mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-06 02:16:04 +08:00
refactor: Fix Qt 5.15 deprecation warnings
This commit is contained in:
@@ -41,7 +41,6 @@ set(SWIFT_MISC_PCH
|
|||||||
<QJsonValue>
|
<QJsonValue>
|
||||||
<QJsonValueRef>
|
<QJsonValueRef>
|
||||||
<QLatin1Char>
|
<QLatin1Char>
|
||||||
<QLatin1Literal>
|
|
||||||
<QLatin1String>
|
<QLatin1String>
|
||||||
<QList>
|
<QList>
|
||||||
<QLoggingCategory>
|
<QLoggingCategory>
|
||||||
|
|||||||
@@ -263,7 +263,7 @@ namespace BlackSample
|
|||||||
|
|
||||||
timer.start();
|
timer.start();
|
||||||
situations.convertFromJson(json);
|
situations.convertFromJson(json);
|
||||||
out << "Convert 100,000 aircraft situations from JSON: " << timer.elapsed() << "ms" << endl
|
out << "Convert 100,000 aircraft situations from JSON: " << timer.elapsed() << "ms" << Qt::endl
|
||||||
<< Qt::endl;
|
<< Qt::endl;
|
||||||
|
|
||||||
timer.start();
|
timer.start();
|
||||||
@@ -272,7 +272,7 @@ namespace BlackSample
|
|||||||
|
|
||||||
timer.start();
|
timer.start();
|
||||||
models.convertFromJson(json);
|
models.convertFromJson(json);
|
||||||
out << "Convert 10,000 aircraft models from JSON (naive): " << timer.elapsed() << "ms" << endl
|
out << "Convert 10,000 aircraft models from JSON (naive): " << timer.elapsed() << "ms" << Qt::endl
|
||||||
<< Qt::endl;
|
<< Qt::endl;
|
||||||
|
|
||||||
timer.start();
|
timer.start();
|
||||||
@@ -281,7 +281,7 @@ namespace BlackSample
|
|||||||
|
|
||||||
timer.start();
|
timer.start();
|
||||||
models.convertFromMemoizedJson(json);
|
models.convertFromMemoizedJson(json);
|
||||||
out << "Convert 10,000 aircraft models from JSON (memoize): " << timer.elapsed() << "ms" << endl
|
out << "Convert 10,000 aircraft models from JSON (memoize): " << timer.elapsed() << "ms" << Qt::endl
|
||||||
<< Qt::endl;
|
<< Qt::endl;
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
@@ -383,7 +383,7 @@ namespace BlackSample
|
|||||||
auto c = s.contains(upperRegex);
|
auto c = s.contains(upperRegex);
|
||||||
Q_UNUSED(c);
|
Q_UNUSED(c);
|
||||||
}
|
}
|
||||||
out << "Check 100,000 strings for containing uppercase letter: (regex) " << timer.elapsed() << "ms" << endl
|
out << "Check 100,000 strings for containing uppercase letter: (regex) " << timer.elapsed() << "ms" << Qt::endl
|
||||||
<< Qt::endl;
|
<< Qt::endl;
|
||||||
|
|
||||||
timer.start();
|
timer.start();
|
||||||
@@ -400,7 +400,7 @@ namespace BlackSample
|
|||||||
auto i = s.indexOf(upperRegex);
|
auto i = s.indexOf(upperRegex);
|
||||||
Q_UNUSED(i);
|
Q_UNUSED(i);
|
||||||
}
|
}
|
||||||
out << "Check 100,000 strings for index of first uppercase letter: (regex) " << timer.elapsed() << "ms" << endl
|
out << "Check 100,000 strings for index of first uppercase letter: (regex) " << timer.elapsed() << "ms" << Qt::endl
|
||||||
<< Qt::endl;
|
<< Qt::endl;
|
||||||
|
|
||||||
auto temp = strings;
|
auto temp = strings;
|
||||||
@@ -417,7 +417,7 @@ namespace BlackSample
|
|||||||
{
|
{
|
||||||
s.remove(upperRegex);
|
s.remove(upperRegex);
|
||||||
}
|
}
|
||||||
out << "Remove from 100,000 strings all uppercase letters: (regex) " << timer.elapsed() << "ms" << endl
|
out << "Remove from 100,000 strings all uppercase letters: (regex) " << timer.elapsed() << "ms" << Qt::endl
|
||||||
<< Qt::endl;
|
<< Qt::endl;
|
||||||
|
|
||||||
timer.start();
|
timer.start();
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ void CWeatherDataPrinter::fetchAndPrintWeatherData(const CCoordinateGeodetic &po
|
|||||||
void CWeatherDataPrinter::printWeatherData(const CWeatherGrid &weatherGrid)
|
void CWeatherDataPrinter::printWeatherData(const CWeatherGrid &weatherGrid)
|
||||||
{
|
{
|
||||||
QTextStream qtout(stdout);
|
QTextStream qtout(stdout);
|
||||||
qtout << "... finished." << endl;
|
qtout << "... finished." << Qt::endl;
|
||||||
qtout << weatherGrid.getDescription();
|
qtout << weatherGrid.getDescription();
|
||||||
qtout << endl;
|
qtout << Qt::endl;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace BlackCore::Afv::Connection
|
|||||||
|
|
||||||
connect(m_voiceServerTimer, &QTimer::timeout, this, &CClientConnection::voiceServerHeartbeat); // sends heartbeat to server
|
connect(m_voiceServerTimer, &QTimer::timeout, this, &CClientConnection::voiceServerHeartbeat); // sends heartbeat to server
|
||||||
connect(m_udpSocket, &QUdpSocket::readyRead, this, &CClientConnection::readPendingDatagrams);
|
connect(m_udpSocket, &QUdpSocket::readyRead, this, &CClientConnection::readPendingDatagrams);
|
||||||
connect(m_udpSocket, qOverload<QAbstractSocket::SocketError>(&QUdpSocket::error), this, &CClientConnection::handleSocketError);
|
connect(m_udpSocket, &QAbstractSocket::errorOccurred, this, &CClientConnection::handleSocketError);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CClientConnection::connectTo(const QString &userName, const QString &password, const QString &callsign, const QString &client, ConnectionCallback callback)
|
void CClientConnection::connectTo(const QString &userName, const QString &password, const QString &callsign, const QString &client, ConnectionCallback callback)
|
||||||
|
|||||||
@@ -38,7 +38,6 @@
|
|||||||
#include <QHttpMultiPart>
|
#include <QHttpMultiPart>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QNetworkRequest>
|
#include <QNetworkRequest>
|
||||||
#include <QNetworkConfigurationManager>
|
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <QSslSocket>
|
#include <QSslSocket>
|
||||||
@@ -971,19 +970,6 @@ namespace BlackCore
|
|||||||
|
|
||||||
// Init network
|
// Init network
|
||||||
Q_ASSERT_X(m_accessManager, Q_FUNC_INFO, "Need QAM");
|
Q_ASSERT_X(m_accessManager, Q_FUNC_INFO, "Need QAM");
|
||||||
|
|
||||||
CLogMessage::preformatted(CNetworkUtils::createNetworkReport(m_accessManager));
|
|
||||||
|
|
||||||
// enable by setting accessible
|
|
||||||
// http://doc.qt.io/qt-5/qnetworkaccessmanager.html#setNetworkAccessible
|
|
||||||
m_accessManager->setNetworkAccessible(QNetworkAccessManager::Accessible);
|
|
||||||
|
|
||||||
// create a network report in the log
|
|
||||||
QTimer::singleShot(4000, this, [=] {
|
|
||||||
if (!sApp || sApp->isShuttingDown()) { return; }
|
|
||||||
const QString r = CNetworkUtils::createNetworkAccessManagerReport(m_accessManager);
|
|
||||||
CLogMessage(this).info(u"Network report:\n%1") << r;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CApplication *BlackCore::CApplication::instance()
|
CApplication *BlackCore::CApplication::instance()
|
||||||
|
|||||||
@@ -418,7 +418,7 @@ namespace BlackCore::Db
|
|||||||
if (size < 1) break;
|
if (size < 1) break;
|
||||||
|
|
||||||
QByteArray ba;
|
QByteArray ba;
|
||||||
ba.append(content.mid(contentIndex));
|
ba.append(content.mid(contentIndex).toUtf8());
|
||||||
ba = QByteArray::fromBase64(ba);
|
ba = QByteArray::fromBase64(ba);
|
||||||
ba.insert(0, CCompressUtils::lengthHeader(size)); // adding 4 bytes length header
|
ba.insert(0, CCompressUtils::lengthHeader(size)); // adding 4 bytes length header
|
||||||
byteData = qUncompress(ba);
|
byteData = qUncompress(ba);
|
||||||
|
|||||||
@@ -1037,7 +1037,7 @@ namespace BlackGui::Components
|
|||||||
{
|
{
|
||||||
auto item = list->findItems(enabledOption, Qt::MatchExactly);
|
auto item = list->findItems(enabledOption, Qt::MatchExactly);
|
||||||
Q_ASSERT_X(item.size() == 1, Q_FUNC_INFO, "Expected exactly one item per option");
|
Q_ASSERT_X(item.size() == 1, Q_FUNC_INFO, "Expected exactly one item per option");
|
||||||
list->setItemSelected(item[0], true);
|
item[0]->setSelected(true);
|
||||||
}
|
}
|
||||||
list->blockSignals(false);
|
list->blockSignals(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace BlackGui::Components
|
|||||||
|
|
||||||
// Widget style
|
// Widget style
|
||||||
connect(ui->hs_SettingsGuiOpacity, &QSlider::valueChanged, this, &CSettingsGuiComponent::changedWindowsOpacity);
|
connect(ui->hs_SettingsGuiOpacity, &QSlider::valueChanged, this, &CSettingsGuiComponent::changedWindowsOpacity);
|
||||||
connect(ui->cb_SettingsGuiWidgetStyle, qOverload<const QString &>(&QComboBox::currentIndexChanged), this, &CSettingsGuiComponent::widgetStyleChanged, Qt::QueuedConnection);
|
connect(ui->cb_SettingsGuiWidgetStyle, qOverload<int>(&QComboBox::currentIndexChanged), this, &CSettingsGuiComponent::widgetStyleChanged, Qt::QueuedConnection);
|
||||||
|
|
||||||
ui->comp_SettingsFonts->setStyleSheetDefaultColor();
|
ui->comp_SettingsFonts->setStyleSheetDefaultColor();
|
||||||
|
|
||||||
@@ -87,8 +87,9 @@ namespace BlackGui::Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingsGuiComponent::widgetStyleChanged(const QString &widgetStyle)
|
void CSettingsGuiComponent::widgetStyleChanged(int index)
|
||||||
{
|
{
|
||||||
|
const QString widgetStyle = ui->cb_SettingsGuiWidgetStyle->itemText(index);
|
||||||
const CGeneralGuiSettings settings = m_guiSettings.getThreadLocal();
|
const CGeneralGuiSettings settings = m_guiSettings.getThreadLocal();
|
||||||
if (!settings.isDifferentValidWidgetStyle(widgetStyle)) { return; }
|
if (!settings.isDifferentValidWidgetStyle(widgetStyle)) { return; }
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ namespace BlackGui::Components
|
|||||||
void guiSettingsChanged();
|
void guiSettingsChanged();
|
||||||
|
|
||||||
//! Widget style has changed
|
//! Widget style has changed
|
||||||
void widgetStyleChanged(const QString &widgetStyle);
|
void widgetStyleChanged(int index);
|
||||||
|
|
||||||
QScopedPointer<Ui::CSettingsGuiComponent> ui;
|
QScopedPointer<Ui::CSettingsGuiComponent> ui;
|
||||||
BlackMisc::CSetting<Settings::TGeneralGui> m_guiSettings { this, &CSettingsGuiComponent::guiSettingsChanged };
|
BlackMisc::CSetting<Settings::TGeneralGui> m_guiSettings { this, &CSettingsGuiComponent::guiSettingsChanged };
|
||||||
|
|||||||
@@ -646,14 +646,6 @@ namespace BlackGui
|
|||||||
a = menu.addAction(CIcons::swift24(), "Check for updates");
|
a = menu.addAction(CIcons::swift24(), "Check for updates");
|
||||||
c = connect(a, &QAction::triggered, this, &CGuiApplication::checkNewVersionMenu);
|
c = connect(a, &QAction::triggered, this, &CGuiApplication::checkNewVersionMenu);
|
||||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
||||||
|
|
||||||
a = menu.addAction(CIcons::monitorError16(), "Network config. (console)");
|
|
||||||
c = connect(a, &QAction::triggered, this, [=]() {
|
|
||||||
if (!sGui || sGui->isShuttingDown()) { return; }
|
|
||||||
const QString r = CNetworkUtils::createNetworkAccessManagerReport(this->getNetworkAccessManager());
|
|
||||||
CLogMessage(this).info(r);
|
|
||||||
});
|
|
||||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
|
||||||
Q_UNUSED(c)
|
Q_UNUSED(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ namespace BlackGui
|
|||||||
signalMapperToggleFloating->setMapping(toggleFloatingMenuAction, i);
|
signalMapperToggleFloating->setMapping(toggleFloatingMenuAction, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
c = connect(signalMapperToggleFloating, qOverload<int>(&QSignalMapper::mapped), this, &CInfoArea::toggleFloatingByIndex);
|
c = connect(signalMapperToggleFloating, &QSignalMapper::mappedInt, this, &CInfoArea::toggleFloatingByIndex);
|
||||||
BLACK_VERIFY_X(c, Q_FUNC_INFO, "Cannot connect mapper"); // do not make that shutdown reason in a release build
|
BLACK_VERIFY_X(c, Q_FUNC_INFO, "Cannot connect mapper"); // do not make that shutdown reason in a release build
|
||||||
|
|
||||||
menu->addMenu(subMenuDisplay);
|
menu->addMenu(subMenuDisplay);
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ namespace BlackGui::Menus
|
|||||||
CMenuAction CMenuActions::addAction(const CMenuAction &menuAction)
|
CMenuAction CMenuActions::addAction(const CMenuAction &menuAction)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(!menuAction.getPath().isEmpty(), Q_FUNC_INFO, "Need path");
|
Q_ASSERT_X(!menuAction.getPath().isEmpty(), Q_FUNC_INFO, "Need path");
|
||||||
m_actions.insertMulti(menuAction.getPath(), menuAction);
|
m_actions.insert(menuAction.getPath(), menuAction);
|
||||||
return menuAction;
|
return menuAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ namespace BlackGui
|
|||||||
QVBoxLayout *layout = new QVBoxLayout;
|
QVBoxLayout *layout = new QVBoxLayout;
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
||||||
connect(m_detailsButtonMapper, qOverload<const QString &>(&QSignalMapper::mapped), this, &CPluginSelector::pluginDetailsRequested);
|
connect(m_detailsButtonMapper, &QSignalMapper::mappedString, this, &CPluginSelector::pluginDetailsRequested);
|
||||||
connect(m_configButtonMapper, qOverload<const QString &>(&QSignalMapper::mapped), this, &CPluginSelector::pluginConfigRequested);
|
connect(m_configButtonMapper, &QSignalMapper::mappedString, this, &CPluginSelector::pluginConfigRequested);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPluginSelector::addPlugin(const QString &identifier, const QString &name, bool hasConfig, bool enabled)
|
void CPluginSelector::addPlugin(const QString &identifier, const QString &name, bool hasConfig, bool enabled)
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QMatrix>
|
#include <QTransform>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QSize>
|
#include <QSize>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
@@ -1301,9 +1301,9 @@ namespace BlackMisc
|
|||||||
|
|
||||||
QPixmap CIcons::rotate(int rotateDegrees, const QPixmap &original)
|
QPixmap CIcons::rotate(int rotateDegrees, const QPixmap &original)
|
||||||
{
|
{
|
||||||
QMatrix rm;
|
QTransform rt;
|
||||||
rm.rotate(rotateDegrees);
|
rt.rotate(rotateDegrees);
|
||||||
QPixmap rotated = original.transformed(rm);
|
QPixmap rotated = original.transformed(rt);
|
||||||
int xoffset = (rotated.width() - original.width()) / 2;
|
int xoffset = (rotated.width() - original.width()) / 2;
|
||||||
int yoffset = (rotated.height() - original.height()) / 2;
|
int yoffset = (rotated.height() - original.height()) / 2;
|
||||||
rotated = rotated.copy(xoffset, yoffset, original.width(), original.height());
|
rotated = rotated.copy(xoffset, yoffset, original.width(), original.height());
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ namespace BlackMisc
|
|||||||
QByteArray baseData;
|
QByteArray baseData;
|
||||||
baseData.append(getMachineId());
|
baseData.append(getMachineId());
|
||||||
baseData.append(reinterpret_cast<const char *>(&m_processId), sizeof(m_processId));
|
baseData.append(reinterpret_cast<const char *>(&m_processId), sizeof(m_processId));
|
||||||
baseData.append(getName());
|
baseData.append(getName().toUtf8());
|
||||||
return QUuid::createUuidV5(ns, baseData);
|
return QUuid::createUuidV5(ns, baseData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QNetworkInterface>
|
#include <QNetworkInterface>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QNetworkConfiguration>
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QSignalMapper>
|
#include <QSignalMapper>
|
||||||
#include <QTcpSocket>
|
#include <QTcpSocket>
|
||||||
@@ -62,11 +61,11 @@ namespace BlackMisc::Network
|
|||||||
QTcpSocket socket;
|
QTcpSocket socket;
|
||||||
QSignalMapper mapper;
|
QSignalMapper mapper;
|
||||||
QObject::connect(&socket, &QTcpSocket::connected, &mapper, qOverload<>(&QSignalMapper::map));
|
QObject::connect(&socket, &QTcpSocket::connected, &mapper, qOverload<>(&QSignalMapper::map));
|
||||||
QObject::connect(&socket, qOverload<QAbstractSocket::SocketError>(&QTcpSocket::error), &mapper, qOverload<>(&QSignalMapper::map));
|
QObject::connect(&socket, &QAbstractSocket::errorOccurred, &mapper, qOverload<>(&QSignalMapper::map));
|
||||||
mapper.setMapping(&socket, 0);
|
mapper.setMapping(&socket, 0);
|
||||||
|
|
||||||
CEventLoop eventLoop;
|
CEventLoop eventLoop;
|
||||||
eventLoop.stopWhen(&mapper, qOverload<int>(&QSignalMapper::mapped));
|
eventLoop.stopWhen(&mapper, &QSignalMapper::mappedInt);
|
||||||
socket.connectToHost(hostAddress, static_cast<quint16>(port));
|
socket.connectToHost(hostAddress, static_cast<quint16>(port));
|
||||||
const bool timedOut = !eventLoop.exec(timeoutMs);
|
const bool timedOut = !eventLoop.exec(timeoutMs);
|
||||||
|
|
||||||
@@ -282,109 +281,6 @@ namespace BlackMisc::Network
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CStatusMessageList CNetworkUtils::createNetworkReport(const QNetworkAccessManager *am)
|
|
||||||
{
|
|
||||||
return CNetworkUtils::createNetworkReport(QUrl(), am);
|
|
||||||
}
|
|
||||||
|
|
||||||
CStatusMessageList CNetworkUtils::createNetworkReport(const QUrl &url, const QNetworkAccessManager *qam)
|
|
||||||
{
|
|
||||||
static const CLogCategoryList cats({ CLogCategories::network() });
|
|
||||||
CStatusMessageList msgs;
|
|
||||||
|
|
||||||
if (!url.isEmpty())
|
|
||||||
{
|
|
||||||
const QString host = url.host();
|
|
||||||
const bool canPing = Network::canPing(host);
|
|
||||||
const CStatusMessage ping(cats, canPing ? CStatusMessage::SeverityInfo : CStatusMessage::SeverityError, "Host: " + host + " ping: " + boolToYesNo(canPing));
|
|
||||||
msgs.push_back(ping);
|
|
||||||
|
|
||||||
QString msg;
|
|
||||||
const bool canConnect = CNetworkUtils::canConnect(url, msg, getTimeoutMs() * 2);
|
|
||||||
if (canConnect)
|
|
||||||
{
|
|
||||||
msgs.push_back(CStatusMessage(cats, CStatusMessage::SeverityInfo, u"Can connect to " % url.toString()));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
msgs.push_back(CStatusMessage(cats, CStatusMessage::SeverityError, u"Cannot connect to " % url.toString() % u" msg: " % msg));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (qam)
|
|
||||||
{
|
|
||||||
const QString msg = CNetworkUtils::createNetworkAccessManagerReport(qam);
|
|
||||||
const bool accessible = qam->networkAccessible() == QNetworkAccessManager::Accessible;
|
|
||||||
msgs.push_back(CStatusMessage(cats, accessible ? CStatusMessage::SeverityInfo : CStatusMessage::SeverityError, msg));
|
|
||||||
}
|
|
||||||
|
|
||||||
return msgs;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString CNetworkUtils::createNetworkAccessManagerReport(const QNetworkAccessManager *qam)
|
|
||||||
{
|
|
||||||
static const QMetaEnum enumAccessible = QMetaEnum::fromType<QNetworkAccessManager::NetworkAccessibility>();
|
|
||||||
static const QString info("Accessible: '%1' (%2) config: %3");
|
|
||||||
|
|
||||||
const bool accessible = qam->networkAccessible() == QNetworkAccessManager::Accessible;
|
|
||||||
return info.arg(boolToYesNo(accessible), enumAccessible.valueToKey(qam->networkAccessible()), CNetworkUtils::networkConfigurationToString(qam->configuration()));
|
|
||||||
}
|
|
||||||
|
|
||||||
QString CNetworkUtils::networkConfigurationToString(const QNetworkConfiguration &configuration)
|
|
||||||
{
|
|
||||||
static const QString s("'%1' '%2' valid: '%3' '%4' '%5'");
|
|
||||||
const QString stateFlagsStr = networkStatesToString(configuration.state());
|
|
||||||
return s.arg(configuration.name(), configuration.identifier(), boolToYesNo(configuration.isValid()), stateFlagsStr, networkTypeToString(configuration.type()));
|
|
||||||
}
|
|
||||||
|
|
||||||
const QString &CNetworkUtils::networkTypeToString(QNetworkConfiguration::Type type)
|
|
||||||
{
|
|
||||||
static const QString iap("InternetAccessPoint");
|
|
||||||
static const QString sn("ServiceNetwork");
|
|
||||||
static const QString i("Invalid");
|
|
||||||
static const QString uc("UserChoice");
|
|
||||||
|
|
||||||
switch (type)
|
|
||||||
{
|
|
||||||
case QNetworkConfiguration::InternetAccessPoint: return iap;
|
|
||||||
case QNetworkConfiguration::ServiceNetwork: return sn;
|
|
||||||
case QNetworkConfiguration::UserChoice: return uc;
|
|
||||||
default:
|
|
||||||
case QNetworkConfiguration::Invalid: break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
const QString &CNetworkUtils::networkStateToString(QNetworkConfiguration::StateFlag state)
|
|
||||||
{
|
|
||||||
static const QString disco("Discovered");
|
|
||||||
static const QString a("Active");
|
|
||||||
static const QString u("Undefined");
|
|
||||||
static const QString d("Defined");
|
|
||||||
|
|
||||||
switch (state)
|
|
||||||
{
|
|
||||||
case QNetworkConfiguration::Defined: return d;
|
|
||||||
case QNetworkConfiguration::Active: return a;
|
|
||||||
case QNetworkConfiguration::Discovered: return disco;
|
|
||||||
default:
|
|
||||||
case QNetworkConfiguration::Undefined: break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return u;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString CNetworkUtils::networkStatesToString(QNetworkConfiguration::StateFlags states)
|
|
||||||
{
|
|
||||||
QStringList statesSl;
|
|
||||||
if (states.testFlag(QNetworkConfiguration::Active)) { statesSl << networkStateToString(QNetworkConfiguration::Active); }
|
|
||||||
if (states.testFlag(QNetworkConfiguration::Discovered)) { statesSl << networkStateToString(QNetworkConfiguration::Discovered); }
|
|
||||||
if (states.testFlag(QNetworkConfiguration::Defined)) { statesSl << networkStateToString(QNetworkConfiguration::Defined); }
|
|
||||||
if (states.testFlag(QNetworkConfiguration::Undefined)) { statesSl << networkStateToString(QNetworkConfiguration::Undefined); }
|
|
||||||
return statesSl.join(", ");
|
|
||||||
}
|
|
||||||
|
|
||||||
const QString &CNetworkUtils::networkOperationToString(QNetworkAccessManager::Operation operation)
|
const QString &CNetworkUtils::networkOperationToString(QNetworkAccessManager::Operation operation)
|
||||||
{
|
{
|
||||||
static const QString h("HEAD");
|
static const QString h("HEAD");
|
||||||
|
|||||||
@@ -12,7 +12,6 @@
|
|||||||
|
|
||||||
#include <QNetworkRequest>
|
#include <QNetworkRequest>
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
#include <QNetworkConfiguration>
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
@@ -124,28 +123,6 @@ namespace BlackMisc::Network
|
|||||||
//! Looks like PHP error messages
|
//! Looks like PHP error messages
|
||||||
static bool looksLikePhpErrorMessage(const QString &errorMessage);
|
static bool looksLikePhpErrorMessage(const QString &errorMessage);
|
||||||
|
|
||||||
//! Status about network
|
|
||||||
static BlackMisc::CStatusMessageList createNetworkReport(const QNetworkAccessManager *am);
|
|
||||||
|
|
||||||
//! Status about network, can be used when an URL fails to resolve issues
|
|
||||||
//! \remark that can take a moment to complete, as it checks network
|
|
||||||
static BlackMisc::CStatusMessageList createNetworkReport(const QUrl &url, const QNetworkAccessManager *qam = nullptr);
|
|
||||||
|
|
||||||
//! Report for QAM
|
|
||||||
static QString createNetworkAccessManagerReport(const QNetworkAccessManager *qam);
|
|
||||||
|
|
||||||
//! Configuration as string
|
|
||||||
static QString networkConfigurationToString(const QNetworkConfiguration &configuration);
|
|
||||||
|
|
||||||
//! Type to string
|
|
||||||
static const QString &networkTypeToString(QNetworkConfiguration::Type type);
|
|
||||||
|
|
||||||
//! State to string
|
|
||||||
static const QString &networkStateToString(QNetworkConfiguration::StateFlag state);
|
|
||||||
|
|
||||||
//! States to string
|
|
||||||
static QString networkStatesToString(QNetworkConfiguration::StateFlags states);
|
|
||||||
|
|
||||||
//! Operation to string
|
//! Operation to string
|
||||||
static const QString &networkOperationToString(QNetworkAccessManager::Operation operation);
|
static const QString &networkOperationToString(QNetworkAccessManager::Operation operation);
|
||||||
|
|
||||||
|
|||||||
@@ -51,9 +51,14 @@ namespace BlackMisc::SharedState::DBus
|
|||||||
void CDuplex::requestPeerSubscriptions()
|
void CDuplex::requestPeerSubscriptions()
|
||||||
{
|
{
|
||||||
QSet<QString> channels;
|
QSet<QString> channels;
|
||||||
for (auto client : m_hub->clients())
|
for (const auto &client : m_hub->clients())
|
||||||
{
|
{
|
||||||
if (client != this) { channels.unite(client->m_subscriptions.keys().toSet()); }
|
if (client != this)
|
||||||
|
{
|
||||||
|
const auto &keys = client->m_subscriptions.keys();
|
||||||
|
const QSet subscriptions(keys.begin(), keys.end());
|
||||||
|
channels.unite(subscriptions);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (const auto &channel : channels)
|
for (const auto &channel : channels)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1389,7 +1389,7 @@ namespace BlackMisc::Simulation
|
|||||||
if (log) { log->push_back(subMsgs); }
|
if (log) { log->push_back(subMsgs); }
|
||||||
CCallsign::addLogDetailsToList(log, remoteModel.getCallsign(), QStringLiteral("--- End calculating #%1 ---").arg(c));
|
CCallsign::addLogDetailsToList(log, remoteModel.getCallsign(), QStringLiteral("--- End calculating #%1 ---").arg(c));
|
||||||
c++;
|
c++;
|
||||||
scoreMap.insertMulti(score, model);
|
scoreMap.insert(score, model);
|
||||||
}
|
}
|
||||||
CCallsign::addLogDetailsToList(log, remoteModel.getCallsign(), QStringLiteral("--- End scoring ---"));
|
CCallsign::addLogDetailsToList(log, remoteModel.getCallsign(), QStringLiteral("--- End scoring ---"));
|
||||||
return scoreMap;
|
return scoreMap;
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
#include <Qt>
|
#include <Qt>
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
|
#include <QMultiMap>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
|
||||||
BLACK_DECLARE_SEQUENCE_MIXINS(BlackMisc::Simulation, CAircraftModel, CAircraftModelList)
|
BLACK_DECLARE_SEQUENCE_MIXINS(BlackMisc::Simulation, CAircraftModel, CAircraftModelList)
|
||||||
@@ -46,7 +47,7 @@ namespace BlackMisc
|
|||||||
namespace Simulation
|
namespace Simulation
|
||||||
{
|
{
|
||||||
//! Individual (matching) score for each model
|
//! Individual (matching) score for each model
|
||||||
using ScoredModels = QMap<int, CAircraftModel>;
|
using ScoredModels = QMultiMap<int, CAircraftModel>;
|
||||||
|
|
||||||
//! Value object encapsulating a list of aircraft models
|
//! Value object encapsulating a list of aircraft models
|
||||||
class BLACKMISC_EXPORT CAircraftModelList :
|
class BLACKMISC_EXPORT CAircraftModelList :
|
||||||
|
|||||||
@@ -391,7 +391,7 @@ namespace BlackMisc::Simulation
|
|||||||
QMultiMap<int, CSimulatorInfo> counts;
|
QMultiMap<int, CSimulatorInfo> counts;
|
||||||
for (int i = 0; i < m_counts.size(); i++)
|
for (int i = 0; i < m_counts.size(); i++)
|
||||||
{
|
{
|
||||||
counts.insertMulti(m_counts[i], simulator(i));
|
counts.insert(m_counts[i], simulator(i));
|
||||||
}
|
}
|
||||||
return counts;
|
return counts;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
if ((latin >= 'a' && latin <= 'z') || (latin >= 'A' && latin <= 'Z') || (latin >= '0' && latin <= '9') || allow.contains(latin))
|
if ((latin >= 'a' && latin <= 'z') || (latin >= 'A' && latin <= 'Z') || (latin >= '0' && latin <= '9') || allow.contains(latin))
|
||||||
{
|
{
|
||||||
result += c;
|
result += c.toLatin1();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user