mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-28 08:16:59 -05:00
changed a few pages to not requiring to call save()
This commit is contained in:
parent
53a1993842
commit
bd379e6b89
@ -30,21 +30,18 @@ ChannelPage::ChannelPage(QWidget * parent, Qt::WindowFlags flags)
|
|||||||
|
|
||||||
/* Initialize GroupFrameSettingsWidget */
|
/* Initialize GroupFrameSettingsWidget */
|
||||||
ui.groupFrameSettingsWidget->setOpenAllInNewTabText(tr("Open each channel in a new tab"));
|
ui.groupFrameSettingsWidget->setOpenAllInNewTabText(tr("Open each channel in a new tab"));
|
||||||
|
|
||||||
|
connect(ui.loadThreadCheckBox,SIGNAL(toggled(bool)),this,SLOT(updateLoadThread)) ;
|
||||||
|
|
||||||
|
ui.groupFrameSettingsWidget->setType(GroupFrameSettings::Channel) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ChannelPage::updateLoadThread() { Settings->setChannelLoadThread(ui.loadThreadCheckBox->isChecked()); }
|
||||||
|
|
||||||
ChannelPage::~ChannelPage()
|
ChannelPage::~ChannelPage()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Saves the changes on this page */
|
|
||||||
bool ChannelPage::save(QString &/*errmsg*/)
|
|
||||||
{
|
|
||||||
Settings->setChannelLoadThread(ui.loadThreadCheckBox->isChecked());
|
|
||||||
ui.groupFrameSettingsWidget->saveSettings(GroupFrameSettings::Channel);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Loads the settings for this page */
|
/** Loads the settings for this page */
|
||||||
void ChannelPage::load()
|
void ChannelPage::load()
|
||||||
{
|
{
|
||||||
|
@ -33,8 +33,6 @@ public:
|
|||||||
ChannelPage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
|
ChannelPage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
|
||||||
~ChannelPage();
|
~ChannelPage();
|
||||||
|
|
||||||
/** Saves the changes on this page */
|
|
||||||
virtual bool save(QString &errmsg);
|
|
||||||
/** Loads the settings for this page */
|
/** Loads the settings for this page */
|
||||||
virtual void load();
|
virtual void load();
|
||||||
|
|
||||||
@ -42,6 +40,9 @@ public:
|
|||||||
virtual QString pageName() const { return tr("Channels") ; }
|
virtual QString pageName() const { return tr("Channels") ; }
|
||||||
virtual QString helpText() const { return ""; }
|
virtual QString helpText() const { return ""; }
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
void updateLoadThread() ;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::ChannelPage ui;
|
Ui::ChannelPage ui;
|
||||||
};
|
};
|
||||||
|
@ -92,13 +92,6 @@ CryptoPage::~CryptoPage()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Saves the changes on this page */
|
|
||||||
bool
|
|
||||||
CryptoPage::save(QString &/*errmsg*/)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Loads the settings for this page */
|
/** Loads the settings for this page */
|
||||||
void
|
void
|
||||||
CryptoPage::load()
|
CryptoPage::load()
|
||||||
|
@ -35,8 +35,6 @@ class CryptoPage : public ConfigPage
|
|||||||
/** Default Destructor */
|
/** Default Destructor */
|
||||||
~CryptoPage();
|
~CryptoPage();
|
||||||
|
|
||||||
/** Saves the changes on this page */
|
|
||||||
virtual bool save(QString &errmsg);
|
|
||||||
/** Loads the settings for this page */
|
/** Loads the settings for this page */
|
||||||
|
|
||||||
virtual QPixmap iconPixmap() const { return QPixmap(":/icons/settings/profile.svg") ; }
|
virtual QPixmap iconPixmap() const { return QPixmap(":/icons/settings/profile.svg") ; }
|
||||||
|
@ -37,6 +37,11 @@ DirectoriesPage::DirectoriesPage(QWidget * parent, Qt::WindowFlags flags)
|
|||||||
connect(ui.partialButton, SIGNAL(clicked( bool ) ), this , SLOT( setPartialsDirectory() ) );
|
connect(ui.partialButton, SIGNAL(clicked( bool ) ), this , SLOT( setPartialsDirectory() ) );
|
||||||
connect(ui.editShareButton, SIGNAL(clicked()), this, SLOT(editDirectories()));
|
connect(ui.editShareButton, SIGNAL(clicked()), this, SLOT(editDirectories()));
|
||||||
connect(ui.autoCheckDirectories_CB, SIGNAL(clicked(bool)), this, SLOT(toggleAutoCheckDirectories(bool)));
|
connect(ui.autoCheckDirectories_CB, SIGNAL(clicked(bool)), this, SLOT(toggleAutoCheckDirectories(bool)));
|
||||||
|
|
||||||
|
connect(ui.autoCheckDirectories_CB, SIGNAL(toggled(bool)), this,SLOT(updateAutoCheckDirectories())) ;
|
||||||
|
connect(ui.autoCheckDirectoriesDelay_SB,SIGNAL(valueChanged(int)),this,SLOT(updateAutoScanDirectoriesPeriod())) ;
|
||||||
|
connect(ui.shareDownloadDirectoryCB, SIGNAL(toggled(bool)), this,SLOT(updateShareDownloadDirectory())) ;
|
||||||
|
connect(ui.followSymLinks_CB, SIGNAL(toggled(bool)), this,SLOT(updateFollowSymLinks())) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DirectoriesPage::toggleAutoCheckDirectories(bool b)
|
void DirectoriesPage::toggleAutoCheckDirectories(bool b)
|
||||||
@ -49,29 +54,10 @@ void DirectoriesPage::editDirectories()
|
|||||||
ShareManager::showYourself() ;
|
ShareManager::showYourself() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Saves the changes on this page */
|
void DirectoriesPage::updateAutoCheckDirectories() { rsFiles->setWatchEnabled(ui.autoCheckDirectories_CB->isChecked()) ; }
|
||||||
bool DirectoriesPage::save(QString &/*errmsg*/)
|
void DirectoriesPage::updateAutoScanDirectoriesPeriod() { rsFiles->setWatchPeriod(ui.autoCheckDirectoriesDelay_SB->value()); }
|
||||||
{
|
void DirectoriesPage::updateShareDownloadDirectory() { rsFiles->shareDownloadDirectory(ui.shareDownloadDirectoryCB->isChecked());}
|
||||||
std::string dir = ui.incomingDir->text().toUtf8().constData();
|
void DirectoriesPage::updateFollowSymLinks() { rsFiles->setFollowSymLinks(ui.followSymLinks_CB->isChecked()); }
|
||||||
if (!dir.empty())
|
|
||||||
{
|
|
||||||
rsFiles->setDownloadDirectory(dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
dir = ui.partialsDir->text().toUtf8().constData();
|
|
||||||
if (!dir.empty())
|
|
||||||
{
|
|
||||||
rsFiles->setPartialsDirectory(dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
rsFiles->setWatchEnabled(ui.autoCheckDirectories_CB->isChecked()) ;
|
|
||||||
rsFiles->setWatchPeriod(ui.autoCheckDirectoriesDelay_SB->value());
|
|
||||||
|
|
||||||
rsFiles->shareDownloadDirectory(ui.shareDownloadDirectoryCB->isChecked());
|
|
||||||
rsFiles->setFollowSymLinks(ui.followSymLinks_CB->isChecked());
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Loads the settings for this page */
|
/** Loads the settings for this page */
|
||||||
void DirectoriesPage::load()
|
void DirectoriesPage::load()
|
||||||
@ -95,6 +81,10 @@ void DirectoriesPage::setIncomingDirectory()
|
|||||||
}
|
}
|
||||||
|
|
||||||
ui.incomingDir->setText(qdir);
|
ui.incomingDir->setText(qdir);
|
||||||
|
std::string dir = ui.incomingDir->text().toUtf8().constData();
|
||||||
|
|
||||||
|
if(!dir.empty())
|
||||||
|
rsFiles->setDownloadDirectory(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DirectoriesPage::setPartialsDirectory()
|
void DirectoriesPage::setPartialsDirectory()
|
||||||
@ -105,4 +95,7 @@ void DirectoriesPage::setPartialsDirectory()
|
|||||||
}
|
}
|
||||||
|
|
||||||
ui.partialsDir->setText(qdir);
|
ui.partialsDir->setText(qdir);
|
||||||
|
std::string dir = ui.partialsDir->text().toUtf8().constData();
|
||||||
|
if (!dir.empty())
|
||||||
|
rsFiles->setPartialsDirectory(dir);
|
||||||
}
|
}
|
||||||
|
@ -32,8 +32,6 @@ class DirectoriesPage: public ConfigPage
|
|||||||
public:
|
public:
|
||||||
DirectoriesPage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
|
DirectoriesPage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
|
||||||
|
|
||||||
/** Saves the changes on this page */
|
|
||||||
virtual bool save(QString &errmsg);
|
|
||||||
/** Loads the settings for this page */
|
/** Loads the settings for this page */
|
||||||
virtual void load();
|
virtual void load();
|
||||||
|
|
||||||
@ -47,6 +45,11 @@ private slots:
|
|||||||
void setPartialsDirectory();
|
void setPartialsDirectory();
|
||||||
void toggleAutoCheckDirectories(bool);
|
void toggleAutoCheckDirectories(bool);
|
||||||
|
|
||||||
|
void updateAutoCheckDirectories() ;
|
||||||
|
void updateAutoScanDirectoriesPeriod() ;
|
||||||
|
void updateShareDownloadDirectory() ;
|
||||||
|
void updateFollowSymLinks() ;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::DirectoriesPage ui;
|
Ui::DirectoriesPage ui;
|
||||||
};
|
};
|
||||||
|
@ -131,38 +131,6 @@ FileAssociationsPage::~FileAssociationsPage()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
|
||||||
|
|
||||||
bool
|
|
||||||
FileAssociationsPage::save (QString &/*errmsg*/)
|
|
||||||
{
|
|
||||||
// RshareSettings settings;
|
|
||||||
|
|
||||||
|
|
||||||
// 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
|
void
|
||||||
FileAssociationsPage::load()
|
FileAssociationsPage::load()
|
||||||
{
|
{
|
||||||
|
@ -52,7 +52,6 @@ public:
|
|||||||
virtual ~FileAssociationsPage();
|
virtual ~FileAssociationsPage();
|
||||||
|
|
||||||
virtual void load();
|
virtual void load();
|
||||||
virtual bool save (QString &errmsg);
|
|
||||||
virtual QPixmap iconPixmap() const { return QPixmap(":/images/filetype-association.png") ; }
|
virtual QPixmap iconPixmap() const { return QPixmap(":/images/filetype-association.png") ; }
|
||||||
virtual QString pageName() const { return tr("Associations") ; }
|
virtual QString pageName() const { return tr("Associations") ; }
|
||||||
|
|
||||||
|
@ -30,24 +30,23 @@ ForumPage::ForumPage(QWidget * parent, Qt::WindowFlags flags)
|
|||||||
|
|
||||||
/* Initialize GroupFrameSettingsWidget */
|
/* Initialize GroupFrameSettingsWidget */
|
||||||
ui.groupFrameSettingsWidget->setOpenAllInNewTabText(tr("Open each forum in a new tab"));
|
ui.groupFrameSettingsWidget->setOpenAllInNewTabText(tr("Open each forum in a new tab"));
|
||||||
|
|
||||||
|
connect(ui.setMsgToReadOnActivate,SIGNAL(toggled(bool)),this,SLOT(updateMsgReadOnActivate())) ;
|
||||||
|
connect(ui.expandNewMessages , SIGNAL(toggled(bool)), this, SLOT( updateExpandNewMessages()));
|
||||||
|
connect(ui.loadEmbeddedImages , SIGNAL(toggled(bool)), this, SLOT(updateLoadEmbeddedImage() ));
|
||||||
|
connect(ui.loadEmoticons , SIGNAL(toggled(bool)), this, SLOT( updateLoadEmoticons() ));
|
||||||
|
|
||||||
|
ui.groupFrameSettingsWidget->setType(GroupFrameSettings::Forum) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
ForumPage::~ForumPage()
|
ForumPage::~ForumPage()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Saves the changes on this page */
|
void ForumPage::updateMsgReadOnActivate() { Settings->setForumMsgSetToReadOnActivate(ui.setMsgToReadOnActivate->isChecked()); }
|
||||||
bool ForumPage::save(QString &/*errmsg*/)
|
void ForumPage::updateExpandNewMessages() { Settings->setForumExpandNewMessages( ui.expandNewMessages ->isChecked());}
|
||||||
{
|
void ForumPage::updateLoadEmbeddedImages() { Settings->setForumLoadEmbeddedImages( ui.loadEmbeddedImages ->isChecked());}
|
||||||
Settings->setForumMsgSetToReadOnActivate(ui.setMsgToReadOnActivate->isChecked());
|
void ForumPage::updateLoadEmoticons() { Settings->setForumLoadEmoticons( ui.loadEmoticons ->isChecked()); }
|
||||||
Settings->setForumExpandNewMessages(ui.expandNewMessages->isChecked());
|
|
||||||
Settings->setForumLoadEmbeddedImages(ui.loadEmbeddedImages->isChecked());
|
|
||||||
Settings->setForumLoadEmoticons(ui.loadEmoticons->isChecked());
|
|
||||||
|
|
||||||
ui.groupFrameSettingsWidget->saveSettings(GroupFrameSettings::Forum);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Loads the settings for this page */
|
/** Loads the settings for this page */
|
||||||
void ForumPage::load()
|
void ForumPage::load()
|
||||||
|
@ -33,8 +33,6 @@ public:
|
|||||||
ForumPage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
|
ForumPage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
|
||||||
~ForumPage();
|
~ForumPage();
|
||||||
|
|
||||||
/** Saves the changes on this page */
|
|
||||||
virtual bool save(QString &errmsg);
|
|
||||||
/** Loads the settings for this page */
|
/** Loads the settings for this page */
|
||||||
virtual void load();
|
virtual void load();
|
||||||
|
|
||||||
@ -42,6 +40,12 @@ public:
|
|||||||
virtual QString pageName() const { return tr("Forum") ; }
|
virtual QString pageName() const { return tr("Forum") ; }
|
||||||
virtual QString helpText() const { return ""; }
|
virtual QString helpText() const { return ""; }
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
void updateMsgReadOnActivate();
|
||||||
|
void updateExpandNewMessages();
|
||||||
|
void updateLoadEmbeddedImages();
|
||||||
|
void updateLoadEmoticons();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::ForumPage ui;
|
Ui::ForumPage ui;
|
||||||
};
|
};
|
||||||
|
@ -38,8 +38,6 @@ GeneralPage::GeneralPage(QWidget * parent, Qt::WindowFlags flags) :
|
|||||||
/* Invoke the Qt Designer generated object setup routine */
|
/* Invoke the Qt Designer generated object setup routine */
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
|
||||||
/* Connect signals */
|
|
||||||
connect(ui.runStartWizard_PB,SIGNAL(clicked()), this,SLOT(runStartWizard())) ;
|
|
||||||
|
|
||||||
/* Hide platform specific features */
|
/* Hide platform specific features */
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
@ -82,6 +80,10 @@ GeneralPage::GeneralPage(QWidget * parent, Qt::WindowFlags flags) :
|
|||||||
ui.autoLogin->setEnabled(false);
|
ui.autoLogin->setEnabled(false);
|
||||||
ui.autoLogin->setToolTip(tr("Your RetroShare build has auto-login disabled."));
|
ui.autoLogin->setToolTip(tr("Your RetroShare build has auto-login disabled."));
|
||||||
#endif // RS_AUTOLOGIN
|
#endif // RS_AUTOLOGIN
|
||||||
|
|
||||||
|
/* Connect signals */
|
||||||
|
connect(ui.runStartWizard_PB,SIGNAL(clicked()), this,SLOT(runStartWizard())) ;
|
||||||
|
connect(ui.checkAdvanced,SIGNAL(toggled(bool)), this,SLOT(updateAdvancedMode())) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Destructor */
|
/** Destructor */
|
||||||
@ -93,17 +95,8 @@ void GeneralPage::runStartWizard()
|
|||||||
QuickStartWizard(this).exec();
|
QuickStartWizard(this).exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Saves the changes on this page */
|
void GeneralPage::updateAdvancedMode()
|
||||||
bool GeneralPage::save(QString &/*errmsg*/)
|
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
#ifndef QT_DEBUG
|
|
||||||
Settings->setRunRetroshareOnBoot(ui.chkRunRetroshareAtSystemStartup->isChecked(), ui.chkRunRetroshareAtSystemStartupMinimized->isChecked());
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Settings->setStartMinimized(ui.checkStartMinimized->isChecked());
|
|
||||||
|
|
||||||
if (ui.checkAdvanced->isChecked())
|
if (ui.checkAdvanced->isChecked())
|
||||||
{
|
{
|
||||||
std::string opt("YES");
|
std::string opt("YES");
|
||||||
@ -114,12 +107,27 @@ bool GeneralPage::save(QString &/*errmsg*/)
|
|||||||
std::string opt("NO");
|
std::string opt("NO");
|
||||||
rsConfig->setConfigurationOption(RS_CONFIG_ADVANCED, opt);
|
rsConfig->setConfigurationOption(RS_CONFIG_ADVANCED, opt);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Settings->setValue("doQuit", ui.checkQuit->isChecked());
|
void GeneralPage::updateUseLocalServer() { Settings->setUseLocalServer(ui.useLocalServer->isChecked()); }
|
||||||
Settings->setCloseToTray(ui.checkCloseToTray->isChecked());
|
void GeneralPage::updateMaxTimeBeforeIdle(){ Settings->setMaxTimeBeforeIdle(ui.idleSpinBox->value()); }
|
||||||
RsInit::setAutoLogin(ui.autoLogin->isChecked());
|
void GeneralPage::updateStartMinimized() { Settings->setStartMinimized(ui.checkStartMinimized->isChecked()); }
|
||||||
|
void GeneralPage::updateDoQuit() { Settings->setValue("doQuit", ui.checkQuit->isChecked()); }
|
||||||
|
void GeneralPage::updateCloseToTray() { Settings->setCloseToTray(ui.checkCloseToTray->isChecked()); }
|
||||||
|
void GeneralPage::updateAutoLogin() { RsInit::setAutoLogin(ui.autoLogin->isChecked());}
|
||||||
|
void GeneralPage::updateRunRSOnBoot()
|
||||||
|
{
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
#ifndef QT_DEBUG
|
||||||
|
Settings->setRunRetroshareOnBoot(ui.chkRunRetroshareAtSystemStartup->isChecked(), ui.chkRunRetroshareAtSystemStartupMinimized->isChecked());
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
if (ui.registerRetroShareProtocol->isChecked() != Settings->getRetroShareProtocol()) {
|
void GeneralPage::updateRegisterRSProtocol()
|
||||||
|
{
|
||||||
|
if (ui.registerRetroShareProtocol->isChecked() != Settings->getRetroShareProtocol())
|
||||||
|
{
|
||||||
QString error ="";
|
QString error ="";
|
||||||
if (Settings->setRetroShareProtocol(ui.registerRetroShareProtocol->isChecked(), error) == false) {
|
if (Settings->setRetroShareProtocol(ui.registerRetroShareProtocol->isChecked(), error) == false) {
|
||||||
if (ui.registerRetroShareProtocol->isChecked()) {
|
if (ui.registerRetroShareProtocol->isChecked()) {
|
||||||
@ -129,12 +137,6 @@ bool GeneralPage::save(QString &/*errmsg*/)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Settings->setUseLocalServer(ui.useLocalServer->isChecked());
|
|
||||||
|
|
||||||
Settings->setMaxTimeBeforeIdle(ui.idleSpinBox->value());
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Loads the settings for this page */
|
/** Loads the settings for this page */
|
||||||
|
@ -37,7 +37,6 @@ public:
|
|||||||
~GeneralPage();
|
~GeneralPage();
|
||||||
|
|
||||||
/** Saves the changes on this page */
|
/** Saves the changes on this page */
|
||||||
virtual bool save(QString &errmsg);
|
|
||||||
/** Loads the settings for this page */
|
/** Loads the settings for this page */
|
||||||
virtual void load();
|
virtual void load();
|
||||||
|
|
||||||
@ -47,6 +46,16 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void runStartWizard() ;
|
void runStartWizard() ;
|
||||||
|
void updateAdvancedMode();
|
||||||
|
void updateUseLocalServer() ;
|
||||||
|
void updateMaxTimeBeforeIdle();
|
||||||
|
void updateStartMinimized() ;
|
||||||
|
void updateDoQuit() ;
|
||||||
|
void updateCloseToTray() ;
|
||||||
|
void updateAutoLogin() ;
|
||||||
|
void updateRunRSOnBoot() ;
|
||||||
|
void updateRegisterRSProtocol();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** Qt Designer generated object */
|
/** Qt Designer generated object */
|
||||||
Ui::GeneralPage ui;
|
Ui::GeneralPage ui;
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include "GroupFrameSettingsWidget.h"
|
#include "GroupFrameSettingsWidget.h"
|
||||||
#include "ui_GroupFrameSettingsWidget.h"
|
#include "ui_GroupFrameSettingsWidget.h"
|
||||||
|
|
||||||
@ -7,7 +9,11 @@ GroupFrameSettingsWidget::GroupFrameSettingsWidget(QWidget *parent) :
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
mType = GroupFrameSettings::Nothing ;
|
||||||
mEnable = true;
|
mEnable = true;
|
||||||
|
|
||||||
|
connect(ui->openAllInNewTabCheckBox, SIGNAL(toggled(bool)),this,SLOT(saveSettings())) ;
|
||||||
|
connect(ui->hideTabBarWithOneTabCheckBox,SIGNAL(toggled(bool)),this,SLOT(saveSettings())) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
GroupFrameSettingsWidget::~GroupFrameSettingsWidget()
|
GroupFrameSettingsWidget::~GroupFrameSettingsWidget()
|
||||||
@ -22,6 +28,8 @@ void GroupFrameSettingsWidget::setOpenAllInNewTabText(const QString &text)
|
|||||||
|
|
||||||
void GroupFrameSettingsWidget::loadSettings(GroupFrameSettings::Type type)
|
void GroupFrameSettingsWidget::loadSettings(GroupFrameSettings::Type type)
|
||||||
{
|
{
|
||||||
|
mType = type ;
|
||||||
|
|
||||||
GroupFrameSettings groupFrameSettings;
|
GroupFrameSettings groupFrameSettings;
|
||||||
if (Settings->getGroupFrameSettings(type, groupFrameSettings)) {
|
if (Settings->getGroupFrameSettings(type, groupFrameSettings)) {
|
||||||
ui->openAllInNewTabCheckBox->setChecked(groupFrameSettings.mOpenAllInNewTab);
|
ui->openAllInNewTabCheckBox->setChecked(groupFrameSettings.mOpenAllInNewTab);
|
||||||
@ -32,13 +40,20 @@ void GroupFrameSettingsWidget::loadSettings(GroupFrameSettings::Type type)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupFrameSettingsWidget::saveSettings(GroupFrameSettings::Type type)
|
void GroupFrameSettingsWidget::saveSettings()
|
||||||
|
{
|
||||||
|
if(mType == GroupFrameSettings::Nothing)
|
||||||
|
{
|
||||||
|
std::cerr << "(EE) No type initialized for groupFrameSettings. This is a bug." << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mEnable)
|
||||||
{
|
{
|
||||||
if (mEnable) {
|
|
||||||
GroupFrameSettings groupFrameSettings;
|
GroupFrameSettings groupFrameSettings;
|
||||||
groupFrameSettings.mOpenAllInNewTab = ui->openAllInNewTabCheckBox->isChecked();
|
groupFrameSettings.mOpenAllInNewTab = ui->openAllInNewTabCheckBox->isChecked();
|
||||||
groupFrameSettings.mHideTabBarWithOneTab = ui->hideTabBarWithOneTabCheckBox->isChecked();
|
groupFrameSettings.mHideTabBarWithOneTab = ui->hideTabBarWithOneTabCheckBox->isChecked();
|
||||||
|
|
||||||
Settings->setGroupFrameSettings(type, groupFrameSettings);
|
Settings->setGroupFrameSettings(mType, groupFrameSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,11 +20,15 @@ public:
|
|||||||
void setOpenAllInNewTabText(const QString &text);
|
void setOpenAllInNewTabText(const QString &text);
|
||||||
|
|
||||||
void loadSettings(GroupFrameSettings::Type type);
|
void loadSettings(GroupFrameSettings::Type type);
|
||||||
void saveSettings(GroupFrameSettings::Type type);
|
|
||||||
|
void setType(GroupFrameSettings::Type type) { mType = type ; }
|
||||||
|
protected slots:
|
||||||
|
void saveSettings();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool mEnable;
|
bool mEnable;
|
||||||
Ui::GroupFrameSettingsWidget *ui;
|
Ui::GroupFrameSettingsWidget *ui;
|
||||||
|
GroupFrameSettings::Type mType ;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GROUPFRAMESETTINGSWIDGET_H
|
#endif // GROUPFRAMESETTINGSWIDGET_H
|
||||||
|
@ -210,13 +210,6 @@ PluginsPage::~PluginsPage()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Saves the changes on this page */
|
|
||||||
bool PluginsPage::save(QString &/*errmsg*/)
|
|
||||||
{
|
|
||||||
// nothing to save for now.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Loads the settings for this page */
|
/** Loads the settings for this page */
|
||||||
void PluginsPage::load()
|
void PluginsPage::load()
|
||||||
{
|
{
|
||||||
|
@ -32,8 +32,6 @@ class PluginsPage : public ConfigPage
|
|||||||
PluginsPage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
|
PluginsPage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
|
||||||
~PluginsPage();
|
~PluginsPage();
|
||||||
|
|
||||||
/** Saves the changes on this page */
|
|
||||||
virtual bool save(QString &errmsg);
|
|
||||||
/** Loads the settings for this page */
|
/** Loads the settings for this page */
|
||||||
virtual void load();
|
virtual void load();
|
||||||
|
|
||||||
|
@ -32,20 +32,13 @@ PostedPage::PostedPage(QWidget * parent, Qt::WindowFlags flags)
|
|||||||
|
|
||||||
/* Initialize GroupFrameSettingsWidget */
|
/* Initialize GroupFrameSettingsWidget */
|
||||||
ui->groupFrameSettingsWidget->setOpenAllInNewTabText(tr("Open each topic in a new tab"));
|
ui->groupFrameSettingsWidget->setOpenAllInNewTabText(tr("Open each topic in a new tab"));
|
||||||
|
ui->groupFrameSettingsWidget->setType(GroupFrameSettings::Posted);
|
||||||
}
|
}
|
||||||
|
|
||||||
PostedPage::~PostedPage()
|
PostedPage::~PostedPage()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Saves the changes on this page */
|
|
||||||
bool PostedPage::save(QString &/*errmsg*/)
|
|
||||||
{
|
|
||||||
ui->groupFrameSettingsWidget->saveSettings(GroupFrameSettings::Posted);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Loads the settings for this page */
|
/** Loads the settings for this page */
|
||||||
void PostedPage::load()
|
void PostedPage::load()
|
||||||
{
|
{
|
||||||
|
@ -36,8 +36,6 @@ public:
|
|||||||
PostedPage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
|
PostedPage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
|
||||||
~PostedPage();
|
~PostedPage();
|
||||||
|
|
||||||
/** Saves the changes on this page */
|
|
||||||
virtual bool save(QString &errmsg);
|
|
||||||
/** Loads the settings for this page */
|
/** Loads the settings for this page */
|
||||||
virtual void load();
|
virtual void load();
|
||||||
|
|
||||||
|
@ -51,6 +51,16 @@ RelayPage::RelayPage(QWidget * parent, Qt::WindowFlags flags)
|
|||||||
|
|
||||||
QObject::connect(ui.enableCheckBox,SIGNAL(stateChanged(int)),this,SLOT(updateEnabled()));
|
QObject::connect(ui.enableCheckBox,SIGNAL(stateChanged(int)),this,SLOT(updateEnabled()));
|
||||||
QObject::connect(ui.serverCheckBox,SIGNAL(stateChanged(int)),this,SLOT(updateEnabled()));
|
QObject::connect(ui.serverCheckBox,SIGNAL(stateChanged(int)),this,SLOT(updateEnabled()));
|
||||||
|
|
||||||
|
QObject::connect(ui.noFriendSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateTotals()));
|
||||||
|
QObject::connect(ui.bandFriendSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateTotals()));
|
||||||
|
QObject::connect(ui.noFOFSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateTotals()));
|
||||||
|
QObject::connect(ui.bandFOFSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateTotals()));
|
||||||
|
QObject::connect(ui.noGeneralSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateTotals()));
|
||||||
|
QObject::connect(ui.bandGeneralSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateTotals()));
|
||||||
|
|
||||||
|
QObject::connect(ui.enableCheckBox,SIGNAL(toggled(bool)),this,SLOT(updateRelayMode()));
|
||||||
|
QObject::connect(ui.serverCheckBox,SIGNAL(toggled(bool)),this,SLOT(updateRelayMode()));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString RelayPage::helpText() const
|
QString RelayPage::helpText() const
|
||||||
@ -66,10 +76,8 @@ QString RelayPage::helpText() const
|
|||||||
is encrypted and authenticated by the two relayed nodes.</p>") ;
|
is encrypted and authenticated by the two relayed nodes.</p>") ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Saves the changes on this page */
|
void RelayPage::updateTotals()
|
||||||
bool RelayPage::save(QString &/*errmsg*/)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
int nFriends = ui.noFriendSpinBox->value();
|
int nFriends = ui.noFriendSpinBox->value();
|
||||||
int friendBandwidth = ui.bandFriendSpinBox->value();
|
int friendBandwidth = ui.bandFriendSpinBox->value();
|
||||||
|
|
||||||
@ -85,7 +93,12 @@ bool RelayPage::save(QString &/*errmsg*/)
|
|||||||
rsDht->setRelayAllowance(RSDHT_RELAY_CLASS_FRIENDS, nFriends, 1024 * friendBandwidth);
|
rsDht->setRelayAllowance(RSDHT_RELAY_CLASS_FRIENDS, nFriends, 1024 * friendBandwidth);
|
||||||
rsDht->setRelayAllowance(RSDHT_RELAY_CLASS_FOF, nFOF, 1024 * fofBandwidth);
|
rsDht->setRelayAllowance(RSDHT_RELAY_CLASS_FOF, nFOF, 1024 * fofBandwidth);
|
||||||
rsDht->setRelayAllowance(RSDHT_RELAY_CLASS_GENERAL, nGeneral, 1024 * genBandwidth);
|
rsDht->setRelayAllowance(RSDHT_RELAY_CLASS_GENERAL, nGeneral, 1024 * genBandwidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Saves the changes on this page */
|
||||||
|
|
||||||
|
void RelayPage::updateRelayMode()
|
||||||
|
{
|
||||||
uint32_t relayMode = 0;
|
uint32_t relayMode = 0;
|
||||||
if (ui.enableCheckBox->isChecked())
|
if (ui.enableCheckBox->isChecked())
|
||||||
{
|
{
|
||||||
@ -106,7 +119,6 @@ bool RelayPage::save(QString &/*errmsg*/)
|
|||||||
}
|
}
|
||||||
|
|
||||||
rsDht->setRelayMode(relayMode);
|
rsDht->setRelayMode(relayMode);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Loads the settings for this page */
|
/** Loads the settings for this page */
|
||||||
@ -182,13 +194,9 @@ void RelayPage::updateRelayOptions()
|
|||||||
int genBandwidth = ui.bandGeneralSpinBox->value();
|
int genBandwidth = ui.bandGeneralSpinBox->value();
|
||||||
|
|
||||||
ui.totalFriendLineEdit->setText(QString::number(nFriends * friendBandwidth * 2));
|
ui.totalFriendLineEdit->setText(QString::number(nFriends * friendBandwidth * 2));
|
||||||
|
|
||||||
ui.totalFOFLineEdit->setText(QString::number(nFOF * fofBandwidth * 2));
|
ui.totalFOFLineEdit->setText(QString::number(nFOF * fofBandwidth * 2));
|
||||||
|
|
||||||
ui.totalGeneralLineEdit->setText(QString::number(nGeneral * genBandwidth * 2));
|
ui.totalGeneralLineEdit->setText(QString::number(nGeneral * genBandwidth * 2));
|
||||||
|
|
||||||
ui.totalBandwidthLineEdit->setText(QString::number((nFriends * friendBandwidth + nFOF * fofBandwidth + nGeneral * genBandwidth) * 2));
|
ui.totalBandwidthLineEdit->setText(QString::number((nFriends * friendBandwidth + nFOF * fofBandwidth + nGeneral * genBandwidth) * 2));
|
||||||
|
|
||||||
ui.noTotalLineEdit->setText(QString::number(nFriends + nFOF + nGeneral));
|
ui.noTotalLineEdit->setText(QString::number(nFriends + nFOF + nGeneral));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,8 +35,6 @@ class RelayPage: public ConfigPage
|
|||||||
RelayPage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
|
RelayPage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
|
||||||
~RelayPage() {}
|
~RelayPage() {}
|
||||||
|
|
||||||
/** Saves the changes on this page */
|
|
||||||
virtual bool save(QString &/*errmsg*/);
|
|
||||||
/** Loads the settings for this page */
|
/** Loads the settings for this page */
|
||||||
virtual void load();
|
virtual void load();
|
||||||
|
|
||||||
@ -51,6 +49,8 @@ class RelayPage: public ConfigPage
|
|||||||
void addServer();
|
void addServer();
|
||||||
void removeServer();
|
void removeServer();
|
||||||
void loadServers();
|
void loadServers();
|
||||||
|
void updateTotals();
|
||||||
|
void updateRelayMode();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ SettingsPage::initStackedWidget()
|
|||||||
ui.stackedWidget->setCurrentIndex(-1);
|
ui.stackedWidget->setCurrentIndex(-1);
|
||||||
ui.stackedWidget->removeWidget(ui.stackedWidget->widget(0));
|
ui.stackedWidget->removeWidget(ui.stackedWidget->widget(0));
|
||||||
|
|
||||||
addPage(new GeneralPage(0));
|
addPage(new GeneralPage());
|
||||||
addPage(new ServerPage());
|
addPage(new ServerPage());
|
||||||
addPage(new TransferPage());
|
addPage(new TransferPage());
|
||||||
addPage(new RelayPage() );
|
addPage(new RelayPage() );
|
||||||
@ -211,39 +211,11 @@ SettingsPage::setNewPage(int page)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Saves changes made to settings. */
|
/** Saves changes made to settings. */
|
||||||
void
|
void SettingsPage::notifySettingsChanged()
|
||||||
SettingsPage::saveChanges()
|
|
||||||
{
|
{
|
||||||
QString errmsg;
|
|
||||||
|
|
||||||
/* Call each config page's save() method to save its data */
|
|
||||||
int i, count = ui.stackedWidget->count();
|
|
||||||
for (i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
ConfigPage *page = dynamic_cast<ConfigPage *>(ui.stackedWidget->widget(i));
|
|
||||||
if (page && page->wasLoaded()) {
|
|
||||||
if (!page->save(errmsg))
|
|
||||||
{
|
|
||||||
/* Display the offending page */
|
|
||||||
ui.stackedWidget->setCurrentWidget(page);
|
|
||||||
|
|
||||||
/* Show the user what went wrong */
|
|
||||||
QMessageBox::warning(this,
|
|
||||||
tr("Error Saving Configuration on page")+" "+QString::number(i), errmsg,
|
|
||||||
QMessageBox::Ok, QMessageBox::NoButton);
|
|
||||||
|
|
||||||
/* Don't process the rest of the pages */
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* call to RsIface save function.... */
|
/* call to RsIface save function.... */
|
||||||
//rsicontrol -> ConfigSave();
|
//rsicontrol -> ConfigSave();
|
||||||
|
|
||||||
if (NotifyQt::getInstance()) {
|
if (NotifyQt::getInstance())
|
||||||
NotifyQt::getInstance()->notifySettingsChanged();
|
NotifyQt::getInstance()->notifySettingsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
close();
|
|
||||||
}
|
|
||||||
|
@ -58,8 +58,10 @@ public slots:
|
|||||||
void setNewPage(int page);
|
void setNewPage(int page);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
/** Called when user clicks "Save Settings" */
|
void notifySettingsChanged();
|
||||||
void saveChanges();
|
|
||||||
|
// Called when user clicks "Save Settings"
|
||||||
|
//void saveChanges();
|
||||||
//void dialogFinished(int result);
|
//void dialogFinished(int result);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -67,7 +69,6 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
FloatingHelpBrowser *mHelpBrowser;
|
FloatingHelpBrowser *mHelpBrowser;
|
||||||
//static RSettingsWin *_instance;
|
|
||||||
static int lastPage;
|
static int lastPage;
|
||||||
|
|
||||||
/* UI - from Designer */
|
/* UI - from Designer */
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#ifndef _CONFIGPAGE_H
|
#ifndef _CONFIGPAGE_H
|
||||||
#define _CONFIGPAGE_H
|
#define _CONFIGPAGE_H
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
class ConfigPage : public QWidget
|
class ConfigPage : public QWidget
|
||||||
@ -37,8 +38,6 @@ class ConfigPage : public QWidget
|
|||||||
/** Pure virtual method. Subclassed pages save their config settings here
|
/** Pure virtual method. Subclassed pages save their config settings here
|
||||||
* and return true if everything was saved successfully. */
|
* and return true if everything was saved successfully. */
|
||||||
|
|
||||||
virtual bool save(QString &errmsg) = 0;
|
|
||||||
|
|
||||||
bool wasLoaded() { return loaded ; }
|
bool wasLoaded() { return loaded ; }
|
||||||
|
|
||||||
// Icon to be used to display the config page.
|
// Icon to be used to display the config page.
|
||||||
@ -53,6 +52,8 @@ class ConfigPage : public QWidget
|
|||||||
//
|
//
|
||||||
virtual QString helpText() const = 0;
|
virtual QString helpText() const = 0;
|
||||||
|
|
||||||
|
private:
|
||||||
|
virtual bool save(QString &errmsg) { std::cerr << "(EE) save() shoud not be called!" << std::endl; return true;}
|
||||||
protected:
|
protected:
|
||||||
virtual void showEvent(QShowEvent * /*event*/)
|
virtual void showEvent(QShowEvent * /*event*/)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user