Calling dialog for creation an expression.
--HG-- branch : feature
This commit is contained in:
parent
ba7a46c4b3
commit
5fa0badfc1
|
@ -41,7 +41,7 @@ DialogAboutTape::DialogAboutTape(QWidget *parent)
|
|||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
//qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||
//mApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||
|
||||
ui->label_Tape_Version->setText(QString("Tape %1").arg(APP_VERSION_STR));
|
||||
ui->labelBuildRevision->setText(tr("Build revision: %1").arg(BUILD_REVISION));
|
||||
|
|
|
@ -38,11 +38,10 @@
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
MApplication::MApplication(int &argc, char **argv)
|
||||
:QApplication(argc, argv),
|
||||
:VAbstractApplication(argc, argv),
|
||||
mainWindows(),
|
||||
localServer(nullptr),
|
||||
trVars(nullptr),
|
||||
settings(nullptr)
|
||||
trVars(nullptr)
|
||||
{
|
||||
setApplicationDisplayName(VER_PRODUCTNAME_STR);
|
||||
setApplicationName(VER_INTERNALNAME_STR);
|
||||
|
@ -138,7 +137,7 @@ void MApplication::InitOptions()
|
|||
qDebug()<<"Command-line arguments:"<<this->arguments();
|
||||
qDebug()<<"Process ID:"<<this->applicationPid();
|
||||
|
||||
const QString checkedLocale = Settings()->GetLocale();
|
||||
const QString checkedLocale = TapeSettings()->GetLocale();
|
||||
qDebug()<<"Checked locale:"<<checkedLocale;
|
||||
|
||||
QTranslator *qtTranslator = new QTranslator(this);
|
||||
|
@ -183,7 +182,7 @@ const VTranslateVars *MApplication::TrVars()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void MApplication::InitTrVars()
|
||||
{
|
||||
trVars = new VTranslateVars(Settings()->GetOsSeparator());
|
||||
trVars = new VTranslateVars(TapeSettings()->GetOsSeparator());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -194,10 +193,10 @@ void MApplication::OpenSettings()
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VTapeSettings *MApplication::Settings()
|
||||
VTapeSettings *MApplication::TapeSettings()
|
||||
{
|
||||
SCASSERT(settings != nullptr);
|
||||
return settings;
|
||||
return qobject_cast<VTapeSettings *>(settings);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -29,11 +29,10 @@
|
|||
#ifndef MAPPLICATION_H
|
||||
#define MAPPLICATION_H
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
#include "../vpatterndb/vtranslatevars.h"
|
||||
#include "../vmisc/def.h"
|
||||
#include "../vmisc/vtapesettings.h"
|
||||
#include "../vmisc/vabstractapplication.h"
|
||||
|
||||
class MApplication;// use in define
|
||||
class TMainWindow;
|
||||
|
@ -42,9 +41,9 @@ class QLocalServer;
|
|||
#if defined(qApp)
|
||||
#undef qApp
|
||||
#endif
|
||||
#define qApp (static_cast<MApplication*>(QApplication::instance()))
|
||||
#define qApp (static_cast<MApplication*>(VAbstractApplication::instance()))
|
||||
|
||||
class MApplication : public QApplication
|
||||
class MApplication : public VAbstractApplication
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -65,14 +64,11 @@ public:
|
|||
virtual const VTranslateVars *TrVars();
|
||||
void InitTrVars();
|
||||
|
||||
void OpenSettings();
|
||||
VTapeSettings *Settings();
|
||||
virtual void OpenSettings() Q_DECL_OVERRIDE;
|
||||
VTapeSettings *TapeSettings();
|
||||
|
||||
QString translationsPath() const;
|
||||
|
||||
template <typename T>
|
||||
QString LocaleToString(const T &value);
|
||||
|
||||
public slots:
|
||||
TMainWindow *NewMainWindow();
|
||||
|
||||
|
@ -86,22 +82,7 @@ private:
|
|||
QLocalServer *localServer;
|
||||
VTranslateVars *trVars;
|
||||
|
||||
/**
|
||||
* @brief settings pointer to settings. Help hide constructor creation settings. Make make code more readable.
|
||||
*/
|
||||
VTapeSettings *settings;
|
||||
|
||||
void Clean();
|
||||
};
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template <typename T>
|
||||
inline QString MApplication::LocaleToString(const T &value)
|
||||
{
|
||||
QLocale loc;
|
||||
qApp->Settings()->GetOsSeparator() ? loc = QLocale::system() : loc = QLocale(QLocale::C);
|
||||
return loc.toString(value);
|
||||
}
|
||||
|
||||
#endif // MAPPLICATION_H
|
||||
|
|
|
@ -141,6 +141,19 @@ CONFIG(debug, debug|release){
|
|||
# Path to recource file.
|
||||
win32:RC_FILE = share/resources/tape.rc
|
||||
|
||||
# When the GNU linker sees a library, it discards all symbols that it doesn't need.
|
||||
# Add dependent library the first.
|
||||
|
||||
#VTools static library (depend on VWidgets, VMisc, VPatternDB)
|
||||
unix|win32: LIBS += -L$$OUT_PWD/../../libs/vtools/$${DESTDIR}/ -lvtools
|
||||
|
||||
INCLUDEPATH += $$PWD/../../libs/vtools
|
||||
INCLUDEPATH += $$OUT_PWD/../../libs/vtools/$${UI_DIR} # For UI files
|
||||
DEPENDPATH += $$PWD/../../libs/vtools
|
||||
|
||||
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vtools/$${DESTDIR}/vtools.lib
|
||||
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vtools/$${DESTDIR}/libvtools.a
|
||||
|
||||
#VWidgets static library
|
||||
unix|win32: LIBS += -L$$OUT_PWD/../../libs/vwidgets/$${DESTDIR}/ -lvwidgets
|
||||
|
||||
|
@ -212,6 +225,14 @@ else:unix: LIBS += -L$${OUT_PWD}/../../libs/qmuparser/$${DESTDIR} -lqmuparser
|
|||
INCLUDEPATH += $${PWD}/../../libs/qmuparser
|
||||
DEPENDPATH += $${PWD}/../../libs/qmuparser
|
||||
|
||||
# VPropertyExplorer library
|
||||
win32:CONFIG(release, debug|release): LIBS += -L$${OUT_PWD}/../../libs/vpropertyexplorer/$${DESTDIR} -lvpropertyexplorer
|
||||
else:win32:CONFIG(debug, debug|release): LIBS += -L$${OUT_PWD}/../../libs/vpropertyexplorer/$${DESTDIR} -lvpropertyexplorer
|
||||
else:unix: LIBS += -L$${OUT_PWD}/../../libs/vpropertyexplorer/$${DESTDIR} -lvpropertyexplorer
|
||||
|
||||
INCLUDEPATH += $${PWD}/../../libs/vpropertyexplorer
|
||||
DEPENDPATH += $${PWD}/../../libs/vpropertyexplorer
|
||||
|
||||
noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols
|
||||
# do nothing
|
||||
} else {
|
||||
|
|
|
@ -28,12 +28,13 @@
|
|||
|
||||
#include "tmainwindow.h"
|
||||
#include "ui_tmainwindow.h"
|
||||
#include "mapplication.h"
|
||||
#include "dialogs/dialogabouttape.h"
|
||||
#include "dialogs/dialognewmeasurements.h"
|
||||
#include "../vpatterndb/calculator.h"
|
||||
#include "../ifc/ifcdef.h"
|
||||
#include "../qmuparser/qmudef.h"
|
||||
#include "../vtools/dialogs/support/dialogeditwrongformula.h"
|
||||
#include "mapplication.h" // Should be last because of definning qApp
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QFileInfo>
|
||||
|
@ -196,11 +197,11 @@ void TMainWindow::FileSaveAs()
|
|||
{
|
||||
if (mType == MeasurementsType::Individual)
|
||||
{
|
||||
dir = qApp->Settings()->GetPathStandardMeasurements() + "/" + fName;
|
||||
dir = qApp->TapeSettings()->GetPathStandardMeasurements() + "/" + fName;
|
||||
}
|
||||
else
|
||||
{
|
||||
dir = qApp->Settings()->GetPathIndividualMeasurements() + "/" + fName;
|
||||
dir = qApp->TapeSettings()->GetPathIndividualMeasurements() + "/" + fName;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -477,6 +478,45 @@ void TMainWindow::MoveDown()
|
|||
Controls(); // Buttons remove, up, down
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void TMainWindow::Fx()
|
||||
{
|
||||
const int row = ui->tableWidget->currentRow();
|
||||
|
||||
if (row == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QTableWidgetItem *nameField = ui->tableWidget->item(row, 0);
|
||||
QSharedPointer<VMeasurement> meash = data->GetVariable<VMeasurement>(nameField->text());
|
||||
|
||||
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(meash->GetData(), NULL_ID, this);
|
||||
dialog->setWindowTitle(tr("Edit measurement"));
|
||||
|
||||
QString text = ui->plainTextEditFormula->toPlainText();
|
||||
text.replace("\n", " ");
|
||||
|
||||
dialog->SetFormula(text);
|
||||
const QString postfix = VDomDocument::UnitsToStr(mUnit, true);//Show unit in dialog lable (cm, mm or inch)
|
||||
dialog->setPostfix(postfix);
|
||||
|
||||
if (dialog->exec() == QDialog::Accepted)
|
||||
{
|
||||
m->SetMValue(nameField->text(), dialog->GetFormula());
|
||||
|
||||
MeasurementsWasSaved(false);
|
||||
|
||||
RefreshData();
|
||||
|
||||
ui->tableWidget->selectRow(row);
|
||||
ui->tableWidget->resizeColumnsToContents();
|
||||
ui->tableWidget->resizeRowsToContents();
|
||||
ui->tableWidget->horizontalHeader()->setStretchLastSection(true);
|
||||
}
|
||||
delete dialog;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void TMainWindow::AddCustom()
|
||||
{
|
||||
|
@ -726,13 +766,13 @@ void TMainWindow::SaveMValue()
|
|||
return;
|
||||
}
|
||||
|
||||
QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), 0);
|
||||
QTableWidgetItem *nameField = ui->tableWidget->item(row, 0);
|
||||
|
||||
// Replace line return character with spaces for calc if exist
|
||||
QString text = ui->plainTextEditFormula->toPlainText();
|
||||
text.replace("\n", " ");
|
||||
|
||||
QTableWidgetItem *formulaField = ui->tableWidget->item(ui->tableWidget->currentRow(), 2);
|
||||
QTableWidgetItem *formulaField = ui->tableWidget->item(row, 2);
|
||||
if (formulaField->text() == text)
|
||||
{
|
||||
return;
|
||||
|
@ -1016,6 +1056,8 @@ void TMainWindow::InitWindow()
|
|||
this->formulaBaseHeight = ui->plainTextEditFormula->height();
|
||||
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &TMainWindow::SaveMValue,
|
||||
Qt::UniqueConnection);
|
||||
|
||||
connect(ui->toolButtonExpr, &QToolButton::clicked, this, &TMainWindow::Fx);
|
||||
}
|
||||
|
||||
ui->actionAddCustom->setEnabled(true);
|
||||
|
|
|
@ -75,6 +75,7 @@ private slots:
|
|||
void Remove();
|
||||
void MoveUp();
|
||||
void MoveDown();
|
||||
void Fx();
|
||||
|
||||
void AddCustom();
|
||||
void AddKnown();
|
||||
|
|
|
@ -484,7 +484,7 @@ void VApplication::InitOptions()
|
|||
qDebug()<<"Command-line arguments:"<<this->arguments();
|
||||
qDebug()<<"Process ID:"<<this->applicationPid();
|
||||
|
||||
const QString checkedLocale = Settings()->GetLocale();
|
||||
const QString checkedLocale = ValentinaSettings()->GetLocale();
|
||||
qDebug()<<"Checked locale:"<<checkedLocale;
|
||||
|
||||
QTranslator *qtTranslator = new QTranslator(this);
|
||||
|
@ -576,7 +576,26 @@ const VTranslateVars *VApplication::TrVars()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VApplication::InitTrVars()
|
||||
{
|
||||
trVars = new VTranslateVars(Settings()->GetOsSeparator());
|
||||
trVars = new VTranslateVars(ValentinaSettings()->GetOsSeparator());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief OpenSettings get acsses to application settings.
|
||||
*
|
||||
* Because we can create object in constructor we open file separately.
|
||||
*/
|
||||
void VApplication::OpenSettings()
|
||||
{
|
||||
settings = new VSettings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
||||
QApplication::applicationName(), this);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VSettings *VApplication::ValentinaSettings()
|
||||
{
|
||||
SCASSERT(settings != nullptr);
|
||||
return qobject_cast<VSettings *>(settings);
|
||||
}
|
||||
|
||||
#if defined(Q_OS_WIN) && defined(Q_CC_GNU)
|
||||
|
|
|
@ -84,6 +84,9 @@ public:
|
|||
void CollectReports() const;
|
||||
#endif // defined(Q_OS_WIN) && defined(Q_CC_GNU)
|
||||
|
||||
virtual void OpenSettings() Q_DECL_OVERRIDE;
|
||||
VSettings *ValentinaSettings();
|
||||
|
||||
private slots:
|
||||
#if defined(Q_OS_WIN) && defined(Q_CC_GNU)
|
||||
void CleanGist() const;
|
||||
|
|
|
@ -93,7 +93,7 @@ ConfigDialog::ConfigDialog(QWidget *parent) :
|
|||
setWindowTitle(tr("Config Dialog"));
|
||||
|
||||
this->setFixedSize(QSize(750, 550));
|
||||
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||
qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -157,7 +157,7 @@ void ConfigDialog::Apply()
|
|||
default:
|
||||
break;
|
||||
}
|
||||
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||
qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||
emit UpdateProperties();
|
||||
setResult(QDialog::Accepted);
|
||||
}
|
||||
|
|
|
@ -57,17 +57,17 @@ CommunityPage::CommunityPage(QWidget *parent):
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void CommunityPage::Apply()
|
||||
{
|
||||
qApp->Settings()->SetServer(this->server->text());
|
||||
qApp->Settings()->SetServerSecure(this->secureComm->isChecked());
|
||||
qApp->Settings()->SetProxy(this->useProxy->isChecked());
|
||||
qApp->Settings()->SetProxyAddress(this->proxyAddress->text());
|
||||
qApp->Settings()->SetProxyPort(this->proxyPort->text());
|
||||
qApp->Settings()->SetProxyUser(this->proxyUser->text());
|
||||
qApp->Settings()->SetProxyPass(this->proxyPass->text());
|
||||
qApp->ValentinaSettings()->SetServer(this->server->text());
|
||||
qApp->ValentinaSettings()->SetServerSecure(this->secureComm->isChecked());
|
||||
qApp->ValentinaSettings()->SetProxy(this->useProxy->isChecked());
|
||||
qApp->ValentinaSettings()->SetProxyAddress(this->proxyAddress->text());
|
||||
qApp->ValentinaSettings()->SetProxyPort(this->proxyPort->text());
|
||||
qApp->ValentinaSettings()->SetProxyUser(this->proxyUser->text());
|
||||
qApp->ValentinaSettings()->SetProxyPass(this->proxyPass->text());
|
||||
|
||||
qApp->Settings()->SetUsername(this->username->text());
|
||||
qApp->Settings()->SetSavePassword(this->savePassword->isChecked());
|
||||
qApp->Settings()->SetUserPassword(this->userpassword->text());
|
||||
qApp->ValentinaSettings()->SetUsername(this->username->text());
|
||||
qApp->ValentinaSettings()->SetSavePassword(this->savePassword->isChecked());
|
||||
qApp->ValentinaSettings()->SetUserPassword(this->userpassword->text());
|
||||
|
||||
}
|
||||
|
||||
|
@ -102,9 +102,9 @@ QGroupBox *CommunityPage::ServerGroup()
|
|||
QGroupBox *ServerGroup = new QGroupBox(tr("Server"));
|
||||
QFormLayout *serverLayout = new QFormLayout;
|
||||
|
||||
CommunityPage::add_lineedit(&this->server, serverLayout, qApp->Settings()->GetServer(), tr("Server name/IP"));
|
||||
CommunityPage::add_lineedit(&this->server, serverLayout, qApp->ValentinaSettings()->GetServer(), tr("Server name/IP"));
|
||||
|
||||
CommunityPage::add_checkbox(&this->secureComm, serverLayout, qApp->Settings()->GetServerSecure(),
|
||||
CommunityPage::add_checkbox(&this->secureComm, serverLayout, qApp->ValentinaSettings()->GetServerSecure(),
|
||||
tr("Secure connection"));
|
||||
|
||||
ServerGroup->setLayout(serverLayout);
|
||||
|
@ -136,12 +136,12 @@ QGroupBox *CommunityPage::ProxyGroup()
|
|||
|
||||
QFormLayout *proxyLayout = new QFormLayout;
|
||||
|
||||
CommunityPage::add_checkbox(&this->useProxy, proxyLayout, qApp->Settings()->GetProxy(), tr("Use Proxy"));
|
||||
CommunityPage::add_lineedit(&this->proxyAddress, proxyLayout, qApp->Settings()->GetProxyAddress(),
|
||||
CommunityPage::add_checkbox(&this->useProxy, proxyLayout, qApp->ValentinaSettings()->GetProxy(), tr("Use Proxy"));
|
||||
CommunityPage::add_lineedit(&this->proxyAddress, proxyLayout, qApp->ValentinaSettings()->GetProxyAddress(),
|
||||
tr("Proxy address"));
|
||||
CommunityPage::add_lineedit(&this->proxyPort, proxyLayout, qApp->Settings()->GetProxyPort(), tr("Proxy port"));
|
||||
CommunityPage::add_lineedit(&this->proxyUser, proxyLayout, qApp->Settings()->GetProxyUser(), tr("Proxy user"));
|
||||
CommunityPage::add_lineedit(&this->proxyPass, proxyLayout, qApp->Settings()->GetProxyPass(), tr("Proxy pass"));
|
||||
CommunityPage::add_lineedit(&this->proxyPort, proxyLayout, qApp->ValentinaSettings()->GetProxyPort(), tr("Proxy port"));
|
||||
CommunityPage::add_lineedit(&this->proxyUser, proxyLayout, qApp->ValentinaSettings()->GetProxyUser(), tr("Proxy user"));
|
||||
CommunityPage::add_lineedit(&this->proxyPass, proxyLayout, qApp->ValentinaSettings()->GetProxyPass(), tr("Proxy pass"));
|
||||
connect(this->useProxy, &QCheckBox::stateChanged, this, &CommunityPage::ProxyCheckChanged);
|
||||
this->ProxyCheckChanged();
|
||||
|
||||
|
@ -156,10 +156,10 @@ QGroupBox *CommunityPage::UserGroup()
|
|||
QGroupBox *userGroup = new QGroupBox(tr("User settings"));
|
||||
QFormLayout *userLayout = new QFormLayout;
|
||||
|
||||
CommunityPage::add_lineedit(&this->username, userLayout, qApp->Settings()->GetUsername(), tr("User Name"));
|
||||
CommunityPage::add_checkbox(&this->savePassword, userLayout, qApp->Settings()->GetSavePassword(),
|
||||
CommunityPage::add_lineedit(&this->username, userLayout, qApp->ValentinaSettings()->GetUsername(), tr("User Name"));
|
||||
CommunityPage::add_checkbox(&this->savePassword, userLayout, qApp->ValentinaSettings()->GetSavePassword(),
|
||||
tr("Save password"));
|
||||
CommunityPage::add_lineedit(&this->userpassword, userLayout, qApp->Settings()->GetUserPassword(),
|
||||
CommunityPage::add_lineedit(&this->userpassword, userLayout, qApp->ValentinaSettings()->GetUserPassword(),
|
||||
tr("Password"));
|
||||
|
||||
connect(this->savePassword, &QCheckBox::stateChanged, this, &CommunityPage::PasswordCheckChanged);
|
||||
|
|
|
@ -67,23 +67,23 @@ ConfigurationPage::ConfigurationPage(QWidget *parent)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void ConfigurationPage::Apply()
|
||||
{
|
||||
qApp->Settings()->SetAutosaveState(autoSaveCheck->isChecked());
|
||||
qApp->Settings()->SetAutosaveTime(autoTime->value());
|
||||
qApp->ValentinaSettings()->SetAutosaveState(autoSaveCheck->isChecked());
|
||||
qApp->ValentinaSettings()->SetAutosaveTime(autoTime->value());
|
||||
|
||||
QTimer *autoSaveTimer = qApp->getAutoSaveTimer();
|
||||
SCASSERT(autoSaveTimer);
|
||||
|
||||
autoSaveCheck->isChecked() ? autoSaveTimer->start(autoTime->value()*60000) : autoSaveTimer->stop();
|
||||
|
||||
qApp->Settings()->SetOsSeparator(osOptionCheck->isChecked());
|
||||
qApp->Settings()->SetSendReportState(sendReportCheck->isChecked());
|
||||
qApp->Settings()->SetConfirmItemDelete(askPointDeletionCheck->isChecked());
|
||||
qApp->Settings()->SetToolBarStyle(toolBarStyleCheck->isChecked());
|
||||
qApp->ValentinaSettings()->SetOsSeparator(osOptionCheck->isChecked());
|
||||
qApp->ValentinaSettings()->SetSendReportState(sendReportCheck->isChecked());
|
||||
qApp->ValentinaSettings()->SetConfirmItemDelete(askPointDeletionCheck->isChecked());
|
||||
qApp->ValentinaSettings()->SetToolBarStyle(toolBarStyleCheck->isChecked());
|
||||
|
||||
if (langChanged)
|
||||
{
|
||||
const QString locale = qvariant_cast<QString>(langCombo->itemData(langCombo->currentIndex()));
|
||||
qApp->Settings()->SetLocale(locale);
|
||||
qApp->ValentinaSettings()->SetLocale(locale);
|
||||
langChanged = false;
|
||||
const QString text = tr("Setup user interface language updated and will be used the next time start") + " " +
|
||||
QApplication::applicationName();
|
||||
|
@ -92,7 +92,7 @@ void ConfigurationPage::Apply()
|
|||
if (this->unitChanged)
|
||||
{
|
||||
const QString unit = qvariant_cast<QString>(this->unitCombo->itemData(this->unitCombo->currentIndex()));
|
||||
qApp->Settings()->SetUnit(unit);
|
||||
qApp->ValentinaSettings()->SetUnit(unit);
|
||||
this->unitChanged = false;
|
||||
const QString text = tr("Default unit updated and will be used the next pattern creation");
|
||||
QMessageBox::information(this, QApplication::applicationName(), text);
|
||||
|
@ -100,7 +100,7 @@ void ConfigurationPage::Apply()
|
|||
if (labelLangChanged)
|
||||
{
|
||||
const QString locale = qvariant_cast<QString>(labelCombo->itemData(labelCombo->currentIndex()));
|
||||
qApp->Settings()->SetLabelLanguage(locale);
|
||||
qApp->ValentinaSettings()->SetLabelLanguage(locale);
|
||||
labelLangChanged = false;
|
||||
}
|
||||
}
|
||||
|
@ -129,11 +129,11 @@ QGroupBox *ConfigurationPage::SaveGroup()
|
|||
QGroupBox *saveGroup = new QGroupBox(tr("Save"));
|
||||
|
||||
autoSaveCheck = new QCheckBox(tr("Auto-save modified pattern"));
|
||||
autoSaveCheck->setChecked(qApp->Settings()->GetAutosaveState());
|
||||
autoSaveCheck->setChecked(qApp->ValentinaSettings()->GetAutosaveState());
|
||||
|
||||
autoTime = new QSpinBox();
|
||||
autoTime->setRange(1, 60);
|
||||
autoTime->setValue(qApp->Settings()->GetAutosaveTime());
|
||||
autoTime->setValue(qApp->ValentinaSettings()->GetAutosaveTime());
|
||||
autoTime->setSuffix(tr("min"));
|
||||
|
||||
QHBoxLayout *autosaveLayout = new QHBoxLayout;
|
||||
|
@ -181,7 +181,7 @@ QGroupBox *ConfigurationPage::LangGroup()
|
|||
}
|
||||
|
||||
// set default translators and language checked
|
||||
qint32 index = langCombo->findData(qApp->Settings()->GetLocale());
|
||||
qint32 index = langCombo->findData(qApp->ValentinaSettings()->GetLocale());
|
||||
if (index != -1)
|
||||
{
|
||||
langCombo->setCurrentIndex(index);
|
||||
|
@ -197,7 +197,7 @@ QGroupBox *ConfigurationPage::LangGroup()
|
|||
QLabel *separatorLabel = new QLabel(tr("Decimal separator parts"));
|
||||
|
||||
osOptionCheck = new QCheckBox(tr("With OS options (%1)").arg(QLocale::system().decimalPoint().toLatin1()));
|
||||
osOptionCheck->setChecked(qApp->Settings()->GetOsSeparator());
|
||||
osOptionCheck->setChecked(qApp->ValentinaSettings()->GetOsSeparator());
|
||||
|
||||
QHBoxLayout *separatorLayout = new QHBoxLayout;
|
||||
separatorLayout->addWidget(separatorLabel);
|
||||
|
@ -212,7 +212,7 @@ QGroupBox *ConfigurationPage::LangGroup()
|
|||
this->unitCombo->addItem(tr("Inches"), "in");
|
||||
|
||||
// set default unit
|
||||
qint32 indexUnit = this->unitCombo->findData(qApp->Settings()->GetUnit());
|
||||
qint32 indexUnit = this->unitCombo->findData(qApp->ValentinaSettings()->GetUnit());
|
||||
if (indexUnit != -1)
|
||||
{
|
||||
this->unitCombo->setCurrentIndex(indexUnit);
|
||||
|
@ -231,7 +231,7 @@ QGroupBox *ConfigurationPage::LangGroup()
|
|||
|
||||
SetLabelComboBox(VApplication::LabelLanguages());
|
||||
|
||||
index = labelCombo->findData(qApp->Settings()->GetLabelLanguage());
|
||||
index = labelCombo->findData(qApp->ValentinaSettings()->GetLabelLanguage());
|
||||
if (index != -1)
|
||||
{
|
||||
labelCombo->setCurrentIndex(index);
|
||||
|
@ -261,7 +261,7 @@ QGroupBox *ConfigurationPage::SendGroup()
|
|||
QGroupBox *sendGroup = new QGroupBox(tr("Send crash reports"));
|
||||
|
||||
sendReportCheck = new QCheckBox(tr("Send crash reports (recommended)"));
|
||||
sendReportCheck->setChecked(qApp->Settings()->GetSendReportState());
|
||||
sendReportCheck->setChecked(qApp->ValentinaSettings()->GetSendReportState());
|
||||
|
||||
QLabel *description = new QLabel(tr("After each crash Valentina collect information that may help us fix a "
|
||||
"problem. We do not collect any personal information. Find more about what "
|
||||
|
@ -286,7 +286,7 @@ QGroupBox *ConfigurationPage::DrawGroup()
|
|||
QGroupBox *drawGroup = new QGroupBox(tr("Pattern Editing"));
|
||||
|
||||
askPointDeletionCheck = new QCheckBox(tr("Confirm item deletion"));
|
||||
askPointDeletionCheck->setChecked(qApp->Settings()->GetConfirmItemDelete());
|
||||
askPointDeletionCheck->setChecked(qApp->ValentinaSettings()->GetConfirmItemDelete());
|
||||
|
||||
QVBoxLayout *editLayout = new QVBoxLayout;
|
||||
editLayout->addWidget(askPointDeletionCheck);
|
||||
|
@ -301,7 +301,7 @@ QGroupBox *ConfigurationPage::ToolBarGroup()
|
|||
QGroupBox *toolBarGroup = new QGroupBox(tr("Toolbar"));
|
||||
|
||||
toolBarStyleCheck = new QCheckBox(tr("The text appears under the icon. (recommended for beginners.)"));
|
||||
toolBarStyleCheck->setChecked(qApp->Settings()->GetToolBarStyle());
|
||||
toolBarStyleCheck->setChecked(qApp->ValentinaSettings()->GetToolBarStyle());
|
||||
|
||||
QVBoxLayout *editLayout = new QVBoxLayout;
|
||||
editLayout->addWidget(toolBarStyleCheck);
|
||||
|
|
|
@ -62,10 +62,10 @@ PathPage::PathPage(QWidget *parent)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void PathPage::Apply()
|
||||
{
|
||||
qApp->Settings()->SetPathIndividualMeasurements(pathTable->item(0, 1)->text());
|
||||
qApp->Settings()->SetPathStandardMeasurements(pathTable->item(1, 1)->text());
|
||||
qApp->Settings()->SetPathPattern(pathTable->item(2, 1)->text());
|
||||
qApp->Settings()->SetPathLayout(pathTable->item(3, 1)->text());
|
||||
qApp->ValentinaSettings()->SetPathIndividualMeasurements(pathTable->item(0, 1)->text());
|
||||
qApp->ValentinaSettings()->SetPathStandardMeasurements(pathTable->item(1, 1)->text());
|
||||
qApp->ValentinaSettings()->SetPathPattern(pathTable->item(2, 1)->text());
|
||||
qApp->ValentinaSettings()->SetPathLayout(pathTable->item(3, 1)->text());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -88,8 +88,8 @@ void PathPage::DefaultPath()
|
|||
switch (row)
|
||||
{
|
||||
case 1: // standard measurements
|
||||
item->setText(qApp->Settings()->StandardTablesPath());
|
||||
item->setToolTip(qApp->Settings()->StandardTablesPath());
|
||||
item->setText(qApp->ValentinaSettings()->StandardTablesPath());
|
||||
item->setToolTip(qApp->ValentinaSettings()->StandardTablesPath());
|
||||
break;
|
||||
case 0: // individual measurements
|
||||
case 2: // pattern path
|
||||
|
@ -113,16 +113,16 @@ void PathPage::EditPath()
|
|||
switch (row)
|
||||
{
|
||||
case 0: // individual measurements
|
||||
path = qApp->Settings()->GetPathIndividualMeasurements();
|
||||
path = qApp->ValentinaSettings()->GetPathIndividualMeasurements();
|
||||
break;
|
||||
case 1: // standard measurements
|
||||
path = qApp->Settings()->GetPathStandardMeasurements();
|
||||
path = qApp->ValentinaSettings()->GetPathStandardMeasurements();
|
||||
break;
|
||||
case 2: // pattern path
|
||||
path = qApp->Settings()->GetPathPattern();
|
||||
path = qApp->ValentinaSettings()->GetPathPattern();
|
||||
break;
|
||||
case 3: // layout path
|
||||
path = qApp->Settings()->GetPathLayout();
|
||||
path = qApp->ValentinaSettings()->GetPathLayout();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -182,29 +182,29 @@ void PathPage::InitTable()
|
|||
|
||||
{
|
||||
pathTable->setItem(0, 0, new QTableWidgetItem(tr("Individual measurements")));
|
||||
QTableWidgetItem *item = new QTableWidgetItem(qApp->Settings()->GetPathIndividualMeasurements());
|
||||
item->setToolTip(qApp->Settings()->GetPathIndividualMeasurements());
|
||||
QTableWidgetItem *item = new QTableWidgetItem(qApp->ValentinaSettings()->GetPathIndividualMeasurements());
|
||||
item->setToolTip(qApp->ValentinaSettings()->GetPathIndividualMeasurements());
|
||||
pathTable->setItem(0, 1, item);
|
||||
}
|
||||
|
||||
{
|
||||
pathTable->setItem(1, 0, new QTableWidgetItem(tr("Standard measurements")));
|
||||
QTableWidgetItem *item = new QTableWidgetItem(qApp->Settings()->GetPathStandardMeasurements());
|
||||
item->setToolTip(qApp->Settings()->GetPathStandardMeasurements());
|
||||
QTableWidgetItem *item = new QTableWidgetItem(qApp->ValentinaSettings()->GetPathStandardMeasurements());
|
||||
item->setToolTip(qApp->ValentinaSettings()->GetPathStandardMeasurements());
|
||||
pathTable->setItem(1, 1, item);
|
||||
}
|
||||
|
||||
{
|
||||
pathTable->setItem(2, 0, new QTableWidgetItem(tr("Patterns")));
|
||||
QTableWidgetItem *item = new QTableWidgetItem(qApp->Settings()->GetPathPattern());
|
||||
item->setToolTip(qApp->Settings()->GetPathPattern());
|
||||
QTableWidgetItem *item = new QTableWidgetItem(qApp->ValentinaSettings()->GetPathPattern());
|
||||
item->setToolTip(qApp->ValentinaSettings()->GetPathPattern());
|
||||
pathTable->setItem(2, 1, item);
|
||||
}
|
||||
|
||||
{
|
||||
pathTable->setItem(3, 0, new QTableWidgetItem(tr("Layout")));
|
||||
QTableWidgetItem *item = new QTableWidgetItem(qApp->Settings()->GetPathLayout());
|
||||
item->setToolTip(qApp->Settings()->GetPathLayout());
|
||||
QTableWidgetItem *item = new QTableWidgetItem(qApp->ValentinaSettings()->GetPathLayout());
|
||||
item->setToolTip(qApp->ValentinaSettings()->GetPathLayout());
|
||||
pathTable->setItem(3, 1, item);
|
||||
}
|
||||
|
||||
|
|
|
@ -58,17 +58,17 @@ PatternPage::PatternPage(QWidget *parent):
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void PatternPage::Apply()
|
||||
{
|
||||
qApp->Settings()->SetUser(userName->text());
|
||||
qApp->ValentinaSettings()->SetUser(userName->text());
|
||||
|
||||
// Scene antialiasing
|
||||
qApp->Settings()->SetGraphicalOutput(graphOutputCheck->isChecked());
|
||||
qApp->ValentinaSettings()->SetGraphicalOutput(graphOutputCheck->isChecked());
|
||||
qApp->getSceneView()->setRenderHint(QPainter::Antialiasing, graphOutputCheck->isChecked());
|
||||
qApp->getSceneView()->setRenderHint(QPainter::SmoothPixmapTransform, graphOutputCheck->isChecked());
|
||||
|
||||
/* Maximum number of commands in undo stack may only be set when the undo stack is empty, since setting it on a
|
||||
* non-empty stack might delete the command at the current index. Calling setUndoLimit() on a non-empty stack
|
||||
* prints a warning and does nothing.*/
|
||||
qApp->Settings()->SetUndoCount(undoCount->value());
|
||||
qApp->ValentinaSettings()->SetUndoCount(undoCount->value());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -78,7 +78,7 @@ QGroupBox *PatternPage::UserGroup()
|
|||
QLabel *nameLabel = new QLabel(tr("User name"));
|
||||
|
||||
userName = new QLineEdit;
|
||||
userName->setText(qApp->Settings()->GetUser());
|
||||
userName->setText(qApp->ValentinaSettings()->GetUser());
|
||||
|
||||
QHBoxLayout *nameLayout = new QHBoxLayout;
|
||||
nameLayout->addWidget(nameLabel);
|
||||
|
@ -96,7 +96,7 @@ QGroupBox *PatternPage::GraphOutputGroup()
|
|||
QGroupBox *graphOutputGroup = new QGroupBox(tr("Graphical output"));
|
||||
|
||||
graphOutputCheck = new QCheckBox(tr("Use antialiasing"));
|
||||
graphOutputCheck->setChecked(qApp->Settings()->GetGraphicalOutput());
|
||||
graphOutputCheck->setChecked(qApp->ValentinaSettings()->GetGraphicalOutput());
|
||||
|
||||
QHBoxLayout *graphLayout = new QHBoxLayout;
|
||||
graphLayout->addWidget(graphOutputCheck);
|
||||
|
@ -114,7 +114,7 @@ QGroupBox *PatternPage::UndoGroup()
|
|||
QLabel *undoLabel = new QLabel(tr("Count steps (0 - no limit)"));
|
||||
undoCount = new QSpinBox;
|
||||
undoCount->setMinimum(0);
|
||||
undoCount->setValue(qApp->Settings()->GetUndoCount());
|
||||
undoCount->setValue(qApp->ValentinaSettings()->GetUndoCount());
|
||||
|
||||
QHBoxLayout *countLayout = new QHBoxLayout;
|
||||
countLayout->addWidget(undoLabel);
|
||||
|
|
|
@ -42,7 +42,7 @@ DialogAboutApp::DialogAboutApp(QWidget *parent) :
|
|||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||
qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||
|
||||
ui->label_Valentina_Version->setText(QString("Valentina %1").arg(APP_VERSION_STR));
|
||||
ui->labelBuildRevision->setText(QString("Build revision: %1").arg(BUILD_REVISION));
|
||||
|
|
|
@ -47,7 +47,7 @@ DialogIndividualMeasurements::DialogIndividualMeasurements(VContainer *data, con
|
|||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||
qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||
|
||||
QRect position = this->frameGeometry();
|
||||
position.moveCenter(QDesktopWidget().availableGeometry().center());
|
||||
|
@ -203,7 +203,7 @@ void DialogIndividualMeasurements::CheckState()
|
|||
void DialogIndividualMeasurements::OpenTable()
|
||||
{
|
||||
const QString filter(tr("Individual measurements (*.vit)"));
|
||||
const QString path = qApp->Settings()->GetPathIndividualMeasurements();
|
||||
const QString path = qApp->ValentinaSettings()->GetPathIndividualMeasurements();
|
||||
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter);
|
||||
if (fileName.isEmpty())
|
||||
|
@ -232,7 +232,7 @@ void DialogIndividualMeasurements::OpenTable()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogIndividualMeasurements::NewTable()
|
||||
{
|
||||
const QString dir = qApp->Settings()->GetPathIndividualMeasurements()+"/measurements.vit";
|
||||
const QString dir = qApp->ValentinaSettings()->GetPathIndividualMeasurements()+"/measurements.vit";
|
||||
QString name = QFileDialog::getSaveFileName(this, tr("Where save measurements?"), dir,
|
||||
tr("Individual measurements (*.vit)"));
|
||||
|
||||
|
@ -260,7 +260,7 @@ void DialogIndividualMeasurements::InitUnits()
|
|||
ui->comboBoxUnits->addItem(tr("Inches"), QVariant(VDomDocument::UnitsToStr(Unit::Inch)));
|
||||
|
||||
// set default unit
|
||||
const qint32 indexUnit = ui->comboBoxUnits->findData(qApp->Settings()->GetUnit());
|
||||
const qint32 indexUnit = ui->comboBoxUnits->findData(qApp->ValentinaSettings()->GetUnit());
|
||||
if (indexUnit != -1)
|
||||
{
|
||||
ui->comboBoxUnits->setCurrentIndex(indexUnit);
|
||||
|
|
|
@ -41,7 +41,7 @@ DialogLayoutProgress::DialogLayoutProgress(int count, QWidget *parent)
|
|||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||
qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||
|
||||
ui->progressBar->setMaximum(maxCount);
|
||||
ui->progressBar->setValue(0);
|
||||
|
|
|
@ -52,7 +52,7 @@ DialogLayoutSettings::DialogLayoutSettings(VLayoutGenerator *generator, QWidget
|
|||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||
qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||
|
||||
ReadSettings();
|
||||
|
||||
|
@ -363,8 +363,8 @@ void DialogLayoutSettings::InitPaperUnits()
|
|||
ui->comboBoxPaperSizeUnit->addItem(tr("Pixels"), QVariant(VDomDocument::UnitsToStr(Unit::Px)));
|
||||
|
||||
// set default unit
|
||||
oldPaperUnit = VDomDocument::StrToUnits(qApp->Settings()->GetUnit());
|
||||
const qint32 indexUnit = ui->comboBoxPaperSizeUnit->findData(qApp->Settings()->GetUnit());
|
||||
oldPaperUnit = VDomDocument::StrToUnits(qApp->ValentinaSettings()->GetUnit());
|
||||
const qint32 indexUnit = ui->comboBoxPaperSizeUnit->findData(qApp->ValentinaSettings()->GetUnit());
|
||||
if (indexUnit != -1)
|
||||
{
|
||||
ui->comboBoxPaperSizeUnit->setCurrentIndex(indexUnit);
|
||||
|
@ -379,8 +379,8 @@ void DialogLayoutSettings::InitLayoutUnits()
|
|||
ui->comboBoxLayoutUnit->addItem(tr("Inches"), QVariant(VDomDocument::UnitsToStr(Unit::Inch)));
|
||||
|
||||
// set default unit
|
||||
oldLayoutUnit = VDomDocument::StrToUnits(qApp->Settings()->GetUnit());
|
||||
const qint32 indexUnit = ui->comboBoxLayoutUnit->findData(qApp->Settings()->GetUnit());
|
||||
oldLayoutUnit = VDomDocument::StrToUnits(qApp->ValentinaSettings()->GetUnit());
|
||||
const qint32 indexUnit = ui->comboBoxLayoutUnit->findData(qApp->ValentinaSettings()->GetUnit());
|
||||
if (indexUnit != -1)
|
||||
{
|
||||
ui->comboBoxLayoutUnit->setCurrentIndex(indexUnit);
|
||||
|
@ -611,33 +611,33 @@ void DialogLayoutSettings::ReadSettings()
|
|||
MinimumPaperSize();
|
||||
MinimumLayoutSize();
|
||||
|
||||
SetLayoutWidth(qApp->Settings()->GetLayoutWidth());
|
||||
SetShift(qApp->Settings()->GetLayoutShift());
|
||||
SetLayoutWidth(qApp->ValentinaSettings()->GetLayoutWidth());
|
||||
SetShift(qApp->ValentinaSettings()->GetLayoutShift());
|
||||
|
||||
const qreal width = UnitConvertor(qApp->Settings()->GetLayoutPaperWidth(), Unit::Px, LayoutUnit());
|
||||
const qreal height = UnitConvertor(qApp->Settings()->GetLayoutPaperHeight(), Unit::Px, LayoutUnit());
|
||||
const qreal width = UnitConvertor(qApp->ValentinaSettings()->GetLayoutPaperWidth(), Unit::Px, LayoutUnit());
|
||||
const qreal height = UnitConvertor(qApp->ValentinaSettings()->GetLayoutPaperHeight(), Unit::Px, LayoutUnit());
|
||||
SheetSize(QSizeF(width, height));
|
||||
SetGroup(qApp->Settings()->GetLayoutGroup());
|
||||
SetRotate(qApp->Settings()->GetLayoutRotate());
|
||||
SetIncrease(qApp->Settings()->GetLayoutRotationIncrease());
|
||||
SetAutoCrop(qApp->Settings()->GetLayoutAutoCrop());
|
||||
SetSaveLength(qApp->Settings()->GetLayoutSaveLength());
|
||||
SetUnitePages(qApp->Settings()->GetLayoutUnitePages());
|
||||
SetGroup(qApp->ValentinaSettings()->GetLayoutGroup());
|
||||
SetRotate(qApp->ValentinaSettings()->GetLayoutRotate());
|
||||
SetIncrease(qApp->ValentinaSettings()->GetLayoutRotationIncrease());
|
||||
SetAutoCrop(qApp->ValentinaSettings()->GetLayoutAutoCrop());
|
||||
SetSaveLength(qApp->ValentinaSettings()->GetLayoutSaveLength());
|
||||
SetUnitePages(qApp->ValentinaSettings()->GetLayoutUnitePages());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogLayoutSettings::WriteSettings() const
|
||||
{
|
||||
qApp->Settings()->SetLayoutWidth(GetLayoutWidth());
|
||||
qApp->Settings()->SetLayoutGroup(GetGroup());
|
||||
qApp->Settings()->SetLayoutPaperHeight(GetPaperHeight());
|
||||
qApp->Settings()->SetLayoutPaperWidth(GetPaperWidth());
|
||||
qApp->Settings()->SetLayoutShift(GetShift());
|
||||
qApp->Settings()->SetLayoutRotate(GetRotate());
|
||||
qApp->Settings()->SetLayoutRotationIncrease(GetIncrease());
|
||||
qApp->Settings()->SetLayoutAutoCrop(GetAutoCrop());
|
||||
qApp->Settings()->SetLayoutSaveLength(IsSaveLength());
|
||||
qApp->Settings()->SetLayoutUnitePages(IsUnitePages());
|
||||
qApp->ValentinaSettings()->SetLayoutWidth(GetLayoutWidth());
|
||||
qApp->ValentinaSettings()->SetLayoutGroup(GetGroup());
|
||||
qApp->ValentinaSettings()->SetLayoutPaperHeight(GetPaperHeight());
|
||||
qApp->ValentinaSettings()->SetLayoutPaperWidth(GetPaperWidth());
|
||||
qApp->ValentinaSettings()->SetLayoutShift(GetShift());
|
||||
qApp->ValentinaSettings()->SetLayoutRotate(GetRotate());
|
||||
qApp->ValentinaSettings()->SetLayoutRotationIncrease(GetIncrease());
|
||||
qApp->ValentinaSettings()->SetLayoutAutoCrop(GetAutoCrop());
|
||||
qApp->ValentinaSettings()->SetLayoutSaveLength(IsSaveLength());
|
||||
qApp->ValentinaSettings()->SetLayoutUnitePages(IsUnitePages());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -36,7 +36,7 @@ DialogMeasurements::DialogMeasurements(QWidget *parent) :
|
|||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||
qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||
|
||||
connect(ui->toolButtonStandard, &QToolButton::clicked, this, &DialogMeasurements::StandardMeasurements);
|
||||
connect(ui->toolButtonIndividual, &QToolButton::clicked, this, &DialogMeasurements::IndividualMeasurements);
|
||||
|
|
|
@ -45,7 +45,7 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, QWidget *parent)
|
|||
|
||||
SCASSERT(doc != nullptr);
|
||||
|
||||
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||
qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||
|
||||
ui->lineEditAuthor->setText(doc->GetAuthor());
|
||||
connect(ui->lineEditAuthor, &QLineEdit::editingFinished, this, &DialogPatternProperties::DescEdited);
|
||||
|
|
|
@ -46,7 +46,7 @@ DialogPatternXmlEdit::DialogPatternXmlEdit(QWidget *parent, VPattern *xmldoc)
|
|||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||
qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||
|
||||
this->xmlmodel = new VXMLTreeView();
|
||||
this->doc=xmldoc;
|
||||
|
|
|
@ -43,7 +43,7 @@ DialogSaveLayout::DialogSaveLayout(const QMap<QString, QString> &formates, int c
|
|||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||
qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||
|
||||
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||
SCASSERT(bOk != nullptr);
|
||||
|
@ -67,7 +67,7 @@ DialogSaveLayout::DialogSaveLayout(const QMap<QString, QString> &formates, int c
|
|||
connect(ui->pushButtonBrowse, &QPushButton::clicked, this, &DialogSaveLayout::Browse);
|
||||
connect(ui->lineEditPath, &QLineEdit::textChanged, this, &DialogSaveLayout::PathChanged);
|
||||
|
||||
ui->lineEditPath->setText(qApp->Settings()->GetPathLayout());
|
||||
ui->lineEditPath->setText(qApp->ValentinaSettings()->GetPathLayout());
|
||||
ShowExample();//Show example for current format.
|
||||
|
||||
adjustSize();
|
||||
|
|
|
@ -47,7 +47,7 @@ DialogStandardMeasurements::DialogStandardMeasurements(VContainer *data, const Q
|
|||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||
qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||
|
||||
QRect position = this->frameGeometry();
|
||||
position.moveCenter(QDesktopWidget().availableGeometry().center());
|
||||
|
@ -157,7 +157,7 @@ void DialogStandardMeasurements::LoadStandardTables()
|
|||
qCDebug(vStMeasur, "Loading standard table.");
|
||||
QStringList filters{"*.vst"};
|
||||
//Use standard path to standard measurements
|
||||
const QString path = qApp->Settings()->GetPathStandardMeasurements();
|
||||
const QString path = qApp->ValentinaSettings()->GetPathStandardMeasurements();
|
||||
QDir tablesDir(path);
|
||||
tablesDir.setNameFilters(filters);
|
||||
tablesDir.setCurrent(path);
|
||||
|
|
|
@ -1539,7 +1539,7 @@ bool MainWindow::SaveAs()
|
|||
QString dir;
|
||||
if (curFile.isEmpty())
|
||||
{
|
||||
dir = qApp->Settings()->GetPathPattern() + "/" + tr("pattern") + ".val";
|
||||
dir = qApp->ValentinaSettings()->GetPathPattern() + "/" + tr("pattern") + ".val";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1572,9 +1572,9 @@ bool MainWindow::SaveAs()
|
|||
if (oldFileName != curFile)
|
||||
{// Now we have new file name after save as.
|
||||
// But still have previous name in restore list. We should delete them.
|
||||
QStringList restoreFiles = qApp->Settings()->GetRestoreFileList();
|
||||
QStringList restoreFiles = qApp->ValentinaSettings()->GetRestoreFileList();
|
||||
restoreFiles.removeAll(oldFileName);
|
||||
qApp->Settings()->SetRestoreFileList(restoreFiles);
|
||||
qApp->ValentinaSettings()->SetRestoreFileList(restoreFiles);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -1623,7 +1623,7 @@ void MainWindow::Open()
|
|||
qCDebug(vMainWindow, "Openning new file.");
|
||||
const QString filter(tr("Pattern files (*.val)"));
|
||||
//Get list last open files
|
||||
const QStringList files = qApp->Settings()->GetRecentFileList();
|
||||
const QStringList files = qApp->ValentinaSettings()->GetRecentFileList();
|
||||
QString dir;
|
||||
if (files.isEmpty())
|
||||
{
|
||||
|
@ -1735,9 +1735,9 @@ void MainWindow::FileClosedCorrect()
|
|||
WriteSettings();
|
||||
|
||||
//File was closed correct.
|
||||
QStringList restoreFiles = qApp->Settings()->GetRestoreFileList();
|
||||
QStringList restoreFiles = qApp->ValentinaSettings()->GetRestoreFileList();
|
||||
restoreFiles.removeAll(curFile);
|
||||
qApp->Settings()->SetRestoreFileList(restoreFiles);
|
||||
qApp->ValentinaSettings()->SetRestoreFileList(restoreFiles);
|
||||
|
||||
// Remove autosave file
|
||||
QFile autofile(curFile +".autosave");
|
||||
|
@ -2359,7 +2359,7 @@ void MainWindow::setCurrentFile(const QString &fileName)
|
|||
else
|
||||
{
|
||||
qCDebug(vMainWindow, "Updating recent file list.");
|
||||
QStringList files = qApp->Settings()->GetRecentFileList();
|
||||
QStringList files = qApp->ValentinaSettings()->GetRecentFileList();
|
||||
files.removeAll(fileName);
|
||||
files.prepend(fileName);
|
||||
while (files.size() > MaxRecentFiles)
|
||||
|
@ -2367,14 +2367,14 @@ void MainWindow::setCurrentFile(const QString &fileName)
|
|||
files.removeLast();
|
||||
}
|
||||
|
||||
qApp->Settings()->SetRecentFileList(files);
|
||||
qApp->ValentinaSettings()->SetRecentFileList(files);
|
||||
UpdateRecentFileActions();
|
||||
|
||||
qCDebug(vMainWindow, "Updating restore file list.");
|
||||
QStringList restoreFiles = qApp->Settings()->GetRestoreFileList();
|
||||
QStringList restoreFiles = qApp->ValentinaSettings()->GetRestoreFileList();
|
||||
restoreFiles.removeAll(fileName);
|
||||
restoreFiles.prepend(fileName);
|
||||
qApp->Settings()->SetRestoreFileList(restoreFiles);
|
||||
qApp->ValentinaSettings()->SetRestoreFileList(restoreFiles);
|
||||
}
|
||||
shownName+="[*]";
|
||||
setWindowTitle(shownName);
|
||||
|
@ -2398,17 +2398,17 @@ QString MainWindow::strippedName(const QString &fullFileName)
|
|||
void MainWindow::ReadSettings()
|
||||
{
|
||||
qCDebug(vMainWindow, "Reading settings.");
|
||||
restoreGeometry(qApp->Settings()->GetGeometry());
|
||||
restoreState(qApp->Settings()->GetWindowState());
|
||||
restoreState(qApp->Settings()->GetToolbarsState(), APP_VERSION);
|
||||
restoreGeometry(qApp->ValentinaSettings()->GetGeometry());
|
||||
restoreState(qApp->ValentinaSettings()->GetWindowState());
|
||||
restoreState(qApp->ValentinaSettings()->GetToolbarsState(), APP_VERSION);
|
||||
|
||||
// Scene antialiasing
|
||||
const bool graphOutputValue = qApp->Settings()->GetGraphicalOutput();
|
||||
const bool graphOutputValue = qApp->ValentinaSettings()->GetGraphicalOutput();
|
||||
ui->view->setRenderHint(QPainter::Antialiasing, graphOutputValue);
|
||||
ui->view->setRenderHint(QPainter::SmoothPixmapTransform, graphOutputValue);
|
||||
|
||||
// Stack limit
|
||||
qApp->getUndoStack()->setUndoLimit(qApp->Settings()->GetUndoCount());
|
||||
qApp->getUndoStack()->setUndoLimit(qApp->ValentinaSettings()->GetUndoCount());
|
||||
|
||||
// Text under tool buton icon
|
||||
ToolBarStyles();
|
||||
|
@ -2422,9 +2422,9 @@ void MainWindow::WriteSettings()
|
|||
{
|
||||
ActionDraw(true);
|
||||
|
||||
qApp->Settings()->SetGeometry(saveGeometry());
|
||||
qApp->Settings()->SetWindowState(saveState());
|
||||
qApp->Settings()->SetToolbarsState(saveState(APP_VERSION));
|
||||
qApp->ValentinaSettings()->SetGeometry(saveGeometry());
|
||||
qApp->ValentinaSettings()->SetWindowState(saveState());
|
||||
qApp->ValentinaSettings()->SetToolbarsState(saveState(APP_VERSION));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -2456,7 +2456,7 @@ bool MainWindow::MaybeSave()
|
|||
void MainWindow::UpdateRecentFileActions()
|
||||
{
|
||||
qCDebug(vMainWindow, "Updating recent file actions.");
|
||||
const QStringList files = qApp->Settings()->GetRecentFileList();
|
||||
const QStringList files = qApp->ValentinaSettings()->GetRecentFileList();
|
||||
const int numRecentFiles = qMin(files.size(), static_cast<int>(MaxRecentFiles));
|
||||
|
||||
for (int i = 0; i < numRecentFiles; ++i)
|
||||
|
@ -2739,9 +2739,9 @@ void MainWindow::InitAutoSave()
|
|||
connect(autoSaveTimer, &QTimer::timeout, this, &MainWindow::AutoSavePattern);
|
||||
autoSaveTimer->stop();
|
||||
|
||||
if (qApp->Settings()->GetAutosaveState())
|
||||
if (qApp->ValentinaSettings()->GetAutosaveState())
|
||||
{
|
||||
const qint32 autoTime = qApp->Settings()->GetAutosaveTime();
|
||||
const qint32 autoTime = qApp->ValentinaSettings()->GetAutosaveTime();
|
||||
autoSaveTimer->start(autoTime*60000);
|
||||
qCDebug(vMainWindow, "Autosaving each %d minutes.", autoTime);
|
||||
}
|
||||
|
@ -2925,7 +2925,7 @@ QStringList MainWindow::GetUnlokedRestoreFileList() const
|
|||
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
|
||||
QStringList restoreFiles;
|
||||
//Take all files that need to be restored
|
||||
QStringList files = qApp->Settings()->GetRestoreFileList();
|
||||
QStringList files = qApp->ValentinaSettings()->GetRestoreFileList();
|
||||
if (files.size() > 0)
|
||||
{
|
||||
for (int i = 0; i < files.size(); ++i)
|
||||
|
@ -2947,7 +2947,7 @@ QStringList MainWindow::GetUnlokedRestoreFileList() const
|
|||
files.removeAll(restoreFiles.at(i));
|
||||
}
|
||||
|
||||
qApp->Settings()->SetRestoreFileList(files);
|
||||
qApp->ValentinaSettings()->SetRestoreFileList(files);
|
||||
|
||||
}
|
||||
return restoreFiles;
|
||||
|
@ -2959,7 +2959,7 @@ QStringList MainWindow::GetUnlokedRestoreFileList() const
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void MainWindow::WindowsLocale()
|
||||
{
|
||||
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||
qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -2993,7 +2993,7 @@ void MainWindow::ShowPaper(int index)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void MainWindow::ToolBarStyle(QToolBar *bar)
|
||||
{
|
||||
if (qApp->Settings()->GetToolBarStyle())
|
||||
if (qApp->ValentinaSettings()->GetToolBarStyle())
|
||||
{
|
||||
bar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
||||
}
|
||||
|
@ -3077,14 +3077,14 @@ QString MainWindow::CheckPathToMeasurements(const QString &path, const Measureme
|
|||
{
|
||||
filter = tr("Standard measurements (*.vst)");
|
||||
//Use standard path to standard measurements
|
||||
const QString path = qApp->Settings()->GetPathStandardMeasurements();
|
||||
const QString path = qApp->ValentinaSettings()->GetPathStandardMeasurements();
|
||||
mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter);
|
||||
}
|
||||
else
|
||||
{
|
||||
filter = tr("Individual measurements (*.vit)");
|
||||
//Use standard path to individual measurements
|
||||
const QString path = qApp->Settings()->GetPathIndividualMeasurements();
|
||||
const QString path = qApp->ValentinaSettings()->GetPathIndividualMeasurements();
|
||||
mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter);
|
||||
}
|
||||
|
||||
|
|
|
@ -153,7 +153,7 @@ void MainWindowsNoGUI::ExportLayoutAs()
|
|||
suf.replace(".", "");
|
||||
|
||||
const QString path = dialog.Path();
|
||||
qApp->Settings()->SetPathLayout(path);
|
||||
qApp->ValentinaSettings()->SetPathLayout(path);
|
||||
const QString mask = dialog.FileName();
|
||||
|
||||
for (int i=0; i < scenes.size(); ++i)
|
||||
|
@ -718,7 +718,7 @@ void MainWindowsNoGUI::SaveLayoutAs()
|
|||
printer.setOutputFormat(QPrinter::PdfFormat);
|
||||
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Print to pdf"),
|
||||
qApp->Settings()->GetPathLayout()+"/"+FileName()+".pdf",
|
||||
qApp->ValentinaSettings()->GetPathLayout()+"/"+FileName()+".pdf",
|
||||
tr("PDF file (*.pdf)"));
|
||||
if (not fileName.isEmpty())
|
||||
{
|
||||
|
@ -727,7 +727,7 @@ void MainWindowsNoGUI::SaveLayoutAs()
|
|||
{
|
||||
fileName.append(".pdf");
|
||||
}
|
||||
qApp->Settings()->SetPathLayout(f.absolutePath());
|
||||
qApp->ValentinaSettings()->SetPathLayout(f.absolutePath());
|
||||
|
||||
printer.setOutputFileName(fileName);
|
||||
printer.setResolution(static_cast<int>(PrintDPI));
|
||||
|
|
|
@ -812,7 +812,7 @@ QString VPattern::GetLabelBase(unsigned int index) const
|
|||
{
|
||||
QStringList list = VApplication::LabelLanguages();
|
||||
QStringList alphabet;
|
||||
switch (list.indexOf(qApp->Settings()->GetLabelLanguage()))
|
||||
switch (list.indexOf(qApp->ValentinaSettings()->GetLabelLanguage()))
|
||||
{
|
||||
case 0: // de
|
||||
{
|
||||
|
@ -2175,7 +2175,7 @@ void VPattern::ParseIncrementsElement(const QDomNode &node)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VPattern::GetAuthor() const
|
||||
{
|
||||
return UniqueTagText(TagAuthor, qApp->Settings()->GetUser());
|
||||
return UniqueTagText(TagAuthor, qApp->ValentinaSettings()->GetUser());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -65,30 +65,17 @@ void VAbstractApplication::setPatternUnit(const Unit &patternUnit)
|
|||
_patternUnit = patternUnit;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief OpenSettings get acsses to application settings.
|
||||
*
|
||||
* Because we can create object in constructor we open file separately.
|
||||
*/
|
||||
void VAbstractApplication::OpenSettings()
|
||||
{
|
||||
settings = new VSettings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
||||
QApplication::applicationName(), this);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getSettings hide settings constructor.
|
||||
* @return pointer to class for acssesing to settings in ini file.
|
||||
*/
|
||||
VSettings *VAbstractApplication::Settings()
|
||||
VCommonSettings *VAbstractApplication::Settings()
|
||||
{
|
||||
SCASSERT(settings != nullptr);
|
||||
return settings;
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QGraphicsScene *VAbstractApplication::getCurrentScene() const
|
||||
{
|
||||
|
|
|
@ -60,8 +60,8 @@ public:
|
|||
MeasurementsType patternType() const;
|
||||
void setPatternType(const MeasurementsType &patternType);
|
||||
|
||||
void OpenSettings();
|
||||
VSettings *Settings();
|
||||
virtual void OpenSettings()=0;
|
||||
VCommonSettings *Settings();
|
||||
|
||||
template <typename T>
|
||||
QString LocaleToString(const T &value);
|
||||
|
@ -98,7 +98,7 @@ protected:
|
|||
/**
|
||||
* @brief settings pointer to settings. Help hide constructor creation settings. Make make code more readable.
|
||||
*/
|
||||
VSettings *settings;
|
||||
VCommonSettings *settings;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(VAbstractApplication)
|
||||
|
|
|
@ -225,8 +225,8 @@ void Calculator::InitCharacterSets()
|
|||
<< "ЭųįҶرҲеԷňعθҺнԿفπÂхՇψÊэšՏÒUəÚѝŻşҤӑâeէŐımկòuշÕúտŔ";
|
||||
|
||||
// Defining identifier character sets
|
||||
DefineNameChars(QStringLiteral("0123456789_") + symbols.join(""));
|
||||
DefineOprtChars(symbols.join("") + QStringLiteral("+-*^/?<>=#!$%&|~_"));
|
||||
DefineNameChars(QStringLiteral("0123456789_@#") + symbols.join(""));
|
||||
DefineOprtChars(symbols.join("") + QStringLiteral("+-*^/?<>=!$%&|~_"));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<class>DialogEditWrongFormula</class>
|
||||
<widget class="QDialog" name="DialogEditWrongFormula">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::ApplicationModal</enum>
|
||||
<enum>Qt::WindowModal</enum>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
|
|
Loading…
Reference in New Issue
Block a user