diff --git a/src/mumble/CMakeLists.txt b/src/mumble/CMakeLists.txt index 4cc9fa84d9..bd254b62ca 100644 --- a/src/mumble/CMakeLists.txt +++ b/src/mumble/CMakeLists.txt @@ -578,7 +578,6 @@ if(WIN32) target_sources(mumble_client_object_lib PRIVATE "GlobalShortcut_win.cpp" "GlobalShortcut_win.h" - "Log_win.cpp" "SharedMemory_win.cpp" "TaskList.cpp" "UserLockFile_win.cpp" @@ -663,7 +662,6 @@ else() PRIVATE "GlobalShortcut_unix.cpp" "GlobalShortcut_unix.h" - "Log_unix.cpp" "os_unix.cpp" ) @@ -687,7 +685,6 @@ else() "AppNap.mm" "GlobalShortcut_macx.h" "GlobalShortcut_macx.mm" - "Log_macx.mm" "os_macx.mm" ) @@ -1116,7 +1113,6 @@ if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16.0") set_source_files_properties( "AppNap.mm" "GlobalShortcut_macx.mm" - "Log_macx.mm" "os_macx.mm" "TextToSpeech_macx.mm" "Overlay_macx.mm" diff --git a/src/mumble/Log.cpp b/src/mumble/Log.cpp index eb01bddf26..291c1cdf93 100644 --- a/src/mumble/Log.cpp +++ b/src/mumble/Log.cpp @@ -818,7 +818,7 @@ void Log::log(MsgType mt, const QString &console, const QString &terse, bool own // 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]"))); + // FIXME } } @@ -913,26 +913,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) { diff --git a/src/mumble/Log.h b/src/mumble/Log.h index eee10bd7f7..7c7dda3f68 100644 --- a/src/mumble/Log.h +++ b/src/mumble/Log.h @@ -133,8 +133,6 @@ class Log : public QObject { unsigned int uiLastId; QDate qdDate; static const QStringList allowedSchemes(); - void postNotification(MsgType mt, const QString &plain); - void postQtNotification(MsgType mt, const QString &plain); public: Log(QObject *p = nullptr); diff --git a/src/mumble/LookConfig.cpp b/src/mumble/LookConfig.cpp index 67534d1ef8..2267718560 100644 --- a/src/mumble/LookConfig.cpp +++ b/src/mumble/LookConfig.cpp @@ -27,11 +27,6 @@ static ConfigRegistrar registrar(1100, LookConfigNew); LookConfig::LookConfig(Settings &st) : ConfigWidget(st) { setupUi(this); -#ifndef Q_OS_MAC - if (!QSystemTrayIcon::isSystemTrayAvailable()) -#endif - qgbTray->hide(); - qcbLanguage->addItem(tr("System default")); QDir d(QLatin1String(":"), QLatin1String("mumble_*.qm"), QDir::Name, QDir::Files); foreach (const QString &key, d.entryList()) { diff --git a/src/mumble/MainWindow.cpp b/src/mumble/MainWindow.cpp index dee417bd85..f7a6897252 100644 --- a/src/mumble/MainWindow.cpp +++ b/src/mumble/MainWindow.cpp @@ -171,10 +171,6 @@ MainWindow::MainWindow(QWidget *p) connect(qteChat, &ChatbarTextEdit::ctrlEnterPressed, [this](const QString &msg) { sendChatbarText(msg, true); }); connect(qteChat, SIGNAL(pastedImage(QString)), this, SLOT(sendChatbarMessage(QString))); - // Tray - connect(qstiIcon, SIGNAL(messageClicked()), this, SLOT(showRaiseWindow())); - connect(qaShow, SIGNAL(triggered()), this, SLOT(showRaiseWindow())); - QObject::connect(this, &MainWindow::transmissionModeChanged, this, &MainWindow::updateTransmitModeComboBox); // Explicitly add actions to mainwindow so their shortcuts are available @@ -271,10 +267,6 @@ void MainWindow::createActions() { new GlobalShortcut(this, GlobalShortcutType::VolumeDown, tr("Volume Down (-10%)", "Global Shortcut")); gsVolumeDown->setObjectName(QLatin1String("VolumeDown")); - qstiIcon = new QSystemTrayIcon(qiIcon, this); - qstiIcon->setToolTip(tr("Mumble -- %1").arg(Version::getRelease())); - qstiIcon->setObjectName(QLatin1String("Icon")); - gsWhisper = new GlobalShortcut(this, GlobalShortcutType::Whisper_Shout, tr("Whisper/Shout"), QVariant::fromValue(ShortcutTarget())); gsWhisper->setObjectName(QLatin1String("gsWhisper")); @@ -423,10 +415,6 @@ void MainWindow::createActions() { tr("Toggle positional audio", "Global Shortcut")); gsTogglePositionalAudio->setObjectName("gsTogglePositionalAudio"); gsTogglePositionalAudio->qsWhatsThis = tr("This will toggle positional audio on/off"); - -#ifndef Q_OS_MAC - qstiIcon->show(); -#endif } void MainWindow::setupGui() { @@ -555,13 +543,6 @@ void MainWindow::setupGui() { setupView(false); - qmTray = new QMenu(this); - connect(qmTray, SIGNAL(aboutToShow()), this, SLOT(trayAboutToShow())); - trayAboutToShow(); - qstiIcon->setContextMenu(qmTray); - - updateTrayIcon(); - #ifdef Q_OS_MAC setWindowOpacity(1.0f); #endif @@ -711,43 +692,16 @@ void MainWindow::hideEvent(QHideEvent *e) { e->ignore(); return; } -#endif -#ifndef Q_OS_MAC -# ifdef Q_OS_UNIX - if (!qApp->activeModalWidget() && !qApp->activePopupWidget()) -# endif - if (Global::get().s.bHideInTray && qstiIcon->isSystemTrayAvailable() && e->spontaneous()) - QMetaObject::invokeMethod(this, "hide", Qt::QueuedConnection); #endif QMainWindow::hideEvent(e); } void MainWindow::showEvent(QShowEvent *e) { -#ifndef Q_OS_MAC -# ifdef Q_OS_UNIX - if (!qApp->activeModalWidget() && !qApp->activePopupWidget()) -# endif - if (Global::get().s.bHideInTray && qstiIcon->isSystemTrayAvailable() && e->spontaneous()) - QMetaObject::invokeMethod(this, "show", Qt::QueuedConnection); -#endif QMainWindow::showEvent(e); } void MainWindow::changeEvent(QEvent *e) { QWidget::changeEvent(e); - -#ifdef Q_OS_MAC - // On modern macOS/Qt combinations, the code below causes Mumble's - // MainWindow to not be interactive after returning from being minimized. - // (See issue mumble-voip/mumble#2171) - // So, let's not do it on macOS. - -#else - if (isMinimized() && qstiIcon->isSystemTrayAvailable() && Global::get().s.bHideInTray) { - // Workaround https://forum.qt.io/topic/4327/minimizing-application-to-tray/24 - QTimer::singleShot(0, this, SLOT(hide())); - } -#endif } void MainWindow::keyPressEvent(QKeyEvent *e) { @@ -809,43 +763,6 @@ void MainWindow::updateAudioToolTips() { qaAudioDeaf->setToolTip(tr("Deafen yourself")); } -void MainWindow::updateTrayIcon() { - ClientUser *p = ClientUser::get(Global::get().uiSession); - - if (Global::get().s.bDeaf) { - qstiIcon->setIcon(qiIconDeafSelf); - } else if (p && p->bDeaf) { - qstiIcon->setIcon(qiIconDeafServer); - } else if (Global::get().s.bMute) { - qstiIcon->setIcon(qiIconMuteSelf); - } else if (p && p->bMute) { - qstiIcon->setIcon(qiIconMuteServer); - } else if (p && p->bSuppress) { - qstiIcon->setIcon(qiIconMuteSuppressed); - } else if (Global::get().s.bStateInTray && Global::get().bPushToMute) { - qstiIcon->setIcon(qiIconMutePushToMute); - } else if (p && Global::get().s.bStateInTray) { - switch (p->tsState) { - case Settings::Talking: - case Settings::MutedTalking: - qstiIcon->setIcon(qiTalkingOn); - break; - case Settings::Whispering: - qstiIcon->setIcon(qiTalkingWhisper); - break; - case Settings::Shouting: - qstiIcon->setIcon(qiTalkingShout); - break; - case Settings::Passive: - default: - qstiIcon->setIcon(qiTalkingOff); - break; - } - } else { - qstiIcon->setIcon(qiIcon); - } -} - void MainWindow::updateUserModel() { UserModel *um = static_cast< UserModel * >(qtvUsers->model()); um->forceVisualUpdate(); @@ -1610,13 +1527,6 @@ void MainWindow::on_qmServer_aboutToShow() { qmServer->addAction(qaServerUserList); qmServer->addAction(qaServerBanList); qmServer->addSeparator(); -#if !defined(Q_OS_MAC) - // Don't add qaHide on macOS. - // There is no way to bring the window back (no 'tray' for Mumble on macOS), - // and the system has built-in hide functionality via Cmd-H. - if (qstiIcon->isSystemTrayAvailable()) - qmServer->addAction(qaHide); -#endif qmServer->addAction(qaQuit); qaServerBanList->setEnabled(Global::get().pPermissions & (ChanACL::Ban | ChanACL::Write)); @@ -2129,10 +2039,6 @@ void MainWindow::on_qaUserInformation_triggered() { Global::get().sh->requestUserStats(p->uiSession, false); } -void MainWindow::on_qaHide_triggered() { - hide(); -} - void MainWindow::on_qaQuit_triggered() { forceQuit = true; this->close(); @@ -2623,10 +2529,6 @@ void MainWindow::updateMenuPermissions() { } void MainWindow::userStateChanged() { - if (Global::get().s.bStateInTray) { - updateTrayIcon(); - } - ClientUser *user = ClientUser::get(Global::get().uiSession); if (!user) { Global::get().bAttenuateOthers = false; @@ -2697,7 +2599,6 @@ void MainWindow::on_qaAudioMute_triggered() { } updateAudioToolTips(); - updateTrayIcon(); } void MainWindow::setAudioMute(bool mute) { @@ -2742,7 +2643,6 @@ void MainWindow::on_qaAudioDeaf_triggered() { } updateAudioToolTips(); - updateTrayIcon(); } void MainWindow::setAudioDeaf(bool deaf) { @@ -2854,7 +2754,6 @@ void MainWindow::pttReleased() { void MainWindow::on_PushToMute_triggered(bool down, QVariant) { Global::get().bPushToMute = down; - updateTrayIcon(); updateUserModel(); } @@ -3136,13 +3035,7 @@ void MainWindow::on_gsCycleTransmitMode_triggered(bool down, QVariant) { } void MainWindow::on_gsToggleMainWindowVisibility_triggered(bool down, QVariant) { - if (down) { - if (Global::get().mw->isVisible()) { - Global::get().mw->hide(); - } else { - Global::get().mw->show(); - } - } + // FIXME } void MainWindow::on_gsListenChannel_triggered(bool down, QVariant scdata) { @@ -3477,7 +3370,6 @@ void MainWindow::serverDisconnected(QAbstractSocket::SocketError err, QString re qaServerBanList->setEnabled(false); qtvUsers->setCurrentIndex(QModelIndex()); qteChat->setEnabled(false); - updateTrayIcon(); #ifdef Q_OS_MAC // Remove App Nap suppression now that we're disconnected. @@ -3686,7 +3578,6 @@ void MainWindow::serverDisconnected(QAbstractSocket::SocketError err, QString re } } } - qstiIcon->setToolTip(tr("Mumble -- %1").arg(Version::getRelease())); AudioInput::setMaxBandwidth(-1); if (Global::get().s.bMinimalView) { @@ -3709,38 +3600,6 @@ void MainWindow::resolverError(QAbstractSocket::SocketError, QString reason) { } } -void MainWindow::trayAboutToShow() { - bool top = false; - - QPoint p = qstiIcon->geometry().center(); - if (p.isNull()) { - p = QCursor::pos(); - } - - QScreen *screen = Mumble::Screen::screenAt(p); - if (screen) { - QRect qr = screen->geometry(); - - if (p.y() < (qr.height() / 2)) - top = true; - - qmTray->clear(); - if (top) { - qmTray->addAction(qaQuit); - qmTray->addAction(qaShow); - qmTray->addSeparator(); - qmTray->addAction(qaAudioDeaf); - qmTray->addAction(qaAudioMute); - } else { - qmTray->addAction(qaAudioMute); - qmTray->addAction(qaAudioDeaf); - qmTray->addSeparator(); - qmTray->addAction(qaShow); - qmTray->addAction(qaQuit); - } - } -} - void MainWindow::showRaiseWindow() { if (isMinimized()) { setWindowState((windowState() & ~Qt::WindowMinimized) | Qt::WindowActive); @@ -3751,21 +3610,6 @@ void MainWindow::showRaiseWindow() { activateWindow(); } -void MainWindow::on_Icon_activated(QSystemTrayIcon::ActivationReason reason) { - switch (reason) { - case QSystemTrayIcon::Trigger: - case QSystemTrayIcon::DoubleClick: - case QSystemTrayIcon::MiddleClick: - if (isMinimized()) { - showRaiseWindow(); - } else { - showMinimized(); - } - default: - break; - } -} - void MainWindow::on_qaTalkingUIToggle_triggered() { if (!Global::get().talkingUI) { qCritical("MainWindow: Attempting to show Talking UI before it has been created!"); @@ -4140,7 +3984,6 @@ void MainWindow::openConfigDialog() { if (dlg->exec() == QDialog::Accepted) { setupView(false); updateTransmitModeComboBox(Global::get().s.atTransmit); - updateTrayIcon(); updateUserModel(); if (Global::get().s.requireRestartToApply) { diff --git a/src/mumble/MainWindow.h b/src/mumble/MainWindow.h index 49df114721..bd436a9d97 100644 --- a/src/mumble/MainWindow.h +++ b/src/mumble/MainWindow.h @@ -10,7 +10,6 @@ #include #include #include -#include #include "CustomElements.h" #include "MUComboBox.h" @@ -74,12 +73,10 @@ class MainWindow : public QMainWindow, public Ui::MainWindow { Q_DISABLE_COPY(MainWindow) public: UserModel *pmModel; - QSystemTrayIcon *qstiIcon; QMenu *qmUser; QMenu *qmChannel; QMenu *qmListener; QMenu *qmDeveloper; - QMenu *qmTray; QIcon qiIcon, qiIconMutePushToMute, qiIconMuteSelf, qiIconMuteServer, qiIconDeafSelf, qiIconDeafServer, qiIconMuteSuppressed; QIcon qiTalkingOn, qiTalkingWhisper, qiTalkingShout, qiTalkingOff; @@ -141,7 +138,6 @@ class MainWindow : public QMainWindow, public Ui::MainWindow { void setOnTop(bool top); void setShowDockTitleBars(bool doShow); void updateAudioToolTips(); - void updateTrayIcon(); void updateUserModel(); void focusNextMainWidget(); QPair< QByteArray, QImage > openImageFile(); @@ -297,7 +293,6 @@ public slots: void on_qaHelpAboutQt_triggered(); void on_qaHelpVersionCheck_triggered(); void on_qaQuit_triggered(); - void on_qaHide_triggered(); void on_qteChat_tabPressed(); void on_qteChat_backtabPressed(); void on_qteChat_ctrlSpacePressed(); @@ -347,7 +342,6 @@ public slots: void on_gsTogglePositionalAudio_triggered(bool, QVariant); void on_Reconnect_timeout(); - void on_Icon_activated(QSystemTrayIcon::ActivationReason); void on_qaTalkingUIToggle_triggered(); void voiceRecorderDialog_finished(int); void qtvUserCurrentChanged(const QModelIndex &, const QModelIndex &); @@ -364,7 +358,6 @@ public slots: /// or priority speaker flag changes for the gui user void userStateChanged(); void destroyUserInformation(); - void trayAboutToShow(); void sendChatbarMessage(QString msg); void sendChatbarText(QString msg, bool plainText = false); void pttReleased(); diff --git a/src/mumble/MainWindow.ui b/src/mumble/MainWindow.ui index da03461539..acf48f829b 100644 --- a/src/mumble/MainWindow.ui +++ b/src/mumble/MainWindow.ui @@ -257,17 +257,6 @@ Ctrl+Q - - - &Hide Mumble - - - Hides the main Mumble window. - - - Hides the main Mumble window. Restore by clicking on the tray icon or starting Mumble again. - - @@ -996,14 +985,6 @@ the channel's context menu. true - - - Show - - - Shows the main Mumble window. - - true diff --git a/src/mumble/Messages.cpp b/src/mumble/Messages.cpp index b9b0e0c259..661ed43bf7 100644 --- a/src/mumble/Messages.cpp +++ b/src/mumble/Messages.cpp @@ -177,8 +177,6 @@ void MainWindow::msgServerSync(const MumbleProto::ServerSync &msg) { &AudioInput::onUserMuteDeafStateChanged); } - qstiIcon->setToolTip(tr("Mumble: %1").arg(Channel::get(Channel::ROOT_ID)->qsName.toHtmlEscaped())); - // Update QActions and menus on_qmServer_aboutToShow(); on_qmSelf_aboutToShow(); @@ -186,8 +184,6 @@ void MainWindow::msgServerSync(const MumbleProto::ServerSync &msg) { qmUser_aboutToShow(); on_qmConfig_aboutToShow(); - updateTrayIcon(); - Global::get().sh->setServerSynchronized(true); @@ -702,8 +698,6 @@ void MainWindow::msgUserState(const MumbleProto::UserState &msg) { tr("You were unsuppressed by %1.").arg(Log::formatClientUser(pSrc, Log::Source))); } } - - updateTrayIcon(); } else if (pSrc == pSelf) { if (msg.has_mute() && msg.has_deaf() && pDst->bMute && pDst->bDeaf) { Global::get().l->log(