2014-08-22 23:08:44 +04:00
|
|
|
/*
|
|
|
|
* Bittorrent Client using Qt and libtorrent.
|
|
|
|
* Copyright (C) 2014 Vladimir Golovnev <glassez@yandex.ru>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* In addition, as a special exception, the copyright holders give permission to
|
|
|
|
* link this program with the OpenSSL project's "OpenSSL" library (or with
|
|
|
|
* modified versions of it that use the same license as the "OpenSSL" library),
|
|
|
|
* and distribute the linked executables. You must obey the GNU General Public
|
|
|
|
* License in all respects for all of the code used other than "OpenSSL". If you
|
|
|
|
* modify file(s), you may extend this exception to your version of the file(s),
|
|
|
|
* but you are not obligated to do so. If you do not wish to do so, delete this
|
|
|
|
* exception statement from your version.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef WEBAPPLICATION_H
|
|
|
|
#define WEBAPPLICATION_H
|
|
|
|
|
2015-01-28 12:03:22 +03:00
|
|
|
#include <QStringList>
|
|
|
|
#include "abstractwebapplication.h"
|
2014-08-22 23:08:44 +04:00
|
|
|
|
2017-09-07 03:00:04 +03:00
|
|
|
class WebApplication : public AbstractWebApplication
|
2014-08-22 23:08:44 +04:00
|
|
|
{
|
2015-01-06 22:42:44 +03:00
|
|
|
Q_DISABLE_COPY(WebApplication)
|
2014-08-22 23:08:44 +04:00
|
|
|
|
|
|
|
public:
|
2017-09-07 03:00:04 +03:00
|
|
|
explicit WebApplication(QObject *parent = nullptr);
|
2014-08-22 23:08:44 +04:00
|
|
|
|
|
|
|
private:
|
2015-01-28 12:03:22 +03:00
|
|
|
// Actions
|
|
|
|
void action_public_webui();
|
|
|
|
void action_public_index();
|
|
|
|
void action_public_login();
|
|
|
|
void action_public_logout();
|
|
|
|
void action_public_theme();
|
|
|
|
void action_public_images();
|
|
|
|
void action_query_torrents();
|
|
|
|
void action_query_preferences();
|
|
|
|
void action_query_transferInfo();
|
|
|
|
void action_query_propertiesGeneral();
|
|
|
|
void action_query_propertiesTrackers();
|
2015-06-12 18:52:01 +03:00
|
|
|
void action_query_propertiesWebSeeds();
|
2015-01-28 12:03:22 +03:00
|
|
|
void action_query_propertiesFiles();
|
2014-12-21 16:00:00 +03:00
|
|
|
void action_query_getLog();
|
|
|
|
void action_query_getPeerLog();
|
2017-04-05 19:36:00 +03:00
|
|
|
void action_query_getPieceHashes();
|
|
|
|
void action_query_getPieceStates();
|
2015-01-28 12:03:22 +03:00
|
|
|
void action_sync_maindata();
|
2015-11-12 22:19:44 +03:00
|
|
|
void action_sync_torrent_peers();
|
2015-01-28 12:03:22 +03:00
|
|
|
void action_command_shutdown();
|
|
|
|
void action_command_download();
|
|
|
|
void action_command_upload();
|
|
|
|
void action_command_addTrackers();
|
|
|
|
void action_command_resumeAll();
|
|
|
|
void action_command_pauseAll();
|
|
|
|
void action_command_resume();
|
|
|
|
void action_command_pause();
|
|
|
|
void action_command_setPreferences();
|
|
|
|
void action_command_setFilePrio();
|
|
|
|
void action_command_getGlobalUpLimit();
|
|
|
|
void action_command_getGlobalDlLimit();
|
|
|
|
void action_command_setGlobalUpLimit();
|
|
|
|
void action_command_setGlobalDlLimit();
|
2015-02-01 20:08:45 +03:00
|
|
|
void action_command_getTorrentsUpLimit();
|
2015-02-01 20:45:37 +03:00
|
|
|
void action_command_getTorrentsDlLimit();
|
2015-02-01 20:08:45 +03:00
|
|
|
void action_command_setTorrentsUpLimit();
|
2015-02-01 20:45:37 +03:00
|
|
|
void action_command_setTorrentsDlLimit();
|
2015-01-28 12:03:22 +03:00
|
|
|
void action_command_alternativeSpeedLimitsEnabled();
|
|
|
|
void action_command_toggleAlternativeSpeedLimits();
|
|
|
|
void action_command_toggleSequentialDownload();
|
|
|
|
void action_command_toggleFirstLastPiecePrio();
|
2015-01-30 23:58:27 +03:00
|
|
|
void action_command_setSuperSeeding();
|
2015-04-15 20:13:18 +03:00
|
|
|
void action_command_setForceStart();
|
2015-01-28 12:03:22 +03:00
|
|
|
void action_command_delete();
|
|
|
|
void action_command_deletePerm();
|
|
|
|
void action_command_increasePrio();
|
|
|
|
void action_command_decreasePrio();
|
|
|
|
void action_command_topPrio();
|
|
|
|
void action_command_bottomPrio();
|
2017-08-06 12:04:39 +03:00
|
|
|
void action_command_setLocation();
|
2017-07-04 12:54:43 +03:00
|
|
|
void action_command_rename();
|
2017-07-05 08:47:23 +03:00
|
|
|
void action_command_setAutoTMM();
|
2015-01-28 12:03:22 +03:00
|
|
|
void action_command_recheck();
|
2016-02-09 11:56:48 +03:00
|
|
|
void action_command_setCategory();
|
2016-01-21 15:32:13 +03:00
|
|
|
void action_command_addCategory();
|
2016-01-21 18:58:08 +03:00
|
|
|
void action_command_removeCategories();
|
2015-10-22 07:36:36 +03:00
|
|
|
void action_command_getSavePath();
|
2015-01-28 12:03:22 +03:00
|
|
|
void action_version_api();
|
|
|
|
void action_version_api_min();
|
|
|
|
void action_version_qbittorrent();
|
|
|
|
|
|
|
|
typedef void (WebApplication::*Action)();
|
|
|
|
|
|
|
|
QString scope_;
|
|
|
|
QString action_;
|
|
|
|
QStringList args_;
|
|
|
|
|
2017-04-27 15:35:28 +03:00
|
|
|
void doProcessRequest() override;
|
2015-01-28 12:03:22 +03:00
|
|
|
|
|
|
|
bool isPublicScope();
|
|
|
|
void parsePath();
|
|
|
|
|
|
|
|
static QMap<QString, QMap<QString, Action> > initializeActions();
|
|
|
|
static QMap<QString, QMap<QString, Action> > actions_;
|
2014-08-22 23:08:44 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // WEBAPPLICATION_H
|