2 * Bittorrent Client using Qt and libtorrent.
3 * Copyright (C) 2015 Vladimir Golovnev <glassez@yandex.ru>
4 * Copyright (C) 2006 Christophe Dumez
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 * In addition, as a special exception, the copyright holders give permission to
21 * link this program with the OpenSSL project's "OpenSSL" library (or with
22 * modified versions of it that use the same license as the "OpenSSL" library),
23 * and distribute the linked executables. You must obey the GNU General Public
24 * License in all respects for all of the code used other than "OpenSSL". If you
25 * modify file(s), you may extend this exception to your version of the file(s),
26 * but you are not obligated to do so. If you do not wish to do so, delete this
27 * exception statement from your version.
34 #include <QStringList>
35 #include <QTranslator>
38 #include "qtsingleapplication.h"
39 typedef QtSingleApplication BaseApplication
;
43 class QSessionManager
;
47 #include "qtsinglecoreapplication.h"
48 typedef QtSingleCoreApplication BaseApplication
;
51 #include "base/utils/misc.h"
52 #include "cmdoptions.h"
71 class Application
: public BaseApplication
74 Q_DISABLE_COPY(Application
)
77 Application(const QString
&id
, int &argc
, char **argv
);
78 ~Application() override
;
80 #if (defined(Q_OS_WIN) && !defined(DISABLE_GUI))
83 int exec(const QStringList
¶ms
);
84 bool sendParams(const QStringList
¶ms
);
87 QPointer
<MainWindow
> mainWindow();
90 const QBtCommandLineParameters
&commandLineArgs() const;
92 // FileLogger properties
93 bool isFileLoggerEnabled() const;
94 void setFileLoggerEnabled(bool value
);
95 QString
fileLoggerPath() const;
96 void setFileLoggerPath(const QString
&path
);
97 bool isFileLoggerBackup() const;
98 void setFileLoggerBackup(bool value
);
99 bool isFileLoggerDeleteOld() const;
100 void setFileLoggerDeleteOld(bool value
);
101 int fileLoggerMaxSize() const;
102 void setFileLoggerMaxSize(const int bytes
);
103 int fileLoggerAge() const;
104 void setFileLoggerAge(const int value
);
105 int fileLoggerAgeType() const;
106 void setFileLoggerAgeType(const int value
);
111 bool event(QEvent
*) override
;
113 bool notify(QObject
*receiver
, QEvent
*event
) override
;
117 void processMessage(const QString
&message
);
118 void torrentFinished(BitTorrent::TorrentHandle
*const torrent
);
119 void allTorrentsFinished();
121 #if (!defined(DISABLE_GUI) && defined(Q_OS_WIN))
122 void shutdownCleanup(QSessionManager
&manager
);
127 ShutdownDialogAction m_shutdownAct
;
128 QBtCommandLineParameters m_commandLineArgs
;
131 QPointer
<MainWindow
> m_window
;
134 #ifndef DISABLE_WEBUI
139 QPointer
<FileLogger
> m_fileLogger
;
141 QTranslator m_qtTranslator
;
142 QTranslator m_translator
;
143 QStringList m_paramsQueue
;
145 void initializeTranslation();
146 void processParams(const QStringList
¶ms
);
147 void runExternalProgram(const BitTorrent::TorrentHandle
*torrent
) const;
148 void sendNotificationEmail(const BitTorrent::TorrentHandle
*torrent
);
149 void validateCommandLineParameters();
152 #endif // APPLICATION_H