mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-24 23:19:29 -05:00
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:
parent
4c8114d93d
commit
ad5694c8e5
@ -135,6 +135,7 @@ HEADERS += rshare.h \
|
||||
gui/Settings/DirectoriesPage.h \
|
||||
gui/Settings/ServerPage.h \
|
||||
gui/Settings/NetworkPage.h \
|
||||
gui/statusbar/peerstatus.h \
|
||||
gui/authdlg/AuthorizationDialog.h \
|
||||
gui/advsearch/advancedsearchdialog.h \
|
||||
gui/advsearch/expressionwidget.h \
|
||||
@ -293,7 +294,8 @@ SOURCES += main.cpp \
|
||||
gui/Settings/GeneralPage.cpp \
|
||||
gui/Settings/DirectoriesPage.cpp \
|
||||
gui/Settings/ServerPage.cpp \
|
||||
gui/Settings/NetworkPage.cpp \
|
||||
gui/Settings/NetworkPage.cpp \
|
||||
gui/statusbar/peerstatus.cpp \
|
||||
gui/toaster/ChatToaster.cpp \
|
||||
gui/toaster/MessageToaster.cpp \
|
||||
gui/toaster/CallToaster.cpp \
|
||||
|
@ -396,26 +396,31 @@ void LinksDialog::updateLinks()
|
||||
if (cit->score > 1)
|
||||
{
|
||||
peerScore = "[+2] ";
|
||||
child -> setIcon(0,(QIcon(IMAGE_GREAT)));
|
||||
//peerScore = "[+2 Great Link] ";
|
||||
}
|
||||
else if (cit->score == 1)
|
||||
{
|
||||
peerScore = "[+1] ";
|
||||
child -> setIcon(0,(QIcon(IMAGE_GOOD)));
|
||||
//peerScore = "[+1 Good] ";
|
||||
}
|
||||
else if (cit->score == 0)
|
||||
{
|
||||
peerScore = "[+0] ";
|
||||
child -> setIcon(0,(QIcon(IMAGE_OK)));
|
||||
//peerScore = "[+0 Okay] ";
|
||||
}
|
||||
else if (cit->score == -1)
|
||||
{
|
||||
peerScore = "[-1] ";
|
||||
child -> setIcon(0,(QIcon(IMAGE_SUX)));
|
||||
//peerScore = "[-1 Not Worth It] ";
|
||||
}
|
||||
else //if (cit->score < -1)
|
||||
{
|
||||
peerScore = "[-2 BAD] ";
|
||||
child -> setIcon(0,(QIcon(IMAGE_BADLINK)));
|
||||
//peerScore = "[-2 BAD Link] ";
|
||||
}
|
||||
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "games/qbackgammon/bgwindow.h"
|
||||
#include "smplayer.h"
|
||||
|
||||
#include "statusbar/peerstatus.h"
|
||||
#include "Preferences/PreferencesWindow.h"
|
||||
#include "Settings/gsettingswin.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 )));
|
||||
|
||||
#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
|
||||
@ -257,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")));
|
||||
//statusPeers->setPixmap(QPixmap::QPixmap(":/images/.png"));
|
||||
statusBar()->addPermanentWidget(statusRates = new QLabel(tr("Down: 0.0 | Up: 0.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. */
|
||||
QAction* MainWindow::createPageAction(QIcon img, QString text, QActionGroup *group)
|
||||
|
@ -116,6 +116,7 @@ private slots:
|
||||
|
||||
void updateMenu();
|
||||
void updateStatus();
|
||||
void peerstat();
|
||||
|
||||
void toggleVisibility(QSystemTrayIcon::ActivationReason e);
|
||||
void toggleVisibilitycontextmenu();
|
||||
@ -192,6 +193,8 @@ private:
|
||||
|
||||
QLabel *statusRates;
|
||||
QLabel *statusPeers;
|
||||
|
||||
class PeerStatus *peerstatus;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::MainWindow ui;
|
||||
|
90
retroshare-gui/src/gui/statusbar/peerstatus.cpp
Normal file
90
retroshare-gui/src/gui/statusbar/peerstatus.cpp
Normal 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()));
|
||||
|
||||
}
|
||||
|
||||
|
45
retroshare-gui/src/gui/statusbar/peerstatus.h
Normal file
45
retroshare-gui/src/gui/statusbar/peerstatus.h
Normal 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
|
Loading…
Reference in New Issue
Block a user