mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 05:13:30 -07:00
Put all application logic into Application class.
Application process message and split it into params list itself (this prevents code duplication). Application store params unless other components ready to process them. Application incapsulate all QMacApplication and SessionApplication logic (this is too small to have separate classes).
This commit is contained in:
parent
8b95bb233d
commit
0c50a8b98b
11 changed files with 210 additions and 486 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2014 Vladimir Golovnev <glassez@yandex.ru>
|
||||
* Copyright (C) 2015 Vladimir Golovnev <glassez@yandex.ru>
|
||||
* Copyright (C) 2006 Christophe Dumez
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -34,8 +34,9 @@
|
|||
#include <QTranslator>
|
||||
|
||||
#ifndef DISABLE_GUI
|
||||
#include "sessionapplication.h"
|
||||
typedef SessionApplication BaseApplication;
|
||||
#include "qtsingleapplication.h"
|
||||
typedef QtSingleApplication BaseApplication;
|
||||
class MainWindow;
|
||||
#else
|
||||
#include "qtsinglecoreapplication.h"
|
||||
typedef QtSingleCoreApplication BaseApplication;
|
||||
|
@ -43,18 +44,40 @@ typedef QtSingleCoreApplication BaseApplication;
|
|||
|
||||
class Application : public BaseApplication
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Application(const QString &id, int &argc, char **argv);
|
||||
~Application();
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#if (defined(Q_OS_WIN) && !defined(DISABLE_GUI))
|
||||
bool isRunning();
|
||||
#endif
|
||||
int exec(const QStringList ¶ms);
|
||||
bool sendParams(const QStringList ¶ms);
|
||||
|
||||
protected:
|
||||
#ifndef DISABLE_GUI
|
||||
#ifdef Q_OS_MAC
|
||||
bool event(QEvent *);
|
||||
#endif
|
||||
bool notify(QObject* receiver, QEvent* event);
|
||||
#endif
|
||||
|
||||
private slots:
|
||||
void processMessage(const QString &message);
|
||||
|
||||
private:
|
||||
bool m_running;
|
||||
#ifndef DISABLE_GUI
|
||||
MainWindow *m_window;
|
||||
#endif
|
||||
QTranslator m_qtTranslator;
|
||||
QTranslator m_translator;
|
||||
QStringList m_paramsQueue;
|
||||
|
||||
void initializeTranslation();
|
||||
void processParams(const QStringList ¶ms);
|
||||
};
|
||||
|
||||
#endif // APPLICATION_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue