Gui: move options to use native or Qt dialogs to class DialogOptions
This commit is contained in:
@@ -50,8 +50,7 @@
|
||||
|
||||
using namespace Gui;
|
||||
|
||||
namespace {
|
||||
bool dontUseNativeDialog()
|
||||
bool DialogOptions::dontUseNativeFileDialog()
|
||||
{
|
||||
#if defined(USE_QT_FILEDIALOG)
|
||||
bool notNativeDialog = true;
|
||||
@@ -64,6 +63,12 @@ bool dontUseNativeDialog()
|
||||
notNativeDialog = group->GetBool("DontUseNativeDialog", notNativeDialog);
|
||||
return notNativeDialog;
|
||||
}
|
||||
|
||||
bool DialogOptions::dontUseNativeColorDialog()
|
||||
{
|
||||
ParameterGrp::handle group = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Dialog");
|
||||
return group->GetBool("DontUseNativeColorDialog", true);
|
||||
}
|
||||
|
||||
/* TRANSLATOR Gui::FileDialog */
|
||||
@@ -177,7 +182,7 @@ QString FileDialog::getSaveFileName (QWidget * parent, const QString & caption,
|
||||
// existing file. Hence we must extract the first matching suffix from the filter list and append it
|
||||
// before showing the file dialog.
|
||||
QString file;
|
||||
if (dontUseNativeDialog()) {
|
||||
if (DialogOptions::dontUseNativeFileDialog()) {
|
||||
QList<QUrl> urls;
|
||||
|
||||
options |= QFileDialog::DontUseNativeDialog;
|
||||
@@ -259,7 +264,7 @@ QString FileDialog::getOpenFileName(QWidget * parent, const QString & caption, c
|
||||
windowTitle = FileDialog::tr("Open");
|
||||
|
||||
QString file;
|
||||
if (dontUseNativeDialog()) {
|
||||
if (DialogOptions::dontUseNativeFileDialog()) {
|
||||
QList<QUrl> urls;
|
||||
|
||||
options |= QFileDialog::DontUseNativeDialog;
|
||||
@@ -320,7 +325,7 @@ QStringList FileDialog::getOpenFileNames (QWidget * parent, const QString & capt
|
||||
windowTitle = FileDialog::tr("Open");
|
||||
|
||||
QStringList files;
|
||||
if (dontUseNativeDialog()) {
|
||||
if (DialogOptions::dontUseNativeFileDialog()) {
|
||||
QList<QUrl> urls;
|
||||
|
||||
options |= QFileDialog::DontUseNativeDialog;
|
||||
@@ -708,7 +713,7 @@ void FileChooser::chooseFile()
|
||||
}
|
||||
|
||||
QFileDialog::Options dlgOpt;
|
||||
if (dontUseNativeDialog()) {
|
||||
if (DialogOptions::dontUseNativeFileDialog()) {
|
||||
dlgOpt = QFileDialog::DontUseNativeDialog;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user