diff --git a/CMakeLists.txt b/CMakeLists.txt index d00bdab1..96566086 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,7 +34,7 @@ set(CMAKE_VERBOSE_MAKEFILE true) # Set flags # if (NOT MSVC) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -g -fno-inline -std=c++11") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -g -fno-inline") else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc") endif() @@ -85,8 +85,8 @@ include_directories(${Boost_INCLUDE_DIRS}) set(LIBS ${Boost_LIBRARIES}) ############# Qt -find_package(Qt5 COMPONENTS Core Widgets Gui Xml OpenGL Concurrent LinguistTools REQUIRED) -set(LIBS ${LIBS} Qt5::Widgets Qt5::Gui Qt5::Core Qt5::Xml Qt5::OpenGL Qt5::Concurrent) +find_package(Qt6 COMPONENTS Core Widgets Gui Xml OpenGL OpenGLWidgets Concurrent LinguistTools REQUIRED) +set(LIBS ${LIBS} Qt6::Widgets Qt6::Gui Qt6::Core Qt6::Xml Qt6::OpenGL Qt6::OpenGLWidgets Qt6::Concurrent) ############################################################################ @@ -96,12 +96,12 @@ set(LIBS ${LIBS} Qt5::Widgets Qt5::Gui Qt5::Core Qt5::Xml Qt5::OpenGL Qt5::Concu # # Configuration # -if (CMAKE_SIZEOF_VOID_P MATCHES 8) # if x64 - message(STATUS "x64 configuration") - set(CONFIGURATION "x64") -else() # if x86 - message(STATUS "x86 configuration") - set(CONFIGURATION "x86") +if (CMAKE_SIZEOF_VOID_P MATCHES 8) # if 64-bits + message(STATUS "64 bits configuration") + set(CONFIGURATION "BUILD_64") +else() # if 32-bits + message(STATUS "32 bits configuration") + set(CONFIGURATION "BUILD_32") endif() # @@ -146,10 +146,15 @@ SET(TRANSLATION_FILES list(TRANSFORM TRANSLATION_FILES PREPEND ${CMAKE_CURRENT_SOURCE_DIR}/res/languages/) -# Redefine "qt5_create_translation" function because of a bug (it originally parse all boost files, and make the build VERY slow) -include(${CMAKE_CURRENT_SOURCE_DIR}/etc/cmake/Qt5LinguistToolsMacros.cmake) +# Redefine "qt6_create_translation" function because of a bug (it originally parse all boost files, and make the build VERY slow) +include(${CMAKE_CURRENT_SOURCE_DIR}/etc/cmake/Qt6LinguistToolsMacros.cmake) -qt5_create_translation(QM_FILES ${SRC_FILES} ${TRANSLATION_FILES} OPTIONS -no-obsolete) +# TODO: Figure out why this is needed. +if (WIN32) + qt6_create_translation(QM_FILES ${SRC_FILES} ${TRANSLATION_FILES}) +else () + qt6_create_translation(QM_FILES ${SRC_FILES} ${TRANSLATION_FILES} OPTIONS "-no-obsolete") +endif () configure_file(res/languages/translations.qrc ${CMAKE_BINARY_DIR} COPYONLY) @@ -249,4 +254,4 @@ if(DOXYGEN_FOUND) else() message(STATUS "Doxygen not found") -endif() \ No newline at end of file +endif() diff --git a/etc/cmake/Qt5LinguistToolsMacros.cmake b/etc/cmake/Qt6LinguistToolsMacros.cmake similarity index 96% rename from etc/cmake/Qt5LinguistToolsMacros.cmake rename to etc/cmake/Qt6LinguistToolsMacros.cmake index 6e7fb6a0..7b7070fb 100644 --- a/etc/cmake/Qt5LinguistToolsMacros.cmake +++ b/etc/cmake/Qt6LinguistToolsMacros.cmake @@ -33,7 +33,7 @@ include(CMakeParseArguments) # redefine this function because of a bug (it originally parse all boost files, and make the build VERY slow) -function(QT5_CREATE_TRANSLATION _qm_files) +function(QT6_CREATE_TRANSLATION _qm_files) set(options) set(oneValueArgs) set(multiValueArgs OPTIONS) @@ -82,7 +82,7 @@ function(QT5_CREATE_TRANSLATION _qm_files) get_source_file_property(_qm_output_location ${_ts_file} OUTPUT_LOCATION) add_custom_command(OUTPUT ${_tmpts_file} - COMMAND ${Qt5_LUPDATE_EXECUTABLE} + COMMAND ${Qt6_LUPDATE_EXECUTABLE} ARGS ${_lupdate_options} "@${_ts_lst_file}" -ts ${_ts_file} COMMAND ${CMAKE_COMMAND} -E copy ${_ts_file} ${_tmpts_file} DEPENDS ${_my_sources} @@ -93,6 +93,6 @@ function(QT5_CREATE_TRANSLATION _qm_files) endif() endforeach() - qt5_add_translation(${_qm_files} ${_my_temptsfiles}) + qt6_add_translation(${_qm_files} ${_my_temptsfiles}) set(${_qm_files} ${${_qm_files}} PARENT_SCOPE) endfunction() diff --git a/src/Core/LogicModel/Gate/GateLibraryExporter.cc b/src/Core/LogicModel/Gate/GateLibraryExporter.cc index f8d00010..34e7b564 100644 --- a/src/Core/LogicModel/Gate/GateLibraryExporter.cc +++ b/src/Core/LogicModel/Gate/GateLibraryExporter.cc @@ -73,7 +73,7 @@ void GateLibraryExporter::export_data(std::string const& filename, GateLibrary_s } QTextStream stream(&file); - stream.setCodec("UTF-8"); + stream.setEncoding(QStringConverter::Utf8); stream << doc.toString(); file.close(); diff --git a/src/Core/LogicModel/LogicModelExporter.cc b/src/Core/LogicModel/LogicModelExporter.cc index f2d7ba5b..21abfc2d 100644 --- a/src/Core/LogicModel/LogicModelExporter.cc +++ b/src/Core/LogicModel/LogicModelExporter.cc @@ -130,7 +130,7 @@ void LogicModelExporter::export_data(std::string const& filename, LogicModel_shp } QTextStream stream(&file); - stream.setCodec("UTF-8"); + stream.setEncoding(QStringConverter::Utf8); stream << doc.toString(); file.close(); diff --git a/src/Core/Project/ProjectExporter.cc b/src/Core/Project/ProjectExporter.cc index a2ae7e29..64e859cb 100644 --- a/src/Core/Project/ProjectExporter.cc +++ b/src/Core/Project/ProjectExporter.cc @@ -106,7 +106,7 @@ void ProjectExporter::export_data(std::string const& filename, const Project_shp } QTextStream stream(&file); - stream.setCodec("UTF-8"); + stream.setEncoding(QStringConverter::Utf8); stream << doc.toString(); file.close(); diff --git a/src/Core/RuleCheck/RCVBlacklistExporter.cc b/src/Core/RuleCheck/RCVBlacklistExporter.cc index 9431e00b..bb819829 100644 --- a/src/Core/RuleCheck/RCVBlacklistExporter.cc +++ b/src/Core/RuleCheck/RCVBlacklistExporter.cc @@ -59,7 +59,7 @@ void RCVBlacklistExporter::export_data(std::string const& filename, } QTextStream stream(&file); - stream.setCodec("UTF-8"); + stream.setEncoding(QStringConverter::Utf8); stream << doc.toString(); file.close(); diff --git a/src/Core/Utils/MemoryMap.h b/src/Core/Utils/MemoryMap.h index af796693..aaeb345f 100644 --- a/src/Core/Utils/MemoryMap.h +++ b/src/Core/Utils/MemoryMap.h @@ -409,8 +409,17 @@ namespace degate return RET_ERR; } +#ifdef SYS_APPLE + + struct stat inf; + if (fstat(file, &inf) < 0) + +#else + struct stat64 inf; if (fstat64(file, &inf) < 0) + +#endif { debug(TM, "can't get the size of file: %s", filename.c_str()); return RET_ERR; diff --git a/src/Core/XML/XMLImporter.h b/src/Core/XML/XMLImporter.h index 8ec359df..26f84833 100644 --- a/src/Core/XML/XMLImporter.h +++ b/src/Core/XML/XMLImporter.h @@ -49,7 +49,7 @@ namespace degate const QString attribute = node.attribute(QString::fromStdString(attribute_str), 0); - if (attribute == 0) + if (attribute.isNull()) { throw XMLAttributeMissingException(std::string("attribute is not present: ") + attribute_str); } @@ -69,7 +69,7 @@ namespace degate const QString attribute = node.attribute(QString::fromStdString(attribute_str), 0); - if (attribute == 0) return default_value; + if (attribute.isNull()) return default_value; else return parse_number(attribute.toStdString()); } diff --git a/src/GUI/Dialog/GateEditDialog.cc b/src/GUI/Dialog/GateEditDialog.cc index da6702c6..6b112af2 100644 --- a/src/GUI/Dialog/GateEditDialog.cc +++ b/src/GUI/Dialog/GateEditDialog.cc @@ -28,6 +28,9 @@ #include "GateEditDialog.h" #include "TerminalDialog.h" +#include +#include + namespace degate { // Entity tab diff --git a/src/GUI/Dialog/GateEditDialog.h b/src/GUI/Dialog/GateEditDialog.h index eb0e925b..57cea110 100644 --- a/src/GUI/Dialog/GateEditDialog.h +++ b/src/GUI/Dialog/GateEditDialog.h @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include diff --git a/src/GUI/Dialog/GateLibraryDialog.cc b/src/GUI/Dialog/GateLibraryDialog.cc index 83a0e74e..3bf045c1 100644 --- a/src/GUI/Dialog/GateLibraryDialog.cc +++ b/src/GUI/Dialog/GateLibraryDialog.cc @@ -21,6 +21,8 @@ #include "GateLibraryDialog.h" +#include + namespace degate { GateLibraryDialog::GateLibraryDialog(QWidget* parent, const Project_shptr& project) diff --git a/src/GUI/Dialog/GateListDialog.cc b/src/GUI/Dialog/GateListDialog.cc index 7d8c5169..316811b0 100644 --- a/src/GUI/Dialog/GateListDialog.cc +++ b/src/GUI/Dialog/GateListDialog.cc @@ -45,7 +45,7 @@ namespace degate // ID Filter id_filter_label.setText(tr("ID filter:")); - id_filter_edit.setValidator(new QRegExpValidator(QRegExp("[0-9]*"), this)); + id_filter_edit.setValidator(new QRegularExpressionValidator(QRegularExpression("[0-9]*"), this)); // Gate template name filter gate_template_name_filter_label.setText(tr("Gate template filter:")); diff --git a/src/GUI/Dialog/PortPlacementDialog.h b/src/GUI/Dialog/PortPlacementDialog.h index 0923051e..aa252bfa 100644 --- a/src/GUI/Dialog/PortPlacementDialog.h +++ b/src/GUI/Dialog/PortPlacementDialog.h @@ -25,6 +25,7 @@ #include "GUI/Widget/PortPlacementWidget.h" #include +#include #include namespace degate diff --git a/src/GUI/MainWindow.cc b/src/GUI/MainWindow.cc index 95c1ea7a..aadb6f6c 100644 --- a/src/GUI/MainWindow.cc +++ b/src/GUI/MainWindow.cc @@ -25,8 +25,10 @@ #include "Core/Version.h" #include "Core/Utils/CrashReport.h" +#include + #ifdef SYS_WINDOWS -#include +#include #endif #include @@ -38,7 +40,7 @@ namespace degate MainWindow::MainWindow(int width, int height) : status_bar(this), tools_group(this), updater(this) { if (width == 0 || height == 0) - resize(QDesktopWidget().availableGeometry(this).size() * 0.7); + resize(QGuiApplication::screenAt(this->pos())->availableGeometry().size() * 0.7); else resize(width, height); @@ -407,10 +409,10 @@ namespace degate QObject::connect(&auto_save_timer, SIGNAL(timeout()), this, SLOT(auto_save())); // Workaround for a bug on Windows that occurs when using QOpenGLWidget + fullscreen mode. - // See: https://doc.qt.io/qt-5/windows-issues.html#fullscreen-opengl-based-windows. + // See: https://doc.qt.io/qt-6/windows-issues.html#fullscreen-opengl-based-windows. #ifdef SYS_WINDOWS - this->topLevelWidget()->winId(); - QWindowsWindowFunctions::setHasBorderInFullScreen(this->topLevelWidget()->windowHandle(), true); + HWND handle = reinterpret_cast(window()->winId()); + SetWindowLongPtr(handle, GWL_STYLE, GetWindowLongPtr(handle, GWL_STYLE) | WS_BORDER); #endif // Check for updates. diff --git a/src/GUI/Text/Text.cc b/src/GUI/Text/Text.cc index 2ba4ce11..f83ed197 100644 --- a/src/GUI/Text/Text.cc +++ b/src/GUI/Text/Text.cc @@ -550,7 +550,7 @@ namespace degate font_data->font = font; QTextStream font_config_file_stream(&font_config_file); - font_config_file_stream.setCodec("UTF-8"); + font_config_file_stream.setEncoding(QStringConverter::Utf8); if (font_config_file_stream.readLine().toUInt() != font_data->font.font_size || font_config_file_stream.readLine().toStdString() != font_data->font.font_family_name) { @@ -703,7 +703,7 @@ namespace degate } QTextStream font_config_file_stream(&font_config_file); - font_config_file_stream.setCodec("UTF-8"); + font_config_file_stream.setEncoding(QStringConverter::Utf8); font_config_file_stream << font_data->font.font_size << Qt::endl; font_config_file_stream << QString::fromStdString(font_data->font.font_family_name) << Qt::endl; diff --git a/src/GUI/Utils/ImageRenderer.h b/src/GUI/Utils/ImageRenderer.h index f891fa19..0127cb02 100644 --- a/src/GUI/Utils/ImageRenderer.h +++ b/src/GUI/Utils/ImageRenderer.h @@ -26,6 +26,7 @@ #include "Core/Project/Project.h" #include +#include /** * This define the zoom out factor (zoom *= zoom_out). diff --git a/src/GUI/Utils/Updater.cc b/src/GUI/Utils/Updater.cc index 731e0da5..3459ec6a 100644 --- a/src/GUI/Utils/Updater.cc +++ b/src/GUI/Utils/Updater.cc @@ -33,7 +33,7 @@ namespace degate : parent(parent) { connect(&process, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(process_finished(int, QProcess::ExitStatus))); - connect(&process, SIGNAL(error(QProcess::ProcessError)), this, SLOT(process_error(QProcess::ProcessError))); + connect(&process, SIGNAL(errorOccurred(QProcess::ProcessError)), this, SLOT(process_error(QProcess::ProcessError))); #if defined(Q_OS_WIN) tool_name = "maintenancetool.exe"; diff --git a/src/GUI/Workspace/WorkspaceRenderer.h b/src/GUI/Workspace/WorkspaceRenderer.h index 2adc039d..e463c0f7 100644 --- a/src/GUI/Workspace/WorkspaceRenderer.h +++ b/src/GUI/Workspace/WorkspaceRenderer.h @@ -40,6 +40,7 @@ #include "GUI/Workspace/WorkspaceRegularGrid.h" #include +#include #include #include