mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-02-07 15:08:24 +00:00
fix(CoreManager): create main components at core startup
This commit is contained in:
parent
5695e8ac6d
commit
1a2e5e5e8a
6 changed files with 26 additions and 25 deletions
|
|
@ -72,16 +72,6 @@ void CoreHandlers::handleCoreCreated () {
|
|||
mCoreStartedLock->unlock();
|
||||
}
|
||||
|
||||
void CoreHandlers::handleCoreStarted () {
|
||||
mCoreStartedLock->lock();
|
||||
|
||||
Q_ASSERT(mCoreStarted == false);
|
||||
mCoreStarted = true;
|
||||
notifyCoreStarted();
|
||||
|
||||
mCoreStartedLock->unlock();
|
||||
}
|
||||
|
||||
void CoreHandlers::notifyCoreStarted () {
|
||||
if (mCoreCreated && mCoreStarted)
|
||||
scheduleFunctionInApp(
|
||||
|
|
@ -128,8 +118,15 @@ void CoreHandlers::onGlobalStateChanged (
|
|||
linphone::GlobalState gstate,
|
||||
const string &
|
||||
) {
|
||||
if (gstate == linphone::GlobalStateOn)
|
||||
handleCoreStarted();
|
||||
if (gstate == linphone::GlobalStateOn) {
|
||||
mCoreStartedLock->lock();
|
||||
|
||||
Q_ASSERT(mCoreStarted == false);
|
||||
mCoreStarted = true;
|
||||
notifyCoreStarted();
|
||||
|
||||
mCoreStartedLock->unlock();
|
||||
}
|
||||
}
|
||||
|
||||
void CoreHandlers::onCallStatsUpdated (
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@ signals:
|
|||
|
||||
private:
|
||||
void handleCoreCreated ();
|
||||
void handleCoreStarted ();
|
||||
void notifyCoreStarted ();
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -46,18 +46,22 @@ CoreManager *CoreManager::mInstance = nullptr;
|
|||
CoreManager::CoreManager (QObject *parent, const QString &configPath) : QObject(parent), mHandlers(make_shared<CoreHandlers>(this)) {
|
||||
mPromiseBuild = QtConcurrent::run(this, &CoreManager::createLinphoneCore, configPath);
|
||||
|
||||
QObject::connect(&mPromiseWatcher, &QFutureWatcher<void>::finished, this, []() {
|
||||
mInstance->mCallsListModel = new CallsListModel(mInstance);
|
||||
mInstance->mContactsListModel = new ContactsListModel(mInstance);
|
||||
mInstance->mSipAddressesModel = new SipAddressesModel(mInstance);
|
||||
mInstance->mSettingsModel = new SettingsModel(mInstance);
|
||||
mInstance->mAccountSettingsModel = new AccountSettingsModel(mInstance);
|
||||
QObject::connect(&mPromiseWatcher, &QFutureWatcher<void>::finished, this, [] {
|
||||
qInfo() << QStringLiteral("Core created. Enable iterate.");
|
||||
mInstance->mCbsTimer->start();
|
||||
|
||||
qInfo() << QStringLiteral("Core created. Enable iterate.");
|
||||
mInstance->mCbsTimer->start();
|
||||
emit mInstance->coreCreated();
|
||||
});
|
||||
|
||||
emit mInstance->coreCreated();
|
||||
});
|
||||
QObject::connect(mHandlers.get(), &CoreHandlers::coreStarted, this, [] {
|
||||
mInstance->mCallsListModel = new CallsListModel(mInstance);
|
||||
mInstance->mContactsListModel = new ContactsListModel(mInstance);
|
||||
mInstance->mSipAddressesModel = new SipAddressesModel(mInstance);
|
||||
mInstance->mSettingsModel = new SettingsModel(mInstance);
|
||||
mInstance->mAccountSettingsModel = new AccountSettingsModel(mInstance);
|
||||
|
||||
emit mInstance->coreStarted();
|
||||
});
|
||||
|
||||
mPromiseWatcher.setFuture(mPromiseBuild);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,6 +121,7 @@ public:
|
|||
|
||||
signals:
|
||||
void coreCreated ();
|
||||
void coreStarted ();
|
||||
|
||||
private:
|
||||
CoreManager (QObject *parent, const QString &configPath);
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 4c291e2c5a32711a1176459d74ed405cf225f706
|
||||
Subproject commit e3365011df5d5281fed91beb91fa928ac3568f60
|
||||
|
|
@ -51,7 +51,7 @@ ApplicationWindow {
|
|||
|
||||
Connections {
|
||||
target: CoreManager
|
||||
onCoreCreated: mainLoader.active = true
|
||||
onCoreStarted: mainLoader.active = true
|
||||
}
|
||||
|
||||
Shortcut {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue