mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-26 01:31:30 -05:00
added systray notifications for chat lobbies.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5357 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
bbae97b88d
commit
a2b6b97ef9
@ -588,6 +588,15 @@ void MainWindow::createNotifyIcons()
|
|||||||
|
|
||||||
#undef DELETE_OBJECT
|
#undef DELETE_OBJECT
|
||||||
}
|
}
|
||||||
|
/*static*/ void MainWindow::displayLobbySystrayMsg(const QString& title,const QString& msg)
|
||||||
|
{
|
||||||
|
if (_instance == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(Settings->getDisplayTrayChatLobby())
|
||||||
|
_instance->displaySystrayMsg(title,msg) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*static*/ void MainWindow::installGroupChatNotifier()
|
/*static*/ void MainWindow::installGroupChatNotifier()
|
||||||
{
|
{
|
||||||
|
@ -133,6 +133,7 @@ public:
|
|||||||
|
|
||||||
static void installGroupChatNotifier();
|
static void installGroupChatNotifier();
|
||||||
static void installNotifyIcons();
|
static void installNotifyIcons();
|
||||||
|
static void displayLobbySystrayMsg(const QString&,const QString&);
|
||||||
|
|
||||||
/* initialize widget with status informations, status constant stored in data or in Qt::UserRole */
|
/* initialize widget with status informations, status constant stored in data or in Qt::UserRole */
|
||||||
void initializeStatusObject(QObject *pObject, bool bConnect);
|
void initializeStatusObject(QObject *pObject, bool bConnect);
|
||||||
|
@ -61,6 +61,7 @@ void ChatLobbyDialog::init(const std::string &peerId, const QString &title)
|
|||||||
if (rsMsgs->getVirtualPeerId(lobbyIt->lobby_id, vpid)) {
|
if (rsMsgs->getVirtualPeerId(lobbyIt->lobby_id, vpid)) {
|
||||||
if (vpid == peerId) {
|
if (vpid == peerId) {
|
||||||
QString msg = tr("Welcome to lobby %1").arg(QString::fromUtf8(lobbyIt->lobby_name.c_str()));
|
QString msg = tr("Welcome to lobby %1").arg(QString::fromUtf8(lobbyIt->lobby_name.c_str()));
|
||||||
|
_lobby_name = QString(lobbyIt->lobby_name.c_str()) ;
|
||||||
if (!lobbyIt->lobby_topic.empty()) {
|
if (!lobbyIt->lobby_topic.empty()) {
|
||||||
msg += "\n" + tr("Topic: %1").arg(QString::fromUtf8(lobbyIt->lobby_topic.c_str()));
|
msg += "\n" + tr("Topic: %1").arg(QString::fromUtf8(lobbyIt->lobby_topic.c_str()));
|
||||||
}
|
}
|
||||||
@ -179,12 +180,18 @@ void ChatLobbyDialog::addIncomingChatMsg(const ChatInfo& info)
|
|||||||
|
|
||||||
std::cerr << "message from rsid " << info.rsid.c_str() << std::endl;
|
std::cerr << "message from rsid " << info.rsid.c_str() << std::endl;
|
||||||
|
|
||||||
if (!isParticipantMuted(name)) {
|
if(!isParticipantMuted(name))
|
||||||
// ui.chatWidget->addChatMsg(true, name.append(" ").append(rsid), sendTime, recvTime, message, ChatWidget::TYPE_NORMAL);
|
|
||||||
ui.chatWidget->addChatMsg(true, name, sendTime, recvTime, message, ChatWidget::TYPE_NORMAL);
|
ui.chatWidget->addChatMsg(true, name, sendTime, recvTime, message, ChatWidget::TYPE_NORMAL);
|
||||||
} else {
|
|
||||||
// ui.chatWidget->addChatMsg(true, name, sendTime, recvTime, message.append(" (BLOCKED)"), ChatWidget::TYPE_NORMAL);
|
// This is a trick to translate HTML into text.
|
||||||
}
|
QTextEdit editor;
|
||||||
|
editor.setHtml(message);
|
||||||
|
QString notifyMsg = name + ": " + editor.toPlainText();
|
||||||
|
|
||||||
|
if(notifyMsg.length() > 30)
|
||||||
|
MainWindow::displayLobbySystrayMsg(tr("Lobby chat") + ": " + _lobby_name, notifyMsg.left(30) + QString("..."));
|
||||||
|
else
|
||||||
|
MainWindow::displayLobbySystrayMsg(tr("Lobby chat") + ": " + _lobby_name, notifyMsg);
|
||||||
|
|
||||||
// also update peer list.
|
// also update peer list.
|
||||||
|
|
||||||
|
@ -69,6 +69,7 @@ private:
|
|||||||
bool isNicknameInLobby(const QString &nickname);
|
bool isNicknameInLobby(const QString &nickname);
|
||||||
|
|
||||||
ChatLobbyId lobbyId;
|
ChatLobbyId lobbyId;
|
||||||
|
QString _lobby_name ;
|
||||||
time_t lastUpdateListTime;
|
time_t lastUpdateListTime;
|
||||||
|
|
||||||
/** Qt Designer generated object */
|
/** Qt Designer generated object */
|
||||||
|
@ -134,6 +134,7 @@ NotifyPage::save(QString &/*errmsg*/)
|
|||||||
Settings->setChatFlags(chatflags);
|
Settings->setChatFlags(chatflags);
|
||||||
Settings->setMessageFlags(messageflags);
|
Settings->setMessageFlags(messageflags);
|
||||||
|
|
||||||
|
Settings->setDisplayTrayChatLobby(ui.systray_ChatLobby->isChecked());
|
||||||
Settings->setDisplayTrayGroupChat(ui.systray_GroupChat->isChecked());
|
Settings->setDisplayTrayGroupChat(ui.systray_GroupChat->isChecked());
|
||||||
MainWindow::installGroupChatNotifier();
|
MainWindow::installGroupChatNotifier();
|
||||||
MainWindow::installNotifyIcons();
|
MainWindow::installNotifyIcons();
|
||||||
@ -186,6 +187,7 @@ void NotifyPage::load()
|
|||||||
ui.message_ConnectAttempt->setChecked(messageflags & RS_MESSAGE_CONNECT_ATTEMPT);
|
ui.message_ConnectAttempt->setChecked(messageflags & RS_MESSAGE_CONNECT_ATTEMPT);
|
||||||
|
|
||||||
ui.systray_GroupChat->setChecked(Settings->getDisplayTrayGroupChat());
|
ui.systray_GroupChat->setChecked(Settings->getDisplayTrayGroupChat());
|
||||||
|
ui.systray_ChatLobby->setChecked(Settings->getDisplayTrayChatLobby());
|
||||||
|
|
||||||
ui.trayNotify_PrivateChat->setChecked(traynotifyflags & TRAYNOTIFY_PRIVATECHAT);
|
ui.trayNotify_PrivateChat->setChecked(traynotifyflags & TRAYNOTIFY_PRIVATECHAT);
|
||||||
ui.trayNotify_Messages->setChecked(traynotifyflags & TRAYNOTIFY_MESSAGES);
|
ui.trayNotify_Messages->setChecked(traynotifyflags & TRAYNOTIFY_MESSAGES);
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>516</width>
|
<width>569</width>
|
||||||
<height>474</height>
|
<height>512</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -499,11 +499,9 @@
|
|||||||
<property name="contextMenuPolicy">
|
<property name="contextMenuPolicy">
|
||||||
<enum>Qt::NoContextMenu</enum>
|
<enum>Qt::NoContextMenu</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="notify_ForumNewMsg">
|
<widget class="QGroupBox" name="notify_ForumNewMsg">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
@ -678,9 +676,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
@ -695,6 +690,9 @@
|
|||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
@ -841,6 +839,29 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_3">
|
||||||
|
<property name="title">
|
||||||
|
<string>Systray message</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="systray_GroupChat">
|
||||||
|
<property name="text">
|
||||||
|
<string>Group chat</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="systray_ChatLobby">
|
||||||
|
<property name="text">
|
||||||
|
<string>Chat lobbies</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox_2">
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
@ -871,38 +892,7 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="groupBox_3">
|
|
||||||
<property name="title">
|
|
||||||
<string>Group chat</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="systray_GroupChat">
|
|
||||||
<property name="text">
|
|
||||||
<string>Display systray message</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer_2">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>130</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -325,11 +325,21 @@ void RshareSettings::setMessageFlags(uint flags)
|
|||||||
setValue("MessageFlags", flags);
|
setValue("MessageFlags", flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RshareSettings::getDisplayTrayChatLobby()
|
||||||
|
{
|
||||||
|
return value("DisplayTrayChatLobby").toBool();
|
||||||
|
}
|
||||||
|
|
||||||
bool RshareSettings::getDisplayTrayGroupChat()
|
bool RshareSettings::getDisplayTrayGroupChat()
|
||||||
{
|
{
|
||||||
return value("DisplayTrayGroupChat").toBool();
|
return value("DisplayTrayGroupChat").toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RshareSettings::setDisplayTrayChatLobby(bool bValue)
|
||||||
|
{
|
||||||
|
setValue("DisplayTrayChatLobby", bValue);
|
||||||
|
}
|
||||||
|
|
||||||
void RshareSettings::setDisplayTrayGroupChat(bool bValue)
|
void RshareSettings::setDisplayTrayGroupChat(bool bValue)
|
||||||
{
|
{
|
||||||
setValue("DisplayTrayGroupChat", bValue);
|
setValue("DisplayTrayGroupChat", bValue);
|
||||||
|
@ -164,6 +164,8 @@ public:
|
|||||||
uint getMessageFlags();
|
uint getMessageFlags();
|
||||||
void setMessageFlags(uint flags);
|
void setMessageFlags(uint flags);
|
||||||
|
|
||||||
|
bool getDisplayTrayChatLobby();
|
||||||
|
void setDisplayTrayChatLobby(bool bValue);
|
||||||
bool getDisplayTrayGroupChat();
|
bool getDisplayTrayGroupChat();
|
||||||
void setDisplayTrayGroupChat(bool bValue);
|
void setDisplayTrayGroupChat(bool bValue);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user