mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-14 02:27:09 -07:00
Load custom theme before initializing main window
Improves debug build startup time with custom themes
This commit is contained in:
parent
b323c4e6be
commit
5b4a940842
3 changed files with 2 additions and 8 deletions
|
@ -615,7 +615,6 @@ int Application::exec(const QStringList ¶ms)
|
|||
#else
|
||||
UIThemeManager::initInstance();
|
||||
m_window = new MainWindow;
|
||||
UIThemeManager::instance()->applyStyleSheet();
|
||||
#endif // DISABLE_GUI
|
||||
|
||||
m_running = true;
|
||||
|
|
|
@ -88,6 +88,7 @@ UIThemeManager::UIThemeManager()
|
|||
else {
|
||||
loadColorsFromJSONConfig();
|
||||
applyPalette();
|
||||
applyStyleSheet();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -99,11 +100,6 @@ UIThemeManager *UIThemeManager::instance()
|
|||
|
||||
void UIThemeManager::applyStyleSheet() const
|
||||
{
|
||||
if (!m_useCustomTheme) {
|
||||
qApp->setStyleSheet({});
|
||||
return;
|
||||
}
|
||||
|
||||
QFile qssFile(":uitheme/stylesheet.qss");
|
||||
if (!qssFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
qApp->setStyleSheet({});
|
||||
|
|
|
@ -45,8 +45,6 @@ public:
|
|||
static void freeInstance();
|
||||
static UIThemeManager *instance();
|
||||
|
||||
void applyStyleSheet() const;
|
||||
|
||||
QString getIconPath(const QString &iconId) const;
|
||||
QIcon getIcon(const QString &iconId, const QString &fallback = {}) const;
|
||||
QIcon getFlagIcon(const QString &countryIsoCode) const;
|
||||
|
@ -58,6 +56,7 @@ private:
|
|||
QString getIconPathFromResources(const QString &iconId, const QString &fallback = {}) const;
|
||||
void loadColorsFromJSONConfig();
|
||||
void applyPalette() const;
|
||||
void applyStyleSheet() const;
|
||||
|
||||
static UIThemeManager *m_instance;
|
||||
QHash<QString, QColor> m_colors;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue