mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -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:
parent
7bacad6884
commit
04e56f1d03
@ -108,6 +108,7 @@ void GoToFlow::setNumSlides(unsigned int slides)
|
|||||||
numImagesLoaded = 0;
|
numImagesLoaded = 0;
|
||||||
|
|
||||||
connect(flow, SIGNAL(centerIndexChanged(int)), this, SLOT(preload()));
|
connect(flow, SIGNAL(centerIndexChanged(int)), this, SLOT(preload()));
|
||||||
|
connect(flow, SIGNAL(centerIndexChangedSilent(int)), this, SLOT(preload()));
|
||||||
|
|
||||||
ready = true;
|
ready = true;
|
||||||
worker->reset();
|
worker->reset();
|
||||||
|
@ -75,7 +75,8 @@ HEADERS += comic_flow.h \
|
|||||||
no_libraries_widget.h \
|
no_libraries_widget.h \
|
||||||
import_widget.h \
|
import_widget.h \
|
||||||
yacreader_local_server.h \
|
yacreader_local_server.h \
|
||||||
yacreader_main_toolbar.h
|
yacreader_main_toolbar.h \
|
||||||
|
comics_remover.h
|
||||||
|
|
||||||
SOURCES += comic_flow.cpp \
|
SOURCES += comic_flow.cpp \
|
||||||
create_library_dialog.cpp \
|
create_library_dialog.cpp \
|
||||||
@ -113,7 +114,8 @@ SOURCES += comic_flow.cpp \
|
|||||||
no_libraries_widget.cpp \
|
no_libraries_widget.cpp \
|
||||||
import_widget.cpp \
|
import_widget.cpp \
|
||||||
yacreader_local_server.cpp \
|
yacreader_local_server.cpp \
|
||||||
yacreader_main_toolbar.cpp
|
yacreader_main_toolbar.cpp \
|
||||||
|
comics_remover.cpp
|
||||||
|
|
||||||
|
|
||||||
include(./server/server.pri)
|
include(./server/server.pri)
|
||||||
|
@ -17,6 +17,7 @@ ComicFlow::ComicFlow(QWidget* parent,FlowType flowType)
|
|||||||
|
|
||||||
worker = new ImageLoader;
|
worker = new ImageLoader;
|
||||||
connect(this, SIGNAL(centerIndexChanged(int)), this, SLOT(preload()));
|
connect(this, SIGNAL(centerIndexChanged(int)), this, SLOT(preload()));
|
||||||
|
connect(this, SIGNAL(centerIndexChangedSilent(int)), this, SLOT(preload()));
|
||||||
|
|
||||||
setReflectionEffect(PlainReflection);
|
setReflectionEffect(PlainReflection);
|
||||||
}
|
}
|
||||||
|
29
YACReaderLibrary/comics_remover.cpp
Normal file
29
YACReaderLibrary/comics_remover.cpp
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#include "comics_remover.h"
|
||||||
|
|
||||||
|
#include <QFile>
|
||||||
|
|
||||||
|
ComicsRemover::ComicsRemover(QModelIndexList & il, QList<QString> & ps, QObject *parent) :
|
||||||
|
QThread(parent),indexList(il), paths(ps)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void ComicsRemover::run()
|
||||||
|
{
|
||||||
|
QString currentComicPath;
|
||||||
|
QListIterator<QModelIndex> i(indexList);
|
||||||
|
QListIterator<QString> i2(paths);
|
||||||
|
i.toBack();
|
||||||
|
i2.toBack();
|
||||||
|
|
||||||
|
while (i.hasPrevious() && i2.hasPrevious())
|
||||||
|
{
|
||||||
|
QModelIndex mi = i.previous();
|
||||||
|
currentComicPath = i2.previous();
|
||||||
|
if(QFile::remove(currentComicPath))
|
||||||
|
{
|
||||||
|
emit remove(mi.row());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
emit finished();
|
||||||
|
}
|
27
YACReaderLibrary/comics_remover.h
Normal file
27
YACReaderLibrary/comics_remover.h
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#ifndef COMICS_REMOVER_H
|
||||||
|
#define COMICS_REMOVER_H
|
||||||
|
|
||||||
|
#include <QThread>
|
||||||
|
|
||||||
|
#include <QModelIndex>
|
||||||
|
#include <comic_db.h>
|
||||||
|
|
||||||
|
class ComicsRemover : public QThread
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit ComicsRemover(QModelIndexList & indexList, QList<QString> & paths, QObject *parent = 0);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void remove(int);
|
||||||
|
void finished();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void run();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QModelIndexList indexList;
|
||||||
|
QList<QString> paths;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // COMICS_REMOVER_H
|
@ -435,6 +435,33 @@ QModelIndex TableModel::getIndexFromId(quint64 id)
|
|||||||
return index(i,0);
|
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)
|
void TableModel::remove(ComicDB * comic, int row)
|
||||||
{
|
{
|
||||||
beginRemoveRows(QModelIndex(),row,row);
|
beginRemoveRows(QModelIndex(),row,row);
|
||||||
@ -450,3 +477,13 @@ void TableModel::remove(ComicDB * comic, int row)
|
|||||||
QSqlDatabase::removeDatabase(_databasePath);
|
QSqlDatabase::removeDatabase(_databasePath);
|
||||||
endRemoveRows();
|
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( QSqlQuery &sqlquery, QObject *parent = 0);
|
||||||
~TableModel();
|
~TableModel();
|
||||||
|
|
||||||
|
|
||||||
QVariant data(const QModelIndex &index, int role) const;
|
QVariant data(const QModelIndex &index, int role) const;
|
||||||
Qt::ItemFlags flags(const QModelIndex &index) const;
|
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||||
QVariant headerData(int section, Qt::Orientation orientation,
|
QVariant headerData(int section, Qt::Orientation orientation,
|
||||||
@ -36,6 +37,7 @@ public:
|
|||||||
QStringList getPaths(const QString & _source);
|
QStringList getPaths(const QString & _source);
|
||||||
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);
|
||||||
QVector<bool> getReadList();
|
QVector<bool> getReadList();
|
||||||
QVector<bool> setAllComicsRead(bool read);
|
QVector<bool> setAllComicsRead(bool read);
|
||||||
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
|
||||||
@ -46,6 +48,13 @@ public:
|
|||||||
QVector<bool> setComicsRead(QList<QModelIndex> list,bool read);
|
QVector<bool> setComicsRead(QList<QModelIndex> list,bool 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);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void remove(int row);
|
||||||
|
void startTransaction(int first, int last);
|
||||||
|
void finishTransaction();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupModelData( QSqlQuery &sqlquery);
|
void setupModelData( QSqlQuery &sqlquery);
|
||||||
ComicDB _getComic(const QModelIndex & mi);
|
ComicDB _getComic(const QModelIndex & mi);
|
||||||
@ -53,6 +62,8 @@ private:
|
|||||||
|
|
||||||
QString _databasePath;
|
QString _databasePath;
|
||||||
|
|
||||||
|
QSqlDatabase dbTransaction;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void beforeReset();
|
void beforeReset();
|
||||||
void reset();
|
void reset();
|
||||||
|
@ -50,11 +50,13 @@
|
|||||||
#include "yacreader_titled_toolbar.h"
|
#include "yacreader_titled_toolbar.h"
|
||||||
#include "yacreader_main_toolbar.h"
|
#include "yacreader_main_toolbar.h"
|
||||||
|
|
||||||
|
#include "comics_remover.h"
|
||||||
|
|
||||||
//#include "yacreader_social_dialog.h"
|
//#include "yacreader_social_dialog.h"
|
||||||
//
|
//
|
||||||
|
|
||||||
LibraryWindow::LibraryWindow()
|
LibraryWindow::LibraryWindow()
|
||||||
:QMainWindow(),skip(0),fullscreen(false),fetching(false)
|
:QMainWindow(),fullscreen(false),fetching(false)
|
||||||
{
|
{
|
||||||
setupUI();
|
setupUI();
|
||||||
loadLibraries();
|
loadLibraries();
|
||||||
@ -882,7 +884,18 @@ void LibraryWindow::loadCovers(const QModelIndex & mi)
|
|||||||
comicFlow->setMarks(dmCV->getReadList());
|
comicFlow->setMarks(dmCV->getReadList());
|
||||||
comicFlow->setFocus(Qt::OtherFocusReason);
|
comicFlow->setFocus(Qt::OtherFocusReason);
|
||||||
|
|
||||||
if(paths.size()>0 && !importedCovers)
|
checkEmptyFolder(&paths);
|
||||||
|
|
||||||
|
if(paths.size()>0)
|
||||||
|
comicView->setCurrentIndex(dmCV->index(0,0));
|
||||||
|
}
|
||||||
|
|
||||||
|
void LibraryWindow::checkEmptyFolder(QStringList * paths)
|
||||||
|
{
|
||||||
|
if(paths == 0)
|
||||||
|
paths = &dmCV->getPaths(currentPath());
|
||||||
|
|
||||||
|
if(paths->size()>0 && !importedCovers)
|
||||||
{
|
{
|
||||||
openComicAction->setEnabled(true);
|
openComicAction->setEnabled(true);
|
||||||
showPropertiesAction->setEnabled(true);
|
showPropertiesAction->setEnabled(true);
|
||||||
@ -896,6 +909,8 @@ void LibraryWindow::loadCovers(const QModelIndex & mi)
|
|||||||
|
|
||||||
showHideMarksAction->setEnabled(true);
|
showHideMarksAction->setEnabled(true);
|
||||||
toggleFullScreenAction->setEnabled(true);
|
toggleFullScreenAction->setEnabled(true);
|
||||||
|
|
||||||
|
deleteComicsAction->setEnabled(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -911,9 +926,9 @@ void LibraryWindow::loadCovers(const QModelIndex & mi)
|
|||||||
|
|
||||||
showHideMarksAction->setEnabled(false);
|
showHideMarksAction->setEnabled(false);
|
||||||
toggleFullScreenAction->setEnabled(false);
|
toggleFullScreenAction->setEnabled(false);
|
||||||
|
|
||||||
|
deleteComicsAction->setEnabled(false);
|
||||||
}
|
}
|
||||||
if(paths.size()>0)
|
|
||||||
comicView->setCurrentIndex(dmCV->index(0,0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryWindow::reloadCovers()
|
void LibraryWindow::reloadCovers()
|
||||||
@ -929,36 +944,16 @@ void LibraryWindow::reloadCovers()
|
|||||||
|
|
||||||
void LibraryWindow::centerComicFlow(const QModelIndex & mi)
|
void LibraryWindow::centerComicFlow(const QModelIndex & mi)
|
||||||
{
|
{
|
||||||
//TODO corregir el comportamiento de ComicFlowWidgetSW para evitar skip
|
|
||||||
if(typeid(comicFlow) == typeid(ComicFlowWidgetSW))
|
|
||||||
{
|
|
||||||
int distance = comicFlow->centerIndex()-mi.row();
|
|
||||||
if(abs(distance)>10)
|
|
||||||
{
|
|
||||||
if(distance<0)
|
|
||||||
comicFlow->setCenterIndex(comicFlow->centerIndex()+(-distance)-10);
|
|
||||||
else
|
|
||||||
comicFlow->setCenterIndex(comicFlow->centerIndex()-distance+10);
|
|
||||||
skip = 10;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
skip = abs(comicFlow->centerIndex()-mi.row());
|
|
||||||
}
|
|
||||||
comicFlow->showSlide(mi.row());
|
comicFlow->showSlide(mi.row());
|
||||||
comicFlow->setFocus(Qt::OtherFocusReason);
|
comicFlow->setFocus(Qt::OtherFocusReason);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryWindow::updateComicView(int i)
|
void LibraryWindow::updateComicView(int i)
|
||||||
{
|
|
||||||
|
|
||||||
if(skip==0)
|
|
||||||
{
|
{
|
||||||
QModelIndex mi = dmCV->index(i,2);
|
QModelIndex mi = dmCV->index(i,2);
|
||||||
comicView->setCurrentIndex(mi);
|
comicView->setCurrentIndex(mi);
|
||||||
comicView->scrollTo(mi,QAbstractItemView::EnsureVisible);
|
comicView->scrollTo(mi,QAbstractItemView::EnsureVisible);
|
||||||
}
|
}
|
||||||
skip?(--skip):0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LibraryWindow::openComic()
|
void LibraryWindow::openComic()
|
||||||
{
|
{
|
||||||
@ -1450,22 +1445,36 @@ QModelIndexList LibraryWindow::getSelectedComics()
|
|||||||
|
|
||||||
void LibraryWindow::deleteComics()
|
void LibraryWindow::deleteComics()
|
||||||
{
|
{
|
||||||
//TODO move this to another thread
|
int ret = QMessageBox::question(this,tr("Delete comics"),tr("All the selected comics will be deleted from your disk. Are you sure?"),QMessageBox::Yes,QMessageBox::No);
|
||||||
|
|
||||||
|
if(ret == QMessageBox::Yes)
|
||||||
|
{
|
||||||
|
|
||||||
QModelIndexList indexList = getSelectedComics();
|
QModelIndexList indexList = getSelectedComics();
|
||||||
|
|
||||||
QString currentComicPath;
|
QList<ComicDB> comics = dmCV->getComics(indexList);
|
||||||
QListIterator<QModelIndex> i(indexList);
|
|
||||||
i.toBack();
|
QList<QString> paths;
|
||||||
while (i.hasPrevious())
|
QString libraryPath = currentPath();
|
||||||
|
foreach(ComicDB comic, comics)
|
||||||
{
|
{
|
||||||
QModelIndex mi = i.previous();
|
paths.append(libraryPath + comic.path);
|
||||||
ComicDB comic = dmCV->getComic(mi);
|
|
||||||
currentComicPath = currentPath() + comic.path;
|
|
||||||
if(QFile::remove(currentComicPath))
|
|
||||||
{
|
|
||||||
dmCV->remove(&comic,mi.row());
|
|
||||||
comicFlow->remove(mi.row());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ComicsRemover * remover = new ComicsRemover(indexList,paths);
|
||||||
|
|
||||||
|
//comicView->showDeleteProgress();
|
||||||
|
dmCV->startTransaction(indexList.first().row(),indexList.last().row());
|
||||||
|
|
||||||
|
connect(remover, SIGNAL(remove(int)), dmCV, SLOT(remove(int)));
|
||||||
|
connect(remover, SIGNAL(remove(int)), comicFlow, SLOT(remove(int)));
|
||||||
|
connect(remover, SIGNAL(finished()), dmCV, SLOT(finishTransaction()));
|
||||||
|
//connect(remover, SIGNAL(finished()), comicView, SLOT(hideDeleteProgress()));
|
||||||
|
connect(remover, SIGNAL(finished()),this,SLOT(checkEmptyFolder()));
|
||||||
|
connect(remover, SIGNAL(finished()), remover, SLOT(deleteLater()));
|
||||||
|
//connect(remover, SIGNAL(finished()), thread, SLOT(deleteLater()));
|
||||||
|
|
||||||
|
remover->start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,6 @@ private:
|
|||||||
bool fetching;
|
bool fetching;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
unsigned int skip;
|
|
||||||
|
|
||||||
QAction * openComicAction;
|
QAction * openComicAction;
|
||||||
QAction * showPropertiesAction;
|
QAction * showPropertiesAction;
|
||||||
@ -190,6 +189,7 @@ public:
|
|||||||
public slots:
|
public slots:
|
||||||
void loadLibrary(const QString & path);
|
void loadLibrary(const QString & path);
|
||||||
void loadCovers(const QModelIndex & mi);
|
void loadCovers(const QModelIndex & mi);
|
||||||
|
void checkEmptyFolder(QStringList * paths = 0);
|
||||||
void reloadCovers();
|
void reloadCovers();
|
||||||
void centerComicFlow(const QModelIndex & mi);
|
void centerComicFlow(const QModelIndex & mi);
|
||||||
void updateComicView(int i);
|
void updateComicView(int i);
|
||||||
|
@ -1092,8 +1092,7 @@ void PictureFlow::removeSlide(int index)
|
|||||||
{
|
{
|
||||||
d->state->slideImages.remove(index);
|
d->state->slideImages.remove(index);
|
||||||
d->state->marks.remove(index);
|
d->state->marks.remove(index);
|
||||||
//TODO remove loaded flags
|
setCenterIndex(index);
|
||||||
triggerRender();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1164,14 +1163,24 @@ void PictureFlow::showPrevious()
|
|||||||
int center = d->state->centerIndex;
|
int center = d->state->centerIndex;
|
||||||
|
|
||||||
if(step > 0)
|
if(step > 0)
|
||||||
|
{
|
||||||
d->animator->start(center);
|
d->animator->start(center);
|
||||||
|
emit centerIndexChanged(center);
|
||||||
|
}
|
||||||
|
|
||||||
if(step == 0)
|
if(step == 0)
|
||||||
if(center > 0)
|
if(center > 0)
|
||||||
|
{
|
||||||
d->animator->start(center - 1);
|
d->animator->start(center - 1);
|
||||||
|
emit centerIndexChanged(center - 1);
|
||||||
|
}
|
||||||
|
|
||||||
if(step < 0)
|
if(step < 0)
|
||||||
|
{
|
||||||
d->animator->target = qMax(0, center - 2);
|
d->animator->target = qMax(0, center - 2);
|
||||||
|
emit centerIndexChanged(qMax(0, center - 2));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PictureFlow::showNext()
|
void PictureFlow::showNext()
|
||||||
@ -1179,15 +1188,27 @@ void PictureFlow::showNext()
|
|||||||
int step = d->animator->step;
|
int step = d->animator->step;
|
||||||
int center = d->state->centerIndex;
|
int center = d->state->centerIndex;
|
||||||
|
|
||||||
|
|
||||||
if(step < 0)
|
if(step < 0)
|
||||||
|
{
|
||||||
d->animator->start(center);
|
d->animator->start(center);
|
||||||
|
emit centerIndexChanged(center);
|
||||||
|
}
|
||||||
|
|
||||||
if(step == 0)
|
if(step == 0)
|
||||||
if(center < slideCount()-1)
|
if(center < slideCount()-1)
|
||||||
|
{
|
||||||
d->animator->start(center + 1);
|
d->animator->start(center + 1);
|
||||||
|
emit centerIndexChanged(center + 1);
|
||||||
|
}
|
||||||
|
|
||||||
if(step > 0)
|
if(step > 0)
|
||||||
|
{
|
||||||
d->animator->target = qMin(center + 2, slideCount()-1);
|
d->animator->target = qMin(center + 2, slideCount()-1);
|
||||||
|
emit centerIndexChanged(qMin(center + 2, slideCount()-1));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PictureFlow::showSlide(unsigned int index)
|
void PictureFlow::showSlide(unsigned int index)
|
||||||
@ -1214,9 +1235,9 @@ void PictureFlow::keyPressEvent(QKeyEvent* event)
|
|||||||
{
|
{
|
||||||
if(event->key() == Qt::Key_Left)
|
if(event->key() == Qt::Key_Left)
|
||||||
{
|
{
|
||||||
if(event->modifiers() == Qt::ControlModifier)
|
/*if(event->modifiers() == Qt::ControlModifier)
|
||||||
showSlide(centerIndex()-10);
|
showSlide(centerIndex()-10);
|
||||||
else
|
else*/
|
||||||
showPrevious();
|
showPrevious();
|
||||||
event->accept();
|
event->accept();
|
||||||
return;
|
return;
|
||||||
@ -1224,9 +1245,9 @@ void PictureFlow::keyPressEvent(QKeyEvent* event)
|
|||||||
|
|
||||||
if(event->key() == Qt::Key_Right)
|
if(event->key() == Qt::Key_Right)
|
||||||
{
|
{
|
||||||
if(event->modifiers() == Qt::ControlModifier)
|
/*if(event->modifiers() == Qt::ControlModifier)
|
||||||
showSlide(centerIndex()+10);
|
showSlide(centerIndex()+10);
|
||||||
else
|
else*/
|
||||||
showNext();
|
showNext();
|
||||||
event->accept();
|
event->accept();
|
||||||
return;
|
return;
|
||||||
@ -1278,8 +1299,9 @@ void PictureFlow::updateAnimation() //bucle principal
|
|||||||
frameSkiped = true;
|
frameSkiped = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(d->state->centerIndex != old_center)
|
if(d->state->centerIndex != old_center)
|
||||||
emit centerIndexChanged(d->state->centerIndex);
|
emit centerIndexChangedSilent(d->state->centerIndex);
|
||||||
if(d->animator->animating == true)
|
if(d->animator->animating == true)
|
||||||
{
|
{
|
||||||
int difference = 10-now.elapsed();
|
int difference = 10-now.elapsed();
|
||||||
|
@ -204,6 +204,7 @@ public slots:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void centerIndexChanged(int index);
|
void centerIndexChanged(int index);
|
||||||
|
void centerIndexChangedSilent(int index);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void paintEvent(QPaintEvent *event);
|
void paintEvent(QPaintEvent *event);
|
||||||
|
@ -2,11 +2,12 @@
|
|||||||
|
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
#include <QResizeEvent>
|
#include <QResizeEvent>
|
||||||
|
#include <QPropertyAnimation>
|
||||||
|
|
||||||
#include "yacreader_deleting_progress.h"
|
#include "yacreader_deleting_progress.h"
|
||||||
|
|
||||||
YACReaderTableView::YACReaderTableView(QWidget *parent) :
|
YACReaderTableView::YACReaderTableView(QWidget *parent) :
|
||||||
QTableView(parent)
|
QTableView(parent),showDelete(false)
|
||||||
{
|
{
|
||||||
setAlternatingRowColors(true);
|
setAlternatingRowColors(true);
|
||||||
verticalHeader()->setAlternatingRowColors(true);
|
verticalHeader()->setAlternatingRowColors(true);
|
||||||
@ -36,24 +37,41 @@ YACReaderTableView::YACReaderTableView(QWidget *parent) :
|
|||||||
setSelectionBehavior(QAbstractItemView::SelectRows);
|
setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||||
setSelectionMode(QAbstractItemView::ExtendedSelection);
|
setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||||
|
|
||||||
deletingProgress = new YACReaderDeletingProgress(/*this*/);
|
/*deletingProgress = new YACReaderDeletingProgress(this);
|
||||||
|
|
||||||
|
showDeletingProgressAnimation = new QPropertyAnimation(deletingProgress,"pos");
|
||||||
|
showDeletingProgressAnimation->setDuration(150);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void YACReaderTableView::showDeleteProgress()
|
void YACReaderTableView::showDeleteProgress()
|
||||||
{
|
{
|
||||||
|
/*showDelete = true;
|
||||||
|
|
||||||
|
showDeletingProgressAnimation->setStartValue(deletingProgress->pos());
|
||||||
|
showDeletingProgressAnimation->setEndValue(QPoint((width()-deletingProgress->width())/2 ,1));
|
||||||
|
showDeletingProgressAnimation->start();*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void YACReaderTableView::hideDeleteProgress()
|
void YACReaderTableView::hideDeleteProgress()
|
||||||
{
|
{
|
||||||
|
/*showDelete = false;
|
||||||
|
|
||||||
|
if(showDeletingProgressAnimation->state()==QPropertyAnimation::Running)
|
||||||
|
showDeletingProgressAnimation->stop();
|
||||||
|
|
||||||
|
showDeletingProgressAnimation->setStartValue(deletingProgress->pos());
|
||||||
|
showDeletingProgressAnimation->setEndValue(QPoint((width()-deletingProgress->width())/2 ,-deletingProgress->height()));
|
||||||
|
showDeletingProgressAnimation->start();*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void YACReaderTableView::resizeEvent(QResizeEvent * event)
|
void YACReaderTableView::resizeEvent(QResizeEvent * event)
|
||||||
{
|
{
|
||||||
event->size();
|
/*event->size();
|
||||||
|
|
||||||
|
if(showDelete)
|
||||||
deletingProgress->move((event->size().width()-deletingProgress->width())/2 ,1);
|
deletingProgress->move((event->size().width()-deletingProgress->width())/2 ,1);
|
||||||
|
else
|
||||||
|
deletingProgress->move((event->size().width()-deletingProgress->width())/2 ,-deletingProgress->height());*/
|
||||||
|
|
||||||
QTableView::resizeEvent(event);
|
QTableView::resizeEvent(event);
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
class YACReaderDeletingProgress;
|
class YACReaderDeletingProgress;
|
||||||
class QResizeEvent;
|
class QResizeEvent;
|
||||||
|
class QPropertyAnimation;
|
||||||
|
|
||||||
class YACReaderTableView : public QTableView
|
class YACReaderTableView : public QTableView
|
||||||
{
|
{
|
||||||
@ -20,6 +21,8 @@ public slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
YACReaderDeletingProgress * deletingProgress;
|
YACReaderDeletingProgress * deletingProgress;
|
||||||
|
bool showDelete;
|
||||||
|
QPropertyAnimation * showDeletingProgressAnimation;
|
||||||
|
|
||||||
void resizeEvent(QResizeEvent * event);
|
void resizeEvent(QResizeEvent * event);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user