Use native dialog on all platforms except Linux.

We have a bug with native dialog on Linux that's why we cannot use it.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2018-04-04 08:34:48 +03:00
parent 911a85d79b
commit d8c3a0ac81
8 changed files with 67 additions and 23 deletions

View File

@ -972,8 +972,11 @@ void TMainWindow::ImportDataFromCSV()
const QString filters = tr("Comma-Separated Values") + QLatin1String(" (*.csv)");
const QString suffix("csv");
QString fileName = QFileDialog::getOpenFileName(this, tr("Import from CSV"), QDir::homePath(), filters, nullptr,
QFileDialog::DontUseNativeDialog);
QString fileName = QFileDialog::getOpenFileName(this, tr("Import from CSV"), QDir::homePath(), filters, nullptr
#ifdef Q_OS_LINUX
, QFileDialog::DontUseNativeDialog
#endif
);
if (fileName.isEmpty())
{

View File

@ -148,7 +148,10 @@ void PreferencesPathPage::EditPath()
const QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"), path,
QFileDialog::ShowDirsOnly
| QFileDialog::DontResolveSymlinks
| QFileDialog::DontUseNativeDialog);
#ifdef Q_OS_LINUX
| QFileDialog::DontUseNativeDialog
#endif
);
if (dir.isEmpty())
{
if (usedNotExistedDir)

View File

@ -837,8 +837,11 @@ void DialogPatternProperties::InitImage()
void DialogPatternProperties::ChangeImage()
{
const QString filter = tr("Images") + QLatin1String(" (*.png *.jpg *.jpeg *.bmp)");
const QString fileName = QFileDialog::getOpenFileName(this, tr("Image for pattern"), QString(), filter, nullptr,
QFileDialog::DontUseNativeDialog);
const QString fileName = QFileDialog::getOpenFileName(this, tr("Image for pattern"), QString(), filter, nullptr
#ifdef Q_OS_LINUX
, QFileDialog::DontUseNativeDialog
#endif
);
if (not fileName.isEmpty())
{
QImage image;
@ -879,8 +882,11 @@ void DialogPatternProperties::SaveImage()
QByteArray ba = QByteArray::fromBase64(byteArray);
const QString extension = QLatin1String(".") + doc->GetImageExtension();
QString filter = tr("Images") + QLatin1String(" (*") + extension + QLatin1String(")");
QString filename = QFileDialog::getSaveFileName(this, tr("Save File"), tr("untitled"), filter, &filter,
QFileDialog::DontUseNativeDialog);
QString filename = QFileDialog::getSaveFileName(this, tr("Save File"), tr("untitled"), filter, &filter
#ifdef Q_OS_LINUX
, QFileDialog::DontUseNativeDialog
#endif
);
if (not filename.isEmpty())
{
if (not filename.endsWith(extension.toUpper()))

View File

@ -129,7 +129,10 @@ DialogSaveLayout::DialogSaveLayout(int count, Draw mode, const QString &fileName
const QString dir = QFileDialog::getExistingDirectory(this, tr("Select folder"), dirPath,
QFileDialog::ShowDirsOnly
| QFileDialog::DontResolveSymlinks
| QFileDialog::DontUseNativeDialog);
#ifdef Q_OS_LINUX
| QFileDialog::DontUseNativeDialog
#endif
);
if (not dir.isEmpty())
{// If paths equal the signal will not be called, we will do this manually
dir == ui->lineEditPath->text() ? PathChanged(dir) : ui->lineEditPath->setText(dir);

View File

@ -1659,8 +1659,11 @@ void MainWindow::LoadIndividual()
usedNotExistedDir = directory.mkpath(".");
}
const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter, nullptr,
QFileDialog::DontUseNativeDialog);
const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter, nullptr
#ifdef Q_OS_LINUX
, QFileDialog::DontUseNativeDialog
#endif
);
if (not mPath.isEmpty())
{
@ -1697,8 +1700,11 @@ void MainWindow::LoadMultisize()
//Use standard path to multisize measurements
QString path = qApp->ValentinaSettings()->GetPathMultisizeMeasurements();
path = VCommonSettings::PrepareMultisizeTables(path);
const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter, nullptr,
QFileDialog::DontUseNativeDialog);
const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter, nullptr
#ifdef Q_OS_LINUX
, QFileDialog::DontUseNativeDialog
#endif
);
if (not mPath.isEmpty())
{
@ -2744,7 +2750,11 @@ bool MainWindow::SaveAs()
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"),
dir + QLatin1String("/") + tr("pattern") + QLatin1String(".val"),
filters, nullptr, QFileDialog::DontUseNativeDialog);
filters, nullptr
#ifdef Q_OS_LINUX
, QFileDialog::DontUseNativeDialog
#endif
);
auto RemoveTempDir = [usedNotExistedDir, dir]()
{
@ -2935,8 +2945,11 @@ void MainWindow::Open()
dir = QFileInfo(files.first()).absolutePath();
}
qCDebug(vMainWindow, "Run QFileDialog::getOpenFileName: dir = %s.", qUtf8Printable(dir));
const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), dir, filter, nullptr,
QFileDialog::DontUseNativeDialog);
const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), dir, filter, nullptr
#ifdef Q_OS_LINUX
, QFileDialog::DontUseNativeDialog
#endif
);
if (filePath.isEmpty())
{
return;

View File

@ -113,10 +113,16 @@ void VPE::VFileEditWidget::onToolButtonClicked()
{
QString filepath = (Directory ? QFileDialog::getExistingDirectory(nullptr, tr("Directory"), CurrentFilePath,
QFileDialog::ShowDirsOnly
| QFileDialog::DontUseNativeDialog)
#ifdef Q_OS_LINUX
| QFileDialog::DontUseNativeDialog
#endif
)
: QFileDialog::getOpenFileName(nullptr, tr("Open File"), CurrentFilePath,
FileDialogFilter, nullptr,
QFileDialog::DontUseNativeDialog));
FileDialogFilter, nullptr
#ifdef Q_OS_LINUX
, QFileDialog::DontUseNativeDialog
#endif
));
if (filepath.isNull() == false)
{
setFile(filepath, true);

View File

@ -291,7 +291,11 @@ void DialogEditLabel::ExportTemplate()
QString fileName = QFileDialog::getSaveFileName(this, tr("Export label template"),
path + QLatin1String("/") + tr("template") + QLatin1String(".xml"),
filters, nullptr, QFileDialog::DontUseNativeDialog);
filters, nullptr
#ifdef Q_OS_LINUX
, QFileDialog::DontUseNativeDialog
#endif
);
if (fileName.isEmpty())
{
@ -340,8 +344,11 @@ void DialogEditLabel::ImportTemplate()
QString filter(tr("Label template") + QLatin1String(" (*.xml)"));
//Use standard path to label templates
const QString path = VCommonSettings::PrepareLabelTemplates(qApp->Settings()->GetPathLabelTemplate());
const QString fileName = QFileDialog::getOpenFileName(this, tr("Import template"), path, filter, nullptr,
QFileDialog::DontUseNativeDialog);
const QString fileName = QFileDialog::getOpenFileName(this, tr("Import template"), path, filter, nullptr
#ifdef Q_OS_LINUX
, QFileDialog::DontUseNativeDialog
#endif
);
if (fileName.isEmpty())
{
return;

View File

@ -106,8 +106,11 @@ QString VAbstractMainWindow::CSVFilePath()
const QString suffix("csv");
const QString path = QDir::homePath() + QLatin1String("/") + tr("values") + QLatin1String(".") + suffix;
QString fileName = QFileDialog::getSaveFileName(this, tr("Export to CSV"), path, filters, nullptr,
QFileDialog::DontUseNativeDialog);
QString fileName = QFileDialog::getSaveFileName(this, tr("Export to CSV"), path, filters, nullptr
#ifdef Q_OS_LINUX
, QFileDialog::DontUseNativeDialog
#endif
);
if (fileName.isEmpty())
{