1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-22 20:44:15 +00:00

Process Mac toolbar toggling event

This commit is contained in:
Christophe Dumez 2010-07-21 18:02:29 +00:00
parent c0520146e9
commit 310433fb54

View File

@ -624,21 +624,32 @@ void GUI::on_actionCreate_torrent_triggered() {
} }
bool GUI::event(QEvent * e) { bool GUI::event(QEvent * e) {
if(e->type() == QEvent::WindowStateChange) { switch(e->type()) {
qDebug("Window change event"); case QEvent::WindowStateChange: {
//Now check to see if the window is minimised qDebug("Window change event");
if(isMinimized()) { //Now check to see if the window is minimised
qDebug("minimisation"); if(isMinimized()) {
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); qDebug("minimisation");
if(systrayIcon && settings.value(QString::fromUtf8("Preferences/General/MinimizeToTray"), false).toBool()) { QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
if(!qApp->activeWindow() || !qApp->activeWindow()->isModal()) { if(systrayIcon && settings.value(QString::fromUtf8("Preferences/General/MinimizeToTray"), false).toBool()) {
qDebug("Minimize to Tray enabled, hiding!"); if(!qApp->activeWindow() || !qApp->activeWindow()->isModal()) {
e->accept(); qDebug("Minimize to Tray enabled, hiding!");
QTimer::singleShot(0, this, SLOT(hide())); e->accept();
return true; QTimer::singleShot(0, this, SLOT(hide()));
return true;
}
} }
} }
break;
} }
#ifdef Q_WS_MAC
case QEvent::ToolBarChange: {
actionTop_tool_bar->setChecked(toolBar->isVisible());
break;
}
#endif
default:
break;
} }
return QMainWindow::event(e); return QMainWindow::event(e);
} }