added the animation for file check/hashing to statusbar

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3716 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2010-10-29 12:50:33 +00:00
parent 417b167d43
commit ad34df9ac5
4 changed files with 18 additions and 8 deletions

View File

@ -23,7 +23,6 @@
#include <QTreeView> #include <QTreeView>
#include <QClipboard> #include <QClipboard>
#include <QMenu> #include <QMenu>
#include <QMovie>
#include <QProcess> #include <QProcess>
#include <QSortFilterProxyModel> #include <QSortFilterProxyModel>
@ -257,14 +256,10 @@ void SharedFilesDialog::checkUpdate()
if (rsFiles->InDirectoryCheck()) if (rsFiles->InDirectoryCheck())
{ {
ui.checkButton->setText(tr("Checking...")); ui.checkButton->setText(tr("Checking..."));
QMovie *movie = new QMovie(":/images/loader/16-loader.gif");
ui.hashLabel->setMovie(movie);
movie->start();
movie->setSpeed(100); // 2x speed
} }
else else
{ {
ui.checkButton->setText(tr("Check files")); ui.checkButton->setText(tr("Check files"));
ui.hashLabel->setPixmap(QPixmap(IMAGE_HASH_DONE)); ui.hashLabel->setPixmap(QPixmap(IMAGE_HASH_DONE));
ui.hashLabel->setToolTip("") ; ui.hashLabel->setToolTip("") ;
} }

View File

@ -116,7 +116,6 @@ private:
QAction* copylinklocalhtmlAct; QAction* copylinklocalhtmlAct;
QTreeView *shareddirtreeview; QTreeView *shareddirtreeview;
QMovie *movie;
/** Qt Designer generated object */ /** Qt Designer generated object */
Ui::SharedFilesDialog ui; Ui::SharedFilesDialog ui;

View File

@ -21,6 +21,7 @@
#include <QLayout> #include <QLayout>
#include <QLabel> #include <QLabel>
#include <QMovie>
#include "hashingstatus.h" #include "hashingstatus.h"
@ -52,6 +53,9 @@ HashingStatus::HashingStatus(QWidget *parent)
QHBoxLayout *hbox = new QHBoxLayout(this); QHBoxLayout *hbox = new QHBoxLayout(this);
hbox->setMargin(0); hbox->setMargin(0);
hbox->setSpacing(6); hbox->setSpacing(6);
hashloader = new QLabel(this);
hbox->addWidget(hashloader);
statusHashing = new StatusLabel(hbox, this); statusHashing = new StatusLabel(hbox, this);
hbox->addWidget(statusHashing); hbox->addWidget(statusHashing);
@ -61,17 +65,27 @@ HashingStatus::HashingStatus(QWidget *parent)
setLayout(hbox); setLayout(hbox);
hashloader->hide();
statusHashing->hide(); statusHashing->hide();
connect(NotifyQt::getInstance(), SIGNAL(hashingInfoChanged(const QString&)), SLOT(updateHashingInfo(const QString&))); connect(NotifyQt::getInstance(), SIGNAL(hashingInfoChanged(const QString&)), SLOT(updateHashingInfo(const QString&)));
} }
void HashingStatus::updateHashingInfo(const QString& s) void HashingStatus::updateHashingInfo(const QString& s)
{ {
QMovie *movie = new QMovie(":/images/loader/16-loader.gif");
if(s.isEmpty()) { if(s.isEmpty()) {
statusHashing->hide() ; statusHashing->hide() ;
hashloader->hide() ;
} else { } else {
statusHashing->setText(s); statusHashing->setText(s);
statusHashing->show(); statusHashing->show();
hashloader->show() ;
hashloader->setMovie(movie);
movie->start();
movie->setSpeed(80); // 2x speed
} }
} }

View File

@ -36,7 +36,9 @@ public slots:
void updateHashingInfo(const QString&) ; void updateHashingInfo(const QString&) ;
private: private:
QLabel *statusHashing; QLabel *statusHashing, *hashloader;
QMovie *movie;
}; };
#endif #endif