Cleanups...

This commit is contained in:
Martin Rotter 2014-03-28 09:04:36 +01:00
parent 2629136a77
commit 94cf8c00aa
29 changed files with 267 additions and 350 deletions

View File

@ -306,7 +306,6 @@ set(APP_SOURCES
src/miscellaneous/localization.cpp
src/miscellaneous/textfactory.cpp
src/miscellaneous/databasefactory.cpp
src/miscellaneous/iconthemefactory.cpp
src/miscellaneous/skinfactory.cpp
src/miscellaneous/iconfactory.cpp
@ -377,7 +376,7 @@ set(APP_HEADERS
src/miscellaneous/localization.h
src/miscellaneous/systemfactory.h
src/miscellaneous/databasefactory.h
src/miscellaneous/iconthemefactory.h
src/miscellaneous/iconfactory.h
src/miscellaneous/skinfactory.h
# CORE headers.

View File

@ -31,7 +31,7 @@ FeedDownloader::~FeedDownloader() {
qDebug("Destroying FeedDownloader instance.");
}
void FeedDownloader::updateFeeds(const QList<FeedsModelFeed *> &feeds) {
void FeedDownloader::updateFeeds(const QList<FeedsModelFeed*> &feeds) {
qDebug().nospace() << "Performing feed updates in thread: \'" <<
QThread::currentThreadId() << "\'.";

View File

@ -23,7 +23,6 @@
class FeedsModelFeed;
class SilentNetworkAccessManager;
// This class offers means to "update" feeds
// and "special" categories.

View File

@ -22,7 +22,6 @@
#include "core/feedsmodelfeed.h"
#include "miscellaneous/textfactory.h"
#include "miscellaneous/databasefactory.h"
#include "miscellaneous/iconthemefactory.h"
#include "miscellaneous/iconfactory.h"
#include <QSqlError>
@ -36,13 +35,16 @@
FeedsModel::FeedsModel(QObject *parent) : QAbstractItemModel(parent) {
setObjectName("FeedsModel");
// Create root item.
m_rootItem = new FeedsModelRootItem();
m_rootItem->setId(NO_PARENT_CATEGORY);
//: Name of root item of feed list which can be seen in feed add/edit dialog.
m_rootItem->setTitle(tr("Root"));
m_rootItem->setIcon(IconThemeFactory::instance()->fromTheme("folder-root"));
m_countsIcon = IconThemeFactory::instance()->fromTheme("mail-mark-unread");
m_rootItem->setIcon(IconFactory::instance()->fromTheme("folder-root"));
// Setup icons.
m_countsIcon = IconFactory::instance()->fromTheme("mail-mark-unread");
//: Title text in the feed list header.
m_headerData << tr("Title");
@ -101,15 +103,7 @@ QModelIndex FeedsModel::index(int row, int column, const QModelIndex &parent) co
return QModelIndex();
}
FeedsModelRootItem *parent_item;
if (!parent.isValid()) {
parent_item = m_rootItem;
}
else {
parent_item = static_cast<FeedsModelRootItem*>(parent.internalPointer());
}
FeedsModelRootItem *parent_item = itemForIndex(parent);
FeedsModelRootItem *child_item = parent_item->child(row);
if (child_item) {
@ -125,7 +119,7 @@ QModelIndex FeedsModel::parent(const QModelIndex &child) const {
return QModelIndex();
}
FeedsModelRootItem *child_item = static_cast<FeedsModelRootItem*>(child.internalPointer());
FeedsModelRootItem *child_item = itemForIndex(child);
FeedsModelRootItem *parent_item = child_item->parent();
if (parent_item == m_rootItem) {
@ -137,20 +131,12 @@ QModelIndex FeedsModel::parent(const QModelIndex &child) const {
}
int FeedsModel::rowCount(const QModelIndex &parent) const {
FeedsModelRootItem *parent_item;
if (parent.column() > 0) {
return 0;
}
if (!parent.isValid()) {
parent_item = m_rootItem;
}
else {
parent_item = static_cast<FeedsModelRootItem*>(parent.internalPointer());
return itemForIndex(parent)->childCount();
}
return parent_item->childCount();
}
bool FeedsModel::removeItem(const QModelIndex &index) {
@ -178,7 +164,7 @@ bool FeedsModel::removeItem(const QModelIndex &index) {
}
bool FeedsModel::addCategory(FeedsModelCategory *category,
FeedsModelRootItem *parent) {
FeedsModelRootItem *parent) {
// Get index of parent item (parent standard category).
QModelIndex parent_index = indexForItem(parent);
@ -196,7 +182,7 @@ bool FeedsModel::addCategory(FeedsModelCategory *category,
query_add.bindValue(":title", category->title());
query_add.bindValue(":description", category->description());
query_add.bindValue(":date_created", category->creationDate().toMSecsSinceEpoch());
query_add.bindValue(":icon", IconFactory::toByteArray(category->icon()));
query_add.bindValue(":icon", IconFactory::instance()->toByteArray(category->icon()));
query_add.bindValue(":type", (int) FeedsModelCategory::Standard);
if (!query_add.exec()) {
@ -226,7 +212,7 @@ bool FeedsModel::addCategory(FeedsModelCategory *category,
}
bool FeedsModel::editCategory(FeedsModelCategory *original_category,
FeedsModelCategory *new_category) {
FeedsModelCategory *new_category) {
QSqlDatabase database = DatabaseFactory::instance()->connection(objectName(),
DatabaseFactory::FromSettings);
QSqlQuery query_update_category(database);
@ -239,7 +225,7 @@ bool FeedsModel::editCategory(FeedsModelCategory *original_category,
"WHERE id = :id;");
query_update_category.bindValue(":title", new_category->title());
query_update_category.bindValue(":description", new_category->description());
query_update_category.bindValue(":icon", IconFactory::toByteArray(new_category->icon()));
query_update_category.bindValue(":icon", IconFactory::instance()->toByteArray(new_category->icon()));
query_update_category.bindValue(":parent_id", new_parent->id());
query_update_category.bindValue(":id", original_category->id());
@ -282,7 +268,7 @@ bool FeedsModel::editCategory(FeedsModelCategory *original_category,
}
bool FeedsModel::addFeed(FeedsModelFeed *feed,
FeedsModelRootItem *parent) {
FeedsModelRootItem *parent) {
// Get index of parent item (parent standard category).
QModelIndex parent_index = indexForItem(parent);
@ -299,7 +285,7 @@ bool FeedsModel::addFeed(FeedsModelFeed *feed,
query_add_feed.bindValue(":title", feed->title());
query_add_feed.bindValue(":description", feed->description());
query_add_feed.bindValue(":date_created", feed->creationDate().toMSecsSinceEpoch());
query_add_feed.bindValue(":icon", IconFactory::toByteArray(feed->icon()));
query_add_feed.bindValue(":icon", IconFactory::instance()->toByteArray(feed->icon()));
query_add_feed.bindValue(":category", parent->id());
query_add_feed.bindValue(":encoding", feed->encoding());
query_add_feed.bindValue(":url", feed->url());
@ -337,7 +323,7 @@ bool FeedsModel::addFeed(FeedsModelFeed *feed,
}
bool FeedsModel::editFeed(FeedsModelFeed *original_feed,
FeedsModelFeed *new_feed) {
FeedsModelFeed *new_feed) {
QSqlDatabase database = DatabaseFactory::instance()->connection(objectName(),
DatabaseFactory::FromSettings);
QSqlQuery query_update_feed(database);
@ -350,7 +336,7 @@ bool FeedsModel::editFeed(FeedsModelFeed *original_feed,
"WHERE id = :id;");
query_update_feed.bindValue(":title", new_feed->title());
query_update_feed.bindValue(":description", new_feed->description());
query_update_feed.bindValue(":icon", IconFactory::toByteArray(new_feed->icon()));
query_update_feed.bindValue(":icon", IconFactory::instance()->toByteArray(new_feed->icon()));
query_update_feed.bindValue(":category", new_parent->id());
query_update_feed.bindValue(":encoding", new_feed->encoding());
query_update_feed.bindValue(":url", new_feed->url());
@ -481,12 +467,7 @@ QList<Message> FeedsModel::messagesForFeeds(const QList<FeedsModelFeed*> &feeds)
}
int FeedsModel::columnCount(const QModelIndex &parent) const {
if (parent.isValid()) {
return static_cast<FeedsModelRootItem*>(parent.internalPointer())->columnCount();
}
else {
return m_rootItem->columnCount();
}
return itemForIndex(parent)->columnCount();
}
FeedsModelRootItem *FeedsModel::itemForIndex(const QModelIndex &index) const {

View File

@ -31,6 +31,7 @@ class FeedsModelFeed;
typedef QList<QPair<int, FeedsModelCategory*> > CategoryAssignment;
typedef QPair<int, FeedsModelCategory*> CategoryAssignmentItem;
typedef QList<QPair<int, FeedsModelFeed*> > FeedAssignment;
typedef QPair<int, FeedsModelFeed*> FeedAssignmentItem;
@ -44,10 +45,13 @@ class FeedsModel : public QAbstractItemModel {
// Returns list of all indexes available
// in the model.
// NOTE: Overriden because original method
// is protected.
QModelIndexList persistentIndexList() const;
// Model implementation.
inline QVariant data(const QModelIndex &index, int role) const {
// Return data according to item.
return itemForIndex(index)->data(index.column(), role);
}
@ -66,7 +70,7 @@ class FeedsModel : public QAbstractItemModel {
return m_rootItem->countOfUnreadMessages();
}
// Base manipulators.
// Removes item with given index.
bool removeItem(const QModelIndex &index);
// Standard category manipulators.
@ -87,9 +91,14 @@ class FeedsModel : public QAbstractItemModel {
// Returns the list of updates which should be updated
// according to auto-update schedule.
// Variable "auto_update_now" is true, when global timeout
// for scheduled auto-update was met so feeds with "default"
// auto-update strategy should be updated.
QList<FeedsModelFeed*> feedsForScheduledUpdate(bool auto_update_now);
// Returns (undeleted) messages for given feeds.
// This is usually used for displaying whole feeds
// in "newspaper" mode.
QList<Message> messagesForFeeds(const QList<FeedsModelFeed*> &feeds);
// Returns all categories, each pair
@ -107,9 +116,7 @@ class FeedsModel : public QAbstractItemModel {
// as root. If root itself is a feed, then it is returned.
QList<FeedsModelFeed*> feedsForItem(FeedsModelRootItem *root);
// Returns list of feeds which belong to given indexes.
// NOTE: If index is "category", then all child feeds are contained in the
// result.
// Returns list of ALL CHILD feeds which belong to given parent indexes.
QList<FeedsModelFeed*> feedsForIndexes(const QModelIndexList &indexes);
// Returns ALL CHILD feeds contained within single index.
@ -127,7 +134,7 @@ class FeedsModel : public QAbstractItemModel {
// root item if index is invalid.
FeedsModelRootItem *itemForIndex(const QModelIndex &index) const;
// Returns QModelIndex on which lies given item.
// Returns source QModelIndex on which lies given item.
QModelIndex indexForItem(FeedsModelRootItem *item) const;
// Access to root item.
@ -138,9 +145,7 @@ class FeedsModel : public QAbstractItemModel {
public slots:
// Feeds operations.
bool markFeedsRead(const QList<FeedsModelFeed*> &feeds, int read);
bool markFeedsDeleted(const QList<FeedsModelFeed*> &feeds,
int deleted,
bool read_only);
bool markFeedsDeleted(const QList<FeedsModelFeed*> &feeds, int deleted, bool read_only);
// Signals that properties (probably counts)
// of ALL items have changed.

View File

@ -21,7 +21,6 @@
#include "miscellaneous/databasefactory.h"
#include "miscellaneous/textfactory.h"
#include "miscellaneous/settings.h"
#include "miscellaneous/iconthemefactory.h"
#include "miscellaneous/iconfactory.h"
#include <QVariant>
@ -154,7 +153,7 @@ FeedsModelCategory *FeedsModelCategory::loadFromRecord(const QSqlRecord &record)
category->setTitle(record.value(CAT_DB_TITLE_INDEX).toString());
category->setDescription(record.value(CAT_DB_DESCRIPTION_INDEX).toString());
category->setCreationDate(TextFactory::parseDateTime(record.value(CAT_DB_DCREATED_INDEX).value<qint64>()).toLocalTime());
category->setIcon(IconFactory::fromByteArray(record.value(CAT_DB_ICON_INDEX).toByteArray()));
category->setIcon(IconFactory::instance()->fromByteArray(record.value(CAT_DB_ICON_INDEX).toByteArray()));
return category;
}

View File

@ -23,7 +23,6 @@
#include "miscellaneous/textfactory.h"
#include "miscellaneous/settings.h"
#include "miscellaneous/iconfactory.h"
#include "miscellaneous/iconthemefactory.h"
#include "network-web/networkfactory.h"
#include <QSqlDatabase>
@ -110,7 +109,7 @@ FeedsModelFeed *FeedsModelFeed::loadFromRecord(const QSqlRecord &record) {
feed->setId(record.value(FDS_DB_ID_INDEX).toInt());
feed->setDescription(record.value(FDS_DB_DESCRIPTION_INDEX).toString());
feed->setCreationDate(TextFactory::parseDateTime(record.value(FDS_DB_DCREATED_INDEX).value<qint64>()).toLocalTime());
feed->setIcon(IconFactory::fromByteArray(record.value(FDS_DB_ICON_INDEX).toByteArray()));
feed->setIcon(IconFactory::instance()->fromByteArray(record.value(FDS_DB_ICON_INDEX).toByteArray()));
feed->setEncoding(record.value(FDS_DB_ENCODING_INDEX).toString());
feed->setUrl(record.value(FDS_DB_URL_INDEX).toString());
feed->setPasswordProtected(record.value(FDS_DB_PROTECTED_INDEX).toBool());

View File

@ -20,7 +20,7 @@
#include "definitions/definitions.h"
#include "miscellaneous/textfactory.h"
#include "miscellaneous/databasefactory.h"
#include "miscellaneous/iconthemefactory.h"
#include "miscellaneous/iconfactory.h"
#include "qtsingleapplication/qtsingleapplication.h"
#include <QSqlRecord>
@ -50,9 +50,9 @@ MessagesModel::~MessagesModel() {
}
void MessagesModel::setupIcons() {
m_favoriteIcon = IconThemeFactory::instance()->fromTheme("mail-mark-favorite");
m_readIcon = IconThemeFactory::instance()->fromTheme("mail-mark-read");
m_unreadIcon = IconThemeFactory::instance()->fromTheme("mail-mark-unread");
m_favoriteIcon = IconFactory::instance()->fromTheme("mail-mark-favorite");
m_readIcon = IconFactory::instance()->fromTheme("mail-mark-read");
m_unreadIcon = IconFactory::instance()->fromTheme("mail-mark-unread");
}
void MessagesModel::fetchAll() {

View File

@ -30,7 +30,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "dynamic-shortcuts/shortcutbutton.h"
#include "gui/plaintoolbutton.h"
#include "miscellaneous/iconthemefactory.h"
#include "miscellaneous/iconfactory.h"
#include <QHBoxLayout>
@ -44,13 +44,13 @@ ShortcutCatcher::ShortcutCatcher(QWidget *parent)
// Create reset button.
m_btnReset = new PlainToolButton(this);
m_btnReset->setIcon(IconThemeFactory::instance()->fromTheme("edit-revert"));
m_btnReset->setIcon(IconFactory::instance()->fromTheme("edit-revert"));
m_btnReset->setFocusPolicy(Qt::NoFocus);
m_btnReset->setToolTip(tr("Reset to original shortcut."));
// Create clear button.
m_btnClear = new PlainToolButton(this);
m_btnClear->setIcon(IconThemeFactory::instance()->fromTheme("item-remove"));
m_btnClear->setIcon(IconFactory::instance()->fromTheme("item-remove"));
m_btnClear->setFocusPolicy(Qt::NoFocus);
m_btnClear->setToolTip(tr("Clear current shortcut."));

View File

@ -20,7 +20,7 @@
#include "miscellaneous/settings.h"
#include "miscellaneous/databasefactory.h"
#include "miscellaneous/systemfactory.h"
#include "miscellaneous/iconthemefactory.h"
#include "miscellaneous/iconfactory.h"
#include "core/messagesproxymodel.h"
#include "core/feeddownloader.h"
#include "core/feedsmodelfeed.h"
@ -49,6 +49,7 @@
FeedMessageViewer::FeedMessageViewer(QWidget *parent)
: TabContent(parent),
m_toolBarsEnabled(true),
m_toolBarFeeds(new QToolBar(tr("Toolbar for feeds"), this)),
m_toolBarMessages(new QToolBar(tr("Toolbar for messages"), this)),
m_messagesView(new MessagesView(this)),

View File

@ -17,7 +17,7 @@
#include "gui/formabout.h"
#include "miscellaneous/iconthemefactory.h"
#include "miscellaneous/iconfactory.h"
#include "miscellaneous/textfactory.h"
#if !defined(Q_OS_WIN)
@ -33,7 +33,8 @@ FormAbout::FormAbout(QWidget *parent) : QDialog(parent), m_ui(new Ui::FormAbout)
// Set flags and attributes.
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog);
setWindowIcon(IconThemeFactory::instance()->fromTheme("application-about"));
setWindowIcon(IconFactory::instance()->fromTheme("application-about"));
//: About RSS Guard dialog title.
setWindowTitle(tr("About %1").arg(APP_NAME));

View File

@ -21,7 +21,7 @@
#include "miscellaneous/settings.h"
#include "miscellaneous/systemfactory.h"
#include "miscellaneous/databasefactory.h"
#include "miscellaneous/iconthemefactory.h"
#include "miscellaneous/iconfactory.h"
#include "network-web/webfactory.h"
#include "network-web/webbrowser.h"
#include "gui/formabout.h"
@ -256,7 +256,7 @@ void FormMain::onAboutToQuit() {
}
void FormMain::setupIcons() {
IconThemeFactory *icon_theme_factory = IconThemeFactory::instance();
IconFactory *icon_theme_factory = IconFactory::instance();
// Setup icons of this main window.
m_ui->m_actionSettings->setIcon(icon_theme_factory->fromTheme("application-settings"));

View File

@ -24,7 +24,7 @@
#include "miscellaneous/databasefactory.h"
#include "miscellaneous/localization.h"
#include "miscellaneous/systemfactory.h"
#include "miscellaneous/iconthemefactory.h"
#include "miscellaneous/iconfactory.h"
#include "miscellaneous/skinfactory.h"
#include "network-web/webfactory.h"
#include "network-web/webbrowsernetworkaccessmanager.h"
@ -49,7 +49,7 @@ FormSettings::FormSettings(QWidget *parent) : QDialog(parent), m_ui(new Ui::Form
// Set flags and attributes.
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog);
setWindowIcon(IconThemeFactory::instance()->fromTheme("application-settings"));
setWindowIcon(IconFactory::instance()->fromTheme("application-settings"));
#if !defined(Q_OS_WIN)
MessageBox::iconify(m_ui->m_buttonBox);
@ -457,7 +457,7 @@ void FormSettings::loadLanguage() {
item->setText(2, language.m_version);
item->setText(3, language.m_author);
item->setText(4, language.m_email);
item->setIcon(0, IconThemeFactory::instance()->fromTheme(language.m_code));
item->setIcon(0, IconFactory::instance()->fromTheme(language.m_code));
}
QList<QTreeWidgetItem*> matching_items = m_ui->m_treeLanguages->findItems(Localization::instance()->loadedLanguage(),
@ -686,9 +686,9 @@ void FormSettings::loadInterface() {
false).toBool());
// Load settings of icon theme.
QString current_theme = IconThemeFactory::instance()->currentIconTheme();
QString current_theme = IconFactory::instance()->currentIconTheme();
foreach (const QString &icon_theme_name, IconThemeFactory::instance()->installedIconThemes()) {
foreach (const QString &icon_theme_name, IconFactory::instance()->installedIconThemes()) {
if (icon_theme_name == APP_NO_THEME) {
// Add just "no theme" on other systems.
//: Label for disabling icon theme.
@ -801,8 +801,8 @@ void FormSettings::saveInterface() {
// Save selected icon theme.
QString selected_icon_theme = m_ui->m_cmbIconTheme->itemData(m_ui->m_cmbIconTheme->currentIndex()).toString();
QString original_icon_theme = IconThemeFactory::instance()->currentIconTheme();
IconThemeFactory::instance()->setCurrentIconTheme(selected_icon_theme);
QString original_icon_theme = IconFactory::instance()->currentIconTheme();
IconFactory::instance()->setCurrentIconTheme(selected_icon_theme);
// Check if icon theme was changed.
if (selected_icon_theme != original_icon_theme) {

View File

@ -21,7 +21,7 @@
#include "core/feedsmodelrootitem.h"
#include "core/feedsmodelcategory.h"
#include "core/feedsmodel.h"
#include "miscellaneous/iconthemefactory.h"
#include "miscellaneous/iconfactory.h"
#include "gui/feedsview.h"
#include "gui/baselineedit.h"
#include "gui/messagebox.h"
@ -179,7 +179,7 @@ void FormStandardCategoryDetails::onLoadIconFromFile() {
QFileDialog dialog(this, tr("Select icon file for the category"),
QDir::homePath(), tr("Images (*.bmp *.jpg *.jpeg *.png *.svg *.tga)"));
dialog.setFileMode(QFileDialog::ExistingFile);
dialog.setWindowIcon(IconThemeFactory::instance()->fromTheme("image-generic"));
dialog.setWindowIcon(IconFactory::instance()->fromTheme("image-generic"));
dialog.setOptions(QFileDialog::DontUseNativeDialog | QFileDialog::ReadOnly);
dialog.setViewMode(QFileDialog::Detail);
dialog.setLabelText(QFileDialog::Accept, tr("Select icon"));
@ -195,7 +195,7 @@ void FormStandardCategoryDetails::onLoadIconFromFile() {
}
void FormStandardCategoryDetails::onUseDefaultIcon() {
m_ui->m_btnIcon->setIcon(IconThemeFactory::instance()->fromTheme("folder-category"));
m_ui->m_btnIcon->setIcon(IconFactory::instance()->fromTheme("folder-category"));
}
void FormStandardCategoryDetails::initialize() {
@ -211,7 +211,7 @@ void FormStandardCategoryDetails::initialize() {
// Set flags and attributes.
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog);
setWindowIcon(IconThemeFactory::instance()->fromTheme("folder-category"));
setWindowIcon(IconFactory::instance()->fromTheme("folder-category"));
// Setup button box.
m_ui->m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
@ -222,13 +222,13 @@ void FormStandardCategoryDetails::initialize() {
// Setup menu & actions for icon selection.
m_iconMenu = new QMenu(tr("Icon selection"), this);
m_actionLoadIconFromFile = new QAction(IconThemeFactory::instance()->fromTheme("image-generic"),
m_actionLoadIconFromFile = new QAction(IconFactory::instance()->fromTheme("image-generic"),
tr("Load icon from file..."),
this);
m_actionNoIcon = new QAction(IconThemeFactory::instance()->fromTheme("dialog-cancel"),
m_actionNoIcon = new QAction(IconFactory::instance()->fromTheme("dialog-cancel"),
tr("Do not use icon"),
this);
m_actionUseDefaultIcon = new QAction(IconThemeFactory::instance()->fromTheme("folder-category"),
m_actionUseDefaultIcon = new QAction(IconFactory::instance()->fromTheme("folder-category"),
tr("Use default icon"),
this);
m_iconMenu->addAction(m_actionLoadIconFromFile);

View File

@ -23,7 +23,7 @@
#include "core/feedsmodelcategory.h"
#include "core/feedsmodelfeed.h"
#include "miscellaneous/textfactory.h"
#include "miscellaneous/iconthemefactory.h"
#include "miscellaneous/iconfactory.h"
#include "network-web/networkfactory.h"
#include "gui/baselineedit.h"
#include "gui/messagebox.h"
@ -181,7 +181,7 @@ void FormStandardFeedDetails::onLoadIconFromFile() {
QFileDialog dialog(this, tr("Select icon file for the feed"),
QDir::homePath(), tr("Images (*.bmp *.jpg *.jpeg *.png *.svg *.tga)"));
dialog.setFileMode(QFileDialog::ExistingFile);
dialog.setWindowIcon(IconThemeFactory::instance()->fromTheme("image-generic"));
dialog.setWindowIcon(IconFactory::instance()->fromTheme("image-generic"));
dialog.setOptions(QFileDialog::DontUseNativeDialog | QFileDialog::ReadOnly);
dialog.setViewMode(QFileDialog::Detail);
dialog.setLabelText(QFileDialog::Accept, tr("Select icon"));
@ -197,7 +197,7 @@ void FormStandardFeedDetails::onLoadIconFromFile() {
}
void FormStandardFeedDetails::onUseDefaultIcon() {
m_ui->m_btnIcon->setIcon(IconThemeFactory::instance()->fromTheme("folder-feed"));
m_ui->m_btnIcon->setIcon(IconFactory::instance()->fromTheme("folder-feed"));
}
void FormStandardFeedDetails::apply() {
@ -354,7 +354,7 @@ void FormStandardFeedDetails::initialize() {
// Set flags and attributes.
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog);
setWindowIcon(IconThemeFactory::instance()->fromTheme("folder-feed"));
setWindowIcon(IconFactory::instance()->fromTheme("folder-feed"));
// Setup button box.
m_ui->m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
@ -399,13 +399,13 @@ void FormStandardFeedDetails::initialize() {
// Setup menu & actions for icon selection.
m_iconMenu = new QMenu(tr("Icon selection"), this);
m_actionLoadIconFromFile = new QAction(IconThemeFactory::instance()->fromTheme("image-generic"),
m_actionLoadIconFromFile = new QAction(IconFactory::instance()->fromTheme("image-generic"),
tr("Load icon from file..."),
this);
m_actionNoIcon = new QAction(IconThemeFactory::instance()->fromTheme("dialog-cancel"),
m_actionNoIcon = new QAction(IconFactory::instance()->fromTheme("dialog-cancel"),
tr("Do not use icon"),
this);
m_actionUseDefaultIcon = new QAction(IconThemeFactory::instance()->fromTheme("folder-feed"),
m_actionUseDefaultIcon = new QAction(IconFactory::instance()->fromTheme("folder-feed"),
tr("Use default icon"),
this);
m_iconMenu->addAction(m_actionLoadIconFromFile);

View File

@ -19,7 +19,7 @@
#include "definitions/definitions.h"
#include "miscellaneous/systemfactory.h"
#include "miscellaneous/iconthemefactory.h"
#include "miscellaneous/iconfactory.h"
#include "network-web/networkfactory.h"
#include "network-web/webfactory.h"
#include "gui/messagebox.h"
@ -35,7 +35,7 @@ FormUpdate::FormUpdate(QWidget *parent)
// Set flags and attributes.
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog);
setWindowIcon(IconThemeFactory::instance()->fromTheme("application-about"));
setWindowIcon(IconFactory::instance()->fromTheme("application-about"));
m_btnUpdate = m_ui->m_buttonBox->addButton(tr("Update"), QDialogButtonBox::ActionRole);
m_btnUpdate->setToolTip(tr("Download new installation files."));

View File

@ -17,7 +17,7 @@
#include "gui/messagebox.h"
#include "miscellaneous/iconthemefactory.h"
#include "miscellaneous/iconfactory.h"
#include <QDialogButtonBox>
#include <QtGlobal>
@ -51,22 +51,22 @@ void MessageBox::iconify(QDialogButtonBox *button_box) {
QIcon MessageBox::iconForRole(QDialogButtonBox::StandardButton button) {
switch (button) {
case QMessageBox::Ok:
return IconThemeFactory::instance()->fromTheme("dialog-ok");
return IconFactory::instance()->fromTheme("dialog-ok");
case QMessageBox::Cancel:
case QMessageBox::Close:
return IconThemeFactory::instance()->fromTheme("dialog-cancel");
return IconFactory::instance()->fromTheme("dialog-cancel");
case QMessageBox::Yes:
case QMessageBox::YesToAll:
return IconThemeFactory::instance()->fromTheme("dialog-yes");
return IconFactory::instance()->fromTheme("dialog-yes");
case QMessageBox::No:
case QMessageBox::NoToAll:
return IconThemeFactory::instance()->fromTheme("dialog-no");
return IconFactory::instance()->fromTheme("dialog-no");
case QMessageBox::Help:
return IconThemeFactory::instance()->fromTheme("dialog-question");
return IconFactory::instance()->fromTheme("dialog-question");
default:
return QIcon();
@ -76,16 +76,16 @@ QIcon MessageBox::iconForRole(QDialogButtonBox::StandardButton button) {
QIcon MessageBox::iconForStatus(QMessageBox::Icon status) {
switch (status) {
case QMessageBox::Information:
return IconThemeFactory::instance()->fromTheme("dialog-information");
return IconFactory::instance()->fromTheme("dialog-information");
case QMessageBox::Warning:
return IconThemeFactory::instance()->fromTheme("dialog-warning");
return IconFactory::instance()->fromTheme("dialog-warning");
case QMessageBox::Critical:
return IconThemeFactory::instance()->fromTheme("dialog-error");
return IconFactory::instance()->fromTheme("dialog-error");
case QMessageBox::Question:
return IconThemeFactory::instance()->fromTheme("dialog-question");
return IconFactory::instance()->fromTheme("dialog-question");
case QMessageBox::NoIcon:
default:

View File

@ -17,7 +17,7 @@
#include "gui/statusbar.h"
#include "miscellaneous/iconthemefactory.h"
#include "miscellaneous/iconfactory.h"
#include <QToolButton>
#include <QLabel>
@ -32,7 +32,7 @@ StatusBar::StatusBar(QWidget *parent) : QStatusBar(parent) {
m_fullscreenSwitcher = new QToolButton(this);
m_fullscreenSwitcher->setAutoRaise(true);
m_fullscreenSwitcher->setCheckable(true);
m_fullscreenSwitcher->setIcon(IconThemeFactory::instance()->fromTheme("view-fullscreen"));
m_fullscreenSwitcher->setIcon(IconFactory::instance()->fromTheme("view-fullscreen"));
m_fullscreenSwitcher->setText(tr("Fullscreen mode"));
m_fullscreenSwitcher->setToolTip(tr("Switch application between fulscreen/normal states right from this status bar icon."));

View File

@ -40,7 +40,7 @@ void TabBar::setTabType(int index, const TabBar::TabType &type) {
case TabBar::Closable: {
PlainToolButton *close_button = new PlainToolButton(this);
close_button->setIcon(IconThemeFactory::instance()->fromTheme("application-exit"));
close_button->setIcon(IconFactory::instance()->fromTheme("application-exit"));
close_button->setToolTip(tr("Close this tab."));
close_button->setText(tr("Close tab"));
close_button->setFixedSize(iconSize());

View File

@ -18,7 +18,7 @@
#ifndef TABBAR_H
#define TABBAR_H
#include "miscellaneous/iconthemefactory.h"
#include "miscellaneous/iconfactory.h"
#include <QTabBar>
#include <QVariant>

View File

@ -20,8 +20,8 @@
#include "definitions/definitions.h"
#include "miscellaneous/settings.h"
#include "miscellaneous/textfactory.h"
#include "miscellaneous/iconfactory.h"
#include "network-web/webbrowser.h"
#include "miscellaneous/iconthemefactory.h"
#include "gui/tabbar.h"
#include "gui/formmain.h"
#include "gui/feedmessageviewer.h"
@ -48,7 +48,7 @@ void TabWidget::setupCornerButton() {
m_btnAddTab->setAutoRaise(true);
m_btnAddTab->setPadding(3);
m_btnAddTab->setToolTip(tr("Open new web browser tab."));
m_btnAddTab->setIcon(IconThemeFactory::instance()->fromTheme("list-add"));
m_btnAddTab->setIcon(IconFactory::instance()->fromTheme("list-add"));
connect(m_btnAddTab, SIGNAL(clicked()), this, SLOT(addEmptyBrowser()));
}
@ -58,7 +58,7 @@ void TabWidget::setupMainMenuButton() {
m_btnMainMenu->setAutoRaise(true);
m_btnMainMenu->setPadding(3);
m_btnMainMenu->setToolTip(tr("Displays main menu."));
m_btnMainMenu->setIcon(IconThemeFactory::instance()->fromTheme("application-menu"));
m_btnMainMenu->setIcon(IconFactory::instance()->fromTheme("application-menu"));
m_btnMainMenu->setPopupMode(QToolButton::InstantPopup);
connect(m_btnMainMenu, SIGNAL(clicked()), this, SLOT(openMainMenu()));
@ -154,7 +154,7 @@ void TabWidget::setupIcons() {
for (int index = 0; index < count(); index++) {
// Index 0 usually contains widget which displays feeds & messages.
if (tabBar()->tabType(index) == TabBar::FeedReader) {
setTabIcon(index, IconThemeFactory::instance()->fromTheme("folder-feed"));
setTabIcon(index, IconFactory::instance()->fromTheme("folder-feed"));
}
// Other indexes probably contain WebBrowsers.
else {
@ -162,13 +162,13 @@ void TabWidget::setupIcons() {
if (active_browser != NULL && active_browser->icon().isNull()) {
// We found WebBrowser instance of this tab page, which
// has no suitable icon, load a new one from the icon theme.
setTabIcon(index, IconThemeFactory::instance()->fromTheme("text-html"));
setTabIcon(index, IconFactory::instance()->fromTheme("text-html"));
}
}
}
// Setup corner button icon.
m_btnAddTab->setIcon(IconThemeFactory::instance()->fromTheme("list-add"));
m_btnAddTab->setIcon(IconFactory::instance()->fromTheme("list-add"));
}
bool TabWidget::closeTab(int index) {
@ -292,14 +292,14 @@ int TabWidget::addBrowser(bool move_after_current,
// Insert web browser after current tab.
final_index = insertTab(currentIndex() + 1,
browser,
IconThemeFactory::instance()->fromTheme("text-html"),
IconFactory::instance()->fromTheme("text-html"),
tr("Web browser"),
TabBar::Closable);
}
else {
// Add new browser as the last tab.
final_index = addTab(browser,
IconThemeFactory::instance()->fromTheme("text-html"),
IconFactory::instance()->fromTheme("text-html"),
//: Web browser default tab title.
tr("Web browser"),
TabBar::Closable);

View File

@ -18,7 +18,7 @@
#include "gui/widgetwithstatus.h"
#include "gui/plaintoolbutton.h"
#include "miscellaneous/iconthemefactory.h"
#include "miscellaneous/iconfactory.h"
#include <QHBoxLayout>
@ -29,10 +29,10 @@ WidgetWithStatus::WidgetWithStatus(QWidget *parent)
m_btnStatus = new PlainToolButton(this);
m_btnStatus->setFocusPolicy(Qt::NoFocus);
m_iconInformation = IconThemeFactory::instance()->fromTheme("dialog-information");
m_iconWarning = IconThemeFactory::instance()->fromTheme("dialog-warning");
m_iconError = IconThemeFactory::instance()->fromTheme("dialog-error");
m_iconOk = IconThemeFactory::instance()->fromTheme("dialog-yes");
m_iconInformation = IconFactory::instance()->fromTheme("dialog-information");
m_iconWarning = IconFactory::instance()->fromTheme("dialog-warning");
m_iconError = IconFactory::instance()->fromTheme("dialog-error");
m_iconOk = IconFactory::instance()->fromTheme("dialog-yes");
// Set layout properties.
m_layout->setMargin(0);

View File

@ -20,7 +20,7 @@
#include "miscellaneous/debugging.h"
#include "miscellaneous/localization.h"
#include "miscellaneous/settings.h"
#include "miscellaneous/iconthemefactory.h"
#include "miscellaneous/iconfactory.h"
#include "miscellaneous/skinfactory.h"
#include "dynamic-shortcuts/dynamicshortcuts.h"
#include "gui/formmain.h"
@ -77,8 +77,8 @@ int main(int argc, char *argv[]) {
// Add an extra path for non-system icon themes and set current icon theme
// and skin.
IconThemeFactory::instance()->setupSearchPaths();
IconThemeFactory::instance()->loadCurrentIconTheme();
IconFactory::instance()->setupSearchPaths();
IconFactory::instance()->loadCurrentIconTheme();
SkinFactory::instance()->loadCurrentSkin();
// Load localization and setup locale before any widget is constructed.

View File

@ -17,10 +17,18 @@
#include "miscellaneous/iconfactory.h"
#include "miscellaneous/settings.h"
#include <QBuffer>
IconFactory::IconFactory() {
QPointer<IconFactory> IconFactory::s_instance;
IconFactory::IconFactory(QObject *parent) : QObject(parent) {
}
IconFactory::~IconFactory() {
qDebug("Destroying IconFactory instance.");
}
QIcon IconFactory::fromByteArray(QByteArray array) {
@ -48,3 +56,82 @@ QByteArray IconFactory::toByteArray(const QIcon &icon) {
buffer.close();
return array.toBase64();
}
IconFactory *IconFactory::instance() {
if (s_instance.isNull()) {
s_instance = new IconFactory(qApp);
}
return s_instance;
}
void IconFactory::setupSearchPaths() {
QIcon::setThemeSearchPaths(QStringList() << APP_THEME_PATH);
qDebug("Available icon theme paths: %s.",
qPrintable(QIcon::themeSearchPaths().replaceInStrings(QRegExp("^|$"),
"\'").join(", ")));
}
void IconFactory::setCurrentIconTheme(const QString &theme_name) {
Settings::instance()->setValue(APP_CFG_GUI,
"icon_theme",
theme_name);
}
void IconFactory::loadCurrentIconTheme() {
QStringList installed_themes = installedIconThemes();
QString theme_name_from_settings = Settings::instance()->value(APP_CFG_GUI,
"icon_theme",
APP_THEME_DEFAULT).toString();
if (m_currentIconTheme == theme_name_from_settings) {
qDebug("Icon theme '%s' already loaded.",
qPrintable(theme_name_from_settings));
return;
}
// Display list of installed themes.
qDebug("Installed icon themes are: %s.",
qPrintable(QStringList(installed_themes).replaceInStrings(QRegExp("^|$"),
"\'").join(", ")));
if (installed_themes.contains(theme_name_from_settings)) {
// Desired icon theme is installed and can be loaded.
qDebug("Loading icon theme '%s'.", qPrintable(theme_name_from_settings));
m_currentIconTheme = theme_name_from_settings;
}
else {
// Desired icon theme is not currently available.
// Install "default" icon theme instead.
qDebug("Icon theme '%s' cannot be loaded because it is not installed. "
"No icon theme is loaded now.",
qPrintable(theme_name_from_settings));
m_currentIconTheme = APP_NO_THEME;
}
}
QStringList IconFactory::installedIconThemes() const {
QStringList icon_theme_names;
icon_theme_names << APP_NO_THEME;
// Iterate all directories with icon themes.
QStringList icon_themes_paths = QIcon::themeSearchPaths();
icon_themes_paths.removeDuplicates();
foreach (const QString &icon_path, icon_themes_paths) {
QDir icon_dir(icon_path);
// Iterate all icon themes in this directory.
foreach (const QString &icon_theme_path, icon_dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot |
QDir::Readable | QDir::CaseSensitive |
QDir::NoSymLinks,
QDir::Time)) {
icon_theme_names << icon_theme_path;
}
}
icon_theme_names.removeDuplicates();
return icon_theme_names;
}

View File

@ -18,19 +18,74 @@
#ifndef ICONFACTORY_H
#define ICONFACTORY_H
#include <QString>
#include <QIcon>
#include <QPointer>
#include <QHash>
#include <QApplication>
#include <QDir>
#include "definitions/definitions.h"
class IconFactory {
private:
// Constructors and destructors.
explicit IconFactory();
class IconFactory : public QObject {
public:
// Destructor.
virtual ~IconFactory();
// Used to store/retrieve QIcons from/to database via Base64-encoded
// byte array.
static QIcon fromByteArray(QByteArray array);
static QByteArray toByteArray(const QIcon &icon);
QIcon fromByteArray(QByteArray array);
QByteArray toByteArray(const QIcon &icon);
// Returns icon from active theme or invalid icon if
// "no icon theme" is set.
inline QIcon fromTheme(const QString &name) {
if (m_currentIconTheme == APP_NO_THEME) {
return QIcon();
}
if (!m_cachedIcons.contains(name)) {
// Icon is not cached yet.
m_cachedIcons.insert(name, QIcon(APP_THEME_PATH + QDir::separator() +
m_currentIconTheme + QDir::separator() +
name + APP_THEME_SUFFIX));
}
return m_cachedIcons.value(name);
}
// Adds custom application path to be search for icons.
void setupSearchPaths();
// Returns list of installed themes, including "default" theme.
QStringList installedIconThemes() const;
// Loads name of selected icon theme (from settings) for the application and
// activates it. If that particular theme is not installed, then
// "default" theme is loaded.
void loadCurrentIconTheme();
// Returns name of currently activated theme for the application.
inline QString currentIconTheme() const {
return m_currentIconTheme;
}
// Sets icon theme with given name as the active one and loads it.
void setCurrentIconTheme(const QString &theme_name);
// Singleton getter.
static IconFactory *instance();
private:
// Constructor.
explicit IconFactory(QObject *parent = 0);
QHash<QString, QIcon> m_cachedIcons;
QString m_currentIconTheme;
// Singleton.
static QPointer<IconFactory> s_instance;
};
#endif // ICONFACTORY_H

View File

@ -1,122 +0,0 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2014 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// RSS Guard is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with RSS Guard. If not, see <http://www.gnu.org/licenses/>.
#include "miscellaneous/iconthemefactory.h"
#include "definitions/definitions.h"
#include "miscellaneous/settings.h"
#include "qtsingleapplication/qtsingleapplication.h"
#include <QIcon>
#include <QFile>
#include <QPointer>
#include <QApplication>
#include <QHash>
QPointer<IconThemeFactory> IconThemeFactory::s_instance;
IconThemeFactory::IconThemeFactory(QObject *parent)
: QObject(parent) {
}
IconThemeFactory::~IconThemeFactory() {
qDebug("Destroying IconThemeFactory instance.");
}
IconThemeFactory *IconThemeFactory::instance() {
if (s_instance.isNull()) {
s_instance = new IconThemeFactory(qApp);
}
return s_instance;
}
void IconThemeFactory::setupSearchPaths() {
QIcon::setThemeSearchPaths(QStringList() << APP_THEME_PATH);
qDebug("Available icon theme paths: %s.",
qPrintable(QIcon::themeSearchPaths().replaceInStrings(QRegExp("^|$"),
"\'").join(", ")));
}
QString IconThemeFactory::currentIconTheme() {
return m_currentIconTheme;
}
void IconThemeFactory::setCurrentIconTheme(const QString &theme_name) {
Settings::instance()->setValue(APP_CFG_GUI,
"icon_theme",
theme_name);
}
void IconThemeFactory::loadCurrentIconTheme() {
QStringList installed_themes = installedIconThemes();
QString theme_name_from_settings = Settings::instance()->value(APP_CFG_GUI,
"icon_theme",
APP_THEME_DEFAULT).toString();
if (m_currentIconTheme == theme_name_from_settings) {
qDebug("Icon theme '%s' already loaded.",
qPrintable(theme_name_from_settings));
return;
}
// Display list of installed themes.
qDebug("Installed icon themes are: %s.",
qPrintable(QStringList(installed_themes).replaceInStrings(QRegExp("^|$"),
"\'").join(", ")));
if (installed_themes.contains(theme_name_from_settings)) {
// Desired icon theme is installed and can be loaded.
qDebug("Loading icon theme '%s'.", qPrintable(theme_name_from_settings));
m_currentIconTheme = theme_name_from_settings;
}
else {
// Desired icon theme is not currently available.
// Install "default" icon theme instead.
qDebug("Icon theme '%s' cannot be loaded because it is not installed. "
"No icon theme is loaded now.",
qPrintable(theme_name_from_settings));
m_currentIconTheme = APP_NO_THEME;
}
}
QStringList IconThemeFactory::installedIconThemes() {
QStringList icon_theme_names;
icon_theme_names << APP_NO_THEME;
// Iterate all directories with icon themes.
QStringList icon_themes_paths = QIcon::themeSearchPaths();
icon_themes_paths.removeDuplicates();
foreach (const QString &icon_path, icon_themes_paths) {
QDir icon_dir(icon_path);
// Iterate all icon themes in this directory.
foreach (const QString &icon_theme_path, icon_dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot |
QDir::Readable | QDir::CaseSensitive |
QDir::NoSymLinks,
QDir::Time)) {
icon_theme_names << icon_theme_path;
}
}
icon_theme_names.removeDuplicates();
return icon_theme_names;
}

View File

@ -1,86 +0,0 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2014 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// RSS Guard is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with RSS Guard. If not, see <http://www.gnu.org/licenses/>.
#ifndef THEMEFACTORY_H
#define THEMEFACTORY_H
#include "definitions/definitions.h"
#include <QString>
#include <QIcon>
#include <QPointer>
#include <QHash>
#include <QApplication>
#include <QDir>
class IconThemeFactory : public QObject {
Q_OBJECT
public:
// Singleton getter.
static IconThemeFactory *instance();
// Destructor.
virtual ~IconThemeFactory();
// Returns icon from active theme or invalid icon if
// "no icon theme" is set.
inline QIcon fromTheme(const QString &name) {
if (m_currentIconTheme == APP_NO_THEME) {
return QIcon();
}
if (!m_cachedIcons.contains(name)) {
// Icon is not cached yet.
m_cachedIcons.insert(name, QIcon(APP_THEME_PATH + QDir::separator() +
m_currentIconTheme + QDir::separator() +
name + APP_THEME_SUFFIX));
}
return m_cachedIcons.value(name);
}
// Adds custom application path to be search for icons.
void setupSearchPaths();
// Returns list of installed themes, including "default" theme.
QStringList installedIconThemes();
// Loads name of selected icon theme (from settings) for the application and
// activates it. If that particular theme is not installed, then
// "default" theme is loaded.
void loadCurrentIconTheme();
// Returns name of currently activated theme for the application.
QString currentIconTheme();
// Sets icon theme with given name as the active one and loads it.
void setCurrentIconTheme(const QString &theme_name);
private:
// Constructor.
explicit IconThemeFactory(QObject *parent = 0);
QHash<QString, QIcon> m_cachedIcons;
QString m_currentIconTheme;
// Singleton.
static QPointer<IconThemeFactory> s_instance;
};
#endif // THEMEFACTORY_H

View File

@ -22,7 +22,6 @@
#include "network-web/webpage.h"
#include "network-web/webview.h"
#include "miscellaneous/skinfactory.h"
#include "miscellaneous/iconthemefactory.h"
#include "gui/formmain.h"
#include "gui/tabwidget.h"
@ -236,7 +235,7 @@ void WebBrowser::navigateToMessages(const QList<Message> &messages) {
m_webView->setHtml(layout_wrapper, QUrl(INTERNAL_URL_NEWSPAPER));
emit iconChanged(m_index,
IconThemeFactory::instance()->fromTheme("item-newspaper"));
IconFactory::instance()->fromTheme("item-newspaper"));
}
void WebBrowser::updateZoomGui() {
@ -281,9 +280,9 @@ WebBrowser::~WebBrowser() {
}
void WebBrowser::setupIcons() {
m_actionBack->setIcon(IconThemeFactory::instance()->fromTheme("go-previous"));
m_actionForward->setIcon(IconThemeFactory::instance()->fromTheme("go-next"));
m_actionReload->setIcon(IconThemeFactory::instance()->fromTheme("go-refresh"));
m_actionStop->setIcon(IconThemeFactory::instance()->fromTheme("go-stop"));
m_actionBack->setIcon(IconFactory::instance()->fromTheme("go-previous"));
m_actionForward->setIcon(IconFactory::instance()->fromTheme("go-next"));
m_actionReload->setIcon(IconFactory::instance()->fromTheme("go-refresh"));
m_actionStop->setIcon(IconFactory::instance()->fromTheme("go-stop"));
m_webView->setupIcons();
}

View File

@ -20,7 +20,7 @@
#include "definitions/definitions.h"
#include "miscellaneous/settings.h"
#include "miscellaneous/skinfactory.h"
#include "miscellaneous/iconthemefactory.h"
#include "miscellaneous/iconfactory.h"
#include "network-web/webpage.h"
#include <QStyleOptionFrameV3>
@ -75,18 +75,18 @@ void WebView::createConnections() {
}
void WebView::setupIcons() {
m_actionReload->setIcon(IconThemeFactory::instance()->fromTheme("go-refresh"));
m_actionCopySelectedItem->setIcon(IconThemeFactory::instance()->fromTheme("edit-copy"));
m_actionCopyLink->setIcon(IconThemeFactory::instance()->fromTheme("edit-copy"));
m_actionCopyImage->setIcon(IconThemeFactory::instance()->fromTheme("edit-copy-image"));
m_actionReload->setIcon(IconFactory::instance()->fromTheme("go-refresh"));
m_actionCopySelectedItem->setIcon(IconFactory::instance()->fromTheme("edit-copy"));
m_actionCopyLink->setIcon(IconFactory::instance()->fromTheme("edit-copy"));
m_actionCopyImage->setIcon(IconFactory::instance()->fromTheme("edit-copy-image"));
#if QT_VERSION >= 0x040800
m_actionCopyImageUrl->setIcon(IconThemeFactory::instance()->fromTheme("edit-copy"));
m_actionCopyImageUrl->setIcon(IconFactory::instance()->fromTheme("edit-copy"));
#endif
m_actionOpenLinkThisTab->setIcon(IconThemeFactory::instance()->fromTheme("text-html"));
m_actionOpenLinkNewTab->setIcon(IconThemeFactory::instance()->fromTheme("text-html"));
m_actionOpenImageNewTab->setIcon(IconThemeFactory::instance()->fromTheme("edit-copy-image"));
m_actionOpenLinkThisTab->setIcon(IconFactory::instance()->fromTheme("text-html"));
m_actionOpenLinkNewTab->setIcon(IconFactory::instance()->fromTheme("text-html"));
m_actionOpenImageNewTab->setIcon(IconFactory::instance()->fromTheme("edit-copy-image"));
}
void WebView::initializeActions() {
@ -161,8 +161,8 @@ void WebView::popupContextMenu(const QPoint &pos) {
QMenu link_submenu(tr("Hyperlink"), this);
QWebHitTestResult hit_result = page()->mainFrame()->hitTestContent(pos);
image_submenu.setIcon(IconThemeFactory::instance()->fromTheme("image-generic"));
link_submenu.setIcon(IconThemeFactory::instance()->fromTheme("text-html"));
image_submenu.setIcon(IconFactory::instance()->fromTheme("image-generic"));
link_submenu.setIcon(IconFactory::instance()->fromTheme("text-html"));
// Assemble the menu from actions.
context_menu.addAction(m_actionReload);