Fix minimize to tray feature on Win32

This commit is contained in:
Christophe Dumez
2010-06-02 09:16:31 +00:00
parent 6bc0aebe0d
commit 35a9d30143

View File

@@ -219,7 +219,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
transferListFilters->getStatusFilters()->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
if(Preferences::startMinimized()) {
setWindowState(Qt::WindowMinimized);
showMinimized();
}
qDebug("GUI Built");
@@ -602,12 +602,16 @@ void GUI::on_actionCreate_torrent_triggered() {
bool GUI::event(QEvent * e) {
if(e->type() == QEvent::WindowStateChange) {
qDebug("Window change event");
//Now check to see if the window is minimised
if(isMinimized()) {
qDebug("minimisation");
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
if(systrayIcon && settings.value(QString::fromUtf8("Preferences/General/MinimizeToTray"), false).toBool()) {
hide();
qDebug("Minimize to Tray enabled, hiding!");
e->accept();
QTimer::singleShot(0, this, SLOT(hide()));
return true;
}
}
}