mirror of
https://github.com/YACReader/yacreader
synced 2025-07-18 21:14:33 -04:00
Add new type of view to display the content of a folder that doesn't contain comics
It is a replacement for EmptyFolderWidget for now, but it should evolve to show comics and folders
This commit is contained in:
70
YACReaderLibrary/folder_content_view.h
Normal file
70
YACReaderLibrary/folder_content_view.h
Normal file
@ -0,0 +1,70 @@
|
||||
#ifndef FOLDERCONTENTVIEW_H
|
||||
#define FOLDERCONTENTVIEW_H
|
||||
|
||||
#include <QtWidgets>
|
||||
|
||||
#include "comic_model.h"
|
||||
|
||||
#include "folder.h"
|
||||
#include "comic_db.h"
|
||||
|
||||
class FolderModel;
|
||||
class ComicModel;
|
||||
class YACReaderToolBarStretch;
|
||||
|
||||
class QQuickWidget;
|
||||
class QQmlContext;
|
||||
|
||||
class FolderContentView : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FolderContentView(QWidget *parent = nullptr);
|
||||
void setModel(const QModelIndex &parent, FolderModel *model);
|
||||
void setContinueReadingModel(ComicModel *model);
|
||||
|
||||
signals:
|
||||
void subfolderSelected(QModelIndex, int);
|
||||
void openComic(const ComicDB &comic, const ComicModel::Mode mode);
|
||||
|
||||
// Drops
|
||||
void copyComicsToCurrentFolder(QList<QPair<QString, QString>>);
|
||||
void moveComicsToCurrentFolder(QList<QPair<QString, QString>>);
|
||||
|
||||
void openFolderContextMenu(QPoint point, Folder folder);
|
||||
void openContinueReadingComicContextMenu(QPoint point, ComicDB comic);
|
||||
|
||||
protected slots:
|
||||
// void onItemClicked(const QModelIndex &mi);
|
||||
void updateCoversSizeInContext(int width, QQmlContext *ctxt);
|
||||
void setCoversSize(int width);
|
||||
virtual void showEvent(QShowEvent *event) override;
|
||||
void openFolder(int index);
|
||||
void openComicFromContinueReadingList(int index);
|
||||
void requestedFolderContextMenu(QPoint point, int index);
|
||||
void requestedContinueReadingComicContextMenu(QPoint point, int index);
|
||||
|
||||
protected:
|
||||
QQuickWidget *view;
|
||||
QModelIndex parent;
|
||||
|
||||
std::unique_ptr<ComicModel> comicModel;
|
||||
FolderModel *folderModel;
|
||||
|
||||
// Drop to import
|
||||
void dragEnterEvent(QDragEnterEvent *event) override;
|
||||
void dropEvent(QDropEvent *event) override;
|
||||
|
||||
private:
|
||||
QSettings *settings;
|
||||
QToolBar *toolbar;
|
||||
YACReaderToolBarStretch *toolBarStretch;
|
||||
QAction *toolBarStretchAction;
|
||||
QWidget *coverSizeSliderWidget;
|
||||
QSlider *coverSizeSlider;
|
||||
QAction *coverSizeSliderAction;
|
||||
QAction *showInfoAction;
|
||||
QAction *showInfoSeparatorAction;
|
||||
};
|
||||
|
||||
#endif // FOLDERCONTENTVIEW_H
|
Reference in New Issue
Block a user