mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 10:58:52 +00:00
Implement ui style selection dialog 12832
This commit is contained in:
parent
e97ebe93d3
commit
072ba7bd2e
@ -53,6 +53,10 @@
|
|||||||
|
|
||||||
* Edit > Paste operation now preserves newlines in text by default.
|
* Edit > Paste operation now preserves newlines in text by default.
|
||||||
|
|
||||||
|
* Dark mode on Windows is possible now by choosing "fusion" user interface style
|
||||||
|
in user interface preferences dialog, your system style has to be set to dark
|
||||||
|
(bug 12832).
|
||||||
|
|
||||||
|
|
||||||
!!Documents compilation process and images conversion
|
!!Documents compilation process and images conversion
|
||||||
|
|
||||||
|
10
src/LyX.cpp
10
src/LyX.cpp
@ -354,6 +354,12 @@ int LyX::exec(int & argc, char * argv[])
|
|||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This one is edited through the preferences dialog.
|
||||||
|
// need to call this before createApplication
|
||||||
|
// because we need to know the Qt style for creating the Application
|
||||||
|
if (!readRcFile("preferences", true))
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
// Let the frontend parse and remove all arguments that it knows
|
// Let the frontend parse and remove all arguments that it knows
|
||||||
pimpl_->application_.reset(createApplication(argc, argv));
|
pimpl_->application_.reset(createApplication(argc, argv));
|
||||||
|
|
||||||
@ -994,10 +1000,6 @@ bool LyX::init()
|
|||||||
pimpl_->system_movers_ = pimpl_->movers_;
|
pimpl_->system_movers_ = pimpl_->movers_;
|
||||||
system_lcolor = lcolor;
|
system_lcolor = lcolor;
|
||||||
|
|
||||||
// This one is edited through the preferences dialog.
|
|
||||||
if (!readRcFile("preferences", true))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// The language may have been set to someting useful through prefs
|
// The language may have been set to someting useful through prefs
|
||||||
setLocale();
|
setLocale();
|
||||||
|
|
||||||
|
@ -197,6 +197,7 @@ LexerKeyword lyxrcTags[] = {
|
|||||||
{ "\\texinputs_prefix", LyXRC::RC_TEXINPUTS_PREFIX },
|
{ "\\texinputs_prefix", LyXRC::RC_TEXINPUTS_PREFIX },
|
||||||
{ "\\thesaurusdir_path", LyXRC::RC_THESAURUSDIRPATH },
|
{ "\\thesaurusdir_path", LyXRC::RC_THESAURUSDIRPATH },
|
||||||
{ "\\ui_file", LyXRC::RC_UIFILE },
|
{ "\\ui_file", LyXRC::RC_UIFILE },
|
||||||
|
{ "\\ui_style", LyXRC::RC_UI_STYLE },
|
||||||
{ "\\use_converter_cache", LyXRC::RC_USE_CONVERTER_CACHE },
|
{ "\\use_converter_cache", LyXRC::RC_USE_CONVERTER_CACHE },
|
||||||
{ "\\use_converter_needauth", LyXRC::RC_USE_CONVERTER_NEEDAUTH },
|
{ "\\use_converter_needauth", LyXRC::RC_USE_CONVERTER_NEEDAUTH },
|
||||||
{ "\\use_converter_needauth_forbidden", LyXRC::RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN },
|
{ "\\use_converter_needauth_forbidden", LyXRC::RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN },
|
||||||
@ -603,6 +604,10 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
|
|||||||
lexrc >> icon_set;
|
lexrc >> icon_set;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case RC_UI_STYLE:
|
||||||
|
lexrc >> ui_style;
|
||||||
|
break;
|
||||||
|
|
||||||
case RC_USE_SYSTEM_THEME_ICONS:
|
case RC_USE_SYSTEM_THEME_ICONS:
|
||||||
lexrc >> use_system_theme_icons;
|
lexrc >> use_system_theme_icons;
|
||||||
break;
|
break;
|
||||||
@ -1624,6 +1629,15 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
|
|||||||
if (tag != RC_LAST)
|
if (tag != RC_LAST)
|
||||||
break;
|
break;
|
||||||
// fall through
|
// fall through
|
||||||
|
case RC_UI_STYLE:
|
||||||
|
if (ignore_system_lyxrc ||
|
||||||
|
ui_style != system_lyxrc.ui_style) {
|
||||||
|
os << "\\ui_style \"" << ui_style
|
||||||
|
<< "\"\n";
|
||||||
|
}
|
||||||
|
if (tag != RC_LAST)
|
||||||
|
break;
|
||||||
|
// fall through
|
||||||
case RC_USE_SYSTEM_THEME_ICONS:
|
case RC_USE_SYSTEM_THEME_ICONS:
|
||||||
if (ignore_system_lyxrc ||
|
if (ignore_system_lyxrc ||
|
||||||
use_system_theme_icons != system_lyxrc.use_system_theme_icons) {
|
use_system_theme_icons != system_lyxrc.use_system_theme_icons) {
|
||||||
@ -2950,6 +2964,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
|
|||||||
case LyXRC::RC_GROUP_LAYOUTS:
|
case LyXRC::RC_GROUP_LAYOUTS:
|
||||||
case LyXRC::RC_HUNSPELLDIR_PATH:
|
case LyXRC::RC_HUNSPELLDIR_PATH:
|
||||||
case LyXRC::RC_ICON_SET:
|
case LyXRC::RC_ICON_SET:
|
||||||
|
case LyXRC::RC_UI_STYLE:
|
||||||
case LyXRC::RC_INDEX_ALTERNATIVES:
|
case LyXRC::RC_INDEX_ALTERNATIVES:
|
||||||
case LyXRC::RC_INDEX_COMMAND:
|
case LyXRC::RC_INDEX_COMMAND:
|
||||||
case LyXRC::RC_JBIBTEX_COMMAND:
|
case LyXRC::RC_JBIBTEX_COMMAND:
|
||||||
|
@ -173,6 +173,7 @@ public:
|
|||||||
RC_TEXINPUTS_PREFIX,
|
RC_TEXINPUTS_PREFIX,
|
||||||
RC_THESAURUSDIRPATH,
|
RC_THESAURUSDIRPATH,
|
||||||
RC_UIFILE,
|
RC_UIFILE,
|
||||||
|
RC_UI_STYLE,
|
||||||
RC_USELASTFILEPOS,
|
RC_USELASTFILEPOS,
|
||||||
RC_USER_EMAIL,
|
RC_USER_EMAIL,
|
||||||
RC_USER_INITIALS,
|
RC_USER_INITIALS,
|
||||||
@ -473,6 +474,8 @@ public:
|
|||||||
std::string user_initials;
|
std::string user_initials;
|
||||||
/// icon set name
|
/// icon set name
|
||||||
std::string icon_set;
|
std::string icon_set;
|
||||||
|
/// ui style name
|
||||||
|
std::string ui_style;
|
||||||
/// whether to use the icons from the theme
|
/// whether to use the icons from the theme
|
||||||
bool use_system_theme_icons = false;
|
bool use_system_theme_icons = false;
|
||||||
/// True if the TeX engine cannot handle posix paths
|
/// True if the TeX engine cannot handle posix paths
|
||||||
|
@ -222,6 +222,9 @@ frontend::Application * createApplication(int & argc, char * argv[])
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (!lyxrc.ui_style.empty())
|
||||||
|
frontend::GuiApplication::setStyle(toqstr(lyxrc.ui_style));
|
||||||
|
|
||||||
frontend::GuiApplication * guiApp = new frontend::GuiApplication(argc, argv);
|
frontend::GuiApplication * guiApp = new frontend::GuiApplication(argc, argv);
|
||||||
// I'd rather do that in the constructor, but I do not think that
|
// I'd rather do that in the constructor, but I do not think that
|
||||||
// the palette is accessible there.
|
// the palette is accessible there.
|
||||||
|
@ -63,6 +63,7 @@
|
|||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include <QStyleFactory>
|
||||||
#include <QTreeWidget>
|
#include <QTreeWidget>
|
||||||
#include <QTreeWidgetItem>
|
#include <QTreeWidgetItem>
|
||||||
#include <QValidator>
|
#include <QValidator>
|
||||||
@ -2494,6 +2495,8 @@ PrefUserInterface::PrefUserInterface(GuiPreferences * form)
|
|||||||
this, SIGNAL(changed()));
|
this, SIGNAL(changed()));
|
||||||
connect(iconSetCO, SIGNAL(activated(int)),
|
connect(iconSetCO, SIGNAL(activated(int)),
|
||||||
this, SIGNAL(changed()));
|
this, SIGNAL(changed()));
|
||||||
|
connect(uiStyleCO, SIGNAL(activated(int)),
|
||||||
|
this, SIGNAL(changed()));
|
||||||
connect(useSystemThemeIconsCB, SIGNAL(clicked()),
|
connect(useSystemThemeIconsCB, SIGNAL(clicked()),
|
||||||
this, SIGNAL(changed()));
|
this, SIGNAL(changed()));
|
||||||
connect(lastfilesSB, SIGNAL(valueChanged(int)),
|
connect(lastfilesSB, SIGNAL(valueChanged(int)),
|
||||||
@ -2516,6 +2519,11 @@ PrefUserInterface::PrefUserInterface(GuiPreferences * form)
|
|||||||
iconSetCO->addItem(qt_("Classic"), "classic");
|
iconSetCO->addItem(qt_("Classic"), "classic");
|
||||||
iconSetCO->addItem(qt_("Oxygen"), "oxygen");
|
iconSetCO->addItem(qt_("Oxygen"), "oxygen");
|
||||||
|
|
||||||
|
for (const auto& style : QStyleFactory::keys())
|
||||||
|
{
|
||||||
|
uiStyleCO->addItem(style.toLower());
|
||||||
|
}
|
||||||
|
|
||||||
if (guiApp->platformName() != "xcb"
|
if (guiApp->platformName() != "xcb"
|
||||||
&& !guiApp->platformName().contains("wayland"))
|
&& !guiApp->platformName().contains("wayland"))
|
||||||
useSystemThemeIconsCB->hide();
|
useSystemThemeIconsCB->hide();
|
||||||
@ -2527,6 +2535,9 @@ void PrefUserInterface::applyRC(LyXRC & rc) const
|
|||||||
rc.icon_set = fromqstr(iconSetCO->itemData(
|
rc.icon_set = fromqstr(iconSetCO->itemData(
|
||||||
iconSetCO->currentIndex()).toString());
|
iconSetCO->currentIndex()).toString());
|
||||||
|
|
||||||
|
frontend::GuiApplication::setStyle(uiStyleCO->currentText());
|
||||||
|
rc.ui_style = fromqstr(uiStyleCO->currentText());
|
||||||
|
|
||||||
rc.ui_file = internal_path(fromqstr(uiFileED->text()));
|
rc.ui_file = internal_path(fromqstr(uiFileED->text()));
|
||||||
rc.use_system_theme_icons = useSystemThemeIconsCB->isChecked();
|
rc.use_system_theme_icons = useSystemThemeIconsCB->isChecked();
|
||||||
rc.num_lastfiles = lastfilesSB->value();
|
rc.num_lastfiles = lastfilesSB->value();
|
||||||
@ -2545,6 +2556,8 @@ void PrefUserInterface::updateRC(LyXRC const & rc)
|
|||||||
if (iconset < 0)
|
if (iconset < 0)
|
||||||
iconset = 0;
|
iconset = 0;
|
||||||
iconSetCO->setCurrentIndex(iconset);
|
iconSetCO->setCurrentIndex(iconset);
|
||||||
|
uiStyleCO->setCurrentIndex(uiStyleCO->findText(
|
||||||
|
frontend::GuiApplication::style()->objectName().toLower()));
|
||||||
useSystemThemeIconsCB->setChecked(rc.use_system_theme_icons);
|
useSystemThemeIconsCB->setChecked(rc.use_system_theme_icons);
|
||||||
uiFileED->setText(toqstr(external_path(rc.ui_file)));
|
uiFileED->setText(toqstr(external_path(rc.ui_file)));
|
||||||
lastfilesSB->setValue(rc.num_lastfiles);
|
lastfilesSB->setValue(rc.num_lastfiles);
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>556</width>
|
<width>556</width>
|
||||||
<height>476</height>
|
<height>502</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -42,18 +42,8 @@
|
|||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<layout class="QGridLayout" name="gridLayout" columnstretch="0,1,0">
|
<layout class="QGridLayout" name="gridLayout" columnstretch="0,1,0">
|
||||||
<item row="0" column="0">
|
<item row="1" column="2">
|
||||||
<widget class="QLabel" name="uiFileLA">
|
<layout class="QHBoxLayout" name="horizontalLayout"/>
|
||||||
<property name="text">
|
|
||||||
<string>&User interface file:</string>
|
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>uiFileED</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QLineEdit" name="uiFileED"/>
|
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="0" column="2">
|
||||||
<widget class="QPushButton" name="uiFilePB">
|
<widget class="QPushButton" name="uiFilePB">
|
||||||
@ -62,6 +52,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QComboBox" name="iconSetCO">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>The icon set to use. Warning: normal size of icons may be wrong until you save the preferences and restart LyX.</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="iconSetLA">
|
<widget class="QLabel" name="iconSetLA">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -72,15 +69,38 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="0" column="0">
|
||||||
<widget class="QComboBox" name="iconSetCO">
|
<widget class="QLabel" name="uiFileLA">
|
||||||
<property name="toolTip">
|
<property name="text">
|
||||||
<string>The icon set to use. Warning: normal size of icons may be wrong until you save the preferences and restart LyX.</string>
|
<string>&User interface file:</string>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>uiFileED</cstring>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2">
|
<item row="0" column="1">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout"/>
|
<widget class="QLineEdit" name="uiFileED"/>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="uiStyleLA">
|
||||||
|
<property name="text">
|
||||||
|
<string>User interface &style:</string>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>uiStyleCO</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QComboBox" name="uiStyleCO">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Only certain styles may support dark mode, e.g. fusion on Windows</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2"/>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
Loading…
Reference in New Issue
Block a user