-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Complete rewrite of the tray icon implementation #6466
Open
Hartmnt
wants to merge
6
commits into
mumble-voip:master
Choose a base branch
from
Hartmnt:fix_tray
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5a63f67
REFAC(client): Replace 0 with nullptr in Global.cpp
Hartmnt 00f35bd
REFAC(client): Remove old tray icon code
Hartmnt 5ca2042
FEAT(client): Fully rewrite tray icon implementation
Hartmnt 583e2a2
FEAT(client): Implement tray icon highlighting
Hartmnt fa945ae
FEAT(client): Add --hidden cli option to start Mumble hidden in tray
Hartmnt 06a0a0a
TRANSLATION: Update translation files
Hartmnt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,8 @@ | |
#include "VolumeAdjustment.h" | ||
#include "Global.h" | ||
|
||
#include "widgets/TrayIcon.h" | ||
|
||
#include <QSignalBlocker> | ||
#include <QtCore/QMutexLocker> | ||
#include <QtGui/QImageWriter> | ||
|
@@ -812,13 +814,58 @@ void Log::log(MsgType mt, const QString &console, const QString &terse, bool own | |
if (!(Global::get().mw->isActiveWindow() && Global::get().mw->qdwLog->isVisible())) { | ||
// Message notification with window highlight | ||
if (flags & Settings::LogHighlight) { | ||
QApplication::alert(Global::get().mw); | ||
Global::get().mw->highlightWindow(); | ||
} | ||
|
||
// Message notification with balloon tooltips | ||
if (flags & Settings::LogBalloon) { | ||
// Replace any instances of a "Object Replacement Character" from QTextDocumentFragment::toPlainText | ||
postNotification(mt, plain.replace("\xEF\xBF\xBC", tr("[embedded content]"))); | ||
plain = plain.replace("\xEF\xBF\xBC", tr("[embedded content]")); | ||
|
||
QSystemTrayIcon::MessageIcon msgIcon; | ||
switch (mt) { | ||
case DebugInfo: | ||
case CriticalError: | ||
msgIcon = QSystemTrayIcon::Critical; | ||
break; | ||
case Warning: | ||
msgIcon = QSystemTrayIcon::Warning; | ||
break; | ||
case TextMessage: | ||
case PrivateTextMessage: | ||
msgIcon = QSystemTrayIcon::NoIcon; | ||
break; | ||
case Information: | ||
case ServerConnected: | ||
case ServerDisconnected: | ||
case UserJoin: | ||
case UserLeave: | ||
case Recording: | ||
case YouKicked: | ||
case UserKicked: | ||
case SelfMute: | ||
case OtherSelfMute: | ||
case YouMuted: | ||
case YouMutedOther: | ||
case OtherMutedOther: | ||
case ChannelJoin: | ||
case ChannelLeave: | ||
case PermissionDenied: | ||
case SelfUnmute: | ||
case SelfDeaf: | ||
case SelfUndeaf: | ||
case UserRenamed: | ||
case SelfChannelJoin: | ||
case SelfChannelJoinOther: | ||
case ChannelJoinConnect: | ||
case ChannelLeaveDisconnect: | ||
case ChannelListeningAdd: | ||
case ChannelListeningRemove: | ||
case PluginMessage: | ||
msgIcon = QSystemTrayIcon::Information; | ||
break; | ||
} | ||
Global::get().trayIcon->showMessage(msgName(mt), plain, msgIcon); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should probably be done via a signal |
||
} | ||
} | ||
|
||
|
@@ -910,26 +957,6 @@ void Log::processDeferredLogs() { | |
} | ||
} | ||
|
||
// Post a notification using the MainWindow's QSystemTrayIcon. | ||
void Log::postQtNotification(MsgType mt, const QString &plain) { | ||
if (Global::get().mw->qstiIcon->isSystemTrayAvailable() && Global::get().mw->qstiIcon->supportsMessages()) { | ||
QSystemTrayIcon::MessageIcon msgIcon; | ||
switch (mt) { | ||
case DebugInfo: | ||
case CriticalError: | ||
msgIcon = QSystemTrayIcon::Critical; | ||
break; | ||
case Warning: | ||
msgIcon = QSystemTrayIcon::Warning; | ||
break; | ||
default: | ||
msgIcon = QSystemTrayIcon::Information; | ||
break; | ||
} | ||
Global::get().mw->qstiIcon->showMessage(msgName(mt), plain, msgIcon); | ||
} | ||
} | ||
|
||
LogMessage::LogMessage(Log::MsgType mt, const QString &console, const QString &terse, bool ownMessage, | ||
const QString &overrideTTS, bool ignoreTTS) | ||
: mt(mt), console(console), terse(terse), ownMessage(ownMessage), overrideTTS(overrideTTS), ignoreTTS(ignoreTTS) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should probably be done via a signal