mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
Add the possibility to show a recently added/updated indicator
This commit is contained in:
parent
11df4a9b42
commit
6a6a239cc7
@ -85,6 +85,7 @@ HEADERS += comic_flow.h \
|
||||
library_creator.h \
|
||||
library_window.h \
|
||||
add_library_dialog.h \
|
||||
recent_visibility_coordinator.h \
|
||||
rename_library_dialog.h \
|
||||
properties_dialog.h \
|
||||
options_dialog.h \
|
||||
@ -171,6 +172,7 @@ SOURCES += comic_flow.cpp \
|
||||
library_window.cpp \
|
||||
main.cpp \
|
||||
add_library_dialog.cpp \
|
||||
recent_visibility_coordinator.cpp \
|
||||
rename_library_dialog.cpp \
|
||||
properties_dialog.cpp \
|
||||
options_dialog.cpp \
|
||||
|
@ -120,9 +120,7 @@ void ClassicComicsView::setToolBar(QToolBar *toolBar)
|
||||
static_cast<QVBoxLayout *>(comics->layout())->insertWidget(0, toolBar);
|
||||
this->toolbar = toolBar;
|
||||
|
||||
toolBarStretch = new YACReaderToolBarStretch(this);
|
||||
|
||||
toolBarStretchAction = toolBar->addWidget(toolBarStretch);
|
||||
startSeparatorAction = toolBar->addSeparator();
|
||||
toolBar->addAction(hideFlowViewAction);
|
||||
}
|
||||
|
||||
@ -343,7 +341,7 @@ void ClassicComicsView::removeItemsFromFlow(const QModelIndex &parent, int from,
|
||||
|
||||
void ClassicComicsView::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
toolbar->removeAction(toolBarStretchAction);
|
||||
toolbar->removeAction(startSeparatorAction);
|
||||
toolbar->removeAction(hideFlowViewAction);
|
||||
|
||||
saveTableHeadersStatus();
|
||||
|
@ -54,8 +54,6 @@ protected slots:
|
||||
|
||||
private:
|
||||
YACReaderTableView *tableView;
|
||||
YACReaderToolBarStretch *toolBarStretch;
|
||||
QAction *toolBarStretchAction;
|
||||
QToolBar *toolbar;
|
||||
QWidget *comics;
|
||||
QSplitter *sVertical;
|
||||
@ -63,6 +61,7 @@ private:
|
||||
QSettings *settings;
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
QAction *hideFlowViewAction;
|
||||
QAction *startSeparatorAction;
|
||||
|
||||
QStackedWidget *stack;
|
||||
|
||||
|
@ -17,12 +17,13 @@
|
||||
#include "QsLog.h"
|
||||
|
||||
ComicModel::ComicModel(QObject *parent)
|
||||
: QAbstractItemModel(parent)
|
||||
: QAbstractItemModel(parent), showRecent(false)
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
ComicModel::ComicModel(QSqlQuery &sqlquery, QObject *parent)
|
||||
: QAbstractItemModel(parent)
|
||||
: QAbstractItemModel(parent), showRecent(false)
|
||||
{
|
||||
setupModelData(sqlquery);
|
||||
}
|
||||
@ -239,7 +240,9 @@ QHash<int, QByteArray> ComicModel::roleNames() const
|
||||
roles[CoverPathRole] = "cover_path";
|
||||
roles[PublicationDate] = "date";
|
||||
roles[ReadableTitle] = "readable_title";
|
||||
roles[Added] = "added_date";
|
||||
roles[AddedRole] = "added_date";
|
||||
roles[TypeRole] = "type";
|
||||
roles[ShowRecentRole] = "show_recent";
|
||||
|
||||
return roles;
|
||||
}
|
||||
@ -306,6 +309,8 @@ QVariant ComicModel::data(const QModelIndex &index, int role) const
|
||||
return item->data(Added);
|
||||
else if (role == TypeRole)
|
||||
return item->data(Type);
|
||||
else if (role == ShowRecentRole)
|
||||
return showRecent;
|
||||
|
||||
if (role != Qt::DisplayRole)
|
||||
return QVariant();
|
||||
@ -1129,6 +1134,16 @@ bool ComicModel::isFavorite(const QModelIndex &index)
|
||||
return isFavorite;
|
||||
}
|
||||
|
||||
void ComicModel::setShowRecent(bool showRecent)
|
||||
{
|
||||
if (this->showRecent == showRecent)
|
||||
return;
|
||||
|
||||
this->showRecent = showRecent;
|
||||
|
||||
emit dataChanged(index(0, 0), index(rowCount() - 1, 0), { ComicModel::ShowRecentRole });
|
||||
}
|
||||
|
||||
void ComicModel::updateRating(int rating, QModelIndex mi)
|
||||
{
|
||||
ComicDB comic = getComic(mi);
|
||||
|
@ -59,6 +59,7 @@ public:
|
||||
ReadableTitle,
|
||||
AddedRole,
|
||||
TypeRole,
|
||||
ShowRecentRole,
|
||||
};
|
||||
|
||||
enum Mode {
|
||||
@ -139,6 +140,8 @@ public:
|
||||
ComicModel::Mode getMode() { return mode; }
|
||||
unsigned long long int getSourceId() { return sourceId; }
|
||||
|
||||
void setShowRecent(bool visible);
|
||||
|
||||
QHash<int, QByteArray> roleNames() const override;
|
||||
|
||||
public slots:
|
||||
@ -168,6 +171,8 @@ private:
|
||||
qulonglong sourceId;
|
||||
QString localizedDate(const QString &dbDate) const;
|
||||
|
||||
bool showRecent;
|
||||
|
||||
signals:
|
||||
void isEmpty();
|
||||
void searchNumResults(int);
|
||||
|
@ -52,12 +52,12 @@ void drawMacOSXFinishedFolderIcon()
|
||||
#define ROOT 1
|
||||
|
||||
FolderModel::FolderModel(QObject *parent)
|
||||
: QAbstractItemModel(parent), isSubfolder(false), rootItem(nullptr), folderIcon(YACReader::noHighlightedIcon(":/images/sidebar/folder.svg")), folderFinishedIcon(YACReader::noHighlightedIcon(":/images/sidebar/folder_finished.svg"))
|
||||
: QAbstractItemModel(parent), isSubfolder(false), rootItem(nullptr), folderIcon(YACReader::noHighlightedIcon(":/images/sidebar/folder.svg")), folderFinishedIcon(YACReader::noHighlightedIcon(":/images/sidebar/folder_finished.svg")), showRecent(false)
|
||||
{
|
||||
}
|
||||
|
||||
FolderModel::FolderModel(QSqlQuery &sqlquery, QObject *parent)
|
||||
: QAbstractItemModel(parent), isSubfolder(false), rootItem(nullptr)
|
||||
: QAbstractItemModel(parent), isSubfolder(false), rootItem(nullptr), showRecent(false)
|
||||
{
|
||||
QList<QVariant> rootData;
|
||||
rootData << "root"; // id 1, parent 1, title "root"
|
||||
@ -99,6 +99,7 @@ QHash<int, QByteArray> FolderModel::roleNames() const
|
||||
roles[TypeRole] = "type";
|
||||
roles[AddedRole] = "added";
|
||||
roles[UpdatedRole] = "updated";
|
||||
roles[ShowRecentRole] = "show_recent";
|
||||
|
||||
return roles;
|
||||
}
|
||||
@ -181,6 +182,9 @@ QVariant FolderModel::data(const QModelIndex &index, int role) const
|
||||
if (role == FolderModel::UpdatedRole)
|
||||
return item->data(Updated);
|
||||
|
||||
if (role == FolderModel::ShowRecentRole)
|
||||
return showRecent;
|
||||
|
||||
if (role != Qt::DisplayRole)
|
||||
return QVariant();
|
||||
|
||||
@ -195,7 +199,8 @@ Qt::ItemFlags FolderModel::flags(const QModelIndex &index) const
|
||||
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDropEnabled | Qt::ItemIsDragEnabled;
|
||||
}
|
||||
|
||||
QVariant FolderModel::headerData(int section, Qt::Orientation orientation,
|
||||
QVariant FolderModel::headerData(int section,
|
||||
Qt::Orientation orientation,
|
||||
int role) const
|
||||
{
|
||||
if (rootItem == nullptr) {
|
||||
@ -401,7 +406,7 @@ void FolderModel::updateFolderCompletedStatus(const QModelIndexList &list, bool
|
||||
}
|
||||
QSqlDatabase::removeDatabase(connectionName);
|
||||
|
||||
emit dataChanged(index(list.first().row(), FolderModel::Name), index(list.last().row(), FolderModel::FirstChildHash));
|
||||
emit dataChanged(index(list.first().row(), FolderModel::Name), index(list.last().row(), FolderModel::Updated));
|
||||
}
|
||||
|
||||
void FolderModel::updateFolderFinishedStatus(const QModelIndexList &list, bool status)
|
||||
@ -640,6 +645,16 @@ QUrl FolderModel::getCoverUrlPathForComicHash(const QString &hash) const
|
||||
return QUrl("file:" + _databasePath + "/covers/" + hash + ".jpg");
|
||||
}
|
||||
|
||||
void FolderModel::setShowRecent(bool showRecent)
|
||||
{
|
||||
if (this->showRecent == showRecent)
|
||||
return;
|
||||
|
||||
this->showRecent = showRecent;
|
||||
|
||||
emit dataChanged(index(0, 0), index(rowCount() - 1, 0), { FolderModel::ShowRecentRole });
|
||||
}
|
||||
|
||||
void FolderModel::deleteFolder(const QModelIndex &mi)
|
||||
{
|
||||
beginRemoveRows(mi.parent(), mi.row(), mi.row());
|
||||
|
@ -81,6 +81,8 @@ public:
|
||||
|
||||
Q_INVOKABLE QUrl getCoverUrlPathForComicHash(const QString &hash) const;
|
||||
|
||||
void setShowRecent(bool showRecent);
|
||||
|
||||
enum Columns {
|
||||
Name = 0,
|
||||
Path,
|
||||
@ -106,6 +108,7 @@ public:
|
||||
TypeRole,
|
||||
AddedRole,
|
||||
UpdatedRole,
|
||||
ShowRecentRole,
|
||||
};
|
||||
|
||||
bool isSubfolder;
|
||||
@ -125,6 +128,8 @@ private:
|
||||
|
||||
QIcon folderIcon;
|
||||
QIcon folderFinishedIcon;
|
||||
|
||||
bool showRecent;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
using namespace YACReader;
|
||||
|
||||
FolderContentView::FolderContentView(QWidget *parent)
|
||||
FolderContentView::FolderContentView(QAction *toogleRecentVisibilityAction, QWidget *parent)
|
||||
: QWidget { parent }, parent(QModelIndex()), comicModel(new ComicModel()), folderModel(new FolderModel())
|
||||
{
|
||||
qmlRegisterType<FolderModel>("com.yacreader.FolderModel", 1, 0, "FolderModel");
|
||||
@ -60,6 +60,8 @@ FolderContentView::FolderContentView(QWidget *parent)
|
||||
|
||||
toolbar = new QToolBar();
|
||||
toolbar->addWidget(new YACReaderToolBarStretch);
|
||||
toolbar->addAction(toogleRecentVisibilityAction);
|
||||
toolbar->addSeparator();
|
||||
toolbar->addWidget(coverSizeSliderWidget);
|
||||
|
||||
auto l = new QVBoxLayout;
|
||||
@ -205,6 +207,11 @@ void FolderContentView::reloadContinueReadingModel()
|
||||
}
|
||||
}
|
||||
|
||||
void FolderContentView::setShowRecent(bool visible)
|
||||
{
|
||||
folderModel->setShowRecent(visible);
|
||||
}
|
||||
|
||||
void FolderContentView::openFolder(int index)
|
||||
{
|
||||
emit subfolderSelected(this->parent, index);
|
||||
|
@ -19,10 +19,11 @@ class FolderContentView : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FolderContentView(QWidget *parent = nullptr);
|
||||
explicit FolderContentView(QAction *toogleRecentVisibilityAction, QWidget *parent = nullptr);
|
||||
void setModel(const QModelIndex &parent, FolderModel *model);
|
||||
void setContinueReadingModel(ComicModel *model);
|
||||
void reloadContinueReadingModel();
|
||||
void setShowRecent(bool visible);
|
||||
|
||||
FolderModel *currentFolderModel() { return folderModel; }
|
||||
signals:
|
||||
|
@ -170,7 +170,6 @@ GridComicsView::~GridComicsView()
|
||||
|
||||
void GridComicsView::createCoverSizeSliderWidget()
|
||||
{
|
||||
toolBarStretch = new YACReaderToolBarStretch(this);
|
||||
coverSizeSliderWidget = new QWidget(this);
|
||||
coverSizeSliderWidget->setFixedWidth(200);
|
||||
coverSizeSlider = new QSlider();
|
||||
@ -206,7 +205,7 @@ void GridComicsView::setToolBar(QToolBar *toolBar)
|
||||
|
||||
createCoverSizeSliderWidget();
|
||||
|
||||
toolBarStretchAction = toolBar->addWidget(toolBarStretch);
|
||||
startSeparatorAction = toolBar->addSeparator();
|
||||
toolBar->addAction(showInfoAction);
|
||||
showInfoSeparatorAction = toolBar->addSeparator();
|
||||
coverSizeSliderAction = toolBar->addWidget(coverSizeSliderWidget);
|
||||
@ -553,7 +552,7 @@ void GridComicsView::setShowMarks(bool show)
|
||||
|
||||
void GridComicsView::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
toolbar->removeAction(toolBarStretchAction);
|
||||
toolbar->removeAction(startSeparatorAction);
|
||||
toolbar->removeAction(showInfoAction);
|
||||
toolbar->removeAction(showInfoSeparatorAction);
|
||||
toolbar->removeAction(coverSizeSliderAction);
|
||||
|
@ -97,13 +97,12 @@ signals:
|
||||
private:
|
||||
QSettings *settings;
|
||||
QToolBar *toolbar;
|
||||
YACReaderToolBarStretch *toolBarStretch;
|
||||
QAction *toolBarStretchAction;
|
||||
QWidget *coverSizeSliderWidget;
|
||||
QSlider *coverSizeSlider;
|
||||
QAction *coverSizeSliderAction;
|
||||
QAction *showInfoAction;
|
||||
QAction *showInfoSeparatorAction;
|
||||
QAction *startSeparatorAction;
|
||||
|
||||
bool filterEnabled;
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
<file>../images/comics_view_toolbar/show_comic_info.svg</file>
|
||||
<file>../images/comics_view_toolbar/setManga.svg</file>
|
||||
<file>../images/comics_view_toolbar/setNormal.svg</file>
|
||||
<file>../images/comics_view_toolbar/showRecentIndicator.svg</file>
|
||||
<file>../images/defaultCover.png</file>
|
||||
<file>../images/edit.png</file>
|
||||
<file>../images/empty_current_readings.png</file>
|
||||
|
@ -1,5 +1,4 @@
|
||||
#include "library_window.h"
|
||||
#include "custom_widgets.h"
|
||||
#include "folder_item.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
@ -43,6 +42,7 @@
|
||||
#include "help_about_dialog.h"
|
||||
#include "server_config_dialog.h"
|
||||
#include "comic_model.h"
|
||||
#include "yacreader_tool_bar_stretch.h"
|
||||
|
||||
#include "yacreader_titled_toolbar.h"
|
||||
#include "yacreader_main_toolbar.h"
|
||||
@ -83,6 +83,8 @@
|
||||
|
||||
#include "library_comic_opener.h"
|
||||
|
||||
#include "recent_visibility_coordinator.h"
|
||||
|
||||
#include "QsLog.h"
|
||||
|
||||
#include "yacreader_http_server.h"
|
||||
@ -200,6 +202,8 @@ void LibraryWindow::setupUI()
|
||||
createToolBars();
|
||||
createMenus();
|
||||
|
||||
setupCoordinators();
|
||||
|
||||
navigationController = new YACReaderNavigationController(this, contentViewsManager);
|
||||
|
||||
createConnections();
|
||||
@ -218,24 +222,6 @@ void LibraryWindow::setupUI()
|
||||
trayIconController = new TrayIconController(settings, this);
|
||||
}
|
||||
|
||||
/*void LibraryWindow::changeEvent(QEvent *event)
|
||||
{
|
||||
QMainWindow::changeEvent(event);
|
||||
|
||||
if (event->type() == QEvent::WindowStateChange && isMinimized() &&
|
||||
trayIcon.isVisible()) {
|
||||
#ifdef Q_OS_MACOS
|
||||
OSXHideDockIcon();
|
||||
#endif
|
||||
hide();
|
||||
} else if (event->type() == QEvent::WindowStateChange) {
|
||||
#ifdef Q_OS_MACOS
|
||||
OSXShowDockIcon();
|
||||
#endif
|
||||
show();
|
||||
}
|
||||
}*/
|
||||
|
||||
void LibraryWindow::doLayout()
|
||||
{
|
||||
// LAYOUT ELEMENTS------------------------------------------------------------
|
||||
@ -457,6 +443,7 @@ void LibraryWindow::setUpShortcutsManagement()
|
||||
editShortcutsDialog->addActionsGroup("Visualization", QIcon(":/images/shortcuts_group_visualization.svg"),
|
||||
tmpList = QList<QAction *>()
|
||||
<< showHideMarksAction
|
||||
<< toogleShowRecentIndicatorAction
|
||||
#ifndef Q_OS_MAC
|
||||
<< toggleFullScreenAction
|
||||
#endif
|
||||
@ -481,6 +468,11 @@ void LibraryWindow::doModels()
|
||||
listsModelProxy = new ReadingListModelProxy(this);
|
||||
}
|
||||
|
||||
void LibraryWindow::setupCoordinators()
|
||||
{
|
||||
recentVisibilityCoordinator = new RecentVisibilityCoordinator(settings, foldersModel, contentViewsManager->folderContentView, comicsModel);
|
||||
}
|
||||
|
||||
void LibraryWindow::createActions()
|
||||
{
|
||||
backAction = new QAction(this);
|
||||
@ -612,14 +604,6 @@ void LibraryWindow::createActions()
|
||||
setYonkomaAction->setData(SET_AS_YONKOMA_ACTION_YL);
|
||||
setYonkomaAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SET_AS_YONKOMA_ACTION_YL));
|
||||
|
||||
/*setAllAsReadAction = new QAction(tr("Set all as read"),this);
|
||||
setAllAsReadAction->setToolTip(tr("Set all comics as read"));
|
||||
setAllAsReadAction->setIcon(QIcon(":/images/comics_view_toolbar/setAllRead.png"));
|
||||
|
||||
setAllAsNonReadAction = new QAction(tr("Set all as unread"),this);
|
||||
setAllAsNonReadAction->setToolTip(tr("Set all comics as unread"));
|
||||
setAllAsNonReadAction->setIcon(QIcon(":/images/comics_view_toolbar/setAllUnread.png"));*/
|
||||
|
||||
showHideMarksAction = new QAction(tr("Show/Hide marks"), this);
|
||||
showHideMarksAction->setToolTip(tr("Show or hide read marks"));
|
||||
showHideMarksAction->setData(SHOW_HIDE_MARKS_ACTION_YL);
|
||||
@ -627,6 +611,15 @@ void LibraryWindow::createActions()
|
||||
showHideMarksAction->setCheckable(true);
|
||||
showHideMarksAction->setIcon(QIcon(":/images/comics_view_toolbar/showMarks.svg"));
|
||||
showHideMarksAction->setChecked(true);
|
||||
|
||||
toogleShowRecentIndicatorAction = new QAction(tr("Show/Hide recent indicator"), this);
|
||||
toogleShowRecentIndicatorAction->setToolTip(tr("Show or hide recent indicator"));
|
||||
toogleShowRecentIndicatorAction->setData(SHOW_HIDE_RECENT_INDICATOR_ACTION_YL);
|
||||
toogleShowRecentIndicatorAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SHOW_HIDE_RECENT_INDICATOR_ACTION_YL));
|
||||
toogleShowRecentIndicatorAction->setCheckable(true);
|
||||
toogleShowRecentIndicatorAction->setIcon(QIcon(":/images/comics_view_toolbar/showRecentIndicator.svg"));
|
||||
toogleShowRecentIndicatorAction->setChecked(settings->value(DISPLAY_RECENTLY_INDICATOR, true).toBool());
|
||||
|
||||
#ifndef Q_OS_MAC
|
||||
toggleFullScreenAction = new QAction(tr("Fullscreen mode on/off"), this);
|
||||
toggleFullScreenAction->setToolTip(tr("Fullscreen mode on/off"));
|
||||
@ -1035,9 +1028,7 @@ void LibraryWindow::createToolBars()
|
||||
editInfoToolBar->addSeparator();
|
||||
|
||||
editInfoToolBar->addAction(setAsReadAction);
|
||||
// editInfoToolBar->addAction(setAllAsReadAction);
|
||||
editInfoToolBar->addAction(setAsNonReadAction);
|
||||
// editInfoToolBar->addAction(setAllAsNonReadAction);
|
||||
|
||||
editInfoToolBar->addAction(showHideMarksAction);
|
||||
|
||||
@ -1057,6 +1048,11 @@ void LibraryWindow::createToolBars()
|
||||
|
||||
editInfoToolBar->addAction(deleteComicsAction);
|
||||
|
||||
auto toolBarStretch = new YACReaderToolBarStretch(this);
|
||||
editInfoToolBar->addWidget(toolBarStretch);
|
||||
|
||||
editInfoToolBar->addAction(toogleShowRecentIndicatorAction);
|
||||
|
||||
contentViewsManager->comicsView->setToolBar(editInfoToolBar);
|
||||
}
|
||||
|
||||
@ -1361,6 +1357,8 @@ void LibraryWindow::createConnections()
|
||||
// upgrade library
|
||||
connect(this, &LibraryWindow::libraryUpgraded, this, &LibraryWindow::loadLibrary, Qt::QueuedConnection);
|
||||
connect(this, &LibraryWindow::errorUpgradingLibrary, this, &LibraryWindow::showErrorUpgradingLibrary, Qt::QueuedConnection);
|
||||
|
||||
connect(toogleShowRecentIndicatorAction, &QAction::toggled, recentVisibilityCoordinator, &RecentVisibilityCoordinator::toggleVisibility);
|
||||
}
|
||||
|
||||
void LibraryWindow::showErrorUpgradingLibrary(const QString &path)
|
||||
|
@ -81,6 +81,7 @@ class YACReaderHistoryController;
|
||||
class EmptyLabelWidget;
|
||||
class EmptySpecialListWidget;
|
||||
class EmptyReadingListWidget;
|
||||
class RecentVisibilityCoordinator;
|
||||
|
||||
namespace YACReader {
|
||||
class TrayIconController;
|
||||
@ -214,12 +215,12 @@ public:
|
||||
QAction *setWebComicAction;
|
||||
QAction *setYonkomaAction;
|
||||
|
||||
// QAction * setAllAsReadAction;
|
||||
// QAction * setAllAsNonReadAction;
|
||||
QAction *showHideMarksAction;
|
||||
QAction *getInfoAction; // comic vine
|
||||
QAction *resetComicRatingAction;
|
||||
|
||||
QAction *toogleShowRecentIndicatorAction;
|
||||
|
||||
// edit info actions
|
||||
QAction *selectAllComicsAction;
|
||||
QAction *editSelectedComicsAction;
|
||||
@ -266,10 +267,6 @@ public:
|
||||
QString _lastAdded;
|
||||
QString _sourceLastAdded;
|
||||
|
||||
// QModelIndex _rootIndex;
|
||||
// QModelIndex _rootIndexCV;
|
||||
// QModelIndex updateDestination;
|
||||
|
||||
quint64 _comicIdEdited;
|
||||
|
||||
enum NavigationStatus {
|
||||
@ -290,6 +287,7 @@ public:
|
||||
void doDialogs();
|
||||
void setUpShortcutsManagement();
|
||||
void doModels();
|
||||
void setupCoordinators();
|
||||
|
||||
// ACTIONS MANAGEMENT
|
||||
void disableComicsActions(bool disabled);
|
||||
@ -298,9 +296,6 @@ public:
|
||||
void disableFoldersActions(bool disabled);
|
||||
|
||||
void disableAllActions();
|
||||
// void disableActions();
|
||||
// void enableActions();
|
||||
// void enableLibraryActions();
|
||||
|
||||
QString currentPath();
|
||||
QString currentFolderPath();
|
||||
@ -455,6 +450,8 @@ private:
|
||||
TrayIconController *trayIconController;
|
||||
ComicQueryResultProcessor comicQueryResultProcessor;
|
||||
std::unique_ptr<FolderQueryResultProcessor> folderQueryResultProcessor;
|
||||
|
||||
RecentVisibilityCoordinator *recentVisibilityCoordinator;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -131,6 +131,16 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
//is new
|
||||
Rectangle {
|
||||
width: 10
|
||||
height: 10
|
||||
radius: 5
|
||||
anchors { left: coverElement.left; top: coverElement.top; topMargin: 10; leftMargin: 10; }
|
||||
color: "#FFFFCC00"
|
||||
visible: (((new Date() / 1000) - added) < 86400 || ((new Date() / 1000) - updated) < 86400) && show_recent
|
||||
}
|
||||
|
||||
//border
|
||||
Rectangle {
|
||||
width: coverElement.width
|
||||
|
@ -133,6 +133,16 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
//is new
|
||||
Rectangle {
|
||||
width: 10
|
||||
height: 10
|
||||
radius: 5
|
||||
anchors { left: coverElement.left; top: coverElement.top; topMargin: 10; leftMargin: 10; }
|
||||
color: "#FFFFCC00"
|
||||
visible: (((new Date() / 1000) - added) < 86400 || ((new Date() / 1000) - updated) < 86400) && show_recent
|
||||
}
|
||||
|
||||
//border
|
||||
Rectangle {
|
||||
width: coverElement.width
|
||||
|
@ -280,6 +280,16 @@ SplitView {
|
||||
|
||||
}
|
||||
|
||||
//is new
|
||||
Rectangle {
|
||||
width: 10
|
||||
height: 10
|
||||
radius: 5
|
||||
anchors { left: coverElement.left; top: coverElement.top; topMargin: 5; leftMargin: 5; }
|
||||
color: "#FFFFCC00"
|
||||
visible: (((new Date() / 1000) - added_date) < 86400) && show_recent
|
||||
}
|
||||
|
||||
//border
|
||||
Rectangle {
|
||||
width: coverElement.width
|
||||
|
@ -283,6 +283,16 @@ SplitView {
|
||||
|
||||
}
|
||||
|
||||
//is new
|
||||
Rectangle {
|
||||
width: 10
|
||||
height: 10
|
||||
radius: 5
|
||||
anchors { left: coverElement.left; top: coverElement.top; topMargin: 5; leftMargin: 5; }
|
||||
color: "#FFFFCC00"
|
||||
visible: (((new Date() / 1000) - added_date) < 86400) && show_recent
|
||||
}
|
||||
|
||||
//border
|
||||
Rectangle {
|
||||
width: coverElement.width
|
||||
|
30
YACReaderLibrary/recent_visibility_coordinator.cpp
Normal file
30
YACReaderLibrary/recent_visibility_coordinator.cpp
Normal file
@ -0,0 +1,30 @@
|
||||
|
||||
#include "recent_visibility_coordinator.h"
|
||||
|
||||
#include "yacreader_global_gui.h"
|
||||
|
||||
RecentVisibilityCoordinator::RecentVisibilityCoordinator(QSettings *settings, FolderModel *folderModel, FolderContentView *folderContentView, ComicModel *comicModel)
|
||||
: QObject(), settings(settings), folderModel(folderModel), folderContentView(folderContentView), comicModel(comicModel)
|
||||
{
|
||||
updateVisibility();
|
||||
}
|
||||
|
||||
void RecentVisibilityCoordinator::toggleVisibility(bool visibility)
|
||||
{
|
||||
settings->setValue(DISPLAY_RECENTLY_INDICATOR, visibility);
|
||||
|
||||
updateVisibility();
|
||||
}
|
||||
|
||||
void RecentVisibilityCoordinator::setTimeRangeInDays(int days)
|
||||
{
|
||||
}
|
||||
|
||||
void RecentVisibilityCoordinator::updateVisibility()
|
||||
{
|
||||
auto visibility = settings->value(DISPLAY_RECENTLY_INDICATOR, true).toBool();
|
||||
|
||||
folderModel->setShowRecent(visibility);
|
||||
folderContentView->setShowRecent(visibility);
|
||||
comicModel->setShowRecent(visibility);
|
||||
}
|
30
YACReaderLibrary/recent_visibility_coordinator.h
Normal file
30
YACReaderLibrary/recent_visibility_coordinator.h
Normal file
@ -0,0 +1,30 @@
|
||||
|
||||
#ifndef RECENT_VISIBILITY_COORDINATOR_H
|
||||
#define RECENT_VISIBILITY_COORDINATOR_H
|
||||
|
||||
#include <QtCore>
|
||||
|
||||
#include "folder_model.h"
|
||||
#include "comic_model.h"
|
||||
#include "folder_content_view.h"
|
||||
|
||||
class RecentVisibilityCoordinator : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RecentVisibilityCoordinator(QSettings *settings, FolderModel *folderModel, FolderContentView *folderContentView, ComicModel *comicModel);
|
||||
|
||||
public slots:
|
||||
void toggleVisibility(bool visibility);
|
||||
void setTimeRangeInDays(int days);
|
||||
|
||||
private:
|
||||
QSettings *settings;
|
||||
FolderModel *folderModel;
|
||||
FolderContentView *folderContentView;
|
||||
ComicModel *comicModel;
|
||||
|
||||
void updateVisibility();
|
||||
};
|
||||
|
||||
#endif // RECENT_VISIBILITY_COORDINATOR_H
|
@ -45,7 +45,7 @@ YACReaderContentViewsManager::YACReaderContentViewsManager(QSettings *settings,
|
||||
doComicsViewConnections();
|
||||
|
||||
comicsViewStack->addWidget(comicsViewTransition = new ComicsViewTransition());
|
||||
comicsViewStack->addWidget(folderContentView = new FolderContentView());
|
||||
comicsViewStack->addWidget(folderContentView = new FolderContentView(parent->toogleShowRecentIndicatorAction));
|
||||
comicsViewStack->addWidget(emptyLabelWidget = new EmptyLabelWidget());
|
||||
comicsViewStack->addWidget(emptySpecialList = new EmptySpecialListWidget());
|
||||
comicsViewStack->addWidget(emptyReadingList = new EmptyReadingListWidget());
|
||||
|
@ -91,4 +91,25 @@ void YACReaderFoldersViewItemDeletegate::paint(QPainter *painter, const QStyleOp
|
||||
}
|
||||
|
||||
QStyledItemDelegate::paint(painter, option, index);
|
||||
|
||||
auto showRecent = index.data(FolderModel::ShowRecentRole).toBool();
|
||||
|
||||
if (showRecent) {
|
||||
auto now = QDateTime::currentSecsSinceEpoch();
|
||||
auto added = index.data(FolderModel::AddedRole).toLongLong();
|
||||
auto updated = index.data(FolderModel::UpdatedRole).toLongLong();
|
||||
auto dayInSeconds = 86400;
|
||||
|
||||
if (now - added < dayInSeconds || now - updated < dayInSeconds) {
|
||||
painter->save();
|
||||
#ifdef Q_OS_MAC
|
||||
painter->setBrush(QBrush(QColor(85, 95, 127)));
|
||||
#else
|
||||
painter->setBrush(QBrush(QColor(237, 197, 24)));
|
||||
#endif
|
||||
painter->setPen(QPen(QBrush(), 0));
|
||||
painter->drawEllipse(option.rect.x() + 13, option.rect.y() + 2, 7, 7);
|
||||
painter->restore();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -71,6 +71,7 @@
|
||||
#define BLUR_RADIUS_BACKGROUND_IMAGE_IN_GRID_VIEW "BLUR_RADIUS_BACKGROUND_IMAGE_IN_GRID_VIEW"
|
||||
#define USE_SELECTED_COMIC_COVER_AS_BACKGROUND_IMAGE_IN_GRID_VIEW "USE_SELECTED_COMIC_COVER_AS_BACKGROUND_IMAGE_IN_GRID_VIEW"
|
||||
#define DISPLAY_CONTINUE_READING_IN_GRID_VIEW "DISPLAY_CONTINUE_READING_IN_GRID_VIEW"
|
||||
#define DISPLAY_RECENTLY_INDICATOR "DISPLAY_RECENTLY_INDICATOR"
|
||||
|
||||
namespace YACReader {
|
||||
|
||||
|
11
images/comics_view_toolbar/showRecentIndicator.svg
Normal file
11
images/comics_view_toolbar/showRecentIndicator.svg
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18">
|
||||
<defs>
|
||||
<style>
|
||||
.cls-1 {
|
||||
fill: #c2c2c2;
|
||||
}
|
||||
</style>
|
||||
</defs>
|
||||
<circle class="cls-1" cx="9" cy="9" r="4.29"/>
|
||||
</svg>
|
After Width: | Height: | Size: 278 B |
@ -97,6 +97,7 @@ public:
|
||||
#define RENAME_LIST_ACTION_YL "RENAME_LIST_ACTION_YL"
|
||||
#define ADD_TO_FAVORITES_ACTION_YL "ADD_TO_FAVORITES_ACTION_YL"
|
||||
#define SAVE_COVERS_TO_ACTION_YL "SAVE_COVERS_TO_ACTION_YL"
|
||||
#define SHOW_HIDE_RECENT_INDICATOR_ACTION_YL "SHOW_HIDE_RECENT_INDICATOR_ACTION_YL"
|
||||
// COMMANDS YACReaderLibrary
|
||||
|
||||
// ACTION NAMES YACReader
|
||||
|
Loading…
x
Reference in New Issue
Block a user