changed more ConfigPages to not requiring calls to save()

This commit is contained in:
csoler 2017-01-29 21:47:13 +01:00
parent bd379e6b89
commit 60d9ea006f
18 changed files with 310 additions and 254 deletions

View File

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

View File

@ -83,44 +83,53 @@ AppearancePage::AppearancePage(QWidget * parent, Qt::WindowFlags flags)
foreach (QString name, styleSheets.keys()) {
ui.cmboStyleSheet->addItem(name, styleSheets[name]);
}
connect(ui.cmboTollButtonsSize, SIGNAL(currentItemChanged(int)), this, SLOT(updateCmboToolButtonSize() ));
connect(ui.cmboListItemSize, SIGNAL(currentItemChanged(int)), this, SLOT(updateCmboListItemSize() ));
connect(ui.cmboTollButtonsStyle, SIGNAL(currentItemChanged(int)), this, SLOT(updateCmboToolButtonStyle()));
connect(ui.cmboLanguage, SIGNAL(currentItemChanged(int)), this, SLOT(updateLanguageCode() ));
connect(ui.cmboStyle, SIGNAL(currentItemChanged(int)), this, SLOT(updateInterfaceStyle() ));
connect(ui.cmboStyleSheet, SIGNAL(currentItemChanged(int)), this, SLOT(updateSheetName() ));
connect(ui.rbtPageOnToolBar, SIGNAL(toggled(bool)), this, SLOT(updateRbtPageOnToolBar() ));
connect(ui.rbtActionOnToolBar, SIGNAL(toggled(bool)), this, SLOT(updateActionButtonLoc() ));
connect(ui.checkBoxDisableSysTrayToolTip, SIGNAL(toggled(bool)), this, SLOT(updateStatusToolTip() ));
}
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() { Settings->setInterfaceStyle(ui.cmboStyle->currentText()); }
void AppearancePage::updateSheetName() { Settings->setSheetName(ui.cmboStyleSheet->itemData(ui.cmboStyleSheet->currentIndex()).toString()); }
void AppearancePage::updateRbtPageOnToolBar() { Settings->setPageButtonLoc(ui.rbtPageOnToolBar->isChecked());}
void AppearancePage::updateActionButtonLoc() { Settings->setActionButtonLoc(ui.rbtActionOnToolBar->isChecked()); }
void AppearancePage::updateStatusToolTip() { MainWindow::getInstance()->toggleStatusToolTip(ui.checkBoxDisableSysTrayToolTip->isChecked()); }
void AppearancePage::updateCmboToolButtonStyle()
{
Q_UNUSED(errmsg);
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());
switch (ui.cmboTollButtonsStyle->currentIndex())
{
case 0:
@ -136,6 +145,10 @@ bool AppearancePage::save(QString &errmsg)
default:
Settings->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
}
}
void AppearancePage::updateCmboToolButtonSize()
{
switch (ui.cmboTollButtonsSize->currentIndex())
{
case 0:
@ -157,6 +170,9 @@ bool AppearancePage::save(QString &errmsg)
case 5:
Settings->setToolButtonSize(128);
}
}
void AppearancePage::updateCmboListItemSize()
{
switch (ui.cmboListItemSize->currentIndex())
{
case 0:
@ -178,29 +194,10 @@ 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;
}
void AppearancePage::updateStyle() { Rshare::setStyle(ui.cmboStyle->currentText()); }
/** Loads the settings for this page */
void AppearancePage::load()
{

View File

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

View File

@ -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();

View File

@ -51,8 +51,12 @@ MessagePage::MessagePage(QWidget * parent, Qt::WindowFlags flags)
connect(ui.comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(distantMsgsComboBoxChanged(int)));
connect(ui.setMsgToReadOnActivate,SIGNAL(toggled(bool)), this,SLOT(updateMsgToReadOnActivate()));
connect(ui.loadEmbeddedImages, SIGNAL(toggled(bool)), this,SLOT(updateLoadEmbededImages() ));
connect(ui.openComboBox, SIGNAL(currentItemChanged(int)),this,SLOT(updateMsgOpen() ));
connect(ui.comboBox, SIGNAL(currebtItemChanged(int)),this,SLOT(updateDistantMsgs() ));
//ui.encryptedMsgs_CB->setEnabled(false) ;
connect(ui.comboBox, SIGNAL(currebtItemChanged(int)),this,SLOT(updateMsgTags() ));
}
MessagePage::~MessagePage()
@ -79,17 +83,13 @@ void MessagePage::distantMsgsComboBoxChanged(int i)
}
/** Saves the changes on this page */
bool
MessagePage::save(QString &/*errmsg*/)
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()
{
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());
std::map<uint32_t, std::pair<std::string, uint32_t> >::iterator Tag;
for (Tag = m_pTags->types.begin(); Tag != m_pTags->types.end(); ++Tag) {
// check for changed tags
@ -107,8 +107,6 @@ MessagePage::save(QString &/*errmsg*/)
}
}
}
return true;
}
/** Loads the settings for this page */
@ -166,6 +164,8 @@ void MessagePage::addTag()
m_changedTagIds.push_back(TagDlg.m_nId);
}
}
updateMsgTags();
}
void MessagePage::editTag()
@ -196,6 +196,7 @@ void MessagePage::editTag()
}
}
}
updateMsgTags();
}
void MessagePage::deleteTag()
@ -228,6 +229,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 +246,7 @@ void MessagePage::defaultTag()
}
}
updateMsgTags();
fillTags();
}

View File

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

View File

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

View File

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

View File

@ -54,7 +54,8 @@ NotifyPage::NotifyPage(QWidget * parent, Qt::WindowFlags flags)
int rowFeed = 0;
int rowToaster = 0;
int pluginCount = rsPlugins->nbPlugins();
for (int i = 0; i < pluginCount; ++i) {
for (int i = 0; i < pluginCount; ++i)
{
RsPlugin *rsPlugin = rsPlugins->plugin(i);
if (rsPlugin) {
FeedNotify *feedNotify = rsPlugin->qt_feedNotify();
@ -67,6 +68,8 @@ NotifyPage::NotifyPage(QWidget * parent, Qt::WindowFlags flags)
ui.feedLayout->addWidget(enabledCheckBox, rowFeed++);
mFeedNotifySettingList.push_back(FeedNotifySetting(feedNotify, enabledCheckBox));
connect(enabledCheckBox,SIGNAL(toggled(bool)),this,SLOT(updateFeedNotifySettings())) ;
}
}
@ -80,6 +83,8 @@ NotifyPage::NotifyPage(QWidget * parent, Qt::WindowFlags flags)
ui.toasterLayout->addWidget(enabledCheckBox, rowToaster++);
mToasterNotifySettingList.push_back(ToasterNotifySetting(toasterNotify, enabledCheckBox));
connect(enabledCheckBox,SIGNAL(toggled(bool)),this,SLOT(updateToasterNotifySettings())) ;
}
QMap<QString, QString> map;
@ -98,12 +103,15 @@ NotifyPage::NotifyPage(QWidget * parent, Qt::WindowFlags flags)
enabledCheckBox->setFont(font);
vbLayout->addWidget(enabledCheckBox);
mToasterNotifySettingList.push_back(ToasterNotifySetting(toasterNotify, enabledCheckBox));
connect(enabledCheckBox,SIGNAL(toggled(bool)),this,SLOT(updateToasterNotifySettings())) ;
}
ui.toasterLayout->addWidget(widget, rowToaster++);
}
}
}
}
}
/* add user notify */
@ -134,9 +142,46 @@ NotifyPage::NotifyPage(QWidget * parent, Qt::WindowFlags flags)
mUserNotifySettingList.push_back(UserNotifySetting(userNotify, enabledCheckBox, combinedCheckBox, blinkCheckBox));
connect(enabledCheckBox,SIGNAL(toggled(bool)),this,SLOT(updateUserNotifySettings())) ;
connect(blinkCheckBox,SIGNAL(toggled(bool)),this,SLOT(updateUserNotifySettings())) ;
connect(combinedCheckBox,SIGNAL(toggled(bool)),this,SLOT(updateUserNotifySettings())) ;
//To get ChatLobbyUserNotify Settings
if (!mChatLobbyUserNotify) mChatLobbyUserNotify = dynamic_cast<ChatLobbyUserNotify*>(*it);
}
connect(ui.popup_Connect, SIGNAL(toggled(bool)), this, SLOT(updateNotifyFlags())) ;
connect(ui.popup_NewMsg, SIGNAL(toggled(bool)), this, SLOT(updateNotifyFlags())) ;
connect(ui.popup_DownloadFinished, SIGNAL(toggled(bool)), this, SLOT(updateNotifyFlags())) ;
connect(ui.popup_PrivateChat, SIGNAL(toggled(bool)), this, SLOT(updateNotifyFlags())) ;
connect(ui.popup_GroupChat, SIGNAL(toggled(bool)), this, SLOT(updateNotifyFlags())) ;
connect(ui.popup_ChatLobby, SIGNAL(toggled(bool)), this, SLOT(updateNotifyFlags())) ;
connect(ui.popup_ConnectAttempt, SIGNAL(toggled(bool)), this, SLOT(updateNotifyFlags())) ;
connect(ui.message_ConnectAttempt, SIGNAL(toggled(bool)), this, SLOT(updateMessageFlags())) ;
connect(ui.notify_Peers, SIGNAL(toggled(bool)), this, SLOT(updateNewsFeedFlags()));
connect(ui.notify_Channels, SIGNAL(toggled(bool)), this, SLOT(updateNewsFeedFlags()));
connect(ui.notify_Forums, SIGNAL(toggled(bool)), this, SLOT(updateNewsFeedFlags()));
connect(ui.notify_Posted, SIGNAL(toggled(bool)), this, SLOT(updateNewsFeedFlags()));
connect(ui.notify_Messages, SIGNAL(toggled(bool)), this, SLOT(updateNewsFeedFlags()));
connect(ui.notify_Chat, SIGNAL(toggled(bool)), this, SLOT(updateNewsFeedFlags()));
connect(ui.notify_Security, SIGNAL(toggled(bool)), this, SLOT(updateNewsFeedFlags()));
connect(ui.notify_SecurityIp, SIGNAL(toggled(bool)), this, SLOT(updateNewsFeedFlags()));
connect(ui.systray_ChatLobby, SIGNAL(toggled(bool)),this,SLOT(updateSystrayChatLobby()));
connect(ui.systray_GroupChat, SIGNAL(toggled(bool)),this,SLOT(updateSystrayGroupChat()));
connect(ui.spinBoxToasterXMargin, SIGNAL(valueChanged(int)),this, SLOT(updateToasterMargin())) ;
connect(ui.spinBoxToasterYMargin, SIGNAL(valueChanged(int)),this, SLOT(updateToasterMargin())) ;
connect(ui.comboBoxToasterPosition, SIGNAL(currentIndexChanged(int)),this, SLOT(updateToasterPosition())) ;
connect(ui.chatLobbies_CountUnRead, SIGNAL(toggled(bool)),this, SLOT(updateChatLobbyUserNotify())) ;
connect(ui.chatLobbies_CheckNickName, SIGNAL(toggled(bool)),this, SLOT(updateChatLobbyUserNotify())) ;
connect(ui.chatLobbies_CountFollowingText, SIGNAL(toggled(bool)),this, SLOT(updateChatLobbyUserNotify())) ;
connect(ui.chatLobbies_TextToNotify, SIGNAL(textChanged(QString)),this, SLOT(updateChatLobbyUserNotify()));
connect(ui.chatLobbies_TextCaseSensitive, SIGNAL(toggled(bool)),this, SLOT(updateChatLobbyUserNotify())) ;
}
NotifyPage::~NotifyPage()
@ -203,64 +248,62 @@ uint NotifyPage::getNotifyFlags()
return notifyFlags;
}
/** Saves the changes on this page */
bool
NotifyPage::save(QString &/*errmsg*/)
void NotifyPage::updateFeedNotifySettings()
{
/* extract from rsNotify the flags */
uint messageflags = 0;
if (ui.message_ConnectAttempt->isChecked())
messageflags |= RS_MESSAGE_CONNECT_ATTEMPT;
/* save feed notify */
QList<FeedNotifySetting>::iterator feedNotifyIt;
for (feedNotifyIt = mFeedNotifySettingList.begin(); feedNotifyIt != mFeedNotifySettingList.end(); ++feedNotifyIt) {
for (feedNotifyIt = mFeedNotifySettingList.begin(); feedNotifyIt != mFeedNotifySettingList.end(); ++feedNotifyIt)
feedNotifyIt->mFeedNotify->setNotifyEnabled(feedNotifyIt->mEnabledCheckBox->isChecked());
}
}
void NotifyPage::updateToasterNotifySettings()
{
/* save toaster notify */
QList<ToasterNotifySetting>::iterator toasterNotifyIt;
for (toasterNotifyIt = mToasterNotifySettingList.begin(); toasterNotifyIt != mToasterNotifySettingList.end(); ++toasterNotifyIt) {
if(toasterNotifyIt->mEnabledCheckBox->accessibleName().isEmpty()){
if(toasterNotifyIt->mEnabledCheckBox->accessibleName().isEmpty())
toasterNotifyIt->mToasterNotify->setNotifyEnabled(toasterNotifyIt->mEnabledCheckBox->isChecked()) ;
} else {
else
toasterNotifyIt->mToasterNotify->setNotifyEnabled(toasterNotifyIt->mEnabledCheckBox->accessibleName(), toasterNotifyIt->mEnabledCheckBox->isChecked()) ;
}
}
}
void NotifyPage::updateUserNotifySettings()
{
/* save user notify */
QList<UserNotifySetting>::iterator notifyIt;
for (notifyIt = mUserNotifySettingList.begin(); notifyIt != mUserNotifySettingList.end(); ++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);
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;
}
/** Loads the settings for this page */

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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();

View File

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

View File

@ -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();