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

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

View File

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

View File

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

View File

@ -31,6 +31,7 @@
#include "AppearancePage.h" #include "AppearancePage.h"
#include "rsharesettings.h" #include "rsharesettings.h"
#include "gui/MainWindow.h" #include "gui/MainWindow.h"
#include "gui/notifyqt.h"
#include "gui/statusbar/peerstatus.h" #include "gui/statusbar/peerstatus.h"
#include "gui/statusbar/natstatus.h" #include "gui/statusbar/natstatus.h"
#include "gui/statusbar/dhtstatus.h" #include "gui/statusbar/dhtstatus.h"
@ -83,44 +84,66 @@ AppearancePage::AppearancePage(QWidget * parent, Qt::WindowFlags flags)
foreach (QString name, styleSheets.keys()) { foreach (QString name, styleSheets.keys()) {
ui.cmboStyleSheet->addItem(name, styleSheets[name]); 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_grpStatus(bool b) { switch_status(MainWindow::StatusGrpStatus ,"ShowStatusBar", b) ; }
void AppearancePage::switch_status_compactMode(bool b) { switch_status(MainWindow::StatusCompactMode,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,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 ,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 ,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 ,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,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 ,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 ,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 ,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 ,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,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,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(); MainWindow *pMainWindow = MainWindow::getInstance();
if(!pMainWindow) if(!pMainWindow)
return ; return ;
Settings->setValueToGroup("StatusBar", key, QVariant(b));
pMainWindow->switchVisibilityStatus(s,b) ; pMainWindow->switchVisibilityStatus(s,b) ;
} }
/** Saves the changes on this page */ void AppearancePage::updateLanguageCode() { Settings->setLanguageCode(LanguageSupport::languageCode(ui.cmboLanguage->currentText())); }
bool AppearancePage::save(QString &errmsg) 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()); void AppearancePage::updateCmboToolButtonStyle()
{
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()) switch (ui.cmboTollButtonsStyle->currentIndex())
{ {
case 0: case 0:
@ -136,6 +159,11 @@ bool AppearancePage::save(QString &errmsg)
default: default:
Settings->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); Settings->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
} }
NotifyQt::getInstance()->notifySettingsChanged();
}
void AppearancePage::updateCmboToolButtonSize()
{
switch (ui.cmboTollButtonsSize->currentIndex()) switch (ui.cmboTollButtonsSize->currentIndex())
{ {
case 0: case 0:
@ -157,6 +185,10 @@ bool AppearancePage::save(QString &errmsg)
case 5: case 5:
Settings->setToolButtonSize(128); Settings->setToolButtonSize(128);
} }
NotifyQt::getInstance()->notifySettingsChanged();
}
void AppearancePage::updateCmboListItemSize()
{
switch (ui.cmboListItemSize->currentIndex()) switch (ui.cmboListItemSize->currentIndex())
{ {
case 0: case 0:
@ -178,29 +210,11 @@ bool AppearancePage::save(QString &errmsg)
case 5: case 5:
Settings->setListItemIconSize(128); Settings->setListItemIconSize(128);
} }
NotifyQt::getInstance()->notifySettingsChanged();
/* 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 */ /** Loads the settings for this page */
void AppearancePage::load() void AppearancePage::load()
{ {
@ -217,10 +231,9 @@ void AppearancePage::load()
} }
ui.cmboStyleSheet->setCurrentIndex(index); ui.cmboStyleSheet->setCurrentIndex(index);
ui.rbtPageOnToolBar->setChecked(Settings->getPageButtonLoc()); ui.mainPageButtonType_CB->setCurrentIndex(!Settings->getPageButtonLoc());
ui.rbtPageOnListItem->setChecked(!Settings->getPageButtonLoc()); ui.menuItemsButtonType_CB->setCurrentIndex(!Settings->getActionButtonLoc());
ui.rbtActionOnToolBar->setChecked(Settings->getActionButtonLoc());
ui.rbtActionOnListItem->setChecked(!Settings->getActionButtonLoc());
switch (Settings->getToolButtonStyle()) switch (Settings->getToolButtonStyle())
{ {
case Qt::ToolButtonIconOnly: case Qt::ToolButtonIconOnly:

View File

@ -34,8 +34,6 @@ public:
/** Default Constructor */ /** Default Constructor */
AppearancePage(QWidget * parent = 0, Qt::WindowFlags flags = 0); 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 */ /** Loads the settings for this page */
virtual void load(); virtual void load();
@ -60,8 +58,20 @@ private slots:
void switch_status_ShowToaster(bool) ; void switch_status_ShowToaster(bool) ;
void switch_status_ShowSystray(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: private:
void switch_status(MainWindow::StatusElement s,bool b); void switch_status(MainWindow::StatusElement s,const QString& key,bool b);
/** Qt Designer generated object */ /** Qt Designer generated object */
Ui::AppearancePage ui; Ui::AppearancePage ui;

View File

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

View File

@ -30,21 +30,17 @@ ChannelPage::ChannelPage(QWidget * parent, Qt::WindowFlags flags)
/* Initialize GroupFrameSettingsWidget */ /* Initialize GroupFrameSettingsWidget */
ui.groupFrameSettingsWidget->setOpenAllInNewTabText(tr("Open each channel in a new tab")); ui.groupFrameSettingsWidget->setOpenAllInNewTabText(tr("Open each channel in a new tab"));
ui.groupFrameSettingsWidget->setType(GroupFrameSettings::Channel) ;
connect(ui.loadThreadCheckBox,SIGNAL(toggled(bool)),this,SLOT(updateLoadThread)) ;
} }
void ChannelPage::updateLoadThread() { Settings->setChannelLoadThread(ui.loadThreadCheckBox->isChecked()); }
ChannelPage::~ChannelPage() ChannelPage::~ChannelPage()
{ {
} }
/** Saves the changes on this page */
bool ChannelPage::save(QString &/*errmsg*/)
{
Settings->setChannelLoadThread(ui.loadThreadCheckBox->isChecked());
ui.groupFrameSettingsWidget->saveSettings(GroupFrameSettings::Channel);
return true;
}
/** Loads the settings for this page */ /** Loads the settings for this page */
void ChannelPage::load() void ChannelPage::load()
{ {

View File

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

View File

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

View File

@ -35,8 +35,6 @@ class ChatPage : public ConfigPage
/** Default Destructor */ /** Default Destructor */
~ChatPage() {} ~ChatPage() {}
/** Saves the changes on this page */
virtual bool save(QString &errmsg);
/** Loads the settings for this page */ /** Loads the settings for this page */
virtual void load(); virtual void load();
@ -58,6 +56,17 @@ class ChatPage : public ConfigPage
void distantChatComboBoxChanged(int); 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: private:
void setPreviewMessages(QString &stylePath, QString styleVariant, QTextBrowser *textBrowser); void setPreviewMessages(QString &stylePath, QString styleVariant, QTextBrowser *textBrowser);

View File

@ -92,13 +92,6 @@ CryptoPage::~CryptoPage()
{ {
} }
/** Saves the changes on this page */
bool
CryptoPage::save(QString &/*errmsg*/)
{
return true;
}
/** Loads the settings for this page */ /** Loads the settings for this page */
void void
CryptoPage::load() CryptoPage::load()

View File

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

View File

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

View File

@ -32,8 +32,6 @@ class DirectoriesPage: public ConfigPage
public: public:
DirectoriesPage(QWidget * parent = 0, Qt::WindowFlags flags = 0); DirectoriesPage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
/** Saves the changes on this page */
virtual bool save(QString &errmsg);
/** Loads the settings for this page */ /** Loads the settings for this page */
virtual void load(); virtual void load();
@ -47,6 +45,11 @@ private slots:
void setPartialsDirectory(); void setPartialsDirectory();
void toggleAutoCheckDirectories(bool); void toggleAutoCheckDirectories(bool);
void updateAutoCheckDirectories() ;
void updateAutoScanDirectoriesPeriod() ;
void updateShareDownloadDirectory() ;
void updateFollowSymLinks() ;
private: private:
Ui::DirectoriesPage ui; Ui::DirectoriesPage ui;
}; };

View File

@ -131,38 +131,6 @@ FileAssociationsPage::~FileAssociationsPage()
{ {
} }
//============================================================================
bool
FileAssociationsPage::save (QString &/*errmsg*/)
{
// RshareSettings settings;
// settings.beginGroup("FileAssotiations");
// settings.setValue(".s01", "s01 test");
// settings.setValue(".s02", "s02 test");
// settings.setValue(".s03", "s03 test");
// settings.setValue(".s04", "s04 test");
// QMap<QString, QString>::const_iterator ati = ations.constBegin();
// while (ati != ations.constEnd())
// {
// settings.setValue( ati.key(), ati.value() );
// qDebug() << " - " << ati.key() << ati.value() << "\n" ;
// ++ati;
// }
//
// settings.endGroup();
// settings.sync();
// delete settings;
/* */
return true;
}
//============================================================================
void void
FileAssociationsPage::load() FileAssociationsPage::load()
{ {

View File

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

View File

@ -30,24 +30,23 @@ ForumPage::ForumPage(QWidget * parent, Qt::WindowFlags flags)
/* Initialize GroupFrameSettingsWidget */ /* Initialize GroupFrameSettingsWidget */
ui.groupFrameSettingsWidget->setOpenAllInNewTabText(tr("Open each forum in a new tab")); ui.groupFrameSettingsWidget->setOpenAllInNewTabText(tr("Open each forum in a new tab"));
connect(ui.setMsgToReadOnActivate,SIGNAL(toggled(bool)),this,SLOT(updateMsgReadOnActivate())) ;
connect(ui.expandNewMessages , SIGNAL(toggled(bool)), this, SLOT( updateExpandNewMessages()));
connect(ui.loadEmbeddedImages , SIGNAL(toggled(bool)), this, SLOT(updateLoadEmbeddedImage() ));
connect(ui.loadEmoticons , SIGNAL(toggled(bool)), this, SLOT( updateLoadEmoticons() ));
ui.groupFrameSettingsWidget->setType(GroupFrameSettings::Forum) ;
} }
ForumPage::~ForumPage() ForumPage::~ForumPage()
{ {
} }
/** Saves the changes on this page */ void ForumPage::updateMsgReadOnActivate() { Settings->setForumMsgSetToReadOnActivate(ui.setMsgToReadOnActivate->isChecked()); }
bool ForumPage::save(QString &/*errmsg*/) void ForumPage::updateExpandNewMessages() { Settings->setForumExpandNewMessages( ui.expandNewMessages ->isChecked());}
{ void ForumPage::updateLoadEmbeddedImages() { Settings->setForumLoadEmbeddedImages( ui.loadEmbeddedImages ->isChecked());}
Settings->setForumMsgSetToReadOnActivate(ui.setMsgToReadOnActivate->isChecked()); void ForumPage::updateLoadEmoticons() { Settings->setForumLoadEmoticons( ui.loadEmoticons ->isChecked()); }
Settings->setForumExpandNewMessages(ui.expandNewMessages->isChecked());
Settings->setForumLoadEmbeddedImages(ui.loadEmbeddedImages->isChecked());
Settings->setForumLoadEmoticons(ui.loadEmoticons->isChecked());
ui.groupFrameSettingsWidget->saveSettings(GroupFrameSettings::Forum);
return true;
}
/** Loads the settings for this page */ /** Loads the settings for this page */
void ForumPage::load() void ForumPage::load()

View File

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

View File

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

View File

@ -28,28 +28,37 @@
class GeneralPage : public ConfigPage class GeneralPage : public ConfigPage
{ {
Q_OBJECT Q_OBJECT
public: public:
/** Default Constructor */ /** Default Constructor */
GeneralPage(QWidget * parent = 0, Qt::WindowFlags flags = 0); GeneralPage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
/** Default Destructor */ /** Default Destructor */
~GeneralPage(); ~GeneralPage();
/** Saves the changes on this page */ /** Saves the changes on this page */
virtual bool save(QString &errmsg); /** Loads the settings for this page */
/** Loads the settings for this page */ virtual void load();
virtual void load();
virtual QPixmap iconPixmap() const { return QPixmap(":/icons/settings/general.svg") ; } virtual QPixmap iconPixmap() const { return QPixmap(":/icons/settings/general.svg") ; }
virtual QString pageName() const { return tr("General") ; } virtual QString pageName() const { return tr("General") ; }
virtual QString helpText() const { return ""; } 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: private:
/** Qt Designer generated object */ /** Qt Designer generated object */
Ui::GeneralPage ui; Ui::GeneralPage ui;
}; };
#endif #endif

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -76,8 +76,6 @@ public:
/** Default Destructor */ /** Default Destructor */
~NotifyPage(); ~NotifyPage();
/** Saves the changes on this page */
virtual bool save(QString &errmsg);
/** Loads the settings for this page */ /** Loads the settings for this page */
virtual void load(); virtual void load();
@ -90,6 +88,20 @@ private slots:
void testToaster(); void testToaster();
void testFeed(); 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: private:
uint getNewsFlags(); uint getNewsFlags();
uint getNotifyFlags(); uint getNotifyFlags();

View File

@ -29,28 +29,26 @@ PeoplePage::PeoplePage(QWidget * parent, Qt::WindowFlags flags)
{ {
ui.setupUi(this); ui.setupUi(this);
setAttribute(Qt::WA_QuitOnClose, false); 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() 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 */ /** Loads the settings for this page */
void PeoplePage::load() void PeoplePage::load()
{ {

View File

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

View File

@ -210,13 +210,6 @@ PluginsPage::~PluginsPage()
{ {
} }
/** Saves the changes on this page */
bool PluginsPage::save(QString &/*errmsg*/)
{
// nothing to save for now.
return true;
}
/** Loads the settings for this page */ /** Loads the settings for this page */
void PluginsPage::load() void PluginsPage::load()
{ {

View File

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

View File

@ -32,20 +32,13 @@ PostedPage::PostedPage(QWidget * parent, Qt::WindowFlags flags)
/* Initialize GroupFrameSettingsWidget */ /* Initialize GroupFrameSettingsWidget */
ui->groupFrameSettingsWidget->setOpenAllInNewTabText(tr("Open each topic in a new tab")); ui->groupFrameSettingsWidget->setOpenAllInNewTabText(tr("Open each topic in a new tab"));
ui->groupFrameSettingsWidget->setType(GroupFrameSettings::Posted);
} }
PostedPage::~PostedPage() PostedPage::~PostedPage()
{ {
} }
/** Saves the changes on this page */
bool PostedPage::save(QString &/*errmsg*/)
{
ui->groupFrameSettingsWidget->saveSettings(GroupFrameSettings::Posted);
return true;
}
/** Loads the settings for this page */ /** Loads the settings for this page */
void PostedPage::load() void PostedPage::load()
{ {

View File

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

View File

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

View File

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

View File

@ -58,11 +58,6 @@ ServerPage::ServerPage(QWidget * parent, Qt::WindowFlags flags)
/* Invoke the Qt Designer generated object setup routine */ /* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this); ui.setupUi(this);
connect( 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 ; manager = NULL ;
ui.filteredIpsTable->setHorizontalHeaderItem(COLUMN_RANGE,new QTableWidgetItem(tr("IP Range"))) ; 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); 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 #ifdef SERVER_DEBUG
std::cerr << "ServerPage::ServerPage() called"; std::cerr << "ServerPage::ServerPage() called";
std::cerr << std::endl; std::cerr << std::endl;
#endif #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) void ServerPage::checkIpRange(const QString& ipstr)
{ {
QColor color; QColor color;
@ -183,22 +199,7 @@ void ServerPage::toggleTunnelConnection(bool b)
//rsPeers->allowTunnelConnection(b) ; //rsPeers->allowTunnelConnection(b) ;
} }
/** Saves the changes on this page */ void ServerPage::updateShowDiscStatusBar() { Settings->setStatusBarFlag(STATUSBAR_DISC, ui.showDiscStatusBar->isChecked()); }
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;
}
/** Loads the settings for this page */ /** Loads the settings for this page */
void ServerPage::load() void ServerPage::load()
@ -815,7 +816,6 @@ void ServerPage::saveAddresses()
} }
rsPeers->setDynDNS(ownId, ui.dynDNS->text().toStdString()); rsPeers->setDynDNS(ownId, ui.dynDNS->text().toStdString());
rsConfig->SetMaxDataRates( ui.totalDownloadRate->value(), ui.totalUploadRate->value() );
// HANDLE PROXY SERVER. // HANDLE PROXY SERVER.
std::string orig_proxyaddr, new_proxyaddr; std::string orig_proxyaddr, new_proxyaddr;
@ -846,6 +846,10 @@ void ServerPage::saveAddresses()
load(); 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(QWidget * parent = 0, Qt::WindowFlags flags = 0);
~ServerPage() {} ~ServerPage() {}
/** Saves the changes on this page */
virtual bool save(QString &errmsg);
/** Loads the settings for this page */ /** Loads the settings for this page */
virtual void load(); virtual void load();
@ -81,6 +79,8 @@ private slots:
// server // server
void saveAddresses(); void saveAddresses();
void saveRates();
void updateShowDiscStatusBar() ;
void toggleUPnP(); void toggleUPnP();
void toggleIpDetermination(bool) ; void toggleIpDetermination(bool) ;
void toggleTunnelConnection(bool) ; void toggleTunnelConnection(bool) ;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -141,7 +141,7 @@ SettingsPage::initStackedWidget()
ui.stackedWidget->setCurrentIndex(-1); ui.stackedWidget->setCurrentIndex(-1);
ui.stackedWidget->removeWidget(ui.stackedWidget->widget(0)); ui.stackedWidget->removeWidget(ui.stackedWidget->widget(0));
addPage(new GeneralPage(0)); addPage(new GeneralPage());
addPage(new ServerPage()); addPage(new ServerPage());
addPage(new TransferPage()); addPage(new TransferPage());
addPage(new RelayPage() ); addPage(new RelayPage() );
@ -211,39 +211,11 @@ SettingsPage::setNewPage(int page)
} }
/** Saves changes made to settings. */ /** Saves changes made to settings. */
void void SettingsPage::notifySettingsChanged()
SettingsPage::saveChanges()
{ {
QString errmsg;
/* Call each config page's save() method to save its data */
int i, count = ui.stackedWidget->count();
for (i = 0; i < count; i++)
{
ConfigPage *page = dynamic_cast<ConfigPage *>(ui.stackedWidget->widget(i));
if (page && page->wasLoaded()) {
if (!page->save(errmsg))
{
/* Display the offending page */
ui.stackedWidget->setCurrentWidget(page);
/* Show the user what went wrong */
QMessageBox::warning(this,
tr("Error Saving Configuration on page")+" "+QString::number(i), errmsg,
QMessageBox::Ok, QMessageBox::NoButton);
/* Don't process the rest of the pages */
return;
}
}
}
/* call to RsIface save function.... */ /* call to RsIface save function.... */
//rsicontrol -> ConfigSave(); //rsicontrol -> ConfigSave();
if (NotifyQt::getInstance()) { if (NotifyQt::getInstance())
NotifyQt::getInstance()->notifySettingsChanged(); NotifyQt::getInstance()->notifySettingsChanged();
}
close();
} }

View File

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

View File

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