Refactoring.
This commit is contained in:
parent
9136c6749e
commit
9982b73a40
28
src/core/feedsmodel.cpp
Normal file → Executable file
28
src/core/feedsmodel.cpp
Normal file → Executable file
@ -41,10 +41,10 @@ FeedsModel::FeedsModel(QObject *parent) : QAbstractItemModel(parent) {
|
|||||||
|
|
||||||
//: Name of root item of feed list which can be seen in feed add/edit dialog.
|
//: Name of root item of feed list which can be seen in feed add/edit dialog.
|
||||||
m_rootItem->setTitle(tr("Root"));
|
m_rootItem->setTitle(tr("Root"));
|
||||||
m_rootItem->setIcon(IconFactory::instance()->fromTheme("folder-root"));
|
m_rootItem->setIcon(qApp->icons()->fromTheme("folder-root"));
|
||||||
|
|
||||||
// Setup icons.
|
// Setup icons.
|
||||||
m_countsIcon = IconFactory::instance()->fromTheme("mail-mark-unread");
|
m_countsIcon = qApp->icons()->fromTheme("mail-mark-unread");
|
||||||
|
|
||||||
//: Title text in the feed list header.
|
//: Title text in the feed list header.
|
||||||
m_headerData << tr("Title");
|
m_headerData << tr("Title");
|
||||||
@ -170,7 +170,7 @@ bool FeedsModel::addCategory(FeedsModelCategory *category,
|
|||||||
|
|
||||||
// Now, add category to persistent storage.
|
// Now, add category to persistent storage.
|
||||||
// Children are removed, remove this standard category too.
|
// Children are removed, remove this standard category too.
|
||||||
QSqlDatabase database = DatabaseFactory::instance()->connection(objectName(),
|
QSqlDatabase database = qApp->database()->connection(objectName(),
|
||||||
DatabaseFactory::FromSettings);
|
DatabaseFactory::FromSettings);
|
||||||
QSqlQuery query_add(database);
|
QSqlQuery query_add(database);
|
||||||
|
|
||||||
@ -182,7 +182,7 @@ bool FeedsModel::addCategory(FeedsModelCategory *category,
|
|||||||
query_add.bindValue(":title", category->title());
|
query_add.bindValue(":title", category->title());
|
||||||
query_add.bindValue(":description", category->description());
|
query_add.bindValue(":description", category->description());
|
||||||
query_add.bindValue(":date_created", category->creationDate().toMSecsSinceEpoch());
|
query_add.bindValue(":date_created", category->creationDate().toMSecsSinceEpoch());
|
||||||
query_add.bindValue(":icon", IconFactory::instance()->toByteArray(category->icon()));
|
query_add.bindValue(":icon", qApp->icons()->toByteArray(category->icon()));
|
||||||
|
|
||||||
if (!query_add.exec()) {
|
if (!query_add.exec()) {
|
||||||
// Query failed.
|
// Query failed.
|
||||||
@ -212,7 +212,7 @@ bool FeedsModel::addCategory(FeedsModelCategory *category,
|
|||||||
|
|
||||||
bool FeedsModel::editCategory(FeedsModelCategory *original_category,
|
bool FeedsModel::editCategory(FeedsModelCategory *original_category,
|
||||||
FeedsModelCategory *new_category) {
|
FeedsModelCategory *new_category) {
|
||||||
QSqlDatabase database = DatabaseFactory::instance()->connection(objectName(),
|
QSqlDatabase database = qApp->database()->connection(objectName(),
|
||||||
DatabaseFactory::FromSettings);
|
DatabaseFactory::FromSettings);
|
||||||
QSqlQuery query_update_category(database);
|
QSqlQuery query_update_category(database);
|
||||||
FeedsModelRootItem *original_parent = original_category->parent();
|
FeedsModelRootItem *original_parent = original_category->parent();
|
||||||
@ -224,7 +224,7 @@ bool FeedsModel::editCategory(FeedsModelCategory *original_category,
|
|||||||
"WHERE id = :id;");
|
"WHERE id = :id;");
|
||||||
query_update_category.bindValue(":title", new_category->title());
|
query_update_category.bindValue(":title", new_category->title());
|
||||||
query_update_category.bindValue(":description", new_category->description());
|
query_update_category.bindValue(":description", new_category->description());
|
||||||
query_update_category.bindValue(":icon", IconFactory::instance()->toByteArray(new_category->icon()));
|
query_update_category.bindValue(":icon", qApp->icons()->toByteArray(new_category->icon()));
|
||||||
query_update_category.bindValue(":parent_id", new_parent->id());
|
query_update_category.bindValue(":parent_id", new_parent->id());
|
||||||
query_update_category.bindValue(":id", original_category->id());
|
query_update_category.bindValue(":id", original_category->id());
|
||||||
|
|
||||||
@ -273,7 +273,7 @@ bool FeedsModel::addFeed(FeedsModelFeed *feed,
|
|||||||
|
|
||||||
// Now, add category to persistent storage.
|
// Now, add category to persistent storage.
|
||||||
// Children are removed, remove this standard category too.
|
// Children are removed, remove this standard category too.
|
||||||
QSqlDatabase database = DatabaseFactory::instance()->connection(objectName(),
|
QSqlDatabase database = qApp->database()->connection(objectName(),
|
||||||
DatabaseFactory::FromSettings);
|
DatabaseFactory::FromSettings);
|
||||||
QSqlQuery query_add_feed(database);
|
QSqlQuery query_add_feed(database);
|
||||||
|
|
||||||
@ -284,7 +284,7 @@ bool FeedsModel::addFeed(FeedsModelFeed *feed,
|
|||||||
query_add_feed.bindValue(":title", feed->title());
|
query_add_feed.bindValue(":title", feed->title());
|
||||||
query_add_feed.bindValue(":description", feed->description());
|
query_add_feed.bindValue(":description", feed->description());
|
||||||
query_add_feed.bindValue(":date_created", feed->creationDate().toMSecsSinceEpoch());
|
query_add_feed.bindValue(":date_created", feed->creationDate().toMSecsSinceEpoch());
|
||||||
query_add_feed.bindValue(":icon", IconFactory::instance()->toByteArray(feed->icon()));
|
query_add_feed.bindValue(":icon", qApp->icons()->toByteArray(feed->icon()));
|
||||||
query_add_feed.bindValue(":category", parent->id());
|
query_add_feed.bindValue(":category", parent->id());
|
||||||
query_add_feed.bindValue(":encoding", feed->encoding());
|
query_add_feed.bindValue(":encoding", feed->encoding());
|
||||||
query_add_feed.bindValue(":url", feed->url());
|
query_add_feed.bindValue(":url", feed->url());
|
||||||
@ -323,7 +323,7 @@ bool FeedsModel::addFeed(FeedsModelFeed *feed,
|
|||||||
|
|
||||||
bool FeedsModel::editFeed(FeedsModelFeed *original_feed,
|
bool FeedsModel::editFeed(FeedsModelFeed *original_feed,
|
||||||
FeedsModelFeed *new_feed) {
|
FeedsModelFeed *new_feed) {
|
||||||
QSqlDatabase database = DatabaseFactory::instance()->connection(objectName(),
|
QSqlDatabase database = qApp->database()->connection(objectName(),
|
||||||
DatabaseFactory::FromSettings);
|
DatabaseFactory::FromSettings);
|
||||||
QSqlQuery query_update_feed(database);
|
QSqlQuery query_update_feed(database);
|
||||||
FeedsModelRootItem *original_parent = original_feed->parent();
|
FeedsModelRootItem *original_parent = original_feed->parent();
|
||||||
@ -335,7 +335,7 @@ bool FeedsModel::editFeed(FeedsModelFeed *original_feed,
|
|||||||
"WHERE id = :id;");
|
"WHERE id = :id;");
|
||||||
query_update_feed.bindValue(":title", new_feed->title());
|
query_update_feed.bindValue(":title", new_feed->title());
|
||||||
query_update_feed.bindValue(":description", new_feed->description());
|
query_update_feed.bindValue(":description", new_feed->description());
|
||||||
query_update_feed.bindValue(":icon", IconFactory::instance()->toByteArray(new_feed->icon()));
|
query_update_feed.bindValue(":icon", qApp->icons()->toByteArray(new_feed->icon()));
|
||||||
query_update_feed.bindValue(":category", new_parent->id());
|
query_update_feed.bindValue(":category", new_parent->id());
|
||||||
query_update_feed.bindValue(":encoding", new_feed->encoding());
|
query_update_feed.bindValue(":encoding", new_feed->encoding());
|
||||||
query_update_feed.bindValue(":url", new_feed->url());
|
query_update_feed.bindValue(":url", new_feed->url());
|
||||||
@ -436,7 +436,7 @@ QList<FeedsModelFeed*> FeedsModel::feedsForScheduledUpdate(bool auto_update_now)
|
|||||||
QList<Message> FeedsModel::messagesForFeeds(const QList<FeedsModelFeed*> &feeds) {
|
QList<Message> FeedsModel::messagesForFeeds(const QList<FeedsModelFeed*> &feeds) {
|
||||||
QList<Message> messages;
|
QList<Message> messages;
|
||||||
|
|
||||||
QSqlDatabase database = DatabaseFactory::instance()->connection(objectName(),
|
QSqlDatabase database = qApp->database()->connection(objectName(),
|
||||||
DatabaseFactory::FromSettings);
|
DatabaseFactory::FromSettings);
|
||||||
QSqlQuery query_read_msg(database);
|
QSqlQuery query_read_msg(database);
|
||||||
query_read_msg.setForwardOnly(true);
|
query_read_msg.setForwardOnly(true);
|
||||||
@ -571,7 +571,7 @@ void FeedsModel::loadFromDatabase() {
|
|||||||
qDeleteAll(m_rootItem->childItems());
|
qDeleteAll(m_rootItem->childItems());
|
||||||
m_rootItem->clearChildren();
|
m_rootItem->clearChildren();
|
||||||
|
|
||||||
QSqlDatabase database = DatabaseFactory::instance()->connection(objectName(),
|
QSqlDatabase database = qApp->database()->connection(objectName(),
|
||||||
DatabaseFactory::FromSettings);
|
DatabaseFactory::FromSettings);
|
||||||
CategoryAssignment categories;
|
CategoryAssignment categories;
|
||||||
FeedAssignment feeds;
|
FeedAssignment feeds;
|
||||||
@ -671,7 +671,7 @@ QList<FeedsModelFeed*> FeedsModel::feedsForIndexes(const QModelIndexList &indexe
|
|||||||
|
|
||||||
bool FeedsModel::markFeedsRead(const QList<FeedsModelFeed*> &feeds,
|
bool FeedsModel::markFeedsRead(const QList<FeedsModelFeed*> &feeds,
|
||||||
int read) {
|
int read) {
|
||||||
QSqlDatabase db_handle = DatabaseFactory::instance()->connection(objectName(),
|
QSqlDatabase db_handle = qApp->database()->connection(objectName(),
|
||||||
DatabaseFactory::FromSettings);
|
DatabaseFactory::FromSettings);
|
||||||
|
|
||||||
if (!db_handle.transaction()) {
|
if (!db_handle.transaction()) {
|
||||||
@ -709,7 +709,7 @@ bool FeedsModel::markFeedsRead(const QList<FeedsModelFeed*> &feeds,
|
|||||||
bool FeedsModel::markFeedsDeleted(const QList<FeedsModelFeed*> &feeds,
|
bool FeedsModel::markFeedsDeleted(const QList<FeedsModelFeed*> &feeds,
|
||||||
int deleted,
|
int deleted,
|
||||||
bool read_only) {
|
bool read_only) {
|
||||||
QSqlDatabase db_handle = DatabaseFactory::instance()->connection(objectName(),
|
QSqlDatabase db_handle = qApp->database()->connection(objectName(),
|
||||||
DatabaseFactory::FromSettings);
|
DatabaseFactory::FromSettings);
|
||||||
|
|
||||||
if (!db_handle.transaction()) {
|
if (!db_handle.transaction()) {
|
||||||
|
@ -131,7 +131,7 @@ bool FeedsModelCategory::removeItself() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Children are removed, remove this standard category too.
|
// Children are removed, remove this standard category too.
|
||||||
QSqlDatabase database = DatabaseFactory::instance()->connection("FeedsModelCategory",
|
QSqlDatabase database = qApp->database()->connection("FeedsModelCategory",
|
||||||
DatabaseFactory::FromSettings);
|
DatabaseFactory::FromSettings);
|
||||||
QSqlQuery query_remove(database);
|
QSqlQuery query_remove(database);
|
||||||
|
|
||||||
@ -151,7 +151,7 @@ FeedsModelCategory *FeedsModelCategory::loadFromRecord(const QSqlRecord &record)
|
|||||||
category->setTitle(record.value(CAT_DB_TITLE_INDEX).toString());
|
category->setTitle(record.value(CAT_DB_TITLE_INDEX).toString());
|
||||||
category->setDescription(record.value(CAT_DB_DESCRIPTION_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->setCreationDate(TextFactory::parseDateTime(record.value(CAT_DB_DCREATED_INDEX).value<qint64>()).toLocalTime());
|
||||||
category->setIcon(IconFactory::instance()->fromByteArray(record.value(CAT_DB_ICON_INDEX).toByteArray()));
|
category->setIcon(qApp->icons()->fromByteArray(record.value(CAT_DB_ICON_INDEX).toByteArray()));
|
||||||
|
|
||||||
return category;
|
return category;
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ QString FeedsModelFeed::typeToString(FeedsModelFeed::Type type) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FeedsModelFeed::updateCounts(bool including_total_count, bool update_feed_statuses) {
|
void FeedsModelFeed::updateCounts(bool including_total_count, bool update_feed_statuses) {
|
||||||
QSqlDatabase database = DatabaseFactory::instance()->connection("FeedsModelFeed",
|
QSqlDatabase database = qApp->database()->connection("FeedsModelFeed",
|
||||||
DatabaseFactory::FromSettings);
|
DatabaseFactory::FromSettings);
|
||||||
QSqlQuery query_all(database);
|
QSqlQuery query_all(database);
|
||||||
query_all.setForwardOnly(true);
|
query_all.setForwardOnly(true);
|
||||||
@ -116,7 +116,7 @@ FeedsModelFeed *FeedsModelFeed::loadFromRecord(const QSqlRecord &record) {
|
|||||||
feed->setId(record.value(FDS_DB_ID_INDEX).toInt());
|
feed->setId(record.value(FDS_DB_ID_INDEX).toInt());
|
||||||
feed->setDescription(record.value(FDS_DB_DESCRIPTION_INDEX).toString());
|
feed->setDescription(record.value(FDS_DB_DESCRIPTION_INDEX).toString());
|
||||||
feed->setCreationDate(TextFactory::parseDateTime(record.value(FDS_DB_DCREATED_INDEX).value<qint64>()).toLocalTime());
|
feed->setCreationDate(TextFactory::parseDateTime(record.value(FDS_DB_DCREATED_INDEX).value<qint64>()).toLocalTime());
|
||||||
feed->setIcon(IconFactory::instance()->fromByteArray(record.value(FDS_DB_ICON_INDEX).toByteArray()));
|
feed->setIcon(qApp->icons()->fromByteArray(record.value(FDS_DB_ICON_INDEX).toByteArray()));
|
||||||
feed->setEncoding(record.value(FDS_DB_ENCODING_INDEX).toString());
|
feed->setEncoding(record.value(FDS_DB_ENCODING_INDEX).toString());
|
||||||
feed->setUrl(record.value(FDS_DB_URL_INDEX).toString());
|
feed->setUrl(record.value(FDS_DB_URL_INDEX).toString());
|
||||||
feed->setPasswordProtected(record.value(FDS_DB_PROTECTED_INDEX).toBool());
|
feed->setPasswordProtected(record.value(FDS_DB_PROTECTED_INDEX).toBool());
|
||||||
@ -398,7 +398,7 @@ void FeedsModelFeed::update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool FeedsModelFeed::removeItself() {
|
bool FeedsModelFeed::removeItself() {
|
||||||
QSqlDatabase database = DatabaseFactory::instance()->connection("FeedsModelFeed",
|
QSqlDatabase database = qApp->database()->connection("FeedsModelFeed",
|
||||||
DatabaseFactory::FromSettings);
|
DatabaseFactory::FromSettings);
|
||||||
QSqlQuery query_remove(database);
|
QSqlQuery query_remove(database);
|
||||||
|
|
||||||
@ -421,7 +421,7 @@ bool FeedsModelFeed::removeItself() {
|
|||||||
|
|
||||||
void FeedsModelFeed::updateMessages(const QList<Message> &messages) {
|
void FeedsModelFeed::updateMessages(const QList<Message> &messages) {
|
||||||
int feed_id = id();
|
int feed_id = id();
|
||||||
QSqlDatabase database = DatabaseFactory::instance()->connection("FeedsModelFeed",
|
QSqlDatabase database = qApp->database()->connection("FeedsModelFeed",
|
||||||
DatabaseFactory::FromSettings);
|
DatabaseFactory::FromSettings);
|
||||||
|
|
||||||
// Prepare queries.
|
// Prepare queries.
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
MessagesModel::MessagesModel(QObject *parent)
|
MessagesModel::MessagesModel(QObject *parent)
|
||||||
: QSqlTableModel(parent,
|
: QSqlTableModel(parent,
|
||||||
DatabaseFactory::instance()->connection("MessagesModel",
|
qApp->database()->connection("MessagesModel",
|
||||||
DatabaseFactory::FromSettings)) {
|
DatabaseFactory::FromSettings)) {
|
||||||
setObjectName("MessagesModel");
|
setObjectName("MessagesModel");
|
||||||
setupFonts();
|
setupFonts();
|
||||||
@ -50,9 +50,9 @@ MessagesModel::~MessagesModel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MessagesModel::setupIcons() {
|
void MessagesModel::setupIcons() {
|
||||||
m_favoriteIcon = IconFactory::instance()->fromTheme("mail-mark-favorite");
|
m_favoriteIcon = qApp->icons()->fromTheme("mail-mark-favorite");
|
||||||
m_readIcon = IconFactory::instance()->fromTheme("mail-mark-read");
|
m_readIcon = qApp->icons()->fromTheme("mail-mark-read");
|
||||||
m_unreadIcon = IconFactory::instance()->fromTheme("mail-mark-unread");
|
m_unreadIcon = qApp->icons()->fromTheme("mail-mark-unread");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagesModel::fetchAll() {
|
void MessagesModel::fetchAll() {
|
||||||
|
4
src/dynamic-shortcuts/shortcutcatcher.cpp
Normal file → Executable file
4
src/dynamic-shortcuts/shortcutcatcher.cpp
Normal file → Executable file
@ -44,13 +44,13 @@ ShortcutCatcher::ShortcutCatcher(QWidget *parent)
|
|||||||
|
|
||||||
// Create reset button.
|
// Create reset button.
|
||||||
m_btnReset = new PlainToolButton(this);
|
m_btnReset = new PlainToolButton(this);
|
||||||
m_btnReset->setIcon(IconFactory::instance()->fromTheme("edit-revert"));
|
m_btnReset->setIcon(qApp->icons()->fromTheme("edit-revert"));
|
||||||
m_btnReset->setFocusPolicy(Qt::NoFocus);
|
m_btnReset->setFocusPolicy(Qt::NoFocus);
|
||||||
m_btnReset->setToolTip(tr("Reset to original shortcut."));
|
m_btnReset->setToolTip(tr("Reset to original shortcut."));
|
||||||
|
|
||||||
// Create clear button.
|
// Create clear button.
|
||||||
m_btnClear = new PlainToolButton(this);
|
m_btnClear = new PlainToolButton(this);
|
||||||
m_btnClear->setIcon(IconFactory::instance()->fromTheme("item-remove"));
|
m_btnClear->setIcon(qApp->icons()->fromTheme("item-remove"));
|
||||||
m_btnClear->setFocusPolicy(Qt::NoFocus);
|
m_btnClear->setFocusPolicy(Qt::NoFocus);
|
||||||
m_btnClear->setToolTip(tr("Clear current shortcut."));
|
m_btnClear->setToolTip(tr("Clear current shortcut."));
|
||||||
|
|
||||||
|
@ -393,7 +393,7 @@ void FeedMessageViewer::vacuumDatabase() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DatabaseFactory::instance()->vacuumDatabase()) {
|
if (qApp->database()->vacuumDatabase()) {
|
||||||
qApp->showGuiMessage(tr("Database defragmented"),
|
qApp->showGuiMessage(tr("Database defragmented"),
|
||||||
tr("Database was successfully defragmented."),
|
tr("Database was successfully defragmented."),
|
||||||
QSystemTrayIcon::Information,
|
QSystemTrayIcon::Information,
|
||||||
|
@ -82,7 +82,7 @@ void FeedsToolBar::loadChangeableActions(const QStringList &actions) {
|
|||||||
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
|
|
||||||
QAction *action = addWidget(spacer);
|
QAction *action = addWidget(spacer);
|
||||||
action->setIcon(IconFactory::instance()->fromTheme("application-search"));
|
action->setIcon(qApp->icons()->fromTheme("application-search"));
|
||||||
action->setProperty("type", SPACER_ACTION_NAME);
|
action->setProperty("type", SPACER_ACTION_NAME);
|
||||||
action->setProperty("name", tr("Toolbar spacer"));
|
action->setProperty("name", tr("Toolbar spacer"));
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ FormAbout::FormAbout(QWidget *parent) : QDialog(parent), m_ui(new Ui::FormAbout)
|
|||||||
|
|
||||||
// Set flags and attributes.
|
// Set flags and attributes.
|
||||||
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint);
|
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint);
|
||||||
setWindowIcon(IconFactory::instance()->fromTheme("application-about"));
|
setWindowIcon(qApp->icons()->fromTheme("application-about"));
|
||||||
|
|
||||||
//: About RSS Guard dialog title.
|
//: About RSS Guard dialog title.
|
||||||
setWindowTitle(tr("About %1").arg(APP_NAME));
|
setWindowTitle(tr("About %1").arg(APP_NAME));
|
||||||
|
@ -166,7 +166,7 @@ void FormCategoryDetails::onLoadIconFromFile() {
|
|||||||
QFileDialog dialog(this, tr("Select icon file for the category"),
|
QFileDialog dialog(this, tr("Select icon file for the category"),
|
||||||
QDir::homePath(), tr("Images (*.bmp *.jpg *.jpeg *.png *.svg *.tga)"));
|
QDir::homePath(), tr("Images (*.bmp *.jpg *.jpeg *.png *.svg *.tga)"));
|
||||||
dialog.setFileMode(QFileDialog::ExistingFile);
|
dialog.setFileMode(QFileDialog::ExistingFile);
|
||||||
dialog.setWindowIcon(IconFactory::instance()->fromTheme("image-generic"));
|
dialog.setWindowIcon(qApp->icons()->fromTheme("image-generic"));
|
||||||
dialog.setOptions(QFileDialog::DontUseNativeDialog | QFileDialog::ReadOnly);
|
dialog.setOptions(QFileDialog::DontUseNativeDialog | QFileDialog::ReadOnly);
|
||||||
dialog.setViewMode(QFileDialog::Detail);
|
dialog.setViewMode(QFileDialog::Detail);
|
||||||
dialog.setLabelText(QFileDialog::Accept, tr("Select icon"));
|
dialog.setLabelText(QFileDialog::Accept, tr("Select icon"));
|
||||||
@ -182,7 +182,7 @@ void FormCategoryDetails::onLoadIconFromFile() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FormCategoryDetails::onUseDefaultIcon() {
|
void FormCategoryDetails::onUseDefaultIcon() {
|
||||||
m_ui->m_btnIcon->setIcon(IconFactory::instance()->fromTheme("folder-category"));
|
m_ui->m_btnIcon->setIcon(qApp->icons()->fromTheme("folder-category"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormCategoryDetails::initialize() {
|
void FormCategoryDetails::initialize() {
|
||||||
@ -198,7 +198,7 @@ void FormCategoryDetails::initialize() {
|
|||||||
|
|
||||||
// Set flags and attributes.
|
// Set flags and attributes.
|
||||||
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowTitleHint);
|
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowTitleHint);
|
||||||
setWindowIcon(IconFactory::instance()->fromTheme("folder-category"));
|
setWindowIcon(qApp->icons()->fromTheme("folder-category"));
|
||||||
|
|
||||||
// Setup button box.
|
// Setup button box.
|
||||||
m_ui->m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
m_ui->m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||||
@ -209,13 +209,13 @@ void FormCategoryDetails::initialize() {
|
|||||||
|
|
||||||
// Setup menu & actions for icon selection.
|
// Setup menu & actions for icon selection.
|
||||||
m_iconMenu = new QMenu(tr("Icon selection"), this);
|
m_iconMenu = new QMenu(tr("Icon selection"), this);
|
||||||
m_actionLoadIconFromFile = new QAction(IconFactory::instance()->fromTheme("image-generic"),
|
m_actionLoadIconFromFile = new QAction(qApp->icons()->fromTheme("image-generic"),
|
||||||
tr("Load icon from file..."),
|
tr("Load icon from file..."),
|
||||||
this);
|
this);
|
||||||
m_actionNoIcon = new QAction(IconFactory::instance()->fromTheme("dialog-cancel"),
|
m_actionNoIcon = new QAction(qApp->icons()->fromTheme("dialog-cancel"),
|
||||||
tr("Do not use icon"),
|
tr("Do not use icon"),
|
||||||
this);
|
this);
|
||||||
m_actionUseDefaultIcon = new QAction(IconFactory::instance()->fromTheme("folder-category"),
|
m_actionUseDefaultIcon = new QAction(qApp->icons()->fromTheme("folder-category"),
|
||||||
tr("Use default icon"),
|
tr("Use default icon"),
|
||||||
this);
|
this);
|
||||||
m_iconMenu->addAction(m_actionLoadIconFromFile);
|
m_iconMenu->addAction(m_actionLoadIconFromFile);
|
||||||
|
@ -181,7 +181,7 @@ void FormFeedDetails::onLoadIconFromFile() {
|
|||||||
QFileDialog dialog(this, tr("Select icon file for the feed"),
|
QFileDialog dialog(this, tr("Select icon file for the feed"),
|
||||||
QDir::homePath(), tr("Images (*.bmp *.jpg *.jpeg *.png *.svg *.tga)"));
|
QDir::homePath(), tr("Images (*.bmp *.jpg *.jpeg *.png *.svg *.tga)"));
|
||||||
dialog.setFileMode(QFileDialog::ExistingFile);
|
dialog.setFileMode(QFileDialog::ExistingFile);
|
||||||
dialog.setWindowIcon(IconFactory::instance()->fromTheme("image-generic"));
|
dialog.setWindowIcon(qApp->icons()->fromTheme("image-generic"));
|
||||||
dialog.setOptions(QFileDialog::DontUseNativeDialog | QFileDialog::ReadOnly);
|
dialog.setOptions(QFileDialog::DontUseNativeDialog | QFileDialog::ReadOnly);
|
||||||
dialog.setViewMode(QFileDialog::Detail);
|
dialog.setViewMode(QFileDialog::Detail);
|
||||||
dialog.setLabelText(QFileDialog::Accept, tr("Select icon"));
|
dialog.setLabelText(QFileDialog::Accept, tr("Select icon"));
|
||||||
@ -197,7 +197,7 @@ void FormFeedDetails::onLoadIconFromFile() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FormFeedDetails::onUseDefaultIcon() {
|
void FormFeedDetails::onUseDefaultIcon() {
|
||||||
m_ui->m_btnIcon->setIcon(IconFactory::instance()->fromTheme("folder-feed"));
|
m_ui->m_btnIcon->setIcon(qApp->icons()->fromTheme("folder-feed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormFeedDetails::apply() {
|
void FormFeedDetails::apply() {
|
||||||
@ -354,7 +354,7 @@ void FormFeedDetails::initialize() {
|
|||||||
|
|
||||||
// Set flags and attributes.
|
// Set flags and attributes.
|
||||||
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowTitleHint);
|
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowTitleHint);
|
||||||
setWindowIcon(IconFactory::instance()->fromTheme("folder-feed"));
|
setWindowIcon(qApp->icons()->fromTheme("folder-feed"));
|
||||||
|
|
||||||
// Setup button box.
|
// Setup button box.
|
||||||
m_ui->m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
m_ui->m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||||
@ -399,13 +399,13 @@ void FormFeedDetails::initialize() {
|
|||||||
|
|
||||||
// Setup menu & actions for icon selection.
|
// Setup menu & actions for icon selection.
|
||||||
m_iconMenu = new QMenu(tr("Icon selection"), this);
|
m_iconMenu = new QMenu(tr("Icon selection"), this);
|
||||||
m_actionLoadIconFromFile = new QAction(IconFactory::instance()->fromTheme("image-generic"),
|
m_actionLoadIconFromFile = new QAction(qApp->icons()->fromTheme("image-generic"),
|
||||||
tr("Load icon from file..."),
|
tr("Load icon from file..."),
|
||||||
this);
|
this);
|
||||||
m_actionNoIcon = new QAction(IconFactory::instance()->fromTheme("dialog-cancel"),
|
m_actionNoIcon = new QAction(qApp->icons()->fromTheme("dialog-cancel"),
|
||||||
tr("Do not use icon"),
|
tr("Do not use icon"),
|
||||||
this);
|
this);
|
||||||
m_actionUseDefaultIcon = new QAction(IconFactory::instance()->fromTheme("folder-feed"),
|
m_actionUseDefaultIcon = new QAction(qApp->icons()->fromTheme("folder-feed"),
|
||||||
tr("Use default icon"),
|
tr("Use default icon"),
|
||||||
this);
|
this);
|
||||||
m_iconMenu->addAction(m_actionLoadIconFromFile);
|
m_iconMenu->addAction(m_actionLoadIconFromFile);
|
||||||
|
@ -240,7 +240,7 @@ void FormMain::onAboutToQuit() {
|
|||||||
m_ui->m_tabWidget->feedMessageViewer()->feedsView()->clearAllReadMessages();
|
m_ui->m_tabWidget->feedMessageViewer()->feedsView()->clearAllReadMessages();
|
||||||
}
|
}
|
||||||
|
|
||||||
DatabaseFactory::instance()->saveDatabase();
|
qApp->database()->saveDatabase();
|
||||||
saveSize();
|
saveSize();
|
||||||
|
|
||||||
if (locked_safely) {
|
if (locked_safely) {
|
||||||
@ -259,7 +259,7 @@ void FormMain::onAboutToQuit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FormMain::setupIcons() {
|
void FormMain::setupIcons() {
|
||||||
IconFactory *icon_theme_factory = IconFactory::instance();
|
IconFactory *icon_theme_factory = qApp->icons();
|
||||||
|
|
||||||
// Setup icons of this main window.
|
// Setup icons of this main window.
|
||||||
m_ui->m_actionSettings->setIcon(icon_theme_factory->fromTheme("application-settings"));
|
m_ui->m_actionSettings->setIcon(icon_theme_factory->fromTheme("application-settings"));
|
||||||
|
@ -52,7 +52,7 @@ FormSettings::FormSettings(QWidget *parent) : QDialog(parent), m_ui(new Ui::Form
|
|||||||
|
|
||||||
// Set flags and attributes.
|
// Set flags and attributes.
|
||||||
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowTitleHint);
|
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowTitleHint);
|
||||||
setWindowIcon(IconFactory::instance()->fromTheme("application-settings"));
|
setWindowIcon(qApp->icons()->fromTheme("application-settings"));
|
||||||
|
|
||||||
#if !defined(Q_OS_WIN)
|
#if !defined(Q_OS_WIN)
|
||||||
MessageBox::iconify(m_ui->m_buttonBox);
|
MessageBox::iconify(m_ui->m_buttonBox);
|
||||||
@ -442,7 +442,7 @@ void FormSettings::loadLanguage() {
|
|||||||
item->setText(2, language.m_version);
|
item->setText(2, language.m_version);
|
||||||
item->setText(3, language.m_author);
|
item->setText(3, language.m_author);
|
||||||
item->setText(4, language.m_email);
|
item->setText(4, language.m_email);
|
||||||
item->setIcon(0, IconFactory::instance()->fromTheme(FLAG_ICON_SUBFOLDER + QDir::separator() +
|
item->setIcon(0, qApp->icons()->fromTheme(FLAG_ICON_SUBFOLDER + QDir::separator() +
|
||||||
language.m_code));
|
language.m_code));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -560,11 +560,11 @@ void FormSettings::saveDataStorage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FormSettings::mysqlTestConnection() {
|
void FormSettings::mysqlTestConnection() {
|
||||||
DatabaseFactory::MySQLError error_code = DatabaseFactory::instance()->mysqlTestConnection(m_ui->m_txtMysqlHostname->lineEdit()->text(),
|
DatabaseFactory::MySQLError error_code = qApp->database()->mysqlTestConnection(m_ui->m_txtMysqlHostname->lineEdit()->text(),
|
||||||
m_ui->m_spinMysqlPort->value(),
|
m_ui->m_spinMysqlPort->value(),
|
||||||
m_ui->m_txtMysqlUsername->lineEdit()->text(),
|
m_ui->m_txtMysqlUsername->lineEdit()->text(),
|
||||||
m_ui->m_txtMysqlPassword->lineEdit()->text());
|
m_ui->m_txtMysqlPassword->lineEdit()->text());
|
||||||
QString interpretation = DatabaseFactory::instance()->mysqlInterpretErrorCode(error_code);
|
QString interpretation = qApp->database()->mysqlInterpretErrorCode(error_code);
|
||||||
|
|
||||||
switch (error_code) {
|
switch (error_code) {
|
||||||
case DatabaseFactory::MySQLOk:
|
case DatabaseFactory::MySQLOk:
|
||||||
@ -675,9 +675,9 @@ void FormSettings::loadInterface() {
|
|||||||
false).toBool());
|
false).toBool());
|
||||||
|
|
||||||
// Load settings of icon theme.
|
// Load settings of icon theme.
|
||||||
QString current_theme = IconFactory::instance()->currentIconTheme();
|
QString current_theme = qApp->icons()->currentIconTheme();
|
||||||
|
|
||||||
foreach (const QString &icon_theme_name, IconFactory::instance()->installedIconThemes()) {
|
foreach (const QString &icon_theme_name, qApp->icons()->installedIconThemes()) {
|
||||||
if (icon_theme_name == APP_NO_THEME) {
|
if (icon_theme_name == APP_NO_THEME) {
|
||||||
// Add just "no theme" on other systems.
|
// Add just "no theme" on other systems.
|
||||||
//: Label for disabling icon theme.
|
//: Label for disabling icon theme.
|
||||||
@ -792,8 +792,8 @@ void FormSettings::saveInterface() {
|
|||||||
|
|
||||||
// Save selected icon theme.
|
// Save selected icon theme.
|
||||||
QString selected_icon_theme = m_ui->m_cmbIconTheme->itemData(m_ui->m_cmbIconTheme->currentIndex()).toString();
|
QString selected_icon_theme = m_ui->m_cmbIconTheme->itemData(m_ui->m_cmbIconTheme->currentIndex()).toString();
|
||||||
QString original_icon_theme = IconFactory::instance()->currentIconTheme();
|
QString original_icon_theme = qApp->icons()->currentIconTheme();
|
||||||
IconFactory::instance()->setCurrentIconTheme(selected_icon_theme);
|
qApp->icons()->setCurrentIconTheme(selected_icon_theme);
|
||||||
|
|
||||||
// Check if icon theme was changed.
|
// Check if icon theme was changed.
|
||||||
if (selected_icon_theme != original_icon_theme) {
|
if (selected_icon_theme != original_icon_theme) {
|
||||||
|
@ -42,7 +42,7 @@ FormUpdate::FormUpdate(QWidget *parent)
|
|||||||
|
|
||||||
// Set flags and attributes.
|
// Set flags and attributes.
|
||||||
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowTitleHint);
|
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowTitleHint);
|
||||||
setWindowIcon(IconFactory::instance()->fromTheme("application-about"));
|
setWindowIcon(qApp->icons()->fromTheme("application-about"));
|
||||||
|
|
||||||
m_btnUpdate = m_ui->m_buttonBox->addButton(tr("Update"), QDialogButtonBox::ActionRole);
|
m_btnUpdate = m_ui->m_buttonBox->addButton(tr("Update"), QDialogButtonBox::ActionRole);
|
||||||
m_btnUpdate->setToolTip(tr("Download new installation files."));
|
m_btnUpdate->setToolTip(tr("Download new installation files."));
|
||||||
|
@ -52,22 +52,22 @@ void MessageBox::iconify(QDialogButtonBox *button_box) {
|
|||||||
QIcon MessageBox::iconForRole(QDialogButtonBox::StandardButton button) {
|
QIcon MessageBox::iconForRole(QDialogButtonBox::StandardButton button) {
|
||||||
switch (button) {
|
switch (button) {
|
||||||
case QMessageBox::Ok:
|
case QMessageBox::Ok:
|
||||||
return IconFactory::instance()->fromTheme("dialog-ok");
|
return qApp->icons()->fromTheme("dialog-ok");
|
||||||
|
|
||||||
case QMessageBox::Cancel:
|
case QMessageBox::Cancel:
|
||||||
case QMessageBox::Close:
|
case QMessageBox::Close:
|
||||||
return IconFactory::instance()->fromTheme("dialog-cancel");
|
return qApp->icons()->fromTheme("dialog-cancel");
|
||||||
|
|
||||||
case QMessageBox::Yes:
|
case QMessageBox::Yes:
|
||||||
case QMessageBox::YesToAll:
|
case QMessageBox::YesToAll:
|
||||||
return IconFactory::instance()->fromTheme("dialog-yes");
|
return qApp->icons()->fromTheme("dialog-yes");
|
||||||
|
|
||||||
case QMessageBox::No:
|
case QMessageBox::No:
|
||||||
case QMessageBox::NoToAll:
|
case QMessageBox::NoToAll:
|
||||||
return IconFactory::instance()->fromTheme("dialog-no");
|
return qApp->icons()->fromTheme("dialog-no");
|
||||||
|
|
||||||
case QMessageBox::Help:
|
case QMessageBox::Help:
|
||||||
return IconFactory::instance()->fromTheme("dialog-question");
|
return qApp->icons()->fromTheme("dialog-question");
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return QIcon();
|
return QIcon();
|
||||||
@ -77,16 +77,16 @@ QIcon MessageBox::iconForRole(QDialogButtonBox::StandardButton button) {
|
|||||||
QIcon MessageBox::iconForStatus(QMessageBox::Icon status) {
|
QIcon MessageBox::iconForStatus(QMessageBox::Icon status) {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case QMessageBox::Information:
|
case QMessageBox::Information:
|
||||||
return IconFactory::instance()->fromTheme("dialog-information");
|
return qApp->icons()->fromTheme("dialog-information");
|
||||||
|
|
||||||
case QMessageBox::Warning:
|
case QMessageBox::Warning:
|
||||||
return IconFactory::instance()->fromTheme("dialog-warning");
|
return qApp->icons()->fromTheme("dialog-warning");
|
||||||
|
|
||||||
case QMessageBox::Critical:
|
case QMessageBox::Critical:
|
||||||
return IconFactory::instance()->fromTheme("dialog-error");
|
return qApp->icons()->fromTheme("dialog-error");
|
||||||
|
|
||||||
case QMessageBox::Question:
|
case QMessageBox::Question:
|
||||||
return IconFactory::instance()->fromTheme("dialog-question");
|
return qApp->icons()->fromTheme("dialog-question");
|
||||||
|
|
||||||
case QMessageBox::NoIcon:
|
case QMessageBox::NoIcon:
|
||||||
default:
|
default:
|
||||||
|
@ -95,7 +95,7 @@ void MessagesToolBar::loadChangeableActions(const QStringList& actions) {
|
|||||||
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
|
|
||||||
QAction *action = addWidget(spacer);
|
QAction *action = addWidget(spacer);
|
||||||
action->setIcon(IconFactory::instance()->fromTheme("view-spacer"));
|
action->setIcon(qApp->icons()->fromTheme("view-spacer"));
|
||||||
action->setProperty("type", SPACER_ACTION_NAME);
|
action->setProperty("type", SPACER_ACTION_NAME);
|
||||||
action->setProperty("name", tr("Toolbar spacer"));
|
action->setProperty("name", tr("Toolbar spacer"));
|
||||||
}
|
}
|
||||||
@ -117,7 +117,7 @@ void MessagesToolBar::initializeSearchBox() {
|
|||||||
// Setup wrapping action for search box.
|
// Setup wrapping action for search box.
|
||||||
m_actionSearchMessages = new QWidgetAction(this);
|
m_actionSearchMessages = new QWidgetAction(this);
|
||||||
m_actionSearchMessages->setDefaultWidget(m_txtSearchMessages);
|
m_actionSearchMessages->setDefaultWidget(m_txtSearchMessages);
|
||||||
m_actionSearchMessages->setIcon(IconFactory::instance()->fromTheme("application-search"));
|
m_actionSearchMessages->setIcon(qApp->icons()->fromTheme("application-search"));
|
||||||
m_actionSearchMessages->setProperty("type", SEACRH_MESSAGES_ACTION_NAME);
|
m_actionSearchMessages->setProperty("type", SEACRH_MESSAGES_ACTION_NAME);
|
||||||
m_actionSearchMessages->setProperty("name", tr("Message search box"));
|
m_actionSearchMessages->setProperty("name", tr("Message search box"));
|
||||||
|
|
||||||
@ -127,18 +127,18 @@ void MessagesToolBar::initializeSearchBox() {
|
|||||||
|
|
||||||
void MessagesToolBar::initializeHighlighter() {
|
void MessagesToolBar::initializeHighlighter() {
|
||||||
m_menuMessageHighlighter = new QMenu(tr("Menu for highlighting messages"), this);
|
m_menuMessageHighlighter = new QMenu(tr("Menu for highlighting messages"), this);
|
||||||
m_menuMessageHighlighter->addAction(IconFactory::instance()->fromTheme("mail-mark-read"),
|
m_menuMessageHighlighter->addAction(qApp->icons()->fromTheme("mail-mark-read"),
|
||||||
tr("No extra highlighting"))->setData(QVariant::fromValue(MessagesModel::DisplayAll));
|
tr("No extra highlighting"))->setData(QVariant::fromValue(MessagesModel::DisplayAll));
|
||||||
m_menuMessageHighlighter->addAction(IconFactory::instance()->fromTheme("mail-mark-unread"),
|
m_menuMessageHighlighter->addAction(qApp->icons()->fromTheme("mail-mark-unread"),
|
||||||
tr("Highlight unread messages"))->setData(QVariant::fromValue(MessagesModel::DisplayUnread));
|
tr("Highlight unread messages"))->setData(QVariant::fromValue(MessagesModel::DisplayUnread));
|
||||||
m_menuMessageHighlighter->addAction(IconFactory::instance()->fromTheme("mail-mark-favorite"),
|
m_menuMessageHighlighter->addAction(qApp->icons()->fromTheme("mail-mark-favorite"),
|
||||||
tr("Highlight important messages"))->setData(QVariant::fromValue(MessagesModel::DisplayImportant));
|
tr("Highlight important messages"))->setData(QVariant::fromValue(MessagesModel::DisplayImportant));
|
||||||
|
|
||||||
m_btnMessageHighlighter = new QToolButton(this);
|
m_btnMessageHighlighter = new QToolButton(this);
|
||||||
m_btnMessageHighlighter->setToolTip(tr("Display all messages"));
|
m_btnMessageHighlighter->setToolTip(tr("Display all messages"));
|
||||||
m_btnMessageHighlighter->setMenu(m_menuMessageHighlighter);
|
m_btnMessageHighlighter->setMenu(m_menuMessageHighlighter);
|
||||||
m_btnMessageHighlighter->setPopupMode(QToolButton::MenuButtonPopup);
|
m_btnMessageHighlighter->setPopupMode(QToolButton::MenuButtonPopup);
|
||||||
m_btnMessageHighlighter->setIcon(IconFactory::instance()->fromTheme("mail-mark-read"));
|
m_btnMessageHighlighter->setIcon(qApp->icons()->fromTheme("mail-mark-read"));
|
||||||
|
|
||||||
m_actionMessageHighlighter = new QWidgetAction(this);
|
m_actionMessageHighlighter = new QWidgetAction(this);
|
||||||
m_actionMessageHighlighter->setDefaultWidget(m_btnMessageHighlighter);
|
m_actionMessageHighlighter->setDefaultWidget(m_btnMessageHighlighter);
|
||||||
|
2
src/gui/statusbar.cpp
Normal file → Executable file
2
src/gui/statusbar.cpp
Normal file → Executable file
@ -32,7 +32,7 @@ StatusBar::StatusBar(QWidget *parent) : QStatusBar(parent) {
|
|||||||
m_fullscreenSwitcher = new QToolButton(this);
|
m_fullscreenSwitcher = new QToolButton(this);
|
||||||
m_fullscreenSwitcher->setAutoRaise(true);
|
m_fullscreenSwitcher->setAutoRaise(true);
|
||||||
m_fullscreenSwitcher->setCheckable(true);
|
m_fullscreenSwitcher->setCheckable(true);
|
||||||
m_fullscreenSwitcher->setIcon(IconFactory::instance()->fromTheme("view-fullscreen"));
|
m_fullscreenSwitcher->setIcon(qApp->icons()->fromTheme("view-fullscreen"));
|
||||||
m_fullscreenSwitcher->setText(tr("Fullscreen mode"));
|
m_fullscreenSwitcher->setText(tr("Fullscreen mode"));
|
||||||
m_fullscreenSwitcher->setToolTip(tr("Switch application between fulscreen/normal states right from this status bar icon."));
|
m_fullscreenSwitcher->setToolTip(tr("Switch application between fulscreen/normal states right from this status bar icon."));
|
||||||
|
|
||||||
|
2
src/gui/tabbar.cpp
Normal file → Executable file
2
src/gui/tabbar.cpp
Normal file → Executable file
@ -40,7 +40,7 @@ void TabBar::setTabType(int index, const TabBar::TabType &type) {
|
|||||||
case TabBar::Closable: {
|
case TabBar::Closable: {
|
||||||
PlainToolButton *close_button = new PlainToolButton(this);
|
PlainToolButton *close_button = new PlainToolButton(this);
|
||||||
|
|
||||||
close_button->setIcon(IconFactory::instance()->fromTheme("application-exit"));
|
close_button->setIcon(qApp->icons()->fromTheme("application-exit"));
|
||||||
close_button->setToolTip(tr("Close this tab."));
|
close_button->setToolTip(tr("Close this tab."));
|
||||||
close_button->setText(tr("Close tab"));
|
close_button->setText(tr("Close tab"));
|
||||||
close_button->setFixedSize(iconSize());
|
close_button->setFixedSize(iconSize());
|
||||||
|
@ -48,7 +48,7 @@ void TabWidget::setupCornerButton() {
|
|||||||
m_btnAddTab->setAutoRaise(true);
|
m_btnAddTab->setAutoRaise(true);
|
||||||
m_btnAddTab->setPadding(3);
|
m_btnAddTab->setPadding(3);
|
||||||
m_btnAddTab->setToolTip(tr("Open new web browser tab."));
|
m_btnAddTab->setToolTip(tr("Open new web browser tab."));
|
||||||
m_btnAddTab->setIcon(IconFactory::instance()->fromTheme("list-add"));
|
m_btnAddTab->setIcon(qApp->icons()->fromTheme("list-add"));
|
||||||
|
|
||||||
connect(m_btnAddTab, SIGNAL(clicked()), this, SLOT(addEmptyBrowser()));
|
connect(m_btnAddTab, SIGNAL(clicked()), this, SLOT(addEmptyBrowser()));
|
||||||
}
|
}
|
||||||
@ -58,7 +58,7 @@ void TabWidget::setupMainMenuButton() {
|
|||||||
m_btnMainMenu->setAutoRaise(true);
|
m_btnMainMenu->setAutoRaise(true);
|
||||||
m_btnMainMenu->setPadding(3);
|
m_btnMainMenu->setPadding(3);
|
||||||
m_btnMainMenu->setToolTip(tr("Displays main menu."));
|
m_btnMainMenu->setToolTip(tr("Displays main menu."));
|
||||||
m_btnMainMenu->setIcon(IconFactory::instance()->fromTheme("application-menu"));
|
m_btnMainMenu->setIcon(qApp->icons()->fromTheme("application-menu"));
|
||||||
m_btnMainMenu->setPopupMode(QToolButton::InstantPopup);
|
m_btnMainMenu->setPopupMode(QToolButton::InstantPopup);
|
||||||
|
|
||||||
connect(m_btnMainMenu, SIGNAL(clicked()), this, SLOT(openMainMenu()));
|
connect(m_btnMainMenu, SIGNAL(clicked()), this, SLOT(openMainMenu()));
|
||||||
@ -154,7 +154,7 @@ void TabWidget::setupIcons() {
|
|||||||
for (int index = 0; index < count(); index++) {
|
for (int index = 0; index < count(); index++) {
|
||||||
// Index 0 usually contains widget which displays feeds & messages.
|
// Index 0 usually contains widget which displays feeds & messages.
|
||||||
if (tabBar()->tabType(index) == TabBar::FeedReader) {
|
if (tabBar()->tabType(index) == TabBar::FeedReader) {
|
||||||
setTabIcon(index, IconFactory::instance()->fromTheme("folder-feed"));
|
setTabIcon(index, qApp->icons()->fromTheme("folder-feed"));
|
||||||
}
|
}
|
||||||
// Other indexes probably contain WebBrowsers.
|
// Other indexes probably contain WebBrowsers.
|
||||||
else {
|
else {
|
||||||
@ -162,13 +162,13 @@ void TabWidget::setupIcons() {
|
|||||||
if (active_browser != NULL && active_browser->icon().isNull()) {
|
if (active_browser != NULL && active_browser->icon().isNull()) {
|
||||||
// We found WebBrowser instance of this tab page, which
|
// We found WebBrowser instance of this tab page, which
|
||||||
// has no suitable icon, load a new one from the icon theme.
|
// has no suitable icon, load a new one from the icon theme.
|
||||||
setTabIcon(index, IconFactory::instance()->fromTheme("text-html"));
|
setTabIcon(index, qApp->icons()->fromTheme("text-html"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup corner button icon.
|
// Setup corner button icon.
|
||||||
m_btnAddTab->setIcon(IconFactory::instance()->fromTheme("list-add"));
|
m_btnAddTab->setIcon(qApp->icons()->fromTheme("list-add"));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TabWidget::closeTab(int index) {
|
bool TabWidget::closeTab(int index) {
|
||||||
@ -292,14 +292,14 @@ int TabWidget::addBrowser(bool move_after_current,
|
|||||||
// Insert web browser after current tab.
|
// Insert web browser after current tab.
|
||||||
final_index = insertTab(currentIndex() + 1,
|
final_index = insertTab(currentIndex() + 1,
|
||||||
browser,
|
browser,
|
||||||
IconFactory::instance()->fromTheme("text-html"),
|
qApp->icons()->fromTheme("text-html"),
|
||||||
tr("Web browser"),
|
tr("Web browser"),
|
||||||
TabBar::Closable);
|
TabBar::Closable);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Add new browser as the last tab.
|
// Add new browser as the last tab.
|
||||||
final_index = addTab(browser,
|
final_index = addTab(browser,
|
||||||
IconFactory::instance()->fromTheme("text-html"),
|
qApp->icons()->fromTheme("text-html"),
|
||||||
//: Web browser default tab title.
|
//: Web browser default tab title.
|
||||||
tr("Web browser"),
|
tr("Web browser"),
|
||||||
TabBar::Closable);
|
TabBar::Closable);
|
||||||
|
8
src/gui/toolbareditor.cpp
Normal file → Executable file
8
src/gui/toolbareditor.cpp
Normal file → Executable file
@ -47,7 +47,7 @@ void ToolBarEditor::loadFromToolBar(BaseToolBar* tool_bar) {
|
|||||||
|
|
||||||
if (action->isSeparator()) {
|
if (action->isSeparator()) {
|
||||||
action_item->setData(Qt::UserRole, SEPARATOR_ACTION_NAME);
|
action_item->setData(Qt::UserRole, SEPARATOR_ACTION_NAME);
|
||||||
action_item->setIcon(IconFactory::instance()->fromTheme("view-separator"));
|
action_item->setIcon(qApp->icons()->fromTheme("view-separator"));
|
||||||
action_item->setText(tr("Separator"));
|
action_item->setText(tr("Separator"));
|
||||||
action_item->setToolTip(tr("Separator"));
|
action_item->setToolTip(tr("Separator"));
|
||||||
}
|
}
|
||||||
@ -72,7 +72,7 @@ void ToolBarEditor::loadFromToolBar(BaseToolBar* tool_bar) {
|
|||||||
action_item->setData(Qt::UserRole, SEPARATOR_ACTION_NAME);
|
action_item->setData(Qt::UserRole, SEPARATOR_ACTION_NAME);
|
||||||
action_item->setText(tr("Separator"));
|
action_item->setText(tr("Separator"));
|
||||||
action_item->setToolTip(tr("Separator"));
|
action_item->setToolTip(tr("Separator"));
|
||||||
action_item->setIcon(IconFactory::instance()->fromTheme("view-separator"));
|
action_item->setIcon(qApp->icons()->fromTheme("view-separator"));
|
||||||
}
|
}
|
||||||
else if (action->property("type").isValid()) {
|
else if (action->property("type").isValid()) {
|
||||||
action_item->setData(Qt::UserRole, action->property("type").toString());
|
action_item->setData(Qt::UserRole, action->property("type").toString());
|
||||||
@ -101,7 +101,7 @@ void ToolBarEditor::insertSpacer() {
|
|||||||
int current_row = m_ui->m_listActivatedActions->currentRow();
|
int current_row = m_ui->m_listActivatedActions->currentRow();
|
||||||
|
|
||||||
QListWidgetItem *item = new QListWidgetItem(tr("Toolbar spacer"));
|
QListWidgetItem *item = new QListWidgetItem(tr("Toolbar spacer"));
|
||||||
item->setIcon(IconFactory::instance()->fromTheme("view-spacer"));
|
item->setIcon(qApp->icons()->fromTheme("view-spacer"));
|
||||||
item->setData(Qt::UserRole, SPACER_ACTION_NAME);
|
item->setData(Qt::UserRole, SPACER_ACTION_NAME);
|
||||||
|
|
||||||
if (current_row >= 0) {
|
if (current_row >= 0) {
|
||||||
@ -118,7 +118,7 @@ void ToolBarEditor::insertSeparator() {
|
|||||||
QListWidgetItem *item = new QListWidgetItem(tr("Separator"));
|
QListWidgetItem *item = new QListWidgetItem(tr("Separator"));
|
||||||
item->setData(Qt::UserRole, SEPARATOR_ACTION_NAME);
|
item->setData(Qt::UserRole, SEPARATOR_ACTION_NAME);
|
||||||
item->setToolTip(tr("Separator"));
|
item->setToolTip(tr("Separator"));
|
||||||
item->setIcon(IconFactory::instance()->fromTheme("view-separator"));
|
item->setIcon(qApp->icons()->fromTheme("view-separator"));
|
||||||
|
|
||||||
if (current_row >= 0) {
|
if (current_row >= 0) {
|
||||||
m_ui->m_listActivatedActions->insertItem(current_row + 1, item);
|
m_ui->m_listActivatedActions->insertItem(current_row + 1, item);
|
||||||
|
8
src/gui/widgetwithstatus.cpp
Normal file → Executable file
8
src/gui/widgetwithstatus.cpp
Normal file → Executable file
@ -29,10 +29,10 @@ WidgetWithStatus::WidgetWithStatus(QWidget *parent)
|
|||||||
m_btnStatus = new PlainToolButton(this);
|
m_btnStatus = new PlainToolButton(this);
|
||||||
m_btnStatus->setFocusPolicy(Qt::NoFocus);
|
m_btnStatus->setFocusPolicy(Qt::NoFocus);
|
||||||
|
|
||||||
m_iconInformation = IconFactory::instance()->fromTheme("dialog-information");
|
m_iconInformation = qApp->icons()->fromTheme("dialog-information");
|
||||||
m_iconWarning = IconFactory::instance()->fromTheme("dialog-warning");
|
m_iconWarning = qApp->icons()->fromTheme("dialog-warning");
|
||||||
m_iconError = IconFactory::instance()->fromTheme("dialog-error");
|
m_iconError = qApp->icons()->fromTheme("dialog-error");
|
||||||
m_iconOk = IconFactory::instance()->fromTheme("dialog-yes");
|
m_iconOk = qApp->icons()->fromTheme("dialog-yes");
|
||||||
|
|
||||||
// Set layout properties.
|
// Set layout properties.
|
||||||
m_layout->setMargin(0);
|
m_layout->setMargin(0);
|
||||||
|
@ -73,8 +73,8 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
// Add an extra path for non-system icon themes and set current icon theme
|
// Add an extra path for non-system icon themes and set current icon theme
|
||||||
// and skin.
|
// and skin.
|
||||||
IconFactory::instance()->setupSearchPaths();
|
qApp->icons()->setupSearchPaths();
|
||||||
IconFactory::instance()->loadCurrentIconTheme();
|
qApp->icons()->loadCurrentIconTheme();
|
||||||
qApp->skins()->loadCurrentSkin();
|
qApp->skins()->loadCurrentSkin();
|
||||||
|
|
||||||
// Load localization and setup locale before any widget is constructed.
|
// Load localization and setup locale before any widget is constructed.
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
#include "miscellaneous/application.h"
|
#include "miscellaneous/application.h"
|
||||||
|
|
||||||
#include "miscellaneous/systemfactory.h"
|
#include "miscellaneous/iconfactory.h"
|
||||||
#include "gui/feedsview.h"
|
#include "gui/feedsview.h"
|
||||||
#include "gui/feedmessageviewer.h"
|
#include "gui/feedmessageviewer.h"
|
||||||
#include "gui/messagebox.h"
|
#include "gui/messagebox.h"
|
||||||
@ -30,7 +30,7 @@ Application::Application(const QString &id, int &argc, char **argv)
|
|||||||
: QtSingleApplication(id, argc, argv),
|
: QtSingleApplication(id, argc, argv),
|
||||||
m_closeLock(NULL), m_userActions(QList<QAction*>()), m_mainForm(NULL),
|
m_closeLock(NULL), m_userActions(QList<QAction*>()), m_mainForm(NULL),
|
||||||
m_trayIcon(NULL), m_settings(NULL), m_system(NULL), m_skins(NULL),
|
m_trayIcon(NULL), m_settings(NULL), m_system(NULL), m_skins(NULL),
|
||||||
m_localization(NULL) {
|
m_localization(NULL), m_icons(NULL), m_database(NULL) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Application::~Application() {
|
Application::~Application() {
|
||||||
@ -45,6 +45,14 @@ QList<QAction*> Application::userActions() {
|
|||||||
return m_userActions;
|
return m_userActions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IconFactory *Application::icons() {
|
||||||
|
if (m_icons == NULL) {
|
||||||
|
m_icons = new IconFactory(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_icons;
|
||||||
|
}
|
||||||
|
|
||||||
SystemTrayIcon *Application::trayIcon() {
|
SystemTrayIcon *Application::trayIcon() {
|
||||||
if (m_trayIcon == NULL) {
|
if (m_trayIcon == NULL) {
|
||||||
m_trayIcon = new SystemTrayIcon(APP_ICON_PATH, APP_ICON_PLAIN_PATH, m_mainForm);
|
m_trayIcon = new SystemTrayIcon(APP_ICON_PATH, APP_ICON_PLAIN_PATH, m_mainForm);
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "miscellaneous/systemfactory.h"
|
#include "miscellaneous/systemfactory.h"
|
||||||
#include "miscellaneous/skinfactory.h"
|
#include "miscellaneous/skinfactory.h"
|
||||||
#include "miscellaneous/localization.h"
|
#include "miscellaneous/localization.h"
|
||||||
|
#include "miscellaneous/databasefactory.h"
|
||||||
#include "gui/systemtrayicon.h"
|
#include "gui/systemtrayicon.h"
|
||||||
|
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
@ -39,6 +40,7 @@
|
|||||||
|
|
||||||
|
|
||||||
class FormMain;
|
class FormMain;
|
||||||
|
class IconFactory;
|
||||||
class QAction;
|
class QAction;
|
||||||
|
|
||||||
// TODO: presunout nektery veci sem, settings atp
|
// TODO: presunout nektery veci sem, settings atp
|
||||||
@ -76,6 +78,16 @@ class Application : public QtSingleApplication {
|
|||||||
return m_localization;
|
return m_localization;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline DatabaseFactory *database() {
|
||||||
|
if (m_database == NULL) {
|
||||||
|
m_database = new DatabaseFactory(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_database;
|
||||||
|
}
|
||||||
|
|
||||||
|
IconFactory *icons();
|
||||||
|
|
||||||
inline Settings *settings() {
|
inline Settings *settings() {
|
||||||
if (m_settings == NULL) {
|
if (m_settings == NULL) {
|
||||||
m_settings = Settings::setupSettings(this);
|
m_settings = Settings::setupSettings(this);
|
||||||
@ -139,6 +151,8 @@ class Application : public QtSingleApplication {
|
|||||||
SystemFactory *m_system;
|
SystemFactory *m_system;
|
||||||
SkinFactory *m_skins;
|
SkinFactory *m_skins;
|
||||||
Localization *m_localization;
|
Localization *m_localization;
|
||||||
|
IconFactory *m_icons;
|
||||||
|
DatabaseFactory *m_database;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // APPLICATION_H
|
#endif // APPLICATION_H
|
||||||
|
@ -17,8 +17,6 @@
|
|||||||
|
|
||||||
#include "miscellaneous/databasefactory.h"
|
#include "miscellaneous/databasefactory.h"
|
||||||
|
|
||||||
#include "definitions/definitions.h"
|
|
||||||
#include "miscellaneous/settings.h"
|
|
||||||
#include "miscellaneous/application.h"
|
#include "miscellaneous/application.h"
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
@ -27,8 +25,6 @@
|
|||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
|
||||||
|
|
||||||
QPointer<DatabaseFactory> DatabaseFactory::s_instance;
|
|
||||||
|
|
||||||
DatabaseFactory::DatabaseFactory(QObject *parent)
|
DatabaseFactory::DatabaseFactory(QObject *parent)
|
||||||
: QObject(parent),
|
: QObject(parent),
|
||||||
m_mysqlDatabaseInitialized(false),
|
m_mysqlDatabaseInitialized(false),
|
||||||
@ -42,18 +38,9 @@ DatabaseFactory::~DatabaseFactory() {
|
|||||||
qDebug("Destroying DatabaseFactory object.");
|
qDebug("Destroying DatabaseFactory object.");
|
||||||
}
|
}
|
||||||
|
|
||||||
DatabaseFactory *DatabaseFactory::instance() {
|
|
||||||
if (s_instance.isNull()) {
|
|
||||||
s_instance = new DatabaseFactory(qApp);
|
|
||||||
}
|
|
||||||
|
|
||||||
return s_instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
DatabaseFactory::MySQLError DatabaseFactory::mysqlTestConnection(const QString &hostname, int port,
|
DatabaseFactory::MySQLError DatabaseFactory::mysqlTestConnection(const QString &hostname, int port,
|
||||||
const QString &username, const QString &password) {
|
const QString &username, const QString &password) {
|
||||||
QSqlDatabase database = QSqlDatabase::addDatabase(APP_DB_MYSQL_DRIVER,
|
QSqlDatabase database = QSqlDatabase::addDatabase(APP_DB_MYSQL_DRIVER, APP_DB_MYSQL_TEST);
|
||||||
APP_DB_MYSQL_TEST);
|
|
||||||
|
|
||||||
database.setHostName(hostname);
|
database.setHostName(hostname);
|
||||||
database.setPort(port);
|
database.setPort(port);
|
||||||
@ -565,6 +552,7 @@ bool DatabaseFactory::vacuumDatabase() {
|
|||||||
return sqliteVacuumDatabase();
|
return sqliteVacuumDatabase();
|
||||||
|
|
||||||
case MYSQL:
|
case MYSQL:
|
||||||
|
case POSTGRESQL:
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
19
src/miscellaneous/databasefactory.h
Normal file → Executable file
19
src/miscellaneous/databasefactory.h
Normal file → Executable file
@ -19,7 +19,6 @@
|
|||||||
#define DATABASEFACTORY_H
|
#define DATABASEFACTORY_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QPointer>
|
|
||||||
#include <QSqlDatabase>
|
#include <QSqlDatabase>
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +30,8 @@ class DatabaseFactory : public QObject {
|
|||||||
enum UsedDriver {
|
enum UsedDriver {
|
||||||
SQLITE,
|
SQLITE,
|
||||||
SQLITE_MEMORY,
|
SQLITE_MEMORY,
|
||||||
MYSQL
|
MYSQL,
|
||||||
|
POSTGRESQL
|
||||||
};
|
};
|
||||||
|
|
||||||
// Describes what type of database user wants.
|
// Describes what type of database user wants.
|
||||||
@ -54,14 +54,16 @@ class DatabaseFactory : public QObject {
|
|||||||
// GENERAL stuff.
|
// GENERAL stuff.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
// Constructor.
|
||||||
|
explicit DatabaseFactory(QObject *parent = 0);
|
||||||
|
|
||||||
// Destructor.
|
// Destructor.
|
||||||
virtual ~DatabaseFactory();
|
virtual ~DatabaseFactory();
|
||||||
|
|
||||||
// If in-memory is true, then :memory: database is returned
|
// If in-memory is true, then :memory: database is returned
|
||||||
// In-memory database is DEFAULT database.
|
// In-memory database is DEFAULT database.
|
||||||
// NOTE: This always returns OPENED database.
|
// NOTE: This always returns OPENED database.
|
||||||
QSqlDatabase connection(const QString &connection_name,
|
QSqlDatabase connection(const QString &connection_name, DesiredType desired_type);
|
||||||
DesiredType desired_type);
|
|
||||||
|
|
||||||
// Removes connection.
|
// Removes connection.
|
||||||
void removeConnection(const QString &connection_name = QString());
|
void removeConnection(const QString &connection_name = QString());
|
||||||
@ -73,9 +75,6 @@ class DatabaseFactory : public QObject {
|
|||||||
// Performs cleanup of the database.
|
// Performs cleanup of the database.
|
||||||
bool vacuumDatabase();
|
bool vacuumDatabase();
|
||||||
|
|
||||||
// Singleton getter.
|
|
||||||
static DatabaseFactory *instance();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// MySQL stuff.
|
// MySQL stuff.
|
||||||
//
|
//
|
||||||
@ -93,16 +92,10 @@ class DatabaseFactory : public QObject {
|
|||||||
// GENERAL stuff.
|
// GENERAL stuff.
|
||||||
//
|
//
|
||||||
|
|
||||||
// Constructor.
|
|
||||||
explicit DatabaseFactory(QObject *parent = 0);
|
|
||||||
|
|
||||||
// Decides which database backend will be used in this
|
// Decides which database backend will be used in this
|
||||||
// application session.
|
// application session.
|
||||||
void determineDriver();
|
void determineDriver();
|
||||||
|
|
||||||
// Private singleton value.
|
|
||||||
static QPointer<DatabaseFactory> s_instance;
|
|
||||||
|
|
||||||
// Holds the type of currently activated database backend.
|
// Holds the type of currently activated database backend.
|
||||||
UsedDriver m_activeDatabaseDriver;
|
UsedDriver m_activeDatabaseDriver;
|
||||||
|
|
||||||
|
26
src/miscellaneous/iconfactory.cpp
Normal file → Executable file
26
src/miscellaneous/iconfactory.cpp
Normal file → Executable file
@ -22,8 +22,6 @@
|
|||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
|
|
||||||
|
|
||||||
QPointer<IconFactory> IconFactory::s_instance;
|
|
||||||
|
|
||||||
IconFactory::IconFactory(QObject *parent) : QObject(parent) {
|
IconFactory::IconFactory(QObject *parent) : QObject(parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,14 +55,6 @@ QByteArray IconFactory::toByteArray(const QIcon &icon) {
|
|||||||
return array.toBase64();
|
return array.toBase64();
|
||||||
}
|
}
|
||||||
|
|
||||||
IconFactory *IconFactory::instance() {
|
|
||||||
if (s_instance.isNull()) {
|
|
||||||
s_instance = new IconFactory(qApp);
|
|
||||||
}
|
|
||||||
|
|
||||||
return s_instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
void IconFactory::setupSearchPaths() {
|
void IconFactory::setupSearchPaths() {
|
||||||
QIcon::setThemeSearchPaths(QStringList() << APP_THEME_PATH);
|
QIcon::setThemeSearchPaths(QStringList() << APP_THEME_PATH);
|
||||||
qDebug("Available icon theme paths: %s.",
|
qDebug("Available icon theme paths: %s.",
|
||||||
@ -74,9 +64,7 @@ void IconFactory::setupSearchPaths() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void IconFactory::setCurrentIconTheme(const QString &theme_name) {
|
void IconFactory::setCurrentIconTheme(const QString &theme_name) {
|
||||||
qApp->settings()->setValue(APP_CFG_GUI,
|
qApp->settings()->setValue(APP_CFG_GUI, "icon_theme", theme_name);
|
||||||
"icon_theme",
|
|
||||||
theme_name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IconFactory::loadCurrentIconTheme() {
|
void IconFactory::loadCurrentIconTheme() {
|
||||||
@ -86,15 +74,13 @@ void IconFactory::loadCurrentIconTheme() {
|
|||||||
APP_THEME_DEFAULT).toString();
|
APP_THEME_DEFAULT).toString();
|
||||||
|
|
||||||
if (m_currentIconTheme == theme_name_from_settings) {
|
if (m_currentIconTheme == theme_name_from_settings) {
|
||||||
qDebug("Icon theme '%s' already loaded.",
|
qDebug("Icon theme '%s' already loaded.", qPrintable(theme_name_from_settings));
|
||||||
qPrintable(theme_name_from_settings));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display list of installed themes.
|
// Display list of installed themes.
|
||||||
qDebug("Installed icon themes are: %s.",
|
qDebug("Installed icon themes are: %s.",
|
||||||
qPrintable(QStringList(installed_themes).replaceInStrings(QRegExp("^|$"),
|
qPrintable(QStringList(installed_themes).replaceInStrings(QRegExp("^|$"), "\'").join(", ")));
|
||||||
"\'").join(", ")));
|
|
||||||
|
|
||||||
if (installed_themes.contains(theme_name_from_settings)) {
|
if (installed_themes.contains(theme_name_from_settings)) {
|
||||||
// Desired icon theme is installed and can be loaded.
|
// Desired icon theme is installed and can be loaded.
|
||||||
@ -104,16 +90,14 @@ void IconFactory::loadCurrentIconTheme() {
|
|||||||
else {
|
else {
|
||||||
// Desired icon theme is not currently available.
|
// Desired icon theme is not currently available.
|
||||||
// Install "default" icon theme instead.
|
// Install "default" icon theme instead.
|
||||||
qDebug("Icon theme '%s' cannot be loaded because it is not installed. "
|
qDebug("Icon theme '%s' cannot be loaded because it is not installed. No icon theme is loaded now.",
|
||||||
"No icon theme is loaded now.",
|
|
||||||
qPrintable(theme_name_from_settings));
|
qPrintable(theme_name_from_settings));
|
||||||
m_currentIconTheme = APP_NO_THEME;
|
m_currentIconTheme = APP_NO_THEME;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList IconFactory::installedIconThemes() const {
|
QStringList IconFactory::installedIconThemes() const {
|
||||||
QStringList icon_theme_names;
|
QStringList icon_theme_names; icon_theme_names << APP_NO_THEME;
|
||||||
icon_theme_names << APP_NO_THEME;
|
|
||||||
|
|
||||||
// Iterate all directories with icon themes.
|
// Iterate all directories with icon themes.
|
||||||
QStringList icon_themes_paths = QIcon::themeSearchPaths();
|
QStringList icon_themes_paths = QIcon::themeSearchPaths();
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QPointer>
|
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
@ -34,6 +33,9 @@ class IconFactory : public QObject {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
// Constructor.
|
||||||
|
explicit IconFactory(QObject *parent = 0);
|
||||||
|
|
||||||
// Destructor.
|
// Destructor.
|
||||||
virtual ~IconFactory();
|
virtual ~IconFactory();
|
||||||
|
|
||||||
@ -82,14 +84,8 @@ class IconFactory : public QObject {
|
|||||||
static IconFactory *instance();
|
static IconFactory *instance();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Constructor.
|
|
||||||
explicit IconFactory(QObject *parent = 0);
|
|
||||||
|
|
||||||
QHash<QString, QIcon> m_cachedIcons;
|
QHash<QString, QIcon> m_cachedIcons;
|
||||||
QString m_currentIconTheme;
|
QString m_currentIconTheme;
|
||||||
|
|
||||||
// Singleton.
|
|
||||||
static QPointer<IconFactory> s_instance;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ICONFACTORY_H
|
#endif // ICONFACTORY_H
|
||||||
|
@ -26,8 +26,11 @@ class IOFactory {
|
|||||||
IOFactory();
|
IOFactory();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
// Copy whole directory recursively.
|
||||||
|
// Destination path is created if it does not exist.
|
||||||
static bool copyDirectory(QString source, QString destination);
|
static bool copyDirectory(QString source, QString destination);
|
||||||
|
|
||||||
|
// Removes directory recursively and skips given folders/files.
|
||||||
static bool removeDirectory(const QString &directory_name,
|
static bool removeDirectory(const QString &directory_name,
|
||||||
const QStringList &exception_file_list = QStringList(),
|
const QStringList &exception_file_list = QStringList(),
|
||||||
const QStringList &exception_folder_list = QStringList());
|
const QStringList &exception_folder_list = QStringList());
|
||||||
|
@ -238,7 +238,7 @@ void WebBrowser::navigateToMessages(const QList<Message> &messages) {
|
|||||||
|
|
||||||
m_webView->setHtml(layout_wrapper, QUrl(INTERNAL_URL_NEWSPAPER));
|
m_webView->setHtml(layout_wrapper, QUrl(INTERNAL_URL_NEWSPAPER));
|
||||||
emit iconChanged(m_index,
|
emit iconChanged(m_index,
|
||||||
IconFactory::instance()->fromTheme("item-newspaper"));
|
qApp->icons()->fromTheme("item-newspaper"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebBrowser::updateZoomGui() {
|
void WebBrowser::updateZoomGui() {
|
||||||
@ -283,9 +283,9 @@ WebBrowser::~WebBrowser() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void WebBrowser::setupIcons() {
|
void WebBrowser::setupIcons() {
|
||||||
m_actionBack->setIcon(IconFactory::instance()->fromTheme("go-previous"));
|
m_actionBack->setIcon(qApp->icons()->fromTheme("go-previous"));
|
||||||
m_actionForward->setIcon(IconFactory::instance()->fromTheme("go-next"));
|
m_actionForward->setIcon(qApp->icons()->fromTheme("go-next"));
|
||||||
m_actionReload->setIcon(IconFactory::instance()->fromTheme("go-refresh"));
|
m_actionReload->setIcon(qApp->icons()->fromTheme("go-refresh"));
|
||||||
m_actionStop->setIcon(IconFactory::instance()->fromTheme("go-stop"));
|
m_actionStop->setIcon(qApp->icons()->fromTheme("go-stop"));
|
||||||
m_webView->setupIcons();
|
m_webView->setupIcons();
|
||||||
}
|
}
|
||||||
|
@ -75,18 +75,18 @@ void WebView::createConnections() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void WebView::setupIcons() {
|
void WebView::setupIcons() {
|
||||||
m_actionReload->setIcon(IconFactory::instance()->fromTheme("go-refresh"));
|
m_actionReload->setIcon(qApp->icons()->fromTheme("go-refresh"));
|
||||||
m_actionCopySelectedItem->setIcon(IconFactory::instance()->fromTheme("edit-copy"));
|
m_actionCopySelectedItem->setIcon(qApp->icons()->fromTheme("edit-copy"));
|
||||||
m_actionCopyLink->setIcon(IconFactory::instance()->fromTheme("edit-copy"));
|
m_actionCopyLink->setIcon(qApp->icons()->fromTheme("edit-copy"));
|
||||||
m_actionCopyImage->setIcon(IconFactory::instance()->fromTheme("edit-copy-image"));
|
m_actionCopyImage->setIcon(qApp->icons()->fromTheme("edit-copy-image"));
|
||||||
|
|
||||||
#if QT_VERSION >= 0x040800
|
#if QT_VERSION >= 0x040800
|
||||||
m_actionCopyImageUrl->setIcon(IconFactory::instance()->fromTheme("edit-copy"));
|
m_actionCopyImageUrl->setIcon(qApp->icons()->fromTheme("edit-copy"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_actionOpenLinkThisTab->setIcon(IconFactory::instance()->fromTheme("text-html"));
|
m_actionOpenLinkThisTab->setIcon(qApp->icons()->fromTheme("text-html"));
|
||||||
m_actionOpenLinkNewTab->setIcon(IconFactory::instance()->fromTheme("text-html"));
|
m_actionOpenLinkNewTab->setIcon(qApp->icons()->fromTheme("text-html"));
|
||||||
m_actionOpenImageNewTab->setIcon(IconFactory::instance()->fromTheme("edit-copy-image"));
|
m_actionOpenImageNewTab->setIcon(qApp->icons()->fromTheme("edit-copy-image"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebView::initializeActions() {
|
void WebView::initializeActions() {
|
||||||
@ -161,8 +161,8 @@ void WebView::popupContextMenu(const QPoint &pos) {
|
|||||||
QMenu link_submenu(tr("Hyperlink"), this);
|
QMenu link_submenu(tr("Hyperlink"), this);
|
||||||
QWebHitTestResult hit_result = page()->mainFrame()->hitTestContent(pos);
|
QWebHitTestResult hit_result = page()->mainFrame()->hitTestContent(pos);
|
||||||
|
|
||||||
image_submenu.setIcon(IconFactory::instance()->fromTheme("image-generic"));
|
image_submenu.setIcon(qApp->icons()->fromTheme("image-generic"));
|
||||||
link_submenu.setIcon(IconFactory::instance()->fromTheme("text-html"));
|
link_submenu.setIcon(qApp->icons()->fromTheme("text-html"));
|
||||||
|
|
||||||
// Assemble the menu from actions.
|
// Assemble the menu from actions.
|
||||||
context_menu.addAction(m_actionReload);
|
context_menu.addAction(m_actionReload);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user