mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-01-10 16:19:59 +01:00
* Option Compile-Time pour definir le chemin du dossier des fichiers de traduction : QET_LANG_PATH
* Option Compile-Time pour definir le chemin du dossier des elements communs : QET_COMMON_COLLECTION_PATH * Option Run-Time pour definir le chemin de la collection principale : --common-elements-dir=/path/to/elements/ * Option Compile-Time pour autoriser ou non l'utilisation de l'option Run-Time precedente : QET_ALLOW_OVERRIDE_CED_OPTION Les options Compile-Time sont a definir dans le fichier .pro git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@158 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -3,7 +3,6 @@
|
|||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
TARGET =
|
|
||||||
DEPENDPATH += . editor lang
|
DEPENDPATH += . editor lang
|
||||||
INCLUDEPATH += . editor
|
INCLUDEPATH += . editor
|
||||||
|
|
||||||
@@ -64,10 +63,10 @@ HEADERS += aboutqet.h \
|
|||||||
editor/terminaleditor.h \
|
editor/terminaleditor.h \
|
||||||
editor/texteditor.h \
|
editor/texteditor.h \
|
||||||
editor/textfieldeditor.h \
|
editor/textfieldeditor.h \
|
||||||
diagramcommands.h \
|
diagramcommands.h \
|
||||||
diagramtextitem.h \
|
diagramtextitem.h \
|
||||||
insetproperties.h \
|
insetproperties.h \
|
||||||
conductorproperties.h
|
conductorproperties.h
|
||||||
SOURCES += aboutqet.cpp \
|
SOURCES += aboutqet.cpp \
|
||||||
borderinset.cpp \
|
borderinset.cpp \
|
||||||
conductor.cpp \
|
conductor.cpp \
|
||||||
@@ -125,10 +124,18 @@ SOURCES += aboutqet.cpp \
|
|||||||
editor/texteditor.cpp \
|
editor/texteditor.cpp \
|
||||||
editor/textfieldeditor.cpp \
|
editor/textfieldeditor.cpp \
|
||||||
diagramcommands.cpp \
|
diagramcommands.cpp \
|
||||||
diagramtextitem.cpp \
|
diagramtextitem.cpp \
|
||||||
conductorproperties.cpp
|
conductorproperties.cpp
|
||||||
RESOURCES += qelectrotech.qrc
|
RESOURCES += qelectrotech.qrc
|
||||||
TRANSLATIONS += lang/qet_en.ts lang/qt_fr.ts
|
TRANSLATIONS += lang/qet_en.ts lang/qt_fr.ts
|
||||||
RC_FILE = ico/windows_icon/application_icon/qelectrotech.rc
|
RC_FILE = ico/windows_icon/application_icon/qelectrotech.rc
|
||||||
QT += xml
|
QT += xml
|
||||||
CONFIG += debug_and_release
|
CONFIG += debug_and_release
|
||||||
|
CONFIG(debug, debug|release) {
|
||||||
|
TARGET = qelectrotech
|
||||||
|
} else {
|
||||||
|
TARGET = qelectrotech.release
|
||||||
|
}
|
||||||
|
;DEFINES += QET_LANG_PATH='\\"/path/to/qelectrotech/lang/\\"'
|
||||||
|
;DEFINES += QET_COMMON_COLLECTION_PATH='\\"/path/to/qelectrotech/elements/\\"'
|
||||||
|
DEFINES += QET_ALLOW_OVERRIDE_CED_OPTION
|
||||||
|
|||||||
41
qetapp.cpp
41
qetapp.cpp
@@ -2,6 +2,8 @@
|
|||||||
#include "qetdiagrameditor.h"
|
#include "qetdiagrameditor.h"
|
||||||
#include "qetelementeditor.h"
|
#include "qetelementeditor.h"
|
||||||
|
|
||||||
|
QString QETApp::common_elements_dir = QString();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Constructeur
|
Constructeur
|
||||||
@param argc Nombre d'arguments passes a l'application
|
@param argc Nombre d'arguments passes a l'application
|
||||||
@@ -58,6 +60,17 @@ QETApp::QETApp(int &argc, char **argv) : QApplication(argc, argv) {
|
|||||||
connect(this, SIGNAL(lastWindowClosed()), this, SLOT(checkRemainingWindows()));
|
connect(this, SIGNAL(lastWindowClosed()), this, SLOT(checkRemainingWindows()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// parse les arguments
|
||||||
|
foreach(QString argument, arguments()) {
|
||||||
|
#ifdef QET_ALLOW_OVERRIDE_CED_OPTION
|
||||||
|
QString ced_arg("--common-elements-dir=");
|
||||||
|
if (argument.startsWith(ced_arg)) {
|
||||||
|
QString ced_value = argument.right(argument.length() - ced_arg.length());
|
||||||
|
overrideCommonElementsDir(ced_value);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// Creation et affichage d'un editeur de schema
|
// Creation et affichage d'un editeur de schema
|
||||||
QStringList files;
|
QStringList files;
|
||||||
foreach(QString argument, arguments()) {
|
foreach(QString argument, arguments()) {
|
||||||
@@ -165,7 +178,14 @@ void QETApp::newElementEditor() {
|
|||||||
@return Le chemin du dossier des elements communs
|
@return Le chemin du dossier des elements communs
|
||||||
*/
|
*/
|
||||||
QString QETApp::commonElementsDir() {
|
QString QETApp::commonElementsDir() {
|
||||||
|
#ifdef QET_ALLOW_OVERRIDE_CED_OPTION
|
||||||
|
if (common_elements_dir != QString()) return(common_elements_dir);
|
||||||
|
#endif
|
||||||
|
#ifdef QET_COMMON_COLLECTION_PATH
|
||||||
|
return(QET_COMMON_COLLECTION_PATH);
|
||||||
|
#else
|
||||||
return(QDir::current().path() + "/elements/");
|
return(QDir::current().path() + "/elements/");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -201,7 +221,7 @@ QString QETApp::configDir() {
|
|||||||
@return Une chaine de caracteres vide en cas d'erreur ou le chemin absolu du
|
@return Une chaine de caracteres vide en cas d'erreur ou le chemin absolu du
|
||||||
fichier *.elmt.
|
fichier *.elmt.
|
||||||
*/
|
*/
|
||||||
QString QETApp::realPath(QString &sym_path) {
|
QString QETApp::realPath(const QString &sym_path) {
|
||||||
QString directory;
|
QString directory;
|
||||||
if (sym_path.startsWith("common://")) {
|
if (sym_path.startsWith("common://")) {
|
||||||
directory = commonElementsDir();
|
directory = commonElementsDir();
|
||||||
@@ -218,7 +238,7 @@ QString QETApp::realPath(QString &sym_path) {
|
|||||||
@return Une chaine de caracteres vide en cas d'erreur ou le chemin
|
@return Une chaine de caracteres vide en cas d'erreur ou le chemin
|
||||||
symbolique designant l'element.
|
symbolique designant l'element.
|
||||||
*/
|
*/
|
||||||
QString QETApp::symbolicPath(QString &real_path) {
|
QString QETApp::symbolicPath(const QString &real_path) {
|
||||||
// recupere les dossier common et custom
|
// recupere les dossier common et custom
|
||||||
QString commond = commonElementsDir();
|
QString commond = commonElementsDir();
|
||||||
QString customd = customElementsDir();
|
QString customd = customElementsDir();
|
||||||
@@ -232,11 +252,28 @@ QString QETApp::symbolicPath(QString &real_path) {
|
|||||||
return(chemin);
|
return(chemin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef QET_ALLOW_OVERRIDE_CED_OPTION
|
||||||
|
/**
|
||||||
|
Redefinit le chemin du dossier des elements communs.
|
||||||
|
*/
|
||||||
|
void QETApp::overrideCommonElementsDir(const QString &new_ced) {
|
||||||
|
QFileInfo new_ced_info(new_ced);
|
||||||
|
if (new_ced_info.isDir()) {
|
||||||
|
common_elements_dir = new_ced_info.absoluteFilePath();
|
||||||
|
if (!common_elements_dir.endsWith("/")) common_elements_dir += "/";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@return Le chemin du dossier contenant les fichiers de langue
|
@return Le chemin du dossier contenant les fichiers de langue
|
||||||
*/
|
*/
|
||||||
QString QETApp::languagesPath() {
|
QString QETApp::languagesPath() {
|
||||||
|
#ifndef QET_LANG_PATH
|
||||||
return(QDir::current().path() + "/lang/");
|
return(QDir::current().path() + "/lang/");
|
||||||
|
#else
|
||||||
|
return(QET_LANG_PATH);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
9
qetapp.h
9
qetapp.h
@@ -27,8 +27,13 @@ class QETApp : public QApplication {
|
|||||||
static QString customElementsDir();
|
static QString customElementsDir();
|
||||||
static QString configDir();
|
static QString configDir();
|
||||||
static QString languagesPath();
|
static QString languagesPath();
|
||||||
static QString realPath(QString &);
|
static QString realPath(const QString &);
|
||||||
static QString symbolicPath(QString &);
|
static QString symbolicPath(const QString &);
|
||||||
|
#ifdef QET_ALLOW_OVERRIDE_CED_OPTION
|
||||||
|
static void overrideCommonElementsDir(const QString &);
|
||||||
|
private:
|
||||||
|
static QString common_elements_dir;
|
||||||
|
#endif
|
||||||
|
|
||||||
// attributs
|
// attributs
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user