mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-11 06:25:33 +08:00
refs #605, fixed unit test itself
* threaded reader were normal members causing a crash when those were moved in their own thread * we need own event processing for unit test * Network request needs to be generated in main thread * don`t shutdown readers on QCoreApplication::aboutToQuit, let CApplication handle it * use CApplication in unit test (as in real world) Unrelated: * access global setup via application
This commit is contained in:
committed by
Mathew Sutcliffe
parent
12957f8ec0
commit
f124412896
@@ -71,31 +71,9 @@ namespace BlackCore
|
||||
//! Application name and version
|
||||
QString getApplicationNameAndVersion() const;
|
||||
|
||||
//! Start services, if not yet parsed call CApplication::parse
|
||||
virtual bool start(bool waitForStart = true);
|
||||
|
||||
//! Wait for stert by calling the event loop and waiting until everything is ready
|
||||
bool waitForStart();
|
||||
|
||||
//! Request to get network reply
|
||||
//! Global setup
|
||||
//! \threadsafe
|
||||
QNetworkReply *getFromNetwork(const BlackMisc::Network::CUrl &url,
|
||||
const BlackMisc::CSlot<void(QNetworkReply *)> &callback);
|
||||
|
||||
//! Request to get network reply
|
||||
//! \threadsafe
|
||||
QNetworkReply *getFromNetwork(const QNetworkRequest &request,
|
||||
const BlackMisc::CSlot<void(QNetworkReply *)> &callback);
|
||||
|
||||
//! Post to network
|
||||
//! \threadsafe
|
||||
QNetworkReply *postToNetwork(const QNetworkRequest &request, const QByteArray &data,
|
||||
const BlackMisc::CSlot<void(QNetworkReply *)> &callback);
|
||||
|
||||
//! Post to network
|
||||
//! \threadsafe
|
||||
QNetworkReply *postToNetwork(const QNetworkRequest &request, QHttpMultiPart *multiPart,
|
||||
const BlackMisc::CSlot<void(QNetworkReply *)> &callback);
|
||||
BlackCore::Data::CGlobalSetup getGlobalSetup() const;
|
||||
|
||||
//! Delete all cookies from cookier manager
|
||||
void deleteAllCookies();
|
||||
@@ -112,6 +90,9 @@ namespace BlackCore
|
||||
//! Get the web data services
|
||||
CWebDataServices *getWebDataServices() const;
|
||||
|
||||
//! Currently running in application thread?
|
||||
bool isApplicationThread() const;
|
||||
|
||||
//! Run event loop
|
||||
static int exec();
|
||||
|
||||
@@ -121,6 +102,9 @@ namespace BlackCore
|
||||
//! Similar to QCoreApplication::arguments
|
||||
static QStringList arguments();
|
||||
|
||||
//! Process all events for some time
|
||||
static void processEventsFor(int milliseconds);
|
||||
|
||||
// ----------------------- parsing ----------------------------------------
|
||||
|
||||
//! \name parsing of command line options
|
||||
@@ -197,10 +181,39 @@ namespace BlackCore
|
||||
//! Graceful shutdown
|
||||
virtual void gracefulShutdown();
|
||||
|
||||
//! Start services, if not yet parsed call CApplication::parse
|
||||
virtual bool start(bool waitForStart = true);
|
||||
|
||||
//! Wait for stert by calling the event loop and waiting until everything is ready
|
||||
bool waitForStart();
|
||||
|
||||
//! Request to get network reply
|
||||
//! \threadsafe
|
||||
QNetworkReply *getFromNetwork(const BlackMisc::Network::CUrl &url,
|
||||
const BlackMisc::CSlot<void(QNetworkReply *)> &callback);
|
||||
|
||||
//! Request to get network reply
|
||||
//! \threadsafe
|
||||
QNetworkReply *getFromNetwork(const QNetworkRequest &request,
|
||||
const BlackMisc::CSlot<void(QNetworkReply *)> &callback);
|
||||
|
||||
//! Post to network
|
||||
//! \threadsafe
|
||||
QNetworkReply *postToNetwork(const QNetworkRequest &request, const QByteArray &data,
|
||||
const BlackMisc::CSlot<void(QNetworkReply *)> &callback);
|
||||
|
||||
//! Post to network
|
||||
//! \threadsafe
|
||||
QNetworkReply *postToNetwork(const QNetworkRequest &request, QHttpMultiPart *multiPart,
|
||||
const BlackMisc::CSlot<void(QNetworkReply *)> &callback);
|
||||
|
||||
signals:
|
||||
//! Setup syncronized
|
||||
void setupSyncronized();
|
||||
|
||||
//! Startup has been completed
|
||||
void startUpCompleted(bool success);
|
||||
|
||||
//! Facade started
|
||||
void coreFacadeStarted();
|
||||
|
||||
@@ -212,9 +225,6 @@ namespace BlackCore
|
||||
void ps_setupSyncronized(bool success);
|
||||
|
||||
protected:
|
||||
//! Constructor
|
||||
CApplication(const QString &applicationName, QCoreApplication *app);
|
||||
|
||||
//! Display help message
|
||||
virtual void cmdLineHelpMessage();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user