mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-12-04 15:39:34 +01:00
Move theme detection into Application
* Add function to Application to quickly determine if in light or dark theme * Add kpxcApp symbol * Explicitly define main function for GUI tests to improve performance and use custom Application.
This commit is contained in:
16
src/main.cpp
16
src/main.cpp
@@ -29,9 +29,6 @@
|
||||
#include "gui/Application.h"
|
||||
#include "gui/MainWindow.h"
|
||||
#include "gui/MessageBox.h"
|
||||
#include "gui/osutils/OSUtils.h"
|
||||
#include "gui/styles/dark/DarkStyle.h"
|
||||
#include "gui/styles/light/LightStyle.h"
|
||||
|
||||
#if defined(WITH_ASAN) && defined(WITH_LSAN)
|
||||
#include <sanitizer/lsan_interface.h>
|
||||
@@ -64,19 +61,6 @@ int main(int argc, char** argv)
|
||||
Application::setApplicationName("KeePassXC");
|
||||
Application::setApplicationVersion(KEEPASSXC_VERSION);
|
||||
|
||||
QString appTheme = config()->get("GUI/ApplicationTheme").toString();
|
||||
if (appTheme == "auto") {
|
||||
if (osUtils->isDarkMode()) {
|
||||
QApplication::setStyle(new DarkStyle);
|
||||
} else {
|
||||
QApplication::setStyle(new LightStyle);
|
||||
}
|
||||
} else if (appTheme == "light") {
|
||||
QApplication::setStyle(new LightStyle);
|
||||
} else if (appTheme == "dark") {
|
||||
QApplication::setStyle(new DarkStyle);
|
||||
}
|
||||
|
||||
// don't set organizationName as that changes the return value of
|
||||
// QStandardPaths::writableLocation(QDesktopServices::DataLocation)
|
||||
Bootstrap::bootstrapApplication();
|
||||
|
||||
Reference in New Issue
Block a user