added pause to file hashing

This commit is contained in:
csoler 2017-09-10 22:07:36 +02:00
parent ea25d4b5a4
commit eff5c5d6ee
11 changed files with 95 additions and 2 deletions

View file

@ -22,7 +22,9 @@
#include <QLayout>
#include <QLabel>
#include <QMovie>
#include <QToolButton>
#include "retroshare/rsfiles.h"
#include "hashingstatus.h"
#include "gui/common/ElidedLabel.h"
#include "gui/notifyqt.h"
@ -61,13 +63,14 @@ HashingStatus::~HashingStatus()
void HashingStatus::updateHashingInfo(const QString& s)
{
if (s.isEmpty()) {
if (s.isEmpty())
{
statusHashing->hide() ;
hashloader->hide() ;
movie->stop() ;
} else {
hashloader->setToolTip(s) ;
setToolTip(s + "\n"+QObject::tr("Click to pause the hashing process"));
if (_compactMode) {
statusHashing->hide() ;
@ -80,3 +83,24 @@ void HashingStatus::updateHashingInfo(const QString& s)
movie->start() ;
}
}
void HashingStatus::mousePressEvent(QMouseEvent *)
{
rsFiles->togglePauseHashingProcess() ;
if(rsFiles->hashingProcessPaused())
{
movie->stop() ;
hashloader->setPixmap(QPixmap(":/images/resume.png")) ;
mLastText = statusHashing->text();
statusHashing->setText(QObject::tr("[Hashing is paused]"));
setToolTip(QObject::tr("Click to resume the hashing process"));
}
else
{
hashloader->setMovie(movie) ;
statusHashing->setText(mLastText);
movie->start() ;
}
}

View file

@ -35,6 +35,7 @@ public:
~HashingStatus();
void setCompactMode(bool compact) {_compactMode = compact; }
void mousePressEvent(QMouseEvent *);
public slots:
void updateHashingInfo(const QString&) ;
@ -42,6 +43,7 @@ public slots:
private:
ElidedLabel *statusHashing;
QLabel *hashloader;
QString mLastText ;
QMovie *movie;
bool _compactMode;
};