Merge branch 'qt6' into develop. Closes #115, #117

This commit is contained in:
Roman Telezhynskyi 2023-02-14 09:24:07 +02:00
commit c6647866cb
341 changed files with 3944 additions and 1569 deletions

2
conanfile.txt Normal file
View File

@ -0,0 +1,2 @@
[requires]
xerces-c/[>=3.2,<4.0]

View File

@ -0,0 +1,124 @@
import qbs.File
import qbs.FileInfo
import qbs.TextFile
ModuleProvider {
relativeSearchPaths: {
var conanPackageDir = FileInfo.cleanPath(FileInfo.joinPaths(outputBaseDir, "../../..", "genconan"));
var dirs = File.directoryEntries(conanPackageDir, File.AllDirs | File.NoDotAndDotDot);
var packageVersions = {};
/*
* The generated conanbuildinfo.json files are inside of the 'genconan' folder in the build directory.
* Since there might be more than one, they're placed inside of folders with a hashed name to avoid conflicts.
* Here we have to iterate over those folders and process the json files within.
*/
for(d in dirs) {
var conanbuildinfo = FileInfo.joinPaths(conanPackageDir, dirs[d], "conanbuildinfo.json");
if(!File.exists(conanbuildinfo)) {
continue;
}
var file = new TextFile(conanbuildinfo, TextFile.ReadOnly);
var fileContent = JSON.parse(file.readAll());
file.close();
console.info(JSON.stringify(fileContent));
var deps = fileContent.dependencies;
for(i in deps){
if(packageVersions[deps[i].name]) {
if(deps[i].version != packageVersions[deps[i].name]) {
console.error("Conan package '" + deps[i].name + "' found in multiple conanfile.txt's with different versions: " +
packageVersions[deps[i].name] + " and " + deps[i].version);
return [];
}
console.info("Already generated module for conan package '" + deps[i].name + "', skipping...")
continue;
}
console.info("Generating module for conan package '" + deps[i].name + "'");
packageVersions[deps[i].name] = deps[i].version;
// module name can be invalid for Javascrip. Search for alternative names for cmake.
var moduleName = deps[i].name;
if (deps[i].hasOwnProperty("names"))
{
if (deps[i].names.hasOwnProperty("cmake_find_package"))
moduleName = deps[i].names.cmake_find_package;
else if (deps.names.hasOwnProperty("cmake_find_package_multi"))
moduleName = deps[i].names.cmake_find_package_multi;
}
var moduleDir = FileInfo.joinPaths(outputBaseDir, "modules", name, moduleName);
File.makePath(moduleDir);
var moduleFile = new TextFile(FileInfo.joinPaths(moduleDir, moduleName + ".qbs"), TextFile.WriteOnly);
var shared = false;
if (fileContent.options[deps[i].name].hasOwnProperty("shared"))
{
shared = (fileContent.options[deps[i].name].shared === 'True');
}
var cppLibraries = shared ? "\tcpp.dynamicLibraries: " : "\tcpp.staticLibraries: ";
moduleFile.write("import qbs\n" +
"Module {\n" +
"\tproperty bool installBin: false\n" +
"\tproperty bool installLib: false\n" +
"\tproperty bool installRes: false\n" +
"\tproperty bool installInclude: false\n" +
"\tproperty string binInstallDir: \"bin\"\n" +
"\tproperty string libInstallDir: \"lib\"\n" +
"\tproperty string resInstallDir: \"res\"\n" +
"\tproperty string includeInstallDir: \"include\"\n" +
"\tproperty stringList binFilePatterns: [\"**/*\"]\n" +
"\tproperty stringList libFilePatterns: [\"**/*\"]\n" +
"\tproperty stringList resFilePatterns: [\"**/*\"]\n" +
"\tproperty stringList includeFilePatterns: [\"**/*\"]\n\n" +
"\tDepends { name: \"cpp\" }\n\n" +
"\tcpp.includePaths: " + JSON.stringify(deps[i].include_paths) + "\n" +
"\tcpp.systemIncludePaths: " + JSON.stringify(deps[i].include_paths) + "\n" +
"\tcpp.libraryPaths: " + JSON.stringify(deps[i].lib_paths) + "\n" +
cppLibraries + JSON.stringify(deps[i].libs) + "\n" +
"\tcpp.defines: " + JSON.stringify(deps[i].defines) + "\n\n");
function writeGroups(file, moduleName, prefix, pathList, install) {
for(j in pathList) {
file.write("\tGroup {\n" +
"\t\tname: \"" + prefix + (j > 0 ? j : "") + "\"\n" +
"\t\tprefix: \"" + FileInfo.fromNativeSeparators(pathList[j]) + "/\"\n" +
"\t\tfilesAreTargets: true\n");
if (install)
file.write("\t\tqbs.install: product.conan." + moduleName + ".install" + (prefix.charAt(0).toUpperCase() + prefix.substring(1)) + "\n" +
"\t\tqbs.installPrefix: \"\"\n" +
"\t\tqbs.installDir: product.conan." + moduleName + "." + prefix + "InstallDir\n" +
"\t\tqbs.installSourceBase: \"" + FileInfo.fromNativeSeparators(pathList[j]) + "\"\n");
file.write("\t\tfiles: product.conan." + moduleName + "." + prefix + "FilePatterns\n" +
"\t}\n");
}
}
writeGroups(moduleFile, moduleName, "bin", deps[i].bin_paths, true);
writeGroups(moduleFile, moduleName, "lib", deps[i].lib_paths, shared);
writeGroups(moduleFile, moduleName, "res", deps[i].res_paths, true);
writeGroups(moduleFile, moduleName, "include", deps[i].include_paths, shared);
moduleFile.writeLine("}");
moduleFile.close();
}
}
return [""];
}
}

View File

@ -37,6 +37,17 @@ Module {
property bool treatWarningsAsErrors: true
readonly property bool useConanPackages : {
if (Utilities.versionCompare(Qt.core.version, "6") < 0)
return false;
if (qbs.targetOS.contains("unix") && !qbs.targetOS.contains("macos"))
{
return project.enableConan;
}
return true;
}
property string libDirName: "lib"
property string appTarget

View File

@ -136,7 +136,7 @@ void DialogPuzzlePreferences::Apply()
if (not preferences.isEmpty())
{
const QString text = tr("Followed %n option(s) require restart to take effect: %1.", "",
preferences.size()).arg(preferences.join(QStringLiteral(", ")));
static_cast<int>(preferences.size())).arg(preferences.join(QStringLiteral(", ")));
QMessageBox::information(this, QCoreApplication::applicationName(), text);
}

View File

@ -45,7 +45,8 @@
#endif
//---------------------------------------------------------------------------------------------------------------------
DialogSaveManualLayout::DialogSaveManualLayout(int count, bool consoleExport, const QString &fileName, QWidget *parent)
DialogSaveManualLayout::DialogSaveManualLayout(vsizetype count, bool consoleExport, const QString &fileName,
QWidget *parent)
: VAbstractLayoutDialog(parent),
ui(new Ui::DialogSaveManualLayout),
m_count(count),

View File

@ -41,7 +41,7 @@ class DialogSaveManualLayout : public VAbstractLayoutDialog
Q_OBJECT // NOLINT
public:
explicit DialogSaveManualLayout(int count, bool consoleExport, const QString &fileName = QString(),
explicit DialogSaveManualLayout(vsizetype count, bool consoleExport, const QString &fileName = QString(),
QWidget *parent = nullptr);
~DialogSaveManualLayout() override;
@ -77,7 +77,7 @@ private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(DialogSaveManualLayout) // NOLINT
Ui::DialogSaveManualLayout *ui;
int m_count;
vsizetype m_count;
bool m_isInitialized{false};
bool m_scaleConnected{true};
bool m_consoleExport;

View File

@ -32,7 +32,6 @@
#include "vpapplication.h"
#include "../vmisc/def.h"
#if defined(APPIMAGE) && defined(Q_OS_LINUX)
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
# include "../vmisc/backport/qscopeguard.h"
@ -42,6 +41,10 @@
# include "../vmisc/appimage.h"
#endif // defined(APPIMAGE) && defined(Q_OS_LINUX)
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <xercesc/util/PlatformUtils.hpp>
#endif
auto main(int argc, char *argv[]) -> int
{
#if defined(APPIMAGE) && defined(Q_OS_LINUX)
@ -68,6 +71,12 @@ auto main(int argc, char *argv[]) -> int
InitHighDpiScaling(argc, argv);
#endif //Q_OS_MAC
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
XERCES_CPP_NAMESPACE::XMLPlatformUtils::Initialize();
auto Terminate = qScopeGuard([](){ XERCES_CPP_NAMESPACE::XMLPlatformUtils::Terminate(); });
#endif
VPApplication app(argc, argv);
app.InitOptions();

View File

@ -66,8 +66,13 @@ QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wenum-enum-conversion")
#endif
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
Q_GLOBAL_STATIC_WITH_ARGS(const QKeySequence, restoreOriginShortcut, // NOLINT
(QKeySequence(Qt::ControlModifier | Qt::Key_Asterisk)))
#else
Q_GLOBAL_STATIC_WITH_ARGS(const QKeySequence, restoreOriginShortcut, // NOLINT
(QKeySequence(Qt::ControlModifier + Qt::Key_Asterisk)))
#endif
QT_WARNING_POP
}
@ -200,7 +205,7 @@ void VPMainGraphicsView::dropEvent(QDropEvent *event)
event->acceptProposedAction();
piece->ClearTransformations();
piece->SetPosition(mapToScene(event->pos()));
piece->SetPosition(mapToScene(DropEventPos(event)));
piece->SetZValue(1.0);
auto *command = new VPUndoMovePieceOnSheet(layout->GetFocusedSheet(), piece);

View File

@ -75,6 +75,12 @@
# include <QtConcurrent>
#endif
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#ifdef QT_OPENGLWIDGETS_LIB
# include <QOpenGLWidget>
#endif
#endif
#endif /*__cplusplus*/
#endif // STABLE_H

View File

@ -41,7 +41,7 @@ auto CorrectedZValues(const QList<QVector<QString>> &order) -> QHash<QString, qr
qreal step = 0;
if (not order.isEmpty())
{
step = 1.0/order.size();
step = 1.0 / static_cast<int>(order.size());
}
for (int i = 0; i < order.size(); ++i)
@ -266,7 +266,7 @@ auto VPUndoPieceZValueMove::LevelStep(const QList<VPPiecePtr> &pieces) const ->
return 0;
}
return 1.0/levels.size();
return 1.0 / static_cast<int>(levels.size());
}
//---------------------------------------------------------------------------------------------------------------------
@ -509,5 +509,5 @@ auto VPUndoPiecesZValueMove::LevelStep(const QList<VPPiecePtr> &pieces) -> qreal
return 0;
}
return 1.0/levels.size();
return 1.0 / static_cast<int>(levels.size());
}

View File

@ -620,7 +620,7 @@ void VPApplication::SetPreferencesDialog(const QSharedPointer<DialogPuzzlePrefer
void VPApplication::Clean()
{
// cleanup any deleted main windows first
for (int i = m_mainWindows.count() - 1; i >= 0; --i)
for (vsizetype i = m_mainWindows.count() - 1; i >= 0; --i)
{
if (m_mainWindows.at(i).isNull())
{

View File

@ -39,7 +39,7 @@ std::shared_ptr<VPCommandLine> VPCommandLine::instance = nullptr; // NOLINT(cppc
auto VPCommandLine::IsExportEnabled() const -> bool
{
const bool result = IsOptionSet(LONG_OPTION_EXPORT_FILE);
int argSize = parser.positionalArguments().size();
auto argSize = parser.positionalArguments().size();
if (result && argSize != 1)
{
qCritical() << translate("Puzzle", "Export options can be used with single input file only.") << "/n";

View File

@ -1534,24 +1534,49 @@ void VPMainWindow::InitZoomToolBar()
// connect the zoom buttons and shortcuts to the slots
QList<QKeySequence> zoomInShortcuts;
zoomInShortcuts.append(QKeySequence(QKeySequence::ZoomIn));
zoomInShortcuts.append(QKeySequence(Qt::ControlModifier + Qt::Key_Plus + Qt::KeypadModifier));
zoomInShortcuts.append(
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QKeySequence(QKeyCombination(Qt::ControlModifier), Qt::Key_Plus | Qt::KeypadModifier));
#else
QKeySequence(Qt::ControlModifier + Qt::Key_Plus + Qt::KeypadModifier));
#endif
ui->actionZoomIn->setShortcuts(zoomInShortcuts);
connect(ui->actionZoomIn, &QAction::triggered, m_graphicsView, &VPMainGraphicsView::ZoomIn);
QList<QKeySequence> zoomOutShortcuts;
zoomOutShortcuts.append(QKeySequence(QKeySequence::ZoomOut));
zoomOutShortcuts.append(QKeySequence(Qt::ControlModifier + Qt::Key_Minus + Qt::KeypadModifier));
zoomOutShortcuts.append(
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QKeySequence(QKeyCombination(Qt::ControlModifier), Qt::Key_Minus | Qt::KeypadModifier));
#else
QKeySequence(Qt::ControlModifier + Qt::Key_Minus + Qt::KeypadModifier));
#endif
ui->actionZoomOut->setShortcuts(zoomOutShortcuts);
connect(ui->actionZoomOut, &QAction::triggered, m_graphicsView, &VPMainGraphicsView::ZoomOut);
QList<QKeySequence> zoomOriginalShortcuts;
zoomOriginalShortcuts.append(QKeySequence(Qt::ControlModifier + Qt::Key_0));
zoomOriginalShortcuts.append(QKeySequence(Qt::ControlModifier + Qt::Key_0 + Qt::KeypadModifier));
zoomOriginalShortcuts.append(
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QKeySequence(Qt::ControlModifier | Qt::Key_0));
#else
QKeySequence(Qt::ControlModifier + Qt::Key_0));
#endif
zoomOriginalShortcuts.append(
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QKeySequence(QKeyCombination(Qt::ControlModifier), Qt::Key_0 | Qt::KeypadModifier));
#else
QKeySequence(Qt::ControlModifier + Qt::Key_0 + Qt::KeypadModifier));
#endif
ui->actionZoomOriginal->setShortcuts(zoomOriginalShortcuts);
connect(ui->actionZoomOriginal, &QAction::triggered, m_graphicsView, &VPMainGraphicsView::ZoomOriginal);
QList<QKeySequence> zoomFitBestShortcuts;
zoomFitBestShortcuts.append(QKeySequence(Qt::ControlModifier + Qt::Key_Equal));
zoomFitBestShortcuts.append(
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QKeySequence(Qt::ControlModifier | Qt::Key_Equal));
#else
QKeySequence(Qt::ControlModifier + Qt::Key_Equal));
#endif
ui->actionZoomFitBest->setShortcuts(zoomFitBestShortcuts);
connect(ui->actionZoomFitBest, &QAction::triggered, m_graphicsView, &VPMainGraphicsView::ZoomFitBest);
@ -1592,7 +1617,7 @@ void VPMainWindow::UpdateWindowTitle()
}
else
{
int index = VPApplication::VApp()->MainWindows().indexOf(this);
vsizetype index = VPApplication::VApp()->MainWindows().indexOf(this);
if (index != -1)
{
showName = tr("untitled %1.vlt").arg(index+1);
@ -1647,7 +1672,6 @@ void VPMainWindow::ReadSettings()
if (settings->status() == QSettings::NoError)
{
restoreGeometry(settings->GetGeometry());
restoreState(settings->GetWindowState());
restoreState(settings->GetToolbarsState(), AppVersion());
// Text under tool buton icon
@ -1673,7 +1697,6 @@ void VPMainWindow::WriteSettings()
{
VPSettings *settings = VPApplication::VApp()->PuzzleSettings();
settings->SetGeometry(saveGeometry());
settings->SetWindowState(saveState());
settings->SetToolbarsState(saveState(AppVersion()));
settings->SetDockWidgetPropertiesActive(ui->dockWidgetProperties->isEnabled());
@ -1745,7 +1768,7 @@ void VPMainWindow::CreateWindowMenu(QMenu *menu)
VPMainWindow *window = windows.at(i);
QString title = QStringLiteral("%1. %2").arg(i+1).arg(window->windowTitle());
const int index = title.lastIndexOf(QLatin1String("[*]"));
const vsizetype index = title.lastIndexOf(QLatin1String("[*]"));
if (index != -1)
{
window->isWindowModified() ? title.replace(index, 3, QChar('*')) : title.replace(index, 3, QString());
@ -2915,13 +2938,13 @@ void VPMainWindow::PrintLayoutSheets(QPrinter *printer, const QList<VPSheetPtr>
firstPageNumber = 0;
}
int lastPageNumber = printer->toPage() - 1;
vsizetype lastPageNumber = printer->toPage() - 1;
if (lastPageNumber == -1 || lastPageNumber >= sheets.count())
{
lastPageNumber = sheets.count() - 1;
}
const int numPages = lastPageNumber - firstPageNumber + 1;
const vsizetype numPages = lastPageNumber - firstPageNumber + 1;
int copyCount = 1;
if (not printer->supportsMultipleCopies())
{
@ -2946,7 +2969,8 @@ void VPMainWindow::PrintLayoutSheets(QPrinter *printer, const QList<VPSheetPtr>
{
for (int j = 0; j < numPages; ++j)
{
int index = printer->pageOrder() == QPrinter::FirstPageFirst ? firstPageNumber + j : lastPageNumber - j;
vsizetype index = printer->pageOrder() == QPrinter::FirstPageFirst ? firstPageNumber + j
: lastPageNumber - j;
const VPSheetPtr& sheet = sheets.at(index);
if (sheet.isNull())
@ -3013,13 +3037,13 @@ void VPMainWindow::PrintLayoutTiledSheets(QPrinter *printer, const QList<VPSheet
firstPageNumber = 0;
}
int lastPageNumber = printer->toPage() - 1;
vsizetype lastPageNumber = printer->toPage() - 1;
if (lastPageNumber == -1 || lastPageNumber >= pages.count())
{
lastPageNumber = pages.count() - 1;
}
const int numPages = lastPageNumber - firstPageNumber + 1;
const vsizetype numPages = lastPageNumber - firstPageNumber + 1;
int copyCount = 1;
if (not printer->supportsMultipleCopies())
{
@ -3036,7 +3060,8 @@ void VPMainWindow::PrintLayoutTiledSheets(QPrinter *printer, const QList<VPSheet
{
for (int j = 0; j < numPages; ++j)
{
int index = printer->pageOrder() == QPrinter::FirstPageFirst ? firstPageNumber + j : lastPageNumber - j;
vsizetype index = printer->pageOrder() == QPrinter::FirstPageFirst ? firstPageNumber + j
: lastPageNumber - j;
const VPLayoutPrinterPage &page = pages.at(index);
if (not PrintLayoutTiledSheetPage(printer, painter, page, firstPage))
@ -3287,7 +3312,7 @@ void VPMainWindow::TranslatePieces()
}
//---------------------------------------------------------------------------------------------------------------------
void VPMainWindow::TranslatePieceRelatively(const VPPiecePtr &piece, const QRectF &rect, int selectedPiecesCount,
void VPMainWindow::TranslatePieceRelatively(const VPPiecePtr &piece, const QRectF &rect, vsizetype selectedPiecesCount,
qreal dx, qreal dy)
{
if (not piece.isNull())

View File

@ -506,7 +506,7 @@ private:
auto AddLayoutPieces(const QVector<VLayoutPiece> &pieces) -> bool;
void TranslatePieces();
void TranslatePieceRelatively(const VPPiecePtr &piece, const QRectF &rect, int selectedPiecesCount, qreal dx,
void TranslatePieceRelatively(const VPPiecePtr &piece, const QRectF &rect, vsizetype selectedPiecesCount, qreal dx,
qreal dy);
void RotatePieces();
};

View File

@ -26,6 +26,7 @@
**
*************************************************************************/
#include "vpsettings.h"
#include "../vmisc/compatibility.h"
#include <QMarginsF>
@ -66,14 +67,14 @@ VPSettings::VPSettings(Format format, Scope scope, const QString &organization,
QObject *parent)
: VCommonSettings(format, scope, organization, application, parent)
{
qRegisterMetaTypeStreamOperators<QMarginsF>("QMarginsF");
REGISTER_META_TYPE_STREAM_OPERATORS(QMarginsF)
}
//---------------------------------------------------------------------------------------------------------------------
VPSettings::VPSettings(const QString &fileName, QSettings::Format format, QObject *parent)
: VCommonSettings(fileName, format, parent)
{
qRegisterMetaTypeStreamOperators<QMarginsF>("QMarginsF");
REGISTER_META_TYPE_STREAM_OPERATORS(QMarginsF)
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -44,7 +44,7 @@ template <class T>
auto NumberToString(T number) -> QString
{
const QLocale locale = QLocale::c();
return locale.toString(number, 'g', 12).remove(locale.groupSeparator());
return locale.toString(number, 'g', 12).remove(LocaleGroupSeparator(locale));
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -36,8 +36,8 @@
#include <ciso646>
#include "../vmisc/literals.h"
#include "../vmisc/defglobal.h"
#include "../layout/layoutdef.h"
#include "../qmuparser/qmudef.h"
class VPLayout;
class VPSheet;
@ -91,7 +91,7 @@ void VPLayoutFileWriter::SetAttribute(const QString &name, const T &value)
{
// See specification for xs:decimal
const QLocale locale = QLocale::c();
writeAttribute(name, locale.toString(value).remove(locale.groupSeparator()));
writeAttribute(name, locale.toString(value).remove(LocaleGroupSeparator(locale)));
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -34,6 +34,7 @@
#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"
//---------------------------------------------------------------------------------------------------------------------
TapePreferencesConfigurationPage::TapePreferencesConfigurationPage(QWidget *parent)
@ -163,7 +164,7 @@ void TapePreferencesConfigurationPage::changeEvent(QEvent *event)
//---------------------------------------------------------------------------------------------------------------------
void TapePreferencesConfigurationPage::RetranslateUi()
{
ui->osOptionCheck->setText(tr("With OS options") + QStringLiteral(" (%1)").arg(QLocale().decimalPoint()));
ui->osOptionCheck->setText(tr("With OS options") + QStringLiteral(" (%1)").arg(LocaleDecimalPoint(QLocale())));
{
const auto code = qvariant_cast<QString>(ui->systemCombo->currentData());

View File

@ -69,7 +69,7 @@ void DialogDimensionCustomNames::InitTable(const QMap<MeasurementDimension, Meas
ui->tableWidget->blockSignals(true);
ui->tableWidget->clearContents();
ui->tableWidget->setRowCount(dimensions.size());
ui->tableWidget->setRowCount(static_cast<int>(dimensions.size()));
int row = 0;
QMap<MeasurementDimension, MeasurementDimension_p>::const_iterator i = dimensions.constBegin();

View File

@ -162,7 +162,7 @@ void DialogDimensionLabels::InitTable()
const QVector<qreal> bases = dimension->ValidBases();
ui->tableWidget->setRowCount(bases.size());
ui->tableWidget->setRowCount(static_cast<int>(bases.size()));
const DimesionLabels labels = m_labels.value(type);

View File

@ -217,7 +217,7 @@ auto DialogMeasurementsCSVColumns::ColumnMandatory(int column) const -> bool
if (m_dimensions.size() > 1)
{
mandatory += qMin(m_dimensions.size(), 2);
mandatory += qMin(static_cast<int>(m_dimensions.size()), 2);
}
return static_cast<int>(column) < mandatory;
@ -315,7 +315,7 @@ auto DialogMeasurementsCSVColumns::MinimumColumns() const -> int
if (m_dimensions.size() > 1)
{
mandatory += qMin(m_dimensions.size(), 2);
mandatory += qMin(static_cast<int>(m_dimensions.size()), 2);
}
return mandatory;

View File

@ -34,6 +34,10 @@
class QxtCsvModel;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
class VTextCodec;
#endif
enum class IndividualMeasurementsColumns: qint8
{
Name = 0,
@ -74,7 +78,7 @@ public:
void SetWithHeader(bool withHeader);
void SetSeparator(const QChar &separator);
void SetCodec(QTextCodec *codec);
void SetCodec(VTextCodec *codec);
protected:
void changeEvent(QEvent* event) override;
@ -91,7 +95,7 @@ private:
QString m_fileName;
bool m_withHeader{false};
QChar m_separator{','};
QTextCodec *m_codec{nullptr};
VTextCodec *m_codec{nullptr};
QVector<int> m_columnsMap{};
MeasurementsType m_type;
QList<MeasurementDimension_p> m_dimensions{};
@ -149,7 +153,7 @@ inline void DialogMeasurementsCSVColumns::SetSeparator(const QChar &separator)
}
//---------------------------------------------------------------------------------------------------------------------
inline void DialogMeasurementsCSVColumns::SetCodec(QTextCodec *codec)
inline void DialogMeasurementsCSVColumns::SetCodec(VTextCodec *codec)
{
m_codec = codec;
}

View File

@ -523,7 +523,7 @@ void DialogRestrictDimension::InitTable()
{
MeasurementDimension_p dimension = m_dimensions.at(index);
const QVector<qreal> bases = dimension->ValidBases();
ui->tableWidget->setRowCount(bases.size());
ui->tableWidget->setRowCount(static_cast<int>(bases.size()));
ui->tableWidget->setVerticalHeaderLabels(DimensionLabels(bases, dimension));
}
};
@ -534,7 +534,7 @@ void DialogRestrictDimension::InitTable()
{
MeasurementDimension_p dimension = m_dimensions.at(index);
const QVector<qreal> bases = dimension->ValidBases();
ui->tableWidget->setColumnCount(bases.size());
ui->tableWidget->setColumnCount(static_cast<int>(bases.size()));
ui->tableWidget->setHorizontalHeaderLabels(DimensionLabels(bases, dimension));
}
};

View File

@ -132,7 +132,7 @@ void DialogTapePreferences::Apply()
if (not preferences.isEmpty())
{
const QString text = tr("Followed %n option(s) require restart to take effect: %1.", "",
preferences.size()).arg(preferences.join(QStringLiteral(", ")));
static_cast<int>(preferences.size())).arg(preferences.join(QStringLiteral(", ")));
QMessageBox::information(this, QCoreApplication::applicationName(), text);
}

View File

@ -40,6 +40,10 @@
# include "../vmisc/appimage.h"
#endif // defined(APPIMAGE) && defined(Q_OS_LINUX)
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <xercesc/util/PlatformUtils.hpp>
#endif
auto main(int argc, char *argv[]) -> int
{
#if defined(APPIMAGE) && defined(Q_OS_LINUX)
@ -61,6 +65,12 @@ auto main(int argc, char *argv[]) -> int
VAbstractApplication::WinAttachConsole();
#endif
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
XERCES_CPP_NAMESPACE::XMLPlatformUtils::Initialize();
auto Terminate = qScopeGuard([](){ XERCES_CPP_NAMESPACE::XMLPlatformUtils::Terminate(); });
#endif
#ifndef Q_OS_MAC // supports natively
InitHighDpiScaling(argc, argv);
#endif //Q_OS_MAC

View File

@ -743,7 +743,7 @@ void MApplication::NewLocalSocketConnection()
void MApplication::Clean()
{
// cleanup any deleted main windows first
for (int i = m_mainWindows.count() - 1; i >= 0; --i)
for (vsizetype i = m_mainWindows.count() - 1; i >= 0; --i)
{
if (m_mainWindows.at(i).isNull())
{

View File

@ -79,6 +79,12 @@
# include <QtConcurrent>
#endif
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#ifdef QT_OPENGLWIDGETS_LIB
# include <QOpenGLWidget>
#endif
#endif
#endif /*__cplusplus*/
#endif // STABLE_H

View File

@ -1,9 +1,10 @@
import qbs.FileInfo
import qbs.Utilities
VToolApp {
Depends { name: "buildconfig" }
Depends { name: "ib"; condition: qbs.targetOS.contains("macos") }
Depends { name: "Qt"; submodules: ["widgets", "svg"] }
Depends { name: "Qt"; submodules: ["core", "widgets", "svg"] }
Depends { name: "VMiscLib"; }
Depends { name: "VPatternDBLib"; }
Depends { name: "FervorLib"; }
@ -13,6 +14,7 @@ VToolApp {
Depends { name: "VToolsLib"; }
Depends { name: "ebr" }
Depends { name: "multibundle"; }
Depends { name: "conan.XercesC"; condition: buildconfig.useConanPackages }
name: "Tape"
buildconfig.appTarget: qbs.targetOS.contains("macos") ? "Tape" : "tape"

View File

@ -59,6 +59,12 @@
#include "../vmisc/dialogs/dialogselectlanguage.h"
#include "mapplication.h" // Should be last because of definning qApp
#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
@ -71,7 +77,6 @@
#include <QComboBox>
#include <QProcess>
#include <QtNumeric>
#include <QTextCodec>
#include <QTimer>
#include <chrono>
@ -760,11 +765,11 @@ auto TMainWindow::eventFilter(QObject *object, QEvent *event) -> bool
{
if (VAbstractApplication::VApp()->Settings()->GetOsSeparator())
{
plainTextEdit->insertPlainText(QLocale().decimalPoint());
plainTextEdit->insertPlainText(LocaleDecimalPoint(QLocale()));
}
else
{
plainTextEdit->insertPlainText(QLocale::c().decimalPoint());
plainTextEdit->insertPlainText(LocaleDecimalPoint(QLocale::c()));
}
return true;
}
@ -779,11 +784,11 @@ auto TMainWindow::eventFilter(QObject *object, QEvent *event) -> bool
{
if (VAbstractApplication::VApp()->Settings()->GetOsSeparator())
{
textEdit->insert(QLocale().decimalPoint());
textEdit->insert(LocaleDecimalPoint(QLocale()));
}
else
{
textEdit->insert(QLocale::c().decimalPoint());
textEdit->insert(LocaleDecimalPoint(QLocale::c()));
}
return true;
}
@ -849,7 +854,7 @@ void TMainWindow::ExportToCSVData(const QString &fileName, bool withHeader, int
}
QString error;
csv.toCSV(fileName, error, withHeader, separator, QTextCodec::codecForMib(mib));
csv.toCSV(fileName, error, withHeader, separator, VTextCodec::codecForMib(mib));
}
//---------------------------------------------------------------------------------------------------------------------
@ -1102,12 +1107,12 @@ void TMainWindow::ImportDataFromCSV()
}
columns->SetWithHeader(dialog.IsWithHeader());
columns->SetSeparator(dialog.GetSeparator());
columns->SetCodec(QTextCodec::codecForMib(dialog.GetSelectedMib()));
columns->SetCodec(VTextCodec::codecForMib(dialog.GetSelectedMib()));
if (columns->exec() == QDialog::Accepted)
{
QxtCsvModel csv(fileName, nullptr, dialog.IsWithHeader(), dialog.GetSeparator(),
QTextCodec::codecForMib(dialog.GetSelectedMib()));
VTextCodec::codecForMib(dialog.GetSelectedMib()));
const QVector<int> map = columns->ColumnsMap();
if (m_m->Type() == MeasurementsType::Individual)
@ -1471,7 +1476,7 @@ void TMainWindow::AddKnown()
QScopedPointer<DialogMDataBase> dialog (new DialogMDataBase(m_m->ListKnown(), this));
if (dialog->exec() == QDialog::Accepted)
{
qint32 currentRow;
vsizetype currentRow;
const QStringList list = dialog->GetNewNames();
if (ui->tableWidget->currentRow() == -1)
@ -1514,7 +1519,7 @@ void TMainWindow::AddKnown()
RefreshData();
m_search->RefreshList(ui->lineEditFind->text());
ui->tableWidget->selectRow(currentRow);
ui->tableWidget->selectRow(static_cast<int>(currentRow));
ui->actionExportToCSV->setEnabled(true);
@ -1596,7 +1601,7 @@ void TMainWindow::ImportFromPattern()
measurements = FilterMeasurements(measurements, m_m->ListAll());
qint32 currentRow;
vsizetype currentRow;
if (ui->tableWidget->currentRow() == -1)
{
@ -1622,7 +1627,7 @@ void TMainWindow::ImportFromPattern()
m_search->RefreshList(ui->lineEditFind->text());
ui->tableWidget->selectRow(currentRow);
ui->tableWidget->selectRow(static_cast<int>(currentRow));
MeasurementsWereSaved(false);
}
@ -3020,7 +3025,7 @@ void TMainWindow::ShowHeaderUnits(QTableWidget *table, int column, const QString
SCASSERT(table != nullptr)
QString header = table->horizontalHeaderItem(column)->text();
const int index = header.indexOf(QLatin1String("("));
const auto index = header.indexOf(QLatin1String("("));
if (index != -1)
{
header.remove(index-1, 100);
@ -3187,7 +3192,7 @@ void TMainWindow::RefreshTable(bool freshCall)
const QMap<int, QSharedPointer<VMeasurement> > orderedTable = OrderedMeasurments();
qint32 currentRow = -1;
ui->tableWidget->setRowCount ( orderedTable.size() );
ui->tableWidget->setRowCount ( static_cast<int>(orderedTable.size()) );
for (auto iMap = orderedTable.constBegin(); iMap != orderedTable.constEnd(); ++iMap)
{
const QSharedPointer<VMeasurement> &meash = iMap.value();
@ -3432,7 +3437,7 @@ void TMainWindow::UpdateWindowTitle()
}
else
{
int index = MApplication::VApp()->MainWindows().indexOf(this);
auto index = MApplication::VApp()->MainWindows().indexOf(this);
if (index != -1)
{
showName = tr("untitled %1").arg(index+1);
@ -3483,7 +3488,7 @@ void TMainWindow::UpdateWindowTitle()
auto TMainWindow::ClearCustomName(const QString &name) -> QString
{
QString clear = name;
const int index = clear.indexOf(CustomMSign);
const auto index = clear.indexOf(CustomMSign);
if (index == 0)
{
clear.remove(0, 1);
@ -3606,7 +3611,6 @@ void TMainWindow::ReadSettings()
if (settings->status() == QSettings::NoError)
{
restoreGeometry(settings->GetGeometry());
restoreState(settings->GetWindowState());
restoreState(settings->GetToolbarsState(), AppVersion());
// Text under tool buton icon
@ -3626,7 +3630,6 @@ void TMainWindow::WriteSettings()
{
VTapeSettings *settings = MApplication::VApp()->TapeSettings();
settings->SetGeometry(saveGeometry());
settings->SetWindowState(saveState());
settings->SetToolbarsState(saveState(AppVersion()));
settings->SetTapeSearchOptionMatchCase(m_search->IsMatchCase());
@ -3798,7 +3801,7 @@ void TMainWindow::CreateWindowMenu(QMenu *menu)
TMainWindow *window = windows.at(i);
QString title = QStringLiteral("%1. %2").arg(i+1).arg(window->windowTitle());
const int index = title.lastIndexOf(QLatin1String("[*]"));
const auto index = title.lastIndexOf(QLatin1String("[*]"));
if (index != -1)
{
window->isWindowModified() ? title.replace(index, 3, QChar('*')) : title.replace(index, 3, QString());
@ -4093,11 +4096,11 @@ void TMainWindow::ImportMultisizeMeasurements(const QxtCsvModel &csv, const QVec
}
//---------------------------------------------------------------------------------------------------------------------
auto TMainWindow::ImportMultisizeMeasurement(
const QxtCsvModel &csv, int i, const QVector<int> &map,int dimensionsCount,
QSet<QString> &importedNames) -> TMainWindow::MultisizeMeasurement
auto TMainWindow::ImportMultisizeMeasurement(const QxtCsvModel &csv, int i, const QVector<int> &map,
vsizetype dimensionsCount,
QSet<QString> &importedNames) -> TMainWindow::MultisizeMeasurement
{
const int nameColumn = map.at(static_cast<int>(MultisizeMeasurementsColumns::Name));
const auto nameColumn = map.at(static_cast<int>(MultisizeMeasurementsColumns::Name));
const QString name = csv.text(i, nameColumn).simplified();
if (name.isEmpty())
{
@ -4110,18 +4113,18 @@ auto TMainWindow::ImportMultisizeMeasurement(
importedNames.insert(mName);
measurement.name = mName;
const int baseValueColumn = map.at(static_cast<int>(MultisizeMeasurementsColumns::BaseValue));
const auto baseValueColumn = map.at(static_cast<int>(MultisizeMeasurementsColumns::BaseValue));
measurement.base = ConverToDouble(csv.text(i, baseValueColumn),
tr("Cannot convert base value to double in column 2."));
const int shiftAColumn = map.at(static_cast<int>(MultisizeMeasurementsColumns::ShiftA));
const auto shiftAColumn = map.at(static_cast<int>(MultisizeMeasurementsColumns::ShiftA));
measurement.shiftA = ConverToDouble(csv.text(i, shiftAColumn),
tr("Cannot convert shift value to double in column %1.")
.arg(shiftAColumn));
if (dimensionsCount > 1)
{
const int shiftBColumn = map.at(static_cast<int>(MultisizeMeasurementsColumns::ShiftB));
const auto shiftBColumn = map.at(static_cast<int>(MultisizeMeasurementsColumns::ShiftB));
measurement.shiftB = ConverToDouble(csv.text(i, shiftBColumn),
tr("Cannot convert shift value to double in column %1.")
.arg(shiftBColumn));
@ -4129,7 +4132,7 @@ auto TMainWindow::ImportMultisizeMeasurement(
if (dimensionsCount > 2)
{
const int shiftCColumn = map.at(static_cast<int>(MultisizeMeasurementsColumns::ShiftC));
const auto shiftCColumn = map.at(static_cast<int>(MultisizeMeasurementsColumns::ShiftC));
measurement.shiftC = ConverToDouble(csv.text(i, shiftCColumn),
tr("Cannot convert shift value to double in column %1.")
.arg(shiftCColumn));
@ -4139,7 +4142,7 @@ auto TMainWindow::ImportMultisizeMeasurement(
const bool custom = name.startsWith(CustomMSign);
if (columns > 4 && custom)
{
const int fullNameColumn = map.at(static_cast<int>(MultisizeMeasurementsColumns::FullName));
const auto fullNameColumn = map.at(static_cast<int>(MultisizeMeasurementsColumns::FullName));
if (fullNameColumn >= 0)
{
measurement.fullName = csv.text(i, fullNameColumn).simplified();
@ -4148,7 +4151,7 @@ auto TMainWindow::ImportMultisizeMeasurement(
if (columns > 5 && custom)
{
const int descriptionColumn = map.at(static_cast<int>(MultisizeMeasurementsColumns::Description));
const auto descriptionColumn = map.at(static_cast<int>(MultisizeMeasurementsColumns::Description));
if (descriptionColumn >= 0)
{
measurement.description = csv.text(i, descriptionColumn).simplified();

View File

@ -266,7 +266,7 @@ private:
void ImportIndividualMeasurements(const QxtCsvModel &csv, const QVector<int> &map, bool withHeader);
void ImportMultisizeMeasurements(const QxtCsvModel &csv, const QVector<int> &map, bool withHeader);
auto ImportMultisizeMeasurement(const QxtCsvModel &csv, int i, const QVector<int> &map,
int dimensionsCount, QSet<QString> &importedNames) -> MultisizeMeasurement;
vsizetype dimensionsCount, QSet<QString> &importedNames) -> MultisizeMeasurement;
void SetCurrentPatternUnit();

View File

@ -28,9 +28,6 @@
#include "vtapesettings.h"
#include <QStaticStringData>
#include <QStringData>
#include <QStringDataPtr>
#include <QVariant>
#include <QGlobalStatic>

View File

@ -49,10 +49,13 @@
#include <QMessageBox>
#include <QThread>
#include <QDateTime>
#include <QtXmlPatterns>
#include <QIcon>
#include <Qt>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <QtXmlPatterns>
#endif
#if !defined(BUILD_REVISION) && defined(QBS_BUILD)
#include <vcsRepoState.h>
#define BUILD_REVISION VCS_REPO_STATE_REVISION
@ -265,11 +268,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
vStdOut().flush();
vStdErr().flush();
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
(*VApplication::VApp()->LogFile()) << debugdate << endl;
#else
(*VApplication::VApp()->LogFile()) << debugdate << Qt::endl;
#endif
}
if (isGuiThread)

View File

@ -36,7 +36,12 @@
#include "../vmisc/dialogs/dialogexporttocsv.h"
#include "../vlayout/vlayoutgenerator.h"
#include <QDebug>
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include "../vmisc/vtextcodec.h"
#else
#include <QTextCodec>
#endif
VCommandLinePtr VCommandLine::instance = nullptr; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
@ -736,7 +741,7 @@ void VCommandLine::InitCommandLineOptions()
"Qt. Default value depend from system. On Windows, the codec will be based on a system locale. On Unix "
"systems, the codec will might fall back to using the iconv library if no builtin codec for the locale can be "
"found. Valid values for this installation:") + DialogExportToCSV::MakeHelpCodecsList(),
translate("VCommandLine", "Codec name"), QString(QTextCodec::codecForLocale()->name())},
translate("VCommandLine", "Codec name"), QString(VTextCodec::codecForLocale()->name())},
{LONG_OPTION_CSVSEPARATOR,
translate("VCommandLine", "Specify csv separator character. Default value is '%1'. Valid characters:")
.arg(VCommonSettings::GetDefCSVSeparator()) + DialogExportToCSV::MakeHelpSeparatorList(),

View File

@ -37,7 +37,12 @@
//---------------------------------------------------------------------------------------------------------------------
VFormulaProperty::VFormulaProperty(const QString &name)
: VProperty(name, static_cast<QVariant::Type>(VFormula::FormulaTypeId()))
: VProperty(name,
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
static_cast<QMetaType::Type>(VFormula::FormulaTypeId()))
#else
static_cast<QVariant::Type>(VFormula::FormulaTypeId()))
#endif
{
d_ptr->type = VPE::Property::Complex;
@ -183,11 +188,19 @@ void VFormulaProperty::SetFormula(const VFormula &formula)
QVariant value;
value.setValue(formula);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
value.convert(QMetaType(VFormula::FormulaTypeId()));
#else
value.convert(VFormula::FormulaTypeId());
#endif
VProperty::d_ptr->VariantValue = value;
QVariant tmpFormula(formula.GetFormula());
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
tmpFormula.convert(QMetaType(QMetaType::QString));
#else
tmpFormula.convert(QVariant::String);
#endif
VProperty::d_ptr->Children.at(0)->setValue(tmpFormula);

View File

@ -737,7 +737,7 @@ void VToolOptionsPropertyBrowser::AddPropertyLineType(Tool *i, const QString &pr
{
auto *lineTypeProperty = new VPE::VLineTypeProperty(propertyName);
lineTypeProperty->setStyles(styles);
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(styles, i->getLineType());
const auto index = VPE::VLineTypeProperty::IndexOfStyle(styles, i->getLineType());
if (index == -1)
{
qWarning()<<"Can't find line style" << i->getLineType()<<"in list";
@ -753,7 +753,7 @@ void VToolOptionsPropertyBrowser::AddPropertyCurvePenStyle(Tool *i, const QStrin
{
auto *penStyleProperty = new VPE::VLineTypeProperty(propertyName);
penStyleProperty->setStyles(styles);
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(styles, i->GetPenStyle());
const auto index = VPE::VLineTypeProperty::IndexOfStyle(styles, i->GetPenStyle());
if (index == -1)
{
qWarning()<<"Can't find pen style" << i->getLineType()<<"in list";
@ -769,7 +769,7 @@ void VToolOptionsPropertyBrowser::AddPropertyLineColor(Tool *i, const QString &p
{
auto *lineColorProperty = new VPE::VLineColorProperty(propertyName);
lineColorProperty->setColors(colors);
const qint32 index = VPE::VLineColorProperty::IndexOfColor(colors, i->GetLineColor());
const auto index = VPE::VLineColorProperty::IndexOfColor(colors, i->GetLineColor());
if (index == -1)
{
qWarning()<<"Can't find line style" << i->GetLineColor()<<"in list";
@ -3348,12 +3348,12 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolEndLine()
m_idToProperty[AttrName]->setValue(i->name());
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
const auto index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
m_idToProperty[AttrTypeLine]->setValue(index);
}
{
const qint32 index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
const auto index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
m_idToProperty[AttrLineColor]->setValue(index);
}
@ -3379,12 +3379,12 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolAlongLine()
m_idToProperty[AttrName]->setValue(i->name());
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
const auto index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
m_idToProperty[AttrTypeLine]->setValue(index);
}
{
const qint32 index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
const auto index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
m_idToProperty[AttrLineColor]->setValue(index);
}
@ -3423,12 +3423,12 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolArc()
m_idToProperty[AttrAngle2]->setValue(valueSecondAngle);
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(CurvePenStylesPics(), i->GetPenStyle());
const auto index = VPE::VLineTypeProperty::IndexOfStyle(CurvePenStylesPics(), i->GetPenStyle());
m_idToProperty[AttrPenStyle]->setValue(index);
}
{
const qint32 index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
const auto index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
m_idToProperty[AttrColor]->setValue(index);
}
@ -3465,12 +3465,12 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolArcWithLength()
m_idToProperty[AttrLength]->setValue(valueLength);
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(CurvePenStylesPics(), i->GetPenStyle());
const auto index = VPE::VLineTypeProperty::IndexOfStyle(CurvePenStylesPics(), i->GetPenStyle());
m_idToProperty[AttrPenStyle]->setValue(index);
}
{
const qint32 index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
const auto index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
m_idToProperty[AttrColor]->setValue(index);
}
@ -3499,12 +3499,12 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolBisector()
m_idToProperty[AttrLength]->setValue(valueFormula);
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
const auto index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
m_idToProperty[AttrTypeLine]->setValue(index);
}
{
const qint32 index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
const auto index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
m_idToProperty[AttrLineColor]->setValue(index);
}
@ -3625,12 +3625,12 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolHeight()
m_idToProperty[AttrName]->setValue(i->name());
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
const auto index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
m_idToProperty[AttrTypeLine]->setValue(index);
}
{
const qint32 index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
const auto index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
m_idToProperty[AttrLineColor]->setValue(index);
}
@ -3655,12 +3655,12 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolLine()
auto *i = qgraphicsitem_cast<VToolLine *>(m_currentItem);
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
const auto index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
m_idToProperty[AttrTypeLine]->setValue(index);
}
{
const qint32 index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
const auto index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
m_idToProperty[AttrLineColor]->setValue(index);
}
@ -3715,12 +3715,12 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolNormal()
m_idToProperty[AttrAngle]->setValue( i->GetAngle());
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
const auto index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
m_idToProperty[AttrTypeLine]->setValue(index);
}
{
const qint32 index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
const auto index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
m_idToProperty[AttrLineColor]->setValue(index);
}
@ -3899,12 +3899,12 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolShoulderPoint()
m_idToProperty[AttrName]->setValue(i->name());
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
const auto index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
m_idToProperty[AttrTypeLine]->setValue(index);
}
{
const qint32 index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
const auto index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
m_idToProperty[AttrLineColor]->setValue(index);
}
@ -3968,7 +3968,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSpline()
m_idToProperty[AttrLength2]->setValue(length2);
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(CurvePenStylesPics(), i->GetPenStyle());
const auto index = VPE::VLineTypeProperty::IndexOfStyle(CurvePenStylesPics(), i->GetPenStyle());
m_idToProperty[AttrPenStyle]->setValue(index);
}
@ -3992,7 +3992,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCubicBezier()
m_idToProperty[AttrName]->setValue(i->name());
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(CurvePenStylesPics(), i->GetPenStyle());
const auto index = VPE::VLineTypeProperty::IndexOfStyle(CurvePenStylesPics(), i->GetPenStyle());
m_idToProperty[AttrPenStyle]->setValue(index);
}
@ -4032,7 +4032,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSplinePath()
m_idToProperty[AttrName]->setValue(i->name());
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(CurvePenStylesPics(), i->GetPenStyle());
const auto index = VPE::VLineTypeProperty::IndexOfStyle(CurvePenStylesPics(), i->GetPenStyle());
m_idToProperty[AttrPenStyle]->setValue(index);
}
@ -4056,7 +4056,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCubicBezierPath()
m_idToProperty[AttrName]->setValue(i->name());
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(CurvePenStylesPics(), i->GetPenStyle());
const auto index = VPE::VLineTypeProperty::IndexOfStyle(CurvePenStylesPics(), i->GetPenStyle());
m_idToProperty[AttrPenStyle]->setValue(index);
}
@ -4105,12 +4105,12 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolLineIntersectAxis()
m_idToProperty[AttrName]->setValue(i->name());
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
const auto index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
m_idToProperty[AttrTypeLine]->setValue(index);
}
{
const qint32 index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
const auto index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
m_idToProperty[AttrLineColor]->setValue(index);
}
@ -4140,12 +4140,12 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCurveIntersectAxis()
m_idToProperty[AttrName]->setValue(i->name());
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
const auto index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
m_idToProperty[AttrTypeLine]->setValue(index);
}
{
const qint32 index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
const auto index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
m_idToProperty[AttrLineColor]->setValue(index);
}
@ -4264,7 +4264,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolEllipticalArc()
valueFormulaRotationAngle.setValue(i->GetFormulaRotationAngle());
m_idToProperty[AttrRotationAngle]->setValue(valueFormulaRotationAngle);
const qint32 index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
const auto index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
m_idToProperty[AttrColor]->setValue(index);
QVariant valueCenterPoint;

View File

@ -35,6 +35,7 @@
#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 <QDir>
#include <QDirIterator>
@ -281,7 +282,7 @@ void PreferencesConfigurationPage::InitUnits()
//---------------------------------------------------------------------------------------------------------------------
void PreferencesConfigurationPage::RetranslateUi()
{
ui->osOptionCheck->setText(tr("With OS options") + QStringLiteral(" (%1)").arg(QLocale().decimalPoint()));
ui->osOptionCheck->setText(tr("With OS options") + QStringLiteral(" (%1)").arg(LocaleDecimalPoint(QLocale())));
{
ui->unitCombo->blockSignals(true);

View File

@ -147,11 +147,11 @@ auto DialogFinalMeasurements::eventFilter(QObject *object, QEvent *event) -> boo
{
if (VAbstractApplication::VApp()->Settings()->GetOsSeparator())
{
textEdit->insert(QLocale().decimalPoint());
textEdit->insert(LocaleDecimalPoint(QLocale()));
}
else
{
textEdit->insert(QLocale::c().decimalPoint());
textEdit->insert(LocaleDecimalPoint(QLocale::c()));
}
return true;
}
@ -483,7 +483,7 @@ void DialogFinalMeasurements::FillFinalMeasurements(bool freshCall)
ui->tableWidget->blockSignals(true);
ui->tableWidget->clearContents();
ui->tableWidget->setRowCount(m_measurements.size());
ui->tableWidget->setRowCount(static_cast<int>(m_measurements.size()));
for (int i=0; i < m_measurements.size(); ++i)
{
const VFinalMeasurement &m = m_measurements.at(i);

View File

@ -177,7 +177,7 @@ void DialogHistory::FillTable()
QVector<VToolRecord> history = m_doc->getLocalHistory();
qint32 currentRow = -1;
qint32 count = 0;
ui->tableWidget->setRowCount(history.size());//Make row count max possible number
ui->tableWidget->setRowCount(static_cast<int>(history.size()));//Make row count max possible number
std::function<HistoryRecord (const VToolRecord &tool)> CreateRecord = [this](const VToolRecord &tool)
{

View File

@ -203,7 +203,7 @@ void DialogIncrements::FillTable(const QMap<QString, T> &varTable, QTableWidget
i.next();
qreal length = *i.value()->GetValue();
currentRow++;
table->setRowCount ( varTable.size() );
table->setRowCount ( static_cast<int>(varTable.size()) );
auto *item = new QTableWidgetItem(i.key());
item->setTextAlignment(Qt::AlignLeft);
@ -349,7 +349,7 @@ auto DialogIncrements::GetCustomName() const -> QString
auto DialogIncrements::ClearIncrementName(const QString &name) -> QString
{
QString clear = name;
const int index = clear.indexOf(CustomIncrSign);
const auto index = clear.indexOf(CustomIncrSign);
if (index == 0)
{
clear.remove(0, 1);
@ -1315,7 +1315,7 @@ void DialogIncrements::FillIncrementsTable(QTableWidget *table,
qint32 currentRow = -1;
QMapIterator<quint32, QString> iMap(map);
table->setRowCount ( map.size() );
table->setRowCount ( static_cast<int>(map.size()) );
while (iMap.hasNext())
{
iMap.next();
@ -1933,11 +1933,11 @@ auto DialogIncrements::eventFilter(QObject *object, QEvent *event) -> bool
{
if (VAbstractApplication::VApp()->Settings()->GetOsSeparator())
{
textEdit->insert(QLocale().decimalPoint());
textEdit->insert(LocaleDecimalPoint(QLocale()));
}
else
{
textEdit->insert(QLocale::c().decimalPoint());
textEdit->insert(LocaleDecimalPoint(QLocale::c()));
}
return true;
}

View File

@ -148,7 +148,7 @@ void DialogPreferences::Apply()
if (not preferences.isEmpty())
{
const QString text = tr("Followed %n option(s) require restart to take effect: %1.", "",
preferences.size()).arg(preferences.join(QStringLiteral(", ")));
static_cast<int>(preferences.size())).arg(preferences.join(QStringLiteral(", ")));
QMessageBox::information(this, QCoreApplication::applicationName(), text);
}

View File

@ -732,7 +732,7 @@ void VWidgetBackgroundImages::FillTable(const QVector<VBackgroundPatternImage> &
ui->tableWidget->clear();
ui->tableWidget->setColumnCount(3);
ui->tableWidget->setRowCount(images.size());
ui->tableWidget->setRowCount(static_cast<int>(images.size()));
qint32 currentRow = -1;
auto ReadOnly = [](QTableWidgetItem *item)

View File

@ -173,7 +173,7 @@ void VWidgetDetails::FillTable(const QHash<quint32, VPiece> *details)
ui->tableWidget->clearContents();
ui->tableWidget->setColumnCount(2);
ui->tableWidget->setRowCount(details->size());
ui->tableWidget->setRowCount(static_cast<int>(details->size()));
qint32 currentRow = -1;
auto i = details->constBegin();
while (i != details->constEnd())

View File

@ -338,7 +338,7 @@ void VWidgetGroups::FillTable(QMap<quint32, VGroupData> groups)
ui->tableWidget->clear();
ui->tableWidget->setColumnCount(2);
ui->tableWidget->setRowCount(groups.size());
ui->tableWidget->setRowCount(static_cast<int>(groups.size()));
qint32 currentRow = -1;
auto i = groups.constBegin();
while (i != groups.constEnd())

View File

@ -43,6 +43,10 @@
# include "../vmisc/appimage.h"
#endif // defined(APPIMAGE) && defined(Q_OS_LINUX)
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <xercesc/util/PlatformUtils.hpp>
#endif
//---------------------------------------------------------------------------------------------------------------------
auto main(int argc, char *argv[]) -> int
@ -69,14 +73,20 @@ auto main(int argc, char *argv[]) -> int
#endif
// Need to internally move a node inside a piece main path
qRegisterMetaTypeStreamOperators<VPieceNode>("VPieceNode");
REGISTER_META_TYPE_STREAM_OPERATORS(VPieceNode);
// Need to internally move a node inside a custom seam allowance path
qRegisterMetaTypeStreamOperators<CustomSARecord>("CustomSARecord");
REGISTER_META_TYPE_STREAM_OPERATORS(CustomSARecord);
#ifndef Q_OS_MAC // supports natively
InitHighDpiScaling(argc, argv);
#endif //Q_OS_MAC
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
XERCES_CPP_NAMESPACE::XMLPlatformUtils::Initialize();
auto Terminate = qScopeGuard([](){ XERCES_CPP_NAMESPACE::XMLPlatformUtils::Terminate(); });
#endif
VApplication app(argc, argv);
app.InitOptions();

View File

@ -49,13 +49,20 @@
#include "../ifc/xml/vvitconverter.h"
#include "../vwidgets/vwidgetpopup.h"
#include "../vwidgets/vmaingraphicsscene.h"
#include "../vtools/undocommands/undogroup.h"
#include "../vformat/vpatternrecipe.h"
#include "../vlayout/dialogs/watermarkwindow.h"
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include "../vmisc/vtextcodec.h"
#else
#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)
#include "../vlayout/vlayoutexporter.h"
#include "../vwidgets/vgraphicssimpletextitem.h"
#include "../vlayout/dialogs/dialoglayoutscale.h"
@ -183,20 +190,22 @@
#include <QShowEvent>
#include <QScrollBar>
#include <QFileDialog>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <QSourceLocation>
#endif
#include <QUndoStack>
#include <QAction>
#include <QProcess>
#include <QSettings>
#include <QTimer>
#include <QtGlobal>
#include <QDesktopWidget>
#include <QDesktopServices>
#include <chrono>
#include <thread>
#include <QFileSystemWatcher>
#include <QComboBox>
#include <QTextCodec>
#include <QDoubleSpinBox>
#include <QProgressBar>
#include <QGlobalStatic>
@ -1919,7 +1928,7 @@ void MainWindow::ExportToCSVData(const QString &fileName, bool withHeader, int m
SavePreviewCalculation(true);
QString error;
csv.toCSV(fileName, error, withHeader, separator, QTextCodec::codecForMib(mib));
csv.toCSV(fileName, error, withHeader, separator, VTextCodec::codecForMib(mib));
}
//---------------------------------------------------------------------------------------------------------------------
@ -2693,7 +2702,7 @@ auto MainWindow::FullParsePattern() -> bool
{
if (VAbstractValApplication::VApp()->getOpeningPattern())
{
futureTestUniqueId = QtConcurrent::run(static_cast<VDomDocument *>(doc), &VDomDocument::TestUniqueId); // clazy:exclude=unneeded-cast
futureTestUniqueId = QtConcurrent::run([this](){doc->TestUniqueId();});
}
SetEnabledGUI(true);
@ -2898,36 +2907,71 @@ void MainWindow::ToolBarTools()
QList<QKeySequence> zoomInShortcuts;
zoomInShortcuts.append(QKeySequence(QKeySequence::ZoomIn));
zoomInShortcuts.append(QKeySequence(Qt::ControlModifier + Qt::Key_Plus + Qt::KeypadModifier));
zoomInShortcuts.append(
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QKeySequence(QKeyCombination(Qt::ControlModifier), Qt::Key_Plus | Qt::KeypadModifier));
#else
QKeySequence(Qt::ControlModifier + Qt::Key_Plus + Qt::KeypadModifier));
#endif
ui->actionZoomIn->setShortcuts(zoomInShortcuts);
connect(ui->actionZoomIn, &QAction::triggered, ui->view, &VMainGraphicsView::ZoomIn);
QList<QKeySequence> zoomOutShortcuts;
zoomOutShortcuts.append(QKeySequence(QKeySequence::ZoomOut));
zoomOutShortcuts.append(QKeySequence(Qt::ControlModifier + Qt::Key_Minus + Qt::KeypadModifier));
zoomOutShortcuts.append(
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QKeySequence(QKeyCombination(Qt::ControlModifier), Qt::Key_Minus | Qt::KeypadModifier));
#else
QKeySequence(Qt::ControlModifier + Qt::Key_Minus + Qt::KeypadModifier));
#endif
ui->actionZoomOut->setShortcuts(zoomOutShortcuts);
connect(ui->actionZoomOut, &QAction::triggered, ui->view, &VMainGraphicsView::ZoomOut);
QList<QKeySequence> zoomOriginalShortcuts;
zoomOriginalShortcuts.append(QKeySequence(Qt::ControlModifier + Qt::Key_0));
zoomOriginalShortcuts.append(QKeySequence(Qt::ControlModifier + Qt::Key_0 + Qt::KeypadModifier));
zoomOriginalShortcuts.append(
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QKeySequence(Qt::ControlModifier | Qt::Key_0));
#else
QKeySequence(Qt::ControlModifier + Qt::Key_0));
#endif
zoomOriginalShortcuts.append(
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QKeySequence(QKeyCombination(Qt::ControlModifier), Qt::Key_0 | Qt::KeypadModifier));
#else
QKeySequence(Qt::ControlModifier + Qt::Key_0 + Qt::KeypadModifier));
#endif
ui->actionZoomOriginal->setShortcuts(zoomOriginalShortcuts);
connect(ui->actionZoomOriginal, &QAction::triggered, ui->view, &VMainGraphicsView::ZoomOriginal);
QList<QKeySequence> zoomFitBestShortcuts;
zoomFitBestShortcuts.append(QKeySequence(Qt::ControlModifier + Qt::Key_Equal));
zoomFitBestShortcuts.append(
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QKeySequence(Qt::ControlModifier | Qt::Key_Equal));
#else
QKeySequence(Qt::ControlModifier + Qt::Key_Equal));
#endif
ui->actionZoomFitBest->setShortcuts(zoomFitBestShortcuts);
connect(ui->actionZoomFitBest, &QAction::triggered, ui->view, &VMainGraphicsView::ZoomFitBest);
QList<QKeySequence> zoomFitBestCurrentShortcuts;
zoomFitBestCurrentShortcuts.append(QKeySequence(Qt::ControlModifier + Qt::Key_M));
zoomFitBestCurrentShortcuts.append(
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QKeySequence(Qt::ControlModifier | Qt::Key_M));
#else
QKeySequence(Qt::ControlModifier + Qt::Key_M));
#endif
ui->actionZoomFitBestCurrent->setShortcuts(zoomFitBestCurrentShortcuts);
connect(ui->actionZoomFitBestCurrent, &QAction::triggered, this, &MainWindow::ZoomFitBestCurrent);
connect(ui->actionPreviousPatternPiece, &QAction::triggered, this, &MainWindow::PreviousPatternPiece);
connect(ui->actionNextPatternPiece, &QAction::triggered, this, &MainWindow::NextPatternPiece);
ui->actionIncreaseLabelFont->setShortcut(QKeySequence(Qt::ShiftModifier + Qt::Key_Plus));
ui->actionIncreaseLabelFont->setShortcut(
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QKeySequence(Qt::ShiftModifier | Qt::Key_Plus));
#else
QKeySequence(Qt::ShiftModifier + Qt::Key_Plus));
#endif
connect(ui->actionIncreaseLabelFont, &QAction::triggered, this, [this]()
{
VValentinaSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
@ -2943,7 +2987,12 @@ void MainWindow::ToolBarTools()
}
});
ui->actionDecreaseLabelFont->setShortcut(QKeySequence(Qt::ShiftModifier + Qt::Key_Minus));
ui->actionDecreaseLabelFont->setShortcut(
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QKeySequence(Qt::ShiftModifier | Qt::Key_Minus));
#else
QKeySequence(Qt::ShiftModifier + Qt::Key_Minus));
#endif
connect(ui->actionDecreaseLabelFont, &QAction::triggered, this, [this]()
{
VValentinaSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
@ -2959,7 +3008,12 @@ void MainWindow::ToolBarTools()
}
});
ui->actionOriginalLabelFont->setShortcut(QKeySequence(Qt::ShiftModifier + Qt::Key_0));
ui->actionOriginalLabelFont->setShortcut(
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QKeySequence(Qt::ShiftModifier | Qt::Key_0));
#else
QKeySequence(Qt::ShiftModifier + Qt::Key_0));
#endif
connect(ui->actionOriginalLabelFont, &QAction::triggered, this, [this]()
{
VValentinaSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
@ -2975,7 +3029,12 @@ void MainWindow::ToolBarTools()
}
});
ui->actionHideLabels->setShortcut(QKeySequence(Qt::AltModifier + Qt::Key_L));
ui->actionHideLabels->setShortcut(
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QKeySequence(Qt::AltModifier | Qt::Key_L));
#else
QKeySequence(Qt::AltModifier + Qt::Key_L));
#endif
ui->actionHideLabels->setChecked(VAbstractValApplication::VApp()->ValentinaSettings()->GetHideLabels());
connect(ui->actionHideLabels, &QAction::triggered, this, [this](bool checked)
{
@ -5145,7 +5204,6 @@ void MainWindow::ReadSettings()
if (settings->status() == QSettings::NoError)
{
restoreGeometry(settings->GetGeometry());
restoreState(settings->GetWindowState());
restoreState(settings->GetToolbarsState(), AppVersion());
m_groupsActive = settings->IsDockWidgetGroupsActive();
@ -5190,7 +5248,6 @@ void MainWindow::WriteSettings()
VValentinaSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
settings->SetGeometry(saveGeometry());
settings->SetWindowState(saveState());
settings->SetToolbarsState(saveState(AppVersion()));
settings->SetDockWidgetGroupsActive(ui->dockWidgetGroups->isVisible());
@ -6203,7 +6260,8 @@ void MainWindow::ExportLayoutAs()
try
{
m_dialogSaveLayout = QSharedPointer<DialogSaveLayout>(
new DialogSaveLayout(m_layoutSettings->LayoutScenes().size(), Draw::Layout, FileName(), this));
new DialogSaveLayout(static_cast<int>(m_layoutSettings->LayoutScenes().size()), Draw::Layout, FileName(),
this));
if (m_dialogSaveLayout->exec() == QDialog::Rejected)
{
@ -6616,8 +6674,8 @@ auto MainWindow::DoExport(const VCommandLinePtr &expParams) -> bool
try
{
m_dialogSaveLayout = QSharedPointer<DialogSaveLayout>(
new DialogSaveLayout(m_layoutSettings->LayoutScenes().size(),
Draw::Layout, expParams->OptBaseName(), this));
new DialogSaveLayout(static_cast<int>(m_layoutSettings->LayoutScenes().size()),
Draw::Layout, expParams->OptBaseName(), this));
m_dialogSaveLayout->SetDestinationPath(expParams->OptDestinationPath());
m_dialogSaveLayout->SelectFormat(static_cast<LayoutExportFormats>(expParams->OptExportType()));
m_dialogSaveLayout->SetBinaryDXFFormat(expParams->IsBinaryDXF());
@ -6679,10 +6737,10 @@ auto MainWindow::DoFMExport(const VCommandLinePtr &expParams) -> bool
}
const QString codecName = expParams->OptCSVCodecName();
int mib = QTextCodec::codecForLocale()->mibEnum();
int mib = VTextCodec::codecForLocale()->mibEnum();
if (not codecName.isEmpty())
{
if (QTextCodec *codec = QTextCodec::codecForName(codecName.toLatin1()))
if (VTextCodec *codec = VTextCodec::codecForName(codecName.toLatin1()))
{
mib = codec->mibEnum();
}

View File

@ -48,6 +48,12 @@
#include "../vmisc/vvalentinasettings.h"
#include "../vdxf/libdxfrw/drw_base.h"
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include "../vmisc/vtextcodec.h"
#else
#include <QTextCodec>
#endif
#include <QFileDialog>
#include <QFileInfo>
#include <QGraphicsScene>
@ -249,7 +255,7 @@ bool MainWindowsNoGUI::GenerateLayout(VLayoutGenerator& lGenerator)
int rotatate = 1;
lGenerator.SetShift(-1); // Trigger first shift calulation
lGenerator.SetRotate(false);
int papersCount = INT_MAX;
vsizetype papersCount = INT_MAX;
qreal efficiency = 0;
bool hasResult = false;
@ -913,7 +919,7 @@ QVector<VLayoutPiece> MainWindowsNoGUI::PrepareDetailsForLayout(const QVector<De
return VLayoutPiece::Create(data.piece, data.id, tool->getData());
};
QProgressDialog progress(tr("Preparing details for layout"), QString(), 0, details.size());
QProgressDialog progress(tr("Preparing details for layout"), QString(), 0, static_cast<int>(details.size()));
progress.setWindowModality(Qt::ApplicationModal);
QFutureWatcher<VLayoutPiece> futureWatcher;
@ -1307,7 +1313,7 @@ bool MainWindowsNoGUI::ExportFMeasurementsToCSVData(const QString &fileName, boo
}
QString error;
const bool success = csv.toCSV(fileName, error, withHeader, separator, QTextCodec::codecForMib(mib));
const bool success = csv.toCSV(fileName, error, withHeader, separator, VTextCodec::codecForMib(mib));
if (not success)
{

View File

@ -79,6 +79,12 @@
# include <QtConcurrent>
#endif
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#ifdef QT_OPENGLWIDGETS_LIB
# include <QOpenGLWidget>
#endif
#endif
#endif /*__cplusplus*/
#endif // STABLE_H

View File

@ -1,9 +1,10 @@
import qbs.FileInfo
import qbs.Utilities
VToolApp {
Depends { name: "buildconfig" }
Depends { name: "ib"; condition: qbs.targetOS.contains("macos") }
Depends { name: "Qt"; submodules: ["widgets", "svg", "xmlpatterns", "concurrent"] }
Depends { name: "Qt"; submodules: ["core", "widgets", "svg", "concurrent"] }
Depends { name: "VPatternDBLib"; }
Depends { name: "VWidgetsLib"; }
Depends { name: "FervorLib"; }
@ -13,7 +14,10 @@ VToolApp {
Depends { name: "VFormatLib"; }
Depends { name: "VMiscLib"; }
primaryApp: true
Depends {
name: "Qt.xmlpatterns"
condition: Utilities.versionCompare(Qt.core.version, "6") < 0
}
Depends {
name: "Qt.winextras"
@ -22,6 +26,8 @@ VToolApp {
required: false
}
primaryApp: true
name: "Valentina"
buildconfig.appTarget: qbs.targetOS.contains("macos") ? "Valentina" : "valentina"
targetName: buildconfig.appTarget

View File

@ -1025,9 +1025,12 @@ void VPattern::ParseDetailInternals(const QDomElement &domElement, VPiece &detai
// TODO. Delete if minimal supported version is 0.4.0
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 4, 0),
"Time to refactor the code.");
const bool closed = GetParametrUInt(domElement, AttrClosed, QChar('1'));
const qreal width = GetParametrDouble(domElement, AttrWidth, QStringLiteral("0.0"));
futurePathV1 = QtConcurrent::run(this, &VPattern::ParseDetailNodes, element, width, closed);
futurePathV1 = QtConcurrent::run([this, domElement, element]()
{
const bool closed = GetParametrUInt(domElement, AttrClosed, QChar('1'));
const qreal width = GetParametrDouble(domElement, AttrWidth, QStringLiteral("0.0"));
return ParseDetailNodes(element, width, closed);
});
}
else
{
@ -1035,16 +1038,22 @@ void VPattern::ParseDetailInternals(const QDomElement &domElement, VPiece &detai
}
break;
case 1:// TagData
futurePPData = QtConcurrent::run(this, &VPattern::ParsePieceDataTag, element,
detail.GetPieceLabelData());
futurePPData = QtConcurrent::run([this, element, detail]()
{
return ParsePieceDataTag(element, detail.GetPieceLabelData());
});
break;
case 2:// TagPatternInfo
futurePatternInfo = QtConcurrent::run(this, &VPattern::ParsePiecePatternInfo, element,
detail.GetPatternLabelData());
futurePatternInfo = QtConcurrent::run([this, element, detail]()
{
return ParsePiecePatternInfo(element, detail.GetPatternLabelData());
});
break;
case 3:// TagGrainline
futureGGeometry = QtConcurrent::run(this, &VPattern::ParsePieceGrainline, element,
detail.GetGrainlineGeometry());
futureGGeometry = QtConcurrent::run([this, element, detail]()
{
return ParsePieceGrainline(element, detail.GetGrainlineGeometry());
});
break;
case 4:// VToolSeamAllowance::TagCSA
futureRecords = QtConcurrent::run(&VPattern::ParsePieceCSARecords, element);
@ -1537,7 +1546,7 @@ QString VPattern::GetLabelBase(quint32 index) const
QString base;
const int count = qFloor(index/static_cast<quint32>(alphabet.size()));
const int number = static_cast<int>(index) - alphabet.size() * count;
const int number = static_cast<int>(index) - static_cast<int>(alphabet.size()) * count;
int i = 0;
do
{
@ -1638,7 +1647,13 @@ void VPattern::ParseToolAlongLine(VMainGraphicsScene *scene, QDomElement &domEle
try
{
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wnoexcept")
VToolAlongLineInitData initData;
QT_WARNING_POP
initData.scene = scene;
initData.doc = this;
initData.data = data;
@ -2328,7 +2343,13 @@ void VPattern::ParseToolCurveIntersectAxis(VMainGraphicsScene *scene, QDomElemen
try
{
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wnoexcept")
VToolCurveIntersectAxisInitData initData;
QT_WARNING_POP
initData.scene = scene;
initData.doc = this;
initData.data = data;
@ -2452,7 +2473,13 @@ void VPattern::ParseToolPointOfIntersectionCurves(VMainGraphicsScene *scene, QDo
try
{
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wnoexcept")
VToolPointOfIntersectionCurvesInitData initData;
QT_WARNING_POP
initData.scene = scene;
initData.doc = this;
initData.data = data;
@ -4229,13 +4256,13 @@ void VPattern::SetIncrementSpecialUnits(const QString &name, bool special)
//---------------------------------------------------------------------------------------------------------------------
void VPattern::ReplaceNameInFormula(QVector<VFormulaField> &expressions, const QString &name, const QString &newName)
{
const int bias = name.length() - newName.length();
const auto bias = name.length() - newName.length();
for(int i = 0; i < expressions.size(); ++i)
{
if (expressions.at(i).expression.indexOf(name) != -1)
{
QMap<int, QString> tokens;
QMap<vsizetype, QString> tokens;
// Eval formula
try
@ -4256,7 +4283,7 @@ void VPattern::ReplaceNameInFormula(QVector<VFormulaField> &expressions, const Q
continue;
}
QList<int> tKeys = tokens.keys();// Take all tokens positions
QList<vsizetype> tKeys = tokens.keys();// Take all tokens positions
QString newFormula = expressions.at(i).expression;
for (int i = 0; i < tKeys.size(); ++i)

View File

@ -33,11 +33,7 @@
#include <QMutex>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QStaticStringData>
#include <QStringData>
#include <QStringDataPtr>
#include <QStringList>
#include <QStringRef>
#include <QVariant>
#include <QXmlStreamAttributes>
#include <QtDebug>

View File

@ -77,6 +77,12 @@
# include <QtConcurrent>
#endif
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#ifdef QT_OPENGLWIDGETS_LIB
# include <QOpenGLWidget>
#endif
#endif
#endif/*__cplusplus*/
#endif // STABLE_H

View File

@ -1,7 +1,29 @@
import qbs.Utilities
VLib {
Depends { name: "Qt"; submodules: ["gui", "xml", "svg", "xmlpatterns", "concurrent"] }
Depends { name: "Qt"; submodules: ["core", "gui", "xml", "svg", "concurrent"] }
Depends { name: "VMiscLib" }
Depends {
name: "Qt.xmlpatterns"
condition: Utilities.versionCompare(Qt.core.version, "6") < 0
}
Depends {
name: "xerces-c"
condition: !buildconfig.useConanPackages
}
Depends {
name: "conan.XercesC"
condition: buildconfig.useConanPackages
}
Properties {
condition: buildconfig.useConan && (qbs.targetOS.contains("macos") || qbs.targetOS.contains("windows"))
conan.XercesC.installLib: true
}
name: "IFCLib"
files: [
"ifcdef.h",
@ -31,7 +53,7 @@ VLib {
"vexceptionwrongid.cpp",
"vexceptionundo.cpp",
"vexceptioninvalidnotch.cpp",
"vexceptioninvalidhistory.cpp",
"vexceptioninvalidhistory.cpp"
]
}
@ -44,6 +66,8 @@ VLib {
"vbackgroundpatternimage.h",
"vdomdocument.h",
"vlayoutconverter.h",
"vparsererrorhandler.cpp",
"vparsererrorhandler.h",
"vpatternconverter.h",
"vpatternimage.h",
"vtoolrecord.h",
@ -81,6 +105,7 @@ VLib {
Depends { name: "cpp" }
Depends { name: "Qt"; submodules: ["xml"] }
Depends { name: "VMiscLib" }
Depends { name: "conan.XercesC"; condition: buildconfig.useConanPackages }
cpp.includePaths: [exportingProduct.sourceDirectory]
}
}

View File

@ -34,9 +34,6 @@
#include <QPainter>
#include <QPen>
#include <QPixmap>
#include <QStaticStringData>
#include <QStringData>
#include <QStringDataPtr>
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h"

View File

@ -41,7 +41,7 @@
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^\-()+=?:;'\\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^\-()+=?:;\\&quot;]){0,}"/>
<xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^\-()+=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^\-()+=?:;\\&quot;]){0,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="formatVersion">

View File

@ -42,7 +42,7 @@
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/>
<xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="formatVersion">

View File

@ -44,7 +44,7 @@
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/>
<xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="formatVersion">

View File

@ -45,7 +45,7 @@
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/>
<xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="formatVersion">

View File

@ -43,7 +43,7 @@
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/>
<xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="units">

View File

@ -82,7 +82,7 @@
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/>
<xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="units">

View File

@ -94,7 +94,7 @@
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/>
<xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="units">

View File

@ -95,7 +95,7 @@
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/>
<xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="units">

View File

@ -96,7 +96,7 @@
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/>
<xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="units">

View File

@ -96,7 +96,7 @@
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/>
<xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="units">

View File

@ -757,7 +757,7 @@
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/>
<xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="units">

View File

@ -760,7 +760,7 @@
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/>
<xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="units">

View File

@ -763,7 +763,7 @@
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/>
<xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="units">

View File

@ -773,7 +773,7 @@
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/>
<xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="units">

View File

@ -751,7 +751,7 @@
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/>
<xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="units">

View File

@ -754,7 +754,7 @@
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/>
<xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="units">

View File

@ -754,7 +754,7 @@
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/>
<xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="units">

View File

@ -755,7 +755,7 @@
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/>
<xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="units">

View File

@ -776,7 +776,7 @@
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/>
<xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="units">

View File

@ -791,7 +791,7 @@
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/>
<xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="units">

View File

@ -775,7 +775,7 @@
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/>
<xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="uuid">

View File

@ -780,7 +780,7 @@
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/>
<xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="uuid">

View File

@ -781,7 +781,7 @@
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/>
<xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="uuid">

View File

@ -781,7 +781,7 @@
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/>
<xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="uuid">

View File

@ -795,7 +795,7 @@
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/>
<xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="units">

View File

@ -801,7 +801,7 @@
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/>
<xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="units">

View File

@ -801,7 +801,7 @@
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/>
<xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="units">

View File

@ -841,7 +841,7 @@
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/>
<xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="units">

View File

@ -827,7 +827,7 @@
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/>
<xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="units">

View File

@ -829,7 +829,7 @@
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/>
<xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="units">

View File

@ -761,7 +761,7 @@
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/>
<xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="uuid">

View File

@ -767,7 +767,7 @@
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/>
<xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="uuid">

View File

@ -808,7 +808,7 @@
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/>
<xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="uuid">
@ -836,7 +836,7 @@
</xs:simpleType>
<xs:simpleType name="contentType">
<xs:restriction base="xs:string">
<xs:pattern value="image\/[-\w]+(\.[-\w]+)*([+][-\w]+)?"/>
<xs:pattern value="image\\/[-\w]+(\.[-\w]+)*([+][-\w]+)?"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="colors">

View File

@ -817,7 +817,7 @@
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/>
<xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="uuid">
@ -845,7 +845,7 @@
</xs:simpleType>
<xs:simpleType name="contentType">
<xs:restriction base="xs:string">
<xs:pattern value="image\/[-\w]+(\.[-\w]+)*([+][-\w]+)?"/>
<xs:pattern value="image\\/[-\w]+(\.[-\w]+)*([+][-\w]+)?"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="colors">

View File

@ -822,12 +822,12 @@
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/>
<xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="pieceShortName">
<xs:restriction base="xs:string">
<xs:pattern value="([^\p{Zs}*\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/>
<xs:pattern value="([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="uuid">
@ -855,7 +855,7 @@
</xs:simpleType>
<xs:simpleType name="contentType">
<xs:restriction base="xs:string">
<xs:pattern value="image\/[-\w]+(\.[-\w]+)*([+][-\w]+)?"/>
<xs:pattern value="image\\/[-\w]+(\.[-\w]+)*([+][-\w]+)?"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="colors">

View File

@ -77,6 +77,12 @@
# include <QtConcurrent>
#endif
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#ifdef QT_OPENGLWIDGETS_LIB
# include <QOpenGLWidget>
#endif
#endif
#endif/*__cplusplus*/
#endif // STABLE_H

View File

@ -30,10 +30,13 @@
class QMimeType;
class QString;
class QStringList;
class QMimeType;
class QByteArray;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
class QStringList;
#endif
auto IsMimeTypeImage(const QMimeType &mime) -> bool;
auto SplitString(QString str) -> QStringList;
auto MimeTypeFromByteArray(const QByteArray &data) -> QMimeType;

View File

@ -27,8 +27,15 @@
*************************************************************************/
#include "vabstractconverter.h"
#include "vparsererrorhandler.h"
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <xercesc/parsers/XercesDOMParser.hpp>
#else
#include <QXmlSchema>
#include <QXmlSchemaValidator>
#endif // QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <QAbstractMessageHandler>
#include <QDir>
#include <QDomElement>
#include <QDomNode>
@ -39,76 +46,13 @@
#include <QMap>
#include <QRegularExpression>
#include <QRegularExpressionMatch>
#include <QSourceLocation>
#include <QStaticStringData>
#include <QStringData>
#include <QStringDataPtr>
#include <QStringList>
#include <QTextDocument>
#include <QUrl>
#include <QXmlSchema>
#include <QXmlSchemaValidator>
#include "../exception/vexception.h"
#include "vdomdocument.h"
//This class need for validation pattern file using XSD shema
class MessageHandler : public QAbstractMessageHandler
{
public:
MessageHandler()
: QAbstractMessageHandler(),
m_messageType(QtMsgType()),
m_description(),
m_sourceLocation(QSourceLocation())
{}
QString statusMessage() const;
qint64 line() const;
qint64 column() const;
protected:
// cppcheck-suppress unusedFunction
virtual void handleMessage(QtMsgType type, const QString &description,
const QUrl &identifier, const QSourceLocation &sourceLocation) override;
private:
QtMsgType m_messageType;
QString m_description;
QSourceLocation m_sourceLocation;
};
//---------------------------------------------------------------------------------------------------------------------
QString MessageHandler::statusMessage() const
{
QTextDocument doc;
doc.setHtml(m_description);
return doc.toPlainText();
}
//---------------------------------------------------------------------------------------------------------------------
inline qint64 MessageHandler::line() const
{
return m_sourceLocation.line();
}
//---------------------------------------------------------------------------------------------------------------------
inline qint64 MessageHandler::column() const
{
return m_sourceLocation.column();
}
//---------------------------------------------------------------------------------------------------------------------
// cppcheck-suppress unusedFunction
void MessageHandler::handleMessage(QtMsgType type, const QString &description, const QUrl &identifier,
const QSourceLocation &sourceLocation)
{
Q_UNUSED(type)
Q_UNUSED(identifier)
m_messageType = type;
m_description = description;
m_sourceLocation = sourceLocation;
}
//---------------------------------------------------------------------------------------------------------------------
VAbstractConverter::VAbstractConverter(const QString &fileName)
: m_ver(0x0),
@ -178,15 +122,16 @@ void VAbstractConverter::ReserveFile() const
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractConverter::Replace(QString &formula, const QString &newName, int position, const QString &token,
int &bias) const
void VAbstractConverter::Replace(QString &formula, const QString &newName, vsizetype position, const QString &token,
vsizetype &bias) const
{
formula.replace(position, token.length(), newName);
bias = token.length() - newName.length();
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractConverter::CorrectionsPositions(int position, int bias, QMap<int, QString> &tokens) const
void VAbstractConverter::CorrectionsPositions(vsizetype position, vsizetype bias,
QMap<vsizetype, QString> &tokens) const
{
if (bias == 0)
{
@ -197,10 +142,10 @@ void VAbstractConverter::CorrectionsPositions(int position, int bias, QMap<int,
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractConverter::BiasTokens(int position, int bias, QMap<int, QString> &tokens)
void VAbstractConverter::BiasTokens(vsizetype position, vsizetype bias, QMap<vsizetype, QString> &tokens)
{
QMap<int, QString> newTokens;
QMap<int, QString>::const_iterator i = tokens.constBegin();
QMap<vsizetype, QString> newTokens;
QMap<vsizetype, QString>::const_iterator i = tokens.constBegin();
while (i != tokens.constEnd())
{
if (i.key()<= position)
@ -224,6 +169,70 @@ void VAbstractConverter::BiasTokens(int position, int bias, QMap<int, QString> &
void VAbstractConverter::ValidateXML(const QString &schema) const
{
qCDebug(vXML, "Validation xml file %s.", qUtf8Printable(m_convertedFileName));
QFile fileSchema(schema);
if (not fileSchema.open(QIODevice::ReadOnly))
{
const QString errorMsg(tr("Can't open schema file %1:\n%2.").arg(schema, fileSchema.errorString()));
throw VException(errorMsg);
}
VParserErrorHandler parserErrorHandler;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QScopedPointer<QTemporaryFile> tempSchema(QTemporaryFile::createNativeFile(fileSchema));
if (tempSchema == nullptr)
{
const QString errorMsg(tr("Can't create native file for schema file %1:\n%2.")
.arg(schema, fileSchema.errorString()));
throw VException(errorMsg);
}
if (tempSchema->open())
{
XercesDOMParser domParser;
domParser.setErrorHandler(&parserErrorHandler);
if (domParser.loadGrammar(
tempSchema->fileName().toUtf8().constData(), Grammar::SchemaGrammarType, true) == nullptr)
{
VException e(parserErrorHandler.StatusMessage());
e.AddMoreInformation(tr("Could not load schema file '%1'.").arg(fileSchema.fileName()));
throw e;
}
qCDebug(vXML, "Schema loaded.");
if (parserErrorHandler.HasError())
{
VException e(parserErrorHandler.StatusMessage());
e.AddMoreInformation(tr("Schema file %3 invalid in line %1 column %2").arg(parserErrorHandler.Line())
.arg(parserErrorHandler.Column()).arg(fileSchema.fileName()));
throw e;
}
domParser.setValidationScheme(XercesDOMParser::Val_Always);
domParser.setDoNamespaces(true);
domParser.setDoSchema(true);
domParser.setValidationConstraintFatal(true);
domParser.setValidationSchemaFullChecking(true);
domParser.useCachedGrammarInParse(true);
domParser.parse(m_convertedFileName.toUtf8().constData());
if (domParser.getErrorCount() > 0)
{
VException e(parserErrorHandler.StatusMessage());
e.AddMoreInformation(tr("Validation error file %3 in line %1 column %2").arg(parserErrorHandler.Line())
.arg(parserErrorHandler.Column()).arg(m_originalFileName));
throw e;
}
}
else
{
qCritical() << tr("Unable to open native file for schema");
}
#else
QFile pattern(m_convertedFileName);
if (not pattern.open(QIODevice::ReadOnly))
{
@ -231,22 +240,11 @@ void VAbstractConverter::ValidateXML(const QString &schema) const
throw VException(errorMsg);
}
QFile fileSchema(schema);
if (not fileSchema.open(QIODevice::ReadOnly))
{
pattern.close();
const QString errorMsg(tr("Can't open schema file %1:\n%2.").arg(schema, fileSchema.errorString()));
throw VException(errorMsg);
}
MessageHandler messageHandler;
QXmlSchema sch;
sch.setMessageHandler(&messageHandler);
sch.setMessageHandler(&parserErrorHandler);
if (sch.load(&fileSchema, QUrl::fromLocalFile(fileSchema.fileName()))==false)
{
pattern.close();
fileSchema.close();
VException e(messageHandler.statusMessage());
VException e(parserErrorHandler.StatusMessage());
e.AddMoreInformation(tr("Could not load schema file '%1'.").arg(fileSchema.fileName()));
throw e;
}
@ -268,15 +266,12 @@ void VAbstractConverter::ValidateXML(const QString &schema) const
if (errorOccurred)
{
pattern.close();
fileSchema.close();
VException e(messageHandler.statusMessage());
e.AddMoreInformation(tr("Validation error file %3 in line %1 column %2").arg(messageHandler.line())
.arg(messageHandler.column()).arg(m_originalFileName));
VException e(parserErrorHandler.StatusMessage());
e.AddMoreInformation(tr("Validation error file %3 in line %1 column %2").arg(parserErrorHandler.Line())
.arg(parserErrorHandler.Column()).arg(m_originalFileName));
throw e;
}
pattern.close();
fileSchema.close();
#endif // QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
}
//---------------------------------------------------------------------------------------------------------------------
@ -342,7 +337,9 @@ void VAbstractConverter::Save()
m_tmpFile.resize(0);//clear previous content
const int indent = 4;
QTextStream out(&m_tmpFile);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
out.setCodec("UTF-8");
#endif
save(out, indent);
if (not m_tmpFile.flush())
@ -362,3 +359,15 @@ void VAbstractConverter::SetVersion(const QString &version)
throw e;
}
}
//---------------------------------------------------------------------------------------------------------------------
QString VAbstractConverter::XSDSchema(unsigned int ver) const
{
const QHash <unsigned, QString> schemas = Schemas();
if (schemas.contains(ver))
{
return schemas.value(ver);
}
InvalidVersion(ver);
}

View File

@ -36,7 +36,6 @@
#include <QtGlobal>
#include "vdomdocument.h"
#include "../vmisc/projectversion.h"
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wsuggest-final-types")
@ -69,15 +68,18 @@ protected:
virtual QString MinVerStr() const =0;
virtual QString MaxVerStr() const =0;
virtual QString XSDSchema(unsigned ver) const =0;
virtual QString XSDSchema(unsigned ver) const;
virtual void ApplyPatches() =0;
virtual void DowngradeToCurrentMaxVersion() =0;
virtual bool IsReadOnly() const =0;
void Replace(QString &formula, const QString &newName, int position, const QString &token, int &bias) const;
void CorrectionsPositions(int position, int bias, QMap<int, QString> &tokens) const;
static void BiasTokens(int position, int bias, QMap<int, QString> &tokens);
virtual auto Schemas() const -> QHash <unsigned, QString> =0;
void Replace(QString &formula, const QString &newName, vsizetype position, const QString &token,
vsizetype &bias) const;
void CorrectionsPositions(vsizetype position, vsizetype bias, QMap<vsizetype, QString> &tokens) const;
static void BiasTokens(vsizetype position, vsizetype bias, QMap<vsizetype, QString> &tokens);
void ValidateXML(const QString &schema) const;

View File

@ -29,9 +29,6 @@
#include "vabstractmconverter.h"
#include <QDomElement>
#include <QStaticStringData>
#include <QStringData>
#include <QStringDataPtr>
#include "vabstractconverter.h"

View File

@ -34,9 +34,6 @@
#include <QList>
#include <QMessageLogger>
#include <QSet>
#include <QStaticStringData>
#include <QStringData>
#include <QStringDataPtr>
#include <QtDebug>
#include <QtConcurrentMap>
#include <QFuture>
@ -278,7 +275,7 @@ template <class T>
auto NumberToString(T number) -> QString
{
const QLocale locale = QLocale::c();
return locale.toString(number, 'g', 12).remove(locale.groupSeparator());
return locale.toString(number, 'g', 12).remove(LocaleGroupSeparator(locale));
}
//---------------------------------------------------------------------------------------------------------------------
@ -327,7 +324,7 @@ bool VAbstractPattern::RequiresMeasurements() const
//---------------------------------------------------------------------------------------------------------------------
QStringList VAbstractPattern::ListMeasurements() const
{
const QFuture<QStringList> futureIncrements = QtConcurrent::run(this, &VAbstractPattern::ListIncrements);
const QFuture<QStringList> futureIncrements = QtConcurrent::run([this](){return ListIncrements();});
const QList<QString> tokens = ConvertToList(QtConcurrent::blockingMappedReduced(ListExpressions(), GetTokens,
GatherTokens));
@ -1418,7 +1415,12 @@ auto VAbstractPattern::GetBackgroundImage(const QUuid &id) const -> VBackgroundP
return GetBackgroundPatternImage(imageElement);
}
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wnoexcept")
return {};
QT_WARNING_POP
}
//---------------------------------------------------------------------------------------------------------------------
@ -1661,7 +1663,7 @@ auto VAbstractPattern::CheckTagExists(const QString &tag) -> QDomElement
void VAbstractPattern::InsertTag(const QStringList &tags, const QDomElement &element)
{
QDomElement pattern = documentElement();
for (int i = tags.indexOf(element.tagName())-1; i >= 0; --i)
for (vsizetype i = tags.indexOf(element.tagName())-1; i >= 0; --i)
{
const QDomNodeList list = elementsByTagName(tags.at(i));
if (not list.isEmpty())
@ -1725,16 +1727,15 @@ QVector<VFormulaField> VAbstractPattern::ListExpressions() const
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
// Note. Tool Union Details also contains formulas, but we don't use them for union and keep only to simplifying
// working with nodes. Same code for saving reading.
auto futurePointExpressions = QtConcurrent::run(this, &VAbstractPattern::ListPointExpressions);
auto futureArcExpressions = QtConcurrent::run(this, &VAbstractPattern::ListArcExpressions);
auto futureElArcExpressions = QtConcurrent::run(this, &VAbstractPattern::ListElArcExpressions);
auto futureSplineExpressions = QtConcurrent::run(this, &VAbstractPattern::ListSplineExpressions);
auto futureIncrementExpressions = QtConcurrent::run(this, &VAbstractPattern::ListIncrementExpressions);
auto futureOperationExpressions = QtConcurrent::run(this, &VAbstractPattern::ListOperationExpressions);
auto futurePathExpressions = QtConcurrent::run(this, &VAbstractPattern::ListPathExpressions);
auto futurePieceExpressions = QtConcurrent::run(this, &VAbstractPattern::ListPieceExpressions);
auto futureFinalMeasurementsExpressions = QtConcurrent::run(this,
&VAbstractPattern::ListFinalMeasurementsExpressions);
auto futurePointExpressions = QtConcurrent::run([this](){return ListPointExpressions();});
auto futureArcExpressions = QtConcurrent::run([this](){return ListArcExpressions();});
auto futureElArcExpressions = QtConcurrent::run([this](){return ListElArcExpressions();});
auto futureSplineExpressions = QtConcurrent::run([this](){return ListSplineExpressions();});
auto futureIncrementExpressions = QtConcurrent::run([this](){return ListIncrementExpressions();});
auto futureOperationExpressions = QtConcurrent::run([this](){return ListOperationExpressions();});
auto futurePathExpressions = QtConcurrent::run([this](){return ListPathExpressions();});
auto futurePieceExpressions = QtConcurrent::run([this](){return ListPieceExpressions();});
auto futureFinalMeasurementsExpressions = QtConcurrent::run([this](){return ListFinalMeasurementsExpressions();});
QVector<VFormulaField> list;
list << futurePointExpressions.result();

View File

@ -72,7 +72,13 @@ auto ScaleVectorImage(const QSvgRenderer &renderer) -> QSize
//---------------------------------------------------------------------------------------------------------------------
auto VBackgroundPatternImage::FromFile(const QString &fileName, bool builtIn) -> VBackgroundPatternImage
{
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wnoexcept")
VBackgroundPatternImage image;
QT_WARNING_POP
QMimeType mime = QMimeDatabase().mimeTypeForFile(fileName);
if (not IsMimeTypeImage(mime))

View File

@ -33,8 +33,6 @@
#include <QUuid>
#include <QTransform>
#include "../vmisc/typedef.h"
class QPixmap;
class QMimeType;

View File

@ -39,7 +39,11 @@
#include "../exception/vexception.h"
#include "../ifcdef.h"
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <QAbstractMessageHandler>
#include <QSourceLocation>
#endif
#include <QByteArray>
#include <QDomNodeList>
#include <QDomText>
@ -47,7 +51,6 @@
#include <QIODevice>
#include <QMessageLogger>
#include <QObject>
#include <QSourceLocation>
#include <QStringList>
#include <QTemporaryFile>
#include <QTextDocument>
@ -703,7 +706,7 @@ void VDomDocument::RefreshElementIdCache()
{
if (m_watcher->isFinished())
{
m_watcher->setFuture(QtConcurrent::run(this, &VDomDocument::RefreshCache, documentElement()));
m_watcher->setFuture(QtConcurrent::run([this](){return RefreshCache(documentElement());}));
}
}
@ -788,7 +791,9 @@ bool VDomDocument::SaveDocument(const QString &fileName, QString &error)
}
// Left these strings in case we will need them for testing purposes
// QTextStream out(&file);
//#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
// out.setCodec("UTF-8");
//#endif
// save(out, indent);
success = file.commit();

View File

@ -35,10 +35,7 @@
#include <QDomNode>
#include <QHash>
#include <QLatin1String>
#include <QStaticStringData>
#include <QString>
#include <QStringData>
#include <QStringDataPtr>
#include <QtGlobal>
#include <QLocale>
#include <QLoggingCategory>
@ -50,10 +47,13 @@
#include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/literals.h"
#include "../qmuparser/qmudef.h"
class QDomElement;
class QDomNode;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
template <typename T> class QVector;
#endif
template <typename T> class QFutureWatcher;
Q_DECLARE_LOGGING_CATEGORY(vXML)
@ -187,7 +187,7 @@ inline void VDomDocument::SetAttribute(QDomElement &domElement, const QString &n
{
// See specification for xs:decimal
const QLocale locale = QLocale::c();
domElement.setAttribute(name, locale.toString(value).remove(locale.groupSeparator()));
domElement.setAttribute(name, locale.toString(value).remove(LocaleGroupSeparator(locale)));
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -51,6 +51,17 @@ VLabelTemplateConverter::VLabelTemplateConverter(const QString &fileName)
ValidateInputFile(CurrentSchema);
}
//---------------------------------------------------------------------------------------------------------------------
auto VLabelTemplateConverter::XSDSchemas() -> QHash<unsigned int, QString>
{
static const auto schemas = QHash <unsigned, QString>
{
std::make_pair(FormatVersion(1, 0, 0), CurrentSchema)
};
return schemas;
}
//---------------------------------------------------------------------------------------------------------------------
unsigned VLabelTemplateConverter::MinVer() const
{
@ -75,20 +86,6 @@ QString VLabelTemplateConverter::MaxVerStr() const
return LabelTemplateMaxVerStr;
}
//---------------------------------------------------------------------------------------------------------------------
QString VLabelTemplateConverter::XSDSchema(unsigned ver) const
{
switch (ver)
{
case (FormatVersion(1, 0, 0)):
return CurrentSchema;
default:
InvalidVersion(ver);
break;
}
return QString();//unreachable code
}
//---------------------------------------------------------------------------------------------------------------------
void VLabelTemplateConverter::ApplyPatches()
{
@ -108,3 +105,9 @@ void VLabelTemplateConverter::DowngradeToCurrentMaxVersion()
SetVersion(LabelTemplateMaxVerStr);
Save();
}
//---------------------------------------------------------------------------------------------------------------------
auto VLabelTemplateConverter::Schemas() const -> QHash<unsigned int, QString>
{
return XSDSchemas();
}

View File

@ -30,6 +30,7 @@
#define VLABELTEMPLATECONVERTER_H
#include "vabstractconverter.h"
#include "../vmisc/projectversion.h"
class VLabelTemplateConverter : public VAbstractConverter
{
@ -42,6 +43,8 @@ public:
static Q_DECL_CONSTEXPR const unsigned LabelTemplateMinVer = FormatVersion(1, 0, 0);
static Q_DECL_CONSTEXPR const unsigned LabelTemplateMaxVer = FormatVersion(1, 0, 0);
static auto XSDSchemas() -> QHash <unsigned, QString>;
protected:
virtual unsigned MinVer() const override;
virtual unsigned MaxVer() const override;
@ -49,12 +52,13 @@ protected:
virtual QString MinVerStr() const override;
virtual QString MaxVerStr() const override;
virtual QString XSDSchema(unsigned ver) const override;
virtual void ApplyPatches() override;
virtual void DowngradeToCurrentMaxVersion() override;
virtual void ApplyPatches() override;
virtual void DowngradeToCurrentMaxVersion() override;
virtual bool IsReadOnly() const override {return false;}
auto Schemas() const -> QHash <unsigned, QString> override;
private:
Q_DISABLE_COPY_MOVE(VLabelTemplateConverter) // NOLINT
static const QString LabelTemplateMinVerStr;

Some files were not shown because too many files have changed in this diff Show More