Config pages in separate files.
--HG-- branch : develop
This commit is contained in:
parent
688eff1542
commit
2147e9fd97
|
@ -30,7 +30,7 @@
|
||||||
#define CONFIGDIALOG_H
|
#define CONFIGDIALOG_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include "pages.h"
|
#include "configpages/pages.h"
|
||||||
|
|
||||||
class QListWidgetItem;
|
class QListWidgetItem;
|
||||||
class QStackedWidget;
|
class QStackedWidget;
|
||||||
|
|
193
src/app/dialogs/app/configpages/communitypage.cpp
Normal file
193
src/app/dialogs/app/configpages/communitypage.cpp
Normal file
|
@ -0,0 +1,193 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file communitypage.cpp
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 21 6, 2014
|
||||||
|
**
|
||||||
|
** @brief
|
||||||
|
** @copyright
|
||||||
|
** This source code is part of the Valentine project, a pattern making
|
||||||
|
** program, whose allow create and modeling patterns of clothing.
|
||||||
|
** Copyright (C) 2014 Valentina project
|
||||||
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||||
|
**
|
||||||
|
** Valentina is free software: you can redistribute it and/or modify
|
||||||
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
** the Free Software Foundation, either version 3 of the License, or
|
||||||
|
** (at your option) any later version.
|
||||||
|
**
|
||||||
|
** Valentina is distributed in the hope that it will be useful,
|
||||||
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
** GNU General Public License for more details.
|
||||||
|
**
|
||||||
|
** You should have received a copy of the GNU General Public License
|
||||||
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
#include "communitypage.h"
|
||||||
|
#include "../../../options.h"
|
||||||
|
#include "../../../widgets/vapplication.h"
|
||||||
|
#include <QGroupBox>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QCheckBox>
|
||||||
|
#include <QLineEdit>
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
CommunityPage::CommunityPage(QWidget *parent):
|
||||||
|
QWidget(parent), server(nullptr), secureComm(nullptr), useProxy(nullptr), proxyAddress(nullptr),
|
||||||
|
proxyPort(nullptr), proxyUser(nullptr), proxyPass(nullptr), username(nullptr), savePassword(nullptr),
|
||||||
|
userpassword(nullptr)
|
||||||
|
{
|
||||||
|
QGroupBox *serverGroup = ServerGroup();
|
||||||
|
QGroupBox *proxyGroup = ProxyGroup();
|
||||||
|
QGroupBox *userGroup = UserGroup();
|
||||||
|
|
||||||
|
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||||
|
mainLayout->addWidget(serverGroup);
|
||||||
|
mainLayout->addWidget(userGroup);
|
||||||
|
mainLayout->addWidget(proxyGroup);
|
||||||
|
mainLayout->addStretch(1);
|
||||||
|
setLayout(mainLayout);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void CommunityPage::Apply()
|
||||||
|
{
|
||||||
|
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
||||||
|
QApplication::applicationName());
|
||||||
|
settings.setValue("community/server", this->server->text());
|
||||||
|
settings.setValue("community/serverSecure", this->secureComm->isChecked());
|
||||||
|
settings.setValue("community/useProxy", this->useProxy->isChecked());
|
||||||
|
settings.setValue("community/proxyAddress", this->proxyAddress->text());
|
||||||
|
settings.setValue("community/proxyPort", this->proxyPort->text());
|
||||||
|
settings.setValue("community/proxyUser", this->proxyUser->text());
|
||||||
|
settings.setValue("community/proxyPass", this->proxyPass->text());
|
||||||
|
|
||||||
|
settings.setValue("community/username", this->username->text());
|
||||||
|
settings.setValue("community/savePassword", this->savePassword->isChecked());
|
||||||
|
settings.setValue("community/userpassword", this->userpassword->text());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void CommunityPage::ProxyCheckChanged()
|
||||||
|
{
|
||||||
|
if (this->useProxy->isChecked() == false)
|
||||||
|
{
|
||||||
|
this->proxyAddress->setEnabled(false);
|
||||||
|
this->proxyPort->setEnabled(false);
|
||||||
|
this->proxyUser->setEnabled(false);
|
||||||
|
this->proxyPass->setEnabled(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->proxyAddress->setEnabled(true);
|
||||||
|
this->proxyPort->setEnabled(true);
|
||||||
|
this->proxyUser->setEnabled(true);
|
||||||
|
this->proxyPass->setEnabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void CommunityPage::PasswordCheckChanged()
|
||||||
|
{
|
||||||
|
this->userpassword->setEnabled(this->savePassword->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QGroupBox *CommunityPage::ServerGroup()
|
||||||
|
{
|
||||||
|
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
||||||
|
QApplication::applicationName());
|
||||||
|
|
||||||
|
QGroupBox *ServerGroup = new QGroupBox(tr("Server"));
|
||||||
|
QFormLayout *serverLayout = new QFormLayout;
|
||||||
|
|
||||||
|
CommunityPage::add_lineedit(&this->server, serverLayout,
|
||||||
|
settings.value("community/server", "community.valentina-project.org").toString(), tr("Server name/IP"));
|
||||||
|
|
||||||
|
CommunityPage::add_checkbox(&this->secureComm, serverLayout,
|
||||||
|
settings.value("community/serverSecure", 0).toBool(), tr("Secure connection"));
|
||||||
|
|
||||||
|
ServerGroup->setLayout(serverLayout);
|
||||||
|
return ServerGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void CommunityPage::add_checkbox(QCheckBox** thebox, QFormLayout *layout, bool checked, QString label)
|
||||||
|
{
|
||||||
|
QLabel *labelbox = new QLabel(label);
|
||||||
|
(*thebox)= new QCheckBox;
|
||||||
|
(*thebox)->setChecked(checked);
|
||||||
|
layout->addRow(labelbox, *thebox);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void CommunityPage::add_lineedit(QLineEdit** theline, QFormLayout *layout, QString value, QString label)
|
||||||
|
{
|
||||||
|
QLabel *labelbox = new QLabel(label);
|
||||||
|
(*theline)= new QLineEdit;
|
||||||
|
(*theline)->setText(value);
|
||||||
|
layout->addRow(labelbox, *theline);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QGroupBox *CommunityPage::ProxyGroup()
|
||||||
|
{
|
||||||
|
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
||||||
|
QApplication::applicationName());
|
||||||
|
QGroupBox *proxyGroup = new QGroupBox(tr("Proxy settings"));
|
||||||
|
|
||||||
|
QFormLayout *proxyLayout = new QFormLayout;
|
||||||
|
|
||||||
|
CommunityPage::add_checkbox(&this->useProxy, proxyLayout,
|
||||||
|
settings.value("community/useProxy", 0).toBool(), tr("Use Proxy"));
|
||||||
|
|
||||||
|
CommunityPage::add_lineedit(&this->proxyAddress, proxyLayout,
|
||||||
|
settings.value("community/proxyAddress", "").toString(), tr("Proxy address"));
|
||||||
|
|
||||||
|
CommunityPage::add_lineedit(&this->proxyPort, proxyLayout,
|
||||||
|
settings.value("community/proxyPort", "").toString(), tr("Proxy port"));
|
||||||
|
|
||||||
|
CommunityPage::add_lineedit(&this->proxyUser, proxyLayout,
|
||||||
|
settings.value("community/proxyUser", "").toString(), tr("Proxy user"));
|
||||||
|
|
||||||
|
CommunityPage::add_lineedit(&this->proxyPass, proxyLayout,
|
||||||
|
settings.value("community/proxyPass", "").toString(), tr("Proxy pass"));
|
||||||
|
|
||||||
|
connect(this->useProxy, &QCheckBox::stateChanged, this, &CommunityPage::ProxyCheckChanged);
|
||||||
|
this->ProxyCheckChanged();
|
||||||
|
|
||||||
|
proxyGroup->setLayout(proxyLayout);
|
||||||
|
|
||||||
|
return proxyGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QGroupBox *CommunityPage::UserGroup()
|
||||||
|
{
|
||||||
|
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
||||||
|
QApplication::applicationName());
|
||||||
|
QGroupBox *userGroup = new QGroupBox(tr("User settings"));
|
||||||
|
QFormLayout *userLayout = new QFormLayout;
|
||||||
|
|
||||||
|
CommunityPage::add_lineedit(&this->username, userLayout,
|
||||||
|
settings.value("community/username", "").toString(), tr("User Name"));
|
||||||
|
|
||||||
|
CommunityPage::add_checkbox(&this->savePassword, userLayout,
|
||||||
|
settings.value("community/savePassword", 0).toBool(), tr("Save password"));
|
||||||
|
|
||||||
|
CommunityPage::add_lineedit(&this->userpassword, userLayout,
|
||||||
|
settings.value("community/userpassword", "").toString(), tr("Password"));
|
||||||
|
|
||||||
|
connect(this->savePassword, &QCheckBox::stateChanged, this, &CommunityPage::PasswordCheckChanged);
|
||||||
|
this->PasswordCheckChanged();
|
||||||
|
|
||||||
|
userGroup->setLayout(userLayout);
|
||||||
|
|
||||||
|
return userGroup;
|
||||||
|
}
|
|
@ -1,14 +1,14 @@
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
**
|
**
|
||||||
** @file pages.h
|
** @file communitypage.h
|
||||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
** @date 12 2, 2014
|
** @date 21 6, 2014
|
||||||
**
|
**
|
||||||
** @brief
|
** @brief
|
||||||
** @copyright
|
** @copyright
|
||||||
** This source code is part of the Valentine project, a pattern making
|
** This source code is part of the Valentine project, a pattern making
|
||||||
** program, whose allow create and modeling patterns of clothing.
|
** program, whose allow create and modeling patterns of clothing.
|
||||||
** Copyright (C) 2013 Valentina project
|
** Copyright (C) 2014 Valentina project
|
||||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||||
**
|
**
|
||||||
** Valentina is free software: you can redistribute it and/or modify
|
** Valentina is free software: you can redistribute it and/or modify
|
||||||
|
@ -26,57 +26,17 @@
|
||||||
**
|
**
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#ifndef PAGES_H
|
#ifndef COMMUNITYPAGE_H
|
||||||
#define PAGES_H
|
#define COMMUNITYPAGE_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QFormLayout>
|
#include <QFormLayout>
|
||||||
|
|
||||||
class QCheckBox;
|
class QCheckBox;
|
||||||
class QSpinBox;
|
|
||||||
class QComboBox;
|
|
||||||
class QGroupBox;
|
class QGroupBox;
|
||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
|
|
||||||
class ConfigurationPage : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
ConfigurationPage(QWidget *parent = nullptr);
|
|
||||||
void Apply();
|
|
||||||
public slots:
|
|
||||||
void LangChanged();
|
|
||||||
void UnitChanged();
|
|
||||||
private:
|
|
||||||
Q_DISABLE_COPY(ConfigurationPage)
|
|
||||||
QCheckBox *autoSaveCheck;
|
|
||||||
QSpinBox *autoTime;
|
|
||||||
QComboBox *langCombo;
|
|
||||||
QComboBox *unitCombo;
|
|
||||||
QCheckBox *osOptionCheck;
|
|
||||||
bool langChanged;
|
|
||||||
bool unitChanged;
|
|
||||||
QGroupBox *SaveGroup();
|
|
||||||
QGroupBox *LangGroup();
|
|
||||||
};
|
|
||||||
|
|
||||||
class PatternPage : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
PatternPage(QWidget *parent = nullptr);
|
|
||||||
void Apply();
|
|
||||||
private:
|
|
||||||
Q_DISABLE_COPY(PatternPage)
|
|
||||||
QLineEdit *userName;
|
|
||||||
QCheckBox *graphOutputCheck;
|
|
||||||
QSpinBox *undoCount;
|
|
||||||
QGroupBox *UserGroup();
|
|
||||||
QGroupBox *GraphOutputGroup();
|
|
||||||
QGroupBox *UndoGroup();
|
|
||||||
};
|
|
||||||
|
|
||||||
class CommunityPage : public QWidget
|
class CommunityPage : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -112,4 +72,4 @@ private:
|
||||||
QGroupBox *UserGroup();
|
QGroupBox *UserGroup();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PAGES_H
|
#endif // COMMUNITYPAGE_H
|
241
src/app/dialogs/app/configpages/configurationpage.cpp
Normal file
241
src/app/dialogs/app/configpages/configurationpage.cpp
Normal file
|
@ -0,0 +1,241 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file configurationpage.cpp
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 21 6, 2014
|
||||||
|
**
|
||||||
|
** @brief
|
||||||
|
** @copyright
|
||||||
|
** This source code is part of the Valentine project, a pattern making
|
||||||
|
** program, whose allow create and modeling patterns of clothing.
|
||||||
|
** Copyright (C) 2014 Valentina project
|
||||||
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||||
|
**
|
||||||
|
** Valentina is free software: you can redistribute it and/or modify
|
||||||
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
** the Free Software Foundation, either version 3 of the License, or
|
||||||
|
** (at your option) any later version.
|
||||||
|
**
|
||||||
|
** Valentina is distributed in the hope that it will be useful,
|
||||||
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
** GNU General Public License for more details.
|
||||||
|
**
|
||||||
|
** You should have received a copy of the GNU General Public License
|
||||||
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
#include "configurationpage.h"
|
||||||
|
#include "../../../options.h"
|
||||||
|
#include "../../../widgets/vapplication.h"
|
||||||
|
#include <QDir>
|
||||||
|
#include <QGroupBox>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QTimer>
|
||||||
|
#include <QSpinBox>
|
||||||
|
#include <QComboBox>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QCheckBox>
|
||||||
|
#include <QIcon>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
ConfigurationPage::ConfigurationPage(QWidget *parent)
|
||||||
|
: QWidget(parent), autoSaveCheck(nullptr), autoTime(nullptr), langCombo(nullptr), unitCombo(nullptr),
|
||||||
|
osOptionCheck(nullptr), langChanged(false), unitChanged(false)
|
||||||
|
{
|
||||||
|
QGroupBox *saveGroup = SaveGroup();
|
||||||
|
QGroupBox *langGroup = LangGroup();
|
||||||
|
|
||||||
|
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||||
|
mainLayout->addWidget(saveGroup);
|
||||||
|
mainLayout->addWidget(langGroup);
|
||||||
|
mainLayout->addStretch(1);
|
||||||
|
setLayout(mainLayout);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void ConfigurationPage::Apply()
|
||||||
|
{
|
||||||
|
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
||||||
|
QApplication::applicationName());
|
||||||
|
settings.setValue("configuration/autosave/state", autoSaveCheck->isChecked());
|
||||||
|
settings.setValue("configuration/autosave/time", autoTime->value());
|
||||||
|
|
||||||
|
QTimer *autoSaveTimer = qApp->getAutoSaveTimer();
|
||||||
|
SCASSERT(autoSaveTimer);
|
||||||
|
|
||||||
|
if (autoSaveCheck->isChecked())
|
||||||
|
{
|
||||||
|
autoSaveTimer->start(autoTime->value()*60000);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
autoSaveTimer->stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
settings.setValue("configuration/osSeparator", osOptionCheck->isChecked());
|
||||||
|
|
||||||
|
if (langChanged)
|
||||||
|
{
|
||||||
|
QString locale = qvariant_cast<QString>(langCombo->itemData(langCombo->currentIndex()));
|
||||||
|
settings.setValue("configuration/locale", locale);
|
||||||
|
langChanged = false;
|
||||||
|
QString text = QString(tr("Setup user interface language updated and will be used the next time start") + " " +
|
||||||
|
QApplication::applicationName());
|
||||||
|
QMessageBox::information(this, QApplication::applicationName(), text);
|
||||||
|
}
|
||||||
|
if (this->unitChanged)
|
||||||
|
{
|
||||||
|
QString unit = qvariant_cast<QString>(this->unitCombo->itemData(this->unitCombo->currentIndex()));
|
||||||
|
settings.setValue("configuration/unit", unit);
|
||||||
|
this->unitChanged = false;
|
||||||
|
QString text = QString(tr("Default unit updated and will be used the next pattern load"));
|
||||||
|
QMessageBox::information(this, QApplication::applicationName(), text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void ConfigurationPage::LangChanged()
|
||||||
|
{
|
||||||
|
langChanged = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void ConfigurationPage::UnitChanged()
|
||||||
|
{
|
||||||
|
this->unitChanged = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QGroupBox *ConfigurationPage::SaveGroup()
|
||||||
|
{
|
||||||
|
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
||||||
|
QApplication::applicationName());
|
||||||
|
|
||||||
|
QGroupBox *saveGroup = new QGroupBox(tr("Save"));
|
||||||
|
|
||||||
|
autoSaveCheck = new QCheckBox(tr("Auto-save modified pattern"));
|
||||||
|
bool autoSaveValue = settings.value("configuration/autosave/state", 1).toBool();
|
||||||
|
autoSaveCheck->setChecked(autoSaveValue);
|
||||||
|
|
||||||
|
QLabel *intervalLabel = new QLabel(tr("Interval:"));
|
||||||
|
|
||||||
|
autoTime = new QSpinBox();
|
||||||
|
bool ok = true;
|
||||||
|
qint32 autoTimeValue = settings.value("configuration/autosave/time", 5).toInt(&ok);
|
||||||
|
if (ok == false)
|
||||||
|
{
|
||||||
|
autoTimeValue = 5;
|
||||||
|
}
|
||||||
|
autoTime->setRange(1, 60);
|
||||||
|
autoTime->setValue(autoTimeValue);
|
||||||
|
autoTime->setSuffix(tr("min"));
|
||||||
|
|
||||||
|
QHBoxLayout *autosaveLayout = new QHBoxLayout;
|
||||||
|
autosaveLayout->addWidget(autoSaveCheck);
|
||||||
|
autosaveLayout->addWidget(intervalLabel);
|
||||||
|
autosaveLayout->addWidget(autoTime);
|
||||||
|
|
||||||
|
QVBoxLayout *saveLayout = new QVBoxLayout;
|
||||||
|
saveLayout->addLayout(autosaveLayout);
|
||||||
|
saveGroup->setLayout(saveLayout);
|
||||||
|
return saveGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QGroupBox *ConfigurationPage::LangGroup()
|
||||||
|
{
|
||||||
|
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
||||||
|
QApplication::applicationName());
|
||||||
|
|
||||||
|
QGroupBox *langGroup = new QGroupBox(tr("Language"));
|
||||||
|
QLabel *guiLabel = new QLabel(tr("GUI language"));
|
||||||
|
langCombo = new QComboBox;
|
||||||
|
|
||||||
|
// format systems language
|
||||||
|
QString defaultLocale = QLocale::system().name(); // e.g. "de_DE"
|
||||||
|
defaultLocale.truncate(defaultLocale.lastIndexOf('_')); // e.g. "de"
|
||||||
|
QString checkedLocale = settings.value("configuration/locale", defaultLocale).toString();
|
||||||
|
|
||||||
|
QString m_langPath = qApp->translationsPath();
|
||||||
|
QDir dir(m_langPath);
|
||||||
|
QStringList fileNames = dir.entryList(QStringList("valentina_*.qm"));
|
||||||
|
|
||||||
|
for (int i = 0; i < fileNames.size(); ++i)
|
||||||
|
{
|
||||||
|
// get locale extracted by filename
|
||||||
|
QString locale;
|
||||||
|
locale = fileNames.at(i); // "valentina_de.qm"
|
||||||
|
locale.truncate(locale.lastIndexOf('.')); // "valentina_de"
|
||||||
|
locale.remove(0, locale.indexOf('_') + 1); // "de"
|
||||||
|
|
||||||
|
QString lang = QLocale(locale).nativeLanguageName();
|
||||||
|
QIcon ico(QString("%1/%2.png").arg("://icon/flags").arg(locale));
|
||||||
|
|
||||||
|
langCombo->addItem(ico, lang, locale);
|
||||||
|
}
|
||||||
|
|
||||||
|
QIcon ico(QString("%1/%2.png").arg("://icon/flags").arg("en"));
|
||||||
|
QString lang = QLocale("en").nativeLanguageName();
|
||||||
|
langCombo->addItem(ico, lang, "en");
|
||||||
|
|
||||||
|
// set default translators and language checked
|
||||||
|
qint32 index = langCombo->findData(checkedLocale);
|
||||||
|
if (index != -1)
|
||||||
|
{
|
||||||
|
langCombo->setCurrentIndex(index);
|
||||||
|
}
|
||||||
|
connect(langCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||||
|
&ConfigurationPage::LangChanged);
|
||||||
|
|
||||||
|
QHBoxLayout *guiLangLayout = new QHBoxLayout;
|
||||||
|
guiLangLayout->addWidget(guiLabel);
|
||||||
|
guiLangLayout->addWidget(langCombo);
|
||||||
|
|
||||||
|
//-------------------- Decimal separator setup
|
||||||
|
QLabel *separatorLabel = new QLabel(tr("Decimal separator parts"));
|
||||||
|
|
||||||
|
osOptionCheck = new QCheckBox(tr("With OS options (%1)").arg(QLocale::system().decimalPoint().toLatin1()));
|
||||||
|
bool osOptionValue = settings.value("configuration/osSeparator", 1).toBool();
|
||||||
|
osOptionCheck->setChecked(osOptionValue);
|
||||||
|
|
||||||
|
QHBoxLayout *separatorLayout = new QHBoxLayout;
|
||||||
|
separatorLayout->addWidget(separatorLabel);
|
||||||
|
separatorLayout->addWidget(osOptionCheck);
|
||||||
|
|
||||||
|
//----------------------- Unit setup
|
||||||
|
this->unitCombo = new QComboBox;
|
||||||
|
QLabel *unitLabel = new QLabel(tr("Default unit"));
|
||||||
|
|
||||||
|
QString checkedUnit = settings.value("configuration/unit", "cm").toString();
|
||||||
|
|
||||||
|
this->unitCombo->addItem(tr("Centimeters"), "cm");
|
||||||
|
this->unitCombo->addItem(tr("Milimiters"), "mm");
|
||||||
|
this->unitCombo->addItem(tr("Inches"), "in");
|
||||||
|
|
||||||
|
// set default unit
|
||||||
|
qint32 indexUnit = this->unitCombo->findData(checkedUnit);
|
||||||
|
if (indexUnit != -1)
|
||||||
|
{
|
||||||
|
this->unitCombo->setCurrentIndex(indexUnit);
|
||||||
|
}
|
||||||
|
connect(this->unitCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||||
|
&ConfigurationPage::UnitChanged);
|
||||||
|
|
||||||
|
QHBoxLayout *UnitLayout = new QHBoxLayout;
|
||||||
|
UnitLayout->addWidget(unitLabel);
|
||||||
|
UnitLayout->addWidget(this->unitCombo);
|
||||||
|
|
||||||
|
//----------------------- Unit setup
|
||||||
|
|
||||||
|
QVBoxLayout *langLayout = new QVBoxLayout;
|
||||||
|
langLayout->addLayout(guiLangLayout);
|
||||||
|
langLayout->addLayout(separatorLayout);
|
||||||
|
langLayout->addLayout(UnitLayout);
|
||||||
|
langGroup->setLayout(langLayout);
|
||||||
|
|
||||||
|
return langGroup;
|
||||||
|
}
|
62
src/app/dialogs/app/configpages/configurationpage.h
Normal file
62
src/app/dialogs/app/configpages/configurationpage.h
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file configurationpage.h
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 21 6, 2014
|
||||||
|
**
|
||||||
|
** @brief
|
||||||
|
** @copyright
|
||||||
|
** This source code is part of the Valentine project, a pattern making
|
||||||
|
** program, whose allow create and modeling patterns of clothing.
|
||||||
|
** Copyright (C) 2014 Valentina project
|
||||||
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||||
|
**
|
||||||
|
** Valentina is free software: you can redistribute it and/or modify
|
||||||
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
** the Free Software Foundation, either version 3 of the License, or
|
||||||
|
** (at your option) any later version.
|
||||||
|
**
|
||||||
|
** Valentina is distributed in the hope that it will be useful,
|
||||||
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
** GNU General Public License for more details.
|
||||||
|
**
|
||||||
|
** You should have received a copy of the GNU General Public License
|
||||||
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
#ifndef CONFIGURATIONPAGE_H
|
||||||
|
#define CONFIGURATIONPAGE_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
class QCheckBox;
|
||||||
|
class QSpinBox;
|
||||||
|
class QComboBox;
|
||||||
|
class QGroupBox;
|
||||||
|
|
||||||
|
class ConfigurationPage : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
ConfigurationPage(QWidget *parent = nullptr);
|
||||||
|
void Apply();
|
||||||
|
public slots:
|
||||||
|
void LangChanged();
|
||||||
|
void UnitChanged();
|
||||||
|
private:
|
||||||
|
Q_DISABLE_COPY(ConfigurationPage)
|
||||||
|
QCheckBox *autoSaveCheck;
|
||||||
|
QSpinBox *autoTime;
|
||||||
|
QComboBox *langCombo;
|
||||||
|
QComboBox *unitCombo;
|
||||||
|
QCheckBox *osOptionCheck;
|
||||||
|
bool langChanged;
|
||||||
|
bool unitChanged;
|
||||||
|
QGroupBox *SaveGroup();
|
||||||
|
QGroupBox *LangGroup();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CONFIGURATIONPAGE_H
|
36
src/app/dialogs/app/configpages/pages.h
Normal file
36
src/app/dialogs/app/configpages/pages.h
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file pages.h
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 12 2, 2014
|
||||||
|
**
|
||||||
|
** @brief
|
||||||
|
** @copyright
|
||||||
|
** This source code is part of the Valentine project, a pattern making
|
||||||
|
** program, whose allow create and modeling patterns of clothing.
|
||||||
|
** Copyright (C) 2013 Valentina project
|
||||||
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||||
|
**
|
||||||
|
** Valentina is free software: you can redistribute it and/or modify
|
||||||
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
** the Free Software Foundation, either version 3 of the License, or
|
||||||
|
** (at your option) any later version.
|
||||||
|
**
|
||||||
|
** Valentina is distributed in the hope that it will be useful,
|
||||||
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
** GNU General Public License for more details.
|
||||||
|
**
|
||||||
|
** You should have received a copy of the GNU General Public License
|
||||||
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
#ifndef PAGES_H
|
||||||
|
#define PAGES_H
|
||||||
|
|
||||||
|
#include "configurationpage.h"
|
||||||
|
#include "patternpage.h"
|
||||||
|
#include "communitypage.h"
|
||||||
|
|
||||||
|
#endif // PAGES_H
|
148
src/app/dialogs/app/configpages/patternpage.cpp
Normal file
148
src/app/dialogs/app/configpages/patternpage.cpp
Normal file
|
@ -0,0 +1,148 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file patternpage.cpp
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 21 6, 2014
|
||||||
|
**
|
||||||
|
** @brief
|
||||||
|
** @copyright
|
||||||
|
** This source code is part of the Valentine project, a pattern making
|
||||||
|
** program, whose allow create and modeling patterns of clothing.
|
||||||
|
** Copyright (C) 2014 Valentina project
|
||||||
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||||
|
**
|
||||||
|
** Valentina is free software: you can redistribute it and/or modify
|
||||||
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
** the Free Software Foundation, either version 3 of the License, or
|
||||||
|
** (at your option) any later version.
|
||||||
|
**
|
||||||
|
** Valentina is distributed in the hope that it will be useful,
|
||||||
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
** GNU General Public License for more details.
|
||||||
|
**
|
||||||
|
** You should have received a copy of the GNU General Public License
|
||||||
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
#include "patternpage.h"
|
||||||
|
#include "../../../options.h"
|
||||||
|
#include "../../../widgets/vapplication.h"
|
||||||
|
#include "../../../widgets/vmaingraphicsview.h"
|
||||||
|
#include <QGroupBox>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QCheckBox>
|
||||||
|
#include <QSpinBox>
|
||||||
|
#include <QLineEdit>
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
PatternPage::PatternPage(QWidget *parent):
|
||||||
|
QWidget(parent), userName(0), graphOutputCheck(0), undoCount(0)
|
||||||
|
{
|
||||||
|
QGroupBox *userGroup = UserGroup();
|
||||||
|
QGroupBox *graphOutputGroup = GraphOutputGroup();
|
||||||
|
QGroupBox *undoGroup = UndoGroup();
|
||||||
|
|
||||||
|
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||||
|
mainLayout->addWidget(userGroup);
|
||||||
|
mainLayout->addWidget(graphOutputGroup);
|
||||||
|
mainLayout->addWidget(undoGroup);
|
||||||
|
mainLayout->addStretch(1);
|
||||||
|
setLayout(mainLayout);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void PatternPage::Apply()
|
||||||
|
{
|
||||||
|
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
||||||
|
QApplication::applicationName());
|
||||||
|
settings.setValue("pattern/user", userName->text());
|
||||||
|
|
||||||
|
// Scene antialiasing
|
||||||
|
settings.setValue("pattern/graphicalOutput", 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.*/
|
||||||
|
settings.setValue("pattern/undo", undoCount->value());
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QGroupBox *PatternPage::UserGroup()
|
||||||
|
{
|
||||||
|
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
||||||
|
QApplication::applicationName());
|
||||||
|
|
||||||
|
QGroupBox *userGroup = new QGroupBox(tr("User"));
|
||||||
|
QLabel *nameLabel = new QLabel(tr("User name"));
|
||||||
|
|
||||||
|
userName = new QLineEdit;
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
QString user = settings.value("pattern/user", QString::fromLocal8Bit(qgetenv("USERNAME").constData())).toString();
|
||||||
|
#else
|
||||||
|
QString user = settings.value("pattern/user", QString::fromLocal8Bit(qgetenv("USER").constData())).toString();
|
||||||
|
#endif
|
||||||
|
userName->setText(user);
|
||||||
|
|
||||||
|
QHBoxLayout *nameLayout = new QHBoxLayout;
|
||||||
|
nameLayout->addWidget(nameLabel);
|
||||||
|
nameLayout->addWidget(userName);
|
||||||
|
|
||||||
|
QVBoxLayout *userLayout = new QVBoxLayout;
|
||||||
|
userLayout->addLayout(nameLayout);
|
||||||
|
userGroup->setLayout(userLayout);
|
||||||
|
return userGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QGroupBox *PatternPage::GraphOutputGroup()
|
||||||
|
{
|
||||||
|
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
||||||
|
QApplication::applicationName());
|
||||||
|
|
||||||
|
QGroupBox *graphOutputGroup = new QGroupBox(tr("Graphical output"));
|
||||||
|
|
||||||
|
graphOutputCheck = new QCheckBox(tr("Use antialiasing"));
|
||||||
|
bool graphOutputValue = settings.value("pattern/graphicalOutput", 1).toBool();
|
||||||
|
graphOutputCheck->setChecked(graphOutputValue);
|
||||||
|
|
||||||
|
QHBoxLayout *graphLayout = new QHBoxLayout;
|
||||||
|
graphLayout->addWidget(graphOutputCheck);
|
||||||
|
|
||||||
|
QVBoxLayout *graphOutputLayout = new QVBoxLayout;
|
||||||
|
graphOutputLayout->addLayout(graphLayout);
|
||||||
|
graphOutputGroup->setLayout(graphOutputLayout);
|
||||||
|
return graphOutputGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QGroupBox *PatternPage::UndoGroup()
|
||||||
|
{
|
||||||
|
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
||||||
|
QApplication::applicationName());
|
||||||
|
|
||||||
|
QGroupBox *undoGroup = new QGroupBox(tr("Undo"));
|
||||||
|
QLabel *undoLabel = new QLabel(tr("Count steps (0 - no limit)"));
|
||||||
|
undoCount = new QSpinBox;
|
||||||
|
undoCount->setMinimum(0);
|
||||||
|
bool ok = true;
|
||||||
|
qint32 count = settings.value("pattern/undo", 0).toInt(&ok);
|
||||||
|
if (ok == false)
|
||||||
|
{
|
||||||
|
count = 0;
|
||||||
|
}
|
||||||
|
undoCount->setValue(count);
|
||||||
|
|
||||||
|
QHBoxLayout *countLayout = new QHBoxLayout;
|
||||||
|
countLayout->addWidget(undoLabel);
|
||||||
|
countLayout->addWidget(undoCount);
|
||||||
|
|
||||||
|
QVBoxLayout *undoLayout = new QVBoxLayout;
|
||||||
|
undoLayout->addLayout(countLayout);
|
||||||
|
undoGroup->setLayout(undoLayout);
|
||||||
|
return undoGroup;
|
||||||
|
}
|
56
src/app/dialogs/app/configpages/patternpage.h
Normal file
56
src/app/dialogs/app/configpages/patternpage.h
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file patternpage.h
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 21 6, 2014
|
||||||
|
**
|
||||||
|
** @brief
|
||||||
|
** @copyright
|
||||||
|
** This source code is part of the Valentine project, a pattern making
|
||||||
|
** program, whose allow create and modeling patterns of clothing.
|
||||||
|
** Copyright (C) 2014 Valentina project
|
||||||
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||||
|
**
|
||||||
|
** Valentina is free software: you can redistribute it and/or modify
|
||||||
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
** the Free Software Foundation, either version 3 of the License, or
|
||||||
|
** (at your option) any later version.
|
||||||
|
**
|
||||||
|
** Valentina is distributed in the hope that it will be useful,
|
||||||
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
** GNU General Public License for more details.
|
||||||
|
**
|
||||||
|
** You should have received a copy of the GNU General Public License
|
||||||
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
#ifndef PATTERNPAGE_H
|
||||||
|
#define PATTERNPAGE_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
class QCheckBox;
|
||||||
|
class QSpinBox;
|
||||||
|
class QGroupBox;
|
||||||
|
class QLineEdit;
|
||||||
|
|
||||||
|
class PatternPage : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
PatternPage(QWidget *parent = nullptr);
|
||||||
|
void Apply();
|
||||||
|
private:
|
||||||
|
Q_DISABLE_COPY(PatternPage)
|
||||||
|
QLineEdit *userName;
|
||||||
|
QCheckBox *graphOutputCheck;
|
||||||
|
QSpinBox *undoCount;
|
||||||
|
QGroupBox *UserGroup();
|
||||||
|
QGroupBox *GraphOutputGroup();
|
||||||
|
QGroupBox *UndoGroup();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // PATTERNPAGE_H
|
|
@ -1,512 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
**
|
|
||||||
** @file pages.cpp
|
|
||||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
||||||
** @date 12 2, 2014
|
|
||||||
**
|
|
||||||
** @brief
|
|
||||||
** @copyright
|
|
||||||
** This source code is part of the Valentine project, a pattern making
|
|
||||||
** program, whose allow create and modeling patterns of clothing.
|
|
||||||
** Copyright (C) 2013 Valentina project
|
|
||||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
||||||
**
|
|
||||||
** Valentina is free software: you can redistribute it and/or modify
|
|
||||||
** it under the terms of the GNU General Public License as published by
|
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
|
||||||
** (at your option) any later version.
|
|
||||||
**
|
|
||||||
** Valentina is distributed in the hope that it will be useful,
|
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
** GNU General Public License for more details.
|
|
||||||
**
|
|
||||||
** You should have received a copy of the GNU General Public License
|
|
||||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
**
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
#include "pages.h"
|
|
||||||
#include "../../options.h"
|
|
||||||
#include "../../widgets/vapplication.h"
|
|
||||||
#include "../../widgets/vmaingraphicsview.h"
|
|
||||||
#include <QDir>
|
|
||||||
#include <QGroupBox>
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QSettings>
|
|
||||||
#include <QTimer>
|
|
||||||
#include <QCheckBox>
|
|
||||||
#include <QSpinBox>
|
|
||||||
#include <QComboBox>
|
|
||||||
#include <QMessageBox>
|
|
||||||
#include <QCheckBox>
|
|
||||||
#include <QIcon>
|
|
||||||
#include <QLineEdit>
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
ConfigurationPage::ConfigurationPage(QWidget *parent)
|
|
||||||
: QWidget(parent), autoSaveCheck(nullptr), autoTime(nullptr), langCombo(nullptr), unitCombo(nullptr),
|
|
||||||
osOptionCheck(nullptr), langChanged(false), unitChanged(false)
|
|
||||||
{
|
|
||||||
QGroupBox *saveGroup = SaveGroup();
|
|
||||||
QGroupBox *langGroup = LangGroup();
|
|
||||||
|
|
||||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
|
||||||
mainLayout->addWidget(saveGroup);
|
|
||||||
mainLayout->addWidget(langGroup);
|
|
||||||
mainLayout->addStretch(1);
|
|
||||||
setLayout(mainLayout);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void ConfigurationPage::Apply()
|
|
||||||
{
|
|
||||||
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
|
||||||
QApplication::applicationName());
|
|
||||||
settings.setValue("configuration/autosave/state", autoSaveCheck->isChecked());
|
|
||||||
settings.setValue("configuration/autosave/time", autoTime->value());
|
|
||||||
|
|
||||||
QTimer *autoSaveTimer = qApp->getAutoSaveTimer();
|
|
||||||
SCASSERT(autoSaveTimer);
|
|
||||||
|
|
||||||
if (autoSaveCheck->isChecked())
|
|
||||||
{
|
|
||||||
autoSaveTimer->start(autoTime->value()*60000);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
autoSaveTimer->stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
settings.setValue("configuration/osSeparator", osOptionCheck->isChecked());
|
|
||||||
|
|
||||||
if (langChanged)
|
|
||||||
{
|
|
||||||
QString locale = qvariant_cast<QString>(langCombo->itemData(langCombo->currentIndex()));
|
|
||||||
settings.setValue("configuration/locale", locale);
|
|
||||||
langChanged = false;
|
|
||||||
QString text = QString(tr("Setup user interface language updated and will be used the next time start") + " " +
|
|
||||||
QApplication::applicationName());
|
|
||||||
QMessageBox::information(this, QApplication::applicationName(), text);
|
|
||||||
}
|
|
||||||
if (this->unitChanged)
|
|
||||||
{
|
|
||||||
QString unit = qvariant_cast<QString>(this->unitCombo->itemData(this->unitCombo->currentIndex()));
|
|
||||||
settings.setValue("configuration/unit", unit);
|
|
||||||
this->unitChanged = false;
|
|
||||||
QString text = QString(tr("Default unit updated and will be used the next pattern load"));
|
|
||||||
QMessageBox::information(this, QApplication::applicationName(), text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void ConfigurationPage::LangChanged()
|
|
||||||
{
|
|
||||||
langChanged = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void ConfigurationPage::UnitChanged()
|
|
||||||
{
|
|
||||||
this->unitChanged = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
QGroupBox *ConfigurationPage::SaveGroup()
|
|
||||||
{
|
|
||||||
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
|
||||||
QApplication::applicationName());
|
|
||||||
|
|
||||||
QGroupBox *saveGroup = new QGroupBox(tr("Save"));
|
|
||||||
|
|
||||||
autoSaveCheck = new QCheckBox(tr("Auto-save modified pattern"));
|
|
||||||
bool autoSaveValue = settings.value("configuration/autosave/state", 1).toBool();
|
|
||||||
autoSaveCheck->setChecked(autoSaveValue);
|
|
||||||
|
|
||||||
QLabel *intervalLabel = new QLabel(tr("Interval:"));
|
|
||||||
|
|
||||||
autoTime = new QSpinBox();
|
|
||||||
bool ok = true;
|
|
||||||
qint32 autoTimeValue = settings.value("configuration/autosave/time", 5).toInt(&ok);
|
|
||||||
if (ok == false)
|
|
||||||
{
|
|
||||||
autoTimeValue = 5;
|
|
||||||
}
|
|
||||||
autoTime->setRange(1, 60);
|
|
||||||
autoTime->setValue(autoTimeValue);
|
|
||||||
autoTime->setSuffix(tr("min"));
|
|
||||||
|
|
||||||
QHBoxLayout *autosaveLayout = new QHBoxLayout;
|
|
||||||
autosaveLayout->addWidget(autoSaveCheck);
|
|
||||||
autosaveLayout->addWidget(intervalLabel);
|
|
||||||
autosaveLayout->addWidget(autoTime);
|
|
||||||
|
|
||||||
QVBoxLayout *saveLayout = new QVBoxLayout;
|
|
||||||
saveLayout->addLayout(autosaveLayout);
|
|
||||||
saveGroup->setLayout(saveLayout);
|
|
||||||
return saveGroup;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
QGroupBox *ConfigurationPage::LangGroup()
|
|
||||||
{
|
|
||||||
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
|
||||||
QApplication::applicationName());
|
|
||||||
|
|
||||||
QGroupBox *langGroup = new QGroupBox(tr("Language"));
|
|
||||||
QLabel *guiLabel = new QLabel(tr("GUI language"));
|
|
||||||
langCombo = new QComboBox;
|
|
||||||
|
|
||||||
// format systems language
|
|
||||||
QString defaultLocale = QLocale::system().name(); // e.g. "de_DE"
|
|
||||||
defaultLocale.truncate(defaultLocale.lastIndexOf('_')); // e.g. "de"
|
|
||||||
QString checkedLocale = settings.value("configuration/locale", defaultLocale).toString();
|
|
||||||
|
|
||||||
QString m_langPath = qApp->translationsPath();
|
|
||||||
QDir dir(m_langPath);
|
|
||||||
QStringList fileNames = dir.entryList(QStringList("valentina_*.qm"));
|
|
||||||
|
|
||||||
for (int i = 0; i < fileNames.size(); ++i)
|
|
||||||
{
|
|
||||||
// get locale extracted by filename
|
|
||||||
QString locale;
|
|
||||||
locale = fileNames.at(i); // "valentina_de.qm"
|
|
||||||
locale.truncate(locale.lastIndexOf('.')); // "valentina_de"
|
|
||||||
locale.remove(0, locale.indexOf('_') + 1); // "de"
|
|
||||||
|
|
||||||
QString lang = QLocale(locale).nativeLanguageName();
|
|
||||||
QIcon ico(QString("%1/%2.png").arg("://icon/flags").arg(locale));
|
|
||||||
|
|
||||||
langCombo->addItem(ico, lang, locale);
|
|
||||||
}
|
|
||||||
|
|
||||||
QIcon ico(QString("%1/%2.png").arg("://icon/flags").arg("en"));
|
|
||||||
QString lang = QLocale("en").nativeLanguageName();
|
|
||||||
langCombo->addItem(ico, lang, "en");
|
|
||||||
|
|
||||||
// set default translators and language checked
|
|
||||||
qint32 index = langCombo->findData(checkedLocale);
|
|
||||||
if (index != -1)
|
|
||||||
{
|
|
||||||
langCombo->setCurrentIndex(index);
|
|
||||||
}
|
|
||||||
connect(langCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
|
||||||
&ConfigurationPage::LangChanged);
|
|
||||||
|
|
||||||
QHBoxLayout *guiLangLayout = new QHBoxLayout;
|
|
||||||
guiLangLayout->addWidget(guiLabel);
|
|
||||||
guiLangLayout->addWidget(langCombo);
|
|
||||||
|
|
||||||
//-------------------- Decimal separator setup
|
|
||||||
QLabel *separatorLabel = new QLabel(tr("Decimal separator parts"));
|
|
||||||
|
|
||||||
osOptionCheck = new QCheckBox(tr("With OS options (%1)").arg(QLocale::system().decimalPoint().toLatin1()));
|
|
||||||
bool osOptionValue = settings.value("configuration/osSeparator", 1).toBool();
|
|
||||||
osOptionCheck->setChecked(osOptionValue);
|
|
||||||
|
|
||||||
QHBoxLayout *separatorLayout = new QHBoxLayout;
|
|
||||||
separatorLayout->addWidget(separatorLabel);
|
|
||||||
separatorLayout->addWidget(osOptionCheck);
|
|
||||||
|
|
||||||
//----------------------- Unit setup
|
|
||||||
this->unitCombo = new QComboBox;
|
|
||||||
QLabel *unitLabel = new QLabel(tr("Default unit"));
|
|
||||||
|
|
||||||
QString checkedUnit = settings.value("configuration/unit", "cm").toString();
|
|
||||||
|
|
||||||
this->unitCombo->addItem(tr("Centimeters"), "cm");
|
|
||||||
this->unitCombo->addItem(tr("Milimiters"), "mm");
|
|
||||||
this->unitCombo->addItem(tr("Inches"), "in");
|
|
||||||
|
|
||||||
// set default unit
|
|
||||||
qint32 indexUnit = this->unitCombo->findData(checkedUnit);
|
|
||||||
if (indexUnit != -1)
|
|
||||||
{
|
|
||||||
this->unitCombo->setCurrentIndex(indexUnit);
|
|
||||||
}
|
|
||||||
connect(this->unitCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
|
||||||
&ConfigurationPage::UnitChanged);
|
|
||||||
|
|
||||||
QHBoxLayout *UnitLayout = new QHBoxLayout;
|
|
||||||
UnitLayout->addWidget(unitLabel);
|
|
||||||
UnitLayout->addWidget(this->unitCombo);
|
|
||||||
|
|
||||||
//----------------------- Unit setup
|
|
||||||
|
|
||||||
QVBoxLayout *langLayout = new QVBoxLayout;
|
|
||||||
langLayout->addLayout(guiLangLayout);
|
|
||||||
langLayout->addLayout(separatorLayout);
|
|
||||||
langLayout->addLayout(UnitLayout);
|
|
||||||
langGroup->setLayout(langLayout);
|
|
||||||
|
|
||||||
return langGroup;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
//---------------------- Pattern Class
|
|
||||||
PatternPage::PatternPage(QWidget *parent):
|
|
||||||
QWidget(parent), userName(0), graphOutputCheck(0), undoCount(0)
|
|
||||||
{
|
|
||||||
QGroupBox *userGroup = UserGroup();
|
|
||||||
QGroupBox *graphOutputGroup = GraphOutputGroup();
|
|
||||||
QGroupBox *undoGroup = UndoGroup();
|
|
||||||
|
|
||||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
|
||||||
mainLayout->addWidget(userGroup);
|
|
||||||
mainLayout->addWidget(graphOutputGroup);
|
|
||||||
mainLayout->addWidget(undoGroup);
|
|
||||||
mainLayout->addStretch(1);
|
|
||||||
setLayout(mainLayout);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void PatternPage::Apply()
|
|
||||||
{
|
|
||||||
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
|
||||||
QApplication::applicationName());
|
|
||||||
settings.setValue("pattern/user", userName->text());
|
|
||||||
|
|
||||||
// Scene antialiasing
|
|
||||||
settings.setValue("pattern/graphicalOutput", 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.*/
|
|
||||||
settings.setValue("pattern/undo", undoCount->value());
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
QGroupBox *PatternPage::UserGroup()
|
|
||||||
{
|
|
||||||
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
|
||||||
QApplication::applicationName());
|
|
||||||
|
|
||||||
QGroupBox *userGroup = new QGroupBox(tr("User"));
|
|
||||||
QLabel *nameLabel = new QLabel(tr("User name"));
|
|
||||||
|
|
||||||
userName = new QLineEdit;
|
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
QString user = settings.value("pattern/user", QString::fromLocal8Bit(qgetenv("USERNAME").constData())).toString();
|
|
||||||
#else
|
|
||||||
QString user = settings.value("pattern/user", QString::fromLocal8Bit(qgetenv("USER").constData())).toString();
|
|
||||||
#endif
|
|
||||||
userName->setText(user);
|
|
||||||
|
|
||||||
QHBoxLayout *nameLayout = new QHBoxLayout;
|
|
||||||
nameLayout->addWidget(nameLabel);
|
|
||||||
nameLayout->addWidget(userName);
|
|
||||||
|
|
||||||
QVBoxLayout *userLayout = new QVBoxLayout;
|
|
||||||
userLayout->addLayout(nameLayout);
|
|
||||||
userGroup->setLayout(userLayout);
|
|
||||||
return userGroup;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
QGroupBox *PatternPage::GraphOutputGroup()
|
|
||||||
{
|
|
||||||
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
|
||||||
QApplication::applicationName());
|
|
||||||
|
|
||||||
QGroupBox *graphOutputGroup = new QGroupBox(tr("Graphical output"));
|
|
||||||
|
|
||||||
graphOutputCheck = new QCheckBox(tr("Use antialiasing"));
|
|
||||||
bool graphOutputValue = settings.value("pattern/graphicalOutput", 1).toBool();
|
|
||||||
graphOutputCheck->setChecked(graphOutputValue);
|
|
||||||
|
|
||||||
QHBoxLayout *graphLayout = new QHBoxLayout;
|
|
||||||
graphLayout->addWidget(graphOutputCheck);
|
|
||||||
|
|
||||||
QVBoxLayout *graphOutputLayout = new QVBoxLayout;
|
|
||||||
graphOutputLayout->addLayout(graphLayout);
|
|
||||||
graphOutputGroup->setLayout(graphOutputLayout);
|
|
||||||
return graphOutputGroup;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
QGroupBox *PatternPage::UndoGroup()
|
|
||||||
{
|
|
||||||
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
|
||||||
QApplication::applicationName());
|
|
||||||
|
|
||||||
QGroupBox *undoGroup = new QGroupBox(tr("Undo"));
|
|
||||||
QLabel *undoLabel = new QLabel(tr("Count steps (0 - no limit)"));
|
|
||||||
undoCount = new QSpinBox;
|
|
||||||
undoCount->setMinimum(0);
|
|
||||||
bool ok = true;
|
|
||||||
qint32 count = settings.value("pattern/undo", 0).toInt(&ok);
|
|
||||||
if (ok == false)
|
|
||||||
{
|
|
||||||
count = 0;
|
|
||||||
}
|
|
||||||
undoCount->setValue(count);
|
|
||||||
|
|
||||||
QHBoxLayout *countLayout = new QHBoxLayout;
|
|
||||||
countLayout->addWidget(undoLabel);
|
|
||||||
countLayout->addWidget(undoCount);
|
|
||||||
|
|
||||||
QVBoxLayout *undoLayout = new QVBoxLayout;
|
|
||||||
undoLayout->addLayout(countLayout);
|
|
||||||
undoGroup->setLayout(undoLayout);
|
|
||||||
return undoGroup;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
//---------------------- Community Class
|
|
||||||
CommunityPage::CommunityPage(QWidget *parent):
|
|
||||||
QWidget(parent), server(nullptr), secureComm(nullptr), useProxy(nullptr), proxyAddress(nullptr),
|
|
||||||
proxyPort(nullptr), proxyUser(nullptr), proxyPass(nullptr), username(nullptr), savePassword(nullptr),
|
|
||||||
userpassword(nullptr)
|
|
||||||
{
|
|
||||||
QGroupBox *serverGroup = ServerGroup();
|
|
||||||
QGroupBox *proxyGroup = ProxyGroup();
|
|
||||||
QGroupBox *userGroup = UserGroup();
|
|
||||||
|
|
||||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
|
||||||
mainLayout->addWidget(serverGroup);
|
|
||||||
mainLayout->addWidget(userGroup);
|
|
||||||
mainLayout->addWidget(proxyGroup);
|
|
||||||
mainLayout->addStretch(1);
|
|
||||||
setLayout(mainLayout);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void CommunityPage::Apply()
|
|
||||||
{
|
|
||||||
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
|
||||||
QApplication::applicationName());
|
|
||||||
settings.setValue("community/server", this->server->text());
|
|
||||||
settings.setValue("community/serverSecure", this->secureComm->isChecked());
|
|
||||||
settings.setValue("community/useProxy", this->useProxy->isChecked());
|
|
||||||
settings.setValue("community/proxyAddress", this->proxyAddress->text());
|
|
||||||
settings.setValue("community/proxyPort", this->proxyPort->text());
|
|
||||||
settings.setValue("community/proxyUser", this->proxyUser->text());
|
|
||||||
settings.setValue("community/proxyPass", this->proxyPass->text());
|
|
||||||
|
|
||||||
settings.setValue("community/username", this->username->text());
|
|
||||||
settings.setValue("community/savePassword", this->savePassword->isChecked());
|
|
||||||
settings.setValue("community/userpassword", this->userpassword->text());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void CommunityPage::ProxyCheckChanged()
|
|
||||||
{
|
|
||||||
if (this->useProxy->isChecked() == false)
|
|
||||||
{
|
|
||||||
this->proxyAddress->setEnabled(false);
|
|
||||||
this->proxyPort->setEnabled(false);
|
|
||||||
this->proxyUser->setEnabled(false);
|
|
||||||
this->proxyPass->setEnabled(false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this->proxyAddress->setEnabled(true);
|
|
||||||
this->proxyPort->setEnabled(true);
|
|
||||||
this->proxyUser->setEnabled(true);
|
|
||||||
this->proxyPass->setEnabled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void CommunityPage::PasswordCheckChanged()
|
|
||||||
{
|
|
||||||
this->userpassword->setEnabled(this->savePassword->isChecked());
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
QGroupBox *CommunityPage::ServerGroup()
|
|
||||||
{
|
|
||||||
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
|
||||||
QApplication::applicationName());
|
|
||||||
|
|
||||||
QGroupBox *ServerGroup = new QGroupBox(tr("Server"));
|
|
||||||
QFormLayout *serverLayout = new QFormLayout;
|
|
||||||
|
|
||||||
CommunityPage::add_lineedit(&this->server, serverLayout,
|
|
||||||
settings.value("community/server", "community.valentina-project.org").toString(), tr("Server name/IP"));
|
|
||||||
|
|
||||||
CommunityPage::add_checkbox(&this->secureComm, serverLayout,
|
|
||||||
settings.value("community/serverSecure", 0).toBool(), tr("Secure connection"));
|
|
||||||
|
|
||||||
ServerGroup->setLayout(serverLayout);
|
|
||||||
return ServerGroup;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void CommunityPage::add_checkbox(QCheckBox** thebox, QFormLayout *layout, bool checked, QString label)
|
|
||||||
{
|
|
||||||
QLabel *labelbox = new QLabel(label);
|
|
||||||
(*thebox)= new QCheckBox;
|
|
||||||
(*thebox)->setChecked(checked);
|
|
||||||
layout->addRow(labelbox, *thebox);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void CommunityPage::add_lineedit(QLineEdit** theline, QFormLayout *layout, QString value, QString label)
|
|
||||||
{
|
|
||||||
QLabel *labelbox = new QLabel(label);
|
|
||||||
(*theline)= new QLineEdit;
|
|
||||||
(*theline)->setText(value);
|
|
||||||
layout->addRow(labelbox, *theline);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
QGroupBox *CommunityPage::ProxyGroup()
|
|
||||||
{
|
|
||||||
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
|
||||||
QApplication::applicationName());
|
|
||||||
QGroupBox *proxyGroup = new QGroupBox(tr("Proxy settings"));
|
|
||||||
|
|
||||||
QFormLayout *proxyLayout = new QFormLayout;
|
|
||||||
|
|
||||||
CommunityPage::add_checkbox(&this->useProxy, proxyLayout,
|
|
||||||
settings.value("community/useProxy", 0).toBool(), tr("Use Proxy"));
|
|
||||||
|
|
||||||
CommunityPage::add_lineedit(&this->proxyAddress, proxyLayout,
|
|
||||||
settings.value("community/proxyAddress", "").toString(), tr("Proxy address"));
|
|
||||||
|
|
||||||
CommunityPage::add_lineedit(&this->proxyPort, proxyLayout,
|
|
||||||
settings.value("community/proxyPort", "").toString(), tr("Proxy port"));
|
|
||||||
|
|
||||||
CommunityPage::add_lineedit(&this->proxyUser, proxyLayout,
|
|
||||||
settings.value("community/proxyUser", "").toString(), tr("Proxy user"));
|
|
||||||
|
|
||||||
CommunityPage::add_lineedit(&this->proxyPass, proxyLayout,
|
|
||||||
settings.value("community/proxyPass", "").toString(), tr("Proxy pass"));
|
|
||||||
|
|
||||||
connect(this->useProxy, &QCheckBox::stateChanged, this, &CommunityPage::ProxyCheckChanged);
|
|
||||||
this->ProxyCheckChanged();
|
|
||||||
|
|
||||||
proxyGroup->setLayout(proxyLayout);
|
|
||||||
|
|
||||||
return proxyGroup;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
QGroupBox *CommunityPage::UserGroup()
|
|
||||||
{
|
|
||||||
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
|
||||||
QApplication::applicationName());
|
|
||||||
QGroupBox *userGroup = new QGroupBox(tr("User settings"));
|
|
||||||
QFormLayout *userLayout = new QFormLayout;
|
|
||||||
|
|
||||||
CommunityPage::add_lineedit(&this->username, userLayout,
|
|
||||||
settings.value("community/username", "").toString(), tr("User Name"));
|
|
||||||
|
|
||||||
CommunityPage::add_checkbox(&this->savePassword, userLayout,
|
|
||||||
settings.value("community/savePassword", 0).toBool(), tr("Save password"));
|
|
||||||
|
|
||||||
CommunityPage::add_lineedit(&this->userpassword, userLayout,
|
|
||||||
settings.value("community/userpassword", "").toString(), tr("Password"));
|
|
||||||
|
|
||||||
connect(this->savePassword, &QCheckBox::stateChanged, this, &CommunityPage::PasswordCheckChanged);
|
|
||||||
this->PasswordCheckChanged();
|
|
||||||
|
|
||||||
userGroup->setLayout(userLayout);
|
|
||||||
|
|
||||||
return userGroup;
|
|
||||||
}
|
|
|
@ -24,14 +24,17 @@ HEADERS += \
|
||||||
dialogs/app/dialogincrements.h \
|
dialogs/app/dialogincrements.h \
|
||||||
dialogs/app/dialoghistory.h \
|
dialogs/app/dialoghistory.h \
|
||||||
dialogs/app/configdialog.h \
|
dialogs/app/configdialog.h \
|
||||||
dialogs/app/pages.h \
|
dialogs/app/configpages/pages.h \
|
||||||
dialogs/app/dialogpatternproperties.h \
|
dialogs/app/dialogpatternproperties.h \
|
||||||
dialogs/app/dialogmeasurements.h \
|
dialogs/app/dialogmeasurements.h \
|
||||||
dialogs/app/dialogstandardmeasurements.h \
|
dialogs/app/dialogstandardmeasurements.h \
|
||||||
dialogs/app/dialogindividualmeasurements.h \
|
dialogs/app/dialogindividualmeasurements.h \
|
||||||
dialogs/app/dialogaboutapp.h \
|
dialogs/app/dialogaboutapp.h \
|
||||||
dialogs/tools/dialogeditwrongformula.h \
|
dialogs/tools/dialogeditwrongformula.h \
|
||||||
dialogs/app/dialogpatternxmledit.h
|
dialogs/app/dialogpatternxmledit.h \
|
||||||
|
dialogs/app/configpages/configurationpage.h \
|
||||||
|
dialogs/app/configpages/patternpage.h \
|
||||||
|
dialogs/app/configpages/communitypage.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
dialogs/tools/dialogtriangle.cpp \
|
dialogs/tools/dialogtriangle.cpp \
|
||||||
|
@ -58,14 +61,16 @@ SOURCES += \
|
||||||
dialogs/app/dialogincrements.cpp \
|
dialogs/app/dialogincrements.cpp \
|
||||||
dialogs/app/dialoghistory.cpp \
|
dialogs/app/dialoghistory.cpp \
|
||||||
dialogs/app/configdialog.cpp \
|
dialogs/app/configdialog.cpp \
|
||||||
dialogs/app/pages.cpp \
|
|
||||||
dialogs/app/dialogpatternproperties.cpp \
|
dialogs/app/dialogpatternproperties.cpp \
|
||||||
dialogs/app/dialogmeasurements.cpp \
|
dialogs/app/dialogmeasurements.cpp \
|
||||||
dialogs/app/dialogstandardmeasurements.cpp \
|
dialogs/app/dialogstandardmeasurements.cpp \
|
||||||
dialogs/app/dialogindividualmeasurements.cpp \
|
dialogs/app/dialogindividualmeasurements.cpp \
|
||||||
dialogs/app/dialogaboutapp.cpp \
|
dialogs/app/dialogaboutapp.cpp \
|
||||||
dialogs/app/dialogpatternxmledit.cpp \
|
dialogs/app/dialogpatternxmledit.cpp \
|
||||||
dialogs/tools/dialogeditwrongformula.cpp
|
dialogs/tools/dialogeditwrongformula.cpp \
|
||||||
|
dialogs/app/configpages/configurationpage.cpp \
|
||||||
|
dialogs/app/configpages/patternpage.cpp \
|
||||||
|
dialogs/app/configpages/communitypage.cpp
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
dialogs/tools/dialogtriangle.ui \
|
dialogs/tools/dialogtriangle.ui \
|
||||||
|
|
Loading…
Reference in New Issue
Block a user