mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
rating images added
This commit is contained in:
parent
57d7a8abdc
commit
65ed153aad
@ -172,7 +172,7 @@ bool DataBaseManagement::createTables(QSqlDatabase & database)
|
|||||||
//now 7.0 fields
|
//now 7.0 fields
|
||||||
|
|
||||||
"hasBeenOpened BOOLEAN DEFAULT 0,"
|
"hasBeenOpened BOOLEAN DEFAULT 0,"
|
||||||
|
"rating INTEGER DEFAULT 0,"
|
||||||
"currentPage INTEGER DEFAULT 1, "
|
"currentPage INTEGER DEFAULT 1, "
|
||||||
"bookmark1 INTEGER DEFAULT -1, "
|
"bookmark1 INTEGER DEFAULT -1, "
|
||||||
"bookmark2 INTEGER DEFAULT -1, "
|
"bookmark2 INTEGER DEFAULT -1, "
|
||||||
@ -569,7 +569,7 @@ bool DataBaseManagement::updateToCurrentVersion(const QString & fullPath)
|
|||||||
QSqlQuery alterTableComicInfo(db);
|
QSqlQuery alterTableComicInfo(db);
|
||||||
alterTableComicInfo.prepare("ALTER TABLE comic_info ADD ("
|
alterTableComicInfo.prepare("ALTER TABLE comic_info ADD ("
|
||||||
"hasBeenOpened BOOLEAN DEFAULT 0,"
|
"hasBeenOpened BOOLEAN DEFAULT 0,"
|
||||||
|
"rating INTEGER DEFAULT 0,"
|
||||||
"currentPage INTEGER DEFAULT 1, "
|
"currentPage INTEGER DEFAULT 1, "
|
||||||
"bookmark1 INTEGER DEFAULT -1, "
|
"bookmark1 INTEGER DEFAULT -1, "
|
||||||
"bookmark2 INTEGER DEFAULT -1, "
|
"bookmark2 INTEGER DEFAULT -1, "
|
||||||
|
@ -20,6 +20,9 @@
|
|||||||
#define HASH 7
|
#define HASH 7
|
||||||
#define READ 8
|
#define READ 8
|
||||||
#define IS_BIS 9
|
#define IS_BIS 9
|
||||||
|
#define CURRENT_PAGE 10
|
||||||
|
#define RATING 11
|
||||||
|
#define HAS_BEEN_OPENED 12
|
||||||
|
|
||||||
TableModel::TableModel(QObject *parent)
|
TableModel::TableModel(QObject *parent)
|
||||||
: QAbstractItemModel(parent)
|
: QAbstractItemModel(parent)
|
||||||
@ -58,6 +61,12 @@ 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)
|
||||||
|
{
|
||||||
|
TableItem *item = static_cast<TableItem*>(index.internalPointer());
|
||||||
|
return QPixmap(QString(":/images/rating%1.png").arg(item->data(index.column()).toInt()));
|
||||||
|
}
|
||||||
|
|
||||||
if (role == Qt::DecorationRole)
|
if (role == Qt::DecorationRole)
|
||||||
{
|
{
|
||||||
return QVariant();
|
return QVariant();
|
||||||
@ -73,6 +82,8 @@ 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:
|
||||||
|
return QVariant(Qt::AlignRight | Qt::AlignVCenter);
|
||||||
default:
|
default:
|
||||||
return QVariant(Qt::AlignLeft | Qt::AlignVCenter);
|
return QVariant(Qt::AlignLeft | Qt::AlignVCenter);
|
||||||
}
|
}
|
||||||
@ -87,6 +98,12 @@ QVariant TableModel::data(const QModelIndex &index, int role) const
|
|||||||
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() == READ)
|
||||||
return item->data(index.column()).toBool()?QVariant(tr("yes")):QVariant(tr("no"));
|
return item->data(index.column()).toBool()?QVariant(tr("yes")):QVariant(tr("no"));
|
||||||
|
if(index.column() == CURRENT_PAGE)
|
||||||
|
return item->data(HAS_BEEN_OPENED).toBool()?item->data(index.column()):QVariant("-");
|
||||||
|
|
||||||
|
if (index.column() == RATING)
|
||||||
|
return QVariant();
|
||||||
|
|
||||||
return item->data(index.column());
|
return item->data(index.column());
|
||||||
}
|
}
|
||||||
//! [3]
|
//! [3]
|
||||||
@ -121,6 +138,10 @@ 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:
|
||||||
|
return QVariant(QString(tr("Current Page")));
|
||||||
|
case RATING:
|
||||||
|
return QVariant(QString(tr("Rating")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,6 +155,8 @@ 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:
|
||||||
|
return QVariant(Qt::AlignRight | Qt::AlignVCenter);
|
||||||
default:
|
default:
|
||||||
return QVariant(Qt::AlignLeft | Qt::AlignVCenter);
|
return QVariant(Qt::AlignLeft | Qt::AlignVCenter);
|
||||||
}
|
}
|
||||||
@ -235,7 +258,7 @@ void TableModel::setupModelData(unsigned long long int folderId,const QString &
|
|||||||
//crear la consulta
|
//crear la consulta
|
||||||
//timer.restart();
|
//timer.restart();
|
||||||
QSqlQuery selectQuery(db); //TODO check
|
QSqlQuery selectQuery(db); //TODO check
|
||||||
selectQuery.prepare("select ci.number,ci.title,c.fileName,ci.numPages,c.id,c.parentId,c.path,ci.hash,ci.read,ci.isBis from comic c inner join comic_info ci on (c.comicInfoId = ci.id) where c.parentId = :parentId");
|
selectQuery.prepare("select ci.number,ci.title,c.fileName,ci.numPages,c.id,c.parentId,c.path,ci.hash,ci.read,ci.isBis,ci.currentPage,ci.rating,ci.hasBeenOpened from comic c inner join comic_info ci on (c.comicInfoId = ci.id) where c.parentId = :parentId");
|
||||||
selectQuery.bindValue(":parentId", folderId);
|
selectQuery.bindValue(":parentId", folderId);
|
||||||
selectQuery.exec();
|
selectQuery.exec();
|
||||||
//txtS << "TABLEMODEL: Tiempo de consulta: " << timer.elapsed() << "ms\r\n";
|
//txtS << "TABLEMODEL: Tiempo de consulta: " << timer.elapsed() << "ms\r\n";
|
||||||
|
@ -86,6 +86,12 @@
|
|||||||
<file>../images/collapsed_branch_selected.png</file>
|
<file>../images/collapsed_branch_selected.png</file>
|
||||||
<file>../images/previousCoverPage.png</file>
|
<file>../images/previousCoverPage.png</file>
|
||||||
<file>../images/nextCoverPage.png</file>
|
<file>../images/nextCoverPage.png</file>
|
||||||
|
<file>../images/rating0.png</file>
|
||||||
|
<file>../images/rating1.png</file>
|
||||||
|
<file>../images/rating2.png</file>
|
||||||
|
<file>../images/rating3.png</file>
|
||||||
|
<file>../images/rating4.png</file>
|
||||||
|
<file>../images/rating5.png</file>
|
||||||
<!--<file>../images/busy_background.png</file>-->
|
<!--<file>../images/busy_background.png</file>-->
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@ -936,6 +936,8 @@ void LibraryWindow::loadCovers(const QModelIndex & mi)
|
|||||||
comicView->horizontalHeader()->showSection(3);
|
comicView->horizontalHeader()->showSection(3);
|
||||||
comicView->horizontalHeader()->showSection(7);
|
comicView->horizontalHeader()->showSection(7);
|
||||||
comicView->horizontalHeader()->showSection(8);
|
comicView->horizontalHeader()->showSection(8);
|
||||||
|
comicView->horizontalHeader()->showSection(10);
|
||||||
|
comicView->horizontalHeader()->showSection(11);
|
||||||
|
|
||||||
|
|
||||||
//debido a un bug, qt4 no es capaz de ajustar el ancho teniendo en cuenta todas la filas (no sólo las visibles)
|
//debido a un bug, qt4 no es capaz de ajustar el ancho teniendo en cuenta todas la filas (no sólo las visibles)
|
||||||
|
@ -97,6 +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);
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
public slots:
|
public slots:
|
||||||
bool isListening();
|
bool isListening();
|
||||||
void sendResponse();
|
void sendResponse();
|
||||||
|
@ -111,7 +111,7 @@ QString ComicDB::toTXT()
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
ComicInfo::ComicInfo()
|
ComicInfo::ComicInfo()
|
||||||
:existOnDb(false),
|
:existOnDb(false),
|
||||||
rating(-1),
|
rating(0),
|
||||||
hasBeenOpened(false),
|
hasBeenOpened(false),
|
||||||
currentPage(1),
|
currentPage(1),
|
||||||
bookmark1(-1),
|
bookmark1(-1),
|
||||||
|
BIN
images/rating0.png
Normal file
BIN
images/rating0.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 402 B |
BIN
images/rating1.png
Normal file
BIN
images/rating1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 479 B |
BIN
images/rating2.png
Normal file
BIN
images/rating2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 514 B |
BIN
images/rating3.png
Normal file
BIN
images/rating3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 514 B |
BIN
images/rating4.png
Normal file
BIN
images/rating4.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 498 B |
BIN
images/rating5.png
Normal file
BIN
images/rating5.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 404 B |
Loading…
x
Reference in New Issue
Block a user