Added new settings which will be replace soon as possible Preferences

Changend Quit RetroShare MessageBox with "Yes" and not more with "OK"

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1412 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2009-07-23 17:11:51 +00:00
parent c99e03f376
commit 6abadc6375
36 changed files with 8708 additions and 27 deletions

View File

@ -1,4 +1,4 @@
CONFIG += qt gui uic qrc resources uitools debug # pluginmgr release version_detail_linux
CONFIG += qt gui uic qrc resources uitools debug pluginmgr #release version_detail_linux newsettings
QT += network xml script
TEMPLATE = app
TARGET = RetroShare
@ -533,7 +533,44 @@ pluginmgr {
}
newsettings {
SOURCES += gui/settings/rsettingswin.cpp \
gui/settings/GeneralPage.cpp \
gui/settings/DirectoriesPage.cpp \
gui/settings/ServerPage.cpp \
gui/settings/NetworkPage.cpp \
gui/settings/NotifyPage.cpp \
gui/settings/CryptoPage.cpp \
gui/settings/AppearancePage.cpp \
gui/settings/FileAssociationsPage.cpp \
gui/settings/SoundPage.cpp \
gui/settings/AddFileAssociationDialog.cpp
HEADERS += gui/settings/rsettingswin.h \
gui/settings/GeneralPage.h \
gui/settings/DirectoriesPage.h \
gui/settings/ServerPage.h \
gui/settings/NetworkPage.h \
gui/settings/NotifyPage.h \
gui/settings/CryptoPage.h \
gui/settings/AppearancePage.h \
gui/settings/FileAssociationsPage.h \
gui/settings/SoundPage.h \
gui/settings/AddFileAssociationDialog.h
FORMS += gui/settings/settings.ui \
gui/settings/GeneralPage.ui \
gui/settings/DirectoriesPage.ui \
gui/settings/ServerPage.ui \
gui/settings/NetworkPage.ui \
gui/settings/NotifyPage.ui \
gui/settings/CryptoPage.ui \
gui/settings/AppearancePage.ui \
gui/settings/SoundPage.ui
DEFINES *= NEWSETTINGS
}

View File

@ -56,7 +56,11 @@
#include "statusbar/ratesstatus.h"
#include "Preferences/PreferencesWindow.h"
//#include "Settings/gsettingswin.h"
#ifdef NEWSETTINGS
#include "settings/rsettingswin.h"
#endif
#include "util/rsversion.h"
#include "rsiface/rsiface.h"
@ -149,7 +153,6 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
connect(ui.actionSMPlayer, SIGNAL(triggered()), this, SLOT( showsmplayer()) );
connect(ui.actionAbout, SIGNAL(triggered()), this, SLOT( showabout()) );
connect(ui.actionColor, SIGNAL(triggered()), this, SLOT( setStyle()) );
//connect(ui.actionSettings, SIGNAL(triggered()), this, SLOT( showSettings()) );
/** adjusted quit behaviour: trigger a warning that can be switched off in the saved
@ -234,6 +237,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
createPageAction(QIcon(IMAGE_PLUGINS), tr("Plugins"), grp));
#endif
/* Create the toolbar */
ui.toolBar->addActions(grp->actions());
ui.toolBar->addSeparator();
@ -244,6 +248,10 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
addAction(new QAction(QIcon(IMAGE_UNFINISHED), tr("Unfinished"), ui.toolBar), SLOT(showApplWindow()));
#endif
#ifdef NEWSETTINGS
addAction(new QAction(QIcon(IMAGE_OPTIONS), tr("Options"), ui.toolBar_2), SLOT(showSettings()));
#endif
/* Select the first action */
grp->actions()[0]->setChecked(true);
@ -465,14 +473,16 @@ MainWindow::showMess(MainWindow::Page page)
/** Shows Options */
//void MainWindow::showSettings()
//{
// static GSettingsWin *win = new GSettingsWin(this);
// if (win->isHidden())
// win->setNewPage(0);
// win->show();
// win->activateWindow();
//}
#ifdef NEWSETTINGS
void MainWindow::showSettings()
{
static RSettingsWin *win = new RSettingsWin(this);
if (win->isHidden())
win->setNewPage(0);
win->show();
win->activateWindow();
}
#endif
/** Shows Messenger window */
void MainWindow::showMessengerWindow()
@ -535,7 +545,7 @@ void MainWindow::doQuit()
queryWrn.clear();
queryWrn.append(tr("Do you really want to exit RetroShare ?"));
if ((QMessageBox::question(this, tr("Really quit ? "),queryWrn,QMessageBox::Ok|QMessageBox::No, QMessageBox::Ok))== QMessageBox::Ok)
if ((QMessageBox::question(this, tr("Really quit ? "),queryWrn,QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes))== QMessageBox::Yes)
{
qApp->quit();
}

View File

@ -43,7 +43,6 @@
#endif
#include "Preferences/PreferencesWindow.h"
//#include "Settings/gsettingswin.h"
#include "bwgraph/bwgraph.h"
#include "help/browser/helpbrowser.h"
#include "games/qbackgammon/bgwindow.h"
@ -151,8 +150,9 @@ private slots:
* to <b>page</b>. */
void showPreferencesWindow(PreferencesWindow::Page page = PreferencesWindow::General);
void showMess(MainWindow::Page page = MainWindow::Messages);
// void showSettings();
#ifdef NEWSETTINGS
void showSettings();
#endif
void setStyle();
/** Called when user attempts to quit via quit button*/

View File

@ -1133,15 +1133,6 @@
<string>About</string>
</property>
</action>
<action name="actionSettings">
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/settings.png</normaloff>:/images/settings.png</iconset>
</property>
<property name="text">
<string>Settings</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -0,0 +1,228 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2009 The RetroShare Team, Oleksiy Bilyanskyy
*
* 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 "AddFileAssociationDialog.h"
//#include "rshare.h" // for Rshare::dataDirectory() method
//#include "rsharesettings.h"
#include <QSettings> //for win registry access
#include <QApplication>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QSizePolicy>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QDialogButtonBox>
#include <QMessageBox>
#include <QDebug>
//============================================================================
AddFileAssociationDialog::AddFileAssociationDialog(bool onlyEdit,
QWidget* parent)
:QDialog(parent)
{
fileTypeLabel = new QLabel();
fileTypeLabel->setText(tr("File type(extension):"));
fileTypeEdit = new QLineEdit();
fileTypeEdit->setEnabled( !onlyEdit );
fileTypeEdit->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
fileTypeEdit->setFixedWidth(50);
connect(fileTypeEdit, SIGNAL( textEdited( const QString& )),
this , SLOT( fileTypeEdited(const QString & )) ) ;
loadSystemDefault = new QPushButton();
loadSystemDefault->setText(tr("Use default command"));
loadSystemDefault->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
loadSystemDefault->setEnabled( fileTypeEdit &&
(!(fileTypeEdit->text().isEmpty())) ) ;
connect(loadSystemDefault, SIGNAL(clicked()),
this, SLOT(loadSystemDefaultCommand()));
loadSystemDefault->setVisible(false); //the button sholud remain unvisivle,
//until it will work properly
commandLabel = new QLabel();
commandLabel->setText(tr("Command"));
commandEdit = new QLineEdit;
selectExecutable = new QPushButton();
selectExecutable->setText("...");
selectExecutable->setFixedWidth(30);
QHBoxLayout* ftlay = new QHBoxLayout();
ftlay->addWidget( fileTypeLabel );
ftlay->addWidget( fileTypeEdit );
buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok
| QDialogButtonBox::Cancel );
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
QGridLayout* mainLay = new QGridLayout();
mainLay->addWidget(fileTypeLabel,0,0,1,1, Qt::AlignLeft);
mainLay->addWidget(fileTypeEdit,0,1,1,1, Qt::AlignLeft);
mainLay->addWidget(loadSystemDefault, 0,2,1,2,Qt::AlignRight);
mainLay->addWidget( commandLabel, 1,0,1,1, Qt::AlignLeft);
mainLay->addWidget( commandEdit, 1,1,1,2);
mainLay->addWidget( selectExecutable, 1,3,1,1);
mainLay->addWidget( buttonBox, 2,1,1,4, Qt::AlignLeft);
mainLay->setColumnStretch(2,1);
mainLay->setRowStretch(2,1);
this->setLayout( mainLay );
//TODO: in the next line we have to count a real height of the dialog;
// It's not good to use a hardcoded const value;
this->resize(600,200);//this->height());
}
//============================================================================
void
AddFileAssociationDialog::fileTypeEdited(const QString & text )
{
loadSystemDefault->setEnabled( !( text.isEmpty() ) );
}
//============================================================================
void
AddFileAssociationDialog::setFileType(QString ft)
{
fileTypeEdit->setText(ft);
}
//============================================================================
void
AddFileAssociationDialog::loadSystemDefaultCommand()
{
qDebug() << " lsdc is here";
QString fileExt = cleanFileType(fileTypeEdit->text()) ;
//fileExt.prepend('/');
fileExt.append("/.");
qDebug() << " fileExt is " << fileExt;
QSettings reg("HKEY_CLASSES_ROOT", QSettings::NativeFormat);
if (reg.contains(fileExt))
{
QString appKey = reg.value(fileExt).toString();
qDebug() << " got app key " << appKey;
appKey.append("/shell/open/command/.");
QString command = reg.value(appKey, "-").toString();
if (command!="-")
{
qDebug() << " got command :" << command ;
commandEdit->setText( command );
return;
}
}
QMessageBox::warning(this, tr("RetroShare"),
tr("Sorry, can't determine system "
"default command for this file\n"),
QMessageBox::Ok);
}
//============================================================================
QString
AddFileAssociationDialog::cleanFileType(QString ft)
{
QString result = ft;
//-- first remove possible filder names from received filename. (like
// "like "/moviedir/file.avi", we will leave only "file.avi"
int ti;
// dirs may be separated with "/"
ti = result.lastIndexOf('/');
if (ti > -1)
{
result.remove(0,ti+1);
}
// or "\"
ti = result.lastIndexOf('\\');
if (ti > -1)
{
result.remove(0,ti+1);
}
//-- then, if it is filename (like "file.avi"), we'll have to remove
//-- the name (ans leave just ".avi")
ti = result.lastIndexOf('.');
if (ti > -1)
{
result.remove(0,ti);
return result;
}
//-- also, if filename still is not prepended with dot, do it
if ((!result.isEmpty()) && (result.at(0)!='.'))
result.prepend('.');
//-- that's all
return result;
}
//============================================================================
QString
AddFileAssociationDialog::resultCommand()
{
return commandEdit->text();
}
//============================================================================
QString
AddFileAssociationDialog::resultFileType()
{
return cleanFileType( fileTypeEdit->text() ) ;
}
//============================================================================
void
AddFileAssociationDialog::setCommand(QString cmd)
{
commandEdit->setText( cmd );
}
//============================================================================
//============================================================================

View File

@ -0,0 +1,80 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2009 The RetroShare Team, Oleksiy Bilyanskyy
*
* 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 __AddFileAssociationDialog__
#define __AddFileAssociationDialog__
#include <QString>
#include <QDialog>
class QPushButton;
class QDialogButtonBox;
class QLabel;
class QLineEdit;
//=============================================================================
//! A dialog for specifying file type and associated command
class AddFileAssociationDialog: public QDialog
{
Q_OBJECT
public:
//! constructor
//! if (onlyEdit == true), user woll not be able to change file type,
//! only command (used for editing existing commands)
AddFileAssociationDialog( bool onlyEdit = false, QWidget *parent = 0 ) ;
virtual ~AddFileAssociationDialog(){};
void setFileType(QString ft);
void setCommand(QString cmd);
//! Gets file type (file extension) from given filename (or other string)
//! "file type" has to be like '.png'(some symbols, prepended by a dot)
static QString cleanFileType(QString ft);
QString resultCommand();
QString resultFileType();
protected:
//QTabWidget *tabWidget;
QLabel* fileTypeLabel;
QLineEdit* fileTypeEdit;
QPushButton* loadSystemDefault;
QPushButton* selectExecutable;
QLabel* commandLabel;
QLineEdit* commandEdit;
QDialogButtonBox *buttonBox;
protected slots:
void fileTypeEdited(const QString & text );
//! On win32, loads default command from system registry.
//! Unfinished. Is not used in current version.
void loadSystemDefaultCommand();
};
#endif

View File

@ -0,0 +1,137 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2006 - 2009 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 <rshare.h>
#include "AppearancePage.h"
/** Constructor */
AppearancePage::AppearancePage(QWidget * parent, Qt::WFlags flags)
: QWidget(parent, flags)
{
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
/* Create RshareSettings object */
_settings = new RshareSettings();
connect(ui.styleSheetCombo, SIGNAL(clicked()), this, SLOT(loadStyleSheet()));
/* Populate combo boxes */
foreach (QString code, LanguageSupport::languageCodes()) {
ui.cmboLanguage->addItem(QIcon(":/images/flags/" + code + ".png"),
LanguageSupport::languageName(code),
code);
}
foreach (QString style, QStyleFactory::keys()) {
ui.cmboStyle->addItem(style, style.toLower());
}
ui.styleSheetCombo->setCurrentIndex(ui.styleSheetCombo->findText("Default"));
//loadStyleSheet("Default");
loadqss();
load();
/* Hide platform specific features */
#ifdef Q_WS_WIN
#endif
}
/** Saves the changes on this page */
bool
AppearancePage::save(QString &errmsg)
{
Q_UNUSED(errmsg);
QString languageCode =
LanguageSupport::languageCode(ui.cmboLanguage->currentText());
_settings->setLanguageCode(languageCode);
_settings->setInterfaceStyle(ui.cmboStyle->currentText());
_settings->setSheetName(ui.styleSheetCombo->currentText());
/* Set to new style */
Rshare::setStyle(ui.cmboStyle->currentText());
return true;
}
/** Loads the settings for this page */
void
AppearancePage::load()
{
int index = ui.cmboLanguage->findData(_settings->getLanguageCode());
ui.cmboLanguage->setCurrentIndex(index);
index = ui.cmboStyle->findData(Rshare::style().toLower());
ui.cmboStyle->setCurrentIndex(index);
ui.styleSheetCombo->setCurrentIndex(ui.styleSheetCombo->findText(_settings->getSheetName()));
/** load saved internal styleSheet **/
//QFile file(":/qss/" + (_settings->getSheetName().toLower()) + ".qss");
/** load saved extern Stylesheets **/
QFile file(QApplication::applicationDirPath() + "/qss/" + (_settings->getSheetName().toLower()) + ".qss");
file.open(QFile::ReadOnly);
QString styleSheet = QLatin1String(file.readAll());
qApp->setStyleSheet(styleSheet);
}
void AppearancePage::on_styleSheetCombo_activated(const QString &sheetName)
{
loadStyleSheet(sheetName);
}
void AppearancePage::loadStyleSheet(const QString &sheetName)
{
/** internal Stylesheets **/
//QFile file(":/qss/" + sheetName.toLower() + ".qss");
/** extern Stylesheets **/
QFile file(QApplication::applicationDirPath() + "/qss/" + sheetName.toLower() + ".qss");
file.open(QFile::ReadOnly);
QString styleSheet = QLatin1String(file.readAll());
qApp->setStyleSheet(styleSheet);
}
void AppearancePage::loadqss()
{
QFileInfoList slist = QDir(QApplication::applicationDirPath() + "/qss/").entryInfoList();
foreach(QFileInfo st, slist)
{
if(st.fileName() != "." && st.fileName() != ".." && st.isFile())
ui.styleSheetCombo->addItem(st.fileName().remove(".qss"));
}
}

View File

@ -0,0 +1,66 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2006 - 2009 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 _APPERARANCEPAGE_H
#define _APPERARANCEPAGE_H
#include <QFileDialog>
#include <QStyleFactory>
#include <QtGui>
#include "gui/Preferences/rsharesettings.h"
#include <lang/languagesupport.h>
#include "ui_AppearancePage.h"
class AppearancePage : public QWidget
{
Q_OBJECT
public:
/** Default Constructor */
AppearancePage(QWidget * parent = 0, Qt::WFlags flags = 0);
/** Default Destructor */
~AppearancePage() {}
/** Saves the changes on this page */
bool save(QString &errmsg);
/** Loads the settings for this page */
void load();
private slots:
void on_styleSheetCombo_activated(const QString &styleSheetName);
private:
/** A RshareSettings object used for saving/loading settings */
RshareSettings* _settings;
void loadStyleSheet(const QString &sheetName);
void loadqss();
/** Qt Designer generated object */
Ui::AppearancePage ui;
};
#endif

View File

@ -0,0 +1,786 @@
<ui version="4.0" >
<class>AppearancePage</class>
<widget class="QWidget" name="AppearancePage" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>410</width>
<height>300</height>
</rect>
</property>
<property name="palette" >
<palette>
<active>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>208</red>
<green>208</green>
<blue>208</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>247</red>
<green>247</green>
<blue>247</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>139</red>
<green>139</green>
<blue>139</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>231</red>
<green>231</green>
<blue>231</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>208</red>
<green>208</green>
<blue>208</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>247</red>
<green>247</green>
<blue>247</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>139</red>
<green>139</green>
<blue>139</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>192</red>
<green>192</green>
<blue>192</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>231</red>
<green>231</green>
<blue>231</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>208</red>
<green>208</green>
<blue>208</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>247</red>
<green>247</green>
<blue>247</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>139</red>
<green>139</green>
<blue>139</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>231</red>
<green>231</green>
<blue>231</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="font" >
<font>
<family>Arial</family>
<pointsize>8</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
<underline>false</underline>
<strikeout>false</strikeout>
</font>
</property>
<property name="contextMenuPolicy" >
<enum>Qt::NoContextMenu</enum>
</property>
<layout class="QGridLayout" >
<property name="leftMargin" >
<number>6</number>
</property>
<property name="topMargin" >
<number>6</number>
</property>
<property name="rightMargin" >
<number>6</number>
</property>
<property name="bottomMargin" >
<number>6</number>
</property>
<property name="horizontalSpacing" >
<number>0</number>
</property>
<property name="verticalSpacing" >
<number>0</number>
</property>
<item row="0" column="0" >
<widget class="QGroupBox" name="grpLanguage" >
<property name="minimumSize" >
<size>
<width>0</width>
<height>75</height>
</size>
</property>
<property name="contextMenuPolicy" >
<enum>Qt::NoContextMenu</enum>
</property>
<property name="title" >
<string>Language</string>
</property>
<widget class="QWidget" name="layoutWidget_2" >
<property name="geometry" >
<rect>
<x>10</x>
<y>44</y>
<width>341</width>
<height>26</height>
</rect>
</property>
<layout class="QGridLayout" >
<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>
<property name="horizontalSpacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<number>6</number>
</property>
<item row="0" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>300</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" >
<widget class="QComboBox" name="cmboLanguage" >
<property name="minimumSize" >
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="contextMenuPolicy" >
<enum>Qt::NoContextMenu</enum>
</property>
<property name="toolTip" >
<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:'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;">Choose the language used in RetroShare&lt;/p>&lt;/body>&lt;/html></string>
</property>
<property name="editable" >
<bool>false</bool>
</property>
<property name="iconSize" >
<size>
<width>24</width>
<height>16</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QLabel" name="label" >
<property name="geometry" >
<rect>
<x>10</x>
<y>27</y>
<width>591</width>
<height>17</height>
</rect>
</property>
<property name="contextMenuPolicy" >
<enum>Qt::NoContextMenu</enum>
</property>
<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:8pt; 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;">Changes to language will only take effect after restarting RetroShare!&lt;/p>&lt;/body>&lt;/html></string>
</property>
</widget>
</widget>
</item>
<item row="1" column="0" >
<widget class="QGroupBox" name="grpStyle" >
<property name="minimumSize" >
<size>
<width>0</width>
<height>64</height>
</size>
</property>
<property name="contextMenuPolicy" >
<enum>Qt::NoContextMenu</enum>
</property>
<property name="toolTip" >
<string/>
</property>
<property name="title" >
<string>Style</string>
</property>
<widget class="QWidget" name="layoutWidget" >
<property name="geometry" >
<rect>
<x>10</x>
<y>24</y>
<width>341</width>
<height>26</height>
</rect>
</property>
<layout class="QGridLayout" >
<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>
<property name="horizontalSpacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<number>6</number>
</property>
<item row="0" column="0" >
<widget class="QComboBox" name="cmboStyle" >
<property name="minimumSize" >
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="contextMenuPolicy" >
<enum>Qt::NoContextMenu</enum>
</property>
<property name="toolTip" >
<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:'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;">Choose RetroShare's interface style&lt;/p>&lt;/body>&lt;/html></string>
</property>
<property name="editable" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
<item row="2" column="0" >
<widget class="QGroupBox" name="groupBox" >
<property name="minimumSize" >
<size>
<width>0</width>
<height>64</height>
</size>
</property>
<property name="title" >
<string>Style Sheet</string>
</property>
<widget class="QWidget" name="layoutWidget_3" >
<property name="geometry" >
<rect>
<x>11</x>
<y>20</y>
<width>341</width>
<height>25</height>
</rect>
</property>
<layout class="QGridLayout" >
<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>
<property name="horizontalSpacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<number>6</number>
</property>
<item row="0" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>181</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" >
<widget class="QComboBox" name="styleSheetCombo" >
<property name="minimumSize" >
<size>
<width>150</width>
<height>0</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="3" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>361</width>
<height>61</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources>
<include location="../images.qrc" />
</resources>
<connections/>
</ui>

View File

@ -0,0 +1,143 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2006 - 2009 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 "rsiface/rspeers.h" //for rsPeers variable
#include "rsiface/rsiface.h"
#include <QtGui>
#include <QClipboard>
#include <rshare.h>
#include "CryptoPage.h"
#include <sstream>
#include <iostream>
#include <set>
/** Constructor */
CryptoPage::CryptoPage(QWidget * parent, Qt::WFlags flags)
: QWidget(parent, flags)
{
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
/* Create RshareSettings object */
_settings = new RshareSettings();
connect(ui.copykeyButton, SIGNAL(clicked()), this, SLOT(copyPublicKey()));
connect(ui.exportkeyButton, SIGNAL(clicked()), this, SLOT(exportPublicKey()));
loadPublicKey();
/* Hide platform specific features */
#ifdef Q_WS_WIN
#endif
}
void
CryptoPage::closeEvent (QCloseEvent * event)
{
QWidget::closeEvent(event);
}
/** Saves the changes on this page */
bool
CryptoPage::save(QString &errmsg)
{
return true;
}
/** Loads the settings for this page */
void
CryptoPage::load()
{
}
/** Loads ouer default Puplickey */
void
CryptoPage::loadPublicKey()
{
//std::cerr << "CryptoPage() getting Invite" << std::endl;
std::string invite = rsPeers->GetRetroshareInvite();
RsPeerDetails ownDetail;
rsPeers->getPeerDetails(rsPeers->getOwnId(), ownDetail);
invite += LOCAL_IP;
invite += ownDetail.localAddr + ":";
std::ostringstream out;
out << ownDetail.localPort;
invite += out.str() + ";";
invite += "\n";
invite += EXT_IP;
invite += ownDetail.extAddr + ":";
std::ostringstream out2;
out2 << ownDetail.extPort;
invite += out2.str() + ";";
ui.certtextEdit->setText(QString::fromStdString(invite));
ui.certtextEdit->setReadOnly(true);
ui.certtextEdit->setMinimumHeight(200);
//std::cerr << "CryptoPage() getting Invite: " << invite << std::endl;
}
void
CryptoPage::copyPublicKey()
{
QMessageBox::information(this,
tr("RetroShare"),
tr("Your Public Key is copied to Clipbard, paste and send it to your"
"friend via email or some other way"));
QClipboard *clipboard = QApplication::clipboard();
clipboard->setText(ui.certtextEdit->toPlainText());
}
void
CryptoPage::exportPublicKey()
{
qDebug() << " exportPulicKey";
QString qdir = QFileDialog::getSaveFileName(this,
"Please choose a filename",
QDir::homePath(),
"RetroShare Certificate (*.pqi)");
if ( rsPeers->SaveCertificateToFile(rsPeers->getOwnId(), qdir.toStdString()) )
{
QMessageBox::information(this, tr("RetroShare"),
tr("Certificate file successfully created"),
QMessageBox::Ok, QMessageBox::Ok);
}
else
{
QMessageBox::information(this, tr("RetroShare"),
tr("Sorry, certificate file creation failed"),
QMessageBox::Ok, QMessageBox::Ok);
}
}

View File

@ -0,0 +1,70 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2006 - 2009 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 _CRYPTOPAGE_H
#define _CRYPTOPAGE_H
#include <QFileDialog>
#include <QtGui/QWidget>
#include <gui/Preferences/rsharesettings.h>
#include "gui/connect/ConnectFriendWizard.h"
#include "ui_CryptoPage.h"
class CryptoPage : public QWidget
{
Q_OBJECT
public:
/** Default Constructor */
CryptoPage(QWidget * parent = 0, Qt::WFlags flags = 0);
/** Default Destructor */
~CryptoPage() {}
/** Saves the changes on this page */
bool save(QString &errmsg);
/** Loads the settings for this page */
void load();
private slots:
void loadPublicKey();
void copyPublicKey();
void exportPublicKey();
private:
/** A RshareSettings object used for saving/loading settings */
RshareSettings* _settings;
void closeEvent (QCloseEvent * event);
/** Qt Designer generated object */
Ui::CryptoPage ui;
};
#endif

View File

@ -0,0 +1,590 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CryptoPage</class>
<widget class="QWidget" name="CryptoPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>542</width>
<height>355</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>208</red>
<green>208</green>
<blue>208</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>247</red>
<green>247</green>
<blue>247</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>139</red>
<green>139</green>
<blue>139</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>231</red>
<green>231</green>
<blue>231</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>208</red>
<green>208</green>
<blue>208</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>247</red>
<green>247</green>
<blue>247</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>139</red>
<green>139</green>
<blue>139</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>192</red>
<green>192</green>
<blue>192</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>231</red>
<green>231</green>
<blue>231</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>208</red>
<green>208</green>
<blue>208</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>247</red>
<green>247</green>
<blue>247</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>139</red>
<green>139</green>
<blue>139</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>231</red>
<green>231</green>
<blue>231</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>8</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
<underline>false</underline>
<strikeout>false</strikeout>
</font>
</property>
<property name="contextMenuPolicy">
<enum>Qt::NoContextMenu</enum>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Public Key</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTextEdit" name="certtextEdit"/>
</item>
</layout>
</widget>
</item>
<item row="0" column="1">
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_2">
<item row="3" column="0">
<widget class="QPushButton" name="exportkeyButton">
<property name="toolTip">
<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:'Arial'; font-size:8pt; 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;Export my Key as file&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Export Key</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="copykeyButton">
<property name="toolTip">
<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:'Arial'; font-size:8pt; 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;Copy my Key to Clipboard&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Copy Key</string>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>58</width>
<height>298</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -0,0 +1,217 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2006 - 2009 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 "DirectoriesPage.h"
#include "rshare.h"
#include "rsiface/rsfiles.h"
#include <algorithm>
DirectoriesPage::DirectoriesPage(QWidget * parent, Qt::WFlags flags)
: QWidget(parent, flags)
{
ui.setupUi(this);
setAttribute(Qt::WA_QuitOnClose, false);
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)));
ui.addButton->setToolTip(tr("Add a Share Directory"));
ui.removeButton->setToolTip(tr("Remove Shared Directory"));
ui.incomingButton->setToolTip(tr("Browse"));
ui.partialButton->setToolTip(tr("Browse"));
if (rsFiles->getShareDownloadDirectory())
{
ui.checkBox->setDown(true); /* signal not emitted */
}
else
{
ui.checkBox->setDown(false); /* signal not emitted */
}
/* Hide platform specific features */
#ifdef Q_WS_WIN
#endif
}
void
DirectoriesPage::closeEvent (QCloseEvent * event)
{
QWidget::closeEvent(event);
}
/** Saves the changes on this page */
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;
rsFiles->getSharedDirectories(dirs);
if (dirs.end() == std::find(dirs.begin(), dirs.end(), rsFiles->getDownloadDirectory()))
{
rsFiles->shareDownloadDirectory();
}
rsFiles->setShareDownloadDirectory(true);
}
else
{
rsFiles->unshareDownloadDirectory();
rsFiles->setShareDownloadDirectory(false);
}
return true;
}
/** Loads the settings for this page */
void DirectoriesPage::load()
{
std::list<std::string>::const_iterator it;
std::list<std::string> dirs;
rsFiles->getSharedDirectories(dirs);
/* get a link to the table */
QListWidget *listWidget = ui.dirList;
/* remove old items ??? */
listWidget->clear();
for(it = dirs.begin(); it != dirs.end(); it++)
{
/* (0) Dir Name */
listWidget->addItem(QString::fromStdString(*it));
}
ui.incomingDir->setText(QString::fromStdString(rsFiles->getDownloadDirectory()));
ui.partialsDir->setText(QString::fromStdString(rsFiles->getPartialsDirectory()));
listWidget->update(); /* update display */
}
void DirectoriesPage::addShareDirectory()
{
/* select a dir
*/
int ind;
QString qdir = QFileDialog::getExistingDirectory(this, tr("Add Shared Directory"), "",
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
ind=qdir.lastIndexOf("/");
/* add it to the server */
std::string dir = qdir.toStdString();
if (dir != "")
{
rsFiles->addSharedDirectory(dir);
load();
}
}
void DirectoriesPage::removeShareDirectory()
{
/* id current dir */
/* ask for removal */
QListWidget *listWidget = ui.dirList;
QListWidgetItem *qdir = listWidget -> currentItem();
if (qdir)
{
rsFiles->removeSharedDirectory( qdir->text().toStdString());
load();
}
}
void DirectoriesPage::setIncomingDirectory()
{
QString qdir = QFileDialog::getExistingDirectory(this, tr("Set Incoming Directory"), "",
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
std::string dir = qdir.toStdString();
if (dir != "")
{
rsFiles->setDownloadDirectory(dir);
if (ui.checkBox->isChecked())
{
std::list<std::string>::const_iterator it;
std::list<std::string> dirs;
rsFiles->getSharedDirectories(dirs);
if (dirs.end() == std::find(dirs.begin(), dirs.end(), rsFiles->getDownloadDirectory()))
{
rsFiles->shareDownloadDirectory();
}
}
}
load();
}
void DirectoriesPage::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();
}
void DirectoriesPage::shareDownloadDirectory(int state)
{
if (state == Qt::Checked)
{
std::list<std::string>::const_iterator it;
std::list<std::string> dirs;
rsFiles->getSharedDirectories(dirs);
if (dirs.end() == std::find(dirs.begin(), dirs.end(), rsFiles->getDownloadDirectory()))
{
rsFiles->shareDownloadDirectory();
}
rsFiles->setShareDownloadDirectory(true);
}
else
{
rsFiles->unshareDownloadDirectory();
rsFiles->setShareDownloadDirectory(false);
}
load();
}

View File

@ -0,0 +1,63 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2006 - 2009 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 DIRECTORIESPAGE_H
# define DIRECTORIESPAGE_H
#include <QFileDialog>
#include <QWidget>
#include <QtGui>
# include "ui_DirectoriesPage.h"
class DirectoriesPage: public QWidget
{
Q_OBJECT
public:
DirectoriesPage(QWidget * parent = 0, Qt::WFlags flags = 0);
// ~DirectoriesPage() {}
/** Saves the changes on this page */
bool save(QString &errmsg);
/** Loads the settings for this page */
void load();
private slots:
void addShareDirectory();
void removeShareDirectory();
void setIncomingDirectory();
void setPartialsDirectory();
void shareDownloadDirectory(int state);
private:
void closeEvent (QCloseEvent * event);
Ui::DirectoriesPage ui;
};
#endif // !GENERALPAGE_H

View File

@ -0,0 +1,711 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DirectoriesPage</class>
<widget class="QWidget" name="DirectoriesPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>452</width>
<height>349</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>208</red>
<green>208</green>
<blue>208</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>247</red>
<green>247</green>
<blue>247</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>139</red>
<green>139</green>
<blue>139</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>231</red>
<green>231</green>
<blue>231</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>208</red>
<green>208</green>
<blue>208</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>247</red>
<green>247</green>
<blue>247</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>139</red>
<green>139</green>
<blue>139</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>192</red>
<green>192</green>
<blue>192</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>231</red>
<green>231</green>
<blue>231</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>208</red>
<green>208</green>
<blue>208</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>247</red>
<green>247</green>
<blue>247</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>139</red>
<green>139</green>
<blue>139</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>231</red>
<green>231</green>
<blue>231</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>10</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
<underline>false</underline>
<strikeout>false</strikeout>
</font>
</property>
<property name="mouseTracking">
<bool>true</bool>
</property>
<property name="contextMenuPolicy">
<enum>Qt::NoContextMenu</enum>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>6</number>
</property>
<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">
<string>Incoming Directory</string>
</property>
<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">
<normaloff>:/images/directoryselect_24x24_shadow.png</normaloff>:/images/directoryselect_24x24_shadow.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QGroupBox" name="groupBox_3">
<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">
<normaloff>:/images/directoryselect_24x24_shadow.png</normaloff>:/images/directoryselect_24x24_shadow.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</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"/>
</resources>
<connections/>
</ui>

View File

@ -0,0 +1,379 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2009 The RetroShare Team, Oleksiy Bilyanskyy
*
* 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 "FileAssociationsPage.h"
#include "AddFileAssociationDialog.h"
//#include "rshare.h" // for Rshare::dataDirectory() method
#include "gui/Preferences/rsharesettings.h"
#include <QSettings>
#include <QApplication>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QSizePolicy>
//#include <QLabel>
//#include <QLineEdit>
#include <QToolBar>
#include <QTableWidget>
#include <QTableWidgetItem>
#include <QPushButton>
#include <QDialogButtonBox>
#include <QStringList>
#include <QAction>
#include <QMessageBox>
#include <QProcess>
#include <QDebug>
#include <QMessageBox>
//#include <iostream>
//============================================================================
FileAssociationsPage::FileAssociationsPage(QWidget * parent, Qt::WFlags flags)
: QWidget(parent, flags)
//:QFrame()
{
QVBoxLayout* pageLay = new QVBoxLayout(this);
toolBar = new QToolBar("actions", this);
newAction = new QAction(QIcon(":/images/add_24x24.png"), tr("&New"), this);
//newAction->setShortcut(tr("Ctrl+N"));
newAction->setStatusTip(tr("Add new Association"));
connect(newAction, SIGNAL(triggered()), this, SLOT(addnew()));
toolBar->addAction(newAction);
editAction = new QAction(QIcon(":/images/kcmsystem24.png"),
tr("&Edit"), this);
editAction->setStatusTip(tr("Edit this Association"));
connect(editAction, SIGNAL(triggered()), this, SLOT(edit()));
toolBar->addAction(editAction);
removeAction = new QAction(QIcon(":/images/edit_remove24.png"),
tr("&Remove"), this);
removeAction->setStatusTip(tr("Remove this Association"));
connect(removeAction, SIGNAL(triggered()), this, SLOT(remove()));
toolBar->addAction( removeAction );
pageLay->addWidget( toolBar );
table = new QTableWidget(5,2,this);//default 5 rows, 2 columns
table->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("File type") ) );
table->setHorizontalHeaderItem(1, new QTableWidgetItem("Command") );
connect( table, SIGNAL( cellActivated(int, int)),
this, SLOT( tableCellActivated(int, int)) );
connect( table, SIGNAL( cellClicked(int, int)),
this, SLOT( tableCellActivated(int, int)) );
// connect( table, SIGNAL( cellChanged(int, int)),
// this, SLOT( tableCellActivated(int, int)) );
//
// connect( table, SIGNAL( cellDoubleClicked(int, int)),
// this, SLOT( tableCellActivated(int, int)) );
//
// connect( table, SIGNAL( cellEntered(int, int)),
// this, SLOT( tableCellActivated(int, int)) );
//
// connect( table, SIGNAL( cellPressed(int, int)),
// this, SLOT( tableCellActivated(int, int)) );
// connect( table, SIGNAL( itemClicked(QTableWidgetItem*)),
// this, SLOT( tableItemActivated(QTableWidgetItem*)) );
pageLay->addWidget(table);
// addNewAssotiationButton = new QPushButton;
// addNewAssotiationButton->setText(tr("Add.."));
// QHBoxLayout* anbLay = new QHBoxLayout;
// anbLay->addStretch();
// anbLay->addWidget(addNewAssotiationButton);
// pageLay->addLayout(anbLay);
// connect( addNewAssotiationButton, SIGNAL( clicked() ),
// this, SLOT( testButtonClicked() ) );
settings = new RshareSettings();
//new QSettings( qApp->applicationDirPath()+"/sett.ini",
// QSettings::IniFormat);
settings->beginGroup("FileAssociations");
}
//============================================================================
FileAssociationsPage::~FileAssociationsPage()
{
delete settings ;
}
//============================================================================
bool
FileAssociationsPage::save (QString &errmsg)
{
//RshareSettings* settings = new RshareSettings();
// settings->beginGroup("FileAssotiations");
// settings->setValue(".s01", "s01 test");
// settings->setValue(".s02", "s02 test");
// settings->setValue(".s03", "s03 test");
// settings->setValue(".s04", "s04 test");
// QMap<QString, QString>::const_iterator ati = ations.constBegin();
// while (ati != ations.constEnd())
// {
// settings->setValue( ati.key(), ati.value() );
// qDebug() << " - " << ati.key() << ati.value() << "\n" ;
// ati++;
// }
//
// settings->endGroup();
settings->sync();
// delete settings;
/* */
return true;
}
//============================================================================
void
FileAssociationsPage::load()
{
//RshareSettings* settings = new RshareSettings();
// QSettings* settings = new QSettings( qApp->applicationDirPath()+"/sett.ini",
// QSettings::IniFormat);
//
// settings->beginGroup("FileAssotiations");
QStringList keys = settings->allKeys();
table->setRowCount( keys.count() );
int rowi = 0;
QStringList::const_iterator ki;
for(ki=keys.constBegin(); ki!=keys.constEnd(); ki++)
{
QString val = (settings->value(*ki, "")).toString();
addNewItemToTable( rowi, 0, *ki );
addNewItemToTable( rowi, 1, val );
rowi++;
}
//delete settings;
if (keys.count()==0)
{
removeAction->setEnabled(false);
editAction->setEnabled(false);
}
table->selectRow(0);
}
//============================================================================
void
FileAssociationsPage::remove()
{
int currentRow = table->currentRow() ;
QTableWidgetItem const * titem = table->item( currentRow,0);
QString key = (titem->data(QTableWidgetItem::Type)).toString();
settings->remove(key);
table->removeRow( currentRow );
if ( table->rowCount()==0 )
{
removeAction->setEnabled(false);
editAction->setEnabled(false);
}
}
//============================================================================
void
FileAssociationsPage::addnew()
{
AddFileAssociationDialog afad(false, this);//'add file assotiations' dialog
int currentRow = table->currentRow() ;
QTableWidgetItem* titem;
int ti = afad.exec();
if (ti==QDialog::Accepted)
{
QString currType = afad.resultFileType() ;
QString currCmd = afad.resultCommand() ;
if ( !settings->contains(currType) )//new item should be added only if
{ // it wasn't entered before.
int nridx = table->rowCount();//new row index
table->setRowCount(nridx+1);
addNewItemToTable(nridx,0, currType) ;
addNewItemToTable(nridx,1, currCmd);
}
else
{
for(int rowi=0; rowi<table->rowCount(); rowi++)
{
titem = table->item( rowi, 0);
if (titem->data(QTableWidgetItem::Type).toString()==currType)
{
titem = table->item( rowi, 1);
titem->setData(QTableWidgetItem::Type, currCmd);
break;
}
}
}
settings->setValue(currType, currCmd);
removeAction->setEnabled(true);
editAction->setEnabled(true);
}
}
//============================================================================
void
FileAssociationsPage::edit()
{
AddFileAssociationDialog afad(true, this);//'add file assotiations' dialog
int currentRow = table->currentRow() ;
QTableWidgetItem* titem;
titem = table->item( currentRow,0);
QString currType = (titem->data(QTableWidgetItem::Type)).toString();
titem = table->item( currentRow,1);
QString currCmd = (titem->data(QTableWidgetItem::Type)).toString();
afad.setCommand(currCmd);
afad.setFileType(currType);
int ti = afad.exec();
if (ti==QDialog::Accepted)
{
currCmd = afad.resultCommand() ;
titem = table->item( currentRow,1);
titem->setData(QTableWidgetItem::Type, currCmd);
settings->setValue(currType, currCmd);
}
}
//============================================================================
void
FileAssociationsPage::tableCellActivated ( int row, int column )
{
table->selectRow(row);
}
//============================================================================
void
FileAssociationsPage::tableItemActivated ( QTableWidgetItem * item )
{
qDebug() << "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy\n";
QMessageBox::information(this,
tr(" Friend Help"),
tr("You this"));
table->selectRow(table->row(item));
}
//============================================================================
void
FileAssociationsPage::addNewItemToTable(int row, int column,
QString itemText)
{
QTableWidgetItem* tmpitem ;
tmpitem = new QTableWidgetItem(itemText) ;
tmpitem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
// | Qt::ItemIsUserCheckable);
table->setItem(row, column, tmpitem );
}
//============================================================================
void
FileAssociationsPage::testButtonClicked()
{
AddFileAssociationDialog afad(this);// = new AddFileAssotiationDialog();
// commented code below is a test for
// AddFileAssotiationDialog::loadSystemDefaultCommand(QString ft) method
// QString tmps;
// tmps = "/home/folder/file";
// qDebug() << " for " << tmps <<" is " << afad.cleanFileType(tmps);
// tmps = "/home/folder/file.avi";
// qDebug() << " for " << tmps <<" is " << afad.cleanFileType(tmps);
// tmps = "file.avi";
// qDebug() << " for " << tmps <<" is " << afad.cleanFileType(tmps);
// tmps = ".file";
// qDebug() << " for " << tmps <<" is " << afad.cleanFileType(tmps);
// tmps = "c:\\home\\folder\\file";
// qDebug() << " for " << tmps <<" is " << afad.cleanFileType(tmps);
// tmps = "/home/folder/.file";
// qDebug() << " for " << tmps <<" is " << afad.cleanFileType(tmps);
// tmps = "D:\\folder\\file.asd.avi";
// qDebug() << " for " << tmps <<" is " << afad.cleanFileType(tmps);
int ti = afad.exec();
if (ti==QDialog::Accepted)
{
qDebug() << " dialog was accepted";
QProcess::execute(afad.resultCommand());//,
//QStringList("D:\\prog\\eclipse_workspace\\tapp-fa\\tt.txt") );
qDebug() << " process finished?";
}
else
if (ti == QDialog::Rejected)
qDebug() << " dialog rejected" ;
else
qDebug() << "dialog returned something else" ;
}
//============================================================================

View File

@ -0,0 +1,93 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2009 The RetroShare Team, Oleksiy Bilyanskyy
*
* 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 __FileAssociationsPage__
#define __FileAssociationsPage__
//#include "configpage.h"
#include <QString>
#include <QWidget>
#include <QtGui>
//#include <QMap>
//#include <QFrame>
//#include <QDialog>
class QToolBar;
class QAction;
class QTableWidget;
class QTableWidgetItem;
class QPushButton;
class QDialogButtonBox;
class QLabel;
class QLineEdit;
//class QSettings;
class RshareSettings;
//=============================================================================
//! Dialog for setting file assotiations for RS
//! With this config page user can specify, what programs should be executed
//! to open some types of files. Here 'type' means 'file extension'(and
//! 'file extension' means 'some symbols after last dot in filename').
class FileAssociationsPage : public QWidget
{
Q_OBJECT
public:
FileAssociationsPage(QWidget * parent = 0, Qt::WFlags flags = 0);
virtual ~FileAssociationsPage();
void load();
bool save (QString &errmsg);
protected:
QToolBar* toolBar;
QAction* newAction;
QAction* editAction;
QAction* removeAction;
QTableWidget* table;
QPushButton* addNewAssotiationButton;
QString settingsFileName;
RshareSettings* settings;
// QSettings* settings;
void addNewItemToTable(int row, int column, QString itemText);
protected slots:
void remove();
void addnew();
void edit();
void tableCellActivated ( int row, int column );
void tableItemActivated ( QTableWidgetItem * item ) ;
void testButtonClicked();//! slot for debuggin purposes, nnot really used
};
#endif

View File

@ -0,0 +1,90 @@
/****************************************************************
* This file is distributed under the following license:
*
* Copyright (c) 2006-2007, crypton
* Copyright (c) 2006, Matt Edman, Justin Hipple
*
* 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 "GeneralPage.h"
#include "rshare.h"
#include <util/stringutil.h>
#include <QSystemTrayIcon>
GeneralPage::GeneralPage(QWidget * parent, Qt::WFlags flags)
: QWidget(parent, flags)
{
ui.setupUi(this);
setAttribute(Qt::WA_QuitOnClose, false);
setWindowTitle(windowTitle() + QLatin1String(" - General"));
/* Create RshareSettings object */
_settings = new RshareSettings();
/* Hide platform specific features */
#ifndef Q_WS_WIN
ui.chkRunRetroshareAtSystemStartup->setVisible(false);
#endif ´
}
void
GeneralPage::closeEvent (QCloseEvent * event)
{
QWidget::closeEvent(event);
}
/** Saves the changes on this page */
bool
GeneralPage::save(QString &errmsg)
{
_settings->setValue(QString::fromUtf8("StartMinimized"), startMinimized());
_settings->setRunRetroshareOnBoot(
ui.chkRunRetroshareAtSystemStartup->isChecked());
return true;
}
/** Loads the settings for this page */
void
GeneralPage::load()
{
ui.chkRunRetroshareAtSystemStartup->setChecked(
_settings->runRetroshareOnBoot());
ui.checkStartMinimized->setChecked(_settings->value(QString::fromUtf8("StartMinimized"), false).toBool());
}
bool GeneralPage::startMinimized() const {
if(ui.checkStartMinimized->isChecked()) return true;
return ui.checkStartMinimized->isChecked();
}
/** Called when the "show on startup" checkbox is toggled. */
void
GeneralPage::toggleShowOnStartup(bool checked)
{
//RshareSettings _settings;
_settings->setShowMainWindowAtStart(checked);
}

View File

@ -0,0 +1,66 @@
/****************************************************************
* This file is distributed under the following license:
*
* Copyright (c) 2006-2007, crypton
* Copyright (c) 2006, Matt Edman, Justin Hipple
*
* 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 GENERALPAGE_H
# define GENERALPAGE_H
#include <QStyleFactory>
#include <QLineEdit>
#include "gui/Preferences/rsharesettings.h"
#include "lang/languagesupport.h"
# include <QtGui/QWidget>
# include "ui_GeneralPage.h"
class GeneralPage: public QWidget
{
Q_OBJECT
public:
GeneralPage(QWidget * parent = 0, Qt::WFlags flags = 0);
~GeneralPage() {}
/** Saves the changes on this page */
bool save(QString &errmsg);
/** Loads the settings for this page */
void load();
bool startMinimized() const;
private slots:
/** Called when the "show on startup" checkbox is toggled. */
void toggleShowOnStartup(bool checked);
private:
/** A VidaliaSettings object used for saving/loading settings */
RshareSettings* _settings;
void closeEvent (QCloseEvent * event);
Ui::GeneralPage ui;
};
#endif // !GENERALPAGE_H

View File

@ -0,0 +1,560 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>GeneralPage</class>
<widget class="QWidget" name="GeneralPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>413</width>
<height>267</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>64</height>
</size>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>208</red>
<green>208</green>
<blue>208</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>247</red>
<green>247</green>
<blue>247</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>139</red>
<green>139</green>
<blue>139</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>231</red>
<green>231</green>
<blue>231</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>208</red>
<green>208</green>
<blue>208</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>247</red>
<green>247</green>
<blue>247</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>139</red>
<green>139</green>
<blue>139</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>192</red>
<green>192</green>
<blue>192</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>231</red>
<green>231</green>
<blue>231</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>208</red>
<green>208</green>
<blue>208</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>247</red>
<green>247</green>
<blue>247</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>139</red>
<green>139</green>
<blue>139</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>231</red>
<green>231</green>
<blue>231</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>10</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
<underline>false</underline>
<strikeout>false</strikeout>
</font>
</property>
<property name="contextMenuPolicy">
<enum>Qt::NoContextMenu</enum>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>6</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>80</height>
</size>
</property>
<property name="title">
<string>Startup</string>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QCheckBox" name="chkRunRetroshareAtSystemStartup">
<property name="text">
<string>Start RetroShare when my system starts</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkStartMinimized">
<property name="text">
<string>Start minimized</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>401</width>
<height>91</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -0,0 +1,53 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2006, crypton
*
* 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 "NetworkPage.h"
#include "rshare.h"
NetworkPage::NetworkPage(QWidget * parent, Qt::WFlags flags)
: QWidget(parent, flags)
{
ui.setupUi(this);
setAttribute(Qt::WA_QuitOnClose, false);
}
void
NetworkPage::closeEvent (QCloseEvent * event)
{
QWidget::closeEvent(event);
}
/** Saves the changes on this page */
bool
NetworkPage::save(QString &errmsg)
{
}
/** Loads the settings for this page */
void
NetworkPage::load()
{
}

View File

@ -0,0 +1,47 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2006, crypton
*
* 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 NETWORKPAGE_H
#define NETWORKPAGE_H
#include <QtGui/QWidget>
#include "ui_NetworkPage.h"
class NetworkPage: public QWidget
{
public:
NetworkPage(QWidget * parent = 0, Qt::WFlags flags = 0);
~NetworkPage() {}
/** Saves the changes on this page */
bool save(QString &errmsg);
/** Loads the settings for this page */
void load();
private:
void closeEvent (QCloseEvent * event);
Ui::NetworkPage ui;
};
#endif // !NETWROKPAGE_H

View File

@ -0,0 +1,506 @@
<ui version="4.0" >
<class>NetworkPage</class>
<widget class="QWidget" name="NetworkPage" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>398</width>
<height>389</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette" >
<palette>
<active>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>208</red>
<green>208</green>
<blue>208</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>247</red>
<green>247</green>
<blue>247</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>139</red>
<green>139</green>
<blue>139</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>231</red>
<green>231</green>
<blue>231</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>208</red>
<green>208</green>
<blue>208</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>247</red>
<green>247</green>
<blue>247</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>139</red>
<green>139</green>
<blue>139</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>192</red>
<green>192</green>
<blue>192</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>231</red>
<green>231</green>
<blue>231</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>208</red>
<green>208</green>
<blue>208</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>247</red>
<green>247</green>
<blue>247</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>139</red>
<green>139</green>
<blue>139</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>231</red>
<green>231</green>
<blue>231</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="font" >
<font>
<family>Arial</family>
<pointsize>8</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
<underline>false</underline>
<strikeout>false</strikeout>
</font>
</property>
<property name="contextMenuPolicy" >
<enum>Qt::NoContextMenu</enum>
</property>
</widget>
<resources>
<include location="../images.qrc" />
</resources>
<connections/>
</ui>

View File

@ -0,0 +1,162 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2006 - 2009 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 <rshare.h>
#include "NotifyPage.h"
#include <iostream>
#include <sstream>
#include "rsiface/rsnotify.h"
#include <QTimer>
/** Constructor */
NotifyPage::NotifyPage(QWidget * parent, Qt::WFlags flags)
: QWidget(parent, flags)
{
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
setAttribute(Qt::WA_QuitOnClose, false);
setWindowTitle(windowTitle() + QLatin1String(" - Notify"));
/* Create RshareSettings object */
_settings = new RshareSettings();
load();
//QTimer *timer = new QTimer(this);
//timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateStatus()));
//timer->start(1000);
/* Hide platform specific features */
#ifdef Q_WS_WIN
#endif
}
void
NotifyPage::closeEvent (QCloseEvent * event)
{
QWidget::closeEvent(event);
}
/** Saves the changes on this page */
bool
NotifyPage::save(QString &errmsg)
{
/* extract from rsNotify the flags */
uint notifyflags = 0;
uint newsflags = 0;
uint chatflags = 0;
if (ui.popup_Connect->isChecked())
notifyflags |= RS_POPUP_CONNECT;
if (ui.popup_NewMsg->isChecked())
notifyflags |= RS_POPUP_MSG;
//if (ui.popup_NewChat->isChecked())
notifyflags |= RS_POPUP_CHAT;
//if (ui.popup_Call->isChecked())
// notifyflags |= RS_POPUP_CALL;
if (ui.notify_Peers->isChecked())
newsflags |= RS_FEED_TYPE_PEER;
if (ui.notify_Channels->isChecked())
newsflags |= RS_FEED_TYPE_CHAN;
if (ui.notify_Forums->isChecked())
newsflags |= RS_FEED_TYPE_FORUM;
if (ui.notify_Blogs->isChecked())
newsflags |= RS_FEED_TYPE_BLOG;
if (ui.notify_Chat->isChecked())
newsflags |= RS_FEED_TYPE_CHAT;
if (ui.notify_Messages->isChecked())
newsflags |= RS_FEED_TYPE_MSG;
if (ui.notify_Downloads->isChecked())
newsflags |= RS_FEED_TYPE_FILES;
if (ui.chat_NewWindow->isChecked())
chatflags |= RS_CHAT_OPEN_NEW;
if (ui.chat_Reopen->isChecked())
chatflags |= RS_CHAT_REOPEN;
if (ui.chat_Focus->isChecked())
chatflags |= RS_CHAT_FOCUS;
_settings->setNotifyFlags(notifyflags);
_settings->setNewsFeedFlags(newsflags);
_settings->setChatFlags(chatflags);
load();
return true;
}
/** Loads the settings for this page */
void NotifyPage::load()
{
/* extract from rsNotify the flags */
uint notifyflags = _settings->getNotifyFlags();
uint newsflags = _settings->getNewsFeedFlags();
uint chatflags = _settings->getChatFlags();
ui.popup_Connect->setChecked(notifyflags & RS_POPUP_CONNECT);
ui.popup_NewMsg->setChecked(notifyflags & RS_POPUP_MSG);
ui.systray_GroupChat->setChecked(true) ;
//ui.popup_NewChat->setChecked(notifyflags & RS_POPUP_CHAT);
//ui.popup_Call->setChecked(notifyflags & RS_POPUP_CALL);
ui.notify_Peers->setChecked(newsflags & RS_FEED_TYPE_PEER);
ui.notify_Channels->setChecked(newsflags & RS_FEED_TYPE_CHAN);
ui.notify_Forums->setChecked(newsflags & RS_FEED_TYPE_FORUM);
ui.notify_Blogs->setChecked(newsflags & RS_FEED_TYPE_BLOG);
ui.notify_Chat->setChecked(newsflags & RS_FEED_TYPE_CHAT);
ui.notify_Messages->setChecked(newsflags & RS_FEED_TYPE_MSG);
ui.notify_Downloads->setChecked(newsflags & RS_FEED_TYPE_FILES);
ui.chat_NewWindow->setChecked(chatflags & RS_CHAT_OPEN_NEW);
ui.chat_Reopen->setChecked(chatflags & RS_CHAT_REOPEN);
ui.chat_Focus->setChecked(chatflags & RS_CHAT_FOCUS);
/* disable ones that don't work yet */
ui.notify_Chat->setEnabled(false);
ui.notify_Blogs->setEnabled(false);
ui.notify_Downloads->setEnabled(false);
ui.systray_GroupChat->setEnabled(false);
//ui.popup_NewChat->setEnabled(false);
}
/** Loads the settings for this page */
void NotifyPage::updateStatus()
{
}

View File

@ -0,0 +1,65 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2006 - 2009 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 NOTIFYPAGE_H
#define NOTIFYPAGE_H
#include <QFileDialog>
#include <QtGui/QWidget>
#include "gui/Preferences/rsharesettings.h"
#include "ui_NotifyPage.h"
class NotifyPage : public QWidget
{
Q_OBJECT
public:
/** Default Constructor */
NotifyPage(QWidget * parent = 0, Qt::WFlags flags = 0);
~NotifyPage() {}
/** Default Destructor */
/** Saves the changes on this page */
bool save(QString &errmsg);
/** Loads the settings for this page */
void load();
public slots:
void updateStatus();
private slots:
private:
void closeEvent (QCloseEvent * event);
/** A RshareSettings object used for saving/loading settings */
RshareSettings* _settings;
/** Qt Designer generated object */
Ui::NotifyPage ui;
};
#endif // !NOTIFYPAGE_H

View File

@ -0,0 +1,686 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>NotifyPage</class>
<widget class="QWidget" name="NotifyPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>388</width>
<height>425</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>208</red>
<green>208</green>
<blue>208</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>247</red>
<green>247</green>
<blue>247</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>139</red>
<green>139</green>
<blue>139</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>231</red>
<green>231</green>
<blue>231</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>208</red>
<green>208</green>
<blue>208</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>247</red>
<green>247</green>
<blue>247</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>139</red>
<green>139</green>
<blue>139</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>192</red>
<green>192</green>
<blue>192</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>231</red>
<green>231</green>
<blue>231</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>208</red>
<green>208</green>
<blue>208</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>247</red>
<green>247</green>
<blue>247</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>139</red>
<green>139</green>
<blue>139</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>231</red>
<green>231</green>
<blue>231</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>10</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
<underline>false</underline>
<strikeout>false</strikeout>
</font>
</property>
<property name="contextMenuPolicy">
<enum>Qt::NoContextMenu</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QGroupBox" name="notify_ForumNewMsg">
<property name="title">
<string>News Feed</string>
</property>
<layout class="QVBoxLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>6</number>
</property>
<item>
<widget class="QCheckBox" name="notify_Peers">
<property name="text">
<string>Peers</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="notify_Channels">
<property name="text">
<string>Channels</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="notify_Forums">
<property name="text">
<string>Forums</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="notify_Chat">
<property name="text">
<string>Chat</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="notify_Blogs">
<property name="text">
<string>Blogs</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="notify_Messages">
<property name="text">
<string>Messages</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="notify_Downloads">
<property name="text">
<string>Downloads</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Toasters</string>
</property>
<layout class="QVBoxLayout">
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<item>
<widget class="QCheckBox" name="popup_Connect">
<property name="text">
<string>Peer Connect</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="popup_NewMsg">
<property name="text">
<string>New Message</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Private Chat</string>
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QCheckBox" name="chat_NewWindow">
<property name="text">
<string>Open Window for new Peer Chat</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chat_Reopen">
<property name="text">
<string>Reopen if closed by user:</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chat_Focus">
<property name="text">
<string>Grab Focus when chat arrives</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Group chat</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QCheckBox" name="systray_GroupChat">
<property name="text">
<string>Display systray message</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>130</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -0,0 +1,363 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2006, crypton
*
* 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 "ServerPage.h"
#include "rshare.h"
#include <iostream>
#include <sstream>
#include "rsiface/rsiface.h"
#include "rsiface/rspeers.h"
#include <QTimer>
ServerPage::ServerPage(QWidget * parent, Qt::WFlags flags)
: QWidget(parent, flags)
{
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
connect( ui.netModeComboBox, SIGNAL( activated ( int ) ), this, SLOT( toggleUPnP( ) ) );
connect( ui.allowIpDeterminationCB, SIGNAL( toggled( bool ) ), this, SLOT( toggleIpDetermination(bool) ) );
QTimer *timer = new QTimer(this);
timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateStatus()));
timer->start(1000);
load();
updateStatus();
bool b = rsPeers->getAllowServerIPDetermination() ;
ui.allowIpDeterminationCB->setChecked(b) ;
ui.IPServersLV->setEnabled(b) ;
std::list<std::string> ip_servers ;
rsPeers->getIPServersList(ip_servers) ;
for(std::list<std::string>::const_iterator it(ip_servers.begin());it!=ip_servers.end();++it)
ui.IPServersLV->addItem(QString::fromStdString(*it)) ;
/* Hide platform specific features */
#ifdef Q_WS_WIN
#endif
}
void ServerPage::toggleIpDetermination(bool b)
{
rsPeers->allowServerIPDetermination(b) ;
ui.IPServersLV->setEnabled(b) ;
}
void
ServerPage::closeEvent (QCloseEvent * event)
{
QWidget::closeEvent(event);
}
/** Saves the changes on this page */
bool
ServerPage::save(QString &errmsg)
{
/* save the server address */
/* save local address */
/* save the url for DNS access */
/* restart server */
/* save all? */
saveAddresses();
return true;
}
/** Loads the settings for this page */
void ServerPage::load()
{
/* load up configuration from rsPeers */
RsPeerDetails detail;
if (!rsPeers->getPeerDetails(rsPeers->getOwnId(), detail))
{
return;
}
/* set net mode */
int netIndex = 0;
switch(detail.tryNetMode)
{
case RS_NETMODE_EXT:
netIndex = 2;
break;
case RS_NETMODE_UDP:
netIndex = 1;
break;
default:
case RS_NETMODE_UPNP:
netIndex = 0;
break;
}
ui.netModeComboBox->setCurrentIndex(netIndex);
/* set dht/disc */
netIndex = 1;
if (detail.visState & RS_VS_DHT_ON)
{
netIndex = 0;
}
ui.dhtComboBox->setCurrentIndex(netIndex);
netIndex = 1;
if (detail.visState & RS_VS_DISC_ON)
{
netIndex = 0;
}
ui.discComboBox->setCurrentIndex(netIndex);
rsiface->lockData(); /* Lock Interface */
ui.totalDownloadRate->setValue(rsiface->getConfig().maxDownloadDataRate);
ui.totalUploadRate->setValue(rsiface->getConfig().maxUploadDataRate);
rsiface->unlockData(); /* UnLock Interface */
toggleUPnP();
/* Addresses must be set here - otherwise can't edit it */
/* set local address */
ui.localAddress->setText(QString::fromStdString(detail.localAddr));
ui.localPort -> setValue(detail.localPort);
/* set the server address */
ui.extAddress->setText(QString::fromStdString(detail.extAddr));
ui.extPort -> setValue(detail.extPort);
}
/** Loads the settings for this page */
void ServerPage::updateStatus()
{
/* load up configuration from rsPeers */
RsPeerDetails detail;
if (!rsPeers->getPeerDetails(rsPeers->getOwnId(), detail))
{
return;
}
/* only update if can't edit */
if (!ui.localPort->isEnabled())
{
/* set local address */
ui.localPort -> setValue(detail.localPort);
ui.extPort -> setValue(detail.extPort);
}
/* set local address */
ui.localAddress->setText(QString::fromStdString(detail.localAddr));
/* set the server address */
ui.extAddress->setText(QString::fromStdString(detail.extAddr));
#if 0
/* set status */
std::ostringstream out;
out << "Attempted Network Mode: ";
switch(detail.tryNetMode)
{
case RS_NETMODE_EXT:
out << "External Forwarded Port (UltraPEER Mode)";
break;
case RS_NETMODE_UDP:
out << "Firewalled";
break;
default:
case RS_NETMODE_UPNP:
out << "Automatic: UPnP Forwarded Port";
break;
}
out << std::endl;
out << "Actual Network Mode: ";
switch(detail.netMode)
{
case RS_NETMODE_EXT:
out << "External Forwarded Port (UltraPEER Mode)";
break;
case RS_NETMODE_UDP:
out << "Firewalled";
break;
case RS_NETMODE_UPNP:
out << "Automatic: UPnP Forwarded Port";
break;
default:
case RS_NETMODE_UNREACHABLE:
out << "Unreachable: Firewalled by Symmetric NAT";
break;
}
out << std::endl;
out << "\tLocal Address: " << detail.localAddr;
out << ":" << detail.localPort;
out << std::endl;
out << "\tExternal Address: " << detail.extAddr;
out << ":" << detail.extPort;
out << std::endl;
out << "UPnP Status: ";
out << std::endl;
out << "DHT Status: ";
if (detail.visState & RS_VS_DHT_ON)
out << " Enabled";
else
out << " Disabled";
out << std::endl;
out << "Discovery Status: ";
if (detail.visState & RS_VS_DISC_ON)
out << " Enabled";
else
out << " Disabled";
out << std::endl;
if (detail.netMode == RS_NETMODE_UNREACHABLE)
{
ui.netStatusBox->setTextColor( Qt::red );
}
else
{
ui.netStatusBox->setTextColor( Qt::black );
}
ui.netStatusBox->setText(QString::fromStdString(out.str()));
ui.netStatusBox ->setReadOnly(true);
#endif
}
void ServerPage::toggleUPnP()
{
/* switch on the radioButton */
bool settingChangeable = false;
if (0 != ui.netModeComboBox->currentIndex())
{
settingChangeable = true;
}
if (settingChangeable)
{
ui.dhtComboBox->setEnabled(true);
// disabled until we've got it all working.
//ui.discComboBox->setEnabled(true);
ui.discComboBox->setEnabled(false);
ui.localAddress->setEnabled(false);
ui.localPort -> setEnabled(true);
ui.extAddress -> setEnabled(false);
ui.extPort -> setEnabled(true);
}
else
{
ui.dhtComboBox->setEnabled(false);
ui.discComboBox->setEnabled(false);
ui.localAddress->setEnabled(false);
ui.localPort -> setEnabled(false);
ui.extAddress -> setEnabled(false);
ui.extPort -> setEnabled(false);
}
}
void ServerPage::saveAddresses()
{
QString str;
bool saveAddr = false;
RsPeerDetails detail;
std::string ownId = rsPeers->getOwnId();
if (!rsPeers->getPeerDetails(ownId, detail))
{
return;
}
int netIndex = ui.netModeComboBox->currentIndex();
/* Check if netMode has changed */
int netMode = 0;
switch(netIndex)
{
case 2:
netMode = RS_NETMODE_EXT;
break;
case 1:
netMode = RS_NETMODE_UDP;
break;
default:
case 0:
netMode = RS_NETMODE_UPNP;
break;
}
if (detail.tryNetMode != netMode)
{
rsPeers->setNetworkMode(ownId, netMode);
}
int visState = 0;
/* Check if vis has changed */
if (0 == ui.discComboBox->currentIndex())
{
visState |= RS_VS_DISC_ON;
}
if (0 == ui.dhtComboBox->currentIndex())
{
visState |= RS_VS_DHT_ON;
}
if (visState != detail.visState)
{
rsPeers->setVisState(ownId, visState);
}
if (0 != netIndex)
{
saveAddr = true;
}
if (saveAddr)
{
rsPeers->setLocalAddress(rsPeers->getOwnId(), ui.localAddress->text().toStdString(), ui.localPort->value());
rsPeers->setExtAddress(rsPeers->getOwnId(), ui.extAddress->text().toStdString(), ui.extPort->value());
}
rsicontrol->ConfigSetDataRates( ui.totalDownloadRate->value(), ui.totalUploadRate->value() );
load();
}

View File

@ -0,0 +1,58 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2006, crypton
*
* 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 SERVERPAGE_H
# define SERVERPAGE_H
# include <QtGui/QWidget>
# include "ui_ServerPage.h"
class ServerPage: public QWidget
{
Q_OBJECT
public:
ServerPage(QWidget * parent = 0, Qt::WFlags flags = 0);
~ServerPage() {}
/** Saves the changes on this page */
bool save(QString &errmsg);
/** Loads the settings for this page */
void load();
public slots:
void updateStatus();
private slots:
void saveAddresses();
void toggleUPnP();
void toggleIpDetermination(bool) ;
private:
void closeEvent (QCloseEvent * event);
Ui::ServerPage ui;
};
#endif // !SERVERPAGE_H

View File

@ -0,0 +1,803 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ServerPage</class>
<widget class="QWidget" name="ServerPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>467</width>
<height>448</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>208</red>
<green>208</green>
<blue>208</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>247</red>
<green>247</green>
<blue>247</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>139</red>
<green>139</green>
<blue>139</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>231</red>
<green>231</green>
<blue>231</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>208</red>
<green>208</green>
<blue>208</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>247</red>
<green>247</green>
<blue>247</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>139</red>
<green>139</green>
<blue>139</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>192</red>
<green>192</green>
<blue>192</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>231</red>
<green>231</green>
<blue>231</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>208</red>
<green>208</green>
<blue>208</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>247</red>
<green>247</green>
<blue>247</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>139</red>
<green>139</green>
<blue>139</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>231</red>
<green>231</green>
<blue>231</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="contextMenuPolicy">
<enum>Qt::NoContextMenu</enum>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>6</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Network Configuration (takes effect after restart)</string>
</property>
<layout class="QHBoxLayout">
<item>
<layout class="QVBoxLayout">
<item>
<widget class="QComboBox" name="netModeComboBox">
<item>
<property name="text">
<string>Automatic</string>
</property>
</item>
<item>
<property name="text">
<string>Firewalled</string>
</property>
</item>
<item>
<property name="text">
<string>Forwarded Port</string>
</property>
</item>
</widget>
</item>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QComboBox" name="dhtComboBox">
<item>
<property name="text">
<string>DHT Enabled</string>
</property>
</item>
<item>
<property name="text">
<string>DHT Disabled</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QComboBox" name="discComboBox">
<item>
<property name="text">
<string>Discovery Enabled</string>
</property>
</item>
<item>
<property name="text">
<string>Discovery Disabled</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<spacer>
<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>
</widget>
</item>
<item row="1" column="0">
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Network Configuration</string>
</attribute>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Network Configuration</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout">
<item>
<layout class="QVBoxLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Local Address</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>External Address</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLineEdit" name="localAddress"/>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Port:</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QSpinBox" name="localPort">
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>7812</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLineEdit" name="extAddress"/>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Port:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QSpinBox" name="extPort">
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>7812</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>IP Service</string>
</attribute>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>IP check service</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QCheckBox" name="allowIpDeterminationCB">
<property name="toolTip">
<string>If you unckeck this, RetroShare can only determine your IP
when you connect to somebody. Leaving this checked helps
connecting when you have few friends. It also helps if you're
behind a firewall or a VPN.</string>
</property>
<property name="text">
<string>Allow RetroShare to ask my ip to these websites:</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QListWidget" name="IPServersLV">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="2" column="0">
<widget class="QGroupBox" name="groupBox_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Transfer Rates</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_14">
<property name="text">
<string>Download (KB/s) </string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="totalDownloadRate">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>12500</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="_2">
<property name="spacing">
<number>6</number>
</property>
<item>
<widget class="QLabel" name="label_15">
<property name="text">
<string>Upload (KB/s) </string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="totalUploadRate">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>12500</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>localAddress</tabstop>
<tabstop>localPort</tabstop>
<tabstop>extPort</tabstop>
<tabstop>totalDownloadRate</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,174 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2006 - 2009 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 <rshare.h>
#include "SoundPage.h"
/** Constructor */
SoundPage::SoundPage(QWidget * parent, Qt::WFlags flags)
: QWidget(parent, flags)
{
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
/* Create RshareSettings object */
_settings = new RshareSettings();
connect(ui.cmd_openFile, SIGNAL(clicked(bool) ),this,SLOT(on_cmd_openFile()));
connect(ui.cmd_openFile_2,SIGNAL(clicked(bool) ),this,SLOT(on_cmd_openFile2()));
connect(ui.cmd_openFile_3,SIGNAL(clicked(bool) ),this,SLOT(on_cmd_openFile3()));
connect(ui.cmd_openFile_4,SIGNAL(clicked(bool) ),this,SLOT(on_cmd_openFile4()));
connect(ui.cmd_openFile_5,SIGNAL(clicked(bool) ),this,SLOT(on_cmd_openFile5()));
connect(ui.cmd_openFile_6,SIGNAL(clicked(bool) ),this,SLOT(on_cmd_openFile6()));
/* Hide platform specific features */
#ifdef Q_WS_WIN
#endif
}
/** Saves the changes on this page */
bool
SoundPage::save(QString &errmsg)
{
_settings->beginGroup("Sound");
_settings->beginGroup("Enable");
_settings->setValue("User_go_Online",ui.checkBoxSound->isChecked());
_settings->setValue("User_go_Offline",ui.checkBoxSound_2->isChecked());
_settings->setValue("FileSend_Finished",ui.checkBoxSound_3->isChecked());
_settings->setValue("FileRecive_Incoming",ui.checkBoxSound_4->isChecked());
_settings->setValue("FileRecive_Finished",ui.checkBoxSound_5->isChecked());
_settings->setValue("NewChatMessage",ui.checkBoxSound_6->isChecked());
_settings->endGroup();
_settings->beginGroup("SoundFilePath");
_settings->setValue("User_go_Online",ui.txt_SoundFile->text());
_settings->setValue("User_go_Offline",ui.txt_SoundFile2->text());
_settings->setValue("FileSend_Finished",ui.txt_SoundFile3->text());
_settings->setValue("FileRecive_Incoming",ui.txt_SoundFile4->text());
_settings->setValue("FileRecive_Finished",ui.txt_SoundFile5->text());
_settings->setValue("NewChatMessage",ui.txt_SoundFile6->text());
_settings->endGroup();
_settings->endGroup();
return true;
}
/** Loads the settings for this page */
void
SoundPage::load()
{
_settings->beginGroup("Sound");
_settings->beginGroup("SoundFilePath");
ui.txt_SoundFile->setText(_settings->value("User_go_Online","").toString());
ui.txt_SoundFile2->setText(_settings->value("User_go_Offline","").toString());
ui.txt_SoundFile3->setText(_settings->value("FileSend_Finished","").toString());
ui.txt_SoundFile4->setText(_settings->value("FileRecive_Incoming","").toString());
ui.txt_SoundFile5->setText(_settings->value("FileRecive_Finished","").toString());
ui.txt_SoundFile6->setText(_settings->value("NewChatMessage","").toString());
if(!ui.txt_SoundFile->text().isEmpty())ui.checkBoxSound->setEnabled(true);
if(!ui.txt_SoundFile2->text().isEmpty())ui.checkBoxSound_2->setEnabled(true);
if(!ui.txt_SoundFile3->text().isEmpty())ui.checkBoxSound_3->setEnabled(true);
if(!ui.txt_SoundFile4->text().isEmpty())ui.checkBoxSound_4->setEnabled(true);
if(!ui.txt_SoundFile5->text().isEmpty())ui.checkBoxSound_5->setEnabled(true);
if(!ui.txt_SoundFile6->text().isEmpty())ui.checkBoxSound_6->setEnabled(true);
_settings->endGroup();
_settings->beginGroup("Enable");
ui.checkBoxSound->setChecked(_settings->value("User_go_Online",false).toBool());
ui.checkBoxSound_2->setChecked(_settings->value("User_go_Offline",false).toBool());
ui.checkBoxSound_3->setChecked(_settings->value("FileSend_Finished",false).toBool());
ui.checkBoxSound_4->setChecked(_settings->value("FileRecive_Incoming",false).toBool());
ui.checkBoxSound_5->setChecked(_settings->value("FileRecive_Finished",false).toBool());
ui.checkBoxSound_6->setChecked(_settings->value("NewChatMessage",false).toBool());
_settings->endGroup();
_settings->endGroup();
}
void SoundPage::on_cmd_openFile()
{
ui.txt_SoundFile->setText(QFileDialog::getOpenFileName(this,"Open File", ".", "wav (*.wav)"));
if(ui.txt_SoundFile->text().isEmpty()){
ui.checkBoxSound->setChecked(false);
ui.checkBoxSound->setEnabled(false);
}
else
ui.checkBoxSound->setEnabled(true);
}
void SoundPage::on_cmd_openFile2()
{
ui.txt_SoundFile2->setText(QFileDialog::getOpenFileName(this,"Open File", ".", "wav (*.wav)"));
if(ui.txt_SoundFile2->text().isEmpty()){
ui.checkBoxSound_2->setChecked(false);
ui.checkBoxSound_2->setEnabled(false);
}
else
ui.checkBoxSound_2->setEnabled(true);
}
void SoundPage::on_cmd_openFile3()
{
ui.txt_SoundFile3->setText(QFileDialog::getOpenFileName(this,"Open File", ".", "wav (*.wav)"));
if(ui.txt_SoundFile3->text().isEmpty()){
ui.checkBoxSound_3->setChecked(false);
ui.checkBoxSound_3->setEnabled(false);
}
else
ui.checkBoxSound_3->setEnabled(true);
}
void SoundPage::on_cmd_openFile4()
{
ui.txt_SoundFile4->setText(QFileDialog::getOpenFileName(this,"Open File", ".", "wav (*.wav)"));
if(ui.txt_SoundFile4->text().isEmpty()){
ui.checkBoxSound_4->setChecked(false);
ui.checkBoxSound_4->setEnabled(false);
}
else
ui.checkBoxSound_4->setEnabled(true);
}
void SoundPage::on_cmd_openFile5()
{
ui.txt_SoundFile5->setText(QFileDialog::getOpenFileName(this,"Open File", ".", "wav (*.wav)"));
if(ui.txt_SoundFile5->text().isEmpty()){
ui.checkBoxSound_5->setChecked(false);
ui.checkBoxSound_5->setEnabled(false);
}
else
ui.checkBoxSound_5->setEnabled(true);
}
void SoundPage::on_cmd_openFile6()
{
ui.txt_SoundFile6->setText(QFileDialog::getOpenFileName(this,"Open File", ".", "wav (*.wav)"));
if(ui.txt_SoundFile6->text().isEmpty()){
ui.checkBoxSound_6->setChecked(false);
ui.checkBoxSound_6->setEnabled(false);
}
else
ui.checkBoxSound_6->setEnabled(true);
}

View File

@ -0,0 +1,64 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2006 - 2009 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 _SOUNDPAGE_H
#define _SOUNDPAGE_H
#include <QFileDialog>
#include <gui/Preferences/rsharesettings.h>
#include "ui_SoundPage.h"
class SoundPage : public QWidget
{
Q_OBJECT
public:
/** Default Constructor */
SoundPage(QWidget * parent = 0, Qt::WFlags flags = 0);
/** Default Destructor */
~SoundPage() {}
/** Saves the changes on this page */
bool save(QString &errmsg);
/** Loads the settings for this page */
void load();
private slots:
void on_cmd_openFile();
void on_cmd_openFile2();
void on_cmd_openFile3();
void on_cmd_openFile4();
void on_cmd_openFile5();
void on_cmd_openFile6();
private:
/** A RshareSettings object used for saving/loading settings */
RshareSettings* _settings;
/** Qt Designer generated object */
Ui::SoundPage ui;
};
#endif

View File

@ -0,0 +1,814 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SoundPage</class>
<widget class="QWidget" name="SoundPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>468</width>
<height>407</height>
</rect>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>208</red>
<green>208</green>
<blue>208</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>247</red>
<green>247</green>
<blue>247</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>139</red>
<green>139</green>
<blue>139</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>231</red>
<green>231</green>
<blue>231</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>208</red>
<green>208</green>
<blue>208</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>247</red>
<green>247</green>
<blue>247</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>139</red>
<green>139</green>
<blue>139</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>192</red>
<green>192</green>
<blue>192</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>231</red>
<green>231</green>
<blue>231</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>208</red>
<green>208</green>
<blue>208</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>247</red>
<green>247</green>
<blue>247</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>139</red>
<green>139</green>
<blue>139</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>231</red>
<green>231</green>
<blue>231</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>8</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
<underline>false</underline>
<strikeout>false</strikeout>
</font>
</property>
<property name="contextMenuPolicy">
<enum>Qt::NoContextMenu</enum>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_11">
<property name="title">
<string>Sound Events</string>
</property>
<widget class="QGroupBox" name="groupBox_12">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>421</width>
<height>81</height>
</rect>
</property>
<property name="title">
<string>User</string>
</property>
<widget class="QCheckBox" name="checkBoxSound">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>80</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>go Online</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBoxSound_2">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>50</y>
<width>80</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>go Offline</string>
</property>
</widget>
<widget class="QLineEdit" name="txt_SoundFile">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>90</x>
<y>20</y>
<width>281</width>
<height>24</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="txt_SoundFile2">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>90</x>
<y>50</y>
<width>281</width>
<height>24</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="cmd_openFile">
<property name="geometry">
<rect>
<x>380</x>
<y>20</y>
<width>31</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>...</string>
</property>
</widget>
<widget class="QPushButton" name="cmd_openFile_2">
<property name="geometry">
<rect>
<x>380</x>
<y>50</y>
<width>31</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>...</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_13">
<property name="geometry">
<rect>
<x>10</x>
<y>100</y>
<width>421</width>
<height>61</height>
</rect>
</property>
<property name="title">
<string>FileSend</string>
</property>
<widget class="QLineEdit" name="txt_SoundFile3">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>90</x>
<y>20</y>
<width>281</width>
<height>24</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="cmd_openFile_3">
<property name="geometry">
<rect>
<x>380</x>
<y>20</y>
<width>31</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>...</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBoxSound_3">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>80</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Finished</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_14">
<property name="geometry">
<rect>
<x>10</x>
<y>160</y>
<width>421</width>
<height>91</height>
</rect>
</property>
<property name="title">
<string>FileRecive</string>
</property>
<widget class="QCheckBox" name="checkBoxSound_4">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>80</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Incoming</string>
</property>
</widget>
<widget class="QLineEdit" name="txt_SoundFile4">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>90</x>
<y>20</y>
<width>281</width>
<height>24</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="cmd_openFile_4">
<property name="geometry">
<rect>
<x>380</x>
<y>20</y>
<width>31</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>...</string>
</property>
</widget>
<widget class="QPushButton" name="cmd_openFile_5">
<property name="geometry">
<rect>
<x>380</x>
<y>50</y>
<width>31</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>...</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBoxSound_5">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>50</y>
<width>80</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Finished</string>
</property>
</widget>
<widget class="QLineEdit" name="txt_SoundFile5">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>90</x>
<y>50</y>
<width>281</width>
<height>24</height>
</rect>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_15">
<property name="geometry">
<rect>
<x>10</x>
<y>260</y>
<width>421</width>
<height>111</height>
</rect>
</property>
<property name="title">
<string>Chatmessage</string>
</property>
<widget class="QPushButton" name="cmd_openFile_6">
<property name="geometry">
<rect>
<x>380</x>
<y>20</y>
<width>31</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>...</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBoxSound_6">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>80</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>New</string>
</property>
</widget>
<widget class="QLineEdit" name="txt_SoundFile6">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>90</x>
<y>20</y>
<width>281</width>
<height>24</height>
</rect>
</property>
</widget>
</widget>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -0,0 +1,186 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2006 -2009 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 "GeneralPage.h"
#include "DirectoriesPage.h"
#include "ServerPage.h"
#include "NetworkPage.h"
#include "NotifyPage.h"
#include "CryptoPage.h"
#include "AppearancePage.h"
#include "FileAssociationsPage.h"
#include "SoundPage.h"
#define IMAGE_GENERAL ":/images/kcmsystem24.png"
#include "rsettingswin.h"
RSettingsWin::RSettingsWin(QWidget * parent, Qt::WFlags flags)
: QDialog(parent, flags)
{
setupUi(this);
setAttribute(Qt::WA_QuitOnClose, false);
setModal(false);
initStackedWidget();
connect(listWidget, SIGNAL(currentRowChanged(int)),
this, SLOT(setNewPage(int)));
connect(okButton, SIGNAL(clicked( bool )), this, SLOT( saveChanges()) );
}
void
RSettingsWin::closeEvent (QCloseEvent * event)
{
QWidget::closeEvent(event);
}
void
RSettingsWin::initStackedWidget()
{
stackedWidget->setCurrentIndex(-1);
stackedWidget->removeWidget(stackedWidget->widget(0));
stackedWidget->addWidget(new GeneralPage(false));
stackedWidget->addWidget(new NetworkPage());
stackedWidget->addWidget(new ServerPage());
stackedWidget->addWidget(new DirectoriesPage());
stackedWidget->addWidget(new NotifyPage());
stackedWidget->addWidget(new CryptoPage());
stackedWidget->addWidget(new AppearancePage());
stackedWidget->addWidget(new FileAssociationsPage() );
stackedWidget->addWidget(new SoundPage() );
setNewPage(General);
}
void
RSettingsWin::setNewPage(int page)
{
QString text;
switch (page)
{
case General:
text = tr("General");
pageicon->setPixmap(QPixmap(":/images/kcmsystem24.png"));
break;
case Network:
text = tr("Network");
pageicon->setPixmap(QPixmap(":/images/network32.png"));
break;
case Directories:
text = tr("Directories");
pageicon->setPixmap(QPixmap(":/images/folder_doments.png"));
break;
case Server:
text = tr("Server");
pageicon->setPixmap(QPixmap(":/images/server_24x24.png"));
break;
case Notify:
text = tr("Notify");
pageicon->setPixmap(QPixmap(":/images/status_unknown.png"));
break;
case Security:
text = tr("Security");
pageicon->setPixmap(QPixmap(":/images/encrypted32.png"));
break;
case Appearance:
text = tr("Appearance");
pageicon->setPixmap(QPixmap(":/images/looknfeel.png"));
break;
case Fileassociations:
text = tr("File Associations");
pageicon->setPixmap(QPixmap(":/images/filetype-association.png"));
break;
case Sound:
text = tr("Sound");
pageicon->setPixmap(QPixmap(":/images/sound.png"));
break;
default:
text = tr("UnknownPage");// impossible case
}
pageName->setText(text); //tr("%1").arg(
stackedWidget->setCurrentIndex(page);
listWidget->setCurrentRow(page);
}
/** Saves changes made to settings. */
void
RSettingsWin::saveChanges()
{
bool saveOk;
QString errmsg;
GeneralPage *gp;
NetworkPage *np;
CryptoPage *cp;
ServerPage *sp;
NotifyPage *nfp;
AppearancePage *ap;
/* Call each config page's save() method to save its data */
int i, count = stackedWidget->count();
for (i = 0; i < count; i++) {
QWidget *page = stackedWidget->widget(i);
if (NULL != (gp = dynamic_cast<GeneralPage *>(page))) {saveOk = gp->save(errmsg);}
else
if (NULL !=(np = dynamic_cast<NetworkPage *>(page))) {saveOk = np->save(errmsg);}
else
if (NULL !=(sp = dynamic_cast<ServerPage *>(page))) {saveOk = sp->save(errmsg);}
else
if (NULL !=(cp = dynamic_cast<CryptoPage *>(page))) {saveOk = cp->save(errmsg);}
else
if (NULL !=(nfp = dynamic_cast<NotifyPage *>(page))) {saveOk = nfp->save(errmsg);}
else if (NULL !=(ap = dynamic_cast<AppearancePage *>(page))) {saveOk = ap->save(errmsg);}
if (!saveOk) {
/* Display the offending page */
stackedWidget->setCurrentWidget(page);
/* Show the user what went wrong */
QMessageBox::warning(this,
tr("Error Saving Configuration"), errmsg,
QMessageBox::Ok, QMessageBox::NoButton);
/* Don't process the rest of the pages */
return;
}
}
/* call to RsIface save function.... */
//rsicontrol -> ConfigSave();
QDialog::close();
}

View File

@ -0,0 +1,52 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2006 - 2009 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 RSETTINGSWIN_HPP_
# define RSETTINGSWIN_HPP_
# include <QtGui/QDialog>
# include "ui_settings.h"
class RSettingsWin: public QDialog, private Ui::Settings
{
Q_OBJECT
public:
enum PageType { General = 0, Network, Server,
Directories, Notify, Security, Appearance, Fileassociations, Sound };
RSettingsWin(QWidget * parent = 0, Qt::WFlags flags = 0);
~RSettingsWin() {}
public slots:
//! Go to a specific part of the control panel.
void setNewPage(int page);
private:
void closeEvent (QCloseEvent * event);
void initStackedWidget();
/** Called when user clicks "Save Settings" */
void saveChanges();
};
#endif // !RSETTINGSWIN_HPP_

View File

@ -0,0 +1,331 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Settings</class>
<widget class="QDialog" name="Settings">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>458</width>
<height>366</height>
</rect>
</property>
<property name="windowTitle">
<string>Settings</string>
</property>
<property name="windowIcon">
<iconset>
<normaloff/>
</iconset>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" rowspan="2">
<widget class="QListWidget" name="listWidget">
<property name="minimumSize">
<size>
<width>110</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>110</width>
<height>16777215</height>
</size>
</property>
<property name="alternatingRowColors">
<bool>false</bool>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="textElideMode">
<enum>Qt::ElideMiddle</enum>
</property>
<property name="movement">
<enum>QListView::Static</enum>
</property>
<property name="flow">
<enum>QListView::TopToBottom</enum>
</property>
<property name="isWrapping" stdset="0">
<bool>false</bool>
</property>
<property name="resizeMode">
<enum>QListView::Fixed</enum>
</property>
<property name="layoutMode">
<enum>QListView::SinglePass</enum>
</property>
<property name="gridSize">
<size>
<width>100</width>
<height>24</height>
</size>
</property>
<property name="viewMode">
<enum>QListView::ListMode</enum>
</property>
<property name="modelColumn">
<number>0</number>
</property>
<property name="uniformItemSizes">
<bool>true</bool>
</property>
<property name="currentRow">
<number>-1</number>
</property>
<item>
<property name="text">
<string>General</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/kcmsystem24.png</normaloff>:/images/kcmsystem24.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Network</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/network.png</normaloff>:/images/network.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Server</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/server_24x24.png</normaloff>:/images/server_24x24.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Directories</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/folder_doments.png</normaloff>:/images/folder_doments.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Notify</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/status_unknown.png</normaloff>:/images/status_unknown.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Security</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/encrypted32.png</normaloff>:/images/encrypted32.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Appearance</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/looknfeel.png</normaloff>:/images/looknfeel.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>File Associations</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/filetype-association.png</normaloff>:/images/filetype-association.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Sound</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/sound.png</normaloff>:/images/sound.png</iconset>
</property>
</item>
</widget>
</item>
<item row="0" column="1">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="pageicon">
<property name="maximumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="pageName">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Sans Serif</family>
<pointsize>11</pointsize>
<weight>75</weight>
<italic>false</italic>
<bold>true</bold>
<underline>false</underline>
<strikeout>false</strikeout>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="1">
<widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="page_2"/>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>312</width>
<height>31</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="canceButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>22</height>
</size>
</property>
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="applyButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>22</height>
</size>
</property>
<property name="text">
<string>Apply</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="okButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>22</height>
</size>
</property>
<property name="text">
<string>OK</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="../images.qrc"/>
</resources>
<connections>
<connection>
<sender>okButton</sender>
<signal>clicked()</signal>
<receiver>Settings</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>278</x>
<y>253</y>
</hint>
<hint type="destinationlabel">
<x>96</x>
<y>254</y>
</hint>
</hints>
</connection>
<connection>
<sender>canceButton</sender>
<signal>clicked()</signal>
<receiver>Settings</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>369</x>
<y>253</y>
</hint>
<hint type="destinationlabel">
<x>179</x>
<y>282</y>
</hint>
</hints>
</connection>
</connections>
</ui>