diff --git a/src/app/AccountMigrationView.qml b/src/app/AccountMigrationView.qml index c3c5f6bf97b4a25d7a4e7947e22a789e78c89f99..a2de84f4ef4b69a33b87fa181cda53f203843597 100644 --- a/src/app/AccountMigrationView.qml +++ b/src/app/AccountMigrationView.qml @@ -15,16 +15,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Window import QtQuick.Controls import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "commoncomponents" // Account Migration Dialog for migrating account @@ -42,16 +39,13 @@ BaseView { signal loaderSourceChangeRequested(int sourceToLoad) function slotMigrationButtonClicked() { - stackedWidget.currentIndex = AccountMigrationView.AccountMigrationStep.Synching - - AccountAdapter.setArchivePasswordAsync( - CurrentAccountToMigrate.accountId, passwordInputLineEdit.text) + stackedWidget.currentIndex = AccountMigrationView.AccountMigrationStep.Synching; + AccountAdapter.setArchivePasswordAsync(CurrentAccountToMigrate.accountId, passwordInputLineEdit.text); } function slotDeleteButtonClicked() { - stackedWidget.currentIndex = AccountMigrationView.AccountMigrationStep.Synching - - CurrentAccountToMigrate.removeCurrentAccountToMigrate() + stackedWidget.currentIndex = AccountMigrationView.AccountMigrationStep.Synching; + CurrentAccountToMigrate.removeCurrentAccountToMigrate(); } Timer { @@ -61,9 +55,8 @@ BaseView { repeat: false onTriggered: { - stackedWidget.currentIndex = - AccountMigrationView.AccountMigrationStep.PasswordEnter - successState = true + stackedWidget.currentIndex = AccountMigrationView.AccountMigrationStep.PasswordEnter; + successState = true; } } @@ -73,24 +66,19 @@ BaseView { target: CurrentAccountToMigrate function onMigrationEnded(ok) { - successState = ok - + successState = ok; if (ok) { - passwordInputLineEdit.clear() - - stackedWidget.currentIndex = - AccountMigrationView.AccountMigrationStep.PasswordEnter + passwordInputLineEdit.clear(); + stackedWidget.currentIndex = AccountMigrationView.AccountMigrationStep.PasswordEnter; } else { - timerFailureReturn.restart() + timerFailureReturn.restart(); } } function onCurrentAccountToMigrateRemoved() { - successState = true - passwordInputLineEdit.clear() - - stackedWidget.currentIndex = - AccountMigrationView.AccountMigrationStep.PasswordEnter + successState = true; + passwordInputLineEdit.clear(); + stackedWidget.currentIndex = AccountMigrationView.AccountMigrationStep.PasswordEnter; } } @@ -122,7 +110,7 @@ BaseView { font.pointSize: JamiTheme.headerFontSize font.kerning: true - wrapMode:Text.Wrap + wrapMode: Text.Wrap text: JamiStrings.authenticationRequired @@ -138,7 +126,7 @@ BaseView { font.pointSize: JamiTheme.textFontSize font.kerning: true - wrapMode:Text.Wrap + wrapMode: Text.Wrap text: JamiStrings.migrationReason @@ -193,9 +181,9 @@ BaseView { text: { if (CurrentAccountToMigrate.alias.length !== 0) { - return CurrentAccountToMigrate.alias + return CurrentAccountToMigrate.alias; } else { - return JamiStrings.notAvailable + return JamiStrings.notAvailable; } } font.pointSize: JamiTheme.textFontSize @@ -228,11 +216,11 @@ BaseView { text: { if (CurrentAccountToMigrate.username.length !== 0) { - return CurrentAccountToMigrate.username + return CurrentAccountToMigrate.username; } else if (CurrentAccountToMigrate.managerUsername.length !== 0) { - return CurrentAccountToMigrate.managerUsername + return CurrentAccountToMigrate.managerUsername; } else { - return JamiStrings.notAvailable + return JamiStrings.notAvailable; } } font.pointSize: JamiTheme.textFontSize @@ -265,9 +253,9 @@ BaseView { text: { if (CurrentAccountToMigrate.managerUri.length !== 0) { - return CurrentAccountToMigrate.managerUri + return CurrentAccountToMigrate.managerUri; } else { - return JamiStrings.notAvailable + return JamiStrings.notAvailable; } } font.pointSize: JamiTheme.textFontSize @@ -323,7 +311,7 @@ BaseView { preferredWidth: JamiTheme.preferredFieldWidth / 2 - color: enabled? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey + color: enabled ? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey hoveredColor: JamiTheme.buttonTintedBlackHovered pressedColor: JamiTheme.buttonTintedBlackPressed secondary: true @@ -368,7 +356,7 @@ BaseView { height: stackedWidget.height Layout.alignment: Qt.AlignHCenter - RowLayout{ + RowLayout { spacing: 8 Layout.alignment: Qt.AlignHCenter @@ -417,8 +405,7 @@ BaseView { Layout.bottomMargin: 80 color: successState ? JamiTheme.textColor : JamiTheme.redColor - text: successState ? JamiStrings.inProgress : - JamiStrings.authenticationFailed + text: successState ? JamiStrings.inProgress : JamiStrings.authenticationFailed font.pointSize: JamiTheme.textFontSize + 5 font.kerning: true diff --git a/src/app/DaemonReconnectWindow.qml b/src/app/DaemonReconnectWindow.qml index ac6633876b205d0a07cd8a7fddbf3f34d91d341b..9c523018be34cf00be8b2f7bce31ee46da971ec0 100644 --- a/src/app/DaemonReconnectWindow.qml +++ b/src/app/DaemonReconnectWindow.qml @@ -15,15 +15,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts import Qt5Compat.GraphicalEffects - import net.jami.Constants 1.1 import net.jami.Models 1.1 - import "commoncomponents" ApplicationWindow { @@ -46,10 +43,9 @@ ApplicationWindow { } function getTextBoundingRect(font, text) { - textMetrics.font = font - textMetrics.text = text - - return textMetrics.boundingRect + textMetrics.font = font; + textMetrics.text = text; + return textMetrics.boundingRect; } ResponsiveImage { @@ -89,16 +85,13 @@ ApplicationWindow { Layout.alignment: Qt.AlignHCenter | Qt.AlignTop Layout.topMargin: preferredMargin - text: connectionFailed ? - JamiStrings.reconnectWarn : - JamiStrings.reconnectTry + text: connectionFailed ? JamiStrings.reconnectWarn : JamiStrings.reconnectTry font.pointSize: 11 horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter Component.onCompleted: { - contentRect.implicitWidth = getTextBoundingRect( - font, text).width + 100 + contentRect.implicitWidth = getTextBoundingRect(font, text).width + 100; } } @@ -143,17 +136,17 @@ ApplicationWindow { anchors.centerIn: parent width: { - return (parent.width / 2 - 18) * 2 + return (parent.width / 2 - 18) * 2; } text: JamiString.optionOk color: { if (btnOk.hovered) - return btnOk.hoveredColor + return btnOk.hoveredColor; if (btnOk.checked) - return btnOk.pressedColor - return btnOk.normalColor + return btnOk.pressedColor; + return btnOk.normalColor; } font: root.font horizontalAlignment: Text.AlignHCenter @@ -169,10 +162,10 @@ ApplicationWindow { color: "transparent" border.color: { if (btnOk.hovered) - return btnOk.hoveredColor + return btnOk.hoveredColor; if (btnOk.checked) - return btnOk.pressedColor - return btnOk.normalColor + return btnOk.pressedColor; + return btnOk.normalColor; } radius: 4 } @@ -186,22 +179,21 @@ ApplicationWindow { function onShowDaemonReconnectPopup(visible) { if (visible) - popup.open() + popup.open(); else { - popup.close() - Qt.quit() + popup.close(); + Qt.quit(); } } function onDaemonReconnectFailed() { - root.connectionFailed = true + root.connectionFailed = true; } } Component.onCompleted: { - DBusErrorHandler.setActive(true) - - x = Screen.width / 2 - width / 2 - y = Screen.height / 2 - height / 2 + DBusErrorHandler.setActive(true); + x = Screen.width / 2 - width / 2; + y = Screen.height / 2 - height / 2; } } diff --git a/src/app/MainApplicationWindow.qml b/src/app/MainApplicationWindow.qml index c141bb0ca55397535a354241f26310e547199fab..254ed801a04dd21004955ac82fb69dd7353a748a 100644 --- a/src/app/MainApplicationWindow.qml +++ b/src/app/MainApplicationWindow.qml @@ -19,19 +19,16 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Window import QtQuick.Controls import QtQuick.Layouts import Qt5Compat.GraphicalEffects - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Enums 1.1 import net.jami.Helpers 1.1 import net.jami.Constants 1.1 - import "mainview" import "mainview/components" import "wizardview" @@ -41,7 +38,7 @@ ApplicationWindow { id: root enum LoadedSource { - WizardView = 0, + WizardView, MainView, AccountMigrationView, None @@ -51,7 +48,8 @@ ApplicationWindow { property LayoutManager layoutManager: LayoutManager { appContainer: appContainer } - property ViewManager viewManager: ViewManager {} + property ViewManager viewManager: ViewManager { + } property ViewCoordinator viewCoordinator: ViewCoordinator { viewManager: root.viewManager } @@ -60,58 +58,53 @@ ApplicationWindow { property bool allowVisibleWindow: true function checkLoadedSource() { - var sourceString = mainApplicationLoader.source.toString() - + var sourceString = mainApplicationLoader.source.toString(); if (sourceString === JamiQmlUtils.wizardViewLoadPath) - return MainApplicationWindow.LoadedSource.WizardView + return MainApplicationWindow.LoadedSource.WizardView; else if (sourceString === JamiQmlUtils.mainViewLoadPath) - return MainApplicationWindow.LoadedSource.MainView - - return MainApplicationWindow.LoadedSource.None + return MainApplicationWindow.LoadedSource.MainView; + return MainApplicationWindow.LoadedSource.None; } function startClient() { if (UtilsAdapter.getAccountListSize() !== 0) { - setMainLoaderSource(JamiQmlUtils.mainViewLoadPath) + setMainLoaderSource(JamiQmlUtils.mainViewLoadPath); } else { - setMainLoaderSource(JamiQmlUtils.wizardViewLoadPath) + setMainLoaderSource(JamiQmlUtils.wizardViewLoadPath); } } function setMainLoaderSource(source) { if (checkLoadedSource() === MainApplicationWindow.LoadedSource.MainView) { - cleanupMainView() + cleanupMainView(); } - mainApplicationLoader.setSource(source) + mainApplicationLoader.setSource(source); } function cleanupMainView() { // Save the main view window size if loading anything else. - layoutManager.saveWindowSettings() + layoutManager.saveWindowSettings(); // Unload any created views used by the main view. - viewCoordinator.deinit() + viewCoordinator.deinit(); } function close(force = false) { // If we're in the onboarding wizard or 'MinimizeOnClose' // is set, then we can quit - if (force || !UtilsAdapter.getAppValue(Settings.MinimizeOnClose) || - !UtilsAdapter.getAccountListSize()) { + if (force || !UtilsAdapter.getAppValue(Settings.MinimizeOnClose) || !UtilsAdapter.getAccountListSize()) { if (checkLoadedSource() === MainApplicationWindow.LoadedSource.MainView) { - cleanupMainView() + cleanupMainView(); } - Qt.quit() + Qt.quit(); } else { - layoutManager.closeToTray() + layoutManager.closeToTray(); } } title: JamiStrings.appTitle - visible: mainApplicationLoader.status === Loader.Ready - && windowSettingsLoaded - && allowVisibleWindow + visible: mainApplicationLoader.status === Loader.Ready && windowSettingsLoaded && allowVisibleWindow // To facilitate reparenting of the callview during // fullscreen mode, we need QQuickItem based object. @@ -134,7 +127,7 @@ ApplicationWindow { target: viewCoordinator function onRequestAppWindowWizardView() { - setMainLoaderSource(JamiQmlUtils.wizardViewLoadPath) + setMainLoaderSource(JamiQmlUtils.wizardViewLoadPath); } } @@ -144,12 +137,12 @@ ApplicationWindow { target: CurrentAccountToMigrate function onAccountNeedsMigration(accountId) { - viewCoordinator.present("AccountMigrationView") + viewCoordinator.present("AccountMigrationView"); } function onAllMigrationsFinished() { - viewCoordinator.dismiss("AccountMigrationView") - startClient() + viewCoordinator.dismiss("AccountMigrationView"); + startClient(); } } @@ -158,11 +151,11 @@ ApplicationWindow { function onLoaderSourceChangeRequested(sourceToLoad) { if (sourceToLoad === MainApplicationWindow.LoadedSource.WizardView) - setMainLoaderSource(JamiQmlUtils.wizardViewLoadPath) + setMainLoaderSource(JamiQmlUtils.wizardViewLoadPath); else if (sourceToLoad === MainApplicationWindow.LoadedSource.AccountMigrationView) - setMainLoaderSource(JamiQmlUtils.accountMigrationViewLoadPath) + setMainLoaderSource(JamiQmlUtils.accountMigrationViewLoadPath); else - setMainLoaderSource(JamiQmlUtils.mainViewLoadPath) + setMainLoaderSource(JamiQmlUtils.mainViewLoadPath); } } @@ -175,39 +168,39 @@ ApplicationWindow { // - window screen will default to the primary // - the window will showNormal once windowSettingsLoaded is // set to true(then forcing visible to true) - appWindow.width = JamiTheme.wizardViewMinWidth - appWindow.height = JamiTheme.wizardViewMinHeight - appWindow.minimumWidth = JamiTheme.wizardViewMinWidth - appWindow.minimumHeight = JamiTheme.wizardViewMinHeight + appWindow.width = JamiTheme.wizardViewMinWidth; + appWindow.height = JamiTheme.wizardViewMinHeight; + appWindow.minimumWidth = JamiTheme.wizardViewMinWidth; + appWindow.minimumHeight = JamiTheme.wizardViewMinHeight; } else { // Main window, load any valid app settings, and allow the // layoutManager to handle as much as possible. - layoutManager.restoreWindowSettings() + layoutManager.restoreWindowSettings(); // Present the welcome view once the viewCoordinator is setup. - viewCoordinator.initialized.connect(function() { - viewCoordinator.preload("SidePanel") - viewCoordinator.preload("SettingsSidePanel") - viewCoordinator.present("WelcomePage") - viewCoordinator.preload("ConversationView") - }) + viewCoordinator.initialized.connect(function () { + viewCoordinator.preload("SidePanel"); + viewCoordinator.preload("SettingsSidePanel"); + viewCoordinator.present("WelcomePage"); + viewCoordinator.preload("ConversationView"); + }); // Set the viewCoordinator's root item. - viewCoordinator.init(item) + viewCoordinator.init(item); if (CurrentAccountToMigrate.accountToMigrateListSize > 0) - viewCoordinator.present("AccountMigrationView") + viewCoordinator.present("AccountMigrationView"); } if (Qt.platform.os.toString() === "osx") { - MainApplication.setEventFilter() + MainApplication.setEventFilter(); } // This will trigger `visible = true`. - windowSettingsLoaded = true + windowSettingsLoaded = true; // Quiet check for updates on start if set to. if (Qt.platform.os.toString() !== "osx") { if (UtilsAdapter.getAppValue(Settings.AutoUpdate)) { - UpdateManager.checkForUpdates(true) - UpdateManager.setAutoUpdateCheck(true) + UpdateManager.checkForUpdates(true); + UpdateManager.setAutoUpdateCheck(true); } } @@ -220,14 +213,14 @@ ApplicationWindow { target: LRCInstance function onRestoreAppRequested() { - requestActivate() - layoutManager.restoreApp() + requestActivate(); + layoutManager.restoreApp(); } function onNotificationClicked() { - requestActivate() - raise() - layoutManager.restoreApp() + requestActivate(); + raise(); + layoutManager.restoreApp(); } } @@ -235,102 +228,93 @@ ApplicationWindow { target: MainApplication function onCloseRequested() { - close(true) + close(true); } function onSearchAndSelect(request) { - ConversationsAdapter.setFilterAndSelect(request) + ConversationsAdapter.setFilterAndSelect(request); } } Connections { target: { - if (Qt.platform.os.toString() !== "windows" && Qt.platform.os.toString() !== "osx") - return DBusErrorHandler - return null + if (Qt.platform.os.toString() !== "windows" && Qt.platform.os.toString() !== "osx") + return DBusErrorHandler; + return null; } ignoreUnknownSignals: true function onShowDaemonReconnectPopup(visible) { if (visible) { - viewCoordinator.presentDialog( - appWindow, - "commoncomponents/DaemonReconnectPopup.qml") + viewCoordinator.presentDialog(appWindow, "commoncomponents/DaemonReconnectPopup.qml"); } } } function presentUpdateInfoDialog(infoText) { - viewCoordinator.presentDialog( - appWindow, - "commoncomponents/SimpleMessageDialog.qml", - { - title: JamiStrings.updateDialogTitle, - infoText: infoText, - buttonTitles: [JamiStrings.optionOk], - buttonStyles: [SimpleMessageDialog.ButtonStyle.TintedBlue], - buttonCallBacks: [] - }) + viewCoordinator.presentDialog(appWindow, "commoncomponents/SimpleMessageDialog.qml", { + "title": JamiStrings.updateDialogTitle, + "infoText": infoText, + "buttonTitles": [JamiStrings.optionOk], + "buttonStyles": [SimpleMessageDialog.ButtonStyle.TintedBlue], + "buttonCallBacks": [] + }); } Connections { target: UpdateManager function onUpdateDownloadStarted() { - viewCoordinator.presentDialog( - appWindow, - "settingsview/components/UpdateDownloadDialog.qml", - {title: JamiStrings.updateDialogTitle}) + viewCoordinator.presentDialog(appWindow, "settingsview/components/UpdateDownloadDialog.qml", { + "title": JamiStrings.updateDialogTitle + }); } function onUpdateCheckReplyReceived(ok, found) { if (!ok) { - presentUpdateInfoDialog(JamiStrings.updateCheckError) - return + presentUpdateInfoDialog(JamiStrings.updateCheckError); + return; } if (!found) { - presentUpdateInfoDialog(JamiStrings.updateNotFound) + presentUpdateInfoDialog(JamiStrings.updateNotFound); } else { - viewCoordinator.presentDialog( - appWindow, - "commoncomponents/SimpleMessageDialog.qml", - { - title: JamiStrings.updateDialogTitle, - infoText: JamiStrings.updateFound, - buttonTitles: [JamiStrings.optionUpgrade, JamiStrings.optionLater], - buttonStyles: [ - SimpleMessageDialog.ButtonStyle.TintedBlue, - SimpleMessageDialog.ButtonStyle.TintedBlue - ], - buttonCallBacks: [function() {UpdateManager.applyUpdates()}] - }) + viewCoordinator.presentDialog(appWindow, "commoncomponents/SimpleMessageDialog.qml", { + "title": JamiStrings.updateDialogTitle, + "infoText": JamiStrings.updateFound, + "buttonTitles": [JamiStrings.optionUpgrade, JamiStrings.optionLater], + "buttonStyles": [SimpleMessageDialog.ButtonStyle.TintedBlue, SimpleMessageDialog.ButtonStyle.TintedBlue], + "buttonCallBacks": [function () { + UpdateManager.applyUpdates(); + }] + }); } } function onUpdateErrorOccurred(error) { presentUpdateInfoDialog((function () { - switch(error){ - case NetWorkManager.ACCESS_DENIED: - return JamiStrings.genericError - case NetWorkManager.DISCONNECTED: - return JamiStrings.networkDisconnected - case NetWorkManager.NETWORK_ERROR: - return JamiStrings.updateNetworkError - case NetWorkManager.SSL_ERROR: - return JamiStrings.updateSSLError - case NetWorkManager.CANCELED: - return JamiStrings.updateDownloadCanceled - default: return {} - } - })()) + switch (error) { + case NetWorkManager.ACCESS_DENIED: + return JamiStrings.genericError; + case NetWorkManager.DISCONNECTED: + return JamiStrings.networkDisconnected; + case NetWorkManager.NETWORK_ERROR: + return JamiStrings.updateNetworkError; + case NetWorkManager.SSL_ERROR: + return JamiStrings.updateSSLError; + case NetWorkManager.CANCELED: + return JamiStrings.updateDownloadCanceled; + default: + return {}; + } + })()); } } onClosing: root.close() Component.onCompleted: { - startClient() - if (Qt.platform.os.toString() !== "windows" && Qt.platform.os.toString() !== "osx") - DBusErrorHandler.setActive(true) + startClient(); + if (Qt.platform.os.toString() !== "windows" && Qt.platform.os.toString() !== "osx") + DBusErrorHandler.setActive(true); } } diff --git a/src/app/ViewCoordinator.qml b/src/app/ViewCoordinator.qml index 59e9925ea7c56ad6484a4afdf6249574a3590eb3..476c2cf3ba852a97a7f2f5d2e3682830badf01a5 100644 --- a/src/app/ViewCoordinator.qml +++ b/src/app/ViewCoordinator.qml @@ -14,14 +14,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Constants 1.1 import net.jami.Models 1.1 - import "commoncomponents" QtObject { @@ -41,82 +38,87 @@ QtObject { "WizardView": "wizardview/WizardView.qml", "AccountMigrationView": "AccountMigrationView.qml", "SettingsView": "settingsview/SettingsView.qml", - "SettingsSidePanel": "settingsview/SettingsSidePanel.qml", + "SettingsSidePanel": "settingsview/SettingsSidePanel.qml" } // The `main` view of the application window. property StackView rootView - property var currentViewName: rootView && rootView.currentItem && - rootView.currentItem.objectName || null + property var currentViewName: rootView && rootView.currentItem && rootView.currentItem.objectName || null function init(mainStackView) { rootView = Qt.createQmlObject(`import QtQuick; import QtQuick.Controls - StackView { anchors.fill: parent }`, - mainStackView) - initialized() + StackView { anchors.fill: parent }`, mainStackView); + initialized(); } function deinit() { - viewManager.destroyAllViews() - if (rootView) rootView.destroy() + viewManager.destroyAllViews(); + if (rootView) + rootView.destroy(); } // Finds a view and gets its index within the StackView it's in. function getStackIndex(viewName) { for (const [key, value] of Object.entries(viewManager.views)) { if (value.objectName === viewName) { - return value.StackView.index + return value.StackView.index; } } - return -1 + return -1; } // Create, present, and return a dialog object. - function presentDialog(parent, path, props={}) { + function presentDialog(parent, path, props = {}) { // Open the dialog once the object is created - return viewManager.createView(path, parent, function(obj) { - const doneCb = function() { viewManager.destroyView(path) } - if (obj.closed !== undefined) { - obj.closed.connect(doneCb) - } else { - if (obj.accepted !== undefined) { obj.accepted.connect(doneCb) } - if (obj.rejected !== undefined) { obj.rejected.connect(doneCb) } - } - obj.open() - }, props) + return viewManager.createView(path, parent, function (obj) { + const doneCb = function () { + viewManager.destroyView(path); + }; + if (obj.closed !== undefined) { + obj.closed.connect(doneCb); + } else { + if (obj.accepted !== undefined) { + obj.accepted.connect(doneCb); + } + if (obj.rejected !== undefined) { + obj.rejected.connect(doneCb); + } + } + obj.open(); + }, props); } // Present a view by name. function present(viewName, props) { - const path = resources[viewName] + const path = resources[viewName]; // Check if the current view should inhibit the presentation of this view. if (rootView.currentItem && rootView.currentItem.inhibits.includes(viewName)) { - print("inhibiting view:", viewName) - return + print("inhibiting view:", viewName); + return; } // If the view already exists in the StackView, the function will attempt // to navigate to its StackView position by dismissing elevated views. - if (rootView.find(function(item) { - return item.objectName === viewName; - }, StackView.DontLoad)) { - const viewIndex = getStackIndex(viewName) + if (rootView.find(function (item) { + return item.objectName === viewName; + }, StackView.DontLoad)) { + const viewIndex = getStackIndex(viewName); for (var i = (rootView.depth - 1); i > viewIndex; i--) { - dismissObj(rootView.get(i, StackView.DontLoad)) + dismissObj(rootView.get(i, StackView.DontLoad)); } - return + return; } - - if (!viewManager.createView(path, rootView, function(view) { - // push the view onto the stack if it's not already there - if (rootView.currentItem !== view) { - rootView.push(view, StackView.Immediate) - } - if (!view.managed) view.presented() - }, props)) { - print("could not create view:", viewName) + if (!viewManager.createView(path, rootView, function (view) { + // push the view onto the stack if it's not already there + if (rootView.currentItem !== view) { + rootView.push(view, StackView.Immediate); + } + if (!view.managed) + view.presented(); + }, props)) { + print("could not create view:", viewName); } } @@ -124,78 +126,82 @@ QtObject { function dismissObj(obj) { // Check if it makes sense to remove this view at all. if (obj.StackView.view !== rootView || !viewManager.viewCount()) { - return + return; } // If we are dismissing a view that is not at the top of the stack, // we need to store each of the views on top into a temporary stack // and then restore them after the view is dismissed. - const viewIndex = obj.StackView.index - var tempStack = [] + const viewIndex = obj.StackView.index; + var tempStack = []; for (var i = (rootView.depth - 1); i > viewIndex; i--) { - var item = rootView.pop(StackView.Immediate) - tempStack.push(item) + var item = rootView.pop(StackView.Immediate); + tempStack.push(item); } // And we define a function to restore and resolve the views. var resolveStack = () => { for (var i = 0; i < tempStack.length; i++) { - rootView.push(tempStack[i], StackView.Immediate) + rootView.push(tempStack[i], StackView.Immediate); } - if (rootView.depth > 0) rootView.currentItem.presented() - } + if (rootView.depth > 0) + rootView.currentItem.presented(); + }; // Now we can dismiss the view at the top of the stack. - const depth = rootView.depth + const depth = rootView.depth; if (obj === rootView.get(depth - 1, StackView.DontLoad)) { - var view + var view; if (rootView.depth === 1) { - view = rootView.currentItem - rootView.clear() - } else view = rootView.pop(StackView.Immediate) + view = rootView.currentItem; + rootView.clear(); + } else + view = rootView.pop(StackView.Immediate); if (!view) { - print("could not pop view:", obj.objectName) - resolveStack() - return + print("could not pop view:", obj.objectName); + resolveStack(); + return; } // If the view is managed, we can destroy it, otherwise, it can // be reused and destroyed by it's parent. if (view.managed) { - var objectName = view ? view.objectName : obj.objectName + var objectName = view ? view.objectName : obj.objectName; if (!viewManager.destroyView(resources[objectName])) { - print("could not destroy view:", objectName) + print("could not destroy view:", objectName); } - } else view.dismissed() + } else + view.dismissed(); } - resolveStack() + resolveStack(); } // Dismiss a view by name or the top view if unspecified. - function dismiss(viewName=undefined) { - if (!rootView || rootView.depth === 0) return + function dismiss(viewName = undefined) { + if (!rootView || rootView.depth === 0) + return; if (viewName !== undefined) { - const depth = rootView.depth + const depth = rootView.depth; for (var i = (depth - 1); i >= 0; i--) { - const view = rootView.get(i, StackView.DontLoad) + const view = rootView.get(i, StackView.DontLoad); if (view.objectName === viewName) { - dismissObj(view) - return + dismissObj(view); + return; } } - return + return; } else { - dismissObj(rootView.currentItem) + dismissObj(rootView.currentItem); } } function getView(viewName) { - return viewManager.getView(viewName) + return viewManager.getView(viewName); } - // Load a view without presenting it. - function preload(viewName) { - if (!viewManager.createView(resources[viewName], null)) { - console.log("Failed to load view: " + viewName) - } - } + // Load a view without presenting it. + function preload(viewName) { + if (!viewManager.createView(resources[viewName], null)) { + console.log("Failed to load view: " + viewName); + } + } } diff --git a/src/app/ViewManager.qml b/src/app/ViewManager.qml index 310af0e94756c5e3a08fc1c4ed224c2ca367ef37..b6ce509622fc372e908583cdd00791cfeac62540 100644 --- a/src/app/ViewManager.qml +++ b/src/app/ViewManager.qml @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick QtObject { @@ -27,67 +26,64 @@ QtObject { // The number of views loaded (`views` is only resized). function viewCount() { - return Object.keys(views).length + return Object.keys(views).length; } // Destroy all views. function destroyAllViews() { for (var path in views) { - destroyView(path) + destroyView(path); } } - function createView(path, parent=null, cb=null, props={}) { + function createView(path, parent = null, cb = null, props = {}) { if (views.hasOwnProperty(path)) { // an instance of <path> already exists if (cb !== null) { - cb(views[path]) + cb(views[path]); } - return views[path] + return views[path]; } - - const component = Qt.createComponent(Qt.resolvedUrl(path)) + const component = Qt.createComponent(Qt.resolvedUrl(path)); if (component.status === Component.Ready) { - const obj = component.createObject(parent, props) + const obj = component.createObject(parent, props); if (obj === null) { - print("error creating object") - return null + print("error creating object"); + return null; } - views[path] = obj + views[path] = obj; // Set the view name to the object name if it has one. - const viewName = obj.objectName.toString() !== '' ? - obj.objectName : - path.replace(/^.*[\\\/]/, '').replace(/\.[^/.]+$/, "") - viewPaths[viewName] = path + const viewName = obj.objectName.toString() !== '' ? obj.objectName : path.replace(/^.*[\\\/]/, '').replace(/\.[^/.]+$/, ""); + viewPaths[viewName] = path; if (cb !== null) { - cb(obj) + cb(obj); } - return views[path] + return views[path]; } - print("error creating component", path) - console.error(component.errorString()) - Qt.exit(1) - return null + print("error creating component", path); + console.error(component.errorString()); + Qt.exit(1); + return null; } function destroyView(path) { // The view may already have been destroyed. if (!views.hasOwnProperty(path)) { - return false + return false; } - views[path].destroy() - delete views[path] + views[path].destroy(); + delete views[path]; // Remove the view name from the viewPaths map. for (var viewName in viewPaths) { if (viewPaths[viewName] === path) { - delete viewPaths[viewName] - break + delete viewPaths[viewName]; + break; } } - return true + return true; } function getView(viewName) { - return views[viewPaths[viewName]] || null + return views[viewPaths[viewName]] || null; } } diff --git a/src/app/commoncomponents/Avatar.qml b/src/app/commoncomponents/Avatar.qml index 2d23ac44968a99320a34b1995f558cd450d07ca8..c495487d18f4e985c74445acb2a2cf60676b29f7 100644 --- a/src/app/commoncomponents/Avatar.qml +++ b/src/app/commoncomponents/Avatar.qml @@ -16,12 +16,10 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts import Qt5Compat.GraphicalEffects - import net.jami.Adapters 1.1 import net.jami.Constants 1.1 import net.jami.Helpers 1.1 @@ -29,7 +27,11 @@ import net.jami.Helpers 1.1 Item { id: root - enum Mode { Account, Contact, Conversation } + enum Mode { + Account, + Contact, + Conversation + } property int mode: Avatar.Mode.Account property alias sourceSize: image.sourceSize @@ -39,9 +41,12 @@ Item { readonly property string baseProviderPrefix: 'image://avatarImage' property string typePrefix: { switch (mode) { - case Avatar.Mode.Account: return 'account' - case Avatar.Mode.Contact: return 'contact' - case Avatar.Mode.Conversation: return 'conversation' + case Avatar.Mode.Account: + return 'account'; + case Avatar.Mode.Contact: + return 'contact'; + case Avatar.Mode.Conversation: + return 'conversation'; } } @@ -57,11 +62,11 @@ Item { function onAvatarUidChanged(id) { // filter this id only if (id !== root.imageId) - return + return; // get the updated uid forcing a new requestImage // call to the image provider - image.updateSource() + image.updateSource(); } } @@ -69,7 +74,7 @@ Item { target: CurrentScreenInfo function onDevicePixelRatioChanged() { - image.updateSource() + image.updateSource(); } } @@ -89,16 +94,14 @@ Item { function updateSource() { if (!imageId) - return - source = baseProviderPrefix + '/' + - typePrefix + divider + - imageId + divider + AvatarRegistry.getUid(imageId) + return; + source = baseProviderPrefix + '/' + typePrefix + divider + imageId + divider + AvatarRegistry.getUid(imageId); } opacity: status === Image.Ready scale: Math.min(image.opacity + 0.5, 1.0) - Behavior on opacity { + Behavior on opacity { NumberAnimation { from: 0 duration: JamiTheme.shortFadeDuration @@ -117,5 +120,5 @@ Item { size: root.width * JamiTheme.avatarPresenceRatio visible: showPresenceIndicator - } + } } diff --git a/src/app/commoncomponents/BackButton.qml b/src/app/commoncomponents/BackButton.qml index 6a1cab084176ada2fc64015321f4417678bfffa3..09f6b76f1d150383a2750e41e5c9fb78f52e13b2 100644 --- a/src/app/commoncomponents/BackButton.qml +++ b/src/app/commoncomponents/BackButton.qml @@ -15,10 +15,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls - import net.jami.Constants 1.1 PushButton { @@ -37,10 +35,9 @@ PushButton { toolTipText: JamiStrings.back Keys.onPressed: function (keyEvent) { - if (keyEvent.key === Qt.Key_Enter || - keyEvent.key === Qt.Key_Return) { - clicked() - keyEvent.accepted = true + if (keyEvent.key === Qt.Key_Enter || keyEvent.key === Qt.Key_Return) { + clicked(); + keyEvent.accepted = true; } } } diff --git a/src/app/commoncomponents/BaseModalDialog.qml b/src/app/commoncomponents/BaseModalDialog.qml index a504527fe83304e1a9ff45fa50bea6c2ab458419..421eca8bfb4c73092aa1661895c555aa710e7c1a 100644 --- a/src/app/commoncomponents/BaseModalDialog.qml +++ b/src/app/commoncomponents/BaseModalDialog.qml @@ -15,12 +15,10 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts import Qt5Compat.GraphicalEffects - import net.jami.Constants 1.1 Popup { @@ -49,9 +47,7 @@ Popup { // A popup is invisible until opened. visible: false - closePolicy: autoClose ? - (Popup.CloseOnEscape | Popup.CloseOnPressOutside) : - Popup.NoAutoClose + closePolicy: autoClose ? (Popup.CloseOnEscape | Popup.CloseOnPressOutside) : Popup.NoAutoClose Rectangle { id: container @@ -100,7 +96,7 @@ Popup { color: JamiTheme.transparentColor // Color animation for overlay when pop up is shown. - ColorAnimation on color { + ColorAnimation on color { to: JamiTheme.popupOverlayColor duration: 500 } @@ -120,13 +116,17 @@ Popup { enter: Transition { NumberAnimation { - properties: "opacity"; from: 0.0; to: 1.0 + properties: "opacity" + from: 0.0 + to: 1.0 duration: JamiTheme.shortFadeDuration } } exit: Transition { NumberAnimation { - properties: "opacity"; from: 1.0; to: 0.0 + properties: "opacity" + from: 1.0 + to: 0.0 duration: JamiTheme.shortFadeDuration } } diff --git a/src/app/commoncomponents/BaseView.qml b/src/app/commoncomponents/BaseView.qml index d535b4c600ce7954b6ffef9c7ad6fc1423dfc9b3..98e5302f739e0a1a71481ab0aa0e9bf82cc8145e 100644 --- a/src/app/commoncomponents/BaseView.qml +++ b/src/app/commoncomponents/BaseView.qml @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick Rectangle { @@ -28,11 +27,19 @@ Rectangle { // A list of view names that this view inhibits the presentation of. property var inhibits: [] - function dismiss() { viewCoordinator.dismiss(objectName) } + function dismiss() { + viewCoordinator.dismiss(objectName); + } signal presented signal dismissed - Component.onCompleted: { if (managed) presented() } - Component.onDestruction: { if (managed) dismissed() } + Component.onCompleted: { + if (managed) + presented(); + } + Component.onDestruction: { + if (managed) + dismissed(); + } } diff --git a/src/app/commoncomponents/BubbleLabel.qml b/src/app/commoncomponents/BubbleLabel.qml index 0ab643bca2211f2da1f03a3a6b8f3d096ef176f2..a6e259ce25c1eb12023767ac7565b2306daca34b 100644 --- a/src/app/commoncomponents/BubbleLabel.qml +++ b/src/app/commoncomponents/BubbleLabel.qml @@ -15,10 +15,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls - import net.jami.Constants 1.1 Label { diff --git a/src/app/commoncomponents/CallMessageDelegate.qml b/src/app/commoncomponents/CallMessageDelegate.qml index 16b8a2d3122fed04b3d063d292bff4845780bd51..b7c66eff798288c97066d027a9ea52904eea4e07 100644 --- a/src/app/commoncomponents/CallMessageDelegate.qml +++ b/src/app/commoncomponents/CallMessageDelegate.qml @@ -18,7 +18,6 @@ import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 @@ -44,13 +43,12 @@ SBSMessageBase { readers: Readers formattedTime: MessagesAdapter.getFormattedTime(Timestamp) - Connections { target: CurrentConversation enabled: root.isActive function onActiveCallsChanged() { - root.isActive = LRCInstance.indexOfActiveCall(ConfId, ActionUri, DeviceId) !== -1 + root.isActive = LRCInstance.indexOfActiveCall(ConfId, ActionUri, DeviceId) !== -1; } } @@ -60,11 +58,9 @@ SBSMessageBase { bubble.color: { if (ConfId === "" && Duration === 0) { // If missed, we can add a darker pattern - return isOutgoing ? - Qt.lighter(CurrentConversation.color, 1.15) : - Qt.darker(JamiTheme.messageInBgColor, 1.15) + return isOutgoing ? Qt.lighter(CurrentConversation.color, 1.15) : Qt.darker(JamiTheme.messageInBgColor, 1.15); } - return isOutgoing ? CurrentConversation.color : JamiTheme.messageInBgColor + return isOutgoing ? CurrentConversation.color : JamiTheme.messageInBgColor; } innerContent.children: [ @@ -80,10 +76,10 @@ SBSMessageBase { Layout.margins: 8 Layout.fillWidth: true - text:{ + text: { if (root.isActive) - return JamiStrings.joinCall - return Body + return JamiStrings.joinCall; + return Body; } horizontalAlignment: Qt.AlignHCenter @@ -93,9 +89,7 @@ SBSMessageBase { renderType: Text.NativeRendering textFormat: Text.MarkdownText - color: UtilsAdapter.luma(bubble.color) ? - JamiTheme.chatviewTextColorLight : - JamiTheme.chatviewTextColorDark + color: UtilsAdapter.luma(bubble.color) ? JamiTheme.chatviewTextColorLight : JamiTheme.chatviewTextColorDark } JoinCallButton { @@ -116,6 +110,10 @@ SBSMessageBase { ] opacity: 0 - Behavior on opacity { NumberAnimation { duration: 100 } } + Behavior on opacity { + NumberAnimation { + duration: 100 + } + } Component.onCompleted: opacity = 1 } diff --git a/src/app/commoncomponents/ConfirmDialog.qml b/src/app/commoncomponents/ConfirmDialog.qml index 5c38fa323461e982f9ca6c381efc224c6de53316..7ebbbf162d2f7dd652fbaa503cbc10c359597dff 100644 --- a/src/app/commoncomponents/ConfirmDialog.qml +++ b/src/app/commoncomponents/ConfirmDialog.qml @@ -15,11 +15,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 @@ -29,10 +27,8 @@ BaseModalDialog { signal accepted - width: Math.min(appWindow.width - 2 * JamiTheme.preferredMarginSize, - JamiTheme.preferredDialogWidth) - height: Math.min(appWindow.height - 2 * JamiTheme.preferredMarginSize, - JamiTheme.preferredDialogHeight) + width: Math.min(appWindow.width - 2 * JamiTheme.preferredMarginSize, JamiTheme.preferredDialogWidth) + height: Math.min(appWindow.height - 2 * JamiTheme.preferredMarginSize, JamiTheme.preferredDialogHeight) property string confirmLabel: "" property string textLabel: "" @@ -44,8 +40,7 @@ BaseModalDialog { id: labelAction Layout.alignment: Qt.AlignHCenter - Layout.preferredWidth: column.width - - JamiTheme.preferredMarginSize * 2 + Layout.preferredWidth: column.width - JamiTheme.preferredMarginSize * 2 color: JamiTheme.textColor text: root.textLabel @@ -79,8 +74,8 @@ BaseModalDialog { autoAccelerator: true onClicked: { - close() - accepted() + close(); + accepted(); } } diff --git a/src/app/commoncomponents/ContactMessageDelegate.qml b/src/app/commoncomponents/ContactMessageDelegate.qml index 03aa9625b513808921734e42466d8f2909879dee..464171f3b0847fd0d6720600b68ee32cdfed1774 100644 --- a/src/app/commoncomponents/ContactMessageDelegate.qml +++ b/src/app/commoncomponents/ContactMessageDelegate.qml @@ -18,7 +18,6 @@ import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 @@ -32,7 +31,7 @@ Column { property string formattedTime: MessagesAdapter.getFormattedTime(Timestamp) property string formattedDay: MessagesAdapter.getFormattedDay(Timestamp) property int seq: MsgSeq.single//a changer par textlabel - property alias messageToSend : textLabel.text + property alias messageToSend: textLabel.text width: ListView.view ? ListView.view.width : 0 spacing: 2 @@ -44,7 +43,7 @@ Column { width: parent.width TimestampInfo { - id:timestampItem + id: timestampItem showDay: root.showDay showTime: root.showTime @@ -93,6 +92,10 @@ Column { } } opacity: 0 - Behavior on opacity { NumberAnimation { duration: 100 } } + Behavior on opacity { + NumberAnimation { + duration: 100 + } + } Component.onCompleted: opacity = 1 } diff --git a/src/app/commoncomponents/CustomBorder.qml b/src/app/commoncomponents/CustomBorder.qml index 4f954213fa83e95484a472b84401432511479c52..340fb7ae1025cb2e496ad3eb9935ff04ee11c508 100644 --- a/src/app/commoncomponents/CustomBorder.qml +++ b/src/app/commoncomponents/CustomBorder.qml @@ -15,7 +15,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick // Inspired by diff --git a/src/app/commoncomponents/DaemonReconnectPopup.qml b/src/app/commoncomponents/DaemonReconnectPopup.qml index df4299b179d97d4e5d00e454373259e88a77bcf2..5e779694665b8123a12ea7231a9648a4b20b6058 100644 --- a/src/app/commoncomponents/DaemonReconnectPopup.qml +++ b/src/app/commoncomponents/DaemonReconnectPopup.qml @@ -15,11 +15,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Constants 1.1 import net.jami.Models 1.1 @@ -33,32 +31,31 @@ BaseModalDialog { Connections { target: { - if (Qt.platform.os.toString() !== "windows" && Qt.platform.os.toString() !== "osx") - return DBusErrorHandler - return null + if (Qt.platform.os.toString() !== "windows" && Qt.platform.os.toString() !== "osx") + return DBusErrorHandler; + return null; } ignoreUnknownSignals: true function onShowDaemonReconnectPopup(visible) { if (!visible) { - viewCoordinator.dismiss(this) + viewCoordinator.dismiss(this); } } function onDaemonReconnectFailed() { - connectionFailed = true + connectionFailed = true; } } - onPopupContentLoadStatusChanged: { if (popupContentLoadStatus === Loader.Ready) { - root.height = Qt.binding(function() { - return popupContentLoader.item.implicitHeight + 50 - }) - root.width = Qt.binding(function() { - return popupContentLoader.item.implicitWidth + 50 - }) + root.height = Qt.binding(function () { + return popupContentLoader.item.implicitHeight + 50; + }); + root.width = Qt.binding(function () { + return popupContentLoader.item.implicitWidth + 50; + }); } } @@ -73,8 +70,7 @@ BaseModalDialog { Layout.alignment: Qt.AlignHCenter | Qt.AlignTop Layout.topMargin: preferredMargin - text: connectionFailed ? JamiStrings.reconnectionFailed : - JamiStrings.reconnectDaemon + text: connectionFailed ? JamiStrings.reconnectionFailed : JamiStrings.reconnectDaemon font.pointSize: JamiTheme.textFontSize + 2 horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter @@ -112,7 +108,7 @@ BaseModalDialog { hoveredColor: JamiTheme.buttonTintedBlueHovered pressedColor: JamiTheme.buttonTintedBluePressed secondary: true - autoAccelerator: true + autoAccelerator: true onClicked: Qt.quit() } diff --git a/src/app/commoncomponents/DeleteAccountDialog.qml b/src/app/commoncomponents/DeleteAccountDialog.qml index 76c3257a3aaf00088c83f6b90b885702ff865f4c..3d0d7bc681b805b7749e9a7bcdfb77259738e322 100644 --- a/src/app/commoncomponents/DeleteAccountDialog.qml +++ b/src/app/commoncomponents/DeleteAccountDialog.qml @@ -15,11 +15,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 @@ -45,8 +43,7 @@ BaseModalDialog { id: labelDeletion Layout.alignment: Qt.AlignHCenter - Layout.preferredWidth: deleteAccountContentColumnLayout.width - - JamiTheme.preferredMarginSize * 2 + Layout.preferredWidth: deleteAccountContentColumnLayout.width - JamiTheme.preferredMarginSize * 2 color: JamiTheme.textColor text: JamiStrings.confirmDeleteQuestion @@ -63,8 +60,7 @@ BaseModalDialog { id: labelBestId Layout.alignment: Qt.AlignHCenter - Layout.preferredWidth: deleteAccountContentColumnLayout.width - - JamiTheme.preferredMarginSize * 2 + Layout.preferredWidth: deleteAccountContentColumnLayout.width - JamiTheme.preferredMarginSize * 2 color: JamiTheme.textColor text: bestName @@ -82,8 +78,7 @@ BaseModalDialog { id: labelAccountHash Layout.alignment: Qt.AlignHCenter - Layout.preferredWidth: deleteAccountContentColumnLayout.width - - JamiTheme.preferredMarginSize * 2 + Layout.preferredWidth: deleteAccountContentColumnLayout.width - JamiTheme.preferredMarginSize * 2 color: JamiTheme.textColor text: accountId @@ -102,8 +97,7 @@ BaseModalDialog { visible: !isSIP Layout.alignment: Qt.AlignHCenter - Layout.preferredWidth: deleteAccountContentColumnLayout.width - - JamiTheme.preferredMarginSize * 2 + Layout.preferredWidth: deleteAccountContentColumnLayout.width - JamiTheme.preferredMarginSize * 2 text: JamiStrings.deleteAccountInfos @@ -140,15 +134,17 @@ BaseModalDialog { Connections { target: root - function onClosed() { btnDelete.enabled = true } + function onClosed() { + btnDelete.enabled = true; + } } onClicked: { - btnDelete.enabled = false - busyInd.running = true - AccountAdapter.deleteCurrentAccount() - close() - accepted() + btnDelete.enabled = false; + busyInd.running = true; + AccountAdapter.deleteCurrentAccount(); + close(); + accepted(); } } @@ -158,7 +154,9 @@ BaseModalDialog { Connections { target: root - function onClosed() { busyInd.running = false } + function onClosed() { + busyInd.running = false; + } } } diff --git a/src/app/commoncomponents/DualPaneView.qml b/src/app/commoncomponents/DualPaneView.qml index a2405686a4eed77a4a0171fecb670a45099d84bc..4e4b3a6247e198431fc9cfff991b4ea7bc23a7d4 100644 --- a/src/app/commoncomponents/DualPaneView.qml +++ b/src/app/commoncomponents/DualPaneView.qml @@ -14,10 +14,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls - import net.jami.Adapters 1.1 import net.jami.Constants 1.1 @@ -38,29 +36,29 @@ BaseView { property bool isSinglePane onPresented: { - if (leftPaneItem) leftPaneItem.parent = leftPane - if (rightPaneItem) rightPaneItem.parent = rightPane - - splitView.restoreSplitViewState() - - resolvePanes() + if (leftPaneItem) + leftPaneItem.parent = leftPane; + if (rightPaneItem) + rightPaneItem.parent = rightPane; + splitView.restoreSplitViewState(); + resolvePanes(); } onDismissed: splitView.saveSplitViewState() Component.onCompleted: { // Avoid double triggering this handler during instantiation. - onIsSinglePaneChanged.connect(isSinglePaneChangedHandler) + onIsSinglePaneChanged.connect(isSinglePaneChangedHandler); } property real previousLeftPaneWidth: leftPane.width onWidthChanged: resolvePanes() function resolvePanes() { - isSinglePane = width < rightPaneMinWidth + previousLeftPaneWidth + isSinglePane = width < rightPaneMinWidth + previousLeftPaneWidth; } // Override this if needed. - property var isSinglePaneChangedHandler: function() { - rightPaneItem.parent = isSinglePane ? leftPane : rightPane + property var isSinglePaneChangedHandler: function () { + rightPaneItem.parent = isSinglePane ? leftPane : rightPane; } JamiSplitView { @@ -70,13 +68,10 @@ BaseView { Item { id: leftPane - onWidthChanged: if (!isSinglePane) previousLeftPaneWidth = width - SplitView.minimumWidth: isSinglePane ? - viewNode.width : - viewNode.leftPaneMinWidth - SplitView.maximumWidth: isSinglePane ? - viewNode.width : - viewNode.width - rightPaneMinWidth + onWidthChanged: if (!isSinglePane) + previousLeftPaneWidth = width + SplitView.minimumWidth: isSinglePane ? viewNode.width : viewNode.leftPaneMinWidth + SplitView.maximumWidth: isSinglePane ? viewNode.width : viewNode.width - rightPaneMinWidth SplitView.preferredWidth: viewNode.leftPaneMinWidth clip: true } diff --git a/src/app/commoncomponents/EditableLineEdit.qml b/src/app/commoncomponents/EditableLineEdit.qml index 49d55ba027f3a833bdc0956f50d88cd53863b8c7..5045815f8cbba3051002a5305f0d1b11da5c3ab5 100644 --- a/src/app/commoncomponents/EditableLineEdit.qml +++ b/src/app/commoncomponents/EditableLineEdit.qml @@ -16,12 +16,10 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts import Qt5Compat.GraphicalEffects - import net.jami.Constants 1.1 import net.jami.Adapters 1.1 @@ -44,7 +42,7 @@ Item { property string selectedColor: "#03B9E9" property string validatedColor: "#009980" property string errorColor: "#CC0022" - property alias selectByMouse:lineEdit.selectByMouse + property alias selectByMouse: lineEdit.selectByMouse property alias loseFocusWhenEnterPressed: lineEdit.loseFocusWhenEnterPressed property alias validator: lineEdit.validator property alias text: lineEdit.text @@ -79,17 +77,17 @@ Item { property int preferredWidth: JamiTheme.preferredFieldWidth function clear() { - lineEdit.clear() - lineEdit.focus = false + lineEdit.clear(); + lineEdit.focus = false; } - function toggleEchoMode(){ + function toggleEchoMode() { if (echoMode == TextInput.Normal) { - echoMode = TextInput.Password - secondIco = JamiResources.eye_cross_svg + echoMode = TextInput.Password; + secondIco = JamiResources.eye_cross_svg; } else { - echoMode = TextInput.Normal - secondIco = JamiResources.noun_eye_svg + echoMode = TextInput.Normal; + secondIco = JamiResources.noun_eye_svg; } } @@ -97,7 +95,7 @@ Item { width: preferredWidth Layout.preferredHeight: 50 - Layout.preferredWidth: 400 + Layout.preferredWidth: 400 MaterialToolTip { parent: lineEdit @@ -110,7 +108,7 @@ Item { target: parent enabled: !root.readOnly onHoveredChanged: { - root.hovered = hovered + root.hovered = hovered; } } @@ -123,33 +121,32 @@ Item { } Item { - id: row anchors.fill: parent z: 1 - ResponsiveImage { + ResponsiveImage { id: firstIco_ opacity: editable && !root.readOnly && firstIco !== "" visible: opacity anchors.left: row.left anchors.bottom: row.bottom - anchors.bottomMargin: row.height /5 + anchors.bottomMargin: row.height / 5 - width: visible? 18 : 0 + width: visible ? 18 : 0 height: 18 layer { enabled: true effect: ColorOverlay { - color: firstIcoColor + color: firstIcoColor } } source: firstIco - Behavior on opacity { + Behavior on opacity { NumberAnimation { from: 0 duration: JamiTheme.longFadeDuration @@ -172,27 +169,27 @@ Item { wrapMode: readOnly ? TextEdit.WrapAnywhere : TextEdit.NoWrap horizontalAlignment: !readOnly || text !== "" ? Qt.AlignLeft : Qt.AlignHCenter - onFocusChanged: function(focus) { + onFocusChanged: function (focus) { if (root.readOnly) - return + return; if (!focus && editable) { - editable = !editable - root.editingFinished() + editable = !editable; + root.editingFinished(); } else if (focus && !editable) { - editable = !editable - lineEdit.forceActiveFocus() + editable = !editable; + lineEdit.forceActiveFocus(); } } onAccepted: { - root.accepted() - root.editingFinished() - editable = !editable - focus = false + root.accepted(); + root.editingFinished(); + editable = !editable; + focus = false; } } - ResponsiveImage { + ResponsiveImage { id: thirdIco_ anchors.right: secIco_.left anchors.rightMargin: 12 @@ -200,7 +197,7 @@ Item { anchors.bottomMargin: 12 visible: thirdIco !== "" - width: visible? 18 : 0 + width: visible ? 18 : 0 height: 18 layer { @@ -212,7 +209,7 @@ Item { source: thirdIco - Behavior on opacity { + Behavior on opacity { NumberAnimation { from: 0 duration: JamiTheme.longFadeDuration @@ -220,15 +217,14 @@ Item { } } - ResponsiveImage { - + ResponsiveImage { id: secIco_ visible: (editable && !root.readOnly) || secondIco !== "" source: secondIco anchors.right: row.right anchors.bottom: row.bottom anchors.bottomMargin: 12 - width: visible? 18 : 0 + width: visible ? 18 : 0 height: 18 MaterialToolTip { @@ -237,7 +233,7 @@ Item { text: informationToolTip textColor: "black" backGroundColor: "white" - visible: parent.hovered && informationToolTip!=="" + visible: parent.hovered && informationToolTip !== "" delay: Qt.styleHints.mousePressAndHoldInterval } @@ -248,16 +244,15 @@ Item { } } - TapHandler{ + TapHandler { target: parent enabled: !root.readOnly onTapped: { - root.secondIcoClicked() + root.secondIcoClicked(); } - } - Behavior on opacity { + Behavior on opacity { NumberAnimation { from: 0 duration: JamiTheme.longFadeDuration @@ -266,7 +261,6 @@ Item { } } - Rectangle { id: barColor anchors.fill: root @@ -274,18 +268,17 @@ Item { visible: !readOnly color: { - if(root.error) - return errorColor - if(root.validated) - return validatedColor - if(root.hovered || root.editable) - return hoveredColor - if(root.inactive) - return inactiveColor - if(root.editable) - return selectedColor - return "black" - + if (root.error) + return errorColor; + if (root.validated) + return validatedColor; + if (root.hovered || root.editable) + return hoveredColor; + if (root.inactive) + return inactiveColor; + if (root.editable) + return selectedColor; + return "black"; } Rectangle { @@ -301,10 +294,8 @@ Item { } } - - onFocusChanged: function(focus) { + onFocusChanged: function (focus) { if (focus) lineEdit.forceActiveFocus(); } - } diff --git a/src/app/commoncomponents/EditedPopup.qml b/src/app/commoncomponents/EditedPopup.qml index 9b5c1469b529ed2583b83f3a60a7b1a48321d73e..883a540f9aa4b11ce67e5cc1d6d015416631173d 100644 --- a/src/app/commoncomponents/EditedPopup.qml +++ b/src/app/commoncomponents/EditedPopup.qml @@ -14,12 +14,10 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts import Qt5Compat.GraphicalEffects - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 @@ -59,8 +57,7 @@ BaseModalDialog { Layout.leftMargin: JamiTheme.settingsMarginSize elide: Text.ElideRight - text: MessagesAdapter.getFormattedDay(modelData.timestamp.toString()) - + " - " + MessagesAdapter.getFormattedTime(modelData.timestamp.toString()) + text: MessagesAdapter.getFormattedDay(modelData.timestamp.toString()) + " - " + MessagesAdapter.getFormattedTime(modelData.timestamp.toString()) color: JamiTheme.textColor opacity: 0.5 } diff --git a/src/app/commoncomponents/ElidedTextLabel.qml b/src/app/commoncomponents/ElidedTextLabel.qml index 9c77b02dea5cbe89a27319bf2cd1256fe673a135..b2d642a7a389139b9327eceb09b572eeb49c20e1 100644 --- a/src/app/commoncomponents/ElidedTextLabel.qml +++ b/src/app/commoncomponents/ElidedTextLabel.qml @@ -15,16 +15,14 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls - import net.jami.Constants 1.1 TextEdit { id: root - property string eText : "" + property string eText: "" property int maxWidth: 100 property int fontSize: JamiTheme.textFontSize property int textWidth: 0 @@ -50,7 +48,7 @@ TextEdit { text: eText onTextChanged: { - textWidth = elided.boundingRect.width + textWidth = elided.boundingRect.width; } } } diff --git a/src/app/commoncomponents/EmojiReactionPopup.qml b/src/app/commoncomponents/EmojiReactionPopup.qml index 7c0165875517815348527f1b5e56a417abeb53bc..4e52a50a13e6ab01d39c2c0d066543826eb209dd 100644 --- a/src/app/commoncomponents/EmojiReactionPopup.qml +++ b/src/app/commoncomponents/EmojiReactionPopup.qml @@ -15,17 +15,14 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts import QtQuick.Controls - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 import Qt5Compat.GraphicalEffects - Popup { id: root @@ -45,7 +42,7 @@ Popup { padding: 0 visible: false - closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside + closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside Rectangle { id: container @@ -61,7 +58,7 @@ Popup { } ColumnLayout { - id: popupContent + id: popupContent Layout.alignment: Qt.AlignCenter @@ -72,16 +69,17 @@ Popup { width: 30 height: 30 imageContainerWidth: 30 - imageContainerHeight : 30 + imageContainerHeight: 30 Layout.margins: 8 - radius : 5 + radius: 5 imageColor: "grey" normalColor: JamiTheme.transparentColor source: JamiResources.round_close_24dp_svg - onClicked: { root.close() } + onClicked: { + root.close(); + } } - ListView { id: listViewReaction @@ -89,7 +87,7 @@ Popup { Layout.rightMargin: JamiTheme.popupButtonsMargin spacing: 15 Layout.preferredWidth: 400 - Layout.preferredHeight: childrenRect.height + 30 < 700 ? childrenRect.height + 30 : 700 + Layout.preferredHeight: childrenRect.height + 30 < 700 ? childrenRect.height + 30 : 700 model: Object.entries(emojiReaction) clip: true property int modelCount: Object.entries(emojiReaction).length @@ -112,7 +110,6 @@ Popup { Layout.topMargin: (textmetric.height - height) + (height - authorName.height) / 2 } - Text { id: authorName @@ -123,11 +120,7 @@ Popup { elide: Text.ElideRight font.pointSize: JamiTheme.namePopupFontsize color: JamiTheme.chatviewTextColor - text: isMe - ? " " + CurrentAccount.bestName - + " " - : " " + UtilsAdapter.getBestNameForUri(CurrentAccount.id, authorUri) - + " " + text: isMe ? " " + CurrentAccount.bestName + " " : " " + UtilsAdapter.getBestNameForUri(CurrentAccount.id, authorUri) + " " } GridLayout { @@ -135,7 +128,7 @@ Popup { visible: !isMe layoutDirection: Qt.RightToLeft Repeater { - model: emojiArray.length < 15 ? emojiArray.length : 15 + model: emojiArray.length < 15 ? emojiArray.length : 15 delegate: Text { text: emojiArray[index] horizontalAlignment: Text.AlignRight @@ -149,7 +142,7 @@ Popup { columns: 5 layoutDirection: Qt.RightToLeft Repeater { - model: emojiArray.length < 15 ? emojiArray.length : 15 + model: emojiArray.length < 15 ? emojiArray.length : 15 delegate: Button { id: emojiButton @@ -167,9 +160,9 @@ Popup { } onClicked: { - MessagesAdapter.removeEmojiReaction(CurrentConversation.id,emojiButton.text,msgId) + MessagesAdapter.removeEmojiReaction(CurrentConversation.id, emojiButton.text, msgId); if (emojiArray.length === 1) - close() + close(); } } } @@ -182,7 +175,7 @@ Popup { Overlay.modal: Rectangle { color: JamiTheme.transparentColor // Color animation for overlay when pop up is shown. - ColorAnimation on color { + ColorAnimation on color { to: JamiTheme.popupOverlayColor duration: 500 } @@ -202,14 +195,18 @@ Popup { enter: Transition { NumberAnimation { - properties: "opacity"; from: 0.0; to: 1.0 + properties: "opacity" + from: 0.0 + to: 1.0 duration: JamiTheme.shortFadeDuration } } exit: Transition { NumberAnimation { - properties: "opacity"; from: 1.0; to: 0.0 + properties: "opacity" + from: 1.0 + to: 0.0 duration: JamiTheme.shortFadeDuration } } diff --git a/src/app/commoncomponents/EmojiReactions.qml b/src/app/commoncomponents/EmojiReactions.qml index 610ee39633d0a27c71565b940f92c134f32d0610..7413d3b4b635a45e498940f3a273aa637a0a89ca 100644 --- a/src/app/commoncomponents/EmojiReactions.qml +++ b/src/app/commoncomponents/EmojiReactions.qml @@ -15,10 +15,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import Qt5Compat.GraphicalEffects - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 @@ -34,49 +32,49 @@ Item { visible: emojis.length && Body !== "" property string emojis: { - var space = "" - var emojiList = [] - var emojiNumberList = [] + var space = ""; + var emojiList = []; + var emojiNumberList = []; for (const reactions of Object.entries(emojiReaction)) { - var authorEmojiList = reactions[1] + var authorEmojiList = reactions[1]; for (var emojiIndex in authorEmojiList) { - var emoji = authorEmojiList[emojiIndex] + var emoji = authorEmojiList[emojiIndex]; if (emojiList.includes(emoji)) { - var findIndex = emojiList.indexOf(emoji) + var findIndex = emojiList.indexOf(emoji); if (findIndex != -1) - emojiNumberList[findIndex] += 1 + emojiNumberList[findIndex] += 1; } else { - emojiList.push(emoji) - emojiNumberList.push(1) + emojiList.push(emoji); + emojiNumberList.push(1); } } } - var cur = "" + var cur = ""; for (var i in emojiList) { if (emojiNumberList[i] !== 1) - cur = cur + space + emojiList[i] + emojiNumberList[i] + "" + cur = cur + space + emojiList[i] + emojiNumberList[i] + ""; else - cur = cur + space + emojiList[i] + "" - space = " " + cur = cur + space + emojiList[i] + ""; + space = " "; } - return cur + return cur; } property var ownEmojiList: { - var list = [] - var index = 0 + var list = []; + var index = 0; for (const reactions of Object.entries(emojiReaction)) { - var authorUri = reactions[0] - var authorEmojiList = reactions[1] + var authorUri = reactions[0]; + var authorEmojiList = reactions[1]; if (CurrentAccount.uri === authorUri) { for (var emojiIndex in authorEmojiList) { - list[index] = authorEmojiList[emojiIndex] - index ++ + list[index] = authorEmojiList[emojiIndex]; + index++; } - return list + return list; } } - return [] + return []; } Rectangle { diff --git a/src/app/commoncomponents/GeneratedMessageDelegate.qml b/src/app/commoncomponents/GeneratedMessageDelegate.qml index 9399f7f84ef417bff633448aa1d0ab8cf58aa86a..82937d94244f513db793bdf1c6f1543c59df418b 100644 --- a/src/app/commoncomponents/GeneratedMessageDelegate.qml +++ b/src/app/commoncomponents/GeneratedMessageDelegate.qml @@ -17,11 +17,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Adapters 1.1 import net.jami.Constants 1.1 @@ -44,7 +42,7 @@ Column { width: parent.width TimestampInfo { - id:timestampItem + id: timestampItem showDay: root.showDay showTime: root.showTime @@ -64,6 +62,10 @@ Column { } opacity: 0 - Behavior on opacity { NumberAnimation { duration: 100 } } + Behavior on opacity { + NumberAnimation { + duration: 100 + } + } Component.onCompleted: opacity = 1 } diff --git a/src/app/commoncomponents/HalfPill.qml b/src/app/commoncomponents/HalfPill.qml index b0a63587d4b52a011f18008cfa8594f991a45489..e8e5147399cd906e1950368648d2fffcffe1c0af 100644 --- a/src/app/commoncomponents/HalfPill.qml +++ b/src/app/commoncomponents/HalfPill.qml @@ -15,7 +15,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick Item { @@ -38,10 +37,8 @@ Item { Rectangle { id: rect - property bool horizontal: type === HalfPill.Left || - type === HalfPill.Right - property bool direction: type === HalfPill.Right || - type === HalfPill.Bottom + property bool horizontal: type === HalfPill.Left || type === HalfPill.Right + property bool direction: type === HalfPill.Right || type === HalfPill.Bottom property bool bp: type === HalfPill.None diff --git a/src/app/commoncomponents/InfoBox.qml b/src/app/commoncomponents/InfoBox.qml index 955608804ef72e38249e1ad3e17f9c7728a1815c..ab4d41e6ebdfc7fafb356cf36a7bb097fc2b41e3 100644 --- a/src/app/commoncomponents/InfoBox.qml +++ b/src/app/commoncomponents/InfoBox.qml @@ -15,17 +15,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts import QtQuick.Controls - import net.jami.Models 1.1 import net.jami.Constants 1.1 - Rectangle { - id: root property string icoSource: "" @@ -40,7 +36,7 @@ Rectangle { ColumnLayout { id: infos - anchors.fill: parent + anchors.fill: parent RowLayout { @@ -60,7 +56,6 @@ Rectangle { source: icoSource color: icoColor - } Label { @@ -71,7 +66,6 @@ Rectangle { Layout.alignment: Qt.AlignCenter color: JamiTheme.textColor font.pixelSize: JamiTheme.infoBoxTitleFontSize - } } @@ -85,8 +79,6 @@ Rectangle { color: JamiTheme.textColor wrapMode: Text.WordWrap text: description - } } - } diff --git a/src/app/commoncomponents/JamiFileDialog.qml b/src/app/commoncomponents/JamiFileDialog.qml index 611dc765f419ff3eb50dc85f1345a29e46e01335..942db164c01fc3800358a387346bbb293a9b524f 100644 --- a/src/app/commoncomponents/JamiFileDialog.qml +++ b/src/app/commoncomponents/JamiFileDialog.qml @@ -15,10 +15,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import Qt.labs.platform - import net.jami.Constants 1.1 FileDialog { @@ -31,15 +29,20 @@ FileDialog { signal filesAccepted(var files) onAccepted: { - switch(fileMode) { - case FileDialog.OpenFile: fileAccepted(file); break - case FileDialog.OpenFiles: filesAccepted(files); break - default: fileAccepted(file) + switch (fileMode) { + case FileDialog.OpenFile: + fileAccepted(file); + break; + case FileDialog.OpenFiles: + filesAccepted(files); + break; + default: + fileAccepted(file); } } enum Mode { - OpenFile = 0, + OpenFile, OpenFiles, SaveFile } @@ -47,15 +50,15 @@ FileDialog { title: JamiStrings.selectFile onModeChanged: { - switch(mode) { - case JamiFileDialog.Mode.OpenFile: - root.fileMode = FileDialog.OpenFile - break - case JamiFileDialog.Mode.OpenFiles: - root.fileMode = FileDialog.OpenFiles - break - default: - root.fileMode = FileDialog.SaveFile + switch (mode) { + case JamiFileDialog.Mode.OpenFile: + root.fileMode = FileDialog.OpenFile; + break; + case JamiFileDialog.Mode.OpenFiles: + root.fileMode = FileDialog.OpenFiles; + break; + default: + root.fileMode = FileDialog.SaveFile; } } } diff --git a/src/app/commoncomponents/JamiFlickable.qml b/src/app/commoncomponents/JamiFlickable.qml index 681e3c3e8ae00c843519a3bd54b83e9fca13c9ea..b9c44732e837f4c95c51cea69f395dff51b690c2 100644 --- a/src/app/commoncomponents/JamiFlickable.qml +++ b/src/app/commoncomponents/JamiFlickable.qml @@ -15,16 +15,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls - import net.jami.Constants 1.1 Flickable { id: root - property bool attachedFlickableMoving: root.moving property alias verticalHandleColor: verticalScrollBar.handleColor property alias horizontalHandleColor: horizontalScrollBar.handleColor diff --git a/src/app/commoncomponents/JamiIdentifier.qml b/src/app/commoncomponents/JamiIdentifier.qml index 70329e1c22071b2064aa8bd395d5a72668ab8d95..d2be97abd49df7a2c758e8e458dad89a394cc37d 100644 --- a/src/app/commoncomponents/JamiIdentifier.qml +++ b/src/app/commoncomponents/JamiIdentifier.qml @@ -14,12 +14,10 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts import Qt5Compat.GraphicalEffects - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 @@ -35,7 +33,8 @@ Item { // Background rounded rectangle. Rectangle { id: outerRect - anchors.fill: parent; radius: 20 + anchors.fill: parent + radius: 20 color: JamiTheme.secondaryBackgroundColor } @@ -43,7 +42,9 @@ Item { Item { anchors.fill: outerRect layer.enabled: true - layer.effect: OpacityMask { maskSource: outerRect } + layer.effect: OpacityMask { + maskSource: outerRect + } Rectangle { id: logoRect @@ -81,45 +82,32 @@ Item { Layout.rightMargin: JamiTheme.pushButtonMargin Layout.preferredHeight: childrenRect.height - component JamiIdControlButton: PushButton { - property bool clicked: true - preferredSize : 30 - normalColor: JamiTheme.transparentColor - hoveredColor: JamiTheme.hoveredButtonColorWizard - imageContainerWidth: JamiTheme.pushButtonSize - imageContainerHeight: JamiTheme.pushButtonSize - border.color: JamiTheme.tintedBlue - imageColor: JamiTheme.buttonTintedBlue - } - JamiIdControlButton { id: btnEdit visible: CurrentAccount.registeredName === "" - border.color: enabled ? JamiTheme.buttonTintedBlue : JamiTheme.buttonTintedBlack - imageColor: enabled ? JamiTheme.buttonTintedBlue : JamiTheme.buttonTintedBlack + border.color: enabled ? JamiTheme.buttonTintedBlue : JamiTheme.buttonTintedBlack + imageColor: enabled ? JamiTheme.buttonTintedBlue : JamiTheme.buttonTintedBlack enabled: { if (!usernameTextEdit.editMode) - return true - switch(usernameTextEdit.nameRegistrationState) { + return true; + switch (usernameTextEdit.nameRegistrationState) { case UsernameTextEdit.NameRegistrationState.BLANK: case UsernameTextEdit.NameRegistrationState.FREE: - return true + return true; case UsernameTextEdit.NameRegistrationState.SEARCHING: case UsernameTextEdit.NameRegistrationState.INVALID: case UsernameTextEdit.NameRegistrationState.TAKEN: - return false + return false; } } - source: usernameTextEdit.editMode - ? JamiResources.check_black_24dp_svg - : JamiResources.round_edit_24dp_svg + source: usernameTextEdit.editMode ? JamiResources.check_black_24dp_svg : JamiResources.round_edit_24dp_svg toolTipText: JamiStrings.chooseUsername onClicked: { if (!usernameTextEdit.editMode) { - usernameTextEdit.startEditing() - usernameTextEdit.readOnly = false + usernameTextEdit.startEditing(); + usernameTextEdit.readOnly = false; } else { - usernameTextEdit.accepted() + usernameTextEdit.accepted(); } } } @@ -135,9 +123,7 @@ Item { id: btnShare source: JamiResources.share_24dp_svg toolTipText: JamiStrings.share - onClicked: viewCoordinator.presentDialog( - appWindow, - "mainview/components/WelcomePageQrDialog.qml") + onClicked: viewCoordinator.presentDialog(appWindow, "mainview/components/WelcomePageQrDialog.qml") } JamiIdControlButton { @@ -147,14 +133,13 @@ Item { toolTipText: JamiStrings.identifierURI onClicked: { if (clicked) { - usernameTextEdit.staticText = CurrentAccount.uri - btnId.toolTipText = JamiStrings.identifierRegisterName + usernameTextEdit.staticText = CurrentAccount.uri; + btnId.toolTipText = JamiStrings.identifierRegisterName; } else { - usernameTextEdit.staticText = CurrentAccount.registeredName - btnId.toolTipText = JamiStrings.identifierURI + usernameTextEdit.staticText = CurrentAccount.registeredName; + btnId.toolTipText = JamiStrings.identifierURI; } - - clicked = !clicked + clicked = !clicked; } } } @@ -173,19 +158,28 @@ Item { readOnly: true onAccepted: { - usernameTextEdit.readOnly = true + usernameTextEdit.readOnly = true; if (dynamicText === '') { - return + return; } - var dlg = viewCoordinator.presentDialog( - appWindow, - "settingsview/components/NameRegistrationDialog.qml", - { registeredName: dynamicText }) - dlg.accepted.connect(function() { - usernameTextEdit.nameRegistrationState = - UsernameTextEdit.NameRegistrationState.BLANK - }) + var dlg = viewCoordinator.presentDialog(appWindow, "settingsview/components/NameRegistrationDialog.qml", { + "registeredName": dynamicText + }); + dlg.accepted.connect(function () { + usernameTextEdit.nameRegistrationState = UsernameTextEdit.NameRegistrationState.BLANK; + }); } } } + + component JamiIdControlButton: PushButton { + property bool clicked: true + preferredSize: 30 + normalColor: JamiTheme.transparentColor + hoveredColor: JamiTheme.hoveredButtonColorWizard + imageContainerWidth: JamiTheme.pushButtonSize + imageContainerHeight: JamiTheme.pushButtonSize + border.color: JamiTheme.tintedBlue + imageColor: JamiTheme.buttonTintedBlue + } } diff --git a/src/app/commoncomponents/JamiListView.qml b/src/app/commoncomponents/JamiListView.qml index e92c8cda33a293446fb0043fff35f47cfb9c3e9b..83d1347a7b35b79989f31a28e3d3fd25ad374d33 100644 --- a/src/app/commoncomponents/JamiListView.qml +++ b/src/app/commoncomponents/JamiListView.qml @@ -16,10 +16,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls - import net.jami.Constants 1.1 import net.jami.Models 1.1 diff --git a/src/app/commoncomponents/JamiScrollBar.qml b/src/app/commoncomponents/JamiScrollBar.qml index aadd64805e4fc1b804a013ac2b110be3e391f7a3..775a29f4a9ca29ed19b9060775c518e9f374150a 100644 --- a/src/app/commoncomponents/JamiScrollBar.qml +++ b/src/app/commoncomponents/JamiScrollBar.qml @@ -15,10 +15,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls - import net.jami.Constants 1.1 // Assumed to be attached to Flickable @@ -30,9 +28,9 @@ ScrollBar { active: { if (root.orientation === Qt.Horizontal) - return visible + return visible; else - return hovered || pressed || attachedFlickableMoving + return hovered || pressed || attachedFlickableMoving; } hoverEnabled: true orientation: Qt.Vertical @@ -48,14 +46,12 @@ ScrollBar { implicitHeight: JamiTheme.scrollBarHandleSize implicitWidth: JamiTheme.scrollBarHandleSize radius: width / 2 - color: pressed ? Qt.darker(JamiTheme.scrollBarHandleColor, 2.0) : - JamiTheme.scrollBarHandleColor + color: pressed ? Qt.darker(JamiTheme.scrollBarHandleColor, 2.0) : JamiTheme.scrollBarHandleColor opacity: 0 states: State { name: "active" - when: root.policy === ScrollBar.AlwaysOn || - (root.active && root.size < 1.0) + when: root.policy === ScrollBar.AlwaysOn || (root.active && root.size < 1.0) PropertyChanges { target: root.contentItem opacity: 1 @@ -65,8 +61,11 @@ ScrollBar { transitions: Transition { from: "active" SequentialAnimation { - PauseAnimation { duration: JamiTheme.longFadeDuration } - NumberAnimation { target: root.contentItem + PauseAnimation { + duration: JamiTheme.longFadeDuration + } + NumberAnimation { + target: root.contentItem duration: JamiTheme.shortFadeDuration property: "opacity" to: 0.0 diff --git a/src/app/commoncomponents/JamiSplitView.qml b/src/app/commoncomponents/JamiSplitView.qml index f7fc6d8ad821172f33c0a70aab1be9864c7a9734..9b66dd0788c08aaad9a0911c0abc0f93014936ab 100644 --- a/src/app/commoncomponents/JamiSplitView.qml +++ b/src/app/commoncomponents/JamiSplitView.qml @@ -14,10 +14,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls - import net.jami.Adapters 1.1 import net.jami.Constants 1.1 @@ -28,17 +26,19 @@ SplitView { property bool autoManageState: !(parent instanceof BaseView) function saveSplitViewState() { - UtilsAdapter.setAppValue("sv_" + splitViewStateKey, root.saveState()) + UtilsAdapter.setAppValue("sv_" + splitViewStateKey, root.saveState()); } function restoreSplitViewState() { - root.restoreState(UtilsAdapter.getAppValue("sv_" + splitViewStateKey)) + root.restoreState(UtilsAdapter.getAppValue("sv_" + splitViewStateKey)); } - onResizingChanged: if (!resizing) saveSplitViewState() + onResizingChanged: if (!resizing) + saveSplitViewState() onVisibleChanged: { - if (!autoManageState) return - visible ? restoreSplitViewState() : saveSplitViewState() + if (!autoManageState) + return; + visible ? restoreSplitViewState() : saveSplitViewState(); } handle: Rectangle { diff --git a/src/app/commoncomponents/JamiSwitch.qml b/src/app/commoncomponents/JamiSwitch.qml index abd69f0af90853badd1f4f20d2ffe57d38e084b1..79d0dcbc827155284b6751c4d75c381bbb9c9f07 100644 --- a/src/app/commoncomponents/JamiSwitch.qml +++ b/src/app/commoncomponents/JamiSwitch.qml @@ -15,10 +15,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls - import net.jami.Constants 1.1 Switch { @@ -60,17 +58,15 @@ Switch { radius: JamiTheme.switchIndicatorRadius - color: root.checked ? JamiTheme.switchHandleCheckedColor : - JamiTheme.switchHandleColor + color: root.checked ? JamiTheme.switchHandleCheckedColor : JamiTheme.switchHandleColor border.color: JamiTheme.switchHandleBorderColor } } Keys.onPressed: function (keyEvent) { - if (keyEvent.key === Qt.Key_Enter || - keyEvent.key === Qt.Key_Return) { - checked = !checked - keyEvent.accepted = true + if (keyEvent.key === Qt.Key_Enter || keyEvent.key === Qt.Key_Return) { + checked = !checked; + keyEvent.accepted = true; } } } diff --git a/src/app/commoncomponents/LineEditContextMenu.qml b/src/app/commoncomponents/LineEditContextMenu.qml index 35795ef83c9ba2632d514cb0d059e5c8cd8c4a95..7f02db97b57c7d86fffd5fc9de639b8e457da65f 100644 --- a/src/app/commoncomponents/LineEditContextMenu.qml +++ b/src/app/commoncomponents/LineEditContextMenu.qml @@ -15,11 +15,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick - import net.jami.Constants 1.1 - import "contextmenu" ContextMenuAutoLoader { @@ -41,7 +38,7 @@ ContextMenuAutoLoader { canTrigger: lineEditObj.selectedText.length itemName: JamiStrings.copy onClicked: { - lineEditObj.copy() + lineEditObj.copy(); } }, GeneralMenuItem { @@ -51,7 +48,7 @@ ContextMenuAutoLoader { itemName: JamiStrings.cut onClicked: { - lineEditObj.cut() + lineEditObj.cut(); } }, GeneralMenuItem { @@ -61,26 +58,22 @@ ContextMenuAutoLoader { itemName: JamiStrings.paste onClicked: { if (customizePaste) - root.contextMenuRequirePaste() + root.contextMenuRequirePaste(); else - lineEditObj.paste() + lineEditObj.paste(); } } ] function openMenuAt(mouseEvent) { if (lineEditObj.selectedText.length === 0 && selectOnly) - return - - x = mouseEvent.x - y = mouseEvent.y - - selectionStart = lineEditObj.selectionStart - selectionEnd = lineEditObj.selectionEnd - - root.openMenu() - - lineEditObj.select(selectionStart, selectionEnd) + return; + x = mouseEvent.x; + y = mouseEvent.y; + selectionStart = lineEditObj.selectionStart; + selectionEnd = lineEditObj.selectionEnd; + root.openMenu(); + lineEditObj.select(selectionStart, selectionEnd); } contextMenuItemPreferredHeight: JamiTheme.lineEditContextMenuItemsHeight @@ -91,7 +84,7 @@ ContextMenuAutoLoader { target: root.item enabled: root.status === Loader.Ready function onOpened() { - lineEditObj.select(selectionStart, selectionEnd) + lineEditObj.select(selectionStart, selectionEnd); } } diff --git a/src/app/commoncomponents/LocalVideo.qml b/src/app/commoncomponents/LocalVideo.qml index d657b54e0cd82709a7e87ca49b6fc9389205c672..15492fc83f8fad34cc4508f96af9aa9b408d829f 100644 --- a/src/app/commoncomponents/LocalVideo.qml +++ b/src/app/commoncomponents/LocalVideo.qml @@ -15,11 +15,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtMultimedia import Qt5Compat.GraphicalEffects - import net.jami.Adapters 1.1 VideoView { @@ -29,13 +27,11 @@ VideoView { function startWithId(id, force = false) { if (id !== undefined && id.length === 0) { - VideoDevices.stopDevice(rendererId) - rendererId = id + VideoDevices.stopDevice(rendererId); + rendererId = id; } else { - const forceRestart = rendererId === id - rendererId = VideoDevices.startDevice(id, forceRestart) + const forceRestart = rendererId === id; + rendererId = VideoDevices.startDevice(id, forceRestart); } } } - - diff --git a/src/app/commoncomponents/MaterialButton.qml b/src/app/commoncomponents/MaterialButton.qml index fd2de8347870111e72fe32a1baf27311781000f6..114a739d3084f1d09f4ab759566e3d23711f1e02 100644 --- a/src/app/commoncomponents/MaterialButton.qml +++ b/src/app/commoncomponents/MaterialButton.qml @@ -15,11 +15,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Constants 1.1 // TODO: this component suffers from excessive responsibility @@ -42,8 +40,7 @@ AbstractButton { property var secHoveredColor: JamiTheme.secAndTertiHoveredBackgroundColor property var pressedColor: JamiTheme.buttonTintedBluePressed property var keysNavigationFocusColor: Qt.darker(hoveredColor, 2) - property bool hasIcon: animatedIconSource.length !== 0 || - iconSource.length !== 0 + property bool hasIcon: animatedIconSource.length !== 0 || iconSource.length !== 0 property var preferredWidth property real textLeftPadding @@ -55,19 +52,17 @@ AbstractButton { height: buttontextHeightMargin + textButton.height Layout.preferredHeight: height - Binding on width { - when: root.preferredWidth !== undefined || - root.Layout.fillWidth + Binding on width { + when: root.preferredWidth !== undefined || root.Layout.fillWidth value: root.preferredWidth } - Binding on Layout.preferredWidth { - when: root.preferredWidth !== undefined || - root.Layout.fillWidth + Binding on Layout.preferredWidth { + when: root.preferredWidth !== undefined || root.Layout.fillWidth value: width } - Binding on Layout.minimumHeight { + Binding on Layout.minimumHeight { when: root.preferredHeight !== undefined value: height } @@ -88,24 +83,22 @@ AbstractButton { } property string contentColorProvider: { - if (root.primary) - return JamiTheme.primaryTextColor + return JamiTheme.primaryTextColor; if (root.tertiary || root.secondary) - return JamiTheme.secAndTertiTextColor + return JamiTheme.secAndTertiTextColor; if (root.down) - return root.pressedColor + return root.pressedColor; if (!root.secondary) - return "white" - return root.color + return "white"; + return root.color; } contentItem: Item { id: item - Binding on implicitWidth { - when: root.preferredWidth === undefined || - !root.Layout.fillWidth + Binding on implicitWidth { + when: root.preferredWidth === undefined || !root.Layout.fillWidth value: item.childrenRect.width } @@ -113,15 +106,12 @@ AbstractButton { RowLayout { anchors.verticalCenter: parent.verticalCenter - Binding on width { - when: root.preferredWidth !== undefined || - root.Layout.fillWidth + Binding on width { + when: root.preferredWidth !== undefined || root.Layout.fillWidth value: root.availableWidth } - spacing: hasIcon ? - JamiTheme.preferredMarginSize : - 0 + spacing: hasIcon ? JamiTheme.preferredMarginSize : 0 Component { id: iconComponent @@ -160,23 +150,17 @@ AbstractButton { Layout.preferredWidth: active * width Layout.alignment: Qt.AlignVCenter - Layout.leftMargin: hasIcon ? - JamiTheme.preferredMarginSize : - undefined - sourceComponent: animatedSource_.length !== 0 ? - animatedIconComponent : - iconComponent + Layout.leftMargin: hasIcon ? JamiTheme.preferredMarginSize : undefined + sourceComponent: animatedSource_.length !== 0 ? animatedIconComponent : iconComponent } Text { id: textButton Layout.rightMargin: { - if ((!hasIcon || root.preferredWidth === undefined) && - !root.Layout.fillWidth) - return undefined - return icon.width + JamiTheme.preferredMarginSize / 2 + - parent.spacing + if ((!hasIcon || root.preferredWidth === undefined) && !root.Layout.fillWidth) + return undefined; + return icon.width + JamiTheme.preferredMarginSize / 2 + parent.spacing; } Layout.fillWidth: true @@ -198,54 +182,43 @@ AbstractButton { background: Rectangle { color: { - var baseColor = root.focus ? root.keysNavigationFocusColor : root.color - if(root.primary) { + var baseColor = root.focus ? root.keysNavigationFocusColor : root.color; + if (root.primary) { if (root.hovered && root.hoverEnabled) - return root.hoveredColor - return baseColor + return root.hoveredColor; + return baseColor; } - if (root.secondary || root.tertiary) { if ((root.hovered && root.hoverEnabled) || root.focus) - return root.secHoveredColor - return JamiTheme.transparentColor + return root.secHoveredColor; + return JamiTheme.transparentColor; } - if (root.down) - return root.pressedColor + return root.pressedColor; if (root.hovered && root.hoverEnabled) - return root.hoveredColor - - return baseColor - + return root.hoveredColor; + return baseColor; } border.color: { if (root.primary || root.tertiary) - return JamiTheme.transparentColor - + return JamiTheme.transparentColor; if (root.secondary && root.hovered && root.hoverEnabled) - return JamiTheme.secondaryButtonHoveredBorderColor - - if(root.secondary) - return JamiTheme.secondaryButtonBorderColor - + return JamiTheme.secondaryButtonHoveredBorderColor; + if (root.secondary) + return JamiTheme.secondaryButtonBorderColor; if (root.down) - return root.pressedColor - - return root.focus ? - root.keysNavigationFocusColor : - root.color + return root.pressedColor; + return root.focus ? root.keysNavigationFocusColor : root.color; } radius: JamiTheme.primaryRadius } Keys.onPressed: function (keyEvent) { - if (keyEvent.key === Qt.Key_Enter || - keyEvent.key === Qt.Key_Return) { - clicked() - keyEvent.accepted = true + if (keyEvent.key === Qt.Key_Enter || keyEvent.key === Qt.Key_Return) { + clicked(); + keyEvent.accepted = true; } } @@ -261,11 +234,10 @@ AbstractButton { enabled: text.length > 0 && parent.visible && autoAccelerator sequence: { if (text.length === 0) - return "" - return "Alt+" + text[0] + return ""; + return "Alt+" + text[0]; } context: Qt.ApplicationShortcut onActivated: clicked() } - } diff --git a/src/app/commoncomponents/MaterialLineEdit.qml b/src/app/commoncomponents/MaterialLineEdit.qml index 3d8e397f3aa7f5bba7dc61d7f1b4d1153699dec8..ad6b0d82d3c372a856dca99a7f38190a1c94c7a1 100644 --- a/src/app/commoncomponents/MaterialLineEdit.qml +++ b/src/app/commoncomponents/MaterialLineEdit.qml @@ -16,10 +16,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls - import net.jami.Constants 1.1 TextField { @@ -60,13 +58,13 @@ TextField { anchors.fill: root radius: JamiTheme.primaryRadius - border.color: readOnly || underlined? "transparent" : borderColor + border.color: readOnly || underlined ? "transparent" : borderColor color: { if (readOnly) - return "transparent" + return "transparent"; if (underlined) - return borderColor - return backgroundColor + return borderColor; + return backgroundColor; } Rectangle { @@ -84,7 +82,7 @@ TextField { onReleased: function (event) { if (event.button === Qt.RightButton) - lineEditContextMenu.openMenuAt(event) + lineEditContextMenu.openMenuAt(event); } // Enter/Return keys intervention @@ -94,12 +92,11 @@ TextField { // (since losing focus will also emit editingFinished) // Use accepted when the info is not saved by focus lost Keys.onPressed: function (event) { - if (event.key === Qt.Key_Enter || - event.key === Qt.Key_Return) { + if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return) { if (loseFocusWhenEnterPressed) - root.focus = false - root.accepted() - event.accepted = true + root.focus = false; + root.accepted(); + event.accepted = true; } } } diff --git a/src/app/commoncomponents/MaterialRadioButton.qml b/src/app/commoncomponents/MaterialRadioButton.qml index be4e48e83573b245ff1a1efed36c3a7644e70db2..c63b8812f87f555b34270406f9939485c7e52b23 100644 --- a/src/app/commoncomponents/MaterialRadioButton.qml +++ b/src/app/commoncomponents/MaterialRadioButton.qml @@ -14,12 +14,10 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts import Qt5Compat.GraphicalEffects - import net.jami.Constants 1.1 import net.jami.Models 1.1 @@ -46,7 +44,6 @@ RadioButton { radius: 10 Rectangle { - id: innerRect anchors.horizontalCenter: parent.horizontalCenter @@ -54,9 +51,9 @@ RadioButton { width: 10 height: 10 radius: 10 - visible : checked || hovered + visible: checked || hovered - Behavior on visible { + Behavior on visible { NumberAnimation { from: 0 duration: JamiTheme.shortFadeDuration @@ -80,10 +77,8 @@ RadioButton { } Keys.onPressed: function (event) { - if (event.key === Qt.Key_Enter - || event.key === Qt.Key_Return) { - root.checked = true + if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return) { + root.checked = true; } } - } diff --git a/src/app/commoncomponents/MaterialTextField.qml b/src/app/commoncomponents/MaterialTextField.qml index 2614eb0578430bfd449d19fcb4020f5372e06ad3..38a27d273da2edc8430f982fcef42c6347ecd1ca 100644 --- a/src/app/commoncomponents/MaterialTextField.qml +++ b/src/app/commoncomponents/MaterialTextField.qml @@ -14,11 +14,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import Qt5Compat.GraphicalEffects - import net.jami.Constants 1.1 TextField { @@ -32,7 +30,7 @@ TextField { onActiveFocusChanged: { if (!activeFocus && !contextMenu.active) { - root.focus = false + root.focus = false; } } @@ -48,15 +46,11 @@ TextField { property alias suffixBisIconColor: suffixBisIcon.color property alias icon: container.data - property color accent: isActive || hovered - ? prefixIconColor - : JamiTheme.buttonTintedBlue + property color accent: isActive || hovered ? prefixIconColor : JamiTheme.buttonTintedBlue property color baseColor: JamiTheme.primaryForegroundColor property color textColor: JamiTheme.textColor color: textColor - placeholderTextColor: !isActive - ? JamiTheme.transparentColor - : root.color + placeholderTextColor: !isActive ? JamiTheme.transparentColor : root.color property alias infoTipText: infoTip.text property alias infoTipLineText: infoTipLine.text @@ -74,29 +68,26 @@ TextField { leftPadding: readOnly || prefixIconSrc === '' || (isSwarmDetail && !root.isActive) ? 0 : 32 rightPadding: { - var total = 2 + var total = 2; if (!readOnly) { - if (suffixIconSrc !== "") - total =+ 30 + total = +30; if (suffixBisIconSrc !== "") - total =+ 30 + total = +30; } - return total + return total; } topPadding: 2 Keys.onPressed: function (event) { - if (event.key === Qt.Key_Enter - || event.key === Qt.Key_Return) { + if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return) { if (inputIsValid && acceptableInput) { - root.accepted() + root.accepted(); } - event.accepted = true - } - else { - root.keyPressed() + event.accepted = true; + } else { + root.keyPressed(); } } @@ -110,7 +101,7 @@ TextField { onReleased: function (event) { if (event.button === Qt.RightButton) - contextMenu.openMenuAt(event) + contextMenu.openMenuAt(event); } // The centered placeholder that appears in the design specs. @@ -133,16 +124,15 @@ TextField { color: isSwarmDetail ? textColor : root.accent visible: { if (!readOnly) { - if (isSwarmDetail && root.hovered - || root.isActive ) { - return true + if (isSwarmDetail && root.hovered || root.isActive) { + return true; } if (isSwarmDetail) { - return false + return false; } - return true + return true; } - return false + return false; } } @@ -152,9 +142,13 @@ TextField { height: size opacity: root.isActive && !readOnly && source.toString() !== '' visible: opacity - HoverHandler { cursorShape: Qt.ArrowCursor } - Behavior on opacity { - NumberAnimation { duration: JamiTheme.longFadeDuration/2 } + HoverHandler { + cursorShape: Qt.ArrowCursor + } + Behavior on opacity { + NumberAnimation { + duration: JamiTheme.longFadeDuration / 2 + } } } @@ -217,7 +211,7 @@ TextField { TapHandler { cursorShape: Qt.ArrowCursor onTapped: { - modalTextEditRoot.icoClicked() + modalTextEditRoot.icoClicked(); } } } diff --git a/src/app/commoncomponents/MaterialToolTip.qml b/src/app/commoncomponents/MaterialToolTip.qml index db9ffaa20be31a1fdcff44a5a2113dc0a809872f..5c66f01216dab797c52856a73f4f4e026884b27c 100644 --- a/src/app/commoncomponents/MaterialToolTip.qml +++ b/src/app/commoncomponents/MaterialToolTip.qml @@ -15,10 +15,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls - import net.jami.Constants 1.1 ToolTip { @@ -29,7 +27,7 @@ ToolTip { onVisibleChanged: { if (visible) - animation.start() + animation.start(); } contentItem: Text { @@ -48,14 +46,18 @@ ToolTip { ParallelAnimation { id: animation NumberAnimation { - target: background; properties: "opacity" - from: 0; to: 1.0 - duration: JamiTheme.shortFadeDuration + target: background + properties: "opacity" + from: 0 + to: 1.0 + duration: JamiTheme.shortFadeDuration } NumberAnimation { - target: background; properties: "scale" - from: 0.5; to: 1.0 - duration: JamiTheme.shortFadeDuration * 0.5 + target: background + properties: "scale" + from: 0.5 + to: 1.0 + duration: JamiTheme.shortFadeDuration * 0.5 } } } diff --git a/src/app/commoncomponents/MessageBubble.qml b/src/app/commoncomponents/MessageBubble.qml index 9309795224fd46647f06f7b55c6e8d12d51449a8..4293409c772079a27ea73148d48b2999bd68c3f1 100644 --- a/src/app/commoncomponents/MessageBubble.qml +++ b/src/app/commoncomponents/MessageBubble.qml @@ -15,13 +15,10 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import Qt5Compat.GraphicalEffects import net.jami.Constants 1.1 - - Rectangle { id: root property bool out: true @@ -46,10 +43,10 @@ Rectangle { color: root.color anchors { fill: parent - leftMargin: out ? root.width/2 : 0 - rightMargin: out ? 0 : root.width/2 - topMargin: type === MsgSeq.first ? root.height /2 : 0 - bottomMargin: type === MsgSeq.last ? root.height /2 : 0 + leftMargin: out ? root.width / 2 : 0 + rightMargin: out ? 0 : root.width / 2 + topMargin: type === MsgSeq.first ? root.height / 2 : 0 + bottomMargin: type === MsgSeq.last ? root.height / 2 : 0 } } @@ -61,10 +58,10 @@ Rectangle { color: root.color anchors { fill: parent - leftMargin: out ? 0 : root.width/2 - rightMargin: !out ? 0 : root.width/2 + leftMargin: out ? 0 : root.width / 2 + rightMargin: !out ? 0 : root.width / 2 topMargin: 0 - bottomMargin: root.height /2 + bottomMargin: root.height / 2 } } @@ -76,9 +73,9 @@ Rectangle { color: root.color anchors { fill: parent - leftMargin: out ? root.width/2 : 0 - rightMargin: out ? 0 : root.width/2 - topMargin: root.width/5 + leftMargin: out ? root.width / 2 : 0 + rightMargin: out ? 0 : root.width / 2 + topMargin: root.width / 5 bottomMargin: 0 } } diff --git a/src/app/commoncomponents/MessageOptionButton.qml b/src/app/commoncomponents/MessageOptionButton.qml index 381dc9b5462204db3d45444e872c10c67193e301..37f18b86c96226e0ae3d6b2b3c3f24753406eba1 100644 --- a/src/app/commoncomponents/MessageOptionButton.qml +++ b/src/app/commoncomponents/MessageOptionButton.qml @@ -15,12 +15,10 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts import Qt5Compat.GraphicalEffects - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 @@ -29,7 +27,7 @@ Button { id: buttonA icon.color: JamiTheme.emojiReactPushButtonColor - font.pixelSize:JamiTheme.messageOptionTextFontSize + font.pixelSize: JamiTheme.messageOptionTextFontSize height: 20 property string textButton diff --git a/src/app/commoncomponents/ModalTextEdit.qml b/src/app/commoncomponents/ModalTextEdit.qml index 67ef89514fa860c9ff457b5c3de1b04a89b105a2..105b168552384762a7e86e7e4b072eaaf4750473 100644 --- a/src/app/commoncomponents/ModalTextEdit.qml +++ b/src/app/commoncomponents/ModalTextEdit.qml @@ -14,9 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick - import net.jami.Adapters 1.1 import net.jami.Constants 1.1 @@ -25,9 +23,9 @@ Loader { id: root property string prefixIconSrc: JamiResources.round_edit_24dp_svg property color prefixIconColor: JamiTheme.editLineColor - property string suffixIconSrc : "" + property string suffixIconSrc: "" property color suffixIconColor: JamiTheme.buttonTintedBlue - property string suffixBisIconSrc : "" + property string suffixBisIconSrc: "" property color suffixBisIconColor: JamiTheme.buttonTintedBlue property color textColor: JamiTheme.textColor @@ -47,7 +45,9 @@ Loader { property bool fontBold: false property int echoMode: TextInput.Normal - property QtObject textValidator: RegularExpressionValidator { id: defaultValidator } + property QtObject textValidator: RegularExpressionValidator { + id: defaultValidator + } property var icon property bool isSettings @@ -57,8 +57,8 @@ Loader { property bool isEditing: false onStatusChanged: { - if(status == Loader.Ready && icon) - root.item.icon = icon + if (status == Loader.Ready && icon) + root.item.icon = icon; } // Always start with the static text component displayed first. @@ -76,9 +76,9 @@ Loader { // Needed to give proper focus to loaded item onFocusChanged: { if (root.focus && root.isPersistent) { - item.forceActiveFocus() + item.forceActiveFocus(); } - isEditing = !isEditing + isEditing = !isEditing; } // This is used when the user is not editing the text. @@ -104,7 +104,6 @@ Loader { Component { id: editComp - MaterialTextField { id: editCompField @@ -129,9 +128,9 @@ Loader { inputIsValid: root.inputIsValid onFocusChanged: { if (!focus && root.editMode) { - root.editMode = isPersistent + root.editMode = isPersistent; } - activeChanged(root.editMode) + activeChanged(root.editMode); } onIsActiveChanged: activeChanged(isActive) validator: root.textValidator @@ -145,8 +144,6 @@ Loader { // We use a loader to switch between the two components depending on the // editMode property. sourceComponent: { - editMode || isPersistent - ? editComp - : displayComp + editMode || isPersistent ? editComp : displayComp; } } diff --git a/src/app/commoncomponents/PasswordDialog.qml b/src/app/commoncomponents/PasswordDialog.qml index b9cc627f76a81b0956f16ad8475f632303ee1cca..f7e3fdb6f62e32fb131bf545b98b9da1bccda05b 100644 --- a/src/app/commoncomponents/PasswordDialog.qml +++ b/src/app/commoncomponents/PasswordDialog.qml @@ -15,10 +15,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts - import net.jami.Adapters 1.1 import net.jami.Constants 1.1 @@ -41,40 +39,37 @@ BaseModalDialog { height: Math.min(appWindow.height - 2 * JamiTheme.preferredMarginSize, JamiTheme.preferredDialogHeight) title: { - switch(purpose){ + switch (purpose) { case PasswordDialog.ExportAccount: - return JamiStrings.enterPassword + return JamiStrings.enterPassword; case PasswordDialog.ChangePassword: - return JamiStrings.changePassword + return JamiStrings.changePassword; case PasswordDialog.SetPassword: - return JamiStrings.setPassword + return JamiStrings.setPassword; } } function reportStatus(success) { - const title = success ? JamiStrings.success : JamiStrings.error - var info - switch(purpose) { - case PasswordDialog.ExportAccount: - info = success ? JamiStrings.backupSuccessful : JamiStrings.backupFailed - break - case PasswordDialog.ChangePassword: - info = success ? JamiStrings.changePasswordSuccess : JamiStrings.changePasswordFailed - break - case PasswordDialog.SetPassword: - info = success ? JamiStrings.setPasswordSuccess : JamiStrings.setPasswordFailed - break + const title = success ? JamiStrings.success : JamiStrings.error; + var info; + switch (purpose) { + case PasswordDialog.ExportAccount: + info = success ? JamiStrings.backupSuccessful : JamiStrings.backupFailed; + break; + case PasswordDialog.ChangePassword: + info = success ? JamiStrings.changePasswordSuccess : JamiStrings.changePasswordFailed; + break; + case PasswordDialog.SetPassword: + info = success ? JamiStrings.setPasswordSuccess : JamiStrings.setPasswordFailed; + break; } - viewCoordinator.presentDialog( - appWindow, - "commoncomponents/SimpleMessageDialog.qml", - { - title: title, - infoText: info, - buttonTitles: [JamiStrings.optionOk], - buttonStyles: [SimpleMessageDialog.ButtonStyle.TintedBlue] - }) - done(success, purpose) + viewCoordinator.presentDialog(appWindow, "commoncomponents/SimpleMessageDialog.qml", { + "title": title, + "infoText": info, + "buttonTitles": [JamiStrings.optionOk], + "buttonStyles": [SimpleMessageDialog.ButtonStyle.TintedBlue] + }); + done(success, purpose); } popupContent: ColumnLayout { @@ -85,38 +80,29 @@ BaseModalDialog { function validatePassword() { switch (purpose) { case PasswordDialog.ExportAccount: - btnConfirm.enabled = currentPasswordEdit.dynamicText.length > 0 - break + btnConfirm.enabled = currentPasswordEdit.dynamicText.length > 0; + break; case PasswordDialog.SetPassword: - btnConfirm.enabled = passwordEdit.dynamicText.length > 0 && - passwordEdit.dynamicText === confirmPasswordEdit.dynamicText - break + btnConfirm.enabled = passwordEdit.dynamicText.length > 0 && passwordEdit.dynamicText === confirmPasswordEdit.dynamicText; + break; default: - btnConfirm.enabled = currentPasswordEdit.dynamicText.length > 0 && - passwordEdit.dynamicText === confirmPasswordEdit.dynamicText + btnConfirm.enabled = currentPasswordEdit.dynamicText.length > 0 && passwordEdit.dynamicText === confirmPasswordEdit.dynamicText; } } function exportAccountQML() { - var success = false + var success = false; if (path.length > 0) { - success = AccountAdapter.exportToFile( - LRCInstance.currentAccountId, - path, - currentPasswordEdit.dynamicText) + success = AccountAdapter.exportToFile(LRCInstance.currentAccountId, path, currentPasswordEdit.dynamicText); } - reportStatus(success) - - close() + reportStatus(success); + close(); } function savePasswordQML() { - var success = AccountAdapter.savePassword( - LRCInstance.currentAccountId, - currentPasswordEdit.dynamicText, - passwordEdit.dynamicText) - reportStatus(success) - close() + var success = AccountAdapter.savePassword(LRCInstance.currentAccountId, currentPasswordEdit.dynamicText, passwordEdit.dynamicText); + reportStatus(success); + close(); } onVisibleChanged: validatePassword() @@ -129,9 +115,9 @@ BaseModalDialog { onTriggered: { if (purpose === PasswordDialog.ExportAccount) { - popupContentColumnLayout.exportAccountQML() + popupContentColumnLayout.exportAccountQML(); } else { - popupContentColumnLayout.savePasswordQML() + popupContentColumnLayout.savePasswordQML(); } } } @@ -143,12 +129,10 @@ BaseModalDialog { Layout.preferredWidth: JamiTheme.preferredFieldWidth Layout.preferredHeight: visible ? 48 : 0 - visible: purpose === PasswordDialog.ChangePassword || - purpose === PasswordDialog.ExportAccount + visible: purpose === PasswordDialog.ChangePassword || purpose === PasswordDialog.ExportAccount placeholderText: JamiStrings.enterCurrentPassword onDynamicTextChanged: popupContentColumnLayout.validatePassword() - } PasswordTextEdit { @@ -158,8 +142,7 @@ BaseModalDialog { Layout.preferredWidth: JamiTheme.preferredFieldWidth Layout.preferredHeight: visible ? 48 : 0 - visible: purpose === PasswordDialog.ChangePassword || - purpose === PasswordDialog.SetPassword + visible: purpose === PasswordDialog.ChangePassword || purpose === PasswordDialog.SetPassword placeholderText: JamiStrings.enterNewPassword @@ -173,8 +156,7 @@ BaseModalDialog { Layout.preferredWidth: JamiTheme.preferredFieldWidth Layout.preferredHeight: visible ? 48 : 0 - visible: purpose === PasswordDialog.ChangePassword || - purpose === PasswordDialog.SetPassword + visible: purpose === PasswordDialog.ChangePassword || purpose === PasswordDialog.SetPassword placeholderText: JamiStrings.confirmNewPassword @@ -193,19 +175,18 @@ BaseModalDialog { preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 - color: enabled? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey + color: enabled ? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey hoveredColor: JamiTheme.buttonTintedBlackHovered pressedColor: JamiTheme.buttonTintedBlackPressed secondary: true autoAccelerator: true enabled: purpose === PasswordDialog.SetPassword - text: (purpose === PasswordDialog.ExportAccount) ? JamiStrings.exportAccount : - JamiStrings.change + text: (purpose === PasswordDialog.ExportAccount) ? JamiStrings.exportAccount : JamiStrings.change onClicked: { - btnConfirm.enabled = false - timerToOperate.restart() + btnConfirm.enabled = false; + timerToOperate.restart(); } } diff --git a/src/app/commoncomponents/PasswordTextEdit.qml b/src/app/commoncomponents/PasswordTextEdit.qml index 8082cd4e0ab731eb238f6ce9bfe179c3d8c30f1c..822db16ea775d6a1f6378d9f222a2d64d47620ca 100644 --- a/src/app/commoncomponents/PasswordTextEdit.qml +++ b/src/app/commoncomponents/PasswordTextEdit.qml @@ -14,9 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick - import net.jami.Adapters 1.1 import net.jami.Constants 1.1 import net.jami.Models 1.1 @@ -40,17 +38,16 @@ ModalTextEdit { onIcoClicked: { if (echoMode == TextInput.Normal) { - echoMode = TextInput.Password - suffixBisIconSrc = JamiResources.eye_cross_svg + echoMode = TextInput.Password; + suffixBisIconSrc = JamiResources.eye_cross_svg; } else { - echoMode = TextInput.Normal - suffixBisIconSrc = JamiResources.noun_eye_svg + echoMode = TextInput.Normal; + suffixBisIconSrc = JamiResources.noun_eye_svg; } } function startEditing() { - root.editMode = true - forceActiveFocus() + root.editMode = true; + forceActiveFocus(); } } - diff --git a/src/app/commoncomponents/PhotoboothView.qml b/src/app/commoncomponents/PhotoboothView.qml index c8def41da55860ffd5c600de761503b2d7187afa..3cf67ee50da65dc01c6178f3c71c27f2405b32d0 100644 --- a/src/app/commoncomponents/PhotoboothView.qml +++ b/src/app/commoncomponents/PhotoboothView.qml @@ -15,16 +15,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts import Qt.labs.platform import Qt5Compat.GraphicalEffects - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../mainview/components" Item { @@ -54,7 +51,7 @@ Item { anchors.centerIn: parent anchors.margins: 1 - mode: newItem? Avatar.Mode.Conversation : Avatar.Mode.Account + mode: newItem ? Avatar.Mode.Conversation : Avatar.Mode.Account fillMode: Image.PreserveAspectCrop showPresenceIndicator: false @@ -81,16 +78,11 @@ Item { enabled: avatar.visible && !root.readOnly visible: enabled - - - onClicked : viewCoordinator.presentDialog( - parent, - "commoncomponents/PhotoboothPopup.qml", - { parent: editImage, - imageId: root.imageId, - newItem: root.newItem, - }) - + onClicked: viewCoordinator.presentDialog(parent, "commoncomponents/PhotoboothPopup.qml", { + "parent": editImage, + "imageId": root.imageId, + "newItem": root.newItem + }) } } } diff --git a/src/app/commoncomponents/PreferenceItemDelegate.qml b/src/app/commoncomponents/PreferenceItemDelegate.qml index 9304d6d034138b4671c3ef55cc8d46459d69272d..b1f2f9a397161146135528890d2bd5b6c7ff25c3 100644 --- a/src/app/commoncomponents/PreferenceItemDelegate.qml +++ b/src/app/commoncomponents/PreferenceItemDelegate.qml @@ -15,17 +15,14 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts import Qt.labs.platform - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - -import "../commoncomponents" +import "." import "../settingsview/components" ItemDelegate { @@ -47,45 +44,41 @@ ItemDelegate { function getNewPreferenceValueSlot(index) { switch (preferenceType) { - case PreferenceItemListModel.LIST: - pluginListPreferenceModel.idx = index - preferenceNewValue = pluginListPreferenceModel.preferenceNewValue - btnPreferenceClicked() - break - case PreferenceItemListModel.PATH: - if (index === 0) { - var dlg = viewCoordinator.presentDialog( - appWindow, - "commoncomponents/JamiFileDialog.qml", - { - title: JamiStrings.selectAnImage.arg(preferenceName), - fileMode: JamiFileDialog.OpenFile, - folder: JamiQmlUtils.qmlFilePrefix + currentPath, - nameFilters: fileFilters - }) - dlg.fileAccepted.connect(function (file) { - var url = UtilsAdapter.getAbsPath(file.toString()) - preferenceNewValue = url - btnPreferenceClicked() - }) - } - else - btnPreferenceClicked() - break - case PreferenceItemListModel.EDITTEXT: - preferenceNewValue = editTextPreference.text - btnPreferenceClicked() - break - case PreferenceItemListModel.SWITCH: - preferenceNewValue = index ? "1" : "0" - btnPreferenceClicked() - break - default: - break + case PreferenceItemListModel.LIST: + pluginListPreferenceModel.idx = index; + preferenceNewValue = pluginListPreferenceModel.preferenceNewValue; + btnPreferenceClicked(); + break; + case PreferenceItemListModel.PATH: + if (index === 0) { + var dlg = viewCoordinator.presentDialog(appWindow, "commoncomponents/JamiFileDialog.qml", { + "title": JamiStrings.selectAnImage.arg(preferenceName), + "fileMode": JamiFileDialog.OpenFile, + "folder": JamiQmlUtils.qmlFilePrefix + currentPath, + "nameFilters": fileFilters + }); + dlg.fileAccepted.connect(function (file) { + var url = UtilsAdapter.getAbsPath(file.toString()); + preferenceNewValue = url; + btnPreferenceClicked(); + }); + } else + btnPreferenceClicked(); + break; + case PreferenceItemListModel.EDITTEXT: + preferenceNewValue = editTextPreference.text; + btnPreferenceClicked(); + break; + case PreferenceItemListModel.SWITCH: + preferenceNewValue = index ? "1" : "0"; + btnPreferenceClicked(); + break; + default: + break; } } - RowLayout{ + RowLayout { anchors.fill: parent Text { diff --git a/src/app/commoncomponents/PresenceIndicator.qml b/src/app/commoncomponents/PresenceIndicator.qml index 9a6e8abf9075eb82fe6184ee4610453a7bf0f3c1..3546eb9db1fd57ec05c2a8e76f707e75fd0e6946 100644 --- a/src/app/commoncomponents/PresenceIndicator.qml +++ b/src/app/commoncomponents/PresenceIndicator.qml @@ -15,9 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick - import net.jami.Models 1.1 import net.jami.Constants 1.1 @@ -40,9 +38,9 @@ Rectangle { } color: { if (status === Account.Status.REGISTERED) - return JamiTheme.presenceGreen + return JamiTheme.presenceGreen; else if (status === Account.Status.TRYING) - return JamiTheme.unPresenceOrange - return JamiTheme.notificationRed + return JamiTheme.unPresenceOrange; + return JamiTheme.notificationRed; } } diff --git a/src/app/commoncomponents/PushButton.qml b/src/app/commoncomponents/PushButton.qml index 11ec262126bbdfe0693b81b1156b6c2d50e8f90d..951eacea8b784f38d5849c447d6035cedc1f9ca8 100644 --- a/src/app/commoncomponents/PushButton.qml +++ b/src/app/commoncomponents/PushButton.qml @@ -16,20 +16,16 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls - import net.jami.Constants 1.1 -// // PushButton contains the following configurable properties: // - colored states // - radius // - minimal support for text // - animation duration // TODO: allow transparent background tinted text/icon -// AbstractButton { id: root @@ -85,7 +81,7 @@ AbstractButton { hoverEnabled: true focusPolicy: Qt.TabFocus - property bool forceHovered: false + property bool forceHovered: false Accessible.role: Accessible.Button Accessible.name: buttonText @@ -112,18 +108,18 @@ AbstractButton { source: { if (checkable && checkedImageSource) - return checked ? checkedImageSource : normalImageSource + return checked ? checkedImageSource : normalImageSource; else - return normalImageSource + return normalImageSource; } color: { if (checked && checkedImageColor) - return checkedImageColor + return checkedImageColor; else if (imageColor) - return imageColor + return imageColor; else - return JamiTheme.transparentColor + return JamiTheme.transparentColor; } } @@ -156,49 +152,79 @@ AbstractButton { states: [ State { - name: "checked"; when: checked - PropertyChanges { target: background; color: checkedColor} + name: "checked" + when: checked + PropertyChanges { + target: background + color: checkedColor + } }, State { - name: "pressed"; when: pressed - PropertyChanges { target: background; color: pressedColor} + name: "pressed" + when: pressed + PropertyChanges { + target: background + color: pressedColor + } }, State { - name: "hovered"; when: hovered || root.focus - PropertyChanges { target: background; color: hoveredColor } + name: "hovered" + when: hovered || root.focus + PropertyChanges { + target: background + color: hoveredColor + } }, State { - name: "forceHovered"; when: forceHovered || root.focus - PropertyChanges { target: background; color: hoveredColor } + name: "forceHovered" + when: forceHovered || root.focus + PropertyChanges { + target: background + color: hoveredColor + } }, State { - name: "normal"; when: !hovered && ! checked - PropertyChanges { target: background; color: normalColor } + name: "normal" + when: !hovered && !checked + PropertyChanges { + target: background + color: normalColor + } } ] transitions: [ Transition { - to: "normal"; reversible: true; enabled: duration - ColorAnimation { duration: root.duration } + to: "normal" + reversible: true + enabled: duration + ColorAnimation { + duration: root.duration + } }, Transition { - to: "pressed"; reversible: true; enabled: duration - ColorAnimation { duration: root.duration * 0.5 } + to: "pressed" + reversible: true + enabled: duration + ColorAnimation { + duration: root.duration * 0.5 + } }, Transition { - to: ""; reversible: true; enabled: duration - ColorAnimation { duration: root.duration } + to: "" + reversible: true + enabled: duration + ColorAnimation { + duration: root.duration + } } ] - } Keys.onPressed: function (keyEvent) { - if (keyEvent.key === Qt.Key_Enter || - keyEvent.key === Qt.Key_Return) { - clicked() - keyEvent.accepted = true + if (keyEvent.key === Qt.Key_Enter || keyEvent.key === Qt.Key_Return) { + clicked(); + keyEvent.accepted = true; } } } diff --git a/src/app/commoncomponents/ReadStatus.qml b/src/app/commoncomponents/ReadStatus.qml index 1f608dc9d71b06c4371e6d86d9ba525ae6f26dcb..b5ffe75e63332f248c27427d64c629272b08cc8b 100644 --- a/src/app/commoncomponents/ReadStatus.qml +++ b/src/app/commoncomponents/ReadStatus.qml @@ -15,12 +15,10 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts import Qt5Compat.GraphicalEffects - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 @@ -33,7 +31,7 @@ ListView { orientation: ListView.Horizontal interactive: false Layout.alignment: Qt.AlignRight - spacing: -(JamiTheme.avatarReadReceiptSize/3) + spacing: -(JamiTheme.avatarReadReceiptSize / 3) delegate: Avatar { width: JamiTheme.avatarReadReceiptSize @@ -44,4 +42,4 @@ ListView { showPresenceIndicator: false mode: Avatar.Mode.Contact } -} \ No newline at end of file +} diff --git a/src/app/commoncomponents/ReplyToRow.qml b/src/app/commoncomponents/ReplyToRow.qml index 6d9ea0678dfdb9aa46bb8960ab6dbcf1a24d5f44..a0a80e713102557c16dc2e51fa8575ded906d519 100644 --- a/src/app/commoncomponents/ReplyToRow.qml +++ b/src/app/commoncomponents/ReplyToRow.qml @@ -14,16 +14,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - Item { id: root @@ -34,14 +31,13 @@ Item { property int requestId: -1 property var replyTransferName: MessagesAdapter.dataForInteraction(ReplyTo, MessageList.TransferName) - Component.onCompleted: { // Make sure we show the original post // In the future, we may just want to load the previous interaction of the thread // and not show it, but for now we can simplify. if (ReplyTo !== "") { // Store the request Id for later filtering. - requestId = MessagesAdapter.loadConversationUntil(ReplyTo) + requestId = MessagesAdapter.loadConversationUntil(ReplyTo); } } @@ -51,8 +47,8 @@ Item { function onMoreMessagesLoaded(loadingRequestId) { // Filter for the request Id we're waiting for (now the message is loaded). if (requestId === loadingRequestId) { - requestId = -1 - replyTransferName = MessagesAdapter.dataForInteraction(ReplyTo, MessageList.TransferName) + requestId = -1; + replyTransferName = MessagesAdapter.dataForInteraction(ReplyTo, MessageList.TransferName); } } } @@ -60,11 +56,7 @@ Item { TextEdit { id: body - text: replyTransferName ? - replyTransferName : - (ReplyToBody === "" && ReplyToAuthor !== "") ? - JamiStrings.deleteReplyMessage : - (ReplyToBody ? ReplyToBody : "") + text: replyTransferName ? replyTransferName : (ReplyToBody === "" && ReplyToAuthor !== "") ? JamiStrings.deleteReplyMessage : (ReplyToBody ? ReplyToBody : "") width: Math.min(JamiTheme.sbsMessageBaseMaximumReplyWidth, implicitWidth) @@ -72,7 +64,7 @@ Item { wrapMode: Text.WrapAtWordBoundaryOrAnywhere selectByMouse: true - font.pixelSize: IsEmojiOnly? JamiTheme.chatviewEmojiSize : JamiTheme.emojiBubbleSize + font.pixelSize: IsEmojiOnly ? JamiTheme.chatviewEmojiSize : JamiTheme.emojiBubbleSize font.hintingPreference: Font.PreferNoHinting renderType: Text.NativeRendering textFormat: Text.MarkdownText @@ -80,19 +72,19 @@ Item { color: getBaseColor() function getBaseColor() { - var baseColor + var baseColor; if (IsEmojiOnly) { if (JamiTheme.darkTheme) - baseColor = JamiTheme.chatviewTextColorLight + baseColor = JamiTheme.chatviewTextColorLight; else - baseColor = JamiTheme.chatviewTextColorDark + baseColor = JamiTheme.chatviewTextColorDark; } else { if (UtilsAdapter.luma(replyBubble.color)) - baseColor = JamiTheme.chatviewTextColorLight + baseColor = JamiTheme.chatviewTextColorLight; else - baseColor = JamiTheme.chatviewTextColorDark + baseColor = JamiTheme.chatviewTextColorDark; } - return baseColor + return baseColor; } } @@ -100,8 +92,14 @@ Item { anchors.fill: parent visible: body.height > JamiTheme.sbsMessageBaseMaximumReplyHeight gradient: Gradient { - GradientStop {position: 0.66 ; color: "transparent"} - GradientStop {position: 1 ; color: replyBubble.color} + GradientStop { + position: 0.66 + color: "transparent" + } + GradientStop { + position: 1 + color: replyBubble.color + } } } } diff --git a/src/app/commoncomponents/ResponsiveImage.qml b/src/app/commoncomponents/ResponsiveImage.qml index 6f3b798ec72e8a88232be0466673ffabe6093ec8..7bdf33b0a20de4580d8dfd302932f1687d33ddfc 100644 --- a/src/app/commoncomponents/ResponsiveImage.qml +++ b/src/app/commoncomponents/ResponsiveImage.qml @@ -15,10 +15,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import Qt5Compat.GraphicalEffects - import net.jami.Constants 1.1 import net.jami.Helpers 1.1 @@ -40,8 +38,8 @@ Item { property bool mirrorVertically: false property bool isSvg: { - var match = /[^.]+$/.exec(source) - return match !== null && match[0] === 'svg' + var match = /[^.]+$/.exec(source); + return match !== null && match[0] === 'svg'; } anchors.horizontalCenterOffset: offset.x @@ -55,7 +53,7 @@ Item { target: CurrentScreenInfo function onDevicePixelRatioChanged() { - image.setSourceSize() + image.setSourceSize(); } } @@ -73,9 +71,9 @@ Item { mirrorVertically: root.mirrorVertically function setSourceSize() { - sourceSize = undefined + sourceSize = undefined; if (isSvg) - sourceSize = Qt.size(width, height) + sourceSize = Qt.size(width, height); } Component.onCompleted: setSourceSize() @@ -90,8 +88,7 @@ Item { HoverHandler { target: parent onHoveredChanged: { - root.hovered = hovered - + root.hovered = hovered; } } } diff --git a/src/app/commoncomponents/SBSContextMenu.qml b/src/app/commoncomponents/SBSContextMenu.qml index 9d5b951f655d1e52d5d5eb5f15b4210681d93369..64f2893ca98b585dda67b39570266e05f45178da 100644 --- a/src/app/commoncomponents/SBSContextMenu.qml +++ b/src/app/commoncomponents/SBSContextMenu.qml @@ -15,15 +15,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - -import "../commoncomponents" -import "../commoncomponents/contextmenu" +import "." +import "contextmenu" ContextMenuAutoLoader { id: root @@ -41,7 +38,7 @@ ContextMenuAutoLoader { canTrigger: root.transferId !== "" itemName: JamiStrings.saveFile onClicked: { - MessagesAdapter.copyToDownloads(root.transferId, root.transferName) + MessagesAdapter.copyToDownloads(root.transferId, root.transferName); } }, GeneralMenuItem { @@ -50,7 +47,7 @@ ContextMenuAutoLoader { canTrigger: root.transferId !== "" itemName: JamiStrings.openLocation onClicked: { - MessagesAdapter.openDirectory(root.location) + MessagesAdapter.openDirectory(root.location); } }, GeneralMenuItem { @@ -58,8 +55,8 @@ ContextMenuAutoLoader { itemName: JamiStrings.reply onClicked: { - MessagesAdapter.editId = "" - MessagesAdapter.replyToId = root.msgId + MessagesAdapter.editId = ""; + MessagesAdapter.replyToId = root.msgId; } }, GeneralMenuItem { @@ -68,8 +65,8 @@ ContextMenuAutoLoader { canTrigger: transferId === "" && isOutgoing itemName: JamiStrings.edit onClicked: { - MessagesAdapter.replyToId = "" - MessagesAdapter.editId = root.msgId + MessagesAdapter.replyToId = ""; + MessagesAdapter.editId = root.msgId; } }, GeneralMenuItem { @@ -79,11 +76,10 @@ ContextMenuAutoLoader { canTrigger: transferId === "" && isOutgoing itemName: JamiStrings.optionDelete onClicked: { - MessagesAdapter.editMessage(CurrentConversation.id, "", root.msgId) + MessagesAdapter.editMessage(CurrentConversation.id, "", root.msgId); } } ] Component.onCompleted: menuItemsToLoad = menuItems } - diff --git a/src/app/commoncomponents/SettingParaCombobox.qml b/src/app/commoncomponents/SettingParaCombobox.qml index 4b3b90b1fb02a6e60dac37515d1ad285fd5911ea..82e6e7d68339e5b9c872dca7e5bf852ec899fb00 100644 --- a/src/app/commoncomponents/SettingParaCombobox.qml +++ b/src/app/commoncomponents/SettingParaCombobox.qml @@ -15,10 +15,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls - import net.jami.Constants 1.1 ComboBox { @@ -43,9 +41,9 @@ ComboBox { // The placeholder text is either the placeholderText property or a default text. // Otherwise, display the currentSelectionText property. if (currentIndex < 0 && !count) { - return placeholderText !== "" ? placeholderText : JamiStrings.notAvailable + return placeholderText !== "" ? placeholderText : JamiStrings.notAvailable; } - return currentSelectionText + return currentSelectionText; } delegate: ItemDelegate { @@ -53,10 +51,11 @@ ComboBox { contentItem: Text { text: { - if (index < 0) return '' - var currentItem = root.delegateModel.items.get(index) - const value = currentItem.model[root.textRole] - return value === undefined ? '' : value.toString() + if (index < 0) + return ''; + var currentItem = root.delegateModel.items.get(index); + const value = currentItem.model[root.textRole]; + return value === undefined ? '' : value.toString(); } color: hovered ? JamiTheme.comboboxTextColorHovered : JamiTheme.textColor @@ -68,7 +67,6 @@ ComboBox { background: Rectangle { color: hovered ? JamiTheme.comboboxBackgroundColorHovered : JamiTheme.transparentColor } - } indicator: ResponsiveImage { @@ -81,8 +79,7 @@ ComboBox { anchors.verticalCenter: parent.verticalCenter anchors.rightMargin: 16 - source: popup.visible ? JamiResources.expand_less_24dp_svg - : JamiResources.expand_more_24dp_svg + source: popup.visible ? JamiResources.expand_less_24dp_svg : JamiResources.expand_more_24dp_svg color: JamiTheme.comboboxIconColor } @@ -128,7 +125,5 @@ ComboBox { border.color: JamiTheme.comboboxBorderColorActive radius: 5 } - } - } diff --git a/src/app/commoncomponents/SidePanelBase.qml b/src/app/commoncomponents/SidePanelBase.qml index 7bfc76ff7752f2724fb6a847a49dd28129005fa7..353c4c762b02d9e3f5fce9ce373b2fa040d2ac6d 100644 --- a/src/app/commoncomponents/SidePanelBase.qml +++ b/src/app/commoncomponents/SidePanelBase.qml @@ -6,8 +6,8 @@ Rectangle { anchors.fill: parent // Override these if needed. - property var select: function() {} - property var deselect: function() {} + property var select: function () {} + property var deselect: function () {} signal indexSelected(int index) signal deselected diff --git a/src/app/commoncomponents/SimpleMessageDialog.qml b/src/app/commoncomponents/SimpleMessageDialog.qml index fa06c4dfafef8ad6ff024c29144d977447fee205..c31a6fb50e0eca6edc2c499ee9355a0ef10a41cd 100644 --- a/src/app/commoncomponents/SimpleMessageDialog.qml +++ b/src/app/commoncomponents/SimpleMessageDialog.qml @@ -15,11 +15,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Adapters 1.1 import net.jami.Constants 1.1 @@ -40,15 +38,13 @@ BaseModalDialog { property var innerContentData: [] function openWithParameters(title, info = "") { - root.title = title + root.title = title; if (info !== "") - root.infoText = info - open() + root.infoText = info; + open(); } - width: Math.max(JamiTheme.preferredDialogWidth, - buttonTitles.length * (JamiTheme.preferredFieldWidth / 2 - + JamiTheme.preferredMarginSize)) + width: Math.max(JamiTheme.preferredDialogWidth, buttonTitles.length * (JamiTheme.preferredFieldWidth / 2 + JamiTheme.preferredMarginSize)) height: JamiTheme.preferredDialogHeight / 2 - JamiTheme.preferredMarginSize popupContent: ColumnLayout { @@ -94,33 +90,33 @@ BaseModalDialog { buttontextHeightMargin: JamiTheme.buttontextHeightMargin color: { - switch(buttonStyles[modelData]) { + switch (buttonStyles[modelData]) { case SimpleMessageDialog.ButtonStyle.TintedBlue: - return JamiTheme.buttonTintedBlue + return JamiTheme.buttonTintedBlue; case SimpleMessageDialog.ButtonStyle.TintedBlack: - return JamiTheme.buttonTintedBlack + return JamiTheme.buttonTintedBlack; case SimpleMessageDialog.ButtonStyle.TintedRed: - return JamiTheme.buttonTintedRed + return JamiTheme.buttonTintedRed; } } hoveredColor: { - switch(buttonStyles[modelData]) { + switch (buttonStyles[modelData]) { case SimpleMessageDialog.ButtonStyle.TintedBlue: - return JamiTheme.buttonTintedBlueHovered + return JamiTheme.buttonTintedBlueHovered; case SimpleMessageDialog.ButtonStyle.TintedBlack: - return JamiTheme.buttonTintedBlackHovered + return JamiTheme.buttonTintedBlackHovered; case SimpleMessageDialog.ButtonStyle.TintedRed: - return JamiTheme.buttonTintedRedHovered + return JamiTheme.buttonTintedRedHovered; } } pressedColor: { - switch(buttonStyles[modelData]) { + switch (buttonStyles[modelData]) { case SimpleMessageDialog.ButtonStyle.TintedBlue: - return JamiTheme.buttonTintedBluePressed + return JamiTheme.buttonTintedBluePressed; case SimpleMessageDialog.ButtonStyle.TintedBlack: - return JamiTheme.buttonTintedBlackPressed + return JamiTheme.buttonTintedBlackPressed; case SimpleMessageDialog.ButtonStyle.TintedRed: - return JamiTheme.buttonTintedRedPressed + return JamiTheme.buttonTintedRedPressed; } } secondary: true @@ -130,8 +126,8 @@ BaseModalDialog { onClicked: { if (buttonCallBacks[modelData]) - buttonCallBacks[modelData]() - close() + buttonCallBacks[modelData](); + close(); } } } diff --git a/src/app/commoncomponents/SpinnerButton.qml b/src/app/commoncomponents/SpinnerButton.qml index 5e324f4b69b04d3a3a599d075d88561058783b2e..4f820e16de174f50e783cfda7eb1addbf9ea686a 100644 --- a/src/app/commoncomponents/SpinnerButton.qml +++ b/src/app/commoncomponents/SpinnerButton.qml @@ -15,7 +15,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import net.jami.Constants 1.1 MaterialButton { @@ -25,12 +24,9 @@ MaterialButton { property string spinnerTriggeredtext: value property string normalText: value - animatedIconSource: spinnerTriggered ? - JamiResources.jami_rolling_spinner_gif : - "" + animatedIconSource: spinnerTriggered ? JamiResources.jami_rolling_spinner_gif : "" text: spinnerTriggered ? spinnerTriggeredtext : normalText - color: !enabled ? JamiTheme.buttonTintedGreyInactive : - JamiTheme.buttonTintedBlue + color: !enabled ? JamiTheme.buttonTintedGreyInactive : JamiTheme.buttonTintedBlue hoverEnabled: enabled hoveredColor: JamiTheme.buttonTintedBlueHovered diff --git a/src/app/commoncomponents/SpinningAnimation.qml b/src/app/commoncomponents/SpinningAnimation.qml index 4493a6cf4770e10dcac2fd6ce33d28ce5e8489f0..740df45d402c7dc395a3af7431b98904f8aa68ca 100644 --- a/src/app/commoncomponents/SpinningAnimation.qml +++ b/src/app/commoncomponents/SpinningAnimation.qml @@ -16,7 +16,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import Qt5Compat.GraphicalEffects @@ -43,11 +42,17 @@ Item { angle: 0.0 gradient: Gradient { - GradientStop { position: 0.5; color: "transparent" } - GradientStop { position: 1.0; color: "white" } + GradientStop { + position: 0.5 + color: "transparent" + } + GradientStop { + position: 1.0 + color: "white" + } } - RotationAnimation on angle { + RotationAnimation on angle { running: root.visible loops: Animation.Infinite duration: spinningAnimationDuration @@ -89,7 +94,7 @@ Item { } } - RotationAnimation on angle { + RotationAnimation on angle { running: root.visible loops: Animation.Infinite duration: spinningAnimationDuration diff --git a/src/app/commoncomponents/TextMessageDelegate.qml b/src/app/commoncomponents/TextMessageDelegate.qml index 312cf6a828750badf1c8c120573bb988a9611505..b46d430693f84d8d64c1518c0630fe1305a17d97 100644 --- a/src/app/commoncomponents/TextMessageDelegate.qml +++ b/src/app/commoncomponents/TextMessageDelegate.qml @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2021-2023 Savoir-faire Linux Inc. * Author: Trevor Tabah <trevor.tabah@savoirfairelinux.com> * Author: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com> @@ -16,26 +16,22 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts import Qt5Compat.GraphicalEffects - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 import net.jami.Enums 1.1 SBSMessageBase { - id : root + id: root property bool isRemoteImage property bool isEmojiOnly: IsEmojiOnly property real maxMsgWidth: root.width - senderMargin - 2 * hPadding - avatarBlockWidth - property string colorUrl: UtilsAdapter.luma(bubble.color) ? - JamiTheme.chatviewLinkColorLight : - JamiTheme.chatviewLinkColorDark + property string colorUrl: UtilsAdapter.luma(bubble.color) ? JamiTheme.chatviewLinkColorLight : JamiTheme.chatviewLinkColorDark isOutgoing: Author === CurrentAccount.uri author: Author @@ -48,7 +44,6 @@ SBSMessageBase { textContentWidth: textEditId.width textContentHeight: textEditId.height - innerContent.children: [ TextEdit { id: textEditId @@ -57,9 +52,9 @@ SBSMessageBase { anchors.right: isOutgoing ? parent.right : undefined text: { if (LinkifiedBody !== "" && Linkified.length === 0) { - MessagesAdapter.parseMessageUrls(Id, Body, UtilsAdapter.getAppValue(Settings.DisplayHyperlinkPreviews), root.colorUrl) + MessagesAdapter.parseMessageUrls(Id, Body, UtilsAdapter.getAppValue(Settings.DisplayHyperlinkPreviews), root.colorUrl); } - return (LinkifiedBody !== "") ? LinkifiedBody : "*("+ JamiStrings.deletedMessage +")*" + return (LinkifiedBody !== "") ? LinkifiedBody : "*(" + JamiStrings.deletedMessage + ")*"; } horizontalAlignment: Text.AlignLeft @@ -69,18 +64,16 @@ SBSMessageBase { width: { if (extraContent.active) - Math.max(extraContent.width, - Math.min((2/3)*root.maxMsgWidth,implicitWidth - avatarBlockWidth, - extraContent.minSize) - senderMargin ) + Math.max(extraContent.width, Math.min((2 / 3) * root.maxMsgWidth, implicitWidth - avatarBlockWidth, extraContent.minSize) - senderMargin); else if (isEmojiOnly) - Math.min((2/3)*root.maxMsgWidth,implicitWidth, innerContent.width - senderMargin - (innerContent.width - senderMargin) % (JamiTheme.chatviewEmojiSize + 2)) + Math.min((2 / 3) * root.maxMsgWidth, implicitWidth, innerContent.width - senderMargin - (innerContent.width - senderMargin) % (JamiTheme.chatviewEmojiSize + 2)); else - Math.min((2/3)*root.maxMsgWidth,implicitWidth, innerContent.width - senderMargin) + Math.min((2 / 3) * root.maxMsgWidth, implicitWidth, innerContent.width - senderMargin); } wrapMode: Label.WrapAtWordBoundaryOrAnywhere selectByMouse: true - font.pixelSize: isEmojiOnly? JamiTheme.chatviewEmojiSize : JamiTheme.emojiBubbleSize + font.pixelSize: isEmojiOnly ? JamiTheme.chatviewEmojiSize : JamiTheme.emojiBubbleSize font.hintingPreference: Font.PreferNoHinting renderType: Text.NativeRendering textFormat: Text.MarkdownText @@ -90,26 +83,26 @@ SBSMessageBase { color: getBaseColor() function getBaseColor() { - var baseColor + var baseColor; if (isEmojiOnly) { if (JamiTheme.darkTheme) - baseColor = JamiTheme.chatviewTextColorLight + baseColor = JamiTheme.chatviewTextColorLight; else - baseColor = JamiTheme.chatviewTextColorDark + baseColor = JamiTheme.chatviewTextColorDark; } else { if (UtilsAdapter.luma(bubble.color)) - baseColor = JamiTheme.chatviewTextColorLight + baseColor = JamiTheme.chatviewTextColorLight; else - baseColor = JamiTheme.chatviewTextColorDark + baseColor = JamiTheme.chatviewTextColorDark; } - return baseColor + return baseColor; } TapHandler { enabled: parent.selectedText.length > 0 acceptedButtons: Qt.RightButton onTapped: function onTapped(eventPoint) { - ctxMenu.openMenuAt(eventPoint.position) + ctxMenu.openMenuAt(eventPoint.position); } } @@ -126,7 +119,7 @@ SBSMessageBase { anchors.right: isOutgoing ? parent.right : undefined visible: PreviousBodies.length !== 0 - ResponsiveImage { + ResponsiveImage { id: editedImage Layout.leftMargin: JamiTheme.preferredMarginSize @@ -149,18 +142,15 @@ SBSMessageBase { Layout.bottomMargin: JamiTheme.preferredMarginSize text: JamiStrings.edited - color: UtilsAdapter.luma(bubble.color) ? - JamiTheme.chatviewTextColorLight : - JamiTheme.chatviewTextColorDark + color: UtilsAdapter.luma(bubble.color) ? JamiTheme.chatviewTextColorLight : JamiTheme.chatviewTextColorDark font.pointSize: JamiTheme.editedFontSize TapHandler { acceptedButtons: Qt.LeftButton onTapped: { - viewCoordinator.presentDialog( - appWindow, - "commoncomponents/EditedPopup.qml", - {previousBodies: PreviousBodies}) + viewCoordinator.presentDialog(appWindow, "commoncomponents/EditedPopup.qml", { + "previousBodies": PreviousBodies + }); } } } @@ -177,12 +167,12 @@ SBSMessageBase { spacing: 12 Component.onCompleted: { - isRemoteImage = MessagesAdapter.isRemoteImage(LinkPreviewInfo.url) + isRemoteImage = MessagesAdapter.isRemoteImage(LinkPreviewInfo.url); } HoverHandler { target: previewContent onHoveredChanged: { - root.hoveredLink = hovered ? LinkPreviewInfo.url : "" + root.hoveredLink = hovered ? LinkPreviewInfo.url : ""; } cursorShape: Qt.PointingHandCursor } @@ -190,9 +180,7 @@ SBSMessageBase { id: img cache: false - source: isRemoteImage ? - LinkPreviewInfo.url : - (hasImage ? LinkPreviewInfo.image : "") + source: isRemoteImage ? LinkPreviewInfo.url : (hasImage ? LinkPreviewInfo.image : "") fillMode: Image.PreserveAspectCrop mipmap: true @@ -201,9 +189,7 @@ SBSMessageBase { asynchronous: true readonly property bool hasImage: LinkPreviewInfo.image !== null property real aspectRatio: implicitWidth / implicitHeight - property real adjustedWidth: Math.min(extraContent.maxSize, - Math.max(extraContent.minSize, - maxMsgWidth)) + property real adjustedWidth: Math.min(extraContent.maxSize, Math.max(extraContent.minSize, maxMsgWidth)) Layout.preferredWidth: adjustedWidth Layout.preferredHeight: Math.ceil(adjustedWidth / aspectRatio) Rectangle { @@ -214,7 +200,10 @@ SBSMessageBase { layer.enabled: isRemoteImage layer.effect: OpacityMask { maskSource: MessageBubble { - Rectangle { height: msgRadius; width: parent.width } + Rectangle { + height: msgRadius + width: parent.width + } out: isOutgoing type: seq width: img.width @@ -237,9 +226,7 @@ SBSMessageBase { wrapMode: Label.WrapAtWordBoundaryOrAnywhere renderType: Text.NativeRendering textFormat: TextEdit.RichText - color: UtilsAdapter.luma(bubble.color) ? - JamiTheme.chatviewTextColorLight : - JamiTheme.chatviewTextColorDark + color: UtilsAdapter.luma(bubble.color) ? JamiTheme.chatviewTextColorLight : JamiTheme.chatviewTextColorDark visible: LinkPreviewInfo.title !== null text: LinkPreviewInfo.title } @@ -254,7 +241,6 @@ SBSMessageBase { font.underline: root.hoveredLink text: LinkPreviewInfo.description color: root.colorUrl - } Label { width: parent.width @@ -263,9 +249,7 @@ SBSMessageBase { wrapMode: Label.WrapAtWordBoundaryOrAnywhere renderType: Text.NativeRendering textFormat: TextEdit.RichText - color: UtilsAdapter.luma(bubble.color) ? - JamiTheme.chatviewTextColorLight : - JamiTheme.chatviewTextColorDark + color: UtilsAdapter.luma(bubble.color) ? JamiTheme.chatviewTextColorLight : JamiTheme.chatviewTextColorDark text: LinkPreviewInfo.domain } } @@ -274,11 +258,15 @@ SBSMessageBase { ] opacity: 0 - Behavior on opacity { NumberAnimation { duration: 100 } } + Behavior on opacity { + NumberAnimation { + duration: 100 + } + } Component.onCompleted: { if (Linkified.length === 0) { - MessagesAdapter.parseMessageUrls(Id, Body, UtilsAdapter.getAppValue(Settings.DisplayHyperlinkPreviews), root.colorUrl) + MessagesAdapter.parseMessageUrls(Id, Body, UtilsAdapter.getAppValue(Settings.DisplayHyperlinkPreviews), root.colorUrl); } - opacity = 1 + opacity = 1; } } diff --git a/src/app/commoncomponents/TimestampInfo.qml b/src/app/commoncomponents/TimestampInfo.qml index 1fc6a2d362d727eb3973230d6b2891f41d83b555..17c28b1a08137f1c00df8f657450ab73bd794160 100644 --- a/src/app/commoncomponents/TimestampInfo.qml +++ b/src/app/commoncomponents/TimestampInfo.qml @@ -15,8 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - -import "../mainview/components/" +import "../mainview/components" import QtQuick import QtQuick.Controls import QtQuick.Layouts @@ -39,7 +38,7 @@ ColumnLayout { target: MessagesAdapter function onTimestampUpdated() { if ((showTime || showDay) && Timestamp !== undefined) { - formattedTime = MessagesAdapter.getFormattedTime(Timestamp) + formattedTime = MessagesAdapter.getFormattedTime(Timestamp); } } } @@ -51,16 +50,14 @@ ColumnLayout { Layout.preferredHeight: childrenRect.height Layout.fillWidth: true Layout.topMargin: JamiTheme.dayTimestampTopMargin - Layout.bottomMargin: formattedTimeLabel.visible ? - 0 : - JamiTheme.dayTimestampBottomMargin + Layout.bottomMargin: formattedTimeLabel.visible ? 0 : JamiTheme.dayTimestampBottomMargin Rectangle { id: line height: 1 opacity: detailsOpacity - color:JamiTheme.timestampColor + color: JamiTheme.timestampColor width: parent.width - JamiTheme.timestampLinePadding anchors.centerIn: parent } @@ -75,13 +72,19 @@ ColumnLayout { Layout.fillHeight: true anchors.centerIn: parent - border { color: JamiTheme.timestampColor; width: 1 } + border { + color: JamiTheme.timestampColor + width: 1 + } Text { id: formattedDayLabel color: JamiTheme.chatviewTextColor - anchors { verticalCenter: parent.verticalCenter; horizontalCenter: parent.horizontalCenter} + anchors { + verticalCenter: parent.verticalCenter + horizontalCenter: parent.horizontalCenter + } text: formattedDay font.pointSize: JamiTheme.timestampFont } diff --git a/src/app/commoncomponents/TypingDots.qml b/src/app/commoncomponents/TypingDots.qml index d7e24f3ebedaad94322d8e1a3f7c412de84d8b42..03fbf7aa08f77c8e2419f7ca8d018fdf50e8b37d 100644 --- a/src/app/commoncomponents/TypingDots.qml +++ b/src/app/commoncomponents/TypingDots.qml @@ -15,11 +15,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import Qt5Compat.GraphicalEffects - import net.jami.Constants 1.1 Row { @@ -36,9 +34,9 @@ Row { onTriggered: { if (root.currentRect < 2) - root.currentRect ++ + root.currentRect++; else - root.currentRect = 0 + root.currentRect = 0; } } diff --git a/src/app/commoncomponents/UsernameTextEdit.qml b/src/app/commoncomponents/UsernameTextEdit.qml index d6614a306aa130133b252f7c37cb4d2bbfd1cbdb..94ddea28488b32372c791a54630490b2edd8d5ec 100644 --- a/src/app/commoncomponents/UsernameTextEdit.qml +++ b/src/app/commoncomponents/UsernameTextEdit.qml @@ -14,9 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick - import net.jami.Adapters 1.1 import net.jami.Constants 1.1 import net.jami.Models 1.1 @@ -25,27 +23,27 @@ ModalTextEdit { id: root prefixIconSrc: { - switch(nameRegistrationState){ + switch (nameRegistrationState) { case UsernameTextEdit.NameRegistrationState.FREE: - return JamiResources.circled_green_check_svg + return JamiResources.circled_green_check_svg; case UsernameTextEdit.NameRegistrationState.INVALID: case UsernameTextEdit.NameRegistrationState.TAKEN: - return JamiResources.circled_red_cross_svg + return JamiResources.circled_red_cross_svg; case UsernameTextEdit.NameRegistrationState.BLANK: default: - return JamiResources.person_24dp_svg + return JamiResources.person_24dp_svg; } } prefixIconColor: { - switch(nameRegistrationState){ + switch (nameRegistrationState) { case UsernameTextEdit.NameRegistrationState.FREE: - return "#009980" + return "#009980"; case UsernameTextEdit.NameRegistrationState.INVALID: case UsernameTextEdit.NameRegistrationState.TAKEN: - return "#CC0022" + return "#CC0022"; case UsernameTextEdit.NameRegistrationState.BLANK: default: - return JamiTheme.editLineColor + return JamiTheme.editLineColor; } } suffixIconSrc: JamiResources.outline_info_24dp_svg @@ -59,23 +57,30 @@ ModalTextEdit { infoTipText: JamiStrings.usernameToolTip placeholderText: JamiStrings.chooseAUsername - textValidator: RegularExpressionValidator { regularExpression: /[A-Za-z0-9-]{0,32}/ } + textValidator: RegularExpressionValidator { + regularExpression: /[A-Za-z0-9-]{0,32}/ + } - enum NameRegistrationState { BLANK, INVALID, TAKEN, FREE, SEARCHING } + enum NameRegistrationState { + BLANK, + INVALID, + TAKEN, + FREE, + SEARCHING + } property int nameRegistrationState: UsernameTextEdit.NameRegistrationState.BLANK - inputIsValid: dynamicText.length === 0 - || nameRegistrationState === UsernameTextEdit.NameRegistrationState.FREE + inputIsValid: dynamicText.length === 0 || nameRegistrationState === UsernameTextEdit.NameRegistrationState.FREE - onActiveChanged: function(active) { - root.isActive = active + onActiveChanged: function (active) { + root.isActive = active; } Connections { target: CurrentAccount function onRegisteredNameChanged() { - root.editMode = false + root.editMode = false; } } @@ -87,18 +92,18 @@ ModalTextEdit { function onRegisteredNameFound(status, address, name) { if (dynamicText === name) { - switch(status) { + switch (status) { case NameDirectory.LookupStatus.NOT_FOUND: - nameRegistrationState = UsernameTextEdit.NameRegistrationState.FREE - break + nameRegistrationState = UsernameTextEdit.NameRegistrationState.FREE; + break; case NameDirectory.LookupStatus.ERROR: case NameDirectory.LookupStatus.INVALID_NAME: case NameDirectory.LookupStatus.INVALID: - nameRegistrationState = UsernameTextEdit.NameRegistrationState.INVALID - break + nameRegistrationState = UsernameTextEdit.NameRegistrationState.INVALID; + break; case NameDirectory.LookupStatus.SUCCESS: - nameRegistrationState = UsernameTextEdit.NameRegistrationState.TAKEN - break + nameRegistrationState = UsernameTextEdit.NameRegistrationState.TAKEN; + break; } } } @@ -112,10 +117,10 @@ ModalTextEdit { onTriggered: { if (dynamicText.length !== 0) { - nameRegistrationState = UsernameTextEdit.NameRegistrationState.SEARCHING - NameDirectory.lookupName(CurrentAccount.id, dynamicText) + nameRegistrationState = UsernameTextEdit.NameRegistrationState.SEARCHING; + NameDirectory.lookupName(CurrentAccount.id, dynamicText); } else { - nameRegistrationState = UsernameTextEdit.NameRegistrationState.BLANK + nameRegistrationState = UsernameTextEdit.NameRegistrationState.BLANK; } } } @@ -124,9 +129,9 @@ ModalTextEdit { function startEditing() { if (!registeredName) { - root.editMode = true - forceActiveFocus() - nameRegistrationState = UsernameTextEdit.NameRegistrationState.BLANK + root.editMode = true; + forceActiveFocus(); + nameRegistrationState = UsernameTextEdit.NameRegistrationState.BLANK; } } } diff --git a/src/app/commoncomponents/VideoView.qml b/src/app/commoncomponents/VideoView.qml index 3f20b0ee3c21aa4193049be1c4a1cdc0012db410..dc611153cb3b56bbd69cf319f42b9e9eb40650c1 100644 --- a/src/app/commoncomponents/VideoView.qml +++ b/src/app/commoncomponents/VideoView.qml @@ -15,7 +15,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtMultimedia import Qt5Compat.GraphicalEffects @@ -27,9 +26,7 @@ Item { property alias videoSink: videoOutput.videoSink property alias underlayItems: rootUnderlayItem.children property alias overlayItems: rootOverlayItem.children - property real invAspectRatio: (videoOutput.sourceRect.height - / videoOutput.sourceRect.width) || - 0.5625 // 16:9 default + property real invAspectRatio: (videoOutput.sourceRect.height / videoOutput.sourceRect.width) || 0.5625 // 16:9 default property bool crop: false property bool flip: false @@ -61,11 +58,13 @@ Item { opacity: videoProvider.activeRenderers[rendererId] !== undefined visible: opacity - fillMode: crop ? - VideoOutput.PreserveAspectCrop : - VideoOutput.PreserveAspectFit + fillMode: crop ? VideoOutput.PreserveAspectCrop : VideoOutput.PreserveAspectFit - Behavior on opacity { NumberAnimation { duration: 150 } } + Behavior on opacity { + NumberAnimation { + duration: 150 + } + } layer.enabled: opacity layer.effect: FastBlur { @@ -74,7 +73,7 @@ Item { radius: (1. - opacity) * 100 } - transform: Scale { + transform: Scale { origin.x: videoOutput.width / 2 xScale: root.flip ? -1 : 1 } diff --git a/src/app/commoncomponents/contextmenu/BaseContextMenu.qml b/src/app/commoncomponents/contextmenu/BaseContextMenu.qml index 40bc60e88b64bcef01c4619129108c9825c56238..1f46d9913ae9a092c6fd4440a71782b9f0511306 100644 --- a/src/app/commoncomponents/contextmenu/BaseContextMenu.qml +++ b/src/app/commoncomponents/contextmenu/BaseContextMenu.qml @@ -15,11 +15,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import Qt5Compat.GraphicalEffects - import net.jami.Constants 1.1 Menu { @@ -30,64 +28,53 @@ Menu { property int menuSeparatorPreferredHeight: 0 property GeneralMenuSeparator menuTopBorder: GeneralMenuSeparator { - separatorPreferredWidth: menuPreferredWidth ? - menuPreferredWidth : JamiTheme.menuItemsPreferredWidth - separatorPreferredHeight: menuSeparatorPreferredHeight ? - menuSeparatorPreferredHeight : JamiTheme.menuBorderPreferredHeight + separatorPreferredWidth: menuPreferredWidth ? menuPreferredWidth : JamiTheme.menuItemsPreferredWidth + separatorPreferredHeight: menuSeparatorPreferredHeight ? menuSeparatorPreferredHeight : JamiTheme.menuBorderPreferredHeight separatorColor: "transparent" } property GeneralMenuSeparator menuBottomBorder: GeneralMenuSeparator { - separatorPreferredWidth: menuPreferredWidth ? - menuPreferredWidth : JamiTheme.menuItemsPreferredWidth - separatorPreferredHeight: menuSeparatorPreferredHeight ? - menuSeparatorPreferredHeight : JamiTheme.menuBorderPreferredHeight + separatorPreferredWidth: menuPreferredWidth ? menuPreferredWidth : JamiTheme.menuItemsPreferredWidth + separatorPreferredHeight: menuSeparatorPreferredHeight ? menuSeparatorPreferredHeight : JamiTheme.menuBorderPreferredHeight separatorColor: "transparent" } property var generalMenuSeparatorList: [] function loadMenuItems(menuItems) { - root.addItem(menuTopBorder) + root.addItem(menuTopBorder); // use the maximum text width as the preferred width for menu for (var j = 0; j < menuItems.length; ++j) { - var currentItemWidth = menuItems[j].itemPreferredWidth - if (currentItemWidth !== JamiTheme.menuItemsPreferredWidth - && currentItemWidth > menuPreferredWidth) - menuPreferredWidth = currentItemWidth + var currentItemWidth = menuItems[j].itemPreferredWidth; + if (currentItemWidth !== JamiTheme.menuItemsPreferredWidth && currentItemWidth > menuPreferredWidth) + menuPreferredWidth = currentItemWidth; } - for (var i = 0; i < menuItems.length; ++i) { if (menuItems[i].canTrigger) { - menuItems[i].parentMenu = root - root.addItem(menuItems[i]) - + menuItems[i].parentMenu = root; + root.addItem(menuItems[i]); if (menuPreferredWidth) - menuItems[i].itemPreferredWidth = menuPreferredWidth + menuItems[i].itemPreferredWidth = menuPreferredWidth; if (menuItemsPreferredHeight) - menuItems[i].itemPreferredHeight = menuItemsPreferredHeight + menuItems[i].itemPreferredHeight = menuItemsPreferredHeight; } if (menuItems[i].addMenuSeparatorAfter) { // If the QML file to be loaded is a local file, // you could omit the finishCreation() function - var menuSeparatorComponent = Qt.createComponent( - "GeneralMenuSeparator.qml", - Component.PreferSynchronous, root) - var menuSeparatorComponentObj = menuSeparatorComponent.createObject() - generalMenuSeparatorList.push(menuSeparatorComponentObj) - root.addItem(menuSeparatorComponentObj) + var menuSeparatorComponent = Qt.createComponent("GeneralMenuSeparator.qml", Component.PreferSynchronous, root); + var menuSeparatorComponentObj = menuSeparatorComponent.createObject(); + generalMenuSeparatorList.push(menuSeparatorComponentObj); + root.addItem(menuSeparatorComponentObj); } } - - root.addItem(menuBottomBorder) - - root.open() + root.addItem(menuBottomBorder); + root.open(); } onVisibleChanged: { if (!visible) - root.close() + root.close(); } modal: true @@ -118,7 +105,7 @@ Menu { Component.onDestruction: { for (var i = 0; i < generalMenuSeparatorList.length; ++i) { - generalMenuSeparatorList[i].destroy() + generalMenuSeparatorList[i].destroy(); } } } diff --git a/src/app/commoncomponents/contextmenu/ContextMenuAutoLoader.qml b/src/app/commoncomponents/contextmenu/ContextMenuAutoLoader.qml index f4d95de50dfe3572676a480803f974343c506621..63e47b2ce63d645ec500073975d87a6e36c6bb0b 100644 --- a/src/app/commoncomponents/contextmenu/ContextMenuAutoLoader.qml +++ b/src/app/commoncomponents/contextmenu/ContextMenuAutoLoader.qml @@ -15,10 +15,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick - -import "../../commoncomponents/contextmenu" +import "." Loader { id: root @@ -33,15 +31,15 @@ Loader { active: false function openMenu() { - root.active = true - root.sourceComponent = menuComponent + root.active = true; + root.sourceComponent = menuComponent; } Connections { target: root.item enabled: root.status === Loader.Ready function onClosed() { - root.active = false + root.active = false; } } @@ -52,10 +50,10 @@ Loader { id: contextMenu Component.onCompleted: { - contextMenu.menuPreferredWidth = contextMenuItemPreferredWidth - contextMenu.menuItemsPreferredHeight = contextMenuItemPreferredHeight - contextMenu.menuSeparatorPreferredHeight = contextMenuSeparatorPreferredHeight - contextMenu.loadMenuItems(menuItemsToLoad) + contextMenu.menuPreferredWidth = contextMenuItemPreferredWidth; + contextMenu.menuItemsPreferredHeight = contextMenuItemPreferredHeight; + contextMenu.menuSeparatorPreferredHeight = contextMenuSeparatorPreferredHeight; + contextMenu.loadMenuItems(menuItemsToLoad); } } } diff --git a/src/app/commoncomponents/contextmenu/GeneralMenuItem.qml b/src/app/commoncomponents/contextmenu/GeneralMenuItem.qml index 4874855269ea12abc8ca3813bd63a52e0231e831..b425aa0f9dfe8ce69f19eb4ef82d1c0e130a3fa3 100644 --- a/src/app/commoncomponents/contextmenu/GeneralMenuItem.qml +++ b/src/app/commoncomponents/contextmenu/GeneralMenuItem.qml @@ -15,14 +15,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Constants 1.1 - -import "../../commoncomponents" +import "../" // General menu item. // Can control top, bottom, left, right border width. @@ -61,8 +58,7 @@ MenuItem { anchors.leftMargin: 1 anchors.rightMargin: 1 - color: menuItemContentRect.hovered ? - JamiTheme.hoverColor : JamiTheme.backgroundColor + color: menuItemContentRect.hovered ? JamiTheme.hoverColor : JamiTheme.backgroundColor } anchors.fill: parent @@ -88,10 +84,8 @@ MenuItem { id: contextMenuItemText Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft - Layout.leftMargin: contextMenuItemImage.status === Image.Ready ? - itemTextMargin : itemTextMargin / 2 - Layout.rightMargin: contextMenuItemImage.status === Image.Ready ? - itemTextMargin : itemTextMargin / 2 + Layout.leftMargin: contextMenuItemImage.status === Image.Ready ? itemTextMargin : itemTextMargin / 2 + Layout.rightMargin: contextMenuItemImage.status === Image.Ready ? itemTextMargin : itemTextMargin / 2 Layout.preferredHeight: itemPreferredHeight Layout.fillWidth: true @@ -108,20 +102,13 @@ MenuItem { text: contextMenuItemText.text onBoundingRectChanged: { - var sizeToCompare = itemPreferredWidth - - (contextMenuItemImage.source.toString().length > 0 ? - itemTextMargin + itemImageLeftMargin + contextMenuItemImage.width : - itemTextMargin / 2) - if (autoTextSizeAdjustment - && boundingRect.width > sizeToCompare) { + var sizeToCompare = itemPreferredWidth - (contextMenuItemImage.source.toString().length > 0 ? itemTextMargin + itemImageLeftMargin + contextMenuItemImage.width : itemTextMargin / 2); + if (autoTextSizeAdjustment && boundingRect.width > sizeToCompare) { if (boundingRect.width > JamiTheme.contextMenuItemTextMaxWidth) { - itemPreferredWidth += JamiTheme.contextMenuItemTextMaxWidth - - JamiTheme.contextMenuItemTextPreferredWidth - + itemTextMargin - contextMenuItemText.elide = Text.ElideRight + itemPreferredWidth += JamiTheme.contextMenuItemTextMaxWidth - JamiTheme.contextMenuItemTextPreferredWidth + itemTextMargin; + contextMenuItemText.elide = Text.ElideRight; } else - itemPreferredWidth += boundingRect.width + itemTextMargin - - sizeToCompare + itemPreferredWidth += boundingRect.width + itemTextMargin - sizeToCompare; } } } @@ -129,8 +116,8 @@ MenuItem { } onReleased: { - menuItem.clicked() - parentMenu.close() + menuItem.clicked(); + parentMenu.close(); } } diff --git a/src/app/commoncomponents/contextmenu/GeneralMenuSeparator.qml b/src/app/commoncomponents/contextmenu/GeneralMenuSeparator.qml index 9f6746a60b3c98bde20d7a57bd6524e40458e480..ff70c55ca8e7f2bf8eaf2ed0f86093c245b7de9d 100644 --- a/src/app/commoncomponents/contextmenu/GeneralMenuSeparator.qml +++ b/src/app/commoncomponents/contextmenu/GeneralMenuSeparator.qml @@ -15,10 +15,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls - import net.jami.Constants 1.1 MenuSeparator { diff --git a/src/app/constant/JamiQmlUtils.qml b/src/app/constant/JamiQmlUtils.qml index 82334258e14d2adb4d58e39f318759af69457698..4eaa02f8775f70540c12bdbd97e935cf74766ec6 100644 --- a/src/app/constant/JamiQmlUtils.qml +++ b/src/app/constant/JamiQmlUtils.qml @@ -18,9 +18,7 @@ // JamiQmlUtils as a singleton is to provide global property entry pragma Singleton - import QtQuick - import net.jami.Adapters 1.1 Item { @@ -33,9 +31,9 @@ Item { property var accountCreationInputParaObject: ({}) function setUpAccountCreationInputPara(inputPara) { - JamiQmlUtils.accountCreationInputParaObject = {} - Object.assign(JamiQmlUtils.accountCreationInputParaObject, inputPara) - return accountCreationInputParaObject + JamiQmlUtils.accountCreationInputParaObject = {}; + Object.assign(JamiQmlUtils.accountCreationInputParaObject, inputPara); + return accountCreationInputParaObject; } // MessageBar buttons in mainview points @@ -52,18 +50,9 @@ Item { function updateMessageBarButtonsPoints() { if (messageBarButtonsRowObj && audioRecordMessageButtonObj && videoRecordMessageButtonObj) { - audioRecordMessageButtonInMainViewPoint = - messageBarButtonsRowObj.mapToItem(mainViewRectObj, - audioRecordMessageButtonObj.x, - audioRecordMessageButtonObj.y) - videoRecordMessageButtonInMainViewPoint = - messageBarButtonsRowObj.mapToItem(mainViewRectObj, - videoRecordMessageButtonObj.x, - videoRecordMessageButtonObj.y) - emojiPickerButtonInMainViewPoint = - messageBarButtonsRowObj.mapToItem(mainViewRectObj, - emojiPickerButtonObj.x, - emojiPickerButtonObj.y) + audioRecordMessageButtonInMainViewPoint = messageBarButtonsRowObj.mapToItem(mainViewRectObj, audioRecordMessageButtonObj.x, audioRecordMessageButtonObj.y); + videoRecordMessageButtonInMainViewPoint = messageBarButtonsRowObj.mapToItem(mainViewRectObj, videoRecordMessageButtonObj.x, videoRecordMessageButtonObj.y); + emojiPickerButtonInMainViewPoint = messageBarButtonsRowObj.mapToItem(mainViewRectObj, emojiPickerButtonObj.x, emojiPickerButtonObj.y); } } @@ -72,13 +61,12 @@ Item { } function getTextBoundingRect(font, text) { - globalTextMetrics.font = font - globalTextMetrics.text = text - - return Qt.size(globalTextMetrics.contentWidth, globalTextMetrics.contentHeight) + globalTextMetrics.font = font; + globalTextMetrics.text = text; + return Qt.size(globalTextMetrics.contentWidth, globalTextMetrics.contentHeight); } function clamp(val, min, max) { - return Math.min(Math.max(val, min), max) + return Math.min(Math.max(val, min), max); } } diff --git a/src/app/constant/JamiStrings.qml b/src/app/constant/JamiStrings.qml index d389ad0fc1d04bcce24f42fbcb52e1ee94ea80ea..8027a982fa1c8da80883e210100ca776ef2ce45e 100644 --- a/src/app/constant/JamiStrings.qml +++ b/src/app/constant/JamiStrings.qml @@ -18,9 +18,7 @@ // JamiStrings as a singleton is to provide global strings entries. pragma Singleton - import QtQuick - import net.jami.Helpers 1.1 Item { @@ -210,10 +208,7 @@ Item { // BackupKeyPage property string whyBackupAccount: qsTr("Why should I back-up this account?") - property string backupAccountInfos: qsTr("Your account only exists on this device. " + - "If you lose your device or uninstall the application, " + - "your account will be deleted and CANNOT be recovered. " + - "You can back up your account now or later (in the Account Settings).") + property string backupAccountInfos: qsTr("Your account only exists on this device. " + "If you lose your device or uninstall the application, " + "your account will be deleted and CANNOT be recovered. " + "You can back up your account now or later (in the Account Settings).") property string backupAccountHere: qsTr("Back up account here") property string backupAccountBtn: qsTr("Back up account") property string skip: qsTr("Skip") @@ -326,27 +321,27 @@ Item { property string minuteLeft: qsTr("%1 minute left") property string locationServicesError: qsTr("Your precise location could not be determined.\nIn Device Settings, please turn on \"Location Services\".\nOther participants' location can still be received.") property string locationServicesClosedError: qsTr("Your precise location could not be determined. Please check your Internet connection.") - property string stopAllSharings: qsTr("Turn off location sharing"); - property string shortStopAllSharings: qsTr("Turn off sharing"); - property string stopConvSharing: qsTr("Stop location sharing in this conversation (%1)"); - property string stopSharingPopupBody: qsTr("Location is shared in several conversations"); - property string unpinStopSharingTooltip: qsTr("Pin map to be able to share location or to turn off location in specific conversations"); + property string stopAllSharings: qsTr("Turn off location sharing") + property string shortStopAllSharings: qsTr("Turn off sharing") + property string stopConvSharing: qsTr("Stop location sharing in this conversation (%1)") + property string stopSharingPopupBody: qsTr("Location is shared in several conversations") + property string unpinStopSharingTooltip: qsTr("Pin map to be able to share location or to turn off location in specific conversations") property string stopSharingSeveralConversationTooltip: qsTr("Location is shared in several conversations, click to choose how to turn off location sharing") - property string shareLocationToolTip: qsTr("Share location to participants of this conversation (%1)"); - property string minimizeMapTooltip: qsTr("Minimize"); - property string maximizeMapTooltip: qsTr("Maximize"); - property string reduceMapTooltip: qsTr("Reduce"); - property string extendMapTooltip: qsTr("Extend"); - property string dragMapTooltip: qsTr("Drag"); - property string centerMapTooltip: qsTr("Center"); - property string closeMapTooltip: qsTr("Close"); - property string unpin: qsTr("Unpin"); - property string pinWindow: qsTr("Pin"); - property string positionShareDuration: qsTr("Position share duration"); - property string positionShareLimit: qsTr("Limit the duration of location sharing"); - property string locationSharingLabel: qsTr("Location sharing"); - property string maxLocationDuration: qsTr("Unlimited"); - property string minLocationDuration: qsTr("1 min"); + property string shareLocationToolTip: qsTr("Share location to participants of this conversation (%1)") + property string minimizeMapTooltip: qsTr("Minimize") + property string maximizeMapTooltip: qsTr("Maximize") + property string reduceMapTooltip: qsTr("Reduce") + property string extendMapTooltip: qsTr("Extend") + property string dragMapTooltip: qsTr("Drag") + property string centerMapTooltip: qsTr("Center") + property string closeMapTooltip: qsTr("Close") + property string unpin: qsTr("Unpin") + property string pinWindow: qsTr("Pin") + property string positionShareDuration: qsTr("Position share duration") + property string positionShareLimit: qsTr("Limit the duration of location sharing") + property string locationSharingLabel: qsTr("Location sharing") + property string maxLocationDuration: qsTr("Unlimited") + property string minLocationDuration: qsTr("1 min") // Chatview header property string hideChat: qsTr("Hide chat") @@ -404,7 +399,6 @@ Item { property string usernameToolTip: qsTr("- 32 characters maximum\n- Alphabetical characters (A to Z and a to z)\n- Numeric characters (0 to 9)\n- Special characters allowed: dash (-)") // Good to know - property string goodToKnow: qsTr("Good to know") property string local: qsTr("Local") property string encrypt: qsTr("Encrypt") @@ -425,9 +419,8 @@ Item { property string udp: qsTr("UDP") property string displayName: qsTr("Display Name") - // accountSettingsPages - property string customizeAccountDescription:qsTr("Your profile is only shared with your contacts.\nYour picture and your nickname can be changed at all time in the settings of your account.") + property string customizeAccountDescription: qsTr("Your profile is only shared with your contacts.\nYour picture and your nickname can be changed at all time in the settings of your account.") property string usernameAccountDescription: qsTr("A chosen username can help to be found more easily on Jami.\nIf a username is not chosen, a randomly generated 40-character identifier will be assigned to this account as a username. It is more difficult to be found and reached with this identifier.") property string ecryptAccountDescription: qsTr("Your Jami account is registered only on this device as an archive containing the keys of your account. Access to this archive can be protected by a password.") property string saveAccountTitle: qsTr("Backup account") @@ -614,9 +607,7 @@ Item { property string archive: qsTr("Archive") property string openFile: qsTr("Open file") property string importAccountArchive: qsTr("Create account from backup") - property string importAccountExplanation: qsTr("You can obtain an archive by clicking on \"Back up account\" " + - "in the Account Settings. " + - "This will create a .gz file on your device.") + property string importAccountExplanation: qsTr("You can obtain an archive by clicking on \"Back up account\" " + "in the Account Settings. " + "This will create a .gz file on your device.") property string connectFromBackup: qsTr("Restore account from backup") property string generatingAccount: qsTr("Generating account…") property string importFromBackup: qsTr("Import from backup") @@ -625,11 +616,9 @@ Item { property string selectArchiveFile: qsTr("Select archive file") property string passwordArchive: qsTr("If the account is encrypted with a password, please fill the following field.") - // ImportFromDevicePage property string mainAccountPassword: qsTr("Enter Jami account password") - property string enterPIN: qsTr("Enter the PIN from another configured Jami account. " + - "Use the \"Link Another Device\" feature to obtain a PIN.") + property string enterPIN: qsTr("Enter the PIN from another configured Jami account. " + "Use the \"Link Another Device\" feature to obtain a PIN.") property string connectFromAnotherDevice: qsTr("Link device") property string importButton: qsTr("Import") property string pin: qsTr("Enter the PIN code") @@ -644,7 +633,6 @@ Item { property string importStep4Desc: qsTr("The PIN code will be available for 10 minutes") property string importPasswordDesc: qsTr("Fill if the account is password-encrypted.") - // LinkDevicesDialog property string pinTimerInfos: qsTr("The PIN and the account password should be entered in your device within 10 minutes.") property string close: qsTr("Close") @@ -747,9 +735,6 @@ Item { property string useExistingAccount: qsTr("Use existing Jami account") property string welcomeToJami: qsTr("Welcome to Jami") - - - // SmartList property string clearText: qsTr("Clear Text") property string conversations: qsTr("Conversations") @@ -905,5 +890,4 @@ Item { // Appearence property string theme: qsTr("Theme") property string zoomLevel: qsTr("Text zoom level") - } diff --git a/src/app/constant/JamiTheme.qml b/src/app/constant/JamiTheme.qml index edb0a4a94c0754e3b279d352c2ce8092c6d89dbc..9c013eed344c0c6470e5f2f0e70e1926ea509e47 100644 --- a/src/app/constant/JamiTheme.qml +++ b/src/app/constant/JamiTheme.qml @@ -18,9 +18,7 @@ // JamiTheme as a singleton is to provide global theme property entry. pragma Singleton - import QtQuick - import net.jami.Adapters 1.1 import net.jami.Enums 1.1 @@ -31,25 +29,25 @@ Item { target: UtilsAdapter function onChangeFontSize() { - baseZoom = UtilsAdapter.getAppValue(Settings.BaseZoom) + baseZoom = UtilsAdapter.getAppValue(Settings.BaseZoom); } function onAppThemeChanged() { - darkTheme = UtilsAdapter.useApplicationTheme() + darkTheme = UtilsAdapter.useApplicationTheme(); } } // Jami theme colors function rgba256(r, g, b, a) { - return Qt.rgba(r / 255, g / 255, b / 255, a / 100.) + return Qt.rgba(r / 255, g / 255, b / 255, a / 100.); } function calcSize(size) { - return Math.min(Math.max(5, baseZoom * size), 30) + return Math.min(Math.max(5, baseZoom * size), 30); } function pixelToPoint(size) { - return size * 0.75 + return size * 0.75; } property real baseZoom: UtilsAdapter.getAppValue(Settings.BaseZoom) @@ -68,11 +66,11 @@ Item { property color transparentColor: "transparent" property color primaryForegroundColor: darkTheme ? whiteColor : blackColor property color primaryBackgroundColor: darkTheme ? bgDarkMode_ : whiteColor - property color backgroundColor: darkTheme? bgSideBarDarkMode_ : lightGrey_ + property color backgroundColor: darkTheme ? bgSideBarDarkMode_ : lightGrey_ property color shadowColor: "#80000000" property color secondaryBackgroundColor: darkTheme ? bgDarkMode_ : whiteColor property color greyBorderColor: "#333" - property color selectionBlue: darkTheme? "#0061a5" : "#109ede" + property color selectionBlue: darkTheme ? "#0061a5" : "#109ede" property color hoverColor: darkTheme ? "#515151" : "#c7c7c7" property color pressColor: darkTheme ? "#777" : "#c0c0c0" @@ -81,10 +79,9 @@ Item { property color smartListSelectedColor: darkTheme ? "#515151" : "#d1d1d1" property color editBackgroundColor: darkTheme ? "#373737" : lightGrey_ property color textColor: primaryForegroundColor - property color textColorHovered: darkTheme? "#cccccc" : "#333333" + property color textColorHovered: darkTheme ? "#cccccc" : "#333333" property color tabbarBorderColor: darkTheme ? blackColor : "#e3e3e3" - property color popupOverlayColor: darkTheme ? Qt.rgba(255, 255, 255, 0.22) : - Qt.rgba(0, 0, 0, 0.33) + property color popupOverlayColor: darkTheme ? Qt.rgba(255, 255, 255, 0.22) : Qt.rgba(0, 0, 0, 0.33) property real formsRadius: 30 // Side panel @@ -177,7 +174,7 @@ Item { property color sipInputButtonPressColor: "#5588bb" property string buttonConference: "transparent" - property string buttonConferenceHovered:"#110000" + property string buttonConferenceHovered: "#110000" property string buttonConferencePressed: "#110000" // Wizard / account manager @@ -216,7 +213,7 @@ Item { property color messageReplyColor: darkTheme ? "#bbb" : "#A7A7A7" property color messageOutTxtColor: "#000000" property color messageInBgColor: "#e5e5e5" - property color messageOutBgColor: darkTheme? "#616161" : "#005699" + property color messageOutBgColor: darkTheme ? "#616161" : "#005699" property color messageInTxtColor: "#FFFFFF" property color fileOutTimestampColor: darkTheme ? "#eee" : "#555" property color fileInTimestampColor: darkTheme ? "#999" : "#555" @@ -229,14 +226,14 @@ Item { property color bgTextInput: darkTheme ? "#060608" : whiteColor property color previewTextContainerColor: darkTheme ? "#959595" : "#ececec" property color previewImageBackgroundColor: whiteColor - property color previewCardContainerColor : darkTheme ? blackColor : whiteColor - property color previewUrlColor : darkTheme ? "#eeeeee" : "#333" + property color previewCardContainerColor: darkTheme ? blackColor : whiteColor + property color previewUrlColor: darkTheme ? "#eeeeee" : "#333" property color messageWebViewFooterButtonImageColor: darkTheme ? "#838383" : "#656565" - property color chatviewUsernameColor : "#A7A7A7" + property color chatviewUsernameColor: "#A7A7A7" //mapPosition property color mapButtonsOverlayColor: darkTheme ? "#000000" : "#f0f0f0" - property color mapButtonColor: darkTheme ? "#f0f0f0" : "#000000" + property color mapButtonColor: darkTheme ? "#f0f0f0" : "#000000" property color sharePositionIndicatorColor: darkTheme ? "#03B9E9" : "#005699" property color sharedPositionIndicatorColor: darkTheme ? whiteColor : blackColor @@ -267,8 +264,7 @@ Item { property color typingDotsEnlargeColor: darkTheme ? "white" : Qt.darker("lightgrey", 3.0) // Font. - - property color faddedFontColor: darkTheme? "#c0c0c0" : "#a0a0a0" + property color faddedFontColor: darkTheme ? "#c0c0c0" : "#a0a0a0" property color faddedLastInteractionFontColor: darkTheme ? "#c0c0c0" : "#505050" property color darkGrey: rgba256(63, 63, 63, 100) @@ -290,7 +286,6 @@ Item { property int overlayFadeDuration: 250 property int smartListTransitionDuration: 120 - // Sizes property real mainViewLeftPaneMinWidth: 300 property real mainViewPaneMinWidth: 430 @@ -408,7 +403,6 @@ Item { property int callInformationBlockSpacing: 25 property int callInformationlayoutMargins: 10 - // Jami switch property real switchIndicatorRadius: 30 property real switchPreferredHeight: 20 @@ -442,9 +436,9 @@ Item { property real chatViewFooterTextAreaMaximumHeight: 130 property real chatViewScrollToBottomButtonBottomMargin: 8 - property real usernameBlockFontSize : calcSize(12) - property real usernameBlockLineHeight : 14 - property real usernameBlockPadding : contactMessageAvatarSize + 8 + property real usernameBlockFontSize: calcSize(12) + property real usernameBlockLineHeight: 14 + property real usernameBlockPadding: contactMessageAvatarSize + 8 // TypingDots property real typingDotsAnimationInterval: 500 @@ -469,7 +463,6 @@ Item { property int sbsMessageBaseReplyMargin: 45 property int sbsMessageBaseReplyTopMargin: 6 - // MessageBar property int messageBarMarginSize: 10 @@ -521,7 +514,7 @@ Item { // WizardView Advanced Account Settings property color lightBlue_: darkTheme ? "#03B9E9" : "#e5eef5" - property color shadowColorBlue: Qt.rgba(0, 0.34,0.6,0.16) + property color shadowColorBlue: Qt.rgba(0, 0.34, 0.6, 0.16) property real passwordEditOpenedBoxWidth: 425 property real passwordEditClosedBoxWidth: 330 property real passwordEditOpenedBoxHeight: 380 @@ -534,13 +527,11 @@ Item { property real cornerIconSize: 40 - //InfoBox property real infoBoxTitleFontSize: calcSize(13) property real infoBoxDescFontSize: calcSize(12) //Tipbox - property real tipBoxTitleFontSize: calcSize(13) property real tipBoxContentFontSize: calcSize(12) property color tipBoxBackgroundColor: darkTheme ? blackColor : whiteColor @@ -569,7 +560,7 @@ Item { property real buttontextFontPixelSize: calcSize(15) // UsernameTextEdit - property real usernameTextEditPointSize:calcSize(9 + fontSizeOffset) + property real usernameTextEditPointSize: calcSize(9 + fontSizeOffset) property real usernameTextEditlookupInterval: 200 // JamiScrollBar @@ -614,9 +605,7 @@ Item { property int settingsMenuHeaderButtonHeight: 50 property int settingsListViewsSpacing: 10 - - function setTheme(dark) { - darkTheme = dark + darkTheme = dark; } } diff --git a/src/app/constant/MsgSeq.qml b/src/app/constant/MsgSeq.qml index f0e5de72d5fa1e23cf02a968f97fd540a4829a6a..e5964a6dc6533cb315ca7e5b847b92cb15f988eb 100644 --- a/src/app/constant/MsgSeq.qml +++ b/src/app/constant/MsgSeq.qml @@ -1,5 +1,6 @@ pragma Singleton import QtQml + QtObject { //readonly property int unknown: -1 readonly property int single: 0 diff --git a/src/app/mainview/ConversationView.qml b/src/app/mainview/ConversationView.qml index 57be86d1f1f4aec24254b60cfdfc4e0a087e03dd..7dc6034406571fe5eb640c922b65617e072d1312 100644 --- a/src/app/mainview/ConversationView.qml +++ b/src/app/mainview/ConversationView.qml @@ -14,16 +14,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts import Qt5Compat.GraphicalEffects - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../commoncomponents" import "components" @@ -38,22 +35,23 @@ ListSelectionView { Connections { target: CurrentConversation function onReloadInteractions() { - UtilsAdapter.clearInteractionsCache(CurrentAccount.id, CurrentConversation.id) - MessagesAdapter.loadMoreMessages() + UtilsAdapter.clearInteractionsCache(CurrentAccount.id, CurrentConversation.id); + MessagesAdapter.loadMoreMessages(); } } onDismissed: { - callStackView.needToCloseInCallConversationAndPotentialWindow() - LRCInstance.deselectConversation() + callStackView.needToCloseInCallConversationAndPotentialWindow(); + LRCInstance.deselectConversation(); } property string currentAccountId: CurrentAccount.id onCurrentAccountIdChanged: dismiss() onVisibleChanged: { - if (visible) return - UtilsAdapter.clearInteractionsCache(CurrentAccount.id, CurrentConversation.id) + if (visible) + return; + UtilsAdapter.clearInteractionsCache(CurrentAccount.id, CurrentConversation.id); } color: JamiTheme.transparentColor @@ -62,9 +60,7 @@ ListSelectionView { rightPaneItem: StackLayout { currentIndex: !CurrentConversation.hasCall ? 0 : 1 - onCurrentIndexChanged: chatView.parent = currentIndex === 1 ? - callStackView.chatViewContainer : - chatViewContainer + onCurrentIndexChanged: chatView.parent = currentIndex === 1 ? callStackView.chatViewContainer : chatViewContainer anchors.fill: parent @@ -82,30 +78,30 @@ ListSelectionView { property string currentConvId: CurrentConversation.id onCurrentConvIdChanged: { if (!CurrentConversation.hasCall) { - resetPanels() - Qt.callLater(focusChatView) + resetPanels(); + Qt.callLater(focusChatView); } else { - dismiss() - callStackView.contentView.forceActiveFocus() + dismiss(); + callStackView.contentView.forceActiveFocus(); } } onDismiss: { if (parent == chatViewContainer) { - viewNode.dismiss() + viewNode.dismiss(); } else { - callStackView.chatViewContainer.visible = false - callStackView.contentView.forceActiveFocus() + callStackView.chatViewContainer.visible = false; + callStackView.contentView.forceActiveFocus(); } } onVisibleChanged: { if (!inCallView) - return + return; if (visible && !parent.showDetails) { - focusChatView() + focusChatView(); } else { - callStackView.contentView.forceActiveFocus() + callStackView.contentView.forceActiveFocus(); } } } @@ -118,9 +114,9 @@ ListSelectionView { onVisibleChanged: { if (visible) - contentView.forceActiveFocus() + contentView.forceActiveFocus(); else - chatView.focusChatView() + chatView.focusChatView(); } } } diff --git a/src/app/mainview/components/AboutPopUp.qml b/src/app/mainview/components/AboutPopUp.qml index 70bd4cb53c007555e0b4f1b0e42089bcf009c5d5..21bd99bc9ec5fb75aaaf2d635aaf04e59298c32b 100644 --- a/src/app/mainview/components/AboutPopUp.qml +++ b/src/app/mainview/components/AboutPopUp.qml @@ -15,17 +15,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts import Qt5Compat.GraphicalEffects - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - - import "../../commoncomponents" BaseModalDialog { @@ -48,7 +44,9 @@ BaseModalDialog { source: JamiResources.round_close_24dp_svg - onClicked: { close(); } + onClicked: { + close(); + } } popupContent: JamiFlickable { @@ -70,9 +68,7 @@ BaseModalDialog { Layout.preferredWidth: JamiTheme.aboutLogoPreferredWidth Layout.preferredHeight: JamiTheme.aboutLogoPreferredHeight - source: JamiTheme.darkTheme ? - JamiResources.logo_jami_standard_coul_white_svg : - JamiResources.logo_jami_standard_coul_svg + source: JamiTheme.darkTheme ? JamiResources.logo_jami_standard_coul_white_svg : JamiResources.logo_jami_standard_coul_svg } TextEdit { @@ -197,8 +193,7 @@ BaseModalDialog { TextMetrics { id: textMetricsjamiNoneWarrantyHyperText font: jamiDeclarationHyperText.font - text: JamiStrings.declarationYear + " " + '<a href="https://savoirfairelinux.com" style="color: ' + JamiTheme.blueLinkColor + '">Savoir-faire Linux Inc.</a><br>' - + 'This program comes with absolutely no warranty. See the <a href="http://www.gnu.org/licenses/gpl-3.0.html" style="color: ' + JamiTheme.blueLinkColor + '">GNU General Public License</a>, version 3 or later for details.' + text: JamiStrings.declarationYear + " " + '<a href="https://savoirfairelinux.com" style="color: ' + JamiTheme.blueLinkColor + '">Savoir-faire Linux Inc.</a><br>' + 'This program comes with absolutely no warranty. See the <a href="http://www.gnu.org/licenses/gpl-3.0.html" style="color: ' + JamiTheme.blueLinkColor + '">GNU General Public License</a>, version 3 or later for details.' } MouseArea { @@ -216,7 +211,6 @@ BaseModalDialog { Layout.topMargin: 25 Layout.margins: JamiTheme.preferredMarginSize } - } } } diff --git a/src/app/mainview/components/AccountComboBox.qml b/src/app/mainview/components/AccountComboBox.qml index adea2fc1cce7ebedb2ec8c0d09643edf803dce86..9ce9925a0afa1742dc1b54c403c5c8539892f4d2 100644 --- a/src/app/mainview/components/AccountComboBox.qml +++ b/src/app/mainview/components/AccountComboBox.qml @@ -16,15 +16,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" Label { @@ -42,7 +39,7 @@ Label { target: AccountAdapter function onAccountStatusChanged(accountId) { - AccountListModel.reset() + AccountListModel.reset(); } } @@ -50,16 +47,16 @@ Label { target: LRCInstance function onAccountListChanged() { - root.update() - AccountListModel.reset() + root.update(); + AccountListModel.reset(); } } function togglePopup() { if (root.popup.opened) { - root.popup.close() + root.popup.close(); } else { - root.popup.open() + root.popup.open(); } } @@ -67,13 +64,11 @@ Label { id: background anchors.fill: parent - color: root.popup.opened ? - Qt.lighter(JamiTheme.hoverColor, 1.0) : - mouseArea.containsMouse ? - Qt.lighter(JamiTheme.hoverColor, 1.05) : - JamiTheme.backgroundColor - Behavior on color { - ColorAnimation { duration: JamiTheme.shortFadeDuration } + color: root.popup.opened ? Qt.lighter(JamiTheme.hoverColor, 1.0) : mouseArea.containsMouse ? Qt.lighter(JamiTheme.hoverColor, 1.05) : JamiTheme.backgroundColor + Behavior on color { + ColorAnimation { + duration: JamiTheme.shortFadeDuration + } } // TODO: this can be removed when frameless window is implemented @@ -94,8 +89,8 @@ Label { anchors.fill: parent hoverEnabled: true onClicked: { - root.forceActiveFocus() - togglePopup() + root.forceActiveFocus(); + togglePopup(); } } @@ -154,7 +149,7 @@ Label { visible: text.length && text !== bestNameText.text - text: CurrentAccount.bestId + text: CurrentAccount.bestId textFormat: TextEdit.PlainText font.pointSize: JamiTheme.textFontSize @@ -181,12 +176,9 @@ Label { color: JamiTheme.textColor - source: !root.popup.opened ? - JamiResources.expand_more_24dp_svg : - JamiResources.expand_less_24dp_svg + source: !root.popup.opened ? JamiResources.expand_more_24dp_svg : JamiResources.expand_less_24dp_svg } - PushButton { id: shareButton @@ -202,30 +194,22 @@ Label { normalColor: JamiTheme.backgroundColor imageColor: JamiTheme.textColor - onClicked: viewCoordinator.presentDialog( - appWindow, - "mainview/components/WelcomePageQrDialog.qml") + onClicked: viewCoordinator.presentDialog(appWindow, "mainview/components/WelcomePageQrDialog.qml") } PushButton { id: settingsButton anchors.verticalCenter: parent.verticalCenter - source: !inSettings ? - JamiResources.settings_24dp_svg : - JamiResources.round_close_24dp_svg + source: !inSettings ? JamiResources.settings_24dp_svg : JamiResources.round_close_24dp_svg normalColor: JamiTheme.backgroundColor imageColor: JamiTheme.textColor - toolTipText: !inSettings ? - JamiStrings.openSettings : - JamiStrings.closeSettings + toolTipText: !inSettings ? JamiStrings.openSettings : JamiStrings.closeSettings onClicked: { - !inSettings ? - viewCoordinator.present("SettingsView") : - viewCoordinator.dismiss("SettingsView") - background.state = "normal" + !inSettings ? viewCoordinator.present("SettingsView") : viewCoordinator.dismiss("SettingsView"); + background.state = "normal"; } } } diff --git a/src/app/mainview/components/AccountComboBoxPopup.qml b/src/app/mainview/components/AccountComboBoxPopup.qml index 068ae75a565f1424afbe01276285cd3b94c42fee..8e6f412b6072c6fab7bf19c7a066dbf0a94fe203 100644 --- a/src/app/mainview/components/AccountComboBoxPopup.qml +++ b/src/app/mainview/components/AccountComboBoxPopup.qml @@ -15,18 +15,14 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts import Qt5Compat.GraphicalEffects - import SortFilterProxyModel 0.2 - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" Popup { @@ -36,10 +32,7 @@ Popup { implicitWidth: parent.width // limit the number of accounts shown at once implicitHeight: { - return visible ? Math.min( - JamiTheme.accountListItemHeight * Math.min( - 5, listView.model.count + 1), - appWindow.height - parent.height) : 0 + return visible ? Math.min(JamiTheme.accountListItemHeight * Math.min(5, listView.model.count + 1), appWindow.height - parent.height) : 0; } padding: 0 modal: true @@ -68,8 +61,8 @@ Popup { height: JamiTheme.accountListItemHeight width: root.width onClicked: { - root.close() - LRCInstance.currentAccountId = ID + root.close(); + LRCInstance.currentAccountId = ID; } } } @@ -86,9 +79,7 @@ Popup { Layout.preferredWidth: parent.width background: Rectangle { - color: footerItem.hovered? - JamiTheme.hoverColor : - JamiTheme.backgroundColor + color: footerItem.hovered ? JamiTheme.hoverColor : JamiTheme.backgroundColor Text { anchors.centerIn: parent @@ -100,8 +91,8 @@ Popup { } onClicked: { - root.close() - viewCoordinator.present("WizardView") + root.close(); + viewCoordinator.present("WizardView"); } } } @@ -110,8 +101,10 @@ Popup { color: JamiTheme.backgroundColor CustomBorder { commonBorder: false - tBorderwidth: 1; lBorderwidth: 2 - bBorderwidth: 2; rBorderwidth: 1 + tBorderwidth: 1 + lBorderwidth: 2 + bBorderwidth: 2 + rBorderwidth: 1 borderColor: JamiTheme.tabbarBorderColor } diff --git a/src/app/mainview/components/AccountItemDelegate.qml b/src/app/mainview/components/AccountItemDelegate.qml index 13bd7488d0e516adb325ddafbc63967636f35436..d6af09c0a81bfcc688c28ebfca90c1d9f22803cc 100644 --- a/src/app/mainview/components/AccountItemDelegate.qml +++ b/src/app/mainview/components/AccountItemDelegate.qml @@ -16,14 +16,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" ItemDelegate { @@ -35,11 +32,11 @@ ItemDelegate { background: Rectangle { color: { if (root.pressed) - return JamiTheme.smartListSelectedColor + return JamiTheme.smartListSelectedColor; else if (root.hovered) - return JamiTheme.smartListHoveredColor + return JamiTheme.smartListHoveredColor; else - return JamiTheme.backgroundColor + return JamiTheme.backgroundColor; } } diff --git a/src/app/mainview/components/AddMemberPanel.qml b/src/app/mainview/components/AddMemberPanel.qml index 5c91db5d9cb76042214047021e1d068e5b4b9035..954be20d42611c300e05a8338f1e7c4cb122cd99 100644 --- a/src/app/mainview/components/AddMemberPanel.qml +++ b/src/app/mainview/components/AddMemberPanel.qml @@ -15,15 +15,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" Rectangle { @@ -48,7 +45,7 @@ Rectangle { placeHolderText: JamiStrings.addParticipant onContactSearchBarTextChanged: { - ContactAdapter.setSearchFilter(text) + ContactAdapter.setSearchFilter(text); } } @@ -66,13 +63,13 @@ Rectangle { target: CurrentConversationMembers function onCountChanged() { - contactPickerListView.model = ContactAdapter.getContactSelectableModel(type) + contactPickerListView.model = ContactAdapter.getContactSelectableModel(type); } } onVisibleChanged: { if (visible) - model = ContactAdapter.getContactSelectableModel(type) + model = ContactAdapter.getContactSelectableModel(type); } delegate: ContactPickerItemDelegate { diff --git a/src/app/mainview/components/BackupTipBox.qml b/src/app/mainview/components/BackupTipBox.qml index e239cbef4899bf03bc08069b6577eab41d47b7ba..2c0ab3f4e344b549dae612a7201c614dd32d7dae 100644 --- a/src/app/mainview/components/BackupTipBox.qml +++ b/src/app/mainview/components/BackupTipBox.qml @@ -14,16 +14,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts import Qt.labs.platform - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" Item { @@ -118,38 +115,31 @@ Item { pressedColor: JamiTheme.buttonTintedGreyPressed onClicked: { - var dlg = viewCoordinator.presentDialog( - appWindow, - "commoncomponents/JamiFileDialog.qml", - { - //objectName: "exportDialog", - title: JamiStrings.backupAccountHere, - fileMode: JamiFileDialog.SaveFile, - folder: StandardPaths.writableLocation( - StandardPaths.HomeLocation) + "/Desktop", - nameFilters: [JamiStrings.jamiArchiveFiles, JamiStrings.allFiles] - }) + var dlg = viewCoordinator.presentDialog(appWindow, "commoncomponents/JamiFileDialog.qml", { + "title": JamiStrings.backupAccountHere, + "fileMode": JamiFileDialog.SaveFile, + "folder": StandardPaths.writableLocation(StandardPaths.HomeLocation) + "/Desktop", + "nameFilters": [JamiStrings.jamiArchiveFiles, JamiStrings.allFiles] + }); dlg.fileAccepted.connect(function (file) { - // Is there password? If so, go to password dialog, else, go to following directly - if (CurrentAccount.hasArchivePassword) { - var pwdDlg = viewCoordinator.presentDialog( - appWindow, - "commoncomponents/PasswordDialog.qml", - { - //objectName: "passwordDialog", - path: UtilsAdapter.getAbsPath(file), - purpose: PasswordDialog.ExportAccount - }) - pwdDlg.done.connect(function () { root.ignore() }) - } else { - if (file.toString().length > 0) { - root.ignore() + // Is there password? If so, go to password dialog, else, go to following directly + if (CurrentAccount.hasArchivePassword) { + var pwdDlg = viewCoordinator.presentDialog(appWindow, "commoncomponents/PasswordDialog.qml", { + "path": UtilsAdapter.getAbsPath(file), + "purpose": PasswordDialog.ExportAccount + }); + pwdDlg.done.connect(function () { + root.ignore(); + }); + } else { + if (file.toString().length > 0) { + root.ignore(); + } } - } - }) + }); dlg.rejected.connect(function () { - backupBtn.forceActiveFocus() - }) + backupBtn.forceActiveFocus(); + }); } } } diff --git a/src/app/mainview/components/BadgeNotifier.qml b/src/app/mainview/components/BadgeNotifier.qml index 77bb701e579b4e7b6a244d04033538fc0e87903e..d3a289220bd84e4fe79a4cc5e9426a2bde881289 100644 --- a/src/app/mainview/components/BadgeNotifier.qml +++ b/src/app/mainview/components/BadgeNotifier.qml @@ -16,9 +16,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick - import net.jami.Constants 1.1 Rectangle { @@ -50,30 +48,37 @@ Rectangle { onCountChanged: { if (count > lastCount && animate) - notifyAnim.start() - lastCount = count + notifyAnim.start(); + lastCount = count; if (!populated) - populated = true + populated = true; } ParallelAnimation { id: notifyAnim ColorAnimation { - target: root; properties: "color" + target: root + properties: "color" from: JamiTheme.filterBadgeTextColor to: JamiTheme.filterBadgeColor - duration: 150; easing.type: Easing.InOutQuad + duration: 150 + easing.type: Easing.InOutQuad } ColorAnimation { - target: countLabel; properties: "color" + target: countLabel + properties: "color" from: JamiTheme.filterBadgeColor to: JamiTheme.filterBadgeTextColor - duration: 150; easing.type: Easing.InOutQuad + duration: 150 + easing.type: Easing.InOutQuad } NumberAnimation { - target: root; property: "y" - from: -3; to: 0 - duration: 150; easing.type: Easing.InOutQuad + target: root + property: "y" + from: -3 + to: 0 + duration: 150 + easing.type: Easing.InOutQuad } } } diff --git a/src/app/mainview/components/BlinkingLocationIcon.qml b/src/app/mainview/components/BlinkingLocationIcon.qml index a9125f17ac4c71059b52f888f1e19c383b809eeb..545d7052b4aaca2995a9276fcfcbb1bd5d3c91e2 100644 --- a/src/app/mainview/components/BlinkingLocationIcon.qml +++ b/src/app/mainview/components/BlinkingLocationIcon.qml @@ -14,12 +14,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts import net.jami.Constants 1.1 - - import "../../commoncomponents" ResponsiveImage { @@ -42,4 +39,3 @@ ResponsiveImage { anchors.leftMargin: isSharing ? 0 : 3 } } - diff --git a/src/app/mainview/components/CallActionBar.qml b/src/app/mainview/components/CallActionBar.qml index a4d520407d481f44f0eade5f01835a2d2340ef00..efdaff3f64192b2b8a7492e659f74b97c8dfb2f3 100644 --- a/src/app/mainview/components/CallActionBar.qml +++ b/src/app/mainview/components/CallActionBar.qml @@ -15,23 +15,20 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 import net.jami.Enums 1.1 - import "../../commoncomponents" Control { id: root enum ActionPopupMode { - MediaDevice = 0, + MediaDevice, ListElement, LayoutOption } @@ -75,9 +72,9 @@ Control { function onAudioDeviceListChanged(inputs, outputs) { audioInputDeviceListModel.reset(); - audioInputMenuAction.enabled = inputs + audioInputMenuAction.enabled = inputs; audioOutputDeviceListModel.reset(); - audioOutputMenuAction.enabled = outputs + audioOutputMenuAction.enabled = outputs; } } @@ -92,9 +89,9 @@ Control { type: AudioDeviceModel.Type.Record } function accept(index) { - AvAdapter.stopAudioMeter() - AVModel.setInputDevice(index) - AvAdapter.startAudioMeter() + AvAdapter.stopAudioMeter(); + AVModel.setInputDevice(index); + AvAdapter.startAudioMeter(); } }, Action { @@ -107,9 +104,9 @@ Control { type: AudioDeviceModel.Type.Playback } function accept(index) { - AvAdapter.stopAudioMeter() - AVModel.setOutputDevice(index) - AvAdapter.startAudioMeter() + AvAdapter.stopAudioMeter(); + AVModel.setOutputDevice(index); + AvAdapter.startAudioMeter(); } }, Action { @@ -120,34 +117,43 @@ Control { id: shareModel } onTriggered: { - shareModel.clear() - shareModel.append({"Name": JamiStrings.shareScreen, - "IconSource": JamiResources.laptop_black_24dp_svg}) + shareModel.clear(); + shareModel.append({ + "Name": JamiStrings.shareScreen, + "IconSource": JamiResources.laptop_black_24dp_svg + }); if (Qt.platform.os.toString() !== "osx") { - shareModel.append({"Name": JamiStrings.shareWindow, - "IconSource" : JamiResources.window_black_24dp_svg}) + shareModel.append({ + "Name": JamiStrings.shareWindow, + "IconSource": JamiResources.window_black_24dp_svg + }); } - if (Qt.platform.os.toString() !== "windows") { // temporarily disable for windows - shareModel.append({"Name": JamiStrings.shareScreenArea, - "IconSource" : JamiResources.share_area_black_24dp_svg}) + if (Qt.platform.os.toString() !== "windows") { + // temporarily disable for windows + shareModel.append({ + "Name": JamiStrings.shareScreenArea, + "IconSource": JamiResources.share_area_black_24dp_svg + }); } - shareModel.append({"Name": JamiStrings.shareFile, - "IconSource" : JamiResources.file_black_24dp_svg}) + shareModel.append({ + "Name": JamiStrings.shareFile, + "IconSource": JamiResources.file_black_24dp_svg + }); } function accept(index) { - switch(shareModel.get(index).Name) { - case JamiStrings.shareScreen: - shareScreenClicked() - break - case JamiStrings.shareWindow: - shareWindowClicked() - break - case JamiStrings.shareScreenArea: - shareScreenAreaClicked() - break - case JamiStrings.shareFile: - shareFileClicked() - break + switch (shareModel.get(index).Name) { + case JamiStrings.shareScreen: + shareScreenClicked(); + break; + case JamiStrings.shareWindow: + shareWindowClicked(); + break; + case JamiStrings.shareScreenArea: + shareScreenAreaClicked(); + break; + case JamiStrings.shareFile: + shareFileClicked(); + break; } } }, @@ -159,81 +165,90 @@ Control { id: layoutModel } function accept(index) { - switch(layoutModel.get(index).Name) { - case JamiStrings.viewFullScreen: - root.fullScreenClicked() - layoutModel.get(index).ActiveSetting = layoutManager.isCallFullscreen - break - case JamiStrings.mosaic: - if (!CurrentCall.isGrid) - CallAdapter.showGridConferenceLayout() - break - case JamiStrings.participantsSide: - if (!UtilsAdapter.getAppValue(Settings.ParticipantsSide)) { - UtilsAdapter.setAppValue(Settings.ParticipantsSide, true) - participantsSide = true - } - break - case JamiStrings.participantsTop: - if (UtilsAdapter.getAppValue(Settings.ParticipantsSide)) { - UtilsAdapter.setAppValue(Settings.ParticipantsSide, false) - participantsSide = false - } - break - case JamiStrings.hideSelf: - UtilsAdapter.setAppValue(Settings.HideSelf, !layoutModel.get(index).ActiveSetting) - CurrentCall.hideSelf = UtilsAdapter.getAppValue(Settings.HideSelf) - break - case JamiStrings.hideSpectators: - UtilsAdapter.setAppValue(Settings.HideSpectators, !layoutModel.get(index).ActiveSetting) - CurrentCall.hideSpectators = UtilsAdapter.getAppValue(Settings.HideSpectators) - break + switch (layoutModel.get(index).Name) { + case JamiStrings.viewFullScreen: + root.fullScreenClicked(); + layoutModel.get(index).ActiveSetting = layoutManager.isCallFullscreen; + break; + case JamiStrings.mosaic: + if (!CurrentCall.isGrid) + CallAdapter.showGridConferenceLayout(); + break; + case JamiStrings.participantsSide: + if (!UtilsAdapter.getAppValue(Settings.ParticipantsSide)) { + UtilsAdapter.setAppValue(Settings.ParticipantsSide, true); + participantsSide = true; + } + break; + case JamiStrings.participantsTop: + if (UtilsAdapter.getAppValue(Settings.ParticipantsSide)) { + UtilsAdapter.setAppValue(Settings.ParticipantsSide, false); + participantsSide = false; + } + break; + case JamiStrings.hideSelf: + UtilsAdapter.setAppValue(Settings.HideSelf, !layoutModel.get(index).ActiveSetting); + CurrentCall.hideSelf = UtilsAdapter.getAppValue(Settings.HideSelf); + break; + case JamiStrings.hideSpectators: + UtilsAdapter.setAppValue(Settings.HideSpectators, !layoutModel.get(index).ActiveSetting); + CurrentCall.hideSpectators = UtilsAdapter.getAppValue(Settings.HideSpectators); + break; } } onTriggered: { - layoutModel.clear() + layoutModel.clear(); if (CurrentCall.isConference) { - layoutModel.append({"Name": JamiStrings.mosaic, - "IconSource": JamiResources.mosaic_black_24dp_svg, - "ActiveSetting": CurrentCall.isGrid, - "TopMargin": true, - "BottomMargin": true, - "SectionEnd": true}) - - var onTheSide = UtilsAdapter.getAppValue(Settings.ParticipantsSide) - layoutModel.append({"Name": JamiStrings.participantsTop, - "IconSource": JamiResources.onthetop_black_24dp_svg, - "ActiveSetting": !onTheSide, - "TopMargin": true, - "BottomMargin": false, - "SectionEnd": false}) - layoutModel.append({"Name": JamiStrings.participantsSide, - "IconSource": JamiResources.ontheside_black_24dp_svg, - "ActiveSetting": onTheSide, - "TopMargin": false, - "BottomMargin": true, - "SectionEnd": true}) - - layoutModel.append({"Name": JamiStrings.hideSelf, - "IconSource": JamiResources.hidemyself_black_24dp_svg, - "ActiveSetting": UtilsAdapter.getAppValue(Settings.HideSelf), - "TopMargin": true, - "BottomMargin": false, - "SectionEnd": false}) + layoutModel.append({ + "Name": JamiStrings.mosaic, + "IconSource": JamiResources.mosaic_black_24dp_svg, + "ActiveSetting": CurrentCall.isGrid, + "TopMargin": true, + "BottomMargin": true, + "SectionEnd": true + }); + var onTheSide = UtilsAdapter.getAppValue(Settings.ParticipantsSide); + layoutModel.append({ + "Name": JamiStrings.participantsTop, + "IconSource": JamiResources.onthetop_black_24dp_svg, + "ActiveSetting": !onTheSide, + "TopMargin": true, + "BottomMargin": false, + "SectionEnd": false + }); + layoutModel.append({ + "Name": JamiStrings.participantsSide, + "IconSource": JamiResources.ontheside_black_24dp_svg, + "ActiveSetting": onTheSide, + "TopMargin": false, + "BottomMargin": true, + "SectionEnd": true + }); + layoutModel.append({ + "Name": JamiStrings.hideSelf, + "IconSource": JamiResources.hidemyself_black_24dp_svg, + "ActiveSetting": UtilsAdapter.getAppValue(Settings.HideSelf), + "TopMargin": true, + "BottomMargin": false, + "SectionEnd": false + }); } - - layoutModel.append({"Name": JamiStrings.viewFullScreen, - "IconSource": JamiResources.open_in_full_24dp_svg, - "ActiveSetting": layoutManager.isCallFullscreen, - "TopMargin": true, - "BottomMargin": true, - "SectionEnd": CurrentCall.isConference}) + layoutModel.append({ + "Name": JamiStrings.viewFullScreen, + "IconSource": JamiResources.open_in_full_24dp_svg, + "ActiveSetting": layoutManager.isCallFullscreen, + "TopMargin": true, + "BottomMargin": true, + "SectionEnd": CurrentCall.isConference + }); if (CurrentCall.isConference) { - layoutModel.append({"Name": JamiStrings.hideSpectators, - "IconSource": JamiResources.videocam_off_24dp_svg, - "ActiveSetting": UtilsAdapter.getAppValue(Settings.HideSpectators), - "TopMargin": true, - "BottomMargin": true}) + layoutModel.append({ + "Name": JamiStrings.hideSpectators, + "IconSource": JamiResources.videocam_off_24dp_svg, + "ActiveSetting": UtilsAdapter.getAppValue(Settings.HideSpectators), + "TopMargin": true, + "BottomMargin": true + }); } } }, @@ -243,7 +258,7 @@ Control { text: JamiStrings.selectVideoDevice property var listModel: VideoDevices.deviceSourceModel function accept(index) { - VideoDevices.setDefaultDevice(index) + VideoDevices.setDefaultDevice(index); } } ] @@ -252,19 +267,16 @@ Control { Action { id: muteAudioAction onTriggered: { - var muteState = CallAdapter.getMuteState(CurrentAccount.uri) - var modMuted = muteState === CallAdapter.MODERATOR_MUTED - || muteState === CallAdapter.BOTH_MUTED + var muteState = CallAdapter.getMuteState(CurrentAccount.uri); + var modMuted = muteState === CallAdapter.MODERATOR_MUTED || muteState === CallAdapter.BOTH_MUTED; if (muteAudioAction.checked && modMuted) { - muteAlertActive = true - muteAlertMessage = JamiStrings.participantModIsStillMuted + muteAlertActive = true; + muteAlertMessage = JamiStrings.participantModIsStillMuted; } - CallAdapter.muteAudioToggle() + CallAdapter.muteAudioToggle(); } checkable: true - icon.source: checked ? - JamiResources.micro_off_black_24dp_svg : - JamiResources.micro_black_24dp_svg + icon.source: checked ? JamiResources.micro_off_black_24dp_svg : JamiResources.micro_black_24dp_svg icon.color: checked ? "red" : "white" text: !checked ? JamiStrings.mute : JamiStrings.unmute checked: CurrentCall.isAudioMuted @@ -282,9 +294,7 @@ Control { id: muteVideoAction onTriggered: CallAdapter.muteCameraToggle() checkable: true - icon.source: checked ? - JamiResources.videocam_off_24dp_svg : - JamiResources.videocam_24dp_svg + icon.source: checked ? JamiResources.videocam_off_24dp_svg : JamiResources.videocam_24dp_svg icon.color: checked ? "red" : "white" text: !checked ? JamiStrings.muteCamera : JamiStrings.unmuteCamera checked: !CurrentCall.isCapturing @@ -320,13 +330,9 @@ Control { Action { id: resumePauseCallAction onTriggered: root.resumePauseCallClicked() - icon.source: CurrentCall.isPaused ? - JamiResources.play_circle_outline_24dp_svg : - JamiResources.pause_circle_outline_24dp_svg + icon.source: CurrentCall.isPaused ? JamiResources.play_circle_outline_24dp_svg : JamiResources.pause_circle_outline_24dp_svg icon.color: "white" - text: CurrentCall.isPaused ? - JamiStrings.resumeCall : - JamiStrings.pauseCall + text: CurrentCall.isPaused ? JamiStrings.resumeCall : JamiStrings.pauseCall }, Action { id: inputPanelSIPAction @@ -346,18 +352,13 @@ Control { id: shareAction onTriggered: { if (CurrentCall.isSharing) - root.stopSharingClicked() + root.stopSharingClicked(); else - root.shareScreenClicked() + root.shareScreenClicked(); } - icon.source: CurrentCall.isSharing ? - JamiResources.share_stop_black_24dp_svg : - JamiResources.share_screen_black_24dp_svg - icon.color: CurrentCall.isSharing ? - "red" : "white" - text: CurrentCall.isSharing ? - JamiStrings.stopSharing : - JamiStrings.shareScreen + icon.source: CurrentCall.isSharing ? JamiResources.share_stop_black_24dp_svg : JamiResources.share_screen_black_24dp_svg + icon.color: CurrentCall.isSharing ? "red" : "white" + text: CurrentCall.isSharing ? JamiStrings.stopSharing : JamiStrings.shareScreen property real size: 34 property var menuAction: shareMenuAction }, @@ -367,9 +368,7 @@ Control { checkable: true icon.source: JamiResources.hand_black_24dp_svg icon.color: checked ? JamiTheme.raiseHandColor : "white" - text: checked ? - JamiStrings.lowerHand : - JamiStrings.raiseHand + text: checked ? JamiStrings.lowerHand : JamiStrings.raiseHand checked: CurrentCall.isHandRaised property real size: 34 }, @@ -377,7 +376,7 @@ Control { id: layoutAction onTriggered: { if (!CurrentCall.isGrid) - CallAdapter.showGridConferenceLayout() + CallAdapter.showGridConferenceLayout(); } checkable: true icon.source: JamiResources.mosaic_black_24dp_svg @@ -396,9 +395,8 @@ Control { property bool blinksWhenChecked: true property real size: 28 checked: CurrentCall.isRecordingLocally - onCheckedChanged: function(checked) { - CallOverlayModel.setUrgentCount(recordAction, - checked ? -1 : 0) + onCheckedChanged: function (checked) { + CallOverlayModel.setUrgentCount(recordAction, checked ? -1 : 0); } }, Action { @@ -407,8 +405,7 @@ Control { icon.source: JamiResources.plugins_24dp_svg icon.color: "white" text: JamiStrings.viewPlugin - enabled: PluginAdapter.isEnabled - && PluginAdapter.callMediaHandlersListCount + enabled: PluginAdapter.isEnabled && PluginAdapter.callMediaHandlersListCount }, Action { id: swarmDetailsAction @@ -418,12 +415,12 @@ Control { text: JamiStrings.details enabled: { if (LRCInstance.currentAccountType === Profile.Type.SIP) - return true + return true; if (!CurrentConversation.isTemporary && !CurrentConversation.isSwarm) - return false + return false; if (CurrentConversation.isRequest || CurrentConversation.needsSyncing) - return false - return true + return false; + return true; } } ] @@ -433,54 +430,74 @@ Control { Connections { target: CurrentCall - function onIsActiveChanged() { if (CurrentCall.isActive) reset() } - function onIsRecordingLocallyChanged() { Qt.callLater(reset) } - function onIsHandRaisedChanged() { Qt.callLater(reset) } - function onIsConferenceChanged() { Qt.callLater(reset) } - function onIsModeratorChanged() { Qt.callLater(reset) } - function onIsSIPChanged() { Qt.callLater(reset) } - function onIsAudioOnlyChanged() { Qt.callLater(reset) } - function onIsAudioMutedChanged() { Qt.callLater(reset) } - function onIsVideoMutedChanged() { Qt.callLater(reset) } + function onIsActiveChanged() { + if (CurrentCall.isActive) + reset(); + } + function onIsRecordingLocallyChanged() { + Qt.callLater(reset); + } + function onIsHandRaisedChanged() { + Qt.callLater(reset); + } + function onIsConferenceChanged() { + Qt.callLater(reset); + } + function onIsModeratorChanged() { + Qt.callLater(reset); + } + function onIsSIPChanged() { + Qt.callLater(reset); + } + function onIsAudioOnlyChanged() { + Qt.callLater(reset); + } + function onIsAudioMutedChanged() { + Qt.callLater(reset); + } + function onIsVideoMutedChanged() { + Qt.callLater(reset); + } } Connections { target: CurrentAccount - function onVideoEnabledVideoChanged() { reset() } + function onVideoEnabledVideoChanged() { + reset(); + } } function reset() { - CallOverlayModel.clearControls() + CallOverlayModel.clearControls(); // centered controls - CallOverlayModel.addPrimaryControl(muteAudioAction) - CallOverlayModel.addPrimaryControl(hangupAction) - + CallOverlayModel.addPrimaryControl(muteAudioAction); + CallOverlayModel.addPrimaryControl(hangupAction); if (CurrentAccount.videoEnabled_Video) - CallOverlayModel.addPrimaryControl(muteVideoAction) + CallOverlayModel.addPrimaryControl(muteVideoAction); // overflow controls - CallOverlayModel.addSecondaryControl(audioOutputAction) + CallOverlayModel.addSecondaryControl(audioOutputAction); if (CurrentCall.isConference) { - CallOverlayModel.addSecondaryControl(raiseHandAction) + CallOverlayModel.addSecondaryControl(raiseHandAction); } if (CurrentCall.isModerator && !CurrentCall.isSIP) - CallOverlayModel.addSecondaryControl(addPersonAction) + CallOverlayModel.addSecondaryControl(addPersonAction); if (CurrentCall.isSIP) { - CallOverlayModel.addSecondaryControl(resumePauseCallAction) - CallOverlayModel.addSecondaryControl(inputPanelSIPAction) - CallOverlayModel.addSecondaryControl(callTransferAction) + CallOverlayModel.addSecondaryControl(resumePauseCallAction); + CallOverlayModel.addSecondaryControl(inputPanelSIPAction); + CallOverlayModel.addSecondaryControl(callTransferAction); } - CallOverlayModel.addSecondaryControl(chatAction) + CallOverlayModel.addSecondaryControl(chatAction); if (CurrentAccount.videoEnabled_Video && !CurrentCall.isSIP) - CallOverlayModel.addSecondaryControl(shareAction) - CallOverlayModel.addSecondaryControl(layoutAction) - CallOverlayModel.addSecondaryControl(recordAction) + CallOverlayModel.addSecondaryControl(shareAction); + CallOverlayModel.addSecondaryControl(layoutAction); + CallOverlayModel.addSecondaryControl(recordAction); if (pluginsAction.enabled) - CallOverlayModel.addSecondaryControl(pluginsAction) + CallOverlayModel.addSecondaryControl(pluginsAction); if (swarmDetailsAction.enabled) - CallOverlayModel.addSecondaryControl(swarmDetailsAction) - overflowItemCount = CallOverlayModel.secondaryModel().rowCount() + CallOverlayModel.addSecondaryControl(swarmDetailsAction); + overflowItemCount = CallOverlayModel.secondaryModel().rowCount(); } Item { @@ -529,18 +546,16 @@ Control { spacing: itemSpacing property int overflowIndex: { - var maxItems = Math.floor( - (overflowRect.remainingSpace) / (root.height + itemSpacing)) - 2 - return Math.min(overflowItemCount, maxItems) + var maxItems = Math.floor((overflowRect.remainingSpace) / (root.height + itemSpacing)) - 2; + return Math.min(overflowItemCount, maxItems); } property int nOverflowItems: overflowItemCount - overflowIndex onNOverflowItemsChanged: { - var diff = overflowItemListView.count - nOverflowItems - var effectiveOverflowIndex = overflowIndex + var diff = overflowItemListView.count - nOverflowItems; + var effectiveOverflowIndex = overflowIndex; if (effectiveOverflowIndex === overflowItemCount - 2) - effectiveOverflowIndex += diff - - CallOverlayModel.overflowIndex = effectiveOverflowIndex + effectiveOverflowIndex += diff; + CallOverlayModel.overflowIndex = effectiveOverflowIndex; } model: CallOverlayModel.overflowModel() @@ -571,24 +586,19 @@ Control { implicitWidth: root.height implicitHeight: implicitWidth radius: type === HalfPill.None ? 0 : 5 - color: overflowButton.down ? - "#c4777777": - overflowButton.hovered ? - "#c4444444" : - "#c4272727" + color: overflowButton.down ? "#c4777777" : overflowButton.hovered ? "#c4444444" : "#c4272727" type: { - if (overflowItemListView.count || - urgentOverflowListView.count || - (overflowHiddenListView.count && - overflowButton.popup.visible)) { - return HalfPill.None + if (overflowItemListView.count || urgentOverflowListView.count || (overflowHiddenListView.count && overflowButton.popup.visible)) { + return HalfPill.None; } else { - return HalfPill.Left + return HalfPill.Left; } } - Behavior on color { - ColorAnimation { duration: JamiTheme.shortFadeDuration } + Behavior on color { + ColorAnimation { + duration: JamiTheme.shortFadeDuration + } } } @@ -603,20 +613,22 @@ Control { spacing: itemSpacing anchors.fill: parent - model: !overflowButton.popup.visible ? - CallOverlayModel.overflowVisibleModel() : - null + model: !overflowButton.popup.visible ? CallOverlayModel.overflowVisibleModel() : null delegate: buttonDelegate add: Transition { NumberAnimation { property: "opacity" - from: 0 ; to: 1.0; duration: 80 + from: 0 + to: 1.0 + duration: 80 } NumberAnimation { property: "scale" - from: 0; to: 1.0; duration: 80 + from: 0 + to: 1.0 + duration: 80 } } } @@ -625,8 +637,7 @@ Control { popup: Popup { y: overflowButton.height + itemSpacing width: overflowButton.width - implicitHeight: Math.min(root.parentHeight - itemSpacing, - (overflowButton.width + itemSpacing) * overflowHiddenListView.count) + implicitHeight: Math.min(root.parentHeight - itemSpacing, (overflowButton.width + itemSpacing) * overflowHiddenListView.count) padding: 0 contentItem: JamiListView { @@ -634,9 +645,7 @@ Control { spacing: itemSpacing implicitHeight: Math.min(contentHeight, parent.height) interactive: true - model: overflowButton.popup.visible ? - overflowButton.delegateModel : - null + model: overflowButton.popup.visible ? overflowButton.delegateModel : null } background: Rectangle { diff --git a/src/app/mainview/components/CallButtonDelegate.qml b/src/app/mainview/components/CallButtonDelegate.qml index fcb73c361f7159288a43fa776df717a5c043cecb..dd7a4da043d019f9ea2e457004584fd675ad7a38 100644 --- a/src/app/mainview/components/CallButtonDelegate.qml +++ b/src/app/mainview/components/CallButtonDelegate.qml @@ -15,15 +15,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts import Qt5Compat.GraphicalEffects - import net.jami.Models 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" ItemDelegate { @@ -53,8 +50,7 @@ ItemDelegate { // TODO: remove this when output volume control is implemented MouseArea { - visible: ItemAction.openPopupWhenClicked !== undefined - && ItemAction.openPopupWhenClicked && !menu.popup.visible + visible: ItemAction.openPopupWhenClicked !== undefined && ItemAction.openPopupWhenClicked && !menu.popup.visible anchors.fill: root onClicked: menu.popup.open() } @@ -64,29 +60,25 @@ ItemDelegate { radius: type === HalfPill.None ? 0 : 5 color: { if (supplimentaryBackground.visible) - return "#c4272727" - return root.down ? - "#c4777777" : - (root.hovered && !menu.hovered) ? - "#c4444444" : - "#c4272727" + return "#c4272727"; + return root.down ? "#c4777777" : (root.hovered && !menu.hovered) ? "#c4444444" : "#c4272727"; } type: { if (isVertical) { if (isFirst) - return HalfPill.Top + return HalfPill.Top; else if (isLast && hasLast) - return HalfPill.Bottom + return HalfPill.Bottom; } else { if (isFirst) - return HalfPill.Left + return HalfPill.Left; else if (isLast && hasLast) - return HalfPill.Right + return HalfPill.Right; } - return HalfPill.None + return HalfPill.None; } - Behavior on color { + Behavior on color { ColorAnimation { duration: JamiTheme.shortFadeDuration } @@ -98,15 +90,12 @@ ItemDelegate { id: supplimentaryBackground visible: ItemAction.hasBg !== undefined - color: root.down ? Qt.lighter(JamiTheme.refuseRed, 1.5) : - root.hovered && !menu.hovered ? - JamiTheme.refuseRed : - JamiTheme.refuseRedTransparent + color: root.down ? Qt.lighter(JamiTheme.refuseRed, 1.5) : root.hovered && !menu.hovered ? JamiTheme.refuseRed : JamiTheme.refuseRedTransparent anchors.fill: parent radius: isLast ? 5 : width / 2 type: isLast ? HalfPill.Right : HalfPill.None - Behavior on color { + Behavior on color { ColorAnimation { duration: JamiTheme.shortFadeDuration } @@ -123,17 +112,11 @@ ItemDelegate { anchors.centerIn: parent source: ItemAction ? ItemAction.icon.source : "" - color: ItemAction ? - (ItemAction.enabled ? - ItemAction.icon.color : - Qt.lighter(ItemAction.icon.color)) : - null + color: ItemAction ? (ItemAction.enabled ? ItemAction.icon.color : Qt.lighter(ItemAction.icon.color)) : null - SequentialAnimation on opacity { + SequentialAnimation on opacity { loops: Animation.Infinite - running: ItemAction !== undefined - && ItemAction.blinksWhenChecked !== undefined - && ItemAction.blinksWhenChecked && checked + running: ItemAction !== undefined && ItemAction.blinksWhenChecked !== undefined && ItemAction.blinksWhenChecked && checked onStopped: icon.opacity = 1 NumberAnimation { from: 1 @@ -163,8 +146,7 @@ ItemDelegate { id: toolTip parent: parent visible: text.length > 0 && (root.hovered || menu.hovered) - text: menu.hovered ? menuAction.text : (ItemAction - !== undefined ? ItemAction.text : null) + text: menu.hovered ? menuAction.text : (ItemAction !== undefined ? ItemAction.text : null) verticalPadding: 1 font.pointSize: 9 } @@ -177,8 +159,7 @@ ItemDelegate { indicator: null - visible: ItemAction.enabled - && menuAction !== undefined && !UrgentCount && menuAction.enabled + visible: ItemAction.enabled && menuAction !== undefined && !UrgentCount && menuAction.enabled y: isVertical ? 0 : -4 x: isVertical ? -4 : 0 @@ -192,14 +173,12 @@ ItemDelegate { target: menuAction !== undefined ? menuAction : null function onTriggered() { if (menuAction.popupMode !== CallActionBar.ActionPopupMode.ListElement) - itemListView.currentIndex = menuAction.listModel.getCurrentIndex() + itemListView.currentIndex = menuAction.listModel.getCurrentIndex(); } } contentItem: ResponsiveImage { - source: isVertical ? - JamiResources.chevron_left_black_24dp_svg : - JamiResources.expand_less_24dp_svg + source: isVertical ? JamiResources.chevron_left_black_24dp_svg : JamiResources.expand_less_24dp_svg color: "white" } @@ -208,18 +187,17 @@ ItemDelegate { radius: 4 } - onActivated: index => menuAction.accept(index) + onActivated: index => menuAction.accept(index); model: visible ? menuAction.listModel : null delegate: ItemDelegate { id: menuItem width: itemListView.menuItemWidth height: { - if (menuAction.popupMode === CallActionBar.ActionPopupMode.LayoutOption && - (!TopMargin || !BottomMargin)) { - return 40 + if (menuAction.popupMode === CallActionBar.ActionPopupMode.LayoutOption && (!TopMargin || !BottomMargin)) { + return 40; } - return 45 + return 45; } background: Rectangle { anchors.fill: parent @@ -234,25 +212,20 @@ ItemDelegate { Layout.leftMargin: 20 Layout.fillHeight: true Layout.alignment: { - if (menuAction.popupMode !== CallActionBar.ActionPopupMode.LayoutOption || - TopMargin && BottomMargin) { - return Qt.AlignLeft | Qt.AlignVCenter + if (menuAction.popupMode !== CallActionBar.ActionPopupMode.LayoutOption || TopMargin && BottomMargin) { + return Qt.AlignLeft | Qt.AlignVCenter; } if (TopMargin) { - Layout.bottomMargin = 4 - return Qt.AlignBottom + Layout.bottomMargin = 4; + return Qt.AlignBottom; } - Layout.topMargin = 4 - return Qt.AlignTop + Layout.topMargin = 4; + return Qt.AlignTop; } spacing: 6 ResponsiveImage { - source: menuAction.popupMode === CallActionBar.ActionPopupMode.ListElement || - menuAction.popupMode === CallActionBar.ActionPopupMode.LayoutOption ? - IconSource : (menuItem.ListView.isCurrentItem ? - JamiResources.check_box_24dp_svg : - JamiResources.check_box_outline_blank_24dp_svg) + source: menuAction.popupMode === CallActionBar.ActionPopupMode.ListElement || menuAction.popupMode === CallActionBar.ActionPopupMode.LayoutOption ? IconSource : (menuItem.ListView.isCurrentItem ? JamiResources.check_box_24dp_svg : JamiResources.check_box_outline_blank_24dp_svg) color: "white" width: 20 height: 20 @@ -262,9 +235,7 @@ ItemDelegate { Layout.fillWidth: true horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter - text: menuAction.popupMode === CallActionBar.ActionPopupMode.ListElement || - menuAction.popupMode === CallActionBar.ActionPopupMode.LayoutOption ? - Name : DeviceName + text: menuAction.popupMode === CallActionBar.ActionPopupMode.ListElement || menuAction.popupMode === CallActionBar.ActionPopupMode.LayoutOption ? Name : DeviceName elide: Text.ElideRight font.pointSize: JamiTheme.participantFontSize color: "white" @@ -274,8 +245,7 @@ ItemDelegate { color: "white" width: 20 height: 20 - visible: menuAction.popupMode === CallActionBar.ActionPopupMode.LayoutOption ? - ActiveSetting : false + visible: menuAction.popupMode === CallActionBar.ActionPopupMode.LayoutOption ? ActiveSetting : false } } Rectangle { @@ -284,7 +254,7 @@ ItemDelegate { Layout.fillWidth: true height: 1 opacity: 0.2 - border.width : 0 + border.width: 0 color: JamiTheme.separationLine Layout.alignment: Qt.AlignBottom } @@ -297,11 +267,11 @@ ItemDelegate { y: isVertical ? -(implicitHeight - root.height) / 2 - 18 : -implicitHeight - 12 x: { if (isVertical) - return -implicitWidth - 12 - var xValue = -(implicitWidth - root.width) / 2 - 18 - var mainPoint = mapToItem(viewCoordinator.rootView, xValue, y) - var diff = mainPoint.x + itemListView.implicitWidth - viewCoordinator.rootView.width - return diff > 0 ? xValue - diff - 24 : xValue + return -implicitWidth - 12; + var xValue = -(implicitWidth - root.width) / 2 - 18; + var mainPoint = mapToItem(viewCoordinator.rootView, xValue, y); + var diff = mainPoint.x + itemListView.implicitWidth - viewCoordinator.rootView.width; + return diff > 0 ? xValue - diff - 24 : xValue; } implicitWidth: contentItem.implicitWidth @@ -332,29 +302,26 @@ ItemDelegate { // recalc list width based on max item width onCountChanged: { - var mPreferredWidth = 145 - + var mPreferredWidth = 145; if (count && menuAction.popupMode === CallActionBar.ActionPopupMode.LayoutOption) { - menuItemWidth = 290 - return + menuItemWidth = 290; + return; } - for (var i = 0; i < count; ++i) { if (menuAction.popupMode === CallActionBar.ActionPopupMode.ListElement) - itemTextMetrics.text = menuAction.listModel.get(i).Name + itemTextMetrics.text = menuAction.listModel.get(i).Name; else { // Hack: use AudioDeviceModel.DeviceName role for video as well - var idx = menuAction.listModel.index(i, 0) - itemTextMetrics.text = menuAction.listModel.data( - idx, AudioDeviceModel.DeviceName) + var idx = menuAction.listModel.index(i, 0); + itemTextMetrics.text = menuAction.listModel.data(idx, AudioDeviceModel.DeviceName); } if (itemTextMetrics.boundingRect.width > mPreferredWidth) - mPreferredWidth = itemTextMetrics.boundingRect.width + mPreferredWidth = itemTextMetrics.boundingRect.width; } // 30(icon) + 5(layout spacing) + 12(margins) + 20 to avoid text elipsis - mPreferredWidth = mPreferredWidth + 30 + 5 + 12 + 20 - mPreferredWidth = Math.min(root.barWidth, mPreferredWidth) - menuItemWidth = mPreferredWidth + mPreferredWidth = mPreferredWidth + 30 + 5 + 12 + 20; + mPreferredWidth = Math.min(root.barWidth, mPreferredWidth); + menuItemWidth = mPreferredWidth; } } diff --git a/src/app/mainview/components/CallInformationOverlay.qml b/src/app/mainview/components/CallInformationOverlay.qml index 4b8a623de1b0a60dc36b89abab2a06cb32ef1c99..3de4fbd5bfe138a7610caeaba62800bbc5ffefae 100644 --- a/src/app/mainview/components/CallInformationOverlay.qml +++ b/src/app/mainview/components/CallInformationOverlay.qml @@ -18,12 +18,10 @@ import QtQuick import QtQuick.Layouts import QtQuick.Controls - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 import Qt5Compat.GraphicalEffects - import "../../commoncomponents" Popup { @@ -40,14 +38,14 @@ Popup { closePolicy: Popup.NoAutoClosed onClosed: { - CallAdapter.stopTimerInformation() + CallAdapter.stopTimerInformation(); } onOpened: { - AvAdapter.resetRendererInfo() - CallAdapter.resetCallInfo() - CallAdapter.setCallInfo() - AvAdapter.setRendererInfo() + AvAdapter.resetRendererInfo(); + CallAdapter.resetCallInfo(); + CallAdapter.setCallInfo(); + AvAdapter.setRendererInfo(); } background: Rectangle { @@ -77,12 +75,12 @@ Popup { toolTipText: JamiStrings.close onClicked: { - root.close() + root.close(); } } RowLayout { - id: windowContent + id: windowContent ColumnLayout { spacing: JamiTheme.callInformationBlockSpacing @@ -90,7 +88,7 @@ Popup { Layout.preferredWidth: callInfoListview.width Layout.alignment: Qt.AlignTop - Text{ + Text { id: textTest color: JamiTheme.callInfoColor text: JamiStrings.callInformation @@ -118,8 +116,8 @@ Popup { } Text { - function stringWithoutRing(peerNumber){ - return peerNumber.replace("@ring.dht","") ; + function stringWithoutRing(peerNumber) { + return peerNumber.replace("@ring.dht", ""); } color: JamiTheme.callInfoColor text: JamiStrings.peerNumber + ": " + stringWithoutRing(PEER_NUMBER) @@ -149,7 +147,7 @@ Popup { Layout.preferredHeight: 20 imageColor: JamiTheme.callInfoColor onClicked: { - socketLayout.showAll = !socketLayout.showAll + socketLayout.showAll = !socketLayout.showAll; } } } @@ -223,7 +221,7 @@ Popup { delegate: Column { spacing: JamiTheme.callInformationElementsSpacing - Text{ + Text { color: JamiTheme.callInfoColor text: JamiStrings.rendererId + ": " + RENDERER_ID font.pointSize: JamiTheme.textFontPointSize diff --git a/src/app/mainview/components/CallOverlay.qml b/src/app/mainview/components/CallOverlay.qml index a5fcff6c62bd273d62c7ec98c58d5756f9e36528..8e3c295367113bc5c8ffbb7957b2015a91ec4b38 100644 --- a/src/app/mainview/components/CallOverlay.qml +++ b/src/app/mainview/components/CallOverlay.qml @@ -17,19 +17,15 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 import net.jami.Enums 1.1 - import "../js/contactpickercreation.js" as ContactPickerCreation import "../js/selectscreenwindowcreation.js" as SelectScreenWindowCreation import "../js/screenrubberbandcreation.js" as ScreenRubberBandCreation import "../js/pluginhandlerpickercreation.js" as PluginHandlerPickerCreation - import "../../commoncomponents" Item { @@ -43,34 +39,29 @@ Item { signal swarmDetailsClicked function closeContextMenuAndRelatedWindows() { - sipInputPanel.close() - ScreenRubberBandCreation.destroyScreenRubberBandWindow() - PluginHandlerPickerCreation.closePluginHandlerPicker() - root.closeClicked() - callInformationOverlay.close() + sipInputPanel.close(); + ScreenRubberBandCreation.destroyScreenRubberBandWindow(); + PluginHandlerPickerCreation.closePluginHandlerPicker(); + root.closeClicked(); + callInformationOverlay.close(); } // x, y position does not need to be translated // since they all fill the call page - function openCallViewContextMenuInPos(x, y, - hoveredOverlayUri, - hoveredOverlaySinkId, - hoveredOverVideoMuted, - isOnLocal) - { - callViewContextMenu.x = root.width - x >= callViewContextMenu.width ? x : root.width - callViewContextMenu.width - callViewContextMenu.y = root.height - y >= callViewContextMenu.height ? y : root.height - callViewContextMenu.height - callViewContextMenu.hoveredOverlayUri = hoveredOverlayUri - callViewContextMenu.hoveredOverlaySinkId = hoveredOverlaySinkId - callViewContextMenu.hoveredOverVideoMuted = hoveredOverVideoMuted - callViewContextMenu.isOnLocal = isOnLocal - callViewContextMenu.open() + function openCallViewContextMenuInPos(x, y, hoveredOverlayUri, hoveredOverlaySinkId, hoveredOverVideoMuted, isOnLocal) { + callViewContextMenu.x = root.width - x >= callViewContextMenu.width ? x : root.width - callViewContextMenu.width; + callViewContextMenu.y = root.height - y >= callViewContextMenu.height ? y : root.height - callViewContextMenu.height; + callViewContextMenu.hoveredOverlayUri = hoveredOverlayUri; + callViewContextMenu.hoveredOverlaySinkId = hoveredOverlaySinkId; + callViewContextMenu.hoveredOverVideoMuted = hoveredOverVideoMuted; + callViewContextMenu.isOnLocal = isOnLocal; + callViewContextMenu.open(); } DropArea { anchors.fill: parent - onDropped: function(drop) { - AvAdapter.shareFile(drop.urls) + onDropped: function (drop) { + AvAdapter.shareFile(drop.urls); } } @@ -94,16 +85,13 @@ Item { } function openShareFileDialog() { - var dlg = viewCoordinator.presentDialog( - appWindow, - "commoncomponents/JamiFileDialog.qml", - { - fileMode: JamiFileDialog.OpenFile, - nameFilters: [JamiStrings.allFiles] - }) - dlg.fileAccepted.connect(function(file) { - AvAdapter.shareFile(file) - }) + var dlg = viewCoordinator.presentDialog(appWindow, "commoncomponents/JamiFileDialog.qml", { + "fileMode": JamiFileDialog.OpenFile, + "nameFilters": [JamiStrings.allFiles] + }); + dlg.fileAccepted.connect(function (file) { + AvAdapter.shareFile(file); + }); } ResponsiveImage { @@ -121,38 +109,36 @@ Item { } function openContactPicker(type) { - ContactPickerCreation.presentContactPickerPopup(type, root) + ContactPickerCreation.presentContactPickerPopup(type, root); } function openShareScreen() { if (Qt.application.screens.length === 1) { - AvAdapter.shareEntireScreen(0) + AvAdapter.shareEntireScreen(0); } else { - SelectScreenWindowCreation.presentSelectScreenWindow( - appWindow, false) + SelectScreenWindowCreation.presentSelectScreenWindow(appWindow, false); } } function openShareWindow() { - AvAdapter.getListWindows() + AvAdapter.getListWindows(); if (AvAdapter.windowsNames.length >= 1) { - SelectScreenWindowCreation.presentSelectScreenWindow( - appWindow, true) + SelectScreenWindowCreation.presentSelectScreenWindow(appWindow, true); } } function openShareScreenArea() { if (Qt.platform.os !== "windows") { - AvAdapter.shareScreenArea(0, 0, 0, 0) + AvAdapter.shareScreenArea(0, 0, 0, 0); } else { - ScreenRubberBandCreation.createScreenRubberBandWindowObject() - ScreenRubberBandCreation.showScreenRubberBandWindow() + ScreenRubberBandCreation.createScreenRubberBandWindowObject(); + ScreenRubberBandCreation.showScreenRubberBandWindow(); } } function openPluginsMenu() { - PluginHandlerPickerCreation.createPluginHandlerPickerObjects(root, true) - PluginHandlerPickerCreation.openPluginHandlerPicker() + PluginHandlerPickerCreation.createPluginHandlerPickerObjects(root, true); + PluginHandlerPickerCreation.openPluginHandlerPicker(); } MainOverlay { @@ -162,20 +148,48 @@ Item { Connections { target: mainOverlay.callActionBar - function onChatClicked() { root.chatButtonClicked() } - function onAddToConferenceClicked() { openContactPicker(ContactList.CONFERENCE) } - function onTransferClicked() { openContactPicker(ContactList.TRANSFER) } - function onResumePauseCallClicked() { CallAdapter.holdThisCallToggle() } - function onShowInputPanelClicked() { sipInputPanel.open() } - function onShareScreenClicked() { openShareScreen() } - function onShareWindowClicked() { openShareWindow() } - function onStopSharingClicked() { AvAdapter.stopSharing(CurrentCall.sharingSource) } - function onShareScreenAreaClicked() { openShareScreenArea() } - function onRecordCallClicked() { CallAdapter.recordThisCallToggle() } - function onShareFileClicked() { openShareFileDialog() } - function onPluginsClicked() { openPluginsMenu() } - function onFullScreenClicked() { root.fullScreenClicked() } - function onSwarmDetailsClicked() { root.swarmDetailsClicked() } + function onChatClicked() { + root.chatButtonClicked(); + } + function onAddToConferenceClicked() { + openContactPicker(ContactList.CONFERENCE); + } + function onTransferClicked() { + openContactPicker(ContactList.TRANSFER); + } + function onResumePauseCallClicked() { + CallAdapter.holdThisCallToggle(); + } + function onShowInputPanelClicked() { + sipInputPanel.open(); + } + function onShareScreenClicked() { + openShareScreen(); + } + function onShareWindowClicked() { + openShareWindow(); + } + function onStopSharingClicked() { + AvAdapter.stopSharing(CurrentCall.sharingSource); + } + function onShareScreenAreaClicked() { + openShareScreenArea(); + } + function onRecordCallClicked() { + CallAdapter.recordThisCallToggle(); + } + function onShareFileClicked() { + openShareFileDialog(); + } + function onPluginsClicked() { + openPluginsMenu(); + } + function onFullScreenClicked() { + root.fullScreenClicked(); + } + function onSwarmDetailsClicked() { + root.swarmDetailsClicked(); + } } } @@ -186,10 +200,10 @@ Item { toastManager.instantiateToast(); } onScreenshotButtonHoveredChanged: { - participantsLayer.screenshotButtonHovered = screenshotButtonHovered + participantsLayer.screenshotButtonHovered = screenshotButtonHovered; } } onVisibleChanged: { - callViewContextMenu.close() + callViewContextMenu.close(); } } diff --git a/src/app/mainview/components/CallStackView.qml b/src/app/mainview/components/CallStackView.qml index f867989c3f32122c7b17be322579017fc11c2fbc..fd38f5fe1b5d06a0ee6710d8e2fe8641105019a7 100644 --- a/src/app/mainview/components/CallStackView.qml +++ b/src/app/mainview/components/CallStackView.qml @@ -15,15 +15,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" Item { @@ -32,12 +29,7 @@ Item { property alias chatViewContainer: ongoingCallPage.chatViewContainer property alias contentView: callStackMainView - property var sipKeys: [ - "1", "2", "3", "A", - "4", "5", "6", "B", - "7", "8", "9", "C", - "*", "0", "#", "D" - ] + property var sipKeys: ["1", "2", "3", "A", "4", "5", "6", "B", "7", "8", "9", "C", "*", "0", "#", "D"] Shortcut { sequence: "Ctrl+D" @@ -48,32 +40,27 @@ Item { Keys.onPressed: { if (LRCInstance.currentAccountType !== Profile.Type.SIP) - return - var key = event.text.toUpperCase() - if(sipKeys.find(function (item) { - return item === key - })) { - CallAdapter.sipInputPanelPlayDTMF(key) + return; + var key = event.text.toUpperCase(); + if (sipKeys.find(function (item) { + return item === key; + })) { + CallAdapter.sipInputPanelPlayDTMF(key); } } // TODO: this should all be done by listening to // parent visibility change or parent `Component.onDestruction` function needToCloseInCallConversationAndPotentialWindow() { - ongoingCallPage.closeInCallConversation() - ongoingCallPage.closeContextMenuAndRelatedWindows() + ongoingCallPage.closeInCallConversation(); + ongoingCallPage.closeContextMenuAndRelatedWindows(); } function toggleFullScreen() { if (!layoutManager.isCallFullscreen) { - layoutManager.pushFullScreenItem( - callStackMainView.currentItem, - callStackMainView, - null, - null) + layoutManager.pushFullScreenItem(callStackMainView.currentItem, callStackMainView, null, null); } else { - layoutManager.removeFullScreenItem( - callStackMainView.currentItem) + layoutManager.removeFullScreenItem(callStackMainView.currentItem); } } @@ -89,17 +76,20 @@ Item { case Call.Status.IN_PROGRESS: case Call.Status.CONNECTED: case Call.Status.PAUSED: - return 1 + return 1; case Call.Status.SEARCHING: case Call.Status.CONNECTING: case Call.Status.INCOMING_RINGING: case Call.Status.OUTGOING_RINGING: default: - return 0 + return 0; } } - InitialCallPage {} - OngoingCallPage { id: ongoingCallPage } + InitialCallPage { + } + OngoingCallPage { + id: ongoingCallPage + } } } diff --git a/src/app/mainview/components/CallViewContextMenu.qml b/src/app/mainview/components/CallViewContextMenu.qml index cb539f3c1efd91fcaac081bf1d138d59a42fdb0d..eab0b9a11accd023a706922c091a9da022d07c98 100644 --- a/src/app/mainview/components/CallViewContextMenu.qml +++ b/src/app/mainview/components/CallViewContextMenu.qml @@ -17,16 +17,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Adapters 1.1 import net.jami.Constants 1.1 import net.jami.Models 1.1 import net.jami.Enums 1.1 - import "../../commoncomponents" import "../../commoncomponents/contextmenu" import "../js/screenrubberbandcreation.js" as ScreenRubberBandCreation @@ -47,26 +44,36 @@ Popup { } onAboutToShow: { - actionsModel.clear() - actionsModel.append({"Top": true}) + actionsModel.clear(); + actionsModel.append({ + "Top": true + }); if (root.isOnLocal) - actionsModel.append({"Name": JamiStrings.mirrorLocalVideo, - "IconSource": JamiResources.flip_24dp_svg}) + actionsModel.append({ + "Name": JamiStrings.mirrorLocalVideo, + "IconSource": JamiResources.flip_24dp_svg + }); if (hoveredOverlayUri !== "" && hoveredOverVideoMuted === false) - actionsModel.append({"Name": JamiStrings.tileScreenshot, - "IconSource" : JamiResources.screenshot_black_24dp_svg}) - actionsModel.append({"Name": JamiStrings.advancedInformation, - "IconSource": JamiResources.informations_black_24dp_svg}) - actionsModel.append({"Bottom": true}) - itemListView.implicitHeight = 20 + 45 * (actionsModel.count - 2) + actionsModel.append({ + "Name": JamiStrings.tileScreenshot, + "IconSource": JamiResources.screenshot_black_24dp_svg + }); + actionsModel.append({ + "Name": JamiStrings.advancedInformation, + "IconSource": JamiResources.informations_black_24dp_svg + }); + actionsModel.append({ + "Bottom": true + }); + itemListView.implicitHeight = 20 + 45 * (actionsModel.count - 2); } onAboutToHide: { - screenshotButtonHovered = false - hoveredOverlayUri = "" - hoveredOverlaySinkId = "" - hoveredOverVideoMuted = true - actionsModel.clear() + screenshotButtonHovered = false; + hoveredOverlayUri = ""; + hoveredOverlaySinkId = ""; + hoveredOverVideoMuted = true; + actionsModel.clear(); } background: Rectangle { @@ -126,28 +133,27 @@ Popup { } onClicked: { - switch(Name) { - case JamiStrings.advancedInformation: - CallAdapter.startTimerInformation() - callInformationOverlay.open() - break - case JamiStrings.tileScreenshot: - if (CallAdapter.takeScreenshot(videoProvider.captureRawVideoFrame(hoveredOverlaySinkId), - UtilsAdapter.getDirScreenshot())) { - screenshotTaken() - } - break - case JamiStrings.mirrorLocalVideo: - UtilsAdapter.setAppValue(Settings.FlipSelf, !UtilsAdapter.getAppValue(Settings.FlipSelf)) - CurrentCall.flipSelf = UtilsAdapter.getAppValue(Settings.FlipSelf) - break + switch (Name) { + case JamiStrings.advancedInformation: + CallAdapter.startTimerInformation(); + callInformationOverlay.open(); + break; + case JamiStrings.tileScreenshot: + if (CallAdapter.takeScreenshot(videoProvider.captureRawVideoFrame(hoveredOverlaySinkId), UtilsAdapter.getDirScreenshot())) { + screenshotTaken(); + } + break; + case JamiStrings.mirrorLocalVideo: + UtilsAdapter.setAppValue(Settings.FlipSelf, !UtilsAdapter.getAppValue(Settings.FlipSelf)); + CurrentCall.flipSelf = UtilsAdapter.getAppValue(Settings.FlipSelf); + break; } - root.close() + root.close(); } onHoveredChanged: { if (Name === JamiStrings.tileScreenshot) { - screenshotButtonHovered = hovered + screenshotButtonHovered = hovered; } } } diff --git a/src/app/mainview/components/ChatView.qml b/src/app/mainview/components/ChatView.qml index 5d9b17533e6f00d0a9fd1506fa806a8a0b626716..6873132b50f8668484acfac4c9c3c6925f5b4b82 100644 --- a/src/app/mainview/components/ChatView.qml +++ b/src/app/mainview/components/ChatView.qml @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2020-2023 Savoir-faire Linux Inc. * * This program is free software; you can redistribute it and/or modify @@ -14,16 +14,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 import net.jami.Enums 1.1 - import "../../commoncomponents" import "../js/pluginhandlerpickercreation.js" as PluginHandlerPickerCreation @@ -46,19 +43,21 @@ Rectangle { signal dismiss function focusChatView() { - chatViewFooter.updateMessageDraft() - chatViewFooter.textInput.forceActiveFocus() + chatViewFooter.updateMessageDraft(); + chatViewFooter.textInput.forceActiveFocus(); } function resetPanels() { - chatViewHeader.showSearch = true + chatViewHeader.showSearch = true; } function instanceMapObject() { if (WITH_WEBENGINE) { var component = Qt.createComponent("qrc:/webengine/map/MapPosition.qml"); - var sprite = component.createObject(root, {maxWidth: root.width, maxHeight: root.height}); - + var sprite = component.createObject(root, { + "maxWidth": root.width, + "maxHeight": root.height + }); if (sprite === null) { // Error Handling console.log("Error creating object"); @@ -69,15 +68,15 @@ Rectangle { Connections { target: PositionManager function onOpenNewMap() { - instanceMapObject() + instanceMapObject(); } } Connections { target: CurrentConversation function onIdChanged() { - extrasPanel.restoreState() - MessagesAdapter.loadMoreMessages() + extrasPanel.restoreState(); + MessagesAdapter.loadMoreMessages(); } } @@ -85,14 +84,13 @@ Rectangle { onVisibleChanged: { if (visible) { - chatViewSplitView.resolvePanes(true) - + chatViewSplitView.resolvePanes(true); if (root.parent.objectName === "CallViewChatViewContainer") { - chatViewHeader.showSearch = !root.parent.showDetails + chatViewHeader.showSearch = !root.parent.showDetails; if (root.parent.showDetails) { - extrasPanel.switchToPanel(ChatView.SwarmDetailsPanel) + extrasPanel.switchToPanel(ChatView.SwarmDetailsPanel); } else { - extrasPanel.closePanel() + extrasPanel.closePanel(); } } } @@ -126,19 +124,15 @@ Rectangle { target: CurrentConversation function onNeedsHost() { - viewCoordinator.presentDialog( - appWindow, - "mainview/components/HostPopup.qml") + viewCoordinator.presentDialog(appWindow, "mainview/components/HostPopup.qml"); } } onPluginSelector: { // Create plugin handler picker - PLUGINS - PluginHandlerPickerCreation.createPluginHandlerPickerObjects( - root, false) - PluginHandlerPickerCreation.calculateCurrentGeo(root.width / 2, - root.height / 2) - PluginHandlerPickerCreation.openPluginHandlerPicker() + PluginHandlerPickerCreation.createPluginHandlerPickerObjects(root, false); + PluginHandlerPickerCreation.calculateCurrentGeo(root.width / 2, root.height / 2); + PluginHandlerPickerCreation.openPluginHandlerPicker(); } } @@ -148,19 +142,19 @@ Rectangle { function onActiveCallsChanged() { if (CurrentConversation.activeCalls.length > 0) { - notificationArea.id = CurrentConversation.activeCalls[0]["id"] - notificationArea.uri = CurrentConversation.activeCalls[0]["uri"] - notificationArea.device = CurrentConversation.activeCalls[0]["device"] + notificationArea.id = CurrentConversation.activeCalls[0]["id"]; + notificationArea.uri = CurrentConversation.activeCalls[0]["uri"]; + notificationArea.device = CurrentConversation.activeCalls[0]["device"]; } - notificationArea.visible = CurrentConversation.activeCalls.length > 0 && !root.inCallView + notificationArea.visible = CurrentConversation.activeCalls.length > 0 && !root.inCallView; } function onErrorsChanged() { if (CurrentConversation.errors.length > 0) { - errorRect.errorLabel.text = CurrentConversation.errors[0] - errorRect.backendErrorToolTip.text = JamiStrings.backendError.arg(CurrentConversation.backendErrors[0]) + errorRect.errorLabel.text = CurrentConversation.errors[0]; + errorRect.backendErrorToolTip.text = JamiStrings.backendError.arg(CurrentConversation.backendErrors[0]); } - errorRect.visible = CurrentConversation.errors.length > 0 // If too much noise: && LRCInstance.debugMode() + errorRect.visible = CurrentConversation.errors.length > 0; // If too much noise: && LRCInstance.debugMode() } } @@ -170,10 +164,10 @@ Rectangle { function onErrorsChanged() { if (CurrentConversation.errors.length > 0) { - errorRect.errorLabel.text = CurrentConversation.errors[0] - errorRect.backendErrorToolTip.text = JamiStrings.backendError.arg(CurrentConversation.backendErrors[0]) + errorRect.errorLabel.text = CurrentConversation.errors[0]; + errorRect.backendErrorToolTip.text = JamiStrings.backendError.arg(CurrentConversation.backendErrors[0]); } - errorRect.visible = CurrentConversation.errors.length > 0 + errorRect.visible = CurrentConversation.errors.length > 0; } } @@ -214,33 +208,37 @@ Rectangle { // called when the width of the SplitView changes, when the SplitView is shown, // and when the details panel is shown. When called with force=true, it is being // called from a visibleChanged event, and we should not update the previous widths. - function resolvePanes(force=false) { + function resolvePanes(force = false) { // If the details panel is not visible, then show the chatContents. if (!extrasPanel.visible) { - chatContents.visible = true - return + chatContents.visible = true; + return; } // Next we compute whether the SplitView is expanding or shrinking. - const isExpanding = width > previousWidth + const isExpanding = width > previousWidth; // If the SplitView is not wide enough to show both the chatContents // and the details panel, then hide the chatContents. - if (width < JamiTheme.mainViewPaneMinWidth + extrasPanel.width - && (!isExpanding || force) && chatContents.visible) { - if (!force) previousDetailsWidth = extrasPanel.width - chatContents.visible = false - } else if (width >= JamiTheme.mainViewPaneMinWidth + previousDetailsWidth - && (isExpanding || force) && !chatContents.visible) { - chatContents.visible = true + if (width < JamiTheme.mainViewPaneMinWidth + extrasPanel.width && (!isExpanding || force) && chatContents.visible) { + if (!force) + previousDetailsWidth = extrasPanel.width; + chatContents.visible = false; + } else if (width >= JamiTheme.mainViewPaneMinWidth + previousDetailsWidth && (isExpanding || force) && !chatContents.visible) { + chatContents.visible = true; } - if (!force) previousWidth = width + if (!force) + previousWidth = width; } Connections { target: viewNode - function onPresented() { chatViewSplitView.restoreSplitViewState() } - function onDismissed() { chatViewSplitView.saveSplitViewState() } + function onPresented() { + chatViewSplitView.restoreSplitViewState(); + } + function onDismissed() { + chatViewSplitView.saveSplitViewState(); + } } ColumnLayout { @@ -260,16 +258,15 @@ Rectangle { Layout.leftMargin: JamiTheme.chatviewMargin Layout.rightMargin: JamiTheme.chatviewMargin - currentIndex: CurrentConversation.isRequest || - CurrentConversation.needsSyncing + currentIndex: CurrentConversation.isRequest || CurrentConversation.needsSyncing Loader { active: CurrentConversation.id !== "" sourceComponent: MessageListView { DropArea { anchors.fill: parent - onDropped: function(drop) { - chatViewFooter.setFilePathsToSend(drop.urls) + onDropped: function (drop) { + chatViewFooter.setFilePathsToSend(drop.urls); } } } @@ -284,7 +281,7 @@ Rectangle { } UpdateToSwarm { - visible: !CurrentConversation.isSwarm && !CurrentConversation.isTemporary && CurrentAccount.type === Profile.Type.JAMI + visible: !CurrentConversation.isSwarm && !CurrentConversation.isTemporary && CurrentAccount.type === Profile.Type.JAMI Layout.fillWidth: true } @@ -292,15 +289,15 @@ Rectangle { id: chatViewFooter visible: { - if (CurrentAccount.type === Profile.Type.SIP) - return true + if (CurrentAccount.type === Profile.Type.SIP) + return true; if (CurrentConversation.isBanned) - return false + return false; else if (CurrentConversation.needsSyncing) - return false + return false; else if (CurrentConversation.isSwarm && CurrentConversation.isRequest) - return false - return CurrentConversation.isSwarm || CurrentConversation.isTemporary + return false; + return CurrentConversation.isSwarm || CurrentConversation.isTemporary; } Layout.alignment: Qt.AlignHCenter @@ -315,7 +312,8 @@ Rectangle { } } - onResizingChanged: if (chatContents.visible) extrasPanel.previousWidth = extrasPanel.width + onResizingChanged: if (chatContents.visible) + extrasPanel.previousWidth = extrasPanel.width ConversationExtrasPanel { id: extrasPanel diff --git a/src/app/mainview/components/ChatViewFooter.qml b/src/app/mainview/components/ChatViewFooter.qml index 650b230fd12af4445b022abbb0c280a0c3a9c928..aa892727ff3a52c66792fcf260fa5b9622c30e8b 100644 --- a/src/app/mainview/components/ChatViewFooter.qml +++ b/src/app/mainview/components/ChatViewFooter.qml @@ -15,15 +15,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts import QtQuick.Controls - import net.jami.Models 1.1 import net.jami.Constants 1.1 import net.jami.Adapters 1.1 - import "../../commoncomponents" Rectangle { @@ -35,8 +32,8 @@ Rectangle { function setFilePathsToSend(filePaths) { for (var index = 0; index < filePaths.length; ++index) { - var path = UtilsAdapter.getAbsPath(decodeURIComponent(filePaths[index])) - dataTransferSendContainer.filesToSendListModel.addToPending(path) + var path = UtilsAdapter.getAbsPath(decodeURIComponent(filePaths[index])); + dataTransferSendContainer.filesToSendListModel.addToPending(path); } } @@ -45,53 +42,49 @@ Rectangle { color: JamiTheme.primaryBackgroundColor function updateMessageDraft() { - LRCInstance.setContentDraft(previousConvId, - previousAccountId, - messageBar.text); - - previousConvId = CurrentConversation.id - previousAccountId = CurrentAccount.id + LRCInstance.setContentDraft(previousConvId, previousAccountId, messageBar.text); + previousConvId = CurrentConversation.id; + previousAccountId = CurrentAccount.id; // turn off the button animations when switching convs - messageBar.animate = false - messageBar.textAreaObj.clearText() - - var restoredContent = LRCInstance.getContentDraft(CurrentConversation.id, - CurrentAccount.id); + messageBar.animate = false; + messageBar.textAreaObj.clearText(); + var restoredContent = LRCInstance.getContentDraft(CurrentConversation.id, CurrentAccount.id); if (restoredContent) { - messageBar.textAreaObj.insertText(restoredContent) + messageBar.textAreaObj.insertText(restoredContent); } } Connections { target: CurrentConversation - function onIdChanged() { messageBar.animate = true } + function onIdChanged() { + messageBar.animate = true; + } } Connections { target: MessagesAdapter function onNewFilePasted(filePath) { - dataTransferSendContainer.filesToSendListModel.addToPending(filePath) + dataTransferSendContainer.filesToSendListModel.addToPending(filePath); } function onNewTextPasted() { - messageBar.textAreaObj.pasteText() + messageBar.textAreaObj.pasteText(); } function onEditIdChanged() { if (MessagesAdapter.editId.length > 0) { - var editedMessageBody = MessagesAdapter.dataForInteraction(MessagesAdapter.editId, MessageList.Body) - messageBar.textAreaObj.insertText(editedMessageBody) - messageBar.textAreaObj.forceActiveFocus() - + var editedMessageBody = MessagesAdapter.dataForInteraction(MessagesAdapter.editId, MessageList.Body); + messageBar.textAreaObj.insertText(editedMessageBody); + messageBar.textAreaObj.forceActiveFocus(); } } function onReplyToIdChanged() { if (MessagesAdapter.replyToId.length > 0) - messageBar.textAreaObj.forceActiveFocus() + messageBar.textAreaObj.forceActiveFocus(); } } @@ -143,116 +136,100 @@ Rectangle { Connections { target: messageBar.emojiPicker ? messageBar.emojiPicker : null function onEmojiIsPicked(content) { - messageBar.textAreaObj.insertText(content) + messageBar.textAreaObj.insertText(content); } } function openEmojiPicker() { - var component = WITH_WEBENGINE - ? Qt.createComponent("qrc:/webengine/emojipicker/EmojiPicker.qml") - : Qt.createComponent("qrc:/nowebengine/EmojiPicker.qml") - messageBar.emojiPicker = - component.createObject(messageBar, { - x: setXposition(), - y: setYposition(), - listView: null - }); + var component = WITH_WEBENGINE ? Qt.createComponent("qrc:/webengine/emojipicker/EmojiPicker.qml") : Qt.createComponent("qrc:/nowebengine/EmojiPicker.qml"); + messageBar.emojiPicker = component.createObject(messageBar, { + "x": setXposition(), + "y": setYposition(), + "listView": null + }); if (messageBar.emojiPicker === null) { console.log("Error creating emojiPicker in chatViewFooter"); } } onWidthChanged: { if (emojiPicker) - emojiPicker.x = setXposition() + emojiPicker.x = setXposition(); } - function setXposition(){ - return messageBar.width - JamiTheme.emojiPickerWidth //- JamiTheme.emojiMargins + function setXposition() { + return messageBar.width - JamiTheme.emojiPickerWidth; //- JamiTheme.emojiMargins } function setYposition() { - return - JamiTheme.emojiPickerHeight //- JamiTheme.emojiMargins + return -JamiTheme.emojiPickerHeight; //- JamiTheme.emojiMargins } - sendButtonVisibility: text || - dataTransferSendContainer.filesToSendCount + sendButtonVisibility: text || dataTransferSendContainer.filesToSendCount onEmojiButtonClicked: { - JamiQmlUtils.updateMessageBarButtonsPoints() - openEmojiPicker() + JamiQmlUtils.updateMessageBarButtonsPoints(); + openEmojiPicker(); } onShowMapClicked: { - PositionManager.setMapActive(CurrentAccount.id) + PositionManager.setMapActive(CurrentAccount.id); } onSendFileButtonClicked: { - var dlg = viewCoordinator.presentDialog( - appWindow, - "commoncomponents/JamiFileDialog.qml", - { - fileMode: JamiFileDialog.OpenFiles, - nameFilters: [JamiStrings.allFiles] - }) - dlg.filesAccepted.connect(function(files) { - setFilePathsToSend(files) - }) + var dlg = viewCoordinator.presentDialog(appWindow, "commoncomponents/JamiFileDialog.qml", { + "fileMode": JamiFileDialog.OpenFiles, + "nameFilters": [JamiStrings.allFiles] + }); + dlg.filesAccepted.connect(function (files) { + setFilePathsToSend(files); + }); } onSendMessageButtonClicked: { // Send file messages - var fileCounts = dataTransferSendContainer.filesToSendListModel.rowCount() + var fileCounts = dataTransferSendContainer.filesToSendListModel.rowCount(); for (var i = 0; i < fileCounts; i++) { - var currentIndex = dataTransferSendContainer.filesToSendListModel.index(i, 0) - var filePath = dataTransferSendContainer.filesToSendListModel.data( - currentIndex, FilesToSend.FilePath) - MessagesAdapter.sendFile(filePath) + var currentIndex = dataTransferSendContainer.filesToSendListModel.index(i, 0); + var filePath = dataTransferSendContainer.filesToSendListModel.data(currentIndex, FilesToSend.FilePath); + MessagesAdapter.sendFile(filePath); } - dataTransferSendContainer.filesToSendListModel.flush() + dataTransferSendContainer.filesToSendListModel.flush(); // Send text message if (messageBar.text) { if (MessagesAdapter.editId !== "") { - MessagesAdapter.editMessage(CurrentConversation.id, messageBar.text) + MessagesAdapter.editMessage(CurrentConversation.id, messageBar.text); } else { - MessagesAdapter.sendMessage(messageBar.text) + MessagesAdapter.sendMessage(messageBar.text); } } - messageBar.textAreaObj.clearText() - MessagesAdapter.replyToId = "" + messageBar.textAreaObj.clearText(); + MessagesAdapter.replyToId = ""; } onVideoRecordMessageButtonClicked: { - JamiQmlUtils.updateMessageBarButtonsPoints() - - recordBox.parent = JamiQmlUtils.mainViewRectObj - - recordBox.x = Qt.binding(function() { - var buttonCenterX = JamiQmlUtils.videoRecordMessageButtonInMainViewPoint.x + - JamiQmlUtils.videoRecordMessageButtonObj.width / 2 - return buttonCenterX - recordBox.width / 2 - }) - recordBox.y = Qt.binding(function() { - var buttonY = JamiQmlUtils.videoRecordMessageButtonInMainViewPoint.y - return buttonY - recordBox.height - recordBox.spikeHeight - }) - - recordBox.openRecorder(true) + JamiQmlUtils.updateMessageBarButtonsPoints(); + recordBox.parent = JamiQmlUtils.mainViewRectObj; + recordBox.x = Qt.binding(function () { + var buttonCenterX = JamiQmlUtils.videoRecordMessageButtonInMainViewPoint.x + JamiQmlUtils.videoRecordMessageButtonObj.width / 2; + return buttonCenterX - recordBox.width / 2; + }); + recordBox.y = Qt.binding(function () { + var buttonY = JamiQmlUtils.videoRecordMessageButtonInMainViewPoint.y; + return buttonY - recordBox.height - recordBox.spikeHeight; + }); + recordBox.openRecorder(true); } onAudioRecordMessageButtonClicked: { - JamiQmlUtils.updateMessageBarButtonsPoints() - - recordBox.parent = JamiQmlUtils.mainViewRectObj - - recordBox.x = Qt.binding(function() { - var buttonCenterX = JamiQmlUtils.audioRecordMessageButtonInMainViewPoint.x + - JamiQmlUtils.audioRecordMessageButtonObj.width / 2 - return buttonCenterX - recordBox.width / 2 - }) - recordBox.y = Qt.binding(function() { - var buttonY = JamiQmlUtils.audioRecordMessageButtonInMainViewPoint.y - return buttonY - recordBox.height - recordBox.spikeHeight - }) - - recordBox.openRecorder(false) + JamiQmlUtils.updateMessageBarButtonsPoints(); + recordBox.parent = JamiQmlUtils.mainViewRectObj; + recordBox.x = Qt.binding(function () { + var buttonCenterX = JamiQmlUtils.audioRecordMessageButtonInMainViewPoint.x + JamiQmlUtils.audioRecordMessageButtonObj.width / 2; + return buttonCenterX - recordBox.width / 2; + }); + recordBox.y = Qt.binding(function () { + var buttonY = JamiQmlUtils.audioRecordMessageButtonInMainViewPoint.y; + return buttonY - recordBox.height - recordBox.spikeHeight; + }); + recordBox.openRecorder(false); } } @@ -264,8 +241,7 @@ Rectangle { Layout.alignment: Qt.AlignHCenter Layout.preferredWidth: footerColumnLayout.width Layout.maximumWidth: JamiTheme.chatViewMaximumWidth - Layout.preferredHeight: filesToSendCount ? - JamiTheme.filesToSendDelegateHeight : 0 + Layout.preferredHeight: filesToSendCount ? JamiTheme.filesToSendDelegateHeight : 0 } } } diff --git a/src/app/mainview/components/ChatViewHeader.qml b/src/app/mainview/components/ChatViewHeader.qml index b95fb641744bdbb266a1f328e0ec8b5b97726cf1..36e84eab6d95a4b876451249ba573e29fa1b7cdf 100644 --- a/src/app/mainview/components/ChatViewHeader.qml +++ b/src/app/mainview/components/ChatViewHeader.qml @@ -16,16 +16,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts import QtQuick.Controls - import net.jami.Adapters 1.1 import net.jami.Constants 1.1 import net.jami.Enums 1.1 import net.jami.Models 1.1 - import "../../commoncomponents" Rectangle { @@ -42,29 +39,35 @@ Rectangle { Connections { target: CurrentConversation enabled: true - function onTitleChanged() { title.eText = CurrentConversation.title } - function onDescriptionChanged() { description.eText = CurrentConversation.description } - function onShowSwarmDetails() { root.showDetailsClicked() } + function onTitleChanged() { + title.eText = CurrentConversation.title; + } + function onDescriptionChanged() { + description.eText = CurrentConversation.description; + } + function onShowSwarmDetails() { + root.showDetailsClicked(); + } } property bool interactionButtonsVisibility: { if (CurrentConversation.inCall) - return false + return false; if (LRCInstance.currentAccountType === Profile.Type.SIP) - return true + return true; if (!CurrentConversation.isTemporary && !CurrentConversation.isSwarm) - return false + return false; if (CurrentConversation.isRequest || CurrentConversation.needsSyncing) - return false - return true + return false; + return true; } property bool addMemberVisibility: { - return swarmDetailsVisibility && !CurrentConversation.isCoreDialog && !CurrentConversation.isRequest + return swarmDetailsVisibility && !CurrentConversation.isCoreDialog && !CurrentConversation.isRequest; } property bool swarmDetailsVisibility: { - return CurrentConversation.isSwarm && !CurrentConversation.isRequest + return CurrentConversation.isSwarm && !CurrentConversation.isRequest; } color: JamiTheme.chatviewBgColor @@ -131,8 +134,7 @@ Rectangle { Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft - visible: text.length && - CurrentConversation.title !== CurrentConversation.description + visible: text.length && CurrentConversation.title !== CurrentConversation.description font.pointSize: JamiTheme.textFontSize color: JamiTheme.faddedLastInteractionFontColor @@ -164,7 +166,7 @@ Rectangle { context: Qt.ApplicationShortcut enabled: rowSearchBar.visible onActivated: { - rowSearchBar.openSearchBar() + rowSearchBar.openSearchBar(); } } } @@ -194,7 +196,7 @@ Rectangle { imageColor: JamiTheme.chatviewButtonColor onClicked: { - CallAdapter.placeCall() + CallAdapter.placeCall(); } } @@ -215,8 +217,7 @@ Rectangle { PushButton { id: selectPluginButton - visible: PluginAdapter.isEnabled && PluginAdapter.chatHandlersListCount && - interactionButtonsVisibility + visible: PluginAdapter.isEnabled && PluginAdapter.chatHandlersListCount && interactionButtonsVisibility source: JamiResources.plugins_24dp_svg toolTipText: JamiStrings.showPlugins @@ -238,16 +239,13 @@ Rectangle { normalColor: JamiTheme.chatviewBgColor imageColor: JamiTheme.chatviewButtonColor - onClicked: CurrentConversation.isBanned ? - MessagesAdapter.unbanConversation(CurrentConversation.id) - : MessagesAdapter.sendConversationRequest() + onClicked: CurrentConversation.isBanned ? MessagesAdapter.unbanConversation(CurrentConversation.id) : MessagesAdapter.sendConversationRequest() } PushButton { id: detailsButton - visible: interactionButtonsVisibility - && (swarmDetailsVisibility || LRCInstance.currentAccountType === Profile.Type.SIP) // TODO if SIP not a request + visible: interactionButtonsVisibility && (swarmDetailsVisibility || LRCInstance.currentAccountType === Profile.Type.SIP) // TODO if SIP not a request source: JamiResources.swarm_details_panel_svg toolTipText: JamiStrings.details diff --git a/src/app/mainview/components/ContactPicker.qml b/src/app/mainview/components/ContactPicker.qml index 1b058d6ae75e1fef8253ecf5ec42740a5fc53568..df0eecfcf52f982f85bf70dec63ae17f82db1c8b 100644 --- a/src/app/mainview/components/ContactPicker.qml +++ b/src/app/mainview/components/ContactPicker.qml @@ -15,15 +15,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Adapters 1.1 import net.jami.Models 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" Popup { @@ -54,7 +51,7 @@ Popup { source: JamiResources.round_close_24dp_svg onClicked: { - contactPickerPopup.close() + contactPickerPopup.close(); } } @@ -79,15 +76,15 @@ Popup { verticalAlignment: Text.AlignVCenter text: { - switch(type) { + switch (type) { case ContactList.CONFERENCE: - return JamiStrings.addToConference + return JamiStrings.addToConference; case ContactList.ADDCONVMEMBER: - return JamiStrings.addToConversation + return JamiStrings.addToConversation; case ContactList.TRANSFER: - return JamiStrings.transferThisCall + return JamiStrings.transferThisCall; default: - return JamiStrings.addDefaultModerator + return JamiStrings.addDefaultModerator; } } } @@ -103,7 +100,7 @@ Popup { placeHolderText: type === ContactList.TRANSFER ? JamiStrings.transferTo : JamiStrings.addParticipant onContactSearchBarTextChanged: { - ContactAdapter.setSearchFilter(text) + ContactAdapter.setSearchFilter(text); } } @@ -129,8 +126,7 @@ Popup { } onAboutToShow: { - contactPickerListView.model = - ContactAdapter.getContactSelectableModel(type) + contactPickerListView.model = ContactAdapter.getContactSelectableModel(type); } background: Rectangle { diff --git a/src/app/mainview/components/ContactPickerItemDelegate.qml b/src/app/mainview/components/ContactPickerItemDelegate.qml index a017b4f426bd52e177b437d3d229469a26906447..f6a83932cfd1e31cc43f4260cddf16f4c40a0192 100644 --- a/src/app/mainview/components/ContactPickerItemDelegate.qml +++ b/src/app/mainview/components/ContactPickerItemDelegate.qml @@ -15,24 +15,18 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls - import net.jami.Adapters 1.1 import net.jami.Models 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" ItemDelegate { id: root width: ListView.view.width - height: Math.max( - contactPickerContactName.height + textMetricsContactPickerContactId.height + 10, - avatar.height + 10 - ) + height: Math.max(contactPickerContactName.height + textMetricsContactPickerContactId.height + 10, avatar.height + 10) property var showPresenceIndicator: false @@ -124,25 +118,24 @@ ItemDelegate { acceptedButtons: Qt.LeftButton onPressed: { - itemSmartListBackground.color = JamiTheme.pressColor + itemSmartListBackground.color = JamiTheme.pressColor; } onReleased: { - itemSmartListBackground.color = JamiTheme.normalButtonColor - - ContactAdapter.contactSelected(index) - root.contactClicked() + itemSmartListBackground.color = JamiTheme.normalButtonColor; + ContactAdapter.contactSelected(index); + root.contactClicked(); // TODO remove from there if (contactPickerPopup) - contactPickerPopup.close() + contactPickerPopup.close(); } onEntered: { - itemSmartListBackground.color = JamiTheme.hoverColor + itemSmartListBackground.color = JamiTheme.hoverColor; } onExited: { - itemSmartListBackground.color = JamiTheme.backgroundColor + itemSmartListBackground.color = JamiTheme.backgroundColor; } } } diff --git a/src/app/mainview/components/ContactSearchBar.qml b/src/app/mainview/components/ContactSearchBar.qml index d416cf5ad0703d4ca5e7c68ffebb59bef5f701a6..40434e9699ba8740a69827671561b5cb7f0be425 100644 --- a/src/app/mainview/components/ContactSearchBar.qml +++ b/src/app/mainview/components/ContactSearchBar.qml @@ -15,13 +15,10 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls - import net.jami.Models 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" Rectangle { @@ -34,8 +31,8 @@ Rectangle { property alias placeHolderText: contactSearchBar.placeholderText function clearText() { - contactSearchBar.clear() - contactSearchBar.forceActiveFocus() + contactSearchBar.clear(); + contactSearchBar.forceActiveFocus(); } radius: JamiTheme.primaryRadius @@ -43,7 +40,7 @@ Rectangle { onFocusChanged: { if (focus) { - contactSearchBar.forceActiveFocus() + contactSearchBar.forceActiveFocus(); } } @@ -72,9 +69,7 @@ Rectangle { anchors.verticalCenter: root.verticalCenter anchors.left: searchIconImage.right - anchors.right: contactSearchBar.text.length ? - clearTextButton.left : - root.right + anchors.right: contactSearchBar.text.length ? clearTextButton.left : root.right height: root.height - 5 @@ -97,7 +92,7 @@ Rectangle { onTextChanged: root.contactSearchBarTextChanged(contactSearchBar.text) onReleased: function (event) { if (event.button === Qt.RightButton) - lineEditContextMenu.openMenuAt(event) + lineEditContextMenu.openMenuAt(event); } } @@ -122,17 +117,19 @@ Rectangle { onClicked: contactSearchBar.clear() - Behavior on opacity { - NumberAnimation { duration: 500; easing.type: Easing.OutCubic } + Behavior on opacity { + NumberAnimation { + duration: 500 + easing.type: Easing.OutCubic + } } } Keys.onPressed: function (keyEvent) { - if (keyEvent.key === Qt.Key_Enter || - keyEvent.key === Qt.Key_Return) { + if (keyEvent.key === Qt.Key_Enter || keyEvent.key === Qt.Key_Return) { if (contactSearchBar.text !== "") { - returnPressedWhileSearching() - keyEvent.accepted = true + returnPressedWhileSearching(); + keyEvent.accepted = true; } } } diff --git a/src/app/mainview/components/ConversationAvatar.qml b/src/app/mainview/components/ConversationAvatar.qml index e10d2a553b390ce2731f09e21574891d284971ac..bd6b99abcc4c3a3a3f584d9bd6aa2ebbe20c4c3d 100644 --- a/src/app/mainview/components/ConversationAvatar.qml +++ b/src/app/mainview/components/ConversationAvatar.qml @@ -15,12 +15,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls - import net.jami.Adapters 1.1 - import "../../commoncomponents" Item { @@ -40,9 +37,7 @@ Item { id: avatar anchors.fill: root - anchors.margins: animation.mode === SpinningAnimation.Mode.Disabled ? - 0 : - animation.spinningAnimationWidth + anchors.margins: animation.mode === SpinningAnimation.Mode.Disabled ? 0 : animation.spinningAnimationWidth mode: Avatar.Mode.Conversation } diff --git a/src/app/mainview/components/ConversationErrorsRow.qml b/src/app/mainview/components/ConversationErrorsRow.qml index 20956e9a85cb727ba7e7a8f691cec1eed6fee568..7707dfb70eb29e35bf54ad89650674263f8f9193 100644 --- a/src/app/mainview/components/ConversationErrorsRow.qml +++ b/src/app/mainview/components/ConversationErrorsRow.qml @@ -14,16 +14,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts import Qt5Compat.GraphicalEffects - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" Rectangle { @@ -37,10 +34,10 @@ Rectangle { function onErrorsChanged() { if (CurrentConversation.errors.length > 0) { - errorLabel.text = CurrentConversation.errors[0] - backendErrorToolTip.text = JamiStrings.backendError.arg(CurrentConversation.backendErrors[0]) + errorLabel.text = CurrentConversation.errors[0]; + backendErrorToolTip.text = JamiStrings.backendError.arg(CurrentConversation.backendErrors[0]); } - errorRect.visible = CurrentConversation.errors.length > 0 && LRCInstance.debugMode() + errorRect.visible = CurrentConversation.errors.length > 0 && LRCInstance.debugMode(); } } color: JamiTheme.filterBadgeColor @@ -73,7 +70,6 @@ Rectangle { } } - MaterialToolTip { id: backendErrorToolTip text: "" @@ -95,10 +91,10 @@ Rectangle { } } - Behavior on opacity { + Behavior on opacity { NumberAnimation { from: 0 duration: JamiTheme.shortFadeDuration } } -} \ No newline at end of file +} diff --git a/src/app/mainview/components/ConversationExtrasPanel.qml b/src/app/mainview/components/ConversationExtrasPanel.qml index f11580246d8c3ba569266999868599e0310fee1d..ba454db849eefd1073695264a7de3b9a197a28c0 100644 --- a/src/app/mainview/components/ConversationExtrasPanel.qml +++ b/src/app/mainview/components/ConversationExtrasPanel.qml @@ -14,10 +14,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts - import net.jami.Adapters 1.1 StackLayout { @@ -25,19 +23,22 @@ StackLayout { property int detailsIndex: -1 - function isOpen(panel) { return visible && currentIndex === panel } + function isOpen(panel) { + return visible && currentIndex === panel; + } visible: currentIndex > -1 property bool detailsShouldOpen: false - onVisibleChanged: if (visible) detailsShouldOpen = true + onVisibleChanged: if (visible) + detailsShouldOpen = true function restoreState() { // Only applies to Jami accounts, and we musn't be in a call. if (detailsShouldOpen && !inCallView) { - switchToPanel(ChatView.SwarmDetailsPanel, false) + switchToPanel(ChatView.SwarmDetailsPanel, false); } else { - closePanel() + closePanel(); } } @@ -47,8 +48,7 @@ StackLayout { function onCountChanged() { // Close the panel if there are 8 or more members in the // conversation AND the "Add Member" panel is currently open. - if (CurrentConversationMembers.count >= 8 - && isOpen(ChatView.AddMemberPanel)) { + if (CurrentConversationMembers.count >= 8 && isOpen(ChatView.AddMemberPanel)) { closePanel(); } } @@ -57,19 +57,19 @@ StackLayout { // This will open the details panel if it's not already visible. // Additionally, `toggle` being true (default) will close the panel // if it is already open to `panel`. - function switchToPanel(panel, toggle=true) { + function switchToPanel(panel, toggle = true) { if (visible && toggle && currentIndex === panel) { - closePanel() + closePanel(); } else { - currentIndex = panel + currentIndex = panel; } } function closePanel() { // We need to close the panel, but not save it when appropriate. - currentIndex = -1 + currentIndex = -1; if (!inCallView) - detailsShouldOpen = false + detailsShouldOpen = false; } SwarmDetailsPanel { @@ -77,11 +77,12 @@ StackLayout { property int parentIndex: root.currentIndex // When we change to the details panel we should load the tab index. - onParentIndexChanged: tabBarIndex = Math.min(tabBarItemsLength - 1, - Math.max(0, root.detailsIndex)) + onParentIndexChanged: tabBarIndex = Math.min(tabBarItemsLength - 1, Math.max(0, root.detailsIndex)) // Save it when it changes. onTabBarIndexChanged: root.detailsIndex = tabBarIndex } - MessagesResearchPanel {} - AddMemberPanel {} + MessagesResearchPanel { + } + AddMemberPanel { + } } diff --git a/src/app/mainview/components/ConversationListView.qml b/src/app/mainview/components/ConversationListView.qml index e21af2b32425c8f6b9e17cb91041cbdeaca0148a..d4c2d15e0124a37788eb30d3db85dbb05e08d13a 100644 --- a/src/app/mainview/components/ConversationListView.qml +++ b/src/app/mainview/components/ConversationListView.qml @@ -16,14 +16,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls - import net.jami.Adapters 1.1 import net.jami.Constants 1.1 import net.jami.Models 1.1 - import "../../commoncomponents" JamiListView { @@ -34,12 +31,12 @@ JamiListView { property string headerLabel property bool headerVisible - delegate: SmartListItemDelegate {} + delegate: SmartListItemDelegate { + } currentIndex: model.currentFilteredRow // highlight selection // down and hover states are done within the delegate - highlightMoveDuration: 60 headerPositioning: ListView.OverlayHeader @@ -67,9 +64,9 @@ JamiListView { // actually select the conversation function onValidSelectionChanged() { - var row = model.currentFilteredRow - var convId = model.dataForRow(row, ConversationList.UID) - LRCInstance.selectConversation(convId) + var row = model.currentFilteredRow; + var convId = model.dataForRow(row, ConversationList.UID); + LRCInstance.selectConversation(convId); } } @@ -77,23 +74,27 @@ JamiListView { add: Transition { NumberAnimation { - property: "opacity"; from: 0; to: 1.0 + property: "opacity" + from: 0 + to: 1.0 duration: JamiTheme.smartListTransitionDuration } } displaced: Transition { NumberAnimation { - properties: "x,y"; easing.type: Easing.OutCubic + properties: "x,y" + easing.type: Easing.OutCubic duration: JamiTheme.smartListTransitionDuration } NumberAnimation { - property: "opacity"; to: 1.0 + property: "opacity" + to: 1.0 duration: JamiTheme.smartListTransitionDuration * (1 - from) } } - Behavior on opacity { + Behavior on opacity { NumberAnimation { easing.type: Easing.OutCubic duration: 2 * JamiTheme.smartListTransitionDuration @@ -101,8 +102,8 @@ JamiListView { } function openContextMenuAt(x, y, delegate) { - var mappedCoord = root.mapFromItem(delegate, x, y) - contextMenu.openMenuAt(mappedCoord.x, mappedCoord.y) + var mappedCoord = root.mapFromItem(delegate, x, y); + contextMenu.openMenuAt(mappedCoord.x, mappedCoord.y); } ConversationSmartListContextMenu { @@ -111,38 +112,32 @@ JamiListView { property int index: -1 function openMenuAt(x, y) { - contextMenu.x = x - contextMenu.y = y - - index = root.indexAt(x, y + root.contentY) + contextMenu.x = x; + contextMenu.y = y; + index = root.indexAt(x, y + root.contentY); // TODO: use accountId and convId only - responsibleAccountId = LRCInstance.currentAccountId - responsibleConvUid = model.dataForRow(index, ConversationList.UID) - isBanned = model.dataForRow(index, ConversationList.IsBanned) - mode = model.dataForRow(index, ConversationList.Mode) - isCoreDialog = model.dataForRow(index, ConversationList.IsCoreDialog) - contactType = LRCInstance.currentAccountType - readOnly = mode === Conversation.Mode.NON_SWARM && - (model.dataForRow(index, ConversationList.ContactType) !== - Profile.Type.TEMPORARY) && - CurrentAccount.type !== Profile.Type.SIP - hasCall = UtilsAdapter.getCallId(responsibleAccountId, - responsibleConvUid) !== "" + responsibleAccountId = LRCInstance.currentAccountId; + responsibleConvUid = model.dataForRow(index, ConversationList.UID); + isBanned = model.dataForRow(index, ConversationList.IsBanned); + mode = model.dataForRow(index, ConversationList.Mode); + isCoreDialog = model.dataForRow(index, ConversationList.IsCoreDialog); + contactType = LRCInstance.currentAccountType; + readOnly = mode === Conversation.Mode.NON_SWARM && (model.dataForRow(index, ConversationList.ContactType) !== Profile.Type.TEMPORARY) && CurrentAccount.type !== Profile.Type.SIP; + hasCall = UtilsAdapter.getCallId(responsibleAccountId, responsibleConvUid) !== ""; // For UserProfile dialog. if (isCoreDialog) { - aliasText = model.dataForRow(index, ConversationList.Title) - registeredNameText = model.dataForRow(index, ConversationList.BestId) - idText = model.dataForRow(index, ConversationList.URI) + aliasText = model.dataForRow(index, ConversationList.Title); + registeredNameText = model.dataForRow(index, ConversationList.BestId); + idText = model.dataForRow(index, ConversationList.URI); } - - openMenu() + openMenu(); } onShowSwarmDetails: { - model.select(index) - CurrentConversation.showSwarmDetails() + model.select(index); + CurrentConversation.showSwarmDetails(); } } @@ -152,7 +147,7 @@ JamiListView { enabled: CurrentAccount.videoEnabled_Video && root.visible onActivated: { if (CurrentAccount.videoEnabled_Video) - CallAdapter.placeCall() + CallAdapter.placeCall(); } } @@ -167,17 +162,14 @@ JamiListView { sequence: "Ctrl+Shift+L" context: Qt.ApplicationShortcut enabled: root.visible - onActivated: MessagesAdapter.clearConversationHistory( - CurrentAccount.id, - CurrentConversation.id) + onActivated: MessagesAdapter.clearConversationHistory(CurrentAccount.id, CurrentConversation.id) } Shortcut { sequence: "Ctrl+Shift+B" context: Qt.ApplicationShortcut enabled: root.visible - onActivated: MessagesAdapter.blockConversation( - CurrentConversation.id) + onActivated: MessagesAdapter.blockConversation(CurrentConversation.id) } Shortcut { @@ -186,8 +178,8 @@ JamiListView { enabled: root.visible onActivated: { if (currentIndex + 1 >= count) - return - model.select(currentIndex + 1) + return; + model.select(currentIndex + 1); } } @@ -197,8 +189,8 @@ JamiListView { enabled: root.visible onActivated: { if (currentIndex <= 0) - return - model.select(currentIndex - 1) + return; + model.select(currentIndex - 1); } } } diff --git a/src/app/mainview/components/ConversationSmartListContextMenu.qml b/src/app/mainview/components/ConversationSmartListContextMenu.qml index f8de8a08b9c6dbe803a029ff7e45a41e1493927c..10b85a0d28f994b3f716bee47cee13f691fd0e15 100644 --- a/src/app/mainview/components/ConversationSmartListContextMenu.qml +++ b/src/app/mainview/components/ConversationSmartListContextMenu.qml @@ -15,13 +15,10 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" import "../../commoncomponents/contextmenu" @@ -52,10 +49,9 @@ ContextMenuAutoLoader { itemName: JamiStrings.startVideoCall iconSource: JamiResources.videocam_24dp_svg onClicked: { - LRCInstance.selectConversation(responsibleConvUid, - responsibleAccountId) + LRCInstance.selectConversation(responsibleConvUid, responsibleAccountId); if (CurrentAccount.videoEnabled_Video) - CallAdapter.placeCall() + CallAdapter.placeCall(); } }, GeneralMenuItem { @@ -65,9 +61,8 @@ ContextMenuAutoLoader { itemName: JamiStrings.startAudioCall iconSource: JamiResources.place_audiocall_24dp_svg onClicked: { - LRCInstance.selectConversation(responsibleConvUid, - responsibleAccountId) - CallAdapter.placeAudioOnlyCall() + LRCInstance.selectConversation(responsibleConvUid, responsibleAccountId); + CallAdapter.placeAudioOnlyCall(); } }, GeneralMenuItem { @@ -76,9 +71,7 @@ ContextMenuAutoLoader { canTrigger: mode === Conversation.Mode.NON_SWARM && !hasCall && !root.isBanned itemName: JamiStrings.clearConversation iconSource: JamiResources.ic_clear_24dp_svg - onClicked: MessagesAdapter.clearConversationHistory( - responsibleAccountId, - responsibleConvUid) + onClicked: MessagesAdapter.clearConversationHistory(responsibleAccountId, responsibleConvUid) }, GeneralMenuItem { id: removeContact @@ -86,26 +79,23 @@ ContextMenuAutoLoader { canTrigger: !hasCall && !root.isBanned itemName: { if (mode !== Conversation.Mode.NON_SWARM) - return JamiStrings.removeConversation + return JamiStrings.removeConversation; else - return JamiStrings.removeContact + return JamiStrings.removeContact; } iconSource: JamiResources.ic_hangup_participant_24dp_svg onClicked: { - var dlg = viewCoordinator.presentDialog( - appWindow, - "commoncomponents/ConfirmDialog.qml", - { - title: JamiStrings.confirmAction, - textLabel: JamiStrings.confirmRmConversation, - confirmLabel: JamiStrings.optionRemove - }) - dlg.accepted.connect(function() { - if (!isCoreDialog) - MessagesAdapter.removeConversation(responsibleConvUid) - else - MessagesAdapter.removeContact(responsibleConvUid) - }) + var dlg = viewCoordinator.presentDialog(appWindow, "commoncomponents/ConfirmDialog.qml", { + "title": JamiStrings.confirmAction, + "textLabel": JamiStrings.confirmRmConversation, + "confirmLabel": JamiStrings.optionRemove + }); + dlg.accepted.connect(function () { + if (!isCoreDialog) + MessagesAdapter.removeConversation(responsibleConvUid); + else + MessagesAdapter.removeContact(responsibleConvUid); + }); } }, GeneralMenuItem { @@ -114,11 +104,8 @@ ContextMenuAutoLoader { canTrigger: hasCall itemName: JamiStrings.endCall iconSource: JamiResources.ic_call_end_white_24dp_svg - addMenuSeparatorAfter: contactType !== Profile.Type.SIP - && (contactType === Profile.Type.PENDING - || !hasCall) - onClicked: CallAdapter.hangUpACall(responsibleAccountId, - responsibleConvUid) + addMenuSeparatorAfter: contactType !== Profile.Type.SIP && (contactType === Profile.Type.PENDING || !hasCall) + onClicked: CallAdapter.hangUpACall(responsibleAccountId, responsibleConvUid) }, GeneralMenuItem { id: acceptContactRequest @@ -144,17 +131,14 @@ ContextMenuAutoLoader { iconSource: JamiResources.block_black_24dp_svg addMenuSeparatorAfter: canTrigger onClicked: { - var dlg = viewCoordinator.presentDialog( - appWindow, - "commoncomponents/ConfirmDialog.qml", - { - title: JamiStrings.confirmAction, - textLabel: JamiStrings.confirmBlockConversation, - confirmLabel: JamiStrings.optionBlock - }) - dlg.accepted.connect(function() { - MessagesAdapter.blockConversation(responsibleConvUid) - }) + var dlg = viewCoordinator.presentDialog(appWindow, "commoncomponents/ConfirmDialog.qml", { + "title": JamiStrings.confirmAction, + "textLabel": JamiStrings.confirmBlockConversation, + "confirmLabel": JamiStrings.optionBlock + }); + dlg.accepted.connect(function () { + MessagesAdapter.blockConversation(responsibleConvUid); + }); } }, GeneralMenuItem { @@ -174,17 +158,14 @@ ContextMenuAutoLoader { iconSource: JamiResources.person_24dp_svg onClicked: { if (isCoreDialog) { - viewCoordinator.presentDialog( - appWindow, - "mainview/components/UserProfile.qml", - { - aliasText: aliasText, - registeredNameText: registeredNameText, - idText: idText, - convId: responsibleConvUid - }) + viewCoordinator.presentDialog(appWindow, "mainview/components/UserProfile.qml", { + "aliasText": aliasText, + "registeredNameText": registeredNameText, + "idText": idText, + "convId": responsibleConvUid + }); } else { - root.showSwarmDetails() + root.showSwarmDetails(); } } } diff --git a/src/app/mainview/components/CustomizeTipBox.qml b/src/app/mainview/components/CustomizeTipBox.qml index 8aff49607851662958cea7b7f0a9d40546f6b9fe..836717ecd46a8f0330103c2ea3317b9f4dbe736e 100644 --- a/src/app/mainview/components/CustomizeTipBox.qml +++ b/src/app/mainview/components/CustomizeTipBox.qml @@ -14,15 +14,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" ColumnLayout { @@ -82,7 +79,6 @@ ColumnLayout { color: JamiTheme.textColor } - PhotoboothView { id: setAvatarWidget width: avatarSize + avatarSize / 2 @@ -93,7 +89,6 @@ ColumnLayout { imageId: CurrentAccount.id avatarSize: 53 doubleEditAvatar: true - } ModalTextEdit { diff --git a/src/app/mainview/components/DevicesListPopup.qml b/src/app/mainview/components/DevicesListPopup.qml index 26e15504891f70565de7eeb33293101403b31b35..4872f0744f9218e8a6c291f4645ae8f318ddc040 100644 --- a/src/app/mainview/components/DevicesListPopup.qml +++ b/src/app/mainview/components/DevicesListPopup.qml @@ -14,18 +14,14 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts import Qt5Compat.GraphicalEffects - import SortFilterProxyModel 0.2 - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" BaseModalDialog { @@ -40,7 +36,6 @@ BaseModalDialog { color: JamiTheme.transparentColor width: root.width - PushButton { id: btnCancel imageColor: "grey" @@ -50,7 +45,9 @@ BaseModalDialog { anchors.topMargin: 10 anchors.rightMargin: 10 source: JamiResources.round_close_24dp_svg - onClicked: { close(); } + onClicked: { + close(); + } } ColumnLayout { @@ -81,7 +78,10 @@ BaseModalDialog { model: SortFilterProxyModel { sourceModel: DeviceItemListModel sorters: [ - RoleSorter { roleName: "IsCurrent"; sortOrder: Qt.DescendingOrder }, + RoleSorter { + roleName: "IsCurrent" + sortOrder: Qt.DescendingOrder + }, StringSorter { roleName: "DeviceName" caseSensitivity: Qt.CaseInsensitive @@ -92,9 +92,9 @@ BaseModalDialog { delegate: ItemDelegate { id: item - property string deviceName : DeviceName - property string deviceId : DeviceID - property bool isCurrent : DeviceName + property string deviceName: DeviceName + property string deviceId: DeviceID + property bool isCurrent: DeviceName implicitWidth: devicesListView.width width: devicesListView.width @@ -105,12 +105,12 @@ BaseModalDialog { MouseArea { anchors.fill: parent onClicked: { - devicesListView.currentIndex = index + devicesListView.currentIndex = index; } } background: Rectangle { - color: highlighted? JamiTheme.selectedColor : JamiTheme.editBackgroundColor + color: highlighted ? JamiTheme.selectedColor : JamiTheme.editBackgroundColor } RowLayout { @@ -182,7 +182,7 @@ BaseModalDialog { MaterialButton { id: chooseBtn - TextMetrics{ + TextMetrics { id: chooseBtnTextSize font.weight: Font.Bold font.pixelSize: JamiTheme.wizardViewButtonFontPixelSize @@ -193,23 +193,23 @@ BaseModalDialog { Layout.alignment: Qt.AlignCenter Layout.fillWidth: true primary: true - preferredWidth: chooseBtnTextSize.width + 2*JamiTheme.buttontextWizzardPadding + preferredWidth: chooseBtnTextSize.width + 2 * JamiTheme.buttontextWizzardPadding enabled: devicesListView.currentItem text: JamiStrings.chooseThisDevice toolTipText: JamiStrings.chooseThisDevice onClicked: { - CurrentConversation.setInfo("rdvAccount", CurrentAccount.uri) - CurrentConversation.setInfo("rdvDevice", devicesListView.currentItem.deviceId) - close() + CurrentConversation.setInfo("rdvAccount", CurrentAccount.uri); + CurrentConversation.setInfo("rdvDevice", devicesListView.currentItem.deviceId); + close(); } } MaterialButton { id: rmDeviceBtn - TextMetrics{ + TextMetrics { id: rmDeviceBtnTextSize font.weight: Font.Bold font.pixelSize: JamiTheme.wizardViewButtonFontPixelSize @@ -220,16 +220,16 @@ BaseModalDialog { Layout.alignment: Qt.AlignCenter Layout.fillWidth: true primary: true - preferredWidth: rmDeviceBtnTextSize.width + 2*JamiTheme.buttontextWizzardPadding + preferredWidth: rmDeviceBtnTextSize.width + 2 * JamiTheme.buttontextWizzardPadding enabled: devicesListView.currentItem text: JamiStrings.removeCurrentDevice toolTipText: JamiStrings.removeCurrentDevice onClicked: { - CurrentConversation.setInfo("rdvAccount", "") - CurrentConversation.setInfo("rdvDevice", "") - close() + CurrentConversation.setInfo("rdvAccount", ""); + CurrentConversation.setInfo("rdvDevice", ""); + close(); } } } diff --git a/src/app/mainview/components/DocumentPreview.qml b/src/app/mainview/components/DocumentPreview.qml index 5ff6ec80a88cd3ad0ec78d9f4e911b0260ae4677..6ffea77a3e53c57fce122cd971be16b728ca73b6 100644 --- a/src/app/mainview/components/DocumentPreview.qml +++ b/src/app/mainview/components/DocumentPreview.qml @@ -15,18 +15,15 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts import Qt5Compat.GraphicalEffects - import net.jami.Adapters 1.1 import net.jami.Constants 1.1 import net.jami.Models 1.1 import "../../commoncomponents" Item { - id: root property real margin: 2 @@ -39,16 +36,16 @@ Item { acceptedButtons: Qt.LeftButton | Qt.RightButton onEntered: { - cursorShape = Qt.PointingHandCursor + cursorShape = Qt.PointingHandCursor; } - onClicked: function(mouse) { + onClicked: function (mouse) { if (mouse.button === Qt.RightButton) { - ctxMenu.x = mouse.x - ctxMenu.y = mouse.y - ctxMenu.openMenu() + ctxMenu.x = mouse.x; + ctxMenu.y = mouse.y; + ctxMenu.openMenu(); } else { - MessagesAdapter.openUrl(name.fileSource) + MessagesAdapter.openUrl(name.fileSource); } } } @@ -67,7 +64,7 @@ Item { anchors.fill: root anchors.rightMargin: JamiTheme.preferredMarginSize anchors.leftMargin: JamiTheme.preferredMarginSize - spacing : 2 + spacing: 2 Rectangle { id: mainRect @@ -90,8 +87,8 @@ Item { height: rect.height Rectangle { anchors.centerIn: parent - width: rect.width - height: rect.height + width: rect.width + height: rect.height radius: JamiTheme.chatViewFooterButtonRadius } } @@ -106,7 +103,7 @@ Item { ResponsiveImage { id: fileIcon - visible : !mediaInfo.isImage && !mediaInfo.isAnimatedImage + visible: !mediaInfo.isImage && !mediaInfo.isAnimatedImage anchors.fill: parent anchors.margins: 8 source: { @@ -133,11 +130,11 @@ Item { fillMode: Image.PreserveAspectCrop source: { - fileSource = "file://" + Body - if (!mediaInfo.isImage && !mediaInfo.isAnimatedImage){ - return "" + fileSource = "file://" + Body; + if (!mediaInfo.isImage && !mediaInfo.isAnimatedImage) { + return ""; } - return "file://" + Body + return "file://" + Body; } } } @@ -148,7 +145,7 @@ Item { id: info Layout.preferredHeight: root.height Layout.fillWidth: true - color : JamiTheme.transparentColor + color: JamiTheme.transparentColor Layout.alignment: Qt.AlignLeft ColumnLayout { @@ -190,8 +187,7 @@ Item { color: JamiTheme.chatviewTextColor Layout.alignment: Qt.AlignLeft Layout.maximumWidth: info.width - fileExtension.width - infoLayout.spacing - text: " " + UtilsAdapter.humanFileSize(TotalSize) + ", " + MessagesAdapter.getFormattedDay(Timestamp) - + " - " + MessagesAdapter.getFormattedTime(Timestamp) + text: " " + UtilsAdapter.humanFileSize(TotalSize) + ", " + MessagesAdapter.getFormattedDay(Timestamp) + " - " + MessagesAdapter.getFormattedTime(Timestamp) elide: Text.ElideRight } } diff --git a/src/app/mainview/components/DocumentsScrollview.qml b/src/app/mainview/components/DocumentsScrollview.qml index dfbf21d5ce388c7e36cd1d750f4bbfa45219249b..e9829f76f90b5b95a15ffb8a64d9ac4c0c63b0a7 100644 --- a/src/app/mainview/components/DocumentsScrollview.qml +++ b/src/app/mainview/components/DocumentsScrollview.qml @@ -15,18 +15,15 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts import Qt.labs.platform import Qt5Compat.GraphicalEffects import SortFilterProxyModel - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" import "../../settingsview/components" @@ -44,18 +41,18 @@ JamiListView { onVisibleChanged: { if (visible) { - MessagesAdapter.startSearch(textFilter,true) + MessagesAdapter.startSearch(textFilter, true); } } onConvIdChanged: { if (visible) { - MessagesAdapter.startSearch(textFilter,true) + MessagesAdapter.startSearch(textFilter, true); } } onTextFilterChanged: { - MessagesAdapter.startSearch(textFilter,true) + MessagesAdapter.startSearch(textFilter, true); } model: SortFilterProxyModel { @@ -66,22 +63,26 @@ JamiListView { readonly property int transferFinishedType: Interaction.Status.TRANSFER_FINISHED readonly property int transferSuccesType: Interaction.Status.SUCCESS - onMessageListModelChanged: sourceModel = root.visible && messageListModel ? - messageListModel : - null + onMessageListModelChanged: sourceModel = root.visible && messageListModel ? messageListModel : null - sorters: RoleSorter { roleName: "Timestamp"; sortOrder: Qt.DescendingOrder } + sorters: RoleSorter { + roleName: "Timestamp" + sortOrder: Qt.DescendingOrder + } filters: [ - ExpressionFilter { expression: Type === proxyModel.documentType }, - ExpressionFilter { expression: Status === proxyModel.transferFinishedType || Status === proxyModel.transferSuccesType } + ExpressionFilter { + expression: Type === proxyModel.documentType + }, + ExpressionFilter { + expression: Status === proxyModel.transferFinishedType || Status === proxyModel.transferSuccesType + } ] - } delegate: DocumentPreview { id: member width: root.width - height: Math.max(JamiTheme.swarmDetailsPageDocumentsHeight,JamiTheme.swarmDetailsPageDocumentsMinHeight) + height: Math.max(JamiTheme.swarmDetailsPageDocumentsHeight, JamiTheme.swarmDetailsPageDocumentsMinHeight) } } diff --git a/src/app/mainview/components/EditContainer.qml b/src/app/mainview/components/EditContainer.qml index 0404a30762f8e98ec41261ed1fb1c38daa76e5cf..43b80df1a077911632cb72f3201950fa8e98fea3 100644 --- a/src/app/mainview/components/EditContainer.qml +++ b/src/app/mainview/components/EditContainer.qml @@ -15,15 +15,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Adapters 1.1 import net.jami.Constants 1.1 import net.jami.Models 1.1 - import "../../commoncomponents" Rectangle { @@ -33,8 +30,8 @@ Rectangle { property var body: { if (MessagesAdapter.editId === "") - return "" - return MessagesAdapter.dataForInteraction(MessagesAdapter.editId, MessageList.LinkifiedBody) + return ""; + return MessagesAdapter.dataForInteraction(MessagesAdapter.editId, MessageList.LinkifiedBody); } RowLayout { @@ -49,9 +46,7 @@ Rectangle { text: JamiStrings.edit - color: UtilsAdapter.luma(root.color) ? - JamiTheme.chatviewTextColorLight : - JamiTheme.chatviewTextColorDark + color: UtilsAdapter.luma(root.color) ? JamiTheme.chatviewTextColorLight : JamiTheme.chatviewTextColorDark font.pointSize: JamiTheme.textFontSize font.kerning: true font.bold: true @@ -70,16 +65,13 @@ Rectangle { text: metrics.elidedText textFormat: Text.MarkdownText - color: UtilsAdapter.luma(root.color) ? - JamiTheme.chatviewTextColorLight : - JamiTheme.chatviewTextColorDark + color: UtilsAdapter.luma(root.color) ? JamiTheme.chatviewTextColorLight : JamiTheme.chatviewTextColorDark font.pointSize: JamiTheme.textFontSize font.kerning: true font.bold: true } } - PushButton { id: closeReply diff --git a/src/app/mainview/components/FilePreview.qml b/src/app/mainview/components/FilePreview.qml index a73d9e5c4170758af5b101628f1b5d1ea9059a1c..f87490e3ca601eb97769c424df7787349b4f190a 100644 --- a/src/app/mainview/components/FilePreview.qml +++ b/src/app/mainview/components/FilePreview.qml @@ -19,11 +19,9 @@ import QtQuick.Controls import QtQuick.Layouts import Qt.labs.platform import Qt5Compat.GraphicalEffects - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" import "../../settingsview/components" @@ -34,11 +32,11 @@ Component { id: dataTransferRect clip: true - width: (contentWidth - spacingLength ) / numberElementsPerRow + width: (contentWidth - spacingLength) / numberElementsPerRow height: width color: "transparent" - ColumnLayout{ + ColumnLayout { anchors.fill: parent anchors.margins: JamiTheme.swarmDetailsPageDocumentsMargins @@ -83,16 +81,16 @@ Component { hoverEnabled: true acceptedButtons: Qt.LeftButton | Qt.RightButton onEntered: { - cursorShape = Qt.PointingHandCursor + cursorShape = Qt.PointingHandCursor; } onClicked: function (mouse) { if (mouse.button === Qt.RightButton) { - ctxMenu.x = mouse.x - ctxMenu.y = mouse.y - ctxMenu.openMenu() + ctxMenu.x = mouse.x; + ctxMenu.y = mouse.y; + ctxMenu.openMenu(); } else { - Qt.openUrlExternally(new Url("file://" + Body)) + Qt.openUrlExternally(new Url("file://" + Body)); } } } diff --git a/src/app/mainview/components/FilesToSendContainer.qml b/src/app/mainview/components/FilesToSendContainer.qml index 905bf6bd57986106a280b8246f39c2767662d940..83932eb719d63e379b9f6af0f442424960299ed2 100644 --- a/src/app/mainview/components/FilesToSendContainer.qml +++ b/src/app/mainview/components/FilesToSendContainer.qml @@ -15,13 +15,10 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls - import net.jami.Models 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" Rectangle { @@ -39,9 +36,7 @@ Rectangle { contentHeight: root.height contentWidth: filesToSendContainerRow.width - horizontalHandleColor: - filesToSendContainerScrollView.ScrollBar.horizontal.pressed ? - JamiTheme.darkGreyColor : JamiTheme.whiteColor + horizontalHandleColor: filesToSendContainerScrollView.ScrollBar.horizontal.pressed ? JamiTheme.darkGreyColor : JamiTheme.whiteColor ScrollBar.vertical.policy: ScrollBar.AlwaysOff Row { @@ -61,8 +56,8 @@ Rectangle { width: JamiTheme.filesToSendDelegateWidth height: JamiTheme.filesToSendDelegateHeight - onRemoveFileButtonClicked: function(index) { - filesToSendListModel.removeFromPending(index) + onRemoveFileButtonClicked: function (index) { + filesToSendListModel.removeFromPending(index); } } model: FilesToSendListModel { diff --git a/src/app/mainview/components/FilesToSendDelegate.qml b/src/app/mainview/components/FilesToSendDelegate.qml index 5cf192a7e7ef6a74e8339a476d4c00fdd090b3f5..e0b7df2183e833693965af57263e22bed848b85a 100644 --- a/src/app/mainview/components/FilesToSendDelegate.qml +++ b/src/app/mainview/components/FilesToSendDelegate.qml @@ -15,18 +15,15 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts import Qt5Compat.GraphicalEffects - import net.jami.Adapters 1.1 import net.jami.Constants 1.1 import net.jami.Models 1.1 import "../../commoncomponents" Item { - id: root property real margin: 5 @@ -35,7 +32,7 @@ Item { RowLayout { anchors.fill: root - spacing : 2 + spacing: 2 Rectangle { id: mainRect @@ -58,8 +55,8 @@ Item { height: rect.height Rectangle { anchors.centerIn: parent - width: rect.width - height: rect.height + width: rect.width + height: rect.height radius: JamiTheme.chatViewFooterButtonRadius } } @@ -74,7 +71,7 @@ Item { ResponsiveImage { id: fileIcon - visible : !IsImage + visible: !IsImage anchors.fill: parent anchors.margins: 14 source: { @@ -100,14 +97,14 @@ Item { fillMode: Image.PreserveAspectCrop source: { if (!IsImage) - return "" + return ""; // :/ -> resource url for test purposes - var sourceUrl = FilePath + var sourceUrl = FilePath; if (!sourceUrl.startsWith(":/")) - return JamiQmlUtils.qmlFilePrefix + sourceUrl + return JamiQmlUtils.qmlFilePrefix + sourceUrl; else - return "qrc" + sourceUrl + return "qrc" + sourceUrl; } layer.enabled: true @@ -148,9 +145,9 @@ Item { Rectangle { id: info - Layout.preferredHeight: root.height -margin + Layout.preferredHeight: root.height - margin Layout.preferredWidth: JamiTheme.layoutWidthFileTransfer - color : JamiTheme.transparentColor + color: JamiTheme.transparentColor Layout.alignment: Qt.AlignLeft ColumnLayout { @@ -166,7 +163,7 @@ Item { Layout.preferredWidth: info.width font.pointSize: JamiTheme.filesToSendDelegateFontPointSize color: JamiTheme.chatviewTextColor - font.bold : true + font.bold: true text: FileName elide: Text.ElideRight } diff --git a/src/app/mainview/components/FilterTabButton.qml b/src/app/mainview/components/FilterTabButton.qml index caa40094c6cd1701c1c4ac6829e4062ba914152f..af812e31f510485fb78ff0ba871af81bbbe1a94a 100644 --- a/src/app/mainview/components/FilterTabButton.qml +++ b/src/app/mainview/components/FilterTabButton.qml @@ -16,13 +16,10 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Constants 1.1 - import "../../commoncomponents" TabButton { @@ -51,9 +48,7 @@ TabButton { anchors.fill: root - color: root.hovered ? - root.hoverColor : - root.backgroundColor + color: root.hovered ? root.hoverColor : root.backgroundColor RowLayout { id: informations @@ -69,8 +64,8 @@ TabButton { font.pointSize: fontSize color: { if (!root.down && root.hovered) - return root.textColorHovered - return root.textColor + return root.textColorHovered; + return root.textColor; } opacity: root.down ? 1.0 : 0.5 } @@ -84,18 +79,16 @@ TabButton { } Rectangle { - width: underlineContentOnly ? - informations.width + JamiTheme.menuBorderPreferredHeight : - contentRect.width + width: underlineContentOnly ? informations.width + JamiTheme.menuBorderPreferredHeight : contentRect.width anchors.horizontalCenter: contentRect.horizontalCenter anchors.bottom: contentRect.bottom height: borderWidth color: { if (!root.down && root.hovered) - return root.textColorHovered + return root.textColorHovered; if (!root.down) - return "transparent" - return root.textColor + return "transparent"; + return root.textColor; } } diff --git a/src/app/mainview/components/GenericErrorsRow.qml b/src/app/mainview/components/GenericErrorsRow.qml index 00260f21d24048893ec7a70bbd9c6d56d57f5cac..1165fae91c9a46a767ee466d8ac566286c83d61b 100644 --- a/src/app/mainview/components/GenericErrorsRow.qml +++ b/src/app/mainview/components/GenericErrorsRow.qml @@ -14,16 +14,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts import Qt5Compat.GraphicalEffects - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" Rectangle { @@ -44,17 +41,17 @@ Rectangle { id: errorLabel Layout.fillWidth: true Layout.alignment: Qt.AlignVCenter - text: CurrentAccount.enabled? JamiStrings.noNetworkConnectivity : JamiStrings.disabledAccount + text: CurrentAccount.enabled ? JamiStrings.noNetworkConnectivity : JamiStrings.disabledAccount color: JamiTheme.filterBadgeTextColor font.pixelSize: JamiTheme.headerFontSize elide: Text.ElideRight } } - Behavior on opacity { + Behavior on opacity { NumberAnimation { from: 0 duration: JamiTheme.shortFadeDuration } } -} \ No newline at end of file +} diff --git a/src/app/mainview/components/HostPopup.qml b/src/app/mainview/components/HostPopup.qml index ad65a86e5b0b0643316e64ab2e25ee02fcb36093..23db77e59df3039d621dada15a44313fb832992e 100644 --- a/src/app/mainview/components/HostPopup.qml +++ b/src/app/mainview/components/HostPopup.qml @@ -14,16 +14,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts import Qt5Compat.GraphicalEffects - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" BaseModalDialog { @@ -33,18 +30,16 @@ BaseModalDialog { height: 256 property bool isAdmin: { - var role = UtilsAdapter.getParticipantRole(CurrentAccount.id, CurrentConversation.id, CurrentAccount.uri) - return role === Member.Role.ADMIN + var role = UtilsAdapter.getParticipantRole(CurrentAccount.id, CurrentConversation.id, CurrentAccount.uri); + return role === Member.Role.ADMIN; } - popupContent: Rectangle { id: rect color: JamiTheme.transparentColor width: root.width - PushButton { id: btnCancel imageColor: "grey" @@ -54,7 +49,9 @@ BaseModalDialog { anchors.topMargin: 10 anchors.rightMargin: 10 source: JamiResources.round_close_24dp_svg - onClicked: { close();} + onClicked: { + close(); + } } ColumnLayout { @@ -81,11 +78,11 @@ BaseModalDialog { Layout.alignment: Qt.AlignCenter Layout.topMargin: 26 - text: isAdmin? JamiStrings.becomeHostOneCall : JamiStrings.hostThisCall + text: isAdmin ? JamiStrings.becomeHostOneCall : JamiStrings.hostThisCall onClicked: { - MessagesAdapter.joinCall(CurrentAccount.uri, CurrentAccount.deviceId, "0") - close() + MessagesAdapter.joinCall(CurrentAccount.uri, CurrentAccount.deviceId, "0"); + close(); } } @@ -100,10 +97,10 @@ BaseModalDialog { visible: isAdmin onClicked: { - CurrentConversation.setInfo("rdvAccount", CurrentAccount.uri) - CurrentConversation.setInfo("rdvDevice", devicesListView.currentItem.deviceId) - MessagesAdapter.joinCall(CurrentAccount.uri, CurrentAccount.deviceId, "0") - close() + CurrentConversation.setInfo("rdvAccount", CurrentAccount.uri); + CurrentConversation.setInfo("rdvDevice", devicesListView.currentItem.deviceId); + MessagesAdapter.joinCall(CurrentAccount.uri, CurrentAccount.deviceId, "0"); + close(); } } } diff --git a/src/app/mainview/components/InformativeTipBox.qml b/src/app/mainview/components/InformativeTipBox.qml index f5fbe94597ca9f97a3fa71c8009f147f87e2f0e1..fdf7617e411a7ac839f91c479d509c43c0e52a0c 100644 --- a/src/app/mainview/components/InformativeTipBox.qml +++ b/src/app/mainview/components/InformativeTipBox.qml @@ -14,18 +14,14 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" - ColumnLayout { id: column width: parent.width @@ -77,7 +73,7 @@ ColumnLayout { Layout.bottomMargin: 15 font.pixelSize: JamiTheme.tipBoxContentFontSize wrapMode: Text.WordWrap - font.weight: opened ? Font.Medium : Font.Normal + font.weight: opened ? Font.Medium : Font.Normal text: root.title color: JamiTheme.textColor } diff --git a/src/app/mainview/components/InitialCallPage.qml b/src/app/mainview/components/InitialCallPage.qml index fb52052f319c20baf883a5086e1f6954b958c970..364ecfa8ed7d03fe65af8501dcdd51c905a3b3ba 100644 --- a/src/app/mainview/components/InitialCallPage.qml +++ b/src/app/mainview/components/InitialCallPage.qml @@ -16,15 +16,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" Rectangle { @@ -42,12 +39,7 @@ Rectangle { id: previewRenderer anchors.centerIn: parent anchors.fill: parent - visible: !CurrentCall.isAudioOnly && - CurrentAccount.videoEnabled_Video && - VideoDevices.listSize !== 0 && - ((CurrentCall.status >= Call.Status.INCOMING_RINGING - && CurrentCall.status <= Call.Status.SEARCHING) - || CurrentCall.status === Call.Status.CONNECTED) + visible: !CurrentCall.isAudioOnly && CurrentAccount.videoEnabled_Video && VideoDevices.listSize !== 0 && ((CurrentCall.status >= Call.Status.INCOMING_RINGING && CurrentCall.status <= Call.Status.SEARCHING) || CurrentCall.status === Call.Status.CONNECTED) opacity: 0.5 // HACK: this is a workaround to the preview video starting @@ -57,27 +49,27 @@ Rectangle { property bool startVideo interval: 1000 onTriggered: { - var rendId = visible && startVideo ? VideoDevices.getDefaultDevice() : "" - previewRenderer.startWithId(rendId) + var rendId = visible && startVideo ? VideoDevices.getDefaultDevice() : ""; + previewRenderer.startWithId(rendId); } } onVisibleChanged: { - controlPreview.stop() + controlPreview.stop(); if (visible) { - controlPreview.startVideo = true - controlPreview.interval = 1000 + controlPreview.startVideo = true; + controlPreview.interval = 1000; } else { - controlPreview.startVideo = false - controlPreview.interval = 0 + controlPreview.startVideo = false; + controlPreview.interval = 0; } - controlPreview.start() + controlPreview.start(); } } ListModel { id: incomingControlsModel Component.onCompleted: { - fillIncomingControls() + fillIncomingControls(); } } @@ -85,7 +77,7 @@ Rectangle { target: CurrentAccount function onVideoEnabledVideoChanged() { - fillIncomingControls() + fillIncomingControls(); } } @@ -93,22 +85,34 @@ Rectangle { target: VideoDevices function onListSizeChanged() { - fillIncomingControls() + fillIncomingControls(); } } function fillIncomingControls() { - incomingControlsModel.clear() - incomingControlsModel.append({"type": "refuse", "image": JamiResources.round_close_24dp_svg}) - incomingControlsModel.append({"type": "mic", "image" : JamiResources.place_audiocall_24dp_svg}) - if (CurrentAccount.videoEnabled_Video && VideoDevices.listSize !== 0) - incomingControlsModel.append({"type": "cam", "image" : JamiResources.videocam_24dp_svg}) + incomingControlsModel.clear(); + incomingControlsModel.append({ + "type": "refuse", + "image": JamiResources.round_close_24dp_svg + }); + incomingControlsModel.append({ + "type": "mic", + "image": JamiResources.place_audiocall_24dp_svg + }); + if (CurrentAccount.videoEnabled_Video && VideoDevices.listSize !== 0) + incomingControlsModel.append({ + "type": "cam", + "image": JamiResources.videocam_24dp_svg + }); } ListModel { id: outgoingControlsModel Component.onCompleted: { - append({"type": "cancel", "image": JamiResources.ic_call_end_white_24dp_svg}) + append({ + "type": "cancel", + "image": JamiResources.ic_call_end_white_24dp_svg + }); } } @@ -118,7 +122,7 @@ Rectangle { propagateComposedEvents: false acceptedButtons: Qt.AllButtons onDoubleClicked: function (mouse) { - mouse.accepted = true + mouse.accepted = true; } } @@ -150,11 +154,9 @@ Rectangle { text: { if (!CurrentCall.isOutgoing) - return CurrentCall.isAudioOnly ? - JamiStrings.incomingAudioCallFrom.replace("{}", title) : - JamiStrings.incomingVideoCallFrom.replace("{}", title) + return CurrentCall.isAudioOnly ? JamiStrings.incomingAudioCallFrom.replace("{}", title) : JamiStrings.incomingVideoCallFrom.replace("{}", title); else - return title + return title; } wrapMode: Text.WordWrap elide: Text.ElideRight @@ -197,35 +199,35 @@ Rectangle { implicitHeight: JamiTheme.callButtonPreferredSize pressedColor: { - if ( type === "cam" || type === "mic") - return JamiTheme.acceptGreen - return JamiTheme.refuseRed + if (type === "cam" || type === "mic") + return JamiTheme.acceptGreen; + return JamiTheme.refuseRed; } hoveredColor: { - if ( type === "cam" || type === "mic") - return JamiTheme.acceptGreen - return JamiTheme.refuseRed + if (type === "cam" || type === "mic") + return JamiTheme.acceptGreen; + return JamiTheme.refuseRed; } normalColor: { - if ( type === "cam" || type === "mic") - return JamiTheme.acceptGreenTransparency - return JamiTheme.refuseRedTransparent + if (type === "cam" || type === "mic") + return JamiTheme.acceptGreenTransparency; + return JamiTheme.refuseRedTransparent; } source: image imageColor: JamiTheme.whiteColor onClicked: { - if ( type === "cam" || type === "mic") { - var acceptVideoMedia = true + if (type === "cam" || type === "mic") { + var acceptVideoMedia = true; if (type === "cam") - acceptVideoMedia = true - else if ( type === "mic" ) - acceptVideoMedia = false - CallAdapter.setCallMedia(CurrentAccount.id, CurrentConversation.id, acceptVideoMedia) - callAccepted() + acceptVideoMedia = true; + else if (type === "mic") + acceptVideoMedia = false; + CallAdapter.setCallMedia(CurrentAccount.id, CurrentConversation.id, acceptVideoMedia); + callAccepted(); } else { - callCanceled() + callCanceled(); } } } @@ -240,17 +242,16 @@ Rectangle { font.kerning: true color: actionButton.hovered ? JamiTheme.whiteColor : JamiTheme.whiteColorTransparent - text: { if (type === "refuse") - return JamiStrings.refuse + return JamiStrings.refuse; else if (type === "cam") - return JamiStrings.acceptVideo + return JamiStrings.acceptVideo; else if (type === "mic") - return CurrentCall.isAudioOnly ? JamiStrings.accept : JamiStrings.acceptAudio + return CurrentCall.isAudioOnly ? JamiStrings.accept : JamiStrings.acceptAudio; else if (type === "cancel") - return JamiStrings.endCall - return "" + return JamiStrings.endCall; + return ""; } horizontalAlignment: Text.AlignHCenter @@ -265,16 +266,14 @@ Rectangle { Shortcut { sequence: "Ctrl+Y" context: Qt.ApplicationShortcut - onActivated: CallAdapter.acceptACall(CurrentAccount.id, - CurrentConversation.id) + onActivated: CallAdapter.acceptACall(CurrentAccount.id, CurrentConversation.id) } Shortcut { sequence: "Ctrl+Shift+D" context: Qt.ApplicationShortcut onActivated: { - CallAdapter.hangUpACall(CurrentAccount.id, - CurrentConversation.id) + CallAdapter.hangUpACall(CurrentAccount.id, CurrentConversation.id); } } } diff --git a/src/app/mainview/components/InvitationView.qml b/src/app/mainview/components/InvitationView.qml index a101b04e2c7750bc30d5580d7db471a327cb4e3e..bf0c2cef85f94b54f58cf1489658ebaf839b0b21 100644 --- a/src/app/mainview/components/InvitationView.qml +++ b/src/app/mainview/components/InvitationView.qml @@ -15,14 +15,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts - import net.jami.Adapters 1.1 import net.jami.Constants 1.1 import net.jami.Models 1.1 - import "../../commoncomponents" Rectangle { @@ -52,8 +49,7 @@ Rectangle { color: JamiTheme.textColor wrapMode: Text.Wrap - text: JamiStrings.invitationViewSentRequest.arg( - CurrentConversation.title) + text: JamiStrings.invitationViewSentRequest.arg(CurrentConversation.title) } ColumnLayout { @@ -91,9 +87,7 @@ Rectangle { color: JamiTheme.textColor wrapMode: Text.Wrap - text: CurrentConversation.needsSyncing ? - JamiStrings.invitationViewAcceptedConversation : - JamiStrings.invitationViewJoinConversation + text: CurrentConversation.needsSyncing ? JamiStrings.invitationViewAcceptedConversation : JamiStrings.invitationViewJoinConversation } Text { @@ -113,8 +107,7 @@ Rectangle { color: JamiTheme.textColor wrapMode: Text.Wrap - text: JamiStrings.invitationViewWaitingForSync.arg( - CurrentConversation.title) + text: JamiStrings.invitationViewWaitingForSync.arg(CurrentConversation.title) } RowLayout { diff --git a/src/app/mainview/components/KeyboardShortcutKeyDelegate.qml b/src/app/mainview/components/KeyboardShortcutKeyDelegate.qml index 3ca869f72f7abe49fee5adcda8de3b3282a9a886..dbbcd8926a26b5d2ebc738cd4bc4865e026696bd 100644 --- a/src/app/mainview/components/KeyboardShortcutKeyDelegate.qml +++ b/src/app/mainview/components/KeyboardShortcutKeyDelegate.qml @@ -15,10 +15,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts - import net.jami.Constants 1.1 RowLayout { @@ -62,9 +60,7 @@ RowLayout { anchors.centerIn: parent - text: shortcut2 === "" ? - shortcut : - shortcut + " + " + shortcut2 + text: shortcut2 === "" ? shortcut : shortcut + " + " + shortcut2 font.pointSize: JamiTheme.textFontSize + 3 font.weight: Font.DemiBold color: JamiTheme.textColor diff --git a/src/app/mainview/components/KeyboardShortcutTabButton.qml b/src/app/mainview/components/KeyboardShortcutTabButton.qml index 400f6ad4bb67000c304a99d163cf2b43ef00cd08..39b6e173a97050799b5d4c4277e42de400680576 100644 --- a/src/app/mainview/components/KeyboardShortcutTabButton.qml +++ b/src/app/mainview/components/KeyboardShortcutTabButton.qml @@ -15,10 +15,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls - import net.jami.Constants 1.1 TabButton { @@ -36,10 +34,7 @@ TabButton { } background: Rectangle { - color: root.hovered ? JamiTheme.hoveredButtonColor : - (root.down || root.currentIndex === index) ? - JamiTheme.pressedButtonColor : - JamiTheme.normalButtonColor + color: root.hovered ? JamiTheme.hoveredButtonColor : (root.down || root.currentIndex === index) ? JamiTheme.pressedButtonColor : JamiTheme.normalButtonColor radius: JamiTheme.primaryRadius } } diff --git a/src/app/mainview/components/KeyboardShortcutTable.qml b/src/app/mainview/components/KeyboardShortcutTable.qml index 95287eb0c37d340b616d220af425ea7c6b63e1cc..39561e1e942f966c055317a8895b89d623a56c7e 100644 --- a/src/app/mainview/components/KeyboardShortcutTable.qml +++ b/src/app/mainview/components/KeyboardShortcutTable.qml @@ -15,15 +15,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Window import QtQuick.Controls import QtQuick.Layouts - import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" Window { @@ -239,14 +236,13 @@ Window { text: { switch (selectionBar.currentIndex) { case 0: - return JamiStrings.generalSettingsTitle + return JamiStrings.generalSettingsTitle; case 1: - return JamiStrings.conversationKeyboardShortcuts + return JamiStrings.conversationKeyboardShortcuts; case 2: - return JamiStrings.callKeyboardShortcuts + return JamiStrings.callKeyboardShortcuts; case 3: - return JamiStrings.settings - + return JamiStrings.settings; } } color: JamiTheme.textColor @@ -261,27 +257,23 @@ Window { anchors.horizontalCenter: parent.horizontalCenter width: parent.width - height: parent.height - titleRect.height - JamiTheme.titleRectMargin - - keyboardShortCutList.anchors.topMargin - selectionBar.height - - selectionBar.anchors.bottomMargin + height: parent.height - titleRect.height - JamiTheme.titleRectMargin - keyboardShortCutList.anchors.topMargin - selectionBar.height - selectionBar.anchors.bottomMargin model: { switch (selectionBar.currentIndex) { case 0: - return keyboardGeneralShortcutsModel + return keyboardGeneralShortcutsModel; case 1: - return keyboardConversationShortcutsModel + return keyboardConversationShortcutsModel; case 2: - return keyboardCallsShortcutsModel + return keyboardCallsShortcutsModel; case 3: - return keyboardSettingsShortcutsModel - + return keyboardSettingsShortcutsModel; } } delegate: KeyboardShortcutKeyDelegate { width: keyboardShortCutList.width - height: Math.max(JamiTheme.keyboardShortcutDelegateSize, - implicitHeight) + height: Math.max(JamiTheme.keyboardShortcutDelegateSize, implicitHeight) } } diff --git a/src/app/mainview/components/MainOverlay.qml b/src/app/mainview/components/MainOverlay.qml index d207b3a61b7bfaebcfae855a80cb19f62f5004c2..7d6daf516a1efe91273347b96a5d4db836f416a0 100644 --- a/src/app/mainview/components/MainOverlay.qml +++ b/src/app/mainview/components/MainOverlay.qml @@ -18,14 +18,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" Item { @@ -38,29 +35,25 @@ Item { target: CurrentCall function onIsRecordingRemotelyChanged() { - var label = "" + var label = ""; if (CurrentCall.isRecordingRemotely) { - label = CurrentCall.remoteRecorderNameList.join(", ") + " " - label += (CurrentCall.remoteRecorderNameList.length > 1) ? - JamiStrings.areRecording : JamiStrings.isRecording + label = CurrentCall.remoteRecorderNameList.join(", ") + " "; + label += (CurrentCall.remoteRecorderNameList.length > 1) ? JamiStrings.areRecording : JamiStrings.isRecording; } - root.remoteRecordingLabel = label + root.remoteRecordingLabel = label; } } property alias callActionBar: __callActionBar - property bool frozen: callActionBar.overflowOpen || - callActionBar.barHovered || - callActionBar.subMenuOpen || - participantCallInStatusView.visible + property bool frozen: callActionBar.overflowOpen || callActionBar.barHovered || callActionBar.subMenuOpen || participantCallInStatusView.visible property string muteAlertMessage: "" property bool muteAlertActive: false onMuteAlertActiveChanged: { if (muteAlertActive) { - alertTimer.restart() + alertTimer.restart(); } } @@ -69,8 +62,7 @@ Item { // (un)subscribe to an app-wide mouse move event trap filtered // for the overlay's geometry onVisibleChanged: { - visible ? CallOverlayModel.registerFilter(appWindow, this) : - CallOverlayModel.unregisterFilter(appWindow, this) + visible ? CallOverlayModel.registerFilter(appWindow, this) : CallOverlayModel.unregisterFilter(appWindow, this); } Connections { @@ -78,8 +70,8 @@ Item { function onMouseMoved(item) { if (item === root) { - root.opacity = 1 - fadeOutTimer.restart() + root.opacity = 1; + fadeOutTimer.restart(); } } } @@ -89,9 +81,9 @@ Item { enabled: root.visible context: Qt.ApplicationShortcut onActivated: { - CallAdapter.muteAudioToggle() - root.opacity = 1 - fadeOutTimer.restart() + CallAdapter.muteAudioToggle(); + root.opacity = 1; + fadeOutTimer.restart(); } } @@ -100,9 +92,9 @@ Item { enabled: root.visible context: Qt.ApplicationShortcut onActivated: { - CallAdapter.muteCameraToggle() - root.opacity = 1 - fadeOutTimer.restart() + CallAdapter.muteCameraToggle(); + root.opacity = 1; + fadeOutTimer.restart(); } } @@ -112,9 +104,9 @@ Item { interval: JamiTheme.overlayFadeDelay onTriggered: { if (frozen) - return - root.opacity = 0 - resetLabelsTimer.restart() + return; + root.opacity = 0; + resetLabelsTimer.restart(); } } @@ -125,11 +117,9 @@ Item { running: root.visible repeat: true onTriggered: { - root.timeText = CallAdapter.getCallDurationTime( - LRCInstance.currentAccountId, - LRCInstance.selectedConvUid) + root.timeText = CallAdapter.getCallDurationTime(LRCInstance.currentAccountId, LRCInstance.selectedConvUid); if (!root.opacity && !CurrentCall.isRecordingRemotely) - root.remoteRecordingLabel = "" + root.remoteRecordingLabel = ""; } } @@ -162,12 +152,12 @@ Item { text: { if (!CurrentCall.isAudioOnly) { if (root.remoteRecordingLabel === "") { - return CurrentConversation.title + return CurrentConversation.title; } else { - return root.remoteRecordingLabel + return root.remoteRecordingLabel; } } - return "" + return ""; } color: JamiTheme.whiteColor elide: Qt.ElideRight @@ -202,7 +192,7 @@ Item { radius: height / 2 color: JamiTheme.recordIconColor - SequentialAnimation on color { + SequentialAnimation on color { loops: Animation.Infinite running: recordingRect.visible ColorAnimation { @@ -258,7 +248,7 @@ Item { id: alertTimer interval: JamiTheme.overlayFadeDelay onTriggered: { - root.muteAlertActive = false + root.muteAlertActive = false; } } } @@ -277,7 +267,7 @@ Item { visible: root.opacity } - Behavior on opacity { + Behavior on opacity { NumberAnimation { duration: JamiTheme.overlayFadeDuration } diff --git a/src/app/mainview/components/MediaPreview.qml b/src/app/mainview/components/MediaPreview.qml index cdef5b3950e962522f94ebcc0cc1f0148e555b69..2b25e3fb136a0a452ee8b7c0ec508cb8bad46954 100644 --- a/src/app/mainview/components/MediaPreview.qml +++ b/src/app/mainview/components/MediaPreview.qml @@ -19,11 +19,9 @@ import QtQuick.Controls import QtQuick.Layouts import Qt.labs.platform import Qt5Compat.GraphicalEffects - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" import "../../settingsview/components" @@ -33,7 +31,7 @@ Component { Rectangle { id: localMediaRect - width: (flickableWidth - spacingLength) / numberElementsPerRow + width: (flickableWidth - spacingLength) / numberElementsPerRow height: width color: "transparent" @@ -70,7 +68,7 @@ Component { height: localMediaCompLoader.height Rectangle { anchors.centerIn: parent - width: localMediaCompLoader.width + width: localMediaCompLoader.width height: localMediaCompLoader.height radius: JamiTheme.swarmDetailsPageDocumentsMediaRadius } @@ -84,19 +82,20 @@ Component { anchors.fill: parent anchors.margins: 2 sourceComponent: { - if (mediaInfo.isImage || mediaInfo.isAnimatedImage ) - return imageMediaComp + if (mediaInfo.isImage || mediaInfo.isAnimatedImage) + return imageMediaComp; else if (WITH_WEBENGINE) - return avMediaComp + return avMediaComp; } Component { id: avMediaComp Loader { Component.onCompleted: { - var qml = WITH_WEBENGINE ? - "qrc:/webengine/VideoPreview.qml" : - "qrc:/nowebengine/VideoPreview.qml" - setSource( qml, { isVideo: mediaInfo.isVideo, html:mediaInfo.html } ) + var qml = WITH_WEBENGINE ? "qrc:/webengine/VideoPreview.qml" : "qrc:/nowebengine/VideoPreview.qml"; + setSource(qml, { + "isVideo": mediaInfo.isVideo, + "html": mediaInfo.html + }); } property real msgRadius: 20 @@ -118,7 +117,7 @@ Component { height: fileImage.height Rectangle { anchors.centerIn: parent - width: fileImage.width + width: fileImage.width height: fileImage.height radius: JamiTheme.swarmDetailsPageDocumentsMediaRadius } @@ -130,16 +129,16 @@ Component { acceptedButtons: Qt.LeftButton | Qt.RightButton onEntered: { - cursorShape = Qt.PointingHandCursor + cursorShape = Qt.PointingHandCursor; } - onClicked: function(mouse) { + onClicked: function (mouse) { if (mouse.button === Qt.RightButton) { - ctxMenu.x = mouse.x - ctxMenu.y = mouse.y - ctxMenu.openMenu() + ctxMenu.x = mouse.x; + ctxMenu.y = mouse.y; + ctxMenu.openMenu(); } else { - MessagesAdapter.openUrl(fileImage.source) + MessagesAdapter.openUrl(fileImage.source); } } } diff --git a/src/app/mainview/components/MessageBar.qml b/src/app/mainview/components/MessageBar.qml index 16dfa6307299bafd3aa48f595670b4ebc437fa89..f0bd91f53d4299e34bb032ec63a7475cfb60a860 100644 --- a/src/app/mainview/components/MessageBar.qml +++ b/src/app/mainview/components/MessageBar.qml @@ -15,14 +15,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts - import net.jami.Adapters 1.1 import net.jami.Models 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" ColumnLayout { @@ -161,7 +158,7 @@ ColumnLayout { // forward activeFocus to the actual text area object onActiveFocusChanged: { if (activeFocus) - textAreaObj.forceActiveFocus() + textAreaObj.forceActiveFocus(); } placeholderText: JamiStrings.writeTo.arg(CurrentConversation.title) @@ -170,11 +167,9 @@ ColumnLayout { Layout.fillWidth: true Layout.margins: marginSize / 2 Layout.preferredHeight: { - return JamiTheme.chatViewFooterPreferredHeight - > contentHeight ? JamiTheme.chatViewFooterPreferredHeight : contentHeight + return JamiTheme.chatViewFooterPreferredHeight > contentHeight ? JamiTheme.chatViewFooterPreferredHeight : contentHeight; } - Layout.maximumHeight: JamiTheme.chatViewFooterTextAreaMaximumHeight - - marginSize / 2 + Layout.maximumHeight: JamiTheme.chatViewFooterTextAreaMaximumHeight - marginSize / 2 onSendMessagesRequired: root.sendMessageButtonClicked() onTextChanged: MessagesAdapter.userIsComposing(text ? true : false) @@ -228,7 +223,7 @@ ColumnLayout { visible: opacity scale: opacity - Behavior on opacity { + Behavior on opacity { enabled: animate NumberAnimation { duration: JamiTheme.shortFadeDuration diff --git a/src/app/mainview/components/MessageBarTextArea.qml b/src/app/mainview/components/MessageBarTextArea.qml index 869edcc295c05490f5ca5724b3087bbfbac16b21..21b37f437f066ae3a469102a60a2ae14dd0614bb 100644 --- a/src/app/mainview/components/MessageBarTextArea.qml +++ b/src/app/mainview/components/MessageBarTextArea.qml @@ -15,13 +15,10 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls - import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" JamiFlickable { @@ -37,15 +34,15 @@ JamiFlickable { signal sendMessagesRequired function insertText(text) { - textArea.insert(textArea.cursorPosition, text) + textArea.insert(textArea.cursorPosition, text); } function clearText() { - textArea.clear() + textArea.clear(); } function pasteText() { - textArea.paste() + textArea.paste(); } LineEditContextMenu { @@ -56,7 +53,7 @@ JamiFlickable { onContextMenuRequirePaste: { // Intercept paste event to use C++ QMimeData - MessagesAdapter.onPaste() + MessagesAdapter.onPaste(); } } @@ -89,14 +86,14 @@ JamiFlickable { onReleased: function (event) { if (event.button === Qt.RightButton) - textAreaContextMenu.openMenuAt(event) + textAreaContextMenu.openMenuAt(event); } onTextChanged: { if (text) - MessagesAdapter.userIsComposing(true) + MessagesAdapter.userIsComposing(true); else - MessagesAdapter.userIsComposing(false) + MessagesAdapter.userIsComposing(false); } // Intercept paste event to use C++ QMimeData @@ -105,23 +102,22 @@ JamiFlickable { // Shift + Enter -> Next Line Keys.onPressed: function (keyEvent) { if (keyEvent.matches(StandardKey.Paste)) { - MessagesAdapter.onPaste() - keyEvent.accepted = true + MessagesAdapter.onPaste(); + keyEvent.accepted = true; } else if (keyEvent.matches(StandardKey.MoveToPreviousLine)) { if (root.text !== "") - return - MessagesAdapter.replyToId = "" - MessagesAdapter.editId = CurrentConversation.lastSelfMessageId + return; + MessagesAdapter.replyToId = ""; + MessagesAdapter.editId = CurrentConversation.lastSelfMessageId; keyEvent.accepted = true; - } else if (keyEvent.key === Qt.Key_Enter || - keyEvent.key === Qt.Key_Return) { + } else if (keyEvent.key === Qt.Key_Enter || keyEvent.key === Qt.Key_Return) { if (!(keyEvent.modifiers & Qt.ShiftModifier)) { - root.sendMessagesRequired() - keyEvent.accepted = true + root.sendMessagesRequired(); + keyEvent.accepted = true; } } else if (keyEvent.key === Qt.Key_Tab) { - nextItemInFocusChain().forceActiveFocus(Qt.TabFocusReason) - keyEvent.accepted = true + nextItemInFocusChain().forceActiveFocus(Qt.TabFocusReason); + keyEvent.accepted = true; } } } diff --git a/src/app/mainview/components/MessagesResearchPanel.qml b/src/app/mainview/components/MessagesResearchPanel.qml index 1f0bf30901288085476c3d4829c88a19bd325de8..f98cf722ad7dbba92bbf4e208f9be33a6ff561c6 100644 --- a/src/app/mainview/components/MessagesResearchPanel.qml +++ b/src/app/mainview/components/MessagesResearchPanel.qml @@ -15,17 +15,14 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts import Qt.labs.platform import Qt5Compat.GraphicalEffects - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" import "../../settingsview/components" @@ -44,13 +41,13 @@ Rectangle { Layout.preferredHeight: contentHeight + 10 Layout.preferredWidth: root.width background.visible: false - signal filterTabChange() + signal filterTabChange onCurrentIndexChanged: { - filterTabChange() + filterTabChange(); } onVisibleChanged: { - researchTabBar.currentIndex = 0 + researchTabBar.currentIndex = 0; } FilterTabButton { @@ -69,7 +66,6 @@ Rectangle { } FilterTabButton { - id: fileResearchTabButton backgroundColor: "transparent" hoverColor: "transparent" diff --git a/src/app/mainview/components/MessagesResearchView.qml b/src/app/mainview/components/MessagesResearchView.qml index 857bc138d01f660815368992af387242c33c50ca..85b7e355459f1be2e12227dd987cd0922c42e47d 100644 --- a/src/app/mainview/components/MessagesResearchView.qml +++ b/src/app/mainview/components/MessagesResearchView.qml @@ -15,23 +15,19 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts import Qt.labs.platform import Qt5Compat.GraphicalEffects import SortFilterProxyModel - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" import "../../settingsview/components" - -ListView { +ListView { id: root spacing: 10 @@ -41,9 +37,7 @@ ListView { property var messageListModel: MessagesAdapter.mediaMessageListModel readonly property int textType: Interaction.Type.TEXT - onMessageListModelChanged: sourceModel = root.visible && messageListModel ? - messageListModel : - null + onMessageListModelChanged: sourceModel = root.visible && messageListModel ? messageListModel : null filters: ExpressionFilter { expression: Type === proxyModel.textType @@ -53,13 +47,13 @@ ListView { property var prompt: MessagesAdapter.searchbarPrompt onPromptChanged: { - MessagesAdapter.startSearch(prompt) + MessagesAdapter.startSearch(prompt); } Connections { target: researchTabBar function onFilterTabChange() { - MessagesAdapter.startSearch(prompt) + MessagesAdapter.startSearch(prompt); } } @@ -106,9 +100,7 @@ ListView { ColumnLayout { Text { - text: contentRow.isMe - ? CurrentAccount.bestName - : UtilsAdapter.getBestNameForUri(CurrentAccount.id, Author) + " :" + text: contentRow.isMe ? CurrentAccount.bestName : UtilsAdapter.getBestNameForUri(CurrentAccount.id, Author) + " :" Layout.preferredWidth: myText.width Layout.rightMargin: 10 Layout.leftMargin: 10 @@ -126,8 +118,8 @@ ListView { elide: Text.ElideRight Layout.rightMargin: 10 Layout.leftMargin: 10 - font.pixelSize: IsEmojiOnly? JamiTheme.chatviewEmojiSize : JamiTheme.chatviewFontSize - Layout.alignment:Qt.AlignHCenter + font.pixelSize: IsEmojiOnly ? JamiTheme.chatviewEmojiSize : JamiTheme.chatviewFontSize + Layout.alignment: Qt.AlignHCenter } } } @@ -146,7 +138,7 @@ ListView { background.visible: false onClicked: { - CurrentConversation.scrollToMsg(Id) + CurrentConversation.scrollToMsg(Id); } Text { @@ -160,6 +152,4 @@ ListView { } } } - } - diff --git a/src/app/mainview/components/NewSwarmPage.qml b/src/app/mainview/components/NewSwarmPage.qml index 447eb6b6c95b7e762ee5493fba74b688b204d64d..a3194a4fe8a7f692bed53a54a5ecf833153fa09e 100644 --- a/src/app/mainview/components/NewSwarmPage.qml +++ b/src/app/mainview/components/NewSwarmPage.qml @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2022-2023 Savoir-faire Linux Inc. * Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com> * @@ -15,15 +15,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" DualPaneView { @@ -34,9 +31,9 @@ DualPaneView { signal removeMember(string convId, string member) onVisibleChanged: { - UtilsAdapter.setTempCreationImageFromString() - title.clear() - description.clear() + UtilsAdapter.setTempCreationImageFromString(); + title.clear(); + description.clear(); } property var members: [] @@ -154,21 +151,19 @@ DualPaneView { placeholderText: JamiStrings.swarmName tooltipText: JamiStrings.swarmName backgroundColor: root.color - color: UtilsAdapter.luma(backgroundColor) ? - JamiTheme.chatviewTextColorLight : - JamiTheme.chatviewTextColorDark + color: UtilsAdapter.luma(backgroundColor) ? JamiTheme.chatviewTextColorLight : JamiTheme.chatviewTextColorDark placeholderTextColor: { if (editable) { if (UtilsAdapter.luma(root.color)) { - return JamiTheme.placeholderTextColorWhite + return JamiTheme.placeholderTextColorWhite; } else { - return JamiTheme.placeholderTextColor + return JamiTheme.placeholderTextColor; } } else { if (UtilsAdapter.luma(root.color)) { - return JamiTheme.chatviewTextColorLight + return JamiTheme.chatviewTextColorLight; } else { - return JamiTheme.chatviewTextColorDark + return JamiTheme.chatviewTextColorDark; } } } @@ -188,21 +183,19 @@ DualPaneView { placeholderText: JamiStrings.addADescription tooltipText: JamiStrings.addADescription backgroundColor: root.color - color: UtilsAdapter.luma(backgroundColor) ? - JamiTheme.chatviewTextColorLight : - JamiTheme.chatviewTextColorDark + color: UtilsAdapter.luma(backgroundColor) ? JamiTheme.chatviewTextColorLight : JamiTheme.chatviewTextColorDark placeholderTextColor: { if (editable) { if (UtilsAdapter.luma(root.color)) { - return JamiTheme.placeholderTextColorWhite + return JamiTheme.placeholderTextColorWhite; } else { - return JamiTheme.placeholderTextColor + return JamiTheme.placeholderTextColor; } } else { if (UtilsAdapter.luma(root.color)) { - return JamiTheme.chatviewTextColorLight + return JamiTheme.chatviewTextColorLight; } else { - return JamiTheme.chatviewTextColorDark + return JamiTheme.chatviewTextColorDark; } } } @@ -228,9 +221,7 @@ DualPaneView { primary: true text: JamiStrings.createTheSwarm - onClicked: createSwarmClicked(title.text, - description.text, - UtilsAdapter.tempCreationImage()) + onClicked: createSwarmClicked(title.text, description.text, UtilsAdapter.tempCreationImage()) } } } diff --git a/src/app/mainview/components/NotificationArea.qml b/src/app/mainview/components/NotificationArea.qml index 35baf670fc1fc7d96d54b0566e0aed0c03c15805..9e2581b155af3ff69f9e01c80a2092a48f27b2ed 100644 --- a/src/app/mainview/components/NotificationArea.qml +++ b/src/app/mainview/components/NotificationArea.qml @@ -14,16 +14,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts import Qt5Compat.GraphicalEffects - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" Rectangle { @@ -36,9 +33,7 @@ Rectangle { property string uri: "" property string device: "" - property string textColor: UtilsAdapter.luma(root.color) ? - JamiTheme.chatviewTextColorLight : - JamiTheme.chatviewTextColorDark + property string textColor: UtilsAdapter.luma(root.color) ? JamiTheme.chatviewTextColorLight : JamiTheme.chatviewTextColorDark RowLayout { anchors.fill: parent anchors.margins: JamiTheme.preferredMarginSize @@ -103,10 +98,10 @@ Rectangle { } } - Behavior on opacity { + Behavior on opacity { NumberAnimation { from: 0 duration: JamiTheme.shortFadeDuration } } -} \ No newline at end of file +} diff --git a/src/app/mainview/components/OngoingCallPage.qml b/src/app/mainview/components/OngoingCallPage.qml index 1ae48946fdbc0bfaf8e1ab5b1e3ffee0519be43c..4564e904a3b1a62e2fecc25f424afded9bde7d06 100644 --- a/src/app/mainview/components/OngoingCallPage.qml +++ b/src/app/mainview/components/OngoingCallPage.qml @@ -17,17 +17,14 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts import Qt5Compat.GraphicalEffects - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Enums 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" Rectangle { @@ -43,7 +40,7 @@ Rectangle { property string callPreviewId onCallPreviewIdChanged: { - controlPreview.start() + controlPreview.start(); } color: "black" @@ -51,7 +48,8 @@ Rectangle { Connections { target: CurrentConversation function onIdChanged() { - if (CurrentConversation.id !== "") contactImage.imageId = CurrentConversation.id + if (CurrentConversation.id !== "") + contactImage.imageId = CurrentConversation.id; } } @@ -59,70 +57,65 @@ Rectangle { target: UtilsAdapter function onChatviewPositionChanged() { - mainColumnLayout.isHorizontal = UtilsAdapter.getAppValue(Settings.Key.ShowChatviewHorizontally) + mainColumnLayout.isHorizontal = UtilsAdapter.getAppValue(Settings.Key.ShowChatviewHorizontally); } } function openInCallConversation() { - mainColumnLayout.isHorizontal = UtilsAdapter.getAppValue(Settings.Key.ShowChatviewHorizontally) - chatViewContainer.visible = false - chatViewContainer.visible = true + mainColumnLayout.isHorizontal = UtilsAdapter.getAppValue(Settings.Key.ShowChatviewHorizontally); + chatViewContainer.visible = false; + chatViewContainer.visible = true; } function closeInCallConversation() { - chatViewContainer.visible = false + chatViewContainer.visible = false; } function closeContextMenuAndRelatedWindows() { - callOverlay.closeContextMenuAndRelatedWindows() + callOverlay.closeContextMenuAndRelatedWindows(); } function previewMagneticSnap() { // Calculate the position where the previewRenderer should attach to. - var previewRendererCenter = Qt.point( - previewRenderer.x + previewRenderer.width / 2, - previewRenderer.y + previewRenderer.height / 2) - var parentCenter = Qt.point( - parent.x + parent.width / 2, - parent.y + parent.height / 2) - + var previewRendererCenter = Qt.point(previewRenderer.x + previewRenderer.width / 2, previewRenderer.y + previewRenderer.height / 2); + var parentCenter = Qt.point(parent.x + parent.width / 2, parent.y + parent.height / 2); if (previewRendererCenter.x >= parentCenter.x) { if (previewRendererCenter.y >= parentCenter.y) { // Bottom right. previewToX = Qt.binding(function () { - return callPageMainRect.width - previewRenderer.width - previewMargin - }) + return callPageMainRect.width - previewRenderer.width - previewMargin; + }); previewToY = Qt.binding(function () { - return callPageMainRect.height - previewRenderer.height - previewMarginYBottom - }) + return callPageMainRect.height - previewRenderer.height - previewMarginYBottom; + }); } else { // Top right. previewToX = Qt.binding(function () { - return callPageMainRect.width - previewRenderer.width - previewMargin - }) - previewToY = previewMarginYTop + return callPageMainRect.width - previewRenderer.width - previewMargin; + }); + previewToY = previewMarginYTop; } } else { if (previewRendererCenter.y >= parentCenter.y) { // Bottom left. - previewToX = previewMargin + previewToX = previewMargin; previewToY = Qt.binding(function () { - return callPageMainRect.height - previewRenderer.height - previewMarginYBottom - }) + return callPageMainRect.height - previewRenderer.height - previewMarginYBottom; + }); } else { // Top left. - previewToX = previewMargin - previewToY = previewMarginYTop + previewToX = previewMargin; + previewToY = previewMarginYTop; } } - previewRenderer.state = "geoChanging" + previewRenderer.state = "geoChanging"; } onWidthChanged: { if (chatViewContainer.visible && root.width < JamiTheme.mainViewPaneMinWidth * 2) { - callPageMainRect.visible = false + callPageMainRect.visible = false; } else { - callPageMainRect.visible = true + callPageMainRect.visible = true; } } @@ -137,9 +130,7 @@ Rectangle { handle: Rectangle { implicitWidth: isHorizontal ? JamiTheme.splitViewHandlePreferredWidth : root.width implicitHeight: isHorizontal ? root.height : JamiTheme.splitViewHandlePreferredWidth - color: SplitHandle.pressed ? JamiTheme.pressColor : - (SplitHandle.hovered ? JamiTheme.hoverColor : - JamiTheme.tabbarBorderColor) + color: SplitHandle.pressed ? JamiTheme.pressColor : (SplitHandle.hovered ? JamiTheme.hoverColor : JamiTheme.tabbarBorderColor) } Rectangle { @@ -154,21 +145,16 @@ Rectangle { onDoubleTapped: function (eventPoint, button) { if (button === Qt.LeftButton) { - callStackView.toggleFullScreen() + callStackView.toggleFullScreen(); } } onTapped: function (eventPoint, button) { if (button === Qt.RightButton) { - var isOnLocal = eventPoint.position.x >= previewRenderer.x && eventPoint.position.x <= previewRenderer.x + previewRenderer.width - isOnLocal &= eventPoint.position.y >= previewRenderer.y && eventPoint.position.y <= previewRenderer.y + previewRenderer.height - isOnLocal |= participantsLayer.hoveredOverlaySinkId.indexOf("camera://") === 0 - callOverlay.openCallViewContextMenuInPos(eventPoint.position.x, - eventPoint.position.y, - participantsLayer.hoveredOverlayUri, - participantsLayer.hoveredOverlaySinkId, - participantsLayer.hoveredOverVideoMuted, - isOnLocal) + var isOnLocal = eventPoint.position.x >= previewRenderer.x && eventPoint.position.x <= previewRenderer.x + previewRenderer.width; + isOnLocal &= eventPoint.position.y >= previewRenderer.y && eventPoint.position.y <= previewRenderer.y + previewRenderer.height; + isOnLocal |= participantsLayer.hoveredOverlaySinkId.indexOf("camera://") === 0; + callOverlay.openCallViewContextMenuInPos(eventPoint.position.x, eventPoint.position.y, participantsLayer.hoveredOverlayUri, participantsLayer.hoveredOverlaySinkId, participantsLayer.hoveredOverVideoMuted, isOnLocal); } } } @@ -200,14 +186,13 @@ Rectangle { anchors.fill: parent function instantiateToast() { - instantiate(JamiStrings.screenshotTaken.arg(UtilsAdapter.getDirScreenshot()),1000,400) + instantiate(JamiStrings.screenshotTaken.arg(UtilsAdapter.getDirScreenshot()), 1000, 400); } } LocalVideo { id: previewRenderer - visible: (CurrentCall.isSharing || !CurrentCall.isVideoMuted) - && !CurrentCall.isConference + visible: (CurrentCall.isSharing || !CurrentCall.isVideoMuted) && !CurrentCall.isConference height: width * invAspectRatio width: Math.max(callPageMainRect.width / 5, JamiTheme.minimumPreviewWidth) @@ -222,21 +207,21 @@ Rectangle { property bool startVideo interval: 1000 onTriggered: { - var rendId = visible && startVideo ? root.callPreviewId : "" - previewRenderer.startWithId(rendId) + var rendId = visible && startVideo ? root.callPreviewId : ""; + previewRenderer.startWithId(rendId); } } onVisibleChanged: { - controlPreview.stop() + controlPreview.stop(); if (visible) { - controlPreview.startVideo = true - controlPreview.interval = 1000 + controlPreview.startVideo = true; + controlPreview.interval = 1000; } else { - controlPreview.startVideo = false - controlPreview.interval = 0 + controlPreview.startVideo = false; + controlPreview.interval = 0; } - controlPreview.start() + controlPreview.start(); } states: [ @@ -257,7 +242,7 @@ Rectangle { duration: 250 onStopped: { - previewRenderer.state = "" + previewRenderer.state = ""; } } } @@ -268,28 +253,25 @@ Rectangle { anchors.fill: previewRenderer onPressed: function (mouse) { - clickPos = Qt.point(mouse.x, mouse.y) + clickPos = Qt.point(mouse.x, mouse.y); } onReleased: { - previewRenderer.state = "" - previewMagneticSnap() + previewRenderer.state = ""; + previewMagneticSnap(); } onPositionChanged: function (mouse) { // Calculate mouse position relative change. - var delta = Qt.point(mouse.x - clickPos.x, - mouse.y - clickPos.y) - var deltaW = previewRenderer.x + delta.x + previewRenderer.width - var deltaH = previewRenderer.y + delta.y + previewRenderer.height + var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y); + var deltaW = previewRenderer.x + delta.x + previewRenderer.width; + var deltaH = previewRenderer.y + delta.y + previewRenderer.height; // Check if the previewRenderer exceeds the border of callPageMainRect. - if (deltaW < callPageMainRect.width - && previewRenderer.x + delta.x > 1) - previewRenderer.x += delta.x - if (deltaH < callPageMainRect.height - && previewRenderer.y + delta.y > 1) - previewRenderer.y += delta.y + if (deltaW < callPageMainRect.width && previewRenderer.x + delta.x > 1) + previewRenderer.x += delta.x; + if (deltaH < callPageMainRect.height && previewRenderer.y + delta.y > 1) + previewRenderer.y += delta.y; } } @@ -310,16 +292,16 @@ Rectangle { function toggleConversation() { if (inCallMessageWebViewStack.visible) - closeInCallConversation() + closeInCallConversation(); else - openInCallConversation() + openInCallConversation(); } Connections { target: CurrentCall function onPreviewIdChanged() { - root.callPreviewId = CurrentCall.previewId + root.callPreviewId = CurrentCall.previewId; } } @@ -329,35 +311,30 @@ Rectangle { function onNewInteraction(id, interactionType) { // Ignore call notifications, as we are in the call. - if (interactionType !== Interaction.Type.CALL && - !chatViewContainer.visible) - openInCallConversation() + if (interactionType !== Interaction.Type.CALL && !chatViewContainer.visible) + openInCallConversation(); } } onCloseClicked: { - participantsLayer.hoveredOverlayUri = "" - participantsLayer.hoveredOverlaySinkId = "" - participantsLayer.hoveredOverVideoMuted = true + participantsLayer.hoveredOverlayUri = ""; + participantsLayer.hoveredOverlaySinkId = ""; + participantsLayer.hoveredOverVideoMuted = true; } onChatButtonClicked: { - var detailsVisible = chatViewContainer.showDetails - chatViewContainer.showDetails = false - !chatViewContainer.visible || detailsVisible ? - openInCallConversation() : - closeInCallConversation() + var detailsVisible = chatViewContainer.showDetails; + chatViewContainer.showDetails = false; + !chatViewContainer.visible || detailsVisible ? openInCallConversation() : closeInCallConversation(); } onFullScreenClicked: { - callStackView.toggleFullScreen() + callStackView.toggleFullScreen(); } onSwarmDetailsClicked: { - chatViewContainer.showDetails = !chatViewContainer.showDetails - chatViewContainer.showDetails ? - openInCallConversation() : - closeInCallConversation() + chatViewContainer.showDetails = !chatViewContainer.showDetails; + chatViewContainer.showDetails ? openInCallConversation() : closeInCallConversation(); } } @@ -368,9 +345,7 @@ Rectangle { anchors.left: parent.left anchors.right: parent.right - visible: !CurrentCall.isPaused && - CurrentCall.isAudioOnly && - !CurrentCall.isConference + visible: !CurrentCall.isPaused && CurrentCall.isAudioOnly && !CurrentCall.isConference ConversationAvatar { id: contactImage @@ -406,12 +381,8 @@ Rectangle { id: chatViewContainer objectName: "CallViewChatViewContainer" - SplitView.preferredHeight: mainColumnLayout.isHorizontal ? - root.height : - root.height / 3 - SplitView.preferredWidth: mainColumnLayout.isHorizontal ? - JamiTheme.mainViewPaneMinWidth : - root.width + SplitView.preferredHeight: mainColumnLayout.isHorizontal ? root.height : root.height / 3 + SplitView.preferredWidth: mainColumnLayout.isHorizontal ? JamiTheme.mainViewPaneMinWidth : root.width SplitView.minimumWidth: JamiTheme.mainViewPaneMinWidth visible: false clip: true @@ -419,9 +390,9 @@ Rectangle { onVisibleChanged: { if (visible && root.width < JamiTheme.mainViewPaneMinWidth * 2) { - callPageMainRect.visible = false + callPageMainRect.visible = false; } else { - callPageMainRect.visible = true + callPageMainRect.visible = true; } } } diff --git a/src/app/mainview/components/ParticipantCallInStatusDelegate.qml b/src/app/mainview/components/ParticipantCallInStatusDelegate.qml index 6792c1f16fa08352ddd1ca84c74462ae4ce2dc3a..c86411de154735af77e6e37d1576feed4dea1455 100644 --- a/src/app/mainview/components/ParticipantCallInStatusDelegate.qml +++ b/src/app/mainview/components/ParticipantCallInStatusDelegate.qml @@ -15,14 +15,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts - import net.jami.Adapters 1.1 import net.jami.Models 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" SpinningAnimation { @@ -40,8 +37,7 @@ SpinningAnimation { anchors.centerIn: root - width: JamiTheme.participantCallInStatusViewWidth + callStatus.Layout.preferredWidth - - JamiTheme.participantCallInStatusTextWidth - spinningAnimationWidth + width: JamiTheme.participantCallInStatusViewWidth + callStatus.Layout.preferredWidth - JamiTheme.participantCallInStatusTextWidth - spinningAnimationWidth height: JamiTheme.participantCallInStatusDelegateHeight - spinningAnimationWidth color: JamiTheme.darkGreyColor @@ -100,15 +96,12 @@ SpinningAnimation { elide: Text.ElideRight onWidthChanged: { - if (width > JamiTheme.participantCallInStatusTextWidth - && width < JamiTheme.participantCallInStatusTextWidthLimit) - callStatus.Layout.preferredWidth = width + if (width > JamiTheme.participantCallInStatusTextWidth && width < JamiTheme.participantCallInStatusTextWidthLimit) + callStatus.Layout.preferredWidth = width; else if (width >= JamiTheme.participantCallInStatusTextWidthLimit) - callStatus.Layout.preferredWidth - = JamiTheme.participantCallInStatusTextWidthLimit + callStatus.Layout.preferredWidth = JamiTheme.participantCallInStatusTextWidthLimit; else - callStatus.Layout.preferredWidth - = JamiTheme.participantCallInStatusTextWidth + callStatus.Layout.preferredWidth = JamiTheme.participantCallInStatusTextWidth; } } } diff --git a/src/app/mainview/components/ParticipantCallInStatusView.qml b/src/app/mainview/components/ParticipantCallInStatusView.qml index 90f34f0fecbad1600676dcad2bbb487d54c20592..3427c2f34bbe05728a363270106df9792bd22119 100644 --- a/src/app/mainview/components/ParticipantCallInStatusView.qml +++ b/src/app/mainview/components/ParticipantCallInStatusView.qml @@ -15,25 +15,22 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" JamiListView { id: root - width: currentItem ? currentItem.width + currentItem.spinningAnimationWidth - : JamiTheme.participantCallInStatusViewWidth + width: currentItem ? currentItem.width + currentItem.spinningAnimationWidth : JamiTheme.participantCallInStatusViewWidth height: JamiTheme.participantCallInStatusDelegateHeight model: CallOverlayModel.pendingConferenceesModel() - delegate: ParticipantCallInStatusDelegate {} + delegate: ParticipantCallInStatusDelegate { + } visible: currentItem ? true : false @@ -41,17 +38,13 @@ JamiListView { target: model function onRowsInserted() { - var preferredHeight = JamiTheme.participantCallInStatusDelegateHeight * model.rowCount() - root.height = JamiTheme.participantCallInStatusViewHeight - < preferredHeight ? JamiTheme.participantCallInStatusViewHeight - : preferredHeight + var preferredHeight = JamiTheme.participantCallInStatusDelegateHeight * model.rowCount(); + root.height = JamiTheme.participantCallInStatusViewHeight < preferredHeight ? JamiTheme.participantCallInStatusViewHeight : preferredHeight; } function onRowsRemoved() { - var preferredHeight = JamiTheme.participantCallInStatusDelegateHeight * model.rowCount() - root.height = JamiTheme.participantCallInStatusViewHeight - < preferredHeight ? JamiTheme.participantCallInStatusViewHeight - : preferredHeight + var preferredHeight = JamiTheme.participantCallInStatusDelegateHeight * model.rowCount(); + root.height = JamiTheme.participantCallInStatusViewHeight < preferredHeight ? JamiTheme.participantCallInStatusViewHeight : preferredHeight; } } } diff --git a/src/app/mainview/components/ParticipantControlLayout.qml b/src/app/mainview/components/ParticipantControlLayout.qml index 4be9bc64ec9f93332f5fb68d3357fab83f670bb4..ff22f184f178ddb1760592e1167659d1fb0bb66f 100644 --- a/src/app/mainview/components/ParticipantControlLayout.qml +++ b/src/app/mainview/components/ParticipantControlLayout.qml @@ -15,22 +15,15 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick.Layouts - import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" RowLayout { id: root - property int visibleButtons: toggleModerator.visible - + toggleMute.visible - + maximizeParticipant.visible - + minimizeParticipant.visible - + hangupParticipant.visible + property int visibleButtons: toggleModerator.visible + toggleMute.visible + maximizeParticipant.visible + minimizeParticipant.visible + hangupParticipant.visible spacing: 8 @@ -44,8 +37,7 @@ RowLayout { Layout.alignment: Qt.AlignVCenter source: JamiResources.moderator_svg onClicked: CallAdapter.setModerator(uri, showSetModerator) - toolTipText: showSetModerator? JamiStrings.setModerator - : JamiStrings.unsetModerator + toolTipText: showSetModerator ? JamiStrings.setModerator : JamiStrings.unsetModerator } ParticipantOverlayButton { @@ -56,27 +48,25 @@ RowLayout { Layout.preferredHeight: buttonPreferredSize Layout.preferredWidth: buttonPreferredSize Layout.alignment: Qt.AlignVCenter - source: showModeratorMute ? - JamiResources.micro_black_24dp_svg : - JamiResources.micro_off_black_24dp_svg + source: showModeratorMute ? JamiResources.micro_black_24dp_svg : JamiResources.micro_off_black_24dp_svg checkable: meModerator onClicked: { if (participantIsModeratorMuted && isLocalMuted) { if (isMe) - muteAlertMessage = JamiStrings.mutedLocally + muteAlertMessage = JamiStrings.mutedLocally; else - muteAlertMessage = JamiStrings.participantMicIsStillMuted - muteAlertActive = true + muteAlertMessage = JamiStrings.participantMicIsStillMuted; + muteAlertActive = true; } - CallAdapter.muteParticipant(uri, deviceId, sinkId, showModeratorMute) + CallAdapter.muteParticipant(uri, deviceId, sinkId, showModeratorMute); } toolTipText: { if (!checkable && participantIsModeratorMuted) - return JamiStrings.mutedByModerator + return JamiStrings.mutedByModerator; if (showModeratorMute) - return JamiStrings.muteParticipant + return JamiStrings.muteParticipant; else - return JamiStrings.unmuteParticipant + return JamiStrings.unmuteParticipant; } } diff --git a/src/app/mainview/components/ParticipantOverlay.qml b/src/app/mainview/components/ParticipantOverlay.qml index a58ffc34fbcd5440a80035a1b7b94723e01e9a7e..e81ef4c870663149aea2548b623b9d3e71c2f757 100644 --- a/src/app/mainview/components/ParticipantOverlay.qml +++ b/src/app/mainview/components/ParticipantOverlay.qml @@ -17,16 +17,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import Qt5Compat.GraphicalEffects import QtQuick.Layouts import QtQuick.Shapes - import net.jami.Adapters 1.1 import net.jami.Models 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" Item { @@ -36,20 +33,14 @@ Item { property int shapeWidth: participantFootInfo.width + 8 property int shapeHeight: 30 property int shapeRadius: 5 - property string pathShape: "M0,0 h%1 q%2,0 %2,%2 v%3 h-%4 z" - .arg(shapeWidth - shapeRadius) - .arg(shapeRadius) - .arg(shapeHeight - shapeRadius) - .arg(shapeWidth) + property string pathShape: "M0,0 h%1 q%2,0 %2,%2 v%3 h-%4 z".arg(shapeWidth - shapeRadius).arg(shapeRadius).arg(shapeHeight - shapeRadius).arg(shapeWidth) property string uri: "" property string deviceId: "" property string bestName: "" property string sinkId: "" property bool participantIsActive: false - property bool canMaximize: root.meModerator && - (!root.participantIsActive - || CallParticipantsModel.conferenceLayout === CallParticipantsModel.ONE_WITH_SMALL) + property bool canMaximize: root.meModerator && (!root.participantIsActive || CallParticipantsModel.conferenceLayout === CallParticipantsModel.ONE_WITH_SMALL) property bool participantIsHost: CallAdapter.participantIsHost(uri) property bool participantIsModerator: false property bool participantIsMuted: isLocalMuted || participantIsModeratorMuted @@ -73,8 +64,7 @@ Item { function takeScreenshot() { if (!hoveredOverVideoMuted) { - if (CallAdapter.takeScreenshot(videoProvider.captureRawVideoFrame(hoveredOverlaySinkId), - UtilsAdapter.getDirScreenshot())) { + if (CallAdapter.takeScreenshot(videoProvider.captureRawVideoFrame(hoveredOverlaySinkId), UtilsAdapter.getDirScreenshot())) { toastManager.instantiateToast(); } } @@ -82,7 +72,7 @@ Item { onMuteAlertActiveChanged: { if (muteAlertActive) { - alertTimer.restart() + alertTimer.restart(); } } @@ -98,10 +88,10 @@ Item { interval: JamiTheme.overlayFadeDelay onTriggered: { if (overlayMenu.hovered) { - fadeOutTimer.restart() - return + fadeOutTimer.restart(); + return; } - participantRect.opacity = 0 + participantRect.opacity = 0; } } @@ -128,8 +118,8 @@ Item { underlayItems: Avatar { property real componentSize: Math.min(mediaDistRender.contentRect.width / 2, mediaDistRender.contentRect.height / 2) - height: componentSize - width: componentSize + height: componentSize + width: componentSize anchors.centerIn: parent // round the avatar source size up to some nearest multiple readonly property real step: 96 @@ -143,7 +133,7 @@ Item { // Only request avatars when visibility changes (and once) // This avoid to request images for non showed participants if (visible && !imageId) { - imageId = root.isMe ? LRCInstance.currentAccountId : root.uri + imageId = root.isMe ? LRCInstance.currentAccountId : root.uri; } } } @@ -160,7 +150,7 @@ Item { acceptedButtons: Qt.MiddleButton acceptedModifiers: Qt.ControlModifier onTapped: { - takeScreenshot() + takeScreenshot(); } } @@ -168,17 +158,17 @@ Item { id: hoverIndicator onPointChanged: { - participantRect.opacity = 1 - fadeOutTimer.restart() + participantRect.opacity = 1; + fadeOutTimer.restart(); } onHoveredChanged: { if (overlayMenu.hovered) { - participantRect.opacity = 1 - fadeOutTimer.restart() - return + participantRect.opacity = 1; + fadeOutTimer.restart(); + return; } - participantRect.opacity = hovered ? 1 : 0 + participantRect.opacity = hovered ? 1 : 0; } } @@ -196,10 +186,10 @@ Item { onHoveredChanged: { if (hovered) { - participantRect.opacity = 1 - fadeOutTimer.restart() + participantRect.opacity = 1; + fadeOutTimer.restart(); } else { - participantRect.opacity = 0 + participantRect.opacity = 0; } } @@ -230,7 +220,9 @@ Item { strokeColor: "transparent" fillColor: JamiTheme.darkGreyColorOpacity capStyle: ShapePath.RoundCap - PathSvg { path: pathShape } + PathSvg { + path: pathShape + } } } @@ -243,8 +235,7 @@ Item { id: bestNameLabel Layout.leftMargin: 8 - Layout.preferredWidth: Math.min(nameTextMetrics.boundingRect.width + 8, - participantIndicators.width - indicatorsRowLayout.width - 16) + Layout.preferredWidth: Math.min(nameTextMetrics.boundingRect.width + 8, participantIndicators.width - indicatorsRowLayout.width - 16) Layout.preferredHeight: shapeHeight text: bestName @@ -253,7 +244,9 @@ Item { font.pointSize: JamiTheme.participantFontSize horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter - HoverHandler { id: hoverName } + HoverHandler { + id: hoverName + } MaterialToolTip { visible: hoverName.hovered && (text.length > 0) text: bestNameLabel.truncated ? bestName : "" @@ -279,7 +272,9 @@ Item { source: JamiResources.star_outline_24dp_svg color: JamiTheme.whiteColor - HoverHandler { id: hoverHost } + HoverHandler { + id: hoverHost + } MaterialToolTip { visible: hoverHost.hovered text: JamiStrings.host @@ -300,7 +295,9 @@ Item { source: JamiResources.moderator_svg color: JamiTheme.whiteColor - HoverHandler { id: hoverModerator } + HoverHandler { + id: hoverModerator + } MaterialToolTip { visible: hoverModerator.hovered text: JamiStrings.moderator @@ -321,17 +318,19 @@ Item { source: JamiResources.micro_off_black_24dp_svg color: JamiTheme.redColor - HoverHandler { id: hoverMicrophone } + HoverHandler { + id: hoverMicrophone + } MaterialToolTip { visible: hoverMicrophone.hovered text: { if (!root.isMe && !root.meModerator && root.participantIsModeratorMuted && root.isLocalMuted) - return JamiStrings.bothMuted + return JamiStrings.bothMuted; if (root.isLocalMuted) - return JamiStrings.localMuted + return JamiStrings.localMuted; if (!root.isMe && !root.meModerator && root.participantIsModeratorMuted) - return JamiStrings.moderatorMuted - return JamiStrings.notMuted + return JamiStrings.moderatorMuted; + return JamiStrings.notMuted; } } } @@ -339,7 +338,11 @@ Item { } } - Behavior on opacity { NumberAnimation { duration: JamiTheme.shortFadeDuration }} + Behavior on opacity { + NumberAnimation { + duration: JamiTheme.shortFadeDuration + } + } } PushButton { @@ -381,7 +384,7 @@ Item { radius: height / 2 color: JamiTheme.recordIconColor - SequentialAnimation on color { + SequentialAnimation on color { loops: Animation.Infinite running: recordingIndicator.visible ColorAnimation { @@ -424,7 +427,7 @@ Item { id: alertTimer interval: JamiTheme.overlayFadeDelay onTriggered: { - root.muteAlertActive = false + root.muteAlertActive = false; } } } diff --git a/src/app/mainview/components/ParticipantOverlayButton.qml b/src/app/mainview/components/ParticipantOverlayButton.qml index ea62b2bebf37e8bda51a3afe1088d4f8ec6213c3..08c2d073ce1884341908f60074f32eeea0871357 100644 --- a/src/app/mainview/components/ParticipantOverlayButton.qml +++ b/src/app/mainview/components/ParticipantOverlayButton.qml @@ -15,11 +15,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick - import net.jami.Constants 1.1 - import "../../commoncomponents" PushButton { @@ -41,10 +38,9 @@ PushButton { anchors { horizontalCenter: parent.horizontalCenter top: parent.bottom - topMargin: isBarLayout? 6 : 2 + topMargin: isBarLayout ? 6 : 2 } - color : isBarLayout ? JamiTheme.darkGreyColorOpacity - : "transparent" + color: isBarLayout ? JamiTheme.darkGreyColorOpacity : "transparent" visible: hover.hovered && !isSmall radius: 2 @@ -63,7 +59,7 @@ PushButton { HoverHandler { id: hover onHoveredChanged: { - root.forceHovered = hover.hovered + root.forceHovered = hover.hovered; } } } diff --git a/src/app/mainview/components/ParticipantOverlayMenu.qml b/src/app/mainview/components/ParticipantOverlayMenu.qml index 37d01e303ab2e4597976eb775523d488d12d074f..104cdd01b2e3ca84842fcf14db32aa277f0ba052 100644 --- a/src/app/mainview/components/ParticipantOverlayMenu.qml +++ b/src/app/mainview/components/ParticipantOverlayMenu.qml @@ -15,15 +15,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Adapters 1.1 import net.jami.Models 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" // Overlay menu for conference moderation @@ -49,9 +46,13 @@ Item { property alias hovered: hover.hovered - HoverHandler { id: hover } + HoverHandler { + id: hover + } - Loader { sourceComponent: isBarLayout ? barComponent : rectComponent } + Loader { + sourceComponent: isBarLayout ? barComponent : rectComponent + } Component { id: rectComponent diff --git a/src/app/mainview/components/ParticipantsLayer.qml b/src/app/mainview/components/ParticipantsLayer.qml index 886a59ce32d8edc0d646b57451b9f657f7967cb1..fd2cad04bb64b42bdca508042e736b67cd46268c 100644 --- a/src/app/mainview/components/ParticipantsLayer.qml +++ b/src/app/mainview/components/ParticipantsLayer.qml @@ -16,14 +16,10 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick - import QtQuick.Layouts import QtQuick.Controls - import SortFilterProxyModel 0.2 - import net.jami.Adapters 1.1 import net.jami.Models 1.1 import net.jami.Constants 1.1 @@ -43,9 +39,9 @@ Item { property bool screenshotButtonHovered: false onVisibleChanged: { - CurrentCall.hideSelf = UtilsAdapter.getAppValue(Settings.HideSelf) - CurrentCall.hideSpectators = UtilsAdapter.getAppValue(Settings.HideSpectators) - CurrentCall.flipSelf = UtilsAdapter.getAppValue(Settings.FlipSelf) + CurrentCall.hideSelf = UtilsAdapter.getAppValue(Settings.HideSelf); + CurrentCall.hideSpectators = UtilsAdapter.getAppValue(Settings.HideSpectators); + CurrentCall.flipSelf = UtilsAdapter.getAppValue(Settings.FlipSelf); } Component { @@ -57,9 +53,7 @@ Item { anchors.fill: parent anchors.leftMargin: leftMargin_ isScreenshotButtonHovered: screenshotButtonHovered && hoveredOverlaySinkId === sinkId_ - opacity: screenshotButtonHovered - ? hoveredOverlaySinkId !== sinkId ? 0.1 : 1 - : 1 + opacity: screenshotButtonHovered ? hoveredOverlaySinkId !== sinkId ? 0.1 : 1 : 1 sinkId: sinkId_ uri: uri_ deviceId: deviceId_ @@ -67,8 +61,8 @@ Item { participantIsModerator: isModerator_ bestName: { if (bestName_ === uri_) - NameDirectory.lookupAddress(CurrentAccount.id, uri_) - return bestName_ + NameDirectory.lookupAddress(CurrentAccount.id, uri_); + return bestName_; } videoMuted: videoMuted_ participantIsActive: active_ @@ -79,11 +73,11 @@ Item { participantHandIsRaised: isHandRaised_ isSharing: isSharing_ - onParticipantHoveredChanged: { + onParticipantHoveredChanged: { if (participantHovered) { - hoveredOverlayUri = overlay.uri - hoveredOverlaySinkId = overlay.sinkId - hoveredOverVideoMuted = videoMuted_ + hoveredOverlayUri = overlay.uri; + hoveredOverlaySinkId = overlay.sinkId; + hoveredOverVideoMuted = videoMuted_; } } @@ -95,7 +89,7 @@ Item { function onRegisteredNameFound(status, address, name) { if (address === uri_ && status === NameDirectory.LookupStatus.SUCCESS) { - bestName_ = name + bestName_ = name; } } } @@ -106,10 +100,12 @@ Item { id: genericParticipantsModel sourceModel: CallParticipantsModel filters: AllOf { - ValueFilter { roleName: "Active"; value: false } ValueFilter { - enabled: CallParticipantsModel.count > 1 && - CurrentCall.hideSelf + roleName: "Active" + value: false + } + ValueFilter { + enabled: CallParticipantsModel.count > 1 && CurrentCall.hideSelf roleName: "IsLocal" value: false } @@ -124,7 +120,10 @@ Item { SortFilterProxyModel { id: activeParticipantsModel sourceModel: CallParticipantsModel - filters: ValueFilter { roleName: "Active"; value: true } + filters: ValueFilter { + roleName: "Active" + value: true + } } ParticipantsLayoutVertical { diff --git a/src/app/mainview/components/ParticipantsLayoutHorizontal.qml b/src/app/mainview/components/ParticipantsLayoutHorizontal.qml index 969f23deffb18c7b8ecbf08bde4f62972e42de93..5f9abe6bc728a3e0315bc0b9354c0258f03f5c52 100644 --- a/src/app/mainview/components/ParticipantsLayoutHorizontal.qml +++ b/src/app/mainview/components/ParticipantsLayoutHorizontal.qml @@ -16,12 +16,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick - import QtQuick.Layouts import QtQuick.Controls - import net.jami.Adapters 1.1 import net.jami.Models 1.1 import net.jami.Constants 1.1 @@ -77,7 +74,9 @@ SplitView { Flow { id: activeParticipantsFlow - TapHandler { acceptedButtons: Qt.LeftButton | Qt.RightButton } + TapHandler { + acceptedButtons: Qt.LeftButton | Qt.RightButton + } SplitView.minimumWidth: parent.width / 4 SplitView.maximumWidth: parent.width @@ -85,7 +84,7 @@ SplitView { spacing: 8 property int columns: Math.max(1, Math.ceil(Math.sqrt(activeParticipants.count))) - property int rows: Math.max(1, Math.ceil(activeParticipants.count/columns)) + property int rows: Math.max(1, Math.ceil(activeParticipants.count / columns)) property int columnsSpacing: 5 * (columns - 1) property int rowsSpacing: 5 * (rows - 1) @@ -130,14 +129,15 @@ SplitView { Rectangle { id: genericParticipantsRect - TapHandler { acceptedButtons: Qt.TopButton | Qt.BottomButton } + TapHandler { + acceptedButtons: Qt.TopButton | Qt.BottomButton + } SplitView.preferredWidth: (parent.width / 4) SplitView.minimumWidth: parent.width / 6 - SplitView.maximumWidth: inLine? parent.width / 2 : parent.width + SplitView.maximumWidth: inLine ? parent.width / 2 : parent.width - visible: commonParticipants.count > 0 && - (inLine || CallParticipantsModel.conferenceLayout === CallParticipantsModel.GRID) + visible: commonParticipants.count > 0 && (inLine || CallParticipantsModel.conferenceLayout === CallParticipantsModel.GRID) color: "transparent" property int lowLimit: 0 @@ -145,13 +145,13 @@ SplitView { property int currentPos: 0 property int showable: { if (!inLine) - return commonParticipants.count + return commonParticipants.count; if (commonParticipantsFlow.componentHeight === 0) - return 1 - var placeableElements = Math.floor((height * 0.9)/commonParticipantsFlow.componentHeight) + return 1; + var placeableElements = Math.floor((height * 0.9) / commonParticipantsFlow.componentHeight); if (commonParticipants.count - placeableElements < currentPos) - currentPos = Math.max(commonParticipants.count - placeableElements, 0) - return Math.max(1, placeableElements) + currentPos = Math.max(commonParticipants.count - placeableElements, 0); + return Math.max(1, placeableElements); } ColumnLayout { @@ -165,19 +165,17 @@ SplitView { Layout.bottomMargin: 16 Layout.topMargin: 16 spacing: 8 - visible: (genericParticipantsRect.currentPos > 0 && activeParticipantsFlow.visible) || - (genericParticipantsRect.topLimit - genericParticipantsRect.showable > genericParticipantsRect.currentPos && activeParticipantsFlow.visible) + visible: (genericParticipantsRect.currentPos > 0 && activeParticipantsFlow.visible) || (genericParticipantsRect.topLimit - genericParticipantsRect.showable > genericParticipantsRect.currentPos && activeParticipantsFlow.visible) RoundButton { - width : 30 - height : 30 + width: 30 + height: 30 radius: 10 text: "^" - visible: genericParticipantsRect.currentPos > 0 - && activeParticipantsFlow.visible + visible: genericParticipantsRect.currentPos > 0 && activeParticipantsFlow.visible onClicked: { if (genericParticipantsRect.currentPos > 0) - genericParticipantsRect.currentPos-- + genericParticipantsRect.currentPos--; } background: Rectangle { anchors.fill: parent @@ -187,15 +185,14 @@ SplitView { } RoundButton { - width : 30 - height : 30 + width: 30 + height: 30 radius: 10 text: "v" - visible: genericParticipantsRect.topLimit - genericParticipantsRect.showable > genericParticipantsRect.currentPos - && activeParticipantsFlow.visible + visible: genericParticipantsRect.topLimit - genericParticipantsRect.showable > genericParticipantsRect.currentPos && activeParticipantsFlow.visible onClicked: { if (genericParticipantsRect.topLimit - genericParticipantsRect.showable > genericParticipantsRect.currentPos) - genericParticipantsRect.currentPos++ + genericParticipantsRect.currentPos++; } background: Rectangle { anchors.fill: parent @@ -219,45 +216,45 @@ SplitView { spacing: 4 property int columns: { if (inLine) - return 1 - var ratio = Math.round(root.width / root.height) + return 1; + var ratio = Math.round(root.width / root.height); // If ratio is 2 we can have 2 times more elements on each columns - var wantedCol = Math.max(1, Math.round(Math.sqrt(commonParticipants.count) * ratio)) - var cols = Math.min(commonParticipants.count, wantedCol) + var wantedCol = Math.max(1, Math.round(Math.sqrt(commonParticipants.count) * ratio)); + var cols = Math.min(commonParticipants.count, wantedCol); // Optimize with the rows (eg 7 with ratio 2 should have 4 and 3 items, not 6 and 1) - var rows = Math.max(1, Math.ceil(commonParticipants.count/cols)) - return Math.min(Math.ceil(commonParticipants.count / rows), cols) + var rows = Math.max(1, Math.ceil(commonParticipants.count / cols)); + return Math.min(Math.ceil(commonParticipants.count / rows), cols); } property int rows: { if (inLine) - return commonParticipants.count - Math.max(1, Math.ceil(commonParticipants.count/columns)) + return commonParticipants.count; + Math.max(1, Math.ceil(commonParticipants.count / columns)); } property int componentHeight: { - var totalSpacing = commonParticipantsFlow.spacing * commonParticipantsFlow.rows - var h = Math.floor((commonParticipantsFlow.height - totalSpacing)/ commonParticipantsFlow.rows) + var totalSpacing = commonParticipantsFlow.spacing * commonParticipantsFlow.rows; + var h = Math.floor((commonParticipantsFlow.height - totalSpacing) / commonParticipantsFlow.rows); if (inLine) { - h = Math.max(width, h) - h = Math.min(width, h * 4 / 3) // Avoid too high elements + h = Math.max(width, h); + h = Math.min(width, h * 4 / 3); // Avoid too high elements } - return h + return h; } property int componentWidth: { - var totalSpacing = commonParticipantsFlow.spacing * commonParticipantsFlow.columns - var w = Math.floor((commonParticipantsFlow.width - totalSpacing)/ commonParticipantsFlow.columns) + var totalSpacing = commonParticipantsFlow.spacing * commonParticipantsFlow.columns; + var w = Math.floor((commonParticipantsFlow.width - totalSpacing) / commonParticipantsFlow.columns); if (inLine) { - w = commonParticipantsFlow.width + w = commonParticipantsFlow.width; } - return w + return w; } Item { width: parent.width height: { if (!inLine) - return 0 - var showed = Math.min(genericParticipantsRect.showable, commonParticipantsFlow.rows) - return Math.max(0, Math.ceil((centerItem.height - commonParticipantsFlow.componentHeight * showed) / 2)) + return 0; + var showed = Math.min(genericParticipantsRect.showable, commonParticipantsFlow.rows); + return Math.max(0, Math.ceil((centerItem.height - commonParticipantsFlow.componentHeight * showed) / 2)); } } @@ -271,30 +268,29 @@ SplitView { asynchronous: true visible: { if (status !== Loader.Ready) - return false + return false; if (inLine) - return index >= genericParticipantsRect.currentPos - && index < genericParticipantsRect.currentPos + genericParticipantsRect.showable - return true + return index >= genericParticipantsRect.currentPos && index < genericParticipantsRect.currentPos + genericParticipantsRect.showable; + return true; } width: commonParticipantsFlow.componentWidth + leftMargin_ height: { if (inLine || commonParticipantsFlow.columns === 1) - return commonParticipantsFlow.componentHeight - var totalSpacing = commonParticipantsFlow.spacing * commonParticipantsFlow.rows - return Math.floor((genericParticipantsRect.height - totalSpacing) / commonParticipantsFlow.rows) + return commonParticipantsFlow.componentHeight; + var totalSpacing = commonParticipantsFlow.spacing * commonParticipantsFlow.rows; + return Math.floor((genericParticipantsRect.height - totalSpacing) / commonParticipantsFlow.rows); } property int leftMargin_: { if (inLine || commonParticipantsFlow.rows === 1) - return 0 - var lastParticipants = (commonParticipants.count % commonParticipantsFlow.columns) + return 0; + var lastParticipants = (commonParticipants.count % commonParticipantsFlow.columns); if (lastParticipants !== 0 && index === commonParticipants.count - lastParticipants) { - var compW = commonParticipantsFlow.componentWidth + commonParticipantsFlow.spacing - var lastLineW = lastParticipants * compW - return Math.floor((commonParticipantsFlow.width - lastLineW) / 2) + var compW = commonParticipantsFlow.componentWidth + commonParticipantsFlow.spacing; + var lastLineW = lastParticipants * compW; + return Math.floor((commonParticipantsFlow.width - lastLineW) / 2); } - return 0 + return 0; } property string uri_: Uri @@ -321,7 +317,7 @@ SplitView { Item { Layout.alignment: Qt.AlignHCenter width: parent.width - height : 30 + height: 30 } } } diff --git a/src/app/mainview/components/ParticipantsLayoutVertical.qml b/src/app/mainview/components/ParticipantsLayoutVertical.qml index c7732cbfcfbf1b6f1362b74be9705eb4174adf26..355fa1181070b6b31c3730041fc37e7098e32282 100644 --- a/src/app/mainview/components/ParticipantsLayoutVertical.qml +++ b/src/app/mainview/components/ParticipantsLayoutVertical.qml @@ -16,12 +16,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick - import QtQuick.Layouts import QtQuick.Controls - import net.jami.Adapters 1.1 import net.jami.Models 1.1 import net.jami.Constants 1.1 @@ -76,14 +73,15 @@ SplitView { Rectangle { id: genericParticipantsRect - TapHandler { acceptedButtons: Qt.LeftButton | Qt.RightButton } + TapHandler { + acceptedButtons: Qt.LeftButton | Qt.RightButton + } SplitView.preferredHeight: (parent.height / 4) SplitView.minimumHeight: parent.height / 6 - SplitView.maximumHeight: inLine? parent.height / 2 : parent.height + SplitView.maximumHeight: inLine ? parent.height / 2 : parent.height - visible: commonParticipants.count > 0 && - (inLine || CallParticipantsModel.conferenceLayout === CallParticipantsModel.GRID) + visible: commonParticipants.count > 0 && (inLine || CallParticipantsModel.conferenceLayout === CallParticipantsModel.GRID) color: "transparent" property int lowLimit: 0 @@ -91,13 +89,13 @@ SplitView { property int currentPos: 0 property int showable: { if (!inLine) - return commonParticipants.count + return commonParticipants.count; if (commonParticipantsFlow.componentWidth === 0) - return 1 - var placeableElements = Math.floor((width * 0.9)/commonParticipantsFlow.componentWidth) + return 1; + var placeableElements = Math.floor((width * 0.9) / commonParticipantsFlow.componentWidth); if (commonParticipants.count - placeableElements < currentPos) - currentPos = Math.max(commonParticipants.count - placeableElements, 0) - return Math.max(1, placeableElements) + currentPos = Math.max(commonParticipants.count - placeableElements, 0); + return Math.max(1, placeableElements); } RowLayout { @@ -105,15 +103,14 @@ SplitView { RoundButton { Layout.alignment: Qt.AlignVCenter - width : 30 - height : 30 + width: 30 + height: 30 radius: 10 text: "<" - visible: genericParticipantsRect.currentPos > 0 - && activeParticipantsFlow.visible + visible: genericParticipantsRect.currentPos > 0 && activeParticipantsFlow.visible onClicked: { if (genericParticipantsRect.currentPos > 0) - genericParticipantsRect.currentPos-- + genericParticipantsRect.currentPos--; } background: Rectangle { anchors.fill: parent @@ -136,33 +133,33 @@ SplitView { spacing: 4 property int columns: { if (inLine) - return commonParticipants.count - var ratio = Math.round(root.width / root.height) + return commonParticipants.count; + var ratio = Math.round(root.width / root.height); // If ratio is 2 we can have 2 times more elements on each columns - var wantedCol = Math.max(1, Math.round(Math.sqrt(commonParticipants.count) * ratio)) - var cols = Math.min(commonParticipants.count, wantedCol) + var wantedCol = Math.max(1, Math.round(Math.sqrt(commonParticipants.count) * ratio)); + var cols = Math.min(commonParticipants.count, wantedCol); // Optimize with the rows (eg 7 with ratio 2 should have 4 and 3 items, not 6 and 1) - var rows = Math.max(1, Math.ceil(commonParticipants.count/cols)) - return Math.min(Math.ceil(commonParticipants.count / rows), cols) + var rows = Math.max(1, Math.ceil(commonParticipants.count / cols)); + return Math.min(Math.ceil(commonParticipants.count / rows), cols); } - property int rows: Math.max(1, Math.ceil(commonParticipants.count/columns)) + property int rows: Math.max(1, Math.ceil(commonParticipants.count / columns)) property int componentWidth: { - var totalSpacing = commonParticipantsFlow.spacing * commonParticipantsFlow.columns - var w = Math.floor((commonParticipantsFlow.width - totalSpacing)/ commonParticipantsFlow.columns) + var totalSpacing = commonParticipantsFlow.spacing * commonParticipantsFlow.columns; + var w = Math.floor((commonParticipantsFlow.width - totalSpacing) / commonParticipantsFlow.columns); if (inLine) { - w = Math.max(w, height) - w = Math.min(w, height * 4 / 3) // Avoid too wide elements + w = Math.max(w, height); + w = Math.min(w, height * 4 / 3); // Avoid too wide elements } - return w + return w; } Item { height: parent.height width: { if (!inLine) - return 0 - var showed = Math.min(genericParticipantsRect.showable, commonParticipantsFlow.columns) - return Math.max(0, Math.ceil((centerItem.width - commonParticipantsFlow.componentWidth * showed) / 2)) + return 0; + var showed = Math.min(genericParticipantsRect.showable, commonParticipantsFlow.columns); + return Math.max(0, Math.ceil((centerItem.width - commonParticipantsFlow.componentWidth * showed) / 2)); } } @@ -176,30 +173,29 @@ SplitView { asynchronous: true visible: { if (status !== Loader.Ready) - return false + return false; if (inLine) - return index >= genericParticipantsRect.currentPos - && index < genericParticipantsRect.currentPos + genericParticipantsRect.showable - return true + return index >= genericParticipantsRect.currentPos && index < genericParticipantsRect.currentPos + genericParticipantsRect.showable; + return true; } width: commonParticipantsFlow.componentWidth + leftMargin_ height: { if (inLine || commonParticipantsFlow.rows === 1) - return genericParticipantsRect.height - var totalSpacing = commonParticipantsFlow.spacing * commonParticipantsFlow.rows - return Math.floor((genericParticipantsRect.height - totalSpacing)/ commonParticipantsFlow.rows) + return genericParticipantsRect.height; + var totalSpacing = commonParticipantsFlow.spacing * commonParticipantsFlow.rows; + return Math.floor((genericParticipantsRect.height - totalSpacing) / commonParticipantsFlow.rows); } property int leftMargin_: { if (inLine || commonParticipantsFlow.rows === 1) - return 0 - var lastParticipants = (commonParticipants.count % commonParticipantsFlow.columns) + return 0; + var lastParticipants = (commonParticipants.count % commonParticipantsFlow.columns); if (lastParticipants !== 0 && index === commonParticipants.count - lastParticipants) { - var compW = commonParticipantsFlow.componentWidth + commonParticipantsFlow.spacing - var lastLineW = lastParticipants * compW - return Math.floor((commonParticipantsFlow.width - lastLineW) / 2) + var compW = commonParticipantsFlow.componentWidth + commonParticipantsFlow.spacing; + var lastLineW = lastParticipants * compW; + return Math.floor((commonParticipantsFlow.width - lastLineW) / 2); } - return 0 + return 0; } property string uri_: Uri @@ -225,15 +221,14 @@ SplitView { RoundButton { Layout.alignment: Qt.AlignVCenter - width : 30 - height : 30 + width: 30 + height: 30 radius: 10 text: ">" - visible: genericParticipantsRect.topLimit - genericParticipantsRect.showable > genericParticipantsRect.currentPos - && activeParticipantsFlow.visible + visible: genericParticipantsRect.topLimit - genericParticipantsRect.showable > genericParticipantsRect.currentPos && activeParticipantsFlow.visible onClicked: { if (genericParticipantsRect.topLimit - genericParticipantsRect.showable > genericParticipantsRect.currentPos) - genericParticipantsRect.currentPos++ + genericParticipantsRect.currentPos++; } background: Rectangle { anchors.fill: parent @@ -248,7 +243,9 @@ SplitView { Flow { id: activeParticipantsFlow - TapHandler { acceptedButtons: Qt.LeftButton | Qt.RightButton } + TapHandler { + acceptedButtons: Qt.LeftButton | Qt.RightButton + } SplitView.minimumHeight: parent.height / 4 SplitView.maximumHeight: parent.height @@ -256,7 +253,7 @@ SplitView { spacing: 8 property int columns: Math.max(1, Math.ceil(Math.sqrt(activeParticipants.count))) - property int rows: Math.max(1, Math.ceil(activeParticipants.count/columns)) + property int rows: Math.max(1, Math.ceil(activeParticipants.count / columns)) property int columnsSpacing: 5 * (columns - 1) property int rowsSpacing: 5 * (rows - 1) diff --git a/src/app/mainview/components/PluginHandlerItemDelegate.qml b/src/app/mainview/components/PluginHandlerItemDelegate.qml index 1666c06a94d840038fd3f134895677f7b895fa23..6e9c06009ca2d956f58d24b8236b0df2eb827d9c 100644 --- a/src/app/mainview/components/PluginHandlerItemDelegate.qml +++ b/src/app/mainview/components/PluginHandlerItemDelegate.qml @@ -15,20 +15,17 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" ItemDelegate { id: root - property string handlerName : "" + property string handlerName: "" property string handlerId: "" property string handlerIcon: "" property bool isLoaded: false @@ -37,7 +34,7 @@ ItemDelegate { signal btnLoadHandlerToggled signal openPreferences - RowLayout{ + RowLayout { anchors.fill: parent Label { @@ -46,7 +43,7 @@ ItemDelegate { width: 30 - background: Rectangle{ + background: Rectangle { color: "transparent" Image { anchors.centerIn: parent @@ -81,12 +78,12 @@ ItemDelegate { ToolTip.visible: hovered ToolTip.text: { - return JamiStrings.onOff + return JamiStrings.onOff; } checked: isLoaded onClicked: { - btnLoadHandlerToggled() + btnLoadHandlerToggled(); } background: Rectangle { @@ -100,13 +97,13 @@ ItemDelegate { onPressed: { } onReleased: { - loadSwitch.clicked() + loadSwitch.clicked(); } onEntered: { - loadSwitch.isHovering = true + loadSwitch.isHovering = true; } onExited: { - loadSwitch.isHovering = false + loadSwitch.isHovering = false; } } } diff --git a/src/app/mainview/components/PluginHandlerPicker.qml b/src/app/mainview/components/PluginHandlerPicker.qml index 59c5413ba2340fb7e82d974bc7d800aeb1d6f8ea..fc45c8b2cf2d7fe2331c8e1f09b61f58e41b623a 100644 --- a/src/app/mainview/components/PluginHandlerPicker.qml +++ b/src/app/mainview/components/PluginHandlerPicker.qml @@ -15,15 +15,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" Popup { @@ -58,23 +55,23 @@ Popup { function onAboutToShow(visible) { // Reset the model on each show. if (isCall) { - pluginhandlerPickerListView.model = PluginAdapter.getMediaHandlerSelectableModel(CurrentCall.id) + pluginhandlerPickerListView.model = PluginAdapter.getMediaHandlerSelectableModel(CurrentCall.id); } else { - var peerId = CurrentConversation.isSwarm ? CurrentConversation.id : CurrentConversationMembers[0] - pluginhandlerPickerListView.model = PluginAdapter.getChatHandlerSelectableModel(LRCInstance.currentAccountId, peerId) + var peerId = CurrentConversation.isSwarm ? CurrentConversation.id : CurrentConversationMembers[0]; + pluginhandlerPickerListView.model = PluginAdapter.getChatHandlerSelectableModel(LRCInstance.currentAccountId, peerId); } } } function toggleHandlerSlot(handlerId, isLoaded) { if (isCall) { - PluginModel.toggleCallMediaHandler(handlerId, CurrentCall.id, !isLoaded) - pluginhandlerPickerListView.model = PluginAdapter.getMediaHandlerSelectableModel(CurrentCall.id) + PluginModel.toggleCallMediaHandler(handlerId, CurrentCall.id, !isLoaded); + pluginhandlerPickerListView.model = PluginAdapter.getMediaHandlerSelectableModel(CurrentCall.id); } else { - var accountId = LRCInstance.currentAccountId - var peerId = CurrentConversation.isSwarm ? CurrentConversation.id : CurrentConversationMembers[0] - PluginModel.toggleChatHandler(handlerId, accountId, peerId, !isLoaded) - pluginhandlerPickerListView.model = PluginAdapter.getChatHandlerSelectableModel(accountId, peerId) + var accountId = LRCInstance.currentAccountId; + var peerId = CurrentConversation.isSwarm ? CurrentConversation.id : CurrentConversationMembers[0]; + PluginModel.toggleChatHandler(handlerId, accountId, peerId, !isLoaded); + pluginhandlerPickerListView.model = PluginAdapter.getChatHandlerSelectableModel(accountId, peerId); } } @@ -111,7 +108,7 @@ Popup { imageColor: JamiTheme.textColor onClicked: { - root.close() + root.close(); } } } @@ -125,10 +122,10 @@ Popup { model: { if (isCall) { - return PluginAdapter.getMediaHandlerSelectableModel(CurrentCall.id) + return PluginAdapter.getMediaHandlerSelectableModel(CurrentCall.id); } else { - var peerId = CurrentConversation.isSwarm ? CurrentConversation.id : CurrentConversationMembers[0] - return PluginAdapter.getChatHandlerSelectableModel(LRCInstance.currentAccountId, peerId) + var peerId = CurrentConversation.isSwarm ? CurrentConversation.id : CurrentConversationMembers[0]; + return PluginAdapter.getChatHandlerSelectableModel(LRCInstance.currentAccountId, peerId); } } @@ -138,20 +135,20 @@ Popup { width: pluginhandlerPickerListView.width height: JamiTheme.pluginHandlersPopupViewDelegateHeight - handlerName : HandlerName + handlerName: HandlerName handlerId: HandlerId handlerIcon: HandlerIcon isLoaded: IsLoaded pluginId: PluginId onBtnLoadHandlerToggled: { - toggleHandlerSlot(HandlerId, isLoaded) + toggleHandlerSlot(HandlerId, isLoaded); } onOpenPreferences: { - root.handlerName = handlerName - root.pluginId = pluginId - stack.push(pluginhandlerPreferenceStack2, StackView.Immediate) + root.handlerName = handlerName; + root.pluginId = pluginId; + stack.push(pluginhandlerPreferenceStack2, StackView.Immediate); } } } @@ -183,7 +180,7 @@ Popup { toolTipText: JamiStrings.goBackToPluginsList onClicked: { - stack.pop(null, StackView.Immediate) + stack.pop(null, StackView.Immediate); } } @@ -211,7 +208,7 @@ Popup { imageColor: JamiTheme.textColor onClicked: { - root.close() + root.close(); } } } @@ -242,7 +239,7 @@ Popup { preferenceCurrentValue: PreferenceCurrentValue pluginId: PluginId currentPath: CurrentPath - preferenceKey : PreferenceKey + preferenceKey: PreferenceKey fileFilters: FileFilters isImage: IsImage enabled: Enabled @@ -250,16 +247,16 @@ Popup { id: handlerPickerPreferenceModel lrcInstance: LRCInstance - preferenceKey : PreferenceKey + preferenceKey: PreferenceKey accountId_: LRCInstance.currentAccountId pluginId: PluginId } - onClicked: pluginhandlerPreferencePickerListView.currentIndex = index + onClicked: pluginhandlerPreferencePickerListView.currentIndex = index onBtnPreferenceClicked: { - PluginModel.setPluginPreference(pluginId, LRCInstance.currentAccountId, preferenceKey, preferenceNewValue) - handlerPickerPrefsModel.reset() + PluginModel.setPluginPreference(pluginId, LRCInstance.currentAccountId, preferenceKey, preferenceNewValue); + handlerPickerPrefsModel.reset(); } } } diff --git a/src/app/mainview/components/ProjectCreditsScrollView.qml b/src/app/mainview/components/ProjectCreditsScrollView.qml index 65d465c3ebbaa28bdf9677025cd8cdd205f5890a..66b7e5f558da97ff8023ecd050d90cae11a7d569 100644 --- a/src/app/mainview/components/ProjectCreditsScrollView.qml +++ b/src/app/mainview/components/ProjectCreditsScrollView.qml @@ -15,20 +15,17 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" Rectangle { id: root color: "transparent" - width : 480 + width: 480 JamiFlickable { id: projectCreditsFlickable @@ -57,11 +54,6 @@ Rectangle { cursorShape: Qt.ArrowCursor acceptedButtons: Qt.NoButton } - } } - - - - } diff --git a/src/app/mainview/components/RecordBox.qml b/src/app/mainview/components/RecordBox.qml index 4614e183a86230a5aee1893d90b6eccd49a9d814..c18db88510f91c11fca38a15f94f3f07419bdba6 100644 --- a/src/app/mainview/components/RecordBox.qml +++ b/src/app/mainview/components/RecordBox.qml @@ -15,16 +15,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts import Qt5Compat.GraphicalEffects - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" Popup { @@ -55,79 +52,73 @@ Popup { signal validatePhoto(string photo) function openRecorder(vid) { - isVideo = vid - updateState(RecordBox.States.INIT) - + isVideo = vid; + updateState(RecordBox.States.INIT); if (isVideo) { - localVideo.startWithId(VideoDevices.getDefaultDevice()) + localVideo.startWithId(VideoDevices.getDefaultDevice()); } - open() + open(); } function closeRecorder() { if (isVideo) { - localVideo.startWithId("") + localVideo.startWithId(""); } if (!root.isPhoto) - stopRecording() - close() + stopRecording(); + close(); } function updateState(new_state) { - state = new_state + state = new_state; if (isPhoto) { - screenshotBtn.visible = (state === RecordBox.States.INIT) - recordButton.visible = false - btnStop.visible = false + screenshotBtn.visible = (state === RecordBox.States.INIT); + recordButton.visible = false; + btnStop.visible = false; } else { - screenshotBtn.visible = false - recordButton.visible = (state === RecordBox.States.INIT) - btnStop.visible = (state === RecordBox.States.RECORDING) + screenshotBtn.visible = false; + recordButton.visible = (state === RecordBox.States.INIT); + btnStop.visible = (state === RecordBox.States.RECORDING); } - btnRestart.visible = (state === RecordBox.States.REC_SUCCESS) - btnSend.visible = (state === RecordBox.States.REC_SUCCESS) - + btnRestart.visible = (state === RecordBox.States.REC_SUCCESS); + btnSend.visible = (state === RecordBox.States.REC_SUCCESS); if (state === RecordBox.States.INIT) { - duration = 0 - time.text = "00:00" - timer.stop() + duration = 0; + time.text = "00:00"; + timer.stop(); } else if (state === RecordBox.States.REC_SUCCESS) { - timer.stop() + timer.stop(); } } function startRecording() { - timer.start() - pathRecorder = AVModel.startLocalMediaRecorder(isVideo? VideoDevices.getDefaultDevice() : "") + timer.start(); + pathRecorder = AVModel.startLocalMediaRecorder(isVideo ? VideoDevices.getDefaultDevice() : ""); if (pathRecorder == "") { - timer.stop() + timer.stop(); } } function stopRecording() { if (pathRecorder !== "") { - AVModel.stopLocalRecorder(pathRecorder) + AVModel.stopLocalRecorder(pathRecorder); } } function sendRecord() { if (pathRecorder !== "") { - MessagesAdapter.sendFile(pathRecorder) - MessagesAdapter.replyToId = "" + MessagesAdapter.sendFile(pathRecorder); + MessagesAdapter.replyToId = ""; } } function updateTimer() { - - duration += 1 - - var m = Math.trunc(duration / 60) - var s = (duration % 60) - - var min = (m < 10) ? "0" + String(m) : String(m) - var sec = (s < 10) ? "0" + String(s) : String(s) - - time.text = min + ":" + sec + duration += 1; + var m = Math.trunc(duration / 60); + var s = (duration % 60); + var min = (m < 10) ? "0" + String(m) : String(m); + var sec = (s < 10) ? "0" + String(s) : String(s); + time.text = min + ":" + sec; } modal: true @@ -135,20 +126,21 @@ Popup { onActiveFocusChanged: { if (visible) { - closeRecorder() + closeRecorder(); } } onVisibleChanged: { if (!visible) { - closeRecorder() + closeRecorder(); } } - background: Item {} // Computed by id: box, to do the layer on LocalVideo + background: Item { + } // Computed by id: box, to do the layer on LocalVideo width: preferredWidth - height: isVideo? previewWidget.height + 80 : preferredHeight + height: isVideo ? previewWidget.height + 80 : preferredHeight Rectangle { id: box radius: 5 @@ -173,8 +165,8 @@ Popup { anchors.margins: 8 onClicked: { - closeRecorder() - updateState(RecordBox.States.INIT) + closeRecorder(); + updateState(RecordBox.States.INIT); } } @@ -273,9 +265,9 @@ Popup { imageColor: JamiTheme.recordIconColor onClicked: { - updateState(RecordBox.States.RECORDING) + updateState(RecordBox.States.RECORDING); if (!root.isPhoto) - startRecording() + startRecording(); } } @@ -295,8 +287,8 @@ Popup { imageColor: UtilsAdapter.luma(JamiTheme.backgroundColor) ? "white" : JamiTheme.redColor onClicked: { - root.photo = videoProvider.captureVideoFrame(VideoDevices.getDefaultDevice()) - updateState(RecordBox.States.REC_SUCCESS) + root.photo = videoProvider.captureVideoFrame(VideoDevices.getDefaultDevice()); + updateState(RecordBox.States.REC_SUCCESS); } } @@ -317,8 +309,8 @@ Popup { onClicked: { if (!root.isPhoto) - stopRecording() - updateState(RecordBox.States.REC_SUCCESS) + stopRecording(); + updateState(RecordBox.States.REC_SUCCESS); } } @@ -339,8 +331,8 @@ Popup { onClicked: { if (!root.isPhoto) - stopRecording() - updateState(RecordBox.States.INIT) + stopRecording(); + updateState(RecordBox.States.INIT); } } @@ -360,13 +352,13 @@ Popup { onClicked: { if (!root.isPhoto) { - stopRecording() - sendRecord() + stopRecording(); + sendRecord(); } else if (root.photo !== "") { - root.validatePhoto(root.photo) + root.validatePhoto(root.photo); } - closeRecorder() - updateState(RecordBox.States.INIT) + closeRecorder(); + updateState(RecordBox.States.INIT); } } diff --git a/src/app/mainview/components/ReplyingContainer.qml b/src/app/mainview/components/ReplyingContainer.qml index 49a2f303a76f4f4fd25f5132d2e57004a59dd066..0231bc8fbb1ae80481e213dd3572e6c2e7ec0d34 100644 --- a/src/app/mainview/components/ReplyingContainer.qml +++ b/src/app/mainview/components/ReplyingContainer.qml @@ -15,15 +15,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Adapters 1.1 import net.jami.Constants 1.1 import net.jami.Models 1.1 - import "../../commoncomponents" Rectangle { @@ -34,18 +31,17 @@ Rectangle { property var isSelf: false property var author: { if (MessagesAdapter.replyToId === "") - return "" - - var author = MessagesAdapter.dataForInteraction(MessagesAdapter.replyToId, MessageList.Author) - isSelf = author === "" || author === undefined + return ""; + var author = MessagesAdapter.dataForInteraction(MessagesAdapter.replyToId, MessageList.Author); + isSelf = author === "" || author === undefined; if (isSelf) { - avatar.mode = Avatar.Mode.Account - avatar.imageId = CurrentAccount.id + avatar.mode = Avatar.Mode.Account; + avatar.imageId = CurrentAccount.id; } else { - avatar.mode = Avatar.Mode.Contact - avatar.imageId = author + avatar.mode = Avatar.Mode.Contact; + avatar.imageId = author; } - return isSelf ? CurrentAccount.uri : author + return isSelf ? CurrentAccount.uri : author; } RowLayout { @@ -60,9 +56,7 @@ Rectangle { text: JamiStrings.replyTo - color: UtilsAdapter.luma(root.color) ? - JamiTheme.chatviewTextColorLight : - JamiTheme.chatviewTextColorDark + color: UtilsAdapter.luma(root.color) ? JamiTheme.chatviewTextColorLight : JamiTheme.chatviewTextColorDark font.pointSize: JamiTheme.textFontSize font.kerning: true font.bold: true @@ -84,20 +78,15 @@ Rectangle { Label { id: username - text: author === CurrentAccount.uri ? - CurrentAccount.bestName - : UtilsAdapter.getBestNameForUri(CurrentAccount.id, author) + text: author === CurrentAccount.uri ? CurrentAccount.bestName : UtilsAdapter.getBestNameForUri(CurrentAccount.id, author) - color: UtilsAdapter.luma(root.color) ? - JamiTheme.chatviewTextColorLight : - JamiTheme.chatviewTextColorDark + color: UtilsAdapter.luma(root.color) ? JamiTheme.chatviewTextColorLight : JamiTheme.chatviewTextColorDark font.pointSize: JamiTheme.textFontSize font.kerning: true font.bold: true } } - PushButton { id: closeReply diff --git a/src/app/mainview/components/ScreenRubberBand.qml b/src/app/mainview/components/ScreenRubberBand.qml index 4a92bbd75fbda9f5b9009861af0e7249ac64c867..0094959ece2ce3013643e00b4b7bc17994f00ab8 100644 --- a/src/app/mainview/components/ScreenRubberBand.qml +++ b/src/app/mainview/components/ScreenRubberBand.qml @@ -15,10 +15,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Window - import net.jami.Adapters 1.1 import net.jami.Models 1.1 import net.jami.Constants 1.1 @@ -32,40 +30,36 @@ Window { id: screenRubberBandWindow function setAllScreensGeo() { - var width = 0, height = 0, x = 0, y = 0 - var screens = Qt.application.screens + var width = 0, height = 0, x = 0, y = 0; + var screens = Qt.application.screens; for (var i = 0; i < screens.length; ++i) { - var screenWidth = screens[i].width * screens[i].devicePixelRatio - var screenHeight = screens[i].height * screens[i].devicePixelRatio - + var screenWidth = screens[i].width * screens[i].devicePixelRatio; + var screenHeight = screens[i].height * screens[i].devicePixelRatio; if (screens[i].virtualX >= x + width) - width += screenWidth + width += screenWidth; else if (screens[i].virtualX + screenWidth <= x) - width += screenWidth + width += screenWidth; else if (screens[i].virtualX < x && screens[i].virtualX + screenWidth > x) - width += (x - screens[i].virtualX) * screens[i].devicePixelRatio + width += (x - screens[i].virtualX) * screens[i].devicePixelRatio; else if (screens[i].virtualX > x && screens[i].virtualX + screenWidth > x + width) - width += (screens[i].virtualX + screenWidth - x - width) * screens[i].devicePixelRatio - + width += (screens[i].virtualX + screenWidth - x - width) * screens[i].devicePixelRatio; if (screens[i].virtualY >= y + height) - height += screenHeight + height += screenHeight; else if (screens[i].virtualY + screenHeight <= y) - height += screenHeight + height += screenHeight; else if (screens[i].virtualY < y && screens[i].virtualY + screenHeight > y) - height += (y - screens[i].virtualY) * screens[i].devicePixelRatio + height += (y - screens[i].virtualY) * screens[i].devicePixelRatio; else if (screens[i].virtualY > y && screens[i].virtualY + screenHeight > y + height) - height += (screens[i].virtualY + screenWidth - y - height) * screens[i].devicePixelRatio - + height += (screens[i].virtualY + screenWidth - y - height) * screens[i].devicePixelRatio; if (screens[i].virtualY < y) - y = screens[i].virtualY + y = screens[i].virtualY; if (screens[i].virtualX < x) - x = screens[i].virtualX + x = screens[i].virtualX; } - - screenRubberBandWindow.width = width - screenRubberBandWindow.height = height - screenRubberBandWindow.x = x - screenRubberBandWindow.y = y + screenRubberBandWindow.width = width; + screenRubberBandWindow.height = height; + screenRubberBandWindow.x = x; + screenRubberBandWindow.y = y; } flags: Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint | Qt.WA_TranslucentBackground @@ -106,36 +100,35 @@ Window { // Geo changing for user selection. onPressed: { - originalX = mouseX - originalY = mouseY - recSelect.x = mouseX - recSelect.y = mouseY - recSelect.visible = true + originalX = mouseX; + originalY = mouseY; + recSelect.x = mouseX; + recSelect.y = mouseY; + recSelect.visible = true; } onMouseXChanged: { if (originalX - mouseX >= 0) { - recSelect.x = mouseX - recSelect.width = originalX - recSelect.x + recSelect.x = mouseX; + recSelect.width = originalX - recSelect.x; } else if (mouseX - recSelect.x > 0) { - recSelect.width = mouseX - recSelect.x + recSelect.width = mouseX - recSelect.x; } } onMouseYChanged: { if (originalY - mouseY >= 0) { - recSelect.y = mouseY - recSelect.height = originalY - recSelect.y + recSelect.y = mouseY; + recSelect.height = originalY - recSelect.y; } else if (mouseY - recSelect.y > 0) { - recSelect.height = mouseY - recSelect.y + recSelect.height = mouseY - recSelect.y; } } onReleased: { - recSelect.visible = false - AvAdapter.shareScreenArea(recSelect.x, recSelect.y, - recSelect.width, recSelect.height) - screenRubberBandWindow.close() + recSelect.visible = false; + AvAdapter.shareScreenArea(recSelect.x, recSelect.y, recSelect.width, recSelect.height); + screenRubberBandWindow.close(); } } } diff --git a/src/app/mainview/components/ScreenSharePreview.qml b/src/app/mainview/components/ScreenSharePreview.qml index 35ec8bb536daec2cb4d3d4b771d3064295ba3a78..1f0f91a684e50b138e37e92e3df8a4305c39fd35 100644 --- a/src/app/mainview/components/ScreenSharePreview.qml +++ b/src/app/mainview/components/ScreenSharePreview.qml @@ -15,24 +15,19 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Adapters 1.1 import net.jami.Models 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" Rectangle { id: root color: JamiTheme.secondaryBackgroundColor - border.color: selectedScreenNumber === elementIndex - ? JamiTheme.screenSelectionBorderColor - : JamiTheme.tabbarBorderColor + border.color: selectedScreenNumber === elementIndex ? JamiTheme.screenSelectionBorderColor : JamiTheme.tabbarBorderColor width: elementWidth height: 3 * width / 4 @@ -64,11 +59,11 @@ Rectangle { width: parent.width - 50 Component.onDestruction: { - VideoDevices.stopDevice(rendererId) + VideoDevices.stopDevice(rendererId); } Component.onCompleted: { if (root.rId !== "") { - rendererId = VideoDevices.startDevice(root.rId) + rendererId = VideoDevices.startDevice(root.rId); } } } @@ -79,7 +74,7 @@ Rectangle { onClicked: { if (selectedScreenNumber !== root.elementIndex) { - selectedScreenNumber = root.elementIndex + selectedScreenNumber = root.elementIndex; } } } diff --git a/src/app/mainview/components/ScrollToBottomButton.qml b/src/app/mainview/components/ScrollToBottomButton.qml index 9b8ac025de8d2ce95df3b708f51fc338c594e919..798ab6f2fe4061bb497d0c3ea66fe85903bc9487 100644 --- a/src/app/mainview/components/ScrollToBottomButton.qml +++ b/src/app/mainview/components/ScrollToBottomButton.qml @@ -15,15 +15,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import Qt5Compat.GraphicalEffects - import net.jami.Constants 1.1 import net.jami.Adapters 1.1 - - import "../../commoncomponents" Control { @@ -84,8 +80,6 @@ Control { text: JamiStrings.scrollToEnd color: UtilsAdapter.luma(CurrentConversation.color) ? JamiTheme.chatviewTextColorLight : JamiTheme.chatviewTextColorDark - - } ResponsiveImage { @@ -112,8 +106,7 @@ Control { MouseArea { anchors.fill: parent - cursorShape: root.opacity ? Qt.PointingHandCursor : - Qt.ArrowCursor + cursorShape: root.opacity ? Qt.PointingHandCursor : Qt.ArrowCursor onClicked: root.clicked() } diff --git a/src/app/mainview/components/Searchbar.qml b/src/app/mainview/components/Searchbar.qml index 6fb1d94ab5d3e8bd57653e26df23722a519dd7d4..1c0117d930c19fc971e1fa03065ba41bf6a4fcd5 100644 --- a/src/app/mainview/components/Searchbar.qml +++ b/src/app/mainview/components/Searchbar.qml @@ -15,14 +15,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts import QtQuick.Controls - import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" RowLayout { @@ -31,7 +28,8 @@ RowLayout { property string currentConversationId: CurrentConversation.id property bool isOpen: extrasPanel.isOpen(ChatView.MessagesResearchPanel) - onIsOpenChanged: if (isOpen) textArea.forceActiveFocus() + onIsOpenChanged: if (isOpen) + textArea.forceActiveFocus() PushButton { id: startSearchMessages @@ -56,10 +54,18 @@ RowLayout { opacity: isOpen visible: opacity - Behavior on opacity { NumberAnimation { duration: 150 } } + Behavior on opacity { + NumberAnimation { + duration: 150 + } + } Layout.preferredWidth: isOpen ? JamiTheme.searchbarSize : 0 - Behavior on Layout.preferredWidth { NumberAnimation { duration: 150 } } + Behavior on Layout.preferredWidth { + NumberAnimation { + duration: 150 + } + } TextField { id: textArea @@ -72,7 +78,7 @@ RowLayout { placeholderTextColor: JamiTheme.chatviewTextColor onTextChanged: { - MessagesAdapter.searchbarPrompt = text + MessagesAdapter.searchbarPrompt = text; } } @@ -94,16 +100,19 @@ RowLayout { property string convId: CurrentConversation.id onConvIdChanged: { - textArea.clear() + textArea.clear(); } onClicked: { - textArea.clear() - textArea.forceActiveFocus() + textArea.clear(); + textArea.forceActiveFocus(); } - Behavior on opacity { - NumberAnimation { duration: 500; easing.type: Easing.OutCubic } + Behavior on opacity { + NumberAnimation { + duration: 500 + easing.type: Easing.OutCubic + } } } } diff --git a/src/app/mainview/components/SelectScreen.qml b/src/app/mainview/components/SelectScreen.qml index 9cc6d80867fcd97b0deb3940e5d0dddfb8786a70..560cca63bb2a8ae4b90e41d6627ab766b93d7deb 100644 --- a/src/app/mainview/components/SelectScreen.qml +++ b/src/app/mainview/components/SelectScreen.qml @@ -17,16 +17,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Window import QtQuick.Controls import QtQuick.Layouts - import net.jami.Adapters 1.1 import net.jami.Models 1.1 import net.jami.Constants 1.1 - import "../js/screenrubberbandcreation.js" as ScreenRubberBandCreation import "../../commoncomponents" @@ -51,45 +48,44 @@ Window { property real componentMinWidth: 350 property real marginSize: JamiTheme.preferredMarginSize property real elementWidth: { - var layoutWidth = selectScreenWindowLayout.width - var minSize = componentMinWidth + 2 * marginSize - var numberElementPerRow = Math.floor(layoutWidth / minSize) + var layoutWidth = selectScreenWindowLayout.width; + var minSize = componentMinWidth + 2 * marginSize; + var numberElementPerRow = Math.floor(layoutWidth / minSize); if (numberElementPerRow == 1 && layoutWidth > componentMinWidth * 1.5) { - numberElementPerRow = 2 + numberElementPerRow = 2; } if (showWindows) - numberElementPerRow = Math.min(listModel.length, numberElementPerRow) + numberElementPerRow = Math.min(listModel.length, numberElementPerRow); else - numberElementPerRow = Math.min(listModel.length + 1, numberElementPerRow) - var spacingLength = marginSize * (numberElementPerRow + 2) - - return (layoutWidth - spacingLength) / numberElementPerRow + numberElementPerRow = Math.min(listModel.length + 1, numberElementPerRow); + var spacingLength = marginSize * (numberElementPerRow + 2); + return (layoutWidth - spacingLength) / numberElementPerRow; } function calculateRepeaterModel() { - listModel = [] - var idx + listModel = []; + var idx; if (!showWindows) { for (idx in Qt.application.screens) { - listModel.push(JamiStrings.screen.arg(idx)) + listModel.push(JamiStrings.screen.arg(idx)); } } else { - AvAdapter.getListWindows() + AvAdapter.getListWindows(); for (idx in AvAdapter.windowsNames) { - listModel.push(AvAdapter.windowsNames[idx]) + listModel.push(AvAdapter.windowsNames[idx]); } } } onVisibleChanged: { if (!visible) - return + return; if (!active) { - selectedScreenNumber = undefined + selectedScreenNumber = undefined; } - screenSharePreviewRepeater.model = {} - calculateRepeaterModel() - screenSharePreviewRepeater.model = root.listModel + screenSharePreviewRepeater.model = {}; + calculateRepeaterModel(); + screenSharePreviewRepeater.model = root.listModel; } Rectangle { @@ -137,9 +133,7 @@ Window { Loader { // Show all screens - active: !showWindows && - Qt.application.screens.length > 1 && - Qt.platform.os.toString() !== "windows" + active: !showWindows && Qt.application.screens.length > 1 && Qt.platform.os.toString() !== "windows" sourceComponent: ScreenSharePreview { id: screenSelectionRectAll @@ -162,8 +156,8 @@ Window { rectTitle: listModel[index] ? listModel[index] : "" rId: { if (showWindows) - return rId = AvAdapter.getSharingResource(-2, AvAdapter.windowsIds[index], AvAdapter.windowsNames[index]) - return rId = AvAdapter.getSharingResource(index) + return rId = AvAdapter.getSharingResource(-2, AvAdapter.windowsIds[index], AvAdapter.windowsNames[index]); + return rId = AvAdapter.getSharingResource(index); } } } @@ -197,15 +191,15 @@ Window { onClicked: { if (selectAllScreens) - AvAdapter.shareAllScreens() + AvAdapter.shareAllScreens(); else { if (!showWindows) - AvAdapter.shareEntireScreen(selectedScreenNumber) + AvAdapter.shareEntireScreen(selectedScreenNumber); else { - AvAdapter.shareWindow(AvAdapter.windowsIds[selectedScreenNumber], AvAdapter.windowsNames[selectedScreenNumber - Qt.application.screens.length]) + AvAdapter.shareWindow(AvAdapter.windowsIds[selectedScreenNumber], AvAdapter.windowsNames[selectedScreenNumber - Qt.application.screens.length]); } } - root.close() + root.close(); } } diff --git a/src/app/mainview/components/SidePanelTabBar.qml b/src/app/mainview/components/SidePanelTabBar.qml index db2c6b1615a939b111da6939cf5d543d37cdc21e..d4289cba560260d4d888d3a31ad50c99f6557bfa 100644 --- a/src/app/mainview/components/SidePanelTabBar.qml +++ b/src/app/mainview/components/SidePanelTabBar.qml @@ -16,13 +16,10 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick.Controls - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" TabBar { @@ -34,7 +31,7 @@ TabBar { } function selectTab(idx) { - ConversationsAdapter.filterRequests = (idx === SidePanelTabBar.Requests) + ConversationsAdapter.filterRequests = (idx === SidePanelTabBar.Requests); } currentIndex: 0 diff --git a/src/app/mainview/components/SipInputPanel.qml b/src/app/mainview/components/SipInputPanel.qml index bd0688ac825f4d5a8cdffa7dd278e8882fa8f598..37de5124185c43e6ef58f85be098129a3ef2129e 100644 --- a/src/app/mainview/components/SipInputPanel.qml +++ b/src/app/mainview/components/SipInputPanel.qml @@ -15,15 +15,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Adapters 1.1 import net.jami.Models 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" // SipInputPanel is a key pad that is designed to be @@ -55,8 +52,7 @@ Popup { Repeater { id: sipInputPanelRectGridLayoutRepeater - model: ["1", "2", "3", "A", "4", "5", "6", "B", "7", - "8", "9", "C", "*", "0", "#", "D"] + model: ["1", "2", "3", "A", "4", "5", "6", "B", "7", "8", "9", "C", "*", "0", "#", "D"] PushButton { id: sipInputPanelButton @@ -77,7 +73,7 @@ Popup { toolTipText: modelData onClicked: { - CallAdapter.sipInputPanelPlayDTMF(modelData) + CallAdapter.sipInputPanelPlayDTMF(modelData); } } } diff --git a/src/app/mainview/components/SwarmDetailsItem.qml b/src/app/mainview/components/SwarmDetailsItem.qml index 77146e1c1db3e98de09805f3c62f78ad70055688..e50ce04cffe457dc6fdcdfde429286ab4a35f4b7 100644 --- a/src/app/mainview/components/SwarmDetailsItem.qml +++ b/src/app/mainview/components/SwarmDetailsItem.qml @@ -15,11 +15,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 @@ -33,7 +31,7 @@ Rectangle { target: parent enabled: parent.visible onHoveredChanged: { - parent.color = hovered ? JamiTheme.smartListHoveredColor : "transparent" + parent.color = hovered ? JamiTheme.smartListHoveredColor : "transparent"; } } } diff --git a/src/app/mainview/components/SwarmDetailsPanel.qml b/src/app/mainview/components/SwarmDetailsPanel.qml index 13e3aa6f31bf4674ea8f0568bf07e61775b6169b..5fb1b2d6d499d0a5200dbdb371efedc2d2f8c3ef 100644 --- a/src/app/mainview/components/SwarmDetailsPanel.qml +++ b/src/app/mainview/components/SwarmDetailsPanel.qml @@ -15,17 +15,14 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts import Qt.labs.platform import Qt5Compat.GraphicalEffects - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" import "../../settingsview/components" @@ -37,15 +34,9 @@ Rectangle { color: CurrentConversation.color - property var isAdmin: UtilsAdapter.getParticipantRole(CurrentAccount.id, - CurrentConversation.id, - CurrentAccount.uri) === Member.Role.ADMIN - || CurrentConversation.isCoreDialog - - property string textColor: UtilsAdapter.luma(root.color) ? - JamiTheme.chatviewTextColorLight : - JamiTheme.chatviewTextColorDark + property var isAdmin: UtilsAdapter.getParticipantRole(CurrentAccount.id, CurrentConversation.id, CurrentAccount.uri) === Member.Role.ADMIN || CurrentConversation.isCoreDialog + property string textColor: UtilsAdapter.luma(root.color) ? JamiTheme.chatviewTextColorLight : JamiTheme.chatviewTextColorDark ColumnLayout { id: swarmProfileDetails @@ -73,7 +64,7 @@ Rectangle { newItem: true imageId: LRCInstance.selectedConvUid - avatarSize: JamiTheme.smartListAvatarSize * 3/2 + avatarSize: JamiTheme.smartListAvatarSize * 3 / 2 } ColumnLayout { @@ -97,7 +88,7 @@ Rectangle { readOnly: !isAdmin Layout.minimumHeight: JamiTheme.preferredFieldHeight - Layout.preferredWidth: Math.min(217,swarmProfileDetails.width - currentAccountAvatar.width - 30 - JamiTheme.settingsMarginSize) + Layout.preferredWidth: Math.min(217, swarmProfileDetails.width - currentAccountAvatar.width - 30 - JamiTheme.settingsMarginSize) staticText: CurrentConversation.title elidedText: titleLineTextSize.elidedText @@ -106,8 +97,7 @@ Rectangle { prefixIconColor: root.textColor onAccepted: { - ConversationsAdapter.updateConversationTitle( - LRCInstance.selectedConvUid, dynamicText) + ConversationsAdapter.updateConversationTitle(LRCInstance.selectedConvUid, dynamicText); } editMode: false @@ -115,12 +105,12 @@ Rectangle { onActiveFocusChanged: { if (!activeFocus) { - ConversationsAdapter.updateConversationTitle(LRCInstance.selectedConvUid, dynamicText) + ConversationsAdapter.updateConversationTitle(LRCInstance.selectedConvUid, dynamicText); } - titleLine.editMode = activeFocus + titleLine.editMode = activeFocus; } - infoTipLineText: CurrentConversation.isCoreDialog? JamiStrings.contactName : JamiStrings.swarmName + infoTipLineText: CurrentConversation.isCoreDialog ? JamiStrings.contactName : JamiStrings.swarmName } ModalTextEdit { @@ -141,7 +131,7 @@ Rectangle { readOnly: !isAdmin || CurrentConversation.isCoreDialog Layout.minimumHeight: JamiTheme.preferredFieldHeight - Layout.preferredWidth: Math.min(217,swarmProfileDetails.width - currentAccountAvatar.width - 30 - JamiTheme.settingsMarginSize) + Layout.preferredWidth: Math.min(217, swarmProfileDetails.width - currentAccountAvatar.width - 30 - JamiTheme.settingsMarginSize) staticText: CurrentConversation.description placeholderText: JamiStrings.addADescription @@ -150,18 +140,16 @@ Rectangle { textColor: root.textColor prefixIconColor: root.textColor - onAccepted: ConversationsAdapter.updateConversationDescription( - LRCInstance.selectedConvUid, dynamicText) + onAccepted: ConversationsAdapter.updateConversationDescription(LRCInstance.selectedConvUid, dynamicText) editMode: false isPersistent: false onActiveFocusChanged: { if (!activeFocus) { - ConversationsAdapter.updateConversationDescription( - LRCInstance.selectedConvUid, dynamicText) + ConversationsAdapter.updateConversationDescription(LRCInstance.selectedConvUid, dynamicText); } - descriptionLineButton.editMode = activeFocus + descriptionLineButton.editMode = activeFocus; } infoTipLineText: JamiStrings.addADescription @@ -179,31 +167,14 @@ Rectangle { property string currentItemName: itemAt(currentIndex).objectName - component DetailsTabButton: FilterTabButton { - backgroundColor: CurrentConversation.color - hoverColor: CurrentConversation.color - borderWidth: 4 - bottomMargin: JamiTheme.settingsMarginSize - fontSize: JamiTheme.menuFontSize - underlineContentOnly: true - textColorHovered: UtilsAdapter.luma(root.color) ? - JamiTheme.placeholderTextColorWhite : - JamiTheme.placeholderTextColor - textColor: UtilsAdapter.luma(root.color) ? - JamiTheme.chatviewTextColorLight : - JamiTheme.chatviewTextColorDark - Layout.fillWidth: true - down: tabBar.currentIndex === TabBar.index - } - function addRemoveButtons() { if (CurrentConversation.isCoreDialog) { if (tabBar.contentChildren.length === 3) - tabBar.removeItem(tabBar.itemAt(1)) + tabBar.removeItem(tabBar.itemAt(1)); } else { if (tabBar.contentChildren.length === 2) { - const obj = membersTabButtonComp.createObject(tabBar) - tabBar.insertItem(1, obj) + const obj = membersTabButtonComp.createObject(tabBar); + tabBar.insertItem(1, obj); } } } @@ -212,7 +183,9 @@ Rectangle { Connections { target: CurrentConversation - function onIsCoreDialogChanged() { tabBar.addRemoveButtons() } + function onIsCoreDialogChanged() { + tabBar.addRemoveButtons(); + } } Component { @@ -224,14 +197,12 @@ Rectangle { labelText: { var membersNb = CurrentConversationMembers.count; if (membersNb > 1) - return JamiStrings.members.arg(membersNb) - return JamiStrings.member + return JamiStrings.members.arg(membersNb); + return JamiStrings.member; } } } - - DetailsTabButton { id: documentsTabButton objectName: "documents" @@ -252,8 +223,8 @@ Rectangle { id: colorDialog title: JamiStrings.chooseAColor onAccepted: { - CurrentConversation.setPreference("color", colorDialog.color) - this.destroy() + CurrentConversation.setPreference("color", colorDialog.color); + this.destroy(); } onRejected: this.destroy() } @@ -262,7 +233,7 @@ Rectangle { Rectangle { id: details Layout.fillWidth: true - Layout.preferredHeight: root.height - header.height - 2*JamiTheme.preferredMarginSize + Layout.preferredHeight: root.height - header.height - 2 * JamiTheme.preferredMarginSize color: JamiTheme.secondaryBackgroundColor JamiFlickable { @@ -299,7 +270,7 @@ Rectangle { tooltipText: JamiStrings.ignoreNotificationsTooltip onSwitchToggled: { - CurrentConversation.setPreference("ignoreNotifications", checked ? "true" : "false") + CurrentConversation.setPreference("ignoreNotifications", checked ? "true" : "false"); } } } @@ -327,17 +298,14 @@ Rectangle { target: parent enabled: parent.visible onTapped: function onTapped(eventPoint) { - var dlg = viewCoordinator.presentDialog( - appWindow, - "commoncomponents/ConfirmDialog.qml", - { - title: JamiStrings.confirmAction, - textLabel: JamiStrings.confirmRmConversation, - confirmLabel: JamiStrings.optionRemove - }) - dlg.accepted.connect(function() { - MessagesAdapter.removeConversation(LRCInstance.selectedConvUid) - }) + var dlg = viewCoordinator.presentDialog(appWindow, "commoncomponents/ConfirmDialog.qml", { + "title": JamiStrings.confirmAction, + "textLabel": JamiStrings.confirmRmConversation, + "confirmLabel": JamiStrings.optionRemove + }); + dlg.accepted.connect(function () { + MessagesAdapter.removeConversation(LRCInstance.selectedConvUid); + }); } } } @@ -384,7 +352,7 @@ Rectangle { target: parent enabled: parent.visible onTapped: function onTapped(eventPoint) { - colorDialogComp.createObject(appWindow).open() + colorDialogComp.createObject(appWindow).open(); } } } @@ -417,7 +385,6 @@ Rectangle { color: JamiTheme.textColor } - RowLayout { id: swarmRdvPref spacing: 10 @@ -429,8 +396,8 @@ Rectangle { function onRdvAccountChanged() { // This avoid incorrect avatar by always modifying the mode before the imageId - avatar.mode = CurrentConversation.rdvAccount === CurrentAccount.uri ? Avatar.Mode.Account : Avatar.Mode.Contact - avatar.imageId = CurrentConversation.rdvAccount === CurrentAccount.uri ? CurrentAccount.id : CurrentConversation.rdvAccount + avatar.mode = CurrentConversation.rdvAccount === CurrentAccount.uri ? Avatar.Mode.Account : Avatar.Mode.Contact; + avatar.imageId = CurrentConversation.rdvAccount === CurrentAccount.uri ? CurrentAccount.id : CurrentConversation.rdvAccount; } } @@ -457,11 +424,11 @@ Rectangle { eText: { if (CurrentConversation.rdvAccount === "") - return JamiStrings.none + return JamiStrings.none; else if (CurrentConversation.rdvAccount === CurrentAccount.uri) - return CurrentAccount.bestName + return CurrentAccount.bestName; else - return UtilsAdapter.getBestNameForUri(CurrentAccount.id, CurrentConversation.rdvAccount) + return UtilsAdapter.getBestNameForUri(CurrentAccount.id, CurrentConversation.rdvAccount); } maxWidth: settingsSwarmItem.width / 2 - JamiTheme.contactMessageAvatarSize @@ -497,9 +464,7 @@ Rectangle { enabled: parent.visible && root.isAdmin onTapped: function onTapped(eventPoint) { - viewCoordinator.presentDialog( - appWindow, - "mainview/components/DevicesListPopup.qml") + viewCoordinator.presentDialog(appWindow, "mainview/components/DevicesListPopup.qml"); } } } @@ -568,10 +533,8 @@ Rectangle { color: JamiTheme.textColor font.pixelSize: JamiTheme.participantSwarmDetailFontSize - text: CurrentConversation.id elide: Text.ElideRight - } } } @@ -590,12 +553,11 @@ Rectangle { role: UtilsAdapter.getParticipantRole(CurrentAccount.id, CurrentConversation.id, CurrentAccount.uri) function openMenuAt(x, y, participantUri) { - contextMenu.x = x - contextMenu.y = y - contextMenu.conversationId = CurrentConversation.id - contextMenu.participantUri = participantUri - - openMenu() + contextMenu.x = x; + contextMenu.y = y; + contextMenu.conversationId = CurrentConversation.id; + contextMenu.participantUri = participantUri; + openMenu(); } } @@ -610,9 +572,9 @@ Rectangle { anchors.fill: parent color: { if (member.hovered || nameTextEditHover.hovered) - return JamiTheme.smartListHoveredColor + return JamiTheme.smartListHoveredColor; else - return "transparent" + return "transparent"; } } @@ -623,8 +585,8 @@ Rectangle { enabled: MemberUri !== CurrentAccount.uri acceptedButtons: Qt.RightButton onClicked: function (mouse) { - var position = mapToItem(members, mouse.x, mouse.y) - contextMenu.openMenuAt(position.x, position.y, MemberUri) + var position = mapToItem(members, mouse.x, mouse.y); + contextMenu.openMenuAt(position.x, position.y, MemberUri); } } @@ -639,7 +601,7 @@ Rectangle { Layout.leftMargin: JamiTheme.preferredMarginSize Layout.topMargin: JamiTheme.preferredMarginSize / 2 z: -index - opacity: (MemberRole === Member.Role.INVITED || MemberRole === Member.Role.BANNED)? 0.5 : 1 + opacity: (MemberRole === Member.Role.INVITED || MemberRole === Member.Role.BANNED) ? 0.5 : 1 imageId: CurrentAccount.uri === MemberUri ? CurrentAccount.id : MemberUri showPresenceIndicator: UtilsAdapter.getContactPresence(CurrentAccount.id, MemberUri) @@ -658,7 +620,7 @@ Rectangle { font.pointSize: JamiTheme.settingsFontSize color: JamiTheme.primaryForegroundColor - opacity: (MemberRole === Member.Role.INVITED || MemberRole === Member.Role.BANNED)? 0.5 : 1 + opacity: (MemberRole === Member.Role.INVITED || MemberRole === Member.Role.BANNED) ? 0.5 : 1 font.kerning: true verticalAlignment: Text.AlignVCenter @@ -676,18 +638,18 @@ Rectangle { eText: { if (MemberRole === Member.Role.ADMIN) - return JamiStrings.administrator + return JamiStrings.administrator; if (MemberRole === Member.Role.INVITED) - return JamiStrings.invited + return JamiStrings.invited; if (MemberRole === Member.Role.BANNED) - return JamiStrings.banned - return "" + return JamiStrings.banned; + return ""; } maxWidth: JamiTheme.preferredFieldWidth font.pointSize: JamiTheme.settingsFontSize color: JamiTheme.textColorHovered - opacity: (MemberRole === Member.Role.INVITED || MemberRole === Member.Role.BANNED)? 0.5 : 1 + opacity: (MemberRole === Member.Role.INVITED || MemberRole === Member.Role.BANNED) ? 0.5 : 1 font.kerning: true horizontalAlignment: Text.AlignRight @@ -705,4 +667,17 @@ Rectangle { } } } + + component DetailsTabButton: FilterTabButton { + backgroundColor: CurrentConversation.color + hoverColor: CurrentConversation.color + borderWidth: 4 + bottomMargin: JamiTheme.settingsMarginSize + fontSize: JamiTheme.menuFontSize + underlineContentOnly: true + textColorHovered: UtilsAdapter.luma(root.color) ? JamiTheme.placeholderTextColorWhite : JamiTheme.placeholderTextColor + textColor: UtilsAdapter.luma(root.color) ? JamiTheme.chatviewTextColorLight : JamiTheme.chatviewTextColorDark + Layout.fillWidth: true + down: tabBar.currentIndex === TabBar.index + } } diff --git a/src/app/mainview/components/SwarmParticipantContextMenu.qml b/src/app/mainview/components/SwarmParticipantContextMenu.qml index e7258f7ec9b37da289cbbb6b640f7102f62c3c05..3733fb7eb540821796ead89199b41ba5f3fdbe3e 100644 --- a/src/app/mainview/components/SwarmParticipantContextMenu.qml +++ b/src/app/mainview/components/SwarmParticipantContextMenu.qml @@ -15,13 +15,10 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" import "../../commoncomponents/contextmenu" @@ -38,8 +35,8 @@ ContextMenuAutoLoader { canTrigger: ConversationsAdapter.dialogId(participantUri) !== "" iconSource: JamiResources.videocam_24dp_svg onClicked: { - ConversationsAdapter.openDialogConversationWith(participantUri) - CallAdapter.placeCall() + ConversationsAdapter.openDialogConversationWith(participantUri); + CallAdapter.placeCall(); } }, GeneralMenuItem { @@ -48,8 +45,8 @@ ContextMenuAutoLoader { canTrigger: ConversationsAdapter.dialogId(participantUri) !== "" iconSource: JamiResources.place_audiocall_24dp_svg onClicked: { - ConversationsAdapter.openDialogConversationWith(participantUri) - CallAdapter.placeAudioOnlyCall() + ConversationsAdapter.openDialogConversationWith(participantUri); + CallAdapter.placeAudioOnlyCall(); } }, GeneralMenuItem { @@ -59,9 +56,9 @@ ContextMenuAutoLoader { itemName: JamiStrings.goToConversation onClicked: { if (ConversationsAdapter.dialogId(participantUri) !== "") - ConversationsAdapter.openDialogConversationWith(participantUri) + ConversationsAdapter.openDialogConversationWith(participantUri); else - ConversationsAdapter.setFilter(participantUri) + ConversationsAdapter.setFilter(participantUri); } }, GeneralMenuItem { @@ -69,7 +66,7 @@ ContextMenuAutoLoader { itemName: JamiStrings.blockContact iconSource: JamiResources.block_black_24dp_svg onClicked: { - ContactAdapter.removeContact(participantUri, true) + ContactAdapter.removeContact(participantUri, true); } }, GeneralMenuItem { @@ -81,9 +78,9 @@ ContextMenuAutoLoader { onClicked: { if (memberRole === Member.Role.BANNED) { - MessagesAdapter.addConversationMember(conversationId, participantUri) + MessagesAdapter.addConversationMember(conversationId, participantUri); } else { - MessagesAdapter.removeConversationMember(conversationId, participantUri) + MessagesAdapter.removeConversationMember(conversationId, participantUri); } } }, @@ -93,15 +90,12 @@ ContextMenuAutoLoader { itemName: JamiStrings.contactDetails iconSource: JamiResources.person_24dp_svg onClicked: { - viewCoordinator.presentDialog( - appWindow, - "mainview/components/UserProfile.qml", - { - aliasText: UtilsAdapter.getBestNameForUri(CurrentAccount.id, participantUri), - registeredNameText: UtilsAdapter.getBestIdForUri(CurrentAccount.id, participantUri), - idText: participantUri, - convId: UtilsAdapter.getConvIdForUri(CurrentAccount.id, participantUri) - }) + viewCoordinator.presentDialog(appWindow, "mainview/components/UserProfile.qml", { + "aliasText": UtilsAdapter.getBestNameForUri(CurrentAccount.id, participantUri), + "registeredNameText": UtilsAdapter.getBestIdForUri(CurrentAccount.id, participantUri), + "idText": participantUri, + "convId": UtilsAdapter.getConvIdForUri(CurrentAccount.id, participantUri) + }); } } ] diff --git a/src/app/mainview/components/TipBox.qml b/src/app/mainview/components/TipBox.qml index f09dcae0f883d119a1e6ab6ae99e0eb691c3fa9d..4644956ed4b45a116611f093275d4ab6cf16c46b 100644 --- a/src/app/mainview/components/TipBox.qml +++ b/src/app/mainview/components/TipBox.qml @@ -15,37 +15,28 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import Qt5Compat.GraphicalEffects - import "../../commoncomponents" Item { - id: root property string title: "" property string description: "" property int tipId: 0 - property string type : "" + property string type: "" property bool hovered: false - property bool clicked : false + property bool clicked: false property bool opened: false - property string customizeTip:"CustomizeTipBox {}" + property string customizeTip: "CustomizeTipBox {}" - property string backupTip: "BackupTipBox {" + - " onIgnore: {" + - " root.ignoreClicked()" + - " }" + - "}" + property string backupTip: "BackupTipBox {" + " onIgnore: {" + " root.ignoreClicked()" + " }" + "}" property string infoTip: "InformativeTipBox {}" @@ -55,7 +46,6 @@ Item { signal ignoreClicked Rectangle { - id: rect anchors.fill: parent @@ -71,18 +61,18 @@ Item { Component.onCompleted: { if (type === "customize") { - Qt.createQmlObject(customizeTip, this, 'tip') + Qt.createQmlObject(customizeTip, this, 'tip'); } else if (type === "backup") { - Qt.createQmlObject(backupTip, this, 'tip') + Qt.createQmlObject(backupTip, this, 'tip'); } else { - Qt.createQmlObject(infoTip, this, 'tip') + Qt.createQmlObject(infoTip, this, 'tip'); } } } } HoverHandler { - target : rect + target: rect onHoveredChanged: root.hovered = hovered cursorShape: Qt.PointingHandCursor } @@ -100,7 +90,7 @@ Item { horizontalOffset: 3.0 verticalOffset: 3.0 radius: 16 - color: Qt.rgba(0, 0.34,0.6,0.16) + color: Qt.rgba(0, 0.34, 0.6, 0.16) source: rect transparentBorder: true } @@ -111,14 +101,14 @@ Item { width: 20 height: 20 imageContainerWidth: 20 - imageContainerHeight : 20 + imageContainerHeight: 20 anchors.margins: 14 anchors.top: parent.top anchors.right: parent.right visible: opened circled: true - imageColor: Qt.rgba(0, 86/255, 153/255, 1) + imageColor: Qt.rgba(0, 86 / 255, 153 / 255, 1) normalColor: "transparent" toolTipText: JamiStrings.dismiss diff --git a/src/app/mainview/components/Toast.qml b/src/app/mainview/components/Toast.qml index db2347b62bf64a3b23b761a5ed016f4c53071ecd..ce94614734fc477aff4365a4469300a1cdecc61e 100644 --- a/src/app/mainview/components/Toast.qml +++ b/src/app/mainview/components/Toast.qml @@ -15,7 +15,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import net.jami.Constants 1.1 @@ -47,7 +46,7 @@ Rectangle { color: JamiTheme.toastColor } - SequentialAnimation on opacity { + SequentialAnimation on opacity { id: anim running: false diff --git a/src/app/mainview/components/ToastManager.qml b/src/app/mainview/components/ToastManager.qml index 3ade93324a451686011619c15be791249063e54b..aeca977ffaa4df01d4d81a73508abb3aa475506c 100644 --- a/src/app/mainview/components/ToastManager.qml +++ b/src/app/mainview/components/ToastManager.qml @@ -15,7 +15,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick Item { @@ -23,6 +22,10 @@ Item { function instantiate(message, duration, fadingTime) { var component = Qt.createComponent("Toast.qml"); - var sprite = component.createObject(root, {message: message, duration: duration, fadingTime: fadingTime}); + var sprite = component.createObject(root, { + "message": message, + "duration": duration, + "fadingTime": fadingTime + }); } } diff --git a/src/app/mainview/components/UpdateToSwarm.qml b/src/app/mainview/components/UpdateToSwarm.qml index 3ddcb8a208d716b278fd162fe2791bef7c999b0c..10023185412fb77a8784090dc00be909eecae4b8 100644 --- a/src/app/mainview/components/UpdateToSwarm.qml +++ b/src/app/mainview/components/UpdateToSwarm.qml @@ -15,14 +15,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" Control { @@ -63,8 +60,7 @@ Control { padding: 8 autoAccelerator: true font.pointSize: JamiTheme.textFontSize + 2 - onClicked: MessagesAdapter.removeContact( - LRCInstance.selectedConvUid) + onClicked: MessagesAdapter.removeContact(LRCInstance.selectedConvUid) } MaterialButton { @@ -72,8 +68,7 @@ Control { padding: 8 autoAccelerator: true font.pointSize: JamiTheme.textFontSize + 2 - onClicked: ConversationsAdapter.restartConversation( - LRCInstance.selectedConvUid) + onClicked: ConversationsAdapter.restartConversation(LRCInstance.selectedConvUid) } } } diff --git a/src/app/mainview/components/UserProfile.qml b/src/app/mainview/components/UserProfile.qml index 77069a637785ef5f3b73e5859d831481c2039f7c..d9bddf491f21ef94bfead831479e3a444f88be61 100644 --- a/src/app/mainview/components/UserProfile.qml +++ b/src/app/mainview/components/UserProfile.qml @@ -16,12 +16,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts - import net.jami.Constants 1.1 - import "../../commoncomponents" BaseModalDialog { @@ -108,7 +105,9 @@ BaseModalDialog { color: JamiTheme.textColor } - Item { Layout.fillWidth: true } + Item { + Layout.fillWidth: true + } Text { Layout.alignment: Qt.AlignRight @@ -192,9 +191,7 @@ BaseModalDialog { mipmap: false smooth: false - source: convId !== "" ? - "image://qrImage/contact_" + convId : - "image://qrImage/contact_" + idText + source: convId !== "" ? "image://qrImage/contact_" + convId : "image://qrImage/contact_" + idText } MaterialButton { diff --git a/src/app/mainview/components/WelcomePage.qml b/src/app/mainview/components/WelcomePage.qml index cf1bcd688c6b5f7a5b1268a058d8e3f4eee33771..432a040167a207bc57da7b418d0c89fef6f65fe6 100644 --- a/src/app/mainview/components/WelcomePage.qml +++ b/src/app/mainview/components/WelcomePage.qml @@ -14,16 +14,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Adapters 1.1 import net.jami.Constants 1.1 import net.jami.Enums 1.1 import net.jami.Models 1.1 - import "../../commoncomponents" import "../js/keyboardshortcuttablecreation.js" as KeyboardShortcutTableCreation @@ -68,15 +65,16 @@ ListSelectionView { color: JamiTheme.rectColor anchors.topMargin: 25 anchors.horizontalCenter: parent.horizontalCenter - width: identifier.width + 2 * JamiTheme.mainViewMargin + (welcomeLogo.visible ? welcomeLogo.width : 0) + width: identifier.width + 2 * JamiTheme.mainViewMargin + (welcomeLogo.visible ? welcomeLogo.width : 0) height: childrenRect.height + 10 - opacity:1 + opacity: 1 - Behavior on width { - NumberAnimation { duration: JamiTheme.shortFadeDuration } + Behavior on width { + NumberAnimation { + duration: JamiTheme.shortFadeDuration + } } - Label { id: welcome @@ -158,8 +156,10 @@ ListSelectionView { source: JamiResources.welcome_illustration_2_svg - Behavior on opacity { - NumberAnimation { duration: JamiTheme.shortFadeDuration } + Behavior on opacity { + NumberAnimation { + duration: JamiTheme.shortFadeDuration + } } } } @@ -192,17 +192,19 @@ ListSelectionView { property bool hideTipBox: false visible: { - if(hideTipBox) return false + if (hideTipBox) + return false; if (type === "backup") { - return LRCInstance.currentAccountType !== Profile.Type.SIP - && CurrentAccount.managerUri.length === 0 + return LRCInstance.currentAccountType !== Profile.Type.SIP && CurrentAccount.managerUri.length === 0; } else if (type === "customize") { - return CurrentAccount.alias.length === 0 + return CurrentAccount.alias.length === 0; } - return true + return true; } - onIgnoreClicked: { hideTipBox = true } + onIgnoreClicked: { + hideTipBox = true; + } } } } @@ -223,9 +225,7 @@ ListSelectionView { preferredWidth: JamiTheme.aboutButtonPreferredWidth text: JamiStrings.aboutJami - onClicked: viewCoordinator.presentDialog( - appWindow, - "mainview/components/AboutPopUp.qml") + onClicked: viewCoordinator.presentDialog(appWindow, "mainview/components/AboutPopUp.qml") } PushButton { @@ -236,7 +236,7 @@ ListSelectionView { hoveredColor: JamiTheme.transparentColor anchors.right: parent.right anchors.rightMargin: JamiTheme.preferredMarginSize - preferredSize : 30 + preferredSize: 30 imageContainerWidth: JamiTheme.pushButtonSize imageContainerHeight: JamiTheme.pushButtonSize @@ -245,9 +245,9 @@ ListSelectionView { source: JamiResources.keyboard_black_24dp_svg toolTipText: JamiStrings.keyboardShortcuts - onClicked: { - KeyboardShortcutTableCreation.createKeyboardShortcutTableWindowObject(appWindow) - KeyboardShortcutTableCreation.showKeyboardShortcutTableWindow() + onClicked: { + KeyboardShortcutTableCreation.createKeyboardShortcutTableWindowObject(appWindow); + KeyboardShortcutTableCreation.showKeyboardShortcutTableWindow(); } } } diff --git a/src/app/mainview/components/WelcomePageQrDialog.qml b/src/app/mainview/components/WelcomePageQrDialog.qml index e7747a1b79cb128b75370a90215e62270b778d1b..39e925f0368a30c32c1ec1e4dcfaa9173c61b381 100644 --- a/src/app/mainview/components/WelcomePageQrDialog.qml +++ b/src/app/mainview/components/WelcomePageQrDialog.qml @@ -15,12 +15,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick - import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" BaseModalDialog { diff --git a/src/app/nowebengine/EmojiPicker.qml b/src/app/nowebengine/EmojiPicker.qml index ceb6528a148eb376499a72c0b7f4615de3d0e36c..cc020c26cbd8be8afd1d58b6adb58a923ae60e5f 100644 --- a/src/app/nowebengine/EmojiPicker.qml +++ b/src/app/nowebengine/EmojiPicker.qml @@ -15,7 +15,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick Rectangle { @@ -24,6 +23,8 @@ Rectangle { required property ListView listView signal emojiIsPicked(string content) - function openEmojiPicker() {} - function closeEmojiPicker() {} + function openEmojiPicker() { + } + function closeEmojiPicker() { + } } diff --git a/src/app/nowebengine/MediaPreviewBase.qml b/src/app/nowebengine/MediaPreviewBase.qml index 545fa8ee3eb74349ee16065a7662401fb6c3bcaa..0ea0570957aa543ece386e797006fbc6fc36d6a9 100644 --- a/src/app/nowebengine/MediaPreviewBase.qml +++ b/src/app/nowebengine/MediaPreviewBase.qml @@ -15,7 +15,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts diff --git a/src/app/nowebengine/VideoPreview.qml b/src/app/nowebengine/VideoPreview.qml index ab0f4e771f5fc179257e2a69123b558a36b062b6..f830136777f330bdabe9f50e5865ff174d4fe14a 100644 --- a/src/app/nowebengine/VideoPreview.qml +++ b/src/app/nowebengine/VideoPreview.qml @@ -14,11 +14,10 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts Rectangle { property var mediaInfo: undefined -} \ No newline at end of file +} diff --git a/src/app/settingsview/SettingsSidePanel.qml b/src/app/settingsview/SettingsSidePanel.qml index d56eaee14a95020b8c9c85b3e42d211eaab9edd0..86479e6ae8e1525f5c5539410785518c98031d28 100644 --- a/src/app/settingsview/SettingsSidePanel.qml +++ b/src/app/settingsview/SettingsSidePanel.qml @@ -14,17 +14,14 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Adapters 1.1 import net.jami.Constants 1.1 import net.jami.Enums 1.1 import net.jami.Models 1.1 import net.jami.Helpers 1.1 - import "../mainview/components" import "../commoncomponents" import "components" @@ -36,12 +33,11 @@ SidePanelBase { color: JamiTheme.backgroundColor property int currentIndex - function createChild() { if (page.menu === undefined) { - return + return; } - page.menu.createChild() + page.menu.createChild(); } Page { @@ -51,15 +47,15 @@ SidePanelBase { background: null - header: AccountComboBox {} + header: AccountComboBox { + } // Bind to requests for a settings page to be selected via shorcut. Connections { target: JamiQmlUtils function onSettingsPageRequested(index) { - viewCoordinator.present("SettingsView") - - buttonGroup.checkedButton = buttonGroup.buttons[index] + viewCoordinator.present("SettingsView"); + buttonGroup.checkedButton = buttonGroup.buttons[index]; } } @@ -73,104 +69,83 @@ SidePanelBase { contentHeight: col.implicitHeight function getHeaders() { - return [ - { - "title": JamiStrings.accountSettingsMenuTitle, - "icon": JamiResources.account_24dp_svg, - "children": [ - { - "id": 0, - "title": JamiStrings.manageAccountSettingsTitle - }, - { - "id": 1, - "title": JamiStrings.customizeProfile - }, - { - "id": 2, - "title": JamiStrings.linkedDevicesSettingsTitle, - "visible": "isJamiAccount" - }, - { - "id": 3, - "title": JamiStrings.callSettingsTitle - }, - { - "id": 4, - "title": JamiStrings.advancedSettingsTitle - } - ] - }, - { - "title": JamiStrings.generalSettingsTitle, - "icon": JamiResources.gear_black_24dp_svg, - "children": [ - { - "id": 5, - "title": JamiStrings.system - }, - { - "id": 6, - "title": JamiStrings.appearence - }, - { - "id": 7, - "title": JamiStrings.locationSharingLabel - }, - { - "id": 8, - "title": JamiStrings.fileTransfer - }, - { - "id": 9, - "title": JamiStrings.callRecording - }, - { - "id": 10, - "title": JamiStrings.troubleshootTitle - }, - { - "id": 11, - "title": JamiStrings.updatesTitle, - "visible": "isUpdatable" - } - ] - },{ - "title": JamiStrings.audioVideoSettingsTitle, - "icon": JamiResources.media_black_24dp_svg, - "children": [ - { - "id": 12, - "title": JamiStrings.audio - }, - { - "id": 13, - "title": JamiStrings.video - }, - { - "id": 14, - "title": JamiStrings.screenSharing - } - ] - },{ - "title": JamiStrings.pluginSettingsTitle, - "icon": JamiResources.plugins_24dp_svg, - "children": [ - { - "id": 15, - "title": JamiStrings.pluginSettingsTitle - } - ] - } - ]} + return [{ + "title": JamiStrings.accountSettingsMenuTitle, + "icon": JamiResources.account_24dp_svg, + "children": [{ + "id": 0, + "title": JamiStrings.manageAccountSettingsTitle + }, { + "id": 1, + "title": JamiStrings.customizeProfile + }, { + "id": 2, + "title": JamiStrings.linkedDevicesSettingsTitle, + "visible": "isJamiAccount" + }, { + "id": 3, + "title": JamiStrings.callSettingsTitle + }, { + "id": 4, + "title": JamiStrings.advancedSettingsTitle + }] + }, { + "title": JamiStrings.generalSettingsTitle, + "icon": JamiResources.gear_black_24dp_svg, + "children": [{ + "id": 5, + "title": JamiStrings.system + }, { + "id": 6, + "title": JamiStrings.appearence + }, { + "id": 7, + "title": JamiStrings.locationSharingLabel + }, { + "id": 8, + "title": JamiStrings.fileTransfer + }, { + "id": 9, + "title": JamiStrings.callRecording + }, { + "id": 10, + "title": JamiStrings.troubleshootTitle + }, { + "id": 11, + "title": JamiStrings.updatesTitle, + "visible": "isUpdatable" + }] + }, { + "title": JamiStrings.audioVideoSettingsTitle, + "icon": JamiResources.media_black_24dp_svg, + "children": [{ + "id": 12, + "title": JamiStrings.audio + }, { + "id": 13, + "title": JamiStrings.video + }, { + "id": 14, + "title": JamiStrings.screenSharing + }] + }, { + "title": JamiStrings.pluginSettingsTitle, + "icon": JamiResources.plugins_24dp_svg, + "children": [{ + "id": 15, + "title": JamiStrings.pluginSettingsTitle + }] + }]; + } Column { id: col anchors.left: parent.left Component.onCompleted: { - page.menu = clv.createObject(this, {"base":flick.getHeaders()}); + page.menu = clv.createObject(this, { + "base": flick.getHeaders() + }); } - } Component { id: clv @@ -184,8 +159,8 @@ SidePanelBase { Layout.fillWidth: true function createChild() { - itemAt(0).children[0].createChild() - root.currentIndex = 0 + itemAt(0).children[0].createChild(); + root.currentIndex = 0; } ColumnLayout { @@ -198,51 +173,50 @@ SidePanelBase { property var sprite: null property var isChildren: { - var ob = base[modelData] - var c = ob["children"] - return c === undefined + var ob = base[modelData]; + var c = ob["children"]; + return c === undefined; } function updateVisibility() { - var currentVisibility = visible - var ob = base[modelData] - var c = ob["visible"] + var currentVisibility = visible; + var ob = base[modelData]; + var c = ob["visible"]; if (c === undefined) - return true - var res = false + return true; + var res = false; if (c === "isUpdatable") { - res = UpdateManager.isUpdaterEnabled() + res = UpdateManager.isUpdaterEnabled(); } else if (c === "isJamiAccount") { - res = CurrentAccount.type !== Profile.Type.SIP + res = CurrentAccount.type !== Profile.Type.SIP; } else { - console.warn("Visibility condition not managed") + console.warn("Visibility condition not managed"); } if (currentVisibility !== res && root.currentIndex === ob["id"]) { // If a menu disappears, go to the first index - root.currentIndex = 0 - root.indexSelected(0) + root.currentIndex = 0; + root.indexSelected(0); } - - return res + return res; } - function createChild() { - var ob = base[modelData] - if(sprite === null) { + var ob = base[modelData]; + if (sprite === null) { //deselect the current selection and collapse menu if (repeater.selected) - repeater.selected.destroy() - - var c = ob["children"] + repeater.selected.destroy(); + var c = ob["children"]; if (c !== undefined) { - sprite = clv.createObject(parent, {"base" : c}); - repeater.selected = sprite - indexSelected(c[0]["id"]) - root.currentIndex = c[0]["id"] + sprite = clv.createObject(parent, { + "base": c + }); + repeater.selected = sprite; + indexSelected(c[0]["id"]); + root.currentIndex = c[0]["id"]; } else { - indexSelected(ob["id"]) - root.currentIndex = ob["id"] + indexSelected(ob["id"]); + root.currentIndex = ob["id"]; } } } @@ -264,7 +238,7 @@ SidePanelBase { radius: 0 buttonText: { - return base[modelData]["title"] + return base[modelData]["title"]; } buttonTextFont.pixelSize: !isChildren ? JamiTheme.settingsDescriptionPixelSize : JamiTheme.settingMenuPixelSize @@ -277,19 +251,18 @@ SidePanelBase { imageColor: !isChildren ? JamiTheme.tintedBlue : null source: { - if (!isChildren) - return base[modelData]["icon"] - else return "" + return base[modelData]["icon"]; + else + return ""; } onClicked: createChild() Keys.onPressed: function (keyEvent) { - if (keyEvent.key === Qt.Key_Enter || - keyEvent.key === Qt.Key_Return) { - clicked() - keyEvent.accepted = true + if (keyEvent.key === Qt.Key_Enter || keyEvent.key === Qt.Key_Return) { + clicked(); + keyEvent.accepted = true; } } } @@ -297,6 +270,5 @@ SidePanelBase { } } } - } } diff --git a/src/app/settingsview/SettingsView.qml b/src/app/settingsview/SettingsView.qml index 09dc48715cb8b9c0030c1622d71d35eb26d0a090..43f3b0ac6402e9711082ecfa9eceb419ed2bc2eb 100644 --- a/src/app/settingsview/SettingsView.qml +++ b/src/app/settingsview/SettingsView.qml @@ -16,20 +16,16 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Enums 1.1 import net.jami.Constants 1.1 import net.jami.Helpers 1.1 - import "components" import "../commoncomponents" - import "../mainview/js/contactpickercreation.js" as ContactPickerCreation ListSelectionView { @@ -53,7 +49,7 @@ ListSelectionView { "AudioSettingsPage": Qt.resolvedUrl("components/AudioSettingsPage.qml"), "VideoSettingsPage": Qt.resolvedUrl("components/VideoSettingsPage.qml"), "ScreenSharingSettingsPage": Qt.resolvedUrl("components/ScreenSharingSettingsPage.qml"), - "PluginSettingsPage": Qt.resolvedUrl("components/PluginSettingsPage.qml"), + "PluginSettingsPage": Qt.resolvedUrl("components/PluginSettingsPage.qml") } splitViewStateKey: "Main" @@ -64,16 +60,16 @@ ListSelectionView { onDismissed: { // Trigger an update to messages if needed. // Currently needed when changing the show link preview setting. - CurrentConversation.reloadInteractions() + CurrentConversation.reloadInteractions(); if (UtilsAdapter.getAccountListSize() === 0) { - viewCoordinator.requestAppWindowWizardView() + viewCoordinator.requestAppWindowWizardView(); } else { - AccountAdapter.changeAccount(0) + AccountAdapter.changeAccount(0); } } Component.onCompleted: { - leftPaneItem.createChild() + leftPaneItem.createChild(); } property int selectedMenu: index @@ -87,62 +83,61 @@ ListSelectionView { signal stopBooth - initialItem: ManageAccountPage {} + initialItem: ManageAccountPage { + } onCurrentIndexChanged: { - - switch(currentIndex) { - default: - case 0: - replace(currentItem, viewNode.resources["ManageAccountPage"], StackView.Immediate) - break - case 1: - replace(currentItem, viewNode.resources["CustomizeProfilePage"], StackView.Immediate) - break - case 2: - replace(currentItem, viewNode.resources["LinkedDevicesPage"], StackView.Immediate) - break - case 3: - replace(currentItem, viewNode.resources["CallSettingsPage"], StackView.Immediate) - break - case 4: - replace(currentItem, viewNode.resources["AdvancedSettingsPage"], StackView.Immediate) - break - case 5: - replace(currentItem, viewNode.resources["SystemSettingsPage"], StackView.Immediate) - break - case 6: - replace(currentItem, viewNode.resources["AppearenceSettingsPage"], StackView.Immediate) - break - case 7: - replace(currentItem, viewNode.resources["LocationSharingSettingsPage"], StackView.Immediate) - break - case 8: - replace(currentItem, viewNode.resources["FileTransferSettingsPage"], StackView.Immediate) - break - case 9: - replace(currentItem, viewNode.resources["CallRecordingSettingsPage"], StackView.Immediate) - break - case 10: - replace(currentItem, viewNode.resources["TroubleshootSettingsPage"], StackView.Immediate) - break - case 11: - replace(currentItem, viewNode.resources["UpdateSettingsPage"], StackView.Immediate) - break - case 12: - replace(currentItem, viewNode.resources["AudioSettingsPage"], StackView.Immediate) - break - case 13: - replace(currentItem, viewNode.resources["VideoSettingsPage"], StackView.Immediate) - break - case 14: - replace(currentItem, viewNode.resources["ScreenSharingSettingsPage"], StackView.Immediate) - break - case 15: - replace(currentItem, viewNode.resources["PluginSettingsPage"], StackView.Immediate) - break + switch (currentIndex) { + default: + case 0: + replace(currentItem, viewNode.resources["ManageAccountPage"], StackView.Immediate); + break; + case 1: + replace(currentItem, viewNode.resources["CustomizeProfilePage"], StackView.Immediate); + break; + case 2: + replace(currentItem, viewNode.resources["LinkedDevicesPage"], StackView.Immediate); + break; + case 3: + replace(currentItem, viewNode.resources["CallSettingsPage"], StackView.Immediate); + break; + case 4: + replace(currentItem, viewNode.resources["AdvancedSettingsPage"], StackView.Immediate); + break; + case 5: + replace(currentItem, viewNode.resources["SystemSettingsPage"], StackView.Immediate); + break; + case 6: + replace(currentItem, viewNode.resources["AppearenceSettingsPage"], StackView.Immediate); + break; + case 7: + replace(currentItem, viewNode.resources["LocationSharingSettingsPage"], StackView.Immediate); + break; + case 8: + replace(currentItem, viewNode.resources["FileTransferSettingsPage"], StackView.Immediate); + break; + case 9: + replace(currentItem, viewNode.resources["CallRecordingSettingsPage"], StackView.Immediate); + break; + case 10: + replace(currentItem, viewNode.resources["TroubleshootSettingsPage"], StackView.Immediate); + break; + case 11: + replace(currentItem, viewNode.resources["UpdateSettingsPage"], StackView.Immediate); + break; + case 12: + replace(currentItem, viewNode.resources["AudioSettingsPage"], StackView.Immediate); + break; + case 13: + replace(currentItem, viewNode.resources["VideoSettingsPage"], StackView.Immediate); + break; + case 14: + replace(currentItem, viewNode.resources["ScreenSharingSettingsPage"], StackView.Immediate); + break; + case 15: + replace(currentItem, viewNode.resources["PluginSettingsPage"], StackView.Immediate); + break; } - } } } diff --git a/src/app/settingsview/components/AccountProfile.qml b/src/app/settingsview/components/AccountProfile.qml index 996255bd4f2dfd25814d7958d6543239651c1519..f203a14080d614ef9bffe50466683f251f6a1287 100644 --- a/src/app/settingsview/components/AccountProfile.qml +++ b/src/app/settingsview/components/AccountProfile.qml @@ -15,20 +15,17 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" ColumnLayout { + id: root spacing: 8 - id: root Text { Layout.fillWidth: true diff --git a/src/app/settingsview/components/AdvancedChatSettings.qml b/src/app/settingsview/components/AdvancedChatSettings.qml index 0544875bd121eefeff07152d267611e49bb7f9d9..b13bdbcef64cc5446cb6b69607770a826a796a80 100644 --- a/src/app/settingsview/components/AdvancedChatSettings.qml +++ b/src/app/settingsview/components/AdvancedChatSettings.qml @@ -15,14 +15,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" ColumnLayout { @@ -39,7 +36,7 @@ ColumnLayout { color: JamiTheme.textColor horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter - wrapMode : Text.WordWrap + wrapMode: Text.WordWrap font.pixelSize: JamiTheme.settingsTitlePixelSize font.kerning: true @@ -56,5 +53,4 @@ ColumnLayout { onSwitchToggled: CurrentAccount.sendReadReceipt = checked } - } diff --git a/src/app/settingsview/components/AdvancedConnectivitySettings.qml b/src/app/settingsview/components/AdvancedConnectivitySettings.qml index 327c94c4d6fda801ae08049c04e83a6bcdc02d8a..27106f42fa72072e3006f54f727d2e96b2a75444 100644 --- a/src/app/settingsview/components/AdvancedConnectivitySettings.qml +++ b/src/app/settingsview/components/AdvancedConnectivitySettings.qml @@ -15,14 +15,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" ColumnLayout { @@ -41,7 +38,7 @@ ColumnLayout { color: JamiTheme.textColor horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter - wrapMode : Text.WordWrap + wrapMode: Text.WordWrap font.pixelSize: JamiTheme.settingsTitlePixelSize font.kerning: true @@ -69,7 +66,7 @@ ColumnLayout { title: JamiStrings.registrationExpirationTime itemWidth: root.itemWidth bottomValue: 0 - topValue: 7*24*3600 + topValue: 7 * 24 * 3600 valueField: CurrentAccount.registrationExpire onNewValue: CurrentAccount.registrationExpire = valueField diff --git a/src/app/settingsview/components/AdvancedJamiSecuritySettings.qml b/src/app/settingsview/components/AdvancedJamiSecuritySettings.qml index 928898ad97fc9fcea248d4a7c582516dc5200ee8..c3efb1dc1c9d9f5ada1937b6730395fb84ea7bf6 100644 --- a/src/app/settingsview/components/AdvancedJamiSecuritySettings.qml +++ b/src/app/settingsview/components/AdvancedJamiSecuritySettings.qml @@ -15,14 +15,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" ColumnLayout { @@ -31,19 +28,14 @@ ColumnLayout { property int itemWidth function openFileDialog(title, oldPath, fileType, onAcceptedCb) { - var openPath = oldPath === "" ? - (UtilsAdapter.getCurrentPath() + "/ringtones/") : - (UtilsAdapter.toFileAbsolutepath(oldPath)) - var dlg = viewCoordinator.presentDialog( - appWindow, - "commoncomponents/JamiFileDialog.qml", - { - title: title, - fileMode: JamiFileDialog.OpenFile, - folder: openPath, - nameFilters: [fileType, JamiStrings.allFiles] - }) - dlg.fileAccepted.connect(onAcceptedCb) + var openPath = oldPath === "" ? (UtilsAdapter.getCurrentPath() + "/ringtones/") : (UtilsAdapter.toFileAbsolutepath(oldPath)); + var dlg = viewCoordinator.presentDialog(appWindow, "commoncomponents/JamiFileDialog.qml", { + "title": title, + "fileMode": JamiFileDialog.OpenFile, + "folder": openPath, + "nameFilters": [fileType, JamiStrings.allFiles] + }); + dlg.fileAccepted.connect(onAcceptedCb); } Text { @@ -55,7 +47,7 @@ ColumnLayout { color: JamiTheme.textColor horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter - wrapMode : Text.WordWrap + wrapMode: Text.WordWrap font.pixelSize: JamiTheme.settingsTitlePixelSize font.kerning: true @@ -74,13 +66,9 @@ ColumnLayout { titleField: JamiStrings.caCertificate itemWidth: root.itemWidth - onClick: openFileDialog(JamiStrings.selectCACert, - CurrentAccount.certificateListFile_TLS, - JamiStrings.certificateFile, - function (file) { - CurrentAccount.certificateListFile_TLS = - UtilsAdapter.getAbsPath(file.toString()) - }) + onClick: openFileDialog(JamiStrings.selectCACert, CurrentAccount.certificateListFile_TLS, JamiStrings.certificateFile, function (file) { + CurrentAccount.certificateListFile_TLS = UtilsAdapter.getAbsPath(file.toString()); + }) } SettingMaterialButton { @@ -93,13 +81,9 @@ ColumnLayout { titleField: JamiStrings.userCertificate itemWidth: root.itemWidth - onClick: openFileDialog(JamiStrings.selectUserCert, - CurrentAccount.certificateFile_TLS, - JamiStrings.certificateFile, - function (file) { - CurrentAccount.certificateFile_TLS = - UtilsAdapter.getAbsPath(file.toString()) - }) + onClick: openFileDialog(JamiStrings.selectUserCert, CurrentAccount.certificateFile_TLS, JamiStrings.certificateFile, function (file) { + CurrentAccount.certificateFile_TLS = UtilsAdapter.getAbsPath(file.toString()); + }) } SettingMaterialButton { @@ -112,13 +96,9 @@ ColumnLayout { titleField: JamiStrings.privateKey itemWidth: root.itemWidth - onClick: openFileDialog(JamiStrings.selectPrivateKey, - CurrentAccount.privateKeyFile_TLS, - JamiStrings.keyFile, - function (file) { - CurrentAccount.privateKeyFile_TLS = - UtilsAdapter.getAbsPath(file.toString()) - }) + onClick: openFileDialog(JamiStrings.selectPrivateKey, CurrentAccount.privateKeyFile_TLS, JamiStrings.keyFile, function (file) { + CurrentAccount.privateKeyFile_TLS = UtilsAdapter.getAbsPath(file.toString()); + }) } SettingsMaterialTextEdit { diff --git a/src/app/settingsview/components/AdvancedMediaSettings.qml b/src/app/settingsview/components/AdvancedMediaSettings.qml index c5f8449b98107be982726e05f12567658334cf38..f97cb162346edd5ff4adddcddf4ca3201fdc3c07 100644 --- a/src/app/settingsview/components/AdvancedMediaSettings.qml +++ b/src/app/settingsview/components/AdvancedMediaSettings.qml @@ -15,15 +15,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts import QtQuick.Controls - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" ColumnLayout { @@ -39,7 +36,7 @@ ColumnLayout { color: JamiTheme.textColor horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter - wrapMode : Text.WordWrap + wrapMode: Text.WordWrap font.pixelSize: JamiTheme.settingsTitlePixelSize font.kerning: true diff --git a/src/app/settingsview/components/AdvancedNameServerSettings.qml b/src/app/settingsview/components/AdvancedNameServerSettings.qml index 3baf49b04a5ff50180dc92f5feca6732a69a6c52..5f1a198f9b164a047e5eeb63d1300908fa706053 100644 --- a/src/app/settingsview/components/AdvancedNameServerSettings.qml +++ b/src/app/settingsview/components/AdvancedNameServerSettings.qml @@ -15,14 +15,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" ColumnLayout { @@ -39,7 +36,7 @@ ColumnLayout { color: JamiTheme.textColor horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter - wrapMode : Text.WordWrap + wrapMode: Text.WordWrap font.pixelSize: JamiTheme.settingsTitlePixelSize font.kerning: true diff --git a/src/app/settingsview/components/AdvancedOpenDHTSettings.qml b/src/app/settingsview/components/AdvancedOpenDHTSettings.qml index 3ced3eca7487539f7019b3e33ec89ed95f17f69a..fed7dad9e06d9b4589edc482264e92952e211e90 100644 --- a/src/app/settingsview/components/AdvancedOpenDHTSettings.qml +++ b/src/app/settingsview/components/AdvancedOpenDHTSettings.qml @@ -15,14 +15,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" ColumnLayout { @@ -39,11 +36,10 @@ ColumnLayout { color: JamiTheme.textColor horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter - wrapMode : Text.WordWrap + wrapMode: Text.WordWrap font.pixelSize: JamiTheme.settingsTitlePixelSize font.kerning: true - } ColumnLayout { diff --git a/src/app/settingsview/components/AdvancedPublicAddressSettings.qml b/src/app/settingsview/components/AdvancedPublicAddressSettings.qml index 690b2bb271d5ee5997883bbc784e115a02193706..3a9b3ef4201b0e432b49dee775caa71bae6dc738 100644 --- a/src/app/settingsview/components/AdvancedPublicAddressSettings.qml +++ b/src/app/settingsview/components/AdvancedPublicAddressSettings.qml @@ -15,14 +15,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" ColumnLayout { diff --git a/src/app/settingsview/components/AdvancedSDPSettings.qml b/src/app/settingsview/components/AdvancedSDPSettings.qml index 63311ce9ed2d754a36bb94cbb3fe048be2ef981b..60a9f50d29836ef985252ef5a48f03a7ffddb0d1 100644 --- a/src/app/settingsview/components/AdvancedSDPSettings.qml +++ b/src/app/settingsview/components/AdvancedSDPSettings.qml @@ -15,14 +15,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" ColumnLayout { @@ -34,18 +31,16 @@ ColumnLayout { Text { Layout.alignment: Qt.AlignLeft - Layout.preferredWidth:Math.min(JamiTheme.maximumWidthSettingsView, - root.width - 2 * JamiTheme.preferredSettingsMarginSize) + Layout.preferredWidth: Math.min(JamiTheme.maximumWidthSettingsView, root.width - 2 * JamiTheme.preferredSettingsMarginSize) text: JamiStrings.sdpSettingsTitle color: JamiTheme.textColor horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter - wrapMode : Text.WordWrap + wrapMode: Text.WordWrap font.pixelSize: JamiTheme.settingsTitlePixelSize font.kerning: true - } ColumnLayout { diff --git a/src/app/settingsview/components/AdvancedSIPSecuritySettings.qml b/src/app/settingsview/components/AdvancedSIPSecuritySettings.qml index 6d7f0223fe8a567eeaf8aff5c744c6099cba4c3e..a76d883478f739cd5eb9cfd1c410687b4c41a0f2 100644 --- a/src/app/settingsview/components/AdvancedSIPSecuritySettings.qml +++ b/src/app/settingsview/components/AdvancedSIPSecuritySettings.qml @@ -15,15 +15,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts import QtQuick.Controls - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" ColumnLayout { @@ -33,19 +30,14 @@ ColumnLayout { spacing: JamiTheme.settingsCategorySpacing function openFileDialog(title, oldPath, fileType, onAcceptedCb) { - var openPath = oldPath === "" ? - (UtilsAdapter.getCurrentPath() + "/ringtones/") : - (UtilsAdapter.toFileAbsolutepath(oldPath)) - var dlg = viewCoordinator.presentDialog( - appWindow, - "commoncomponents/JamiFileDialog.qml", - { - title: title, - fileMode: JamiFileDialog.OpenFile, - folder: openPath, - nameFilters: [fileType, JamiStrings.allFiles] - }) - dlg.fileAccepted.connect(onAcceptedCb) + var openPath = oldPath === "" ? (UtilsAdapter.getCurrentPath() + "/ringtones/") : (UtilsAdapter.toFileAbsolutepath(oldPath)); + var dlg = viewCoordinator.presentDialog(appWindow, "commoncomponents/JamiFileDialog.qml", { + "title": title, + "fileMode": JamiFileDialog.OpenFile, + "folder": openPath, + "nameFilters": [fileType, JamiStrings.allFiles] + }); + dlg.fileAccepted.connect(onAcceptedCb); } Text { @@ -57,8 +49,8 @@ ColumnLayout { color: JamiTheme.textColor horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter - wrapMode : Text.WordWrap - + wrapMode: Text.WordWrap + font.pixelSize: JamiTheme.settingsTitlePixelSize font.kerning: true } @@ -101,13 +93,9 @@ ColumnLayout { textField: UtilsAdapter.toFileInfoName(CurrentAccount.certificateListFile_TLS) !== "" ? UtilsAdapter.toFileInfoName(CurrentAccount.certificateListFile_TLS) : JamiStrings.selectCACertDefault itemWidth: root.itemWidth - onClick: openFileDialog(JamiStrings.selectCACert, - CurrentAccount.certificateListFile_TLS, - JamiStrings.certificateFile, - function (file) { - CurrentAccount.certificateListFile_TLS = - UtilsAdapter.getAbsPath(file.toString()) - }) + onClick: openFileDialog(JamiStrings.selectCACert, CurrentAccount.certificateListFile_TLS, JamiStrings.certificateFile, function (file) { + CurrentAccount.certificateListFile_TLS = UtilsAdapter.getAbsPath(file.toString()); + }) } SettingMaterialButton { @@ -120,13 +108,9 @@ ColumnLayout { itemWidth: root.itemWidth textField: UtilsAdapter.toFileInfoName(CurrentAccount.certificateFile_TLS) !== "" ? UtilsAdapter.toFileInfoName(CurrentAccount.certificateFile_TLS) : JamiStrings.selectCACertDefault - onClick: openFileDialog(JamiStrings.selectUserCert, - CurrentAccount.certificateFile_TLS, - JamiStrings.certificateFile, - function (file) { - CurrentAccount.certificateFile_TLS = - UtilsAdapter.getAbsPath(file.toString()) - }) + onClick: openFileDialog(JamiStrings.selectUserCert, CurrentAccount.certificateFile_TLS, JamiStrings.certificateFile, function (file) { + CurrentAccount.certificateFile_TLS = UtilsAdapter.getAbsPath(file.toString()); + }) } SettingMaterialButton { @@ -139,13 +123,9 @@ ColumnLayout { itemWidth: root.itemWidth textField: UtilsAdapter.toFileInfoName(CurrentAccount.privateKeyFile_TLS) !== "" ? UtilsAdapter.toFileInfoName(CurrentAccount.privateKeyFile_TLS) : JamiStrings.selectCACertDefault - onClick: openFileDialog(JamiStrings.selectPrivateKey, - CurrentAccount.privateKeyFile_TLS, - JamiStrings.keyFile, - function (file) { - CurrentAccount.privateKeyFile_TLS = - UtilsAdapter.getAbsPath(file.toString()) - }) + onClick: openFileDialog(JamiStrings.selectPrivateKey, CurrentAccount.privateKeyFile_TLS, JamiStrings.keyFile, function (file) { + CurrentAccount.privateKeyFile_TLS = UtilsAdapter.getAbsPath(file.toString()); + }) } // Private key password @@ -204,10 +184,26 @@ ColumnLayout { labelText: JamiStrings.tlsProtocol comboModel: ListModel { - ListElement{textDisplay: "Default"; firstArg: "Default"; secondArg: 0} - ListElement{textDisplay: "TLSv1"; firstArg: "TLSv1"; secondArg: 1} - ListElement{textDisplay: "TLSv1.1"; firstArg: "TLSv1.1"; secondArg: 2} - ListElement{textDisplay: "TLSv1.2"; firstArg: "TLSv1.2"; secondArg: 3} + ListElement { + textDisplay: "Default" + firstArg: "Default" + secondArg: 0 + } + ListElement { + textDisplay: "TLSv1" + firstArg: "TLSv1" + secondArg: 1 + } + ListElement { + textDisplay: "TLSv1.1" + firstArg: "TLSv1.1" + secondArg: 2 + } + ListElement { + textDisplay: "TLSv1.2" + firstArg: "TLSv1.2" + secondArg: 3 + } } widthOfComboBox: root.itemWidth tipText: JamiStrings.audioDeviceSelector @@ -215,8 +211,7 @@ ColumnLayout { modelIndex: CurrentAccount.method_TLS - onActivated: CurrentAccount.method_TLS = - parseInt(comboModel.get(modelIndex).secondArg) + onActivated: CurrentAccount.method_TLS = parseInt(comboModel.get(modelIndex).secondArg) } SettingsMaterialTextEdit { diff --git a/src/app/settingsview/components/AdvancedSettings.qml b/src/app/settingsview/components/AdvancedSettings.qml index 813b3fa6b20803aa3355ce61ecf6f5446026ea7c..e611d08b2baea8e5443df629c74cd57724e67841 100644 --- a/src/app/settingsview/components/AdvancedSettings.qml +++ b/src/app/settingsview/components/AdvancedSettings.qml @@ -15,14 +15,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" ColumnLayout { @@ -59,18 +56,14 @@ ColumnLayout { Layout.alignment: Qt.AlignHCenter imageColor: JamiTheme.textColor - toolTipText: advancedSettingsView.visible ? - JamiStrings.tipAdvancedSettingsHide : - JamiStrings.tipAdvancedSettingsDisplay + toolTipText: advancedSettingsView.visible ? JamiStrings.tipAdvancedSettingsHide : JamiStrings.tipAdvancedSettingsDisplay preferredSize: 32 - source: advancedSettingsView.visible ? - JamiResources.expand_less_24dp_svg : - JamiResources.expand_more_24dp_svg + source: advancedSettingsView.visible ? JamiResources.expand_less_24dp_svg : JamiResources.expand_more_24dp_svg onClicked: { - advancedSettingsView.visible = !advancedSettingsView.visible - showAdvancedSettingsRequest() + advancedSettingsView.visible = !advancedSettingsView.visible; + showAdvancedSettingsRequest(); } } } @@ -108,7 +101,5 @@ ColumnLayout { visible: LRCInstance.currentAccountType === Profile.Type.SIP itemWidth: root.itemWidth } - - } } diff --git a/src/app/settingsview/components/AdvancedSettingsPage.qml b/src/app/settingsview/components/AdvancedSettingsPage.qml index f27549db069032524955fd3d7c8160c1c42979fc..7869af3c04858ec84ea0e9304594361bab2f6507 100644 --- a/src/app/settingsview/components/AdvancedSettingsPage.qml +++ b/src/app/settingsview/components/AdvancedSettingsPage.qml @@ -15,16 +15,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Enums 1.1 import net.jami.Constants 1.1 import net.jami.Helpers 1.1 - import "../../commoncomponents" SettingsPageBase { @@ -36,7 +33,6 @@ SettingsPageBase { title: JamiStrings.advancedSettingsTitle flickableContent: ColumnLayout { - id: currentAccountEnableColumnLayout width: contentFlickableWidth @@ -116,4 +112,3 @@ SettingsPageBase { } } } - diff --git a/src/app/settingsview/components/AdvancedVoiceMailSettings.qml b/src/app/settingsview/components/AdvancedVoiceMailSettings.qml index 91319b9855d9d5ee41453944732aede3d74362cc..14968cd056b6ee3d2d64b5a2d5c6443cd638703a 100644 --- a/src/app/settingsview/components/AdvancedVoiceMailSettings.qml +++ b/src/app/settingsview/components/AdvancedVoiceMailSettings.qml @@ -15,15 +15,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts import QtQuick.Controls - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" ColumnLayout { diff --git a/src/app/settingsview/components/AppearenceSettingsPage.qml b/src/app/settingsview/components/AppearenceSettingsPage.qml index 860daa76592845aa5e7116ac3fe8f4a054d1e0c5..e04a5ee68098649565199b80bdd6fa0bfd2478cc 100644 --- a/src/app/settingsview/components/AppearenceSettingsPage.qml +++ b/src/app/settingsview/components/AppearenceSettingsPage.qml @@ -15,22 +15,18 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts import QtQuick.Controls - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Enums 1.1 import net.jami.Constants 1.1 import net.jami.Helpers 1.1 - import "../../commoncomponents" import "../../mainview/components" import "../../mainview/js/contactpickercreation.js" as ContactPickerCreation - SettingsPageBase { id: root @@ -62,11 +58,10 @@ SettingsPageBase { color: JamiTheme.textColor horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter - wrapMode : Text.WordWrap + wrapMode: Text.WordWrap font.pixelSize: JamiTheme.settingsTitlePixelSize font.kerning: true - } ToggleSwitch { @@ -98,7 +93,7 @@ SettingsPageBase { tooltipText: JamiStrings.displayHyperlinkPreviews onSwitchToggled: { - UtilsAdapter.setAppValue(Settings.Key.DisplayHyperlinkPreviews, checked) + UtilsAdapter.setAppValue(Settings.Key.DisplayHyperlinkPreviews, checked); } } @@ -113,8 +108,12 @@ SettingsPageBase { comboModel: ListModel { id: layoutModel Component.onCompleted: { - append({ textDisplay: JamiStrings.horizontalViewOpt }) - append({ textDisplay: JamiStrings.verticalViewOpt }) + append({ + "textDisplay": JamiStrings.horizontalViewOpt + }); + append({ + "textDisplay": JamiStrings.verticalViewOpt + }); } } widthOfComboBox: itemWidth @@ -123,21 +122,22 @@ SettingsPageBase { modelIndex: UtilsAdapter.getAppValue(Settings.Key.ShowChatviewHorizontally) ? 1 : 0 onActivated: { - UtilsAdapter.setAppValue( - Settings.Key.ShowChatviewHorizontally, - comboModel.get(modelIndex).textDisplay === JamiStrings.verticalViewOpt - ) + UtilsAdapter.setAppValue(Settings.Key.ShowChatviewHorizontally, comboModel.get(modelIndex).textDisplay === JamiStrings.verticalViewOpt); } Connections { target: UtilsAdapter function onChangeLanguage() { - var idx = outputComboBoxSetting.modelIndex - layoutModel.clear() - layoutModel.append({ textDisplay: JamiStrings.horizontalViewOpt }) - layoutModel.append({ textDisplay: JamiStrings.verticalViewOpt }) - outputComboBoxSetting.modelIndex = idx + var idx = outputComboBoxSetting.modelIndex; + layoutModel.clear(); + layoutModel.append({ + "textDisplay": JamiStrings.horizontalViewOpt + }); + layoutModel.append({ + "textDisplay": JamiStrings.verticalViewOpt + }); + outputComboBoxSetting.modelIndex = idx; } } } @@ -152,13 +152,13 @@ SettingsPageBase { property var nativeDarkThemeShift: UtilsAdapter.hasNativeDarkTheme() ? 1 : 0 function isComplete() { - var theme = UtilsAdapter.getAppValue(Settings.Key.AppTheme) + var theme = UtilsAdapter.getAppValue(Settings.Key.AppTheme); if (themeSettings.nativeDarkThemeShift && theme === "System") - sysThemeButton.checked = true + sysThemeButton.checked = true; if (theme === "Light") { - lightThemeButton.checked = true + lightThemeButton.checked = true; } else if (theme === "Dark") { - darkThemeButton.checked = true + darkThemeButton.checked = true; } } @@ -173,13 +173,15 @@ SettingsPageBase { color: JamiTheme.textColor horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter - wrapMode : Text.WordWrap + wrapMode: Text.WordWrap font.pixelSize: JamiTheme.settingsTitlePixelSize font.kerning: true } - ButtonGroup { id: optionsB } + ButtonGroup { + id: optionsB + } Flow { @@ -211,7 +213,7 @@ SettingsPageBase { onCheckedChanged: { if (checked) - UtilsAdapter.setAppValue(Settings.Key.AppTheme, "Light") + UtilsAdapter.setAppValue(Settings.Key.AppTheme, "Light"); } } } @@ -242,7 +244,7 @@ SettingsPageBase { onCheckedChanged: { if (checked) - UtilsAdapter.setAppValue(Settings.Key.AppTheme, "Dark") + UtilsAdapter.setAppValue(Settings.Key.AppTheme, "Dark"); } } } @@ -270,7 +272,7 @@ SettingsPageBase { onCheckedChanged: { if (checked) - UtilsAdapter.setAppValue(Settings.Key.AppTheme, "System") + UtilsAdapter.setAppValue(Settings.Key.AppTheme, "System"); } } } @@ -292,11 +294,10 @@ SettingsPageBase { color: JamiTheme.textColor horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter - wrapMode : Text.WordWrap + wrapMode: Text.WordWrap font.pixelSize: JamiTheme.settingsTitlePixelSize font.kerning: true - } Slider { @@ -315,7 +316,7 @@ SettingsPageBase { snapMode: Slider.SnapAlways onMoved: { - UtilsAdapter.setAppValue(Settings.BaseZoom, value / 100.0) + UtilsAdapter.setAppValue(Settings.BaseZoom, value / 100.0); } background: Rectangle { @@ -330,7 +331,6 @@ SettingsPageBase { handle: ColumnLayout { x: zoomSpinBox.visualPosition * zoomSpinBox.availableWidth - textSize.width / 2 - Rectangle { Layout.topMargin: -12 implicitWidth: 6 @@ -343,7 +343,7 @@ SettingsPageBase { Text { id: zoomSpinBoxValueLabel - TextMetrics{ + TextMetrics { id: textSize font.pointSize: JamiTheme.settingsFontSize font.kerning: true @@ -366,7 +366,7 @@ SettingsPageBase { target: UtilsAdapter function onChangeFontSize() { - zoomSpinBox.value = Math.round(UtilsAdapter.getAppValue(Settings.BaseZoom) * 100.0) + zoomSpinBox.value = Math.round(UtilsAdapter.getAppValue(Settings.BaseZoom) * 100.0); } } } @@ -374,7 +374,7 @@ SettingsPageBase { MaterialButton { id: defaultSettings - TextMetrics{ + TextMetrics { id: defaultSettingsTextSize font.weight: Font.Bold font.pixelSize: JamiTheme.wizardViewButtonFontPixelSize @@ -385,21 +385,18 @@ SettingsPageBase { secondary: true text: JamiStrings.defaultSettings - preferredWidth: defaultSettingsTextSize.width + 2*JamiTheme.buttontextWizzardPadding + preferredWidth: defaultSettingsTextSize.width + 2 * JamiTheme.buttontextWizzardPadding onClicked: { - enableTypingIndicatorCheckbox.checked = UtilsAdapter.getDefault(Settings.Key.EnableTypingIndicator) - displayImagesCheckbox.checked = UtilsAdapter.getDefault(Settings.Key.DisplayHyperlinkPreviews) - zoomSpinBox.value = Math.round(UtilsAdapter.getDefault(Settings.BaseZoom) * 100.0) - - UtilsAdapter.setToDefault(Settings.Key.EnableTypingIndicator) - UtilsAdapter.setToDefault(Settings.Key.DisplayHyperlinkPreviews) - UtilsAdapter.setToDefault(Settings.Key.AppTheme) - UtilsAdapter.setToDefault(Settings.Key.BaseZoom) - - themeSettings.isComplete() + enableTypingIndicatorCheckbox.checked = UtilsAdapter.getDefault(Settings.Key.EnableTypingIndicator); + displayImagesCheckbox.checked = UtilsAdapter.getDefault(Settings.Key.DisplayHyperlinkPreviews); + zoomSpinBox.value = Math.round(UtilsAdapter.getDefault(Settings.BaseZoom) * 100.0); + UtilsAdapter.setToDefault(Settings.Key.EnableTypingIndicator); + UtilsAdapter.setToDefault(Settings.Key.DisplayHyperlinkPreviews); + UtilsAdapter.setToDefault(Settings.Key.AppTheme); + UtilsAdapter.setToDefault(Settings.Key.BaseZoom); + themeSettings.isComplete(); } - } } } diff --git a/src/app/settingsview/components/AudioSettingsPage.qml b/src/app/settingsview/components/AudioSettingsPage.qml index a91a2ba92eb209c319631685f5dcd8bd741ee8e4..b0e3bd41fd9d9b841198ea85028aa25ed918ddb5 100644 --- a/src/app/settingsview/components/AudioSettingsPage.qml +++ b/src/app/settingsview/components/AudioSettingsPage.qml @@ -15,15 +15,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Enums 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" SettingsPageBase { @@ -40,32 +37,24 @@ SettingsPageBase { anchors.left: parent.left anchors.leftMargin: JamiTheme.preferredSettingsMarginSize - enum Setting { - AUDIOINPUT, - AUDIOOUTPUT, - RINGTONEDEVICE, - AUDIOMANAGER - } - Connections { target: UtilsAdapter function onChangeLanguage() { - inputAudioModel.reset() - outputAudioModel.reset() - ringtoneAudioModel.reset() + inputAudioModel.reset(); + outputAudioModel.reset(); + ringtoneAudioModel.reset(); } } function populateAudioSettings() { - inputComboBoxSetting.modelIndex = inputComboBoxSetting.comboModel.getCurrentIndex() - outputComboBoxSetting.modelIndex = outputComboBoxSetting.comboModel.getCurrentIndex() - ringtoneComboBoxSetting.modelIndex = ringtoneComboBoxSetting.comboModel.getCurrentIndex() - if(audioManagerComboBoxSetting.comboModel.rowCount() > 0) { - audioManagerComboBoxSetting.modelIndex = - audioManagerComboBoxSetting.comboModel.getCurrentSettingIndex() + inputComboBoxSetting.modelIndex = inputComboBoxSetting.comboModel.getCurrentIndex(); + outputComboBoxSetting.modelIndex = outputComboBoxSetting.comboModel.getCurrentIndex(); + ringtoneComboBoxSetting.modelIndex = ringtoneComboBoxSetting.comboModel.getCurrentIndex(); + if (audioManagerComboBoxSetting.comboModel.rowCount() > 0) { + audioManagerComboBoxSetting.modelIndex = audioManagerComboBoxSetting.comboModel.getCurrentSettingIndex(); } - audioManagerComboBoxSetting.visible = audioManagerComboBoxSetting.comboModel.rowCount() > 0 + audioManagerComboBoxSetting.visible = audioManagerComboBoxSetting.comboModel.rowCount() > 0; } SettingsComboBox { @@ -85,9 +74,9 @@ SettingsPageBase { role: "DeviceName" onActivated: { - AvAdapter.stopAudioMeter() - AVModel.setInputDevice(modelIndex) - AvAdapter.startAudioMeter() + AvAdapter.stopAudioMeter(); + AVModel.setInputDevice(modelIndex); + AvAdapter.startAudioMeter(); } } @@ -119,8 +108,6 @@ SettingsPageBase { from: 0 to: 100 } - - } SettingsComboBox { @@ -140,9 +127,9 @@ SettingsPageBase { role: "DeviceName" onActivated: { - AvAdapter.stopAudioMeter() - AVModel.setOutputDevice(modelIndex) - AvAdapter.startAudioMeter() + AvAdapter.stopAudioMeter(); + AVModel.setOutputDevice(modelIndex); + AvAdapter.startAudioMeter(); } } @@ -163,9 +150,9 @@ SettingsPageBase { role: "DeviceName" onActivated: { - AvAdapter.stopAudioMeter() - AVModel.setRingtoneDevice(modelIndex) - AvAdapter.startAudioMeter() + AvAdapter.stopAudioMeter(); + AVModel.setRingtoneDevice(modelIndex); + AvAdapter.startAudioMeter(); } } @@ -185,13 +172,19 @@ SettingsPageBase { Component.onCompleted: currentAccountEnableColumnLayout.populateAudioSettings() onActivated: { - AvAdapter.stopAudioMeter() - var selectedAudioManager = comboModel.data( - comboModel.index(modelIndex, 0), AudioManagerListModel.AudioManagerID) - AVModel.setAudioManager(selectedAudioManager) - AvAdapter.startAudioMeter() - currentAccountEnableColumnLayout.populateAudioSettings() + AvAdapter.stopAudioMeter(); + var selectedAudioManager = comboModel.data(comboModel.index(modelIndex, 0), AudioManagerListModel.AudioManagerID); + AVModel.setAudioManager(selectedAudioManager); + AvAdapter.startAudioMeter(); + currentAccountEnableColumnLayout.populateAudioSettings(); } } } + + enum Setting { + AUDIOINPUT, + AUDIOOUTPUT, + RINGTONEDEVICE, + AUDIOMANAGER + } } diff --git a/src/app/settingsview/components/BannedContacts.qml b/src/app/settingsview/components/BannedContacts.qml index 66e8bff725fb7333c0791433f2e1dcb84c5650a8..5cef6ac6c82c3c158a54a70ad2a0dbd0e068bd2a 100644 --- a/src/app/settingsview/components/BannedContacts.qml +++ b/src/app/settingsview/components/BannedContacts.qml @@ -15,14 +15,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" ColumnLayout { diff --git a/src/app/settingsview/components/CallRecordingSettingsPage.qml b/src/app/settingsview/components/CallRecordingSettingsPage.qml index 352d164d0323b79042d3f534b8bda5503a00e68d..590dee430e534476d4ef91a9594f4a3ce27aaf29 100644 --- a/src/app/settingsview/components/CallRecordingSettingsPage.qml +++ b/src/app/settingsview/components/CallRecordingSettingsPage.qml @@ -16,16 +16,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts import Qt.labs.platform - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" SettingsPageBase { @@ -41,18 +38,17 @@ SettingsPageBase { title: JamiStrings.callRecording onRecordPathChanged: { - if(recordPath === "") - return - - if(AVModel) { - AVModel.setRecordPath(recordPath) + if (recordPath === "") + return; + if (AVModel) { + AVModel.setRecordPath(recordPath); } } onScreenshotPathChanged: { if (screenshotPath === "") - return - UtilsAdapter.setScreenshotPath(screenshotPath) + return; + UtilsAdapter.setScreenshotPath(screenshotPath); } flickableContent: ColumnLayout { @@ -76,10 +72,10 @@ SettingsPageBase { options: FolderDialog.ShowDirsOnly onAccepted: { - var dir = UtilsAdapter.getAbsPath(folder.toString()) - var dirName = UtilsAdapter.dirName(folder.toString()) - recordPath = dir - recordPathBestName = dirName + var dir = UtilsAdapter.getAbsPath(folder.toString()); + var dirName = UtilsAdapter.dirName(folder.toString()); + recordPath = dir; + recordPathBestName = dirName; } } @@ -91,14 +87,14 @@ SettingsPageBase { options: FolderDialog.ShowDirsOnly onAccepted: { - var dir = UtilsAdapter.getAbsPath(folder.toString()) - var dirName = UtilsAdapter.dirName(folder.toString()) - screenshotPath = dir - screenshotPathBestName = dirName + var dir = UtilsAdapter.getAbsPath(folder.toString()); + var dirName = UtilsAdapter.dirName(folder.toString()); + screenshotPath = dir; + screenshotPathBestName = dirName; } } - Timer{ + Timer { id: updateRecordQualityTimer interval: 500 @@ -106,7 +102,6 @@ SettingsPageBase { onTriggered: AVModel.setRecordQuality(recordQualitySlider.value * 100) } - ToggleSwitch { id: alwaysRecordingCheckBox @@ -177,8 +172,8 @@ SettingsPageBase { stepSize: 1 onMoved: { - recordQualityValueLabel.text = UtilsAdapter.getRecordQualityString(value) - updateRecordQualityTimer.restart() + recordQualityValueLabel.text = UtilsAdapter.getRecordQualityString(value); + updateRecordQualityTimer.restart(); } background: Rectangle { diff --git a/src/app/settingsview/components/CallSettingsPage.qml b/src/app/settingsview/components/CallSettingsPage.qml index b23db21ff24e59bd2042c1a0f4ca72c6ccda8561..357cf08d3d900dc8452fab2af07d36fa1b5325c4 100644 --- a/src/app/settingsview/components/CallSettingsPage.qml +++ b/src/app/settingsview/components/CallSettingsPage.qml @@ -15,44 +15,38 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts import QtMultimedia - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Enums 1.1 import net.jami.Constants 1.1 import net.jami.Helpers 1.1 - import "../../commoncomponents" import "../../mainview/components" import "../../mainview/js/contactpickercreation.js" as ContactPickerCreation - SettingsPageBase { id: root - property bool isSIP property int itemWidth: 132 title: JamiStrings.callSettingsTitle function updateAndShowModeratorsSlot() { - moderatorListWidget.model.reset() - moderatorListWidget.visible = moderatorListWidget.model.rowCount() > 0 + moderatorListWidget.model.reset(); + moderatorListWidget.visible = moderatorListWidget.model.rowCount() > 0; } Connections { target: ContactAdapter function onDefaultModeratorsUpdated() { - updateAndShowModeratorsSlot() + updateAndShowModeratorsSlot(); } } - flickableContent: ColumnLayout { id: callSettingsColumnLayout @@ -77,14 +71,12 @@ SettingsPageBase { color: JamiTheme.textColor horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter - wrapMode : Text.WordWrap + wrapMode: Text.WordWrap font.pixelSize: JamiTheme.settingsTitlePixelSize font.kerning: true - } - ToggleSwitch { id: checkBoxUntrusted visible: !root.isSIP @@ -101,7 +93,6 @@ SettingsPageBase { checked: CurrentAccount.autoAnswer onSwitchToggled: CurrentAccount.autoAnswer = checked } - } ColumnLayout { @@ -119,11 +110,10 @@ SettingsPageBase { color: JamiTheme.textColor horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter - wrapMode : Text.WordWrap + wrapMode: Text.WordWrap font.pixelSize: JamiTheme.settingsTitlePixelSize font.kerning: true - } ToggleSwitch { @@ -147,23 +137,18 @@ SettingsPageBase { itemWidth: root.itemWidth onClick: { - var dlg = viewCoordinator.presentDialog( - appWindow, - "commoncomponents/JamiFileDialog.qml", - { - title: JamiStrings.selectNewRingtone, - fileMode: JamiFileDialog.OpenFile, - folder: JamiQmlUtils.qmlFilePrefix + - UtilsAdapter.toFileAbsolutepath( - CurrentAccount.ringtonePath_Ringtone), - nameFilters: [JamiStrings.audioFile, JamiStrings.allFiles] - }) + var dlg = viewCoordinator.presentDialog(appWindow, "commoncomponents/JamiFileDialog.qml", { + "title": JamiStrings.selectNewRingtone, + "fileMode": JamiFileDialog.OpenFile, + "folder": JamiQmlUtils.qmlFilePrefix + UtilsAdapter.toFileAbsolutepath(CurrentAccount.ringtonePath_Ringtone), + "nameFilters": [JamiStrings.audioFile, JamiStrings.allFiles] + }); dlg.fileAccepted.connect(function (file) { - var url = UtilsAdapter.getAbsPath(file.toString()) - if(url.length !== 0) { - CurrentAccount.ringtonePath_Ringtone = url - } - }) + var url = UtilsAdapter.getAbsPath(file.toString()); + if (url.length !== 0) { + CurrentAccount.ringtonePath_Ringtone = url; + } + }); } } } @@ -183,11 +168,10 @@ SettingsPageBase { color: JamiTheme.textColor horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter - wrapMode : Text.WordWrap + wrapMode: Text.WordWrap font.pixelSize: JamiTheme.settingsTitlePixelSize font.kerning: true - } ToggleSwitch { @@ -216,11 +200,10 @@ SettingsPageBase { color: JamiTheme.textColor horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter - wrapMode : Text.WordWrap + wrapMode: Text.WordWrap font.pixelSize: JamiTheme.settingsTitlePixelSize font.kerning: true - } ToggleSwitch { @@ -231,7 +214,6 @@ SettingsPageBase { onSwitchToggled: CurrentAccount.isLocalModeratorsEnabled = checked } - ToggleSwitch { id: checkboxAllModerators @@ -250,7 +232,7 @@ SettingsPageBase { Layout.rightMargin: JamiTheme.preferredMarginSize color: JamiTheme.textColor - wrapMode : Text.WordWrap + wrapMode: Text.WordWrap text: JamiStrings.defaultModerators font.pointSize: JamiTheme.settingsFontSize font.kerning: true @@ -264,7 +246,7 @@ SettingsPageBase { Layout.alignment: Qt.AlignCenter - preferredWidth: textSize.width + 2*JamiTheme.buttontextWizzardPadding + preferredWidth: textSize.width + 2 * JamiTheme.buttontextWizzardPadding buttontextHeightMargin: JamiTheme.buttontextHeightMargin primary: true @@ -273,12 +255,10 @@ SettingsPageBase { text: JamiStrings.addModerator onClicked: { - ContactPickerCreation.presentContactPickerPopup( - ContactList.CONVERSATION, - appWindow) + ContactPickerCreation.presentContactPickerPopup(ContactList.CONVERSATION, appWindow); } - TextMetrics{ + TextMetrics { id: textSize font.weight: Font.Bold font.pixelSize: JamiTheme.wizardViewButtonFontPixelSize @@ -288,7 +268,6 @@ SettingsPageBase { } } - JamiListView { id: moderatorListWidget @@ -316,9 +295,8 @@ SettingsPageBase { onClicked: moderatorListWidget.currentIndex = index onBtnContactClicked: { - AccountAdapter.setDefaultModerator( - LRCInstance.currentAccountId, contactID, false) - updateAndShowModeratorsSlot() + AccountAdapter.setDefaultModerator(LRCInstance.currentAccountId, contactID, false); + updateAndShowModeratorsSlot(); } } } diff --git a/src/app/settingsview/components/ContactItemDelegate.qml b/src/app/settingsview/components/ContactItemDelegate.qml index d758734e59197a390f6495417d713bbc49b71f06..18c5be5ed9772d64eb327e7dfb1c2ed4dbf25670 100644 --- a/src/app/settingsview/components/ContactItemDelegate.qml +++ b/src/app/settingsview/components/ContactItemDelegate.qml @@ -16,20 +16,17 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" ItemDelegate { id: root - property string contactName : "" + property string contactName: "" property string contactID: "" property string btnImgSource: "" property string btnToolTip: "" @@ -112,7 +109,7 @@ ItemDelegate { Layout.rightMargin: 16 - TextMetrics{ + TextMetrics { id: textSize font.weight: Font.Bold font.pixelSize: JamiTheme.wizardViewButtonFontPixelSize @@ -124,13 +121,11 @@ ItemDelegate { buttontextHeightMargin: 14 text: btnImgSource - preferredWidth: textSize.width + 2*JamiTheme.buttontextWizzardPadding + preferredWidth: textSize.width + 2 * JamiTheme.buttontextWizzardPadding toolTipText: btnToolTip onClicked: btnContactClicked() - } } } - diff --git a/src/app/settingsview/components/CustomizeProfilePage.qml b/src/app/settingsview/components/CustomizeProfilePage.qml index 332df962bba592f5156cf47ff941b1c6f0d8b355..0a84d965beb653777d852fe36ac3ef914c8637bb 100644 --- a/src/app/settingsview/components/CustomizeProfilePage.qml +++ b/src/app/settingsview/components/CustomizeProfilePage.qml @@ -15,16 +15,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Enums 1.1 import net.jami.Constants 1.1 import net.jami.Helpers 1.1 - import "../../commoncomponents" SettingsPageBase { @@ -33,10 +30,9 @@ SettingsPageBase { title: JamiStrings.customizeProfile function stopBooth() { - currentAccountAvatar.stopBooth() + currentAccountAvatar.stopBooth(); } - flickableContent: ColumnLayout { id: currentAccountEnableColumnLayout @@ -54,7 +50,7 @@ SettingsPageBase { target: settingsView function onStopBooth() { - stopBooth() + stopBooth(); } } @@ -97,9 +93,9 @@ SettingsPageBase { onActiveFocusChanged: { if (!activeFocus) { - AccountAdapter.setCurrAccDisplayName(dynamicText) + AccountAdapter.setCurrAccDisplayName(dynamicText); } - displayNameLineEdit.editMode = activeFocus + displayNameLineEdit.editMode = activeFocus; } } } @@ -115,7 +111,7 @@ SettingsPageBase { color: JamiTheme.textColor horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter - wrapMode : Text.WordWrap + wrapMode: Text.WordWrap font.pixelSize: JamiTheme.settingsDescriptionPixelSize font.kerning: true diff --git a/src/app/settingsview/components/DeviceItemDelegate.qml b/src/app/settingsview/components/DeviceItemDelegate.qml index fdf12b53cac361bf506f383afef8ab92fa0106d1..7035802ee67730e98adbd0c480bb948f1dc65870 100644 --- a/src/app/settingsview/components/DeviceItemDelegate.qml +++ b/src/app/settingsview/components/DeviceItemDelegate.qml @@ -1,7 +1,7 @@ /* * Copyright (C) 2019-2023 Savoir-faire Linux Inc. * Author: Yang Wang <yang.wang@savoirfairelinux.com> - * + * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,30 +16,26 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts import Qt5Compat.GraphicalEffects - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" ItemDelegate { id: root - property string deviceName : "" - property string deviceId : "" - property bool isCurrent : false + property string deviceName: "" + property string deviceId: "" + property bool isCurrent: false - property bool editable : false + property bool editable: false signal btnRemoveDeviceClicked - background: Rectangle { color: JamiTheme.editBackgroundColor height: root.height @@ -90,16 +86,16 @@ ItemDelegate { backgroundColor: JamiTheme.transparentColor onAccepted: { - AvAdapter.setDeviceName(editDeviceName.text) - editable = !editable + AvAdapter.setDeviceName(editDeviceName.text); + editable = !editable; } onReadOnlyChanged: { if (readOnly) - editDeviceName.text = Qt.binding(function() { - return elidedTextDeviceName.elidedText - }) + editDeviceName.text = Qt.binding(function () { + return elidedTextDeviceName.elidedText; + }); else - editDeviceName.text = deviceName + editDeviceName.text = deviceName; } TextMetrics { @@ -136,34 +132,23 @@ ItemDelegate { Layout.preferredHeight: JamiTheme.preferredFieldHeight imageColor: JamiTheme.tintedBlue - normalColor: highlighted ? - JamiTheme.selectedColor : - JamiTheme.editBackgroundColor - - source: isCurrent ? - (editable ? - JamiResources.round_save_alt_24dp_svg : - JamiResources.round_edit_24dp_svg) : - JamiResources.delete_24dp_svg - - toolTipText: isCurrent ? - (editable ? - JamiStrings.saveNewDeviceName : - JamiStrings.editDeviceName) : - JamiStrings.unlinkDevice + normalColor: highlighted ? JamiTheme.selectedColor : JamiTheme.editBackgroundColor + + source: isCurrent ? (editable ? JamiResources.round_save_alt_24dp_svg : JamiResources.round_edit_24dp_svg) : JamiResources.delete_24dp_svg + + toolTipText: isCurrent ? (editable ? JamiStrings.saveNewDeviceName : JamiStrings.editDeviceName) : JamiStrings.unlinkDevice onClicked: { if (isCurrent) { if (!editable) { - editable = !editable - editDeviceName.forceActiveFocus() - } - else { - editDeviceName.focus = false - editDeviceName.accepted() + editable = !editable; + editDeviceName.forceActiveFocus(); + } else { + editDeviceName.focus = false; + editDeviceName.accepted(); } } else { - btnRemoveDeviceClicked() + btnRemoveDeviceClicked(); } } } diff --git a/src/app/settingsview/components/FileTransferSettingsPage.qml b/src/app/settingsview/components/FileTransferSettingsPage.qml index 4db804f226adcc92ca1c4b518e1a8fe399e8f5c7..3dcbb098f0c941c6b4e8626fc8556db3e7821fc8 100644 --- a/src/app/settingsview/components/FileTransferSettingsPage.qml +++ b/src/app/settingsview/components/FileTransferSettingsPage.qml @@ -16,16 +16,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Enums 1.1 import net.jami.Constants 1.1 import net.jami.Helpers 1.1 - import "../../commoncomponents" SettingsPageBase { @@ -34,7 +31,6 @@ SettingsPageBase { property int itemWidth: 164 title: JamiStrings.fileTransfer - flickableContent: ColumnLayout { id: callSettingsColumnLayout @@ -69,7 +65,7 @@ SettingsPageBase { MaterialButton { id: defaultSettings - TextMetrics{ + TextMetrics { id: defaultSettingsTextSize font.weight: Font.Bold font.pixelSize: JamiTheme.wizardViewButtonFontPixelSize @@ -80,14 +76,13 @@ SettingsPageBase { secondary: true text: JamiStrings.defaultSettings - preferredWidth: defaultSettingsTextSize.width + 2*JamiTheme.buttontextWizzardPadding + preferredWidth: defaultSettingsTextSize.width + 2 * JamiTheme.buttontextWizzardPadding onClicked: { - autoAcceptFilesCheckbox.checked = UtilsAdapter.getDefault(Settings.Key.AutoAcceptFiles) - acceptTransferBelowSpinBox.valueField = UtilsAdapter.getDefault(Settings.Key.AcceptTransferBelow) - - UtilsAdapter.setToDefault(Settings.Key.AutoAcceptFiles) - UtilsAdapter.setToDefault(Settings.Key.AcceptTransferBelow) + autoAcceptFilesCheckbox.checked = UtilsAdapter.getDefault(Settings.Key.AutoAcceptFiles); + acceptTransferBelowSpinBox.valueField = UtilsAdapter.getDefault(Settings.Key.AcceptTransferBelow); + UtilsAdapter.setToDefault(Settings.Key.AutoAcceptFiles); + UtilsAdapter.setToDefault(Settings.Key.AcceptTransferBelow); } } } diff --git a/src/app/settingsview/components/LevelMeter.qml b/src/app/settingsview/components/LevelMeter.qml index fbdc6a1676a88ec43125c2bb9c24f092a81d3744..acf3910bef35ddd7ab443ea483558494ac57c19a 100644 --- a/src/app/settingsview/components/LevelMeter.qml +++ b/src/app/settingsview/components/LevelMeter.qml @@ -15,10 +15,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 @@ -29,7 +27,7 @@ ProgressBar { property real rmsLevel: 0 value: { - return clamp(rmsLevel * 300.0, 0.0, 100.0) + return clamp(rmsLevel * 300.0, 0.0, 100.0); } contentItem: Item { @@ -45,23 +43,23 @@ ProgressBar { onVisibleChanged: { if (visible) { - rmsLevel = 0 - AvAdapter.startAudioMeter() + rmsLevel = 0; + AvAdapter.startAudioMeter(); } else - AvAdapter.stopAudioMeter() + AvAdapter.stopAudioMeter(); } function clamp(num, a, b) { - return Math.max(Math.min(num, Math.max(a, b)), Math.min(a, b)) + return Math.max(Math.min(num, Math.max(a, b)), Math.min(a, b)); } - Connections{ + Connections { target: AVModel enabled: root.visible function onAudioMeter(id, level) { if (id === "audiolayer_id") { - rmsLevel = level + rmsLevel = level; } } } diff --git a/src/app/settingsview/components/LinkDeviceDialog.qml b/src/app/settingsview/components/LinkDeviceDialog.qml index 9e20a0d22fc8883fcfde0098618b05b6ed1a38d9..58d2b33e432276db24923434fa98f4cd91319ead 100644 --- a/src/app/settingsview/components/LinkDeviceDialog.qml +++ b/src/app/settingsview/components/LinkDeviceDialog.qml @@ -16,15 +16,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" BaseModalDialog { @@ -41,51 +38,47 @@ BaseModalDialog { id: stackedWidget function setGeneratingPage() { - if(passwordEdit.length === 0 && CurrentAccount.hasArchivePassword){ - setExportPage(NameDirectory.ExportOnRingStatus.WRONG_PASSWORD, "") - return + if (passwordEdit.length === 0 && CurrentAccount.hasArchivePassword) { + setExportPage(NameDirectory.ExportOnRingStatus.WRONG_PASSWORD, ""); + return; } - - stackedWidget.currentIndex = exportingSpinnerPage.pageIndex - spinnerMovie.playing = true - - timerForExport.restart() + stackedWidget.currentIndex = exportingSpinnerPage.pageIndex; + spinnerMovie.playing = true; + timerForExport.restart(); } function setExportPage(status, pin) { if (status === NameDirectory.ExportOnRingStatus.SUCCESS) { - infoLabel.success = true - infoLabelsRowLayout.visible = true - infoLabel.text = JamiStrings.pinTimerInfos - exportedPIN.text = pin + infoLabel.success = true; + infoLabelsRowLayout.visible = true; + infoLabel.text = JamiStrings.pinTimerInfos; + exportedPIN.text = pin; } else { - infoLabel.success = false - infoLabelsRowLayout.visible = false - - switch(status) { + infoLabel.success = false; + infoLabelsRowLayout.visible = false; + switch (status) { case NameDirectory.ExportOnRingStatus.WRONG_PASSWORD: - infoLabel.text = JamiStrings.incorrectPassword - break + infoLabel.text = JamiStrings.incorrectPassword; + break; case NameDirectory.ExportOnRingStatus.NETWORK_ERROR: - infoLabel.text = JamiStrings.linkDeviceNetWorkError - break + infoLabel.text = JamiStrings.linkDeviceNetWorkError; + break; case NameDirectory.ExportOnRingStatus.INVALID: - infoLabel.text = JamiStrings.somethingWentWrong - break + infoLabel.text = JamiStrings.somethingWentWrong; + break; } } - stackedWidget.currentIndex = exportingInfoPage.pageIndex + stackedWidget.currentIndex = exportingInfoPage.pageIndex; } - Timer{ + Timer { id: timerForExport repeat: false interval: 200 onTriggered: { - AccountAdapter.model.exportOnRing(LRCInstance.currentAccountId, - passwordEdit.dynamicText) + AccountAdapter.model.exportOnRing(LRCInstance.currentAccountId, passwordEdit.dynamicText); } } @@ -93,19 +86,18 @@ BaseModalDialog { target: NameDirectory function onExportOnRingEnded(status, pin) { - stackedWidget.setExportPage(status, pin) + stackedWidget.setExportPage(status, pin); } } onVisibleChanged: { if (visible) { - infoLabel.text = JamiStrings.pinTimerInfos - - if(CurrentAccount.hasArchivePassword) { - stackedWidget.currentIndex = enterPasswordPage.pageIndex - passwordEdit.forceActiveFocus() + infoLabel.text = JamiStrings.pinTimerInfos; + if (CurrentAccount.hasArchivePassword) { + stackedWidget.currentIndex = enterPasswordPage.pageIndex; + passwordEdit.forceActiveFocus(); } else { - setGeneratingPage() + setGeneratingPage(); } } } @@ -142,7 +134,7 @@ BaseModalDialog { placeholderText: JamiStrings.enterCurrentPassword onDynamicTextChanged: { - btnConfirm.enabled = dynamicText.length > 0 + btnConfirm.enabled = dynamicText.length > 0; } onAccepted: btnConfirm.clicked() @@ -161,7 +153,7 @@ BaseModalDialog { preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 buttontextHeightMargin: JamiTheme.buttontextHeightMargin - color: enabled? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey + color: enabled ? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey hoveredColor: JamiTheme.buttonTintedBlackHovered pressedColor: JamiTheme.buttonTintedBlackPressed secondary: true @@ -250,8 +242,7 @@ BaseModalDialog { Layout.alignment: Qt.AlignCenter Layout.margins: JamiTheme.preferredMarginSize - Layout.preferredWidth: yourPinLabel.contentWidth + - exportedPIN.contentWidth + 5 + Layout.preferredWidth: yourPinLabel.contentWidth + exportedPIN.contentWidth + 5 Label { id: yourPinLabel @@ -292,13 +283,12 @@ BaseModalDialog { id: infoLabel property bool success: false - property int borderWidth : success? 1 : 0 - property int borderRadius : success? 15 : 0 - property string backgroundColor : success? "whitesmoke" : "transparent" - property string borderColor : success? "lightgray" : "transparent" + property int borderWidth: success ? 1 : 0 + property int borderRadius: success ? 15 : 0 + property string backgroundColor: success ? "whitesmoke" : "transparent" + property string borderColor: success ? "lightgray" : "transparent" - Layout.maximumWidth: stackedWidget.width - - JamiTheme.preferredMarginSize * 2 + Layout.maximumWidth: stackedWidget.width - JamiTheme.preferredMarginSize * 2 Layout.alignment: Qt.AlignCenter @@ -307,8 +297,7 @@ BaseModalDialog { wrapMode: Text.Wrap text: JamiStrings.pinTimerInfos - font.pointSize: success ? JamiTheme.textFontSize : - JamiTheme.textFontSize + 3 + font.pointSize: success ? JamiTheme.textFontSize : JamiTheme.textFontSize + 3 font.kerning: true horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter @@ -342,12 +331,11 @@ BaseModalDialog { onClicked: { if (infoLabel.success) - accepted() - close() + accepted(); + close(); } } } } } } - diff --git a/src/app/settingsview/components/LinkedDevicesBase.qml b/src/app/settingsview/components/LinkedDevicesBase.qml index e8f78446c98a8c6b70f52636f56a123670c4ee75..49b93c0c679dc0b6cf453a29839237e2445bea7a 100644 --- a/src/app/settingsview/components/LinkedDevicesBase.qml +++ b/src/app/settingsview/components/LinkedDevicesBase.qml @@ -15,22 +15,18 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import SortFilterProxyModel 0.2 - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 import net.jami.Enums 1.1 - import "../../commoncomponents" ColumnLayout { - id:root + id: root width: parent.width property bool inverted: false @@ -39,28 +35,22 @@ ColumnLayout { visible: settingsListView.model.count > 0 - function removeDeviceSlot(index){ - var deviceId = settingsListView.model.data(settingsListView.model.index(index,0), - DeviceItemListModel.DeviceID) - if(CurrentAccount.hasArchivePassword){ - viewCoordinator.presentDialog( - appWindow, - "settingsview/components/RevokeDevicePasswordDialog.qml", - { deviceId: deviceId }) + function removeDeviceSlot(index) { + var deviceId = settingsListView.model.data(settingsListView.model.index(index, 0), DeviceItemListModel.DeviceID); + if (CurrentAccount.hasArchivePassword) { + viewCoordinator.presentDialog(appWindow, "settingsview/components/RevokeDevicePasswordDialog.qml", { + "deviceId": deviceId + }); } else { - viewCoordinator.presentDialog( - appWindow, - "commoncomponents/SimpleMessageDialog.qml", - { - title: JamiStrings.removeDevice, - infoText: JamiStrings.sureToRemoveDevice, - buttonTitles: [JamiStrings.optionOk, JamiStrings.optionCancel], - buttonStyles: [SimpleMessageDialog.ButtonStyle.TintedBlue, - SimpleMessageDialog.ButtonStyle.TintedBlack], - buttonCallBacks: [ - function() { DeviceItemListModel.revokeDevice(deviceId, "") } - ] - }) + viewCoordinator.presentDialog(appWindow, "commoncomponents/SimpleMessageDialog.qml", { + "title": JamiStrings.removeDevice, + "infoText": JamiStrings.sureToRemoveDevice, + "buttonTitles": [JamiStrings.optionOk, JamiStrings.optionCancel], + "buttonStyles": [SimpleMessageDialog.ButtonStyle.TintedBlue, SimpleMessageDialog.ButtonStyle.TintedBlack], + "buttonCallBacks": [function () { + DeviceItemListModel.revokeDevice(deviceId, ""); + }] + }); } } @@ -74,7 +64,7 @@ ColumnLayout { color: JamiTheme.textColor horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter - wrapMode : Text.WordWrap + wrapMode: Text.WordWrap font.weight: Font.Medium font.pixelSize: JamiTheme.settingsDescriptionPixelSize @@ -92,7 +82,10 @@ ColumnLayout { model: SortFilterProxyModel { sourceModel: DeviceItemListModel sorters: [ - RoleSorter { roleName: "DeviceName"; sortOrder: Qt.DescendingOrder} + RoleSorter { + roleName: "DeviceName" + sortOrder: Qt.DescendingOrder + } ] filters: ValueFilter { @@ -113,6 +106,5 @@ ColumnLayout { onBtnRemoveDeviceClicked: removeDeviceSlot(index) isCurrent: root.isCurrent } - } } diff --git a/src/app/settingsview/components/LinkedDevicesPage.qml b/src/app/settingsview/components/LinkedDevicesPage.qml index f9de7c82f2ff2337f98ff3313fcc58b53aa39f6b..489ea2800251ea45bce5b908f4383e786c98b98e 100644 --- a/src/app/settingsview/components/LinkedDevicesPage.qml +++ b/src/app/settingsview/components/LinkedDevicesPage.qml @@ -16,17 +16,14 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts import Qt.labs.platform - import net.jami.Adapters 1.1 import net.jami.Constants 1.1 import net.jami.Enums 1.1 import net.jami.Models 1.1 - import "../../commoncomponents" SettingsPageBase { @@ -52,7 +49,7 @@ SettingsPageBase { color: JamiTheme.textColor horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter - wrapMode : Text.WordWrap + wrapMode: Text.WordWrap font.pixelSize: JamiTheme.settingsDescriptionPixelSize font.kerning: true @@ -96,7 +93,7 @@ SettingsPageBase { color: JamiTheme.textColor horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter - wrapMode : Text.WordWrap + wrapMode: Text.WordWrap font.pixelSize: JamiTheme.settingsDescriptionPixelSize font.kerning: true @@ -106,7 +103,7 @@ SettingsPageBase { MaterialButton { id: linkDevPushButton - TextMetrics{ + TextMetrics { id: linkDevPushButtonTextSize font.weight: Font.Bold font.pixelSize: JamiTheme.wizardViewButtonFontPixelSize @@ -114,7 +111,7 @@ SettingsPageBase { } Layout.alignment: Qt.AlignLeft - preferredWidth: linkDevPushButtonTextSize.width + 2*JamiTheme.buttontextWizzardPadding + preferredWidth: linkDevPushButtonTextSize.width + 2 * JamiTheme.buttontextWizzardPadding visible: CurrentAccount.managerUri === "" && CurrentAccount.enabled @@ -122,10 +119,7 @@ SettingsPageBase { toolTipText: JamiStrings.tipLinkNewDevice text: JamiStrings.linkAnotherDevice - onClicked: viewCoordinator.presentDialog( - appWindow, - "settingsview/components/LinkDeviceDialog.qml", - ) + onClicked: viewCoordinator.presentDialog(appWindow, "settingsview/components/LinkDeviceDialog.qml") } } } diff --git a/src/app/settingsview/components/LocationSharingSettingsPage.qml b/src/app/settingsview/components/LocationSharingSettingsPage.qml index 0f84707d5e3c52e0ef91785112e51784e48d1336..b07ebb1f1fdb50194635de9e017bd00b3c84aa7f 100644 --- a/src/app/settingsview/components/LocationSharingSettingsPage.qml +++ b/src/app/settingsview/components/LocationSharingSettingsPage.qml @@ -16,29 +16,24 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts import QtQuick.Controls - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Enums 1.1 import net.jami.Constants 1.1 import net.jami.Helpers 1.1 - import "../../commoncomponents" import "../../mainview/components" import "../../mainview/js/contactpickercreation.js" as ContactPickerCreation - SettingsPageBase { id: root property int itemWidth: 578 title: JamiStrings.locationSharingLabel - flickableContent: ColumnLayout { id: callSettingsColumnLayout @@ -54,15 +49,15 @@ SettingsPageBase { Layout.preferredHeight: JamiTheme.preferredFieldHeight function standartCountdown(minutes) { - var hour = Math.floor(minutes / 60) - var min = minutes % 60 + var hour = Math.floor(minutes / 60); + var min = minutes % 60; if (hour) { if (min) - return qsTr("%1h%2min").arg(hour).arg(min) + return qsTr("%1h%2min").arg(hour).arg(min); else - return qsTr("%1h").arg(hour) + return qsTr("%1h").arg(hour); } - return qsTr("%1min").arg(min) + return qsTr("%1min").arg(min); } Text { @@ -73,7 +68,7 @@ SettingsPageBase { text: JamiStrings.positionShareDuration font.pointSize: JamiTheme.settingsFontSize font.kerning: true - wrapMode : Text.WordWrap + wrapMode: Text.WordWrap horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter } @@ -128,14 +123,13 @@ SettingsPageBase { property bool isMax: UtilsAdapter.getAppValue(Settings.PositionShareDuration) < 0.05 value: isMax ? Math.log(600) : Math.log(UtilsAdapter.getAppValue(Settings.PositionShareDuration)) - function valueLabel(){ - if (value != Math.log(600)){ - UtilsAdapter.setAppValue(Settings.PositionShareDuration, Math.floor(Math.exp(value))) - timeSharingLocationValueLabel.text = timeSharingLocation.standartCountdown(Math.floor(Math.exp(value))) - } - else { - UtilsAdapter.setAppValue(Settings.PositionShareDuration, 0) - timeSharingLocationValueLabel.text = JamiStrings.maxLocationDuration + function valueLabel() { + if (value != Math.log(600)) { + UtilsAdapter.setAppValue(Settings.PositionShareDuration, Math.floor(Math.exp(value))); + timeSharingLocationValueLabel.text = timeSharingLocation.standartCountdown(Math.floor(Math.exp(value))); + } else { + UtilsAdapter.setAppValue(Settings.PositionShareDuration, 0); + timeSharingLocationValueLabel.text = JamiStrings.maxLocationDuration; } } @@ -159,7 +153,6 @@ SettingsPageBase { handle: ColumnLayout { x: timeSharingSlider.visualPosition * timeSharingSlider.availableWidth - textSize.width / 2 - Rectangle { Layout.topMargin: -12 implicitWidth: 6 @@ -172,7 +165,7 @@ SettingsPageBase { Text { id: timeSharingLocationValueLabel - TextMetrics{ + TextMetrics { id: textSize font.pointSize: JamiTheme.settingsFontSize font.kerning: true @@ -194,7 +187,7 @@ SettingsPageBase { MaterialButton { id: defaultSettings - TextMetrics{ + TextMetrics { id: defaultSettingsTextSize font.weight: Font.Bold font.pixelSize: JamiTheme.wizardViewButtonFontPixelSize @@ -205,12 +198,12 @@ SettingsPageBase { secondary: true text: JamiStrings.defaultSettings - preferredWidth: defaultSettingsTextSize.width + 2*JamiTheme.buttontextWizzardPadding + preferredWidth: defaultSettingsTextSize.width + 2 * JamiTheme.buttontextWizzardPadding onClicked: { - timeSharingSlider.value = Math.log(UtilsAdapter.getDefault(Settings.Key.PositionShareDuration)) - timeSharingSlider.valueLabel() - UtilsAdapter.setToDefault(Settings.Key.PositionShareDuration) + timeSharingSlider.value = Math.log(UtilsAdapter.getDefault(Settings.Key.PositionShareDuration)); + timeSharingSlider.valueLabel(); + UtilsAdapter.setToDefault(Settings.Key.PositionShareDuration); } } } diff --git a/src/app/settingsview/components/LogsView.qml b/src/app/settingsview/components/LogsView.qml index 1308db7ff70f5e5d46aaeb36ec0ac9b011183097..2db0890249eedb89bdb95ed75a0e7ceb40620b31 100644 --- a/src/app/settingsview/components/LogsView.qml +++ b/src/app/settingsview/components/LogsView.qml @@ -15,15 +15,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" Window { @@ -43,7 +40,7 @@ Window { property var lineCounter: 0 function monitor(continuous) { - UtilsAdapter.monitor(continuous) + UtilsAdapter.monitor(continuous); } title: JamiStrings.logsViewTitle @@ -55,40 +52,38 @@ Window { function onDebugMessageReceived(message) { if (!root.visible) { - return + return; } - var initialPosition = scrollView.ScrollBar.vertical.position - lineCounter += 1 - lineSize.push(message.length) + var initialPosition = scrollView.ScrollBar.vertical.position; + lineCounter += 1; + lineSize.push(message.length); if (!root.cancelPressed) { - logsText.append(message) + logsText.append(message); } if (lineCounter >= 10000) { - lineCounter -= 1 - logsText.remove(0, lineSize[0]) - lineSize.shift() + lineCounter -= 1; + logsText.remove(0, lineSize[0]); + lineSize.shift(); } - scrollView.ScrollBar.vertical.position = initialPosition - > (.8 * (1.0 - scrollView.ScrollBar.vertical.size)) ? - 1.0 - scrollView.ScrollBar.vertical.size : initialPosition + scrollView.ScrollBar.vertical.position = initialPosition > (.8 * (1.0 - scrollView.ScrollBar.vertical.size)) ? 1.0 - scrollView.ScrollBar.vertical.size : initialPosition; } } onVisibleChanged: { if (visible && startStopToggle.checked) { if (hasOpened && lineCounter == 0) { - var logList = UtilsAdapter.logList - logsText.append(logList.join('\n')) - lineCounter = logList.length - lineSize.push(lineCounter ? logList[0].length : 0) + var logList = UtilsAdapter.logList; + logsText.append(logList.join('\n')); + lineCounter = logList.length; + lineSize.push(lineCounter ? logList[0].length : 0); } } else { - logsText.clear() - copiedToolTip.close() - lineCounter = 0 - lineSize = [] + logsText.clear(); + copiedToolTip.close(); + lineCounter = 0; + lineSize = []; } - hasOpened = true + hasOpened = true; } ColumnLayout { @@ -123,15 +118,15 @@ Window { labelText: JamiStrings.logsViewDisplay onSwitchToggled: { - logging = !logging + logging = !logging; if (logging) { - isStopped = false - root.cancelPressed = false - monitor(true) + isStopped = false; + root.cancelPressed = false; + monitor(true); } else { - isStopped = true - root.cancelPressed = true - monitor(false) + isStopped = true; + root.cancelPressed = true; + monitor(false); } } } @@ -154,12 +149,12 @@ Window { autoAccelerator: true onClicked: { - logsText.clear() - logging = false - startStopToggle.checked = false - root.cancelPressed = true - UtilsAdapter.logList = [] - monitor(false) + logsText.clear(); + logging = false; + startStopToggle.checked = false; + root.cancelPressed = true; + UtilsAdapter.logList = []; + monitor(false); } } @@ -180,10 +175,10 @@ Window { autoAccelerator: true onClicked: { - logsText.selectAll() - logsText.copy() - logsText.deselect() - copiedToolTip.open() + logsText.selectAll(); + logsText.copy(); + logsText.deselect(); + copiedToolTip.open(); } ToolTip { @@ -218,8 +213,7 @@ Window { secondary: true autoAccelerator: true - onClicked: Qt.openUrlExternally( - "https://jami.net/bugs-and-improvements/") + onClicked: Qt.openUrlExternally("https://jami.net/bugs-and-improvements/") } } } @@ -256,10 +250,10 @@ Window { hoverEnabled: true onClicked: { - selectBeginning = logsText.selectionStart - selectEnd = logsText.selectionEnd - rightClickMenu.open() - logsText.select(selectBeginning, selectEnd) + selectBeginning = logsText.selectionStart; + selectEnd = logsText.selectionEnd; + rightClickMenu.open(); + logsText.select(selectBeginning, selectEnd); } Menu { @@ -268,7 +262,7 @@ Window { MenuItem { text: JamiStrings.logsViewCopy onTriggered: { - logsText.copy() + logsText.copy(); } } } diff --git a/src/app/settingsview/components/ManageAccountPage.qml b/src/app/settingsview/components/ManageAccountPage.qml index f25d2eb286ce8f1a0c740d2818c9ea4872ec6534..08db16ca2021bb21b7c76458a4b8bce6507fddb0 100644 --- a/src/app/settingsview/components/ManageAccountPage.qml +++ b/src/app/settingsview/components/ManageAccountPage.qml @@ -15,17 +15,14 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts import Qt.labs.platform - import net.jami.Adapters 1.1 import net.jami.Constants 1.1 import net.jami.Enums 1.1 import net.jami.Models 1.1 - import "../../commoncomponents" SettingsPageBase { @@ -40,7 +37,6 @@ SettingsPageBase { title: JamiStrings.manageAccountSettingsTitle flickableContent: ColumnLayout { - id: manageAccountColumnLayout width: contentFlickableWidth @@ -64,11 +60,10 @@ SettingsPageBase { color: JamiTheme.textColor horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter - wrapMode : Text.WordWrap + wrapMode: Text.WordWrap font.pixelSize: JamiTheme.settingsTitlePixelSize font.kerning: true - } ToggleSwitch { @@ -84,7 +79,6 @@ SettingsPageBase { checked: CurrentAccount.enabled onSwitchToggled: CurrentAccount.enableAccount(checked) } - } ColumnLayout { @@ -104,11 +98,10 @@ SettingsPageBase { color: JamiTheme.textColor horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter - wrapMode : Text.WordWrap + wrapMode: Text.WordWrap font.pixelSize: JamiTheme.settingsTitlePixelSize font.kerning: true - } SIPUserIdentity { @@ -160,13 +153,12 @@ SettingsPageBase { color: JamiTheme.textColor horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter - wrapMode : Text.WordWrap + wrapMode: Text.WordWrap font.pixelSize: JamiTheme.settingsDescriptionPixelSize font.kerning: true lineHeight: JamiTheme.wizardViewTextLineHeight } - } ColumnLayout { @@ -176,7 +168,6 @@ SettingsPageBase { visible: !isSIP && CurrentAccount.managerUri === "" spacing: JamiTheme.settingsCategorySpacing - Text { id: encryptTitle @@ -187,7 +178,7 @@ SettingsPageBase { color: JamiTheme.textColor horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter - wrapMode : Text.WordWrap + wrapMode: Text.WordWrap font.pixelSize: JamiTheme.settingsTitlePixelSize font.kerning: true @@ -203,7 +194,7 @@ SettingsPageBase { color: JamiTheme.textColor horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter - wrapMode : Text.WordWrap + wrapMode: Text.WordWrap font.pixelSize: JamiTheme.settingsDescriptionPixelSize font.kerning: true @@ -213,36 +204,28 @@ SettingsPageBase { MaterialButton { id: passwdPushButton - TextMetrics{ + TextMetrics { id: passwdPushButtonTextSize font.weight: Font.Bold font.pixelSize: JamiTheme.wizardViewButtonFontPixelSize text: passwdPushButton.text } - preferredWidth: passwdPushButtonTextSize.width + 2*JamiTheme.buttontextWizzardPadding + preferredWidth: passwdPushButtonTextSize.width + 2 * JamiTheme.buttontextWizzardPadding primary: true Layout.alignment: Qt.AlignLeft - toolTipText: CurrentAccount.hasArchivePassword ? - JamiStrings.changeCurrentPassword : - JamiStrings.setAPassword - text: CurrentAccount.hasArchivePassword ? - JamiStrings.changePassword : - JamiStrings.setPassword - - onClicked: viewCoordinator.presentDialog( - appWindow, - "commoncomponents/PasswordDialog.qml", - { purpose: CurrentAccount.hasArchivePassword ? - PasswordDialog.ChangePassword : - PasswordDialog.SetPassword }) + toolTipText: CurrentAccount.hasArchivePassword ? JamiStrings.changeCurrentPassword : JamiStrings.setAPassword + text: CurrentAccount.hasArchivePassword ? JamiStrings.changePassword : JamiStrings.setPassword + + onClicked: viewCoordinator.presentDialog(appWindow, "commoncomponents/PasswordDialog.qml", { + "purpose": CurrentAccount.hasArchivePassword ? PasswordDialog.ChangePassword : PasswordDialog.SetPassword + }) } } ColumnLayout { - id: saveAccount width: parent.width visible: !isSIP && CurrentAccount.managerUri === "" @@ -258,7 +241,7 @@ SettingsPageBase { color: JamiTheme.textColor horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter - wrapMode : Text.WordWrap + wrapMode: Text.WordWrap font.pixelSize: JamiTheme.settingsTitlePixelSize font.kerning: true @@ -274,25 +257,24 @@ SettingsPageBase { color: JamiTheme.textColor horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter - wrapMode : Text.WordWrap + wrapMode: Text.WordWrap font.pixelSize: JamiTheme.settingsDescriptionPixelSize font.kerning: true lineHeight: JamiTheme.wizardViewTextLineHeight } - MaterialButton { id: btnExportAccount - TextMetrics{ + TextMetrics { id: btnExportAccountTextSize font.weight: Font.Bold font.pixelSize: JamiTheme.wizardViewButtonFontPixelSize text: btnExportAccount.text } - preferredWidth: btnExportAccountTextSize.width + 2*JamiTheme.buttontextWizzardPadding + preferredWidth: btnExportAccountTextSize.width + 2 * JamiTheme.buttontextWizzardPadding primary: true Layout.alignment: Qt.AlignLeft @@ -300,47 +282,36 @@ SettingsPageBase { text: JamiStrings.saveAccountTitle onClicked: { - var dlg = viewCoordinator.presentDialog( - appWindow, - "commoncomponents/JamiFileDialog.qml", - { - title: JamiStrings.backupAccountHere, - fileMode: FileDialog.SaveFile, - folder: StandardPaths.writableLocation(StandardPaths.DesktopLocation), - nameFilters: [JamiStrings.jamiArchiveFiles, JamiStrings.allFiles] - }) + var dlg = viewCoordinator.presentDialog(appWindow, "commoncomponents/JamiFileDialog.qml", { + "title": JamiStrings.backupAccountHere, + "fileMode": FileDialog.SaveFile, + "folder": StandardPaths.writableLocation(StandardPaths.DesktopLocation), + "nameFilters": [JamiStrings.jamiArchiveFiles, JamiStrings.allFiles] + }); dlg.fileAccepted.connect(function (file) { - // is there password? If so, go to password dialog, else, go to following directly - var exportPath = UtilsAdapter.getAbsPath(file.toString()) - if (CurrentAccount.hasArchivePassword) { - viewCoordinator.presentDialog( - appWindow, - "commoncomponents/PasswordDialog.qml", - { - purpose: PasswordDialog.ExportAccount, - path: exportPath - }) - return - } else if (exportPath.length > 0) { - var success = AccountAdapter.model.exportToFile(LRCInstance.currentAccountId, exportPath) - viewCoordinator.presentDialog( - appWindow, - "commoncomponents/SimpleMessageDialog.qml", - { - title: success ? JamiStrings.success : JamiStrings.error, - infoText: success ? JamiStrings.backupSuccessful : JamiStrings.backupFailed, - buttonTitles: [JamiStrings.optionOk], - buttonStyles: [SimpleMessageDialog.ButtonStyle.TintedBlue] - }) - } - }) + // is there password? If so, go to password dialog, else, go to following directly + var exportPath = UtilsAdapter.getAbsPath(file.toString()); + if (CurrentAccount.hasArchivePassword) { + viewCoordinator.presentDialog(appWindow, "commoncomponents/PasswordDialog.qml", { + "purpose": PasswordDialog.ExportAccount, + "path": exportPath + }); + return; + } else if (exportPath.length > 0) { + var success = AccountAdapter.model.exportToFile(LRCInstance.currentAccountId, exportPath); + viewCoordinator.presentDialog(appWindow, "commoncomponents/SimpleMessageDialog.qml", { + "title": success ? JamiStrings.success : JamiStrings.error, + "infoText": success ? JamiStrings.backupSuccessful : JamiStrings.backupFailed, + "buttonTitles": [JamiStrings.optionOk], + "buttonStyles": [SimpleMessageDialog.ButtonStyle.TintedBlue] + }); + } + }); } } - } ColumnLayout { - id: bannedAccount width: parent.width visible: !isSIP && CurrentAccount.hasBannedContacts @@ -356,7 +327,7 @@ SettingsPageBase { color: JamiTheme.textColor horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter - wrapMode : Text.WordWrap + wrapMode: Text.WordWrap font.pixelSize: JamiTheme.settingsTitlePixelSize font.kerning: true @@ -383,7 +354,7 @@ SettingsPageBase { color: JamiTheme.textColor horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter - wrapMode : Text.WordWrap + wrapMode: Text.WordWrap font.pixelSize: JamiTheme.settingsTitlePixelSize font.kerning: true @@ -399,25 +370,24 @@ SettingsPageBase { color: JamiTheme.textColor horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter - wrapMode : Text.WordWrap + wrapMode: Text.WordWrap font.pixelSize: JamiTheme.settingsDescriptionPixelSize font.kerning: true lineHeight: JamiTheme.wizardViewTextLineHeight } - MaterialButton { id: deleteAccountPushButton - TextMetrics{ + TextMetrics { id: deleteAccountPushButtonTextSize font.weight: Font.Bold font.pixelSize: JamiTheme.wizardViewButtonFontPixelSize text: deleteAccountPushButton.text } - preferredWidth: deleteAccountPushButtonTextSize.width + 2*JamiTheme.buttontextWizzardPadding + preferredWidth: deleteAccountPushButtonTextSize.width + 2 * JamiTheme.buttontextWizzardPadding primary: true Layout.alignment: Qt.AlignLeft @@ -427,22 +397,17 @@ SettingsPageBase { hoveredColor: JamiTheme.buttonTintedRedHovered pressedColor: JamiTheme.buttonTintedRedPressed - text: JamiStrings.deleteAccount onClicked: { - var dlg = viewCoordinator.presentDialog( - appWindow, - "commoncomponents/DeleteAccountDialog.qml", - { - isSIP: CurrentAccount.type === Profile.Type.SIP, - bestName: CurrentAccount.bestName, - accountId: CurrentAccount.uri - }) - dlg.accepted.connect(navigateToMainView) + var dlg = viewCoordinator.presentDialog(appWindow, "commoncomponents/DeleteAccountDialog.qml", { + "isSIP": CurrentAccount.type === Profile.Type.SIP, + "bestName": CurrentAccount.bestName, + "accountId": CurrentAccount.uri + }); + dlg.accepted.connect(navigateToMainView); } } - } } } diff --git a/src/app/settingsview/components/MediaCodecDelegate.qml b/src/app/settingsview/components/MediaCodecDelegate.qml index 044b6e8023a12d3381131d74b1c758edb6c359b4..a5468e912c7ab3abae16e25af1d31dfdda63f7b6 100644 --- a/src/app/settingsview/components/MediaCodecDelegate.qml +++ b/src/app/settingsview/components/MediaCodecDelegate.qml @@ -15,26 +15,24 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts import Qt5Compat.GraphicalEffects - import net.jami.Models 1.1 import net.jami.Constants 1.1 ItemDelegate { id: root - property string mediaCodecName : "" - property bool isEnabled : false + property string mediaCodecName: "" + property bool isEnabled: false property int mediaCodecId property string samplerRate: "" property int checkBoxWidth: 24 property int mediaType - signal mediaCodecStateChange(string idToSet , bool isToBeEnabled) + signal mediaCodecStateChange(string idToSet, bool isToBeEnabled) highlighted: ListView.isCurrentItem background: Rectangle { @@ -42,7 +40,6 @@ ItemDelegate { } hoverEnabled: true - RowLayout { anchors.fill: parent @@ -70,25 +67,22 @@ ItemDelegate { } width: checkBoxWidth height: checkBoxWidth - source: checkBoxIsEnabled.checked ? - JamiResources.check_box_24dp_svg : - JamiResources.check_box_outline_blank_24dp_svg + source: checkBoxIsEnabled.checked ? JamiResources.check_box_24dp_svg : JamiResources.check_box_outline_blank_24dp_svg } - nextCheckState: function() { - var result - var result_bool - - if (checkState === Qt.Checked) { - result = Qt.Unchecked - result_bool = false - } else { - result = Qt.Checked - result_bool = true - } - mediaCodecStateChange(mediaCodecId, result_bool) - return result + nextCheckState: function () { + var result; + var result_bool; + if (checkState === Qt.Checked) { + result = Qt.Unchecked; + result_bool = false; + } else { + result = Qt.Checked; + result_bool = true; } + mediaCodecStateChange(mediaCodecId, result_bool); + return result; + } } Label { @@ -101,9 +95,9 @@ ItemDelegate { text: { if (mediaType == MediaSettings.VIDEO) - return mediaCodecName + return mediaCodecName; else if (mediaType == MediaSettings.AUDIO) - return mediaCodecName + " " + samplerRate + " Hz" + return mediaCodecName + " " + samplerRate + " Hz"; } color: JamiTheme.textColor elide: Text.ElideRight diff --git a/src/app/settingsview/components/MediaSettings.qml b/src/app/settingsview/components/MediaSettings.qml index fb434a60c15f4482067f83a4b6a4b96f14083ede..f4dc684ef0887533327c4b5be01fcbf67d151f3d 100644 --- a/src/app/settingsview/components/MediaSettings.qml +++ b/src/app/settingsview/components/MediaSettings.qml @@ -15,15 +15,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts import QtQuick.Controls - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" ColumnLayout { @@ -37,35 +34,29 @@ ColumnLayout { property int mediaType function decreaseCodecPriority() { - var index = mediaListWidget.currentIndex + var index = mediaListWidget.currentIndex; if (index >= mediaListWidget.model.rowCount() - 1) - return - var codecId = mediaListWidget.model.data(mediaListWidget.model.index(index,0), - MediaCodecListModel.MediaCodecID) - - AvAdapter.decreaseCodecPriority(codecId, mediaType === MediaSettings.VIDEO) - mediaListWidget.currentIndex = index + 1 - updateCodecs() + return; + var codecId = mediaListWidget.model.data(mediaListWidget.model.index(index, 0), MediaCodecListModel.MediaCodecID); + AvAdapter.decreaseCodecPriority(codecId, mediaType === MediaSettings.VIDEO); + mediaListWidget.currentIndex = index + 1; + updateCodecs(); } function updateCodecs() { - mediaListWidget.model.layoutAboutToBeChanged() - mediaListWidget.model.dataChanged(mediaListWidget.model.index(0, 0), - mediaListWidget.model.index( - mediaListWidget.model.rowCount() - 1, 0)) - mediaListWidget.model.layoutChanged() + mediaListWidget.model.layoutAboutToBeChanged(); + mediaListWidget.model.dataChanged(mediaListWidget.model.index(0, 0), mediaListWidget.model.index(mediaListWidget.model.rowCount() - 1, 0)); + mediaListWidget.model.layoutChanged(); } - function increaseCodecPriority(){ - var index = mediaListWidget.currentIndex + function increaseCodecPriority() { + var index = mediaListWidget.currentIndex; if (index === 0) - return - var codecId = mediaListWidget.model.data(mediaListWidget.model.index(index,0), - MediaCodecListModel.MediaCodecID) - - AvAdapter.increaseCodecPriority(codecId, mediaType === MediaSettings.VIDEO) - mediaListWidget.currentIndex = index - 1 - updateCodecs() + return; + var codecId = mediaListWidget.model.data(mediaListWidget.model.index(index, 0), MediaCodecListModel.MediaCodecID); + AvAdapter.increaseCodecPriority(codecId, mediaType === MediaSettings.VIDEO); + mediaListWidget.currentIndex = index - 1; + updateCodecs(); } RowLayout { @@ -78,11 +69,11 @@ ColumnLayout { Layout.preferredHeight: JamiTheme.preferredFieldHeight maxWidth: width - eText: { + eText: { if (mediaType === MediaSettings.VIDEO) - return JamiStrings.videoCodecs + return JamiStrings.videoCodecs; else if (mediaType === MediaSettings.AUDIO) - return JamiStrings.audioCodecs + return JamiStrings.audioCodecs; } fontSize: JamiTheme.settingsFontSize } @@ -117,19 +108,19 @@ ColumnLayout { width: mediaListWidget.width height: mediaListWidget.height / 4 - mediaCodecName : MediaCodecName - isEnabled : IsEnabled + mediaCodecName: MediaCodecName + isEnabled: IsEnabled mediaCodecId: MediaCodecID samplerRate: Samplerate mediaType: root.mediaType onClicked: { - mediaListWidget.currentIndex = index + mediaListWidget.currentIndex = index; } onMediaCodecStateChange: { - AvAdapter.enableCodec(idToSet, isToBeEnabled) - updateCodecs() + AvAdapter.enableCodec(idToSet, isToBeEnabled); + updateCodecs(); } } } diff --git a/src/app/settingsview/components/NameRegistrationDialog.qml b/src/app/settingsview/components/NameRegistrationDialog.qml index 1acf3affdd8485de2b477dc155e72236b73e12a9..a54a6f092794d6dff5cacc5a59da8e091ff36d70 100644 --- a/src/app/settingsview/components/NameRegistrationDialog.qml +++ b/src/app/settingsview/components/NameRegistrationDialog.qml @@ -16,21 +16,18 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" BaseModalDialog { id: root - property string registeredName : "" + property string registeredName: "" signal accepted @@ -43,10 +40,9 @@ BaseModalDialog { id: stackedWidget function startRegistration() { - stackedWidget.currentIndex = nameRegisterSpinnerPage.pageIndex - spinnerMovie.visible = true - - timerForStartRegistration.restart() + stackedWidget.currentIndex = nameRegisterSpinnerPage.pageIndex; + spinnerMovie.visible = true; + timerForStartRegistration.restart(); } Timer { @@ -56,44 +52,41 @@ BaseModalDialog { repeat: false onTriggered: { - AccountAdapter.model.registerName(LRCInstance.currentAccountId, - passwordEdit.text, registeredName) + AccountAdapter.model.registerName(LRCInstance.currentAccountId, passwordEdit.text, registeredName); } } - Connections{ + Connections { target: NameDirectory function onNameRegistrationEnded(status, name) { - switch(status) { + switch (status) { case NameDirectory.RegisterNameStatus.SUCCESS: - accepted() - close() - return + accepted(); + close(); + return; case NameDirectory.RegisterNameStatus.WRONG_PASSWORD: - lblRegistrationError.text = JamiStrings.incorrectPassword - break + lblRegistrationError.text = JamiStrings.incorrectPassword; + break; case NameDirectory.RegisterNameStatus.NETWORK_ERROR: - lblRegistrationError.text = JamiStrings.networkError - break + lblRegistrationError.text = JamiStrings.networkError; + break; default: - break + break; } - - stackedWidget.currentIndex = nameRegisterErrorPage.pageIndex + stackedWidget.currentIndex = nameRegisterErrorPage.pageIndex; } } onVisibleChanged: { if (visible) { - lblRegistrationError.text = JamiStrings.somethingWentWrong - passwordEdit.clear() - - if (CurrentAccount.hasArchivePassword){ - stackedWidget.currentIndex = nameRegisterEnterPasswordPage.pageIndex - passwordEdit.forceActiveFocus() + lblRegistrationError.text = JamiStrings.somethingWentWrong; + passwordEdit.clear(); + if (CurrentAccount.hasArchivePassword) { + stackedWidget.currentIndex = nameRegisterEnterPasswordPage.pageIndex; + passwordEdit.forceActiveFocus(); } else { - startRegistration() + startRegistration(); } } } @@ -148,7 +141,7 @@ BaseModalDialog { preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 buttontextHeightMargin: JamiTheme.buttontextHeightMargin - color: enabled? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey + color: enabled ? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey hoveredColor: JamiTheme.buttonTintedBlackHovered pressedColor: JamiTheme.buttonTintedBlackPressed secondary: true diff --git a/src/app/settingsview/components/PluginItemDelegate.qml b/src/app/settingsview/components/PluginItemDelegate.qml index 8c8886c8f8fd31779e3fd249ee72187b1a62e621..af5ee09eede1e5b0a468ece7d1c361fa0f8e9abf 100644 --- a/src/app/settingsview/components/PluginItemDelegate.qml +++ b/src/app/settingsview/components/PluginItemDelegate.qml @@ -15,15 +15,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" ItemDelegate { @@ -34,15 +31,11 @@ ItemDelegate { property string pluginIcon: "" property bool isLoaded: false property string activeId: "" - height: pluginPreferencesView.visible ? - implicitHeight + pluginPreferencesView.childrenRect.height : - implicitHeight + height: pluginPreferencesView.visible ? implicitHeight + pluginPreferencesView.childrenRect.height : implicitHeight signal settingsClicked - onActiveIdChanged: pluginPreferencesView.visible = activeId != pluginId ? - false : - !pluginPreferencesView.visible + onActiveIdChanged: pluginPreferencesView.visible = activeId != pluginId ? false : !pluginPreferencesView.visible ColumnLayout { width: parent.width @@ -98,10 +91,10 @@ ItemDelegate { checked: isLoaded onSwitchToggled: { if (isLoaded) - PluginModel.unloadPlugin(pluginId) + PluginModel.unloadPlugin(pluginId); else - PluginModel.loadPlugin(pluginId) - installedPluginsModel.pluginChanged(index) + PluginModel.loadPlugin(pluginId); + installedPluginsModel.pluginChanged(index); } } diff --git a/src/app/settingsview/components/PluginListView.qml b/src/app/settingsview/components/PluginListView.qml index 1260a0e235e18c75cfb0bdf172790df2240a7c2d..487042c4d6edc10b02b26bb5d392589700db6506 100644 --- a/src/app/settingsview/components/PluginListView.qml +++ b/src/app/settingsview/components/PluginListView.qml @@ -15,16 +15,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts import Qt.labs.platform - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" Rectangle { @@ -73,20 +70,17 @@ Rectangle { text: JamiStrings.installPlugin onClicked: { - var dlg = viewCoordinator.presentDialog( - appWindow, - "commoncomponents/JamiFileDialog.qml", - { - title: JamiStrings.selectPluginInstall, - fileMode: JamiFileDialog.OpenFile, - folder: StandardPaths.writableLocation(StandardPaths.DownloadLocation), - nameFilters: [JamiStrings.pluginFiles, JamiStrings.allFiles] - }) + var dlg = viewCoordinator.presentDialog(appWindow, "commoncomponents/JamiFileDialog.qml", { + "title": JamiStrings.selectPluginInstall, + "fileMode": JamiFileDialog.OpenFile, + "folder": StandardPaths.writableLocation(StandardPaths.DownloadLocation), + "nameFilters": [JamiStrings.pluginFiles, JamiStrings.allFiles] + }); dlg.fileAccepted.connect(function (file) { - var url = UtilsAdapter.getAbsPath(file.toString()) - PluginModel.installPlugin(url, true) - installedPluginsModel.addPlugin() - }) + var url = UtilsAdapter.getAbsPath(file.toString()); + PluginModel.installPlugin(url, true); + installedPluginsModel.addPlugin(); + }); } } @@ -104,7 +98,7 @@ Rectangle { lrcInstance: LRCInstance onLrcInstanceChanged: { - this.reset() + this.reset(); } } @@ -126,7 +120,7 @@ Rectangle { } onSettingsClicked: { - root.activePlugin = root.activePlugin === pluginId ? "" : pluginId + root.activePlugin = root.activePlugin === pluginId ? "" : pluginId; } } } diff --git a/src/app/settingsview/components/PluginPreferencesListView.qml b/src/app/settingsview/components/PluginPreferencesListView.qml index 4014834faa122e14169fe7878dc37f7efc6a9c33..31c85ce653b46c4c9bf9f2220e79a817816d906d 100644 --- a/src/app/settingsview/components/PluginPreferencesListView.qml +++ b/src/app/settingsview/components/PluginPreferencesListView.qml @@ -15,15 +15,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Adapters 1.1 import net.jami.Models 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" Rectangle { @@ -35,8 +32,8 @@ Rectangle { implicitHeight: childrenRect.height onVisibleChanged: { if (visible) { - preferencesPerCategoryModel.reset() - generalPreferencesModel.reset() + preferencesPerCategoryModel.reset(); + generalPreferencesModel.reset(); } } @@ -47,8 +44,8 @@ Rectangle { function onCurrentAccountIdChanged() { if (accountId) { - preferencesPerCategoryModel.reset() - generalPreferencesModel.reset() + preferencesPerCategoryModel.reset(); + generalPreferencesModel.reset(); } } } @@ -59,9 +56,8 @@ Rectangle { visible: false - function setPreference(pluginId, preferenceKey, preferenceNewValue) - { - PluginModel.setPluginPreference(pluginId, accountId, preferenceKey, preferenceNewValue) + function setPreference(pluginId, preferenceKey, preferenceNewValue) { + PluginModel.setPluginPreference(pluginId, accountId, preferenceKey, preferenceNewValue); } ColumnLayout { @@ -102,7 +98,7 @@ Rectangle { text: modelData flat: true onClicked: { - root.category = modelData + root.category = modelData; } background: Rectangle { anchors.fill: parent @@ -134,7 +130,7 @@ Rectangle { highlighted: category === text onClicked: { - root.category = oddCategoryButton.text + root.category = oddCategoryButton.text; } background: Rectangle { anchors.fill: parent @@ -167,7 +163,7 @@ Rectangle { pluginId_: pluginId onCategory_Changed: { - this.reset() + this.reset(); } } interactive: false @@ -192,14 +188,14 @@ Rectangle { id: pluginListPreferenceCategoryModel lrcInstance: LRCInstance - preferenceKey : PreferenceKey + preferenceKey: PreferenceKey accountId_: accountId pluginId: PluginId } onBtnPreferenceClicked: { - setPreference(pluginId, preferenceKey, preferenceNewValue) - preferencesPerCategoryModel.reset() + setPreference(pluginId, preferenceKey, preferenceNewValue); + preferencesPerCategoryModel.reset(); } background: Rectangle { @@ -226,7 +222,7 @@ Rectangle { pluginId_: pluginId onCategory_Changed: { - this.reset() + this.reset(); } } interactive: false @@ -251,14 +247,14 @@ Rectangle { id: pluginListPreferenceModel lrcInstance: LRCInstance - preferenceKey : PreferenceKey + preferenceKey: PreferenceKey accountId_: accountId pluginId: PluginId } onBtnPreferenceClicked: { - setPreference(pluginId, preferenceKey, preferenceNewValue) - generalPreferencesModel.reset() + setPreference(pluginId, preferenceKey, preferenceNewValue); + generalPreferencesModel.reset(); } } } @@ -280,27 +276,23 @@ Rectangle { text: JamiStrings.reset - onClicked: viewCoordinator.presentDialog( - appWindow, - "commoncomponents/SimpleMessageDialog.qml", - { - title: JamiStrings.resetPreferences, - infoText: JamiStrings.pluginResetConfirmation.arg(pluginName), - buttonTitles: [JamiStrings.optionOk, JamiStrings.optionCancel], - buttonStyles: [SimpleMessageDialog.ButtonStyle.TintedBlue, - SimpleMessageDialog.ButtonStyle.TintedBlack], - buttonCallBacks: [function () { - if (isLoaded) { - PluginModel.unloadPlugin(pluginId) - PluginModel.resetPluginPreferencesValues(pluginId, accountId) - PluginModel.loadPlugin(pluginId) - } else { - PluginModel.resetPluginPreferencesValues(pluginId, accountId) - } - preferencesPerCategoryModel.reset() - generalPreferencesModel.reset() - }] - }) + onClicked: viewCoordinator.presentDialog(appWindow, "commoncomponents/SimpleMessageDialog.qml", { + "title": JamiStrings.resetPreferences, + "infoText": JamiStrings.pluginResetConfirmation.arg(pluginName), + "buttonTitles": [JamiStrings.optionOk, JamiStrings.optionCancel], + "buttonStyles": [SimpleMessageDialog.ButtonStyle.TintedBlue, SimpleMessageDialog.ButtonStyle.TintedBlack], + "buttonCallBacks": [function () { + if (isLoaded) { + PluginModel.unloadPlugin(pluginId); + PluginModel.resetPluginPreferencesValues(pluginId, accountId); + PluginModel.loadPlugin(pluginId); + } else { + PluginModel.resetPluginPreferencesValues(pluginId, accountId); + } + preferencesPerCategoryModel.reset(); + generalPreferencesModel.reset(); + }] + }) } } } diff --git a/src/app/settingsview/components/PluginPreferencesView.qml b/src/app/settingsview/components/PluginPreferencesView.qml index 4bcf9bc02a4c9bbb105f4df72197780d8efa1a14..809313ae45846229baf9adbc18b8aa661182b660 100644 --- a/src/app/settingsview/components/PluginPreferencesView.qml +++ b/src/app/settingsview/components/PluginPreferencesView.qml @@ -15,15 +15,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Adapters 1.1 import net.jami.Models 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" Rectangle { @@ -38,7 +35,7 @@ Rectangle { anchors.right: root.right anchors.bottomMargin: 10 - Label{ + Label { Layout.topMargin: 34 Layout.alignment: Qt.AlignHCenter height: 64 @@ -95,12 +92,10 @@ Rectangle { toolTipText: JamiStrings.tipGeneralPluginSettingsDisplay preferredSize: 32 - source: pluginGeneralSettingsView.visible ? - JamiResources.expand_less_24dp_svg : - JamiResources.expand_more_24dp_svg + source: pluginGeneralSettingsView.visible ? JamiResources.expand_less_24dp_svg : JamiResources.expand_more_24dp_svg onClicked: { - pluginGeneralSettingsView.visible = !pluginGeneralSettingsView.visible + pluginGeneralSettingsView.visible = !pluginGeneralSettingsView.visible; } } } @@ -139,12 +134,10 @@ Rectangle { toolTipText: JamiStrings.tipAccountPluginSettingsDisplay preferredSize: 32 - source: pluginAccountSettingsView.visible ? - JamiResources.expand_less_24dp_svg : - JamiResources.expand_more_24dp_svg + source: pluginAccountSettingsView.visible ? JamiResources.expand_less_24dp_svg : JamiResources.expand_more_24dp_svg onClicked: { - pluginAccountSettingsView.visible = !pluginAccountSettingsView.visible + pluginAccountSettingsView.visible = !pluginAccountSettingsView.visible; } } } @@ -173,21 +166,17 @@ Rectangle { text: JamiStrings.uninstall - onClicked: viewCoordinator.presentDialog( - appWindow, - "commoncomponents/SimpleMessageDialog.qml", - { - title: JamiStrings.uninstallPlugin, - infoText: JamiStrings.pluginUninstallConfirmation.arg(pluginName), - buttonTitles: [JamiStrings.optionOk, JamiStrings.optionCancel], - buttonStyles: [SimpleMessageDialog.ButtonStyle.TintedBlue, - SimpleMessageDialog.ButtonStyle.TintedBlack], - buttonCallBacks: [function () { - pluginPreferencesView.visible = false - PluginModel.uninstallPlugin(pluginId) - installedPluginsModel.removePlugin(index) - }] - }) + onClicked: viewCoordinator.presentDialog(appWindow, "commoncomponents/SimpleMessageDialog.qml", { + "title": JamiStrings.uninstallPlugin, + "infoText": JamiStrings.pluginUninstallConfirmation.arg(pluginName), + "buttonTitles": [JamiStrings.optionOk, JamiStrings.optionCancel], + "buttonStyles": [SimpleMessageDialog.ButtonStyle.TintedBlue, SimpleMessageDialog.ButtonStyle.TintedBlack], + "buttonCallBacks": [function () { + pluginPreferencesView.visible = false; + PluginModel.uninstallPlugin(pluginId); + installedPluginsModel.removePlugin(index); + }] + }) } Rectangle { diff --git a/src/app/settingsview/components/PluginSettingsPage.qml b/src/app/settingsview/components/PluginSettingsPage.qml index dd62832fd89ae1c9d846107466cff4347161cb4e..f1350b315c564b3f74a2f54d9a30e184babd66be 100644 --- a/src/app/settingsview/components/PluginSettingsPage.qml +++ b/src/app/settingsview/components/PluginSettingsPage.qml @@ -15,15 +15,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Adapters 1.1 import net.jami.Models 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" SettingsPageBase { @@ -31,7 +28,6 @@ SettingsPageBase { title: JamiStrings.pluginSettingsTitle - flickableContent: ColumnLayout { id: pluginSettingsColumnLayout @@ -40,7 +36,6 @@ SettingsPageBase { anchors.left: parent.left anchors.leftMargin: JamiTheme.preferredSettingsMarginSize - ColumnLayout { id: generalSettings @@ -56,8 +51,8 @@ SettingsPageBase { labelText: JamiStrings.enable onSwitchToggled: { - PluginModel.setPluginsEnabled(checked) - PluginAdapter.isEnabled = checked + PluginModel.setPluginsEnabled(checked); + PluginAdapter.isEnabled = checked; } } diff --git a/src/app/settingsview/components/RevokeDevicePasswordDialog.qml b/src/app/settingsview/components/RevokeDevicePasswordDialog.qml index 82594b35d26b5ddeb1a888a49c5be58e5793a292..b4857300c02829d371e0f83a5a3a57a2d09410eb 100644 --- a/src/app/settingsview/components/RevokeDevicePasswordDialog.qml +++ b/src/app/settingsview/components/RevokeDevicePasswordDialog.qml @@ -16,14 +16,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Constants 1.1 import net.jami.Models 1.1 - import "../../commoncomponents" BaseModalDialog { @@ -45,8 +42,7 @@ BaseModalDialog { id: labelDeletion Layout.alignment: Qt.AlignHCenter - Layout.preferredWidth: revokeDeviceContentColumnLayout.width - - JamiTheme.preferredMarginSize * 2 + Layout.preferredWidth: revokeDeviceContentColumnLayout.width - JamiTheme.preferredMarginSize * 2 text: JamiStrings.confirmRemoval color: JamiTheme.textColor @@ -68,7 +64,6 @@ BaseModalDialog { placeholderText: JamiStrings.enterCurrentPassword onDynamicTextChanged: btnRemove.enabled = dynamicText.length > 0 - } RowLayout { @@ -85,7 +80,7 @@ BaseModalDialog { preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 buttontextHeightMargin: JamiTheme.buttontextHeightMargin - color: enabled? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey + color: enabled ? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey hoveredColor: JamiTheme.buttonTintedBlackHovered pressedColor: JamiTheme.buttonTintedBlackPressed secondary: true @@ -95,8 +90,8 @@ BaseModalDialog { text: JamiStrings.optionRemove onClicked: { - DeviceItemListModel.revokeDevice(deviceId, passwordEdit.text) - close() + DeviceItemListModel.revokeDevice(deviceId, passwordEdit.text); + close(); } } diff --git a/src/app/settingsview/components/SIPUserIdentity.qml b/src/app/settingsview/components/SIPUserIdentity.qml index 2eb34dc9ef4be166dc1bcaa10af338c48f167d95..4a90eb9a12c27a8b49846238f3f3f192acd2d3e5 100644 --- a/src/app/settingsview/components/SIPUserIdentity.qml +++ b/src/app/settingsview/components/SIPUserIdentity.qml @@ -15,14 +15,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" ColumnLayout { @@ -82,5 +79,4 @@ ColumnLayout { onEditFinished: CurrentAccount.routeset = dynamicText } - } diff --git a/src/app/settingsview/components/ScreenSharingSettingsPage.qml b/src/app/settingsview/components/ScreenSharingSettingsPage.qml index 756dae08a2f3b9c43fd94d1c30dd22287b346f22..c1559cc12761f3ecce7e1bb93fbd64e89e3a57b7 100644 --- a/src/app/settingsview/components/ScreenSharingSettingsPage.qml +++ b/src/app/settingsview/components/ScreenSharingSettingsPage.qml @@ -1,5 +1,3 @@ - - /* * Copyright (C) 2023 Savoir-faire Linux Inc. * Author: Fadi Shehadeh <fadi.shehadeh@savoirfairelinux.com> @@ -17,16 +15,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Enums 1.1 import net.jami.Constants 1.1 import net.jami.Helpers 1.1 - import "../../commoncomponents" SettingsPageBase { @@ -59,18 +54,20 @@ SettingsPageBase { labelText: JamiStrings.fps currentSelectionText: VideoDevices.screenSharingDefaultFps.toString() placeholderText: VideoDevices.screenSharingDefaultFps.toString() - comboModel: ListModel { id: screenSharingFpsModel } + comboModel: ListModel { + id: screenSharingFpsModel + } role: "FPS" Component.onCompleted: { - var elements = VideoDevices.sharingFpsSourceModel + var elements = VideoDevices.sharingFpsSourceModel; for (var item in elements) { - screenSharingFpsModel.append({"FPS": elements[item]}) + screenSharingFpsModel.append({ + "FPS": elements[item] + }); } } onActivated: VideoDevices.setDisplayFPS(screenSharingFpsModel.get(modelIndex).FPS) } - } - } diff --git a/src/app/settingsview/components/SettingMaterialButton.qml b/src/app/settingsview/components/SettingMaterialButton.qml index 310d550e1a12bcb19bcb585aec91a5000c6f0fba..5c71ec5221fa489ef0df5a0cc799c61702cf1954 100644 --- a/src/app/settingsview/components/SettingMaterialButton.qml +++ b/src/app/settingsview/components/SettingMaterialButton.qml @@ -15,14 +15,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" RowLayout { @@ -57,8 +54,8 @@ RowLayout { preferredWidth: root.itemWidth buttontextHeightMargin: JamiTheme.buttontextHeightMargin - textLeftPadding: JamiTheme.buttontextWizzardPadding /2 - textRightPadding: JamiTheme.buttontextWizzardPadding /2 + textLeftPadding: JamiTheme.buttontextWizzardPadding / 2 + textRightPadding: JamiTheme.buttontextWizzardPadding / 2 iconSource: root.source secondary: true diff --git a/src/app/settingsview/components/SettingSpinBox.qml b/src/app/settingsview/components/SettingSpinBox.qml index f2e863ad262879a9b31ee149b2801e39fb43a7a2..6c45ced5bba59d274780b49c0777eac7e18db0c4 100644 --- a/src/app/settingsview/components/SettingSpinBox.qml +++ b/src/app/settingsview/components/SettingSpinBox.qml @@ -16,15 +16,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts import QtQuick.Controls - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" RowLayout { @@ -70,12 +67,10 @@ RowLayout { onValueChanged: newValue() Keys.onPressed: function (keyEvent) { - - if (keyEvent.key === Qt.Key_Enter || - keyEvent.key === Qt.Key_Return) { - textInput.focus = false - spinbox.value = textInput.text - keyEvent.accepted = true + if (keyEvent.key === Qt.Key_Enter || keyEvent.key === Qt.Key_Return) { + textInput.focus = false; + spinbox.value = textInput.text; + keyEvent.accepted = true; } } @@ -83,10 +78,10 @@ RowLayout { id: textInput text: spinbox.textFromValue(spinbox.value, spinbox.locale) - color : JamiTheme.textColor + color: JamiTheme.textColor horizontalAlignment: Qt.AlignHCenter verticalAlignment: Qt.AlignVCenter - inputMethodHints : Qt.ImhDigitsOnly + inputMethodHints: Qt.ImhDigitsOnly validator: spinbox.validator font.pointSize: JamiTheme.settingsFontSize } @@ -110,10 +105,10 @@ RowLayout { up.indicator: Rectangle { width: parent.width / 8 - radius : 4 + radius: 4 anchors { - top : parent.top - bottom : parent.bottom + top: parent.top + bottom: parent.bottom right: parent.right margins: 1 } @@ -136,10 +131,10 @@ RowLayout { down.indicator: Rectangle { width: parent.width / 8 - radius : 4 + radius: 4 anchors { - top : parent.top - bottom : parent.bottom + top: parent.top + bottom: parent.bottom left: parent.left margins: 1 } diff --git a/src/app/settingsview/components/SettingsComboBox.qml b/src/app/settingsview/components/SettingsComboBox.qml index 1c69fc7ecad87a62da3732c8ef59b01866e39383..590fd732c9533b5c2006ea18574a8a7af0b480c8 100644 --- a/src/app/settingsview/components/SettingsComboBox.qml +++ b/src/app/settingsview/components/SettingsComboBox.qml @@ -15,12 +15,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts - import net.jami.Constants 1.1 - import "../../commoncomponents" RowLayout { diff --git a/src/app/settingsview/components/SettingsHeader.qml b/src/app/settingsview/components/SettingsHeader.qml index 88f270b618c8188a2f51744097109651d0f411e3..2b780797cb5dec286c1e3edd40f37c275537998e 100644 --- a/src/app/settingsview/components/SettingsHeader.qml +++ b/src/app/settingsview/components/SettingsHeader.qml @@ -15,18 +15,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" - - RowLayout { id: root diff --git a/src/app/settingsview/components/SettingsMaterialTextEdit.qml b/src/app/settingsview/components/SettingsMaterialTextEdit.qml index d4c1cd66deda426a30bdba3bc14e45b2dda5c40e..67064b78d8234b8d7fdbe0461a3d529914087698 100644 --- a/src/app/settingsview/components/SettingsMaterialTextEdit.qml +++ b/src/app/settingsview/components/SettingsMaterialTextEdit.qml @@ -15,14 +15,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" RowLayout { @@ -75,20 +72,20 @@ RowLayout { elidedText: modalTextEditTextSize.elidedText onAccepted: { - root.dynamicText = dynamicText - editFinished() + root.dynamicText = dynamicText; + editFinished(); } editMode: false isPersistent: false onActiveFocusChanged: { - if(!activeFocus){ - root.dynamicText = dynamicText - editFinished() - modalTextEdit.editMode = false + if (!activeFocus) { + root.dynamicText = dynamicText; + editFinished(); + modalTextEdit.editMode = false; } else { - modalTextEdit.editMode = true + modalTextEdit.editMode = true; } } } @@ -105,10 +102,9 @@ RowLayout { placeholderText: root.placeholderText ? root.placeholderText : root.titleField onAccepted: { - root.dynamicText = dynamicText - editFinished() - echoMode = TextInput.Password + root.dynamicText = dynamicText; + editFinished(); + echoMode = TextInput.Password; } - } } diff --git a/src/app/settingsview/components/SettingsMenuButton.qml b/src/app/settingsview/components/SettingsMenuButton.qml index 6a85a1194b41a05afce9056ce751b3743dac8549..33ac094addad17c8c98bd2872a14737e5e036ffa 100644 --- a/src/app/settingsview/components/SettingsMenuButton.qml +++ b/src/app/settingsview/components/SettingsMenuButton.qml @@ -16,13 +16,10 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls - import net.jami.Models 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" PushButton { diff --git a/src/app/settingsview/components/SettingsPageBase.qml b/src/app/settingsview/components/SettingsPageBase.qml index c5adeca43623dafabf6eedf0e11e02589e257abe..e28a0cd308c9eb7c8139e824d6651f304c9b6164 100644 --- a/src/app/settingsview/components/SettingsPageBase.qml +++ b/src/app/settingsview/components/SettingsPageBase.qml @@ -14,16 +14,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Adapters 1.1 import net.jami.Constants 1.1 import net.jami.Enums 1.1 import net.jami.Models 1.1 - import "../../commoncomponents" Page { @@ -31,8 +28,7 @@ Page { required property Item flickableContent - property real contentFlickableWidth: Math.min(JamiTheme.maximumWidthSettingsView, - root.width - 2 * JamiTheme.preferredSettingsMarginSize) + property real contentFlickableWidth: Math.min(JamiTheme.maximumWidthSettingsView, root.width - 2 * JamiTheme.preferredSettingsMarginSize) property color backgroundColor: JamiTheme.secondaryBackgroundColor diff --git a/src/app/settingsview/components/SystemSettingsPage.qml b/src/app/settingsview/components/SystemSettingsPage.qml index 17ef1c8e364b16d377ce3361c94b57e4595f6985..9e426d669661ed5a1d14aed1564ceb4af89b2b81 100644 --- a/src/app/settingsview/components/SystemSettingsPage.qml +++ b/src/app/settingsview/components/SystemSettingsPage.qml @@ -15,17 +15,14 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts import Qt.labs.platform - import net.jami.Adapters 1.1 import net.jami.Constants 1.1 import net.jami.Enums 1.1 import net.jami.Models 1.1 - import "../../commoncomponents" SettingsPageBase { @@ -39,14 +36,13 @@ SettingsPageBase { title: JamiStrings.system - onDownloadPathChanged: { - if(downloadPath === "") return - UtilsAdapter.setDownloadPath(downloadPath) + if (downloadPath === "") + return; + UtilsAdapter.setDownloadPath(downloadPath); } flickableContent: ColumnLayout { - id: manageAccountEnableColumnLayout width: contentFlickableWidth spacing: JamiTheme.settingsBlockSpacing @@ -66,12 +62,11 @@ SettingsPageBase { options: FolderDialog.ShowDirsOnly onAccepted: { - var dir = UtilsAdapter.getAbsPath(folder.toString()) - var dirName = UtilsAdapter.dirName(folder.toString()) - downloadPath = dir - downloadPathBestName = dirName + var dir = UtilsAdapter.getAbsPath(folder.toString()); + var dirName = UtilsAdapter.dirName(folder.toString()); + downloadPath = dir; + downloadPathBestName = dirName; } - } ToggleSwitch { @@ -153,10 +148,13 @@ SettingsPageBase { var supported = UtilsAdapter.supportedLang(); var keys = Object.keys(supported); var currentKey = UtilsAdapter.getAppValue(Settings.Key.LANG); - for (var i = 0 ; i < keys.length ; ++i) { - append({ textDisplay: supported[keys[i]], id: keys[i] }) + for (var i = 0; i < keys.length; ++i) { + append({ + "textDisplay": supported[keys[i]], + "id": keys[i] + }); if (keys[i] === currentKey) - langComboBoxSetting.modelIndex = i + langComboBoxSetting.modelIndex = i; } } } @@ -165,7 +163,7 @@ SettingsPageBase { role: "textDisplay" onActivated: { - UtilsAdapter.setAppValue(Settings.Key.LANG, comboModel.get(modelIndex).id) + UtilsAdapter.setAppValue(Settings.Key.LANG, comboModel.get(modelIndex).id); } } @@ -173,18 +171,19 @@ SettingsPageBase { target: UtilsAdapter function onChangeLanguage() { - var langIdx = langComboBoxSetting.modelIndex - langModel.clear() + var langIdx = langComboBoxSetting.modelIndex; + langModel.clear(); var supported = UtilsAdapter.supportedLang(); var keys = Object.keys(supported); - for (var i = 0 ; i < keys.length ; ++i) { - langModel.append({ textDisplay: supported[keys[i]], id: keys[i] }) + for (var i = 0; i < keys.length; ++i) { + langModel.append({ + "textDisplay": supported[keys[i]], + "id": keys[i] + }); } - langComboBoxSetting.modelIndex = langIdx + langComboBoxSetting.modelIndex = langIdx; } } - - } ColumnLayout { @@ -202,11 +201,10 @@ SettingsPageBase { color: JamiTheme.textColor horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter - wrapMode : Text.WordWrap + wrapMode: Text.WordWrap font.pixelSize: JamiTheme.settingsTitlePixelSize font.kerning: true - } ToggleSwitch { @@ -216,17 +214,15 @@ SettingsPageBase { labelText: JamiStrings.experimentalCallSwarm tooltipText: JamiStrings.experimentalCallSwarmTooltip onSwitchToggled: { - UtilsAdapter.setAppValue(Settings.Key.EnableExperimentalSwarm, checked) + UtilsAdapter.setAppValue(Settings.Key.EnableExperimentalSwarm, checked); } } - - } MaterialButton { id: defaultSettings - TextMetrics{ + TextMetrics { id: textSize font.weight: Font.Bold font.pixelSize: JamiTheme.wizardViewButtonFontPixelSize @@ -237,22 +233,18 @@ SettingsPageBase { secondary: true text: JamiStrings.defaultSettings - preferredWidth: textSize.width + 2*JamiTheme.buttontextWizzardPadding + preferredWidth: textSize.width + 2 * JamiTheme.buttontextWizzardPadding onClicked: { - notificationCheckBox.checked = UtilsAdapter.getDefault(Settings.Key.EnableNotifications) - closeOrMinCheckBox.checked = UtilsAdapter.getDefault(Settings.Key.MinimizeOnClose) - checkboxCallSwarm.checked = UtilsAdapter.getDefault(Settings.Key.EnableExperimentalSwarm) - langComboBoxSetting.modelIndex = 0 - - UtilsAdapter.setToDefault(Settings.Key.EnableNotifications) - UtilsAdapter.setToDefault(Settings.Key.MinimizeOnClose) - UtilsAdapter.setToDefault(Settings.Key.LANG) - UtilsAdapter.setToDefault(Settings.Key.EnableExperimentalSwarm) + notificationCheckBox.checked = UtilsAdapter.getDefault(Settings.Key.EnableNotifications); + closeOrMinCheckBox.checked = UtilsAdapter.getDefault(Settings.Key.MinimizeOnClose); + checkboxCallSwarm.checked = UtilsAdapter.getDefault(Settings.Key.EnableExperimentalSwarm); + langComboBoxSetting.modelIndex = 0; + UtilsAdapter.setToDefault(Settings.Key.EnableNotifications); + UtilsAdapter.setToDefault(Settings.Key.MinimizeOnClose); + UtilsAdapter.setToDefault(Settings.Key.LANG); + UtilsAdapter.setToDefault(Settings.Key.EnableExperimentalSwarm); } - } - - } } diff --git a/src/app/settingsview/components/ToggleSwitch.qml b/src/app/settingsview/components/ToggleSwitch.qml index 9522e2a6b4a92cb5a1bf6fb39d8232394bbe5f29..72046002ca6b7c1a970cb4da309abd65e36f62f8 100644 --- a/src/app/settingsview/components/ToggleSwitch.qml +++ b/src/app/settingsview/components/ToggleSwitch.qml @@ -15,13 +15,10 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Constants 1.1 - import "../../commoncomponents" RowLayout { @@ -95,9 +92,8 @@ RowLayout { enabled: parent.visible onTapped: function onTapped(eventPoint) { // switchToggled should be emitted as onToggled is not called (because it's only called if the user click on the switch) - switchOfLayout.toggle() - switchToggled() + switchOfLayout.toggle(); + switchToggled(); } } - } diff --git a/src/app/settingsview/components/TroubleshootSettingsPage.qml b/src/app/settingsview/components/TroubleshootSettingsPage.qml index 8e8154fc93269e6b4f7b846b1f423d3cbdedc612..63f5adedc6b21571ee317943372cad9ef6f73125 100644 --- a/src/app/settingsview/components/TroubleshootSettingsPage.qml +++ b/src/app/settingsview/components/TroubleshootSettingsPage.qml @@ -16,20 +16,16 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Adapters 1.1 import net.jami.Constants 1.1 import net.jami.Enums 1.1 import net.jami.Models 1.1 - import "../../commoncomponents" import "../js/logviewwindowcreation.js" as LogViewWindowCreation - SettingsPageBase { id: root @@ -37,7 +33,6 @@ SettingsPageBase { title: JamiStrings.troubleshootTitle - flickableContent: ColumnLayout { id: troubleshootSettingsColumnLayout @@ -66,7 +61,7 @@ SettingsPageBase { MaterialButton { id: enableTroubleshootingButton - TextMetrics{ + TextMetrics { id: enableTroubleshootingButtonTextSize font.weight: Font.Bold font.pixelSize: JamiTheme.wizardViewButtonFontPixelSize @@ -76,7 +71,7 @@ SettingsPageBase { Layout.alignment: Qt.AlignRight - preferredWidth: enableTroubleshootingButtonTextSize.width + 2*JamiTheme.buttontextWizzardPadding + preferredWidth: enableTroubleshootingButtonTextSize.width + 2 * JamiTheme.buttontextWizzardPadding buttontextHeightMargin: JamiTheme.buttontextHeightMargin primary: true @@ -85,8 +80,8 @@ SettingsPageBase { toolTipText: JamiStrings.troubleshootButton onClicked: { - LogViewWindowCreation.createlogViewWindowObject() - LogViewWindowCreation.showLogViewWindow() + LogViewWindowCreation.createlogViewWindowObject(); + LogViewWindowCreation.showLogViewWindow(); } } } diff --git a/src/app/settingsview/components/UpdateDownloadDialog.qml b/src/app/settingsview/components/UpdateDownloadDialog.qml index 88cf9f351020f3f1b585c946d87ee82ea27a955a..74d0894e18b09d030db4121fa7321ebaac553625 100644 --- a/src/app/settingsview/components/UpdateDownloadDialog.qml +++ b/src/app/settingsview/components/UpdateDownloadDialog.qml @@ -14,17 +14,14 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Adapters 1.1 import net.jami.Enums 1.1 import net.jami.Models 1.1 import net.jami.Helpers 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" SimpleMessageDialog { @@ -32,7 +29,7 @@ SimpleMessageDialog { property int bytesRead: 0 property int totalBytes: 0 - property string hSizeRead: UtilsAdapter.humanFileSize(bytesRead) + property string hSizeRead: UtilsAdapter.humanFileSize(bytesRead) property string hTotalBytes: UtilsAdapter.humanFileSize(totalBytes) property alias progressBarValue: progressBar.value @@ -40,31 +37,29 @@ SimpleMessageDialog { target: UpdateManager function onUpdateDownloadProgressChanged(bytesRead, totalBytes) { - downloadDialog.setDownloadProgress(bytesRead, totalBytes) + downloadDialog.setDownloadProgress(bytesRead, totalBytes); } function onUpdateDownloadErrorOccurred(error) { - downloadDialog.close() + downloadDialog.close(); } function onUpdateDownloadFinished() { - downloadDialog.close() + downloadDialog.close(); } } function setDownloadProgress(bytesRead, totalBytes) { - downloadDialog.bytesRead = bytesRead - downloadDialog.totalBytes = totalBytes + downloadDialog.bytesRead = bytesRead; + downloadDialog.totalBytes = totalBytes; } - infoText: JamiStrings.updateDownloading + - " (%1 / %2)".arg(hSizeRead).arg(hTotalBytes) + infoText: JamiStrings.updateDownloading + " (%1 / %2)".arg(hSizeRead).arg(hTotalBytes) innerContentData: ProgressBar { id: progressBar - value: downloadDialog.bytesRead / - downloadDialog.totalBytes + value: downloadDialog.bytesRead / downloadDialog.totalBytes anchors.left: parent.left anchors.leftMargin: JamiTheme.preferredMarginSize @@ -102,9 +97,11 @@ SimpleMessageDialog { buttonTitles: [JamiStrings.optionCancel] buttonStyles: [SimpleMessageDialog.ButtonStyle.TintedBlue] - buttonCallBacks: [function() { UpdateManager.cancelUpdate() }] + buttonCallBacks: [function () { + UpdateManager.cancelUpdate(); + }] onVisibleChanged: { if (!visible) - UpdateManager.cancelUpdate() + UpdateManager.cancelUpdate(); } } diff --git a/src/app/settingsview/components/UpdateSettingsPage.qml b/src/app/settingsview/components/UpdateSettingsPage.qml index fa3ae6184d53ef046ea9f0538555d73f51087cef..186cf0c46d5577ae8e3e29f95face85b033c6730 100644 --- a/src/app/settingsview/components/UpdateSettingsPage.qml +++ b/src/app/settingsview/components/UpdateSettingsPage.qml @@ -17,56 +17,44 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Adapters 1.1 import net.jami.Enums 1.1 import net.jami.Models 1.1 import net.jami.Helpers 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" - SettingsPageBase { id: root title: JamiStrings.updatesTitle function presentInfoDialog(infoText) { - viewCoordinator.presentDialog( - appWindow, - "commoncomponents/SimpleMessageDialog.qml", - { - title: JamiStrings.updateDialogTitle, - infoText: infoText, - buttonTitles: [JamiStrings.optionOk], - buttonStyles: [SimpleMessageDialog.ButtonStyle.TintedBlue], - buttonCallBacks: [] - }) + viewCoordinator.presentDialog(appWindow, "commoncomponents/SimpleMessageDialog.qml", { + "title": JamiStrings.updateDialogTitle, + "infoText": infoText, + "buttonTitles": [JamiStrings.optionOk], + "buttonStyles": [SimpleMessageDialog.ButtonStyle.TintedBlue], + "buttonCallBacks": [] + }); } function presentConfirmInstallDialog(infoText, beta) { - viewCoordinator.presentDialog( - appWindow, - "commoncomponents/SimpleMessageDialog.qml", - { - title: JamiStrings.updateDialogTitle, - infoText: infoText, - buttonTitles: [JamiStrings.optionUpgrade, JamiStrings.optionLater], - buttonStyles: [ - SimpleMessageDialog.ButtonStyle.TintedBlue, - SimpleMessageDialog.ButtonStyle.TintedBlue - ], - buttonCallBacks: [function() {UpdateManager.applyUpdates(beta)}] - }) + viewCoordinator.presentDialog(appWindow, "commoncomponents/SimpleMessageDialog.qml", { + "title": JamiStrings.updateDialogTitle, + "infoText": infoText, + "buttonTitles": [JamiStrings.optionUpgrade, JamiStrings.optionLater], + "buttonStyles": [SimpleMessageDialog.ButtonStyle.TintedBlue, SimpleMessageDialog.ButtonStyle.TintedBlue], + "buttonCallBacks": [function () { + UpdateManager.applyUpdates(beta); + }] + }); } flickableContent: ColumnLayout { - id: manageAccountEnableColumnLayout width: contentFlickableWidth spacing: JamiTheme.settingsBlockSpacing @@ -78,23 +66,21 @@ SettingsPageBase { Layout.fillWidth: true - checked: Qt.platform.os.toString() === "windows" ? - UtilsAdapter.getAppValue(Settings.Key.AutoUpdate) : - UpdateManager.isAutoUpdaterEnabled() + checked: Qt.platform.os.toString() === "windows" ? UtilsAdapter.getAppValue(Settings.Key.AutoUpdate) : UpdateManager.isAutoUpdaterEnabled() labelText: JamiStrings.update tooltipText: JamiStrings.enableAutoUpdates onSwitchToggled: { - UtilsAdapter.setAppValue(Settings.Key.AutoUpdate, checked) - UpdateManager.setAutoUpdateCheck(checked) + UtilsAdapter.setAppValue(Settings.Key.AutoUpdate, checked); + UpdateManager.setAutoUpdateCheck(checked); } } MaterialButton { id: checkUpdateButton - TextMetrics{ + TextMetrics { id: checkUpdateButtonTextSize font.weight: Font.Bold font.pixelSize: JamiTheme.wizardViewButtonFontPixelSize @@ -104,7 +90,7 @@ SettingsPageBase { Layout.alignment: Qt.AlignLeft - preferredWidth: checkUpdateButtonTextSize.width + 2*JamiTheme.buttontextWizzardPadding + preferredWidth: checkUpdateButtonTextSize.width + 2 * JamiTheme.buttontextWizzardPadding primary: true autoAccelerator: true @@ -118,13 +104,13 @@ SettingsPageBase { MaterialButton { id: installBetaButton - visible: !UpdateManager.isCurrentVersionBeta() && Qt.platform.os.toString() === "windows" + visible: !UpdateManager.isCurrentVersionBeta() && Qt.platform.os.toString() === "windows" Layout.alignment: Qt.AlignHCenter preferredWidth: JamiTheme.preferredFieldWidth - color: enabled? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey + color: enabled ? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey hoveredColor: JamiTheme.buttonTintedBlackHovered pressedColor: JamiTheme.buttonTintedBlackPressed secondary: true @@ -133,19 +119,15 @@ SettingsPageBase { toolTipText: JamiStrings.betaInstall text: JamiStrings.betaInstall - onClicked: viewCoordinator.presentDialog( - appWindow, - "commoncomponents/SimpleMessageDialog.qml", - { - title: JamiStrings.updateDialogTitle, - infoText: JamiStrings.confirmBeta, - buttonTitles: [JamiStrings.optionUpgrade, JamiStrings.optionLater], - buttonStyles: [ - SimpleMessageDialog.ButtonStyle.TintedBlue, - SimpleMessageDialog.ButtonStyle.TintedBlue - ], - buttonCallBacks: [function() {UpdateManager.applyUpdates(true)}] - }) + onClicked: viewCoordinator.presentDialog(appWindow, "commoncomponents/SimpleMessageDialog.qml", { + "title": JamiStrings.updateDialogTitle, + "infoText": JamiStrings.confirmBeta, + "buttonTitles": [JamiStrings.optionUpgrade, JamiStrings.optionLater], + "buttonStyles": [SimpleMessageDialog.ButtonStyle.TintedBlue, SimpleMessageDialog.ButtonStyle.TintedBlue], + "buttonCallBacks": [function () { + UpdateManager.applyUpdates(true); + }] + }) } } } diff --git a/src/app/settingsview/components/VideoSettingsPage.qml b/src/app/settingsview/components/VideoSettingsPage.qml index 61768b950f519f041cc89ddceeaf0e08f5050d8c..61ecd45d3f54d9ab8057d8c7baba2840c4e041aa 100644 --- a/src/app/settingsview/components/VideoSettingsPage.qml +++ b/src/app/settingsview/components/VideoSettingsPage.qml @@ -15,20 +15,16 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts import Qt5Compat.GraphicalEffects - import SortFilterProxyModel 0.2 - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Enums 1.1 import net.jami.Constants 1.1 import net.jami.Helpers 1.1 - import "../../commoncomponents" SettingsPageBase { @@ -46,7 +42,6 @@ SettingsPageBase { anchors.left: parent.left anchors.leftMargin: JamiTheme.preferredSettingsMarginSize - ColumnLayout { id: generalSettings @@ -55,60 +50,48 @@ SettingsPageBase { function startPreviewing(force = false) { if (!visible) { - return + return; } - previewWidget.startWithId(VideoDevices.getDefaultDevice(), force) + previewWidget.startWithId(VideoDevices.getDefaultDevice(), force); } Connections { target: VideoDevices function onDefaultResChanged() { - generalSettings.startPreviewing(true) + generalSettings.startPreviewing(true); } function onDefaultFpsChanged() { - generalSettings.startPreviewing(true) + generalSettings.startPreviewing(true); } function onDeviceAvailable() { - generalSettings.startPreviewing() + generalSettings.startPreviewing(); } function onDeviceListChanged() { - var deviceModel = deviceComboBoxSetting.comboModel - var resModel = resolutionComboBoxSetting.comboModel - var fpsModel = fpsComboBoxSetting.comboModel - - var resultList = deviceModel.match(deviceModel.index(0, 0), - VideoInputDeviceModel.DeviceId, - VideoDevices.defaultId) - deviceComboBoxSetting.modelIndex = resultList.length > 0 ? - resultList[0].row : deviceModel.rowCount() ? 0 : -1 - - resultList = resModel.match(resModel.index(0, 0), - VideoFormatResolutionModel.Resolution, - VideoDevices.defaultRes) - resolutionComboBoxSetting.modelIndex = resultList.length > 0 ? - resultList[0].row : deviceModel.rowCount() ? 0 : -1 - - resultList = fpsModel.match(fpsModel.index(0, 0), - VideoFormatFpsModel.FPS, - VideoDevices.defaultFps) - fpsComboBoxSetting.modelIndex = resultList.length > 0 ? - resultList[0].row : deviceModel.rowCount() ? 0 : -1 + var deviceModel = deviceComboBoxSetting.comboModel; + var resModel = resolutionComboBoxSetting.comboModel; + var fpsModel = fpsComboBoxSetting.comboModel; + var resultList = deviceModel.match(deviceModel.index(0, 0), VideoInputDeviceModel.DeviceId, VideoDevices.defaultId); + deviceComboBoxSetting.modelIndex = resultList.length > 0 ? resultList[0].row : deviceModel.rowCount() ? 0 : -1; + resultList = resModel.match(resModel.index(0, 0), VideoFormatResolutionModel.Resolution, VideoDevices.defaultRes); + resolutionComboBoxSetting.modelIndex = resultList.length > 0 ? resultList[0].row : deviceModel.rowCount() ? 0 : -1; + resultList = fpsModel.match(fpsModel.index(0, 0), VideoFormatFpsModel.FPS, VideoDevices.defaultFps); + fpsComboBoxSetting.modelIndex = resultList.length > 0 ? resultList[0].row : deviceModel.rowCount() ? 0 : -1; } } Component.onCompleted: { - flipControl.checked = UtilsAdapter.getAppValue(Settings.FlipSelf) - hardwareAccelControl.checked = AvAdapter.getHardwareAcceleration() + flipControl.checked = UtilsAdapter.getAppValue(Settings.FlipSelf); + hardwareAccelControl.checked = AvAdapter.getHardwareAcceleration(); if (previewWidget.visible) - startPreviewing(true) + startPreviewing(true); } Component.onDestruction: { - previewWidget.startWithId("") + previewWidget.startWithId(""); } // video Preview @@ -148,8 +131,8 @@ SettingsPageBase { labelText: JamiStrings.mirrorLocalVideo onSwitchToggled: { - UtilsAdapter.setAppValue(Settings.FlipSelf, checked) - CurrentCall.flipSelf = UtilsAdapter.getAppValue(Settings.FlipSelf) + UtilsAdapter.setAppValue(Settings.FlipSelf, checked); + CurrentCall.flipSelf = UtilsAdapter.getAppValue(Settings.FlipSelf); } } @@ -185,10 +168,9 @@ SettingsPageBase { onActivated: { // TODO: start and stop preview logic in here should be in LRC - previewWidget.startWithId("") - VideoDevices.setDefaultDevice( - filteredDevicesModel.mapToSource(modelIndex)) - generalSettings.startPreviewing() + previewWidget.startWithId(""); + VideoDevices.setDefaultDevice(filteredDevicesModel.mapToSource(modelIndex)); + generalSettings.startPreviewing(); } } @@ -221,8 +203,7 @@ SettingsPageBase { } role: "Resolution" - onActivated: VideoDevices.setDefaultDeviceRes( - filteredResModel.mapToSource(modelIndex)) + onActivated: VideoDevices.setDefaultDeviceRes(filteredResModel.mapToSource(modelIndex)) } SettingsComboBox { @@ -253,8 +234,7 @@ SettingsPageBase { } role: "FPS" - onActivated: VideoDevices.setDefaultDeviceFps( - filteredFpsModel.mapToSource(modelIndex)) + onActivated: VideoDevices.setDefaultDeviceFps(filteredFpsModel.mapToSource(modelIndex)) } ToggleSwitch { @@ -265,13 +245,11 @@ SettingsPageBase { labelText: JamiStrings.enableHWAccel onSwitchToggled: { - AvAdapter.setHardwareAcceleration(checked) - generalSettings.startPreviewing(true) + AvAdapter.setHardwareAcceleration(checked); + generalSettings.startPreviewing(true); } } - - Text { visible: VideoDevices.listSize === 0 diff --git a/src/app/webengine/GeneralWebEngineView.qml b/src/app/webengine/GeneralWebEngineView.qml index 109a279f4b93f7b70cd05ffb0dd1ceed6c80462b..da8e2dfef4005c978dfe040492ab186ff498bd7f 100644 --- a/src/app/webengine/GeneralWebEngineView.qml +++ b/src/app/webengine/GeneralWebEngineView.qml @@ -15,11 +15,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtWebEngine import QtWebChannel - import net.jami.Adapters 1.1 import net.jami.Constants 1.1 @@ -52,26 +50,24 @@ WebEngineView { onNavigationRequested: function (request) { if (request.navigationType === WebEngineView.LinkClickedNavigation) { - MessagesAdapter.openUrl(request.url) - request.action = WebEngineView.IgnoreRequest + MessagesAdapter.openUrl(request.url); + request.action = WebEngineView.IgnoreRequest; } } onContextMenuRequested: function (request) { - var needContextMenu = request.selectedText.length || request.isContentEditable + var needContextMenu = request.selectedText.length || request.isContentEditable; if (!needContextMenu) - request.accepted = true + request.accepted = true; } Component.onCompleted: { - profile.cachePath = UtilsAdapter.getCachePath() - profile.persistentStoragePath = UtilsAdapter.getCachePath() - profile.persistentCookiesPolicy = WebEngineProfile.NoPersistentCookies - profile.httpCacheType = WebEngineProfile.NoCache - profile.httpUserAgent = JamiStrings.httpUserAgentName - - root.loadHtml(UtilsAdapter.qStringFromFile(onCompletedLoadHtml), - onCompletedLoadHtml) - root.url = onCompletedUrl + profile.cachePath = UtilsAdapter.getCachePath(); + profile.persistentStoragePath = UtilsAdapter.getCachePath(); + profile.persistentCookiesPolicy = WebEngineProfile.NoPersistentCookies; + profile.httpCacheType = WebEngineProfile.NoCache; + profile.httpUserAgent = JamiStrings.httpUserAgentName; + root.loadHtml(UtilsAdapter.qStringFromFile(onCompletedLoadHtml), onCompletedLoadHtml); + root.url = onCompletedUrl; } } diff --git a/src/app/webengine/MediaPreviewBase.qml b/src/app/webengine/MediaPreviewBase.qml index 9903b7daab80065b9d76e223d3bc58959bde1cce..05d18dbcf8d4201e522b17bd70972191246e2b5c 100644 --- a/src/app/webengine/MediaPreviewBase.qml +++ b/src/app/webengine/MediaPreviewBase.qml @@ -15,17 +15,14 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts import Qt5Compat.GraphicalEffects import QtWebEngine - import net.jami.Models 1.1 import net.jami.Constants 1.1 import net.jami.Adapters 1.1 - import "../commoncomponents" WebEngineView { @@ -35,18 +32,12 @@ WebEngineView { readonly property real minSize: 192 readonly property real maxSize: 256 readonly property real aspectRatio: 1 / .75 - readonly property real adjustedWidth: Math.min(maxSize, - Math.max(minSize, - innerContent.width - senderMargin)) + readonly property real adjustedWidth: Math.min(maxSize, Math.max(minSize, innerContent.width - senderMargin)) anchors.right: isOutgoing ? parent.right : undefined width: isFullScreen ? parent.width : adjustedWidth - height: isVideo ? - isFullScreen ? - parent.height : - Math.ceil(adjustedWidth / aspectRatio) : - 54 - onContextMenuRequested: function(request) { - request.accepted = true + height: isVideo ? isFullScreen ? parent.height : Math.ceil(adjustedWidth / aspectRatio) : 54 + onContextMenuRequested: function (request) { + request.accepted = true; } settings.fullScreenSupportEnabled: isVideo settings.javascriptCanOpenWindows: false @@ -61,16 +52,14 @@ WebEngineView { radius: msgRadius } } - onFullScreenRequested: function(request) { + onFullScreenRequested: function (request) { if (request.toggleOn) { - layoutManager.pushFullScreenItem( - this, - localMediaCompLoader, - null, - function() { wev.fullScreenCancelled() }) + layoutManager.pushFullScreenItem(this, localMediaCompLoader, null, function () { + wev.fullScreenCancelled(); + }); } else if (!request.toggleOn) { - layoutManager.removeFullScreenItem(this) + layoutManager.removeFullScreenItem(this); } - request.accept() + request.accept(); } } diff --git a/src/app/webengine/VideoPreview.qml b/src/app/webengine/VideoPreview.qml index df6b6f7f59e3d77daa99ebe4a0975767555ed454..f46b45bd9a033d683717c25e5828b6ea629b8dfd 100644 --- a/src/app/webengine/VideoPreview.qml +++ b/src/app/webengine/VideoPreview.qml @@ -14,11 +14,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtWebEngine import Qt5Compat.GraphicalEffects - import net.jami.Constants 1.1 Rectangle { @@ -34,21 +32,19 @@ Rectangle { anchors.fill: parent anchors.verticalCenter: root.verticalCenter backgroundColor: JamiTheme.secondaryBackgroundColor - anchors.topMargin: root.isVideo? 0 : wev.implicitHeight / 2 + anchors.topMargin: root.isVideo ? 0 : wev.implicitHeight / 2 settings.fullScreenSupportEnabled: root.isVideo settings.javascriptCanOpenWindows: false Component.onCompleted: loadHtml(root.html, 'file://') - onFullScreenRequested: function(request) { + onFullScreenRequested: function (request) { if (request.toggleOn) { - layoutManager.pushFullScreenItem( - this, - root, - null, - function() { wev.fullScreenCancelled() }) + layoutManager.pushFullScreenItem(this, root, null, function () { + wev.fullScreenCancelled(); + }); } else if (!request.toggleOn) { - layoutManager.removeFullScreenItem(this) + layoutManager.removeFullScreenItem(this); } - request.accept() + request.accept(); } } @@ -59,10 +55,10 @@ Rectangle { height: root.height Rectangle { anchors.centerIn: parent - width: root.width + width: root.width height: root.height radius: JamiTheme.swarmDetailsPageDocumentsMediaRadius } } } -} \ No newline at end of file +} diff --git a/src/app/webengine/emojipicker/EmojiPicker.qml b/src/app/webengine/emojipicker/EmojiPicker.qml index 8fa5251a13c0079e38f6d6c7927c1b24c1193341..0bc1ebe31673418ccb05b7e19834aa56e2224ab9 100644 --- a/src/app/webengine/emojipicker/EmojiPicker.qml +++ b/src/app/webengine/emojipicker/EmojiPicker.qml @@ -16,17 +16,14 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import Qt5Compat.GraphicalEffects import QtWebEngine import QtWebChannel - import net.jami.Models 1.1 import net.jami.Constants 1.1 import net.jami.Adapters 1.1 - import "../" Popup { @@ -44,14 +41,13 @@ Popup { onIsScrollingChanged: close() function openEmojiPicker() { - root.open() - emojiPickerWebView.runJavaScript( - "prepare_to_show(" + JamiTheme.darkTheme + ");") + root.open(); + emojiPickerWebView.runJavaScript("prepare_to_show(" + JamiTheme.darkTheme + ");"); } function closeEmojiPicker() { - emojiPickerWebView.runJavaScript("prepare_to_hide();") - close() + emojiPickerWebView.runJavaScript("prepare_to_hide();"); + close(); } padding: 0 visible: false @@ -66,13 +62,13 @@ Popup { // Functions that are exposed, return code can be derived from js side // by setting callback function. function emojiIsPicked(arg) { - root.emojiIsPicked(arg) - closeEmojiPicker() + root.emojiIsPicked(arg); + closeEmojiPicker(); } // For emojiPicker to properly close function emojiPickerHideFinished() { - root.visible = false + root.visible = false; } } @@ -88,17 +84,11 @@ Popup { onLoadingChanged: function (loadingInfo) { if (loadingInfo.status === WebEngineView.LoadSucceededStatus) { - emojiPickerWebView.runJavaScript(UtilsAdapter.qStringFromFile( - ":/webengine/qwebchannel.js")) - emojiPickerWebView.runJavaScript( - UtilsAdapter.qStringFromFile( - ":/webengine/emojipicker/emoji.js")) - emojiPickerWebView.runJavaScript( - UtilsAdapter.qStringFromFile( - ":/webengine/emojipicker/emojiPickerLoader.js")) - emojiPickerWebView.runJavaScript( - "init_emoji_picker(" + JamiTheme.darkTheme + ");") - root.openEmojiPicker() + emojiPickerWebView.runJavaScript(UtilsAdapter.qStringFromFile(":/webengine/qwebchannel.js")); + emojiPickerWebView.runJavaScript(UtilsAdapter.qStringFromFile(":/webengine/emojipicker/emoji.js")); + emojiPickerWebView.runJavaScript(UtilsAdapter.qStringFromFile(":/webengine/emojipicker/emojiPickerLoader.js")); + emojiPickerWebView.runJavaScript("init_emoji_picker(" + JamiTheme.darkTheme + ");"); + root.openEmojiPicker(); } } } @@ -106,7 +96,7 @@ Popup { Overlay.modal: Rectangle { color: JamiTheme.transparentColor // Color animation for overlay when pop up is shown. - ColorAnimation on color { + ColorAnimation on color { to: JamiTheme.popupOverlayColor duration: 500 } @@ -114,14 +104,18 @@ Popup { enter: Transition { NumberAnimation { - properties: "opacity"; from: 0.0; to: 1.0 + properties: "opacity" + from: 0.0 + to: 1.0 duration: JamiTheme.shortFadeDuration } } exit: Transition { NumberAnimation { - properties: "opacity"; from: 1.0; to: 0.0 + properties: "opacity" + from: 1.0 + to: 0.0 duration: JamiTheme.shortFadeDuration } } diff --git a/src/app/webengine/map/MapPosition.qml b/src/app/webengine/map/MapPosition.qml index 86677992c43d2ff48f2e8e3bd19dae28a5dca835..754ff356a7a2b408a781b2f68dab7c9ca10ae81e 100644 --- a/src/app/webengine/map/MapPosition.qml +++ b/src/app/webengine/map/MapPosition.qml @@ -15,18 +15,15 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts import Qt5Compat.GraphicalEffects import QtWebEngine - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Enums 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" Item { @@ -42,7 +39,7 @@ Item { property bool isSharingToCurrentConversation function closeMapPosition() { - root.destroy() + root.destroy(); } Connections { @@ -50,22 +47,22 @@ Item { function onPinMapSignal(key) { if (key === attachedAccountId) { - isUnpin = false - mapObject.state = "pin" - windowUnpin.close() + isUnpin = false; + mapObject.state = "pin"; + windowUnpin.close(); } } function onCloseMap(key) { - if (key === attachedAccountId ) - closeMapPosition() + if (key === attachedAccountId) + closeMapPosition(); } function onUnPinMapSignal(key) { - if (key === attachedAccountId ) { - isUnpin = true - mapObject.state = "unpin" - windowUnpin.show() + if (key === attachedAccountId) { + isUnpin = true; + mapObject.state = "unpin"; + windowUnpin.show(); } } } @@ -87,7 +84,7 @@ Item { onClosing: { if (isUnpin) { - PositionManager.setMapInactive(attachedAccountId) + PositionManager.setMapInactive(attachedAccountId); } } } @@ -103,30 +100,33 @@ Item { x: xPos y: yPos - width: root.isUnpin - ? windowUnpin.width - : isFullScreen ? root.maxWidth : windowSize - height: root.isUnpin - ? windowUnpin.height - : isFullScreen ? root.maxHeight - yPos : windowSize + width: root.isUnpin ? windowUnpin.width : isFullScreen ? root.maxWidth : windowSize + height: root.isUnpin ? windowUnpin.height : isFullScreen ? root.maxHeight - yPos : windowSize property bool isFullScreen: false - property real windowSize: windowPreferedSize > JamiTheme.minimumMapWidth - ? windowPreferedSize - : JamiTheme.minimumMapWidth - property real windowPreferedSize: root.maxWidth > root.maxHeight - ? root.maxHeight / 3 - : root.maxWidth / 3 + property real windowSize: windowPreferedSize > JamiTheme.minimumMapWidth ? windowPreferedSize : JamiTheme.minimumMapWidth + property real windowPreferedSize: root.maxWidth > root.maxHeight ? root.maxHeight / 3 : root.maxWidth / 3 property real xPos: 0 property real yPos: root.isUnpin ? 0 : JamiTheme.chatViewHeaderPreferredHeight - states: [ State { + states: [ + State { name: "unpin" - ParentChange { target: mapObject; parent: parentUnPin; x:0; y:0 } + ParentChange { + target: mapObject + parent: parentUnPin + x: 0 + y: 0 + } }, State { name: "pin" - ParentChange { target: mapObject; parent: parentPin; x:xPos; y:JamiTheme.chatViewHeaderPreferredHeight } + ParentChange { + target: mapObject + parent: parentPin + x: xPos + y: JamiTheme.chatViewHeaderPreferredHeight + } } ] property alias webView: webView @@ -136,11 +136,10 @@ Item { layer.enabled: !isFullScreen layer.effect: OpacityMask { - maskSource: - Rectangle { - width: webView.width - height: webView.height - radius: 10 + maskSource: Rectangle { + width: webView.width + height: webView.height + radius: 10 } } @@ -152,87 +151,84 @@ Item { property string mapJs: "../../webengine/map/map.js" property string olJs: "../../webengine/map/ol.js" property bool isLoaded: false - property var positionList: PositionManager.positionList; - property var avatarPositionList: PositionManager.avatarPositionList; + property var positionList: PositionManager.positionList + property var avatarPositionList: PositionManager.avatarPositionList - function loadScripts () { + function loadScripts() { var scriptMapJs = { - sourceUrl: Qt.resolvedUrl(mapJs), - injectionPoint: WebEngineScript.DocumentReady, - worldId: WebEngineScript.MainWorld - } - + "sourceUrl": Qt.resolvedUrl(mapJs), + "injectionPoint": WebEngineScript.DocumentReady, + "worldId": WebEngineScript.MainWorld + }; var scriptOlJs = { - sourceUrl: Qt.resolvedUrl(olJs), - injectionPoint: WebEngineScript.DocumentReady, - worldId: WebEngineScript.MainWorld - } - - userScripts.collection = [ scriptOlJs, scriptMapJs ] + "sourceUrl": Qt.resolvedUrl(olJs), + "injectionPoint": WebEngineScript.DocumentReady, + "worldId": WebEngineScript.MainWorld + }; + userScripts.collection = [scriptOlJs, scriptMapJs]; } Connections { target: PositionManager function onPositionShareAdded(shareInfo) { - if(webView.isLoaded) { + if (webView.isLoaded) { if (shareInfo.account === attachedAccountId) { - var curLong = shareInfo.long - var curLat = shareInfo.lat - webView.runJavaScript("newPosition([" + curLong + "," + curLat + "], '" + - shareInfo.author + "', '" + shareInfo.avatar + "', '" + shareInfo.authorName + "' )" ); - webView.runJavaScript("zoomTolayersExtent()" ); + var curLong = shareInfo.long; + var curLat = shareInfo.lat; + webView.runJavaScript("newPosition([" + curLong + "," + curLat + "], '" + shareInfo.author + "', '" + shareInfo.avatar + "', '" + shareInfo.authorName + "' )"); + webView.runJavaScript("zoomTolayersExtent()"); } } } function onPositionShareUpdated(shareInfo) { - if(webView.isLoaded) { + if (webView.isLoaded) { if (shareInfo.account === attachedAccountId) { - var curLong = shareInfo.long - var curLat = shareInfo.lat - webView.runJavaScript("updatePosition([" + curLong + "," + curLat + "], '" + shareInfo.author + "' )" ); + var curLong = shareInfo.long; + var curLat = shareInfo.lat; + webView.runJavaScript("updatePosition([" + curLong + "," + curLat + "], '" + shareInfo.author + "' )"); } } } function onPositionShareRemoved(author, accountId) { - if(webView.isLoaded) { + if (webView.isLoaded) { if (accountId === attachedAccountId) { - webView.runJavaScript("removePosition( '" + author + "' )" ); - webView.runJavaScript("zoomTolayersExtent()" ); + webView.runJavaScript("removePosition( '" + author + "' )"); + webView.runJavaScript("zoomTolayersExtent()"); } } } } Component.onCompleted: { - loadHtml(UtilsAdapter.qStringFromFile(mapHtml), mapHtml) - loadScripts() + loadHtml(UtilsAdapter.qStringFromFile(mapHtml), mapHtml); + loadScripts(); } onLoadingChanged: function (loadingInfo) { if (loadingInfo.status === WebEngineView.LoadSucceededStatus) { - attachedAccountId = CurrentAccount.id - runJavaScript(UtilsAdapter.getStyleSheet("olcss",UtilsAdapter.qStringFromFile(olCss))) - webView.isLoaded = true - webView.runJavaScript("setMapView([" + 0 + ","+ 0 + "], " + 1 + " );" ); - PositionManager.startPositioning() + attachedAccountId = CurrentAccount.id; + runJavaScript(UtilsAdapter.getStyleSheet("olcss", UtilsAdapter.qStringFromFile(olCss))); + webView.isLoaded = true; + webView.runJavaScript("setMapView([" + 0 + "," + 0 + "], " + 1 + " );"); + PositionManager.startPositioning(); //load locations that were received before this conversation was opened PositionManager.loadPreviousLocations(attachedAccountId); - isSharingToCurrentConversation = PositionManager.isPositionSharedToConv(attachedAccountId, currentConvId) + isSharingToCurrentConversation = PositionManager.isPositionSharedToConv(attachedAccountId, currentConvId); } } } - MapPositionSharingControl {} + MapPositionSharingControl { + } - MapPositionOverlay {} + MapPositionOverlay { + } StopSharingPositionPopup { id: stopSharingPositionPopup - } } } } - diff --git a/src/app/webengine/map/MapPositionOverlay.qml b/src/app/webengine/map/MapPositionOverlay.qml index 8394f9fdf24f552ecf51cd608b33d937568249ba..ec2302b6c59e0de96a7d5e1aa56b193e9d5310fe 100644 --- a/src/app/webengine/map/MapPositionOverlay.qml +++ b/src/app/webengine/map/MapPositionOverlay.qml @@ -15,13 +15,10 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts - import net.jami.Constants 1.1 import net.jami.Adapters 1.1 - import "../../commoncomponents" Rectangle { @@ -49,9 +46,9 @@ Rectangle { source: JamiResources.unpin_svg onClicked: { if (!isUnpin) { - PositionManager.unPinMap(attachedAccountId) + PositionManager.unPinMap(attachedAccountId); } else { - PositionManager.pinMap(attachedAccountId) + PositionManager.pinMap(attachedAccountId); } } } @@ -64,7 +61,7 @@ Rectangle { normalColor: JamiTheme.transparentColor source: JamiResources.share_location_svg onClicked: { - webView.runJavaScript("zoomTolayersExtent()" ); + webView.runJavaScript("zoomTolayersExtent()"); } } @@ -91,19 +88,16 @@ Rectangle { id: btnMaximise visible: !isUnpin - toolTipText: mapObject.isFullScreen - ? JamiStrings.reduceMapTooltip - : JamiStrings.maximizeMapTooltip + toolTipText: mapObject.isFullScreen ? JamiStrings.reduceMapTooltip : JamiStrings.maximizeMapTooltip imageColor: JamiTheme.mapButtonColor normalColor: JamiTheme.transparentColor - source: mapObject.isFullScreen? JamiResources.close_fullscreen_24dp_svg : JamiResources.open_in_full_24dp_svg + source: mapObject.isFullScreen ? JamiResources.close_fullscreen_24dp_svg : JamiResources.open_in_full_24dp_svg onClicked: { if (!mapObject.isFullScreen) { - mapObject.x = mapObject.xPos - mapObject.y = mapObject.yPos + mapObject.x = mapObject.xPos; + mapObject.y = mapObject.yPos; } - - mapObject.isFullScreen = !mapObject.isFullScreen + mapObject.isFullScreen = !mapObject.isFullScreen; } } @@ -117,8 +111,8 @@ Rectangle { visible: !isUnpin onClicked: { - PositionManager.setMapInactive(attachedAccountId) - PositionManager.mapAutoOpening = false + PositionManager.setMapInactive(attachedAccountId); + PositionManager.mapAutoOpening = false; } } } diff --git a/src/app/webengine/map/MapPositionSharingControl.qml b/src/app/webengine/map/MapPositionSharingControl.qml index 22d2efe7ea00c93f46f3bd66e2294b0696672d47..7e3b972be0ee9c17a57a660567bbc226c4619158 100644 --- a/src/app/webengine/map/MapPositionSharingControl.qml +++ b/src/app/webengine/map/MapPositionSharingControl.qml @@ -17,11 +17,9 @@ */ import QtQuick import QtQuick.Layouts - import net.jami.Constants 1.1 import net.jami.Adapters 1.1 import net.jami.Enums 1.1 - import "../../commoncomponents" ColumnLayout { @@ -50,23 +48,22 @@ ColumnLayout { function standartCountdown(seconds) { var minutes = Math.floor(seconds / 60); - var hour = Math.floor(minutes / 60) - minutes = minutes % 60 - var sec = seconds % 60 + var hour = Math.floor(minutes / 60); + minutes = minutes % 60; + var sec = seconds % 60; if (hour) { if (minutes) - return qsTr("%1h%2min").arg(hour).arg(minutes) + return qsTr("%1h%2min").arg(hour).arg(minutes); else - return qsTr("%1h").arg(hour) + return qsTr("%1h").arg(hour); } if (minutes) { if (sec) - return qsTr("%1m%2sec").arg(minutes).arg(sec) + return qsTr("%1m%2sec").arg(minutes).arg(sec); else - return qsTr("%1m").arg(minutes) - + return qsTr("%1m").arg(minutes); } - return qsTr("%1sec").arg(sec) + return qsTr("%1sec").arg(sec); } property int remainingTimeMs: 0 @@ -74,7 +71,7 @@ ColumnLayout { target: PositionManager function onSendCountdownUpdate(key, remainingTime) { if (key === attachedAccountId + "_" + currentConvId) { - textTimer.remainingTimeMs = remainingTime + textTimer.remainingTimeMs = remainingTime; } } } @@ -97,15 +94,9 @@ ColumnLayout { visible: !isSharingToCurrentConversation && !isUnpin && webView.isLoaded text: JamiStrings.shareLocation - color: isError - ? JamiTheme.buttonTintedGreyInactive - : JamiTheme.buttonTintedBlue - hoveredColor: isError - ? JamiTheme.buttonTintedGreyInactive - : JamiTheme.buttonTintedBlueHovered - pressedColor: isError - ? JamiTheme.buttonTintedGreyInactive - : JamiTheme.buttonTintedBluePressed + color: isError ? JamiTheme.buttonTintedGreyInactive : JamiTheme.buttonTintedBlue + hoveredColor: isError ? JamiTheme.buttonTintedGreyInactive : JamiTheme.buttonTintedBlueHovered + pressedColor: isError ? JamiTheme.buttonTintedGreyInactive : JamiTheme.buttonTintedBluePressed Layout.alignment: Qt.AlignHCenter property bool isHovered: false property string positioningError: "default" @@ -116,41 +107,39 @@ ColumnLayout { function errorString(posError) { if (posError === "locationServicesError") - return JamiStrings.locationServicesError - return JamiStrings.locationServicesClosedError + return JamiStrings.locationServicesError; + return JamiStrings.locationServicesClosedError; } onPositionShareConvIdsCountChanged: { - isSharingToCurrentConversation = PositionManager.isPositionSharedToConv(attachedAccountId, currentConvId) + isSharingToCurrentConversation = PositionManager.isPositionSharedToConv(attachedAccountId, currentConvId); } onCurrentConvIdChanged: { - isSharingToCurrentConversation = PositionManager.isPositionSharedToConv(attachedAccountId, currentConvId) + isSharingToCurrentConversation = PositionManager.isPositionSharedToConv(attachedAccountId, currentConvId); } onIsMapUnpinChanged: { - isSharingToCurrentConversation = PositionManager.isPositionSharedToConv(attachedAccountId, currentConvId) + isSharingToCurrentConversation = PositionManager.isPositionSharedToConv(attachedAccountId, currentConvId); } onClicked: { - var sharingDuration = 60 * 1000 * UtilsAdapter.getAppValue(Settings.PositionShareDuration) + var sharingDuration = 60 * 1000 * UtilsAdapter.getAppValue(Settings.PositionShareDuration); if (!isError && !isUnpin) { PositionManager.sharePosition(sharingDuration, attachedAccountId, currentConvId); } - webView.runJavaScript("zoomTolayersExtent()" ); + webView.runJavaScript("zoomTolayersExtent()"); } MaterialToolTip { property bool isSharingPossible: !(sharePositionButton.isError && (sharePositionButton.positioningError !== "default")) visible: sharePositionButton.hovered - text: isSharingPossible - ? JamiStrings.shareLocationToolTip.arg(PositionManager.getmapTitle(attachedAccountId, currentConvId)) - : sharePositionButton.errorString(sharePositionButton.positioningError) + text: isSharingPossible ? JamiStrings.shareLocationToolTip.arg(PositionManager.getmapTitle(attachedAccountId, currentConvId)) : sharePositionButton.errorString(sharePositionButton.positioningError) } Connections { target: PositionManager - function onPositioningError (err) { + function onPositioningError(err) { sharePositionButton.positioningError = err; } } @@ -164,24 +153,12 @@ ColumnLayout { textRightPadding: JamiTheme.buttontextPadding primary: true visible: isSharing - text: stopAllSharing - ? JamiStrings.shortStopAllSharings - : JamiStrings.stopSharingLocation - color: isError - ? JamiTheme.buttonTintedGreyInactive - : JamiTheme.buttonTintedRed - hoveredColor: isError - ? JamiTheme.buttonTintedGreyInactive - : JamiTheme.buttonTintedRedHovered - pressedColor: isError - ? JamiTheme.buttonTintedGreyInactive - : JamiTheme.buttonTintedRedPressed + text: stopAllSharing ? JamiStrings.shortStopAllSharings : JamiStrings.stopSharingLocation + color: isError ? JamiTheme.buttonTintedGreyInactive : JamiTheme.buttonTintedRed + hoveredColor: isError ? JamiTheme.buttonTintedGreyInactive : JamiTheme.buttonTintedRedHovered + pressedColor: isError ? JamiTheme.buttonTintedGreyInactive : JamiTheme.buttonTintedRedPressed Layout.alignment: Qt.AlignHCenter - toolTipText: stopAllSharing - ? isUnpin - ? JamiStrings.unpinStopSharingTooltip - : JamiStrings.stopAllSharings - : JamiStrings.stopSharingSeveralConversationTooltip + toolTipText: stopAllSharing ? isUnpin ? JamiStrings.unpinStopSharingTooltip : JamiStrings.stopAllSharings : JamiStrings.stopSharingSeveralConversationTooltip property bool isHovered: false property string positioningError property bool isError: positioningError.length @@ -191,7 +168,7 @@ ColumnLayout { if (stopAllSharing) { PositionManager.stopSharingPosition(); } else { - stopSharingPositionPopup.open() + stopSharingPositionPopup.open(); } } } diff --git a/src/app/webengine/map/StopSharingPositionPopup.qml b/src/app/webengine/map/StopSharingPositionPopup.qml index 6b06b120868a7bc70fae34b666fabaedcb606f49..4f8ddf90d72ad77d1f79b3987a86c614a64ff59a 100644 --- a/src/app/webengine/map/StopSharingPositionPopup.qml +++ b/src/app/webengine/map/StopSharingPositionPopup.qml @@ -15,16 +15,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts import QtQuick.Controls import Qt5Compat.GraphicalEffects - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" Popup { @@ -41,11 +38,11 @@ Popup { signal joinClicked - modal:true + modal: true padding: 0 visible: false - closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside + closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside Rectangle { id: container @@ -54,7 +51,7 @@ Popup { color: JamiTheme.secondaryBackgroundColor ColumnLayout { - id: popupContent + id: popupContent Layout.alignment: Qt.AlignCenter @@ -65,13 +62,15 @@ Popup { width: 30 height: 30 imageContainerWidth: 30 - imageContainerHeight : 30 + imageContainerHeight: 30 Layout.margins: 8 - radius : 5 + radius: 5 imageColor: "grey" normalColor: JamiTheme.transparentColor source: JamiResources.round_close_24dp_svg - onClicked: { root.visible = false } + onClicked: { + root.visible = false; + } } Text { @@ -88,7 +87,7 @@ Popup { text: JamiStrings.stopSharingPopupBody } - RowLayout{ + RowLayout { Layout.margins: JamiTheme.popupButtonsMargin Layout.alignment: Qt.AlignCenter @@ -103,8 +102,8 @@ Popup { text: JamiStrings.stopConvSharing.arg(PositionManager.getmapTitle(attachedAccountId, CurrentConversation.id)) onClicked: { - PositionManager.stopSharingPosition(attachedAccountId, CurrentConversation.id) - root.close() + PositionManager.stopSharingPosition(attachedAccountId, CurrentConversation.id); + root.close(); } } @@ -120,8 +119,8 @@ Popup { text: JamiStrings.stopAllSharings onClicked: { - PositionManager.stopSharingPosition() - root.close() + PositionManager.stopSharingPosition(); + root.close(); } } } @@ -135,7 +134,7 @@ Popup { Overlay.modal: Rectangle { color: JamiTheme.transparentColor // Color animation for overlay when pop up is shown. - ColorAnimation on color { + ColorAnimation on color { to: JamiTheme.popupOverlayColor duration: 500 } @@ -155,14 +154,18 @@ Popup { enter: Transition { NumberAnimation { - properties: "opacity"; from: 0.0; to: 1.0 + properties: "opacity" + from: 0.0 + to: 1.0 duration: JamiTheme.shortFadeDuration } } exit: Transition { NumberAnimation { - properties: "opacity"; from: 1.0; to: 0.0 + properties: "opacity" + from: 1.0 + to: 0.0 duration: JamiTheme.shortFadeDuration } } diff --git a/src/app/wizardview/WizardView.qml b/src/app/wizardview/WizardView.qml index b3e012fd4568ae1fecaece2184b2f7766f8a2706..d0651434fe66da0d91632acde641b942a7ef4003 100644 --- a/src/app/wizardview/WizardView.qml +++ b/src/app/wizardview/WizardView.qml @@ -16,16 +16,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Controls import QtQuick.Layouts - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 import net.jami.Enums 1.1 - import "../" import "../commoncomponents" import "components" @@ -41,17 +38,16 @@ BaseView { color: JamiTheme.backgroundColor - Connections{ + Connections { target: AccountAdapter // reportFailure function onReportFailure() { - var errorMessage = JamiStrings.errorCreateAccount - + var errorMessage = JamiStrings.errorCreateAccount; for (var i = 0; i < controlPanelStackView.children.length; i++) { if (i === controlPanelStackView.currentIndex) { - controlPanelStackView.children[i].errorOccured(errorMessage) - return + controlPanelStackView.children[i].errorOccured(errorMessage); + return; } } } @@ -61,8 +57,8 @@ BaseView { target: WizardViewStepModel function onCloseWizardView() { - loaderSourceChangeRequested(MainApplicationWindow.LoadedSource.MainView) - root.dismiss() + loaderSourceChangeRequested(MainApplicationWindow.LoadedSource.MainView); + root.dismiss(); } } @@ -81,11 +77,11 @@ BaseView { objectName: "controlPanelStackView" function setPage(obj) { - wizardViewScrollView.vScrollBar.position = 0 + wizardViewScrollView.vScrollBar.position = 0; for (var i in this.children) { if (this.children[i] === obj) { - currentIndex = i - return + currentIndex = i; + return; } } } @@ -144,14 +140,10 @@ BaseView { Component.onCompleted: { // avoid binding loop - height = Qt.binding(function (){ - var index = currentIndex - === WizardViewStepModel.MainSteps.CreateRendezVous ? - WizardViewStepModel.MainSteps.CreateJamiAccount : currentIndex - return Math.max( - controlPanelStackView.itemAt(index).preferredHeight, - wizardViewScrollView.height) - }) + height = Qt.binding(function () { + var index = currentIndex === WizardViewStepModel.MainSteps.CreateRendezVous ? WizardViewStepModel.MainSteps.CreateJamiAccount : currentIndex; + return Math.max(controlPanelStackView.itemAt(index).preferredHeight, wizardViewScrollView.height); + }); } } } diff --git a/src/app/wizardview/components/AccountCreationStepIndicator.qml b/src/app/wizardview/components/AccountCreationStepIndicator.qml index 6991eb757c5e0401f71a9d12c95b67468bfbdfec..0ba3c7d2cc0f93c5b1c540eb0378b3097e85cd05 100644 --- a/src/app/wizardview/components/AccountCreationStepIndicator.qml +++ b/src/app/wizardview/components/AccountCreationStepIndicator.qml @@ -15,11 +15,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick - import net.jami.Constants 1.1 - import "../../commoncomponents" Row { @@ -34,8 +31,8 @@ Row { Rectangle { color: { if (modelData === currentStep - 1) - return JamiTheme.accountCreationCurrentStepColor - return JamiTheme.accountCreationOtherStepColor + return JamiTheme.accountCreationCurrentStepColor; + return JamiTheme.accountCreationOtherStepColor; } radius: height / 2 implicitHeight: 12 diff --git a/src/app/wizardview/components/AdvancedAccountSettings.qml b/src/app/wizardview/components/AdvancedAccountSettings.qml index a9995d3d9e6c274bd4a2a588c0f57f26749818ea..adff349fb0a5a1852d61923d0cecfc435fada3c6 100644 --- a/src/app/wizardview/components/AdvancedAccountSettings.qml +++ b/src/app/wizardview/components/AdvancedAccountSettings.qml @@ -15,20 +15,16 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts import QtQuick.Controls - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 import Qt5Compat.GraphicalEffects - import "../../commoncomponents" Rectangle { - id: root signal saveButtonClicked @@ -43,14 +39,13 @@ Rectangle { opacity: 0.93 function clear() { - openedPassword = false - openedNickname = false - passwordEdit.dynamicText = "" - passwordConfirmEdit.dynamicText = "" - UtilsAdapter.setTempCreationImageFromString() + openedPassword = false; + openedNickname = false; + passwordEdit.dynamicText = ""; + passwordConfirmEdit.dynamicText = ""; + UtilsAdapter.setTempCreationImageFromString(); } - JamiFlickable { id: scrollView @@ -58,9 +53,9 @@ Rectangle { anchors.fill: parent onClicked: { - openedPassword = false - openedNickname = false - adviceBox.checked = false + openedPassword = false; + openedNickname = false; + adviceBox.checked = false; } } @@ -95,30 +90,33 @@ Rectangle { Layout.preferredWidth: { if (root.openedPassword) - return Math.min(settings.width, JamiTheme.passwordEditOpenedBoxWidth) + return Math.min(settings.width, JamiTheme.passwordEditOpenedBoxWidth); if (root.openedNickname) - return Math.min(settings.width, cornerIcon1.width) - return Math.min(settings.width, JamiTheme.passwordEditClosedBoxWidth) + return Math.min(settings.width, cornerIcon1.width); + return Math.min(settings.width, JamiTheme.passwordEditClosedBoxWidth); } Layout.preferredHeight: { if (root.openedPassword) - return passwordColumnLayout.implicitHeight - return Math.max(cornerIcon1.height, labelEncrypt.height + 2*JamiTheme.advancedAccountSettingsHeightMargin) + return passwordColumnLayout.implicitHeight; + return Math.max(cornerIcon1.height, labelEncrypt.height + 2 * JamiTheme.advancedAccountSettingsHeightMargin); } - - Behavior on Layout.preferredWidth { - NumberAnimation { duration: 100 } + Behavior on Layout.preferredWidth { + NumberAnimation { + duration: 100 + } } - Behavior on Layout.preferredHeight { - NumberAnimation { duration: 100 } + Behavior on Layout.preferredHeight { + NumberAnimation { + duration: 100 + } } Rectangle { id: bg radius: JamiTheme.formsRadius - border.color: openedPassword? JamiTheme.transparentColor : JamiTheme.lightBlue_ + border.color: openedPassword ? JamiTheme.transparentColor : JamiTheme.lightBlue_ layer.enabled: true color: root.icon1Hovered ? JamiTheme.buttonTintedBlue : JamiTheme.secAndTertiHoveredBackgroundColor anchors.fill: parent @@ -126,22 +124,21 @@ Rectangle { Rectangle { layer.enabled: true - height: parent.height /2 - width: parent.width /2 + height: parent.height / 2 + width: parent.width / 2 anchors.bottom: parent.bottom anchors.left: parent.left - border.color: openedPassword? JamiTheme.transparentColor : JamiTheme.lightBlue_ + border.color: openedPassword ? JamiTheme.transparentColor : JamiTheme.lightBlue_ color: root.icon1Hovered ? JamiTheme.buttonTintedBlue : JamiTheme.secAndTertiHoveredBackgroundColor Rectangle { - height: parent.height + height: parent.height width: parent.width anchors.bottom: parent.bottom anchors.left: parent.left anchors.margins: 1 color: root.icon1Hovered ? JamiTheme.buttonTintedBlue : JamiTheme.secAndTertiHoveredBackgroundColor - } } @@ -182,7 +179,6 @@ Rectangle { } PasswordTextEdit { - id: passwordEdit visible: openedPassword @@ -201,7 +197,6 @@ Rectangle { } PasswordTextEdit { - id: passwordConfirmEdit visible: openedPassword placeholderText: JamiStrings.confirmPassword @@ -237,7 +232,7 @@ Rectangle { MaterialButton { id: setButton - TextMetrics{ + TextMetrics { id: setButtonTextSize font.weight: Font.Bold font.pixelSize: JamiTheme.wizardViewDescriptionFontPixelSize @@ -248,27 +243,25 @@ Rectangle { Layout.topMargin: 10 Layout.alignment: Qt.AlignCenter - preferredWidth: setButtonTextSize.width + 2*JamiTheme.buttontextWizzardPadding + preferredWidth: setButtonTextSize.width + 2 * JamiTheme.buttontextWizzardPadding text: JamiStrings.setPassword primary: true hoveredColor: checkEnable() ? JamiTheme.buttonTintedBlueHovered : JamiTheme.buttonTintedGreyInactive pressedColor: checkEnable() ? JamiTheme.buttonTintedBluePressed : JamiTheme.buttonTintedGreyInactive - color: checkEnable() ? JamiTheme.buttonTintedBlue : - JamiTheme.buttonTintedGreyInactive + color: checkEnable() ? JamiTheme.buttonTintedBlue : JamiTheme.buttonTintedGreyInactive enabled: checkEnable() function checkEnable() { - text = JamiStrings.setPassword - return (passwordEdit.dynamicText === passwordConfirmEdit.dynamicText - && passwordEdit.dynamicText.length !== 0) + text = JamiStrings.setPassword; + return (passwordEdit.dynamicText === passwordConfirmEdit.dynamicText && passwordEdit.dynamicText.length !== 0); } onClicked: { - root.validatedPassword = passwordConfirmEdit.dynamicText - text = JamiStrings.setPasswordSuccess + root.validatedPassword = passwordConfirmEdit.dynamicText; + text = JamiStrings.setPasswordSuccess; } } @@ -278,7 +271,6 @@ Rectangle { Layout.preferredWidth: parent.width Rectangle { - id: cornerIcon1 layer.enabled: true @@ -287,31 +279,28 @@ Rectangle { height: JamiTheme.cornerIconSize width: JamiTheme.cornerIconSize - - color: openedPassword ? JamiTheme.buttonTintedBlue : JamiTheme.transparentColor + color: openedPassword ? JamiTheme.buttonTintedBlue : JamiTheme.transparentColor Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft - Layout.leftMargin: openedPassword ? 2 : openedNickname ? 0 : 20 + Layout.leftMargin: openedPassword ? 2 : openedNickname ? 0 : 20 Layout.bottomMargin: openedPassword ? 2 : 0 Rectangle { visible: openedPassword - height: cornerIcon1.height/2 - width: cornerIcon1.width/2 + height: cornerIcon1.height / 2 + width: cornerIcon1.width / 2 anchors.left: cornerIcon1.left anchors.bottom: cornerIcon1.bottom color: JamiTheme.buttonTintedBlue - } - ResponsiveImage { + ResponsiveImage { width: 18 height: 18 source: JamiResources.lock_svg - color: root.icon1Hovered ? JamiTheme.primaryTextColor - : openedPassword ? JamiTheme.primaryTextColor : JamiTheme.buttonTintedBlue + color: root.icon1Hovered ? JamiTheme.primaryTextColor : openedPassword ? JamiTheme.primaryTextColor : JamiTheme.buttonTintedBlue anchors.centerIn: cornerIcon1 } } @@ -326,7 +315,6 @@ Rectangle { wrapMode: Text.WordWrap color: root.icon1Hovered ? JamiTheme.primaryTextColor : JamiTheme.textColor font.pixelSize: JamiTheme.creditsTextSize - } } } @@ -334,8 +322,8 @@ Rectangle { TapHandler { target: passwordColumnLayout onTapped: { - openedNickname = false - openedPassword = true + openedNickname = false; + openedPassword = true; } } @@ -343,37 +331,39 @@ Rectangle { target: passwordColumnLayout enabled: !openedPassword onHoveredChanged: { - root.icon1Hovered = hovered + root.icon1Hovered = hovered; } } } } - - Item { Layout.alignment: Qt.AlignRight | Qt.AlignTop - Behavior on Layout.preferredWidth { - NumberAnimation { duration: 100 } + Behavior on Layout.preferredWidth { + NumberAnimation { + duration: 100 + } } - Behavior on Layout.preferredHeight { - NumberAnimation { duration: 100 } + Behavior on Layout.preferredHeight { + NumberAnimation { + duration: 100 + } } Layout.preferredWidth: { if (openedNickname) - return Math.min(settings.width, JamiTheme.customNicknameOpenedBoxWidth) + return Math.min(settings.width, JamiTheme.customNicknameOpenedBoxWidth); if (openedPassword) - return Math.min(settings.width, cornerIcon1.width) - return Math.min(settings.width, JamiTheme.customNicknameClosedBoxWidth) + return Math.min(settings.width, cornerIcon1.width); + return Math.min(settings.width, JamiTheme.customNicknameClosedBoxWidth); } Layout.preferredHeight: { if (openedNickname) - return customColumnLayout.implicitHeight - return Math.max(cornerIcon2.height, labelCustomize.height + 2*JamiTheme.advancedAccountSettingsHeightMargin) + return customColumnLayout.implicitHeight; + return Math.max(cornerIcon2.height, labelCustomize.height + 2 * JamiTheme.advancedAccountSettingsHeightMargin); } Rectangle { @@ -387,8 +377,8 @@ Rectangle { Rectangle { - height: parent.height /2 - width: parent.width /2 + height: parent.height / 2 + width: parent.width / 2 anchors.bottom: parent.bottom anchors.right: parent.right border.color: openedNickname ? JamiTheme.transparentColor : JamiTheme.lightBlue_ @@ -404,17 +394,13 @@ Rectangle { anchors.right: parent.right anchors.margins: 1 color: root.icon2Hovered ? JamiTheme.buttonTintedBlue : JamiTheme.secAndTertiHoveredBackgroundColor - } - } ColumnLayout { - id: customColumnLayout anchors.fill: parent - Text { visible: openedNickname @@ -444,7 +430,7 @@ Rectangle { Layout.leftMargin: JamiTheme.cornerIconSize newItem: true - imageId: visible? "temp" : "" + imageId: visible ? "temp" : "" avatarSize: 80 } @@ -463,8 +449,6 @@ Rectangle { } } - - Text { visible: openedNickname @@ -482,14 +466,12 @@ Rectangle { lineHeight: JamiTheme.wizardViewTextLineHeight } - RowLayout{ + RowLayout { Layout.alignment: openedNickname ? Qt.AlignRight : Qt.AlignLeft Layout.preferredWidth: parent.width - Rectangle { - id: cornerIcon2 layer.enabled: true @@ -498,28 +480,27 @@ Rectangle { height: JamiTheme.cornerIconSize width: JamiTheme.cornerIconSize - color: openedNickname ? JamiTheme.buttonTintedBlue : JamiTheme.transparentColor + color: openedNickname ? JamiTheme.buttonTintedBlue : JamiTheme.transparentColor Layout.alignment: Qt.AlignVCenter | Qt.AlignRight Layout.leftMargin: openedPassword ? 0 : 20 - Layout.rightMargin: openedNickname ? 2 : 0 + Layout.rightMargin: openedNickname ? 2 : 0 Layout.bottomMargin: openedNickname ? 2 : 0 Rectangle { visible: openedNickname - height: cornerIcon2.height/2 - width: cornerIcon2.width/2 + height: cornerIcon2.height / 2 + width: cornerIcon2.width / 2 anchors.right: cornerIcon2.right anchors.bottom: cornerIcon2.bottom color: JamiTheme.buttonTintedBlue } - ResponsiveImage { + ResponsiveImage { width: 18 height: 18 source: JamiResources.noun_paint_svg - color: root.icon2Hovered ? JamiTheme.primaryTextColor - : openedNickname ? JamiTheme.primaryTextColor : JamiTheme.buttonTintedBlue + color: root.icon2Hovered ? JamiTheme.primaryTextColor : openedNickname ? JamiTheme.primaryTextColor : JamiTheme.buttonTintedBlue anchors.centerIn: cornerIcon2 } } @@ -541,8 +522,8 @@ Rectangle { TapHandler { target: customColumnLayout onTapped: { - openedNickname = true - openedPassword = false + openedNickname = true; + openedPassword = false; } } @@ -550,7 +531,7 @@ Rectangle { target: customColumnLayout enabled: !openedNickname onHoveredChanged: { - root.icon2Hovered = hovered + root.icon2Hovered = hovered; } } } @@ -559,7 +540,7 @@ Rectangle { MaterialButton { id: showAdvancedButton - TextMetrics{ + TextMetrics { id: showAdvancedButtonTextSize font.weight: Font.Bold font.pixelSize: JamiTheme.wizardViewDescriptionFontPixelSize @@ -571,17 +552,15 @@ Rectangle { Layout.bottomMargin: JamiTheme.wizardViewPageBackButtonMargins Layout.topMargin: JamiTheme.wizardViewBlocMarginSize - preferredWidth: showAdvancedButtonTextSize.width + 2*JamiTheme.buttontextWizzardPadding + 1 + preferredWidth: showAdvancedButtonTextSize.width + 2 * JamiTheme.buttontextWizzardPadding + 1 text: JamiStrings.optionSave onClicked: { - root.saveButtonClicked() - root.alias = displayNameLineEdit.dynamicText + root.saveButtonClicked(); + root.alias = displayNameLineEdit.dynamicText; } } } - } } - } diff --git a/src/app/wizardview/components/ConnectToAccountManagerPage.qml b/src/app/wizardview/components/ConnectToAccountManagerPage.qml index a833ad91cf8f5c8ec0be29543584ab9227dd397a..0f8848376f705f72a246ad6ee476810b09b97399 100644 --- a/src/app/wizardview/components/ConnectToAccountManagerPage.qml +++ b/src/app/wizardview/components/ConnectToAccountManagerPage.qml @@ -16,14 +16,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts import QtQuick.Controls - import net.jami.Models 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" Rectangle { @@ -35,24 +32,22 @@ Rectangle { signal showThisPage function clearAllTextFields() { - connectBtn.spinnerTriggered = false - errorText = "" + connectBtn.spinnerTriggered = false; + errorText = ""; } function errorOccured(errorMessage) { - connectBtn.spinnerTriggered = false - errorText = errorMessage + connectBtn.spinnerTriggered = false; + errorText = errorMessage; } Connections { target: WizardViewStepModel function onMainStepChanged() { - if (WizardViewStepModel.mainStep === WizardViewStepModel.MainSteps.AccountCreation && - WizardViewStepModel.accountCreationOption === - WizardViewStepModel.AccountCreationOption.ConnectToAccountManager) { - clearAllTextFields() - root.showThisPage() + if (WizardViewStepModel.mainStep === WizardViewStepModel.MainSteps.AccountCreation && WizardViewStepModel.accountCreationOption === WizardViewStepModel.AccountCreationOption.ConnectToAccountManager) { + clearAllTextFields(); + root.showThisPage(); } } } @@ -78,8 +73,7 @@ Rectangle { color: JamiTheme.textColor font.pixelSize: JamiTheme.wizardViewTitleFontPixelSize - wrapMode : Text.WordWrap - + wrapMode: Text.WordWrap } Text { @@ -95,7 +89,7 @@ Rectangle { color: JamiTheme.textColor font.pixelSize: JamiTheme.wizardViewDescriptionFontPixelSize - wrapMode : Text.WordWrap + wrapMode: Text.WordWrap } ModalTextEdit { @@ -133,11 +127,9 @@ Rectangle { color: JamiTheme.textColor wrapMode: Text.Wrap - } ModalTextEdit { - id: usernameManagerEdit objectName: "usernameManagerEdit" @@ -156,7 +148,6 @@ Rectangle { } PasswordTextEdit { - id: passwordManagerEdit objectName: "passwordManagerEdit" @@ -172,13 +163,12 @@ Rectangle { KeyNavigation.tab: KeyNavigation.down onAccepted: connectBtn.forceActiveFocus() - } SpinnerButton { id: connectBtn - TextMetrics{ + TextMetrics { id: textSize font.weight: Font.Bold font.pixelSize: JamiTheme.wizardViewDescriptionFontPixelSize @@ -191,15 +181,12 @@ Rectangle { Layout.topMargin: JamiTheme.wizardViewBlocMarginSize Layout.bottomMargin: errorLabel.visible ? 0 : JamiTheme.wizardViewPageBackButtonMargins - preferredWidth: textSize.width + 2*JamiTheme.buttontextWizzardPadding + preferredWidth: textSize.width + 2 * JamiTheme.buttontextWizzardPadding spinnerTriggeredtext: JamiStrings.creatingAccount normalText: JamiStrings.connect - enabled: accountManagerEdit.dynamicText.length !== 0 - && usernameManagerEdit.dynamicText.length !== 0 - && passwordManagerEdit.dynamicText.length !== 0 - && !spinnerTriggered + enabled: accountManagerEdit.dynamicText.length !== 0 && usernameManagerEdit.dynamicText.length !== 0 && passwordManagerEdit.dynamicText.length !== 0 && !spinnerTriggered primary: true @@ -207,18 +194,16 @@ Rectangle { KeyNavigation.down: backButton KeyNavigation.tab: KeyNavigation.down - onClicked: { if (connectBtn.focus) - accountManagerEdit.forceActiveFocus() - spinnerTriggered = true - - WizardViewStepModel.accountCreationInfo = - JamiQmlUtils.setUpAccountCreationInputPara( - {username : usernameManagerEdit.dynamicText, - password : passwordManagerEdit.dynamicText, - manager : accountManagerEdit.dynamicText}) - WizardViewStepModel.nextStep() + accountManagerEdit.forceActiveFocus(); + spinnerTriggered = true; + WizardViewStepModel.accountCreationInfo = JamiQmlUtils.setUpAccountCreationInputPara({ + "username": usernameManagerEdit.dynamicText, + "password": passwordManagerEdit.dynamicText, + "manager": accountManagerEdit.dynamicText + }); + WizardViewStepModel.nextStep(); } } @@ -249,11 +234,10 @@ Rectangle { preferredSize: JamiTheme.wizardViewPageBackButtonSize - KeyNavigation.up: { if (connectBtn.enabled) - return connectBtn - return passwordManagerEdit + return connectBtn; + return passwordManagerEdit; } KeyNavigation.down: accountManagerEdit KeyNavigation.tab: KeyNavigation.down diff --git a/src/app/wizardview/components/CreateAccountPage.qml b/src/app/wizardview/components/CreateAccountPage.qml index 7874f6ad30614f7a380ecfbfef7abe1f6dc72dce..6f7caf00d215d2b4d800323d09197b6a44a00ef9 100644 --- a/src/app/wizardview/components/CreateAccountPage.qml +++ b/src/app/wizardview/components/CreateAccountPage.qml @@ -16,16 +16,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts import QtQuick.Controls - import net.jami.Adapters 1.1 import net.jami.Constants 1.1 import net.jami.Models 1.1 import Qt5Compat.GraphicalEffects - import "../" import "../../commoncomponents" import "../../settingsview/components" @@ -40,17 +37,17 @@ Rectangle { signal showThisPage function initializeOnShowUp(isRdv) { - root.isRendezVous = isRdv - createAccountStack.currentIndex = 0 - clearAllTextFields() - usernameEdit.forceActiveFocus() + root.isRendezVous = isRdv; + createAccountStack.currentIndex = 0; + clearAllTextFields(); + usernameEdit.forceActiveFocus(); } function clearAllTextFields() { - chooseUsernameButton.enabled = true - showAdvancedButton.enabled = true - usernameEdit.dynamicText = "" - advancedAccountSettingsPage.clear() + chooseUsernameButton.enabled = true; + showAdvancedButton.enabled = true; + usernameEdit.dynamicText = ""; + advancedAccountSettingsPage.clear(); } color: JamiTheme.secondaryBackgroundColor @@ -59,12 +56,11 @@ Rectangle { target: WizardViewStepModel function onMainStepChanged() { - var currentMainStep = WizardViewStepModel.mainStep + var currentMainStep = WizardViewStepModel.mainStep; if (currentMainStep === WizardViewStepModel.MainSteps.NameRegistration) { - createAccountStack.currentIndex = nameRegistrationPage.stackIndex - initializeOnShowUp(WizardViewStepModel.accountCreationOption === - WizardViewStepModel.AccountCreationOption.CreateRendezVous) - root.showThisPage() + createAccountStack.currentIndex = nameRegistrationPage.stackIndex; + initializeOnShowUp(WizardViewStepModel.accountCreationOption === WizardViewStepModel.AccountCreationOption.CreateRendezVous); + root.showThisPage(); } } } @@ -73,8 +69,8 @@ Rectangle { anchors.fill: parent onClicked: { - infoBox.checked = false - adviceBox.checked = false + infoBox.checked = false; + adviceBox.checked = false; } } @@ -117,13 +113,12 @@ Rectangle { color: JamiTheme.textColor font.pixelSize: JamiTheme.wizardViewTitleFontPixelSize - wrapMode : Text.WordWrap + wrapMode: Text.WordWrap } Text { - text: root.isRendezVous ? JamiStrings.chooseUsernameForRV : - JamiStrings.chooseUsernameForAccount + text: root.isRendezVous ? JamiStrings.chooseUsernameForRV : JamiStrings.chooseUsernameForAccount Layout.alignment: Qt.AlignCenter Layout.topMargin: JamiTheme.wizardViewDescriptionMarginSize Layout.preferredWidth: Math.min(360, root.width - JamiTheme.preferredMarginSize * 2) @@ -140,9 +135,8 @@ Rectangle { id: usernameEdit icon: PushButton { - id: infoBox - z:1 + z: 1 normalColor: "transparent" imageColor: infoBox.checked ? JamiTheme.inviteHoverColor : JamiTheme.buttonTintedBlue @@ -150,14 +144,14 @@ Rectangle { pressedColor: JamiTheme.tintedBlue hoveredColor: JamiTheme.hoveredButtonColorWizard border.color: { - if(infoBox.checked){ - return "transparent" + if (infoBox.checked) { + return "transparent"; } - return JamiTheme.buttonTintedBlue + return JamiTheme.buttonTintedBlue; } checkable: true onCheckedChanged: { - textBoxinfo.visible = !textBoxinfo.visible + textBoxinfo.visible = !textBoxinfo.visible; } preferredSize: 20 @@ -173,12 +167,16 @@ Rectangle { visible: false - Behavior on width { - NumberAnimation { duration: JamiTheme.shortFadeDuration } + Behavior on width { + NumberAnimation { + duration: JamiTheme.shortFadeDuration + } } - Behavior on height { - NumberAnimation { duration: JamiTheme.shortFadeDuration} + Behavior on height { + NumberAnimation { + duration: JamiTheme.shortFadeDuration + } } DropShadow { @@ -193,7 +191,6 @@ Rectangle { } Rectangle { - id: boxInfo z: 1 @@ -215,7 +212,6 @@ Rectangle { font.pixelSize: JamiTheme.infoBoxDescFontSize lineHeight: JamiTheme.wizardViewTextLineHeight } - } } @@ -229,15 +225,13 @@ Rectangle { Layout.topMargin: JamiTheme.wizardViewBlocMarginSize Layout.alignment: Qt.AlignHCenter Layout.preferredWidth: Math.min(440, root.width - JamiTheme.preferredMarginSize * 2) - placeholderText: root.isRendezVous ? JamiStrings.chooseAName : - JamiStrings.chooseUsername + placeholderText: root.isRendezVous ? JamiStrings.chooseAName : JamiStrings.chooseUsername staticText: "" editMode: true KeyNavigation.tab: infoBox KeyNavigation.up: backButton KeyNavigation.down: infoBox - } Label { @@ -245,23 +239,21 @@ Rectangle { Layout.alignment: Qt.AlignHCenter | Qt.AlignTop Layout.topMargin: JamiTheme.wizardViewDescriptionMarginSize - visible: text.length !==0 + visible: text.length !== 0 Layout.preferredWidth: Math.min(440, root.width - JamiTheme.preferredMarginSize * 2) text: { - switch(usernameEdit.nameRegistrationState){ + switch (usernameEdit.nameRegistrationState) { case UsernameTextEdit.NameRegistrationState.BLANK: - return "" + return ""; case UsernameTextEdit.NameRegistrationState.SEARCHING: - return "" + return ""; case UsernameTextEdit.NameRegistrationState.FREE: - return "" + return ""; case UsernameTextEdit.NameRegistrationState.INVALID: - return root.isRendezVous ? JamiStrings.invalidName : - JamiStrings.invalidUsername + return root.isRendezVous ? JamiStrings.invalidName : JamiStrings.invalidUsername; case UsernameTextEdit.NameRegistrationState.TAKEN: - return root.isRendezVous ? JamiStrings.nameAlreadyTaken : - JamiStrings.usernameAlreadyTaken + return root.isRendezVous ? JamiStrings.nameAlreadyTaken : JamiStrings.usernameAlreadyTaken; } } font.pixelSize: JamiTheme.textEditError @@ -270,9 +262,9 @@ Rectangle { MaterialButton { id: chooseUsernameButton - z:-1 + z: -1 - TextMetrics{ + TextMetrics { id: textSize font.weight: Font.Bold font.pixelSize: JamiTheme.wizardViewButtonFontPixelSize @@ -285,38 +277,32 @@ Rectangle { Layout.alignment: Qt.AlignCenter Layout.topMargin: JamiTheme.wizardViewBlocMarginSize primary: true - preferredWidth: textSize.width + 2*JamiTheme.buttontextWizzardPadding + preferredWidth: textSize.width + 2 * JamiTheme.buttontextWizzardPadding font.capitalization: Font.AllUppercase - color: enabled? JamiTheme.buttonTintedBlue : JamiTheme.buttonTintedGrey - text: !enabled ? JamiStrings.creatingAccount : - root.isRendezVous ? JamiStrings.chooseName : JamiStrings.joinJami - enabled: usernameEdit.nameRegistrationState === UsernameTextEdit.NameRegistrationState.FREE - || usernameEdit.nameRegistrationState === UsernameTextEdit.NameRegistrationState.BLANK - + color: enabled ? JamiTheme.buttonTintedBlue : JamiTheme.buttonTintedGrey + text: !enabled ? JamiStrings.creatingAccount : root.isRendezVous ? JamiStrings.chooseName : JamiStrings.joinJami + enabled: usernameEdit.nameRegistrationState === UsernameTextEdit.NameRegistrationState.FREE || usernameEdit.nameRegistrationState === UsernameTextEdit.NameRegistrationState.BLANK KeyNavigation.tab: showAdvancedButton KeyNavigation.up: usernameEdit KeyNavigation.down: showAdvancedButton onClicked: { - WizardViewStepModel.accountCreationInfo = - JamiQmlUtils.setUpAccountCreationInputPara( - { - registeredName : usernameEdit.dynamicText, - alias: advancedAccountSettingsPage.alias, - password: advancedAccountSettingsPage.validatedPassword, - avatar: UtilsAdapter.tempCreationImage(), - isRendezVous: root.isRendezVous - }) + WizardViewStepModel.accountCreationInfo = JamiQmlUtils.setUpAccountCreationInputPara({ + "registeredName": usernameEdit.dynamicText, + "alias": advancedAccountSettingsPage.alias, + "password": advancedAccountSettingsPage.validatedPassword, + "avatar": UtilsAdapter.tempCreationImage(), + "isRendezVous": root.isRendezVous + }); if (usernameEdit.nameRegistrationState === UsernameTextEdit.NameRegistrationState.FREE) { - enabled = false - showAdvancedButton.enabled = false - WizardViewStepModel.nextStep() + enabled = false; + showAdvancedButton.enabled = false; + WizardViewStepModel.nextStep(); } - - if(usernameEdit.nameRegistrationState === UsernameTextEdit.NameRegistrationState.BLANK) - popup.visible = true + if (usernameEdit.nameRegistrationState === UsernameTextEdit.NameRegistrationState.BLANK) + popup.visible = true; } } @@ -339,9 +325,9 @@ Rectangle { KeyNavigation.down: backButton onClicked: { - adviceBox.checked = false - infoBox.checked = false - createAccountStack.currentIndex++ + adviceBox.checked = false; + infoBox.checked = false; + createAccountStack.currentIndex++; } } @@ -353,8 +339,8 @@ Rectangle { visible: false onJoinClicked: { - chooseUsernameButton.enabled = false - showAdvancedButton.enabled = false + chooseUsernameButton.enabled = false; + showAdvancedButton.enabled = false; } } } @@ -390,23 +376,21 @@ Rectangle { KeyNavigation.down: usernameEdit onClicked: { - adviceBox.checked = false - infoBox.checked = false + adviceBox.checked = false; + infoBox.checked = false; if (createAccountStack.currentIndex > 0) { - createAccountStack.currentIndex-- - + createAccountStack.currentIndex--; } else { - WizardViewStepModel.previousStep() - goodToKnow.visible = false - helpOpened = false + WizardViewStepModel.previousStep(); + goodToKnow.visible = false; + helpOpened = false; } } } PushButton { - id: adviceBox - z:1 + z: 1 preferredSize: JamiTheme.wizardViewPageBackButtonSize anchors.right: parent.right @@ -419,48 +403,49 @@ Rectangle { pressedColor: JamiTheme.tintedBlue hoveredColor: JamiTheme.hoveredButtonColorWizard border.color: { - if(adviceBox.checked){ - return "transparent" + if (adviceBox.checked) { + return "transparent"; } - return JamiTheme.buttonTintedBlue + return JamiTheme.buttonTintedBlue; } checkable: true onCheckedChanged: { - goodToKnow.visible = !goodToKnow.visible - helpOpened = !helpOpened - - advancedAccountSettingsPage.openedPassword = false - advancedAccountSettingsPage.openedNickname = false + goodToKnow.visible = !goodToKnow.visible; + helpOpened = !helpOpened; + advancedAccountSettingsPage.openedPassword = false; + advancedAccountSettingsPage.openedNickname = false; } } - - Item { id: goodToKnow anchors.top: parent.top anchors.right: parent.right - anchors.margins: JamiTheme.wizardViewPageBackButtonMargins + adviceBox.preferredWidth*2/5 + anchors.margins: JamiTheme.wizardViewPageBackButtonMargins + adviceBox.preferredWidth * 2 / 5 width: helpOpened ? Math.min(root.width - 2 * JamiTheme.preferredMarginSize, 452) : 0 height: { if (!helpOpened) - return 0 - var finalHeight = title.height + 3 * JamiTheme.preferredMarginSize - finalHeight += flow.implicitHeight - return finalHeight + return 0; + var finalHeight = title.height + 3 * JamiTheme.preferredMarginSize; + finalHeight += flow.implicitHeight; + return finalHeight; } visible: false - Behavior on width { - NumberAnimation { duration: JamiTheme.shortFadeDuration } + Behavior on width { + NumberAnimation { + duration: JamiTheme.shortFadeDuration + } } - Behavior on height { - NumberAnimation { duration: JamiTheme.shortFadeDuration} + Behavior on height { + NumberAnimation { + duration: JamiTheme.shortFadeDuration + } } DropShadow { @@ -475,7 +460,6 @@ Rectangle { } Rectangle { - id: boxAdvice z: 0 @@ -484,7 +468,6 @@ Rectangle { color: JamiTheme.secondaryBackgroundColor ColumnLayout { - id: adviceContainer anchors.horizontalCenter: parent.horizontalCenter @@ -492,14 +475,13 @@ Rectangle { anchors.top: parent.top visible: helpOpened ? 1 : 0 - Behavior on visible { + Behavior on visible { NumberAnimation { from: 0 duration: JamiTheme.overlayFadeDuration } } - Text { id: title text: JamiStrings.goodToKnow diff --git a/src/app/wizardview/components/CreateSIPAccountPage.qml b/src/app/wizardview/components/CreateSIPAccountPage.qml index a2005044ccd69b7722d42c3e25b14c769255c2dd..af7b99d3d8c9bc94098e355e585f3f481455f100 100644 --- a/src/app/wizardview/components/CreateSIPAccountPage.qml +++ b/src/app/wizardview/components/CreateSIPAccountPage.qml @@ -16,15 +16,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts import QtQuick.Controls - import net.jami.Adapters 1.1 import net.jami.Constants 1.1 import net.jami.Models 1.1 - import "../../commoncomponents" Rectangle { @@ -35,19 +32,17 @@ Rectangle { signal showThisPage function clearAllTextFields() { - UtilsAdapter.setTempCreationImageFromString() + UtilsAdapter.setTempCreationImageFromString(); } Connections { target: WizardViewStepModel function onMainStepChanged() { - if (WizardViewStepModel.mainStep === WizardViewStepModel.MainSteps.AccountCreation && - WizardViewStepModel.accountCreationOption === - WizardViewStepModel.AccountCreationOption.CreateSipAccount) { - clearAllTextFields() - root.showThisPage() - sipServernameEdit.focus = true + if (WizardViewStepModel.mainStep === WizardViewStepModel.MainSteps.AccountCreation && WizardViewStepModel.accountCreationOption === WizardViewStepModel.AccountCreationOption.CreateSipAccount) { + clearAllTextFields(); + root.showThisPage(); + sipServernameEdit.focus = true; } } } @@ -153,9 +148,11 @@ Rectangle { onAccepted: tlsRadioButton.forceActiveFocus() } - ButtonGroup { id: optionsB } + ButtonGroup { + id: optionsB + } - RowLayout{ + RowLayout { Layout.alignment: Qt.AlignHCenter Layout.preferredWidth: Math.min(440, root.width - JamiTheme.preferredMarginSize * 2) @@ -172,7 +169,6 @@ Rectangle { KeyNavigation.up: sipPasswordEdit KeyNavigation.down: udpRadioButton KeyNavigation.tab: KeyNavigation.down - } MaterialRadioButton { @@ -186,14 +182,13 @@ Rectangle { KeyNavigation.up: tlsRadioButton KeyNavigation.down: createAccountButton KeyNavigation.tab: KeyNavigation.down - } } MaterialButton { id: createAccountButton - TextMetrics{ + TextMetrics { id: textSize font.weight: Font.Bold font.pixelSize: JamiTheme.wizardViewDescriptionFontPixelSize @@ -205,7 +200,7 @@ Rectangle { Layout.alignment: Qt.AlignCenter Layout.topMargin: JamiTheme.wizardViewBlocMarginSize - preferredWidth: textSize.width + 2*JamiTheme.buttontextWizzardPadding + preferredWidth: textSize.width + 2 * JamiTheme.buttontextWizzardPadding primary: true text: JamiStrings.addSip @@ -215,37 +210,35 @@ Rectangle { KeyNavigation.tab: KeyNavigation.down onClicked: { - WizardViewStepModel.accountCreationInfo = - JamiQmlUtils.setUpAccountCreationInputPara( - {hostname : sipServernameEdit.dynamicText, - alias: displayNameLineEdit.dynamicText, - username : sipUsernameEdit.dynamicText, - password : sipPasswordEdit.dynamicText, - tls: tlsRadioButton.checked, - avatar: UtilsAdapter.tempCreationImage()}) - WizardViewStepModel.nextStep() + WizardViewStepModel.accountCreationInfo = JamiQmlUtils.setUpAccountCreationInputPara({ + "hostname": sipServernameEdit.dynamicText, + "alias": displayNameLineEdit.dynamicText, + "username": sipUsernameEdit.dynamicText, + "password": sipPasswordEdit.dynamicText, + "tls": tlsRadioButton.checked, + "avatar": UtilsAdapter.tempCreationImage() + }); + WizardViewStepModel.nextStep(); } } MaterialButton { - id: personalizeAccount - TextMetrics{ + TextMetrics { id: personalizeAccountTextSize font.weight: Font.Bold font.pixelSize: JamiTheme.wizardViewDescriptionFontPixelSize text: personalizeAccount.text } - text: JamiStrings.personalizeAccount tertiary: true secHoveredColor: JamiTheme.secAndTertiHoveredBackgroundColor - preferredWidth: personalizeAccountTextSize.width + 2*JamiTheme.buttontextWizzardPadding + 1 + preferredWidth: personalizeAccountTextSize.width + 2 * JamiTheme.buttontextWizzardPadding + 1 Layout.alignment: Qt.AlignCenter - Layout.bottomMargin: JamiTheme.wizardViewPageBackButtonMargins*2 + Layout.bottomMargin: JamiTheme.wizardViewPageBackButtonMargins * 2 Layout.topMargin: JamiTheme.wizardViewBlocMarginSize KeyNavigation.up: createAccountButton @@ -341,9 +334,9 @@ Rectangle { onClicked: { if (createAccountStack.currentIndex !== 0) { - createAccountStack.currentIndex-- + createAccountStack.currentIndex--; } else { - WizardViewStepModel.previousStep() + WizardViewStepModel.previousStep(); } } } diff --git a/src/app/wizardview/components/ImportFromBackupPage.qml b/src/app/wizardview/components/ImportFromBackupPage.qml index aa7c723b669246c49508ea82b7a43b831d485c8f..b4fed5433c7dbaee2c380df281e1522434040b1f 100644 --- a/src/app/wizardview/components/ImportFromBackupPage.qml +++ b/src/app/wizardview/components/ImportFromBackupPage.qml @@ -16,16 +16,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts import QtQuick.Controls import Qt.labs.platform - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" Rectangle { @@ -40,26 +37,24 @@ Rectangle { signal showThisPage function clearAllTextFields() { - connectBtn.spinnerTriggered = false - filePath = "" - errorText = "" - fileImportBtnText = JamiStrings.selectArchiveFile + connectBtn.spinnerTriggered = false; + filePath = ""; + errorText = ""; + fileImportBtnText = JamiStrings.selectArchiveFile; } function errorOccured(errorMessage) { - errorText = errorMessage - connectBtn.spinnerTriggered = false + errorText = errorMessage; + connectBtn.spinnerTriggered = false; } Connections { target: WizardViewStepModel function onMainStepChanged() { - if (WizardViewStepModel.mainStep === WizardViewStepModel.MainSteps.AccountCreation && - WizardViewStepModel.accountCreationOption === - WizardViewStepModel.AccountCreationOption.ImportFromBackup) { - clearAllTextFields() - root.showThisPage() + if (WizardViewStepModel.mainStep === WizardViewStepModel.MainSteps.AccountCreation && WizardViewStepModel.accountCreationOption === WizardViewStepModel.AccountCreationOption.ImportFromBackup) { + clearAllTextFields(); + root.showThisPage(); } } } @@ -87,7 +82,7 @@ Rectangle { color: JamiTheme.textColor font.pixelSize: JamiTheme.wizardViewTitleFontPixelSize - wrapMode : Text.WordWrap + wrapMode: Text.WordWrap } Text { @@ -101,21 +96,20 @@ Rectangle { color: JamiTheme.textColor font.pixelSize: JamiTheme.wizardViewDescriptionFontPixelSize - wrapMode : Text.WordWrap + wrapMode: Text.WordWrap lineHeight: JamiTheme.wizardViewTextLineHeight } MaterialButton { id: fileImportBtn - TextMetrics{ + TextMetrics { id: textSizeFileImportBtn font.weight: Font.Bold font.pixelSize: JamiTheme.wizardViewDescriptionFontPixelSize text: fileImportBtn.text } - objectName: "fileImportBtn" secondary: true @@ -124,7 +118,7 @@ Rectangle { Layout.alignment: Qt.AlignCenter Layout.topMargin: JamiTheme.wizardViewBlocMarginSize - preferredWidth: textSizeFileImportBtn.width + 2*JamiTheme.buttontextWizzardPadding + preferredWidth: textSizeFileImportBtn.width + 2 * JamiTheme.buttontextWizzardPadding text: fileImportBtnText toolTipText: JamiStrings.importAccountArchive @@ -134,30 +128,25 @@ Rectangle { KeyNavigation.tab: KeyNavigation.down onClicked: { - errorText = "" - var dlg = viewCoordinator.presentDialog( - appWindow, - "commoncomponents/JamiFileDialog.qml", - { - title: JamiStrings.openFile, - fileMode: JamiFileDialog.OpenFile, - folder: StandardPaths.writableLocation( - StandardPaths.HomeLocation) + "/Desktop", - nameFilters: [JamiStrings.jamiArchiveFiles, - JamiStrings.allFiles] - }) - dlg.fileAccepted.connect(function(file) { - filePath = file - if (file.length !== "") { - fileImportBtnText = UtilsAdapter.toFileInfoName(file) - passwordFromBackupEdit.forceActiveFocus() - } else { - fileImportBtnText = JamiStrings.archive - } - }) - dlg.rejected.connect(function() { - fileImportBtn.forceActiveFocus() - }) + errorText = ""; + var dlg = viewCoordinator.presentDialog(appWindow, "commoncomponents/JamiFileDialog.qml", { + "title": JamiStrings.openFile, + "fileMode": JamiFileDialog.OpenFile, + "folder": StandardPaths.writableLocation(StandardPaths.HomeLocation) + "/Desktop", + "nameFilters": [JamiStrings.jamiArchiveFiles, JamiStrings.allFiles] + }); + dlg.fileAccepted.connect(function (file) { + filePath = file; + if (file.length !== "") { + fileImportBtnText = UtilsAdapter.toFileInfoName(file); + passwordFromBackupEdit.forceActiveFocus(); + } else { + fileImportBtnText = JamiStrings.archive; + } + }); + dlg.rejected.connect(function () { + fileImportBtn.forceActiveFocus(); + }); } } @@ -171,7 +160,7 @@ Rectangle { color: JamiTheme.textColor font.pixelSize: JamiTheme.wizardViewDescriptionFontPixelSize - wrapMode : Text.WordWrap + wrapMode: Text.WordWrap lineHeight: JamiTheme.wizardViewTextLineHeight } @@ -196,7 +185,7 @@ Rectangle { SpinnerButton { id: connectBtn - TextMetrics{ + TextMetrics { id: textSizeConnectBtn font.weight: Font.Bold font.pixelSize: JamiTheme.wizardViewDescriptionFontPixelSize @@ -209,7 +198,7 @@ Rectangle { Layout.bottomMargin: errorLabel.visible ? 0 : JamiTheme.wizardViewPageBackButtonMargins Layout.topMargin: JamiTheme.wizardViewBlocMarginSize - preferredWidth: textSizeConnectBtn.width + 2*JamiTheme.buttontextWizzardPadding + 1 + preferredWidth: textSizeConnectBtn.width + 2 * JamiTheme.buttontextWizzardPadding + 1 primary: true spinnerTriggeredtext: JamiStrings.generatingAccount @@ -217,10 +206,10 @@ Rectangle { enabled: { if (spinnerTriggered) - return false + return false; if (!(filePath.length === 0) && errorText.length === 0) - return true - return false + return true; + return false; } KeyNavigation.up: passwordFromBackupEdit @@ -229,14 +218,13 @@ Rectangle { onClicked: { if (connectBtn.focus) - fileImportBtn.forceActiveFocus() - spinnerTriggered = true - - WizardViewStepModel.accountCreationInfo = - JamiQmlUtils.setUpAccountCreationInputPara( - {archivePath : UtilsAdapter.getAbsPath(filePath), - password : passwordFromBackupEdit.dynamicText}) - WizardViewStepModel.nextStep() + fileImportBtn.forceActiveFocus(); + spinnerTriggered = true; + WizardViewStepModel.accountCreationInfo = JamiQmlUtils.setUpAccountCreationInputPara({ + "archivePath": UtilsAdapter.getAbsPath(filePath), + "password": passwordFromBackupEdit.dynamicText + }); + WizardViewStepModel.nextStep(); } } @@ -272,8 +260,8 @@ Rectangle { KeyNavigation.tab: fileImportBtn KeyNavigation.up: { if (connectBtn.enabled) - return connectBtn - return passwordFromBackupEdit + return connectBtn; + return passwordFromBackupEdit; } KeyNavigation.down: fileImportBtn diff --git a/src/app/wizardview/components/ImportFromDevicePage.qml b/src/app/wizardview/components/ImportFromDevicePage.qml index 22a1492460438eacc2404a25382bd26b1c9dcfb8..e12295ffcfaf8b939e871cfe36d5c099708e85ec 100644 --- a/src/app/wizardview/components/ImportFromDevicePage.qml +++ b/src/app/wizardview/components/ImportFromDevicePage.qml @@ -16,14 +16,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts import QtQuick.Controls - import net.jami.Models 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" Rectangle { @@ -35,27 +32,25 @@ Rectangle { signal showThisPage function initializeOnShowUp() { - clearAllTextFields() + clearAllTextFields(); } function clearAllTextFields() { - connectBtn.spinnerTriggered = false + connectBtn.spinnerTriggered = false; } function errorOccured(errorMessage) { - errorText = errorMessage - connectBtn.spinnerTriggered = false + errorText = errorMessage; + connectBtn.spinnerTriggered = false; } Connections { target: WizardViewStepModel function onMainStepChanged() { - if (WizardViewStepModel.mainStep === WizardViewStepModel.MainSteps.AccountCreation && - WizardViewStepModel.accountCreationOption === - WizardViewStepModel.AccountCreationOption.ImportFromDevice) { - clearAllTextFields() - root.showThisPage() + if (WizardViewStepModel.mainStep === WizardViewStepModel.MainSteps.AccountCreation && WizardViewStepModel.accountCreationOption === WizardViewStepModel.AccountCreationOption.ImportFromDevice) { + clearAllTextFields(); + root.showThisPage(); } } } @@ -82,7 +77,7 @@ Rectangle { color: JamiTheme.textColor font.pixelSize: JamiTheme.wizardViewTitleFontPixelSize - wrapMode : Text.WordWrap + wrapMode: Text.WordWrap } Text { @@ -100,8 +95,6 @@ Rectangle { lineHeight: JamiTheme.wizardViewTextLineHeight } - - Flow { spacing: 30 Layout.alignment: Qt.AlignHCenter @@ -139,7 +132,6 @@ Rectangle { description: JamiStrings.importStep4Desc icoColor: JamiTheme.buttonTintedBlue } - } ModalTextEdit { @@ -161,12 +153,10 @@ Rectangle { KeyNavigation.tab: KeyNavigation.down onAccepted: passwordFromDevice.forceActiveFocus() - } Text { - Layout.alignment: Qt.AlignCenter Layout.topMargin: JamiTheme.wizardViewBlocMarginSize @@ -177,8 +167,6 @@ Rectangle { font.weight: Font.Medium } - - PasswordTextEdit { id: passwordFromDevice @@ -192,21 +180,20 @@ Rectangle { KeyNavigation.up: pinFromDevice KeyNavigation.down: { if (connectBtn.enabled) - return connectBtn + return connectBtn; else if (connectBtn.spinnerTriggered) - return passwordFromDevice - return backButton + return passwordFromDevice; + return backButton; } KeyNavigation.tab: KeyNavigation.down onAccepted: pinFromDevice.forceActiveFocus() - } SpinnerButton { id: connectBtn - TextMetrics{ + TextMetrics { id: textSize font.weight: Font.Bold font.pixelSize: JamiTheme.wizardViewButtonFontPixelSize @@ -219,7 +206,7 @@ Rectangle { Layout.topMargin: JamiTheme.wizardViewBlocMarginSize Layout.bottomMargin: errorLabel.visible ? 0 : JamiTheme.wizardViewPageBackButtonMargins - preferredWidth: textSize.width + 2*JamiTheme.buttontextWizzardPadding +1 + preferredWidth: textSize.width + 2 * JamiTheme.buttontextWizzardPadding + 1 primary: true spinnerTriggeredtext: JamiStrings.generatingAccount @@ -232,13 +219,12 @@ Rectangle { KeyNavigation.down: backButton onClicked: { - spinnerTriggered = true - - WizardViewStepModel.accountCreationInfo = - JamiQmlUtils.setUpAccountCreationInputPara( - {archivePin : pinFromDevice.dynamicText, - password : passwordFromDevice.dynamicText}) - WizardViewStepModel.nextStep() + spinnerTriggered = true; + WizardViewStepModel.accountCreationInfo = JamiQmlUtils.setUpAccountCreationInputPara({ + "archivePin": pinFromDevice.dynamicText, + "password": passwordFromDevice.dynamicText + }); + WizardViewStepModel.nextStep(); } } diff --git a/src/app/wizardview/components/NoUsernamePopup.qml b/src/app/wizardview/components/NoUsernamePopup.qml index 888ea976168670bfcfc588bed8ae3b5d2e1a599e..6851782ea16a10f010516ad97fde1e8d46c80d43 100644 --- a/src/app/wizardview/components/NoUsernamePopup.qml +++ b/src/app/wizardview/components/NoUsernamePopup.qml @@ -15,17 +15,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts import QtQuick.Controls - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 import Qt5Compat.GraphicalEffects - - import "../../commoncomponents" Popup { @@ -42,11 +38,11 @@ Popup { signal joinClicked - modal:true + modal: true padding: 0 visible: false - closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside + closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside Rectangle { id: container @@ -56,7 +52,7 @@ Popup { color: JamiTheme.secondaryBackgroundColor ColumnLayout { - id: popupContent + id: popupContent Layout.alignment: Qt.AlignCenter @@ -67,13 +63,15 @@ Popup { width: 30 height: 30 imageContainerWidth: 30 - imageContainerHeight : 30 + imageContainerHeight: 30 Layout.margins: 8 - radius : 5 + radius: 5 imageColor: "grey" normalColor: JamiTheme.transparentColor source: JamiResources.round_close_24dp_svg - onClicked: { root.visible = false } + onClicked: { + root.visible = false; + } } Text { @@ -90,7 +88,7 @@ Popup { text: JamiStrings.joinJamiNoPassword } - RowLayout{ + RowLayout { Layout.topMargin: JamiTheme.popupButtonsMargin Layout.bottomMargin: JamiTheme.popupButtonsMargin @@ -99,7 +97,7 @@ Popup { MaterialButton { - TextMetrics{ + TextMetrics { id: joinJamiSize font.weight: Font.Bold font.pixelSize: JamiTheme.wizardViewButtonFontPixelSize @@ -108,21 +106,21 @@ Popup { Layout.leftMargin: JamiTheme.popupButtonsMargin objectName: "joinButton" - preferredWidth: joinJamiSize.width + 2*(JamiTheme.buttontextWizzardPadding + 1) + preferredWidth: joinJamiSize.width + 2 * (JamiTheme.buttontextWizzardPadding + 1) textLeftPadding: JamiTheme.buttontextWizzardPadding textRightPadding: JamiTheme.buttontextWizzardPadding secondary: true text: JamiStrings.joinJami onClicked: { - root.joinClicked() - WizardViewStepModel.nextStep() - root.close() + root.joinClicked(); + WizardViewStepModel.nextStep(); + root.close(); } } MaterialButton { - TextMetrics{ + TextMetrics { id: chooseAUsernameSize font.weight: Font.Bold font.pixelSize: JamiTheme.wizardViewButtonFontPixelSize @@ -130,13 +128,12 @@ Popup { } Layout.rightMargin: JamiTheme.popupButtonsMargin - preferredWidth: chooseAUsernameSize.width + 2*JamiTheme.buttontextWizzardPadding + preferredWidth: chooseAUsernameSize.width + 2 * JamiTheme.buttontextWizzardPadding primary: true text: JamiStrings.chooseAUsername onClicked: root.close() } } - } } @@ -147,7 +144,7 @@ Popup { Overlay.modal: Rectangle { color: JamiTheme.transparentColor // Color animation for overlay when pop up is shown. - ColorAnimation on color { + ColorAnimation on color { to: JamiTheme.popupOverlayColor duration: 500 } @@ -167,14 +164,18 @@ Popup { enter: Transition { NumberAnimation { - properties: "opacity"; from: 0.0; to: 1.0 + properties: "opacity" + from: 0.0 + to: 1.0 duration: JamiTheme.shortFadeDuration } } exit: Transition { NumberAnimation { - properties: "opacity"; from: 1.0; to: 0.0 + properties: "opacity" + from: 1.0 + to: 0.0 duration: JamiTheme.shortFadeDuration } } diff --git a/src/app/wizardview/components/WelcomePage.qml b/src/app/wizardview/components/WelcomePage.qml index 82e27fa64baa10a6fbafb2e4063a1c42a4fb23f7..e8942fa9c17f65d46198f9e32f76738b0e83e2da 100644 --- a/src/app/wizardview/components/WelcomePage.qml +++ b/src/app/wizardview/components/WelcomePage.qml @@ -17,21 +17,16 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - import QtQuick import QtQuick.Layouts import QtMultimedia import Qt5Compat.GraphicalEffects - - import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 - import "../../commoncomponents" import "../../mainview/components" - Rectangle { id: root @@ -49,14 +44,14 @@ Rectangle { function onMainStepChanged() { if (WizardViewStepModel.mainStep === WizardViewStepModel.MainSteps.Initial) - root.showThisPage() + root.showThisPage(); } } // Make sure that welcomePage grab activeFocus initially (when there is no account) onVisibleChanged: { if (visible) - forceActiveFocus() + forceActiveFocus(); } KeyNavigation.tab: newAccountButton @@ -84,14 +79,17 @@ Rectangle { property var mediaInfo: UtilsAdapter.getVideoPlayer(JamiTheme.darkTheme ? JamiResources.logo_dark_webm : JamiResources.logo_light_webm, JamiTheme.secondaryBackgroundColor) anchors.fill: parent anchors.margins: 2 - sourceComponent: WITH_WEBENGINE? avMediaComp : basicPlayer + sourceComponent: WITH_WEBENGINE ? avMediaComp : basicPlayer Component { id: avMediaComp Loader { Component.onCompleted: { - var qml = "qrc:/webengine/VideoPreview.qml" - setSource( qml, { isVideo: mediaInfo.isVideo, html:mediaInfo.html } ) + var qml = "qrc:/webengine/VideoPreview.qml"; + setSource(qml, { + "isVideo": mediaInfo.isVideo, + "html": mediaInfo.html + }); } } } @@ -114,16 +112,13 @@ Rectangle { } Component.onCompleted: { - mediaPlayer.play() + mediaPlayer.play(); } } - } } - } - Text { id: introduction @@ -135,7 +130,7 @@ Rectangle { color: JamiTheme.textColor horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter - wrapMode : Text.WordWrap + wrapMode: Text.WordWrap lineHeight: JamiTheme.wizardViewTextLineHeight font.pixelSize: JamiTheme.wizardViewTitleFontPixelSize @@ -153,7 +148,7 @@ Rectangle { color: JamiTheme.textColor horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter - wrapMode : Text.WordWrap + wrapMode: Text.WordWrap lineHeight: JamiTheme.wizardViewTextLineHeight font.pixelSize: JamiTheme.wizardViewDescriptionFontPixelSize @@ -174,10 +169,7 @@ Rectangle { toolTipText: JamiStrings.createNewJamiAccount KeyNavigation.tab: alreadyHaveAccount - KeyNavigation.up: backButton.visible ? backButton : - (showAdvancedButton.showAdvanced ? - newSIPAccountButton : - showAdvancedButton) + KeyNavigation.up: backButton.visible ? backButton : (showAdvancedButton.showAdvanced ? newSIPAccountButton : showAdvancedButton) KeyNavigation.down: KeyNavigation.tab onClicked: WizardViewStepModel.startAccountCreationFlow(WizardViewStepModel.AccountCreationOption.CreateJamiAccount) @@ -202,20 +194,18 @@ Rectangle { KeyNavigation.tab: showAlreadyHave ? fromDeviceButton : showAdvancedButton - KeyNavigation.up: newAccountButton KeyNavigation.down: KeyNavigation.tab onClicked: { - boldFont = !boldFont - showAlreadyHave = !showAlreadyHave - showAdvanced = false - fromDeviceButton.visible = showAlreadyHave - fromBackupButton.visible = showAlreadyHave - newRdvButton.visible = showAdvanced - connectAccountManagerButton.visible = showAdvanced - newSIPAccountButton.visible = showAdvanced - + boldFont = !boldFont; + showAlreadyHave = !showAlreadyHave; + showAdvanced = false; + fromDeviceButton.visible = showAlreadyHave; + fromBackupButton.visible = showAlreadyHave; + newRdvButton.visible = showAdvanced; + connectAccountManagerButton.visible = showAdvanced; + newSIPAccountButton.visible = showAdvanced; } } @@ -274,28 +264,25 @@ Rectangle { secHoveredColor: JamiTheme.secAndTertiHoveredBackgroundColor Layout.alignment: Qt.AlignCenter - Layout.bottomMargin: newSIPAccountButton.visible ? - 0 : JamiTheme.wizardViewPageBackButtonMargins + Layout.bottomMargin: newSIPAccountButton.visible ? 0 : JamiTheme.wizardViewPageBackButtonMargins preferredWidth: Math.min(JamiTheme.wizardButtonWidth, root.width - JamiTheme.preferredMarginSize * 2) text: JamiStrings.advancedFeatures - toolTipText: showAdvanced ? JamiStrings.hideAdvancedFeatures : - JamiStrings.showAdvancedFeatures - + toolTipText: showAdvanced ? JamiStrings.hideAdvancedFeatures : JamiStrings.showAdvancedFeatures KeyNavigation.tab: showAdvanced ? newRdvButton : btnAboutPopUp KeyNavigation.up: showAlreadyHave ? fromBackupButton : alreadyHaveAccount KeyNavigation.down: KeyNavigation.tab onClicked: { - boldFont = !boldFont - showAdvanced = !showAdvanced - showAlreadyHave = false - newRdvButton.visible = showAdvanced - connectAccountManagerButton.visible = showAdvanced - newSIPAccountButton.visible = showAdvanced - fromDeviceButton.visible = showAlreadyHave - fromBackupButton.visible = showAlreadyHave + boldFont = !boldFont; + showAdvanced = !showAdvanced; + showAlreadyHave = false; + newRdvButton.visible = showAdvanced; + connectAccountManagerButton.visible = showAdvanced; + newSIPAccountButton.visible = showAdvanced; + fromDeviceButton.visible = showAlreadyHave; + fromBackupButton.visible = showAlreadyHave; } } @@ -367,8 +354,7 @@ Rectangle { KeyNavigation.up: connectAccountManagerButton KeyNavigation.down: KeyNavigation.tab - onClicked: WizardViewStepModel.startAccountCreationFlow( - WizardViewStepModel.AccountCreationOption.CreateSipAccount) + onClicked: WizardViewStepModel.startAccountCreationFlow(WizardViewStepModel.AccountCreationOption.CreateSipAccount) } MaterialButton { @@ -391,9 +377,7 @@ Rectangle { text: JamiStrings.aboutJami - onClicked: viewCoordinator.presentDialog( - parent, - "mainview/components/AboutPopUp.qml") + onClicked: viewCoordinator.presentDialog(parent, "mainview/components/AboutPopUp.qml") } } @@ -410,7 +394,7 @@ Rectangle { target: LRCInstance function onAccountListChanged() { - backButton.visible = UtilsAdapter.getAccountListSize() + backButton.visible = UtilsAdapter.getAccountListSize(); } }