diff options
author | Janek Bevendorff <janek@jbev.net> | 2020-03-09 03:27:16 +0300 |
---|---|---|
committer | Jonathan White <support@dmapps.us> | 2020-03-14 17:13:12 +0300 |
commit | b045160e4fcd612def4c5cff55f9469baf12a738 (patch) | |
tree | 6c262e2a48355bb054400b647a3d515f54b682fe /src/gui | |
parent | 4ff781fa4846c7e1d9d90230dac9bc2f14369fa4 (diff) |
Bundle icons using the Qt resource system.
Simplify resource loading logic and enable reproducible builds.
Fixes #2582
Diffstat (limited to 'src/gui')
28 files changed, 135 insertions, 135 deletions
diff --git a/src/gui/AboutDialog.cpp b/src/gui/AboutDialog.cpp index bd24cf165..f9b85ac63 100644 --- a/src/gui/AboutDialog.cpp +++ b/src/gui/AboutDialog.cpp @@ -20,7 +20,7 @@ #include "ui_AboutDialog.h" #include "config-keepassx.h" -#include "core/FilePath.h" +#include "core/Resources.h" #include "core/Tools.h" #include "crypto/Crypto.h" @@ -207,7 +207,7 @@ AboutDialog::AboutDialog(QWidget* parent) nameLabelFont.setPointSize(nameLabelFont.pointSize() + 4); m_ui->nameLabel->setFont(nameLabelFont); - m_ui->iconLabel->setPixmap(filePath()->applicationIcon().pixmap(48)); + m_ui->iconLabel->setPixmap(resources()->applicationIcon().pixmap(48)); QString debugInfo = Tools::debugInfo().append("\n").append(Crypto::debugInfo()); m_ui->debugInfo->setPlainText(debugInfo); diff --git a/src/gui/ApplicationSettingsWidget.cpp b/src/gui/ApplicationSettingsWidget.cpp index b17c44ecc..3424a46fb 100644 --- a/src/gui/ApplicationSettingsWidget.cpp +++ b/src/gui/ApplicationSettingsWidget.cpp @@ -24,8 +24,8 @@ #include "autotype/AutoType.h" #include "core/Config.h" -#include "core/FilePath.h" #include "core/Global.h" +#include "core/Resources.h" #include "core/Translator.h" #include "MessageBox.h" @@ -91,8 +91,8 @@ ApplicationSettingsWidget::ApplicationSettingsWidget(QWidget* parent) m_secUi->setupUi(m_secWidget); m_generalUi->setupUi(m_generalWidget); - addPage(tr("General"), FilePath::instance()->icon("categories", "preferences-other"), m_generalWidget); - addPage(tr("Security"), FilePath::instance()->icon("status", "security-high"), m_secWidget); + addPage(tr("General"), Resources::instance()->icon("preferences-other"), m_generalWidget); + addPage(tr("Security"), Resources::instance()->icon("security-high"), m_secWidget); if (!autoType()->isAvailable()) { m_generalUi->generalSettingsTabWidget->removeTab(1); diff --git a/src/gui/CloneDialog.cpp b/src/gui/CloneDialog.cpp index e91df62c7..2441b3f17 100644 --- a/src/gui/CloneDialog.cpp +++ b/src/gui/CloneDialog.cpp @@ -21,7 +21,7 @@ #include "config-keepassx.h" #include "core/Database.h" #include "core/Entry.h" -#include "core/FilePath.h" +#include "core/Resources.h" #include "crypto/Crypto.h" #include "gui/DatabaseWidget.h" diff --git a/src/gui/DatabaseOpenWidget.cpp b/src/gui/DatabaseOpenWidget.cpp index c58b2df40..31391b12b 100644 --- a/src/gui/DatabaseOpenWidget.cpp +++ b/src/gui/DatabaseOpenWidget.cpp @@ -21,7 +21,7 @@ #include "core/Config.h" #include "core/Database.h" -#include "core/FilePath.h" +#include "core/Resources.h" #include "crypto/Random.h" #include "format/KeePass2Reader.h" #include "gui/FileDialog.h" @@ -61,14 +61,14 @@ DatabaseOpenWidget::DatabaseOpenWidget(QWidget* parent) connect(m_ui->buttonBox, SIGNAL(accepted()), SLOT(openDatabase())); connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(reject())); - m_ui->hardwareKeyLabelHelp->setIcon(filePath()->icon("actions", "system-help").pixmap(QSize(12, 12))); + m_ui->hardwareKeyLabelHelp->setIcon(resources()->icon("system-help").pixmap(QSize(12, 12))); connect(m_ui->hardwareKeyLabelHelp, SIGNAL(clicked(bool)), SLOT(openHardwareKeyHelp())); - m_ui->keyFileLabelHelp->setIcon(filePath()->icon("actions", "system-help").pixmap(QSize(12, 12))); + m_ui->keyFileLabelHelp->setIcon(resources()->icon("system-help").pixmap(QSize(12, 12))); connect(m_ui->keyFileLabelHelp, SIGNAL(clicked(bool)), SLOT(openKeyFileHelp())); connect(m_ui->comboKeyFile->lineEdit(), SIGNAL(textChanged(QString)), SLOT(handleKeyFileComboEdited())); connect(m_ui->comboKeyFile, SIGNAL(currentIndexChanged(int)), SLOT(handleKeyFileComboChanged())); - m_ui->keyFileClearIcon->setIcon(filePath()->icon("actions", "edit-clear-locationbar-rtl")); + m_ui->keyFileClearIcon->setIcon(resources()->icon("edit-clear-locationbar-rtl")); m_ui->keyFileClearIcon->setVisible(false); connect(m_ui->keyFileClearIcon, SIGNAL(triggered(bool)), SLOT(clearKeyFileEdit())); diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp index 6434ba923..e6cc9f309 100644 --- a/src/gui/DatabaseWidget.cpp +++ b/src/gui/DatabaseWidget.cpp @@ -36,11 +36,11 @@ #include "core/Config.h" #include "core/Database.h" #include "core/EntrySearcher.h" -#include "core/FilePath.h" #include "core/FileWatcher.h" #include "core/Group.h" #include "core/Merger.h" #include "core/Metadata.h" +#include "core/Resources.h" #include "core/Tools.h" #include "format/KeePass2Reader.h" #include "gui/Clipboard.h" diff --git a/src/gui/EditWidget.cpp b/src/gui/EditWidget.cpp index f9bcbb5af..68a8d7d4a 100644 --- a/src/gui/EditWidget.cpp +++ b/src/gui/EditWidget.cpp @@ -22,7 +22,7 @@ #include <QPushButton> #include <QScrollArea> -#include "core/FilePath.h" +#include "core/Resources.h" EditWidget::EditWidget(QWidget* parent) : DialogyWidget(parent) diff --git a/src/gui/EntryPreviewWidget.cpp b/src/gui/EntryPreviewWidget.cpp index 2e2e37dbc..08627ac3c 100644 --- a/src/gui/EntryPreviewWidget.cpp +++ b/src/gui/EntryPreviewWidget.cpp @@ -24,7 +24,7 @@ #include <QDir> #include "core/Config.h" -#include "core/FilePath.h" +#include "core/Resources.h" #include "entry/EntryAttachmentsModel.h" #include "gui/Clipboard.h" #if defined(WITH_XC_KEESHARE) @@ -48,12 +48,12 @@ EntryPreviewWidget::EntryPreviewWidget(QWidget* parent) m_ui->setupUi(this); // Entry - m_ui->entryTotpButton->setIcon(filePath()->icon("actions", "chronometer")); - m_ui->entryCloseButton->setIcon(filePath()->icon("actions", "dialog-close")); + m_ui->entryTotpButton->setIcon(resources()->icon("chronometer")); + m_ui->entryCloseButton->setIcon(resources()->icon("dialog-close")); m_ui->entryPasswordLabel->setFont(Font::fixedFont()); - m_ui->togglePasswordButton->setIcon(filePath()->onOffIcon("actions", "password-show")); - m_ui->toggleEntryNotesButton->setIcon(filePath()->onOffIcon("actions", "password-show")); - m_ui->toggleGroupNotesButton->setIcon(filePath()->onOffIcon("actions", "password-show")); + m_ui->togglePasswordButton->setIcon(resources()->onOffIcon("password-show")); + m_ui->toggleEntryNotesButton->setIcon(resources()->onOffIcon("password-show")); + m_ui->toggleGroupNotesButton->setIcon(resources()->onOffIcon("password-show")); m_ui->entryAttachmentsWidget->setReadOnly(true); m_ui->entryAttachmentsWidget->setButtonsVisible(false); @@ -78,7 +78,7 @@ EntryPreviewWidget::EntryPreviewWidget(QWidget* parent) connect(&m_totpTimer, SIGNAL(timeout()), SLOT(updateTotpLabel())); // Group - m_ui->groupCloseButton->setIcon(filePath()->icon("actions", "dialog-close")); + m_ui->groupCloseButton->setIcon(resources()->icon("dialog-close")); connect(m_ui->groupCloseButton, SIGNAL(clicked()), SLOT(hide())); connect(m_ui->groupTabWidget, SIGNAL(tabBarClicked(int)), SLOT(updateTabIndexes()), Qt::QueuedConnection); diff --git a/src/gui/KMessageWidget.cpp b/src/gui/KMessageWidget.cpp index 01925b7dd..5e11b354c 100644 --- a/src/gui/KMessageWidget.cpp +++ b/src/gui/KMessageWidget.cpp @@ -20,7 +20,7 @@ */ #include "KMessageWidget.h" -#include "core/FilePath.h" +#include "core/Resources.h" #include "core/Global.h" #include <QAction> @@ -94,7 +94,7 @@ void KMessageWidgetPrivate::init(KMessageWidget *q_ptr) QAction *closeAction = new QAction(q); closeAction->setText(KMessageWidget::tr("&Close")); closeAction->setToolTip(KMessageWidget::tr("Close message")); - closeAction->setIcon(FilePath::instance()->icon("actions", "message-close")); + closeAction->setIcon(Resources::instance()->icon("message-close")); QObject::connect(closeAction, SIGNAL(triggered(bool)), q, SLOT(animatedHide())); diff --git a/src/gui/LineEdit.cpp b/src/gui/LineEdit.cpp index 98a5c09e8..ec5cb7f9c 100644 --- a/src/gui/LineEdit.cpp +++ b/src/gui/LineEdit.cpp @@ -22,7 +22,7 @@ #include <QStyle> #include <QToolButton> -#include "core/FilePath.h" +#include "core/Resources.h" LineEdit::LineEdit(QWidget* parent) : QLineEdit(parent) @@ -33,7 +33,7 @@ LineEdit::LineEdit(QWidget* parent) QString iconNameDirected = QString("edit-clear-locationbar-").append((layoutDirection() == Qt::LeftToRight) ? "rtl" : "ltr"); - const auto icon = filePath()->icon("actions", iconNameDirected); + const auto icon = resources()->icon(iconNameDirected); m_clearButton->setIcon(icon); m_clearButton->setCursor(Qt::ArrowCursor); diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 7623a13f8..485c21125 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -31,9 +31,9 @@ #include "autotype/AutoType.h" #include "core/Config.h" -#include "core/FilePath.h" #include "core/InactivityTimer.h" #include "core/Metadata.h" +#include "core/Resources.h" #include "core/Tools.h" #include "gui/AboutDialog.h" #include "gui/DatabaseWidget.h" @@ -103,7 +103,7 @@ public: QIcon icon() override { - return FilePath::instance()->icon("apps", "internet-web-browser"); + return Resources::instance()->icon("internet-web-browser"); } QWidget* createWidget() override @@ -210,7 +210,7 @@ MainWindow::MainWindow() m_ui->settingsWidget->addSettingsPage(fdoSS); #endif - setWindowIcon(filePath()->applicationIcon()); + setWindowIcon(resources()->applicationIcon()); m_ui->globalMessageWidget->setHidden(true); // clang-format off connect(m_ui->globalMessageWidget, &MessageWidget::linkActivated, &MessageWidget::openHttpUrl); @@ -334,48 +334,48 @@ MainWindow::MainWindow() new QShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_C, this, SLOT(togglePasswordsHidden())); new QShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_B, this, SLOT(toggleUsernamesHidden())); - m_ui->actionDatabaseNew->setIcon(filePath()->icon("actions", "document-new")); - m_ui->actionDatabaseOpen->setIcon(filePath()->icon("actions", "document-open")); - m_ui->actionDatabaseSave->setIcon(filePath()->icon("actions", "document-save")); - m_ui->actionDatabaseSaveAs->setIcon(filePath()->icon("actions", "document-save-as")); - m_ui->actionDatabaseClose->setIcon(filePath()->icon("actions", "document-close")); - m_ui->actionReports->setIcon(filePath()->icon("actions", "help-about")); - m_ui->actionChangeDatabaseSettings->setIcon(filePath()->icon("actions", "document-edit")); - m_ui->actionChangeMasterKey->setIcon(filePath()->icon("actions", "database-change-key")); - m_ui->actionLockDatabases->setIcon(filePath()->icon("actions", "database-lock")); - m_ui->actionQuit->setIcon(filePath()->icon("actions", "application-exit")); - m_ui->actionDatabaseMerge->setIcon(filePath()->icon("actions", "database-merge")); - - m_ui->actionEntryNew->setIcon(filePath()->icon("actions", "entry-new")); - m_ui->actionEntryClone->setIcon(filePath()->icon("actions", "entry-clone")); - m_ui->actionEntryEdit->setIcon(filePath()->icon("actions", "entry-edit")); - m_ui->actionEntryDelete->setIcon(filePath()->icon("actions", "entry-delete")); - m_ui->actionEntryAutoType->setIcon(filePath()->icon("actions", "auto-type")); - m_ui->actionEntryCopyUsername->setIcon(filePath()->icon("actions", "username-copy")); - m_ui->actionEntryCopyPassword->setIcon(filePath()->icon("actions", "password-copy")); - m_ui->actionEntryCopyURL->setIcon(filePath()->icon("actions", "url-copy")); - m_ui->actionEntryDownloadIcon->setIcon(filePath()->icon("actions", "favicon-download")); - m_ui->actionGroupSortAsc->setIcon(filePath()->icon("actions", "sort-alphabetical-ascending")); - m_ui->actionGroupSortDesc->setIcon(filePath()->icon("actions", "sort-alphabetical-descending")); - - m_ui->actionGroupNew->setIcon(filePath()->icon("actions", "group-new")); - m_ui->actionGroupEdit->setIcon(filePath()->icon("actions", "group-edit")); - m_ui->actionGroupDelete->setIcon(filePath()->icon("actions", "group-delete")); - m_ui->actionGroupEmptyRecycleBin->setIcon(filePath()->icon("actions", "group-empty-trash")); - m_ui->actionEntryOpenUrl->setIcon(filePath()->icon("actions", "web")); - m_ui->actionGroupDownloadFavicons->setIcon(filePath()->icon("actions", "favicon-download")); - - m_ui->actionSettings->setIcon(filePath()->icon("actions", "configure")); - m_ui->actionPasswordGenerator->setIcon(filePath()->icon("actions", "password-generator")); - - m_ui->actionAbout->setIcon(filePath()->icon("actions", "help-about")); - m_ui->actionDonate->setIcon(filePath()->icon("actions", "donate")); - m_ui->actionBugReport->setIcon(filePath()->icon("actions", "bugreport")); - m_ui->actionGettingStarted->setIcon(filePath()->icon("actions", "getting-started")); - m_ui->actionUserGuide->setIcon(filePath()->icon("actions", "user-guide")); - m_ui->actionOnlineHelp->setIcon(filePath()->icon("actions", "system-help")); - m_ui->actionKeyboardShortcuts->setIcon(filePath()->icon("actions", "keyboard-shortcuts")); - m_ui->actionCheckForUpdates->setIcon(filePath()->icon("actions", "system-software-update")); + m_ui->actionDatabaseNew->setIcon(resources()->icon("document-new")); + m_ui->actionDatabaseOpen->setIcon(resources()->icon("document-open")); + m_ui->actionDatabaseSave->setIcon(resources()->icon("document-save")); + m_ui->actionDatabaseSaveAs->setIcon(resources()->icon("document-save-as")); + m_ui->actionDatabaseClose->setIcon(resources()->icon("document-close")); + m_ui->actionReports->setIcon(resources()->icon("help-about")); + m_ui->actionChangeDatabaseSettings->setIcon(resources()->icon("document-edit")); + m_ui->actionChangeMasterKey->setIcon(resources()->icon("database-change-key")); + m_ui->actionLockDatabases->setIcon(resources()->icon("database-lock")); + m_ui->actionQuit->setIcon(resources()->icon("application-exit")); + m_ui->actionDatabaseMerge->setIcon(resources()->icon("database-merge")); + + m_ui->actionEntryNew->setIcon(resources()->icon("entry-new")); + m_ui->actionEntryClone->setIcon(resources()->icon("entry-clone")); + m_ui->actionEntryEdit->setIcon(resources()->icon("entry-edit")); + m_ui->actionEntryDelete->setIcon(resources()->icon("entry-delete")); + m_ui->actionEntryAutoType->setIcon(resources()->icon("auto-type")); + m_ui->actionEntryCopyUsername->setIcon(resources()->icon("username-copy")); + m_ui->actionEntryCopyPassword->setIcon(resources()->icon("password-copy")); + m_ui->actionEntryCopyURL->setIcon(resources()->icon("url-copy")); + m_ui->actionEntryDownloadIcon->setIcon(resources()->icon("favicon-download")); + m_ui->actionGroupSortAsc->setIcon(resources()->icon("sort-alphabetical-ascending")); + m_ui->actionGroupSortDesc->setIcon(resources()->icon("sort-alphabetical-descending")); + + m_ui->actionGroupNew->setIcon(resources()->icon("group-new")); + m_ui->actionGroupEdit->setIcon(resources()->icon("group-edit")); + m_ui->actionGroupDelete->setIcon(resources()->icon("group-delete")); + m_ui->actionGroupEmptyRecycleBin->setIcon(resources()->icon("group-empty-trash")); + m_ui->actionEntryOpenUrl->setIcon(resources()->icon("web")); + m_ui->actionGroupDownloadFavicons->setIcon(resources()->icon("favicon-download")); + + m_ui->actionSettings->setIcon(resources()->icon("configure")); + m_ui->actionPasswordGenerator->setIcon(resources()->icon("password-generator")); + + m_ui->actionAbout->setIcon(resources()->icon("help-about")); + m_ui->actionDonate->setIcon(resources()->icon("donate")); + m_ui->actionBugReport->setIcon(resources()->icon("bugreport")); + m_ui->actionGettingStarted->setIcon(resources()->icon("getting-started")); + m_ui->actionUserGuide->setIcon(resources()->icon("user-guide")); + m_ui->actionOnlineHelp->setIcon(resources()->icon("system-help")); + m_ui->actionKeyboardShortcuts->setIcon(resources()->icon("keyboard-shortcuts")); + m_ui->actionCheckForUpdates->setIcon(resources()->icon("system-software-update")); m_actionMultiplexer.connect( SIGNAL(currentModeChanged(DatabaseWidget::Mode)), this, SLOT(setMenuActionState(DatabaseWidget::Mode))); @@ -894,12 +894,12 @@ void MainWindow::openBugReportUrl() void MainWindow::openGettingStartedGuide() { - customOpenUrl(QString("file:///%1").arg(filePath()->dataPath("docs/KeePassXC_GettingStarted.pdf"))); + customOpenUrl(QString("file:///%1").arg(resources()->dataPath("docs/KeePassXC_GettingStarted.pdf"))); } void MainWindow::openUserGuide() { - customOpenUrl(QString("file:///%1").arg(filePath()->dataPath("docs/KeePassXC_UserGuide.pdf"))); + customOpenUrl(QString("file:///%1").arg(resources()->dataPath("docs/KeePassXC_UserGuide.pdf"))); } void MainWindow::openOnlineHelp() @@ -1138,7 +1138,7 @@ void MainWindow::updateTrayIcon() QAction* actionToggle = new QAction(tr("Toggle window"), menu); menu->addAction(actionToggle); - actionToggle->setIcon(filePath()->icon("apps", "keepassxc-dark", false)); + actionToggle->setIcon(resources()->icon("keepassxc-dark", false)); menu->addAction(m_ui->actionLockDatabases); @@ -1158,13 +1158,13 @@ void MainWindow::updateTrayIcon() m_trayIcon->setContextMenu(menu); - m_trayIcon->setIcon(filePath()->trayIcon()); + m_trayIcon->setIcon(resources()->trayIcon()); m_trayIcon->show(); } if (m_ui->tabWidget->hasLockableDatabases()) { - m_trayIcon->setIcon(filePath()->trayIconUnlocked()); + m_trayIcon->setIcon(resources()->trayIconUnlocked()); } else { - m_trayIcon->setIcon(filePath()->trayIconLocked()); + m_trayIcon->setIcon(resources()->trayIconLocked()); } } else { if (m_trayIcon) { @@ -1525,7 +1525,7 @@ void MainWindow::displayDesktopNotification(const QString& msg, QString title, i } #if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0) - m_trayIcon->showMessage(title, msg, filePath()->applicationIcon(), msTimeoutHint); + m_trayIcon->showMessage(title, msg, resources()->applicationIcon(), msTimeoutHint); #else m_trayIcon->showMessage(title, msg, QSystemTrayIcon::Information, msTimeoutHint); #endif diff --git a/src/gui/PasswordEdit.cpp b/src/gui/PasswordEdit.cpp index 9474adb16..ebe9e34ad 100644 --- a/src/gui/PasswordEdit.cpp +++ b/src/gui/PasswordEdit.cpp @@ -19,7 +19,7 @@ #include "PasswordEdit.h" #include "core/Config.h" -#include "core/FilePath.h" +#include "core/Resources.h" #include "gui/Application.h" #include "gui/Font.h" #include "gui/PasswordGeneratorWidget.h" @@ -39,12 +39,12 @@ namespace PasswordEdit::PasswordEdit(QWidget* parent) : QLineEdit(parent) { - const QIcon errorIcon = filePath()->icon("status", "dialog-error"); + const QIcon errorIcon = resources()->icon("dialog-error"); m_errorAction = addAction(errorIcon, QLineEdit::TrailingPosition); m_errorAction->setVisible(false); m_errorAction->setToolTip(tr("Passwords do not match")); - const QIcon correctIcon = filePath()->icon("actions", "dialog-ok"); + const QIcon correctIcon = resources()->icon("dialog-ok"); m_correctAction = addAction(correctIcon, QLineEdit::TrailingPosition); m_correctAction->setVisible(false); m_correctAction->setToolTip(tr("Passwords match so far")); @@ -57,7 +57,7 @@ PasswordEdit::PasswordEdit(QWidget* parent) setFont(passwordFont); m_toggleVisibleAction = new QAction( - filePath()->icon("actions", "password-show-off"), + resources()->icon("password-show"), tr("Toggle Password (%1)").arg(QKeySequence(Qt::CTRL + Qt::Key_H).toString(QKeySequence::NativeText)), nullptr); m_toggleVisibleAction->setCheckable(true); @@ -67,7 +67,7 @@ PasswordEdit::PasswordEdit(QWidget* parent) connect(m_toggleVisibleAction, &QAction::triggered, this, &PasswordEdit::setShowPassword); m_passwordGeneratorAction = new QAction( - filePath()->icon("actions", "password-generator"), + resources()->icon("password-generator"), tr("Generate Password (%1)").arg(QKeySequence(Qt::CTRL + Qt::Key_G).toString(QKeySequence::NativeText)), nullptr); m_passwordGeneratorAction->setShortcut(Qt::CTRL + Qt::Key_G); @@ -105,7 +105,7 @@ void PasswordEdit::enablePasswordGenerator() void PasswordEdit::setShowPassword(bool show) { setEchoMode(show ? QLineEdit::Normal : QLineEdit::Password); - m_toggleVisibleAction->setIcon(filePath()->icon("actions", show ? "password-show-on" : "password-show-off")); + m_toggleVisibleAction->setIcon(resources()->icon(show ? "password-show-on" : "password-show-off")); m_toggleVisibleAction->setChecked(show); if (m_repeatPasswordEdit) { diff --git a/src/gui/PasswordGeneratorWidget.cpp b/src/gui/PasswordGeneratorWidget.cpp index 7ce45b1d1..1de51ec0f 100644 --- a/src/gui/PasswordGeneratorWidget.cpp +++ b/src/gui/PasswordGeneratorWidget.cpp @@ -24,9 +24,9 @@ #include <QLineEdit> #include "core/Config.h" -#include "core/FilePath.h" #include "core/PasswordGenerator.h" #include "core/PasswordHealth.h" +#include "core/Resources.h" #include "gui/Application.h" #include "gui/Clipboard.h" @@ -38,10 +38,10 @@ PasswordGeneratorWidget::PasswordGeneratorWidget(QWidget* parent) { m_ui->setupUi(this); - m_ui->buttonGenerate->setIcon(filePath()->icon("actions", "refresh")); + m_ui->buttonGenerate->setIcon(resources()->icon("refresh")); m_ui->buttonGenerate->setToolTip( tr("Regenerate password (%1)").arg(m_ui->buttonGenerate->shortcut().toString(QKeySequence::NativeText))); - m_ui->buttonCopy->setIcon(filePath()->icon("actions", "clipboard-text")); + m_ui->buttonCopy->setIcon(resources()->icon("clipboard-text")); m_ui->buttonClose->setShortcut(Qt::Key_Escape); connect(m_ui->editNewPassword, SIGNAL(textChanged(QString)), SLOT(updateButtonsEnabled(QString))); @@ -85,7 +85,7 @@ PasswordGeneratorWidget::PasswordGeneratorWidget(QWidget* parent) m_ui->wordCaseComboBox->addItem(tr("UPPER CASE"), PassphraseGenerator::UPPERCASE); m_ui->wordCaseComboBox->addItem(tr("Title Case"), PassphraseGenerator::TITLECASE); - QDir path(filePath()->wordlistPath("")); + QDir path(resources()->wordlistPath("")); QStringList files = path.entryList(QDir::Files); m_ui->comboBoxWordList->addItems(files); if (files.size() > 1) { @@ -538,7 +538,7 @@ void PasswordGeneratorWidget::updateGenerator() m_dicewareGenerator->setWordCount(m_ui->spinBoxWordCount->value()); if (!m_ui->comboBoxWordList->currentText().isEmpty()) { - QString path = filePath()->wordlistPath(m_ui->comboBoxWordList->currentText()); + QString path = resources()->wordlistPath(m_ui->comboBoxWordList->currentText()); m_dicewareGenerator->setWordList(path); } m_dicewareGenerator->setWordSeparator(m_ui->editWordSeparator->text()); diff --git a/src/gui/SearchWidget.cpp b/src/gui/SearchWidget.cpp index 001c3d861..3702266b4 100644 --- a/src/gui/SearchWidget.cpp +++ b/src/gui/SearchWidget.cpp @@ -25,7 +25,7 @@ #include <QToolButton> #include "core/Config.h" -#include "core/FilePath.h" +#include "core/Resources.h" #include "gui/widgets/PopupHelpWidget.h" SearchWidget::SearchWidget(QWidget* parent) @@ -69,13 +69,13 @@ SearchWidget::SearchWidget(QWidget* parent) m_actionLimitGroup->setCheckable(true); m_actionLimitGroup->setChecked(config()->get("SearchLimitGroup", false).toBool()); - m_ui->searchIcon->setIcon(filePath()->icon("actions", "system-search")); + m_ui->searchIcon->setIcon(resources()->icon("system-search")); m_ui->searchEdit->addAction(m_ui->searchIcon, QLineEdit::LeadingPosition); - m_ui->helpIcon->setIcon(filePath()->icon("actions", "system-help")); + m_ui->helpIcon->setIcon(resources()->icon("system-help")); m_ui->searchEdit->addAction(m_ui->helpIcon, QLineEdit::TrailingPosition); - m_ui->clearIcon->setIcon(filePath()->icon("actions", "edit-clear-locationbar-rtl")); + m_ui->clearIcon->setIcon(resources()->icon("edit-clear-locationbar-rtl")); m_ui->clearIcon->setVisible(false); m_ui->searchEdit->addAction(m_ui->clearIcon, QLineEdit::TrailingPosition); diff --git a/src/gui/URLEdit.cpp b/src/gui/URLEdit.cpp index 4dc2a55c2..428a918db 100644 --- a/src/gui/URLEdit.cpp +++ b/src/gui/URLEdit.cpp @@ -21,7 +21,7 @@ #include <QRegularExpression> #include "core/Config.h" -#include "core/FilePath.h" +#include "core/Resources.h" #include "core/Tools.h" #include "gui/Font.h" @@ -30,7 +30,7 @@ const QColor URLEdit::ErrorColor = QColor(255, 125, 125); URLEdit::URLEdit(QWidget* parent) : QLineEdit(parent) { - const QIcon errorIcon = filePath()->icon("status", "dialog-error"); + const QIcon errorIcon = resources()->icon("dialog-error"); m_errorAction = addAction(errorIcon, QLineEdit::TrailingPosition); m_errorAction->setVisible(false); m_errorAction->setToolTip(tr("Invalid URL")); diff --git a/src/gui/UpdateCheckDialog.cpp b/src/gui/UpdateCheckDialog.cpp index 2f6d1fc48..db817a74b 100644 --- a/src/gui/UpdateCheckDialog.cpp +++ b/src/gui/UpdateCheckDialog.cpp @@ -16,7 +16,7 @@ */ #include "UpdateCheckDialog.h" -#include "core/FilePath.h" +#include "core/Resources.h" #include "ui_UpdateCheckDialog.h" #include "updatecheck/UpdateChecker.h" @@ -28,7 +28,7 @@ UpdateCheckDialog::UpdateCheckDialog(QWidget* parent) setWindowFlags(Qt::Window); setAttribute(Qt::WA_DeleteOnClose); - m_ui->iconLabel->setPixmap(filePath()->applicationIcon().pixmap(48)); + m_ui->iconLabel->setPixmap(resources()->applicationIcon().pixmap(48)); connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(close())); connect(UpdateChecker::instance(), diff --git a/src/gui/WelcomeWidget.cpp b/src/gui/WelcomeWidget.cpp index 35cce553e..25d261ea7 100644 --- a/src/gui/WelcomeWidget.cpp +++ b/src/gui/WelcomeWidget.cpp @@ -22,7 +22,7 @@ #include "config-keepassx.h" #include "core/Config.h" -#include "core/FilePath.h" +#include "core/Resources.h" WelcomeWidget::WelcomeWidget(QWidget* parent) : QWidget(parent) @@ -36,7 +36,7 @@ WelcomeWidget::WelcomeWidget(QWidget* parent) welcomeLabelFont.setPointSize(welcomeLabelFont.pointSize() + 4); m_ui->welcomeLabel->setFont(welcomeLabelFont); - m_ui->iconLabel->setPixmap(filePath()->applicationIcon().pixmap(64)); + m_ui->iconLabel->setPixmap(resources()->applicationIcon().pixmap(64)); refreshLastDatabases(); diff --git a/src/gui/dbsettings/DatabaseSettingsDialog.cpp b/src/gui/dbsettings/DatabaseSettingsDialog.cpp index e0e6765a4..d2eece319 100644 --- a/src/gui/dbsettings/DatabaseSettingsDialog.cpp +++ b/src/gui/dbsettings/DatabaseSettingsDialog.cpp @@ -34,8 +34,8 @@ #include "core/Config.h" #include "core/Database.h" -#include "core/FilePath.h" #include "core/Global.h" +#include "core/Resources.h" #include "touchid/TouchID.h" class DatabaseSettingsDialog::ExtraPage @@ -76,8 +76,8 @@ DatabaseSettingsDialog::DatabaseSettingsDialog(QWidget* parent) connect(m_ui->buttonBox, SIGNAL(accepted()), SLOT(save())); connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(reject())); - m_ui->categoryList->addCategory(tr("General"), FilePath::instance()->icon("categories", "preferences-other")); - m_ui->categoryList->addCategory(tr("Security"), FilePath::instance()->icon("status", "security-high")); + m_ui->categoryList->addCategory(tr("General"), Resources::instance()->icon("preferences-other")); + m_ui->categoryList->addCategory(tr("Security"), Resources::instance()->icon("security-high")); m_ui->stackedWidget->addWidget(m_generalWidget); m_ui->stackedWidget->addWidget(m_securityTabWidget); @@ -100,8 +100,7 @@ DatabaseSettingsDialog::DatabaseSettingsDialog(QWidget* parent) connect(m_ui->advancedSettingsToggle, SIGNAL(toggled(bool)), SLOT(toggleAdvancedMode(bool))); #ifdef WITH_XC_BROWSER - m_ui->categoryList->addCategory(tr("Browser Integration"), - FilePath::instance()->icon("apps", "internet-web-browser")); + m_ui->categoryList->addCategory(tr("Browser Integration"), Resources::instance()->icon("internet-web-browser")); m_ui->stackedWidget->addWidget(m_browserWidget); #endif diff --git a/src/gui/entry/EditEntryWidget.cpp b/src/gui/entry/EditEntryWidget.cpp index 201c9628a..d52657430 100644 --- a/src/gui/entry/EditEntryWidget.cpp +++ b/src/gui/entry/EditEntryWidget.cpp @@ -41,8 +41,8 @@ #include "core/Config.h" #include "core/Database.h" #include "core/Entry.h" -#include "core/FilePath.h" #include "core/Metadata.h" +#include "core/Resources.h" #include "core/TimeDelta.h" #include "core/Tools.h" #ifdef WITH_XC_SSHAGENT @@ -138,7 +138,7 @@ EditEntryWidget::~EditEntryWidget() void EditEntryWidget::setupMain() { m_mainUi->setupUi(m_mainWidget); - addPage(tr("Entry"), FilePath::instance()->icon("actions", "document-edit"), m_mainWidget); + addPage(tr("Entry"), Resources::instance()->icon("document-edit"), m_mainWidget); m_mainUi->usernameComboBox->setEditable(true); m_usernameCompleter->setCompletionMode(QCompleter::InlineCompletion); @@ -147,7 +147,7 @@ void EditEntryWidget::setupMain() m_mainUi->usernameComboBox->setCompleter(m_usernameCompleter); #ifdef WITH_XC_NETWORKING - m_mainUi->fetchFaviconButton->setIcon(filePath()->icon("actions", "favicon-download")); + m_mainUi->fetchFaviconButton->setIcon(resources()->icon("favicon-download")); m_mainUi->fetchFaviconButton->setDisabled(true); #else m_mainUi->fetchFaviconButton->setVisible(false); @@ -168,7 +168,7 @@ void EditEntryWidget::setupMain() void EditEntryWidget::setupAdvanced() { m_advancedUi->setupUi(m_advancedWidget); - addPage(tr("Advanced"), FilePath::instance()->icon("categories", "preferences-other"), m_advancedWidget); + addPage(tr("Advanced"), Resources::instance()->icon("preferences-other"), m_advancedWidget); m_advancedUi->attachmentsWidget->setReadOnly(false); m_advancedUi->attachmentsWidget->setButtonsVisible(true); @@ -198,7 +198,7 @@ void EditEntryWidget::setupAdvanced() void EditEntryWidget::setupIcon() { m_iconsWidget->setShowApplyIconToButton(false); - addPage(tr("Icon"), FilePath::instance()->icon("apps", "preferences-desktop-icons"), m_iconsWidget); + addPage(tr("Icon"), Resources::instance()->icon("preferences-desktop-icons"), m_iconsWidget); connect(this, SIGNAL(accepted()), m_iconsWidget, SLOT(abortRequests())); connect(this, SIGNAL(rejected()), m_iconsWidget, SLOT(abortRequests())); } @@ -211,9 +211,9 @@ void EditEntryWidget::openAutotypeHelp() void EditEntryWidget::setupAutoType() { m_autoTypeUi->setupUi(m_autoTypeWidget); - addPage(tr("Auto-Type"), FilePath::instance()->icon("actions", "key-enter"), m_autoTypeWidget); + addPage(tr("Auto-Type"), Resources::instance()->icon("key-enter"), m_autoTypeWidget); - m_autoTypeUi->openHelpButton->setIcon(filePath()->icon("actions", "system-help")); + m_autoTypeUi->openHelpButton->setIcon(resources()->icon("system-help")); m_autoTypeDefaultSequenceGroup->addButton(m_autoTypeUi->inheritSequenceButton); m_autoTypeDefaultSequenceGroup->addButton(m_autoTypeUi->customSequenceButton); @@ -252,7 +252,7 @@ void EditEntryWidget::setupBrowser() m_browserUi->setupUi(m_browserWidget); if (config()->get("Browser/Enabled", false).toBool()) { - addPage(tr("Browser Integration"), FilePath::instance()->icon("apps", "internet-web-browser"), m_browserWidget); + addPage(tr("Browser Integration"), Resources::instance()->icon("internet-web-browser"), m_browserWidget); m_additionalURLsDataModel->setEntryAttributes(m_entryAttributes); m_browserUi->additionalURLsView->setModel(m_additionalURLsDataModel); @@ -370,13 +370,13 @@ void EditEntryWidget::updateCurrentURL() void EditEntryWidget::setupProperties() { - addPage(tr("Properties"), FilePath::instance()->icon("actions", "document-properties"), m_editWidgetProperties); + addPage(tr("Properties"), Resources::instance()->icon("document-properties"), m_editWidgetProperties); } void EditEntryWidget::setupHistory() { m_historyUi->setupUi(m_historyWidget); - addPage(tr("History"), FilePath::instance()->icon("actions", "view-history"), m_historyWidget); + addPage(tr("History"), Resources::instance()->icon("view-history"), m_historyWidget); m_sortModel->setSourceModel(m_historyModel); m_sortModel->setDynamicSortFilter(true); @@ -521,7 +521,7 @@ void EditEntryWidget::setupSSHAgent() SIGNAL(entryAttachmentsModified()), SLOT(updateSSHAgentAttachments())); - addPage(tr("SSH Agent"), FilePath::instance()->icon("apps", "utilities-terminal"), m_sshAgentWidget); + addPage(tr("SSH Agent"), Resources::instance()->icon("utilities-terminal"), m_sshAgentWidget); } void EditEntryWidget::updateSSHAgent() diff --git a/src/gui/entry/EntryModel.cpp b/src/gui/entry/EntryModel.cpp index 9bbf7d56d..405de9495 100644 --- a/src/gui/entry/EntryModel.cpp +++ b/src/gui/entry/EntryModel.cpp @@ -26,10 +26,10 @@ #include "core/Config.h" #include "core/DatabaseIcons.h" #include "core/Entry.h" -#include "core/FilePath.h" #include "core/Global.h" #include "core/Group.h" #include "core/Metadata.h" +#include "core/Resources.h" #ifdef Q_OS_MACOS #include "gui/osutils/macutils/MacUtils.h" #endif @@ -259,12 +259,12 @@ QVariant EntryModel::data(const QModelIndex& index, int role) const return entry->iconScaledPixmap(); case Paperclip: if (!entry->attachments()->isEmpty()) { - return filePath()->icon("actions", "paperclip"); + return resources()->icon("paperclip"); } break; case Totp: if (entry->hasTotp()) { - return filePath()->icon("actions", "chronometer"); + return resources()->icon("chronometer"); } break; } @@ -336,9 +336,9 @@ QVariant EntryModel::headerData(int section, Qt::Orientation orientation, int ro } else if (role == Qt::DecorationRole) { switch (section) { case Paperclip: - return filePath()->icon("actions", "paperclip"); + return resources()->icon("paperclip"); case Totp: - return filePath()->icon("actions", "chronometer"); + return resources()->icon("chronometer"); } } else if (role == Qt::ToolTipRole) { switch (section) { diff --git a/src/gui/entry/EntryURLModel.cpp b/src/gui/entry/EntryURLModel.cpp index 3e6fb839c..7bf673a99 100644 --- a/src/gui/entry/EntryURLModel.cpp +++ b/src/gui/entry/EntryURLModel.cpp @@ -19,7 +19,7 @@ #include "EntryURLModel.h" #include "core/Entry.h" -#include "core/FilePath.h" +#include "core/Resources.h" #include "core/Tools.h" #include <algorithm> @@ -27,7 +27,7 @@ EntryURLModel::EntryURLModel(QObject* parent) : QStandardItemModel(parent) , m_entryAttributes(nullptr) - , m_errorIcon(filePath()->icon("status", "dialog-error")) + , m_errorIcon(resources()->icon("dialog-error")) { } diff --git a/src/gui/group/EditGroupWidget.cpp b/src/gui/group/EditGroupWidget.cpp index 30d8fb913..8d8115649 100644 --- a/src/gui/group/EditGroupWidget.cpp +++ b/src/gui/group/EditGroupWidget.cpp @@ -20,8 +20,8 @@ #include "ui_EditGroupWidgetMain.h" #include "core/Config.h" -#include "core/FilePath.h" #include "core/Metadata.h" +#include "core/Resources.h" #include "gui/EditWidgetIcons.h" #include "gui/EditWidgetProperties.h" #include "gui/MessageBox.h" @@ -69,12 +69,12 @@ EditGroupWidget::EditGroupWidget(QWidget* parent) { m_mainUi->setupUi(m_editGroupWidgetMain); - addPage(tr("Group"), FilePath::instance()->icon("actions", "document-edit"), m_editGroupWidgetMain); - addPage(tr("Icon"), FilePath::instance()->icon("apps", "preferences-desktop-icons"), m_editGroupWidgetIcons); + addPage(tr("Group"), Resources::instance()->icon("document-edit"), m_editGroupWidgetMain); + addPage(tr("Icon"), Resources::instance()->icon("preferences-desktop-icons"), m_editGroupWidgetIcons); #if defined(WITH_XC_KEESHARE) addEditPage(new EditGroupPageKeeShare(this)); #endif - addPage(tr("Properties"), FilePath::instance()->icon("actions", "document-properties"), m_editWidgetProperties); + addPage(tr("Properties"), Resources::instance()->icon("document-properties"), m_editWidgetProperties); connect(m_mainUi->expireCheck, SIGNAL(toggled(bool)), m_mainUi->expireDatePicker, SLOT(setEnabled(bool))); connect(m_mainUi->autoTypeSequenceCustomRadio, diff --git a/src/gui/masterkey/PasswordEditWidget.cpp b/src/gui/masterkey/PasswordEditWidget.cpp index 60689e920..2d355cc10 100644 --- a/src/gui/masterkey/PasswordEditWidget.cpp +++ b/src/gui/masterkey/PasswordEditWidget.cpp @@ -18,7 +18,7 @@ #include "PasswordEditWidget.h" #include "ui_PasswordEditWidget.h" -#include "core/FilePath.h" +#include "core/Resources.h" #include "gui/PasswordGeneratorWidget.h" #include "keys/CompositeKey.h" #include "keys/PasswordKey.h" diff --git a/src/gui/reports/ReportsPageHealthcheck.cpp b/src/gui/reports/ReportsPageHealthcheck.cpp index 41fa40625..1dfe793a6 100644 --- a/src/gui/reports/ReportsPageHealthcheck.cpp +++ b/src/gui/reports/ReportsPageHealthcheck.cpp @@ -18,7 +18,7 @@ #include "ReportsPageHealthcheck.h" #include "ReportsWidgetHealthcheck.h" -#include "core/FilePath.h" +#include "core/Resources.h" #include <QApplication> @@ -34,7 +34,7 @@ QString ReportsPageHealthcheck::name() QIcon ReportsPageHealthcheck::icon() { - return FilePath::instance()->icon("actions", "health"); + return Resources::instance()->icon("health"); } QWidget* ReportsPageHealthcheck::createWidget() diff --git a/src/gui/reports/ReportsPageStatistics.cpp b/src/gui/reports/ReportsPageStatistics.cpp index e4570e172..90cd338df 100644 --- a/src/gui/reports/ReportsPageStatistics.cpp +++ b/src/gui/reports/ReportsPageStatistics.cpp @@ -18,7 +18,7 @@ #include "ReportsPageStatistics.h" #include "ReportsWidgetStatistics.h" -#include "core/FilePath.h" +#include "core/Resources.h" #include <QApplication> @@ -29,7 +29,7 @@ QString ReportsPageStatistics::name() QIcon ReportsPageStatistics::icon() { - return FilePath::instance()->icon("actions", "statistics"); + return Resources::instance()->icon("statistics"); } QWidget* ReportsPageStatistics::createWidget() diff --git a/src/gui/reports/ReportsWidgetHealthcheck.cpp b/src/gui/reports/ReportsWidgetHealthcheck.cpp index c668b3495..49370d5f8 100644 --- a/src/gui/reports/ReportsWidgetHealthcheck.cpp +++ b/src/gui/reports/ReportsWidgetHealthcheck.cpp @@ -20,9 +20,9 @@ #include "core/AsyncTask.h" #include "core/Database.h" -#include "core/FilePath.h" #include "core/Group.h" #include "core/PasswordHealth.h" +#include "core/Resources.h" #include <QSharedPointer> #include <QStandardItemModel> @@ -102,7 +102,7 @@ Health::Health(QSharedPointer<Database> db) ReportsWidgetHealthcheck::ReportsWidgetHealthcheck(QWidget* parent) : QWidget(parent) , m_ui(new Ui::ReportsWidgetHealthcheck()) - , m_errorIcon(FilePath::instance()->icon("status", "dialog-error")) + , m_errorIcon(Resources::instance()->icon("dialog-error")) { m_ui->setupUi(this); diff --git a/src/gui/reports/ReportsWidgetStatistics.cpp b/src/gui/reports/ReportsWidgetStatistics.cpp index bc642af78..f5a99b363 100644 --- a/src/gui/reports/ReportsWidgetStatistics.cpp +++ b/src/gui/reports/ReportsWidgetStatistics.cpp @@ -20,10 +20,10 @@ #include "core/AsyncTask.h" #include "core/Database.h" -#include "core/FilePath.h" #include "core/Group.h" #include "core/Metadata.h" #include "core/PasswordHealth.h" +#include "core/Resources.h" #include <QFileInfo> #include <QHash> @@ -150,7 +150,7 @@ namespace ReportsWidgetStatistics::ReportsWidgetStatistics(QWidget* parent) : QWidget(parent) , m_ui(new Ui::ReportsWidgetStatistics()) - , m_errIcon(FilePath::instance()->icon("status", "dialog-error")) + , m_errIcon(Resources::instance()->icon("dialog-error")) { m_ui->setupUi(this); diff --git a/src/gui/styles/base/BaseStyle.cpp b/src/gui/styles/base/BaseStyle.cpp index b3e22efc9..a816e90c9 100644 --- a/src/gui/styles/base/BaseStyle.cpp +++ b/src/gui/styles/base/BaseStyle.cpp @@ -4160,8 +4160,8 @@ void BaseStyle::polish(QApplication* app) } Q_INIT_RESOURCE(styles); - QString stylesheet; + QString stylesheet; QFile baseStylesheetFile(":/styles/base/basestyle.qss"); if (baseStylesheetFile.open(QIODevice::ReadOnly | QIODevice::Text)) { stylesheet = baseStylesheetFile.readAll(); diff --git a/src/gui/wizard/NewDatabaseWizard.cpp b/src/gui/wizard/NewDatabaseWizard.cpp index 34c594046..0e9d6ba1e 100644 --- a/src/gui/wizard/NewDatabaseWizard.cpp +++ b/src/gui/wizard/NewDatabaseWizard.cpp @@ -21,9 +21,9 @@ #include "NewDatabaseWizardPageMetaData.h" #include "core/Database.h" -#include "core/FilePath.h" #include "core/Global.h" #include "core/Group.h" +#include "core/Resources.h" #include "format/KeePass2.h" #include <QVBoxLayout> @@ -48,7 +48,8 @@ NewDatabaseWizard::NewDatabaseWizard(QWidget* parent) setWindowTitle(tr("Create a new KeePassXC database...")); - setPixmap(QWizard::BackgroundPixmap, QPixmap(filePath()->dataPath("wizard/background-pixmap.png"))); + Q_INIT_RESOURCE(wizard); + setPixmap(QWizard::BackgroundPixmap, QPixmap(":/wizard/background-pixmap.png")); } NewDatabaseWizard::~NewDatabaseWizard() |