added for Network View Settings QFrame to can Hide/Show the settings

added a Log Tab in Network


git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@398 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2008-03-21 23:31:00 +00:00
parent 247e583a35
commit 4c40d7beff
6 changed files with 230 additions and 86 deletions

View File

@ -23,7 +23,8 @@
#include <QFileInfo>
#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 <sstream>
#include <QTime>
#include <QContextMenuEvent>
#include <QMenu>
#include <QCursor>
@ -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("<font color='grey'>")+ QTime::currentTime().toString(QString::fromUtf8("hh:mm:ss")) + QString::fromUtf8("</font> - <font color='") + color.name() +QString::fromUtf8("'><i>") + info + QString::fromUtf8("</i></font>"));
}
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));
}

View File

@ -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:

View File

@ -5,8 +5,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>619</width>
<height>443</height>
<width>582</width>
<height>444</height>
</rect>
</property>
<property name="windowTitle" >
@ -50,9 +50,6 @@
<property name="bottomMargin" >
<number>0</number>
</property>
<property name="horizontalSpacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<number>0</number>
</property>
@ -208,6 +205,63 @@ p, li { white-space: pre-wrap; }
</column>
</widget>
</item>
<item row="2" column="0" >
<widget class="QTabWidget" name="tabBottom" >
<property name="maximumSize" >
<size>
<width>16777215</width>
<height>142</height>
</size>
</property>
<property name="tabPosition" >
<enum>QTabWidget::North</enum>
</property>
<property name="currentIndex" >
<number>0</number>
</property>
<widget class="QWidget" name="log_tab" >
<attribute name="title" >
<string>Log</string>
</attribute>
<layout class="QVBoxLayout" >
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item>
<widget class="QTextBrowser" name="infoLog" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize" >
<size>
<width>16777215</width>
<height>142</height>
</size>
</property>
<property name="contextMenuPolicy" >
<enum>Qt::CustomContextMenu</enum>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="networkviewTab" >
@ -218,6 +272,11 @@ p, li { white-space: pre-wrap; }
</widget>
</item>
</layout>
<action name="actionClearLog" >
<property name="text" >
<string>Clear</string>
</property>
</action>
</widget>
<resources/>
<connections/>

View File

@ -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<QRectF> & ) ), this, SLOT ( changedScene( void ) ) );
//connect( mScene, SIGNAL( changed ( const QList<QRectF> & ) ), 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"));
}
}

View File

@ -50,6 +50,9 @@ void changedFoFCheckBox( );
void changedDrawSignatures( );
void changedDrawFriends( );
/** Called when Settings button is toggled */
void shownwSettingsFrame(bool show);
private:
void clearPeerItems();

View File

@ -5,8 +5,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>603</width>
<height>418</height>
<width>493</width>
<height>373</height>
</rect>
</property>
<property name="windowTitle" >
@ -25,62 +25,25 @@
<property name="bottomMargin" >
<number>0</number>
</property>
<property name="horizontalSpacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<number>0</number>
<number>2</number>
</property>
<item row="0" column="0" >
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="networkviewiconlabel" >
<property name="minimumSize" >
<size>
<width>20</width>
<height>16</height>
</size>
</property>
<property name="text" >
<string/>
</property>
<property name="pixmap" >
<pixmap resource="images.qrc" >:/images/network16.png</pixmap>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QLabel" name="label_2" >
<property name="font" >
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text" >
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;">&lt;span style=" font-size:9pt; font-weight:600;">Network View&lt;/span>&lt;/p>&lt;/body>&lt;/html></string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
<widget class="GraphWidget" name="graphicsView" >
<property name="styleSheet" >
<string>background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop:0 lightgray, stop:1 darkgray);
</string>
</property>
<property name="sizeHint" >
<size>
<width>311</width>
<height>20</height>
</size>
</property>
</spacer>
</widget>
</item>
<item row="1" column="0" colspan="2" >
<widget class="GraphWidget" name="graphicsView" />
</item>
<item row="2" column="0" colspan="2" >
<item row="1" column="0" >
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QPushButton" name="refreshButton" >
@ -96,39 +59,103 @@ p, li { white-space: pre-wrap; }
</property>
<property name="sizeHint" >
<size>
<width>31</width>
<height>20</height>
<width>391</width>
<height>23</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2" >
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QCheckBox" name="fofCheckBox" >
<property name="text" >
<string>Show Friends of Friends</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QCheckBox" name="checkBox" >
<property name="text" >
<string>Connect Signature</string>
</property>
</widget>
</item>
<item row="0" column="2" >
<widget class="QCheckBox" name="checkBox_2" >
<property name="text" >
<string>Draw Friend Connections</string>
</property>
</widget>
</item>
</layout>
<widget class="QPushButton" name="nviewsettingsButton" >
<property name="text" >
<string>Settings</string>
</property>
<property name="checkable" >
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0" >
<widget class="QFrame" name="viewsettingsframe" >
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" >
<property name="leftMargin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<item row="0" column="0" >
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QCheckBox" name="fofCheckBox" >
<property name="text" >
<string>Show Friends of Friends</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QCheckBox" name="checkBox" >
<property name="text" >
<string>Connect Signature</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1" >
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QCheckBox" name="checkBox_2" >
<property name="text" >
<string>Draw Friend Connections</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>141</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="0" column="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>161</width>
<height>41</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>