Merge pull request #675 from csoler/v0.6-ImprovedGUI

V0.6 improved gui
This commit is contained in:
csoler 2017-01-31 23:24:09 +01:00 committed by GitHub
commit 3eedf1be58
47 changed files with 792 additions and 712 deletions

View File

@ -1063,9 +1063,8 @@ bool p3GxsReputation::saveList(bool& cleanup, std::list<RsItem*> &savelist)
cleanup = true;
RsStackMutex stack(mReputationMtx); /****** LOCKED MUTEX *******/
#ifdef DEBUG_REPUTATION
std::cerr << "p3GxsReputation::saveList()" << std::endl;
#endif
/* save */
std::map<RsPeerId, ReputationConfig>::iterator it;
for(it = mConfig.begin(); it != mConfig.end(); ++it)

View File

@ -36,8 +36,6 @@ public:
/** Default Destructor */
~AboutPage();
/** Saves the changes on this page */
virtual bool save(QString &errmsg) { return true;}
/** Loads the settings for this page */
virtual void load();

View File

@ -31,6 +31,7 @@
#include "AppearancePage.h"
#include "rsharesettings.h"
#include "gui/MainWindow.h"
#include "gui/notifyqt.h"
#include "gui/statusbar/peerstatus.h"
#include "gui/statusbar/natstatus.h"
#include "gui/statusbar/dhtstatus.h"
@ -83,44 +84,66 @@ AppearancePage::AppearancePage(QWidget * parent, Qt::WindowFlags flags)
foreach (QString name, styleSheets.keys()) {
ui.cmboStyleSheet->addItem(name, styleSheets[name]);
}
connect(ui.cmboTollButtonsSize, SIGNAL(currentIndexChanged(int)), this, SLOT(updateCmboToolButtonSize() ));
connect(ui.cmboListItemSize, SIGNAL(currentIndexChanged(int)), this, SLOT(updateCmboListItemSize() ));
connect(ui.cmboTollButtonsStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(updateCmboToolButtonStyle()));
connect(ui.cmboLanguage, SIGNAL(currentIndexChanged(int)), this, SLOT(updateLanguageCode() ));
connect(ui.cmboStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(updateInterfaceStyle() ));
connect(ui.cmboStyleSheet, SIGNAL(currentIndexChanged(int)), this, SLOT(updateSheetName() ));
connect(ui.checkBoxDisableSysTrayToolTip, SIGNAL(toggled(bool)), this, SLOT(updateStatusToolTip() ));
connect(ui.mainPageButtonType_CB, SIGNAL(currentIndexChanged(int)), this, SLOT(updateRbtPageOnToolBar() ));
connect(ui.menuItemsButtonType_CB, SIGNAL(currentIndexChanged(int)), this, SLOT(updateActionButtonLoc() ));
}
void AppearancePage::switch_status_grpStatus(bool b) { switch_status(MainWindow::StatusGrpStatus ,b) ; }
void AppearancePage::switch_status_compactMode(bool b) { switch_status(MainWindow::StatusCompactMode,b) ; }
void AppearancePage::switch_status_showToolTip(bool b) { switch_status(MainWindow::StatusShowToolTip,b) ; }
void AppearancePage::switch_status_ShowStatus(bool b) { switch_status(MainWindow::StatusShowStatus ,b) ; }
void AppearancePage::switch_status_ShowPeer(bool b) { switch_status(MainWindow::StatusShowPeer ,b) ; }
void AppearancePage::switch_status_ShowDHT(bool b) { switch_status(MainWindow::StatusShowDHT ,b) ; }
void AppearancePage::switch_status_ShowHashing(bool b) { switch_status(MainWindow::StatusShowHashing,b) ; }
void AppearancePage::switch_status_ShowDisc(bool b) { switch_status(MainWindow::StatusShowDisc ,b) ; }
void AppearancePage::switch_status_ShowRate(bool b) { switch_status(MainWindow::StatusShowRate ,b) ; }
void AppearancePage::switch_status_ShowOpMode(bool b) { switch_status(MainWindow::StatusShowOpMode ,b) ; }
void AppearancePage::switch_status_ShowSound(bool b) { switch_status(MainWindow::StatusShowSound ,b) ; }
void AppearancePage::switch_status_ShowToaster(bool b) { switch_status(MainWindow::StatusShowToaster,b) ; }
void AppearancePage::switch_status_ShowSystray(bool b) { switch_status(MainWindow::StatusShowSystray,b) ; }
void AppearancePage::switch_status_grpStatus(bool b) { switch_status(MainWindow::StatusGrpStatus ,"ShowStatusBar", b) ; }
void AppearancePage::switch_status_compactMode(bool b) { switch_status(MainWindow::StatusCompactMode,"CompactMode", b) ; }
void AppearancePage::switch_status_showToolTip(bool b) { switch_status(MainWindow::StatusShowToolTip,"DisableSysTrayToolTip", b) ; }
void AppearancePage::switch_status_ShowStatus(bool b) { switch_status(MainWindow::StatusShowStatus ,"ShowStatus", b) ; }
void AppearancePage::switch_status_ShowPeer(bool b) { switch_status(MainWindow::StatusShowPeer ,"ShowPeer", b) ; }
void AppearancePage::switch_status_ShowDHT(bool b) { switch_status(MainWindow::StatusShowDHT ,"ShowDHT", b) ; }
void AppearancePage::switch_status_ShowHashing(bool b) { switch_status(MainWindow::StatusShowHashing,"ShowHashing", b) ; }
void AppearancePage::switch_status_ShowDisc(bool b) { switch_status(MainWindow::StatusShowDisc ,"ShowDisc", b) ; }
void AppearancePage::switch_status_ShowRate(bool b) { switch_status(MainWindow::StatusShowRate ,"ShowRate", b) ; }
void AppearancePage::switch_status_ShowOpMode(bool b) { switch_status(MainWindow::StatusShowOpMode ,"ShowOpMode", b) ; }
void AppearancePage::switch_status_ShowSound(bool b) { switch_status(MainWindow::StatusShowSound ,"ShowSound", b) ; }
void AppearancePage::switch_status_ShowToaster(bool b) { switch_status(MainWindow::StatusShowToaster,"ShowToaster", b) ; }
void AppearancePage::switch_status_ShowSystray(bool b) { switch_status(MainWindow::StatusShowSystray,"ShowSysTrayOnStatusBar",b) ; }
void AppearancePage::switch_status(MainWindow::StatusElement s,bool b)
void AppearancePage::switch_status(MainWindow::StatusElement s,const QString& key, bool b)
{
MainWindow *pMainWindow = MainWindow::getInstance();
if(!pMainWindow)
return ;
Settings->setValueToGroup("StatusBar", key, QVariant(b));
pMainWindow->switchVisibilityStatus(s,b) ;
}
/** Saves the changes on this page */
bool AppearancePage::save(QString &errmsg)
void AppearancePage::updateLanguageCode() { Settings->setLanguageCode(LanguageSupport::languageCode(ui.cmboLanguage->currentText())); }
void AppearancePage::updateInterfaceStyle()
{
Q_UNUSED(errmsg);
Rshare::setStyle(ui.cmboStyle->currentText());
Settings->setInterfaceStyle(ui.cmboStyle->currentText());
}
void AppearancePage::updateSheetName() { Settings->setSheetName(ui.cmboStyleSheet->itemData(ui.cmboStyleSheet->currentIndex()).toString()); }
void AppearancePage::updateRbtPageOnToolBar()
{
Settings->setPageButtonLoc(!ui.mainPageButtonType_CB->currentIndex());
NotifyQt::getInstance()->notifySettingsChanged();
}
void AppearancePage::updateActionButtonLoc()
{
Settings->setActionButtonLoc(!ui.menuItemsButtonType_CB->currentIndex());
NotifyQt::getInstance()->notifySettingsChanged();
}
void AppearancePage::updateStatusToolTip() { MainWindow::getInstance()->toggleStatusToolTip(ui.checkBoxDisableSysTrayToolTip->isChecked()); }
QString languageCode = LanguageSupport::languageCode(ui.cmboLanguage->currentText());
Settings->setLanguageCode(languageCode);
Settings->setInterfaceStyle(ui.cmboStyle->currentText());
Settings->setSheetName(ui.cmboStyleSheet->itemData(ui.cmboStyleSheet->currentIndex()).toString());
Settings->setPageButtonLoc(ui.rbtPageOnToolBar->isChecked());
Settings->setActionButtonLoc(ui.rbtActionOnToolBar->isChecked());
void AppearancePage::updateCmboToolButtonStyle()
{
switch (ui.cmboTollButtonsStyle->currentIndex())
{
case 0:
@ -136,6 +159,11 @@ bool AppearancePage::save(QString &errmsg)
default:
Settings->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
}
NotifyQt::getInstance()->notifySettingsChanged();
}
void AppearancePage::updateCmboToolButtonSize()
{
switch (ui.cmboTollButtonsSize->currentIndex())
{
case 0:
@ -157,6 +185,10 @@ bool AppearancePage::save(QString &errmsg)
case 5:
Settings->setToolButtonSize(128);
}
NotifyQt::getInstance()->notifySettingsChanged();
}
void AppearancePage::updateCmboListItemSize()
{
switch (ui.cmboListItemSize->currentIndex())
{
case 0:
@ -178,29 +210,11 @@ bool AppearancePage::save(QString &errmsg)
case 5:
Settings->setListItemIconSize(128);
}
/* Set to new style */
Rshare::setStyle(ui.cmboStyle->currentText());
Settings->setValueToGroup("StatusBar", "ShowStatusBar", QVariant(ui.grpStatus->isChecked()));
Settings->setValueToGroup("StatusBar", "CompactMode", QVariant(ui.checkBoxStatusCompactMode->isChecked()));
Settings->setValueToGroup("StatusBar", "DisableSysTrayToolTip", QVariant(ui.checkBoxDisableSysTrayToolTip->isChecked()));
MainWindow::getInstance()->toggleStatusToolTip(ui.checkBoxDisableSysTrayToolTip->isChecked());
Settings->setValueToGroup("StatusBar", "ShowStatus", QVariant(ui.checkBoxShowStatusStatus->isChecked()));
Settings->setValueToGroup("StatusBar", "ShowPeer", QVariant(ui.checkBoxShowPeerStatus->isChecked()));
Settings->setValueToGroup("StatusBar", "ShowNAT", QVariant(ui.checkBoxShowNATStatus->isChecked()));
Settings->setValueToGroup("StatusBar", "ShowDHT", QVariant(ui.checkBoxShowDHTStatus->isChecked()));
Settings->setValueToGroup("StatusBar", "ShowHashing", QVariant(ui.checkBoxShowHashingStatus->isChecked()));
Settings->setValueToGroup("StatusBar", "ShowDisc", QVariant(ui.checkBoxShowDiscStatus->isChecked()));
Settings->setValueToGroup("StatusBar", "ShowRate", QVariant(ui.checkBoxShowRateStatus->isChecked()));
Settings->setValueToGroup("StatusBar", "ShowOpMode", QVariant(ui.checkBoxShowOpModeStatus->isChecked()));
Settings->setValueToGroup("StatusBar", "ShowSound", QVariant(ui.checkBoxShowSoundStatus->isChecked()));
Settings->setValueToGroup("StatusBar", "ShowToaster", QVariant(ui.checkBoxShowToasterDisable->isChecked()));
Settings->setValueToGroup("StatusBar", "ShowSysTrayOnStatusBar", QVariant(ui.checkBoxShowSystrayOnStatus->isChecked()));
return true;
NotifyQt::getInstance()->notifySettingsChanged();
}
void AppearancePage::updateStyle() { Rshare::setStyle(ui.cmboStyle->currentText()); }
/** Loads the settings for this page */
void AppearancePage::load()
{
@ -217,10 +231,9 @@ void AppearancePage::load()
}
ui.cmboStyleSheet->setCurrentIndex(index);
ui.rbtPageOnToolBar->setChecked(Settings->getPageButtonLoc());
ui.rbtPageOnListItem->setChecked(!Settings->getPageButtonLoc());
ui.rbtActionOnToolBar->setChecked(Settings->getActionButtonLoc());
ui.rbtActionOnListItem->setChecked(!Settings->getActionButtonLoc());
ui.mainPageButtonType_CB->setCurrentIndex(!Settings->getPageButtonLoc());
ui.menuItemsButtonType_CB->setCurrentIndex(!Settings->getActionButtonLoc());
switch (Settings->getToolButtonStyle())
{
case Qt::ToolButtonIconOnly:

View File

@ -34,8 +34,6 @@ public:
/** Default Constructor */
AppearancePage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
/** Saves the changes on this page */
virtual bool save(QString &errmsg);
/** Loads the settings for this page */
virtual void load();
@ -60,8 +58,20 @@ private slots:
void switch_status_ShowToaster(bool) ;
void switch_status_ShowSystray(bool) ;
void updateLanguageCode() ;
void updateInterfaceStyle() ;
void updateSheetName() ;
void updateRbtPageOnToolBar();
void updateActionButtonLoc() ;
void updateStatusToolTip() ;
void updateCmboToolButtonStyle();
void updateCmboToolButtonSize();
void updateCmboListItemSize();
void updateStyle() ;
private:
void switch_status(MainWindow::StatusElement s,bool b);
void switch_status(MainWindow::StatusElement s,const QString& key,bool b);
/** Qt Designer generated object */
Ui::AppearancePage ui;

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>1160</width>
<height>608</height>
<height>897</height>
</rect>
</property>
<property name="contextMenuPolicy">
@ -44,13 +44,6 @@
<string>Language</string>
</property>
<layout class="QGridLayout" name="grpLanguageGLayout">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="labelLanguage">
<property name="text">
<string>Changes to language will only take effect after restarting RetroShare!</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QComboBox" name="cmboLanguage">
<property name="minimumSize">
@ -70,7 +63,7 @@
</property>
</widget>
</item>
<item row="1" column="1">
<item row="1" column="2">
<spacer name="grpLanguageHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -83,6 +76,13 @@
</property>
</spacer>
</item>
<item row="1" column="1">
<widget class="QLabel" name="labelLanguage">
<property name="text">
<string>(Needs restart)</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -198,124 +198,84 @@
<property name="title">
<string>Tool Bar</string>
</property>
<layout class="QGridLayout" name="grpToolBarGLayout">
<item row="4" column="0">
<widget class="QFrame" name="frameAction">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<layout class="QHBoxLayout" name="frameActionHLayout">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<widget class="QRadioButton" name="rbtActionOnToolBar">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="labelPageToolBar">
<property name="text">
<string>Main page items:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="mainPageButtonType_CB">
<item>
<property name="text">
<string>On Tool Bar</string>
<string>Buttons</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rbtActionOnListItem">
</item>
<item>
<property name="text">
<string>On List Ite&amp;m</string>
<string>Item list</string>
</property>
</widget>
</item>
<item>
<spacer name="frameActionHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>300</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</widget>
</item>
<item>
<spacer name="framePageHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>300</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="3" column="0">
<widget class="QLabel" name="labelActionToolBar">
<property name="text">
<string>Where do you want to have the buttons for menu?</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QFrame" name="framePage">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<layout class="QHBoxLayout" name="framePageHLayout">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<widget class="QRadioButton" name="rbtPageOnToolBar">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="labelActionToolBar">
<property name="text">
<string>Menu items:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="menuItemsButtonType_CB">
<item>
<property name="text">
<string>On Tool Bar</string>
<string>Buttons</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rbtPageOnListItem">
</item>
<item>
<property name="text">
<string>On List Item</string>
<string>Item list</string>
</property>
</widget>
</item>
<item>
<spacer name="framePageHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>300</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</widget>
</item>
<item>
<spacer name="frameActionHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>300</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelPageToolBar">
<property name="text">
<string>Where do you want to have the buttons for the page?</string>
</property>
</widget>
</item>
<item row="5" column="0">
<item>
<widget class="QFrame" name="frameToolListStyle">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">

View File

@ -30,21 +30,17 @@ ChannelPage::ChannelPage(QWidget * parent, Qt::WindowFlags flags)
/* Initialize GroupFrameSettingsWidget */
ui.groupFrameSettingsWidget->setOpenAllInNewTabText(tr("Open each channel in a new tab"));
ui.groupFrameSettingsWidget->setType(GroupFrameSettings::Channel) ;
connect(ui.loadThreadCheckBox,SIGNAL(toggled(bool)),this,SLOT(updateLoadThread)) ;
}
void ChannelPage::updateLoadThread() { Settings->setChannelLoadThread(ui.loadThreadCheckBox->isChecked()); }
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 */
void ChannelPage::load()
{

View File

@ -33,8 +33,6 @@ public:
ChannelPage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
~ChannelPage();
/** Saves the changes on this page */
virtual bool save(QString &errmsg);
/** Loads the settings for this page */
virtual void load();
@ -42,6 +40,9 @@ public:
virtual QString pageName() const { return tr("Channels") ; }
virtual QString helpText() const { return ""; }
protected slots:
void updateLoadThread() ;
private:
Ui::ChannelPage ui;
};

View File

@ -93,6 +93,117 @@ static QString loadStyleInfo(ChatStyle::enumStyleType type, QListWidget *listWid
}
return stylePath;
}
void ChatPage::updateFontsAndEmotes()
{
Settings->beginGroup(QString("Chat"));
Settings->setValue("Emoteicons_PrivatChat", ui.checkBox_emoteprivchat->isChecked());
Settings->setValue("Emoteicons_GroupChat", ui.checkBox_emotegroupchat->isChecked());
Settings->setValue("EnableCustomFonts", ui.checkBox_enableCustomFonts->isChecked());
Settings->setValue("EnableCustomFontSize", ui.checkBox_enableCustomFontSize->isChecked());
Settings->setValue("MinimumFontSize", ui.minimumFontSize->value());
Settings->setValue("EnableBold", ui.checkBox_enableBold->isChecked());
Settings->setValue("EnableItalics", ui.checkBox_enableItalics->isChecked());
Settings->setValue("MinimumContrast", ui.minimumContrast->value());
Settings->endGroup();
}
/** Saves the changes on this page */
void ChatPage::updateChatParams()
{
// state of distant Chat combobox
Settings->setValue("DistantChat", ui.distantChatComboBox->currentIndex());
Settings->setChatScreenFont(fontTempChat.toString());
NotifyQt::getInstance()->notifyChatFontChanged();
Settings->setChatSendMessageWithCtrlReturn(ui.sendMessageWithCtrlReturn->isChecked());
Settings->setChatSendAsPlainTextByDef(ui.sendAsPlainTextByDef->isChecked());
Settings->setChatLoadEmbeddedImages(ui.loadEmbeddedImages->isChecked());
Settings->setChatDoNotSendIsTyping(ui.DontSendTyping->isChecked());
}
void ChatPage::updateChatSearchParams()
{
Settings->setChatSearchCharToStartSearch(ui.sbSearch_CharToStart->value());
Settings->setChatSearchCaseSensitively(ui.cbSearch_CaseSensitively->isChecked());
Settings->setChatSearchWholeWords(ui.cbSearch_WholeWords->isChecked());
Settings->setChatSearchMoveToCursor(ui.cbSearch_MoveToCursor->isChecked());
Settings->setChatSearchSearchWithoutLimit(ui.cbSearch_WithoutLimit->isChecked());
Settings->setChatSearchMaxSearchLimitColor(ui.sbSearch_MaxLimitColor->value());
Settings->setChatSearchFoundColor(rgbChatSearchFoundColor);
}
void ChatPage::updateDefaultLobbyIdentity()
{
RsGxsId chosen_id ;
switch(ui.chatLobbyIdentity_IC->getChosenId(chosen_id))
{
case GxsIdChooser::KnowId:
case GxsIdChooser::UnKnowId:
rsMsgs->setDefaultIdentityForChatLobby(chosen_id) ;
break ;
default:;
}
}
void ChatPage::updateHistoryParams()
{
Settings->setPublicChatHistoryCount(ui.publicChatLoadCount->value());
Settings->setPrivateChatHistoryCount(ui.privateChatLoadCount->value());
Settings->setLobbyChatHistoryCount(ui.lobbyChatLoadCount->value());
rsHistory->setEnable(RS_HISTORY_TYPE_PUBLIC , ui.publicChatEnable->isChecked());
rsHistory->setEnable(RS_HISTORY_TYPE_PRIVATE, ui.privateChatEnable->isChecked());
rsHistory->setEnable(RS_HISTORY_TYPE_LOBBY , ui.lobbyChatEnable->isChecked());
rsHistory->setSaveCount(RS_HISTORY_TYPE_PUBLIC , ui.publicChatSaveCount->value());
rsHistory->setSaveCount(RS_HISTORY_TYPE_PRIVATE, ui.privateChatSaveCount->value());
rsHistory->setSaveCount(RS_HISTORY_TYPE_LOBBY , ui.lobbyChatSaveCount->value());
}
void ChatPage::updatePublicStyle()
{
ChatStyleInfo info;
QListWidgetItem *item = ui.publicList->currentItem();
if (item) {
info = item->data(Qt::UserRole).value<ChatStyleInfo>();
if (publicStylePath != info.stylePath || publicStyleVariant != ui.publicComboBoxVariant->currentText()) {
Settings->setPublicChatStyle(info.stylePath, ui.publicComboBoxVariant->currentText());
NotifyQt::getInstance()->notifyChatStyleChanged(ChatStyle::TYPE_PUBLIC);
}
}
}
void ChatPage::updatePrivateStyle()
{
ChatStyleInfo info;
QListWidgetItem *item = ui.privateList->currentItem();
if (item) {
info = item->data(Qt::UserRole).value<ChatStyleInfo>();
if (privateStylePath != info.stylePath || privateStyleVariant != ui.privateComboBoxVariant->currentText()) {
Settings->setPrivateChatStyle(info.stylePath, ui.privateComboBoxVariant->currentText());
NotifyQt::getInstance()->notifyChatStyleChanged(ChatStyle::TYPE_PRIVATE);
}
}
}
void ChatPage::updateHistoryStyle()
{
ChatStyleInfo info;
QListWidgetItem *item = ui.historyList->currentItem();
if (item) {
info = item->data(Qt::UserRole).value<ChatStyleInfo>();
if (historyStylePath != info.stylePath || historyStyleVariant != ui.historyComboBoxVariant->currentText()) {
Settings->setHistoryChatStyle(info.stylePath, ui.historyComboBoxVariant->currentText());
NotifyQt::getInstance()->notifyChatStyleChanged(ChatStyle::TYPE_HISTORY);
}
}
}
void ChatPage::updateHistoryStorage() { rsHistory->setMaxStorageDuration(ui.max_storage_period->value() * 86400) ; }
/** Constructor */
ChatPage::ChatPage(QWidget * parent, Qt::WindowFlags flags)
@ -101,121 +212,87 @@ ChatPage::ChatPage(QWidget * parent, Qt::WindowFlags flags)
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
connect(ui.distantChatComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(distantChatComboBoxChanged(int)));
#if QT_VERSION < 0x040600
ui.minimumContrastLabel->hide();
ui.minimumContrast->hide();
#endif
connect(ui.distantChatComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(distantChatComboBoxChanged(int)));
connect(ui.checkBox_emoteprivchat, SIGNAL(toggled(bool)), this, SLOT(updateFontsAndEmotes()));
connect(ui.checkBox_emotegroupchat, SIGNAL(toggled(bool)), this, SLOT(updateFontsAndEmotes()));
connect(ui.checkBox_enableCustomFonts, SIGNAL(toggled(bool)), this, SLOT(updateFontsAndEmotes()));
connect(ui.minimumFontSize, SIGNAL(valueChanged(int)), this, SLOT(updateFontsAndEmotes()));
connect(ui.checkBox_enableBold, SIGNAL(toggled(bool)), this, SLOT(updateFontsAndEmotes()));
connect(ui.checkBox_enableItalics, SIGNAL(toggled(bool)), this, SLOT(updateFontsAndEmotes()));
connect(ui.minimumContrast, SIGNAL(valueChanged(int)), this, SLOT(updateFontsAndEmotes()));
connect(ui.distantChatComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateChatParams()));
connect(ui.sendMessageWithCtrlReturn, SIGNAL(toggled(bool)), this, SLOT(updateChatParams()));
connect(ui.sendAsPlainTextByDef, SIGNAL(toggled(bool)), this, SLOT(updateChatParams()));
connect(ui.loadEmbeddedImages, SIGNAL(toggled(bool)), this, SLOT(updateChatParams()));
connect(ui.DontSendTyping, SIGNAL(toggled(bool)), this, SLOT(updateChatParams()));
connect(ui.sbSearch_CharToStart, SIGNAL(valueChanged(int)), this, SLOT(updateChatSearchParams()));
connect(ui.cbSearch_CaseSensitively, SIGNAL(toggled(bool)), this, SLOT(updateChatSearchParams()));
connect(ui.cbSearch_WholeWords, SIGNAL(toggled(bool)), this, SLOT(updateChatSearchParams()));
connect(ui.cbSearch_MoveToCursor, SIGNAL(toggled(bool)), this, SLOT(updateChatSearchParams()));
connect(ui.cbSearch_WithoutLimit, SIGNAL(toggled(bool)), this, SLOT(updateChatSearchParams()));
connect(ui.sbSearch_MaxLimitColor, SIGNAL(valueChanged(int)), this, SLOT(updateChatSearchParams()));
connect(ui.chatLobbyIdentity_IC, SIGNAL(currentIndexChanged(int)), this, SLOT(updateDefaultLobbyIdentity()));
connect(ui.publicChatLoadCount, SIGNAL(valueChanged(int)), this, SLOT(updateHistoryParams()));
connect(ui.privateChatLoadCount, SIGNAL(valueChanged(int)), this, SLOT(updateHistoryParams()));
connect(ui.lobbyChatLoadCount, SIGNAL(valueChanged(int)), this, SLOT(updateHistoryParams()));
connect(ui.publicChatEnable, SIGNAL(toggled(bool)), this, SLOT(updateHistoryParams()));
connect(ui.privateChatEnable, SIGNAL(toggled(bool)), this, SLOT(updateHistoryParams()));
connect(ui.lobbyChatEnable, SIGNAL(toggled(bool)), this, SLOT(updateHistoryParams()));
connect(ui.publicChatSaveCount, SIGNAL(valueChanged(int)), this, SLOT(updateHistoryParams()));
connect(ui.privateChatSaveCount, SIGNAL(valueChanged(int)), this, SLOT(updateHistoryParams()));
connect(ui.lobbyChatSaveCount, SIGNAL(valueChanged(int)), this, SLOT(updateHistoryParams()));
connect(ui.publicList, SIGNAL(currentRowChanged(int)), this, SLOT(updatePublicStyle())) ;
connect(ui.publicComboBoxVariant, SIGNAL(currentIndexChanged(int)), this, SLOT(updatePublicStyle())) ;
connect(ui.privateList, SIGNAL(currentRowChanged(int)), this, SLOT(updatePrivateStyle())) ;
connect(ui.privateComboBoxVariant, SIGNAL(currentIndexChanged(int)), this, SLOT(updatePrivateStyle())) ;
connect(ui.historyList, SIGNAL(currentRowChanged(int)), this, SLOT(updateHistoryStyle())) ;
connect(ui.historyComboBoxVariant, SIGNAL(currentIndexChanged(int)), this, SLOT(updateHistoryStyle())) ;
connect(ui.max_storage_period, SIGNAL(valueChanged(int)), this, SLOT(updateHistoryStorage())) ;
connect(ui.chat_NewWindow, SIGNAL(toggled(bool)), this, SLOT(updateChatFlags()));
connect(ui.chat_Focus, SIGNAL(toggled(bool)), this, SLOT(updateChatFlags()));
connect(ui.chat_tabbedWindow, SIGNAL(toggled(bool)), this, SLOT(updateChatFlags()));
connect(ui.chat_Blink, SIGNAL(toggled(bool)), this, SLOT(updateChatFlags()));
connect(ui.chatLobby_Blink, SIGNAL(toggled(bool)), this, SLOT(updateChatLobbyFlags()));
}
void ChatPage::updateChatFlags()
{
uint chatflags = 0;
if (ui.chat_NewWindow->isChecked())
chatflags |= RS_CHAT_OPEN;
if (ui.chat_Focus->isChecked())
chatflags |= RS_CHAT_FOCUS;
if (ui.chat_tabbedWindow->isChecked())
chatflags |= RS_CHAT_TABBED_WINDOW;
if (ui.chat_Blink->isChecked())
chatflags |= RS_CHAT_BLINK;
Settings->setChatFlags(chatflags);
}
/** Saves the changes on this page */
bool
ChatPage::save(QString &/*errmsg*/)
void ChatPage::updateChatLobbyFlags()
{
Settings->beginGroup(QString("Chat"));
Settings->setValue("Emoteicons_PrivatChat", ui.checkBox_emoteprivchat->isChecked());
Settings->setValue("Emoteicons_GroupChat", ui.checkBox_emotegroupchat->isChecked());
Settings->setValue("EnableCustomFonts", ui.checkBox_enableCustomFonts->isChecked());
Settings->setValue("EnableCustomFontSize", ui.checkBox_enableCustomFontSize->isChecked());
Settings->setValue("MinimumFontSize", ui.minimumFontSize->value());
Settings->setValue("EnableBold", ui.checkBox_enableBold->isChecked());
Settings->setValue("EnableItalics", ui.checkBox_enableItalics->isChecked());
Settings->setValue("MinimumContrast", ui.minimumContrast->value());
Settings->endGroup();
// state of distant Chat combobox
Settings->setValue("DistantChat", ui.distantChatComboBox->currentIndex());
uint chatLobbyFlags = 0;
Settings->setChatScreenFont(fontTempChat.toString());
NotifyQt::getInstance()->notifyChatFontChanged();
if (ui.chatLobby_Blink->isChecked())
chatLobbyFlags |= RS_CHATLOBBY_BLINK;
Settings->setChatSendMessageWithCtrlReturn(ui.sendMessageWithCtrlReturn->isChecked());
Settings->setChatSendAsPlainTextByDef(ui.sendAsPlainTextByDef->isChecked());
Settings->setChatLoadEmbeddedImages(ui.loadEmbeddedImages->isChecked());
Settings->setChatDoNotSendIsTyping(ui.DontSendTyping->isChecked());
Settings->setChatSearchCharToStartSearch(ui.sbSearch_CharToStart->value());
Settings->setChatSearchCaseSensitively(ui.cbSearch_CaseSensitively->isChecked());
Settings->setChatSearchWholeWords(ui.cbSearch_WholeWords->isChecked());
Settings->setChatSearchMoveToCursor(ui.cbSearch_MoveToCursor->isChecked());
Settings->setChatSearchSearchWithoutLimit(ui.cbSearch_WithoutLimit->isChecked());
Settings->setChatSearchMaxSearchLimitColor(ui.sbSearch_MaxLimitColor->value());
Settings->setChatSearchFoundColor(rgbChatSearchFoundColor);
Settings->setPublicChatHistoryCount(ui.publicChatLoadCount->value());
Settings->setPrivateChatHistoryCount(ui.privateChatLoadCount->value());
Settings->setLobbyChatHistoryCount(ui.lobbyChatLoadCount->value());
rsHistory->setEnable(RS_HISTORY_TYPE_PUBLIC , ui.publicChatEnable->isChecked());
rsHistory->setEnable(RS_HISTORY_TYPE_PRIVATE, ui.privateChatEnable->isChecked());
rsHistory->setEnable(RS_HISTORY_TYPE_LOBBY , ui.lobbyChatEnable->isChecked());
rsHistory->setSaveCount(RS_HISTORY_TYPE_PUBLIC , ui.publicChatSaveCount->value());
rsHistory->setSaveCount(RS_HISTORY_TYPE_PRIVATE, ui.privateChatSaveCount->value());
rsHistory->setSaveCount(RS_HISTORY_TYPE_LOBBY , ui.lobbyChatSaveCount->value());
RsGxsId chosen_id ;
switch(ui.chatLobbyIdentity_IC->getChosenId(chosen_id))
{
case GxsIdChooser::KnowId:
case GxsIdChooser::UnKnowId:
rsMsgs->setDefaultIdentityForChatLobby(chosen_id) ;
break ;
default:;
}
ChatStyleInfo info;
QListWidgetItem *item = ui.publicList->currentItem();
if (item) {
info = item->data(Qt::UserRole).value<ChatStyleInfo>();
if (publicStylePath != info.stylePath || publicStyleVariant != ui.publicComboBoxVariant->currentText()) {
Settings->setPublicChatStyle(info.stylePath, ui.publicComboBoxVariant->currentText());
NotifyQt::getInstance()->notifyChatStyleChanged(ChatStyle::TYPE_PUBLIC);
}
}
item = ui.privateList->currentItem();
if (item) {
info = item->data(Qt::UserRole).value<ChatStyleInfo>();
if (privateStylePath != info.stylePath || privateStyleVariant != ui.privateComboBoxVariant->currentText()) {
Settings->setPrivateChatStyle(info.stylePath, ui.privateComboBoxVariant->currentText());
NotifyQt::getInstance()->notifyChatStyleChanged(ChatStyle::TYPE_PRIVATE);
}
}
item = ui.historyList->currentItem();
if (item) {
info = item->data(Qt::UserRole).value<ChatStyleInfo>();
if (historyStylePath != info.stylePath || historyStyleVariant != ui.historyComboBoxVariant->currentText()) {
Settings->setHistoryChatStyle(info.stylePath, ui.historyComboBoxVariant->currentText());
NotifyQt::getInstance()->notifyChatStyleChanged(ChatStyle::TYPE_HISTORY);
}
}
rsHistory->setMaxStorageDuration(ui.max_storage_period->value() * 86400) ;
uint chatflags = 0;
if (ui.chat_NewWindow->isChecked())
chatflags |= RS_CHAT_OPEN;
if (ui.chat_Focus->isChecked())
chatflags |= RS_CHAT_FOCUS;
if (ui.chat_tabbedWindow->isChecked())
chatflags |= RS_CHAT_TABBED_WINDOW;
if (ui.chat_Blink->isChecked())
chatflags |= RS_CHAT_BLINK;
Settings->setChatFlags(chatflags);
uint chatLobbyFlags = 0;
if (ui.chatLobby_Blink->isChecked())
chatLobbyFlags |= RS_CHATLOBBY_BLINK;
Settings->setChatLobbyFlags(chatLobbyFlags);
return true;
Settings->setChatLobbyFlags(chatLobbyFlags);
}
/** Loads the settings for this page */

View File

@ -35,8 +35,6 @@ class ChatPage : public ConfigPage
/** Default Destructor */
~ChatPage() {}
/** Saves the changes on this page */
virtual bool save(QString &errmsg);
/** Loads the settings for this page */
virtual void load();
@ -58,6 +56,17 @@ class ChatPage : public ConfigPage
void distantChatComboBoxChanged(int);
void updateFontsAndEmotes();
void updateChatParams();
void updateChatSearchParams();
void updateDefaultLobbyIdentity() ;
void updateHistoryParams();
void updatePublicStyle() ;
void updatePrivateStyle() ;
void updateHistoryStyle() ;
void updateHistoryStorage();
void updateChatFlags();
void updateChatLobbyFlags();
private:
void setPreviewMessages(QString &stylePath, QString styleVariant, QTextBrowser *textBrowser);

View File

@ -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 */
void
CryptoPage::load()

View File

@ -35,8 +35,6 @@ class CryptoPage : public ConfigPage
/** Default Destructor */
~CryptoPage();
/** Saves the changes on this page */
virtual bool save(QString &errmsg);
/** Loads the settings for this page */
virtual QPixmap iconPixmap() const { return QPixmap(":/icons/settings/profile.svg") ; }
@ -46,9 +44,9 @@ class CryptoPage : public ConfigPage
private slots:
virtual void load();
void copyPublicKey();
void copyRSLink() ;
virtual void showEvent ( QShowEvent * event );
void profilemanager();
void copyRSLink() ;
virtual void showEvent ( QShowEvent * event );
void profilemanager();
bool fileSave();
bool fileSaveAs();
void showStats();

View File

@ -37,6 +37,11 @@ DirectoriesPage::DirectoriesPage(QWidget * parent, Qt::WindowFlags flags)
connect(ui.partialButton, SIGNAL(clicked( bool ) ), this , SLOT( setPartialsDirectory() ) );
connect(ui.editShareButton, SIGNAL(clicked()), this, SLOT(editDirectories()));
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)
@ -49,29 +54,10 @@ void DirectoriesPage::editDirectories()
ShareManager::showYourself() ;
}
/** Saves the changes on this page */
bool DirectoriesPage::save(QString &/*errmsg*/)
{
std::string dir = ui.incomingDir->text().toUtf8().constData();
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;
}
void DirectoriesPage::updateAutoCheckDirectories() { rsFiles->setWatchEnabled(ui.autoCheckDirectories_CB->isChecked()) ; }
void DirectoriesPage::updateAutoScanDirectoriesPeriod() { rsFiles->setWatchPeriod(ui.autoCheckDirectoriesDelay_SB->value()); }
void DirectoriesPage::updateShareDownloadDirectory() { rsFiles->shareDownloadDirectory(ui.shareDownloadDirectoryCB->isChecked());}
void DirectoriesPage::updateFollowSymLinks() { rsFiles->setFollowSymLinks(ui.followSymLinks_CB->isChecked()); }
/** Loads the settings for this page */
void DirectoriesPage::load()
@ -95,6 +81,10 @@ void DirectoriesPage::setIncomingDirectory()
}
ui.incomingDir->setText(qdir);
std::string dir = ui.incomingDir->text().toUtf8().constData();
if(!dir.empty())
rsFiles->setDownloadDirectory(dir);
}
void DirectoriesPage::setPartialsDirectory()
@ -105,4 +95,7 @@ void DirectoriesPage::setPartialsDirectory()
}
ui.partialsDir->setText(qdir);
std::string dir = ui.partialsDir->text().toUtf8().constData();
if (!dir.empty())
rsFiles->setPartialsDirectory(dir);
}

View File

@ -32,8 +32,6 @@ class DirectoriesPage: public ConfigPage
public:
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 */
virtual void load();
@ -47,6 +45,11 @@ private slots:
void setPartialsDirectory();
void toggleAutoCheckDirectories(bool);
void updateAutoCheckDirectories() ;
void updateAutoScanDirectoriesPeriod() ;
void updateShareDownloadDirectory() ;
void updateFollowSymLinks() ;
private:
Ui::DirectoriesPage ui;
};

View File

@ -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
FileAssociationsPage::load()
{

View File

@ -52,7 +52,6 @@ public:
virtual ~FileAssociationsPage();
virtual void load();
virtual bool save (QString &errmsg);
virtual QPixmap iconPixmap() const { return QPixmap(":/images/filetype-association.png") ; }
virtual QString pageName() const { return tr("Associations") ; }

View File

@ -30,24 +30,23 @@ ForumPage::ForumPage(QWidget * parent, Qt::WindowFlags flags)
/* Initialize GroupFrameSettingsWidget */
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()
{
}
/** Saves the changes on this page */
bool ForumPage::save(QString &/*errmsg*/)
{
Settings->setForumMsgSetToReadOnActivate(ui.setMsgToReadOnActivate->isChecked());
Settings->setForumExpandNewMessages(ui.expandNewMessages->isChecked());
Settings->setForumLoadEmbeddedImages(ui.loadEmbeddedImages->isChecked());
Settings->setForumLoadEmoticons(ui.loadEmoticons->isChecked());
ui.groupFrameSettingsWidget->saveSettings(GroupFrameSettings::Forum);
return true;
}
void ForumPage::updateMsgReadOnActivate() { Settings->setForumMsgSetToReadOnActivate(ui.setMsgToReadOnActivate->isChecked()); }
void ForumPage::updateExpandNewMessages() { Settings->setForumExpandNewMessages( ui.expandNewMessages ->isChecked());}
void ForumPage::updateLoadEmbeddedImages() { Settings->setForumLoadEmbeddedImages( ui.loadEmbeddedImages ->isChecked());}
void ForumPage::updateLoadEmoticons() { Settings->setForumLoadEmoticons( ui.loadEmoticons ->isChecked()); }
/** Loads the settings for this page */
void ForumPage::load()

View File

@ -33,8 +33,6 @@ public:
ForumPage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
~ForumPage();
/** Saves the changes on this page */
virtual bool save(QString &errmsg);
/** Loads the settings for this page */
virtual void load();
@ -42,6 +40,12 @@ public:
virtual QString pageName() const { return tr("Forum") ; }
virtual QString helpText() const { return ""; }
protected slots:
void updateMsgReadOnActivate();
void updateExpandNewMessages();
void updateLoadEmbeddedImages();
void updateLoadEmoticons();
private:
Ui::ForumPage ui;
};

View File

@ -38,8 +38,6 @@ GeneralPage::GeneralPage(QWidget * parent, Qt::WindowFlags flags) :
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
/* Connect signals */
connect(ui.runStartWizard_PB,SIGNAL(clicked()), this,SLOT(runStartWizard())) ;
/* Hide platform specific features */
#ifdef Q_OS_WIN
@ -82,6 +80,19 @@ GeneralPage::GeneralPage(QWidget * parent, Qt::WindowFlags flags) :
ui.autoLogin->setEnabled(false);
ui.autoLogin->setToolTip(tr("Your RetroShare build has auto-login disabled."));
#endif // RS_AUTOLOGIN
/* Connect signals */
connect(ui.useLocalServer, SIGNAL(toggled(bool)), this,SLOT(updateUseLocalServer())) ;
connect(ui.idleSpinBox, SIGNAL(valueChanged(int)), this,SLOT(updateMaxTimeBeforeIdle())) ;
connect(ui.checkStartMinimized, SIGNAL(toggled(bool)), this,SLOT(updateStartMinimized())) ;
connect(ui.checkQuit, SIGNAL(toggled(bool)), this,SLOT(updateDoQuit())) ;
connect(ui.checkCloseToTray, SIGNAL(toggled(bool)), this,SLOT(updateCloseToTray())) ;
connect(ui.autoLogin, SIGNAL(toggled(bool)), this,SLOT(updateAutoLogin())) ;
connect(ui.chkRunRetroshareAtSystemStartup, SIGNAL(toggled(bool)), this,SLOT(updateRunRSOnBoot())) ;
connect(ui.chkRunRetroshareAtSystemStartupMinimized, SIGNAL(toggled(bool)), this,SLOT(updateRunRSOnBoot())) ;
connect(ui.runStartWizard_PB, SIGNAL(clicked()), this,SLOT(runStartWizard())) ;
connect(ui.checkAdvanced, SIGNAL(toggled(bool)), this,SLOT(updateAdvancedMode())) ;
connect(ui.registerRetroShareProtocol, SIGNAL(toggled(bool)), this,SLOT(updateRegisterRSProtocol())) ;
}
/** Destructor */
@ -93,48 +104,48 @@ void GeneralPage::runStartWizard()
QuickStartWizard(this).exec();
}
/** Saves the changes on this page */
bool GeneralPage::save(QString &/*errmsg*/)
void GeneralPage::updateAdvancedMode()
{
if (ui.checkAdvanced->isChecked())
{
std::string opt("YES");
rsConfig->setConfigurationOption(RS_CONFIG_ADVANCED, opt);
}
else
{
std::string opt("NO");
rsConfig->setConfigurationOption(RS_CONFIG_ADVANCED, opt);
}
}
void GeneralPage::updateUseLocalServer() { Settings->setUseLocalServer(ui.useLocalServer->isChecked()); }
void GeneralPage::updateMaxTimeBeforeIdle(){ Settings->setMaxTimeBeforeIdle(ui.idleSpinBox->value()); }
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
}
Settings->setStartMinimized(ui.checkStartMinimized->isChecked());
if (ui.checkAdvanced->isChecked())
{
std::string opt("YES");
rsConfig->setConfigurationOption(RS_CONFIG_ADVANCED, opt);
}
else
{
std::string opt("NO");
rsConfig->setConfigurationOption(RS_CONFIG_ADVANCED, opt);
}
Settings->setValue("doQuit", ui.checkQuit->isChecked());
Settings->setCloseToTray(ui.checkCloseToTray->isChecked());
RsInit::setAutoLogin(ui.autoLogin->isChecked());
if (ui.registerRetroShareProtocol->isChecked() != Settings->getRetroShareProtocol()) {
QString error ="";
if (Settings->setRetroShareProtocol(ui.registerRetroShareProtocol->isChecked(), error) == false) {
if (ui.registerRetroShareProtocol->isChecked()) {
QMessageBox::critical(this, tr("Error"), tr("Could not add retroshare:// as protocol.").append("\n").append(error));
} else {
QMessageBox::critical(this, tr("Error"), tr("Could not remove retroshare:// protocol.").append("\n").append(error));
}
}
}
Settings->setUseLocalServer(ui.useLocalServer->isChecked());
Settings->setMaxTimeBeforeIdle(ui.idleSpinBox->value());
return true;
void GeneralPage::updateRegisterRSProtocol()
{
if (ui.registerRetroShareProtocol->isChecked() != Settings->getRetroShareProtocol())
{
QString error ="";
if (Settings->setRetroShareProtocol(ui.registerRetroShareProtocol->isChecked(), error) == false) {
if (ui.registerRetroShareProtocol->isChecked()) {
QMessageBox::critical(this, tr("Error"), tr("Could not add retroshare:// as protocol.").append("\n").append(error));
} else {
QMessageBox::critical(this, tr("Error"), tr("Could not remove retroshare:// protocol.").append("\n").append(error));
}
}
}
}
/** Loads the settings for this page */

View File

@ -28,28 +28,37 @@
class GeneralPage : public ConfigPage
{
Q_OBJECT
Q_OBJECT
public:
/** Default Constructor */
GeneralPage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
/** Default Destructor */
~GeneralPage();
/** Default Constructor */
GeneralPage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
/** Default Destructor */
~GeneralPage();
/** Saves the changes on this page */
virtual bool save(QString &errmsg);
/** Loads the settings for this page */
virtual void load();
/** Saves the changes on this page */
/** Loads the settings for this page */
virtual void load();
virtual QPixmap iconPixmap() const { return QPixmap(":/icons/settings/general.svg") ; }
virtual QString pageName() const { return tr("General") ; }
virtual QString helpText() const { return ""; }
virtual QPixmap iconPixmap() const { return QPixmap(":/icons/settings/general.svg") ; }
virtual QString pageName() const { return tr("General") ; }
virtual QString helpText() const { return ""; }
public slots:
void runStartWizard() ;
void updateAdvancedMode();
void updateUseLocalServer() ;
void updateMaxTimeBeforeIdle();
void updateStartMinimized() ;
void updateDoQuit() ;
void updateCloseToTray() ;
void updateAutoLogin() ;
void updateRunRSOnBoot() ;
void updateRegisterRSProtocol();
public slots:
void runStartWizard() ;
private:
/** Qt Designer generated object */
Ui::GeneralPage ui;
/** Qt Designer generated object */
Ui::GeneralPage ui;
};
#endif

View File

@ -1,3 +1,5 @@
#include <iostream>
#include "GroupFrameSettingsWidget.h"
#include "ui_GroupFrameSettingsWidget.h"
@ -7,7 +9,11 @@ GroupFrameSettingsWidget::GroupFrameSettingsWidget(QWidget *parent) :
{
ui->setupUi(this);
mType = GroupFrameSettings::Nothing ;
mEnable = true;
connect(ui->openAllInNewTabCheckBox, SIGNAL(toggled(bool)),this,SLOT(saveSettings())) ;
connect(ui->hideTabBarWithOneTabCheckBox,SIGNAL(toggled(bool)),this,SLOT(saveSettings())) ;
}
GroupFrameSettingsWidget::~GroupFrameSettingsWidget()
@ -22,6 +28,8 @@ void GroupFrameSettingsWidget::setOpenAllInNewTabText(const QString &text)
void GroupFrameSettingsWidget::loadSettings(GroupFrameSettings::Type type)
{
mType = type ;
GroupFrameSettings groupFrameSettings;
if (Settings->getGroupFrameSettings(type, groupFrameSettings)) {
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 (mEnable) {
if(mType == GroupFrameSettings::Nothing)
{
std::cerr << "(EE) No type initialized for groupFrameSettings. This is a bug." << std::endl;
return;
}
if (mEnable)
{
GroupFrameSettings groupFrameSettings;
groupFrameSettings.mOpenAllInNewTab = ui->openAllInNewTabCheckBox->isChecked();
groupFrameSettings.mHideTabBarWithOneTab = ui->hideTabBarWithOneTabCheckBox->isChecked();
Settings->setGroupFrameSettings(type, groupFrameSettings);
Settings->setGroupFrameSettings(mType, groupFrameSettings);
}
}

View File

@ -20,11 +20,15 @@ public:
void setOpenAllInNewTabText(const QString &text);
void loadSettings(GroupFrameSettings::Type type);
void saveSettings(GroupFrameSettings::Type type);
void setType(GroupFrameSettings::Type type) { mType = type ; }
protected slots:
void saveSettings();
private:
bool mEnable;
Ui::GroupFrameSettingsWidget *ui;
GroupFrameSettings::Type mType ;
};
#endif // GROUPFRAMESETTINGSWIDGET_H

View File

@ -51,8 +51,9 @@ MessagePage::MessagePage(QWidget * parent, Qt::WindowFlags flags)
connect(ui.comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(distantMsgsComboBoxChanged(int)));
//ui.encryptedMsgs_CB->setEnabled(false) ;
connect(ui.setMsgToReadOnActivate,SIGNAL(toggled(bool)), this,SLOT(updateMsgToReadOnActivate()));
connect(ui.loadEmbeddedImages, SIGNAL(toggled(bool)), this,SLOT(updateLoadEmbededImages() ));
connect(ui.openComboBox, SIGNAL(currentIndexChanged(int)),this,SLOT(updateMsgOpen() ));
}
MessagePage::~MessagePage()
@ -79,17 +80,13 @@ void MessagePage::distantMsgsComboBoxChanged(int i)
}
/** Saves the changes on this page */
bool
MessagePage::save(QString &/*errmsg*/)
{
Settings->setMsgSetToReadOnActivate(ui.setMsgToReadOnActivate->isChecked());
Settings->setMsgLoadEmbeddedImages(ui.loadEmbeddedImages->isChecked());
Settings->setMsgOpen((RshareSettings::enumMsgOpen) ui.openComboBox->itemData(ui.openComboBox->currentIndex()).toInt());
// state of distant Message combobox
Settings->setValue("DistantMessages", ui.comboBox->currentIndex());
void MessagePage::updateMsgToReadOnActivate() { Settings->setMsgSetToReadOnActivate(ui.setMsgToReadOnActivate->isChecked()); }
void MessagePage::updateLoadEmbededImages() { Settings->setMsgLoadEmbeddedImages(ui.loadEmbeddedImages->isChecked()); }
void MessagePage::updateMsgOpen() { Settings->setMsgOpen((RshareSettings::enumMsgOpen) ui.openComboBox->itemData(ui.openComboBox->currentIndex()).toInt());}
void MessagePage::updateDistantMsgs() { Settings->setValue("DistantMessages", ui.comboBox->currentIndex()); }
void MessagePage::updateMsgTags()
{
std::map<uint32_t, std::pair<std::string, uint32_t> >::iterator Tag;
for (Tag = m_pTags->types.begin(); Tag != m_pTags->types.end(); ++Tag) {
// check for changed tags
@ -107,8 +104,6 @@ MessagePage::save(QString &/*errmsg*/)
}
}
}
return true;
}
/** Loads the settings for this page */
@ -166,6 +161,8 @@ void MessagePage::addTag()
m_changedTagIds.push_back(TagDlg.m_nId);
}
}
updateMsgTags();
}
void MessagePage::editTag()
@ -196,6 +193,7 @@ void MessagePage::editTag()
}
}
}
updateMsgTags();
}
void MessagePage::deleteTag()
@ -228,6 +226,7 @@ void MessagePage::deleteTag()
if (std::find(m_changedTagIds.begin(), m_changedTagIds.end(), nId) == m_changedTagIds.end()) {
m_changedTagIds.push_back(nId);
}
updateMsgTags();
}
void MessagePage::defaultTag()
@ -244,6 +243,7 @@ void MessagePage::defaultTag()
}
}
updateMsgTags();
fillTags();
}

View File

@ -37,8 +37,6 @@ public:
MessagePage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
~MessagePage();
/** Saves the changes on this page */
virtual bool save(QString &errmsg);
/** Loads the settings for this page */
virtual void load();
@ -56,6 +54,11 @@ private slots:
void currentRowChangedTag(int row);
void distantMsgsComboBoxChanged(int);
void updateMsgToReadOnActivate() ;
void updateLoadEmbededImages() ;
void updateMsgOpen() ;
void updateDistantMsgs() ;
void updateMsgTags() ;
private:
void fillTags();

View File

@ -30,13 +30,6 @@ NetworkPage::NetworkPage(QWidget * parent, Qt::WindowFlags flags)
}
/** Saves the changes on this page */
bool
NetworkPage::save(QString &/*errmsg*/)
{
return true;
}
/** Loads the settings for this page */
void
NetworkPage::load()

View File

@ -31,8 +31,6 @@ public:
NetworkPage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
~NetworkPage() {}
/** Saves the changes on this page */
virtual bool save(QString &errmsg);
/** Loads the settings for this page */
virtual void load();

View File

@ -37,106 +37,151 @@
NotifyPage::NotifyPage(QWidget * parent, Qt::WindowFlags flags)
: ConfigPage(parent, flags)
{
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
connect(ui.testFeedButton, SIGNAL(clicked()), this, SLOT(testFeed()));
connect(ui.testToasterButton, SIGNAL(clicked()), this, SLOT(testToaster()));
connect(ui.pushButtonDisableAll,SIGNAL(toggled(bool)), NotifyQt::getInstance(), SLOT(SetDisableAll(bool)));
connect(NotifyQt::getInstance(),SIGNAL(disableAllChanged(bool)), ui.pushButtonDisableAll, SLOT(setChecked(bool)));
connect(ui.chatLobbies_CountFollowingText,SIGNAL(toggled(bool)),ui.chatLobbies_TextToNotify,SLOT(setEnabled(bool)));
connect(ui.testFeedButton, SIGNAL(clicked()), this, SLOT(testFeed()));
connect(ui.testToasterButton, SIGNAL(clicked()), this, SLOT(testToaster()));
connect(ui.pushButtonDisableAll,SIGNAL(toggled(bool)), NotifyQt::getInstance(), SLOT(SetDisableAll(bool)));
connect(NotifyQt::getInstance(),SIGNAL(disableAllChanged(bool)), ui.pushButtonDisableAll, SLOT(setChecked(bool)));
connect(ui.chatLobbies_CountFollowingText,SIGNAL(toggled(bool)),ui.chatLobbies_TextToNotify,SLOT(setEnabled(bool)));
ui.notify_Blogs->hide();
ui.notify_Blogs->hide();
QFont font = ui.notify_Peers->font(); // use font from existing checkbox
QFont font = ui.notify_Peers->font(); // use font from existing checkbox
/* add feed and Toaster notify */
int rowFeed = 0;
int rowToaster = 0;
int pluginCount = rsPlugins->nbPlugins();
for (int i = 0; i < pluginCount; ++i) {
RsPlugin *rsPlugin = rsPlugins->plugin(i);
if (rsPlugin) {
FeedNotify *feedNotify = rsPlugin->qt_feedNotify();
if (feedNotify) {
QString name;
if (feedNotify->hasSetting(name)) {
/* add feed and Toaster notify */
int rowFeed = 0;
int rowToaster = 0;
int pluginCount = rsPlugins->nbPlugins();
for (int i = 0; i < pluginCount; ++i)
{
RsPlugin *rsPlugin = rsPlugins->plugin(i);
if (rsPlugin) {
FeedNotify *feedNotify = rsPlugin->qt_feedNotify();
if (feedNotify) {
QString name;
if (feedNotify->hasSetting(name)) {
QCheckBox *enabledCheckBox = new QCheckBox(name, this);
enabledCheckBox->setFont(font);
ui.feedLayout->addWidget(enabledCheckBox, rowFeed++);
QCheckBox *enabledCheckBox = new QCheckBox(name, this);
enabledCheckBox->setFont(font);
ui.feedLayout->addWidget(enabledCheckBox, rowFeed++);
mFeedNotifySettingList.push_back(FeedNotifySetting(feedNotify, enabledCheckBox));
}
}
mFeedNotifySettingList.push_back(FeedNotifySetting(feedNotify, enabledCheckBox));
ToasterNotify *toasterNotify = rsPlugin->qt_toasterNotify();
if (toasterNotify) {
QString name;
if (toasterNotify->hasSetting(name)) {
connect(enabledCheckBox,SIGNAL(toggled(bool)),this,SLOT(updateFeedNotifySettings())) ;
}
}
QCheckBox *enabledCheckBox = new QCheckBox(name, this);
enabledCheckBox->setFont(font);
ui.toasterLayout->addWidget(enabledCheckBox, rowToaster++);
ToasterNotify *toasterNotify = rsPlugin->qt_toasterNotify();
if (toasterNotify) {
QString name;
if (toasterNotify->hasSetting(name)) {
mToasterNotifySettingList.push_back(ToasterNotifySetting(toasterNotify, enabledCheckBox));
}
QCheckBox *enabledCheckBox = new QCheckBox(name, this);
enabledCheckBox->setFont(font);
ui.toasterLayout->addWidget(enabledCheckBox, rowToaster++);
QMap<QString, QString> map;
if (toasterNotify->hasSettings(name, map)) {
if (!map.empty()){
QWidget* widget = new QWidget();
QVBoxLayout* vbLayout = new QVBoxLayout(widget);
QLabel *label = new QLabel(name, this);
QFont fontBold = QFont(font);
fontBold.setBold(true);
label->setFont(fontBold);
vbLayout->addWidget(label);
for (QMap<QString, QString>::const_iterator it = map.begin(); it != map.end(); ++it){
QCheckBox *enabledCheckBox = new QCheckBox(it.value(), this);
enabledCheckBox->setAccessibleName(it.key());
enabledCheckBox->setFont(font);
vbLayout->addWidget(enabledCheckBox);
mToasterNotifySettingList.push_back(ToasterNotifySetting(toasterNotify, enabledCheckBox));
}
ui.toasterLayout->addWidget(widget, rowToaster++);
}
}
}
}
}
mToasterNotifySettingList.push_back(ToasterNotifySetting(toasterNotify, enabledCheckBox));
/* add user notify */
const QList<UserNotify*> &userNotifyList = MainWindow::getInstance()->getUserNotifyList();
QList<UserNotify*>::const_iterator it;
rowFeed = 0;
mChatLobbyUserNotify = 0;
for (it = userNotifyList.begin(); it != userNotifyList.end(); ++it) {
UserNotify *userNotify = *it;
connect(enabledCheckBox,SIGNAL(toggled(bool)),this,SLOT(updateToasterNotifySettings())) ;
}
QString name;
if (!userNotify->hasSetting(&name, NULL)) {
continue;
}
QMap<QString, QString> map;
if (toasterNotify->hasSettings(name, map)) {
if (!map.empty()){
QWidget* widget = new QWidget();
QVBoxLayout* vbLayout = new QVBoxLayout(widget);
QLabel *label = new QLabel(name, this);
QFont fontBold = QFont(font);
fontBold.setBold(true);
label->setFont(fontBold);
vbLayout->addWidget(label);
for (QMap<QString, QString>::const_iterator it = map.begin(); it != map.end(); ++it){
QCheckBox *enabledCheckBox = new QCheckBox(it.value(), this);
enabledCheckBox->setAccessibleName(it.key());
enabledCheckBox->setFont(font);
vbLayout->addWidget(enabledCheckBox);
mToasterNotifySettingList.push_back(ToasterNotifySetting(toasterNotify, enabledCheckBox));
QCheckBox *enabledCheckBox = new QCheckBox(name, this);
enabledCheckBox->setFont(font);
ui.notifyLayout->addWidget(enabledCheckBox, rowFeed, 0, 0);
connect(enabledCheckBox, SIGNAL(toggled(bool)), this, SLOT(notifyToggled()));
connect(enabledCheckBox,SIGNAL(toggled(bool)),this,SLOT(updateToasterNotifySettings())) ;
}
ui.toasterLayout->addWidget(widget, rowToaster++);
}
}
}
}
QCheckBox *combinedCheckBox = new QCheckBox(tr("Combined"), this);
combinedCheckBox->setFont(font);
ui.notifyLayout->addWidget(combinedCheckBox, rowFeed, 1);
}
QCheckBox *blinkCheckBox = new QCheckBox(tr("Blink"), this);
blinkCheckBox->setFont(font);
ui.notifyLayout->addWidget(blinkCheckBox, rowFeed++, 2);
/* add user notify */
const QList<UserNotify*> &userNotifyList = MainWindow::getInstance()->getUserNotifyList();
QList<UserNotify*>::const_iterator it;
rowFeed = 0;
mChatLobbyUserNotify = 0;
for (it = userNotifyList.begin(); it != userNotifyList.end(); ++it) {
UserNotify *userNotify = *it;
mUserNotifySettingList.push_back(UserNotifySetting(userNotify, enabledCheckBox, combinedCheckBox, blinkCheckBox));
QString name;
if (!userNotify->hasSetting(&name, NULL)) {
continue;
}
//To get ChatLobbyUserNotify Settings
if (!mChatLobbyUserNotify) mChatLobbyUserNotify = dynamic_cast<ChatLobbyUserNotify*>(*it);
}
QCheckBox *enabledCheckBox = new QCheckBox(name, this);
enabledCheckBox->setFont(font);
ui.notifyLayout->addWidget(enabledCheckBox, rowFeed, 0, 0);
connect(enabledCheckBox, SIGNAL(toggled(bool)), this, SLOT(notifyToggled()));
QCheckBox *combinedCheckBox = new QCheckBox(tr("Combined"), this);
combinedCheckBox->setFont(font);
ui.notifyLayout->addWidget(combinedCheckBox, rowFeed, 1);
QCheckBox *blinkCheckBox = new QCheckBox(tr("Blink"), this);
blinkCheckBox->setFont(font);
ui.notifyLayout->addWidget(blinkCheckBox, rowFeed++, 2);
mUserNotifySettingList.push_back(UserNotifySetting(userNotify, enabledCheckBox, combinedCheckBox, blinkCheckBox));
connect(enabledCheckBox,SIGNAL(toggled(bool)),this,SLOT(updateUserNotifySettings())) ;
connect(blinkCheckBox,SIGNAL(toggled(bool)),this,SLOT(updateUserNotifySettings())) ;
connect(combinedCheckBox,SIGNAL(toggled(bool)),this,SLOT(updateUserNotifySettings())) ;
//To get ChatLobbyUserNotify Settings
if (!mChatLobbyUserNotify) mChatLobbyUserNotify = dynamic_cast<ChatLobbyUserNotify*>(*it);
}
connect(ui.popup_Connect, SIGNAL(toggled(bool)), this, SLOT(updateNotifyFlags())) ;
connect(ui.popup_NewMsg, SIGNAL(toggled(bool)), this, SLOT(updateNotifyFlags())) ;
connect(ui.popup_DownloadFinished, SIGNAL(toggled(bool)), this, SLOT(updateNotifyFlags())) ;
connect(ui.popup_PrivateChat, SIGNAL(toggled(bool)), this, SLOT(updateNotifyFlags())) ;
connect(ui.popup_GroupChat, SIGNAL(toggled(bool)), this, SLOT(updateNotifyFlags())) ;
connect(ui.popup_ChatLobby, SIGNAL(toggled(bool)), this, SLOT(updateNotifyFlags())) ;
connect(ui.popup_ConnectAttempt, SIGNAL(toggled(bool)), this, SLOT(updateNotifyFlags())) ;
connect(ui.message_ConnectAttempt, SIGNAL(toggled(bool)), this, SLOT(updateMessageFlags())) ;
connect(ui.notify_Peers, SIGNAL(toggled(bool)), this, SLOT(updateNewsFeedFlags()));
connect(ui.notify_Channels, SIGNAL(toggled(bool)), this, SLOT(updateNewsFeedFlags()));
connect(ui.notify_Forums, SIGNAL(toggled(bool)), this, SLOT(updateNewsFeedFlags()));
connect(ui.notify_Posted, SIGNAL(toggled(bool)), this, SLOT(updateNewsFeedFlags()));
connect(ui.notify_Messages, SIGNAL(toggled(bool)), this, SLOT(updateNewsFeedFlags()));
connect(ui.notify_Chat, SIGNAL(toggled(bool)), this, SLOT(updateNewsFeedFlags()));
connect(ui.notify_Security, SIGNAL(toggled(bool)), this, SLOT(updateNewsFeedFlags()));
connect(ui.notify_SecurityIp, SIGNAL(toggled(bool)), this, SLOT(updateNewsFeedFlags()));
connect(ui.systray_ChatLobby, SIGNAL(toggled(bool)),this,SLOT(updateSystrayChatLobby()));
connect(ui.systray_GroupChat, SIGNAL(toggled(bool)),this,SLOT(updateSystrayGroupChat()));
connect(ui.spinBoxToasterXMargin, SIGNAL(valueChanged(int)),this, SLOT(updateToasterMargin())) ;
connect(ui.spinBoxToasterYMargin, SIGNAL(valueChanged(int)),this, SLOT(updateToasterMargin())) ;
connect(ui.comboBoxToasterPosition, SIGNAL(currentIndexChanged(int)),this, SLOT(updateToasterPosition())) ;
connect(ui.chatLobbies_CountUnRead, SIGNAL(toggled(bool)),this, SLOT(updateChatLobbyUserNotify())) ;
connect(ui.chatLobbies_CheckNickName, SIGNAL(toggled(bool)),this, SLOT(updateChatLobbyUserNotify())) ;
connect(ui.chatLobbies_CountFollowingText, SIGNAL(toggled(bool)),this, SLOT(updateChatLobbyUserNotify())) ;
connect(ui.chatLobbies_TextToNotify, SIGNAL(textChanged(QString)),this, SLOT(updateChatLobbyUserNotify()));
connect(ui.chatLobbies_TextCaseSensitive, SIGNAL(toggled(bool)),this, SLOT(updateChatLobbyUserNotify())) ;
}
NotifyPage::~NotifyPage()
@ -203,64 +248,62 @@ uint NotifyPage::getNotifyFlags()
return notifyFlags;
}
/** Saves the changes on this page */
bool
NotifyPage::save(QString &/*errmsg*/)
void NotifyPage::updateFeedNotifySettings()
{
/* extract from rsNotify the flags */
uint messageflags = 0;
if (ui.message_ConnectAttempt->isChecked())
messageflags |= RS_MESSAGE_CONNECT_ATTEMPT;
/* save feed notify */
QList<FeedNotifySetting>::iterator feedNotifyIt;
for (feedNotifyIt = mFeedNotifySettingList.begin(); feedNotifyIt != mFeedNotifySettingList.end(); ++feedNotifyIt) {
feedNotifyIt->mFeedNotify->setNotifyEnabled(feedNotifyIt->mEnabledCheckBox->isChecked());
}
/* save feed notify */
QList<FeedNotifySetting>::iterator feedNotifyIt;
for (feedNotifyIt = mFeedNotifySettingList.begin(); feedNotifyIt != mFeedNotifySettingList.end(); ++feedNotifyIt)
feedNotifyIt->mFeedNotify->setNotifyEnabled(feedNotifyIt->mEnabledCheckBox->isChecked());
}
void NotifyPage::updateToasterNotifySettings()
{
/* save toaster notify */
QList<ToasterNotifySetting>::iterator toasterNotifyIt;
for (toasterNotifyIt = mToasterNotifySettingList.begin(); toasterNotifyIt != mToasterNotifySettingList.end(); ++toasterNotifyIt) {
if(toasterNotifyIt->mEnabledCheckBox->accessibleName().isEmpty()){
if(toasterNotifyIt->mEnabledCheckBox->accessibleName().isEmpty())
toasterNotifyIt->mToasterNotify->setNotifyEnabled(toasterNotifyIt->mEnabledCheckBox->isChecked()) ;
} else {
else
toasterNotifyIt->mToasterNotify->setNotifyEnabled(toasterNotifyIt->mEnabledCheckBox->accessibleName(), toasterNotifyIt->mEnabledCheckBox->isChecked()) ;
}
}
}
/* save user notify */
QList<UserNotifySetting>::iterator notifyIt;
for (notifyIt = mUserNotifySettingList.begin(); notifyIt != mUserNotifySettingList.end(); ++notifyIt) {
notifyIt->mUserNotify->setNotifyEnabled(notifyIt->mEnabledCheckBox->isChecked(), notifyIt->mCombinedCheckBox->isChecked(), notifyIt->mBlinkCheckBox->isChecked());
}
void NotifyPage::updateUserNotifySettings()
{
/* save user notify */
QList<UserNotifySetting>::iterator notifyIt;
for (notifyIt = mUserNotifySettingList.begin(); notifyIt != mUserNotifySettingList.end(); ++notifyIt)
notifyIt->mUserNotify->setNotifyEnabled(notifyIt->mEnabledCheckBox->isChecked(), notifyIt->mCombinedCheckBox->isChecked(), notifyIt->mBlinkCheckBox->isChecked());
Settings->setNotifyFlags(getNotifyFlags());
Settings->setNewsFeedFlags(getNewsFlags());
Settings->setMessageFlags(messageflags);
MainWindow::installNotifyIcons();
}
Settings->setDisplayTrayChatLobby(ui.systray_ChatLobby->isChecked());
Settings->setDisplayTrayGroupChat(ui.systray_GroupChat->isChecked());
MainWindow::installGroupChatNotifier();
MainWindow::installNotifyIcons();
void NotifyPage::updateMessageFlags() { Settings->setMessageFlags( ui.message_ConnectAttempt->isChecked()? RS_MESSAGE_CONNECT_ATTEMPT : 0); }
void NotifyPage::updateNotifyFlags() { Settings->setNotifyFlags(getNotifyFlags()); }
void NotifyPage::updateNewsFeedFlags(){ Settings->setNewsFeedFlags(getNewsFlags()); }
void NotifyPage::updateSystrayChatLobby() { Settings->setDisplayTrayChatLobby(ui.systray_ChatLobby->isChecked()); }
void NotifyPage::updateSystrayGroupChat() { Settings->setDisplayTrayGroupChat(ui.systray_GroupChat->isChecked()); MainWindow::installGroupChatNotifier(); }
void NotifyPage::updateToasterMargin() { Settings->setToasterMargin(QPoint(ui.spinBoxToasterXMargin->value(), ui.spinBoxToasterYMargin->value())); }
void NotifyPage::updateToasterPosition()
{
int index = ui.comboBoxToasterPosition->currentIndex();
if (index != -1) {
if (index != -1)
Settings->setToasterPosition((RshareSettings::enumToasterPosition) ui.comboBoxToasterPosition->itemData(index).toInt());
}
}
Settings->setToasterMargin(QPoint(ui.spinBoxToasterXMargin->value(), ui.spinBoxToasterYMargin->value()));
void NotifyPage::updateChatLobbyUserNotify()
{
if(!mChatLobbyUserNotify)
return ;
if (mChatLobbyUserNotify){
mChatLobbyUserNotify->setCountUnRead(ui.chatLobbies_CountUnRead->isChecked()) ;
mChatLobbyUserNotify->setCheckForNickName(ui.chatLobbies_CheckNickName->isChecked()) ;
mChatLobbyUserNotify->setCountSpecificText(ui.chatLobbies_CountFollowingText->isChecked()) ;
mChatLobbyUserNotify->setTextToNotify(ui.chatLobbies_TextToNotify->document()->toPlainText());
mChatLobbyUserNotify->setTextCaseSensitive(ui.chatLobbies_TextCaseSensitive->isChecked());
}
load();
return true;
mChatLobbyUserNotify->setCountUnRead(ui.chatLobbies_CountUnRead->isChecked()) ;
mChatLobbyUserNotify->setCheckForNickName(ui.chatLobbies_CheckNickName->isChecked()) ;
mChatLobbyUserNotify->setCountSpecificText(ui.chatLobbies_CountFollowingText->isChecked()) ;
mChatLobbyUserNotify->setTextToNotify(ui.chatLobbies_TextToNotify->document()->toPlainText());
mChatLobbyUserNotify->setTextCaseSensitive(ui.chatLobbies_TextCaseSensitive->isChecked());
}
/** Loads the settings for this page */

View File

@ -76,8 +76,6 @@ public:
/** Default Destructor */
~NotifyPage();
/** Saves the changes on this page */
virtual bool save(QString &errmsg);
/** Loads the settings for this page */
virtual void load();
@ -90,6 +88,20 @@ private slots:
void testToaster();
void testFeed();
void updateFeedNotifySettings();
void updateToasterNotifySettings();
void updateUserNotifySettings();
void updateMessageFlags() ;
void updateNotifyFlags() ;
void updateNewsFeedFlags();
void updateSystrayChatLobby();
void updateSystrayGroupChat();
void updateToasterMargin();
void updateToasterPosition();
void updateChatLobbyUserNotify();
private:
uint getNewsFlags();
uint getNotifyFlags();

View File

@ -29,28 +29,26 @@ PeoplePage::PeoplePage(QWidget * parent, Qt::WindowFlags flags)
{
ui.setupUi(this);
setAttribute(Qt::WA_QuitOnClose, false);
connect(ui.autoPositiveOpinion_CB,SIGNAL(toggled(bool)),this,SLOT(updateAutoPositiveOpinion())) ;
connect(ui.thresholdForPositive_SB,SIGNAL(valueChanged(int)),this,SLOT(updateThresholdForRemotelyPositiveReputation()));
connect(ui.thresholdForNegative_SB,SIGNAL(valueChanged(int)),this,SLOT(updateThresholdForRemotelyNegativeReputation()));
connect(ui.preventReloadingBannedIdentitiesFor_SB,SIGNAL(valueChanged(int)),this,SLOT(updateRememberDeletedNodes()));
connect(ui.deleteBannedIdentitiesAfter_SB,SIGNAL(valueChanged(int)),this,SLOT(updateDeleteBannedNodesThreshold()));
}
void PeoplePage::updateAutoPositiveOpinion() { rsReputations->setNodeAutoPositiveOpinionForContacts(ui.autoPositiveOpinion_CB->isChecked()) ; }
void PeoplePage::updateThresholdForRemotelyPositiveReputation() { rsReputations->setThresholdForRemotelyPositiveReputation(ui.thresholdForPositive_SB->value()); }
void PeoplePage::updateThresholdForRemotelyNegativeReputation() { rsReputations->setThresholdForRemotelyNegativeReputation(ui.thresholdForNegative_SB->value()); }
void PeoplePage::updateRememberDeletedNodes() { rsReputations->setRememberDeletedNodesThreshold(ui.preventReloadingBannedIdentitiesFor_SB->value()); }
void PeoplePage::updateDeleteBannedNodesThreshold() { rsIdentity->setDeleteBannedNodesThreshold(ui.deleteBannedIdentitiesAfter_SB->value());}
PeoplePage::~PeoplePage()
{
}
/** Saves the changes on this page */
bool PeoplePage::save(QString &/*errmsg*/)
{
if(ui.autoPositiveOpinion_CB->isChecked())
rsReputations->setNodeAutoPositiveOpinionForContacts(true) ;
else
rsReputations->setNodeAutoPositiveOpinionForContacts(false) ;
rsReputations->setThresholdForRemotelyPositiveReputation(ui.thresholdForPositive_SB->value());
rsReputations->setThresholdForRemotelyNegativeReputation(ui.thresholdForNegative_SB->value());
rsReputations->setRememberDeletedNodesThreshold(ui.preventReloadingBannedIdentitiesFor_SB->value());
rsIdentity->setDeleteBannedNodesThreshold(ui.deleteBannedIdentitiesAfter_SB->value());
return true;
}
/** Loads the settings for this page */
void PeoplePage::load()
{

View File

@ -33,8 +33,6 @@ public:
PeoplePage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
~PeoplePage();
/** Saves the changes on this page */
virtual bool save(QString &errmsg);
/** Loads the settings for this page */
virtual void load();
@ -42,6 +40,15 @@ public:
virtual QString pageName() const { return tr("People") ; }
virtual QString helpText() const { return ""; }
protected slots:
void updateAutoPositiveOpinion() ;
void updateThresholdForRemotelyPositiveReputation();
void updateThresholdForRemotelyNegativeReputation();
void updateRememberDeletedNodes();
void updateDeleteBannedNodesThreshold() ;
private:
Ui::PeoplePage ui;
};

View File

@ -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 */
void PluginsPage::load()
{

View File

@ -32,8 +32,6 @@ class PluginsPage : public ConfigPage
PluginsPage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
~PluginsPage();
/** Saves the changes on this page */
virtual bool save(QString &errmsg);
/** Loads the settings for this page */
virtual void load();

View File

@ -32,20 +32,13 @@ PostedPage::PostedPage(QWidget * parent, Qt::WindowFlags flags)
/* Initialize GroupFrameSettingsWidget */
ui->groupFrameSettingsWidget->setOpenAllInNewTabText(tr("Open each topic in a new tab"));
ui->groupFrameSettingsWidget->setType(GroupFrameSettings::Posted);
}
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 */
void PostedPage::load()
{

View File

@ -36,8 +36,6 @@ public:
PostedPage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
~PostedPage();
/** Saves the changes on this page */
virtual bool save(QString &errmsg);
/** Loads the settings for this page */
virtual void load();

View File

@ -51,6 +51,16 @@ RelayPage::RelayPage(QWidget * parent, Qt::WindowFlags flags)
QObject::connect(ui.enableCheckBox,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
@ -66,10 +76,8 @@ QString RelayPage::helpText() const
is encrypted and authenticated by the two relayed nodes.</p>") ;
}
/** Saves the changes on this page */
bool RelayPage::save(QString &/*errmsg*/)
void RelayPage::updateTotals()
{
int nFriends = ui.noFriendSpinBox->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_FOF, nFOF, 1024 * fofBandwidth);
rsDht->setRelayAllowance(RSDHT_RELAY_CLASS_GENERAL, nGeneral, 1024 * genBandwidth);
}
/** Saves the changes on this page */
void RelayPage::updateRelayMode()
{
uint32_t relayMode = 0;
if (ui.enableCheckBox->isChecked())
{
@ -106,7 +119,6 @@ bool RelayPage::save(QString &/*errmsg*/)
}
rsDht->setRelayMode(relayMode);
return true;
}
/** Loads the settings for this page */
@ -182,13 +194,9 @@ void RelayPage::updateRelayOptions()
int genBandwidth = ui.bandGeneralSpinBox->value();
ui.totalFriendLineEdit->setText(QString::number(nFriends * friendBandwidth * 2));
ui.totalFOFLineEdit->setText(QString::number(nFOF * fofBandwidth * 2));
ui.totalGeneralLineEdit->setText(QString::number(nGeneral * genBandwidth * 2));
ui.totalBandwidthLineEdit->setText(QString::number((nFriends * friendBandwidth + nFOF * fofBandwidth + nGeneral * genBandwidth) * 2));
ui.noTotalLineEdit->setText(QString::number(nFriends + nFOF + nGeneral));
}

View File

@ -35,8 +35,6 @@ class RelayPage: public ConfigPage
RelayPage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
~RelayPage() {}
/** Saves the changes on this page */
virtual bool save(QString &/*errmsg*/);
/** Loads the settings for this page */
virtual void load();
@ -51,6 +49,8 @@ class RelayPage: public ConfigPage
void addServer();
void removeServer();
void loadServers();
void updateTotals();
void updateRelayMode();
private:

View File

@ -58,11 +58,6 @@ ServerPage::ServerPage(QWidget * parent, Qt::WindowFlags 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) ) );
connect( ui.cleanKnownIPs_PB, SIGNAL( clicked( ) ), this, SLOT( clearKnownAddressList() ) );
connect( ui.testIncoming_PB, SIGNAL( clicked( ) ), this, SLOT( updateInProxyIndicator() ) );
manager = NULL ;
ui.filteredIpsTable->setHorizontalHeaderItem(COLUMN_RANGE,new QTableWidgetItem(tr("IP Range"))) ;
@ -107,11 +102,32 @@ ServerPage::ServerPage(QWidget * parent, Qt::WindowFlags flags)
ui.hiddenpage_incoming->setVisible(false);
connect( ui.netModeComboBox, SIGNAL( activated ( int ) ), this, SLOT( toggleUPnP( ) ) );
connect( ui.allowIpDeterminationCB, SIGNAL( toggled( bool ) ), this, SLOT( toggleIpDetermination(bool) ) );
connect( ui.cleanKnownIPs_PB, SIGNAL( clicked( ) ), this, SLOT( clearKnownAddressList() ) );
connect( ui.testIncoming_PB, SIGNAL( clicked( ) ), this, SLOT( updateInProxyIndicator() ) );
connect( ui.showDiscStatusBar,SIGNAL(toggled(bool)),this,SLOT(updateShowDiscStatusBar())) ;
#ifdef SERVER_DEBUG
std::cerr << "ServerPage::ServerPage() called";
std::cerr << std::endl;
#endif
connect(ui.netModeComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(saveAddresses()));
connect(ui.discComboBox, SIGNAL(currentIndexChanged(int)),this,SLOT(saveAddresses()));
connect(ui.localAddress, SIGNAL(textChanged(QString)),this,SLOT(saveAddresses()));
connect(ui.extAddress, SIGNAL(textChanged(QString)),this,SLOT(saveAddresses()));
connect(ui.dynDNS, SIGNAL(textChanged(QString)),this,SLOT(saveAddresses()));
connect(ui.hiddenpage_proxyAddress_tor, SIGNAL(textChanged(QString)),this,SLOT(saveAddresses()));
connect(ui.hiddenpage_proxyPort_tor, SIGNAL(textChanged(QString)),this,SLOT(saveAddresses()));
connect(ui.hiddenpage_proxyAddress_i2p, SIGNAL(textChanged(QString)),this,SLOT(saveAddresses()));
connect(ui.hiddenpage_proxyPort_i2p, SIGNAL(textChanged(QString)),this,SLOT(saveAddresses()));
connect(ui.totalDownloadRate,SIGNAL(valueChanged(int)),this,SLOT(saveRates()));
connect(ui.totalUploadRate, SIGNAL(valueChanged(int)),this,SLOT(saveRates()));
}
void ServerPage::checkIpRange(const QString& ipstr)
{
QColor color;
@ -183,22 +199,7 @@ void ServerPage::toggleTunnelConnection(bool b)
//rsPeers->allowTunnelConnection(b) ;
}
/** Saves the changes on this page */
bool
ServerPage::save(QString &/*errmsg*/)
{
Settings->setStatusBarFlag(STATUSBAR_DISC, ui.showDiscStatusBar->isChecked());
/* save the server address */
/* save local address */
/* save the url for DNS access */
/* restart server */
/* save all? */
saveAddresses();
return true;
}
void ServerPage::updateShowDiscStatusBar() { Settings->setStatusBarFlag(STATUSBAR_DISC, ui.showDiscStatusBar->isChecked()); }
/** Loads the settings for this page */
void ServerPage::load()
@ -815,7 +816,6 @@ void ServerPage::saveAddresses()
}
rsPeers->setDynDNS(ownId, ui.dynDNS->text().toStdString());
rsConfig->SetMaxDataRates( ui.totalDownloadRate->value(), ui.totalUploadRate->value() );
// HANDLE PROXY SERVER.
std::string orig_proxyaddr, new_proxyaddr;
@ -846,6 +846,10 @@ void ServerPage::saveAddresses()
load();
}
void ServerPage::saveRates()
{
rsConfig->SetMaxDataRates( ui.totalDownloadRate->value(), ui.totalUploadRate->value() );
}
/***********************************************************************************/
/***********************************************************************************/

View File

@ -47,8 +47,6 @@ public:
ServerPage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
~ServerPage() {}
/** Saves the changes on this page */
virtual bool save(QString &errmsg);
/** Loads the settings for this page */
virtual void load();
@ -81,6 +79,8 @@ private slots:
// server
void saveAddresses();
void saveRates();
void updateShowDiscStatusBar() ;
void toggleUPnP();
void toggleIpDetermination(bool) ;
void toggleTunnelConnection(bool) ;

View File

@ -31,16 +31,18 @@
ServicePermissionsPage::ServicePermissionsPage(QWidget * parent, Qt::WindowFlags flags) :
ConfigPage(parent, flags)
{
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
connect(ui.cb_hideOffline, SIGNAL(toggled(bool)), ui.frame, SLOT(setHideOffline(bool)));
//QObject::connect(ui.tableWidget,SIGNAL(itemChanged(QTableWidgetItem *)), this, SLOT(tableItemChanged(QTableWidgetItem *)));
ui.cb_hideOffline->setChecked(true);
ui.frame->setHideOffline(ui.cb_hideOffline->isChecked());
connect(ui.cb_hideOffline, SIGNAL(toggled(bool)), ui.frame, SLOT(setHideOffline(bool)));
//QObject::connect(ui.tableWidget,SIGNAL(itemChanged(QTableWidgetItem *)), this, SLOT(tableItemChanged(QTableWidgetItem *)));
// Not implemented?
ui.pushButton->hide();
ui.frame->setHideOffline(ui.cb_hideOffline->isChecked());
// Not implemented?
ui.pushButton->hide();
}
QString ServicePermissionsPage::helpText() const

View File

@ -35,8 +35,6 @@ public:
ServicePermissionsPage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
~ServicePermissionsPage() {}
/** Saves the changes on this page */
virtual bool save(QString &/*errmsg*/) { return true ;}
/** Loads the settings for this page */
virtual void load() {}

View File

@ -46,6 +46,7 @@ SoundPage::SoundPage(QWidget * parent, Qt::WindowFlags flags)
connect(ui.defaultButton, SIGNAL(clicked()), this, SLOT(defaultButtonClicked()));
connect(ui.browseButton, SIGNAL(clicked()), this, SLOT(browseButtonClicked()));
connect(ui.playButton, SIGNAL(clicked()), this, SLOT(playButtonClicked()));
connect(ui.eventTreeWidget, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(updateSounds()));
ui.eventTreeWidget->setColumnCount(COLUMN_COUNT);
@ -100,7 +101,7 @@ QTreeWidgetItem *SoundPage::addItem(QTreeWidgetItem *groupItem, const QString &n
}
/** Saves the changes on this page */
bool SoundPage::save(QString &/*errmsg*/)
void SoundPage::updateSounds()
{
QTreeWidgetItemIterator itemIterator(ui.eventTreeWidget);
QTreeWidgetItem *item = NULL;
@ -113,8 +114,6 @@ bool SoundPage::save(QString &/*errmsg*/)
SoundManager::setEventFilename(event, item->text(COLUMN_FILENAME));
}
}
return true;
}
/** Loads the settings for this page */

View File

@ -37,8 +37,6 @@ public:
/** Default Destructor */
~SoundPage();
/** Saves the changes on this page */
virtual bool save(QString &errmsg);
/** Loads the settings for this page */
virtual void load();
@ -52,6 +50,7 @@ private slots:
void defaultButtonClicked();
void browseButtonClicked();
void playButtonClicked();
void updateSounds();
private:
QTreeWidgetItem *addGroup(const QString &name);

View File

@ -35,8 +35,6 @@ class TransferPage: public ConfigPage
TransferPage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
~TransferPage() {}
/** Saves the changes on this page */
virtual bool save(QString &/*errmsg*/) { return true ; }
/** Loads the settings for this page */
virtual void load() {}

View File

@ -33,7 +33,7 @@ WebuiPage::~WebuiPage()
}
bool WebuiPage::save(QString &errmsg)
bool WebuiPage::updateParams(QString &errmsg)
{
std::cerr << "WebuiPage::save()" << std::endl;
bool ok = true;
@ -148,12 +148,15 @@ void WebuiPage::onEnableCBClicked(bool checked)
ui.params_GB->setEnabled(false);
ui.applyStartBrowser_PB->setEnabled(false);
}
QString S;
updateParams(S);
}
void WebuiPage::onApplyClicked()
{
QString errmsg;
bool ok = save(errmsg);
bool ok = updateParams(errmsg);
if(!ok)
{
QMessageBox::warning(0, tr("failed to start Webinterface"), "Failed to start the webinterface.");

View File

@ -20,8 +20,6 @@ public:
/** Default Destructor */
~WebuiPage();
/** Saves the changes on this page */
virtual bool save(QString &errmsg);
/** Loads the settings for this page */
virtual void load();
@ -47,6 +45,8 @@ private:
/** Qt Designer generated object */
Ui::WebuiPage ui;
bool updateParams(QString &errmsg);
static resource_api::ApiServer* apiServer;
static resource_api::ApiServerMHD* apiServerMHD;
#ifdef LIBRESAPI_LOCAL_SERVER

View File

@ -141,7 +141,7 @@ SettingsPage::initStackedWidget()
ui.stackedWidget->setCurrentIndex(-1);
ui.stackedWidget->removeWidget(ui.stackedWidget->widget(0));
addPage(new GeneralPage(0));
addPage(new GeneralPage());
addPage(new ServerPage());
addPage(new TransferPage());
addPage(new RelayPage() );
@ -211,39 +211,11 @@ SettingsPage::setNewPage(int page)
}
/** Saves changes made to settings. */
void
SettingsPage::saveChanges()
void SettingsPage::notifySettingsChanged()
{
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.... */
//rsicontrol -> ConfigSave();
if (NotifyQt::getInstance()) {
if (NotifyQt::getInstance())
NotifyQt::getInstance()->notifySettingsChanged();
}
close();
}

View File

@ -58,8 +58,10 @@ public slots:
void setNewPage(int page);
private slots:
/** Called when user clicks "Save Settings" */
void saveChanges();
void notifySettingsChanged();
// Called when user clicks "Save Settings"
//void saveChanges();
//void dialogFinished(int result);
private:
@ -67,7 +69,6 @@ private:
private:
FloatingHelpBrowser *mHelpBrowser;
//static RSettingsWin *_instance;
static int lastPage;
/* UI - from Designer */

View File

@ -23,6 +23,7 @@
#ifndef _CONFIGPAGE_H
#define _CONFIGPAGE_H
#include <iostream>
#include <QWidget>
class ConfigPage : public QWidget
@ -37,8 +38,6 @@ class ConfigPage : public QWidget
/** Pure virtual method. Subclassed pages save their config settings here
* and return true if everything was saved successfully. */
virtual bool save(QString &errmsg) = 0;
bool wasLoaded() { return loaded ; }
// Icon to be used to display the config page.
@ -53,6 +52,8 @@ class ConfigPage : public QWidget
//
virtual QString helpText() const = 0;
private:
virtual bool save(QString &errmsg) { std::cerr << "(EE) save() shoud not be called!" << std::endl; return true;}
protected:
virtual void showEvent(QShowEvent * /*event*/)
{