add webview

This commit is contained in:
Julien Wadel 2021-05-24 17:46:30 +02:00
parent 5397094d92
commit 5b2b0d334f
4 changed files with 23 additions and 4 deletions

View file

@ -90,7 +90,7 @@ if( WIN32)
endif()
set(CMAKE_INCLUDE_CURRENT_DIR ON)#useful for config.h
set(QT5_PACKAGES Core Gui Quick Widgets QuickControls2 Svg LinguistTools Concurrent Network Test)
set(QT5_PACKAGES Core Gui Quick Widgets QuickControls2 Svg LinguistTools Concurrent Network Test WebView)
if (UNIX AND NOT APPLE)
list(APPEND QT5_PACKAGES DBus)
endif ()

View file

@ -20,18 +20,22 @@
#include "AppController.hpp"
#include <qloggingcategory.h>
#include <QtWebView>
#ifdef QT_QML_DEBUG
#include <QQmlDebuggingEnabler>
#endif
// =============================================================================
int main (int argc, char *argv[]) {
QtWebView::initialize();
AppController controller(argc, argv);
#ifdef QT_QML_DEBUG
QQmlDebuggingEnabler enabler;
#endif
//QLoggingCategory::setFilterRules("*.debug=true;qml=false");
App *app = controller.getApp();
if (app->isSecondary())
{
qInfo() << QStringLiteral("Running secondary app success. Kill it now.");

View file

@ -20,6 +20,7 @@ Item {
property alias title: title.text
property bool backEnabled: true
property bool maximized: false // Used to stretch content to fit all the view (the title will be set to top)
default property alias _content: content.data
@ -33,6 +34,7 @@ Item {
// ---------------------------------------------------------------------------
Column {
id:titleBar
anchors.centerIn: parent
spacing: AssistantAbstractViewStyle.info.spacing
@ -75,7 +77,7 @@ Item {
id: content
anchors.horizontalCenter: parent.horizontalCenter
height: AssistantAbstractViewStyle.content.height
height: (maximized?view.height - description.height - title.height - buttons.height -titleBar.spacing*3 : AssistantAbstractViewStyle.content.height)
width: AssistantAbstractViewStyle.content.width
}
}

View file

@ -1,4 +1,5 @@
import QtQuick 2.7
import QtWebView 1.15
import Common 1.0
@ -9,11 +10,23 @@ import App.Styles 1.0
AssistantAbstractView {
description: qsTr('createAppSipAccountDescription')
title: qsTr('createAppSipAccountTitle').replace('%1', Qt.application.name.toUpperCase())
maximized:true
// ---------------------------------------------------------------------------
// Menu.
// ---------------------------------------------------------------------------
WebView{
anchors.fill:parent
httpUserAgent: 'Linphone Desktop'
//url:'https://www.whatismybrowser.com/detect/what-is-my-user-agent'
url: 'https://subscribe.linphone.org/register'
onLoadingChanged: {
if (loadRequest.errorString)
console.error(loadRequest.errorString);
}
}
/*
Column {
anchors.centerIn: parent
spacing: CreateAppSipAccountStyle.buttons.spacing
@ -36,5 +49,5 @@ AssistantAbstractView {
onClicked: assistant.pushView('CreateAppSipAccountWithEmail')
}
}
}*/
}