refs #199, removed context_application_base (moved to IContext application)

* as discussed under 4, and in the meeting https://dev.vatsim-germany.org/boards/22/topics/1671?r=1676#message-1676
This commit is contained in:
Klaus Basan
2014-04-16 23:40:27 +02:00
parent 20322a1a55
commit 3c42a91596
9 changed files with 103 additions and 128 deletions

View File

@@ -25,7 +25,7 @@ namespace BlackCore
protected:
//! Constructor
IContextApplication(CRuntimeConfig::ContextMode mode, CRuntime *runtime) : CContext(mode, runtime) {}
IContextApplication(CRuntimeConfig::ContextMode mode, CRuntime *runtime);
public:
@@ -70,16 +70,22 @@ namespace BlackCore
virtual ~IContextApplication() {}
//! Output redirection (redirect my output)
virtual RedirectionLevel getOutputRedirectionLevel() const = 0;
RedirectionLevel getOutputRedirectionLevel() const { return this->m_outputRedirectionLevel; }
//! Output redirection (redirect my output)
virtual void setOutputRedirectionLevel(RedirectionLevel level) = 0;
void setOutputRedirectionLevel(RedirectionLevel redirectionLevel) { this->m_outputRedirectionLevel = redirectionLevel; }
//! Redirected output generated by others
virtual RedirectionLevel getStreamingForRedirectedOutputLevel() const = 0;
RedirectionLevel getStreamingForRedirectedOutputLevel() const { return this->m_redirectedOutputRedirectionLevel; }
//! Redirected output generated by others
virtual void setStreamingForRedirectedOutputLevel(RedirectionLevel level) = 0;
void setStreamingForRedirectedOutputLevel(RedirectionLevel redirectionLevel) ;
//! Process event, cross thread messages
bool event(QEvent *event) override;
//! Reset output redirection
static void resetOutputRedirection();
signals:
//! \brief Status message
@@ -112,15 +118,35 @@ namespace BlackCore
//! A component has changed its state
virtual void notifyAboutComponentChange(uint component, uint action) = 0;
//! Remote enable version of writing a text file
//! Remote enabled version of writing a text file
virtual bool writeToFile(const QString &fileName, const QString &content) = 0;
//! Remote enable version of reading a text file
//! Remote enabled version of reading a text file
virtual QString readFromFile(const QString &fileName) = 0;
//! Remote enable version of deleting a file
//! Remote enabled version of deleting a file
virtual bool removeFile(const QString &fileName) = 0;
private:
//! All contexts, used with messageHandler
static QList<IContextApplication *> s_contexts;
//! Previous message handler
static QtMessageHandler s_oldHandler;
//! Message handler, handles one individual context
void messageHandler(QtMsgType type, const QMessageLogContext &messageContext, const QString &messsage);
//! Handle output dispatch, handles all contexts
static void messageHandlerDispatch(QtMsgType type, const QMessageLogContext &messageContext, const QString &message);
RedirectionLevel m_outputRedirectionLevel; //!< enable / disable my output
RedirectionLevel m_redirectedOutputRedirectionLevel; //!< enable / disable others output
private slots:
//! Re-stream the redirected output
void streamRedirectedOutput(const BlackMisc::CStatusMessage &message, qint64 contextId);
};
}