mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
Reading status added
sending comic info to yacreaderlibrary on openNext/openPrevious
This commit is contained in:
parent
020219a3a4
commit
79fe9a3f2d
@ -171,7 +171,7 @@ void MainWindowViewer::setupUI()
|
|||||||
QString pathFile = QCoreApplication::arguments().at(1);
|
QString pathFile = QCoreApplication::arguments().at(1);
|
||||||
currentDirectory = pathFile;
|
currentDirectory = pathFile;
|
||||||
quint64 comicId = QCoreApplication::arguments().at(2).toULongLong();
|
quint64 comicId = QCoreApplication::arguments().at(2).toULongLong();
|
||||||
quint64 libraryId = QCoreApplication::arguments().at(3).toULongLong();
|
libraryId = QCoreApplication::arguments().at(3).toULongLong();
|
||||||
int page = QCoreApplication::arguments().at(4).toULongLong();
|
int page = QCoreApplication::arguments().at(4).toULongLong();
|
||||||
|
|
||||||
enableActions();
|
enableActions();
|
||||||
@ -848,7 +848,7 @@ void MainWindowViewer::closeEvent ( QCloseEvent * event )
|
|||||||
currentComicDB.info.currentPage = viewer->getCurrentPageNumber()+1;
|
currentComicDB.info.currentPage = viewer->getCurrentPageNumber()+1;
|
||||||
currentComicDB.info.hasBeenOpened = true;
|
currentComicDB.info.hasBeenOpened = true;
|
||||||
//viewer->getBookmarks();
|
//viewer->getBookmarks();
|
||||||
client.sendComicInfo(0,currentComicDB);
|
client.sendComicInfo(libraryId,currentComicDB);
|
||||||
}
|
}
|
||||||
|
|
||||||
viewer->save();
|
viewer->save();
|
||||||
@ -865,8 +865,18 @@ void MainWindowViewer::closeEvent ( QCloseEvent * event )
|
|||||||
|
|
||||||
void MainWindowViewer::openPreviousComic()
|
void MainWindowViewer::openPreviousComic()
|
||||||
{
|
{
|
||||||
|
YACReaderLocalClient client;
|
||||||
if(!siblingComics.isEmpty())
|
if(!siblingComics.isEmpty())
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if(isClient)
|
||||||
|
{
|
||||||
|
currentComicDB.info.currentPage = viewer->getCurrentPageNumber()+1;
|
||||||
|
currentComicDB.info.hasBeenOpened = true;
|
||||||
|
//viewer->getBookmarks();
|
||||||
|
client.sendComicInfo(libraryId,currentComicDB);
|
||||||
|
}
|
||||||
|
|
||||||
int currentIndex = siblingComics.indexOf(currentComicDB);
|
int currentIndex = siblingComics.indexOf(currentComicDB);
|
||||||
if (currentIndex == -1)
|
if (currentIndex == -1)
|
||||||
return;
|
return;
|
||||||
@ -889,8 +899,17 @@ void MainWindowViewer::openPreviousComic()
|
|||||||
|
|
||||||
void MainWindowViewer::openNextComic()
|
void MainWindowViewer::openNextComic()
|
||||||
{
|
{
|
||||||
|
YACReaderLocalClient client;
|
||||||
if(!siblingComics.isEmpty())
|
if(!siblingComics.isEmpty())
|
||||||
{
|
{
|
||||||
|
if(isClient)
|
||||||
|
{
|
||||||
|
currentComicDB.info.currentPage = viewer->getCurrentPageNumber()+1;
|
||||||
|
currentComicDB.info.hasBeenOpened = true;
|
||||||
|
//viewer->getBookmarks();
|
||||||
|
client.sendComicInfo(libraryId,currentComicDB);
|
||||||
|
}
|
||||||
|
|
||||||
int currentIndex = siblingComics.indexOf(currentComicDB);
|
int currentIndex = siblingComics.indexOf(currentComicDB);
|
||||||
if (currentIndex == -1)
|
if (currentIndex == -1)
|
||||||
return;
|
return;
|
||||||
|
@ -122,6 +122,7 @@ class YACReaderSliderAction;
|
|||||||
ComicDB currentComicDB;
|
ComicDB currentComicDB;
|
||||||
QList<ComicDB> siblingComics;
|
QList<ComicDB> siblingComics;
|
||||||
bool isClient;
|
bool isClient;
|
||||||
|
quint64 libraryId;
|
||||||
signals:
|
signals:
|
||||||
void closed();
|
void closed();
|
||||||
protected:
|
protected:
|
||||||
|
@ -47,7 +47,7 @@ void ComicFlowWidgetSW::setShowMarks(bool value)
|
|||||||
{
|
{
|
||||||
flow->setShowMarks(value);
|
flow->setShowMarks(value);
|
||||||
}
|
}
|
||||||
void ComicFlowWidgetSW::setMarks(QVector<bool> marks)
|
void ComicFlowWidgetSW::setMarks(QVector<YACReaderComicReadStatus> marks)
|
||||||
{
|
{
|
||||||
flow->setMarks(marks);
|
flow->setMarks(marks);
|
||||||
}
|
}
|
||||||
@ -55,9 +55,9 @@ void ComicFlowWidgetSW::setMarkImage(QImage & image)
|
|||||||
{
|
{
|
||||||
flow->setMarkImage(image);
|
flow->setMarkImage(image);
|
||||||
}
|
}
|
||||||
void ComicFlowWidgetSW::markSlide(int index)
|
void ComicFlowWidgetSW::markSlide(int index, YACReaderComicReadStatus status)
|
||||||
{
|
{
|
||||||
flow->markSlide(index);
|
flow->markSlide(index,status);
|
||||||
}
|
}
|
||||||
void ComicFlowWidgetSW::unmarkSlide(int index)
|
void ComicFlowWidgetSW::unmarkSlide(int index)
|
||||||
{
|
{
|
||||||
@ -181,7 +181,7 @@ void ComicFlowWidgetGL::setShowMarks(bool value)
|
|||||||
{
|
{
|
||||||
flow->setShowMarks(value);
|
flow->setShowMarks(value);
|
||||||
}
|
}
|
||||||
void ComicFlowWidgetGL::setMarks(QVector<bool> marks)
|
void ComicFlowWidgetGL::setMarks(QVector<YACReaderComicReadStatus> marks)
|
||||||
{
|
{
|
||||||
flow->setMarks(marks);
|
flow->setMarks(marks);
|
||||||
}
|
}
|
||||||
@ -189,9 +189,9 @@ void ComicFlowWidgetGL::setMarkImage(QImage & image)
|
|||||||
{
|
{
|
||||||
flow->setMarkImage(image);
|
flow->setMarkImage(image);
|
||||||
}
|
}
|
||||||
void ComicFlowWidgetGL::markSlide(int index)
|
void ComicFlowWidgetGL::markSlide(int index, YACReaderComicReadStatus status)
|
||||||
{
|
{
|
||||||
flow->markSlide(index);
|
flow->markSlide(index,status);
|
||||||
}
|
}
|
||||||
void ComicFlowWidgetGL::unmarkSlide(int index)
|
void ComicFlowWidgetGL::unmarkSlide(int index)
|
||||||
{
|
{
|
||||||
|
@ -16,9 +16,9 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void setShowMarks(bool value) = 0;
|
virtual void setShowMarks(bool value) = 0;
|
||||||
virtual void setMarks(QVector<bool> marks) = 0;
|
virtual void setMarks(QVector<YACReaderComicReadStatus> marks) = 0;
|
||||||
virtual void setMarkImage(QImage & image) = 0;
|
virtual void setMarkImage(QImage & image) = 0;
|
||||||
virtual void markSlide(int index) = 0;
|
virtual void markSlide(int index, YACReaderComicReadStatus status) = 0;
|
||||||
virtual void unmarkSlide(int index) = 0;
|
virtual void unmarkSlide(int index) = 0;
|
||||||
virtual void setSlideSize(QSize size) = 0;
|
virtual void setSlideSize(QSize size) = 0;
|
||||||
virtual void clear() = 0;
|
virtual void clear() = 0;
|
||||||
@ -46,9 +46,9 @@ public:
|
|||||||
ComicFlowWidgetSW(QWidget * parent = 0);
|
ComicFlowWidgetSW(QWidget * parent = 0);
|
||||||
|
|
||||||
void setShowMarks(bool value);
|
void setShowMarks(bool value);
|
||||||
void setMarks(QVector<bool> marks);
|
void setMarks(QVector<YACReaderComicReadStatus> marks);
|
||||||
void setMarkImage(QImage & image);
|
void setMarkImage(QImage & image);
|
||||||
void markSlide(int index);
|
void markSlide(int index, YACReaderComicReadStatus status);
|
||||||
void unmarkSlide(int index);
|
void unmarkSlide(int index);
|
||||||
void setSlideSize(QSize size);
|
void setSlideSize(QSize size);
|
||||||
void clear();
|
void clear();
|
||||||
@ -82,9 +82,9 @@ public:
|
|||||||
ComicFlowWidgetGL(QWidget * parent = 0);
|
ComicFlowWidgetGL(QWidget * parent = 0);
|
||||||
|
|
||||||
void setShowMarks(bool value);
|
void setShowMarks(bool value);
|
||||||
void setMarks(QVector<bool> marks);
|
void setMarks(QVector<YACReaderComicReadStatus> marks);
|
||||||
void setMarkImage(QImage & image);
|
void setMarkImage(QImage & image);
|
||||||
void markSlide(int index);
|
void markSlide(int index, YACReaderComicReadStatus status);
|
||||||
void unmarkSlide(int index);
|
void unmarkSlide(int index);
|
||||||
void setSlideSize(QSize size);
|
void setSlideSize(QSize size);
|
||||||
void clear();
|
void clear();
|
||||||
|
@ -10,19 +10,22 @@
|
|||||||
#include "db_helper.h"
|
#include "db_helper.h"
|
||||||
|
|
||||||
//ci.number,ci.title,c.fileName,ci.numPages,c.id,c.parentId,c.path,ci.hash,ci.read
|
//ci.number,ci.title,c.fileName,ci.numPages,c.id,c.parentId,c.path,ci.hash,ci.read
|
||||||
#define NUMBER 0
|
enum Columns {
|
||||||
#define TITLE 1
|
Number = 0,
|
||||||
#define FILE_NAME 2
|
Title = 1,
|
||||||
#define NUM_PAGES 3
|
FileName = 2,
|
||||||
#define ID 4
|
NumPages = 3,
|
||||||
#define PARENT_ID 5
|
Id = 4,
|
||||||
#define PATH 6
|
Parent_Id = 5,
|
||||||
#define HASH 7
|
Path = 6,
|
||||||
#define READ 8
|
Hash = 7,
|
||||||
#define IS_BIS 9
|
ReadColumn = 8,
|
||||||
#define CURRENT_PAGE 10
|
IsBis = 9,
|
||||||
#define RATING 11
|
CurrentPage = 10,
|
||||||
#define HAS_BEEN_OPENED 12
|
Rating = 11,
|
||||||
|
HasBeenOpened = 12
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
TableModel::TableModel(QObject *parent)
|
TableModel::TableModel(QObject *parent)
|
||||||
: QAbstractItemModel(parent)
|
: QAbstractItemModel(parent)
|
||||||
@ -61,7 +64,7 @@ QVariant TableModel::data(const QModelIndex &index, int role) const
|
|||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
if (index.column() == RATING && role == Qt::DecorationRole)
|
if (index.column() == Columns::Rating && role == Qt::DecorationRole)
|
||||||
{
|
{
|
||||||
TableItem *item = static_cast<TableItem*>(index.internalPointer());
|
TableItem *item = static_cast<TableItem*>(index.internalPointer());
|
||||||
return QPixmap(QString(":/images/rating%1.png").arg(item->data(index.column()).toInt()));
|
return QPixmap(QString(":/images/rating%1.png").arg(item->data(index.column()).toInt()));
|
||||||
@ -82,7 +85,7 @@ QVariant TableModel::data(const QModelIndex &index, int role) const
|
|||||||
return QVariant(Qt::AlignRight | Qt::AlignVCenter);
|
return QVariant(Qt::AlignRight | Qt::AlignVCenter);
|
||||||
case 7:
|
case 7:
|
||||||
return QVariant(Qt::AlignRight | Qt::AlignVCenter);
|
return QVariant(Qt::AlignRight | Qt::AlignVCenter);
|
||||||
case CURRENT_PAGE:
|
case Columns::CurrentPage:
|
||||||
return QVariant(Qt::AlignRight | Qt::AlignVCenter);
|
return QVariant(Qt::AlignRight | Qt::AlignVCenter);
|
||||||
default:
|
default:
|
||||||
return QVariant(Qt::AlignLeft | Qt::AlignVCenter);
|
return QVariant(Qt::AlignLeft | Qt::AlignVCenter);
|
||||||
@ -94,14 +97,14 @@ QVariant TableModel::data(const QModelIndex &index, int role) const
|
|||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
TableItem *item = static_cast<TableItem*>(index.internalPointer());
|
TableItem *item = static_cast<TableItem*>(index.internalPointer());
|
||||||
if(index.column() == HASH)
|
if(index.column() == Columns::Hash)
|
||||||
return QString::number(item->data(index.column()).toString().right(item->data(index.column()).toString().length()-40).toInt()/1024.0/1024.0,'f',2)+"Mb";
|
return QString::number(item->data(index.column()).toString().right(item->data(index.column()).toString().length()-40).toInt()/1024.0/1024.0,'f',2)+"Mb";
|
||||||
if(index.column() == READ)
|
if(index.column() == Columns::ReadColumn)
|
||||||
return item->data(index.column()).toBool()?QVariant(tr("yes")):QVariant(tr("no"));
|
return (item->data(Columns::CurrentPage).toInt()==item->data(Columns::NumPages).toInt() || item->data(Columns::ReadColumn).toBool())?QVariant(tr("yes")):QVariant(tr("no"));
|
||||||
if(index.column() == CURRENT_PAGE)
|
if(index.column() == Columns::CurrentPage)
|
||||||
return item->data(HAS_BEEN_OPENED).toBool()?item->data(index.column()):QVariant("-");
|
return item->data(Columns::HasBeenOpened).toBool()?item->data(index.column()):QVariant("-");
|
||||||
|
|
||||||
if (index.column() == RATING)
|
if (index.column() == Columns::Rating)
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
return item->data(index.column());
|
return item->data(index.column());
|
||||||
@ -138,9 +141,9 @@ QVariant TableModel::headerData(int section, Qt::Orientation orientation,
|
|||||||
return QVariant(QString(tr("Size")));
|
return QVariant(QString(tr("Size")));
|
||||||
case 8:
|
case 8:
|
||||||
return QVariant(QString(tr("Read")));
|
return QVariant(QString(tr("Read")));
|
||||||
case CURRENT_PAGE:
|
case Columns::CurrentPage:
|
||||||
return QVariant(QString(tr("Current Page")));
|
return QVariant(QString(tr("Current Page")));
|
||||||
case RATING:
|
case Columns::Rating:
|
||||||
return QVariant(QString(tr("Rating")));
|
return QVariant(QString(tr("Rating")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -155,7 +158,7 @@ QVariant TableModel::headerData(int section, Qt::Orientation orientation,
|
|||||||
return QVariant(Qt::AlignRight | Qt::AlignVCenter);
|
return QVariant(Qt::AlignRight | Qt::AlignVCenter);
|
||||||
case 7:
|
case 7:
|
||||||
return QVariant(Qt::AlignRight | Qt::AlignVCenter);
|
return QVariant(Qt::AlignRight | Qt::AlignVCenter);
|
||||||
case CURRENT_PAGE:
|
case Columns::CurrentPage:
|
||||||
return QVariant(Qt::AlignRight | Qt::AlignVCenter);
|
return QVariant(Qt::AlignRight | Qt::AlignVCenter);
|
||||||
default:
|
default:
|
||||||
return QVariant(Qt::AlignLeft | Qt::AlignVCenter);
|
return QVariant(Qt::AlignLeft | Qt::AlignVCenter);
|
||||||
@ -165,7 +168,7 @@ QVariant TableModel::headerData(int section, Qt::Orientation orientation,
|
|||||||
|
|
||||||
if(orientation == Qt::Vertical && role == Qt::DecorationRole)
|
if(orientation == Qt::Vertical && role == Qt::DecorationRole)
|
||||||
{
|
{
|
||||||
QString fileName = _data.value(section)->data(FILE_NAME).toString();
|
QString fileName = _data.value(section)->data(Columns::FileName).toString();
|
||||||
QFileInfo fi(fileName);
|
QFileInfo fi(fileName);
|
||||||
QString ext = fi.suffix();
|
QString ext = fi.suffix();
|
||||||
|
|
||||||
@ -233,7 +236,7 @@ QStringList TableModel::getPaths(const QString & _source)
|
|||||||
QList<TableItem *>::ConstIterator itr;
|
QList<TableItem *>::ConstIterator itr;
|
||||||
for(itr = _data.constBegin();itr != _data.constEnd();itr++)
|
for(itr = _data.constBegin();itr != _data.constEnd();itr++)
|
||||||
{
|
{
|
||||||
QString hash = (*itr)->data(HASH).toString();
|
QString hash = (*itr)->data(Columns::Hash).toString();
|
||||||
paths << source+ hash +".jpg";
|
paths << source+ hash +".jpg";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -276,7 +279,7 @@ void TableModel::setupModelData(unsigned long long int folderId,const QString &
|
|||||||
QString TableModel::getComicPath(QModelIndex mi)
|
QString TableModel::getComicPath(QModelIndex mi)
|
||||||
{
|
{
|
||||||
if(mi.isValid())
|
if(mi.isValid())
|
||||||
return _data.at(mi.row())->data(PATH).toString();
|
return _data.at(mi.row())->data(Columns::Path).toString();
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
#define NUMBER_MAX 99999999
|
#define NUMBER_MAX 99999999
|
||||||
@ -297,16 +300,16 @@ void TableModel::setupModelData(QSqlQuery &sqlquery)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
TableItem * last = _data.back();
|
TableItem * last = _data.back();
|
||||||
QString nameLast = last->data(FILE_NAME).toString();
|
QString nameLast = last->data(Columns::FileName).toString();
|
||||||
QString nameCurrent = currentItem->data(FILE_NAME).toString();
|
QString nameCurrent = currentItem->data(Columns::FileName).toString();
|
||||||
int numberLast,numberCurrent;
|
int numberLast,numberCurrent;
|
||||||
numberLast = numberCurrent = NUMBER_MAX; //TODO change by std limit
|
numberLast = numberCurrent = NUMBER_MAX; //TODO change by std limit
|
||||||
|
|
||||||
if(!last->data(NUMBER).isNull())
|
if(!last->data(Columns::Number).isNull())
|
||||||
numberLast = last->data(NUMBER).toInt();
|
numberLast = last->data(Columns::Number).toInt();
|
||||||
|
|
||||||
if(!currentItem->data(NUMBER).isNull())
|
if(!currentItem->data(Columns::Number).isNull())
|
||||||
numberCurrent = currentItem->data(NUMBER).toInt();
|
numberCurrent = currentItem->data(Columns::Number).toInt();
|
||||||
|
|
||||||
QList<TableItem *>::iterator i;
|
QList<TableItem *>::iterator i;
|
||||||
i = _data.end();
|
i = _data.end();
|
||||||
@ -319,8 +322,8 @@ void TableModel::setupModelData(QSqlQuery &sqlquery)
|
|||||||
i--;
|
i--;
|
||||||
numberLast = NUMBER_MAX; //TODO change by std limit
|
numberLast = NUMBER_MAX; //TODO change by std limit
|
||||||
|
|
||||||
if(!(*i)->data(NUMBER).isNull())
|
if(!(*i)->data(Columns::Number).isNull())
|
||||||
numberLast = (*i)->data(NUMBER).toInt();
|
numberLast = (*i)->data(Columns::Number).toInt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -328,11 +331,11 @@ void TableModel::setupModelData(QSqlQuery &sqlquery)
|
|||||||
while ((lessThan = naturalSortLessThanCI(nameCurrent,nameLast)) && i != _data.begin() && numberLast == 99999999)
|
while ((lessThan = naturalSortLessThanCI(nameCurrent,nameLast)) && i != _data.begin() && numberLast == 99999999)
|
||||||
{
|
{
|
||||||
i--;
|
i--;
|
||||||
nameLast = (*i)->data(FILE_NAME).toString();
|
nameLast = (*i)->data(Columns::FileName).toString();
|
||||||
numberLast = NUMBER_MAX; //TODO change by std limit
|
numberLast = NUMBER_MAX; //TODO change by std limit
|
||||||
|
|
||||||
if(!(*i)->data(NUMBER).isNull())
|
if(!(*i)->data(Columns::Number).isNull())
|
||||||
numberLast = (*i)->data(NUMBER).toInt();
|
numberLast = (*i)->data(Columns::Number).toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -341,7 +344,7 @@ void TableModel::setupModelData(QSqlQuery &sqlquery)
|
|||||||
if(numberCurrent != NUMBER_MAX)
|
if(numberCurrent != NUMBER_MAX)
|
||||||
{
|
{
|
||||||
if(numberCurrent == numberLast)
|
if(numberCurrent == numberLast)
|
||||||
if(currentItem->data(IS_BIS).toBool())
|
if(currentItem->data(Columns::IsBis).toBool())
|
||||||
{
|
{
|
||||||
_data.insert(++i,currentItem);
|
_data.insert(++i,currentItem);
|
||||||
}
|
}
|
||||||
@ -365,7 +368,7 @@ void TableModel::setupModelData(QSqlQuery &sqlquery)
|
|||||||
ComicDB TableModel::getComic(const QModelIndex & mi)
|
ComicDB TableModel::getComic(const QModelIndex & mi)
|
||||||
{
|
{
|
||||||
QSqlDatabase db = DataBaseManagement::loadDatabase(_databasePath);
|
QSqlDatabase db = DataBaseManagement::loadDatabase(_databasePath);
|
||||||
ComicDB c = DBHelper::loadComic(_data.at(mi.row())->data(ID).toULongLong(),db);
|
ComicDB c = DBHelper::loadComic(_data.at(mi.row())->data(Columns::Id).toULongLong(),db);
|
||||||
db.close();
|
db.close();
|
||||||
QSqlDatabase::removeDatabase(_databasePath);
|
QSqlDatabase::removeDatabase(_databasePath);
|
||||||
|
|
||||||
@ -375,7 +378,7 @@ ComicDB TableModel::getComic(const QModelIndex & mi)
|
|||||||
ComicDB TableModel::_getComic(const QModelIndex & mi)
|
ComicDB TableModel::_getComic(const QModelIndex & mi)
|
||||||
{
|
{
|
||||||
QSqlDatabase db = DataBaseManagement::loadDatabase(_databasePath);
|
QSqlDatabase db = DataBaseManagement::loadDatabase(_databasePath);
|
||||||
ComicDB c = DBHelper::loadComic(_data.at(mi.row())->data(ID).toULongLong(),db);
|
ComicDB c = DBHelper::loadComic(_data.at(mi.row())->data(Columns::Id).toULongLong(),db);
|
||||||
db.close();
|
db.close();
|
||||||
QSqlDatabase::removeDatabase(_databasePath);
|
QSqlDatabase::removeDatabase(_databasePath);
|
||||||
|
|
||||||
@ -383,36 +386,53 @@ ComicDB TableModel::_getComic(const QModelIndex & mi)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QVector<bool> TableModel::getReadList()
|
QVector<YACReaderComicReadStatus> TableModel::getReadList()
|
||||||
{
|
{
|
||||||
int numComics = _data.count();
|
int numComics = _data.count();
|
||||||
QVector<bool> readList(numComics);
|
QVector<YACReaderComicReadStatus> readList(numComics);
|
||||||
for(int i=0;i<numComics;i++)
|
for(int i=0;i<numComics;i++)
|
||||||
{
|
{
|
||||||
readList[i] = _data.value(i)->data(READ).toBool();
|
if(_data.value(i)->data(Columns::ReadColumn).toBool())
|
||||||
|
readList[i] = YACReaderComicReadStatus::Read;
|
||||||
|
else if (_data.value(i)->data(Columns::CurrentPage).toInt() == _data.value(i)->data(Columns::NumPages).toInt())
|
||||||
|
readList[i] = YACReaderComicReadStatus::Read;
|
||||||
|
else if (_data.value(i)->data(Columns::HasBeenOpened).toBool())
|
||||||
|
readList[i] = YACReaderComicReadStatus::Opened;
|
||||||
|
else
|
||||||
|
readList[i] = YACReaderComicReadStatus::Unread;
|
||||||
}
|
}
|
||||||
return readList;
|
return readList;
|
||||||
}
|
}
|
||||||
|
//TODO check other read status
|
||||||
QVector<bool> TableModel::setAllComicsRead(bool read)
|
QVector<YACReaderComicReadStatus> TableModel::setAllComicsRead(YACReaderComicReadStatus read)
|
||||||
{
|
{
|
||||||
QSqlDatabase db = DataBaseManagement::loadDatabase(_databasePath);
|
QSqlDatabase db = DataBaseManagement::loadDatabase(_databasePath);
|
||||||
db.transaction();
|
db.transaction();
|
||||||
int numComics = _data.count();
|
int numComics = _data.count();
|
||||||
QVector<bool> readList(numComics);
|
QVector<YACReaderComicReadStatus> readList(numComics);
|
||||||
for(int i=0;i<numComics;i++)
|
for(int i=0;i<numComics;i++)
|
||||||
{
|
{
|
||||||
readList[i] = read;
|
readList[i] = read;
|
||||||
_data.value(i)->setData(READ,QVariant(read));
|
if(read == YACReaderComicReadStatus::Read)
|
||||||
ComicDB c = DBHelper::loadComic(_data.value(i)->data(ID).toULongLong(),db);
|
{
|
||||||
c.info.read = read;
|
_data.value(i)->setData(Columns::ReadColumn,QVariant(true));
|
||||||
|
ComicDB c = DBHelper::loadComic(_data.value(i)->data(Columns::Id).toULongLong(),db);
|
||||||
|
c.info.read = true;
|
||||||
DBHelper::update(&(c.info),db);
|
DBHelper::update(&(c.info),db);
|
||||||
}
|
}
|
||||||
|
if(read == YACReaderComicReadStatus::Unread)
|
||||||
|
{
|
||||||
|
_data.value(i)->setData(Columns::ReadColumn,QVariant(false));
|
||||||
|
ComicDB c = DBHelper::loadComic(_data.value(i)->data(Columns::Id).toULongLong(),db);
|
||||||
|
c.info.read = false;
|
||||||
|
DBHelper::update(&(c.info),db);
|
||||||
|
}
|
||||||
|
}
|
||||||
db.commit();
|
db.commit();
|
||||||
db.close();
|
db.close();
|
||||||
QSqlDatabase::removeDatabase(_databasePath);
|
QSqlDatabase::removeDatabase(_databasePath);
|
||||||
|
|
||||||
emit dataChanged(index(0,READ),index(numComics-1,READ));
|
emit dataChanged(index(0,Columns::ReadColumn),index(numComics-1,Columns::ReadColumn));
|
||||||
|
|
||||||
return readList;
|
return readList;
|
||||||
}
|
}
|
||||||
@ -426,7 +446,7 @@ QList<ComicDB> TableModel::getAllComics()
|
|||||||
int numComics = _data.count();
|
int numComics = _data.count();
|
||||||
for(int i=0;i<numComics;i++)
|
for(int i=0;i<numComics;i++)
|
||||||
{
|
{
|
||||||
comics.append(DBHelper::loadComic(_data.value(i)->data(ID).toULongLong(),db));
|
comics.append(DBHelper::loadComic(_data.value(i)->data(Columns::Id).toULongLong(),db));
|
||||||
}
|
}
|
||||||
|
|
||||||
db.commit();
|
db.commit();
|
||||||
@ -452,23 +472,33 @@ QList<ComicDB> TableModel::getComics(QList<QModelIndex> list)
|
|||||||
QSqlDatabase::removeDatabase(_databasePath);
|
QSqlDatabase::removeDatabase(_databasePath);
|
||||||
return comics;
|
return comics;
|
||||||
}
|
}
|
||||||
|
//TODO
|
||||||
QVector<bool> TableModel::setComicsRead(QList<QModelIndex> list,bool read)
|
QVector<YACReaderComicReadStatus> TableModel::setComicsRead(QList<QModelIndex> list,YACReaderComicReadStatus read)
|
||||||
{
|
{
|
||||||
QSqlDatabase db = DataBaseManagement::loadDatabase(_databasePath);
|
QSqlDatabase db = DataBaseManagement::loadDatabase(_databasePath);
|
||||||
db.transaction();
|
db.transaction();
|
||||||
foreach (QModelIndex mi, list)
|
foreach (QModelIndex mi, list)
|
||||||
{
|
{
|
||||||
_data.value(mi.row())->setData(READ, QVariant(read));
|
if(read == YACReaderComicReadStatus::Read)
|
||||||
ComicDB c = DBHelper::loadComic(_data.value(mi.row())->data(ID).toULongLong(),db);
|
{
|
||||||
c.info.read = read;
|
_data.value(mi.row())->setData(Columns::ReadColumn, QVariant(true));
|
||||||
|
ComicDB c = DBHelper::loadComic(_data.value(mi.row())->data(Columns::Id).toULongLong(),db);
|
||||||
|
c.info.read = true;
|
||||||
DBHelper::update(&(c.info),db);
|
DBHelper::update(&(c.info),db);
|
||||||
}
|
}
|
||||||
|
if(read == YACReaderComicReadStatus::Unread)
|
||||||
|
{
|
||||||
|
_data.value(mi.row())->setData(Columns::ReadColumn, QVariant(false));
|
||||||
|
ComicDB c = DBHelper::loadComic(_data.value(mi.row())->data(Columns::Id).toULongLong(),db);
|
||||||
|
c.info.read = false;
|
||||||
|
DBHelper::update(&(c.info),db);
|
||||||
|
}
|
||||||
|
}
|
||||||
db.commit();
|
db.commit();
|
||||||
db.close();
|
db.close();
|
||||||
QSqlDatabase::removeDatabase(_databasePath);
|
QSqlDatabase::removeDatabase(_databasePath);
|
||||||
|
|
||||||
emit dataChanged(index(list.first().row(),READ),index(list.last().row(),READ));
|
emit dataChanged(index(list.first().row(),Columns::ReadColumn),index(list.last().row(),Columns::ReadColumn));
|
||||||
|
|
||||||
return getReadList();
|
return getReadList();
|
||||||
}
|
}
|
||||||
@ -476,11 +506,11 @@ qint64 TableModel::asignNumbers(QList<QModelIndex> list,int startingNumber)
|
|||||||
{
|
{
|
||||||
QSqlDatabase db = DataBaseManagement::loadDatabase(_databasePath);
|
QSqlDatabase db = DataBaseManagement::loadDatabase(_databasePath);
|
||||||
db.transaction();
|
db.transaction();
|
||||||
qint64 idFirst = _data.value(list[0].row())->data(ID).toULongLong();
|
qint64 idFirst = _data.value(list[0].row())->data(Columns::Id).toULongLong();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
foreach (QModelIndex mi, list)
|
foreach (QModelIndex mi, list)
|
||||||
{
|
{
|
||||||
ComicDB c = DBHelper::loadComic(_data.value(mi.row())->data(ID).toULongLong(),db);
|
ComicDB c = DBHelper::loadComic(_data.value(mi.row())->data(Columns::Id).toULongLong(),db);
|
||||||
c.info.setNumber(startingNumber+i);
|
c.info.setNumber(startingNumber+i);
|
||||||
c.info.edited = true;
|
c.info.edited = true;
|
||||||
DBHelper::update(&(c.info),db);
|
DBHelper::update(&(c.info),db);
|
||||||
@ -501,7 +531,7 @@ QModelIndex TableModel::getIndexFromId(quint64 id)
|
|||||||
int i=0;
|
int i=0;
|
||||||
for(itr = _data.constBegin();itr != _data.constEnd();itr++)
|
for(itr = _data.constBegin();itr != _data.constEnd();itr++)
|
||||||
{
|
{
|
||||||
if((*itr)->data(ID).toULongLong() == id)
|
if((*itr)->data(Columns::Id).toULongLong() == id)
|
||||||
break;
|
break;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@ -527,7 +557,7 @@ void TableModel::finishTransaction()
|
|||||||
|
|
||||||
void TableModel::removeInTransaction(int row)
|
void TableModel::removeInTransaction(int row)
|
||||||
{
|
{
|
||||||
ComicDB c = DBHelper::loadComic(_data.at(row)->data(ID).toULongLong(),dbTransaction);
|
ComicDB c = DBHelper::loadComic(_data.at(row)->data(Columns::Id).toULongLong(),dbTransaction);
|
||||||
|
|
||||||
DBHelper::removeFromDB(&c,dbTransaction);
|
DBHelper::removeFromDB(&c,dbTransaction);
|
||||||
beginRemoveRows(QModelIndex(),row,row);
|
beginRemoveRows(QModelIndex(),row,row);
|
||||||
@ -570,16 +600,16 @@ void TableModel::reload(const ComicDB & comic)
|
|||||||
bool found = false;
|
bool found = false;
|
||||||
foreach(TableItem * item,_data)
|
foreach(TableItem * item,_data)
|
||||||
{
|
{
|
||||||
if(item->data(ID).toULongLong() == comic.id)
|
if(item->data(Columns::Id).toULongLong() == comic.id)
|
||||||
{
|
{
|
||||||
found = true;
|
found = true;
|
||||||
item->setData(CURRENT_PAGE,comic.info.currentPage);
|
item->setData(Columns::CurrentPage,comic.info.currentPage);
|
||||||
item->setData(HAS_BEEN_OPENED,true);
|
item->setData(Columns::HasBeenOpened,true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
row++;
|
row++;
|
||||||
}
|
}
|
||||||
if(found)
|
if(found)
|
||||||
emit dataChanged(index(row,CURRENT_PAGE),index(row,CURRENT_PAGE));
|
emit dataChanged(index(row,Columns::CurrentPage),index(row,Columns::CurrentPage));
|
||||||
}
|
}
|
@ -7,6 +7,8 @@
|
|||||||
#include <QSqlQuery>
|
#include <QSqlQuery>
|
||||||
#include <QSqlDatabase>
|
#include <QSqlDatabase>
|
||||||
|
|
||||||
|
#include "yacreader_global.h"
|
||||||
|
|
||||||
class ComicDB;
|
class ComicDB;
|
||||||
|
|
||||||
class TableItem;
|
class TableItem;
|
||||||
@ -38,15 +40,15 @@ public:
|
|||||||
QString getComicPath(QModelIndex mi);
|
QString getComicPath(QModelIndex mi);
|
||||||
ComicDB getComic(const QModelIndex & mi); //--> para la edición
|
ComicDB getComic(const QModelIndex & mi); //--> para la edición
|
||||||
ComicDB getComic(int row);
|
ComicDB getComic(int row);
|
||||||
QVector<bool> getReadList();
|
QVector<YACReaderComicReadStatus> getReadList();
|
||||||
QVector<bool> setAllComicsRead(bool read);
|
QVector<YACReaderComicReadStatus> setAllComicsRead(YACReaderComicReadStatus readStatus);
|
||||||
QList<ComicDB> getComics(QList<QModelIndex> list); //--> recupera la información común a los comics seleccionados
|
QList<ComicDB> getComics(QList<QModelIndex> list); //--> recupera la información común a los comics seleccionados
|
||||||
QList<ComicDB> getAllComics();
|
QList<ComicDB> getAllComics();
|
||||||
QModelIndex getIndexFromId(quint64 id);
|
QModelIndex getIndexFromId(quint64 id);
|
||||||
//setcomicInfo(QModelIndex & mi); --> inserta en la base datos
|
//setcomicInfo(QModelIndex & mi); --> inserta en la base datos
|
||||||
//setComicInfoForAllComics(); --> inserta la información común a todos los cómics de una sola vez.
|
//setComicInfoForAllComics(); --> inserta la información común a todos los cómics de una sola vez.
|
||||||
//setComicInfoForSelectedComis(QList<QModelIndex> list); -->inserta la información común para los comics seleccionados
|
//setComicInfoForSelectedComis(QList<QModelIndex> list); -->inserta la información común para los comics seleccionados
|
||||||
QVector<bool> setComicsRead(QList<QModelIndex> list,bool read);
|
QVector<YACReaderComicReadStatus> setComicsRead(QList<QModelIndex> list,YACReaderComicReadStatus read);
|
||||||
qint64 asignNumbers(QList<QModelIndex> list,int startingNumber);
|
qint64 asignNumbers(QList<QModelIndex> list,int startingNumber);
|
||||||
void remove(ComicDB * comic, int row);
|
void remove(ComicDB * comic, int row);
|
||||||
void removeInTransaction(int row);
|
void removeInTransaction(int row);
|
||||||
|
@ -53,6 +53,7 @@
|
|||||||
<file>../images/clearSearch.png</file>
|
<file>../images/clearSearch.png</file>
|
||||||
<file>../images/iconSearch.png</file>
|
<file>../images/iconSearch.png</file>
|
||||||
<file>../images/readRibbon.png</file>
|
<file>../images/readRibbon.png</file>
|
||||||
|
<file>../images/readingRibbon.png</file>
|
||||||
<file>../images/shownCovers.png</file>
|
<file>../images/shownCovers.png</file>
|
||||||
<file>../images/hiddenCovers.png</file>
|
<file>../images/hiddenCovers.png</file>
|
||||||
<file>../images/trash.png</file>
|
<file>../images/trash.png</file>
|
||||||
|
@ -1017,42 +1017,47 @@ void LibraryWindow::openComic()
|
|||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
|
|
||||||
QProcess::startDetached("open", QStringList() << "-n" << QDir::cleanPath(QCoreApplication::applicationDirPath()+"/../../../YACReader.app") << "--args" << path << comicId << libraryId << page);//,QStringList() << path);
|
QProcess::startDetached("open", QStringList() << "-n" << QDir::cleanPath(QCoreApplication::applicationDirPath()+"/../../../YACReader.app") << "--args" << path << comicId << libraryId << page);//,QStringList() << path);
|
||||||
//Comic is readed
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
QProcess::startDetached(QDir::cleanPath(QCoreApplication::applicationDirPath())+QString("/YACReader \"%1\" \"%2\" \"%3\" \"%4\"").arg(path).arg(comicId).arg(libraryId).arg(page),QStringList());
|
QProcess::startDetached(QDir::cleanPath(QCoreApplication::applicationDirPath())+QString("/YACReader \"%1\" \"%2\" \"%3\" \"%4\"").arg(path).arg(comicId).arg(libraryId).arg(page),QStringList());
|
||||||
#endif
|
#endif
|
||||||
//Comic is readed
|
//Comic is readed
|
||||||
setCurrentComicReaded();
|
//setCurrentComicReaded();
|
||||||
|
setCurrentComicOpened();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryWindow::setCurrentComicsStatusReaded(bool readed)
|
void LibraryWindow::setCurrentComicsStatusReaded(YACReaderComicReadStatus readStatus)
|
||||||
{
|
{
|
||||||
|
|
||||||
comicFlow->setMarks(dmCV->setComicsRead(getSelectedComics(),readed));
|
comicFlow->setMarks(dmCV->setComicsRead(getSelectedComics(),readStatus));
|
||||||
comicFlow->updateMarks();
|
comicFlow->updateMarks();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryWindow::setCurrentComicReaded()
|
void LibraryWindow::setCurrentComicReaded()
|
||||||
{
|
{
|
||||||
this->setCurrentComicsStatusReaded(true);
|
this->setCurrentComicsStatusReaded(YACReaderComicReadStatus::Read);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LibraryWindow::setCurrentComicOpened()
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryWindow::setComicsReaded()
|
void LibraryWindow::setComicsReaded()
|
||||||
{
|
{
|
||||||
comicFlow->setMarks(dmCV->setAllComicsRead(true));
|
comicFlow->setMarks(dmCV->setAllComicsRead(YACReaderComicReadStatus::Read));
|
||||||
comicFlow->updateMarks();
|
comicFlow->updateMarks();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryWindow::setCurrentComicUnreaded()
|
void LibraryWindow::setCurrentComicUnreaded()
|
||||||
{
|
{
|
||||||
this->setCurrentComicsStatusReaded(false);
|
this->setCurrentComicsStatusReaded(YACReaderComicReadStatus::Unread);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryWindow::setComicsUnreaded()
|
void LibraryWindow::setComicsUnreaded()
|
||||||
{
|
{
|
||||||
comicFlow->setMarks(dmCV->setAllComicsRead(false));
|
comicFlow->setMarks(dmCV->setAllComicsRead(YACReaderComicReadStatus::Unread));
|
||||||
comicFlow->updateMarks();
|
comicFlow->updateMarks();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1689,7 +1694,12 @@ void LibraryWindow::importLibraryPackage()
|
|||||||
importLibraryDialog->show(libraries);
|
importLibraryDialog->show(libraries);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryWindow::updateComicsView(const ComicDB & comic)
|
void LibraryWindow::updateComicsView(quint64 libraryId, const ComicDB & comic)
|
||||||
{
|
{
|
||||||
|
//TODO comprobar la biblioteca....
|
||||||
|
if(libraryId == selectedLibrary->currentIndex())
|
||||||
|
{
|
||||||
dmCV->reload(comic);
|
dmCV->reload(comic);
|
||||||
|
comicFlow->setMarks(dmCV->getReadList());
|
||||||
|
}
|
||||||
}
|
}
|
@ -5,6 +5,7 @@
|
|||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QModelIndex>
|
#include <QModelIndex>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
#include "yacreader_global.h"
|
||||||
|
|
||||||
class QTreeView;
|
class QTreeView;
|
||||||
class QDirModel;
|
class QDirModel;
|
||||||
@ -238,7 +239,7 @@ public:
|
|||||||
void exportLibrary(QString destPath);
|
void exportLibrary(QString destPath);
|
||||||
void importLibrary(QString clc,QString destPath,QString name);
|
void importLibrary(QString clc,QString destPath,QString name);
|
||||||
void reloadOptions();
|
void reloadOptions();
|
||||||
void setCurrentComicsStatusReaded(bool readed);
|
void setCurrentComicsStatusReaded(YACReaderComicReadStatus readStatus);
|
||||||
void setCurrentComicReaded();
|
void setCurrentComicReaded();
|
||||||
void setCurrentComicUnreaded();
|
void setCurrentComicUnreaded();
|
||||||
void setComicsReaded();
|
void setComicsReaded();
|
||||||
@ -261,7 +262,8 @@ public:
|
|||||||
void updateHistory(const QModelIndex & mi);
|
void updateHistory(const QModelIndex & mi);
|
||||||
void libraryAlreadyExists(const QString & name);
|
void libraryAlreadyExists(const QString & name);
|
||||||
void importLibraryPackage();
|
void importLibraryPackage();
|
||||||
void updateComicsView(const ComicDB & comic);
|
void updateComicsView(quint64 libraryId, const ComicDB & comic);
|
||||||
|
void setCurrentComicOpened();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ int main( int argc, char ** argv )
|
|||||||
|
|
||||||
LibraryWindow * mw = new LibraryWindow();
|
LibraryWindow * mw = new LibraryWindow();
|
||||||
|
|
||||||
mw->connect(localServer,SIGNAL(comicUpdated(const ComicDB &)),mw,SLOT(updateComicsView(const ComicDB &)));
|
mw->connect(localServer,SIGNAL(comicUpdated(quint64, const ComicDB &)),mw,SLOT(updateComicsView(quint64, const ComicDB &)));
|
||||||
|
|
||||||
//connections to localServer
|
//connections to localServer
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ void YACReaderLocalServer::getComicInfo(quint64 libraryId, ComicDB & comic, QLis
|
|||||||
void YACReaderLocalServer::updateComic(quint64 libraryId, ComicDB & comic)
|
void YACReaderLocalServer::updateComic(quint64 libraryId, ComicDB & comic)
|
||||||
{
|
{
|
||||||
DBHelper::update(DBHelper::getLibrariesNames().at(libraryId), comic.info);
|
DBHelper::update(DBHelper::getLibrariesNames().at(libraryId), comic.info);
|
||||||
emit comicUpdated(comic);
|
emit comicUpdated(libraryId, comic);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool YACReaderLocalServer::isRunning()
|
bool YACReaderLocalServer::isRunning()
|
||||||
|
@ -13,7 +13,7 @@ public:
|
|||||||
explicit YACReaderLocalServer(QObject *parent = 0);
|
explicit YACReaderLocalServer(QObject *parent = 0);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void comicUpdated(const ComicDB & comic);
|
void comicUpdated(quint64 libraryId, const ComicDB & comic);
|
||||||
public slots:
|
public slots:
|
||||||
bool isListening();
|
bool isListening();
|
||||||
void sendResponse();
|
void sendResponse();
|
||||||
|
@ -192,7 +192,7 @@ public:
|
|||||||
PictureFlow::ReflectionEffect reflectionEffect;
|
PictureFlow::ReflectionEffect reflectionEffect;
|
||||||
QVector<QImage*> slideImages;
|
QVector<QImage*> slideImages;
|
||||||
|
|
||||||
QVector<bool> marks;
|
QVector<YACReaderComicReadStatus> marks;
|
||||||
bool showMarks;
|
bool showMarks;
|
||||||
QImage mark;
|
QImage mark;
|
||||||
|
|
||||||
@ -1076,7 +1076,7 @@ void PictureFlow::addSlide(const QImage& image)
|
|||||||
d->state->slideImages.resize(c+1);
|
d->state->slideImages.resize(c+1);
|
||||||
d->state->slideImages[c] = new QImage(image);
|
d->state->slideImages[c] = new QImage(image);
|
||||||
d->state->marks.resize(c+1);
|
d->state->marks.resize(c+1);
|
||||||
d->state->marks[c] = false;
|
d->state->marks[c] = YACReaderComicReadStatus::Unread;
|
||||||
triggerRender();
|
triggerRender();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1345,10 +1345,10 @@ void PictureFlow::setMarkImage(const QImage & m)
|
|||||||
d->state->mark = m;
|
d->state->mark = m;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PictureFlow::markSlide(int index)
|
void PictureFlow::markSlide(int index, YACReaderComicReadStatus readStatus)
|
||||||
{
|
{
|
||||||
if(index<d->state->marks.size())
|
if(index<d->state->marks.size())
|
||||||
d->state->marks[index] = true;
|
d->state->marks[index] = readStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PictureFlow::updateMarks()
|
void PictureFlow::updateMarks()
|
||||||
@ -1361,10 +1361,10 @@ void PictureFlow::updateMarks()
|
|||||||
void PictureFlow::unmarkSlide(int index)
|
void PictureFlow::unmarkSlide(int index)
|
||||||
{
|
{
|
||||||
if(index<d->state->marks.size())
|
if(index<d->state->marks.size())
|
||||||
d->state->marks[index] = false;
|
d->state->marks[index] = YACReaderComicReadStatus::Unread;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PictureFlow::setMarks(const QVector<bool> & m)
|
void PictureFlow::setMarks(const QVector<YACReaderComicReadStatus> & m)
|
||||||
{
|
{
|
||||||
d->state->marks = m;
|
d->state->marks = m;
|
||||||
updateMarks();
|
updateMarks();
|
||||||
@ -1376,7 +1376,7 @@ void PictureFlow::setShowMarks(bool enable)
|
|||||||
updateMarks();
|
updateMarks();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<bool> PictureFlow::getMarks()
|
QVector<YACReaderComicReadStatus > PictureFlow::getMarks()
|
||||||
{
|
{
|
||||||
return d->state->marks;
|
return d->state->marks;
|
||||||
}
|
}
|
||||||
|
@ -189,17 +189,17 @@ public slots:
|
|||||||
|
|
||||||
void setMarkImage(const QImage & mark);
|
void setMarkImage(const QImage & mark);
|
||||||
|
|
||||||
void markSlide(int index);
|
void markSlide(int index, YACReaderComicReadStatus readStatus = Read);
|
||||||
|
|
||||||
void updateMarks();
|
void updateMarks();
|
||||||
|
|
||||||
void unmarkSlide(int index);
|
void unmarkSlide(int index);
|
||||||
|
|
||||||
void setMarks(const QVector<bool> & marks);
|
void setMarks(const QVector<YACReaderComicReadStatus> & marks);
|
||||||
|
|
||||||
void setShowMarks(bool enable);
|
void setShowMarks(bool enable);
|
||||||
|
|
||||||
QVector<bool> getMarks();
|
QVector<YACReaderComicReadStatus> getMarks();
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@ -218,7 +218,6 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
PictureFlowPrivate* d;
|
PictureFlowPrivate* d;
|
||||||
QImage mark;
|
QImage mark;
|
||||||
QVector<bool> marks;
|
|
||||||
int framesSkip;
|
int framesSkip;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -280,7 +280,7 @@ void YACReaderFlowGL::initializeGL()
|
|||||||
|
|
||||||
defaultTexture = bindTexture(QImage(":/images/defaultCover.png"),GL_TEXTURE_2D,GL_RGBA,QGLContext::LinearFilteringBindOption | QGLContext::MipmapBindOption);
|
defaultTexture = bindTexture(QImage(":/images/defaultCover.png"),GL_TEXTURE_2D,GL_RGBA,QGLContext::LinearFilteringBindOption | QGLContext::MipmapBindOption);
|
||||||
markTexture = bindTexture(QImage(":/images/readRibbon.png"),GL_TEXTURE_2D,GL_RGBA,QGLContext::LinearFilteringBindOption | QGLContext::MipmapBindOption);
|
markTexture = bindTexture(QImage(":/images/readRibbon.png"),GL_TEXTURE_2D,GL_RGBA,QGLContext::LinearFilteringBindOption | QGLContext::MipmapBindOption);
|
||||||
|
readingTexture = bindTexture(QImage(":/images/readingRibbon.png"),GL_TEXTURE_2D,GL_RGBA,QGLContext::LinearFilteringBindOption | QGLContext::MipmapBindOption);
|
||||||
if(lazyPopulateObjects!=-1)
|
if(lazyPopulateObjects!=-1)
|
||||||
populate(lazyPopulateObjects);
|
populate(lazyPopulateObjects);
|
||||||
|
|
||||||
@ -454,10 +454,13 @@ void YACReaderFlowGL::drawCover(CFImage *CF)
|
|||||||
glEnd();
|
glEnd();
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
if(showMarks && loaded[CF->index] && marks[CF->index])
|
if(showMarks && loaded[CF->index] && marks[CF->index] != Unread)
|
||||||
{
|
{
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
if(marks[CF->index] == Read)
|
||||||
glBindTexture(GL_TEXTURE_2D, markTexture);
|
glBindTexture(GL_TEXTURE_2D, markTexture);
|
||||||
|
else
|
||||||
|
glBindTexture(GL_TEXTURE_2D, readingTexture);
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
|
|
||||||
//esquina inferior izquierda
|
//esquina inferior izquierda
|
||||||
@ -866,7 +869,7 @@ void YACReaderFlowGL::setShowMarks(bool value)
|
|||||||
{
|
{
|
||||||
showMarks = value;
|
showMarks = value;
|
||||||
}
|
}
|
||||||
void YACReaderFlowGL::setMarks(QVector<bool> marks)
|
void YACReaderFlowGL::setMarks(QVector<YACReaderComicReadStatus> marks)
|
||||||
{
|
{
|
||||||
this->marks = marks;
|
this->marks = marks;
|
||||||
}
|
}
|
||||||
@ -876,13 +879,13 @@ void YACReaderFlowGL::setMarkImage(QImage & image)
|
|||||||
//deleteTexture(markTexture);
|
//deleteTexture(markTexture);
|
||||||
//markTexture = bindTexture(image,GL_TEXTURE_2D,GL_RGBA,QGLContext::LinearFilteringBindOption | QGLContext::MipmapBindOption);
|
//markTexture = bindTexture(image,GL_TEXTURE_2D,GL_RGBA,QGLContext::LinearFilteringBindOption | QGLContext::MipmapBindOption);
|
||||||
}
|
}
|
||||||
void YACReaderFlowGL::markSlide(int index)
|
void YACReaderFlowGL::markSlide(int index, YACReaderComicReadStatus status)
|
||||||
{
|
{
|
||||||
marks[index] = true;
|
marks[index] = status;
|
||||||
}
|
}
|
||||||
void YACReaderFlowGL::unmarkSlide(int index)
|
void YACReaderFlowGL::unmarkSlide(int index)
|
||||||
{
|
{
|
||||||
marks[index] = false;
|
marks[index] = YACReaderComicReadStatus::Unread;
|
||||||
}
|
}
|
||||||
void YACReaderFlowGL::setSlideSize(QSize size)
|
void YACReaderFlowGL::setSlideSize(QSize size)
|
||||||
{
|
{
|
||||||
|
@ -127,6 +127,7 @@ protected:
|
|||||||
|
|
||||||
GLuint defaultTexture;
|
GLuint defaultTexture;
|
||||||
GLuint markTexture;
|
GLuint markTexture;
|
||||||
|
GLuint readingTexture;
|
||||||
void initializeGL();
|
void initializeGL();
|
||||||
void paintGL();
|
void paintGL();
|
||||||
void timerEvent(QTimerEvent *);
|
void timerEvent(QTimerEvent *);
|
||||||
@ -136,7 +137,7 @@ protected:
|
|||||||
int lazyPopulateObjects;
|
int lazyPopulateObjects;
|
||||||
bool showMarks;
|
bool showMarks;
|
||||||
QVector<bool> loaded;
|
QVector<bool> loaded;
|
||||||
QVector<bool> marks;
|
QVector<YACReaderComicReadStatus> marks;
|
||||||
QList<QString> paths;
|
QList<QString> paths;
|
||||||
CFImage * cfImages;
|
CFImage * cfImages;
|
||||||
bool hasBeenInitialized;
|
bool hasBeenInitialized;
|
||||||
@ -247,9 +248,9 @@ public:
|
|||||||
|
|
||||||
//interface with yacreaderlibrary, compatibility
|
//interface with yacreaderlibrary, compatibility
|
||||||
void setShowMarks(bool value);
|
void setShowMarks(bool value);
|
||||||
void setMarks(QVector<bool> marks);
|
void setMarks(QVector<YACReaderComicReadStatus> marks);
|
||||||
void setMarkImage(QImage & image);
|
void setMarkImage(QImage & image);
|
||||||
void markSlide(int index);
|
void markSlide(int index, YACReaderComicReadStatus status);
|
||||||
void unmarkSlide(int index);
|
void unmarkSlide(int index);
|
||||||
void setSlideSize(QSize size);
|
void setSlideSize(QSize size);
|
||||||
void clear();
|
void clear();
|
||||||
|
@ -67,5 +67,12 @@
|
|||||||
SendComicInfo,
|
SendComicInfo,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum YACReaderComicReadStatus
|
||||||
|
{
|
||||||
|
Unread = 0,
|
||||||
|
Read = 1,
|
||||||
|
Opened = 2
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 7.8 KiB |
BIN
images/readingRibbon.png
Normal file
BIN
images/readingRibbon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.4 KiB |
Loading…
x
Reference in New Issue
Block a user