mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-12 07:59:29 -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 )));
|
connect(transfersDialog, SIGNAL(playFiles( QStringList )), this, SLOT(playFiles( QStringList )));
|
||||||
|
|
||||||
#ifdef RS_RELEASE_VERSION
|
#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
|
#else
|
||||||
@ -258,9 +258,9 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
|||||||
ui.toolBarservice->addSeparator();
|
ui.toolBarservice->addSeparator();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
//peerstatus = new PeerStatus();
|
peerstatus = new PeerStatus();
|
||||||
//statusBar()->addWidget(peerstatus);
|
statusBar()->addWidget(peerstatus);
|
||||||
statusBar()->addWidget(statusPeers = new QLabel(tr("Online: 0 |Friends: 0|Network: 0")));
|
//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(statusRates = new QLabel(tr("Down: 0.0 | Up: 0.0 ")));
|
||||||
//statusBar()->addPermanentWidget(statusPeers = new QLabel(tr("Online: 0 |Friends: 0|Network: 0")));
|
//statusBar()->addPermanentWidget(statusPeers = new QLabel(tr("Online: 0 |Friends: 0|Network: 0")));
|
||||||
|
|
||||||
@ -328,36 +328,15 @@ void MainWindow::updateStatus()
|
|||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
out << "Down: " << std::setprecision(2) << std::fixed << downKb << " (kB/s) | Up: " << std::setprecision(2) << std::fixed << upKb << " (kB/s) ";
|
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 */
|
/* set uploads/download rates */
|
||||||
|
|
||||||
if (statusRates)
|
if (statusRates)
|
||||||
statusRates -> setText(QString::fromStdString(out.str()));
|
statusRates -> setText(QString::fromStdString(out.str()));
|
||||||
|
|
||||||
if (statusPeers)
|
if (peerstatus)
|
||||||
statusPeers -> setText(QString::fromStdString(out2.str()));
|
peerstatus->setPeerStatus();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::peerstat()
|
|
||||||
{
|
|
||||||
peerstatus->setPeerStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/** Creates a new action associated with a config page. */
|
/** Creates a new action associated with a config page. */
|
||||||
QAction* MainWindow::createPageAction(QIcon img, QString text, QActionGroup *group)
|
QAction* MainWindow::createPageAction(QIcon img, QString text, QActionGroup *group)
|
||||||
|
@ -56,6 +56,8 @@
|
|||||||
|
|
||||||
class SMPlayer;
|
class SMPlayer;
|
||||||
|
|
||||||
|
class PeerStatus;
|
||||||
|
|
||||||
class MainWindow : public QMainWindow
|
class MainWindow : public QMainWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -116,7 +118,6 @@ private slots:
|
|||||||
|
|
||||||
void updateMenu();
|
void updateMenu();
|
||||||
void updateStatus();
|
void updateStatus();
|
||||||
void peerstat();
|
|
||||||
|
|
||||||
void toggleVisibility(QSystemTrayIcon::ActivationReason e);
|
void toggleVisibility(QSystemTrayIcon::ActivationReason e);
|
||||||
void toggleVisibilitycontextmenu();
|
void toggleVisibilitycontextmenu();
|
||||||
@ -192,9 +193,7 @@ private:
|
|||||||
QMenu *menu;
|
QMenu *menu;
|
||||||
|
|
||||||
QLabel *statusRates;
|
QLabel *statusRates;
|
||||||
QLabel *statusPeers;
|
PeerStatus *peerstatus;
|
||||||
|
|
||||||
class PeerStatus *peerstatus;
|
|
||||||
|
|
||||||
/** Qt Designer generated object */
|
/** Qt Designer generated object */
|
||||||
Ui::MainWindow ui;
|
Ui::MainWindow ui;
|
||||||
|
@ -296,7 +296,8 @@ void MessengerWindow::connectfriend2()
|
|||||||
if (!i)
|
if (!i)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (isOnline)
|
std::string id = (i -> text(4)).toStdString();
|
||||||
|
if (rsPeers->isOnline(id))
|
||||||
{
|
{
|
||||||
std::cerr << "MessengerWindow::connectfriend2() Already online" << std::endl;
|
std::cerr << "MessengerWindow::connectfriend2() Already online" << std::endl;
|
||||||
}
|
}
|
||||||
@ -368,7 +369,7 @@ void MessengerWindow::chatfriend2()
|
|||||||
std::string name = (i -> text(0)).toStdString();
|
std::string name = (i -> text(0)).toStdString();
|
||||||
std::string id = (i -> text(4)).toStdString();
|
std::string id = (i -> text(4)).toStdString();
|
||||||
|
|
||||||
if (!isOnline)
|
if (!(rsPeers->isOnline(id)))
|
||||||
{
|
{
|
||||||
/* info dialog */
|
/* info dialog */
|
||||||
QMessageBox::StandardButton sb = QMessageBox::question ( NULL,
|
QMessageBox::StandardButton sb = QMessageBox::question ( NULL,
|
||||||
|
@ -53,9 +53,6 @@ PeerStatus::PeerStatus(QWidget *parent)
|
|||||||
|
|
||||||
setLayout( hbox );
|
setLayout( hbox );
|
||||||
|
|
||||||
QTimer *timer2 = new QTimer(this);
|
|
||||||
timer2->connect(timer2, SIGNAL(timeout()), this, SLOT(setPeerStatus()));
|
|
||||||
timer2->start(5113);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PeerStatus::~PeerStatus()
|
PeerStatus::~PeerStatus()
|
||||||
@ -79,7 +76,7 @@ void PeerStatus::setPeerStatus()
|
|||||||
int others = 1 + ids.size();
|
int others = 1 + ids.size();
|
||||||
|
|
||||||
std::ostringstream out2;
|
std::ostringstream out2;
|
||||||
out2 << "Online: " << online << "| Friends: " << friends << "| Network: " << others << " ";
|
out2 << "Online: " << online << " | Friends: " << friends << " | Network: " << others << " ";
|
||||||
|
|
||||||
|
|
||||||
if (statusPeers)
|
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 getFriendList(std::list<std::string> &ids) = 0;
|
||||||
virtual bool getOthersList(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 bool isFriend(std::string id) = 0;
|
||||||
virtual std::string getPeerName(std::string id) = 0;
|
virtual std::string getPeerName(std::string id) = 0;
|
||||||
virtual bool getPeerDetails(std::string id, RsPeerDetails &d) = 0;
|
virtual bool getPeerDetails(std::string id, RsPeerDetails &d) = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user