Browse Source

Second attempt at fixing saving settings on shutdown.

adaptive-webui-19844
sledgehammer999 11 years ago
parent
commit
88b5550540
  1. 5
      src/headlessloader.h
  2. 6
      src/mainwindow.cpp
  3. 6
      src/sessionapplication.cpp
  4. 4
      src/sessionapplication.h

5
src/headlessloader.h

@ -41,6 +41,7 @@ class HeadlessLoader: public QObject { @@ -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: @@ -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() {

6
src/mainwindow.cpp

@ -110,7 +110,7 @@ MainWindow::MainWindow(QWidget *parent, const QStringList& torrentCmdLine) : QMa @@ -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() { @@ -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...");
}

6
src/sessionapplication.cpp

@ -39,12 +39,6 @@ QtSingleApplication(id, argc, argv) @@ -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);

4
src/sessionapplication.h

@ -52,13 +52,9 @@ class SessionApplication : @@ -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…
Cancel
Save