mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
added a callback in MainWindow.cpp to display info about hashed files.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@910 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
6d6901e6e9
commit
4ee6f4847f
@ -112,6 +112,23 @@
|
||||
|
||||
#define RS_RELEASE_VERSION 1
|
||||
|
||||
// This static function is a callback passed to the file hashing thread. As it is called
|
||||
// from a separate thread without locks, it should not perturbate the interface. That's why
|
||||
// I'm only using show()/hide() and setText() instead of add/remove widgets.
|
||||
//
|
||||
static QLabel *hash_info_label = NULL ;
|
||||
static void displayHashingInfo(const std::string& s)
|
||||
{
|
||||
if(hash_info_label != NULL)
|
||||
if(s == "")
|
||||
hash_info_label->hide() ;
|
||||
else
|
||||
{
|
||||
hash_info_label->show() ;
|
||||
hash_info_label->setText(QString::fromStdString(s)) ;
|
||||
}
|
||||
}
|
||||
|
||||
/** Constructor */
|
||||
MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||
: RWindow("MainWindow", parent, flags)
|
||||
@ -309,8 +326,12 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||
#endif
|
||||
peerstatus = new PeerStatus();
|
||||
statusBar()->addWidget(peerstatus);
|
||||
statusBar()->addPermanentWidget(statusRates = new QLabel(tr("<strong>Down:</strong> 0.00 (kB/s) | <strong>Up:</strong> 0.00 (kB/s) ")));
|
||||
|
||||
hash_info_label = new QLabel("") ;
|
||||
statusBar()->addPermanentWidget(hash_info_label);
|
||||
hash_info_label->hide() ;
|
||||
|
||||
statusBar()->addPermanentWidget(statusRates = new QLabel(tr("<strong>Down:</strong> 0.00 (kB/s) | <strong>Up:</strong> 0.00 (kB/s) ")));
|
||||
|
||||
//servicegrp->actions()[0]->setChecked(true);
|
||||
|
||||
@ -365,6 +386,10 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||
timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateStatus()));
|
||||
timer->start(5113);
|
||||
|
||||
// Here we're setting the callback responsible for displaying what's happening to
|
||||
// file hashing.
|
||||
//
|
||||
rsFiles->setFileHashingCallback(displayHashingInfo) ;
|
||||
}
|
||||
|
||||
void MainWindow::updateStatus()
|
||||
@ -386,7 +411,6 @@ void MainWindow::updateStatus()
|
||||
|
||||
}
|
||||
|
||||
|
||||
/** Creates a new action associated with a config page. */
|
||||
QAction* MainWindow::createPageAction(QIcon img, QString text, QActionGroup *group)
|
||||
{
|
||||
|
@ -139,6 +139,9 @@ virtual int SearchBoolExp(Expression * exp, std::list<FileDetail> &results) = 0;
|
||||
virtual bool ConvertSharedFilePath(std::string path, std::string &fullpath) = 0;
|
||||
virtual void ForceDirectoryCheck() = 0;
|
||||
virtual bool InDirectoryCheck() = 0;
|
||||
virtual void setFileHashingCallback( void(*cb)(const std::string&)) = 0;
|
||||
|
||||
|
||||
|
||||
/***
|
||||
* Directory Control
|
||||
|
Loading…
Reference in New Issue
Block a user