Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFelix Geyer <debfx@fobos.de>2012-01-06 01:27:08 +0400
committerFelix Geyer <debfx@fobos.de>2012-01-06 01:27:08 +0400
commit55c94e61663cea0ad74a02993704b39b9deeab9e (patch)
tree656154bc443395a5ca118a29816aa04f605332f9 /src
parent34d7b841c09f1b67f5463e057df230c1d54913b2 (diff)
Set application window icon.
Diffstat (limited to 'src')
-rw-r--r--src/core/DataPath.cpp22
-rw-r--r--src/core/DataPath.h2
-rw-r--r--src/gui/MainWindow.cpp3
3 files changed, 27 insertions, 0 deletions
diff --git a/src/core/DataPath.cpp b/src/core/DataPath.cpp
index a69463c4c..8e7991c96 100644
--- a/src/core/DataPath.cpp
+++ b/src/core/DataPath.cpp
@@ -33,6 +33,28 @@ QString DataPath::getPath(const QString& name)
return m_instance->m_basePath + name;
}
+QIcon DataPath::applicationIcon()
+{
+ if (!m_instance) {
+ m_instance = new DataPath();
+ }
+
+ QIcon icon = QIcon::fromTheme("keepassx");
+
+#if defined(QT_DEBUG) || defined(Q_WS_MAC) || defined(Q_WS_WIN)
+ if (icon.isNull()) {
+ QStringList pngSizes;
+ pngSizes << "16" << "24" << "32" << "48" << "64" << "128";
+ Q_FOREACH (const QString& size, pngSizes) {
+ icon.addFile(QString("%1/icons/application/%2x%2/apps/keepassx.png").arg(m_instance->m_basePath, size));
+ }
+ icon.addFile(QString("%1/icons/application/scalable/apps/keepassx.svg").arg(m_instance->m_basePath));
+ }
+#endif
+
+ return icon;
+}
+
DataPath::DataPath()
{
if (false) {
diff --git a/src/core/DataPath.h b/src/core/DataPath.h
index 7d1056065..8c5639b83 100644
--- a/src/core/DataPath.h
+++ b/src/core/DataPath.h
@@ -19,11 +19,13 @@
#define KEEPASSX_DATAPATH_H
#include <QtCore/QString>
+#include <QtGui/QIcon>
class DataPath
{
public:
static QString getPath(const QString& name);
+ static QIcon applicationIcon();
private:
DataPath();
diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp
index f8cb7d00e..51796e810 100644
--- a/src/gui/MainWindow.cpp
+++ b/src/gui/MainWindow.cpp
@@ -19,6 +19,7 @@
#include "ui_MainWindow.h"
#include "core/Database.h"
+#include "core/DataPath.h"
#include "core/Metadata.h"
#include "gui/DatabaseWidget.h"
@@ -27,6 +28,8 @@ MainWindow::MainWindow()
{
m_ui->setupUi(this);
+ setWindowIcon(DataPath::applicationIcon());
+
connect(m_ui->tabWidget, SIGNAL(currentChanged(int)), SLOT(currentTabChanged(int)));
connect(m_ui->tabWidget, SIGNAL(entrySelectionChanged(bool)), m_ui->actionEntryEdit, SLOT(setEnabled(bool)));
connect(m_ui->tabWidget, SIGNAL(entrySelectionChanged(bool)), m_ui->actionEntryDelete, SLOT(setEnabled(bool)));