Move IVoice enum registration into static method

refs #183
This commit is contained in:
Roland Winklmeier
2014-05-02 14:01:25 +02:00
parent e56eeb4ef9
commit 68e9cc2c3e
8 changed files with 57 additions and 5 deletions

View File

@@ -1,6 +1,7 @@
#include "introwindow.h"
#include "mainwindow.h"
#include "guimodeenums.h"
#include "blackcore/blackcorefreefunctions.h"
#include "blackcore/context_runtime_config.h"
#include "blacksim/blacksimfreefunctions.h"
#include "blackmisc/blackmiscfreefunctions.h"
@@ -23,6 +24,7 @@ int main(int argc, char *argv[])
BlackMisc::initResources();
BlackMisc::registerMetadata();
BlackSim::registerMetadata();
BlackCore::registerMetadata();
// BlackMisc::displayAllUserMetatypesTypes();
QFile file(":blackmisc/translations/blackmisc_i18n_de.qm");

View File

@@ -1,6 +1,7 @@
#include "introwindow.h"
#include "dockwindow.h"
#include "guimodeenums.h"
#include "blackcore/blackcorefreefunctions.h"
#include "blackmisc/blackmiscfreefunctions.h"
#include <QtGlobal>
#include <QApplication>
@@ -19,6 +20,7 @@ int main(int argc, char *argv[])
Q_INIT_RESOURCE(blackgui);
BlackMisc::initResources();
BlackMisc::registerMetadata();
BlackCore::registerMetadata();
// BlackMisc::displayAllUserMetatypesTypes();
QFile file(":blackmisc/translations/blackmisc_i18n_de.qm");

View File

@@ -4,6 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "blackcore/voice_vatlib.h"
#include "blackcore/blackcorefreefunctions.h"
#include "blackmisc/blackmiscfreefunctions.h"
#include "client.h"
@@ -20,6 +21,7 @@ int main(int argc, char *argv[])
QCoreApplication app (argc, argv);
Client client(&app);
BlackMisc::registerMetadata();
BlackCore::registerMetadata();
BlackCore::IVoice *m_voice = new BlackCore::CVoiceVatlib();
QThread m_voiceThread;
m_voice->moveToThread(&m_voiceThread);

View File

@@ -0,0 +1,17 @@
/* Copyright (C) 2013 VATSIM Community / contributors
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "blackcorefreefunctions.h"
#include "voice.h"
namespace BlackCore
{
void registerMetadata()
{
IVoice::registerMetadata();
}
} // namespace

View File

@@ -0,0 +1,21 @@
/* Copyright (C) 2013 VATSIM Community / contributors
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef BLACKCORE_FREEFUNCTIONS_H
#define BLACKCORE_FREEFUNCTIONS_H
/*!
* Free functions in BlackSim
*/
namespace BlackCore
{
/*!
* \brief Register all relevant metadata in BlackCore
*/
void registerMetadata();
} // BlackCore
#endif // guard

View File

@@ -1,6 +1,7 @@
#include "blackcore/context_runtime.h"
#include "blackcore/context_all_impl.h"
#include "blackcore/context_all_proxies.h"
#include "blackcore/blackcorefreefunctions.h"
#include "blacksim/blacksimfreefunctions.h"
@@ -224,6 +225,7 @@ namespace BlackCore
BlackMisc::registerMetadata();
BlackMisc::initResources();
BlackSim::registerMetadata();
BlackCore::registerMetadata();
// upfront reading of settings, as DBus server already relies on settings
CContextSettings *settings = nullptr;

View File

@@ -9,10 +9,13 @@ namespace BlackCore
{
IVoice::IVoice(QObject *parent) : QObject(parent)
{
// http://qt-project.org/forums/viewthread/27495
qRegisterMetaType<IVoice::ComUnit>("ComUnit");
qRegisterMetaType<IVoice::ComUnit>("IVoice::ComUnit");
qRegisterMetaType<IVoice::ConnectionStatus>("ConnectionStatus");
qRegisterMetaType<IVoice::ConnectionStatus>("IVoice::ConnectionStatus");
}
void IVoice::registerMetadata()
{
qRegisterMetaType<ComUnit>();
qRegisterMetaType<ComUnit>("ComUnit");
qRegisterMetaType<ConnectionStatus>();
qRegisterMetaType<ConnectionStatus>("ConnectionStatus");
}
}

View File

@@ -126,6 +126,9 @@ namespace BlackCore
*/
virtual QString micTestResultAsString() const = 0;
//! \brief Register metadata
static void registerMetadata();
public slots:
/*!