diff --git a/CMakeLists.txt b/CMakeLists.txt index bba9372..b638c0e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,30 +1,22 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.16) -project(volbx LANGUAGES CXX VERSION 2.0.0 DESCRIPTION "Graphical tool for data manipulation") +project(volbx + LANGUAGES CXX + VERSION 2.1.0 + DESCRIPTION "Graphical tool for data manipulation" + HOMEPAGE_URL "https://github.com/przemek83/volbx") -set(CMAKE_INCLUDE_CURRENT_DIR ON) -set(CMAKE_AUTOUIC ON) -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTORCC ON) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) find_package(Threads REQUIRED) - -# find Qt packages -find_package(Qt5 COMPONENTS Widgets Core Gui Network Xml Test REQUIRED) -add_definitions(${QT_DEFINITIONS}) +find_package(Qt6 REQUIRED COMPONENTS Widgets Core Gui Network Xml Test) +qt_standard_project_setup() # QWT if(DEFINED ENV{QWT_ROOT}) message(STATUS "QWT_ROOT environment variable defined, using QWT_ROOT paths.") - # copy QWT dlls for easy launch - if (WIN32) - file(GLOB_RECURSE QWT_DLLS "$ENV{QWT_ROOT}/lib/*.dll" ) - file(COPY ${QWT_DLLS} DESTINATION ${CMAKE_BINARY_DIR}) - file(COPY ${QWT_DLLS} DESTINATION ${CMAKE_BINARY_DIR}/Tests) - endif() else() configure_file(CMakeLists.txt.qwt qwt/CMakeLists.txt) execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . @@ -39,30 +31,26 @@ else() set(ENV{QWT_ROOT} ${CMAKE_BINARY_DIR}/qwt/install/) endif() -set(THIRD_PARTY_LIBS zlib quazip wble qwtble eible) -foreach(file_i ${THIRD_PARTY_LIBS}) - configure_file(CMakeLists.txt.${file_i} ${file_i}/CMakeLists.txt) +set(THIRD_PARTY_LIBS wble qwtble eible zlib quazip) +foreach(library ${THIRD_PARTY_LIBS}) + configure_file(CMakeLists.txt.${library} ${library}/CMakeLists.txt) execute_process(COMMAND ${CMAKE_COMMAND} -G ${CMAKE_GENERATOR} . - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/${file_i}) + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/${library}) execute_process(COMMAND ${CMAKE_COMMAND} --build . - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/${file_i} ) -endforeach(file_i) - -# copy dlls for easy launch -if(WIN32) - file(GLOB_RECURSE DLLS "${CMAKE_BINARY_DIR}/*.dll" ) - file(COPY ${DLLS} DESTINATION ${CMAKE_BINARY_DIR}) - file(COPY ${DLLS} DESTINATION ${CMAKE_BINARY_DIR}/Tests) -endif() - -# workaround for not working passing "CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=" in ExternalProject_Add -set(workaround ON CACHE BOOL "" FORCE) + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/${library} ) +endforeach(library) include_directories($ENV{QWT_ROOT}/include) + foreach(file_i ${THIRD_PARTY_LIBS}) include_directories(${CMAKE_BINARY_DIR}/${file_i}/install/include) endforeach(file_i) +set(ZLIB_ROOT ${CMAKE_BINARY_DIR}/zlib/install) +find_package(ZLIB REQUIRED) +list(APPEND CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}/quazip/install/") +find_package(QuaZip-Qt6 CONFIG REQUIRED) + link_directories($ENV{QWT_ROOT}/lib) link_directories(${CMAKE_BINARY_DIR}/zlib/install/bin) link_directories(${CMAKE_BINARY_DIR}/quazip/install/lib) @@ -85,61 +73,69 @@ add_subdirectory(Datasets) add_subdirectory(ModelsAndViews) add_subdirectory(Export) -set(${PROJECT_NAME}_SOURCES +set(SOURCES Volbx/main.cpp Volbx/Volbx.ico - Volbx/VolbxProperties.h Volbx/VolbxProperties.rc GUI/About.cpp - GUI/About.h - GUI/About.ui GUI/CheckUpdates.cpp - GUI/CheckUpdates.h - GUI/CheckUpdates.ui GUI/DockTitleBar.cpp - GUI/DockTitleBar.h - GUI/DockTitleBar.ui GUI/Dock.cpp - GUI/Dock.h GUI/Export.cpp - GUI/Export.h - GUI/Export.ui GUI/FiltersDock.cpp - GUI/FiltersDock.h GUI/Tab.cpp - GUI/Tab.h GUI/TabWidget.cpp - GUI/TabWidget.h GUI/PlotDock.cpp - GUI/PlotDock.h GUI/SaveDatasetAs.cpp - GUI/SaveDatasetAs.h - GUI/SaveDatasetAs.ui GUI/TabBar.cpp - GUI/TabBar.h GUI/DataViewDock.cpp - GUI/DataViewDock.h GUI/VolbxMain.cpp - GUI/VolbxMain.h - GUI/VolbxMain.ui Import/ColumnsPreview.cpp - Import/ColumnsPreview.h Import/DatasetVisualization.cpp - Import/DatasetVisualization.h - Import/DatasetVisualization.ui Import/DatasetImportTab.cpp - Import/DatasetImportTab.h Import/DatasetsListBrowser.cpp - Import/DatasetsListBrowser.h - Import/DatasetsListBrowser.ui Import/ImportData.cpp - Import/ImportData.h Import/ImportTab.cpp - Import/ImportTab.h Import/SpreadsheetsImportTab.cpp +) +qt_add_resources(SOURCES Resources/Resources.qrc) + +set(HEADERS + Volbx/VolbxProperties.h + GUI/About.h + GUI/CheckUpdates.h + GUI/DockTitleBar.h + GUI/Dock.h + GUI/Export.h + GUI/FiltersDock.h + GUI/Tab.h + GUI/TabWidget.h + GUI/PlotDock.h + GUI/SaveDatasetAs.h + GUI/TabBar.h + GUI/DataViewDock.h + GUI/VolbxMain.h + Import/ColumnsPreview.h + Import/DatasetVisualization.h + Import/DatasetImportTab.h + Import/DatasetsListBrowser.h + Import/ImportData.h + Import/ImportTab.h Import/SpreadsheetsImportTab.h +) + +set(UI + GUI/About.ui + GUI/CheckUpdates.ui + GUI/DockTitleBar.ui + GUI/Export.ui + GUI/SaveDatasetAs.ui + GUI/VolbxMain.ui Import/SpreadsheetsImportTab.ui - ) + Import/DatasetsListBrowser.ui + Import/DatasetVisualization.ui +) +source_group("UI Files" FILES ${UI}) # remove background console window. if(WIN32) @@ -149,19 +145,15 @@ if(APPLE) set(GUI_TYPE MACOSX_BUNDLE) endif(APPLE) -qt5_add_resources(RESOURCES Resources/Resources.qrc) -add_custom_target(generated_qrc DEPENDS ${RESOURCES}) +add_executable(${PROJECT_NAME} ${GUI_TYPE} ${SOURCES} ${HEADERS} ${UI}) -add_executable(${PROJECT_NAME} ${GUI_TYPE} ${${PROJECT_NAME}_SOURCES} ${RESOURCES} Volbx/VolbxProperties.rc) -add_dependencies(${PROJECT_NAME} generated_qrc) +target_link_libraries(${PROJECT_NAME} Threads::Threads shared common datasets modelsAndViews export wble qwtble eible Qt6::Core Qt6::Network Qt6::Widgets Qt6::Gui Qt6::Xml) -target_link_libraries(${PROJECT_NAME} Threads::Threads shared common datasets modelsAndViews export wble qwtble eible Qt5::Core Qt5::Network Qt5::Widgets Qt5::Gui Qt5::Xml) if(WIN32) target_link_libraries(${PROJECT_NAME} optimized qwt debug qwtd) else() target_link_libraries(${PROJECT_NAME} qwt) endif() -target_link_libraries(${PROJECT_NAME} optimized Qt5Quazip debug Qt5Quazipd) add_subdirectory(Update) diff --git a/CMakeLists.txt.eible b/CMakeLists.txt.eible index c14db56..9a282fb 100644 --- a/CMakeLists.txt.eible +++ b/CMakeLists.txt.eible @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.16) include(ExternalProject) @@ -7,6 +7,6 @@ project(eible NONE) ExternalProject_Add(eible PREFIX eible GIT_REPOSITORY https://github.com/przemek83/eible.git - GIT_TAG v1.0.0 + GIT_TAG master CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/eible/install ) diff --git a/CMakeLists.txt.quazip b/CMakeLists.txt.quazip index 5f05fc5..b354237 100644 --- a/CMakeLists.txt.quazip +++ b/CMakeLists.txt.quazip @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.16) include(ExternalProject) @@ -7,8 +7,10 @@ project(quazip NONE) ExternalProject_Add(quazip PREFIX quazip GIT_REPOSITORY https://github.com/stachenov/quazip.git - GIT_TAG 9e6e827e01310c08f40979be192ba76295f4b6e4 + GIT_TAG 9d3aa3ee948c1cde5a9f873ecbc3bb229c1182ee CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/quazip/install + -DQUAZIP_QT_MAJOR_VERSION=6 -DZLIB_ROOT=${CMAKE_BINARY_DIR}/zlib/install + -DQUAZIP_BZIP2=OFF ) diff --git a/CMakeLists.txt.qwt b/CMakeLists.txt.qwt index 63ce7d8..d386045 100644 --- a/CMakeLists.txt.qwt +++ b/CMakeLists.txt.qwt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.16) include(ExternalProject) @@ -6,7 +6,8 @@ project(qwt NONE) ExternalProject_Add(qwt PREFIX qwt - SVN_REPOSITORY https://svn.code.sf.net/p/qwt/code/branches/qwt-6.1/ - CONFIGURE_COMMAND ${QT_QMAKE_EXECUTABLE} ${CMAKE_BINARY_DIR}/qwt/qwt/src/qwt/qwt.pro + GIT_REPOSITORY https://git.code.sf.net/p/qwt/git + GIT_TAG 9e554a5e03bc3a1fe379bdddfa4d21ced2ed7995 + CONFIGURE_COMMAND qmake ${CMAKE_BINARY_DIR}/qwt/qwt/src/qwt/qwt.pro INSTALL_COMMAND "" ) diff --git a/CMakeLists.txt.qwtble b/CMakeLists.txt.qwtble index 7ec2310..d9b7180 100644 --- a/CMakeLists.txt.qwtble +++ b/CMakeLists.txt.qwtble @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.16) include(ExternalProject) @@ -7,6 +7,6 @@ project(qwtble NONE) ExternalProject_Add(qwtble PREFIX qwtble GIT_REPOSITORY https://github.com/przemek83/qwtble.git - GIT_TAG v1.0.0 + GIT_TAG master CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/qwtble/install ) diff --git a/CMakeLists.txt.wble b/CMakeLists.txt.wble index 4765af3..5e41008 100644 --- a/CMakeLists.txt.wble +++ b/CMakeLists.txt.wble @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.16) include(ExternalProject) @@ -7,6 +7,6 @@ project(wble NONE) ExternalProject_Add(wble PREFIX wble GIT_REPOSITORY https://github.com/przemek83/wble.git - GIT_TAG v1.0.0 + GIT_TAG master CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/wble/install ) diff --git a/CMakeLists.txt.zlib b/CMakeLists.txt.zlib index c21faeb..7158d66 100644 --- a/CMakeLists.txt.zlib +++ b/CMakeLists.txt.zlib @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.16) include(ExternalProject) @@ -7,6 +7,8 @@ project(zlib NONE) ExternalProject_Add(zlib PREFIX zlib GIT_REPOSITORY https://github.com/madler/zlib.git - GIT_TAG 04f42ceca40f73e2978b50e93806c2a18c1281fc - CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/zlib/install -DSTATIC=OFF + GIT_TAG v1.2.13 + CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} + -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/zlib/install + -DSTATIC=OFF ) diff --git a/Common/CMakeLists.txt b/Common/CMakeLists.txt index 6d2913a..d3c2b26 100644 --- a/Common/CMakeLists.txt +++ b/Common/CMakeLists.txt @@ -1,19 +1,22 @@ project(common) -set(${PROJECT_NAME}_SOURCES +set(SOURCES Configuration.cpp - Configuration.h Constants.cpp + DatasetUtilities.cpp + TimeLogger.cpp + FileUtilities.cpp +) + +set(HEADERS + Configuration.h Constants.h ColumnTag.h - DatasetUtilities.cpp DatasetUtilities.h - TimeLogger.cpp TimeLogger.h - FileUtilities.cpp FileUtilities.h - ) +) -ADD_LIBRARY(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_SOURCES}) +ADD_LIBRARY(${PROJECT_NAME} STATIC ${SOURCES} ${HEADERS}) -target_link_libraries(${PROJECT_NAME} shared Qt5::Core) +target_link_libraries(${PROJECT_NAME} shared Qt6::Core) diff --git a/Common/FileUtilities.cpp b/Common/FileUtilities.cpp index d5c0efa..53204b6 100644 --- a/Common/FileUtilities.cpp +++ b/Common/FileUtilities.cpp @@ -13,7 +13,7 @@ std::pair loadFile(const QString& name) return {false, ""}; QTextStream stream(&file); - stream.setCodec("UTF-8"); + stream.setEncoding(QStringConverter::Utf8); return {true, stream.readAll()}; } } // namespace FileUtilities diff --git a/Datasets/CMakeLists.txt b/Datasets/CMakeLists.txt index ab9d691..9377ab0 100644 --- a/Datasets/CMakeLists.txt +++ b/Datasets/CMakeLists.txt @@ -1,18 +1,21 @@ project(datasets) -set(${PROJECT_NAME}_SOURCES +set(SOURCES Dataset.cpp - Dataset.h DatasetOds.cpp - DatasetOds.h DatasetXlsx.cpp - DatasetXlsx.h DatasetInner.cpp - DatasetInner.h DatasetSpreadsheet.cpp +) + +set(HEADERS + Dataset.h + DatasetOds.h + DatasetXlsx.h + DatasetInner.h DatasetSpreadsheet.h - ) +) -ADD_LIBRARY(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_SOURCES}) +ADD_LIBRARY(${PROJECT_NAME} STATIC ${SOURCES} ${HEADERS}) -target_link_libraries(${PROJECT_NAME} eible shared common Qt5::Core Qt5::Xml) +target_link_libraries(${PROJECT_NAME} eible shared common Qt6::Core Qt6::Xml QuaZip::QuaZip) diff --git a/Datasets/Dataset.cpp b/Datasets/Dataset.cpp index c274250..bb89c50 100644 --- a/Datasets/Dataset.cpp +++ b/Datasets/Dataset.cpp @@ -7,7 +7,7 @@ Dataset::Dataset(QString name, QObject* parent) : QObject(parent), - nullStringVariant_(QVariant::String), + nullStringVariant_(QMetaType(QMetaType::QString)), name_(std::move(name)) { } @@ -92,7 +92,7 @@ QStringList Dataset::getStringList(Column column) const if (row[column].isNull()) continue; - if (row[column].type() == QVariant::String) + if (row[column].typeId() == QMetaType::QString) { listToFill.append(row[column].toString()); continue; @@ -238,7 +238,7 @@ void Dataset::updateSampleDataStrings(QVector>& data) const for (auto& sampleDataRow : data) { - if (sampleDataRow[i].type() != QVariant::Int) + if (sampleDataRow[i].typeId() != QMetaType::Int) continue; const int index{sampleDataRow[i].toInt()}; diff --git a/Datasets/Dataset.h b/Datasets/Dataset.h index b4cf46b..c569601 100644 --- a/Datasets/Dataset.h +++ b/Datasets/Dataset.h @@ -55,7 +55,7 @@ class Dataset : public QObject { if (data_[row][column].isNull()) return &nullStringVariant_; - if (data_[row][column].type() != QVariant::String) + if (data_[row][column].typeId() != QMetaType::QString) return &sharedStrings_[data_[row][column].toInt()]; } return &data_[row][column]; diff --git a/Datasets/DatasetInner.cpp b/Datasets/DatasetInner.cpp index dc813fd..b194ec1 100644 --- a/Datasets/DatasetInner.cpp +++ b/Datasets/DatasetInner.cpp @@ -1,6 +1,6 @@ #include "DatasetInner.h" -#include +#include #include #include #include @@ -197,7 +197,7 @@ QVariant DatasetInner::getElementAsVariant(ColumnType columnFormat, case ColumnType::UNKNOWN: Q_ASSERT(false); - elementAsVariant = QVariant(QVariant::String); + elementAsVariant = QVariant(QMetaType(QMetaType::QString)); break; } } @@ -209,18 +209,18 @@ QVariant DatasetInner::getDefaultVariantForFormat(ColumnType format) switch (format) { case ColumnType::STRING: - return {QVariant::Int}; + return QVariant(QMetaType(QMetaType::Int)); case ColumnType::NUMBER: - return {QVariant::Double}; + return QVariant(QMetaType(QMetaType::Double)); case ColumnType::DATE: - return {QVariant::Date}; + return QVariant(QMetaType(QMetaType::QDate)); case ColumnType::UNKNOWN: - return {QVariant::String}; + return QVariant(QMetaType(QMetaType::QString)); } - return {QVariant::String}; + return QVariant(QMetaType(QMetaType::QString)); } QVector DatasetInner::fillRow(const QStringList& line, @@ -269,7 +269,7 @@ std::tuple>> DatasetInner::fillData( return {false, {}}; QTextStream stream(&zipFile); - stream.setCodec("UTF-8"); + stream.setEncoding(QStringConverter::Utf8); const QVector> data{parseData(stream, fillSamplesOnly)}; LOG(LogTypes::IMPORT_EXPORT, "Loaded " + QString::number(data.size()) + " rows."); @@ -281,7 +281,7 @@ QVector> DatasetInner::prepareContainerForAllData() const { QVector> data; data.resize(static_cast(rowCount())); - const int activeColumnsCount{activeColumns_.size()}; + const qsizetype activeColumnsCount{activeColumns_.size()}; for (auto& row : data) row.resize(activeColumnsCount); return data; diff --git a/Datasets/DatasetInner.h b/Datasets/DatasetInner.h index b57f3d6..f575f82 100644 --- a/Datasets/DatasetInner.h +++ b/Datasets/DatasetInner.h @@ -2,7 +2,7 @@ #include "Dataset.h" -#include +#include class QuaZipFile; class QTextStream; diff --git a/Export/CMakeLists.txt b/Export/CMakeLists.txt index 5ab3850..61bd545 100644 --- a/Export/CMakeLists.txt +++ b/Export/CMakeLists.txt @@ -1,12 +1,15 @@ project(export) -set(${PROJECT_NAME}_SOURCES +set(SOURCES ExportImage.cpp - ExportImage.h ExportVbx.cpp +) + +set(HEADERS + ExportImage.h ExportVbx.h - ) +) -ADD_LIBRARY(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_SOURCES}) +ADD_LIBRARY(${PROJECT_NAME} STATIC ${SOURCES} ${HEADERS}) -target_link_libraries(${PROJECT_NAME} shared Qt5::Core wble) +target_link_libraries(${PROJECT_NAME} shared Qt6::Core QuaZip::QuaZip) diff --git a/Export/ExportVbx.cpp b/Export/ExportVbx.cpp index 5cbc56d..76976d8 100644 --- a/Export/ExportVbx.cpp +++ b/Export/ExportVbx.cpp @@ -1,7 +1,7 @@ #include "ExportVbx.h" #include -#include +#include #include #include #include @@ -75,24 +75,24 @@ void ExportVbx::variantToString(const QVariant& variant, QByteArray& destinationArray, [[maybe_unused]] char separator) { - switch (variant.type()) + switch (variant.typeId()) { - case QVariant::Double: - case QVariant::Int: + case QMetaType::Double: + case QMetaType::Int: { destinationArray.append(variant.toByteArray()); break; } - case QVariant::Date: - case QVariant::DateTime: + case QMetaType::QDate: + case QMetaType::QDateTime: { destinationArray.append( QByteArray::number(variant.toDate().toJulianDay())); break; } - case QVariant::String: + case QMetaType::QString: { QString tmpString(variant.toString()); int& index = stringsMap_[tmpString]; diff --git a/Export/ExportVbx.h b/Export/ExportVbx.h index 6f0372c..2fcc5c8 100644 --- a/Export/ExportVbx.h +++ b/Export/ExportVbx.h @@ -5,7 +5,7 @@ #include #include -#include +#include class QAbstractItemModel; class QAbstractItemView; diff --git a/GUI/Export.cpp b/GUI/Export.cpp index 2fb3fb9..2ba0188 100644 --- a/GUI/Export.cpp +++ b/GUI/Export.cpp @@ -29,11 +29,11 @@ Export::Export(QWidget* tab, QWidget* parent) ui_->locationLineEdit->setText( Configuration::getInstance().getImportFilePath()); - auto* validator{ - new QRegExpValidator(QRegExp(QStringLiteral("[\\w]*")), ui_->prefix)}; + auto* validator{new QRegularExpressionValidator( + QRegularExpression(QStringLiteral("[\\w]*")), ui_->prefix)}; ui_->prefix->setValidator(validator); ui_->prefix->setText(tab_->windowTitle().replace( - QRegExp(QStringLiteral("[^\\w]")), QLatin1String(""))); + QRegularExpression(QStringLiteral("[^\\w]")), QLatin1String(""))); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); } diff --git a/GUI/FiltersDock.cpp b/GUI/FiltersDock.cpp index ab21008..b589ad7 100644 --- a/GUI/FiltersDock.cpp +++ b/GUI/FiltersDock.cpp @@ -116,7 +116,7 @@ FilterStrings* FiltersDock::createStringsFilter(const TableModel* parentModel, { const QString columnName{getColumnName(parentModel, index)}; QStringList list{parentModel->getStringList(index)}; - const int itemCount{list.size()}; + const qsizetype itemCount{list.size()}; list.sort(); auto* filter{new FilterStrings(columnName, std::move(list))}; auto emitChangeForColumn{[=](QStringList bannedList) { diff --git a/GUI/SaveDatasetAs.cpp b/GUI/SaveDatasetAs.cpp index ca6f708..4e17a39 100644 --- a/GUI/SaveDatasetAs.cpp +++ b/GUI/SaveDatasetAs.cpp @@ -1,7 +1,7 @@ #include "SaveDatasetAs.h" #include -#include +#include #include @@ -14,8 +14,9 @@ SaveDatasetAs::SaveDatasetAs(QStringList usedNames, QWidget* parent) connect(ui_->name, &QLineEdit::textChanged, this, &SaveDatasetAs::nameChanged); - const QRegExp datasetNameRegExp(DatasetUtilities::getDatasetNameRegExp()); - auto* validator{new QRegExpValidator(datasetNameRegExp, this)}; + const QRegularExpression datasetNameRegExp( + DatasetUtilities::getDatasetNameRegExp()); + auto* validator{new QRegularExpressionValidator(datasetNameRegExp, this)}; ui_->name->setValidator(validator); connect(ui_->save, &QPushButton::clicked, this, diff --git a/GUI/TabBar.cpp b/GUI/TabBar.cpp index 196b2c1..d54595c 100644 --- a/GUI/TabBar.cpp +++ b/GUI/TabBar.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include #include @@ -59,8 +59,8 @@ bool TabBar::eventFilter(QObject* obj, QEvent* event) void TabBar::setupLineEdit() { - auto* validator{new QRegExpValidator( - QRegExp(DatasetUtilities::getDatasetNameRegExp()), this)}; + auto* validator{new QRegularExpressionValidator( + QRegularExpression(DatasetUtilities::getDatasetNameRegExp()), this)}; nameEdit_.setValidator(validator); nameEdit_.hide(); connect(&nameEdit_, &QLineEdit::editingFinished, this, diff --git a/GUI/VolbxMain.cpp b/GUI/VolbxMain.cpp index 457f486..3c57324 100644 --- a/GUI/VolbxMain.cpp +++ b/GUI/VolbxMain.cpp @@ -1,6 +1,7 @@ #include "VolbxMain.h" #include +#include #include #include #include diff --git a/Import/ColumnsPreview.cpp b/Import/ColumnsPreview.cpp index 0d9b337..247073b 100644 --- a/Import/ColumnsPreview.cpp +++ b/Import/ColumnsPreview.cpp @@ -23,7 +23,7 @@ void ColumnsPreview::setDatasetSampleInfo( setLabels(dataset); const QVector> sampleData{dataset->retrieveSampleData()}; - const int rows{sampleData.size()}; + const qsizetype rows{sampleData.size()}; setRowCount(rows); for (int i = 0; i < rows; ++i) for (int j = 0; j < columns; ++j) diff --git a/Import/SpreadsheetsImportTab.cpp b/Import/SpreadsheetsImportTab.cpp index b430304..8aea651 100644 --- a/Import/SpreadsheetsImportTab.cpp +++ b/Import/SpreadsheetsImportTab.cpp @@ -97,7 +97,7 @@ QString SpreadsheetsImportTab::getValidDatasetName(const QFileInfo& fileInfo) const QString regexpString{DatasetUtilities::getDatasetNameRegExp().replace( QStringLiteral("["), QStringLiteral("[^"))}; QString datasetName{ - fileInfo.completeBaseName().remove(QRegExp(regexpString))}; + fileInfo.completeBaseName().remove(QRegularExpression(regexpString))}; if (datasetName.isEmpty()) datasetName = tr("Dataset"); diff --git a/ModelsAndViews/CMakeLists.txt b/ModelsAndViews/CMakeLists.txt index 4a0a965..9ba4c31 100644 --- a/ModelsAndViews/CMakeLists.txt +++ b/ModelsAndViews/CMakeLists.txt @@ -1,21 +1,24 @@ project(modelsAndViews) -set(${PROJECT_NAME}_SOURCES +set(SOURCES DataView.cpp - DataView.h DateDelegate.cpp - DateDelegate.h FilteringProxyModel.cpp - FilteringProxyModel.h NumericDelegate.cpp - NumericDelegate.h TableModel.cpp - TableModel.h PlotDataProvider.cpp +) + +set(HEADERS + DataView.h + DateDelegate.h + FilteringProxyModel.h + NumericDelegate.h + TableModel.h PlotDataProvider.h TransactionData.h - ) +) -ADD_LIBRARY(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_SOURCES}) +ADD_LIBRARY(${PROJECT_NAME} STATIC ${SOURCES} ${HEADERS}) -target_link_libraries(${PROJECT_NAME} qwtble common shared Qt5::Core Qt5::Widgets) +target_link_libraries(${PROJECT_NAME} qwtble common shared Qt6::Core Qt6::Widgets) diff --git a/Shared/CMakeLists.txt b/Shared/CMakeLists.txt index f509d88..de16177 100644 --- a/Shared/CMakeLists.txt +++ b/Shared/CMakeLists.txt @@ -1,18 +1,21 @@ project(shared) -set(${PROJECT_NAME}_SOURCES +set(SOURCES Application.cpp - Application.h LoggerCheckBox.cpp + Logger.cpp + Networking.cpp +) + +set(HEADERS + Application.h LoggerCheckBox.h CommonProperties.h - Logger.cpp Logger.h LogType.h - Networking.cpp Networking.h - ) +) -ADD_LIBRARY(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_SOURCES}) +ADD_LIBRARY(${PROJECT_NAME} STATIC ${SOURCES} ${HEADERS}) -target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Network Qt5::Widgets) +target_link_libraries(${PROJECT_NAME} Qt6::Core Qt6::Network Qt6::Widgets) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 5321ffe..77e1004 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1,47 +1,43 @@ project(tests) -qt5_add_resources(RESOURCES_TESTS testResources.qrc) -add_custom_target(generatedTest_qrc DEPENDS ${RESOURCES_TESTS}) - -set(${PROJECT_NAME}_SOURCES - qrc_testResources.cpp +set(SOURCES Common.cpp - Common.h ConfigurationTest.cpp - ConfigurationTest.h InnerTests.cpp - InnerTests.h SpreadsheetsTest.cpp - SpreadsheetsTest.h Tests.cpp - PlotDataProviderTest.h PlotDataProviderTest.cpp - FilteringProxyModelTest.h FilteringProxyModelTest.cpp DetailedSpreadsheetsTest.cpp - DetailedSpreadsheetsTest.h DatasetDummy.cpp - DatasetDummy.h DatasetTest.cpp - DatasetTest.h DatasetCommon.cpp - DatasetCommon.h - ) +) +qt_add_resources(SOURCES testResources.qrc) -add_executable(${PROJECT_NAME} ${${PROJECT_NAME}_SOURCES}) +set(HEADERS + Common.h + ConfigurationTest.h + InnerTests.h + SpreadsheetsTest.h + PlotDataProviderTest.h + FilteringProxyModelTest.h + DetailedSpreadsheetsTest.h + DatasetDummy.h + DatasetTest.h + DatasetCommon.h +) -add_dependencies(${PROJECT_NAME} generatedTest_qrc) +add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS}) -target_link_libraries(${PROJECT_NAME} common datasets modelsAndViews export Qt5::Xml Qt5::Test Qt5::Core) -target_link_libraries(${PROJECT_NAME} optimized Qt5Quazip) -target_link_libraries(${PROJECT_NAME} debug Qt5Quazipd) +target_link_libraries(${PROJECT_NAME} common datasets modelsAndViews export Qt6::Xml Qt6::Test Qt6::Core) add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory - ${CMAKE_CURRENT_SOURCE_DIR}/TestFiles/Data $/Data) + "${CMAKE_CURRENT_SOURCE_DIR}/TestFiles/Data" "$/Data") add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_CURRENT_SOURCE_DIR}/TestFiles/config $) + "${CMAKE_CURRENT_SOURCE_DIR}/TestFiles/config" "$") add_test(NAME tests COMMAND tests) diff --git a/Tests/Common.cpp b/Tests/Common.cpp index dbc1f1c..0c79ed8 100644 --- a/Tests/Common.cpp +++ b/Tests/Common.cpp @@ -11,7 +11,7 @@ void saveFile(const QString& fileName, const QString& data) file.open(QIODevice::WriteOnly); QTextStream stream(&file); - stream.setCodec("UTF-8"); + stream.setEncoding(QStringConverter::Utf8); stream << data; } diff --git a/Tests/DatasetCommon.cpp b/Tests/DatasetCommon.cpp index 580243c..60c641c 100644 --- a/Tests/DatasetCommon.cpp +++ b/Tests/DatasetCommon.cpp @@ -150,12 +150,13 @@ void compareExportDataWithDump(std::unique_ptr dataset, FileUtilities::loadFile(filePath + Common::getDataTsvDumpSuffix()) .second}; - QVector actualDataLines{ - actualData.splitRef(QRegExp(QStringLiteral("\n|\r\n")))}; - QVector expectedDataLines{ - expectedData.splitRef(QRegExp(QStringLiteral("\n|\r\n")))}; + QStringList actualDataLines{ + actualData.split(QRegularExpression(QStringLiteral("\n|\r\n")))}; + QStringList expectedDataLines{ + expectedData.split(QRegularExpression(QStringLiteral("\n|\r\n")))}; QCOMPARE(actualDataLines.size(), expectedDataLines.size()); for (int i = 0; i < actualDataLines.size(); ++i) + { if (actualDataLines[i] != expectedDataLines[i]) { const QString msg{"Difference in line " + QString::number(i + 1) + @@ -163,6 +164,7 @@ void compareExportDataWithDump(std::unique_ptr dataset, "\nExpected: " + expectedDataLines[i]}; QFAIL(msg.toStdString().c_str()); } + } } std::unique_ptr createDataset(const QString& fileName, diff --git a/Tests/InnerTests.cpp b/Tests/InnerTests.cpp index 13c7d23..92ea7d0 100644 --- a/Tests/InnerTests.cpp +++ b/Tests/InnerTests.cpp @@ -1,6 +1,6 @@ #include "InnerTests.h" -#include +#include #include #include #include diff --git a/Tests/SpreadsheetsTest.cpp b/Tests/SpreadsheetsTest.cpp index 3fab798..4165092 100644 --- a/Tests/SpreadsheetsTest.cpp +++ b/Tests/SpreadsheetsTest.cpp @@ -100,8 +100,8 @@ void SpreadsheetsTest::compareOdsAndXlsxExpectedData(const QString& fileSuffix) FileUtilities::loadFile(filePath + ".ods" + fileSuffix); QVERIFY(odsLoaded); - QVector xlsxLines{xlsxDump.splitRef('\n')}; - QVector odsLines{odsDump.splitRef('\n')}; + QStringList xlsxLines{xlsxDump.split('\n')}; + QStringList odsLines{odsDump.split('\n')}; QCOMPARE(xlsxLines.size(), odsLines.size()); for (int i = 0; i < xlsxLines.size(); ++i) if (xlsxLines[i] != odsLines[i]) diff --git a/Tests/SpreadsheetsTest.h b/Tests/SpreadsheetsTest.h index 4147e93..c5cdcc3 100644 --- a/Tests/SpreadsheetsTest.h +++ b/Tests/SpreadsheetsTest.h @@ -51,7 +51,6 @@ private Q_SLOTS: "test2", "testAccounts", "testDataWithPlot", - "testDataWithPlot", "test", "testFileData", "test01", diff --git a/Update/CMakeLists.txt b/Update/CMakeLists.txt index 8021ec0..c336f24 100644 --- a/Update/CMakeLists.txt +++ b/Update/CMakeLists.txt @@ -2,14 +2,21 @@ #Workaround it using different name. project(VersionCheck) -set(${PROJECT_NAME}_SOURCES +set(SOURCES main.cpp Update.cpp + UpdateProperties.rc +) + +set(HEADERS Update.h - Update.ui UpdateProperties.h - UpdateProperties.rc - ) +) + +set(UI + Update.ui +) +source_group("UI Files" FILES ${UI}) include_directories(${CMAKE_SOURCE_DIR}) @@ -21,6 +28,6 @@ if(APPLE) set(GUI_TYPE MACOSX_BUNDLE) endif(APPLE) -add_executable(${PROJECT_NAME} ${GUI_TYPE} ${${PROJECT_NAME}_SOURCES}) +add_executable(${PROJECT_NAME} ${GUI_TYPE} ${SOURCES} ${HEADERS} ${UI}) -target_link_libraries(${PROJECT_NAME} shared Qt5::Core Qt5::Network Qt5::Gui) +target_link_libraries(${PROJECT_NAME} shared Qt6::Core Qt6::Network Qt6::Gui) diff --git a/Update/Update.cpp b/Update/Update.cpp index e45665a..9daa3e8 100644 --- a/Update/Update.cpp +++ b/Update/Update.cpp @@ -121,7 +121,7 @@ void Update::initialInfoNetworkReplyFinished(QNetworkReply* reply) void Update::fillFilesToUpdateLists(const QStringList& serverInfoList) { // First line/element is correctness checker, second version. - const int filesCount{serverInfoList.size() - 2}; + const qsizetype filesCount{serverInfoList.size() - 2}; insertNewSectionIntoDetails( tr("Found") + QLatin1Char(' ') + QString::number(filesCount) + QLatin1Char(' ') + (filesCount != 1 ? tr("files") : tr("file")) +