No sort indicators.

This commit is contained in:
Martin Rotter 2014-10-02 20:34:21 +02:00
parent 7836756579
commit fbb4d0cd3d
6 changed files with 10 additions and 25 deletions

View File

@ -38,9 +38,7 @@ void FeedDownloader::updateFeeds(const QList<FeedsModelFeed*> &feeds) {
for (int i = 0, total = feeds.size(); i < total; i++) { for (int i = 0, total = feeds.size(); i < total; i++) {
feeds.at(i)->update(); feeds.at(i)->update();
qDebug("Made progress in feed updates: %d/%d (id of feed is %d).", i + 1, total, feeds.at(i)->id()); qDebug("Made progress in feed updates: %d/%d (id of feed is %d).", i + 1, total, feeds.at(i)->id());
emit progress(feeds.at(i), i + 1, total); emit progress(feeds.at(i), i + 1, total);
} }

View File

@ -19,7 +19,6 @@
#define FEEDDOWNLOADER_H #define FEEDDOWNLOADER_H
#include <QObject> #include <QObject>
#include <QPointer>
class FeedsModelFeed; class FeedsModelFeed;
@ -53,7 +52,7 @@ class FeedDownloader : public QObject {
// Emitted if any item is processed. // Emitted if any item is processed.
// "Current" number indicates count of processed feeds // "Current" number indicates count of processed feeds
// and "total" number indicates total number of feeds // and "total" number indicates total number of feeds
// which are in the initial queue. // which were in the initial queue.
void progress(FeedsModelFeed *feed, int current, int total); void progress(FeedsModelFeed *feed, int current, int total);
}; };

View File

@ -32,7 +32,7 @@ FeedsProxyModel::FeedsProxyModel(QObject *parent)
setSortRole(Qt::EditRole); setSortRole(Qt::EditRole);
setSortCaseSensitivity(Qt::CaseInsensitive); setSortCaseSensitivity(Qt::CaseInsensitive);
setFilterCaseSensitivity(Qt::CaseInsensitive); setFilterCaseSensitivity(Qt::CaseInsensitive);
setFilterKeyColumn(0); setFilterKeyColumn(-1);
setFilterRole(Qt::EditRole); setFilterRole(Qt::EditRole);
setDynamicSortFilter(true); setDynamicSortFilter(true);
setSourceModel(m_sourceModel); setSourceModel(m_sourceModel);
@ -42,8 +42,7 @@ FeedsProxyModel::~FeedsProxyModel() {
qDebug("Destroying FeedsProxyModel instance"); qDebug("Destroying FeedsProxyModel instance");
} }
bool FeedsProxyModel::lessThan(const QModelIndex &left, bool FeedsProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const {
const QModelIndex &right) const {
if (left.isValid() && right.isValid()) { if (left.isValid() && right.isValid()) {
// Make necessary castings. // Make necessary castings.
FeedsModelRootItem *left_item = m_sourceModel->itemForIndex(left); FeedsModelRootItem *left_item = m_sourceModel->itemForIndex(left);
@ -63,8 +62,7 @@ bool FeedsProxyModel::lessThan(const QModelIndex &left,
} }
else { else {
// In other cases, sort by title. // In other cases, sort by title.
return QString::localeAwareCompare(left_item->title(), return QString::localeAwareCompare(left_item->title(), right_item->title()) < 0;
right_item->title()) < 0;
} }
} }
else if (left_item->kind() == FeedsModelRootItem::RecycleBin) { else if (left_item->kind() == FeedsModelRootItem::RecycleBin) {
@ -92,16 +90,6 @@ bool FeedsProxyModel::lessThan(const QModelIndex &left,
} }
} }
QModelIndexList FeedsProxyModel::mapListFromSource(const QModelIndexList &indexes) {
QModelIndexList mapped_indexes;
foreach (const QModelIndex &index, indexes) {
mapped_indexes << mapFromSource(index);
}
return mapped_indexes;
}
QModelIndexList FeedsProxyModel::mapListToSource(const QModelIndexList &indexes) { QModelIndexList FeedsProxyModel::mapListToSource(const QModelIndexList &indexes) {
QModelIndexList source_indexes; QModelIndexList source_indexes;

View File

@ -38,7 +38,6 @@ class FeedsProxyModel : public QSortFilterProxyModel {
// Maps list of indexes. // Maps list of indexes.
QModelIndexList mapListToSource(const QModelIndexList &indexes); QModelIndexList mapListToSource(const QModelIndexList &indexes);
QModelIndexList mapListFromSource(const QModelIndexList &indexes);
protected: protected:
// Compares two rows of data. // Compares two rows of data.

View File

@ -578,8 +578,6 @@ void FeedsView::setupAppearance() {
header()->setResizeMode(FDS_MODEL_COUNTS_INDEX, QHeaderView::ResizeToContents); header()->setResizeMode(FDS_MODEL_COUNTS_INDEX, QHeaderView::ResizeToContents);
#endif #endif
header()->setStretchLastSection(false);
header()->setSortIndicatorShown(false);
setUniformRowHeights(true); setUniformRowHeights(true);
setAnimated(true); setAnimated(true);
setSortingEnabled(true); setSortingEnabled(true);
@ -595,6 +593,8 @@ void FeedsView::setupAppearance() {
setRootIsDecorated(false); setRootIsDecorated(false);
setSelectionMode(QAbstractItemView::SingleSelection); setSelectionMode(QAbstractItemView::SingleSelection);
setItemDelegate(new StyledItemDelegateWithoutFocus(this)); setItemDelegate(new StyledItemDelegateWithoutFocus(this));
header()->setStretchLastSection(false);
header()->setSortIndicatorShown(false);
// Sort in ascending order, that is categories are // Sort in ascending order, that is categories are
// "bigger" than feeds. // "bigger" than feeds.

View File

@ -43,7 +43,6 @@ MessagesView::MessagesView(QWidget *parent)
createConnections(); createConnections();
setModel(m_proxyModel); setModel(m_proxyModel);
setupAppearance(); setupAppearance();
setItemDelegate(new StyledItemDelegateWithoutFocus(this));
} }
MessagesView::~MessagesView() { MessagesView::~MessagesView() {
@ -106,8 +105,6 @@ void MessagesView::reloadSelections(int mark_current_index_read) {
} }
void MessagesView::setupAppearance() { void MessagesView::setupAppearance() {
header()->setDefaultSectionSize(MESSAGES_VIEW_DEFAULT_COL);
header()->setStretchLastSection(false);
setUniformRowHeights(true); setUniformRowHeights(true);
setAcceptDrops(false); setAcceptDrops(false);
setDragEnabled(false); setDragEnabled(false);
@ -119,6 +116,10 @@ void MessagesView::setupAppearance() {
setSortingEnabled(true); setSortingEnabled(true);
setAllColumnsShowFocus(false); setAllColumnsShowFocus(false);
setSelectionMode(QAbstractItemView::ExtendedSelection); setSelectionMode(QAbstractItemView::ExtendedSelection);
setItemDelegate(new StyledItemDelegateWithoutFocus(this));
header()->setDefaultSectionSize(MESSAGES_VIEW_DEFAULT_COL);
header()->setStretchLastSection(false);
header()->setSortIndicatorShown(false);
} }
void MessagesView::keyPressEvent(QKeyEvent *event) { void MessagesView::keyPressEvent(QKeyEvent *event) {