Browse Source

- Prepare a little headlessloader class

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
1923a51c59
  1. 18
      src/headlessloader.h
  2. 2
      src/main.cpp
  3. 5
      src/preferences.h

18
src/headlessloader.h

@ -33,13 +33,29 @@
#include <QObject> #include <QObject>
#include <QCoreApplication> #include <QCoreApplication>
#include "preferences.h"
#include "bittorrent.h"
class HeadlessLoader: QObject { class HeadlessLoader: QObject {
Q_OBJECT Q_OBJECT
private:
Bittorrent *BTSession;
public: public:
HeadlessLoader() { HeadlessLoader(QStringList torrentCmdLine) {
// Enable Web UI
Preferences::setWebUiEnabled(true);
// TODO: Listen on socket for parameters
// Instanciate Bittorrent Object
BTSession = new Bittorrent();
// Resume unfinished torrents
BTSession->startUpTorrents();
// TODO: Process command line parameter
}
~HeadlessLoader() {
delete BTSession;
} }
public slots: public slots:

2
src/main.cpp

@ -242,7 +242,7 @@ int main(int argc, char *argv[]){
#else #else
// Load Headless class // Load Headless class
// TODO: by Frederic Lassabe // TODO: by Frederic Lassabe
HeadlessLoader *loader = new HeadlessLoader(); HeadlessLoader *loader = new HeadlessLoader(torrentCmdLine);
#endif #endif
int ret = app->exec(); int ret = app->exec();
#ifndef DISABLE_GUI #ifndef DISABLE_GUI

5
src/preferences.h

@ -450,6 +450,11 @@ public:
return settings.value("Preferences/WebUI/Enabled", false).toBool(); return settings.value("Preferences/WebUI/Enabled", false).toBool();
} }
static void setWebUiEnabled(bool enabled) {
QSettings settings("qBittorrent", "qBittorrent");
settings.setValue("Preferences/WebUI/Enabled", enabled);
}
static quint16 getWebUiPort() { static quint16 getWebUiPort() {
QSettings settings("qBittorrent", "qBittorrent"); QSettings settings("qBittorrent", "qBittorrent");
return settings.value("Preferences/WebUI/Port", 8080).toInt(); return settings.value("Preferences/WebUI/Port", 8080).toInt();

Loading…
Cancel
Save