diff --git a/src/app/tape/dialogs/configpages/tapepreferencesconfigurationpage.cpp b/src/app/tape/dialogs/configpages/tapepreferencesconfigurationpage.cpp
index 0525e3d29..2e49a0060 100644
--- a/src/app/tape/dialogs/configpages/tapepreferencesconfigurationpage.cpp
+++ b/src/app/tape/dialogs/configpages/tapepreferencesconfigurationpage.cpp
@@ -50,29 +50,30 @@ TapePreferencesConfigurationPage::TapePreferencesConfigurationPage(QWidget *pare
});
//-------------------- Decimal separator setup
- ui->osOptionCheck->setChecked(qApp->TapeSettings()->GetOsSeparator());
+ ui->osOptionCheck->setChecked(MApplication::VApp()->TapeSettings()->GetOsSeparator());
// Theme
- ui->darkModeCheck->setChecked(qApp->TapeSettings()->GetDarkMode());
+ ui->darkModeCheck->setChecked(MApplication::VApp()->TapeSettings()->GetDarkMode());
// Native dialogs
- ui->checkBoxDontUseNativeDialog->setChecked(qApp->TapeSettings()->IsDontUseNativeDialog());
+ ui->checkBoxDontUseNativeDialog->setChecked(MApplication::VApp()->TapeSettings()->IsDontUseNativeDialog());
//---------------------- Pattern making system
ui->systemBookValueLabel->setFixedHeight(4 * QFontMetrics(ui->systemBookValueLabel->font()).lineSpacing());
connect(ui->systemCombo, QOverload::of(&QComboBox::currentIndexChanged), this, [this]()
{
m_systemChanged = true;
- QString text = qApp->TrVars()->PMSystemAuthor(ui->systemCombo->currentData().toString());
+ QString text = VAbstractApplication::VApp()->TrVars()
+ ->PMSystemAuthor(ui->systemCombo->currentData().toString());
ui->systemAuthorValueLabel->setText(text);
ui->systemAuthorValueLabel->setToolTip(text);
- text = qApp->TrVars()->PMSystemBook(ui->systemCombo->currentData().toString());
+ text = VAbstractApplication::VApp()->TrVars()->PMSystemBook(ui->systemCombo->currentData().toString());
ui->systemBookValueLabel->setPlainText(text);
});
// set default pattern making system
- int index = ui->systemCombo->findData(qApp->TapeSettings()->GetPMSystemCode());
+ int index = ui->systemCombo->findData(MApplication::VApp()->TapeSettings()->GetPMSystemCode());
if (index != -1)
{
ui->systemCombo->setCurrentIndex(index);
@@ -81,11 +82,11 @@ TapePreferencesConfigurationPage::TapePreferencesConfigurationPage(QWidget *pare
//----------------------------- Measurements Editing
connect(ui->resetWarningsButton, &QPushButton::released, this, []()
{
- qApp->TapeSettings()->SetConfirmFormatRewriting(true);
+ MApplication::VApp()->TapeSettings()->SetConfirmFormatRewriting(true);
});
//----------------------- Toolbar
- ui->toolBarStyleCheck->setChecked(qApp->TapeSettings()->GetToolBarStyle());
+ ui->toolBarStyleCheck->setChecked(MApplication::VApp()->TapeSettings()->GetToolBarStyle());
}
//---------------------------------------------------------------------------------------------------------------------
@@ -98,7 +99,7 @@ TapePreferencesConfigurationPage::~TapePreferencesConfigurationPage()
QStringList TapePreferencesConfigurationPage::Apply()
{
QStringList preferences;
- VTapeSettings *settings = qApp->TapeSettings();
+ VTapeSettings *settings = MApplication::VApp()->TapeSettings();
settings->SetOsSeparator(ui->osOptionCheck->isChecked());
settings->SetToolBarStyle(ui->toolBarStyleCheck->isChecked());
@@ -124,12 +125,12 @@ QStringList TapePreferencesConfigurationPage::Apply()
settings->SetPMSystemCode(code);
m_systemChanged = false;
- qApp->LoadTranslation(locale);
+ VAbstractApplication::VApp()->LoadTranslation(locale);
qApp->processEvents();// force to call changeEvent
// Part about measurments will not be updated automatically
- qApp->RetranslateTables();
- qApp->RetranslateGroups();
+ MApplication::VApp()->RetranslateTables();
+ MApplication::VApp()->RetranslateGroups();
}
return preferences;
diff --git a/src/app/tape/dialogs/configpages/tapepreferencespathpage.cpp b/src/app/tape/dialogs/configpages/tapepreferencespathpage.cpp
index 15d964d22..c40ec8b8b 100644
--- a/src/app/tape/dialogs/configpages/tapepreferencespathpage.cpp
+++ b/src/app/tape/dialogs/configpages/tapepreferencespathpage.cpp
@@ -65,7 +65,7 @@ TapePreferencesPathPage::~TapePreferencesPathPage()
//---------------------------------------------------------------------------------------------------------------------
void TapePreferencesPathPage::Apply()
{
- VTapeSettings *settings = qApp->TapeSettings();
+ VTapeSettings *settings = MApplication::VApp()->TapeSettings();
settings->SetPathIndividualMeasurements(ui->pathTable->item(0, 1)->text());
settings->SetPathMultisizeMeasurements(ui->pathTable->item(1, 1)->text());
settings->SetPathPattern(ui->pathTable->item(2, 1)->text());
@@ -126,17 +126,17 @@ void TapePreferencesPathPage::EditPath()
switch (row)
{
case 0: // individual measurements
- path = qApp->TapeSettings()->GetPathIndividualMeasurements();
+ path = MApplication::VApp()->TapeSettings()->GetPathIndividualMeasurements();
break;
case 1: // multisize measurements
- path = qApp->TapeSettings()->GetPathMultisizeMeasurements();
+ path = MApplication::VApp()->TapeSettings()->GetPathMultisizeMeasurements();
path = VCommonSettings::PrepareMultisizeTables(path);
break;
case 2: // pattern path
- path = qApp->TapeSettings()->GetPathPattern();
+ path = MApplication::VApp()->TapeSettings()->GetPathPattern();
break;
case 3: // templates
- path = qApp->TapeSettings()->GetPathTemplate();
+ path = MApplication::VApp()->TapeSettings()->GetPathTemplate();
break;
default:
break;
@@ -151,7 +151,7 @@ void TapePreferencesPathPage::EditPath()
const QString dir = QFileDialog::getExistingDirectory(
this, tr("Open Directory"), path,
- qApp->NativeFileDialog(QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks));
+ VAbstractApplication::VApp()->NativeFileDialog(QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks));
if (dir.isEmpty())
{
if (usedNotExistedDir)
@@ -174,7 +174,7 @@ void TapePreferencesPathPage::InitTable()
ui->pathTable->setRowCount(4);
ui->pathTable->setColumnCount(2);
- const VTapeSettings *settings = qApp->TapeSettings();
+ const VTapeSettings *settings = MApplication::VApp()->TapeSettings();
{
ui->pathTable->setItem(0, 0, new QTableWidgetItem(tr("My Individual Measurements")));
diff --git a/src/app/tape/dialogs/dialogmdatabase.cpp b/src/app/tape/dialogs/dialogmdatabase.cpp
index 0d5c14c0d..d8f4e4f9a 100644
--- a/src/app/tape/dialogs/dialogmdatabase.cpp
+++ b/src/app/tape/dialogs/dialogmdatabase.cpp
@@ -181,7 +181,8 @@ void DialogMDataBase::RetranslateGroups()
QString DialogMDataBase::ImgTag(const QString &number)
{
QString imgUrl(""); // In case of error
- const QString filePath = QString("://diagrams/%1.svg").arg(MapDiagrams(qApp->TrVars(), number));
+ const QString filePath = QString("://diagrams/%1.svg")
+ .arg(MapDiagrams(VAbstractApplication::VApp()->TrVars(), number));
if (QFileInfo::exists(filePath))
{
// Load your SVG
@@ -508,7 +509,8 @@ void DialogMDataBase::AddMeasurement(QTreeWidgetItem *group, const QString &name
UpdateChecks(m, 0);
}
- const QString text = qApp->TrVars()->MNumber(name) + ". " + qApp->TrVars()->MToUser(name);
+ const QString text = VAbstractApplication::VApp()->TrVars()->MNumber(name) + ". " +
+ VAbstractApplication::VApp()->TrVars()->MToUser(name);
m->setText(0, text);
m->setToolTip(0, text);
m->setData(0, Qt::UserRole, name);
@@ -517,13 +519,13 @@ void DialogMDataBase::AddMeasurement(QTreeWidgetItem *group, const QString &name
//---------------------------------------------------------------------------------------------------------------------
void DialogMDataBase::ReadSettings()
{
- restoreGeometry(qApp->TapeSettings()->GetDataBaseGeometry());
+ restoreGeometry(MApplication::VApp()->TapeSettings()->GetDataBaseGeometry());
}
//---------------------------------------------------------------------------------------------------------------------
void DialogMDataBase::WriteSettings()
{
- qApp->TapeSettings()->SetDataBaseGeometry(saveGeometry());
+ MApplication::VApp()->TapeSettings()->SetDataBaseGeometry(saveGeometry());
}
//---------------------------------------------------------------------------------------------------------------------
@@ -540,7 +542,7 @@ QString DialogMDataBase::ItemFullDescription(QTreeWidgetItem *item, bool showIma
return QString();
}
- const QString number = qApp->TrVars()->MNumber(name);
+ const QString number = VAbstractApplication::VApp()->TrVars()->MNumber(name);
QString imgTag;
if (showImage)
@@ -552,7 +554,8 @@ QString DialogMDataBase::ItemFullDescription(QTreeWidgetItem *item, bool showIma
"normal\"> %1
%2. %3
"
"%4
")
- .arg(imgTag, number, qApp->TrVars()->GuiText(name), qApp->TrVars()->Description(name));
+ .arg(imgTag, number, VAbstractApplication::VApp()->TrVars()->GuiText(name),
+ VAbstractApplication::VApp()->TrVars()->Description(name));
return text;
}
@@ -572,7 +575,8 @@ void DialogMDataBase::RetranslateGroup(QTreeWidgetItem *group, const QString &gr
//---------------------------------------------------------------------------------------------------------------------
void DialogMDataBase::RetranslateMeasurement(QTreeWidgetItem *group, int index, const QString &name)
{
- const QString text = qApp->TrVars()->MNumber(name) + ". " + qApp->TrVars()->MToUser(name);
+ const QString text = VAbstractApplication::VApp()->TrVars()->MNumber(name) + ". " +
+ VAbstractApplication::VApp()->TrVars()->MToUser(name);
QTreeWidgetItem *m = group->child(index);
m->setText(0, text);
diff --git a/src/app/tape/dialogs/dialogtapepreferences.cpp b/src/app/tape/dialogs/dialogtapepreferences.cpp
index 2d2bc0f6c..11cf0e732 100644
--- a/src/app/tape/dialogs/dialogtapepreferences.cpp
+++ b/src/app/tape/dialogs/dialogtapepreferences.cpp
@@ -50,7 +50,7 @@ DialogTapePreferences::DialogTapePreferences(QWidget *parent)
setWindowFlags(Qt::Window);
#endif
- qApp->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
SCASSERT(bOk != nullptr)
@@ -88,7 +88,7 @@ void DialogTapePreferences::showEvent(QShowEvent *event)
}
// do your init stuff here
- QSize sz = qApp->Settings()->GetPreferenceDialogSize();
+ QSize sz = VAbstractApplication::VApp()->Settings()->GetPreferenceDialogSize();
if (sz.isEmpty() == false)
{
resize(sz);
@@ -106,7 +106,7 @@ void DialogTapePreferences::resizeEvent(QResizeEvent *event)
// dialog creating, which would
if (m_isInitialized)
{
- qApp->Settings()->SetPreferenceDialogSize(size());
+ VAbstractApplication::VApp()->Settings()->SetPreferenceDialogSize(size());
}
}
@@ -137,7 +137,7 @@ void DialogTapePreferences::Apply()
QMessageBox::information(this, QCoreApplication::applicationName(), text);
}
- qApp->TapeSettings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
+ MApplication::VApp()->TapeSettings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
emit UpdateProperties();
setResult(QDialog::Accepted);
}
diff --git a/src/app/tape/mapplication.cpp b/src/app/tape/mapplication.cpp
index 82e901109..007e83305 100644
--- a/src/app/tape/mapplication.cpp
+++ b/src/app/tape/mapplication.cpp
@@ -151,7 +151,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
}
QString logMsg = msg;
- const bool isWarningMessage = qApp->IsWarningMessage(msg);
+ const bool isWarningMessage = VAbstractApplication::VApp()->IsWarningMessage(msg);
if (isWarningMessage)
{
logMsg = logMsg.remove(VAbstractApplication::warningMessageSignature);
@@ -219,7 +219,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
if (type == QtWarningMsg || type == QtCriticalMsg || type == QtFatalMsg)
{
- if (not qApp->IsTestMode())
+ if (not MApplication::VApp()->IsTestMode())
{
if (topWinAllowsPop)
{
@@ -432,7 +432,7 @@ void MApplication::InitOptions()
void MApplication::ActivateDarkMode()
{
- VTapeSettings *settings = qApp->TapeSettings();
+ VTapeSettings *settings = MApplication::VApp()->TapeSettings();
if (settings->GetDarkMode())
{
QFile f(":qdarkstyle/style.qss");
@@ -839,12 +839,18 @@ void MApplication::ParseCommandLine(const SocketConnection &connection, const QS
}
}
+//---------------------------------------------------------------------------------------------------------------------
+auto MApplication::VApp() -> MApplication *
+{
+ return qobject_cast(QCoreApplication::instance());
+}
+
//---------------------------------------------------------------------------------------------------------------------
TMainWindow *MApplication::NewMainWindow()
{
TMainWindow *tape = new TMainWindow();
mainWindows.prepend(tape);
- if (not qApp->IsTestMode())
+ if (not MApplication::VApp()->IsTestMode())
{
tape->show();
}
diff --git a/src/app/tape/mapplication.h b/src/app/tape/mapplication.h
index dc8cea765..5725b6bbd 100644
--- a/src/app/tape/mapplication.h
+++ b/src/app/tape/mapplication.h
@@ -39,11 +39,6 @@ class MApplication;// use in define
class TMainWindow;
class QLocalServer;
-#if defined(qApp)
-#undef qApp
-#endif
-#define qApp (static_cast(VAbstractApplication::instance()))
-
enum class SocketConnection : bool {Client = false, Server = true};
class MApplication : public VAbstractApplication
@@ -78,6 +73,8 @@ public:
void ParseCommandLine(const SocketConnection &connection, const QStringList &arguments);
+ static MApplication *VApp();
+
public slots:
void ProcessCMD();
diff --git a/src/app/tape/tape.pro b/src/app/tape/tape.pro
index a1bfd651e..6e6017317 100644
--- a/src/app/tape/tape.pro
+++ b/src/app/tape/tape.pro
@@ -352,16 +352,7 @@ DEPENDPATH += $$PWD/../../libs/vformat
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vformat/$${DESTDIR}/vformat.lib
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vformat/$${DESTDIR}/libvformat.a
-# VLayout static library (depend on IFC, VGeometry, VPatternDB)
-unix|win32: LIBS += -L$$OUT_PWD/../../libs/vlayout/$${DESTDIR}/ -lvlayout
-
-INCLUDEPATH += $$PWD/../../libs/vlayout
-DEPENDPATH += $$PWD/../../libs/vlayout
-
-win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vlayout/$${DESTDIR}/vlayout.lib
-else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vlayout/$${DESTDIR}/libvlayout.a
-
-#VPatternDB static library (depend on vgeometry, vmisc)
+#VPatternDB static library (depend on vgeometry, vmisc, VLayout)
unix|win32: LIBS += -L$$OUT_PWD/../../libs/vpatterndb/$${DESTDIR} -lvpatterndb
INCLUDEPATH += $$PWD/../../libs/vpatterndb
@@ -370,6 +361,15 @@ DEPENDPATH += $$PWD/../../libs/vpatterndb
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vpatterndb/$${DESTDIR}/vpatterndb.lib
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vpatterndb/$${DESTDIR}/libvpatterndb.a
+# VLayout static library (depend on IFC, VGeometry)
+unix|win32: LIBS += -L$$OUT_PWD/../../libs/vlayout/$${DESTDIR}/ -lvlayout
+
+INCLUDEPATH += $$PWD/../../libs/vlayout
+DEPENDPATH += $$PWD/../../libs/vlayout
+
+win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vlayout/$${DESTDIR}/vlayout.lib
+else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vlayout/$${DESTDIR}/libvlayout.a
+
# Fervor static library (depend on VMisc, IFC)
unix|win32: LIBS += -L$$OUT_PWD/../../libs/fervor/$${DESTDIR}/ -lfervor
diff --git a/src/app/tape/tmainwindow.cpp b/src/app/tape/tmainwindow.cpp
index 2293c4e0e..b154c4eed 100644
--- a/src/app/tape/tmainwindow.cpp
+++ b/src/app/tape/tmainwindow.cpp
@@ -111,7 +111,7 @@ TMainWindow::TMainWindow(QWidget *parent)
{
ui->setupUi(this);
- qApp->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
ui->lineEditFind->setClearButtonEnabled(true);
ui->lineEditName->setClearButtonEnabled(true);
@@ -269,7 +269,7 @@ bool TMainWindow::LoadFile(const QString &path)
if (not QFileInfo::exists(path))
{
qCCritical(tMainWindow, "%s", qUtf8Printable(tr("File '%1' doesn't exist!").arg(path)));
- if (qApp->IsTestMode())
+ if (MApplication::VApp()->IsTestMode())
{
qApp->exit(V_EX_NOINPUT);
}
@@ -277,7 +277,7 @@ bool TMainWindow::LoadFile(const QString &path)
}
// Check if file already opened
- const QList list = qApp->MainWindows();
+ const QList list = MApplication::VApp()->MainWindows();
for (auto w : list)
{
if (w->CurrentFile() == path)
@@ -300,7 +300,7 @@ bool TMainWindow::LoadFile(const QString &path)
try
{
- data = new VContainer(qApp->TrVars(), &mUnit, VContainer::UniqueNamespace());
+ data = new VContainer(VAbstractApplication::VApp()->TrVars(), &mUnit, VContainer::UniqueNamespace());
m = new VMeasurements(data);
m->setXMLContent(path);
@@ -373,7 +373,7 @@ bool TMainWindow::LoadFile(const QString &path)
data = nullptr;
lock.reset();
- if (qApp->IsTestMode())
+ if (MApplication::VApp()->IsTestMode())
{
qApp->exit(V_EX_NOINPUT);
}
@@ -382,7 +382,7 @@ bool TMainWindow::LoadFile(const QString &path)
}
else
{
- return qApp->NewMainWindow()->LoadFile(path);
+ return MApplication::VApp()->NewMainWindow()->LoadFile(path);
}
return true;
@@ -418,7 +418,7 @@ void TMainWindow::FileNew()
return;
}
- data = new VContainer(qApp->TrVars(), &mUnit, VContainer::UniqueNamespace());
+ data = new VContainer(VAbstractApplication::VApp()->TrVars(), &mUnit, VContainer::UniqueNamespace());
m = new VMeasurements(mUnit, setup.Dimensions(), data);
m->SetFullCircumference(setup.FullCircumference());
@@ -429,7 +429,7 @@ void TMainWindow::FileNew()
}
else
{
- data = new VContainer(qApp->TrVars(), &mUnit, VContainer::UniqueNamespace());
+ data = new VContainer(VAbstractApplication::VApp()->TrVars(), &mUnit, VContainer::UniqueNamespace());
m = new VMeasurements(mUnit, data);
m_curFileFormatVersion = VVITConverter::MeasurementMaxVer;
@@ -450,7 +450,7 @@ void TMainWindow::FileNew()
}
else
{
- qApp->NewMainWindow()->FileNew();
+ MApplication::VApp()->NewMainWindow()->FileNew();
}
}
@@ -460,7 +460,7 @@ void TMainWindow::OpenIndividual()
const QString filter = tr("Individual measurements") + QStringLiteral(" (*.vit);;") + tr("Multisize measurements") +
QStringLiteral(" (*.vst);;") + tr("All files") + QStringLiteral(" (*.*)");
//Use standard path to individual measurements
- const QString pathTo = qApp->TapeSettings()->GetPathIndividualMeasurements();
+ const QString pathTo = MApplication::VApp()->TapeSettings()->GetPathIndividualMeasurements();
bool usedNotExistedDir = false;
QDir directory(pathTo);
@@ -483,7 +483,7 @@ void TMainWindow::OpenMultisize()
const QString filter = tr("Multisize measurements") + QStringLiteral(" (*.vst);;") + tr("Individual measurements") +
QStringLiteral(" (*.vit);;") + tr("All files") + QStringLiteral(" (*.*)");
//Use standard path to multisize measurements
- QString pathTo = qApp->TapeSettings()->GetPathMultisizeMeasurements();
+ QString pathTo = MApplication::VApp()->TapeSettings()->GetPathMultisizeMeasurements();
pathTo = VCommonSettings::PrepareMultisizeTables(pathTo);
Open(pathTo, filter);
@@ -495,7 +495,7 @@ void TMainWindow::OpenTemplate()
const QString filter = tr("Measurements") + QStringLiteral(" (*.vst *.vit);;") + tr("All files") +
QStringLiteral(" (*.*)");
//Use standard path to template files
- QString pathTo = qApp->TapeSettings()->GetPathTemplate();
+ QString pathTo = MApplication::VApp()->TapeSettings()->GetPathTemplate();
pathTo = VCommonSettings::PrepareStandardTemplates(pathTo);
Open(pathTo, filter);
@@ -511,7 +511,7 @@ void TMainWindow::CreateFromExisting()
{
const QString filter = tr("Individual measurements") + QStringLiteral(" (*.vit)");
//Use standard path to individual measurements
- const QString pathTo = qApp->TapeSettings()->GetPathIndividualMeasurements();
+ const QString pathTo = MApplication::VApp()->TapeSettings()->GetPathIndividualMeasurements();
bool usedNotExistedDir = false;
QDir directory(pathTo);
@@ -521,7 +521,7 @@ void TMainWindow::CreateFromExisting()
}
const QString mPath = QFileDialog::getOpenFileName(this, tr("Select file"), pathTo, filter, nullptr,
- qApp->NativeFileDialog());
+ VAbstractApplication::VApp()->NativeFileDialog());
if (not mPath.isEmpty())
{
@@ -531,7 +531,7 @@ void TMainWindow::CreateFromExisting()
}
else
{
- qApp->NewMainWindow()->CreateFromExisting();
+ MApplication::VApp()->NewMainWindow()->CreateFromExisting();
}
}
@@ -597,7 +597,7 @@ void TMainWindow::changeEvent(QEvent *event)
{
if (event->type() == QEvent::LanguageChange)
{
- qApp->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
// retranslate designer form (single inheritance approach)
ui->retranslateUi(this);
@@ -667,7 +667,7 @@ bool TMainWindow::eventFilter(QObject *object, QEvent *event)
auto *keyEvent = static_cast(event);
if ((keyEvent->key() == Qt::Key_Period) && ((keyEvent->modifiers() & Qt::KeypadModifier) != 0u))
{
- if (qApp->Settings()->GetOsSeparator())
+ if (VAbstractApplication::VApp()->Settings()->GetOsSeparator())
{
plainTextEdit->insertPlainText(QLocale().decimalPoint());
}
@@ -686,7 +686,7 @@ bool TMainWindow::eventFilter(QObject *object, QEvent *event)
auto *keyEvent = static_cast(event);
if ((keyEvent->key() == Qt::Key_Period) && ((keyEvent->modifiers() & Qt::KeypadModifier) != 0u))
{
- if (qApp->Settings()->GetOsSeparator())
+ if (VAbstractApplication::VApp()->Settings()->GetOsSeparator())
{
textEdit->insert(QLocale().decimalPoint());
}
@@ -756,7 +756,7 @@ void TMainWindow::ExportToCSVData(const QString &fileName, bool withHeader, int
//---------------------------------------------------------------------------------------------------------------------
QStringList TMainWindow::RecentFileList() const
{
- return qApp->TapeSettings()->GetRecentFileList();
+ return MApplication::VApp()->TapeSettings()->GetRecentFileList();
}
//---------------------------------------------------------------------------------------------------------------------
@@ -876,11 +876,11 @@ bool TMainWindow::FileSaveAs()
{
if (mType == MeasurementsType::Individual)
{
- dir = qApp->TapeSettings()->GetPathIndividualMeasurements();
+ dir = MApplication::VApp()->TapeSettings()->GetPathIndividualMeasurements();
}
else
{
- dir = qApp->TapeSettings()->GetPathMultisizeMeasurements();
+ dir = MApplication::VApp()->TapeSettings()->GetPathMultisizeMeasurements();
dir = VCommonSettings::PrepareMultisizeTables(dir);
}
}
@@ -897,7 +897,7 @@ bool TMainWindow::FileSaveAs()
}
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), dir + QChar('/') + fName, filters, nullptr,
- qApp->NativeFileDialog());
+ VAbstractApplication::VApp()->NativeFileDialog());
auto RemoveTempDir = qScopeGuard([usedNotExistedDir, dir]()
{
@@ -998,7 +998,7 @@ void TMainWindow::ShowWindow() const
if (v.canConvert())
{
const int offset = qvariant_cast(v);
- const QList windows = qApp->MainWindows();
+ const QList windows = MApplication::VApp()->MainWindows();
windows.at(offset)->raise();
windows.at(offset)->activateWindow();
}
@@ -1017,7 +1017,7 @@ void TMainWindow::ImportDataFromCSV()
const QString suffix = QStringLiteral("csv");
QString fileName = QFileDialog::getOpenFileName(this, tr("Import from CSV"), QDir::homePath(), filters, nullptr,
- qApp->NativeFileDialog());
+ VAbstractApplication::VApp()->NativeFileDialog());
if (fileName.isEmpty())
{
@@ -1031,16 +1031,16 @@ void TMainWindow::ImportDataFromCSV()
}
DialogExportToCSV dialog(this);
- dialog.SetWithHeader(qApp->Settings()->GetCSVWithHeader());
- dialog.SetSelectedMib(qApp->Settings()->GetCSVCodec());
- dialog.SetSeparator(qApp->Settings()->GetCSVSeparator());
+ dialog.SetWithHeader(VAbstractApplication::VApp()->Settings()->GetCSVWithHeader());
+ dialog.SetSelectedMib(VAbstractApplication::VApp()->Settings()->GetCSVCodec());
+ dialog.SetSeparator(VAbstractApplication::VApp()->Settings()->GetCSVSeparator());
dialog.ShowFilePreview(fileName);
if (dialog.exec() == QDialog::Accepted)
{
- qApp->Settings()->SetCSVSeparator(dialog.GetSeparator());
- qApp->Settings()->SetCSVCodec(dialog.GetSelectedMib());
- qApp->Settings()->SetCSVWithHeader(dialog.IsWithHeader());
+ VAbstractApplication::VApp()->Settings()->SetCSVSeparator(dialog.GetSeparator());
+ VAbstractApplication::VApp()->Settings()->SetCSVCodec(dialog.GetSelectedMib());
+ VAbstractApplication::VApp()->Settings()->SetCSVWithHeader(dialog.IsWithHeader());
QSharedPointer columns;
if (m->Type() == MeasurementsType::Multisize)
@@ -1365,7 +1365,8 @@ void TMainWindow::Fx()
auto *dialog = new DialogEditWrongFormula(meash->GetData(), NULL_ID, this);
dialog->setWindowTitle(tr("Edit measurement"));
dialog->SetMeasurementsMode();
- dialog->SetFormula(qApp->TrVars()->TryFormulaFromUser(ui->plainTextEditFormula->toPlainText(), true));
+ dialog->SetFormula(VAbstractApplication::VApp()->TrVars()
+ ->TryFormulaFromUser(ui->plainTextEditFormula->toPlainText(), true));
const QString postfix = UnitsToStr(mUnit, true);//Show unit in dialog lable (cm, mm or inch)
dialog->setPostfix(postfix);
@@ -1433,7 +1434,7 @@ void TMainWindow::AddKnown()
{
if (mType == MeasurementsType::Individual)
{
- m->AddEmpty(name, qApp->TrVars()->MFormula(name));
+ m->AddEmpty(name, VAbstractApplication::VApp()->TrVars()->MFormula(name));
}
else
{
@@ -1452,7 +1453,7 @@ void TMainWindow::AddKnown()
{
if (mType == MeasurementsType::Individual)
{
- m->AddEmptyAfter(after, name, qApp->TrVars()->MFormula(name));
+ m->AddEmptyAfter(after, name, VAbstractApplication::VApp()->TrVars()->MFormula(name));
}
else
{
@@ -1485,10 +1486,10 @@ void TMainWindow::ImportFromPattern()
const QString filter(tr("Pattern files (*.val)"));
//Use standard path to individual measurements
- QString pathTo = qApp->TapeSettings()->GetPathPattern();
+ QString pathTo = MApplication::VApp()->TapeSettings()->GetPathPattern();
const QString mPath = QFileDialog::getOpenFileName(this, tr("Import from a pattern"), pathTo, filter, nullptr,
- qApp->NativeFileDialog());
+ VAbstractApplication::VApp()->NativeFileDialog());
if (mPath.isEmpty())
{
return;
@@ -1653,8 +1654,9 @@ void TMainWindow::ShowNewMData(bool fresh)
else
{
//Show known
- ui->plainTextEditDescription->setPlainText(qApp->TrVars()->Description(meash->GetName()));
- ui->lineEditFullName->setText(qApp->TrVars()->GuiText(meash->GetName()));
+ ui->plainTextEditDescription->setPlainText(
+ VAbstractApplication::VApp()->TrVars()->Description(meash->GetName()));
+ ui->lineEditFullName->setText(VAbstractApplication::VApp()->TrVars()->GuiText(meash->GetName()));
ui->lineEditName->setText(nameField->text());
}
connect(ui->lineEditName, &QLineEdit::textEdited, this, &TMainWindow::SaveMName);
@@ -1679,14 +1681,15 @@ void TMainWindow::ShowNewMData(bool fresh)
if (meash->IsSpecialUnits())
{
const qreal value = *data->DataVariables()->value(meash->GetName())->GetValue();
- calculatedValue = qApp->LocaleToString(value) + QChar(QChar::Space) + degreeSymbol;
+ calculatedValue = VAbstractApplication::VApp()->LocaleToString(value) + QChar(QChar::Space) +
+ degreeSymbol;
}
else
{
const QString postfix = UnitsToStr(pUnit);//Show unit in dialog lable (cm, mm or inch)
const qreal value = UnitConvertor(*data->DataVariables()->value(meash->GetName())->GetValue(), mUnit,
pUnit);
- calculatedValue = qApp->LocaleToString(value) + QChar(QChar::Space) + postfix;
+ calculatedValue = VAbstractApplication::VApp()->LocaleToString(value) + QChar(QChar::Space) + postfix;
}
ui->labelCalculatedValue->setText(calculatedValue);
@@ -1714,7 +1717,9 @@ void TMainWindow::ShowNewMData(bool fresh)
ui->plainTextEditFormula->blockSignals(true);
- QString formula = VTranslateVars::TryFormulaToUser(meash->GetFormula(), qApp->Settings()->GetOsSeparator());
+ QString formula =
+ VTranslateVars::TryFormulaToUser(meash->GetFormula(),
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator());
ui->plainTextEditFormula->setPlainText(formula);
ui->plainTextEditFormula->blockSignals(false);
@@ -1736,7 +1741,7 @@ void TMainWindow::ShowNewMData(bool fresh)
//---------------------------------------------------------------------------------------------------------------------
void TMainWindow::ShowMDiagram(const QString &name)
{
- const VTranslateVars *trv = qApp->TrVars();
+ const VTranslateVars *trv = VAbstractApplication::VApp()->TrVars();
const QString number = trv->MNumber(name);
if (number.isEmpty())
@@ -1901,7 +1906,8 @@ void TMainWindow::SaveMValue()
try
{
- const QString formula = qApp->TrVars()->FormulaFromUser(text, qApp->Settings()->GetOsSeparator());
+ const QString formula = VAbstractApplication::VApp()->TrVars()
+ ->FormulaFromUser(text, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
m->SetMValue(nameField->data(Qt::UserRole).toString(), formula);
}
catch (qmu::QmuParserError &e) // Just in case something bad will happen
@@ -2189,7 +2195,7 @@ void TMainWindow::ExportToIndividual()
QString dir;
if (curFile.isEmpty())
{
- dir = qApp->TapeSettings()->GetPathIndividualMeasurements();
+ dir = MApplication::VApp()->TapeSettings()->GetPathIndividualMeasurements();
}
else
{
@@ -2206,7 +2212,7 @@ void TMainWindow::ExportToIndividual()
QString filters = tr("Individual measurements") + QStringLiteral(" (*.vit)");
QString fName = tr("measurements.vit");
QString fileName = QFileDialog::getSaveFileName(this, tr("Export to individual"), dir + QChar('/') + fName,
- filters, nullptr, qApp->NativeFileDialog());
+ filters, nullptr, VAbstractApplication::VApp()->NativeFileDialog());
auto RemoveTempDir = qScopeGuard([usedNotExistedDir, dir]()
{
@@ -2228,7 +2234,8 @@ void TMainWindow::ExportToIndividual()
fileName += QChar('.') + suffix;
}
- QScopedPointer tmpData(new VContainer(qApp->TrVars(), &mUnit, VContainer::UniqueNamespace()));
+ QScopedPointer tmpData(
+ new VContainer(VAbstractApplication::VApp()->TrVars(), &mUnit, VContainer::UniqueNamespace()));
VMeasurements individualMeasurements(mUnit, tmpData.data());
@@ -2409,7 +2416,7 @@ void TMainWindow::SetupMenu()
// Measurements
connect(ui->actionAddCustom, &QAction::triggered, this, &TMainWindow::AddCustom);
connect(ui->actionAddKnown, &QAction::triggered, this, &TMainWindow::AddKnown);
- connect(ui->actionDatabase, &QAction::triggered, qApp, &MApplication::ShowDataBase);
+ connect(ui->actionDatabase, &QAction::triggered, MApplication::VApp(), &MApplication::ShowDataBase);
connect(ui->actionImportFromPattern, &QAction::triggered, this, &TMainWindow::ImportFromPattern);
// Window
@@ -2524,7 +2531,7 @@ void TMainWindow::InitWindow()
ui->comboBoxGender->setCurrentIndex(index);
{
- const QLocale dateLocale = QLocale(qApp->Settings()->GetLocale());
+ const QLocale dateLocale = QLocale(VAbstractApplication::VApp()->Settings()->GetLocale());
ui->dateEditBirthDate->setLocale(dateLocale);
ui->dateEditBirthDate->setDisplayFormat(dateLocale.dateFormat());
ui->dateEditBirthDate->setDate(m->BirthDate());
@@ -2969,7 +2976,7 @@ void TMainWindow::SetCurrentFile(const QString &fileName)
ui->lineEditPathToFile->setToolTip(QDir::toNativeSeparators(curFile));
ui->lineEditPathToFile->setCursorPosition(0);
ui->pushButtonShowInExplorer->setEnabled(true);
- auto settings = qApp->TapeSettings();
+ auto settings = MApplication::VApp()->TapeSettings();
QStringList files = settings->GetRecentFileList();
files.removeAll(fileName);
files.prepend(fileName);
@@ -3100,8 +3107,8 @@ void TMainWindow::RefreshTable(bool freshCall)
if (mType == MeasurementsType::Individual)
{
- QTableWidgetItem *item = AddCell(qApp->TrVars()->MToUser(meash->GetName()), currentRow, ColumnName,
- Qt::AlignVCenter); // name
+ QTableWidgetItem *item = AddCell(VAbstractApplication::VApp()->TrVars()->MToUser(meash->GetName()),
+ currentRow, ColumnName, Qt::AlignVCenter); // name
item->setData(Qt::UserRole, meash->GetName());
if (meash->IsCustom())
@@ -3110,7 +3117,8 @@ void TMainWindow::RefreshTable(bool freshCall)
}
else
{
- AddCell(qApp->TrVars()->GuiText(meash->GetName()), currentRow, ColumnFullName, Qt::AlignVCenter);
+ AddCell(VAbstractApplication::VApp()->TrVars()->GuiText(meash->GetName()), currentRow, ColumnFullName,
+ Qt::AlignVCenter);
}
QString calculatedValue;
@@ -3126,14 +3134,16 @@ void TMainWindow::RefreshTable(bool freshCall)
AddCell(calculatedValue, currentRow, ColumnCalcValue, Qt::AlignHCenter | Qt::AlignVCenter,
meash->IsFormulaOk()); // calculated value
- QString formula = VTranslateVars::TryFormulaToUser(meash->GetFormula(), qApp->Settings()->GetOsSeparator());
+ QString formula =
+ VTranslateVars::TryFormulaToUser(meash->GetFormula(),
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator());
AddCell(formula, currentRow, ColumnFormula, Qt::AlignVCenter); // formula
}
else
{
- QTableWidgetItem *item = AddCell(qApp->TrVars()->MToUser(meash->GetName()), currentRow, 0,
- Qt::AlignVCenter); // name
+ QTableWidgetItem *item = AddCell(VAbstractApplication::VApp()->TrVars()->MToUser(meash->GetName()),
+ currentRow, 0, Qt::AlignVCenter); // name
item->setData(Qt::UserRole, meash->GetName());
if (meash->IsCustom())
@@ -3142,7 +3152,8 @@ void TMainWindow::RefreshTable(bool freshCall)
}
else
{
- AddCell(qApp->TrVars()->GuiText(meash->GetName()), currentRow, ColumnFullName, Qt::AlignVCenter);
+ AddCell(VAbstractApplication::VApp()->TrVars()->GuiText(meash->GetName()), currentRow, ColumnFullName,
+ Qt::AlignVCenter);
}
QString calculatedValue;
@@ -3196,7 +3207,8 @@ QString TMainWindow::GetCustomName() const
QString name;
do
{
- name = CustomMSign + qApp->TrVars()->InternalVarToUser(measurement_) + QString::number(num);
+ name = CustomMSign + VAbstractApplication::VApp()->TrVars()->InternalVarToUser(measurement_) +
+ QString::number(num);
num++;
} while (not data->IsUnique(name));
@@ -3305,7 +3317,7 @@ void TMainWindow::UpdateWindowTitle()
}
else
{
- showName = tr("untitled %1").arg(qApp->MainWindows().size()+1);
+ showName = tr("untitled %1").arg(MApplication::VApp()->MainWindows().size()+1);
mType == MeasurementsType::Multisize ? showName += QLatin1String(".vst") : showName += QLatin1String(".vit");
}
@@ -3375,7 +3387,8 @@ bool TMainWindow::EvalFormula(const QString &formula, bool fromUser, VContainer
QString f;
if (fromUser)
{
- f = qApp->TrVars()->FormulaFromUser(formula, qApp->Settings()->GetOsSeparator());
+ f = VAbstractApplication::VApp()->TrVars()
+ ->FormulaFromUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}
else
{
@@ -3396,7 +3409,7 @@ bool TMainWindow::EvalFormula(const QString &formula, bool fromUser, VContainer
result = UnitConvertor(result, mUnit, pUnit);
}
- label->setText(qApp->LocaleToString(result) + QChar(QChar::Space) +postfix);
+ label->setText(VAbstractApplication::VApp()->LocaleToString(result) + QChar(QChar::Space) +postfix);
label->setToolTip(tr("Value"));
return true;
}
@@ -3412,7 +3425,7 @@ bool TMainWindow::EvalFormula(const QString &formula, bool fromUser, VContainer
void TMainWindow::Open(const QString &pathTo, const QString &filter)
{
const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), pathTo, filter, nullptr,
- qApp->NativeFileDialog());
+ VAbstractApplication::VApp()->NativeFileDialog());
if (not mPath.isEmpty())
{
@@ -3422,7 +3435,7 @@ void TMainWindow::Open(const QString &pathTo, const QString &filter)
}
else
{
- qApp->NewMainWindow()->LoadFile(mPath);
+ MApplication::VApp()->NewMainWindow()->LoadFile(mPath);
}
}
}
@@ -3465,7 +3478,7 @@ void TMainWindow::MeasurementGUI()
//---------------------------------------------------------------------------------------------------------------------
void TMainWindow::ReadSettings()
{
- const VTapeSettings *settings = qApp->TapeSettings();
+ const VTapeSettings *settings = MApplication::VApp()->TapeSettings();
if (settings->status() == QSettings::NoError)
{
@@ -3477,7 +3490,7 @@ void TMainWindow::ReadSettings()
ToolBarStyles();
// Stack limit
- //qApp->getUndoStack()->setUndoLimit(settings->GetUndoCount());
+ //VAbstractApplication::VApp()->getUndoStack()->setUndoLimit(settings->GetUndoCount());
}
else
{
@@ -3488,7 +3501,7 @@ void TMainWindow::ReadSettings()
//---------------------------------------------------------------------------------------------------------------------
void TMainWindow::WriteSettings()
{
- VTapeSettings *settings = qApp->TapeSettings();
+ VTapeSettings *settings = MApplication::VApp()->TapeSettings();
settings->SetGeometry(saveGeometry());
settings->SetWindowState(saveState());
settings->SetToolbarsState(saveState(APP_VERSION));
@@ -3531,7 +3544,7 @@ bool TMainWindow::LoadFromExistingFile(const QString &path)
if (not QFileInfo::exists(path))
{
qCCritical(tMainWindow, "%s", qUtf8Printable(tr("File '%1' doesn't exist!").arg(path)));
- if (qApp->IsTestMode())
+ if (MApplication::VApp()->IsTestMode())
{
qApp->exit(V_EX_NOINPUT);
}
@@ -3539,7 +3552,7 @@ bool TMainWindow::LoadFromExistingFile(const QString &path)
}
// Check if file already opened
- const QList list = qApp->MainWindows();
+ const QList list = MApplication::VApp()->MainWindows();
for (auto w : list)
{
if (w->CurrentFile() == path)
@@ -3562,7 +3575,7 @@ bool TMainWindow::LoadFromExistingFile(const QString &path)
try
{
- data = new VContainer(qApp->TrVars(), &mUnit, VContainer::UniqueNamespace());
+ data = new VContainer(VAbstractApplication::VApp()->TrVars(), &mUnit, VContainer::UniqueNamespace());
m = new VMeasurements(data);
m->setXMLContent(path);
@@ -3628,7 +3641,7 @@ bool TMainWindow::LoadFromExistingFile(const QString &path)
data = nullptr;
lock.reset();
- if (qApp->IsTestMode())
+ if (MApplication::VApp()->IsTestMode())
{
qApp->exit(V_EX_NOINPUT);
}
@@ -3637,7 +3650,7 @@ bool TMainWindow::LoadFromExistingFile(const QString &path)
}
else
{
- return qApp->NewMainWindow()->LoadFile(path);
+ return MApplication::VApp()->NewMainWindow()->LoadFile(path);
}
return true;
@@ -3651,12 +3664,12 @@ void TMainWindow::CreateWindowMenu(QMenu *menu)
QAction *action = menu->addAction(tr("&New Window"));
connect(action, &QAction::triggered, this, []()
{
- qApp->NewMainWindow()->activateWindow();
+ MApplication::VApp()->NewMainWindow()->activateWindow();
});
action->setMenuRole(QAction::NoRole);
menu->addSeparator();
- const QList windows = qApp->MainWindows();
+ const QList windows = MApplication::VApp()->MainWindows();
for (int i = 0; i < windows.count(); ++i)
{
TMainWindow *window = windows.at(i);
@@ -3683,7 +3696,7 @@ void TMainWindow::CreateWindowMenu(QMenu *menu)
bool TMainWindow::IgnoreLocking(int error, const QString &path)
{
QMessageBox::StandardButton answer = QMessageBox::Abort;
- if (not qApp->IsTestMode())
+ if (not MApplication::VApp()->IsTestMode())
{
switch(error)
{
@@ -3717,7 +3730,7 @@ bool TMainWindow::IgnoreLocking(int error, const QString &path)
{
qCDebug(tMainWindow, "Failed to lock %s", qUtf8Printable(path));
qCDebug(tMainWindow, "Error type: %d", error);
- if (qApp->IsTestMode())
+ if (MApplication::VApp()->IsTestMode())
{
switch(error)
{
@@ -3898,13 +3911,14 @@ void TMainWindow::ImportIndividualMeasurements(const QxtCsvModel &csv, const QVe
}
IndividualMeasurement measurement;
- const QString mName = CheckMName(qApp->TrVars()->MFromUser(name), importedNames);
+ const QString mName = CheckMName(VAbstractApplication::VApp()->TrVars()->MFromUser(name), importedNames);
importedNames.insert(mName);
measurement.name = mName;
const int valueColumn = map.at(static_cast(IndividualMeasurementsColumns::Value));
- measurement.value = VTranslateVars::TryFormulaFromUser(csv.text(i, valueColumn),
- qApp->Settings()->GetOsSeparator());
+ measurement.value =
+ VTranslateVars::TryFormulaFromUser(csv.text(i, valueColumn),
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator());
const bool custom = name.startsWith(CustomMSign);
if (columns > 2 && custom)
@@ -3967,7 +3981,7 @@ void TMainWindow::ImportMultisizeMeasurements(const QxtCsvModel &csv, const QVec
auto ConverToDouble = [](QString text, const QString &error)
{
text.replace(" ", QString());
- text = VTranslateVars::TryFormulaFromUser(text, qApp->Settings()->GetOsSeparator());
+ text = VTranslateVars::TryFormulaFromUser(text, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
bool ok = false;
const qreal value = QLocale::c().toDouble(text, &ok);
@@ -4013,7 +4027,7 @@ void TMainWindow::ImportMultisizeMeasurements(const QxtCsvModel &csv, const QVec
}
MultisizeMeasurement measurement;
- const QString mName = CheckMName(qApp->TrVars()->MFromUser(name), importedNames);
+ const QString mName = CheckMName(VAbstractApplication::VApp()->TrVars()->MFromUser(name), importedNames);
importedNames.insert(mName);
measurement.name = mName;
diff --git a/src/app/valentina/core/vapplication.cpp b/src/app/valentina/core/vapplication.cpp
index e5700e8cd..36e7c1621 100644
--- a/src/app/valentina/core/vapplication.cpp
+++ b/src/app/valentina/core/vapplication.cpp
@@ -148,7 +148,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
}
QString logMsg = msg;
- const bool isPatternMessage = qApp->IsWarningMessage(msg);
+ const bool isPatternMessage = VAbstractApplication::VApp()->IsWarningMessage(msg);
if (isPatternMessage)
{
logMsg = logMsg.remove(VAbstractValApplication::warningMessageSignature);
@@ -167,7 +167,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
case QtWarningMsg:
if (isPatternMessage)
{
- qApp->PostWarningMessage(logMsg, type);
+ VAbstractValApplication::VApp()->PostWarningMessage(logMsg, type);
}
debugdate += QStringLiteral(":WARNING:%1(%2)] %3: %4: %5").arg(context.file).arg(context.line)
.arg(context.function, context.category, logMsg);
@@ -176,7 +176,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
case QtCriticalMsg:
if (isPatternMessage)
{
- qApp->PostWarningMessage(logMsg, type);
+ VAbstractValApplication::VApp()->PostWarningMessage(logMsg, type);
}
debugdate += QStringLiteral(":CRITICAL:%1(%2)] %3: %4: %5").arg(context.file).arg(context.line)
.arg(context.function, context.category, logMsg);
@@ -191,7 +191,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
case QtInfoMsg:
if (isPatternMessage)
{
- qApp->PostWarningMessage(logMsg, type);
+ VAbstractValApplication::VApp()->PostWarningMessage(logMsg, type);
}
debugdate += QStringLiteral(":INFO:%1(%2)] %3: %4: %5").arg(context.file).arg(context.line)
.arg(context.function, context.category, logMsg);
@@ -205,9 +205,9 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
vStdErr().flush();
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
- (*qApp->LogFile()) << debugdate << endl;
+ (*VApplication::VApp()->LogFile()) << debugdate << endl;
#else
- (*qApp->LogFile()) << debugdate << Qt::endl;
+ (*VApplication::VApp()->LogFile()) << debugdate << Qt::endl;
#endif
}
@@ -436,7 +436,7 @@ bool VApplication::notify(QObject *receiver, QEvent *event)
void VApplication::ActivateDarkMode()
{
- VSettings *settings = qApp->ValentinaSettings();
+ VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
if (settings->GetDarkMode())
{
QFile f(QStringLiteral(":qdarkstyle/style.qss"));
@@ -769,6 +769,12 @@ bool VApplication::IsPedantic() const
return (VCommandLine::instance != nullptr) && VCommandLine::instance->IsPedantic();
}
+//---------------------------------------------------------------------------------------------------------------------
+auto VApplication::VApp() -> VApplication *
+{
+ return qobject_cast(QCoreApplication::instance());
+}
+
//---------------------------------------------------------------------------------------------------------------------
const VCommandLinePtr VApplication::CommandLine() const
{
diff --git a/src/app/valentina/core/vapplication.h b/src/app/valentina/core/vapplication.h
index 70c4bbfe7..a0b10b4e8 100644
--- a/src/app/valentina/core/vapplication.h
+++ b/src/app/valentina/core/vapplication.h
@@ -37,11 +37,6 @@
class VApplication;// use in define
-#if defined(qApp)
-#undef qApp
-#endif
-#define qApp (qobject_cast(VAbstractApplication::instance()))
-
/**
* @brief The VApplication class reimplamentation QApplication class.
*/
@@ -74,6 +69,8 @@ public:
virtual bool IsAppInGUIMode() const override;
virtual bool IsPedantic() const override;
+ static VApplication *VApp();
+
protected:
virtual void InitTrVars() override;
virtual bool event(QEvent *e) override;
diff --git a/src/app/valentina/core/vformulaproperty.cpp b/src/app/valentina/core/vformulaproperty.cpp
index e6aa5ce6c..0aba4d03e 100644
--- a/src/app/valentina/core/vformulaproperty.cpp
+++ b/src/app/valentina/core/vformulaproperty.cpp
@@ -45,7 +45,7 @@ VFormulaProperty::VFormulaProperty(const QString &name)
addChild(tmpFormula);
tmpFormula->setClearButtonEnable(true);
tmpFormula->setUpdateBehaviour(true, false);
- tmpFormula->setOsSeparator(qApp->Settings()->GetOsSeparator());
+ tmpFormula->setOsSeparator(VAbstractApplication::VApp()->Settings()->GetOsSeparator());
// Cannot use virtual function setValue in constructor
SetFormula(QVariant(0).value());
diff --git a/src/app/valentina/core/vformulapropertyeditor.cpp b/src/app/valentina/core/vformulapropertyeditor.cpp
index a52a56771..b0535b502 100644
--- a/src/app/valentina/core/vformulapropertyeditor.cpp
+++ b/src/app/valentina/core/vformulapropertyeditor.cpp
@@ -39,6 +39,7 @@
#include "../vpropertyexplorer/vproperty.h"
#include "../vtools/dialogs/support/dialogeditwrongformula.h"
+#include "vapplication.h"
// VFormulaPropertyEditor
//---------------------------------------------------------------------------------------------------------------------
@@ -87,8 +88,9 @@ void VFormulaPropertyEditor::SetFormula(const VFormula& formula)
//---------------------------------------------------------------------------------------------------------------------
void VFormulaPropertyEditor::onToolButtonClicked()
{
- QScopedPointer tmpWidget(new DialogEditWrongFormula(formula.getData(), formula.getToolId(),
- qApp->getMainWindow()));
+ QScopedPointer tmpWidget(
+ new DialogEditWrongFormula(formula.getData(), formula.getToolId(),
+ VAbstractValApplication::VApp()->getMainWindow()));
tmpWidget->setCheckZero(formula.getCheckZero());
tmpWidget->setPostfix(formula.getPostfix());
tmpWidget->SetFormula(formula.GetFormula(FormulaType::FromUser));
diff --git a/src/app/valentina/core/vtooloptionspropertybrowser.cpp b/src/app/valentina/core/vtooloptionspropertybrowser.cpp
index bf71188c2..2bd34452e 100644
--- a/src/app/valentina/core/vtooloptionspropertybrowser.cpp
+++ b/src/app/valentina/core/vtooloptionspropertybrowser.cpp
@@ -460,7 +460,7 @@ void VToolOptionsPropertyBrowser::userChangedData(VPE::VProperty *property)
default:
break;
}
- qApp->getSceneView()->update();
+ VAbstractValApplication::VApp()->getSceneView()->update();
}
//---------------------------------------------------------------------------------------------------------------------
@@ -540,7 +540,7 @@ void VToolOptionsPropertyBrowser::AddPropertyAlias(Tool *i, const QString &prope
{
auto *itemName = new VPE::VStringProperty(propertyName);
itemName->setClearButtonEnable(true);
- itemName->setValue(qApp->TrVars()->VarToUser(i->GetAliasSuffix()));
+ itemName->setValue(VAbstractApplication::VApp()->TrVars()->VarToUser(i->GetAliasSuffix()));
AddProperty(itemName, AttrAlias);
}
@@ -550,7 +550,7 @@ void VToolOptionsPropertyBrowser::AddPropertyAlias1(Tool *i, const QString &prop
{
auto *itemName = new VPE::VStringProperty(propertyName);
itemName->setClearButtonEnable(true);
- itemName->setValue(qApp->TrVars()->VarToUser(i->GetAliasSuffix1()));
+ itemName->setValue(VAbstractApplication::VApp()->TrVars()->VarToUser(i->GetAliasSuffix1()));
AddProperty(itemName, AttrAlias1);
}
@@ -560,7 +560,7 @@ void VToolOptionsPropertyBrowser::AddPropertyAlias2(Tool *i, const QString &prop
{
auto *itemName = new VPE::VStringProperty(propertyName);
itemName->setClearButtonEnable(true);
- itemName->setValue(qApp->TrVars()->VarToUser(i->GetAliasSuffix2()));
+ itemName->setValue(VAbstractApplication::VApp()->TrVars()->VarToUser(i->GetAliasSuffix2()));
AddProperty(itemName, AttrAlias2);
}
@@ -2066,14 +2066,16 @@ void VToolOptionsPropertyBrowser::ChangeDataToolSpline(VPE::VProperty *property)
case 36: // AttrLength1
if (not f.error() && f.getDoubleValue() >= 0)
{
- spl.SetC1Length(qApp->toPixel(f.getDoubleValue()), f.GetFormula(FormulaType::FromUser));
+ spl.SetC1Length(VAbstractValApplication::VApp()->toPixel(f.getDoubleValue()),
+ f.GetFormula(FormulaType::FromUser));
i->setSpline(spl);
}
break;
case 37: // AttrLength2
if (not f.error() && f.getDoubleValue() >= 0)
{
- spl.SetC2Length(qApp->toPixel(f.getDoubleValue()), f.GetFormula(FormulaType::FromUser));
+ spl.SetC2Length(VAbstractValApplication::VApp()->toPixel(f.getDoubleValue()),
+ f.GetFormula(FormulaType::FromUser));
i->setSpline(spl);
}
break;
@@ -2887,7 +2889,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolSpline(QGraphicsItem *item)
VFormula length1(spl.GetC1LengthFormula(), i->getData());
length1.setCheckZero(false);
length1.setToolId(i->getId());
- length1.setPostfix(UnitsToStr(qApp->patternUnits()));
+ length1.setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits()));
length1.Eval();
AddPropertyFormula(tr("C1: length:"), length1, AttrLength1);
@@ -2901,7 +2903,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolSpline(QGraphicsItem *item)
VFormula length2(spl.GetC2LengthFormula(), i->getData());
length2.setCheckZero(false);
length2.setToolId(i->getId());
- length2.setPostfix(UnitsToStr(qApp->patternUnits()));
+ length2.setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits()));
length2.Eval();
AddPropertyFormula(tr("C2: length:"), length2, AttrLength2);
@@ -3693,7 +3695,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSpline()
VFormula length1F(spl.GetC1LengthFormula(), i->getData());
length1F.setCheckZero(false);
length1F.setToolId(i->getId());
- length1F.setPostfix(UnitsToStr(qApp->patternUnits()));
+ length1F.setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits()));
length1F.Eval();
QVariant length1;
length1.setValue(length1F);
@@ -3711,7 +3713,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSpline()
VFormula length2F(spl.GetC2LengthFormula(), i->getData());
length2F.setCheckZero(false);
length2F.setToolId(i->getId());
- length2F.setPostfix(UnitsToStr(qApp->patternUnits()));
+ length2F.setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits()));
length2F.Eval();
QVariant length2;
length2.setValue(length2F);
diff --git a/src/app/valentina/dialogs/configpages/preferencesconfigurationpage.cpp b/src/app/valentina/dialogs/configpages/preferencesconfigurationpage.cpp
index f3e88df3a..e2f5320f4 100644
--- a/src/app/valentina/dialogs/configpages/preferencesconfigurationpage.cpp
+++ b/src/app/valentina/dialogs/configpages/preferencesconfigurationpage.cpp
@@ -51,7 +51,7 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent)
ui->tabWidget->setCurrentIndex(0);
// Tab General
- ui->autoSaveCheck->setChecked(qApp->ValentinaSettings()->GetAutosaveState());
+ ui->autoSaveCheck->setChecked(VAbstractValApplication::VApp()->ValentinaSettings()->GetAutosaveState());
InitLanguages(ui->langCombo);
connect(ui->langCombo, QOverload::of(&QComboBox::currentIndexChanged), this, [this]()
@@ -60,11 +60,11 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent)
});
//-------------------- Decimal separator setup
- ui->osOptionCheck->setChecked(qApp->ValentinaSettings()->GetOsSeparator());
+ ui->osOptionCheck->setChecked(VAbstractValApplication::VApp()->ValentinaSettings()->GetOsSeparator());
//----------------------- Unit setup
// set default unit
- const qint32 indexUnit = ui->unitCombo->findData(qApp->ValentinaSettings()->GetUnit());
+ const qint32 indexUnit = ui->unitCombo->findData(VAbstractValApplication::VApp()->ValentinaSettings()->GetUnit());
if (indexUnit != -1)
{
ui->unitCombo->setCurrentIndex(indexUnit);
@@ -78,7 +78,7 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent)
//----------------------- Label language
SetLabelComboBox(VApplication::LabelLanguages());
- int index = ui->labelCombo->findData(qApp->ValentinaSettings()->GetLabelLanguage());
+ int index = ui->labelCombo->findData(VAbstractValApplication::VApp()->ValentinaSettings()->GetLabelLanguage());
if (index != -1)
{
ui->labelCombo->setCurrentIndex(index);
@@ -93,16 +93,17 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent)
connect(ui->systemCombo, QOverload::of(&QComboBox::currentIndexChanged), this, [this]()
{
m_systemChanged = true;
- QString text = qApp->TrVars()->PMSystemAuthor(ui->systemCombo->currentData().toString());
+ QString text = VAbstractApplication::VApp()->TrVars()
+ ->PMSystemAuthor(ui->systemCombo->currentData().toString());
ui->systemAuthorValueLabel->setText(text);
ui->systemAuthorValueLabel->setToolTip(text);
- text = qApp->TrVars()->PMSystemBook(ui->systemCombo->currentData().toString());
+ text = VAbstractApplication::VApp()->TrVars()->PMSystemBook(ui->systemCombo->currentData().toString());
ui->systemBookValueLabel->setPlainText(text);
});
// set default pattern making system
- index = ui->systemCombo->findData(qApp->ValentinaSettings()->GetPMSystemCode());
+ index = ui->systemCombo->findData(VAbstractValApplication::VApp()->ValentinaSettings()->GetPMSystemCode());
if (index != -1)
{
ui->systemCombo->setCurrentIndex(index);
@@ -111,13 +112,13 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent)
//----------------------------- Pattern Editing
connect(ui->resetWarningsButton, &QPushButton::released, this, []()
{
- VSettings *settings = qApp->ValentinaSettings();
+ VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
settings->SetConfirmItemDelete(true);
settings->SetConfirmFormatRewriting(true);
});
- VSettings *settings = qApp->ValentinaSettings();
+ VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
ui->checkBoxFreeCurve->setChecked(settings->IsFreeCurveMode());
ui->checkBoxZoomFitBestCurrentPP->setChecked(settings->IsDoubleClickZoomFitBestCurrentPP());
@@ -167,11 +168,11 @@ QStringList PreferencesConfigurationPage::Apply()
{
// Tab General
QStringList preferences;
- VSettings *settings = qApp->ValentinaSettings();
+ VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
settings->SetAutosaveState(ui->autoSaveCheck->isChecked());
settings->SetAutosaveTime(ui->autoTime->value());
- QTimer *autoSaveTimer = qApp->getAutoSaveTimer();
+ QTimer *autoSaveTimer = VApplication::VApp()->getAutoSaveTimer();
SCASSERT(autoSaveTimer)
ui->autoSaveCheck->isChecked() ? autoSaveTimer->start(ui->autoTime->value()*60000) : autoSaveTimer->stop();
@@ -208,7 +209,7 @@ QStringList PreferencesConfigurationPage::Apply()
settings->SetPMSystemCode(code);
m_systemChanged = false;
- qApp->LoadTranslation(locale);
+ VAbstractApplication::VApp()->LoadTranslation(locale);
}
if (m_unitChanged)
{
diff --git a/src/app/valentina/dialogs/configpages/preferencespathpage.cpp b/src/app/valentina/dialogs/configpages/preferencespathpage.cpp
index c700941e3..6ffe3b2df 100644
--- a/src/app/valentina/dialogs/configpages/preferencespathpage.cpp
+++ b/src/app/valentina/dialogs/configpages/preferencespathpage.cpp
@@ -65,7 +65,7 @@ PreferencesPathPage::~PreferencesPathPage()
//---------------------------------------------------------------------------------------------------------------------
QStringList PreferencesPathPage::Apply()
{
- VSettings *settings = qApp->ValentinaSettings();
+ VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
settings->SetPathIndividualMeasurements(ui->pathTable->item(0, 1)->text());
settings->SetPathMultisizeMeasurements(ui->pathTable->item(1, 1)->text());
settings->SetPathPattern(ui->pathTable->item(2, 1)->text());
@@ -137,23 +137,23 @@ void PreferencesPathPage::EditPath()
switch (row)
{
case 0: // individual measurements
- path = qApp->ValentinaSettings()->GetPathIndividualMeasurements();
+ path = VAbstractValApplication::VApp()->ValentinaSettings()->GetPathIndividualMeasurements();
break;
case 1: // multisize measurements
- path = qApp->ValentinaSettings()->GetPathMultisizeMeasurements();
+ path = VAbstractValApplication::VApp()->ValentinaSettings()->GetPathMultisizeMeasurements();
path = VCommonSettings::PrepareMultisizeTables(path);
break;
case 2: // pattern path
- path = qApp->ValentinaSettings()->GetPathPattern();
+ path = VAbstractValApplication::VApp()->ValentinaSettings()->GetPathPattern();
break;
case 3: // layout path
- path = qApp->ValentinaSettings()->GetPathLayout();
+ path = VAbstractValApplication::VApp()->ValentinaSettings()->GetPathLayout();
break;
case 4: // templates
- path = qApp->ValentinaSettings()->GetPathTemplate();
+ path = VAbstractValApplication::VApp()->ValentinaSettings()->GetPathTemplate();
break;
case 5: // label templates
- path = qApp->ValentinaSettings()->GetPathLabelTemplate();
+ path = VAbstractValApplication::VApp()->ValentinaSettings()->GetPathLabelTemplate();
break;
default:
break;
@@ -168,7 +168,7 @@ void PreferencesPathPage::EditPath()
const QString dir = QFileDialog::getExistingDirectory(
this, tr("Open Directory"), path,
- qApp->NativeFileDialog(QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks));
+ VAbstractApplication::VApp()->NativeFileDialog(QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks));
if (dir.isEmpty())
{
if (usedNotExistedDir)
@@ -195,7 +195,7 @@ void PreferencesPathPage::InitTable()
ui->pathTable->setRowCount(6);
ui->pathTable->setColumnCount(2);
- const VSettings *settings = qApp->ValentinaSettings();
+ const VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
{
ui->pathTable->setItem(0, 0, new QTableWidgetItem(tr("My Individual Measurements")));
diff --git a/src/app/valentina/dialogs/configpages/preferencespatternpage.cpp b/src/app/valentina/dialogs/configpages/preferencespatternpage.cpp
index be9dde58c..193a48960 100644
--- a/src/app/valentina/dialogs/configpages/preferencespatternpage.cpp
+++ b/src/app/valentina/dialogs/configpages/preferencespatternpage.cpp
@@ -64,7 +64,7 @@ PreferencesPatternPage::PreferencesPatternPage(QWidget *parent)
ui->setupUi(this);
RetranslateUi();
- VSettings *settings = qApp->ValentinaSettings();
+ VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
ui->graphOutputCheck->setChecked(settings->GetGraphicalOutput());
ui->checkBoxOpenGLRender->setChecked(settings->IsOpenGLRender());
@@ -126,12 +126,12 @@ QStringList PreferencesPatternPage::Apply()
{
QStringList preferences;
- VSettings *settings = qApp->ValentinaSettings();
+ VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
// Scene antialiasing
if (settings->GetGraphicalOutput() != ui->graphOutputCheck->isChecked())
{
- if (qApp->getSceneView()->IsOpenGLRender())
+ if (VAbstractValApplication::VApp()->getSceneView()->IsOpenGLRender())
{
preferences.append(tr("antialiasing"));
}
@@ -147,7 +147,7 @@ QStringList PreferencesPatternPage::Apply()
settings->SetCurveApproximationScale(ui->doubleSpinBoxCurveApproximation->value());
settings->SetLineWidth(UnitConvertor(ui->doubleSpinBoxLineWidth->value(), m_oldLineUnit, Unit::Mm));
- qApp->getSceneView()->SetAntialiasing(ui->graphOutputCheck->isChecked());
+ VAbstractValApplication::VApp()->getSceneView()->SetAntialiasing(ui->graphOutputCheck->isChecked());
/* Maximum number of commands in undo stack may only be set when the undo stack is empty, since setting it on a
* non-empty stack might delete the command at the current index. Calling setUndoLimit() on a non-empty stack
@@ -163,7 +163,7 @@ QStringList PreferencesPatternPage::Apply()
if (settings->IsDoublePassmark() != ui->doublePassmarkCheck->isChecked())
{
settings->SetDoublePassmark(ui->doublePassmarkCheck->isChecked());
- qApp->getCurrentDocument()->LiteParseTree(Document::LiteParse);
+ VAbstractValApplication::VApp()->getCurrentDocument()->LiteParseTree(Document::LiteParse);
}
settings->SetLabelDateFormat(ui->comboBoxDateFormats->currentText());
@@ -181,8 +181,9 @@ QStringList PreferencesPatternPage::Apply()
//---------------------------------------------------------------------------------------------------------------------
void PreferencesPatternPage::InitDefaultSeamAllowance()
{
- ui->defaultSeamAllowance->setValue(qApp->ValentinaSettings()->GetDefaultSeamAllowance());
- ui->defaultSeamAllowance->setSuffix(UnitsToStr(StrToUnits(qApp->ValentinaSettings()->GetUnit()), true));
+ ui->defaultSeamAllowance->setValue(VAbstractValApplication::VApp()->ValentinaSettings()->GetDefaultSeamAllowance());
+ ui->defaultSeamAllowance->setSuffix(
+ UnitsToStr(StrToUnits(VAbstractValApplication::VApp()->ValentinaSettings()->GetUnit()), true));
}
//---------------------------------------------------------------------------------------------------------------------
@@ -201,7 +202,7 @@ void PreferencesPatternPage::changeEvent(QEvent *event)
//---------------------------------------------------------------------------------------------------------------------
void PreferencesPatternPage::EditDateTimeFormats()
{
- VSettings *settings = qApp->ValentinaSettings();
+ VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
QPushButton *button = qobject_cast(sender());
if (button == ui->pushButtonEditDateFormats)
@@ -231,7 +232,7 @@ void PreferencesPatternPage::ManageKnownMaterials()
//---------------------------------------------------------------------------------------------------------------------
void PreferencesPatternPage::InitLabelDateTimeFormats()
{
- VSettings *settings = qApp->ValentinaSettings();
+ VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
InitComboBoxFormats(ui->comboBoxDateFormats,
VCommonSettings::PredefinedDateFormats() + settings->GetUserDefinedDateFormats(),
diff --git a/src/app/valentina/dialogs/dialogaboutapp.cpp b/src/app/valentina/dialogs/dialogaboutapp.cpp
index e57b10a67..d4efe750c 100644
--- a/src/app/valentina/dialogs/dialogaboutapp.cpp
+++ b/src/app/valentina/dialogs/dialogaboutapp.cpp
@@ -45,7 +45,8 @@ DialogAboutApp::DialogAboutApp(QWidget *parent) :
{
ui->setupUi(this);
- qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
+ VAbstractValApplication::VApp()->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale())
+ : setLocale(QLocale::c());
ui->label_Valentina_Version->setText(QString("Valentina %1").arg(APP_VERSION_STR));
ui->labelBuildRevision->setText(QString("Build revision: %1").arg(BUILD_REVISION));
diff --git a/src/app/valentina/dialogs/dialogfinalmeasurements.cpp b/src/app/valentina/dialogs/dialogfinalmeasurements.cpp
index 923e22a69..f6b2e8845 100644
--- a/src/app/valentina/dialogs/dialogfinalmeasurements.cpp
+++ b/src/app/valentina/dialogs/dialogfinalmeasurements.cpp
@@ -35,6 +35,7 @@
#include "../vpatterndb/vtranslatevars.h"
#include "../vpatterndb/calculator.h"
#include "../vtools/dialogs/support/dialogeditwrongformula.h"
+#include "../core/vapplication.h"
#include
#define DIALOG_MAX_FORMULA_HEIGHT 64
@@ -66,9 +67,8 @@ DialogFinalMeasurements::DialogFinalMeasurements(VPattern *doc, QWidget *parent)
formulaBaseHeight = ui->plainTextEditFormula->height();
ui->plainTextEditFormula->installEventFilter(this);
- qApp->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
- qCDebug(vDialog, "Showing variables.");
ShowUnits();
const bool freshCall = true;
@@ -151,7 +151,7 @@ bool DialogFinalMeasurements::eventFilter(QObject *object, QEvent *event)
QKeyEvent *keyEvent = static_cast(event);
if ((keyEvent->key() == Qt::Key_Period) && (keyEvent->modifiers() & Qt::KeypadModifier))
{
- if (qApp->Settings()->GetOsSeparator())
+ if (VAbstractApplication::VApp()->Settings()->GetOsSeparator())
{
textEdit->insert(QLocale().decimalPoint());
}
@@ -186,7 +186,7 @@ void DialogFinalMeasurements::showEvent(QShowEvent *event)
}
// do your init stuff here
- const QSize sz = qApp->Settings()->GetFinalMeasurementsDialogSize();
+ const QSize sz = VAbstractApplication::VApp()->Settings()->GetFinalMeasurementsDialogSize();
if (not sz.isEmpty())
{
resize(sz);
@@ -203,7 +203,7 @@ void DialogFinalMeasurements::resizeEvent(QResizeEvent *event)
// dialog creating, which would
if (m_isInitialized)
{
- qApp->Settings()->SetFinalMeasurementsDialogSize(size());
+ VAbstractApplication::VApp()->Settings()->SetFinalMeasurementsDialogSize(size());
}
QDialog::resizeEvent(event);
}
@@ -228,7 +228,8 @@ void DialogFinalMeasurements::ShowFinalMeasurementDetails()
EvalUserFormula(m.formula, false);
ui->plainTextEditFormula->blockSignals(true);
- const QString formula = VTranslateVars::TryFormulaToUser(m.formula, qApp->Settings()->GetOsSeparator());
+ const QString formula =
+ VTranslateVars::TryFormulaToUser(m.formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
ui->plainTextEditFormula->setPlainText(formula);
ui->plainTextEditFormula->blockSignals(false);
@@ -373,7 +374,7 @@ void DialogFinalMeasurements::SaveFormula()
{
QTableWidgetItem *result = ui->tableWidget->item(row, 1);
//Show unit in dialog lable (cm, mm or inch)
- const QString postfix = UnitsToStr(qApp->patternUnits());
+ const QString postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits());
ui->labelCalculatedValue->setText(result->text() + QChar(QChar::Space) +postfix);
return;
}
@@ -381,7 +382,7 @@ void DialogFinalMeasurements::SaveFormula()
if (text.isEmpty())
{
//Show unit in dialog lable (cm, mm or inch)
- const QString postfix = UnitsToStr(qApp->patternUnits());
+ const QString postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits());
ui->labelCalculatedValue->setText(tr("Error") + " (" + postfix + "). " + tr("Empty field."));
return;
}
@@ -393,7 +394,8 @@ void DialogFinalMeasurements::SaveFormula()
try
{
- m_measurements[row].formula = qApp->TrVars()->FormulaFromUser(text, qApp->Settings()->GetOsSeparator());
+ m_measurements[row].formula = VAbstractApplication::VApp()->TrVars()
+ ->FormulaFromUser(text, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}
catch (qmu::QmuParserError &e) // Just in case something bad will happen
{
@@ -453,9 +455,10 @@ void DialogFinalMeasurements::Fx()
QScopedPointer dialog(new DialogEditWrongFormula(&m_data, NULL_ID, this));
dialog->setWindowTitle(tr("Edit measurement"));
- dialog->SetFormula(qApp->TrVars()->TryFormulaFromUser(ui->plainTextEditFormula->toPlainText(),
- qApp->Settings()->GetOsSeparator()));
- const QString postfix = UnitsToStr(qApp->patternUnits(), true);
+ dialog->SetFormula(VAbstractApplication::VApp()->TrVars()
+ ->TryFormulaFromUser(ui->plainTextEditFormula->toPlainText(),
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
+ const QString postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
dialog->setPostfix(postfix);//Show unit in dialog lable (cm, mm or inch)
if (dialog->exec() == QDialog::Accepted)
@@ -494,9 +497,12 @@ void DialogFinalMeasurements::FillFinalMeasurements(bool freshCall)
bool ok = true;
const qreal result = EvalFormula(m.formula, ok);
- AddCell(qApp->LocaleToString(result), i, 1, Qt::AlignHCenter | Qt::AlignVCenter, ok); // calculated value
+ AddCell(VAbstractApplication::VApp()
+ ->LocaleToString(result), i, 1, Qt::AlignHCenter | Qt::AlignVCenter, ok); // calculated value
- const QString formula = VTranslateVars::TryFormulaFromUser(m.formula, qApp->Settings()->GetOsSeparator());
+ const QString formula =
+ VTranslateVars::TryFormulaFromUser(m.formula,
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator());
AddCell(formula, i, 2, Qt::AlignVCenter); // formula
}
@@ -513,7 +519,7 @@ void DialogFinalMeasurements::FillFinalMeasurements(bool freshCall)
//---------------------------------------------------------------------------------------------------------------------
void DialogFinalMeasurements::ShowUnits()
{
- const QString unit = UnitsToStr(qApp->patternUnits());
+ const QString unit = UnitsToStr(VAbstractValApplication::VApp()->patternUnits());
{
// calculated value
@@ -554,7 +560,8 @@ void DialogFinalMeasurements::AddCell(const QString &text, int row, int column,
//---------------------------------------------------------------------------------------------------------------------
bool DialogFinalMeasurements::EvalUserFormula(const QString &formula, bool fromUser)
{
- const QString postfix = UnitsToStr(qApp->patternUnits());//Show unit in dialog lable (cm, mm or inch)
+ const QString postfix =
+ UnitsToStr(VAbstractValApplication::VApp()->patternUnits());//Show unit in dialog lable (cm, mm or inch)
if (formula.isEmpty())
{
ui->labelCalculatedValue->setText(tr("Error") + " (" + postfix + "). " + tr("Empty field."));
@@ -569,7 +576,8 @@ bool DialogFinalMeasurements::EvalUserFormula(const QString &formula, bool fromU
// Replace line return character with spaces for calc if exist
if (fromUser)
{
- f = qApp->TrVars()->FormulaFromUser(formula, qApp->Settings()->GetOsSeparator());
+ f = VAbstractApplication::VApp()->TrVars()
+ ->FormulaFromUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}
else
{
@@ -586,7 +594,8 @@ bool DialogFinalMeasurements::EvalUserFormula(const QString &formula, bool fromU
return false;
}
- ui->labelCalculatedValue->setText(qApp->LocaleToString(result) + QChar(QChar::Space) + postfix);
+ ui->labelCalculatedValue->setText(
+ VAbstractApplication::VApp()->LocaleToString(result) + QChar(QChar::Space) + postfix);
ui->labelCalculatedValue->setToolTip(tr("Value"));
return true;
}
diff --git a/src/app/valentina/dialogs/dialoghistory.cpp b/src/app/valentina/dialogs/dialoghistory.cpp
index ec6c1ce22..dd38d51c9 100644
--- a/src/app/valentina/dialogs/dialoghistory.cpp
+++ b/src/app/valentina/dialogs/dialoghistory.cpp
@@ -58,7 +58,7 @@ DialogHistory::DialogHistory(VContainer *data, VPattern *doc, QWidget *parent)
{
ui->setupUi(this);
- qApp->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogHistory::DialogAccepted);
diff --git a/src/app/valentina/dialogs/dialogincrements.cpp b/src/app/valentina/dialogs/dialogincrements.cpp
index da7c69478..c50fdd14e 100644
--- a/src/app/valentina/dialogs/dialogincrements.cpp
+++ b/src/app/valentina/dialogs/dialogincrements.cpp
@@ -90,7 +90,7 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par
formulaBaseHeightPC = ui->plainTextEditFormulaPC->height();
ui->plainTextEditFormulaPC->installEventFilter(this);
- qApp->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
qCDebug(vDialog, "Showing variables.");
ShowUnits();
@@ -214,7 +214,7 @@ void DialogIncrements::FillTable(const QMap &varTable, QTableWidget
item->setFont(font);
table->setItem(currentRow, 0, item);
- item = new QTableWidgetItem(qApp->LocaleToString(length));
+ item = new QTableWidgetItem(VAbstractApplication::VApp()->LocaleToString(length));
item->setTextAlignment(Qt::AlignHCenter);
table->setItem(currentRow, 1, item);
}
@@ -268,7 +268,7 @@ void DialogIncrements::FillAnglesCurves()
//---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::ShowUnits()
{
- const QString unit = UnitsToStr(qApp->patternUnits());
+ const QString unit = UnitsToStr(VAbstractValApplication::VApp()->patternUnits());
ShowHeaderUnits(ui->tableWidgetIncrement, 1, unit);// calculated value
ShowHeaderUnits(ui->tableWidgetIncrement, 2, unit);// formula
@@ -340,7 +340,8 @@ QString DialogIncrements::GetCustomName() const
QString name;
do
{
- name = CustomIncrSign + qApp->TrVars()->InternalVarToUser(increment_) + QString().number(num);
+ name = CustomIncrSign + VAbstractApplication::VApp()->TrVars()->InternalVarToUser(increment_) +
+ QString().number(num);
num++;
} while (not data->IsUnique(name));
return name;
@@ -361,7 +362,8 @@ QString DialogIncrements::ClearIncrementName(const QString &name) const
//---------------------------------------------------------------------------------------------------------------------
bool DialogIncrements::EvalIncrementFormula(const QString &formula, bool fromUser, VContainer *data, QLabel *label)
{
- const QString postfix = UnitsToStr(qApp->patternUnits());//Show unit in dialog lable (cm, mm or inch)
+ const QString postfix =
+ UnitsToStr(VAbstractValApplication::VApp()->patternUnits());//Show unit in dialog lable (cm, mm or inch)
if (formula.isEmpty())
{
label->setText(tr("Error") + " (" + postfix + "). " + tr("Empty field."));
@@ -376,7 +378,8 @@ bool DialogIncrements::EvalIncrementFormula(const QString &formula, bool fromUse
// Replace line return character with spaces for calc if exist
if (fromUser)
{
- f = qApp->TrVars()->FormulaFromUser(formula, qApp->Settings()->GetOsSeparator());
+ f = VAbstractApplication::VApp()->TrVars()
+ ->FormulaFromUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}
else
{
@@ -392,7 +395,7 @@ bool DialogIncrements::EvalIncrementFormula(const QString &formula, bool fromUse
return false;
}
- label->setText(qApp->LocaleToString(result) + QChar(QChar::Space) + postfix);
+ label->setText(VAbstractApplication::VApp()->LocaleToString(result) + QChar(QChar::Space) + postfix);
label->setToolTip(tr("Value"));
return true;
}
@@ -729,7 +732,9 @@ void DialogIncrements::ShowTableIncrementDetails(QTableWidget *table)
EvalIncrementFormula(incr->GetFormula(), false, incr->GetData(), labelCalculatedValue);
plainTextEditFormula->blockSignals(true);
- QString formula = VTranslateVars::TryFormulaToUser(incr->GetFormula(), qApp->Settings()->GetOsSeparator());
+ QString formula =
+ VTranslateVars::TryFormulaToUser(incr->GetFormula(),
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator());
plainTextEditFormula->setPlainText(formula);
plainTextEditFormula->blockSignals(false);
@@ -906,10 +911,13 @@ void DialogIncrements::FillIncrementsTable(QTableWidget *table,
if (incr->GetType() == VarType::Increment)
{
AddCell(table, incr->GetName(), currentRow, 0, Qt::AlignVCenter); // name
- AddCell(table, qApp->LocaleToString(*incr->GetValue()), currentRow, 1, Qt::AlignCenter,
+ AddCell(table, VAbstractApplication::VApp()->
+ LocaleToString(*incr->GetValue()), currentRow, 1, Qt::AlignCenter,
incr->IsFormulaOk()); // calculated value
- QString formula = VTranslateVars::TryFormulaToUser(incr->GetFormula(), qApp->Settings()->GetOsSeparator());
+ QString formula =
+ VTranslateVars::TryFormulaToUser(incr->GetFormula(),
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator());
AddCell(table, formula, currentRow, 2, Qt::AlignVCenter); // formula
@@ -1228,7 +1236,7 @@ void DialogIncrements::SaveIncrFormula()
{
QTableWidgetItem *result = table->item(row, 1);
//Show unit in dialog lable (cm, mm or inch)
- const QString postfix = UnitsToStr(qApp->patternUnits());
+ const QString postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits());
labelCalculatedValue->setText(result->text() + QChar(QChar::Space) +postfix);
return;
}
@@ -1236,7 +1244,7 @@ void DialogIncrements::SaveIncrFormula()
if (text.isEmpty())
{
//Show unit in dialog lable (cm, mm or inch)
- const QString postfix = UnitsToStr(qApp->patternUnits());
+ const QString postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits());
labelCalculatedValue->setText(tr("Error") + " (" + postfix + "). " + tr("Empty field."));
return;
}
@@ -1254,7 +1262,8 @@ void DialogIncrements::SaveIncrFormula()
try
{
- const QString formula = qApp->TrVars()->FormulaFromUser(text, qApp->Settings()->GetOsSeparator());
+ const QString formula = VAbstractApplication::VApp()->TrVars()
+ ->FormulaFromUser(text, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
doc->SetIncrementFormula(nameField->text(), formula);
}
catch (qmu::QmuParserError &e) // Just in case something bad will happen
@@ -1372,9 +1381,10 @@ void DialogIncrements::Fx()
dialog->setWindowTitle(tr("Edit increment"));
incrementMode ? dialog->SetIncrementsMode() : dialog->SetPreviewCalculationsMode();
- dialog->SetFormula(qApp->TrVars()->TryFormulaFromUser(plainTextEditFormula->toPlainText(),
- qApp->Settings()->GetOsSeparator()));
- const QString postfix = UnitsToStr(qApp->patternUnits(), true);
+ dialog->SetFormula(VAbstractApplication::VApp()->TrVars()
+ ->TryFormulaFromUser(plainTextEditFormula->toPlainText(),
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
+ const QString postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
dialog->setPostfix(postfix);//Show unit in dialog lable (cm, mm or inch)
if (dialog->exec() == QDialog::Accepted)
@@ -1434,7 +1444,7 @@ bool DialogIncrements::eventFilter(QObject *object, QEvent *event)
QKeyEvent *keyEvent = static_cast(event);
if ((keyEvent->key() == Qt::Key_Period) && (keyEvent->modifiers() & Qt::KeypadModifier))
{
- if (qApp->Settings()->GetOsSeparator())
+ if (VAbstractApplication::VApp()->Settings()->GetOsSeparator())
{
textEdit->insert(QLocale().decimalPoint());
}
@@ -1467,7 +1477,7 @@ void DialogIncrements::showEvent(QShowEvent *event)
}
// do your init stuff here
- const QSize sz = qApp->Settings()->GetIncrementsDialogSize();
+ const QSize sz = VAbstractApplication::VApp()->Settings()->GetIncrementsDialogSize();
if (not sz.isEmpty())
{
resize(sz);
@@ -1484,7 +1494,7 @@ void DialogIncrements::resizeEvent(QResizeEvent *event)
// dialog creating, which would
if (isInitialized)
{
- qApp->Settings()->SetIncrementsDialogSize(size());
+ VAbstractApplication::VApp()->Settings()->SetIncrementsDialogSize(size());
}
DialogTool::resizeEvent(event);
}
diff --git a/src/app/valentina/dialogs/dialoglayoutprogress.cpp b/src/app/valentina/dialogs/dialoglayoutprogress.cpp
index f8b2dd4db..c760b0b54 100644
--- a/src/app/valentina/dialogs/dialoglayoutprogress.cpp
+++ b/src/app/valentina/dialogs/dialoglayoutprogress.cpp
@@ -48,7 +48,8 @@ DialogLayoutProgress::DialogLayoutProgress(QElapsedTimer timer, qint64 timeout,
{
ui->setupUi(this);
- qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
+ VAbstractValApplication::VApp()->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale())
+ : setLocale(QLocale::c());
ui->progressBar->setMaximum(static_cast(timeout/1000));
ui->progressBar->setValue(0);
diff --git a/src/app/valentina/dialogs/dialoglayoutsettings.cpp b/src/app/valentina/dialogs/dialoglayoutsettings.cpp
index 9087e3c2c..87a573f6a 100644
--- a/src/app/valentina/dialogs/dialoglayoutsettings.cpp
+++ b/src/app/valentina/dialogs/dialoglayoutsettings.cpp
@@ -50,7 +50,8 @@ DialogLayoutSettings::DialogLayoutSettings(VLayoutGenerator *generator, QWidget
{
ui->setupUi(this);
- qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
+ VAbstractValApplication::VApp()->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale())
+ : setLocale(QLocale::c());
//moved from ReadSettings - well...it seems it can be done once only (i.e. constructor) because Init funcs dont
//even cleanse lists before adding
@@ -764,8 +765,9 @@ void DialogLayoutSettings::InitPaperUnits()
ui->comboBoxPaperSizeUnit->addItem(tr("Pixels"), QVariant(UnitsToStr(Unit::Px)));
// set default unit
- oldPaperUnit = StrToUnits(qApp->ValentinaSettings()->GetUnit());
- const qint32 indexUnit = ui->comboBoxPaperSizeUnit->findData(qApp->ValentinaSettings()->GetUnit());
+ oldPaperUnit = StrToUnits(VAbstractValApplication::VApp()->ValentinaSettings()->GetUnit());
+ const qint32 indexUnit = ui->comboBoxPaperSizeUnit->findData(
+ VAbstractValApplication::VApp()->ValentinaSettings()->GetUnit());
if (indexUnit != -1)
{
ui->comboBoxPaperSizeUnit->setCurrentIndex(indexUnit);
@@ -780,8 +782,9 @@ void DialogLayoutSettings::InitLayoutUnits()
ui->comboBoxLayoutUnit->addItem(tr("Inches"), QVariant(UnitsToStr(Unit::Inch)));
// set default unit
- oldLayoutUnit = StrToUnits(qApp->ValentinaSettings()->GetUnit());
- const qint32 indexUnit = ui->comboBoxLayoutUnit->findData(qApp->ValentinaSettings()->GetUnit());
+ oldLayoutUnit = StrToUnits(VAbstractValApplication::VApp()->ValentinaSettings()->GetUnit());
+ const qint32 indexUnit = ui->comboBoxLayoutUnit->findData(
+ VAbstractValApplication::VApp()->ValentinaSettings()->GetUnit());
if (indexUnit != -1)
{
ui->comboBoxLayoutUnit->setCurrentIndex(indexUnit);
@@ -1016,7 +1019,7 @@ void DialogLayoutSettings::MinimumLayoutSize()
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::ReadSettings()
{
- const VSettings *settings = qApp->ValentinaSettings();
+ const VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
SetLayoutWidth(settings->GetLayoutWidth());
SetNestingTime(settings->GetNestingTime());
SetEfficiencyCoefficient(settings->GetEfficiencyCoefficient());
@@ -1048,7 +1051,7 @@ void DialogLayoutSettings::ReadSettings()
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::WriteSettings() const
{
- VSettings *settings = qApp->ValentinaSettings();
+ VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
settings->SetLayoutWidth(GetLayoutWidth());
settings->SetLayoutGroup(GetGroup());
settings->SetLayoutPaperHeight(GetPaperHeight());
diff --git a/src/app/valentina/dialogs/dialognewpattern.cpp b/src/app/valentina/dialogs/dialognewpattern.cpp
index d3277640f..a84bd292f 100644
--- a/src/app/valentina/dialogs/dialognewpattern.cpp
+++ b/src/app/valentina/dialogs/dialognewpattern.cpp
@@ -46,7 +46,8 @@ DialogNewPattern::DialogNewPattern(VContainer *data, const QString &patternPiece
ui->lineEditName->setClearButtonEnabled(true);
- qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
+ VAbstractValApplication::VApp()->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale())
+ : setLocale(QLocale::c());
QRect position = this->frameGeometry();
position.moveCenter(QGuiApplication::primaryScreen()->availableGeometry().center());
@@ -115,7 +116,8 @@ void DialogNewPattern::InitUnits()
ui->comboBoxUnits->addItem(tr("Inches"), QVariant(UnitsToStr(Unit::Inch)));
// set default unit
- const qint32 indexUnit = ui->comboBoxUnits->findData(qApp->ValentinaSettings()->GetUnit());
+ const qint32 indexUnit = ui->comboBoxUnits->findData(
+ VAbstractValApplication::VApp()->ValentinaSettings()->GetUnit());
if (indexUnit != -1)
{
ui->comboBoxUnits->setCurrentIndex(indexUnit);
diff --git a/src/app/valentina/dialogs/dialogpatternproperties.cpp b/src/app/valentina/dialogs/dialogpatternproperties.cpp
index 142a50d64..30e261af4 100644
--- a/src/app/valentina/dialogs/dialogpatternproperties.cpp
+++ b/src/app/valentina/dialogs/dialogpatternproperties.cpp
@@ -67,10 +67,10 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pat
SCASSERT(doc != nullptr)
- VSettings *settings = qApp->ValentinaSettings();
+ VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
settings->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
- if (qApp->GetPatternPath().isEmpty())
+ if (VAbstractValApplication::VApp()->GetPatternPath().isEmpty())
{
ui->lineEditPathToFile->setText(tr(""));
ui->lineEditPathToFile->setToolTip(tr("File was not saved yet."));
@@ -78,15 +78,15 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pat
}
else
{
- ui->lineEditPathToFile->setText(QDir::toNativeSeparators(qApp->GetPatternPath()));
- ui->lineEditPathToFile->setToolTip(QDir::toNativeSeparators(qApp->GetPatternPath()));
+ ui->lineEditPathToFile->setText(QDir::toNativeSeparators(VAbstractValApplication::VApp()->GetPatternPath()));
+ ui->lineEditPathToFile->setToolTip(QDir::toNativeSeparators(VAbstractValApplication::VApp()->GetPatternPath()));
ui->pushButtonShowInExplorer->setEnabled(true);
}
ui->lineEditPathToFile->setCursorPosition(0);
connect(ui->pushButtonShowInExplorer, &QPushButton::clicked, this, []()
{
- ShowInGraphicalShell(qApp->GetPatternPath());
+ ShowInGraphicalShell(VAbstractValApplication::VApp()->GetPatternPath());
});
#if defined(Q_OS_MAC)
ui->pushButtonShowInExplorer->setText(tr("Show in Finder"));
@@ -98,7 +98,8 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pat
ui->comboBoxLabelLanguage->addItem(QLocale(name).nativeLanguageName(), name);
}
- int index = ui->comboBoxLabelLanguage->findData(qApp->ValentinaSettings()->GetLabelLanguage());
+ int index = ui->comboBoxLabelLanguage->findData(
+ VAbstractValApplication::VApp()->ValentinaSettings()->GetLabelLanguage());
if (index != -1)
{
ui->comboBoxLabelLanguage->setCurrentIndex(index);
@@ -277,7 +278,7 @@ void DialogPatternProperties::ChangeImage()
{
const QString filter = tr("Images") + QLatin1String(" (*.png *.jpg *.jpeg *.bmp)");
const QString fileName = QFileDialog::getOpenFileName(this, tr("Image for pattern"), QString(), filter, nullptr,
- qApp->NativeFileDialog());
+ VAbstractApplication::VApp()->NativeFileDialog());
if (not fileName.isEmpty())
{
QImage image;
@@ -319,7 +320,7 @@ void DialogPatternProperties::SaveImage()
const QString extension = doc->GetImageExtension().prepend(QChar('.'));
QString filter = tr("Images") + QStringLiteral(" (*") + extension + QChar(')');
QString filename = QFileDialog::getSaveFileName(this, tr("Save File"), tr("untitled"), filter, &filter,
- qApp->NativeFileDialog());
+ VAbstractApplication::VApp()->NativeFileDialog());
if (not filename.isEmpty())
{
if (not filename.endsWith(extension.toUpper()))
diff --git a/src/app/valentina/dialogs/dialogpreferences.cpp b/src/app/valentina/dialogs/dialogpreferences.cpp
index 93543160a..83ae97e77 100644
--- a/src/app/valentina/dialogs/dialogpreferences.cpp
+++ b/src/app/valentina/dialogs/dialogpreferences.cpp
@@ -52,7 +52,7 @@ DialogPreferences::DialogPreferences(QWidget *parent)
setWindowFlags(Qt::Window);
#endif
- qApp->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
SCASSERT(bOk != nullptr)
@@ -91,7 +91,7 @@ void DialogPreferences::showEvent(QShowEvent *event)
}
// do your init stuff here
- QSize sz = qApp->Settings()->GetPreferenceDialogSize();
+ QSize sz = VAbstractApplication::VApp()->Settings()->GetPreferenceDialogSize();
if (sz.isEmpty() == false)
{
resize(sz);
@@ -109,7 +109,7 @@ void DialogPreferences::resizeEvent(QResizeEvent *event)
// dialog creating, which would
if (m_isInitialized)
{
- qApp->Settings()->SetPreferenceDialogSize(size());
+ VAbstractApplication::VApp()->Settings()->SetPreferenceDialogSize(size());
}
}
@@ -155,7 +155,8 @@ void DialogPreferences::Apply()
m_patternPage->InitDefaultSeamAllowance();
- qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
+ VAbstractValApplication::VApp()->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale())
+ : setLocale(QLocale::c());
emit UpdateProperties();
setResult(QDialog::Accepted);
}
diff --git a/src/app/valentina/dialogs/dialogsavelayout.cpp b/src/app/valentina/dialogs/dialogsavelayout.cpp
index 295e6b48b..be039617f 100644
--- a/src/app/valentina/dialogs/dialogsavelayout.cpp
+++ b/src/app/valentina/dialogs/dialogsavelayout.cpp
@@ -69,7 +69,8 @@ DialogSaveLayout::DialogSaveLayout(int count, Draw mode, const QString &fileName
ui->lineEditPath->setClearButtonEnabled(true);
ui->lineEditFileName->setClearButtonEnabled(true);
- qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
+ VAbstractValApplication::VApp()->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale())
+ : setLocale(QLocale::c());
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
SCASSERT(bOk != nullptr)
@@ -120,7 +121,7 @@ DialogSaveLayout::DialogSaveLayout(int count, Draw mode, const QString &fileName
this, &DialogSaveLayout::ShowExample);
connect(ui->pushButtonBrowse, &QPushButton::clicked, this, [this]()
{
- const QString dirPath = qApp->ValentinaSettings()->GetPathLayout();
+ const QString dirPath = VAbstractValApplication::VApp()->ValentinaSettings()->GetPathLayout();
bool usedNotExistedDir = false;
QDir directory(dirPath);
if (not directory.exists())
@@ -130,7 +131,8 @@ DialogSaveLayout::DialogSaveLayout(int count, Draw mode, const QString &fileName
const QString dir = QFileDialog::getExistingDirectory(
this, tr("Select folder"), dirPath,
- qApp->NativeFileDialog(QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks));
+ VAbstractApplication::VApp()->NativeFileDialog(QFileDialog::ShowDirsOnly |
+ QFileDialog::DontResolveSymlinks));
if (not dir.isEmpty())
{// If paths equal the signal will not be called, we will do this manually
dir == ui->lineEditPath->text() ? PathChanged(dir) : ui->lineEditPath->setText(dir);
@@ -144,7 +146,7 @@ DialogSaveLayout::DialogSaveLayout(int count, Draw mode, const QString &fileName
});
connect(ui->lineEditPath, &QLineEdit::textChanged, this, &DialogSaveLayout::PathChanged);
- ui->lineEditPath->setText(qApp->ValentinaSettings()->GetPathLayout());
+ ui->lineEditPath->setText(VAbstractValApplication::VApp()->ValentinaSettings()->GetPathLayout());
InitTemplates(ui->comboBoxTemplates);
@@ -680,7 +682,7 @@ void DialogSaveLayout::SetTiledExportMode(bool tiledExportMode)
void DialogSaveLayout::SetTiledMargins(QMarginsF margins)
{
// read Margins top, right, bottom, left
- margins = UnitConvertor(margins, Unit::Mm, qApp->patternUnits());
+ margins = UnitConvertor(margins, Unit::Mm, VAbstractValApplication::VApp()->patternUnits());
ui->doubleSpinBoxLeftField->setValue(margins.left());
ui->doubleSpinBoxTopField->setValue(margins.top());
@@ -698,7 +700,7 @@ QMarginsF DialogSaveLayout::GetTiledMargins() const
ui->doubleSpinBoxBottomField->value()
);
- return UnitConvertor(margins, qApp->patternUnits(), Unit::Mm);
+ return UnitConvertor(margins, VAbstractValApplication::VApp()->patternUnits(), Unit::Mm);
}
//---------------------------------------------------------------------------------------------------------------------
@@ -873,8 +875,8 @@ void DialogSaveLayout::RemoveFormatFromList(LayoutExportFormats format)
*/
void DialogSaveLayout::ReadSettings()
{
- VSettings *settings = qApp->ValentinaSettings();
- const Unit unit = qApp->patternUnits();
+ VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
+ const Unit unit = VAbstractValApplication::VApp()->patternUnits();
// read Margins top, right, bottom, left
const QMarginsF margins = settings->GetTiledPDFMargins(unit);
@@ -927,8 +929,8 @@ void DialogSaveLayout::WriteSettings() const
return;
}
- VSettings *settings = qApp->ValentinaSettings();
- const Unit unit = qApp->patternUnits();
+ VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
+ const Unit unit = VAbstractValApplication::VApp()->patternUnits();
// write Margins top, right, bottom, left
QMarginsF margins = QMarginsF(
diff --git a/src/app/valentina/dialogs/vwidgetdetails.cpp b/src/app/valentina/dialogs/vwidgetdetails.cpp
index 73ab8b76c..9a5d04239 100644
--- a/src/app/valentina/dialogs/vwidgetdetails.cpp
+++ b/src/app/valentina/dialogs/vwidgetdetails.cpp
@@ -140,7 +140,7 @@ void VWidgetDetails::InLayoutStateChanged(int row, int column)
TogglePieceInLayout *togglePrint = new TogglePieceInLayout(id, inLayout, m_data, m_doc);
connect(togglePrint, &TogglePieceInLayout::Toggled, this, &VWidgetDetails::ToggledPiece);
- qApp->getUndoStack()->push(togglePrint);
+ VAbstractApplication::VApp()->getUndoStack()->push(togglePrint);
}
//---------------------------------------------------------------------------------------------------------------------
@@ -189,7 +189,7 @@ void VWidgetDetails::ToggleSectionDetails(bool select)
{
TogglePieceInLayout *togglePrint = new TogglePieceInLayout(id, select, m_data, m_doc);
connect(togglePrint, &TogglePieceInLayout::Toggled, this, &VWidgetDetails::ToggledPiece);
- qApp->getUndoStack()->push(togglePrint);
+ VAbstractApplication::VApp()->getUndoStack()->push(togglePrint);
}
}
}
@@ -334,20 +334,20 @@ void VWidgetDetails::ShowContextMenu(const QPoint &pos)
if (selectedAction == actionSelectAll)
{
select = true;
- qApp->getUndoStack()->beginMacro(tr("select all details"));
+ VAbstractApplication::VApp()->getUndoStack()->beginMacro(tr("select all details"));
ToggleSectionDetails(select);
- qApp->getUndoStack()->endMacro();
+ VAbstractApplication::VApp()->getUndoStack()->endMacro();
}
else if (selectedAction == actionSelectNone)
{
select = false;
- qApp->getUndoStack()->beginMacro(tr("select none details"));
+ VAbstractApplication::VApp()->getUndoStack()->beginMacro(tr("select none details"));
ToggleSectionDetails(select);
- qApp->getUndoStack()->endMacro();
+ VAbstractApplication::VApp()->getUndoStack()->endMacro();
}
else if (selectedAction == actionInvertSelection)
{
- qApp->getUndoStack()->beginMacro(tr("invert selection"));
+ VAbstractApplication::VApp()->getUndoStack()->beginMacro(tr("invert selection"));
for (int i = 0; itableWidget->rowCount(); ++i)
{
@@ -359,11 +359,11 @@ void VWidgetDetails::ShowContextMenu(const QPoint &pos)
TogglePieceInLayout *togglePrint = new TogglePieceInLayout(id, select, m_data, m_doc);
connect(togglePrint, &TogglePieceInLayout::Toggled, this, &VWidgetDetails::ToggledPiece);
- qApp->getUndoStack()->push(togglePrint);
+ VAbstractApplication::VApp()->getUndoStack()->push(togglePrint);
}
}
- qApp->getUndoStack()->endMacro();
+ VAbstractApplication::VApp()->getUndoStack()->endMacro();
}
else if (pieceMode && selectedAction == actionPieceOptions)
{
diff --git a/src/app/valentina/dialogs/vwidgetgroups.cpp b/src/app/valentina/dialogs/vwidgetgroups.cpp
index af6bb0c5a..33b9f1874 100644
--- a/src/app/valentina/dialogs/vwidgetgroups.cpp
+++ b/src/app/valentina/dialogs/vwidgetgroups.cpp
@@ -80,7 +80,7 @@ void VWidgetGroups::SetGroupVisibility(vidtype id, bool visible) const
: item->setIcon(QIcon(QStringLiteral("://icon/16x16/closed_eye.png")));
}
});
- qApp->getUndoStack()->push(changeGroup);
+ VAbstractApplication::VApp()->getUndoStack()->push(changeGroup);
}
//---------------------------------------------------------------------------------------------------------------------
@@ -110,7 +110,7 @@ void VWidgetGroups::SetMultipleGroupsVisibility(const QVector &groups,
}
});
- qApp->getUndoStack()->push(changeGroups);
+ VAbstractApplication::VApp()->getUndoStack()->push(changeGroups);
}
//---------------------------------------------------------------------------------------------------------------------
@@ -179,7 +179,7 @@ void VWidgetGroups::RenameGroup(int row, int column)
const quint32 id = ui->tableWidget->item(row, 0)->data(Qt::UserRole).toUInt();
::RenameGroup *renameGroup = new ::RenameGroup(doc, id, ui->tableWidget->item(row, column)->text());
connect(renameGroup, &RenameGroup::UpdateGroups, this, &VWidgetGroups::UpdateGroups);
- qApp->getUndoStack()->push(renameGroup);
+ VAbstractApplication::VApp()->getUndoStack()->push(renameGroup);
}
//---------------------------------------------------------------------------------------------------------------------
@@ -230,7 +230,8 @@ void VWidgetGroups::CtxMenu(const QPoint &pos)
}
else if (selectedAction == actionPreferences)
{
- QScopedPointer fackeContainer(new VContainer(qApp->TrVars(), qApp->patternUnitsP(),
+ QScopedPointer fackeContainer(new VContainer(VAbstractApplication::VApp()->TrVars(),
+ VAbstractValApplication::VApp()->patternUnitsP(),
VContainer::UniqueNamespace()));
QScopedPointer dialog(new DialogGroup(fackeContainer.data(), NULL_ID, this));
dialog->SetName(doc->GetGroupName(id));
@@ -243,14 +244,14 @@ void VWidgetGroups::CtxMenu(const QPoint &pos)
ChangeGroupOptions *changeGroupOptions = new ChangeGroupOptions(doc, id, dialog->GetName(),
dialog->GetTags());
connect(changeGroupOptions, &ChangeGroupOptions::UpdateGroups, this, &VWidgetGroups::UpdateGroups);
- qApp->getUndoStack()->push(changeGroupOptions);
+ VAbstractApplication::VApp()->getUndoStack()->push(changeGroupOptions);
}
}
else if (selectedAction == actionDelete)
{
DelGroup *delGroup = new DelGroup(doc, id);
connect(delGroup, &DelGroup::UpdateGroups, this, &VWidgetGroups::UpdateGroups);
- qApp->getUndoStack()->push(delGroup);
+ VAbstractApplication::VApp()->getUndoStack()->push(delGroup);
}
else if (selectedAction == actionHideAll)
{//all groups in "group" make unvisible
diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp
index 1be52ee8a..ebbced7ab 100644
--- a/src/app/valentina/mainwindow.cpp
+++ b/src/app/valentina/mainwindow.cpp
@@ -173,8 +173,8 @@ void WarningNotUniquePieceName(const QHash *allDetails)
else
{
const QString errorMsg = QObject::tr("Piece name '%1' is not unique.").arg(pieceName);
- qApp->IsPedantic() ? throw VException(errorMsg) :
- qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
+ qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
}
++i;
@@ -236,7 +236,7 @@ MainWindow::MainWindow(QWidget *parent)
});
connect(doc, &VPattern::SetCurrentPP, this, &MainWindow::GlobalChangePP);
connect(doc, &VPattern::MadeProgress, this, &MainWindow::ShowProgress);
- qApp->setCurrentDocument(doc);
+ VAbstractValApplication::VApp()->setCurrentDocument(doc);
InitDocksContain();
CreateMenus();
@@ -254,7 +254,8 @@ MainWindow::MainWindow(QWidget *parent)
ToolBarTools();
- connect(qApp->getUndoStack(), &QUndoStack::cleanChanged, this, &MainWindow::PatternChangesWereSaved);
+ connect(VAbstractApplication::VApp()->getUndoStack(), &QUndoStack::cleanChanged, this,
+ &MainWindow::PatternChangesWereSaved);
InitAutoSave();
@@ -327,7 +328,7 @@ MainWindow::MainWindow(QWidget *parent)
connect(ui->toolButtonMessagesZoomInFont, &QToolButton::clicked, this, [this]()
{
- VSettings *settings = qApp->ValentinaSettings();
+ VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
QFont f = ui->plainTextEditPatternMessages->font();
if (f.pointSize() < settings->GetDefMaxPatternMessageFontSize())
{
@@ -339,7 +340,7 @@ MainWindow::MainWindow(QWidget *parent)
connect(ui->toolButtonMessagesZoomOutFont, &QToolButton::clicked, this, [this]()
{
- VSettings *settings = qApp->ValentinaSettings();
+ VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
QFont f = ui->plainTextEditPatternMessages->font();
if (f.pointSize() > settings->GetDefMinPatternMessageFontSize())
{
@@ -356,10 +357,11 @@ MainWindow::MainWindow(QWidget *parent)
connect(ui->toolButtonClearMessages, &QToolButton::clicked, this, &MainWindow::ClearPatternMessages);
- ui->toolButtonAutoRefresh->setChecked(qApp->ValentinaSettings()->GetAutoRefreshPatternMessage());
+ ui->toolButtonAutoRefresh->setChecked(
+ VAbstractValApplication::VApp()->ValentinaSettings()->GetAutoRefreshPatternMessage());
connect(ui->toolButtonAutoRefresh, &QToolButton::clicked, this, [](bool checked)
{
- qApp->ValentinaSettings()->SetAutoRefreshPatternMessage(checked);
+ VAbstractValApplication::VApp()->ValentinaSettings()->SetAutoRefreshPatternMessage(checked);
});
connect(doc, &VPattern::PreParseState, this, [this]()
@@ -461,7 +463,7 @@ void MainWindow::InitScenes()
{
sceneDraw = new VMainGraphicsScene(this);
currentScene = sceneDraw;
- qApp->setCurrentScene(¤tScene);
+ VAbstractValApplication::VApp()->setCurrentScene(¤tScene);
connect(this, &MainWindow::EnableItemMove, sceneDraw, &VMainGraphicsScene::EnableItemMove);
connect(this, &MainWindow::ItemsSelection, sceneDraw, &VMainGraphicsScene::ItemsSelection);
@@ -507,7 +509,7 @@ void MainWindow::InitScenes()
QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding);
policy.setHorizontalStretch(12);
ui->view->setSizePolicy(policy);
- qApp->setSceneView(ui->view);
+ VAbstractValApplication::VApp()->setSceneView(ui->view);
}
//---------------------------------------------------------------------------------------------------------------------
@@ -522,12 +524,12 @@ bool MainWindow::LoadMeasurements(const QString &path)
try
{
- qApp->SetMeasurementsType(m->Type());
+ VAbstractValApplication::VApp()->SetMeasurementsType(m->Type());
if (m->Type() == MeasurementsType::Individual)
{
- qApp->SetCustomerName(m->Customer());
- qApp->SetCustomerBirthDate(m->BirthDate());
- qApp->SetCustomerEmail(m->Email());
+ VAbstractValApplication::VApp()->SetCustomerName(m->Customer());
+ VAbstractValApplication::VApp()->SetCustomerBirthDate(m->BirthDate());
+ VAbstractValApplication::VApp()->SetCustomerEmail(m->Email());
}
else if (m->Type() == MeasurementsType::Multisize)
{
@@ -580,7 +582,7 @@ bool MainWindow::UpdateMeasurements(const QString &path, qreal baseA, qreal base
return false;
}
- if (qApp->GetMeasurementsType() != m->Type())
+ if (VAbstractValApplication::VApp()->GetMeasurementsType() != m->Type())
{
qCCritical(vMainWindow, "%s", qUtf8Printable(tr("Measurement files types have not match.")));
if (not VApplication::IsGUIMode())
@@ -604,9 +606,9 @@ bool MainWindow::UpdateMeasurements(const QString &path, qreal baseA, qreal base
m->ReadMeasurements(baseA, baseB, baseC);
if (m->Type() == MeasurementsType::Individual)
{
- qApp->SetCustomerName(m->Customer());
- qApp->SetCustomerBirthDate(m->BirthDate());
- qApp->SetCustomerEmail(m->Email());
+ VAbstractValApplication::VApp()->SetCustomerName(m->Customer());
+ VAbstractValApplication::VApp()->SetCustomerBirthDate(m->BirthDate());
+ VAbstractValApplication::VApp()->SetCustomerEmail(m->Email());
}
}
catch (VExceptionEmptyParameter &e)
@@ -1297,7 +1299,7 @@ void MainWindow::ClosedDialogGroup(int result)
{
AddGroup *addGroup = new AddGroup(group, doc);
connect(addGroup, &AddGroup::UpdateGroups, groupsWidget, &VWidgetGroups::UpdateGroups);
- qApp->getUndoStack()->push(addGroup);
+ VAbstractApplication::VApp()->getUndoStack()->push(addGroup);
}
}
ArrowTool(true);
@@ -1581,7 +1583,7 @@ void MainWindow::changeEvent(QEvent *event)
statusBar()->showMessage(tr("Changes applied."), 5000);
patternPieceLabel->setText(tr("Pattern Piece:"));
- if (qApp->GetDrawMode() == Draw::Calculation)
+ if (VApplication::VApp()->GetDrawMode() == Draw::Calculation)
{
ui->dockWidgetGroups->setWindowTitle(tr("Groups of visibility"));
ui->dockWidgetGroups->setToolTip(tr("Contains all visibility groups"));
@@ -1637,7 +1639,7 @@ void MainWindow::customEvent(QEvent *event)
{
if (event->type() == UNDO_EVENT)
{
- qApp->getUndoStack()->undo();
+ VAbstractApplication::VApp()->getUndoStack()->undo();
}
else if (event->type() == FIT_BEST_CURRENT_EVENT)
{
@@ -1719,10 +1721,12 @@ void MainWindow::ExportToCSVData(const QString &fileName, bool withHeader, int m
csv.insertRow(currentRow);
csv.setText(currentRow, 0, incr->GetName()); // name
- csv.setText(currentRow, 1, qApp->LocaleToString(*incr->GetValue())); // calculated value
+ csv.setText(currentRow, 1,
+ VAbstractApplication::VApp()->LocaleToString(*incr->GetValue())); // calculated value
- QString formula = VTranslateVars::TryFormulaToUser(incr->GetFormula(),
- qApp->Settings()->GetOsSeparator());
+ QString formula =
+ VTranslateVars::TryFormulaToUser(incr->GetFormula(),
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator());
csv.setText(currentRow, 2, formula); // formula
}
};
@@ -1741,7 +1745,8 @@ void MainWindow::ToolBarStyle(QToolBar *bar) const
#if defined(Q_OS_MAC)
// Temporary fix issue with toolbar black background on mac with OpenGL render
- if (qApp->getSceneView() && qApp->getSceneView()->IsOpenGLRender())
+ if (VAbstractValApplication::VApp()->getSceneView() &&
+ VAbstractValApplication::VApp()->getSceneView()->IsOpenGLRender())
{
bar->setStyle(QStyleFactory::create("fusion"));
}
@@ -1768,7 +1773,7 @@ void MainWindow::LoadIndividual()
const QString filter = tr("Individual measurements") + QLatin1String(" (*.vit);;") + tr("Multisize measurements") +
QLatin1String(" (*.vst)");
//Use standard path to individual measurements
- const QString path = qApp->ValentinaSettings()->GetPathIndividualMeasurements();
+ const QString path = VAbstractValApplication::VApp()->ValentinaSettings()->GetPathIndividualMeasurements();
bool usedNotExistedDir = false;
QDir directory(path);
@@ -1778,7 +1783,7 @@ void MainWindow::LoadIndividual()
}
const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter, nullptr,
- qApp->NativeFileDialog());
+ VAbstractApplication::VApp()->NativeFileDialog());
if (not mPath.isEmpty())
{
@@ -1786,10 +1791,10 @@ void MainWindow::LoadIndividual()
{
if (not doc->MPath().isEmpty())
{
- watcher->removePath(AbsoluteMPath(qApp->GetPatternPath(), doc->MPath()));
+ watcher->removePath(AbsoluteMPath(VAbstractValApplication::VApp()->GetPatternPath(), doc->MPath()));
}
ui->actionUnloadMeasurements->setEnabled(true);
- doc->SetMPath(RelativeMPath(qApp->GetPatternPath(), mPath));
+ doc->SetMPath(RelativeMPath(VAbstractValApplication::VApp()->GetPatternPath(), mPath));
watcher->addPath(mPath);
PatternChangesWereSaved(false);
ui->actionEditCurrent->setEnabled(true);
@@ -1813,10 +1818,10 @@ void MainWindow::LoadMultisize()
const QString filter = tr("Multisize measurements") + QLatin1String(" (*.vst);;") + tr("Individual measurements") +
QLatin1String("(*.vit)");
//Use standard path to multisize measurements
- QString path = qApp->ValentinaSettings()->GetPathMultisizeMeasurements();
+ QString path = VAbstractValApplication::VApp()->ValentinaSettings()->GetPathMultisizeMeasurements();
path = VCommonSettings::PrepareMultisizeTables(path);
const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter, nullptr,
- qApp->NativeFileDialog());
+ VAbstractApplication::VApp()->NativeFileDialog());
if (not mPath.isEmpty())
{
@@ -1824,10 +1829,10 @@ void MainWindow::LoadMultisize()
{
if (not doc->MPath().isEmpty())
{
- watcher->removePath(AbsoluteMPath(qApp->GetPatternPath(), doc->MPath()));
+ watcher->removePath(AbsoluteMPath(VAbstractValApplication::VApp()->GetPatternPath(), doc->MPath()));
}
ui->actionUnloadMeasurements->setEnabled(true);
- doc->SetMPath(RelativeMPath(qApp->GetPatternPath(), mPath));
+ doc->SetMPath(RelativeMPath(VAbstractValApplication::VApp()->GetPatternPath(), mPath));
watcher->addPath(mPath);
PatternChangesWereSaved(false);
ui->actionEditCurrent->setEnabled(true);
@@ -1850,17 +1855,17 @@ void MainWindow::UnloadMeasurements()
if (doc->ListMeasurements().isEmpty())
{
- watcher->removePath(AbsoluteMPath(qApp->GetPatternPath(), doc->MPath()));
+ watcher->removePath(AbsoluteMPath(VAbstractValApplication::VApp()->GetPatternPath(), doc->MPath()));
- const MeasurementsType oldType = qApp->GetMeasurementsType();
- qApp->SetMeasurementsType(MeasurementsType::Unknown);
+ const MeasurementsType oldType = VAbstractValApplication::VApp()->GetMeasurementsType();
+ VAbstractValApplication::VApp()->SetMeasurementsType(MeasurementsType::Unknown);
m.clear();
- qApp->SetDimensionHeight(0);
- qApp->SetDimensionSize(0);
- qApp->SetDimensionHip(0);
- qApp->SetDimensionWaist(0);
+ VAbstractValApplication::VApp()->SetDimensionHeight(0);
+ VAbstractValApplication::VApp()->SetDimensionSize(0);
+ VAbstractValApplication::VApp()->SetDimensionHip(0);
+ VAbstractValApplication::VApp()->SetDimensionWaist(0);
if (oldType == MeasurementsType::Multisize)
{
@@ -1872,11 +1877,11 @@ void MainWindow::UnloadMeasurements()
}
else if (oldType == MeasurementsType::Individual)
{
- qApp->SetCustomerBirthDate(QDate());
- qApp->SetCustomerEmail(QString());
- qApp->SetCustomerName(QString());
- qApp->SetMeasurementsUnits(Unit::LAST_UNIT_DO_NOT_USE);
- qApp->SetDimensionSizeUnits(Unit::LAST_UNIT_DO_NOT_USE);
+ VAbstractValApplication::VApp()->SetCustomerBirthDate(QDate());
+ VAbstractValApplication::VApp()->SetCustomerEmail(QString());
+ VAbstractValApplication::VApp()->SetCustomerName(QString());
+ VAbstractValApplication::VApp()->SetMeasurementsUnits(Unit::LAST_UNIT_DO_NOT_USE);
+ VAbstractValApplication::VApp()->SetDimensionSizeUnits(Unit::LAST_UNIT_DO_NOT_USE);
}
doc->SetMPath(QString());
@@ -1900,14 +1905,14 @@ void MainWindow::ShowMeasurements()
{
if (not doc->MPath().isEmpty())
{
- const QString absoluteMPath = AbsoluteMPath(qApp->GetPatternPath(), doc->MPath());
+ const QString absoluteMPath = AbsoluteMPath(VAbstractValApplication::VApp()->GetPatternPath(), doc->MPath());
QStringList arguments;
arguments.append(absoluteMPath);
arguments.append("-u");
- arguments.append(UnitsToStr(qApp->patternUnits()));
+ arguments.append(UnitsToStr(VAbstractValApplication::VApp()->patternUnits()));
- if (qApp->GetMeasurementsType() == MeasurementsType::Multisize)
+ if (VAbstractValApplication::VApp()->GetMeasurementsType() == MeasurementsType::Multisize)
{
if (m_currentDimensionA > 0)
{
@@ -1933,7 +1938,7 @@ void MainWindow::ShowMeasurements()
arguments.append(QLatin1String("--") + LONG_OPTION_NO_HDPI_SCALING);
}
- const QString tape = qApp->TapeFilePath();
+ const QString tape = VApplication::VApp()->TapeFilePath();
const QString workingDirectory = QFileInfo(tape).absoluteDir().absolutePath();
QProcess::startDetached(tape, arguments, workingDirectory);
}
@@ -1981,7 +1986,7 @@ void MainWindow::SyncMeasurements()
{
if (mChanges)
{
- const QString path = AbsoluteMPath(qApp->GetPatternPath(), doc->MPath());
+ const QString path = AbsoluteMPath(VAbstractValApplication::VApp()->GetPatternPath(), doc->MPath());
// Temporarily remove the path to prevent infinite synchronization after a format conversion.
watcher->removePath(path);
@@ -2037,7 +2042,7 @@ void MainWindow::LoadWatermark()
QString dir = QDir::homePath();
qDebug("Run QFileDialog::getOpenFileName: dir = %s.", qUtf8Printable(dir));
const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), dir, filter, nullptr,
- qApp->NativeFileDialog());
+ VAbstractApplication::VApp()->NativeFileDialog());
if (filePath.isEmpty())
{
return;
@@ -2078,7 +2083,7 @@ void MainWindow::CleanWaterkmarkEditors()
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::StoreMultisizeMDimensions()
{
- qApp->SetMeasurementsUnits(m->MUnit());
+ VAbstractValApplication::VApp()->SetMeasurementsUnits(m->MUnit());
QList dimensions = m->Dimensions().values();
@@ -2091,26 +2096,27 @@ void MainWindow::StoreMultisizeMDimensions()
switch(dimension->Type())
{
case MeasurementDimension::X:
- qApp->SetDimensionHeight(currentBase);
+ VAbstractValApplication::VApp()->SetDimensionHeight(currentBase);
break;
case MeasurementDimension::Y:
{
const bool fc = m->IsFullCircumference();
- qApp->SetDimensionSize(fc ? currentBase*2 : currentBase);
+ VAbstractValApplication::VApp()->SetDimensionSize(fc ? currentBase*2 : currentBase);
const bool circumference = dimension->IsCircumference();
- qApp->SetDimensionSizeUnits(circumference ? m->MUnit() : Unit::LAST_UNIT_DO_NOT_USE);
+ VAbstractValApplication::VApp()
+ ->SetDimensionSizeUnits(circumference ? m->MUnit() : Unit::LAST_UNIT_DO_NOT_USE);
break;
}
case MeasurementDimension::W:
{
const bool fc = m->IsFullCircumference();
- qApp->SetDimensionWaist(fc ? currentBase*2 : currentBase);
+ VAbstractValApplication::VApp()->SetDimensionWaist(fc ? currentBase*2 : currentBase);
break;
}
case MeasurementDimension::Z:
{
const bool fc = m->IsFullCircumference();
- qApp->SetDimensionHip(fc ? currentBase*2 : currentBase);
+ VAbstractValApplication::VApp()->SetDimensionHip(fc ? currentBase*2 : currentBase);
break;
}
default:
@@ -2131,21 +2137,21 @@ void MainWindow::StoreIndividualMDimensions()
auto StoreDimension = [this, measurements](IMD type)
{
- const QString name = qApp->TrVars()->VarToUser(m->MeasurementForDimension(type));
+ const QString name = VAbstractApplication::VApp()->TrVars()->VarToUser(m->MeasurementForDimension(type));
const bool valid = not name.isEmpty() && measurements.contains(name);
switch(type)
{
case IMD::X:
- qApp->SetDimensionHeight(valid ? *measurements.value(name)->GetValue() : 0);
+ VAbstractValApplication::VApp()->SetDimensionHeight(valid ? *measurements.value(name)->GetValue() : 0);
break;
case IMD::Y:
- qApp->SetDimensionSize(valid ? *measurements.value(name)->GetValue() : 0);
+ VAbstractValApplication::VApp()->SetDimensionSize(valid ? *measurements.value(name)->GetValue() : 0);
break;
case IMD::W:
- qApp->SetDimensionWaist(valid ? *measurements.value(name)->GetValue() : 0);
+ VAbstractValApplication::VApp()->SetDimensionWaist(valid ? *measurements.value(name)->GetValue() : 0);
break;
case IMD::Z:
- qApp->SetDimensionHip(valid ? *measurements.value(name)->GetValue() : 0);
+ VAbstractValApplication::VApp()->SetDimensionHip(valid ? *measurements.value(name)->GetValue() : 0);
break;
case IMD::N:
default:
@@ -2228,8 +2234,9 @@ void MainWindow::SetDimensionBases()
#if defined(Q_OS_MAC)
void MainWindow::OpenAt(QAction *where)
{
- const QString path = qApp->GetPatternPath().left(qApp->GetPatternPath().indexOf(where->text())) + where->text();
- if (path == qApp->GetPatternPath())
+ const QString path = VAbstractValApplication::VApp()->GetPatternPath()
+ .left(VAbstractValApplication::VApp()->GetPatternPath().indexOf(where->text())) + where->text();
+ if (path == VAbstractValApplication::VApp()->GetPatternPath())
{
return;
}
@@ -2281,7 +2288,8 @@ void MainWindow::ToolBarOption()
ui->toolBarOption->addSeparator();
- m_mouseCoordinate = new QLabel(QString("0, 0 (%1)").arg(UnitsToStr(qApp->patternUnits(), true)));
+ m_mouseCoordinate = new QLabel(QString("0, 0 (%1)")
+ .arg(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true)));
ui->toolBarOption->addWidget(m_mouseCoordinate);
ui->toolBarOption->addSeparator();
@@ -2326,7 +2334,7 @@ void MainWindow::ToolBarDraws()
{
return;
}
- qApp->getUndoStack()->push(new RenamePP(doc, draw, comboBoxDraws));
+ VAbstractApplication::VApp()->getUndoStack()->push(new RenamePP(doc, draw, comboBoxDraws));
});
}
@@ -2372,7 +2380,7 @@ void MainWindow::ToolBarTools()
ui->actionIncreaseLabelFont->setShortcut(QKeySequence(Qt::ShiftModifier + Qt::Key_Plus));
connect(ui->actionIncreaseLabelFont, &QAction::triggered, this, [this]()
{
- VSettings *settings = qApp->ValentinaSettings();
+ VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
settings->SetLabelFontSize(settings->GetLabelFontSize() + 1);
if (sceneDraw)
{
@@ -2388,7 +2396,7 @@ void MainWindow::ToolBarTools()
ui->actionDecreaseLabelFont->setShortcut(QKeySequence(Qt::ShiftModifier + Qt::Key_Minus));
connect(ui->actionDecreaseLabelFont, &QAction::triggered, this, [this]()
{
- VSettings *settings = qApp->ValentinaSettings();
+ VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
settings->SetLabelFontSize(settings->GetLabelFontSize() - 1);
if (sceneDraw)
{
@@ -2404,7 +2412,7 @@ void MainWindow::ToolBarTools()
ui->actionOriginalLabelFont->setShortcut(QKeySequence(Qt::ShiftModifier + Qt::Key_0));
connect(ui->actionOriginalLabelFont, &QAction::triggered, this, [this]()
{
- VSettings *settings = qApp->ValentinaSettings();
+ VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
settings->SetLabelFontSize(settings->GetDefLabelFontSize());
if (sceneDraw)
{
@@ -2420,7 +2428,7 @@ void MainWindow::ToolBarTools()
ui->actionHideLabels->setShortcut(QKeySequence(Qt::AltModifier + Qt::Key_L));
connect(ui->actionHideLabels, &QAction::triggered, this, [this](bool checked)
{
- qApp->ValentinaSettings()->SetHideLabels(checked);
+ VAbstractValApplication::VApp()->ValentinaSettings()->SetHideLabels(checked);
if (sceneDraw)
{
sceneDraw->update();
@@ -2513,9 +2521,9 @@ void MainWindow::MouseMove(const QPointF &scenePos)
if (not m_mouseCoordinate.isNull())
{
m_mouseCoordinate->setText(QStringLiteral("%1, %2 (%3)")
- .arg(static_cast(qApp->fromPixel(scenePos.x())))
- .arg(static_cast(qApp->fromPixel(scenePos.y())))
- .arg(UnitsToStr(qApp->patternUnits(), true)));
+ .arg(static_cast(VAbstractValApplication::VApp()->fromPixel(scenePos.x())))
+ .arg(static_cast(VAbstractValApplication::VApp()->fromPixel(scenePos.y())))
+ .arg(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true)));
}
}
@@ -2707,8 +2715,8 @@ void MainWindow::CancelTool()
// Crash: using CRTL+Z while using line tool.
// related bug report:
// https://bitbucket.org/dismine/valentina/issues/454/crash-using-crtl-z-while-using-line-tool
- undoAction->setEnabled(qApp->getUndoStack()->canUndo());
- redoAction->setEnabled(qApp->getUndoStack()->canRedo());
+ undoAction->setEnabled(VAbstractApplication::VApp()->getUndoStack()->canUndo());
+ redoAction->setEnabled(VAbstractApplication::VApp()->getUndoStack()->canRedo());
}
QT_WARNING_POP
@@ -2801,7 +2809,8 @@ void MainWindow::keyPressEvent ( QKeyEvent * event )
*/
void MainWindow::SaveCurrentScene()
{
- if (qApp->GetDrawMode() == Draw::Calculation || qApp->GetDrawMode() == Draw::Modeling)
+ if (VAbstractValApplication::VApp()->GetDrawMode() == Draw::Calculation ||
+ VAbstractValApplication::VApp()->GetDrawMode() == Draw::Modeling)
{
VMainGraphicsScene *scene = qobject_cast(currentScene);
SCASSERT(scene != nullptr)
@@ -2858,7 +2867,7 @@ void MainWindow::ActionDraw(bool checked)
ui->view->setScene(currentScene);
RestoreCurrentScene();
- qApp->SetDrawMode(Draw::Calculation);
+ VAbstractValApplication::VApp()->SetDrawMode(Draw::Calculation);
comboBoxDraws->setCurrentIndex(currentDrawIndex);//restore current pattern peace
drawMode = true;
@@ -2866,7 +2875,7 @@ void MainWindow::ActionDraw(bool checked)
SetEnableWidgets(true);
ui->toolBox->setCurrentIndex(currentToolBoxIndex);
- if (qApp->GetMeasurementsType() == MeasurementsType::Multisize)
+ if (VAbstractValApplication::VApp()->GetMeasurementsType() == MeasurementsType::Multisize)
{
ui->toolBarOption->setVisible(true);
}
@@ -2910,7 +2919,7 @@ void MainWindow::ActionDetails(bool checked)
ui->actionDetails->setChecked(true);
ui->actionLayout->setChecked(false);
- if(not qApp->getOpeningPattern())
+ if(not VAbstractValApplication::VApp()->getOpeningPattern())
{
if (pattern->DataPieces()->count() == 0)
{
@@ -2932,16 +2941,16 @@ void MainWindow::ActionDetails(bool checked)
ui->view->setScene(currentScene);
RestoreCurrentScene();
- if (qApp->GetDrawMode() == Draw::Calculation)
+ if (VAbstractValApplication::VApp()->GetDrawMode() == Draw::Calculation)
{
currentToolBoxIndex = ui->toolBox->currentIndex();
}
- qApp->SetDrawMode(Draw::Modeling);
+ VAbstractValApplication::VApp()->SetDrawMode(Draw::Modeling);
SetEnableTool(true);
SetEnableWidgets(true);
ui->toolBox->setCurrentIndex(ui->toolBox->indexOf(ui->detailPage));
- if (qApp->GetMeasurementsType() == MeasurementsType::Multisize)
+ if (VAbstractValApplication::VApp()->GetMeasurementsType() == MeasurementsType::Multisize)
{
ui->toolBarOption->setVisible(true);
}
@@ -2991,7 +3000,7 @@ void MainWindow::ActionLayout(bool checked)
ui->actionLayout->setChecked(true);
QVector details;
- if(not qApp->getOpeningPattern())
+ if(not VAbstractValApplication::VApp()->getOpeningPattern())
{
const QHash *allDetails = pattern->DataPieces();
if (allDetails->count() == 0)
@@ -3012,7 +3021,8 @@ void MainWindow::ActionLayout(bool checked)
QMessageBox::information(this, tr("Layout mode"), tr("You can't use Layout mode yet. Please, "
"include at least one detail in layout."),
QMessageBox::Ok, QMessageBox::Ok);
- qApp->GetDrawMode() == Draw::Calculation ? ActionDraw(true) : ActionDetails(true);
+ VAbstractValApplication::VApp()->GetDrawMode() == Draw::Calculation ? ActionDraw(true)
+ : ActionDetails(true);
return;
}
}
@@ -3034,7 +3044,8 @@ void MainWindow::ActionLayout(bool checked)
QMessageBox::warning(this, tr("Layout mode"),
tr("You can't use Layout mode yet.") + QLatin1String(" \n") + e.ErrorMessage(),
QMessageBox::Ok, QMessageBox::Ok);
- qApp->GetDrawMode() == Draw::Calculation ? ActionDraw(true) : ActionDetails(true);
+ VAbstractValApplication::VApp()->GetDrawMode() == Draw::Calculation ? ActionDraw(true)
+ : ActionDetails(true);
return;
}
@@ -3042,11 +3053,11 @@ void MainWindow::ActionLayout(bool checked)
emit ui->view->itemClicked(nullptr);
ui->view->setScene(currentScene);
- if (qApp->GetDrawMode() == Draw::Calculation)
+ if (VAbstractValApplication::VApp()->GetDrawMode() == Draw::Calculation)
{
currentToolBoxIndex = ui->toolBox->currentIndex();
}
- qApp->SetDrawMode(Draw::Layout);
+ VAbstractValApplication::VApp()->SetDrawMode(Draw::Layout);
SetEnableTool(true);
SetEnableWidgets(true);
ui->toolBox->setCurrentIndex(ui->toolBox->indexOf(ui->layoutPage));
@@ -3056,7 +3067,7 @@ void MainWindow::ActionLayout(bool checked)
m_mouseCoordinate->setText(QString());
}
- if (qApp->GetMeasurementsType() == MeasurementsType::Multisize)
+ if (VAbstractValApplication::VApp()->GetMeasurementsType() == MeasurementsType::Multisize)
{
ui->toolBarOption->setVisible(false);
}
@@ -3093,16 +3104,16 @@ void MainWindow::ActionLayout(bool checked)
*/
bool MainWindow::on_actionSaveAs_triggered()
{
- const QString oldFilePath = qApp->GetPatternPath();
+ const QString oldFilePath = VAbstractValApplication::VApp()->GetPatternPath();
QString filters(tr("Pattern files") + QLatin1String("(*.val)"));
QString dir;
- if (qApp->GetPatternPath().isEmpty())
+ if (VAbstractValApplication::VApp()->GetPatternPath().isEmpty())
{
- dir = qApp->ValentinaSettings()->GetPathPattern();
+ dir = VAbstractValApplication::VApp()->ValentinaSettings()->GetPathPattern();
}
else
{
- dir = QFileInfo(qApp->GetPatternPath()).absolutePath();
+ dir = QFileInfo(VAbstractValApplication::VApp()->GetPatternPath()).absolutePath();
}
bool usedNotExistedDir = false;
@@ -3114,7 +3125,7 @@ bool MainWindow::on_actionSaveAs_triggered()
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"),
dir + QLatin1String("/") + tr("pattern") + QLatin1String(".val"),
- filters, nullptr, qApp->NativeFileDialog());
+ filters, nullptr, VAbstractApplication::VApp()->NativeFileDialog());
auto RemoveTempDir = qScopeGuard([usedNotExistedDir, dir]()
{
@@ -3136,7 +3147,7 @@ bool MainWindow::on_actionSaveAs_triggered()
fileName += QLatin1String(".val");
}
- if (f.exists() && qApp->GetPatternPath() != fileName)
+ if (f.exists() && VAbstractValApplication::VApp()->GetPatternPath() != fileName)
{
// Temporary try to lock the file before saving
// Also help to rewite current read-only pattern
@@ -3175,9 +3186,9 @@ bool MainWindow::on_actionSaveAs_triggered()
else if (not oldFilePath.isEmpty())
{
qCDebug(vMainWindow, "Updating restore file list.");
- QStringList restoreFiles = qApp->ValentinaSettings()->GetRestoreFileList();
+ QStringList restoreFiles = VAbstractValApplication::VApp()->ValentinaSettings()->GetRestoreFileList();
restoreFiles.removeAll(oldFilePath);
- qApp->ValentinaSettings()->SetRestoreFileList(restoreFiles);
+ VAbstractValApplication::VApp()->ValentinaSettings()->SetRestoreFileList(restoreFiles);
QFile::remove(oldFilePath + *autosavePrefix);
}
@@ -3186,7 +3197,7 @@ bool MainWindow::on_actionSaveAs_triggered()
patternReadOnly = false;
qCDebug(vMainWindow, "Locking file");
- if (qApp->GetPatternPath() == fileName && not lock.isNull())
+ if (VAbstractValApplication::VApp()->GetPatternPath() == fileName && not lock.isNull())
{
lock->Unlock();
}
@@ -3215,7 +3226,7 @@ bool MainWindow::on_actionSaveAs_triggered()
*/
bool MainWindow::on_actionSave_triggered()
{
- if (qApp->GetPatternPath().isEmpty() || patternReadOnly)
+ if (VAbstractValApplication::VApp()->GetPatternPath().isEmpty() || patternReadOnly)
{
return on_actionSaveAs_triggered();
}
@@ -3230,7 +3241,7 @@ bool MainWindow::on_actionSave_triggered()
#ifdef Q_OS_WIN32
qt_ntfs_permission_lookup++; // turn checking on
#endif /*Q_OS_WIN32*/
- const bool isFileWritable = QFileInfo(qApp->GetPatternPath()).isWritable();
+ const bool isFileWritable = QFileInfo(VAbstractValApplication::VApp()->GetPatternPath()).isWritable();
#ifdef Q_OS_WIN32
qt_ntfs_permission_lookup--; // turn it off again
#endif /*Q_OS_WIN32*/
@@ -3248,8 +3259,10 @@ bool MainWindow::on_actionSave_triggered()
#ifdef Q_OS_WIN32
qt_ntfs_permission_lookup++; // turn checking on
#endif /*Q_OS_WIN32*/
- bool changed = QFile::setPermissions(qApp->GetPatternPath(),
- QFileInfo(qApp->GetPatternPath()).permissions() | QFileDevice::WriteUser);
+ bool changed =
+ QFile::setPermissions(VAbstractValApplication::VApp()->GetPatternPath(),
+ QFileInfo(VAbstractValApplication::VApp()
+ ->GetPatternPath()).permissions() | QFileDevice::WriteUser);
#ifdef Q_OS_WIN32
qt_ntfs_permission_lookup--; // turn it off again
#endif /*Q_OS_WIN32*/
@@ -3258,7 +3271,8 @@ bool MainWindow::on_actionSave_triggered()
{
QMessageBox messageBox(this);
messageBox.setIcon(QMessageBox::Warning);
- messageBox.setText(tr("Cannot set permissions for %1 to writable.").arg(qApp->GetPatternPath()));
+ messageBox.setText(tr("Cannot set permissions for %1 to writable.")
+ .arg(VAbstractValApplication::VApp()->GetPatternPath()));
messageBox.setInformativeText(tr("Could not save the file."));
messageBox.setDefaultButton(QMessageBox::Ok);
messageBox.setStandardButtons(QMessageBox::Ok);
@@ -3273,10 +3287,10 @@ bool MainWindow::on_actionSave_triggered()
}
QString error;
- bool result = SavePattern(qApp->GetPatternPath(), error);
+ bool result = SavePattern(VAbstractValApplication::VApp()->GetPatternPath(), error);
if (result)
{
- QFile::remove(qApp->GetPatternPath() + *autosavePrefix);
+ QFile::remove(VAbstractValApplication::VApp()->GetPatternPath() + *autosavePrefix);
m_curFileFormatVersion = VPatternConverter::PatternMaxVer;
m_curFileFormatVersionStr = VPatternConverter::PatternMaxVerStr;
}
@@ -3303,7 +3317,7 @@ void MainWindow::on_actionOpen_triggered()
qCDebug(vMainWindow, "Openning new file.");
const QString filter(tr("Pattern files") + QLatin1String(" (*.val)"));
//Get list last open files
- const QStringList files = qApp->ValentinaSettings()->GetRecentFileList();
+ const QStringList files = VAbstractValApplication::VApp()->ValentinaSettings()->GetRecentFileList();
QString dir;
if (files.isEmpty())
{
@@ -3316,7 +3330,7 @@ void MainWindow::on_actionOpen_triggered()
}
qCDebug(vMainWindow, "Run QFileDialog::getOpenFileName: dir = %s.", qUtf8Printable(dir));
const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), dir, filter, nullptr,
- qApp->NativeFileDialog());
+ VAbstractApplication::VApp()->NativeFileDialog());
if (filePath.isEmpty())
{
return;
@@ -3338,9 +3352,9 @@ void MainWindow::Clear()
setCurrentFile(QString());// Keep before cleaning a pattern data to prevent a crash
pattern->Clear();
qCDebug(vMainWindow, "Clearing pattern.");
- if (not qApp->GetPatternPath().isEmpty() && not doc->MPath().isEmpty())
+ if (not VAbstractValApplication::VApp()->GetPatternPath().isEmpty() && not doc->MPath().isEmpty())
{
- watcher->removePath(AbsoluteMPath(qApp->GetPatternPath(), doc->MPath()));
+ watcher->removePath(AbsoluteMPath(VAbstractValApplication::VApp()->GetPatternPath(), doc->MPath()));
}
doc->Clear();
UpdateWindowTitle();
@@ -3380,15 +3394,15 @@ void MainWindow::Clear()
ui->actionPreviousPatternPiece->setEnabled(false);
ui->actionNextPatternPiece->setEnabled(false);
SetEnableTool(false);
- qApp->SetPatternUnits(Unit::Cm);
- qApp->SetMeasurementsType(MeasurementsType::Unknown);
+ VAbstractValApplication::VApp()->SetPatternUnits(Unit::Cm);
+ VAbstractValApplication::VApp()->SetMeasurementsType(MeasurementsType::Unknown);
ui->toolBarOption->clear();
#ifndef QT_NO_CURSOR
QGuiApplication::restoreOverrideCursor();
#endif
CleanLayout();
listDetails.clear(); // don't move to CleanLayout()
- qApp->getUndoStack()->clear();
+ VAbstractApplication::VApp()->getUndoStack()->clear();
toolOptions->ClearPropertyBrowser();
toolOptions->itemClicked(nullptr);
m_progressBar->setVisible(false);
@@ -3412,17 +3426,17 @@ void MainWindow::FileClosedCorrect()
WriteSettings();
//File was closed correct.
- QStringList restoreFiles = qApp->ValentinaSettings()->GetRestoreFileList();
- restoreFiles.removeAll(qApp->GetPatternPath());
- qApp->ValentinaSettings()->SetRestoreFileList(restoreFiles);
+ QStringList restoreFiles = VAbstractValApplication::VApp()->ValentinaSettings()->GetRestoreFileList();
+ restoreFiles.removeAll(VAbstractValApplication::VApp()->GetPatternPath());
+ VAbstractValApplication::VApp()->ValentinaSettings()->SetRestoreFileList(restoreFiles);
// Remove autosave file
- QFile autofile(qApp->GetPatternPath() + *autosavePrefix);
+ QFile autofile(VAbstractValApplication::VApp()->GetPatternPath() + *autosavePrefix);
if (autofile.exists())
{
autofile.remove();
}
- qCDebug(vMainWindow, "File %s closed correct.", qUtf8Printable(qApp->GetPatternPath()));
+ qCDebug(vMainWindow, "File %s closed correct.", qUtf8Printable(VAbstractValApplication::VApp()->GetPatternPath()));
}
//---------------------------------------------------------------------------------------------------------------------
@@ -3447,7 +3461,7 @@ void MainWindow::FullParseFile()
try
{
- if (qApp->getOpeningPattern())
+ if (VAbstractValApplication::VApp()->getOpeningPattern())
{
futureTestUniqueId = QtConcurrent::run(static_cast(doc), &VDomDocument::TestUniqueId);
}
@@ -3455,7 +3469,7 @@ void MainWindow::FullParseFile()
SetEnabledGUI(true);
doc->Parse(Document::FullParse);
- if (qApp->getOpeningPattern())
+ if (VAbstractValApplication::VApp()->getOpeningPattern())
{
futureTestUniqueId.waitForFinished();
}
@@ -3464,7 +3478,7 @@ void MainWindow::FullParseFile()
{
/* If user want undo last operation before undo we need finish broken redo operation. For those we post event
* myself. Later in method customEvent call undo.*/
- if (qApp->getOpeningPattern())
+ if (VAbstractValApplication::VApp()->getOpeningPattern())
{
try
{
@@ -3490,7 +3504,7 @@ void MainWindow::FullParseFile()
qCCritical(vMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error parsing file.")), //-V807
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
SetEnabledGUI(false);
- if (qApp->getOpeningPattern())
+ if (VAbstractValApplication::VApp()->getOpeningPattern())
{
WaitForFutureFinish(futureTestUniqueId);
}
@@ -3505,7 +3519,7 @@ void MainWindow::FullParseFile()
qCCritical(vMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error can't convert value.")),
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
SetEnabledGUI(false);
- if (qApp->getOpeningPattern())
+ if (VAbstractValApplication::VApp()->getOpeningPattern())
{
WaitForFutureFinish(futureTestUniqueId);
}
@@ -3520,7 +3534,7 @@ void MainWindow::FullParseFile()
qCCritical(vMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error empty parameter.")),
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
SetEnabledGUI(false);
- if (qApp->getOpeningPattern())
+ if (VAbstractValApplication::VApp()->getOpeningPattern())
{
WaitForFutureFinish(futureTestUniqueId);
}
@@ -3535,7 +3549,7 @@ void MainWindow::FullParseFile()
qCCritical(vMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error wrong id.")),
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
SetEnabledGUI(false);
- if (qApp->getOpeningPattern())
+ if (VAbstractValApplication::VApp()->getOpeningPattern())
{
WaitForFutureFinish(futureTestUniqueId);
}
@@ -3550,7 +3564,7 @@ void MainWindow::FullParseFile()
qCCritical(vMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error parsing file.")),
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
SetEnabledGUI(false);
- if (qApp->getOpeningPattern())
+ if (VAbstractValApplication::VApp()->getOpeningPattern())
{
WaitForFutureFinish(futureTestUniqueId);
}
@@ -3564,7 +3578,7 @@ void MainWindow::FullParseFile()
{
qCCritical(vMainWindow, "%s", qUtf8Printable(tr("Error parsing file (std::bad_alloc).")));
SetEnabledGUI(false);
- if (qApp->getOpeningPattern())
+ if (VAbstractValApplication::VApp()->getOpeningPattern())
{
WaitForFutureFinish(futureTestUniqueId);
}
@@ -3607,8 +3621,8 @@ void MainWindow::FullParseFile()
SetEnableTool(comboBoxDraws->count() > 0);
detailsWidget->UpdateList();
- VMainGraphicsView::NewSceneRect(sceneDraw, qApp->getSceneView());
- VMainGraphicsView::NewSceneRect(sceneDetails, qApp->getSceneView());
+ VMainGraphicsView::NewSceneRect(sceneDraw, VAbstractValApplication::VApp()->getSceneView());
+ VMainGraphicsView::NewSceneRect(sceneDetails, VAbstractValApplication::VApp()->getSceneView());
}
//---------------------------------------------------------------------------------------------------------------------
@@ -3705,7 +3719,7 @@ void MainWindow::SetEnabledGUI(bool enabled)
if (enabled == false)
{
ArrowTool(true);
- qApp->getUndoStack()->clear();
+ VAbstractApplication::VApp()->getUndoStack()->clear();
}
SetEnableWidgets(enabled);
@@ -3726,8 +3740,8 @@ void MainWindow::SetEnabledGUI(bool enabled)
*/
void MainWindow::SetEnableWidgets(bool enable)
{
- const bool drawStage = (qApp->GetDrawMode() == Draw::Calculation);
- const bool detailsStage = (qApp->GetDrawMode() == Draw::Modeling);
+ const bool drawStage = (VAbstractValApplication::VApp()->GetDrawMode() == Draw::Calculation);
+ const bool detailsStage = (VAbstractValApplication::VApp()->GetDrawMode() == Draw::Modeling);
const bool designStage = (drawStage || detailsStage);
comboBoxDraws->setEnabled(enable && drawStage);
@@ -3770,8 +3784,8 @@ void MainWindow::SetEnableWidgets(bool enable)
actionDockWidgetToolOptions->setEnabled(enable && designStage);
actionDockWidgetGroups->setEnabled(enable && designStage);
- undoAction->setEnabled(enable && designStage && qApp->getUndoStack()->canUndo());
- redoAction->setEnabled(enable && designStage && qApp->getUndoStack()->canRedo());
+ undoAction->setEnabled(enable && designStage && VAbstractApplication::VApp()->getUndoStack()->canUndo());
+ redoAction->setEnabled(enable && designStage && VAbstractApplication::VApp()->getUndoStack()->canRedo());
//Now we don't want allow user call context menu
sceneDraw->SetDisableTools(!enable, doc->GetNameActivPP());
@@ -3795,7 +3809,7 @@ void MainWindow::on_actionNew_triggered()
if (newPattern.exec() == QDialog::Accepted)
{
patternPieceName = newPattern.name();
- qApp->SetPatternUnits(newPattern.PatternUnit());
+ VAbstractValApplication::VApp()->SetPatternUnits(newPattern.PatternUnit());
qCDebug(vMainWindow, "PP name: %s", qUtf8Printable(patternPieceName));
}
else
@@ -3810,7 +3824,8 @@ void MainWindow::on_actionNew_triggered()
AddPP(patternPieceName);
- m_mouseCoordinate = new QLabel(QString("0, 0 (%1)").arg(UnitsToStr(qApp->patternUnits(), true)));
+ m_mouseCoordinate = new QLabel(QString("0, 0 (%1)")
+ .arg(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true)));
ui->toolBarOption->addWidget(m_mouseCoordinate);
m_curFileFormatVersion = VPatternConverter::PatternMaxVer;
@@ -3901,8 +3916,8 @@ void MainWindow::DimensionCBaseChanged()
void MainWindow::GradationChanged()
{
m_gradation->stop();
- if (UpdateMeasurements(AbsoluteMPath(qApp->GetPatternPath(), doc->MPath()), m_currentDimensionA,
- m_currentDimensionB, m_currentDimensionC))
+ if (UpdateMeasurements(AbsoluteMPath(VAbstractValApplication::VApp()->GetPatternPath(), doc->MPath()),
+ m_currentDimensionA, m_currentDimensionB, m_currentDimensionC))
{
doc->LiteParseTree(Document::FullLiteParse);
emit sceneDetails->DimensionsChanged();
@@ -3967,10 +3982,10 @@ void MainWindow::InitDimensionControls()
delete dimensionCLabel;
}
- if (qApp->GetMeasurementsType() == MeasurementsType::Multisize)
+ if (VAbstractValApplication::VApp()->GetMeasurementsType() == MeasurementsType::Multisize)
{
const QList dimensions = m->Dimensions().values();
- const QString unit = UnitsToStr(qApp->MeasurementsUnits(), true);
+ const QString unit = UnitsToStr(VAbstractValApplication::VApp()->MeasurementsUnits(), true);
auto InitControl = [this, dimensions, unit](int index, QPointer &name, QPointer &control)
{
@@ -4035,7 +4050,7 @@ void MainWindow::InitDimensionGradation(int index, const MeasurementDimension_p
SCASSERT(control != nullptr)
const bool fc = m->IsFullCircumference();
- const QString unit = UnitsToStr(qApp->MeasurementsUnits(), true);
+ const QString unit = UnitsToStr(VAbstractValApplication::VApp()->MeasurementsUnits(), true);
qreal current = -1;
if (control->currentIndex() != -1)
@@ -4129,7 +4144,7 @@ void MainWindow::SetEnableTool(bool enable)
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default")
- switch (qApp->GetDrawMode())
+ switch (VAbstractValApplication::VApp()->GetDrawMode())
{
case Draw::Calculation:
drawTools = enable;
@@ -4242,8 +4257,8 @@ bool MainWindow::SavePattern(const QString &fileName, QString &error)
qCDebug(vMainWindow, "Saving pattern file %s.", qUtf8Printable(fileName));
QFileInfo tempInfo(fileName);
- const QString mPath = AbsoluteMPath(qApp->GetPatternPath(), doc->MPath());
- if (not mPath.isEmpty() && qApp->GetPatternPath() != fileName)
+ const QString mPath = AbsoluteMPath(VAbstractValApplication::VApp()->GetPatternPath(), doc->MPath());
+ if (not mPath.isEmpty() && VAbstractValApplication::VApp()->GetPatternPath() != fileName)
{
doc->SetMPath(RelativeMPath(fileName, mPath));
}
@@ -4274,11 +4289,11 @@ bool MainWindow::SavePattern(const QString &fileName, QString &error)
*/
void MainWindow::AutoSavePattern()
{
- if (not qApp->GetPatternPath().isEmpty() && isWindowModified() && isNeedAutosave)
+ if (not VAbstractValApplication::VApp()->GetPatternPath().isEmpty() && isWindowModified() && isNeedAutosave)
{
qCDebug(vMainWindow, "Autosaving pattern.");
QString error;
- if (SavePattern(qApp->GetPatternPath() + *autosavePrefix, error))
+ if (SavePattern(VAbstractValApplication::VApp()->GetPatternPath() + *autosavePrefix, error))
{
isNeedAutosave = false;
}
@@ -4294,15 +4309,15 @@ void MainWindow::AutoSavePattern()
void MainWindow::setCurrentFile(const QString &fileName)
{
qCDebug(vMainWindow, "Set current name to \"%s\"", qUtf8Printable(fileName));
- qApp->SetPatternPath(fileName);
+ VAbstractValApplication::VApp()->SetPatternPath(fileName);
doc->SetPatternWasChanged(true);
emit doc->UpdatePatternLabel();
- qApp->getUndoStack()->setClean();
+ VAbstractApplication::VApp()->getUndoStack()->setClean();
- if (not qApp->GetPatternPath().isEmpty() && VApplication::IsGUIMode())
+ if (not VAbstractValApplication::VApp()->GetPatternPath().isEmpty() && VApplication::IsGUIMode())
{
qCDebug(vMainWindow, "Updating recent file list.");
- VSettings *settings = qApp->ValentinaSettings();
+ VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
QStringList files = settings->GetRecentFileList();
files.removeAll(fileName);
files.prepend(fileName);
@@ -4331,7 +4346,7 @@ void MainWindow::setCurrentFile(const QString &fileName)
void MainWindow::ReadSettings()
{
qCDebug(vMainWindow, "Reading settings.");
- const VSettings *settings = qApp->ValentinaSettings();
+ const VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
if (settings->status() == QSettings::NoError)
{
@@ -4347,7 +4362,7 @@ void MainWindow::ReadSettings()
ui->view->SetAntialiasing(settings->GetGraphicalOutput());
// Stack limit
- qApp->getUndoStack()->setUndoLimit(settings->GetUndoCount());
+ VAbstractApplication::VApp()->getUndoStack()->setUndoLimit(settings->GetUndoCount());
// Text under tool buton icon
ToolBarStyles();
@@ -4376,7 +4391,7 @@ void MainWindow::WriteSettings()
{
ActionDraw(true);
- VSettings *settings = qApp->ValentinaSettings();
+ VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
settings->SetGeometry(saveGeometry());
settings->SetWindowState(saveState());
settings->SetToolbarsState(saveState(APP_VERSION));
@@ -4411,7 +4426,8 @@ bool MainWindow::MaybeSave()
messageBox->setEscapeButton(QMessageBox::Cancel);
messageBox->setButtonText(QMessageBox::Yes,
- qApp->GetPatternPath().isEmpty() || patternReadOnly ? tr("Save…") : tr("Save"));
+ VAbstractValApplication::VApp()
+ ->GetPatternPath().isEmpty() || patternReadOnly ? tr("Save…") : tr("Save"));
messageBox->setButtonText(QMessageBox::No, tr("Don't Save"));
messageBox->setWindowModality(Qt::ApplicationModal);
@@ -4452,14 +4468,14 @@ void MainWindow::CreateMenus()
UpdateRecentFileActions();
//Add Undo/Redo actions.
- undoAction = qApp->getUndoStack()->createUndoAction(this, tr("&Undo"));
+ undoAction = VAbstractApplication::VApp()->getUndoStack()->createUndoAction(this, tr("&Undo"));
connect(undoAction, &QAction::triggered, toolOptions, &VToolOptionsPropertyBrowser::RefreshOptions);
undoAction->setShortcuts(QKeySequence::Undo);
undoAction->setIcon(QIcon::fromTheme("edit-undo"));
ui->menuPatternPiece->insertAction(ui->actionLast_tool, undoAction);
ui->toolBarTools->addAction(undoAction);
- redoAction = qApp->getUndoStack()->createRedoAction(this, tr("&Redo"));
+ redoAction = VAbstractApplication::VApp()->getUndoStack()->createRedoAction(this, tr("&Redo"));
connect(redoAction, &QAction::triggered, toolOptions, &VToolOptionsPropertyBrowser::RefreshOptions);
redoAction->setShortcuts(QKeySequence::Redo);
redoAction->setIcon(QIcon::fromTheme("edit-redo"));
@@ -4735,7 +4751,7 @@ void MainWindow::InitDocksContain()
//---------------------------------------------------------------------------------------------------------------------
bool MainWindow::OpenNewValentina(const QString &fileName) const
{
- if (this->isWindowModified() || qApp->GetPatternPath().isEmpty() == false)
+ if (this->isWindowModified() || VAbstractValApplication::VApp()->GetPatternPath().isEmpty() == false)
{
VApplication::NewValentina(fileName);
return true;
@@ -4782,7 +4798,7 @@ void MainWindow::CreateActions()
QString fileName =
QFileDialog::getSaveFileName(this, tr("Export recipe"),
QDir::homePath() + '/' + tr("recipe") + QStringLiteral(".vpr"),
- filters, nullptr, qApp->NativeFileDialog());
+ filters, nullptr, VAbstractApplication::VApp()->NativeFileDialog());
if (fileName.isEmpty())
{
return;
@@ -4897,18 +4913,18 @@ void MainWindow::CreateActions()
}
});
- ui->actionShowCurveDetails->setChecked(qApp->ValentinaSettings()->IsShowCurveDetails());
+ ui->actionShowCurveDetails->setChecked(VAbstractValApplication::VApp()->ValentinaSettings()->IsShowCurveDetails());
connect(ui->actionShowCurveDetails, &QAction::triggered, this, [this](bool checked)
{
emit ui->view->itemClicked(nullptr);
sceneDraw->EnableDetailsMode(checked);
- qApp->ValentinaSettings()->SetShowCurveDetails(checked);
+ VAbstractValApplication::VApp()->ValentinaSettings()->SetShowCurveDetails(checked);
});
- ui->actionShowMainPath->setChecked(qApp->ValentinaSettings()->IsPieceShowMainPath());
+ ui->actionShowMainPath->setChecked(VAbstractValApplication::VApp()->ValentinaSettings()->IsPieceShowMainPath());
connect(ui->actionShowMainPath, &QAction::triggered, this, [this](bool checked)
{
- qApp->ValentinaSettings()->SetPieceShowMainPath(checked);
+ VAbstractValApplication::VApp()->ValentinaSettings()->SetPieceShowMainPath(checked);
const QList ids = pattern->DataPieces()->keys();
const bool updateChildren = false;
QGuiApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
@@ -4932,7 +4948,7 @@ void MainWindow::CreateActions()
connect(ui->actionOpenTape, &QAction::triggered, this, [this]()
{
- const QString tape = qApp->TapeFilePath();
+ const QString tape = VApplication::VApp()->TapeFilePath();
const QString workingDirectory = QFileInfo(tape).absoluteDir().absolutePath();
QStringList arguments;
@@ -4997,13 +5013,13 @@ void MainWindow::InitAutoSave()
connect(autoSaveTimer, &QTimer::timeout, this, &MainWindow::AutoSavePattern);
autoSaveTimer->stop();
- if (qApp->ValentinaSettings()->GetAutosaveState())
+ if (VAbstractValApplication::VApp()->ValentinaSettings()->GetAutosaveState())
{
- const qint32 autoTime = qApp->ValentinaSettings()->GetAutosaveTime();
+ const qint32 autoTime = VAbstractValApplication::VApp()->ValentinaSettings()->GetAutosaveTime();
autoSaveTimer->start(autoTime*60000);
qCDebug(vMainWindow, "Autosaving each %d minutes.", autoTime);
}
- qApp->setAutoSaveTimer(autoSaveTimer);
+ VApplication::VApp()->setAutoSaveTimer(autoSaveTimer);
}
//---------------------------------------------------------------------------------------------------------------------
@@ -5094,7 +5110,7 @@ bool MainWindow::LoadPattern(QString fileName, const QString& customMeasureFile)
if (m.Type() == MeasurementsType::Multisize || m.Type() == MeasurementsType::Individual)
{
- const QString tape = qApp->TapeFilePath();
+ const QString tape = VApplication::VApp()->TapeFilePath();
const QString workingDirectory = QFileInfo(tape).absoluteDir().absolutePath();
QStringList arguments = QStringList() << fileName;
@@ -5139,7 +5155,7 @@ bool MainWindow::LoadPattern(QString fileName, const QString& customMeasureFile)
VMainGraphicsView::NewSceneRect(sceneDraw, ui->view);
VMainGraphicsView::NewSceneRect(sceneDetails, ui->view);
- qApp->setOpeningPattern();//Begin opening file
+ VAbstractValApplication::VApp()->setOpeningPattern();//Begin opening file
try
{
// Quick reading measurements
@@ -5158,7 +5174,7 @@ bool MainWindow::LoadPattern(QString fileName, const QString& customMeasureFile)
{
doc->SetMPath(RelativeMPath(fileName, customMeasureFile));
}
- qApp->SetPatternUnits(doc->MUnit());
+ VAbstractValApplication::VApp()->SetPatternUnits(doc->MUnit());
QString path = AbsoluteMPath(fileName, doc->MPath());
QString fixedMPath;
@@ -5171,7 +5187,7 @@ bool MainWindow::LoadPattern(QString fileName, const QString& customMeasureFile)
fixedMPath = CheckPathToMeasurements(fileName, fakeName);
if (fixedMPath.isEmpty())
{
- qApp->setOpeningPattern();// End opening file
+ VAbstractValApplication::VApp()->setOpeningPattern();// End opening file
Clear();
qCCritical(vMainWindow, "%s", qUtf8Printable(tr("The measurements file '%1' could not be found.")
.arg(fakeName)));
@@ -5193,7 +5209,7 @@ bool MainWindow::LoadPattern(QString fileName, const QString& customMeasureFile)
fixedMPath = CheckPathToMeasurements(fileName, path);
if (fixedMPath.isEmpty())
{
- qApp->setOpeningPattern();// End opening file
+ VAbstractValApplication::VApp()->setOpeningPattern();// End opening file
Clear();
qCCritical(vMainWindow, "%s", qUtf8Printable(tr("The measurements file '%1' could not be found.")
.arg(path)));
@@ -5209,7 +5225,7 @@ bool MainWindow::LoadPattern(QString fileName, const QString& customMeasureFile)
qCCritical(vMainWindow, "%s", qUtf8Printable(tr("The measurements file '%1' could not be found or "
"provides not enough information.")
.arg(fixedMPath)));
- qApp->setOpeningPattern();// End opening file
+ VAbstractValApplication::VApp()->setOpeningPattern();// End opening file
Clear();
if (not VApplication::IsGUIMode())
{
@@ -5225,7 +5241,7 @@ bool MainWindow::LoadPattern(QString fileName, const QString& customMeasureFile)
}
}
- if (qApp->GetMeasurementsType() == MeasurementsType::Unknown)
+ if (VAbstractValApplication::VApp()->GetMeasurementsType() == MeasurementsType::Unknown)
{// Show toolbar only if was not uploaded any measurements.
ToolBarOption();
}
@@ -5245,14 +5261,14 @@ bool MainWindow::LoadPattern(QString fileName, const QString& customMeasureFile)
{
doc->SetMPath(RelativeMPath(fileName, fixedMPath));
}
- qApp->SetPatternUnits(doc->MUnit());
+ VAbstractValApplication::VApp()->SetPatternUnits(doc->MUnit());
}
}
catch (VException &e)
{
qCCritical(vMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("File error.")),
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
- qApp->setOpeningPattern();// End opening file
+ VAbstractValApplication::VApp()->setOpeningPattern();// End opening file
Clear();
if (not VApplication::IsGUIMode())
{
@@ -5281,7 +5297,7 @@ bool MainWindow::LoadPattern(QString fileName, const QString& customMeasureFile)
if (guiEnabled)
{ // No errors occurred
- if (qApp->IsGUIMode())
+ if (VApplication::VApp()->IsGUIMode())
{
/* Collect garbage only after successfully parse. This way wrongly accused items have one more time to restore
* a reference. */
@@ -5298,13 +5314,13 @@ bool MainWindow::LoadPattern(QString fileName, const QString& customMeasureFile)
ActionDraw(true);
- qApp->setOpeningPattern();// End opening file
+ VAbstractValApplication::VApp()->setOpeningPattern();// End opening file
m_statusLabel->setText(QString());
return true;
}
else
{
- qApp->setOpeningPattern();// End opening file
+ VAbstractValApplication::VApp()->setOpeningPattern();// End opening file
return false;
}
}
@@ -5314,7 +5330,7 @@ QStringList MainWindow::GetUnlokedRestoreFileList() const
{
QStringList restoreFiles;
//Take all files that need to be restored
- QStringList files = qApp->ValentinaSettings()->GetRestoreFileList();
+ QStringList files = VAbstractValApplication::VApp()->ValentinaSettings()->GetRestoreFileList();
if (files.size() > 0)
{
for (auto &file : files)
@@ -5343,7 +5359,7 @@ QStringList MainWindow::GetUnlokedRestoreFileList() const
}
}
- qApp->ValentinaSettings()->SetRestoreFileList(filtered);
+ VAbstractValApplication::VApp()->ValentinaSettings()->SetRestoreFileList(filtered);
}
return restoreFiles;
}
@@ -5362,8 +5378,8 @@ void MainWindow::ToolBarStyles()
void MainWindow::ToolBoxSizePolicy()
{
ui->toolBox->setSizePolicy(ui->toolBox->sizePolicy().horizontalPolicy(),
- qApp->ValentinaSettings()->GetToolPanelScaling() ? QSizePolicy::Fixed
- : QSizePolicy::Preferred);
+ VAbstractValApplication::VApp()->ValentinaSettings()->GetToolPanelScaling()
+ ? QSizePolicy::Fixed : QSizePolicy::Preferred);
}
//---------------------------------------------------------------------------------------------------------------------
@@ -5414,7 +5430,7 @@ void MainWindow::Preferences()
#if defined(Q_OS_MAC)
void MainWindow::CreateMeasurements()
{
- const QString tape = qApp->TapeFilePath();
+ const QString tape = VApplication::VApp()->TapeFilePath();
const QString workingDirectory = QFileInfo(tape).absoluteDir().absolutePath();
QStringList arguments;
@@ -5589,7 +5605,8 @@ QString MainWindow::CheckPathToMeasurements(const QString &patternPath, const QS
QFileDialog dialog(this, tr("Open file"), dirPath, filter);
dialog.selectFile(selectedName);
dialog.setFileMode(QFileDialog::ExistingFile);
- dialog.setOption(QFileDialog::DontUseNativeDialog, qApp->Settings()->IsDontUseNativeDialog());
+ dialog.setOption(QFileDialog::DontUseNativeDialog,
+ VAbstractApplication::VApp()->Settings()->IsDontUseNativeDialog());
if (dialog.exec() == QDialog::Accepted)
{
mPath = dialog.selectedFiles().value(0);
@@ -5663,7 +5680,8 @@ QString MainWindow::CheckPathToMeasurements(const QString &patternPath, const QS
tr("Individual measurements") + QLatin1String(" (*.vit)");
//Use standard path to multisize measurements
QString selectedName;
- const QString dirPath = DirPath(qApp->ValentinaSettings()->GetPathMultisizeMeasurements(),
+ const QString dirPath = DirPath(VAbstractValApplication::VApp()
+ ->ValentinaSettings()->GetPathMultisizeMeasurements(),
selectedName);
mPath = FindLocation(filter, dirPath, selectedName);
}
@@ -5673,7 +5691,8 @@ QString MainWindow::CheckPathToMeasurements(const QString &patternPath, const QS
tr("Multisize measurements") + QLatin1String(" (*.vst)");
//Use standard path to individual measurements
QString selectedName;
- const QString dirPath = DirPath(qApp->ValentinaSettings()->GetPathIndividualMeasurements(),
+ const QString dirPath = DirPath(VAbstractValApplication::VApp()
+ ->ValentinaSettings()->GetPathIndividualMeasurements(),
selectedName);
mPath = FindLocation(filter, dirPath, selectedName);
}
@@ -5714,7 +5733,7 @@ QString MainWindow::CheckPathToMeasurements(const QString &patternPath, const QS
CheckRequiredMeasurements(m.data());
- qApp->SetMeasurementsType(patternType);
+ VAbstractValApplication::VApp()->SetMeasurementsType(patternType);
doc->SetMPath(RelativeMPath(patternPath, mPath));
return mPath;
}
@@ -5795,7 +5814,7 @@ void MainWindow::ZoomFirstShow()
bool MainWindow::DoExport(const VCommandLinePtr &expParams)
{
QVector details;
- if(not qApp->getOpeningPattern())
+ if(not VAbstractValApplication::VApp()->getOpeningPattern())
{
const QHash *allDetails = pattern->DataPieces();
if (allDetails->count() == 0)
@@ -5949,9 +5968,9 @@ bool MainWindow::SetDimensionA(int value)
{
if (not VApplication::IsGUIMode())
{
- if (this->isWindowModified() || not qApp->GetPatternPath().isEmpty())
+ if (this->isWindowModified() || not VAbstractValApplication::VApp()->GetPatternPath().isEmpty())
{
- if (qApp->GetMeasurementsType() == MeasurementsType::Multisize)
+ if (VAbstractValApplication::VApp()->GetMeasurementsType() == MeasurementsType::Multisize)
{
const qint32 index = dimensionA->findData(value);
if (index != -1)
@@ -5992,9 +6011,9 @@ bool MainWindow::SetDimensionB(int value)
{
if (not VApplication::IsGUIMode())
{
- if (this->isWindowModified() || not qApp->GetPatternPath().isEmpty())
+ if (this->isWindowModified() || not VAbstractValApplication::VApp()->GetPatternPath().isEmpty())
{
- if (qApp->GetMeasurementsType() == MeasurementsType::Multisize)
+ if (VAbstractValApplication::VApp()->GetMeasurementsType() == MeasurementsType::Multisize)
{
const qint32 index = dimensionB->findData(value);
if (index != -1)
@@ -6035,9 +6054,9 @@ bool MainWindow::SetDimensionC(int value)
{
if (not VApplication::IsGUIMode())
{
- if (this->isWindowModified() || not qApp->GetPatternPath().isEmpty())
+ if (this->isWindowModified() || not VAbstractValApplication::VApp()->GetPatternPath().isEmpty())
{
- if (qApp->GetMeasurementsType() == MeasurementsType::Multisize)
+ if (VAbstractValApplication::VApp()->GetMeasurementsType() == MeasurementsType::Multisize)
{
const qint32 index = dimensionC->findData(value);
if (index != -1)
@@ -6076,7 +6095,7 @@ bool MainWindow::SetDimensionC(int value)
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ProcessCMD()
{
- const VCommandLinePtr cmd = qApp->CommandLine();
+ const VCommandLinePtr cmd = VApplication::VApp()->CommandLine();
auto args = cmd->OptInputFileNames();
isNoScaling = cmd->IsNoScalingEnabled();
@@ -6099,7 +6118,7 @@ void MainWindow::ProcessCMD()
return;
}
- qApp->SetUserMaterials(cmd->OptUserMaterials());
+ VAbstractValApplication::VApp()->SetUserMaterials(cmd->OptUserMaterials());
const bool loaded = LoadPattern(args.first(), cmd->OptMeasurePath());
@@ -6153,9 +6172,9 @@ void MainWindow::ProcessCMD()
QString MainWindow::GetPatternFileName()
{
QString shownName = tr("untitled.val");
- if(not qApp->GetPatternPath().isEmpty())
+ if(not VAbstractValApplication::VApp()->GetPatternPath().isEmpty())
{
- shownName = StrippedName(qApp->GetPatternPath());
+ shownName = StrippedName(VAbstractValApplication::VApp()->GetPatternPath());
}
shownName += QLatin1String("[*]");
return shownName;
@@ -6171,7 +6190,7 @@ QString MainWindow::GetMeasurementFileName()
else
{
QString shownName(" [");
- shownName += StrippedName(AbsoluteMPath(qApp->GetPatternPath(), doc->MPath()));
+ shownName += StrippedName(AbsoluteMPath(VAbstractValApplication::VApp()->GetPatternPath(), doc->MPath()));
if(mChanges)
{
@@ -6187,12 +6206,12 @@ QString MainWindow::GetMeasurementFileName()
void MainWindow::UpdateWindowTitle()
{
bool isFileWritable = true;
- if (not qApp->GetPatternPath().isEmpty())
+ if (not VAbstractValApplication::VApp()->GetPatternPath().isEmpty())
{
#ifdef Q_OS_WIN32
qt_ntfs_permission_lookup++; // turn checking on
#endif /*Q_OS_WIN32*/
- isFileWritable = QFileInfo(qApp->GetPatternPath()).isWritable();
+ isFileWritable = QFileInfo(VAbstractValApplication::VApp()->GetPatternPath()).isWritable();
#ifdef Q_OS_WIN32
qt_ntfs_permission_lookup--; // turn it off again
#endif /*Q_OS_WIN32*/
@@ -6207,13 +6226,13 @@ void MainWindow::UpdateWindowTitle()
setWindowTitle(GetPatternFileName()+GetMeasurementFileName() + QLatin1String(" (") + tr("read only") +
QLatin1String(")"));
}
- setWindowFilePath(qApp->GetPatternPath());
+ setWindowFilePath(VAbstractValApplication::VApp()->GetPatternPath());
#if defined(Q_OS_MAC)
static QIcon fileIcon = QIcon(QCoreApplication::applicationDirPath() +
QLatin1String("/../Resources/Valentina.icns"));
QIcon icon;
- if (not qApp->GetPatternPath().isEmpty())
+ if (not VAbstractValApplication::VApp()->GetPatternPath().isEmpty())
{
if (not isWindowModified())
{
@@ -6597,14 +6616,14 @@ void MainWindow::OpenWatermark(const QString &path)
for (i = m_watermarkEditors.begin(); i != m_watermarkEditors.end(); ++i)
{
if (not (*i).isNull() && not (*i)->CurrentFile().isEmpty()
- && (*i)->CurrentFile() == AbsoluteMPath(qApp->GetPatternPath(), path))
+ && (*i)->CurrentFile() == AbsoluteMPath(VAbstractValApplication::VApp()->GetPatternPath(), path))
{
(*i)->show();
return;
}
}
- auto *watermark = new WatermarkWindow(qApp->GetPatternPath(), this);
+ auto *watermark = new WatermarkWindow(VAbstractValApplication::VApp()->GetPatternPath(), this);
connect(watermark, &WatermarkWindow::New, this, [this](){OpenWatermark();});
connect(watermark, &WatermarkWindow::OpenAnother, this, [this](const QString &path){OpenWatermark(path);});
m_watermarkEditors.append(watermark);
diff --git a/src/app/valentina/mainwindowsnogui.cpp b/src/app/valentina/mainwindowsnogui.cpp
index 0bca2967a..a61dfea90 100644
--- a/src/app/valentina/mainwindowsnogui.cpp
+++ b/src/app/valentina/mainwindowsnogui.cpp
@@ -128,7 +128,8 @@ void InsertGlobalContours(const QList &scenes, const QListTrVars(), qApp->patternUnitsP(), valentinaNamespace))
+ pattern(new VContainer(VAbstractApplication::VApp()->TrVars(), VAbstractValApplication::VApp()->patternUnitsP(),
+ valentinaNamespace))
#if defined(Q_OS_WIN32) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
,m_taskbarButton(new QWinTaskbarButton(this))
#endif
@@ -468,17 +469,17 @@ void MainWindowsNoGUI::ExportFMeasurementsToCSV()
}
DialogExportToCSV dialog(this);
- dialog.SetWithHeader(qApp->Settings()->GetCSVWithHeader());
- dialog.SetSelectedMib(qApp->Settings()->GetCSVCodec());
- dialog.SetSeparator(qApp->Settings()->GetCSVSeparator());
+ dialog.SetWithHeader(VAbstractApplication::VApp()->Settings()->GetCSVWithHeader());
+ dialog.SetSelectedMib(VAbstractApplication::VApp()->Settings()->GetCSVCodec());
+ dialog.SetSeparator(VAbstractApplication::VApp()->Settings()->GetCSVSeparator());
if (dialog.exec() == QDialog::Accepted)
{
ExportFMeasurementsToCSVData(fileName, dialog.IsWithHeader(), dialog.GetSelectedMib(), dialog.GetSeparator());
- qApp->Settings()->SetCSVSeparator(dialog.GetSeparator());
- qApp->Settings()->SetCSVCodec(dialog.GetSelectedMib());
- qApp->Settings()->SetCSVWithHeader(dialog.IsWithHeader());
+ VAbstractApplication::VApp()->Settings()->SetCSVSeparator(dialog.GetSeparator());
+ VAbstractApplication::VApp()->Settings()->SetCSVCodec(dialog.GetSelectedMib());
+ VAbstractApplication::VApp()->Settings()->SetCSVWithHeader(dialog.IsWithHeader());
}
}
@@ -554,7 +555,7 @@ void MainWindowsNoGUI::ExportFlatLayout(const QList &scenes,
return;
}
- qApp->ValentinaSettings()->SetPathLayout(path);
+ VAbstractValApplication::VApp()->ValentinaSettings()->SetPathLayout(path);
const LayoutExportFormats format = m_dialogSaveLayout->Format();
if (format == LayoutExportFormats::PDFTiled && m_dialogSaveLayout->Mode() == Draw::Layout)
@@ -655,7 +656,7 @@ void MainWindowsNoGUI::ExportApparelLayout(const QVector &details,
return;
}
- qApp->ValentinaSettings()->SetPathLayout(path);
+ VAbstractValApplication::VApp()->ValentinaSettings()->SetPathLayout(path);
const LayoutExportFormats format = m_dialogSaveLayout->Format();
VLayoutExporter exporter;
@@ -848,14 +849,15 @@ void MainWindowsNoGUI::PrintPreviewTiled()
}
else
{
- VSettings *settings = qApp->ValentinaSettings();
+ VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
m_layoutSettings->SetTiledMargins(QMarginsF(settings->GetTiledPDFMargins(Unit::Mm)));
m_layoutSettings->SetTiledPDFOrientation(settings->GetTiledPDFOrientation());
m_layoutSettings->SetTiledPDFPaperSize(QSizeF(settings->GetTiledPDFPaperWidth(Unit::Mm),
settings->GetTiledPDFPaperHeight(Unit::Mm)));
}
- m_layoutSettings->SetWatermarkPath(AbsoluteMPath(qApp->GetPatternPath(), doc->GetWatermarkPath()));
+ m_layoutSettings->SetWatermarkPath(
+ AbsoluteMPath(VAbstractValApplication::VApp()->GetPatternPath(), doc->GetWatermarkPath()));
m_layoutSettings->PrintPreviewTiled();
}
@@ -881,14 +883,15 @@ void MainWindowsNoGUI::PrintTiled()
}
else
{
- VSettings *settings = qApp->ValentinaSettings();
+ VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
m_layoutSettings->SetTiledMargins(QMarginsF(settings->GetTiledPDFMargins(Unit::Mm)));
m_layoutSettings->SetTiledPDFOrientation(settings->GetTiledPDFOrientation());
m_layoutSettings->SetTiledPDFPaperSize(QSizeF(settings->GetTiledPDFPaperWidth(Unit::Mm),
settings->GetTiledPDFPaperHeight(Unit::Mm)));
}
- m_layoutSettings->SetWatermarkPath(AbsoluteMPath(qApp->GetPatternPath(), doc->GetWatermarkPath()));
+ m_layoutSettings->SetWatermarkPath(
+ AbsoluteMPath(VAbstractValApplication::VApp()->GetPatternPath(), doc->GetWatermarkPath()));
m_layoutSettings->PrintTiled();
}
@@ -919,7 +922,7 @@ QVector MainWindowsNoGUI::PrepareDetailsForLayout(const QVectorIsGUIMode())
+ if (VApplication::VApp()->IsGUIMode())
{
progress.exec();
}
@@ -949,7 +952,7 @@ void MainWindowsNoGUI::InitTempLayoutScene()
//---------------------------------------------------------------------------------------------------------------------
QStringList MainWindowsNoGUI::RecentFileList() const
{
- return qApp->ValentinaSettings()->GetRecentFileList();
+ return VAbstractValApplication::VApp()->ValentinaSettings()->GetRecentFileList();
}
//---------------------------------------------------------------------------------------------------------------------
@@ -977,8 +980,8 @@ QIcon MainWindowsNoGUI::ScenePreview(int i, QSize iconSize, PreviewQuatilty qual
QPainter painter(&image);
painter.setFont( QFont( QStringLiteral("Arial"), 8, QFont::Normal ) );
painter.setRenderHint(QPainter::Antialiasing, true);
- painter.setPen(QPen(Qt::black, qApp->Settings()->WidthMainLine(), Qt::SolidLine, Qt::RoundCap,
- Qt::RoundJoin));
+ painter.setPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthMainLine(), Qt::SolidLine,
+ Qt::RoundCap, Qt::RoundJoin));
painter.setBrush ( QBrush ( Qt::NoBrush ) );
m_layoutSettings->LayoutScenes().at(i)->render(&painter, r, r, Qt::IgnoreAspectRatio);
painter.end();
@@ -1067,7 +1070,7 @@ void MainWindowsNoGUI::PdfTiledFile(const QString &name)
}
else
{
- VSettings *settings = qApp->ValentinaSettings();
+ VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
m_layoutSettings->SetTiledMargins(QMarginsF(settings->GetTiledPDFMargins(Unit::Mm)));
m_layoutSettings->SetTiledPDFOrientation(settings->GetTiledPDFOrientation());
m_layoutSettings->SetTiledPDFPaperSize(QSizeF(settings->GetTiledPDFPaperWidth(Unit::Mm),
@@ -1076,7 +1079,8 @@ void MainWindowsNoGUI::PdfTiledFile(const QString &name)
m_layoutSettings->SetYScale(1);
}
- m_layoutSettings->SetWatermarkPath(AbsoluteMPath(qApp->GetPatternPath(), doc->GetWatermarkPath()));
+ m_layoutSettings->SetWatermarkPath(
+ AbsoluteMPath(VAbstractValApplication::VApp()->GetPatternPath(), doc->GetWatermarkPath()));
m_layoutSettings->PdfTiledFile(name);
}
@@ -1117,19 +1121,19 @@ void MainWindowsNoGUI::ExportScene(const QList &scenes,
{
case LayoutExportFormats::SVG:
paper->setVisible(false);
- exporter.SetPen(QPen(Qt::black, qApp->Settings()->WidthHairLine(), Qt::SolidLine, Qt::RoundCap,
- Qt::RoundJoin));
+ exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
+ Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
exporter.ExportToSVG(scene);
paper->setVisible(true);
break;
case LayoutExportFormats::PDF:
- exporter.SetPen(QPen(Qt::black, qApp->Settings()->WidthHairLine(), Qt::SolidLine, Qt::RoundCap,
- Qt::RoundJoin));
+ exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
+ Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
exporter.ExportToPDF(scene);
break;
case LayoutExportFormats::PNG:
- exporter.SetPen(QPen(Qt::black, qApp->Settings()->WidthHairLine(), Qt::SolidLine, Qt::RoundCap,
- Qt::RoundJoin));
+ exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
+ Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
exporter.ExportToPNG(scene);
break;
case LayoutExportFormats::OBJ:
@@ -1138,13 +1142,13 @@ void MainWindowsNoGUI::ExportScene(const QList &scenes,
paper->setVisible(true);
break;
case LayoutExportFormats::PS:
- exporter.SetPen(QPen(Qt::black, qApp->Settings()->WidthHairLine(), Qt::SolidLine, Qt::RoundCap,
- Qt::RoundJoin));
+ exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
+ Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
exporter.ExportToPS(scene);
break;
case LayoutExportFormats::EPS:
- exporter.SetPen(QPen(Qt::black, qApp->Settings()->WidthHairLine(), Qt::SolidLine, Qt::RoundCap,
- Qt::RoundJoin));
+ exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
+ Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
exporter.ExportToEPS(scene);
break;
case LayoutExportFormats::DXF_AC1006_Flat:
@@ -1202,8 +1206,8 @@ void MainWindowsNoGUI::ExportScene(const QList &scenes,
paper->setVisible(true);
break;
case LayoutExportFormats::TIF:
- exporter.SetPen(QPen(Qt::black, qApp->Settings()->WidthHairLine(), Qt::SolidLine, Qt::RoundCap,
- Qt::RoundJoin));
+ exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
+ Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
exporter.ExportToTIF(scene);
break;
default:
@@ -1224,7 +1228,8 @@ void MainWindowsNoGUI::ExportScene(const QList &scenes,
QString MainWindowsNoGUI::FileName() const
{
QString fileName;
- qApp->GetPatternPath().isEmpty() ? fileName = tr("unnamed") : fileName = qApp->GetPatternPath();
+ VAbstractValApplication::VApp()->GetPatternPath().isEmpty()
+ ? fileName = tr("unnamed") : fileName = VAbstractValApplication::VApp()->GetPatternPath();
return QFileInfo(fileName).baseName();
}
@@ -1262,7 +1267,7 @@ bool MainWindowsNoGUI::ExportFMeasurementsToCSVData(const QString &fileName, boo
QScopedPointer cal(new Calculator());
const qreal result = cal->EvalFormula(completeData.DataVariables(), m.formula);
- csv.setText(i, 1, qApp->LocaleToString(result)); // value
+ csv.setText(i, 1, VAbstractApplication::VApp()->LocaleToString(result)); // value
if (qIsInf(result) || qIsNaN(result))
{
@@ -1371,7 +1376,7 @@ void MainWindowsNoGUI::CheckRequiredMeasurements(const VMeasurements *m) const
QList list = ConvertToList(match);
for (int i = 0; i < list.size(); ++i)
{
- list[i] = qApp->TrVars()->MToUser(list.at(i));
+ list[i] = VAbstractApplication::VApp()->TrVars()->MToUser(list.at(i));
}
VException e(tr("Measurement file doesn't include all required measurements."));
diff --git a/src/app/valentina/valentina.pro b/src/app/valentina/valentina.pro
index 953b236d1..f726878b6 100644
--- a/src/app/valentina/valentina.pro
+++ b/src/app/valentina/valentina.pro
@@ -584,16 +584,7 @@ DEPENDPATH += $$PWD/../../libs/vformat
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vformat/$${DESTDIR}/vformat.lib
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vformat/$${DESTDIR}/libvformat.a
-# VLayout static library (depend on IFC, VGeometry, VPatternDB)
-unix|win32: LIBS += -L$$OUT_PWD/../../libs/vlayout/$${DESTDIR}/ -lvlayout
-
-INCLUDEPATH += $$PWD/../../libs/vlayout
-DEPENDPATH += $$PWD/../../libs/vlayout
-
-win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vlayout/$${DESTDIR}/vlayout.lib
-else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vlayout/$${DESTDIR}/libvlayout.a
-
-#VPatternDB static library (depend on vgeometry, vmisc)
+#VPatternDB static library (depend on vgeometry, vmisc, VLayout)
unix|win32: LIBS += -L$$OUT_PWD/../../libs/vpatterndb/$${DESTDIR} -lvpatterndb
INCLUDEPATH += $$PWD/../../libs/vpatterndb
@@ -602,6 +593,15 @@ DEPENDPATH += $$PWD/../../libs/vpatterndb
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vpatterndb/$${DESTDIR}/vpatterndb.lib
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vpatterndb/$${DESTDIR}/libvpatterndb.a
+# VLayout static library (depend on IFC, VGeometry)
+unix|win32: LIBS += -L$$OUT_PWD/../../libs/vlayout/$${DESTDIR}/ -lvlayout
+
+INCLUDEPATH += $$PWD/../../libs/vlayout
+DEPENDPATH += $$PWD/../../libs/vlayout
+
+win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vlayout/$${DESTDIR}/vlayout.lib
+else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vlayout/$${DESTDIR}/libvlayout.a
+
# VGeometry static library (depend on ifc)
unix|win32: LIBS += -L$$OUT_PWD/../../libs/vgeometry/$${DESTDIR}/ -lvgeometry
diff --git a/src/app/valentina/watermarkwindow.cpp b/src/app/valentina/watermarkwindow.cpp
index f85de0f6f..6c62258d3 100644
--- a/src/app/valentina/watermarkwindow.cpp
+++ b/src/app/valentina/watermarkwindow.cpp
@@ -53,7 +53,7 @@ WatermarkWindow::WatermarkWindow(const QString &patternPath, QWidget *parent) :
ui->setupUi(this);
m_okPathColor = ui->lineEditPath->palette().color(ui->lineEditPath->foregroundRole());
- qApp->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
UpdateWindowTitle();
m_curFileFormatVersion = VWatermarkConverter::WatermarkMaxVer;
@@ -94,7 +94,8 @@ WatermarkWindow::WatermarkWindow(const QString &patternPath, QWidget *parent) :
{
const QString filter = tr("Images") + QLatin1String(" (*.png *.jpg *.jpeg *.bmp)");
const QString fileName = QFileDialog::getOpenFileName(this, tr("Watermark image"), QString(), filter,
- nullptr, qApp->NativeFileDialog());
+ nullptr,
+ VAbstractApplication::VApp()->NativeFileDialog());
if (not fileName.isEmpty())
{
ui->lineEditPath->setText(fileName);
@@ -241,7 +242,7 @@ void WatermarkWindow::showEvent(QShowEvent *event)
}
// do your init stuff here
- QSize sz = qApp->ValentinaSettings()->GetWatermarkEditorSize();
+ QSize sz = VAbstractValApplication::VApp()->ValentinaSettings()->GetWatermarkEditorSize();
if (sz.isEmpty() == false)
{
resize(sz);
@@ -258,7 +259,7 @@ void WatermarkWindow::resizeEvent(QResizeEvent *event)
// window creating, which would
if (m_isInitialized)
{
- qApp->ValentinaSettings()->SetWatermarkEditorSize(size());
+ VAbstractValApplication::VApp()->ValentinaSettings()->SetWatermarkEditorSize(size());
}
QMainWindow::resizeEvent(event);
}
@@ -285,7 +286,7 @@ bool WatermarkWindow::on_actionSaveAs_triggered()
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"),
dir + QLatin1String("/") + tr("watermark") + QLatin1String(".vwm"),
- filters, nullptr, qApp->NativeFileDialog());
+ filters, nullptr, VAbstractApplication::VApp()->NativeFileDialog());
if (fileName.isEmpty())
{
@@ -434,7 +435,7 @@ void WatermarkWindow::on_actionOpen_triggered()
QString dir = QDir::homePath();
qDebug("Run QFileDialog::getOpenFileName: dir = %s.", qUtf8Printable(dir));
const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), dir, filter, nullptr,
- qApp->NativeFileDialog());
+ VAbstractApplication::VApp()->NativeFileDialog());
if (filePath.isEmpty())
{
return;
@@ -555,7 +556,7 @@ QString WatermarkWindow::GetWatermarkFileName()
//---------------------------------------------------------------------------------------------------------------------
bool WatermarkWindow::ContinueFormatRewrite(const QString ¤tFormatVersion, const QString &maxFormatVersion)
{
- if (qApp->Settings()->GetConfirmFormatRewriting())
+ if (VAbstractApplication::VApp()->Settings()->GetConfirmFormatRewriting())
{
Utils::CheckableMessageBox msgBox(this);
msgBox.setWindowTitle(tr("Confirm format rewriting"));
@@ -571,7 +572,7 @@ bool WatermarkWindow::ContinueFormatRewrite(const QString ¤tFormatVersion,
if (dialogResult == QDialog::Accepted)
{
- qApp->Settings()->SetConfirmFormatRewriting(not msgBox.isChecked());
+ VAbstractApplication::VApp()->Settings()->SetConfirmFormatRewriting(not msgBox.isChecked());
return true;
}
else
@@ -732,7 +733,7 @@ void WatermarkWindow::ValidatePath()
void WatermarkWindow::ToolBarStyle(QToolBar *bar)
{
SCASSERT(bar != nullptr)
- if (qApp->Settings()->GetToolBarStyle())
+ if (VAbstractApplication::VApp()->Settings()->GetToolBarStyle())
{
bar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
}
diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp
index ac8a880db..4484edc22 100644
--- a/src/app/valentina/xml/vpattern.cpp
+++ b/src/app/valentina/xml/vpattern.cpp
@@ -98,7 +98,7 @@ void GatherCount(int &count, const int nodes)
//---------------------------------------------------------------------------------------------------------------------
QString DefLabelLanguage()
{
- QString def = qApp->ValentinaSettings()->GetLabelLanguage();
+ QString def = VAbstractValApplication::VApp()->ValentinaSettings()->GetLabelLanguage();
if (not ConvertToSet(VApplication::LabelLanguages()).contains(def))
{
def = QStringLiteral("en");
@@ -127,7 +127,8 @@ void VPattern::CreateEmptyFile()
patternElement.appendChild(createComment(FileComment()));
patternElement.appendChild(CreateElementWithText(TagVersion, VPatternConverter::PatternMaxVerStr));
- patternElement.appendChild(CreateElementWithText(TagUnit, UnitsToStr(qApp->patternUnits())));
+ patternElement.appendChild(CreateElementWithText(TagUnit,
+ UnitsToStr(VAbstractValApplication::VApp()->patternUnits())));
patternElement.appendChild(createElement(TagDescription));
patternElement.appendChild(createElement(TagNotes));
@@ -227,11 +228,11 @@ void VPattern::Parse(const Document &parse)
}
domNode = domNode.nextSibling();
}
- if (qApp->IsGUIMode())
+ if (VApplication::VApp()->IsGUIMode())
{
QTimer::singleShot(1000, Qt::VeryCoarseTimer, this, SLOT(RefreshPieceGeometry()));
}
- else if (qApp->CommandLine()->IsTestModeEnabled())
+ else if (VApplication::VApp()->CommandLine()->IsTestModeEnabled())
{
RefreshPieceGeometry();
}
@@ -249,7 +250,7 @@ void VPattern::Parse(const Document &parse)
*/
void VPattern::setCurrentData()
{
- if (qApp->GetDrawMode() == Draw::Calculation)
+ if (VAbstractValApplication::VApp()->GetDrawMode() == Draw::Calculation)
{
const int countPP = CountPP();
if (countPP > 1)//don't need upadate data if we have only one pattern piece
@@ -670,8 +671,8 @@ void VPattern::LiteParseTree(const Document &parse)
setCurrentData();
emit FullUpdateFromFile();
// Recalculate scene rect
- VMainGraphicsView::NewSceneRect(sceneDraw, qApp->getSceneView());
- VMainGraphicsView::NewSceneRect(sceneDetail, qApp->getSceneView());
+ VMainGraphicsView::NewSceneRect(sceneDraw, VAbstractValApplication::VApp()->getSceneView());
+ VMainGraphicsView::NewSceneRect(sceneDetail, VAbstractValApplication::VApp()->getSceneView());
qCDebug(vXML, "Scene size updated.");
}
@@ -681,7 +682,7 @@ void VPattern::customEvent(QEvent *event)
{
if (event->type() == UNDO_EVENT)
{
- qApp->getUndoStack()->undo();
+ VAbstractApplication::VApp()->getUndoStack()->undo();
}
else if (event->type() == LITE_PARSE_EVENT)
{
@@ -864,18 +865,23 @@ void VPattern::ParseDetailElement(QDomElement &domElement, const Document &parse
VToolSeamAllowanceInitData initData;
initData.id = GetParametrId(domElement);
initData.detail.SetName(GetParametrString(domElement, AttrName, tr("Detail")));
- initData.detail.SetMx(qApp->toPixel(GetParametrDouble(domElement, AttrMx, QStringLiteral("0.0"))));
- initData.detail.SetMy(qApp->toPixel(GetParametrDouble(domElement, AttrMy, QStringLiteral("0.0"))));
+ initData.detail.SetMx(VAbstractValApplication::VApp()
+ ->toPixel(GetParametrDouble(domElement, AttrMx, QStringLiteral("0.0"))));
+ initData.detail.SetMy(VAbstractValApplication::VApp()
+ ->toPixel(GetParametrDouble(domElement, AttrMy, QStringLiteral("0.0"))));
initData.detail.SetSeamAllowance(GetParametrBool(domElement, VToolSeamAllowance::AttrSeamAllowance, falseStr));
initData.detail.SetHideMainPath(GetParametrBool(domElement, VToolSeamAllowance::AttrHideMainPath,
- QString().setNum(qApp->ValentinaSettings()->IsHideMainPath())));
+ QString().setNum(VAbstractValApplication::VApp()
+ ->ValentinaSettings()->IsHideMainPath())));
initData.detail.SetSeamAllowanceBuiltIn(GetParametrBool(domElement,
VToolSeamAllowance::AttrSeamAllowanceBuiltIn,
falseStr));
initData.detail.SetForbidFlipping(GetParametrBool(domElement, AttrForbidFlipping,
- QString().setNum(qApp->ValentinaSettings()->GetForbidWorkpieceFlipping())));
+ QString().setNum(VAbstractValApplication::VApp()
+ ->ValentinaSettings()->GetForbidWorkpieceFlipping())));
initData.detail.SetForceFlipping(GetParametrBool(domElement, AttrForceFlipping,
- QString().setNum(qApp->ValentinaSettings()->GetForceWorkpieceFlipping())));
+ QString().setNum(VAbstractValApplication::VApp()
+ ->ValentinaSettings()->GetForceWorkpieceFlipping())));
initData.detail.SetInLayout(GetParametrBool(domElement, AttrInLayout, trueStr));
initData.detail.SetUnited(GetParametrBool(domElement, VToolSeamAllowance::AttrUnited, falseStr));
initData.detail.SetPriority(GetParametrUInt(domElement, VToolSeamAllowance::AttrPiecePriority, QChar('0')));
@@ -1210,8 +1216,8 @@ void VPattern::PointsCommonAttributes(const QDomElement &domElement, VToolSingle
void VPattern::PointsCommonAttributes(const QDomElement &domElement, quint32 &id, qreal &mx, qreal &my)
{
ToolsCommonAttributes(domElement, id);
- mx = qApp->toPixel(GetParametrDouble(domElement, AttrMx, QString::number(labelMX)));
- my = qApp->toPixel(GetParametrDouble(domElement, AttrMy, QString::number(labelMY)));
+ mx = VAbstractValApplication::VApp()->toPixel(GetParametrDouble(domElement, AttrMx, QString::number(labelMX)));
+ my = VAbstractValApplication::VApp()->toPixel(GetParametrDouble(domElement, AttrMy, QString::number(labelMY)));
}
//---------------------------------------------------------------------------------------------------------------------
@@ -1219,8 +1225,8 @@ void VPattern::DrawPointsCommonAttributes(const QDomElement &domElement, quint32
QString ¬es)
{
DrawToolsCommonAttributes(domElement, id, notes);
- mx = qApp->toPixel(GetParametrDouble(domElement, AttrMx, QString::number(labelMX)));
- my = qApp->toPixel(GetParametrDouble(domElement, AttrMy, QString::number(labelMY)));
+ mx = VAbstractValApplication::VApp()->toPixel(GetParametrDouble(domElement, AttrMx, QString::number(labelMX)));
+ my = VAbstractValApplication::VApp()->toPixel(GetParametrDouble(domElement, AttrMy, QString::number(labelMY)));
}
//---------------------------------------------------------------------------------------------------------------------
@@ -1489,8 +1495,10 @@ void VPattern::ParseToolBasePoint(VMainGraphicsScene *scene, const QDomElement &
initData.typeCreation = Source::FromFile;
PointsCommonAttributes(domElement, initData);
- initData.x = qApp->toPixel(GetParametrDouble(domElement, AttrX, QStringLiteral("10.0")));
- initData.y = qApp->toPixel(GetParametrDouble(domElement, AttrY, QStringLiteral("10.0")));
+ initData.x = VAbstractValApplication::VApp()
+ ->toPixel(GetParametrDouble(domElement, AttrX, QStringLiteral("10.0")));
+ initData.y = VAbstractValApplication::VApp()
+ ->toPixel(GetParametrDouble(domElement, AttrY, QStringLiteral("10.0")));
spoint = VToolBasePoint::Create(initData);
}
@@ -2494,13 +2502,17 @@ void VPattern::ParseToolTrueDarts(VMainGraphicsScene *scene, const QDomElement &
initData.dartP3Id = GetParametrUInt(domElement, AttrDartP3, NULL_ID_STR);
initData.name1 = GetParametrString(domElement, AttrName1, QChar('A'));
- initData.mx1 = qApp->toPixel(GetParametrDouble(domElement, AttrMx1, QString::number(labelMX)));
- initData.my1 = qApp->toPixel(GetParametrDouble(domElement, AttrMy1, QString::number(labelMY)));
+ initData.mx1 = VAbstractValApplication::VApp()
+ ->toPixel(GetParametrDouble(domElement, AttrMx1, QString::number(labelMX)));
+ initData.my1 = VAbstractValApplication::VApp()
+ ->toPixel(GetParametrDouble(domElement, AttrMy1, QString::number(labelMY)));
initData.showLabel1 = GetParametrBool(domElement, AttrShowLabel1, trueStr);
initData.name2 = GetParametrString(domElement, AttrName2, QChar('A'));
- initData.mx2 = qApp->toPixel(GetParametrDouble(domElement, AttrMx2, QString::number(labelMX)));
- initData.my2 = qApp->toPixel(GetParametrDouble(domElement, AttrMy2, QString::number(labelMY)));
+ initData.mx2 = VAbstractValApplication::VApp()
+ ->toPixel(GetParametrDouble(domElement, AttrMx2, QString::number(labelMX)));
+ initData.my2 = VAbstractValApplication::VApp()
+ ->toPixel(GetParametrDouble(domElement, AttrMy2, QString::number(labelMY)));
initData.showLabel2 = GetParametrBool(domElement, AttrShowLabel2, trueStr);
VToolTrueDarts::Create(initData);
@@ -2604,7 +2616,8 @@ void VPattern::ParseToolSpline(VMainGraphicsScene *scene, QDomElement &domElemen
if (spl != nullptr)
{
- VAbstractMainWindow *window = qobject_cast(qApp->getMainWindow());
+ VAbstractMainWindow *window =
+ qobject_cast(VAbstractValApplication::VApp()->getMainWindow());
SCASSERT(window != nullptr)
connect(spl, &VToolSpline::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
}
@@ -2813,7 +2826,8 @@ void VPattern::ParseToolSplinePath(VMainGraphicsScene *scene, const QDomElement
if (spl != nullptr)
{
- VAbstractMainWindow *window = qobject_cast(qApp->getMainWindow());
+ VAbstractMainWindow *window =
+ qobject_cast(VAbstractValApplication::VApp()->getMainWindow());
SCASSERT(window != nullptr)
connect(spl, &VToolSplinePath::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
}
@@ -3667,17 +3681,17 @@ void VPattern::RefreshPieceGeometry()
auto CleanRefreshList = qScopeGuard([this]()
{
updatePieces.clear();
- VMainGraphicsView::NewSceneRect(sceneDetail, qApp->getSceneView());
+ VMainGraphicsView::NewSceneRect(sceneDetail, VAbstractValApplication::VApp()->getSceneView());
});
- if (qApp->IsGUIMode() && m_parsing)
+ if (VApplication::VApp()->IsGUIMode() && m_parsing)
{
return;
}
for(auto pieceId : qAsConst(updatePieces))
{
- if (qApp->IsGUIMode() && m_parsing)
+ if (VApplication::VApp()->IsGUIMode() && m_parsing)
{
return;
}
@@ -3696,7 +3710,7 @@ void VPattern::RefreshPieceGeometry()
QApplication::processEvents();
- if (qApp->IsGUIMode() && m_parsing)
+ if (VApplication::VApp()->IsGUIMode() && m_parsing)
{
return;
}
diff --git a/src/libs/fervor/fvupdater.cpp b/src/libs/fervor/fvupdater.cpp
index 542b881e2..3921938ce 100644
--- a/src/libs/fervor/fvupdater.cpp
+++ b/src/libs/fervor/fvupdater.cpp
@@ -128,7 +128,7 @@ void FvUpdater::showUpdaterWindowUpdatedWithCurrentUpdateProposal()
hideUpdaterWindow();
// Create a new window
- m_updaterWindow = new FvUpdateWindow(qApp->getMainWindow());
+ m_updaterWindow = new FvUpdateWindow(VAbstractValApplication::VApp()->getMainWindow());
m_updaterWindow->UpdateWindowWithCurrentProposedUpdate();
m_updaterWindow->exec();
}
@@ -209,7 +209,7 @@ void FvUpdater::RemindMeLater()
{
qDebug() << "Remind me later";
- qApp->Settings()->SetDateOfLastRemind(QDate::currentDate());
+ VAbstractApplication::VApp()->Settings()->SetDateOfLastRemind(QDate::currentDate());
hideUpdaterWindow();
}
@@ -283,7 +283,7 @@ bool FvUpdater::CheckForUpdates(bool silentAsMuchAsItCouldGet)
//---------------------------------------------------------------------------------------------------------------------
bool FvUpdater::CheckForUpdatesSilent()
{
- if (qApp->Settings()->GetDateOfLastRemind().daysTo(QDate::currentDate()) >= 1)
+ if (VAbstractApplication::VApp()->Settings()->GetDateOfLastRemind().daysTo(QDate::currentDate()) >= 1)
{
const bool success = CheckForUpdates(true);
if (m_dropOnFinnish && not success)
@@ -548,7 +548,7 @@ bool FvUpdater::VersionIsIgnored(const QString &version)
return true;
}
- const int lastSkippedVersion = qApp->Settings()->GetLatestSkippedVersion();
+ const int lastSkippedVersion = VAbstractApplication::VApp()->Settings()->GetLatestSkippedVersion();
if (lastSkippedVersion != 0x0)
{
if (decVersion == lastSkippedVersion)
@@ -588,7 +588,7 @@ void FvUpdater::IgnoreVersion(const QString &version)
return;
}
- qApp->Settings()->SetLatestSkippedVersion(decVersion);
+ VAbstractApplication::VApp()->Settings()->SetLatestSkippedVersion(decVersion);
}
//---------------------------------------------------------------------------------------------------------------------
diff --git a/src/libs/ifc/xml/vabstractpattern.cpp b/src/libs/ifc/xml/vabstractpattern.cpp
index 0ec819e8a..a9fc274db 100644
--- a/src/libs/ifc/xml/vabstractpattern.cpp
+++ b/src/libs/ifc/xml/vabstractpattern.cpp
@@ -215,7 +215,7 @@ void GatherTokens(QSet &tokens, const QList &tokenList)
*/
QMap AdjustMaterials(QMap materials)
{
- const QMap cliMaterials = qApp->GetUserMaterials();
+ const QMap cliMaterials = VAbstractValApplication::VApp()->GetUserMaterials();
QMap::const_iterator i = cliMaterials.constBegin();
while (i != cliMaterials.constEnd())
{
@@ -1045,7 +1045,7 @@ QString VAbstractPattern::GetLabelDateFormat() const
{
if (*labelDateFormatCached == unknownCharacter)
{
- const QString globalLabelDateFormat = qApp->Settings()->GetLabelDateFormat();
+ const QString globalLabelDateFormat = VAbstractApplication::VApp()->Settings()->GetLabelDateFormat();
const QDomNodeList list = elementsByTagName(TagPatternLabel);
if (list.isEmpty())
@@ -1079,7 +1079,7 @@ void VAbstractPattern::SetLabelDateFormat(const QString &format)
//---------------------------------------------------------------------------------------------------------------------
QString VAbstractPattern::GetLabelTimeFormat() const
{
- QString globalLabelTimeFormat = qApp->Settings()->GetLabelTimeFormat();
+ QString globalLabelTimeFormat = VAbstractApplication::VApp()->Settings()->GetLabelTimeFormat();
const QDomNodeList list = elementsByTagName(TagPatternLabel);
if (list.isEmpty())
diff --git a/src/libs/vdxf/dxiface.cpp b/src/libs/vdxf/dxiface.cpp
index 88372d63f..868713ab6 100644
--- a/src/libs/vdxf/dxiface.cpp
+++ b/src/libs/vdxf/dxiface.cpp
@@ -467,5 +467,6 @@ void dx_iface::AddBlock(dx_ifaceBlock *block)
std::string dx_iface::LocaleToISO()
{
QMap locMap = LocaleMap();
- return locMap.value(QLocale(qApp->Settings()->GetLocale()).name(), "ISO8859-1").toStdString();
+ return locMap.value(QLocale(VAbstractApplication::VApp()->Settings()->GetLocale()).name(),
+ "ISO8859-1").toStdString();
}
diff --git a/src/libs/vdxf/libdxfrw/intern/drw_textcodec.cpp b/src/libs/vdxf/libdxfrw/intern/drw_textcodec.cpp
index 307e4e81e..c381f58c5 100644
--- a/src/libs/vdxf/libdxfrw/intern/drw_textcodec.cpp
+++ b/src/libs/vdxf/libdxfrw/intern/drw_textcodec.cpp
@@ -112,8 +112,8 @@ void DRW_TextCodec::setCodePage(const std::string *c, bool dxfFormat){
{
const QString errorMsg = QCoreApplication::translate("DRW_TextCodec", "No available codec for code page '%1'.")
.arg(cp.c_str());
- qApp->IsPedantic() ? throw VException(errorMsg) :
- qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
+ qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
if (version < DRW::AC1021 && cp == "UTF-8")
{
diff --git a/src/libs/vformat/vpatternrecipe.cpp b/src/libs/vformat/vpatternrecipe.cpp
index 368f7b578..bfd036b68 100644
--- a/src/libs/vformat/vpatternrecipe.cpp
+++ b/src/libs/vformat/vpatternrecipe.cpp
@@ -116,7 +116,8 @@ QDomElement VPatternRecipe::Prerequisite()
QDomElement prerequisiteElement = createElement(QStringLiteral("prerequisite"));
prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("valentina"), APP_VERSION_STR));
- prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("unit"), UnitsToStr(qApp->patternUnits())));
+ prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("unit"),
+ UnitsToStr(VAbstractValApplication::VApp()->patternUnits())));
prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("author"), m_pattern->GetCompanyName()));
prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("pattenName"), m_pattern->GetPatternName()));
prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("description"), m_pattern->GetDescription()));
@@ -440,8 +441,8 @@ QDomElement VPatternRecipe::FinalMeasurement(const VFinalMeasurement &fm, const
const QString errorMsg = QString("%1\n\n%1").arg(tr("Reading final measurements error."),
tr("Value for final measurtement '%1' is infinite or NaN. "
"Please, check your calculations.").arg(fm.name));
- qApp->IsPedantic() ? throw VException(errorMsg) :
- qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
+ qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
}
SetAttribute(recipeFinalMeasurement, QStringLiteral("value"), result);
@@ -595,10 +596,10 @@ QDomElement VPatternRecipe::Spline(const VToolRecord &record)
SetAttribute(step, AttrAngle2Value, spl.GetEndAngle());
SetAttribute(step, AttrLength1, spl.GetC1LengthFormula());
- SetAttribute(step, AttrLength1Value, qApp->fromPixel(spl.GetC1Length()));
+ SetAttribute(step, AttrLength1Value, VAbstractValApplication::VApp()->fromPixel(spl.GetC1Length()));
SetAttribute(step, AttrLength2, spl.GetC2LengthFormula());
- SetAttribute(step, AttrLength2Value, qApp->fromPixel(spl.GetC2Length()));
+ SetAttribute(step, AttrLength2Value, VAbstractValApplication::VApp()->fromPixel(spl.GetC2Length()));
CurveAttributes(step, tool);
@@ -693,10 +694,10 @@ QDomElement VPatternRecipe::SplinePath(const VToolRecord &record)
SetAttribute(node, AttrAngle2Value, pathNode.Angle2());
SetAttribute(node, AttrLength1, pathNode.Length1Formula());
- SetAttribute(node, AttrLength1Value, qApp->fromPixel(pathNode.Length1()));
+ SetAttribute(node, AttrLength1Value, VAbstractValApplication::VApp()->fromPixel(pathNode.Length1()));
SetAttribute(node, AttrLength2, pathNode.Length2Formula());
- SetAttribute(node, AttrLength2Value, qApp->fromPixel(pathNode.Length2()));
+ SetAttribute(node, AttrLength2Value, VAbstractValApplication::VApp()->fromPixel(pathNode.Length2()));
nodes.appendChild(node);
}
diff --git a/src/libs/vgeometry/vabstractcubicbezier.cpp b/src/libs/vgeometry/vabstractcubicbezier.cpp
index 3f2831de7..396826f85 100644
--- a/src/libs/vgeometry/vabstractcubicbezier.cpp
+++ b/src/libs/vgeometry/vabstractcubicbezier.cpp
@@ -96,7 +96,7 @@ QVector PointBezier_r(qreal x1, qreal y1, qreal x2, qreal y2, qreal x3,
double m_approximation_scale = approximationScale;
if(m_approximation_scale < minCurveApproximationScale || m_approximation_scale > maxCurveApproximationScale)
{
- m_approximation_scale = qApp->Settings()->GetCurveApproximationScale();
+ m_approximation_scale = VAbstractApplication::VApp()->Settings()->GetCurveApproximationScale();
}
double m_distance_tolerance_square;
diff --git a/src/libs/vgeometry/vabstractcurve.cpp b/src/libs/vgeometry/vabstractcurve.cpp
index e8bde1cd6..17ae5019e 100644
--- a/src/libs/vgeometry/vabstractcurve.cpp
+++ b/src/libs/vgeometry/vabstractcurve.cpp
@@ -145,8 +145,8 @@ QVector VAbstractCurve::GetSegmentPoints(const QPointF &begin, const QP
errorMsg = QObject::tr("Error in path '%1'. Calculating segment for curve '%2' has failed. %3")
.arg(piece, name(), error);
}
- qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
- qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
+ qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
}
return segment;
@@ -600,7 +600,7 @@ QPainterPath VAbstractCurve::ShowDirection(const QVector &arrows
//---------------------------------------------------------------------------------------------------------------------
qreal VAbstractCurve::LengthCurveDirectionArrow()
{
- return qApp->Settings()->GetLineWidth() * 8.0;
+ return VAbstractApplication::VApp()->Settings()->GetLineWidth() * 8.0;
}
//---------------------------------------------------------------------------------------------------------------------
diff --git a/src/libs/vgeometry/varc_p.h b/src/libs/vgeometry/varc_p.h
index 4530b02a2..16feb40ea 100644
--- a/src/libs/vgeometry/varc_p.h
+++ b/src/libs/vgeometry/varc_p.h
@@ -72,7 +72,7 @@ VArcData::VArcData(qreal radius, const QString &formulaRadius)
//---------------------------------------------------------------------------------------------------------------------
VArcData::VArcData(qreal radius)
: radius(radius),
- formulaRadius(QString().number(qApp->fromPixel(radius)))
+ formulaRadius(QString().number(VAbstractValApplication::VApp()->fromPixel(radius)))
{}
//---------------------------------------------------------------------------------------------------------------------
diff --git a/src/libs/vgeometry/vellipticalarc.cpp b/src/libs/vgeometry/vellipticalarc.cpp
index 68b878de3..5db2a4b95 100644
--- a/src/libs/vgeometry/vellipticalarc.cpp
+++ b/src/libs/vgeometry/vellipticalarc.cpp
@@ -479,7 +479,7 @@ void VEllipticalArc::FindF2(qreal length)
SetFormulaF2(QString::number(endAngle), endAngle);
lenBez = GetLength();
}
- SetFormulaLength(QString::number(qApp->fromPixel(lenBez)));
+ SetFormulaLength(QString::number(VAbstractValApplication::VApp()->fromPixel(lenBez)));
}
//---------------------------------------------------------------------------------------------------------------------
diff --git a/src/libs/vgeometry/vellipticalarc_p.h b/src/libs/vgeometry/vellipticalarc_p.h
index ee00d533d..6d9bf57ae 100644
--- a/src/libs/vgeometry/vellipticalarc_p.h
+++ b/src/libs/vgeometry/vellipticalarc_p.h
@@ -67,10 +67,10 @@ VEllipticalArcData::VEllipticalArcData(qreal radius1, qreal radius2, const QStri
VEllipticalArcData::VEllipticalArcData(qreal radius1, qreal radius2, qreal rotationAngle)
: radius1(radius1),
radius2(radius2),
- formulaRadius1(QString().number(qApp->fromPixel(radius1))),
- formulaRadius2(QString().number(qApp->fromPixel(radius2))),
+ formulaRadius1(QString().number(VAbstractValApplication::VApp()->fromPixel(radius1))),
+ formulaRadius2(QString().number(VAbstractValApplication::VApp()->fromPixel(radius2))),
rotationAngle(rotationAngle),
- formulaRotationAngle(QString().number(qApp->fromPixel(rotationAngle))),
+ formulaRotationAngle(QString().number(VAbstractValApplication::VApp()->fromPixel(rotationAngle))),
m_transform()
{}
diff --git a/src/libs/vgeometry/vgobject.cpp b/src/libs/vgeometry/vgobject.cpp
index fd8c3d196..ac9388c47 100644
--- a/src/libs/vgeometry/vgobject.cpp
+++ b/src/libs/vgeometry/vgobject.cpp
@@ -271,8 +271,8 @@ QString VGObject::GetAliasSuffix() const
//---------------------------------------------------------------------------------------------------------------------
QString VGObject::ObjectName() const
{
- const QString alias = qApp->TrVars()->VarToUser(d->m_alias);
- const QString name = qApp->TrVars()->VarToUser(d->_name);
+ const QString alias = VAbstractApplication::VApp()->TrVars()->VarToUser(d->m_alias);
+ const QString name = VAbstractApplication::VApp()->TrVars()->VarToUser(d->_name);
return not d->m_alias.isEmpty() ? QString("%1 (%2)").arg(alias, name) : name;
}
diff --git a/src/libs/vgeometry/vspline_p.h b/src/libs/vgeometry/vspline_p.h
index 1b71ca5a6..63ca2e9b0 100644
--- a/src/libs/vgeometry/vspline_p.h
+++ b/src/libs/vgeometry/vspline_p.h
@@ -140,12 +140,12 @@ VSplineData::VSplineData(VPointF p1, VPointF p4, qreal angle1, qreal angle2, qre
QLineF p1p2(p1.x(), p1.y(), p1.x() + L * kAsm1, p1.y());
p1p2.setAngle(angle1);
c1Length = p1p2.length();
- c1LengthF = QString().number(qApp->fromPixel(c1Length));
+ c1LengthF = QString().number(VAbstractValApplication::VApp()->fromPixel(c1Length));
QLineF p4p3(p4.x(), p4.y(), p4.x() + L * kAsm2, p4.y());
p4p3.setAngle(angle2);
c2Length = p4p3.length();
- c2LengthF = QString().number(qApp->fromPixel(c2Length));
+ c2LengthF = QString().number(VAbstractValApplication::VApp()->fromPixel(c2Length));
}
//---------------------------------------------------------------------------------------------------------------------
@@ -168,7 +168,7 @@ VSplineData::VSplineData(VPointF p1, QPointF p2, QPointF p3, VPointF p4)
angle1F = QString().number(angle1);
c1Length = p1p2.length();
- c1LengthF = QString().number(qApp->fromPixel(c1Length));
+ c1LengthF = QString().number(VAbstractValApplication::VApp()->fromPixel(c1Length));
QLineF p4p3(static_cast(p4), static_cast(p3));
@@ -176,7 +176,7 @@ VSplineData::VSplineData(VPointF p1, QPointF p2, QPointF p3, VPointF p4)
angle2F = QString().number(angle2);
c2Length = p4p3.length();
- c2LengthF = QString().number(qApp->fromPixel(c2Length));
+ c2LengthF = QString().number(VAbstractValApplication::VApp()->fromPixel(c2Length));
}
//---------------------------------------------------------------------------------------------------------------------
diff --git a/src/libs/vlayout/dialogs/dialoglayoutscale.cpp b/src/libs/vlayout/dialogs/dialoglayoutscale.cpp
index a5d566c0d..5166e7a1d 100644
--- a/src/libs/vlayout/dialogs/dialoglayoutscale.cpp
+++ b/src/libs/vlayout/dialogs/dialoglayoutscale.cpp
@@ -41,7 +41,7 @@ DialogLayoutScale::DialogLayoutScale(bool printTiled, QWidget *parent)
{
ui->setupUi(this);
- qApp->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
SCASSERT(bOk != nullptr)
@@ -72,7 +72,7 @@ DialogLayoutScale::~DialogLayoutScale()
void DialogLayoutScale::SetTiledMargins(QMarginsF margins)
{
// read Margins top, right, bottom, left
- margins = UnitConvertor(margins, Unit::Mm, qApp->patternUnits());
+ margins = UnitConvertor(margins, Unit::Mm, VAbstractValApplication::VApp()->patternUnits());
ui->doubleSpinBoxLeftField->setValue(margins.left());
ui->doubleSpinBoxTopField->setValue(margins.top());
@@ -90,7 +90,7 @@ QMarginsF DialogLayoutScale::GetTiledMargins() const
ui->doubleSpinBoxBottomField->value()
);
- return UnitConvertor(margins, qApp->patternUnits(), Unit::Mm);
+ return UnitConvertor(margins, VAbstractValApplication::VApp()->patternUnits(), Unit::Mm);
}
//---------------------------------------------------------------------------------------------------------------------
@@ -181,8 +181,8 @@ void DialogLayoutScale::VerticalScaleChanged(double d)
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutScale::ReadSettings()
{
- VCommonSettings *settings = qApp->Settings();
- const Unit unit = qApp->patternUnits();
+ VCommonSettings *settings = VAbstractApplication::VApp()->Settings();
+ const Unit unit = VAbstractValApplication::VApp()->patternUnits();
// read Margins top, right, bottom, left
const QMarginsF margins = settings->GetTiledPDFMargins(unit);
@@ -201,8 +201,8 @@ void DialogLayoutScale::ReadSettings()
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutScale::WriteSettings() const
{
- VCommonSettings *settings = qApp->Settings();
- const Unit unit = qApp->patternUnits();
+ VCommonSettings *settings = VAbstractApplication::VApp()->Settings();
+ const Unit unit = VAbstractValApplication::VApp()->patternUnits();
// write Margins top, right, bottom, left
QMarginsF margins = QMarginsF(
diff --git a/src/libs/vlayout/vabstractpiece.cpp b/src/libs/vlayout/vabstractpiece.cpp
index 186967b2b..11633a379 100644
--- a/src/libs/vlayout/vabstractpiece.cpp
+++ b/src/libs/vlayout/vabstractpiece.cpp
@@ -1071,8 +1071,8 @@ QVector VAbstractPiece::Equidistant(QVector points, qreal wid
if ( points.size() < 3 )
{
const QString errorMsg = tr("Piece '%1'. Not enough points to build seam allowance.").arg(name);
- qApp->IsPedantic() ? throw VException(errorMsg) :
- qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
+ qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
return QVector();
}
diff --git a/src/libs/vlayout/vbank.cpp b/src/libs/vlayout/vbank.cpp
index 23c70c9f6..c6b666825 100644
--- a/src/libs/vlayout/vbank.cpp
+++ b/src/libs/vlayout/vbank.cpp
@@ -390,8 +390,8 @@ bool VBank::PrepareDetails()
{
const QString errorMsg = QObject::tr("Piece '%1' has invalid layout allowance. Please, check seam allowance"
" to check how seam allowance behave.").arg(details.at(i).GetName());
- qApp->IsPedantic() ? throw VException(errorMsg) :
- qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
+ qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
}
const qreal d = details.at(i).Diagonal();
diff --git a/src/libs/vlayout/vlayoutpiece.cpp b/src/libs/vlayout/vlayoutpiece.cpp
index 26b742983..d650cf0b1 100644
--- a/src/libs/vlayout/vlayoutpiece.cpp
+++ b/src/libs/vlayout/vlayoutpiece.cpp
@@ -274,8 +274,8 @@ QVector ConvertPassmarks(const VPiece &piece, const VContainer
const QString errorMsg =
QObject::tr("Cannot prepare builtin passmark '%1' for piece '%2'. Passmark is empty.")
.arg(pData.nodeName, piece.GetName());
- qApp->IsPedantic() ? throw VException(errorMsg) :
- qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
+ qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
return;
}
@@ -288,8 +288,8 @@ QVector ConvertPassmarks(const VPiece &piece, const VContainer
QObject::tr("Cannot prepare builtin passmark '%1' for piece '%2'. Passmark base line is "
"empty.")
.arg(pData.nodeName, piece.GetName());
- qApp->IsPedantic() ? throw VException(errorMsg) :
- qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
+ qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
return;
}
layoutPassmark.baseLine = ConstFirst (baseLines);
@@ -305,8 +305,8 @@ QVector ConvertPassmarks(const VPiece &piece, const VContainer
const QString errorMsg =
QObject::tr("Passmark '%1' is not part of piece '%2'.")
.arg(pData.nodeName, piece.GetName());
- qApp->IsPedantic() ? throw VException(errorMsg) :
- qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
+ qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
}
};
@@ -331,8 +331,8 @@ QVector ConvertPassmarks(const VPiece &piece, const VContainer
const QString errorMsg =
QObject::tr("Cannot prepare passmark '%1' for piece '%2'. Passmark base line is empty.")
.arg(pData.nodeName, piece.GetName());
- qApp->IsPedantic() ? throw VException(errorMsg) :
- qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
+ qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
return;
}
@@ -351,8 +351,8 @@ QVector ConvertPassmarks(const VPiece &piece, const VContainer
const QString errorMsg =
QObject::tr("Cannot prepare passmark '%1' for piece '%2'. Passmark is empty.")
.arg(pData.nodeName, piece.GetName());
- qApp->IsPedantic() ? throw VException(errorMsg) :
- qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
+ qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
return;
}
@@ -367,8 +367,8 @@ QVector ConvertPassmarks(const VPiece &piece, const VContainer
const QString errorMsg =
QObject::tr("Passmark '%1' is not part of piece '%2'.")
.arg(pData.nodeName, piece.GetName());
- qApp->IsPedantic() ? throw VException(errorMsg) :
- qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
+ qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
}
};
@@ -404,8 +404,9 @@ QVector ConvertPassmarks(const VPiece &piece, const VContainer
}
}
- if (qApp->Settings()->IsDoublePassmark()
- && (qApp->Settings()->IsPieceShowMainPath() || not piece.IsHideMainPath())
+ if (VAbstractApplication::VApp()->Settings()->IsDoublePassmark()
+ && (VAbstractApplication::VApp()->Settings()->IsPieceShowMainPath() ||
+ not piece.IsHideMainPath())
&& pData.isMainPathNode
&& pData.passmarkAngleType != PassmarkAngleType::Intersection
&& pData.passmarkAngleType != PassmarkAngleType::IntersectionOnlyLeft
@@ -504,7 +505,7 @@ VLayoutPiece VLayoutPiece::Create(const VPiece &piece, vidtype id, const VContai
det.SetName(piece.GetName());
- det.SetSAWidth(qApp->toPixel(piece.GetSAWidth()));
+ det.SetSAWidth(VAbstractValApplication::VApp()->toPixel(piece.GetSAWidth()));
det.SetForbidFlipping(piece.IsForbidFlipping());
det.SetForceFlipping(piece.IsForceFlipping());
det.SetId(id);
@@ -513,12 +514,13 @@ VLayoutPiece VLayoutPiece::Create(const VPiece &piece, vidtype id, const VContai
{
const QString errorMsg = QObject::tr("Piece '%1'. Seam allowance is not valid.")
.arg(piece.GetName());
- qApp->IsPedantic() ? throw VException(errorMsg) :
- qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
+ qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
}
det.SetCountourPoints(futureMainPath.result(),
- qApp->Settings()->IsPieceShowMainPath() ? false : piece.IsHideMainPath());
+ VAbstractApplication::VApp()->Settings()->IsPieceShowMainPath() ? false
+ : piece.IsHideMainPath());
det.SetSeamAllowancePoints(futureSeamAllowance.result(), piece.IsSeamAllowance(), piece.IsSeamAllowanceBuiltIn());
det.SetInternalPaths(futureInternalPaths.result());
det.SetPassmarks(futurePassmarks.result());
@@ -535,14 +537,14 @@ VLayoutPiece VLayoutPiece::Create(const VPiece &piece, vidtype id, const VContai
det.SetQuantity(data.GetQuantity());
if (data.IsVisible())
{
- det.SetPieceText(piece.GetName(), data, qApp->Settings()->GetLabelFont(), pattern);
+ det.SetPieceText(piece.GetName(), data, VAbstractApplication::VApp()->Settings()->GetLabelFont(), pattern);
}
const VPatternLabelData& geom = piece.GetPatternInfo();
if (geom.IsVisible())
{
- VAbstractPattern* pDoc = qApp->getCurrentDocument();
- det.SetPatternInfo(pDoc, geom, qApp->Settings()->GetLabelFont(), pattern);
+ VAbstractPattern* pDoc = VAbstractValApplication::VApp()->getCurrentDocument();
+ det.SetPatternInfo(pDoc, geom, VAbstractApplication::VApp()->Settings()->GetLabelFont(), pattern);
}
const VGrainlineData& grainlineGeom = piece.GetGrainlineGeometry();
@@ -1158,7 +1160,7 @@ QGraphicsItem *VLayoutPiece::GetItem(bool textAsPaths) const
QPen pen = pathItem->pen();
pen.setStyle(path.PenStyle());
- pen.setWidthF(qApp->Settings()->WidthHairLine());
+ pen.setWidthF(VAbstractApplication::VApp()->Settings()->WidthHairLine());
pathItem->setPen(pen);
}
@@ -1166,7 +1168,7 @@ QGraphicsItem *VLayoutPiece::GetItem(bool textAsPaths) const
{
QGraphicsPathItem* pathItem = new QGraphicsPathItem(item);
QPen pen = pathItem->pen();
- pen.setWidthF(qApp->Settings()->WidthHairLine());
+ pen.setWidthF(VAbstractApplication::VApp()->Settings()->WidthHairLine());
pathItem->setPen(pen);
pathItem->setPath(d->matrix.map(VPlaceLabelItem::LabelShapePath(label.shape)));
}
@@ -1333,7 +1335,7 @@ void VLayoutPiece::CreateGrainlineItem(QGraphicsItem *parent) const
return;
}
auto* item = new VGraphicsFillItem(parent);
- item->SetWidth(qApp->Settings()->WidthHairLine());
+ item->SetWidth(VAbstractApplication::VApp()->Settings()->WidthHairLine());
QPainterPath path;
@@ -1364,7 +1366,7 @@ QGraphicsPathItem *VLayoutPiece::GetMainItem() const
{
QGraphicsPathItem *item = new QGraphicsPathItem();
QPen pen = item->pen();
- pen.setWidthF(qApp->Settings()->WidthHairLine());
+ pen.setWidthF(VAbstractApplication::VApp()->Settings()->WidthHairLine());
item->setPen(pen);
item->setPath(ContourPath());
return item;
@@ -1375,7 +1377,7 @@ QGraphicsPathItem *VLayoutPiece::GetMainPathItem() const
{
QGraphicsPathItem *item = new QGraphicsPathItem();
QPen pen = item->pen();
- pen.setWidthF(qApp->Settings()->WidthHairLine());
+ pen.setWidthF(VAbstractApplication::VApp()->Settings()->WidthHairLine());
item->setPen(pen);
QPainterPath path;
diff --git a/src/libs/vlayout/vposter.cpp b/src/libs/vlayout/vposter.cpp
index 13d8fdd51..dab321692 100644
--- a/src/libs/vlayout/vposter.cpp
+++ b/src/libs/vlayout/vposter.cpp
@@ -309,8 +309,8 @@ QVector VPoster::ImageWatermark(QGraphicsItem *parent, const Po
if (watermark.isNull())
{
const QString errorMsg = tr("Cannot open the watermark image.") + QChar(' ') + error;
- qApp->IsPedantic() ? throw VException(errorMsg) :
- qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
+ qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
return data;
}
@@ -319,8 +319,8 @@ QVector VPoster::ImageWatermark(QGraphicsItem *parent, const Po
else
{
const QString errorMsg = tr("Not supported file suffix '%1'").arg(f.suffix());
- qApp->IsPedantic() ? throw VException(errorMsg) :
- qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
+ qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
return data;
}
@@ -456,7 +456,7 @@ void VPoster::Ruler(QVector &data, QGraphicsItem *parent, QRect
const qreal notchHeight = ToPixel(3); // mm
const qreal shortNotchHeight = ToPixel(1.1); // mm
- Unit patternUnits = qApp->patternUnits();
+ Unit patternUnits = VAbstractValApplication::VApp()->patternUnits();
const qreal step = UnitConvertor(1, patternUnits, Unit::Px);
double marksCount = rec.width() / step;
int i = 0;
diff --git a/src/libs/vlayout/vprintlayout.cpp b/src/libs/vlayout/vprintlayout.cpp
index 4ad0b0cb4..576ec0f23 100644
--- a/src/libs/vlayout/vprintlayout.cpp
+++ b/src/libs/vlayout/vprintlayout.cpp
@@ -320,7 +320,8 @@ void VPrintLayout::PrintPages(QPrinter *printer)
}
painter.setRenderHint(QPainter::Antialiasing, true);
- painter.setPen(QPen(Qt::black, qApp->Settings()->WidthMainLine(), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
+ painter.setPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthMainLine(), Qt::SolidLine,
+ Qt::RoundCap, Qt::RoundJoin));
painter.setBrush ( QBrush ( Qt::NoBrush ) );
int count = 0;
@@ -732,8 +733,8 @@ auto VPrintLayout::WatermarkData() const -> VWatermarkData
catch (VException &e)
{
const QString errorMsg = tr("File error.\n\n%1\n\n%2").arg(e.ErrorMessage(), e.DetailedInformation());
- qApp->IsPedantic() ? throw VException(errorMsg) :
- qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
+ qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
}
}
diff --git a/src/libs/vlayout/vtextmanager.cpp b/src/libs/vlayout/vtextmanager.cpp
index b32648954..f131314d2 100644
--- a/src/libs/vlayout/vtextmanager.cpp
+++ b/src/libs/vlayout/vtextmanager.cpp
@@ -175,7 +175,7 @@ QMap PreparePlaceholders(const VAbstractPattern *doc, const VC
QMap placeholders;
// Pattern tags
- QLocale locale(qApp->Settings()->GetLocale());
+ QLocale locale(VAbstractApplication::VApp()->Settings()->GetLocale());
const QString date = locale.toString(QDate::currentDate(), doc->GetLabelDateFormat());
placeholders.insert(pl_date, date);
@@ -187,18 +187,19 @@ QMap PreparePlaceholders(const VAbstractPattern *doc, const VC
placeholders.insert(pl_patternNumber, doc->GetPatternNumber());
placeholders.insert(pl_author, doc->GetCompanyName());
- placeholders.insert(pl_mUnits, UnitsToStr(qApp->MeasurementsUnits(), true));
- placeholders.insert(pl_pUnits, UnitsToStr(qApp->patternUnits(), true));
- placeholders.insert(pl_mSizeUnits, UnitsToStr(qApp->DimensionSizeUnits(), true));
+ placeholders.insert(pl_mUnits, UnitsToStr(VAbstractValApplication::VApp()->MeasurementsUnits(), true));
+ placeholders.insert(pl_pUnits, UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
+ placeholders.insert(pl_mSizeUnits, UnitsToStr(VAbstractValApplication::VApp()->DimensionSizeUnits(), true));
- if (qApp->GetMeasurementsType() == MeasurementsType::Individual)
+ if (VAbstractValApplication::VApp()->GetMeasurementsType() == MeasurementsType::Individual)
{
- placeholders.insert(pl_customer, qApp->GetCustomerName());
+ placeholders.insert(pl_customer, VAbstractValApplication::VApp()->GetCustomerName());
- const QString birthDate = locale.toString(qApp->GetCustomerBirthDate(), doc->GetLabelDateFormat());
+ const QString birthDate = locale.toString(VAbstractValApplication::VApp()->GetCustomerBirthDate(),
+ doc->GetLabelDateFormat());
placeholders.insert(pl_birthDate, birthDate);
- placeholders.insert(pl_email, qApp->CustomerEmail());
+ placeholders.insert(pl_email, VAbstractValApplication::VApp()->CustomerEmail());
}
else
{
@@ -211,15 +212,15 @@ QMap PreparePlaceholders(const VAbstractPattern *doc, const VC
}
placeholders.insert(pl_pExt, QStringLiteral("val"));
- placeholders.insert(pl_pFileName, QFileInfo(qApp->GetPatternPath()).baseName());
+ placeholders.insert(pl_pFileName, QFileInfo(VAbstractValApplication::VApp()->GetPatternPath()).baseName());
placeholders.insert(pl_mFileName, QFileInfo(doc->MPath()).baseName());
- placeholders.insert(pl_height, QString::number(qApp->GetDimensionHeight()));
- placeholders.insert(pl_size, QString::number(qApp->GetDimensionSize()));
- placeholders.insert(pl_hip, QString::number(qApp->GetDimensionHip()));
- placeholders.insert(pl_waist, QString::number(qApp->GetDimensionWaist()));
- placeholders.insert(pl_mExt, qApp->GetMeasurementsType() == MeasurementsType::Multisize ? QString("vst")
- : QString("vit"));
+ placeholders.insert(pl_height, QString::number(VAbstractValApplication::VApp()->GetDimensionHeight()));
+ placeholders.insert(pl_size, QString::number(VAbstractValApplication::VApp()->GetDimensionSize()));
+ placeholders.insert(pl_hip, QString::number(VAbstractValApplication::VApp()->GetDimensionHip()));
+ placeholders.insert(pl_waist, QString::number(VAbstractValApplication::VApp()->GetDimensionWaist()));
+ placeholders.insert(pl_mExt, VAbstractValApplication::VApp()->GetMeasurementsType() == MeasurementsType::Multisize
+ ? QString("vst") : QString("vit"));
const QMap materials = doc->GetPatternMaterials();
for (int i = 0; i < userMaterialPlaceholdersQuantity; ++i)
@@ -265,8 +266,8 @@ QMap PreparePlaceholders(const VAbstractPattern *doc, const VC
{
const QString errorMsg = QObject::tr("Failed to prepare final measurement placeholder. Parser error at "
"line %1: %2.").arg(i+1).arg(e.GetMsg());
- qApp->IsPedantic() ? throw VException(errorMsg) :
- qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
+ qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
}
}
}
@@ -317,8 +318,8 @@ QString ReplacePlaceholders(const QMap &placeholders, QString
{
if (line.contains(per+placeholder+per) && placeholders.value(placeholder) == QChar('0'))
{
- qApp->IsPedantic() ? throw VException(errorMsg) :
- qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
+ qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
}
};
@@ -531,7 +532,8 @@ void VTextManager::Update(const QString& qsName, const VPieceLabelData& data, co
{
m_liLines.clear();
- QMap placeholders = PreparePlaceholders(qApp->getCurrentDocument(), pattern);
+ QMap placeholders =
+ PreparePlaceholders(VAbstractValApplication::VApp()->getCurrentDocument(), pattern);
InitPiecePlaceholders(placeholders, qsName, data);
QVector lines = data.GetLabelTemplate();
diff --git a/src/libs/vmisc/def.cpp b/src/libs/vmisc/def.cpp
index 365850573..19e4e4641 100644
--- a/src/libs/vmisc/def.cpp
+++ b/src/libs/vmisc/def.cpp
@@ -599,7 +599,8 @@ void InitLanguages(QComboBox *combobox)
combobox->clear();
QStringList fileNames;
- QDirIterator it(qApp->translationsPath(), QStringList("valentina_*.qm"), QDir::Files, QDirIterator::Subdirectories);
+ QDirIterator it(VAbstractApplication::VApp()->translationsPath(), QStringList("valentina_*.qm"), QDir::Files,
+ QDirIterator::Subdirectories);
while (it.hasNext())
{
it.next();
@@ -636,7 +637,7 @@ void InitLanguages(QComboBox *combobox)
}
// set default translators and language checked
- qint32 index = combobox->findData(qApp->Settings()->GetLocale());
+ qint32 index = combobox->findData(VAbstractApplication::VApp()->Settings()->GetLocale());
if (index != -1)
{
combobox->setCurrentIndex(index);
diff --git a/src/libs/vmisc/dialogs/dialogexporttocsv.cpp b/src/libs/vmisc/dialogs/dialogexporttocsv.cpp
index c6ae57e5d..9a86516ee 100644
--- a/src/libs/vmisc/dialogs/dialogexporttocsv.cpp
+++ b/src/libs/vmisc/dialogs/dialogexporttocsv.cpp
@@ -68,7 +68,7 @@ DialogExportToCSV::DialogExportToCSV(QWidget *parent)
ui->checkBoxWithHeader->blockSignals(true);
ui->buttonGroup->blockSignals(true);
- ui->checkBoxWithHeader->setChecked(qApp->Settings()->GetDefCSVWithHeader());
+ ui->checkBoxWithHeader->setChecked(VAbstractApplication::VApp()->Settings()->GetDefCSVWithHeader());
ui->comboBoxCodec->setCurrentIndex(ui->comboBoxCodec->findData(VCommonSettings::GetDefCSVCodec()));
SetSeparator(VCommonSettings::GetDefCSVSeparator());
diff --git a/src/libs/vmisc/testvapplication.h b/src/libs/vmisc/testvapplication.h
index c1bf6d993..781307880 100644
--- a/src/libs/vmisc/testvapplication.h
+++ b/src/libs/vmisc/testvapplication.h
@@ -33,11 +33,6 @@
#include "projectversion.h"
#include "../vmisc/vsettings.h"
-#if defined(qApp)
-#undef qApp
-#endif
-#define qApp (static_cast(QCoreApplication::instance()))
-
class VTestSettings;
class TestVApplication : public VAbstractValApplication
@@ -80,6 +75,11 @@ public:
m_trVars = trVars;
}
+ static TestVApplication *VApp()
+ {
+ return static_cast(QCoreApplication::instance());
+ }
+
protected slots:
virtual void AboutToQuit() override
{}
diff --git a/src/libs/vmisc/vabstractapplication.cpp b/src/libs/vmisc/vabstractapplication.cpp
index 6e9359cd4..07747c91c 100644
--- a/src/libs/vmisc/vabstractapplication.cpp
+++ b/src/libs/vmisc/vabstractapplication.cpp
@@ -324,3 +324,9 @@ QFileDialog::Options VAbstractApplication::NativeFileDialog(QFileDialog::Options
return options;
}
+
+//---------------------------------------------------------------------------------------------------------------------
+auto VAbstractApplication::VApp() -> VAbstractApplication *
+{
+ return qobject_cast(QCoreApplication::instance());
+}
diff --git a/src/libs/vmisc/vabstractapplication.h b/src/libs/vmisc/vabstractapplication.h
index 7bc0ef3ab..12f5167c9 100644
--- a/src/libs/vmisc/vabstractapplication.h
+++ b/src/libs/vmisc/vabstractapplication.h
@@ -49,11 +49,6 @@ class QUndoStack;
class VAbstractApplication;// use in define
class VCommonSettings;
-#if defined(qApp)
-#undef qApp
-#endif
-#define qApp (qobject_cast(QCoreApplication::instance()))
-
class VAbstractApplication : public QApplication
{
Q_OBJECT
@@ -89,6 +84,8 @@ public:
static void WinAttachConsole();
#endif
+ static VAbstractApplication *VApp();
+
protected:
QUndoStack *undoStack;
@@ -119,7 +116,7 @@ template
inline QString VAbstractApplication::LocaleToString(const T &value)
{
QLocale loc;
- qApp->Settings()->GetOsSeparator() ? loc = QLocale() : loc = QLocale::c();
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator() ? loc = QLocale() : loc = QLocale::c();
return loc.toString(value);
}
diff --git a/src/libs/vmisc/vabstractvalapplication.cpp b/src/libs/vmisc/vabstractvalapplication.cpp
index dc901f2b9..d45a02604 100644
--- a/src/libs/vmisc/vabstractvalapplication.cpp
+++ b/src/libs/vmisc/vabstractvalapplication.cpp
@@ -71,5 +71,11 @@ void VAbstractValApplication::OpenSettings()
VSettings *VAbstractValApplication::ValentinaSettings()
{
SCASSERT(settings != nullptr)
- return qobject_cast(settings);
+ return qobject_cast(settings);
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+auto VAbstractValApplication::VApp() -> VAbstractValApplication *
+{
+ return qobject_cast(QCoreApplication::instance());
}
diff --git a/src/libs/vmisc/vabstractvalapplication.h b/src/libs/vmisc/vabstractvalapplication.h
index eb603a50b..d6e74898c 100644
--- a/src/libs/vmisc/vabstractvalapplication.h
+++ b/src/libs/vmisc/vabstractvalapplication.h
@@ -38,11 +38,6 @@ class VMainGraphicsView;
class QGraphicsScene;
class VSettings;
-#if defined(qApp)
-#undef qApp
-#endif
-#define qApp (qobject_cast(QCoreApplication::instance()))
-
class VAbstractValApplication : public VAbstractApplication
{
Q_OBJECT
@@ -116,6 +111,8 @@ public:
virtual void OpenSettings() override;
VSettings *ValentinaSettings();
+ static VAbstractValApplication *VApp();
+
protected:
QString m_customerName{};
QDate m_customerBirthDate{};
diff --git a/src/libs/vpatterndb/calculator.cpp b/src/libs/vpatterndb/calculator.cpp
index 105877a47..56b2cf4e3 100644
--- a/src/libs/vpatterndb/calculator.cpp
+++ b/src/libs/vpatterndb/calculator.cpp
@@ -48,7 +48,7 @@
* Use this constuctor for evaluation formula. All formulas must be converted to internal look.
* Example:
*
- * const QString formula = qApp->FormulaFromUser(edit->text());
+ * const QString formula = VAbstractApplication::VApp()->FormulaFromUser(edit->text());
* Calculator *cal = new Calculator(data, patternType);
* const qreal result = cal->EvalFormula(data->PlainVariables(), formula);
* delete cal;
@@ -124,8 +124,8 @@ qreal *Calculator::VarFactory(const QString &a_szName, void *a_pUserData)
//---------------------------------------------------------------------------------------------------------------------
qreal Calculator::Warning(const QString &warningMsg, qreal value)
{
- qApp->IsPedantic() ? throw qmu::QmuParserWarning(warningMsg)
- : qWarning() << VAbstractApplication::warningMessageSignature + warningMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw qmu::QmuParserWarning(warningMsg) :
+ qWarning() << VAbstractApplication::warningMessageSignature + warningMsg;
return value;
}
diff --git a/src/libs/vpatterndb/pmsystems.cpp b/src/libs/vpatterndb/pmsystems.cpp
index 9aa29fb9e..b11313c67 100644
--- a/src/libs/vpatterndb/pmsystems.cpp
+++ b/src/libs/vpatterndb/pmsystems.cpp
@@ -161,14 +161,15 @@ void InitPMSystems(QComboBox *systemCombo)
QMap systems;
for (auto &sys : listSystems)
{
- systems.insert(qApp->TrVars()->PMSystemName(sys) + QLatin1String(" (") + sys + QLatin1String(")"), sys);
+ systems.insert(VAbstractApplication::VApp()->TrVars()->PMSystemName(sys) + QLatin1String(" (") + sys +
+ QLatin1String(")"), sys);
}
// * The default option (blank field or 'None') should appear at the top of the list.
// * The list should be sorted alphabetically so users can find their system easily.
SCASSERT(systemCombo != nullptr)
- systemCombo->addItem(qApp->TrVars()->PMSystemName(listSystems.at(listSystems.size()-1)),
+ systemCombo->addItem(VAbstractApplication::VApp()->TrVars()->PMSystemName(listSystems.at(listSystems.size()-1)),
listSystems.at(listSystems.size()-1));
QMap::const_iterator i = systems.constBegin();
diff --git a/src/libs/vpatterndb/vformula.cpp b/src/libs/vpatterndb/vformula.cpp
index 1f1b98336..36e1e2a2e 100644
--- a/src/libs/vpatterndb/vformula.cpp
+++ b/src/libs/vpatterndb/vformula.cpp
@@ -94,7 +94,7 @@ QString VFormula::GetFormula(FormulaType type) const
{
if (type == FormulaType::ToUser)
{
- return VTranslateVars::TryFormulaToUser(d->formula, qApp->Settings()->GetOsSeparator());
+ return VTranslateVars::TryFormulaToUser(d->formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}
else
{
@@ -109,7 +109,8 @@ void VFormula::SetFormula(const QString &value, FormulaType type)
{
if (type == FormulaType::FromUser)
{
- d->formula = VTranslateVars::TryFormulaFromUser(value, qApp->Settings()->GetOsSeparator());
+ d->formula = VTranslateVars::TryFormulaFromUser(value,
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}
else
{
@@ -262,7 +263,7 @@ void VFormula::Eval()
}
else
{
- d->strValue = qApp->LocaleToString(result) + QLatin1Char(' ') + d->postfix;
+ d->strValue = VAbstractApplication::VApp()->LocaleToString(result) + QLatin1Char(' ') + d->postfix;
d->error = false;
}
}
diff --git a/src/libs/vpatterndb/vpassmark.cpp b/src/libs/vpatterndb/vpassmark.cpp
index d6eda48aa..7e552e790 100644
--- a/src/libs/vpatterndb/vpassmark.cpp
+++ b/src/libs/vpatterndb/vpassmark.cpp
@@ -578,8 +578,8 @@ QVector PassmarkBisectorBaseLine(PassmarkStatus seamPassmarkType, const
const QString errorMsg = QObject::tr("Found null notch for point '%1' in piece '%2'. Length is less "
"than minimal allowed.")
.arg(passmarkData.nodeName, passmarkData.pieceName);
- qApp->IsPedantic() ? throw VException(errorMsg) :
- qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
+ qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
return QVector();
}
@@ -661,8 +661,8 @@ QVector VPassmark::FullPassmark(const VPiece &piece, const VContainer *d
{
QVector lines;
lines += SAPassmark(piece, data, PassmarkSide::All);
- if (qApp->Settings()->IsDoublePassmark()
- && (qApp->Settings()->IsPieceShowMainPath() || not piece.IsHideMainPath())
+ if (VAbstractApplication::VApp()->Settings()->IsDoublePassmark()
+ && (VAbstractApplication::VApp()->Settings()->IsPieceShowMainPath() || not piece.IsHideMainPath())
&& m_data.isMainPathNode
&& m_data.passmarkAngleType != PassmarkAngleType::Intersection
&& m_data.passmarkAngleType != PassmarkAngleType::IntersectionOnlyLeft
@@ -787,7 +787,7 @@ QVector VPassmark::BuiltInSAPassmarkBaseLine(const VPiece &piece) const
const QString errorMsg = QObject::tr("Found null notch for point '%1' in piece '%2'. Length is less "
"than minimal allowed.")
.arg(m_data.nodeName, m_data.pieceName);
- qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
+ VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
return QVector();
}
@@ -803,8 +803,8 @@ QVector VPassmark::BuiltInSAPassmarkBaseLine(const VPiece &piece) const
const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2' with built in "
"seam allowance. User must manually provide length.")
.arg(m_data.nodeName, m_data.pieceName);
- qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
- qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
+ qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
return QVector();
}
}
@@ -847,8 +847,8 @@ QVector VPassmark::SAPassmarkBaseLine(const QVector &seamAllowa
{
const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2'. Seam allowance is "
"empty.").arg(m_data.nodeName, m_data.pieceName);
- qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
- qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
+ qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
return QVector(); // Something wrong
}
@@ -859,8 +859,8 @@ QVector VPassmark::SAPassmarkBaseLine(const QVector &seamAllowa
const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2'. Cannot find "
"position for a notch.")
.arg(m_data.nodeName, m_data.pieceName);
- qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
- qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
+ qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
return QVector(); // Something wrong
}
@@ -869,8 +869,8 @@ QVector VPassmark::SAPassmarkBaseLine(const QVector &seamAllowa
const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2'. Unable to fix a "
"notch position.")
.arg(m_data.nodeName, m_data.pieceName);
- qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
- qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
+ qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
}
auto PassmarkIntersection = [this, seamAllowance] (QLineF line, qreal width)
@@ -896,8 +896,8 @@ QVector VPassmark::SAPassmarkBaseLine(const QVector &seamAllowa
const QString errorMsg = QObject::tr("Found null notch for point '%1' in piece '%2'. Length is "
"less than minimal allowed.")
.arg(m_data.nodeName, m_data.pieceName);
- qApp->IsPedantic() ? throw VException(errorMsg) :
- qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
+ qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
return QLineF();
}
line.setLength(length);
@@ -913,8 +913,8 @@ QVector VPassmark::SAPassmarkBaseLine(const QVector &seamAllowa
const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2'. Notch "
"collapse.")
.arg(m_data.nodeName, m_data.pieceName);
- qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
- qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
+ qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
}
}
else
@@ -922,8 +922,8 @@ QVector VPassmark::SAPassmarkBaseLine(const QVector &seamAllowa
const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2'. Cannot find "
"intersection.")
.arg(m_data.nodeName, m_data.pieceName);
- qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
- qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
+ qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
}
return QLineF();
@@ -937,8 +937,8 @@ QVector VPassmark::SAPassmarkBaseLine(const QVector &seamAllowa
const QString errorMsg = QObject::tr("Found null notch for point '%1' in piece '%2'. Length is less "
"than minimal allowed.")
.arg(m_data.nodeName, m_data.pieceName);
- qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
- qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
+ qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
}
else
{
diff --git a/src/libs/vpatterndb/vpiece.cpp b/src/libs/vpatterndb/vpiece.cpp
index 8f22261e9..3aa2e566b 100644
--- a/src/libs/vpatterndb/vpiece.cpp
+++ b/src/libs/vpatterndb/vpiece.cpp
@@ -936,8 +936,8 @@ bool VPiece::GetPassmarkPreviousSAPoints(const QVector &path, int in
{
const QString errorMsg = tr("Cannot calculate a notch for point '%1' in piece '%2'.")
.arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName());
- qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
- qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
+ qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
return false; // Something wrong
}
@@ -975,8 +975,8 @@ bool VPiece::GetPassmarkNextSAPoints(const QVector &path, int index,
{
const QString errorMsg = tr("Cannot calculate a notch for point '%1' in piece '%2'.")
.arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName());
- qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
- qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
+ qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
return false; // Something wrong
}
@@ -1059,8 +1059,8 @@ VPassmark VPiece::CreatePassmark(const QVector &path, int previousIn
{
const QString errorMsg = tr("Cannot calculate a notch for point '%1' in piece '%2'.")
.arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName());
- qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
- qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
+ qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
return VPassmark();
}
diff --git a/src/libs/vpatterndb/vpiecenode.cpp b/src/libs/vpatterndb/vpiecenode.cpp
index 719d8f089..b2178a4d3 100644
--- a/src/libs/vpatterndb/vpiecenode.cpp
+++ b/src/libs/vpatterndb/vpiecenode.cpp
@@ -161,8 +161,8 @@ qreal VPieceNode::GetSABefore(const VContainer *data) const
const QString errorMsg = QObject::tr("Cannot calculate seam allowance before for point '%1'. Reason: %2.")
.arg(nodeName, formula.Reason());
- qApp->IsPedantic() ? throw VException(errorMsg) :
- qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
+ qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
return -1;
}
return formula.getDoubleValue();
@@ -192,8 +192,8 @@ qreal VPieceNode::GetSABefore(const VContainer *data, Unit unit) const
const QString errorMsg = QObject::tr("Cannot calculate seam allowance before for point '%1'. Reason: %2.")
.arg(nodeName, formula.Reason());
- qApp->IsPedantic() ? throw VException(errorMsg) :
- qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
+ qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
return -1;
}
@@ -244,8 +244,8 @@ qreal VPieceNode::GetSAAfter(const VContainer *data) const
const QString errorMsg = QObject::tr("Cannot calculate seam allowance after for point '%1'. Reason: %2.")
.arg(nodeName, formula.Reason());
- qApp->IsPedantic() ? throw VException(errorMsg) :
- qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
+ qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
return -1;
}
@@ -276,8 +276,8 @@ qreal VPieceNode::GetSAAfter(const VContainer *data, Unit unit) const
const QString errorMsg = QObject::tr("Cannot calculate seam allowance after for point '%1'. Reason: ")
.arg(nodeName, formula.Reason());
- qApp->IsPedantic() ? throw VException(errorMsg) :
- qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
+ qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
return -1;
}
@@ -342,8 +342,8 @@ qreal VPieceNode::GetPassmarkLength(const VContainer *data, Unit unit) const
const QString errorMsg = QObject::tr("Cannot calculate passmark length for point '%1'. Reason: %2.")
.arg(nodeName, formula.Reason());
- qApp->IsPedantic() ? throw VException(errorMsg) :
- qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
+ qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
return VSAPoint::maxPassmarkLength;
}
diff --git a/src/libs/vpatterndb/vpiecepath.cpp b/src/libs/vpatterndb/vpiecepath.cpp
index 0cd36482c..b5263a753 100644
--- a/src/libs/vpatterndb/vpiecepath.cpp
+++ b/src/libs/vpatterndb/vpiecepath.cpp
@@ -384,8 +384,8 @@ QVector VPiecePath::PathPoints(const VContainer *data, const QVectorIsPedantic() ? throw VExceptionObjectError(errorMsg) :
- qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
+ qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
}
}
@@ -401,8 +401,8 @@ QVector VPiecePath::PathPoints(const VContainer *data, const QVectorIsPedantic() ? throw VExceptionObjectError(errorMsg) :
- qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
+ qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
}
}
diff --git a/src/libs/vpatterndb/vtranslatemeasurements.cpp b/src/libs/vpatterndb/vtranslatemeasurements.cpp
index 48e1cc4df..05e086a99 100644
--- a/src/libs/vpatterndb/vtranslatemeasurements.cpp
+++ b/src/libs/vpatterndb/vtranslatemeasurements.cpp
@@ -62,7 +62,7 @@ bool VTranslateMeasurements::MeasurementsFromUser(QString &newFormula, int posit
QMap::const_iterator i = measurements.constBegin();
while (i != measurements.constEnd())
{
- if (token == i.value().translate(qApp->Settings()->GetLocale()))
+ if (token == i.value().translate(VAbstractApplication::VApp()->Settings()->GetLocale()))
{
newFormula.replace(position, token.length(), i.key());
bias = token.length() - i.key().length();
@@ -79,7 +79,7 @@ QString VTranslateMeasurements::MFromUser(const QString &measurement) const
QMap::const_iterator i = measurements.constBegin();
while (i != measurements.constEnd())
{
- const QString translated = i.value().translate(qApp->Settings()->GetLocale());
+ const QString translated = i.value().translate(VAbstractApplication::VApp()->Settings()->GetLocale());
if (measurement == translated)
{
return i.key();
@@ -94,7 +94,7 @@ QString VTranslateMeasurements::MToUser(const QString &measurement) const
{
if (measurements.contains(measurement))
{
- return measurements.value(measurement).translate(qApp->Settings()->GetLocale());
+ return measurements.value(measurement).translate(VAbstractApplication::VApp()->Settings()->GetLocale());
}
else
{
@@ -126,7 +126,7 @@ QString VTranslateMeasurements::GuiText(const QString &measurement) const
{
if (guiTexts.contains(measurement))
{
- return guiTexts.value(measurement).translate(qApp->Settings()->GetLocale());
+ return guiTexts.value(measurement).translate(VAbstractApplication::VApp()->Settings()->GetLocale());
}
else
{
@@ -139,7 +139,7 @@ QString VTranslateMeasurements::Description(const QString &measurement) const
{
if (descriptions.contains(measurement))
{
- return descriptions.value(measurement).translate(qApp->Settings()->GetLocale());
+ return descriptions.value(measurement).translate(VAbstractApplication::VApp()->Settings()->GetLocale());
}
else
{
diff --git a/src/libs/vpatterndb/vtranslatevars.cpp b/src/libs/vpatterndb/vtranslatevars.cpp
index d75078b84..0c42f39fd 100644
--- a/src/libs/vpatterndb/vtranslatevars.cpp
+++ b/src/libs/vpatterndb/vtranslatevars.cpp
@@ -547,7 +547,7 @@ void VTranslateVars::PrepareFunctionTranslations()
QMap::const_iterator i = functions.constBegin();
while (i != functions.constEnd())
{
- const QString translated = i.value().translate(qApp->Settings()->GetLocale());
+ const QString translated = i.value().translate(VAbstractApplication::VApp()->Settings()->GetLocale());
if (i.key() != translated)
{
translatedFunctions.insert(translated, i.key());
@@ -628,15 +628,16 @@ void VTranslateVars::BiasTokens(int position, int bias, QMap &toke
*/
bool VTranslateVars::VariablesFromUser(QString &newFormula, int position, const QString &token, int &bias) const
{
- const QString currentLengthTr = variables.value(currentLength).translate(qApp->Settings()->GetLocale());
+ const QString currentLengthTr =
+ variables.value(currentLength).translate(VAbstractApplication::VApp()->Settings()->GetLocale());
const QString currentSeamAllowanceTr = variables.value(currentSeamAllowance)
- .translate(qApp->Settings()->GetLocale());
+ .translate(VAbstractApplication::VApp()->Settings()->GetLocale());
QMap::const_iterator i = variables.constBegin();
while (i != variables.constEnd())
{
const qmu::QmuTranslation &var = i.value();
- const QString varTr = var.translate(qApp->Settings()->GetLocale());
+ const QString varTr = var.translate(VAbstractApplication::VApp()->Settings()->GetLocale());
if (token.indexOf(varTr) == 0)
{
@@ -671,7 +672,7 @@ bool VTranslateVars::FunctionsFromUser(QString &newFormula, int position, const
QMap::const_iterator i = functions.constBegin();
while (i != functions.constEnd())
{
- if (token == i.value().translate(qApp->Settings()->GetLocale()))
+ if (token == i.value().translate(VAbstractApplication::VApp()->Settings()->GetLocale()))
{
newFormula.replace(position, token.length(), i.key());
bias = token.length() - i.key().length();
@@ -704,10 +705,12 @@ bool VTranslateVars::VariablesToUser(QString &newFormula, int position, const QS
continue;
}
- newFormula.replace(position, i.key().length(), i.value().translate(qApp->Settings()->GetLocale()));
+ newFormula.replace(position, i.key().length(),
+ i.value().translate(VAbstractApplication::VApp()->Settings()->GetLocale()));
QString newToken = token;
- newToken.replace(0, i.key().length(), i.value().translate(qApp->Settings()->GetLocale()));
+ newToken.replace(0, i.key().length(),
+ i.value().translate(VAbstractApplication::VApp()->Settings()->GetLocale()));
bias = token.length() - newToken.length();
return true;
}
@@ -734,19 +737,19 @@ QString VTranslateVars::InternalVarToUser(const QString &var) const
//---------------------------------------------------------------------------------------------------------------------
QString VTranslateVars::VarToUser(const QString &var) const
{
- if (qApp->Settings()->GetLocale() == QStringLiteral("zh_CN"))
+ if (VAbstractApplication::VApp()->Settings()->GetLocale() == QStringLiteral("zh_CN"))
{
return var; // We do not support translation of variables for Chinese
}
if (measurements.contains(var))
{
- return measurements.value(var).translate(qApp->Settings()->GetLocale());
+ return measurements.value(var).translate(VAbstractApplication::VApp()->Settings()->GetLocale());
}
if (functions.contains(var))
{
- return functions.value(var).translate(qApp->Settings()->GetLocale());
+ return functions.value(var).translate(VAbstractApplication::VApp()->Settings()->GetLocale());
}
return InternalVarToUser(var);
@@ -755,7 +758,7 @@ QString VTranslateVars::VarToUser(const QString &var) const
//---------------------------------------------------------------------------------------------------------------------
QString VTranslateVars::VarFromUser(const QString &var) const
{
- if (qApp->Settings()->GetLocale() == QStringLiteral("zh_CN"))
+ if (VAbstractApplication::VApp()->Settings()->GetLocale() == QStringLiteral("zh_CN"))
{
return var; // We do not support translation of variables for Chinese
}
@@ -782,19 +785,19 @@ QString VTranslateVars::VarFromUser(const QString &var) const
//---------------------------------------------------------------------------------------------------------------------
QString VTranslateVars::PMSystemName(const QString &code) const
{
- return PMSystemNames.value(code).translate(qApp->Settings()->GetLocale());
+ return PMSystemNames.value(code).translate(VAbstractApplication::VApp()->Settings()->GetLocale());
}
//---------------------------------------------------------------------------------------------------------------------
QString VTranslateVars::PMSystemAuthor(const QString &code) const
{
- return PMSystemAuthors.value(code).translate(qApp->Settings()->GetLocale());
+ return PMSystemAuthors.value(code).translate(VAbstractApplication::VApp()->Settings()->GetLocale());
}
//---------------------------------------------------------------------------------------------------------------------
QString VTranslateVars::PMSystemBook(const QString &code) const
{
- return PMSystemBooks.value(code).translate(qApp->Settings()->GetLocale());
+ return PMSystemBooks.value(code).translate(VAbstractApplication::VApp()->Settings()->GetLocale());
}
//---------------------------------------------------------------------------------------------------------------------
@@ -900,8 +903,8 @@ QString VTranslateVars::TryFormulaFromUser(const QString &formula, bool osSepara
{
try
{
- SCASSERT(qApp->TrVars() != nullptr)
- return qApp->TrVars()->FormulaFromUser(formula, osSeparator);
+ SCASSERT(VAbstractApplication::VApp()->TrVars() != nullptr)
+ return VAbstractApplication::VApp()->TrVars()->FormulaFromUser(formula, osSeparator);
}
catch (qmu::QmuParserError &e)// In case something bad will happen
{
@@ -951,9 +954,10 @@ QString VTranslateVars::FormulaToUser(const QString &formula, bool osSeparator)
if (measurements.contains(tValues.at(i)))
{
newFormula.replace(tKeys.at(i), tValues.at(i).length(),
- measurements.value(tValues.at(i)).translate(qApp->Settings()->GetLocale()));
+ measurements.value(tValues.at(i))
+ .translate(VAbstractApplication::VApp()->Settings()->GetLocale()));
int bias = tValues.at(i).length() - measurements.value(tValues.at(i))
- .translate(qApp->Settings()->GetLocale()).length();
+ .translate(VAbstractApplication::VApp()->Settings()->GetLocale()).length();
if (bias != 0)
{// Translated token has different length than original. Position next tokens need to be corrected.
CorrectionsPositions(tKeys.at(i), bias, tokens, numbers);
@@ -966,9 +970,10 @@ QString VTranslateVars::FormulaToUser(const QString &formula, bool osSeparator)
if (functions.contains(tValues.at(i)))
{
newFormula.replace(tKeys.at(i), tValues.at(i).length(),
- functions.value(tValues.at(i)).translate(qApp->Settings()->GetLocale()));
+ functions.value(tValues.at(i))
+ .translate(VAbstractApplication::VApp()->Settings()->GetLocale()));
int bias = tValues.at(i).length() - functions.value(tValues.at(i))
- .translate(qApp->Settings()->GetLocale()).length();
+ .translate(VAbstractApplication::VApp()->Settings()->GetLocale()).length();
if (bias != 0)
{// Translated token has different length than original. Position next tokens need to be corrected.
CorrectionsPositions(tKeys.at(i), bias, tokens, numbers);
@@ -1037,7 +1042,7 @@ QString VTranslateVars::TryFormulaToUser(const QString &formula, bool osSeparato
{
try
{
- return qApp->TrVars()->FormulaToUser(formula, osSeparator);
+ return VAbstractApplication::VApp()->TrVars()->FormulaToUser(formula, osSeparator);
}
catch (qmu::QmuParserError &e)// In case something bad will happen
{
diff --git a/src/libs/vtools/dialogs/dialogtoolbox.cpp b/src/libs/vtools/dialogs/dialogtoolbox.cpp
index e77a435ba..a2ce91c1d 100644
--- a/src/libs/vtools/dialogs/dialogtoolbox.cpp
+++ b/src/libs/vtools/dialogs/dialogtoolbox.cpp
@@ -182,7 +182,7 @@ bool FilterObject(QObject *object, QEvent *event)
QKeyEvent *keyEvent = static_cast(event);
if ((keyEvent->key() == Qt::Key_Period) && (keyEvent->modifiers() & Qt::KeypadModifier))
{
- if (qApp->Settings()->GetOsSeparator())
+ if (VAbstractApplication::VApp()->Settings()->GetOsSeparator())
{
plainTextEdit->insertPlainText(QLocale().decimalPoint());
}
@@ -218,7 +218,9 @@ qreal EvalToolFormula(QDialog *dialog, const FormulaData &data, bool &flag)
try
{
// Translate to internal look.
- QString formula = qApp->TrVars()->FormulaFromUser(data.formula, qApp->Settings()->GetOsSeparator());
+ QString formula = VAbstractApplication::VApp()
+ ->TrVars()->FormulaFromUser(data.formula,
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator());
QScopedPointer cal(new Calculator());
result = cal->EvalFormula(data.variables, formula);
@@ -249,7 +251,8 @@ qreal EvalToolFormula(QDialog *dialog, const FormulaData &data, bool &flag)
}
else
{
- data.labelResult->setText(qApp->LocaleToString(result) + QChar(QChar::Space) + data.postfix);
+ data.labelResult->setText(VAbstractApplication::VApp()
+ ->LocaleToString(result) + QChar(QChar::Space) + data.postfix);
flag = true;
ChangeColor(data.labelEditFormula, OkColor(dialog));
data.labelResult->setToolTip(QObject::tr("Value"));
diff --git a/src/libs/vtools/dialogs/support/dialogeditlabel.cpp b/src/libs/vtools/dialogs/support/dialogeditlabel.cpp
index 55b5f2ba9..ca0ae266a 100644
--- a/src/libs/vtools/dialogs/support/dialogeditlabel.cpp
+++ b/src/libs/vtools/dialogs/support/dialogeditlabel.cpp
@@ -297,11 +297,12 @@ void DialogEditLabel::NewTemplate()
void DialogEditLabel::ExportTemplate()
{
QString filters(tr("Label template") + QLatin1String("(*.xml)"));
- const QString path = VCommonSettings::PrepareLabelTemplates(qApp->Settings()->GetPathLabelTemplate());
+ const QString path =
+ VCommonSettings::PrepareLabelTemplates(VAbstractApplication::VApp()->Settings()->GetPathLabelTemplate());
QString fileName = QFileDialog::getSaveFileName(this, tr("Export label template"),
path + QLatin1String("/") + tr("template") + QLatin1String(".xml"),
- filters, nullptr, qApp->NativeFileDialog());
+ filters, nullptr, VAbstractApplication::VApp()->NativeFileDialog());
if (fileName.isEmpty())
{
@@ -349,9 +350,10 @@ void DialogEditLabel::ImportTemplate()
QString filter(tr("Label template") + QLatin1String(" (*.xml)"));
//Use standard path to label templates
- const QString path = VCommonSettings::PrepareLabelTemplates(qApp->Settings()->GetPathLabelTemplate());
+ const QString path =
+ VCommonSettings::PrepareLabelTemplates(VAbstractApplication::VApp()->Settings()->GetPathLabelTemplate());
const QString fileName = QFileDialog::getOpenFileName(this, tr("Import template"), path, filter, nullptr,
- qApp->NativeFileDialog());
+ VAbstractApplication::VApp()->NativeFileDialog());
if (fileName.isEmpty())
{
return;
@@ -483,7 +485,7 @@ void DialogEditLabel::InitPlaceholdersMenu()
void DialogEditLabel::InitPlaceholders()
{
// Pattern tags
- QLocale locale(qApp->Settings()->GetLocale());
+ QLocale locale(VAbstractApplication::VApp()->Settings()->GetLocale());
const QString date = locale.toString(QDate::currentDate(), m_doc->GetLabelDateFormat());
m_placeholders.insert(pl_date, qMakePair(tr("Date"), date));
@@ -495,18 +497,25 @@ void DialogEditLabel::InitPlaceholders()
m_placeholders.insert(pl_patternNumber, qMakePair(tr("Pattern number"), m_doc->GetPatternNumber()));
m_placeholders.insert(pl_author, qMakePair(tr("Company name or designer name"), m_doc->GetCompanyName()));
- m_placeholders.insert(pl_mUnits, qMakePair(tr("Measurements units"), UnitsToStr(qApp->MeasurementsUnits(), true)));
- m_placeholders.insert(pl_pUnits, qMakePair(tr("Pattern units"), UnitsToStr(qApp->patternUnits(), true)));
- m_placeholders.insert(pl_mSizeUnits, qMakePair(tr("Size units"), UnitsToStr(qApp->DimensionSizeUnits(), true)));
+ m_placeholders.insert(pl_mUnits, qMakePair(tr("Measurements units"),
+ UnitsToStr(VAbstractValApplication::VApp()->MeasurementsUnits(), true)));
+ m_placeholders.insert(pl_pUnits, qMakePair(tr("Pattern units"),
+ UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true)));
+ m_placeholders.insert(pl_mSizeUnits, qMakePair(tr("Size units"),
+ UnitsToStr(VAbstractValApplication::VApp()->DimensionSizeUnits(),
+ true)));
- if (qApp->GetMeasurementsType() == MeasurementsType::Individual)
+ if (VAbstractValApplication::VApp()->GetMeasurementsType() == MeasurementsType::Individual)
{
- m_placeholders.insert(pl_customer, qMakePair(tr("Customer name"), qApp->GetCustomerName()));
+ m_placeholders.insert(pl_customer, qMakePair(tr("Customer name"),
+ VAbstractValApplication::VApp()->GetCustomerName()));
- const QString birthDate = locale.toString(qApp->GetCustomerBirthDate(), m_doc->GetLabelDateFormat());
+ const QString birthDate = locale.toString(VAbstractValApplication::VApp()->GetCustomerBirthDate(),
+ m_doc->GetLabelDateFormat());
m_placeholders.insert(pl_birthDate, qMakePair(tr("Customer birth date"), birthDate));
- m_placeholders.insert(pl_email, qMakePair(tr("Customer email"), qApp->CustomerEmail()));
+ m_placeholders.insert(pl_email, qMakePair(tr("Customer email"),
+ VAbstractValApplication::VApp()->CustomerEmail()));
}
else
{
@@ -520,20 +529,24 @@ void DialogEditLabel::InitPlaceholders()
m_placeholders.insert(pl_pExt, qMakePair(tr("Pattern extension"), QString("val")));
- const QString patternFilePath = QFileInfo(qApp->GetPatternPath()).baseName();
+ const QString patternFilePath = QFileInfo(VAbstractValApplication::VApp()->GetPatternPath()).baseName();
m_placeholders.insert(pl_pFileName, qMakePair(tr("Pattern file name"), patternFilePath));
const QString measurementsFilePath = QFileInfo(m_doc->MPath()).baseName();
m_placeholders.insert(pl_mFileName, qMakePair(tr("Measurments file name"), measurementsFilePath));
- m_placeholders.insert(pl_height, qMakePair(tr("Height", "dimension"), QString::number(qApp->GetDimensionHeight())));
- m_placeholders.insert(pl_size, qMakePair(tr("Size", "dimension"), QString::number(qApp->GetDimensionSize())));
- m_placeholders.insert(pl_hip, qMakePair(tr("Hip", "dimension"), QString::number(qApp->GetDimensionHip())));
- m_placeholders.insert(pl_waist, qMakePair(tr("Waist", "dimension"), QString::number(qApp->GetDimensionWaist())));
+ m_placeholders.insert(pl_height, qMakePair(tr("Height", "dimension"),
+ QString::number(VAbstractValApplication::VApp()->GetDimensionHeight())));
+ m_placeholders.insert(pl_size, qMakePair(tr("Size", "dimension"),
+ QString::number(VAbstractValApplication::VApp()->GetDimensionSize())));
+ m_placeholders.insert(pl_hip, qMakePair(tr("Hip", "dimension"),
+ QString::number(VAbstractValApplication::VApp()->GetDimensionHip())));
+ m_placeholders.insert(pl_waist, qMakePair(tr("Waist", "dimension"),
+ QString::number(VAbstractValApplication::VApp()->GetDimensionWaist())));
m_placeholders.insert(pl_mExt,
qMakePair(tr("Measurments extension"),
- qApp->GetMeasurementsType() == MeasurementsType::Multisize ? QString("vst")
- : QString("vit")));
+ VAbstractValApplication::VApp()->GetMeasurementsType() == MeasurementsType::Multisize
+ ? QString("vst") : QString("vit")));
const QString materialDescription = tr("User material");
const QMap materials = m_doc->GetPatternMaterials();
@@ -582,8 +595,8 @@ void DialogEditLabel::InitPlaceholders()
{
const QString errorMsg = QObject::tr("Failed to prepare final measurement placeholder. Parser error at "
"line %1: %2.").arg(i+1).arg(e.GetMsg());
- qApp->IsPedantic() ? throw VException(errorMsg) :
- qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
+ qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
}
}
}
@@ -614,8 +627,8 @@ QString DialogEditLabel::ReplacePlaceholders(QString line) const
{
if (line.contains(per+placeholder+per) && m_placeholders.value(placeholder).second == QChar('0'))
{
- qApp->IsPedantic() ? throw VException(errorMsg) :
- qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
+ VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
+ qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
}
};
diff --git a/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp b/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp
index 7a09bdb0e..747c0b8c2 100644
--- a/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp
+++ b/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp
@@ -75,8 +75,10 @@ enum {ColumnName = 0, ColumnFullName};
//---------------------------------------------------------------------------------------------------------------------
DialogEditWrongFormula::DialogEditWrongFormula(const VContainer *data, quint32 toolId, QWidget *parent)
- : DialogTool(data, toolId, parent),
+ : QDialog(parent),
ui(new Ui::DialogEditWrongFormula),
+ m_data(data),
+ m_toolId(toolId),
formula(),
formulaBaseHeight(0),
checkZero(false),
@@ -86,6 +88,8 @@ DialogEditWrongFormula::DialogEditWrongFormula(const VContainer *data, quint32 t
timerFormula(new QTimer(this)),
flagFormula(false)
{
+ SCASSERT(data != nullptr)
+
ui->setupUi(this);
timerFormula->setSingleShot(true);
@@ -102,7 +106,15 @@ DialogEditWrongFormula::DialogEditWrongFormula(const VContainer *data, quint32 t
connect(ui->filterFormulaInputs, &QLineEdit::textChanged, this, &DialogEditWrongFormula::FilterVariablesEdited);
- InitOkCancel(ui);
+ QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
+ SCASSERT(bOk != nullptr)
+ connect(bOk, &QPushButton::clicked, this, &DialogEditWrongFormula::DialogAccepted);
+
+ QPushButton *bCancel = ui->buttonBox->button(QDialogButtonBox::Cancel);
+ SCASSERT(bCancel != nullptr)
+ connect(bCancel, &QPushButton::clicked, this, &DialogEditWrongFormula::DialogRejected);
+
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogEditWrongFormula::PutHere);
connect(ui->tableWidget, &QTableWidget::itemDoubleClicked, this, &DialogEditWrongFormula::PutVal);
@@ -161,7 +173,7 @@ void DialogEditWrongFormula::EvalFormula()
{
FormulaData formulaData;
formulaData.formula = ui->plainTextEditFormula->toPlainText();
- formulaData.variables = data->DataVariables();
+ formulaData.variables = m_data->DataVariables();
formulaData.labelEditFormula = ui->labelEditFormula;
formulaData.labelResult = ui->labelResultCalculation;
formulaData.postfix = postfix;
@@ -184,55 +196,55 @@ void DialogEditWrongFormula::ValChanged(int row)
return;
}
QTableWidgetItem *item = ui->tableWidget->item( row, ColumnName );
- const QString name = qApp->TrVars()->VarFromUser(item->text());
+ const QString name = VAbstractApplication::VApp()->TrVars()->VarFromUser(item->text());
try
{
if (ui->radioButtonStandardTable->isChecked())
{
- const QSharedPointer stable = data->GetVariable(name);
+ const QSharedPointer stable = m_data->GetVariable(name);
SetDescription(item->text(), *stable->GetValue(), stable->IsSpecialUnits(), stable->GetGuiText());
}
else if (ui->radioButtonIncrements->isChecked())
{
- const QSharedPointer incr = data->GetVariable(name);
+ const QSharedPointer incr = m_data->GetVariable(name);
const bool specialUnits = false;
SetDescription(item->text(), *incr->GetValue(), specialUnits, incr->GetDescription());
}
else if (ui->radioButtonPC->isChecked())
{
- const QSharedPointer incr = data->GetVariable(name);
+ const QSharedPointer incr = m_data->GetVariable(name);
const bool specialUnits = false;
SetDescription(item->text(), *incr->GetValue(), specialUnits, incr->GetDescription());
}
else if (ui->radioButtonLengthLine->isChecked())
{
const bool specialUnits = false;
- SetDescription(item->text(), *data->GetVariable(name)->GetValue(), specialUnits,
+ SetDescription(item->text(), *m_data->GetVariable(name)->GetValue(), specialUnits,
tr("Line length"));
}
else if (ui->radioButtonLengthSpline->isChecked())
{
const bool specialUnits = false;
- SetDescription(item->text(), *data->GetVariable(name)->GetValue(), specialUnits,
+ SetDescription(item->text(), *m_data->GetVariable(name)->GetValue(), specialUnits,
tr("Curve length"));
}
else if (ui->radioButtonAngleLine->isChecked())
{
const bool specialUnits = true;
- SetDescription(item->text(), *data->GetVariable(name)->GetValue(), specialUnits,
+ SetDescription(item->text(), *m_data->GetVariable(name)->GetValue(), specialUnits,
tr("Line Angle"));
}
else if (ui->radioButtonRadiusesArcs->isChecked())
{
const bool specialUnits = false;
- SetDescription(item->text(), *data->GetVariable(name)->GetValue(), specialUnits,
+ SetDescription(item->text(), *m_data->GetVariable(name)->GetValue(), specialUnits,
tr("Arc radius"));
}
else if (ui->radioButtonAnglesCurves->isChecked())
{
const bool specialUnits = true;
- SetDescription(item->text(), *data->GetVariable(name)->GetValue(), specialUnits,
+ SetDescription(item->text(), *m_data->GetVariable(name)->GetValue(), specialUnits,
tr("Curve angle"));
}
else if (ui->radioButtonFunctions->isChecked())
@@ -282,7 +294,7 @@ void DialogEditWrongFormula::PutVal(QTableWidgetItem *item)
void DialogEditWrongFormula::Measurements()
{
ui->checkBoxHideEmpty->setEnabled(true);
- ShowMeasurements(data->DataMeasurements());
+ ShowMeasurements(m_data->DataMeasurements());
}
//---------------------------------------------------------------------------------------------------------------------
@@ -292,21 +304,21 @@ void DialogEditWrongFormula::Measurements()
void DialogEditWrongFormula::LengthLines()
{
ui->checkBoxHideEmpty->setEnabled(false);
- ShowVariable(data->DataLengthLines());
+ ShowVariable(m_data->DataLengthLines());
}
//---------------------------------------------------------------------------------------------------------------------
void DialogEditWrongFormula::RadiusArcs()
{
ui->checkBoxHideEmpty->setEnabled(false);
- ShowVariable(data->DataRadiusesArcs());
+ ShowVariable(m_data->DataRadiusesArcs());
}
//---------------------------------------------------------------------------------------------------------------------
void DialogEditWrongFormula::AnglesCurves()
{
ui->checkBoxHideEmpty->setEnabled(false);
- ShowVariable(data->DataAnglesCurves());
+ ShowVariable(m_data->DataAnglesCurves());
}
//---------------------------------------------------------------------------------------------------------------------
@@ -316,21 +328,21 @@ void DialogEditWrongFormula::AnglesCurves()
void DialogEditWrongFormula::LengthCurves()
{
ui->checkBoxHideEmpty->setEnabled(false);
- ShowVariable(data->DataLengthCurves());
+ ShowVariable(m_data->DataLengthCurves());
}
//---------------------------------------------------------------------------------------------------------------------
void DialogEditWrongFormula::CurvesCLength()
{
ui->checkBoxHideEmpty->setEnabled(false);
- ShowVariable(data->DataCurvesCLength());
+ ShowVariable(m_data->DataCurvesCLength());
}
//---------------------------------------------------------------------------------------------------------------------
void DialogEditWrongFormula::AngleLines()
{
ui->checkBoxHideEmpty->setEnabled(false);
- ShowVariable(data->DataAngleLines());
+ ShowVariable(m_data->DataAngleLines());
}
//---------------------------------------------------------------------------------------------------------------------
@@ -362,7 +374,7 @@ void DialogEditWrongFormula::Functions()
void DialogEditWrongFormula::closeEvent(QCloseEvent *event)
{
ui->plainTextEditFormula->blockSignals(true);
- DialogTool::closeEvent(event);
+ QDialog::closeEvent(event);
}
//---------------------------------------------------------------------------------------------------------------------
@@ -374,13 +386,13 @@ void DialogEditWrongFormula::showEvent(QShowEvent *event)
return;
}
- if (isInitialized)
+ if (m_isInitialized)
{
return;
}
// do your init stuff here
- const QSize sz = qApp->Settings()->GetFormulaWizardDialogSize();
+ const QSize sz = VAbstractApplication::VApp()->Settings()->GetFormulaWizardDialogSize();
if (not sz.isEmpty())
{
resize(sz);
@@ -388,7 +400,7 @@ void DialogEditWrongFormula::showEvent(QShowEvent *event)
CheckState();
- isInitialized = true;//first show windows are held
+ m_isInitialized = true;//first show windows are held
}
//---------------------------------------------------------------------------------------------------------------------
@@ -397,17 +409,32 @@ void DialogEditWrongFormula::resizeEvent(QResizeEvent *event)
// remember the size for the next time this dialog is opened, but only
// if widget was already initialized, which rules out the resize at
// dialog creating, which would
- if (isInitialized)
+ if (m_isInitialized)
{
- qApp->Settings()->SetFormulaWizardDialogSize(size());
+ VAbstractApplication::VApp()->Settings()->SetFormulaWizardDialogSize(size());
+ }
+ QDialog::resizeEvent(event);
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+void DialogEditWrongFormula::CheckState()
+{
+ QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
+ SCASSERT(bOk != nullptr)
+ bOk->setEnabled(IsValid());
+ // In case dialog hasn't apply button
+ QPushButton *bApply = ui->buttonBox->button(QDialogButtonBox::Apply);
+ if (bApply != nullptr)
+ {
+ bApply->setEnabled(bOk->isEnabled());
}
- DialogTool::resizeEvent(event);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogEditWrongFormula::SetFormula(const QString &value)
{
- formula = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
+ formula = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(value, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
ui->plainTextEditFormula->setPlainText(formula);
MoveCursorToEnd(ui->plainTextEditFormula);
ui->plainTextEditFormula->selectAll();
@@ -459,7 +486,8 @@ void DialogEditWrongFormula::SetPreviewCalculationsMode()
//---------------------------------------------------------------------------------------------------------------------
QString DialogEditWrongFormula::GetFormula() const
{
- return qApp->TrVars()->TryFormulaFromUser(formula, qApp->Settings()->GetOsSeparator());
+ return VAbstractApplication::VApp()->TrVars()
+ ->TryFormulaFromUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
@@ -510,11 +538,20 @@ void DialogEditWrongFormula::InitVariables()
void DialogEditWrongFormula::SetDescription(const QString &name, qreal value, bool specialUnits,
const QString &description)
{
- const QString unit = specialUnits ? degreeSymbol : " " + UnitsToStr(qApp->patternUnits(), true);
+ const QString unit = specialUnits ? degreeSymbol
+ : " " + UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
const QString desc = QStringLiteral("%1(%2%3) - %4").arg(name).arg(value).arg(unit, description);
ui->labelDescription->setText(desc);
}
+//---------------------------------------------------------------------------------------------------------------------
+qreal DialogEditWrongFormula::Eval(const FormulaData &formulaData, bool &flag)
+{
+ const qreal result = EvalToolFormula(this, formulaData, flag);
+ CheckState(); // Disable Ok and Apply buttons if something wrong.
+ return result;
+}
+
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ShowVariable show variables in list
@@ -537,7 +574,7 @@ void DialogEditWrongFormula::ShowVariable(const QMap &var)
{
continue; //skip this measurement
}
- if (iMap.value()->Filter(toolId) == false)
+ if (iMap.value()->Filter(m_toolId) == false)
{// If we create this variable don't show
ui->tableWidget->setRowCount(ui->tableWidget->rowCount() + 1);
QTableWidgetItem *item = new QTableWidgetItem(iMap.key());
@@ -573,7 +610,7 @@ void DialogEditWrongFormula::ShowMeasurements(const QMapFilter(toolId) == false)
+ if (iMap.value()->Filter(m_toolId) == false)
{// If we create this variable don't show
ui->tableWidget->setRowCount(ui->tableWidget->rowCount() + 1);
QTableWidgetItem *itemName = new QTableWidgetItem(iMap.key());
@@ -592,7 +629,7 @@ void DialogEditWrongFormula::ShowMeasurements(const QMapsetText(qApp->TrVars()->GuiText(iMap.value()->GetName()));
+ itemFullName->setText(VAbstractApplication::VApp()->TrVars()->GuiText(iMap.value()->GetName()));
}
itemFullName->setToolTip(itemFullName->text());
@@ -617,20 +654,23 @@ void DialogEditWrongFormula::ShowFunctions()
ui->tableWidget->setColumnHidden(ColumnFullName, true);
ui->labelDescription->setText(QString());
- const QMap functionsDescriptions = qApp->TrVars()->GetFunctionsDescriptions();
- const QMap functions = qApp->TrVars()->GetFunctions();
+ const QMap functionsDescriptions =
+ VAbstractApplication::VApp()->TrVars()->GetFunctionsDescriptions();
+ const QMap functions = VAbstractApplication::VApp()->TrVars()->GetFunctions();
QMap::const_iterator i = functions.constBegin();
while (i != functions.constEnd())
{
ui->tableWidget->setRowCount(ui->tableWidget->rowCount() + 1);
- QTableWidgetItem *item = new QTableWidgetItem(i.value().translate(qApp->Settings()->GetLocale()));
+ QTableWidgetItem *item =
+ new QTableWidgetItem(i.value().translate(VAbstractApplication::VApp()->Settings()->GetLocale()));
QFont font = item->font();
font.setBold(true);
item->setFont(font);
ui->tableWidget->setItem(ui->tableWidget->rowCount()-1, ColumnName, item);
functionsDescriptions.contains(i.key())
- ? item->setToolTip(functionsDescriptions.value(i.key()).translate(qApp->Settings()->GetLocale()))
+ ? item->setToolTip(functionsDescriptions.value(i.key())
+ .translate(VAbstractApplication::VApp()->Settings()->GetLocale()))
: item->setToolTip(i.value().getMdisambiguation());
++i;
}
@@ -647,7 +687,7 @@ void DialogEditWrongFormula::ShowIncrementsInPreviewCalculation(bool show)
QMap > increments;
- const QMap > list = data->DataIncrements();
+ const QMap > list = m_data->DataIncrements();
QMap >::const_iterator i = list.constBegin();
while (i != list.constEnd())
{
diff --git a/src/libs/vtools/dialogs/support/dialogeditwrongformula.h b/src/libs/vtools/dialogs/support/dialogeditwrongformula.h
index 677802c1e..de46cd030 100644
--- a/src/libs/vtools/dialogs/support/dialogeditwrongformula.h
+++ b/src/libs/vtools/dialogs/support/dialogeditwrongformula.h
@@ -36,10 +36,11 @@
#include
#include
#include
-
-#include "../tools/dialogtool.h"
+#include
class VMeasurement;
+struct FormulaData;
+class VContainer;
namespace Ui
{
@@ -54,7 +55,7 @@ class DialogEditWrongFormula;
*
* Don't implemant button "Apply" for this dialog!!
*/
-class DialogEditWrongFormula : public DialogTool
+class DialogEditWrongFormula : public QDialog
{
Q_OBJECT
public:
@@ -70,8 +71,8 @@ public:
void SetIncrementsMode();
void SetPreviewCalculationsMode();
public slots:
- virtual void DialogAccepted() override;
- virtual void DialogRejected() override;
+ virtual void DialogAccepted();
+ virtual void DialogRejected();
void EvalFormula();
void ValChanged(int row);
void PutHere();
@@ -87,17 +88,32 @@ public slots:
void Increments();
void PreviewCalculations();
void Functions();
+signals:
+ /**
+ * @brief DialogClosed signal dialog closed
+ * @param result keep result
+ */
+ void DialogClosed(int result);
+ /**
+ * @brief DialogApplied emit signal dialog apply changes
+ */
+ void DialogApplied();
protected:
virtual bool IsValid() const final;
virtual void closeEvent(QCloseEvent *event) override;
virtual void showEvent( QShowEvent *event ) override;
virtual void resizeEvent(QResizeEvent *event) override;
+ virtual void CheckState();
private slots:
void FilterVariablesEdited(const QString &filter);
private:
Q_DISABLE_COPY(DialogEditWrongFormula)
Ui::DialogEditWrongFormula *ui;
+ const VContainer *m_data;
+
+ quint32 m_toolId;
+
/** @brief formula string with formula */
QString formula;
@@ -113,6 +129,9 @@ private:
bool flagFormula;
+ /** @brief m_isInitialized true if window is initialized */
+ bool m_isInitialized{false};
+
void InitVariables();
template
@@ -122,6 +141,8 @@ private:
void ShowIncrementsInPreviewCalculation(bool show);
void SetDescription(const QString &name, qreal value, bool specialUnits, const QString &description);
+
+ qreal Eval(const FormulaData &formulaData, bool &flag);
};
//---------------------------------------------------------------------------------------------------------------------
diff --git a/src/libs/vtools/dialogs/support/dialogundo.cpp b/src/libs/vtools/dialogs/support/dialogundo.cpp
index ba6d48eec..93ccf6848 100644
--- a/src/libs/vtools/dialogs/support/dialogundo.cpp
+++ b/src/libs/vtools/dialogs/support/dialogundo.cpp
@@ -43,9 +43,9 @@ DialogUndo::DialogUndo(QWidget *parent)
{
ui->setupUi(this);
- qApp->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
- bool opening = qApp->getOpeningPattern();
+ bool opening = VAbstractValApplication::VApp()->getOpeningPattern();
if (opening)
{
ui->pushButtonUndo->setDisabled(opening);
diff --git a/src/libs/vtools/dialogs/tools/dialogalongline.cpp b/src/libs/vtools/dialogs/tools/dialogalongline.cpp
index 0c178813f..487d8e7d9 100644
--- a/src/libs/vtools/dialogs/tools/dialogalongline.cpp
+++ b/src/libs/vtools/dialogs/tools/dialogalongline.cpp
@@ -81,7 +81,8 @@ DialogAlongLine::DialogAlongLine(const VContainer *data, quint32 toolId, QWidget
ui->lineEditNamePoint->setClearButtonEnabled(true);
- ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
+ ui->lineEditNamePoint->setText(
+ VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
this->formulaBaseHeight = ui->plainTextEditFormula->height();
ui->plainTextEditFormula->installEventFilter(this);
@@ -144,7 +145,7 @@ void DialogAlongLine::FXLength()
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit length"));
dialog->SetFormula(GetFormula());
- dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
+ dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetFormula(dialog->GetFormula());
@@ -160,7 +161,7 @@ void DialogAlongLine::EvalFormula()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditFormula;
formulaData.labelResult = ui->labelResultCalculation;
- formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
+ formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
formulaData.checkZero = false;
Eval(formulaData, flagFormula);
@@ -345,7 +346,8 @@ void DialogAlongLine::SetFirstPointId(quint32 value)
*/
void DialogAlongLine::SetFormula(const QString &value)
{
- formula = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
+ formula = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(value, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
// increase height if needed.
if (formula.length() > 80)
{
@@ -417,7 +419,8 @@ QString DialogAlongLine::GetTypeLine() const
*/
QString DialogAlongLine::GetFormula() const
{
- return qApp->TrVars()->TryFormulaFromUser(formula, qApp->Settings()->GetOsSeparator());
+ return VAbstractApplication::VApp()->TrVars()
+ ->TryFormulaFromUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
diff --git a/src/libs/vtools/dialogs/tools/dialogarc.cpp b/src/libs/vtools/dialogs/tools/dialogarc.cpp
index 83ce97da4..564aa4e17 100644
--- a/src/libs/vtools/dialogs/tools/dialogarc.cpp
+++ b/src/libs/vtools/dialogs/tools/dialogarc.cpp
@@ -174,7 +174,8 @@ void DialogArc::SetCenter(const quint32 &value)
*/
void DialogArc::SetF2(const QString &value)
{
- f2 = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
+ f2 = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(value, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
// increase height if needed.
if (f2.length() > 80)
{
@@ -262,7 +263,8 @@ QString DialogArc::GetAliasSuffix() const
*/
void DialogArc::SetF1(const QString &value)
{
- f1 = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
+ f1 = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(value, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
// increase height if needed.
if (f1.length() > 80)
{
@@ -284,7 +286,8 @@ void DialogArc::SetF1(const QString &value)
*/
void DialogArc::SetRadius(const QString &value)
{
- radius = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
+ radius = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(value, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
// increase height if needed.
if (radius.length() > 80)
{
@@ -383,7 +386,7 @@ void DialogArc::FXRadius()
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit radius"));
dialog->SetFormula(GetRadius());
- dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
+ dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetRadius(dialog->GetFormula());
@@ -430,7 +433,7 @@ void DialogArc::EvalRadius()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditRadius;
formulaData.labelResult = ui->labelResultRadius;
- formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
+ formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
const qreal radius = Eval(formulaData, flagRadius);
@@ -485,7 +488,8 @@ quint32 DialogArc::GetCenter() const
*/
QString DialogArc::GetRadius() const
{
- return qApp->TrVars()->TryFormulaFromUser(radius, qApp->Settings()->GetOsSeparator());
+ return VAbstractApplication::VApp()->TrVars()
+ ->TryFormulaFromUser(radius, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
@@ -495,7 +499,8 @@ QString DialogArc::GetRadius() const
*/
QString DialogArc::GetF1() const
{
- return qApp->TrVars()->TryFormulaFromUser(f1, qApp->Settings()->GetOsSeparator());
+ return VAbstractApplication::VApp()->TrVars()
+ ->TryFormulaFromUser(f1, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
@@ -505,5 +510,6 @@ QString DialogArc::GetF1() const
*/
QString DialogArc::GetF2() const
{
- return qApp->TrVars()->TryFormulaFromUser(f2, qApp->Settings()->GetOsSeparator());
+ return VAbstractApplication::VApp()->TrVars()
+ ->TryFormulaFromUser(f2, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}
diff --git a/src/libs/vtools/dialogs/tools/dialogarcwithlength.cpp b/src/libs/vtools/dialogs/tools/dialogarcwithlength.cpp
index c1ec97df7..86f3b7010 100644
--- a/src/libs/vtools/dialogs/tools/dialogarcwithlength.cpp
+++ b/src/libs/vtools/dialogs/tools/dialogarcwithlength.cpp
@@ -147,13 +147,15 @@ void DialogArcWithLength::SetCenter(const quint32 &value)
//---------------------------------------------------------------------------------------------------------------------
QString DialogArcWithLength::GetRadius() const
{
- return qApp->TrVars()->TryFormulaFromUser(radius, qApp->Settings()->GetOsSeparator());
+ return VAbstractApplication::VApp()->TrVars()
+ ->TryFormulaFromUser(radius, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
void DialogArcWithLength::SetRadius(const QString &value)
{
- radius = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
+ radius = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(value, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
// increase height if needed.
if (radius.length() > 80)
{
@@ -171,12 +173,14 @@ void DialogArcWithLength::SetRadius(const QString &value)
//---------------------------------------------------------------------------------------------------------------------
QString DialogArcWithLength::GetF1() const
{
- return qApp->TrVars()->TryFormulaFromUser(f1, qApp->Settings()->GetOsSeparator());
+ return VAbstractApplication::VApp()->TrVars()
+ ->TryFormulaFromUser(f1, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}
void DialogArcWithLength::SetF1(const QString &value)
{
- f1 = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
+ f1 = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(value, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
// increase height if needed.
if (f1.length() > 80)
{
@@ -194,13 +198,15 @@ void DialogArcWithLength::SetF1(const QString &value)
//---------------------------------------------------------------------------------------------------------------------
QString DialogArcWithLength::GetLength() const
{
- return qApp->TrVars()->TryFormulaFromUser(length, qApp->Settings()->GetOsSeparator());
+ return VAbstractApplication::VApp()->TrVars()
+ ->TryFormulaFromUser(length, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
void DialogArcWithLength::SetLength(const QString &value)
{
- length = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
+ length = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(value, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
// increase height if needed.
if (length.length() > 80)
{
@@ -323,7 +329,7 @@ void DialogArcWithLength::FXRadius()
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit radius"));
dialog->SetFormula(GetRadius());
- dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
+ dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetRadius(dialog->GetFormula());
@@ -351,7 +357,7 @@ void DialogArcWithLength::FXLength()
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit the arc length"));
dialog->SetFormula(GetLength());
- dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
+ dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetLength(dialog->GetFormula());
@@ -422,7 +428,7 @@ void DialogArcWithLength::Radius()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditRadius;
formulaData.labelResult = ui->labelResultRadius;
- formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
+ formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
formulaData.checkLessThanZero = true;
Eval(formulaData, flagRadius);
@@ -436,7 +442,7 @@ void DialogArcWithLength::Length()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditLength;
formulaData.labelResult = ui->labelResultLength;
- formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
+ formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
Eval(formulaData, flagLength);
}
diff --git a/src/libs/vtools/dialogs/tools/dialogbisector.cpp b/src/libs/vtools/dialogs/tools/dialogbisector.cpp
index 64a3c8ada..ffd73e08f 100644
--- a/src/libs/vtools/dialogs/tools/dialogbisector.cpp
+++ b/src/libs/vtools/dialogs/tools/dialogbisector.cpp
@@ -75,7 +75,8 @@ DialogBisector::DialogBisector(const VContainer *data, quint32 toolId, QWidget *
ui->lineEditNamePoint->setClearButtonEnabled(true);
- ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
+ ui->lineEditNamePoint->setText(
+ VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
this->formulaBaseHeight = ui->plainTextEditFormula->height();
ui->plainTextEditFormula->installEventFilter(this);
@@ -142,7 +143,7 @@ void DialogBisector::FXLength()
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit length"));
dialog->SetFormula(GetFormula());
- dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
+ dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetFormula(dialog->GetFormula());
@@ -158,7 +159,7 @@ void DialogBisector::EvalFormula()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditFormula;
formulaData.labelResult = ui->labelResultCalculation;
- formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
+ formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
formulaData.checkZero = false;
Eval(formulaData, flagFormula);
@@ -279,7 +280,8 @@ void DialogBisector::SetTypeLine(const QString &value)
*/
void DialogBisector::SetFormula(const QString &value)
{
- formula = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
+ formula = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(value, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
// increase height if needed.
if (formula.length() > 80)
{
@@ -401,7 +403,8 @@ QString DialogBisector::GetTypeLine() const
*/
QString DialogBisector::GetFormula() const
{
- return qApp->TrVars()->TryFormulaFromUser(formula, qApp->Settings()->GetOsSeparator());
+ return VAbstractApplication::VApp()->TrVars()
+ ->TryFormulaFromUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
diff --git a/src/libs/vtools/dialogs/tools/dialogcubicbezier.cpp b/src/libs/vtools/dialogs/tools/dialogcubicbezier.cpp
index 306423f6a..4db6d3577 100644
--- a/src/libs/vtools/dialogs/tools/dialogcubicbezier.cpp
+++ b/src/libs/vtools/dialogs/tools/dialogcubicbezier.cpp
@@ -106,7 +106,7 @@ void DialogCubicBezier::SetSpline(const VCubicBezier &spline)
ChangeCurrentData(ui->comboBoxPenStyle, spl.GetPenStyle());
ChangeCurrentData(ui->comboBoxColor, spl.GetColor());
- ui->lineEditSplineName->setText(qApp->TrVars()->VarToUser(spl.name()));
+ ui->lineEditSplineName->setText(VAbstractApplication::VApp()->TrVars()->VarToUser(spl.name()));
ui->doubleSpinBoxApproximationScale->setValue(spl.GetApproximationScale());
originAliasSuffix = spl.GetAliasSuffix();
@@ -200,7 +200,7 @@ void DialogCubicBezier::PointNameChanged()
getCurrentObjectId(ui->comboBoxP4) == spl.GetP4().id())
{
newDuplicate = -1;
- ui->lineEditSplineName->setText(qApp->TrVars()->VarToUser(spl.name()));
+ ui->lineEditSplineName->setText(VAbstractApplication::VApp()->TrVars()->VarToUser(spl.name()));
}
else
{
@@ -213,7 +213,7 @@ void DialogCubicBezier::PointNameChanged()
newDuplicate = static_cast(DNumber(spline.name()));
spline.SetDuplicate(static_cast(newDuplicate));
}
- ui->lineEditSplineName->setText(qApp->TrVars()->VarToUser(spline.name()));
+ ui->lineEditSplineName->setText(VAbstractApplication::VApp()->TrVars()->VarToUser(spline.name()));
}
catch (const VExceptionBadId &)
{
diff --git a/src/libs/vtools/dialogs/tools/dialogcubicbezierpath.cpp b/src/libs/vtools/dialogs/tools/dialogcubicbezierpath.cpp
index e583126a0..961a70b47 100644
--- a/src/libs/vtools/dialogs/tools/dialogcubicbezierpath.cpp
+++ b/src/libs/vtools/dialogs/tools/dialogcubicbezierpath.cpp
@@ -112,7 +112,7 @@ void DialogCubicBezierPath::SetPath(const VCubicBezierPath &value)
NewItem(path.at(i));
}
ui->listWidget->setFocus(Qt::OtherFocusReason);
- ui->lineEditSplPathName->setText(qApp->TrVars()->VarToUser(path.name()));
+ ui->lineEditSplPathName->setText(VAbstractApplication::VApp()->TrVars()->VarToUser(path.name()));
ui->doubleSpinBoxApproximationScale->setValue(path.GetApproximationScale());
originAliasSuffix = path.GetAliasSuffix();
@@ -157,7 +157,8 @@ void DialogCubicBezierPath::ChosenObject(quint32 id, const SceneObject &type)
if (path.CountPoints() == 1)
{
visPath->VisualMode(NULL_ID);
- VAbstractMainWindow *window = qobject_cast(qApp->getMainWindow());
+ VAbstractMainWindow *window =
+ qobject_cast(VAbstractValApplication::VApp()->getMainWindow());
SCASSERT(window != nullptr)
connect(visPath, &VisToolCubicBezierPath::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
}
@@ -374,7 +375,7 @@ void DialogCubicBezierPath::ValidatePath()
if (first.id() == path.at(0).id() && last.id() == path.at(path.CountPoints()-1).id())
{
newDuplicate = -1;
- ui->lineEditSplPathName->setText(qApp->TrVars()->VarToUser(path.name()));
+ ui->lineEditSplPathName->setText(VAbstractApplication::VApp()->TrVars()->VarToUser(path.name()));
}
else
{
@@ -386,7 +387,7 @@ void DialogCubicBezierPath::ValidatePath()
newPath.SetDuplicate(static_cast(newDuplicate));
}
- ui->lineEditSplPathName->setText(qApp->TrVars()->VarToUser(newPath.name()));
+ ui->lineEditSplPathName->setText(VAbstractApplication::VApp()->TrVars()->VarToUser(newPath.name()));
}
}
diff --git a/src/libs/vtools/dialogs/tools/dialogcurveintersectaxis.cpp b/src/libs/vtools/dialogs/tools/dialogcurveintersectaxis.cpp
index 2dadef0f5..c7facc36a 100644
--- a/src/libs/vtools/dialogs/tools/dialogcurveintersectaxis.cpp
+++ b/src/libs/vtools/dialogs/tools/dialogcurveintersectaxis.cpp
@@ -71,7 +71,8 @@ DialogCurveIntersectAxis::DialogCurveIntersectAxis(const VContainer *data, quint
ui->lineEditNamePoint->setClearButtonEnabled(true);
- ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
+ ui->lineEditNamePoint->setText(
+ VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
formulaBaseHeightAngle = ui->plainTextEditFormula->height();
ui->plainTextEditFormula->installEventFilter(this);
@@ -136,13 +137,15 @@ void DialogCurveIntersectAxis::SetTypeLine(const QString &value)
//---------------------------------------------------------------------------------------------------------------------
QString DialogCurveIntersectAxis::GetAngle() const
{
- return qApp->TrVars()->TryFormulaFromUser(formulaAngle, qApp->Settings()->GetOsSeparator());
+ return VAbstractApplication::VApp()->TrVars()
+ ->TryFormulaFromUser(formulaAngle, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
void DialogCurveIntersectAxis::SetAngle(const QString &value)
{
- formulaAngle = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
+ formulaAngle = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(value, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
// increase height if needed. TODO : see if I can get the max number of caracters in one line
// of this PlainTextEdit to change 80 to this value
if (formulaAngle.length() > 80)
@@ -218,13 +221,14 @@ void DialogCurveIntersectAxis::ShowDialog(bool click)
}
/*We will ignore click if poinet is in point circle*/
- VMainGraphicsScene *scene = qobject_cast(qApp->getCurrentScene());
+ VMainGraphicsScene *scene =
+ qobject_cast(VAbstractValApplication::VApp()->getCurrentScene());
SCASSERT(scene != nullptr)
const QSharedPointer point = data->GeometricObject(GetBasePointId());
QLineF line = QLineF(static_cast(*point), scene->getScenePos());
//Radius of point circle, but little bigger. Need handle with hover sizes.
- if (line.length() <= ScaledRadius(SceneScale(qApp->getCurrentScene()))*1.5)
+ if (line.length() <= ScaledRadius(SceneScale(VAbstractValApplication::VApp()->getCurrentScene()))*1.5)
{
return;
}
@@ -260,7 +264,8 @@ void DialogCurveIntersectAxis::ChosenObject(quint32 id, const SceneObject &type)
{
number++;
line->VisualMode(id);
- VAbstractMainWindow *window = qobject_cast(qApp->getMainWindow());
+ VAbstractMainWindow *window =
+ qobject_cast(VAbstractValApplication::VApp()->getMainWindow());
SCASSERT(window != nullptr)
connect(line, &VisToolCurveIntersectAxis::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
diff --git a/src/libs/vtools/dialogs/tools/dialogcutarc.cpp b/src/libs/vtools/dialogs/tools/dialogcutarc.cpp
index eea074655..ec0bbb4d9 100644
--- a/src/libs/vtools/dialogs/tools/dialogcutarc.cpp
+++ b/src/libs/vtools/dialogs/tools/dialogcutarc.cpp
@@ -72,7 +72,8 @@ DialogCutArc::DialogCutArc(const VContainer *data, quint32 toolId, QWidget *pare
ui->lineEditNamePoint->setClearButtonEnabled(true);
- ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
+ ui->lineEditNamePoint->setText(
+ VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
formulaBaseHeight = ui->plainTextEditFormula->height();
ui->plainTextEditFormula->installEventFilter(this);
@@ -109,7 +110,7 @@ void DialogCutArc::FXLength()
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit length"));
dialog->SetFormula(GetFormula());
- dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
+ dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetFormula(dialog->GetFormula());
@@ -125,7 +126,7 @@ void DialogCutArc::EvalFormula()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditFormula;
formulaData.labelResult = ui->labelResultCalculation;
- formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
+ formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
formulaData.checkZero = false;
Eval(formulaData, flagFormula);
@@ -268,7 +269,8 @@ void DialogCutArc::setArcId(quint32 value)
*/
void DialogCutArc::SetFormula(const QString &value)
{
- formula = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
+ formula = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(value, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
// increase height if needed.
if (formula.length() > 80)
{
@@ -301,7 +303,8 @@ void DialogCutArc::SetPointName(const QString &value)
*/
QString DialogCutArc::GetFormula() const
{
- return qApp->TrVars()->TryFormulaFromUser(formula, qApp->Settings()->GetOsSeparator());
+ return VAbstractApplication::VApp()->TrVars()
+ ->TryFormulaFromUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
diff --git a/src/libs/vtools/dialogs/tools/dialogcutspline.cpp b/src/libs/vtools/dialogs/tools/dialogcutspline.cpp
index 0f41f71a9..30dd1a12e 100644
--- a/src/libs/vtools/dialogs/tools/dialogcutspline.cpp
+++ b/src/libs/vtools/dialogs/tools/dialogcutspline.cpp
@@ -72,7 +72,8 @@ DialogCutSpline::DialogCutSpline(const VContainer *data, quint32 toolId, QWidget
ui->lineEditNamePoint->setClearButtonEnabled(true);
- ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
+ ui->lineEditNamePoint->setText(
+ VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
this->formulaBaseHeight = ui->plainTextEditFormula->height();
ui->plainTextEditFormula->installEventFilter(this);
@@ -132,7 +133,8 @@ void DialogCutSpline::SetPointName(const QString &value)
*/
void DialogCutSpline::SetFormula(const QString &value)
{
- formula = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
+ formula = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(value, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
// increase height if needed. TODO : see if I can get the max number of caracters in one line
// of this PlainTextEdit to change 80 to this value
if (formula.length() > 80)
@@ -266,7 +268,7 @@ void DialogCutSpline::FXLength()
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit length"));
dialog->SetFormula(GetFormula());
- dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
+ dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetFormula(dialog->GetFormula());
@@ -282,7 +284,7 @@ void DialogCutSpline::EvalFormula()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditFormula;
formulaData.labelResult = ui->labelResultCalculation;
- formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
+ formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
formulaData.checkZero = false;
Eval(formulaData, flagFormula);
@@ -301,7 +303,8 @@ void DialogCutSpline::ShowVisualization()
*/
QString DialogCutSpline::GetFormula() const
{
- return qApp->TrVars()->TryFormulaFromUser(formula, qApp->Settings()->GetOsSeparator());
+ return VAbstractApplication::VApp()->TrVars()
+ ->TryFormulaFromUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
diff --git a/src/libs/vtools/dialogs/tools/dialogcutsplinepath.cpp b/src/libs/vtools/dialogs/tools/dialogcutsplinepath.cpp
index f49581936..44e5c6175 100644
--- a/src/libs/vtools/dialogs/tools/dialogcutsplinepath.cpp
+++ b/src/libs/vtools/dialogs/tools/dialogcutsplinepath.cpp
@@ -72,7 +72,8 @@ DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, quint32 toolId,
ui->lineEditNamePoint->setClearButtonEnabled(true);
- ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
+ ui->lineEditNamePoint->setText(
+ VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
this->formulaBaseHeight = ui->plainTextEditFormula->height();
ui->plainTextEditFormula->installEventFilter(this);
@@ -132,7 +133,8 @@ void DialogCutSplinePath::SetPointName(const QString &value)
*/
void DialogCutSplinePath::SetFormula(const QString &value)
{
- formula = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
+ formula = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(value, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
// increase height if needed. TODO : see if I can get the max number of caracters in one line
// of this PlainTextEdit to change 80 to this value
if (formula.length() > 80)
@@ -266,7 +268,7 @@ void DialogCutSplinePath::FXLength()
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit length"));
dialog->SetFormula(GetFormula());
- dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
+ dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetFormula(dialog->GetFormula());
@@ -282,7 +284,7 @@ void DialogCutSplinePath::EvalFormula()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditFormula;
formulaData.labelResult = ui->labelResultCalculation;
- formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
+ formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
formulaData.checkZero = false;
Eval(formulaData, flagFormula);
@@ -301,7 +303,8 @@ void DialogCutSplinePath::ShowVisualization()
*/
QString DialogCutSplinePath::GetFormula() const
{
- return qApp->TrVars()->TryFormulaFromUser(formula, qApp->Settings()->GetOsSeparator());
+ return VAbstractApplication::VApp()->TrVars()
+ ->TryFormulaFromUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
diff --git a/src/libs/vtools/dialogs/tools/dialogellipticalarc.cpp b/src/libs/vtools/dialogs/tools/dialogellipticalarc.cpp
index 9ec1af735..db69a46d0 100644
--- a/src/libs/vtools/dialogs/tools/dialogellipticalarc.cpp
+++ b/src/libs/vtools/dialogs/tools/dialogellipticalarc.cpp
@@ -198,7 +198,8 @@ void DialogEllipticalArc::SetCenter(const quint32 &value)
*/
QString DialogEllipticalArc::GetRadius1() const
{
- return qApp->TrVars()->TryFormulaFromUser(radius1, qApp->Settings()->GetOsSeparator());
+ return VAbstractApplication::VApp()->TrVars()
+ ->TryFormulaFromUser(radius1, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
@@ -208,7 +209,8 @@ QString DialogEllipticalArc::GetRadius1() const
*/
void DialogEllipticalArc::SetRadius1(const QString &value)
{
- radius1 = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
+ radius1 = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(value, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
// increase height if needed.
if (radius1.length() > 80)
{
@@ -230,7 +232,8 @@ void DialogEllipticalArc::SetRadius1(const QString &value)
*/
QString DialogEllipticalArc::GetRadius2() const
{
- return qApp->TrVars()->TryFormulaFromUser(radius2, qApp->Settings()->GetOsSeparator());
+ return VAbstractApplication::VApp()->TrVars()
+ ->TryFormulaFromUser(radius2, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
@@ -240,7 +243,8 @@ QString DialogEllipticalArc::GetRadius2() const
*/
void DialogEllipticalArc::SetRadius2(const QString &value)
{
- radius2 = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
+ radius2 = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(value, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
// increase height if needed.
if (radius2.length() > 80)
{
@@ -262,7 +266,8 @@ void DialogEllipticalArc::SetRadius2(const QString &value)
*/
QString DialogEllipticalArc::GetF1() const
{
- return qApp->TrVars()->TryFormulaFromUser(f1, qApp->Settings()->GetOsSeparator());
+ return VAbstractApplication::VApp()->TrVars()
+ ->TryFormulaFromUser(f1, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
@@ -272,7 +277,8 @@ QString DialogEllipticalArc::GetF1() const
*/
void DialogEllipticalArc::SetF1(const QString &value)
{
- f1 = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
+ f1 = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(value, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
// increase height if needed.
if (f1.length() > 80)
{
@@ -294,7 +300,8 @@ void DialogEllipticalArc::SetF1(const QString &value)
*/
QString DialogEllipticalArc::GetF2() const
{
- return qApp->TrVars()->TryFormulaFromUser(f2, qApp->Settings()->GetOsSeparator());
+ return VAbstractApplication::VApp()->TrVars()
+ ->TryFormulaFromUser(f2, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
@@ -304,7 +311,8 @@ QString DialogEllipticalArc::GetF2() const
*/
void DialogEllipticalArc::SetF2(const QString &value)
{
- f2 = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
+ f2 = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(value, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
// increase height if needed.
if (f2.length() > 80)
{
@@ -326,7 +334,8 @@ void DialogEllipticalArc::SetF2(const QString &value)
*/
QString DialogEllipticalArc::GetRotationAngle() const
{
- return qApp->TrVars()->TryFormulaFromUser(rotationAngle, qApp->Settings()->GetOsSeparator());
+ return VAbstractApplication::VApp()->TrVars()
+ ->TryFormulaFromUser(rotationAngle, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
@@ -336,7 +345,8 @@ QString DialogEllipticalArc::GetRotationAngle() const
*/
void DialogEllipticalArc::SetRotationAngle(const QString &value)
{
- rotationAngle = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
+ rotationAngle = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(value, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
// increase height if needed.
if (rotationAngle.length() > 80)
{
@@ -394,7 +404,7 @@ void DialogEllipticalArc::EvalRadiuses()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditRadius1;
formulaData.labelResult = ui->labelResultRadius1;
- formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
+ formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
formulaData.checkLessThanZero = true;
Eval(formulaData, flagRadius1);
@@ -441,7 +451,7 @@ void DialogEllipticalArc::FXRadius1()
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit radius1"));
dialog->SetFormula(GetRadius1());
- dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
+ dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetRadius1(dialog->GetFormula());
@@ -455,7 +465,7 @@ void DialogEllipticalArc::FXRadius2()
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit radius2"));
dialog->SetFormula(GetRadius2());
- dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
+ dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetRadius2(dialog->GetFormula());
diff --git a/src/libs/vtools/dialogs/tools/dialogendline.cpp b/src/libs/vtools/dialogs/tools/dialogendline.cpp
index f500fcbb6..9e0c0aead 100644
--- a/src/libs/vtools/dialogs/tools/dialogendline.cpp
+++ b/src/libs/vtools/dialogs/tools/dialogendline.cpp
@@ -83,7 +83,8 @@ DialogEndLine::DialogEndLine(const VContainer *data, quint32 toolId, QWidget *pa
ui->lineEditNamePoint->setClearButtonEnabled(true);
- ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
+ ui->lineEditNamePoint->setText(
+ VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
this->formulaBaseHeight = ui->plainTextEditFormula->height();
this->formulaBaseHeightAngle = ui->plainTextEditAngle->height();
@@ -153,7 +154,7 @@ void DialogEndLine::EvalLength()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditFormula;
formulaData.labelResult = ui->labelResultCalculation;
- formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
+ formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
formulaData.checkLessThanZero = false;
Eval(formulaData, flagFormula);
@@ -191,7 +192,7 @@ void DialogEndLine::FXLength()
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit length"));
dialog->SetFormula(GetFormula());
- dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
+ dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetFormula(dialog->GetFormula());
@@ -214,7 +215,8 @@ void DialogEndLine::ChosenObject(quint32 id, const SceneObject &type)
if (SetObject(id, ui->comboBoxBasePoint, QString()))
{
vis->VisualMode(id);
- VAbstractMainWindow *window = qobject_cast(qApp->getMainWindow());
+ VAbstractMainWindow *window =
+ qobject_cast(VAbstractValApplication::VApp()->getMainWindow());
SCASSERT(window != nullptr)
connect(vis.data(), &Visualization::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
prepare = true;
@@ -252,7 +254,8 @@ void DialogEndLine::SetTypeLine(const QString &value)
*/
void DialogEndLine::SetFormula(const QString &value)
{
- formulaLength = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
+ formulaLength = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(value, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
// increase height if needed. TODO : see if I can get the max number of caracters in one line
// of this PlainTextEdit to change 80 to this value
if (formulaLength.length() > 80)
@@ -275,7 +278,8 @@ void DialogEndLine::SetFormula(const QString &value)
*/
void DialogEndLine::SetAngle(const QString &value)
{
- formulaAngle = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
+ formulaAngle = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(value, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
// increase height if needed. TODO : see if I can get the max number of caracters in one line
// of this PlainTextEdit to change 80 to this value
if (formulaAngle.length() > 80)
@@ -337,13 +341,14 @@ void DialogEndLine::ShowDialog(bool click)
}
/*We will ignore click if pointer is in point circle*/
- VMainGraphicsScene *scene = qobject_cast(qApp->getCurrentScene());
+ VMainGraphicsScene *scene =
+ qobject_cast(VAbstractValApplication::VApp()->getCurrentScene());
SCASSERT(scene != nullptr)
const QSharedPointer point = data->GeometricObject(GetBasePointId());
QLineF line = QLineF(static_cast(*point), scene->getScenePos());
//Radius of point circle, but little bigger. Need handle with hover sizes.
- if (line.length() <= ScaledRadius(SceneScale(qApp->getCurrentScene()))*1.5)
+ if (line.length() <= ScaledRadius(SceneScale(VAbstractValApplication::VApp()->getCurrentScene()))*1.5)
{
return;
}
@@ -421,7 +426,8 @@ QString DialogEndLine::GetTypeLine() const
*/
QString DialogEndLine::GetFormula() const
{
- return qApp->TrVars()->TryFormulaFromUser(formulaLength, qApp->Settings()->GetOsSeparator());
+ return VAbstractApplication::VApp()->TrVars()
+ ->TryFormulaFromUser(formulaLength, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
@@ -431,7 +437,8 @@ QString DialogEndLine::GetFormula() const
*/
QString DialogEndLine::GetAngle() const
{
- return qApp->TrVars()->TryFormulaFromUser(formulaAngle, qApp->Settings()->GetOsSeparator());
+ return VAbstractApplication::VApp()->TrVars()
+ ->TryFormulaFromUser(formulaAngle, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
diff --git a/src/libs/vtools/dialogs/tools/dialogflippingbyaxis.cpp b/src/libs/vtools/dialogs/tools/dialogflippingbyaxis.cpp
index 673ce7bd0..ec964f84a 100644
--- a/src/libs/vtools/dialogs/tools/dialogflippingbyaxis.cpp
+++ b/src/libs/vtools/dialogs/tools/dialogflippingbyaxis.cpp
@@ -73,7 +73,7 @@ DialogFlippingByAxis::DialogFlippingByAxis(const VContainer *data, quint32 toolI
{
ui->setupUi(this);
- ui->lineEditSuffix->setText(qApp->getCurrentDocument()->GenerateSuffix());
+ ui->lineEditSuffix->setText(VAbstractValApplication::VApp()->getCurrentDocument()->GenerateSuffix());
InitOkCancelApply(ui);
@@ -212,7 +212,8 @@ void DialogFlippingByAxis::ShowDialog(bool click)
stage1 = false;
- VMainGraphicsScene *scene = qobject_cast(qApp->getCurrentScene());
+ VMainGraphicsScene *scene =
+ qobject_cast(VAbstractValApplication::VApp()->getCurrentScene());
SCASSERT(scene != nullptr)
scene->clearSelection();
@@ -231,7 +232,7 @@ void DialogFlippingByAxis::ShowDialog(bool click)
scene->ToggleSplineHover(false);
scene->ToggleSplinePathHover(false);
- qApp->getSceneView()->AllowRubberBand(false);
+ VAbstractValApplication::VApp()->getSceneView()->AllowRubberBand(false);
FillSourceList();
diff --git a/src/libs/vtools/dialogs/tools/dialogflippingbyline.cpp b/src/libs/vtools/dialogs/tools/dialogflippingbyline.cpp
index 582794b4e..ded7d90ca 100644
--- a/src/libs/vtools/dialogs/tools/dialogflippingbyline.cpp
+++ b/src/libs/vtools/dialogs/tools/dialogflippingbyline.cpp
@@ -73,7 +73,7 @@ DialogFlippingByLine::DialogFlippingByLine(const VContainer *data, quint32 toolI
{
ui->setupUi(this);
- ui->lineEditSuffix->setText(qApp->getCurrentDocument()->GenerateSuffix());
+ ui->lineEditSuffix->setText(VAbstractValApplication::VApp()->getCurrentDocument()->GenerateSuffix());
InitOkCancelApply(ui);
@@ -206,7 +206,8 @@ void DialogFlippingByLine::ShowDialog(bool click)
stage1 = false;
- VMainGraphicsScene *scene = qobject_cast(qApp->getCurrentScene());
+ VMainGraphicsScene *scene =
+ qobject_cast(VAbstractValApplication::VApp()->getCurrentScene());
SCASSERT(scene != nullptr)
scene->clearSelection();
@@ -225,7 +226,7 @@ void DialogFlippingByLine::ShowDialog(bool click)
scene->ToggleSplineHover(false);
scene->ToggleSplinePathHover(false);
- qApp->getSceneView()->AllowRubberBand(false);
+ VAbstractValApplication::VApp()->getSceneView()->AllowRubberBand(false);
FillSourceList();
diff --git a/src/libs/vtools/dialogs/tools/dialogheight.cpp b/src/libs/vtools/dialogs/tools/dialogheight.cpp
index de5fca452..6bff683ee 100644
--- a/src/libs/vtools/dialogs/tools/dialogheight.cpp
+++ b/src/libs/vtools/dialogs/tools/dialogheight.cpp
@@ -68,7 +68,8 @@ DialogHeight::DialogHeight(const VContainer *data, quint32 toolId, QWidget *pare
ui->lineEditNamePoint->setClearButtonEnabled(true);
- ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
+ ui->lineEditNamePoint->setText(
+ VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
InitOkCancelApply(ui);
FillComboBoxPoints(ui->comboBoxBasePoint);
diff --git a/src/libs/vtools/dialogs/tools/dialoglineintersect.cpp b/src/libs/vtools/dialogs/tools/dialoglineintersect.cpp
index 39cfb0750..0bacd1820 100644
--- a/src/libs/vtools/dialogs/tools/dialoglineintersect.cpp
+++ b/src/libs/vtools/dialogs/tools/dialoglineintersect.cpp
@@ -71,7 +71,8 @@ DialogLineIntersect::DialogLineIntersect(const VContainer *data, quint32 toolId,
number = 0;
InitOkCancelApply(ui);
- ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
+ ui->lineEditNamePoint->setText(
+ VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
FillComboBoxPoints(ui->comboBoxP1Line1);
FillComboBoxPoints(ui->comboBoxP2Line1);
diff --git a/src/libs/vtools/dialogs/tools/dialoglineintersectaxis.cpp b/src/libs/vtools/dialogs/tools/dialoglineintersectaxis.cpp
index d5c6593e6..891f9e1d9 100644
--- a/src/libs/vtools/dialogs/tools/dialoglineintersectaxis.cpp
+++ b/src/libs/vtools/dialogs/tools/dialoglineintersectaxis.cpp
@@ -77,7 +77,8 @@ DialogLineIntersectAxis::DialogLineIntersectAxis(const VContainer *data, quint32
ui->lineEditNamePoint->setClearButtonEnabled(true);
- ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
+ ui->lineEditNamePoint->setText(
+ VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
this->formulaBaseHeightAngle = ui->plainTextEditFormula->height();
ui->plainTextEditFormula->installEventFilter(this);
@@ -149,13 +150,15 @@ void DialogLineIntersectAxis::SetTypeLine(const QString &value)
//---------------------------------------------------------------------------------------------------------------------
QString DialogLineIntersectAxis::GetAngle() const
{
- return qApp->TrVars()->TryFormulaFromUser(formulaAngle, qApp->Settings()->GetOsSeparator());
+ return VAbstractApplication::VApp()->TrVars()
+ ->TryFormulaFromUser(formulaAngle, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLineIntersectAxis::SetAngle(const QString &value)
{
- formulaAngle = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
+ formulaAngle = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(value, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
// increase height if needed. TODO : see if I can get the max number of caracters in one line
// of this PlainTextEdit to change 80 to this value
if (formulaAngle.length() > 80)
@@ -247,13 +250,14 @@ void DialogLineIntersectAxis::ShowDialog(bool click)
}
/*We will ignore click if poinet is in point circle*/
- VMainGraphicsScene *scene = qobject_cast(qApp->getCurrentScene());
+ VMainGraphicsScene *scene =
+ qobject_cast(VAbstractValApplication::VApp()->getCurrentScene());
SCASSERT(scene != nullptr)
const QSharedPointer point = data->GeometricObject(GetBasePointId());
QLineF line = QLineF(static_cast(*point), scene->getScenePos());
//Radius of point circle, but little bigger. Need handle with hover sizes.
- if (line.length() <= ScaledRadius(SceneScale(qApp->getCurrentScene()))*1.5)
+ if (line.length() <= ScaledRadius(SceneScale(VAbstractValApplication::VApp()->getCurrentScene()))*1.5)
{
return;
}
@@ -286,7 +290,8 @@ void DialogLineIntersectAxis::ChosenObject(quint32 id, const SceneObject &type)
{
number++;
line->VisualMode(id);
- VAbstractMainWindow *window = qobject_cast(qApp->getMainWindow());
+ VAbstractMainWindow *window =
+ qobject_cast(VAbstractValApplication::VApp()->getMainWindow());
SCASSERT(window != nullptr)
connect(line, &VisToolLineIntersectAxis::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
}
diff --git a/src/libs/vtools/dialogs/tools/dialogmove.cpp b/src/libs/vtools/dialogs/tools/dialogmove.cpp
index fe2f207d3..03319be48 100644
--- a/src/libs/vtools/dialogs/tools/dialogmove.cpp
+++ b/src/libs/vtools/dialogs/tools/dialogmove.cpp
@@ -100,7 +100,7 @@ DialogMove::DialogMove(const VContainer *data, quint32 toolId, QWidget *parent)
this->formulaBaseHeightLength = ui->plainTextEditLength->height();
ui->plainTextEditLength->installEventFilter(this);
- ui->lineEditSuffix->setText(qApp->getCurrentDocument()->GenerateSuffix());
+ ui->lineEditSuffix->setText(VAbstractValApplication::VApp()->getCurrentDocument()->GenerateSuffix());
timerAngle->setSingleShot(true);
connect(timerAngle, &QTimer::timeout, this, &DialogMove::EvalAngle);
@@ -168,13 +168,15 @@ DialogMove::~DialogMove()
//---------------------------------------------------------------------------------------------------------------------
QString DialogMove::GetAngle() const
{
- return qApp->TrVars()->TryFormulaFromUser(formulaAngle, qApp->Settings()->GetOsSeparator());
+ return VAbstractApplication::VApp()->TrVars()
+ ->TryFormulaFromUser(formulaAngle, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
void DialogMove::SetAngle(const QString &value)
{
- formulaAngle = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
+ formulaAngle = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(value, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
// increase height if needed.
if (formulaAngle.length() > 80)
{
@@ -192,13 +194,15 @@ void DialogMove::SetAngle(const QString &value)
//---------------------------------------------------------------------------------------------------------------------
QString DialogMove::GetLength() const
{
- return qApp->TrVars()->TryFormulaFromUser(formulaLength, qApp->Settings()->GetOsSeparator());
+ return VAbstractApplication::VApp()->TrVars()
+ ->TryFormulaFromUser(formulaLength, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
void DialogMove::SetLength(const QString &value)
{
- formulaLength = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
+ formulaLength = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(value, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
// increase height if needed.
if (formulaLength.length() > 80)
{
@@ -216,13 +220,15 @@ void DialogMove::SetLength(const QString &value)
//---------------------------------------------------------------------------------------------------------------------
QString DialogMove::GetRotationAngle() const
{
- return qApp->TrVars()->TryFormulaFromUser(formulaRotationAngle, qApp->Settings()->GetOsSeparator());
+ return VAbstractApplication::VApp()->TrVars()
+ ->TryFormulaFromUser(formulaRotationAngle, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
void DialogMove::SetRotationAngle(const QString &value)
{
- formulaRotationAngle = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
+ formulaRotationAngle = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(value, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
// increase height if needed.
if (formulaRotationAngle.length() > 80)
{
@@ -321,7 +327,8 @@ void DialogMove::ShowDialog(bool click)
stage1 = false;
prepare = true;
- VMainGraphicsScene *scene = qobject_cast(qApp->getCurrentScene());
+ VMainGraphicsScene *scene =
+ qobject_cast(VAbstractValApplication::VApp()->getCurrentScene());
SCASSERT(scene != nullptr)
scene->clearSelection();
@@ -330,7 +337,8 @@ void DialogMove::ShowDialog(bool click)
operation->SetObjects(SourceToObjects(sourceObjects));
operation->VisualMode();
- VAbstractMainWindow *window = qobject_cast(qApp->getMainWindow());
+ VAbstractMainWindow *window =
+ qobject_cast(VAbstractValApplication::VApp()->getMainWindow());
SCASSERT(window != nullptr)
connect(operation, &VisToolMove::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
@@ -344,7 +352,7 @@ void DialogMove::ShowDialog(bool click)
scene->ToggleSplineHover(false);
scene->ToggleSplinePathHover(false);
- qApp->getSceneView()->AllowRubberBand(false);
+ VAbstractValApplication::VApp()->getSceneView()->AllowRubberBand(false);
FillSourceList();
}
@@ -355,8 +363,10 @@ void DialogMove::ShowDialog(bool click)
if (operation->LengthValue() > 0)
{
- formulaAngle = qApp->TrVars()->FormulaToUser(operation->Angle(), qApp->Settings()->GetOsSeparator());
- formulaLength = qApp->TrVars()->FormulaToUser(operation->Length(), qApp->Settings()->GetOsSeparator());
+ formulaAngle = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(operation->Angle(), VAbstractApplication::VApp()->Settings()->GetOsSeparator());
+ formulaLength = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(operation->Length(), VAbstractApplication::VApp()->Settings()->GetOsSeparator());
operation->SetAngle(formulaAngle);
operation->SetLength(formulaLength);
operation->RefreshGeometry();
@@ -381,8 +391,10 @@ void DialogMove::ShowDialog(bool click)
}
else
{
- SetAngle(qApp->TrVars()->FormulaFromUser(formulaAngle, qApp->Settings()->GetOsSeparator()));
- SetLength(qApp->TrVars()->FormulaFromUser(formulaLength, qApp->Settings()->GetOsSeparator()));
+ SetAngle(VAbstractApplication::VApp()->TrVars()
+ ->FormulaFromUser(formulaAngle, VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
+ SetLength(VAbstractApplication::VApp()->TrVars()
+ ->FormulaFromUser(formulaLength, VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
SetRotationAngle(operation->RotationAngle());
setModal(true);
emit ToolTip(QString());
@@ -493,7 +505,7 @@ void DialogMove::FXLength()
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit length"));
dialog->SetFormula(GetLength());
- dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
+ dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetLength(dialog->GetFormula());
@@ -819,7 +831,7 @@ void DialogMove::EvalLength()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditLength;
formulaData.labelResult = ui->labelResultLength;
- formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
+ formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
Eval(formulaData, flagLength);
diff --git a/src/libs/vtools/dialogs/tools/dialognormal.cpp b/src/libs/vtools/dialogs/tools/dialognormal.cpp
index 0e58b189d..6732727ed 100644
--- a/src/libs/vtools/dialogs/tools/dialognormal.cpp
+++ b/src/libs/vtools/dialogs/tools/dialognormal.cpp
@@ -76,7 +76,8 @@ DialogNormal::DialogNormal(const VContainer *data, quint32 toolId, QWidget *pare
ui->lineEditNamePoint->setClearButtonEnabled(true);
- ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
+ ui->lineEditNamePoint->setText(
+ VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
this->formulaBaseHeight = ui->plainTextEditFormula->height();
ui->plainTextEditFormula->installEventFilter(this);
@@ -144,7 +145,7 @@ void DialogNormal::FXLength()
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit length"));
dialog->SetFormula(GetFormula());
- dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
+ dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetFormula(dialog->GetFormula());
@@ -160,7 +161,7 @@ void DialogNormal::EvalFormula()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditFormula;
formulaData.labelResult = ui->labelResultCalculation;
- formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
+ formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
Eval(formulaData, flagFormula);
}
@@ -320,7 +321,8 @@ void DialogNormal::SetAngle(qreal value)
*/
void DialogNormal::SetFormula(const QString &value)
{
- formula = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
+ formula = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(value, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
// increase height if needed.
if (formula.length() > 80)
{
@@ -374,7 +376,8 @@ QString DialogNormal::GetTypeLine() const
*/
QString DialogNormal::GetFormula() const
{
- return qApp->TrVars()->TryFormulaFromUser(formula, qApp->Settings()->GetOsSeparator());
+ return VAbstractApplication::VApp()->TrVars()
+ ->TryFormulaFromUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
diff --git a/src/libs/vtools/dialogs/tools/dialogpointfromarcandtangent.cpp b/src/libs/vtools/dialogs/tools/dialogpointfromarcandtangent.cpp
index 40688c97f..b0e5dcc18 100644
--- a/src/libs/vtools/dialogs/tools/dialogpointfromarcandtangent.cpp
+++ b/src/libs/vtools/dialogs/tools/dialogpointfromarcandtangent.cpp
@@ -49,7 +49,8 @@ DialogPointFromArcAndTangent::DialogPointFromArcAndTangent(const VContainer *dat
ui->lineEditNamePoint->setClearButtonEnabled(true);
- ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
+ ui->lineEditNamePoint->setText(
+ VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
InitOkCancelApply(ui);
diff --git a/src/libs/vtools/dialogs/tools/dialogpointfromcircleandtangent.cpp b/src/libs/vtools/dialogs/tools/dialogpointfromcircleandtangent.cpp
index ea86e1709..17ab3bd06 100644
--- a/src/libs/vtools/dialogs/tools/dialogpointfromcircleandtangent.cpp
+++ b/src/libs/vtools/dialogs/tools/dialogpointfromcircleandtangent.cpp
@@ -68,7 +68,8 @@ DialogPointFromCircleAndTangent::DialogPointFromCircleAndTangent(const VContaine
ui->lineEditNamePoint->setClearButtonEnabled(true);
- ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
+ ui->lineEditNamePoint->setText(
+ VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
this->formulaBaseHeightCircleRadius = ui->plainTextEditRadius->height();
@@ -146,14 +147,16 @@ void DialogPointFromCircleAndTangent::SetCircleCenterId(const quint32 &value)
//---------------------------------------------------------------------------------------------------------------------
QString DialogPointFromCircleAndTangent::GetCircleRadius() const
{
- return qApp->TrVars()->TryFormulaFromUser(ui->plainTextEditRadius->toPlainText(),
- qApp->Settings()->GetOsSeparator());
+ return VAbstractApplication::VApp()->TrVars()
+ ->TryFormulaFromUser(ui->plainTextEditRadius->toPlainText(),
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
void DialogPointFromCircleAndTangent::SetCircleRadius(const QString &value)
{
- const QString formula = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
+ const QString formula = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(value, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
// increase height if needed.
if (formula.length() > 80)
{
@@ -275,7 +278,7 @@ void DialogPointFromCircleAndTangent::FXCircleRadius()
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit radius"));
dialog->SetFormula(GetCircleRadius());
- dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
+ dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetCircleRadius(dialog->GetFormula());
@@ -291,7 +294,7 @@ void DialogPointFromCircleAndTangent::EvalCircleRadius()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditRadius;
formulaData.labelResult = ui->labelResultCircleRadius;
- formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
+ formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
const qreal radius = Eval(formulaData, flagCircleRadius);
diff --git a/src/libs/vtools/dialogs/tools/dialogpointofcontact.cpp b/src/libs/vtools/dialogs/tools/dialogpointofcontact.cpp
index 697708617..b9404cb86 100644
--- a/src/libs/vtools/dialogs/tools/dialogpointofcontact.cpp
+++ b/src/libs/vtools/dialogs/tools/dialogpointofcontact.cpp
@@ -75,7 +75,8 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, quint32 toolI
ui->lineEditNamePoint->setClearButtonEnabled(true);
- ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
+ ui->lineEditNamePoint->setText(
+ VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
this->formulaBaseHeight = ui->plainTextEditFormula->height();
ui->plainTextEditFormula->installEventFilter(this);
@@ -152,7 +153,7 @@ void DialogPointOfContact::FXRadius()
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit radius"));
dialog->SetFormula(getRadius());
- dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
+ dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
setRadius(dialog->GetFormula());
@@ -168,7 +169,7 @@ void DialogPointOfContact::EvalFormula()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditFormula;
formulaData.labelResult = ui->labelResultCalculation;
- formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
+ formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
Eval(formulaData, flagFormula);
}
@@ -319,7 +320,8 @@ void DialogPointOfContact::setCenter(quint32 value)
*/
void DialogPointOfContact::setRadius(const QString &value)
{
- radius = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
+ radius = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(value, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
// increase height if needed.
if (radius.length() > 80)
{
@@ -352,7 +354,8 @@ void DialogPointOfContact::SetPointName(const QString &value)
*/
QString DialogPointOfContact::getRadius() const
{
- return qApp->TrVars()->TryFormulaFromUser(radius, qApp->Settings()->GetOsSeparator());
+ return VAbstractApplication::VApp()->TrVars()
+ ->TryFormulaFromUser(radius, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
diff --git a/src/libs/vtools/dialogs/tools/dialogpointofintersection.cpp b/src/libs/vtools/dialogs/tools/dialogpointofintersection.cpp
index 4a44fcef3..80de3dee9 100644
--- a/src/libs/vtools/dialogs/tools/dialogpointofintersection.cpp
+++ b/src/libs/vtools/dialogs/tools/dialogpointofintersection.cpp
@@ -59,7 +59,8 @@ DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, qui
ui->lineEditNamePoint->setClearButtonEnabled(true);
- ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
+ ui->lineEditNamePoint->setText(
+ VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
InitOkCancelApply(ui);
diff --git a/src/libs/vtools/dialogs/tools/dialogpointofintersectionarcs.cpp b/src/libs/vtools/dialogs/tools/dialogpointofintersectionarcs.cpp
index ff52a4d5f..888e2e8ad 100644
--- a/src/libs/vtools/dialogs/tools/dialogpointofintersectionarcs.cpp
+++ b/src/libs/vtools/dialogs/tools/dialogpointofintersectionarcs.cpp
@@ -52,7 +52,8 @@ DialogPointOfIntersectionArcs::DialogPointOfIntersectionArcs(const VContainer *d
ui->lineEditNamePoint->setClearButtonEnabled(true);
- ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
+ ui->lineEditNamePoint->setText(
+ VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
InitOkCancelApply(ui);
diff --git a/src/libs/vtools/dialogs/tools/dialogpointofintersectioncircles.cpp b/src/libs/vtools/dialogs/tools/dialogpointofintersectioncircles.cpp
index 494962b78..961d847da 100644
--- a/src/libs/vtools/dialogs/tools/dialogpointofintersectioncircles.cpp
+++ b/src/libs/vtools/dialogs/tools/dialogpointofintersectioncircles.cpp
@@ -72,7 +72,8 @@ DialogPointOfIntersectionCircles::DialogPointOfIntersectionCircles(const VContai
ui->lineEditNamePoint->setClearButtonEnabled(true);
- ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
+ ui->lineEditNamePoint->setText(
+ VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
this->formulaBaseHeightCircle1Radius = ui->plainTextEditCircle1Radius->height();
this->formulaBaseHeightCircle2Radius = ui->plainTextEditCircle2Radius->height();
@@ -182,14 +183,16 @@ void DialogPointOfIntersectionCircles::SetSecondCircleCenterId(const quint32 &va
//---------------------------------------------------------------------------------------------------------------------
QString DialogPointOfIntersectionCircles::GetFirstCircleRadius() const
{
- return qApp->TrVars()->TryFormulaFromUser(ui->plainTextEditCircle1Radius->toPlainText(),
- qApp->Settings()->GetOsSeparator());
+ return VAbstractApplication::VApp()->TrVars()
+ ->TryFormulaFromUser(ui->plainTextEditCircle1Radius->toPlainText(),
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
void DialogPointOfIntersectionCircles::SetFirstCircleRadius(const QString &value)
{
- const QString formula = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
+ const QString formula = VAbstractValApplication::VApp()->TrVars()
+ ->FormulaToUser(value, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
// increase height if needed.
if (formula.length() > 80)
{
@@ -207,14 +210,16 @@ void DialogPointOfIntersectionCircles::SetFirstCircleRadius(const QString &value
//---------------------------------------------------------------------------------------------------------------------
QString DialogPointOfIntersectionCircles::GetSecondCircleRadius() const
{
- return qApp->TrVars()->TryFormulaFromUser(ui->plainTextEditCircle2Radius->toPlainText(),
- qApp->Settings()->GetOsSeparator());
+ return VAbstractApplication::VApp()->TrVars()
+ ->TryFormulaFromUser(ui->plainTextEditCircle2Radius->toPlainText(),
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
void DialogPointOfIntersectionCircles::SetSecondCircleRadius(const QString &value)
{
- const QString formula = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
+ const QString formula = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(value, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
// increase height if needed.
if (formula.length() > 80)
{
@@ -326,7 +331,7 @@ void DialogPointOfIntersectionCircles::FXCircle1Radius()
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit first circle radius"));
dialog->SetFormula(GetFirstCircleRadius());
- dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
+ dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetFirstCircleRadius(dialog->GetFormula());
@@ -340,7 +345,7 @@ void DialogPointOfIntersectionCircles::FXCircle2Radius()
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit second circle radius"));
dialog->SetFormula(GetSecondCircleRadius());
- dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
+ dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetSecondCircleRadius(dialog->GetFormula());
@@ -356,7 +361,7 @@ void DialogPointOfIntersectionCircles::EvalCircle1Radius()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditCircle1Radius;
formulaData.labelResult = ui->labelResultCircle1Radius;
- formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
+ formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
const qreal radius = Eval(formulaData, flagCircle1Radius);
@@ -379,7 +384,7 @@ void DialogPointOfIntersectionCircles::EvalCircle2Radius()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditCircle2Radius;
formulaData.labelResult = ui->labelResultCircle2Radius;
- formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
+ formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
const qreal radius = Eval(formulaData, flagCircle2Radius);
diff --git a/src/libs/vtools/dialogs/tools/dialogpointofintersectioncurves.cpp b/src/libs/vtools/dialogs/tools/dialogpointofintersectioncurves.cpp
index c82a21d75..653aa4bd0 100644
--- a/src/libs/vtools/dialogs/tools/dialogpointofintersectioncurves.cpp
+++ b/src/libs/vtools/dialogs/tools/dialogpointofintersectioncurves.cpp
@@ -54,7 +54,7 @@ DialogPointOfIntersectionCurves::DialogPointOfIntersectionCurves(const VContaine
ui->lineEditNamePoint->setClearButtonEnabled(true);
- ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
+ ui->lineEditNamePoint->setText(VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
InitOkCancelApply(ui);
diff --git a/src/libs/vtools/dialogs/tools/dialogrotation.cpp b/src/libs/vtools/dialogs/tools/dialogrotation.cpp
index 283765a87..647b466e5 100644
--- a/src/libs/vtools/dialogs/tools/dialogrotation.cpp
+++ b/src/libs/vtools/dialogs/tools/dialogrotation.cpp
@@ -86,7 +86,7 @@ DialogRotation::DialogRotation(const VContainer *data, quint32 toolId, QWidget *
this->formulaBaseHeightAngle = ui->plainTextEditFormula->height();
ui->plainTextEditFormula->installEventFilter(this);
- ui->lineEditSuffix->setText(qApp->getCurrentDocument()->GenerateSuffix());
+ ui->lineEditSuffix->setText(VAbstractValApplication::VApp()->getCurrentDocument()->GenerateSuffix());
timerAngle->setSingleShot(true);
connect(timerAngle, &QTimer::timeout, this, &DialogRotation::EvalAngle);
@@ -145,13 +145,15 @@ void DialogRotation::SetOrigPointId(quint32 value)
//---------------------------------------------------------------------------------------------------------------------
QString DialogRotation::GetAngle() const
{
- return qApp->TrVars()->TryFormulaFromUser(formulaAngle, qApp->Settings()->GetOsSeparator());
+ return VAbstractApplication::VApp()->TrVars()
+ ->TryFormulaFromUser(formulaAngle, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
void DialogRotation::SetAngle(const QString &value)
{
- formulaAngle = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
+ formulaAngle = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(value, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
// increase height if needed.
if (formulaAngle.length() > 80)
{
@@ -234,7 +236,8 @@ void DialogRotation::ShowDialog(bool click)
stage1 = false;
- VMainGraphicsScene *scene = qobject_cast(qApp->getCurrentScene());
+ VMainGraphicsScene *scene =
+ qobject_cast(VAbstractValApplication::VApp()->getCurrentScene());
SCASSERT(scene != nullptr)
scene->clearSelection();
@@ -253,7 +256,7 @@ void DialogRotation::ShowDialog(bool click)
scene->ToggleSplineHover(false);
scene->ToggleSplinePathHover(false);
- qApp->getSceneView()->AllowRubberBand(false);
+ VAbstractValApplication::VApp()->getSceneView()->AllowRubberBand(false);
FillSourceList();
@@ -270,7 +273,8 @@ void DialogRotation::ShowDialog(bool click)
}
/*We will ignore click if pointer is in point circle*/
- VMainGraphicsScene *scene = qobject_cast(qApp->getCurrentScene());
+ VMainGraphicsScene *scene =
+ qobject_cast(VAbstractValApplication::VApp()->getCurrentScene());
SCASSERT(scene != nullptr)
try
{
@@ -278,7 +282,7 @@ void DialogRotation::ShowDialog(bool click)
const QLineF line = QLineF(static_cast(*point), scene->getScenePos());
//Radius of point circle, but little bigger. Need handle with hover sizes.
- if (line.length() <= ScaledRadius(SceneScale(qApp->getCurrentScene()))*1.5)
+ if (line.length() <= ScaledRadius(SceneScale(VAbstractValApplication::VApp()->getCurrentScene()))*1.5)
{
return;
}
@@ -347,7 +351,8 @@ void DialogRotation::ChosenObject(quint32 id, const SceneObject &type)
if (SetObject(id, ui->comboBoxOriginPoint, QString()))
{
- VAbstractMainWindow *window = qobject_cast(qApp->getMainWindow());
+ VAbstractMainWindow *window =
+ qobject_cast(VAbstractValApplication::VApp()->getMainWindow());
SCASSERT(window != nullptr)
connect(operation, &Visualization::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
diff --git a/src/libs/vtools/dialogs/tools/dialogshoulderpoint.cpp b/src/libs/vtools/dialogs/tools/dialogshoulderpoint.cpp
index b57ed59e0..66a4558a3 100644
--- a/src/libs/vtools/dialogs/tools/dialogshoulderpoint.cpp
+++ b/src/libs/vtools/dialogs/tools/dialogshoulderpoint.cpp
@@ -75,7 +75,8 @@ DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, quint32 toolId,
ui->lineEditNamePoint->setClearButtonEnabled(true);
- ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
+ ui->lineEditNamePoint->setText(
+ VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
formulaBaseHeight = ui->plainTextEditFormula->height();
ui->plainTextEditFormula->installEventFilter(this);
@@ -142,7 +143,7 @@ void DialogShoulderPoint::FXLength()
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit length"));
dialog->SetFormula(GetFormula());
- dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
+ dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetFormula(dialog->GetFormula());
@@ -158,7 +159,7 @@ void DialogShoulderPoint::EvalFormula()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditFormula;
formulaData.labelResult = ui->labelResultCalculation;
- formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
+ formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
Eval(formulaData, flagFormula);
}
@@ -334,7 +335,8 @@ void DialogShoulderPoint::SetP1Line(const quint32 &value)
*/
void DialogShoulderPoint::SetFormula(const QString &value)
{
- formula = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
+ formula = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(value, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
// increase height if needed.
if (formula.length() > 80)
{
@@ -387,7 +389,8 @@ QString DialogShoulderPoint::GetTypeLine() const
*/
QString DialogShoulderPoint::GetFormula() const
{
- return qApp->TrVars()->TryFormulaFromUser(formula, qApp->Settings()->GetOsSeparator());
+ return VAbstractApplication::VApp()->TrVars()
+ ->TryFormulaFromUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
diff --git a/src/libs/vtools/dialogs/tools/dialogsinglepoint.cpp b/src/libs/vtools/dialogs/tools/dialogsinglepoint.cpp
index 7a6f11dd8..b9ec1ced9 100644
--- a/src/libs/vtools/dialogs/tools/dialogsinglepoint.cpp
+++ b/src/libs/vtools/dialogs/tools/dialogsinglepoint.cpp
@@ -53,8 +53,8 @@ DialogSinglePoint::DialogSinglePoint(const VContainer *data, quint32 toolId, QWi
ui->lineEditName->setClearButtonEnabled(true);
- ui->doubleSpinBoxX->setRange(0, qApp->fromPixel(SceneSize));
- ui->doubleSpinBoxY->setRange(0, qApp->fromPixel(SceneSize));
+ ui->doubleSpinBoxX->setRange(0, VAbstractValApplication::VApp()->fromPixel(SceneSize));
+ ui->doubleSpinBoxY->setRange(0, VAbstractValApplication::VApp()->fromPixel(SceneSize));
InitOkCancel(ui);
connect(ui->lineEditName, &QLineEdit::textChanged, this, [this]()
@@ -76,21 +76,22 @@ void DialogSinglePoint::mousePress(const QPointF &scenePos)
{
if (isInitialized == false)
{
- ui->doubleSpinBoxX->setValue(qApp->fromPixel(scenePos.x()));
- ui->doubleSpinBoxY->setValue(qApp->fromPixel(scenePos.y()));
+ ui->doubleSpinBoxX->setValue(VAbstractValApplication::VApp()->fromPixel(scenePos.x()));
+ ui->doubleSpinBoxY->setValue(VAbstractValApplication::VApp()->fromPixel(scenePos.y()));
this->show();
}
else
{
- ui->doubleSpinBoxX->setValue(qApp->fromPixel(scenePos.x()));
- ui->doubleSpinBoxY->setValue(qApp->fromPixel(scenePos.y()));
+ ui->doubleSpinBoxX->setValue(VAbstractValApplication::VApp()->fromPixel(scenePos.x()));
+ ui->doubleSpinBoxY->setValue(VAbstractValApplication::VApp()->fromPixel(scenePos.y()));
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSinglePoint::SaveData()
{
- point = QPointF(qApp->toPixel(ui->doubleSpinBoxX->value()), qApp->toPixel(ui->doubleSpinBoxY->value()));
+ point = QPointF(VAbstractValApplication::VApp()->toPixel(ui->doubleSpinBoxX->value()),
+ VAbstractValApplication::VApp()->toPixel(ui->doubleSpinBoxY->value()));
pointName = ui->lineEditName->text();
}
@@ -106,8 +107,8 @@ void DialogSinglePoint::SetData(const QString &name, const QPointF &point)
this->point = point;
isInitialized = true;
ui->lineEditName->setText(name);
- ui->doubleSpinBoxX->setValue(qApp->fromPixel(point.x()));
- ui->doubleSpinBoxY->setValue(qApp->fromPixel(point.y()));
+ ui->doubleSpinBoxX->setValue(VAbstractValApplication::VApp()->fromPixel(point.x()));
+ ui->doubleSpinBoxY->setValue(VAbstractValApplication::VApp()->fromPixel(point.y()));
}
//---------------------------------------------------------------------------------------------------------------------
diff --git a/src/libs/vtools/dialogs/tools/dialogspline.cpp b/src/libs/vtools/dialogs/tools/dialogspline.cpp
index a781a2bf6..5eb7274a5 100644
--- a/src/libs/vtools/dialogs/tools/dialogspline.cpp
+++ b/src/libs/vtools/dialogs/tools/dialogspline.cpp
@@ -155,7 +155,7 @@ DialogSpline::DialogSpline(const VContainer *data, quint32 toolId, QWidget *pare
auto path = qobject_cast(vis);
SCASSERT(path != nullptr)
- auto scene = qobject_cast(qApp->getCurrentScene());
+ auto scene = qobject_cast(VAbstractValApplication::VApp()->getCurrentScene());
SCASSERT(scene != nullptr)
connect(scene, &VMainGraphicsScene::MouseLeftPressed, path, &VisToolSpline::MouseLeftPressed);
connect(scene, &VMainGraphicsScene::MouseLeftReleased, path, &VisToolSpline::MouseLeftReleased);
@@ -278,13 +278,15 @@ void DialogSpline::FXAngle1()
{
auto* dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit first control point angle"));
- QString angle1F = qApp->TrVars()->TryFormulaFromUser(ui->plainTextEditAngle1F->toPlainText(),
- qApp->Settings()->GetOsSeparator());
+ QString angle1F = VAbstractApplication::VApp()->TrVars()
+ ->TryFormulaFromUser(ui->plainTextEditAngle1F->toPlainText(),
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator());
dialog->SetFormula(angle1F);
dialog->setPostfix(degreeSymbol);
if (dialog->exec() == QDialog::Accepted)
{
- angle1F = qApp->TrVars()->FormulaToUser(dialog->GetFormula(), qApp->Settings()->GetOsSeparator());
+ angle1F = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(dialog->GetFormula(), VAbstractApplication::VApp()->Settings()->GetOsSeparator());
// increase height if needed.
if (angle1F.length() > 80)
{
@@ -301,13 +303,15 @@ void DialogSpline::FXAngle2()
{
auto* dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit second control point angle"));
- QString angle2F = qApp->TrVars()->TryFormulaFromUser(ui->plainTextEditAngle2F->toPlainText(),
- qApp->Settings()->GetOsSeparator());
+ QString angle2F = VAbstractApplication::VApp()->TrVars()
+ ->TryFormulaFromUser(ui->plainTextEditAngle2F->toPlainText(),
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator());
dialog->SetFormula(angle2F);
dialog->setPostfix(degreeSymbol);
if (dialog->exec() == QDialog::Accepted)
{
- angle2F = qApp->TrVars()->FormulaToUser(dialog->GetFormula(), qApp->Settings()->GetOsSeparator());
+ angle2F = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(dialog->GetFormula(), VAbstractApplication::VApp()->Settings()->GetOsSeparator());
// increase height if needed.
if (angle2F.length() > 80)
{
@@ -324,13 +328,15 @@ void DialogSpline::FXLength1()
{
auto* dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit first control point length"));
- QString length1F = qApp->TrVars()->TryFormulaFromUser(ui->plainTextEditLength1F->toPlainText(),
- qApp->Settings()->GetOsSeparator());
+ QString length1F = VAbstractApplication::VApp()->TrVars()
+ ->TryFormulaFromUser(ui->plainTextEditLength1F->toPlainText(),
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator());
dialog->SetFormula(length1F);
- dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
+ dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
- length1F = qApp->TrVars()->FormulaToUser(dialog->GetFormula(), qApp->Settings()->GetOsSeparator());
+ length1F = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(dialog->GetFormula(), VAbstractApplication::VApp()->Settings()->GetOsSeparator());
// increase height if needed.
if (length1F.length() > 80)
{
@@ -347,13 +353,15 @@ void DialogSpline::FXLength2()
{
auto* dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit second control point length"));
- QString length2F = qApp->TrVars()->TryFormulaFromUser(ui->plainTextEditLength2F->toPlainText(),
- qApp->Settings()->GetOsSeparator());
+ QString length2F = VAbstractApplication::VApp()->TrVars()
+ ->TryFormulaFromUser(ui->plainTextEditLength2F->toPlainText(),
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator());
dialog->SetFormula(length2F);
- dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
+ dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
- length2F = qApp->TrVars()->FormulaToUser(dialog->GetFormula(), qApp->Settings()->GetOsSeparator());
+ length2F = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(dialog->GetFormula(), VAbstractApplication::VApp()->Settings()->GetOsSeparator());
// increase height if needed.
if (length2F.length() > 80)
{
@@ -413,7 +421,7 @@ void DialogSpline::EvalLength1()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditLength1;
formulaData.labelResult = ui->labelResultLength1;
- formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
+ formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
formulaData.checkZero = false;
formulaData.checkLessThanZero = true;
@@ -428,7 +436,7 @@ void DialogSpline::EvalLength2()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditLength2;
formulaData.labelResult = ui->labelResultLength2;
- formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
+ formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
formulaData.checkZero = false;
formulaData.checkLessThanZero = true;
@@ -474,12 +482,12 @@ VSpline DialogSpline::CurrentSpline() const
const qreal length1 = Visualization::FindLengthFromUser(length1F, vars);
const qreal length2 = Visualization::FindLengthFromUser(length2F, vars);
- const bool separator = qApp->Settings()->GetOsSeparator();
+ const bool separator = VAbstractApplication::VApp()->Settings()->GetOsSeparator();
- angle1F = qApp->TrVars()->TryFormulaFromUser(angle1F, separator);
- angle2F = qApp->TrVars()->TryFormulaFromUser(angle2F, separator);
- length1F = qApp->TrVars()->TryFormulaFromUser(length1F, separator);
- length2F = qApp->TrVars()->TryFormulaFromUser(length2F, separator);
+ angle1F = VAbstractApplication::VApp()->TrVars()->TryFormulaFromUser(angle1F, separator);
+ angle2F = VAbstractApplication::VApp()->TrVars()->TryFormulaFromUser(angle2F, separator);
+ length1F = VAbstractApplication::VApp()->TrVars()->TryFormulaFromUser(length1F, separator);
+ length2F = VAbstractApplication::VApp()->TrVars()->TryFormulaFromUser(length2F, separator);
VSpline spline(*GetP1(), *GetP4(), angle1, angle1F, angle2, angle2F, length1, length1F, length2, length2F);
spline.SetApproximationScale(ui->doubleSpinBoxApproximationScale->value());
@@ -514,7 +522,7 @@ void DialogSpline::PointNameChanged()
getCurrentObjectId(ui->comboBoxP4) == spl.GetP4().id())
{
newDuplicate = -1;
- ui->lineEditSplineName->setText(qApp->TrVars()->VarToUser(spl.name()));
+ ui->lineEditSplineName->setText(VAbstractApplication::VApp()->TrVars()->VarToUser(spl.name()));
}
else
{
@@ -527,7 +535,7 @@ void DialogSpline::PointNameChanged()
newDuplicate = static_cast(DNumber(spline.name()));
spline.SetDuplicate(static_cast(newDuplicate));
}
- ui->lineEditSplineName->setText(qApp->TrVars()->VarToUser(spline.name()));
+ ui->lineEditSplineName->setText(VAbstractApplication::VApp()->TrVars()->VarToUser(spline.name()));
}
catch (const VExceptionBadId &)
{
@@ -552,24 +560,28 @@ void DialogSpline::ShowDialog(bool click)
spl = VSpline(*GetP1(), path->GetP2(), path->GetP3(), *GetP4());
- const QString angle1F = qApp->TrVars()->FormulaToUser(spl.GetStartAngleFormula(),
- qApp->Settings()->GetOsSeparator());
- const QString angle2F = qApp->TrVars()->FormulaToUser(spl.GetEndAngleFormula(),
- qApp->Settings()->GetOsSeparator());
+ const QString angle1F = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(spl.GetStartAngleFormula(), VAbstractApplication::VApp()->Settings()->GetOsSeparator());
+ const QString angle2F = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(spl.GetEndAngleFormula(), VAbstractApplication::VApp()->Settings()->GetOsSeparator());
ui->plainTextEditAngle1F->setPlainText(angle1F);
ui->plainTextEditAngle2F->setPlainText(angle2F);
- ui->plainTextEditLength1F->setPlainText(qApp->TrVars()->FormulaToUser(spl.GetC1LengthFormula(),
- qApp->Settings()->GetOsSeparator()));
- ui->plainTextEditLength2F->setPlainText(qApp->TrVars()->FormulaToUser(spl.GetC2LengthFormula(),
- qApp->Settings()->GetOsSeparator()));
+ ui->plainTextEditLength1F->setPlainText(
+ VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(spl.GetC1LengthFormula(),
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
+ ui->plainTextEditLength2F->setPlainText(
+ VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(spl.GetC2LengthFormula(),
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
if (not data->IsUnique(spl.name()))
{
spl.SetDuplicate(DNumber(spl.name()));
}
- ui->lineEditSplineName->setText(qApp->TrVars()->VarToUser(spl.name()));
+ ui->lineEditSplineName->setText(VAbstractApplication::VApp()->TrVars()->VarToUser(spl.name()));
DialogAccepted();
}
@@ -599,22 +611,22 @@ void DialogSpline::SetSpline(const VSpline &spline)
setCurrentPointId(ui->comboBoxP1, spl.GetP1().id());
setCurrentPointId(ui->comboBoxP4, spl.GetP4().id());
- const QString angle1F = qApp->TrVars()->FormulaToUser(spl.GetStartAngleFormula(),
- qApp->Settings()->GetOsSeparator());
- const QString angle2F = qApp->TrVars()->FormulaToUser(spl.GetEndAngleFormula(),
- qApp->Settings()->GetOsSeparator());
+ const QString angle1F = VAbstractApplication::VApp()->TrVars()->FormulaToUser(spl.GetStartAngleFormula(),
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator());
+ const QString angle2F = VAbstractApplication::VApp()->TrVars()->FormulaToUser(spl.GetEndAngleFormula(),
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator());
ui->plainTextEditAngle1F->setPlainText(angle1F);
ui->plainTextEditAngle2F->setPlainText(angle2F);
- const QString length1F = qApp->TrVars()->FormulaToUser(spl.GetC1LengthFormula(),
- qApp->Settings()->GetOsSeparator());
- const QString length2F = qApp->TrVars()->FormulaToUser(spl.GetC2LengthFormula(),
- qApp->Settings()->GetOsSeparator());
+ const QString length1F = VAbstractApplication::VApp()->TrVars()->FormulaToUser(spl.GetC1LengthFormula(),
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator());
+ const QString length2F = VAbstractApplication::VApp()->TrVars()->FormulaToUser(spl.GetC2LengthFormula(),
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator());
ui->plainTextEditLength1F->setPlainText(length1F);
ui->plainTextEditLength2F->setPlainText(length2F);
- ui->lineEditSplineName->setText(qApp->TrVars()->VarToUser(spl.name()));
+ ui->lineEditSplineName->setText(VAbstractApplication::VApp()->TrVars()->VarToUser(spl.name()));
originAliasSuffix = spl.GetAliasSuffix();
ui->lineEditAlias->setText(originAliasSuffix);
diff --git a/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp b/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp
index 38340b41a..e44d4a921 100644
--- a/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp
+++ b/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp
@@ -132,7 +132,7 @@ DialogSplinePath::DialogSplinePath(const VContainer *data, quint32 toolId, QWidg
auto path = qobject_cast(vis);
SCASSERT(path != nullptr)
- auto scene = qobject_cast(qApp->getCurrentScene());
+ auto scene = qobject_cast(VAbstractValApplication::VApp()->getCurrentScene());
SCASSERT(scene != nullptr)
connect(scene, &VMainGraphicsScene::MouseLeftPressed, path, &VisToolSplinePath::MouseLeftPressed);
connect(scene, &VMainGraphicsScene::MouseLeftReleased, path, &VisToolSplinePath::MouseLeftReleased);
@@ -167,7 +167,7 @@ void DialogSplinePath::SetPath(const VSplinePath &value)
NewItem(path.at(i));
}
ui->listWidget->setFocus(Qt::OtherFocusReason);
- ui->lineEditSplPathName->setText(qApp->TrVars()->VarToUser(path.name()));
+ ui->lineEditSplPathName->setText(VAbstractApplication::VApp()->TrVars()->VarToUser(path.name()));
ui->doubleSpinBoxApproximationScale->setValue(path.GetApproximationScale());
originAliasSuffix = path.GetAliasSuffix();
@@ -215,7 +215,8 @@ void DialogSplinePath::ChosenObject(quint32 id, const SceneObject &type)
if (path.CountPoints() == 1)
{
visPath->VisualMode(NULL_ID);
- VAbstractMainWindow *window = qobject_cast(qApp->getMainWindow());
+ VAbstractMainWindow *window =
+ qobject_cast(VAbstractValApplication::VApp()->getMainWindow());
SCASSERT(window != nullptr)
connect(visPath, &VisToolSplinePath::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
@@ -296,7 +297,9 @@ void DialogSplinePath::Angle1Changed()
const QString angle1F = ui->plainTextEditAngle1F->toPlainText();
const qreal angle1 = Visualization::FindValFromUser(angle1F, data->DataVariables());
- p.SetAngle1(angle1, VTranslateVars::TryFormulaFromUser(angle1F, qApp->Settings()->GetOsSeparator()));
+ p.SetAngle1(angle1,
+ VTranslateVars::TryFormulaFromUser(angle1F,
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
item->setData(Qt::UserRole, QVariant::fromValue(p));
@@ -305,8 +308,9 @@ void DialogSplinePath::Angle1Changed()
if (row != ui->listWidget->count()-1)
{
ui->plainTextEditAngle2F->blockSignals(true);
- ui->plainTextEditAngle2F->setPlainText(qApp->TrVars()->FormulaToUser(p.Angle2Formula(),
- qApp->Settings()->GetOsSeparator()));
+ ui->plainTextEditAngle2F->setPlainText(
+ VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(p.Angle2Formula(), VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
EvalAngle2();
ui->plainTextEditAngle2F->blockSignals(false);
}
@@ -330,7 +334,9 @@ void DialogSplinePath::Angle2Changed()
const QString angle2F = ui->plainTextEditAngle2F->toPlainText();
const qreal angle2 = Visualization::FindValFromUser(angle2F, data->DataVariables());
- p.SetAngle2(angle2, VTranslateVars::TryFormulaFromUser(angle2F, qApp->Settings()->GetOsSeparator()));
+ p.SetAngle2(angle2,
+ VTranslateVars::TryFormulaFromUser(angle2F,
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
item->setData(Qt::UserRole, QVariant::fromValue(p));
@@ -339,8 +345,9 @@ void DialogSplinePath::Angle2Changed()
if (row != 0)
{
ui->plainTextEditAngle1F->blockSignals(true);
- ui->plainTextEditAngle1F->setPlainText(qApp->TrVars()->FormulaToUser(p.Angle1Formula(),
- qApp->Settings()->GetOsSeparator()));
+ ui->plainTextEditAngle1F->setPlainText(
+ VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(p.Angle1Formula(), VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
EvalAngle1();
ui->plainTextEditAngle1F->blockSignals(false);
}
@@ -364,7 +371,9 @@ void DialogSplinePath::Length1Changed()
const QString length1F = ui->plainTextEditLength1F->toPlainText();
const qreal length1 = Visualization::FindLengthFromUser(length1F, data->DataVariables());
- p.SetLength1(length1, VTranslateVars::TryFormulaFromUser(length1F, qApp->Settings()->GetOsSeparator()));
+ p.SetLength1(length1,
+ VTranslateVars::TryFormulaFromUser(length1F,
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
item->setData(Qt::UserRole, QVariant::fromValue(p));
@@ -389,7 +398,9 @@ void DialogSplinePath::Length2Changed()
const QString length2F = ui->plainTextEditLength2F->toPlainText();
const qreal length2 = Visualization::FindLengthFromUser(length2F, data->DataVariables());
- p.SetLength2(length2, VTranslateVars::TryFormulaFromUser(length2F, qApp->Settings()->GetOsSeparator()));
+ p.SetLength2(length2,
+ VTranslateVars::TryFormulaFromUser(length2F,
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
item->setData(Qt::UserRole, QVariant::fromValue(p));
@@ -404,13 +415,14 @@ void DialogSplinePath::FXAngle1()
dialog->setWindowTitle(tr("Edit first control point angle"));
QString angle1F = VTranslateVars::TryFormulaFromUser(ui->plainTextEditAngle1F->toPlainText(),
- qApp->Settings()->GetOsSeparator());
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator());
dialog->SetFormula(angle1F);
dialog->setPostfix(degreeSymbol);
if (dialog->exec() == QDialog::Accepted)
{
- angle1F = VTranslateVars::TryFormulaToUser(dialog->GetFormula(), qApp->Settings()->GetOsSeparator());
+ angle1F = VTranslateVars::TryFormulaToUser(dialog->GetFormula(),
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator());
// increase height if needed.
if (angle1F.length() > 80)
{
@@ -429,13 +441,14 @@ void DialogSplinePath::FXAngle2()
dialog->setWindowTitle(tr("Edit second control point angle"));
QString angle2F = VTranslateVars::TryFormulaFromUser(ui->plainTextEditAngle2F->toPlainText(),
- qApp->Settings()->GetOsSeparator());
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator());
dialog->SetFormula(angle2F);
dialog->setPostfix(degreeSymbol);
if (dialog->exec() == QDialog::Accepted)
{
- angle2F = VTranslateVars::TryFormulaToUser(dialog->GetFormula(), qApp->Settings()->GetOsSeparator());
+ angle2F = VTranslateVars::TryFormulaToUser(dialog->GetFormula(),
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator());
// increase height if needed.
if (angle2F.length() > 80)
{
@@ -454,13 +467,14 @@ void DialogSplinePath::FXLength1()
dialog->setWindowTitle(tr("Edit first control point length"));
QString length1F = VTranslateVars::TryFormulaFromUser(ui->plainTextEditLength1F->toPlainText(),
- qApp->Settings()->GetOsSeparator());
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator());
dialog->SetFormula(length1F);
- dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
+ dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
- length1F = VTranslateVars::TryFormulaToUser(dialog->GetFormula(), qApp->Settings()->GetOsSeparator());
+ length1F = VTranslateVars::TryFormulaToUser(dialog->GetFormula(),
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator());
// increase height if needed.
if (length1F.length() > 80)
{
@@ -479,13 +493,14 @@ void DialogSplinePath::FXLength2()
dialog->setWindowTitle(tr("Edit second control point length"));
QString length2F = VTranslateVars::TryFormulaFromUser(ui->plainTextEditLength2F->toPlainText(),
- qApp->Settings()->GetOsSeparator());
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator());
dialog->SetFormula(length2F);
- dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
+ dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
if (dialog->exec() == QDialog::Accepted)
{
- length2F = VTranslateVars::TryFormulaToUser(dialog->GetFormula(), qApp->Settings()->GetOsSeparator());
+ length2F = VTranslateVars::TryFormulaToUser(dialog->GetFormula(),
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator());
// increase height if needed.
if (length2F.length() > 80)
{
@@ -587,7 +602,7 @@ void DialogSplinePath::EvalLength1()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditLength1;
formulaData.labelResult = ui->labelResultLength1;
- formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
+ formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
formulaData.checkZero = false;
formulaData.checkLessThanZero = true;
@@ -614,7 +629,7 @@ void DialogSplinePath::EvalLength2()
formulaData.variables = data->DataVariables();
formulaData.labelEditFormula = ui->labelEditLength2;
formulaData.labelResult = ui->labelResultLength2;
- formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
+ formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
formulaData.checkZero = false;
formulaData.checkLessThanZero = true;
@@ -683,7 +698,7 @@ void DialogSplinePath::currentPointChanged(int index)
if (first.P().id() == path.at(0).P().id() && last.P().id() == path.at(path.CountPoints()-1).P().id())
{
newDuplicate = -1;
- ui->lineEditSplPathName->setText(qApp->TrVars()->VarToUser(path.name()));
+ ui->lineEditSplPathName->setText(VAbstractApplication::VApp()->TrVars()->VarToUser(path.name()));
}
else
{
@@ -695,7 +710,7 @@ void DialogSplinePath::currentPointChanged(int index)
newPath.SetDuplicate(static_cast(newDuplicate));
}
- ui->lineEditSplPathName->setText(qApp->TrVars()->VarToUser(newPath.name()));
+ ui->lineEditSplPathName->setText(VAbstractApplication::VApp()->TrVars()->VarToUser(newPath.name()));
}
}
}
@@ -813,11 +828,13 @@ void DialogSplinePath::DataPoint(const VSplinePoint &p)
ui->plainTextEditAngle2F->blockSignals(true);
ui->plainTextEditLength2F->blockSignals(true);
- ui->plainTextEditAngle2F->setPlainText(qApp->TrVars()->FormulaToUser(p.Angle2Formula(),
- qApp->Settings()->GetOsSeparator()));
+ ui->plainTextEditAngle2F->setPlainText(
+ VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(p.Angle2Formula(),VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
EvalAngle2();
- ui->plainTextEditLength2F->setPlainText(qApp->TrVars()->FormulaToUser(p.Length2Formula(),
- qApp->Settings()->GetOsSeparator()));
+ ui->plainTextEditLength2F->setPlainText(
+ VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(p.Length2Formula(), VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
EvalLength2();
ui->plainTextEditAngle2F->blockSignals(false);
ui->plainTextEditLength2F->blockSignals(false);
@@ -850,11 +867,13 @@ void DialogSplinePath::DataPoint(const VSplinePoint &p)
ui->plainTextEditAngle1F->blockSignals(true);
ui->plainTextEditLength1F->blockSignals(true);
- ui->plainTextEditAngle1F->setPlainText(qApp->TrVars()->FormulaToUser(p.Angle1Formula(),
- qApp->Settings()->GetOsSeparator()));
+ ui->plainTextEditAngle1F->setPlainText(
+ VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(p.Angle1Formula(), VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
EvalAngle1();
- ui->plainTextEditLength1F->setPlainText(qApp->TrVars()->FormulaToUser(p.Length1Formula(),
- qApp->Settings()->GetOsSeparator()));
+ ui->plainTextEditLength1F->setPlainText(
+ VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(p.Length1Formula(), VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
EvalLength1();
ui->plainTextEditAngle1F->blockSignals(false);
ui->plainTextEditLength1F->blockSignals(false);
@@ -876,14 +895,18 @@ void DialogSplinePath::DataPoint(const VSplinePoint &p)
ui->plainTextEditAngle2F->blockSignals(true);
ui->plainTextEditLength2F->blockSignals(true);
- ui->plainTextEditAngle1F->setPlainText(qApp->TrVars()->FormulaToUser(p.Angle1Formula(),
- qApp->Settings()->GetOsSeparator()));
- ui->plainTextEditAngle2F->setPlainText(qApp->TrVars()->FormulaToUser(p.Angle2Formula(),
- qApp->Settings()->GetOsSeparator()));
- ui->plainTextEditLength1F->setPlainText(qApp->TrVars()->FormulaToUser(p.Length1Formula(),
- qApp->Settings()->GetOsSeparator()));
- ui->plainTextEditLength2F->setPlainText(qApp->TrVars()->FormulaToUser(p.Length2Formula(),
- qApp->Settings()->GetOsSeparator()));
+ ui->plainTextEditAngle1F->setPlainText(
+ VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(p.Angle1Formula(), VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
+ ui->plainTextEditAngle2F->setPlainText(
+ VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(p.Angle2Formula(), VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
+ ui->plainTextEditLength1F->setPlainText(
+ VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(p.Length1Formula(), VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
+ ui->plainTextEditLength2F->setPlainText(
+ VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(p.Length2Formula(), VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
EvalAngle1();
EvalLength1();
diff --git a/src/libs/vtools/dialogs/tools/dialogtool.h b/src/libs/vtools/dialogs/tools/dialogtool.h
index 6912eb13c..37bff7874 100644
--- a/src/libs/vtools/dialogs/tools/dialogtool.h
+++ b/src/libs/vtools/dialogs/tools/dialogtool.h
@@ -286,7 +286,7 @@ inline void DialogTool::InitOkCancel(T *ui)
SCASSERT(bCancel != nullptr)
connect(bCancel, &QPushButton::clicked, this, &DialogTool::DialogRejected);
- qApp->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
+ VAbstractApplication::VApp()->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
}
//---------------------------------------------------------------------------------------------------------------------
@@ -295,7 +295,8 @@ inline void DialogTool::AddVisualization()
{
if (prepare == false)
{
- VMainGraphicsScene *scene = qobject_cast(qApp->getCurrentScene());
+ VMainGraphicsScene *scene =
+ qobject_cast(VAbstractValApplication::VApp()->getCurrentScene());
SCASSERT(scene != nullptr)
T *toolVis = qobject_cast(vis);
diff --git a/src/libs/vtools/dialogs/tools/dialogtriangle.cpp b/src/libs/vtools/dialogs/tools/dialogtriangle.cpp
index ecbbf3dbb..ea6fbbf0b 100644
--- a/src/libs/vtools/dialogs/tools/dialogtriangle.cpp
+++ b/src/libs/vtools/dialogs/tools/dialogtriangle.cpp
@@ -59,7 +59,8 @@ DialogTriangle::DialogTriangle(const VContainer *data, quint32 toolId, QWidget *
ui->lineEditNamePoint->setClearButtonEnabled(true);
- ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
+ ui->lineEditNamePoint->setText(
+ VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
InitOkCancelApply(ui);
diff --git a/src/libs/vtools/dialogs/tools/dialogtruedarts.cpp b/src/libs/vtools/dialogs/tools/dialogtruedarts.cpp
index bab4f1658..4659c36dc 100644
--- a/src/libs/vtools/dialogs/tools/dialogtruedarts.cpp
+++ b/src/libs/vtools/dialogs/tools/dialogtruedarts.cpp
@@ -66,8 +66,9 @@ DialogTrueDarts::DialogTrueDarts(const VContainer *data, quint32 toolId, QWidget
ui->lineEditFirstNewDartPoint->setClearButtonEnabled(true);
ui->lineEditSecondNewDartPoint->setClearButtonEnabled(true);
- const QString name1 = qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel);
- const QString name2 = qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel, name1);
+ const QString name1 = VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel);
+ const QString name2 =
+ VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel, name1);
ui->lineEditFirstNewDartPoint->setText(name1);
ui->lineEditSecondNewDartPoint->setText(name2);
diff --git a/src/libs/vtools/dialogs/tools/piece/dialogpatternmaterials.cpp b/src/libs/vtools/dialogs/tools/piece/dialogpatternmaterials.cpp
index decb39377..b336abfa9 100644
--- a/src/libs/vtools/dialogs/tools/piece/dialogpatternmaterials.cpp
+++ b/src/libs/vtools/dialogs/tools/piece/dialogpatternmaterials.cpp
@@ -39,7 +39,7 @@ namespace
//---------------------------------------------------------------------------------------------------------------------
QStringList PrepareKnowMaterials(const QStringList &patternMaterials, bool rememberPM)
{
- QStringList knownMaterials = qApp->ValentinaSettings()->GetKnownMaterials();
+ QStringList knownMaterials = VAbstractValApplication::VApp()->ValentinaSettings()->GetKnownMaterials();
if (rememberPM)
{
diff --git a/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp b/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp
index 19ec44b48..fb6124b9e 100644
--- a/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp
+++ b/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp
@@ -177,7 +177,7 @@ void DialogPiecePath::ChosenObject(quint32 id, const SceneObject &type)
"%2 - finish creation")
.arg(VModifierKey::Shift(), VModifierKey::EnterKey()));
- if (not qApp->getCurrentScene()->items().contains(visPath))
+ if (not VAbstractValApplication::VApp()->getCurrentScene()->items().contains(visPath))
{
visPath->VisualMode(NULL_ID);
}
@@ -465,7 +465,8 @@ void DialogPiecePath::NodeChanged(int index)
{
this->DeployWidthBeforeFormulaTextEdit();
}
- w1Formula = qApp->TrVars()->FormulaToUser(w1Formula, qApp->Settings()->GetOsSeparator());
+ w1Formula = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(w1Formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
ui->plainTextEditFormulaWidthBefore->setPlainText(w1Formula);
MoveCursorToEnd(ui->plainTextEditFormulaWidthBefore);
@@ -482,7 +483,8 @@ void DialogPiecePath::NodeChanged(int index)
{
this->DeployWidthAfterFormulaTextEdit();
}
- w2Formula = qApp->TrVars()->FormulaToUser(w2Formula, qApp->Settings()->GetOsSeparator());
+ w2Formula = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(w2Formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
ui->plainTextEditFormulaWidthAfter->setPlainText(w2Formula);
MoveCursorToEnd(ui->plainTextEditFormulaWidthAfter);
@@ -537,7 +539,8 @@ void DialogPiecePath::PassmarkChanged(int index)
ui->groupBoxManualLength->setChecked(true);
QString passmarkLength = node.GetFormulaPassmarkLength();
- passmarkLength = qApp->TrVars()->FormulaToUser(passmarkLength, qApp->Settings()->GetOsSeparator());
+ passmarkLength = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(passmarkLength, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
if (passmarkLength.length() > 80)// increase height if needed.
{
this->DeployPassmarkLength();
@@ -545,8 +548,8 @@ void DialogPiecePath::PassmarkChanged(int index)
if (passmarkLength.isEmpty())
{
- qreal length = UnitConvertor(1, Unit::Cm, qApp->patternUnits());
- ui->plainTextEditPassmarkLength->setPlainText(qApp->LocaleToString(length));
+ qreal length = UnitConvertor(1, Unit::Cm, VAbstractValApplication::VApp()->patternUnits());
+ ui->plainTextEditPassmarkLength->setPlainText(VAbstractApplication::VApp()->LocaleToString(length));
}
else
{
@@ -555,8 +558,8 @@ void DialogPiecePath::PassmarkChanged(int index)
}
else
{
- qreal length = UnitConvertor(1, Unit::Cm, qApp->patternUnits());
- ui->plainTextEditPassmarkLength->setPlainText(qApp->LocaleToString(length));
+ qreal length = UnitConvertor(1, Unit::Cm, VAbstractValApplication::VApp()->patternUnits());
+ ui->plainTextEditPassmarkLength->setPlainText(VAbstractApplication::VApp()->LocaleToString(length));
}
MoveCursorToEnd(ui->plainTextEditPassmarkLength);
@@ -643,7 +646,8 @@ void DialogPiecePath::PassmarkChanged(int index)
//---------------------------------------------------------------------------------------------------------------------
void DialogPiecePath::ReturnDefBefore()
{
- const QString def = qApp->TrVars()->FormulaToUser(currentSeamAllowance, qApp->Settings()->GetOsSeparator());
+ const QString def = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(currentSeamAllowance, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
ui->plainTextEditFormulaWidthBefore->setPlainText(def);
if (QPushButton* button = qobject_cast(sender()))
{
@@ -654,7 +658,8 @@ void DialogPiecePath::ReturnDefBefore()
//---------------------------------------------------------------------------------------------------------------------
void DialogPiecePath::ReturnDefAfter()
{
- const QString def = qApp->TrVars()->FormulaToUser(currentSeamAllowance, qApp->Settings()->GetOsSeparator());
+ const QString def = VAbstractApplication::VApp()->TrVars()
+ ->FormulaToUser(currentSeamAllowance, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
ui->plainTextEditFormulaWidthAfter->setPlainText(def);
if (QPushButton* button = qobject_cast