mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-08-02 03:26:14 -04: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:
parent
a8c02fdc3c
commit
1d7ef5d4eb
7 changed files with 77 additions and 30 deletions
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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue