Fix Tape crash.
This commit is contained in:
parent
d61089d755
commit
2bb95154cd
|
@ -50,29 +50,30 @@ TapePreferencesConfigurationPage::TapePreferencesConfigurationPage(QWidget *pare
|
||||||
});
|
});
|
||||||
|
|
||||||
//-------------------- Decimal separator setup
|
//-------------------- Decimal separator setup
|
||||||
ui->osOptionCheck->setChecked(qApp->TapeSettings()->GetOsSeparator());
|
ui->osOptionCheck->setChecked(MApplication::VApp()->TapeSettings()->GetOsSeparator());
|
||||||
|
|
||||||
// Theme
|
// Theme
|
||||||
ui->darkModeCheck->setChecked(qApp->TapeSettings()->GetDarkMode());
|
ui->darkModeCheck->setChecked(MApplication::VApp()->TapeSettings()->GetDarkMode());
|
||||||
|
|
||||||
// Native dialogs
|
// Native dialogs
|
||||||
ui->checkBoxDontUseNativeDialog->setChecked(qApp->TapeSettings()->IsDontUseNativeDialog());
|
ui->checkBoxDontUseNativeDialog->setChecked(MApplication::VApp()->TapeSettings()->IsDontUseNativeDialog());
|
||||||
|
|
||||||
//---------------------- Pattern making system
|
//---------------------- Pattern making system
|
||||||
ui->systemBookValueLabel->setFixedHeight(4 * QFontMetrics(ui->systemBookValueLabel->font()).lineSpacing());
|
ui->systemBookValueLabel->setFixedHeight(4 * QFontMetrics(ui->systemBookValueLabel->font()).lineSpacing());
|
||||||
connect(ui->systemCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this]()
|
connect(ui->systemCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this]()
|
||||||
{
|
{
|
||||||
m_systemChanged = true;
|
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->setText(text);
|
||||||
ui->systemAuthorValueLabel->setToolTip(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);
|
ui->systemBookValueLabel->setPlainText(text);
|
||||||
});
|
});
|
||||||
|
|
||||||
// set default pattern making system
|
// 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)
|
if (index != -1)
|
||||||
{
|
{
|
||||||
ui->systemCombo->setCurrentIndex(index);
|
ui->systemCombo->setCurrentIndex(index);
|
||||||
|
@ -81,11 +82,11 @@ TapePreferencesConfigurationPage::TapePreferencesConfigurationPage(QWidget *pare
|
||||||
//----------------------------- Measurements Editing
|
//----------------------------- Measurements Editing
|
||||||
connect(ui->resetWarningsButton, &QPushButton::released, this, []()
|
connect(ui->resetWarningsButton, &QPushButton::released, this, []()
|
||||||
{
|
{
|
||||||
qApp->TapeSettings()->SetConfirmFormatRewriting(true);
|
MApplication::VApp()->TapeSettings()->SetConfirmFormatRewriting(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
//----------------------- Toolbar
|
//----------------------- Toolbar
|
||||||
ui->toolBarStyleCheck->setChecked(qApp->TapeSettings()->GetToolBarStyle());
|
ui->toolBarStyleCheck->setChecked(MApplication::VApp()->TapeSettings()->GetToolBarStyle());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -98,7 +99,7 @@ TapePreferencesConfigurationPage::~TapePreferencesConfigurationPage()
|
||||||
QStringList TapePreferencesConfigurationPage::Apply()
|
QStringList TapePreferencesConfigurationPage::Apply()
|
||||||
{
|
{
|
||||||
QStringList preferences;
|
QStringList preferences;
|
||||||
VTapeSettings *settings = qApp->TapeSettings();
|
VTapeSettings *settings = MApplication::VApp()->TapeSettings();
|
||||||
settings->SetOsSeparator(ui->osOptionCheck->isChecked());
|
settings->SetOsSeparator(ui->osOptionCheck->isChecked());
|
||||||
|
|
||||||
settings->SetToolBarStyle(ui->toolBarStyleCheck->isChecked());
|
settings->SetToolBarStyle(ui->toolBarStyleCheck->isChecked());
|
||||||
|
@ -124,12 +125,12 @@ QStringList TapePreferencesConfigurationPage::Apply()
|
||||||
settings->SetPMSystemCode(code);
|
settings->SetPMSystemCode(code);
|
||||||
m_systemChanged = false;
|
m_systemChanged = false;
|
||||||
|
|
||||||
qApp->LoadTranslation(locale);
|
VAbstractApplication::VApp()->LoadTranslation(locale);
|
||||||
qApp->processEvents();// force to call changeEvent
|
qApp->processEvents();// force to call changeEvent
|
||||||
|
|
||||||
// Part about measurments will not be updated automatically
|
// Part about measurments will not be updated automatically
|
||||||
qApp->RetranslateTables();
|
MApplication::VApp()->RetranslateTables();
|
||||||
qApp->RetranslateGroups();
|
MApplication::VApp()->RetranslateGroups();
|
||||||
}
|
}
|
||||||
|
|
||||||
return preferences;
|
return preferences;
|
||||||
|
|
|
@ -65,7 +65,7 @@ TapePreferencesPathPage::~TapePreferencesPathPage()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TapePreferencesPathPage::Apply()
|
void TapePreferencesPathPage::Apply()
|
||||||
{
|
{
|
||||||
VTapeSettings *settings = qApp->TapeSettings();
|
VTapeSettings *settings = MApplication::VApp()->TapeSettings();
|
||||||
settings->SetPathIndividualMeasurements(ui->pathTable->item(0, 1)->text());
|
settings->SetPathIndividualMeasurements(ui->pathTable->item(0, 1)->text());
|
||||||
settings->SetPathMultisizeMeasurements(ui->pathTable->item(1, 1)->text());
|
settings->SetPathMultisizeMeasurements(ui->pathTable->item(1, 1)->text());
|
||||||
settings->SetPathPattern(ui->pathTable->item(2, 1)->text());
|
settings->SetPathPattern(ui->pathTable->item(2, 1)->text());
|
||||||
|
@ -126,17 +126,17 @@ void TapePreferencesPathPage::EditPath()
|
||||||
switch (row)
|
switch (row)
|
||||||
{
|
{
|
||||||
case 0: // individual measurements
|
case 0: // individual measurements
|
||||||
path = qApp->TapeSettings()->GetPathIndividualMeasurements();
|
path = MApplication::VApp()->TapeSettings()->GetPathIndividualMeasurements();
|
||||||
break;
|
break;
|
||||||
case 1: // multisize measurements
|
case 1: // multisize measurements
|
||||||
path = qApp->TapeSettings()->GetPathMultisizeMeasurements();
|
path = MApplication::VApp()->TapeSettings()->GetPathMultisizeMeasurements();
|
||||||
path = VCommonSettings::PrepareMultisizeTables(path);
|
path = VCommonSettings::PrepareMultisizeTables(path);
|
||||||
break;
|
break;
|
||||||
case 2: // pattern path
|
case 2: // pattern path
|
||||||
path = qApp->TapeSettings()->GetPathPattern();
|
path = MApplication::VApp()->TapeSettings()->GetPathPattern();
|
||||||
break;
|
break;
|
||||||
case 3: // templates
|
case 3: // templates
|
||||||
path = qApp->TapeSettings()->GetPathTemplate();
|
path = MApplication::VApp()->TapeSettings()->GetPathTemplate();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -151,7 +151,7 @@ void TapePreferencesPathPage::EditPath()
|
||||||
|
|
||||||
const QString dir = QFileDialog::getExistingDirectory(
|
const QString dir = QFileDialog::getExistingDirectory(
|
||||||
this, tr("Open Directory"), path,
|
this, tr("Open Directory"), path,
|
||||||
qApp->NativeFileDialog(QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks));
|
VAbstractApplication::VApp()->NativeFileDialog(QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks));
|
||||||
if (dir.isEmpty())
|
if (dir.isEmpty())
|
||||||
{
|
{
|
||||||
if (usedNotExistedDir)
|
if (usedNotExistedDir)
|
||||||
|
@ -174,7 +174,7 @@ void TapePreferencesPathPage::InitTable()
|
||||||
ui->pathTable->setRowCount(4);
|
ui->pathTable->setRowCount(4);
|
||||||
ui->pathTable->setColumnCount(2);
|
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")));
|
ui->pathTable->setItem(0, 0, new QTableWidgetItem(tr("My Individual Measurements")));
|
||||||
|
|
|
@ -181,7 +181,8 @@ void DialogMDataBase::RetranslateGroups()
|
||||||
QString DialogMDataBase::ImgTag(const QString &number)
|
QString DialogMDataBase::ImgTag(const QString &number)
|
||||||
{
|
{
|
||||||
QString imgUrl("<img src=\"wrong.png\" align=\"center\"/>"); // In case of error
|
QString imgUrl("<img src=\"wrong.png\" align=\"center\"/>"); // 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))
|
if (QFileInfo::exists(filePath))
|
||||||
{
|
{
|
||||||
// Load your SVG
|
// Load your SVG
|
||||||
|
@ -508,7 +509,8 @@ void DialogMDataBase::AddMeasurement(QTreeWidgetItem *group, const QString &name
|
||||||
UpdateChecks(m, 0);
|
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->setText(0, text);
|
||||||
m->setToolTip(0, text);
|
m->setToolTip(0, text);
|
||||||
m->setData(0, Qt::UserRole, name);
|
m->setData(0, Qt::UserRole, name);
|
||||||
|
@ -517,13 +519,13 @@ void DialogMDataBase::AddMeasurement(QTreeWidgetItem *group, const QString &name
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogMDataBase::ReadSettings()
|
void DialogMDataBase::ReadSettings()
|
||||||
{
|
{
|
||||||
restoreGeometry(qApp->TapeSettings()->GetDataBaseGeometry());
|
restoreGeometry(MApplication::VApp()->TapeSettings()->GetDataBaseGeometry());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogMDataBase::WriteSettings()
|
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();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString number = qApp->TrVars()->MNumber(name);
|
const QString number = VAbstractApplication::VApp()->TrVars()->MNumber(name);
|
||||||
|
|
||||||
QString imgTag;
|
QString imgTag;
|
||||||
if (showImage)
|
if (showImage)
|
||||||
|
@ -552,7 +554,8 @@ QString DialogMDataBase::ItemFullDescription(QTreeWidgetItem *item, bool showIma
|
||||||
"normal\"> %1 <br clear=\"left\"><b>%2</b>. <i>%3</i></p>"
|
"normal\"> %1 <br clear=\"left\"><b>%2</b>. <i>%3</i></p>"
|
||||||
"<p align=\"left\" style=\"font-variant: normal; font-style: normal; font-weight: "
|
"<p align=\"left\" style=\"font-variant: normal; font-style: normal; font-weight: "
|
||||||
"normal\">%4</p>")
|
"normal\">%4</p>")
|
||||||
.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;
|
return text;
|
||||||
}
|
}
|
||||||
|
@ -572,7 +575,8 @@ void DialogMDataBase::RetranslateGroup(QTreeWidgetItem *group, const QString &gr
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogMDataBase::RetranslateMeasurement(QTreeWidgetItem *group, int index, const QString &name)
|
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);
|
QTreeWidgetItem *m = group->child(index);
|
||||||
m->setText(0, text);
|
m->setText(0, text);
|
||||||
|
|
|
@ -50,7 +50,7 @@ DialogTapePreferences::DialogTapePreferences(QWidget *parent)
|
||||||
setWindowFlags(Qt::Window);
|
setWindowFlags(Qt::Window);
|
||||||
#endif
|
#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);
|
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||||
SCASSERT(bOk != nullptr)
|
SCASSERT(bOk != nullptr)
|
||||||
|
@ -88,7 +88,7 @@ void DialogTapePreferences::showEvent(QShowEvent *event)
|
||||||
}
|
}
|
||||||
// do your init stuff here
|
// do your init stuff here
|
||||||
|
|
||||||
QSize sz = qApp->Settings()->GetPreferenceDialogSize();
|
QSize sz = VAbstractApplication::VApp()->Settings()->GetPreferenceDialogSize();
|
||||||
if (sz.isEmpty() == false)
|
if (sz.isEmpty() == false)
|
||||||
{
|
{
|
||||||
resize(sz);
|
resize(sz);
|
||||||
|
@ -106,7 +106,7 @@ void DialogTapePreferences::resizeEvent(QResizeEvent *event)
|
||||||
// dialog creating, which would
|
// dialog creating, which would
|
||||||
if (m_isInitialized)
|
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);
|
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();
|
emit UpdateProperties();
|
||||||
setResult(QDialog::Accepted);
|
setResult(QDialog::Accepted);
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,7 +151,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
||||||
}
|
}
|
||||||
|
|
||||||
QString logMsg = msg;
|
QString logMsg = msg;
|
||||||
const bool isWarningMessage = qApp->IsWarningMessage(msg);
|
const bool isWarningMessage = VAbstractApplication::VApp()->IsWarningMessage(msg);
|
||||||
if (isWarningMessage)
|
if (isWarningMessage)
|
||||||
{
|
{
|
||||||
logMsg = logMsg.remove(VAbstractApplication::warningMessageSignature);
|
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 (type == QtWarningMsg || type == QtCriticalMsg || type == QtFatalMsg)
|
||||||
{
|
{
|
||||||
if (not qApp->IsTestMode())
|
if (not MApplication::VApp()->IsTestMode())
|
||||||
{
|
{
|
||||||
if (topWinAllowsPop)
|
if (topWinAllowsPop)
|
||||||
{
|
{
|
||||||
|
@ -432,7 +432,7 @@ void MApplication::InitOptions()
|
||||||
|
|
||||||
void MApplication::ActivateDarkMode()
|
void MApplication::ActivateDarkMode()
|
||||||
{
|
{
|
||||||
VTapeSettings *settings = qApp->TapeSettings();
|
VTapeSettings *settings = MApplication::VApp()->TapeSettings();
|
||||||
if (settings->GetDarkMode())
|
if (settings->GetDarkMode())
|
||||||
{
|
{
|
||||||
QFile f(":qdarkstyle/style.qss");
|
QFile f(":qdarkstyle/style.qss");
|
||||||
|
@ -839,12 +839,18 @@ void MApplication::ParseCommandLine(const SocketConnection &connection, const QS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto MApplication::VApp() -> MApplication *
|
||||||
|
{
|
||||||
|
return qobject_cast<MApplication*>(QCoreApplication::instance());
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
TMainWindow *MApplication::NewMainWindow()
|
TMainWindow *MApplication::NewMainWindow()
|
||||||
{
|
{
|
||||||
TMainWindow *tape = new TMainWindow();
|
TMainWindow *tape = new TMainWindow();
|
||||||
mainWindows.prepend(tape);
|
mainWindows.prepend(tape);
|
||||||
if (not qApp->IsTestMode())
|
if (not MApplication::VApp()->IsTestMode())
|
||||||
{
|
{
|
||||||
tape->show();
|
tape->show();
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,11 +39,6 @@ class MApplication;// use in define
|
||||||
class TMainWindow;
|
class TMainWindow;
|
||||||
class QLocalServer;
|
class QLocalServer;
|
||||||
|
|
||||||
#if defined(qApp)
|
|
||||||
#undef qApp
|
|
||||||
#endif
|
|
||||||
#define qApp (static_cast<MApplication*>(VAbstractApplication::instance()))
|
|
||||||
|
|
||||||
enum class SocketConnection : bool {Client = false, Server = true};
|
enum class SocketConnection : bool {Client = false, Server = true};
|
||||||
|
|
||||||
class MApplication : public VAbstractApplication
|
class MApplication : public VAbstractApplication
|
||||||
|
@ -78,6 +73,8 @@ public:
|
||||||
|
|
||||||
void ParseCommandLine(const SocketConnection &connection, const QStringList &arguments);
|
void ParseCommandLine(const SocketConnection &connection, const QStringList &arguments);
|
||||||
|
|
||||||
|
static MApplication *VApp();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void ProcessCMD();
|
void ProcessCMD();
|
||||||
|
|
||||||
|
|
|
@ -352,16 +352,7 @@ DEPENDPATH += $$PWD/../../libs/vformat
|
||||||
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vformat/$${DESTDIR}/vformat.lib
|
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
|
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vformat/$${DESTDIR}/libvformat.a
|
||||||
|
|
||||||
# VLayout static library (depend on IFC, VGeometry, VPatternDB)
|
#VPatternDB static library (depend on vgeometry, vmisc, VLayout)
|
||||||
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)
|
|
||||||
unix|win32: LIBS += -L$$OUT_PWD/../../libs/vpatterndb/$${DESTDIR} -lvpatterndb
|
unix|win32: LIBS += -L$$OUT_PWD/../../libs/vpatterndb/$${DESTDIR} -lvpatterndb
|
||||||
|
|
||||||
INCLUDEPATH += $$PWD/../../libs/vpatterndb
|
INCLUDEPATH += $$PWD/../../libs/vpatterndb
|
||||||
|
@ -370,6 +361,15 @@ DEPENDPATH += $$PWD/../../libs/vpatterndb
|
||||||
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vpatterndb/$${DESTDIR}/vpatterndb.lib
|
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
|
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)
|
# Fervor static library (depend on VMisc, IFC)
|
||||||
unix|win32: LIBS += -L$$OUT_PWD/../../libs/fervor/$${DESTDIR}/ -lfervor
|
unix|win32: LIBS += -L$$OUT_PWD/../../libs/fervor/$${DESTDIR}/ -lfervor
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,7 @@ TMainWindow::TMainWindow(QWidget *parent)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
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->lineEditFind->setClearButtonEnabled(true);
|
||||||
ui->lineEditName->setClearButtonEnabled(true);
|
ui->lineEditName->setClearButtonEnabled(true);
|
||||||
|
@ -269,7 +269,7 @@ bool TMainWindow::LoadFile(const QString &path)
|
||||||
if (not QFileInfo::exists(path))
|
if (not QFileInfo::exists(path))
|
||||||
{
|
{
|
||||||
qCCritical(tMainWindow, "%s", qUtf8Printable(tr("File '%1' doesn't exist!").arg(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);
|
qApp->exit(V_EX_NOINPUT);
|
||||||
}
|
}
|
||||||
|
@ -277,7 +277,7 @@ bool TMainWindow::LoadFile(const QString &path)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if file already opened
|
// Check if file already opened
|
||||||
const QList<TMainWindow*> list = qApp->MainWindows();
|
const QList<TMainWindow*> list = MApplication::VApp()->MainWindows();
|
||||||
for (auto w : list)
|
for (auto w : list)
|
||||||
{
|
{
|
||||||
if (w->CurrentFile() == path)
|
if (w->CurrentFile() == path)
|
||||||
|
@ -300,7 +300,7 @@ bool TMainWindow::LoadFile(const QString &path)
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
data = new VContainer(qApp->TrVars(), &mUnit, VContainer::UniqueNamespace());
|
data = new VContainer(VAbstractApplication::VApp()->TrVars(), &mUnit, VContainer::UniqueNamespace());
|
||||||
|
|
||||||
m = new VMeasurements(data);
|
m = new VMeasurements(data);
|
||||||
m->setXMLContent(path);
|
m->setXMLContent(path);
|
||||||
|
@ -373,7 +373,7 @@ bool TMainWindow::LoadFile(const QString &path)
|
||||||
data = nullptr;
|
data = nullptr;
|
||||||
lock.reset();
|
lock.reset();
|
||||||
|
|
||||||
if (qApp->IsTestMode())
|
if (MApplication::VApp()->IsTestMode())
|
||||||
{
|
{
|
||||||
qApp->exit(V_EX_NOINPUT);
|
qApp->exit(V_EX_NOINPUT);
|
||||||
}
|
}
|
||||||
|
@ -382,7 +382,7 @@ bool TMainWindow::LoadFile(const QString &path)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return qApp->NewMainWindow()->LoadFile(path);
|
return MApplication::VApp()->NewMainWindow()->LoadFile(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -418,7 +418,7 @@ void TMainWindow::FileNew()
|
||||||
return;
|
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 = new VMeasurements(mUnit, setup.Dimensions(), data);
|
||||||
m->SetFullCircumference(setup.FullCircumference());
|
m->SetFullCircumference(setup.FullCircumference());
|
||||||
|
@ -429,7 +429,7 @@ void TMainWindow::FileNew()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
data = new VContainer(qApp->TrVars(), &mUnit, VContainer::UniqueNamespace());
|
data = new VContainer(VAbstractApplication::VApp()->TrVars(), &mUnit, VContainer::UniqueNamespace());
|
||||||
|
|
||||||
m = new VMeasurements(mUnit, data);
|
m = new VMeasurements(mUnit, data);
|
||||||
m_curFileFormatVersion = VVITConverter::MeasurementMaxVer;
|
m_curFileFormatVersion = VVITConverter::MeasurementMaxVer;
|
||||||
|
@ -450,7 +450,7 @@ void TMainWindow::FileNew()
|
||||||
}
|
}
|
||||||
else
|
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") +
|
const QString filter = tr("Individual measurements") + QStringLiteral(" (*.vit);;") + tr("Multisize measurements") +
|
||||||
QStringLiteral(" (*.vst);;") + tr("All files") + QStringLiteral(" (*.*)");
|
QStringLiteral(" (*.vst);;") + tr("All files") + QStringLiteral(" (*.*)");
|
||||||
//Use standard path to individual measurements
|
//Use standard path to individual measurements
|
||||||
const QString pathTo = qApp->TapeSettings()->GetPathIndividualMeasurements();
|
const QString pathTo = MApplication::VApp()->TapeSettings()->GetPathIndividualMeasurements();
|
||||||
|
|
||||||
bool usedNotExistedDir = false;
|
bool usedNotExistedDir = false;
|
||||||
QDir directory(pathTo);
|
QDir directory(pathTo);
|
||||||
|
@ -483,7 +483,7 @@ void TMainWindow::OpenMultisize()
|
||||||
const QString filter = tr("Multisize measurements") + QStringLiteral(" (*.vst);;") + tr("Individual measurements") +
|
const QString filter = tr("Multisize measurements") + QStringLiteral(" (*.vst);;") + tr("Individual measurements") +
|
||||||
QStringLiteral(" (*.vit);;") + tr("All files") + QStringLiteral(" (*.*)");
|
QStringLiteral(" (*.vit);;") + tr("All files") + QStringLiteral(" (*.*)");
|
||||||
//Use standard path to multisize measurements
|
//Use standard path to multisize measurements
|
||||||
QString pathTo = qApp->TapeSettings()->GetPathMultisizeMeasurements();
|
QString pathTo = MApplication::VApp()->TapeSettings()->GetPathMultisizeMeasurements();
|
||||||
pathTo = VCommonSettings::PrepareMultisizeTables(pathTo);
|
pathTo = VCommonSettings::PrepareMultisizeTables(pathTo);
|
||||||
|
|
||||||
Open(pathTo, filter);
|
Open(pathTo, filter);
|
||||||
|
@ -495,7 +495,7 @@ void TMainWindow::OpenTemplate()
|
||||||
const QString filter = tr("Measurements") + QStringLiteral(" (*.vst *.vit);;") + tr("All files") +
|
const QString filter = tr("Measurements") + QStringLiteral(" (*.vst *.vit);;") + tr("All files") +
|
||||||
QStringLiteral(" (*.*)");
|
QStringLiteral(" (*.*)");
|
||||||
//Use standard path to template files
|
//Use standard path to template files
|
||||||
QString pathTo = qApp->TapeSettings()->GetPathTemplate();
|
QString pathTo = MApplication::VApp()->TapeSettings()->GetPathTemplate();
|
||||||
pathTo = VCommonSettings::PrepareStandardTemplates(pathTo);
|
pathTo = VCommonSettings::PrepareStandardTemplates(pathTo);
|
||||||
Open(pathTo, filter);
|
Open(pathTo, filter);
|
||||||
|
|
||||||
|
@ -511,7 +511,7 @@ void TMainWindow::CreateFromExisting()
|
||||||
{
|
{
|
||||||
const QString filter = tr("Individual measurements") + QStringLiteral(" (*.vit)");
|
const QString filter = tr("Individual measurements") + QStringLiteral(" (*.vit)");
|
||||||
//Use standard path to individual measurements
|
//Use standard path to individual measurements
|
||||||
const QString pathTo = qApp->TapeSettings()->GetPathIndividualMeasurements();
|
const QString pathTo = MApplication::VApp()->TapeSettings()->GetPathIndividualMeasurements();
|
||||||
|
|
||||||
bool usedNotExistedDir = false;
|
bool usedNotExistedDir = false;
|
||||||
QDir directory(pathTo);
|
QDir directory(pathTo);
|
||||||
|
@ -521,7 +521,7 @@ void TMainWindow::CreateFromExisting()
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString mPath = QFileDialog::getOpenFileName(this, tr("Select file"), pathTo, filter, nullptr,
|
const QString mPath = QFileDialog::getOpenFileName(this, tr("Select file"), pathTo, filter, nullptr,
|
||||||
qApp->NativeFileDialog());
|
VAbstractApplication::VApp()->NativeFileDialog());
|
||||||
|
|
||||||
if (not mPath.isEmpty())
|
if (not mPath.isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -531,7 +531,7 @@ void TMainWindow::CreateFromExisting()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qApp->NewMainWindow()->CreateFromExisting();
|
MApplication::VApp()->NewMainWindow()->CreateFromExisting();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -597,7 +597,7 @@ void TMainWindow::changeEvent(QEvent *event)
|
||||||
{
|
{
|
||||||
if (event->type() == QEvent::LanguageChange)
|
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)
|
// retranslate designer form (single inheritance approach)
|
||||||
ui->retranslateUi(this);
|
ui->retranslateUi(this);
|
||||||
|
@ -667,7 +667,7 @@ bool TMainWindow::eventFilter(QObject *object, QEvent *event)
|
||||||
auto *keyEvent = static_cast<QKeyEvent *>(event);
|
auto *keyEvent = static_cast<QKeyEvent *>(event);
|
||||||
if ((keyEvent->key() == Qt::Key_Period) && ((keyEvent->modifiers() & Qt::KeypadModifier) != 0u))
|
if ((keyEvent->key() == Qt::Key_Period) && ((keyEvent->modifiers() & Qt::KeypadModifier) != 0u))
|
||||||
{
|
{
|
||||||
if (qApp->Settings()->GetOsSeparator())
|
if (VAbstractApplication::VApp()->Settings()->GetOsSeparator())
|
||||||
{
|
{
|
||||||
plainTextEdit->insertPlainText(QLocale().decimalPoint());
|
plainTextEdit->insertPlainText(QLocale().decimalPoint());
|
||||||
}
|
}
|
||||||
|
@ -686,7 +686,7 @@ bool TMainWindow::eventFilter(QObject *object, QEvent *event)
|
||||||
auto *keyEvent = static_cast<QKeyEvent *>(event);
|
auto *keyEvent = static_cast<QKeyEvent *>(event);
|
||||||
if ((keyEvent->key() == Qt::Key_Period) && ((keyEvent->modifiers() & Qt::KeypadModifier) != 0u))
|
if ((keyEvent->key() == Qt::Key_Period) && ((keyEvent->modifiers() & Qt::KeypadModifier) != 0u))
|
||||||
{
|
{
|
||||||
if (qApp->Settings()->GetOsSeparator())
|
if (VAbstractApplication::VApp()->Settings()->GetOsSeparator())
|
||||||
{
|
{
|
||||||
textEdit->insert(QLocale().decimalPoint());
|
textEdit->insert(QLocale().decimalPoint());
|
||||||
}
|
}
|
||||||
|
@ -756,7 +756,7 @@ void TMainWindow::ExportToCSVData(const QString &fileName, bool withHeader, int
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QStringList TMainWindow::RecentFileList() const
|
QStringList TMainWindow::RecentFileList() const
|
||||||
{
|
{
|
||||||
return qApp->TapeSettings()->GetRecentFileList();
|
return MApplication::VApp()->TapeSettings()->GetRecentFileList();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -876,11 +876,11 @@ bool TMainWindow::FileSaveAs()
|
||||||
{
|
{
|
||||||
if (mType == MeasurementsType::Individual)
|
if (mType == MeasurementsType::Individual)
|
||||||
{
|
{
|
||||||
dir = qApp->TapeSettings()->GetPathIndividualMeasurements();
|
dir = MApplication::VApp()->TapeSettings()->GetPathIndividualMeasurements();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dir = qApp->TapeSettings()->GetPathMultisizeMeasurements();
|
dir = MApplication::VApp()->TapeSettings()->GetPathMultisizeMeasurements();
|
||||||
dir = VCommonSettings::PrepareMultisizeTables(dir);
|
dir = VCommonSettings::PrepareMultisizeTables(dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -897,7 +897,7 @@ bool TMainWindow::FileSaveAs()
|
||||||
}
|
}
|
||||||
|
|
||||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), dir + QChar('/') + fName, filters, nullptr,
|
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), dir + QChar('/') + fName, filters, nullptr,
|
||||||
qApp->NativeFileDialog());
|
VAbstractApplication::VApp()->NativeFileDialog());
|
||||||
|
|
||||||
auto RemoveTempDir = qScopeGuard([usedNotExistedDir, dir]()
|
auto RemoveTempDir = qScopeGuard([usedNotExistedDir, dir]()
|
||||||
{
|
{
|
||||||
|
@ -998,7 +998,7 @@ void TMainWindow::ShowWindow() const
|
||||||
if (v.canConvert<int>())
|
if (v.canConvert<int>())
|
||||||
{
|
{
|
||||||
const int offset = qvariant_cast<int>(v);
|
const int offset = qvariant_cast<int>(v);
|
||||||
const QList<TMainWindow*> windows = qApp->MainWindows();
|
const QList<TMainWindow*> windows = MApplication::VApp()->MainWindows();
|
||||||
windows.at(offset)->raise();
|
windows.at(offset)->raise();
|
||||||
windows.at(offset)->activateWindow();
|
windows.at(offset)->activateWindow();
|
||||||
}
|
}
|
||||||
|
@ -1017,7 +1017,7 @@ void TMainWindow::ImportDataFromCSV()
|
||||||
const QString suffix = QStringLiteral("csv");
|
const QString suffix = QStringLiteral("csv");
|
||||||
|
|
||||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Import from CSV"), QDir::homePath(), filters, nullptr,
|
QString fileName = QFileDialog::getOpenFileName(this, tr("Import from CSV"), QDir::homePath(), filters, nullptr,
|
||||||
qApp->NativeFileDialog());
|
VAbstractApplication::VApp()->NativeFileDialog());
|
||||||
|
|
||||||
if (fileName.isEmpty())
|
if (fileName.isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -1031,16 +1031,16 @@ void TMainWindow::ImportDataFromCSV()
|
||||||
}
|
}
|
||||||
|
|
||||||
DialogExportToCSV dialog(this);
|
DialogExportToCSV dialog(this);
|
||||||
dialog.SetWithHeader(qApp->Settings()->GetCSVWithHeader());
|
dialog.SetWithHeader(VAbstractApplication::VApp()->Settings()->GetCSVWithHeader());
|
||||||
dialog.SetSelectedMib(qApp->Settings()->GetCSVCodec());
|
dialog.SetSelectedMib(VAbstractApplication::VApp()->Settings()->GetCSVCodec());
|
||||||
dialog.SetSeparator(qApp->Settings()->GetCSVSeparator());
|
dialog.SetSeparator(VAbstractApplication::VApp()->Settings()->GetCSVSeparator());
|
||||||
dialog.ShowFilePreview(fileName);
|
dialog.ShowFilePreview(fileName);
|
||||||
|
|
||||||
if (dialog.exec() == QDialog::Accepted)
|
if (dialog.exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
qApp->Settings()->SetCSVSeparator(dialog.GetSeparator());
|
VAbstractApplication::VApp()->Settings()->SetCSVSeparator(dialog.GetSeparator());
|
||||||
qApp->Settings()->SetCSVCodec(dialog.GetSelectedMib());
|
VAbstractApplication::VApp()->Settings()->SetCSVCodec(dialog.GetSelectedMib());
|
||||||
qApp->Settings()->SetCSVWithHeader(dialog.IsWithHeader());
|
VAbstractApplication::VApp()->Settings()->SetCSVWithHeader(dialog.IsWithHeader());
|
||||||
|
|
||||||
QSharedPointer<DialogMeasurementsCSVColumns> columns;
|
QSharedPointer<DialogMeasurementsCSVColumns> columns;
|
||||||
if (m->Type() == MeasurementsType::Multisize)
|
if (m->Type() == MeasurementsType::Multisize)
|
||||||
|
@ -1365,7 +1365,8 @@ void TMainWindow::Fx()
|
||||||
auto *dialog = new DialogEditWrongFormula(meash->GetData(), NULL_ID, this);
|
auto *dialog = new DialogEditWrongFormula(meash->GetData(), NULL_ID, this);
|
||||||
dialog->setWindowTitle(tr("Edit measurement"));
|
dialog->setWindowTitle(tr("Edit measurement"));
|
||||||
dialog->SetMeasurementsMode();
|
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)
|
const QString postfix = UnitsToStr(mUnit, true);//Show unit in dialog lable (cm, mm or inch)
|
||||||
dialog->setPostfix(postfix);
|
dialog->setPostfix(postfix);
|
||||||
|
|
||||||
|
@ -1433,7 +1434,7 @@ void TMainWindow::AddKnown()
|
||||||
{
|
{
|
||||||
if (mType == MeasurementsType::Individual)
|
if (mType == MeasurementsType::Individual)
|
||||||
{
|
{
|
||||||
m->AddEmpty(name, qApp->TrVars()->MFormula(name));
|
m->AddEmpty(name, VAbstractApplication::VApp()->TrVars()->MFormula(name));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1452,7 +1453,7 @@ void TMainWindow::AddKnown()
|
||||||
{
|
{
|
||||||
if (mType == MeasurementsType::Individual)
|
if (mType == MeasurementsType::Individual)
|
||||||
{
|
{
|
||||||
m->AddEmptyAfter(after, name, qApp->TrVars()->MFormula(name));
|
m->AddEmptyAfter(after, name, VAbstractApplication::VApp()->TrVars()->MFormula(name));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1485,10 +1486,10 @@ void TMainWindow::ImportFromPattern()
|
||||||
|
|
||||||
const QString filter(tr("Pattern files (*.val)"));
|
const QString filter(tr("Pattern files (*.val)"));
|
||||||
//Use standard path to individual measurements
|
//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,
|
const QString mPath = QFileDialog::getOpenFileName(this, tr("Import from a pattern"), pathTo, filter, nullptr,
|
||||||
qApp->NativeFileDialog());
|
VAbstractApplication::VApp()->NativeFileDialog());
|
||||||
if (mPath.isEmpty())
|
if (mPath.isEmpty())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -1653,8 +1654,9 @@ void TMainWindow::ShowNewMData(bool fresh)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Show known
|
//Show known
|
||||||
ui->plainTextEditDescription->setPlainText(qApp->TrVars()->Description(meash->GetName()));
|
ui->plainTextEditDescription->setPlainText(
|
||||||
ui->lineEditFullName->setText(qApp->TrVars()->GuiText(meash->GetName()));
|
VAbstractApplication::VApp()->TrVars()->Description(meash->GetName()));
|
||||||
|
ui->lineEditFullName->setText(VAbstractApplication::VApp()->TrVars()->GuiText(meash->GetName()));
|
||||||
ui->lineEditName->setText(nameField->text());
|
ui->lineEditName->setText(nameField->text());
|
||||||
}
|
}
|
||||||
connect(ui->lineEditName, &QLineEdit::textEdited, this, &TMainWindow::SaveMName);
|
connect(ui->lineEditName, &QLineEdit::textEdited, this, &TMainWindow::SaveMName);
|
||||||
|
@ -1679,14 +1681,15 @@ void TMainWindow::ShowNewMData(bool fresh)
|
||||||
if (meash->IsSpecialUnits())
|
if (meash->IsSpecialUnits())
|
||||||
{
|
{
|
||||||
const qreal value = *data->DataVariables()->value(meash->GetName())->GetValue();
|
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
|
else
|
||||||
{
|
{
|
||||||
const QString postfix = UnitsToStr(pUnit);//Show unit in dialog lable (cm, mm or inch)
|
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,
|
const qreal value = UnitConvertor(*data->DataVariables()->value(meash->GetName())->GetValue(), mUnit,
|
||||||
pUnit);
|
pUnit);
|
||||||
calculatedValue = qApp->LocaleToString(value) + QChar(QChar::Space) + postfix;
|
calculatedValue = VAbstractApplication::VApp()->LocaleToString(value) + QChar(QChar::Space) + postfix;
|
||||||
}
|
}
|
||||||
ui->labelCalculatedValue->setText(calculatedValue);
|
ui->labelCalculatedValue->setText(calculatedValue);
|
||||||
|
|
||||||
|
@ -1714,7 +1717,9 @@ void TMainWindow::ShowNewMData(bool fresh)
|
||||||
|
|
||||||
ui->plainTextEditFormula->blockSignals(true);
|
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->setPlainText(formula);
|
||||||
ui->plainTextEditFormula->blockSignals(false);
|
ui->plainTextEditFormula->blockSignals(false);
|
||||||
|
@ -1736,7 +1741,7 @@ void TMainWindow::ShowNewMData(bool fresh)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TMainWindow::ShowMDiagram(const QString &name)
|
void TMainWindow::ShowMDiagram(const QString &name)
|
||||||
{
|
{
|
||||||
const VTranslateVars *trv = qApp->TrVars();
|
const VTranslateVars *trv = VAbstractApplication::VApp()->TrVars();
|
||||||
const QString number = trv->MNumber(name);
|
const QString number = trv->MNumber(name);
|
||||||
|
|
||||||
if (number.isEmpty())
|
if (number.isEmpty())
|
||||||
|
@ -1901,7 +1906,8 @@ void TMainWindow::SaveMValue()
|
||||||
|
|
||||||
try
|
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);
|
m->SetMValue(nameField->data(Qt::UserRole).toString(), formula);
|
||||||
}
|
}
|
||||||
catch (qmu::QmuParserError &e) // Just in case something bad will happen
|
catch (qmu::QmuParserError &e) // Just in case something bad will happen
|
||||||
|
@ -2189,7 +2195,7 @@ void TMainWindow::ExportToIndividual()
|
||||||
QString dir;
|
QString dir;
|
||||||
if (curFile.isEmpty())
|
if (curFile.isEmpty())
|
||||||
{
|
{
|
||||||
dir = qApp->TapeSettings()->GetPathIndividualMeasurements();
|
dir = MApplication::VApp()->TapeSettings()->GetPathIndividualMeasurements();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2206,7 +2212,7 @@ void TMainWindow::ExportToIndividual()
|
||||||
QString filters = tr("Individual measurements") + QStringLiteral(" (*.vit)");
|
QString filters = tr("Individual measurements") + QStringLiteral(" (*.vit)");
|
||||||
QString fName = tr("measurements.vit");
|
QString fName = tr("measurements.vit");
|
||||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Export to individual"), dir + QChar('/') + fName,
|
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]()
|
auto RemoveTempDir = qScopeGuard([usedNotExistedDir, dir]()
|
||||||
{
|
{
|
||||||
|
@ -2228,7 +2234,8 @@ void TMainWindow::ExportToIndividual()
|
||||||
fileName += QChar('.') + suffix;
|
fileName += QChar('.') + suffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
QScopedPointer<VContainer> tmpData(new VContainer(qApp->TrVars(), &mUnit, VContainer::UniqueNamespace()));
|
QScopedPointer<VContainer> tmpData(
|
||||||
|
new VContainer(VAbstractApplication::VApp()->TrVars(), &mUnit, VContainer::UniqueNamespace()));
|
||||||
|
|
||||||
VMeasurements individualMeasurements(mUnit, tmpData.data());
|
VMeasurements individualMeasurements(mUnit, tmpData.data());
|
||||||
|
|
||||||
|
@ -2409,7 +2416,7 @@ void TMainWindow::SetupMenu()
|
||||||
// Measurements
|
// Measurements
|
||||||
connect(ui->actionAddCustom, &QAction::triggered, this, &TMainWindow::AddCustom);
|
connect(ui->actionAddCustom, &QAction::triggered, this, &TMainWindow::AddCustom);
|
||||||
connect(ui->actionAddKnown, &QAction::triggered, this, &TMainWindow::AddKnown);
|
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);
|
connect(ui->actionImportFromPattern, &QAction::triggered, this, &TMainWindow::ImportFromPattern);
|
||||||
|
|
||||||
// Window
|
// Window
|
||||||
|
@ -2524,7 +2531,7 @@ void TMainWindow::InitWindow()
|
||||||
ui->comboBoxGender->setCurrentIndex(index);
|
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->setLocale(dateLocale);
|
||||||
ui->dateEditBirthDate->setDisplayFormat(dateLocale.dateFormat());
|
ui->dateEditBirthDate->setDisplayFormat(dateLocale.dateFormat());
|
||||||
ui->dateEditBirthDate->setDate(m->BirthDate());
|
ui->dateEditBirthDate->setDate(m->BirthDate());
|
||||||
|
@ -2969,7 +2976,7 @@ void TMainWindow::SetCurrentFile(const QString &fileName)
|
||||||
ui->lineEditPathToFile->setToolTip(QDir::toNativeSeparators(curFile));
|
ui->lineEditPathToFile->setToolTip(QDir::toNativeSeparators(curFile));
|
||||||
ui->lineEditPathToFile->setCursorPosition(0);
|
ui->lineEditPathToFile->setCursorPosition(0);
|
||||||
ui->pushButtonShowInExplorer->setEnabled(true);
|
ui->pushButtonShowInExplorer->setEnabled(true);
|
||||||
auto settings = qApp->TapeSettings();
|
auto settings = MApplication::VApp()->TapeSettings();
|
||||||
QStringList files = settings->GetRecentFileList();
|
QStringList files = settings->GetRecentFileList();
|
||||||
files.removeAll(fileName);
|
files.removeAll(fileName);
|
||||||
files.prepend(fileName);
|
files.prepend(fileName);
|
||||||
|
@ -3100,8 +3107,8 @@ void TMainWindow::RefreshTable(bool freshCall)
|
||||||
|
|
||||||
if (mType == MeasurementsType::Individual)
|
if (mType == MeasurementsType::Individual)
|
||||||
{
|
{
|
||||||
QTableWidgetItem *item = AddCell(qApp->TrVars()->MToUser(meash->GetName()), currentRow, ColumnName,
|
QTableWidgetItem *item = AddCell(VAbstractApplication::VApp()->TrVars()->MToUser(meash->GetName()),
|
||||||
Qt::AlignVCenter); // name
|
currentRow, ColumnName, Qt::AlignVCenter); // name
|
||||||
item->setData(Qt::UserRole, meash->GetName());
|
item->setData(Qt::UserRole, meash->GetName());
|
||||||
|
|
||||||
if (meash->IsCustom())
|
if (meash->IsCustom())
|
||||||
|
@ -3110,7 +3117,8 @@ void TMainWindow::RefreshTable(bool freshCall)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AddCell(qApp->TrVars()->GuiText(meash->GetName()), currentRow, ColumnFullName, Qt::AlignVCenter);
|
AddCell(VAbstractApplication::VApp()->TrVars()->GuiText(meash->GetName()), currentRow, ColumnFullName,
|
||||||
|
Qt::AlignVCenter);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString calculatedValue;
|
QString calculatedValue;
|
||||||
|
@ -3126,14 +3134,16 @@ void TMainWindow::RefreshTable(bool freshCall)
|
||||||
AddCell(calculatedValue, currentRow, ColumnCalcValue, Qt::AlignHCenter | Qt::AlignVCenter,
|
AddCell(calculatedValue, currentRow, ColumnCalcValue, Qt::AlignHCenter | Qt::AlignVCenter,
|
||||||
meash->IsFormulaOk()); // calculated value
|
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
|
AddCell(formula, currentRow, ColumnFormula, Qt::AlignVCenter); // formula
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QTableWidgetItem *item = AddCell(qApp->TrVars()->MToUser(meash->GetName()), currentRow, 0,
|
QTableWidgetItem *item = AddCell(VAbstractApplication::VApp()->TrVars()->MToUser(meash->GetName()),
|
||||||
Qt::AlignVCenter); // name
|
currentRow, 0, Qt::AlignVCenter); // name
|
||||||
item->setData(Qt::UserRole, meash->GetName());
|
item->setData(Qt::UserRole, meash->GetName());
|
||||||
|
|
||||||
if (meash->IsCustom())
|
if (meash->IsCustom())
|
||||||
|
@ -3142,7 +3152,8 @@ void TMainWindow::RefreshTable(bool freshCall)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AddCell(qApp->TrVars()->GuiText(meash->GetName()), currentRow, ColumnFullName, Qt::AlignVCenter);
|
AddCell(VAbstractApplication::VApp()->TrVars()->GuiText(meash->GetName()), currentRow, ColumnFullName,
|
||||||
|
Qt::AlignVCenter);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString calculatedValue;
|
QString calculatedValue;
|
||||||
|
@ -3196,7 +3207,8 @@ QString TMainWindow::GetCustomName() const
|
||||||
QString name;
|
QString name;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
name = CustomMSign + qApp->TrVars()->InternalVarToUser(measurement_) + QString::number(num);
|
name = CustomMSign + VAbstractApplication::VApp()->TrVars()->InternalVarToUser(measurement_) +
|
||||||
|
QString::number(num);
|
||||||
num++;
|
num++;
|
||||||
} while (not data->IsUnique(name));
|
} while (not data->IsUnique(name));
|
||||||
|
|
||||||
|
@ -3305,7 +3317,7 @@ void TMainWindow::UpdateWindowTitle()
|
||||||
}
|
}
|
||||||
else
|
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");
|
mType == MeasurementsType::Multisize ? showName += QLatin1String(".vst") : showName += QLatin1String(".vit");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3375,7 +3387,8 @@ bool TMainWindow::EvalFormula(const QString &formula, bool fromUser, VContainer
|
||||||
QString f;
|
QString f;
|
||||||
if (fromUser)
|
if (fromUser)
|
||||||
{
|
{
|
||||||
f = qApp->TrVars()->FormulaFromUser(formula, qApp->Settings()->GetOsSeparator());
|
f = VAbstractApplication::VApp()->TrVars()
|
||||||
|
->FormulaFromUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -3396,7 +3409,7 @@ bool TMainWindow::EvalFormula(const QString &formula, bool fromUser, VContainer
|
||||||
result = UnitConvertor(result, mUnit, pUnit);
|
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"));
|
label->setToolTip(tr("Value"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -3412,7 +3425,7 @@ bool TMainWindow::EvalFormula(const QString &formula, bool fromUser, VContainer
|
||||||
void TMainWindow::Open(const QString &pathTo, const QString &filter)
|
void TMainWindow::Open(const QString &pathTo, const QString &filter)
|
||||||
{
|
{
|
||||||
const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), pathTo, filter, nullptr,
|
const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), pathTo, filter, nullptr,
|
||||||
qApp->NativeFileDialog());
|
VAbstractApplication::VApp()->NativeFileDialog());
|
||||||
|
|
||||||
if (not mPath.isEmpty())
|
if (not mPath.isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -3422,7 +3435,7 @@ void TMainWindow::Open(const QString &pathTo, const QString &filter)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qApp->NewMainWindow()->LoadFile(mPath);
|
MApplication::VApp()->NewMainWindow()->LoadFile(mPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3465,7 +3478,7 @@ void TMainWindow::MeasurementGUI()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TMainWindow::ReadSettings()
|
void TMainWindow::ReadSettings()
|
||||||
{
|
{
|
||||||
const VTapeSettings *settings = qApp->TapeSettings();
|
const VTapeSettings *settings = MApplication::VApp()->TapeSettings();
|
||||||
|
|
||||||
if (settings->status() == QSettings::NoError)
|
if (settings->status() == QSettings::NoError)
|
||||||
{
|
{
|
||||||
|
@ -3477,7 +3490,7 @@ void TMainWindow::ReadSettings()
|
||||||
ToolBarStyles();
|
ToolBarStyles();
|
||||||
|
|
||||||
// Stack limit
|
// Stack limit
|
||||||
//qApp->getUndoStack()->setUndoLimit(settings->GetUndoCount());
|
//VAbstractApplication::VApp()->getUndoStack()->setUndoLimit(settings->GetUndoCount());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -3488,7 +3501,7 @@ void TMainWindow::ReadSettings()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TMainWindow::WriteSettings()
|
void TMainWindow::WriteSettings()
|
||||||
{
|
{
|
||||||
VTapeSettings *settings = qApp->TapeSettings();
|
VTapeSettings *settings = MApplication::VApp()->TapeSettings();
|
||||||
settings->SetGeometry(saveGeometry());
|
settings->SetGeometry(saveGeometry());
|
||||||
settings->SetWindowState(saveState());
|
settings->SetWindowState(saveState());
|
||||||
settings->SetToolbarsState(saveState(APP_VERSION));
|
settings->SetToolbarsState(saveState(APP_VERSION));
|
||||||
|
@ -3531,7 +3544,7 @@ bool TMainWindow::LoadFromExistingFile(const QString &path)
|
||||||
if (not QFileInfo::exists(path))
|
if (not QFileInfo::exists(path))
|
||||||
{
|
{
|
||||||
qCCritical(tMainWindow, "%s", qUtf8Printable(tr("File '%1' doesn't exist!").arg(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);
|
qApp->exit(V_EX_NOINPUT);
|
||||||
}
|
}
|
||||||
|
@ -3539,7 +3552,7 @@ bool TMainWindow::LoadFromExistingFile(const QString &path)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if file already opened
|
// Check if file already opened
|
||||||
const QList<TMainWindow*> list = qApp->MainWindows();
|
const QList<TMainWindow*> list = MApplication::VApp()->MainWindows();
|
||||||
for (auto w : list)
|
for (auto w : list)
|
||||||
{
|
{
|
||||||
if (w->CurrentFile() == path)
|
if (w->CurrentFile() == path)
|
||||||
|
@ -3562,7 +3575,7 @@ bool TMainWindow::LoadFromExistingFile(const QString &path)
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
data = new VContainer(qApp->TrVars(), &mUnit, VContainer::UniqueNamespace());
|
data = new VContainer(VAbstractApplication::VApp()->TrVars(), &mUnit, VContainer::UniqueNamespace());
|
||||||
|
|
||||||
m = new VMeasurements(data);
|
m = new VMeasurements(data);
|
||||||
m->setXMLContent(path);
|
m->setXMLContent(path);
|
||||||
|
@ -3628,7 +3641,7 @@ bool TMainWindow::LoadFromExistingFile(const QString &path)
|
||||||
data = nullptr;
|
data = nullptr;
|
||||||
lock.reset();
|
lock.reset();
|
||||||
|
|
||||||
if (qApp->IsTestMode())
|
if (MApplication::VApp()->IsTestMode())
|
||||||
{
|
{
|
||||||
qApp->exit(V_EX_NOINPUT);
|
qApp->exit(V_EX_NOINPUT);
|
||||||
}
|
}
|
||||||
|
@ -3637,7 +3650,7 @@ bool TMainWindow::LoadFromExistingFile(const QString &path)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return qApp->NewMainWindow()->LoadFile(path);
|
return MApplication::VApp()->NewMainWindow()->LoadFile(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -3651,12 +3664,12 @@ void TMainWindow::CreateWindowMenu(QMenu *menu)
|
||||||
QAction *action = menu->addAction(tr("&New Window"));
|
QAction *action = menu->addAction(tr("&New Window"));
|
||||||
connect(action, &QAction::triggered, this, []()
|
connect(action, &QAction::triggered, this, []()
|
||||||
{
|
{
|
||||||
qApp->NewMainWindow()->activateWindow();
|
MApplication::VApp()->NewMainWindow()->activateWindow();
|
||||||
});
|
});
|
||||||
action->setMenuRole(QAction::NoRole);
|
action->setMenuRole(QAction::NoRole);
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
|
|
||||||
const QList<TMainWindow*> windows = qApp->MainWindows();
|
const QList<TMainWindow*> windows = MApplication::VApp()->MainWindows();
|
||||||
for (int i = 0; i < windows.count(); ++i)
|
for (int i = 0; i < windows.count(); ++i)
|
||||||
{
|
{
|
||||||
TMainWindow *window = windows.at(i);
|
TMainWindow *window = windows.at(i);
|
||||||
|
@ -3683,7 +3696,7 @@ void TMainWindow::CreateWindowMenu(QMenu *menu)
|
||||||
bool TMainWindow::IgnoreLocking(int error, const QString &path)
|
bool TMainWindow::IgnoreLocking(int error, const QString &path)
|
||||||
{
|
{
|
||||||
QMessageBox::StandardButton answer = QMessageBox::Abort;
|
QMessageBox::StandardButton answer = QMessageBox::Abort;
|
||||||
if (not qApp->IsTestMode())
|
if (not MApplication::VApp()->IsTestMode())
|
||||||
{
|
{
|
||||||
switch(error)
|
switch(error)
|
||||||
{
|
{
|
||||||
|
@ -3717,7 +3730,7 @@ bool TMainWindow::IgnoreLocking(int error, const QString &path)
|
||||||
{
|
{
|
||||||
qCDebug(tMainWindow, "Failed to lock %s", qUtf8Printable(path));
|
qCDebug(tMainWindow, "Failed to lock %s", qUtf8Printable(path));
|
||||||
qCDebug(tMainWindow, "Error type: %d", error);
|
qCDebug(tMainWindow, "Error type: %d", error);
|
||||||
if (qApp->IsTestMode())
|
if (MApplication::VApp()->IsTestMode())
|
||||||
{
|
{
|
||||||
switch(error)
|
switch(error)
|
||||||
{
|
{
|
||||||
|
@ -3898,13 +3911,14 @@ void TMainWindow::ImportIndividualMeasurements(const QxtCsvModel &csv, const QVe
|
||||||
}
|
}
|
||||||
|
|
||||||
IndividualMeasurement measurement;
|
IndividualMeasurement measurement;
|
||||||
const QString mName = CheckMName(qApp->TrVars()->MFromUser(name), importedNames);
|
const QString mName = CheckMName(VAbstractApplication::VApp()->TrVars()->MFromUser(name), importedNames);
|
||||||
importedNames.insert(mName);
|
importedNames.insert(mName);
|
||||||
measurement.name = mName;
|
measurement.name = mName;
|
||||||
|
|
||||||
const int valueColumn = map.at(static_cast<int>(IndividualMeasurementsColumns::Value));
|
const int valueColumn = map.at(static_cast<int>(IndividualMeasurementsColumns::Value));
|
||||||
measurement.value = VTranslateVars::TryFormulaFromUser(csv.text(i, valueColumn),
|
measurement.value =
|
||||||
qApp->Settings()->GetOsSeparator());
|
VTranslateVars::TryFormulaFromUser(csv.text(i, valueColumn),
|
||||||
|
VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
|
|
||||||
const bool custom = name.startsWith(CustomMSign);
|
const bool custom = name.startsWith(CustomMSign);
|
||||||
if (columns > 2 && custom)
|
if (columns > 2 && custom)
|
||||||
|
@ -3967,7 +3981,7 @@ void TMainWindow::ImportMultisizeMeasurements(const QxtCsvModel &csv, const QVec
|
||||||
auto ConverToDouble = [](QString text, const QString &error)
|
auto ConverToDouble = [](QString text, const QString &error)
|
||||||
{
|
{
|
||||||
text.replace(" ", QString());
|
text.replace(" ", QString());
|
||||||
text = VTranslateVars::TryFormulaFromUser(text, qApp->Settings()->GetOsSeparator());
|
text = VTranslateVars::TryFormulaFromUser(text, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
|
|
||||||
const qreal value = QLocale::c().toDouble(text, &ok);
|
const qreal value = QLocale::c().toDouble(text, &ok);
|
||||||
|
@ -4013,7 +4027,7 @@ void TMainWindow::ImportMultisizeMeasurements(const QxtCsvModel &csv, const QVec
|
||||||
}
|
}
|
||||||
|
|
||||||
MultisizeMeasurement measurement;
|
MultisizeMeasurement measurement;
|
||||||
const QString mName = CheckMName(qApp->TrVars()->MFromUser(name), importedNames);
|
const QString mName = CheckMName(VAbstractApplication::VApp()->TrVars()->MFromUser(name), importedNames);
|
||||||
importedNames.insert(mName);
|
importedNames.insert(mName);
|
||||||
measurement.name = mName;
|
measurement.name = mName;
|
||||||
|
|
||||||
|
|
|
@ -148,7 +148,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
||||||
}
|
}
|
||||||
|
|
||||||
QString logMsg = msg;
|
QString logMsg = msg;
|
||||||
const bool isPatternMessage = qApp->IsWarningMessage(msg);
|
const bool isPatternMessage = VAbstractApplication::VApp()->IsWarningMessage(msg);
|
||||||
if (isPatternMessage)
|
if (isPatternMessage)
|
||||||
{
|
{
|
||||||
logMsg = logMsg.remove(VAbstractValApplication::warningMessageSignature);
|
logMsg = logMsg.remove(VAbstractValApplication::warningMessageSignature);
|
||||||
|
@ -167,7 +167,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
||||||
case QtWarningMsg:
|
case QtWarningMsg:
|
||||||
if (isPatternMessage)
|
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)
|
debugdate += QStringLiteral(":WARNING:%1(%2)] %3: %4: %5").arg(context.file).arg(context.line)
|
||||||
.arg(context.function, context.category, logMsg);
|
.arg(context.function, context.category, logMsg);
|
||||||
|
@ -176,7 +176,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
||||||
case QtCriticalMsg:
|
case QtCriticalMsg:
|
||||||
if (isPatternMessage)
|
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)
|
debugdate += QStringLiteral(":CRITICAL:%1(%2)] %3: %4: %5").arg(context.file).arg(context.line)
|
||||||
.arg(context.function, context.category, logMsg);
|
.arg(context.function, context.category, logMsg);
|
||||||
|
@ -191,7 +191,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
||||||
case QtInfoMsg:
|
case QtInfoMsg:
|
||||||
if (isPatternMessage)
|
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)
|
debugdate += QStringLiteral(":INFO:%1(%2)] %3: %4: %5").arg(context.file).arg(context.line)
|
||||||
.arg(context.function, context.category, logMsg);
|
.arg(context.function, context.category, logMsg);
|
||||||
|
@ -205,9 +205,9 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
||||||
vStdErr().flush();
|
vStdErr().flush();
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||||
(*qApp->LogFile()) << debugdate << endl;
|
(*VApplication::VApp()->LogFile()) << debugdate << endl;
|
||||||
#else
|
#else
|
||||||
(*qApp->LogFile()) << debugdate << Qt::endl;
|
(*VApplication::VApp()->LogFile()) << debugdate << Qt::endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -436,7 +436,7 @@ bool VApplication::notify(QObject *receiver, QEvent *event)
|
||||||
|
|
||||||
void VApplication::ActivateDarkMode()
|
void VApplication::ActivateDarkMode()
|
||||||
{
|
{
|
||||||
VSettings *settings = qApp->ValentinaSettings();
|
VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
|
||||||
if (settings->GetDarkMode())
|
if (settings->GetDarkMode())
|
||||||
{
|
{
|
||||||
QFile f(QStringLiteral(":qdarkstyle/style.qss"));
|
QFile f(QStringLiteral(":qdarkstyle/style.qss"));
|
||||||
|
@ -769,6 +769,12 @@ bool VApplication::IsPedantic() const
|
||||||
return (VCommandLine::instance != nullptr) && VCommandLine::instance->IsPedantic();
|
return (VCommandLine::instance != nullptr) && VCommandLine::instance->IsPedantic();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VApplication::VApp() -> VApplication *
|
||||||
|
{
|
||||||
|
return qobject_cast<VApplication*>(QCoreApplication::instance());
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
const VCommandLinePtr VApplication::CommandLine() const
|
const VCommandLinePtr VApplication::CommandLine() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,11 +37,6 @@
|
||||||
|
|
||||||
class VApplication;// use in define
|
class VApplication;// use in define
|
||||||
|
|
||||||
#if defined(qApp)
|
|
||||||
#undef qApp
|
|
||||||
#endif
|
|
||||||
#define qApp (qobject_cast<VApplication*>(VAbstractApplication::instance()))
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The VApplication class reimplamentation QApplication class.
|
* @brief The VApplication class reimplamentation QApplication class.
|
||||||
*/
|
*/
|
||||||
|
@ -74,6 +69,8 @@ public:
|
||||||
virtual bool IsAppInGUIMode() const override;
|
virtual bool IsAppInGUIMode() const override;
|
||||||
virtual bool IsPedantic() const override;
|
virtual bool IsPedantic() const override;
|
||||||
|
|
||||||
|
static VApplication *VApp();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void InitTrVars() override;
|
virtual void InitTrVars() override;
|
||||||
virtual bool event(QEvent *e) override;
|
virtual bool event(QEvent *e) override;
|
||||||
|
|
|
@ -45,7 +45,7 @@ VFormulaProperty::VFormulaProperty(const QString &name)
|
||||||
addChild(tmpFormula);
|
addChild(tmpFormula);
|
||||||
tmpFormula->setClearButtonEnable(true);
|
tmpFormula->setClearButtonEnable(true);
|
||||||
tmpFormula->setUpdateBehaviour(true, false);
|
tmpFormula->setUpdateBehaviour(true, false);
|
||||||
tmpFormula->setOsSeparator(qApp->Settings()->GetOsSeparator());
|
tmpFormula->setOsSeparator(VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
|
|
||||||
// Cannot use virtual function setValue in constructor
|
// Cannot use virtual function setValue in constructor
|
||||||
SetFormula(QVariant(0).value<VFormula>());
|
SetFormula(QVariant(0).value<VFormula>());
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
|
|
||||||
#include "../vpropertyexplorer/vproperty.h"
|
#include "../vpropertyexplorer/vproperty.h"
|
||||||
#include "../vtools/dialogs/support/dialogeditwrongformula.h"
|
#include "../vtools/dialogs/support/dialogeditwrongformula.h"
|
||||||
|
#include "vapplication.h"
|
||||||
|
|
||||||
// VFormulaPropertyEditor
|
// VFormulaPropertyEditor
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -87,8 +88,9 @@ void VFormulaPropertyEditor::SetFormula(const VFormula& formula)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VFormulaPropertyEditor::onToolButtonClicked()
|
void VFormulaPropertyEditor::onToolButtonClicked()
|
||||||
{
|
{
|
||||||
QScopedPointer<DialogEditWrongFormula> tmpWidget(new DialogEditWrongFormula(formula.getData(), formula.getToolId(),
|
QScopedPointer<DialogEditWrongFormula> tmpWidget(
|
||||||
qApp->getMainWindow()));
|
new DialogEditWrongFormula(formula.getData(), formula.getToolId(),
|
||||||
|
VAbstractValApplication::VApp()->getMainWindow()));
|
||||||
tmpWidget->setCheckZero(formula.getCheckZero());
|
tmpWidget->setCheckZero(formula.getCheckZero());
|
||||||
tmpWidget->setPostfix(formula.getPostfix());
|
tmpWidget->setPostfix(formula.getPostfix());
|
||||||
tmpWidget->SetFormula(formula.GetFormula(FormulaType::FromUser));
|
tmpWidget->SetFormula(formula.GetFormula(FormulaType::FromUser));
|
||||||
|
|
|
@ -460,7 +460,7 @@ void VToolOptionsPropertyBrowser::userChangedData(VPE::VProperty *property)
|
||||||
default:
|
default:
|
||||||
break;
|
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);
|
auto *itemName = new VPE::VStringProperty(propertyName);
|
||||||
itemName->setClearButtonEnable(true);
|
itemName->setClearButtonEnable(true);
|
||||||
itemName->setValue(qApp->TrVars()->VarToUser(i->GetAliasSuffix()));
|
itemName->setValue(VAbstractApplication::VApp()->TrVars()->VarToUser(i->GetAliasSuffix()));
|
||||||
AddProperty(itemName, AttrAlias);
|
AddProperty(itemName, AttrAlias);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -550,7 +550,7 @@ void VToolOptionsPropertyBrowser::AddPropertyAlias1(Tool *i, const QString &prop
|
||||||
{
|
{
|
||||||
auto *itemName = new VPE::VStringProperty(propertyName);
|
auto *itemName = new VPE::VStringProperty(propertyName);
|
||||||
itemName->setClearButtonEnable(true);
|
itemName->setClearButtonEnable(true);
|
||||||
itemName->setValue(qApp->TrVars()->VarToUser(i->GetAliasSuffix1()));
|
itemName->setValue(VAbstractApplication::VApp()->TrVars()->VarToUser(i->GetAliasSuffix1()));
|
||||||
AddProperty(itemName, AttrAlias1);
|
AddProperty(itemName, AttrAlias1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -560,7 +560,7 @@ void VToolOptionsPropertyBrowser::AddPropertyAlias2(Tool *i, const QString &prop
|
||||||
{
|
{
|
||||||
auto *itemName = new VPE::VStringProperty(propertyName);
|
auto *itemName = new VPE::VStringProperty(propertyName);
|
||||||
itemName->setClearButtonEnable(true);
|
itemName->setClearButtonEnable(true);
|
||||||
itemName->setValue(qApp->TrVars()->VarToUser(i->GetAliasSuffix2()));
|
itemName->setValue(VAbstractApplication::VApp()->TrVars()->VarToUser(i->GetAliasSuffix2()));
|
||||||
AddProperty(itemName, AttrAlias2);
|
AddProperty(itemName, AttrAlias2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2066,14 +2066,16 @@ void VToolOptionsPropertyBrowser::ChangeDataToolSpline(VPE::VProperty *property)
|
||||||
case 36: // AttrLength1
|
case 36: // AttrLength1
|
||||||
if (not f.error() && f.getDoubleValue() >= 0)
|
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);
|
i->setSpline(spl);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 37: // AttrLength2
|
case 37: // AttrLength2
|
||||||
if (not f.error() && f.getDoubleValue() >= 0)
|
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);
|
i->setSpline(spl);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -2887,7 +2889,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolSpline(QGraphicsItem *item)
|
||||||
VFormula length1(spl.GetC1LengthFormula(), i->getData());
|
VFormula length1(spl.GetC1LengthFormula(), i->getData());
|
||||||
length1.setCheckZero(false);
|
length1.setCheckZero(false);
|
||||||
length1.setToolId(i->getId());
|
length1.setToolId(i->getId());
|
||||||
length1.setPostfix(UnitsToStr(qApp->patternUnits()));
|
length1.setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits()));
|
||||||
length1.Eval();
|
length1.Eval();
|
||||||
AddPropertyFormula(tr("C1: length:"), length1, AttrLength1);
|
AddPropertyFormula(tr("C1: length:"), length1, AttrLength1);
|
||||||
|
|
||||||
|
@ -2901,7 +2903,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolSpline(QGraphicsItem *item)
|
||||||
VFormula length2(spl.GetC2LengthFormula(), i->getData());
|
VFormula length2(spl.GetC2LengthFormula(), i->getData());
|
||||||
length2.setCheckZero(false);
|
length2.setCheckZero(false);
|
||||||
length2.setToolId(i->getId());
|
length2.setToolId(i->getId());
|
||||||
length2.setPostfix(UnitsToStr(qApp->patternUnits()));
|
length2.setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits()));
|
||||||
length2.Eval();
|
length2.Eval();
|
||||||
AddPropertyFormula(tr("C2: length:"), length2, AttrLength2);
|
AddPropertyFormula(tr("C2: length:"), length2, AttrLength2);
|
||||||
|
|
||||||
|
@ -3693,7 +3695,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSpline()
|
||||||
VFormula length1F(spl.GetC1LengthFormula(), i->getData());
|
VFormula length1F(spl.GetC1LengthFormula(), i->getData());
|
||||||
length1F.setCheckZero(false);
|
length1F.setCheckZero(false);
|
||||||
length1F.setToolId(i->getId());
|
length1F.setToolId(i->getId());
|
||||||
length1F.setPostfix(UnitsToStr(qApp->patternUnits()));
|
length1F.setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits()));
|
||||||
length1F.Eval();
|
length1F.Eval();
|
||||||
QVariant length1;
|
QVariant length1;
|
||||||
length1.setValue(length1F);
|
length1.setValue(length1F);
|
||||||
|
@ -3711,7 +3713,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSpline()
|
||||||
VFormula length2F(spl.GetC2LengthFormula(), i->getData());
|
VFormula length2F(spl.GetC2LengthFormula(), i->getData());
|
||||||
length2F.setCheckZero(false);
|
length2F.setCheckZero(false);
|
||||||
length2F.setToolId(i->getId());
|
length2F.setToolId(i->getId());
|
||||||
length2F.setPostfix(UnitsToStr(qApp->patternUnits()));
|
length2F.setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits()));
|
||||||
length2F.Eval();
|
length2F.Eval();
|
||||||
QVariant length2;
|
QVariant length2;
|
||||||
length2.setValue(length2F);
|
length2.setValue(length2F);
|
||||||
|
|
|
@ -51,7 +51,7 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent)
|
||||||
ui->tabWidget->setCurrentIndex(0);
|
ui->tabWidget->setCurrentIndex(0);
|
||||||
|
|
||||||
// Tab General
|
// Tab General
|
||||||
ui->autoSaveCheck->setChecked(qApp->ValentinaSettings()->GetAutosaveState());
|
ui->autoSaveCheck->setChecked(VAbstractValApplication::VApp()->ValentinaSettings()->GetAutosaveState());
|
||||||
|
|
||||||
InitLanguages(ui->langCombo);
|
InitLanguages(ui->langCombo);
|
||||||
connect(ui->langCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this]()
|
connect(ui->langCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this]()
|
||||||
|
@ -60,11 +60,11 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent)
|
||||||
});
|
});
|
||||||
|
|
||||||
//-------------------- Decimal separator setup
|
//-------------------- Decimal separator setup
|
||||||
ui->osOptionCheck->setChecked(qApp->ValentinaSettings()->GetOsSeparator());
|
ui->osOptionCheck->setChecked(VAbstractValApplication::VApp()->ValentinaSettings()->GetOsSeparator());
|
||||||
|
|
||||||
//----------------------- Unit setup
|
//----------------------- Unit setup
|
||||||
// set default unit
|
// 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)
|
if (indexUnit != -1)
|
||||||
{
|
{
|
||||||
ui->unitCombo->setCurrentIndex(indexUnit);
|
ui->unitCombo->setCurrentIndex(indexUnit);
|
||||||
|
@ -78,7 +78,7 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent)
|
||||||
//----------------------- Label language
|
//----------------------- Label language
|
||||||
SetLabelComboBox(VApplication::LabelLanguages());
|
SetLabelComboBox(VApplication::LabelLanguages());
|
||||||
|
|
||||||
int index = ui->labelCombo->findData(qApp->ValentinaSettings()->GetLabelLanguage());
|
int index = ui->labelCombo->findData(VAbstractValApplication::VApp()->ValentinaSettings()->GetLabelLanguage());
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
{
|
{
|
||||||
ui->labelCombo->setCurrentIndex(index);
|
ui->labelCombo->setCurrentIndex(index);
|
||||||
|
@ -93,16 +93,17 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent)
|
||||||
connect(ui->systemCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this]()
|
connect(ui->systemCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this]()
|
||||||
{
|
{
|
||||||
m_systemChanged = true;
|
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->setText(text);
|
||||||
ui->systemAuthorValueLabel->setToolTip(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);
|
ui->systemBookValueLabel->setPlainText(text);
|
||||||
});
|
});
|
||||||
|
|
||||||
// set default pattern making system
|
// set default pattern making system
|
||||||
index = ui->systemCombo->findData(qApp->ValentinaSettings()->GetPMSystemCode());
|
index = ui->systemCombo->findData(VAbstractValApplication::VApp()->ValentinaSettings()->GetPMSystemCode());
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
{
|
{
|
||||||
ui->systemCombo->setCurrentIndex(index);
|
ui->systemCombo->setCurrentIndex(index);
|
||||||
|
@ -111,13 +112,13 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent)
|
||||||
//----------------------------- Pattern Editing
|
//----------------------------- Pattern Editing
|
||||||
connect(ui->resetWarningsButton, &QPushButton::released, this, []()
|
connect(ui->resetWarningsButton, &QPushButton::released, this, []()
|
||||||
{
|
{
|
||||||
VSettings *settings = qApp->ValentinaSettings();
|
VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
|
||||||
|
|
||||||
settings->SetConfirmItemDelete(true);
|
settings->SetConfirmItemDelete(true);
|
||||||
settings->SetConfirmFormatRewriting(true);
|
settings->SetConfirmFormatRewriting(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
VSettings *settings = qApp->ValentinaSettings();
|
VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
|
||||||
|
|
||||||
ui->checkBoxFreeCurve->setChecked(settings->IsFreeCurveMode());
|
ui->checkBoxFreeCurve->setChecked(settings->IsFreeCurveMode());
|
||||||
ui->checkBoxZoomFitBestCurrentPP->setChecked(settings->IsDoubleClickZoomFitBestCurrentPP());
|
ui->checkBoxZoomFitBestCurrentPP->setChecked(settings->IsDoubleClickZoomFitBestCurrentPP());
|
||||||
|
@ -167,11 +168,11 @@ QStringList PreferencesConfigurationPage::Apply()
|
||||||
{
|
{
|
||||||
// Tab General
|
// Tab General
|
||||||
QStringList preferences;
|
QStringList preferences;
|
||||||
VSettings *settings = qApp->ValentinaSettings();
|
VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
|
||||||
settings->SetAutosaveState(ui->autoSaveCheck->isChecked());
|
settings->SetAutosaveState(ui->autoSaveCheck->isChecked());
|
||||||
settings->SetAutosaveTime(ui->autoTime->value());
|
settings->SetAutosaveTime(ui->autoTime->value());
|
||||||
|
|
||||||
QTimer *autoSaveTimer = qApp->getAutoSaveTimer();
|
QTimer *autoSaveTimer = VApplication::VApp()->getAutoSaveTimer();
|
||||||
SCASSERT(autoSaveTimer)
|
SCASSERT(autoSaveTimer)
|
||||||
|
|
||||||
ui->autoSaveCheck->isChecked() ? autoSaveTimer->start(ui->autoTime->value()*60000) : autoSaveTimer->stop();
|
ui->autoSaveCheck->isChecked() ? autoSaveTimer->start(ui->autoTime->value()*60000) : autoSaveTimer->stop();
|
||||||
|
@ -208,7 +209,7 @@ QStringList PreferencesConfigurationPage::Apply()
|
||||||
settings->SetPMSystemCode(code);
|
settings->SetPMSystemCode(code);
|
||||||
m_systemChanged = false;
|
m_systemChanged = false;
|
||||||
|
|
||||||
qApp->LoadTranslation(locale);
|
VAbstractApplication::VApp()->LoadTranslation(locale);
|
||||||
}
|
}
|
||||||
if (m_unitChanged)
|
if (m_unitChanged)
|
||||||
{
|
{
|
||||||
|
|
|
@ -65,7 +65,7 @@ PreferencesPathPage::~PreferencesPathPage()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QStringList PreferencesPathPage::Apply()
|
QStringList PreferencesPathPage::Apply()
|
||||||
{
|
{
|
||||||
VSettings *settings = qApp->ValentinaSettings();
|
VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
|
||||||
settings->SetPathIndividualMeasurements(ui->pathTable->item(0, 1)->text());
|
settings->SetPathIndividualMeasurements(ui->pathTable->item(0, 1)->text());
|
||||||
settings->SetPathMultisizeMeasurements(ui->pathTable->item(1, 1)->text());
|
settings->SetPathMultisizeMeasurements(ui->pathTable->item(1, 1)->text());
|
||||||
settings->SetPathPattern(ui->pathTable->item(2, 1)->text());
|
settings->SetPathPattern(ui->pathTable->item(2, 1)->text());
|
||||||
|
@ -137,23 +137,23 @@ void PreferencesPathPage::EditPath()
|
||||||
switch (row)
|
switch (row)
|
||||||
{
|
{
|
||||||
case 0: // individual measurements
|
case 0: // individual measurements
|
||||||
path = qApp->ValentinaSettings()->GetPathIndividualMeasurements();
|
path = VAbstractValApplication::VApp()->ValentinaSettings()->GetPathIndividualMeasurements();
|
||||||
break;
|
break;
|
||||||
case 1: // multisize measurements
|
case 1: // multisize measurements
|
||||||
path = qApp->ValentinaSettings()->GetPathMultisizeMeasurements();
|
path = VAbstractValApplication::VApp()->ValentinaSettings()->GetPathMultisizeMeasurements();
|
||||||
path = VCommonSettings::PrepareMultisizeTables(path);
|
path = VCommonSettings::PrepareMultisizeTables(path);
|
||||||
break;
|
break;
|
||||||
case 2: // pattern path
|
case 2: // pattern path
|
||||||
path = qApp->ValentinaSettings()->GetPathPattern();
|
path = VAbstractValApplication::VApp()->ValentinaSettings()->GetPathPattern();
|
||||||
break;
|
break;
|
||||||
case 3: // layout path
|
case 3: // layout path
|
||||||
path = qApp->ValentinaSettings()->GetPathLayout();
|
path = VAbstractValApplication::VApp()->ValentinaSettings()->GetPathLayout();
|
||||||
break;
|
break;
|
||||||
case 4: // templates
|
case 4: // templates
|
||||||
path = qApp->ValentinaSettings()->GetPathTemplate();
|
path = VAbstractValApplication::VApp()->ValentinaSettings()->GetPathTemplate();
|
||||||
break;
|
break;
|
||||||
case 5: // label templates
|
case 5: // label templates
|
||||||
path = qApp->ValentinaSettings()->GetPathLabelTemplate();
|
path = VAbstractValApplication::VApp()->ValentinaSettings()->GetPathLabelTemplate();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -168,7 +168,7 @@ void PreferencesPathPage::EditPath()
|
||||||
|
|
||||||
const QString dir = QFileDialog::getExistingDirectory(
|
const QString dir = QFileDialog::getExistingDirectory(
|
||||||
this, tr("Open Directory"), path,
|
this, tr("Open Directory"), path,
|
||||||
qApp->NativeFileDialog(QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks));
|
VAbstractApplication::VApp()->NativeFileDialog(QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks));
|
||||||
if (dir.isEmpty())
|
if (dir.isEmpty())
|
||||||
{
|
{
|
||||||
if (usedNotExistedDir)
|
if (usedNotExistedDir)
|
||||||
|
@ -195,7 +195,7 @@ void PreferencesPathPage::InitTable()
|
||||||
ui->pathTable->setRowCount(6);
|
ui->pathTable->setRowCount(6);
|
||||||
ui->pathTable->setColumnCount(2);
|
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")));
|
ui->pathTable->setItem(0, 0, new QTableWidgetItem(tr("My Individual Measurements")));
|
||||||
|
|
|
@ -64,7 +64,7 @@ PreferencesPatternPage::PreferencesPatternPage(QWidget *parent)
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
RetranslateUi();
|
RetranslateUi();
|
||||||
|
|
||||||
VSettings *settings = qApp->ValentinaSettings();
|
VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
|
||||||
|
|
||||||
ui->graphOutputCheck->setChecked(settings->GetGraphicalOutput());
|
ui->graphOutputCheck->setChecked(settings->GetGraphicalOutput());
|
||||||
ui->checkBoxOpenGLRender->setChecked(settings->IsOpenGLRender());
|
ui->checkBoxOpenGLRender->setChecked(settings->IsOpenGLRender());
|
||||||
|
@ -126,12 +126,12 @@ QStringList PreferencesPatternPage::Apply()
|
||||||
{
|
{
|
||||||
QStringList preferences;
|
QStringList preferences;
|
||||||
|
|
||||||
VSettings *settings = qApp->ValentinaSettings();
|
VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
|
||||||
|
|
||||||
// Scene antialiasing
|
// Scene antialiasing
|
||||||
if (settings->GetGraphicalOutput() != ui->graphOutputCheck->isChecked())
|
if (settings->GetGraphicalOutput() != ui->graphOutputCheck->isChecked())
|
||||||
{
|
{
|
||||||
if (qApp->getSceneView()->IsOpenGLRender())
|
if (VAbstractValApplication::VApp()->getSceneView()->IsOpenGLRender())
|
||||||
{
|
{
|
||||||
preferences.append(tr("antialiasing"));
|
preferences.append(tr("antialiasing"));
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@ QStringList PreferencesPatternPage::Apply()
|
||||||
|
|
||||||
settings->SetCurveApproximationScale(ui->doubleSpinBoxCurveApproximation->value());
|
settings->SetCurveApproximationScale(ui->doubleSpinBoxCurveApproximation->value());
|
||||||
settings->SetLineWidth(UnitConvertor(ui->doubleSpinBoxLineWidth->value(), m_oldLineUnit, Unit::Mm));
|
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
|
/* 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
|
* 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())
|
if (settings->IsDoublePassmark() != ui->doublePassmarkCheck->isChecked())
|
||||||
{
|
{
|
||||||
settings->SetDoublePassmark(ui->doublePassmarkCheck->isChecked());
|
settings->SetDoublePassmark(ui->doublePassmarkCheck->isChecked());
|
||||||
qApp->getCurrentDocument()->LiteParseTree(Document::LiteParse);
|
VAbstractValApplication::VApp()->getCurrentDocument()->LiteParseTree(Document::LiteParse);
|
||||||
}
|
}
|
||||||
|
|
||||||
settings->SetLabelDateFormat(ui->comboBoxDateFormats->currentText());
|
settings->SetLabelDateFormat(ui->comboBoxDateFormats->currentText());
|
||||||
|
@ -181,8 +181,9 @@ QStringList PreferencesPatternPage::Apply()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void PreferencesPatternPage::InitDefaultSeamAllowance()
|
void PreferencesPatternPage::InitDefaultSeamAllowance()
|
||||||
{
|
{
|
||||||
ui->defaultSeamAllowance->setValue(qApp->ValentinaSettings()->GetDefaultSeamAllowance());
|
ui->defaultSeamAllowance->setValue(VAbstractValApplication::VApp()->ValentinaSettings()->GetDefaultSeamAllowance());
|
||||||
ui->defaultSeamAllowance->setSuffix(UnitsToStr(StrToUnits(qApp->ValentinaSettings()->GetUnit()), true));
|
ui->defaultSeamAllowance->setSuffix(
|
||||||
|
UnitsToStr(StrToUnits(VAbstractValApplication::VApp()->ValentinaSettings()->GetUnit()), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -201,7 +202,7 @@ void PreferencesPatternPage::changeEvent(QEvent *event)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void PreferencesPatternPage::EditDateTimeFormats()
|
void PreferencesPatternPage::EditDateTimeFormats()
|
||||||
{
|
{
|
||||||
VSettings *settings = qApp->ValentinaSettings();
|
VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
|
||||||
|
|
||||||
QPushButton *button = qobject_cast<QPushButton *>(sender());
|
QPushButton *button = qobject_cast<QPushButton *>(sender());
|
||||||
if (button == ui->pushButtonEditDateFormats)
|
if (button == ui->pushButtonEditDateFormats)
|
||||||
|
@ -231,7 +232,7 @@ void PreferencesPatternPage::ManageKnownMaterials()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void PreferencesPatternPage::InitLabelDateTimeFormats()
|
void PreferencesPatternPage::InitLabelDateTimeFormats()
|
||||||
{
|
{
|
||||||
VSettings *settings = qApp->ValentinaSettings();
|
VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
|
||||||
|
|
||||||
InitComboBoxFormats(ui->comboBoxDateFormats,
|
InitComboBoxFormats(ui->comboBoxDateFormats,
|
||||||
VCommonSettings::PredefinedDateFormats() + settings->GetUserDefinedDateFormats(),
|
VCommonSettings::PredefinedDateFormats() + settings->GetUserDefinedDateFormats(),
|
||||||
|
|
|
@ -45,7 +45,8 @@ DialogAboutApp::DialogAboutApp(QWidget *parent) :
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
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->label_Valentina_Version->setText(QString("Valentina %1").arg(APP_VERSION_STR));
|
||||||
ui->labelBuildRevision->setText(QString("Build revision: %1").arg(BUILD_REVISION));
|
ui->labelBuildRevision->setText(QString("Build revision: %1").arg(BUILD_REVISION));
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include "../vpatterndb/vtranslatevars.h"
|
#include "../vpatterndb/vtranslatevars.h"
|
||||||
#include "../vpatterndb/calculator.h"
|
#include "../vpatterndb/calculator.h"
|
||||||
#include "../vtools/dialogs/support/dialogeditwrongformula.h"
|
#include "../vtools/dialogs/support/dialogeditwrongformula.h"
|
||||||
|
#include "../core/vapplication.h"
|
||||||
#include <qnumeric.h>
|
#include <qnumeric.h>
|
||||||
|
|
||||||
#define DIALOG_MAX_FORMULA_HEIGHT 64
|
#define DIALOG_MAX_FORMULA_HEIGHT 64
|
||||||
|
@ -66,9 +67,8 @@ DialogFinalMeasurements::DialogFinalMeasurements(VPattern *doc, QWidget *parent)
|
||||||
formulaBaseHeight = ui->plainTextEditFormula->height();
|
formulaBaseHeight = ui->plainTextEditFormula->height();
|
||||||
ui->plainTextEditFormula->installEventFilter(this);
|
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();
|
ShowUnits();
|
||||||
|
|
||||||
const bool freshCall = true;
|
const bool freshCall = true;
|
||||||
|
@ -151,7 +151,7 @@ bool DialogFinalMeasurements::eventFilter(QObject *object, QEvent *event)
|
||||||
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
|
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
|
||||||
if ((keyEvent->key() == Qt::Key_Period) && (keyEvent->modifiers() & Qt::KeypadModifier))
|
if ((keyEvent->key() == Qt::Key_Period) && (keyEvent->modifiers() & Qt::KeypadModifier))
|
||||||
{
|
{
|
||||||
if (qApp->Settings()->GetOsSeparator())
|
if (VAbstractApplication::VApp()->Settings()->GetOsSeparator())
|
||||||
{
|
{
|
||||||
textEdit->insert(QLocale().decimalPoint());
|
textEdit->insert(QLocale().decimalPoint());
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ void DialogFinalMeasurements::showEvent(QShowEvent *event)
|
||||||
}
|
}
|
||||||
// do your init stuff here
|
// do your init stuff here
|
||||||
|
|
||||||
const QSize sz = qApp->Settings()->GetFinalMeasurementsDialogSize();
|
const QSize sz = VAbstractApplication::VApp()->Settings()->GetFinalMeasurementsDialogSize();
|
||||||
if (not sz.isEmpty())
|
if (not sz.isEmpty())
|
||||||
{
|
{
|
||||||
resize(sz);
|
resize(sz);
|
||||||
|
@ -203,7 +203,7 @@ void DialogFinalMeasurements::resizeEvent(QResizeEvent *event)
|
||||||
// dialog creating, which would
|
// dialog creating, which would
|
||||||
if (m_isInitialized)
|
if (m_isInitialized)
|
||||||
{
|
{
|
||||||
qApp->Settings()->SetFinalMeasurementsDialogSize(size());
|
VAbstractApplication::VApp()->Settings()->SetFinalMeasurementsDialogSize(size());
|
||||||
}
|
}
|
||||||
QDialog::resizeEvent(event);
|
QDialog::resizeEvent(event);
|
||||||
}
|
}
|
||||||
|
@ -228,7 +228,8 @@ void DialogFinalMeasurements::ShowFinalMeasurementDetails()
|
||||||
EvalUserFormula(m.formula, false);
|
EvalUserFormula(m.formula, false);
|
||||||
ui->plainTextEditFormula->blockSignals(true);
|
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->setPlainText(formula);
|
||||||
ui->plainTextEditFormula->blockSignals(false);
|
ui->plainTextEditFormula->blockSignals(false);
|
||||||
|
@ -373,7 +374,7 @@ void DialogFinalMeasurements::SaveFormula()
|
||||||
{
|
{
|
||||||
QTableWidgetItem *result = ui->tableWidget->item(row, 1);
|
QTableWidgetItem *result = ui->tableWidget->item(row, 1);
|
||||||
//Show unit in dialog lable (cm, mm or inch)
|
//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);
|
ui->labelCalculatedValue->setText(result->text() + QChar(QChar::Space) +postfix);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -381,7 +382,7 @@ void DialogFinalMeasurements::SaveFormula()
|
||||||
if (text.isEmpty())
|
if (text.isEmpty())
|
||||||
{
|
{
|
||||||
//Show unit in dialog lable (cm, mm or inch)
|
//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."));
|
ui->labelCalculatedValue->setText(tr("Error") + " (" + postfix + "). " + tr("Empty field."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -393,7 +394,8 @@ void DialogFinalMeasurements::SaveFormula()
|
||||||
|
|
||||||
try
|
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
|
catch (qmu::QmuParserError &e) // Just in case something bad will happen
|
||||||
{
|
{
|
||||||
|
@ -453,9 +455,10 @@ void DialogFinalMeasurements::Fx()
|
||||||
|
|
||||||
QScopedPointer<DialogEditWrongFormula> dialog(new DialogEditWrongFormula(&m_data, NULL_ID, this));
|
QScopedPointer<DialogEditWrongFormula> dialog(new DialogEditWrongFormula(&m_data, NULL_ID, this));
|
||||||
dialog->setWindowTitle(tr("Edit measurement"));
|
dialog->setWindowTitle(tr("Edit measurement"));
|
||||||
dialog->SetFormula(qApp->TrVars()->TryFormulaFromUser(ui->plainTextEditFormula->toPlainText(),
|
dialog->SetFormula(VAbstractApplication::VApp()->TrVars()
|
||||||
qApp->Settings()->GetOsSeparator()));
|
->TryFormulaFromUser(ui->plainTextEditFormula->toPlainText(),
|
||||||
const QString postfix = UnitsToStr(qApp->patternUnits(), true);
|
VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
|
||||||
|
const QString postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
dialog->setPostfix(postfix);//Show unit in dialog lable (cm, mm or inch)
|
dialog->setPostfix(postfix);//Show unit in dialog lable (cm, mm or inch)
|
||||||
|
|
||||||
if (dialog->exec() == QDialog::Accepted)
|
if (dialog->exec() == QDialog::Accepted)
|
||||||
|
@ -494,9 +497,12 @@ void DialogFinalMeasurements::FillFinalMeasurements(bool freshCall)
|
||||||
|
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
const qreal result = EvalFormula(m.formula, ok);
|
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
|
AddCell(formula, i, 2, Qt::AlignVCenter); // formula
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -513,7 +519,7 @@ void DialogFinalMeasurements::FillFinalMeasurements(bool freshCall)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogFinalMeasurements::ShowUnits()
|
void DialogFinalMeasurements::ShowUnits()
|
||||||
{
|
{
|
||||||
const QString unit = UnitsToStr(qApp->patternUnits());
|
const QString unit = UnitsToStr(VAbstractValApplication::VApp()->patternUnits());
|
||||||
|
|
||||||
{
|
{
|
||||||
// calculated value
|
// calculated value
|
||||||
|
@ -554,7 +560,8 @@ void DialogFinalMeasurements::AddCell(const QString &text, int row, int column,
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool DialogFinalMeasurements::EvalUserFormula(const QString &formula, bool fromUser)
|
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())
|
if (formula.isEmpty())
|
||||||
{
|
{
|
||||||
ui->labelCalculatedValue->setText(tr("Error") + " (" + postfix + "). " + tr("Empty field."));
|
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
|
// Replace line return character with spaces for calc if exist
|
||||||
if (fromUser)
|
if (fromUser)
|
||||||
{
|
{
|
||||||
f = qApp->TrVars()->FormulaFromUser(formula, qApp->Settings()->GetOsSeparator());
|
f = VAbstractApplication::VApp()->TrVars()
|
||||||
|
->FormulaFromUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -586,7 +594,8 @@ bool DialogFinalMeasurements::EvalUserFormula(const QString &formula, bool fromU
|
||||||
return false;
|
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"));
|
ui->labelCalculatedValue->setToolTip(tr("Value"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ DialogHistory::DialogHistory(VContainer *data, VPattern *doc, QWidget *parent)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
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);
|
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||||
connect(bOk, &QPushButton::clicked, this, &DialogHistory::DialogAccepted);
|
connect(bOk, &QPushButton::clicked, this, &DialogHistory::DialogAccepted);
|
||||||
|
|
|
@ -90,7 +90,7 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par
|
||||||
formulaBaseHeightPC = ui->plainTextEditFormulaPC->height();
|
formulaBaseHeightPC = ui->plainTextEditFormulaPC->height();
|
||||||
ui->plainTextEditFormulaPC->installEventFilter(this);
|
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.");
|
qCDebug(vDialog, "Showing variables.");
|
||||||
ShowUnits();
|
ShowUnits();
|
||||||
|
@ -214,7 +214,7 @@ void DialogIncrements::FillTable(const QMap<QString, T> &varTable, QTableWidget
|
||||||
item->setFont(font);
|
item->setFont(font);
|
||||||
table->setItem(currentRow, 0, item);
|
table->setItem(currentRow, 0, item);
|
||||||
|
|
||||||
item = new QTableWidgetItem(qApp->LocaleToString(length));
|
item = new QTableWidgetItem(VAbstractApplication::VApp()->LocaleToString(length));
|
||||||
item->setTextAlignment(Qt::AlignHCenter);
|
item->setTextAlignment(Qt::AlignHCenter);
|
||||||
table->setItem(currentRow, 1, item);
|
table->setItem(currentRow, 1, item);
|
||||||
}
|
}
|
||||||
|
@ -268,7 +268,7 @@ void DialogIncrements::FillAnglesCurves()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogIncrements::ShowUnits()
|
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, 1, unit);// calculated value
|
||||||
ShowHeaderUnits(ui->tableWidgetIncrement, 2, unit);// formula
|
ShowHeaderUnits(ui->tableWidgetIncrement, 2, unit);// formula
|
||||||
|
@ -340,7 +340,8 @@ QString DialogIncrements::GetCustomName() const
|
||||||
QString name;
|
QString name;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
name = CustomIncrSign + qApp->TrVars()->InternalVarToUser(increment_) + QString().number(num);
|
name = CustomIncrSign + VAbstractApplication::VApp()->TrVars()->InternalVarToUser(increment_) +
|
||||||
|
QString().number(num);
|
||||||
num++;
|
num++;
|
||||||
} while (not data->IsUnique(name));
|
} while (not data->IsUnique(name));
|
||||||
return 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)
|
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())
|
if (formula.isEmpty())
|
||||||
{
|
{
|
||||||
label->setText(tr("Error") + " (" + postfix + "). " + tr("Empty field."));
|
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
|
// Replace line return character with spaces for calc if exist
|
||||||
if (fromUser)
|
if (fromUser)
|
||||||
{
|
{
|
||||||
f = qApp->TrVars()->FormulaFromUser(formula, qApp->Settings()->GetOsSeparator());
|
f = VAbstractApplication::VApp()->TrVars()
|
||||||
|
->FormulaFromUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -392,7 +395,7 @@ bool DialogIncrements::EvalIncrementFormula(const QString &formula, bool fromUse
|
||||||
return false;
|
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"));
|
label->setToolTip(tr("Value"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -729,7 +732,9 @@ void DialogIncrements::ShowTableIncrementDetails(QTableWidget *table)
|
||||||
EvalIncrementFormula(incr->GetFormula(), false, incr->GetData(), labelCalculatedValue);
|
EvalIncrementFormula(incr->GetFormula(), false, incr->GetData(), labelCalculatedValue);
|
||||||
plainTextEditFormula->blockSignals(true);
|
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->setPlainText(formula);
|
||||||
plainTextEditFormula->blockSignals(false);
|
plainTextEditFormula->blockSignals(false);
|
||||||
|
@ -906,10 +911,13 @@ void DialogIncrements::FillIncrementsTable(QTableWidget *table,
|
||||||
if (incr->GetType() == VarType::Increment)
|
if (incr->GetType() == VarType::Increment)
|
||||||
{
|
{
|
||||||
AddCell(table, incr->GetName(), currentRow, 0, Qt::AlignVCenter); // name
|
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
|
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
|
AddCell(table, formula, currentRow, 2, Qt::AlignVCenter); // formula
|
||||||
|
|
||||||
|
@ -1228,7 +1236,7 @@ void DialogIncrements::SaveIncrFormula()
|
||||||
{
|
{
|
||||||
QTableWidgetItem *result = table->item(row, 1);
|
QTableWidgetItem *result = table->item(row, 1);
|
||||||
//Show unit in dialog lable (cm, mm or inch)
|
//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);
|
labelCalculatedValue->setText(result->text() + QChar(QChar::Space) +postfix);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1236,7 +1244,7 @@ void DialogIncrements::SaveIncrFormula()
|
||||||
if (text.isEmpty())
|
if (text.isEmpty())
|
||||||
{
|
{
|
||||||
//Show unit in dialog lable (cm, mm or inch)
|
//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."));
|
labelCalculatedValue->setText(tr("Error") + " (" + postfix + "). " + tr("Empty field."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1254,7 +1262,8 @@ void DialogIncrements::SaveIncrFormula()
|
||||||
|
|
||||||
try
|
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);
|
doc->SetIncrementFormula(nameField->text(), formula);
|
||||||
}
|
}
|
||||||
catch (qmu::QmuParserError &e) // Just in case something bad will happen
|
catch (qmu::QmuParserError &e) // Just in case something bad will happen
|
||||||
|
@ -1372,9 +1381,10 @@ void DialogIncrements::Fx()
|
||||||
dialog->setWindowTitle(tr("Edit increment"));
|
dialog->setWindowTitle(tr("Edit increment"));
|
||||||
incrementMode ? dialog->SetIncrementsMode() : dialog->SetPreviewCalculationsMode();
|
incrementMode ? dialog->SetIncrementsMode() : dialog->SetPreviewCalculationsMode();
|
||||||
|
|
||||||
dialog->SetFormula(qApp->TrVars()->TryFormulaFromUser(plainTextEditFormula->toPlainText(),
|
dialog->SetFormula(VAbstractApplication::VApp()->TrVars()
|
||||||
qApp->Settings()->GetOsSeparator()));
|
->TryFormulaFromUser(plainTextEditFormula->toPlainText(),
|
||||||
const QString postfix = UnitsToStr(qApp->patternUnits(), true);
|
VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
|
||||||
|
const QString postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
dialog->setPostfix(postfix);//Show unit in dialog lable (cm, mm or inch)
|
dialog->setPostfix(postfix);//Show unit in dialog lable (cm, mm or inch)
|
||||||
|
|
||||||
if (dialog->exec() == QDialog::Accepted)
|
if (dialog->exec() == QDialog::Accepted)
|
||||||
|
@ -1434,7 +1444,7 @@ bool DialogIncrements::eventFilter(QObject *object, QEvent *event)
|
||||||
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
|
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
|
||||||
if ((keyEvent->key() == Qt::Key_Period) && (keyEvent->modifiers() & Qt::KeypadModifier))
|
if ((keyEvent->key() == Qt::Key_Period) && (keyEvent->modifiers() & Qt::KeypadModifier))
|
||||||
{
|
{
|
||||||
if (qApp->Settings()->GetOsSeparator())
|
if (VAbstractApplication::VApp()->Settings()->GetOsSeparator())
|
||||||
{
|
{
|
||||||
textEdit->insert(QLocale().decimalPoint());
|
textEdit->insert(QLocale().decimalPoint());
|
||||||
}
|
}
|
||||||
|
@ -1467,7 +1477,7 @@ void DialogIncrements::showEvent(QShowEvent *event)
|
||||||
}
|
}
|
||||||
// do your init stuff here
|
// do your init stuff here
|
||||||
|
|
||||||
const QSize sz = qApp->Settings()->GetIncrementsDialogSize();
|
const QSize sz = VAbstractApplication::VApp()->Settings()->GetIncrementsDialogSize();
|
||||||
if (not sz.isEmpty())
|
if (not sz.isEmpty())
|
||||||
{
|
{
|
||||||
resize(sz);
|
resize(sz);
|
||||||
|
@ -1484,7 +1494,7 @@ void DialogIncrements::resizeEvent(QResizeEvent *event)
|
||||||
// dialog creating, which would
|
// dialog creating, which would
|
||||||
if (isInitialized)
|
if (isInitialized)
|
||||||
{
|
{
|
||||||
qApp->Settings()->SetIncrementsDialogSize(size());
|
VAbstractApplication::VApp()->Settings()->SetIncrementsDialogSize(size());
|
||||||
}
|
}
|
||||||
DialogTool::resizeEvent(event);
|
DialogTool::resizeEvent(event);
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,8 @@ DialogLayoutProgress::DialogLayoutProgress(QElapsedTimer timer, qint64 timeout,
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
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<int>(timeout/1000));
|
ui->progressBar->setMaximum(static_cast<int>(timeout/1000));
|
||||||
ui->progressBar->setValue(0);
|
ui->progressBar->setValue(0);
|
||||||
|
|
|
@ -50,7 +50,8 @@ DialogLayoutSettings::DialogLayoutSettings(VLayoutGenerator *generator, QWidget
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
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
|
//moved from ReadSettings - well...it seems it can be done once only (i.e. constructor) because Init funcs dont
|
||||||
//even cleanse lists before adding
|
//even cleanse lists before adding
|
||||||
|
@ -764,8 +765,9 @@ void DialogLayoutSettings::InitPaperUnits()
|
||||||
ui->comboBoxPaperSizeUnit->addItem(tr("Pixels"), QVariant(UnitsToStr(Unit::Px)));
|
ui->comboBoxPaperSizeUnit->addItem(tr("Pixels"), QVariant(UnitsToStr(Unit::Px)));
|
||||||
|
|
||||||
// set default unit
|
// set default unit
|
||||||
oldPaperUnit = StrToUnits(qApp->ValentinaSettings()->GetUnit());
|
oldPaperUnit = StrToUnits(VAbstractValApplication::VApp()->ValentinaSettings()->GetUnit());
|
||||||
const qint32 indexUnit = ui->comboBoxPaperSizeUnit->findData(qApp->ValentinaSettings()->GetUnit());
|
const qint32 indexUnit = ui->comboBoxPaperSizeUnit->findData(
|
||||||
|
VAbstractValApplication::VApp()->ValentinaSettings()->GetUnit());
|
||||||
if (indexUnit != -1)
|
if (indexUnit != -1)
|
||||||
{
|
{
|
||||||
ui->comboBoxPaperSizeUnit->setCurrentIndex(indexUnit);
|
ui->comboBoxPaperSizeUnit->setCurrentIndex(indexUnit);
|
||||||
|
@ -780,8 +782,9 @@ void DialogLayoutSettings::InitLayoutUnits()
|
||||||
ui->comboBoxLayoutUnit->addItem(tr("Inches"), QVariant(UnitsToStr(Unit::Inch)));
|
ui->comboBoxLayoutUnit->addItem(tr("Inches"), QVariant(UnitsToStr(Unit::Inch)));
|
||||||
|
|
||||||
// set default unit
|
// set default unit
|
||||||
oldLayoutUnit = StrToUnits(qApp->ValentinaSettings()->GetUnit());
|
oldLayoutUnit = StrToUnits(VAbstractValApplication::VApp()->ValentinaSettings()->GetUnit());
|
||||||
const qint32 indexUnit = ui->comboBoxLayoutUnit->findData(qApp->ValentinaSettings()->GetUnit());
|
const qint32 indexUnit = ui->comboBoxLayoutUnit->findData(
|
||||||
|
VAbstractValApplication::VApp()->ValentinaSettings()->GetUnit());
|
||||||
if (indexUnit != -1)
|
if (indexUnit != -1)
|
||||||
{
|
{
|
||||||
ui->comboBoxLayoutUnit->setCurrentIndex(indexUnit);
|
ui->comboBoxLayoutUnit->setCurrentIndex(indexUnit);
|
||||||
|
@ -1016,7 +1019,7 @@ void DialogLayoutSettings::MinimumLayoutSize()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogLayoutSettings::ReadSettings()
|
void DialogLayoutSettings::ReadSettings()
|
||||||
{
|
{
|
||||||
const VSettings *settings = qApp->ValentinaSettings();
|
const VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
|
||||||
SetLayoutWidth(settings->GetLayoutWidth());
|
SetLayoutWidth(settings->GetLayoutWidth());
|
||||||
SetNestingTime(settings->GetNestingTime());
|
SetNestingTime(settings->GetNestingTime());
|
||||||
SetEfficiencyCoefficient(settings->GetEfficiencyCoefficient());
|
SetEfficiencyCoefficient(settings->GetEfficiencyCoefficient());
|
||||||
|
@ -1048,7 +1051,7 @@ void DialogLayoutSettings::ReadSettings()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogLayoutSettings::WriteSettings() const
|
void DialogLayoutSettings::WriteSettings() const
|
||||||
{
|
{
|
||||||
VSettings *settings = qApp->ValentinaSettings();
|
VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
|
||||||
settings->SetLayoutWidth(GetLayoutWidth());
|
settings->SetLayoutWidth(GetLayoutWidth());
|
||||||
settings->SetLayoutGroup(GetGroup());
|
settings->SetLayoutGroup(GetGroup());
|
||||||
settings->SetLayoutPaperHeight(GetPaperHeight());
|
settings->SetLayoutPaperHeight(GetPaperHeight());
|
||||||
|
|
|
@ -46,7 +46,8 @@ DialogNewPattern::DialogNewPattern(VContainer *data, const QString &patternPiece
|
||||||
|
|
||||||
ui->lineEditName->setClearButtonEnabled(true);
|
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();
|
QRect position = this->frameGeometry();
|
||||||
position.moveCenter(QGuiApplication::primaryScreen()->availableGeometry().center());
|
position.moveCenter(QGuiApplication::primaryScreen()->availableGeometry().center());
|
||||||
|
@ -115,7 +116,8 @@ void DialogNewPattern::InitUnits()
|
||||||
ui->comboBoxUnits->addItem(tr("Inches"), QVariant(UnitsToStr(Unit::Inch)));
|
ui->comboBoxUnits->addItem(tr("Inches"), QVariant(UnitsToStr(Unit::Inch)));
|
||||||
|
|
||||||
// set default unit
|
// 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)
|
if (indexUnit != -1)
|
||||||
{
|
{
|
||||||
ui->comboBoxUnits->setCurrentIndex(indexUnit);
|
ui->comboBoxUnits->setCurrentIndex(indexUnit);
|
||||||
|
|
|
@ -67,10 +67,10 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pat
|
||||||
|
|
||||||
SCASSERT(doc != nullptr)
|
SCASSERT(doc != nullptr)
|
||||||
|
|
||||||
VSettings *settings = qApp->ValentinaSettings();
|
VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
|
||||||
settings->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
|
settings->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
|
||||||
|
|
||||||
if (qApp->GetPatternPath().isEmpty())
|
if (VAbstractValApplication::VApp()->GetPatternPath().isEmpty())
|
||||||
{
|
{
|
||||||
ui->lineEditPathToFile->setText(tr("<Empty>"));
|
ui->lineEditPathToFile->setText(tr("<Empty>"));
|
||||||
ui->lineEditPathToFile->setToolTip(tr("File was not saved yet."));
|
ui->lineEditPathToFile->setToolTip(tr("File was not saved yet."));
|
||||||
|
@ -78,15 +78,15 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pat
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ui->lineEditPathToFile->setText(QDir::toNativeSeparators(qApp->GetPatternPath()));
|
ui->lineEditPathToFile->setText(QDir::toNativeSeparators(VAbstractValApplication::VApp()->GetPatternPath()));
|
||||||
ui->lineEditPathToFile->setToolTip(QDir::toNativeSeparators(qApp->GetPatternPath()));
|
ui->lineEditPathToFile->setToolTip(QDir::toNativeSeparators(VAbstractValApplication::VApp()->GetPatternPath()));
|
||||||
ui->pushButtonShowInExplorer->setEnabled(true);
|
ui->pushButtonShowInExplorer->setEnabled(true);
|
||||||
}
|
}
|
||||||
ui->lineEditPathToFile->setCursorPosition(0);
|
ui->lineEditPathToFile->setCursorPosition(0);
|
||||||
|
|
||||||
connect(ui->pushButtonShowInExplorer, &QPushButton::clicked, this, []()
|
connect(ui->pushButtonShowInExplorer, &QPushButton::clicked, this, []()
|
||||||
{
|
{
|
||||||
ShowInGraphicalShell(qApp->GetPatternPath());
|
ShowInGraphicalShell(VAbstractValApplication::VApp()->GetPatternPath());
|
||||||
});
|
});
|
||||||
#if defined(Q_OS_MAC)
|
#if defined(Q_OS_MAC)
|
||||||
ui->pushButtonShowInExplorer->setText(tr("Show in Finder"));
|
ui->pushButtonShowInExplorer->setText(tr("Show in Finder"));
|
||||||
|
@ -98,7 +98,8 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pat
|
||||||
ui->comboBoxLabelLanguage->addItem(QLocale(name).nativeLanguageName(), name);
|
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)
|
if (index != -1)
|
||||||
{
|
{
|
||||||
ui->comboBoxLabelLanguage->setCurrentIndex(index);
|
ui->comboBoxLabelLanguage->setCurrentIndex(index);
|
||||||
|
@ -277,7 +278,7 @@ void DialogPatternProperties::ChangeImage()
|
||||||
{
|
{
|
||||||
const QString filter = tr("Images") + QLatin1String(" (*.png *.jpg *.jpeg *.bmp)");
|
const QString filter = tr("Images") + QLatin1String(" (*.png *.jpg *.jpeg *.bmp)");
|
||||||
const QString fileName = QFileDialog::getOpenFileName(this, tr("Image for pattern"), QString(), filter, nullptr,
|
const QString fileName = QFileDialog::getOpenFileName(this, tr("Image for pattern"), QString(), filter, nullptr,
|
||||||
qApp->NativeFileDialog());
|
VAbstractApplication::VApp()->NativeFileDialog());
|
||||||
if (not fileName.isEmpty())
|
if (not fileName.isEmpty())
|
||||||
{
|
{
|
||||||
QImage image;
|
QImage image;
|
||||||
|
@ -319,7 +320,7 @@ void DialogPatternProperties::SaveImage()
|
||||||
const QString extension = doc->GetImageExtension().prepend(QChar('.'));
|
const QString extension = doc->GetImageExtension().prepend(QChar('.'));
|
||||||
QString filter = tr("Images") + QStringLiteral(" (*") + extension + QChar(')');
|
QString filter = tr("Images") + QStringLiteral(" (*") + extension + QChar(')');
|
||||||
QString filename = QFileDialog::getSaveFileName(this, tr("Save File"), tr("untitled"), filter, &filter,
|
QString filename = QFileDialog::getSaveFileName(this, tr("Save File"), tr("untitled"), filter, &filter,
|
||||||
qApp->NativeFileDialog());
|
VAbstractApplication::VApp()->NativeFileDialog());
|
||||||
if (not filename.isEmpty())
|
if (not filename.isEmpty())
|
||||||
{
|
{
|
||||||
if (not filename.endsWith(extension.toUpper()))
|
if (not filename.endsWith(extension.toUpper()))
|
||||||
|
|
|
@ -52,7 +52,7 @@ DialogPreferences::DialogPreferences(QWidget *parent)
|
||||||
setWindowFlags(Qt::Window);
|
setWindowFlags(Qt::Window);
|
||||||
#endif
|
#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);
|
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||||
SCASSERT(bOk != nullptr)
|
SCASSERT(bOk != nullptr)
|
||||||
|
@ -91,7 +91,7 @@ void DialogPreferences::showEvent(QShowEvent *event)
|
||||||
}
|
}
|
||||||
// do your init stuff here
|
// do your init stuff here
|
||||||
|
|
||||||
QSize sz = qApp->Settings()->GetPreferenceDialogSize();
|
QSize sz = VAbstractApplication::VApp()->Settings()->GetPreferenceDialogSize();
|
||||||
if (sz.isEmpty() == false)
|
if (sz.isEmpty() == false)
|
||||||
{
|
{
|
||||||
resize(sz);
|
resize(sz);
|
||||||
|
@ -109,7 +109,7 @@ void DialogPreferences::resizeEvent(QResizeEvent *event)
|
||||||
// dialog creating, which would
|
// dialog creating, which would
|
||||||
if (m_isInitialized)
|
if (m_isInitialized)
|
||||||
{
|
{
|
||||||
qApp->Settings()->SetPreferenceDialogSize(size());
|
VAbstractApplication::VApp()->Settings()->SetPreferenceDialogSize(size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +155,8 @@ void DialogPreferences::Apply()
|
||||||
|
|
||||||
m_patternPage->InitDefaultSeamAllowance();
|
m_patternPage->InitDefaultSeamAllowance();
|
||||||
|
|
||||||
qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
|
VAbstractValApplication::VApp()->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale())
|
||||||
|
: setLocale(QLocale::c());
|
||||||
emit UpdateProperties();
|
emit UpdateProperties();
|
||||||
setResult(QDialog::Accepted);
|
setResult(QDialog::Accepted);
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,8 @@ DialogSaveLayout::DialogSaveLayout(int count, Draw mode, const QString &fileName
|
||||||
ui->lineEditPath->setClearButtonEnabled(true);
|
ui->lineEditPath->setClearButtonEnabled(true);
|
||||||
ui->lineEditFileName->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);
|
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||||
SCASSERT(bOk != nullptr)
|
SCASSERT(bOk != nullptr)
|
||||||
|
@ -120,7 +121,7 @@ DialogSaveLayout::DialogSaveLayout(int count, Draw mode, const QString &fileName
|
||||||
this, &DialogSaveLayout::ShowExample);
|
this, &DialogSaveLayout::ShowExample);
|
||||||
connect(ui->pushButtonBrowse, &QPushButton::clicked, this, [this]()
|
connect(ui->pushButtonBrowse, &QPushButton::clicked, this, [this]()
|
||||||
{
|
{
|
||||||
const QString dirPath = qApp->ValentinaSettings()->GetPathLayout();
|
const QString dirPath = VAbstractValApplication::VApp()->ValentinaSettings()->GetPathLayout();
|
||||||
bool usedNotExistedDir = false;
|
bool usedNotExistedDir = false;
|
||||||
QDir directory(dirPath);
|
QDir directory(dirPath);
|
||||||
if (not directory.exists())
|
if (not directory.exists())
|
||||||
|
@ -130,7 +131,8 @@ DialogSaveLayout::DialogSaveLayout(int count, Draw mode, const QString &fileName
|
||||||
|
|
||||||
const QString dir = QFileDialog::getExistingDirectory(
|
const QString dir = QFileDialog::getExistingDirectory(
|
||||||
this, tr("Select folder"), dirPath,
|
this, tr("Select folder"), dirPath,
|
||||||
qApp->NativeFileDialog(QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks));
|
VAbstractApplication::VApp()->NativeFileDialog(QFileDialog::ShowDirsOnly |
|
||||||
|
QFileDialog::DontResolveSymlinks));
|
||||||
if (not dir.isEmpty())
|
if (not dir.isEmpty())
|
||||||
{// If paths equal the signal will not be called, we will do this manually
|
{// If paths equal the signal will not be called, we will do this manually
|
||||||
dir == ui->lineEditPath->text() ? PathChanged(dir) : ui->lineEditPath->setText(dir);
|
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);
|
connect(ui->lineEditPath, &QLineEdit::textChanged, this, &DialogSaveLayout::PathChanged);
|
||||||
|
|
||||||
ui->lineEditPath->setText(qApp->ValentinaSettings()->GetPathLayout());
|
ui->lineEditPath->setText(VAbstractValApplication::VApp()->ValentinaSettings()->GetPathLayout());
|
||||||
|
|
||||||
InitTemplates(ui->comboBoxTemplates);
|
InitTemplates(ui->comboBoxTemplates);
|
||||||
|
|
||||||
|
@ -680,7 +682,7 @@ void DialogSaveLayout::SetTiledExportMode(bool tiledExportMode)
|
||||||
void DialogSaveLayout::SetTiledMargins(QMarginsF margins)
|
void DialogSaveLayout::SetTiledMargins(QMarginsF margins)
|
||||||
{
|
{
|
||||||
// read Margins top, right, bottom, left
|
// 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->doubleSpinBoxLeftField->setValue(margins.left());
|
||||||
ui->doubleSpinBoxTopField->setValue(margins.top());
|
ui->doubleSpinBoxTopField->setValue(margins.top());
|
||||||
|
@ -698,7 +700,7 @@ QMarginsF DialogSaveLayout::GetTiledMargins() const
|
||||||
ui->doubleSpinBoxBottomField->value()
|
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()
|
void DialogSaveLayout::ReadSettings()
|
||||||
{
|
{
|
||||||
VSettings *settings = qApp->ValentinaSettings();
|
VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
|
||||||
const Unit unit = qApp->patternUnits();
|
const Unit unit = VAbstractValApplication::VApp()->patternUnits();
|
||||||
|
|
||||||
// read Margins top, right, bottom, left
|
// read Margins top, right, bottom, left
|
||||||
const QMarginsF margins = settings->GetTiledPDFMargins(unit);
|
const QMarginsF margins = settings->GetTiledPDFMargins(unit);
|
||||||
|
@ -927,8 +929,8 @@ void DialogSaveLayout::WriteSettings() const
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
VSettings *settings = qApp->ValentinaSettings();
|
VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
|
||||||
const Unit unit = qApp->patternUnits();
|
const Unit unit = VAbstractValApplication::VApp()->patternUnits();
|
||||||
|
|
||||||
// write Margins top, right, bottom, left
|
// write Margins top, right, bottom, left
|
||||||
QMarginsF margins = QMarginsF(
|
QMarginsF margins = QMarginsF(
|
||||||
|
|
|
@ -140,7 +140,7 @@ void VWidgetDetails::InLayoutStateChanged(int row, int column)
|
||||||
|
|
||||||
TogglePieceInLayout *togglePrint = new TogglePieceInLayout(id, inLayout, m_data, m_doc);
|
TogglePieceInLayout *togglePrint = new TogglePieceInLayout(id, inLayout, m_data, m_doc);
|
||||||
connect(togglePrint, &TogglePieceInLayout::Toggled, this, &VWidgetDetails::ToggledPiece);
|
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);
|
TogglePieceInLayout *togglePrint = new TogglePieceInLayout(id, select, m_data, m_doc);
|
||||||
connect(togglePrint, &TogglePieceInLayout::Toggled, this, &VWidgetDetails::ToggledPiece);
|
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)
|
if (selectedAction == actionSelectAll)
|
||||||
{
|
{
|
||||||
select = true;
|
select = true;
|
||||||
qApp->getUndoStack()->beginMacro(tr("select all details"));
|
VAbstractApplication::VApp()->getUndoStack()->beginMacro(tr("select all details"));
|
||||||
ToggleSectionDetails(select);
|
ToggleSectionDetails(select);
|
||||||
qApp->getUndoStack()->endMacro();
|
VAbstractApplication::VApp()->getUndoStack()->endMacro();
|
||||||
}
|
}
|
||||||
else if (selectedAction == actionSelectNone)
|
else if (selectedAction == actionSelectNone)
|
||||||
{
|
{
|
||||||
select = false;
|
select = false;
|
||||||
qApp->getUndoStack()->beginMacro(tr("select none details"));
|
VAbstractApplication::VApp()->getUndoStack()->beginMacro(tr("select none details"));
|
||||||
ToggleSectionDetails(select);
|
ToggleSectionDetails(select);
|
||||||
qApp->getUndoStack()->endMacro();
|
VAbstractApplication::VApp()->getUndoStack()->endMacro();
|
||||||
}
|
}
|
||||||
else if (selectedAction == actionInvertSelection)
|
else if (selectedAction == actionInvertSelection)
|
||||||
{
|
{
|
||||||
qApp->getUndoStack()->beginMacro(tr("invert selection"));
|
VAbstractApplication::VApp()->getUndoStack()->beginMacro(tr("invert selection"));
|
||||||
|
|
||||||
for (int i = 0; i<ui->tableWidget->rowCount(); ++i)
|
for (int i = 0; i<ui->tableWidget->rowCount(); ++i)
|
||||||
{
|
{
|
||||||
|
@ -359,11 +359,11 @@ void VWidgetDetails::ShowContextMenu(const QPoint &pos)
|
||||||
|
|
||||||
TogglePieceInLayout *togglePrint = new TogglePieceInLayout(id, select, m_data, m_doc);
|
TogglePieceInLayout *togglePrint = new TogglePieceInLayout(id, select, m_data, m_doc);
|
||||||
connect(togglePrint, &TogglePieceInLayout::Toggled, this, &VWidgetDetails::ToggledPiece);
|
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)
|
else if (pieceMode && selectedAction == actionPieceOptions)
|
||||||
{
|
{
|
||||||
|
|
|
@ -80,7 +80,7 @@ void VWidgetGroups::SetGroupVisibility(vidtype id, bool visible) const
|
||||||
: item->setIcon(QIcon(QStringLiteral("://icon/16x16/closed_eye.png")));
|
: 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<vidtype> &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();
|
const quint32 id = ui->tableWidget->item(row, 0)->data(Qt::UserRole).toUInt();
|
||||||
::RenameGroup *renameGroup = new ::RenameGroup(doc, id, ui->tableWidget->item(row, column)->text());
|
::RenameGroup *renameGroup = new ::RenameGroup(doc, id, ui->tableWidget->item(row, column)->text());
|
||||||
connect(renameGroup, &RenameGroup::UpdateGroups, this, &VWidgetGroups::UpdateGroups);
|
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)
|
else if (selectedAction == actionPreferences)
|
||||||
{
|
{
|
||||||
QScopedPointer<VContainer> fackeContainer(new VContainer(qApp->TrVars(), qApp->patternUnitsP(),
|
QScopedPointer<VContainer> fackeContainer(new VContainer(VAbstractApplication::VApp()->TrVars(),
|
||||||
|
VAbstractValApplication::VApp()->patternUnitsP(),
|
||||||
VContainer::UniqueNamespace()));
|
VContainer::UniqueNamespace()));
|
||||||
QScopedPointer<DialogGroup> dialog(new DialogGroup(fackeContainer.data(), NULL_ID, this));
|
QScopedPointer<DialogGroup> dialog(new DialogGroup(fackeContainer.data(), NULL_ID, this));
|
||||||
dialog->SetName(doc->GetGroupName(id));
|
dialog->SetName(doc->GetGroupName(id));
|
||||||
|
@ -243,14 +244,14 @@ void VWidgetGroups::CtxMenu(const QPoint &pos)
|
||||||
ChangeGroupOptions *changeGroupOptions = new ChangeGroupOptions(doc, id, dialog->GetName(),
|
ChangeGroupOptions *changeGroupOptions = new ChangeGroupOptions(doc, id, dialog->GetName(),
|
||||||
dialog->GetTags());
|
dialog->GetTags());
|
||||||
connect(changeGroupOptions, &ChangeGroupOptions::UpdateGroups, this, &VWidgetGroups::UpdateGroups);
|
connect(changeGroupOptions, &ChangeGroupOptions::UpdateGroups, this, &VWidgetGroups::UpdateGroups);
|
||||||
qApp->getUndoStack()->push(changeGroupOptions);
|
VAbstractApplication::VApp()->getUndoStack()->push(changeGroupOptions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (selectedAction == actionDelete)
|
else if (selectedAction == actionDelete)
|
||||||
{
|
{
|
||||||
DelGroup *delGroup = new DelGroup(doc, id);
|
DelGroup *delGroup = new DelGroup(doc, id);
|
||||||
connect(delGroup, &DelGroup::UpdateGroups, this, &VWidgetGroups::UpdateGroups);
|
connect(delGroup, &DelGroup::UpdateGroups, this, &VWidgetGroups::UpdateGroups);
|
||||||
qApp->getUndoStack()->push(delGroup);
|
VAbstractApplication::VApp()->getUndoStack()->push(delGroup);
|
||||||
}
|
}
|
||||||
else if (selectedAction == actionHideAll)
|
else if (selectedAction == actionHideAll)
|
||||||
{//all groups in "group" make unvisible
|
{//all groups in "group" make unvisible
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -128,7 +128,8 @@ void InsertGlobalContours(const QList<QGraphicsScene *> &scenes, const QList<QGr
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
MainWindowsNoGUI::MainWindowsNoGUI(QWidget *parent)
|
MainWindowsNoGUI::MainWindowsNoGUI(QWidget *parent)
|
||||||
: VAbstractMainWindow(parent),
|
: VAbstractMainWindow(parent),
|
||||||
pattern(new VContainer(qApp->TrVars(), 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)
|
#if defined(Q_OS_WIN32) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
||||||
,m_taskbarButton(new QWinTaskbarButton(this))
|
,m_taskbarButton(new QWinTaskbarButton(this))
|
||||||
#endif
|
#endif
|
||||||
|
@ -468,17 +469,17 @@ void MainWindowsNoGUI::ExportFMeasurementsToCSV()
|
||||||
}
|
}
|
||||||
|
|
||||||
DialogExportToCSV dialog(this);
|
DialogExportToCSV dialog(this);
|
||||||
dialog.SetWithHeader(qApp->Settings()->GetCSVWithHeader());
|
dialog.SetWithHeader(VAbstractApplication::VApp()->Settings()->GetCSVWithHeader());
|
||||||
dialog.SetSelectedMib(qApp->Settings()->GetCSVCodec());
|
dialog.SetSelectedMib(VAbstractApplication::VApp()->Settings()->GetCSVCodec());
|
||||||
dialog.SetSeparator(qApp->Settings()->GetCSVSeparator());
|
dialog.SetSeparator(VAbstractApplication::VApp()->Settings()->GetCSVSeparator());
|
||||||
|
|
||||||
if (dialog.exec() == QDialog::Accepted)
|
if (dialog.exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
ExportFMeasurementsToCSVData(fileName, dialog.IsWithHeader(), dialog.GetSelectedMib(), dialog.GetSeparator());
|
ExportFMeasurementsToCSVData(fileName, dialog.IsWithHeader(), dialog.GetSelectedMib(), dialog.GetSeparator());
|
||||||
|
|
||||||
qApp->Settings()->SetCSVSeparator(dialog.GetSeparator());
|
VAbstractApplication::VApp()->Settings()->SetCSVSeparator(dialog.GetSeparator());
|
||||||
qApp->Settings()->SetCSVCodec(dialog.GetSelectedMib());
|
VAbstractApplication::VApp()->Settings()->SetCSVCodec(dialog.GetSelectedMib());
|
||||||
qApp->Settings()->SetCSVWithHeader(dialog.IsWithHeader());
|
VAbstractApplication::VApp()->Settings()->SetCSVWithHeader(dialog.IsWithHeader());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -554,7 +555,7 @@ void MainWindowsNoGUI::ExportFlatLayout(const QList<QGraphicsScene *> &scenes,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
qApp->ValentinaSettings()->SetPathLayout(path);
|
VAbstractValApplication::VApp()->ValentinaSettings()->SetPathLayout(path);
|
||||||
const LayoutExportFormats format = m_dialogSaveLayout->Format();
|
const LayoutExportFormats format = m_dialogSaveLayout->Format();
|
||||||
|
|
||||||
if (format == LayoutExportFormats::PDFTiled && m_dialogSaveLayout->Mode() == Draw::Layout)
|
if (format == LayoutExportFormats::PDFTiled && m_dialogSaveLayout->Mode() == Draw::Layout)
|
||||||
|
@ -655,7 +656,7 @@ void MainWindowsNoGUI::ExportApparelLayout(const QVector<VLayoutPiece> &details,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
qApp->ValentinaSettings()->SetPathLayout(path);
|
VAbstractValApplication::VApp()->ValentinaSettings()->SetPathLayout(path);
|
||||||
const LayoutExportFormats format = m_dialogSaveLayout->Format();
|
const LayoutExportFormats format = m_dialogSaveLayout->Format();
|
||||||
|
|
||||||
VLayoutExporter exporter;
|
VLayoutExporter exporter;
|
||||||
|
@ -848,14 +849,15 @@ void MainWindowsNoGUI::PrintPreviewTiled()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VSettings *settings = qApp->ValentinaSettings();
|
VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
|
||||||
m_layoutSettings->SetTiledMargins(QMarginsF(settings->GetTiledPDFMargins(Unit::Mm)));
|
m_layoutSettings->SetTiledMargins(QMarginsF(settings->GetTiledPDFMargins(Unit::Mm)));
|
||||||
m_layoutSettings->SetTiledPDFOrientation(settings->GetTiledPDFOrientation());
|
m_layoutSettings->SetTiledPDFOrientation(settings->GetTiledPDFOrientation());
|
||||||
m_layoutSettings->SetTiledPDFPaperSize(QSizeF(settings->GetTiledPDFPaperWidth(Unit::Mm),
|
m_layoutSettings->SetTiledPDFPaperSize(QSizeF(settings->GetTiledPDFPaperWidth(Unit::Mm),
|
||||||
settings->GetTiledPDFPaperHeight(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();
|
m_layoutSettings->PrintPreviewTiled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -881,14 +883,15 @@ void MainWindowsNoGUI::PrintTiled()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VSettings *settings = qApp->ValentinaSettings();
|
VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
|
||||||
m_layoutSettings->SetTiledMargins(QMarginsF(settings->GetTiledPDFMargins(Unit::Mm)));
|
m_layoutSettings->SetTiledMargins(QMarginsF(settings->GetTiledPDFMargins(Unit::Mm)));
|
||||||
m_layoutSettings->SetTiledPDFOrientation(settings->GetTiledPDFOrientation());
|
m_layoutSettings->SetTiledPDFOrientation(settings->GetTiledPDFOrientation());
|
||||||
m_layoutSettings->SetTiledPDFPaperSize(QSizeF(settings->GetTiledPDFPaperWidth(Unit::Mm),
|
m_layoutSettings->SetTiledPDFPaperSize(QSizeF(settings->GetTiledPDFPaperWidth(Unit::Mm),
|
||||||
settings->GetTiledPDFPaperHeight(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();
|
m_layoutSettings->PrintTiled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -919,7 +922,7 @@ QVector<VLayoutPiece> MainWindowsNoGUI::PrepareDetailsForLayout(const QVector<De
|
||||||
|
|
||||||
futureWatcher.setFuture(QtConcurrent::mapped(details, PrepareDetail));
|
futureWatcher.setFuture(QtConcurrent::mapped(details, PrepareDetail));
|
||||||
|
|
||||||
if (qApp->IsGUIMode())
|
if (VApplication::VApp()->IsGUIMode())
|
||||||
{
|
{
|
||||||
progress.exec();
|
progress.exec();
|
||||||
}
|
}
|
||||||
|
@ -949,7 +952,7 @@ void MainWindowsNoGUI::InitTempLayoutScene()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QStringList MainWindowsNoGUI::RecentFileList() const
|
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);
|
QPainter painter(&image);
|
||||||
painter.setFont( QFont( QStringLiteral("Arial"), 8, QFont::Normal ) );
|
painter.setFont( QFont( QStringLiteral("Arial"), 8, QFont::Normal ) );
|
||||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||||
painter.setPen(QPen(Qt::black, qApp->Settings()->WidthMainLine(), Qt::SolidLine, Qt::RoundCap,
|
painter.setPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthMainLine(), Qt::SolidLine,
|
||||||
Qt::RoundJoin));
|
Qt::RoundCap, Qt::RoundJoin));
|
||||||
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
||||||
m_layoutSettings->LayoutScenes().at(i)->render(&painter, r, r, Qt::IgnoreAspectRatio);
|
m_layoutSettings->LayoutScenes().at(i)->render(&painter, r, r, Qt::IgnoreAspectRatio);
|
||||||
painter.end();
|
painter.end();
|
||||||
|
@ -1067,7 +1070,7 @@ void MainWindowsNoGUI::PdfTiledFile(const QString &name)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VSettings *settings = qApp->ValentinaSettings();
|
VSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
|
||||||
m_layoutSettings->SetTiledMargins(QMarginsF(settings->GetTiledPDFMargins(Unit::Mm)));
|
m_layoutSettings->SetTiledMargins(QMarginsF(settings->GetTiledPDFMargins(Unit::Mm)));
|
||||||
m_layoutSettings->SetTiledPDFOrientation(settings->GetTiledPDFOrientation());
|
m_layoutSettings->SetTiledPDFOrientation(settings->GetTiledPDFOrientation());
|
||||||
m_layoutSettings->SetTiledPDFPaperSize(QSizeF(settings->GetTiledPDFPaperWidth(Unit::Mm),
|
m_layoutSettings->SetTiledPDFPaperSize(QSizeF(settings->GetTiledPDFPaperWidth(Unit::Mm),
|
||||||
|
@ -1076,7 +1079,8 @@ void MainWindowsNoGUI::PdfTiledFile(const QString &name)
|
||||||
m_layoutSettings->SetYScale(1);
|
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);
|
m_layoutSettings->PdfTiledFile(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1117,19 +1121,19 @@ void MainWindowsNoGUI::ExportScene(const QList<QGraphicsScene *> &scenes,
|
||||||
{
|
{
|
||||||
case LayoutExportFormats::SVG:
|
case LayoutExportFormats::SVG:
|
||||||
paper->setVisible(false);
|
paper->setVisible(false);
|
||||||
exporter.SetPen(QPen(Qt::black, qApp->Settings()->WidthHairLine(), Qt::SolidLine, Qt::RoundCap,
|
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
|
||||||
Qt::RoundJoin));
|
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||||
exporter.ExportToSVG(scene);
|
exporter.ExportToSVG(scene);
|
||||||
paper->setVisible(true);
|
paper->setVisible(true);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::PDF:
|
case LayoutExportFormats::PDF:
|
||||||
exporter.SetPen(QPen(Qt::black, qApp->Settings()->WidthHairLine(), Qt::SolidLine, Qt::RoundCap,
|
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
|
||||||
Qt::RoundJoin));
|
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||||
exporter.ExportToPDF(scene);
|
exporter.ExportToPDF(scene);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::PNG:
|
case LayoutExportFormats::PNG:
|
||||||
exporter.SetPen(QPen(Qt::black, qApp->Settings()->WidthHairLine(), Qt::SolidLine, Qt::RoundCap,
|
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
|
||||||
Qt::RoundJoin));
|
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||||
exporter.ExportToPNG(scene);
|
exporter.ExportToPNG(scene);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::OBJ:
|
case LayoutExportFormats::OBJ:
|
||||||
|
@ -1138,13 +1142,13 @@ void MainWindowsNoGUI::ExportScene(const QList<QGraphicsScene *> &scenes,
|
||||||
paper->setVisible(true);
|
paper->setVisible(true);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::PS:
|
case LayoutExportFormats::PS:
|
||||||
exporter.SetPen(QPen(Qt::black, qApp->Settings()->WidthHairLine(), Qt::SolidLine, Qt::RoundCap,
|
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
|
||||||
Qt::RoundJoin));
|
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||||
exporter.ExportToPS(scene);
|
exporter.ExportToPS(scene);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::EPS:
|
case LayoutExportFormats::EPS:
|
||||||
exporter.SetPen(QPen(Qt::black, qApp->Settings()->WidthHairLine(), Qt::SolidLine, Qt::RoundCap,
|
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
|
||||||
Qt::RoundJoin));
|
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||||
exporter.ExportToEPS(scene);
|
exporter.ExportToEPS(scene);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::DXF_AC1006_Flat:
|
case LayoutExportFormats::DXF_AC1006_Flat:
|
||||||
|
@ -1202,8 +1206,8 @@ void MainWindowsNoGUI::ExportScene(const QList<QGraphicsScene *> &scenes,
|
||||||
paper->setVisible(true);
|
paper->setVisible(true);
|
||||||
break;
|
break;
|
||||||
case LayoutExportFormats::TIF:
|
case LayoutExportFormats::TIF:
|
||||||
exporter.SetPen(QPen(Qt::black, qApp->Settings()->WidthHairLine(), Qt::SolidLine, Qt::RoundCap,
|
exporter.SetPen(QPen(Qt::black, VAbstractApplication::VApp()->Settings()->WidthHairLine(),
|
||||||
Qt::RoundJoin));
|
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||||
exporter.ExportToTIF(scene);
|
exporter.ExportToTIF(scene);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -1224,7 +1228,8 @@ void MainWindowsNoGUI::ExportScene(const QList<QGraphicsScene *> &scenes,
|
||||||
QString MainWindowsNoGUI::FileName() const
|
QString MainWindowsNoGUI::FileName() const
|
||||||
{
|
{
|
||||||
QString fileName;
|
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();
|
return QFileInfo(fileName).baseName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1262,7 +1267,7 @@ bool MainWindowsNoGUI::ExportFMeasurementsToCSVData(const QString &fileName, boo
|
||||||
QScopedPointer<Calculator> cal(new Calculator());
|
QScopedPointer<Calculator> cal(new Calculator());
|
||||||
const qreal result = cal->EvalFormula(completeData.DataVariables(), m.formula);
|
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))
|
if (qIsInf(result) || qIsNaN(result))
|
||||||
{
|
{
|
||||||
|
@ -1371,7 +1376,7 @@ void MainWindowsNoGUI::CheckRequiredMeasurements(const VMeasurements *m) const
|
||||||
QList<QString> list = ConvertToList(match);
|
QList<QString> list = ConvertToList(match);
|
||||||
for (int i = 0; i < list.size(); ++i)
|
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."));
|
VException e(tr("Measurement file doesn't include all required measurements."));
|
||||||
|
|
|
@ -584,16 +584,7 @@ DEPENDPATH += $$PWD/../../libs/vformat
|
||||||
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vformat/$${DESTDIR}/vformat.lib
|
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
|
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vformat/$${DESTDIR}/libvformat.a
|
||||||
|
|
||||||
# VLayout static library (depend on IFC, VGeometry, VPatternDB)
|
#VPatternDB static library (depend on vgeometry, vmisc, VLayout)
|
||||||
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)
|
|
||||||
unix|win32: LIBS += -L$$OUT_PWD/../../libs/vpatterndb/$${DESTDIR} -lvpatterndb
|
unix|win32: LIBS += -L$$OUT_PWD/../../libs/vpatterndb/$${DESTDIR} -lvpatterndb
|
||||||
|
|
||||||
INCLUDEPATH += $$PWD/../../libs/vpatterndb
|
INCLUDEPATH += $$PWD/../../libs/vpatterndb
|
||||||
|
@ -602,6 +593,15 @@ DEPENDPATH += $$PWD/../../libs/vpatterndb
|
||||||
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vpatterndb/$${DESTDIR}/vpatterndb.lib
|
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
|
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)
|
# VGeometry static library (depend on ifc)
|
||||||
unix|win32: LIBS += -L$$OUT_PWD/../../libs/vgeometry/$${DESTDIR}/ -lvgeometry
|
unix|win32: LIBS += -L$$OUT_PWD/../../libs/vgeometry/$${DESTDIR}/ -lvgeometry
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ WatermarkWindow::WatermarkWindow(const QString &patternPath, QWidget *parent) :
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
m_okPathColor = ui->lineEditPath->palette().color(ui->lineEditPath->foregroundRole());
|
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();
|
UpdateWindowTitle();
|
||||||
|
|
||||||
m_curFileFormatVersion = VWatermarkConverter::WatermarkMaxVer;
|
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 filter = tr("Images") + QLatin1String(" (*.png *.jpg *.jpeg *.bmp)");
|
||||||
const QString fileName = QFileDialog::getOpenFileName(this, tr("Watermark image"), QString(), filter,
|
const QString fileName = QFileDialog::getOpenFileName(this, tr("Watermark image"), QString(), filter,
|
||||||
nullptr, qApp->NativeFileDialog());
|
nullptr,
|
||||||
|
VAbstractApplication::VApp()->NativeFileDialog());
|
||||||
if (not fileName.isEmpty())
|
if (not fileName.isEmpty())
|
||||||
{
|
{
|
||||||
ui->lineEditPath->setText(fileName);
|
ui->lineEditPath->setText(fileName);
|
||||||
|
@ -241,7 +242,7 @@ void WatermarkWindow::showEvent(QShowEvent *event)
|
||||||
}
|
}
|
||||||
// do your init stuff here
|
// do your init stuff here
|
||||||
|
|
||||||
QSize sz = qApp->ValentinaSettings()->GetWatermarkEditorSize();
|
QSize sz = VAbstractValApplication::VApp()->ValentinaSettings()->GetWatermarkEditorSize();
|
||||||
if (sz.isEmpty() == false)
|
if (sz.isEmpty() == false)
|
||||||
{
|
{
|
||||||
resize(sz);
|
resize(sz);
|
||||||
|
@ -258,7 +259,7 @@ void WatermarkWindow::resizeEvent(QResizeEvent *event)
|
||||||
// window creating, which would
|
// window creating, which would
|
||||||
if (m_isInitialized)
|
if (m_isInitialized)
|
||||||
{
|
{
|
||||||
qApp->ValentinaSettings()->SetWatermarkEditorSize(size());
|
VAbstractValApplication::VApp()->ValentinaSettings()->SetWatermarkEditorSize(size());
|
||||||
}
|
}
|
||||||
QMainWindow::resizeEvent(event);
|
QMainWindow::resizeEvent(event);
|
||||||
}
|
}
|
||||||
|
@ -285,7 +286,7 @@ bool WatermarkWindow::on_actionSaveAs_triggered()
|
||||||
|
|
||||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"),
|
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"),
|
||||||
dir + QLatin1String("/") + tr("watermark") + QLatin1String(".vwm"),
|
dir + QLatin1String("/") + tr("watermark") + QLatin1String(".vwm"),
|
||||||
filters, nullptr, qApp->NativeFileDialog());
|
filters, nullptr, VAbstractApplication::VApp()->NativeFileDialog());
|
||||||
|
|
||||||
if (fileName.isEmpty())
|
if (fileName.isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -434,7 +435,7 @@ void WatermarkWindow::on_actionOpen_triggered()
|
||||||
QString dir = QDir::homePath();
|
QString dir = QDir::homePath();
|
||||||
qDebug("Run QFileDialog::getOpenFileName: dir = %s.", qUtf8Printable(dir));
|
qDebug("Run QFileDialog::getOpenFileName: dir = %s.", qUtf8Printable(dir));
|
||||||
const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), dir, filter, nullptr,
|
const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), dir, filter, nullptr,
|
||||||
qApp->NativeFileDialog());
|
VAbstractApplication::VApp()->NativeFileDialog());
|
||||||
if (filePath.isEmpty())
|
if (filePath.isEmpty())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -555,7 +556,7 @@ QString WatermarkWindow::GetWatermarkFileName()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool WatermarkWindow::ContinueFormatRewrite(const QString ¤tFormatVersion, const QString &maxFormatVersion)
|
bool WatermarkWindow::ContinueFormatRewrite(const QString ¤tFormatVersion, const QString &maxFormatVersion)
|
||||||
{
|
{
|
||||||
if (qApp->Settings()->GetConfirmFormatRewriting())
|
if (VAbstractApplication::VApp()->Settings()->GetConfirmFormatRewriting())
|
||||||
{
|
{
|
||||||
Utils::CheckableMessageBox msgBox(this);
|
Utils::CheckableMessageBox msgBox(this);
|
||||||
msgBox.setWindowTitle(tr("Confirm format rewriting"));
|
msgBox.setWindowTitle(tr("Confirm format rewriting"));
|
||||||
|
@ -571,7 +572,7 @@ bool WatermarkWindow::ContinueFormatRewrite(const QString ¤tFormatVersion,
|
||||||
|
|
||||||
if (dialogResult == QDialog::Accepted)
|
if (dialogResult == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
qApp->Settings()->SetConfirmFormatRewriting(not msgBox.isChecked());
|
VAbstractApplication::VApp()->Settings()->SetConfirmFormatRewriting(not msgBox.isChecked());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -732,7 +733,7 @@ void WatermarkWindow::ValidatePath()
|
||||||
void WatermarkWindow::ToolBarStyle(QToolBar *bar)
|
void WatermarkWindow::ToolBarStyle(QToolBar *bar)
|
||||||
{
|
{
|
||||||
SCASSERT(bar != nullptr)
|
SCASSERT(bar != nullptr)
|
||||||
if (qApp->Settings()->GetToolBarStyle())
|
if (VAbstractApplication::VApp()->Settings()->GetToolBarStyle())
|
||||||
{
|
{
|
||||||
bar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
bar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ void GatherCount(int &count, const int nodes)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString DefLabelLanguage()
|
QString DefLabelLanguage()
|
||||||
{
|
{
|
||||||
QString def = qApp->ValentinaSettings()->GetLabelLanguage();
|
QString def = VAbstractValApplication::VApp()->ValentinaSettings()->GetLabelLanguage();
|
||||||
if (not ConvertToSet<QString>(VApplication::LabelLanguages()).contains(def))
|
if (not ConvertToSet<QString>(VApplication::LabelLanguages()).contains(def))
|
||||||
{
|
{
|
||||||
def = QStringLiteral("en");
|
def = QStringLiteral("en");
|
||||||
|
@ -127,7 +127,8 @@ void VPattern::CreateEmptyFile()
|
||||||
|
|
||||||
patternElement.appendChild(createComment(FileComment()));
|
patternElement.appendChild(createComment(FileComment()));
|
||||||
patternElement.appendChild(CreateElementWithText(TagVersion, VPatternConverter::PatternMaxVerStr));
|
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(TagDescription));
|
||||||
patternElement.appendChild(createElement(TagNotes));
|
patternElement.appendChild(createElement(TagNotes));
|
||||||
|
@ -227,11 +228,11 @@ void VPattern::Parse(const Document &parse)
|
||||||
}
|
}
|
||||||
domNode = domNode.nextSibling();
|
domNode = domNode.nextSibling();
|
||||||
}
|
}
|
||||||
if (qApp->IsGUIMode())
|
if (VApplication::VApp()->IsGUIMode())
|
||||||
{
|
{
|
||||||
QTimer::singleShot(1000, Qt::VeryCoarseTimer, this, SLOT(RefreshPieceGeometry()));
|
QTimer::singleShot(1000, Qt::VeryCoarseTimer, this, SLOT(RefreshPieceGeometry()));
|
||||||
}
|
}
|
||||||
else if (qApp->CommandLine()->IsTestModeEnabled())
|
else if (VApplication::VApp()->CommandLine()->IsTestModeEnabled())
|
||||||
{
|
{
|
||||||
RefreshPieceGeometry();
|
RefreshPieceGeometry();
|
||||||
}
|
}
|
||||||
|
@ -249,7 +250,7 @@ void VPattern::Parse(const Document &parse)
|
||||||
*/
|
*/
|
||||||
void VPattern::setCurrentData()
|
void VPattern::setCurrentData()
|
||||||
{
|
{
|
||||||
if (qApp->GetDrawMode() == Draw::Calculation)
|
if (VAbstractValApplication::VApp()->GetDrawMode() == Draw::Calculation)
|
||||||
{
|
{
|
||||||
const int countPP = CountPP();
|
const int countPP = CountPP();
|
||||||
if (countPP > 1)//don't need upadate data if we have only one pattern piece
|
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();
|
setCurrentData();
|
||||||
emit FullUpdateFromFile();
|
emit FullUpdateFromFile();
|
||||||
// Recalculate scene rect
|
// Recalculate scene rect
|
||||||
VMainGraphicsView::NewSceneRect(sceneDraw, qApp->getSceneView());
|
VMainGraphicsView::NewSceneRect(sceneDraw, VAbstractValApplication::VApp()->getSceneView());
|
||||||
VMainGraphicsView::NewSceneRect(sceneDetail, qApp->getSceneView());
|
VMainGraphicsView::NewSceneRect(sceneDetail, VAbstractValApplication::VApp()->getSceneView());
|
||||||
qCDebug(vXML, "Scene size updated.");
|
qCDebug(vXML, "Scene size updated.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -681,7 +682,7 @@ void VPattern::customEvent(QEvent *event)
|
||||||
{
|
{
|
||||||
if (event->type() == UNDO_EVENT)
|
if (event->type() == UNDO_EVENT)
|
||||||
{
|
{
|
||||||
qApp->getUndoStack()->undo();
|
VAbstractApplication::VApp()->getUndoStack()->undo();
|
||||||
}
|
}
|
||||||
else if (event->type() == LITE_PARSE_EVENT)
|
else if (event->type() == LITE_PARSE_EVENT)
|
||||||
{
|
{
|
||||||
|
@ -864,18 +865,23 @@ void VPattern::ParseDetailElement(QDomElement &domElement, const Document &parse
|
||||||
VToolSeamAllowanceInitData initData;
|
VToolSeamAllowanceInitData initData;
|
||||||
initData.id = GetParametrId(domElement);
|
initData.id = GetParametrId(domElement);
|
||||||
initData.detail.SetName(GetParametrString(domElement, AttrName, tr("Detail")));
|
initData.detail.SetName(GetParametrString(domElement, AttrName, tr("Detail")));
|
||||||
initData.detail.SetMx(qApp->toPixel(GetParametrDouble(domElement, AttrMx, QStringLiteral("0.0"))));
|
initData.detail.SetMx(VAbstractValApplication::VApp()
|
||||||
initData.detail.SetMy(qApp->toPixel(GetParametrDouble(domElement, AttrMy, QStringLiteral("0.0"))));
|
->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.SetSeamAllowance(GetParametrBool(domElement, VToolSeamAllowance::AttrSeamAllowance, falseStr));
|
||||||
initData.detail.SetHideMainPath(GetParametrBool(domElement, VToolSeamAllowance::AttrHideMainPath,
|
initData.detail.SetHideMainPath(GetParametrBool(domElement, VToolSeamAllowance::AttrHideMainPath,
|
||||||
QString().setNum(qApp->ValentinaSettings()->IsHideMainPath())));
|
QString().setNum(VAbstractValApplication::VApp()
|
||||||
|
->ValentinaSettings()->IsHideMainPath())));
|
||||||
initData.detail.SetSeamAllowanceBuiltIn(GetParametrBool(domElement,
|
initData.detail.SetSeamAllowanceBuiltIn(GetParametrBool(domElement,
|
||||||
VToolSeamAllowance::AttrSeamAllowanceBuiltIn,
|
VToolSeamAllowance::AttrSeamAllowanceBuiltIn,
|
||||||
falseStr));
|
falseStr));
|
||||||
initData.detail.SetForbidFlipping(GetParametrBool(domElement, AttrForbidFlipping,
|
initData.detail.SetForbidFlipping(GetParametrBool(domElement, AttrForbidFlipping,
|
||||||
QString().setNum(qApp->ValentinaSettings()->GetForbidWorkpieceFlipping())));
|
QString().setNum(VAbstractValApplication::VApp()
|
||||||
|
->ValentinaSettings()->GetForbidWorkpieceFlipping())));
|
||||||
initData.detail.SetForceFlipping(GetParametrBool(domElement, AttrForceFlipping,
|
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.SetInLayout(GetParametrBool(domElement, AttrInLayout, trueStr));
|
||||||
initData.detail.SetUnited(GetParametrBool(domElement, VToolSeamAllowance::AttrUnited, falseStr));
|
initData.detail.SetUnited(GetParametrBool(domElement, VToolSeamAllowance::AttrUnited, falseStr));
|
||||||
initData.detail.SetPriority(GetParametrUInt(domElement, VToolSeamAllowance::AttrPiecePriority, QChar('0')));
|
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)
|
void VPattern::PointsCommonAttributes(const QDomElement &domElement, quint32 &id, qreal &mx, qreal &my)
|
||||||
{
|
{
|
||||||
ToolsCommonAttributes(domElement, id);
|
ToolsCommonAttributes(domElement, id);
|
||||||
mx = qApp->toPixel(GetParametrDouble(domElement, AttrMx, QString::number(labelMX)));
|
mx = VAbstractValApplication::VApp()->toPixel(GetParametrDouble(domElement, AttrMx, QString::number(labelMX)));
|
||||||
my = qApp->toPixel(GetParametrDouble(domElement, AttrMy, QString::number(labelMY)));
|
my = VAbstractValApplication::VApp()->toPixel(GetParametrDouble(domElement, AttrMy, QString::number(labelMY)));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -1219,8 +1225,8 @@ void VPattern::DrawPointsCommonAttributes(const QDomElement &domElement, quint32
|
||||||
QString ¬es)
|
QString ¬es)
|
||||||
{
|
{
|
||||||
DrawToolsCommonAttributes(domElement, id, notes);
|
DrawToolsCommonAttributes(domElement, id, notes);
|
||||||
mx = qApp->toPixel(GetParametrDouble(domElement, AttrMx, QString::number(labelMX)));
|
mx = VAbstractValApplication::VApp()->toPixel(GetParametrDouble(domElement, AttrMx, QString::number(labelMX)));
|
||||||
my = qApp->toPixel(GetParametrDouble(domElement, AttrMy, QString::number(labelMY)));
|
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;
|
initData.typeCreation = Source::FromFile;
|
||||||
|
|
||||||
PointsCommonAttributes(domElement, initData);
|
PointsCommonAttributes(domElement, initData);
|
||||||
initData.x = qApp->toPixel(GetParametrDouble(domElement, AttrX, QStringLiteral("10.0")));
|
initData.x = VAbstractValApplication::VApp()
|
||||||
initData.y = qApp->toPixel(GetParametrDouble(domElement, AttrY, QStringLiteral("10.0")));
|
->toPixel(GetParametrDouble(domElement, AttrX, QStringLiteral("10.0")));
|
||||||
|
initData.y = VAbstractValApplication::VApp()
|
||||||
|
->toPixel(GetParametrDouble(domElement, AttrY, QStringLiteral("10.0")));
|
||||||
|
|
||||||
spoint = VToolBasePoint::Create(initData);
|
spoint = VToolBasePoint::Create(initData);
|
||||||
}
|
}
|
||||||
|
@ -2494,13 +2502,17 @@ void VPattern::ParseToolTrueDarts(VMainGraphicsScene *scene, const QDomElement &
|
||||||
initData.dartP3Id = GetParametrUInt(domElement, AttrDartP3, NULL_ID_STR);
|
initData.dartP3Id = GetParametrUInt(domElement, AttrDartP3, NULL_ID_STR);
|
||||||
|
|
||||||
initData.name1 = GetParametrString(domElement, AttrName1, QChar('A'));
|
initData.name1 = GetParametrString(domElement, AttrName1, QChar('A'));
|
||||||
initData.mx1 = qApp->toPixel(GetParametrDouble(domElement, AttrMx1, QString::number(labelMX)));
|
initData.mx1 = VAbstractValApplication::VApp()
|
||||||
initData.my1 = qApp->toPixel(GetParametrDouble(domElement, AttrMy1, QString::number(labelMY)));
|
->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.showLabel1 = GetParametrBool(domElement, AttrShowLabel1, trueStr);
|
||||||
|
|
||||||
initData.name2 = GetParametrString(domElement, AttrName2, QChar('A'));
|
initData.name2 = GetParametrString(domElement, AttrName2, QChar('A'));
|
||||||
initData.mx2 = qApp->toPixel(GetParametrDouble(domElement, AttrMx2, QString::number(labelMX)));
|
initData.mx2 = VAbstractValApplication::VApp()
|
||||||
initData.my2 = qApp->toPixel(GetParametrDouble(domElement, AttrMy2, QString::number(labelMY)));
|
->toPixel(GetParametrDouble(domElement, AttrMx2, QString::number(labelMX)));
|
||||||
|
initData.my2 = VAbstractValApplication::VApp()
|
||||||
|
->toPixel(GetParametrDouble(domElement, AttrMy2, QString::number(labelMY)));
|
||||||
initData.showLabel2 = GetParametrBool(domElement, AttrShowLabel2, trueStr);
|
initData.showLabel2 = GetParametrBool(domElement, AttrShowLabel2, trueStr);
|
||||||
|
|
||||||
VToolTrueDarts::Create(initData);
|
VToolTrueDarts::Create(initData);
|
||||||
|
@ -2604,7 +2616,8 @@ void VPattern::ParseToolSpline(VMainGraphicsScene *scene, QDomElement &domElemen
|
||||||
|
|
||||||
if (spl != nullptr)
|
if (spl != nullptr)
|
||||||
{
|
{
|
||||||
VAbstractMainWindow *window = qobject_cast<VAbstractMainWindow *>(qApp->getMainWindow());
|
VAbstractMainWindow *window =
|
||||||
|
qobject_cast<VAbstractMainWindow *>(VAbstractValApplication::VApp()->getMainWindow());
|
||||||
SCASSERT(window != nullptr)
|
SCASSERT(window != nullptr)
|
||||||
connect(spl, &VToolSpline::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
|
connect(spl, &VToolSpline::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
|
||||||
}
|
}
|
||||||
|
@ -2813,7 +2826,8 @@ void VPattern::ParseToolSplinePath(VMainGraphicsScene *scene, const QDomElement
|
||||||
|
|
||||||
if (spl != nullptr)
|
if (spl != nullptr)
|
||||||
{
|
{
|
||||||
VAbstractMainWindow *window = qobject_cast<VAbstractMainWindow *>(qApp->getMainWindow());
|
VAbstractMainWindow *window =
|
||||||
|
qobject_cast<VAbstractMainWindow *>(VAbstractValApplication::VApp()->getMainWindow());
|
||||||
SCASSERT(window != nullptr)
|
SCASSERT(window != nullptr)
|
||||||
connect(spl, &VToolSplinePath::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
|
connect(spl, &VToolSplinePath::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
|
||||||
}
|
}
|
||||||
|
@ -3667,17 +3681,17 @@ void VPattern::RefreshPieceGeometry()
|
||||||
auto CleanRefreshList = qScopeGuard([this]()
|
auto CleanRefreshList = qScopeGuard([this]()
|
||||||
{
|
{
|
||||||
updatePieces.clear();
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(auto pieceId : qAsConst(updatePieces))
|
for(auto pieceId : qAsConst(updatePieces))
|
||||||
{
|
{
|
||||||
if (qApp->IsGUIMode() && m_parsing)
|
if (VApplication::VApp()->IsGUIMode() && m_parsing)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -3696,7 +3710,7 @@ void VPattern::RefreshPieceGeometry()
|
||||||
|
|
||||||
QApplication::processEvents();
|
QApplication::processEvents();
|
||||||
|
|
||||||
if (qApp->IsGUIMode() && m_parsing)
|
if (VApplication::VApp()->IsGUIMode() && m_parsing)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,7 +128,7 @@ void FvUpdater::showUpdaterWindowUpdatedWithCurrentUpdateProposal()
|
||||||
hideUpdaterWindow();
|
hideUpdaterWindow();
|
||||||
|
|
||||||
// Create a new window
|
// Create a new window
|
||||||
m_updaterWindow = new FvUpdateWindow(qApp->getMainWindow());
|
m_updaterWindow = new FvUpdateWindow(VAbstractValApplication::VApp()->getMainWindow());
|
||||||
m_updaterWindow->UpdateWindowWithCurrentProposedUpdate();
|
m_updaterWindow->UpdateWindowWithCurrentProposedUpdate();
|
||||||
m_updaterWindow->exec();
|
m_updaterWindow->exec();
|
||||||
}
|
}
|
||||||
|
@ -209,7 +209,7 @@ void FvUpdater::RemindMeLater()
|
||||||
{
|
{
|
||||||
qDebug() << "Remind me later";
|
qDebug() << "Remind me later";
|
||||||
|
|
||||||
qApp->Settings()->SetDateOfLastRemind(QDate::currentDate());
|
VAbstractApplication::VApp()->Settings()->SetDateOfLastRemind(QDate::currentDate());
|
||||||
|
|
||||||
hideUpdaterWindow();
|
hideUpdaterWindow();
|
||||||
}
|
}
|
||||||
|
@ -283,7 +283,7 @@ bool FvUpdater::CheckForUpdates(bool silentAsMuchAsItCouldGet)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool FvUpdater::CheckForUpdatesSilent()
|
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);
|
const bool success = CheckForUpdates(true);
|
||||||
if (m_dropOnFinnish && not success)
|
if (m_dropOnFinnish && not success)
|
||||||
|
@ -548,7 +548,7 @@ bool FvUpdater::VersionIsIgnored(const QString &version)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const int lastSkippedVersion = qApp->Settings()->GetLatestSkippedVersion();
|
const int lastSkippedVersion = VAbstractApplication::VApp()->Settings()->GetLatestSkippedVersion();
|
||||||
if (lastSkippedVersion != 0x0)
|
if (lastSkippedVersion != 0x0)
|
||||||
{
|
{
|
||||||
if (decVersion == lastSkippedVersion)
|
if (decVersion == lastSkippedVersion)
|
||||||
|
@ -588,7 +588,7 @@ void FvUpdater::IgnoreVersion(const QString &version)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
qApp->Settings()->SetLatestSkippedVersion(decVersion);
|
VAbstractApplication::VApp()->Settings()->SetLatestSkippedVersion(decVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -215,7 +215,7 @@ void GatherTokens(QSet<QString> &tokens, const QList<QString> &tokenList)
|
||||||
*/
|
*/
|
||||||
QMap<int, QString> AdjustMaterials(QMap<int, QString> materials)
|
QMap<int, QString> AdjustMaterials(QMap<int, QString> materials)
|
||||||
{
|
{
|
||||||
const QMap<int, QString> cliMaterials = qApp->GetUserMaterials();
|
const QMap<int, QString> cliMaterials = VAbstractValApplication::VApp()->GetUserMaterials();
|
||||||
QMap<int, QString>::const_iterator i = cliMaterials.constBegin();
|
QMap<int, QString>::const_iterator i = cliMaterials.constBegin();
|
||||||
while (i != cliMaterials.constEnd())
|
while (i != cliMaterials.constEnd())
|
||||||
{
|
{
|
||||||
|
@ -1045,7 +1045,7 @@ QString VAbstractPattern::GetLabelDateFormat() const
|
||||||
{
|
{
|
||||||
if (*labelDateFormatCached == unknownCharacter)
|
if (*labelDateFormatCached == unknownCharacter)
|
||||||
{
|
{
|
||||||
const QString globalLabelDateFormat = qApp->Settings()->GetLabelDateFormat();
|
const QString globalLabelDateFormat = VAbstractApplication::VApp()->Settings()->GetLabelDateFormat();
|
||||||
|
|
||||||
const QDomNodeList list = elementsByTagName(TagPatternLabel);
|
const QDomNodeList list = elementsByTagName(TagPatternLabel);
|
||||||
if (list.isEmpty())
|
if (list.isEmpty())
|
||||||
|
@ -1079,7 +1079,7 @@ void VAbstractPattern::SetLabelDateFormat(const QString &format)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VAbstractPattern::GetLabelTimeFormat() const
|
QString VAbstractPattern::GetLabelTimeFormat() const
|
||||||
{
|
{
|
||||||
QString globalLabelTimeFormat = qApp->Settings()->GetLabelTimeFormat();
|
QString globalLabelTimeFormat = VAbstractApplication::VApp()->Settings()->GetLabelTimeFormat();
|
||||||
|
|
||||||
const QDomNodeList list = elementsByTagName(TagPatternLabel);
|
const QDomNodeList list = elementsByTagName(TagPatternLabel);
|
||||||
if (list.isEmpty())
|
if (list.isEmpty())
|
||||||
|
|
|
@ -467,5 +467,6 @@ void dx_iface::AddBlock(dx_ifaceBlock *block)
|
||||||
std::string dx_iface::LocaleToISO()
|
std::string dx_iface::LocaleToISO()
|
||||||
{
|
{
|
||||||
QMap <QString, QString> locMap = LocaleMap();
|
QMap <QString, QString> 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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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'.")
|
const QString errorMsg = QCoreApplication::translate("DRW_TextCodec", "No available codec for code page '%1'.")
|
||||||
.arg(cp.c_str());
|
.arg(cp.c_str());
|
||||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
|
|
||||||
if (version < DRW::AC1021 && cp == "UTF-8")
|
if (version < DRW::AC1021 && cp == "UTF-8")
|
||||||
{
|
{
|
||||||
|
|
|
@ -116,7 +116,8 @@ QDomElement VPatternRecipe::Prerequisite()
|
||||||
QDomElement prerequisiteElement = createElement(QStringLiteral("prerequisite"));
|
QDomElement prerequisiteElement = createElement(QStringLiteral("prerequisite"));
|
||||||
|
|
||||||
prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("valentina"), APP_VERSION_STR));
|
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("author"), m_pattern->GetCompanyName()));
|
||||||
prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("pattenName"), m_pattern->GetPatternName()));
|
prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("pattenName"), m_pattern->GetPatternName()));
|
||||||
prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("description"), m_pattern->GetDescription()));
|
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."),
|
const QString errorMsg = QString("%1\n\n%1").arg(tr("Reading final measurements error."),
|
||||||
tr("Value for final measurtement '%1' is infinite or NaN. "
|
tr("Value for final measurtement '%1' is infinite or NaN. "
|
||||||
"Please, check your calculations.").arg(fm.name));
|
"Please, check your calculations.").arg(fm.name));
|
||||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetAttribute(recipeFinalMeasurement, QStringLiteral("value"), result);
|
SetAttribute(recipeFinalMeasurement, QStringLiteral("value"), result);
|
||||||
|
@ -595,10 +596,10 @@ QDomElement VPatternRecipe::Spline(const VToolRecord &record)
|
||||||
SetAttribute(step, AttrAngle2Value, spl.GetEndAngle());
|
SetAttribute(step, AttrAngle2Value, spl.GetEndAngle());
|
||||||
|
|
||||||
SetAttribute(step, AttrLength1, spl.GetC1LengthFormula());
|
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, AttrLength2, spl.GetC2LengthFormula());
|
||||||
SetAttribute(step, AttrLength2Value, qApp->fromPixel(spl.GetC2Length()));
|
SetAttribute(step, AttrLength2Value, VAbstractValApplication::VApp()->fromPixel(spl.GetC2Length()));
|
||||||
|
|
||||||
CurveAttributes(step, tool);
|
CurveAttributes(step, tool);
|
||||||
|
|
||||||
|
@ -693,10 +694,10 @@ QDomElement VPatternRecipe::SplinePath(const VToolRecord &record)
|
||||||
SetAttribute(node, AttrAngle2Value, pathNode.Angle2());
|
SetAttribute(node, AttrAngle2Value, pathNode.Angle2());
|
||||||
|
|
||||||
SetAttribute(node, AttrLength1, pathNode.Length1Formula());
|
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, AttrLength2, pathNode.Length2Formula());
|
||||||
SetAttribute(node, AttrLength2Value, qApp->fromPixel(pathNode.Length2()));
|
SetAttribute(node, AttrLength2Value, VAbstractValApplication::VApp()->fromPixel(pathNode.Length2()));
|
||||||
|
|
||||||
nodes.appendChild(node);
|
nodes.appendChild(node);
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,7 @@ QVector<QPointF> PointBezier_r(qreal x1, qreal y1, qreal x2, qreal y2, qreal x3,
|
||||||
double m_approximation_scale = approximationScale;
|
double m_approximation_scale = approximationScale;
|
||||||
if(m_approximation_scale < minCurveApproximationScale || m_approximation_scale > maxCurveApproximationScale)
|
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;
|
double m_distance_tolerance_square;
|
||||||
|
|
|
@ -145,8 +145,8 @@ QVector<QPointF> VAbstractCurve::GetSegmentPoints(const QPointF &begin, const QP
|
||||||
errorMsg = QObject::tr("Error in path '%1'. Calculating segment for curve '%2' has failed. %3")
|
errorMsg = QObject::tr("Error in path '%1'. Calculating segment for curve '%2' has failed. %3")
|
||||||
.arg(piece, name(), error);
|
.arg(piece, name(), error);
|
||||||
}
|
}
|
||||||
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
return segment;
|
return segment;
|
||||||
|
@ -600,7 +600,7 @@ QPainterPath VAbstractCurve::ShowDirection(const QVector<DirectionArrow> &arrows
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal VAbstractCurve::LengthCurveDirectionArrow()
|
qreal VAbstractCurve::LengthCurveDirectionArrow()
|
||||||
{
|
{
|
||||||
return qApp->Settings()->GetLineWidth() * 8.0;
|
return VAbstractApplication::VApp()->Settings()->GetLineWidth() * 8.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -72,7 +72,7 @@ VArcData::VArcData(qreal radius, const QString &formulaRadius)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VArcData::VArcData(qreal radius)
|
VArcData::VArcData(qreal radius)
|
||||||
: radius(radius),
|
: radius(radius),
|
||||||
formulaRadius(QString().number(qApp->fromPixel(radius)))
|
formulaRadius(QString().number(VAbstractValApplication::VApp()->fromPixel(radius)))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -479,7 +479,7 @@ void VEllipticalArc::FindF2(qreal length)
|
||||||
SetFormulaF2(QString::number(endAngle), endAngle);
|
SetFormulaF2(QString::number(endAngle), endAngle);
|
||||||
lenBez = GetLength();
|
lenBez = GetLength();
|
||||||
}
|
}
|
||||||
SetFormulaLength(QString::number(qApp->fromPixel(lenBez)));
|
SetFormulaLength(QString::number(VAbstractValApplication::VApp()->fromPixel(lenBez)));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -67,10 +67,10 @@ VEllipticalArcData::VEllipticalArcData(qreal radius1, qreal radius2, const QStri
|
||||||
VEllipticalArcData::VEllipticalArcData(qreal radius1, qreal radius2, qreal rotationAngle)
|
VEllipticalArcData::VEllipticalArcData(qreal radius1, qreal radius2, qreal rotationAngle)
|
||||||
: radius1(radius1),
|
: radius1(radius1),
|
||||||
radius2(radius2),
|
radius2(radius2),
|
||||||
formulaRadius1(QString().number(qApp->fromPixel(radius1))),
|
formulaRadius1(QString().number(VAbstractValApplication::VApp()->fromPixel(radius1))),
|
||||||
formulaRadius2(QString().number(qApp->fromPixel(radius2))),
|
formulaRadius2(QString().number(VAbstractValApplication::VApp()->fromPixel(radius2))),
|
||||||
rotationAngle(rotationAngle),
|
rotationAngle(rotationAngle),
|
||||||
formulaRotationAngle(QString().number(qApp->fromPixel(rotationAngle))),
|
formulaRotationAngle(QString().number(VAbstractValApplication::VApp()->fromPixel(rotationAngle))),
|
||||||
m_transform()
|
m_transform()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
|
@ -271,8 +271,8 @@ QString VGObject::GetAliasSuffix() const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VGObject::ObjectName() const
|
QString VGObject::ObjectName() const
|
||||||
{
|
{
|
||||||
const QString alias = qApp->TrVars()->VarToUser(d->m_alias);
|
const QString alias = VAbstractApplication::VApp()->TrVars()->VarToUser(d->m_alias);
|
||||||
const QString name = qApp->TrVars()->VarToUser(d->_name);
|
const QString name = VAbstractApplication::VApp()->TrVars()->VarToUser(d->_name);
|
||||||
return not d->m_alias.isEmpty() ? QString("%1 (%2)").arg(alias, name) : name;
|
return not d->m_alias.isEmpty() ? QString("%1 (%2)").arg(alias, name) : name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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());
|
QLineF p1p2(p1.x(), p1.y(), p1.x() + L * kAsm1, p1.y());
|
||||||
p1p2.setAngle(angle1);
|
p1p2.setAngle(angle1);
|
||||||
c1Length = p1p2.length();
|
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());
|
QLineF p4p3(p4.x(), p4.y(), p4.x() + L * kAsm2, p4.y());
|
||||||
p4p3.setAngle(angle2);
|
p4p3.setAngle(angle2);
|
||||||
c2Length = p4p3.length();
|
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);
|
angle1F = QString().number(angle1);
|
||||||
|
|
||||||
c1Length = p1p2.length();
|
c1Length = p1p2.length();
|
||||||
c1LengthF = QString().number(qApp->fromPixel(c1Length));
|
c1LengthF = QString().number(VAbstractValApplication::VApp()->fromPixel(c1Length));
|
||||||
|
|
||||||
QLineF p4p3(static_cast<QPointF>(p4), static_cast<QPointF>(p3));
|
QLineF p4p3(static_cast<QPointF>(p4), static_cast<QPointF>(p3));
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ VSplineData::VSplineData(VPointF p1, QPointF p2, QPointF p3, VPointF p4)
|
||||||
angle2F = QString().number(angle2);
|
angle2F = QString().number(angle2);
|
||||||
|
|
||||||
c2Length = p4p3.length();
|
c2Length = p4p3.length();
|
||||||
c2LengthF = QString().number(qApp->fromPixel(c2Length));
|
c2LengthF = QString().number(VAbstractValApplication::VApp()->fromPixel(c2Length));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -41,7 +41,7 @@ DialogLayoutScale::DialogLayoutScale(bool printTiled, QWidget *parent)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
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);
|
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||||
SCASSERT(bOk != nullptr)
|
SCASSERT(bOk != nullptr)
|
||||||
|
@ -72,7 +72,7 @@ DialogLayoutScale::~DialogLayoutScale()
|
||||||
void DialogLayoutScale::SetTiledMargins(QMarginsF margins)
|
void DialogLayoutScale::SetTiledMargins(QMarginsF margins)
|
||||||
{
|
{
|
||||||
// read Margins top, right, bottom, left
|
// 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->doubleSpinBoxLeftField->setValue(margins.left());
|
||||||
ui->doubleSpinBoxTopField->setValue(margins.top());
|
ui->doubleSpinBoxTopField->setValue(margins.top());
|
||||||
|
@ -90,7 +90,7 @@ QMarginsF DialogLayoutScale::GetTiledMargins() const
|
||||||
ui->doubleSpinBoxBottomField->value()
|
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()
|
void DialogLayoutScale::ReadSettings()
|
||||||
{
|
{
|
||||||
VCommonSettings *settings = qApp->Settings();
|
VCommonSettings *settings = VAbstractApplication::VApp()->Settings();
|
||||||
const Unit unit = qApp->patternUnits();
|
const Unit unit = VAbstractValApplication::VApp()->patternUnits();
|
||||||
|
|
||||||
// read Margins top, right, bottom, left
|
// read Margins top, right, bottom, left
|
||||||
const QMarginsF margins = settings->GetTiledPDFMargins(unit);
|
const QMarginsF margins = settings->GetTiledPDFMargins(unit);
|
||||||
|
@ -201,8 +201,8 @@ void DialogLayoutScale::ReadSettings()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogLayoutScale::WriteSettings() const
|
void DialogLayoutScale::WriteSettings() const
|
||||||
{
|
{
|
||||||
VCommonSettings *settings = qApp->Settings();
|
VCommonSettings *settings = VAbstractApplication::VApp()->Settings();
|
||||||
const Unit unit = qApp->patternUnits();
|
const Unit unit = VAbstractValApplication::VApp()->patternUnits();
|
||||||
|
|
||||||
// write Margins top, right, bottom, left
|
// write Margins top, right, bottom, left
|
||||||
QMarginsF margins = QMarginsF(
|
QMarginsF margins = QMarginsF(
|
||||||
|
|
|
@ -1071,8 +1071,8 @@ QVector<QPointF> VAbstractPiece::Equidistant(QVector<VSAPoint> points, qreal wid
|
||||||
if ( points.size() < 3 )
|
if ( points.size() < 3 )
|
||||||
{
|
{
|
||||||
const QString errorMsg = tr("Piece '%1'. Not enough points to build seam allowance.").arg(name);
|
const QString errorMsg = tr("Piece '%1'. Not enough points to build seam allowance.").arg(name);
|
||||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
return QVector<QPointF>();
|
return QVector<QPointF>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -390,8 +390,8 @@ bool VBank::PrepareDetails()
|
||||||
{
|
{
|
||||||
const QString errorMsg = QObject::tr("Piece '%1' has invalid layout allowance. Please, check seam allowance"
|
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());
|
" to check how seam allowance behave.").arg(details.at(i).GetName());
|
||||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
const qreal d = details.at(i).Diagonal();
|
const qreal d = details.at(i).Diagonal();
|
||||||
|
|
|
@ -274,8 +274,8 @@ QVector<VLayoutPassmark> ConvertPassmarks(const VPiece &piece, const VContainer
|
||||||
const QString errorMsg =
|
const QString errorMsg =
|
||||||
QObject::tr("Cannot prepare builtin passmark '%1' for piece '%2'. Passmark is empty.")
|
QObject::tr("Cannot prepare builtin passmark '%1' for piece '%2'. Passmark is empty.")
|
||||||
.arg(pData.nodeName, piece.GetName());
|
.arg(pData.nodeName, piece.GetName());
|
||||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,8 +288,8 @@ QVector<VLayoutPassmark> ConvertPassmarks(const VPiece &piece, const VContainer
|
||||||
QObject::tr("Cannot prepare builtin passmark '%1' for piece '%2'. Passmark base line is "
|
QObject::tr("Cannot prepare builtin passmark '%1' for piece '%2'. Passmark base line is "
|
||||||
"empty.")
|
"empty.")
|
||||||
.arg(pData.nodeName, piece.GetName());
|
.arg(pData.nodeName, piece.GetName());
|
||||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
layoutPassmark.baseLine = ConstFirst (baseLines);
|
layoutPassmark.baseLine = ConstFirst (baseLines);
|
||||||
|
@ -305,8 +305,8 @@ QVector<VLayoutPassmark> ConvertPassmarks(const VPiece &piece, const VContainer
|
||||||
const QString errorMsg =
|
const QString errorMsg =
|
||||||
QObject::tr("Passmark '%1' is not part of piece '%2'.")
|
QObject::tr("Passmark '%1' is not part of piece '%2'.")
|
||||||
.arg(pData.nodeName, piece.GetName());
|
.arg(pData.nodeName, piece.GetName());
|
||||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -331,8 +331,8 @@ QVector<VLayoutPassmark> ConvertPassmarks(const VPiece &piece, const VContainer
|
||||||
const QString errorMsg =
|
const QString errorMsg =
|
||||||
QObject::tr("Cannot prepare passmark '%1' for piece '%2'. Passmark base line is empty.")
|
QObject::tr("Cannot prepare passmark '%1' for piece '%2'. Passmark base line is empty.")
|
||||||
.arg(pData.nodeName, piece.GetName());
|
.arg(pData.nodeName, piece.GetName());
|
||||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,8 +351,8 @@ QVector<VLayoutPassmark> ConvertPassmarks(const VPiece &piece, const VContainer
|
||||||
const QString errorMsg =
|
const QString errorMsg =
|
||||||
QObject::tr("Cannot prepare passmark '%1' for piece '%2'. Passmark is empty.")
|
QObject::tr("Cannot prepare passmark '%1' for piece '%2'. Passmark is empty.")
|
||||||
.arg(pData.nodeName, piece.GetName());
|
.arg(pData.nodeName, piece.GetName());
|
||||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -367,8 +367,8 @@ QVector<VLayoutPassmark> ConvertPassmarks(const VPiece &piece, const VContainer
|
||||||
const QString errorMsg =
|
const QString errorMsg =
|
||||||
QObject::tr("Passmark '%1' is not part of piece '%2'.")
|
QObject::tr("Passmark '%1' is not part of piece '%2'.")
|
||||||
.arg(pData.nodeName, piece.GetName());
|
.arg(pData.nodeName, piece.GetName());
|
||||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -404,8 +404,9 @@ QVector<VLayoutPassmark> ConvertPassmarks(const VPiece &piece, const VContainer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qApp->Settings()->IsDoublePassmark()
|
if (VAbstractApplication::VApp()->Settings()->IsDoublePassmark()
|
||||||
&& (qApp->Settings()->IsPieceShowMainPath() || not piece.IsHideMainPath())
|
&& (VAbstractApplication::VApp()->Settings()->IsPieceShowMainPath() ||
|
||||||
|
not piece.IsHideMainPath())
|
||||||
&& pData.isMainPathNode
|
&& pData.isMainPathNode
|
||||||
&& pData.passmarkAngleType != PassmarkAngleType::Intersection
|
&& pData.passmarkAngleType != PassmarkAngleType::Intersection
|
||||||
&& pData.passmarkAngleType != PassmarkAngleType::IntersectionOnlyLeft
|
&& pData.passmarkAngleType != PassmarkAngleType::IntersectionOnlyLeft
|
||||||
|
@ -504,7 +505,7 @@ VLayoutPiece VLayoutPiece::Create(const VPiece &piece, vidtype id, const VContai
|
||||||
|
|
||||||
det.SetName(piece.GetName());
|
det.SetName(piece.GetName());
|
||||||
|
|
||||||
det.SetSAWidth(qApp->toPixel(piece.GetSAWidth()));
|
det.SetSAWidth(VAbstractValApplication::VApp()->toPixel(piece.GetSAWidth()));
|
||||||
det.SetForbidFlipping(piece.IsForbidFlipping());
|
det.SetForbidFlipping(piece.IsForbidFlipping());
|
||||||
det.SetForceFlipping(piece.IsForceFlipping());
|
det.SetForceFlipping(piece.IsForceFlipping());
|
||||||
det.SetId(id);
|
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.")
|
const QString errorMsg = QObject::tr("Piece '%1'. Seam allowance is not valid.")
|
||||||
.arg(piece.GetName());
|
.arg(piece.GetName());
|
||||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
det.SetCountourPoints(futureMainPath.result(),
|
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.SetSeamAllowancePoints(futureSeamAllowance.result(), piece.IsSeamAllowance(), piece.IsSeamAllowanceBuiltIn());
|
||||||
det.SetInternalPaths(futureInternalPaths.result());
|
det.SetInternalPaths(futureInternalPaths.result());
|
||||||
det.SetPassmarks(futurePassmarks.result());
|
det.SetPassmarks(futurePassmarks.result());
|
||||||
|
@ -535,14 +537,14 @@ VLayoutPiece VLayoutPiece::Create(const VPiece &piece, vidtype id, const VContai
|
||||||
det.SetQuantity(data.GetQuantity());
|
det.SetQuantity(data.GetQuantity());
|
||||||
if (data.IsVisible())
|
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();
|
const VPatternLabelData& geom = piece.GetPatternInfo();
|
||||||
if (geom.IsVisible())
|
if (geom.IsVisible())
|
||||||
{
|
{
|
||||||
VAbstractPattern* pDoc = qApp->getCurrentDocument();
|
VAbstractPattern* pDoc = VAbstractValApplication::VApp()->getCurrentDocument();
|
||||||
det.SetPatternInfo(pDoc, geom, qApp->Settings()->GetLabelFont(), pattern);
|
det.SetPatternInfo(pDoc, geom, VAbstractApplication::VApp()->Settings()->GetLabelFont(), pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
const VGrainlineData& grainlineGeom = piece.GetGrainlineGeometry();
|
const VGrainlineData& grainlineGeom = piece.GetGrainlineGeometry();
|
||||||
|
@ -1158,7 +1160,7 @@ QGraphicsItem *VLayoutPiece::GetItem(bool textAsPaths) const
|
||||||
|
|
||||||
QPen pen = pathItem->pen();
|
QPen pen = pathItem->pen();
|
||||||
pen.setStyle(path.PenStyle());
|
pen.setStyle(path.PenStyle());
|
||||||
pen.setWidthF(qApp->Settings()->WidthHairLine());
|
pen.setWidthF(VAbstractApplication::VApp()->Settings()->WidthHairLine());
|
||||||
pathItem->setPen(pen);
|
pathItem->setPen(pen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1166,7 +1168,7 @@ QGraphicsItem *VLayoutPiece::GetItem(bool textAsPaths) const
|
||||||
{
|
{
|
||||||
QGraphicsPathItem* pathItem = new QGraphicsPathItem(item);
|
QGraphicsPathItem* pathItem = new QGraphicsPathItem(item);
|
||||||
QPen pen = pathItem->pen();
|
QPen pen = pathItem->pen();
|
||||||
pen.setWidthF(qApp->Settings()->WidthHairLine());
|
pen.setWidthF(VAbstractApplication::VApp()->Settings()->WidthHairLine());
|
||||||
pathItem->setPen(pen);
|
pathItem->setPen(pen);
|
||||||
pathItem->setPath(d->matrix.map(VPlaceLabelItem::LabelShapePath(label.shape)));
|
pathItem->setPath(d->matrix.map(VPlaceLabelItem::LabelShapePath(label.shape)));
|
||||||
}
|
}
|
||||||
|
@ -1333,7 +1335,7 @@ void VLayoutPiece::CreateGrainlineItem(QGraphicsItem *parent) const
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto* item = new VGraphicsFillItem(parent);
|
auto* item = new VGraphicsFillItem(parent);
|
||||||
item->SetWidth(qApp->Settings()->WidthHairLine());
|
item->SetWidth(VAbstractApplication::VApp()->Settings()->WidthHairLine());
|
||||||
|
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
|
|
||||||
|
@ -1364,7 +1366,7 @@ QGraphicsPathItem *VLayoutPiece::GetMainItem() const
|
||||||
{
|
{
|
||||||
QGraphicsPathItem *item = new QGraphicsPathItem();
|
QGraphicsPathItem *item = new QGraphicsPathItem();
|
||||||
QPen pen = item->pen();
|
QPen pen = item->pen();
|
||||||
pen.setWidthF(qApp->Settings()->WidthHairLine());
|
pen.setWidthF(VAbstractApplication::VApp()->Settings()->WidthHairLine());
|
||||||
item->setPen(pen);
|
item->setPen(pen);
|
||||||
item->setPath(ContourPath());
|
item->setPath(ContourPath());
|
||||||
return item;
|
return item;
|
||||||
|
@ -1375,7 +1377,7 @@ QGraphicsPathItem *VLayoutPiece::GetMainPathItem() const
|
||||||
{
|
{
|
||||||
QGraphicsPathItem *item = new QGraphicsPathItem();
|
QGraphicsPathItem *item = new QGraphicsPathItem();
|
||||||
QPen pen = item->pen();
|
QPen pen = item->pen();
|
||||||
pen.setWidthF(qApp->Settings()->WidthHairLine());
|
pen.setWidthF(VAbstractApplication::VApp()->Settings()->WidthHairLine());
|
||||||
item->setPen(pen);
|
item->setPen(pen);
|
||||||
|
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
|
|
|
@ -309,8 +309,8 @@ QVector<QGraphicsItem *> VPoster::ImageWatermark(QGraphicsItem *parent, const Po
|
||||||
if (watermark.isNull())
|
if (watermark.isNull())
|
||||||
{
|
{
|
||||||
const QString errorMsg = tr("Cannot open the watermark image.") + QChar(' ') + error;
|
const QString errorMsg = tr("Cannot open the watermark image.") + QChar(' ') + error;
|
||||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,8 +319,8 @@ QVector<QGraphicsItem *> VPoster::ImageWatermark(QGraphicsItem *parent, const Po
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const QString errorMsg = tr("Not supported file suffix '%1'").arg(f.suffix());
|
const QString errorMsg = tr("Not supported file suffix '%1'").arg(f.suffix());
|
||||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -456,7 +456,7 @@ void VPoster::Ruler(QVector<QGraphicsItem *> &data, QGraphicsItem *parent, QRect
|
||||||
|
|
||||||
const qreal notchHeight = ToPixel(3); // mm
|
const qreal notchHeight = ToPixel(3); // mm
|
||||||
const qreal shortNotchHeight = ToPixel(1.1); // 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);
|
const qreal step = UnitConvertor(1, patternUnits, Unit::Px);
|
||||||
double marksCount = rec.width() / step;
|
double marksCount = rec.width() / step;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
|
@ -320,7 +320,8 @@ void VPrintLayout::PrintPages(QPrinter *printer)
|
||||||
}
|
}
|
||||||
|
|
||||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
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 ) );
|
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
@ -732,8 +733,8 @@ auto VPrintLayout::WatermarkData() const -> VWatermarkData
|
||||||
catch (VException &e)
|
catch (VException &e)
|
||||||
{
|
{
|
||||||
const QString errorMsg = tr("File error.\n\n%1\n\n%2").arg(e.ErrorMessage(), e.DetailedInformation());
|
const QString errorMsg = tr("File error.\n\n%1\n\n%2").arg(e.ErrorMessage(), e.DetailedInformation());
|
||||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -175,7 +175,7 @@ QMap<QString, QString> PreparePlaceholders(const VAbstractPattern *doc, const VC
|
||||||
QMap<QString, QString> placeholders;
|
QMap<QString, QString> placeholders;
|
||||||
|
|
||||||
// Pattern tags
|
// Pattern tags
|
||||||
QLocale locale(qApp->Settings()->GetLocale());
|
QLocale locale(VAbstractApplication::VApp()->Settings()->GetLocale());
|
||||||
|
|
||||||
const QString date = locale.toString(QDate::currentDate(), doc->GetLabelDateFormat());
|
const QString date = locale.toString(QDate::currentDate(), doc->GetLabelDateFormat());
|
||||||
placeholders.insert(pl_date, date);
|
placeholders.insert(pl_date, date);
|
||||||
|
@ -187,18 +187,19 @@ QMap<QString, QString> PreparePlaceholders(const VAbstractPattern *doc, const VC
|
||||||
placeholders.insert(pl_patternNumber, doc->GetPatternNumber());
|
placeholders.insert(pl_patternNumber, doc->GetPatternNumber());
|
||||||
placeholders.insert(pl_author, doc->GetCompanyName());
|
placeholders.insert(pl_author, doc->GetCompanyName());
|
||||||
|
|
||||||
placeholders.insert(pl_mUnits, UnitsToStr(qApp->MeasurementsUnits(), true));
|
placeholders.insert(pl_mUnits, UnitsToStr(VAbstractValApplication::VApp()->MeasurementsUnits(), true));
|
||||||
placeholders.insert(pl_pUnits, UnitsToStr(qApp->patternUnits(), true));
|
placeholders.insert(pl_pUnits, UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
||||||
placeholders.insert(pl_mSizeUnits, UnitsToStr(qApp->DimensionSizeUnits(), 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_birthDate, birthDate);
|
||||||
|
|
||||||
placeholders.insert(pl_email, qApp->CustomerEmail());
|
placeholders.insert(pl_email, VAbstractValApplication::VApp()->CustomerEmail());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -211,15 +212,15 @@ QMap<QString, QString> PreparePlaceholders(const VAbstractPattern *doc, const VC
|
||||||
}
|
}
|
||||||
|
|
||||||
placeholders.insert(pl_pExt, QStringLiteral("val"));
|
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_mFileName, QFileInfo(doc->MPath()).baseName());
|
||||||
|
|
||||||
placeholders.insert(pl_height, QString::number(qApp->GetDimensionHeight()));
|
placeholders.insert(pl_height, QString::number(VAbstractValApplication::VApp()->GetDimensionHeight()));
|
||||||
placeholders.insert(pl_size, QString::number(qApp->GetDimensionSize()));
|
placeholders.insert(pl_size, QString::number(VAbstractValApplication::VApp()->GetDimensionSize()));
|
||||||
placeholders.insert(pl_hip, QString::number(qApp->GetDimensionHip()));
|
placeholders.insert(pl_hip, QString::number(VAbstractValApplication::VApp()->GetDimensionHip()));
|
||||||
placeholders.insert(pl_waist, QString::number(qApp->GetDimensionWaist()));
|
placeholders.insert(pl_waist, QString::number(VAbstractValApplication::VApp()->GetDimensionWaist()));
|
||||||
placeholders.insert(pl_mExt, qApp->GetMeasurementsType() == MeasurementsType::Multisize ? QString("vst")
|
placeholders.insert(pl_mExt, VAbstractValApplication::VApp()->GetMeasurementsType() == MeasurementsType::Multisize
|
||||||
: QString("vit"));
|
? QString("vst") : QString("vit"));
|
||||||
|
|
||||||
const QMap<int, QString> materials = doc->GetPatternMaterials();
|
const QMap<int, QString> materials = doc->GetPatternMaterials();
|
||||||
for (int i = 0; i < userMaterialPlaceholdersQuantity; ++i)
|
for (int i = 0; i < userMaterialPlaceholdersQuantity; ++i)
|
||||||
|
@ -265,8 +266,8 @@ QMap<QString, QString> PreparePlaceholders(const VAbstractPattern *doc, const VC
|
||||||
{
|
{
|
||||||
const QString errorMsg = QObject::tr("Failed to prepare final measurement placeholder. Parser error at "
|
const QString errorMsg = QObject::tr("Failed to prepare final measurement placeholder. Parser error at "
|
||||||
"line %1: %2.").arg(i+1).arg(e.GetMsg());
|
"line %1: %2.").arg(i+1).arg(e.GetMsg());
|
||||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -317,8 +318,8 @@ QString ReplacePlaceholders(const QMap<QString, QString> &placeholders, QString
|
||||||
{
|
{
|
||||||
if (line.contains(per+placeholder+per) && placeholders.value(placeholder) == QChar('0'))
|
if (line.contains(per+placeholder+per) && placeholders.value(placeholder) == QChar('0'))
|
||||||
{
|
{
|
||||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -531,7 +532,8 @@ void VTextManager::Update(const QString& qsName, const VPieceLabelData& data, co
|
||||||
{
|
{
|
||||||
m_liLines.clear();
|
m_liLines.clear();
|
||||||
|
|
||||||
QMap<QString, QString> placeholders = PreparePlaceholders(qApp->getCurrentDocument(), pattern);
|
QMap<QString, QString> placeholders =
|
||||||
|
PreparePlaceholders(VAbstractValApplication::VApp()->getCurrentDocument(), pattern);
|
||||||
InitPiecePlaceholders(placeholders, qsName, data);
|
InitPiecePlaceholders(placeholders, qsName, data);
|
||||||
|
|
||||||
QVector<VLabelTemplateLine> lines = data.GetLabelTemplate();
|
QVector<VLabelTemplateLine> lines = data.GetLabelTemplate();
|
||||||
|
|
|
@ -599,7 +599,8 @@ void InitLanguages(QComboBox *combobox)
|
||||||
combobox->clear();
|
combobox->clear();
|
||||||
|
|
||||||
QStringList fileNames;
|
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())
|
while (it.hasNext())
|
||||||
{
|
{
|
||||||
it.next();
|
it.next();
|
||||||
|
@ -636,7 +637,7 @@ void InitLanguages(QComboBox *combobox)
|
||||||
}
|
}
|
||||||
|
|
||||||
// set default translators and language checked
|
// set default translators and language checked
|
||||||
qint32 index = combobox->findData(qApp->Settings()->GetLocale());
|
qint32 index = combobox->findData(VAbstractApplication::VApp()->Settings()->GetLocale());
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
{
|
{
|
||||||
combobox->setCurrentIndex(index);
|
combobox->setCurrentIndex(index);
|
||||||
|
|
|
@ -68,7 +68,7 @@ DialogExportToCSV::DialogExportToCSV(QWidget *parent)
|
||||||
ui->checkBoxWithHeader->blockSignals(true);
|
ui->checkBoxWithHeader->blockSignals(true);
|
||||||
ui->buttonGroup->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()));
|
ui->comboBoxCodec->setCurrentIndex(ui->comboBoxCodec->findData(VCommonSettings::GetDefCSVCodec()));
|
||||||
|
|
||||||
SetSeparator(VCommonSettings::GetDefCSVSeparator());
|
SetSeparator(VCommonSettings::GetDefCSVSeparator());
|
||||||
|
|
|
@ -33,11 +33,6 @@
|
||||||
#include "projectversion.h"
|
#include "projectversion.h"
|
||||||
#include "../vmisc/vsettings.h"
|
#include "../vmisc/vsettings.h"
|
||||||
|
|
||||||
#if defined(qApp)
|
|
||||||
#undef qApp
|
|
||||||
#endif
|
|
||||||
#define qApp (static_cast<TestVApplication*>(QCoreApplication::instance()))
|
|
||||||
|
|
||||||
class VTestSettings;
|
class VTestSettings;
|
||||||
|
|
||||||
class TestVApplication : public VAbstractValApplication
|
class TestVApplication : public VAbstractValApplication
|
||||||
|
@ -80,6 +75,11 @@ public:
|
||||||
m_trVars = trVars;
|
m_trVars = trVars;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static TestVApplication *VApp()
|
||||||
|
{
|
||||||
|
return static_cast<TestVApplication*>(QCoreApplication::instance());
|
||||||
|
}
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
virtual void AboutToQuit() override
|
virtual void AboutToQuit() override
|
||||||
{}
|
{}
|
||||||
|
|
|
@ -324,3 +324,9 @@ QFileDialog::Options VAbstractApplication::NativeFileDialog(QFileDialog::Options
|
||||||
|
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VAbstractApplication::VApp() -> VAbstractApplication *
|
||||||
|
{
|
||||||
|
return qobject_cast<VAbstractApplication*>(QCoreApplication::instance());
|
||||||
|
}
|
||||||
|
|
|
@ -49,11 +49,6 @@ class QUndoStack;
|
||||||
class VAbstractApplication;// use in define
|
class VAbstractApplication;// use in define
|
||||||
class VCommonSettings;
|
class VCommonSettings;
|
||||||
|
|
||||||
#if defined(qApp)
|
|
||||||
#undef qApp
|
|
||||||
#endif
|
|
||||||
#define qApp (qobject_cast<VAbstractApplication*>(QCoreApplication::instance()))
|
|
||||||
|
|
||||||
class VAbstractApplication : public QApplication
|
class VAbstractApplication : public QApplication
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -89,6 +84,8 @@ public:
|
||||||
static void WinAttachConsole();
|
static void WinAttachConsole();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static VAbstractApplication *VApp();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QUndoStack *undoStack;
|
QUndoStack *undoStack;
|
||||||
|
|
||||||
|
@ -119,7 +116,7 @@ template <typename T>
|
||||||
inline QString VAbstractApplication::LocaleToString(const T &value)
|
inline QString VAbstractApplication::LocaleToString(const T &value)
|
||||||
{
|
{
|
||||||
QLocale loc;
|
QLocale loc;
|
||||||
qApp->Settings()->GetOsSeparator() ? loc = QLocale() : loc = QLocale::c();
|
VAbstractApplication::VApp()->Settings()->GetOsSeparator() ? loc = QLocale() : loc = QLocale::c();
|
||||||
return loc.toString(value);
|
return loc.toString(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,5 +71,11 @@ void VAbstractValApplication::OpenSettings()
|
||||||
VSettings *VAbstractValApplication::ValentinaSettings()
|
VSettings *VAbstractValApplication::ValentinaSettings()
|
||||||
{
|
{
|
||||||
SCASSERT(settings != nullptr)
|
SCASSERT(settings != nullptr)
|
||||||
return qobject_cast<VSettings *>(settings);
|
return qobject_cast<VSettings *>(settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VAbstractValApplication::VApp() -> VAbstractValApplication *
|
||||||
|
{
|
||||||
|
return qobject_cast<VAbstractValApplication*>(QCoreApplication::instance());
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,11 +38,6 @@ class VMainGraphicsView;
|
||||||
class QGraphicsScene;
|
class QGraphicsScene;
|
||||||
class VSettings;
|
class VSettings;
|
||||||
|
|
||||||
#if defined(qApp)
|
|
||||||
#undef qApp
|
|
||||||
#endif
|
|
||||||
#define qApp (qobject_cast<VAbstractValApplication*>(QCoreApplication::instance()))
|
|
||||||
|
|
||||||
class VAbstractValApplication : public VAbstractApplication
|
class VAbstractValApplication : public VAbstractApplication
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -116,6 +111,8 @@ public:
|
||||||
virtual void OpenSettings() override;
|
virtual void OpenSettings() override;
|
||||||
VSettings *ValentinaSettings();
|
VSettings *ValentinaSettings();
|
||||||
|
|
||||||
|
static VAbstractValApplication *VApp();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QString m_customerName{};
|
QString m_customerName{};
|
||||||
QDate m_customerBirthDate{};
|
QDate m_customerBirthDate{};
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
* Use this constuctor for evaluation formula. All formulas must be converted to internal look.
|
* Use this constuctor for evaluation formula. All formulas must be converted to internal look.
|
||||||
* Example:
|
* Example:
|
||||||
*
|
*
|
||||||
* const QString formula = qApp->FormulaFromUser(edit->text());
|
* const QString formula = VAbstractApplication::VApp()->FormulaFromUser(edit->text());
|
||||||
* Calculator *cal = new Calculator(data, patternType);
|
* Calculator *cal = new Calculator(data, patternType);
|
||||||
* const qreal result = cal->EvalFormula(data->PlainVariables(), formula);
|
* const qreal result = cal->EvalFormula(data->PlainVariables(), formula);
|
||||||
* delete cal;
|
* delete cal;
|
||||||
|
@ -124,8 +124,8 @@ qreal *Calculator::VarFactory(const QString &a_szName, void *a_pUserData)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal Calculator::Warning(const QString &warningMsg, qreal value)
|
qreal Calculator::Warning(const QString &warningMsg, qreal value)
|
||||||
{
|
{
|
||||||
qApp->IsPedantic() ? throw qmu::QmuParserWarning(warningMsg)
|
VAbstractApplication::VApp()->IsPedantic() ? throw qmu::QmuParserWarning(warningMsg) :
|
||||||
: qWarning() << VAbstractApplication::warningMessageSignature + warningMsg;
|
qWarning() << VAbstractApplication::warningMessageSignature + warningMsg;
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,14 +161,15 @@ void InitPMSystems(QComboBox *systemCombo)
|
||||||
QMap<QString, QString> systems;
|
QMap<QString, QString> systems;
|
||||||
for (auto &sys : listSystems)
|
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 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.
|
// * The list should be sorted alphabetically so users can find their system easily.
|
||||||
|
|
||||||
SCASSERT(systemCombo != nullptr)
|
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));
|
listSystems.at(listSystems.size()-1));
|
||||||
|
|
||||||
QMap<QString, QString>::const_iterator i = systems.constBegin();
|
QMap<QString, QString>::const_iterator i = systems.constBegin();
|
||||||
|
|
|
@ -94,7 +94,7 @@ QString VFormula::GetFormula(FormulaType type) const
|
||||||
{
|
{
|
||||||
if (type == FormulaType::ToUser)
|
if (type == FormulaType::ToUser)
|
||||||
{
|
{
|
||||||
return VTranslateVars::TryFormulaToUser(d->formula, qApp->Settings()->GetOsSeparator());
|
return VTranslateVars::TryFormulaToUser(d->formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -109,7 +109,8 @@ void VFormula::SetFormula(const QString &value, FormulaType type)
|
||||||
{
|
{
|
||||||
if (type == FormulaType::FromUser)
|
if (type == FormulaType::FromUser)
|
||||||
{
|
{
|
||||||
d->formula = VTranslateVars::TryFormulaFromUser(value, qApp->Settings()->GetOsSeparator());
|
d->formula = VTranslateVars::TryFormulaFromUser(value,
|
||||||
|
VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -262,7 +263,7 @@ void VFormula::Eval()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
d->strValue = qApp->LocaleToString(result) + QLatin1Char(' ') + d->postfix;
|
d->strValue = VAbstractApplication::VApp()->LocaleToString(result) + QLatin1Char(' ') + d->postfix;
|
||||||
d->error = false;
|
d->error = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -578,8 +578,8 @@ QVector<QLineF> PassmarkBisectorBaseLine(PassmarkStatus seamPassmarkType, const
|
||||||
const QString errorMsg = QObject::tr("Found null notch for point '%1' in piece '%2'. Length is less "
|
const QString errorMsg = QObject::tr("Found null notch for point '%1' in piece '%2'. Length is less "
|
||||||
"than minimal allowed.")
|
"than minimal allowed.")
|
||||||
.arg(passmarkData.nodeName, passmarkData.pieceName);
|
.arg(passmarkData.nodeName, passmarkData.pieceName);
|
||||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
return QVector<QLineF>();
|
return QVector<QLineF>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -661,8 +661,8 @@ QVector<QLineF> VPassmark::FullPassmark(const VPiece &piece, const VContainer *d
|
||||||
{
|
{
|
||||||
QVector<QLineF> lines;
|
QVector<QLineF> lines;
|
||||||
lines += SAPassmark(piece, data, PassmarkSide::All);
|
lines += SAPassmark(piece, data, PassmarkSide::All);
|
||||||
if (qApp->Settings()->IsDoublePassmark()
|
if (VAbstractApplication::VApp()->Settings()->IsDoublePassmark()
|
||||||
&& (qApp->Settings()->IsPieceShowMainPath() || not piece.IsHideMainPath())
|
&& (VAbstractApplication::VApp()->Settings()->IsPieceShowMainPath() || not piece.IsHideMainPath())
|
||||||
&& m_data.isMainPathNode
|
&& m_data.isMainPathNode
|
||||||
&& m_data.passmarkAngleType != PassmarkAngleType::Intersection
|
&& m_data.passmarkAngleType != PassmarkAngleType::Intersection
|
||||||
&& m_data.passmarkAngleType != PassmarkAngleType::IntersectionOnlyLeft
|
&& m_data.passmarkAngleType != PassmarkAngleType::IntersectionOnlyLeft
|
||||||
|
@ -787,7 +787,7 @@ QVector<QLineF> VPassmark::BuiltInSAPassmarkBaseLine(const VPiece &piece) const
|
||||||
const QString errorMsg = QObject::tr("Found null notch for point '%1' in piece '%2'. Length is less "
|
const QString errorMsg = QObject::tr("Found null notch for point '%1' in piece '%2'. Length is less "
|
||||||
"than minimal allowed.")
|
"than minimal allowed.")
|
||||||
.arg(m_data.nodeName, m_data.pieceName);
|
.arg(m_data.nodeName, m_data.pieceName);
|
||||||
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
return QVector<QLineF>();
|
return QVector<QLineF>();
|
||||||
}
|
}
|
||||||
|
@ -803,8 +803,8 @@ QVector<QLineF> VPassmark::BuiltInSAPassmarkBaseLine(const VPiece &piece) const
|
||||||
const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2' with built in "
|
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.")
|
"seam allowance. User must manually provide length.")
|
||||||
.arg(m_data.nodeName, m_data.pieceName);
|
.arg(m_data.nodeName, m_data.pieceName);
|
||||||
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
return QVector<QLineF>();
|
return QVector<QLineF>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -847,8 +847,8 @@ QVector<QLineF> VPassmark::SAPassmarkBaseLine(const QVector<QPointF> &seamAllowa
|
||||||
{
|
{
|
||||||
const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2'. Seam allowance is "
|
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);
|
"empty.").arg(m_data.nodeName, m_data.pieceName);
|
||||||
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
return QVector<QLineF>(); // Something wrong
|
return QVector<QLineF>(); // Something wrong
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -859,8 +859,8 @@ QVector<QLineF> VPassmark::SAPassmarkBaseLine(const QVector<QPointF> &seamAllowa
|
||||||
const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2'. Cannot find "
|
const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2'. Cannot find "
|
||||||
"position for a notch.")
|
"position for a notch.")
|
||||||
.arg(m_data.nodeName, m_data.pieceName);
|
.arg(m_data.nodeName, m_data.pieceName);
|
||||||
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
return QVector<QLineF>(); // Something wrong
|
return QVector<QLineF>(); // Something wrong
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -869,8 +869,8 @@ QVector<QLineF> VPassmark::SAPassmarkBaseLine(const QVector<QPointF> &seamAllowa
|
||||||
const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2'. Unable to fix a "
|
const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2'. Unable to fix a "
|
||||||
"notch position.")
|
"notch position.")
|
||||||
.arg(m_data.nodeName, m_data.pieceName);
|
.arg(m_data.nodeName, m_data.pieceName);
|
||||||
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto PassmarkIntersection = [this, seamAllowance] (QLineF line, qreal width)
|
auto PassmarkIntersection = [this, seamAllowance] (QLineF line, qreal width)
|
||||||
|
@ -896,8 +896,8 @@ QVector<QLineF> VPassmark::SAPassmarkBaseLine(const QVector<QPointF> &seamAllowa
|
||||||
const QString errorMsg = QObject::tr("Found null notch for point '%1' in piece '%2'. Length is "
|
const QString errorMsg = QObject::tr("Found null notch for point '%1' in piece '%2'. Length is "
|
||||||
"less than minimal allowed.")
|
"less than minimal allowed.")
|
||||||
.arg(m_data.nodeName, m_data.pieceName);
|
.arg(m_data.nodeName, m_data.pieceName);
|
||||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
return QLineF();
|
return QLineF();
|
||||||
}
|
}
|
||||||
line.setLength(length);
|
line.setLength(length);
|
||||||
|
@ -913,8 +913,8 @@ QVector<QLineF> VPassmark::SAPassmarkBaseLine(const QVector<QPointF> &seamAllowa
|
||||||
const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2'. Notch "
|
const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2'. Notch "
|
||||||
"collapse.")
|
"collapse.")
|
||||||
.arg(m_data.nodeName, m_data.pieceName);
|
.arg(m_data.nodeName, m_data.pieceName);
|
||||||
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -922,8 +922,8 @@ QVector<QLineF> VPassmark::SAPassmarkBaseLine(const QVector<QPointF> &seamAllowa
|
||||||
const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2'. Cannot find "
|
const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2'. Cannot find "
|
||||||
"intersection.")
|
"intersection.")
|
||||||
.arg(m_data.nodeName, m_data.pieceName);
|
.arg(m_data.nodeName, m_data.pieceName);
|
||||||
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
return QLineF();
|
return QLineF();
|
||||||
|
@ -937,8 +937,8 @@ QVector<QLineF> VPassmark::SAPassmarkBaseLine(const QVector<QPointF> &seamAllowa
|
||||||
const QString errorMsg = QObject::tr("Found null notch for point '%1' in piece '%2'. Length is less "
|
const QString errorMsg = QObject::tr("Found null notch for point '%1' in piece '%2'. Length is less "
|
||||||
"than minimal allowed.")
|
"than minimal allowed.")
|
||||||
.arg(m_data.nodeName, m_data.pieceName);
|
.arg(m_data.nodeName, m_data.pieceName);
|
||||||
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -936,8 +936,8 @@ bool VPiece::GetPassmarkPreviousSAPoints(const QVector<VPieceNode> &path, int in
|
||||||
{
|
{
|
||||||
const QString errorMsg = tr("Cannot calculate a notch for point '%1' in piece '%2'.")
|
const QString errorMsg = tr("Cannot calculate a notch for point '%1' in piece '%2'.")
|
||||||
.arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName());
|
.arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName());
|
||||||
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
return false; // Something wrong
|
return false; // Something wrong
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -975,8 +975,8 @@ bool VPiece::GetPassmarkNextSAPoints(const QVector<VPieceNode> &path, int index,
|
||||||
{
|
{
|
||||||
const QString errorMsg = tr("Cannot calculate a notch for point '%1' in piece '%2'.")
|
const QString errorMsg = tr("Cannot calculate a notch for point '%1' in piece '%2'.")
|
||||||
.arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName());
|
.arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName());
|
||||||
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
return false; // Something wrong
|
return false; // Something wrong
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1059,8 +1059,8 @@ VPassmark VPiece::CreatePassmark(const QVector<VPieceNode> &path, int previousIn
|
||||||
{
|
{
|
||||||
const QString errorMsg = tr("Cannot calculate a notch for point '%1' in piece '%2'.")
|
const QString errorMsg = tr("Cannot calculate a notch for point '%1' in piece '%2'.")
|
||||||
.arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName());
|
.arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName());
|
||||||
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
return VPassmark();
|
return VPassmark();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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.")
|
const QString errorMsg = QObject::tr("Cannot calculate seam allowance before for point '%1'. Reason: %2.")
|
||||||
.arg(nodeName, formula.Reason());
|
.arg(nodeName, formula.Reason());
|
||||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return formula.getDoubleValue();
|
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.")
|
const QString errorMsg = QObject::tr("Cannot calculate seam allowance before for point '%1'. Reason: %2.")
|
||||||
.arg(nodeName, formula.Reason());
|
.arg(nodeName, formula.Reason());
|
||||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
return -1;
|
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.")
|
const QString errorMsg = QObject::tr("Cannot calculate seam allowance after for point '%1'. Reason: %2.")
|
||||||
.arg(nodeName, formula.Reason());
|
.arg(nodeName, formula.Reason());
|
||||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
return -1;
|
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: ")
|
const QString errorMsg = QObject::tr("Cannot calculate seam allowance after for point '%1'. Reason: ")
|
||||||
.arg(nodeName, formula.Reason());
|
.arg(nodeName, formula.Reason());
|
||||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
return -1;
|
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.")
|
const QString errorMsg = QObject::tr("Cannot calculate passmark length for point '%1'. Reason: %2.")
|
||||||
.arg(nodeName, formula.Reason());
|
.arg(nodeName, formula.Reason());
|
||||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
return VSAPoint::maxPassmarkLength;
|
return VSAPoint::maxPassmarkLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -384,8 +384,8 @@ QVector<QPointF> VPiecePath::PathPoints(const VContainer *data, const QVector<QP
|
||||||
const QString errorMsg = QObject::tr("Error in internal path '%1'. There is no intersection of first "
|
const QString errorMsg = QObject::tr("Error in internal path '%1'. There is no intersection of first "
|
||||||
"point with cutting countour")
|
"point with cutting countour")
|
||||||
.arg(GetName());
|
.arg(GetName());
|
||||||
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,8 +401,8 @@ QVector<QPointF> VPiecePath::PathPoints(const VContainer *data, const QVector<QP
|
||||||
const QString errorMsg = QObject::tr("Error in internal path '%1'. There is no intersection of last "
|
const QString errorMsg = QObject::tr("Error in internal path '%1'. There is no intersection of last "
|
||||||
"point with cutting countour")
|
"point with cutting countour")
|
||||||
.arg(GetName());
|
.arg(GetName());
|
||||||
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ bool VTranslateMeasurements::MeasurementsFromUser(QString &newFormula, int posit
|
||||||
QMap<QString, qmu::QmuTranslation>::const_iterator i = measurements.constBegin();
|
QMap<QString, qmu::QmuTranslation>::const_iterator i = measurements.constBegin();
|
||||||
while (i != measurements.constEnd())
|
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());
|
newFormula.replace(position, token.length(), i.key());
|
||||||
bias = token.length() - i.key().length();
|
bias = token.length() - i.key().length();
|
||||||
|
@ -79,7 +79,7 @@ QString VTranslateMeasurements::MFromUser(const QString &measurement) const
|
||||||
QMap<QString, qmu::QmuTranslation>::const_iterator i = measurements.constBegin();
|
QMap<QString, qmu::QmuTranslation>::const_iterator i = measurements.constBegin();
|
||||||
while (i != measurements.constEnd())
|
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)
|
if (measurement == translated)
|
||||||
{
|
{
|
||||||
return i.key();
|
return i.key();
|
||||||
|
@ -94,7 +94,7 @@ QString VTranslateMeasurements::MToUser(const QString &measurement) const
|
||||||
{
|
{
|
||||||
if (measurements.contains(measurement))
|
if (measurements.contains(measurement))
|
||||||
{
|
{
|
||||||
return measurements.value(measurement).translate(qApp->Settings()->GetLocale());
|
return measurements.value(measurement).translate(VAbstractApplication::VApp()->Settings()->GetLocale());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -126,7 +126,7 @@ QString VTranslateMeasurements::GuiText(const QString &measurement) const
|
||||||
{
|
{
|
||||||
if (guiTexts.contains(measurement))
|
if (guiTexts.contains(measurement))
|
||||||
{
|
{
|
||||||
return guiTexts.value(measurement).translate(qApp->Settings()->GetLocale());
|
return guiTexts.value(measurement).translate(VAbstractApplication::VApp()->Settings()->GetLocale());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -139,7 +139,7 @@ QString VTranslateMeasurements::Description(const QString &measurement) const
|
||||||
{
|
{
|
||||||
if (descriptions.contains(measurement))
|
if (descriptions.contains(measurement))
|
||||||
{
|
{
|
||||||
return descriptions.value(measurement).translate(qApp->Settings()->GetLocale());
|
return descriptions.value(measurement).translate(VAbstractApplication::VApp()->Settings()->GetLocale());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -547,7 +547,7 @@ void VTranslateVars::PrepareFunctionTranslations()
|
||||||
QMap<QString, qmu::QmuTranslation>::const_iterator i = functions.constBegin();
|
QMap<QString, qmu::QmuTranslation>::const_iterator i = functions.constBegin();
|
||||||
while (i != functions.constEnd())
|
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)
|
if (i.key() != translated)
|
||||||
{
|
{
|
||||||
translatedFunctions.insert(translated, i.key());
|
translatedFunctions.insert(translated, i.key());
|
||||||
|
@ -628,15 +628,16 @@ void VTranslateVars::BiasTokens(int position, int bias, QMap<int, QString> &toke
|
||||||
*/
|
*/
|
||||||
bool VTranslateVars::VariablesFromUser(QString &newFormula, int position, const QString &token, int &bias) const
|
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)
|
const QString currentSeamAllowanceTr = variables.value(currentSeamAllowance)
|
||||||
.translate(qApp->Settings()->GetLocale());
|
.translate(VAbstractApplication::VApp()->Settings()->GetLocale());
|
||||||
|
|
||||||
QMap<QString, qmu::QmuTranslation>::const_iterator i = variables.constBegin();
|
QMap<QString, qmu::QmuTranslation>::const_iterator i = variables.constBegin();
|
||||||
while (i != variables.constEnd())
|
while (i != variables.constEnd())
|
||||||
{
|
{
|
||||||
const qmu::QmuTranslation &var = i.value();
|
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)
|
if (token.indexOf(varTr) == 0)
|
||||||
{
|
{
|
||||||
|
@ -671,7 +672,7 @@ bool VTranslateVars::FunctionsFromUser(QString &newFormula, int position, const
|
||||||
QMap<QString, qmu::QmuTranslation>::const_iterator i = functions.constBegin();
|
QMap<QString, qmu::QmuTranslation>::const_iterator i = functions.constBegin();
|
||||||
while (i != functions.constEnd())
|
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());
|
newFormula.replace(position, token.length(), i.key());
|
||||||
bias = token.length() - i.key().length();
|
bias = token.length() - i.key().length();
|
||||||
|
@ -704,10 +705,12 @@ bool VTranslateVars::VariablesToUser(QString &newFormula, int position, const QS
|
||||||
continue;
|
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;
|
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();
|
bias = token.length() - newToken.length();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -734,19 +737,19 @@ QString VTranslateVars::InternalVarToUser(const QString &var) const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VTranslateVars::VarToUser(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
|
return var; // We do not support translation of variables for Chinese
|
||||||
}
|
}
|
||||||
|
|
||||||
if (measurements.contains(var))
|
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))
|
if (functions.contains(var))
|
||||||
{
|
{
|
||||||
return functions.value(var).translate(qApp->Settings()->GetLocale());
|
return functions.value(var).translate(VAbstractApplication::VApp()->Settings()->GetLocale());
|
||||||
}
|
}
|
||||||
|
|
||||||
return InternalVarToUser(var);
|
return InternalVarToUser(var);
|
||||||
|
@ -755,7 +758,7 @@ QString VTranslateVars::VarToUser(const QString &var) const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VTranslateVars::VarFromUser(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
|
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
|
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
|
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
|
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
|
try
|
||||||
{
|
{
|
||||||
SCASSERT(qApp->TrVars() != nullptr)
|
SCASSERT(VAbstractApplication::VApp()->TrVars() != nullptr)
|
||||||
return qApp->TrVars()->FormulaFromUser(formula, osSeparator);
|
return VAbstractApplication::VApp()->TrVars()->FormulaFromUser(formula, osSeparator);
|
||||||
}
|
}
|
||||||
catch (qmu::QmuParserError &e)// In case something bad will happen
|
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)))
|
if (measurements.contains(tValues.at(i)))
|
||||||
{
|
{
|
||||||
newFormula.replace(tKeys.at(i), tValues.at(i).length(),
|
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))
|
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)
|
if (bias != 0)
|
||||||
{// Translated token has different length than original. Position next tokens need to be corrected.
|
{// Translated token has different length than original. Position next tokens need to be corrected.
|
||||||
CorrectionsPositions(tKeys.at(i), bias, tokens, numbers);
|
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)))
|
if (functions.contains(tValues.at(i)))
|
||||||
{
|
{
|
||||||
newFormula.replace(tKeys.at(i), tValues.at(i).length(),
|
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))
|
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)
|
if (bias != 0)
|
||||||
{// Translated token has different length than original. Position next tokens need to be corrected.
|
{// Translated token has different length than original. Position next tokens need to be corrected.
|
||||||
CorrectionsPositions(tKeys.at(i), bias, tokens, numbers);
|
CorrectionsPositions(tKeys.at(i), bias, tokens, numbers);
|
||||||
|
@ -1037,7 +1042,7 @@ QString VTranslateVars::TryFormulaToUser(const QString &formula, bool osSeparato
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return qApp->TrVars()->FormulaToUser(formula, osSeparator);
|
return VAbstractApplication::VApp()->TrVars()->FormulaToUser(formula, osSeparator);
|
||||||
}
|
}
|
||||||
catch (qmu::QmuParserError &e)// In case something bad will happen
|
catch (qmu::QmuParserError &e)// In case something bad will happen
|
||||||
{
|
{
|
||||||
|
|
|
@ -182,7 +182,7 @@ bool FilterObject(QObject *object, QEvent *event)
|
||||||
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
|
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
|
||||||
if ((keyEvent->key() == Qt::Key_Period) && (keyEvent->modifiers() & Qt::KeypadModifier))
|
if ((keyEvent->key() == Qt::Key_Period) && (keyEvent->modifiers() & Qt::KeypadModifier))
|
||||||
{
|
{
|
||||||
if (qApp->Settings()->GetOsSeparator())
|
if (VAbstractApplication::VApp()->Settings()->GetOsSeparator())
|
||||||
{
|
{
|
||||||
plainTextEdit->insertPlainText(QLocale().decimalPoint());
|
plainTextEdit->insertPlainText(QLocale().decimalPoint());
|
||||||
}
|
}
|
||||||
|
@ -218,7 +218,9 @@ qreal EvalToolFormula(QDialog *dialog, const FormulaData &data, bool &flag)
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Translate to internal look.
|
// 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<Calculator> cal(new Calculator());
|
QScopedPointer<Calculator> cal(new Calculator());
|
||||||
result = cal->EvalFormula(data.variables, formula);
|
result = cal->EvalFormula(data.variables, formula);
|
||||||
|
|
||||||
|
@ -249,7 +251,8 @@ qreal EvalToolFormula(QDialog *dialog, const FormulaData &data, bool &flag)
|
||||||
}
|
}
|
||||||
else
|
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;
|
flag = true;
|
||||||
ChangeColor(data.labelEditFormula, OkColor(dialog));
|
ChangeColor(data.labelEditFormula, OkColor(dialog));
|
||||||
data.labelResult->setToolTip(QObject::tr("Value"));
|
data.labelResult->setToolTip(QObject::tr("Value"));
|
||||||
|
|
|
@ -297,11 +297,12 @@ void DialogEditLabel::NewTemplate()
|
||||||
void DialogEditLabel::ExportTemplate()
|
void DialogEditLabel::ExportTemplate()
|
||||||
{
|
{
|
||||||
QString filters(tr("Label template") + QLatin1String("(*.xml)"));
|
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"),
|
QString fileName = QFileDialog::getSaveFileName(this, tr("Export label template"),
|
||||||
path + QLatin1String("/") + tr("template") + QLatin1String(".xml"),
|
path + QLatin1String("/") + tr("template") + QLatin1String(".xml"),
|
||||||
filters, nullptr, qApp->NativeFileDialog());
|
filters, nullptr, VAbstractApplication::VApp()->NativeFileDialog());
|
||||||
|
|
||||||
if (fileName.isEmpty())
|
if (fileName.isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -349,9 +350,10 @@ void DialogEditLabel::ImportTemplate()
|
||||||
|
|
||||||
QString filter(tr("Label template") + QLatin1String(" (*.xml)"));
|
QString filter(tr("Label template") + QLatin1String(" (*.xml)"));
|
||||||
//Use standard path to label templates
|
//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,
|
const QString fileName = QFileDialog::getOpenFileName(this, tr("Import template"), path, filter, nullptr,
|
||||||
qApp->NativeFileDialog());
|
VAbstractApplication::VApp()->NativeFileDialog());
|
||||||
if (fileName.isEmpty())
|
if (fileName.isEmpty())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -483,7 +485,7 @@ void DialogEditLabel::InitPlaceholdersMenu()
|
||||||
void DialogEditLabel::InitPlaceholders()
|
void DialogEditLabel::InitPlaceholders()
|
||||||
{
|
{
|
||||||
// Pattern tags
|
// Pattern tags
|
||||||
QLocale locale(qApp->Settings()->GetLocale());
|
QLocale locale(VAbstractApplication::VApp()->Settings()->GetLocale());
|
||||||
|
|
||||||
const QString date = locale.toString(QDate::currentDate(), m_doc->GetLabelDateFormat());
|
const QString date = locale.toString(QDate::currentDate(), m_doc->GetLabelDateFormat());
|
||||||
m_placeholders.insert(pl_date, qMakePair(tr("Date"), date));
|
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_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_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_mUnits, qMakePair(tr("Measurements units"),
|
||||||
m_placeholders.insert(pl_pUnits, qMakePair(tr("Pattern units"), UnitsToStr(qApp->patternUnits(), true)));
|
UnitsToStr(VAbstractValApplication::VApp()->MeasurementsUnits(), true)));
|
||||||
m_placeholders.insert(pl_mSizeUnits, qMakePair(tr("Size units"), UnitsToStr(qApp->DimensionSizeUnits(), 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_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
|
else
|
||||||
{
|
{
|
||||||
|
@ -520,20 +529,24 @@ void DialogEditLabel::InitPlaceholders()
|
||||||
|
|
||||||
m_placeholders.insert(pl_pExt, qMakePair(tr("Pattern extension"), QString("val")));
|
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));
|
m_placeholders.insert(pl_pFileName, qMakePair(tr("Pattern file name"), patternFilePath));
|
||||||
|
|
||||||
const QString measurementsFilePath = QFileInfo(m_doc->MPath()).baseName();
|
const QString measurementsFilePath = QFileInfo(m_doc->MPath()).baseName();
|
||||||
m_placeholders.insert(pl_mFileName, qMakePair(tr("Measurments file name"), measurementsFilePath));
|
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_height, qMakePair(tr("Height", "dimension"),
|
||||||
m_placeholders.insert(pl_size, qMakePair(tr("Size", "dimension"), QString::number(qApp->GetDimensionSize())));
|
QString::number(VAbstractValApplication::VApp()->GetDimensionHeight())));
|
||||||
m_placeholders.insert(pl_hip, qMakePair(tr("Hip", "dimension"), QString::number(qApp->GetDimensionHip())));
|
m_placeholders.insert(pl_size, qMakePair(tr("Size", "dimension"),
|
||||||
m_placeholders.insert(pl_waist, qMakePair(tr("Waist", "dimension"), QString::number(qApp->GetDimensionWaist())));
|
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,
|
m_placeholders.insert(pl_mExt,
|
||||||
qMakePair(tr("Measurments extension"),
|
qMakePair(tr("Measurments extension"),
|
||||||
qApp->GetMeasurementsType() == MeasurementsType::Multisize ? QString("vst")
|
VAbstractValApplication::VApp()->GetMeasurementsType() == MeasurementsType::Multisize
|
||||||
: QString("vit")));
|
? QString("vst") : QString("vit")));
|
||||||
|
|
||||||
const QString materialDescription = tr("User material");
|
const QString materialDescription = tr("User material");
|
||||||
const QMap<int, QString> materials = m_doc->GetPatternMaterials();
|
const QMap<int, QString> 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 "
|
const QString errorMsg = QObject::tr("Failed to prepare final measurement placeholder. Parser error at "
|
||||||
"line %1: %2.").arg(i+1).arg(e.GetMsg());
|
"line %1: %2.").arg(i+1).arg(e.GetMsg());
|
||||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + 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'))
|
if (line.contains(per+placeholder+per) && m_placeholders.value(placeholder).second == QChar('0'))
|
||||||
{
|
{
|
||||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -75,8 +75,10 @@ enum {ColumnName = 0, ColumnFullName};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogEditWrongFormula::DialogEditWrongFormula(const VContainer *data, quint32 toolId, QWidget *parent)
|
DialogEditWrongFormula::DialogEditWrongFormula(const VContainer *data, quint32 toolId, QWidget *parent)
|
||||||
: DialogTool(data, toolId, parent),
|
: QDialog(parent),
|
||||||
ui(new Ui::DialogEditWrongFormula),
|
ui(new Ui::DialogEditWrongFormula),
|
||||||
|
m_data(data),
|
||||||
|
m_toolId(toolId),
|
||||||
formula(),
|
formula(),
|
||||||
formulaBaseHeight(0),
|
formulaBaseHeight(0),
|
||||||
checkZero(false),
|
checkZero(false),
|
||||||
|
@ -86,6 +88,8 @@ DialogEditWrongFormula::DialogEditWrongFormula(const VContainer *data, quint32 t
|
||||||
timerFormula(new QTimer(this)),
|
timerFormula(new QTimer(this)),
|
||||||
flagFormula(false)
|
flagFormula(false)
|
||||||
{
|
{
|
||||||
|
SCASSERT(data != nullptr)
|
||||||
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
timerFormula->setSingleShot(true);
|
timerFormula->setSingleShot(true);
|
||||||
|
@ -102,7 +106,15 @@ DialogEditWrongFormula::DialogEditWrongFormula(const VContainer *data, quint32 t
|
||||||
|
|
||||||
connect(ui->filterFormulaInputs, &QLineEdit::textChanged, this, &DialogEditWrongFormula::FilterVariablesEdited);
|
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->toolButtonPutHere, &QPushButton::clicked, this, &DialogEditWrongFormula::PutHere);
|
||||||
connect(ui->tableWidget, &QTableWidget::itemDoubleClicked, this, &DialogEditWrongFormula::PutVal);
|
connect(ui->tableWidget, &QTableWidget::itemDoubleClicked, this, &DialogEditWrongFormula::PutVal);
|
||||||
|
@ -161,7 +173,7 @@ void DialogEditWrongFormula::EvalFormula()
|
||||||
{
|
{
|
||||||
FormulaData formulaData;
|
FormulaData formulaData;
|
||||||
formulaData.formula = ui->plainTextEditFormula->toPlainText();
|
formulaData.formula = ui->plainTextEditFormula->toPlainText();
|
||||||
formulaData.variables = data->DataVariables();
|
formulaData.variables = m_data->DataVariables();
|
||||||
formulaData.labelEditFormula = ui->labelEditFormula;
|
formulaData.labelEditFormula = ui->labelEditFormula;
|
||||||
formulaData.labelResult = ui->labelResultCalculation;
|
formulaData.labelResult = ui->labelResultCalculation;
|
||||||
formulaData.postfix = postfix;
|
formulaData.postfix = postfix;
|
||||||
|
@ -184,55 +196,55 @@ void DialogEditWrongFormula::ValChanged(int row)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QTableWidgetItem *item = ui->tableWidget->item( row, ColumnName );
|
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
|
try
|
||||||
{
|
{
|
||||||
if (ui->radioButtonStandardTable->isChecked())
|
if (ui->radioButtonStandardTable->isChecked())
|
||||||
{
|
{
|
||||||
const QSharedPointer<VMeasurement> stable = data->GetVariable<VMeasurement>(name);
|
const QSharedPointer<VMeasurement> stable = m_data->GetVariable<VMeasurement>(name);
|
||||||
SetDescription(item->text(), *stable->GetValue(), stable->IsSpecialUnits(), stable->GetGuiText());
|
SetDescription(item->text(), *stable->GetValue(), stable->IsSpecialUnits(), stable->GetGuiText());
|
||||||
}
|
}
|
||||||
else if (ui->radioButtonIncrements->isChecked())
|
else if (ui->radioButtonIncrements->isChecked())
|
||||||
{
|
{
|
||||||
const QSharedPointer<VIncrement> incr = data->GetVariable<VIncrement>(name);
|
const QSharedPointer<VIncrement> incr = m_data->GetVariable<VIncrement>(name);
|
||||||
const bool specialUnits = false;
|
const bool specialUnits = false;
|
||||||
SetDescription(item->text(), *incr->GetValue(), specialUnits, incr->GetDescription());
|
SetDescription(item->text(), *incr->GetValue(), specialUnits, incr->GetDescription());
|
||||||
}
|
}
|
||||||
else if (ui->radioButtonPC->isChecked())
|
else if (ui->radioButtonPC->isChecked())
|
||||||
{
|
{
|
||||||
const QSharedPointer<VIncrement> incr = data->GetVariable<VIncrement>(name);
|
const QSharedPointer<VIncrement> incr = m_data->GetVariable<VIncrement>(name);
|
||||||
const bool specialUnits = false;
|
const bool specialUnits = false;
|
||||||
SetDescription(item->text(), *incr->GetValue(), specialUnits, incr->GetDescription());
|
SetDescription(item->text(), *incr->GetValue(), specialUnits, incr->GetDescription());
|
||||||
}
|
}
|
||||||
else if (ui->radioButtonLengthLine->isChecked())
|
else if (ui->radioButtonLengthLine->isChecked())
|
||||||
{
|
{
|
||||||
const bool specialUnits = false;
|
const bool specialUnits = false;
|
||||||
SetDescription(item->text(), *data->GetVariable<VLengthLine>(name)->GetValue(), specialUnits,
|
SetDescription(item->text(), *m_data->GetVariable<VLengthLine>(name)->GetValue(), specialUnits,
|
||||||
tr("Line length"));
|
tr("Line length"));
|
||||||
}
|
}
|
||||||
else if (ui->radioButtonLengthSpline->isChecked())
|
else if (ui->radioButtonLengthSpline->isChecked())
|
||||||
{
|
{
|
||||||
const bool specialUnits = false;
|
const bool specialUnits = false;
|
||||||
SetDescription(item->text(), *data->GetVariable<VCurveLength>(name)->GetValue(), specialUnits,
|
SetDescription(item->text(), *m_data->GetVariable<VCurveLength>(name)->GetValue(), specialUnits,
|
||||||
tr("Curve length"));
|
tr("Curve length"));
|
||||||
}
|
}
|
||||||
else if (ui->radioButtonAngleLine->isChecked())
|
else if (ui->radioButtonAngleLine->isChecked())
|
||||||
{
|
{
|
||||||
const bool specialUnits = true;
|
const bool specialUnits = true;
|
||||||
SetDescription(item->text(), *data->GetVariable<VLineAngle>(name)->GetValue(), specialUnits,
|
SetDescription(item->text(), *m_data->GetVariable<VLineAngle>(name)->GetValue(), specialUnits,
|
||||||
tr("Line Angle"));
|
tr("Line Angle"));
|
||||||
}
|
}
|
||||||
else if (ui->radioButtonRadiusesArcs->isChecked())
|
else if (ui->radioButtonRadiusesArcs->isChecked())
|
||||||
{
|
{
|
||||||
const bool specialUnits = false;
|
const bool specialUnits = false;
|
||||||
SetDescription(item->text(), *data->GetVariable<VArcRadius>(name)->GetValue(), specialUnits,
|
SetDescription(item->text(), *m_data->GetVariable<VArcRadius>(name)->GetValue(), specialUnits,
|
||||||
tr("Arc radius"));
|
tr("Arc radius"));
|
||||||
}
|
}
|
||||||
else if (ui->radioButtonAnglesCurves->isChecked())
|
else if (ui->radioButtonAnglesCurves->isChecked())
|
||||||
{
|
{
|
||||||
const bool specialUnits = true;
|
const bool specialUnits = true;
|
||||||
SetDescription(item->text(), *data->GetVariable<VCurveAngle>(name)->GetValue(), specialUnits,
|
SetDescription(item->text(), *m_data->GetVariable<VCurveAngle>(name)->GetValue(), specialUnits,
|
||||||
tr("Curve angle"));
|
tr("Curve angle"));
|
||||||
}
|
}
|
||||||
else if (ui->radioButtonFunctions->isChecked())
|
else if (ui->radioButtonFunctions->isChecked())
|
||||||
|
@ -282,7 +294,7 @@ void DialogEditWrongFormula::PutVal(QTableWidgetItem *item)
|
||||||
void DialogEditWrongFormula::Measurements()
|
void DialogEditWrongFormula::Measurements()
|
||||||
{
|
{
|
||||||
ui->checkBoxHideEmpty->setEnabled(true);
|
ui->checkBoxHideEmpty->setEnabled(true);
|
||||||
ShowMeasurements(data->DataMeasurements());
|
ShowMeasurements(m_data->DataMeasurements());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -292,21 +304,21 @@ void DialogEditWrongFormula::Measurements()
|
||||||
void DialogEditWrongFormula::LengthLines()
|
void DialogEditWrongFormula::LengthLines()
|
||||||
{
|
{
|
||||||
ui->checkBoxHideEmpty->setEnabled(false);
|
ui->checkBoxHideEmpty->setEnabled(false);
|
||||||
ShowVariable(data->DataLengthLines());
|
ShowVariable(m_data->DataLengthLines());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogEditWrongFormula::RadiusArcs()
|
void DialogEditWrongFormula::RadiusArcs()
|
||||||
{
|
{
|
||||||
ui->checkBoxHideEmpty->setEnabled(false);
|
ui->checkBoxHideEmpty->setEnabled(false);
|
||||||
ShowVariable(data->DataRadiusesArcs());
|
ShowVariable(m_data->DataRadiusesArcs());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogEditWrongFormula::AnglesCurves()
|
void DialogEditWrongFormula::AnglesCurves()
|
||||||
{
|
{
|
||||||
ui->checkBoxHideEmpty->setEnabled(false);
|
ui->checkBoxHideEmpty->setEnabled(false);
|
||||||
ShowVariable(data->DataAnglesCurves());
|
ShowVariable(m_data->DataAnglesCurves());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -316,21 +328,21 @@ void DialogEditWrongFormula::AnglesCurves()
|
||||||
void DialogEditWrongFormula::LengthCurves()
|
void DialogEditWrongFormula::LengthCurves()
|
||||||
{
|
{
|
||||||
ui->checkBoxHideEmpty->setEnabled(false);
|
ui->checkBoxHideEmpty->setEnabled(false);
|
||||||
ShowVariable(data->DataLengthCurves());
|
ShowVariable(m_data->DataLengthCurves());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogEditWrongFormula::CurvesCLength()
|
void DialogEditWrongFormula::CurvesCLength()
|
||||||
{
|
{
|
||||||
ui->checkBoxHideEmpty->setEnabled(false);
|
ui->checkBoxHideEmpty->setEnabled(false);
|
||||||
ShowVariable(data->DataCurvesCLength());
|
ShowVariable(m_data->DataCurvesCLength());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogEditWrongFormula::AngleLines()
|
void DialogEditWrongFormula::AngleLines()
|
||||||
{
|
{
|
||||||
ui->checkBoxHideEmpty->setEnabled(false);
|
ui->checkBoxHideEmpty->setEnabled(false);
|
||||||
ShowVariable(data->DataAngleLines());
|
ShowVariable(m_data->DataAngleLines());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -362,7 +374,7 @@ void DialogEditWrongFormula::Functions()
|
||||||
void DialogEditWrongFormula::closeEvent(QCloseEvent *event)
|
void DialogEditWrongFormula::closeEvent(QCloseEvent *event)
|
||||||
{
|
{
|
||||||
ui->plainTextEditFormula->blockSignals(true);
|
ui->plainTextEditFormula->blockSignals(true);
|
||||||
DialogTool::closeEvent(event);
|
QDialog::closeEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -374,13 +386,13 @@ void DialogEditWrongFormula::showEvent(QShowEvent *event)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isInitialized)
|
if (m_isInitialized)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// do your init stuff here
|
// do your init stuff here
|
||||||
|
|
||||||
const QSize sz = qApp->Settings()->GetFormulaWizardDialogSize();
|
const QSize sz = VAbstractApplication::VApp()->Settings()->GetFormulaWizardDialogSize();
|
||||||
if (not sz.isEmpty())
|
if (not sz.isEmpty())
|
||||||
{
|
{
|
||||||
resize(sz);
|
resize(sz);
|
||||||
|
@ -388,7 +400,7 @@ void DialogEditWrongFormula::showEvent(QShowEvent *event)
|
||||||
|
|
||||||
CheckState();
|
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
|
// remember the size for the next time this dialog is opened, but only
|
||||||
// if widget was already initialized, which rules out the resize at
|
// if widget was already initialized, which rules out the resize at
|
||||||
// dialog creating, which would
|
// 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)
|
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);
|
ui->plainTextEditFormula->setPlainText(formula);
|
||||||
MoveCursorToEnd(ui->plainTextEditFormula);
|
MoveCursorToEnd(ui->plainTextEditFormula);
|
||||||
ui->plainTextEditFormula->selectAll();
|
ui->plainTextEditFormula->selectAll();
|
||||||
|
@ -459,7 +486,8 @@ void DialogEditWrongFormula::SetPreviewCalculationsMode()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString DialogEditWrongFormula::GetFormula() const
|
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,
|
void DialogEditWrongFormula::SetDescription(const QString &name, qreal value, bool specialUnits,
|
||||||
const QString &description)
|
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);
|
const QString desc = QStringLiteral("%1(%2%3) - %4").arg(name).arg(value).arg(unit, description);
|
||||||
ui->labelDescription->setText(desc);
|
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
|
* @brief ShowVariable show variables in list
|
||||||
|
@ -537,7 +574,7 @@ void DialogEditWrongFormula::ShowVariable(const QMap<key, val> &var)
|
||||||
{
|
{
|
||||||
continue; //skip this measurement
|
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
|
{// If we create this variable don't show
|
||||||
ui->tableWidget->setRowCount(ui->tableWidget->rowCount() + 1);
|
ui->tableWidget->setRowCount(ui->tableWidget->rowCount() + 1);
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(iMap.key());
|
QTableWidgetItem *item = new QTableWidgetItem(iMap.key());
|
||||||
|
@ -573,7 +610,7 @@ void DialogEditWrongFormula::ShowMeasurements(const QMap<QString, QSharedPointer
|
||||||
{
|
{
|
||||||
continue; //skip this measurement
|
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
|
{// If we create this variable don't show
|
||||||
ui->tableWidget->setRowCount(ui->tableWidget->rowCount() + 1);
|
ui->tableWidget->setRowCount(ui->tableWidget->rowCount() + 1);
|
||||||
QTableWidgetItem *itemName = new QTableWidgetItem(iMap.key());
|
QTableWidgetItem *itemName = new QTableWidgetItem(iMap.key());
|
||||||
|
@ -592,7 +629,7 @@ void DialogEditWrongFormula::ShowMeasurements(const QMap<QString, QSharedPointer
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
itemFullName->setText(qApp->TrVars()->GuiText(iMap.value()->GetName()));
|
itemFullName->setText(VAbstractApplication::VApp()->TrVars()->GuiText(iMap.value()->GetName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
itemFullName->setToolTip(itemFullName->text());
|
itemFullName->setToolTip(itemFullName->text());
|
||||||
|
@ -617,20 +654,23 @@ void DialogEditWrongFormula::ShowFunctions()
|
||||||
ui->tableWidget->setColumnHidden(ColumnFullName, true);
|
ui->tableWidget->setColumnHidden(ColumnFullName, true);
|
||||||
ui->labelDescription->setText(QString());
|
ui->labelDescription->setText(QString());
|
||||||
|
|
||||||
const QMap<QString, qmu::QmuTranslation> functionsDescriptions = qApp->TrVars()->GetFunctionsDescriptions();
|
const QMap<QString, qmu::QmuTranslation> functionsDescriptions =
|
||||||
const QMap<QString, qmu::QmuTranslation> functions = qApp->TrVars()->GetFunctions();
|
VAbstractApplication::VApp()->TrVars()->GetFunctionsDescriptions();
|
||||||
|
const QMap<QString, qmu::QmuTranslation> functions = VAbstractApplication::VApp()->TrVars()->GetFunctions();
|
||||||
QMap<QString, qmu::QmuTranslation>::const_iterator i = functions.constBegin();
|
QMap<QString, qmu::QmuTranslation>::const_iterator i = functions.constBegin();
|
||||||
while (i != functions.constEnd())
|
while (i != functions.constEnd())
|
||||||
{
|
{
|
||||||
ui->tableWidget->setRowCount(ui->tableWidget->rowCount() + 1);
|
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();
|
QFont font = item->font();
|
||||||
font.setBold(true);
|
font.setBold(true);
|
||||||
item->setFont(font);
|
item->setFont(font);
|
||||||
ui->tableWidget->setItem(ui->tableWidget->rowCount()-1, ColumnName, item);
|
ui->tableWidget->setItem(ui->tableWidget->rowCount()-1, ColumnName, item);
|
||||||
|
|
||||||
functionsDescriptions.contains(i.key())
|
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());
|
: item->setToolTip(i.value().getMdisambiguation());
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
@ -647,7 +687,7 @@ void DialogEditWrongFormula::ShowIncrementsInPreviewCalculation(bool show)
|
||||||
|
|
||||||
QMap<QString, QSharedPointer<VIncrement> > increments;
|
QMap<QString, QSharedPointer<VIncrement> > increments;
|
||||||
|
|
||||||
const QMap<QString, QSharedPointer<VIncrement> > list = data->DataIncrements();
|
const QMap<QString, QSharedPointer<VIncrement> > list = m_data->DataIncrements();
|
||||||
QMap<QString, QSharedPointer<VIncrement> >::const_iterator i = list.constBegin();
|
QMap<QString, QSharedPointer<VIncrement> >::const_iterator i = list.constBegin();
|
||||||
while (i != list.constEnd())
|
while (i != list.constEnd())
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,10 +36,11 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QTableWidgetItem>
|
#include <QTableWidgetItem>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
#include <QDialog>
|
||||||
#include "../tools/dialogtool.h"
|
|
||||||
|
|
||||||
class VMeasurement;
|
class VMeasurement;
|
||||||
|
struct FormulaData;
|
||||||
|
class VContainer;
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
|
@ -54,7 +55,7 @@ class DialogEditWrongFormula;
|
||||||
*
|
*
|
||||||
* Don't implemant button "Apply" for this dialog!!
|
* Don't implemant button "Apply" for this dialog!!
|
||||||
*/
|
*/
|
||||||
class DialogEditWrongFormula : public DialogTool
|
class DialogEditWrongFormula : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
@ -70,8 +71,8 @@ public:
|
||||||
void SetIncrementsMode();
|
void SetIncrementsMode();
|
||||||
void SetPreviewCalculationsMode();
|
void SetPreviewCalculationsMode();
|
||||||
public slots:
|
public slots:
|
||||||
virtual void DialogAccepted() override;
|
virtual void DialogAccepted();
|
||||||
virtual void DialogRejected() override;
|
virtual void DialogRejected();
|
||||||
void EvalFormula();
|
void EvalFormula();
|
||||||
void ValChanged(int row);
|
void ValChanged(int row);
|
||||||
void PutHere();
|
void PutHere();
|
||||||
|
@ -87,17 +88,32 @@ public slots:
|
||||||
void Increments();
|
void Increments();
|
||||||
void PreviewCalculations();
|
void PreviewCalculations();
|
||||||
void Functions();
|
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:
|
protected:
|
||||||
virtual bool IsValid() const final;
|
virtual bool IsValid() const final;
|
||||||
virtual void closeEvent(QCloseEvent *event) override;
|
virtual void closeEvent(QCloseEvent *event) override;
|
||||||
virtual void showEvent( QShowEvent *event ) override;
|
virtual void showEvent( QShowEvent *event ) override;
|
||||||
virtual void resizeEvent(QResizeEvent *event) override;
|
virtual void resizeEvent(QResizeEvent *event) override;
|
||||||
|
virtual void CheckState();
|
||||||
private slots:
|
private slots:
|
||||||
void FilterVariablesEdited(const QString &filter);
|
void FilterVariablesEdited(const QString &filter);
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(DialogEditWrongFormula)
|
Q_DISABLE_COPY(DialogEditWrongFormula)
|
||||||
Ui::DialogEditWrongFormula *ui;
|
Ui::DialogEditWrongFormula *ui;
|
||||||
|
|
||||||
|
const VContainer *m_data;
|
||||||
|
|
||||||
|
quint32 m_toolId;
|
||||||
|
|
||||||
/** @brief formula string with formula */
|
/** @brief formula string with formula */
|
||||||
QString formula;
|
QString formula;
|
||||||
|
|
||||||
|
@ -113,6 +129,9 @@ private:
|
||||||
|
|
||||||
bool flagFormula;
|
bool flagFormula;
|
||||||
|
|
||||||
|
/** @brief m_isInitialized true if window is initialized */
|
||||||
|
bool m_isInitialized{false};
|
||||||
|
|
||||||
void InitVariables();
|
void InitVariables();
|
||||||
|
|
||||||
template <class key, class val>
|
template <class key, class val>
|
||||||
|
@ -122,6 +141,8 @@ private:
|
||||||
void ShowIncrementsInPreviewCalculation(bool show);
|
void ShowIncrementsInPreviewCalculation(bool show);
|
||||||
|
|
||||||
void SetDescription(const QString &name, qreal value, bool specialUnits, const QString &description);
|
void SetDescription(const QString &name, qreal value, bool specialUnits, const QString &description);
|
||||||
|
|
||||||
|
qreal Eval(const FormulaData &formulaData, bool &flag);
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -43,9 +43,9 @@ DialogUndo::DialogUndo(QWidget *parent)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
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)
|
if (opening)
|
||||||
{
|
{
|
||||||
ui->pushButtonUndo->setDisabled(opening);
|
ui->pushButtonUndo->setDisabled(opening);
|
||||||
|
|
|
@ -81,7 +81,8 @@ DialogAlongLine::DialogAlongLine(const VContainer *data, quint32 toolId, QWidget
|
||||||
|
|
||||||
ui->lineEditNamePoint->setClearButtonEnabled(true);
|
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->formulaBaseHeight = ui->plainTextEditFormula->height();
|
||||||
ui->plainTextEditFormula->installEventFilter(this);
|
ui->plainTextEditFormula->installEventFilter(this);
|
||||||
|
@ -144,7 +145,7 @@ void DialogAlongLine::FXLength()
|
||||||
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
||||||
dialog->setWindowTitle(tr("Edit length"));
|
dialog->setWindowTitle(tr("Edit length"));
|
||||||
dialog->SetFormula(GetFormula());
|
dialog->SetFormula(GetFormula());
|
||||||
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
|
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
||||||
if (dialog->exec() == QDialog::Accepted)
|
if (dialog->exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
SetFormula(dialog->GetFormula());
|
SetFormula(dialog->GetFormula());
|
||||||
|
@ -160,7 +161,7 @@ void DialogAlongLine::EvalFormula()
|
||||||
formulaData.variables = data->DataVariables();
|
formulaData.variables = data->DataVariables();
|
||||||
formulaData.labelEditFormula = ui->labelEditFormula;
|
formulaData.labelEditFormula = ui->labelEditFormula;
|
||||||
formulaData.labelResult = ui->labelResultCalculation;
|
formulaData.labelResult = ui->labelResultCalculation;
|
||||||
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
formulaData.checkZero = false;
|
formulaData.checkZero = false;
|
||||||
|
|
||||||
Eval(formulaData, flagFormula);
|
Eval(formulaData, flagFormula);
|
||||||
|
@ -345,7 +346,8 @@ void DialogAlongLine::SetFirstPointId(quint32 value)
|
||||||
*/
|
*/
|
||||||
void DialogAlongLine::SetFormula(const QString &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.
|
// increase height if needed.
|
||||||
if (formula.length() > 80)
|
if (formula.length() > 80)
|
||||||
{
|
{
|
||||||
|
@ -417,7 +419,8 @@ QString DialogAlongLine::GetTypeLine() const
|
||||||
*/
|
*/
|
||||||
QString DialogAlongLine::GetFormula() const
|
QString DialogAlongLine::GetFormula() const
|
||||||
{
|
{
|
||||||
return qApp->TrVars()->TryFormulaFromUser(formula, qApp->Settings()->GetOsSeparator());
|
return VAbstractApplication::VApp()->TrVars()
|
||||||
|
->TryFormulaFromUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -174,7 +174,8 @@ void DialogArc::SetCenter(const quint32 &value)
|
||||||
*/
|
*/
|
||||||
void DialogArc::SetF2(const QString &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.
|
// increase height if needed.
|
||||||
if (f2.length() > 80)
|
if (f2.length() > 80)
|
||||||
{
|
{
|
||||||
|
@ -262,7 +263,8 @@ QString DialogArc::GetAliasSuffix() const
|
||||||
*/
|
*/
|
||||||
void DialogArc::SetF1(const QString &value)
|
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.
|
// increase height if needed.
|
||||||
if (f1.length() > 80)
|
if (f1.length() > 80)
|
||||||
{
|
{
|
||||||
|
@ -284,7 +286,8 @@ void DialogArc::SetF1(const QString &value)
|
||||||
*/
|
*/
|
||||||
void DialogArc::SetRadius(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.
|
// increase height if needed.
|
||||||
if (radius.length() > 80)
|
if (radius.length() > 80)
|
||||||
{
|
{
|
||||||
|
@ -383,7 +386,7 @@ void DialogArc::FXRadius()
|
||||||
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
||||||
dialog->setWindowTitle(tr("Edit radius"));
|
dialog->setWindowTitle(tr("Edit radius"));
|
||||||
dialog->SetFormula(GetRadius());
|
dialog->SetFormula(GetRadius());
|
||||||
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
|
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
||||||
if (dialog->exec() == QDialog::Accepted)
|
if (dialog->exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
SetRadius(dialog->GetFormula());
|
SetRadius(dialog->GetFormula());
|
||||||
|
@ -430,7 +433,7 @@ void DialogArc::EvalRadius()
|
||||||
formulaData.variables = data->DataVariables();
|
formulaData.variables = data->DataVariables();
|
||||||
formulaData.labelEditFormula = ui->labelEditRadius;
|
formulaData.labelEditFormula = ui->labelEditRadius;
|
||||||
formulaData.labelResult = ui->labelResultRadius;
|
formulaData.labelResult = ui->labelResultRadius;
|
||||||
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
|
|
||||||
const qreal radius = Eval(formulaData, flagRadius);
|
const qreal radius = Eval(formulaData, flagRadius);
|
||||||
|
|
||||||
|
@ -485,7 +488,8 @@ quint32 DialogArc::GetCenter() const
|
||||||
*/
|
*/
|
||||||
QString DialogArc::GetRadius() 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
|
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
|
QString DialogArc::GetF2() const
|
||||||
{
|
{
|
||||||
return qApp->TrVars()->TryFormulaFromUser(f2, qApp->Settings()->GetOsSeparator());
|
return VAbstractApplication::VApp()->TrVars()
|
||||||
|
->TryFormulaFromUser(f2, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,13 +147,15 @@ void DialogArcWithLength::SetCenter(const quint32 &value)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString DialogArcWithLength::GetRadius() const
|
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)
|
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.
|
// increase height if needed.
|
||||||
if (radius.length() > 80)
|
if (radius.length() > 80)
|
||||||
{
|
{
|
||||||
|
@ -171,12 +173,14 @@ void DialogArcWithLength::SetRadius(const QString &value)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString DialogArcWithLength::GetF1() const
|
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)
|
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.
|
// increase height if needed.
|
||||||
if (f1.length() > 80)
|
if (f1.length() > 80)
|
||||||
{
|
{
|
||||||
|
@ -194,13 +198,15 @@ void DialogArcWithLength::SetF1(const QString &value)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString DialogArcWithLength::GetLength() const
|
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)
|
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.
|
// increase height if needed.
|
||||||
if (length.length() > 80)
|
if (length.length() > 80)
|
||||||
{
|
{
|
||||||
|
@ -323,7 +329,7 @@ void DialogArcWithLength::FXRadius()
|
||||||
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
||||||
dialog->setWindowTitle(tr("Edit radius"));
|
dialog->setWindowTitle(tr("Edit radius"));
|
||||||
dialog->SetFormula(GetRadius());
|
dialog->SetFormula(GetRadius());
|
||||||
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
|
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
||||||
if (dialog->exec() == QDialog::Accepted)
|
if (dialog->exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
SetRadius(dialog->GetFormula());
|
SetRadius(dialog->GetFormula());
|
||||||
|
@ -351,7 +357,7 @@ void DialogArcWithLength::FXLength()
|
||||||
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
||||||
dialog->setWindowTitle(tr("Edit the arc length"));
|
dialog->setWindowTitle(tr("Edit the arc length"));
|
||||||
dialog->SetFormula(GetLength());
|
dialog->SetFormula(GetLength());
|
||||||
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
|
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
||||||
if (dialog->exec() == QDialog::Accepted)
|
if (dialog->exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
SetLength(dialog->GetFormula());
|
SetLength(dialog->GetFormula());
|
||||||
|
@ -422,7 +428,7 @@ void DialogArcWithLength::Radius()
|
||||||
formulaData.variables = data->DataVariables();
|
formulaData.variables = data->DataVariables();
|
||||||
formulaData.labelEditFormula = ui->labelEditRadius;
|
formulaData.labelEditFormula = ui->labelEditRadius;
|
||||||
formulaData.labelResult = ui->labelResultRadius;
|
formulaData.labelResult = ui->labelResultRadius;
|
||||||
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
formulaData.checkLessThanZero = true;
|
formulaData.checkLessThanZero = true;
|
||||||
|
|
||||||
Eval(formulaData, flagRadius);
|
Eval(formulaData, flagRadius);
|
||||||
|
@ -436,7 +442,7 @@ void DialogArcWithLength::Length()
|
||||||
formulaData.variables = data->DataVariables();
|
formulaData.variables = data->DataVariables();
|
||||||
formulaData.labelEditFormula = ui->labelEditLength;
|
formulaData.labelEditFormula = ui->labelEditLength;
|
||||||
formulaData.labelResult = ui->labelResultLength;
|
formulaData.labelResult = ui->labelResultLength;
|
||||||
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
|
|
||||||
Eval(formulaData, flagLength);
|
Eval(formulaData, flagLength);
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,8 @@ DialogBisector::DialogBisector(const VContainer *data, quint32 toolId, QWidget *
|
||||||
|
|
||||||
ui->lineEditNamePoint->setClearButtonEnabled(true);
|
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->formulaBaseHeight = ui->plainTextEditFormula->height();
|
||||||
ui->plainTextEditFormula->installEventFilter(this);
|
ui->plainTextEditFormula->installEventFilter(this);
|
||||||
|
|
||||||
|
@ -142,7 +143,7 @@ void DialogBisector::FXLength()
|
||||||
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
||||||
dialog->setWindowTitle(tr("Edit length"));
|
dialog->setWindowTitle(tr("Edit length"));
|
||||||
dialog->SetFormula(GetFormula());
|
dialog->SetFormula(GetFormula());
|
||||||
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
|
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
||||||
if (dialog->exec() == QDialog::Accepted)
|
if (dialog->exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
SetFormula(dialog->GetFormula());
|
SetFormula(dialog->GetFormula());
|
||||||
|
@ -158,7 +159,7 @@ void DialogBisector::EvalFormula()
|
||||||
formulaData.variables = data->DataVariables();
|
formulaData.variables = data->DataVariables();
|
||||||
formulaData.labelEditFormula = ui->labelEditFormula;
|
formulaData.labelEditFormula = ui->labelEditFormula;
|
||||||
formulaData.labelResult = ui->labelResultCalculation;
|
formulaData.labelResult = ui->labelResultCalculation;
|
||||||
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
formulaData.checkZero = false;
|
formulaData.checkZero = false;
|
||||||
|
|
||||||
Eval(formulaData, flagFormula);
|
Eval(formulaData, flagFormula);
|
||||||
|
@ -279,7 +280,8 @@ void DialogBisector::SetTypeLine(const QString &value)
|
||||||
*/
|
*/
|
||||||
void DialogBisector::SetFormula(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.
|
// increase height if needed.
|
||||||
if (formula.length() > 80)
|
if (formula.length() > 80)
|
||||||
{
|
{
|
||||||
|
@ -401,7 +403,8 @@ QString DialogBisector::GetTypeLine() const
|
||||||
*/
|
*/
|
||||||
QString DialogBisector::GetFormula() const
|
QString DialogBisector::GetFormula() const
|
||||||
{
|
{
|
||||||
return qApp->TrVars()->TryFormulaFromUser(formula, qApp->Settings()->GetOsSeparator());
|
return VAbstractApplication::VApp()->TrVars()
|
||||||
|
->TryFormulaFromUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -106,7 +106,7 @@ void DialogCubicBezier::SetSpline(const VCubicBezier &spline)
|
||||||
ChangeCurrentData(ui->comboBoxPenStyle, spl.GetPenStyle());
|
ChangeCurrentData(ui->comboBoxPenStyle, spl.GetPenStyle());
|
||||||
ChangeCurrentData(ui->comboBoxColor, spl.GetColor());
|
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());
|
ui->doubleSpinBoxApproximationScale->setValue(spl.GetApproximationScale());
|
||||||
|
|
||||||
originAliasSuffix = spl.GetAliasSuffix();
|
originAliasSuffix = spl.GetAliasSuffix();
|
||||||
|
@ -200,7 +200,7 @@ void DialogCubicBezier::PointNameChanged()
|
||||||
getCurrentObjectId(ui->comboBoxP4) == spl.GetP4().id())
|
getCurrentObjectId(ui->comboBoxP4) == spl.GetP4().id())
|
||||||
{
|
{
|
||||||
newDuplicate = -1;
|
newDuplicate = -1;
|
||||||
ui->lineEditSplineName->setText(qApp->TrVars()->VarToUser(spl.name()));
|
ui->lineEditSplineName->setText(VAbstractApplication::VApp()->TrVars()->VarToUser(spl.name()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -213,7 +213,7 @@ void DialogCubicBezier::PointNameChanged()
|
||||||
newDuplicate = static_cast<qint32>(DNumber(spline.name()));
|
newDuplicate = static_cast<qint32>(DNumber(spline.name()));
|
||||||
spline.SetDuplicate(static_cast<quint32>(newDuplicate));
|
spline.SetDuplicate(static_cast<quint32>(newDuplicate));
|
||||||
}
|
}
|
||||||
ui->lineEditSplineName->setText(qApp->TrVars()->VarToUser(spline.name()));
|
ui->lineEditSplineName->setText(VAbstractApplication::VApp()->TrVars()->VarToUser(spline.name()));
|
||||||
}
|
}
|
||||||
catch (const VExceptionBadId &)
|
catch (const VExceptionBadId &)
|
||||||
{
|
{
|
||||||
|
|
|
@ -112,7 +112,7 @@ void DialogCubicBezierPath::SetPath(const VCubicBezierPath &value)
|
||||||
NewItem(path.at(i));
|
NewItem(path.at(i));
|
||||||
}
|
}
|
||||||
ui->listWidget->setFocus(Qt::OtherFocusReason);
|
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());
|
ui->doubleSpinBoxApproximationScale->setValue(path.GetApproximationScale());
|
||||||
|
|
||||||
originAliasSuffix = path.GetAliasSuffix();
|
originAliasSuffix = path.GetAliasSuffix();
|
||||||
|
@ -157,7 +157,8 @@ void DialogCubicBezierPath::ChosenObject(quint32 id, const SceneObject &type)
|
||||||
if (path.CountPoints() == 1)
|
if (path.CountPoints() == 1)
|
||||||
{
|
{
|
||||||
visPath->VisualMode(NULL_ID);
|
visPath->VisualMode(NULL_ID);
|
||||||
VAbstractMainWindow *window = qobject_cast<VAbstractMainWindow *>(qApp->getMainWindow());
|
VAbstractMainWindow *window =
|
||||||
|
qobject_cast<VAbstractMainWindow *>(VAbstractValApplication::VApp()->getMainWindow());
|
||||||
SCASSERT(window != nullptr)
|
SCASSERT(window != nullptr)
|
||||||
connect(visPath, &VisToolCubicBezierPath::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
|
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())
|
if (first.id() == path.at(0).id() && last.id() == path.at(path.CountPoints()-1).id())
|
||||||
{
|
{
|
||||||
newDuplicate = -1;
|
newDuplicate = -1;
|
||||||
ui->lineEditSplPathName->setText(qApp->TrVars()->VarToUser(path.name()));
|
ui->lineEditSplPathName->setText(VAbstractApplication::VApp()->TrVars()->VarToUser(path.name()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -386,7 +387,7 @@ void DialogCubicBezierPath::ValidatePath()
|
||||||
newPath.SetDuplicate(static_cast<quint32>(newDuplicate));
|
newPath.SetDuplicate(static_cast<quint32>(newDuplicate));
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->lineEditSplPathName->setText(qApp->TrVars()->VarToUser(newPath.name()));
|
ui->lineEditSplPathName->setText(VAbstractApplication::VApp()->TrVars()->VarToUser(newPath.name()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,8 @@ DialogCurveIntersectAxis::DialogCurveIntersectAxis(const VContainer *data, quint
|
||||||
|
|
||||||
ui->lineEditNamePoint->setClearButtonEnabled(true);
|
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();
|
formulaBaseHeightAngle = ui->plainTextEditFormula->height();
|
||||||
ui->plainTextEditFormula->installEventFilter(this);
|
ui->plainTextEditFormula->installEventFilter(this);
|
||||||
|
|
||||||
|
@ -136,13 +137,15 @@ void DialogCurveIntersectAxis::SetTypeLine(const QString &value)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString DialogCurveIntersectAxis::GetAngle() const
|
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)
|
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
|
// 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
|
// of this PlainTextEdit to change 80 to this value
|
||||||
if (formulaAngle.length() > 80)
|
if (formulaAngle.length() > 80)
|
||||||
|
@ -218,13 +221,14 @@ void DialogCurveIntersectAxis::ShowDialog(bool click)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*We will ignore click if poinet is in point circle*/
|
/*We will ignore click if poinet is in point circle*/
|
||||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
VMainGraphicsScene *scene =
|
||||||
|
qobject_cast<VMainGraphicsScene *>(VAbstractValApplication::VApp()->getCurrentScene());
|
||||||
SCASSERT(scene != nullptr)
|
SCASSERT(scene != nullptr)
|
||||||
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(GetBasePointId());
|
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(GetBasePointId());
|
||||||
QLineF line = QLineF(static_cast<QPointF>(*point), scene->getScenePos());
|
QLineF line = QLineF(static_cast<QPointF>(*point), scene->getScenePos());
|
||||||
|
|
||||||
//Radius of point circle, but little bigger. Need handle with hover sizes.
|
//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;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -260,7 +264,8 @@ void DialogCurveIntersectAxis::ChosenObject(quint32 id, const SceneObject &type)
|
||||||
{
|
{
|
||||||
number++;
|
number++;
|
||||||
line->VisualMode(id);
|
line->VisualMode(id);
|
||||||
VAbstractMainWindow *window = qobject_cast<VAbstractMainWindow *>(qApp->getMainWindow());
|
VAbstractMainWindow *window =
|
||||||
|
qobject_cast<VAbstractMainWindow *>(VAbstractValApplication::VApp()->getMainWindow());
|
||||||
SCASSERT(window != nullptr)
|
SCASSERT(window != nullptr)
|
||||||
connect(line, &VisToolCurveIntersectAxis::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
|
connect(line, &VisToolCurveIntersectAxis::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,8 @@ DialogCutArc::DialogCutArc(const VContainer *data, quint32 toolId, QWidget *pare
|
||||||
|
|
||||||
ui->lineEditNamePoint->setClearButtonEnabled(true);
|
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();
|
formulaBaseHeight = ui->plainTextEditFormula->height();
|
||||||
ui->plainTextEditFormula->installEventFilter(this);
|
ui->plainTextEditFormula->installEventFilter(this);
|
||||||
|
|
||||||
|
@ -109,7 +110,7 @@ void DialogCutArc::FXLength()
|
||||||
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
||||||
dialog->setWindowTitle(tr("Edit length"));
|
dialog->setWindowTitle(tr("Edit length"));
|
||||||
dialog->SetFormula(GetFormula());
|
dialog->SetFormula(GetFormula());
|
||||||
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
|
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
||||||
if (dialog->exec() == QDialog::Accepted)
|
if (dialog->exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
SetFormula(dialog->GetFormula());
|
SetFormula(dialog->GetFormula());
|
||||||
|
@ -125,7 +126,7 @@ void DialogCutArc::EvalFormula()
|
||||||
formulaData.variables = data->DataVariables();
|
formulaData.variables = data->DataVariables();
|
||||||
formulaData.labelEditFormula = ui->labelEditFormula;
|
formulaData.labelEditFormula = ui->labelEditFormula;
|
||||||
formulaData.labelResult = ui->labelResultCalculation;
|
formulaData.labelResult = ui->labelResultCalculation;
|
||||||
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
formulaData.checkZero = false;
|
formulaData.checkZero = false;
|
||||||
|
|
||||||
Eval(formulaData, flagFormula);
|
Eval(formulaData, flagFormula);
|
||||||
|
@ -268,7 +269,8 @@ void DialogCutArc::setArcId(quint32 value)
|
||||||
*/
|
*/
|
||||||
void DialogCutArc::SetFormula(const QString &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.
|
// increase height if needed.
|
||||||
if (formula.length() > 80)
|
if (formula.length() > 80)
|
||||||
{
|
{
|
||||||
|
@ -301,7 +303,8 @@ void DialogCutArc::SetPointName(const QString &value)
|
||||||
*/
|
*/
|
||||||
QString DialogCutArc::GetFormula() const
|
QString DialogCutArc::GetFormula() const
|
||||||
{
|
{
|
||||||
return qApp->TrVars()->TryFormulaFromUser(formula, qApp->Settings()->GetOsSeparator());
|
return VAbstractApplication::VApp()->TrVars()
|
||||||
|
->TryFormulaFromUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -72,7 +72,8 @@ DialogCutSpline::DialogCutSpline(const VContainer *data, quint32 toolId, QWidget
|
||||||
|
|
||||||
ui->lineEditNamePoint->setClearButtonEnabled(true);
|
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->formulaBaseHeight = ui->plainTextEditFormula->height();
|
||||||
ui->plainTextEditFormula->installEventFilter(this);
|
ui->plainTextEditFormula->installEventFilter(this);
|
||||||
|
|
||||||
|
@ -132,7 +133,8 @@ void DialogCutSpline::SetPointName(const QString &value)
|
||||||
*/
|
*/
|
||||||
void DialogCutSpline::SetFormula(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
|
// 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
|
// of this PlainTextEdit to change 80 to this value
|
||||||
if (formula.length() > 80)
|
if (formula.length() > 80)
|
||||||
|
@ -266,7 +268,7 @@ void DialogCutSpline::FXLength()
|
||||||
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
||||||
dialog->setWindowTitle(tr("Edit length"));
|
dialog->setWindowTitle(tr("Edit length"));
|
||||||
dialog->SetFormula(GetFormula());
|
dialog->SetFormula(GetFormula());
|
||||||
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
|
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
||||||
if (dialog->exec() == QDialog::Accepted)
|
if (dialog->exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
SetFormula(dialog->GetFormula());
|
SetFormula(dialog->GetFormula());
|
||||||
|
@ -282,7 +284,7 @@ void DialogCutSpline::EvalFormula()
|
||||||
formulaData.variables = data->DataVariables();
|
formulaData.variables = data->DataVariables();
|
||||||
formulaData.labelEditFormula = ui->labelEditFormula;
|
formulaData.labelEditFormula = ui->labelEditFormula;
|
||||||
formulaData.labelResult = ui->labelResultCalculation;
|
formulaData.labelResult = ui->labelResultCalculation;
|
||||||
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
formulaData.checkZero = false;
|
formulaData.checkZero = false;
|
||||||
|
|
||||||
Eval(formulaData, flagFormula);
|
Eval(formulaData, flagFormula);
|
||||||
|
@ -301,7 +303,8 @@ void DialogCutSpline::ShowVisualization()
|
||||||
*/
|
*/
|
||||||
QString DialogCutSpline::GetFormula() const
|
QString DialogCutSpline::GetFormula() const
|
||||||
{
|
{
|
||||||
return qApp->TrVars()->TryFormulaFromUser(formula, qApp->Settings()->GetOsSeparator());
|
return VAbstractApplication::VApp()->TrVars()
|
||||||
|
->TryFormulaFromUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -72,7 +72,8 @@ DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, quint32 toolId,
|
||||||
|
|
||||||
ui->lineEditNamePoint->setClearButtonEnabled(true);
|
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->formulaBaseHeight = ui->plainTextEditFormula->height();
|
||||||
ui->plainTextEditFormula->installEventFilter(this);
|
ui->plainTextEditFormula->installEventFilter(this);
|
||||||
|
|
||||||
|
@ -132,7 +133,8 @@ void DialogCutSplinePath::SetPointName(const QString &value)
|
||||||
*/
|
*/
|
||||||
void DialogCutSplinePath::SetFormula(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
|
// 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
|
// of this PlainTextEdit to change 80 to this value
|
||||||
if (formula.length() > 80)
|
if (formula.length() > 80)
|
||||||
|
@ -266,7 +268,7 @@ void DialogCutSplinePath::FXLength()
|
||||||
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
||||||
dialog->setWindowTitle(tr("Edit length"));
|
dialog->setWindowTitle(tr("Edit length"));
|
||||||
dialog->SetFormula(GetFormula());
|
dialog->SetFormula(GetFormula());
|
||||||
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
|
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
||||||
if (dialog->exec() == QDialog::Accepted)
|
if (dialog->exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
SetFormula(dialog->GetFormula());
|
SetFormula(dialog->GetFormula());
|
||||||
|
@ -282,7 +284,7 @@ void DialogCutSplinePath::EvalFormula()
|
||||||
formulaData.variables = data->DataVariables();
|
formulaData.variables = data->DataVariables();
|
||||||
formulaData.labelEditFormula = ui->labelEditFormula;
|
formulaData.labelEditFormula = ui->labelEditFormula;
|
||||||
formulaData.labelResult = ui->labelResultCalculation;
|
formulaData.labelResult = ui->labelResultCalculation;
|
||||||
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
formulaData.checkZero = false;
|
formulaData.checkZero = false;
|
||||||
|
|
||||||
Eval(formulaData, flagFormula);
|
Eval(formulaData, flagFormula);
|
||||||
|
@ -301,7 +303,8 @@ void DialogCutSplinePath::ShowVisualization()
|
||||||
*/
|
*/
|
||||||
QString DialogCutSplinePath::GetFormula() const
|
QString DialogCutSplinePath::GetFormula() const
|
||||||
{
|
{
|
||||||
return qApp->TrVars()->TryFormulaFromUser(formula, qApp->Settings()->GetOsSeparator());
|
return VAbstractApplication::VApp()->TrVars()
|
||||||
|
->TryFormulaFromUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -198,7 +198,8 @@ void DialogEllipticalArc::SetCenter(const quint32 &value)
|
||||||
*/
|
*/
|
||||||
QString DialogEllipticalArc::GetRadius1() const
|
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)
|
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.
|
// increase height if needed.
|
||||||
if (radius1.length() > 80)
|
if (radius1.length() > 80)
|
||||||
{
|
{
|
||||||
|
@ -230,7 +232,8 @@ void DialogEllipticalArc::SetRadius1(const QString &value)
|
||||||
*/
|
*/
|
||||||
QString DialogEllipticalArc::GetRadius2() const
|
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)
|
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.
|
// increase height if needed.
|
||||||
if (radius2.length() > 80)
|
if (radius2.length() > 80)
|
||||||
{
|
{
|
||||||
|
@ -262,7 +266,8 @@ void DialogEllipticalArc::SetRadius2(const QString &value)
|
||||||
*/
|
*/
|
||||||
QString DialogEllipticalArc::GetF1() const
|
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)
|
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.
|
// increase height if needed.
|
||||||
if (f1.length() > 80)
|
if (f1.length() > 80)
|
||||||
{
|
{
|
||||||
|
@ -294,7 +300,8 @@ void DialogEllipticalArc::SetF1(const QString &value)
|
||||||
*/
|
*/
|
||||||
QString DialogEllipticalArc::GetF2() const
|
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)
|
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.
|
// increase height if needed.
|
||||||
if (f2.length() > 80)
|
if (f2.length() > 80)
|
||||||
{
|
{
|
||||||
|
@ -326,7 +334,8 @@ void DialogEllipticalArc::SetF2(const QString &value)
|
||||||
*/
|
*/
|
||||||
QString DialogEllipticalArc::GetRotationAngle() const
|
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)
|
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.
|
// increase height if needed.
|
||||||
if (rotationAngle.length() > 80)
|
if (rotationAngle.length() > 80)
|
||||||
{
|
{
|
||||||
|
@ -394,7 +404,7 @@ void DialogEllipticalArc::EvalRadiuses()
|
||||||
formulaData.variables = data->DataVariables();
|
formulaData.variables = data->DataVariables();
|
||||||
formulaData.labelEditFormula = ui->labelEditRadius1;
|
formulaData.labelEditFormula = ui->labelEditRadius1;
|
||||||
formulaData.labelResult = ui->labelResultRadius1;
|
formulaData.labelResult = ui->labelResultRadius1;
|
||||||
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
formulaData.checkLessThanZero = true;
|
formulaData.checkLessThanZero = true;
|
||||||
|
|
||||||
Eval(formulaData, flagRadius1);
|
Eval(formulaData, flagRadius1);
|
||||||
|
@ -441,7 +451,7 @@ void DialogEllipticalArc::FXRadius1()
|
||||||
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
||||||
dialog->setWindowTitle(tr("Edit radius1"));
|
dialog->setWindowTitle(tr("Edit radius1"));
|
||||||
dialog->SetFormula(GetRadius1());
|
dialog->SetFormula(GetRadius1());
|
||||||
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
|
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
||||||
if (dialog->exec() == QDialog::Accepted)
|
if (dialog->exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
SetRadius1(dialog->GetFormula());
|
SetRadius1(dialog->GetFormula());
|
||||||
|
@ -455,7 +465,7 @@ void DialogEllipticalArc::FXRadius2()
|
||||||
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
||||||
dialog->setWindowTitle(tr("Edit radius2"));
|
dialog->setWindowTitle(tr("Edit radius2"));
|
||||||
dialog->SetFormula(GetRadius2());
|
dialog->SetFormula(GetRadius2());
|
||||||
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
|
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
||||||
if (dialog->exec() == QDialog::Accepted)
|
if (dialog->exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
SetRadius2(dialog->GetFormula());
|
SetRadius2(dialog->GetFormula());
|
||||||
|
|
|
@ -83,7 +83,8 @@ DialogEndLine::DialogEndLine(const VContainer *data, quint32 toolId, QWidget *pa
|
||||||
|
|
||||||
ui->lineEditNamePoint->setClearButtonEnabled(true);
|
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->formulaBaseHeight = ui->plainTextEditFormula->height();
|
||||||
this->formulaBaseHeightAngle = ui->plainTextEditAngle->height();
|
this->formulaBaseHeightAngle = ui->plainTextEditAngle->height();
|
||||||
|
|
||||||
|
@ -153,7 +154,7 @@ void DialogEndLine::EvalLength()
|
||||||
formulaData.variables = data->DataVariables();
|
formulaData.variables = data->DataVariables();
|
||||||
formulaData.labelEditFormula = ui->labelEditFormula;
|
formulaData.labelEditFormula = ui->labelEditFormula;
|
||||||
formulaData.labelResult = ui->labelResultCalculation;
|
formulaData.labelResult = ui->labelResultCalculation;
|
||||||
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
formulaData.checkLessThanZero = false;
|
formulaData.checkLessThanZero = false;
|
||||||
|
|
||||||
Eval(formulaData, flagFormula);
|
Eval(formulaData, flagFormula);
|
||||||
|
@ -191,7 +192,7 @@ void DialogEndLine::FXLength()
|
||||||
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
||||||
dialog->setWindowTitle(tr("Edit length"));
|
dialog->setWindowTitle(tr("Edit length"));
|
||||||
dialog->SetFormula(GetFormula());
|
dialog->SetFormula(GetFormula());
|
||||||
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
|
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
||||||
if (dialog->exec() == QDialog::Accepted)
|
if (dialog->exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
SetFormula(dialog->GetFormula());
|
SetFormula(dialog->GetFormula());
|
||||||
|
@ -214,7 +215,8 @@ void DialogEndLine::ChosenObject(quint32 id, const SceneObject &type)
|
||||||
if (SetObject(id, ui->comboBoxBasePoint, QString()))
|
if (SetObject(id, ui->comboBoxBasePoint, QString()))
|
||||||
{
|
{
|
||||||
vis->VisualMode(id);
|
vis->VisualMode(id);
|
||||||
VAbstractMainWindow *window = qobject_cast<VAbstractMainWindow *>(qApp->getMainWindow());
|
VAbstractMainWindow *window =
|
||||||
|
qobject_cast<VAbstractMainWindow *>(VAbstractValApplication::VApp()->getMainWindow());
|
||||||
SCASSERT(window != nullptr)
|
SCASSERT(window != nullptr)
|
||||||
connect(vis.data(), &Visualization::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
|
connect(vis.data(), &Visualization::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
|
||||||
prepare = true;
|
prepare = true;
|
||||||
|
@ -252,7 +254,8 @@ void DialogEndLine::SetTypeLine(const QString &value)
|
||||||
*/
|
*/
|
||||||
void DialogEndLine::SetFormula(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
|
// 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
|
// of this PlainTextEdit to change 80 to this value
|
||||||
if (formulaLength.length() > 80)
|
if (formulaLength.length() > 80)
|
||||||
|
@ -275,7 +278,8 @@ void DialogEndLine::SetFormula(const QString &value)
|
||||||
*/
|
*/
|
||||||
void DialogEndLine::SetAngle(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
|
// 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
|
// of this PlainTextEdit to change 80 to this value
|
||||||
if (formulaAngle.length() > 80)
|
if (formulaAngle.length() > 80)
|
||||||
|
@ -337,13 +341,14 @@ void DialogEndLine::ShowDialog(bool click)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*We will ignore click if pointer is in point circle*/
|
/*We will ignore click if pointer is in point circle*/
|
||||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
VMainGraphicsScene *scene =
|
||||||
|
qobject_cast<VMainGraphicsScene *>(VAbstractValApplication::VApp()->getCurrentScene());
|
||||||
SCASSERT(scene != nullptr)
|
SCASSERT(scene != nullptr)
|
||||||
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(GetBasePointId());
|
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(GetBasePointId());
|
||||||
QLineF line = QLineF(static_cast<QPointF>(*point), scene->getScenePos());
|
QLineF line = QLineF(static_cast<QPointF>(*point), scene->getScenePos());
|
||||||
|
|
||||||
//Radius of point circle, but little bigger. Need handle with hover sizes.
|
//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;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -421,7 +426,8 @@ QString DialogEndLine::GetTypeLine() const
|
||||||
*/
|
*/
|
||||||
QString DialogEndLine::GetFormula() 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
|
QString DialogEndLine::GetAngle() const
|
||||||
{
|
{
|
||||||
return qApp->TrVars()->TryFormulaFromUser(formulaAngle, qApp->Settings()->GetOsSeparator());
|
return VAbstractApplication::VApp()->TrVars()
|
||||||
|
->TryFormulaFromUser(formulaAngle, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -73,7 +73,7 @@ DialogFlippingByAxis::DialogFlippingByAxis(const VContainer *data, quint32 toolI
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
ui->lineEditSuffix->setText(qApp->getCurrentDocument()->GenerateSuffix());
|
ui->lineEditSuffix->setText(VAbstractValApplication::VApp()->getCurrentDocument()->GenerateSuffix());
|
||||||
|
|
||||||
InitOkCancelApply(ui);
|
InitOkCancelApply(ui);
|
||||||
|
|
||||||
|
@ -212,7 +212,8 @@ void DialogFlippingByAxis::ShowDialog(bool click)
|
||||||
|
|
||||||
stage1 = false;
|
stage1 = false;
|
||||||
|
|
||||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
VMainGraphicsScene *scene =
|
||||||
|
qobject_cast<VMainGraphicsScene *>(VAbstractValApplication::VApp()->getCurrentScene());
|
||||||
SCASSERT(scene != nullptr)
|
SCASSERT(scene != nullptr)
|
||||||
scene->clearSelection();
|
scene->clearSelection();
|
||||||
|
|
||||||
|
@ -231,7 +232,7 @@ void DialogFlippingByAxis::ShowDialog(bool click)
|
||||||
scene->ToggleSplineHover(false);
|
scene->ToggleSplineHover(false);
|
||||||
scene->ToggleSplinePathHover(false);
|
scene->ToggleSplinePathHover(false);
|
||||||
|
|
||||||
qApp->getSceneView()->AllowRubberBand(false);
|
VAbstractValApplication::VApp()->getSceneView()->AllowRubberBand(false);
|
||||||
|
|
||||||
FillSourceList();
|
FillSourceList();
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ DialogFlippingByLine::DialogFlippingByLine(const VContainer *data, quint32 toolI
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
ui->lineEditSuffix->setText(qApp->getCurrentDocument()->GenerateSuffix());
|
ui->lineEditSuffix->setText(VAbstractValApplication::VApp()->getCurrentDocument()->GenerateSuffix());
|
||||||
|
|
||||||
InitOkCancelApply(ui);
|
InitOkCancelApply(ui);
|
||||||
|
|
||||||
|
@ -206,7 +206,8 @@ void DialogFlippingByLine::ShowDialog(bool click)
|
||||||
|
|
||||||
stage1 = false;
|
stage1 = false;
|
||||||
|
|
||||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
VMainGraphicsScene *scene =
|
||||||
|
qobject_cast<VMainGraphicsScene *>(VAbstractValApplication::VApp()->getCurrentScene());
|
||||||
SCASSERT(scene != nullptr)
|
SCASSERT(scene != nullptr)
|
||||||
scene->clearSelection();
|
scene->clearSelection();
|
||||||
|
|
||||||
|
@ -225,7 +226,7 @@ void DialogFlippingByLine::ShowDialog(bool click)
|
||||||
scene->ToggleSplineHover(false);
|
scene->ToggleSplineHover(false);
|
||||||
scene->ToggleSplinePathHover(false);
|
scene->ToggleSplinePathHover(false);
|
||||||
|
|
||||||
qApp->getSceneView()->AllowRubberBand(false);
|
VAbstractValApplication::VApp()->getSceneView()->AllowRubberBand(false);
|
||||||
|
|
||||||
FillSourceList();
|
FillSourceList();
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,8 @@ DialogHeight::DialogHeight(const VContainer *data, quint32 toolId, QWidget *pare
|
||||||
|
|
||||||
ui->lineEditNamePoint->setClearButtonEnabled(true);
|
ui->lineEditNamePoint->setClearButtonEnabled(true);
|
||||||
|
|
||||||
ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
|
ui->lineEditNamePoint->setText(
|
||||||
|
VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
|
||||||
InitOkCancelApply(ui);
|
InitOkCancelApply(ui);
|
||||||
|
|
||||||
FillComboBoxPoints(ui->comboBoxBasePoint);
|
FillComboBoxPoints(ui->comboBoxBasePoint);
|
||||||
|
|
|
@ -71,7 +71,8 @@ DialogLineIntersect::DialogLineIntersect(const VContainer *data, quint32 toolId,
|
||||||
|
|
||||||
number = 0;
|
number = 0;
|
||||||
InitOkCancelApply(ui);
|
InitOkCancelApply(ui);
|
||||||
ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
|
ui->lineEditNamePoint->setText(
|
||||||
|
VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
|
||||||
|
|
||||||
FillComboBoxPoints(ui->comboBoxP1Line1);
|
FillComboBoxPoints(ui->comboBoxP1Line1);
|
||||||
FillComboBoxPoints(ui->comboBoxP2Line1);
|
FillComboBoxPoints(ui->comboBoxP2Line1);
|
||||||
|
|
|
@ -77,7 +77,8 @@ DialogLineIntersectAxis::DialogLineIntersectAxis(const VContainer *data, quint32
|
||||||
|
|
||||||
ui->lineEditNamePoint->setClearButtonEnabled(true);
|
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();
|
this->formulaBaseHeightAngle = ui->plainTextEditFormula->height();
|
||||||
ui->plainTextEditFormula->installEventFilter(this);
|
ui->plainTextEditFormula->installEventFilter(this);
|
||||||
|
|
||||||
|
@ -149,13 +150,15 @@ void DialogLineIntersectAxis::SetTypeLine(const QString &value)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString DialogLineIntersectAxis::GetAngle() const
|
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)
|
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
|
// 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
|
// of this PlainTextEdit to change 80 to this value
|
||||||
if (formulaAngle.length() > 80)
|
if (formulaAngle.length() > 80)
|
||||||
|
@ -247,13 +250,14 @@ void DialogLineIntersectAxis::ShowDialog(bool click)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*We will ignore click if poinet is in point circle*/
|
/*We will ignore click if poinet is in point circle*/
|
||||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
VMainGraphicsScene *scene =
|
||||||
|
qobject_cast<VMainGraphicsScene *>(VAbstractValApplication::VApp()->getCurrentScene());
|
||||||
SCASSERT(scene != nullptr)
|
SCASSERT(scene != nullptr)
|
||||||
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(GetBasePointId());
|
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(GetBasePointId());
|
||||||
QLineF line = QLineF(static_cast<QPointF>(*point), scene->getScenePos());
|
QLineF line = QLineF(static_cast<QPointF>(*point), scene->getScenePos());
|
||||||
|
|
||||||
//Radius of point circle, but little bigger. Need handle with hover sizes.
|
//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;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -286,7 +290,8 @@ void DialogLineIntersectAxis::ChosenObject(quint32 id, const SceneObject &type)
|
||||||
{
|
{
|
||||||
number++;
|
number++;
|
||||||
line->VisualMode(id);
|
line->VisualMode(id);
|
||||||
VAbstractMainWindow *window = qobject_cast<VAbstractMainWindow *>(qApp->getMainWindow());
|
VAbstractMainWindow *window =
|
||||||
|
qobject_cast<VAbstractMainWindow *>(VAbstractValApplication::VApp()->getMainWindow());
|
||||||
SCASSERT(window != nullptr)
|
SCASSERT(window != nullptr)
|
||||||
connect(line, &VisToolLineIntersectAxis::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
|
connect(line, &VisToolLineIntersectAxis::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,7 @@ DialogMove::DialogMove(const VContainer *data, quint32 toolId, QWidget *parent)
|
||||||
this->formulaBaseHeightLength = ui->plainTextEditLength->height();
|
this->formulaBaseHeightLength = ui->plainTextEditLength->height();
|
||||||
ui->plainTextEditLength->installEventFilter(this);
|
ui->plainTextEditLength->installEventFilter(this);
|
||||||
|
|
||||||
ui->lineEditSuffix->setText(qApp->getCurrentDocument()->GenerateSuffix());
|
ui->lineEditSuffix->setText(VAbstractValApplication::VApp()->getCurrentDocument()->GenerateSuffix());
|
||||||
|
|
||||||
timerAngle->setSingleShot(true);
|
timerAngle->setSingleShot(true);
|
||||||
connect(timerAngle, &QTimer::timeout, this, &DialogMove::EvalAngle);
|
connect(timerAngle, &QTimer::timeout, this, &DialogMove::EvalAngle);
|
||||||
|
@ -168,13 +168,15 @@ DialogMove::~DialogMove()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString DialogMove::GetAngle() const
|
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)
|
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.
|
// increase height if needed.
|
||||||
if (formulaAngle.length() > 80)
|
if (formulaAngle.length() > 80)
|
||||||
{
|
{
|
||||||
|
@ -192,13 +194,15 @@ void DialogMove::SetAngle(const QString &value)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString DialogMove::GetLength() const
|
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)
|
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.
|
// increase height if needed.
|
||||||
if (formulaLength.length() > 80)
|
if (formulaLength.length() > 80)
|
||||||
{
|
{
|
||||||
|
@ -216,13 +220,15 @@ void DialogMove::SetLength(const QString &value)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString DialogMove::GetRotationAngle() const
|
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)
|
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.
|
// increase height if needed.
|
||||||
if (formulaRotationAngle.length() > 80)
|
if (formulaRotationAngle.length() > 80)
|
||||||
{
|
{
|
||||||
|
@ -321,7 +327,8 @@ void DialogMove::ShowDialog(bool click)
|
||||||
stage1 = false;
|
stage1 = false;
|
||||||
prepare = true;
|
prepare = true;
|
||||||
|
|
||||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
VMainGraphicsScene *scene =
|
||||||
|
qobject_cast<VMainGraphicsScene *>(VAbstractValApplication::VApp()->getCurrentScene());
|
||||||
SCASSERT(scene != nullptr)
|
SCASSERT(scene != nullptr)
|
||||||
scene->clearSelection();
|
scene->clearSelection();
|
||||||
|
|
||||||
|
@ -330,7 +337,8 @@ void DialogMove::ShowDialog(bool click)
|
||||||
operation->SetObjects(SourceToObjects(sourceObjects));
|
operation->SetObjects(SourceToObjects(sourceObjects));
|
||||||
operation->VisualMode();
|
operation->VisualMode();
|
||||||
|
|
||||||
VAbstractMainWindow *window = qobject_cast<VAbstractMainWindow *>(qApp->getMainWindow());
|
VAbstractMainWindow *window =
|
||||||
|
qobject_cast<VAbstractMainWindow *>(VAbstractValApplication::VApp()->getMainWindow());
|
||||||
SCASSERT(window != nullptr)
|
SCASSERT(window != nullptr)
|
||||||
connect(operation, &VisToolMove::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
|
connect(operation, &VisToolMove::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
|
||||||
|
|
||||||
|
@ -344,7 +352,7 @@ void DialogMove::ShowDialog(bool click)
|
||||||
scene->ToggleSplineHover(false);
|
scene->ToggleSplineHover(false);
|
||||||
scene->ToggleSplinePathHover(false);
|
scene->ToggleSplinePathHover(false);
|
||||||
|
|
||||||
qApp->getSceneView()->AllowRubberBand(false);
|
VAbstractValApplication::VApp()->getSceneView()->AllowRubberBand(false);
|
||||||
|
|
||||||
FillSourceList();
|
FillSourceList();
|
||||||
}
|
}
|
||||||
|
@ -355,8 +363,10 @@ void DialogMove::ShowDialog(bool click)
|
||||||
|
|
||||||
if (operation->LengthValue() > 0)
|
if (operation->LengthValue() > 0)
|
||||||
{
|
{
|
||||||
formulaAngle = qApp->TrVars()->FormulaToUser(operation->Angle(), qApp->Settings()->GetOsSeparator());
|
formulaAngle = VAbstractApplication::VApp()->TrVars()
|
||||||
formulaLength = qApp->TrVars()->FormulaToUser(operation->Length(), qApp->Settings()->GetOsSeparator());
|
->FormulaToUser(operation->Angle(), VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
|
formulaLength = VAbstractApplication::VApp()->TrVars()
|
||||||
|
->FormulaToUser(operation->Length(), VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
operation->SetAngle(formulaAngle);
|
operation->SetAngle(formulaAngle);
|
||||||
operation->SetLength(formulaLength);
|
operation->SetLength(formulaLength);
|
||||||
operation->RefreshGeometry();
|
operation->RefreshGeometry();
|
||||||
|
@ -381,8 +391,10 @@ void DialogMove::ShowDialog(bool click)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetAngle(qApp->TrVars()->FormulaFromUser(formulaAngle, qApp->Settings()->GetOsSeparator()));
|
SetAngle(VAbstractApplication::VApp()->TrVars()
|
||||||
SetLength(qApp->TrVars()->FormulaFromUser(formulaLength, qApp->Settings()->GetOsSeparator()));
|
->FormulaFromUser(formulaAngle, VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
|
||||||
|
SetLength(VAbstractApplication::VApp()->TrVars()
|
||||||
|
->FormulaFromUser(formulaLength, VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
|
||||||
SetRotationAngle(operation->RotationAngle());
|
SetRotationAngle(operation->RotationAngle());
|
||||||
setModal(true);
|
setModal(true);
|
||||||
emit ToolTip(QString());
|
emit ToolTip(QString());
|
||||||
|
@ -493,7 +505,7 @@ void DialogMove::FXLength()
|
||||||
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
||||||
dialog->setWindowTitle(tr("Edit length"));
|
dialog->setWindowTitle(tr("Edit length"));
|
||||||
dialog->SetFormula(GetLength());
|
dialog->SetFormula(GetLength());
|
||||||
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
|
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
||||||
if (dialog->exec() == QDialog::Accepted)
|
if (dialog->exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
SetLength(dialog->GetFormula());
|
SetLength(dialog->GetFormula());
|
||||||
|
@ -819,7 +831,7 @@ void DialogMove::EvalLength()
|
||||||
formulaData.variables = data->DataVariables();
|
formulaData.variables = data->DataVariables();
|
||||||
formulaData.labelEditFormula = ui->labelEditLength;
|
formulaData.labelEditFormula = ui->labelEditLength;
|
||||||
formulaData.labelResult = ui->labelResultLength;
|
formulaData.labelResult = ui->labelResultLength;
|
||||||
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
|
|
||||||
Eval(formulaData, flagLength);
|
Eval(formulaData, flagLength);
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,8 @@ DialogNormal::DialogNormal(const VContainer *data, quint32 toolId, QWidget *pare
|
||||||
|
|
||||||
ui->lineEditNamePoint->setClearButtonEnabled(true);
|
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->formulaBaseHeight = ui->plainTextEditFormula->height();
|
||||||
ui->plainTextEditFormula->installEventFilter(this);
|
ui->plainTextEditFormula->installEventFilter(this);
|
||||||
|
|
||||||
|
@ -144,7 +145,7 @@ void DialogNormal::FXLength()
|
||||||
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
||||||
dialog->setWindowTitle(tr("Edit length"));
|
dialog->setWindowTitle(tr("Edit length"));
|
||||||
dialog->SetFormula(GetFormula());
|
dialog->SetFormula(GetFormula());
|
||||||
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
|
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
||||||
if (dialog->exec() == QDialog::Accepted)
|
if (dialog->exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
SetFormula(dialog->GetFormula());
|
SetFormula(dialog->GetFormula());
|
||||||
|
@ -160,7 +161,7 @@ void DialogNormal::EvalFormula()
|
||||||
formulaData.variables = data->DataVariables();
|
formulaData.variables = data->DataVariables();
|
||||||
formulaData.labelEditFormula = ui->labelEditFormula;
|
formulaData.labelEditFormula = ui->labelEditFormula;
|
||||||
formulaData.labelResult = ui->labelResultCalculation;
|
formulaData.labelResult = ui->labelResultCalculation;
|
||||||
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
|
|
||||||
Eval(formulaData, flagFormula);
|
Eval(formulaData, flagFormula);
|
||||||
}
|
}
|
||||||
|
@ -320,7 +321,8 @@ void DialogNormal::SetAngle(qreal value)
|
||||||
*/
|
*/
|
||||||
void DialogNormal::SetFormula(const QString &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.
|
// increase height if needed.
|
||||||
if (formula.length() > 80)
|
if (formula.length() > 80)
|
||||||
{
|
{
|
||||||
|
@ -374,7 +376,8 @@ QString DialogNormal::GetTypeLine() const
|
||||||
*/
|
*/
|
||||||
QString DialogNormal::GetFormula() const
|
QString DialogNormal::GetFormula() const
|
||||||
{
|
{
|
||||||
return qApp->TrVars()->TryFormulaFromUser(formula, qApp->Settings()->GetOsSeparator());
|
return VAbstractApplication::VApp()->TrVars()
|
||||||
|
->TryFormulaFromUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -49,7 +49,8 @@ DialogPointFromArcAndTangent::DialogPointFromArcAndTangent(const VContainer *dat
|
||||||
|
|
||||||
ui->lineEditNamePoint->setClearButtonEnabled(true);
|
ui->lineEditNamePoint->setClearButtonEnabled(true);
|
||||||
|
|
||||||
ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
|
ui->lineEditNamePoint->setText(
|
||||||
|
VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
|
||||||
|
|
||||||
InitOkCancelApply(ui);
|
InitOkCancelApply(ui);
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,8 @@ DialogPointFromCircleAndTangent::DialogPointFromCircleAndTangent(const VContaine
|
||||||
|
|
||||||
ui->lineEditNamePoint->setClearButtonEnabled(true);
|
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();
|
this->formulaBaseHeightCircleRadius = ui->plainTextEditRadius->height();
|
||||||
|
|
||||||
|
@ -146,14 +147,16 @@ void DialogPointFromCircleAndTangent::SetCircleCenterId(const quint32 &value)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString DialogPointFromCircleAndTangent::GetCircleRadius() const
|
QString DialogPointFromCircleAndTangent::GetCircleRadius() const
|
||||||
{
|
{
|
||||||
return qApp->TrVars()->TryFormulaFromUser(ui->plainTextEditRadius->toPlainText(),
|
return VAbstractApplication::VApp()->TrVars()
|
||||||
qApp->Settings()->GetOsSeparator());
|
->TryFormulaFromUser(ui->plainTextEditRadius->toPlainText(),
|
||||||
|
VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPointFromCircleAndTangent::SetCircleRadius(const QString &value)
|
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.
|
// increase height if needed.
|
||||||
if (formula.length() > 80)
|
if (formula.length() > 80)
|
||||||
{
|
{
|
||||||
|
@ -275,7 +278,7 @@ void DialogPointFromCircleAndTangent::FXCircleRadius()
|
||||||
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
||||||
dialog->setWindowTitle(tr("Edit radius"));
|
dialog->setWindowTitle(tr("Edit radius"));
|
||||||
dialog->SetFormula(GetCircleRadius());
|
dialog->SetFormula(GetCircleRadius());
|
||||||
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
|
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
||||||
if (dialog->exec() == QDialog::Accepted)
|
if (dialog->exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
SetCircleRadius(dialog->GetFormula());
|
SetCircleRadius(dialog->GetFormula());
|
||||||
|
@ -291,7 +294,7 @@ void DialogPointFromCircleAndTangent::EvalCircleRadius()
|
||||||
formulaData.variables = data->DataVariables();
|
formulaData.variables = data->DataVariables();
|
||||||
formulaData.labelEditFormula = ui->labelEditRadius;
|
formulaData.labelEditFormula = ui->labelEditRadius;
|
||||||
formulaData.labelResult = ui->labelResultCircleRadius;
|
formulaData.labelResult = ui->labelResultCircleRadius;
|
||||||
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
|
|
||||||
const qreal radius = Eval(formulaData, flagCircleRadius);
|
const qreal radius = Eval(formulaData, flagCircleRadius);
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,8 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, quint32 toolI
|
||||||
|
|
||||||
ui->lineEditNamePoint->setClearButtonEnabled(true);
|
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->formulaBaseHeight = ui->plainTextEditFormula->height();
|
||||||
ui->plainTextEditFormula->installEventFilter(this);
|
ui->plainTextEditFormula->installEventFilter(this);
|
||||||
|
|
||||||
|
@ -152,7 +153,7 @@ void DialogPointOfContact::FXRadius()
|
||||||
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
||||||
dialog->setWindowTitle(tr("Edit radius"));
|
dialog->setWindowTitle(tr("Edit radius"));
|
||||||
dialog->SetFormula(getRadius());
|
dialog->SetFormula(getRadius());
|
||||||
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
|
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
||||||
if (dialog->exec() == QDialog::Accepted)
|
if (dialog->exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
setRadius(dialog->GetFormula());
|
setRadius(dialog->GetFormula());
|
||||||
|
@ -168,7 +169,7 @@ void DialogPointOfContact::EvalFormula()
|
||||||
formulaData.variables = data->DataVariables();
|
formulaData.variables = data->DataVariables();
|
||||||
formulaData.labelEditFormula = ui->labelEditFormula;
|
formulaData.labelEditFormula = ui->labelEditFormula;
|
||||||
formulaData.labelResult = ui->labelResultCalculation;
|
formulaData.labelResult = ui->labelResultCalculation;
|
||||||
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
|
|
||||||
Eval(formulaData, flagFormula);
|
Eval(formulaData, flagFormula);
|
||||||
}
|
}
|
||||||
|
@ -319,7 +320,8 @@ void DialogPointOfContact::setCenter(quint32 value)
|
||||||
*/
|
*/
|
||||||
void DialogPointOfContact::setRadius(const QString &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.
|
// increase height if needed.
|
||||||
if (radius.length() > 80)
|
if (radius.length() > 80)
|
||||||
{
|
{
|
||||||
|
@ -352,7 +354,8 @@ void DialogPointOfContact::SetPointName(const QString &value)
|
||||||
*/
|
*/
|
||||||
QString DialogPointOfContact::getRadius() const
|
QString DialogPointOfContact::getRadius() const
|
||||||
{
|
{
|
||||||
return qApp->TrVars()->TryFormulaFromUser(radius, qApp->Settings()->GetOsSeparator());
|
return VAbstractApplication::VApp()->TrVars()
|
||||||
|
->TryFormulaFromUser(radius, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -59,7 +59,8 @@ DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, qui
|
||||||
|
|
||||||
ui->lineEditNamePoint->setClearButtonEnabled(true);
|
ui->lineEditNamePoint->setClearButtonEnabled(true);
|
||||||
|
|
||||||
ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
|
ui->lineEditNamePoint->setText(
|
||||||
|
VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
|
||||||
|
|
||||||
InitOkCancelApply(ui);
|
InitOkCancelApply(ui);
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,8 @@ DialogPointOfIntersectionArcs::DialogPointOfIntersectionArcs(const VContainer *d
|
||||||
|
|
||||||
ui->lineEditNamePoint->setClearButtonEnabled(true);
|
ui->lineEditNamePoint->setClearButtonEnabled(true);
|
||||||
|
|
||||||
ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
|
ui->lineEditNamePoint->setText(
|
||||||
|
VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
|
||||||
|
|
||||||
InitOkCancelApply(ui);
|
InitOkCancelApply(ui);
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,8 @@ DialogPointOfIntersectionCircles::DialogPointOfIntersectionCircles(const VContai
|
||||||
|
|
||||||
ui->lineEditNamePoint->setClearButtonEnabled(true);
|
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->formulaBaseHeightCircle1Radius = ui->plainTextEditCircle1Radius->height();
|
||||||
this->formulaBaseHeightCircle2Radius = ui->plainTextEditCircle2Radius->height();
|
this->formulaBaseHeightCircle2Radius = ui->plainTextEditCircle2Radius->height();
|
||||||
|
@ -182,14 +183,16 @@ void DialogPointOfIntersectionCircles::SetSecondCircleCenterId(const quint32 &va
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString DialogPointOfIntersectionCircles::GetFirstCircleRadius() const
|
QString DialogPointOfIntersectionCircles::GetFirstCircleRadius() const
|
||||||
{
|
{
|
||||||
return qApp->TrVars()->TryFormulaFromUser(ui->plainTextEditCircle1Radius->toPlainText(),
|
return VAbstractApplication::VApp()->TrVars()
|
||||||
qApp->Settings()->GetOsSeparator());
|
->TryFormulaFromUser(ui->plainTextEditCircle1Radius->toPlainText(),
|
||||||
|
VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPointOfIntersectionCircles::SetFirstCircleRadius(const QString &value)
|
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.
|
// increase height if needed.
|
||||||
if (formula.length() > 80)
|
if (formula.length() > 80)
|
||||||
{
|
{
|
||||||
|
@ -207,14 +210,16 @@ void DialogPointOfIntersectionCircles::SetFirstCircleRadius(const QString &value
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString DialogPointOfIntersectionCircles::GetSecondCircleRadius() const
|
QString DialogPointOfIntersectionCircles::GetSecondCircleRadius() const
|
||||||
{
|
{
|
||||||
return qApp->TrVars()->TryFormulaFromUser(ui->plainTextEditCircle2Radius->toPlainText(),
|
return VAbstractApplication::VApp()->TrVars()
|
||||||
qApp->Settings()->GetOsSeparator());
|
->TryFormulaFromUser(ui->plainTextEditCircle2Radius->toPlainText(),
|
||||||
|
VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPointOfIntersectionCircles::SetSecondCircleRadius(const QString &value)
|
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.
|
// increase height if needed.
|
||||||
if (formula.length() > 80)
|
if (formula.length() > 80)
|
||||||
{
|
{
|
||||||
|
@ -326,7 +331,7 @@ void DialogPointOfIntersectionCircles::FXCircle1Radius()
|
||||||
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
||||||
dialog->setWindowTitle(tr("Edit first circle radius"));
|
dialog->setWindowTitle(tr("Edit first circle radius"));
|
||||||
dialog->SetFormula(GetFirstCircleRadius());
|
dialog->SetFormula(GetFirstCircleRadius());
|
||||||
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
|
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
||||||
if (dialog->exec() == QDialog::Accepted)
|
if (dialog->exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
SetFirstCircleRadius(dialog->GetFormula());
|
SetFirstCircleRadius(dialog->GetFormula());
|
||||||
|
@ -340,7 +345,7 @@ void DialogPointOfIntersectionCircles::FXCircle2Radius()
|
||||||
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
|
||||||
dialog->setWindowTitle(tr("Edit second circle radius"));
|
dialog->setWindowTitle(tr("Edit second circle radius"));
|
||||||
dialog->SetFormula(GetSecondCircleRadius());
|
dialog->SetFormula(GetSecondCircleRadius());
|
||||||
dialog->setPostfix(UnitsToStr(qApp->patternUnits(), true));
|
dialog->setPostfix(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true));
|
||||||
if (dialog->exec() == QDialog::Accepted)
|
if (dialog->exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
SetSecondCircleRadius(dialog->GetFormula());
|
SetSecondCircleRadius(dialog->GetFormula());
|
||||||
|
@ -356,7 +361,7 @@ void DialogPointOfIntersectionCircles::EvalCircle1Radius()
|
||||||
formulaData.variables = data->DataVariables();
|
formulaData.variables = data->DataVariables();
|
||||||
formulaData.labelEditFormula = ui->labelEditCircle1Radius;
|
formulaData.labelEditFormula = ui->labelEditCircle1Radius;
|
||||||
formulaData.labelResult = ui->labelResultCircle1Radius;
|
formulaData.labelResult = ui->labelResultCircle1Radius;
|
||||||
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
|
|
||||||
const qreal radius = Eval(formulaData, flagCircle1Radius);
|
const qreal radius = Eval(formulaData, flagCircle1Radius);
|
||||||
|
|
||||||
|
@ -379,7 +384,7 @@ void DialogPointOfIntersectionCircles::EvalCircle2Radius()
|
||||||
formulaData.variables = data->DataVariables();
|
formulaData.variables = data->DataVariables();
|
||||||
formulaData.labelEditFormula = ui->labelEditCircle2Radius;
|
formulaData.labelEditFormula = ui->labelEditCircle2Radius;
|
||||||
formulaData.labelResult = ui->labelResultCircle2Radius;
|
formulaData.labelResult = ui->labelResultCircle2Radius;
|
||||||
formulaData.postfix = UnitsToStr(qApp->patternUnits(), true);
|
formulaData.postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
|
||||||
|
|
||||||
const qreal radius = Eval(formulaData, flagCircle2Radius);
|
const qreal radius = Eval(formulaData, flagCircle2Radius);
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ DialogPointOfIntersectionCurves::DialogPointOfIntersectionCurves(const VContaine
|
||||||
|
|
||||||
ui->lineEditNamePoint->setClearButtonEnabled(true);
|
ui->lineEditNamePoint->setClearButtonEnabled(true);
|
||||||
|
|
||||||
ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
|
ui->lineEditNamePoint->setText(VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
|
||||||
|
|
||||||
InitOkCancelApply(ui);
|
InitOkCancelApply(ui);
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ DialogRotation::DialogRotation(const VContainer *data, quint32 toolId, QWidget *
|
||||||
this->formulaBaseHeightAngle = ui->plainTextEditFormula->height();
|
this->formulaBaseHeightAngle = ui->plainTextEditFormula->height();
|
||||||
ui->plainTextEditFormula->installEventFilter(this);
|
ui->plainTextEditFormula->installEventFilter(this);
|
||||||
|
|
||||||
ui->lineEditSuffix->setText(qApp->getCurrentDocument()->GenerateSuffix());
|
ui->lineEditSuffix->setText(VAbstractValApplication::VApp()->getCurrentDocument()->GenerateSuffix());
|
||||||
|
|
||||||
timerAngle->setSingleShot(true);
|
timerAngle->setSingleShot(true);
|
||||||
connect(timerAngle, &QTimer::timeout, this, &DialogRotation::EvalAngle);
|
connect(timerAngle, &QTimer::timeout, this, &DialogRotation::EvalAngle);
|
||||||
|
@ -145,13 +145,15 @@ void DialogRotation::SetOrigPointId(quint32 value)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString DialogRotation::GetAngle() const
|
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)
|
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.
|
// increase height if needed.
|
||||||
if (formulaAngle.length() > 80)
|
if (formulaAngle.length() > 80)
|
||||||
{
|
{
|
||||||
|
@ -234,7 +236,8 @@ void DialogRotation::ShowDialog(bool click)
|
||||||
|
|
||||||
stage1 = false;
|
stage1 = false;
|
||||||
|
|
||||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
VMainGraphicsScene *scene =
|
||||||
|
qobject_cast<VMainGraphicsScene *>(VAbstractValApplication::VApp()->getCurrentScene());
|
||||||
SCASSERT(scene != nullptr)
|
SCASSERT(scene != nullptr)
|
||||||
scene->clearSelection();
|
scene->clearSelection();
|
||||||
|
|
||||||
|
@ -253,7 +256,7 @@ void DialogRotation::ShowDialog(bool click)
|
||||||
scene->ToggleSplineHover(false);
|
scene->ToggleSplineHover(false);
|
||||||
scene->ToggleSplinePathHover(false);
|
scene->ToggleSplinePathHover(false);
|
||||||
|
|
||||||
qApp->getSceneView()->AllowRubberBand(false);
|
VAbstractValApplication::VApp()->getSceneView()->AllowRubberBand(false);
|
||||||
|
|
||||||
FillSourceList();
|
FillSourceList();
|
||||||
|
|
||||||
|
@ -270,7 +273,8 @@ void DialogRotation::ShowDialog(bool click)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*We will ignore click if pointer is in point circle*/
|
/*We will ignore click if pointer is in point circle*/
|
||||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
VMainGraphicsScene *scene =
|
||||||
|
qobject_cast<VMainGraphicsScene *>(VAbstractValApplication::VApp()->getCurrentScene());
|
||||||
SCASSERT(scene != nullptr)
|
SCASSERT(scene != nullptr)
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -278,7 +282,7 @@ void DialogRotation::ShowDialog(bool click)
|
||||||
const QLineF line = QLineF(static_cast<QPointF>(*point), scene->getScenePos());
|
const QLineF line = QLineF(static_cast<QPointF>(*point), scene->getScenePos());
|
||||||
|
|
||||||
//Radius of point circle, but little bigger. Need handle with hover sizes.
|
//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;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -347,7 +351,8 @@ void DialogRotation::ChosenObject(quint32 id, const SceneObject &type)
|
||||||
|
|
||||||
if (SetObject(id, ui->comboBoxOriginPoint, QString()))
|
if (SetObject(id, ui->comboBoxOriginPoint, QString()))
|
||||||
{
|
{
|
||||||
VAbstractMainWindow *window = qobject_cast<VAbstractMainWindow *>(qApp->getMainWindow());
|
VAbstractMainWindow *window =
|
||||||
|
qobject_cast<VAbstractMainWindow *>(VAbstractValApplication::VApp()->getMainWindow());
|
||||||
SCASSERT(window != nullptr)
|
SCASSERT(window != nullptr)
|
||||||
connect(operation, &Visualization::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
|
connect(operation, &Visualization::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user