39 #define QUOTE(x) STRINGIFY(x) 40 #define STRINGIFY(x) #x 41 #include <QProcessEnvironment> 44 #include <KAutoSaveFile> 46 #ifdef QET_ALLOW_OVERRIDE_CED_OPTION 47 QString QETApp::common_elements_dir = QString();
49 #ifdef QET_ALLOW_OVERRIDE_CTBTD_OPTION 50 QString QETApp::common_tbt_dir_ = QString();
52 #ifdef QET_ALLOW_OVERRIDE_CD_OPTION 53 QString QETApp::config_dir = QString();
74 m_splash_screen(nullptr),
75 non_interactive_execution_(false)
80 std::exit(EXIT_SUCCESS);
90 qApp->setQuitOnLastWindowClosed(
false);
93 setSplashScreenStep(
tr(
"Chargement... Initialisation du cache des collections d'éléments",
"splash screen caption"));
156 QString qt_l10n_path = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
157 if (!
qtTranslator.load(
"qt_" + desired_language, qt_l10n_path)) {
158 qtTranslator.load(
"qt_" + desired_language, languages_path);
163 if (!
qetTranslator.load(
"qet_" + desired_language, languages_path)) {
165 if (desired_language !=
"fr") {
172 QString ltr_special_string =
tr(
174 "Translate this string to RTL if you are translating to a Right-to-Left language, else translate to LTR" 176 if (ltr_special_string ==
"RTL")
switchLayout(Qt::RightToLeft);
187 QString system_language = settings.value(
"lang",
"system").toString();
188 if(system_language ==
"system") {system_language = QLocale::system().name().left(2);}
189 return system_language;
195 qApp->setLayoutDirection(direction);
203 if (!QSystemTrayIcon::isSystemTrayAvailable())
return;
205 case QSystemTrayIcon::Context:
208 m_qsti -> contextMenu() -> show();
210 case QSystemTrayIcon::DoubleClick:
211 case QSystemTrayIcon::Trigger:
216 case QSystemTrayIcon::Unknown:
240 setMainWindowsVisible<QETDiagramEditor>(
false);
245 setMainWindowsVisible<QETDiagramEditor>(
true);
250 setMainWindowsVisible<QETElementEditor>(
false);
255 setMainWindowsVisible<QETElementEditor>(
true);
260 setMainWindowsVisible<QETTitleBlockTemplateEditor>(
false);
265 setMainWindowsVisible<QETTitleBlockTemplateEditor>(
true);
291 QStringList info_list;
292 info_list <<
"formula" 299 <<
"tension-protocol" 306 <<
"manufacturer-reference" 307 <<
"machine-manufacturer-reference" 323 if (info ==
"formula")
return tr(
"Formule du label");
324 else if (info ==
"label")
return tr(
"Label");
325 else if (info ==
"plant")
return tr(
"Installation");
326 else if (info ==
"location")
return tr(
"Localisation");
328 else if (info ==
"comment")
return tr(
"Commentaire");
329 else if (info ==
"function")
return tr(
"Fonction");
330 else if (info ==
"tension-protocol")
return tr(
"Tension / Protocole");
331 else if (info ==
"auxiliary1")
return tr(
"Bloc auxiliaire 1");
332 else if (info ==
"auxiliary2")
return tr(
"Bloc auxiliaire 2");
334 else if (info ==
"description")
return tr(
"Description textuelle");
335 else if (info ==
"designation")
return tr(
"Numéro d'article");
336 else if (info ==
"manufacturer")
return tr(
"Fabricant");
337 else if (info ==
"manufacturer-reference")
return tr(
"Numéro de commande");
338 else if (info ==
"machine-manufacturer-reference")
return tr(
"Numéro interne");
339 else if (info ==
"supplier")
return tr(
"Fournisseur");
340 else if (info ==
"quantity")
return tr(
"Quantité");
341 else if (info ==
"unity")
return tr(
"Unité");
357 if (info ==
"formula")
return QString(
"%{formula}");
358 else if (info ==
"label")
return QString(
"%{label}");
359 else if (info ==
"plant")
return QString(
"%{plant}");
360 else if (info ==
"comment")
return QString(
"%{comment}");
361 else if (info ==
"description")
return QString(
"%{description}");
362 else if (info ==
"designation")
return QString(
"%{designation}");
363 else if (info ==
"manufacturer")
return QString(
"%{manufacturer}");
364 else if (info ==
"manufacturer-reference")
return QString(
"%{manufacturer-reference}");
365 else if (info ==
"supplier")
return QString(
"%{supplier}");
366 else if (info ==
"quantity")
return QString(
"%{quantity}");
367 else if (info ==
"unity")
return QString(
"%{unity}");
368 else if (info ==
"auxiliary1")
return QString(
"%{auxiliary1}");
369 else if (info ==
"auxiliary2")
return QString(
"%{auxiliary2}");
370 else if (info ==
"machine-manufacturer-reference")
return QString(
"%{machine-manufacturer-reference}");
371 else if (info ==
"location")
return QString(
"%{location}");
372 else if (info ==
"function")
return QString(
"%{function}");
373 else if (info ==
"tension-protocol")
return QString(
"%{tension-protocol}");
375 return (QString (
"%{void}"));
385 keys.append(
"formula");
387 keys.append(
"function");
388 keys.append(
"tension/protocol");
401 if (key ==
"formula")
return tr(
"Formule du texte");
402 else if (key ==
"text")
return tr(
"Texte");
403 else if (key ==
"function")
return tr(
"Fonction");
404 else if (key ==
"tension/protocol")
return tr(
"Tension / Protocole");
415 list.append(
"title");
416 list.append(
"author");
417 list.append(
"filename");
418 list.append(
"folio");
419 list.append(
"plant");
420 list.append(
"locmach");
421 list.append(
"indexrev");
434 if (key ==
"title")
return tr(
"Titre");
435 else if (key ==
"author")
return tr(
"Auteur");
436 else if (key ==
"filename")
return tr(
"Fichier");
437 else if (key ==
"folio")
return tr(
"Folio");
438 else if (key ==
"plant")
return tr(
"Installation");
439 else if (key ==
"locmach")
return tr(
"Localisation");
440 else if (key ==
"indexrev")
return tr(
"Indice Rev");
441 else return QString();
451 m_common_tbt_collection -> setTitle(
tr(
"Cartouches QET",
"title of the title block templates collection provided by QElectroTech"));
465 m_custom_tbt_collection -> setTitle(
tr(
"Cartouches utilisateur",
"title of the user's title block templates collection"));
477 QList<TitleBlockTemplatesCollection *> collections_list;
483 collections_list << opened_project -> embeddedTitleBlockTemplatesCollection();
486 return(collections_list);
501 return(
project -> embeddedTitleBlockTemplatesCollection());
516 QString path = settings.value(
"elements-collections/common-collection-path",
"default").toString();
517 if (path !=
"default" && !path.isEmpty())
534 #ifdef QET_ALLOW_OVERRIDE_CED_OPTION 535 if (common_elements_dir != QString())
return(common_elements_dir);
537 #ifndef QET_COMMON_COLLECTION_PATH 539 return(QCoreApplication::applicationDirPath() +
"/elements/");
541 #ifndef QET_COMMON_COLLECTION_PATH_RELATIVE_TO_BINARY_PATH 543 return(
QUOTE(QET_COMMON_COLLECTION_PATH));
546 return(QCoreApplication::applicationDirPath() +
"/" +
QUOTE(QET_COMMON_COLLECTION_PATH));
560 QString path = settings.value(
"elements-collections/custom-collection-path",
"default").toString();
561 if (path !=
"default" && !path.isEmpty())
589 if (path.endsWith(
"/")) path.remove(path.length()-1, 1);
601 if (path.endsWith(
"/")) path.remove(path.length()-1, 1);
622 #ifdef QET_ALLOW_OVERRIDE_CTBTD_OPTION 623 if (common_tbt_dir_ != QString())
return(common_tbt_dir_);
625 #ifndef QET_COMMON_TBT_PATH 627 return(QCoreApplication::applicationDirPath() +
"/titleblocks/");
629 #ifndef QET_COMMON_COLLECTION_PATH_RELATIVE_TO_BINARY_PATH 631 return(
QUOTE(QET_COMMON_TBT_PATH));
634 return(QCoreApplication::applicationDirPath() +
"/" +
QUOTE(QET_COMMON_TBT_PATH));
647 QString path = settings.value(
"elements-collections/custom-tbt-path",
"default").toString();
648 if (path !=
"default" && !path.isEmpty())
677 #ifdef QET_ALLOW_OVERRIDE_CD_OPTION 678 if (config_dir != QString())
return(config_dir);
684 QProcess * process =
new QProcess();
685 QString app_data_str = (process->processEnvironment()).value(
"APPDATA");
688 if (app_data_str.isEmpty()) {
689 app_data_str = QDir::homePath() +
"/Application Data";
691 return(app_data_str +
"/qet/");
693 return(QDir::homePath() +
"/.qet/");
706 if (sym_path.startsWith(
"common://")) {
708 }
else if (sym_path.startsWith(
"custom://")) {
714 }
else return(QString());
715 return(directory + QDir::toNativeSeparators(sym_path.right(sym_path.length() - 9)));
731 if (real_path.startsWith(commond)) {
732 chemin =
"common://" + real_path.right(real_path.length() - commond.length());
733 }
else if (real_path.startsWith(customd)) {
734 chemin =
"custom://" + real_path.right(real_path.length() - customd.length());
735 }
else chemin = QString();
744 static QStringList ext;
758 QList<QString> filepaths;
759 foreach (QUrl url, urls) {
760 if (url.scheme() !=
"file")
continue;
761 QString local_path = url.toLocalFile();
762 QFileInfo local_path_info(local_path);
763 QString local_path_ext = local_path_info.completeSuffix();
765 filepaths << local_path;
778 if (filepath.isEmpty())
return(
nullptr);
782 if (diagram_editor -> viewForFile(filepath)) {
783 return(diagram_editor);
799 if (qde->isAncestorOf(child)) {
807 #ifdef QET_ALLOW_OVERRIDE_CED_OPTION 812 void QETApp::overrideCommonElementsDir(
const QString &new_ced) {
813 QFileInfo new_ced_info(new_ced);
814 if (new_ced_info.isDir()) {
815 common_elements_dir = new_ced_info.absoluteFilePath();
816 if (!common_elements_dir.endsWith(
"/")) common_elements_dir +=
"/";
821 #ifdef QET_ALLOW_OVERRIDE_CTBTD_OPTION 826 void QETApp::overrideCommonTitleBlockTemplatesDir(
const QString &new_ctbtd) {
827 QFileInfo new_ctbtd_info(new_ctbtd);
828 if (new_ctbtd_info.isDir()) {
829 common_tbt_dir_ = new_ctbtd_info.absoluteFilePath();
830 if (!common_tbt_dir_.endsWith(
"/")) common_tbt_dir_ +=
"/";
835 #ifdef QET_ALLOW_OVERRIDE_CD_OPTION 840 void QETApp::overrideConfigDir(
const QString &new_cd) {
841 QFileInfo new_cd_info(new_cd);
842 if (new_cd_info.isDir()) {
843 config_dir = new_cd_info.absoluteFilePath();
844 if (!config_dir.endsWith(
"/")) config_dir +=
"/";
854 QFileInfo new_ld_info(new_ld);
855 if (new_ld_info.isDir()) {
856 lang_dir = new_ld_info.absoluteFilePath();
868 #ifndef QET_LANG_PATH 870 return(QCoreApplication::applicationDirPath() +
"/lang/");
872 #ifndef QET_LANG_PATH_RELATIVE_TO_BINARY_PATH 874 return(
QUOTE(QET_LANG_PATH));
877 return(QCoreApplication::applicationDirPath() +
"/" +
QUOTE(QET_LANG_PATH));
893 bool every_window_closed =
true;
895 every_window_closed = every_window_closed && e -> close();
898 every_window_closed = every_window_closed && e -> close();
900 return(every_window_closed);
915 QString diagram_texts_family = settings.value(
"diagramfont",
"Sans Serif").toString();
916 qreal diagram_texts_size = settings.value(
"diagramsize", 9.0).toDouble();
919 diagram_texts_size = size;
921 QFont diagram_texts_font = QFont(diagram_texts_family);
922 diagram_texts_font.setPointSizeF(diagram_texts_size);
923 if (diagram_texts_size <= 4.0) {
924 diagram_texts_font.setWeight(QFont::Light);
926 return(diagram_texts_font);
939 QString diagram_texts_item_family = settings.value(
"diagramitemfont",
"Sans Serif").toString();
940 qreal diagram_texts_item_size = settings.value(
"diagramitemsize", 9.0).toDouble();
941 qreal diagram_texts_item_weight = settings.value(
"diagramitemweight").toDouble();
942 QString diagram_texts_item_style = settings.value(
"diagramitemstyle",
"normal").toString();
945 diagram_texts_item_size = size;
947 QFont diagram_texts_item_font = QFont(diagram_texts_item_family);
948 diagram_texts_item_font.setPointSizeF(diagram_texts_item_size);
949 diagram_texts_item_font.setWeight(diagram_texts_item_weight);
950 diagram_texts_item_font.setStyleName(diagram_texts_item_style);
951 if (diagram_texts_item_size <= 4.0) {
952 diagram_texts_item_font.setWeight(QFont::Light);
954 return(diagram_texts_item_font);
967 if (settings.contains(
"diagrameditor/dynamic_text_font")) {
968 font_.fromString(settings.value(
"diagrameditor/dynamic_text_font").toString());
971 font_.setPointSizeF(size);
987 QString foliolist_texts_family = settings.value(
"foliolistfont",
"Sans Serif").toString();
988 qreal foliolist_texts_size = settings.value(
"foliolistsize", 9.0).toDouble();
991 foliolist_texts_size = size;
993 QFont foliolist_texts_font = QFont(foliolist_texts_family);
994 foliolist_texts_font.setPointSizeF(foliolist_texts_size);
995 if (foliolist_texts_size <= 4.0) {
996 foliolist_texts_font.setWeight(QFont::Light);
998 return(foliolist_texts_font);
1012 if (settings.contains(
"diagrameditor/independent_text_font")) {
1013 font_.fromString(settings.value(
"diagrameditor/independent_text_font").toString());
1016 font_.setPointSizeF(size);
1040 return(
QETApp::instance() -> detectWindows<QETTitleBlockTemplateEditor>());
1049 QList<QETTitleBlockTemplateEditor *> editors;
1050 if (!
project)
return(editors);
1054 if (tbt_editor -> location().parentProject() ==
project) {
1055 editors << tbt_editor;
1075 widget -> orientationWidget() -> setUsableTexts(QList<QString>()
1076 <<
QETApp::tr(
"Q",
"Single-letter example text - translate length, not meaning")
1077 <<
QETApp::tr(
"QET",
"Small example text - translate length, not meaning")
1078 <<
QETApp::tr(
"Schema",
"Normal example text - translate length, not meaning")
1079 <<
QETApp::tr(
"Electrique",
"Normal example text - translate length, not meaning")
1080 <<
QETApp::tr(
"QElectroTech",
"Long example text - translate length, not meaning")
1091 if (titleblock_template -> loadFromXmlFile(
":/titleblocks/default.titleblock")) {
1105 QList<QETElementEditor *> editors;
1106 if (!
project)
return(editors);
1114 if (elmt_editor_loc.
isNull())
continue;
1117 editors << elmt_editor;
1126 Q_UNUSED(instanceId);
1128 QString str(message);
1130 if (str.startsWith(
"launched-with-args: "))
1132 QString my_message(str.mid(20));
1144 foreach(QWidget *widget, qApp->topLevelWidgets()) {
1145 if (!widget -> isWindow())
continue;
1146 if (T *window = qobject_cast<T *>(widget)) {
1158 foreach(T *e, detectWindows<T>()) {
1183 if (window -> isVisible() == visible)
return;
1207 if (QMainWindow *w = qobject_cast<QMainWindow *>(window))
setMainWindowVisible(w, !w -> isVisible());
1214 #if defined(Q_OS_WIN) && defined(Q_OS_WINCE) 1216 if defined(Q_OS_WIN)
1217 if ((QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA
1218 && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based))
1219 style = QLatin1String(
"WindowsVista");
1220 else if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP
1221 && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based))
1222 style = QLatin1String(
"WindowsXP");
1224 style = QLatin1String(
"Windows");
1235 qApp->setStyleSheet(
1236 "QTabBar::tab:!selected { background-color: transparent; }" 1237 "QAbstractScrollArea#mdiarea {" 1238 "background-color -> setPalette(initial_palette_);" 1243 file.open(QFile::ReadOnly);
1244 QString styleSheet = QLatin1String(file.readAll());
1245 qApp->setStyleSheet(styleSheet);
1269 static bool sleep =
true;
1300 if (files_list.isEmpty())
return;
1306 if (diagrams_editors.count()) {
1307 QList<QETDiagramEditor *> visible_diagrams_editors;
1309 if (
de -> isVisible()) visible_diagrams_editors <<
de;
1314 if (visible_diagrams_editors.count()) {
1315 de_open = visible_diagrams_editors.first();
1317 de_open = diagrams_editors.first();
1318 de_open -> setVisible(
true);
1322 foreach(QString file, files_list) {
1323 de_open -> openAndAddProject(file);
1337 if (files_list.isEmpty())
return;
1340 QSet<QString> files_set;
1341 foreach(QString file, files_list) {
1342 QString canonical_filepath = QFileInfo(file).canonicalFilePath();
1343 if (!canonical_filepath.isEmpty()) files_set << canonical_filepath;
1346 if (files_set.isEmpty())
return;
1352 foreach(QString element_file, files_set) {
1353 bool already_opened_in_existing_element_editor =
false;
1355 if (element_editor -> isEditing(element_file)) {
1357 already_opened_in_existing_element_editor =
true;
1358 element_editor -> setVisible(
true);
1359 element_editor ->
raise();
1360 element_editor -> activateWindow();
1364 if (!already_opened_in_existing_element_editor) {
1367 element_editor -> fromFile(element_file);
1378 if (locations_list.isEmpty())
return;
1385 bool already_opened_in_existing_element_editor =
false;
1387 if (element_editor -> isEditing(element_location)) {
1389 already_opened_in_existing_element_editor =
true;
1390 element_editor -> setVisible(
true);
1391 element_editor ->
raise();
1392 element_editor -> activateWindow();
1396 if (!already_opened_in_existing_element_editor) {
1399 element_editor -> fromLocation(element_location);
1414 qet_template_editor -> setOpenForDuplication(duplicate);
1415 qet_template_editor -> edit(location);
1416 qet_template_editor -> show();
1425 qet_template_editor -> edit(filepath);
1426 qet_template_editor -> show();
1435 if (files_list.isEmpty())
return;
1438 QSet<QString> files_set;
1439 foreach (QString file, files_list) {
1440 QString canonical_filepath = QFileInfo(file).canonicalFilePath();
1441 if (!canonical_filepath.isEmpty()) files_set << canonical_filepath;
1444 if (files_set.isEmpty())
return;
1449 foreach(QString tbt_file, files_set) {
1450 bool already_opened_in_existing_tbt_editor =
false;
1452 if (tbt_editor -> isEditing(tbt_file)) {
1454 already_opened_in_existing_tbt_editor =
true;
1455 tbt_editor -> setVisible(
true);
1456 tbt_editor ->
raise();
1457 tbt_editor -> activateWindow();
1461 if (!already_opened_in_existing_tbt_editor) {
1474 QWidget *parent_widget = qApp->activeWindow();
1478 cd.setWindowTitle(
tr(
"Configurer QElectroTech",
"window title"));
1479 cd.setWindowModality(Qt::WindowModal);
1487 if (parent_widget) {
1488 cd.setParent(parent_widget, cd.windowFlags());
1493 cd.setParent(
nullptr, cd.windowFlags());
1505 aq.setWindowFlags(Qt::Sheet);
1515 QList<QWidget *> widgets;
1516 foreach(QWidget *qw, qApp->topLevelWidgets()) {
1517 if (!qw -> isWindow())
continue;
1518 if (qobject_cast<QToolBar *>(qw) || qobject_cast<QDockWidget *>(qw)) {
1519 if (qw -> parent() == window) widgets << qw;
1539 QList<QString> arguments_list(qApp->arguments());
1542 arguments_list.takeFirst();
1547 #ifdef QET_ALLOW_OVERRIDE_CED_OPTION 1552 #ifdef QET_ALLOW_OVERRIDE_CTBTD_OPTION 1554 overrideCommonTitleBlockTemplatesDir(
qet_arguments_.commonTitleBlockTemplatesDir());
1557 #ifdef QET_ALLOW_OVERRIDE_CD_OPTION 1599 if (!message.isEmpty()) {
1600 m_splash_screen -> showMessage(message, Qt::AlignBottom | Qt::AlignLeft);
1602 qApp->processEvents();
1656 menu_systray =
new QMenu(
tr(
"QElectroTech",
"systray menu title"));
1670 quitter_qet -> setStatusTip(
tr(
"Ferme l'application QElectroTech"));
1671 reduce_appli -> setToolTip(
tr(
"Réduire QElectroTech dans le systray"));
1688 m_qsti -> setToolTip(
tr(
"QElectroTech",
"systray icon tooltip"));
1689 connect(
m_qsti, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
this, SLOT(
systray(QSystemTrayIcon::ActivationReason)));
1703 menu -> addSeparator();
1704 foreach (QMainWindow *window, windows) {
1705 QAction *current_menu = menu -> addAction(window -> windowTitle());
1706 current_menu -> setCheckable(
true);
1707 current_menu -> setChecked(window -> isVisible());
1708 connect(current_menu, SIGNAL(triggered()), &
signal_map, SLOT(map()));
1720 QRegExp embedded(
"^project([0-9]+)\\+embed.*$", Qt::CaseInsensitive);
1721 if (embedded.exactMatch(url)) {
1722 bool conv_ok =
false;
1723 int project_id = embedded.capturedTexts().at(1).toInt(&conv_ok);
1739 if (project_id == -1)
return(
nullptr);
1757 QMenu *diagrams_submenu =
menu_systray -> addMenu(
tr(
"Éditeurs de schémas"));
1763 addWindowsListToMenu<QETDiagramEditor>(diagrams_submenu, diagrams);
1766 QMenu *elements_submenu =
menu_systray -> addMenu(
tr(
"Éditeurs d'élément"));
1772 elements_submenu -> addSeparator();
1773 addWindowsListToMenu<QETElementEditor>(elements_submenu, elements);
1776 QMenu *tbtemplates_submenu =
menu_systray -> addMenu(
tr(
"Éditeurs de cartouche",
"systray menu entry"));
1781 addWindowsListToMenu<QETTitleBlockTemplateEditor>(tbtemplates_submenu, tbtemplates);
1795 QList<KAutoSaveFile *> stale_files = KAutoSaveFile::allStaleFiles();
1798 const QList<KAutoSaveFile *> sf = stale_files;
1799 for (KAutoSaveFile *kasf : sf)
1804 const QString path = QUrl::fromLocalFile(
project->
filePath()).adjusted(QUrl::RemoveScheme | QUrl::StripTrailingSlash).path();
1805 if (kasf->managedFile() == path) {
1806 stale_files.removeOne(kasf);
1811 if (stale_files.isEmpty()) {
1816 if(stale_files.size() == 1) {
1817 text.append(
tr(
"<b>Le fichier de restauration suivant a été trouvé,<br>" 1818 "Voulez-vous l'ouvrir ?</b><br>"));
1820 text.append(
tr(
"<b>Les fichiers de restauration suivant on été trouvé,<br>" 1821 "Voulez-vous les ouvrir ?</b><br>"));
1823 for(
const KAutoSaveFile *kasf : stale_files)
1827 text.append(
"<br>" + kasf->managedFile().path().remove(0,1));
1829 text.append(
"<br>" + kasf->managedFile().path());
1851 for (KAutoSaveFile *stale : stale_files)
1853 stale->open(QIODevice::ReadWrite);
1861 const QList<QETDiagramEditor *> &diagrams,
1862 const QList<QETElementEditor *> &elements,
1863 const QList<QETTitleBlockTemplateEditor *> &tbtemplates
1866 int visible_diagrams = 0;
1867 foreach(QMainWindow *w, diagrams)
if (w -> isVisible()) ++ visible_diagrams;
1872 int visible_elements = 0;
1873 foreach(QMainWindow *w, elements)
if (w -> isVisible()) ++ visible_elements;
1878 int visible_templates = 0;
1879 foreach(QMainWindow *window, tbtemplates) {
1880 if (window -> isVisible()) ++ visible_templates;
1894 bool QETApp::eventFiltrer(QObject *
object, QEvent *e) {
1896 if (e -> type() == QEvent::FileOpen) {
1898 QString filename =
static_cast<QFileOpenEvent *
>(e) -> file();
1902 return QObject::eventFilter(
object, e);
1912 tr(
"Usage : ") + QFileInfo(qApp->applicationFilePath()).fileName() +
tr(
" [options] [fichier]...\n\n") +
1913 tr(
"QElectroTech, une application de réalisation de schémas électriques.\n\n" 1914 "Options disponibles : \n" 1915 " --help Afficher l'aide sur les options\n" 1916 " -v, --version Afficher la version\n" 1917 " --license Afficher la licence\n")
1918 #ifdef QET_ALLOW_OVERRIDE_CED_OPTION 1919 +
tr(
" --common-elements-dir=DIR Definir le dossier de la collection d'elements\n")
1921 #ifdef QET_ALLOW_OVERRIDE_CTBTD_OPTION 1922 +
tr(
" --common-tbt-dir=DIR Definir le dossier de la collection de modeles de cartouches\n")
1924 #ifdef QET_ALLOW_OVERRIDE_CD_OPTION 1925 +
tr(
" --config-dir=DIR Definir le dossier de configuration\n")
1927 +
tr(
" --lang-dir=DIR Definir le dossier contenant les fichiers de langue\n")
1929 std::cout << qPrintable(help) << std::endl;
1980 if (project_id == -1)
return(
false);
static TitleBlockTemplatesFilesCollection * commonTitleBlockTemplatesCollection()
static QTextOrientationSpinBoxWidget * createTextOrientationSpinBoxWidget()
static QString symbolicPath(const QString &)
void fetchWindowStats(const QList< QETDiagramEditor *> &, const QList< QETElementEditor *> &, const QList< QETTitleBlockTemplateEditor *> &)
Met a jour les booleens concernant l'etat des fenetres.
void setLocale(const QString &)
void reduceEveryEditor()
Reduit toutes les fenetres de l'application dans le systray.
#define QETAPP_COMMON_TBT_PROTOCOL
static QString customTitleBlockTemplatesDir()
static QString commonTitleBlockTemplatesDir()
static bool unregisterProject(QETProject *)
static QStringList handledFiles(const QList< QUrl > &)
QPalette initial_palette_
System color palette.
void invertMainWindowVisibility(QWidget *)
static TitleBlockTemplate * defaultTitleBlockTemplate()
void openElementFiles(const QStringList &)
QStringList splitWithSpaces(const QString &)
QETArguments qet_arguments_
Comand-line arguments parser.
void reduceDiagramEditors()
Reduit tous les editeurs de schemas dans le systray.
static RecentFiles * m_elements_recent_files
void restoreElementEditors()
Restaure tous les editeurs d'element dans le systray.
void newElementEditor()
lance un nouvel editeur d'element
static QMap< uint, QETProject * > registeredProjects()
static QString customElementsDir()
QETApp::customElementsDir.
static QStringList handledFileExtensions()
virtual QList< QString > projectFiles() const
void addWindowsListToMenu(QMenu *, const QList< T *> &)
bool every_diagram_visible
void aboutQET()
QETApp::aboutQET Open the dialog about qet.
void systray(QSystemTrayIcon::ActivationReason)
static int projectIdFromString(const QString &)
void setMainWindowVisible(QMainWindow *, bool)
static QFont foliolistTextsFont(qreal=-1.0)
QETApp::foliolistTextsFont the font for to use in summary pages.
bool non_interactive_execution_
Whether the application will end without any user interaction.
QHash< QMainWindow *, QByteArray > window_geometries
void openFiles(const QETArguments &)
void initStyle()
QETApp::initStyle Setup the gui style.
const QString displayedVersion
QElectroTech displayed version.
QAction * reduce_templates
void reduceElementEditors()
Reduit tous les editeurs d'element dans le systray.
void buildSystemTrayMenu()
construit le menu de l'icone dans le systray
QAction * restore_elements
static ElementsCollectionCache * collectionCache()
~QETApp() override
QETApp::~QETApp.
static void dropInstance()
void openTitleBlockTemplate(const TitleBlockTemplateLocation &, bool=false)
QAction * reduce_elements
static bool registerProject(QETProject *)
void setSplashScreenStep(const QString &=QString())
static int projectId(const QETProject *)
static QETProject * project(const uint &)
static QString langFromSetting()
QETApp::langFromSetting.
void receiveMessage(int instanceId, QByteArray message)
static QString languagesPath()
QAction * reduce_diagrams
#define QETAPP_CUSTOM_TBT_PROTOCOL
static QStringList conductorInfoKeys()
QETApp::conductorInfoKeys.
virtual QList< QString > elementFiles() const
static QString m_user_common_elements_dir
static QString diagramTranslatedInfoKey(const QString &key)
QETApp::diagramTranslatedInfoKey.
QAction * restore_diagrams
static QETProject * projectFromString(const QString &)
static TitleBlockTemplatesFilesCollection * customTitleBlockTemplatesCollection()
bool every_editor_reduced
QList< QWidget * > floatingToolbarsAndDocksForMainWindow(QMainWindow *) const
bool every_element_reduced
bool every_template_visible
bool every_diagram_reduced
void addPage(ConfigPage *)
static QFont indiTextsItemFont(qreal=-1.0)
QETApp::indiTextsItemFont The default font to use for independent text item.
static void overrideLangDir(const QString &)
void checkBackupFiles()
QETApp::checkBackupFiles Check for backup files. If backup was found, open a dialog and ask user what...
static RecentFiles * projectsRecentFiles()
static QList< QETTitleBlockTemplateEditor * > titleBlockTemplateEditors()
virtual bool printVersionRequested() const
static RecentFiles * m_projects_recent_files
virtual bool printLicenseRequested() const
QETProject * project() const
static QList< QETElementEditor * > elementEditors()
static QString m_user_custom_elements_dir
static QMap< uint, QETProject * > registered_projects_
static QString elementInfoToVar(const QString &info)
QETApp::elementInfoToVar.
QSplashScreen * m_splash_screen
static QStringList elementInfoKeys()
QETApp::elementInfoKeys.
static QFont dynamicTextsItemFont(qreal=-1.0)
QETApp::dynamicTextsFont the defaukt font of dynamic element text item.
static void printVersion()
virtual bool langDirSpecified() const
bool every_template_reduced
static ElementsCollectionCache * collections_cache_
QAction * restore_templates
static void dropInstance()
dropInstance Drop the instance of factory
void switchLayout(Qt::LayoutDirection)
void restoreEveryEditor()
Restaure toutes les fenetres de l'application dans le systray.
QHash< QMainWindow *, QByteArray > window_states
static TitleBlockTemplatesFilesCollection * m_custom_tbt_collection
virtual QString langDir() const
void setLanguage(const QString &)
QTranslator qetTranslator
static QString conductorTranslatedInfoKey(const QString &key)
QETApp::conductorTranslatedInfoKey.
static QFont diagramTextsItemFont(qreal=-1.0)
QETApp::diagramTextsItemFont the font for to use in independent text item.
#define TITLEBLOCKS_FILE_EXTENSION
void openProjectFiles(const QStringList &)
virtual QList< QString > titleBlockTemplateFiles() const
void useSystemPalette(bool)
void openBackupFiles(QList< KAutoSaveFile *> backup_files)
QETDiagramEditor::openBackupFiles.
void setMainWindowsVisible(bool)
static TitleBlockTemplate * default_titleblock_template_
void openTitleBlockTemplateFiles(const QStringList &)
static TitleBlockTemplatesCollection * titleBlockTemplatesCollection(const QString &)
void newDiagramEditor()
lance un nouvel editeur de schemas
bool every_element_visible
static QFont diagramTextsFont(qreal=-1.0)
QETApp::diagramTextsFont The font to use By default the font is "sans Serif" and size 9...
void reduceTitleBlockTemplateEditors()
Reduce all known template editors.
static QETDiagramEditor * diagramEditorAncestorOf(const QWidget *child)
QETApp::diagramEditorAncestorOf.
QMessageBox::StandardButton question(QWidget *, const QString &, const QString &, QMessageBox::StandardButtons=QMessageBox::Ok, QMessageBox::StandardButton=QMessageBox::NoButton)
static QString customElementsDirN()
QETApp::customElementsDirN like QString QETApp::customElementsDir but without "/" at the end...
static QList< TitleBlockTemplatesCollection * > availableTitleBlockTemplatesCollections()
static QString elementTranslatedInfoKey(const QString &)
ElementsProperties::translatedInfo Return the translated information key given by If don't match...
void restoreTitleBlockTemplateEditors()
Restore all known template editors.
static QList< QETDiagramEditor * > diagramEditors()
virtual bool printHelpRequested() const
static QString commonElementsDir()
QETApp::commonElementsDir.
void openElementLocations(const QList< ElementsLocation > &)
static TitleBlockTemplatesFilesCollection * m_common_tbt_collection
static QString lang_dir
Directory containing localization files.
void checkRemainingWindows()
static QString commonElementsDirN()
QETApp::commonElementsDirN like QString QETApp::commonElementsDir but without "/" at the end...
static RecentFiles * elementsRecentFiles()
static QString m_user_custom_tbt_dir
virtual QList< QString > files() const
static void resetUserElementsDir()
QETApp::resetUserElementsDir Reset the path of the user common and custom elements dir...
static uint next_project_id
static QETApp * instance()
static void printLicense()
QList< T * > detectWindows() const
static QETDiagramEditor * diagramEditorForFile(const QString &)
void restoreDiagramEditors()
Restaure tous les editeurs de schemas dans le systray.
static QString realPath(const QString &)
static QString configDir()
static QStringList diagramInfoKeys()
QETApp::diagramInfoKeys.