mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 06:45:37 +08:00
[skip ci] refactor: Disable autopublish in swiftgui
This commit is contained in:
@@ -144,9 +144,6 @@ namespace swift::core::context
|
||||
const swift::misc::simulation::CAircraftModelList &invalid, bool stopped,
|
||||
const swift::misc::CStatusMessageList &msgs);
|
||||
|
||||
//! Auto publish data written for simulator
|
||||
void autoPublishDataWritten(const swift::misc::simulation::CSimulatorInfo &simulator);
|
||||
|
||||
public slots:
|
||||
//! Simulator info, currently loaded plugin
|
||||
virtual swift::misc::simulation::CSimulatorPluginInfo getSimulatorPluginInfo() const = 0;
|
||||
|
||||
@@ -539,8 +539,6 @@ namespace swift::core::context
|
||||
Q_ASSERT(c);
|
||||
c = connect(simulator, &ISimulator::driverMessages, this, &IContextSimulator::driverMessages);
|
||||
Q_ASSERT(c);
|
||||
c = connect(simulator, &ISimulator::autoPublishDataWritten, this, &IContextSimulator::autoPublishDataWritten);
|
||||
Q_ASSERT(c);
|
||||
|
||||
// disconnect for X-Plane FPS below 20
|
||||
c = connect(simulator, &ISimulator::insufficientFrameRateDetected, this, [this](bool fatal) {
|
||||
|
||||
@@ -822,17 +822,6 @@ namespace swift::core
|
||||
{
|
||||
this->insertCG(cgOvr, modelString, callsign); // per model string and CG
|
||||
}
|
||||
|
||||
// here we know we have a valid model and CG did change
|
||||
const CSimulatorInfo sim = this->getSimulatorInfo();
|
||||
m_autoPublishing.insert(modelString,
|
||||
simulatorCG); // still using simulator CG here, not the overridden value
|
||||
|
||||
// if simulator did change, add as well
|
||||
if (!model.getSimulator().matchesAll(sim))
|
||||
{
|
||||
m_autoPublishing.insert(modelString, this->getSimulatorInfo());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -984,9 +973,6 @@ namespace swift::core
|
||||
void ISimulator::unload()
|
||||
{
|
||||
this->disconnectFrom(); // disconnect from simulator
|
||||
const bool saved = m_autoPublishing.writeJsonToFile(); // empty data are ignored
|
||||
if (saved) { emit this->autoPublishDataWritten(this->getSimulatorInfo()); }
|
||||
m_autoPublishing.clear();
|
||||
m_remoteAircraftProviderConnections.disconnectAll(); // disconnect signals from provider
|
||||
}
|
||||
|
||||
|
||||
@@ -302,9 +302,6 @@ namespace swift::core
|
||||
virtual swift::misc::CStatusMessageList
|
||||
getInterpolationMessages(const swift::misc::aviation::CCallsign &callsign) const = 0;
|
||||
|
||||
//! Get the data for auto publishing
|
||||
const swift::misc::simulation::CAutoPublishData &getPublishData() const { return m_autoPublishing; }
|
||||
|
||||
//! Counter added aircraft
|
||||
int getStatisticsPhysicallyAddedAircraft() const { return m_statsPhysicallyAddedAircraft; }
|
||||
|
||||
@@ -400,9 +397,6 @@ namespace swift::core
|
||||
void receivedRequestedElevation(const swift::misc::geo::CElevationPlane &plane,
|
||||
const swift::misc::aviation::CCallsign &callsign);
|
||||
|
||||
//! Auto publish data written for simulator
|
||||
void autoPublishDataWritten(const swift::misc::simulation::CSimulatorInfo &simulator);
|
||||
|
||||
//! Frame rate has fallen too far below the threshold to maintain consistent sim rate
|
||||
void insufficientFrameRateDetected(bool fatal);
|
||||
|
||||
@@ -600,7 +594,6 @@ namespace swift::core
|
||||
}; //!< pseudo elevation for testing purposes
|
||||
swift::misc::simulation::CSimulatorInternals m_simulatorInternals; //!< setup read from the sim
|
||||
swift::misc::simulation::CInterpolationLogger m_interpolationLogger; //!< log.interpolation
|
||||
swift::misc::simulation::CAutoPublishData m_autoPublishing; //!< for the DB
|
||||
swift::misc::aviation::CAircraftSituationPerCallsign
|
||||
m_lastSentSituations; //!< last situations sent to simulator
|
||||
swift::misc::aviation::CAircraftPartsPerCallsign m_lastSentParts; //!< last parts sent to simulator
|
||||
|
||||
@@ -159,12 +159,6 @@ void SwiftGuiStd::closeEvent(QCloseEvent *event)
|
||||
return;
|
||||
}
|
||||
|
||||
if (this->triggerAutoPublishDialog())
|
||||
{
|
||||
event->ignore();
|
||||
return;
|
||||
}
|
||||
|
||||
// save settings
|
||||
if (sGui->showCloseDialog(this, event) == QDialog::Rejected)
|
||||
{
|
||||
@@ -563,30 +557,6 @@ void SwiftGuiStd::onShowOverlayInlineTextMessageCallsign(const CCallsign &callsi
|
||||
ui->fr_CentralFrameInside->showOverlayInlineTextMessage(callsign);
|
||||
}
|
||||
|
||||
bool SwiftGuiStd::triggerAutoPublishDialog()
|
||||
{
|
||||
if (!CAutoPublishData::existAutoPublishFiles()) { return false; }
|
||||
|
||||
constexpr qint64 deltaT = 48 * 60 * 60 * 1000;
|
||||
const qint64 lastDialogTs = m_lastAutoPublish.get();
|
||||
bool showAutoPublish = lastDialogTs < 0 || (QDateTime::currentMSecsSinceEpoch() - lastDialogTs) > deltaT;
|
||||
if (!showAutoPublish) { return false; }
|
||||
|
||||
const QMessageBox::StandardButton reply =
|
||||
QMessageBox::question(this, QStringLiteral("Upload data?"),
|
||||
QStringLiteral("Do you want to help improving swift by uploading anonymized data?"),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
|
||||
if (reply != QMessageBox::Yes)
|
||||
{
|
||||
m_lastAutoPublish.set(QDateTime::currentMSecsSinceEpoch());
|
||||
return false;
|
||||
}
|
||||
|
||||
this->autoPublishDialog(); // updates m_lastAutoPublish
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SwiftGuiStd::startModelBrowser()
|
||||
{
|
||||
if (!m_modelBrower) { m_modelBrower.reset(new CModelBrowserDialog(this)); }
|
||||
|
||||
@@ -317,12 +317,6 @@ private:
|
||||
//! Copy the xswiftbus files from build directory
|
||||
void copyXSwiftBusDialog(bool checkFileTimestamp);
|
||||
|
||||
//! Auto publish diloag
|
||||
int autoPublishDialog();
|
||||
|
||||
//! Show auto publish dialog if appropriate
|
||||
bool triggerAutoPublishDialog();
|
||||
|
||||
//! Start the model browser
|
||||
bool startModelBrowser();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user