diff --git a/qelectrotech.pro b/qelectrotech.pro index eb5f7d921..af534afb5 100644 --- a/qelectrotech.pro +++ b/qelectrotech.pro @@ -61,6 +61,9 @@ DEFINES += QET_ALLOW_OVERRIDE_CTBTD_OPTION # Commenter la ligne ci-dessous pour desactiver l'option --config-dir DEFINES += QET_ALLOW_OVERRIDE_CD_OPTION +#comment the line below to disable the project database export +DEFINES += QET_EXPORT_PROJECT_DB + # warn on *any* usage of deprecated APIs #DEFINES += QT_DEPRECATED_WARNINGS diff --git a/sources/dataBase/projectdatabase.cpp b/sources/dataBase/projectdatabase.cpp index ea6781586..1757696ff 100644 --- a/sources/dataBase/projectdatabase.cpp +++ b/sources/dataBase/projectdatabase.cpp @@ -521,6 +521,7 @@ QHash projectDataBase::elementInfoToString(Element *elmt) return hash; } +#ifdef QET_EXPORT_PROJECT_DB /** @brief projectDataBase::sqliteHandle @param db @@ -528,11 +529,6 @@ QHash projectDataBase::elementInfoToString(Element *elmt) */ sqlite3 *projectDataBase::sqliteHandle(QSqlDatabase *db) { - //sqlite 3 lib isn't availlable for the moment on macosx - //need some help to add sqlite3 lib on macosx compilation -#ifdef Q_OS_MACOS - return nullptr; -#else sqlite3 *handle = nullptr; QVariant v = db->driver()->handle(); @@ -541,7 +537,6 @@ sqlite3 *projectDataBase::sqliteHandle(QSqlDatabase *db) } return handle; -#endif } @@ -562,9 +557,7 @@ void projectDataBase::exportDb(projectDataBase *db, if (caption_.isEmpty()) { caption_ = tr("Exporter la base de données interne du projet"); } -#ifdef Q_OS_MACOS - return; -#else + auto dir_ = dir; if(dir_.isEmpty()) { dir_ = db->project()->filePath(); @@ -604,5 +597,5 @@ void projectDataBase::exportDb(projectDataBase *db, file_db.close(); } QSqlDatabase::removeDatabase(connection_name); -#endif } +#endif diff --git a/sources/dataBase/projectdatabase.h b/sources/dataBase/projectdatabase.h index 69ebe2893..2fe470f87 100644 --- a/sources/dataBase/projectdatabase.h +++ b/sources/dataBase/projectdatabase.h @@ -79,12 +79,14 @@ class projectDataBase : public QObject m_remove_diagram_query, m_insert_diagram_info_query; +#ifdef QET_EXPORT_PROJECT_DB public: static sqlite3 *sqliteHandle(QSqlDatabase *db); static void exportDb(projectDataBase *db, QWidget *parent = nullptr, const QString &caption = QString(), const QString &dir = QString()); +#endif }; #endif // PROJECTDATABASE_H diff --git a/sources/qetdiagrameditor.cpp b/sources/qetdiagrameditor.cpp index 81c1ca67e..13ff0ff70 100644 --- a/sources/qetdiagrameditor.cpp +++ b/sources/qetdiagrameditor.cpp @@ -437,10 +437,12 @@ void QETDiagramEditor::setUpActions() } }); +#ifdef QET_EXPORT_PROJECT_DB m_export_project_db = new QAction(QET::Icons::DocumentSpreadsheet, tr("Exporter la base de donnée interne du projet"), this); connect(m_export_project_db, &QAction::triggered, [this]() { projectDataBase::exportDb(this->currentProject()->dataBase(), this); }); +#endif //MDI view style m_tabbed_view_mode = new QAction(tr("en utilisant des onglets"), this); @@ -793,7 +795,7 @@ void QETDiagramEditor::setUpMenu() menu_project -> addAction(m_csv_export); menu_project -> addAction(m_project_export_conductor_num); menu_project -> addAction(m_project_terminalBloc); -#if defined(Q_OS_LINUX) || defined(Q_OS_WINDOWS) +#ifdef QET_EXPORT_PROJECT_DB menu_project -> addSeparator(); menu_project -> addAction(m_export_project_db); #endif