mirror of
https://github.com/YACReader/yacreader
synced 2025-05-28 03:10:27 -04:00
Add current/next comic view to GridView.
This commit is contained in:
parent
b41884d5db
commit
f6d389ff35
@ -148,7 +148,8 @@ HEADERS += comic_flow.h \
|
|||||||
info_comics_view.h \
|
info_comics_view.h \
|
||||||
yacreader_comics_selection_helper.h \
|
yacreader_comics_selection_helper.h \
|
||||||
yacreader_comic_info_helper.h \
|
yacreader_comic_info_helper.h \
|
||||||
db/reading_list.h
|
db/reading_list.h \
|
||||||
|
current_comic_view_helper.h
|
||||||
|
|
||||||
!CONFIG(no_opengl) {
|
!CONFIG(no_opengl) {
|
||||||
HEADERS += ../common/gl/yacreader_flow_gl.h
|
HEADERS += ../common/gl/yacreader_flow_gl.h
|
||||||
@ -218,7 +219,8 @@ SOURCES += comic_flow.cpp \
|
|||||||
info_comics_view.cpp \
|
info_comics_view.cpp \
|
||||||
yacreader_comics_selection_helper.cpp \
|
yacreader_comics_selection_helper.cpp \
|
||||||
yacreader_comic_info_helper.cpp\
|
yacreader_comic_info_helper.cpp\
|
||||||
db/reading_list.cpp
|
db/reading_list.cpp \
|
||||||
|
current_comic_view_helper.cpp
|
||||||
|
|
||||||
!CONFIG(no_opengl) {
|
!CONFIG(no_opengl) {
|
||||||
SOURCES += ../common/gl/yacreader_flow_gl.cpp
|
SOURCES += ../common/gl/yacreader_flow_gl.cpp
|
||||||
@ -316,4 +318,4 @@ translation.files = ../release/languages/yacreaderlibrary_*
|
|||||||
|
|
||||||
manpage.path = $$DATADIR/man/man1
|
manpage.path = $$DATADIR/man/man1
|
||||||
manpage.files = ../YACReaderLibrary.1
|
manpage.files = ../YACReaderLibrary.1
|
||||||
}
|
}
|
||||||
|
@ -265,6 +265,11 @@ void ClassicComicsView::selectIndex(int index)
|
|||||||
tableView->selectRow(index);
|
tableView->selectRow(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClassicComicsView::updateCurrentComicView()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void ClassicComicsView::selectAll()
|
void ClassicComicsView::selectAll()
|
||||||
{
|
{
|
||||||
tableView->selectAll();
|
tableView->selectAll();
|
||||||
|
@ -31,6 +31,7 @@ public:
|
|||||||
void updateConfig(QSettings * settings);
|
void updateConfig(QSettings * settings);
|
||||||
void enableFilterMode(bool enabled);
|
void enableFilterMode(bool enabled);
|
||||||
void selectIndex(int index);
|
void selectIndex(int index);
|
||||||
|
void updateCurrentComicView();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setCurrentIndex(const QModelIndex &index);
|
void setCurrentIndex(const QModelIndex &index);
|
||||||
|
@ -28,6 +28,7 @@ public:
|
|||||||
virtual void updateConfig(QSettings * settings) = 0;
|
virtual void updateConfig(QSettings * settings) = 0;
|
||||||
virtual void enableFilterMode(bool enabled) = 0;
|
virtual void enableFilterMode(bool enabled) = 0;
|
||||||
virtual void selectIndex(int index) = 0;
|
virtual void selectIndex(int index) = 0;
|
||||||
|
virtual void updateCurrentComicView() = 0;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void updateInfoForIndex(int index);
|
virtual void updateInfoForIndex(int index);
|
||||||
@ -36,6 +37,7 @@ public slots:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void selected(unsigned int);
|
void selected(unsigned int);
|
||||||
|
void openComic(const ComicDB& comic);
|
||||||
void comicRated(int,QModelIndex);
|
void comicRated(int,QModelIndex);
|
||||||
|
|
||||||
//Context menus
|
//Context menus
|
||||||
|
17
YACReaderLibrary/current_comic_view_helper.cpp
Normal file
17
YACReaderLibrary/current_comic_view_helper.cpp
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#include "current_comic_view_helper.h"
|
||||||
|
|
||||||
|
#include "comic_db.h"
|
||||||
|
|
||||||
|
ComicDB currentComicFromModel(ComicModel *model, bool &found) {
|
||||||
|
auto comics = model->getAllComics();
|
||||||
|
|
||||||
|
foreach (auto comic, comics) {
|
||||||
|
if (comic.info.read == false) {
|
||||||
|
found = true;
|
||||||
|
return comic;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
found = false;
|
||||||
|
return ComicDB();
|
||||||
|
}
|
8
YACReaderLibrary/current_comic_view_helper.h
Normal file
8
YACReaderLibrary/current_comic_view_helper.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#ifndef CURRENT_COMIC_VIEW_HELPER_H
|
||||||
|
#define CURRENT_COMIC_VIEW_HELPER_H
|
||||||
|
|
||||||
|
#include "comic_model.h"
|
||||||
|
|
||||||
|
ComicDB currentComicFromModel(ComicModel *model, bool &found);
|
||||||
|
|
||||||
|
#endif // CURRENT_COMIC_VIEW_HELPER_H
|
@ -295,7 +295,7 @@ QVariant ComicModel::data(const QModelIndex &index, int role) const
|
|||||||
else if (role == RatingRole)
|
else if (role == RatingRole)
|
||||||
return item->data(Rating);
|
return item->data(Rating);
|
||||||
else if (role == CoverPathRole)
|
else if (role == CoverPathRole)
|
||||||
return QUrl("file:"+_databasePath+"/covers/"+item->data(Hash).toString()+".jpg");
|
return getCoverUrlPathForComicHash(item->data(Hash).toString());
|
||||||
else if (role == NumPagesRole)
|
else if (role == NumPagesRole)
|
||||||
return item->data(NumPages);
|
return item->data(NumPages);
|
||||||
else if (role == CurrentPageRole)
|
else if (role == CurrentPageRole)
|
||||||
@ -994,6 +994,11 @@ void ComicModel::resetComicRating(const QModelIndex &mi)
|
|||||||
QSqlDatabase::removeDatabase(_databasePath);
|
QSqlDatabase::removeDatabase(_databasePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QUrl ComicModel::getCoverUrlPathForComicHash(const QString &hash) const
|
||||||
|
{
|
||||||
|
return QUrl("file:"+_databasePath+"/covers/"+hash+".jpg");
|
||||||
|
}
|
||||||
|
|
||||||
void ComicModel::addComicsToFavorites(const QList<qulonglong> &comicIds)
|
void ComicModel::addComicsToFavorites(const QList<qulonglong> &comicIds)
|
||||||
{
|
{
|
||||||
addComicsToFavorites(getIndexesFromIds(comicIds));
|
addComicsToFavorites(getIndexesFromIds(comicIds));
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
#include <QSqlQuery>
|
#include <QSqlQuery>
|
||||||
#include <QSqlDatabase>
|
#include <QSqlDatabase>
|
||||||
|
#include <QUrl>
|
||||||
|
|
||||||
#include "yacreader_global_gui.h"
|
#include "yacreader_global_gui.h"
|
||||||
|
|
||||||
@ -70,6 +71,8 @@ public:
|
|||||||
void reload(const ComicDB & comic);
|
void reload(const ComicDB & comic);
|
||||||
void resetComicRating(const QModelIndex & mi);
|
void resetComicRating(const QModelIndex & mi);
|
||||||
|
|
||||||
|
Q_INVOKABLE QUrl getCoverUrlPathForComicHash(const QString& hash) const;
|
||||||
|
|
||||||
|
|
||||||
void addComicsToFavorites(const QList<QModelIndex> &comicsList);
|
void addComicsToFavorites(const QList<QModelIndex> &comicsList);
|
||||||
void addComicsToLabel(const QList<QModelIndex> &comicsList, qulonglong labelId);
|
void addComicsToLabel(const QList<QModelIndex> &comicsList, qulonglong labelId);
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include "comic_db.h"
|
#include "comic_db.h"
|
||||||
#include "yacreader_comics_selection_helper.h"
|
#include "yacreader_comics_selection_helper.h"
|
||||||
#include "yacreader_comic_info_helper.h"
|
#include "yacreader_comic_info_helper.h"
|
||||||
|
#include "current_comic_view_helper.h"
|
||||||
|
|
||||||
//values relative to visible cells
|
//values relative to visible cells
|
||||||
const unsigned int YACREADER_MIN_GRID_ZOOM_WIDTH = 156;
|
const unsigned int YACREADER_MIN_GRID_ZOOM_WIDTH = 156;
|
||||||
@ -30,7 +31,7 @@ const unsigned int YACREADER_MIN_ITEM_WIDTH = YACREADER_MIN_COVER_WIDTH;
|
|||||||
|
|
||||||
|
|
||||||
GridComicsView::GridComicsView(QWidget *parent) :
|
GridComicsView::GridComicsView(QWidget *parent) :
|
||||||
ComicsView(parent)
|
ComicsView(parent), filterEnabled(false)
|
||||||
{
|
{
|
||||||
settings = new QSettings(YACReader::getSettingsPath()+"/YACReaderLibrary.ini", QSettings::IniFormat, this);
|
settings = new QSettings(YACReader::getSettingsPath()+"/YACReaderLibrary.ini", QSettings::IniFormat, this);
|
||||||
settings->beginGroup("libraryConfig");
|
settings->beginGroup("libraryConfig");
|
||||||
@ -151,6 +152,7 @@ GridComicsView::GridComicsView(QWidget *parent) :
|
|||||||
ctxt->setContextProperty("dummyValue", true);
|
ctxt->setContextProperty("dummyValue", true);
|
||||||
ctxt->setContextProperty("dragManager", this);
|
ctxt->setContextProperty("dragManager", this);
|
||||||
ctxt->setContextProperty("dropManager", this);
|
ctxt->setContextProperty("dropManager", this);
|
||||||
|
ctxt->setContextProperty("comicOpener", this);
|
||||||
|
|
||||||
bool showInfo = settings->value(COMICS_GRID_SHOW_INFO, false).toBool();
|
bool showInfo = settings->value(COMICS_GRID_SHOW_INFO, false).toBool();
|
||||||
ctxt->setContextProperty("showInfo", showInfo);
|
ctxt->setContextProperty("showInfo", showInfo);
|
||||||
@ -237,6 +239,8 @@ void GridComicsView::setModel(ComicModel *model)
|
|||||||
|
|
||||||
ComicsView::setModel(model);
|
ComicsView::setModel(model);
|
||||||
|
|
||||||
|
setCurrentComicIfNeeded();
|
||||||
|
|
||||||
selectionHelper->setModel(model);
|
selectionHelper->setModel(model);
|
||||||
comicInfoHelper->setModel(model);
|
comicInfoHelper->setModel(model);
|
||||||
|
|
||||||
@ -255,12 +259,18 @@ void GridComicsView::setModel(ComicModel *model)
|
|||||||
|
|
||||||
updateBackgroundConfig();
|
updateBackgroundConfig();
|
||||||
|
|
||||||
|
selectionHelper->clear();
|
||||||
|
|
||||||
if(model->rowCount()>0)
|
if(model->rowCount()>0)
|
||||||
{
|
{
|
||||||
setCurrentIndex(model->index(0,0));
|
setCurrentIndex(model->index(0,0));
|
||||||
if(showInfoAction->isChecked())
|
if(showInfoAction->isChecked())
|
||||||
updateInfoForIndex(0);
|
updateInfoForIndex(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//If the currentComicView was hidden before showing it sometimes the scroll view doesn't show it
|
||||||
|
//this is a hacky solution...
|
||||||
|
QTimer::singleShot(0, this, SLOT(resetScroll()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GridComicsView::updateBackgroundConfig()
|
void GridComicsView::updateBackgroundConfig()
|
||||||
@ -360,7 +370,16 @@ void GridComicsView::updateConfig(QSettings *settings)
|
|||||||
|
|
||||||
void GridComicsView::enableFilterMode(bool enabled)
|
void GridComicsView::enableFilterMode(bool enabled)
|
||||||
{
|
{
|
||||||
Q_UNUSED(enabled);
|
filterEnabled = enabled;
|
||||||
|
|
||||||
|
QQmlContext *ctxt = view->rootContext();
|
||||||
|
|
||||||
|
if (enabled) {
|
||||||
|
ctxt->setContextProperty("showCurrentComic", false);
|
||||||
|
ctxt->setContextProperty("currentComic", nullptr);
|
||||||
|
} else {
|
||||||
|
setCurrentComicIfNeeded();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GridComicsView::selectAll()
|
void GridComicsView::selectAll()
|
||||||
@ -373,6 +392,11 @@ void GridComicsView::selectIndex(int index)
|
|||||||
selectionHelper->selectIndex(index);
|
selectionHelper->selectIndex(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GridComicsView::triggerOpenCurrentComic()
|
||||||
|
{
|
||||||
|
emit openComic(currentComic);
|
||||||
|
}
|
||||||
|
|
||||||
void GridComicsView::rate(int index, int rating)
|
void GridComicsView::rate(int index, int rating)
|
||||||
{
|
{
|
||||||
model->updateRating(rating,model->index(index,0));
|
model->updateRating(rating,model->index(index,0));
|
||||||
@ -414,6 +438,36 @@ void GridComicsView::dummyUpdater()
|
|||||||
ctxt->setContextProperty("dummyValue", true);
|
ctxt->setContextProperty("dummyValue", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GridComicsView::setCurrentComicIfNeeded()
|
||||||
|
{
|
||||||
|
bool found;
|
||||||
|
currentComic = currentComicFromModel(model, found);
|
||||||
|
|
||||||
|
QQmlContext *ctxt = view->rootContext();
|
||||||
|
|
||||||
|
if (found && filterEnabled == false) {
|
||||||
|
ctxt->setContextProperty("currentComic", ¤tComic);
|
||||||
|
ctxt->setContextProperty("currentComicInfo", &(currentComic.info));
|
||||||
|
ctxt->setContextProperty("showCurrentComic", true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ctxt->setContextProperty("currentComic", ¤tComic);
|
||||||
|
ctxt->setContextProperty("currentComicInfo", &(currentComic.info));
|
||||||
|
ctxt->setContextProperty("showCurrentComic", false);
|
||||||
|
//ctxt->setContextProperty("currentComic", nullptr);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GridComicsView::resetScroll()
|
||||||
|
{
|
||||||
|
QObject *rootObject = dynamic_cast<QObject*>(view->rootObject());
|
||||||
|
QObject *scrollView = rootObject->findChild<QObject*>("topScrollView", Qt::FindChildrenRecursively);
|
||||||
|
|
||||||
|
QMetaObject::invokeMethod(scrollView, "scrollToOrigin");
|
||||||
|
}
|
||||||
|
|
||||||
QSize GridComicsView::sizeHint()
|
QSize GridComicsView::sizeHint()
|
||||||
{
|
{
|
||||||
return QSize(1280,768);
|
return QSize(1280,768);
|
||||||
@ -431,6 +485,11 @@ QByteArray GridComicsView::getMimeDataFromSelection()
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GridComicsView::updateCurrentComicView()
|
||||||
|
{
|
||||||
|
setCurrentComicIfNeeded();
|
||||||
|
}
|
||||||
|
|
||||||
void GridComicsView::startDrag()
|
void GridComicsView::startDrag()
|
||||||
{
|
{
|
||||||
QDrag *drag = new QDrag(this);
|
QDrag *drag = new QDrag(this);
|
||||||
@ -498,7 +557,7 @@ void GridComicsView::closeEvent(QCloseEvent *event)
|
|||||||
toolbar->removeAction(coverSizeSliderAction);
|
toolbar->removeAction(coverSizeSliderAction);
|
||||||
|
|
||||||
QObject *rootObject = dynamic_cast<QObject*>(view->rootObject());
|
QObject *rootObject = dynamic_cast<QObject*>(view->rootObject());
|
||||||
QObject *infoContainer = rootObject->findChild<QObject*>("infoContainer");
|
QObject *infoContainer = rootObject->findChild<QObject*>("infoContainer", Qt::FindChildrenRecursively);
|
||||||
|
|
||||||
int infoWidth = QQmlProperty(infoContainer, "width").read().toInt();
|
int infoWidth = QQmlProperty(infoContainer, "width").read().toInt();
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include <QModelIndex>
|
#include <QModelIndex>
|
||||||
|
|
||||||
|
#include "comic_db.h"
|
||||||
|
|
||||||
|
|
||||||
class QAbstractListModel;
|
class QAbstractListModel;
|
||||||
@ -17,7 +18,6 @@ class YACReaderComicsSelectionHelper;
|
|||||||
class YACReaderComicInfoHelper;
|
class YACReaderComicInfoHelper;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class GridComicsView : public ComicsView
|
class GridComicsView : public ComicsView
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -36,12 +36,14 @@ public:
|
|||||||
void enableFilterMode(bool enabled);
|
void enableFilterMode(bool enabled);
|
||||||
QSize sizeHint();
|
QSize sizeHint();
|
||||||
QByteArray getMimeDataFromSelection();
|
QByteArray getMimeDataFromSelection();
|
||||||
|
void updateCurrentComicView();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
//ComicsView
|
//ComicsView
|
||||||
void setShowMarks(bool show);
|
void setShowMarks(bool show);
|
||||||
void selectAll();
|
void selectAll();
|
||||||
void selectIndex(int index);
|
void selectIndex(int index);
|
||||||
|
void triggerOpenCurrentComic();
|
||||||
|
|
||||||
void updateBackgroundConfig();
|
void updateBackgroundConfig();
|
||||||
|
|
||||||
@ -68,6 +70,13 @@ protected slots:
|
|||||||
|
|
||||||
void dummyUpdater(); //TODO remove this
|
void dummyUpdater(); //TODO remove this
|
||||||
|
|
||||||
|
void setCurrentComicIfNeeded();
|
||||||
|
|
||||||
|
void resetScroll();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void onScrollToOrigin();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSettings * settings;
|
QSettings * settings;
|
||||||
QToolBar * toolbar;
|
QToolBar * toolbar;
|
||||||
@ -79,9 +88,13 @@ private:
|
|||||||
QAction * showInfoAction;
|
QAction * showInfoAction;
|
||||||
QAction * showInfoSeparatorAction;
|
QAction * showInfoSeparatorAction;
|
||||||
|
|
||||||
|
boolean filterEnabled;
|
||||||
|
|
||||||
YACReaderComicsSelectionHelper * selectionHelper;
|
YACReaderComicsSelectionHelper * selectionHelper;
|
||||||
YACReaderComicInfoHelper * comicInfoHelper;
|
YACReaderComicInfoHelper * comicInfoHelper;
|
||||||
|
|
||||||
|
ComicDB currentComic;
|
||||||
|
|
||||||
bool dummy;
|
bool dummy;
|
||||||
void closeEvent ( QCloseEvent * event );
|
void closeEvent ( QCloseEvent * event );
|
||||||
void createCoverSizeSliderWidget();
|
void createCoverSizeSliderWidget();
|
||||||
|
@ -201,6 +201,11 @@ void InfoComicsView::selectIndex(int index)
|
|||||||
selectionHelper->selectIndex(index);
|
selectionHelper->selectIndex(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InfoComicsView::updateCurrentComicView()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void InfoComicsView::setShowMarks(bool show)
|
void InfoComicsView::setShowMarks(bool show)
|
||||||
{
|
{
|
||||||
QQmlContext *ctxt = view->rootContext();
|
QQmlContext *ctxt = view->rootContext();
|
||||||
|
@ -29,6 +29,7 @@ public:
|
|||||||
void updateConfig(QSettings * settings);
|
void updateConfig(QSettings * settings);
|
||||||
void enableFilterMode(bool enabled);
|
void enableFilterMode(bool enabled);
|
||||||
void selectIndex(int index);
|
void selectIndex(int index);
|
||||||
|
void updateCurrentComicView();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setShowMarks(bool show);
|
void setShowMarks(bool show);
|
||||||
|
@ -1792,14 +1792,12 @@ void LibraryWindow::checkEmptyFolder()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryWindow::openComic()
|
void LibraryWindow::openComic(const ComicDB &comic)
|
||||||
{
|
{
|
||||||
if(!importedCovers)
|
if(!importedCovers) {
|
||||||
{
|
|
||||||
ComicDB comic = comicsModel->getComic(comicsViewsManager->comicsView->currentIndex());
|
|
||||||
QList<ComicDB> siblings = comicsModel->getAllComics();
|
QList<ComicDB> siblings = comicsModel->getAllComics();
|
||||||
|
|
||||||
//TODO generate IDS for libraries...
|
//TODO generate IDS for libraries...
|
||||||
quint64 libraryId = libraries.getId(selectedLibrary->currentText());
|
quint64 libraryId = libraries.getId(selectedLibrary->currentText());
|
||||||
bool yacreaderFound = false;
|
bool yacreaderFound = false;
|
||||||
|
|
||||||
@ -1822,26 +1820,36 @@ void LibraryWindow::openComic()
|
|||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
QStringList parameters {currentPath(), QString("--comicId=%1").arg(comic.id), QString("--libraryId=%1").arg(libraryId)};
|
QStringList parameters {currentPath(), QString("--comicId=%1").arg(comic.id), QString("--libraryId=%1").arg(libraryId)};
|
||||||
yacreaderFound = QProcess::startDetached(QDir::cleanPath(QCoreApplication::applicationDirPath()), parameters);
|
yacreaderFound = QProcess::startDetached(QDir::cleanPath(QCoreApplication::applicationDirPath()+"/YACReader.exe"), parameters);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined Q_OS_UNIX && !defined Q_OS_MAC
|
#if defined Q_OS_UNIX && !defined Q_OS_MAC
|
||||||
QStringList parameters {currentPath(), QString("--comicId=%1").arg(comic.id), QString("--libraryId=%1").arg(libraryId)};
|
QStringList parameters {currentPath(), QString("--comicId=%1").arg(comic.id), QString("--libraryId=%1").arg(libraryId)};
|
||||||
yacreaderFound = QProcess::startDetached(QStringLiteral("YACReader"), parameters);
|
yacreaderFound = QProcess::startDetached(QStringLiteral("YACReader"), parameters);
|
||||||
#endif
|
#endif
|
||||||
if(!yacreaderFound)
|
if(!yacreaderFound)
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
QMessageBox::critical(this,tr("YACReader not found"),tr("YACReader not found. YACReader should be installed in the same folder as YACReaderLibrary."));
|
QMessageBox::critical(this,tr("YACReader not found"),tr("YACReader not found. YACReader should be installed in the same folder as YACReaderLibrary."));
|
||||||
#else
|
#else
|
||||||
QMessageBox::critical(this,tr("YACReader not found"),tr("YACReader not found. There might be a problem with your YACReader installation."));
|
QMessageBox::critical(this,tr("YACReader not found"),tr("YACReader not found. There might be a problem with your YACReader installation."));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LibraryWindow::openComic()
|
||||||
|
{
|
||||||
|
if(!importedCovers)
|
||||||
|
{
|
||||||
|
ComicDB comic = comicsModel->getComic(comicsViewsManager->comicsView->currentIndex());
|
||||||
|
openComic(comic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryWindow::setCurrentComicsStatusReaded(YACReaderComicReadStatus readStatus) {
|
void LibraryWindow::setCurrentComicsStatusReaded(YACReaderComicReadStatus readStatus) {
|
||||||
comicsModel->setComicsRead(getSelectedComics(),readStatus);
|
comicsModel->setComicsRead(getSelectedComics(),readStatus);
|
||||||
|
comicsViewsManager->updateCurrentComicView();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryWindow::setCurrentComicReaded() {
|
void LibraryWindow::setCurrentComicReaded() {
|
||||||
@ -2618,5 +2626,6 @@ void LibraryWindow::updateComicsView(quint64 libraryId, const ComicDB & comic)
|
|||||||
{
|
{
|
||||||
if(libraryId == libraries.getId(selectedLibrary->currentText())) {
|
if(libraryId == libraries.getId(selectedLibrary->currentText())) {
|
||||||
comicsModel->reload(comic);
|
comicsModel->reload(comic);
|
||||||
|
comicsViewsManager->updateCurrentComicView();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -296,6 +296,7 @@ public slots:
|
|||||||
void selectSubfolder(const QModelIndex & mi, int child);
|
void selectSubfolder(const QModelIndex & mi, int child);
|
||||||
void checkEmptyFolder();
|
void checkEmptyFolder();
|
||||||
void openComic();
|
void openComic();
|
||||||
|
void openComic(const ComicDB & comic);
|
||||||
void createLibrary();
|
void createLibrary();
|
||||||
void create(QString source,QString dest, QString name);
|
void create(QString source,QString dest, QString name);
|
||||||
void showAddLibrary();
|
void showAddLibrary();
|
||||||
|
@ -101,7 +101,7 @@ int main( int argc, char ** argv )
|
|||||||
QDir().mkpath(YACReader::getSettingsPath());
|
QDir().mkpath(YACReader::getSettingsPath());
|
||||||
|
|
||||||
Logger& logger = Logger::instance();
|
Logger& logger = Logger::instance();
|
||||||
logger.setLoggingLevel(QsLogging::InfoLevel);
|
logger.setLoggingLevel(QsLogging::TraceLevel);
|
||||||
|
|
||||||
DestinationPtr fileDestination(DestinationFactory::MakeFileDestination(
|
DestinationPtr fileDestination(DestinationFactory::MakeFileDestination(
|
||||||
destLog, EnableLogRotation, MaxSizeBytes(1048576), MaxOldLogCount(2)));
|
destLog, EnableLogRotation, MaxSizeBytes(1048576), MaxOldLogCount(2)));
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
<file>qml/info-indicator-light@2x.png</file>
|
<file>qml/info-indicator-light@2x.png</file>
|
||||||
<file>qml/info-shadow-light@2x.png</file>
|
<file>qml/info-shadow-light@2x.png</file>
|
||||||
<file>qml/info-top-shadow.png</file>
|
<file>qml/info-top-shadow.png</file>
|
||||||
<file>qml/ComicInfo.qml</file>
|
<file>qml/ComicInfoView.qml</file>
|
||||||
<file>qml/info-favorites.png</file>
|
<file>qml/info-favorites.png</file>
|
||||||
<file>qml/info-favorites@2x.png</file>
|
<file>qml/info-favorites@2x.png</file>
|
||||||
<file>qml/info-rating.png</file>
|
<file>qml/info-rating.png</file>
|
||||||
|
528
YACReaderLibrary/qml/ComicInfoView.qml
Normal file
528
YACReaderLibrary/qml/ComicInfoView.qml
Normal file
@ -0,0 +1,528 @@
|
|||||||
|
import QtQuick 2.6
|
||||||
|
|
||||||
|
import QtQuick.Controls 1.4
|
||||||
|
import QtQuick.Layouts 1.2
|
||||||
|
|
||||||
|
import QtGraphicalEffects 1.0
|
||||||
|
|
||||||
|
import com.yacreader.ComicInfo 1.0
|
||||||
|
import com.yacreader.ComicDB 1.0
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
|
||||||
|
color : "transparent"
|
||||||
|
id: mainContainer
|
||||||
|
|
||||||
|
height: info.height + 2 * topMargin
|
||||||
|
|
||||||
|
property string infoColor: infoTextColor
|
||||||
|
property font infoFont: Qt.font({
|
||||||
|
|
||||||
|
family: "Arial",
|
||||||
|
pixelSize: 14
|
||||||
|
});
|
||||||
|
|
||||||
|
property int topMargin : 27
|
||||||
|
|
||||||
|
property bool compact : width <= 650
|
||||||
|
|
||||||
|
RowLayout
|
||||||
|
{
|
||||||
|
id:main_layout
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
//READ------------------------------------------------------------
|
||||||
|
ColumnLayout
|
||||||
|
{
|
||||||
|
Layout.topMargin: topMargin
|
||||||
|
Layout.maximumWidth: 61
|
||||||
|
Layout.fillHeight: true
|
||||||
|
id: readStatus
|
||||||
|
|
||||||
|
Layout.alignment: Qt.AlignTop |
|
||||||
|
Qt.AlignHCenter
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
color: "transparent"
|
||||||
|
width: 61
|
||||||
|
height: 24
|
||||||
|
|
||||||
|
InfoTick {
|
||||||
|
x: 27
|
||||||
|
y: 5
|
||||||
|
|
||||||
|
read: comicInfo.read
|
||||||
|
|
||||||
|
onReadChangedByUser: {
|
||||||
|
comicInfo.read = read;
|
||||||
|
comicInfoHelper.setRead(comic_info_index, read);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
visible: !mainContainer.compact
|
||||||
|
}
|
||||||
|
|
||||||
|
//INFO------------------------------------------------------------
|
||||||
|
ColumnLayout
|
||||||
|
{
|
||||||
|
id: info
|
||||||
|
//width: parent.width
|
||||||
|
//Layout.fillWidth: true
|
||||||
|
|
||||||
|
Layout.alignment: Qt.AlignTop |
|
||||||
|
Qt.AlignLeft
|
||||||
|
|
||||||
|
Layout.maximumWidth: mainContainer.compact ? mainContainer.width : 960
|
||||||
|
|
||||||
|
Layout.leftMargin: mainContainer.compact ? 30 : 0
|
||||||
|
|
||||||
|
RowLayout
|
||||||
|
{
|
||||||
|
Layout.topMargin: topMargin
|
||||||
|
|
||||||
|
InfoTick {
|
||||||
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
|
||||||
|
|
||||||
|
read: comicInfo.read
|
||||||
|
|
||||||
|
onReadChangedByUser: {
|
||||||
|
comicInfo.read = read;
|
||||||
|
comicInfoHelper.setRead(comic_info_index, read);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
|
||||||
|
InfoFavorites {
|
||||||
|
Layout.topMargin: 1
|
||||||
|
Layout.rightMargin: 17
|
||||||
|
Layout.alignment: Qt.AlignTop
|
||||||
|
|
||||||
|
active: comicInfo.isFavorite
|
||||||
|
|
||||||
|
onActiveChangedByUser: {
|
||||||
|
if(active)
|
||||||
|
comicInfoHelper.addToFavorites(comic_info_index);
|
||||||
|
else
|
||||||
|
comicInfoHelper.removeFromFavorites(comic_info_index);
|
||||||
|
|
||||||
|
comicInfo.isFavorite = active;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
InfoRating {
|
||||||
|
Layout.alignment: Qt.AlignTop
|
||||||
|
Layout.rightMargin: 30
|
||||||
|
rating: comicInfo.rating
|
||||||
|
|
||||||
|
onRatingChangedByUser: {
|
||||||
|
comicInfo.rating = rating;
|
||||||
|
comicInfoHelper.rate(comic_info_index, rating);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
visible: mainContainer.compact
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout
|
||||||
|
{
|
||||||
|
Text {
|
||||||
|
Layout.topMargin: mainContainer.compact ? 18 : topMargin
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.rightMargin: mainContainer.compact ? 30 : 0
|
||||||
|
|
||||||
|
id: title
|
||||||
|
|
||||||
|
color: infoTitleColor
|
||||||
|
font.family: "Arial"
|
||||||
|
font.bold: true
|
||||||
|
font.pixelSize: mainContainer.compact ? 18 : 21;
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
|
||||||
|
text: comic.getTitleIncludingNumber()
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout
|
||||||
|
{
|
||||||
|
visible: !mainContainer.compact
|
||||||
|
|
||||||
|
Layout.alignment: Qt.AlignTop
|
||||||
|
Layout.topMargin: topMargin
|
||||||
|
|
||||||
|
InfoFavorites {
|
||||||
|
Layout.topMargin: 1
|
||||||
|
Layout.rightMargin: 17
|
||||||
|
Layout.alignment: Qt.AlignTop
|
||||||
|
|
||||||
|
active: comicInfo.isFavorite
|
||||||
|
|
||||||
|
onActiveChangedByUser: {
|
||||||
|
if(active)
|
||||||
|
comicInfoHelper.addToFavorites(comic_info_index);
|
||||||
|
else
|
||||||
|
comicInfoHelper.removeFromFavorites(comic_info_index);
|
||||||
|
|
||||||
|
comicInfo.isFavorite = active;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
InfoRating {
|
||||||
|
Layout.alignment: Qt.AlignTop
|
||||||
|
Layout.rightMargin: 30
|
||||||
|
rating: comicInfo.rating
|
||||||
|
|
||||||
|
onRatingChangedByUser: {
|
||||||
|
comicInfo.rating = rating;
|
||||||
|
comicInfoHelper.rate(comic_info_index, rating);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Flow {
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Text {
|
||||||
|
id: volume
|
||||||
|
color: infoColor
|
||||||
|
font: mainContainer.infoFont
|
||||||
|
text: comicInfo.volume
|
||||||
|
rightPadding: 20
|
||||||
|
visible: comicInfo.volume
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: numbering
|
||||||
|
color: infoColor
|
||||||
|
font: mainContainer.infoFont
|
||||||
|
text: comicInfo.number + "/" + comicInfo.count
|
||||||
|
rightPadding: 20
|
||||||
|
visible : comicInfo.number
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: genre
|
||||||
|
color: infoColor
|
||||||
|
font: mainContainer.infoFont
|
||||||
|
text: comicInfo.genere
|
||||||
|
rightPadding: 20
|
||||||
|
visible: comicInfo.genere
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: date
|
||||||
|
color: infoColor
|
||||||
|
font: mainContainer.infoFont
|
||||||
|
text: comicInfo.date
|
||||||
|
rightPadding: 20
|
||||||
|
visible: comicInfo.date
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: pages
|
||||||
|
color: infoColor
|
||||||
|
font: mainContainer.infoFont
|
||||||
|
text: comicInfo.numPages + " pages"
|
||||||
|
rightPadding: 20
|
||||||
|
visible: comicInfo.numPages
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: showInComicVine
|
||||||
|
font: mainContainer.infoFont
|
||||||
|
color: "#ffcc00"
|
||||||
|
text: "Show in Comic Vine"
|
||||||
|
visible: comicInfo.comicVineID
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: {
|
||||||
|
Qt.openUrlExternally("http://www.comicvine.com/comic/4000-%1/".arg(comicInfo.comicVineID));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
Layout.topMargin: 22
|
||||||
|
Layout.rightMargin: 30
|
||||||
|
Layout.bottomMargin: 5
|
||||||
|
Layout.fillWidth: true
|
||||||
|
|
||||||
|
id: sinopsis
|
||||||
|
color: infoTitleColor
|
||||||
|
font.family: "Arial"
|
||||||
|
font.pixelSize: 15
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
horizontalAlignment: Text.AlignJustify
|
||||||
|
text: comicInfo.synopsis
|
||||||
|
visible: comicInfo.synopsis
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
Layout.topMargin: 25
|
||||||
|
Layout.bottomMargin: 5
|
||||||
|
|
||||||
|
id: authors_title
|
||||||
|
color: infoTitleColor
|
||||||
|
font.family: "Arial"
|
||||||
|
font.pixelSize: 18
|
||||||
|
font.bold: true
|
||||||
|
|
||||||
|
text: "Authors"
|
||||||
|
|
||||||
|
visible: comicInfo.getWriters().length +
|
||||||
|
comicInfo.getPencillers().length +
|
||||||
|
comicInfo.getInkers().length +
|
||||||
|
comicInfo.getColorists().length +
|
||||||
|
comicInfo.getLetterers().length +
|
||||||
|
comicInfo.getCoverArtists().length > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
Flow {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
spacing: 20
|
||||||
|
Repeater {
|
||||||
|
id: writers
|
||||||
|
model: comicInfo.getWriters().length
|
||||||
|
Column{
|
||||||
|
Text {
|
||||||
|
color: infoTitleColor
|
||||||
|
font.family: "Arial"
|
||||||
|
font.pixelSize: 15
|
||||||
|
|
||||||
|
text: comicInfo.getWriters()[index]
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
color: infoTextColor
|
||||||
|
font.family: "Arial"
|
||||||
|
font.pixelSize: 13
|
||||||
|
font.italic: true
|
||||||
|
text: "writer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
id: pencilllers
|
||||||
|
model: comicInfo.getPencillers().length
|
||||||
|
Column{
|
||||||
|
Text {
|
||||||
|
color: infoTitleColor
|
||||||
|
font.family: "Arial"
|
||||||
|
font.pixelSize: 15
|
||||||
|
|
||||||
|
text: comicInfo.getPencillers()[index]
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
color: infoTextColor
|
||||||
|
font.family: "Arial"
|
||||||
|
font.pixelSize: 13
|
||||||
|
font.italic: true
|
||||||
|
text: "penciller"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
id: inkers
|
||||||
|
model: comicInfo.getInkers().length
|
||||||
|
Column{
|
||||||
|
Text {
|
||||||
|
color: infoTitleColor
|
||||||
|
font.family: "Arial"
|
||||||
|
font.pixelSize: 15
|
||||||
|
|
||||||
|
text: comicInfo.getInkers()[index]
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
color: infoTextColor
|
||||||
|
font.family: "Arial"
|
||||||
|
font.pixelSize: 13
|
||||||
|
font.italic: true
|
||||||
|
text: "inker"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
id: colorist
|
||||||
|
model: comicInfo.getColorists().length
|
||||||
|
Column{
|
||||||
|
Text {
|
||||||
|
color: infoTitleColor
|
||||||
|
font.family: "Arial"
|
||||||
|
font.pixelSize: 15
|
||||||
|
|
||||||
|
text: comicInfo.getColorists()[index]
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
color: infoTextColor
|
||||||
|
font.family: "Arial"
|
||||||
|
font.pixelSize: 13
|
||||||
|
font.italic: true
|
||||||
|
text: "colorist"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
id: letterers
|
||||||
|
model: comicInfo.getLetterers().length
|
||||||
|
Column{
|
||||||
|
Text {
|
||||||
|
color: infoTitleColor
|
||||||
|
font.family: "Arial"
|
||||||
|
font.pixelSize: 15
|
||||||
|
|
||||||
|
text: comicInfo.getLetterers()[index]
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
color: infoTextColor
|
||||||
|
font.family: "Arial"
|
||||||
|
font.pixelSize: 13
|
||||||
|
font.italic: true
|
||||||
|
text: "letterer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
id: cover_artist
|
||||||
|
model: comicInfo.getCoverArtists().length
|
||||||
|
Column{
|
||||||
|
Text {
|
||||||
|
color: infoTitleColor
|
||||||
|
font.family: "Arial"
|
||||||
|
font.pixelSize: 15
|
||||||
|
|
||||||
|
text: comicInfo.getCoverArtists()[index]
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
color: infoTextColor
|
||||||
|
font.family: "Arial"
|
||||||
|
font.pixelSize: 13
|
||||||
|
font.italic: true
|
||||||
|
text: "cover artist"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
Layout.topMargin: 25
|
||||||
|
|
||||||
|
id: publisher_title
|
||||||
|
color: infoTitleColor
|
||||||
|
font.family: "Arial"
|
||||||
|
font.pixelSize: 18
|
||||||
|
font.bold: true
|
||||||
|
|
||||||
|
text: "Publisher"
|
||||||
|
|
||||||
|
visible: publisher.visible || format.visible || color.visible || age_rating.visible
|
||||||
|
}
|
||||||
|
|
||||||
|
Flow {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
spacing: 20
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: publisher
|
||||||
|
|
||||||
|
color: infoTitleColor
|
||||||
|
font.family: "Arial"
|
||||||
|
font.pixelSize: 15
|
||||||
|
|
||||||
|
text: comicInfo.publisher
|
||||||
|
|
||||||
|
visible: comicInfo.publisher
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: format
|
||||||
|
|
||||||
|
color: infoTitleColor
|
||||||
|
font.family: "Arial"
|
||||||
|
font.pixelSize: 15
|
||||||
|
|
||||||
|
text: comicInfo.format
|
||||||
|
|
||||||
|
visible: comicInfo.format
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: color
|
||||||
|
|
||||||
|
color: infoTitleColor
|
||||||
|
font.family: "Arial"
|
||||||
|
font.pixelSize: 15
|
||||||
|
|
||||||
|
text: comicInfo.color ? "color" : "b/w"
|
||||||
|
|
||||||
|
visible: comicInfo.color
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: age_rating
|
||||||
|
|
||||||
|
color: infoTitleColor
|
||||||
|
font.family: "Arial"
|
||||||
|
font.pixelSize: 15
|
||||||
|
|
||||||
|
text: comicInfo.ageRating
|
||||||
|
|
||||||
|
visible: comicInfo.ageRating
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
Layout.topMargin: 25
|
||||||
|
Layout.bottomMargin: 5
|
||||||
|
|
||||||
|
id: characters_title
|
||||||
|
color: infoTitleColor
|
||||||
|
font.family: "Arial"
|
||||||
|
font.pixelSize: 18
|
||||||
|
font.bold: true
|
||||||
|
|
||||||
|
text: "Characters"
|
||||||
|
|
||||||
|
visible: comicInfo.getCharacters().length > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
Flow {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
spacing: 20
|
||||||
|
Repeater {
|
||||||
|
id: characters
|
||||||
|
model: comicInfo.getCharacters().length
|
||||||
|
|
||||||
|
Text {
|
||||||
|
color: infoTitleColor
|
||||||
|
font.family: "Arial"
|
||||||
|
font.pixelSize: 15
|
||||||
|
|
||||||
|
text: comicInfo.getCharacters()[index]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
Layout.fillHeight: true
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.minimumWidth: 0
|
||||||
|
Layout.preferredWidth: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,13 +1,16 @@
|
|||||||
import QtQuick 2.3
|
import QtQuick 2.9
|
||||||
|
|
||||||
import QtQuick.Controls 1.4
|
import QtQuick.Controls 1.4
|
||||||
import QtQuick.Layouts 1.2
|
import QtQuick.Layouts 1.3
|
||||||
|
|
||||||
import QtGraphicalEffects 1.0
|
import QtGraphicalEffects 1.0
|
||||||
import QtQuick.Controls.Styles 1.4
|
import QtQuick.Controls.Styles 1.4
|
||||||
|
|
||||||
import com.yacreader.ComicModel 1.0
|
import com.yacreader.ComicModel 1.0
|
||||||
|
|
||||||
|
import com.yacreader.ComicInfo 1.0
|
||||||
|
import com.yacreader.ComicDB 1.0
|
||||||
|
|
||||||
SplitView {
|
SplitView {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
orientation: Qt.Horizontal
|
orientation: Qt.Horizontal
|
||||||
@ -171,7 +174,6 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onPressed: {
|
onPressed: {
|
||||||
|
|
||||||
var ci = grid.currentIndex; //save current index
|
var ci = grid.currentIndex; //save current index
|
||||||
|
|
||||||
/*if(mouse.button != Qt.RightButton && !(mouse.modifiers & Qt.ControlModifier || mouse.modifiers & Qt.ShiftModifier))
|
/*if(mouse.button != Qt.RightButton && !(mouse.modifiers & Qt.ControlModifier || mouse.modifiers & Qt.ShiftModifier))
|
||||||
@ -385,12 +387,18 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
YACReaderScrollView {
|
ScrollView {
|
||||||
__wheelAreaScrollSpeed: grid.cellHeight * 0.30
|
__wheelAreaScrollSpeed: grid.cellHeight * 0.40
|
||||||
id: scrollView
|
id: scrollView
|
||||||
|
objectName: "topScrollView"
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: 0
|
anchors.margins: 0
|
||||||
|
|
||||||
|
function scrollToOrigin() {
|
||||||
|
flickableItem.contentY = showCurrentComic ? -270 : -20
|
||||||
|
flickableItem.contentX = 0
|
||||||
|
}
|
||||||
|
|
||||||
style: YACReaderScrollViewStyle {
|
style: YACReaderScrollViewStyle {
|
||||||
transientScrollBars: false
|
transientScrollBars: false
|
||||||
incrementControl: Item {}
|
incrementControl: Item {}
|
||||||
@ -456,22 +464,244 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: currentComicView
|
||||||
|
Rectangle {
|
||||||
|
id: currentComicViewTopView
|
||||||
|
color: "#00000000"
|
||||||
|
|
||||||
|
height: showCurrentComic ? 270 : 20
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
color: "#88000000"
|
||||||
|
|
||||||
|
id: currentComicVisualView
|
||||||
|
|
||||||
|
width: main.width
|
||||||
|
height: 250
|
||||||
|
|
||||||
|
visible: showCurrentComic
|
||||||
|
|
||||||
|
//cover
|
||||||
|
Image {
|
||||||
|
id: currentCoverElement
|
||||||
|
anchors.fill: parent
|
||||||
|
width: paintedWidth
|
||||||
|
|
||||||
|
anchors.leftMargin: 15
|
||||||
|
anchors.topMargin: 15
|
||||||
|
anchors.bottomMargin: 15
|
||||||
|
anchors.rightMargin: 15
|
||||||
|
horizontalAlignment: Image.AlignLeft
|
||||||
|
anchors {horizontalCenter: parent.horizontalCenter; top: realCell.top; topMargin: 0}
|
||||||
|
source: comicsList.getCoverUrlPathForComicHash(currentComicInfo.hash.toString())
|
||||||
|
fillMode: Image.PreserveAspectFit
|
||||||
|
smooth: true
|
||||||
|
mipmap: true
|
||||||
|
asynchronous : true
|
||||||
|
cache: false //TODO clear cache only when it is needed
|
||||||
|
}
|
||||||
|
|
||||||
|
DropShadow {
|
||||||
|
anchors.fill: currentCoverElement
|
||||||
|
horizontalOffset: 0
|
||||||
|
verticalOffset: 0
|
||||||
|
radius: 8.0
|
||||||
|
samples: 17
|
||||||
|
color: "#FF000000"
|
||||||
|
source: currentCoverElement
|
||||||
|
visible: (Qt.platform.os === "osx") ? false : true;
|
||||||
|
}
|
||||||
|
|
||||||
|
ColumnLayout
|
||||||
|
{
|
||||||
|
id: currentComicInfoView
|
||||||
|
|
||||||
|
x: currentCoverElement.anchors.rightMargin + currentCoverElement.paintedWidth + currentCoverElement.anchors.rightMargin
|
||||||
|
//y: currentCoverElement.anchors.topMargin
|
||||||
|
|
||||||
|
anchors.top: currentCoverElement.top
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.left: readButton.left
|
||||||
|
|
||||||
|
spacing: 9
|
||||||
|
|
||||||
|
Text {
|
||||||
|
Layout.topMargin: 7
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.rightMargin: 20
|
||||||
|
|
||||||
|
Layout.alignment: Qt.AlignTop | Qt.AlignLeft
|
||||||
|
|
||||||
|
id: currentComicInfoTitleView
|
||||||
|
|
||||||
|
color: infoTitleColor
|
||||||
|
font.family: "Arial"
|
||||||
|
font.bold: true
|
||||||
|
font.pixelSize: 21
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
|
||||||
|
text: currentComic.getTitleIncludingNumber()
|
||||||
|
}
|
||||||
|
|
||||||
|
Flow {
|
||||||
|
spacing: 0
|
||||||
|
Layout.alignment: Qt.AlignTop | Qt.AlignLeft
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.fillHeight: false
|
||||||
|
|
||||||
|
id: currentComicDetailsFlowView
|
||||||
|
property font infoFont: Qt.font({
|
||||||
|
family: "Arial",
|
||||||
|
pixelSize: 14
|
||||||
|
});
|
||||||
|
property string infoFlowTextColor: infoTextColor
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: currentComicInfoVolume
|
||||||
|
color: currentComicDetailsFlowView.infoFlowTextColor
|
||||||
|
font: currentComicDetailsFlowView.infoFont
|
||||||
|
text: currentComicInfo.volume
|
||||||
|
rightPadding: 20
|
||||||
|
visible: currentComicInfo.volume
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: currentComicInfoNumbering
|
||||||
|
color: currentComicDetailsFlowView.infoFlowTextColor
|
||||||
|
font: currentComicDetailsFlowView.infoFont
|
||||||
|
text: currentComicInfo.number + "/" + currentComicInfo.count
|
||||||
|
rightPadding: 20
|
||||||
|
visible : currentComicInfo.number
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: currentComicInfoGenre
|
||||||
|
color: currentComicDetailsFlowView.infoFlowTextColor
|
||||||
|
font: currentComicDetailsFlowView.infoFont
|
||||||
|
text: currentComicInfo.genere
|
||||||
|
rightPadding: 20
|
||||||
|
visible: currentComicInfo.genere
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: currentComicInfoDate
|
||||||
|
color: currentComicDetailsFlowView.infoFlowTextColor
|
||||||
|
font: currentComicDetailsFlowView.infoFont
|
||||||
|
text: currentComicInfo.date
|
||||||
|
rightPadding: 20
|
||||||
|
visible: currentComicInfo.date
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: currentComicInfoPages
|
||||||
|
color: currentComicDetailsFlowView.infoFlowTextColor
|
||||||
|
font: currentComicDetailsFlowView.infoFont
|
||||||
|
text: currentComicInfo.numPages + " pages"
|
||||||
|
rightPadding: 20
|
||||||
|
visible: currentComicInfo.numPages
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: currentComicInfoShowInComicVine
|
||||||
|
font: currentComicDetailsFlowView.infoFont
|
||||||
|
color: "#ffcc00"
|
||||||
|
text: "Show in Comic Vine"
|
||||||
|
visible: currentComicInfo.comicVineID
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: {
|
||||||
|
Qt.openUrlExternally("http://www.comicvine.com/comic/4000-%1/".arg(comicInfo.comicVineID));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
Layout.topMargin: 6
|
||||||
|
Layout.rightMargin: 30
|
||||||
|
Layout.bottomMargin: 5
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.maximumHeight: (currentComicVisualView.height * 0.32)
|
||||||
|
Layout.maximumWidth: 960
|
||||||
|
|
||||||
|
id: currentComicInfoSinopsis
|
||||||
|
color: infoTitleColor
|
||||||
|
font.family: "Arial"
|
||||||
|
font.pixelSize: 14
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
elide: Text.ElideRight
|
||||||
|
horizontalAlignment: Text.AlignJustify
|
||||||
|
text: currentComicInfo.synopsis
|
||||||
|
visible: currentComicInfo.synopsis
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
text: "Read"
|
||||||
|
id: readButton
|
||||||
|
x: currentCoverElement.anchors.rightMargin + currentCoverElement.paintedWidth + currentCoverElement.anchors.rightMargin
|
||||||
|
anchors.bottom: currentCoverElement.bottom
|
||||||
|
anchors.bottomMargin: 15
|
||||||
|
|
||||||
|
onClicked: comicOpener.triggerOpenCurrentComic()
|
||||||
|
|
||||||
|
style: ButtonStyle {
|
||||||
|
background: Rectangle {
|
||||||
|
implicitWidth: 100
|
||||||
|
implicitHeight: 30
|
||||||
|
border.width: control.activeFocus ? 2 : 1
|
||||||
|
border.color: "#FFCC00"
|
||||||
|
radius: height / 2
|
||||||
|
color: "#FFCC00"
|
||||||
|
|
||||||
|
}
|
||||||
|
label: Text {
|
||||||
|
renderType: Text.NativeRendering
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
font.family: "Arial"
|
||||||
|
font.pointSize: 12
|
||||||
|
font.bold: true
|
||||||
|
color: "white"
|
||||||
|
text: control.text
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DropShadow {
|
||||||
|
anchors.fill: readButton
|
||||||
|
horizontalOffset: 0
|
||||||
|
verticalOffset: 0
|
||||||
|
radius: 8.0
|
||||||
|
samples: 17
|
||||||
|
color: "#AA000000"
|
||||||
|
source: readButton
|
||||||
|
visible: ((Qt.platform.os === "osx") ? false : true) && !readButton.pressed
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GridView {
|
GridView {
|
||||||
id:grid
|
id:grid
|
||||||
objectName: "grid"
|
objectName: "grid"
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
cellHeight: cellCustomHeight
|
cellHeight: cellCustomHeight
|
||||||
|
header: currentComicView
|
||||||
//highlight: appHighlight
|
//highlight: appHighlight
|
||||||
focus: true
|
focus: true
|
||||||
model: comicsList
|
model: comicsList
|
||||||
delegate: appDelegate
|
delegate: appDelegate
|
||||||
anchors.topMargin: 20
|
anchors.topMargin: 0 //showCurrentComic ? 0 : 20
|
||||||
anchors.bottomMargin: 20
|
anchors.bottomMargin: 20
|
||||||
anchors.leftMargin: 10
|
anchors.leftMargin: 0
|
||||||
anchors.rightMargin: 10
|
anchors.rightMargin: 0
|
||||||
pixelAligned: true
|
pixelAligned: true
|
||||||
//flickDeceleration: -2000
|
//flickDeceleration: -2000
|
||||||
|
|
||||||
|
|
||||||
currentIndex: 0
|
currentIndex: 0
|
||||||
cacheBuffer: 0
|
cacheBuffer: 0
|
||||||
|
|
||||||
@ -620,7 +850,7 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ComicInfo {
|
ComicInfoView {
|
||||||
width: info_container.width
|
width: info_container.width
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ComicInfo {
|
ComicInfoView {
|
||||||
width: info_container.width - 14
|
width: info_container.width - 14
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ Style {
|
|||||||
id: root
|
id: root
|
||||||
|
|
||||||
/*! The \l ScrollView this style is attached to. */
|
/*! The \l ScrollView this style is attached to. */
|
||||||
readonly property YACReaderScrollView control: __control
|
readonly property ScrollView control: __control
|
||||||
|
|
||||||
/*! This property controls the frame border padding of the scrollView. */
|
/*! This property controls the frame border padding of the scrollView. */
|
||||||
padding {left: 1; top: 1; right: 1; bottom: 1}
|
padding {left: 1; top: 1; right: 1; bottom: 1}
|
||||||
|
@ -70,6 +70,13 @@ QWidget * YACReaderComicsViewsManager::containerWidget()
|
|||||||
return comicsViewStack;
|
return comicsViewStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void YACReaderComicsViewsManager::updateCurrentComicView()
|
||||||
|
{
|
||||||
|
if (comicsViewStack->currentWidget() == comicsView) {
|
||||||
|
comicsView->updateCurrentComicView();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void YACReaderComicsViewsManager::showComicsView()
|
void YACReaderComicsViewsManager::showComicsView()
|
||||||
{
|
{
|
||||||
comicsViewStack->setCurrentWidget(comicsView);
|
comicsViewStack->setCurrentWidget(comicsView);
|
||||||
@ -123,6 +130,7 @@ void YACReaderComicsViewsManager::disconnectComicsViewConnections(ComicsView * w
|
|||||||
disconnect(widget, SIGNAL(comicRated(int,QModelIndex)), libraryWindow->comicsModel, SLOT(updateRating(int,QModelIndex)));
|
disconnect(widget, SIGNAL(comicRated(int,QModelIndex)), libraryWindow->comicsModel, SLOT(updateRating(int,QModelIndex)));
|
||||||
disconnect(libraryWindow->showHideMarksAction,SIGNAL(toggled(bool)),widget,SLOT(setShowMarks(bool)));
|
disconnect(libraryWindow->showHideMarksAction,SIGNAL(toggled(bool)),widget,SLOT(setShowMarks(bool)));
|
||||||
disconnect(widget,SIGNAL(selected(unsigned int)),libraryWindow,SLOT(openComic()));
|
disconnect(widget,SIGNAL(selected(unsigned int)),libraryWindow,SLOT(openComic()));
|
||||||
|
disconnect(widget,SIGNAL(openComic(ComicDB)),libraryWindow,SLOT(openComic(ComicDB)));
|
||||||
disconnect(libraryWindow->selectAllComicsAction,SIGNAL(triggered()),widget,SLOT(selectAll()));
|
disconnect(libraryWindow->selectAllComicsAction,SIGNAL(triggered()),widget,SLOT(selectAll()));
|
||||||
disconnect(comicsView, SIGNAL(copyComicsToCurrentFolder(QList<QPair<QString, QString> >)), libraryWindow, SLOT(copyAndImportComicsToCurrentFolder(QList<QPair<QString, QString> >)));
|
disconnect(comicsView, SIGNAL(copyComicsToCurrentFolder(QList<QPair<QString, QString> >)), libraryWindow, SLOT(copyAndImportComicsToCurrentFolder(QList<QPair<QString, QString> >)));
|
||||||
disconnect(comicsView, SIGNAL(moveComicsToCurrentFolder(QList<QPair<QString, QString> >)), libraryWindow, SLOT(moveAndImportComicsToCurrentFolder(QList<QPair<QString, QString> >)));
|
disconnect(comicsView, SIGNAL(moveComicsToCurrentFolder(QList<QPair<QString, QString> >)), libraryWindow, SLOT(moveAndImportComicsToCurrentFolder(QList<QPair<QString, QString> >)));
|
||||||
@ -135,6 +143,8 @@ void YACReaderComicsViewsManager::doComicsViewConnections()
|
|||||||
connect(comicsView, SIGNAL(comicRated(int,QModelIndex)), libraryWindow->comicsModel, SLOT(updateRating(int,QModelIndex)));
|
connect(comicsView, SIGNAL(comicRated(int,QModelIndex)), libraryWindow->comicsModel, SLOT(updateRating(int,QModelIndex)));
|
||||||
connect(libraryWindow->showHideMarksAction,SIGNAL(toggled(bool)),comicsView,SLOT(setShowMarks(bool)));
|
connect(libraryWindow->showHideMarksAction,SIGNAL(toggled(bool)),comicsView,SLOT(setShowMarks(bool)));
|
||||||
connect(comicsView,SIGNAL(selected(unsigned int)),libraryWindow,SLOT(openComic()));
|
connect(comicsView,SIGNAL(selected(unsigned int)),libraryWindow,SLOT(openComic()));
|
||||||
|
connect(comicsView,SIGNAL(openComic(ComicDB)),libraryWindow,SLOT(openComic(ComicDB)));
|
||||||
|
|
||||||
connect(libraryWindow->selectAllComicsAction,SIGNAL(triggered()),comicsView,SLOT(selectAll()));
|
connect(libraryWindow->selectAllComicsAction,SIGNAL(triggered()),comicsView,SLOT(selectAll()));
|
||||||
|
|
||||||
connect(comicsView,SIGNAL(customContextMenuViewRequested(QPoint)),libraryWindow,SLOT(showComicsViewContextMenu(QPoint)));
|
connect(comicsView,SIGNAL(customContextMenuViewRequested(QPoint)),libraryWindow,SLOT(showComicsViewContextMenu(QPoint)));
|
||||||
|
@ -39,6 +39,8 @@ public:
|
|||||||
|
|
||||||
NoSearchResultsWidget * noSearchResultsWidget;
|
NoSearchResultsWidget * noSearchResultsWidget;
|
||||||
|
|
||||||
|
void updateCurrentComicView();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QStackedWidget * comicsViewStack;
|
QStackedWidget * comicsViewStack;
|
||||||
LibraryWindow * libraryWindow;
|
LibraryWindow * libraryWindow;
|
||||||
|
@ -60,12 +60,12 @@ void YACReaderNavigationController::loadFolderInfo(const QModelIndex &modelIndex
|
|||||||
|
|
||||||
//check comics in folder with id = folderId
|
//check comics in folder with id = folderId
|
||||||
libraryWindow->comicsModel->setupFolderModelData(folderId,libraryWindow->foldersModel->getDatabase());
|
libraryWindow->comicsModel->setupFolderModelData(folderId,libraryWindow->foldersModel->getDatabase());
|
||||||
comicsViewsManager->comicsView->setModel(libraryWindow->comicsModel);
|
|
||||||
|
|
||||||
//configure views
|
//configure views
|
||||||
if(libraryWindow->comicsModel->rowCount() > 0)
|
if(libraryWindow->comicsModel->rowCount() > 0)
|
||||||
{
|
{
|
||||||
//updateView
|
//updateView
|
||||||
|
comicsViewsManager->comicsView->setModel(libraryWindow->comicsModel);
|
||||||
comicsViewsManager->showComicsView();
|
comicsViewsManager->showComicsView();
|
||||||
libraryWindow->disableComicsActions(false);
|
libraryWindow->disableComicsActions(false);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user