Corregido picture flow, ahora centerIndexChanged funciona igual que en la versi?n OpenGL.

Implementada la versi?n RC del borrado de c?mics.
This commit is contained in:
Luis Ángel San Martín
2013-06-14 17:04:13 +02:00
parent 7bacad6884
commit 04e56f1d03
13 changed files with 427 additions and 266 deletions

View File

@ -435,6 +435,33 @@ QModelIndex TableModel::getIndexFromId(quint64 id)
return index(i,0);
}
void TableModel::startTransaction(int first, int last)
{
beginRemoveRows(QModelIndex(),first,last);
dbTransaction = DataBaseManagement::loadDatabase(_databasePath);
dbTransaction.transaction();
}
void TableModel::finishTransaction()
{
dbTransaction.commit();
dbTransaction.close();
QSqlDatabase::removeDatabase(_databasePath);
endRemoveRows();
}
void TableModel::removeInTransaction(int row)
{
ComicDB c = DBHelper::loadComic(_data.at(row)->data(ID).toULongLong(),dbTransaction);
DBHelper::removeFromDB(&c,dbTransaction);
removeRow(row);
delete _data.at(row);
_data.removeAt(row);
}
void TableModel::remove(ComicDB * comic, int row)
{
beginRemoveRows(QModelIndex(),row,row);
@ -449,4 +476,14 @@ void TableModel::remove(ComicDB * comic, int row)
db.close();
QSqlDatabase::removeDatabase(_databasePath);
endRemoveRows();
}
ComicDB TableModel::getComic(int row)
{
return getComic(index(row,0));
}
void TableModel::remove(int row)
{
removeInTransaction(row);
}