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:
|
||||
HeadlessLoader(const QStringList &torrentCmdLine) {
|
||||
connect(static_cast<SessionApplication*>(qApp), SIGNAL(aboutToQuit()), this, SLOT(deleteBTSession()), Qt::DirectConnection);
|
||||
Preferences pref;
|
||||
// Enable Web UI
|
||||
pref.setWebUiEnabled(true);
|
||||
@ -61,11 +62,11 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
~HeadlessLoader() {
|
||||
public slots:
|
||||
void deleteBTSession() {
|
||||
QBtSession::drop();
|
||||
}
|
||||
|
||||
public slots:
|
||||
// Call this function to exit qBittorrent headless loader
|
||||
// and return to prompt (object will be deleted by main)
|
||||
void exit() {
|
||||
|
@ -110,7 +110,7 @@ MainWindow::MainWindow(QWidget *parent, const QStringList& torrentCmdLine) : QMa
|
||||
setWindowTitle(QString("qBittorrent %1").arg(QString::fromUtf8(VERSION)));
|
||||
displaySpeedInTitle = pref.speedInTitleBar();
|
||||
// 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
|
||||
#if defined(Q_WS_X11)
|
||||
if (Preferences().useSystemIconTheme())
|
||||
@ -397,10 +397,6 @@ MainWindow::~MainWindow() {
|
||||
delete switchTransferShortcut;
|
||||
delete switchRSSShortcut;
|
||||
IconProvider::drop();
|
||||
// Delete QBtSession::instance() object
|
||||
m_pwr->setActivityState(false);
|
||||
qDebug("Deleting QBtSession::instance()");
|
||||
QBtSession::drop();
|
||||
qDebug("Exiting GUI destructor...");
|
||||
}
|
||||
|
||||
|
@ -39,12 +39,6 @@ QtSingleApplication(id, argc, argv)
|
||||
#endif
|
||||
{}
|
||||
|
||||
void SessionApplication::commitData(QSessionManager & manager) {
|
||||
Q_UNUSED(manager);
|
||||
emit sessionIsShuttingDown();
|
||||
manager.release();
|
||||
}
|
||||
|
||||
bool SessionApplication::notify(QObject* receiver, QEvent* event) {
|
||||
try {
|
||||
return QApplication::notify(receiver, event);
|
||||
|
@ -52,13 +52,9 @@ class SessionApplication :
|
||||
|
||||
public:
|
||||
SessionApplication(const QString &id, int &argc, char **argv);
|
||||
void commitData(QSessionManager & manager);
|
||||
|
||||
protected:
|
||||
virtual bool notify(QObject* receiver, QEvent* event);
|
||||
|
||||
signals:
|
||||
void sessionIsShuttingDown();
|
||||
};
|
||||
|
||||
#endif // SESSIONAPPLICATION_H
|
||||
|
Loading…
Reference in New Issue
Block a user