mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-08-02 03:26:14 -04:00
Add custom light and dark UI themes
This commit is contained in:
parent
6d2ca74878
commit
557736ea5e
39 changed files with 6452 additions and 401 deletions
17
src/main.cpp
17
src/main.cpp
|
@ -29,6 +29,9 @@
|
|||
#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>
|
||||
|
@ -60,6 +63,20 @@ int main(int argc, char** argv)
|
|||
Application app(argc, 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