New option "Don't use the native file dialog".
This commit is contained in:
parent
0ab76dd6b9
commit
58cae6f66c
|
@ -4,6 +4,7 @@
|
||||||
- Fix a regression in tool Segment a spline path.
|
- Fix a regression in tool Segment a spline path.
|
||||||
- Fix invalid visualization for tool Point of intersection circles.
|
- Fix invalid visualization for tool Point of intersection circles.
|
||||||
- New warning. Warn about empty measurements dimension value when preparing placeholders.
|
- New warning. Warn about empty measurements dimension value when preparing placeholders.
|
||||||
|
- New option "Don't use the native file dialog".
|
||||||
|
|
||||||
# Version 0.7.41 Dec 4, 2020
|
# Version 0.7.41 Dec 4, 2020
|
||||||
- Bug fixes.
|
- Bug fixes.
|
||||||
|
|
|
@ -55,6 +55,9 @@ TapePreferencesConfigurationPage::TapePreferencesConfigurationPage(QWidget *pare
|
||||||
// Theme
|
// Theme
|
||||||
ui->darkModeCheck->setChecked(qApp->TapeSettings()->GetDarkMode());
|
ui->darkModeCheck->setChecked(qApp->TapeSettings()->GetDarkMode());
|
||||||
|
|
||||||
|
// Native dialogs
|
||||||
|
ui->checkBoxDontUseNativeDialog->setChecked(qApp->TapeSettings()->IsDontUseNativeDialog());
|
||||||
|
|
||||||
//---------------------- Pattern making system
|
//---------------------- Pattern making system
|
||||||
ui->systemBookValueLabel->setFixedHeight(4 * QFontMetrics(ui->systemBookValueLabel->font()).lineSpacing());
|
ui->systemBookValueLabel->setFixedHeight(4 * QFontMetrics(ui->systemBookValueLabel->font()).lineSpacing());
|
||||||
connect(ui->systemCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this]()
|
connect(ui->systemCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this]()
|
||||||
|
@ -106,6 +109,11 @@ QStringList TapePreferencesConfigurationPage::Apply()
|
||||||
preferences.append(tr("dark mode"));
|
preferences.append(tr("dark mode"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (settings->IsDontUseNativeDialog() != ui->checkBoxDontUseNativeDialog->isChecked())
|
||||||
|
{
|
||||||
|
settings->SetDontUseNativeDialog(ui->checkBoxDontUseNativeDialog->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
if (m_langChanged || m_systemChanged)
|
if (m_langChanged || m_systemChanged)
|
||||||
{
|
{
|
||||||
const QString locale = qvariant_cast<QString>(ui->langCombo->currentData());
|
const QString locale = qvariant_cast<QString>(ui->langCombo->currentData());
|
||||||
|
|
|
@ -170,19 +170,22 @@
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>User Interface</string>
|
<string>User Interface</string>
|
||||||
</property>
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
|
<item>
|
||||||
<widget class="QCheckBox" name="darkModeCheck">
|
<widget class="QCheckBox" name="darkModeCheck">
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>20</x>
|
|
||||||
<y>30</y>
|
|
||||||
<width>351</width>
|
|
||||||
<height>20</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Activate dark mode</string>
|
<string>Activate dark mode</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBoxDontUseNativeDialog">
|
||||||
|
<property name="text">
|
||||||
|
<string>Don't use the native file dialog</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
|
@ -149,8 +149,9 @@ void TapePreferencesPathPage::EditPath()
|
||||||
usedNotExistedDir = directory.mkpath(QChar('.'));
|
usedNotExistedDir = directory.mkpath(QChar('.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"), path,
|
const QString dir = QFileDialog::getExistingDirectory(
|
||||||
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
this, tr("Open Directory"), path,
|
||||||
|
qApp->NativeFileDialog(QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks));
|
||||||
if (dir.isEmpty())
|
if (dir.isEmpty())
|
||||||
{
|
{
|
||||||
if (usedNotExistedDir)
|
if (usedNotExistedDir)
|
||||||
|
|
|
@ -520,7 +520,8 @@ void TMainWindow::CreateFromExisting()
|
||||||
usedNotExistedDir = directory.mkpath(QChar('.'));
|
usedNotExistedDir = directory.mkpath(QChar('.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString mPath = QFileDialog::getOpenFileName(this, tr("Select file"), pathTo, filter);
|
const QString mPath = QFileDialog::getOpenFileName(this, tr("Select file"), pathTo, filter, nullptr,
|
||||||
|
qApp->NativeFileDialog());
|
||||||
|
|
||||||
if (not mPath.isEmpty())
|
if (not mPath.isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -889,7 +890,8 @@ bool TMainWindow::FileSaveAs()
|
||||||
usedNotExistedDir = directory.mkpath(QChar('.'));
|
usedNotExistedDir = directory.mkpath(QChar('.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), dir + QChar('/') + fName, filters);
|
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), dir + QChar('/') + fName, filters, nullptr,
|
||||||
|
qApp->NativeFileDialog());
|
||||||
|
|
||||||
auto RemoveTempDir = qScopeGuard([usedNotExistedDir, dir]()
|
auto RemoveTempDir = qScopeGuard([usedNotExistedDir, dir]()
|
||||||
{
|
{
|
||||||
|
@ -997,11 +999,8 @@ void TMainWindow::ImportDataFromCSV()
|
||||||
const QString filters = tr("Comma-Separated Values") + QStringLiteral(" (*.csv)");
|
const QString filters = tr("Comma-Separated Values") + QStringLiteral(" (*.csv)");
|
||||||
const QString suffix = QStringLiteral("csv");
|
const QString suffix = QStringLiteral("csv");
|
||||||
|
|
||||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Import from CSV"), QDir::homePath(), filters, nullptr
|
QString fileName = QFileDialog::getOpenFileName(this, tr("Import from CSV"), QDir::homePath(), filters, nullptr,
|
||||||
#ifdef Q_OS_LINUX
|
qApp->NativeFileDialog());
|
||||||
, QFileDialog::DontUseNativeDialog
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
|
|
||||||
if (fileName.isEmpty())
|
if (fileName.isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -1471,7 +1470,8 @@ void TMainWindow::ImportFromPattern()
|
||||||
//Use standard path to individual measurements
|
//Use standard path to individual measurements
|
||||||
QString pathTo = qApp->TapeSettings()->GetPathPattern();
|
QString pathTo = qApp->TapeSettings()->GetPathPattern();
|
||||||
|
|
||||||
const QString mPath = QFileDialog::getOpenFileName(this, tr("Import from a pattern"), pathTo, filter);
|
const QString mPath = QFileDialog::getOpenFileName(this, tr("Import from a pattern"), pathTo, filter, nullptr,
|
||||||
|
qApp->NativeFileDialog());
|
||||||
if (mPath.isEmpty())
|
if (mPath.isEmpty())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -2189,7 +2189,7 @@ void TMainWindow::ExportToIndividual()
|
||||||
QString filters = tr("Individual measurements") + QStringLiteral(" (*.vit)");
|
QString filters = tr("Individual measurements") + QStringLiteral(" (*.vit)");
|
||||||
QString fName = tr("measurements.vit");
|
QString fName = tr("measurements.vit");
|
||||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Export to individual"), dir + QChar('/') + fName,
|
QString fileName = QFileDialog::getSaveFileName(this, tr("Export to individual"), dir + QChar('/') + fName,
|
||||||
filters);
|
filters, nullptr, qApp->NativeFileDialog());
|
||||||
|
|
||||||
auto RemoveTempDir = qScopeGuard([usedNotExistedDir, dir]()
|
auto RemoveTempDir = qScopeGuard([usedNotExistedDir, dir]()
|
||||||
{
|
{
|
||||||
|
@ -3358,7 +3358,8 @@ bool TMainWindow::EvalFormula(const QString &formula, bool fromUser, VContainer
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TMainWindow::Open(const QString &pathTo, const QString &filter)
|
void TMainWindow::Open(const QString &pathTo, const QString &filter)
|
||||||
{
|
{
|
||||||
const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), pathTo, filter);
|
const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), pathTo, filter, nullptr,
|
||||||
|
qApp->NativeFileDialog());
|
||||||
|
|
||||||
if (not mPath.isEmpty())
|
if (not mPath.isEmpty())
|
||||||
{
|
{
|
||||||
|
|
|
@ -130,6 +130,9 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent)
|
||||||
// Tool panel
|
// Tool panel
|
||||||
ui->checkBoxToolPanelScaling->setChecked(settings->GetToolPanelScaling());
|
ui->checkBoxToolPanelScaling->setChecked(settings->GetToolPanelScaling());
|
||||||
|
|
||||||
|
// Native dialogs
|
||||||
|
ui->checkBoxDontUseNativeDialog->setChecked(settings->IsDontUseNativeDialog());
|
||||||
|
|
||||||
// Tab Scrolling
|
// Tab Scrolling
|
||||||
ui->spinBoxDuration->setMinimum(VSettings::scrollingDurationMin);
|
ui->spinBoxDuration->setMinimum(VSettings::scrollingDurationMin);
|
||||||
ui->spinBoxDuration->setMaximum(VSettings::scrollingDurationMax);
|
ui->spinBoxDuration->setMaximum(VSettings::scrollingDurationMax);
|
||||||
|
@ -186,6 +189,11 @@ QStringList PreferencesConfigurationPage::Apply()
|
||||||
settings->SetToolPanelScaling(ui->checkBoxToolPanelScaling->isChecked());
|
settings->SetToolPanelScaling(ui->checkBoxToolPanelScaling->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (settings->IsDontUseNativeDialog() != ui->checkBoxDontUseNativeDialog->isChecked())
|
||||||
|
{
|
||||||
|
settings->SetDontUseNativeDialog(ui->checkBoxDontUseNativeDialog->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
settings->SetFreeCurveMode(ui->checkBoxFreeCurve->isChecked());
|
settings->SetFreeCurveMode(ui->checkBoxFreeCurve->isChecked());
|
||||||
settings->SetDoubleClickZoomFitBestCurrentPP(ui->checkBoxZoomFitBestCurrentPP->isChecked());
|
settings->SetDoubleClickZoomFitBestCurrentPP(ui->checkBoxZoomFitBestCurrentPP->isChecked());
|
||||||
|
|
||||||
|
|
|
@ -33,9 +33,9 @@
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>-161</y>
|
<y>-189</y>
|
||||||
<width>624</width>
|
<width>624</width>
|
||||||
<height>717</height>
|
<height>745</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
@ -283,6 +283,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBoxDontUseNativeDialog">
|
||||||
|
<property name="text">
|
||||||
|
<string>Don't use the native file dialog</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -166,13 +166,9 @@ void PreferencesPathPage::EditPath()
|
||||||
usedNotExistedDir = directory.mkpath(QChar('.'));
|
usedNotExistedDir = directory.mkpath(QChar('.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"), path,
|
const QString dir = QFileDialog::getExistingDirectory(
|
||||||
QFileDialog::ShowDirsOnly
|
this, tr("Open Directory"), path,
|
||||||
| QFileDialog::DontResolveSymlinks
|
qApp->NativeFileDialog(QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks));
|
||||||
#ifdef Q_OS_LINUX
|
|
||||||
| QFileDialog::DontUseNativeDialog
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
if (dir.isEmpty())
|
if (dir.isEmpty())
|
||||||
{
|
{
|
||||||
if (usedNotExistedDir)
|
if (usedNotExistedDir)
|
||||||
|
|
|
@ -411,11 +411,8 @@ void DialogPatternProperties::InitImage()
|
||||||
void DialogPatternProperties::ChangeImage()
|
void DialogPatternProperties::ChangeImage()
|
||||||
{
|
{
|
||||||
const QString filter = tr("Images") + QLatin1String(" (*.png *.jpg *.jpeg *.bmp)");
|
const QString filter = tr("Images") + QLatin1String(" (*.png *.jpg *.jpeg *.bmp)");
|
||||||
const QString fileName = QFileDialog::getOpenFileName(this, tr("Image for pattern"), QString(), filter, nullptr
|
const QString fileName = QFileDialog::getOpenFileName(this, tr("Image for pattern"), QString(), filter, nullptr,
|
||||||
#ifdef Q_OS_LINUX
|
qApp->NativeFileDialog());
|
||||||
, QFileDialog::DontUseNativeDialog
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
if (not fileName.isEmpty())
|
if (not fileName.isEmpty())
|
||||||
{
|
{
|
||||||
QImage image;
|
QImage image;
|
||||||
|
@ -456,11 +453,8 @@ void DialogPatternProperties::SaveImage()
|
||||||
QByteArray ba = QByteArray::fromBase64(byteArray);
|
QByteArray ba = QByteArray::fromBase64(byteArray);
|
||||||
const QString extension = doc->GetImageExtension().prepend(QChar('.'));
|
const QString extension = doc->GetImageExtension().prepend(QChar('.'));
|
||||||
QString filter = tr("Images") + QStringLiteral(" (*") + extension + QChar(')');
|
QString filter = tr("Images") + QStringLiteral(" (*") + extension + QChar(')');
|
||||||
QString filename = QFileDialog::getSaveFileName(this, tr("Save File"), tr("untitled"), filter, &filter
|
QString filename = QFileDialog::getSaveFileName(this, tr("Save File"), tr("untitled"), filter, &filter,
|
||||||
#ifdef Q_OS_LINUX
|
qApp->NativeFileDialog());
|
||||||
, QFileDialog::DontUseNativeDialog
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
if (not filename.isEmpty())
|
if (not filename.isEmpty())
|
||||||
{
|
{
|
||||||
if (not filename.endsWith(extension.toUpper()))
|
if (not filename.endsWith(extension.toUpper()))
|
||||||
|
|
|
@ -127,13 +127,9 @@ DialogSaveLayout::DialogSaveLayout(int count, Draw mode, const QString &fileName
|
||||||
usedNotExistedDir = directory.mkpath(QChar('.'));
|
usedNotExistedDir = directory.mkpath(QChar('.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString dir = QFileDialog::getExistingDirectory(this, tr("Select folder"), dirPath,
|
const QString dir = QFileDialog::getExistingDirectory(
|
||||||
QFileDialog::ShowDirsOnly
|
this, tr("Select folder"), dirPath,
|
||||||
| QFileDialog::DontResolveSymlinks
|
qApp->NativeFileDialog(QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks));
|
||||||
#ifdef Q_OS_LINUX
|
|
||||||
| QFileDialog::DontUseNativeDialog
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
if (not dir.isEmpty())
|
if (not dir.isEmpty())
|
||||||
{// If paths equal the signal will not be called, we will do this manually
|
{// If paths equal the signal will not be called, we will do this manually
|
||||||
dir == ui->lineEditPath->text() ? PathChanged(dir) : ui->lineEditPath->setText(dir);
|
dir == ui->lineEditPath->text() ? PathChanged(dir) : ui->lineEditPath->setText(dir);
|
||||||
|
|
|
@ -1769,11 +1769,8 @@ void MainWindow::LoadIndividual()
|
||||||
usedNotExistedDir = directory.mkpath(QChar('.'));
|
usedNotExistedDir = directory.mkpath(QChar('.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter, nullptr
|
const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter, nullptr,
|
||||||
#ifdef Q_OS_LINUX
|
qApp->NativeFileDialog());
|
||||||
, QFileDialog::DontUseNativeDialog
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
|
|
||||||
if (not mPath.isEmpty())
|
if (not mPath.isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -1810,11 +1807,8 @@ void MainWindow::LoadMultisize()
|
||||||
//Use standard path to multisize measurements
|
//Use standard path to multisize measurements
|
||||||
QString path = qApp->ValentinaSettings()->GetPathMultisizeMeasurements();
|
QString path = qApp->ValentinaSettings()->GetPathMultisizeMeasurements();
|
||||||
path = VCommonSettings::PrepareMultisizeTables(path);
|
path = VCommonSettings::PrepareMultisizeTables(path);
|
||||||
const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter, nullptr
|
const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter, nullptr,
|
||||||
#ifdef Q_OS_LINUX
|
qApp->NativeFileDialog());
|
||||||
, QFileDialog::DontUseNativeDialog
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
|
|
||||||
if (not mPath.isEmpty())
|
if (not mPath.isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -2034,7 +2028,8 @@ void MainWindow::LoadWatermark()
|
||||||
const QString filter(tr("Watermark files") + QLatin1String(" (*.vwm)"));
|
const QString filter(tr("Watermark files") + QLatin1String(" (*.vwm)"));
|
||||||
QString dir = QDir::homePath();
|
QString dir = QDir::homePath();
|
||||||
qDebug("Run QFileDialog::getOpenFileName: dir = %s.", qUtf8Printable(dir));
|
qDebug("Run QFileDialog::getOpenFileName: dir = %s.", qUtf8Printable(dir));
|
||||||
const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), dir, filter, nullptr);
|
const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), dir, filter, nullptr,
|
||||||
|
qApp->NativeFileDialog());
|
||||||
if (filePath.isEmpty())
|
if (filePath.isEmpty())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -3108,11 +3103,7 @@ bool MainWindow::on_actionSaveAs_triggered()
|
||||||
|
|
||||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"),
|
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"),
|
||||||
dir + QLatin1String("/") + tr("pattern") + QLatin1String(".val"),
|
dir + QLatin1String("/") + tr("pattern") + QLatin1String(".val"),
|
||||||
filters, nullptr
|
filters, nullptr, qApp->NativeFileDialog());
|
||||||
#ifdef Q_OS_LINUX
|
|
||||||
, QFileDialog::DontUseNativeDialog
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
|
|
||||||
auto RemoveTempDir = qScopeGuard([usedNotExistedDir, dir]()
|
auto RemoveTempDir = qScopeGuard([usedNotExistedDir, dir]()
|
||||||
{
|
{
|
||||||
|
@ -3305,11 +3296,8 @@ void MainWindow::on_actionOpen_triggered()
|
||||||
dir = QFileInfo(files.first()).absolutePath();
|
dir = QFileInfo(files.first()).absolutePath();
|
||||||
}
|
}
|
||||||
qCDebug(vMainWindow, "Run QFileDialog::getOpenFileName: dir = %s.", qUtf8Printable(dir));
|
qCDebug(vMainWindow, "Run QFileDialog::getOpenFileName: dir = %s.", qUtf8Printable(dir));
|
||||||
const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), dir, filter, nullptr
|
const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), dir, filter, nullptr,
|
||||||
#ifdef Q_OS_LINUX
|
qApp->NativeFileDialog());
|
||||||
, QFileDialog::DontUseNativeDialog
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
if (filePath.isEmpty())
|
if (filePath.isEmpty())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -4762,7 +4750,7 @@ void MainWindow::CreateActions()
|
||||||
QString fileName =
|
QString fileName =
|
||||||
QFileDialog::getSaveFileName(this, tr("Export recipe"),
|
QFileDialog::getSaveFileName(this, tr("Export recipe"),
|
||||||
QDir::homePath() + '/' + tr("recipe") + QStringLiteral(".vpr"),
|
QDir::homePath() + '/' + tr("recipe") + QStringLiteral(".vpr"),
|
||||||
filters, nullptr);
|
filters, nullptr, qApp->NativeFileDialog());
|
||||||
if (fileName.isEmpty())
|
if (fileName.isEmpty())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -5569,6 +5557,7 @@ QString MainWindow::CheckPathToMeasurements(const QString &patternPath, const QS
|
||||||
QFileDialog dialog(this, tr("Open file"), dirPath, filter);
|
QFileDialog dialog(this, tr("Open file"), dirPath, filter);
|
||||||
dialog.selectFile(selectedName);
|
dialog.selectFile(selectedName);
|
||||||
dialog.setFileMode(QFileDialog::ExistingFile);
|
dialog.setFileMode(QFileDialog::ExistingFile);
|
||||||
|
dialog.setOption(QFileDialog::DontUseNativeDialog, qApp->Settings()->IsDontUseNativeDialog());
|
||||||
if (dialog.exec() == QDialog::Accepted)
|
if (dialog.exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
mPath = dialog.selectedFiles().value(0);
|
mPath = dialog.selectedFiles().value(0);
|
||||||
|
|
|
@ -93,7 +93,7 @@ WatermarkWindow::WatermarkWindow(const QString &patternPath, QWidget *parent) :
|
||||||
{
|
{
|
||||||
const QString filter = tr("Images") + QLatin1String(" (*.png *.jpg *.jpeg *.bmp)");
|
const QString filter = tr("Images") + QLatin1String(" (*.png *.jpg *.jpeg *.bmp)");
|
||||||
const QString fileName = QFileDialog::getOpenFileName(this, tr("Watermark image"), QString(), filter,
|
const QString fileName = QFileDialog::getOpenFileName(this, tr("Watermark image"), QString(), filter,
|
||||||
nullptr);
|
nullptr, qApp->NativeFileDialog());
|
||||||
if (not fileName.isEmpty())
|
if (not fileName.isEmpty())
|
||||||
{
|
{
|
||||||
ui->lineEditPath->setText(fileName);
|
ui->lineEditPath->setText(fileName);
|
||||||
|
@ -284,7 +284,7 @@ bool WatermarkWindow::on_actionSaveAs_triggered()
|
||||||
|
|
||||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"),
|
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"),
|
||||||
dir + QLatin1String("/") + tr("watermark") + QLatin1String(".vwm"),
|
dir + QLatin1String("/") + tr("watermark") + QLatin1String(".vwm"),
|
||||||
filters, nullptr);
|
filters, nullptr, qApp->NativeFileDialog());
|
||||||
|
|
||||||
if (fileName.isEmpty())
|
if (fileName.isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -426,7 +426,8 @@ void WatermarkWindow::on_actionOpen_triggered()
|
||||||
const QString filter(tr("Watermark files") + QLatin1String(" (*.vwm)"));
|
const QString filter(tr("Watermark files") + QLatin1String(" (*.vwm)"));
|
||||||
QString dir = QDir::homePath();
|
QString dir = QDir::homePath();
|
||||||
qDebug("Run QFileDialog::getOpenFileName: dir = %s.", qUtf8Printable(dir));
|
qDebug("Run QFileDialog::getOpenFileName: dir = %s.", qUtf8Printable(dir));
|
||||||
const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), dir, filter, nullptr);
|
const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), dir, filter, nullptr,
|
||||||
|
qApp->NativeFileDialog());
|
||||||
if (filePath.isEmpty())
|
if (filePath.isEmpty())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -313,3 +313,14 @@ bool VAbstractApplication::IsWarningMessage(const QString &message) const
|
||||||
{
|
{
|
||||||
return VAbstractApplication::ClearMessage(message).startsWith(warningMessageSignature);
|
return VAbstractApplication::ClearMessage(message).startsWith(warningMessageSignature);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QFileDialog::Options VAbstractApplication::NativeFileDialog(QFileDialog::Options options) const
|
||||||
|
{
|
||||||
|
if (settings->IsDontUseNativeDialog())
|
||||||
|
{
|
||||||
|
options |= QFileDialog::DontUseNativeDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
|
#include <QFileDialog>
|
||||||
|
|
||||||
#include "../vmisc/def.h"
|
#include "../vmisc/def.h"
|
||||||
#include "../vpatterndb/vtranslatevars.h"
|
#include "../vpatterndb/vtranslatevars.h"
|
||||||
|
@ -82,6 +83,8 @@ public:
|
||||||
static const QString warningMessageSignature;
|
static const QString warningMessageSignature;
|
||||||
bool IsWarningMessage(const QString &message) const;
|
bool IsWarningMessage(const QString &message) const;
|
||||||
|
|
||||||
|
QFileDialog::Options NativeFileDialog(QFileDialog::Options options = QFileDialog::Options()) const;
|
||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
static void WinAttachConsole();
|
static void WinAttachConsole();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -66,6 +66,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationConfirmFormatRewrit
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationToolBarStyle, (QLatin1String("configuration/tool_bar_style")))
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationToolBarStyle, (QLatin1String("configuration/tool_bar_style")))
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationFreeCurveMode, (QLatin1String("configuration/freeCurveMode")))
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationFreeCurveMode, (QLatin1String("configuration/freeCurveMode")))
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationDoubleClickZoomFitBestCurrentPP, (QLatin1String("configuration/doubleClickZoomFitBestCurrentPP")))
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationDoubleClickZoomFitBestCurrentPP, (QLatin1String("configuration/doubleClickZoomFitBestCurrentPP")))
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationDontUseNativeDialog, (QLatin1String("configuration/dontUseNativeDialog")))
|
||||||
|
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternUndo, (QLatin1String("pattern/undo")))
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternUndo, (QLatin1String("pattern/undo")))
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternForbidFlipping, (QLatin1String("pattern/forbidFlipping")))
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternForbidFlipping, (QLatin1String("pattern/forbidFlipping")))
|
||||||
|
@ -1170,6 +1171,21 @@ void VCommonSettings::SetPieceShowMainPath(bool value)
|
||||||
setValue(*settingPatternPieceShowMainPath, pieceShowMainPath);
|
setValue(*settingPatternPieceShowMainPath, pieceShowMainPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool VCommonSettings::IsDontUseNativeDialog() const
|
||||||
|
{
|
||||||
|
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
|
||||||
|
return settings.value(*settingConfigurationDontUseNativeDialog, false).toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VCommonSettings::SetDontUseNativeDialog(bool value)
|
||||||
|
{
|
||||||
|
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
|
||||||
|
settings.setValue(*settingConfigurationDontUseNativeDialog, value);
|
||||||
|
settings.sync();
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal VCommonSettings::GetLineWidth() const
|
qreal VCommonSettings::GetLineWidth() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -214,6 +214,9 @@ public:
|
||||||
bool IsPieceShowMainPath() const;
|
bool IsPieceShowMainPath() const;
|
||||||
void SetPieceShowMainPath(bool value);
|
void SetPieceShowMainPath(bool value);
|
||||||
|
|
||||||
|
bool IsDontUseNativeDialog() const;
|
||||||
|
void SetDontUseNativeDialog(bool value);
|
||||||
|
|
||||||
static qreal DefaultLineWidth();
|
static qreal DefaultLineWidth();
|
||||||
static qreal MinimalLineWidth();
|
static qreal MinimalLineWidth();
|
||||||
static qreal MaximalLineWidth();
|
static qreal MaximalLineWidth();
|
||||||
|
|
|
@ -300,11 +300,7 @@ void DialogEditLabel::ExportTemplate()
|
||||||
|
|
||||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Export label template"),
|
QString fileName = QFileDialog::getSaveFileName(this, tr("Export label template"),
|
||||||
path + QLatin1String("/") + tr("template") + QLatin1String(".xml"),
|
path + QLatin1String("/") + tr("template") + QLatin1String(".xml"),
|
||||||
filters, nullptr
|
filters, nullptr, qApp->NativeFileDialog());
|
||||||
#ifdef Q_OS_LINUX
|
|
||||||
, QFileDialog::DontUseNativeDialog
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
|
|
||||||
if (fileName.isEmpty())
|
if (fileName.isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -353,11 +349,8 @@ void DialogEditLabel::ImportTemplate()
|
||||||
QString filter(tr("Label template") + QLatin1String(" (*.xml)"));
|
QString filter(tr("Label template") + QLatin1String(" (*.xml)"));
|
||||||
//Use standard path to label templates
|
//Use standard path to label templates
|
||||||
const QString path = VCommonSettings::PrepareLabelTemplates(qApp->Settings()->GetPathLabelTemplate());
|
const QString path = VCommonSettings::PrepareLabelTemplates(qApp->Settings()->GetPathLabelTemplate());
|
||||||
const QString fileName = QFileDialog::getOpenFileName(this, tr("Import template"), path, filter, nullptr
|
const QString fileName = QFileDialog::getOpenFileName(this, tr("Import template"), path, filter, nullptr,
|
||||||
#ifdef Q_OS_LINUX
|
qApp->NativeFileDialog());
|
||||||
, QFileDialog::DontUseNativeDialog
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
if (fileName.isEmpty())
|
if (fileName.isEmpty())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -180,11 +180,8 @@ QString VAbstractMainWindow::CSVFilePath()
|
||||||
const QString suffix("csv");
|
const QString suffix("csv");
|
||||||
const QString path = QDir::homePath() + QChar('/') + tr("values") + QChar('.') + suffix;
|
const QString path = QDir::homePath() + QChar('/') + tr("values") + QChar('.') + suffix;
|
||||||
|
|
||||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Export to CSV"), path, filters, nullptr
|
QString fileName = QFileDialog::getSaveFileName(this, tr("Export to CSV"), path, filters, nullptr,
|
||||||
#ifdef Q_OS_LINUX
|
qApp->NativeFileDialog());
|
||||||
, QFileDialog::DontUseNativeDialog
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
|
|
||||||
if (fileName.isEmpty())
|
if (fileName.isEmpty())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user