mirror of
https://github.com/YACReader/yacreader
synced 2025-07-25 08:25:03 -04:00
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:
@ -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);
|
||||
}
|
@ -21,6 +21,7 @@ public:
|
||||
TableModel( QSqlQuery &sqlquery, QObject *parent = 0);
|
||||
~TableModel();
|
||||
|
||||
|
||||
QVariant data(const QModelIndex &index, int role) const;
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation,
|
||||
@ -31,11 +32,12 @@ public:
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
void setupModelData(unsigned long long int parentFolder,const QString & databasePath);
|
||||
|
||||
|
||||
//M<>todos de conveniencia
|
||||
QStringList getPaths(const QString & _source);
|
||||
QString getComicPath(QModelIndex mi);
|
||||
ComicDB getComic(const QModelIndex & mi); //--> para la edici<63>n
|
||||
ComicDB getComic(int row);
|
||||
QVector<bool> getReadList();
|
||||
QVector<bool> setAllComicsRead(bool read);
|
||||
QList<ComicDB> getComics(QList<QModelIndex> list); //--> recupera la informaci<63>n com<6F>n a los comics seleccionados
|
||||
@ -46,6 +48,13 @@ public:
|
||||
QVector<bool> setComicsRead(QList<QModelIndex> list,bool read);
|
||||
qint64 asignNumbers(QList<QModelIndex> list,int startingNumber);
|
||||
void remove(ComicDB * comic, int row);
|
||||
void removeInTransaction(int row);
|
||||
|
||||
public slots:
|
||||
void remove(int row);
|
||||
void startTransaction(int first, int last);
|
||||
void finishTransaction();
|
||||
|
||||
private:
|
||||
void setupModelData( QSqlQuery &sqlquery);
|
||||
ComicDB _getComic(const QModelIndex & mi);
|
||||
@ -53,6 +62,8 @@ private:
|
||||
|
||||
QString _databasePath;
|
||||
|
||||
QSqlDatabase dbTransaction;
|
||||
|
||||
signals:
|
||||
void beforeReset();
|
||||
void reset();
|
||||
|
Reference in New Issue
Block a user