Minimal Qt version increased to Qt 5.15. Minimal C++ standard to C++17.
This commit is contained in:
parent
35adb101ba
commit
38dbbe29ba
|
@ -62,6 +62,7 @@
|
|||
- Puzzle app. Horizontal piece flipping.
|
||||
- Mirror line.
|
||||
- Fold line.
|
||||
- Minimal Qt version increased to Qt 5.15. Minimal C++ standard to C++17.
|
||||
|
||||
# Valentina 0.7.52 September 12, 2022
|
||||
- Fix crash when default locale is ru.
|
||||
|
|
30
appveyor.yml
30
appveyor.yml
|
@ -158,18 +158,6 @@ environment:
|
|||
WINDEPLOYQT_NO_COMPILER_RUNTIME: "false"
|
||||
DEPLOY: true
|
||||
RUN_TESTS: true
|
||||
|
||||
- job_name: Windows_Qt_5_6_(GCC_x86)
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
COMPILER: mingw
|
||||
QT: Qt\5.6\mingw49_32
|
||||
QT_VERSION: Qt5_6
|
||||
BUILD_SYSTEM: "make"
|
||||
MINGW_PATH: C:\Qt\Tools\mingw492_32\bin
|
||||
ARCH: x86
|
||||
PYTHON: "C:\\Python38"
|
||||
PLATFORM: "WindowsXP+"
|
||||
DEPLOY: true
|
||||
|
||||
- job_name: Windows_Qt_5_15_(make_GCC_x86)
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||
|
@ -259,18 +247,6 @@ environment:
|
|||
PLATFORM: "macOS_10.13+"
|
||||
DEPLOY: false
|
||||
|
||||
- job_name: Windows_Qt_5_6_(MSVC_x64)
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
COMPILER: msvc
|
||||
QT: Qt\5.6\msvc2015_64
|
||||
QT_VERSION: Qt5_6
|
||||
BUILD_SYSTEM: "nmake"
|
||||
VSVER: 14
|
||||
ARCH: x64
|
||||
PYTHON: "C:\\Python38-x64"
|
||||
PLATFORM: "WindowsXP+"
|
||||
DEPLOY: false
|
||||
|
||||
matrix:
|
||||
fast_finish: false
|
||||
exclude:
|
||||
|
@ -286,8 +262,6 @@ matrix:
|
|||
job_name: Windows_Qt_5_15_(qbs_GCC_x64)
|
||||
- platform: x86
|
||||
job_name: Windows_Qt_5_15_(qbs_MSVC_x64)
|
||||
- platform: x86
|
||||
job_name: Windows_Qt_5_6_(MSVC_x64)
|
||||
- platform: x86
|
||||
job_name: MacOS_12_Qt_6_4 (multibundle)
|
||||
- platform: x86
|
||||
|
@ -302,8 +276,6 @@ matrix:
|
|||
job_name: Windows_Qt_5_15_(make_GCC_x86)
|
||||
- platform: x64
|
||||
job_name: Windows_Qt_5_15_(qbs_GCC_x86)
|
||||
- platform: x64
|
||||
job_name: Windows_Qt_5_6_(GCC_x86)
|
||||
|
||||
for:
|
||||
|
||||
|
@ -449,8 +421,6 @@ for:
|
|||
- job_name: Windows_Qt_5_15_(make_GCC_x86)
|
||||
- job_name: Windows_Qt_5_15_(make_GCC_x64)
|
||||
- job_name: Windows_Qt_5_15_(nmake_MSVC_x64)
|
||||
- job_name: Windows_Qt_5_6_(GCC_x86)
|
||||
- job_name: Windows_Qt_5_6_(MSVC_x64)
|
||||
|
||||
# clone directory
|
||||
clone_folder: c:\projects\valentina
|
||||
|
|
BIN
dist/win/openssl/win32/libeay32.dll
vendored
BIN
dist/win/openssl/win32/libeay32.dll
vendored
Binary file not shown.
BIN
dist/win/openssl/win32/ssleay32.dll
vendored
BIN
dist/win/openssl/win32/ssleay32.dll
vendored
Binary file not shown.
BIN
dist/win/openssl/win64/libeay32.dll
vendored
BIN
dist/win/openssl/win64/libeay32.dll
vendored
Binary file not shown.
BIN
dist/win/openssl/win64/ssleay32.dll
vendored
BIN
dist/win/openssl/win64/ssleay32.dll
vendored
Binary file not shown.
|
@ -42,9 +42,7 @@ CppApplication {
|
|||
cpp.cxxLanguageVersion: {
|
||||
if (Qt.core.versionMajor >= 6) // Start building with C++20 since Qt 6.0
|
||||
return "c++20";
|
||||
else if(Qt.core.versionMajor >= 5 && Qt.core.versionMinor >= 12) // Since Qt 5.12 available support for C++17
|
||||
return "c++17";
|
||||
return "c++11";
|
||||
return "c++17";
|
||||
}
|
||||
|
||||
Properties {
|
||||
|
@ -52,11 +50,7 @@ CppApplication {
|
|||
cpp.minimumWindowsVersion: {
|
||||
if (Qt.core.versionMajor >= 6)
|
||||
return "6.02"; // should be 10.0
|
||||
|
||||
if (Qt.core.versionMajor >= 5 && Qt.core.versionMinor >= 7)
|
||||
return "6.00";
|
||||
|
||||
return "5.01";
|
||||
return "6.00";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,31 +74,18 @@ CppApplication {
|
|||
files.push("msvcr120.dll");
|
||||
|
||||
// Minimal supported OpenSSL version since Qt 5.12.4 is 1.1.1.
|
||||
if (Utilities.versionCompare(Qt.core.version, "5.12.4") >= 0) {
|
||||
if (qbs.architecture.contains("x86_64")) {
|
||||
files.push(
|
||||
"openssl/win64/libcrypto-1_1-x64.dll",
|
||||
"openssl/win64/libssl-1_1-x64.dll"
|
||||
);
|
||||
} else {
|
||||
files.push(
|
||||
"openssl/win32/libcrypto-1_1.dll",
|
||||
"openssl/win32/libssl-1_1.dll"
|
||||
);
|
||||
}
|
||||
if (qbs.architecture.contains("x86_64")) {
|
||||
files.push(
|
||||
"openssl/win64/libcrypto-1_1-x64.dll",
|
||||
"openssl/win64/libssl-1_1-x64.dll"
|
||||
);
|
||||
} else {
|
||||
if (qbs.architecture.contains("x86_64")) {
|
||||
files.push(
|
||||
"openssl/win64/libeay32.dll",
|
||||
"openssl/win64/ssleay32.dll"
|
||||
);
|
||||
} else {
|
||||
files.push(
|
||||
"openssl/win32/libeay32.dll",
|
||||
"openssl/win32/ssleay32.dll"
|
||||
);
|
||||
}
|
||||
files.push(
|
||||
"openssl/win32/libcrypto-1_1.dll",
|
||||
"openssl/win32/libssl-1_1.dll"
|
||||
);
|
||||
}
|
||||
|
||||
return files;
|
||||
}
|
||||
qbs.install: true
|
||||
|
|
|
@ -26,9 +26,7 @@ Library {
|
|||
cpp.cxxLanguageVersion: {
|
||||
if (Qt.core.versionMajor >= 6) // Start building with C++20 since Qt 6.0
|
||||
return "c++20";
|
||||
else if(Qt.core.versionMajor >= 5 && Qt.core.versionMinor >= 12) // Since Qt 5.12 available support for C++17
|
||||
return "c++17";
|
||||
return "c++11";
|
||||
return "c++17";
|
||||
}
|
||||
|
||||
Properties {
|
||||
|
@ -37,10 +35,7 @@ Library {
|
|||
if (Qt.core.versionMajor >= 6)
|
||||
return "6.02"; // should be 10.0
|
||||
|
||||
if (Qt.core.versionMajor >= 5 && Qt.core.versionMinor >= 7)
|
||||
return "6.00";
|
||||
|
||||
return "5.01";
|
||||
return "6.00";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -157,34 +157,8 @@ Module {
|
|||
return "10.15"; // Qt 6.4 and above
|
||||
}
|
||||
|
||||
if (Qt.core.versionMajor >= 5) {
|
||||
// See page https://doc.qt.io/qt-5.15/supported-platforms.html
|
||||
// For qt 5.14 https://doc.qt.io/archives/qt-5.14/supported-platforms.html
|
||||
if (Qt.core.versionMinor >= 14) // Qt 5.14
|
||||
return "10.13";
|
||||
|
||||
// For Qt 5.13 https://doc.qt.io/archives/qt-5.13/supported-platforms.html
|
||||
// For Qt 5.12 https://doc.qt.io/archives/qt-5.12/supported-platforms.html
|
||||
if (Qt.core.versionMinor >= 12) // Qt 5.12
|
||||
return "10.12";
|
||||
|
||||
// For older versions https://doc.qt.io/archives/qt-5.11/supported-platforms-and-configurations.html
|
||||
if (Qt.core.versionMinor >= 10) // Qt 5.11 and Qt 5.10
|
||||
return "10.11";
|
||||
|
||||
if (Qt.core.versionMinor >= 9) // Qt 5.9
|
||||
return "10.10";
|
||||
|
||||
if (Qt.core.versionMinor >= 8) // Qt 5.8
|
||||
return "10.9";
|
||||
|
||||
if (Qt.core.versionMinor >= 7) // Qt 5.7
|
||||
return "10.8";
|
||||
|
||||
return "10.7";
|
||||
}
|
||||
|
||||
return undefined;
|
||||
// See page https://doc.qt.io/qt-5.15/supported-platforms.html
|
||||
return "10.13";
|
||||
}
|
||||
|
||||
cpp.separateDebugInformation: true
|
||||
|
|
|
@ -24,14 +24,8 @@ Module {
|
|||
var enableCompression = input.moduleProperty("ebr", "enableCompression");
|
||||
if (enableCompression) {
|
||||
var compressAlgorithm = input.moduleProperty("ebr", "compressAlgorithm");
|
||||
if (product.Qt.core.versionMajor >= 5 && product.Qt.core.versionMinor >= 13) {
|
||||
// Since Qt 5.13 we have option to select compress algorithm
|
||||
if (compressAlgorithm !== "zstd")
|
||||
args.push("-compress-algo", compressAlgorithm);
|
||||
} else {
|
||||
if (compressAlgorithm !== "zlib")
|
||||
compressAlgorithm = "zlib";
|
||||
}
|
||||
if (compressAlgorithm !== "zstd")
|
||||
args.push("-compress-algo", compressAlgorithm);
|
||||
|
||||
var thresholdLevel = input.moduleProperty("ebr", "thresholdLevel");
|
||||
if (thresholdLevel !== 70)
|
||||
|
|
|
@ -32,9 +32,6 @@
|
|||
#include <QScrollBar>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
#include "../vmisc/backport/qoverload.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
#include "../layout/vplayout.h"
|
||||
#include "../layout/vpsheet.h"
|
||||
|
||||
|
|
|
@ -35,9 +35,6 @@
|
|||
#include <QWidget>
|
||||
|
||||
#include "../layout/layoutdef.h"
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
|
|
|
@ -32,9 +32,6 @@
|
|||
#include <QMouseEvent>
|
||||
|
||||
#include "../layout/layoutdef.h"
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif
|
||||
|
||||
class VPCarrouselPiece : public QListWidgetItem
|
||||
{
|
||||
|
|
|
@ -43,10 +43,6 @@
|
|||
#include "vpcarrouselpiece.h"
|
||||
#include "vpmimedatapiece.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
#include "../vmisc/backport/qoverload.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_CLANG("-Wmissing-prototypes")
|
||||
QT_WARNING_DISABLE_INTEL(1418)
|
||||
|
|
|
@ -34,9 +34,6 @@
|
|||
#include <QUuid>
|
||||
|
||||
#include "../layout/layoutdef.h"
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif
|
||||
|
||||
class VPMimeDataPiece : public QMimeData
|
||||
{
|
||||
|
|
|
@ -34,10 +34,6 @@
|
|||
#include "../vmisc/vabstractshortcutmanager.h"
|
||||
#include "ui_puzzlepreferencesconfigurationpage.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
#include "../vmisc/backport/qoverload.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
|
||||
#include <QStyleHints>
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -30,10 +30,6 @@
|
|||
|
||||
#include <QWidget>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class PuzzlePreferencesConfigurationPage;
|
||||
|
|
|
@ -26,15 +26,12 @@
|
|||
**
|
||||
*************************************************************************/
|
||||
#include "puzzlepreferenceslayoutpage.h"
|
||||
#include "ui_puzzlepreferenceslayoutpage.h"
|
||||
#include "../../vpapplication.h"
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
#include "../vmisc/backport/qoverload.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
#include "ui_puzzlepreferenceslayoutpage.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
PuzzlePreferencesLayoutPage::PuzzlePreferencesLayoutPage(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
PuzzlePreferencesLayoutPage::PuzzlePreferencesLayoutPage(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
ui(new Ui::PuzzlePreferencesLayoutPage)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
@ -49,47 +46,48 @@ PuzzlePreferencesLayoutPage::PuzzlePreferencesLayoutPage(QWidget *parent) :
|
|||
|
||||
ReadSettings();
|
||||
|
||||
connect(ui->comboBoxLayoutUnit, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &PuzzlePreferencesLayoutPage::ConvertPaperSize);
|
||||
connect(ui->comboBoxLayoutUnit, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
&PuzzlePreferencesLayoutPage::ConvertPaperSize);
|
||||
|
||||
connect(ui->comboBoxSheetTemplates, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, [this]
|
||||
{
|
||||
SheetSize(SheetTemplate()); m_settingsChanged = true;
|
||||
});
|
||||
connect(ui->comboBoxTileTemplates, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, [this]
|
||||
{
|
||||
TileSize(TileTemplate());
|
||||
m_settingsChanged = true;
|
||||
});
|
||||
connect(ui->comboBoxSheetTemplates, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
[this]
|
||||
{
|
||||
SheetSize(SheetTemplate());
|
||||
m_settingsChanged = true;
|
||||
});
|
||||
connect(ui->comboBoxTileTemplates, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
[this]
|
||||
{
|
||||
TileSize(TileTemplate());
|
||||
m_settingsChanged = true;
|
||||
});
|
||||
|
||||
connect(ui->doubleSpinBoxSheetPaperWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, &PuzzlePreferencesLayoutPage::SheetPaperSizeChanged);
|
||||
connect(ui->doubleSpinBoxSheetPaperHeight, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, &PuzzlePreferencesLayoutPage::SheetPaperSizeChanged);
|
||||
connect(ui->doubleSpinBoxTilePaperWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, &PuzzlePreferencesLayoutPage::TilePaperSizeChanged);
|
||||
connect(ui->doubleSpinBoxTilePaperHeight, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, &PuzzlePreferencesLayoutPage::TilePaperSizeChanged);
|
||||
connect(ui->doubleSpinBoxSheetPaperWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
|
||||
&PuzzlePreferencesLayoutPage::SheetPaperSizeChanged);
|
||||
connect(ui->doubleSpinBoxSheetPaperHeight, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
|
||||
&PuzzlePreferencesLayoutPage::SheetPaperSizeChanged);
|
||||
connect(ui->doubleSpinBoxTilePaperWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
|
||||
&PuzzlePreferencesLayoutPage::TilePaperSizeChanged);
|
||||
connect(ui->doubleSpinBoxTilePaperHeight, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
|
||||
&PuzzlePreferencesLayoutPage::TilePaperSizeChanged);
|
||||
|
||||
connect(ui->doubleSpinBoxSheetPaperWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, &PuzzlePreferencesLayoutPage::FindSheetTemplate);
|
||||
connect(ui->doubleSpinBoxSheetPaperHeight, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, &PuzzlePreferencesLayoutPage::FindSheetTemplate);
|
||||
connect(ui->doubleSpinBoxTilePaperWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, &PuzzlePreferencesLayoutPage::FindTileTemplate);
|
||||
connect(ui->doubleSpinBoxTilePaperHeight, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, &PuzzlePreferencesLayoutPage::FindTileTemplate);
|
||||
connect(ui->doubleSpinBoxSheetPaperWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
|
||||
&PuzzlePreferencesLayoutPage::FindSheetTemplate);
|
||||
connect(ui->doubleSpinBoxSheetPaperHeight, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
|
||||
&PuzzlePreferencesLayoutPage::FindSheetTemplate);
|
||||
connect(ui->doubleSpinBoxTilePaperWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
|
||||
&PuzzlePreferencesLayoutPage::FindTileTemplate);
|
||||
connect(ui->doubleSpinBoxTilePaperHeight, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
|
||||
&PuzzlePreferencesLayoutPage::FindTileTemplate);
|
||||
|
||||
connect(ui->doubleSpinBoxSheetPaperWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, &PuzzlePreferencesLayoutPage::CorrectMaxMargins);
|
||||
connect(ui->doubleSpinBoxSheetPaperHeight, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, &PuzzlePreferencesLayoutPage::CorrectMaxMargins);
|
||||
connect(ui->doubleSpinBoxTilePaperWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, &PuzzlePreferencesLayoutPage::CorrectMaxMargins);
|
||||
connect(ui->doubleSpinBoxTilePaperHeight, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, &PuzzlePreferencesLayoutPage::CorrectMaxMargins);
|
||||
connect(ui->doubleSpinBoxSheetPaperWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
|
||||
&PuzzlePreferencesLayoutPage::CorrectMaxMargins);
|
||||
connect(ui->doubleSpinBoxSheetPaperHeight, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
|
||||
&PuzzlePreferencesLayoutPage::CorrectMaxMargins);
|
||||
connect(ui->doubleSpinBoxTilePaperWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
|
||||
&PuzzlePreferencesLayoutPage::CorrectMaxMargins);
|
||||
connect(ui->doubleSpinBoxTilePaperHeight, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
|
||||
&PuzzlePreferencesLayoutPage::CorrectMaxMargins);
|
||||
|
||||
connect(ui->checkBoxLayoutIgnoreFileds, &QCheckBox::stateChanged, this,
|
||||
&PuzzlePreferencesLayoutPage::LayoutSheetIgnoreMargins);
|
||||
|
@ -105,29 +103,31 @@ PuzzlePreferencesLayoutPage::PuzzlePreferencesLayoutPage(QWidget *parent) :
|
|||
connect(ui->toolButtonTileLandscapeOrientation, &QToolButton::toggled, this,
|
||||
&PuzzlePreferencesLayoutPage::SwapTileOrientation);
|
||||
|
||||
connect(ui->doubleSpinBoxSheetMarginLeft, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, [this](){m_settingsChanged=true;});
|
||||
connect(ui->doubleSpinBoxSheetMarginRight, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, [this](){m_settingsChanged=true;});
|
||||
connect(ui->doubleSpinBoxSheetMarginTop, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, [this](){m_settingsChanged=true;});
|
||||
connect(ui->doubleSpinBoxSheetMarginBottom, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, [this](){m_settingsChanged=true;});
|
||||
connect(ui->doubleSpinBoxSheetMarginLeft, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
|
||||
[this]() { m_settingsChanged = true; });
|
||||
connect(ui->doubleSpinBoxSheetMarginRight, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
|
||||
[this]() { m_settingsChanged = true; });
|
||||
connect(ui->doubleSpinBoxSheetMarginTop, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
|
||||
[this]() { m_settingsChanged = true; });
|
||||
connect(ui->doubleSpinBoxSheetMarginBottom, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
|
||||
[this]() { m_settingsChanged = true; });
|
||||
|
||||
connect(ui->checkBoxTileShowTiles, &QCheckBox::stateChanged, this, [this](){m_settingsChanged=true;});
|
||||
connect(ui->checkBoxTileShowWatermark, &QCheckBox::stateChanged, this, [this](){m_settingsChanged=true;});
|
||||
connect(ui->checkBoxTileShowWatermark, &QCheckBox::stateChanged, this, [this](){m_settingsChanged=true;});
|
||||
connect(ui->checkBoxTileShowTiles, &QCheckBox::stateChanged, this, [this]() { m_settingsChanged = true; });
|
||||
connect(ui->checkBoxTileShowWatermark, &QCheckBox::stateChanged, this, [this]() { m_settingsChanged = true; });
|
||||
connect(ui->checkBoxTileShowWatermark, &QCheckBox::stateChanged, this, [this]() { m_settingsChanged = true; });
|
||||
|
||||
connect(ui->doubleSpinBoxPiecesGap, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, [this](){m_settingsChanged=true;});
|
||||
connect(ui->doubleSpinBoxPiecesGap, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
|
||||
[this]() { m_settingsChanged = true; });
|
||||
ui->doubleSpinBoxPiecesGap->setSuffix(UnitsToStr(m_oldLayoutUnit));
|
||||
|
||||
ui->spinBoxLineWidth->setSuffix(UnitsToStr(Unit::Px));
|
||||
|
||||
connect(ui->checkBoxWarningPiecesSuperposition, &QCheckBox::stateChanged, this, [this](){m_settingsChanged=true;});
|
||||
connect(ui->checkBoxStickyEdges, &QCheckBox::stateChanged, this, [this](){m_settingsChanged=true;});
|
||||
connect(ui->checkBoxWarningPiecesOutOfBound, &QCheckBox::stateChanged, this, [this](){m_settingsChanged=true;});
|
||||
connect(ui->checkBoxFollowGrainline, &QCheckBox::stateChanged, this, [this](){m_settingsChanged=true;});
|
||||
connect(ui->checkBoxWarningPiecesSuperposition, &QCheckBox::stateChanged, this,
|
||||
[this]() { m_settingsChanged = true; });
|
||||
connect(ui->checkBoxStickyEdges, &QCheckBox::stateChanged, this, [this]() { m_settingsChanged = true; });
|
||||
connect(ui->checkBoxWarningPiecesOutOfBound, &QCheckBox::stateChanged, this,
|
||||
[this]() { m_settingsChanged = true; });
|
||||
connect(ui->checkBoxFollowGrainline, &QCheckBox::stateChanged, this, [this]() { m_settingsChanged = true; });
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -145,9 +145,9 @@ auto PuzzlePreferencesLayoutPage::Apply() -> QStringList
|
|||
settings->SetLayoutUnit(LayoutUnit());
|
||||
|
||||
settings->SetLayoutSheetPaperHeight(
|
||||
UnitConvertor(ui->doubleSpinBoxSheetPaperHeight->value(), m_oldLayoutUnit, Unit::Px));
|
||||
UnitConvertor(ui->doubleSpinBoxSheetPaperHeight->value(), m_oldLayoutUnit, Unit::Px));
|
||||
settings->SetLayoutSheetPaperWidth(
|
||||
UnitConvertor(ui->doubleSpinBoxSheetPaperWidth->value(), m_oldLayoutUnit, Unit::Px));
|
||||
UnitConvertor(ui->doubleSpinBoxSheetPaperWidth->value(), m_oldLayoutUnit, Unit::Px));
|
||||
|
||||
settings->SetLayoutSheetIgnoreMargins(ui->checkBoxLayoutIgnoreFileds->isChecked());
|
||||
settings->SetLayoutSheetMargins(GetSheetMargins());
|
||||
|
@ -156,9 +156,9 @@ auto PuzzlePreferencesLayoutPage::Apply() -> QStringList
|
|||
settings->SetLayoutTileShowWatermark(ui->checkBoxTileShowWatermark->isChecked());
|
||||
|
||||
settings->SetLayoutTilePaperHeight(
|
||||
UnitConvertor(ui->doubleSpinBoxTilePaperHeight->value(), m_oldLayoutUnit, Unit::Px));
|
||||
UnitConvertor(ui->doubleSpinBoxTilePaperHeight->value(), m_oldLayoutUnit, Unit::Px));
|
||||
settings->SetLayoutTilePaperWidth(
|
||||
UnitConvertor(ui->doubleSpinBoxTilePaperWidth->value(), m_oldLayoutUnit, Unit::Px));
|
||||
UnitConvertor(ui->doubleSpinBoxTilePaperWidth->value(), m_oldLayoutUnit, Unit::Px));
|
||||
|
||||
settings->SetLayoutTileIgnoreMargins(ui->checkBoxTileIgnoreFileds->isChecked());
|
||||
settings->SetLayoutTileMargins(GetTileMargins());
|
||||
|
@ -318,8 +318,8 @@ void PuzzlePreferencesLayoutPage::CorrectMaxMargins()
|
|||
const qreal sheetHeight = ui->doubleSpinBoxSheetPaperHeight->value();
|
||||
|
||||
// 80%/2 of paper size for each field
|
||||
const qreal sheetWidthMargin = (sheetWidth*80.0/100.0)/2.0;
|
||||
const qreal sheetHeightMargin = (sheetHeight*80.0/100.0)/2.0;
|
||||
const qreal sheetWidthMargin = (sheetWidth * 80.0 / 100.0) / 2.0;
|
||||
const qreal sheetHeightMargin = (sheetHeight * 80.0 / 100.0) / 2.0;
|
||||
|
||||
ui->doubleSpinBoxSheetMarginLeft->setMaximum(sheetWidthMargin);
|
||||
ui->doubleSpinBoxSheetMarginRight->setMaximum(sheetWidthMargin);
|
||||
|
@ -330,8 +330,8 @@ void PuzzlePreferencesLayoutPage::CorrectMaxMargins()
|
|||
const qreal tileHeight = ui->doubleSpinBoxTilePaperHeight->value();
|
||||
|
||||
// 80%/2 of paper size for each field
|
||||
const qreal tileWidthMargin = (tileWidth*80.0/100.0)/2.0;
|
||||
const qreal tileHeightMargin = (tileHeight*80.0/100.0)/2.0;
|
||||
const qreal tileWidthMargin = (tileWidth * 80.0 / 100.0) / 2.0;
|
||||
const qreal tileHeightMargin = (tileHeight * 80.0 / 100.0) / 2.0;
|
||||
|
||||
ui->doubleSpinBoxTileMarginLeft->setMaximum(tileWidthMargin);
|
||||
ui->doubleSpinBoxTileMarginRight->setMaximum(tileWidthMargin);
|
||||
|
@ -689,10 +689,10 @@ void PuzzlePreferencesLayoutPage::FindTemplate(QComboBox *box, qreal width, qrea
|
|||
const Unit paperUnit = LayoutUnit();
|
||||
|
||||
const int max = static_cast<int>(VAbstractLayoutDialog::PaperSizeTemplate::Custom);
|
||||
for (int i=0; i < max; ++i)
|
||||
for (int i = 0; i < max; ++i)
|
||||
{
|
||||
const QSizeF tmplSize = VAbstractLayoutDialog::GetTemplateSize(
|
||||
static_cast<VAbstractLayoutDialog::PaperSizeTemplate>(i), paperUnit);
|
||||
const QSizeF tmplSize =
|
||||
VAbstractLayoutDialog::GetTemplateSize(static_cast<VAbstractLayoutDialog::PaperSizeTemplate>(i), paperUnit);
|
||||
if (QSizeF(width, height) == tmplSize || QSizeF(height, width) == tmplSize)
|
||||
{
|
||||
box->blockSignals(true);
|
||||
|
|
|
@ -30,10 +30,6 @@
|
|||
|
||||
#include <QWidget>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class PuzzlePreferencesPathPage;
|
||||
|
|
|
@ -30,10 +30,6 @@
|
|||
|
||||
#include <QDialog>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class DialogPuzzlePreferences;
|
||||
|
|
|
@ -30,9 +30,6 @@
|
|||
#include "../vlayout/vlayoutexporter.h"
|
||||
#include "../vpapplication.h"
|
||||
#include "ui_dialogsavemanuallayout.h"
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
#include "../vmisc/backport/qoverload.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QShowEvent>
|
||||
|
|
|
@ -31,10 +31,6 @@
|
|||
|
||||
#include <QDialog>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class VPDialogAbout;
|
||||
|
|
|
@ -37,10 +37,6 @@
|
|||
#include "../vlayout/vlayoutpiece.h"
|
||||
#include "vpiecegrainline.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
|
||||
class VPLayout;
|
||||
class VPSheet;
|
||||
|
||||
|
|
|
@ -39,10 +39,6 @@
|
|||
|
||||
#include "../vmisc/def.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
|
||||
class VPLayout;
|
||||
class VPPiece;
|
||||
class VMainGraphicsScene;
|
||||
|
|
|
@ -32,12 +32,8 @@
|
|||
#include "vpapplication.h"
|
||||
|
||||
#if defined(APPIMAGE) && defined(Q_OS_LINUX)
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
|
||||
#include "../vmisc/backport/qscopeguard.h"
|
||||
#else
|
||||
#include <QScopeGuard>
|
||||
#endif
|
||||
#include "../vmisc/appimage.h"
|
||||
#include <QScopeGuard>
|
||||
#endif // defined(APPIMAGE) && defined(Q_OS_LINUX)
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
|
@ -121,11 +117,9 @@ auto main(int argc, char *argv[]) -> int
|
|||
VPApplication app(argc, argv);
|
||||
app.InitOptions();
|
||||
|
||||
QT_REQUIRE_VERSION(argc, argv, "5.6.0") // clazy:exclude=qstring-arg,qstring-allocations NOLINT
|
||||
QT_REQUIRE_VERSION(argc, argv, "5.15.0") // clazy:exclude=qstring-arg,qstring-allocations NOLINT
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
||||
VPApplication::setDesktopFileName(QStringLiteral("ua.com.smart-pattern.puzzle.desktop"));
|
||||
#endif
|
||||
|
||||
QTimer::singleShot(0, &app, &VPApplication::ProcessCMD);
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ inline auto LineFont(const TextLine &tl, const VSvgFont &base) -> VSvgFont
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline auto LineAlign(const TextLine &tl, const QString &text, const QFontMetrics &fm, qreal width) -> qreal
|
||||
{
|
||||
const int lineWidth = TextWidth(fm, text);
|
||||
const int lineWidth = fm.horizontalAdvance(text);
|
||||
|
||||
qreal dX = 0;
|
||||
if (tl.m_eAlign == 0 || (tl.m_eAlign & Qt::AlignLeft) > 0)
|
||||
|
@ -553,7 +553,7 @@ void VPGraphicsPiece::InitPieceLabelOutlineFont(const QVector<QPointF> &labelSha
|
|||
for (auto c : qAsConst(tl.m_qsText))
|
||||
{
|
||||
path.addPath(corrector.DrawChar(w, static_cast<qreal>(fm.ascent()), c));
|
||||
w += TextWidth(fm, c);
|
||||
w += fm.horizontalAdvance(c);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -35,10 +35,6 @@
|
|||
#include "../layout/layoutdef.h"
|
||||
#include "scenedef.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
|
||||
class VTextManager;
|
||||
class VGraphicsFillItem;
|
||||
|
||||
|
|
|
@ -34,10 +34,6 @@
|
|||
#include "../layout/layoutdef.h"
|
||||
#include "scenedef.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
|
||||
class VPLayout;
|
||||
class VPGraphicsPiece;
|
||||
class QGraphicsView;
|
||||
|
|
|
@ -34,9 +34,6 @@
|
|||
#include <QPainter>
|
||||
|
||||
#include "../layout/layoutdef.h"
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif
|
||||
|
||||
class VPLayout;
|
||||
|
||||
|
|
|
@ -35,10 +35,6 @@
|
|||
|
||||
#include "../layout/layoutdef.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
|
||||
class VPTileFactory;
|
||||
class VPLayout;
|
||||
struct VWatermarkData;
|
||||
|
@ -47,7 +43,7 @@ class VPGraphicsTileGrid : public QGraphicsItem
|
|||
{
|
||||
public:
|
||||
explicit VPGraphicsTileGrid(const VPLayoutPtr &layout, const QUuid &sheetUuid, QGraphicsItem *parent = nullptr);
|
||||
~VPGraphicsTileGrid() override =default;
|
||||
~VPGraphicsTileGrid() override = default;
|
||||
|
||||
auto boundingRect() const -> QRectF override;
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
||||
|
|
|
@ -28,17 +28,13 @@
|
|||
#ifndef VPUNDOCOMMAND_H
|
||||
#define VPUNDOCOMMAND_H
|
||||
|
||||
#include <QLoggingCategory>
|
||||
#include <QObject>
|
||||
#include <QUndoCommand>
|
||||
#include <QLoggingCategory>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
|
||||
namespace ML
|
||||
{
|
||||
enum class UndoCommand: qint8
|
||||
enum class UndoCommand : qint8
|
||||
{
|
||||
MovePiece = 0,
|
||||
MovePieces = 1,
|
||||
|
@ -51,17 +47,18 @@ enum class UndoCommand: qint8
|
|||
ZValueMovePiece = 8,
|
||||
ZValueMovePieces = 9,
|
||||
};
|
||||
} // namespace ML
|
||||
} // namespace ML
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(vpUndo) // NOLINT
|
||||
|
||||
class VPUndoCommand : public QObject, public QUndoCommand
|
||||
{
|
||||
Q_OBJECT // NOLINT
|
||||
|
||||
public:
|
||||
explicit VPUndoCommand(QUndoCommand *parent = nullptr);
|
||||
explicit VPUndoCommand(bool allowMerge = false, QUndoCommand *parent = nullptr);
|
||||
~VPUndoCommand() override =default;
|
||||
~VPUndoCommand() override = default;
|
||||
|
||||
auto AllowMerge() const -> bool;
|
||||
|
||||
|
@ -72,7 +69,6 @@ private:
|
|||
bool m_allowMerge{false};
|
||||
};
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline auto VPUndoCommand::AllowMerge() const -> bool
|
||||
{
|
||||
|
|
|
@ -28,12 +28,8 @@
|
|||
#ifndef VPUNDOPIECEZVALUEMOVE_H
|
||||
#define VPUNDOPIECEZVALUEMOVE_H
|
||||
|
||||
#include "vpundocommand.h"
|
||||
#include "../layout/layoutdef.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "vpundocommand.h"
|
||||
|
||||
namespace ML
|
||||
{
|
||||
|
@ -49,9 +45,10 @@ enum class ZValueMove
|
|||
class VPUndoPieceZValueMove : public VPUndoCommand
|
||||
{
|
||||
Q_OBJECT // NOLINT
|
||||
|
||||
public:
|
||||
VPUndoPieceZValueMove(const VPPiecePtr &piece, ML::ZValueMove move, QUndoCommand *parent = nullptr);
|
||||
~VPUndoPieceZValueMove() override =default;
|
||||
~VPUndoPieceZValueMove() override = default;
|
||||
|
||||
void undo() override;
|
||||
void redo() override;
|
||||
|
@ -74,9 +71,10 @@ private:
|
|||
class VPUndoPiecesZValueMove : public VPUndoCommand
|
||||
{
|
||||
Q_OBJECT // NOLINT
|
||||
|
||||
public:
|
||||
VPUndoPiecesZValueMove(const QList<VPPiecePtr> &pieces, ML::ZValueMove move, QUndoCommand *parent = nullptr);
|
||||
~VPUndoPiecesZValueMove() override =default;
|
||||
~VPUndoPiecesZValueMove() override = default;
|
||||
|
||||
void undo() override;
|
||||
void redo() override;
|
||||
|
@ -86,15 +84,15 @@ private:
|
|||
Q_DISABLE_COPY_MOVE(VPUndoPiecesZValueMove) // NOLINT
|
||||
|
||||
QList<VPPieceWeakPtr> m_pieces{};
|
||||
ML::ZValueMove m_move;
|
||||
ML::ZValueMove m_move;
|
||||
QHash<QString, qreal> m_oldValues{};
|
||||
|
||||
auto Layout() const -> VPLayoutPtr;
|
||||
auto Sheet() const -> VPSheetPtr;
|
||||
|
||||
auto PieceIds() const -> QVector<QString>;
|
||||
static auto Levels(const QList<VPPiecePtr> &allPieces, const QVector<QString> &skipPieces,
|
||||
bool skip) -> QList<QVector<QString>>;
|
||||
static auto Levels(const QList<VPPiecePtr> &allPieces, const QVector<QString> &skipPieces, bool skip)
|
||||
-> QList<QVector<QString>>;
|
||||
static auto LevelStep(const QList<VPPiecePtr> &pieces) -> qreal;
|
||||
};
|
||||
|
||||
|
|
|
@ -115,26 +115,6 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
|||
#endif // defined(V_NO_ASSERT)
|
||||
|
||||
#if defined(Q_OS_MAC)
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
// Try hide very annoying, Qt related, warnings in Mac OS X
|
||||
// QNSView mouseDragged: Internal mouse button tracking invalid (missing Qt::LeftButton)
|
||||
// https://bugreports.qt.io/browse/QTBUG-42846
|
||||
if ((type == QtWarningMsg) && msg.contains(QStringLiteral("QNSView")))
|
||||
{
|
||||
type = QtDebugMsg;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 9, 0)
|
||||
// Hide Qt bug 'Assertion when reading an icns file'
|
||||
// https://bugreports.qt.io/browse/QTBUG-45537
|
||||
// Remove after Qt fix will be released
|
||||
if ((type == QtWarningMsg) && msg.contains(QStringLiteral("QICNSHandler::read()")))
|
||||
{
|
||||
type = QtDebugMsg;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Hide anything that starts with QMacCGContext
|
||||
if ((type == QtWarningMsg) && msg.contains(QStringLiteral("QMacCGContext::")))
|
||||
{
|
||||
|
|
|
@ -37,10 +37,6 @@
|
|||
#include <ciso646> // and, not, or
|
||||
#endif
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif
|
||||
|
||||
class VPCommandLine;
|
||||
using VPCommandLinePtr = std::shared_ptr<VPCommandLine>;
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <QPrintPreviewDialog>
|
||||
#include <QPrinterInfo>
|
||||
#include <QSaveFile>
|
||||
#include <QScopeGuard>
|
||||
#include <QSvgGenerator>
|
||||
#include <QTimer>
|
||||
#include <QUndoStack>
|
||||
|
@ -75,16 +76,6 @@
|
|||
#include "xml/vplayoutfilereader.h"
|
||||
#include "xml/vplayoutfilewriter.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
#include "../vmisc/backport/qoverload.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
|
||||
#include "../vmisc/backport/qscopeguard.h"
|
||||
#else
|
||||
#include <QScopeGuard>
|
||||
#endif
|
||||
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_CLANG("-Wmissing-prototypes")
|
||||
QT_WARNING_DISABLE_INTEL(1418)
|
||||
|
@ -93,16 +84,7 @@ Q_LOGGING_CATEGORY(pWindow, "p.window") // NOLINT
|
|||
|
||||
QT_WARNING_POP
|
||||
|
||||
#if (defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
|
||||
// DO NOT WORK WITH GCC 4.8
|
||||
#else
|
||||
#if __cplusplus >= 201402L
|
||||
using namespace std::chrono_literals;
|
||||
#else
|
||||
#include "../vmisc/bpstd/chrono.hpp"
|
||||
using namespace bpstd::literals::chrono_literals;
|
||||
#endif // __cplusplus >= 201402L
|
||||
#endif //(defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
|
||||
#include "../vmisc/compatibility.h"
|
||||
|
@ -432,7 +414,7 @@ VPMainWindow::VPMainWindow(const VPCommandLinePtr &cmd, QWidget *parent)
|
|||
|
||||
if (m_cmd->IsGuiEnabled())
|
||||
{
|
||||
QTimer::singleShot(V_SECONDS(1), this, &VPMainWindow::AskDefaultSettings);
|
||||
QTimer::singleShot(1s, this, &VPMainWindow::AskDefaultSettings);
|
||||
}
|
||||
|
||||
if (VAbstractShortcutManager *manager = VAbstractApplication::VApp()->GetShortcutManager())
|
||||
|
@ -3483,15 +3465,6 @@ void VPMainWindow::ShowToolTip(const QString &toolTip)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPMainWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
#if defined(Q_OS_MAC) && QT_VERSION < QT_VERSION_CHECK(5, 11, 1)
|
||||
// Workaround for Qt bug https://bugreports.qt.io/browse/QTBUG-43344
|
||||
static int numCalled = 0;
|
||||
if (numCalled++ >= 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (MaybeSave())
|
||||
{
|
||||
WriteSettings();
|
||||
|
|
|
@ -102,11 +102,6 @@ auto TriangleBasic() -> QPainterPath
|
|||
}
|
||||
} // namespace
|
||||
|
||||
// See https://stackoverflow.com/a/46719572/3045403
|
||||
#if __cplusplus < 201703L // C++17
|
||||
constexpr qreal VPTileFactory::tileStripeWidth; // NOLINT(readability-redundant-declaration)
|
||||
#endif
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPTileFactory::VPTileFactory(const VPLayoutPtr &layout, VCommonSettings *commonSettings, QObject *parent)
|
||||
: QObject(parent),
|
||||
|
@ -359,7 +354,7 @@ void VPTileFactory::DrawRuler(QPainter *painter, qreal scale) const
|
|||
qreal unitsWidth = 0;
|
||||
QFontMetrics fm(fnt);
|
||||
QString units = rulerUnits != Unit::Inch ? tr("cm", "unit") : tr("in", "unit");
|
||||
unitsWidth = TextWidth(fm, units);
|
||||
unitsWidth = fm.horizontalAdvance(units);
|
||||
painter->drawText(QPointF(step * 0.5 - unitsWidth * 0.6,
|
||||
m_drawingAreaHeight - tileStripeWidth + notchHeight + shortNotchHeight),
|
||||
units);
|
||||
|
@ -629,7 +624,7 @@ void VPTileFactory::DrawTextInformation(QPainter *painter, int row, int col, int
|
|||
td.setPageSize(QSizeF(m_drawingAreaHeight - UnitConvertor(2, Unit::Cm, Unit::Px), m_drawingAreaWidth));
|
||||
|
||||
QFontMetrics metrix = QFontMetrics(td.defaultFont());
|
||||
int maxWidth = TextWidth(metrix, QString().fill('z', 50));
|
||||
int maxWidth = metrix.horizontalAdvance(QString().fill('z', 50));
|
||||
QString clippedSheetName = metrix.elidedText(sheetName, Qt::ElideMiddle, maxWidth);
|
||||
|
||||
td.setHtml(QStringLiteral("<table width='100%' style='color:rgb(%1);'>"
|
||||
|
@ -754,11 +749,7 @@ void VPTileFactory::PaintWatermarkImage(QPainter *painter, const QRectF &img, co
|
|||
return;
|
||||
}
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
|
||||
qint64 fileSize = watermarkImage.byteCount();
|
||||
#else
|
||||
qint64 fileSize = watermarkImage.sizeInBytes();
|
||||
#endif
|
||||
qint64 pixelSize = fileSize / watermarkImage.height() / watermarkImage.width();
|
||||
QSize scaledSize(qRound(watermarkImage.width() / xScale), qRound(watermarkImage.height() / yScale));
|
||||
qint64 scaledImageSize = pixelSize * scaledSize.width() * scaledSize.height() / 1024;
|
||||
|
|
|
@ -35,10 +35,6 @@
|
|||
#include "../ifc/ifcdef.h"
|
||||
#include "layout/layoutdef.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
|
||||
class QGraphicsScene;
|
||||
class VCommonSettings;
|
||||
class QPainter;
|
||||
|
|
|
@ -30,10 +30,6 @@
|
|||
|
||||
#include "../vmisc/vabstractshortcutmanager.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif
|
||||
|
||||
class VPuzzleShortcutManager : public VAbstractShortcutManager
|
||||
{
|
||||
Q_OBJECT // NOLINT
|
||||
|
|
|
@ -37,10 +37,6 @@
|
|||
#include "../vmisc/vabstractshortcutmanager.h"
|
||||
#include "ui_tapepreferencesconfigurationpage.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
#include "../vmisc/backport/qoverload.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
|
||||
#include <QStyleHints>
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -31,10 +31,6 @@
|
|||
|
||||
#include <QWidget>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif
|
||||
|
||||
class QComboBox;
|
||||
|
||||
namespace Ui
|
||||
|
|
|
@ -30,10 +30,6 @@
|
|||
|
||||
#include <QWidget>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class TapePreferencesPathPage;
|
||||
|
|
|
@ -31,10 +31,6 @@
|
|||
|
||||
#include <QDialog>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class DialogAboutTape;
|
||||
|
|
|
@ -32,10 +32,6 @@
|
|||
|
||||
#include "../vformat/vdimensions.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class DialogDimensionCustomNames;
|
||||
|
@ -46,7 +42,7 @@ class DialogDimensionCustomNames : public QDialog
|
|||
Q_OBJECT // NOLINT
|
||||
|
||||
public:
|
||||
explicit DialogDimensionCustomNames(const QMap<MeasurementDimension, MeasurementDimension_p > &dimensions,
|
||||
explicit DialogDimensionCustomNames(const QMap<MeasurementDimension, MeasurementDimension_p> &dimensions,
|
||||
QWidget *parent = nullptr);
|
||||
~DialogDimensionCustomNames() override;
|
||||
|
||||
|
|
|
@ -27,17 +27,14 @@
|
|||
*************************************************************************/
|
||||
#include "dialogdimensionlabels.h"
|
||||
#include "ui_dialogdimensionlabels.h"
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
#include "../vmisc/backport/qoverload.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogDimensionLabels::DialogDimensionLabels(const QMap<MeasurementDimension, MeasurementDimension_p> &dimensions,
|
||||
bool fullCircumference, QWidget *parent)
|
||||
: QDialog(parent),
|
||||
ui(new Ui::DialogDimensionLabels),
|
||||
m_dimensions(dimensions),
|
||||
m_fullCircumference(fullCircumference)
|
||||
: QDialog(parent),
|
||||
ui(new Ui::DialogDimensionLabels),
|
||||
m_dimensions(dimensions),
|
||||
m_fullCircumference(fullCircumference)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
|
@ -119,7 +116,7 @@ void DialogDimensionLabels::InitLabels()
|
|||
|
||||
const QList<MeasurementDimension_p> dimensions = m_dimensions.values();
|
||||
|
||||
for(const auto &dimension : dimensions)
|
||||
for (const auto &dimension : dimensions)
|
||||
{
|
||||
m_labels.insert(dimension->Type(), dimension->Labels());
|
||||
}
|
||||
|
@ -131,7 +128,7 @@ void DialogDimensionLabels::InitDimensions()
|
|||
ui->comboBoxDimensionLabels->blockSignals(true);
|
||||
ui->comboBoxDimensionLabels->clear();
|
||||
|
||||
for(auto &dimension : m_dimensions)
|
||||
for (auto &dimension : m_dimensions)
|
||||
{
|
||||
ui->comboBoxDimensionLabels->addItem(dimension->Name(), static_cast<int>(dimension->Type()));
|
||||
}
|
||||
|
@ -166,7 +163,7 @@ void DialogDimensionLabels::InitTable()
|
|||
|
||||
const DimesionLabels labels = m_labels.value(type);
|
||||
|
||||
for(int row = 0; row < bases.size(); ++row)
|
||||
for (int row = 0; row < bases.size(); ++row)
|
||||
{
|
||||
const qreal base = bases.at(row);
|
||||
|
||||
|
@ -208,16 +205,15 @@ auto DialogDimensionLabels::DimensionValue(const MeasurementDimension_p &dimensi
|
|||
{
|
||||
if (dimension->IsBodyMeasurement())
|
||||
{
|
||||
return QString::number(m_fullCircumference ? value*2 : value);
|
||||
return QString::number(m_fullCircumference ? value * 2 : value);
|
||||
}
|
||||
|
||||
return QString::number(value);
|
||||
|
||||
}
|
||||
|
||||
if (dimension->Type() == MeasurementDimension::W || dimension->Type() == MeasurementDimension::Z)
|
||||
{
|
||||
return QString::number(m_fullCircumference ? value*2 : value);
|
||||
return QString::number(m_fullCircumference ? value * 2 : value);
|
||||
}
|
||||
|
||||
return QString::number(value);
|
||||
|
|
|
@ -29,9 +29,6 @@
|
|||
#include "ui_dialogknownmeasurementscsvcolumns.h"
|
||||
|
||||
#include "../vmisc/qxtcsvmodel.h"
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
#include "../vmisc/backport/qoverload.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
#include "../vtools/dialogs/dialogtoolbox.h"
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
|
|
|
@ -30,10 +30,6 @@
|
|||
|
||||
#include <QDialog>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif
|
||||
|
||||
class QxtCsvModel;
|
||||
class QComboBox;
|
||||
|
||||
|
|
|
@ -32,10 +32,6 @@
|
|||
#include <QDialog>
|
||||
#include <QUuid>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class DialogMDataBase;
|
||||
|
|
|
@ -27,12 +27,8 @@
|
|||
*************************************************************************/
|
||||
#include "dialogmeasurementscsvcolumns.h"
|
||||
#include "../vmisc/qxtcsvmodel.h"
|
||||
#include "ui_dialogmeasurementscsvcolumns.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
#include "../vmisc/backport/qoverload.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
#include "../vtools/dialogs/dialogtoolbox.h"
|
||||
#include "ui_dialogmeasurementscsvcolumns.h"
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
#include "../vmisc/vtextcodec.h"
|
||||
|
|
|
@ -33,9 +33,6 @@
|
|||
|
||||
#include "../vpatterndb/variables/vmeasurement.h"
|
||||
#include "../vwidgets/vdecorationaligningdelegate.h"
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
#include "../vmisc/backport/qoverload.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
|
||||
#include "../vmisc/compatibility.h"
|
||||
|
|
|
@ -31,11 +31,6 @@
|
|||
#include <QPushButton>
|
||||
#include <QShowEvent>
|
||||
|
||||
#include "../mapplication.h"
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
#include "../vmisc/backport/qoverload.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
|
||||
namespace
|
||||
{
|
||||
void InitDimensionTitle(QGroupBox *group, const MeasurementDimension_p &dimension)
|
||||
|
@ -43,11 +38,11 @@ void InitDimensionTitle(QGroupBox *group, const MeasurementDimension_p &dimensio
|
|||
SCASSERT(group != nullptr)
|
||||
group->setTitle(QStringLiteral("%1 (%2)").arg(dimension->Name(), dimension->Axis()));
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogSetupMultisize::DialogSetupMultisize(Unit unit, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
DialogSetupMultisize::DialogSetupMultisize(Unit unit, QWidget *parent)
|
||||
: QDialog(parent),
|
||||
ui(new Ui::DialogSetupMultisize),
|
||||
m_xDimension(QSharedPointer<VXMeasurementDimension>::create(unit)),
|
||||
m_yDimension(QSharedPointer<VYMeasurementDimension>::create(unit)),
|
||||
|
@ -64,150 +59,133 @@ DialogSetupMultisize::DialogSetupMultisize(Unit unit, QWidget *parent) :
|
|||
InitZDimension();
|
||||
|
||||
// height
|
||||
connect(ui->doubleSpinBoxXDimensionMinValue, QOverload<qreal>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, [this](qreal value)
|
||||
connect(ui->doubleSpinBoxXDimensionMinValue, QOverload<qreal>::of(&QDoubleSpinBox::valueChanged), this,
|
||||
[this](qreal value)
|
||||
{
|
||||
DimensionMinValueChanged(value, ui->doubleSpinBoxXDimensionMaxValue, ui->comboBoxXDimensionStep,
|
||||
ui->comboBoxXDimensionBase, m_xDimension);
|
||||
});
|
||||
connect(ui->doubleSpinBoxXDimensionMaxValue, QOverload<qreal>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, [this](qreal value)
|
||||
connect(ui->doubleSpinBoxXDimensionMaxValue, QOverload<qreal>::of(&QDoubleSpinBox::valueChanged), this,
|
||||
[this](qreal value)
|
||||
{
|
||||
DimensionMaxValueChanged(value, ui->doubleSpinBoxXDimensionMinValue, ui->comboBoxXDimensionStep,
|
||||
ui->comboBoxXDimensionBase, m_xDimension);
|
||||
});
|
||||
connect(ui->comboBoxXDimensionStep, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, [this](int index)
|
||||
{
|
||||
DimensionStepChanged(index, ui->comboBoxXDimensionStep, ui->comboBoxXDimensionBase, m_xDimension);
|
||||
});
|
||||
connect(ui->comboBoxXDimensionBase, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, [this](int index)
|
||||
{
|
||||
DimensionBaseChanged(index, ui->comboBoxXDimensionBase, m_xDimension);
|
||||
});
|
||||
connect(ui->comboBoxXDimensionStep, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
[this](int index)
|
||||
{ DimensionStepChanged(index, ui->comboBoxXDimensionStep, ui->comboBoxXDimensionBase, m_xDimension); });
|
||||
connect(ui->comboBoxXDimensionBase, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
[this](int index) { DimensionBaseChanged(index, ui->comboBoxXDimensionBase, m_xDimension); });
|
||||
|
||||
// size
|
||||
connect(ui->doubleSpinBoxYDimensionMinValue, QOverload<qreal>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, [this](qreal value)
|
||||
connect(ui->doubleSpinBoxYDimensionMinValue, QOverload<qreal>::of(&QDoubleSpinBox::valueChanged), this,
|
||||
[this](qreal value)
|
||||
{
|
||||
DimensionMinValueChanged(value, ui->doubleSpinBoxYDimensionMaxValue, ui->comboBoxYDimensionStep,
|
||||
ui->comboBoxYDimensionBase, m_yDimension);
|
||||
});
|
||||
connect(ui->doubleSpinBoxYDimensionMaxValue, QOverload<qreal>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, [this](qreal value)
|
||||
connect(ui->doubleSpinBoxYDimensionMaxValue, QOverload<qreal>::of(&QDoubleSpinBox::valueChanged), this,
|
||||
[this](qreal value)
|
||||
{
|
||||
DimensionMaxValueChanged(value, ui->doubleSpinBoxYDimensionMinValue, ui->comboBoxYDimensionStep,
|
||||
ui->comboBoxYDimensionBase, m_yDimension);
|
||||
});
|
||||
connect(ui->comboBoxYDimensionStep, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, [this](int index)
|
||||
{
|
||||
DimensionStepChanged(index, ui->comboBoxYDimensionStep, ui->comboBoxYDimensionBase, m_yDimension);
|
||||
});
|
||||
connect(ui->comboBoxYDimensionBase, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, [this](int index)
|
||||
{
|
||||
DimensionBaseChanged(index, ui->comboBoxYDimensionBase, m_yDimension);
|
||||
});
|
||||
connect(ui->comboBoxYDimensionStep, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
[this](int index)
|
||||
{ DimensionStepChanged(index, ui->comboBoxYDimensionStep, ui->comboBoxYDimensionBase, m_yDimension); });
|
||||
connect(ui->comboBoxYDimensionBase, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
[this](int index) { DimensionBaseChanged(index, ui->comboBoxYDimensionBase, m_yDimension); });
|
||||
|
||||
// hip
|
||||
connect(ui->doubleSpinBoxWDimensionMinValue, QOverload<qreal>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, [this](qreal value)
|
||||
connect(ui->doubleSpinBoxWDimensionMinValue, QOverload<qreal>::of(&QDoubleSpinBox::valueChanged), this,
|
||||
[this](qreal value)
|
||||
{
|
||||
DimensionMinValueChanged(value, ui->doubleSpinBoxWDimensionMaxValue, ui->comboBoxWDimensionStep,
|
||||
ui->comboBoxWDimensionBase, m_wDimension);
|
||||
});
|
||||
connect(ui->doubleSpinBoxWDimensionMaxValue, QOverload<qreal>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, [this](qreal value)
|
||||
connect(ui->doubleSpinBoxWDimensionMaxValue, QOverload<qreal>::of(&QDoubleSpinBox::valueChanged), this,
|
||||
[this](qreal value)
|
||||
{
|
||||
DimensionMaxValueChanged(value, ui->doubleSpinBoxWDimensionMinValue, ui->comboBoxWDimensionStep,
|
||||
ui->comboBoxWDimensionBase, m_wDimension);
|
||||
});
|
||||
connect(ui->comboBoxWDimensionStep, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, [this](int index)
|
||||
{
|
||||
DimensionStepChanged(index, ui->comboBoxWDimensionStep, ui->comboBoxWDimensionBase, m_wDimension);
|
||||
});
|
||||
connect(ui->comboBoxWDimensionBase, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, [this](int index)
|
||||
{
|
||||
DimensionBaseChanged(index, ui->comboBoxWDimensionBase, m_wDimension);
|
||||
});
|
||||
connect(ui->comboBoxWDimensionStep, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
[this](int index)
|
||||
{ DimensionStepChanged(index, ui->comboBoxWDimensionStep, ui->comboBoxWDimensionBase, m_wDimension); });
|
||||
connect(ui->comboBoxWDimensionBase, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
[this](int index) { DimensionBaseChanged(index, ui->comboBoxWDimensionBase, m_wDimension); });
|
||||
|
||||
// waist
|
||||
connect(ui->doubleSpinBoxZDimensionMinValue, QOverload<qreal>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, [this](qreal value)
|
||||
connect(ui->doubleSpinBoxZDimensionMinValue, QOverload<qreal>::of(&QDoubleSpinBox::valueChanged), this,
|
||||
[this](qreal value)
|
||||
{
|
||||
DimensionMinValueChanged(value, ui->doubleSpinBoxZDimensionMaxValue, ui->comboBoxZDimensionStep,
|
||||
ui->comboBoxZDimensionBase, m_zDimension);
|
||||
});
|
||||
connect(ui->doubleSpinBoxZDimensionMaxValue, QOverload<qreal>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, [this](qreal value)
|
||||
connect(ui->doubleSpinBoxZDimensionMaxValue, QOverload<qreal>::of(&QDoubleSpinBox::valueChanged), this,
|
||||
[this](qreal value)
|
||||
{
|
||||
DimensionMaxValueChanged(value, ui->doubleSpinBoxZDimensionMinValue, ui->comboBoxZDimensionStep,
|
||||
ui->comboBoxZDimensionBase, m_zDimension);
|
||||
});
|
||||
connect(ui->comboBoxZDimensionStep, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, [this](int index)
|
||||
connect(ui->comboBoxZDimensionStep, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
[this](int index)
|
||||
{ DimensionStepChanged(index, ui->comboBoxZDimensionStep, ui->comboBoxZDimensionBase, m_zDimension); });
|
||||
connect(ui->comboBoxZDimensionBase, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
[this](int index) { DimensionBaseChanged(index, ui->comboBoxZDimensionBase, m_zDimension); });
|
||||
|
||||
connect(ui->groupBoxXDimension, &QGroupBox::clicked, this, [this]() { CheckState(); });
|
||||
connect(ui->groupBoxYDimension, &QGroupBox::clicked, this, [this]() { CheckState(); });
|
||||
connect(ui->groupBoxWDimension, &QGroupBox::clicked, this, [this]() { CheckState(); });
|
||||
connect(ui->groupBoxZDimension, &QGroupBox::clicked, this, [this]() { CheckState(); });
|
||||
|
||||
connect(ui->checkBoxFullCircumference, &QCheckBox::stateChanged, this,
|
||||
&DialogSetupMultisize::ShowFullCircumference);
|
||||
|
||||
connect(ui->checkBoxXDimensionBodyMeasurement, &QCheckBox::stateChanged, this,
|
||||
&DialogSetupMultisize::XDimensionBodyMeasurementChanged);
|
||||
connect(ui->checkBoxYDimensionBodyMeasurement, &QCheckBox::stateChanged, this,
|
||||
&DialogSetupMultisize::YDimensionBodyMeasurementChanged);
|
||||
connect(ui->checkBoxWDimensionBodyMeasurement, &QCheckBox::stateChanged, this,
|
||||
&DialogSetupMultisize::WDimensionBodyMeasurementChanged);
|
||||
connect(ui->checkBoxZDimensionBodyMeasurement, &QCheckBox::stateChanged, this,
|
||||
&DialogSetupMultisize::ZDimensionBodyMeasurementChanged);
|
||||
|
||||
connect(ui->lineEditCustomXDimensionName, &QLineEdit::textChanged, this,
|
||||
[this](const QString &text)
|
||||
{
|
||||
DimensionStepChanged(index, ui->comboBoxZDimensionStep, ui->comboBoxZDimensionBase, m_zDimension);
|
||||
});
|
||||
connect(ui->comboBoxZDimensionBase, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, [this](int index)
|
||||
{
|
||||
DimensionBaseChanged(index, ui->comboBoxZDimensionBase, m_zDimension);
|
||||
m_xDimension->SetCustomName(text);
|
||||
InitDimensionTitle(ui->groupBoxXDimension, m_xDimension);
|
||||
|
||||
CheckState();
|
||||
});
|
||||
|
||||
connect(ui->lineEditCustomYDimensionName, &QLineEdit::textChanged, this,
|
||||
[this](const QString &text)
|
||||
{
|
||||
m_yDimension->SetCustomName(text);
|
||||
InitDimensionTitle(ui->groupBoxYDimension, m_yDimension);
|
||||
|
||||
connect(ui->groupBoxXDimension, &QGroupBox::clicked, this, [this](){CheckState();});
|
||||
connect(ui->groupBoxYDimension, &QGroupBox::clicked, this, [this](){CheckState();});
|
||||
connect(ui->groupBoxWDimension, &QGroupBox::clicked, this, [this](){CheckState();});
|
||||
connect(ui->groupBoxZDimension, &QGroupBox::clicked, this, [this](){CheckState();});
|
||||
CheckState();
|
||||
});
|
||||
|
||||
connect(ui->checkBoxFullCircumference, &QCheckBox::stateChanged,
|
||||
this, &DialogSetupMultisize::ShowFullCircumference);
|
||||
connect(ui->lineEditCustomWDimensionName, &QLineEdit::textChanged, this,
|
||||
[this](const QString &text)
|
||||
{
|
||||
m_wDimension->SetCustomName(text);
|
||||
InitDimensionTitle(ui->groupBoxWDimension, m_wDimension);
|
||||
|
||||
connect(ui->checkBoxXDimensionBodyMeasurement, &QCheckBox::stateChanged,
|
||||
this, &DialogSetupMultisize::XDimensionBodyMeasurementChanged);
|
||||
connect(ui->checkBoxYDimensionBodyMeasurement, &QCheckBox::stateChanged,
|
||||
this, &DialogSetupMultisize::YDimensionBodyMeasurementChanged);
|
||||
connect(ui->checkBoxWDimensionBodyMeasurement, &QCheckBox::stateChanged,
|
||||
this, &DialogSetupMultisize::WDimensionBodyMeasurementChanged);
|
||||
connect(ui->checkBoxZDimensionBodyMeasurement, &QCheckBox::stateChanged,
|
||||
this, &DialogSetupMultisize::ZDimensionBodyMeasurementChanged);
|
||||
CheckState();
|
||||
});
|
||||
|
||||
connect(ui->lineEditCustomXDimensionName, &QLineEdit::textChanged, this, [this](const QString &text)
|
||||
{
|
||||
m_xDimension->SetCustomName(text);
|
||||
InitDimensionTitle(ui->groupBoxXDimension, m_xDimension);
|
||||
connect(ui->lineEditCustomZDimensionName, &QLineEdit::textChanged, this,
|
||||
[this](const QString &text)
|
||||
{
|
||||
m_zDimension->SetCustomName(text);
|
||||
InitDimensionTitle(ui->groupBoxZDimension, m_zDimension);
|
||||
|
||||
CheckState();
|
||||
});
|
||||
|
||||
connect(ui->lineEditCustomYDimensionName, &QLineEdit::textChanged, this, [this](const QString &text)
|
||||
{
|
||||
m_yDimension->SetCustomName(text);
|
||||
InitDimensionTitle(ui->groupBoxYDimension, m_yDimension);
|
||||
|
||||
CheckState();
|
||||
});
|
||||
|
||||
connect(ui->lineEditCustomWDimensionName, &QLineEdit::textChanged, this, [this](const QString &text)
|
||||
{
|
||||
m_wDimension->SetCustomName(text);
|
||||
InitDimensionTitle(ui->groupBoxWDimension, m_wDimension);
|
||||
|
||||
CheckState();
|
||||
});
|
||||
|
||||
connect(ui->lineEditCustomZDimensionName, &QLineEdit::textChanged, this, [this](const QString &text)
|
||||
{
|
||||
m_zDimension->SetCustomName(text);
|
||||
InitDimensionTitle(ui->groupBoxZDimension, m_zDimension);
|
||||
|
||||
CheckState();
|
||||
});
|
||||
CheckState();
|
||||
});
|
||||
|
||||
CheckState();
|
||||
}
|
||||
|
@ -271,8 +249,8 @@ auto DialogSetupMultisize::FullCircumference() const -> bool
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::showEvent(QShowEvent *event)
|
||||
{
|
||||
QDialog::showEvent( event );
|
||||
if ( event->spontaneous() )
|
||||
QDialog::showEvent(event);
|
||||
if (event->spontaneous())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -286,15 +264,15 @@ void DialogSetupMultisize::showEvent(QShowEvent *event)
|
|||
setMaximumSize(size());
|
||||
setMinimumSize(size());
|
||||
|
||||
m_isInitialized = true;//first show windows are held
|
||||
m_isInitialized = true; // first show windows are held
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::ShowFullCircumference()
|
||||
{
|
||||
auto ShowDimensionFullCircumference = [this](QDoubleSpinBox *doubleSpinBoxMinValue,
|
||||
QDoubleSpinBox *doubleSpinBoxMaxValue, QComboBox *comboBoxStep, QComboBox *comboBoxBase,
|
||||
const MeasurementDimension_p &dimension)
|
||||
QDoubleSpinBox *doubleSpinBoxMaxValue, QComboBox *comboBoxStep,
|
||||
QComboBox *comboBoxBase, const MeasurementDimension_p &dimension)
|
||||
{
|
||||
SCASSERT(doubleSpinBoxMinValue != nullptr)
|
||||
SCASSERT(doubleSpinBoxMaxValue != nullptr)
|
||||
|
@ -498,24 +476,23 @@ void DialogSetupMultisize::InitDimensionMinMax(QDoubleSpinBox *doubleSpinBoxMinV
|
|||
doubleSpinBoxMinValue->blockSignals(true);
|
||||
doubleSpinBoxMinValue->setSuffix(unitStr);
|
||||
doubleSpinBoxMinValue->setDecimals(dimension->Units() == Unit::Mm ? 0 : 1);
|
||||
doubleSpinBoxMinValue->setMinimum(m && fc ? dimension->RangeMin()*2 : dimension->RangeMin());
|
||||
doubleSpinBoxMinValue->setMaximum(m && fc ? dimension->MaxValue()*2 : dimension->MaxValue());
|
||||
doubleSpinBoxMinValue->setValue(m && fc ? dimension->MinValue()*2 : dimension->MinValue());
|
||||
doubleSpinBoxMinValue->setMinimum(m && fc ? dimension->RangeMin() * 2 : dimension->RangeMin());
|
||||
doubleSpinBoxMinValue->setMaximum(m && fc ? dimension->MaxValue() * 2 : dimension->MaxValue());
|
||||
doubleSpinBoxMinValue->setValue(m && fc ? dimension->MinValue() * 2 : dimension->MinValue());
|
||||
doubleSpinBoxMinValue->blockSignals(false);
|
||||
|
||||
doubleSpinBoxMaxValue->blockSignals(true);
|
||||
doubleSpinBoxMaxValue->setSuffix(unitStr);
|
||||
doubleSpinBoxMaxValue->setDecimals(dimension->Units() == Unit::Mm ? 0 : 1);
|
||||
doubleSpinBoxMaxValue->setMinimum(m && fc ? dimension->MinValue()*2 : dimension->MinValue());
|
||||
doubleSpinBoxMaxValue->setMaximum(m && fc ? dimension->RangeMax()*2 : dimension->RangeMax());
|
||||
doubleSpinBoxMaxValue->setValue(m && fc ? dimension->RangeMax()*2 : dimension->RangeMax());
|
||||
doubleSpinBoxMaxValue->setValue(m && fc ? dimension->MaxValue()*2 : dimension->MaxValue());
|
||||
doubleSpinBoxMaxValue->setMinimum(m && fc ? dimension->MinValue() * 2 : dimension->MinValue());
|
||||
doubleSpinBoxMaxValue->setMaximum(m && fc ? dimension->RangeMax() * 2 : dimension->RangeMax());
|
||||
doubleSpinBoxMaxValue->setValue(m && fc ? dimension->RangeMax() * 2 : dimension->RangeMax());
|
||||
doubleSpinBoxMaxValue->setValue(m && fc ? dimension->MaxValue() * 2 : dimension->MaxValue());
|
||||
doubleSpinBoxMaxValue->blockSignals(false);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::InitDimensionStep(QComboBox *comboBoxStep,
|
||||
const MeasurementDimension_p &dimension)
|
||||
void DialogSetupMultisize::InitDimensionStep(QComboBox *comboBoxStep, const MeasurementDimension_p &dimension)
|
||||
{
|
||||
SCASSERT(comboBoxStep != nullptr)
|
||||
|
||||
|
@ -528,9 +505,9 @@ void DialogSetupMultisize::InitDimensionStep(QComboBox *comboBoxStep,
|
|||
comboBoxStep->blockSignals(true);
|
||||
const QVector<qreal> steps = dimension->ValidSteps();
|
||||
comboBoxStep->clear();
|
||||
for(auto step : steps)
|
||||
for (auto step : steps)
|
||||
{
|
||||
comboBoxStep->addItem(QStringLiteral("%1%2").arg(m && fc ? step*2 : step).arg(unitStr), step);
|
||||
comboBoxStep->addItem(QStringLiteral("%1%2").arg(m && fc ? step * 2 : step).arg(unitStr), step);
|
||||
}
|
||||
|
||||
comboBoxStep->setCurrentIndex(-1); // force a user to select
|
||||
|
@ -560,7 +537,7 @@ void DialogSetupMultisize::InitXDimension()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::InitYDimension()
|
||||
{
|
||||
InitDimensionTitle(ui->groupBoxYDimension, m_yDimension);
|
||||
InitDimensionTitle(ui->groupBoxYDimension, m_yDimension);
|
||||
InitDimension(ui->doubleSpinBoxYDimensionMinValue, ui->doubleSpinBoxYDimensionMaxValue, ui->comboBoxYDimensionStep,
|
||||
m_yDimension);
|
||||
}
|
||||
|
@ -663,8 +640,7 @@ void DialogSetupMultisize::DimensionBaseChanged(int index, QComboBox *comboBoxBa
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::UpdateSteps(QComboBox *comboBoxStep,
|
||||
const MeasurementDimension_p &dimension)
|
||||
void DialogSetupMultisize::UpdateSteps(QComboBox *comboBoxStep, const MeasurementDimension_p &dimension)
|
||||
{
|
||||
SCASSERT(comboBoxStep != nullptr)
|
||||
|
||||
|
@ -683,7 +659,7 @@ void DialogSetupMultisize::UpdateSteps(QComboBox *comboBoxStep,
|
|||
const bool m = dimension->IsBodyMeasurement();
|
||||
const QString unitStr = m ? " " + UnitsToStr(dimension->Units()) : QString();
|
||||
|
||||
for(auto step : steps)
|
||||
for (auto step : steps)
|
||||
{
|
||||
comboBoxStep->addItem(QStringLiteral("%1%2").arg(m && fc ? step * 2 : step).arg(unitStr), step);
|
||||
}
|
||||
|
@ -697,8 +673,7 @@ void DialogSetupMultisize::UpdateSteps(QComboBox *comboBoxStep,
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::UpdateBase(QComboBox *comboBoxBase,
|
||||
const MeasurementDimension_p &dimension)
|
||||
void DialogSetupMultisize::UpdateBase(QComboBox *comboBoxBase, const MeasurementDimension_p &dimension)
|
||||
{
|
||||
SCASSERT(comboBoxBase != nullptr)
|
||||
|
||||
|
@ -716,7 +691,7 @@ void DialogSetupMultisize::UpdateBase(QComboBox *comboBoxBase,
|
|||
const bool m = dimension->IsBodyMeasurement();
|
||||
const QString unitStr = m ? " " + UnitsToStr(dimension->Units()) : QString();
|
||||
|
||||
for(auto base : bases)
|
||||
for (auto base : bases)
|
||||
{
|
||||
comboBoxBase->addItem(QStringLiteral("%1%2").arg(m && fc ? base * 2 : base).arg(unitStr), base);
|
||||
}
|
||||
|
@ -728,4 +703,3 @@ void DialogSetupMultisize::UpdateBase(QComboBox *comboBoxBase,
|
|||
const qreal base = comboBoxBase->currentData().toDouble(&ok);
|
||||
dimension->SetBaseValue(ok ? base : -1);
|
||||
}
|
||||
|
||||
|
|
|
@ -33,10 +33,6 @@
|
|||
#include "../vformat/vdimensions.h"
|
||||
#include "../vmisc/def.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
|
||||
class QDoubleSpinBox;
|
||||
class QGroupBox;
|
||||
class QLineEdit;
|
||||
|
@ -101,8 +97,7 @@ private:
|
|||
|
||||
void DimensionStepChanged(int index, QComboBox *comboBoxStep, QComboBox *comboBoxBase,
|
||||
const MeasurementDimension_p &dimension);
|
||||
void DimensionBaseChanged(int index, QComboBox *comboBoxBase,
|
||||
const MeasurementDimension_p &dimension);
|
||||
void DimensionBaseChanged(int index, QComboBox *comboBoxBase, const MeasurementDimension_p &dimension);
|
||||
|
||||
void UpdateSteps(QComboBox *comboBoxStep, const MeasurementDimension_p &dimension);
|
||||
void UpdateBase(QComboBox *comboBoxBase, const MeasurementDimension_p &dimension);
|
||||
|
|
|
@ -31,10 +31,6 @@
|
|||
|
||||
#include <QDialog>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class DialogTapePreferences;
|
||||
|
|
|
@ -32,12 +32,8 @@
|
|||
#include <QTimer>
|
||||
|
||||
#if defined(APPIMAGE) && defined(Q_OS_LINUX)
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
|
||||
#include "../vmisc/backport/qscopeguard.h"
|
||||
#else
|
||||
#include <QScopeGuard>
|
||||
#endif
|
||||
#include "../vmisc/appimage.h"
|
||||
#include <QScopeGuard>
|
||||
#endif // defined(APPIMAGE) && defined(Q_OS_LINUX)
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
|
@ -119,11 +115,9 @@ auto main(int argc, char *argv[]) -> int
|
|||
MApplication app(argc, argv);
|
||||
app.InitOptions();
|
||||
|
||||
QT_REQUIRE_VERSION(argc, argv, "5.6.0"); // clazy:exclude=qstring-arg,qstring-allocations NOLINT
|
||||
QT_REQUIRE_VERSION(argc, argv, "5.15.0"); // clazy:exclude=qstring-arg,qstring-allocations NOLINT
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
||||
MApplication::setDesktopFileName(QStringLiteral("ua.com.smart-pattern.tape.desktop"));
|
||||
#endif
|
||||
|
||||
QTimer::singleShot(0, &app, &MApplication::ProcessCMD);
|
||||
|
||||
|
|
|
@ -155,26 +155,6 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
|||
#endif // defined(V_NO_ASSERT)
|
||||
|
||||
#if defined(Q_OS_MAC)
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
// Try hide very annoying, Qt related, warnings in Mac OS X
|
||||
// QNSView mouseDragged: Internal mouse button tracking invalid (missing Qt::LeftButton)
|
||||
// https://bugreports.qt.io/browse/QTBUG-42846
|
||||
if ((type == QtWarningMsg) && msg.contains(QStringLiteral("QNSView")))
|
||||
{
|
||||
type = QtDebugMsg;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 9, 0)
|
||||
// Hide Qt bug 'Assertion when reading an icns file'
|
||||
// https://bugreports.qt.io/browse/QTBUG-45537
|
||||
// Remove after Qt fix will be released
|
||||
if ((type == QtWarningMsg) && msg.contains(QStringLiteral("QICNSHandler::read()")))
|
||||
{
|
||||
type = QtDebugMsg;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Hide anything that starts with QMacCGContext
|
||||
if ((type == QtWarningMsg) && msg.contains(QStringLiteral("QMacCGContext::")))
|
||||
{
|
||||
|
|
|
@ -69,20 +69,7 @@
|
|||
#include <QTextCodec>
|
||||
#endif
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
#include "../vmisc/backport/qoverload.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
|
||||
#if (defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
|
||||
// DO NOT WORK WITH GCC 4.8
|
||||
#else
|
||||
#if __cplusplus >= 201402L
|
||||
using namespace std::chrono_literals;
|
||||
#else
|
||||
#include "../vmisc/bpstd/chrono.hpp"
|
||||
using namespace bpstd::literals::chrono_literals;
|
||||
#endif // __cplusplus >= 201402L
|
||||
#endif //(defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
|
||||
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_CLANG("-Wmissing-prototypes")
|
||||
|
@ -145,7 +132,7 @@ TKMMainWindow::TKMMainWindow(QWidget *parent)
|
|||
|
||||
if (MApplication::VApp()->IsAppInGUIMode())
|
||||
{
|
||||
QTimer::singleShot(V_SECONDS(1), this, &TKMMainWindow::AskDefaultSettings);
|
||||
QTimer::singleShot(1s, this, &TKMMainWindow::AskDefaultSettings);
|
||||
}
|
||||
|
||||
m_buttonShortcuts.insert(VShortcutAction::CaseSensitiveMatch, ui->toolButtonCaseSensitive);
|
||||
|
@ -358,15 +345,6 @@ void TKMMainWindow::UpdateWindowTitle()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void TKMMainWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
#if defined(Q_OS_MAC) && QT_VERSION < QT_VERSION_CHECK(5, 11, 1)
|
||||
// Workaround for Qt bug https://bugreports.qt.io/browse/QTBUG-43344
|
||||
static int numCalled = 0;
|
||||
if (numCalled++ >= 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (MaybeSave())
|
||||
{
|
||||
WriteSettings();
|
||||
|
|
|
@ -66,22 +66,12 @@
|
|||
#include "vlitepattern.h"
|
||||
#include "vtapesettings.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
#include "../vmisc/backport/qoverload.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
#include "../vmisc/vtextcodec.h"
|
||||
#else
|
||||
#include <QTextCodec>
|
||||
#endif
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
|
||||
#include "../vmisc/backport/qscopeguard.h"
|
||||
#else
|
||||
#include <QScopeGuard>
|
||||
#endif
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QCursor>
|
||||
#include <QDesktopServices>
|
||||
|
@ -91,21 +81,13 @@
|
|||
#include <QMimeType>
|
||||
#include <QPixmap>
|
||||
#include <QProcess>
|
||||
#include <QScopeGuard>
|
||||
#include <QTimer>
|
||||
#include <QUuid>
|
||||
#include <QtNumeric>
|
||||
#include <chrono>
|
||||
|
||||
#if (defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
|
||||
// DO NOT WORK WITH GCC 4.8
|
||||
#else
|
||||
#if __cplusplus >= 201402L
|
||||
using namespace std::chrono_literals;
|
||||
#else
|
||||
#include "../vmisc/bpstd/chrono.hpp"
|
||||
using namespace bpstd::literals::chrono_literals;
|
||||
#endif // __cplusplus >= 201402L
|
||||
#endif //(defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
|
||||
|
||||
#if defined(Q_OS_MAC)
|
||||
#include <QDrag>
|
||||
|
@ -313,7 +295,7 @@ TMainWindow::TMainWindow(QWidget *parent)
|
|||
|
||||
if (MApplication::VApp()->IsAppInGUIMode())
|
||||
{
|
||||
QTimer::singleShot(V_SECONDS(1), this, &TMainWindow::AskDefaultSettings);
|
||||
QTimer::singleShot(1s, this, &TMainWindow::AskDefaultSettings);
|
||||
}
|
||||
|
||||
m_buttonShortcuts.insert(VShortcutAction::CaseSensitiveMatch, ui->toolButtonCaseSensitive);
|
||||
|
@ -732,15 +714,6 @@ void TMainWindow::ToolBarStyles()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void TMainWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
#if defined(Q_OS_MAC) && QT_VERSION < QT_VERSION_CHECK(5, 11, 1)
|
||||
// Workaround for Qt bug https://bugreports.qt.io/browse/QTBUG-43344
|
||||
static int numCalled = 0;
|
||||
if (numCalled++ >= 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (MaybeSave())
|
||||
{
|
||||
WriteSettings();
|
||||
|
@ -3278,7 +3251,7 @@ void TMainWindow::InitDimensionGradation(int index, const MeasurementDimension_p
|
|||
int maxWidth = 0;
|
||||
for (int i = 0; i < control->count(); ++i)
|
||||
{
|
||||
int itemWidth = TextWidth(fontMetrics, control->itemText(i));
|
||||
int itemWidth = fontMetrics.horizontalAdvance(control->itemText(i));
|
||||
if (itemWidth > maxWidth)
|
||||
{
|
||||
maxWidth = itemWidth;
|
||||
|
|
|
@ -30,10 +30,6 @@
|
|||
|
||||
#include "../vmisc/vabstractshortcutmanager.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif
|
||||
|
||||
class VTapeShortcutManager : public VAbstractShortcutManager
|
||||
{
|
||||
Q_OBJECT // NOLINT
|
||||
|
|
|
@ -45,13 +45,10 @@
|
|||
#include "../vmisc/vvalentinasettings.h"
|
||||
#include "vvalentinashortcutmanager.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
||||
#include "../vmisc/backport/text.h"
|
||||
#endif
|
||||
|
||||
#include "QtConcurrent/qtconcurrentrun.h"
|
||||
#include <QDateTime>
|
||||
#include <QDir>
|
||||
#include <QEvent>
|
||||
#include <QFile>
|
||||
#include <QFileSystemWatcher>
|
||||
#include <QFuture>
|
||||
|
@ -60,6 +57,7 @@
|
|||
#include <QMessageBox>
|
||||
#include <QObject>
|
||||
#include <QProcess>
|
||||
#include <QScopeGuard>
|
||||
#include <QStandardPaths>
|
||||
#include <QStyleFactory>
|
||||
#include <QTemporaryFile>
|
||||
|
@ -77,13 +75,6 @@
|
|||
#define BUILD_REVISION VCS_REPO_STATE_REVISION
|
||||
#endif
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
|
||||
#include "../vmisc/backport/qscopeguard.h"
|
||||
#else
|
||||
#include <QEvent>
|
||||
#include <QScopeGuard>
|
||||
#endif
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
|
||||
#include "../vmisc/compatibility.h"
|
||||
#endif
|
||||
|
@ -181,26 +172,6 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
|||
#endif // defined(V_NO_ASSERT)
|
||||
|
||||
#if defined(Q_OS_MAC)
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
// Try hide very annoying, Qt related, warnings in Mac OS X
|
||||
// QNSView mouseDragged: Internal mouse button tracking invalid (missing Qt::LeftButton)
|
||||
// https://bugreports.qt.io/browse/QTBUG-42846
|
||||
if ((type == QtWarningMsg) && msg.contains(QStringLiteral("QNSView")))
|
||||
{
|
||||
type = QtDebugMsg;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 9, 0)
|
||||
// Hide Qt bug 'Assertion when reading an icns file'
|
||||
// https://bugreports.qt.io/browse/QTBUG-45537
|
||||
// Remove after Qt fix will be released
|
||||
if ((type == QtWarningMsg) && msg.contains(QStringLiteral("QICNSHandler::read()")))
|
||||
{
|
||||
type = QtDebugMsg;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Hide anything that starts with QMacCGContext
|
||||
if ((type == QtWarningMsg) && msg.contains(QStringLiteral("QMacCGContext::")))
|
||||
{
|
||||
|
@ -645,11 +616,7 @@ void VApplication::ClearOldLogs()
|
|||
for (const auto &fn : allFiles)
|
||||
{
|
||||
QFileInfo info(fn);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
const QDateTime created = info.birthTime();
|
||||
#else
|
||||
const QDateTime created = info.created();
|
||||
#endif
|
||||
if (created.daysTo(QDateTime::currentDateTime()) >= DAYS_TO_KEEP_LOGS)
|
||||
{
|
||||
VLockGuard<QFile> tmp(info.absoluteFilePath(), [&fn]() { return new QFile(fn); });
|
||||
|
|
|
@ -35,9 +35,6 @@
|
|||
#include <QWidget>
|
||||
|
||||
#include "../vpatterndb/vformula.h"
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif
|
||||
|
||||
class VFormulaPropertyEditor : public QWidget
|
||||
{
|
||||
|
|
|
@ -30,10 +30,6 @@
|
|||
|
||||
#include "../vmisc/vabstractshortcutmanager.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif
|
||||
|
||||
class VValentinaShortcutManager : public VAbstractShortcutManager
|
||||
{
|
||||
Q_OBJECT // NOLINT
|
||||
|
|
|
@ -35,16 +35,12 @@
|
|||
#include "../vmisc/theme/vtheme.h"
|
||||
#include "../vmisc/vabstractshortcutmanager.h"
|
||||
#include "../vmisc/vvalentinasettings.h"
|
||||
#include "qpushbutton.h"
|
||||
#include "ui_preferencesconfigurationpage.h"
|
||||
#include "vcommonsettings.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
#include "../vmisc/backport/qoverload.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
|
||||
#include <QDir>
|
||||
#include <QDirIterator>
|
||||
#include <QPushButton>
|
||||
#include <QStyleHints>
|
||||
#include <QTimer>
|
||||
|
||||
|
|
|
@ -31,10 +31,6 @@
|
|||
|
||||
#include <QWidget>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class PreferencesConfigurationPage;
|
||||
|
|
|
@ -31,10 +31,6 @@
|
|||
|
||||
#include <QWidget>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class PreferencesPathPage;
|
||||
|
|
|
@ -29,24 +29,21 @@
|
|||
#include "preferencespatternpage.h"
|
||||
#include "../dialogdatetimeformats.h"
|
||||
#include "../dialogknownmaterials.h"
|
||||
#include "../ifc/xml/vabstractpattern.h"
|
||||
#include "../vformat/vsinglelineoutlinechar.h"
|
||||
#include "../vmisc/svgfont/vsvgfontdatabase.h"
|
||||
#include "../vmisc/vabstractvalapplication.h"
|
||||
#include "../vmisc/vvalentinasettings.h"
|
||||
#include "../vwidgets/vmaingraphicsview.h"
|
||||
#include "svgfont/svgdef.h"
|
||||
#include "svgfont/vsvgfont.h"
|
||||
#include "svgfont/vsvgfontengine.h"
|
||||
#include "ui_preferencespatternpage.h"
|
||||
#include "vabstractapplication.h"
|
||||
#include <QFontMetrics>
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
#include "../vmisc/backport/qoverload.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
#include "../ifc/xml/vabstractpattern.h"
|
||||
#include "../vformat/vsinglelineoutlinechar.h"
|
||||
#include "../vwidgets/vmaingraphicsview.h"
|
||||
|
||||
#include <QCompleter>
|
||||
#include <QDate>
|
||||
#include <QFontMetrics>
|
||||
#include <QMessageBox>
|
||||
#include <QScreen>
|
||||
#include <QStyledItemDelegate>
|
||||
|
|
|
@ -31,10 +31,6 @@
|
|||
|
||||
#include <QDialog>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class DialogAboutApp;
|
||||
|
|
|
@ -30,13 +30,9 @@
|
|||
|
||||
#include <QDialog>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class DialogAddBackgroundImage;
|
||||
class DialogAddBackgroundImage;
|
||||
}
|
||||
|
||||
class DialogAddBackgroundImage : public QDialog
|
||||
|
|
|
@ -33,10 +33,6 @@
|
|||
#include <QDialog>
|
||||
#include <QTime>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class DialogDateTimeFormats;
|
||||
|
|
|
@ -27,14 +27,10 @@
|
|||
*************************************************************************/
|
||||
|
||||
#include "dialogincrements.h"
|
||||
#include "../vmisc/vvalentinasettings.h"
|
||||
#include "ui_dialogincrements.h"
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
#include "../vmisc/backport/qoverload.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
#include "../qmuparser/qmudef.h"
|
||||
#include "../qmuparser/qmutokenparser.h"
|
||||
#include "../vmisc/theme/vtheme.h"
|
||||
#include "../vmisc/vvalentinasettings.h"
|
||||
#include "../vpatterndb/calculator.h"
|
||||
#include "../vpatterndb/variables/varcradius.h"
|
||||
#include "../vpatterndb/variables/vcurveangle.h"
|
||||
|
@ -45,6 +41,7 @@
|
|||
#include "../vpatterndb/variables/vlinelength.h"
|
||||
#include "../vpatterndb/vtranslatevars.h"
|
||||
#include "../vtools/dialogs/support/dialogeditwrongformula.h"
|
||||
#include "ui_dialogincrements.h"
|
||||
|
||||
#include <QCloseEvent>
|
||||
#include <QDir>
|
||||
|
@ -2106,9 +2103,6 @@ DialogIncrements::~DialogIncrements()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogIncrements::RestoreAfterClose()
|
||||
{
|
||||
// Because of bug on Mac OS with Qt 5.11 closing this dialog causes a crash. Instead of closing we will keep
|
||||
// dialog in memory and reuse it again. This function redo some moves made after close.
|
||||
|
||||
connect(this->m_doc, &VPattern::FullUpdateFromFile, this, &DialogIncrements::FullUpdateFromFile);
|
||||
|
||||
ui->tabWidget->setCurrentIndex(0);
|
||||
|
|
|
@ -31,10 +31,6 @@
|
|||
|
||||
#include <QDialog>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class DialogKnownMaterials;
|
||||
|
|
|
@ -40,16 +40,7 @@
|
|||
#include <QtDebug>
|
||||
#include <chrono>
|
||||
|
||||
#if (defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
|
||||
// DO NOT WORK WITH GCC 4.8
|
||||
#else
|
||||
#if __cplusplus >= 201402L
|
||||
using namespace std::chrono_literals;
|
||||
#else
|
||||
#include "../vmisc/bpstd/chrono.hpp"
|
||||
using namespace bpstd::literals::chrono_literals;
|
||||
#endif // __cplusplus >= 201402L
|
||||
#endif //(defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogLayoutProgress::DialogLayoutProgress(QElapsedTimer timer, qint64 timeout, QWidget *parent)
|
||||
|
@ -96,7 +87,7 @@ DialogLayoutProgress::DialogLayoutProgress(QElapsedTimer timer, qint64 timeout,
|
|||
m_progressTimer->stop();
|
||||
}
|
||||
});
|
||||
m_progressTimer->start(V_SECONDS(1));
|
||||
m_progressTimer->start(1s);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -33,10 +33,6 @@
|
|||
#include <QElapsedTimer>
|
||||
#include <QTimer>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class DialogLayoutProgress;
|
||||
|
|
|
@ -27,13 +27,10 @@
|
|||
*************************************************************************/
|
||||
|
||||
#include "dialoglayoutsettings.h"
|
||||
#include "../vlayout/vlayoutgenerator.h"
|
||||
#include "../vmisc/vabstractvalapplication.h"
|
||||
#include "../vmisc/vvalentinasettings.h"
|
||||
#include "ui_dialoglayoutsettings.h"
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
#include "../vmisc/backport/qoverload.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
#include "../vlayout/vlayoutgenerator.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QPrinterInfo>
|
||||
|
|
|
@ -43,16 +43,13 @@
|
|||
#include <QUrl>
|
||||
|
||||
#include "../core/vapplication.h"
|
||||
#include "../ifc/xml/utils.h"
|
||||
#include "../ifc/xml/vpatternimage.h"
|
||||
#include "../qmuparser/qmudef.h"
|
||||
#include "../vmisc/vabstractvalapplication.h"
|
||||
#include "../vmisc/vvalentinasettings.h"
|
||||
#include "../vpatterndb/vcontainer.h"
|
||||
#include "../xml/vpattern.h"
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
#include "../vmisc/backport/qoverload.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
#include "../ifc/xml/utils.h"
|
||||
#include "../ifc/xml/vpatternimage.h"
|
||||
#include "../qmuparser/qmudef.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
|
||||
#include "../vmisc/compatibility.h"
|
||||
|
|
|
@ -33,10 +33,6 @@
|
|||
#include <QMap>
|
||||
#include <QPointer>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif
|
||||
|
||||
class VPattern;
|
||||
class VContainer;
|
||||
class QCheckBox;
|
||||
|
|
|
@ -31,10 +31,6 @@
|
|||
|
||||
#include <QDialog>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class DialogPreferences;
|
||||
|
|
|
@ -33,10 +33,6 @@
|
|||
#include "../vmisc/vvalentinasettings.h"
|
||||
#include "ui_dialogsavelayout.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
#include "../vmisc/backport/qoverload.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileDialog>
|
||||
#include <QGlobalStatic>
|
||||
|
|
|
@ -44,10 +44,6 @@
|
|||
#include "../vtools/undocommands/image/zvaluemovebackgroundimage.h"
|
||||
#include "ui_vwidgetbackgroundimages.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
#include "../vmisc/backport/qoverload.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
|
||||
#include <QMenu>
|
||||
#include <QPushButton>
|
||||
|
||||
|
|
|
@ -30,10 +30,6 @@
|
|||
|
||||
#include <QWidget>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
|
||||
#include "../vmisc/def.h"
|
||||
|
||||
class VAbstractPattern;
|
||||
|
@ -41,10 +37,17 @@ class VBackgroundPatternImage;
|
|||
|
||||
namespace Ui
|
||||
{
|
||||
class VWidgetBackgroundImages;
|
||||
class VWidgetBackgroundImages;
|
||||
}
|
||||
|
||||
enum class ScaleUnit {Percent, Mm, Cm, Inch, Px};
|
||||
enum class ScaleUnit
|
||||
{
|
||||
Percent,
|
||||
Mm,
|
||||
Cm,
|
||||
Inch,
|
||||
Px
|
||||
};
|
||||
|
||||
class VWidgetBackgroundImages : public QWidget
|
||||
{
|
||||
|
|
|
@ -40,16 +40,7 @@
|
|||
#include <QUndoStack>
|
||||
#include <chrono>
|
||||
|
||||
#if (defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
|
||||
// DO NOT WORK WITH GCC 4.8
|
||||
#else
|
||||
#if __cplusplus >= 201402L
|
||||
using namespace std::chrono_literals;
|
||||
#else
|
||||
#include "../vmisc/bpstd/chrono.hpp"
|
||||
using namespace bpstd::literals::chrono_literals;
|
||||
#endif // __cplusplus >= 201402L
|
||||
#endif //(defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -95,7 +86,7 @@ void VWidgetDetails::UpdateList()
|
|||
// The filling table is a very expensive operation. This optimization will postpone it.
|
||||
// Each time a new request happen we will wait 800 ms before calling it. If at this time a new request will arrive
|
||||
// we will wait 800 ms more. And so on, until nothing happens within 800ms.
|
||||
m_updateListTimer->start(V_MSECONDS(800));
|
||||
m_updateListTimer->start(800ms);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -31,10 +31,6 @@
|
|||
|
||||
#include <QWidget>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif
|
||||
|
||||
class VAbstractPattern;
|
||||
class VContainer;
|
||||
class VPiece;
|
||||
|
|
|
@ -30,10 +30,8 @@
|
|||
#define VWIDGETGROUPS_H
|
||||
|
||||
#include "../vmisc/typedef.h"
|
||||
|
||||
#include <QWidget>
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif
|
||||
|
||||
class QTableWidgetItem;
|
||||
class VAbstractPattern;
|
||||
|
|
|
@ -36,12 +36,8 @@
|
|||
#include <QTimer>
|
||||
|
||||
#if defined(APPIMAGE) && defined(Q_OS_LINUX)
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
|
||||
#include "../vmisc/backport/qscopeguard.h"
|
||||
#else
|
||||
#include <QScopeGuard>
|
||||
#endif
|
||||
#include "../vmisc/appimage.h"
|
||||
#include <QScopeGuard>
|
||||
#endif // defined(APPIMAGE) && defined(Q_OS_LINUX)
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
|
@ -133,11 +129,9 @@ auto main(int argc, char *argv[]) -> int
|
|||
VApplication app(argc, argv);
|
||||
app.InitOptions();
|
||||
|
||||
QT_REQUIRE_VERSION(argc, argv, "5.6.0") // clazy:exclude=qstring-arg,qstring-allocations NOLINT
|
||||
QT_REQUIRE_VERSION(argc, argv, "5.15.0") // clazy:exclude=qstring-arg,qstring-allocations NOLINT
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
||||
VApplication::setDesktopFileName(QStringLiteral("ua.com.smart-pattern.valentina.desktop"));
|
||||
#endif
|
||||
|
||||
if (VApplication::IsGUIMode() && VAbstractApplication::VApp()->Settings()->IsAutomaticallyCheckUpdates())
|
||||
{
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include <QMessageBox>
|
||||
#include <QProcess>
|
||||
#include <QProgressBar>
|
||||
#include <QScopeGuard>
|
||||
#include <QScrollBar>
|
||||
#include <QSettings>
|
||||
#include <QShowEvent>
|
||||
|
@ -202,21 +203,11 @@
|
|||
#include <QTextCodec>
|
||||
#endif
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
#include "../vmisc/backport/qoverload.h"
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
|
||||
#include "../vmisc/backport/qscopeguard.h"
|
||||
#else
|
||||
#include <QScopeGuard>
|
||||
#endif
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
#include <QSourceLocation>
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
||||
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
#include <QWinTaskbarButton>
|
||||
#include <QWinTaskbarProgress>
|
||||
#endif
|
||||
|
@ -226,16 +217,7 @@
|
|||
#include <QMimeData>
|
||||
#endif // defined(Q_OS_MAC)
|
||||
|
||||
#if (defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
|
||||
// DO NOT WORK WITH GCC 4.8
|
||||
#else
|
||||
#if __cplusplus >= 201402L
|
||||
using namespace std::chrono_literals;
|
||||
#else
|
||||
#include "../vmisc/bpstd/chrono.hpp"
|
||||
using namespace bpstd::literals::chrono_literals;
|
||||
#endif // __cplusplus >= 201402L
|
||||
#endif //(defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
|
||||
#include "../vmisc/compatibility.h"
|
||||
|
@ -403,7 +385,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
connect(ui->actionExportFontCorrections, &QAction::triggered, this, &MainWindow::ActionExportFontCorrections);
|
||||
|
||||
m_progressBar->setVisible(false);
|
||||
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
||||
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
m_taskbarProgress->setVisible(false);
|
||||
#endif
|
||||
m_statusLabel->setText(tr("Create new pattern piece to start working."));
|
||||
|
@ -531,7 +513,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
|
||||
if (VApplication::IsGUIMode())
|
||||
{
|
||||
QTimer::singleShot(V_SECONDS(1), this, &MainWindow::AskDefaultSettings);
|
||||
QTimer::singleShot(1s, this, &MainWindow::AskDefaultSettings);
|
||||
}
|
||||
|
||||
ui->actionExportFontCorrections->setEnabled(settings->GetSingleStrokeOutlineFont());
|
||||
|
@ -1829,7 +1811,7 @@ void MainWindow::showEvent(QShowEvent *event)
|
|||
return;
|
||||
}
|
||||
|
||||
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
||||
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
m_taskbarButton->setWindow(windowHandle());
|
||||
#endif
|
||||
|
||||
|
@ -1894,15 +1876,6 @@ void MainWindow::changeEvent(QEvent *event)
|
|||
*/
|
||||
void MainWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
#if defined(Q_OS_MAC) && QT_VERSION < QT_VERSION_CHECK(5, 11, 1)
|
||||
// Workaround for Qt bug https://bugreports.qt.io/browse/QTBUG-43344
|
||||
static int numCalled = 0;
|
||||
if (numCalled++ >= 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
qCDebug(vMainWindow, "Closing main window");
|
||||
if (MaybeSave())
|
||||
{
|
||||
|
@ -2235,7 +2208,7 @@ void MainWindow::MeasurementsChanged(const QString &path)
|
|||
{
|
||||
m_mChanges = true;
|
||||
m_mChangesAsked = false;
|
||||
m_measurementsSyncTimer->start(V_MSECONDS(1500));
|
||||
m_measurementsSyncTimer->start(1500ms);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2245,7 +2218,7 @@ void MainWindow::MeasurementsChanged(const QString &path)
|
|||
{
|
||||
m_mChanges = true;
|
||||
m_mChangesAsked = false;
|
||||
m_measurementsSyncTimer->start(V_MSECONDS(1500));
|
||||
m_measurementsSyncTimer->start(1500ms);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -4498,7 +4471,7 @@ void MainWindow::Clear()
|
|||
m_toolOptions->ClearPropertyBrowser();
|
||||
m_toolOptions->itemClicked(nullptr);
|
||||
m_progressBar->setVisible(false);
|
||||
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
||||
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
m_taskbarProgress->setVisible(false);
|
||||
#endif
|
||||
m_statusLabel->setVisible(true);
|
||||
|
@ -4914,7 +4887,7 @@ void MainWindow::ShowProgress()
|
|||
{
|
||||
const int newValue = m_progressBar->value() + 1;
|
||||
m_progressBar->setValue(newValue);
|
||||
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
||||
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
m_taskbarProgress->setValue(newValue);
|
||||
#endif
|
||||
QCoreApplication::processEvents();
|
||||
|
@ -5393,7 +5366,7 @@ void MainWindow::InitDimensionGradation(int index, const MeasurementDimension_p
|
|||
int maxWidth = 0;
|
||||
for (int i = 0; i < control->count(); ++i)
|
||||
{
|
||||
int itemWidth = TextWidth(fontMetrics, control->itemText(i));
|
||||
int itemWidth = fontMetrics.horizontalAdvance(control->itemText(i));
|
||||
if (itemWidth > maxWidth)
|
||||
{
|
||||
maxWidth = itemWidth;
|
||||
|
@ -6600,7 +6573,7 @@ auto MainWindow::LoadPattern(QString fileName, const QString &customMeasureFile)
|
|||
m_progressBar->setValue(0);
|
||||
const int elements = doc->ElementsToParse();
|
||||
m_progressBar->setMaximum(elements);
|
||||
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
||||
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
m_taskbarProgress->setVisible(true);
|
||||
m_taskbarProgress->setMaximum(elements);
|
||||
#endif
|
||||
|
@ -6608,7 +6581,7 @@ auto MainWindow::LoadPattern(QString fileName, const QString &customMeasureFile)
|
|||
FullParseFile();
|
||||
|
||||
m_progressBar->setVisible(false);
|
||||
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
||||
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
m_taskbarProgress->setVisible(false);
|
||||
#endif
|
||||
m_statusLabel->setVisible(true);
|
||||
|
@ -6619,7 +6592,7 @@ auto MainWindow::LoadPattern(QString fileName, const QString &customMeasureFile)
|
|||
{
|
||||
/* Collect garbage only after successfully parse. This way wrongly accused items have one more time to
|
||||
* restore a reference. */
|
||||
QTimer::singleShot(V_MSECONDS(100), Qt::CoarseTimer, this, [this]() { doc->GarbageCollector(true); });
|
||||
QTimer::singleShot(100ms, Qt::CoarseTimer, this, [this]() { doc->GarbageCollector(true); });
|
||||
}
|
||||
|
||||
m_patternReadOnly = doc->IsReadOnly();
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
#include <QtSvg>
|
||||
#include <functional>
|
||||
|
||||
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
||||
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
#include <QWinTaskbarButton>
|
||||
#include <QWinTaskbarProgress>
|
||||
#endif
|
||||
|
@ -134,14 +134,14 @@ MainWindowsNoGUI::MainWindowsNoGUI(QWidget *parent)
|
|||
: VAbstractMainWindow(parent),
|
||||
pattern(new VContainer(VAbstractApplication::VApp()->TrVars(), VAbstractValApplication::VApp()->patternUnitsP(),
|
||||
valentinaNamespace))
|
||||
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
||||
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
,
|
||||
m_taskbarButton(new QWinTaskbarButton(this))
|
||||
#endif
|
||||
{
|
||||
InitTempLayoutScene();
|
||||
|
||||
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
||||
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
m_taskbarButton->setWindow(this->windowHandle());
|
||||
m_taskbarProgress = m_taskbarButton->progress();
|
||||
m_taskbarProgress->setMinimum(0);
|
||||
|
@ -193,14 +193,14 @@ auto MainWindowsNoGUI::GenerateLayout(VLayoutGenerator &lGenerator) -> bool
|
|||
QElapsedTimer timer;
|
||||
timer.start();
|
||||
|
||||
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
||||
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
QTimer *progressTimer = nullptr;
|
||||
#endif
|
||||
|
||||
QSharedPointer<DialogLayoutProgress> progress;
|
||||
if (VApplication::IsGUIMode())
|
||||
{
|
||||
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
||||
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
m_taskbarProgress->setVisible(true);
|
||||
m_taskbarProgress->setValue(0);
|
||||
m_taskbarProgress->setMaximum(lGenerator.GetNestingTime() * 60);
|
||||
|
@ -419,7 +419,7 @@ auto MainWindowsNoGUI::GenerateLayout(VLayoutGenerator &lGenerator) -> bool
|
|||
progress->Finished();
|
||||
}
|
||||
|
||||
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
||||
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
if (VApplication::IsGUIMode())
|
||||
{
|
||||
progressTimer->stop();
|
||||
|
|
|
@ -46,7 +46,7 @@ struct PosterData;
|
|||
class QGraphicsRectItem;
|
||||
class VMeasurements;
|
||||
|
||||
#if defined(Q_OS_WIN) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
||||
#if defined(Q_OS_WIN) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
class QWinTaskbarButton;
|
||||
class QWinTaskbarProgress;
|
||||
#endif
|
||||
|
@ -127,7 +127,7 @@ protected:
|
|||
|
||||
QSharedPointer<DialogSaveLayout> m_dialogSaveLayout{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||
|
||||
#if defined(Q_OS_WIN) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
||||
#if defined(Q_OS_WIN) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
QWinTaskbarButton *m_taskbarButton; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||
QWinTaskbarProgress *m_taskbarProgress{nullptr}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||
#endif
|
||||
|
|
|
@ -377,45 +377,18 @@ win32:*g++* {
|
|||
package.files += $$[QT_INSTALL_BINS]/Qt5WinExtras.dll
|
||||
}
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4):greaterThan(QT_MINOR_VERSION, 10) {
|
||||
versionAtLeast(QT_VERSION, 5.12.4){
|
||||
# Minimal supported OpenSSL version since Qt 5.12.4 is 1.1.1.
|
||||
contains(QMAKE_HOST.arch, x86_64) {
|
||||
package.files += \
|
||||
$$PWD/../../../dist/win/openssl/win64/libcrypto-1_1-x64.dll \
|
||||
$$PWD/../../../dist/win/openssl/win64/libssl-1_1-x64.dll
|
||||
} else {
|
||||
package.files += \
|
||||
$$PWD/../../../dist/win/openssl/win32/libcrypto-1_1.dll \
|
||||
$$PWD/../../../dist/win/openssl/win32/libssl-1_1.dll
|
||||
}
|
||||
} else {
|
||||
package.files += \
|
||||
$$PWD/../../../dist/win/msvcr120.dll \
|
||||
package.files += \
|
||||
$$PWD/../../../dist/win/msvcr120.dll
|
||||
|
||||
contains(QMAKE_HOST.arch, x86_64) {
|
||||
package.files += \
|
||||
$$PWD/../../../dist/win/openssl/win64/libeay32.dll \
|
||||
$$PWD/../../../dist/win/openssl/win64/ssleay32.dll
|
||||
} else {
|
||||
package.files += \
|
||||
$$PWD/../../../dist/win/openssl/win32/libeay32.dll \
|
||||
$$PWD/../../../dist/win/openssl/win32/ssleay32.dll
|
||||
}
|
||||
}
|
||||
# Minimal supported OpenSSL version since Qt 5.12.4 is 1.1.1.
|
||||
contains(QMAKE_HOST.arch, x86_64) {
|
||||
package.files += \
|
||||
$$PWD/../../../dist/win/openssl/win64/libcrypto-1_1-x64.dll \
|
||||
$$PWD/../../../dist/win/openssl/win64/libssl-1_1-x64.dll
|
||||
} else {
|
||||
package.files += \
|
||||
$$PWD/../../../dist/win/msvcr120.dll \
|
||||
|
||||
contains(QMAKE_HOST.arch, x86_64) {
|
||||
package.files += \
|
||||
$$PWD/../../../dist/win/openssl/win64/libeay32.dll \
|
||||
$$PWD/../../../dist/win/openssl/win64/ssleay32.dll
|
||||
} else {
|
||||
package.files += \
|
||||
$$PWD/../../../dist/win/openssl/win32/libeay32.dll \
|
||||
$$PWD/../../../dist/win/openssl/win32/ssleay32.dll
|
||||
}
|
||||
$$PWD/../../../dist/win/openssl/win32/libcrypto-1_1.dll \
|
||||
$$PWD/../../../dist/win/openssl/win32/libssl-1_1.dll
|
||||
}
|
||||
|
||||
package.CONFIG = no_check_exist
|
||||
|
|
|
@ -103,16 +103,11 @@
|
|||
#include "../vtools/tools/vtooluniondetails.h"
|
||||
#include "../vwidgets/vabstractmainwindow.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
|
||||
#include "../vmisc/backport/qscopeguard.h"
|
||||
#else
|
||||
#include <QScopeGuard>
|
||||
#endif
|
||||
|
||||
#include <QDebug>
|
||||
#include <QFileInfo>
|
||||
#include <QFuture>
|
||||
#include <QMessageBox>
|
||||
#include <QScopeGuard>
|
||||
#include <QTimer>
|
||||
#include <QUndoStack>
|
||||
#include <QtConcurrentMap>
|
||||
|
@ -121,16 +116,7 @@
|
|||
#include <chrono>
|
||||
#include <functional>
|
||||
|
||||
#if (defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
|
||||
// DO NOT WORK WITH GCC 4.8
|
||||
#else
|
||||
#if __cplusplus >= 201402L
|
||||
using namespace std::chrono_literals;
|
||||
#else
|
||||
#include "../vmisc/bpstd/chrono.hpp"
|
||||
using namespace bpstd::literals::chrono_literals;
|
||||
#endif // __cplusplus >= 201402L
|
||||
#endif //(defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
|
||||
|
||||
using namespace Qt::Literals::StringLiterals;
|
||||
|
||||
|
@ -291,7 +277,7 @@ void VPattern::Parse(const Document &parse)
|
|||
|
||||
if (VApplication::IsGUIMode())
|
||||
{
|
||||
QTimer::singleShot(V_SECONDS(1), Qt::VeryCoarseTimer, this, &VPattern::RefreshPieceGeometry);
|
||||
QTimer::singleShot(1s, Qt::VeryCoarseTimer, this, &VPattern::RefreshPieceGeometry);
|
||||
}
|
||||
else if (VApplication::CommandLine()->IsTestModeEnabled())
|
||||
{
|
||||
|
|
|
@ -28,10 +28,6 @@
|
|||
#include <QUrl>
|
||||
#include <QtGlobal>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif
|
||||
|
||||
class FvAvailableUpdate final : public QObject
|
||||
{
|
||||
Q_OBJECT // NOLINT
|
||||
|
|
|
@ -28,10 +28,6 @@
|
|||
#include <QString>
|
||||
#include <QtGlobal>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif
|
||||
|
||||
class QGraphicsScene;
|
||||
|
||||
namespace Ui
|
||||
|
|
|
@ -457,11 +457,7 @@ auto LocaleSign0(const QLocale &locale) -> QChar
|
|||
const QString sign = locale.toString(0);
|
||||
if (sign.size() == 1)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
return sign.front();
|
||||
#else
|
||||
return sign.at(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
|
@ -477,11 +473,7 @@ auto LocaleSign1(const QLocale &locale) -> QChar
|
|||
const QString sign = locale.toString(1);
|
||||
if (sign.size() == 1)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
return sign.front();
|
||||
#else
|
||||
return sign.at(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
|
@ -497,11 +489,7 @@ auto LocaleSign2(const QLocale &locale) -> QChar
|
|||
const QString sign = locale.toString(2);
|
||||
if (sign.size() == 1)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
return sign.front();
|
||||
#else
|
||||
return sign.at(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
|
@ -517,11 +505,7 @@ auto LocaleSign3(const QLocale &locale) -> QChar
|
|||
const QString sign = locale.toString(3);
|
||||
if (sign.size() == 1)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
return sign.front();
|
||||
#else
|
||||
return sign.at(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
|
@ -537,11 +521,7 @@ auto LocaleSign4(const QLocale &locale) -> QChar
|
|||
const QString sign = locale.toString(4);
|
||||
if (sign.size() == 1)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
return sign.front();
|
||||
#else
|
||||
return sign.at(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
|
@ -557,11 +537,7 @@ auto LocaleSign5(const QLocale &locale) -> QChar
|
|||
const QString sign = locale.toString(5);
|
||||
if (sign.size() == 1)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
return sign.front();
|
||||
#else
|
||||
return sign.at(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
|
@ -577,11 +553,7 @@ auto LocaleSign6(const QLocale &locale) -> QChar
|
|||
const QString sign = locale.toString(6);
|
||||
if (sign.size() == 1)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
return sign.front();
|
||||
#else
|
||||
return sign.at(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
|
@ -597,11 +569,7 @@ auto LocaleSign7(const QLocale &locale) -> QChar
|
|||
const QString sign = locale.toString(7);
|
||||
if (sign.size() == 1)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
return sign.front();
|
||||
#else
|
||||
return sign.at(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
|
@ -617,11 +585,7 @@ auto LocaleSign8(const QLocale &locale) -> QChar
|
|||
const QString sign = locale.toString(8);
|
||||
if (sign.size() == 1)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
return sign.front();
|
||||
#else
|
||||
return sign.at(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
|
@ -637,11 +601,7 @@ auto LocaleSign9(const QLocale &locale) -> QChar
|
|||
const QString sign = locale.toString(9);
|
||||
if (sign.size() == 1)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
return sign.front();
|
||||
#else
|
||||
return sign.at(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
|
|
|
@ -25,13 +25,6 @@
|
|||
#include "qmuparser_global.h"
|
||||
#include "qmuparserdef.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#define Q_DISABLE_COPY_MOVE(Class) \
|
||||
Q_DISABLE_COPY(Class) \
|
||||
Class(Class &&) = delete; \
|
||||
Class &operator=(Class &&) = delete;
|
||||
#endif
|
||||
|
||||
#ifndef Q_DISABLE_ASSIGN
|
||||
#define Q_DISABLE_ASSIGN(Class) Class &operator=(const Class &) = delete;
|
||||
#endif
|
||||
|
|
|
@ -23,15 +23,15 @@
|
|||
|
||||
#include <QCoreApplication>
|
||||
#include <QLineF>
|
||||
#include <QtDebug>
|
||||
#include <QtGlobal>
|
||||
#include <QtMath>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <QtDebug>
|
||||
#include <QtMath>
|
||||
|
||||
#include "qmuparsererror.h"
|
||||
#include "../vmisc/defglobal.h"
|
||||
#include "qmudef.h"
|
||||
#include "qmuparsererror.h"
|
||||
|
||||
/**
|
||||
* @file
|
||||
|
@ -64,13 +64,13 @@ auto CSR(qreal length, qreal split, qreal arcLength) -> qreal
|
|||
const QLineF line(QPointF(0, 0), QPointF(0, length));
|
||||
|
||||
QLineF tmp = line;
|
||||
tmp.setAngle(tmp.angle()+90.0*sign);
|
||||
tmp.setAngle(tmp.angle() + 90.0 * sign);
|
||||
tmp.setLength(split);
|
||||
|
||||
QPointF p1 = tmp.p2();
|
||||
|
||||
tmp = QLineF(QPointF(0, length), QPointF(0, 0));
|
||||
tmp.setAngle(tmp.angle()-90.0*sign);
|
||||
tmp.setAngle(tmp.angle() - 90.0 * sign);
|
||||
tmp.setLength(split);
|
||||
|
||||
QPointF p2 = tmp.p2();
|
||||
|
@ -83,11 +83,11 @@ auto CSR(qreal length, qreal split, qreal arcLength) -> qreal
|
|||
{
|
||||
if (arcL > arcLength)
|
||||
{
|
||||
angle = angle - angle/2.0;
|
||||
angle = angle - angle / 2.0;
|
||||
}
|
||||
else if (arcL < arcLength)
|
||||
{
|
||||
angle = angle + angle/2.0;
|
||||
angle = angle + angle / 2.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -100,28 +100,23 @@ auto CSR(qreal length, qreal split, qreal arcLength) -> qreal
|
|||
}
|
||||
|
||||
tmp = line2;
|
||||
tmp.setAngle(tmp.angle()+angle*sign);
|
||||
tmp.setAngle(tmp.angle() + angle * sign);
|
||||
|
||||
QPointF crosPoint;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
||||
const auto type = line.intersects(tmp, &crosPoint);
|
||||
#else
|
||||
const auto type = line.intersect(tmp, &crosPoint);
|
||||
#endif
|
||||
if (type == QLineF::NoIntersection)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
QLineF radius(crosPoint, tmp.p2());
|
||||
const qreal arcAngle = sign > 0 ? line.angleTo(radius): radius.angleTo(line);
|
||||
arcL = (M_PI*radius.length())/180.0 * arcAngle;
|
||||
}
|
||||
while(qAbs(arcL - arcLength) > (0.5/*mm*/ / 25.4) * PrintDPI);
|
||||
const qreal arcAngle = sign > 0 ? line.angleTo(radius) : radius.angleTo(line);
|
||||
arcL = (M_PI * radius.length()) / 180.0 * arcAngle;
|
||||
} while (qAbs(arcL - arcLength) > (0.5 /*mm*/ / 25.4) * PrintDPI);
|
||||
|
||||
return angle;
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
/**
|
||||
* @brief Namespace for mathematical applications.
|
||||
|
@ -132,13 +127,13 @@ namespace qmu
|
|||
// Trigonometric function
|
||||
auto QmuParser::DegreeToRadian(qreal deg) -> qreal
|
||||
{
|
||||
return qDegreesToRadians(deg);
|
||||
return qDegreesToRadians(deg);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto QmuParser::RadianToDegree(qreal rad) -> qreal
|
||||
{
|
||||
return qRadiansToDegrees(rad);
|
||||
return qRadiansToDegrees(rad);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -221,12 +216,12 @@ auto QmuParser::ATanD(qreal v) -> qreal
|
|||
auto QmuParser::Log2(qreal v) -> qreal
|
||||
{
|
||||
#ifdef MUP_MATH_EXCEPTIONS
|
||||
if (v<=0)
|
||||
if (v <= 0)
|
||||
{
|
||||
throw QmuParserError(ecDOMAIN_ERROR, "Log2");
|
||||
}
|
||||
#endif
|
||||
return log(v)/log(2.0);
|
||||
return log(v) / log(2.0);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -234,7 +229,7 @@ auto QmuParser::Log2(qreal v) -> qreal
|
|||
auto QmuParser::Log10(qreal v) -> qreal
|
||||
{
|
||||
#ifdef MUP_MATH_EXCEPTIONS
|
||||
if (v<=0)
|
||||
if (v <= 0)
|
||||
{
|
||||
throw QmuParserError(ecDOMAIN_ERROR, "Log10");
|
||||
}
|
||||
|
@ -258,7 +253,7 @@ auto QmuParser::Rint(qreal v) -> qreal
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto QmuParser::R2CM(qreal v) -> qreal
|
||||
{
|
||||
return Rint(v*10.0)/10.0;
|
||||
return Rint(v * 10.0) / 10.0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -284,7 +279,7 @@ auto QmuParser::CSRInch(qreal length, qreal split, qreal arcLength) -> qreal
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto QmuParser::Sign(qreal v) -> qreal
|
||||
{
|
||||
return ((v<0) ? -1 : (v>0) ? 1 : 0);
|
||||
return ((v < 0) ? -1 : (v > 0) ? 1 : 0);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -303,11 +298,11 @@ auto QmuParser::Sum(const qreal *a_afArg, qmusizetype a_iArgc) -> qreal
|
|||
{
|
||||
if (a_iArgc == 0)
|
||||
{
|
||||
throw QmuParserError(QCoreApplication::translate("QmuParser", "too few arguments for function sum.",
|
||||
"parser error message"));
|
||||
throw QmuParserError(
|
||||
QCoreApplication::translate("QmuParser", "too few arguments for function sum.", "parser error message"));
|
||||
}
|
||||
qreal fRes=0;
|
||||
for (int i=0; i<a_iArgc; ++i)
|
||||
qreal fRes = 0;
|
||||
for (int i = 0; i < a_iArgc; ++i)
|
||||
{
|
||||
fRes += a_afArg[i];
|
||||
}
|
||||
|
@ -324,15 +319,15 @@ auto QmuParser::Avg(const qreal *a_afArg, qmusizetype a_iArgc) -> qreal
|
|||
{
|
||||
if (a_iArgc == 0)
|
||||
{
|
||||
throw QmuParserError(QCoreApplication::translate("QmuParser", "too few arguments for function sum.",
|
||||
"parser error message"));
|
||||
throw QmuParserError(
|
||||
QCoreApplication::translate("QmuParser", "too few arguments for function sum.", "parser error message"));
|
||||
}
|
||||
qreal fRes=0;
|
||||
for (int i=0; i<a_iArgc; ++i)
|
||||
qreal fRes = 0;
|
||||
for (int i = 0; i < a_iArgc; ++i)
|
||||
{
|
||||
fRes += a_afArg[i];
|
||||
}
|
||||
return fRes/static_cast<qreal>(a_iArgc);
|
||||
return fRes / static_cast<qreal>(a_iArgc);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -345,11 +340,11 @@ auto QmuParser::Min(const qreal *a_afArg, qmusizetype a_iArgc) -> qreal
|
|||
{
|
||||
if (a_iArgc == 0)
|
||||
{
|
||||
throw QmuParserError(QCoreApplication::translate("QmuParser", "too few arguments for function min.",
|
||||
"parser error message"));
|
||||
throw QmuParserError(
|
||||
QCoreApplication::translate("QmuParser", "too few arguments for function min.", "parser error message"));
|
||||
}
|
||||
qreal fRes=a_afArg[0];
|
||||
for (int i=0; i<a_iArgc; ++i)
|
||||
qreal fRes = a_afArg[0];
|
||||
for (int i = 0; i < a_iArgc; ++i)
|
||||
{
|
||||
fRes = qMin(fRes, a_afArg[i]);
|
||||
}
|
||||
|
@ -366,11 +361,11 @@ auto QmuParser::Max(const qreal *a_afArg, qmusizetype a_iArgc) -> qreal
|
|||
{
|
||||
if (a_iArgc == 0)
|
||||
{
|
||||
throw QmuParserError(QCoreApplication::translate("QmuParser", "too few arguments for function min.",
|
||||
"parser error message"));
|
||||
throw QmuParserError(
|
||||
QCoreApplication::translate("QmuParser", "too few arguments for function min.", "parser error message"));
|
||||
}
|
||||
qreal fRes=a_afArg[0];
|
||||
for (int i=0; i<a_iArgc; ++i)
|
||||
qreal fRes = a_afArg[0];
|
||||
for (int i = 0; i < a_iArgc; ++i)
|
||||
{
|
||||
fRes = qMax(fRes, a_afArg[i]);
|
||||
}
|
||||
|
@ -379,19 +374,19 @@ auto QmuParser::Max(const qreal *a_afArg, qmusizetype a_iArgc) -> qreal
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief Default value recognition callback.
|
||||
* @param [in] a_szExpr Pointer to the expression
|
||||
* @param [in, out] a_iPos Pointer to an index storing the current position within the expression
|
||||
* @param [out] a_fVal Pointer where the value should be stored in case one is found.
|
||||
* @return 1 if a value was found 0 otherwise.
|
||||
*/
|
||||
* @brief Default value recognition callback.
|
||||
* @param [in] a_szExpr Pointer to the expression
|
||||
* @param [in, out] a_iPos Pointer to an index storing the current position within the expression
|
||||
* @param [out] a_fVal Pointer where the value should be stored in case one is found.
|
||||
* @return 1 if a value was found 0 otherwise.
|
||||
*/
|
||||
auto QmuParser::IsVal(const QString &a_szExpr, qmusizetype *a_iPos, qreal *a_fVal, const QLocale &locale, bool cNumbers,
|
||||
const QChar &decimal, const QChar &thousand) -> int
|
||||
{
|
||||
qreal fVal(0);
|
||||
|
||||
qmusizetype pos = ReadVal(a_szExpr, fVal, locale != QLocale::c() && cNumbers ? QLocale::c() : locale, decimal,
|
||||
thousand);
|
||||
qmusizetype pos =
|
||||
ReadVal(a_szExpr, fVal, locale != QLocale::c() && cNumbers ? QLocale::c() : locale, decimal, thousand);
|
||||
|
||||
if (pos == -1)
|
||||
{
|
||||
|
@ -409,7 +404,8 @@ auto QmuParser::IsVal(const QString &a_szExpr, qmusizetype *a_iPos, qreal *a_fVa
|
|||
*
|
||||
* Call QmuParserBase class constructor and trigger Function, Operator and Constant initialization.
|
||||
*/
|
||||
QmuParser::QmuParser():QmuParserBase()
|
||||
QmuParser::QmuParser()
|
||||
: QmuParserBase()
|
||||
{
|
||||
AddValIdent(IsVal);
|
||||
|
||||
|
@ -426,9 +422,9 @@ QmuParser::QmuParser():QmuParserBase()
|
|||
*/
|
||||
void QmuParser::InitCharSets()
|
||||
{
|
||||
DefineNameChars( QStringLiteral("0123456789_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") );
|
||||
DefineOprtChars( QStringLiteral("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+-*^/?<>=#!$%&|~'_{}") );
|
||||
DefineInfixOprtChars( QStringLiteral("/+-*^?<>=#!$%&|~'_") );
|
||||
DefineNameChars(QStringLiteral("0123456789_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"));
|
||||
DefineOprtChars(QStringLiteral("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+-*^/?<>=#!$%&|~'_{}"));
|
||||
DefineInfixOprtChars(QStringLiteral("/+-*^?<>=#!$%&|~'_"));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -438,76 +434,76 @@ void QmuParser::InitCharSets()
|
|||
void QmuParser::InitFun()
|
||||
{
|
||||
// trigonometric helper functions
|
||||
DefineFun(QStringLiteral("degTorad"), DegreeToRadian);
|
||||
DefineFun(QStringLiteral("radTodeg"), RadianToDegree);
|
||||
DefineFun(QStringLiteral("degTorad"), DegreeToRadian);
|
||||
DefineFun(QStringLiteral("radTodeg"), RadianToDegree);
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
#define QSIN_FUN qSin<qreal>
|
||||
#define QCOS_FUN qCos<qreal>
|
||||
#define QTAN_FUN qTan<qreal>
|
||||
#define QASIN_FUN qAsin<qreal>
|
||||
#define QACOS_FUN qAcos<qreal>
|
||||
#define QATAN_FUN qAtan<qreal>
|
||||
#define QATAN2_FUN qAtan2<qreal, qreal>
|
||||
#define QLN_FUN qLn<qreal>
|
||||
#define QEXP_FUN qExp<qreal>
|
||||
#define QSQRT_FUN qSqrt<qreal>
|
||||
#define QSIN_FUN qSin<qreal>
|
||||
#define QCOS_FUN qCos<qreal>
|
||||
#define QTAN_FUN qTan<qreal>
|
||||
#define QASIN_FUN qAsin<qreal>
|
||||
#define QACOS_FUN qAcos<qreal>
|
||||
#define QATAN_FUN qAtan<qreal>
|
||||
#define QATAN2_FUN qAtan2<qreal, qreal>
|
||||
#define QLN_FUN qLn<qreal>
|
||||
#define QEXP_FUN qExp<qreal>
|
||||
#define QSQRT_FUN qSqrt<qreal>
|
||||
#else
|
||||
#define QSIN_FUN qSin
|
||||
#define QCOS_FUN qCos
|
||||
#define QTAN_FUN qTan
|
||||
#define QASIN_FUN qAsin
|
||||
#define QACOS_FUN qAcos
|
||||
#define QATAN_FUN qAtan
|
||||
#define QATAN2_FUN qAtan2
|
||||
#define QLN_FUN qLn
|
||||
#define QEXP_FUN qExp
|
||||
#define QSQRT_FUN qSqrt
|
||||
#define QSIN_FUN qSin
|
||||
#define QCOS_FUN qCos
|
||||
#define QTAN_FUN qTan
|
||||
#define QASIN_FUN qAsin
|
||||
#define QACOS_FUN qAcos
|
||||
#define QATAN_FUN qAtan
|
||||
#define QATAN2_FUN qAtan2
|
||||
#define QLN_FUN qLn
|
||||
#define QEXP_FUN qExp
|
||||
#define QSQRT_FUN qSqrt
|
||||
#endif
|
||||
|
||||
// trigonometric functions
|
||||
DefineFun(QStringLiteral("sin"), QSIN_FUN);
|
||||
DefineFun(QStringLiteral("cos"), QCOS_FUN);
|
||||
DefineFun(QStringLiteral("tan"), QTAN_FUN);
|
||||
DefineFun(QStringLiteral("sin"), QSIN_FUN);
|
||||
DefineFun(QStringLiteral("cos"), QCOS_FUN);
|
||||
DefineFun(QStringLiteral("tan"), QTAN_FUN);
|
||||
DefineFun(QStringLiteral("sinD"), SinD);
|
||||
DefineFun(QStringLiteral("cosD"), CosD);
|
||||
DefineFun(QStringLiteral("tanD"), TanD);
|
||||
// arcus functions
|
||||
DefineFun(QStringLiteral("asin"), QASIN_FUN);
|
||||
DefineFun(QStringLiteral("acos"), QACOS_FUN);
|
||||
DefineFun(QStringLiteral("atan"), QATAN_FUN);
|
||||
DefineFun(QStringLiteral("asin"), QASIN_FUN);
|
||||
DefineFun(QStringLiteral("acos"), QACOS_FUN);
|
||||
DefineFun(QStringLiteral("atan"), QATAN_FUN);
|
||||
DefineFun(QStringLiteral("atan2"), QATAN2_FUN);
|
||||
DefineFun(QStringLiteral("asinD"), ASinD);
|
||||
DefineFun(QStringLiteral("acosD"), ACosD);
|
||||
DefineFun(QStringLiteral("atanD"), ATanD);
|
||||
// hyperbolic functions
|
||||
DefineFun(QStringLiteral("sinh"), Sinh);
|
||||
DefineFun(QStringLiteral("cosh"), Cosh);
|
||||
DefineFun(QStringLiteral("tanh"), Tanh);
|
||||
DefineFun(QStringLiteral("sinh"), Sinh);
|
||||
DefineFun(QStringLiteral("cosh"), Cosh);
|
||||
DefineFun(QStringLiteral("tanh"), Tanh);
|
||||
// arcus hyperbolic functions
|
||||
DefineFun(QStringLiteral("asinh"), ASinh);
|
||||
DefineFun(QStringLiteral("acosh"), ACosh);
|
||||
DefineFun(QStringLiteral("atanh"), ATanh);
|
||||
// Logarithm functions
|
||||
DefineFun(QStringLiteral("log2"), Log2);
|
||||
DefineFun(QStringLiteral("log2"), Log2);
|
||||
DefineFun(QStringLiteral("log10"), Log10);
|
||||
DefineFun(QStringLiteral("log"), Log10);
|
||||
DefineFun(QStringLiteral("ln"), QLN_FUN);
|
||||
DefineFun(QStringLiteral("log"), Log10);
|
||||
DefineFun(QStringLiteral("ln"), QLN_FUN);
|
||||
// misc
|
||||
DefineFun(QStringLiteral("exp"), QEXP_FUN);
|
||||
DefineFun(QStringLiteral("sqrt"), QSQRT_FUN);
|
||||
DefineFun(QStringLiteral("sign"), Sign);
|
||||
DefineFun(QStringLiteral("rint"), Rint);
|
||||
DefineFun(QStringLiteral("r2cm"), R2CM);
|
||||
DefineFun(QStringLiteral("exp"), QEXP_FUN);
|
||||
DefineFun(QStringLiteral("sqrt"), QSQRT_FUN);
|
||||
DefineFun(QStringLiteral("sign"), Sign);
|
||||
DefineFun(QStringLiteral("rint"), Rint);
|
||||
DefineFun(QStringLiteral("r2cm"), R2CM);
|
||||
DefineFun(QStringLiteral("csrCm"), CSRCm);
|
||||
DefineFun(QStringLiteral("csrInch"), CSRInch);
|
||||
DefineFun(QStringLiteral("abs"), Abs);
|
||||
DefineFun(QStringLiteral("fmod"), FMod);
|
||||
DefineFun(QStringLiteral("abs"), Abs);
|
||||
DefineFun(QStringLiteral("fmod"), FMod);
|
||||
// Functions with variable number of arguments
|
||||
DefineFun(QStringLiteral("sum"), Sum);
|
||||
DefineFun(QStringLiteral("avg"), Avg);
|
||||
DefineFun(QStringLiteral("min"), Min);
|
||||
DefineFun(QStringLiteral("max"), Max);
|
||||
DefineFun(QStringLiteral("sum"), Sum);
|
||||
DefineFun(QStringLiteral("avg"), Avg);
|
||||
DefineFun(QStringLiteral("min"), Min);
|
||||
DefineFun(QStringLiteral("max"), Max);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -579,10 +575,7 @@ void QmuParser::OnDetectVar(const QString &pExpr, qmusizetype &nStart, qmusizety
|
|||
// cppcheck-suppress unusedFunction
|
||||
auto QmuParser::Diff(qreal *a_Var, qreal a_fPos, qreal a_fEpsilon) const -> qreal
|
||||
{
|
||||
qreal fRes(0),
|
||||
fBuf(*a_Var),
|
||||
f[4] = {0, 0, 0, 0},
|
||||
fEpsilon(a_fEpsilon);
|
||||
qreal fRes(0), fBuf(*a_Var), f[4] = {0, 0, 0, 0}, fEpsilon(a_fEpsilon);
|
||||
|
||||
// Backwards compatible calculation of epsilon inc case the user doesnt provide
|
||||
// his own epsilon
|
||||
|
@ -591,13 +584,17 @@ auto QmuParser::Diff(qreal *a_Var, qreal a_fPos, qreal a_fEpsilon) const -> qrea
|
|||
fEpsilon = qFuzzyIsNull(a_fPos) ? static_cast<qreal>(1e-10) : static_cast<qreal>(1e-7) * a_fPos;
|
||||
}
|
||||
|
||||
*a_Var = a_fPos+2 * fEpsilon; f[0] = Eval();
|
||||
*a_Var = a_fPos+1 * fEpsilon; f[1] = Eval();
|
||||
*a_Var = a_fPos-1 * fEpsilon; f[2] = Eval();
|
||||
*a_Var = a_fPos-2 * fEpsilon; f[3] = Eval();
|
||||
*a_Var = a_fPos + 2 * fEpsilon;
|
||||
f[0] = Eval();
|
||||
*a_Var = a_fPos + 1 * fEpsilon;
|
||||
f[1] = Eval();
|
||||
*a_Var = a_fPos - 1 * fEpsilon;
|
||||
f[2] = Eval();
|
||||
*a_Var = a_fPos - 2 * fEpsilon;
|
||||
f[3] = Eval();
|
||||
*a_Var = fBuf; // restore variable
|
||||
|
||||
fRes = (-f[0] + 8*f[1] - 8*f[2] + f[3]) / (12*fEpsilon);
|
||||
fRes = (-f[0] + 8 * f[1] - 8 * f[2] + f[3]) / (12 * fEpsilon);
|
||||
return fRes;
|
||||
}
|
||||
} // namespace qmu
|
||||
|
|
|
@ -34,5 +34,5 @@ HEADERS += \
|
|||
$$PWD/qmuformulabase.h \
|
||||
$$PWD/qmutokenparser.h \
|
||||
$$PWD/qmuparsercallback_p.h \
|
||||
$$PWD/make_unique.h \
|
||||
$$PWD/text.h
|
||||
$$PWD/make_unique.h
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ VDynamicLib {
|
|||
"qmutokenparser.h",
|
||||
"qmuparsercallback_p.h",
|
||||
"make_unique.h",
|
||||
"text.h"
|
||||
]
|
||||
|
||||
cpp.defines: ["QMUPARSER_LIBRARY", 'QMUP_VERSION="' + product.version + '"']
|
||||
|
|
|
@ -36,10 +36,6 @@
|
|||
|
||||
#include "qmudef.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
||||
#include "text.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief This file contains the basic implementation of the muparser engine.
|
||||
|
|
|
@ -64,34 +64,6 @@
|
|||
#define __has_cpp_attribute(x) 0
|
||||
#endif
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
|
||||
|
||||
#ifndef QT_HAS_CPP_ATTRIBUTE
|
||||
#ifdef __has_cpp_attribute
|
||||
#define QT_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x)
|
||||
#else
|
||||
#define QT_HAS_CPP_ATTRIBUTE(x) 0
|
||||
#endif
|
||||
#endif // QT_HAS_CPP_ATTRIBUTE
|
||||
|
||||
#if defined(__cplusplus)
|
||||
#if QT_HAS_CPP_ATTRIBUTE(clang::fallthrough)
|
||||
#define Q_FALLTHROUGH() [[clang::fallthrough]]
|
||||
#elif QT_HAS_CPP_ATTRIBUTE(gnu::fallthrough)
|
||||
#define Q_FALLTHROUGH() [[gnu::fallthrough]]
|
||||
#elif QT_HAS_CPP_ATTRIBUTE(fallthrough)
|
||||
#define Q_FALLTHROUGH() [[fallthrough]]
|
||||
#endif
|
||||
#endif
|
||||
#ifndef Q_FALLTHROUGH
|
||||
#if (defined(Q_CC_GNU) && Q_CC_GNU >= 700) && !defined(Q_CC_INTEL)
|
||||
#define Q_FALLTHROUGH() __attribute__((fallthrough))
|
||||
#else
|
||||
#define Q_FALLTHROUGH() (void)0
|
||||
#endif
|
||||
#endif // defined(__cplusplus)
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
|
||||
|
||||
/** @brief If this macro is defined mathematical exceptions (div by zero) will be thrown as exceptions. */
|
||||
// #define QMUP_MATH_EXCEPTIONS
|
||||
|
||||
|
|
|
@ -34,10 +34,6 @@
|
|||
#include "qmuparserdef.h"
|
||||
#include "qmutranslation.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#include "../vmisc/defglobal.h"
|
||||
#endif
|
||||
|
||||
/** @file
|
||||
@brief This file defines the error class used by the parser.
|
||||
*/
|
||||
|
|
|
@ -22,17 +22,14 @@
|
|||
#ifndef QMUPARSERTEST_H
|
||||
#define QMUPARSERTEST_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <QMetaObject>
|
||||
#include <QObject>
|
||||
#include <QRandomGenerator>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
#include <QtGlobal>
|
||||
#include <locale>
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
# include <QRandomGenerator>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "qmuparser.h"
|
||||
#include "qmuparser_global.h"
|
||||
|
@ -60,8 +57,9 @@ namespace Test
|
|||
class QMUPARSERSHARED_EXPORT QmuParserTester : public QObject // final
|
||||
{
|
||||
Q_OBJECT // NOLINT
|
||||
|
||||
public:
|
||||
typedef int ( QmuParserTester::*testfun_type ) ();
|
||||
typedef int (QmuParserTester::*testfun_type)();
|
||||
|
||||
explicit QmuParserTester(QObject *parent = nullptr);
|
||||
|
||||
|
@ -73,7 +71,7 @@ private:
|
|||
QVector<testfun_type> m_vTestFun;
|
||||
static int c_iCount;
|
||||
|
||||
void AddTest ( testfun_type a_pFun );
|
||||
void AddTest(testfun_type a_pFun);
|
||||
|
||||
// Test Double Parser
|
||||
static auto EqnTest(const QString &a_str, double a_fRes, bool a_fPass) -> int;
|
||||
|
@ -133,9 +131,9 @@ private:
|
|||
|
||||
static auto FirstArg(const qreal *a_afArg, qmusizetype a_iArgc) -> qreal
|
||||
{
|
||||
if ( a_iArgc == 0)
|
||||
if (a_iArgc == 0)
|
||||
{
|
||||
throw QmuParserError ( "too few arguments for function FirstArg." );
|
||||
throw QmuParserError("too few arguments for function FirstArg.");
|
||||
}
|
||||
|
||||
return a_afArg[0];
|
||||
|
@ -143,9 +141,9 @@ private:
|
|||
|
||||
static auto LastArg(const qreal *a_afArg, qmusizetype a_iArgc) -> qreal
|
||||
{
|
||||
if ( a_iArgc == 0)
|
||||
if (a_iArgc == 0)
|
||||
{
|
||||
throw QmuParserError ( "too few arguments for function LastArg." );
|
||||
throw QmuParserError("too few arguments for function LastArg.");
|
||||
}
|
||||
|
||||
return a_afArg[a_iArgc - 1];
|
||||
|
@ -153,13 +151,13 @@ private:
|
|||
|
||||
static auto Sum(const qreal *a_afArg, qmusizetype a_iArgc) -> qreal
|
||||
{
|
||||
if ( a_iArgc == 0)
|
||||
if (a_iArgc == 0)
|
||||
{
|
||||
throw QmuParserError ( "too few arguments for function sum." );
|
||||
throw QmuParserError("too few arguments for function sum.");
|
||||
}
|
||||
|
||||
qreal fRes = 0;
|
||||
for ( int i = 0; i < a_iArgc; ++i )
|
||||
for (int i = 0; i < a_iArgc; ++i)
|
||||
{
|
||||
fRes += a_afArg[i];
|
||||
}
|
||||
|
@ -168,22 +166,14 @@ private:
|
|||
|
||||
static auto Rnd(qreal v) -> qreal
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
return static_cast<qreal>( ( 1 + ( v * QRandomGenerator().bounded(static_cast<qreal>(RAND_MAX)) /
|
||||
( RAND_MAX + 1.0 ) ) ) );
|
||||
#else
|
||||
return static_cast<qreal>( ( 1 + ( v * qrand() / ( RAND_MAX + 1.0 ) ) ) );
|
||||
#endif
|
||||
return static_cast<qreal>(
|
||||
(1 + (v * QRandomGenerator().bounded(static_cast<qreal>(RAND_MAX)) / (RAND_MAX + 1.0))));
|
||||
}
|
||||
|
||||
static auto RndWithString(const char_type *) -> qreal
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
return static_cast<qreal>( ( 1 + ( 1000.0f * QRandomGenerator().bounded(static_cast<qreal>(RAND_MAX)) /
|
||||
( RAND_MAX + 1.0 ) ) ) );
|
||||
#else
|
||||
return static_cast<qreal>( ( 1 + ( 1000.0f * static_cast<qreal>(qrand()) / ( RAND_MAX + 1.0 ) ) ) );
|
||||
#endif
|
||||
return static_cast<qreal>(
|
||||
(1 + (1000.0f * QRandomGenerator().bounded(static_cast<qreal>(RAND_MAX)) / (RAND_MAX + 1.0))));
|
||||
}
|
||||
|
||||
static auto Ping() -> qreal { return 10; }
|
||||
|
@ -199,7 +189,7 @@ private:
|
|||
static auto StrFun2(const QString &v1, qreal v2) -> qreal
|
||||
{
|
||||
int val = v1.toInt();
|
||||
return static_cast<qreal>( val + v2 );
|
||||
return static_cast<qreal>(val + v2);
|
||||
}
|
||||
|
||||
static auto StrFun3(const QString &v1, qreal v2, qreal v3) -> qreal
|
||||
|
|
|
@ -1,52 +0,0 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file text.h
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 21 2, 2023
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentina project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2023 Valentina project
|
||||
** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
|
||||
**
|
||||
** Valentina is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** Valentina is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||
**
|
||||
*************************************************************************/
|
||||
#ifndef TEXT_H
|
||||
#define TEXT_H
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
||||
#include <QTextStream>
|
||||
|
||||
namespace Qt
|
||||
{
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_GCC("-Wunused-variable")
|
||||
QT_WARNING_DISABLE_CLANG("-Wunused-variable")
|
||||
|
||||
// static auto endl Q_DECL_UNUSED = ::endl; // NOLINT
|
||||
// static auto flush Q_DECL_UNUSED = ::flush; // NOLINT
|
||||
static auto dec Q_DECL_UNUSED = ::dec; // NOLINT
|
||||
// static auto SkipEmptyParts Q_DECL_UNUSED = QString::SkipEmptyParts; // NOLINT
|
||||
|
||||
QT_WARNING_POP
|
||||
} // namespace Qt
|
||||
|
||||
#endif
|
||||
|
||||
#endif // TEXT_H
|
|
@ -58,41 +58,6 @@
|
|||
#define __has_cpp_attribute(x) 0
|
||||
#endif
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
|
||||
|
||||
#ifndef QT_HAS_CPP_ATTRIBUTE
|
||||
#ifdef __has_cpp_attribute
|
||||
#define QT_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x)
|
||||
#else
|
||||
#define QT_HAS_CPP_ATTRIBUTE(x) 0
|
||||
#endif
|
||||
#endif // QT_HAS_CPP_ATTRIBUTE
|
||||
|
||||
#if defined(__cplusplus)
|
||||
#if QT_HAS_CPP_ATTRIBUTE(clang::fallthrough)
|
||||
#define Q_FALLTHROUGH() [[clang::fallthrough]]
|
||||
#elif QT_HAS_CPP_ATTRIBUTE(gnu::fallthrough)
|
||||
#define Q_FALLTHROUGH() [[gnu::fallthrough]]
|
||||
#elif QT_HAS_CPP_ATTRIBUTE(fallthrough)
|
||||
#define Q_FALLTHROUGH() [[fallthrough]]
|
||||
#endif
|
||||
#endif
|
||||
#ifndef Q_FALLTHROUGH
|
||||
#if (defined(Q_CC_GNU) && Q_CC_GNU >= 700) && !defined(Q_CC_INTEL)
|
||||
#define Q_FALLTHROUGH() __attribute__((fallthrough))
|
||||
#else
|
||||
#define Q_FALLTHROUGH() (void)0
|
||||
#endif
|
||||
#endif // defined(__cplusplus)
|
||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||
#define Q_DISABLE_COPY_MOVE(Class) \
|
||||
Q_DISABLE_COPY(Class) \
|
||||
Class(Class &&) = delete; \
|
||||
Class &operator=(Class &&) = delete;
|
||||
#endif
|
||||
|
||||
#ifndef Q_DISABLE_ASSIGN_MOVE
|
||||
#define Q_DISABLE_ASSIGN_MOVE(Class) \
|
||||
Q_DISABLE_ASSIGN(Class) \
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user