mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 07:18:08 +00:00
Second attempt at fixing saving settings on shutdown.
This commit is contained in:
parent
c87856d846
commit
88b5550540
@ -41,6 +41,7 @@ class HeadlessLoader: public QObject {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
HeadlessLoader(const QStringList &torrentCmdLine) {
|
HeadlessLoader(const QStringList &torrentCmdLine) {
|
||||||
|
connect(static_cast<SessionApplication*>(qApp), SIGNAL(aboutToQuit()), this, SLOT(deleteBTSession()), Qt::DirectConnection);
|
||||||
Preferences pref;
|
Preferences pref;
|
||||||
// Enable Web UI
|
// Enable Web UI
|
||||||
pref.setWebUiEnabled(true);
|
pref.setWebUiEnabled(true);
|
||||||
@ -61,11 +62,11 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
~HeadlessLoader() {
|
public slots:
|
||||||
|
void deleteBTSession() {
|
||||||
QBtSession::drop();
|
QBtSession::drop();
|
||||||
}
|
}
|
||||||
|
|
||||||
public slots:
|
|
||||||
// Call this function to exit qBittorrent headless loader
|
// Call this function to exit qBittorrent headless loader
|
||||||
// and return to prompt (object will be deleted by main)
|
// and return to prompt (object will be deleted by main)
|
||||||
void exit() {
|
void exit() {
|
||||||
|
@ -110,7 +110,7 @@ MainWindow::MainWindow(QWidget *parent, const QStringList& torrentCmdLine) : QMa
|
|||||||
setWindowTitle(QString("qBittorrent %1").arg(QString::fromUtf8(VERSION)));
|
setWindowTitle(QString("qBittorrent %1").arg(QString::fromUtf8(VERSION)));
|
||||||
displaySpeedInTitle = pref.speedInTitleBar();
|
displaySpeedInTitle = pref.speedInTitleBar();
|
||||||
// Clean exit on log out
|
// Clean exit on log out
|
||||||
connect(static_cast<SessionApplication*>(qApp), SIGNAL(sessionIsShuttingDown()), this, SLOT(deleteBTSession()), Qt::DirectConnection);
|
connect(static_cast<SessionApplication*>(qApp), SIGNAL(aboutToQuit()), this, SLOT(deleteBTSession()), Qt::DirectConnection);
|
||||||
// Setting icons
|
// Setting icons
|
||||||
#if defined(Q_WS_X11)
|
#if defined(Q_WS_X11)
|
||||||
if (Preferences().useSystemIconTheme())
|
if (Preferences().useSystemIconTheme())
|
||||||
@ -397,10 +397,6 @@ MainWindow::~MainWindow() {
|
|||||||
delete switchTransferShortcut;
|
delete switchTransferShortcut;
|
||||||
delete switchRSSShortcut;
|
delete switchRSSShortcut;
|
||||||
IconProvider::drop();
|
IconProvider::drop();
|
||||||
// Delete QBtSession::instance() object
|
|
||||||
m_pwr->setActivityState(false);
|
|
||||||
qDebug("Deleting QBtSession::instance()");
|
|
||||||
QBtSession::drop();
|
|
||||||
qDebug("Exiting GUI destructor...");
|
qDebug("Exiting GUI destructor...");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,12 +39,6 @@ QtSingleApplication(id, argc, argv)
|
|||||||
#endif
|
#endif
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void SessionApplication::commitData(QSessionManager & manager) {
|
|
||||||
Q_UNUSED(manager);
|
|
||||||
emit sessionIsShuttingDown();
|
|
||||||
manager.release();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SessionApplication::notify(QObject* receiver, QEvent* event) {
|
bool SessionApplication::notify(QObject* receiver, QEvent* event) {
|
||||||
try {
|
try {
|
||||||
return QApplication::notify(receiver, event);
|
return QApplication::notify(receiver, event);
|
||||||
|
@ -52,13 +52,9 @@ class SessionApplication :
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
SessionApplication(const QString &id, int &argc, char **argv);
|
SessionApplication(const QString &id, int &argc, char **argv);
|
||||||
void commitData(QSessionManager & manager);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool notify(QObject* receiver, QEvent* event);
|
virtual bool notify(QObject* receiver, QEvent* event);
|
||||||
|
|
||||||
signals:
|
|
||||||
void sessionIsShuttingDown();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SESSIONAPPLICATION_H
|
#endif // SESSIONAPPLICATION_H
|
||||||
|
Loading…
Reference in New Issue
Block a user