1
0
Fork 0
mirror of https://github.com/HenkKalkwater/harbour-sailfin.git synced 2025-09-05 10:12:46 +00:00

Add track selection back

This commit is contained in:
Chris Josten 2021-08-23 01:46:57 +02:00
parent 5a24bdee59
commit 1aae311b9b
11 changed files with 306 additions and 57 deletions

View file

@ -185,17 +185,22 @@ private:
* @brief Updates the data when finished.
*/
void onLoaderReady() {
R newData = m_loader->result();
if (m_dataViewModel->data()->sameAs(newData)) {
// Replace the data the model holds
m_dataViewModel->data()->replaceData(newData);
} else {
// Replace the model
using PointerType = typename decltype(m_dataViewModel->data())::Type;
m_dataViewModel = new T(this, QSharedPointer<PointerType>::create(newData, m_apiClient));
try {
R newData = m_loader->result();
if (m_dataViewModel->data()->sameAs(newData)) {
// Replace the data the model holds
m_dataViewModel->data()->replaceData(newData);
} else {
// Replace the model
using PointerType = typename decltype(m_dataViewModel->data())::Type;
m_dataViewModel = new T(this, QSharedPointer<PointerType>::create(newData, m_apiClient));
}
setStatus(Ready);
emitDataChanged();
} catch(QException &e) {
setErrorString(e.what());
setStatus(Error);
}
setStatus(Ready);
emitDataChanged();
}
void onLoaderError(QString message) {