Another const refactoring.

This commit is contained in:
Martin Rotter 2016-01-13 09:57:05 +01:00
parent 756991d7e8
commit 35bae07ddd
192 changed files with 412 additions and 368 deletions

View file

@ -4,6 +4,18 @@ Welcome to RSS Guard website. You can find here basic information.
RSS Guard is simple and easy-to-use RSS/ATOM feed aggregator developed using Qt framework which supports online feed synchronization.
Core features are:
* **support for online feed synchronization via plugins**,
* Tiny Tiny RSS (from RSS Guard 3.0.0).
* multiplatformity,
* multiple data backend support,
* SQLite (in-memory DBs too),
* MySQL.
* Adblock.
See below for more information about features and other RSS Guard aspects.
- - -
Contacts
--------
@ -54,8 +66,8 @@ Downloads
* Archlinux AUR packages - [stable-qt5](https://aur.archlinux.org/packages/rssguard/).
![RSS Guard is 100% clean.](http://www.softpedia.com/_img/softpedia_100_free.png)
- - -
- - -
Features
--------
RSS Guard is simple (yet powerful) feed reader. It is able to fetch the most known feed formats, including RSS/RDF and ATOM. RSS Guard is developed on top of the [Qt library](http://qt-project.org/) and it supports these operating systems:
@ -121,7 +133,6 @@ RSS Guard is written in C++. It is pretty fast even with tons of messages loaded
* no ads, no hidden costs.
- - -
Philosophy
----------
RSS Guard tends to be independent software. It's free, it's open-source. RSS Guard accepts donations but only to SUPPORT its development.

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -575,13 +575,13 @@ RootItem *FeedsModel::itemForIndex(const QModelIndex &index) const {
}
}
QModelIndex FeedsModel::indexForItem(RootItem *item) const {
QModelIndex FeedsModel::indexForItem(const RootItem *item) const {
if (item == NULL || item->kind() == RootItemKind::Root) {
// Root item lies on invalid index.
return QModelIndex();
}
QStack<RootItem*> chain;
QStack<const RootItem*> chain;
while (item->kind() != RootItemKind::Root) {
chain.push(item);
@ -593,8 +593,8 @@ QModelIndex FeedsModel::indexForItem(RootItem *item) const {
// We go through the stack and create our target index.
while (!chain.isEmpty()) {
RootItem *parent_item = chain.pop();
target_index = index(parent_item->parent()->childItems().indexOf(parent_item), 0, target_index);
const RootItem *parent_item = chain.pop();
target_index = index(parent_item->parent()->childItems().indexOf(const_cast<RootItem* const>(parent_item)), 0, target_index);
}
return target_index;

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -121,7 +121,7 @@ class FeedsModel : public QAbstractItemModel {
// NOTE: This goes through all available indexes and
// checks their bound items manually, there is no
// other way to to this.
QModelIndex indexForItem(RootItem *item) const;
QModelIndex indexForItem(const RootItem *item) const;
// Determines if any feed has any new messages.
bool hasAnyFeedNewMessages() const;

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -212,11 +212,11 @@ bool FeedsProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source
}
}
RootItem *FeedsProxyModel::selectedItem() const {
const RootItem *FeedsProxyModel::selectedItem() const {
return m_selectedItem;
}
void FeedsProxyModel::setSelectedItem(RootItem *selected_item) {
void FeedsProxyModel::setSelectedItem(const RootItem *selected_item) {
m_selectedItem = selected_item;
}

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -47,8 +47,8 @@ class FeedsProxyModel : public QSortFilterProxyModel {
bool showUnreadOnly() const;
void setShowUnreadOnly(bool show_unread_only);
RootItem *selectedItem() const;
void setSelectedItem(RootItem *selected_item);
const RootItem *selectedItem() const;
void setSelectedItem(const RootItem *selected_item);
public slots:
void invalidateReadFeedsFilter(bool set_new_value = false, bool show_unread_only = false);
@ -63,7 +63,7 @@ class FeedsProxyModel : public QSortFilterProxyModel {
// Source model pointer.
FeedsModel *m_sourceModel;
RootItem *m_selectedItem;
const RootItem *m_selectedItem;
bool m_showUnreadOnly;
};

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

2
src/core/parsingfactory.h Normal file → Executable file
View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

2
src/dynamic-shortcuts/dynamicshortcuts.h Normal file → Executable file
View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

2
src/dynamic-shortcuts/dynamicshortcutswidget.h Normal file → Executable file
View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

2
src/dynamic-shortcuts/shortcutbutton.cpp Normal file → Executable file
View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

2
src/dynamic-shortcuts/shortcutbutton.h Normal file → Executable file
View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

2
src/dynamic-shortcuts/shortcutcatcher.h Normal file → Executable file
View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

2
src/exceptions/applicationexception.cpp Normal file → Executable file
View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

2
src/exceptions/applicationexception.h Normal file → Executable file
View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

2
src/exceptions/ioexception.cpp Normal file → Executable file
View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -35,7 +35,7 @@ BaseToolBar::~BaseToolBar() {
qDebug("Destroying BaseToolBar instance.");
}
QAction *BaseToolBar::findMatchingAction(const QString &action, const QList<QAction*> actions) {
QAction *BaseToolBar::findMatchingAction(const QString &action, const QList<QAction*> actions) const {
foreach (QAction *act, actions) {
if (act->objectName() == action) {
return act;

4
src/gui/basetoolbar.h Normal file → Executable file
View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -44,7 +44,7 @@ class BaseToolBar : public QToolBar {
virtual void loadChangeableActions() = 0;
protected:
QAction *findMatchingAction(const QString &action, const QList<QAction*> actions);
QAction *findMatchingAction(const QString &action, const QList<QAction*> actions) const;
};
#endif // TOOLBAR_H

View file

@ -1,3 +1,20 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// RSS Guard is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with RSS Guard. If not, see <http://www.gnu.org/licenses/>.
#include "gui/colorlabel.h"
#include <QPaintEvent>
@ -22,6 +39,5 @@ void ColorLabel::setColor(const QColor &color) {
}
void ColorLabel::paintEvent(QPaintEvent *event) {
QPainter painter(this);
painter.fillRect(event->rect(), m_color);
QPainter(this).fillRect(event->rect(), m_color);
}

View file

@ -1,3 +1,20 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// RSS Guard is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with RSS Guard. If not, see <http://www.gnu.org/licenses/>.
#ifndef COLORLABEL_H
#define COLORLABEL_H

4
src/gui/comboboxwithstatus.cpp Normal file → Executable file
View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -27,7 +27,7 @@ ComboBoxWithStatus::ComboBoxWithStatus(QWidget *parent)
m_wdgInput = new QComboBox(this);
// Set correct size for the tool button.
int txt_input_height = m_wdgInput->sizeHint().height();
const int txt_input_height = m_wdgInput->sizeHint().height();
m_btnStatus->setFixedSize(txt_input_height, txt_input_height);
// Compose the layout.

3
src/gui/comboboxwithstatus.h Normal file → Executable file
View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -22,6 +22,7 @@
#include <QComboBox>
class ComboBoxWithStatus : public WidgetWithStatus {
Q_OBJECT

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -222,6 +222,9 @@ void FormMain::updateAddItemMenu() {
m_ui->m_menuAddItem->addAction(m_ui->m_actionAddCategoryIntoSelectedAccount);
m_ui->m_menuAddItem->addAction(m_ui->m_actionAddFeedIntoSelectedAccount);
}
else {
m_ui->m_menuAddItem->addAction(m_ui->m_actionNoActions);
}
}
void FormMain::updateRecycleBinMenu() {

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -59,8 +59,8 @@ void DiscoverFeedsButton::setFeedAddresses(const QStringList &addresses) {
m_addresses = addresses;
}
void DiscoverFeedsButton::linkTriggered(QAction *action) {
QString url = action->property("url").toString();
void DiscoverFeedsButton::linkTriggered(const QAction *action) {
const QString url = action->property("url").toString();
ServiceRoot *root = static_cast<ServiceRoot*>(action->property("root").value<void*>());
if (root->supportsFeedAdding()) {
@ -77,7 +77,7 @@ void DiscoverFeedsButton::linkTriggered(QAction *action) {
void DiscoverFeedsButton::fillMenu() {
menu()->clear();
foreach (ServiceRoot *root, qApp->mainForm()->tabWidget()->feedMessageViewer()->feedsView()->sourceModel()->serviceRoots()) {
foreach (const ServiceRoot *root, qApp->mainForm()->tabWidget()->feedMessageViewer()->feedsView()->sourceModel()->serviceRoots()) {
QMenu *root_menu = menu()->addMenu(root->icon(), root->title());
foreach (const QString &url, m_addresses) {

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -35,7 +35,7 @@ class DiscoverFeedsButton : public QToolButton {
private slots:
// User chose any of addresses.
void linkTriggered(QAction *action);
void linkTriggered(const QAction *action);
void fillMenu();
private:

22
src/gui/edittableview.cpp Normal file → Executable file
View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -38,27 +38,27 @@ void EditTableView::removeSelected() {
return;
}
QModelIndexList selectedRows = selectionModel()->selectedRows();
const QModelIndexList selected_rows = selectionModel()->selectedRows();
if (selectedRows.isEmpty()) {
if (selected_rows.isEmpty()) {
return;
}
int newSelectedRow = selectedRows.at(0).row();
const int new_selected_row = selected_rows.at(0).row();
for (int i = selectedRows.count() - 1; i >= 0; i--) {
QModelIndex idx = selectedRows.at(i);
for (int i = selected_rows.count() - 1; i >= 0; i--) {
QModelIndex idx = selected_rows.at(i);
model()->removeRow(idx.row(), rootIndex());
}
QModelIndex newSelectedIndex = model()->index(newSelectedRow, 0, rootIndex());
QModelIndex new_selected_index = model()->index(new_selected_row, 0, rootIndex());
if (!newSelectedIndex.isValid()) {
newSelectedIndex = model()->index(newSelectedRow - 1, 0, rootIndex());
if (!new_selected_index.isValid()) {
new_selected_index = model()->index(new_selected_row - 1, 0, rootIndex());
}
selectionModel()->select(newSelectedIndex, QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows);
setCurrentIndex(newSelectedIndex);
selectionModel()->select(new_selected_index, QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows);
setCurrentIndex(new_selected_index);
}
void EditTableView::removeAll() {

7
src/gui/edittableview.h Normal file → Executable file
View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -27,11 +27,12 @@ class EditTableView : public QTableView {
public:
explicit EditTableView(QWidget *parent = 0);
void keyPressEvent(QKeyEvent *event);
public slots:
void removeSelected();
void removeAll();
private:
void keyPressEvent(QKeyEvent *event);
};
#endif // EDITTABLEVIEW_H

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -100,8 +100,8 @@ void FeedMessageViewer::saveSize() {
}
void FeedMessageViewer::loadSize() {
Settings *settings = qApp->settings();
int default_msg_section_size = m_messagesView->header()->defaultSectionSize();
const Settings *settings = qApp->settings();
const int default_msg_section_size = m_messagesView->header()->defaultSectionSize();
// Restore offsets of splitters.
m_feedSplitter->restoreState(QByteArray::fromBase64(settings->value(GROUP(GUI), SETTING(GUI::SplitterFeeds)).toString().toLocal8Bit()));
@ -117,7 +117,7 @@ void FeedMessageViewer::loadSize() {
}
void FeedMessageViewer::loadMessageViewerFonts() {
Settings *settings = qApp->settings();
const Settings *settings = qApp->settings();
QWebSettings *view_settings = m_messagesBrowser->view()->settings();
view_settings->setFontFamily(QWebSettings::StandardFont, settings->value(GROUP(Messages),
@ -163,7 +163,7 @@ void FeedMessageViewer::switchFeedComponentVisibility() {
}
void FeedMessageViewer::toggleShowOnlyUnreadFeeds() {
QAction *origin = qobject_cast<QAction*>(sender());
const QAction *origin = qobject_cast<QAction*>(sender());
if (origin == NULL) {
m_feedsView->model()->invalidateReadFeedsFilter(true, false);
@ -174,10 +174,10 @@ void FeedMessageViewer::toggleShowOnlyUnreadFeeds() {
}
void FeedMessageViewer::updateMessageButtonsAvailability() {
bool one_message_selected = m_messagesView->selectionModel()->selectedRows().size() == 1;
bool atleast_one_message_selected = !m_messagesView->selectionModel()->selectedRows().isEmpty();
bool bin_loaded = m_messagesView->sourceModel()->loadedItem() != NULL && m_messagesView->sourceModel()->loadedItem()->kind() == RootItemKind::Bin;
FormMain *form_main = qApp->mainForm();
const bool one_message_selected = m_messagesView->selectionModel()->selectedRows().size() == 1;
const bool atleast_one_message_selected = !m_messagesView->selectionModel()->selectedRows().isEmpty();
const bool bin_loaded = m_messagesView->sourceModel()->loadedItem() != NULL && m_messagesView->sourceModel()->loadedItem()->kind() == RootItemKind::Bin;
const FormMain *form_main = qApp->mainForm();
form_main->m_ui->m_actionDeleteSelectedMessages->setEnabled(atleast_one_message_selected);
form_main->m_ui->m_actionRestoreSelectedMessages->setEnabled(atleast_one_message_selected && bin_loaded);
@ -191,13 +191,13 @@ void FeedMessageViewer::updateMessageButtonsAvailability() {
}
void FeedMessageViewer::updateFeedButtonsAvailability() {
bool critical_action_running = qApp->feedUpdateLock()->isLocked();
RootItem *selected_item = feedsView()->selectedItem();
bool anything_selected = selected_item != NULL;
bool feed_selected = anything_selected && selected_item->kind() == RootItemKind::Feed;
bool category_selected = anything_selected && selected_item->kind() == RootItemKind::Category;
bool service_selected = anything_selected && selected_item->kind() == RootItemKind::ServiceRoot;
FormMain *form_main = qApp->mainForm();
const bool critical_action_running = qApp->feedUpdateLock()->isLocked();
const RootItem *selected_item = feedsView()->selectedItem();
const bool anything_selected = selected_item != NULL;
const bool feed_selected = anything_selected && selected_item->kind() == RootItemKind::Feed;
const bool category_selected = anything_selected && selected_item->kind() == RootItemKind::Category;
const bool service_selected = anything_selected && selected_item->kind() == RootItemKind::ServiceRoot;
const FormMain *form_main = qApp->mainForm();
form_main->m_ui->m_actionBackupDatabaseSettings->setEnabled(!critical_action_running);
form_main->m_ui->m_actionCleanupDatabase->setEnabled(!critical_action_running);
@ -221,7 +221,7 @@ void FeedMessageViewer::updateFeedButtonsAvailability() {
}
void FeedMessageViewer::createConnections() {
FormMain *form_main = qApp->mainForm();
const FormMain *form_main = qApp->mainForm();
// Filtering & searching.
connect(m_toolBarMessages, SIGNAL(messageSearchPatternChanged(QString)), m_messagesView, SLOT(searchMessages(QString)));
@ -406,11 +406,10 @@ void FeedMessageViewer::initializeViews() {
void FeedMessageViewer::showDbCleanupAssistant() {
if (qApp->feedUpdateLock()->tryLock()) {
QPointer<FormDatabaseCleanup> form_pointer = new FormDatabaseCleanup(this);
QScopedPointer<FormDatabaseCleanup> form_pointer(new FormDatabaseCleanup(this));
form_pointer.data()->setCleaner(m_feedsView->sourceModel()->databaseCleaner());
form_pointer.data()->exec();
delete form_pointer.data();
qApp->feedUpdateLock()->unlock();
m_messagesView->reloadSelections(false);
@ -424,7 +423,7 @@ void FeedMessageViewer::showDbCleanupAssistant() {
}
void FeedMessageViewer::refreshVisualProperties() {
Qt::ToolButtonStyle button_style = static_cast<Qt::ToolButtonStyle>(qApp->settings()->value(GROUP(GUI),
const Qt::ToolButtonStyle button_style = static_cast<Qt::ToolButtonStyle>(qApp->settings()->value(GROUP(GUI),
SETTING(GUI::ToolbarStyle)).toInt());
m_toolBarFeeds->setToolButtonStyle(button_style);

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -43,24 +43,24 @@ class FeedMessageViewer : public TabContent {
virtual ~FeedMessageViewer();
// WebBrowser getter from TabContent interface.
inline WebBrowser *webBrowser() {
inline WebBrowser *webBrowser() const {
return m_messagesBrowser;
}
// FeedsView getter.
inline FeedsView *feedsView() {
inline FeedsView *feedsView() const {
return m_feedsView;
}
inline MessagesView *messagesView() {
inline MessagesView *messagesView() const {
return m_messagesView;
}
inline MessagesToolBar *messagesToolBar() {
inline MessagesToolBar *messagesToolBar() const {
return m_toolBarMessages;
}
inline FeedsToolBar *feedsToolBar() {
inline FeedsToolBar *feedsToolBar() const {
return m_toolBarFeeds;
}

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

2
src/gui/feedstoolbar.h Normal file → Executable file
View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -75,7 +75,7 @@ void FeedsView::setSortingEnabled(bool enable) {
}
QList<Feed*> FeedsView::selectedFeeds() const {
QModelIndex current_index = currentIndex();
const QModelIndex current_index = currentIndex();
if (current_index.isValid()) {
return m_sourceModel->feedsForIndex(m_proxyModel->mapToSource(current_index));
@ -85,12 +85,8 @@ QList<Feed*> FeedsView::selectedFeeds() const {
}
}
QList<Feed*> FeedsView::allFeeds() const {
return m_sourceModel->allFeeds();
}
RootItem *FeedsView::selectedItem() const {
QModelIndexList selected_rows = selectionModel()->selectedRows();
const QModelIndexList selected_rows = selectionModel()->selectedRows();
if (selected_rows.isEmpty()) {
return NULL;
@ -114,7 +110,7 @@ void FeedsView::saveExpandStates(RootItem *item) {
QList<RootItem*> items = item->getSubTree(RootItemKind::Category | RootItemKind::ServiceRoot);
// Iterate all categories and save their expand statuses.
foreach (RootItem *item, items) {
foreach (const RootItem *item, items) {
const QString setting_name = item->hashCode();
settings->setValue(GROUP(CategoriesExpandStates),
@ -124,13 +120,13 @@ void FeedsView::saveExpandStates(RootItem *item) {
}
void FeedsView::loadAllExpandStates() {
Settings *settings = qApp->settings();
const Settings *settings = qApp->settings();
QList<RootItem*> expandable_items;
expandable_items.append(sourceModel()->rootItem()->getSubTree(RootItemKind::Category | RootItemKind::ServiceRoot));
// Iterate all categories and save their expand statuses.
foreach (RootItem *item, expandable_items) {
foreach (const RootItem *item, expandable_items) {
const QString setting_name = item->hashCode();
setExpanded(model()->mapFromSource(sourceModel()->indexForItem(item)),
@ -142,7 +138,7 @@ void FeedsView::loadAllExpandStates() {
}
void FeedsView::addFeedIntoSelectedAccount() {
RootItem *selected = selectedItem();
const RootItem *selected = selectedItem();
if (selected != NULL) {
ServiceRoot *root = selected->getParentServiceRoot();
@ -160,7 +156,7 @@ void FeedsView::addFeedIntoSelectedAccount() {
}
void FeedsView::addCategoryIntoSelectedAccount() {
RootItem *selected = selectedItem();
const RootItem *selected = selectedItem();
if (selected != NULL) {
ServiceRoot *root = selected->getParentServiceRoot();
@ -246,9 +242,7 @@ void FeedsView::deleteSelectedItem() {
return;
}
QModelIndex current_index = currentIndex();
if (!current_index.isValid()) {
if (!currentIndex().isValid()) {
// Changes are done, unlock the update master lock and exit.
qApp->feedUpdateLock()->unlock();
return;
@ -313,7 +307,7 @@ void FeedsView::markAllItemsRead() {
}
void FeedsView::openSelectedItemsInNewspaperMode() {
QList<Message> messages = m_sourceModel->messagesForItem(selectedItem());
const QList<Message> messages = m_sourceModel->messagesForItem(selectedItem());
if (!messages.isEmpty()) {
emit openMessagesInNewspaperView(messages);
@ -322,7 +316,7 @@ void FeedsView::openSelectedItemsInNewspaperMode() {
}
void FeedsView::selectNextItem() {
QModelIndex index_next = moveCursor(QAbstractItemView::MoveDown, Qt::NoModifier);
const QModelIndex index_next = moveCursor(QAbstractItemView::MoveDown, Qt::NoModifier);
if (index_next.isValid()) {
setCurrentIndex(index_next);
@ -331,7 +325,7 @@ void FeedsView::selectNextItem() {
}
void FeedsView::selectPreviousItem() {
QModelIndex index_previous = moveCursor(QAbstractItemView::MoveUp, Qt::NoModifier);
const QModelIndex index_previous = moveCursor(QAbstractItemView::MoveUp, Qt::NoModifier);
if (index_previous.isValid()) {
setCurrentIndex(index_previous);
@ -474,10 +468,10 @@ void FeedsView::keyPressEvent(QKeyEvent *event) {
}
void FeedsView::contextMenuEvent(QContextMenuEvent *event) {
QModelIndex clicked_index = indexAt(event->pos());
const QModelIndex clicked_index = indexAt(event->pos());
if (clicked_index.isValid()) {
QModelIndex mapped_index = model()->mapToSource(clicked_index);
const QModelIndex mapped_index = model()->mapToSource(clicked_index);
RootItem *clicked_item = sourceModel()->itemForIndex(mapped_index);
if (clicked_item->kind() == RootItemKind::Category) {
@ -504,7 +498,7 @@ void FeedsView::saveSortState(int column, Qt::SortOrder order) {
}
void FeedsView::validateItemAfterDragDrop(const QModelIndex &source_index) {
QModelIndex mapped = m_proxyModel->mapFromSource(source_index);
const QModelIndex mapped = m_proxyModel->mapFromSource(source_index);
if (mapped.isValid()) {
expand(mapped);
@ -513,7 +507,7 @@ void FeedsView::validateItemAfterDragDrop(const QModelIndex &source_index) {
}
void FeedsView::onItemExpandRequested(const QList<RootItem*> &items, bool exp) {
foreach (RootItem *item, items) {
foreach (const RootItem *item, items) {
QModelIndex source_index = m_sourceModel->indexForItem(item);
QModelIndex proxy_index = m_proxyModel->mapFromSource(source_index);

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -38,11 +38,11 @@ class FeedsView : public QTreeView {
virtual ~FeedsView();
// Fundamental accessors.
inline FeedsProxyModel *model() {
inline FeedsProxyModel *model() const {
return m_proxyModel;
}
inline FeedsModel *sourceModel() {
inline FeedsModel *sourceModel() const {
return m_sourceModel;
}
@ -51,7 +51,6 @@ class FeedsView : public QTreeView {
// Returns list of selected/all feeds.
// NOTE: This is recursive method which returns all descendants.
QList<Feed*> selectedFeeds() const;
QList<Feed*> allFeeds() const;
// Returns pointers to selected feed/category if they are really
// selected.

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

2
src/gui/labelwithstatus.h Normal file → Executable file
View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

4
src/gui/lineeditwithstatus.cpp Normal file → Executable file
View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -30,7 +30,7 @@ LineEditWithStatus::LineEditWithStatus(QWidget *parent)
setFocusProxy(m_wdgInput);
// Set correct size for the tool button.
int txt_input_height = m_wdgInput->sizeHint().height();
const int txt_input_height = m_wdgInput->sizeHint().height();
m_btnStatus->setFixedSize(txt_input_height, txt_input_height);
// Compose the layout.

2
src/gui/lineeditwithstatus.h Normal file → Executable file
View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -35,9 +35,8 @@ MessageBox::~MessageBox() {
void MessageBox::setIcon(QMessageBox::Icon icon) {
// Determine correct status icon size.
int icon_size = qApp->style()->pixelMetric(QStyle::PM_MessageBoxIconSize,
0,
this);
const int icon_size = qApp->style()->pixelMetric(QStyle::PM_MessageBoxIconSize, 0, this);
// Setup status icon.
setIconPixmap(iconForStatus(icon).pixmap(icon_size, icon_size));
}

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

2
src/gui/messagessearchlineedit.cpp Normal file → Executable file
View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

2
src/gui/messagessearchlineedit.h Normal file → Executable file
View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -74,9 +74,9 @@ void MessagesView::keyboardSearch(const QString &search) {
void MessagesView::reloadSelections(bool mark_current_index_read) {
QModelIndex current_index = selectionModel()->currentIndex();
QModelIndex mapped_current_index = m_proxyModel->mapToSource(current_index);
const QModelIndex mapped_current_index = m_proxyModel->mapToSource(current_index);
QModelIndexList selected_indexes = selectionModel()->selectedRows();
QModelIndexList mapped_indexes = m_proxyModel->mapListToSource(selected_indexes);
const QModelIndexList mapped_indexes = m_proxyModel->mapListToSource(selected_indexes);
// Reload the model now.
m_sourceModel->fetchAllData();
@ -134,7 +134,7 @@ void MessagesView::keyPressEvent(QKeyEvent *event) {
}
void MessagesView::contextMenuEvent(QContextMenuEvent *event) {
QModelIndex clicked_index = indexAt(event->pos());
const QModelIndex clicked_index = indexAt(event->pos());
if (!clicked_index.isValid()) {
qDebug("Context menu for MessagesView will not be shown because user clicked on invalid item.");
@ -175,10 +175,10 @@ void MessagesView::mousePressEvent(QMouseEvent *event) {
case Qt::LeftButton: {
// Make sure that message importance is switched when user
// clicks the "important" column.
QModelIndex clicked_index = indexAt(event->pos());
const QModelIndex clicked_index = indexAt(event->pos());
if (clicked_index.isValid()) {
QModelIndex mapped_index = m_proxyModel->mapToSource(clicked_index);
const QModelIndex mapped_index = m_proxyModel->mapToSource(clicked_index);
if (mapped_index.column() == MSG_DB_IMPORTANT_INDEX) {
m_sourceModel->switchMessageImportance(mapped_index.row());
@ -200,9 +200,9 @@ void MessagesView::mousePressEvent(QMouseEvent *event) {
}
void MessagesView::selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) {
QModelIndexList selected_rows = selectionModel()->selectedRows();
QModelIndex current_index = currentIndex();
QModelIndex mapped_current_index = m_proxyModel->mapToSource(current_index);
const QModelIndexList selected_rows = selectionModel()->selectedRows();
const QModelIndex current_index = currentIndex();
const QModelIndex mapped_current_index = m_proxyModel->mapToSource(current_index);
qDebug("Current row changed - row [%d,%d] source [%d, %d].",
current_index.row(), current_index.column(),
@ -231,8 +231,8 @@ void MessagesView::selectionChanged(const QItemSelection &selected, const QItemS
void MessagesView::loadItem(RootItem *item) {
m_sourceModel->loadMessages(item);
int col = qApp->settings()->value(GROUP(GUI), SETTING(GUI::DefaultSortColumnMessages)).toInt();
Qt::SortOrder ord = static_cast<Qt::SortOrder>(qApp->settings()->value(GROUP(GUI), SETTING(GUI::DefaultSortOrderMessages)).toInt());
const int col = qApp->settings()->value(GROUP(GUI), SETTING(GUI::DefaultSortColumnMessages)).toInt();
const Qt::SortOrder ord = static_cast<Qt::SortOrder>(qApp->settings()->value(GROUP(GUI), SETTING(GUI::DefaultSortOrderMessages)).toInt());
sortByColumn(col, ord);
@ -247,7 +247,7 @@ void MessagesView::loadItem(RootItem *item) {
void MessagesView::openSelectedSourceMessagesExternally() {
foreach (const QModelIndex &index, selectionModel()->selectedRows()) {
QString link = m_sourceModel->messageAt(m_proxyModel->mapToSource(index).row()).m_url;
const QString link = m_sourceModel->messageAt(m_proxyModel->mapToSource(index).row()).m_url;
if (!WebFactory::instance()->openUrlInExternalBrowser(link)) {
qApp->showGuiMessage(tr("Problem with starting external web browser"),
@ -265,7 +265,7 @@ void MessagesView::openSelectedSourceMessagesExternally() {
void MessagesView::openSelectedSourceMessagesInternally() {
foreach (const QModelIndex &index, selectionModel()->selectedRows()) {
Message message = m_sourceModel->messageAt(m_proxyModel->mapToSource(index).row());
const Message message = m_sourceModel->messageAt(m_proxyModel->mapToSource(index).row());
if (message.m_url.isEmpty()) {
MessageBox::show(this,
@ -308,7 +308,7 @@ void MessagesView::openSelectedMessagesInternally() {
void MessagesView::sendSelectedMessageViaEmail() {
if (selectionModel()->selectedRows().size() == 1) {
Message message = m_sourceModel->messageAt(m_proxyModel->mapToSource(selectionModel()->selectedRows().at(0)).row());
const Message message = m_sourceModel->messageAt(m_proxyModel->mapToSource(selectionModel()->selectedRows().at(0)).row());
if (!WebFactory::instance()->sendMessageViaEmail(message)) {
MessageBox::show(this,
@ -334,9 +334,9 @@ void MessagesView::setSelectedMessagesReadStatus(RootItem::ReadStatus read) {
return;
}
QModelIndex mapped_current_index = m_proxyModel->mapToSource(current_index);
const QModelIndex mapped_current_index = m_proxyModel->mapToSource(current_index);
QModelIndexList selected_indexes = selectionModel()->selectedRows();
QModelIndexList mapped_indexes = m_proxyModel->mapListToSource(selected_indexes);
const QModelIndexList mapped_indexes = m_proxyModel->mapListToSource(selected_indexes);
m_sourceModel->setBatchMessagesRead(mapped_indexes, read);
sortByColumn(header()->sortIndicatorSection(), header()->sortIndicatorOrder());
@ -357,21 +357,22 @@ void MessagesView::setSelectedMessagesReadStatus(RootItem::ReadStatus read) {
}
void MessagesView::deleteSelectedMessages() {
QModelIndex current_index = selectionModel()->currentIndex();
const QModelIndex current_index = selectionModel()->currentIndex();
if (!current_index.isValid()) {
return;
}
QModelIndexList selected_indexes = selectionModel()->selectedRows();
QModelIndexList mapped_indexes = m_proxyModel->mapListToSource(selected_indexes);
const QModelIndexList selected_indexes = selectionModel()->selectedRows();
const QModelIndexList mapped_indexes = m_proxyModel->mapListToSource(selected_indexes);
m_sourceModel->setBatchMessagesDeleted(mapped_indexes);
sortByColumn(header()->sortIndicatorSection(), header()->sortIndicatorOrder());
int row_count = m_sourceModel->rowCount();
const int row_count = m_sourceModel->rowCount();
if (row_count > 0) {
QModelIndex last_item = current_index.row() < row_count ?
const QModelIndex last_item = current_index.row() < row_count ?
m_proxyModel->index(current_index.row(), MSG_DB_TITLE_INDEX) :
m_proxyModel->index(row_count - 1, MSG_DB_TITLE_INDEX);
@ -385,21 +386,22 @@ void MessagesView::deleteSelectedMessages() {
}
void MessagesView::restoreSelectedMessages() {
QModelIndex current_index = selectionModel()->currentIndex();
const QModelIndex current_index = selectionModel()->currentIndex();
if (!current_index.isValid()) {
return;
}
QModelIndexList selected_indexes = selectionModel()->selectedRows();
QModelIndexList mapped_indexes = m_proxyModel->mapListToSource(selected_indexes);
const QModelIndexList selected_indexes = selectionModel()->selectedRows();
const QModelIndexList mapped_indexes = m_proxyModel->mapListToSource(selected_indexes);
m_sourceModel->setBatchMessagesRestored(mapped_indexes);
sortByColumn(header()->sortIndicatorSection(), header()->sortIndicatorOrder());
int row_count = m_sourceModel->rowCount();
if (row_count > 0) {
QModelIndex last_item = current_index.row() < row_count ?
const QModelIndex last_item = current_index.row() < row_count ?
m_proxyModel->index(current_index.row(), MSG_DB_TITLE_INDEX) :
m_proxyModel->index(row_count - 1, MSG_DB_TITLE_INDEX);
@ -419,9 +421,9 @@ void MessagesView::switchSelectedMessagesImportance() {
return;
}
QModelIndex mapped_current_index = m_proxyModel->mapToSource(current_index);
const QModelIndex mapped_current_index = m_proxyModel->mapToSource(current_index);
QModelIndexList selected_indexes = selectionModel()->selectedRows();
QModelIndexList mapped_indexes = m_proxyModel->mapListToSource(selected_indexes);
const QModelIndexList mapped_indexes = m_proxyModel->mapListToSource(selected_indexes);
m_sourceModel->switchBatchMessageImportance(mapped_indexes);
sortByColumn(header()->sortIndicatorSection(), header()->sortIndicatorOrder());
@ -450,7 +452,7 @@ void MessagesView::reselectIndexes(const QModelIndexList &indexes) {
}
void MessagesView::selectNextItem() {
QModelIndex index_next = moveCursor(QAbstractItemView::MoveDown, Qt::NoModifier);
const QModelIndex index_next = moveCursor(QAbstractItemView::MoveDown, Qt::NoModifier);
if (index_next.isValid()) {
setCurrentIndex(index_next);
@ -460,7 +462,7 @@ void MessagesView::selectNextItem() {
}
void MessagesView::selectPreviousItem() {
QModelIndex index_previous = moveCursor(QAbstractItemView::MoveUp, Qt::NoModifier);
const QModelIndex index_previous = moveCursor(QAbstractItemView::MoveUp, Qt::NoModifier);
if (index_previous.isValid()) {
setCurrentIndex(index_previous);
@ -472,7 +474,7 @@ void MessagesView::selectPreviousItem() {
void MessagesView::selectNextUnreadItem() {
// FIXME: Use this to solve #112.
QModelIndexList selected_rows = selectionModel()->selectedRows();
const QModelIndexList selected_rows = selectionModel()->selectedRows();
int active_row;
if (!selected_rows.isEmpty()) {
@ -483,7 +485,7 @@ void MessagesView::selectNextUnreadItem() {
active_row = 0;
}
QModelIndex next_unread = m_proxyModel->getNextPreviousUnreadItemIndex(active_row);
const QModelIndex next_unread = m_proxyModel->getNextPreviousUnreadItemIndex(active_row);
if (next_unread.isValid()) {
// We found unread message, mark it.

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -39,11 +39,11 @@ class MessagesView : public QTreeView {
void setSortingEnabled(bool enable);
// Model accessors.
inline MessagesProxyModel *model() {
inline MessagesProxyModel *model() const {
return m_proxyModel;
}
inline MessagesModel *sourceModel() {
inline MessagesModel *sourceModel() const {
return m_sourceModel;
}

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -86,7 +86,7 @@ class Notification : public QWidget {
int m_widgetMargin;
int m_timerId;
QObject *m_clickTarget;
const QObject *m_clickTarget;
const char *m_clickSlot;
#if defined(Q_OS_LINUX)

4
src/gui/plaintoolbutton.cpp Normal file → Executable file
View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -39,7 +39,6 @@ void PlainToolButton::paintEvent(QPaintEvent *e) {
// Set padding.
rect.adjust(m_padding, m_padding, -m_padding, -m_padding);
// Paint the icon.
if (underMouse() || isChecked()) {
p.setOpacity(0.7);
@ -61,4 +60,3 @@ void PlainToolButton::setChecked(bool checked) {
QToolButton::setChecked(checked);
repaint();
}

2
src/gui/plaintoolbutton.h Normal file → Executable file
View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

2
src/gui/squeezelabel.cpp Normal file → Executable file
View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

2
src/gui/squeezelabel.h Normal file → Executable file
View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

5
src/gui/styleditemdelegatewithoutfocus.cpp Normal file → Executable file
View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -24,7 +24,8 @@ StyledItemDelegateWithoutFocus::StyledItemDelegateWithoutFocus(QObject *parent)
StyledItemDelegateWithoutFocus::~StyledItemDelegateWithoutFocus() {
}
void StyledItemDelegateWithoutFocus::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const {
void StyledItemDelegateWithoutFocus::paint(QPainter *painter, const QStyleOptionViewItem &option,
const QModelIndex &index) const {
QStyleOptionViewItemV4 itemOption(option);
if (itemOption.state & QStyle::State_HasFocus) {

4
src/gui/styleditemdelegatewithoutfocus.h Normal file → Executable file
View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -28,7 +28,7 @@ class StyledItemDelegateWithoutFocus : public QStyledItemDelegate {
explicit StyledItemDelegateWithoutFocus(QObject *parent = 0);
virtual ~StyledItemDelegateWithoutFocus();
void paint(QPainter* painter, const QStyleOptionViewItem & option, const QModelIndex &index) const;
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
};

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -41,6 +41,7 @@ bool TrayIconMenu::event(QEvent *event) {
tr("Close opened modal dialogs first."),
QSystemTrayIcon::Warning, qApp->mainForm(), true);
}
return QMenu::event(event);
}
#endif
@ -75,6 +76,7 @@ void SystemTrayIcon::onActivated(const QSystemTrayIcon::ActivationReason &reason
case SystemTrayIcon::DoubleClick:
case SystemTrayIcon::MiddleClick:
static_cast<FormMain*>(parent())->switchVisibility();
break;
default:
break;
@ -153,8 +155,8 @@ void SystemTrayIcon::setNumber(int number, bool any_new_message) {
tray_painter.setFont(m_font);
tray_painter.drawText(QRect(0, 0, 128, 128), Qt::AlignVCenter | Qt::AlignCenter, QString::number(number));
}
tray_painter.end();
tray_painter.end();
QSystemTrayIcon::setIcon(QIcon(background));
}
}

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -47,7 +47,7 @@ void TabBar::setTabType(int index, const TabBar::TabType &type) {
close_button->setFixedSize(iconSize());
// Close underlying tab when button is clicked.
connect(close_button, SIGNAL(clicked()),this, SLOT(closeTabViaButton()));
connect(close_button, SIGNAL(clicked()), this, SLOT(closeTabViaButton()));
setTabButton(index, QTabBar::RightSide, close_button);
break;
}
@ -63,8 +63,8 @@ void TabBar::setTabType(int index, const TabBar::TabType &type) {
}
void TabBar::closeTabViaButton() {
QAbstractButton *close_button = qobject_cast<QAbstractButton*>(sender());
QTabBar::ButtonPosition button_position = static_cast<ButtonPosition>(style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition,
const QAbstractButton *close_button = qobject_cast<QAbstractButton*>(sender());
const QTabBar::ButtonPosition button_position = static_cast<ButtonPosition>(style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition,
0,
this));
@ -81,8 +81,8 @@ void TabBar::closeTabViaButton() {
}
void TabBar::wheelEvent(QWheelEvent *event) {
int current_index = currentIndex();
int number_of_tabs = count();
const int current_index = currentIndex();
const int number_of_tabs = count();
// Make sure rotating works.
if (number_of_tabs > 1) {
@ -104,7 +104,7 @@ void TabBar::wheelEvent(QWheelEvent *event) {
void TabBar::mousePressEvent(QMouseEvent *event) {
QTabBar::mousePressEvent(event);
int tab_index = tabAt(event->pos());
const int tab_index = tabAt(event->pos());
// Check if user clicked on some tab or on empty space.
if (tab_index >= 0) {
@ -123,7 +123,7 @@ void TabBar::mousePressEvent(QMouseEvent *event) {
void TabBar::mouseDoubleClickEvent(QMouseEvent *event) {
QTabBar::mouseDoubleClickEvent(event);
int tab_index = tabAt(event->pos());
const int tab_index = tabAt(event->pos());
// Check if user clicked on some tab or on empty space.
if (tab_index >= 0) {

8
src/gui/tabbar.h Normal file → Executable file
View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -42,15 +42,15 @@ class TabBar : public QTabBar {
// Getter/setter for tab type.
void setTabType(int index, const TabBar::TabType &type);
inline TabBar::TabType tabType(int index) {
inline TabBar::TabType tabType(int index) const {
return static_cast<TabBar::TabType>(tabData(index).value<int>());
}
protected slots:
private slots:
// Called when user selects to close tab via close button.
void closeTabViaButton();
protected:
private:
// Reimplementations.
void mouseDoubleClickEvent(QMouseEvent *event);
void mousePressEvent(QMouseEvent *event);

2
src/gui/tabcontent.cpp Normal file → Executable file
View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

4
src/gui/tabcontent.h Normal file → Executable file
View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -45,7 +45,7 @@ class TabContent : public QWidget {
// Obtains instance contained in this TabContent or nullptr.
// This can be used for obtaining the menu from the instance and so on.
virtual WebBrowser *webBrowser() = 0;
virtual WebBrowser *webBrowser() const = 0;
protected:
int m_index;

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -77,7 +77,7 @@ void TabWidget::openMainMenu() {
}
QPoint button_position = m_btnMainMenu->pos();
QSize target_size = m_btnMainMenu->size() / 2.0;
const QSize target_size = m_btnMainMenu->size() / 2.0;
button_position.setX(button_position.x() + target_size.width());
button_position.setY(button_position.y() + target_size.height());
@ -87,7 +87,7 @@ void TabWidget::openMainMenu() {
void TabWidget::showDownloadManager() {
for (int i = 0; i < count(); i++) {
if (QString(widget(i)->metaObject()->className()) == "DownloadManager") {
if (widget(i)->metaObject()->className() == QSL("DownloadManager")) {
setCurrentIndex(i);
return;
}
@ -100,7 +100,7 @@ void TabWidget::showDownloadManager() {
}
void TabWidget::checkTabBarVisibility() {
bool should_be_visible = count() > 1 || !qApp->settings()->value(GROUP(GUI), SETTING(GUI::HideTabBarIfOnlyOneTab)).toBool();
const bool should_be_visible = count() > 1 || !qApp->settings()->value(GROUP(GUI), SETTING(GUI::HideTabBarIfOnlyOneTab)).toBool();
if (should_be_visible) {
setCornerWidget(m_btnMainMenu, Qt::TopLeftCorner);
@ -124,7 +124,7 @@ void TabWidget::tabInserted(int index) {
QTabWidget::tabInserted(index);
checkTabBarVisibility();
int count_of_tabs = count();
const int count_of_tabs = count();
if (index < count_of_tabs - 1 && count_of_tabs > 1) {
// New tab was inserted and the tab is not the last one.
@ -136,7 +136,7 @@ void TabWidget::tabRemoved(int index) {
QTabWidget::tabRemoved(index);
checkTabBarVisibility();
int count_of_tabs = count();
const int count_of_tabs = count();
if (index < count_of_tabs && count_of_tabs > 1) {
// Some tab was removed and the tab was not the last one.
@ -153,7 +153,7 @@ void TabWidget::createConnections() {
void TabWidget::initializeTabs() {
// Create widget for "Feeds" page and add it.
m_feedMessageViewer = new FeedMessageViewer(this);
int index_of_browser = addTab(static_cast<TabContent*>(m_feedMessageViewer),
const int index_of_browser = addTab(static_cast<TabContent*>(m_feedMessageViewer),
QIcon(),
tr("Feeds"),
TabBar::FeedReader);
@ -170,7 +170,8 @@ void TabWidget::setupIcons() {
}
// Other indexes probably contain WebBrowsers.
else {
WebBrowser *active_browser = widget(index)->webBrowser();
const WebBrowser *active_browser = widget(index)->webBrowser();
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.
@ -242,35 +243,35 @@ void TabWidget::removeTab(int index, bool clear_from_memory) {
}
int TabWidget::addTab(TabContent *widget, const QIcon &icon, const QString &label, const TabBar::TabType &type) {
int index = QTabWidget::addTab(widget, icon, label);
const int index = QTabWidget::addTab(widget, icon, label);
tabBar()->setTabType(index, type);
return index;
}
int TabWidget::addTab(TabContent *widget, const QString &label, const TabBar::TabType &type) {
int index = QTabWidget::addTab(widget, label);
const int index = QTabWidget::addTab(widget, label);
tabBar()->setTabType(index, type);
return index;
}
int TabWidget::insertTab(int index, QWidget *widget, const QIcon &icon, const QString &label, const TabBar::TabType &type) {
int tab_index = QTabWidget::insertTab(index, widget, icon, label);
const int tab_index = QTabWidget::insertTab(index, widget, icon, label);
tabBar()->setTabType(tab_index, type);
return tab_index;
}
int TabWidget::insertTab(int index, QWidget *widget, const QString &label, const TabBar::TabType &type) {
int tab_index = QTabWidget::insertTab(index, widget, label);
const int tab_index = QTabWidget::insertTab(index, widget, label);
tabBar()->setTabType(tab_index, type);
return tab_index;
}
int TabWidget::addBrowserWithMessages(const QList<Message> &messages) {
int new_index = addBrowser(false, true);
const int new_index = addBrowser(false, true);
WebBrowser *browser = static_cast<WebBrowser*>(widget(new_index));
browser->setNavigationBarVisible(false);

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -50,7 +50,7 @@ class TabWidget : public QTabWidget {
void removeTab(int index, bool clear_from_memory);
// Returns tab bar.
inline TabBar *tabBar() {
inline TabBar *tabBar() const {
return static_cast<TabBar*>(QTabWidget::tabBar());
}
@ -105,6 +105,7 @@ class TabWidget : public QTabWidget {
// Opens main menu.
void openMainMenu();
// Displays download manager.
void showDownloadManager();
// Closes all "closable" tabs except the active tab.

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -46,7 +46,6 @@ ToolBarEditor::ToolBarEditor(QWidget *parent)
}
ToolBarEditor::~ToolBarEditor() {
delete m_ui;
}
void ToolBarEditor::loadFromToolBar(BaseToolBar *tool_bar) {
@ -55,7 +54,7 @@ void ToolBarEditor::loadFromToolBar(BaseToolBar *tool_bar) {
QList<QAction*> activated_actions = m_toolBar->changeableActions();
QList<QAction*> available_actions = m_toolBar->availableActions();
foreach (QAction *action, activated_actions) {
foreach (const QAction *action, activated_actions) {
QListWidgetItem *action_item = new QListWidgetItem(action->icon(), action->text().replace('&', ""), m_ui->m_listActivatedActions);
if (action->isSeparator()) {
@ -115,7 +114,7 @@ void ToolBarEditor::saveToolBar() {
bool ToolBarEditor::eventFilter(QObject *object, QEvent *event) {
if (object == m_ui->m_listActivatedActions) {
if (event->type() == QEvent::KeyPress) {
QKeyEvent *key_event = static_cast<QKeyEvent*>(event);
const QKeyEvent *key_event = static_cast<QKeyEvent*>(event);
if (key_event->key() == Qt::Key_Delete) {
deleteSelectedAction();
@ -146,7 +145,7 @@ void ToolBarEditor::updateActionsAvailability() {
}
void ToolBarEditor::insertSpacer() {
int current_row = m_ui->m_listActivatedActions->currentRow();
const int current_row = m_ui->m_listActivatedActions->currentRow();
QListWidgetItem *item = new QListWidgetItem(tr("Toolbar spacer"));
item->setIcon(qApp->icons()->fromTheme(QSL("view-spacer")));
@ -157,7 +156,7 @@ void ToolBarEditor::insertSpacer() {
}
void ToolBarEditor::insertSeparator() {
int current_row = m_ui->m_listActivatedActions->currentRow();
const int current_row = m_ui->m_listActivatedActions->currentRow();
QListWidgetItem *item = new QListWidgetItem(tr("Separator"));
item->setData(Qt::UserRole, SEPARATOR_ACTION_NAME);
@ -212,7 +211,7 @@ void ToolBarEditor::deleteSelectedAction() {
if (items.size() == 1) {
QListWidgetItem *selected_item = items.at(0);
QString data_item = selected_item->data(Qt::UserRole).toString();
const QString data_item = selected_item->data(Qt::UserRole).toString();
if (data_item == SEPARATOR_ACTION_NAME || data_item == SPACER_ACTION_NAME) {
m_ui->m_listActivatedActions->takeItem(m_ui->m_listActivatedActions->row(selected_item));

8
src/gui/toolbareditor.h Normal file → Executable file
View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -41,11 +41,11 @@ class ToolBarEditor : public QWidget {
void loadFromToolBar(BaseToolBar *tool_bar);
void saveToolBar();
inline QListWidget *activeItemsWidget() {
inline QListWidget *activeItemsWidget() const {
return m_ui->m_listActivatedActions;
}
inline QListWidget *availableItemsWidget() {
inline QListWidget *availableItemsWidget() const {
return m_ui->m_listAvailableActions;
}
@ -67,7 +67,7 @@ class ToolBarEditor : public QWidget {
void deleteAllActions();
private:
Ui::ToolBarEditor *m_ui;
QScopedPointer<Ui::ToolBarEditor> m_ui;
BaseToolBar *m_toolBar;
};

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

Some files were not shown because too many files have changed in this diff Show more