Fix language changing at runtime.
All two preferences dialogs have this issue. --HG-- branch : develop
This commit is contained in:
parent
e1276dde99
commit
f67af27c06
|
@ -42,6 +42,7 @@ TapePreferencesConfigurationPage::TapePreferencesConfigurationPage(QWidget *pare
|
||||||
m_defGradationChanged(false)
|
m_defGradationChanged(false)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
RetranslateUi();
|
||||||
|
|
||||||
InitLanguages(ui->langCombo);
|
InitLanguages(ui->langCombo);
|
||||||
connect(ui->langCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this]()
|
connect(ui->langCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this]()
|
||||||
|
@ -50,11 +51,9 @@ TapePreferencesConfigurationPage::TapePreferencesConfigurationPage(QWidget *pare
|
||||||
});
|
});
|
||||||
|
|
||||||
//-------------------- Decimal separator setup
|
//-------------------- Decimal separator setup
|
||||||
ui->osOptionCheck->setText(tr("With OS options") + QString(" (%1)").arg(QLocale().decimalPoint()));
|
|
||||||
ui->osOptionCheck->setChecked(qApp->TapeSettings()->GetOsSeparator());
|
ui->osOptionCheck->setChecked(qApp->TapeSettings()->GetOsSeparator());
|
||||||
|
|
||||||
//---------------------- Pattern making system
|
//---------------------- Pattern making system
|
||||||
InitPMSystems(ui->systemCombo);
|
|
||||||
ui->systemBookValueLabel->setFixedHeight(4 * QFontMetrics(ui->systemBookValueLabel->font()).lineSpacing());
|
ui->systemBookValueLabel->setFixedHeight(4 * QFontMetrics(ui->systemBookValueLabel->font()).lineSpacing());
|
||||||
connect(ui->systemCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this]()
|
connect(ui->systemCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this]()
|
||||||
{
|
{
|
||||||
|
@ -77,15 +76,14 @@ TapePreferencesConfigurationPage::TapePreferencesConfigurationPage(QWidget *pare
|
||||||
//----------------------------- Measurements Editing
|
//----------------------------- Measurements Editing
|
||||||
connect(ui->resetWarningsButton, &QPushButton::released, this, []()
|
connect(ui->resetWarningsButton, &QPushButton::released, this, []()
|
||||||
{
|
{
|
||||||
VTapeSettings *settings = qApp->TapeSettings();
|
qApp->TapeSettings()->SetConfirmFormatRewriting(true);
|
||||||
|
|
||||||
settings->SetConfirmFormatRewriting(true);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//----------------------- Toolbar
|
//----------------------- Toolbar
|
||||||
ui->toolBarStyleCheck->setChecked(qApp->TapeSettings()->GetToolBarStyle());
|
ui->toolBarStyleCheck->setChecked(qApp->TapeSettings()->GetToolBarStyle());
|
||||||
|
|
||||||
//---------------------------Default height and size
|
//---------------------------Default height and size
|
||||||
|
// If change units don't forget about the label
|
||||||
ui->defHeightCombo->addItems(VMeasurement::WholeListHeights(Unit::Cm));
|
ui->defHeightCombo->addItems(VMeasurement::WholeListHeights(Unit::Cm));
|
||||||
index = ui->defHeightCombo->findText(QString().setNum(qApp->TapeSettings()->GetDefHeight()));
|
index = ui->defHeightCombo->findText(QString().setNum(qApp->TapeSettings()->GetDefHeight()));
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
|
@ -100,13 +98,14 @@ TapePreferencesConfigurationPage::TapePreferencesConfigurationPage(QWidget *pare
|
||||||
|
|
||||||
connect(ui->defHeightCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, DefGradationChanged);
|
connect(ui->defHeightCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, DefGradationChanged);
|
||||||
|
|
||||||
|
// If change units don't forget about the label
|
||||||
ui->defSizeCombo->addItems(VMeasurement::WholeListSizes(Unit::Cm));
|
ui->defSizeCombo->addItems(VMeasurement::WholeListSizes(Unit::Cm));
|
||||||
index = ui->defSizeCombo->findText(QString().setNum(qApp->TapeSettings()->GetDefSize()));
|
index = ui->defSizeCombo->findText(QString().setNum(qApp->TapeSettings()->GetDefSize()));
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
{
|
{
|
||||||
ui->defSizeCombo->setCurrentIndex(index);
|
ui->defSizeCombo->setCurrentIndex(index);
|
||||||
}
|
}
|
||||||
connect(ui->defHeightCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, DefGradationChanged);
|
connect(ui->defSizeCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, DefGradationChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -156,6 +155,7 @@ void TapePreferencesConfigurationPage::changeEvent(QEvent *event)
|
||||||
{
|
{
|
||||||
// retranslate designer form (single inheritance approach)
|
// retranslate designer form (single inheritance approach)
|
||||||
RetranslateUi();
|
RetranslateUi();
|
||||||
|
ui->retranslateUi(this);
|
||||||
}
|
}
|
||||||
// remember to call base class implementation
|
// remember to call base class implementation
|
||||||
QWidget::changeEvent(event);
|
QWidget::changeEvent(event);
|
||||||
|
@ -164,5 +164,18 @@ void TapePreferencesConfigurationPage::changeEvent(QEvent *event)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TapePreferencesConfigurationPage::RetranslateUi()
|
void TapePreferencesConfigurationPage::RetranslateUi()
|
||||||
{
|
{
|
||||||
ui->osOptionCheck->setText(tr("With OS options") + QString(" (%1)").arg(QLocale().decimalPoint()));
|
ui->osOptionCheck->setText(tr("With OS options") + QStringLiteral(" (%1)").arg(QLocale().decimalPoint()));
|
||||||
|
|
||||||
|
{
|
||||||
|
const QString code = qvariant_cast<QString>(ui->systemCombo->currentData());
|
||||||
|
ui->systemCombo->blockSignals(true);
|
||||||
|
ui->systemCombo->clear();
|
||||||
|
InitPMSystems(ui->systemCombo);
|
||||||
|
ui->systemCombo->setCurrentIndex(-1);
|
||||||
|
ui->systemCombo->blockSignals(false);
|
||||||
|
ui->systemCombo->setCurrentIndex(ui->systemCombo->findData(code));
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->labelHeightUnit->setText(UnitsToStr(Unit::Cm, true));
|
||||||
|
ui->labelSizeUnit->setText(UnitsToStr(Unit::Cm, true));
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>501</width>
|
<width>501</width>
|
||||||
<height>526</height>
|
<height>550</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -155,10 +155,24 @@
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Default height and size</string>
|
<string>Default height and size</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QFormLayout" name="formLayout_3">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<property name="fieldGrowthPolicy">
|
<item row="0" column="2">
|
||||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
<widget class="QLabel" name="labelHeightUnit">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">Height unit</string>
|
||||||
</property>
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QComboBox" name="defSizeCombo">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -167,7 +181,21 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QComboBox" name="defHeightCombo"/>
|
<widget class="QComboBox" name="defHeightCombo">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QLabel" name="labelSizeUnit">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">Size unit</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="label_4">
|
<widget class="QLabel" name="label_4">
|
||||||
|
@ -176,8 +204,31 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="0" column="3">
|
||||||
<widget class="QComboBox" name="defSizeCombo"/>
|
<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 row="1" column="3">
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<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>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
|
@ -43,6 +43,15 @@ TapePreferencesPathPage::TapePreferencesPathPage(QWidget *parent)
|
||||||
|
|
||||||
InitTable();
|
InitTable();
|
||||||
|
|
||||||
|
connect(ui->pathTable, &QTableWidget::itemSelectionChanged, this, [this]()
|
||||||
|
{
|
||||||
|
ui->defaultButton->setEnabled(not ui->pathTable->selectedItems().isEmpty());
|
||||||
|
ui->defaultButton->setDefault(false);
|
||||||
|
|
||||||
|
ui->editButton->setEnabled(not ui->pathTable->selectedItems().isEmpty());
|
||||||
|
ui->editButton->setDefault(true);
|
||||||
|
});
|
||||||
|
|
||||||
connect(ui->defaultButton, &QPushButton::clicked, this, &TapePreferencesPathPage::DefaultPath);
|
connect(ui->defaultButton, &QPushButton::clicked, this, &TapePreferencesPathPage::DefaultPath);
|
||||||
connect(ui->editButton, &QPushButton::clicked, this, &TapePreferencesPathPage::EditPath);
|
connect(ui->editButton, &QPushButton::clicked, this, &TapePreferencesPathPage::EditPath);
|
||||||
}
|
}
|
||||||
|
@ -62,6 +71,19 @@ void TapePreferencesPathPage::Apply()
|
||||||
settings->SetPathTemplate(ui->pathTable->item(2, 1)->text());
|
settings->SetPathTemplate(ui->pathTable->item(2, 1)->text());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void TapePreferencesPathPage::changeEvent(QEvent *event)
|
||||||
|
{
|
||||||
|
if (event->type() == QEvent::LanguageChange)
|
||||||
|
{
|
||||||
|
// retranslate designer form (single inheritance approach)
|
||||||
|
ui->retranslateUi(this);
|
||||||
|
InitTable();
|
||||||
|
}
|
||||||
|
// remember to call base class implementation
|
||||||
|
QWidget::changeEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TapePreferencesPathPage::DefaultPath()
|
void TapePreferencesPathPage::DefaultPath()
|
||||||
{
|
{
|
||||||
|
@ -141,6 +163,7 @@ void TapePreferencesPathPage::EditPath()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TapePreferencesPathPage::InitTable()
|
void TapePreferencesPathPage::InitTable()
|
||||||
{
|
{
|
||||||
|
ui->pathTable->clearContents();
|
||||||
ui->pathTable->setRowCount(3);
|
ui->pathTable->setRowCount(3);
|
||||||
ui->pathTable->setColumnCount(2);
|
ui->pathTable->setColumnCount(2);
|
||||||
|
|
||||||
|
@ -171,13 +194,4 @@ void TapePreferencesPathPage::InitTable()
|
||||||
ui->pathTable->resizeColumnsToContents();
|
ui->pathTable->resizeColumnsToContents();
|
||||||
ui->pathTable->resizeRowsToContents();
|
ui->pathTable->resizeRowsToContents();
|
||||||
ui->pathTable->horizontalHeader()->setStretchLastSection(true);
|
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);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,8 @@ public:
|
||||||
virtual ~TapePreferencesPathPage();
|
virtual ~TapePreferencesPathPage();
|
||||||
|
|
||||||
void Apply();
|
void Apply();
|
||||||
|
protected:
|
||||||
|
virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
|
||||||
private slots:
|
private slots:
|
||||||
void DefaultPath();
|
void DefaultPath();
|
||||||
void EditPath();
|
void EditPath();
|
||||||
|
|
|
@ -111,6 +111,18 @@ void DialogTapePreferences::resizeEvent(QResizeEvent *event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogTapePreferences::changeEvent(QEvent *event)
|
||||||
|
{
|
||||||
|
if (event->type() == QEvent::LanguageChange)
|
||||||
|
{
|
||||||
|
// retranslate designer form (single inheritance approach)
|
||||||
|
ui->retranslateUi(this);
|
||||||
|
}
|
||||||
|
// remember to call base class implementation
|
||||||
|
QDialog::changeEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogTapePreferences::Apply()
|
void DialogTapePreferences::Apply()
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,6 +52,7 @@ signals:
|
||||||
protected:
|
protected:
|
||||||
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;
|
||||||
|
virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
|
||||||
private slots:
|
private slots:
|
||||||
void Apply();
|
void Apply();
|
||||||
void Ok();
|
void Ok();
|
||||||
|
|
|
@ -45,6 +45,7 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent)
|
||||||
m_labelLangChanged(false)
|
m_labelLangChanged(false)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
RetranslateUi();
|
||||||
|
|
||||||
ui->tabWidget->setCurrentIndex(0);
|
ui->tabWidget->setCurrentIndex(0);
|
||||||
|
|
||||||
|
@ -58,11 +59,16 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent)
|
||||||
});
|
});
|
||||||
|
|
||||||
//-------------------- Decimal separator setup
|
//-------------------- Decimal separator setup
|
||||||
ui->osOptionCheck->setText(tr("With OS options") + QString(" (%1)").arg(QLocale().decimalPoint()));
|
|
||||||
ui->osOptionCheck->setChecked(qApp->ValentinaSettings()->GetOsSeparator());
|
ui->osOptionCheck->setChecked(qApp->ValentinaSettings()->GetOsSeparator());
|
||||||
|
|
||||||
//----------------------- Unit setup
|
//----------------------- Unit setup
|
||||||
InitUnits();
|
// set default unit
|
||||||
|
const qint32 indexUnit = ui->unitCombo->findData(qApp->ValentinaSettings()->GetUnit());
|
||||||
|
if (indexUnit != -1)
|
||||||
|
{
|
||||||
|
ui->unitCombo->setCurrentIndex(indexUnit);
|
||||||
|
}
|
||||||
|
|
||||||
connect(ui->unitCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this]()
|
connect(ui->unitCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this]()
|
||||||
{
|
{
|
||||||
m_unitChanged = true;
|
m_unitChanged = true;
|
||||||
|
@ -82,7 +88,6 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent)
|
||||||
});
|
});
|
||||||
|
|
||||||
//---------------------- Pattern making system
|
//---------------------- Pattern making system
|
||||||
InitPMSystems(ui->systemCombo);
|
|
||||||
ui->systemBookValueLabel->setFixedHeight(4 * QFontMetrics(ui->systemBookValueLabel->font()).lineSpacing());
|
ui->systemBookValueLabel->setFixedHeight(4 * QFontMetrics(ui->systemBookValueLabel->font()).lineSpacing());
|
||||||
connect(ui->systemCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this]()
|
connect(ui->systemCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this]()
|
||||||
{
|
{
|
||||||
|
@ -209,6 +214,7 @@ void PreferencesConfigurationPage::changeEvent(QEvent *event)
|
||||||
{
|
{
|
||||||
// retranslate designer form (single inheritance approach)
|
// retranslate designer form (single inheritance approach)
|
||||||
RetranslateUi();
|
RetranslateUi();
|
||||||
|
ui->retranslateUi(this);
|
||||||
}
|
}
|
||||||
// remember to call base class implementation
|
// remember to call base class implementation
|
||||||
QWidget::changeEvent(event);
|
QWidget::changeEvent(event);
|
||||||
|
@ -229,17 +235,29 @@ void PreferencesConfigurationPage::InitUnits()
|
||||||
ui->unitCombo->addItem(tr("Centimeters"), unitCM);
|
ui->unitCombo->addItem(tr("Centimeters"), unitCM);
|
||||||
ui->unitCombo->addItem(tr("Millimiters"), unitMM);
|
ui->unitCombo->addItem(tr("Millimiters"), unitMM);
|
||||||
ui->unitCombo->addItem(tr("Inches"), unitINCH);
|
ui->unitCombo->addItem(tr("Inches"), unitINCH);
|
||||||
|
|
||||||
// set default unit
|
|
||||||
const qint32 indexUnit = ui->unitCombo->findData(qApp->ValentinaSettings()->GetUnit());
|
|
||||||
if (indexUnit != -1)
|
|
||||||
{
|
|
||||||
ui->unitCombo->setCurrentIndex(indexUnit);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void PreferencesConfigurationPage::RetranslateUi()
|
void PreferencesConfigurationPage::RetranslateUi()
|
||||||
{
|
{
|
||||||
ui->osOptionCheck->setText(tr("With OS options") + QString(" (%1)").arg(QLocale().decimalPoint()));
|
ui->osOptionCheck->setText(tr("With OS options") + QStringLiteral(" (%1)").arg(QLocale().decimalPoint()));
|
||||||
|
|
||||||
|
{
|
||||||
|
ui->unitCombo->blockSignals(true);
|
||||||
|
const QString unit = qvariant_cast<QString>(ui->unitCombo->currentData());
|
||||||
|
ui->unitCombo->clear();
|
||||||
|
InitUnits();
|
||||||
|
ui->unitCombo->setCurrentIndex(ui->unitCombo->findData(unit));
|
||||||
|
ui->unitCombo->blockSignals(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const QString code = qvariant_cast<QString>(ui->systemCombo->currentData());
|
||||||
|
ui->systemCombo->blockSignals(true);
|
||||||
|
ui->systemCombo->clear();
|
||||||
|
InitPMSystems(ui->systemCombo);
|
||||||
|
ui->systemCombo->setCurrentIndex(-1);
|
||||||
|
ui->systemCombo->blockSignals(false);
|
||||||
|
ui->systemCombo->setCurrentIndex(ui->systemCombo->findData(code));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,15 @@ PreferencesPathPage::PreferencesPathPage(QWidget *parent)
|
||||||
|
|
||||||
InitTable();
|
InitTable();
|
||||||
|
|
||||||
|
connect(ui->pathTable, &QTableWidget::itemSelectionChanged, this, [this]()
|
||||||
|
{
|
||||||
|
ui->defaultButton->setEnabled(not ui->pathTable->selectedItems().isEmpty());
|
||||||
|
ui->defaultButton->setDefault(false);
|
||||||
|
|
||||||
|
ui->editButton->setEnabled(not ui->pathTable->selectedItems().isEmpty());
|
||||||
|
ui->editButton->setDefault(true);
|
||||||
|
});
|
||||||
|
|
||||||
connect(ui->defaultButton, &QPushButton::clicked, this, &PreferencesPathPage::DefaultPath);
|
connect(ui->defaultButton, &QPushButton::clicked, this, &PreferencesPathPage::DefaultPath);
|
||||||
connect(ui->editButton, &QPushButton::clicked, this, &PreferencesPathPage::EditPath);
|
connect(ui->editButton, &QPushButton::clicked, this, &PreferencesPathPage::EditPath);
|
||||||
}
|
}
|
||||||
|
@ -68,6 +77,19 @@ QStringList PreferencesPathPage::Apply()
|
||||||
return QStringList(); // No changes those require restart.
|
return QStringList(); // No changes those require restart.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void PreferencesPathPage::changeEvent(QEvent *event)
|
||||||
|
{
|
||||||
|
if (event->type() == QEvent::LanguageChange)
|
||||||
|
{
|
||||||
|
// retranslate designer form (single inheritance approach)
|
||||||
|
ui->retranslateUi(this);
|
||||||
|
InitTable();
|
||||||
|
}
|
||||||
|
// remember to call base class implementation
|
||||||
|
QWidget::changeEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void PreferencesPathPage::DefaultPath()
|
void PreferencesPathPage::DefaultPath()
|
||||||
{
|
{
|
||||||
|
@ -176,6 +198,7 @@ void PreferencesPathPage::EditPath()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void PreferencesPathPage::InitTable()
|
void PreferencesPathPage::InitTable()
|
||||||
{
|
{
|
||||||
|
ui->pathTable->clearContents();
|
||||||
ui->pathTable->setRowCount(6);
|
ui->pathTable->setRowCount(6);
|
||||||
ui->pathTable->setColumnCount(2);
|
ui->pathTable->setColumnCount(2);
|
||||||
|
|
||||||
|
@ -226,13 +249,4 @@ void PreferencesPathPage::InitTable()
|
||||||
ui->pathTable->verticalHeader()->setDefaultSectionSize(20);
|
ui->pathTable->verticalHeader()->setDefaultSectionSize(20);
|
||||||
ui->pathTable->resizeColumnsToContents();
|
ui->pathTable->resizeColumnsToContents();
|
||||||
ui->pathTable->resizeRowsToContents();
|
ui->pathTable->resizeRowsToContents();
|
||||||
|
|
||||||
connect(ui->pathTable, &QTableWidget::itemSelectionChanged, this, [this]()
|
|
||||||
{
|
|
||||||
ui->defaultButton->setEnabled(true);
|
|
||||||
ui->defaultButton->setDefault(false);
|
|
||||||
|
|
||||||
ui->editButton->setEnabled(true);
|
|
||||||
ui->editButton->setDefault(true);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,9 @@ public:
|
||||||
|
|
||||||
QStringList Apply();
|
QStringList Apply();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void DefaultPath();
|
void DefaultPath();
|
||||||
void EditPath();
|
void EditPath();
|
||||||
|
|
|
@ -61,6 +61,7 @@ PreferencesPatternPage::PreferencesPatternPage(QWidget *parent)
|
||||||
m_oldLineUnit(Unit::Mm)
|
m_oldLineUnit(Unit::Mm)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
RetranslateUi();
|
||||||
|
|
||||||
VSettings *settings = qApp->ValentinaSettings();
|
VSettings *settings = qApp->ValentinaSettings();
|
||||||
|
|
||||||
|
@ -72,7 +73,14 @@ PreferencesPatternPage::PreferencesPatternPage(QWidget *parent)
|
||||||
ui->undoCount->setValue(settings->GetUndoCount());
|
ui->undoCount->setValue(settings->GetUndoCount());
|
||||||
|
|
||||||
//----------------------- Unit setup
|
//----------------------- Unit setup
|
||||||
InitUnits();
|
// set default unit
|
||||||
|
const Unit defUnit = QLocale().measurementSystem() == QLocale::MetricSystem ? Unit::Mm : Unit::Inch;
|
||||||
|
const qint32 indexUnit = ui->comboBoxLineWidthUnit->findData(static_cast<int>(defUnit));
|
||||||
|
if (indexUnit != -1)
|
||||||
|
{
|
||||||
|
ui->comboBoxLineWidthUnit->setCurrentIndex(indexUnit);
|
||||||
|
}
|
||||||
|
|
||||||
connect(ui->comboBoxLineWidthUnit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this]()
|
connect(ui->comboBoxLineWidthUnit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this]()
|
||||||
{
|
{
|
||||||
const Unit lineUnit = static_cast<Unit>(ui->comboBoxLineWidthUnit->currentData().toInt());
|
const Unit lineUnit = static_cast<Unit>(ui->comboBoxLineWidthUnit->currentData().toInt());
|
||||||
|
@ -176,6 +184,19 @@ void PreferencesPatternPage::InitDefaultSeamAllowance()
|
||||||
ui->defaultSeamAllowance->setSuffix(UnitsToStr(StrToUnits(qApp->ValentinaSettings()->GetUnit()), true));
|
ui->defaultSeamAllowance->setSuffix(UnitsToStr(StrToUnits(qApp->ValentinaSettings()->GetUnit()), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void PreferencesPatternPage::changeEvent(QEvent *event)
|
||||||
|
{
|
||||||
|
if (event->type() == QEvent::LanguageChange)
|
||||||
|
{
|
||||||
|
// retranslate designer form (single inheritance approach)
|
||||||
|
RetranslateUi();
|
||||||
|
ui->retranslateUi(this);
|
||||||
|
}
|
||||||
|
// remember to call base class implementation
|
||||||
|
QWidget::changeEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void PreferencesPatternPage::EditDateTimeFormats()
|
void PreferencesPatternPage::EditDateTimeFormats()
|
||||||
{
|
{
|
||||||
|
@ -244,14 +265,17 @@ void PreferencesPatternPage::InitUnits()
|
||||||
{
|
{
|
||||||
ui->comboBoxLineWidthUnit->addItem(tr("Millimiters"), static_cast<int>(Unit::Mm));
|
ui->comboBoxLineWidthUnit->addItem(tr("Millimiters"), static_cast<int>(Unit::Mm));
|
||||||
ui->comboBoxLineWidthUnit->addItem(tr("Inches"), static_cast<int>(Unit::Inch));
|
ui->comboBoxLineWidthUnit->addItem(tr("Inches"), static_cast<int>(Unit::Inch));
|
||||||
|
}
|
||||||
|
|
||||||
// set default unit
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
const Unit defUnit = QLocale().measurementSystem() == QLocale::MetricSystem ? Unit::Mm : Unit::Inch;
|
void PreferencesPatternPage::RetranslateUi()
|
||||||
const qint32 indexUnit = ui->comboBoxLineWidthUnit->findData(static_cast<int>(defUnit));
|
{
|
||||||
if (indexUnit != -1)
|
ui->comboBoxLineWidthUnit->blockSignals(true);
|
||||||
{
|
const int unit = ui->comboBoxLineWidthUnit->currentData().toInt();
|
||||||
ui->comboBoxLineWidthUnit->setCurrentIndex(indexUnit);
|
ui->comboBoxLineWidthUnit->clear();
|
||||||
}
|
InitUnits();
|
||||||
|
ui->comboBoxLineWidthUnit->setCurrentIndex(ui->comboBoxLineWidthUnit->findData(unit));
|
||||||
|
ui->comboBoxLineWidthUnit->blockSignals(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -50,6 +50,9 @@ public:
|
||||||
QStringList Apply();
|
QStringList Apply();
|
||||||
void InitDefaultSeamAllowance();
|
void InitDefaultSeamAllowance();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void EditDateTimeFormats();
|
void EditDateTimeFormats();
|
||||||
void ManageKnownMaterials();
|
void ManageKnownMaterials();
|
||||||
|
@ -63,6 +66,7 @@ private:
|
||||||
void InitLabelDateTimeFormats();
|
void InitLabelDateTimeFormats();
|
||||||
void InitComboBoxFormats(QComboBox *box, const QStringList &items, const QString ¤tFormat);
|
void InitComboBoxFormats(QComboBox *box, const QStringList &items, const QString ¤tFormat);
|
||||||
void InitUnits();
|
void InitUnits();
|
||||||
|
void RetranslateUi();
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void CallDateTimeFormatEditor(const T &type, const QStringList &predefinedFormats,
|
void CallDateTimeFormatEditor(const T &type, const QStringList &predefinedFormats,
|
||||||
|
|
|
@ -116,7 +116,14 @@ This option will take an affect after restart.</string>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="comboBoxLineWidthUnit"/>
|
<widget class="QComboBox" name="comboBoxLineWidthUnit">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_3">
|
<spacer name="horizontalSpacer_3">
|
||||||
|
@ -125,7 +132,7 @@ This option will take an affect after restart.</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>500</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
@ -114,6 +114,18 @@ void DialogPreferences::resizeEvent(QResizeEvent *event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPreferences::changeEvent(QEvent *event)
|
||||||
|
{
|
||||||
|
if (event->type() == QEvent::LanguageChange)
|
||||||
|
{
|
||||||
|
// retranslate designer form (single inheritance approach)
|
||||||
|
ui->retranslateUi(this);
|
||||||
|
}
|
||||||
|
// remember to call base class implementation
|
||||||
|
QDialog::changeEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPreferences::PageChanged(QListWidgetItem *current, QListWidgetItem *previous)
|
void DialogPreferences::PageChanged(QListWidgetItem *current, QListWidgetItem *previous)
|
||||||
{
|
{
|
||||||
|
|
|
@ -54,6 +54,7 @@ signals:
|
||||||
protected:
|
protected:
|
||||||
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;
|
||||||
|
virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
|
||||||
private slots:
|
private slots:
|
||||||
void PageChanged(QListWidgetItem *current, QListWidgetItem *previous);
|
void PageChanged(QListWidgetItem *current, QListWidgetItem *previous);
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user