Refactoring Tape's preferences dialog.
Instead of manual declaring used Qt Designer. --HG-- branch : release
This commit is contained in:
parent
1ee0988f8a
commit
cade111206
|
@ -1,341 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
**
|
|
||||||
** @file tapeTapeConfigurationPage.cpp
|
|
||||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
||||||
** @date 02 08, 2015
|
|
||||||
**
|
|
||||||
** @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-2015 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 "tapeconfigurationpage.h"
|
|
||||||
#include "../../mapplication.h"
|
|
||||||
#include "../vmisc/vtapesettings.h"
|
|
||||||
#include "../vpatterndb/variables/vmeasurement.h"
|
|
||||||
#include <QDir>
|
|
||||||
#include <QGroupBox>
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QSettings>
|
|
||||||
#include <QTimer>
|
|
||||||
#include <QSpinBox>
|
|
||||||
#include <QComboBox>
|
|
||||||
#include <QMessageBox>
|
|
||||||
#include <QCheckBox>
|
|
||||||
#include <QIcon>
|
|
||||||
#include <QFormLayout>
|
|
||||||
#include <QDirIterator>
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
TapeConfigurationPage::TapeConfigurationPage(QWidget *parent)
|
|
||||||
: QWidget(parent),
|
|
||||||
langCombo(nullptr),
|
|
||||||
systemCombo(nullptr),
|
|
||||||
labelCombo(nullptr),
|
|
||||||
osOptionCheck(nullptr),
|
|
||||||
langChanged(false),
|
|
||||||
systemChanged(false),
|
|
||||||
defGradationChanged(false),
|
|
||||||
sendReportCheck(nullptr),
|
|
||||||
askPointDeletionCheck(nullptr),
|
|
||||||
toolBarStyleCheck(nullptr),
|
|
||||||
systemAuthorValueLabel(nullptr),
|
|
||||||
systemBookValueLabel(nullptr),
|
|
||||||
langGroup(nullptr),
|
|
||||||
guiLabel(nullptr),
|
|
||||||
separatorLabel(nullptr),
|
|
||||||
pmSystemGroup(nullptr),
|
|
||||||
systemLabel(nullptr),
|
|
||||||
systemAuthorLabel(nullptr),
|
|
||||||
systemBookLabel(nullptr),
|
|
||||||
gradationGroup(nullptr),
|
|
||||||
defHeightLabel(nullptr),
|
|
||||||
defSizeLabel(nullptr),
|
|
||||||
defHeightCombo(nullptr),
|
|
||||||
defSizeCombo(nullptr)
|
|
||||||
{
|
|
||||||
QGroupBox *langGroup = LangGroup();
|
|
||||||
QGroupBox *pmSystemGroup = PMSystemGroup();
|
|
||||||
QGroupBox *gradationBox = GradationGroup();
|
|
||||||
|
|
||||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
|
||||||
mainLayout->addWidget(langGroup);
|
|
||||||
mainLayout->addWidget(pmSystemGroup);
|
|
||||||
mainLayout->addWidget(gradationBox);
|
|
||||||
mainLayout->addStretch(1);
|
|
||||||
setLayout(mainLayout);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void TapeConfigurationPage::Apply()
|
|
||||||
{
|
|
||||||
VTapeSettings *settings = qApp->TapeSettings();
|
|
||||||
settings->SetOsSeparator(osOptionCheck->isChecked());
|
|
||||||
|
|
||||||
if (langChanged || systemChanged)
|
|
||||||
{
|
|
||||||
const QString locale = qvariant_cast<QString>(langCombo->itemData(langCombo->currentIndex()));
|
|
||||||
settings->SetLocale(locale);
|
|
||||||
langChanged = false;
|
|
||||||
|
|
||||||
const QString code = qvariant_cast<QString>(systemCombo->itemData(systemCombo->currentIndex()));
|
|
||||||
settings->SetPMSystemCode(code);
|
|
||||||
systemChanged = false;
|
|
||||||
|
|
||||||
qApp->LoadTranslation(locale);
|
|
||||||
qApp->processEvents();// force to call changeEvent
|
|
||||||
|
|
||||||
// Part about measurments will not be updated automatically
|
|
||||||
qApp->RetranslateTables();
|
|
||||||
qApp->RetranslateGroups();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (defGradationChanged)
|
|
||||||
{
|
|
||||||
settings->SetDefHeight(defHeightCombo->currentText().toInt());
|
|
||||||
settings->SetDefSize(defSizeCombo->currentText().toInt());
|
|
||||||
defGradationChanged = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void TapeConfigurationPage::changeEvent(QEvent *event)
|
|
||||||
{
|
|
||||||
if (event->type() == QEvent::LanguageChange)
|
|
||||||
{
|
|
||||||
// retranslate designer form (single inheritance approach)
|
|
||||||
RetranslateUi();
|
|
||||||
}
|
|
||||||
|
|
||||||
// remember to call base class implementation
|
|
||||||
QWidget::changeEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
QGroupBox *TapeConfigurationPage::LangGroup()
|
|
||||||
{
|
|
||||||
langGroup = new QGroupBox(tr("Language"));
|
|
||||||
guiLabel = new QLabel(tr("GUI language:"));
|
|
||||||
langCombo = new QComboBox;
|
|
||||||
|
|
||||||
QStringList fileNames;
|
|
||||||
QDirIterator it(qApp->translationsPath(), QStringList() << QStringList("valentina_*.qm"), QDir::Files,
|
|
||||||
QDirIterator::Subdirectories);
|
|
||||||
while (it.hasNext())
|
|
||||||
{
|
|
||||||
it.next();
|
|
||||||
fileNames.append(it.fileName());
|
|
||||||
}
|
|
||||||
|
|
||||||
bool englishUS = false;
|
|
||||||
const QString en_US = QStringLiteral("en_US");
|
|
||||||
|
|
||||||
for (int i = 0; i < fileNames.size(); ++i)
|
|
||||||
{
|
|
||||||
// get locale extracted by filename
|
|
||||||
QString locale = fileNames.at(i); // "valentina_de_De.qm"
|
|
||||||
locale.truncate(locale.lastIndexOf(QLatin1String("."))); // "valentina_de_De"
|
|
||||||
locale.remove(0, locale.indexOf(QLatin1String("_")) + 1); // "de_De"
|
|
||||||
|
|
||||||
if (not englishUS)
|
|
||||||
{
|
|
||||||
englishUS = (en_US == locale);
|
|
||||||
}
|
|
||||||
|
|
||||||
const QLocale loc(locale);
|
|
||||||
const QString lang = loc.nativeLanguageName();
|
|
||||||
QIcon ico(QString("%1/%2.png").arg("://flags").arg(QLocale::countryToString(loc.country())));
|
|
||||||
|
|
||||||
langCombo->addItem(ico, lang, locale);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (langCombo->count() == 0 || not englishUS)
|
|
||||||
{
|
|
||||||
// English language is internal and doens't have own *.qm file.
|
|
||||||
QIcon ico(QString("%1/%2.png").arg("://flags").arg(QLocale::countryToString(QLocale::UnitedStates)));
|
|
||||||
const QString lang = QLocale(en_US).nativeLanguageName();
|
|
||||||
langCombo->addItem(ico, lang, en_US);
|
|
||||||
}
|
|
||||||
|
|
||||||
// set default translators and language checked
|
|
||||||
const VTapeSettings *settings = qApp->TapeSettings();
|
|
||||||
qint32 index = langCombo->findData(settings->GetLocale());
|
|
||||||
if (index != -1)
|
|
||||||
{
|
|
||||||
langCombo->setCurrentIndex(index);
|
|
||||||
}
|
|
||||||
connect(langCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), RECEIVER(this)[this]()
|
|
||||||
{
|
|
||||||
langChanged = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
QFormLayout *langLayout = new QFormLayout;
|
|
||||||
langLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
|
||||||
langLayout->addRow(guiLabel, langCombo);
|
|
||||||
|
|
||||||
//-------------------- Decimal separator setup
|
|
||||||
separatorLabel = new QLabel(tr("Decimal separator parts:"));
|
|
||||||
|
|
||||||
osOptionCheck = new QCheckBox(tr("With OS options (%1)").arg(QLocale().decimalPoint()));
|
|
||||||
osOptionCheck->setChecked(settings->GetOsSeparator());
|
|
||||||
|
|
||||||
langLayout->addRow(separatorLabel, osOptionCheck);
|
|
||||||
//-----------------------
|
|
||||||
langGroup->setLayout(langLayout);
|
|
||||||
|
|
||||||
return langGroup;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
QGroupBox *TapeConfigurationPage::PMSystemGroup()
|
|
||||||
{
|
|
||||||
pmSystemGroup = new QGroupBox(tr("Pattern making system"));
|
|
||||||
|
|
||||||
systemLabel = new QLabel(tr("Pattern making system:"));
|
|
||||||
systemCombo = new QComboBox;
|
|
||||||
|
|
||||||
InitPMSystems(systemCombo);
|
|
||||||
|
|
||||||
QFormLayout *pmSystemLayout = new QFormLayout;
|
|
||||||
pmSystemLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
|
||||||
pmSystemLayout->addRow(systemLabel, systemCombo);
|
|
||||||
|
|
||||||
//----
|
|
||||||
systemAuthorLabel = new QLabel(tr("Author:"));
|
|
||||||
systemAuthorValueLabel = new QLabel("");
|
|
||||||
|
|
||||||
pmSystemLayout->addRow(systemAuthorLabel, systemAuthorValueLabel);
|
|
||||||
|
|
||||||
//----
|
|
||||||
systemBookLabel = new QLabel(tr("Book:"));
|
|
||||||
systemBookValueLabel = new QPlainTextEdit("");
|
|
||||||
systemBookValueLabel->setReadOnly(true);
|
|
||||||
systemBookValueLabel->setFixedHeight(4 * QFontMetrics(systemBookValueLabel->font()).lineSpacing());
|
|
||||||
|
|
||||||
pmSystemLayout->addRow(systemBookLabel, systemBookValueLabel);
|
|
||||||
|
|
||||||
connect(systemCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), RECEIVER(this)[this]()
|
|
||||||
{
|
|
||||||
systemChanged = true;
|
|
||||||
QString text = qApp->TrVars()->PMSystemAuthor(CURRENT_DATA(systemCombo).toString());
|
|
||||||
systemAuthorValueLabel->setText(text);
|
|
||||||
systemAuthorValueLabel->setToolTip(text);
|
|
||||||
text = qApp->TrVars()->PMSystemBook(CURRENT_DATA(systemCombo).toString());
|
|
||||||
systemBookValueLabel->setPlainText(text);
|
|
||||||
});
|
|
||||||
|
|
||||||
// set default pattern making system
|
|
||||||
const VTapeSettings *settings = qApp->TapeSettings();
|
|
||||||
const int index = systemCombo->findData(settings->GetPMSystemCode());
|
|
||||||
if (index != -1)
|
|
||||||
{
|
|
||||||
systemCombo->setCurrentIndex(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
pmSystemGroup->setLayout(pmSystemLayout);
|
|
||||||
return pmSystemGroup;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
QGroupBox *TapeConfigurationPage::GradationGroup()
|
|
||||||
{
|
|
||||||
gradationGroup = new QGroupBox(tr("Default height and size"));
|
|
||||||
|
|
||||||
QFormLayout *gradationLayout = new QFormLayout;
|
|
||||||
gradationLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
|
||||||
|
|
||||||
const VTapeSettings *settings = qApp->TapeSettings();
|
|
||||||
|
|
||||||
defHeightLabel = new QLabel(tr("Default height:"));
|
|
||||||
defHeightCombo = new QComboBox;
|
|
||||||
defHeightCombo->addItems(VMeasurement::WholeListHeights(Unit::Cm));
|
|
||||||
int index = defHeightCombo->findText(QString().setNum(settings->GetDefHeight()));
|
|
||||||
if (index != -1)
|
|
||||||
{
|
|
||||||
defHeightCombo->setCurrentIndex(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto DefGradationChanged = [this]()
|
|
||||||
{
|
|
||||||
defGradationChanged = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
connect(defHeightCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), RECEIVER(this)
|
|
||||||
DefGradationChanged);
|
|
||||||
gradationLayout->addRow(defHeightLabel, defHeightCombo);
|
|
||||||
|
|
||||||
|
|
||||||
defSizeLabel = new QLabel(tr("Default size:"));
|
|
||||||
defSizeCombo = new QComboBox;
|
|
||||||
defSizeCombo->addItems(VMeasurement::WholeListSizes(Unit::Cm));
|
|
||||||
index = defSizeCombo->findText(QString().setNum(settings->GetDefSize()));
|
|
||||||
if (index != -1)
|
|
||||||
{
|
|
||||||
defSizeCombo->setCurrentIndex(index);
|
|
||||||
}
|
|
||||||
connect(defHeightCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), RECEIVER(this)
|
|
||||||
DefGradationChanged);
|
|
||||||
gradationLayout->addRow(defSizeLabel, defSizeCombo);
|
|
||||||
|
|
||||||
gradationGroup->setLayout(gradationLayout);
|
|
||||||
return gradationGroup;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void TapeConfigurationPage::SetLabelComboBox(const QStringList &list)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < list.size(); ++i)
|
|
||||||
{
|
|
||||||
QLocale loc = QLocale(list.at(i));
|
|
||||||
labelCombo->addItem(loc.nativeLanguageName(), list.at(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void TapeConfigurationPage::RetranslateUi()
|
|
||||||
{
|
|
||||||
langGroup->setTitle(tr("Language"));
|
|
||||||
guiLabel->setText(tr("GUI language:"));
|
|
||||||
separatorLabel->setText(tr("Decimal separator parts:"));
|
|
||||||
osOptionCheck->setText(tr("With OS options (%1)").arg(QLocale().decimalPoint()));
|
|
||||||
|
|
||||||
pmSystemGroup->setTitle(tr("Pattern making system"));
|
|
||||||
systemLabel->setText(tr("Pattern making system:"));
|
|
||||||
|
|
||||||
const int index = systemCombo->currentIndex();
|
|
||||||
systemCombo->blockSignals(true);
|
|
||||||
systemCombo->clear();
|
|
||||||
InitPMSystems(systemCombo);
|
|
||||||
systemCombo->setCurrentIndex(index);
|
|
||||||
systemCombo->blockSignals(false);
|
|
||||||
|
|
||||||
systemAuthorLabel->setText(tr("Author:"));
|
|
||||||
systemBookLabel->setText(tr("Book:"));
|
|
||||||
|
|
||||||
QString text = qApp->TrVars()->PMSystemAuthor(CURRENT_DATA(systemCombo).toString());
|
|
||||||
systemAuthorValueLabel->setText(text);
|
|
||||||
systemAuthorValueLabel->setToolTip(text);
|
|
||||||
text = qApp->TrVars()->PMSystemBook(CURRENT_DATA(systemCombo).toString());
|
|
||||||
systemBookValueLabel->setPlainText(text);
|
|
||||||
|
|
||||||
gradationGroup->setTitle(tr("Default height and size"));
|
|
||||||
defHeightLabel->setText(tr("Default height:"));
|
|
||||||
defSizeLabel->setText(tr("Default size:"));
|
|
||||||
}
|
|
|
@ -1,87 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
**
|
|
||||||
** @file tapeconfigurationpage.h
|
|
||||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
||||||
** @date 02 08, 2015
|
|
||||||
**
|
|
||||||
** @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-2015 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 <QPlainTextEdit>
|
|
||||||
#include <QWidget>
|
|
||||||
|
|
||||||
class QCheckBox;
|
|
||||||
class QSpinBox;
|
|
||||||
class QComboBox;
|
|
||||||
class QGroupBox;
|
|
||||||
class QLabel;
|
|
||||||
|
|
||||||
class TapeConfigurationPage : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit TapeConfigurationPage(QWidget *parent = nullptr);
|
|
||||||
void Apply();
|
|
||||||
protected:
|
|
||||||
virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
|
|
||||||
private:
|
|
||||||
Q_DISABLE_COPY(TapeConfigurationPage)
|
|
||||||
QComboBox *langCombo;
|
|
||||||
QComboBox *systemCombo;
|
|
||||||
QComboBox *labelCombo;
|
|
||||||
QCheckBox *osOptionCheck;
|
|
||||||
bool langChanged;
|
|
||||||
bool systemChanged;
|
|
||||||
bool defGradationChanged;
|
|
||||||
QCheckBox *sendReportCheck;
|
|
||||||
QCheckBox *askPointDeletionCheck;
|
|
||||||
QCheckBox *toolBarStyleCheck;
|
|
||||||
QLabel *systemAuthorValueLabel;
|
|
||||||
QPlainTextEdit *systemBookValueLabel;
|
|
||||||
|
|
||||||
QGroupBox *langGroup;
|
|
||||||
QLabel *guiLabel;
|
|
||||||
QLabel *separatorLabel;
|
|
||||||
|
|
||||||
QGroupBox *pmSystemGroup;
|
|
||||||
QLabel *systemLabel;
|
|
||||||
QLabel *systemAuthorLabel;
|
|
||||||
QLabel *systemBookLabel;
|
|
||||||
|
|
||||||
QGroupBox *gradationGroup;
|
|
||||||
QLabel *defHeightLabel;
|
|
||||||
QLabel *defSizeLabel;
|
|
||||||
QComboBox *defHeightCombo;
|
|
||||||
QComboBox *defSizeCombo;
|
|
||||||
|
|
||||||
QGroupBox *LangGroup() Q_REQUIRED_RESULT;
|
|
||||||
QGroupBox *PMSystemGroup() Q_REQUIRED_RESULT;
|
|
||||||
QGroupBox *GradationGroup() Q_REQUIRED_RESULT;
|
|
||||||
void SetLabelComboBox(const QStringList &list);
|
|
||||||
void RetranslateUi();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // CONFIGURATIONPAGE_H
|
|
|
@ -1,255 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
**
|
|
||||||
** @file tapepathpage.cpp
|
|
||||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
||||||
** @date 02 08, 2015
|
|
||||||
**
|
|
||||||
** @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-2015 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 "tapepathpage.h"
|
|
||||||
#include "../../mapplication.h"
|
|
||||||
#include "../vmisc/vtapesettings.h"
|
|
||||||
#include <QDir>
|
|
||||||
#include <QGroupBox>
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QSettings>
|
|
||||||
#include <QTimer>
|
|
||||||
#include <QSpinBox>
|
|
||||||
#include <QComboBox>
|
|
||||||
#include <QMessageBox>
|
|
||||||
#include <QCheckBox>
|
|
||||||
#include <QIcon>
|
|
||||||
#include <QVBoxLayout>
|
|
||||||
#include <QTableWidget>
|
|
||||||
#include <QPushButton>
|
|
||||||
#include <QFileDialog>
|
|
||||||
#include <QHeaderView>
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
TapePathPage::TapePathPage(QWidget *parent)
|
|
||||||
: QWidget(parent),
|
|
||||||
defaultButton(nullptr),
|
|
||||||
editButton(nullptr),
|
|
||||||
pathTable(nullptr),
|
|
||||||
pathGroup(nullptr)
|
|
||||||
{
|
|
||||||
QGroupBox *pathGroup = PathGroup();
|
|
||||||
SCASSERT(pathGroup != nullptr)
|
|
||||||
|
|
||||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
|
||||||
mainLayout->addWidget(pathGroup);
|
|
||||||
mainLayout->addStretch(1);
|
|
||||||
setLayout(mainLayout);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void TapePathPage::Apply()
|
|
||||||
{
|
|
||||||
VTapeSettings *settings = qApp->TapeSettings();
|
|
||||||
settings->SetPathIndividualMeasurements(pathTable->item(0, 1)->text());
|
|
||||||
settings->SetPathStandardMeasurements(pathTable->item(1, 1)->text());
|
|
||||||
settings->SetPathTemplate(pathTable->item(2, 1)->text());
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void TapePathPage::DefaultPath()
|
|
||||||
{
|
|
||||||
const int row = pathTable->currentRow();
|
|
||||||
QTableWidgetItem *item = pathTable->item(row, 1);
|
|
||||||
SCASSERT(item != nullptr)
|
|
||||||
|
|
||||||
QString path;
|
|
||||||
switch (row)
|
|
||||||
{
|
|
||||||
case 0: // individual measurements
|
|
||||||
path = VCommonSettings::GetDefPathIndividualMeasurements();
|
|
||||||
break;
|
|
||||||
case 1: // standard measurements
|
|
||||||
path = VCommonSettings::GetDefPathStandardMeasurements();
|
|
||||||
break;
|
|
||||||
case 2: // templates
|
|
||||||
path = VCommonSettings::GetDefPathTemplate();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
item->setText(path);
|
|
||||||
item->setToolTip(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void TapePathPage::EditPath()
|
|
||||||
{
|
|
||||||
const int row = pathTable->currentRow();
|
|
||||||
QTableWidgetItem *item = pathTable->item(row, 1);
|
|
||||||
SCASSERT(item != nullptr)
|
|
||||||
|
|
||||||
QString path;
|
|
||||||
switch (row)
|
|
||||||
{
|
|
||||||
case 0: // individual measurements
|
|
||||||
path = qApp->TapeSettings()->GetPathIndividualMeasurements();
|
|
||||||
break;
|
|
||||||
case 1: // standard measurements
|
|
||||||
path = qApp->TapeSettings()->GetPathStandardMeasurements();
|
|
||||||
VCommonSettings::PrepareStandardTables(path);
|
|
||||||
break;
|
|
||||||
case 2: // templates
|
|
||||||
path = qApp->TapeSettings()->GetPathTemplate();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool usedNotExistedDir = false;
|
|
||||||
QDir directory(path);
|
|
||||||
if (not directory.exists())
|
|
||||||
{
|
|
||||||
usedNotExistedDir = directory.mkpath(".");
|
|
||||||
}
|
|
||||||
|
|
||||||
const QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"), path,
|
|
||||||
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
|
||||||
if (dir.isEmpty())
|
|
||||||
{
|
|
||||||
if (usedNotExistedDir)
|
|
||||||
{
|
|
||||||
QDir directory(path);
|
|
||||||
directory.rmpath(".");
|
|
||||||
}
|
|
||||||
|
|
||||||
DefaultPath();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
item->setText(dir);
|
|
||||||
item->setToolTip(dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void TapePathPage::changeEvent(QEvent *event)
|
|
||||||
{
|
|
||||||
if (event->type() == QEvent::LanguageChange)
|
|
||||||
{
|
|
||||||
// retranslate designer form (single inheritance approach)
|
|
||||||
RetranslateUi();
|
|
||||||
}
|
|
||||||
|
|
||||||
// remember to call base class implementation
|
|
||||||
QWidget::changeEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
QGroupBox *TapePathPage::PathGroup()
|
|
||||||
{
|
|
||||||
pathGroup = new QGroupBox(tr("Path that use Valentina"));
|
|
||||||
InitTable();
|
|
||||||
|
|
||||||
defaultButton = new QPushButton(tr("Default"));
|
|
||||||
defaultButton->setEnabled(false);
|
|
||||||
connect(defaultButton, &QPushButton::clicked, this, &TapePathPage::DefaultPath);
|
|
||||||
|
|
||||||
editButton = new QPushButton(tr("Edit"));
|
|
||||||
editButton->setEnabled(false);
|
|
||||||
connect(editButton, &QPushButton::clicked, this, &TapePathPage::EditPath);
|
|
||||||
|
|
||||||
QHBoxLayout *buttonsLayout = new QHBoxLayout;
|
|
||||||
buttonsLayout->addWidget(defaultButton);
|
|
||||||
buttonsLayout->addWidget(editButton);
|
|
||||||
|
|
||||||
QVBoxLayout *pathLayout = new QVBoxLayout;
|
|
||||||
pathLayout->addWidget(pathTable);
|
|
||||||
pathLayout->addLayout(buttonsLayout);
|
|
||||||
|
|
||||||
pathGroup->setLayout(pathLayout);
|
|
||||||
return pathGroup;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void TapePathPage::InitTable()
|
|
||||||
{
|
|
||||||
pathTable = new QTableWidget();
|
|
||||||
pathTable->setRowCount(3);
|
|
||||||
pathTable->setColumnCount(2);
|
|
||||||
pathTable->verticalHeader()->setVisible(false);
|
|
||||||
pathTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
|
||||||
pathTable->setSelectionBehavior(QAbstractItemView::SelectRows);
|
|
||||||
pathTable->setSelectionMode(QAbstractItemView::SingleSelection);
|
|
||||||
pathTable->setShowGrid(false);
|
|
||||||
|
|
||||||
const QStringList tableHeader = QStringList() << tr("Type") << tr("Path");
|
|
||||||
pathTable->setHorizontalHeaderLabels(tableHeader);
|
|
||||||
|
|
||||||
const VTapeSettings *settings = qApp->TapeSettings();
|
|
||||||
|
|
||||||
{
|
|
||||||
pathTable->setItem(0, 0, new QTableWidgetItem(tr("My Individual Measurements")));
|
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathIndividualMeasurements());
|
|
||||||
item->setToolTip(settings->GetPathIndividualMeasurements());
|
|
||||||
pathTable->setItem(0, 1, item);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
pathTable->setItem(1, 0, new QTableWidgetItem(tr("My Multisize Measurements")));
|
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathStandardMeasurements());
|
|
||||||
item->setToolTip(settings->GetPathStandardMeasurements());
|
|
||||||
pathTable->setItem(1, 1, item);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
pathTable->setItem(2, 0, new QTableWidgetItem(tr("My Templates")));
|
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathTemplate());
|
|
||||||
item->setToolTip(settings->GetPathTemplate());
|
|
||||||
pathTable->setItem(2, 1, item);
|
|
||||||
}
|
|
||||||
|
|
||||||
pathTable->verticalHeader()->setDefaultSectionSize(20);
|
|
||||||
pathTable->resizeColumnsToContents();
|
|
||||||
pathTable->resizeRowsToContents();
|
|
||||||
pathTable->horizontalHeader()->setStretchLastSection(true);
|
|
||||||
|
|
||||||
connect(pathTable, &QTableWidget::itemSelectionChanged, [this]
|
|
||||||
{
|
|
||||||
defaultButton->setEnabled(true);
|
|
||||||
defaultButton->setDefault(false);
|
|
||||||
|
|
||||||
editButton->setEnabled(true);
|
|
||||||
editButton->setDefault(true);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void TapePathPage::RetranslateUi()
|
|
||||||
{
|
|
||||||
pathGroup->setTitle(tr("Path that use Valentina"));
|
|
||||||
defaultButton->setText(tr("Default"));
|
|
||||||
editButton->setText(tr("Edit"));
|
|
||||||
|
|
||||||
const QStringList tableHeader = QStringList() << tr("Type") << tr("Path");
|
|
||||||
pathTable->setHorizontalHeaderLabels(tableHeader);
|
|
||||||
|
|
||||||
pathTable->item(0, 0)->setText(tr("My Individual Measurements"));
|
|
||||||
pathTable->item(1, 0)->setText(tr("My Multisize measurements"));
|
|
||||||
pathTable->item(2, 0)->setText(tr("My Templates"));
|
|
||||||
}
|
|
|
@ -0,0 +1,169 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file tapepreferencesconfigurationpage.cpp
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 12 4, 2017
|
||||||
|
**
|
||||||
|
** @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) 2017 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 "tapepreferencesconfigurationpage.h"
|
||||||
|
#include "ui_tapepreferencesconfigurationpage.h"
|
||||||
|
#include "../../mapplication.h"
|
||||||
|
#include "../vmisc/vtapesettings.h"
|
||||||
|
#include "../vpatterndb/variables/vmeasurement.h"
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
TapePreferencesConfigurationPage::TapePreferencesConfigurationPage(QWidget *parent)
|
||||||
|
: QWidget(parent),
|
||||||
|
ui(new Ui::TapePreferencesConfigurationPage),
|
||||||
|
m_langChanged(false),
|
||||||
|
m_systemChanged(false),
|
||||||
|
m_defGradationChanged(false)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
InitLanguages(ui->langCombo);
|
||||||
|
connect(ui->langCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, [this]()
|
||||||
|
{
|
||||||
|
m_langChanged = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
//-------------------- Decimal separator setup
|
||||||
|
ui->osOptionCheck->setText(tr("With OS options") + QString(" (%1)").arg(QLocale().decimalPoint()));
|
||||||
|
ui->osOptionCheck->setChecked(qApp->TapeSettings()->GetOsSeparator());
|
||||||
|
|
||||||
|
//---------------------- Pattern making system
|
||||||
|
InitPMSystems(ui->systemCombo);
|
||||||
|
ui->systemBookValueLabel->setFixedHeight(4 * QFontMetrics(ui->systemBookValueLabel->font()).lineSpacing());
|
||||||
|
connect(ui->systemCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, [this]()
|
||||||
|
{
|
||||||
|
m_systemChanged = true;
|
||||||
|
QString text = qApp->TrVars()->PMSystemAuthor(CURRENT_DATA(ui->systemCombo).toString());
|
||||||
|
ui->systemAuthorValueLabel->setText(text);
|
||||||
|
ui->systemAuthorValueLabel->setToolTip(text);
|
||||||
|
|
||||||
|
text = qApp->TrVars()->PMSystemBook(CURRENT_DATA(ui->systemCombo).toString());
|
||||||
|
ui->systemBookValueLabel->setPlainText(text);
|
||||||
|
});
|
||||||
|
|
||||||
|
// set default pattern making system
|
||||||
|
int index = ui->systemCombo->findData(qApp->TapeSettings()->GetPMSystemCode());
|
||||||
|
if (index != -1)
|
||||||
|
{
|
||||||
|
ui->systemCombo->setCurrentIndex(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------- Measurements Editing
|
||||||
|
connect(ui->resetWarningsButton, &QPushButton::released, []()
|
||||||
|
{
|
||||||
|
VTapeSettings *settings = qApp->TapeSettings();
|
||||||
|
|
||||||
|
settings->SetConfirmFormatRewriting(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
//----------------------- Toolbar
|
||||||
|
ui->toolBarStyleCheck->setChecked(qApp->TapeSettings()->GetToolBarStyle());
|
||||||
|
|
||||||
|
//---------------------------Default height and size
|
||||||
|
ui->defHeightCombo->addItems(VMeasurement::WholeListHeights(Unit::Cm));
|
||||||
|
index = ui->defHeightCombo->findText(QString().setNum(qApp->TapeSettings()->GetDefHeight()));
|
||||||
|
if (index != -1)
|
||||||
|
{
|
||||||
|
ui->defHeightCombo->setCurrentIndex(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto DefGradationChanged = [this]()
|
||||||
|
{
|
||||||
|
m_defGradationChanged = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
connect(ui->defHeightCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||||
|
DefGradationChanged);
|
||||||
|
|
||||||
|
ui->defSizeCombo->addItems(VMeasurement::WholeListSizes(Unit::Cm));
|
||||||
|
index = ui->defSizeCombo->findText(QString().setNum(qApp->TapeSettings()->GetDefSize()));
|
||||||
|
if (index != -1)
|
||||||
|
{
|
||||||
|
ui->defSizeCombo->setCurrentIndex(index);
|
||||||
|
}
|
||||||
|
connect(ui->defHeightCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||||
|
DefGradationChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
TapePreferencesConfigurationPage::~TapePreferencesConfigurationPage()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void TapePreferencesConfigurationPage::Apply()
|
||||||
|
{
|
||||||
|
VTapeSettings *settings = qApp->TapeSettings();
|
||||||
|
settings->SetOsSeparator(ui->osOptionCheck->isChecked());
|
||||||
|
|
||||||
|
settings->SetToolBarStyle(ui->toolBarStyleCheck->isChecked());
|
||||||
|
|
||||||
|
if (m_langChanged || m_systemChanged)
|
||||||
|
{
|
||||||
|
const QString locale = qvariant_cast<QString>(ui->langCombo->currentData());
|
||||||
|
settings->SetLocale(locale);
|
||||||
|
m_langChanged = false;
|
||||||
|
|
||||||
|
const QString code = qvariant_cast<QString>(ui->systemCombo->currentData());
|
||||||
|
settings->SetPMSystemCode(code);
|
||||||
|
m_systemChanged = false;
|
||||||
|
|
||||||
|
qApp->LoadTranslation(locale);
|
||||||
|
qApp->processEvents();// force to call changeEvent
|
||||||
|
|
||||||
|
// Part about measurments will not be updated automatically
|
||||||
|
qApp->RetranslateTables();
|
||||||
|
qApp->RetranslateGroups();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_defGradationChanged)
|
||||||
|
{
|
||||||
|
settings->SetDefHeight(ui->defHeightCombo->currentText().toInt());
|
||||||
|
settings->SetDefSize(ui->defSizeCombo->currentText().toInt());
|
||||||
|
m_defGradationChanged = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void TapePreferencesConfigurationPage::changeEvent(QEvent *event)
|
||||||
|
{
|
||||||
|
if (event->type() == QEvent::LanguageChange)
|
||||||
|
{
|
||||||
|
// retranslate designer form (single inheritance approach)
|
||||||
|
RetranslateUi();
|
||||||
|
}
|
||||||
|
// remember to call base class implementation
|
||||||
|
QWidget::changeEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void TapePreferencesConfigurationPage::RetranslateUi()
|
||||||
|
{
|
||||||
|
ui->osOptionCheck->setText(tr("With OS options") + QString(" (%1)").arg(QLocale().decimalPoint()));
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file tapepreferencesconfigurationpage.h
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 12 4, 2017
|
||||||
|
**
|
||||||
|
** @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) 2017 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 TAPEPREFERENCESCONFIGURATIONPAGE_H
|
||||||
|
#define TAPEPREFERENCESCONFIGURATIONPAGE_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
namespace Ui
|
||||||
|
{
|
||||||
|
class TapePreferencesConfigurationPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
class TapePreferencesConfigurationPage : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit TapePreferencesConfigurationPage(QWidget *parent = nullptr);
|
||||||
|
virtual ~TapePreferencesConfigurationPage();
|
||||||
|
|
||||||
|
void Apply();
|
||||||
|
protected:
|
||||||
|
virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
|
||||||
|
private:
|
||||||
|
Q_DISABLE_COPY(TapePreferencesConfigurationPage)
|
||||||
|
Ui::TapePreferencesConfigurationPage *ui;
|
||||||
|
bool m_langChanged;
|
||||||
|
bool m_systemChanged;
|
||||||
|
bool m_defGradationChanged;
|
||||||
|
|
||||||
|
void RetranslateUi();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // TAPEPREFERENCESCONFIGURATIONPAGE_H
|
|
@ -0,0 +1,202 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>TapePreferencesConfigurationPage</class>
|
||||||
|
<widget class="QWidget" name="TapePreferencesConfigurationPage">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>501</width>
|
||||||
|
<height>526</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string notr="true">Configuration</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
|
<property name="title">
|
||||||
|
<string>Language</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QFormLayout" name="formLayout">
|
||||||
|
<property name="fieldGrowthPolicy">
|
||||||
|
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>GUI language:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QComboBox" name="langCombo"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Decimal separator parts:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QCheckBox" name="osOptionCheck">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">< With OS options ></string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_3">
|
||||||
|
<property name="title">
|
||||||
|
<string>Pattern making system</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QFormLayout" name="formLayout_2">
|
||||||
|
<property name="fieldGrowthPolicy">
|
||||||
|
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="text">
|
||||||
|
<string>Pattern making system:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QComboBox" name="systemCombo"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_7">
|
||||||
|
<property name="text">
|
||||||
|
<string>Author:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLabel" name="systemAuthorValueLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">author</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label_9">
|
||||||
|
<property name="text">
|
||||||
|
<string>Book:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QPlainTextEdit" name="systemBookValueLabel">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_5">
|
||||||
|
<property name="title">
|
||||||
|
<string>Measurements editing</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="resetWarningsButton">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Reset warnings</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_6">
|
||||||
|
<property name="title">
|
||||||
|
<string>Toolbar</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="toolBarStyleCheck">
|
||||||
|
<property name="text">
|
||||||
|
<string>The text appears under the icon (recommended for beginners).</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Default height and size</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QFormLayout" name="formLayout_3">
|
||||||
|
<property name="fieldGrowthPolicy">
|
||||||
|
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Default height:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QComboBox" name="defHeightCombo"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>Default size:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QComboBox" name="defSizeCombo"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
183
src/app/tape/dialogs/configpages/tapepreferencespathpage.cpp
Normal file
183
src/app/tape/dialogs/configpages/tapepreferencespathpage.cpp
Normal file
|
@ -0,0 +1,183 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file tapepreferencespathpage.cpp
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 12 4, 2017
|
||||||
|
**
|
||||||
|
** @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) 2017 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 "tapepreferencespathpage.h"
|
||||||
|
#include "ui_tapepreferencespathpage.h"
|
||||||
|
#include "../../mapplication.h"
|
||||||
|
#include "../vmisc/vtapesettings.h"
|
||||||
|
|
||||||
|
#include <QDir>
|
||||||
|
#include <QFileDialog>
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
TapePreferencesPathPage::TapePreferencesPathPage(QWidget *parent)
|
||||||
|
: QWidget(parent),
|
||||||
|
ui(new Ui::TapePreferencesPathPage)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
InitTable();
|
||||||
|
|
||||||
|
connect(ui->defaultButton, &QPushButton::clicked, this, &TapePreferencesPathPage::DefaultPath);
|
||||||
|
connect(ui->editButton, &QPushButton::clicked, this, &TapePreferencesPathPage::EditPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
TapePreferencesPathPage::~TapePreferencesPathPage()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void TapePreferencesPathPage::Apply()
|
||||||
|
{
|
||||||
|
VTapeSettings *settings = qApp->TapeSettings();
|
||||||
|
settings->SetPathIndividualMeasurements(ui->pathTable->item(0, 1)->text());
|
||||||
|
settings->SetPathStandardMeasurements(ui->pathTable->item(1, 1)->text());
|
||||||
|
settings->SetPathTemplate(ui->pathTable->item(2, 1)->text());
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void TapePreferencesPathPage::DefaultPath()
|
||||||
|
{
|
||||||
|
const int row = ui->pathTable->currentRow();
|
||||||
|
QTableWidgetItem *item = ui->pathTable->item(row, 1);
|
||||||
|
SCASSERT(item != nullptr)
|
||||||
|
|
||||||
|
QString path;
|
||||||
|
switch (row)
|
||||||
|
{
|
||||||
|
case 0: // individual measurements
|
||||||
|
path = VCommonSettings::GetDefPathIndividualMeasurements();
|
||||||
|
break;
|
||||||
|
case 1: // standard measurements
|
||||||
|
path = VCommonSettings::GetDefPathStandardMeasurements();
|
||||||
|
break;
|
||||||
|
case 2: // templates
|
||||||
|
path = VCommonSettings::GetDefPathTemplate();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
item->setText(path);
|
||||||
|
item->setToolTip(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void TapePreferencesPathPage::EditPath()
|
||||||
|
{
|
||||||
|
const int row = ui->pathTable->currentRow();
|
||||||
|
QTableWidgetItem *item = ui->pathTable->item(row, 1);
|
||||||
|
SCASSERT(item != nullptr)
|
||||||
|
|
||||||
|
QString path;
|
||||||
|
switch (row)
|
||||||
|
{
|
||||||
|
case 0: // individual measurements
|
||||||
|
path = qApp->TapeSettings()->GetPathIndividualMeasurements();
|
||||||
|
break;
|
||||||
|
case 1: // standard measurements
|
||||||
|
path = qApp->TapeSettings()->GetPathStandardMeasurements();
|
||||||
|
VCommonSettings::PrepareStandardTables(path);
|
||||||
|
break;
|
||||||
|
case 2: // templates
|
||||||
|
path = qApp->TapeSettings()->GetPathTemplate();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool usedNotExistedDir = false;
|
||||||
|
QDir directory(path);
|
||||||
|
if (not directory.exists())
|
||||||
|
{
|
||||||
|
usedNotExistedDir = directory.mkpath(".");
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"), path,
|
||||||
|
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
||||||
|
if (dir.isEmpty())
|
||||||
|
{
|
||||||
|
if (usedNotExistedDir)
|
||||||
|
{
|
||||||
|
QDir directory(path);
|
||||||
|
directory.rmpath(".");
|
||||||
|
}
|
||||||
|
|
||||||
|
DefaultPath();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
item->setText(dir);
|
||||||
|
item->setToolTip(dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void TapePreferencesPathPage::InitTable()
|
||||||
|
{
|
||||||
|
ui->pathTable->setRowCount(3);
|
||||||
|
ui->pathTable->setColumnCount(2);
|
||||||
|
|
||||||
|
const VTapeSettings *settings = qApp->TapeSettings();
|
||||||
|
|
||||||
|
{
|
||||||
|
ui->pathTable->setItem(0, 0, new QTableWidgetItem(tr("My Individual Measurements")));
|
||||||
|
QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathIndividualMeasurements());
|
||||||
|
item->setToolTip(settings->GetPathIndividualMeasurements());
|
||||||
|
ui->pathTable->setItem(0, 1, item);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
ui->pathTable->setItem(1, 0, new QTableWidgetItem(tr("My Multisize Measurements")));
|
||||||
|
QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathStandardMeasurements());
|
||||||
|
item->setToolTip(settings->GetPathStandardMeasurements());
|
||||||
|
ui->pathTable->setItem(1, 1, item);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
ui->pathTable->setItem(2, 0, new QTableWidgetItem(tr("My Templates")));
|
||||||
|
QTableWidgetItem *item = new QTableWidgetItem(settings->GetPathTemplate());
|
||||||
|
item->setToolTip(settings->GetPathTemplate());
|
||||||
|
ui->pathTable->setItem(2, 1, item);
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->pathTable->verticalHeader()->setDefaultSectionSize(20);
|
||||||
|
ui->pathTable->resizeColumnsToContents();
|
||||||
|
ui->pathTable->resizeRowsToContents();
|
||||||
|
ui->pathTable->horizontalHeader()->setStretchLastSection(true);
|
||||||
|
|
||||||
|
connect(ui->pathTable, &QTableWidget::itemSelectionChanged, this, [this]()
|
||||||
|
{
|
||||||
|
ui->defaultButton->setEnabled(true);
|
||||||
|
ui->defaultButton->setDefault(false);
|
||||||
|
|
||||||
|
ui->editButton->setEnabled(true);
|
||||||
|
ui->editButton->setDefault(true);
|
||||||
|
});
|
||||||
|
}
|
|
@ -1,14 +1,14 @@
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
**
|
**
|
||||||
** @file tapepathpage.h
|
** @file tapepreferencespathpage.h
|
||||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
** @date 02 08, 2015
|
** @date 12 4, 2017
|
||||||
**
|
**
|
||||||
** @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-2015 Valentina project
|
** Copyright (C) 2017 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,37 +26,33 @@
|
||||||
**
|
**
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#ifndef PATHPAGE_H
|
#ifndef TAPEPREFERENCESPATHPAGE_H
|
||||||
#define PATHPAGE_H
|
#define TAPEPREFERENCESPATHPAGE_H
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
class QGroupBox;
|
namespace Ui
|
||||||
class QPushButton;
|
{
|
||||||
class QTableWidget;
|
class TapePreferencesPathPage;
|
||||||
|
}
|
||||||
|
|
||||||
class TapePathPage : public QWidget
|
class TapePreferencesPathPage : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TapePathPage(QWidget *parent = nullptr);
|
explicit TapePreferencesPathPage(QWidget *parent = nullptr);
|
||||||
void Apply();
|
virtual ~TapePreferencesPathPage();
|
||||||
protected:
|
|
||||||
virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
|
void Apply();
|
||||||
private slots:
|
private slots:
|
||||||
void DefaultPath();
|
void DefaultPath();
|
||||||
void EditPath();
|
void EditPath();
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(TapePathPage)
|
Q_DISABLE_COPY(TapePreferencesPathPage)
|
||||||
QPushButton *defaultButton;
|
Ui::TapePreferencesPathPage *ui;
|
||||||
QPushButton *editButton;
|
|
||||||
QTableWidget *pathTable;
|
|
||||||
QGroupBox *pathGroup;
|
|
||||||
|
|
||||||
QGroupBox *PathGroup() Q_REQUIRED_RESULT;
|
void InitTable();
|
||||||
void InitTable();
|
|
||||||
void RetranslateUi();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PATHPAGE_H
|
#endif // TAPEPREFERENCESPATHPAGE_H
|
111
src/app/tape/dialogs/configpages/tapepreferencespathpage.ui
Normal file
111
src/app/tape/dialogs/configpages/tapepreferencespathpage.ui
Normal file
|
@ -0,0 +1,111 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>TapePreferencesPathPage</class>
|
||||||
|
<widget class="QWidget" name="TapePreferencesPathPage">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>375</width>
|
||||||
|
<height>276</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string notr="true">Paths</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Paths that Valentina uses</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QTableWidget" name="pathTable">
|
||||||
|
<property name="editTriggers">
|
||||||
|
<set>QAbstractItemView::NoEditTriggers</set>
|
||||||
|
</property>
|
||||||
|
<property name="selectionMode">
|
||||||
|
<enum>QAbstractItemView::SingleSelection</enum>
|
||||||
|
</property>
|
||||||
|
<property name="selectionBehavior">
|
||||||
|
<enum>QAbstractItemView::SelectRows</enum>
|
||||||
|
</property>
|
||||||
|
<property name="showGrid">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<attribute name="horizontalHeaderStretchLastSection">
|
||||||
|
<bool>true</bool>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="verticalHeaderVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Type</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Path</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="defaultButton">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Default</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="editButton">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Edit</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
137
src/app/tape/dialogs/dialogtapepreferences.cpp
Normal file
137
src/app/tape/dialogs/dialogtapepreferences.cpp
Normal file
|
@ -0,0 +1,137 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file dialogtapepreferences.cpp
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 12 4, 2017
|
||||||
|
**
|
||||||
|
** @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) 2017 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 "dialogtapepreferences.h"
|
||||||
|
#include "ui_dialogtapepreferences.h"
|
||||||
|
#include "../mapplication.h"
|
||||||
|
#include "configpages/tapepreferencesconfigurationpage.h"
|
||||||
|
#include "configpages/tapepreferencespathpage.h"
|
||||||
|
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QShowEvent>
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
DialogTapePreferences::DialogTapePreferences(QWidget *parent)
|
||||||
|
:QDialog(parent),
|
||||||
|
ui(new Ui::DialogTapePreferences),
|
||||||
|
m_isInitialized(false),
|
||||||
|
m_configurationPage(new TapePreferencesConfigurationPage),
|
||||||
|
m_pathPage(new TapePreferencesPathPage)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
|
||||||
|
|
||||||
|
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||||
|
SCASSERT(bOk != nullptr)
|
||||||
|
connect(bOk, &QPushButton::clicked, this, &DialogTapePreferences::Ok);
|
||||||
|
|
||||||
|
QPushButton *bApply = ui->buttonBox->button(QDialogButtonBox::Apply);
|
||||||
|
SCASSERT(bApply != nullptr)
|
||||||
|
connect(bApply, &QPushButton::clicked, this, &DialogTapePreferences::Apply);
|
||||||
|
|
||||||
|
ui->pagesWidget->insertWidget(0, m_configurationPage);
|
||||||
|
ui->pagesWidget->insertWidget(1, m_pathPage);
|
||||||
|
|
||||||
|
connect(ui->contentsWidget, &QListWidget::currentItemChanged, this, &DialogTapePreferences::PageChanged);
|
||||||
|
ui->pagesWidget->setCurrentIndex(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
DialogTapePreferences::~DialogTapePreferences()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogTapePreferences::showEvent(QShowEvent *event)
|
||||||
|
{
|
||||||
|
QDialog::showEvent( event );
|
||||||
|
if ( event->spontaneous() )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_isInitialized)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// do your init stuff here
|
||||||
|
|
||||||
|
setMinimumSize(size());
|
||||||
|
|
||||||
|
QSize sz = qApp->Settings()->GetPreferenceDialogSize();
|
||||||
|
if (sz.isEmpty() == false)
|
||||||
|
{
|
||||||
|
resize(sz);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_isInitialized = true;//first show windows are held
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogTapePreferences::resizeEvent(QResizeEvent *event)
|
||||||
|
{
|
||||||
|
Q_UNUSED(event)
|
||||||
|
// remember the size for the next time this dialog is opened, but only
|
||||||
|
// if widget was already initialized, which rules out the resize at
|
||||||
|
// dialog creating, which would
|
||||||
|
if (m_isInitialized)
|
||||||
|
{
|
||||||
|
qApp->Settings()->SetPreferenceDialogSize(size());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogTapePreferences::Apply()
|
||||||
|
{
|
||||||
|
m_configurationPage->Apply();
|
||||||
|
m_pathPage->Apply();
|
||||||
|
|
||||||
|
qApp->TapeSettings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
|
||||||
|
emit UpdateProperties();
|
||||||
|
setResult(QDialog::Accepted);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogTapePreferences::Ok()
|
||||||
|
{
|
||||||
|
Apply();
|
||||||
|
done(QDialog::Accepted);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogTapePreferences::PageChanged(QListWidgetItem *current, QListWidgetItem *previous)
|
||||||
|
{
|
||||||
|
if (current == nullptr)
|
||||||
|
{
|
||||||
|
current = previous;
|
||||||
|
}
|
||||||
|
int rowIndex = ui->contentsWidget->row(current);
|
||||||
|
ui->pagesWidget->setCurrentIndex(rowIndex);
|
||||||
|
}
|
|
@ -1,14 +1,14 @@
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
**
|
**
|
||||||
** @file tapeconfigdialog.h
|
** @file dialogtapepreferences.h
|
||||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
** @date 02 08, 2015
|
** @date 12 4, 2017
|
||||||
**
|
**
|
||||||
** @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-2015 Valentina project
|
** Copyright (C) 2017 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,46 +26,42 @@
|
||||||
**
|
**
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#ifndef CONFIGDIALOG_H
|
#ifndef DIALOGTAPEPREFERENCES_H
|
||||||
#define CONFIGDIALOG_H
|
#define DIALOGTAPEPREFERENCES_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include "configpages/tapeconfigurationpage.h"
|
|
||||||
#include "configpages/tapepathpage.h"
|
|
||||||
|
|
||||||
|
namespace Ui
|
||||||
|
{
|
||||||
|
class DialogTapePreferences;
|
||||||
|
}
|
||||||
|
|
||||||
|
class TapePreferencesConfigurationPage;
|
||||||
|
class TapePreferencesPathPage;
|
||||||
class QListWidgetItem;
|
class QListWidgetItem;
|
||||||
class QStackedWidget;
|
|
||||||
class QListWidget;
|
|
||||||
|
|
||||||
class TapeConfigDialog : public QDialog
|
class DialogTapePreferences : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TapeConfigDialog(QWidget *parent = nullptr);
|
explicit DialogTapePreferences(QWidget *parent = nullptr);
|
||||||
|
virtual ~DialogTapePreferences();
|
||||||
signals:
|
signals:
|
||||||
void UpdateProperties();
|
void UpdateProperties();
|
||||||
protected:
|
protected:
|
||||||
virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
|
|
||||||
virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
|
|
||||||
virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
|
virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
|
||||||
virtual void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
|
virtual void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
|
||||||
private:
|
private slots:
|
||||||
Q_DISABLE_COPY(TapeConfigDialog)
|
|
||||||
QListWidget *contentsWidget;
|
|
||||||
QStackedWidget *pagesWidget;
|
|
||||||
TapeConfigurationPage *configurationPage;
|
|
||||||
TapePathPage *pathPage;
|
|
||||||
QPushButton *applyButton;
|
|
||||||
QPushButton *cancelButton;
|
|
||||||
QPushButton *okButton;
|
|
||||||
bool isInitialized;
|
|
||||||
|
|
||||||
void createIcons();
|
|
||||||
void createIcon(const QString &icon, const QString &text);
|
|
||||||
void Apply();
|
void Apply();
|
||||||
void Ok();
|
void Ok();
|
||||||
|
void PageChanged(QListWidgetItem *current, QListWidgetItem *previous);
|
||||||
void RetranslateUi();
|
private:
|
||||||
|
Q_DISABLE_COPY(DialogTapePreferences)
|
||||||
|
Ui::DialogTapePreferences *ui;
|
||||||
|
bool m_isInitialized;
|
||||||
|
TapePreferencesConfigurationPage *m_configurationPage;
|
||||||
|
TapePreferencesPathPage *m_pathPage;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CONFIGDIALOG_H
|
#endif // DIALOGTAPEPREFERENCES_H
|
143
src/app/tape/dialogs/dialogtapepreferences.ui
Normal file
143
src/app/tape/dialogs/dialogtapepreferences.ui
Normal file
|
@ -0,0 +1,143 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>DialogTapePreferences</class>
|
||||||
|
<widget class="QDialog" name="DialogTapePreferences">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>831</width>
|
||||||
|
<height>669</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Preferences</string>
|
||||||
|
</property>
|
||||||
|
<property name="windowIcon">
|
||||||
|
<iconset resource="../share/resources/tapeicon.qrc">
|
||||||
|
<normaloff>:/tapeicon/64x64/logo.png</normaloff>:/tapeicon/64x64/logo.png</iconset>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QListWidget" name="contentsWidget">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>128</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>128</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>96</width>
|
||||||
|
<height>84</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="textElideMode">
|
||||||
|
<enum>Qt::ElideMiddle</enum>
|
||||||
|
</property>
|
||||||
|
<property name="movement">
|
||||||
|
<enum>QListView::Static</enum>
|
||||||
|
</property>
|
||||||
|
<property name="spacing">
|
||||||
|
<number>12</number>
|
||||||
|
</property>
|
||||||
|
<property name="viewMode">
|
||||||
|
<enum>QListView::IconMode</enum>
|
||||||
|
</property>
|
||||||
|
<property name="currentRow">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Configuration</string>
|
||||||
|
</property>
|
||||||
|
<property name="textAlignment">
|
||||||
|
<set>AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../../libs/vmisc/share/resources/icon.qrc">
|
||||||
|
<normaloff>:/icon/config.png</normaloff>:/icon/config.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="flags">
|
||||||
|
<set>ItemIsSelectable|ItemIsUserCheckable|ItemIsEnabled</set>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Paths</string>
|
||||||
|
</property>
|
||||||
|
<property name="textAlignment">
|
||||||
|
<set>AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../../libs/vmisc/share/resources/icon.qrc">
|
||||||
|
<normaloff>:/icon/path_config.png</normaloff>:/icon/path_config.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="flags">
|
||||||
|
<set>ItemIsSelectable|ItemIsUserCheckable|ItemIsEnabled</set>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QStackedWidget" name="pagesWidget">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="sizeIncrement">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="page_2"/>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources>
|
||||||
|
<include location="../share/resources/tapeicon.qrc"/>
|
||||||
|
<include location="../../../libs/vmisc/share/resources/icon.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>DialogTapePreferences</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>316</x>
|
||||||
|
<y>260</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
|
@ -1,219 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
**
|
|
||||||
** @file tapeconfigdialog.cpp
|
|
||||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
||||||
** @date 02 08, 2015
|
|
||||||
**
|
|
||||||
** @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-2015 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 "tapeconfigdialog.h"
|
|
||||||
#include <QListWidget>
|
|
||||||
#include <QPushButton>
|
|
||||||
#include <QHBoxLayout>
|
|
||||||
#include <QVBoxLayout>
|
|
||||||
#include <QStackedWidget>
|
|
||||||
#include <QCloseEvent>
|
|
||||||
#include "../mapplication.h"
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
TapeConfigDialog::TapeConfigDialog(QWidget *parent)
|
|
||||||
:QDialog(parent),
|
|
||||||
contentsWidget(nullptr),
|
|
||||||
pagesWidget(nullptr),
|
|
||||||
configurationPage(nullptr),
|
|
||||||
pathPage(nullptr),
|
|
||||||
applyButton(nullptr),
|
|
||||||
cancelButton(nullptr),
|
|
||||||
okButton(nullptr),
|
|
||||||
isInitialized(false)
|
|
||||||
{
|
|
||||||
contentsWidget = new QListWidget;
|
|
||||||
contentsWidget->setViewMode(QListView::IconMode);
|
|
||||||
contentsWidget->setIconSize(QSize(96, 84));
|
|
||||||
contentsWidget->setMovement(QListView::Static);
|
|
||||||
contentsWidget->setMaximumWidth(130);
|
|
||||||
contentsWidget->setMinimumWidth(130);
|
|
||||||
contentsWidget->setMinimumHeight(260);
|
|
||||||
contentsWidget->setSpacing(12);
|
|
||||||
|
|
||||||
pagesWidget = new QStackedWidget;
|
|
||||||
pagesWidget->setMinimumWidth(550);
|
|
||||||
|
|
||||||
configurationPage = new TapeConfigurationPage();
|
|
||||||
pagesWidget->addWidget(configurationPage);
|
|
||||||
|
|
||||||
pathPage = new TapePathPage();
|
|
||||||
pagesWidget->addWidget(pathPage);
|
|
||||||
|
|
||||||
applyButton = new QPushButton(tr("Apply"));
|
|
||||||
cancelButton = new QPushButton(tr("&Cancel"));
|
|
||||||
okButton = new QPushButton(tr("&Ok"));
|
|
||||||
|
|
||||||
createIcons();
|
|
||||||
connect(contentsWidget, &QListWidget::currentItemChanged,
|
|
||||||
RECEIVER(this)[this](QListWidgetItem *current, QListWidgetItem *previous)
|
|
||||||
{
|
|
||||||
if (current == nullptr)
|
|
||||||
{
|
|
||||||
current = previous;
|
|
||||||
}
|
|
||||||
pagesWidget->setCurrentIndex(contentsWidget->row(current));
|
|
||||||
});
|
|
||||||
contentsWidget->setCurrentRow(0);
|
|
||||||
|
|
||||||
connect(cancelButton, &QPushButton::clicked, this, &TapeConfigDialog::close);
|
|
||||||
connect(applyButton, &QPushButton::clicked, this, &TapeConfigDialog::Apply);
|
|
||||||
connect(okButton, &QPushButton::clicked, this, &TapeConfigDialog::Ok);
|
|
||||||
|
|
||||||
QHBoxLayout *horizontalLayout = new QHBoxLayout;
|
|
||||||
horizontalLayout->addWidget(contentsWidget);
|
|
||||||
horizontalLayout->addWidget(pagesWidget, 1);
|
|
||||||
|
|
||||||
QHBoxLayout *buttonsLayout = new QHBoxLayout;
|
|
||||||
buttonsLayout->addStretch(1);
|
|
||||||
buttonsLayout->addWidget(applyButton);
|
|
||||||
buttonsLayout->addWidget(cancelButton);
|
|
||||||
buttonsLayout->addWidget(okButton);
|
|
||||||
|
|
||||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
|
||||||
mainLayout->addLayout(horizontalLayout);
|
|
||||||
mainLayout->addSpacing(12);
|
|
||||||
mainLayout->addLayout(buttonsLayout);
|
|
||||||
setLayout(mainLayout);
|
|
||||||
|
|
||||||
mainLayout->setStretch(0, 1);
|
|
||||||
|
|
||||||
setWindowTitle(tr("Config Dialog"));
|
|
||||||
|
|
||||||
qApp->TapeSettings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void TapeConfigDialog::closeEvent(QCloseEvent *event)
|
|
||||||
{
|
|
||||||
if (result() == QDialog::Accepted)
|
|
||||||
{
|
|
||||||
done(QDialog::Accepted);
|
|
||||||
}
|
|
||||||
event->accept();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void TapeConfigDialog::changeEvent(QEvent *event)
|
|
||||||
{
|
|
||||||
if (event->type() == QEvent::LanguageChange)
|
|
||||||
{
|
|
||||||
// retranslate designer form (single inheritance approach)
|
|
||||||
RetranslateUi();
|
|
||||||
}
|
|
||||||
|
|
||||||
// remember to call base class implementation
|
|
||||||
QDialog::changeEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void TapeConfigDialog::showEvent(QShowEvent *event)
|
|
||||||
{
|
|
||||||
QDialog::showEvent( event );
|
|
||||||
if ( event->spontaneous() )
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isInitialized)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// do your init stuff here
|
|
||||||
|
|
||||||
setMinimumSize(size());
|
|
||||||
|
|
||||||
QSize sz = qApp->Settings()->GetPreferenceDialogSize();
|
|
||||||
if (sz.isEmpty() == false)
|
|
||||||
{
|
|
||||||
resize(sz);
|
|
||||||
}
|
|
||||||
|
|
||||||
isInitialized = true;//first show windows are held
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void TapeConfigDialog::resizeEvent(QResizeEvent *event)
|
|
||||||
{
|
|
||||||
Q_UNUSED(event)
|
|
||||||
// remember the size for the next time this dialog is opened, but only
|
|
||||||
// if widget was already initialized, which rules out the resize at
|
|
||||||
// dialog creating, which would
|
|
||||||
if (isInitialized == true)
|
|
||||||
{
|
|
||||||
qApp->Settings()->SetPreferenceDialogSize(size());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void TapeConfigDialog::createIcons()
|
|
||||||
{
|
|
||||||
createIcon("://icon/config.png", tr("Configuration"));
|
|
||||||
createIcon("://icon/path_config.png", tr("Paths"));
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void TapeConfigDialog::createIcon(const QString &icon, const QString &text)
|
|
||||||
{
|
|
||||||
SCASSERT(contentsWidget != nullptr)
|
|
||||||
|
|
||||||
QListWidgetItem *button = new QListWidgetItem(contentsWidget);
|
|
||||||
button->setIcon(QIcon(icon));
|
|
||||||
button->setText(text);
|
|
||||||
button->setTextAlignment(Qt::AlignHCenter);
|
|
||||||
button->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void TapeConfigDialog::Apply()
|
|
||||||
{
|
|
||||||
configurationPage->Apply();
|
|
||||||
pathPage->Apply();
|
|
||||||
|
|
||||||
qApp->TapeSettings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
|
|
||||||
emit UpdateProperties();
|
|
||||||
setResult(QDialog::Accepted);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void TapeConfigDialog::Ok()
|
|
||||||
{
|
|
||||||
Apply();
|
|
||||||
done(QDialog::Accepted);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void TapeConfigDialog::RetranslateUi()
|
|
||||||
{
|
|
||||||
applyButton->setText(tr("Apply"));
|
|
||||||
cancelButton->setText(tr("&Cancel"));
|
|
||||||
okButton->setText(tr("&Ok"));
|
|
||||||
setWindowTitle(tr("Config Dialog"));
|
|
||||||
contentsWidget->item(0)->setText(tr("Configuration"));
|
|
||||||
contentsWidget->item(1)->setText(tr("Paths"));
|
|
||||||
}
|
|
|
@ -8,11 +8,11 @@ SOURCES += \
|
||||||
$$PWD/dialogs/dialogabouttape.cpp \
|
$$PWD/dialogs/dialogabouttape.cpp \
|
||||||
$$PWD/dialogs/dialognewmeasurements.cpp \
|
$$PWD/dialogs/dialognewmeasurements.cpp \
|
||||||
$$PWD/dialogs/dialogmdatabase.cpp \
|
$$PWD/dialogs/dialogmdatabase.cpp \
|
||||||
$$PWD/dialogs/tapeconfigdialog.cpp \
|
|
||||||
$$PWD/dialogs/configpages/tapeconfigurationpage.cpp \
|
|
||||||
$$PWD/dialogs/configpages/tapepathpage.cpp \
|
|
||||||
$$PWD/dialogs/dialogexporttocsv.cpp \
|
$$PWD/dialogs/dialogexporttocsv.cpp \
|
||||||
$$PWD/vlitepattern.cpp
|
$$PWD/vlitepattern.cpp \
|
||||||
|
$$PWD/dialogs/dialogtapepreferences.cpp \
|
||||||
|
$$PWD/dialogs/configpages/tapepreferencesconfigurationpage.cpp \
|
||||||
|
$$PWD/dialogs/configpages/tapepreferencespathpage.cpp
|
||||||
|
|
||||||
win32-msvc*:SOURCES += $$PWD/stable.cpp
|
win32-msvc*:SOURCES += $$PWD/stable.cpp
|
||||||
|
|
||||||
|
@ -24,15 +24,18 @@ HEADERS += \
|
||||||
$$PWD/dialogs/dialognewmeasurements.h \
|
$$PWD/dialogs/dialognewmeasurements.h \
|
||||||
$$PWD/dialogs/dialogmdatabase.h \
|
$$PWD/dialogs/dialogmdatabase.h \
|
||||||
$$PWD/version.h \
|
$$PWD/version.h \
|
||||||
$$PWD/dialogs/tapeconfigdialog.h \
|
|
||||||
$$PWD/dialogs/configpages/tapeconfigurationpage.h \
|
|
||||||
$$PWD/dialogs/configpages/tapepathpage.h \
|
|
||||||
$$PWD/dialogs/dialogexporttocsv.h \
|
$$PWD/dialogs/dialogexporttocsv.h \
|
||||||
$$PWD/vlitepattern.h
|
$$PWD/vlitepattern.h \
|
||||||
|
$$PWD/dialogs/dialogtapepreferences.h \
|
||||||
|
$$PWD/dialogs/configpages/tapepreferencesconfigurationpage.h \
|
||||||
|
$$PWD/dialogs/configpages/tapepreferencespathpage.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
$$PWD/tmainwindow.ui \
|
$$PWD/tmainwindow.ui \
|
||||||
$$PWD/dialogs/dialogabouttape.ui \
|
$$PWD/dialogs/dialogabouttape.ui \
|
||||||
$$PWD/dialogs/dialognewmeasurements.ui \
|
$$PWD/dialogs/dialognewmeasurements.ui \
|
||||||
$$PWD/dialogs/dialogmdatabase.ui \
|
$$PWD/dialogs/dialogmdatabase.ui \
|
||||||
$$PWD/dialogs/dialogexporttocsv.ui
|
$$PWD/dialogs/dialogexporttocsv.ui \
|
||||||
|
$$PWD/dialogs/dialogtapepreferences.ui \
|
||||||
|
$$PWD/dialogs/configpages/tapepreferencesconfigurationpage.ui \
|
||||||
|
$$PWD/dialogs/configpages/tapepreferencespathpage.ui
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#include "dialogs/dialogabouttape.h"
|
#include "dialogs/dialogabouttape.h"
|
||||||
#include "dialogs/dialognewmeasurements.h"
|
#include "dialogs/dialognewmeasurements.h"
|
||||||
#include "dialogs/dialogmdatabase.h"
|
#include "dialogs/dialogmdatabase.h"
|
||||||
#include "dialogs/tapeconfigdialog.h"
|
#include "dialogs/dialogtapepreferences.h"
|
||||||
#include "dialogs/dialogexporttocsv.h"
|
#include "dialogs/dialogexporttocsv.h"
|
||||||
#include "../vpatterndb/calculator.h"
|
#include "../vpatterndb/calculator.h"
|
||||||
#include "../ifc/ifcdef.h"
|
#include "../ifc/ifcdef.h"
|
||||||
|
@ -485,17 +485,27 @@ void TMainWindow::CreateFromExisting()
|
||||||
void TMainWindow::Preferences()
|
void TMainWindow::Preferences()
|
||||||
{
|
{
|
||||||
// Calling constructor of the dialog take some time. Because of this user have time to call the dialog twice.
|
// Calling constructor of the dialog take some time. Because of this user have time to call the dialog twice.
|
||||||
static QPointer<TapeConfigDialog> guard;// Prevent any second run
|
static QPointer<DialogTapePreferences> guard;// Prevent any second run
|
||||||
if (guard.isNull())
|
if (guard.isNull())
|
||||||
{
|
{
|
||||||
TapeConfigDialog *config = new TapeConfigDialog(this);
|
DialogTapePreferences *preferences = new DialogTapePreferences(this);
|
||||||
// QScopedPointer needs to be sure any exception will never block guard
|
// QScopedPointer needs to be sure any exception will never block guard
|
||||||
QScopedPointer<TapeConfigDialog> dlg(config);
|
QScopedPointer<DialogTapePreferences> dlg(preferences);
|
||||||
guard = config;
|
guard = preferences;
|
||||||
|
// Must be first
|
||||||
|
connect(dlg.data(), &DialogTapePreferences::UpdateProperties, this, &TMainWindow::WindowsLocale);
|
||||||
|
connect(dlg.data(), &DialogTapePreferences::UpdateProperties, this, &TMainWindow::ToolBarStyles);
|
||||||
dlg->exec();
|
dlg->exec();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void TMainWindow::ToolBarStyles()
|
||||||
|
{
|
||||||
|
ToolBarStyle(ui->toolBarGradation);
|
||||||
|
ToolBarStyle(ui->mainToolBar);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TMainWindow::closeEvent(QCloseEvent *event)
|
void TMainWindow::closeEvent(QCloseEvent *event)
|
||||||
{
|
{
|
||||||
|
@ -2740,6 +2750,9 @@ void TMainWindow::ReadSettings()
|
||||||
restoreState(settings->GetWindowState());
|
restoreState(settings->GetWindowState());
|
||||||
restoreState(settings->GetToolbarsState(), APP_VERSION);
|
restoreState(settings->GetToolbarsState(), APP_VERSION);
|
||||||
|
|
||||||
|
// Text under tool buton icon
|
||||||
|
ToolBarStyles();
|
||||||
|
|
||||||
// Stack limit
|
// Stack limit
|
||||||
//qApp->getUndoStack()->setUndoLimit(settings->GetUndoCount());
|
//qApp->getUndoStack()->setUndoLimit(settings->GetUndoCount());
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,6 +78,7 @@ private slots:
|
||||||
void OpenTemplate();
|
void OpenTemplate();
|
||||||
void CreateFromExisting();
|
void CreateFromExisting();
|
||||||
void Preferences();
|
void Preferences();
|
||||||
|
void ToolBarStyles();
|
||||||
|
|
||||||
bool FileSave();
|
bool FileSave();
|
||||||
bool FileSaveAs();
|
bool FileSaveAs();
|
||||||
|
|
|
@ -47,7 +47,7 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent)
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->autoSaveCheck->setChecked(qApp->ValentinaSettings()->GetAutosaveState());
|
ui->autoSaveCheck->setChecked(qApp->ValentinaSettings()->GetAutosaveState());
|
||||||
|
|
||||||
InitLanguages();
|
InitLanguages(ui->langCombo);
|
||||||
connect(ui->langCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, [this]()
|
connect(ui->langCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, [this]()
|
||||||
{
|
{
|
||||||
m_langChanged = true;
|
m_langChanged = true;
|
||||||
|
@ -191,56 +191,6 @@ void PreferencesConfigurationPage::SetLabelComboBox(const QStringList &list)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void PreferencesConfigurationPage::InitLanguages()
|
|
||||||
{
|
|
||||||
QStringList fileNames;
|
|
||||||
QDirIterator it(qApp->translationsPath(), QStringList("valentina_*.qm"), QDir::Files, QDirIterator::Subdirectories);
|
|
||||||
while (it.hasNext())
|
|
||||||
{
|
|
||||||
it.next();
|
|
||||||
fileNames.append(it.fileName());
|
|
||||||
}
|
|
||||||
|
|
||||||
bool englishUS = false;
|
|
||||||
const QString en_US = QStringLiteral("en_US");
|
|
||||||
|
|
||||||
for (int i = 0; i < fileNames.size(); ++i)
|
|
||||||
{
|
|
||||||
// get locale extracted by filename
|
|
||||||
QString locale;
|
|
||||||
locale = fileNames.at(i); // "valentina_de_De.qm"
|
|
||||||
locale.truncate(locale.lastIndexOf('.')); // "valentina_de_De"
|
|
||||||
locale.remove(0, locale.indexOf('_') + 1); // "de_De"
|
|
||||||
|
|
||||||
if (not englishUS)
|
|
||||||
{
|
|
||||||
englishUS = (en_US == locale);
|
|
||||||
}
|
|
||||||
|
|
||||||
QLocale loc = QLocale(locale);
|
|
||||||
QString lang = loc.nativeLanguageName();
|
|
||||||
QIcon ico(QString("%1/%2.png").arg("://flags").arg(QLocale::countryToString(loc.country())));
|
|
||||||
|
|
||||||
ui->langCombo->addItem(ico, lang, locale);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ui->langCombo->count() == 0 || not englishUS)
|
|
||||||
{
|
|
||||||
// English language is internal and doens't have own *.qm file.
|
|
||||||
QIcon ico(QString("%1/%2.png").arg("://flags").arg(QLocale::countryToString(QLocale::UnitedStates)));
|
|
||||||
QString lang = QLocale(en_US).nativeLanguageName();
|
|
||||||
ui->langCombo->addItem(ico, lang, en_US);
|
|
||||||
}
|
|
||||||
|
|
||||||
// set default translators and language checked
|
|
||||||
qint32 index = ui->langCombo->findData(qApp->ValentinaSettings()->GetLocale());
|
|
||||||
if (index != -1)
|
|
||||||
{
|
|
||||||
ui->langCombo->setCurrentIndex(index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void PreferencesConfigurationPage::InitUnits()
|
void PreferencesConfigurationPage::InitUnits()
|
||||||
{
|
{
|
||||||
|
|
|
@ -56,10 +56,7 @@ private:
|
||||||
bool m_labelLangChanged;
|
bool m_labelLangChanged;
|
||||||
|
|
||||||
void SetLabelComboBox(const QStringList &list);
|
void SetLabelComboBox(const QStringList &list);
|
||||||
|
|
||||||
void InitLanguages();
|
|
||||||
void InitUnits();
|
void InitUnits();
|
||||||
|
|
||||||
void RetranslateUi();
|
void RetranslateUi();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -4230,12 +4230,6 @@ QStringList MainWindow::GetUnlokedRestoreFileList() const
|
||||||
#endif //QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
|
#endif //QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void MainWindow::WindowsLocale()
|
|
||||||
{
|
|
||||||
qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MainWindow::ToolBarStyles()
|
void MainWindow::ToolBarStyles()
|
||||||
{
|
{
|
||||||
|
@ -4335,19 +4329,6 @@ void MainWindow::ExportLayoutAs()
|
||||||
ui->toolButtonLayoutExportAs->setChecked(false);
|
ui->toolButtonLayoutExportAs->setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void MainWindow::ToolBarStyle(QToolBar *bar)
|
|
||||||
{
|
|
||||||
if (qApp->ValentinaSettings()->GetToolBarStyle())
|
|
||||||
{
|
|
||||||
bar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bar->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MainWindow::ReopenFilesAfterCrash(QStringList &args)
|
void MainWindow::ReopenFilesAfterCrash(QStringList &args)
|
||||||
{
|
{
|
||||||
|
|
|
@ -110,7 +110,6 @@ private slots:
|
||||||
void FullParseFile();
|
void FullParseFile();
|
||||||
void SetEnabledGUI(bool enabled);
|
void SetEnabledGUI(bool enabled);
|
||||||
void GlobalChangePP(const QString &patternPiece);
|
void GlobalChangePP(const QString &patternPiece);
|
||||||
void WindowsLocale();
|
|
||||||
void ToolBarStyles();
|
void ToolBarStyles();
|
||||||
void ShowPaper(int index);
|
void ShowPaper(int index);
|
||||||
void Preferences();
|
void Preferences();
|
||||||
|
@ -334,7 +333,6 @@ private:
|
||||||
bool OpenNewValentina(const QString &fileName = QString())const;
|
bool OpenNewValentina(const QString &fileName = QString())const;
|
||||||
void FileClosedCorrect();
|
void FileClosedCorrect();
|
||||||
QStringList GetUnlokedRestoreFileList()const;
|
QStringList GetUnlokedRestoreFileList()const;
|
||||||
void ToolBarStyle(QToolBar *bar);
|
|
||||||
|
|
||||||
void AddPP(const QString &PPName);
|
void AddPP(const QString &PPName);
|
||||||
QPointF StartPositionNewPP() const;
|
QPointF StartPositionNewPP() const;
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QCursor>
|
#include <QCursor>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
#include <QDirIterator>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
|
@ -2109,3 +2110,56 @@ PassmarkAngleType StringToPassmarkAngleType(const QString &value)
|
||||||
}
|
}
|
||||||
return PassmarkAngleType::Straightforward;
|
return PassmarkAngleType::Straightforward;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void InitLanguages(QComboBox *combobox)
|
||||||
|
{
|
||||||
|
SCASSERT(combobox != nullptr)
|
||||||
|
combobox->clear();
|
||||||
|
|
||||||
|
QStringList fileNames;
|
||||||
|
QDirIterator it(qApp->translationsPath(), QStringList("valentina_*.qm"), QDir::Files, QDirIterator::Subdirectories);
|
||||||
|
while (it.hasNext())
|
||||||
|
{
|
||||||
|
it.next();
|
||||||
|
fileNames.append(it.fileName());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool englishUS = false;
|
||||||
|
const QString en_US = QStringLiteral("en_US");
|
||||||
|
|
||||||
|
for (int i = 0; i < fileNames.size(); ++i)
|
||||||
|
{
|
||||||
|
// get locale extracted by filename
|
||||||
|
QString locale;
|
||||||
|
locale = fileNames.at(i); // "valentina_de_De.qm"
|
||||||
|
locale.truncate(locale.lastIndexOf('.')); // "valentina_de_De"
|
||||||
|
locale.remove(0, locale.indexOf('_') + 1); // "de_De"
|
||||||
|
|
||||||
|
if (not englishUS)
|
||||||
|
{
|
||||||
|
englishUS = (en_US == locale);
|
||||||
|
}
|
||||||
|
|
||||||
|
QLocale loc = QLocale(locale);
|
||||||
|
QString lang = loc.nativeLanguageName();
|
||||||
|
QIcon ico(QString("%1/%2.png").arg("://flags").arg(QLocale::countryToString(loc.country())));
|
||||||
|
|
||||||
|
combobox->addItem(ico, lang, locale);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (combobox->count() == 0 || not englishUS)
|
||||||
|
{
|
||||||
|
// English language is internal and doens't have own *.qm file.
|
||||||
|
QIcon ico(QString("%1/%2.png").arg("://flags").arg(QLocale::countryToString(QLocale::UnitedStates)));
|
||||||
|
QString lang = QLocale(en_US).nativeLanguageName();
|
||||||
|
combobox->addItem(ico, lang, en_US);
|
||||||
|
}
|
||||||
|
|
||||||
|
// set default translators and language checked
|
||||||
|
qint32 index = combobox->findData(qApp->Settings()->GetLocale());
|
||||||
|
if (index != -1)
|
||||||
|
{
|
||||||
|
combobox->setCurrentIndex(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -719,6 +719,7 @@ qreal UnitConvertor(qreal value, const Unit &from, const Unit &to) Q_REQUIRED_RE
|
||||||
|
|
||||||
void CheckFactor(qreal &oldFactor, const qreal &Newfactor);
|
void CheckFactor(qreal &oldFactor, const qreal &Newfactor);
|
||||||
|
|
||||||
|
void InitLanguages(QComboBox *combobox);
|
||||||
QStringList SupportedLocales() Q_REQUIRED_RESULT;
|
QStringList SupportedLocales() Q_REQUIRED_RESULT;
|
||||||
QStringList AllGroupNames() Q_REQUIRED_RESULT;
|
QStringList AllGroupNames() Q_REQUIRED_RESULT;
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include "../vmisc/vabstractapplication.h"
|
#include "../vmisc/vabstractapplication.h"
|
||||||
|
|
||||||
#include <QStyle>
|
#include <QStyle>
|
||||||
|
#include <QToolBar>
|
||||||
|
|
||||||
VAbstractMainWindow::VAbstractMainWindow(QWidget *parent)
|
VAbstractMainWindow::VAbstractMainWindow(QWidget *parent)
|
||||||
: QMainWindow(parent),
|
: QMainWindow(parent),
|
||||||
|
@ -68,3 +69,23 @@ bool VAbstractMainWindow::ContinueFormatRewrite(const QString ¤tFormatVers
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VAbstractMainWindow::ToolBarStyle(QToolBar *bar)
|
||||||
|
{
|
||||||
|
SCASSERT(bar != nullptr)
|
||||||
|
if (qApp->Settings()->GetToolBarStyle())
|
||||||
|
{
|
||||||
|
bar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bar->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VAbstractMainWindow::WindowsLocale()
|
||||||
|
{
|
||||||
|
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
|
||||||
|
}
|
||||||
|
|
|
@ -45,12 +45,15 @@ public:
|
||||||
public slots:
|
public slots:
|
||||||
virtual void ShowToolTip(const QString &toolTip)=0;
|
virtual void ShowToolTip(const QString &toolTip)=0;
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
void WindowsLocale();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int m_curFileFormatVersion;
|
int m_curFileFormatVersion;
|
||||||
QString m_curFileFormatVersionStr;
|
QString m_curFileFormatVersionStr;
|
||||||
|
|
||||||
bool ContinueFormatRewrite(const QString ¤tFormatVersion, const QString &maxFormatVersion);
|
bool ContinueFormatRewrite(const QString ¤tFormatVersion, const QString &maxFormatVersion);
|
||||||
|
void ToolBarStyle(QToolBar *bar);
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VAbstractMainWindow)
|
Q_DISABLE_COPY(VAbstractMainWindow)
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user