Skip to content

Commit 568a91f

Browse files
committed
Fix: Wrapped text / RealTraffic status / Readme
1 parent d63ba6e commit 568a91f

File tree

6 files changed

+101
-65
lines changed

6 files changed

+101
-65
lines changed

Include/LTRealTraffic.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,6 @@ class RealTrafficConnection : public LTFlightDataChannel
247247
RT_LIC_STANDARD = 1, ///< Standard RealTraffic license
248248
RT_LIC_PROFESSIONAL = 2, ///< Professional RT license, allowing for historical data
249249
} eLicType = RT_LIC_UNKNOWN;
250-
/// QNH to use for altitude correction (will be historic QNH in case of historic data)
251250
/// Data for the current request
252251
struct CurrTy {
253252
/// Which kind of call do we need next?
@@ -273,6 +272,8 @@ class RealTrafficConnection : public LTFlightDataChannel
273272

274273
WxTy& operator = (const CurrTy& o); ///< fill from `current` data
275274
} rtWx; ///< Data with which latest weather was requested
275+
/// How many flights does RealTraffic have in total?
276+
long lTotalFlights = -1;
276277

277278
// TCP connection to send current position
278279
std::thread thrTcpServer; ///< thread of the TCP listening thread (short-lived)

LiveTraffic.xcodeproj/project.xcworkspace/xcuserdata/birger.xcuserdatad/xcdebugger/Expressions.xcexplist

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,13 @@
7676
contextName = "Apt::FindEdgesForHeading(double, double, std::__1::vector&lt;unsigned long, std::__1::allocator&lt;unsigned long&gt; &gt;&amp;, TaxiEdge::edgeTy) const:LTApt.cpp">
7777
<PersistentStrings>
7878
<PersistentString
79-
value = "vecTaxiEdgesIdxHead[3321]">
79+
value = "vecTaxiEdges[222]">
8080
</PersistentString>
8181
<PersistentString
82-
value = "lst[1385]">
82+
value = "vecTaxiEdgesIdxHead[3321]">
8383
</PersistentString>
8484
<PersistentString
85-
value = "vecTaxiEdges[222]">
85+
value = "lst[1385]">
8686
</PersistentString>
8787
</PersistentStrings>
8888
</ContextState>
@@ -129,10 +129,10 @@
129129
contextName = "LTFlightData::AddDynData(LTFlightData::FDDynamicData const&amp;, int, int, positionTy*):LTFlightData.cpp">
130130
<PersistentStrings>
131131
<PersistentString
132-
value = "dynDataDeque">
132+
value = "posDeque">
133133
</PersistentString>
134134
<PersistentString
135-
value = "posDeque">
135+
value = "dynDataDeque">
136136
</PersistentString>
137137
<PersistentString
138138
value = "currCycle">
@@ -268,10 +268,10 @@
268268
value = "cull">
269269
</PersistentString>
270270
<PersistentString
271-
value = "tcas">
271+
value = "iter-&gt;second">
272272
</PersistentString>
273273
<PersistentString
274-
value = "iter-&gt;second">
274+
value = "tcas">
275275
</PersistentString>
276276
</PersistentStrings>
277277
</ContextState>
@@ -363,7 +363,7 @@
363363
</PersistentStrings>
364364
</ContextState>
365365
<ContextState
366-
contextName = "LTFlightData::FDStaticData::operator|=(LTFlightData::FDStaticData const&amp;):LTFlightData.cpp">
366+
contextName = "SyntheticConnection::ProcessFetchedData():LTSynthetic.cpp">
367367
</ContextState>
368368
<ContextState
369369
contextName = "OpenSkyAcMasterdata::ProcessFetchedData(std::__1::map&lt;LTFlightData::FDKeyTy, LTFlightData, std::__1::less&lt;LTFlightData::FDKeyTy&gt;, std::__1::allocator&lt;std::__1::pair&lt;LTFlightData::FDKeyTy const, LTFlightData&gt; &gt; &gt;&amp;):LTOpenSky.cpp">
@@ -377,7 +377,7 @@
377377
contextName = "LTFlightData::AppendNewPos():LTFlightData.cpp">
378378
</ContextState>
379379
<ContextState
380-
contextName = "SyntheticConnection::ProcessFetchedData():LTSynthetic.cpp">
380+
contextName = "LTFlightData::FDStaticData::operator|=(LTFlightData::FDStaticData const&amp;):LTFlightData.cpp">
381381
</ContextState>
382382
<ContextState
383383
contextName = "DataRefs::GetLocalDateDays():DataRefs.h">
@@ -411,6 +411,9 @@
411411
<ContextState
412412
contextName = "LTACMasterdataChannel::ClearMasterDataRequests()::$_0::operator()(acStatUpdateTy&amp;) const:LTChannel.cpp">
413413
</ContextState>
414+
<ContextState
415+
contextName = "XPMP2::AIUpdateTCASTargets():AIMultiplayer.cpp">
416+
</ContextState>
414417
<ContextState
415418
contextName = "OpenSkyAcMasterdata::FetchAllData(positionTy const&amp;):LTOpenSky.cpp">
416419
<PersistentStrings>
@@ -473,7 +476,7 @@
473476
contextName = "LTAircraft::CalcPPos():LTAircraft.cpp">
474477
<PersistentStrings>
475478
<PersistentString
476-
value = "turn">
479+
value = "from">
477480
</PersistentString>
478481
<PersistentString
479482
value = "to">
@@ -485,7 +488,7 @@
485488
value = "ppos">
486489
</PersistentString>
487490
<PersistentString
488-
value = "from">
491+
value = "turn">
489492
</PersistentString>
490493
</PersistentStrings>
491494
</ContextState>
@@ -583,10 +586,10 @@
583586
value = "mapFd">
584587
</PersistentString>
585588
<PersistentString
586-
value = "dataRefs">
589+
value = "sizeof(bool)">
587590
</PersistentString>
588591
<PersistentString
589-
value = "sizeof(bool)">
592+
value = "dataRefs">
590593
</PersistentString>
591594
<PersistentString
592595
value = "(int*)p">
@@ -810,9 +813,6 @@
810813
</PersistentString>
811814
</PersistentStrings>
812815
</ContextState>
813-
<ContextState
814-
contextName = "CreateMsgWindow(float, logLevelTy, char const*, ...):TextIO.cpp">
815-
</ContextState>
816816
<ContextState
817817
contextName = "XPMP2::SocketNetworking::Connect(std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; const&amp;, int, unsigned long, unsigned int):Network.cpp">
818818
<PersistentStrings>
@@ -821,6 +821,9 @@
821821
</PersistentString>
822822
</PersistentStrings>
823823
</ContextState>
824+
<ContextState
825+
contextName = "CreateMsgWindow(float, logLevelTy, char const*, ...):TextIO.cpp">
826+
</ContextState>
824827
<ContextState
825828
contextName = "XPMPRenderMultiplayerPlanes(int, int, void*):XPMPMultiplayer.cpp">
826829
<PersistentStrings>
@@ -1165,10 +1168,10 @@
11651168
value = "_startTime">
11661169
</PersistentString>
11671170
<PersistentString
1168-
value = "_deltaDist">
1171+
value = "_targetTime">
11691172
</PersistentString>
11701173
<PersistentString
1171-
value = "_targetTime">
1174+
value = "_deltaDist">
11721175
</PersistentString>
11731176
</PersistentStrings>
11741177
</ContextState>

Src/InfoListWnd.cpp

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -187,18 +187,18 @@ void InfoListWnd::buildInterface()
187187
ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable |
188188
ImGuiTableFlags_Hideable |
189189
ImGuiTableFlags_RowBg |
190-
ImGuiTableFlags_SizingPolicyFixedX | ImGuiTableFlags_Scroll |
190+
ImGuiTableFlags_ScrollY |
191191
ImGuiTableFlags_ScrollFreezeTopRow |
192192
ImGuiTableFlags_ScrollFreezeLeftColumn))
193193
{
194194
// Set up columns
195-
ImGui::TableSetupColumn("Time", ImGuiTableColumnFlags_NoHeaderWidth, 70);
196-
ImGui::TableSetupColumn("Network Time", ImGuiTableColumnFlags_NoHeaderWidth, 85);
197-
ImGui::TableSetupColumn("Level", ImGuiTableColumnFlags_NoHeaderWidth, 70);
198-
ImGui::TableSetupColumn("File", ImGuiTableColumnFlags_DefaultHide | ImGuiTableColumnFlags_NoHeaderWidth, 120);
199-
ImGui::TableSetupColumn("Line", ImGuiTableColumnFlags_DefaultHide | ImGuiTableColumnFlags_NoHeaderWidth, 50);
200-
ImGui::TableSetupColumn("Function", ImGuiTableColumnFlags_DefaultHide | ImGuiTableColumnFlags_NoHeaderWidth, 120);
201-
ImGui::TableSetupColumn("Message", ImGuiTableColumnFlags_NoHeaderWidth, 650);
195+
ImGui::TableSetupColumn("Time", ImGuiTableColumnFlags_WidthFixed | ImGuiTableColumnFlags_NoHeaderWidth, 70);
196+
ImGui::TableSetupColumn("Network Time", ImGuiTableColumnFlags_WidthFixed | ImGuiTableColumnFlags_NoHeaderWidth, 85);
197+
ImGui::TableSetupColumn("Level", ImGuiTableColumnFlags_WidthFixed | ImGuiTableColumnFlags_NoHeaderWidth, 70);
198+
ImGui::TableSetupColumn("File", ImGuiTableColumnFlags_WidthFixed | ImGuiTableColumnFlags_DefaultHide | ImGuiTableColumnFlags_NoHeaderWidth, 120);
199+
ImGui::TableSetupColumn("Line", ImGuiTableColumnFlags_WidthFixed | ImGuiTableColumnFlags_DefaultHide | ImGuiTableColumnFlags_NoHeaderWidth, 50);
200+
ImGui::TableSetupColumn("Function", ImGuiTableColumnFlags_WidthFixed | ImGuiTableColumnFlags_DefaultHide | ImGuiTableColumnFlags_NoHeaderWidth, 120);
201+
ImGui::TableSetupColumn("Message", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_NoHeaderWidth, 650);
202202
ImGui::TableAutoHeaders();
203203

204204
// Set up / update list of messages to show
@@ -322,7 +322,10 @@ void InfoListWnd::buildInterface()
322322
if (ImGui::TreeNodeEx("Aircraft / Channel Status", ImGuiTreeNodeFlags_DefaultOpen)) {
323323

324324
if (ImGui::BeginTable("StatusInfo", 2, ImGuiTableFlags_SizingPolicyFixedX)) {
325-
325+
326+
ImGui::TableSetupColumn("Label", ImGuiTableColumnFlags_WidthFixed);
327+
ImGui::TableSetupColumn("Info", ImGuiTableColumnFlags_WidthStretch);
328+
326329
// Are we active at all?
327330
if (dataRefs.AreAircraftDisplayed()) {
328331
// Number of aircraft seen/shown
@@ -372,10 +375,12 @@ void InfoListWnd::buildInterface()
372375
ImGui::TableNextRow();
373376
if (ImGui::TableSetColumnIndex(0)) ImGui::TextUnformatted("Live Weather");
374377
if (ImGui::TableSetColumnIndex(1)) {
378+
ImGui::PushTextWrapPos();
375379
ImGui::Text(weatherStationId.empty() ? "QNH %.f hPa" : "QNH %.f hPa at %s",
376380
weatherHPA, weatherStationId.c_str());
377381
if (!weatherMETAR.empty())
378382
ImGui::TextUnformatted(weatherMETAR.c_str());
383+
ImGui::PopTextWrapPos();
379384
}
380385

381386
// Refresh Period
@@ -396,19 +401,23 @@ void InfoListWnd::buildInterface()
396401
{
397402
ImGui::TableNextRow();
398403
if (ImGui::TableSetColumnIndex(1)) {
404+
ImGui::PushTextWrapPos();
399405
ImGui::TextUnformatted(ICON_FA_EXCLAMATION_TRIANGLE " " ERR_CH_INACTIVE1 " ");
400-
ImGui::SameLine();
401406
if (ImGui::ButtonTooltip(ICON_FA_UNDO " Restart Stopped Channels", "Restarts all channels that got temporarily inactivated"))
402407
LTFlightDataRestartInvalidChs();
408+
ImGui::PopTextWrapPos();
403409
}
404410
}
405411

406412
// No tracking data channel enabled?
407413
if (!LTFlightDataAnyTrackingChEnabled())
408414
{
409415
ImGui::TableNextRow();
410-
if (ImGui::TableSetColumnIndex(1))
416+
if (ImGui::TableSetColumnIndex(1)) {
417+
ImGui::PushTextWrapPos();
411418
ImGui::TextUnformatted(ICON_FA_EXCLAMATION_TRIANGLE " " ERR_CH_NONE_ACTIVE);
419+
ImGui::PopTextWrapPos();
420+
}
412421
}
413422

414423
// Individual channels' status
@@ -423,8 +432,11 @@ void InfoListWnd::buildInterface()
423432
ImGui::TextUnformatted(pCh->ChName());
424433
}
425434
// Channel's status
426-
if (ImGui::TableSetColumnIndex(1))
435+
if (ImGui::TableSetColumnIndex(1)) {
436+
ImGui::PushTextWrapPos();
427437
ImGui::TextUnformatted(pCh->GetStatusText().c_str());
438+
ImGui::PopTextWrapPos();
439+
}
428440
ImGui::PopID();
429441
}
430442
}
@@ -495,17 +507,20 @@ void InfoListWnd::buildInterface()
495507

496508
// Credits
497509
if (ImGui::TreeNode("Credits")) {
510+
ImGui::PushTextWrapPos();
498511
ImGui::TextUnformatted(LIVE_TRAFFIC " is based on a number of other great libraries and APIs, most notably:");
499512
for (const CreditTy& c: CREDITS)
500513
{
501514
ImGui::ButtonURL(c.txtLink, c.url, nullptr, true); ImGui::SameLine();
502515
ImGui::TextUnformatted(c.txtAdd);
503516
}
517+
ImGui::PopTextWrapPos();
504518
ImGui::TreePop();
505519
}
506520

507521
// Thanks
508522
if (ImGui::TreeNode("Thanks")) {
523+
ImGui::PushTextWrapPos();
509524
ImGui::TextUnformatted("172MC, Dozo, and Sir.Anri for continued Beta testing.");
510525
ImGui::Spacing();
511526

@@ -529,6 +544,7 @@ void InfoListWnd::buildInterface()
529544
ImGui::ButtonURL("FontAwesome", "https://fontawesome.com/icons?d=gallery&s=solid&m=free", nullptr, true); ImGui::SameLine();
530545
ImGui::TextUnformatted("for the icon font fa-solid-900.ttf " ICON_FA_PLANE);
531546

547+
ImGui::PopTextWrapPos();
532548
ImGui::TreePop();
533549
}
534550

Src/LTRealTraffic.cpp

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,17 @@ std::string RealTrafficConnection::GetStatusText () const
9090

9191
// --- Direct Connection? ---
9292
if (eConnType == RT_CONN_REQU_REPL) {
93-
if (tsAdjust > 1.0) {
94-
std::string s = LTChannel::GetStatusText();
93+
std::string s = LTChannel::GetStatusText();
94+
if (tsAdjust > 1.0) { // historic data?
9595
snprintf(sIntvl, sizeof(sIntvl), MSG_RT_ADJUST,
9696
GetAdjustTSText().c_str());
9797
s += sIntvl;
98-
return s;
9998
}
100-
return LTChannel::GetStatusText();
99+
if (lTotalFlights == 0) { // RealTraffic has no data at all???
100+
s += " | RealTraffic has no traffic at all! ";
101+
s += (curr.tOff > 0 ? "Maybe requested historic data too far in the past?" : "(full_count=0)");
102+
}
103+
return s;
101104
}
102105

103106
// --- UDP/TCP connection ---
@@ -179,6 +182,7 @@ void RealTrafficConnection::MainDirect ()
179182
curr.sGUID.clear();
180183
rtWx.QNH = NAN;
181184
rtWx.nErr = 0;
185+
lTotalFlights = -1;
182186

183187
while ( shallRun() ) {
184188
// LiveTraffic Top Level Exception Handling
@@ -480,14 +484,14 @@ bool RealTrafficConnection::ProcessFetchedData ()
480484

481485
// If RealTraffic returns `full_count = 0` then something's wrong...
482486
// like data requested too far in the past
483-
l = jog_l(pObj, "full_count");
484-
if (l == 0) {
485-
static std::chrono::steady_clock::time_point lastWarn;
487+
lTotalFlights = jog_l(pObj, "full_count");
488+
if (lTotalFlights == 0) {
489+
static std::chrono::steady_clock::time_point prevWarn;
486490
const auto now = std::chrono::steady_clock::now();
487-
if (now - lastWarn > std::chrono::minutes(5)) {
491+
if (now - prevWarn > std::chrono::minutes(5)) {
488492
SHOW_MSG(logWARN, "RealTraffic has no traffic at all! %s",
489493
curr.tOff > 0 ? "Maybe requested historic data too far in the past?" : "(full_count=0)");
490-
lastWarn = now;
494+
prevWarn = now;
491495
}
492496
}
493497

@@ -666,6 +670,7 @@ void RealTrafficConnection::MainUDP ()
666670
// This is a communication thread's main function, set thread's name and C locale
667671
ThreadSettings TS ("LT_RT_App", LC_ALL_MASK);
668672
eConnType = RT_CONN_APP;
673+
lTotalFlights = -1;
669674

670675
// Top-level exception handling
671676
try {

Src/SettingsUI.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ void LTSettingsUI::buildInterface()
201201
ImGui::FilteredCfgCheckbox("No TCAS/AI for ground a/c", sFilter, DR_CFG_AI_NOT_ON_GND, "Aircraft on the ground will not be reported to TCAS or AI/multiplayer interfaces");
202202
ImGui::FilteredCfgCheckbox("Hide a/c while taxiing", sFilter, DR_CFG_HIDE_TAXIING, "Hide aircraft in phase 'Taxi'");
203203
ImGui::FilteredCfgCheckbox("Hide a/c while parking", sFilter, DR_CFG_HIDE_PARKING, "Hide aircraft parking at a gate or ramp position");
204-
ImGui::FilteredCfgCheckbox("Hide all a/c in Reply", sFilter, DR_CFG_HIDE_IN_REPLAY, "Hide all aircraft while in Replay mode");
204+
ImGui::FilteredCfgCheckbox("Hide all a/c in Replay", sFilter, DR_CFG_HIDE_IN_REPLAY, "Hide all aircraft while in Replay mode");
205205
ImGui::FilteredCfgNumber("No aircraft below", sFilter, DR_CFG_HIDE_BELOW_AGL, 0, 10000, 100, "%d ft AGL");
206206
ImGui::FilteredCfgNumber("Hide ground a/c closer than", sFilter, DR_CFG_HIDE_NEARBY_GND, 0, 500, 10, "%d m");
207207
ImGui::FilteredCfgNumber("Hide airborne a/c closer than", sFilter, DR_CFG_HIDE_NEARBY_AIR, 0, 5000, 100, "%d m");

0 commit comments

Comments
 (0)