mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-09-27 20:01:21 -04:00
fixed hashing status
This commit is contained in:
parent
bfcfa2293b
commit
af36a0b6d9
1 changed files with 30 additions and 5 deletions
|
@ -31,6 +31,8 @@
|
||||||
#include "gui/notifyqt.h"
|
#include "gui/notifyqt.h"
|
||||||
#include "gui/common/FilesDefs.h"
|
#include "gui/common/FilesDefs.h"
|
||||||
|
|
||||||
|
//#define DEBUG_HASHING_STATUS 1
|
||||||
|
|
||||||
HashingStatus::HashingStatus(QWidget *parent)
|
HashingStatus::HashingStatus(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
|
@ -61,25 +63,32 @@ HashingStatus::HashingStatus(QWidget *parent)
|
||||||
|
|
||||||
void HashingStatus::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
|
void HashingStatus::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
|
||||||
{
|
{
|
||||||
// Warning: no GUI calls should happen here!
|
|
||||||
|
|
||||||
if(event->mType != RsEventType::SHARED_DIRECTORIES)
|
if(event->mType != RsEventType::SHARED_DIRECTORIES)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const RsSharedDirectoriesEvent *fe = dynamic_cast<const RsSharedDirectoriesEvent*>(event.get());
|
const RsSharedDirectoriesEvent *fe = dynamic_cast<const RsSharedDirectoriesEvent*>(event.get());
|
||||||
|
|
||||||
if(!fe)
|
if(!fe)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::cerr << "HashStatusEventHandler: received event " << (void*)fe->mEventCode << std::endl;
|
|
||||||
|
|
||||||
switch (fe->mEventCode)
|
switch (fe->mEventCode)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
|
break;
|
||||||
|
|
||||||
case RsSharedDirectoriesEventCode::HASHING_PROCESS_RESUMED:
|
case RsSharedDirectoriesEventCode::HASHING_PROCESS_RESUMED:
|
||||||
statusHashing->setText(mLastText); // fallthrough
|
statusHashing->setText(mLastText); // fallthrough
|
||||||
|
#ifdef DEBUG_HASHING_STATUS
|
||||||
|
std::cerr << "HashStatusEventHandler: received event " << (void*)fe->mEventCode << ": " ;
|
||||||
|
std::cerr << "HASHING RESUMED" << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
case RsSharedDirectoriesEventCode::HASHING_PROCESS_STARTED:
|
case RsSharedDirectoriesEventCode::HASHING_PROCESS_STARTED:
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_HASHING_STATUS
|
||||||
|
std::cerr << "HashStatusEventHandler: received event " << (void*)fe->mEventCode << ": " ;
|
||||||
|
std::cerr << "HASHING STARTED" << std::endl;
|
||||||
|
#endif
|
||||||
hashloader->show() ;
|
hashloader->show() ;
|
||||||
hashloader->setMovie(movie) ;
|
hashloader->setMovie(movie) ;
|
||||||
movie->start() ;
|
movie->start() ;
|
||||||
|
@ -90,6 +99,10 @@ void HashingStatus::handleEvent_main_thread(std::shared_ptr<const RsEvent> event
|
||||||
|
|
||||||
case RsSharedDirectoriesEventCode::HASHING_PROCESS_PAUSED:
|
case RsSharedDirectoriesEventCode::HASHING_PROCESS_PAUSED:
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_HASHING_STATUS
|
||||||
|
std::cerr << "HashStatusEventHandler: received event " << (void*)fe->mEventCode << ": " ;
|
||||||
|
std::cerr << "HASHING PAUSED" << std::endl;
|
||||||
|
#endif
|
||||||
movie->stop() ;
|
movie->stop() ;
|
||||||
hashloader->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":/images/resume.png")) ;
|
hashloader->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":/images/resume.png")) ;
|
||||||
|
|
||||||
|
@ -101,6 +114,10 @@ void HashingStatus::handleEvent_main_thread(std::shared_ptr<const RsEvent> event
|
||||||
|
|
||||||
case RsSharedDirectoriesEventCode::HASHING_PROCESS_FINISHED:
|
case RsSharedDirectoriesEventCode::HASHING_PROCESS_FINISHED:
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_HASHING_STATUS
|
||||||
|
std::cerr << "HashStatusEventHandler: received event " << (void*)fe->mEventCode << ": " ;
|
||||||
|
std::cerr << "HASHING FINISHED" << std::endl;
|
||||||
|
#endif
|
||||||
movie->stop() ;
|
movie->stop() ;
|
||||||
statusHashing->setText(QString());
|
statusHashing->setText(QString());
|
||||||
statusHashing->hide() ;
|
statusHashing->hide() ;
|
||||||
|
@ -120,11 +137,19 @@ void HashingStatus::handleEvent_main_thread(std::shared_ptr<const RsEvent> event
|
||||||
|
|
||||||
statusHashing->setText(tr("Hashing file") + " " + msg);
|
statusHashing->setText(tr("Hashing file") + " " + msg);
|
||||||
setToolTip(msg + "\n"+QObject::tr("Click to pause the hashing process"));
|
setToolTip(msg + "\n"+QObject::tr("Click to pause the hashing process"));
|
||||||
|
#ifdef DEBUG_HASHING_STATUS
|
||||||
|
std::cerr << "HashStatusEventHandler: received event " << (void*)fe->mEventCode << ": " ;
|
||||||
|
std::cerr << "HASHING FILE " << msg.toStdString() << std::endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RsSharedDirectoriesEventCode::SAVING_FILE_INDEX:
|
case RsSharedDirectoriesEventCode::SAVING_FILE_INDEX:
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_HASHING_STATUS
|
||||||
|
std::cerr << "HashStatusEventHandler: received event " << (void*)fe->mEventCode << ": " ;
|
||||||
|
std::cerr << "SAVING FILE INDEX" << std::endl;
|
||||||
|
#endif
|
||||||
statusHashing->setText(tr("Saving file index..."));
|
statusHashing->setText(tr("Saving file index..."));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue