Moved dark icon logic into FilePath.

This commit is contained in:
Vlad N
2017-12-17 16:52:13 +02:00
committed by Janek Bevendorff
parent 55271311c4
commit 4fa00b74ad
3 changed files with 16 additions and 35 deletions

View File

@@ -23,6 +23,7 @@
#include "config-keepassx.h"
#include "core/Global.h"
#include "core/Config.h"
FilePath* FilePath::m_instance(nullptr);
@@ -91,21 +92,15 @@ QString FilePath::pluginPath(const QString& name)
QIcon FilePath::applicationIcon()
{
bool darkIcon = useDarkIcon();
#ifdef KEEPASSXC_DIST_SNAP
return icon("apps", "keepassxc", false);
return (darkIcon) ? icon("apps", "keepassxc-dark", false) : icon("apps", "keepassxc", false);
#else
return icon("apps", "keepassxc");
return (darkIcon) ? icon("apps", "keepassxc-dark") : icon("apps", "keepassxc");
#endif
}
QIcon FilePath::applicationIconDark()
{
#ifdef KEEPASSXC_DIST_SNAP
return icon("apps", "keepassxc-dark", false);
#else
return icon("apps", "keepassxc-dark");
#endif
}
QIcon FilePath::trayIconLocked()
{
@@ -118,19 +113,12 @@ QIcon FilePath::trayIconLocked()
QIcon FilePath::trayIconUnlocked()
{
#ifdef KEEPASSXC_DIST_SNAP
return icon("apps", "keepassxc-unlocked", false);
#else
return icon("apps", "keepassxc-unlocked");
#endif
}
bool darkIcon = useDarkIcon();
QIcon FilePath::trayIconUnlockedDark()
{
#ifdef KEEPASSXC_DIST_SNAP
return icon("apps", "keepassxc-dark", false);
return (darkIcon) ? icon("apps", "keepassxc-dark", false) : icon("apps", "keepassxc-unlocked", false);
#else
return icon("apps", "keepassxc-dark");
return (darkIcon) ? icon("apps", "keepassxc-dark") : icon("apps", "keepassxc-unlocked");
#endif
}
@@ -264,6 +252,11 @@ bool FilePath::testSetDir(const QString& dir)
}
}
bool FilePath::useDarkIcon()
{
return config()->get("GUI/DarkTrayIcon").toBool();
}
FilePath* FilePath::instance()
{
if (!m_instance) {