Commit ae7f10ca authored by Ronan Abhamon's avatar Ronan Abhamon

feat(src/app/App): display app only when core is started (so after creation)

parent a1066c36
......@@ -114,7 +114,7 @@ inline QQuickWindow *createSubWindow (App *app, const char *path) {
inline void activeSplashScreen (App *app) {
QQuickWindow *splashScreen = createSubWindow(app, QML_VIEW_SPLASH_SCREEN);
QObject::connect(CoreManager::getInstance(), &CoreManager::linphoneCoreCreated, splashScreen, [splashScreen] {
QObject::connect(CoreManager::getInstance()->getHandlers().get(), &CoreHandlers::coreStarted, splashScreen, [splashScreen] {
splashScreen->close();
splashScreen->deleteLater();
});
......@@ -179,8 +179,8 @@ void App::initContentApp () {
activeSplashScreen(this);
QObject::connect(
CoreManager::getInstance(),
&CoreManager::linphoneCoreCreated,
CoreManager::getInstance()->getHandlers().get(),
&CoreHandlers::coreStarted,
this, mParser.isSet("selftest") ? &App::quit : &App::openAppAfterInit
);
}
......@@ -441,7 +441,6 @@ void App::openAppAfterInit () {
tryToUsePreferredLocale();
qInfo() << QStringLiteral("Linphone core created.");
CoreManager::getInstance()->enableHandlers();
#ifndef __APPLE__
// Enable TrayIconSystem.
......
......@@ -52,6 +52,15 @@ void CoreHandlers::onCallStateChanged (
App::getInstance()->getNotifier()->notifyReceivedCall(call);
}
void CoreHandlers::onGlobalStateChanged (
const shared_ptr<linphone::Core> &,
linphone::GlobalState gstate,
const string &
) {
if (gstate == linphone::GlobalStateOn)
emit coreStarted ();
}
void CoreHandlers::onCallStatsUpdated (
const shared_ptr<linphone::Core> &,
const shared_ptr<linphone::Call> &call,
......
......@@ -36,6 +36,7 @@ class CoreHandlers :
signals:
void authenticationRequested (const std::shared_ptr<linphone::AuthInfo> &authInfo);
void callStateChanged (const std::shared_ptr<linphone::Call> &call, linphone::CallState state);
void coreStarted ();
void messageReceived (const std::shared_ptr<linphone::ChatMessage> &message);
void presenceReceived (const QString &sipAddress, const std::shared_ptr<const linphone::PresenceModel> &presenceModel);
void registrationStateChanged (const std::shared_ptr<linphone::ProxyConfig> &proxyConfig, linphone::RegistrationState state);
......@@ -54,6 +55,12 @@ private:
const std::string &message
) override;
void onGlobalStateChanged (
const std::shared_ptr<linphone::Core> &core,
linphone::GlobalState gstate,
const std::string &message
) override;
void onCallStatsUpdated (
const std::shared_ptr<linphone::Core> &core,
const std::shared_ptr<linphone::Call> &call,
......
......@@ -48,6 +48,8 @@ CoreManager::CoreManager (QObject *parent, const QString &configPath) : QObject(
mInstance->mSettingsModel = new SettingsModel(mInstance);
mInstance->mAccountSettingsModel = new AccountSettingsModel(mInstance);
mInstance->mCbsTimer->start();
emit mInstance->linphoneCoreCreated();
}
);
......@@ -55,10 +57,6 @@ CoreManager::CoreManager (QObject *parent, const QString &configPath) : QObject(
mPromiseWatcher.setFuture(mPromiseBuild);
}
void CoreManager::enableHandlers () {
mCbsTimer->start();
}
// -----------------------------------------------------------------------------
void CoreManager::init (QObject *parent, const QString &configPath) {
......
......@@ -47,8 +47,6 @@ class CoreManager : public QObject {
public:
~CoreManager () = default;
void enableHandlers ();
std::shared_ptr<linphone::Core> getCore () {
return mCore;
}
......
Markdown is supported
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