Skip to content

Commit

Permalink
Merge PR #3604: Add tray menu action to show the main window
Browse files Browse the repository at this point in the history
  • Loading branch information
davidebeatrici committed Feb 22, 2019
2 parents ba08786 + 896d51a commit 755c290
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 17 deletions.
16 changes: 10 additions & 6 deletions src/mumble/MainWindow.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ MainWindow::MainWindow(QWidget *p) : QMainWindow(p) {
connect(qmChannel, SIGNAL(aboutToShow()), this, SLOT(qmChannel_aboutToShow())); connect(qmChannel, SIGNAL(aboutToShow()), this, SLOT(qmChannel_aboutToShow()));
connect(qteChat, SIGNAL(entered(QString)), this, SLOT(sendChatbarMessage(QString))); connect(qteChat, SIGNAL(entered(QString)), this, SLOT(sendChatbarMessage(QString)));


// Tray
connect(qstiIcon, SIGNAL(messageClicked()), this, SLOT(showRaiseWindow()));
connect(qaShow, SIGNAL(triggered()), this, SLOT(showRaiseWindow()));


// Explicitely add actions to mainwindow so their shortcuts are available // Explicitely add actions to mainwindow so their shortcuts are available
// if only the main window is visible (e.g. minimal mode) // if only the main window is visible (e.g. minimal mode)
Expand Down Expand Up @@ -3041,20 +3044,24 @@ void MainWindow::trayAboutToShow() {
qmTray->clear(); qmTray->clear();
if (top) { if (top) {
qmTray->addAction(qaQuit); qmTray->addAction(qaQuit);
qmTray->addAction(qaShow);
qmTray->addSeparator(); qmTray->addSeparator();
qmTray->addAction(qaAudioDeaf); qmTray->addAction(qaAudioDeaf);
qmTray->addAction(qaAudioMute); qmTray->addAction(qaAudioMute);
} else { } else {
qmTray->addAction(qaAudioMute); qmTray->addAction(qaAudioMute);
qmTray->addAction(qaAudioDeaf); qmTray->addAction(qaAudioDeaf);
qmTray->addSeparator(); qmTray->addSeparator();
qmTray->addAction(qaShow);
qmTray->addAction(qaQuit); qmTray->addAction(qaQuit);
} }
} }


void MainWindow::on_Icon_messageClicked() { void MainWindow::showRaiseWindow() {
if (isMinimized()) if (isMinimized()) {
setWindowState((windowState() & ~Qt::WindowMinimized) | Qt::WindowActive); setWindowState((windowState() & ~Qt::WindowMinimized) | Qt::WindowActive);
}

show(); show();
raise(); raise();
activateWindow(); activateWindow();
Expand All @@ -3065,10 +3072,7 @@ void MainWindow::on_Icon_activated(QSystemTrayIcon::ActivationReason reason) {
case QSystemTrayIcon::Trigger: case QSystemTrayIcon::Trigger:
case QSystemTrayIcon::DoubleClick: case QSystemTrayIcon::DoubleClick:
case QSystemTrayIcon::MiddleClick: case QSystemTrayIcon::MiddleClick:
setWindowState((windowState() & ~Qt::WindowMinimized) | Qt::WindowActive); showRaiseWindow();
show();
raise();
activateWindow();
default: break; default: break;
} }
} }
Expand Down
2 changes: 1 addition & 1 deletion src/mumble/MainWindow.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ class MainWindow : public QMainWindow, public MessageHandler, public Ui::MainWin
void on_gsSendTextMessage_triggered(bool, QVariant); void on_gsSendTextMessage_triggered(bool, QVariant);
void on_gsSendClipboardTextMessage_triggered(bool, QVariant); void on_gsSendClipboardTextMessage_triggered(bool, QVariant);
void on_Reconnect_timeout(); void on_Reconnect_timeout();
void on_Icon_messageClicked();
void on_Icon_activated(QSystemTrayIcon::ActivationReason); void on_Icon_activated(QSystemTrayIcon::ActivationReason);
void voiceRecorderDialog_finished(int); void voiceRecorderDialog_finished(int);
void qtvUserCurrentChanged(const QModelIndex &, const QModelIndex &); void qtvUserCurrentChanged(const QModelIndex &, const QModelIndex &);
Expand All @@ -283,6 +282,7 @@ class MainWindow : public QMainWindow, public MessageHandler, public Ui::MainWin
void pttReleased(); void pttReleased();
void whisperReleased(QVariant scdata); void whisperReleased(QVariant scdata);
void onResetAudio(); void onResetAudio();
void showRaiseWindow();
void on_qaFilterToggle_triggered(); void on_qaFilterToggle_triggered();
/// Opens a save dialog for the image referenced by qtcSaveImageCursor. /// Opens a save dialog for the image referenced by qtcSaveImageCursor.
void saveImageAs(); void saveImageAs();
Expand Down
10 changes: 9 additions & 1 deletion src/mumble/MainWindow.ui
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>671</width> <width>671</width>
<height>21</height> <height>22</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="qmConfig"> <widget class="QMenu" name="qmConfig">
Expand Down Expand Up @@ -909,6 +909,14 @@ the channel's context menu.</string>
<bool>false</bool> <bool>false</bool>
</property> </property>
</action> </action>
<action name="qaShow">
<property name="text">
<string>Show</string>
</property>
<property name="toolTip">
<string>Shows the main Mumble window.</string>
</property>
</action>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>
Expand Down
28 changes: 19 additions & 9 deletions src/mumble/mumble_en.ts
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -4680,7 +4680,7 @@ This field describes the size of an LCD device. The size is given either in pixe
<name>MainWindow</name> <name>MainWindow</name>
<message> <message>
<location filename="MainWindow.cpp" line="+107"/> <location filename="MainWindow.cpp" line="+107"/>
<location line="+2702"/> <location line="+2705"/>
<source>Root</source> <source>Root</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
Expand Down Expand Up @@ -4838,13 +4838,13 @@ This field describes the size of an LCD device. The size is given either in pixe
</message> </message>
<message> <message>
<location line="+79"/> <location line="+79"/>
<location line="+2798"/> <location line="+2799"/>
<source>&lt;center&gt;Not connected&lt;/center&gt;</source> <source>&lt;center&gt;Not connected&lt;/center&gt;</source>
<oldsource>Not connected</oldsource> <oldsource>Not connected</oldsource>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="-2350"/> <location line="-2351"/>
<source>Clear</source> <source>Clear</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
Expand Down Expand Up @@ -5035,7 +5035,7 @@ This field describes the size of an LCD device. The size is given either in pixe
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+80"/> <location line="+81"/>
<source>&lt;center&gt;Type message to channel &apos;%1&apos; here&lt;/center&gt;</source> <source>&lt;center&gt;Type message to channel &apos;%1&apos; here&lt;/center&gt;</source>
<oldsource>Type message to channel &apos;%1&apos; here</oldsource> <oldsource>Type message to channel &apos;%1&apos; here</oldsource>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
Expand Down Expand Up @@ -5070,7 +5070,7 @@ This field describes the size of an LCD device. The size is given either in pixe
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="-3104"/> <location line="-3108"/>
<source>&amp;User</source> <source>&amp;User</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
Expand All @@ -5080,7 +5080,7 @@ This field describes the size of an LCD device. The size is given either in pixe
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+62"/> <location line="+65"/>
<location line="+26"/> <location line="+26"/>
<source>Use in conjunction with Whisper to.</source> <source>Use in conjunction with Whisper to.</source>
<comment>Global Shortcut</comment> <comment>Global Shortcut</comment>
Expand Down Expand Up @@ -5416,7 +5416,7 @@ Otherwise abort and check your certificate and username.</source>
</message> </message>
<message> <message>
<location line="-2239"/> <location line="-2239"/>
<location line="+2451"/> <location line="+2452"/>
<source>Images (*.png *.jpg *.jpeg)</source> <source>Images (*.png *.jpg *.jpeg)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
Expand Down Expand Up @@ -6637,7 +6637,7 @@ the channel&apos;s context menu.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="MainWindow.cpp" line="-3068"/> <location filename="MainWindow.cpp" line="-3072"/>
<source>&amp;Developer</source> <source>&amp;Developer</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
Expand Down Expand Up @@ -6801,6 +6801,16 @@ the channel&apos;s context menu.</source>
<source>R&amp;egister...</source> <source>R&amp;egister...</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<location/>
<source>Show</source>
<translation type="unfinished"></translation>
</message>
<message>
<location/>
<source>Shows the main Mumble window.</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>Manual</name> <name>Manual</name>
Expand Down Expand Up @@ -8816,7 +8826,7 @@ An access token is a text string, which can be used as a password for very simpl
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+9"/> <location line="+19"/>
<source>Certificate details</source> <source>Certificate details</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
Expand Down

0 comments on commit 755c290

Please sign in to comment.