moved chat room part from notify page into preferences->chat

This commit is contained in:
csoler 2020-10-22 21:54:26 +02:00
parent bb5c758f87
commit 8b7341185d
6 changed files with 142 additions and 127 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,6 +225,13 @@ ChatPage::ChatPage(QWidget * parent, Qt::WindowFlags flags)
ui.minimumContrastLabel->hide();
ui.minimumContrast->hide();
#endif
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()));
@ -286,7 +294,37 @@ 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);
}
}
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 +461,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

View File

@ -14,7 +14,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>2</number>
<number>1</number>
</property>
<widget class="QWidget" name="general">
<attribute name="title">
@ -420,9 +420,19 @@
<attribute name="title">
<string>Chat rooms</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_5">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<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 search</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="defIDLabel">
<property name="text">
@ -435,6 +445,8 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_14">
<item>
<widget class="QCheckBox" name="DontSendTyping">
<property name="text">
@ -449,6 +461,36 @@
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_15">
<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>
</layout>
</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="Line" name="line">
<property name="orientation">
@ -561,6 +603,19 @@
</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>8</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">

View File

@ -44,7 +44,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();
@ -118,7 +117,6 @@ NotifyPage::NotifyPage(QWidget * parent, Qt::WindowFlags flags)
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;
@ -145,9 +143,6 @@ NotifyPage::NotifyPage(QWidget * parent, Qt::WindowFlags flags)
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())) ;
@ -177,12 +172,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()
@ -297,18 +286,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()
{
@ -397,14 +374,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/>