mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-09-13 20:23:04 +02:00
Add macro to disable/enable project database export
This commit is contained in:
parent
aa9266ab64
commit
6437bf212a
@ -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
|
||||
|
||||
|
@ -521,6 +521,7 @@ QHash<QString, QString> projectDataBase::elementInfoToString(Element *elmt)
|
||||
return hash;
|
||||
}
|
||||
|
||||
#ifdef QET_EXPORT_PROJECT_DB
|
||||
/**
|
||||
@brief projectDataBase::sqliteHandle
|
||||
@param db
|
||||
@ -528,11 +529,6 @@ QHash<QString, QString> 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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user