mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-09-13 20:23:04 +02:00
Add switch for KF5 (QT6) and Mod Cmake
if we want to test QET on QT6, KF5 must be removed from the code, this switch is for that, this is for testing only
This commit is contained in:
parent
13db08ad56
commit
cb37c1c2fe
@ -85,36 +85,14 @@ add_executable(
|
||||
${QET_DIR}/qelectrotech.qrc
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
${PROJECT_NAME}
|
||||
PUBLIC
|
||||
PRIVATE
|
||||
Qt${QT_VERSION_MAJOR}::Xml
|
||||
Qt${QT_VERSION_MAJOR}::Svg
|
||||
Qt${QT_VERSION_MAJOR}::Network
|
||||
Qt${QT_VERSION_MAJOR}::Sql
|
||||
Qt${QT_VERSION_MAJOR}::PrintSupport
|
||||
Qt${QT_VERSION_MAJOR}::Widgets
|
||||
Qt${QT_VERSION_MAJOR}::Concurrent
|
||||
KF5::WidgetsAddons
|
||||
KF5::CoreAddons
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
${PROJECT_NAME}
|
||||
PUBLIC
|
||||
PRIVATE
|
||||
pugixml::pugixml
|
||||
SingleApplication::SingleApplication
|
||||
KF5::WidgetsAddons
|
||||
KF5::CoreAddons
|
||||
Qt5::Gui
|
||||
Qt5::Xml
|
||||
Qt5::Svg
|
||||
Qt5::Network
|
||||
Qt5::Sql
|
||||
Qt5::Widgets
|
||||
Qt5::Concurrent
|
||||
${KF5_PRIVATE_LIBRARIES}
|
||||
${QET_PRIVATE_LIBRARIES}
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
|
@ -61,6 +61,11 @@ message("PROJECT_HOMEPAGE_URL :" ${PROJECT_HOMEPAGE_URL})
|
||||
message("PROJECT_SOURCE_DIR :" ${PROJECT_SOURCE_DIR})
|
||||
message("QET_DIR :" ${QET_DIR})
|
||||
message("GIT_COMMIT_SHA :" ${GIT_COMMIT_SHA})
|
||||
message("KF5_GIT_TAG :" ${KF5_GIT_TAG})
|
||||
|
||||
if(BUILD_WITH_KF5)
|
||||
message("KF5_GIT_TAG :" ${KF5_GIT_TAG})
|
||||
else()
|
||||
add_definitions(-DBUILD_WITHOUT_KF5)
|
||||
endif()
|
||||
message("QET_COMPONENTS :" ${QET_COMPONENTS})
|
||||
message("QT_VERSION_MAJOR :" ${QT_VERSION_MAJOR})
|
||||
|
@ -30,3 +30,6 @@ add_definitions(-DQT_MESSAGELOGCONTEXT)
|
||||
# You can make your code warn on compile time for the TODO's
|
||||
# In order to do so, uncomment the following line.
|
||||
#add_definitions(-DTODO_LIST)
|
||||
|
||||
# Build with KF5
|
||||
option(BUILD_WITH_KF5 "Build with KF5" ON)
|
||||
|
@ -16,40 +16,52 @@
|
||||
|
||||
message(" - fetch_kdeaddons")
|
||||
|
||||
Include(FetchContent)
|
||||
if(DEFINED BUILD_WITH_KF5)
|
||||
Include(FetchContent)
|
||||
|
||||
set(BUILD_KF5_YES "YES")
|
||||
set(BUILD_KF5_YES "YES")
|
||||
|
||||
if(DEFINED BUILD_KF5_YES)
|
||||
if(DEFINED BUILD_KF5_YES)
|
||||
|
||||
if(NOT DEFINED KF5_GIT_TAG)
|
||||
#https://qelectrotech.org/forum/viewtopic.php?pid=13924#p13924
|
||||
set(KF5_GIT_TAG v5.70.0)
|
||||
if(NOT DEFINED KF5_GIT_TAG)
|
||||
#https://qelectrotech.org/forum/viewtopic.php?pid=13924#p13924
|
||||
set(KF5_GIT_TAG v5.70.0)
|
||||
endif()
|
||||
|
||||
# Fix stop the run autotests of kcoreaddons
|
||||
# see
|
||||
# https://invent.kde.org/frameworks/kcoreaddons/-/blob/master/CMakeLists.txt#L98
|
||||
# issue:
|
||||
# CMake Error at /usr/share/ECM/modules/ECMAddTests.cmake:89 (add_executable):
|
||||
# Cannot find source file:
|
||||
# see
|
||||
# https://qelectrotech.org/forum/viewtopic.php?pid=13929#p13929
|
||||
set(KDE_SKIP_TEST_SETTINGS "TRUE")
|
||||
set(BUILD_TESTING "0")
|
||||
FetchContent_Declare(
|
||||
ecm
|
||||
GIT_REPOSITORY https://invent.kde.org/frameworks/extra-cmake-modules.git
|
||||
GIT_TAG ${KF5_GIT_TAG})
|
||||
FetchContent_MakeAvailable(ecm)
|
||||
|
||||
FetchContent_Declare(
|
||||
kcoreaddons
|
||||
GIT_REPOSITORY https://invent.kde.org/frameworks/kcoreaddons.git
|
||||
GIT_TAG ${KF5_GIT_TAG})
|
||||
FetchContent_MakeAvailable(kcoreaddons)
|
||||
|
||||
FetchContent_Declare(
|
||||
kwidgetsaddons
|
||||
GIT_REPOSITORY https://invent.kde.org/frameworks/kwidgetsaddons.git
|
||||
GIT_TAG ${KF5_GIT_TAG})
|
||||
FetchContent_MakeAvailable(kwidgetsaddons)
|
||||
else()
|
||||
find_package(KF5CoreAddons REQUIRED)
|
||||
find_package(KF5WidgetsAddons REQUIRED)
|
||||
endif()
|
||||
|
||||
# Fix stop the run autotests of kcoreaddons
|
||||
# see
|
||||
# https://invent.kde.org/frameworks/kcoreaddons/-/blob/master/CMakeLists.txt#L98
|
||||
# issue:
|
||||
# CMake Error at /usr/share/ECM/modules/ECMAddTests.cmake:89 (add_executable):
|
||||
# Cannot find source file:
|
||||
# see
|
||||
# https://qelectrotech.org/forum/viewtopic.php?pid=13929#p13929
|
||||
set(KDE_SKIP_TEST_SETTINGS "TRUE")
|
||||
set(BUILD_TESTING "0")
|
||||
|
||||
FetchContent_Declare(
|
||||
kcoreaddons
|
||||
GIT_REPOSITORY https://invent.kde.org/frameworks/kcoreaddons.git
|
||||
GIT_TAG ${KF5_GIT_TAG})
|
||||
FetchContent_MakeAvailable(kcoreaddons)
|
||||
|
||||
FetchContent_Declare(
|
||||
kwidgetsaddons
|
||||
GIT_REPOSITORY https://invent.kde.org/frameworks/kwidgetsaddons.git
|
||||
GIT_TAG ${KF5_GIT_TAG})
|
||||
FetchContent_MakeAvailable(kwidgetsaddons)
|
||||
else()
|
||||
find_package(KF5CoreAddons REQUIRED)
|
||||
find_package(KF5WidgetsAddons REQUIRED)
|
||||
set(KF5_PRIVATE_LIBRARIES
|
||||
KF5::WidgetsAddons
|
||||
KF5::CoreAddons
|
||||
)
|
||||
endif()
|
||||
|
@ -17,14 +17,25 @@
|
||||
message(" - qet_compilation_vars")
|
||||
|
||||
set(QET_COMPONENTS
|
||||
Widgets
|
||||
Concurrent
|
||||
LinguistTools
|
||||
PrintSupport
|
||||
Xml
|
||||
Svg
|
||||
Network
|
||||
Sql
|
||||
PrintSupport
|
||||
LinguistTools)
|
||||
Network
|
||||
Widgets
|
||||
Concurrent)
|
||||
|
||||
set(QET_PRIVATE_LIBRARIES
|
||||
Qt::PrintSupport
|
||||
Qt::Gui
|
||||
Qt::Xml
|
||||
Qt::Svg
|
||||
Qt::Sql
|
||||
Qt::Network
|
||||
Qt::Widgets
|
||||
Qt::Concurrent
|
||||
)
|
||||
|
||||
set(QET_SRC_FILES
|
||||
${QET_DIR}/sources/borderproperties.cpp
|
||||
|
@ -135,7 +135,10 @@ void DynamicTextFieldEditor::updateForm()
|
||||
ui -> m_frame_cb -> setChecked(m_text_field.data() -> frame());
|
||||
ui -> m_user_text_le -> setText(m_text_field.data() -> text());
|
||||
ui -> m_size_sb -> setValue(m_text_field.data() -> font().pointSize());
|
||||
#ifdef BUILD_WITHOUT_KF5
|
||||
#else
|
||||
ui -> m_color_kpb -> setColor(m_text_field.data() -> color());
|
||||
#endif
|
||||
ui -> m_width_sb -> setValue(m_text_field.data() -> textWidth());
|
||||
ui -> m_font_pb -> setText(m_text_field -> font().family());
|
||||
|
||||
|
@ -42,7 +42,10 @@
|
||||
#define STRINGIFY(x) #x
|
||||
#include <QProcessEnvironment>
|
||||
#include <QRegularExpression>
|
||||
#include <KAutoSaveFile>
|
||||
#ifdef BUILD_WITHOUT_KF5
|
||||
#else
|
||||
# include <KAutoSaveFile>
|
||||
#endif
|
||||
|
||||
#ifdef QET_ALLOW_OVERRIDE_CED_OPTION
|
||||
QString QETApp::common_elements_dir = QString();
|
||||
@ -2080,6 +2083,9 @@ void QETApp::buildSystemTrayMenu()
|
||||
*/
|
||||
void QETApp::checkBackupFiles()
|
||||
{
|
||||
#ifdef BUILD_WITHOUT_KF5
|
||||
return;
|
||||
#else
|
||||
QList<KAutoSaveFile *> stale_files = KAutoSaveFile::allStaleFiles();
|
||||
|
||||
//Remove from the list @stale_files, the stales file of opened project
|
||||
@ -2116,12 +2122,12 @@ void QETApp::checkBackupFiles()
|
||||
}
|
||||
for(const KAutoSaveFile *kasf : stale_files)
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
# ifdef Q_OS_WIN
|
||||
//Remove the first character '/' before the name of the drive
|
||||
text.append("<br>" + kasf->managedFile().path().remove(0,1));
|
||||
#else
|
||||
# else
|
||||
text.append("<br>" + kasf->managedFile().path());
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
|
||||
//Open backup file
|
||||
@ -2154,6 +2160,7 @@ void QETApp::checkBackupFiles()
|
||||
delete stale;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -42,7 +42,10 @@
|
||||
#include "undocommand/rotateselectioncommand.h"
|
||||
#include "undocommand/rotatetextscommand.h"
|
||||
|
||||
#include <KAutoSaveFile>
|
||||
#ifdef BUILD_WITHOUT_KF5
|
||||
#else
|
||||
# include <KAutoSaveFile>
|
||||
#endif
|
||||
|
||||
/**
|
||||
@brief QETDiagramEditor::QETDiagramEditor
|
||||
@ -1847,6 +1850,8 @@ bool QETDiagramEditor::drawGrid() const
|
||||
return m_draw_grid->isChecked();
|
||||
}
|
||||
|
||||
#ifdef BUILD_WITHOUT_KF5
|
||||
#else
|
||||
/**
|
||||
@brief QETDiagramEditor::openBackupFiles
|
||||
@param backup_files
|
||||
@ -1877,7 +1882,7 @@ void QETDiagramEditor::openBackupFiles(QList<KAutoSaveFile *> backup_files)
|
||||
DialogWaiting::dropInstance();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
/**
|
||||
met a jour le menu "Fenetres"
|
||||
*/
|
||||
|
@ -41,8 +41,11 @@ class RecentFiles;
|
||||
class DiagramPropertiesEditorDockWidget;
|
||||
class ElementsCollectionWidget;
|
||||
class AutoNumberingDockWidget;
|
||||
class KAutoSaveFile;
|
||||
|
||||
#ifdef BUILD_WITHOUT_KF5
|
||||
#else
|
||||
class KAutoSaveFile;
|
||||
#endif
|
||||
/**
|
||||
This class represents the main window of the QElectroTech diagram editor and,
|
||||
ipso facto, the most important part of the QElectroTech user interface.
|
||||
@ -65,9 +68,12 @@ class QETDiagramEditor : public QETMainWindow
|
||||
ProjectView *currentProjectView() const;
|
||||
QETProject *currentProject() const;
|
||||
bool drawGrid() const;
|
||||
#ifdef BUILD_WITHOUT_KF5
|
||||
#else
|
||||
void openBackupFiles (QList<KAutoSaveFile *> backup_files);
|
||||
|
||||
protected:
|
||||
#endif
|
||||
|
||||
protected:
|
||||
bool event(QEvent *) override;
|
||||
private:
|
||||
QETDiagramEditor(const QETDiagramEditor &);
|
||||
|
@ -77,6 +77,8 @@ QETProject::QETProject(const QString &path, QObject *parent) :
|
||||
init();
|
||||
}
|
||||
|
||||
#ifdef BUILD_WITHOUT_KF5
|
||||
#else
|
||||
/**
|
||||
@brief QETProject::QETProject
|
||||
@param backup : backup file to open, QETProject take ownership of backup.
|
||||
@ -110,6 +112,7 @@ QETProject::QETProject(KAutoSaveFile *backup, QObject *parent) :
|
||||
|
||||
init();
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
@brief QETProject::~QETProject
|
||||
@ -276,12 +279,13 @@ void QETProject::setFilePath(const QString &filepath)
|
||||
if (filepath == m_file_path) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef BUILD_WITHOUT_KF5
|
||||
#else
|
||||
if (m_backup_file.isOpen()) {
|
||||
m_backup_file.close();
|
||||
}
|
||||
m_backup_file.setManagedFile(QUrl::fromLocalFile(filepath));
|
||||
|
||||
#endif
|
||||
m_file_path = filepath;
|
||||
|
||||
QFileInfo fi(m_file_path);
|
||||
@ -1742,15 +1746,18 @@ NamesList QETProject::namesListForIntegrationCategory()
|
||||
*/
|
||||
void QETProject::writeBackup()
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
#ifdef BUILD_WITHOUT_KF5
|
||||
#else
|
||||
# if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
QDomDocument xml_project(toXml());
|
||||
QtConcurrent::run(
|
||||
QET::writeToFile,xml_project,&m_backup_file,nullptr);
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
# else
|
||||
# if TODO_LIST
|
||||
# pragma message("@TODO remove code for QT 6 or later")
|
||||
# endif
|
||||
qDebug()<<"Help code for QT 6 or later";
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -27,8 +27,10 @@
|
||||
#include "properties/xrefproperties.h"
|
||||
#include "titleblock/templatescollection.h"
|
||||
#include "titleblockproperties.h"
|
||||
|
||||
#include <KAutoSaveFile>
|
||||
#ifdef BUILD_WITHOUT_KF5
|
||||
#else
|
||||
# include <KAutoSaveFile>
|
||||
#endif
|
||||
#include <QHash>
|
||||
|
||||
class Diagram;
|
||||
@ -40,7 +42,10 @@ class NumerotationContext;
|
||||
class QUndoStack;
|
||||
class XmlElementCollection;
|
||||
class QTimer;
|
||||
#ifdef BUILD_WITHOUT_KF5
|
||||
#else
|
||||
class KAutoSaveFile;
|
||||
#endif
|
||||
|
||||
/**
|
||||
This class represents a QET project. Typically saved as a .qet file, it
|
||||
@ -68,7 +73,10 @@ class QETProject : public QObject
|
||||
public:
|
||||
QETProject (QObject *parent = nullptr);
|
||||
QETProject (const QString &path, QObject * = nullptr);
|
||||
#ifdef BUILD_WITHOUT_KF5
|
||||
#else
|
||||
QETProject (KAutoSaveFile *backup, QObject *parent=nullptr);
|
||||
#endif
|
||||
~QETProject() override;
|
||||
|
||||
private:
|
||||
@ -267,7 +275,10 @@ class QETProject : public QObject
|
||||
bool m_freeze_new_conductors = false;
|
||||
QTimer m_save_backup_timer,
|
||||
m_autosave_timer;
|
||||
#ifdef BUILD_WITHOUT_KF5
|
||||
#else
|
||||
KAutoSaveFile m_backup_file;
|
||||
#endif
|
||||
QUuid m_uuid = QUuid::createUuid();
|
||||
projectDataBase m_data_base;
|
||||
};
|
||||
|
@ -88,15 +88,8 @@ target_link_libraries(
|
||||
PUBLIC
|
||||
Catch2::Catch2
|
||||
PRIVATE
|
||||
KF5::WidgetsAddons
|
||||
KF5::CoreAddons
|
||||
Qt::Gui
|
||||
Qt::Xml
|
||||
Qt::Svg
|
||||
Qt::Sql
|
||||
Qt::Network
|
||||
Qt::Widgets
|
||||
Qt::Concurrent)
|
||||
${KF5_PRIVATE_LIBRARIES}
|
||||
${QET_PRIVATE_LIBRARIES})
|
||||
|
||||
if (DEFINED ENV{CATCH_INCLUDE_DIR})
|
||||
set(CATCH_INCLUDE_DIR $ENV{CATCH_INCLUDE_DIR})
|
||||
|
@ -85,13 +85,6 @@ target_link_libraries(
|
||||
PUBLIC
|
||||
gmock gmock_main
|
||||
PRIVATE
|
||||
KF5::WidgetsAddons
|
||||
KF5::CoreAddons
|
||||
Qt::Gui
|
||||
Qt::Xml
|
||||
Qt::Svg
|
||||
Qt::Sql
|
||||
Qt::Network
|
||||
Qt::Widgets
|
||||
Qt::Concurrent)
|
||||
${KF5_PRIVATE_LIBRARIES}
|
||||
${QET_PRIVATE_LIBRARIES})
|
||||
|
||||
|
@ -79,19 +79,11 @@ add_executable(
|
||||
tst_My_test.cpp
|
||||
main.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
${PROJECT_NAME}
|
||||
PUBLIC
|
||||
gtest gtest_main
|
||||
PRIVATE
|
||||
KF5::WidgetsAddons
|
||||
KF5::CoreAddons
|
||||
Qt::Gui
|
||||
Qt::Xml
|
||||
Qt::Svg
|
||||
Qt::Sql
|
||||
Qt::Network
|
||||
Qt::Widgets
|
||||
Qt::Concurrent)
|
||||
${KF5_PRIVATE_LIBRARIES}
|
||||
${QET_PRIVATE_LIBRARIES})
|
||||
|
||||
|
@ -74,13 +74,6 @@ target_link_libraries(
|
||||
${PROJECT_NAME}
|
||||
PRIVATE
|
||||
Qt::Test
|
||||
KF5::CoreAddons
|
||||
KF5::WidgetsAddons
|
||||
Qt::Gui
|
||||
Qt::Xml
|
||||
Qt::Svg
|
||||
Qt::Sql
|
||||
Qt::Network
|
||||
Qt::Widgets
|
||||
Qt::Concurrent)
|
||||
${KF5_PRIVATE_LIBRARIES}
|
||||
${QET_PRIVATE_LIBRARIES})
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user