mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-11 23:49:38 -05:00
* Fixed Defnax's Status Bar.
* Fixed 'Offline' bug in MessengerWindow. * Added isOnline function to rspeers interface. * Cleaned up some stuff. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@610 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
1389c617e9
commit
0d6471433c
@ -214,7 +214,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||
connect(transfersDialog, SIGNAL(playFiles( QStringList )), this, SLOT(playFiles( QStringList )));
|
||||
|
||||
#ifdef RS_RELEASE_VERSION
|
||||
addAction(new QAction(QIcon(IMAGE_BLOCK), tr("Unfinished"), ui.toolBar), SLOT(showApplWindow()));
|
||||
//addAction(new QAction(QIcon(IMAGE_BLOCK), tr("Unfinished"), ui.toolBar), SLOT(showApplWindow()));
|
||||
|
||||
|
||||
#else
|
||||
@ -258,9 +258,9 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||
ui.toolBarservice->addSeparator();
|
||||
|
||||
#endif
|
||||
//peerstatus = new PeerStatus();
|
||||
//statusBar()->addWidget(peerstatus);
|
||||
statusBar()->addWidget(statusPeers = new QLabel(tr("Online: 0 |Friends: 0|Network: 0")));
|
||||
peerstatus = new PeerStatus();
|
||||
statusBar()->addWidget(peerstatus);
|
||||
//statusBar()->addWidget(statusPeers = new QLabel(tr("Online: 0 |Friends: 0|Network: 0")));
|
||||
statusBar()->addPermanentWidget(statusRates = new QLabel(tr("Down: 0.0 | Up: 0.0 ")));
|
||||
//statusBar()->addPermanentWidget(statusPeers = new QLabel(tr("Online: 0 |Friends: 0|Network: 0")));
|
||||
|
||||
@ -328,34 +328,13 @@ void MainWindow::updateStatus()
|
||||
std::ostringstream out;
|
||||
out << "Down: " << std::setprecision(2) << std::fixed << downKb << " (kB/s) | Up: " << std::setprecision(2) << std::fixed << upKb << " (kB/s) ";
|
||||
|
||||
std::list<std::string> ids;
|
||||
rsPeers->getOnlineList(ids);
|
||||
int online = ids.size();
|
||||
|
||||
ids.clear();
|
||||
rsPeers->getFriendList(ids);
|
||||
int friends = ids.size();
|
||||
|
||||
ids.clear();
|
||||
rsPeers->getOthersList(ids);
|
||||
int others = 1 + ids.size();
|
||||
|
||||
std::ostringstream out2;
|
||||
out2 << "Online: " << online << "| Friends: " << friends << "| Network: " << others << " ";
|
||||
|
||||
/* set uploads/download rates */
|
||||
|
||||
if (statusRates)
|
||||
statusRates -> setText(QString::fromStdString(out.str()));
|
||||
|
||||
if (statusPeers)
|
||||
statusPeers -> setText(QString::fromStdString(out2.str()));
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::peerstat()
|
||||
{
|
||||
if (peerstatus)
|
||||
peerstatus->setPeerStatus();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -56,6 +56,8 @@
|
||||
|
||||
class SMPlayer;
|
||||
|
||||
class PeerStatus;
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -116,7 +118,6 @@ private slots:
|
||||
|
||||
void updateMenu();
|
||||
void updateStatus();
|
||||
void peerstat();
|
||||
|
||||
void toggleVisibility(QSystemTrayIcon::ActivationReason e);
|
||||
void toggleVisibilitycontextmenu();
|
||||
@ -192,9 +193,7 @@ private:
|
||||
QMenu *menu;
|
||||
|
||||
QLabel *statusRates;
|
||||
QLabel *statusPeers;
|
||||
|
||||
class PeerStatus *peerstatus;
|
||||
PeerStatus *peerstatus;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::MainWindow ui;
|
||||
|
@ -296,7 +296,8 @@ void MessengerWindow::connectfriend2()
|
||||
if (!i)
|
||||
return;
|
||||
|
||||
if (isOnline)
|
||||
std::string id = (i -> text(4)).toStdString();
|
||||
if (rsPeers->isOnline(id))
|
||||
{
|
||||
std::cerr << "MessengerWindow::connectfriend2() Already online" << std::endl;
|
||||
}
|
||||
@ -368,7 +369,7 @@ void MessengerWindow::chatfriend2()
|
||||
std::string name = (i -> text(0)).toStdString();
|
||||
std::string id = (i -> text(4)).toStdString();
|
||||
|
||||
if (!isOnline)
|
||||
if (!(rsPeers->isOnline(id)))
|
||||
{
|
||||
/* info dialog */
|
||||
QMessageBox::StandardButton sb = QMessageBox::question ( NULL,
|
||||
|
@ -53,9 +53,6 @@ PeerStatus::PeerStatus(QWidget *parent)
|
||||
|
||||
setLayout( hbox );
|
||||
|
||||
QTimer *timer2 = new QTimer(this);
|
||||
timer2->connect(timer2, SIGNAL(timeout()), this, SLOT(setPeerStatus()));
|
||||
timer2->start(5113);
|
||||
}
|
||||
|
||||
PeerStatus::~PeerStatus()
|
||||
@ -79,7 +76,7 @@ void PeerStatus::setPeerStatus()
|
||||
int others = 1 + ids.size();
|
||||
|
||||
std::ostringstream out2;
|
||||
out2 << "Online: " << online << "| Friends: " << friends << "| Network: " << others << " ";
|
||||
out2 << "Online: " << online << " | Friends: " << friends << " | Network: " << others << " ";
|
||||
|
||||
|
||||
if (statusPeers)
|
||||
|
@ -125,6 +125,7 @@ virtual bool getOnlineList(std::list<std::string> &ids) = 0;
|
||||
virtual bool getFriendList(std::list<std::string> &ids) = 0;
|
||||
virtual bool getOthersList(std::list<std::string> &ids) = 0;
|
||||
|
||||
virtual bool isOnline(std::string id) = 0;
|
||||
virtual bool isFriend(std::string id) = 0;
|
||||
virtual std::string getPeerName(std::string id) = 0;
|
||||
virtual bool getPeerDetails(std::string id, RsPeerDetails &d) = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user