Ref T171, use a shared completer for callsign completion

* CSharedStringListCompleter utility class supporting timestamp checks
* avoid unnecessary DBus transfer
* less memory consumption

Remark: No totally clear if a QCompleter can be shared, but I have not noticed a problem so far
This commit is contained in:
Klaus Basan
2017-10-16 11:53:31 +02:00
parent 1155bf3ed2
commit d348226283
4 changed files with 114 additions and 19 deletions

View File

@@ -13,6 +13,7 @@
#define BLACKGUI_COMPONENTS_CALLSIGNCOMPLETER_H
#include "blackgui/blackguiexport.h"
#include "blackgui/sharedstringlistcompleter.h"
#include "blackmisc/digestsignal.h"
#include "blackmisc/aviation/callsignset.h"
#include "blackcore/network.h"
@@ -63,8 +64,10 @@ namespace BlackGui
void onChangedConnectionStatus(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to);
bool isValidKnownCallsign(const QString &callsignString) const;
//! Shared completer data
static CSharedStringListCompleter *completer();
QScopedPointer <Ui::CCallsignCompleter> ui;
QCompleter *m_currentCompleter = nullptr;
BlackMisc::Aviation::CCallsignSet m_validCallsigns;
BlackMisc::CDigestSignal m_dsAircraftsInRangeChanged { this, &CCallsignCompleter::onChangedAircraftInRange, 5000, 5 };
};