All columns resizable, prepare for labels.

This commit is contained in:
Martin Rotter 2017-06-09 08:54:39 +02:00
parent ad5f3b8b74
commit 1ff2316370
9 changed files with 130 additions and 6 deletions

View File

@ -332,7 +332,9 @@ HEADERS += src/core/feeddownloader.h \
src/gui/guiutilities.h \
src/core/messagesmodelcache.h \
src/core/messagesmodelsqllayer.h \
src/gui/treeviewcolumnsmenu.h
src/gui/treeviewcolumnsmenu.h \
src/services/abstract/labelsrootitem.h \
src/services/abstract/label.h
SOURCES += src/core/feeddownloader.cpp \
src/core/feedsmodel.cpp \
@ -456,7 +458,9 @@ SOURCES += src/core/feeddownloader.cpp \
src/gui/guiutilities.cpp \
src/core/messagesmodelcache.cpp \
src/core/messagesmodelsqllayer.cpp \
src/gui/treeviewcolumnsmenu.cpp
src/gui/treeviewcolumnsmenu.cpp \
src/services/abstract/labelsrootitem.cpp \
src/services/abstract/label.cpp
FORMS += src/gui/toolbareditor.ui \
src/network-web/downloaditem.ui \

View File

@ -48,6 +48,7 @@
#define CLOSE_LOCK_TIMEOUT 500
#define DOWNLOAD_TIMEOUT 5000
#define MESSAGES_VIEW_DEFAULT_COL 170
#define MESSAGES_VIEW_MINIMUM_COL 36
#define FEEDS_VIEW_COLUMN_COUNT 2
#define FEED_DOWNLOADER_MAX_THREADS 6
#define DEFAULT_DAYS_TO_DELETE_MSG 14

View File

@ -151,8 +151,11 @@ void MessagesView::setupAppearance() {
setAllColumnsShowFocus(false);
setSelectionMode(QAbstractItemView::ExtendedSelection);
setItemDelegate(new StyledItemDelegateWithoutFocus(this));
header()->setDefaultSectionSize(MESSAGES_VIEW_DEFAULT_COL);
header()->setStretchLastSection(false);
header()->setMinimumSectionSize(MESSAGES_VIEW_MINIMUM_COL);
header()->setCascadingSectionResizes(false);
header()->setStretchLastSection(true);
header()->setSortIndicatorShown(true);
}
@ -510,13 +513,16 @@ void MessagesView::adjustColumns() {
header()->setSectionResizeMode(MSG_DB_DELETED_INDEX, QHeaderView::Interactive);
header()->setSectionResizeMode(MSG_DB_IMPORTANT_INDEX, QHeaderView::ResizeToContents);
header()->setSectionResizeMode(MSG_DB_FEED_TITLE_INDEX, QHeaderView::Interactive);
header()->setSectionResizeMode(MSG_DB_TITLE_INDEX, QHeaderView::Stretch);
header()->setSectionResizeMode(MSG_DB_TITLE_INDEX, QHeaderView::Interactive);
header()->setSectionResizeMode(MSG_DB_URL_INDEX, QHeaderView::Interactive);
header()->setSectionResizeMode(MSG_DB_AUTHOR_INDEX, QHeaderView::Interactive);
header()->setSectionResizeMode(MSG_DB_DCREATED_INDEX, QHeaderView::Interactive);
header()->setSectionResizeMode(MSG_DB_CONTENTS_INDEX, QHeaderView::Interactive);
header()->setSectionResizeMode(MSG_DB_PDELETED_INDEX, QHeaderView::Interactive);
//header()->resizeSection(MSG_DB_READ_INDEX, MESSAGES_VIEW_MINIMUM_COL);
//header()->resizeSection(MSG_DB_IMPORTANT_INDEX, MESSAGES_VIEW_MINIMUM_COL);
// Hide columns.
hideColumn(MSG_DB_ID_INDEX);
hideColumn(MSG_DB_DELETED_INDEX);

22
src/services/abstract/label.cpp Executable file
View File

@ -0,0 +1,22 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2017 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 "services/abstract/label.h"
Label::Label(RootItem *parent_item) : RootItem(parent_item) {
}

29
src/services/abstract/label.h Executable file
View File

@ -0,0 +1,29 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2017 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 LABEL_H
#define LABEL_H
#include "services/abstract/rootitem.h"
class Label : public RootItem {
public:
explicit Label(RootItem *parent_item = nullptr);
};
#endif // LABEL_H

View File

@ -0,0 +1,28 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2017 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 "services/abstract/labelsrootitem.h"
#include "miscellaneous/iconfactory.h"
LabelsRootItem::LabelsRootItem(RootItem *parent_item) : RootItem(parent_item) {
setTitle(tr("Labels"));
setIcon(qApp->icons()->fromTheme(QSL("stock_bookmark")));
setKind(RootItemKind::LabelsRoot);
}

View File

@ -0,0 +1,29 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2017 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 LABELSROOTITEM_H
#define LABELSROOTITEM_H
#include "services/abstract/rootitem.h"
class LabelsRootItem : public RootItem {
public:
explicit LabelsRootItem(RootItem *parent_item = nullptr);
};
#endif // LABELSROOTITEM_H

View File

@ -37,7 +37,8 @@ namespace RootItemKind {
Bin = 2,
Feed = 4,
Category = 8,
ServiceRoot = 16
ServiceRoot = 16,
LabelsRoot = 32
};
inline Kind operator|(Kind a, Kind b) {

View File

@ -27,6 +27,7 @@
#include "gui/messagebox.h"
#include "exceptions/applicationexception.h"
#include "services/abstract/recyclebin.h"
#include "services/abstract/labelsrootitem.h"
#include "services/standard/standardserviceentrypoint.h"
#include "services/standard/standardfeed.h"
#include "services/standard/standardcategory.h"
@ -175,7 +176,10 @@ void StandardServiceRoot::loadFromDatabase(){
assembleFeeds(feeds);
// As the last item, add recycle bin, which is needed.
appendChild(m_recycleBin);
appendChild(recycleBin());
//appendChild(new LabelsRootItem(this));
updateCounts(true);
}