1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-31 20:16:57 +00:00
transmission/qt/Application.h
Charles Kerr 96f76999aa
feat: add "table" format in torrent-get RPC (#1049)
* feat: add optional "format" arg to torrent-get RPC

If the "format" request was "objects" (default), "torrents" will be an
array of objects, each of which contains the key/value pairs matching
the request's "fields" arg. This is unchanged from previous versions.

If the format was "table", then "torrents" will be an array of arrays.
The first row holds the keys and each remaining row holds a torrent's
values for those keys. This format is more efficient in terms of JSON
generation and JSON parsing.
2019-11-09 17:02:23 -06:00

72 lines
1.5 KiB
C++

/*
* This file Copyright (C) 2009-2015 Mnemosyne LLC
*
* It may be used under the GNU GPL versions 2 or 3
* or any future license endorsed by Mnemosyne LLC.
*
*/
#pragma once
#include <QApplication>
#include <QSet>
#include <QTimer>
#include <QTranslator>
#include "FaviconCache.h"
class AddData;
class Prefs;
class Session;
class TorrentModel;
class MainWindow;
class WatchDir;
class Application : public QApplication
{
Q_OBJECT
public:
Application(int& argc, char** argv);
virtual ~Application();
void raise();
bool notifyApp(QString const& title, QString const& body) const;
FaviconCache& faviconCache();
public slots:
void addTorrent(AddData const&);
private slots:
void consentGiven(int result);
void onSessionSourceChanged();
void refreshPref(int key);
void refreshTorrents();
void onTorrentsAdded(QSet<int> const& torrents);
void onTorrentsCompleted(QSet<int> const& torrents);
void onTorrentsNeedInfo(QSet<int> const& torrents);
private:
void maybeUpdateBlocklist();
void loadTranslations();
QStringList getNames(QSet<int> const& ids) const;
void quitLater();
private:
Prefs* myPrefs;
Session* mySession;
TorrentModel* myModel;
MainWindow* myWindow;
WatchDir* myWatchDir;
QTimer myModelTimer;
QTimer myStatsTimer;
QTimer mySessionTimer;
time_t myLastFullUpdateTime;
QTranslator myQtTranslator;
QTranslator myAppTranslator;
FaviconCache myFavicons;
};
#undef qApp
#define qApp static_cast<Application*>(Application::instance())