Browse Source

Correction

v0.9.0
Ulrich Van Den Hekke 12 years ago
parent
commit
7bafc28675
  1. BIN
      datas/snipets.db
  2. 43
      framework/contentview2/contentview2completionmodel.cpp
  3. 15
      framework/contentview2/contentview2file.cpp
  4. 4
      framework/contentview2/contentview2file.h
  5. 2
      framework/core/exceptions.cpp
  6. 239
      plugins/generix/configuration/gceconfiguration.cpp
  7. 240
      plugins/generix/configuration/gceconfigurationdef.cpp
  8. 4
      plugins/generix/configuration/gceconfigurationdef.h
  9. 270
      plugins/generix/configuration/gceconfigurationxmlparser.cpp
  10. 72
      plugins/generix/configuration/gceconfigurationxmlparser.h
  11. 222
      plugins/generix/configuration/gceproperties.cpp
  12. 3
      plugins/generix/configuration/gceproperties.h
  13. 183
      plugins/generix/generix.pro
  14. 1
      xinx/mainformimpl.cpp

BIN
datas/snipets.db

Binary file not shown.

43
framework/contentview2/contentview2completionmodel.cpp

@ -128,28 +128,33 @@ QString CompletionModel::whereClause() const
void CompletionModel::select()
{
if (m_file.isValid(m_db))
m_file.reload(m_db);
QSqlQuery query(m_db);
// Order by clause
QString queryStr =
"SELECT cv_node.display_name, cv_node.name, cv_node.icon, cv_node.id, cv_node.type, cv_node.completion_value "
"FROM cv_node, cv_file " + whereClause() + " AND cv_node.display_name like ifnull(:prefix,'')||'%' "
"ORDER BY lower(cv_node.display_name) LIMIT 5";
// Set the query used all snipet
query.prepare(queryStr);
query.bindValue(":project_id", m_file.file(m_db).projectId());
query.bindValue(":id1", m_file.file(m_db).fileId());
query.bindValue(":id2", m_file.file(m_db).fileId());
query.bindValue(":prefix", m_prefix);
bool result = query.exec();
if (result)
{
m_file.reload(m_db);
QSqlQuery query(m_db);
// Order by clause
QString queryStr =
"SELECT cv_node.display_name, cv_node.name, cv_node.icon, cv_node.id, cv_node.type, cv_node.completion_value "
"FROM cv_node, cv_file " + whereClause() + " AND cv_node.display_name like ifnull(:prefix,'')||'%' "
"ORDER BY lower(cv_node.display_name) LIMIT 5";
// Set the query used all snipet
query.prepare(queryStr);
query.bindValue(":project_id", m_file.file(m_db).projectId());
query.bindValue(":id1", m_file.file(m_db).fileId());
query.bindValue(":id2", m_file.file(m_db).fileId());
query.bindValue(":prefix", m_prefix);
bool result = query.exec();
Q_ASSERT_X(result, "CompletionModel::select", qPrintable(query.lastError().text()));
setQuery(query);
}
else
{
ErrorManager::self()->addMessage(m_file.path(), -1, ErrorManager::MessageInformation, tr("Completion not ready"));
Q_ASSERT_X(result, "CompletionModel::select", qPrintable(query.lastError().text()));
}
}
FileContainer CompletionModel::file() const

15
framework/contentview2/contentview2file.cpp

@ -137,6 +137,21 @@ FileContainer::~FileContainer()
{
}
XinxProject * FileContainer::project() const
{
return d->m_project;
}
const QString & FileContainer::path() const
{
return d->m_path;
}
bool FileContainer::isCached() const
{
return d->m_cached;
}
File FileContainer::file(QSqlDatabase db) const
{
d->load(db);

4
framework/contentview2/contentview2file.h

@ -68,6 +68,10 @@ public:
FileContainer(QPointer<XinxProject> project, const QString & path, bool isCached);
~FileContainer();
XinxProject * project() const;
const QString & path() const;
bool isCached() const;
File file(QSqlDatabase db) const;
void reload(QSqlDatabase db);
bool isValid(QSqlDatabase db) const;

2
framework/core/exceptions.cpp

@ -205,7 +205,7 @@ ExceptionManager * ExceptionManager::self()
XinxException::XinxException(const QString & message) : m_message(message), m_locationLine(-1)
{
m_stack = ExceptionManager::self()->stackTrace(); //[ (unsigned long)QThread::currentThreadId() ];
}
XinxException::XinxException(const QString & assertion, const QString & locationFile, int locationLine, const QString & locationMethod, const QString & message)

239
plugins/generix/configuration/gceconfiguration.cpp

@ -19,6 +19,7 @@
// Xinx header
#include "gceconfiguration.h"
#include "gceconfigurationxmlparser.h"
// Qt header
#include <QXmlStreamReader>
@ -27,245 +28,13 @@
#include <QDebug>
#include <QDir>
/* GceConfigurationParser */
class GceConfigurationParser : public QXmlStreamReader
{
public:
GceConfigurationParser();
bool loadFromFile(const QString & filename);
/* OUTPUT */
QString m_version, m_rootPath;
int m_edition;
QMultiHash<QString,BusinessViewInformation> m_fileRefToInformation;
private:
void readUnknownElement();
void readConfigElement();
void readVersionElement();
void readApplicationElement();
void readBusinessViewDef();
void readBusinessViewDefElement();
void readPresentation();
void readPresentationElement();
QString m_configurationFileName;
QHash<QString,BusinessViewInformation> m_nameToInformation;
QMultiHash<QString,QString> m_fileRefToName;
};
GceConfigurationParser::GceConfigurationParser()
{
}
bool GceConfigurationParser::loadFromFile(const QString & filename)
{
m_fileRefToName.clear();
m_nameToInformation.clear();
m_configurationFileName = filename;
QFile device(filename);
if (! device.open(QFile::ReadOnly))
{
return false;
}
setDevice(&device);
while (! atEnd())
{
readNext();
if (isStartElement())
{
if (name() == "config")
readConfigElement();
else
raiseError("The file is not a configuration file.");
}
}
m_fileRefToInformation.clear();
foreach(const QString & bvName, m_fileRefToName.keys())
{
foreach(const QString & fileRef, m_fileRefToName.values(bvName))
{
const QString ref = m_rootPath + "/" + fileRef;
m_fileRefToInformation.insert(ref, m_nameToInformation.value(bvName));
}
}
return ! error();
}
void GceConfigurationParser::readUnknownElement()
{
Q_ASSERT(isStartElement());
while (!atEnd())
{
readNext();
if (isEndElement())
break;
if (isStartElement())
readUnknownElement();
}
}
void GceConfigurationParser::readConfigElement()
{
Q_ASSERT(isStartElement() && (QXmlStreamReader::name() == "config"));
while (!atEnd())
{
readNext();
if (isEndElement())
break;
if (isStartElement())
{
if (QXmlStreamReader::name() == "version")
readVersionElement();
else if (QXmlStreamReader::name() == "application")
readApplicationElement();
else
readUnknownElement();
}
}
}
void GceConfigurationParser::readVersionElement()
{
Q_ASSERT(isStartElement() && (QXmlStreamReader::name() == "version"));
while (!atEnd())
{
readNext();
if (isEndElement())
break;
if (isStartElement())
{
if (QXmlStreamReader::name() == "numero")
m_version = readElementText();
else if (QXmlStreamReader::name() == "edition_speciale")
m_edition = readElementText().toInt();
else
readUnknownElement();
}
}
}
void GceConfigurationParser::readApplicationElement()
{
Q_ASSERT(isStartElement() && (QXmlStreamReader::name() == "application"));
while (!atEnd())
{
readNext();
if (isEndElement())
break;
if (isStartElement())
{
if (QXmlStreamReader::name() == "businessview_def")
{
readBusinessViewDef();
}
else if (QXmlStreamReader::name() == "presentation")
{
readPresentation();
}
else
readUnknownElement();
}
}
}
void GceConfigurationParser::readBusinessViewDef()
{
Q_ASSERT(isStartElement() && (QXmlStreamReader::name() == "businessview_def"));
while (!atEnd())
{
readNext();
if (isEndElement())
break;
if (isStartElement())
{
if (QXmlStreamReader::name() == "businessview")
{
readBusinessViewDefElement();
}
else
readUnknownElement();
}
}
}
void GceConfigurationParser::readBusinessViewDefElement()
{
Q_ASSERT(isStartElement() && (QXmlStreamReader::name() == "businessview"));
BusinessViewInformation information;
information.setBusinessViewName(attributes().value("name").toString());
information.setTargetName(attributes().value("target").toString());
information.setViewstructName(attributes().value("viewstruct").toString());
information.setConfigurationFileName(m_configurationFileName);
information.setConfigurationNumber(-1);
m_nameToInformation.insert(information.businesViewName(), information);
readUnknownElement();
}
void GceConfigurationParser::readPresentation()
{
Q_ASSERT(isStartElement() && (QXmlStreamReader::name() == "presentation"));
if (! attributes().value("rootPath").isEmpty())
m_rootPath = attributes().value("rootPath").toString();
while (!atEnd())
{
readNext();
if (isEndElement())
break;
if (isStartElement())
readPresentationElement();
}
}
void GceConfigurationParser::readPresentationElement()
{
Q_ASSERT(isStartElement());
const QString bv = attributes().value("businessview").toString();
const QString fr = attributes().value("fileRef").toString();
if (! m_fileRefToName.values(bv).contains(fr))
m_fileRefToName.insert(bv, fr);
readUnknownElement();
}
/* GceConfiguration */
GceConfiguration::GceConfiguration(const QString & filename) : m_configurationFileName(filename)
{
GceConfigurationParser parser;
GceConfigurationXmlParser parser;
parser.m_configurationNumber = -1;
parser.m_parent = 0;
parser.loadFromFile(filename);
m_fileToInformation = parser.m_fileRefToInformation;

240
plugins/generix/configuration/gceconfigurationdef.cpp

@ -19,6 +19,7 @@
// Xinx header
#include "gceconfigurationdef.h"
#include "gceconfigurationxmlparser.h"
// Qt header
#include <QXmlStreamReader>
@ -29,242 +30,6 @@
#include <QDir>
#include <QFile>
/* GceConfigurationDefParser */
class GceConfigurationDefParser : public QXmlStreamReader
{
public:
GceConfigurationDefParser();
bool loadFromFile(const QString & filename);
/* INPUT */
int m_configurationNumber;
/* OUTPUT */
QString m_version, m_rootPath;
int m_edition;
QMultiHash<QString,BusinessViewInformation> m_fileRefToInformation;
private:
void readUnknownElement();
void readConfigElement();
void readVersionElement();
void readApplicationElement();
void readBusinessViewDef();
void readBusinessViewDefElement();
void readPresentation();
void readPresentationElement();
QString m_configurationFileName;
QHash<QString,BusinessViewInformation> m_nameToInformation;
QMultiHash<QString,QString> m_fileRefToName;
};
GceConfigurationDefParser::GceConfigurationDefParser()
{
}
bool GceConfigurationDefParser::loadFromFile(const QString & filename)
{
m_configurationFileName = filename;
QFile device(filename);
if (! device.open(QFile::ReadOnly))
{
return false;
}
setDevice(&device);
while (! atEnd())
{
readNext();
if (isStartElement())
{
if (name() == "config")
readConfigElement();
else
raiseError("The file is not a configuration file.");
}
}
m_fileRefToInformation.clear();
foreach(const QString & bvName, m_fileRefToName.keys())
{
foreach(const QString & fileRef, m_fileRefToName.values(bvName))
{
const QString ref = m_rootPath + "/" + fileRef;
m_fileRefToInformation.insert(ref, m_nameToInformation.value(bvName));
}
}
return ! error();
}
void GceConfigurationDefParser::readUnknownElement()
{
Q_ASSERT(isStartElement());
while (!atEnd())
{
readNext();
if (isEndElement())
break;
if (isStartElement())
readUnknownElement();
}
}
void GceConfigurationDefParser::readConfigElement()
{
Q_ASSERT(isStartElement() && (QXmlStreamReader::name() == "config"));
while (!atEnd())
{
readNext();
if (isEndElement())
break;
if (isStartElement())
{
if (QXmlStreamReader::name() == "version")
readVersionElement();
else if (QXmlStreamReader::name() == "application")
readApplicationElement();
else
readUnknownElement();
}
}
}
void GceConfigurationDefParser::readVersionElement()
{
Q_ASSERT(isStartElement() && (QXmlStreamReader::name() == "version"));
while (!atEnd())
{
readNext();
if (isEndElement())
break;
if (isStartElement())
{
if (QXmlStreamReader::name() == "numero")
m_version = readElementText();
else if (QXmlStreamReader::name() == "edition_speciale")
m_edition = readElementText().toInt();
else
readUnknownElement();
}
}
}
void GceConfigurationDefParser::readApplicationElement()
{
Q_ASSERT(isStartElement() && (QXmlStreamReader::name() == "application"));
while (!atEnd())
{
readNext();
if (isEndElement())
break;
if (isStartElement())
{
if (QXmlStreamReader::name() == "businessview_def")
{
readBusinessViewDef();
}
else if (QXmlStreamReader::name() == "presentation")
{
readPresentation();
}
else
readUnknownElement();
}
}
}
void GceConfigurationDefParser::readBusinessViewDef()
{
Q_ASSERT(isStartElement() && (QXmlStreamReader::name() == "businessview_def"));
while (!atEnd())
{
readNext();
if (isEndElement())
break;
if (isStartElement())
{
if (QXmlStreamReader::name() == "businessview")
{
readBusinessViewDefElement();
}
else
readUnknownElement();
}
}
}
void GceConfigurationDefParser::readBusinessViewDefElement()
{
Q_ASSERT(isStartElement() && (QXmlStreamReader::name() == "businessview"));
BusinessViewInformation information;
information.setBusinessViewName(attributes().value("name").toString());
information.setTargetName(attributes().value("target").toString());
information.setViewstructName(attributes().value("viewstruct").toString());
information.setConfigurationFileName(m_configurationFileName);
information.setConfigurationNumber(m_configurationNumber);
m_nameToInformation.insert(information.businesViewName(), information);
readUnknownElement();
}
void GceConfigurationDefParser::readPresentation()
{
Q_ASSERT(isStartElement() && (QXmlStreamReader::name() == "presentation"));
if (! attributes().value("rootPath").isEmpty())
m_rootPath = attributes().value("rootPath").toString();
while (!atEnd())
{
readNext();
if (isEndElement())
break;
if (isStartElement())
readPresentationElement();
}
}
void GceConfigurationDefParser::readPresentationElement()
{
Q_ASSERT(isStartElement());
const QString bv = attributes().value("businessview").toString();
const QString fr = attributes().value("fileRef").toString();
if (! m_fileRefToName.values(bv).contains(fr))
m_fileRefToName.insert(bv, fr);
readUnknownElement();
}
/* GceConfigurationDef */
GceConfigurationDef::GceConfigurationDef()
@ -327,7 +92,8 @@ void GceConfigurationDef::readConfigurationDef(const QString & configurationdefF
void GceConfigurationDef::readConfigurationFile(int configurationIndex, const QString & configurationFileName)
{
GceConfigurationDefParser parser;
GceConfigurationXmlParser parser;
parser.m_parent = this;
parser.m_configurationNumber = configurationIndex;
parser.loadFromFile(configurationFileName);
m_filenames.append(configurationFileName);

4
plugins/generix/configuration/gceconfigurationdef.h

@ -28,6 +28,8 @@
#include <QMultiHash>
#include <QCoreApplication>
class GceConfigurationXmlParser;
class GceConfigurationDef : public GceInterface
{
Q_DECLARE_TR_FUNCTIONS(GceConfigurationDef)
@ -51,6 +53,8 @@ protected:
QString m_configurationFileName, m_directoryPath;
ConfigurationVersion m_version;
QMultiHash<QString,BusinessViewInformation> m_fileToInformation;
friend class GceConfigurationXmlParser;
};
#endif // GCECONFIGURATIONDEF_H

270
plugins/generix/configuration/gceconfigurationxmlparser.cpp

@ -0,0 +1,270 @@
/* *********************************************************************** *
* XINX *
* Copyright (C) 2010 by Ulrich Van Den Hekke *
* ulrich.vdh@shadoware.org *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *********************************************************************** */
// Xinx header
#include "gceconfigurationxmlparser.h"
#include "gceconfigurationdef.h"
// 150 = V06.01-50
const ConfigurationVersion version150(6, 1, 50, 0);
/* GceConfigurationXmlParser */
GceConfigurationXmlParser::GceConfigurationXmlParser()
{
}
bool GceConfigurationXmlParser::loadFromFile(const QString & filename)
{
m_fileRefToName.clear();
m_nameToInformation.clear();
m_configurationFileName = filename;
QFile device(filename);
if (! device.open(QFile::ReadOnly))
{
return false;
}
setDevice(&device);
while (! atEnd())
{
readNext();
if (isStartElement())
{
if (name() == "config")
readConfigElement();
else
raiseError("The file is not a configuration file.");
}
}
if (ConfigurationVersion(m_version) < version150)
{
m_fileRefToInformation.clear();
foreach(const QString & bvName, m_fileRefToName.keys())
{
foreach(const QString & fileRef, m_fileRefToName.values(bvName))
{
const QString ref = m_rootPath + "/" + fileRef;
m_fileRefToInformation.insert(ref, m_nameToInformation.value(bvName));
}
}
}
return ! error();
}
void GceConfigurationXmlParser::readUnknownElement()
{
Q_ASSERT(isStartElement());
while (!atEnd())
{
readNext();
if (isEndElement())
break;
if (isStartElement())
readUnknownElement();
}
}
void GceConfigurationXmlParser::readConfigElement()
{
Q_ASSERT(isStartElement() && (QXmlStreamReader::name() == "config"));
while (!atEnd())
{
readNext();
if (isEndElement())
break;
if (isStartElement())
{
if (QXmlStreamReader::name() == "version")
readVersionElement();
else if (QXmlStreamReader::name() == "application")
readApplicationElement();
else
readUnknownElement();
}
}
}
void GceConfigurationXmlParser::readVersionElement()
{
Q_ASSERT(isStartElement() && (QXmlStreamReader::name() == "version"));
while (!atEnd())
{
readNext();
if (isEndElement())
break;
if (isStartElement())
{
if (QXmlStreamReader::name() == "numero")
m_version = readElementText();
else if (QXmlStreamReader::name() == "edition_speciale")
m_edition = readElementText().toInt();
else
readUnknownElement();
}
}
}
void GceConfigurationXmlParser::readApplicationElement()
{
Q_ASSERT(isStartElement() && (QXmlStreamReader::name() == "application"));
while (!atEnd())
{
readNext();
if (isEndElement())
break;
if (isStartElement())
{
QString name = QXmlStreamReader::name().toString();
if (QXmlStreamReader::name() == "businessview_def")
{
readBusinessViewDef();
}
else if ((ConfigurationVersion(m_version) < version150) && (QXmlStreamReader::name() == "presentation"))
{
readPresentation();
}
else
readUnknownElement();
}
}
}
void GceConfigurationXmlParser::readBusinessViewDef()
{
Q_ASSERT(isStartElement() && (QXmlStreamReader::name() == "businessview_def"));
while (!atEnd())
{
readNext();
if (isEndElement())
break;
if (isStartElement())
{
if (QXmlStreamReader::name() == "businessview")
{
readBusinessViewDefElement();
}
else
readUnknownElement();
}
}
}
void GceConfigurationXmlParser::readBusinessViewDefElement()
{
Q_ASSERT(isStartElement() && (QXmlStreamReader::name() == "businessview"));
BusinessViewInformation information;
information.setBusinessViewName(attributes().value("name").toString());
information.setTargetName(attributes().value("target").toString());
information.setViewstructName(attributes().value("viewstruct").toString());
information.setConfigurationFileName(m_configurationFileName);
information.setConfigurationNumber(m_configurationNumber);
m_nameToInformation.insert(information.businesViewName(), information);
if (ConfigurationVersion(m_version) >= version150)
{
while (!atEnd())
{
readNext();
if (isEndElement())
break;
if (isStartElement())
readPresentationElement(information);
}
}
else
{
readUnknownElement();
}
}
void GceConfigurationXmlParser::readPresentationElement(const BusinessViewInformation & information)
{
Q_ASSERT(isStartElement());
QString fileRef = attributes().value("fileRef").toString();
if (m_parent)
{
fileRef = m_parent->resolveFileName(fileRef);
if (QDir(fileRef).isAbsolute())
{
fileRef = QDir(m_parent->m_directoryPath).relativeFilePath(fileRef);
}
}
m_fileRefToInformation.insert(fileRef, information);
readUnknownElement();
}
void GceConfigurationXmlParser::readPresentation()
{
Q_ASSERT(isStartElement() && (QXmlStreamReader::name() == "presentation"));
if (! attributes().value("rootPath").isEmpty())
m_rootPath = attributes().value("rootPath").toString();
while (!atEnd())
{
readNext();
if (isEndElement())
break;
if (isStartElement())
readPresentationElement();
}
}
void GceConfigurationXmlParser::readPresentationElement()
{
Q_ASSERT(isStartElement());
const QString bv = attributes().value("businessview").toString();
const QString fr = attributes().value("fileRef").toString();
if (! m_fileRefToName.values(bv).contains(fr))
m_fileRefToName.insert(bv, fr);
readUnknownElement();
}

72
plugins/generix/configuration/gceconfigurationxmlparser.h

@ -0,0 +1,72 @@
/* *********************************************************************** *
* XINX *
* Copyright (C) 2010 by Ulrich Van Den Hekke *
* ulrich.vdh@shadoware.org *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *********************************************************************** */
#pragma once
#ifndef GCECONFIGURATIONXMLPARSER_H
#define GCECONFIGURATIONXMLPARSER_H
// Xinx header
#include "configurationfile.h"
// Qt header
#include <QXmlStreamReader>
#include <QIODevice>
#include <QDebug>
#include <QDomDocument>
#include <QFileInfo>
#include <QDir>
#include <QFile>
class GceConfigurationDef;
class GceConfigurationXmlParser : public QXmlStreamReader
{
public:
GceConfigurationXmlParser();
bool loadFromFile(const QString & filename);
/* INPUT */
GceConfigurationDef * m_parent;
int m_configurationNumber;
/* OUTPUT */
QString m_version, m_rootPath;
int m_edition;
QMultiHash<QString,BusinessViewInformation> m_fileRefToInformation;
private:
void readUnknownElement();
void readConfigElement();
void readVersionElement();
void readApplicationElement();
void readBusinessViewDef();
void readBusinessViewDefElement();
void readPresentationElement(const BusinessViewInformation & information);
void readPresentation();
void readPresentationElement();
QString m_configurationFileName;
QHash<QString,BusinessViewInformation> m_nameToInformation;
QMultiHash<QString,QString> m_fileRefToName;
};
#endif // GCECONFIGURATIONXMLPARSER_H

222
plugins/generix/configuration/gceproperties.cpp

@ -37,216 +37,6 @@
#include <libxml/xpathInternals.h>
#include <libxml/tree.h>
/* GceConfiguration150Parser */
class GceConfiguration150Parser : public QXmlStreamReader
{
public:
GceConfiguration150Parser();
bool loadFromFile(const QString & filename);
/* INPUT */
GceProperties * m_parent;
int m_configurationNumber;
/* OUTPUT */
QString m_version;
int m_edition;
QMultiHash<QString,BusinessViewInformation> m_fileRefToInformation;
private:
void readUnknownElement();
void readConfigElement();
void readVersionElement();
void readApplicationElement();
void readBusinessViewDef();
void readBusinessViewDefElement();
void readPresentationElement(const BusinessViewInformation & information);
QString m_configurationFileName;
};
GceConfiguration150Parser::GceConfiguration150Parser()
{
}
bool GceConfiguration150Parser::loadFromFile(const QString & filename)
{
m_configurationFileName = filename;
QFile device(filename);
if (! device.open(QFile::ReadOnly))
{
return false;
}
setDevice(&device);
while (! atEnd())
{
readNext();
if (isStartElement())
{
if (name() == "config")
readConfigElement();
else
raiseError("The file is not a configuration file.");
}
}
return ! error();
}
void GceConfiguration150Parser::readUnknownElement()
{
Q_ASSERT(isStartElement());
while (!atEnd())
{
readNext();
if (isEndElement())
break;
if (isStartElement())
readUnknownElement();
}
}
void GceConfiguration150Parser::readConfigElement()
{
Q_ASSERT(isStartElement() && (QXmlStreamReader::name() == "config"));
while (!atEnd())
{
readNext();
if (isEndElement())
break;
if (isStartElement())
{
if (QXmlStreamReader::name() == "version")
readVersionElement();
else if (QXmlStreamReader::name() == "application")
readApplicationElement();
else
readUnknownElement();
}
}
}
void GceConfiguration150Parser::readVersionElement()
{
Q_ASSERT(isStartElement() && (QXmlStreamReader::name() == "version"));
while (!atEnd())
{
readNext();
if (isEndElement())
break;
if (isStartElement())
{
if (QXmlStreamReader::name() == "numero")
m_version = readElementText();
else if (QXmlStreamReader::name() == "edition_speciale")
m_edition = readElementText().toInt();
else
readUnknownElement();
}
}
}
void GceConfiguration150Parser::readApplicationElement()
{
Q_ASSERT(isStartElement() && (QXmlStreamReader::name() == "application"));
while (!atEnd())
{
readNext();
if (isEndElement())
break;
if (isStartElement())
{
if (QXmlStreamReader::name() == "businessview_def")
{
readBusinessViewDef();
}
else
readUnknownElement();
}
}
}
void GceConfiguration150Parser::readBusinessViewDef()
{
Q_ASSERT(isStartElement() && (QXmlStreamReader::name() == "businessview_def"));
while (!atEnd())
{
readNext();
if (isEndElement())
break;
if (isStartElement())
{
if (QXmlStreamReader::name() == "businessview")
{
readBusinessViewDefElement();
}
else
readUnknownElement();
}
}
}
void GceConfiguration150Parser::readBusinessViewDefElement()
{
Q_ASSERT(isStartElement() && (QXmlStreamReader::name() == "businessview"));
BusinessViewInformation information;
information.setBusinessViewName(attributes().value("name").toString());
information.setTargetName(attributes().value("target").toString());
information.setViewstructName(attributes().value("viewstruct").toString());
information.setConfigurationFileName(m_configurationFileName);
information.setConfigurationNumber(m_configurationNumber);
while (!atEnd())
{
readNext();
if (isEndElement())
break;
if (isStartElement())
readPresentationElement(information);
}
}
void GceConfiguration150Parser::readPresentationElement(const BusinessViewInformation & information)
{
Q_ASSERT(isStartElement());
QString fileRef = m_parent->resolveFileName(attributes().value("fileRef").toString());
if (QDir(fileRef).isAbsolute())
{
fileRef = QDir(m_parent->m_directoryPath).relativeFilePath(fileRef);
}
m_fileRefToInformation.insert(fileRef, information);
readUnknownElement();
}
/* GceProperties */
GceProperties::GceProperties(const QString & filename) : GceConfigurationDef(), m_propertiesFilename(filename)
@ -337,18 +127,6 @@ void GceProperties::readGceProperties(const QString & propertiesFileName)
}
void GceProperties::readConfigurationFile(int configurationIndex, const QString & configurationFileName)
{
GceConfiguration150Parser parser;
parser.m_parent = this;
parser.m_configurationNumber = configurationIndex;
parser.loadFromFile(configurationFileName);
m_filenames.append(configurationFileName);
m_fileToInformation += parser.m_fileRefToInformation;
m_version = ConfigurationVersion(parser.m_version, parser.m_edition);
}
QStringList GceProperties::generateFileName(const QString & filename)
{
QStack<QString> nameToResolve;

3
plugins/generix/configuration/gceproperties.h

@ -42,14 +42,11 @@ public:
virtual QString resolveFileName(const QString & filename);
protected:
virtual void readGceProperties(const QString & propertiesFileName);
virtual void readConfigurationFile(int configurationIndex, const QString & configurationFileName);
QStringList m_dictionnaries, m_filenames;
QString m_propertiesFilename, m_configurationDef;
QHash<QString,QStringList> m_policy;
friend class GceConfiguration150Parser;
};
#endif // GCEPROPERTIES_H

183
plugins/generix/generix.pro

@ -1,89 +1,94 @@
include(../../project_mode.pri)
TEMPLATE = lib
VERSION = 1.0.0.1
CONFIG += plugin
QT += xml \
xmlpatterns \
sql
DESTDIR += ../
LIBS += -L../../components \
-lxinxcmp \
-L../../framework \
-lxinxframework
win32:LIBS += -lwsock32 -llibxml2 -llibxslt
unix:LIBS += -lxml2 -lxslt
TARGET = generix
INCLUDEPATH += ../../framework \
../../components
unix:INCLUDEPATH += /usr/include/libxml2
RESOURCES = plugindefinition/generix.qrc
TRANSLATIONS += plugindefinition/translations/dictionary_fr.ts
HEADERS = config/generixsettings.h \
config/selfgenerixsettings.h \
plugindefinition/generix.h \
docks/dictionary/dictionarydockwidgetimpl.h \
docks/dictionary/dictionaryparser.h \
pluginresolver/gce150fileresolver.h \
configuration/configurationfile.h \
config/customgeneriximpl.h \
config/specifiquemodelindex.h \
configuration/gceinterface.h \
configuration/gceinterfacefactory.h \
configuration/gceconfiguration.h \
configuration/gceconfigurationdef.h \
configuration/gceproperties.h \
projectproperty/std/generixprojectpageform.h \
projectproperty/std/generixderivationpage.h \
projectproperty/std/generixderivationoptionspage.h \
projectproperty/wizard/newgenerixinformationpageimpl.h \
projectproperty/wizard/newgenerixderivation1page.h \
projectproperty/wizard/newgenerixderivation2page.h \
projectproperty/wizard/newgenerixderivation3page.h \
projectproperty/generixproject.h \
configuration/configurationfileedit.h \
configuration/configurationmanager.h \
docks/project/generixprojectdock.h \
savedialog/derivationdialogimpl.h \
parser/generixxsltparser.h \
docks/dictionary/dictionarywidget.h
SOURCES = config/generixsettings.cpp \
config/selfgenerixsettings.cpp \
plugindefinition/generix.cpp \
docks/dictionary/dictionarydockwidgetimpl.cpp \
docks/dictionary/dictionaryparser.cpp \
pluginresolver/gce150fileresolver.cpp \
configuration/configurationfile.cpp \
config/customgeneriximpl.cpp \
config/specifiquemodelindex.cpp \
configuration/gceinterface.cpp \
configuration/gceinterfacefactory.cpp \
configuration/gceconfiguration.cpp \
configuration/gceconfigurationdef.cpp \
configuration/gceproperties.cpp \
projectproperty/std/generixprojectpageform.cpp \
projectproperty/std/generixderivationpage.cpp \
projectproperty/std/generixderivationoptionspage.cpp \
projectproperty/wizard/newgenerixinformationpageimpl.cpp \
projectproperty/wizard/newgenerixderivation1page.cpp \
projectproperty/wizard/newgenerixderivation2page.cpp \
projectproperty/wizard/newgenerixderivation3page.cpp \
projectproperty/generixproject.cpp \
configuration/configurationfileedit.cpp \
configuration/configurationmanager.cpp \
docks/project/generixprojectdock.cpp \
savedialog/derivationdialogimpl.cpp \
parser/generixxsltparser.cpp \
docks/dictionary/dictionarywidget.cpp
win32:RC_FILE += rc/plugin.rc
FORMS += ui/dictionarydockwidget.ui \
config/customgenerix.ui \
projectproperty/std/generixprojectpageform.ui \
projectproperty/std/generixderivationpage.ui \
projectproperty/std/generixderivationoptionspage.ui \
projectproperty/wizard/newgenerixinformationpage.ui \
projectproperty/wizard/newgenerixderivation1page.ui \
projectproperty/wizard/newgenerixderivation2page.ui \
projectproperty/wizard/newgenerixderivation3page.ui \
docks/project/gnxprojectdock.ui \
savedialog/derivationdialog.ui
include(../../ext/qmodeltest/modeltest.pri)
include(../../project_mode.pri)
TEMPLATE = lib
VERSION = 1.0.0.1
CONFIG += plugin
QT += xml \
xmlpatterns \
sql
DESTDIR += ../
LIBS += -L../../components \
-lxinxcmp \
-L../../framework \
-lxinxframework
win32:LIBS += -lwsock32 \
-llibxml2 \
-llibxslt
unix:LIBS += -lxml2 \
-lxslt
TARGET = generix
INCLUDEPATH += ../../framework \
../../components
unix:INCLUDEPATH += /usr/include/libxml2
RESOURCES = plugindefinition/generix.qrc
TRANSLATIONS += plugindefinition/translations/dictionary_fr.ts
HEADERS = config/generixsettings.h \
config/selfgenerixsettings.h \
plugindefinition/generix.h \
docks/dictionary/dictionarydockwidgetimpl.h \
docks/dictionary/dictionaryparser.h \
pluginresolver/gce150fileresolver.h \
configuration/configurationfile.h \
config/customgeneriximpl.h \
config/specifiquemodelindex.h \
configuration/gceinterface.h \
configuration/gceinterfacefactory.h \
configuration/gceconfiguration.h \
configuration/gceconfigurationdef.h \
configuration/gceproperties.h \
projectproperty/std/generixprojectpageform.h \
projectproperty/std/generixderivationpage.h \
projectproperty/std/generixderivationoptionspage.h \
projectproperty/wizard/newgenerixinformationpageimpl.h \
projectproperty/wizard/newgenerixderivation1page.h \
projectproperty/wizard/newgenerixderivation2page.h \
projectproperty/wizard/newgenerixderivation3page.h \
projectproperty/generixproject.h \
configuration/configurationfileedit.h \
configuration/configurationmanager.h \
docks/project/generixprojectdock.h \
savedialog/derivationdialogimpl.h \
parser/generixxsltparser.h \
docks/dictionary/dictionarywidget.h \
configuration/gceconfigurationxmlparser.h
SOURCES = config/generixsettings.cpp \
config/selfgenerixsettings.cpp \
plugindefinition/generix.cpp \
docks/dictionary/dictionarydockwidgetimpl.cpp \
docks/dictionary/dictionaryparser.cpp \
pluginresolver/gce150fileresolver.cpp \
configuration/configurationfile.cpp \
config/customgeneriximpl.cpp \
config/specifiquemodelindex.cpp \
configuration/gceinterface.cpp \
configuration/gceinterfacefactory.cpp \
configuration/gceconfiguration.cpp \
configuration/gceconfigurationdef.cpp \
configuration/gceproperties.cpp \
projectproperty/std/generixprojectpageform.cpp \
projectproperty/std/generixderivationpage.cpp \
projectproperty/std/generixderivationoptionspage.cpp \
projectproperty/wizard/newgenerixinformationpageimpl.cpp \
projectproperty/wizard/newgenerixderivation1page.cpp \
projectproperty/wizard/newgenerixderivation2page.cpp \
projectproperty/wizard/newgenerixderivation3page.cpp \
projectproperty/generixproject.cpp \
configuration/configurationfileedit.cpp \
configuration/configurationmanager.cpp \
docks/project/generixprojectdock.cpp \
savedialog/derivationdialogimpl.cpp \
parser/generixxsltparser.cpp \
docks/dictionary/dictionarywidget.cpp \
configuration/gceconfigurationxmlparser.cpp
win32:RC_FILE += rc/plugin.rc
FORMS += ui/dictionarydockwidget.ui \
config/customgenerix.ui \
projectproperty/std/generixprojectpageform.ui \
projectproperty/std/generixderivationpage.ui \
projectproperty/std/generixderivationoptionspage.ui \
projectproperty/wizard/newgenerixinformationpage.ui \
projectproperty/wizard/newgenerixderivation1page.ui \
projectproperty/wizard/newgenerixderivation2page.ui \
projectproperty/wizard/newgenerixderivation3page.ui \
docks/project/gnxprojectdock.ui \
savedialog/derivationdialog.ui
include(../../ext/qmodeltest/modeltest.pri)

1
xinx/mainformimpl.cpp

@ -1952,6 +1952,7 @@ void MainformImpl::openProject(const QString & filename)
progressDlg.setMinimumWidth(300);
progressDlg.setMaximum(2 + steps.size());
progressDlg.setValue(0);
progressDlg.show();
progressDlg.setLabelText(tr("Close previous project"));
qApp->processEvents();

Loading…
Cancel
Save