mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-09-13 20:23:04 +02: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:
parent
3abe0be705
commit
be6ba77656
@ -434,7 +434,9 @@ void DiagramView::dialogExport() {
|
|||||||
void DiagramView::dialogPrint() {
|
void DiagramView::dialogPrint() {
|
||||||
// initialise l'acces a l'imprimante
|
// initialise l'acces a l'imprimante
|
||||||
QPrinter qprin;
|
QPrinter qprin;
|
||||||
|
#ifndef Q_OS_WIN32
|
||||||
qprin.setOutputFormat(QPrinter::PdfFormat);
|
qprin.setOutputFormat(QPrinter::PdfFormat);
|
||||||
|
#endif
|
||||||
qprin.setOrientation(QPrinter::Landscape);
|
qprin.setOrientation(QPrinter::Landscape);
|
||||||
qprin.setPageSize(QPrinter::A4);
|
qprin.setPageSize(QPrinter::A4);
|
||||||
QPrintDialog qpd(&qprin, this);
|
QPrintDialog qpd(&qprin, this);
|
||||||
|
@ -3,16 +3,30 @@
|
|||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
# Chemins utilises pour la compilation et l'installation de QET
|
# Chemins utilises pour la compilation et l'installation de QET
|
||||||
COMPIL_PREFIX = '/usr/local/'
|
!win32 {
|
||||||
INSTALL_PREFIX = '/usr/local/'
|
# Chemins UNIX
|
||||||
QET_BINARY_PATH = 'bin/'
|
COMPIL_PREFIX = '/usr/local/'
|
||||||
QET_COMMON_COLLECTION_PATH = 'share/qelectrotech/elements/'
|
INSTALL_PREFIX = '/usr/local/'
|
||||||
QET_LANG_PATH = 'share/qelectrotech/lang/'
|
QET_BINARY_PATH = 'bin/'
|
||||||
QET_LICENSE_PATH = 'doc/qelectrotech/'
|
QET_COMMON_COLLECTION_PATH = 'share/qelectrotech/elements/'
|
||||||
|
QET_LANG_PATH = 'share/qelectrotech/lang/'
|
||||||
|
QET_LICENSE_PATH = 'doc/qelectrotech/'
|
||||||
|
} else {
|
||||||
|
# Chemins Windows
|
||||||
|
COMPIL_PREFIX = './'
|
||||||
|
INSTALL_PREFIX = './'
|
||||||
|
QET_BINARY_PATH = './'
|
||||||
|
QET_COMMON_COLLECTION_PATH = 'elements/'
|
||||||
|
QET_LANG_PATH = 'lang/'
|
||||||
|
QET_LICENSE_PATH = './'
|
||||||
|
}
|
||||||
|
|
||||||
#Commenter la ligne ci-dessous pour desactiver l'option --common-elements-dir
|
# Commenter la ligne ci-dessous pour desactiver l'option --common-elements-dir
|
||||||
DEFINES += QET_ALLOW_OVERRIDE_CED_OPTION
|
DEFINES += QET_ALLOW_OVERRIDE_CED_OPTION
|
||||||
|
|
||||||
|
# Commenter la ligne ci-dessous pour desactiver l'option --config-dir
|
||||||
|
DEFINES += QET_ALLOW_OVERRIDE_CD_OPTION
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
28
qetapp.cpp
28
qetapp.cpp
@ -6,6 +6,7 @@
|
|||||||
#define STRINGIFY(x) #x
|
#define STRINGIFY(x) #x
|
||||||
|
|
||||||
QString QETApp::common_elements_dir = QString();
|
QString QETApp::common_elements_dir = QString();
|
||||||
|
QString QETApp::config_dir = QString();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Constructeur
|
Constructeur
|
||||||
@ -25,6 +26,13 @@ QETApp::QETApp(int &argc, char **argv) : QApplication(argc, argv) {
|
|||||||
QString ced_value = argument.right(argument.length() - ced_arg.length());
|
QString ced_value = argument.right(argument.length() - ced_arg.length());
|
||||||
overrideCommonElementsDir(ced_value);
|
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
|
#endif
|
||||||
bool must_exit = false;
|
bool must_exit = false;
|
||||||
if (argument == QString("--help")) {
|
if (argument == QString("--help")) {
|
||||||
@ -231,6 +239,9 @@ QString QETApp::customElementsDir() {
|
|||||||
@return Le chemin du dossier de configuration de QElectroTech
|
@return Le chemin du dossier de configuration de QElectroTech
|
||||||
*/
|
*/
|
||||||
QString QETApp::configDir() {
|
QString QETApp::configDir() {
|
||||||
|
#ifdef QET_ALLOW_OVERRIDE_CD_OPTION
|
||||||
|
if (config_dir != QString()) return(config_dir);
|
||||||
|
#endif
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN32
|
||||||
return(QDir::homePath() + "/Application Data/qet/");
|
return(QDir::homePath() + "/Application Data/qet/");
|
||||||
#else
|
#else
|
||||||
@ -278,7 +289,8 @@ QString QETApp::symbolicPath(const QString &real_path) {
|
|||||||
|
|
||||||
#ifdef QET_ALLOW_OVERRIDE_CED_OPTION
|
#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) {
|
void QETApp::overrideCommonElementsDir(const QString &new_ced) {
|
||||||
QFileInfo new_ced_info(new_ced);
|
QFileInfo new_ced_info(new_ced);
|
||||||
@ -289,6 +301,20 @@ void QETApp::overrideCommonElementsDir(const QString &new_ced) {
|
|||||||
}
|
}
|
||||||
#endif
|
#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
|
@return Le chemin du dossier contenant les fichiers de langue
|
||||||
*/
|
*/
|
||||||
|
8
qetapp.h
8
qetapp.h
@ -33,10 +33,18 @@ class QETApp : public QApplication {
|
|||||||
static QString realPath(const QString &);
|
static QString realPath(const QString &);
|
||||||
static QString symbolicPath(const QString &);
|
static QString symbolicPath(const QString &);
|
||||||
#ifdef QET_ALLOW_OVERRIDE_CED_OPTION
|
#ifdef QET_ALLOW_OVERRIDE_CED_OPTION
|
||||||
|
public:
|
||||||
static void overrideCommonElementsDir(const QString &);
|
static void overrideCommonElementsDir(const QString &);
|
||||||
private:
|
private:
|
||||||
static QString common_elements_dir;
|
static QString common_elements_dir;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef QET_ALLOW_OVERRIDE_CD_OPTION
|
||||||
|
public:
|
||||||
|
static void overrideConfigDir(const QString &);
|
||||||
|
private:
|
||||||
|
static QString config_dir;
|
||||||
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool event(QEvent *);
|
bool event(QEvent *);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user