added new source statusbar folder

added for show each vote with the correct icon in Link Cloud


git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@608 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2008-06-15 15:34:56 +00:00
parent 4c8114d93d
commit ad5694c8e5
6 changed files with 155 additions and 4 deletions

View File

@ -135,6 +135,7 @@ HEADERS += rshare.h \
gui/Settings/DirectoriesPage.h \ gui/Settings/DirectoriesPage.h \
gui/Settings/ServerPage.h \ gui/Settings/ServerPage.h \
gui/Settings/NetworkPage.h \ gui/Settings/NetworkPage.h \
gui/statusbar/peerstatus.h \
gui/authdlg/AuthorizationDialog.h \ gui/authdlg/AuthorizationDialog.h \
gui/advsearch/advancedsearchdialog.h \ gui/advsearch/advancedsearchdialog.h \
gui/advsearch/expressionwidget.h \ gui/advsearch/expressionwidget.h \
@ -294,6 +295,7 @@ SOURCES += main.cpp \
gui/Settings/DirectoriesPage.cpp \ gui/Settings/DirectoriesPage.cpp \
gui/Settings/ServerPage.cpp \ gui/Settings/ServerPage.cpp \
gui/Settings/NetworkPage.cpp \ gui/Settings/NetworkPage.cpp \
gui/statusbar/peerstatus.cpp \
gui/toaster/ChatToaster.cpp \ gui/toaster/ChatToaster.cpp \
gui/toaster/MessageToaster.cpp \ gui/toaster/MessageToaster.cpp \
gui/toaster/CallToaster.cpp \ gui/toaster/CallToaster.cpp \

View File

@ -396,26 +396,31 @@ void LinksDialog::updateLinks()
if (cit->score > 1) if (cit->score > 1)
{ {
peerScore = "[+2] "; peerScore = "[+2] ";
child -> setIcon(0,(QIcon(IMAGE_GREAT)));
//peerScore = "[+2 Great Link] "; //peerScore = "[+2 Great Link] ";
} }
else if (cit->score == 1) else if (cit->score == 1)
{ {
peerScore = "[+1] "; peerScore = "[+1] ";
child -> setIcon(0,(QIcon(IMAGE_GOOD)));
//peerScore = "[+1 Good] "; //peerScore = "[+1 Good] ";
} }
else if (cit->score == 0) else if (cit->score == 0)
{ {
peerScore = "[+0] "; peerScore = "[+0] ";
child -> setIcon(0,(QIcon(IMAGE_OK)));
//peerScore = "[+0 Okay] "; //peerScore = "[+0 Okay] ";
} }
else if (cit->score == -1) else if (cit->score == -1)
{ {
peerScore = "[-1] "; peerScore = "[-1] ";
child -> setIcon(0,(QIcon(IMAGE_SUX)));
//peerScore = "[-1 Not Worth It] "; //peerScore = "[-1 Not Worth It] ";
} }
else //if (cit->score < -1) else //if (cit->score < -1)
{ {
peerScore = "[-2 BAD] "; peerScore = "[-2 BAD] ";
child -> setIcon(0,(QIcon(IMAGE_BADLINK)));
//peerScore = "[-2 BAD Link] "; //peerScore = "[-2 BAD Link] ";
} }

View File

@ -40,6 +40,7 @@
#include "games/qbackgammon/bgwindow.h" #include "games/qbackgammon/bgwindow.h"
#include "smplayer.h" #include "smplayer.h"
#include "statusbar/peerstatus.h"
#include "Preferences/PreferencesWindow.h" #include "Preferences/PreferencesWindow.h"
#include "Settings/gsettingswin.h" #include "Settings/gsettingswin.h"
#include "util/rsversion.h" #include "util/rsversion.h"
@ -213,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
@ -257,9 +258,9 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
ui.toolBarservice->addSeparator(); ui.toolBarservice->addSeparator();
#endif #endif
//peerstatus = new 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")));
//statusPeers->setPixmap(QPixmap::QPixmap(":/images/.png"));
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")));
@ -352,6 +353,11 @@ void MainWindow::updateStatus()
} }
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)

View File

@ -116,6 +116,7 @@ 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();
@ -193,6 +194,8 @@ private:
QLabel *statusRates; QLabel *statusRates;
QLabel *statusPeers; QLabel *statusPeers;
class PeerStatus *peerstatus;
/** Qt Designer generated object */ /** Qt Designer generated object */
Ui::MainWindow ui; Ui::MainWindow ui;
}; };

View File

@ -0,0 +1,90 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 RetroShare Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include "peerstatus.h"
#include <QtGui>
#include <QString>
#include <QLayout>
#include <QLabel>
#include <QIcon>
#include <QPainter>
#include <QPixmap>
#include "rsiface/rsiface.h"
#include "rsiface/rspeers.h"
#include <sstream>
#include <iomanip>
PeerStatus::PeerStatus(QWidget *parent)
: QWidget(parent)
{
QHBoxLayout *hbox = new QHBoxLayout();
hbox->setMargin(0);
hbox->setSpacing(6);
iconLabel = new QLabel( this );
iconLabel->setPixmap(QPixmap::QPixmap(":/images/user.png"));
// iconLabel doesn't change over time, so we didn't need a minimum size
hbox->addWidget(iconLabel);
statusPeers = new QLabel( tr("Online: 0 |Friends: 0|Network: 0"), this );
//statusPeers->setMinimumSize( statusPeers->frameSize().width() + 0, 0 );
hbox->addWidget(statusPeers);
setLayout( hbox );
QTimer *timer2 = new QTimer(this);
timer2->connect(timer2, SIGNAL(timeout()), this, SLOT(setPeerStatus()));
timer2->start(5113);
}
PeerStatus::~PeerStatus()
{
}
void PeerStatus::setPeerStatus()
{
/* set users/friends/network */
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 << " ";
if (statusPeers)
statusPeers -> setText(QString::fromStdString(out2.str()));
}

View File

@ -0,0 +1,45 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 RetroShare Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef PEERSTATUS_H
#define PEERSTATUS_H
#include "gui/MainWindow.h"
#include <QWidget>
class PeerStatus : public QWidget
{
Q_OBJECT
public:
PeerStatus(QWidget *parent = 0);
~PeerStatus();
void setPeerStatus( );
private:
class QLabel *iconLabel, *statusPeers;
};
#endif