diff --git a/Changelog b/Changelog
index 808f3a464..095ae0705 100644
--- a/Changelog
+++ b/Changelog
@@ -9,6 +9,7 @@
- FEATURE: Improved the way parameters are passed between qBT instances (socket)
- FEATURE: User is warned when hard drive becomes full and downloads are paused
- FEATURE: Number of complete/incomplete sources are now displayed in download list for each torrent
+ - FEATURE: Implemented close to systray
- BUGFIX: Two torrents can now have the same name although they are different
- BUGFIX: Fixed download from url that would fail sometimes
- BUGFIX: Save directory was reset to default when filtering files in torrent
diff --git a/TODO b/TODO
index ac1b66b61..9a6a0b034 100644
--- a/TODO
+++ b/TODO
@@ -42,5 +42,4 @@
- UPnP support
// In v0.9.0
-- Implement close to systray
- Wait for libtorrent v0.12 official release
\ No newline at end of file
diff --git a/src/GUI.cpp b/src/GUI.cpp
index ab55ae192..9d58de7e0 100644
--- a/src/GUI.cpp
+++ b/src/GUI.cpp
@@ -862,6 +862,11 @@ void GUI::showAbout(){
// Called when we close the program
void GUI::closeEvent(QCloseEvent *e){
+ if(options->getGoToSysTrayOnExitingWindow() && !this->isHidden()){
+ hide();
+ e->ignore();
+ return;
+ }
if(options->getConfirmOnExit()){
if(QMessageBox::question(this,
tr("Are you sure you want to quit? -- qBittorrent"),
diff --git a/src/options.ui b/src/options.ui
index 161892670..332753fee 100644
--- a/src/options.ui
+++ b/src/options.ui
@@ -6,7 +6,7 @@
0
0
506
- 491
+ 508
@@ -640,6 +640,19 @@
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
@@ -1256,6 +1269,13 @@
+ -
+
+
+ Go to systray when closing main window
+
+
+
diff --git a/src/options_imp.cpp b/src/options_imp.cpp
index 8cff3bde8..5b8c39819 100644
--- a/src/options_imp.cpp
+++ b/src/options_imp.cpp
@@ -141,6 +141,7 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
connect(checkAdditionDialog, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(txt_savePath, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
connect(check_goToSysTray, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
+ connect(check_closeToSysTray, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(clearFinished_checkBox, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(confirmExit_checkBox, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(preview_program, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
@@ -219,6 +220,7 @@ void options_imp::saveOptions(){
settings.setValue("ConfirmOnExit", getConfirmOnExit());
settings.setValue("ClearFinishedDownloads", getClearFinishedOnExit());
settings.setValue("GoToSystray", getGoToSysTrayOnMinimizingWindow());
+ settings.setValue("GoToSystrayOnExit", getGoToSysTrayOnExitingWindow());
settings.endGroup();
settings.setValue("PreviewProgram", getPreviewProgram());
// End Misc options
@@ -394,6 +396,7 @@ void options_imp::loadOptions(){
confirmExit_checkBox->setChecked(settings.value("ConfirmOnExit", true).toBool());
clearFinished_checkBox->setChecked(settings.value("ClearFinishedDownloads", true).toBool());
check_goToSysTray->setChecked(settings.value("GoToSystray", true).toBool());
+ check_closeToSysTray->setChecked(settings.value("GoToSystrayOnExit", true).toBool());
settings.endGroup();
preview_program->setText(settings.value("PreviewProgram", QString()).toString());
// End Misc options
@@ -437,6 +440,10 @@ bool options_imp::getGoToSysTrayOnMinimizingWindow() const{
return check_goToSysTray->isChecked();
}
+bool options_imp::getGoToSysTrayOnExitingWindow() const{
+ return check_closeToSysTray->isChecked();
+}
+
bool options_imp::getConfirmOnExit() const{
return confirmExit_checkBox->isChecked();
}
diff --git a/src/options_imp.h b/src/options_imp.h
index d57d78fbd..e5fa6f8d7 100644
--- a/src/options_imp.h
+++ b/src/options_imp.h
@@ -71,6 +71,7 @@ class options_imp : public QDialog, private Ui::Dialog{
QString getSavePath() const;
bool getClearFinishedOnExit() const;
bool getGoToSysTrayOnMinimizingWindow() const;
+ bool getGoToSysTrayOnExitingWindow() const;
bool getConfirmOnExit() const;
QString getPreviewProgram() const;
bool getUseOSDAlways() const;