mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-20 08:10:52 +01:00
Ajout d'une option d'execution --config-dir pour redefinir le dossier de configuration (et donc la collection d'elements perso)
Cette option d'execution peut etre desactivee avec l'option de compilation QET_ALLOW_OVERRIDE_CD_OPTION Correction pour l'impression sous Windows git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@211 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
28
qetapp.cpp
28
qetapp.cpp
@@ -6,6 +6,7 @@
|
||||
#define STRINGIFY(x) #x
|
||||
|
||||
QString QETApp::common_elements_dir = QString();
|
||||
QString QETApp::config_dir = QString();
|
||||
|
||||
/**
|
||||
Constructeur
|
||||
@@ -25,6 +26,13 @@ QETApp::QETApp(int &argc, char **argv) : QApplication(argc, argv) {
|
||||
QString ced_value = argument.right(argument.length() - ced_arg.length());
|
||||
overrideCommonElementsDir(ced_value);
|
||||
}
|
||||
#endif
|
||||
#ifdef QET_ALLOW_OVERRIDE_CD_OPTION
|
||||
QString cd_arg("--config-dir=");
|
||||
if (argument.startsWith(cd_arg)) {
|
||||
QString cd_value = argument.right(argument.length() - cd_arg.length());
|
||||
overrideConfigDir(cd_value);
|
||||
}
|
||||
#endif
|
||||
bool must_exit = false;
|
||||
if (argument == QString("--help")) {
|
||||
@@ -231,6 +239,9 @@ QString QETApp::customElementsDir() {
|
||||
@return Le chemin du dossier de configuration de QElectroTech
|
||||
*/
|
||||
QString QETApp::configDir() {
|
||||
#ifdef QET_ALLOW_OVERRIDE_CD_OPTION
|
||||
if (config_dir != QString()) return(config_dir);
|
||||
#endif
|
||||
#ifdef Q_OS_WIN32
|
||||
return(QDir::homePath() + "/Application Data/qet/");
|
||||
#else
|
||||
@@ -278,7 +289,8 @@ QString QETApp::symbolicPath(const QString &real_path) {
|
||||
|
||||
#ifdef QET_ALLOW_OVERRIDE_CED_OPTION
|
||||
/**
|
||||
Redefinit le chemin du dossier des elements communs.
|
||||
Redefinit le chemin du dossier des elements communs
|
||||
@param new_ced Nouveau chemin du dossier des elements communs
|
||||
*/
|
||||
void QETApp::overrideCommonElementsDir(const QString &new_ced) {
|
||||
QFileInfo new_ced_info(new_ced);
|
||||
@@ -289,6 +301,20 @@ void QETApp::overrideCommonElementsDir(const QString &new_ced) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef QET_ALLOW_OVERRIDE_CD_OPTION
|
||||
/**
|
||||
Redefinit le chemin du dossier de configuration
|
||||
@param new_cd Nouveau chemin du dossier de configuration
|
||||
*/
|
||||
void QETApp::overrideConfigDir(const QString &new_cd) {
|
||||
QFileInfo new_cd_info(new_cd);
|
||||
if (new_cd_info.isDir()) {
|
||||
config_dir = new_cd_info.absoluteFilePath();
|
||||
if (!config_dir.endsWith("/")) config_dir += "/";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
@return Le chemin du dossier contenant les fichiers de langue
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user