diff --git a/libretroshare/src/services/p3gxsreputation.cc b/libretroshare/src/services/p3gxsreputation.cc index aa64bec14..bf3dabfcb 100644 --- a/libretroshare/src/services/p3gxsreputation.cc +++ b/libretroshare/src/services/p3gxsreputation.cc @@ -1063,9 +1063,8 @@ bool p3GxsReputation::saveList(bool& cleanup, std::list &savelist) cleanup = true; RsStackMutex stack(mReputationMtx); /****** LOCKED MUTEX *******/ -#ifdef DEBUG_REPUTATION std::cerr << "p3GxsReputation::saveList()" << std::endl; -#endif + /* save */ std::map::iterator it; for(it = mConfig.begin(); it != mConfig.end(); ++it) diff --git a/retroshare-gui/src/gui/settings/AboutPage.h b/retroshare-gui/src/gui/settings/AboutPage.h index e374a0c23..3f41750e0 100644 --- a/retroshare-gui/src/gui/settings/AboutPage.h +++ b/retroshare-gui/src/gui/settings/AboutPage.h @@ -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(); diff --git a/retroshare-gui/src/gui/settings/AppearancePage.cpp b/retroshare-gui/src/gui/settings/AppearancePage.cpp index 7bc85a103..92747816b 100755 --- a/retroshare-gui/src/gui/settings/AppearancePage.cpp +++ b/retroshare-gui/src/gui/settings/AppearancePage.cpp @@ -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: diff --git a/retroshare-gui/src/gui/settings/AppearancePage.h b/retroshare-gui/src/gui/settings/AppearancePage.h index 2ae6ce212..a80b97d1a 100755 --- a/retroshare-gui/src/gui/settings/AppearancePage.h +++ b/retroshare-gui/src/gui/settings/AppearancePage.h @@ -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; diff --git a/retroshare-gui/src/gui/settings/AppearancePage.ui b/retroshare-gui/src/gui/settings/AppearancePage.ui index dface3903..f05634f8f 100755 --- a/retroshare-gui/src/gui/settings/AppearancePage.ui +++ b/retroshare-gui/src/gui/settings/AppearancePage.ui @@ -7,7 +7,7 @@ 0 0 1160 - 608 + 897 @@ -44,13 +44,6 @@ Language - - - - Changes to language will only take effect after restarting RetroShare! - - - @@ -70,7 +63,7 @@ - + Qt::Horizontal @@ -83,6 +76,13 @@ + + + + (Needs restart) + + + @@ -198,124 +198,84 @@ Tool Bar - - - - - QFrame::StyledPanel - - - QFrame::Plain - - - - 2 - - - 2 - - - 2 - - - 2 - - - + + + + + + + Main page items: + + + + + + - On Tool Bar + Buttons - - - - + + - On List Ite&m + Item list - - - - - - Qt::Horizontal - - - - 300 - 16 - - - - - - + + + + + + + Qt::Horizontal + + + + 300 + 16 + + + + + - - - - Where do you want to have the buttons for menu? - - - - - - - QFrame::StyledPanel - - - QFrame::Plain - - - - 2 - - - 2 - - - 2 - - - 2 - - - + + + + + + Menu items: + + + + + + - On Tool Bar + Buttons - - - - + + - On List Item + Item list - - - - - - Qt::Horizontal - - - - 300 - 16 - - - - - - + + + + + + + Qt::Horizontal + + + + 300 + 16 + + + + + - - - - Where do you want to have the buttons for the page? - - - - + diff --git a/retroshare-gui/src/gui/settings/ChannelPage.cpp b/retroshare-gui/src/gui/settings/ChannelPage.cpp index ca6c55031..b58035a01 100644 --- a/retroshare-gui/src/gui/settings/ChannelPage.cpp +++ b/retroshare-gui/src/gui/settings/ChannelPage.cpp @@ -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() { diff --git a/retroshare-gui/src/gui/settings/ChannelPage.h b/retroshare-gui/src/gui/settings/ChannelPage.h index 40e343fc0..69e28455b 100644 --- a/retroshare-gui/src/gui/settings/ChannelPage.h +++ b/retroshare-gui/src/gui/settings/ChannelPage.h @@ -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; }; diff --git a/retroshare-gui/src/gui/settings/ChatPage.cpp b/retroshare-gui/src/gui/settings/ChatPage.cpp index 8f74c69d9..b2f5d8478 100644 --- a/retroshare-gui/src/gui/settings/ChatPage.cpp +++ b/retroshare-gui/src/gui/settings/ChatPage.cpp @@ -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(); + 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(); + 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(); + 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(); - 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(); - 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(); - 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 */ diff --git a/retroshare-gui/src/gui/settings/ChatPage.h b/retroshare-gui/src/gui/settings/ChatPage.h index f6445d4d5..8f7048e2c 100644 --- a/retroshare-gui/src/gui/settings/ChatPage.h +++ b/retroshare-gui/src/gui/settings/ChatPage.h @@ -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); diff --git a/retroshare-gui/src/gui/settings/CryptoPage.cpp b/retroshare-gui/src/gui/settings/CryptoPage.cpp index 8cca2756c..1aa30b520 100755 --- a/retroshare-gui/src/gui/settings/CryptoPage.cpp +++ b/retroshare-gui/src/gui/settings/CryptoPage.cpp @@ -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() diff --git a/retroshare-gui/src/gui/settings/CryptoPage.h b/retroshare-gui/src/gui/settings/CryptoPage.h index a1bcb42f0..fb07b0da7 100755 --- a/retroshare-gui/src/gui/settings/CryptoPage.h +++ b/retroshare-gui/src/gui/settings/CryptoPage.h @@ -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(); diff --git a/retroshare-gui/src/gui/settings/DirectoriesPage.cpp b/retroshare-gui/src/gui/settings/DirectoriesPage.cpp index c3c466980..7fdd90cbb 100755 --- a/retroshare-gui/src/gui/settings/DirectoriesPage.cpp +++ b/retroshare-gui/src/gui/settings/DirectoriesPage.cpp @@ -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); } diff --git a/retroshare-gui/src/gui/settings/DirectoriesPage.h b/retroshare-gui/src/gui/settings/DirectoriesPage.h index ffeb1bf34..dfb0f15cd 100755 --- a/retroshare-gui/src/gui/settings/DirectoriesPage.h +++ b/retroshare-gui/src/gui/settings/DirectoriesPage.h @@ -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; }; diff --git a/retroshare-gui/src/gui/settings/FileAssociationsPage.cpp b/retroshare-gui/src/gui/settings/FileAssociationsPage.cpp index 95bd33cf1..d8f5f003c 100755 --- a/retroshare-gui/src/gui/settings/FileAssociationsPage.cpp +++ b/retroshare-gui/src/gui/settings/FileAssociationsPage.cpp @@ -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::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() { diff --git a/retroshare-gui/src/gui/settings/FileAssociationsPage.h b/retroshare-gui/src/gui/settings/FileAssociationsPage.h index 769dbabb0..078a437e0 100755 --- a/retroshare-gui/src/gui/settings/FileAssociationsPage.h +++ b/retroshare-gui/src/gui/settings/FileAssociationsPage.h @@ -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") ; } diff --git a/retroshare-gui/src/gui/settings/ForumPage.cpp b/retroshare-gui/src/gui/settings/ForumPage.cpp index 90ff1f176..d7681762e 100644 --- a/retroshare-gui/src/gui/settings/ForumPage.cpp +++ b/retroshare-gui/src/gui/settings/ForumPage.cpp @@ -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() diff --git a/retroshare-gui/src/gui/settings/ForumPage.h b/retroshare-gui/src/gui/settings/ForumPage.h index 6e1082a19..d4ca206e1 100644 --- a/retroshare-gui/src/gui/settings/ForumPage.h +++ b/retroshare-gui/src/gui/settings/ForumPage.h @@ -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; }; diff --git a/retroshare-gui/src/gui/settings/GeneralPage.cpp b/retroshare-gui/src/gui/settings/GeneralPage.cpp index 7aa5f016f..deed5a031 100755 --- a/retroshare-gui/src/gui/settings/GeneralPage.cpp +++ b/retroshare-gui/src/gui/settings/GeneralPage.cpp @@ -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 */ diff --git a/retroshare-gui/src/gui/settings/GeneralPage.h b/retroshare-gui/src/gui/settings/GeneralPage.h index fd7b90a33..d28146915 100755 --- a/retroshare-gui/src/gui/settings/GeneralPage.h +++ b/retroshare-gui/src/gui/settings/GeneralPage.h @@ -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 diff --git a/retroshare-gui/src/gui/settings/GroupFrameSettingsWidget.cpp b/retroshare-gui/src/gui/settings/GroupFrameSettingsWidget.cpp index 5b55ff689..ad5e06c5c 100644 --- a/retroshare-gui/src/gui/settings/GroupFrameSettingsWidget.cpp +++ b/retroshare-gui/src/gui/settings/GroupFrameSettingsWidget.cpp @@ -1,3 +1,5 @@ +#include + #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); } } diff --git a/retroshare-gui/src/gui/settings/GroupFrameSettingsWidget.h b/retroshare-gui/src/gui/settings/GroupFrameSettingsWidget.h index 418a9f9e6..aa7eb1b82 100644 --- a/retroshare-gui/src/gui/settings/GroupFrameSettingsWidget.h +++ b/retroshare-gui/src/gui/settings/GroupFrameSettingsWidget.h @@ -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 diff --git a/retroshare-gui/src/gui/settings/MessagePage.cpp b/retroshare-gui/src/gui/settings/MessagePage.cpp index 89dcaa0ac..1aa4509f0 100644 --- a/retroshare-gui/src/gui/settings/MessagePage.cpp +++ b/retroshare-gui/src/gui/settings/MessagePage.cpp @@ -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 >::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(); } diff --git a/retroshare-gui/src/gui/settings/MessagePage.h b/retroshare-gui/src/gui/settings/MessagePage.h index 99d3ca5f2..c58ab6e0f 100644 --- a/retroshare-gui/src/gui/settings/MessagePage.h +++ b/retroshare-gui/src/gui/settings/MessagePage.h @@ -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(); diff --git a/retroshare-gui/src/gui/settings/NetworkPage.cpp b/retroshare-gui/src/gui/settings/NetworkPage.cpp index 4bc31e1b2..0c0bd7f67 100755 --- a/retroshare-gui/src/gui/settings/NetworkPage.cpp +++ b/retroshare-gui/src/gui/settings/NetworkPage.cpp @@ -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() diff --git a/retroshare-gui/src/gui/settings/NetworkPage.h b/retroshare-gui/src/gui/settings/NetworkPage.h index 9244e99a0..fa1cf8968 100755 --- a/retroshare-gui/src/gui/settings/NetworkPage.h +++ b/retroshare-gui/src/gui/settings/NetworkPage.h @@ -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(); diff --git a/retroshare-gui/src/gui/settings/NotifyPage.cpp b/retroshare-gui/src/gui/settings/NotifyPage.cpp index 1c31af679..2c9dbde5b 100755 --- a/retroshare-gui/src/gui/settings/NotifyPage.cpp +++ b/retroshare-gui/src/gui/settings/NotifyPage.cpp @@ -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 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::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 &userNotifyList = MainWindow::getInstance()->getUserNotifyList(); - QList::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 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::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 &userNotifyList = MainWindow::getInstance()->getUserNotifyList(); + QList::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(*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(*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::iterator feedNotifyIt; - for (feedNotifyIt = mFeedNotifySettingList.begin(); feedNotifyIt != mFeedNotifySettingList.end(); ++feedNotifyIt) { - feedNotifyIt->mFeedNotify->setNotifyEnabled(feedNotifyIt->mEnabledCheckBox->isChecked()); - } + /* save feed notify */ + QList::iterator feedNotifyIt; + for (feedNotifyIt = mFeedNotifySettingList.begin(); feedNotifyIt != mFeedNotifySettingList.end(); ++feedNotifyIt) + feedNotifyIt->mFeedNotify->setNotifyEnabled(feedNotifyIt->mEnabledCheckBox->isChecked()); +} +void NotifyPage::updateToasterNotifySettings() +{ /* save toaster notify */ QList::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::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::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 */ diff --git a/retroshare-gui/src/gui/settings/NotifyPage.h b/retroshare-gui/src/gui/settings/NotifyPage.h index 900c8efb6..547af2767 100755 --- a/retroshare-gui/src/gui/settings/NotifyPage.h +++ b/retroshare-gui/src/gui/settings/NotifyPage.h @@ -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(); diff --git a/retroshare-gui/src/gui/settings/PeoplePage.cpp b/retroshare-gui/src/gui/settings/PeoplePage.cpp index 66265f4de..8f95b2b2f 100644 --- a/retroshare-gui/src/gui/settings/PeoplePage.cpp +++ b/retroshare-gui/src/gui/settings/PeoplePage.cpp @@ -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() { diff --git a/retroshare-gui/src/gui/settings/PeoplePage.h b/retroshare-gui/src/gui/settings/PeoplePage.h index 393436f57..b3e14adfa 100644 --- a/retroshare-gui/src/gui/settings/PeoplePage.h +++ b/retroshare-gui/src/gui/settings/PeoplePage.h @@ -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; }; diff --git a/retroshare-gui/src/gui/settings/PluginsPage.cpp b/retroshare-gui/src/gui/settings/PluginsPage.cpp index 39bd39a4a..cdc326ec0 100644 --- a/retroshare-gui/src/gui/settings/PluginsPage.cpp +++ b/retroshare-gui/src/gui/settings/PluginsPage.cpp @@ -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() { diff --git a/retroshare-gui/src/gui/settings/PluginsPage.h b/retroshare-gui/src/gui/settings/PluginsPage.h index 08354ca68..0d8f72dac 100644 --- a/retroshare-gui/src/gui/settings/PluginsPage.h +++ b/retroshare-gui/src/gui/settings/PluginsPage.h @@ -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(); diff --git a/retroshare-gui/src/gui/settings/PostedPage.cpp b/retroshare-gui/src/gui/settings/PostedPage.cpp index 30b18f24d..76b3411b0 100644 --- a/retroshare-gui/src/gui/settings/PostedPage.cpp +++ b/retroshare-gui/src/gui/settings/PostedPage.cpp @@ -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() { diff --git a/retroshare-gui/src/gui/settings/PostedPage.h b/retroshare-gui/src/gui/settings/PostedPage.h index 73a454c5f..bc2cb8aa0 100644 --- a/retroshare-gui/src/gui/settings/PostedPage.h +++ b/retroshare-gui/src/gui/settings/PostedPage.h @@ -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(); diff --git a/retroshare-gui/src/gui/settings/RelayPage.cpp b/retroshare-gui/src/gui/settings/RelayPage.cpp index a7cc7e041..258bc05aa 100644 --- a/retroshare-gui/src/gui/settings/RelayPage.cpp +++ b/retroshare-gui/src/gui/settings/RelayPage.cpp @@ -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.

") ; } - /** 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)); } diff --git a/retroshare-gui/src/gui/settings/RelayPage.h b/retroshare-gui/src/gui/settings/RelayPage.h index d88dbd07b..5c8036926 100644 --- a/retroshare-gui/src/gui/settings/RelayPage.h +++ b/retroshare-gui/src/gui/settings/RelayPage.h @@ -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: diff --git a/retroshare-gui/src/gui/settings/ServerPage.cpp b/retroshare-gui/src/gui/settings/ServerPage.cpp index 8ece6d7cd..c80a56bbe 100755 --- a/retroshare-gui/src/gui/settings/ServerPage.cpp +++ b/retroshare-gui/src/gui/settings/ServerPage.cpp @@ -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() ); +} /***********************************************************************************/ /***********************************************************************************/ diff --git a/retroshare-gui/src/gui/settings/ServerPage.h b/retroshare-gui/src/gui/settings/ServerPage.h index 4561cd7ca..02685bfc0 100755 --- a/retroshare-gui/src/gui/settings/ServerPage.h +++ b/retroshare-gui/src/gui/settings/ServerPage.h @@ -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) ; diff --git a/retroshare-gui/src/gui/settings/ServicePermissionsPage.cpp b/retroshare-gui/src/gui/settings/ServicePermissionsPage.cpp index 5ded8fb80..d608c24af 100644 --- a/retroshare-gui/src/gui/settings/ServicePermissionsPage.cpp +++ b/retroshare-gui/src/gui/settings/ServicePermissionsPage.cpp @@ -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 diff --git a/retroshare-gui/src/gui/settings/ServicePermissionsPage.h b/retroshare-gui/src/gui/settings/ServicePermissionsPage.h index abc54c9b0..b8559bbef 100644 --- a/retroshare-gui/src/gui/settings/ServicePermissionsPage.h +++ b/retroshare-gui/src/gui/settings/ServicePermissionsPage.h @@ -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() {} diff --git a/retroshare-gui/src/gui/settings/SoundPage.cpp b/retroshare-gui/src/gui/settings/SoundPage.cpp index ef93c7679..8b3f79a39 100644 --- a/retroshare-gui/src/gui/settings/SoundPage.cpp +++ b/retroshare-gui/src/gui/settings/SoundPage.cpp @@ -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 */ diff --git a/retroshare-gui/src/gui/settings/SoundPage.h b/retroshare-gui/src/gui/settings/SoundPage.h index 831233784..989fcc1a2 100644 --- a/retroshare-gui/src/gui/settings/SoundPage.h +++ b/retroshare-gui/src/gui/settings/SoundPage.h @@ -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); diff --git a/retroshare-gui/src/gui/settings/TransferPage.h b/retroshare-gui/src/gui/settings/TransferPage.h index 75cab1b4c..eca52ace5 100644 --- a/retroshare-gui/src/gui/settings/TransferPage.h +++ b/retroshare-gui/src/gui/settings/TransferPage.h @@ -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() {} diff --git a/retroshare-gui/src/gui/settings/WebuiPage.cpp b/retroshare-gui/src/gui/settings/WebuiPage.cpp index f8923a174..4afad5968 100644 --- a/retroshare-gui/src/gui/settings/WebuiPage.cpp +++ b/retroshare-gui/src/gui/settings/WebuiPage.cpp @@ -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."); diff --git a/retroshare-gui/src/gui/settings/WebuiPage.h b/retroshare-gui/src/gui/settings/WebuiPage.h index 3ff6a45a9..c7e167ff8 100644 --- a/retroshare-gui/src/gui/settings/WebuiPage.h +++ b/retroshare-gui/src/gui/settings/WebuiPage.h @@ -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 diff --git a/retroshare-gui/src/gui/settings/rsettingswin.cpp b/retroshare-gui/src/gui/settings/rsettingswin.cpp index 50052eaa1..1b88cbb53 100644 --- a/retroshare-gui/src/gui/settings/rsettingswin.cpp +++ b/retroshare-gui/src/gui/settings/rsettingswin.cpp @@ -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(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(); } diff --git a/retroshare-gui/src/gui/settings/rsettingswin.h b/retroshare-gui/src/gui/settings/rsettingswin.h index 51371f8f7..eff14f31b 100755 --- a/retroshare-gui/src/gui/settings/rsettingswin.h +++ b/retroshare-gui/src/gui/settings/rsettingswin.h @@ -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 */ diff --git a/retroshare-gui/src/retroshare-gui/configpage.h b/retroshare-gui/src/retroshare-gui/configpage.h index 1299f2b3f..ecb292740 100644 --- a/retroshare-gui/src/retroshare-gui/configpage.h +++ b/retroshare-gui/src/retroshare-gui/configpage.h @@ -23,6 +23,7 @@ #ifndef _CONFIGPAGE_H #define _CONFIGPAGE_H +#include #include 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*/) {