mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-09-14 20:33:05 +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
|
# Commenter la ligne ci-dessous pour desactiver l'option --config-dir
|
||||||
DEFINES += QET_ALLOW_OVERRIDE_CD_OPTION
|
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
|
# warn on *any* usage of deprecated APIs
|
||||||
#DEFINES += QT_DEPRECATED_WARNINGS
|
#DEFINES += QT_DEPRECATED_WARNINGS
|
||||||
|
|
||||||
|
@ -521,6 +521,7 @@ QHash<QString, QString> projectDataBase::elementInfoToString(Element *elmt)
|
|||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef QET_EXPORT_PROJECT_DB
|
||||||
/**
|
/**
|
||||||
@brief projectDataBase::sqliteHandle
|
@brief projectDataBase::sqliteHandle
|
||||||
@param db
|
@param db
|
||||||
@ -528,11 +529,6 @@ QHash<QString, QString> projectDataBase::elementInfoToString(Element *elmt)
|
|||||||
*/
|
*/
|
||||||
sqlite3 *projectDataBase::sqliteHandle(QSqlDatabase *db)
|
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;
|
sqlite3 *handle = nullptr;
|
||||||
|
|
||||||
QVariant v = db->driver()->handle();
|
QVariant v = db->driver()->handle();
|
||||||
@ -541,7 +537,6 @@ sqlite3 *projectDataBase::sqliteHandle(QSqlDatabase *db)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return handle;
|
return handle;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -562,9 +557,7 @@ void projectDataBase::exportDb(projectDataBase *db,
|
|||||||
if (caption_.isEmpty()) {
|
if (caption_.isEmpty()) {
|
||||||
caption_ = tr("Exporter la base de données interne du projet");
|
caption_ = tr("Exporter la base de données interne du projet");
|
||||||
}
|
}
|
||||||
#ifdef Q_OS_MACOS
|
|
||||||
return;
|
|
||||||
#else
|
|
||||||
auto dir_ = dir;
|
auto dir_ = dir;
|
||||||
if(dir_.isEmpty()) {
|
if(dir_.isEmpty()) {
|
||||||
dir_ = db->project()->filePath();
|
dir_ = db->project()->filePath();
|
||||||
@ -604,5 +597,5 @@ void projectDataBase::exportDb(projectDataBase *db,
|
|||||||
file_db.close();
|
file_db.close();
|
||||||
}
|
}
|
||||||
QSqlDatabase::removeDatabase(connection_name);
|
QSqlDatabase::removeDatabase(connection_name);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
@ -79,12 +79,14 @@ class projectDataBase : public QObject
|
|||||||
m_remove_diagram_query,
|
m_remove_diagram_query,
|
||||||
m_insert_diagram_info_query;
|
m_insert_diagram_info_query;
|
||||||
|
|
||||||
|
#ifdef QET_EXPORT_PROJECT_DB
|
||||||
public:
|
public:
|
||||||
static sqlite3 *sqliteHandle(QSqlDatabase *db);
|
static sqlite3 *sqliteHandle(QSqlDatabase *db);
|
||||||
static void exportDb(projectDataBase *db,
|
static void exportDb(projectDataBase *db,
|
||||||
QWidget *parent = nullptr,
|
QWidget *parent = nullptr,
|
||||||
const QString &caption = QString(),
|
const QString &caption = QString(),
|
||||||
const QString &dir = QString());
|
const QString &dir = QString());
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PROJECTDATABASE_H
|
#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);
|
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]() {
|
connect(m_export_project_db, &QAction::triggered, [this]() {
|
||||||
projectDataBase::exportDb(this->currentProject()->dataBase(), this);
|
projectDataBase::exportDb(this->currentProject()->dataBase(), this);
|
||||||
});
|
});
|
||||||
|
#endif
|
||||||
|
|
||||||
//MDI view style
|
//MDI view style
|
||||||
m_tabbed_view_mode = new QAction(tr("en utilisant des onglets"), this);
|
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_csv_export);
|
||||||
menu_project -> addAction(m_project_export_conductor_num);
|
menu_project -> addAction(m_project_export_conductor_num);
|
||||||
menu_project -> addAction(m_project_terminalBloc);
|
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 -> addSeparator();
|
||||||
menu_project -> addAction(m_export_project_db);
|
menu_project -> addAction(m_export_project_db);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user