1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-02-10 13:54:23 +00:00

- Slightly improved minimize to systray code (but still experiencing the virtual desktop switching bug)

This commit is contained in:
Christophe Dumez 2008-08-01 20:03:16 +00:00
parent 5563e24781
commit 7bbb2f542b
2 changed files with 12 additions and 9 deletions

View File

@ -656,15 +656,18 @@ void GUI::on_actionCreate_torrent_triggered() {
connect(ct, SIGNAL(torrent_to_seed(QString)), this, SLOT(addTorrent(QString))); connect(ct, SIGNAL(torrent_to_seed(QString)), this, SLOT(addTorrent(QString)));
} }
// Called when we minimize the program bool GUI::event(QEvent * e) {
void GUI::hideEvent(QHideEvent *e) { if(e->type() == QEvent::WindowStateChange) {
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); //Now check to see if the window is minimised
if(systrayIntegration && settings.value(QString::fromUtf8("Preferences/General/MinimizeToTray"), false).toBool()) { if(isMinimized()) {
// Hide window qDebug("minimisation");
hide(); QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
if(systrayIntegration && settings.value(QString::fromUtf8("Preferences/General/MinimizeToTray"), false).toBool()) {
hide();
}
}
} }
// Accept hiding return QMainWindow::event(e);
e->accept();
} }
// Action executed when a file is dropped // Action executed when a file is dropped

View File

@ -183,7 +183,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
protected: protected:
void closeEvent(QCloseEvent *); void closeEvent(QCloseEvent *);
void hideEvent(QHideEvent *); bool event(QEvent * event);
void displayRSSTab(bool enable); void displayRSSTab(bool enable);
public: public: