mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
YACReaderTableView, no se usar? de momento (custom_widgets.h)
toLongLong cambiado por toULongLong antes de la edici?n se guarda el id del c?mic, o el id del primer c?mic, para restaurar posteriormente la posici?n de comicsView y comicFlow cambios en el orden en el que se a?aden las nueva bibliotecas a selectedLibrary y se cargan
This commit is contained in:
parent
aa1efea8ff
commit
accf77d4b9
@ -45,8 +45,8 @@ QList<LibraryItem *> Comic::getComicsFromParent(qulonglong parentId, QSqlDatabas
|
|||||||
data << record.value(i);
|
data << record.value(i);
|
||||||
//TODO sort by sort indicator and name
|
//TODO sort by sort indicator and name
|
||||||
currentItem = new Comic();
|
currentItem = new Comic();
|
||||||
currentItem->id = record.value("id").toLongLong();
|
currentItem->id = record.value("id").toULongLong();
|
||||||
currentItem->parentId = record.value(1).toLongLong();
|
currentItem->parentId = record.value(1).toULongLong();
|
||||||
currentItem->name = record.value(2).toString();
|
currentItem->name = record.value(2).toString();
|
||||||
currentItem->path = record.value(3).toString();
|
currentItem->path = record.value(3).toString();
|
||||||
currentItem->info.load(record.value(4).toString(),db);
|
currentItem->info.load(record.value(4).toString(),db);
|
||||||
@ -77,19 +77,19 @@ QList<LibraryItem *> Comic::getComicsFromParent(qulonglong parentId, QSqlDatabas
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Comic::load(qulonglong id, QSqlDatabase & db)
|
bool Comic::load(qulonglong idc, QSqlDatabase & db)
|
||||||
{
|
{
|
||||||
|
|
||||||
QSqlQuery selectQuery(db); //TODO check
|
QSqlQuery selectQuery(db); //TODO check
|
||||||
selectQuery.prepare("select c.id,c.parentId,c.fileName,c.path,ci.hash from comic c inner join comic_info ci on (c.comicInfoId = ci.id) where c.id = :id");
|
selectQuery.prepare("select c.id,c.parentId,c.fileName,c.path,ci.hash from comic c inner join comic_info ci on (c.comicInfoId = ci.id) where c.id = :id");
|
||||||
selectQuery.bindValue(":id", id);
|
selectQuery.bindValue(":id", idc);
|
||||||
selectQuery.exec();
|
selectQuery.exec();
|
||||||
|
this->id = idc;
|
||||||
if(selectQuery.next())
|
if(selectQuery.next())
|
||||||
{
|
{
|
||||||
QSqlRecord record = selectQuery.record();
|
QSqlRecord record = selectQuery.record();
|
||||||
id = record.value("id").toLongLong();
|
//id = record.value("id").toULongLong();
|
||||||
parentId = record.value("parentId").toLongLong();
|
parentId = record.value("parentId").toULongLong();
|
||||||
name = record.value("name").toString();
|
name = record.value("name").toString();
|
||||||
info.load(record.value("hash").toString(),db);
|
info.load(record.value("hash").toString(),db);
|
||||||
return true;
|
return true;
|
||||||
@ -107,11 +107,12 @@ qulonglong Comic::insert(QSqlDatabase & db)
|
|||||||
if(!info.existOnDb)
|
if(!info.existOnDb)
|
||||||
{
|
{
|
||||||
QSqlQuery comicInfoInsert(db);
|
QSqlQuery comicInfoInsert(db);
|
||||||
comicInfoInsert.prepare("INSERT INTO comic_info (hash) "
|
comicInfoInsert.prepare("INSERT INTO comic_info (hash,numPages) "
|
||||||
"VALUES (:hash)");
|
"VALUES (:hash,:numPages)");
|
||||||
comicInfoInsert.bindValue(":hash", info.hash);
|
comicInfoInsert.bindValue(":hash", info.hash);
|
||||||
|
comicInfoInsert.bindValue(":numPages", *info.numPages);
|
||||||
comicInfoInsert.exec();
|
comicInfoInsert.exec();
|
||||||
info.id =comicInfoInsert.lastInsertId().toLongLong();
|
info.id =comicInfoInsert.lastInsertId().toULongLong();
|
||||||
_hasCover = false;
|
_hasCover = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -125,7 +126,7 @@ qulonglong Comic::insert(QSqlDatabase & db)
|
|||||||
query.bindValue(":name", name);
|
query.bindValue(":name", name);
|
||||||
query.bindValue(":path", path);
|
query.bindValue(":path", path);
|
||||||
query.exec();
|
query.exec();
|
||||||
return query.lastInsertId().toLongLong();
|
return query.lastInsertId().toULongLong();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Comic::update(QSqlDatabase & db)
|
void Comic::update(QSqlDatabase & db)
|
||||||
@ -376,7 +377,7 @@ bool ComicInfo::load(QString hash, QSqlDatabase & db)
|
|||||||
QSqlRecord record = findComicInfo.record();
|
QSqlRecord record = findComicInfo.record();
|
||||||
|
|
||||||
hash = hash;
|
hash = hash;
|
||||||
id = record.value("id").toLongLong();
|
id = record.value("id").toULongLong();
|
||||||
read = record.value("read").toBool();
|
read = record.value("read").toBool();
|
||||||
edited = record.value("edited").toBool();
|
edited = record.value("edited").toBool();
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ qulonglong Folder::insert(QSqlDatabase & db)
|
|||||||
query.bindValue(":name", name);
|
query.bindValue(":name", name);
|
||||||
query.bindValue(":path", path);
|
query.bindValue(":path", path);
|
||||||
query.exec();
|
query.exec();
|
||||||
return query.lastInsertId().toLongLong();
|
return query.lastInsertId().toULongLong();
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<LibraryItem *> Folder::getFoldersFromParent(qulonglong parentId, QSqlDatabase & db)
|
QList<LibraryItem *> Folder::getFoldersFromParent(qulonglong parentId, QSqlDatabase & db)
|
||||||
@ -33,7 +33,7 @@ QList<LibraryItem *> Folder::getFoldersFromParent(qulonglong parentId, QSqlDatab
|
|||||||
for(int i=0;i<record.count();i++)
|
for(int i=0;i<record.count();i++)
|
||||||
data << record.value(i);
|
data << record.value(i);
|
||||||
//TODO sort by sort indicator and name
|
//TODO sort by sort indicator and name
|
||||||
currentItem = new Folder(record.value("id").toLongLong(),record.value("parentId").toLongLong(),record.value("name").toString(),record.value("path").toString());
|
currentItem = new Folder(record.value("id").toULongLong(),record.value("parentId").toULongLong(),record.value("name").toString(),record.value("path").toString());
|
||||||
int lessThan = 0;
|
int lessThan = 0;
|
||||||
if(list.isEmpty())
|
if(list.isEmpty())
|
||||||
list.append(currentItem);
|
list.append(currentItem);
|
||||||
|
@ -187,7 +187,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(6).toString();
|
return _data.at(mi.row())->data(PATH).toString();
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
void TableModel::setupModelData(QSqlQuery &sqlquery)
|
void TableModel::setupModelData(QSqlQuery &sqlquery)
|
||||||
@ -231,7 +231,7 @@ Comic TableModel::getComic(const QModelIndex & mi)
|
|||||||
Comic c;
|
Comic c;
|
||||||
|
|
||||||
QSqlDatabase db = DataBaseManagement::loadDatabase(_databasePath);
|
QSqlDatabase db = DataBaseManagement::loadDatabase(_databasePath);
|
||||||
c.load(_data.at(mi.row())->data(ID).toLongLong(),db);
|
c.load(_data.at(mi.row())->data(ID).toULongLong(),db);
|
||||||
db.close();
|
db.close();
|
||||||
QSqlDatabase::removeDatabase(_databasePath);
|
QSqlDatabase::removeDatabase(_databasePath);
|
||||||
|
|
||||||
@ -243,7 +243,7 @@ Comic TableModel::_getComic(const QModelIndex & mi)
|
|||||||
Comic c;
|
Comic c;
|
||||||
|
|
||||||
QSqlDatabase db = DataBaseManagement::loadDatabase(_databasePath);
|
QSqlDatabase db = DataBaseManagement::loadDatabase(_databasePath);
|
||||||
c.load(_data.at(mi.row())->data(ID).toLongLong(),db);
|
c.load(_data.at(mi.row())->data(ID).toULongLong(),db);
|
||||||
db.close();
|
db.close();
|
||||||
QSqlDatabase::removeDatabase(_databasePath);
|
QSqlDatabase::removeDatabase(_databasePath);
|
||||||
|
|
||||||
@ -275,7 +275,7 @@ QVector<bool> TableModel::setAllComicsRead(bool read)
|
|||||||
readList[i] = read;
|
readList[i] = read;
|
||||||
_data.value(i)->data(READ) = QVariant(true);
|
_data.value(i)->data(READ) = QVariant(true);
|
||||||
Comic c;
|
Comic c;
|
||||||
c.load(_data.value(i)->data(ID).toLongLong(),db);
|
c.load(_data.value(i)->data(ID).toULongLong(),db);
|
||||||
c.info.read = read;
|
c.info.read = read;
|
||||||
c.info.update(db);
|
c.info.update(db);
|
||||||
}
|
}
|
||||||
@ -301,4 +301,18 @@ QList<Comic> TableModel::getComics(QList<QModelIndex> list)
|
|||||||
db.close();
|
db.close();
|
||||||
QSqlDatabase::removeDatabase(_databasePath);
|
QSqlDatabase::removeDatabase(_databasePath);
|
||||||
return comics;
|
return comics;
|
||||||
|
}
|
||||||
|
|
||||||
|
QModelIndex TableModel::getIndexFromId(quint64 id)
|
||||||
|
{
|
||||||
|
QList<TableItem *>::ConstIterator itr;
|
||||||
|
int i=0;
|
||||||
|
for(itr = _data.constBegin();itr != _data.constEnd();itr++)
|
||||||
|
{
|
||||||
|
if((*itr)->data(ID).toULongLong() == id)
|
||||||
|
break;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return index(i,0);
|
||||||
}
|
}
|
@ -39,6 +39,7 @@ public:
|
|||||||
QVector<bool> getReadList();
|
QVector<bool> getReadList();
|
||||||
QVector<bool> setAllComicsRead(bool read);
|
QVector<bool> setAllComicsRead(bool read);
|
||||||
QList<Comic> getComics(QList<QModelIndex> list); //--> recupera la información común a los comics seleccionados
|
QList<Comic> getComics(QList<QModelIndex> list); //--> recupera la información común a los comics seleccionados
|
||||||
|
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
|
||||||
|
@ -245,9 +245,9 @@ void TreeModel::setupModelData(QSqlQuery &sqlquery, TreeItem *parent)
|
|||||||
data << record.value("path").toString();
|
data << record.value("path").toString();
|
||||||
TreeItem * item = new TreeItem(data);
|
TreeItem * item = new TreeItem(data);
|
||||||
|
|
||||||
item->id = record.value("id").toLongLong();
|
item->id = record.value("id").toULongLong();
|
||||||
//la inserción de hijos se hace de forma ordenada
|
//la inserción de hijos se hace de forma ordenada
|
||||||
items.value(record.value("parentId").toLongLong())->appendChild(item);
|
items.value(record.value("parentId").toULongLong())->appendChild(item);
|
||||||
//se añade el item al map, de forma que se pueda encontrar como padre en siguientes iteraciones
|
//se añade el item al map, de forma que se pueda encontrar como padre en siguientes iteraciones
|
||||||
items.insert(item->id,item);
|
items.insert(item->id,item);
|
||||||
}
|
}
|
||||||
@ -315,10 +315,10 @@ void TreeModel::setupFilteredModelData(QSqlQuery &sqlquery, TreeItem *parent)
|
|||||||
data << record.value("name").toString();
|
data << record.value("name").toString();
|
||||||
data << record.value("path").toString();
|
data << record.value("path").toString();
|
||||||
TreeItem * item = new TreeItem(data);
|
TreeItem * item = new TreeItem(data);
|
||||||
item->id = sqlquery.value(0).toLongLong();
|
item->id = sqlquery.value(0).toULongLong();
|
||||||
|
|
||||||
//id del padre
|
//id del padre
|
||||||
quint64 parentId = record.value("parentId").toLongLong();
|
quint64 parentId = record.value("parentId").toULongLong();
|
||||||
|
|
||||||
//se añade el item al map, de forma que se pueda encontrar como padre en siguientes iteraciones
|
//se añade el item al map, de forma que se pueda encontrar como padre en siguientes iteraciones
|
||||||
if(!filteredItems.contains(item->id))
|
if(!filteredItems.contains(item->id))
|
||||||
|
@ -123,7 +123,7 @@ qulonglong LibraryCreator::insertFolders()
|
|||||||
query.bindValue(":name", folder.name);
|
query.bindValue(":name", folder.name);
|
||||||
query.bindValue(":path", folder.path);
|
query.bindValue(":path", folder.path);
|
||||||
query.exec();
|
query.exec();
|
||||||
return query.lastInsertId().toLongLong();
|
return query.lastInsertId().toULongLong();
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/*qulonglong LibraryCreator::insertComic(const Comic & comic)
|
/*qulonglong LibraryCreator::insertComic(const Comic & comic)
|
||||||
@ -134,7 +134,7 @@ qulonglong LibraryCreator::insertFolders()
|
|||||||
"VALUES (:hash)");
|
"VALUES (:hash)");
|
||||||
comicInfoInsert.bindValue(":hash", comic.hash);
|
comicInfoInsert.bindValue(":hash", comic.hash);
|
||||||
comicInfoInsert.exec();
|
comicInfoInsert.exec();
|
||||||
qulonglong comicInfoId =comicInfoInsert.lastInsertId().toLongLong();
|
qulonglong comicInfoId =comicInfoInsert.lastInsertId().toULongLong();
|
||||||
|
|
||||||
QSqlQuery query(_database);
|
QSqlQuery query(_database);
|
||||||
query.prepare("INSERT INTO comic (parentId, comicInfoId, fileName, path) "
|
query.prepare("INSERT INTO comic (parentId, comicInfoId, fileName, path) "
|
||||||
@ -144,7 +144,7 @@ qulonglong LibraryCreator::insertFolders()
|
|||||||
query.bindValue(":name", comic.name);
|
query.bindValue(":name", comic.name);
|
||||||
query.bindValue(":path", comic.path);
|
query.bindValue(":path", comic.path);
|
||||||
query.exec();
|
query.exec();
|
||||||
return query.lastInsertId().toLongLong();
|
return query.lastInsertId().toULongLong();
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
void LibraryCreator::create(QDir dir)
|
void LibraryCreator::create(QDir dir)
|
||||||
@ -190,13 +190,17 @@ void LibraryCreator::insertComic(const QString & relativePath,const QFileInfo &
|
|||||||
//hash Sha1 del primer 0.5MB + filesize
|
//hash Sha1 del primer 0.5MB + filesize
|
||||||
QString hash = QString(crypto.result().toHex().constData()) + QString::number(fileInfo.size());
|
QString hash = QString(crypto.result().toHex().constData()) + QString::number(fileInfo.size());
|
||||||
Comic comic(_currentPathFolders.last().id,fileInfo.fileName(),relativePath,hash,_database);
|
Comic comic(_currentPathFolders.last().id,fileInfo.fileName(),relativePath,hash,_database);
|
||||||
comic.insert(_database);
|
int numPages;
|
||||||
|
|
||||||
if(!comic.hasCover())
|
if(!comic.hasCover())
|
||||||
{
|
{
|
||||||
ThumbnailCreator tc(QDir::cleanPath(fileInfo.absoluteFilePath()),_target+"/covers/"+hash+".jpg");
|
ThumbnailCreator tc(QDir::cleanPath(fileInfo.absoluteFilePath()),_target+"/covers/"+hash+".jpg");
|
||||||
//ThumbnailCreator tc(QDir::cleanPath(fileInfo.absoluteFilePath()),_target+"/covers/"+fileInfo.fileName()+".jpg");
|
//ThumbnailCreator tc(QDir::cleanPath(fileInfo.absoluteFilePath()),_target+"/covers/"+fileInfo.fileName()+".jpg");
|
||||||
tc.create();
|
tc.create();
|
||||||
|
numPages = tc.getNumPages();
|
||||||
}
|
}
|
||||||
|
comic.info.setNumPages(numPages);
|
||||||
|
comic.insert(_database);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryCreator::update(QDir dirS)
|
void LibraryCreator::update(QDir dirS)
|
||||||
|
@ -91,14 +91,18 @@ void LibraryWindow::doLayout()
|
|||||||
//comicView->setItemDelegate(new YACReaderComicViewDelegate());
|
//comicView->setItemDelegate(new YACReaderComicViewDelegate());
|
||||||
comicView->setContextMenuPolicy(Qt::ActionsContextMenu);
|
comicView->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||||
comicView->setShowGrid(false);
|
comicView->setShowGrid(false);
|
||||||
comicView->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
|
//comicView->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
|
||||||
comicView->horizontalHeader()->setStretchLastSection(true);
|
comicView->horizontalHeader()->setStretchLastSection(true);
|
||||||
comicView->horizontalHeader()->setClickable(false);
|
comicView->horizontalHeader()->setClickable(false);
|
||||||
//comicView->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
|
//comicView->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
|
||||||
comicView->verticalHeader()->setDefaultSectionSize(24);
|
comicView->verticalHeader()->setDefaultSectionSize(24);
|
||||||
comicView->verticalHeader()->setClickable(false); //TODO comportamiento anómalo
|
comicView->verticalHeader()->setClickable(false); //TODO comportamiento anómalo
|
||||||
comicView->setCornerButtonEnabled(false);
|
comicView->setCornerButtonEnabled(false);
|
||||||
comicView->setStyleSheet("QTableView {selection-background-color: #d7d7c7; selection-color: #000000;}");
|
comicView->setStyleSheet("QTableView {selection-background-color: #d7d7c7; selection-color: #000000;}\n QTableView QTableView::item{"
|
||||||
|
"border-right-style:solid;"
|
||||||
|
"border-width:1;"
|
||||||
|
"border-color: #9B9B9B;"
|
||||||
|
"}");
|
||||||
// comicView->verticalHeader()->setStyleSheet("QHeaderView::section"
|
// comicView->verticalHeader()->setStyleSheet("QHeaderView::section"
|
||||||
//"{"
|
//"{"
|
||||||
// "background-color: white /* steelblue */"
|
// "background-color: white /* steelblue */"
|
||||||
@ -673,13 +677,18 @@ void LibraryWindow::loadCovers(const QModelIndex & mi)
|
|||||||
//comicView->setModel(NULL);
|
//comicView->setModel(NULL);
|
||||||
dmCV->setupModelData(folderId,dm->getDatabase());
|
dmCV->setupModelData(folderId,dm->getDatabase());
|
||||||
comicView->setModel(dmCV);
|
comicView->setModel(dmCV);
|
||||||
|
comicView->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft);
|
||||||
comicView->horizontalHeader()->hideSection(4);
|
comicView->horizontalHeader()->hideSection(4);
|
||||||
comicView->horizontalHeader()->hideSection(5);
|
comicView->horizontalHeader()->hideSection(5);
|
||||||
comicView->horizontalHeader()->hideSection(6);
|
comicView->horizontalHeader()->hideSection(6);
|
||||||
comicView->horizontalHeader()->hideSection(7);
|
comicView->horizontalHeader()->hideSection(7);
|
||||||
comicView->horizontalHeader()->hideSection(8);
|
comicView->horizontalHeader()->hideSection(8);
|
||||||
|
|
||||||
|
//debido a un bug, qt4 no es capaz de ajustar el ancho teniendo en cuenta todas la filas (no sólo las visibles)
|
||||||
|
//así que se ecala la primera vez y después se deja el control al usuario.
|
||||||
|
comicView->resizeColumnsToContents();
|
||||||
|
comicView->horizontalHeader()->setStretchLastSection(true);
|
||||||
|
|
||||||
QStringList paths = dmCV->getPaths(currentPath());
|
QStringList paths = dmCV->getPaths(currentPath());
|
||||||
comicFlow->setImagePaths(paths);
|
comicFlow->setImagePaths(paths);
|
||||||
comicFlow->setMarks(dmCV->getReadList());
|
comicFlow->setMarks(dmCV->getReadList());
|
||||||
@ -716,6 +725,11 @@ void LibraryWindow::loadCovers(const QModelIndex & mi)
|
|||||||
void LibraryWindow::reloadCovers()
|
void LibraryWindow::reloadCovers()
|
||||||
{
|
{
|
||||||
loadCovers(_rootIndexCV);
|
loadCovers(_rootIndexCV);
|
||||||
|
|
||||||
|
QModelIndex mi = dmCV->getIndexFromId(_comicIdEdited);
|
||||||
|
comicView->setCurrentIndex(mi);
|
||||||
|
//centerComicFlow(mi);
|
||||||
|
comicFlow->setCenterIndex(mi.row());
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryWindow::centerComicFlow(const QModelIndex & mi)
|
void LibraryWindow::centerComicFlow(const QModelIndex & mi)
|
||||||
@ -807,18 +821,27 @@ void LibraryWindow::createLibrary()
|
|||||||
|
|
||||||
void LibraryWindow::create(QString source, QString dest, QString name)
|
void LibraryWindow::create(QString source, QString dest, QString name)
|
||||||
{
|
{
|
||||||
_lastAdded = name;
|
|
||||||
libraries.insert(name,source);
|
|
||||||
selectedLibrary->addItem(name,source);
|
|
||||||
libraryCreator->createLibrary(source,dest);
|
libraryCreator->createLibrary(source,dest);
|
||||||
libraryCreator->start();
|
libraryCreator->start();
|
||||||
saveLibraries();
|
_lastAdded = name;
|
||||||
|
_sourceLastAdded = source;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryWindow::openLastCreated()
|
void LibraryWindow::openLastCreated()
|
||||||
{
|
{
|
||||||
loadLibrary(_lastAdded);
|
|
||||||
|
selectedLibrary->disconnect();
|
||||||
|
|
||||||
selectedLibrary->setCurrentIndex(selectedLibrary->findText(_lastAdded));
|
selectedLibrary->setCurrentIndex(selectedLibrary->findText(_lastAdded));
|
||||||
|
libraries.insert(_lastAdded,_sourceLastAdded);
|
||||||
|
selectedLibrary->addItem(_lastAdded,_sourceLastAdded);
|
||||||
|
selectedLibrary->setCurrentIndex(selectedLibrary->findText(_lastAdded));
|
||||||
|
saveLibraries();
|
||||||
|
|
||||||
|
connect(selectedLibrary,SIGNAL(currentIndexChanged(QString)),this,SLOT(loadLibrary(QString)));
|
||||||
|
|
||||||
|
loadLibrary(_lastAdded);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryWindow::showAddLibrary()
|
void LibraryWindow::showAddLibrary()
|
||||||
@ -829,10 +852,8 @@ void LibraryWindow::showAddLibrary()
|
|||||||
void LibraryWindow::openLibrary(QString path, QString name)
|
void LibraryWindow::openLibrary(QString path, QString name)
|
||||||
{
|
{
|
||||||
_lastAdded = name;
|
_lastAdded = name;
|
||||||
libraries.insert(name,path);
|
_sourceLastAdded = path;
|
||||||
selectedLibrary->addItem(name,path);
|
|
||||||
openLastCreated();
|
openLastCreated();
|
||||||
saveLibraries();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryWindow::loadLibraries()
|
void LibraryWindow::loadLibraries()
|
||||||
@ -1052,12 +1073,14 @@ void LibraryWindow::setFoldersFilter(QString filter)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#include "tableitem.h"
|
||||||
void LibraryWindow::showProperties()
|
void LibraryWindow::showProperties()
|
||||||
{
|
{
|
||||||
QModelIndexList indexList = comicView->selectionModel()->selectedRows();
|
QModelIndexList indexList = comicView->selectionModel()->selectedRows();
|
||||||
|
|
||||||
QList<Comic> comics = dmCV->getComics(indexList);
|
QList<Comic> comics = dmCV->getComics(indexList);
|
||||||
|
Comic c = comics[0];
|
||||||
|
_comicIdEdited = c.id;//static_cast<TableItem*>(indexList[0].internalPointer())->data(4).toULongLong();
|
||||||
|
|
||||||
//QModelIndex mi = comicView->currentIndex();
|
//QModelIndex mi = comicView->currentIndex();
|
||||||
//QString path = QDir::cleanPath(currentPath()+dmCV->getComicPath(mi));
|
//QString path = QDir::cleanPath(currentPath()+dmCV->getComicPath(mi));
|
||||||
|
@ -131,10 +131,13 @@ private:
|
|||||||
QString comicsPath;
|
QString comicsPath;
|
||||||
|
|
||||||
QString _lastAdded;
|
QString _lastAdded;
|
||||||
|
QString _sourceLastAdded;
|
||||||
|
|
||||||
QModelIndex _rootIndex;
|
QModelIndex _rootIndex;
|
||||||
QModelIndex _rootIndexCV;
|
QModelIndex _rootIndexCV;
|
||||||
|
|
||||||
|
quint64 _comicIdEdited;
|
||||||
|
|
||||||
void setupUI();
|
void setupUI();
|
||||||
void createActions();
|
void createActions();
|
||||||
void createToolBars();
|
void createToolBars();
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QPlainTextEdit>
|
#include <QPlainTextEdit>
|
||||||
|
#include <QTableView>
|
||||||
|
|
||||||
#include "pictureflow.h"
|
#include "pictureflow.h"
|
||||||
|
|
||||||
@ -165,5 +166,22 @@ private:
|
|||||||
QAction * restore;
|
QAction * restore;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//class YACReaderTableView : public QTableView
|
||||||
|
//{
|
||||||
|
// Q_OBJECT
|
||||||
|
//public:
|
||||||
|
// YACReaderTableView(QWidget *parent = 0)
|
||||||
|
// : QTableView(parent) {}
|
||||||
|
//
|
||||||
|
//protected:
|
||||||
|
// bool viewportEvent ( QEvent * event )
|
||||||
|
// {
|
||||||
|
// resizeColumnsToContents();
|
||||||
|
// return QTableView::viewportEvent(event);
|
||||||
|
// }
|
||||||
|
//};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user