* Added for Partials Directory to Directories Dialog

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@885 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2008-12-11 01:54:41 +00:00
parent 616f4e671f
commit 5cb9f16dd7
3 changed files with 143 additions and 100 deletions

View File

@ -17,43 +17,45 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <rshare.h>
****************************************************************/
#include <rshare.h>
#include "rsiface/rsfiles.h"
#include "DirectoriesDialog.h"
/** Constructor */
DirectoriesDialog::DirectoriesDialog(QWidget *parent)
: ConfigPage(parent)
{
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
/* Create RshareSettings object */
_settings = new RshareSettings();
#include "DirectoriesDialog.h"
/** Constructor */
DirectoriesDialog::DirectoriesDialog(QWidget *parent)
: ConfigPage(parent)
{
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
/* Create RshareSettings object */
_settings = new RshareSettings();
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() ) );
/* Hide platform specific features */
#ifdef Q_WS_WIN
#endif
}
/** Saves the changes on this page */
bool
DirectoriesDialog::save(QString &errmsg)
{
/* Hide platform specific features */
#ifdef Q_WS_WIN
#endif
}
/** Saves the changes on this page */
bool
DirectoriesDialog::save(QString &errmsg)
{
return true;
}
/** Loads the settings for this page */
}
/** Loads the settings for this page */
void DirectoriesDialog::load()
{
std::list<std::string>::const_iterator it;
@ -73,6 +75,7 @@ void DirectoriesDialog::load()
}
ui.incomingDir->setText(QString::fromStdString(rsFiles->getDownloadDirectory()));
ui.partialsDir->setText(QString::fromStdString(rsFiles->getPartialsDirectory()));
listWidget->update(); /* update display */
@ -84,8 +87,9 @@ void DirectoriesDialog::addShareDirectory()
/* select a dir
*/
QString qdir = QFileDialog::getExistingDirectory(this, tr("Add Shared Directory"), "",
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
QString qdir = QFileDialog::getOpenFileName(this, tr("Add Shared Directory"),tr("All Files (*)"));
/* add it to the server */
std::string dir = qdir.toStdString();
@ -111,7 +115,7 @@ void DirectoriesDialog::removeShareDirectory()
void DirectoriesDialog::setIncomingDirectory()
{
QString qdir = QFileDialog::getExistingDirectory(this, tr("Add Shared Directory"), "",
QString qdir = QFileDialog::getExistingDirectory(this, tr("Set Incoming Directory"), "",
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
std::string dir = qdir.toStdString();
@ -122,4 +126,16 @@ void DirectoriesDialog::setIncomingDirectory()
load();
}
void DirectoriesDialog::setPartialsDirectory()
{
QString qdir = QFileDialog::getExistingDirectory(this, tr("Set Partials Directory"), "",
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
std::string dir = qdir.toStdString();
if (dir != "")
{
rsFiles->setPartialsDirectory(dir);
}
load();
}

View File

@ -48,6 +48,8 @@ private slots:
void addShareDirectory();
void removeShareDirectory();
void setIncomingDirectory();
void setPartialsDirectory();
private:
/** A RshareSettings object used for saving/loading settings */

View File

@ -5,14 +5,12 @@
<rect>
<x>0</x>
<y>0</y>
<width>470</width>
<height>313</height>
<width>456</width>
<height>356</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -509,72 +507,49 @@
<x>0</x>
<y>200</y>
<width>441</width>
<height>81</height>
<height>72</height>
</rect>
</property>
<property name="title" >
<string>Other Directories</string>
<string>Incoming Directory</string>
</property>
<widget class="QWidget" name="layoutWidget" >
<property name="geometry" >
<rect>
<x>10</x>
<y>30</y>
<width>421</width>
<height>34</height>
</rect>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="1" >
<widget class="QLineEdit" name="incomingDir" >
<property name="readOnly" >
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QLabel" name="label_4" >
<property name="text" >
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:Arial; font-size:10pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-size:8pt;">Incoming Files&lt;/span>&lt;/p>&lt;/body>&lt;/html></string>
</property>
</widget>
</item>
<item row="0" column="2" >
<widget class="QPushButton" name="incomingButton" >
<property name="minimumSize" >
<size>
<width>31</width>
<height>31</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>31</width>
<height>31</height>
</size>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="../images.qrc" >:/images/directoryselect_24x24_shadow.png</iconset>
</property>
<property name="iconSize" >
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QLineEdit" name="incomingDir" >
<property name="readOnly" >
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QPushButton" name="incomingButton" >
<property name="minimumSize" >
<size>
<width>31</width>
<height>31</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>31</width>
<height>31</height>
</size>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="../images.qrc" >:/images/directoryselect_24x24_shadow.png</iconset>
</property>
<property name="iconSize" >
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QGroupBox" name="groupBox" >
<property name="geometry" >
@ -667,6 +642,56 @@
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_3" >
<property name="geometry" >
<rect>
<x>0</x>
<y>270</y>
<width>441</width>
<height>72</height>
</rect>
</property>
<property name="title" >
<string>Partials Direcrtory</string>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QLineEdit" name="partialsDir" >
<property name="readOnly" >
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QPushButton" name="partialButton" >
<property name="minimumSize" >
<size>
<width>31</width>
<height>31</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>31</width>
<height>31</height>
</size>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="../images.qrc" >:/images/directoryselect_24x24_shadow.png</iconset>
</property>
<property name="iconSize" >
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<tabstops>
<tabstop>incomingDir</tabstop>