Commit dd1bd712 authored by Ronan's avatar Ronan
Browse files

feat(app): many changes

  - refactoring
  - supports own transient window system
  - update languages
  - ...
parent 2db66e1f
......@@ -249,10 +249,6 @@ Server url not configured.</translation>
<source>removeContactDescription</source>
<translation>Do you really want remove this contact from your book?</translation>
</message>
<message>
<source>removeContactTitle</source>
<translation>Delete confirmation</translation>
</message>
<message>
<source>sipAccounts</source>
<translation>SIP ACCOUNT(S)</translation>
......@@ -317,10 +313,6 @@ Server url not configured.</translation>
<source>locality</source>
<translation>Locality</translation>
</message>
<message>
<source>abortEditionTitle</source>
<translation>Cancel contact edition</translation>
</message>
<message>
<source>abortEditionDescriptionText</source>
<translation>Are you sure you want to cancel the contact edition?</translation>
......@@ -348,10 +340,6 @@ Server url not configured.</translation>
<source>removeContactDescription</source>
<translation>Do you really want remove this contact from your book?</translation>
</message>
<message>
<source>removeContactTitle</source>
<translation>Delete confirmation</translation>
</message>
</context>
<context>
<name>Conversation</name>
......@@ -371,10 +359,6 @@ Server url not configured.</translation>
<source>removeAllEntriesDescription</source>
<translation>Are you sure you want to clean history?</translation>
</message>
<message>
<source>removeAllEntriesTitle</source>
<translation>Clean history</translation>
</message>
</context>
<context>
<name>DroppableTextArea</name>
......@@ -573,23 +557,19 @@ Server url not configured.</translation>
</message>
</context>
<context>
<name>ManageAccountsWindow</name>
<name>ManageAccounts</name>
<message>
<source>ok</source>
<translation>OK</translation>
</message>
<message>
<source>manageAccountsTitle</source>
<translation>Presence and accounts</translation>
<source>selectPresenceLabel</source>
<translation>Select a presence status</translation>
</message>
<message>
<source>selectAccountLabel</source>
<translation>Select you active account</translation>
</message>
<message>
<source>selectPresenceLabel</source>
<translation>Select a presence status</translation>
</message>
</context>
<context>
<name>Presence</name>
......
......@@ -249,10 +249,6 @@ Url du serveur non configurée.</translation>
<source>removeContactDescription</source>
<translation>Voulez-vous vraiment supprimer ce contact de votre carnet ?</translation>
</message>
<message>
<source>removeContactTitle</source>
<translation>Confirmation de la suppression</translation>
</message>
<message>
<source>sipAccounts</source>
<translation>COMPTE(S) SIP</translation>
......@@ -317,10 +313,6 @@ Url du serveur non configurée.</translation>
<source>locality</source>
<translation>Localité</translation>
</message>
<message>
<source>abortEditionTitle</source>
<translation>Annuler l&apos;édition du contact</translation>
</message>
<message>
<source>abortEditionDescriptionText</source>
<translation>Êtes-vous sûr de vouloir annuler l&apos;édition du contact ?</translation>
......@@ -348,10 +340,6 @@ Url du serveur non configurée.</translation>
<source>removeContactDescription</source>
<translation>Voulez-vous vraiment supprimer ce contact de votre carnet ?</translation>
</message>
<message>
<source>removeContactTitle</source>
<translation>Confirmation de la suppression</translation>
</message>
</context>
<context>
<name>Conversation</name>
......@@ -371,10 +359,6 @@ Url du serveur non configurée.</translation>
<source>removeAllEntriesDescription</source>
<translation>Êtes-vous sûr de vouloir supprimer cet historique ?</translation>
</message>
<message>
<source>removeAllEntriesTitle</source>
<translation>Suppression de l&apos;historique</translation>
</message>
</context>
<context>
<name>DroppableTextArea</name>
......@@ -573,23 +557,19 @@ Url du serveur non configurée.</translation>
</message>
</context>
<context>
<name>ManageAccountsWindow</name>
<name>ManageAccounts</name>
<message>
<source>ok</source>
<translation>OK</translation>
</message>
<message>
<source>manageAccountsTitle</source>
<translation>Présence et comptes</translation>
<source>selectPresenceLabel</source>
<translation>Sélectionner votre présence</translation>
</message>
<message>
<source>selectAccountLabel</source>
<translation>Sélectionner votre compte principal</translation>
</message>
<message>
<source>selectPresenceLabel</source>
<translation>Sélectionner votre présence</translation>
</message>
</context>
<context>
<name>Presence</name>
......
......@@ -253,10 +253,14 @@
<file>ui/modules/Common/Styles/Popup/PopupStyle.qml</file>
<file>ui/modules/Common/Styles/qmldir</file>
<file>ui/modules/Common/Styles/Tooltip/TooltipStyle.qml</file>
<file>ui/modules/Common/Styles/Window/WindowStyle.qml</file>
<file>ui/modules/Common/Tooltip/TooltipArea.qml</file>
<file>ui/modules/Common/Tooltip/Tooltip.qml</file>
<file>ui/modules/Common/View/ScrollableListView.js</file>
<file>ui/modules/Common/View/ScrollableListView.qml</file>
<file>ui/modules/Common/Window/ApplicationWindow.qml</file>
<file>ui/modules/Common/Window/VirtualWindow.qml</file>
<file>ui/modules/Common/Window/Window.js</file>
<file>ui/modules/Linphone/Account/AccountStatus.qml</file>
<file>ui/modules/Linphone/Calls/CallControls.qml</file>
<file>ui/modules/Linphone/Calls/Calls.qml</file>
......@@ -319,15 +323,17 @@
<file>ui/views/App/Main/Assistant/AssistantUseLinphoneSipAccount.qml</file>
<file>ui/views/App/Main/Assistant/AssistantUseOtherSipAccount.qml</file>
<file>ui/views/App/Main/Assistant.qml</file>
<file>ui/views/App/Main/ContactEdit.js</file>
<file>ui/views/App/Main/ContactEdit.qml</file>
<file>ui/views/App/Main/Contacts.qml</file>
<file>ui/views/App/Main/Conversation.js</file>
<file>ui/views/App/Main/Conversation.qml</file>
<file>ui/views/App/Main/Home.qml</file>
<file>ui/views/App/Main/InviteFriends.qml</file>
<file>ui/views/App/Main/MainWindow.js</file>
<file>ui/views/App/Main/MainWindowMenuBar.qml</file>
<file>ui/views/App/Main/MainWindow.qml</file>
<file>ui/views/App/ManageAccountsWindow.qml</file>
<file>ui/views/App/Main/ManageAccounts.qml</file>
<file>ui/views/App/qmldir</file>
<file>ui/views/App/Settings/SettingsAudio.qml</file>
<file>ui/views/App/Settings/SettingsCallsChat.qml</file>
......
......@@ -58,8 +58,8 @@ private:
) override;
void onNotifyPresenceReceivedForUriOrTel (
const std::shared_ptr<linphone::Core> &lc,
const std::shared_ptr<linphone::Friend> &lf,
const std::shared_ptr<linphone::Core> &core,
const std::shared_ptr<linphone::Friend> &linphone_friend,
const std::string &uri_or_tel,
const std::shared_ptr<linphone::PresenceModel> &presence_model
) override;
......
......@@ -30,6 +30,8 @@ using namespace std;
// =============================================================================
int main (int argc, char *argv[]) {
qputenv("QML_DISABLE_DISK_CACHE", "true");
QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL, true);
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);
......
......@@ -23,6 +23,7 @@ QtObject {
property color k50: '#32FFFFFF'
property color l: '#000000'
property color l50: '#32000000'
property color l80: '#80000000'
property color m: '#D1D1D1'
property color n: '#C0C0C0'
property color o: '#232323'
......
......@@ -18,9 +18,9 @@ DialogPlus {
onClicked: exit(1)
}
]
centeredButtons: true
maximumHeight: DialogStyle.confirmDialog.height
maximumWidth: DialogStyle.confirmDialog.width
minimumHeight: DialogStyle.confirmDialog.height
minimumWidth: DialogStyle.confirmDialog.width
height: DialogStyle.confirmDialog.height
width: DialogStyle.confirmDialog.width
}
import QtQuick 2.7
import QtQuick.Layouts 1.3
import QtQuick.Window 2.2
import Common 1.0
import Common.Styles 1.0
// =============================================================================
// Helper to build quickly dialogs.
// =============================================================================
Window {
Rectangle {
property alias buttons: buttons.data // Optionnal.
property alias descriptionText: description.text // Optionnal.
property bool centeredButtons: false
......@@ -22,21 +22,21 @@ Window {
// ---------------------------------------------------------------------------
// Derived class must use this function instead of close.
// Destroy the component and send signal to caller.
function exit (status) {
if (!_disableExitStatus) {
_disableExitStatus = true
exitStatus(status)
close()
}
}
flags: Qt.Tool | Qt.FramelessWindowHint
modality: Qt.WindowModal
// ---------------------------------------------------------------------------
color: DialogStyle.color
// Handle normal windows close.
onClosing: !_disableExitStatus && exitStatus(0)
layer {
enabled: true
effect: PopupShadow {}
}
// ---------------------------------------------------------------------------
......
......@@ -6,6 +6,8 @@ import Common 1.0
// =============================================================================
QtObject {
property color color: Colors.k
property int leftMargin: 50
property int rightMargin: 50
......
pragma Singleton
import QtQuick 2.7
import Common 1.0
// =============================================================================
QtObject {
property QtObject transientWindow: QtObject {
property color color: Colors.l80
}
}
......@@ -50,3 +50,5 @@ singleton PanedStyle 1.0 Misc/PanedStyle.qml
singleton PopupStyle 1.0 Popup/PopupStyle.qml
singleton TooltipStyle 1.0 Tooltip/TooltipStyle.qml
singleton WindowStyle 1.0 Window/WindowStyle.qml
import QtQuick 2.7
// Explicit import to support Toolbar.
import QtQuick.Controls 1.4 as Controls1
import 'Window.js' as Logic
// =============================================================================
Controls1.ApplicationWindow {
default property alias _content: content.data
// ---------------------------------------------------------------------------
function attachVirtualWindow () {
Logic.attachVirtualWindow.apply(this, arguments)
}
function detachVirtualWindow () {
Logic.detachVirtualWindow()
}
// ---------------------------------------------------------------------------
Item {
anchors.fill: parent
Rectangle {
id: content
anchors.fill: parent
}
VirtualWindow {
id: virtualWindow
}
}
}
import QtQuick 2.7
import Common.Styles 1.0
// =============================================================================
Item {
function setContent (object) {
object.parent = content
object.anchors.centerIn = content
visible = true
}
function unsetContent () {
visible = false
var object = content.data[0]
content.data = []
return object
}
// ---------------------------------------------------------------------------
anchors.fill: parent
visible: false
MouseArea {
anchors.fill: parent
hoverEnabled: true
}
Rectangle {
id: content
anchors.fill: parent
color: WindowStyle.transientWindow.color
}
}
// =============================================================================
// Windows (qml) Logic.
// =============================================================================
.import 'qrc:/ui/scripts/Utils/utils.js' as Utils
// =============================================================================
// Create a dynamic component hover the main content of one window.
// The object parameter must have a `exitStatus` signal which is used
// at item destruction.
//
// The exit status handler is optional.
function attachVirtualWindow (object, properties, exitStatusHandler) {
if (virtualWindow.visible) {
return
}
var object = Utils.createObject(object, null, {
properties: properties
})
if (exitStatusHandler) {
object.exitStatus.connect(exitStatusHandler)
}
object.exitStatus.connect(function () {
virtualWindow.unsetContent().destroy()
})
virtualWindow.setContent(object)
}
......@@ -75,3 +75,5 @@ PopupShadow 1.0 Popup/PopupShadow.qml
TooltipArea 1.0 Tooltip/TooltipArea.qml
ScrollableListView 1.0 View/ScrollableListView.qml
ApplicationWindow 1.0 Window/ApplicationWindow.qml
......@@ -20,6 +20,12 @@ var PORT_RANGE_REGEX = PortTools.PORT_RANGE_REGEX
// QML helpers.
// =============================================================================
function buildDialogUri (component) {
return 'qrc:/ui/modules/Common/Dialog/' + component + '.qml'
}
// -----------------------------------------------------------------------------
// Destroy timeout.
function clearTimeout (timer) {
timer.stop() // NECESSARY.
......@@ -90,25 +96,35 @@ function getTopParent (object, useFakeParent) {
// -----------------------------------------------------------------------------
// Display a simple ConfirmDialog component.
// Wrap the openWindow function.
function openConfirmDialog (parent, options) {
return openWindow(
'import QtQuick 2.7;' +
'import Common 1.0;' +
'ConfirmDialog {' +
'descriptionText: \'' + escapeQuotes(options.descriptionText) + '\';' +
'title: \'' + escapeQuotes(options.title) + '\'' +
'}',
parent, {
isString: true,
exitHandler: (options && options.exitHandler) ||
function () {
return 0
},
properties: options && options.properties
function createObject (source, parent, options) {
if (options && options.isString) {
var object = Qt.createQmlObject(source, parent)
var properties = options && options.properties
if (properties) {
for (var key in properties) {
object[key] = properties[key]
}
}
return object
}
var component = Qt.createComponent(source)
if (component.status !== QtQuick.Component.Ready) {
console.debug('Component not ready.')
if (component.status === QtQuick.Component.Error) {
console.debug('Error: ' + component.errorString())
}
)
return // Error.
}
var object = component.createObject(parent, (options && options.properties) || {})
if (!object) {
console.debug('Error: unable to create dynamic object.')
}
return object
}
// -----------------------------------------------------------------------------
......@@ -121,32 +137,7 @@ function openConfirmDialog (parent, options) {
//
// If exitHandler is used, window must implement exitStatus signal.
function openWindow (window, parent, options) {
var object
if (options && options.isString) {
object = Qt.createQmlObject(window, parent)
var properties = options && options.properties
if (properties) {
for (var key in properties) {
object[key] = properties[key]
}
}
} else {
var component = Qt.createComponent(
'qrc:/ui/views/App/' + window + '.qml'
)
if (component.status !== QtQuick.Component.Ready) {
console.debug('Window not ready.')
if (component.status === QtQuick.Component.Error) {
console.debug('Error:' + component.errorString())
}
return // Error.
}
object = component.createObject(parent, options ? options.properties : {})
}
var object = createObject(window, parent, options)
object.closing.connect(object.destroy.bind(object))
......
......@@ -41,29 +41,6 @@ TestCase {
// ---------------------------------------------------------------------------
// Test only if a confirm dialog can be opened.
// The other tests are launched by `ConfirmDialog.spec.qml`.
function test_openConfirmDialog () {
var dialog
try {
dialog = Utils.openConfirmDialog(testCase, {
descriptionText: '',
title: ''
})
} catch (e) {
fail(e)
}
if (dialog == null) {
fail('`dialog` is not returned')
}
dialog.close()
}
// ---------------------------------------------------------------------------
function test_qmlTypeof_data () {
return [
{
......
// =============================================================================
// `Conversation.qml` Logic.
// =============================================================================
.import Linphone 1.0 as Linphone
.import 'qrc:/ui/scripts/Utils/utils.js' as Utils
// =============================================================================
function handleCreation () {
var sipAddress = contactEdit.sipAddress
var contact = contactEdit._contact = Linphone.SipAddressesModel.mapSipAddressToContact(
sipAddress
)
if (!contact) {
var vcard = Linphone.CoreManager.createDetachedVcardModel()
contactEdit._vcard = vcard
if (sipAddress && sipAddress.length > 0) {
vcard.addSipAddress(sipAddress)
}
contactEdit._edition = true
} else {
contactEdit._vcard = contact.vcard
}
}
function handleDestruction () {
var contact = contactEdit._contact
if (contactEdit._edition && contact) {
contact.abortEdit()
}
}
// -----------------------------------------------------------------------------
function editContact () {
contactEdit._contact.startEdit()
contactEdit._edition = true
window.lockView({