diff options
Diffstat (limited to 'src/ap_state.cpp')
| -rw-r--r-- | src/ap_state.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
| diff --git a/src/ap_state.cpp b/src/ap_state.cpp index 8feb78b..b057beb 100644 --- a/src/ap_state.cpp +++ b/src/ap_state.cpp | |||
| @@ -173,7 +173,7 @@ struct APState { | |||
| 173 | TrackerLog("Location: " + std::to_string(location_id)); | 173 | TrackerLog("Location: " + std::to_string(location_id)); |
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | RefreshTracker(); | 176 | RefreshTracker(false); |
| 177 | }); | 177 | }); |
| 178 | 178 | ||
| 179 | apclient->set_slot_disconnected_handler([this]() { | 179 | apclient->set_slot_disconnected_handler([this]() { |
| @@ -197,7 +197,7 @@ struct APState { | |||
| 197 | TrackerLog("Item: " + std::to_string(item.item)); | 197 | TrackerLog("Item: " + std::to_string(item.item)); |
| 198 | } | 198 | } |
| 199 | 199 | ||
| 200 | RefreshTracker(); | 200 | RefreshTracker(false); |
| 201 | }); | 201 | }); |
| 202 | 202 | ||
| 203 | apclient->set_retrieved_handler( | 203 | apclient->set_retrieved_handler( |
| @@ -206,14 +206,14 @@ struct APState { | |||
| 206 | HandleDataStorage(key, value); | 206 | HandleDataStorage(key, value); |
| 207 | } | 207 | } |
| 208 | 208 | ||
| 209 | RefreshTracker(); | 209 | RefreshTracker(false); |
| 210 | }); | 210 | }); |
| 211 | 211 | ||
| 212 | apclient->set_set_reply_handler([this](const std::string& key, | 212 | apclient->set_set_reply_handler([this](const std::string& key, |
| 213 | const nlohmann::json& value, | 213 | const nlohmann::json& value, |
| 214 | const nlohmann::json&) { | 214 | const nlohmann::json&) { |
| 215 | HandleDataStorage(key, value); | 215 | HandleDataStorage(key, value); |
| 216 | RefreshTracker(); | 216 | RefreshTracker(false); |
| 217 | }); | 217 | }); |
| 218 | 218 | ||
| 219 | apclient->set_slot_connected_handler([this]( | 219 | apclient->set_slot_connected_handler([this]( |
| @@ -271,7 +271,7 @@ struct APState { | |||
| 271 | connected = true; | 271 | connected = true; |
| 272 | has_connection_result = true; | 272 | has_connection_result = true; |
| 273 | 273 | ||
| 274 | RefreshTracker(); | 274 | RefreshTracker(true); |
| 275 | 275 | ||
| 276 | std::list<std::string> corrected_keys; | 276 | std::list<std::string> corrected_keys; |
| 277 | for (const std::string& key : tracked_data_storage_keys) { | 277 | for (const std::string& key : tracked_data_storage_keys) { |
| @@ -353,7 +353,7 @@ struct APState { | |||
| 353 | } | 353 | } |
| 354 | 354 | ||
| 355 | if (connected) { | 355 | if (connected) { |
| 356 | RefreshTracker(); | 356 | RefreshTracker(false); |
| 357 | } else { | 357 | } else { |
| 358 | client_active = false; | 358 | client_active = false; |
| 359 | } | 359 | } |
| @@ -407,11 +407,16 @@ struct APState { | |||
| 407 | return data_storage.count(key) && std::any_cast<bool>(data_storage.at(key)); | 407 | return data_storage.count(key) && std::any_cast<bool>(data_storage.at(key)); |
| 408 | } | 408 | } |
| 409 | 409 | ||
| 410 | void RefreshTracker() { | 410 | void RefreshTracker(bool reset) { |
| 411 | TrackerLog("Refreshing display..."); | 411 | TrackerLog("Refreshing display..."); |
| 412 | 412 | ||
| 413 | RecalculateReachability(); | 413 | RecalculateReachability(); |
| 414 | tracker_frame->UpdateIndicators(); | 414 | |
| 415 | if (reset) { | ||
| 416 | tracker_frame->ResetIndicators(); | ||
| 417 | } else { | ||
| 418 | tracker_frame->UpdateIndicators(); | ||
| 419 | } | ||
| 415 | } | 420 | } |
| 416 | 421 | ||
| 417 | int64_t GetItemId(const std::string& item_name) { | 422 | int64_t GetItemId(const std::string& item_name) { |
