Move icon handling from Resources to gui/Icons (#5506)

This commit is contained in:
louib 2020-10-05 20:41:00 -04:00 committed by GitHub
parent ba8611cf4c
commit af4ecb4aa1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
39 changed files with 411 additions and 325 deletions

View file

@ -1,6 +1,6 @@
/*
* Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
* Copyright (C) 2020 KeePassXC Team <team@keepassxc.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -43,7 +43,6 @@
#include "core/Entry.h"
#include "core/Metadata.h"
#include "core/PasswordHealth.h"
#include "core/Resources.h"
#include "core/TimeDelta.h"
#include "core/Tools.h"
#ifdef WITH_XC_SSHAGENT
@ -60,6 +59,7 @@
#include "gui/EditWidgetProperties.h"
#include "gui/FileDialog.h"
#include "gui/Font.h"
#include "gui/Icons.h"
#include "gui/MessageBox.h"
#include "gui/entry/AutoTypeAssociationsModel.h"
#include "gui/entry/EntryAttachmentsModel.h"
@ -147,7 +147,7 @@ EditEntryWidget::~EditEntryWidget()
void EditEntryWidget::setupMain()
{
m_mainUi->setupUi(m_mainWidget);
addPage(tr("Entry"), Resources::instance()->icon("document-edit"), m_mainWidget);
addPage(tr("Entry"), icons()->icon("document-edit"), m_mainWidget);
m_mainUi->usernameComboBox->setEditable(true);
m_usernameCompleter->setCompletionMode(QCompleter::InlineCompletion);
@ -156,7 +156,7 @@ void EditEntryWidget::setupMain()
m_mainUi->usernameComboBox->setCompleter(m_usernameCompleter);
#ifdef WITH_XC_NETWORKING
m_mainUi->fetchFaviconButton->setIcon(resources()->icon("favicon-download"));
m_mainUi->fetchFaviconButton->setIcon(icons()->icon("favicon-download"));
m_mainUi->fetchFaviconButton->setDisabled(true);
#else
m_mainUi->fetchFaviconButton->setVisible(false);
@ -186,7 +186,7 @@ void EditEntryWidget::setupMain()
void EditEntryWidget::setupAdvanced()
{
m_advancedUi->setupUi(m_advancedWidget);
addPage(tr("Advanced"), Resources::instance()->icon("preferences-other"), m_advancedWidget);
addPage(tr("Advanced"), icons()->icon("preferences-other"), m_advancedWidget);
m_advancedUi->attachmentsWidget->setReadOnly(false);
m_advancedUi->attachmentsWidget->setButtonsVisible(true);
@ -216,7 +216,7 @@ void EditEntryWidget::setupAdvanced()
void EditEntryWidget::setupIcon()
{
m_iconsWidget->setShowApplyIconToButton(false);
addPage(tr("Icon"), Resources::instance()->icon("preferences-desktop-icons"), m_iconsWidget);
addPage(tr("Icon"), icons()->icon("preferences-desktop-icons"), m_iconsWidget);
connect(this, SIGNAL(accepted()), m_iconsWidget, SLOT(abortRequests()));
connect(this, SIGNAL(rejected()), m_iconsWidget, SLOT(abortRequests()));
}
@ -230,9 +230,9 @@ void EditEntryWidget::openAutotypeHelp()
void EditEntryWidget::setupAutoType()
{
m_autoTypeUi->setupUi(m_autoTypeWidget);
addPage(tr("Auto-Type"), Resources::instance()->icon("key-enter"), m_autoTypeWidget);
addPage(tr("Auto-Type"), icons()->icon("key-enter"), m_autoTypeWidget);
m_autoTypeUi->openHelpButton->setIcon(resources()->icon("system-help"));
m_autoTypeUi->openHelpButton->setIcon(icons()->icon("system-help"));
m_autoTypeDefaultSequenceGroup->addButton(m_autoTypeUi->inheritSequenceButton);
m_autoTypeDefaultSequenceGroup->addButton(m_autoTypeUi->customSequenceButton);
@ -271,7 +271,7 @@ void EditEntryWidget::setupBrowser()
m_browserUi->setupUi(m_browserWidget);
if (config()->get(Config::Browser_Enabled).toBool()) {
addPage(tr("Browser Integration"), Resources::instance()->icon("internet-web-browser"), m_browserWidget);
addPage(tr("Browser Integration"), icons()->icon("internet-web-browser"), m_browserWidget);
m_additionalURLsDataModel->setEntryAttributes(m_entryAttributes);
m_browserUi->additionalURLsView->setModel(m_additionalURLsDataModel);
@ -394,13 +394,13 @@ void EditEntryWidget::updateCurrentURL()
void EditEntryWidget::setupProperties()
{
addPage(tr("Properties"), Resources::instance()->icon("document-properties"), m_editWidgetProperties);
addPage(tr("Properties"), icons()->icon("document-properties"), m_editWidgetProperties);
}
void EditEntryWidget::setupHistory()
{
m_historyUi->setupUi(m_historyWidget);
addPage(tr("History"), Resources::instance()->icon("view-history"), m_historyWidget);
addPage(tr("History"), icons()->icon("view-history"), m_historyWidget);
m_sortModel->setSourceModel(m_historyModel);
m_sortModel->setDynamicSortFilter(true);
@ -546,7 +546,7 @@ void EditEntryWidget::setupSSHAgent()
SIGNAL(entryAttachmentsModified()),
SLOT(updateSSHAgentAttachments()));
addPage(tr("SSH Agent"), Resources::instance()->icon("utilities-terminal"), m_sshAgentWidget);
addPage(tr("SSH Agent"), icons()->icon("utilities-terminal"), m_sshAgentWidget);
}
void EditEntryWidget::setSSHAgentSettings()