mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-05-07 14:44:01 +00:00
feat(src/app/App): add a splash screen
This commit is contained in:
parent
038445f3e8
commit
81d616e885
6 changed files with 123 additions and 18 deletions
28
linphone-desktop/assets/images/splash_screen.svg
Normal file
28
linphone-desktop/assets/images/splash_screen.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 21 KiB |
|
|
@ -148,6 +148,7 @@
|
|||
<file>assets/images/speaker_on_hovered.svg</file>
|
||||
<file>assets/images/speaker_on_normal.svg</file>
|
||||
<file>assets/images/speaker_on_pressed.svg</file>
|
||||
<file>assets/images/splash_screen.svg</file>
|
||||
<file>assets/images/tooltip_arrow_bottom.svg</file>
|
||||
<file>assets/images/tooltip_arrow_left.svg</file>
|
||||
<file>assets/images/tooltip_arrow_right.svg</file>
|
||||
|
|
@ -343,6 +344,7 @@
|
|||
<file>ui/views/App/Settings/SettingsUi.qml</file>
|
||||
<file>ui/views/App/Settings/SettingsVideo.qml</file>
|
||||
<file>ui/views/App/Settings/SettingsWindow.qml</file>
|
||||
<file>ui/views/App/SplashScreen/SplashScreen.qml</file>
|
||||
<file>ui/views/App/Styles/Calls/CallStyle.qml</file>
|
||||
<file>ui/views/App/Styles/Calls/CallsWindowStyle.qml</file>
|
||||
<file>ui/views/App/Styles/Main/Assistant/AssistantAbstractViewStyle.qml</file>
|
||||
|
|
@ -360,5 +362,6 @@
|
|||
<file>ui/views/App/Styles/Main/ManageAccountsStyle.qml</file>
|
||||
<file>ui/views/App/Styles/qmldir</file>
|
||||
<file>ui/views/App/Styles/Settings/SettingsWindowStyle.qml</file>
|
||||
<file>ui/views/App/Styles/SplashScreen/SplashScreenStyle.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
|||
|
|
@ -55,6 +55,8 @@
|
|||
#define QML_VIEW_CALLS_WINDOW "qrc:/ui/views/App/Calls/CallsWindow.qml"
|
||||
#define QML_VIEW_SETTINGS_WINDOW "qrc:/ui/views/App/Settings/SettingsWindow.qml"
|
||||
|
||||
#define QML_VIEW_SPLASH_SCREEN "qrc:/ui/views/App/SplashScreen/SplashScreen.qml"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
inline bool installLocale (App &app, QTranslator &translator, const QLocale &locale) {
|
||||
|
|
@ -92,6 +94,35 @@ App::~App () {
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
inline QQuickWindow *createSubWindow (App *app, const char *path) {
|
||||
QQmlEngine *engine = app->getEngine();
|
||||
|
||||
QQmlComponent component(engine, QUrl(path));
|
||||
if (component.isError()) {
|
||||
qWarning() << component.errors();
|
||||
abort();
|
||||
}
|
||||
|
||||
QObject *object = component.create();
|
||||
QQmlEngine::setObjectOwnership(object, QQmlEngine::CppOwnership);
|
||||
object->setParent(app->getMainWindow());
|
||||
|
||||
return qobject_cast<QQuickWindow *>(object);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
inline void activeSplashScreen (App *app) {
|
||||
QQuickWindow *splash_screen = createSubWindow(app, QML_VIEW_SPLASH_SCREEN);
|
||||
|
||||
QObject::connect(
|
||||
CoreManager::getInstance(), &CoreManager::linphoneCoreCreated, splash_screen, [splash_screen]() {
|
||||
splash_screen->hide();
|
||||
splash_screen->deleteLater();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void App::initContentApp () {
|
||||
// Init core.
|
||||
CoreManager::init(this, m_parser.value("config"));
|
||||
|
|
@ -124,6 +155,9 @@ void App::initContentApp () {
|
|||
if (m_engine.rootObjects().isEmpty())
|
||||
qFatal("Unable to open main window.");
|
||||
|
||||
// Load splashscreen.
|
||||
activeSplashScreen(this);
|
||||
|
||||
CoreManager *core = CoreManager::getInstance();
|
||||
|
||||
if (m_parser.isSet("selftest"))
|
||||
|
|
@ -210,24 +244,6 @@ void App::tryToUsePreferredLocale () {
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
inline QQuickWindow *createSubWindow (App *app, const char *path) {
|
||||
QQmlEngine *engine = app->getEngine();
|
||||
|
||||
QQmlComponent component(engine, QUrl(path));
|
||||
if (component.isError()) {
|
||||
qWarning() << component.errors();
|
||||
abort();
|
||||
}
|
||||
|
||||
QObject *object = component.create();
|
||||
QQmlEngine::setObjectOwnership(object, QQmlEngine::CppOwnership);
|
||||
object->setParent(app->getMainWindow());
|
||||
|
||||
return qobject_cast<QQuickWindow *>(object);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
QQuickWindow *App::getCallsWindow () {
|
||||
if (!m_calls_window)
|
||||
m_calls_window = createSubWindow(this, QML_VIEW_CALLS_WINDOW);
|
||||
|
|
|
|||
|
|
@ -1,8 +1,47 @@
|
|||
import QtQuick 2.7
|
||||
import QtQuick.Window 2.2
|
||||
|
||||
import Common 1.0
|
||||
|
||||
import App.Styles 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
||||
Window {
|
||||
color: SplashScreenStyle.color
|
||||
flags: Qt.SplashScreen
|
||||
modality: Qt.ApplicationModal
|
||||
visible: image.status === Image.Ready
|
||||
|
||||
x: (Screen.width - image.width) / 2
|
||||
y: (Screen.height - image.height) / 2
|
||||
|
||||
height: image.paintedHeight
|
||||
width: image.paintedWidth
|
||||
|
||||
Image {
|
||||
id: image
|
||||
|
||||
anchors.centerIn: parent
|
||||
|
||||
height: SplashScreenStyle.height
|
||||
width: SplashScreenStyle.width
|
||||
|
||||
fillMode: Image.PreserveAspectFit
|
||||
mipmap: true
|
||||
|
||||
source: SplashScreenStyle.image
|
||||
|
||||
BusyIndicator {
|
||||
height: SplashScreenStyle.busyIndicator.height
|
||||
width: SplashScreenStyle.busyIndicator.width
|
||||
|
||||
anchors {
|
||||
bottom: parent.bottom
|
||||
bottomMargin: SplashScreenStyle.busyIndicator.bottomMargin
|
||||
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
pragma Singleton
|
||||
import QtQuick 2.7
|
||||
|
||||
// =============================================================================
|
||||
|
||||
QtObject {
|
||||
property color color: '#444444' // Not a `Common.Color`. Specific case.
|
||||
property int height: 350
|
||||
property int width: 620
|
||||
property url image: 'qrc:/assets/images/splash_screen.svg'
|
||||
|
||||
property QtObject busyIndicator: QtObject {
|
||||
property int bottomMargin: 25
|
||||
property int height: 24
|
||||
property int width: 24
|
||||
}
|
||||
}
|
||||
|
|
@ -23,3 +23,5 @@ singleton MainWindowStyle 1.0 Main/MainWindowStyle.qml
|
|||
singleton ManageAccountsStyle 1.0 Main/ManageAccountsStyle.qml
|
||||
|
||||
singleton SettingsWindowStyle 1.0 Settings/SettingsWindowStyle.qml
|
||||
|
||||
singleton SplashScreenStyle 1.0 SplashScreen/SplashScreenStyle.qml
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue