added rating icons to show on first columns too

update settings with latest changes from Preferences

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1543 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2009-08-17 20:19:02 +00:00
parent 6972bc1cb8
commit 43b6505512
8 changed files with 186 additions and 145 deletions

View File

@ -55,6 +55,7 @@
#define IMAGE_OK ":/images/filerating3.png"
#define IMAGE_SUX ":/images/filerating2.png"
#define IMAGE_BADLINK ":/images/filerating1.png"
#define IMAGE_NOCOMMENTRATING ":/images/filerating0.png"
#define IMAGE_DOWNLOAD ":/images/download16.png"
/******
@ -411,30 +412,35 @@ void LinksDialog::updateLinks()
{
peerScore = "[+2] ";
child -> setIcon(0,(QIcon(IMAGE_GREAT)));
item -> setIcon(0,(QIcon(IMAGE_GREAT)));
//peerScore = "[+2 Great Link] ";
}
else if (cit->score == 1)
{
peerScore = "[+1] ";
child -> setIcon(0,(QIcon(IMAGE_GOOD)));
item -> setIcon(0,(QIcon(IMAGE_GOOD)));
//peerScore = "[+1 Good] ";
}
else if (cit->score == 0)
{
peerScore = "[+0] ";
child -> setIcon(0,(QIcon(IMAGE_OK)));
item -> setIcon(0,(QIcon(IMAGE_OK)));
//peerScore = "[+0 Okay] ";
}
else if (cit->score == -1)
{
peerScore = "[-1] ";
child -> setIcon(0,(QIcon(IMAGE_SUX)));
item -> setIcon(0,(QIcon(IMAGE_SUX)));
//peerScore = "[-1 Not Worth It] ";
}
else //if (cit->score < -1)
{
peerScore = "[-2 BAD] ";
child -> setIcon(0,(QIcon(IMAGE_BADLINK)));
item -> setIcon(0,(QIcon(IMAGE_BADLINK)));
//peerScore = "[-2 BAD Link] ";
}

View File

@ -227,7 +227,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
#endif
#ifdef NEWSETTINGS
addAction(new QAction(QIcon(IMAGE_OPTIONS), tr("Options"), ui.toolBar_2), SLOT(showSettings()));
addAction(new QAction(QIcon(IMAGE_OPTIONS), tr("Options"), ui.toolBar), SLOT(showSettings()));
#endif
/* Select the first action */

View File

@ -20,6 +20,8 @@
****************************************************************/
#include "DirectoriesPage.h"
#include "gui/ShareManager.h"
#include "rshare.h"
#include "rsiface/rsfiles.h"
@ -34,14 +36,16 @@ DirectoriesPage::DirectoriesPage(QWidget * parent, Qt::WFlags flags)
load();
connect(ui.addButton, SIGNAL(clicked( bool ) ), this , SLOT( addShareDirectory() ) );
connect(ui.removeButton, SIGNAL(clicked( bool ) ), this , SLOT( removeShareDirectory() ) );
connect(ui.incomingButton, SIGNAL(clicked( bool ) ), this , SLOT( setIncomingDirectory() ) );
connect(ui.partialButton, SIGNAL(clicked( bool ) ), this , SLOT( setPartialsDirectory() ) );
connect(ui.checkBox, SIGNAL(stateChanged(int)), this, SLOT(shareDownloadDirectory(int)));
connect(ui.editButton, SIGNAL(clicked()), this, SLOT(editDirectories()));
#ifdef TO_REMOVE
ui.addButton->setToolTip(tr("Add a Share Directory"));
ui.removeButton->setToolTip(tr("Remove Shared Directory"));
#endif
ui.incomingButton->setToolTip(tr("Browse"));
ui.partialButton->setToolTip(tr("Browse"));
@ -66,24 +70,34 @@ DirectoriesPage::closeEvent (QCloseEvent * event)
QWidget::closeEvent(event);
}
void DirectoriesPage::editDirectories()
{
ShareManager::showYourself() ;
}
/** Saves the changes on this page */
bool
DirectoriesPage::save(QString &errmsg)
bool DirectoriesPage::save(QString &errmsg)
{
/* this is usefull especially when shared incoming files is
* default option and when the user don't check/uncheck the
* checkBox, so no signal is emitted to update the shared list */
if (ui.checkBox->isChecked())
{
std::list<std::string>::const_iterator it;
std::list<std::string> dirs;
std::list<SharedDirInfo>::const_iterator it;
std::list<SharedDirInfo> dirs;
rsFiles->getSharedDirectories(dirs);
if (dirs.end() == std::find(dirs.begin(), dirs.end(), rsFiles->getDownloadDirectory()))
bool found = false ;
for(std::list<SharedDirInfo>::const_iterator it(dirs.begin());it!=dirs.end();++it)
if((*it).filename == rsFiles->getDownloadDirectory())
{
rsFiles->shareDownloadDirectory();
found=true ;
break ;
}
if(!found)
rsFiles->shareDownloadDirectory();
rsFiles->setShareDownloadDirectory(true);
}
else
@ -93,14 +107,13 @@ DirectoriesPage::save(QString &errmsg)
}
return true;
}
/** Loads the settings for this page */
void DirectoriesPage::load()
{
std::list<std::string>::const_iterator it;
std::list<std::string> dirs;
std::list<SharedDirInfo>::const_iterator it;
std::list<SharedDirInfo> dirs;
rsFiles->getSharedDirectories(dirs);
/* get a link to the table */
@ -112,16 +125,16 @@ void DirectoriesPage::load()
for(it = dirs.begin(); it != dirs.end(); it++)
{
/* (0) Dir Name */
listWidget->addItem(QString::fromStdString(*it));
listWidget->addItem(QString::fromStdString((*it).filename));
}
ui.incomingDir->setText(QString::fromStdString(rsFiles->getDownloadDirectory()));
ui.partialsDir->setText(QString::fromStdString(rsFiles->getPartialsDirectory()));
listWidget->update(); /* update display */
}
#ifdef TO_REMOVE
void DirectoriesPage::addShareDirectory()
{
@ -154,6 +167,7 @@ void DirectoriesPage::removeShareDirectory()
load();
}
}
#endif
void DirectoriesPage::setIncomingDirectory()
{
@ -166,14 +180,19 @@ void DirectoriesPage::setIncomingDirectory()
rsFiles->setDownloadDirectory(dir);
if (ui.checkBox->isChecked())
{
std::list<std::string>::const_iterator it;
std::list<std::string> dirs;
std::list<SharedDirInfo>::const_iterator it;
std::list<SharedDirInfo> dirs;
rsFiles->getSharedDirectories(dirs);
if (dirs.end() == std::find(dirs.begin(), dirs.end(), rsFiles->getDownloadDirectory()))
bool found = false ;
for(std::list<SharedDirInfo>::const_iterator it(dirs.begin());it!=dirs.end();++it)
if((*it).filename == rsFiles->getDownloadDirectory())
{
rsFiles->shareDownloadDirectory();
found=true ;
break ;
}
if(!found)
rsFiles->shareDownloadDirectory();
}
}
load();
@ -196,14 +215,20 @@ void DirectoriesPage::shareDownloadDirectory(int state)
{
if (state == Qt::Checked)
{
std::list<std::string>::const_iterator it;
std::list<std::string> dirs;
std::list<SharedDirInfo>::const_iterator it;
std::list<SharedDirInfo> dirs;
rsFiles->getSharedDirectories(dirs);
if (dirs.end() == std::find(dirs.begin(), dirs.end(), rsFiles->getDownloadDirectory()))
bool found = false ;
for(std::list<SharedDirInfo>::const_iterator it(dirs.begin());it!=dirs.end();++it)
if((*it).filename == rsFiles->getDownloadDirectory())
{
rsFiles->shareDownloadDirectory();
found=true ;
break ;
}
if(!found)
rsFiles->shareDownloadDirectory();
rsFiles->setShareDownloadDirectory(true);
}
else
@ -214,4 +239,3 @@ void DirectoriesPage::shareDownloadDirectory(int state)
load();
}

View File

@ -46,8 +46,12 @@ class DirectoriesPage: public QWidget
private slots:
#ifdef TO_REMOVE
void addShareDirectory();
void removeShareDirectory();
#endif
void editDirectories() ;
void setIncomingDirectory();
void setPartialsDirectory();
void shareDownloadDirectory(int state);

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>452</width>
<height>349</height>
<width>477</width>
<height>439</height>
</rect>
</property>
<property name="sizePolicy">
@ -509,102 +509,6 @@
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Shared Directories</string>
</property>
<layout class="QGridLayout">
<item row="0" column="0" rowspan="3">
<widget class="QListWidget" name="dirList"/>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="addButton">
<property name="minimumSize">
<size>
<width>34</width>
<height>34</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>34</width>
<height>34</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/directoryadd_24x24_shadow.png</normaloff>:/images/directoryadd_24x24_shadow.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="removeButton">
<property name="minimumSize">
<size>
<width>34</width>
<height>34</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>34</width>
<height>34</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/directoryremove_24x24_shadow.png</normaloff>:/images/directoryremove_24x24_shadow.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item row="2" column="1">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>71</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="checkBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Automatically share incoming directory (Recommanded)</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
@ -695,14 +599,44 @@
</layout>
</widget>
</item>
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Shared Directories</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
<widget class="QListWidget" name="dirList"/>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Automatically share incoming directory (Recommanded)</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="editButton">
<property name="text">
<string>Edit Share</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>incomingDir</tabstop>
<tabstop>incomingButton</tabstop>
<tabstop>dirList</tabstop>
<tabstop>addButton</tabstop>
<tabstop>removeButton</tabstop>
</tabstops>
<resources>
<include location="../images.qrc"/>

View File

@ -20,6 +20,8 @@
****************************************************************/
#include "ServerPage.h"
#include <gui/TurtleRouterDialog.h>
#include "rshare.h"
#include <iostream>
@ -38,6 +40,10 @@ ServerPage::ServerPage(QWidget * parent, Qt::WFlags flags)
connect( ui.netModeComboBox, SIGNAL( activated ( int ) ), this, SLOT( toggleUPnP( ) ) );
connect( ui.allowIpDeterminationCB, SIGNAL( toggled( bool ) ), this, SLOT( toggleIpDetermination(bool) ) );
connect( ui._showTurtleDialogPB,SIGNAL(clicked()),this,SLOT( showTurtleRouterDialog() )) ;
ui._enableTurtleCB->setChecked(true) ;
ui._enableTurtleCB->setEnabled(false) ;
QTimer *timer = new QTimer(this);
timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateStatus()));
@ -62,6 +68,11 @@ ServerPage::ServerPage(QWidget * parent, Qt::WFlags flags)
#endif
}
void ServerPage::showTurtleRouterDialog()
{
TurtleRouterDialog::showUp() ;
}
void ServerPage::toggleIpDetermination(bool b)
{
rsPeers->allowServerIPDetermination(b) ;

View File

@ -45,6 +45,7 @@ private slots:
void saveAddresses();
void toggleUPnP();
void toggleIpDetermination(bool) ;
void showTurtleRouterDialog();
private:

View File

@ -716,6 +716,67 @@ behind a firewall or a VPN.</string>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_3">
<attribute name="title">
<string>F2F routing</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="_enableTurtleCB">
<property name="text">
<string>enable anonymous F2F routing</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="_showTurtleDialogPB">
<property name="text">
<string>Show router statistics</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QTextEdit" name="textEdit">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt; font-weight:600;&quot;&gt;RetroShare&lt;/span&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; is capable of transfering data and search requests between peers that are not necessarily friends. This traffic however only transits through a connected list of friends and is anonymous.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;If want to you use &lt;/span&gt;&lt;span style=&quot; font-size:8pt; font-weight:600;&quot;&gt;RetroShare&lt;/span&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; to anonymously share and download files, leaving this checked drastically increases your download scope, and participate into the overall network bandwidth. &lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;You can separately setup share flags for each shared directory:&lt;/span&gt;&lt;/p&gt;
&lt;ul style=&quot;-qt-list-indent: 1;&quot;&gt;&lt;li style=&quot; font-size:8pt;&quot; style=&quot; margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Browsable by friends&lt;/span&gt;: files are browsable from your direct friends.&lt;/li&gt;
&lt;li style=&quot; font-size:8pt;&quot; style=&quot; margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Anonymously shared&lt;/span&gt;: files can be downloaded by anybody through anonymous tunnels.&lt;/li&gt;&lt;/ul&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="2" column="0">