Commit d3def74e authored by Nate Graham's avatar Nate Graham
Browse files

Rename m_initializingBackends to m_initializingBackendsCount for clarity

This way it'll be clear just from looking at its name that it holds an
int, not a bool. This should make it harder to accidentally use it in
place of m_isInitializing in the future.
parent 31fd4a4d
Pipeline #214993 passed with stage
in 1 minute and 37 seconds
......@@ -40,7 +40,7 @@ ResourcesModel *ResourcesModel::global()
ResourcesModel::ResourcesModel(QObject *parent, bool load)
: QObject(parent)
, m_isFetching(false)
, m_initializingBackends(0)
, m_initializingBackendsCount(0)
, m_currentApplicationBackend(nullptr)
, m_allInitializedEmitter(new QTimer(this))
, m_updatesCount(
......@@ -88,7 +88,7 @@ void ResourcesModel::init(bool load)
m_allInitializedEmitter->setSingleShot(true);
m_allInitializedEmitter->setInterval(0);
connect(m_allInitializedEmitter, &QTimer::timeout, this, [this]() {
if (m_initializingBackends == 0) {
if (m_initializingBackendsCount == 0) {
m_isInitializing = false;
Q_EMIT allInitialized();
}
......@@ -136,7 +136,7 @@ void ResourcesModel::addResourcesBackend(AbstractResourcesBackend *backend)
if (!backend->isFetching()) {
m_updatesCount.reevaluate();
} else {
m_initializingBackends++;
m_initializingBackendsCount++;
}
connect(backend, &AbstractResourcesBackend::fetchingChanged, this, &ResourcesModel::callerFetchingChanged);
......@@ -160,7 +160,7 @@ void ResourcesModel::addResourcesBackend(AbstractResourcesBackend *backend)
// pre-filled, we still need for the rest of the backends to be added before trying
// to send out the initialized signal. To ensure this happens, schedule it for the
// start of the next run of the event loop.
if (m_initializingBackends == 0) {
if (m_initializingBackendsCount == 0) {
m_allInitializedEmitter->start();
} else {
slotFetching();
......@@ -184,11 +184,11 @@ void ResourcesModel::callerFetchingChanged()
}
if (backend->isFetching()) {
m_initializingBackends++;
m_initializingBackendsCount++;
slotFetching();
} else {
m_initializingBackends--;
if (m_initializingBackends == 0)
m_initializingBackendsCount--;
if (m_initializingBackendsCount == 0)
m_allInitializedEmitter->start();
else
slotFetching();
......@@ -237,7 +237,7 @@ void ResourcesModel::registerAllBackends()
{
DiscoverBackendsFactory f;
const auto backends = f.allBackends();
if (m_initializingBackends == 0 && backends.isEmpty()) {
if (m_initializingBackendsCount == 0 && backends.isEmpty()) {
qCWarning(LIBDISCOVER_LOG) << "Couldn't find any backends";
m_allInitializedEmitter->start();
} else {
......
......@@ -155,7 +155,7 @@ private:
bool m_isFetching;
bool m_isInitializing = true;
QVector<AbstractResourcesBackend *> m_backends;
int m_initializingBackends;
int m_initializingBackendsCount;
DiscoverAction *m_updateAction = nullptr;
AbstractResourcesBackend *m_currentApplicationBackend;
QTimer *m_allInitializedEmitter;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment