mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-12 16:23:07 -07:00
FEATURE: Detect executable updates in order to advise the user to restart
This commit is contained in:
parent
a0ff0cdc7e
commit
431d2f082c
35 changed files with 1205 additions and 1008 deletions
16
src/GUI.cpp
16
src/GUI.cpp
|
@ -34,6 +34,7 @@
|
|||
#endif
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QFileSystemWatcher>
|
||||
#include <QMessageBox>
|
||||
#include <QTimer>
|
||||
#include <QDesktopServices>
|
||||
|
@ -220,6 +221,11 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), for
|
|||
showMinimized();
|
||||
}
|
||||
|
||||
// Start watching the executable for updates
|
||||
executable_watcher = new QFileSystemWatcher();
|
||||
connect(executable_watcher, SIGNAL(fileChanged(QString)), this, SLOT(notifyOfUpdate(QString)));
|
||||
executable_watcher->addPath(qApp->applicationFilePath());
|
||||
|
||||
// Resume unfinished torrents
|
||||
BTSession->startUpTorrents();
|
||||
// Add torrent given on command line
|
||||
|
@ -257,6 +263,8 @@ GUI::~GUI() {
|
|||
properties->saveSettings();
|
||||
disconnect(tabs, SIGNAL(currentChanged(int)), this, SLOT(tab_changed(int)));
|
||||
// Delete other GUI objects
|
||||
if(executable_watcher)
|
||||
delete executable_watcher;
|
||||
delete status_bar;
|
||||
delete search_filter;
|
||||
delete transferList;
|
||||
|
@ -592,6 +600,14 @@ bool GUI::unlockUI() {
|
|||
return false;
|
||||
}
|
||||
|
||||
void GUI::notifyOfUpdate(QString) {
|
||||
// Show restart message
|
||||
status_bar->showRestartRequired();
|
||||
// Delete the executable watcher
|
||||
delete executable_watcher;
|
||||
executable_watcher = 0;
|
||||
}
|
||||
|
||||
// Toggle Main window visibility
|
||||
void GUI::toggleVisibility(QSystemTrayIcon::ActivationReason e) {
|
||||
if(e == QSystemTrayIcon::Trigger || e == QSystemTrayIcon::DoubleClick) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue