mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-30 14:15:35 +08:00
as discussed in slack: added default swift testserver (FSD servers) if no settings can be loaded
This commit is contained in:
committed by
Mathew Sutcliffe
parent
d8e0ff83e6
commit
6a1f5e8347
@@ -16,6 +16,7 @@
|
|||||||
#include "blackcore/context_simulator.h"
|
#include "blackcore/context_simulator.h"
|
||||||
#include "blackcore/network.h"
|
#include "blackcore/network.h"
|
||||||
#include "blackcore/simulator.h"
|
#include "blackcore/simulator.h"
|
||||||
|
#include "blackcore/global_network_settings.h"
|
||||||
#include "blackmisc/logmessage.h"
|
#include "blackmisc/logmessage.h"
|
||||||
#include "blackmisc/aviation/aircrafticaodata.h"
|
#include "blackmisc/aviation/aircrafticaodata.h"
|
||||||
#include "../uppercasevalidator.h"
|
#include "../uppercasevalidator.h"
|
||||||
@@ -142,6 +143,12 @@ namespace BlackGui
|
|||||||
ps_validateVatsimValues();
|
ps_validateVatsimValues();
|
||||||
ps_onVatsimDataFileLoaded();
|
ps_onVatsimDataFileLoaded();
|
||||||
CServerList otherServers = this->m_trafficNetworkServers.get();
|
CServerList otherServers = this->m_trafficNetworkServers.get();
|
||||||
|
|
||||||
|
// add a testserver when no servers can be loaded
|
||||||
|
if (otherServers.isEmpty() && CProject::isDebugBuild())
|
||||||
|
{
|
||||||
|
otherServers.push_back(CGlobalNetworkSettings::instance().swiftFSDTestServer());
|
||||||
|
}
|
||||||
this->ui->cbp_OtherServers->setServers(otherServers);
|
this->ui->cbp_OtherServers->setServers(otherServers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,9 @@
|
|||||||
#include "ui_settingsnetworkserverscomponent.h"
|
#include "ui_settingsnetworkserverscomponent.h"
|
||||||
#include "blackcore/context_network.h"
|
#include "blackcore/context_network.h"
|
||||||
#include "blackcore/context_settings.h"
|
#include "blackcore/context_settings.h"
|
||||||
|
#include "blackcore/global_network_settings.h"
|
||||||
#include "blackmisc/logmessage.h"
|
#include "blackmisc/logmessage.h"
|
||||||
|
#include "blackmisc/project.h"
|
||||||
#include "blackmisc/settingsblackmiscclasses.h"
|
#include "blackmisc/settingsblackmiscclasses.h"
|
||||||
|
|
||||||
using namespace BlackCore;
|
using namespace BlackCore;
|
||||||
@@ -44,8 +46,15 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CSettingsNetworkServersComponent::reloadSettings()
|
void CSettingsNetworkServersComponent::reloadSettings()
|
||||||
{
|
{
|
||||||
// update servers
|
CServerList serverList(m_trafficNetworkServers.get());
|
||||||
this->ui->tvp_SettingsTnServers->updateContainer(m_trafficNetworkServers.get());
|
|
||||||
|
// add swift test server in case we have no servers
|
||||||
|
// this is debug/bootstrap feature we can continue to test when something goes wrong
|
||||||
|
if (serverList.isEmpty() && CProject::isDebugBuild())
|
||||||
|
{
|
||||||
|
serverList.push_back(CGlobalNetworkSettings::instance().swiftFSDTestServer());
|
||||||
|
}
|
||||||
|
this->ui->tvp_SettingsTnServers->updateContainer(serverList);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingsNetworkServersComponent::ps_networkServerSelected(QModelIndex index)
|
void CSettingsNetworkServersComponent::ps_networkServerSelected(QModelIndex index)
|
||||||
@@ -66,7 +75,7 @@ namespace BlackGui
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CServerList serverList = m_trafficNetworkServers.get();
|
CServerList serverList(m_trafficNetworkServers.get());
|
||||||
QObject *sender = QObject::sender();
|
QObject *sender = QObject::sender();
|
||||||
if (sender == this->ui->pb_SettingsTnServersRemoveServer)
|
if (sender == this->ui->pb_SettingsTnServersRemoveServer)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ namespace BlackGui
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<Ui::CSettingsNetworkServersComponent> ui;
|
QScopedPointer<Ui::CSettingsNetworkServersComponent> ui;
|
||||||
|
|
||||||
BlackCore::CSetting<BlackCore::Settings::Network::TrafficServers> m_trafficNetworkServers { this };
|
BlackCore::CSetting<BlackCore::Settings::Network::TrafficServers> m_trafficNetworkServers { this };
|
||||||
};
|
};
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace BlackMisc
|
|||||||
};
|
};
|
||||||
|
|
||||||
//! Default constructor.
|
//! Default constructor.
|
||||||
CServer() : m_port(-1), m_isAcceptingConnections(true) {}
|
CServer() {}
|
||||||
|
|
||||||
//! Constructor.
|
//! Constructor.
|
||||||
CServer(const QString &name, const QString &description, const QString &address, int port, const CUser &user, bool isAcceptingConnections = true)
|
CServer(const QString &name, const QString &description, const QString &address, int port, const CUser &user, bool isAcceptingConnections = true)
|
||||||
@@ -73,10 +73,10 @@ namespace BlackMisc
|
|||||||
//! Set port
|
//! Set port
|
||||||
void setPort(int port) { m_port = port; }
|
void setPort(int port) { m_port = port; }
|
||||||
|
|
||||||
//! Server is accepting connections
|
//! Server is accepting connections (allows to disable server temporarily)
|
||||||
bool isAcceptingConnections() const { return m_isAcceptingConnections; }
|
bool isAcceptingConnections() const { return m_isAcceptingConnections; }
|
||||||
|
|
||||||
//! Set whether server is accepting connections
|
//! Set whether server is accepting connections (allows to disable server temporarily)
|
||||||
void setIsAcceptingConnections(bool value) { m_isAcceptingConnections = value; }
|
void setIsAcceptingConnections(bool value) { m_isAcceptingConnections = value; }
|
||||||
|
|
||||||
//! Is valid for login?
|
//! Is valid for login?
|
||||||
@@ -99,9 +99,9 @@ namespace BlackMisc
|
|||||||
QString m_name;
|
QString m_name;
|
||||||
QString m_description;
|
QString m_description;
|
||||||
QString m_address;
|
QString m_address;
|
||||||
int m_port;
|
int m_port = -1;
|
||||||
CUser m_user;
|
CUser m_user;
|
||||||
bool m_isAcceptingConnections;
|
bool m_isAcceptingConnections = true; //!< temp. disable server
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ namespace BlackMisc
|
|||||||
if (isCompiledWithBlackSound()) sl << "BlackSound";
|
if (isCompiledWithBlackSound()) sl << "BlackSound";
|
||||||
if (isCompiledWithBlackInput()) sl << "BlackInput";
|
if (isCompiledWithBlackInput()) sl << "BlackInput";
|
||||||
if (isCompiledWithGui()) sl << "BlackGui";
|
if (isCompiledWithGui()) sl << "BlackGui";
|
||||||
|
if (isCompiledWithFs9Support()) sl << "FS9";
|
||||||
if (isCompiledWithFsxSupport()) sl << "FSX";
|
if (isCompiledWithFsxSupport()) sl << "FSX";
|
||||||
if (isCompiledWithXPlaneSupport()) sl << "XPlane";
|
if (isCompiledWithXPlaneSupport()) sl << "XPlane";
|
||||||
info = sl.join(", ");
|
info = sl.join(", ");
|
||||||
@@ -102,6 +103,7 @@ namespace BlackMisc
|
|||||||
static QStringList sl;
|
static QStringList sl;
|
||||||
if (isCompiledWithFsxSupport()) sl << "FSX";
|
if (isCompiledWithFsxSupport()) sl << "FSX";
|
||||||
if (isCompiledWithXPlaneSupport()) sl << "XPlane";
|
if (isCompiledWithXPlaneSupport()) sl << "XPlane";
|
||||||
|
if (isCompiledWithFs9Support()) sl << "FS9";
|
||||||
sims = sl.join(", ");
|
sims = sl.join(", ");
|
||||||
if (sims.isEmpty()) sims = "<none>";
|
if (sims.isEmpty()) sims = "<none>";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user