Merge pull request #2084 from csoler/v0.6-BugFixing_3

Clean up the mess in chat settings
This commit is contained in:
csoler 2020-11-15 15:41:23 +01:00 committed by GitHub
commit 587ee69fe5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 1005 additions and 1007 deletions

View File

@ -27,6 +27,7 @@
#include <retroshare/rsmsgs.h>
#include <retroshare/rspeers.h>
#include "ChatPage.h"
#include "gui/MainWindow.h"
#include <gui/RetroShareLink.h>
#include "gui/chat/ChatDialog.h"
#include "gui/notifyqt.h"
@ -224,7 +225,14 @@ ChatPage::ChatPage(QWidget * parent, Qt::WindowFlags flags)
ui.minimumContrastLabel->hide();
ui.minimumContrast->hide();
#endif
connect(ui.distantChatComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(distantChatComboBoxChanged(int)));
connect(ui.chatLobbies_CountFollowingText, SIGNAL(toggled(bool)),ui.chatLobbies_TextToNotify,SLOT(setEnabled(bool)));
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())) ;
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()));
@ -286,7 +294,40 @@ ChatPage::ChatPage(QWidget * parent, Qt::WindowFlags flags)
connect(ui.publicStyle, SIGNAL(currentIndexChanged(int)), this,SLOT(on_publicList_currentRowChanged(int)));
connect(ui.privateStyle, SIGNAL(currentIndexChanged(int)), this,SLOT(on_privateList_currentRowChanged(int)));
connect(ui.historyStyle, SIGNAL(currentIndexChanged(int)), this,SLOT(on_historyList_currentRowChanged(int)));
/* Add user notify */
const QList<UserNotify*> &userNotifyList = MainWindow::getInstance()->getUserNotifyList() ;
QList<UserNotify*>::const_iterator it;
mChatLobbyUserNotify = nullptr;
for (it = userNotifyList.begin(); it != userNotifyList.end(); ++it)
{
UserNotify *userNotify = *it;
//To get ChatLobbyUserNotify Settings
if(!mChatLobbyUserNotify)
mChatLobbyUserNotify = dynamic_cast<ChatLobbyUserNotify*>(*it);
}
// hide the broadcast page: it only shows "show/hide emoticons, which is really not much for an entire page
ui.tabWidget->removeTab(3);
}
void ChatPage::updateChatLobbyUserNotify()
{
if(!mChatLobbyUserNotify)
return ;
mChatLobbyUserNotify->setCountUnRead(ui.chatLobbies_CountUnRead->isChecked()) ;
mChatLobbyUserNotify->setCheckForNickName(ui.chatLobbies_CheckNickName->isChecked()) ;
mChatLobbyUserNotify->setCountSpecificText(ui.chatLobbies_CountFollowingText->isChecked()) ;
mChatLobbyUserNotify->setTextToNotify(ui.chatLobbies_TextToNotify->document()->toPlainText());
mChatLobbyUserNotify->setTextCaseSensitive(ui.chatLobbies_TextCaseSensitive->isChecked());
}
void ChatPage::updateChatFlags()
{
uint chatflags = 0;
@ -423,6 +464,15 @@ ChatPage::load()
ui._collected_contacts_LW->insertItem(0,item) ;
}
#endif
if (mChatLobbyUserNotify){
whileBlocking(ui.chatLobbies_CountUnRead)->setChecked(mChatLobbyUserNotify->isCountUnRead());
whileBlocking(ui.chatLobbies_CheckNickName)->setChecked(mChatLobbyUserNotify->isCheckForNickName());
whileBlocking(ui.chatLobbies_CountFollowingText)->setChecked(mChatLobbyUserNotify->isCountSpecificText()) ;
whileBlocking(ui.chatLobbies_TextToNotify)->setEnabled(mChatLobbyUserNotify->isCountSpecificText()) ;
whileBlocking(ui.chatLobbies_TextToNotify)->setPlainText(mChatLobbyUserNotify->textToNotify());
whileBlocking(ui.chatLobbies_TextCaseSensitive)->setChecked(mChatLobbyUserNotify->isTextCaseSensitive());
}
}
void ChatPage::on_pushButtonChangeChatFont_clicked()

View File

@ -23,6 +23,7 @@
#include "retroshare-gui/configpage.h"
#include "gui/chat/ChatStyle.h"
#include "gui/chat/ChatLobbyUserNotify.h"
#include "ui_ChatPage.h"
#include "gui/common/FilesDefs.h"
@ -44,6 +45,7 @@ class ChatPage : public ConfigPage
virtual QString helpText() const { return ""; }
private slots:
void updateChatLobbyUserNotify();
void on_historyComboBoxVariant_currentIndexChanged(int index);
void on_privateComboBoxVariant_currentIndexChanged(int index);
void on_publicComboBoxVariant_currentIndexChanged(int index);
@ -87,6 +89,8 @@ class ChatPage : public ConfigPage
/** Qt Designer generated object */
Ui::ChatPage ui;
ChatLobbyUserNotify* mChatLobbyUserNotify;
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -46,7 +46,6 @@ NotifyPage::NotifyPage(QWidget * parent, Qt::WindowFlags flags)
connect(ui.testToasterButton, SIGNAL(clicked()), this, SLOT(testToaster()));
connect(ui.pushButtonDisableAll,SIGNAL(toggled(bool)), NotifyQt::getInstance(), SLOT(SetDisableAll(bool)));
connect(NotifyQt::getInstance(),SIGNAL(disableAllChanged(bool)), ui.pushButtonDisableAll, SLOT(setChecked(bool)));
connect(ui.chatLobbies_CountFollowingText,SIGNAL(toggled(bool)),ui.chatLobbies_TextToNotify,SLOT(setEnabled(bool)));
ui.notify_Blogs->hide();
@ -116,41 +115,37 @@ NotifyPage::NotifyPage(QWidget * parent, Qt::WindowFlags flags)
}
/* Add user notify */
const QList<UserNotify*> &userNotifyList = MainWindow::getInstance()->getUserNotifyList() ;
QList<UserNotify*>::const_iterator it;
rowFeed = 0;
mChatLobbyUserNotify = 0;
for (it = userNotifyList.begin(); it != userNotifyList.end(); ++it) {
UserNotify *userNotify = *it;
/* Add user notify */
const QList<UserNotify*> &userNotifyList = MainWindow::getInstance()->getUserNotifyList() ;
QList<UserNotify*>::const_iterator it;
rowFeed = 0;
for (it = userNotifyList.begin(); it != userNotifyList.end(); ++it) {
UserNotify *userNotify = *it;
QString name;
if (!userNotify->hasSetting(&name, NULL)) {
continue;
}
QString name;
if (!userNotify->hasSetting(&name, NULL)) {
continue;
}
QCheckBox *enabledCheckBox = new QCheckBox(name, this);
enabledCheckBox->setFont(font);
ui.notifyLayout->addWidget(enabledCheckBox, rowFeed, 0, 0);
connect(enabledCheckBox, SIGNAL(toggled(bool)), this, SLOT(notifyToggled()));
QCheckBox *enabledCheckBox = new QCheckBox(name, this);
enabledCheckBox->setFont(font);
ui.notifyLayout->addWidget(enabledCheckBox, rowFeed, 0, 0);
connect(enabledCheckBox, SIGNAL(toggled(bool)), this, SLOT(notifyToggled()));
QCheckBox *combinedCheckBox = new QCheckBox(tr("Combined"), this);
combinedCheckBox->setFont(font);
ui.notifyLayout->addWidget(combinedCheckBox, rowFeed, 1);
QCheckBox *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);
QCheckBox *blinkCheckBox = new QCheckBox(tr("Blink"), this);
blinkCheckBox->setFont(font);
ui.notifyLayout->addWidget(blinkCheckBox, rowFeed++, 2);
mUserNotifySettingList.push_back(UserNotifySetting(userNotify, enabledCheckBox, combinedCheckBox, blinkCheckBox));
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(enabledCheckBox,SIGNAL(toggled(bool)),this,SLOT(updateUserNotifySettings())) ;
connect(blinkCheckBox,SIGNAL(toggled(bool)),this,SLOT(updateUserNotifySettings())) ;
connect(combinedCheckBox,SIGNAL(toggled(bool)),this,SLOT(updateUserNotifySettings())) ;
}
connect(ui.popup_Connect, SIGNAL(toggled(bool)), this, SLOT(updateNotifyFlags())) ;
connect(ui.popup_NewMsg, SIGNAL(toggled(bool)), this, SLOT(updateNotifyFlags())) ;
@ -179,12 +174,6 @@ NotifyPage::NotifyPage(QWidget * parent, Qt::WindowFlags flags)
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()
@ -299,18 +288,6 @@ void NotifyPage::updateToasterPosition()
Settings->setToasterPosition((RshareSettings::enumToasterPosition) ui.comboBoxToasterPosition->itemData(index).toInt());
}
void NotifyPage::updateChatLobbyUserNotify()
{
if(!mChatLobbyUserNotify)
return ;
mChatLobbyUserNotify->setCountUnRead(ui.chatLobbies_CountUnRead->isChecked()) ;
mChatLobbyUserNotify->setCheckForNickName(ui.chatLobbies_CheckNickName->isChecked()) ;
mChatLobbyUserNotify->setCountSpecificText(ui.chatLobbies_CountFollowingText->isChecked()) ;
mChatLobbyUserNotify->setTextToNotify(ui.chatLobbies_TextToNotify->document()->toPlainText());
mChatLobbyUserNotify->setTextCaseSensitive(ui.chatLobbies_TextCaseSensitive->isChecked());
}
/** Loads the settings for this page */
void NotifyPage::load()
{
@ -399,14 +376,6 @@ void NotifyPage::load()
notifyToggled() ;
if (mChatLobbyUserNotify){
whileBlocking(ui.chatLobbies_CountUnRead)->setChecked(mChatLobbyUserNotify->isCountUnRead());
whileBlocking(ui.chatLobbies_CheckNickName)->setChecked(mChatLobbyUserNotify->isCheckForNickName());
whileBlocking(ui.chatLobbies_CountFollowingText)->setChecked(mChatLobbyUserNotify->isCountSpecificText()) ;
whileBlocking(ui.chatLobbies_TextToNotify)->setEnabled(mChatLobbyUserNotify->isCountSpecificText()) ;
whileBlocking(ui.chatLobbies_TextToNotify)->setPlainText(mChatLobbyUserNotify->textToNotify());
whileBlocking(ui.chatLobbies_TextCaseSensitive)->setChecked(mChatLobbyUserNotify->isTextCaseSensitive());
}
}
void NotifyPage::notifyToggled()

View File

@ -100,12 +100,10 @@ private slots:
void updateToasterMargin();
void updateToasterPosition();
void updateChatLobbyUserNotify();
private:
uint getNewsFlags();
uint getNotifyFlags();
ChatLobbyUserNotify* mChatLobbyUserNotify;
QList<FeedNotifySetting> mFeedNotifySettingList;
QList<ToasterNotifySetting> mToasterNotifySettingList;

View File

@ -14,7 +14,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
<number>2</number>
</property>
<widget class="QWidget" name="tabFeed">
<attribute name="title">
@ -443,60 +443,6 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tabChatLobbies">
<attribute name="title">
<string>Chat Rooms</string>
</attribute>
<layout class="QVBoxLayout" name="tabChatLobbiesVLayout">
<item>
<widget class="QCheckBox" name="chatLobbies_CountUnRead">
<property name="text">
<string>Count all unread messages</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chatLobbies_CheckNickName">
<property name="text">
<string>Count occurrences of my current identity</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chatLobbies_CountFollowingText">
<property name="text">
<string>Count occurrences of any of the following texts (separate by newlines):</string>
</property>
</widget>
</item>
<item>
<widget class="QPlainTextEdit" name="chatLobbies_TextToNotify"/>
</item>
<item>
<widget class="QCheckBox" name="chatLobbies_TextCaseSensitive">
<property name="toolTip">
<string>Checked, if the identity and the text above occurrences must be in the same case to trigger count.</string>
</property>
<property name="text">
<string>Case sensitive</string>
</property>
</widget>
</item>
<item>
<spacer name="tabChatLobbiesVSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
@ -527,10 +473,6 @@
<tabstop>spinBoxToasterYMargin</tabstop>
<tabstop>systray_GroupChat</tabstop>
<tabstop>systray_ChatLobby</tabstop>
<tabstop>chatLobbies_CountUnRead</tabstop>
<tabstop>chatLobbies_CheckNickName</tabstop>
<tabstop>chatLobbies_CountFollowingText</tabstop>
<tabstop>chatLobbies_TextToNotify</tabstop>
<tabstop>pushButtonDisableAll</tabstop>
</tabstops>
<resources/>