refs #485, removal of CEnableForRuntime

This commit is contained in:
Klaus Basan
2016-02-14 11:28:27 +01:00
committed by Mathew Sutcliffe
parent 158efe819a
commit 3829aaeae8
61 changed files with 490 additions and 984 deletions

View File

@@ -9,13 +9,13 @@
#define _CRT_SECURE_NO_WARNINGS
#include "blackcore/application.h"
#include "blackmisc/logmessage.h"
#include "directplayerror.h"
#include "directplayutils.h"
#include "fs9host.h"
#include "multiplayerpacketparser.h"
#include "multiplayerpackets.h"
#include "blackmisc/project.h"
#include "blackmisc/logmessage.h"
#include <QScopedArrayPointer>
#include <QVector>
@@ -26,9 +26,8 @@ namespace BlackSimPlugin
namespace Fs9
{
CFs9Host::CFs9Host(QObject *owner) :
CDirectPlayPeer(owner, CProject::swiftVersionString())
{
}
CDirectPlayPeer(owner, sApp->swiftVersionString())
{}
QString CFs9Host::getHostAddress()
{
@@ -78,7 +77,7 @@ namespace BlackSimPlugin
{
initDirectPlay();
createHostAddress();
startHosting(CProject::swiftVersionString(), m_callsign.toQString());
startHosting(sApp->swiftVersionString(), m_callsign.toQString());
}
void CFs9Host::cleanup()
@@ -142,7 +141,7 @@ namespace BlackSimPlugin
}
else
{
BlackMisc::CLogMessage(this).info("Hosting successfully started");
CLogMessage(this).info("Hosting successfully started");
m_hostStatus = Hosting;
}
@@ -172,7 +171,7 @@ namespace BlackSimPlugin
if (m_hostStatus == Terminated) return hr;
BlackMisc::CLogMessage(this).info("Hosting terminated!");
CLogMessage(this).info("Hosting terminated!");
if (FAILED(hr = m_directPlayPeer->TerminateSession(nullptr, 0, 0)))
{
return logDirectPlayError(hr);

View File

@@ -6,11 +6,13 @@
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
#define _CRT_SECURE_NO_WARNINGS
#include "blackcore/actionbind.h"
#include "blackcore/application.h"
#include "directplayerror.h"
#include "directplayutils.h"
#include "blackmisc/project.h"
#include "fs9.h"
#include "lobbyclient.h"
#include "blackmisc/logmessage.h"
@@ -30,6 +32,7 @@ namespace BlackSimPlugin
m_callbackWrapper(this, &CLobbyClient::directPlayMessageHandler),
m_lobbyCallbackWrapper(this, &CLobbyClient::directPlayLobbyMessageHandler)
{
Q_ASSERT_X(sApp, Q_FUNC_INFO, "Missing global object");
initDirectPlay();
}
@@ -208,7 +211,7 @@ namespace BlackSimPlugin
// Set the device addresses
apDevAddress[0] = pDeviceAddress;
QString session = BlackMisc::CProject::swiftVersionString();
QString session = sApp->swiftVersionString();
QScopedArrayPointer<wchar_t> wstrSessionName(new wchar_t[session.size() + 1]);
session.toWCharArray(wstrSessionName.data());
wstrSessionName[session.size()] = 0;

View File

@@ -9,7 +9,7 @@
#include "simulatorfsx.h"
#include "blackcore/interpolatorlinear.h"
#include "blackcore/registermetadata.h"
#include "blackcore/application.h"
#include "blackmisc/simulation/fscommon/bcdconversions.h"
#include "blackmisc/simulation/fsx/simconnectutilities.h"
#include "blackmisc/simulation/fsx/fsxsimulatorsetup.h"
@@ -47,8 +47,9 @@ namespace BlackSimPlugin
QObject *parent) :
CSimulatorFsCommon(info, ownAircraftProvider, remoteAircraftProvider, pluginStorageProvider, parent)
{
Q_ASSERT(ownAircraftProvider);
Q_ASSERT(remoteAircraftProvider);
Q_ASSERT_X(ownAircraftProvider, Q_FUNC_INFO, "Missing provider");
Q_ASSERT_X(remoteAircraftProvider, Q_FUNC_INFO, "Missing provider");
Q_ASSERT_X(sApp, Q_FUNC_INFO, "Missing global object");
this->m_simulatorSetup = CFsxSimulatorSetup::getInitialSetup();
m_useFsuipc = true; // Temporarily enabled until Simconnect Weather is implemented.
@@ -80,7 +81,7 @@ namespace BlackSimPlugin
bool CSimulatorFsx::connectTo()
{
if (this->isConnected()) { return true; }
if (FAILED(SimConnect_Open(&m_hSimConnect, BlackMisc::CProject::swiftVersionChar(), nullptr, 0, 0, 0)))
if (FAILED(SimConnect_Open(&m_hSimConnect, sApp->swiftVersionChar(), nullptr, 0, 0, 0)))
{
// reset state as expected for unconnected
if (m_simconnectTimerId >= 0) { killTimer(m_simconnectTimerId); }
@@ -858,7 +859,7 @@ namespace BlackSimPlugin
{
Q_ASSERT_X(!CThreadUtils::isCurrentThreadApplicationThread(), Q_FUNC_INFO, "Expect to run in background");
HANDLE hSimConnect;
HRESULT result = SimConnect_Open(&hSimConnect, BlackMisc::CProject::swiftVersionChar(), nullptr, 0, 0, 0);
HRESULT result = SimConnect_Open(&hSimConnect, sApp->swiftVersionChar(), nullptr, 0, 0, 0);
SimConnect_Close(hSimConnect);
if (result == S_OK)
{

View File

@@ -8,15 +8,16 @@
*/
#include "simulatorfsx.h"
#include "blackcore/application.h"
#include "simconnectdatadefinition.h"
#include "blackmisc/simulation/fscommon/bcdconversions.h"
#include "blackmisc/simulation/fsx/simconnectutilities.h"
#include "blackmisc/simulation/fsx/fsxsimulatorsetup.h"
#include "blackmisc/simulation/simulatorplugininfo.h"
#include "blackmisc/project.h"
#include "blackmisc/aviation/airportlist.h"
#include "blackmisc/logmessage.h"
using namespace BlackCore;
using namespace BlackMisc;
using namespace BlackMisc::Simulation;
using namespace BlackMisc::Aviation;
@@ -43,7 +44,7 @@ namespace BlackSimPlugin
.arg(event->szApplicationName)
.arg(event->dwApplicationVersionMajor).arg(event->dwApplicationVersionMinor).arg(event->dwApplicationBuildMajor).arg(event->dwApplicationBuildMinor)
.arg(event->dwSimConnectVersionMajor).arg(event->dwSimConnectVersionMinor).arg(event->dwSimConnectBuildMajor).arg(event->dwSimConnectBuildMinor);
CLogMessage(static_cast<CSimulatorFsx *>(nullptr)).info("Connect to FSX: %1") << CProject::swiftVersionString();
CLogMessage(static_cast<CSimulatorFsx *>(nullptr)).info("Connect to FSX: %1") << sApp->swiftVersionString();
break;
}
case SIMCONNECT_RECV_ID_EXCEPTION:

View File

@@ -1,5 +1,15 @@
/* Copyright (C) 2015
* swift project Community / Contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
#include "simconnectsettingscomponent.h"
#include "ui_simconnectsettingscomponent.h"
#include "blackgui/guiapplication.h"
#include "blackcore/contextapplication.h"
#include "blackcore/contextsimulator.h"
#include "blackmisc/network/networkutils.h"
@@ -20,7 +30,6 @@ namespace BlackSimPlugin
{
namespace Fsx
{
CSimConnectSettingsComponent::CSimConnectSettingsComponent(QWidget *parent) :
QFrame(parent),
ui(new Ui::CSimConnectSettingsComponent)
@@ -36,7 +45,7 @@ namespace BlackSimPlugin
CSimConnectSettingsComponent::~CSimConnectSettingsComponent()
{
// void
}
void CSimConnectSettingsComponent::openSimConnectCfgFile()
@@ -49,7 +58,7 @@ namespace BlackSimPlugin
void CSimConnectSettingsComponent::deleteSimConnectCfgFile()
{
QString fileName = CSimConnectUtilities::getLocalSimConnectCfgFilename();
bool result = getIContextApplication()->removeFile(fileName);
bool result = sGui->getIContextApplication()->removeFile(fileName);
if (result)
{
QMessageBox::information(qApp->activeWindow(), tr("File deleted"),
@@ -62,7 +71,7 @@ namespace BlackSimPlugin
void CSimConnectSettingsComponent::checkSimConnectCfgFile()
{
QString fileName = CSimConnectUtilities::getLocalSimConnectCfgFilename();
if (getIContextApplication()->existsFile(fileName))
if (sGui->getIContextApplication()->existsFile(fileName))
{
ui->le_SettingsFsxExistsSimconncetCfg->setText(fileName);
}
@@ -134,9 +143,9 @@ namespace BlackSimPlugin
int p = port.toInt();
QString fileName;
if (getIContextSimulator())
if (sGui->getIContextSimulator())
{
fileName = getIContextSimulator()->getSimulatorSetup().getStringValue(CFsxSimulatorSetup::KeyLocalSimConnectCfgFilename());
fileName = sGui->getIContextSimulator()->getSimulatorSetup().getStringValue(CFsxSimulatorSetup::KeyLocalSimConnectCfgFilename());
}
if (fileName.isEmpty())
@@ -151,7 +160,7 @@ namespace BlackSimPlugin
return;
}
if (getIContextApplication()->writeToFile(fileName, CSimConnectUtilities::simConnectCfg(address, p)))
if (sGui->getIContextApplication()->writeToFile(fileName, CSimConnectUtilities::simConnectCfg(address, p)))
{
QMessageBox::information(qApp->activeWindow(), tr("File saved"),
tr("File %1 saved.").arg(fileName));
@@ -163,6 +172,5 @@ namespace BlackSimPlugin
tr("Failed writing %1!").arg(fileName));
}
}
}
}
} // ns
} // ns

View File

@@ -14,11 +14,8 @@
#include <QFrame>
#include <QScopedPointer>
#include "blackgui/components/enableforruntime.h"
namespace Ui {
class CSimConnectSettingsComponent;
}
namespace Ui { class CSimConnectSettingsComponent; }
namespace BlackSimPlugin
{
@@ -27,7 +24,7 @@ namespace BlackSimPlugin
/**
* A component that gathers all SimConnect-related settings.
*/
class CSimConnectSettingsComponent : public QFrame, public BlackGui::Components::CEnableForRuntime
class CSimConnectSettingsComponent : public QFrame
{
Q_OBJECT
@@ -56,10 +53,8 @@ namespace BlackSimPlugin
private:
QScopedPointer<Ui::CSimConnectSettingsComponent> ui;
};
}
}
} // ns
} // ns
#endif // guard