From d35ca30b6675dee410ed81409f2f29799c8e5f91 Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Wed, 15 Feb 2017 10:39:57 +0100 Subject: [PATCH] test --- linphone-desktop/resources.qrc | 1 + .../ui/views/App/Main/MainWindow.qml | 257 ++++++++++-------- .../ui/views/App/Main/MainWindowMenuBar.qml | 11 + 3 files changed, 149 insertions(+), 120 deletions(-) create mode 100644 linphone-desktop/ui/views/App/Main/MainWindowMenuBar.qml diff --git a/linphone-desktop/resources.qrc b/linphone-desktop/resources.qrc index 98990302a..cbc418946 100644 --- a/linphone-desktop/resources.qrc +++ b/linphone-desktop/resources.qrc @@ -303,6 +303,7 @@ ui/views/App/Main/Contacts.qml ui/views/App/Main/Conversation.qml ui/views/App/Main/Home.qml + ui/views/App/Main/MainWindowMenuBar.qml ui/views/App/Main/MainWindow.qml ui/views/App/ManageAccounts.qml ui/views/App/qmldir diff --git a/linphone-desktop/ui/views/App/Main/MainWindow.qml b/linphone-desktop/ui/views/App/Main/MainWindow.qml index 94311d681..8105f0539 100644 --- a/linphone-desktop/ui/views/App/Main/MainWindow.qml +++ b/linphone-desktop/ui/views/App/Main/MainWindow.qml @@ -2,6 +2,8 @@ import QtQuick 2.7 import QtQuick.Controls 2.0 import QtQuick.Layouts 1.3 +import QtQuick.Controls 1.4 as Controls1 + import Common 1.0 import Linphone 1.0 import Utils 1.0 @@ -10,7 +12,7 @@ import App.Styles 1.0 // ============================================================================= -ApplicationWindow { +Controls1.ApplicationWindow { id: window property string _currentView: '' @@ -62,7 +64,7 @@ ApplicationWindow { } function _setView (view, props) { - window.show() + window.setVisible(true) window.requestActivate() collapse.setCollapsed(true) @@ -84,145 +86,160 @@ ApplicationWindow { onActiveFocusItemChanged: activeFocusItem == null && smartSearchBar.hideMenu() // --------------------------------------------------------------------------- - // Toolbar properties. + // Menu bar. // --------------------------------------------------------------------------- - header: ToolBar { - background: MainWindowStyle.toolBar.background - height: MainWindowStyle.toolBar.height + menuBar: MainWindowMenuBar {} - RowLayout { - anchors { - fill: parent - leftMargin: MainWindowStyle.toolBar.leftMargin - rightMargin: MainWindowStyle.toolBar.rightMargin - } - spacing: MainWindowStyle.toolBar.spacing - Collapse { - id: collapse - - Layout.fillHeight: parent.height - target: window - targetHeight: MainWindowStyle.minimumHeight - } - - AccountStatus { - id: accountStatus - - Layout.fillHeight: parent.height - Layout.preferredWidth: MainWindowStyle.accountStatus.width - - account: AccountSettingsModel - - TooltipArea { - text: AccountSettingsModel.sipAddress - } - - onClicked: Utils.openWindow('ManageAccounts', window) - } - - Column { - width: MainWindowStyle.autoAnswerStatus.width - - Icon { - icon: SettingsModel.autoAnswerStatus - ? 'auto_answer' - : '' - iconSize: MainWindowStyle.autoAnswerStatus.iconSize - } - - Text { - clip: true - font { - pointSize: MainWindowStyle.autoAnswerStatus.text.fontSize - } - text: qsTr('autoAnswerStatus') - width: parent.width - color: MainWindowStyle.autoAnswerStatus.text.color - } - } - - SmartSearchBar { - id: smartSearchBar - - Layout.fillWidth: true - entryHeight: MainWindowStyle.searchBox.entryHeight - maxMenuHeight: MainWindowStyle.searchBox.maxHeight - placeholderText: qsTr('mainSearchBarPlaceholder') - - model: SmartSearchBarModel {} - - onAddContact: window.setView('ContactEdit', { - sipAddress: sipAddress - }) - - onLaunchCall: CallsListModel.launchAudioCall(sipAddress) - onLaunchChat: window.setView('Conversation', { - sipAddress: sipAddress - }) - - onLaunchVideoCall: CallsListModel.launchVideoCall(sipAddress) - - onEntryClicked: window.setView(entry.contact ? 'ContactEdit' : 'Conversation', { - sipAddress: entry.sipAddress - }) - } - } - } - - // --------------------------------------------------------------------------- - // Content. - // --------------------------------------------------------------------------- - - RowLayout { + ColumnLayout { anchors.fill: parent spacing: 0 - // Main menu. - ColumnLayout { - Layout.fillHeight: true - Layout.maximumWidth: MainWindowStyle.menu.width - Layout.preferredWidth: MainWindowStyle.menu.width - spacing: 0 + // ------------------------------------------------------------------------- + // Toolbar properties. + // ------------------------------------------------------------------------- - Menu { - id: menu + ToolBar { + background: MainWindowStyle.toolBar.background + Layout.preferredHeight: MainWindowStyle.toolBar.height + Layout.fillWidth: true - entryHeight: MainWindowStyle.menu.entryHeight - entryWidth: MainWindowStyle.menu.width + RowLayout { + anchors { + fill: parent + leftMargin: MainWindowStyle.toolBar.leftMargin + rightMargin: MainWindowStyle.toolBar.rightMargin + } + spacing: MainWindowStyle.toolBar.spacing - entries: [{ - entryName: qsTr('homeEntry'), - icon: 'home' - }, { - entryName: qsTr('contactsEntry'), - icon: 'contact' - }] + Collapse { + id: collapse - onEntrySelected: !entry ? setView('Home') : setView('Contacts') - } + Layout.fillHeight: parent.height + target: window + targetHeight: MainWindowStyle.minimumHeight + } - // History. - Timeline { - id: timeline + AccountStatus { + id: accountStatus - Layout.fillHeight: true - Layout.fillWidth: true - model: TimelineModel + Layout.fillHeight: parent.height + Layout.preferredWidth: MainWindowStyle.accountStatus.width - onEntrySelected: setView('Conversation', { sipAddress: entry }) + account: AccountSettingsModel + + TooltipArea { + text: AccountSettingsModel.sipAddress + } + + onClicked: Utils.openWindow('ManageAccounts', window) + } + + Column { + width: MainWindowStyle.autoAnswerStatus.width + + Icon { + icon: SettingsModel.autoAnswerStatus + ? 'auto_answer' + : '' + iconSize: MainWindowStyle.autoAnswerStatus.iconSize + } + + Text { + clip: true + font { + pointSize: MainWindowStyle.autoAnswerStatus.text.fontSize + } + text: qsTr('autoAnswerStatus') + width: parent.width + color: MainWindowStyle.autoAnswerStatus.text.color + } + } + + SmartSearchBar { + id: smartSearchBar + + Layout.fillWidth: true + entryHeight: MainWindowStyle.searchBox.entryHeight + maxMenuHeight: MainWindowStyle.searchBox.maxHeight + placeholderText: qsTr('mainSearchBarPlaceholder') + + model: SmartSearchBarModel {} + + onAddContact: window.setView('ContactEdit', { + sipAddress: sipAddress + }) + + onLaunchCall: CallsListModel.launchAudioCall(sipAddress) + onLaunchChat: window.setView('Conversation', { + sipAddress: sipAddress + }) + + onLaunchVideoCall: CallsListModel.launchVideoCall(sipAddress) + + onEntryClicked: window.setView(entry.contact ? 'ContactEdit' : 'Conversation', { + sipAddress: entry.sipAddress + }) + } } } - // Main content. - Loader { - id: contentLoader + // ------------------------------------------------------------------------- + // Content. + // ------------------------------------------------------------------------- + RowLayout { Layout.fillHeight: true Layout.fillWidth: true - Component.onCompleted: setView('Home') + spacing: 0 + + // Main menu. + ColumnLayout { + Layout.fillHeight: true + Layout.maximumWidth: MainWindowStyle.menu.width + Layout.preferredWidth: MainWindowStyle.menu.width + spacing: 0 + + Menu { + id: menu + + entryHeight: MainWindowStyle.menu.entryHeight + entryWidth: MainWindowStyle.menu.width + + entries: [{ + entryName: qsTr('homeEntry'), + icon: 'home' + }, { + entryName: qsTr('contactsEntry'), + icon: 'contact' + }] + + onEntrySelected: !entry ? setView('Home') : setView('Contacts') + } + + // History. + Timeline { + id: timeline + + Layout.fillHeight: true + Layout.fillWidth: true + model: TimelineModel + + onEntrySelected: setView('Conversation', { sipAddress: entry }) + } + } + + // Main content. + Loader { + id: contentLoader + + Layout.fillHeight: true + Layout.fillWidth: true + + Component.onCompleted: setView('Home') + } } } } diff --git a/linphone-desktop/ui/views/App/Main/MainWindowMenuBar.qml b/linphone-desktop/ui/views/App/Main/MainWindowMenuBar.qml new file mode 100644 index 000000000..69260e63a --- /dev/null +++ b/linphone-desktop/ui/views/App/Main/MainWindowMenuBar.qml @@ -0,0 +1,11 @@ + + import QtQuick.Controls 1.4 +MenuBar { + + Menu { + title: "File" + MenuItem { text: "Open..." } + MenuItem { text: "Close" } + } + +}