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
|
||||
}
|
||||
/*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()
|
||||
{
|
||||
|
@ -133,6 +133,7 @@ public:
|
||||
|
||||
static void installGroupChatNotifier();
|
||||
static void installNotifyIcons();
|
||||
static void displayLobbySystrayMsg(const QString&,const QString&);
|
||||
|
||||
/* initialize widget with status informations, status constant stored in data or in Qt::UserRole */
|
||||
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 (vpid == peerId) {
|
||||
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()) {
|
||||
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;
|
||||
|
||||
if (!isParticipantMuted(name)) {
|
||||
// ui.chatWidget->addChatMsg(true, name.append(" ").append(rsid), sendTime, recvTime, message, ChatWidget::TYPE_NORMAL);
|
||||
if(!isParticipantMuted(name))
|
||||
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.
|
||||
|
||||
|
@ -69,6 +69,7 @@ private:
|
||||
bool isNicknameInLobby(const QString &nickname);
|
||||
|
||||
ChatLobbyId lobbyId;
|
||||
QString _lobby_name ;
|
||||
time_t lastUpdateListTime;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
|
@ -134,6 +134,7 @@ NotifyPage::save(QString &/*errmsg*/)
|
||||
Settings->setChatFlags(chatflags);
|
||||
Settings->setMessageFlags(messageflags);
|
||||
|
||||
Settings->setDisplayTrayChatLobby(ui.systray_ChatLobby->isChecked());
|
||||
Settings->setDisplayTrayGroupChat(ui.systray_GroupChat->isChecked());
|
||||
MainWindow::installGroupChatNotifier();
|
||||
MainWindow::installNotifyIcons();
|
||||
@ -186,6 +187,7 @@ void NotifyPage::load()
|
||||
ui.message_ConnectAttempt->setChecked(messageflags & RS_MESSAGE_CONNECT_ATTEMPT);
|
||||
|
||||
ui.systray_GroupChat->setChecked(Settings->getDisplayTrayGroupChat());
|
||||
ui.systray_ChatLobby->setChecked(Settings->getDisplayTrayChatLobby());
|
||||
|
||||
ui.trayNotify_PrivateChat->setChecked(traynotifyflags & TRAYNOTIFY_PRIVATECHAT);
|
||||
ui.trayNotify_Messages->setChecked(traynotifyflags & TRAYNOTIFY_MESSAGES);
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>516</width>
|
||||
<height>474</height>
|
||||
<width>569</width>
|
||||
<height>512</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -499,11 +499,9 @@
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::NoContextMenu</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="notify_ForumNewMsg">
|
||||
<property name="title">
|
||||
@ -678,9 +676,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
@ -695,6 +690,9 @@
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
@ -841,6 +839,29 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</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>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
@ -871,38 +892,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</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>
|
||||
</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>
|
||||
</layout>
|
||||
</widget>
|
||||
|
@ -325,11 +325,21 @@ void RshareSettings::setMessageFlags(uint flags)
|
||||
setValue("MessageFlags", flags);
|
||||
}
|
||||
|
||||
bool RshareSettings::getDisplayTrayChatLobby()
|
||||
{
|
||||
return value("DisplayTrayChatLobby").toBool();
|
||||
}
|
||||
|
||||
bool RshareSettings::getDisplayTrayGroupChat()
|
||||
{
|
||||
return value("DisplayTrayGroupChat").toBool();
|
||||
}
|
||||
|
||||
void RshareSettings::setDisplayTrayChatLobby(bool bValue)
|
||||
{
|
||||
setValue("DisplayTrayChatLobby", bValue);
|
||||
}
|
||||
|
||||
void RshareSettings::setDisplayTrayGroupChat(bool bValue)
|
||||
{
|
||||
setValue("DisplayTrayGroupChat", bValue);
|
||||
|
@ -164,6 +164,8 @@ public:
|
||||
uint getMessageFlags();
|
||||
void setMessageFlags(uint flags);
|
||||
|
||||
bool getDisplayTrayChatLobby();
|
||||
void setDisplayTrayChatLobby(bool bValue);
|
||||
bool getDisplayTrayGroupChat();
|
||||
void setDisplayTrayGroupChat(bool bValue);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user