Merge pull request #67 from vedgy/goto_flow-fixes

goto_flow fixes
This commit is contained in:
Luis Ángel San Martín 2019-09-18 18:12:29 +02:00 committed by GitHub
commit 3219d00a28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View File

@ -40,6 +40,8 @@ GoToFlow::GoToFlow(QWidget *parent, FlowType flowType)
flow->setSlideSize(imageSize);
connect(flow, SIGNAL(centerIndexChanged(int)), this, SLOT(setPageNumber(int)));
connect(flow, SIGNAL(selected(unsigned int)), this, SIGNAL(goToPage(unsigned int)));
connect(flow, &PictureFlow::centerIndexChanged, this, &GoToFlow::preload);
connect(flow, &PictureFlow::centerIndexChangedSilent, this, &GoToFlow::preload);
connect(toolBar, SIGNAL(goTo(unsigned int)), this, SIGNAL(goToPage(unsigned int)));
connect(toolBar, SIGNAL(setCenter(unsigned int)), flow, SLOT(showSlide(unsigned int)));
@ -114,9 +116,6 @@ void GoToFlow::setNumSlides(unsigned int slides)
numImagesLoaded = 0;
connect(flow, SIGNAL(centerIndexChanged(int)), this, SLOT(preload()));
connect(flow, SIGNAL(centerIndexChangedSilent(int)), this, SLOT(preload()));
ready = true;
worker->reset();
@ -244,7 +243,7 @@ PageLoader::~PageLoader()
bool PageLoader::busy() const
{
return isRunning() ? working : false;
return isRunning() ? working.load() : false;
}
void PageLoader::generate(int index, QSize size, const QByteArray &rImage)
@ -283,8 +282,8 @@ void PageLoader::run()
mutex->unlock();
mutex->lock();
this->working = false;
this->img = image;
this->working = false;
mutex->unlock();
// put to sleep

View File

@ -9,6 +9,8 @@
#include <QWaitCondition>
#include <QMutex>
#include <atomic>
class QLineEdit;
class QPushButton;
class QPixmap;
@ -89,7 +91,7 @@ private:
QWaitCondition condition;
bool restart;
bool working;
std::atomic<bool> working;
int idx;
QSize size;