Skip to content
This repository has been archived by the owner on Aug 31, 2020. It is now read-only.

Commit

Permalink
Remove some QSystemTrayIcon::isSystemTrayAvailable calls where Unity …
Browse files Browse the repository at this point in the history
…has problems.
  • Loading branch information
Ryochan7 committed Oct 28, 2015
1 parent a189bd1 commit 42d5219
Showing 1 changed file with 23 additions and 9 deletions.
32 changes: 23 additions & 9 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ MainWindow::MainWindow(QMap<SDL_JoystickID, InputDevice*> *joysticks,
aboutDialog = 0;
}

connect(ui->menuQuit, SIGNAL(aboutToShow()), this, SLOT(mainMenuChange()));
connect(ui->menuOptions, SIGNAL(aboutToShow()), this, SLOT(mainMenuChange()));
connect(ui->actionKeyValue, SIGNAL(triggered()), this, SLOT(openKeyCheckerDialog()));
connect(ui->actionAbout_Qt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
Expand Down Expand Up @@ -658,17 +659,25 @@ void MainWindow::trayIconClickAction(QSystemTrayIcon::ActivationReason reason)

void MainWindow::mainMenuChange()
{
if (QSystemTrayIcon::isSystemTrayAvailable())
{
ui->actionHide->setEnabled(true);
}
else
QMenu *tempMenu = static_cast<QMenu*>(sender());

if (tempMenu == ui->menuQuit)
{
ui->actionHide->setEnabled(false);
if (showTrayIcon)
{
ui->actionHide->setEnabled(true);
}
else
{
ui->actionHide->setEnabled(false);
}
}

#ifndef USE_SDL_2
ui->actionGameController_Mapping->setVisible(false);
if (tempMenu == ui->menuOptions)
{
ui->actionGameController_Mapping->setVisible(false);
}
#endif
}

Expand Down Expand Up @@ -903,6 +912,8 @@ void MainWindow::joystickTrayShow()

void MainWindow::showEvent(QShowEvent *event)
{
bool propogate = true;

// Check if hideEvent has been processed
if (signalDisconnect && isVisible())
{
Expand All @@ -911,7 +922,7 @@ void MainWindow::showEvent(QShowEvent *event)
signalDisconnect = false;

// Only needed if hidden with the system tray enabled
if (QSystemTrayIcon::isSystemTrayAvailable() && showTrayIcon)
if (showTrayIcon)
{
if (isMinimized())
{
Expand All @@ -930,7 +941,10 @@ void MainWindow::showEvent(QShowEvent *event)
}
}

QMainWindow::showEvent(event);
if (propogate)
{
QMainWindow::showEvent(event);
}
}

void MainWindow::changeEvent(QEvent *event)
Expand Down

0 comments on commit 42d5219

Please sign in to comment.