diff --git a/retroshare-gui/src/gui/NetworkDialog.cpp b/retroshare-gui/src/gui/NetworkDialog.cpp index 3c6fef87a..9a92bf3a2 100644 --- a/retroshare-gui/src/gui/NetworkDialog.cpp +++ b/retroshare-gui/src/gui/NetworkDialog.cpp @@ -23,7 +23,8 @@ #include #include "rshare.h" -#include "common/vmessagebox.h" +#include "common/vmessagebox.h" +#include "util/rsversion.h" #include "NetworkDialog.h" #include "NetworkView.h" #include "connect/ConnectDialog.h" @@ -32,7 +33,7 @@ #include "rsiface/rspeers.h" #include - +#include #include #include #include @@ -63,6 +64,8 @@ NetworkDialog::NetworkDialog(QWidget *parent) /* create a single connect dialog */ connectdialog = new ConnectDialog(); + connect(ui.infoLog, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayInfoLogMenu(const QPoint&))); + /* hide the Tree +/- */ ui.connecttreeWidget -> setRootIsDecorated( false ); @@ -98,6 +101,11 @@ NetworkDialog::NetworkDialog(QWidget *parent) layout->setSpacing( 0 ); layout->setMargin( 0 ); + // Set Log infos + setLogInfo(tr("RetroShare %1 started.", "e.g: RetroShare v0.x started.").arg(retroshareVersion())); + + setLogInfo(tr("Welcome to RetroShare."), QString::fromUtf8("blue")); + /* Hide platform specific features */ #ifdef Q_WS_WIN @@ -442,3 +450,26 @@ void NetworkDialog::authneighbour() */ } +// Update Log Info information +void NetworkDialog::setLogInfo(QString info, QColor color) { + static unsigned int nbLines = 0; + ++nbLines; + // Check log size, clear it if too big + if(nbLines > 200) { + ui.infoLog->clear(); + nbLines = 1; + } + ui.infoLog->append(QString::fromUtf8("")+ QTime::currentTime().toString(QString::fromUtf8("hh:mm:ss")) + QString::fromUtf8(" - ") + info + QString::fromUtf8("")); +} + +void NetworkDialog::on_actionClearLog_triggered() { + ui.infoLog->clear(); +} + +void NetworkDialog::displayInfoLogMenu(const QPoint& pos) { + // Log Menu + QMenu myLogMenu(this); + myLogMenu.addAction(ui.actionClearLog); + // XXX: Why mapToGlobal() is not enough? + myLogMenu.exec(mapToGlobal(pos)+QPoint(20,450)); +} \ No newline at end of file diff --git a/retroshare-gui/src/gui/NetworkDialog.h b/retroshare-gui/src/gui/NetworkDialog.h index 4d7fd6d2e..421e4474f 100644 --- a/retroshare-gui/src/gui/NetworkDialog.h +++ b/retroshare-gui/src/gui/NetworkDialog.h @@ -48,6 +48,8 @@ public: public slots: std::string loadneighbour(); /* void loadneighbour(); */ + void setLogInfo(QString info, QColor color=QApplication::palette().color(QPalette::WindowText)); + private slots: @@ -62,6 +64,9 @@ private slots: void authneighbour(); void addneighbour(); + + void on_actionClearLog_triggered(); + void displayInfoLogMenu(const QPoint& pos); private: diff --git a/retroshare-gui/src/gui/NetworkDialog.ui b/retroshare-gui/src/gui/NetworkDialog.ui index 07a070911..1e9a00eca 100644 --- a/retroshare-gui/src/gui/NetworkDialog.ui +++ b/retroshare-gui/src/gui/NetworkDialog.ui @@ -5,8 +5,8 @@ 0 0 - 619 - 443 + 582 + 444 @@ -50,9 +50,6 @@ 0 - - 6 - 0 @@ -208,6 +205,63 @@ p, li { white-space: pre-wrap; } + + + + + 16777215 + 142 + + + + QTabWidget::North + + + 0 + + + + Log + + + + 6 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 16777215 + 142 + + + + Qt::CustomContextMenu + + + + + + + @@ -218,6 +272,11 @@ p, li { white-space: pre-wrap; } + + + Clear + + diff --git a/retroshare-gui/src/gui/NetworkView.cpp b/retroshare-gui/src/gui/NetworkView.cpp index ae1d94157..d43a5d87c 100644 --- a/retroshare-gui/src/gui/NetworkView.cpp +++ b/retroshare-gui/src/gui/NetworkView.cpp @@ -41,7 +41,11 @@ NetworkView::NetworkView(QWidget *parent) /* add button */ connect( ui.refreshButton, SIGNAL( clicked( void ) ), this, SLOT( insertPeers( void ) ) ); -// connect( mScene, SIGNAL( changed ( const QList & ) ), this, SLOT ( changedScene( void ) ) ); +//connect( mScene, SIGNAL( changed ( const QList & ) ), this, SLOT ( changedScene( void ) ) ); + + /* Hide Settings frame */ + shownwSettingsFrame(false); + connect( ui.nviewsettingsButton, SIGNAL(toggled(bool)), this, SLOT(shownwSettingsFrame(bool))); /* hide the Tree +/- */ @@ -233,4 +237,19 @@ void NetworkView::changedScene() { } +/** +Toggles the Settings pane on and off, changes toggle button text + */ +void NetworkView::shownwSettingsFrame(bool show) +{ + if (show) { + ui.viewsettingsframe->setVisible(true); + ui.nviewsettingsButton->setChecked(true); + ui.nviewsettingsButton->setToolTip(tr("Hide Settings")); + } else { + ui.viewsettingsframe->setVisible(false); + ui.nviewsettingsButton->setChecked(false); + ui.nviewsettingsButton->setToolTip(tr("Show Settings")); + } +} diff --git a/retroshare-gui/src/gui/NetworkView.h b/retroshare-gui/src/gui/NetworkView.h index 4c0bc944c..7acbca16b 100644 --- a/retroshare-gui/src/gui/NetworkView.h +++ b/retroshare-gui/src/gui/NetworkView.h @@ -50,6 +50,9 @@ void changedFoFCheckBox( ); void changedDrawSignatures( ); void changedDrawFriends( ); +/** Called when Settings button is toggled */ +void shownwSettingsFrame(bool show); + private: void clearPeerItems(); diff --git a/retroshare-gui/src/gui/NetworkView.ui b/retroshare-gui/src/gui/NetworkView.ui index ce4371818..1ad4d2c65 100644 --- a/retroshare-gui/src/gui/NetworkView.ui +++ b/retroshare-gui/src/gui/NetworkView.ui @@ -5,8 +5,8 @@ 0 0 - 603 - 418 + 493 + 373 @@ -25,62 +25,25 @@ 0 + + 6 + - 0 + 2 - - - - - - 20 - 16 - - - - - - - :/images/network16.png - - - - - - - - 50 - false - - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><span style=" font-size:9pt; font-weight:600;">Network View</span></p></body></html> - - - - - - - - - Qt::Horizontal + + + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, + stop:0 lightgray, stop:1 darkgray); + + + + - - - 311 - 20 - - - + - - - - + @@ -96,39 +59,103 @@ p, li { white-space: pre-wrap; } - 31 - 20 + 391 + 23 - - - - - Show Friends of Friends - - - - - - - Connect Signature - - - - - - - Draw Friend Connections - - - - + + + Settings + + + true + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 9 + + + 9 + + + 9 + + + 9 + + + + + + + Show Friends of Friends + + + + + + + Connect Signature + + + + + + + + + + + Draw Friend Connections + + + + + + + Qt::Horizontal + + + + 141 + 20 + + + + + + + + + + Qt::Horizontal + + + + 161 + 41 + + + + + + +