Refactoring...
This commit is contained in:
parent
a3e189671c
commit
2943816804
@ -19,7 +19,7 @@ void BaseNetworkAccessManager::loadSettings() {
|
||||
qDebug("Settings of BaseNetworkAccessManager changed.");
|
||||
|
||||
QNetworkProxy new_proxy;
|
||||
QNetworkProxy::ProxyType selected_proxy_type = static_cast<QNetworkProxy::ProxyType>(Settings::getInstance()->value(APP_CFG_PROXY,
|
||||
QNetworkProxy::ProxyType selected_proxy_type = static_cast<QNetworkProxy::ProxyType>(Settings::instance()->value(APP_CFG_PROXY,
|
||||
"proxy_type",
|
||||
QNetworkProxy::NoProxy).toInt());
|
||||
|
||||
@ -29,7 +29,7 @@ void BaseNetworkAccessManager::loadSettings() {
|
||||
return;
|
||||
}
|
||||
|
||||
Settings *settings = Settings::getInstance();
|
||||
Settings *settings = Settings::instance();
|
||||
|
||||
// Custom proxy is selected, set it up.
|
||||
new_proxy.setType(selected_proxy_type);
|
||||
|
@ -30,7 +30,7 @@ DatabaseFactory *DatabaseFactory::instance() {
|
||||
}
|
||||
|
||||
void DatabaseFactory::assemblyDatabaseFilePath() {
|
||||
if (Settings::getInstance()->type() == Settings::Portable) {
|
||||
if (Settings::instance()->type() == Settings::Portable) {
|
||||
m_databasePath = qApp->applicationDirPath() +
|
||||
QDir::separator() +
|
||||
QString(APP_DB_PATH);
|
||||
|
@ -10,7 +10,7 @@ DynamicShortcuts::DynamicShortcuts() {
|
||||
}
|
||||
|
||||
void DynamicShortcuts::save(const QList<QAction *> actions) {
|
||||
Settings *settings = Settings::getInstance();
|
||||
Settings *settings = Settings::instance();
|
||||
|
||||
foreach (QAction *action, actions) {
|
||||
settings->setValue(APP_CFG_CUTS,
|
||||
@ -20,7 +20,7 @@ void DynamicShortcuts::save(const QList<QAction *> actions) {
|
||||
}
|
||||
|
||||
void DynamicShortcuts::load(const QList<QAction *> actions) {
|
||||
Settings *settings = Settings::getInstance();
|
||||
Settings *settings = Settings::instance();
|
||||
|
||||
foreach (QAction *action, actions) {
|
||||
QString shortcut_for_action = settings->value(APP_CFG_CUTS,
|
||||
|
@ -22,8 +22,8 @@ FeedsModel::FeedsModel(QObject *parent) : QAbstractItemModel(parent) {
|
||||
m_rootItem = new FeedsModelRootItem();
|
||||
m_rootItem->setId(NO_PARENT_CATEGORY);
|
||||
m_rootItem->setTitle(tr("root"));
|
||||
m_rootItem->setIcon(IconThemeFactory::getInstance()->fromTheme("folder-red"));
|
||||
m_countsIcon = IconThemeFactory::getInstance()->fromTheme("mail-mark-important");
|
||||
m_rootItem->setIcon(IconThemeFactory::instance()->fromTheme("folder-red"));
|
||||
m_countsIcon = IconThemeFactory::instance()->fromTheme("mail-mark-important");
|
||||
m_headerData << tr("Title");
|
||||
m_tooltipData << tr("Titles of feeds/categories.") <<
|
||||
tr("Counts of unread/all meesages.");
|
||||
|
@ -25,26 +25,6 @@ FeedsModelCategory::FeedsModelCategory(const FeedsModelCategory &other)
|
||||
FeedsModelCategory::~FeedsModelCategory() {
|
||||
}
|
||||
|
||||
int FeedsModelCategory::countOfAllMessages() const {
|
||||
int total_count = 0;
|
||||
|
||||
foreach (FeedsModelRootItem *child_item, m_childItems) {
|
||||
total_count += child_item->countOfAllMessages();
|
||||
}
|
||||
|
||||
return total_count;
|
||||
}
|
||||
|
||||
int FeedsModelCategory::countOfUnreadMessages() const {
|
||||
int total_count = 0;
|
||||
|
||||
foreach (FeedsModelRootItem *child_item, m_childItems) {
|
||||
total_count += child_item->countOfUnreadMessages();
|
||||
}
|
||||
|
||||
return total_count;
|
||||
}
|
||||
|
||||
FeedsModelCategory:: Type FeedsModelCategory::type() const {
|
||||
return m_type;
|
||||
}
|
||||
|
@ -24,12 +24,6 @@ class FeedsModelCategory : public FeedsModelRootItem {
|
||||
explicit FeedsModelCategory(const FeedsModelCategory &other);
|
||||
virtual ~FeedsModelCategory();
|
||||
|
||||
// Counts of messages.
|
||||
// NOTE: Counts of messages in categories include
|
||||
// counts of messages from all children.
|
||||
int countOfAllMessages() const;
|
||||
int countOfUnreadMessages() const;
|
||||
|
||||
// All types of categories offer these getters/setters.
|
||||
Type type() const;
|
||||
void setType(const Type &type);
|
||||
|
@ -68,11 +68,23 @@ QVariant FeedsModelRootItem::data(int column, int role) const {
|
||||
}
|
||||
|
||||
int FeedsModelRootItem::countOfAllMessages() const {
|
||||
return 0;
|
||||
int total_count = 0;
|
||||
|
||||
foreach (FeedsModelRootItem *child_item, m_childItems) {
|
||||
total_count += child_item->countOfAllMessages();
|
||||
}
|
||||
|
||||
return total_count;
|
||||
}
|
||||
|
||||
int FeedsModelRootItem::countOfUnreadMessages() const {
|
||||
return 0;
|
||||
int total_count = 0;
|
||||
|
||||
foreach (FeedsModelRootItem *child_item, m_childItems) {
|
||||
total_count += child_item->countOfUnreadMessages();
|
||||
}
|
||||
|
||||
return total_count;
|
||||
}
|
||||
|
||||
void FeedsModelRootItem::setIcon(const QIcon &icon) {
|
||||
|
@ -33,6 +33,7 @@ class FeedsModelRootItem {
|
||||
virtual QVariant data(int column, int role) const;
|
||||
|
||||
// Each item offers "counts" of messages.
|
||||
// Returns counts of messages of all child items summed up.
|
||||
virtual int countOfUnreadMessages() const;
|
||||
virtual int countOfAllMessages() const;
|
||||
|
||||
|
@ -69,7 +69,7 @@ QVariant FeedsModelStandardCategory::data(int column, int role) const {
|
||||
case Qt::DecorationRole:
|
||||
if (column == FDS_MODEL_TITLE_INDEX) {
|
||||
return m_icon.isNull() ?
|
||||
IconThemeFactory::getInstance()->fromTheme("folder-black") :
|
||||
IconThemeFactory::instance()->fromTheme("folder-black") :
|
||||
m_icon;
|
||||
}
|
||||
else {
|
||||
|
@ -89,7 +89,7 @@ QVariant FeedsModelStandardFeed::data(int column, int role) const {
|
||||
case Qt::DecorationRole:
|
||||
if (column == FDS_MODEL_TITLE_INDEX) {
|
||||
return m_icon.isNull() ?
|
||||
IconThemeFactory::getInstance()->fromTheme("application-rss+xml") :
|
||||
IconThemeFactory::instance()->fromTheme("application-rss+xml") :
|
||||
m_icon;
|
||||
}
|
||||
else {
|
||||
@ -130,7 +130,7 @@ QVariant FeedsModelStandardFeed::data(int column, int role) const {
|
||||
|
||||
void FeedsModelStandardFeed::update() {
|
||||
QByteArray feed_contents;
|
||||
int download_timeout = Settings::getInstance()->value(APP_CFG_FEEDS,
|
||||
int download_timeout = Settings::instance()->value(APP_CFG_FEEDS,
|
||||
"download_timeout",
|
||||
DOWNLOAD_TIMEOUT).toInt();
|
||||
|
||||
|
@ -12,11 +12,12 @@
|
||||
Localization::Localization() {
|
||||
}
|
||||
|
||||
QList<Language> Localization::getInstalledLanguages() {
|
||||
QList<Language> Localization::installedLanguages() {
|
||||
QList<Language> languages;
|
||||
QDir file_dir(APP_LANG_PATH);
|
||||
QTranslator translator;
|
||||
|
||||
// Iterate all found language files.
|
||||
foreach (const QFileInfo &file, file_dir.entryInfoList(QStringList() << "rssguard_*.qm",
|
||||
QDir::Files,
|
||||
QDir::Name)) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
// Loads currently active language.
|
||||
// NOTE: Macro is used due to QTranslator persistency.
|
||||
#define LoadLocalization(); \
|
||||
QString locale_name = Settings::getInstance()->value( \
|
||||
QString locale_name = Settings::instance()->value( \
|
||||
APP_CFG_GEN, \
|
||||
"language", \
|
||||
"en").toString(); \
|
||||
@ -41,12 +41,13 @@ struct Language {
|
||||
|
||||
class Localization {
|
||||
private:
|
||||
// Constructor.
|
||||
explicit Localization();
|
||||
|
||||
public:
|
||||
// Returns list of installed application localizations.
|
||||
// This list is used ie. in settings dialog.
|
||||
static QList<Language> getInstalledLanguages();
|
||||
static QList<Language> installedLanguages();
|
||||
};
|
||||
|
||||
#endif // LOCALIZATION_H
|
||||
|
@ -38,9 +38,9 @@ bool MessagesModel::submitAll() {
|
||||
}
|
||||
|
||||
void MessagesModel::setupIcons() {
|
||||
m_favoriteIcon = IconThemeFactory::getInstance()->fromTheme("favorites");
|
||||
m_readIcon = IconThemeFactory::getInstance()->fromTheme("mail-mark-not-junk");
|
||||
m_unreadIcon = IconThemeFactory::getInstance()->fromTheme("mail-mark-important");
|
||||
m_favoriteIcon = IconThemeFactory::instance()->fromTheme("favorites");
|
||||
m_readIcon = IconThemeFactory::instance()->fromTheme("mail-mark-not-junk");
|
||||
m_unreadIcon = IconThemeFactory::instance()->fromTheme("mail-mark-important");
|
||||
}
|
||||
|
||||
void MessagesModel::fetchAll() {
|
||||
@ -59,9 +59,7 @@ QList<int> MessagesModel::currentFeeds() const {
|
||||
return m_currentFeeds;
|
||||
}
|
||||
|
||||
|
||||
void MessagesModel::loadMessages(const QList<int> feed_ids) {
|
||||
// Conversion of parameter.
|
||||
m_currentFeeds = feed_ids;
|
||||
|
||||
QString assembled_ids = textualFeeds().join(", ");
|
||||
@ -75,7 +73,7 @@ void MessagesModel::loadMessages(const QList<int> feed_ids) {
|
||||
|
||||
QStringList MessagesModel::textualFeeds() const {
|
||||
QStringList stringy_ids;
|
||||
stringy_ids.reserve(m_currentFeeds.count());
|
||||
stringy_ids.reserve(m_currentFeeds.size());
|
||||
|
||||
foreach (int feed_id, m_currentFeeds) {
|
||||
stringy_ids.append(QString::number(feed_id));
|
||||
|
@ -80,6 +80,8 @@ class MessagesModel : public QSqlTableModel {
|
||||
void feedCountsChanged();
|
||||
|
||||
protected:
|
||||
// Returns selected feed ids in concatenated textual form,
|
||||
// which is used for SQL queries.
|
||||
QStringList textualFeeds() const;
|
||||
|
||||
// Sets up header data.
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
class NetworkFactory {
|
||||
private:
|
||||
// Constructor.
|
||||
explicit NetworkFactory();
|
||||
|
||||
public:
|
||||
@ -14,7 +15,6 @@ class NetworkFactory {
|
||||
static QNetworkReply::NetworkError downloadFile(const QString &url,
|
||||
int timeout,
|
||||
QByteArray &output);
|
||||
|
||||
};
|
||||
|
||||
#endif // NETWORKFACTORY_H
|
||||
|
@ -10,8 +10,6 @@ ParsingFactory::ParsingFactory() {
|
||||
}
|
||||
|
||||
QList<Message> ParsingFactory::parseAsATOM10(const QString &data) {
|
||||
// TODO: Implement this.
|
||||
|
||||
QList<Message> messages;
|
||||
QDomDocument xml_file;
|
||||
QDateTime current_time = QDateTime::currentDateTime();
|
||||
|
@ -32,7 +32,7 @@ QSettings::Status Settings::checkSettings() {
|
||||
return status();
|
||||
}
|
||||
|
||||
Settings *Settings::getInstance() {
|
||||
Settings *Settings::instance() {
|
||||
if (s_instance.isNull()) {
|
||||
setupSettings();
|
||||
}
|
||||
|
@ -9,17 +9,19 @@ class Settings : public QSettings {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
// Describes possible types of loaded settings.
|
||||
enum Type {
|
||||
Portable,
|
||||
NonPortable
|
||||
};
|
||||
|
||||
// Singleton getter.
|
||||
static Settings *getInstance();
|
||||
static Settings *instance();
|
||||
|
||||
// Destructor.
|
||||
virtual ~Settings();
|
||||
|
||||
// Type of used settings.
|
||||
Type type() const;
|
||||
|
||||
// Getter/setter for settings values.
|
||||
|
@ -6,7 +6,7 @@
|
||||
CornerButton::CornerButton(QWidget *parent) : QToolButton(parent) {
|
||||
setToolTip(tr("Open new tab"));
|
||||
setAutoRaise(true);
|
||||
setIcon(IconThemeFactory::getInstance()->fromTheme("list-add"));
|
||||
setIcon(IconThemeFactory::instance()->fromTheme("list-add"));
|
||||
}
|
||||
|
||||
CornerButton::~CornerButton() {
|
||||
|
@ -49,7 +49,7 @@ FeedMessageViewer::~FeedMessageViewer() {
|
||||
}
|
||||
|
||||
void FeedMessageViewer::saveSize() {
|
||||
Settings *settings = Settings::getInstance();
|
||||
Settings *settings = Settings::instance();
|
||||
|
||||
// Store offsets of splitters.
|
||||
settings->setValue(APP_CFG_GUI,
|
||||
@ -70,7 +70,7 @@ void FeedMessageViewer::saveSize() {
|
||||
}
|
||||
|
||||
void FeedMessageViewer::loadSize() {
|
||||
Settings *settings = Settings::getInstance();
|
||||
Settings *settings = Settings::instance();
|
||||
int default_msg_section_size = m_messagesView->header()->defaultSectionSize();
|
||||
|
||||
// Restore offsets of splitters.
|
||||
@ -86,6 +86,7 @@ void FeedMessageViewer::loadSize() {
|
||||
settings->value(APP_CFG_GUI,
|
||||
KEY_MESSAGES_VIEW + QString::number(MSG_DB_DCREATED_INDEX),
|
||||
default_msg_section_size).toInt());
|
||||
|
||||
// TODO: Perhaps make toolbar icon size changeable,
|
||||
// this concerns toolbars of web browsers too.
|
||||
}
|
||||
@ -119,7 +120,7 @@ void FeedMessageViewer::updateAllFeeds() {
|
||||
}
|
||||
|
||||
void FeedMessageViewer::onFeedUpdatesStarted() {
|
||||
FormMain::getInstance()->statusBar()->showProgress(0, tr("Feed update started"));
|
||||
FormMain::instance()->statusBar()->showProgress(0, tr("Feed update started"));
|
||||
}
|
||||
|
||||
void FeedMessageViewer::onFeedUpdatesProgress(FeedsModelFeed *feed,
|
||||
@ -127,14 +128,14 @@ void FeedMessageViewer::onFeedUpdatesProgress(FeedsModelFeed *feed,
|
||||
int total) {
|
||||
// Some feed got updated.
|
||||
m_feedsView->updateCountsOfParticularFeed(feed, true);
|
||||
FormMain::getInstance()->statusBar()->showProgress((current * 100.0) / total,
|
||||
FormMain::instance()->statusBar()->showProgress((current * 100.0) / total,
|
||||
tr("Updated feed '%1'").arg(feed->title()));
|
||||
}
|
||||
|
||||
void FeedMessageViewer::onFeedUpdatesFinished() {
|
||||
// Updates of some feeds finished, unlock the lock.
|
||||
SystemFactory::getInstance()->applicationCloseLock()->unlock();
|
||||
FormMain::getInstance()->statusBar()->clearProgress();
|
||||
FormMain::instance()->statusBar()->clearProgress();
|
||||
}
|
||||
|
||||
void FeedMessageViewer::createConnections() {
|
||||
@ -154,13 +155,13 @@ void FeedMessageViewer::createConnections() {
|
||||
|
||||
// Message openers.
|
||||
connect(m_messagesView, SIGNAL(openMessagesInNewspaperView(QList<Message>)),
|
||||
FormMain::getInstance()->m_ui->m_tabWidget,
|
||||
FormMain::instance()->m_ui->m_tabWidget,
|
||||
SLOT(addBrowserWithMessages(QList<Message>)));
|
||||
connect(m_messagesView, SIGNAL(openLinkNewTab(QString)),
|
||||
FormMain::getInstance()->m_ui->m_tabWidget,
|
||||
FormMain::instance()->m_ui->m_tabWidget,
|
||||
SLOT(addLinkedBrowser(QString)));
|
||||
connect(m_feedsView, SIGNAL(openMessagesInNewspaperView(QList<Message>)),
|
||||
FormMain::getInstance()->m_ui->m_tabWidget,
|
||||
FormMain::instance()->m_ui->m_tabWidget,
|
||||
SLOT(addBrowserWithMessages(QList<Message>)));
|
||||
|
||||
// Downloader connections.
|
||||
@ -174,39 +175,39 @@ void FeedMessageViewer::createConnections() {
|
||||
this, SLOT(onFeedUpdatesProgress(FeedsModelFeed*,int,int)));
|
||||
|
||||
// Toolbar forwardings.
|
||||
connect(FormMain::getInstance()->m_ui->m_actionSwitchImportanceOfSelectedMessages,
|
||||
connect(FormMain::instance()->m_ui->m_actionSwitchImportanceOfSelectedMessages,
|
||||
SIGNAL(triggered()), m_messagesView, SLOT(switchSelectedMessagesImportance()));
|
||||
connect(FormMain::getInstance()->m_ui->m_actionDeleteSelectedMessages,
|
||||
connect(FormMain::instance()->m_ui->m_actionDeleteSelectedMessages,
|
||||
SIGNAL(triggered()), m_messagesView, SLOT(deleteSelectedMessages()));
|
||||
connect(FormMain::getInstance()->m_ui->m_actionMarkSelectedMessagesAsRead,
|
||||
connect(FormMain::instance()->m_ui->m_actionMarkSelectedMessagesAsRead,
|
||||
SIGNAL(triggered()), m_messagesView, SLOT(markSelectedMessagesRead()));
|
||||
connect(FormMain::getInstance()->m_ui->m_actionMarkSelectedMessagesAsUnread,
|
||||
connect(FormMain::instance()->m_ui->m_actionMarkSelectedMessagesAsUnread,
|
||||
SIGNAL(triggered()), m_messagesView, SLOT(markSelectedMessagesUnread()));
|
||||
connect(FormMain::getInstance()->m_ui->m_actionOpenSelectedSourceArticlesExternally,
|
||||
connect(FormMain::instance()->m_ui->m_actionOpenSelectedSourceArticlesExternally,
|
||||
SIGNAL(triggered()), m_messagesView, SLOT(openSelectedSourceArticlesExternally()));
|
||||
connect(FormMain::getInstance()->m_ui->m_actionOpenSelectedSourceArticlesInternally,
|
||||
connect(FormMain::instance()->m_ui->m_actionOpenSelectedSourceArticlesInternally,
|
||||
SIGNAL(triggered()), m_messagesView, SLOT(openSelectedSourceMessagesInternally()));
|
||||
connect(FormMain::getInstance()->m_ui->m_actionOpenSelectedMessagesInternally,
|
||||
connect(FormMain::instance()->m_ui->m_actionOpenSelectedMessagesInternally,
|
||||
SIGNAL(triggered()), m_messagesView, SLOT(openSelectedMessagesInternally()));
|
||||
connect(FormMain::getInstance()->m_ui->m_actionMarkAllFeedsRead,
|
||||
connect(FormMain::instance()->m_ui->m_actionMarkAllFeedsRead,
|
||||
SIGNAL(triggered()), m_feedsView, SLOT(markAllFeedsRead()));
|
||||
connect(FormMain::getInstance()->m_ui->m_actionMarkFeedsAsRead,
|
||||
connect(FormMain::instance()->m_ui->m_actionMarkFeedsAsRead,
|
||||
SIGNAL(triggered()), m_feedsView, SLOT(markSelectedFeedsRead()));
|
||||
connect(FormMain::getInstance()->m_ui->m_actionMarkFeedsAsUnread,
|
||||
connect(FormMain::instance()->m_ui->m_actionMarkFeedsAsUnread,
|
||||
SIGNAL(triggered()), m_feedsView, SLOT(markSelectedFeedsUnread()));
|
||||
connect(FormMain::getInstance()->m_ui->m_actionClearFeeds,
|
||||
connect(FormMain::instance()->m_ui->m_actionClearFeeds,
|
||||
SIGNAL(triggered()), m_feedsView, SLOT(clearSelectedFeeds()));
|
||||
connect(FormMain::getInstance()->m_ui->m_actionUpdateSelectedFeedsCategories,
|
||||
connect(FormMain::instance()->m_ui->m_actionUpdateSelectedFeedsCategories,
|
||||
SIGNAL(triggered()), this, SLOT(updateSelectedFeeds()));
|
||||
connect(FormMain::getInstance()->m_ui->m_actionUpdateAllFeeds,
|
||||
connect(FormMain::instance()->m_ui->m_actionUpdateAllFeeds,
|
||||
SIGNAL(triggered()), this, SLOT(updateAllFeeds()));
|
||||
connect(FormMain::getInstance()->m_ui->m_actionAddNewCategory,
|
||||
connect(FormMain::instance()->m_ui->m_actionAddNewCategory,
|
||||
SIGNAL(triggered()), m_feedsView, SLOT(addNewCategory()));
|
||||
connect(FormMain::getInstance()->m_ui->m_actionEditSelectedFeedCategory,
|
||||
connect(FormMain::instance()->m_ui->m_actionEditSelectedFeedCategory,
|
||||
SIGNAL(triggered()), m_feedsView, SLOT(editSelectedItem()));
|
||||
connect(FormMain::getInstance()->m_ui->m_actionViewSelectedItemsNewspaperMode,
|
||||
connect(FormMain::instance()->m_ui->m_actionViewSelectedItemsNewspaperMode,
|
||||
SIGNAL(triggered()), m_feedsView, SLOT(openSelectedFeedsInNewspaperMode()));
|
||||
connect(FormMain::getInstance()->m_ui->m_actionDeleteSelectedFeedsCategories,
|
||||
connect(FormMain::instance()->m_ui->m_actionDeleteSelectedFeedsCategories,
|
||||
SIGNAL(triggered()), m_feedsView, SLOT(deleteSelectedItems()));
|
||||
}
|
||||
|
||||
@ -218,20 +219,20 @@ void FeedMessageViewer::initialize() {
|
||||
m_toolBar->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
||||
|
||||
// Add everything to toolbar.
|
||||
m_toolBar->addAction(FormMain::getInstance()->m_ui->m_actionUpdateAllFeeds);
|
||||
m_toolBar->addAction(FormMain::getInstance()->m_ui->m_actionMarkAllFeedsRead);
|
||||
m_toolBar->addAction(FormMain::instance()->m_ui->m_actionUpdateAllFeeds);
|
||||
m_toolBar->addAction(FormMain::instance()->m_ui->m_actionMarkAllFeedsRead);
|
||||
m_toolBar->addSeparator();
|
||||
m_toolBar->addAction(FormMain::getInstance()->m_ui->m_actionUpdateSelectedFeedsCategories);
|
||||
m_toolBar->addAction(FormMain::getInstance()->m_ui->m_actionAddNewFeed);
|
||||
m_toolBar->addAction(FormMain::getInstance()->m_ui->m_actionEditSelectedFeedCategory);
|
||||
m_toolBar->addAction(FormMain::getInstance()->m_ui->m_actionDeleteSelectedFeedsCategories);
|
||||
m_toolBar->addAction(FormMain::getInstance()->m_ui->m_actionMarkFeedsAsRead);
|
||||
m_toolBar->addAction(FormMain::getInstance()->m_ui->m_actionMarkFeedsAsUnread);
|
||||
m_toolBar->addAction(FormMain::getInstance()->m_ui->m_actionClearFeeds);
|
||||
m_toolBar->addAction(FormMain::instance()->m_ui->m_actionUpdateSelectedFeedsCategories);
|
||||
m_toolBar->addAction(FormMain::instance()->m_ui->m_actionAddNewFeed);
|
||||
m_toolBar->addAction(FormMain::instance()->m_ui->m_actionEditSelectedFeedCategory);
|
||||
m_toolBar->addAction(FormMain::instance()->m_ui->m_actionDeleteSelectedFeedsCategories);
|
||||
m_toolBar->addAction(FormMain::instance()->m_ui->m_actionMarkFeedsAsRead);
|
||||
m_toolBar->addAction(FormMain::instance()->m_ui->m_actionMarkFeedsAsUnread);
|
||||
m_toolBar->addAction(FormMain::instance()->m_ui->m_actionClearFeeds);
|
||||
m_toolBar->addSeparator();
|
||||
m_toolBar->addAction(FormMain::getInstance()->m_ui->m_actionMarkSelectedMessagesAsRead);
|
||||
m_toolBar->addAction(FormMain::getInstance()->m_ui->m_actionMarkSelectedMessagesAsUnread);
|
||||
m_toolBar->addAction(FormMain::getInstance()->m_ui->m_actionDeleteSelectedMessages);
|
||||
m_toolBar->addAction(FormMain::instance()->m_ui->m_actionMarkSelectedMessagesAsRead);
|
||||
m_toolBar->addAction(FormMain::instance()->m_ui->m_actionMarkSelectedMessagesAsUnread);
|
||||
m_toolBar->addAction(FormMain::instance()->m_ui->m_actionDeleteSelectedMessages);
|
||||
|
||||
// Finish web/message browser setup.
|
||||
m_messagesBrowser->setNavigationBarVisible(false);
|
||||
|
@ -190,16 +190,16 @@ void FeedsView::updateCountsOfParticularFeed(FeedsModelFeed *feed,
|
||||
void FeedsView::initializeContextMenuCategoriesFeeds() {
|
||||
m_contextMenuCategoriesFeeds = new QMenu(tr("Context menu for feeds"), this);
|
||||
m_contextMenuCategoriesFeeds->addActions(QList<QAction*>() <<
|
||||
FormMain::getInstance()->m_ui->m_actionUpdateSelectedFeedsCategories <<
|
||||
FormMain::getInstance()->m_ui->m_actionViewSelectedItemsNewspaperMode <<
|
||||
FormMain::getInstance()->m_ui->m_actionMarkFeedsAsRead <<
|
||||
FormMain::getInstance()->m_ui->m_actionMarkFeedsAsUnread);
|
||||
FormMain::instance()->m_ui->m_actionUpdateSelectedFeedsCategories <<
|
||||
FormMain::instance()->m_ui->m_actionViewSelectedItemsNewspaperMode <<
|
||||
FormMain::instance()->m_ui->m_actionMarkFeedsAsRead <<
|
||||
FormMain::instance()->m_ui->m_actionMarkFeedsAsUnread);
|
||||
}
|
||||
|
||||
void FeedsView::initializeContextMenuEmptySpace() {
|
||||
m_contextMenuEmptySpace = new QMenu(tr("Context menu for feeds"), this);
|
||||
m_contextMenuEmptySpace->addActions(QList<QAction*>() <<
|
||||
FormMain::getInstance()->m_ui->m_actionUpdateAllFeeds);
|
||||
FormMain::instance()->m_ui->m_actionUpdateAllFeeds);
|
||||
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ FormAbout::FormAbout(QWidget *parent) : QDialog(parent), m_ui(new Ui::FormAbout)
|
||||
|
||||
// Set flags and attributes.
|
||||
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog);
|
||||
setWindowIcon(IconThemeFactory::getInstance()->fromTheme("help-about"));
|
||||
setWindowIcon(IconThemeFactory::instance()->fromTheme("help-about"));
|
||||
m_ui->m_lblIcon->setPixmap(QPixmap(APP_ICON_PATH));
|
||||
|
||||
// Load information from embedded text files.
|
||||
|
@ -58,7 +58,7 @@ void FormCategoryDetails::initialize() {
|
||||
|
||||
// Set flags and attributes.
|
||||
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog);
|
||||
setWindowIcon(IconThemeFactory::getInstance()->fromTheme("document-new"));
|
||||
setWindowIcon(IconThemeFactory::instance()->fromTheme("document-new"));
|
||||
}
|
||||
|
||||
void FormCategoryDetails::loadCategories(const QList<FeedsModelCategory *> categories,
|
||||
|
@ -54,7 +54,7 @@ FormMain::~FormMain() {
|
||||
}
|
||||
}
|
||||
|
||||
FormMain *FormMain::getInstance() {
|
||||
FormMain *FormMain::instance() {
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ void FormMain::processExecutionMessage(const QString &message) {
|
||||
|
||||
if (message == APP_IS_RUNNING) {
|
||||
if (SystemTrayIcon::isSystemTrayActivated()) {
|
||||
SystemTrayIcon::getInstance()->showMessage(APP_NAME,
|
||||
SystemTrayIcon::instance()->showMessage(APP_NAME,
|
||||
tr("Application is already running."),
|
||||
QSystemTrayIcon::Information,
|
||||
TRAY_ICON_BUBBLE_TIMEOUT);
|
||||
@ -206,39 +206,39 @@ bool FormMain::event(QEvent *event) {
|
||||
|
||||
void FormMain::setupIcons() {
|
||||
// Setup icons of this main window.
|
||||
m_ui->m_actionSettings->setIcon(IconThemeFactory::getInstance()->fromTheme("preferences-system"));
|
||||
m_ui->m_actionQuit->setIcon(IconThemeFactory::getInstance()->fromTheme("application-exit"));
|
||||
m_ui->m_actionAboutGuard->setIcon(IconThemeFactory::getInstance()->fromTheme("help-about"));
|
||||
m_ui->m_actionImport->setIcon(IconThemeFactory::getInstance()->fromTheme("document-import"));
|
||||
m_ui->m_actionExport->setIcon(IconThemeFactory::getInstance()->fromTheme("document-export"));
|
||||
m_ui->m_actionFullscreen->setIcon(IconThemeFactory::getInstance()->fromTheme("view-fullscreen"));
|
||||
m_ui->m_actionSettings->setIcon(IconThemeFactory::instance()->fromTheme("preferences-system"));
|
||||
m_ui->m_actionQuit->setIcon(IconThemeFactory::instance()->fromTheme("application-exit"));
|
||||
m_ui->m_actionAboutGuard->setIcon(IconThemeFactory::instance()->fromTheme("help-about"));
|
||||
m_ui->m_actionImport->setIcon(IconThemeFactory::instance()->fromTheme("document-import"));
|
||||
m_ui->m_actionExport->setIcon(IconThemeFactory::instance()->fromTheme("document-export"));
|
||||
m_ui->m_actionFullscreen->setIcon(IconThemeFactory::instance()->fromTheme("view-fullscreen"));
|
||||
|
||||
// Web browser.
|
||||
m_ui->m_actionAddBrowser->setIcon(IconThemeFactory::getInstance()->fromTheme("list-add"));
|
||||
m_ui->m_actionCloseCurrentTab->setIcon(IconThemeFactory::getInstance()->fromTheme("list-remove"));
|
||||
m_ui->m_actionCloseAllTabs->setIcon(IconThemeFactory::getInstance()->fromTheme("list-remove"));
|
||||
m_ui->m_menuCurrentTab->setIcon(IconThemeFactory::getInstance()->fromTheme("go-home"));
|
||||
m_ui->m_actionAddBrowser->setIcon(IconThemeFactory::instance()->fromTheme("list-add"));
|
||||
m_ui->m_actionCloseCurrentTab->setIcon(IconThemeFactory::instance()->fromTheme("list-remove"));
|
||||
m_ui->m_actionCloseAllTabs->setIcon(IconThemeFactory::instance()->fromTheme("list-remove"));
|
||||
m_ui->m_menuCurrentTab->setIcon(IconThemeFactory::instance()->fromTheme("go-home"));
|
||||
|
||||
// Feeds/messages.
|
||||
m_ui->m_actionUpdateAllFeeds->setIcon(IconThemeFactory::getInstance()->fromTheme("document-save-as"));
|
||||
m_ui->m_actionUpdateSelectedFeedsCategories->setIcon(IconThemeFactory::getInstance()->fromTheme("document-save"));
|
||||
m_ui->m_actionClearFeeds->setIcon(IconThemeFactory::getInstance()->fromTheme("mail-mark-junk"));
|
||||
m_ui->m_actionDeleteSelectedFeedsCategories->setIcon(IconThemeFactory::getInstance()->fromTheme("edit-delete"));
|
||||
m_ui->m_actionDeleteSelectedMessages->setIcon(IconThemeFactory::getInstance()->fromTheme("mail-mark-junk"));
|
||||
m_ui->m_actionAddNewCategory->setIcon(IconThemeFactory::getInstance()->fromTheme("document-new"));
|
||||
m_ui->m_actionAddNewFeed->setIcon(IconThemeFactory::getInstance()->fromTheme("document-new"));
|
||||
m_ui->m_actionEditSelectedFeedCategory->setIcon(IconThemeFactory::getInstance()->fromTheme("gnome-other"));
|
||||
m_ui->m_actionMarkAllFeedsRead->setIcon(IconThemeFactory::getInstance()->fromTheme("mail-mark-not-junk"));
|
||||
m_ui->m_actionMarkFeedsAsRead->setIcon(IconThemeFactory::getInstance()->fromTheme("mail-mark-not-junk"));
|
||||
m_ui->m_actionMarkFeedsAsUnread->setIcon(IconThemeFactory::getInstance()->fromTheme("mail-mark-important"));
|
||||
m_ui->m_actionMarkFeedsAsRead->setIcon(IconThemeFactory::getInstance()->fromTheme("mail-mark-not-junk"));
|
||||
m_ui->m_actionMarkSelectedMessagesAsRead->setIcon(IconThemeFactory::getInstance()->fromTheme("mail-mark-not-junk"));
|
||||
m_ui->m_actionMarkSelectedMessagesAsUnread->setIcon(IconThemeFactory::getInstance()->fromTheme("mail-mark-important"));
|
||||
m_ui->m_actionSwitchImportanceOfSelectedMessages->setIcon(IconThemeFactory::getInstance()->fromTheme("favorites"));
|
||||
m_ui->m_actionOpenSelectedSourceArticlesInternally->setIcon(IconThemeFactory::getInstance()->fromTheme("document-open"));
|
||||
m_ui->m_actionOpenSelectedSourceArticlesExternally->setIcon(IconThemeFactory::getInstance()->fromTheme("document-open"));
|
||||
m_ui->m_actionOpenSelectedMessagesInternally->setIcon(IconThemeFactory::getInstance()->fromTheme("document-open"));
|
||||
m_ui->m_actionViewSelectedItemsNewspaperMode->setIcon(IconThemeFactory::getInstance()->fromTheme("document-multiple"));
|
||||
m_ui->m_actionUpdateAllFeeds->setIcon(IconThemeFactory::instance()->fromTheme("document-save-as"));
|
||||
m_ui->m_actionUpdateSelectedFeedsCategories->setIcon(IconThemeFactory::instance()->fromTheme("document-save"));
|
||||
m_ui->m_actionClearFeeds->setIcon(IconThemeFactory::instance()->fromTheme("mail-mark-junk"));
|
||||
m_ui->m_actionDeleteSelectedFeedsCategories->setIcon(IconThemeFactory::instance()->fromTheme("edit-delete"));
|
||||
m_ui->m_actionDeleteSelectedMessages->setIcon(IconThemeFactory::instance()->fromTheme("mail-mark-junk"));
|
||||
m_ui->m_actionAddNewCategory->setIcon(IconThemeFactory::instance()->fromTheme("document-new"));
|
||||
m_ui->m_actionAddNewFeed->setIcon(IconThemeFactory::instance()->fromTheme("document-new"));
|
||||
m_ui->m_actionEditSelectedFeedCategory->setIcon(IconThemeFactory::instance()->fromTheme("gnome-other"));
|
||||
m_ui->m_actionMarkAllFeedsRead->setIcon(IconThemeFactory::instance()->fromTheme("mail-mark-not-junk"));
|
||||
m_ui->m_actionMarkFeedsAsRead->setIcon(IconThemeFactory::instance()->fromTheme("mail-mark-not-junk"));
|
||||
m_ui->m_actionMarkFeedsAsUnread->setIcon(IconThemeFactory::instance()->fromTheme("mail-mark-important"));
|
||||
m_ui->m_actionMarkFeedsAsRead->setIcon(IconThemeFactory::instance()->fromTheme("mail-mark-not-junk"));
|
||||
m_ui->m_actionMarkSelectedMessagesAsRead->setIcon(IconThemeFactory::instance()->fromTheme("mail-mark-not-junk"));
|
||||
m_ui->m_actionMarkSelectedMessagesAsUnread->setIcon(IconThemeFactory::instance()->fromTheme("mail-mark-important"));
|
||||
m_ui->m_actionSwitchImportanceOfSelectedMessages->setIcon(IconThemeFactory::instance()->fromTheme("favorites"));
|
||||
m_ui->m_actionOpenSelectedSourceArticlesInternally->setIcon(IconThemeFactory::instance()->fromTheme("document-open"));
|
||||
m_ui->m_actionOpenSelectedSourceArticlesExternally->setIcon(IconThemeFactory::instance()->fromTheme("document-open"));
|
||||
m_ui->m_actionOpenSelectedMessagesInternally->setIcon(IconThemeFactory::instance()->fromTheme("document-open"));
|
||||
m_ui->m_actionViewSelectedItemsNewspaperMode->setIcon(IconThemeFactory::instance()->fromTheme("document-multiple"));
|
||||
|
||||
// Setup icons for underlying components: opened web browsers...
|
||||
foreach (WebBrowser *browser, WebBrowser::runningWebBrowsers()) {
|
||||
@ -251,22 +251,25 @@ void FormMain::setupIcons() {
|
||||
|
||||
void FormMain::loadSize() {
|
||||
QRect screen = qApp->desktop()->screenGeometry();
|
||||
Settings *settings = Settings::instance();
|
||||
|
||||
// Reload main window size & position.
|
||||
resize(Settings::getInstance()->value(APP_CFG_GUI,
|
||||
"window_size",
|
||||
size()).toSize());
|
||||
move(Settings::getInstance()->value(APP_CFG_GUI,
|
||||
"window_position",
|
||||
screen.center() - rect().center()).toPoint());
|
||||
resize(settings->value(APP_CFG_GUI,
|
||||
"window_size",
|
||||
size()).toSize());
|
||||
move(settings->value(APP_CFG_GUI,
|
||||
"window_position",
|
||||
screen.center() - rect().center()).toPoint());
|
||||
|
||||
// Adjust dimensions of "feeds & messages" widget.
|
||||
m_ui->m_tabWidget->feedMessageViewer()->loadSize();
|
||||
}
|
||||
|
||||
void FormMain::saveSize() {
|
||||
Settings::getInstance()->setValue(APP_CFG_GUI, "window_position", pos());
|
||||
Settings::getInstance()->setValue(APP_CFG_GUI, "window_size", size());
|
||||
Settings *settings = Settings::instance();
|
||||
|
||||
settings->setValue(APP_CFG_GUI, "window_position", pos());
|
||||
settings->setValue(APP_CFG_GUI, "window_size", size());
|
||||
m_ui->m_tabWidget->feedMessageViewer()->saveSize();
|
||||
}
|
||||
|
||||
@ -324,7 +327,7 @@ void FormMain::loadWebBrowserMenu(int index) {
|
||||
|
||||
void FormMain::closeEvent(QCloseEvent *event) {
|
||||
if (SystemTrayIcon::isSystemTrayActivated()) {
|
||||
if (Settings::getInstance()->value(APP_CFG_GUI,
|
||||
if (Settings::instance()->value(APP_CFG_GUI,
|
||||
"close_win_action",
|
||||
0).toInt() == 0) {
|
||||
// User selected to minimize the application if its main
|
||||
|
@ -36,7 +36,7 @@ class FormMain : public QMainWindow {
|
||||
StatusBar *statusBar();
|
||||
|
||||
// Singleton accessor.
|
||||
static FormMain *getInstance();
|
||||
static FormMain *instance();
|
||||
|
||||
protected:
|
||||
// Creates all needed menus and sets them up.
|
||||
|
@ -26,7 +26,7 @@ FormSettings::FormSettings(QWidget *parent) : QDialog(parent), m_ui(new Ui::Form
|
||||
|
||||
// Set flags and attributes.
|
||||
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog);
|
||||
setWindowIcon(IconThemeFactory::getInstance()->fromTheme("preferences-system"));
|
||||
setWindowIcon(IconThemeFactory::instance()->fromTheme("preferences-system"));
|
||||
|
||||
// Setup behavior.
|
||||
m_ui->m_treeLanguages->setColumnCount(5);
|
||||
@ -147,7 +147,7 @@ void FormSettings::selectBrowserExecutable() {
|
||||
}
|
||||
|
||||
void FormSettings::loadFeedsMessages() {
|
||||
Settings *settings = Settings::getInstance();
|
||||
Settings *settings = Settings::instance();
|
||||
|
||||
m_ui->m_cmbExternalBrowserPreset->addItem(tr("Opera 12 or older"), "-nosession %1");
|
||||
m_ui->m_txtExternalBrowserExecutable->setText(settings->value(APP_CFG_MESSAGES,
|
||||
@ -158,7 +158,7 @@ void FormSettings::loadFeedsMessages() {
|
||||
}
|
||||
|
||||
void FormSettings::saveFeedsMessages() {
|
||||
Settings *settings = Settings::getInstance();
|
||||
Settings *settings = Settings::instance();
|
||||
|
||||
settings->setValue(APP_CFG_MESSAGES,
|
||||
"external_browser_executable",
|
||||
@ -268,7 +268,7 @@ void FormSettings::saveSettings() {
|
||||
saveLanguage();
|
||||
saveFeedsMessages();
|
||||
|
||||
Settings::getInstance()->checkSettings();
|
||||
Settings::instance()->checkSettings();
|
||||
promptForRestart();
|
||||
|
||||
accept();
|
||||
@ -291,7 +291,7 @@ void FormSettings::onProxyTypeChanged(int index) {
|
||||
}
|
||||
|
||||
void FormSettings::loadBrowser() {
|
||||
Settings *settings = Settings::getInstance();
|
||||
Settings *settings = Settings::instance();
|
||||
|
||||
// Load settings of web browser GUI.
|
||||
m_initialSettings.m_webBrowserProgress = settings->value(APP_CFG_BROWSER,
|
||||
@ -310,7 +310,7 @@ void FormSettings::loadBrowser() {
|
||||
}
|
||||
|
||||
void FormSettings::saveBrowser() {
|
||||
Settings *settings = Settings::getInstance();
|
||||
Settings *settings = Settings::instance();
|
||||
|
||||
// Save settings of GUI of web browser.
|
||||
settings->setValue(APP_CFG_BROWSER,
|
||||
@ -333,10 +333,10 @@ void FormSettings::loadProxy() {
|
||||
m_ui->m_cmbProxyType->addItem(tr("Http"), QNetworkProxy::HttpProxy);
|
||||
|
||||
// Load the settings.
|
||||
QNetworkProxy::ProxyType selected_proxy_type = static_cast<QNetworkProxy::ProxyType>(Settings::getInstance()->value(APP_CFG_PROXY,
|
||||
QNetworkProxy::ProxyType selected_proxy_type = static_cast<QNetworkProxy::ProxyType>(Settings::instance()->value(APP_CFG_PROXY,
|
||||
"proxy_type",
|
||||
QNetworkProxy::NoProxy).toInt());
|
||||
Settings *settings = Settings::getInstance();
|
||||
Settings *settings = Settings::instance();
|
||||
|
||||
m_ui->m_cmbProxyType->setCurrentIndex(m_ui->m_cmbProxyType->findData(selected_proxy_type));
|
||||
m_ui->m_txtProxyHost->setText(settings->value(APP_CFG_PROXY,
|
||||
@ -350,7 +350,7 @@ void FormSettings::loadProxy() {
|
||||
}
|
||||
|
||||
void FormSettings::saveProxy() {
|
||||
Settings *settings = Settings::getInstance();
|
||||
Settings *settings = Settings::instance();
|
||||
|
||||
settings->setValue(APP_CFG_PROXY, "proxy_type",
|
||||
m_ui->m_cmbProxyType->itemData(m_ui->m_cmbProxyType->currentIndex()));
|
||||
@ -368,17 +368,17 @@ void FormSettings::saveProxy() {
|
||||
}
|
||||
|
||||
void FormSettings::loadLanguage() {
|
||||
foreach (const Language &language, Localization::getInstalledLanguages()) {
|
||||
foreach (const Language &language, Localization::installedLanguages()) {
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem(m_ui->m_treeLanguages);
|
||||
item->setText(0, language.m_name);
|
||||
item->setText(1, language.m_code);
|
||||
item->setText(2, language.m_version);
|
||||
item->setText(3, language.m_author);
|
||||
item->setText(4, language.m_email);
|
||||
item->setIcon(0, IconThemeFactory::getInstance()->fromTheme(language.m_code));
|
||||
item->setIcon(0, IconThemeFactory::instance()->fromTheme(language.m_code));
|
||||
}
|
||||
|
||||
QList<QTreeWidgetItem*> matching_items = m_ui->m_treeLanguages->findItems(Settings::getInstance()->value(APP_CFG_GEN,
|
||||
QList<QTreeWidgetItem*> matching_items = m_ui->m_treeLanguages->findItems(Settings::instance()->value(APP_CFG_GEN,
|
||||
"language",
|
||||
"en").toString(),
|
||||
Qt::MatchExactly,
|
||||
@ -394,7 +394,7 @@ void FormSettings::saveLanguage() {
|
||||
return;
|
||||
}
|
||||
|
||||
Settings *settings = Settings::getInstance();
|
||||
Settings *settings = Settings::instance();
|
||||
QString actual_lang = settings->value(APP_CFG_GEN,
|
||||
"language",
|
||||
"en").toString();
|
||||
@ -408,7 +408,7 @@ void FormSettings::saveLanguage() {
|
||||
}
|
||||
|
||||
void FormSettings::loadShortcuts() {
|
||||
m_ui->m_shortcuts->populate(FormMain::getInstance()->getActions());
|
||||
m_ui->m_shortcuts->populate(FormMain::instance()->getActions());
|
||||
}
|
||||
|
||||
void FormSettings::saveShortcuts() {
|
||||
@ -416,7 +416,7 @@ void FormSettings::saveShortcuts() {
|
||||
m_ui->m_shortcuts->updateShortcuts();
|
||||
|
||||
// Save new shortcuts to the settings.
|
||||
DynamicShortcuts::save(FormMain::getInstance()->getActions());
|
||||
DynamicShortcuts::save(FormMain::instance()->getActions());
|
||||
}
|
||||
|
||||
void FormSettings::loadGeneral() {
|
||||
@ -449,7 +449,7 @@ void FormSettings::saveGeneral() {
|
||||
}
|
||||
|
||||
void FormSettings::loadInterface() {
|
||||
Settings *settings = Settings::getInstance();
|
||||
Settings *settings = Settings::instance();
|
||||
|
||||
// Load settings of tray icon.
|
||||
if (SystemTrayIcon::isSystemTrayAvailable()) {
|
||||
@ -471,9 +471,9 @@ void FormSettings::loadInterface() {
|
||||
}
|
||||
|
||||
// Load settings of icon theme.
|
||||
QString current_theme = IconThemeFactory::getInstance()->getCurrentIconTheme();
|
||||
QString current_theme = IconThemeFactory::instance()->currentIconTheme();
|
||||
|
||||
foreach (const QString &icon_theme_name, IconThemeFactory::getInstance()->getInstalledIconThemes()) {
|
||||
foreach (const QString &icon_theme_name, IconThemeFactory::instance()->installedIconThemes()) {
|
||||
if (icon_theme_name == APP_NO_THEME) {
|
||||
// Add just "no theme" on other systems.
|
||||
m_ui->m_cmbIconTheme->addItem(tr("no icon theme"),
|
||||
@ -502,9 +502,9 @@ void FormSettings::loadInterface() {
|
||||
}
|
||||
|
||||
// Load skin.
|
||||
QString selected_skin = SkinFactory::getInstance()->getSelectedSkinName();
|
||||
QString selected_skin = SkinFactory::instance()->selectedSkinName();
|
||||
|
||||
foreach (const Skin &skin, SkinFactory::getInstance()->getInstalledSkins()) {
|
||||
foreach (const Skin &skin, SkinFactory::instance()->installedSkins()) {
|
||||
QTreeWidgetItem *new_item = new QTreeWidgetItem(QStringList() <<
|
||||
skin.m_visibleName <<
|
||||
skin.m_version <<
|
||||
@ -544,7 +544,7 @@ void FormSettings::loadInterface() {
|
||||
}
|
||||
|
||||
void FormSettings::saveInterface() {
|
||||
Settings *settings = Settings::getInstance();
|
||||
Settings *settings = Settings::instance();
|
||||
|
||||
// Save tray icon.
|
||||
if (SystemTrayIcon::isSystemTrayAvailable()) {
|
||||
@ -555,18 +555,18 @@ void FormSettings::saveInterface() {
|
||||
settings->setValue(APP_CFG_GUI, "start_hidden",
|
||||
m_ui->m_checkHidden->isChecked());
|
||||
if (settings->value(APP_CFG_GUI, "use_tray_icon", true).toBool()) {
|
||||
SystemTrayIcon::getInstance()->show();
|
||||
SystemTrayIcon::instance()->show();
|
||||
}
|
||||
else {
|
||||
FormMain::getInstance()->display();
|
||||
FormMain::instance()->display();
|
||||
SystemTrayIcon::deleteInstance();
|
||||
}
|
||||
}
|
||||
|
||||
// Save selected icon theme.
|
||||
QString selected_icon_theme = m_ui->m_cmbIconTheme->itemData(m_ui->m_cmbIconTheme->currentIndex()).toString();
|
||||
QString original_icon_theme = IconThemeFactory::getInstance()->getCurrentIconTheme();
|
||||
IconThemeFactory::getInstance()->setCurrentIconTheme(selected_icon_theme);
|
||||
QString original_icon_theme = IconThemeFactory::instance()->currentIconTheme();
|
||||
IconThemeFactory::instance()->setCurrentIconTheme(selected_icon_theme);
|
||||
|
||||
// Check if icon theme was changed.
|
||||
if (selected_icon_theme != original_icon_theme) {
|
||||
@ -577,8 +577,8 @@ void FormSettings::saveInterface() {
|
||||
if (m_ui->m_treeSkins->selectedItems().size() > 0) {
|
||||
Skin active_skin = m_ui->m_treeSkins->currentItem()->data(0, Qt::UserRole).value<Skin>();
|
||||
|
||||
if (SkinFactory::getInstance()->getSelectedSkinName() != active_skin.m_baseName) {
|
||||
SkinFactory::getInstance()->setCurrentSkinName(active_skin.m_baseName);
|
||||
if (SkinFactory::instance()->selectedSkinName() != active_skin.m_baseName) {
|
||||
SkinFactory::instance()->setCurrentSkinName(active_skin.m_baseName);
|
||||
m_changedDataTexts.append(tr("skin changed"));
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ IconThemeFactory::~IconThemeFactory() {
|
||||
qDebug("Destroying IconThemeFactory instance.");
|
||||
}
|
||||
|
||||
IconThemeFactory *IconThemeFactory::getInstance() {
|
||||
IconThemeFactory *IconThemeFactory::instance() {
|
||||
if (s_instance.isNull()) {
|
||||
s_instance = new IconThemeFactory(qApp);
|
||||
}
|
||||
@ -37,7 +37,7 @@ void IconThemeFactory::setupSearchPaths() {
|
||||
"\'").join(", ")));
|
||||
}
|
||||
|
||||
QString IconThemeFactory::getCurrentIconTheme() {
|
||||
QString IconThemeFactory::currentIconTheme() {
|
||||
return m_currentIconTheme;
|
||||
}
|
||||
|
||||
@ -57,14 +57,14 @@ QIcon IconThemeFactory::fromTheme(const QString &name) {
|
||||
}
|
||||
|
||||
void IconThemeFactory::setCurrentIconTheme(const QString &theme_name) {
|
||||
Settings::getInstance()->setValue(APP_CFG_GUI,
|
||||
Settings::instance()->setValue(APP_CFG_GUI,
|
||||
"icon_theme",
|
||||
theme_name);
|
||||
}
|
||||
|
||||
void IconThemeFactory::loadCurrentIconTheme() {
|
||||
QStringList installed_themes = getInstalledIconThemes();
|
||||
QString theme_name_from_settings = Settings::getInstance()->value(APP_CFG_GUI,
|
||||
QStringList installed_themes = installedIconThemes();
|
||||
QString theme_name_from_settings = Settings::instance()->value(APP_CFG_GUI,
|
||||
"icon_theme",
|
||||
APP_THEME_DEFAULT).toString();
|
||||
|
||||
@ -94,7 +94,7 @@ void IconThemeFactory::loadCurrentIconTheme() {
|
||||
}
|
||||
}
|
||||
|
||||
QStringList IconThemeFactory::getInstalledIconThemes() {
|
||||
QStringList IconThemeFactory::installedIconThemes() {
|
||||
QStringList icon_theme_names;
|
||||
icon_theme_names << APP_NO_THEME;
|
||||
|
||||
|
@ -12,7 +12,7 @@ class IconThemeFactory : public QObject {
|
||||
|
||||
public:
|
||||
// Singleton getter.
|
||||
static IconThemeFactory *getInstance();
|
||||
static IconThemeFactory *instance();
|
||||
|
||||
// Destructor.
|
||||
virtual ~IconThemeFactory();
|
||||
@ -25,7 +25,7 @@ class IconThemeFactory : public QObject {
|
||||
void setupSearchPaths();
|
||||
|
||||
// Returns list of installed themes, including "default" theme.
|
||||
QStringList getInstalledIconThemes();
|
||||
QStringList installedIconThemes();
|
||||
|
||||
// Loads name of selected icon theme (from settings) for the application and
|
||||
// activates it. If that particular theme is not installed, then
|
||||
@ -33,18 +33,16 @@ class IconThemeFactory : public QObject {
|
||||
void loadCurrentIconTheme();
|
||||
|
||||
// Returns name of currently activated theme for the application.
|
||||
QString getCurrentIconTheme();
|
||||
QString currentIconTheme();
|
||||
|
||||
// Sets icon theme with given name as the active one and loads it.
|
||||
void setCurrentIconTheme(const QString &theme_name);
|
||||
|
||||
private:
|
||||
QHash<QString, QIcon> m_cachedIcons;
|
||||
|
||||
// Constructor.
|
||||
explicit IconThemeFactory(QObject *parent = 0);
|
||||
|
||||
// Holds name of the current icon theme.
|
||||
QHash<QString, QIcon> m_cachedIcons;
|
||||
QString m_currentIconTheme;
|
||||
|
||||
// Singleton.
|
||||
|
@ -52,7 +52,7 @@ void LocationLineEdit::mousePressEvent(QMouseEvent *event) {
|
||||
|
||||
void LocationLineEdit::paintEvent(QPaintEvent *event) {
|
||||
// Draw "progress bar" if needed.
|
||||
Settings *settings = Settings::getInstance();
|
||||
Settings *settings = Settings::instance();
|
||||
|
||||
if (m_progress > 0 && settings->value(APP_CFG_BROWSER,
|
||||
"browser_colored_progress_enabled",
|
||||
|
@ -145,13 +145,13 @@ void MessagesView::contextMenuEvent(QContextMenuEvent *event) {
|
||||
void MessagesView::initializeContextMenu() {
|
||||
m_contextMenu = new QMenu(tr("Context menu for messages"), this);
|
||||
m_contextMenu->addActions(QList<QAction*>() <<
|
||||
FormMain::getInstance()->m_ui->m_actionOpenSelectedSourceArticlesExternally <<
|
||||
FormMain::getInstance()->m_ui->m_actionOpenSelectedSourceArticlesInternally <<
|
||||
FormMain::getInstance()->m_ui->m_actionOpenSelectedMessagesInternally <<
|
||||
FormMain::getInstance()->m_ui->m_actionMarkSelectedMessagesAsRead <<
|
||||
FormMain::getInstance()->m_ui->m_actionMarkSelectedMessagesAsUnread <<
|
||||
FormMain::getInstance()->m_ui->m_actionSwitchImportanceOfSelectedMessages <<
|
||||
FormMain::getInstance()->m_ui->m_actionDeleteSelectedMessages);
|
||||
FormMain::instance()->m_ui->m_actionOpenSelectedSourceArticlesExternally <<
|
||||
FormMain::instance()->m_ui->m_actionOpenSelectedSourceArticlesInternally <<
|
||||
FormMain::instance()->m_ui->m_actionOpenSelectedMessagesInternally <<
|
||||
FormMain::instance()->m_ui->m_actionMarkSelectedMessagesAsRead <<
|
||||
FormMain::instance()->m_ui->m_actionMarkSelectedMessagesAsUnread <<
|
||||
FormMain::instance()->m_ui->m_actionSwitchImportanceOfSelectedMessages <<
|
||||
FormMain::instance()->m_ui->m_actionDeleteSelectedMessages);
|
||||
}
|
||||
|
||||
void MessagesView::mousePressEvent(QMouseEvent *event) {
|
||||
@ -227,9 +227,9 @@ void MessagesView::loadFeeds(const QList<int> &feed_ids) {
|
||||
}
|
||||
|
||||
void MessagesView::openSelectedSourceArticlesExternally() {
|
||||
QString browser = Settings::getInstance()->value(APP_CFG_MESSAGES,
|
||||
QString browser = Settings::instance()->value(APP_CFG_MESSAGES,
|
||||
"external_browser_executable").toString();
|
||||
QString arguments = Settings::getInstance()->value(APP_CFG_MESSAGES,
|
||||
QString arguments = Settings::instance()->value(APP_CFG_MESSAGES,
|
||||
"external_browser_arguments",
|
||||
"%1").toString();
|
||||
|
||||
|
@ -44,7 +44,7 @@ ShortcutCatcher::ShortcutCatcher(QWidget *parent)
|
||||
|
||||
// Create clear button.
|
||||
m_clearButton = new QToolButton(this);
|
||||
m_clearButton->setIcon(IconThemeFactory::getInstance()->fromTheme("document-revert"));
|
||||
m_clearButton->setIcon(IconThemeFactory::instance()->fromTheme("document-revert"));
|
||||
m_clearButton->setFocusPolicy(Qt::NoFocus);
|
||||
m_clearButton->setToolTip(tr("Reset shortcut."));
|
||||
|
||||
|
@ -19,7 +19,7 @@ SkinFactory::~SkinFactory() {
|
||||
qDebug("Destroying SkinFactory instance.");
|
||||
}
|
||||
|
||||
SkinFactory *SkinFactory::getInstance() {
|
||||
SkinFactory *SkinFactory::instance() {
|
||||
if (s_instance.isNull()) {
|
||||
s_instance = new SkinFactory(qApp);
|
||||
}
|
||||
@ -28,9 +28,9 @@ SkinFactory *SkinFactory::getInstance() {
|
||||
}
|
||||
|
||||
void SkinFactory::loadCurrentSkin() {
|
||||
QString skin_name_from_settings = getSelectedSkinName();
|
||||
QString skin_name_from_settings = selectedSkinName();
|
||||
bool skin_parsed;
|
||||
Skin skin_data = getSkinInfo(skin_name_from_settings, &skin_parsed);
|
||||
Skin skin_data = skinInfo(skin_name_from_settings, &skin_parsed);
|
||||
|
||||
if (skin_parsed) {
|
||||
loadSkinFromData(skin_data);
|
||||
@ -93,24 +93,24 @@ bool SkinFactory::loadSkinFromData(const Skin &skin) {
|
||||
}
|
||||
|
||||
void SkinFactory::setCurrentSkinName(const QString &skin_name) {
|
||||
Settings::getInstance()->setValue(APP_CFG_GUI, "skin", skin_name);
|
||||
Settings::instance()->setValue(APP_CFG_GUI, "skin", skin_name);
|
||||
}
|
||||
|
||||
QString SkinFactory::getSelectedSkinName() {
|
||||
return Settings::getInstance()->value(APP_CFG_GUI,
|
||||
QString SkinFactory::selectedSkinName() {
|
||||
return Settings::instance()->value(APP_CFG_GUI,
|
||||
"skin",
|
||||
APP_SKIN_DEFAULT).toString();
|
||||
}
|
||||
|
||||
QString SkinFactory::getCurrentMarkup() {
|
||||
QString SkinFactory::currentMarkup() {
|
||||
return m_currentSkin.m_layoutMarkup;
|
||||
}
|
||||
|
||||
QString SkinFactory::getCurrentMarkupLayout() {
|
||||
QString SkinFactory::currentMarkupLayout() {
|
||||
return m_currentSkin.m_layoutMarkupWrapper;
|
||||
}
|
||||
|
||||
Skin SkinFactory::getSkinInfo(const QString &skin_name, bool *ok) {
|
||||
Skin SkinFactory::skinInfo(const QString &skin_name, bool *ok) {
|
||||
Skin skin;
|
||||
QString styles;
|
||||
QFile skin_file(APP_SKIN_PATH + QDir::separator() + skin_name);
|
||||
@ -171,7 +171,7 @@ Skin SkinFactory::getSkinInfo(const QString &skin_name, bool *ok) {
|
||||
return skin;
|
||||
}
|
||||
|
||||
QList<Skin> SkinFactory::getInstalledSkins() {
|
||||
QList<Skin> SkinFactory::installedSkins() {
|
||||
QList<Skin> skins;
|
||||
bool skin_load_ok;
|
||||
QStringList skin_directories = QDir(APP_SKIN_PATH).entryList(QDir::Dirs |
|
||||
@ -186,7 +186,7 @@ QList<Skin> SkinFactory::getInstalledSkins() {
|
||||
|
||||
foreach (const QString &skin_file, skin_files) {
|
||||
// Check if skin file is valid and add it if it is valid.
|
||||
Skin skin_info = getSkinInfo(base_directory + QDir::separator() + skin_file,
|
||||
Skin skin_info = skinInfo(base_directory + QDir::separator() + skin_file,
|
||||
&skin_load_ok);
|
||||
|
||||
if (skin_load_ok) {
|
||||
|
@ -29,6 +29,7 @@ class SkinFactory : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
// Constructor.
|
||||
explicit SkinFactory(QObject *parent = 0);
|
||||
|
||||
// Loads the skin from give skin_data.
|
||||
@ -38,7 +39,7 @@ class SkinFactory : public QObject {
|
||||
|
||||
public:
|
||||
// Singleton getter.
|
||||
static SkinFactory *getInstance();
|
||||
static SkinFactory *instance();
|
||||
|
||||
// Destructor.
|
||||
virtual ~SkinFactory();
|
||||
@ -47,19 +48,19 @@ class SkinFactory : public QObject {
|
||||
void loadCurrentSkin();
|
||||
|
||||
// Returns contents of current layout markup.
|
||||
QString getCurrentMarkup();
|
||||
QString getCurrentMarkupLayout();
|
||||
QString currentMarkup();
|
||||
QString currentMarkupLayout();
|
||||
|
||||
// Returns the name of the skin, that should be activated
|
||||
// after application restart.
|
||||
QString getSelectedSkinName();
|
||||
QString selectedSkinName();
|
||||
|
||||
// Gets skin about a particular skin.
|
||||
Skin getSkinInfo(const QString &skin_name, bool *ok = NULL);
|
||||
Skin skinInfo(const QString &skin_name, bool *ok = NULL);
|
||||
|
||||
// Returns list of installed skins, including "default system skin".
|
||||
// NOTE: Default skin always lies at position 0.
|
||||
QList<Skin> getInstalledSkins();
|
||||
QList<Skin> installedSkins();
|
||||
|
||||
// Sets the desired skin as the active one if it exists.
|
||||
void setCurrentSkinName(const QString &skin_name);
|
||||
|
@ -14,7 +14,7 @@ StatusBar::StatusBar(QWidget *parent) : QStatusBar(parent) {
|
||||
// Initializations of widgets for status bar.
|
||||
m_fullscreenSwitcher = new QToolButton(this);
|
||||
m_fullscreenSwitcher->setAutoRaise(true);
|
||||
m_fullscreenSwitcher->setIcon(IconThemeFactory::getInstance()->fromTheme("view-fullscreen"));
|
||||
m_fullscreenSwitcher->setIcon(IconThemeFactory::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."));
|
||||
|
||||
|
@ -23,7 +23,7 @@ bool TrayIconMenu::event(QEvent *event) {
|
||||
if (QtSingleApplication::activeModalWidget() != NULL &&
|
||||
event->type() == QEvent::Show) {
|
||||
QTimer::singleShot(0, this, SLOT(hide()));
|
||||
SystemTrayIcon::getInstance()->showMessage(APP_LONG_NAME,
|
||||
SystemTrayIcon::instance()->showMessage(APP_LONG_NAME,
|
||||
tr("Close opened modal dialogs first."),
|
||||
QSystemTrayIcon::Warning);
|
||||
}
|
||||
@ -69,16 +69,16 @@ bool SystemTrayIcon::isSystemTrayAvailable() {
|
||||
}
|
||||
|
||||
bool SystemTrayIcon::isSystemTrayActivated() {
|
||||
return SystemTrayIcon::isSystemTrayAvailable() && Settings::getInstance()->value(APP_CFG_GUI,
|
||||
return SystemTrayIcon::isSystemTrayAvailable() && Settings::instance()->value(APP_CFG_GUI,
|
||||
"use_tray_icon",
|
||||
true).toBool();
|
||||
}
|
||||
|
||||
SystemTrayIcon *SystemTrayIcon::getInstance() {
|
||||
SystemTrayIcon *SystemTrayIcon::instance() {
|
||||
if (s_trayIcon.isNull()) {
|
||||
s_trayIcon = new SystemTrayIcon(APP_ICON_PATH,
|
||||
APP_ICON_PLAIN_PATH,
|
||||
FormMain::getInstance());
|
||||
FormMain::instance());
|
||||
}
|
||||
|
||||
return s_trayIcon;
|
||||
|
@ -40,7 +40,7 @@ class SystemTrayIcon : public QSystemTrayIcon {
|
||||
|
||||
// Creates new tray icon if necessary and returns it.
|
||||
// WARNING: Use this in cooperation with SystemTrayIcon::isSystemTrayActivated().
|
||||
static SystemTrayIcon *getInstance();
|
||||
static SystemTrayIcon *instance();
|
||||
|
||||
// Sets the number to be visible in the tray icon, -1 removes it.
|
||||
void setNumber(int number = -1);
|
||||
|
@ -55,7 +55,7 @@ void TabBar::mousePressEvent(QMouseEvent *event) {
|
||||
// Check if user clicked tab with middle button.
|
||||
// NOTE: This needs to be done here because
|
||||
// destination does not know the original event.
|
||||
if (event->button() & Qt::MiddleButton && Settings::getInstance()->value(APP_CFG_GUI,
|
||||
if (event->button() & Qt::MiddleButton && Settings::instance()->value(APP_CFG_GUI,
|
||||
"tab_close_mid_button",
|
||||
true).toBool()) {
|
||||
if (tabType(tab_index) == TabBar::Closable) {
|
||||
@ -76,7 +76,7 @@ void TabBar::mouseDoubleClickEvent(QMouseEvent *event) {
|
||||
// Check if user clicked tab with middle button.
|
||||
// NOTE: This needs to be done here because
|
||||
// destination does not know the original event.
|
||||
if (event->button() & Qt::LeftButton && Settings::getInstance()->value(APP_CFG_GUI,
|
||||
if (event->button() & Qt::LeftButton && Settings::instance()->value(APP_CFG_GUI,
|
||||
"tab_close_double_button",
|
||||
true).toBool()) {
|
||||
if (tabType(tab_index) == TabBar::Closable) {
|
||||
@ -88,7 +88,7 @@ void TabBar::mouseDoubleClickEvent(QMouseEvent *event) {
|
||||
// Check if new tab should be opened with initial web browser.
|
||||
// NOTE: This check could be unnecesary here and should be done in
|
||||
// destination object but we keep it here for consistency.
|
||||
else if (Settings::getInstance()->value(APP_CFG_GUI,
|
||||
else if (Settings::instance()->value(APP_CFG_GUI,
|
||||
"tab_new_double_button",
|
||||
true).toBool()) {
|
||||
emit emptySpaceDoubleClicked();
|
||||
|
@ -29,7 +29,7 @@ void TabWidget::setupCornerButton() {
|
||||
}
|
||||
|
||||
void TabWidget::checkTabBarVisibility() {
|
||||
tabBar()->setVisible(count() > 1 || !Settings::getInstance()->value(APP_CFG_GUI,
|
||||
tabBar()->setVisible(count() > 1 || !Settings::instance()->value(APP_CFG_GUI,
|
||||
"hide_tabbar_one_tab",
|
||||
true).toBool());
|
||||
}
|
||||
@ -76,7 +76,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::getInstance()->fromTheme("application-rss+xml"));
|
||||
setTabIcon(index, IconThemeFactory::instance()->fromTheme("application-rss+xml"));
|
||||
}
|
||||
// Other indexes probably contain WebBrowsers.
|
||||
else {
|
||||
@ -84,13 +84,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::getInstance()->fromTheme("text-html"));
|
||||
setTabIcon(index, IconThemeFactory::instance()->fromTheme("text-html"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Setup corner button icon.
|
||||
m_cornerButton->setIcon(IconThemeFactory::getInstance()->fromTheme("list-add"));
|
||||
m_cornerButton->setIcon(IconThemeFactory::instance()->fromTheme("list-add"));
|
||||
}
|
||||
|
||||
bool TabWidget::closeTab(int index) {
|
||||
@ -194,7 +194,7 @@ int TabWidget::addLinkedBrowser(const QString &initial_url) {
|
||||
}
|
||||
|
||||
int TabWidget::addLinkedBrowser(const QUrl &initial_url) {
|
||||
return addBrowser(Settings::getInstance()->value(APP_CFG_BROWSER,
|
||||
return addBrowser(Settings::instance()->value(APP_CFG_BROWSER,
|
||||
"queue_tabs",
|
||||
true).toBool(),
|
||||
false,
|
||||
@ -214,14 +214,14 @@ int TabWidget::addBrowser(bool move_after_current,
|
||||
// Insert web browser after current tab.
|
||||
final_index = insertTab(currentIndex() + 1,
|
||||
browser,
|
||||
IconThemeFactory::getInstance()->fromTheme("text-html"),
|
||||
IconThemeFactory::instance()->fromTheme("text-html"),
|
||||
tr("Web browser"),
|
||||
TabBar::Closable);
|
||||
}
|
||||
else {
|
||||
// Add new browser as the last tab.
|
||||
final_index = addTab(browser,
|
||||
IconThemeFactory::getInstance()->fromTheme("text-html"),
|
||||
IconThemeFactory::instance()->fromTheme("text-html"),
|
||||
tr("Web browser"),
|
||||
TabBar::Closable);
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ void WebBrowser::createConnections() {
|
||||
connect(m_webView, SIGNAL(urlChanged(QUrl)), this, SLOT(updateUrl(QUrl)));
|
||||
|
||||
// Connect this WebBrowser to global TabWidget.
|
||||
TabWidget *tab_widget = FormMain::getInstance()->getTabWidget();
|
||||
TabWidget *tab_widget = FormMain::instance()->getTabWidget();
|
||||
connect(m_webView, SIGNAL(newTabRequested()), tab_widget, SLOT(addEmptyBrowser()));
|
||||
connect(m_webView, SIGNAL(linkMiddleClicked(QUrl)),
|
||||
tab_widget, SLOT(addLinkedBrowser(QUrl)));
|
||||
@ -167,9 +167,9 @@ void WebBrowser::clear() {
|
||||
}
|
||||
|
||||
void WebBrowser::navigateToMessages(const QList<Message> &messages) {
|
||||
SkinFactory *factory = SkinFactory::getInstance();
|
||||
SkinFactory *factory = SkinFactory::instance();
|
||||
QString messages_layout;
|
||||
QString default_message_layout = factory->getCurrentMarkup();
|
||||
QString default_message_layout = factory->currentMarkup();
|
||||
|
||||
foreach (const Message &message, messages) {
|
||||
messages_layout.append(default_message_layout.arg(message.m_title,
|
||||
@ -181,14 +181,14 @@ void WebBrowser::navigateToMessages(const QList<Message> &messages) {
|
||||
message.m_created.toString(Qt::DefaultLocaleShortDate)));
|
||||
}
|
||||
|
||||
QString layout_wrapper = factory->getCurrentMarkupLayout().arg(messages.size() == 1 ?
|
||||
QString layout_wrapper = factory->currentMarkupLayout().arg(messages.size() == 1 ?
|
||||
messages.at(0).m_title :
|
||||
tr("Newspaper view"),
|
||||
messages_layout);
|
||||
|
||||
m_webView->setHtml(layout_wrapper, QUrl(INTERNAL_URL_NEWSPAPER));
|
||||
emit iconChanged(m_index,
|
||||
IconThemeFactory::getInstance()->fromTheme("document-multiple"));
|
||||
IconThemeFactory::instance()->fromTheme("document-multiple"));
|
||||
}
|
||||
|
||||
void WebBrowser::updateZoomGui() {
|
||||
@ -254,11 +254,11 @@ void WebBrowser::setFocus(Qt::FocusReason reason) {
|
||||
}
|
||||
|
||||
void WebBrowser::setupIcons() {
|
||||
m_actionZoom->setIcon(IconThemeFactory::getInstance()->fromTheme("zoom-fit-best"));
|
||||
m_actionBack->setIcon(IconThemeFactory::getInstance()->fromTheme("go-previous"));
|
||||
m_actionForward->setIcon(IconThemeFactory::getInstance()->fromTheme("go-next"));
|
||||
m_actionReload->setIcon(IconThemeFactory::getInstance()->fromTheme("view-refresh"));
|
||||
m_actionStop->setIcon(IconThemeFactory::getInstance()->fromTheme("process-stop"));
|
||||
m_actionZoom->setIcon(IconThemeFactory::instance()->fromTheme("zoom-fit-best"));
|
||||
m_actionBack->setIcon(IconThemeFactory::instance()->fromTheme("go-previous"));
|
||||
m_actionForward->setIcon(IconThemeFactory::instance()->fromTheme("go-next"));
|
||||
m_actionReload->setIcon(IconThemeFactory::instance()->fromTheme("view-refresh"));
|
||||
m_actionStop->setIcon(IconThemeFactory::instance()->fromTheme("process-stop"));
|
||||
m_webView->setupIcons();
|
||||
}
|
||||
|
||||
|
@ -57,17 +57,17 @@ void WebView::createConnections() {
|
||||
}
|
||||
|
||||
void WebView::setupIcons() {
|
||||
m_actionReload->setIcon(IconThemeFactory::getInstance()->fromTheme("view-refresh"));
|
||||
m_actionCopyLink->setIcon(IconThemeFactory::getInstance()->fromTheme("edit-copy"));
|
||||
m_actionCopyImage->setIcon(IconThemeFactory::getInstance()->fromTheme("insert-image"));
|
||||
m_actionReload->setIcon(IconThemeFactory::instance()->fromTheme("view-refresh"));
|
||||
m_actionCopyLink->setIcon(IconThemeFactory::instance()->fromTheme("edit-copy"));
|
||||
m_actionCopyImage->setIcon(IconThemeFactory::instance()->fromTheme("insert-image"));
|
||||
|
||||
#if QT_VERSION >= 0x040800
|
||||
m_actionCopyImageUrl->setIcon(IconThemeFactory::getInstance()->fromTheme("edit-copy"));
|
||||
m_actionCopyImageUrl->setIcon(IconThemeFactory::instance()->fromTheme("edit-copy"));
|
||||
#endif
|
||||
|
||||
m_actionOpenLinkThisTab->setIcon(IconThemeFactory::getInstance()->fromTheme("text-html"));
|
||||
m_actionOpenLinkNewTab->setIcon(IconThemeFactory::getInstance()->fromTheme("text-html"));
|
||||
m_actionOpenImageNewTab->setIcon(IconThemeFactory::getInstance()->fromTheme("insert-image"));
|
||||
m_actionOpenLinkThisTab->setIcon(IconThemeFactory::instance()->fromTheme("text-html"));
|
||||
m_actionOpenLinkNewTab->setIcon(IconThemeFactory::instance()->fromTheme("text-html"));
|
||||
m_actionOpenImageNewTab->setIcon(IconThemeFactory::instance()->fromTheme("insert-image"));
|
||||
}
|
||||
|
||||
void WebView::initializeActions() {
|
||||
@ -111,9 +111,9 @@ void WebView::initializeActions() {
|
||||
}
|
||||
|
||||
void WebView::displayErrorPage() {
|
||||
setHtml(SkinFactory::getInstance()->getCurrentMarkupLayout().arg(
|
||||
setHtml(SkinFactory::instance()->currentMarkupLayout().arg(
|
||||
tr("Error page"),
|
||||
SkinFactory::getInstance()->getCurrentMarkup().arg(tr("Page not found"),
|
||||
SkinFactory::instance()->currentMarkup().arg(tr("Page not found"),
|
||||
tr("Check your internet connection or website address"),
|
||||
QString(),
|
||||
tr("This failure can be caused by:<br><ul>"
|
||||
@ -132,8 +132,8 @@ void WebView::popupContextMenu(const QPoint &pos) {
|
||||
QMenu link_submenu(tr("Hyperlink"), this);
|
||||
QWebHitTestResult hit_result = page()->mainFrame()->hitTestContent(pos);
|
||||
|
||||
image_submenu.setIcon(IconThemeFactory::getInstance()->fromTheme("image-x-generic"));
|
||||
link_submenu.setIcon(IconThemeFactory::getInstance()->fromTheme("text-html"));
|
||||
image_submenu.setIcon(IconThemeFactory::instance()->fromTheme("image-x-generic"));
|
||||
link_submenu.setIcon(IconThemeFactory::instance()->fromTheme("text-html"));
|
||||
|
||||
// Assemble the menu from actions.
|
||||
context_menu.addAction(m_actionReload);
|
||||
@ -198,7 +198,7 @@ void WebView::mousePressEvent(QMouseEvent *event) {
|
||||
|
||||
void WebView::mouseReleaseEvent(QMouseEvent *event) {
|
||||
if (event->button() & Qt::MiddleButton) {
|
||||
bool are_gestures_enabled = Settings::getInstance()->value(APP_CFG_BROWSER,
|
||||
bool are_gestures_enabled = Settings::instance()->value(APP_CFG_BROWSER,
|
||||
"gestures_enabled",
|
||||
true).toBool();
|
||||
if (are_gestures_enabled) {
|
||||
|
14
src/main.cpp
14
src/main.cpp
@ -65,9 +65,9 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
// Add an extra path for non-system icon themes and set current icon theme
|
||||
// and skin.
|
||||
IconThemeFactory::getInstance()->setupSearchPaths();
|
||||
IconThemeFactory::getInstance()->loadCurrentIconTheme();
|
||||
SkinFactory::getInstance()->loadCurrentSkin();
|
||||
IconThemeFactory::instance()->setupSearchPaths();
|
||||
IconThemeFactory::instance()->loadCurrentIconTheme();
|
||||
SkinFactory::instance()->loadCurrentSkin();
|
||||
|
||||
// Load localization and setup locale before any widget is constructed.
|
||||
LoadLocalization();
|
||||
@ -92,13 +92,13 @@ int main(int argc, char *argv[]) {
|
||||
DynamicShortcuts::load(window.getActions());
|
||||
|
||||
// Display welcome dialog if application is launched for the first time.
|
||||
if (Settings::getInstance()->value(APP_CFG_GEN, "first_start", true).toBool()) {
|
||||
Settings::getInstance()->setValue(APP_CFG_GEN, "first_start", false);
|
||||
if (Settings::instance()->value(APP_CFG_GEN, "first_start", true).toBool()) {
|
||||
Settings::instance()->setValue(APP_CFG_GEN, "first_start", false);
|
||||
FormWelcome(&window).exec();
|
||||
}
|
||||
|
||||
// Display main window.
|
||||
if (Settings::getInstance()->value(APP_CFG_GUI, "start_hidden",
|
||||
if (Settings::instance()->value(APP_CFG_GUI, "start_hidden",
|
||||
false).toBool() &&
|
||||
SystemTrayIcon::isSystemTrayActivated()) {
|
||||
qDebug("Hiding the main window when the application is starting.");
|
||||
@ -111,7 +111,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
// Display tray icon if it is enabled and available.
|
||||
if (SystemTrayIcon::isSystemTrayActivated()) {
|
||||
SystemTrayIcon::getInstance()->show();
|
||||
SystemTrayIcon::instance()->show();
|
||||
}
|
||||
|
||||
// Setup single-instance behavior.
|
||||
|
Loading…
x
Reference in New Issue
Block a user