X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt%2FGuiPrefs.cpp;h=7537ead04820af5627a2931f0ab8eb1347082d05;hb=635a7d77ddc94c63d52494dc4d68a930faccf45f;hp=01d7d9bf9dc403c81e1bfb2cd631126d1abaaf89;hpb=7d38a4d126e8e2dab08c6a47947b913921c3f083;p=features.git diff --git a/src/frontends/qt/GuiPrefs.cpp b/src/frontends/qt/GuiPrefs.cpp index 01d7d9bf9d..7537ead048 100644 --- a/src/frontends/qt/GuiPrefs.cpp +++ b/src/frontends/qt/GuiPrefs.cpp @@ -31,7 +31,6 @@ #include "ConverterCache.h" #include "FontEnums.h" #include "FuncRequest.h" -#include "KeyMap.h" #include "KeySequence.h" #include "Language.h" #include "LyXAction.h" @@ -50,8 +49,6 @@ #include "support/os.h" #include "support/Package.h" -#include "graphics/GraphicsTypes.h" - #include "frontends/alert.h" #include "frontends/Application.h" #include "frontends/FontLoader.h" @@ -191,7 +188,11 @@ QString browseRelToSub(QString const & filename, QString const & relpath, toqstr(makeRelPath(qstring_to_ucs4(outname), qstring_to_ucs4(relpath))); QString testname = reloutname; +#if QT_VERSION < 0x060000 testname.remove(QRegExp("^(\\.\\./)+")); +#else + testname.remove(QRegularExpression("^(\\.\\./)+")); +#endif if (testname.contains("/")) return outname; @@ -1207,8 +1208,8 @@ void PrefColors::resetAllColor() } -bool PrefColors::setColor(int const row, QColor const new_color, - QString const old_color) +bool PrefColors::setColor(int const row, QColor const & new_color, + QString const & old_color) { if (new_color.isValid() && new_color.name() != old_color) { newcolors_[size_t(row)] = new_color.name(); @@ -1245,7 +1246,7 @@ void PrefColors::setDisabledResets() } -bool PrefColors::isDefaultColor(int const row, QString const color) +bool PrefColors::isDefaultColor(int const row, QString const & color) { return color == getDefaultColorByRow(row).name(); } @@ -1254,7 +1255,8 @@ bool PrefColors::isDefaultColor(int const row, QString const color) QColor PrefColors::getDefaultColorByRow(int const row) { ColorSet const defaultcolor; - return defaultcolor.getX11HexName(lcolors_[size_t(row)]).c_str(); + return defaultcolor.getX11HexName(lcolors_[size_t(row)], + guiApp->colorCache().isDarkMode()).c_str(); } @@ -2426,7 +2428,11 @@ PrefLanguage::PrefLanguage(GuiPreferences * form) startCommandED->setValidator(new NoNewLineValidator(startCommandED)); endCommandED->setValidator(new NoNewLineValidator(endCommandED)); +#if QT_VERSION < 0x060000 defaultDecimalSepED->setValidator(new QRegExpValidator(QRegExp("\\S"), this)); +#else + defaultDecimalSepED->setValidator(new QRegularExpressionValidator(QRegularExpression("\\S"), this)); +#endif defaultDecimalSepED->setMaxLength(1); defaultLengthUnitCO->addItem(lyx::qt_(unit_name_gui[Length::CM]), Length::CM); @@ -2455,6 +2461,9 @@ PrefLanguage::PrefLanguage(GuiPreferences * form) index.data(Qt::UserRole).toString()); } uiLanguageCO->blockSignals(false); + + // FIXME: restore this when it works (see discussion in #6450). + respectOSkbdCB->hide(); } @@ -2583,9 +2592,12 @@ PrefUserInterface::PrefUserInterface(GuiPreferences * form) iconSetCO->addItem(qt_("Classic"), "classic"); iconSetCO->addItem(qt_("Oxygen"), "oxygen"); -#if (!(defined Q_WS_X11 || defined(QPA_XCB)) || QT_VERSION < 0x040600) - useSystemThemeIconsCB->hide(); +#if QT_VERSION >= 0x040600 + if (guiApp->platformName() != "qt4x11" + && guiApp->platformName() != "xcb" + && !guiApp->platformName().contains("wayland")) #endif + useSystemThemeIconsCB->hide(); } @@ -3147,7 +3159,7 @@ void PrefShortcuts::removeShortcut() for (auto & item : items) { string shortcut = fromqstr(item->data(1, Qt::UserRole).toString()); string lfun = fromqstr(item->text(0)); - FuncRequest func = lyxaction.lookupFunc(lfun); + FuncRequest const func = lyxaction.lookupFunc(lfun); switch (itemType(*item)) { case KeyMap::System: { @@ -3203,7 +3215,7 @@ void PrefShortcuts::deactivateShortcuts(QList const & items) for (auto item : items) { string shortcut = fromqstr(item->data(1, Qt::UserRole).toString()); string lfun = fromqstr(item->text(0)); - FuncRequest func = lyxaction.lookupFunc(lfun); + FuncRequest const func = lyxaction.lookupFunc(lfun); switch (itemType(*item)) { case KeyMap::System: @@ -3376,7 +3388,7 @@ bool PrefShortcuts::validateNewShortcut(FuncRequest const & func, void PrefShortcuts::shortcutOkPressed() { QString const new_lfun = shortcut_->lfunLE->text(); - FuncRequest func = lyxaction.lookupFunc(fromqstr(new_lfun)); + FuncRequest const func = lyxaction.lookupFunc(fromqstr(new_lfun)); KeySequence k = shortcut_->shortcutWG->getKeySequence(); // save_lfun_ contains the text of the lfun to modify, if the user clicked @@ -3689,9 +3701,6 @@ QString GuiPreferences::browse(QString const & file, } -Dialog * createGuiPreferences(GuiView & lv) { return new GuiPreferences(lv); } - - } // namespace frontend } // namespace lyx