8000 refactor(ui): Remove update times from settings · swift-project/pilotclient@d8b0748 · GitHub
[go: up one dir, main page]

Skip to content

Commit d8b0748

Browse files
committed
refactor(ui): Remove update times from settings
This settings is not documented and likely not used by any user.
1 parent ced054e commit d8b0748

19 files changed

+11
-629
lines changed

src/gui/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -439,9 +439,6 @@ add_library(gui SHARED
439439
components/settingsvatsimreaderscomponent.cpp
440440
components/settingsvatsimreaderscomponent.h
441441
components/settingsvatsimreaderscomponent.ui
442-
components/settingsviewupdatetimes.cpp
443-
components/settingsviewupdatetimes.h
444-
components/settingsviewupdatetimes.ui
445442
components/settingsxswiftbuscomponent.cpp
446443
components/settingsxswiftbuscomponent.h
447444
components/settingsxswiftbuscomponent.ui
@@ -761,8 +758,6 @@ add_library(gui SHARED
761758
settings/textmessagesettings.cpp
762759
settings/textmessagesettings.h
763760
settings/updatenotification.h
764-
settings/viewupdatesettings.cpp
765-
settings/viewupdatesettings.h
766761
sharedstringlistcompleter.cpp
767762
sharedstringlistcompleter.h
768763
shortcut.cpp

src/gui/components/aircraftcomponent.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ namespace swift::gui::components
5858
&CAircraftComponent::onOwnAircraftMoved, Qt::QueuedConnection);
5959
connect(&m_updateTimer, &QTimer::timeout, this, &CAircraftComponent::update);
6060

61-
this->onSettingsChanged();
61+
using namespace std::chrono_literals;
62+
m_updateTimer.setInterval(10s);
63+
6264
m_updateTimer.start();
6365
}
6466

@@ -149,13 +151,6 @@ namespace swift::gui::components
149151
}
150152
}
151153

152-
void CAircraftComponent::onSettingsChanged()
153-
{
154-
const CViewUpdateSettings settings = m_settings.get();
155-
const int ms = settings.getAircraftUpdateTime().toMs();
156-
m_updateTimer.setInterval(ms);
157-
}
158-
159154
void CAircraftComponent::onOwnAircraftMoved(const CLength &distance)
160155
{
161156
Q_UNUSED(distance)

src/gui/components/aircraftcomponent.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include <QtGlobal>
1414

1515
#include "gui/enablefordockwidgetinfoarea.h"
16-
#include "gui/settings/viewupdatesettings.h"
1716
#include "gui/swiftguiexport.h"
1817
#include "misc/network/connectionstatus.h"
1918

@@ -88,16 +87,10 @@ namespace swift::gui
8887
void onConnectionStatusChanged(const swift::misc::network::CConnectionStatus &from,
8988
const swift::misc::network::CConnectionStatus &to);
9089

91-
//! Settings have been changed
92-
void onSettingsChanged();
93-
9490
//! Own aircraft has been moved
9591
void onOwnAircraftMoved(const swift::misc::physical_quantities::CLength &distance);
9692

9793
QScopedPointer<Ui::CAircraftComponent> ui;
98-
swift::misc::CSettingReadOnly<swift::gui::settings::TViewUpdateSettings> m_settings {
99-
this, &CAircraftComponent::onSettingsChanged
100-
}; //!< settings changed
10194
QTimer m_updateTimer;
10295
int m_updateCounter = 0;
10396
};

src/gui/components/atcstationcomponent.cpp

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ namespace swift::gui::components
152152
this->airportsRead();
153153
}
154154

155-
// init settings
156-
this->settingsChanged();
155 8000 +
using namespace std::chrono_literals;
156+
m_updateTimer.setInterval(10ms);
157157
}
158158

159159
CAtcStationComponent::~CAtcStationComponent() {}
@@ -329,22 +329,6 @@ namespace swift::gui::components
329329
sGui->getIContextOwnAircraft()->updateActiveComFrequency(frequency, unit, identifier());
330330
}
331331

332-
void CAtcStationComponent::settingsChanged()
333-
{
334-
if (!this->canAccessContext()) { return; }
335-
const CViewUpdateSettings settings = m_settingsView.get();
336-
const int ms = settings.getAtcUpdateTime().toMs();
337-
const bool connected = sGui->getIContextNetwork()->isConnected();
338-
m_updateTimer.setInterval(ms);
339-
if (connected)
340-
{
341-
m_timestampOnlineStationsChanged = QDateTime::currentDateTimeUtc();
342-
m_updateTimer.start(ms); // restart
343-
this->update();
344-
}
345-
else { m_updateTimer.stop(); }
346-
}
347-
348332
void CAtcStationComponent::airportsRead() { this->initCompleters(); }
349333

350334
void CAtcStationComponent::updateTreeView()

src/gui/components/atcstationcomponent.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include <QtGlobal>
2020

2121
#include "gui/overlaymessagesframe.h"
22-
#include "gui/settings/viewupdatesettings.h"
2322
#include "gui/swiftguiexport.h"
2423
#include "misc/aviation/atcstation.h"
2524
#include "misc/aviation/comsystem.h"
@@ -130,9 +129,6 @@ namespace swift::gui
130129
//! Init the completers
131130
void initCompleters();
132131

133-
//! Settings have been changed
134-
void settingsChanged();
135-
136132
//! Contexts?
137133
bool canAccessContext() const;
138134

@@ -154,9 +150,6 @@ namespace swift::gui
154150
swift::misc::aviation::CCallsign m_selectedCallsign;
155151
QDateTime m_timestampLastReadOnlineStations; //!< stations read
156152
QDateTime m_timestampOnlineStationsChanged; //!< stations marked as changed
157-
swift::misc::CSettingReadOnly<swift::gui::settings::TViewUpdateSettings> m_settingsView {
158-
this, &CAtcStationComponent::settingsChanged
159-
};
160153
};
161154
} // namespace components
162155
} // namespace swift::gui

src/gui/components/copysettingsandcachescomponent.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ namespace swift::gui::components
7171
!CCacheSettingsUtils::hasOtherVersionSettingsFile(info, m_settingsGuiGeneral.getFilename()));
7272
readOnlyCheckbox(ui->cb_SettingsDockWidget,
7373
!CCacheSettingsUtils::hasOtherVersionSettingsFile(info, m_settingsDockWidget.getFilename()));
74-
readOnlyCheckbox(ui->cb_SettingsViewUpdate,
75-
!CCacheSettingsUtils::hasOtherVersionSettingsFile(info, m_settingsViewUpdate.getFilename()));
7674

7775
readOnlyCheckbox(ui->cb_SettingsEnabledSimulators, !CCacheSettingsUtils::hasOtherVersionSettingsFile(
7876
info, m_settingsEnabledSimulators.getFilename()));
@@ -124,7 +122,6 @@ namespace swift::gui::components
124122
{
125123
ui->cb_SettingsGuiGeneral->setText(checkBoxText(TGeneralGui::humanReadable(), true));
126124
ui->cb_SettingsDockWidget->setText(checkBoxText(TDockWidget::humanReadable(), true));
127-
ui->cb_SettingsViewUpdate->setText(checkBoxText(TViewUpdateSettings::humanReadable(), true));
128125
}
129126

130127
void CCopySettingsAndCachesComponent::initSimulator()
@@ -294,19 +291,6 @@ namespace swift::gui::components
294291
}
295292
}
296293

297-
if (ui->cb_SettingsViewUpdate->isChecked())
298-
{
299-
const QString joStr = CCacheSettingsUtils::otherVersionSettingsFileContent(
300-
otherVersionInfo, m_settingsViewUpdate.getFilename());
301-
if (!joStr.isEmpty())
302-
{
303-
const CViewUpdateSettings viewUpdate =
304-
CViewUpdateSettings::fromJsonNoThrow(joStr, true, success, errMsg);
305-
this->displayStatusMessage(m_settingsViewUpdate.setAndSave(viewUpdate), viewUpdate.toQString(true));
306-
copied++;
307-
}
308-
}
309-
310294
// ------- sims -------
311295
if (ui->cb_SettingsEnabledSimulators->isChecked())
312296
{

src/gui/components/copysettingsandcachescomponent.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include "gui/settings/dockwidgetsettings.h"
2121
#include "gui/settings/guisettings.h"
2222
#include "gui/settings/textmessagesettings.h"
23-
#include "gui/settings/viewupdatesettings.h"
2423
#include "gui/swiftguiexport.h"
2524
#include "misc/applicationinfo.h"
2625
#include "misc/audio/audiosettings.h"
@@ -113,7 +112,6 @@ namespace swift::gui::components
113112
swift::misc::CSetting<swift::core::audio::TOutputDevice> m_settingsAudioOutputDevice { this };
114113
swift::misc::CSetting<settings::TGeneralGui> m_settingsGuiGeneral { this };
115114
swift::misc::CSetting<settings::TDockWidget> m_settingsDockWidget { this };
116-
swift::misc::CSetting<settings::TViewUpdateSettings> m_settingsViewUpdate { this };
117115
swift::misc::CSetting<settings::TBackgroundConsolidation> m_settingsConsolidation {
118116
this
119117
}; //!< consolidation time

src/gui/components/copysettingsandcachescomponent.ui

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -300,13 +300,6 @@
300300
</property>
301301
</widget>
302302
</item>
303-
<item>
304-
<widget class="QCheckBox" name="cb_SettingsViewUpdate">
305-
<property name="text">
306-
<string>UI3</string>
307-
</property>
308-
</widget>
309-
</item>
310303
</layout>
311304
</widget>
312305
</item>

src/gui/components/mappingcomponent.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,9 @@ namespace swift::gui::components
124124
connect(&m_updateTimer, &QTimer::timeout, this, &CMappingComponent::timerUpdate);
125125
m_updateTimer.setObjectName(this->objectName() + "::updateTimer");
126126
ui->tvp_AircraftModels->setDisplayAutomatically(false);
127-
this->settingsChanged();
127+
128+
using namespace std::chrono_literals;
129+
m_updateTimer.setInterval(10s);
128130

129131
// selector
130132
ui->comp_SimulatorSelector->setRememberSelection(false); // pilot client UI
@@ -563,13 +565,6 @@ namespace swift::gui::components
563565
this->updateRenderedAircraftView(true); // forced update
564566
}
565567

566-
void CMappingComponent::settingsChanged()
567-
{
568-
const CViewUpdateSettings settings = m_settings.get();
569-
const int ms = settings.getRenderingUpdateTime().toMs();
570-
m_updateTimer.setInterval(ms);
571-
}
572-
573568
void CMappingComponent::onNetworkConnectionStatusChanged(const CConnectionStatus &from, const CConnectionStatus &to)
574569
{
575570
Q_UNUSED(from);

src/gui/components/mappingcomponent.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
#include "gui/enablefordockwidgetinfoarea.h"
1717
#include "gui/overlaymessagesframe.h"
18-
#include "gui/settings/viewupdatesettings.h"
1918
#include "gui/swiftguiexport.h"
2019
#include "misc/identifiable.h"
2120
#include "misc/identifier.h"
@@ -161,9 +160,6 @@ namespace swift::gui
161160
//! Token bucket based update
162161
void tokenBucketUpdateAircraft(const swift::misc::simulation::CSimulatedAircraft &aircraft);
163162

164-
//! Settings have been changed
165-
void settingsChanged();
166-
167163
//! Connection status has been changed
168164
void onNetworkConnectionStatusChanged(const swift::misc::network::CConnectionStatus &from,
169165
const swift::misc::network::CConnectionStatus &to);
@@ -191,9 +187,6 @@ namespace swift::gui
191187
QTimer m_updateTimer;
192188
bool m_missedRenderedAircraftUpdate = true; //! Rendered aircraft need update
193189
swift::misc::CTokenBucket m_bucket { 3, 5000, 1 };
194-
swift::misc::CSettingReadOnly<settings::TViewUpdateSettings> m_settings {
195-
this, &CMappingComponent::settingsChanged
196-
}; //!< settings changed
197190
views::CCheckBoxDelegate *m_currentMappingsViewDelegate = nullptr; //! checkbox in view
198191
};
199192
} // namespace components

0 commit comments

Comments
 (0)
0