From acd4b3065c9ef1e3dc44dc69511d6cdb87074f16 Mon Sep 17 00:00:00 2001 From: Fadi SHEHADEH <fadi.shehadeh@savoirfairelinux.com> Date: Tue, 4 Apr 2023 11:44:36 -0400 Subject: [PATCH] SettingsView: apply the new design Change-Id: I03f536a22eb24c30a33f9d1736ac0e7849d66c42 --- resources/icons/Key_Black_24dp.svg | 15 + src/app/appsettingsmanager.cpp | 6 + src/app/appsettingsmanager.h | 2 + src/app/bannedlistmodel.cpp | 42 +- src/app/bannedlistmodel.h | 6 +- src/app/commoncomponents/ConfirmDialog.qml | 4 +- .../ContactMessageDelegate.qml | 2 + .../commoncomponents/DeleteAccountDialog.qml | 4 +- .../JamiIdentifier.qml | 35 +- src/app/commoncomponents/MaterialButton.qml | 13 +- .../commoncomponents/MaterialRadioButton.qml | 22 +- .../commoncomponents/MaterialTextField.qml | 2 +- src/app/commoncomponents/PasswordTextEdit.qml | 2 +- .../PreferenceItemDelegate.qml | 2 +- src/app/commoncomponents/PushButton.qml | 29 +- .../commoncomponents/SettingParaCombobox.qml | 17 +- .../commoncomponents/SimpleMessageDialog.qml | 2 +- src/app/constant/JamiStrings.qml | 92 +++- src/app/constant/JamiTheme.qml | 38 +- src/app/currentaccount.cpp | 12 + src/app/currentaccount.h | 1 + .../components/KeyboardShortcutTable.qml | 2 +- src/app/mainview/components/SipInputPanel.qml | 3 +- .../mainview/components/SwarmDetailsPanel.qml | 1 - src/app/mainview/components/UserProfile.qml | 2 +- src/app/positionmanager.cpp | 2 +- src/app/settingsview/SettingsSidePanel.qml | 287 ++++++++--- src/app/settingsview/SettingsView.qml | 200 +++----- .../components/AdvancedCallSettings.qml | 233 --------- .../components/AdvancedChatSettings.qml | 42 +- .../AdvancedConnectivitySettings.qml | 47 +- .../AdvancedJamiSecuritySettings.qml | 27 +- .../components/AdvancedMediaSettings.qml | 17 +- .../components/AdvancedNameServerSettings.qml | 17 +- .../components/AdvancedOpenDHTSettings.qml | 24 +- .../AdvancedPublicAddressSettings.qml | 7 +- .../components/AdvancedSDPSettings.qml | 37 +- .../AdvancedSIPSecuritySettings.qml | 64 +-- .../components/AdvancedSettings.qml | 67 --- .../components/AdvancedSettingsPage.qml | 122 +++++ .../components/AppearenceSettingsPage.qml | 408 ++++++++++++++++ .../settingsview/components/AudioSettings.qml | 183 ------- .../components/AudioSettingsPage.qml | 199 ++++++++ .../components/BannedContacts.qml | 83 +--- .../components/CallRecordingSettingsPage.qml | 292 ++++++++++++ .../components/CallSettingsPage.qml | 330 +++++++++++++ .../components/ChatviewSettings.qml | 123 ----- .../components/ContactItemDelegate.qml | 27 +- .../components/CurrentAccountSettings.qml | 31 +- .../components/CustomizeProfilePage.qml | 106 +++++ .../components/DeviceItemDelegate.qml | 48 +- .../components/FileTransferSettings.qml | 73 --- .../components/FileTransferSettingsPage.qml | 97 ++++ .../components/GeneralSettingsPage.qml | 68 --- .../settingsview/components/LevelMeter.qml | 12 + .../components/LinkDeviceDialog.qml | 6 +- ...inkedDevices.qml => LinkedDevicesBase.qml} | 75 ++- .../components/LinkedDevicesPage.qml | 134 ++++++ .../components/LocationSharingSettings.qml | 150 ------ .../LocationSharingSettingsPage.qml | 220 +++++++++ src/app/settingsview/components/LogsView.qml | 7 +- .../components/ManageAccountPage.qml | 447 ++++++++++++++++++ .../components/MediaCodecDelegate.qml | 6 +- .../components/NameRegistrationDialog.qml | 6 +- .../components/PluginListView.qml | 2 +- .../components/PluginPreferencesListView.qml | 2 +- .../components/PluginPreferencesView.qml | 2 +- .../components/PluginSettingsPage.qml | 61 ++- .../components/RecordingSettings.qml | 260 ---------- .../components/RevokeDevicePasswordDialog.qml | 4 +- .../components/SIPUserIdentity.qml | 4 - .../components/ScreenSharingSettingsPage.qml | 78 +++ .../components/SettingMaterialButton.qml | 11 +- .../components/SettingSpinBox.qml | 8 +- .../components/SettingsComboBox.qml | 20 +- .../components/SettingsHeader.qml | 9 +- .../components/SettingsMaterialTextEdit.qml | 8 +- .../components/SettingsMenuButton.qml | 6 +- .../components/SettingsPageBase.qml | 66 +++ .../components/SystemSettings.qml | 269 ----------- .../components/SystemSettingsPage.qml | 260 ++++++++++ .../settingsview/components/ToggleSwitch.qml | 50 +- .../components/TroubleshootSettings.qml | 101 ---- .../components/TroubleshootSettingsPage.qml | 96 ++++ .../components/UpdateSettings.qml | 184 ------- .../components/UpdatesSettingsPage.qml | 188 ++++++++ .../settingsview/components/VideoSettings.qml | 334 ------------- .../components/VideoSettingsPage.qml | 294 ++++++++++++ src/app/utilsadapter.cpp | 19 + src/app/utilsadapter.h | 3 + .../components/CreateAccountPage.qml | 2 - .../components/CreateSIPAccountPage.qml | 2 + 92 files changed, 4247 insertions(+), 2776 deletions(-) create mode 100644 resources/icons/Key_Black_24dp.svg rename src/app/{mainview/components => commoncomponents}/JamiIdentifier.qml (84%) delete mode 100644 src/app/settingsview/components/AdvancedCallSettings.qml create mode 100644 src/app/settingsview/components/AdvancedSettingsPage.qml create mode 100644 src/app/settingsview/components/AppearenceSettingsPage.qml delete mode 100644 src/app/settingsview/components/AudioSettings.qml create mode 100644 src/app/settingsview/components/AudioSettingsPage.qml create mode 100644 src/app/settingsview/components/CallRecordingSettingsPage.qml create mode 100644 src/app/settingsview/components/CallSettingsPage.qml delete mode 100644 src/app/settingsview/components/ChatviewSettings.qml create mode 100644 src/app/settingsview/components/CustomizeProfilePage.qml delete mode 100644 src/app/settingsview/components/FileTransferSettings.qml create mode 100644 src/app/settingsview/components/FileTransferSettingsPage.qml rename src/app/settingsview/components/{LinkedDevices.qml => LinkedDevicesBase.qml} (63%) create mode 100644 src/app/settingsview/components/LinkedDevicesPage.qml delete mode 100644 src/app/settingsview/components/LocationSharingSettings.qml create mode 100644 src/app/settingsview/components/LocationSharingSettingsPage.qml create mode 100644 src/app/settingsview/components/ManageAccountPage.qml delete mode 100644 src/app/settingsview/components/RecordingSettings.qml create mode 100644 src/app/settingsview/components/ScreenSharingSettingsPage.qml create mode 100644 src/app/settingsview/components/SettingsPageBase.qml delete mode 100644 src/app/settingsview/components/SystemSettings.qml create mode 100644 src/app/settingsview/components/SystemSettingsPage.qml delete mode 100644 src/app/settingsview/components/TroubleshootSettings.qml create mode 100644 src/app/settingsview/components/TroubleshootSettingsPage.qml delete mode 100644 src/app/settingsview/components/UpdateSettings.qml create mode 100644 src/app/settingsview/components/UpdatesSettingsPage.qml delete mode 100644 src/app/settingsview/components/VideoSettings.qml create mode 100644 src/app/settingsview/components/VideoSettingsPage.qml diff --git a/resources/icons/Key_Black_24dp.svg b/resources/icons/Key_Black_24dp.svg new file mode 100644 index 000000000..c72330d70 --- /dev/null +++ b/resources/icons/Key_Black_24dp.svg @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generator: Adobe Illustrator 24.3.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> +<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" + viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve"> +<g id="noun-key-2387257" transform="translate(0.043 -0.005)"> + <path id="Path_306" d="M21.2,17.8v-1.2c0-0.4-0.3-0.8-0.8-0.8h-0.8v-0.8c0-0.4-0.3-0.8-0.8-0.8c0,0,0,0,0,0h-0.8v-0.8 + c0-0.2-0.1-0.4-0.2-0.5l-3.7-3.7c0.1-0.4,0.1-0.7,0.1-1.1c0-3.4-2.8-6.2-6.2-6.2S2,4.8,2,8.2s2.8,6.2,6.2,6.2c0,0,0,0,0,0 + c0.8,0,1.6-0.2,2.3-0.5l7.9,7.9c0.1,0.1,0.3,0.2,0.5,0.2h2.3c0.4,0,0.8-0.3,0.8-0.8v-2.3c0-0.2-0.1-0.4-0.2-0.5L21.2,17.8z + M20.4,20.5h-1.2l-8.1-8.1c-0.2-0.2-0.6-0.3-0.9-0.1c-2.3,1.2-5.1,0.3-6.3-2S3.6,5.2,5.9,4s5.1-0.3,6.3,2c0.5,1,0.7,2.2,0.4,3.3 + c-0.1,0.3,0,0.5,0.2,0.7l3.8,3.8v1.2c0,0.4,0.3,0.8,0.8,0.8h0.8v0.8c0,0.4,0.3,0.8,0.8,0.8h0.8v0.8c0,0.2,0.1,0.4,0.2,0.5l0.5,0.5 + L20.4,20.5z"/> + <path id="Path_307" d="M8.1,6.6c0,0.8-0.7,1.5-1.5,1.5C5.7,8.2,5,7.5,5,6.6c0-0.8,0.7-1.5,1.5-1.5c0,0,0,0,0,0 + C7.4,5.1,8.1,5.8,8.1,6.6"/> +</g> +</svg> diff --git a/src/app/appsettingsmanager.cpp b/src/app/appsettingsmanager.cpp index 93f9653e2..f2351dae3 100644 --- a/src/app/appsettingsmanager.cpp +++ b/src/app/appsettingsmanager.cpp @@ -69,6 +69,12 @@ AppSettingsManager::setValue(const Settings::Key key, const QVariant& value) setValue(Settings::toString(key), value); } +QVariant +AppSettingsManager::getDefault(const Settings::Key key) const +{ + return Settings::defaultValue(key); +} + QString AppSettingsManager::getLanguage() { diff --git a/src/app/appsettingsmanager.h b/src/app/appsettingsmanager.h index edafd9d33..c81bf7630 100644 --- a/src/app/appsettingsmanager.h +++ b/src/app/appsettingsmanager.h @@ -116,6 +116,8 @@ public: Q_INVOKABLE QVariant getValue(const Settings::Key key); Q_INVOKABLE void setValue(const Settings::Key key, const QVariant& value = {}); + Q_INVOKABLE QVariant getDefault(const Settings::Key key) const; + QString getLanguage(); void loadTranslations(); diff --git a/src/app/bannedlistmodel.cpp b/src/app/bannedlistmodel.cpp index 346fead25..a097f1730 100644 --- a/src/app/bannedlistmodel.cpp +++ b/src/app/bannedlistmodel.cpp @@ -23,16 +23,46 @@ BannedListModel::BannedListModel(QObject* parent) : AbstractListModelBase(parent) -{} + +{ + connect(this, &BannedListModel::lrcInstanceChanged, [this]() { + if (lrcInstance_ && lrcInstance_->getCurrentContactModel()) { + connect( + lrcInstance_->getCurrentContactModel(), + &ContactModel::bannedStatusChanged, + this, + [&](const QString& uri, bool banned) { + if (banned) { + beginInsertRows(QModelIndex(), rowCount(), rowCount()); + bannedlist_.append(uri); + endInsertRows(); + set_count(rowCount()); + } else { + auto it = std::find_if(bannedlist_.begin(), + bannedlist_.end(), + [&uri](const auto& c) { return uri == c; }); + if (it != bannedlist_.end()) { + auto elementIndex = std::distance(bannedlist_.begin(), it); + beginRemoveRows(QModelIndex(), elementIndex, elementIndex); + bannedlist_.remove(elementIndex); + endRemoveRows(); + set_count(rowCount()); + } + } + }, + Qt::UniqueConnection); + } + reset(); + }); +} BannedListModel::~BannedListModel() {} int BannedListModel::rowCount(const QModelIndex& parent) const { - if (!parent.isValid() && lrcInstance_) { - return lrcInstance_->getCurrentAccountInfo().contactModel->getBannedContacts().size(); - } + if (!parent.isValid() && lrcInstance_) + return bannedlist_.size(); return 0; } @@ -50,7 +80,7 @@ QVariant BannedListModel::data(const QModelIndex& index, int role) const { try { - auto contactList = lrcInstance_->getCurrentAccountInfo().contactModel->getBannedContacts(); + auto contactList = bannedlist_; if (!index.isValid() || contactList.size() <= index.row()) { return QVariant(); } @@ -114,5 +144,7 @@ void BannedListModel::reset() { beginResetModel(); + bannedlist_ = lrcInstance_->getCurrentAccountInfo().contactModel->getBannedContacts(); endResetModel(); + set_count(rowCount()); } diff --git a/src/app/bannedlistmodel.h b/src/app/bannedlistmodel.h index 0ee9ba28a..efd9e3179 100644 --- a/src/app/bannedlistmodel.h +++ b/src/app/bannedlistmodel.h @@ -24,6 +24,7 @@ class BannedListModel : public AbstractListModelBase { Q_OBJECT + QML_RO_PROPERTY(int, count) public: enum Role { ContactName = Qt::UserRole + 1, ContactID }; Q_ENUM(Role) @@ -48,5 +49,8 @@ public: /* * This function is to reset the model when there's new account added. */ - Q_INVOKABLE void reset(); + void reset(); + +private: + QList<QString> bannedlist_; }; diff --git a/src/app/commoncomponents/ConfirmDialog.qml b/src/app/commoncomponents/ConfirmDialog.qml index 2a2acb1e4..5c38fa323 100644 --- a/src/app/commoncomponents/ConfirmDialog.qml +++ b/src/app/commoncomponents/ConfirmDialog.qml @@ -70,7 +70,7 @@ BaseModalDialog { text: root.confirmLabel preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 - preferredHeight: JamiTheme.preferredFieldHeight + buttontextHeightMargin: JamiTheme.buttontextHeightMargin color: JamiTheme.buttonTintedRed hoveredColor: JamiTheme.buttonTintedRedHovered @@ -90,7 +90,7 @@ BaseModalDialog { Layout.alignment: Qt.AlignHCenter preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 - preferredHeight: JamiTheme.preferredFieldHeight + buttontextHeightMargin: JamiTheme.buttontextHeightMargin color: JamiTheme.buttonTintedBlack hoveredColor: JamiTheme.buttonTintedBlackHovered diff --git a/src/app/commoncomponents/ContactMessageDelegate.qml b/src/app/commoncomponents/ContactMessageDelegate.qml index 0e253db6c..03aa9625b 100644 --- a/src/app/commoncomponents/ContactMessageDelegate.qml +++ b/src/app/commoncomponents/ContactMessageDelegate.qml @@ -32,6 +32,8 @@ 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 + width: ListView.view ? ListView.view.width : 0 spacing: 2 topPadding: 12 diff --git a/src/app/commoncomponents/DeleteAccountDialog.qml b/src/app/commoncomponents/DeleteAccountDialog.qml index a4c2b5411..76c3257a3 100644 --- a/src/app/commoncomponents/DeleteAccountDialog.qml +++ b/src/app/commoncomponents/DeleteAccountDialog.qml @@ -128,7 +128,7 @@ BaseModalDialog { Layout.alignment: Qt.AlignHCenter preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 - preferredHeight: JamiTheme.preferredFieldHeight + buttontextHeightMargin: JamiTheme.buttontextHeightMargin color: JamiTheme.buttonTintedRed hoveredColor: JamiTheme.buttonTintedRedHovered @@ -168,7 +168,7 @@ BaseModalDialog { Layout.alignment: Qt.AlignHCenter preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 - preferredHeight: JamiTheme.preferredFieldHeight + buttontextHeightMargin: JamiTheme.buttontextHeightMargin color: JamiTheme.buttonTintedBlack hoveredColor: JamiTheme.buttonTintedBlackHovered diff --git a/src/app/mainview/components/JamiIdentifier.qml b/src/app/commoncomponents/JamiIdentifier.qml similarity index 84% rename from src/app/mainview/components/JamiIdentifier.qml rename to src/app/commoncomponents/JamiIdentifier.qml index 013797361..31310f639 100644 --- a/src/app/mainview/components/JamiIdentifier.qml +++ b/src/app/commoncomponents/JamiIdentifier.qml @@ -24,15 +24,13 @@ import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 -import "../../commoncomponents" -import "../../settingsview/components" - Item { id: root + property alias backgroundColor: outerRect.color + width: childrenRect.width - height: controlsLayout.height + usernameTextEdit.height - + 2 * JamiTheme.preferredMarginSize + height: controlsLayout.height + usernameTextEdit.height + 2 * JamiTheme.preferredMarginSize // Background rounded rectangle. Rectangle { @@ -44,7 +42,8 @@ Item { // Logo masked by outerRect. Item { anchors.fill: outerRect - layer.enabled: true; layer.effect: OpacityMask { maskSource: outerRect } + layer.enabled: true + layer.effect: OpacityMask { maskSource: outerRect } Rectangle { id: logoRect @@ -77,15 +76,16 @@ Item { RowLayout { id: controlsLayout - Layout.alignment: Qt.AlignTop | Qt.AlignRight - Layout.topMargin: JamiTheme.pushButtonMargin + Layout.alignment: Qt.AlignVCenter | Qt.AlignRight + Layout.topMargin: JamiTheme.pushButtonMargin / 2 Layout.rightMargin: JamiTheme.pushButtonMargin Layout.preferredHeight: childrenRect.height component JamiIdControlButton: PushButton { + property bool clicked: true preferredSize : 30 normalColor: JamiTheme.transparentColor - hoveredColor: JamiTheme.transparentColor + hoveredColor: JamiTheme.hoveredButtonColorWizard imageContainerWidth: JamiTheme.pushButtonSize imageContainerHeight: JamiTheme.pushButtonSize border.color: JamiTheme.tintedBlue @@ -127,7 +127,7 @@ Item { id: btnCopy source: JamiResources.content_copy_24dp_svg toolTipText: JamiStrings.copy - onClicked: UtilsAdapter.setClipboardText(CurrentAccount.bestId) + onClicked: UtilsAdapter.setClipboardText(usernameTextEdit.staticText) } JamiIdControlButton { @@ -138,6 +138,21 @@ Item { appWindow, "mainview/components/WelcomePageQrDialog.qml") } + + JamiIdControlButton { + id: btnId + source: JamiResources.key_black_24dp_svg + visible: CurrentAccount.registeredName !== "" + onClicked: { + if (clicked) { + usernameTextEdit.staticText = CurrentAccount.uri + } else { + usernameTextEdit.staticText = CurrentAccount.registeredName + } + + clicked = !clicked + } + } } UsernameTextEdit { diff --git a/src/app/commoncomponents/MaterialButton.qml b/src/app/commoncomponents/MaterialButton.qml index 71c31bb90..fd2de8347 100644 --- a/src/app/commoncomponents/MaterialButton.qml +++ b/src/app/commoncomponents/MaterialButton.qml @@ -48,9 +48,13 @@ AbstractButton { property var preferredWidth property real textLeftPadding property real textRightPadding - property real fontSize: JamiTheme.wizardViewButtonFontPixelSize + property real fontSize: JamiTheme.buttontextFontPixelSize property real textAlignment: Text.AlignHCenter + property real buttontextHeightMargin: JamiTheme.wizardButtonHeightMargin + height: buttontextHeightMargin + textButton.height + Layout.preferredHeight: height + Binding on width { when: root.preferredWidth !== undefined || root.Layout.fillWidth @@ -63,9 +67,10 @@ AbstractButton { value: width } - property real preferredHeight: JamiTheme.wizardButtonHeightMargin*2 + textButton.height - height: preferredHeight - Layout.preferredHeight: height + Binding on Layout.minimumHeight { + when: root.preferredHeight !== undefined + value: height + } hoverEnabled: true focusPolicy: Qt.TabFocus diff --git a/src/app/commoncomponents/MaterialRadioButton.qml b/src/app/commoncomponents/MaterialRadioButton.qml index e9a41ccd2..be4e48e83 100644 --- a/src/app/commoncomponents/MaterialRadioButton.qml +++ b/src/app/commoncomponents/MaterialRadioButton.qml @@ -27,18 +27,18 @@ RadioButton { id: root property string color: JamiTheme.textColor - - font.pointSize: JamiTheme.textFontSize + property string bgColor: "" indicator: Rectangle { id: rect anchors.left: parent.left anchors.verticalCenter: parent.verticalCenter + color: root.bgColor border { id: border color: JamiTheme.buttonTintedBlue - width: 2 + width: 1 } implicitWidth: 20 @@ -56,6 +56,13 @@ RadioButton { radius: 10 visible : checked || hovered + Behavior on visible { + NumberAnimation { + from: 0 + duration: JamiTheme.shortFadeDuration + } + } + color: JamiTheme.buttonTintedBlue HoverHandler { @@ -69,6 +76,7 @@ RadioButton { color: root.color leftPadding: root.indicator.width + root.spacing verticalAlignment: Text.AlignVCenter + font.pixelSize: JamiTheme.settingsDescriptionPixelSize } Keys.onPressed: function (event) { @@ -78,12 +86,4 @@ RadioButton { } } - onActiveFocusChanged: { - if (focus && !root.checked) { - border.width = 2.5 - } else { - border.width = 2 - } - } - } diff --git a/src/app/commoncomponents/MaterialTextField.qml b/src/app/commoncomponents/MaterialTextField.qml index 566dced72..776cf632d 100644 --- a/src/app/commoncomponents/MaterialTextField.qml +++ b/src/app/commoncomponents/MaterialTextField.qml @@ -132,7 +132,7 @@ TextField { width: parent.width height: visible ? 1 : 0 anchors.top: root.baseline - anchors.topMargin: root.font.pixelSize / 1.5 + anchors.topMargin: 10 color: isSwarmDetail ? textColor : root.accent visible: { if (!readOnly) { diff --git a/src/app/commoncomponents/PasswordTextEdit.qml b/src/app/commoncomponents/PasswordTextEdit.qml index 841ee2444..8082cd4e0 100644 --- a/src/app/commoncomponents/PasswordTextEdit.qml +++ b/src/app/commoncomponents/PasswordTextEdit.qml @@ -30,7 +30,7 @@ ModalTextEdit { prefixIconSrc: firstEntry ? JamiResources.lock_svg : JamiResources.round_edit_24dp_svg - suffixBisIconSrc: JamiResources.eye_cross_svg + suffixBisIconSrc: echoMode == TextInput.Password ? JamiResources.eye_cross_svg : JamiResources.noun_eye_svg suffixBisIconColor: JamiTheme.buttonTintedBlue placeholderText: JamiStrings.password diff --git a/src/app/commoncomponents/PreferenceItemDelegate.qml b/src/app/commoncomponents/PreferenceItemDelegate.qml index 609e70b3e..9304d6d03 100644 --- a/src/app/commoncomponents/PreferenceItemDelegate.qml +++ b/src/app/commoncomponents/PreferenceItemDelegate.qml @@ -161,7 +161,7 @@ ItemDelegate { visible: preferenceType === PreferenceItemListModel.PATH preferredWidth: root.width / 2 - 8 - preferredHeight: 30 + buttontextHeightMargin: JamiTheme.buttontextHeightMargin Layout.alignment: Qt.AlignRight | Qt.AlignVCenter Layout.rightMargin: 4 diff --git a/src/app/commoncomponents/PushButton.qml b/src/app/commoncomponents/PushButton.qml index de5d5ad34..11ec26212 100644 --- a/src/app/commoncomponents/PushButton.qml +++ b/src/app/commoncomponents/PushButton.qml @@ -38,7 +38,8 @@ AbstractButton { property int preferredSize: 30 property int preferredHeight: 0 property int preferredWidth: 0 - property int preferredMargin: 16 + property int preferredLeftMargin: 16 + property int preferredRightMargin: 16 // Note the radius will default to preferredSize property bool circled: true property alias radius: background.radius @@ -52,6 +53,7 @@ AbstractButton { property alias buttonTextColor: textContent.color property alias textHAlign: textContent.horizontalAlignment property bool buttonTextEnableElide: false + property alias alignement: textContent.horizontalAlignment property alias toolTipText: toolTip.text @@ -102,7 +104,7 @@ AbstractButton { anchors.centerIn: textContent.text ? undefined : root anchors.left: textContent.text ? root.left : undefined - anchors.leftMargin: textContent.text ? preferredMargin : 0 + anchors.leftMargin: textContent.text ? preferredLeftMargin : 0 anchors.verticalCenter: root.verticalCenter containerWidth: preferredWidth ? preferredWidth : preferredSize @@ -128,14 +130,12 @@ AbstractButton { Text { id: textContent - anchors.centerIn: image.status !== Image.Null ? undefined : root - anchors.left: image.status !== Image.Null ? image.right : undefined - - anchors.leftMargin: preferredMargin + anchors.left: image.status !== Image.Null ? image.right : root.left + anchors.leftMargin: preferredLeftMargin anchors.verticalCenter: root.verticalCenter anchors.right: buttonTextEnableElide ? root.right : undefined - anchors.rightMargin: preferredMargin + anchors.rightMargin: preferredRightMargin visible: text ? true : false @@ -144,7 +144,7 @@ AbstractButton { color: JamiTheme.primaryForegroundColor font.kerning: true - font.pointSize: 9 + font.pixelSize: 12 elide: Qt.ElideRight } @@ -152,15 +152,16 @@ AbstractButton { id: background radius: circled ? preferredSize : 5 + color: normalColor states: [ State { name: "checked"; when: checked - PropertyChanges { target: background; color: checkedColor } + PropertyChanges { target: background; color: checkedColor} }, State { name: "pressed"; when: pressed - PropertyChanges { target: background; color: pressedColor } + PropertyChanges { target: background; color: pressedColor} }, State { name: "hovered"; when: hovered || root.focus @@ -192,4 +193,12 @@ AbstractButton { ] } + + Keys.onPressed: function (keyEvent) { + if (keyEvent.key === Qt.Key_Enter || + keyEvent.key === Qt.Key_Return) { + clicked() + keyEvent.accepted = true + } + } } diff --git a/src/app/commoncomponents/SettingParaCombobox.qml b/src/app/commoncomponents/SettingParaCombobox.qml index 8f6657de6..4b3b90b1f 100644 --- a/src/app/commoncomponents/SettingParaCombobox.qml +++ b/src/app/commoncomponents/SettingParaCombobox.qml @@ -28,6 +28,7 @@ ComboBox { property string placeholderText property string currentSelectionText: currentText property string comboBoxBackgroundColor: JamiTheme.editBackgroundColor + property bool selection: currentIndex < 0 && !count MaterialToolTip { id: toolTip @@ -61,6 +62,7 @@ ComboBox { color: hovered ? JamiTheme.comboboxTextColorHovered : JamiTheme.textColor elide: Text.ElideRight verticalAlignment: Text.AlignVCenter + font.pointSize: JamiTheme.settingsFontSize } background: Rectangle { @@ -82,17 +84,17 @@ ComboBox { source: popup.visible ? JamiResources.expand_less_24dp_svg : JamiResources.expand_more_24dp_svg - color: JamiTheme.tintedBlue + color: JamiTheme.comboboxIconColor } contentItem: Text { leftPadding: root.indicator.width - + font.pixelSize: JamiTheme.settingsDescriptionPixelSize text: root.displayText - color: JamiTheme.textColor - + color: JamiTheme.comboboxTextColor + font.weight: Font.Medium verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter + horizontalAlignment: Text.AlignLeft elide: Text.ElideRight } @@ -100,9 +102,8 @@ ComboBox { id: selectOption color: JamiTheme.transparentColor implicitWidth: 120 - implicitHeight: 43 - border.color: popup.visible ? JamiTheme.comboboxBorderColorActive - : JamiTheme.comboboxBorderColor + implicitHeight: contentItem.implicitHeight + JamiTheme.buttontextHeightMargin + border.color: popup.visible ? JamiTheme.comboboxBorderColorActive : JamiTheme.comboboxBorderColor border.width: root.visualFocus ? 2 : 1 radius: 5 } diff --git a/src/app/commoncomponents/SimpleMessageDialog.qml b/src/app/commoncomponents/SimpleMessageDialog.qml index 44530f749..fa06c4dfa 100644 --- a/src/app/commoncomponents/SimpleMessageDialog.qml +++ b/src/app/commoncomponents/SimpleMessageDialog.qml @@ -91,7 +91,7 @@ BaseModalDialog { Layout.alignment: Qt.AlignVCenter preferredWidth: JamiTheme.preferredFieldWidth / 2 - preferredHeight: JamiTheme.preferredFieldHeight + buttontextHeightMargin: JamiTheme.buttontextHeightMargin color: { switch(buttonStyles[modelData]) { diff --git a/src/app/constant/JamiStrings.qml b/src/app/constant/JamiStrings.qml index 5ccdb4061..f99e498c0 100644 --- a/src/app/constant/JamiStrings.qml +++ b/src/app/constant/JamiStrings.qml @@ -81,7 +81,6 @@ Item { property string alias: qsTr("Alias") // AdvancedCallSettings - property string callSettings: qsTr("Call settings") property string allowCallsUnknownContacs: qsTr("Allow incoming calls from unknown contacts") property string rendezVous: qsTr("Convert your account into a rendezvous point") property string autoAnswerCalls: qsTr("Automatically answer calls") @@ -93,7 +92,6 @@ Item { property string audioFile: qsTr("Audio File (*.wav *.ogg *.opus *.mp3 *.aiff *.wma)") // AdvancedChatSettings - property string chatSettings: qsTr("Chat settings") property string enableReadReceipts: qsTr("Enable read receipts") property string enableReadReceiptsTooltip: qsTr("Send and receive receipts indicating that a message have been displayed") @@ -121,6 +119,7 @@ Item { property string selectPrivateKey: qsTr("Select a private key") property string selectUserCert: qsTr("Select a user certificate") property string selectCACert: qsTr("Select a CA certificate") + property string selectCACertDefault: qsTr("Select") property string keyFile: qsTr("Key File (*.key)") // AdvancedConnectivitySettings @@ -174,9 +173,14 @@ Item { property string accountSettingsTitle: qsTr("Account Settings") property string accountSettingsMenuTitle: qsTr("Account") property string generalSettingsTitle: qsTr("General") - property string pluginSettingsTitle: qsTr("Plugin") - property string avSettingsTitle: qsTr("Audio and Video Settings") - property string avSettingsMenuTitle: qsTr("Audio/Video") + property string pluginSettingsTitle: qsTr("Plugins") + property string enableAccountSettingsTitle: qsTr("Enable account") + property string manageAccountSettingsTitle: qsTr("Manage account") + property string linkedDevicesSettingsTitle: qsTr("Linked devices") + property string callSettingsTitle: qsTr("Call settings") + property string chatSettingsTitle: qsTr("Chat") + property string advancedSettingsTitle: qsTr("Advanced settings") + property string audioVideoSettingsTitle: qsTr("Audio and Video") // AudioSettings property string audio: qsTr("Audio") @@ -187,6 +191,7 @@ Item { property string ringtoneDevice: qsTr("Ringtone device") property string selectRingtoneOutputDevice: qsTr("Select ringtone output device") property string audioManager: qsTr("Audio manager") + property string soundTest: qsTr("Sound test") // VideoSettings property string video: qsTr("Video") @@ -340,6 +345,8 @@ Item { 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") @@ -406,7 +413,6 @@ Item { property string passwordOptional: qsTr("Encrypting your account with a password is optional, and if the password is lost it CANNOT be recovered later.") property string customizeOptional: qsTr("Setting a profile picture and nickname is optional, and can also be changed later in the settings.") - // CreateSIPAccountPage property string sipAccount: qsTr("SIP account") property string proxy: qsTr("Proxy") @@ -420,6 +426,19 @@ Item { 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 usernameAccountDescription: qsTr("Your username help you to be easily found and reach on Jami.\nIf you don’t choose one, the serial identifier (a randomly generated word of 40 characters) of your account will be your username. It’s more difficult to be found and reach with this number.") + 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") + property string saveAccountDescription: qsTr("Your Jami account exists only on this device.\nIf you lose your device or uninstall the application, your account will be lost. We recommend to back up it.") + property string deleteAccountTitle: qsTr("Delete your account") + property string deleteAccountDescription: qsTr("If your account has not been backed up or added to another device, your account and registered name will be irrevocably lost.") + property string linkedAccountList: qsTr("List of the devices that are linked to this account:") + property string linkedThisDevice: qsTr("This device") + property string linkedOtherDevices: qsTr("Other linked devices") + property string linkedAccountDescription: qsTr("You can link your account to an other device to be able to use it on the other device.") + // CurrentAccountSettings && AdvancedSettings property string backupSuccessful: qsTr("Backup successful") property string backupFailed: qsTr("Backup failed") @@ -428,18 +447,17 @@ Item { property string setPasswordSuccess: qsTr("Password set successfully") property string setPasswordFailed: qsTr("Password set failed") property string changePassword: qsTr("Change password") - property string setPassword: qsTr("Set password") + property string setPassword: qsTr("Encrypt account") property string setAPassword: qsTr("Set a password") property string changeCurrentPassword: qsTr("Change current password") property string tipBackupAccount: qsTr("Back up account to a .gz file") property string tipAdvancedSettingsDisplay: qsTr("Display advanced settings") property string tipAdvancedSettingsHide: qsTr("Hide advanced settings") - property string enableAccount: qsTr("Enable account") property string advancedAccountSettings: qsTr("Advanced account settings") property string encryptAccount: qsTr("Encrypt account with password") property string customizeProfile: qsTr("Customize profile") property string customizeProfileDescription: qsTr("This profile is only shared with this account's contacts.\nThe profile can be changed at all times from the account's settings.") - property string encryptTitle: qsTr("Encrypt your account with a password") + property string encryptTitle: qsTr("Encrypt account with a password") property string encryptDescription: qsTr("A Jami account is created and stored locally only on this device, as an archive containing your account keys. Access to this archive can optionally be protected by a password.") property string encryptWarning: qsTr("Please note that if you lose your password, it CANNOT be recovered!") property string enterNickname: qsTr("Enter a nickname, surname...") @@ -455,11 +473,10 @@ Item { // LinkedDevices property string tipLinkNewDevice: qsTr("Link a new device to this account") - property string linkAnotherDevice: qsTr("Link another device") + property string linkAnotherDevice: qsTr("Link a new device") property string linkNewDevice: qsTr("Exporting account…") property string removeDevice: qsTr("Remove Device") property string sureToRemoveDevice: qsTr("Are you sure you wish to remove this device?") - property string linkedDevices: qsTr("Linked Devices") property string yourPinIs: qsTr("Your PIN is:") property string linkDeviceNetWorkError: qsTr("Error connecting to the network.\nPlease try again later.") @@ -490,15 +507,19 @@ Item { property string keepMinimized: qsTr("Minimize on close") property string tipRunStartup: qsTr("Run at system startup") property string runStartup: qsTr("Launch at startup") - property string downloadFolder: qsTr("Download directory") + property string downloadFolder: qsTr("Choose download directory") property string tipChooseDownloadFolder: qsTr("Choose download directory") property string includeLocalVideo: qsTr("Include local video in recording") property string textZoom: qsTr("Text zoom") property string changeTextSize: qsTr("Change text size (%)") + property string defaultSettings: qsTr("Default settings") // ChatviewSettings - property string enableTypingIndicator: qsTr("Typing indicators") - property string displayHyperlinkPreviews: qsTr("Show link previews") + property string enableTypingIndicator: qsTr("Enable typing indicators") + property string enableTypingIndicatorDescription: qsTr("Send and receive typing indicators showing that a message is being typed.") + property string displayHyperlinkPreviews: qsTr("Show link preview in conversations") + property string displayHyperlinkPreviewsDescription: qsTr("Preview require to download content from this third-party servers.") + property string layout: qsTr("Layout") property string language: qsTr("User interface language") property string verticalViewOpt: qsTr("Vertical view") @@ -507,7 +528,7 @@ Item { // File transfer settings property string fileTransfer: qsTr("File transfer") property string autoAcceptFiles: qsTr("Automatically accept incoming files") - property string acceptTransferBelow: qsTr("Accept transfer limit") + property string acceptTransferBelow: qsTr("Accept transfer limit (in Mb)") property string acceptTransferTooltip: qsTr("in MB, 0 = unlimited") // JamiUserIdentity settings @@ -544,7 +565,7 @@ Item { property string troubleshootButton: qsTr("Open logs") property string troubleshootText: qsTr("Get logs") - property string experimentalCallSwarm: qsTr("(Experimental) Enable call support for swarm") + property string experimentalCallSwarm: qsTr("Enable small swarm groups support for Swarm") property string experimentalCallSwarmTooltip: qsTr("This feature will enable call buttons in swarms with multiple participants.") // Recording Settings @@ -558,7 +579,6 @@ Item { // KeyboardShortCutTable property string keyboardShortcutTableWindowTitle: qsTr("Keyboard Shortcut Table") property string keyboardShortcuts: qsTr("Keyboard Shortcuts") - property string generalKeyboardShortcuts: qsTr("General") property string conversationKeyboardShortcuts: qsTr("Conversation") property string callKeyboardShortcuts: qsTr("Call") property string settings: qsTr("Settings") @@ -572,7 +592,6 @@ Item { property string clearHistory: qsTr("Clear history") property string mediaSettings: qsTr("Media settings") property string generalSettings: qsTr("General settings") - property string accountSettings: qsTr("Account settings") property string pluginSettings: qsTr("Plugin settings") property string answerIncoming: qsTr("Answer an incoming call") property string declineCallRequest: qsTr("Decline the call request") @@ -727,8 +746,9 @@ Item { property string alreadyHaveAccount: qsTr("I already have an account") property string useExistingAccount: qsTr("Use existing Jami account") property string welcomeToJami: qsTr("Welcome to Jami") - property string identifierDescription: qsTr("Share this Jami identifier to be contacted on this account!") - property string hereIsIdentifier: qsTr("Here is your Jami identifier, don't hesitate to share it in order to be contacted more easily!") + + + // SmartList property string clearText: qsTr("Clear Text") @@ -752,6 +772,7 @@ Item { property string optionDelete: qsTr("Delete") property string optionRemove: qsTr("Remove") property string optionBlock: qsTr("Block") + property string optionUnban: qsTr("Unban") // Conference moderation property string setModerator: qsTr("Set moderator") @@ -769,6 +790,7 @@ Item { property string enableLocalModerators: qsTr("Enable local moderators") property string enableAllModerators: qsTr("Make all participants moderators") property string addDefaultModerator: qsTr("Add default moderator") + property string addModerator: qsTr("Add") property string removeDefaultModerator: qsTr("Remove default moderator") // Daemon reconnection @@ -856,4 +878,34 @@ Item { property string deleteReplyMessage: qsTr("*(Deleted Message)*") property string editMessage: qsTr("Edit message") + //Jami identifier + property string identifierDescription: qsTr("Share this Jami identifier to be contacted on this account!") + property string hereIsIdentifier: qsTr("Here is your Jami identifier, don't hesitate to share it in order to be contacted more easily!") + property string jamiIdentity: qsTr("Jami identity") + + //New settings + //ManageAccount + property string enableAccountDescription: qsTr("Enabling your account allows you to be contacted on Jami") + + //General + property string appearence: qsTr("Appearence") + + //system + property string experimental: qsTr("Experimental") + + //ringtone + property string ringtone: qsTr("Ringtone") + + //rdv + property string rendezVousPoint: qsTr("Rendezvous point") + + //moderation + property string moderation: qsTr("Moderation") + + //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 967c6c970..a76312658 100644 --- a/src/app/constant/JamiTheme.qml +++ b/src/app/constant/JamiTheme.qml @@ -63,6 +63,7 @@ Item { property color darkGreyColor: "#272727" property color darkGreyColorOpacity: "#be272727" // 77% property color tintedBlue: darkTheme ? "#03B9E9" : "#005699" + property color sysColor: "#F0EFEF" property color transparentColor: "transparent" property color primaryForegroundColor: darkTheme ? whiteColor : blackColor @@ -131,7 +132,7 @@ Item { property color primaryTextColor: darkTheme ? "black" : "white" property color secAndTertiTextColor: buttonTintedBlue - property color secondaryButtonBorderColor: darkTheme ? "#03B9E9" : "#E5EEF5" + property color secondaryButtonBorderColor: darkTheme ? "#1D5F70" : "#A3C2DA" property color secondaryButtonHoveredBorderColor: tintedBlue property color secAndTertiHoveredBackgroundColor: darkTheme ? "#123F4A" : "#E5EEF5" property color closeButtonLighterBlack: "#4c4c4c" @@ -146,11 +147,12 @@ Item { //Combobox property color comboBoxBackgroundColor: darkTheme ? editBackgroundColor : selectedColor - property color comboboxBorderColorActive: tintedBlue + property color comboboxBorderColorActive: darkTheme ? "#03B9E9" : "#005699" property color comboboxBorderColor: darkTheme ? "#1D5F70" : "#A3C2DA" - property color comboboxTextColorHovered: tintedBlue + property color comboboxIconColor: darkTheme ? "#03B9E9" : "#005699" property color comboboxBackgroundColorHovered: darkTheme ? "#123F4A" : "#E5EEF5" - + property color comboboxTextColor: darkTheme ? "#03B9E9" : "#005699" + property color comboboxTextColorHovered: tintedBlue //Spinbox property color spinboxBackgroundColor: darkTheme ? editBackgroundColor : selectedColor @@ -352,11 +354,15 @@ Item { property int menuItemsCommonBorderWidth: 1 property int menuBorderPreferredHeight: 8 - property real maximumWidthSettingsView: 600 + property real maximumWidthSettingsView: 516 property real settingsHeaderpreferredHeight: 64 property real preferredFieldWidth: 256 - property real preferredFieldHeight: 32 + property real preferredFieldHeight: 36 + property real preferredButtonSettingsHeight: 46 property real preferredMarginSize: 16 + property real preferredSettingsMarginSize: 40 + property real preferredSettingsContentMarginSize: 30 + property real preferredSettingsBottomMarginSize: 30 property real settingsMarginSize: 8 property real preferredDialogWidth: 400 property real preferredDialogHeight: 300 @@ -479,6 +485,7 @@ Item { property real jamiIdLogoWidth: 70 property real jamiIdLogoHeight: 24 property real jamiIdFontSize: calcSize(13) + property color jamiIdColor: darkTheme ? blackColor : sysColor // MainView property color welcomeViewBackgroundColor: darkTheme ? lightGrey_ : secondaryBackgroundColor @@ -510,7 +517,7 @@ Item { property real welcomeLogoWidth: 100 property real welcomeLogoHeight: 100 property real wizardButtonWidth: 400 - property real wizardButtonHeightMargin: 13 + property real wizardButtonHeightMargin: 31 // WizardView Advanced Account Settings property color lightBlue_: darkTheme ? "#03B9E9" : "#e5eef5" @@ -557,6 +564,8 @@ Item { //MaterialButton property real buttontextPadding: 10 property real buttontextWizzardPadding: 30 + property real buttontextHeightMargin: 21 + property real buttontextFontPixelSize: calcSize(15) // UsernameTextEdit property real usernameTextEditPointSize:calcSize(9 + fontSizeOffset) @@ -590,6 +599,21 @@ Item { property real contactEventPointSize: calcSize(10 + fontSizeOffset) property int contactMessageAvatarSize: 24 + // Settings + property int settingMenuPixelSize: calcSize(13) + property int settingToggleDescrpitonPixelSize: calcSize(13) + property int settingsTitlePixelSize: calcSize(22) + property int settingsHeaderPixelSize: calcSize(26) + property int settingsDescriptionPixelSize: calcSize(15) + property int settingsCategorySpacing: 15 + property int settingsCategoryAudioVideoSpacing: 6 + property int settingsBoxRadius: 10 + property int settingsBlockSpacing: 40 + property int settingsMenuChildrenButtonHeight: 30 + property int settingsMenuHeaderButtonHeight: 50 + property int settingsListViewsSpacing: 10 + + function setTheme(dark) { darkTheme = dark diff --git a/src/app/currentaccount.cpp b/src/app/currentaccount.cpp index df68a6023..f5083f280 100644 --- a/src/app/currentaccount.cpp +++ b/src/app/currentaccount.cpp @@ -35,6 +35,16 @@ CurrentAccount::CurrentAccount(LRCInstance* lrcInstance, this, &CurrentAccount::onAccountUpdated); + + connect(lrcInstance_->getCurrentContactModel(), + &ContactModel::bannedStatusChanged, + this, + [&](const auto&, auto) { + set_hasBannedContacts( + lrcInstance_->getCurrentAccountInfo().contactModel->getBannedContacts().size()); + }, + Qt::UniqueConnection); + connect(lrcInstance_, &LRCInstance::currentAccountIdChanged, [this] { updateData(); }); updateData(); @@ -105,6 +115,8 @@ CurrentAccount::updateData() set_bestId(lrcInstance_->accountModel().bestIdForAccount(id_)); set_bestName(lrcInstance_->accountModel().bestNameForAccount(id_)); set_hasAvatarSet(!accInfo.profileInfo.avatar.isEmpty()); + set_hasBannedContacts( + lrcInstance_->getCurrentAccountInfo().contactModel->getBannedContacts().size()); set_status(accInfo.status); set_type(accInfo.profileInfo.type); diff --git a/src/app/currentaccount.h b/src/app/currentaccount.h index 8b345e24c..2ad1f7eaa 100644 --- a/src/app/currentaccount.h +++ b/src/app/currentaccount.h @@ -108,6 +108,7 @@ class CurrentAccount final : public QObject QML_RO_PROPERTY(QString, bestName) QML_RO_PROPERTY(QString, managerUri) QML_RO_PROPERTY(bool, hasAvatarSet) + QML_RO_PROPERTY(bool, hasBannedContacts) QML_PROPERTY(bool, enabled) QML_RO_PROPERTY(lrc::api::account::Status, status) QML_RO_PROPERTY(lrc::api::profile::Type, type) diff --git a/src/app/mainview/components/KeyboardShortcutTable.qml b/src/app/mainview/components/KeyboardShortcutTable.qml index 8bba7e509..95287eb0c 100644 --- a/src/app/mainview/components/KeyboardShortcutTable.qml +++ b/src/app/mainview/components/KeyboardShortcutTable.qml @@ -239,7 +239,7 @@ Window { text: { switch (selectionBar.currentIndex) { case 0: - return JamiStrings.generalKeyboardShortcuts + return JamiStrings.generalSettingsTitle case 1: return JamiStrings.conversationKeyboardShortcuts case 2: diff --git a/src/app/mainview/components/SipInputPanel.qml b/src/app/mainview/components/SipInputPanel.qml index 40eae173c..bd0688ac8 100644 --- a/src/app/mainview/components/SipInputPanel.qml +++ b/src/app/mainview/components/SipInputPanel.qml @@ -64,7 +64,8 @@ Popup { Layout.preferredWidth: 30 Layout.preferredHeight: 30 - preferredMargin: 8 + preferredLeftMargin: 8 + preferredRightMargin: 8 buttonText: modelData buttonTextColor: "white" checkable: false diff --git a/src/app/mainview/components/SwarmDetailsPanel.qml b/src/app/mainview/components/SwarmDetailsPanel.qml index 0c41b9b04..c0bd646d8 100644 --- a/src/app/mainview/components/SwarmDetailsPanel.qml +++ b/src/app/mainview/components/SwarmDetailsPanel.qml @@ -265,7 +265,6 @@ Rectangle { checked: CurrentConversation.ignoreNotifications labelText: JamiStrings.muteConversation - fontPointSize: JamiTheme.settingsFontSize tooltipText: JamiStrings.ignoreNotificationsTooltip diff --git a/src/app/mainview/components/UserProfile.qml b/src/app/mainview/components/UserProfile.qml index 7f4562d34..b989dc5a1 100644 --- a/src/app/mainview/components/UserProfile.qml +++ b/src/app/mainview/components/UserProfile.qml @@ -203,7 +203,7 @@ BaseModalDialog { Layout.alignment: Qt.AlignHCenter preferredWidth: JamiTheme.preferredFieldWidth / 2 - preferredHeight: JamiTheme.preferredFieldHeight + buttontextHeightMargin: JamiTheme.buttontextHeightMargin color: JamiTheme.buttonTintedBlack hoveredColor: JamiTheme.buttonTintedBlackHovered diff --git a/src/app/positionmanager.cpp b/src/app/positionmanager.cpp index 2f99053ea..f968007f0 100644 --- a/src/app/positionmanager.cpp +++ b/src/app/positionmanager.cpp @@ -185,7 +185,7 @@ void PositionManager::sharePosition(int maximumTime, QString accountId, QString convId) { try { - if (settingsManager_->getValue(Settings::Key::PositionShareLimit) == true) + if (settingsManager_->getValue(Settings::Key::PositionShareDuration) != 0) startPositionTimers(maximumTime); positionShareConvIds_.append(PositionKey {accountId, convId}); set_positionShareConvIdsCount(positionShareConvIds_.size()); diff --git a/src/app/settingsview/SettingsSidePanel.qml b/src/app/settingsview/SettingsSidePanel.qml index 930178e65..8bc60a5b3 100644 --- a/src/app/settingsview/SettingsSidePanel.qml +++ b/src/app/settingsview/SettingsSidePanel.qml @@ -32,21 +32,23 @@ SidePanelBase { id: root objectName: "SettingsSidePanel" - property var select: function(index) { - buttonGroup.checkedButton = buttonGroup.buttons[index] - } - property var deselect: function() { buttonGroup.checkedButton = null } - color: JamiTheme.backgroundColor + property int currentIndex + + + function createChild() { + if (page.menu === undefined) { + return + } + page.menu.createChild() + } Page { id: page anchors.fill: parent - background: Rectangle { - color: JamiTheme.backgroundColor - } + background: null header: AccountComboBox {} @@ -55,76 +57,245 @@ SidePanelBase { target: JamiQmlUtils function onSettingsPageRequested(index) { viewCoordinator.present("SettingsView") + buttonGroup.checkedButton = buttonGroup.buttons[index] } } - ButtonGroup { - id: buttonGroup - buttons: settingsButtons.children + property var menu: undefined + + Flickable { + id: flick + width: root.width + height: childrenRect.height + clip: true + 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": "isWindows" + } + ] + },{ + "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()}); + } - onCheckedButtonChanged: { - for (var i = 0; i < buttons.length; i++) - if (buttons[i] === checkedButton) { - indexSelected(i) - return - } - indexSelected(-1) } - } + Component { + id: clv - Column { - id: settingsButtons + Repeater { + id: repeater - spacing: 0 - anchors.left: parent.left - anchors.right: parent.right - height: childrenRect.height + property var base: ({}) + property var selected: null + model: Object.keys(base) + Layout.fillWidth: true + + function createChild() { + itemAt(0).children[0].createChild() + root.currentIndex = 0 + } - component SMB: PushButton { - normalColor: root.color + ColumnLayout { + id: clvButtons + spacing: 0 + Layout.fillWidth: true - preferredHeight: 64 - preferredMargin: 24 + PushButton { + id: btn + property var sprite: null - anchors.left: parent.left - anchors.right: parent.right + property var isChildren: { + var ob = base[modelData] + var c = ob["children"] + return c === undefined + } - buttonTextFont.pointSize: JamiTheme.textFontSize + 2 - textHAlign: Text.AlignLeft + function updateVisibility() { + var currentVisibility = visible + var ob = base[modelData] + var c = ob["visible"] + if (c === undefined) + return true + var res = false + if (c === "isWindows") { + res = Qt.platform.os.toString() === "windows" + } else if (c === "isJamiAccount") { + res = CurrentAccount.type !== Profile.Type.SIP + } else { + 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) + } - imageColor: JamiTheme.textColor - imageContainerHeight: 40 - imageContainerWidth: 40 + return res + } - pressedColor: Qt.lighter(JamiTheme.pressedButtonColor, 1.25) - checkedColor: JamiTheme.smartListSelectedColor - hoveredColor: JamiTheme.smartListHoveredColor - duration: 0 - checkable: true - radius: 0 - } + function createChild() { + var ob = base[modelData] + if(sprite === null) { + //deselect the current selection and collapse menu + if (repeater.selected) + repeater.selected.destroy() - SMB { - buttonText: JamiStrings.accountSettingsMenuTitle - source: JamiResources.account_24dp_svg - } + 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"] + } else { + indexSelected(ob["id"]) + root.currentIndex = ob["id"] + } + } + } - SMB { - buttonText: JamiStrings.generalSettingsTitle - source: JamiResources.gear_black_24dp_svg - } + visible: updateVisibility() - SMB { - buttonText: JamiStrings.avSettingsMenuTitle - source: JamiResources.media_black_24dp_svg - } + property bool isOpen: !isChildren && sprite != null + property bool isChildOpen: isChildren && (base[modelData]["id"] === root.currentIndex) + + alignement: Text.AlignLeft + Layout.preferredWidth: root.width - (isChildren ? 28 : 0) + Layout.leftMargin: isChildren ? 28 : 0 + preferredLeftMargin: isChildren ? 47 : 25 + + imageContainerWidth: !isChildren ? 30 : 0 + height: isChildren ? JamiTheme.settingsMenuChildrenButtonHeight : JamiTheme.settingsMenuHeaderButtonHeight + + circled: false + radius: 0 - SMB { - buttonText: JamiStrings.pluginSettingsTitle - source: JamiResources.plugin_settings_black_24dp_svg + buttonText: { + return base[modelData]["title"] + } + + buttonTextFont.pixelSize: !isChildren ? JamiTheme.settingsDescriptionPixelSize : JamiTheme.settingMenuPixelSize + buttonTextColor: isOpen || isChildOpen ? JamiTheme.tintedBlue : JamiTheme.primaryForegroundColor + buttonTextFont.weight: isOpen || isChildOpen ? Font.Medium : Font.Normal + buttonTextEnableElide: true + + normalColor: isOpen ? JamiTheme.smartListSelectedColor : "transparent" + hoveredColor: JamiTheme.smartListHoveredColor + imageColor: !isChildren ? JamiTheme.tintedBlue : null + + source: { + + if (!isChildren) + 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 + } + } + } + } + } } } + } } diff --git a/src/app/settingsview/SettingsView.qml b/src/app/settingsview/SettingsView.qml index 9c6ff4b4f..68dbb17b2 100644 --- a/src/app/settingsview/SettingsView.qml +++ b/src/app/settingsview/SettingsView.qml @@ -23,10 +23,13 @@ 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 { @@ -34,9 +37,21 @@ ListSelectionView { objectName: "SettingsView" enum SettingsMenu { - Account, - General, - Media, + ManageAccount, + CustomizeProfile, + LinkedDevices, + AdvancedSettings, + System, + CallSettings, + Appearence, + LocationSharing, + FileTransfer, + CallRecording, + Troubleshoot, + Update, + Audio, + Video, + Screensharing, Plugin } @@ -56,157 +71,62 @@ ListSelectionView { } } - selectionFallback: true + Component.onCompleted: { + leftPaneItem.createChild() + } + property int selectedMenu: index + onSelectedMenuChanged: { - if (selectedMenu === SettingsView.Account) { - pageIdCurrentAccountSettings.updateAccountInfoDisplayed() - } else if (selectedMenu === SettingsView.Media) { + if (selectedMenu === SettingsView.Media) { avSettings.populateAVSettings() } } - rightPaneItem: Rectangle { + rightPaneItem: StackLayout { id: settingsViewRect + currentIndex: selectedMenu !== -1 ? selectedMenu : 0 anchors.fill: parent - color: JamiTheme.secondaryBackgroundColor signal stopBooth - property bool isSIP: { - switch (CurrentAccount.type) { - case Profile.Type.SIP: - return true; - default: - return false; - } - } + property bool isSIP: CurrentAccount.type === Profile.Type.SIP - SettingsHeader { - id: settingsHeader - - anchors.top: settingsViewRect.top - anchors.left: settingsViewRect.left - anchors.leftMargin: { - var pageWidth = rightSettingsStackLayout.itemAt( - rightSettingsStackLayout.currentIndex).contentWidth - return (settingsViewRect.width - pageWidth) / 2 + JamiTheme.preferredMarginSize - } - - height: JamiTheme.settingsHeaderpreferredHeight - - title: { - switch(selectedMenu){ - default: - case SettingsView.Account: - return JamiStrings.accountSettingsTitle - case SettingsView.General: - return JamiStrings.generalSettingsTitle - case SettingsView.Media: - return JamiStrings.avSettingsTitle - case SettingsView.Plugin: - return JamiStrings.pluginSettingsTitle - } - } - - onBackArrowClicked: viewNode.dismiss() + ManageAccountPage { + isSIP: settingsViewRect.isSIP + onNavigateToMainView: dismiss() + onNavigateToNewWizardView: dismiss() } - JamiFlickable { - id: settingsViewScrollView - - anchors.top: settingsHeader.bottom - anchors.horizontalCenter: settingsViewRect.horizontalCenter - - height: settingsViewRect.height - settingsHeader.height - width: settingsViewRect.width - - contentHeight: rightSettingsStackLayout.height - - StackLayout { - id: rightSettingsStackLayout - - anchors.centerIn: parent - - width: settingsViewScrollView.width - - property int pageIdCurrentAccountSettingsPage: 0 - property int pageIdGeneralSettingsPage: 1 - property int pageIdAvSettingPage: 2 - property int pageIdPluginSettingsPage: 3 - - currentIndex: { - switch(selectedMenu){ - default: - case SettingsView.Account: - return pageIdCurrentAccountSettingsPage - case SettingsView.General: - return pageIdGeneralSettingsPage - case SettingsView.Media: - return pageIdAvSettingPage - case SettingsView.Plugin: - return pageIdPluginSettingsPage - } - } - - Component.onCompleted: { - // avoid binding loop - height = Qt.binding(function (){ - return Math.max( - rightSettingsStackLayout.itemAt(currentIndex).preferredHeight, - settingsViewScrollView.height) - }) - } - - // current account setting scroll page, index 0 - CurrentAccountSettings { - id: pageIdCurrentAccountSettings - - Layout.alignment: Qt.AlignCenter - - isSIP: settingsViewRect.isSIP - - onNavigateToMainView: dismiss() - Connections { - target: LRCInstance - - function onAccountListChanged() { - if (!UtilsAdapter.getAccountListSize()) { - viewCoordinator.requestAppWindowWizardView() - } - } - } - - onAdvancedSettingsToggled: function (settingsVisible) { - if (settingsVisible) - settingsViewScrollView.contentY = getAdvancedSettingsScrollPosition() - else - settingsViewScrollView.contentY = 0 - } - } - - // general setting page, index 1 - GeneralSettingsPage { - id: generalSettings - - Layout.alignment: Qt.AlignCenter - } - - // av setting page, index 2 - AvSettingPage { - id: avSettings - - Layout.alignment: Qt.AlignCenter - } - - // plugin setting page, index 3 - PluginSettingsPage { - id: pluginSettings - - Layout.alignment: Qt.AlignCenter - } - } - } + CustomizeProfilePage {} + + LinkedDevicesPage {} + + CallSettingsPage {} + + AdvancedSettingsPage {} + + SystemSettingsPage {} + + AppearenceSettingsPage {} + + LocationSharingSettingsPage {} + + FileTransferSettingsPage{} + + CallRecordingSettingsPage {} + + TroubleshootSettingsPage {} + + UpdatesSettingsPage {} + + AudioSettingsPage {} + + VideoSettingsPage {} + + ScreenSharingSettingsPage {} + + PluginSettingsPage {} } } diff --git a/src/app/settingsview/components/AdvancedCallSettings.qml b/src/app/settingsview/components/AdvancedCallSettings.qml deleted file mode 100644 index 324f270fd..000000000 --- a/src/app/settingsview/components/AdvancedCallSettings.qml +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Copyright (C) 2020-2023 Savoir-faire Linux Inc. - * Author: Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com> - * Author: Albert Babà Oller <albert.babi@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 - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * 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" -import "../../mainview/components" -import "../../mainview/js/contactpickercreation.js" as ContactPickerCreation - -ColumnLayout { - id: root - - property bool isSIP - property int itemWidth - - function updateAndShowModeratorsSlot() { - moderatorListWidget.model.reset() - moderatorListWidget.visible = moderatorListWidget.model.rowCount() > 0 - } - - Connections { - target: ContactAdapter - - function onDefaultModeratorsUpdated() { - updateAndShowModeratorsSlot() - } - } - - ElidedTextLabel { - Layout.fillWidth: true - - eText: JamiStrings.callSettings - fontSize: JamiTheme.headerFontSize - maxWidth: width - } - - ColumnLayout { - Layout.fillWidth: true - Layout.leftMargin: JamiTheme.preferredMarginSize - - ToggleSwitch { - id: checkBoxUntrusted - visible: !root.isSIP - - labelText: JamiStrings.allowCallsUnknownContacs - fontPointSize: JamiTheme.settingsFontSize - - checked: CurrentAccount.PublicInCalls_DHT - - onSwitchToggled: CurrentAccount.PublicInCalls_DHT = checked - } - - ToggleSwitch { - id: checkBoxAutoAnswer - - labelText: JamiStrings.autoAnswerCalls - fontPointSize: JamiTheme.settingsFontSize - - checked: CurrentAccount.autoAnswer - - onSwitchToggled: CurrentAccount.autoAnswer = checked - } - - ToggleSwitch { - id: checkBoxCustomRingtone - - labelText: JamiStrings.enableCustomRingtone - fontPointSize: JamiTheme.settingsFontSize - - checked: CurrentAccount.ringtoneEnabled_Ringtone - - onSwitchToggled: CurrentAccount.ringtoneEnabled_Ringtone = checked - } - - SettingMaterialButton { - id: btnRingtone - - Layout.fillWidth: true - Layout.minimumHeight: JamiTheme.preferredFieldHeight - - enabled: checkBoxCustomRingtone.checked - - textField: UtilsAdapter.toFileInfoName(CurrentAccount.ringtonePath_Ringtone) - - titleField: JamiStrings.selectCustomRingtone - source: JamiResources.round_folder_24dp_svg - 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] - }) - dlg.fileAccepted.connect(function (file) { - var url = UtilsAdapter.getAbsPath(file.toString()) - if(url.length !== 0) { - CurrentAccount.ringtonePath_Ringtone = url - } - }) - } - } - - ToggleSwitch { - id: checkBoxRdv - - visible: !isSIP - - labelText: JamiStrings.rendezVous - fontPointSize: JamiTheme.settingsFontSize - - checked: CurrentAccount.isRendezVous - - onSwitchToggled: CurrentAccount.isRendezVous = checked - } - - ToggleSwitch { - id: toggleLocalModerators - - labelText: JamiStrings.enableLocalModerators - fontPointSize: JamiTheme.settingsFontSize - - checked: CurrentAccount.isLocalModeratorsEnabled - - onSwitchToggled: CurrentAccount.isLocalModeratorsEnabled = checked - } - - ElidedTextLabel { - Layout.fillWidth: true - - eText: JamiStrings.defaultModerators - fontSize: JamiTheme.settingsFontSize - maxWidth: root.width - JamiTheme.preferredFieldHeight - - JamiTheme.preferredMarginSize * 4 - } - - JamiListView { - id: moderatorListWidget - - Layout.fillWidth: true - Layout.preferredHeight: 160 - - visible: model.rowCount() > 0 - - model: ModeratorListModel { - lrcInstance: LRCInstance - } - - delegate: ContactItemDelegate { - id: moderatorListDelegate - - width: moderatorListWidget.width - height: 74 - - contactName: ContactName - contactID: ContactID - - btnImgSource: JamiResources.round_remove_circle_24dp_svg - btnToolTip: JamiStrings.removeDefaultModerator - - onClicked: moderatorListWidget.currentIndex = index - onBtnContactClicked: { - AccountAdapter.setDefaultModerator( - LRCInstance.currentAccountId, contactID, false) - updateAndShowModeratorsSlot() - } - } - } - - MaterialButton { - id: addDefaultModeratorPushButton - - Layout.alignment: Qt.AlignCenter - - preferredWidth: JamiTheme.preferredFieldWidth - preferredHeight: JamiTheme.preferredFieldHeight - - color: JamiTheme.buttonTintedBlack - hoveredColor: JamiTheme.buttonTintedBlackHovered - pressedColor: JamiTheme.buttonTintedBlackPressed - secondary: true - toolTipText: JamiStrings.addDefaultModerator - - iconSource: JamiResources.round_add_24dp_svg - - text: JamiStrings.addDefaultModerator - - onClicked: { - ContactPickerCreation.presentContactPickerPopup( - ContactList.CONVERSATION, - appWindow) - } - } - - ToggleSwitch { - id: checkboxAllModerators - - labelText: JamiStrings.enableAllModerators - fontPointSize: JamiTheme.settingsFontSize - - checked: CurrentAccount.isAllModeratorsEnabled - - onSwitchToggled: CurrentAccount.isAllModeratorsEnabled = checked - } - } -} diff --git a/src/app/settingsview/components/AdvancedChatSettings.qml b/src/app/settingsview/components/AdvancedChatSettings.qml index a0cf8ba19..0544875bd 100644 --- a/src/app/settingsview/components/AdvancedChatSettings.qml +++ b/src/app/settingsview/components/AdvancedChatSettings.qml @@ -1,6 +1,6 @@ /* - * Copyright (C) 2021-2023 Savoir-faire Linux Inc. - * Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com> + * Copyright (C) 2020-2023 Savoir-faire Linux Inc. + * Author: Franck Laurent <franck.laurent@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 @@ -19,6 +19,7 @@ import QtQuick import QtQuick.Layouts +import net.jami.Models 1.1 import net.jami.Adapters 1.1 import net.jami.Constants 1.1 @@ -28,29 +29,32 @@ ColumnLayout { id: root property int itemWidth + spacing: JamiTheme.settingsCategorySpacing - ElidedTextLabel { - Layout.fillWidth: true + Text { - eText: JamiStrings.chatSettings - fontSize: JamiTheme.headerFontSize - maxWidth: width - } + Layout.alignment: Qt.AlignLeft + Layout.preferredWidth: parent.width + text: JamiStrings.chatSettingsTitle + color: JamiTheme.textColor + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + wrapMode : Text.WordWrap - ColumnLayout { - Layout.fillWidth: true - Layout.leftMargin: JamiTheme.preferredMarginSize + font.pixelSize: JamiTheme.settingsTitlePixelSize + font.kerning: true + } - ToggleSwitch { - id: checkBoxSendDisplayed + ToggleSwitch { + id: checkBoxSendDisplayed - tooltipText: JamiStrings.enableReadReceiptsTooltip - labelText: JamiStrings.enableReadReceipts - fontPointSize: JamiTheme.settingsFontSize + tooltipText: JamiStrings.enableReadReceiptsTooltip + labelText: JamiStrings.enableReadReceipts + descText: JamiStrings.enableReadReceiptsTooltip - checked: CurrentAccount.sendReadReceipt + checked: CurrentAccount.sendReadReceipt - onSwitchToggled: CurrentAccount.sendReadReceipt = checked - } + onSwitchToggled: CurrentAccount.sendReadReceipt = checked } + } diff --git a/src/app/settingsview/components/AdvancedConnectivitySettings.qml b/src/app/settingsview/components/AdvancedConnectivitySettings.qml index a595b9db2..a29bfd072 100644 --- a/src/app/settingsview/components/AdvancedConnectivitySettings.qml +++ b/src/app/settingsview/components/AdvancedConnectivitySettings.qml @@ -30,19 +30,25 @@ ColumnLayout { property int itemWidth property bool isSIP + spacing: JamiTheme.settingsCategorySpacing - ElidedTextLabel { - Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.preferredFieldHeight + Text { + id: enableAccountTitle + + Layout.alignment: Qt.AlignLeft - eText: JamiStrings.connectivity - fontSize: JamiTheme.headerFontSize - maxWidth: width + text: JamiStrings.connectivity + color: JamiTheme.textColor + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + wrapMode : Text.WordWrap + + font.pixelSize: JamiTheme.settingsTitlePixelSize + font.kerning: true } ColumnLayout { Layout.fillWidth: true - Layout.leftMargin: JamiTheme.preferredMarginSize ToggleSwitch { id: autoRegistrationAfterExpired @@ -51,10 +57,7 @@ ColumnLayout { visible: isSIP labelText: JamiStrings.autoRegistration - fontPointSize: JamiTheme.settingsFontSize - checked: CurrentAccount.keepAliveEnabled - onSwitchToggled: CurrentAccount.keepAliveEnabled = checked } @@ -69,7 +72,6 @@ ColumnLayout { topValue: 7*24*3600 valueField: CurrentAccount.registrationExpire - onNewValue: CurrentAccount.registrationExpire = valueField } @@ -84,7 +86,6 @@ ColumnLayout { topValue: 65535 valueField: CurrentAccount.localPort - onNewValue: CurrentAccount.localPort = valueField } @@ -94,10 +95,7 @@ ColumnLayout { Layout.fillWidth: true labelText: JamiStrings.useUPnP - fontPointSize: JamiTheme.settingsFontSize - checked: CurrentAccount.upnpEnabled - onSwitchToggled: CurrentAccount.upnpEnabled = checked } @@ -107,10 +105,7 @@ ColumnLayout { Layout.fillWidth: true labelText: JamiStrings.useTURN - fontPointSize: JamiTheme.settingsFontSize - checked: CurrentAccount.enable_TURN - onSwitchToggled: CurrentAccount.enable_TURN = checked } @@ -118,12 +113,9 @@ ColumnLayout { id: lineEditTurnAddress Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.preferredFieldHeight enabled: checkBoxTurnEnable.checked - staticText: CurrentAccount.server_TURN - itemWidth: root.itemWidth titleField: JamiStrings.turnAdress @@ -134,12 +126,9 @@ ColumnLayout { id: lineEditTurnUsername Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.preferredFieldHeight enabled: checkBoxTurnEnable.checked - staticText: CurrentAccount.username_TURN - itemWidth: root.itemWidth titleField: JamiStrings.turnUsername @@ -150,12 +139,9 @@ ColumnLayout { id: lineEditTurnPassword Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.preferredFieldHeight enabled: checkBoxTurnEnable.checked - staticText: CurrentAccount.password_TURN - itemWidth: root.itemWidth titleField: JamiStrings.turnPassword @@ -166,12 +152,9 @@ ColumnLayout { id: lineEditTurnRealmSIP Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.preferredFieldHeight enabled: checkBoxTurnEnable.checked - staticText: CurrentAccount.realm_TURN - itemWidth: root.itemWidth titleField: JamiStrings.turnRealm @@ -184,8 +167,6 @@ ColumnLayout { Layout.fillWidth: true labelText: JamiStrings.useSTUN - fontPointSize: JamiTheme.settingsFontSize - visible: isSIP checked: CurrentAccount.enable_STUN @@ -200,9 +181,7 @@ ColumnLayout { enabled: checkBoxSTUNEnable.checked visible: isSIP - staticText: CurrentAccount.server_STUN - itemWidth: root.itemWidth titleField: JamiStrings.stunAdress diff --git a/src/app/settingsview/components/AdvancedJamiSecuritySettings.qml b/src/app/settingsview/components/AdvancedJamiSecuritySettings.qml index 168a9147d..7d5e12c6f 100644 --- a/src/app/settingsview/components/AdvancedJamiSecuritySettings.qml +++ b/src/app/settingsview/components/AdvancedJamiSecuritySettings.qml @@ -46,29 +46,32 @@ ColumnLayout { dlg.fileAccepted.connect(onAcceptedCb) } - ElidedTextLabel { - Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.preferredFieldHeight + Text { + + Layout.alignment: Qt.AlignLeft + Layout.preferredWidth: Math.min(350, root.width - JamiTheme.preferredMarginSize * 2) + + text: JamiStrings.security + color: JamiTheme.textColor + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + wrapMode : Text.WordWrap - eText: JamiStrings.security - fontSize: JamiTheme.headerFontSize - maxWidth: width + font.pixelSize: JamiTheme.settingsTitlePixelSize + font.kerning: true } ColumnLayout { Layout.fillWidth: true - Layout.leftMargin: JamiTheme.preferredMarginSize SettingMaterialButton { id: btnCACert Layout.fillWidth: true - Layout.minimumHeight: JamiTheme.preferredFieldHeight enabled: CurrentAccount.enable_TLS - textField: UtilsAdapter.toFileInfoName(CurrentAccount.certificateListFile_TLS) + textField: UtilsAdapter.toFileInfoName(CurrentAccount.certificateListFile_TLS) !== "" ? UtilsAdapter.toFileInfoName(CurrentAccount.certificateListFile_TLS) : JamiStrings.selectCACertDefault titleField: JamiStrings.caCertificate - source: JamiResources.round_folder_24dp_svg itemWidth: root.itemWidth onClick: openFileDialog(JamiStrings.selectCACert, @@ -84,12 +87,10 @@ ColumnLayout { id: btnUserCert Layout.fillWidth: true - Layout.minimumHeight: JamiTheme.preferredFieldHeight enabled: CurrentAccount.enable_TLS textField: UtilsAdapter.toFileInfoName(CurrentAccount.certificateFile_TLS) titleField: JamiStrings.userCertificate - source: JamiResources.round_folder_24dp_svg itemWidth: root.itemWidth onClick: openFileDialog(JamiStrings.selectUserCert, @@ -105,12 +106,10 @@ ColumnLayout { id: btnPrivateKey Layout.fillWidth: true - Layout.minimumHeight: JamiTheme.preferredFieldHeight enabled: CurrentAccount.enable_TLS textField: UtilsAdapter.toFileInfoName(CurrentAccount.privateKeyFile_TLS) titleField: JamiStrings.privateKey - source: JamiResources.round_folder_24dp_svg itemWidth: root.itemWidth onClick: openFileDialog(JamiStrings.selectPrivateKey, diff --git a/src/app/settingsview/components/AdvancedMediaSettings.qml b/src/app/settingsview/components/AdvancedMediaSettings.qml index 03cea8ab1..c5f8449b9 100644 --- a/src/app/settingsview/components/AdvancedMediaSettings.qml +++ b/src/app/settingsview/components/AdvancedMediaSettings.qml @@ -28,29 +28,30 @@ import "../../commoncomponents" ColumnLayout { id: root + spacing: JamiTheme.settingsCategorySpacing - Label { - Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.preferredFieldHeight + Text { + + Layout.alignment: Qt.AlignLeft + Layout.preferredWidth: Math.min(350, root.width - JamiTheme.preferredMarginSize * 2) text: JamiStrings.media color: JamiTheme.textColor - font.pointSize: JamiTheme.headerFontSize - font.kerning: true - horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter + wrapMode : Text.WordWrap + + font.pixelSize: JamiTheme.settingsTitlePixelSize + font.kerning: true } ColumnLayout { Layout.fillWidth: true - Layout.leftMargin: JamiTheme.preferredMarginSize ToggleSwitch { id: videoCheckBox labelText: JamiStrings.enableVideo - fontPointSize: JamiTheme.settingsFontSize checked: CurrentAccount.videoEnabled_Video diff --git a/src/app/settingsview/components/AdvancedNameServerSettings.qml b/src/app/settingsview/components/AdvancedNameServerSettings.qml index 9441bd2cd..3baf49b04 100644 --- a/src/app/settingsview/components/AdvancedNameServerSettings.qml +++ b/src/app/settingsview/components/AdvancedNameServerSettings.qml @@ -29,27 +29,26 @@ ColumnLayout { id: root property int itemWidth + spacing: JamiTheme.settingsCategorySpacing Text { - Layout.fillWidth: true - Layout.rightMargin: JamiTheme.preferredMarginSize / 2 - - font.pointSize: JamiTheme.headerFontSize - font.kerning: true + Layout.alignment: Qt.AlignLeft + Layout.preferredWidth: parent.width + text: JamiStrings.nameServer + color: JamiTheme.textColor horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter + wrapMode : Text.WordWrap - text: JamiStrings.nameServer - color: JamiTheme.textColor - elide: Text.ElideRight + font.pixelSize: JamiTheme.settingsTitlePixelSize + font.kerning: true } SettingsMaterialTextEdit { id: lineEditNameServer Layout.fillWidth: true - Layout.leftMargin: JamiTheme.preferredMarginSize Layout.preferredHeight: JamiTheme.preferredFieldHeight itemWidth: root.itemWidth diff --git a/src/app/settingsview/components/AdvancedOpenDHTSettings.qml b/src/app/settingsview/components/AdvancedOpenDHTSettings.qml index 14274b468..3ced3eca7 100644 --- a/src/app/settingsview/components/AdvancedOpenDHTSettings.qml +++ b/src/app/settingsview/components/AdvancedOpenDHTSettings.qml @@ -29,24 +29,25 @@ ColumnLayout { id: root property int itemWidth + spacing: JamiTheme.settingsCategorySpacing Text { - Layout.fillWidth: true - Layout.rightMargin: JamiTheme.preferredMarginSize / 2 - - font.pointSize: JamiTheme.headerFontSize - font.kerning: true + Layout.alignment: Qt.AlignLeft + Layout.preferredWidth: parent.width + text: JamiStrings.openDHTConfig + color: JamiTheme.textColor horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter - color: JamiTheme.textColor - text: JamiStrings.openDHTConfig - elide: Text.ElideRight + wrapMode : Text.WordWrap + + font.pixelSize: JamiTheme.settingsTitlePixelSize + font.kerning: true + } ColumnLayout { Layout.fillWidth: true - Layout.leftMargin: JamiTheme.preferredMarginSize ToggleSwitch { id: checkAutoConnectOnLocalNetwork @@ -56,7 +57,6 @@ ColumnLayout { labelText: JamiStrings.enablePeerDiscovery tooltipText: JamiStrings.tooltipPeerDiscovery - fontPointSize: JamiTheme.settingsFontSize checked: CurrentAccount.peerDiscovery @@ -67,7 +67,7 @@ ColumnLayout { id: checkBoxEnableProxy labelText: JamiStrings.enableProxy - fontPointSize: JamiTheme.settingsFontSize + Layout.fillWidth: true checked: CurrentAccount.proxyEnabled @@ -78,7 +78,6 @@ ColumnLayout { id: lineEditProxy Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.preferredFieldHeight enabled: checkBoxEnableProxy.checked @@ -94,7 +93,6 @@ ColumnLayout { id: lineEditBootstrap Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.preferredFieldHeight staticText: CurrentAccount.hostname diff --git a/src/app/settingsview/components/AdvancedPublicAddressSettings.qml b/src/app/settingsview/components/AdvancedPublicAddressSettings.qml index d71dcdea8..690b2bb27 100644 --- a/src/app/settingsview/components/AdvancedPublicAddressSettings.qml +++ b/src/app/settingsview/components/AdvancedPublicAddressSettings.qml @@ -29,11 +29,12 @@ ColumnLayout { id: root property int itemWidth + spacing: JamiTheme.settingsCategorySpacing Text { Layout.fillWidth: true - font.pointSize: JamiTheme.headerFontSize + font.pixelSize: JamiTheme.settingsTitlePixelSize font.kerning: true horizontalAlignment: Text.AlignLeft @@ -46,13 +47,11 @@ ColumnLayout { ColumnLayout { Layout.fillWidth: true - Layout.leftMargin: JamiTheme.preferredMarginSize ToggleSwitch { id: checkBoxAllowIPAutoRewrite labelText: JamiStrings.allowIPAutoRewrite - fontPointSize: JamiTheme.settingsFontSize checked: CurrentAccount.allowIPAutoRewrite @@ -63,7 +62,6 @@ ColumnLayout { id: checkBoxCustomAddressPort labelText: JamiStrings.useCustomAddress - fontPointSize: JamiTheme.settingsFontSize visible: !checkBoxAllowIPAutoRewrite.checked checked: CurrentAccount.publishedSameAsLocal @@ -75,7 +73,6 @@ ColumnLayout { id: lineEditSIPCustomAddress Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.preferredFieldHeight visible: !checkBoxAllowIPAutoRewrite.checked enabled: checkBoxCustomAddressPort.checked diff --git a/src/app/settingsview/components/AdvancedSDPSettings.qml b/src/app/settingsview/components/AdvancedSDPSettings.qml index 1cc55afca..63311ce9e 100644 --- a/src/app/settingsview/components/AdvancedSDPSettings.qml +++ b/src/app/settingsview/components/AdvancedSDPSettings.qml @@ -29,27 +29,36 @@ ColumnLayout { id: root property int itemWidth + spacing: JamiTheme.settingsCategorySpacing + 2 - ElidedTextLabel { - Layout.preferredWidth: textWidth - Layout.preferredHeight: JamiTheme.preferredFieldHeight + Text { + + Layout.alignment: Qt.AlignLeft + 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 + + font.pixelSize: JamiTheme.settingsTitlePixelSize + font.kerning: true - eText: JamiStrings.sdpSettingsTitle - fontSize: JamiTheme.headerFontSize - maxWidth: root.width } ColumnLayout { + id: mainLayout Layout.fillWidth: true - Layout.leftMargin: JamiTheme.preferredMarginSize - - ElidedTextLabel { - Layout.preferredWidth: textWidth - Layout.preferredHeight: JamiTheme.preferredFieldHeight - eText: JamiStrings.sdpSettingsSubtitle - fontSize: JamiTheme.settingsFontSize - maxWidth: parent.width - JamiTheme.preferredMarginSize + Text { + Layout.fillWidth: true + text: JamiStrings.sdpSettingsSubtitle + font.pointSize: JamiTheme.settingsFontSize + font.kerning: true + wrapMode: Text.WordWrap + color: JamiTheme.textColor } SettingSpinBox { diff --git a/src/app/settingsview/components/AdvancedSIPSecuritySettings.qml b/src/app/settingsview/components/AdvancedSIPSecuritySettings.qml index b52d42e77..6d7f0223f 100644 --- a/src/app/settingsview/components/AdvancedSIPSecuritySettings.qml +++ b/src/app/settingsview/components/AdvancedSIPSecuritySettings.qml @@ -30,6 +30,7 @@ ColumnLayout { id: root property int itemWidth + spacing: JamiTheme.settingsCategorySpacing function openFileDialog(title, oldPath, fileType, onAcceptedCb) { var openPath = oldPath === "" ? @@ -47,27 +48,30 @@ ColumnLayout { dlg.fileAccepted.connect(onAcceptedCb) } - ElidedTextLabel { - Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.preferredFieldHeight + Text { + + Layout.alignment: Qt.AlignLeft + Layout.preferredWidth: Math.min(350, root.width - JamiTheme.preferredMarginSize * 2) - eText: JamiStrings.security - fontSize: JamiTheme.headerFontSize - maxWidth: width + text: JamiStrings.security + color: JamiTheme.textColor + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + wrapMode : Text.WordWrap + + font.pixelSize: JamiTheme.settingsTitlePixelSize + font.kerning: true } ColumnLayout { Layout.fillWidth: true - Layout.leftMargin: JamiTheme.preferredMarginSize + spacing: 5 ToggleSwitch { id: enableSDESToggle labelText: JamiStrings.enableSDES - fontPointSize: JamiTheme.settingsFontSize - checked: CurrentAccount.keyExchange_SRTP - onSwitchToggled: CurrentAccount.keyExchange_SRTP = Number(checked) } @@ -75,10 +79,7 @@ ColumnLayout { id: fallbackRTPToggle labelText: JamiStrings.fallbackRTP - fontPointSize: JamiTheme.settingsFontSize - checked: CurrentAccount.rtpFallback_SRTP - onSwitchToggled: CurrentAccount.rtpFallback_SRTP = checked } @@ -86,10 +87,7 @@ ColumnLayout { id: encryptNegotitationToggle labelText: JamiStrings.encryptNegotiation - fontPointSize: JamiTheme.settingsFontSize - checked: CurrentAccount.enable_TLS - onSwitchToggled: CurrentAccount.enable_TLS = checked } @@ -97,16 +95,12 @@ ColumnLayout { id: btnSIPCACert Layout.fillWidth: true - Layout.minimumHeight: JamiTheme.preferredFieldHeight enabled: CurrentAccount.enable_TLS - titleField: JamiStrings.caCertificate - source: JamiResources.round_folder_24dp_svg + textField: UtilsAdapter.toFileInfoName(CurrentAccount.certificateListFile_TLS) !== "" ? UtilsAdapter.toFileInfoName(CurrentAccount.certificateListFile_TLS) : JamiStrings.selectCACertDefault itemWidth: root.itemWidth - textField: UtilsAdapter.toFileInfoName(CurrentAccount.certificateListFile_TLS) - onClick: openFileDialog(JamiStrings.selectCACert, CurrentAccount.certificateListFile_TLS, JamiStrings.certificateFile, @@ -120,15 +114,11 @@ ColumnLayout { id: btnSIPUserCert Layout.fillWidth: true - Layout.minimumHeight: JamiTheme.preferredFieldHeight enabled: CurrentAccount.enable_TLS - titleField: JamiStrings.userCertificate - source: JamiResources.round_folder_24dp_svg itemWidth: root.itemWidth - - textField: UtilsAdapter.toFileInfoName(CurrentAccount.certificateFile_TLS) + textField: UtilsAdapter.toFileInfoName(CurrentAccount.certificateFile_TLS) !== "" ? UtilsAdapter.toFileInfoName(CurrentAccount.certificateFile_TLS) : JamiStrings.selectCACertDefault onClick: openFileDialog(JamiStrings.selectUserCert, CurrentAccount.certificateFile_TLS, @@ -143,15 +133,11 @@ ColumnLayout { id: btnSIPPrivateKey Layout.fillWidth: true - Layout.minimumHeight: JamiTheme.preferredFieldHeight enabled: CurrentAccount.enable_TLS - titleField: JamiStrings.privateKey - source: JamiResources.round_folder_24dp_svg itemWidth: root.itemWidth - - textField: UtilsAdapter.toFileInfoName(CurrentAccount.privateKeyFile_TLS) + textField: UtilsAdapter.toFileInfoName(CurrentAccount.privateKeyFile_TLS) !== "" ? UtilsAdapter.toFileInfoName(CurrentAccount.privateKeyFile_TLS) : JamiStrings.selectCACertDefault onClick: openFileDialog(JamiStrings.selectPrivateKey, CurrentAccount.privateKeyFile_TLS, @@ -174,6 +160,7 @@ ColumnLayout { titleField: JamiStrings.privateKeyPassword staticText: CurrentAccount.password_TLS + isPassword: true onEditFinished: CurrentAccount.password_TLS = dynamicText } @@ -182,10 +169,7 @@ ColumnLayout { id: verifyIncomingCertificatesServerToggle labelText: JamiStrings.verifyCertificatesServer - fontPointSize: JamiTheme.settingsFontSize - checked: CurrentAccount.verifyServer_TLS - onSwitchToggled: CurrentAccount.verifyServer_TLS = checked } @@ -193,10 +177,7 @@ ColumnLayout { id: verifyIncomingCertificatesClientToggle labelText: JamiStrings.verifyCertificatesClient - fontPointSize: JamiTheme.settingsFontSize - checked: CurrentAccount.verifyClient_TLS - onSwitchToggled: CurrentAccount.verifyClient_TLS = checked } @@ -204,10 +185,7 @@ ColumnLayout { id: requireCeritificateForTLSIncomingToggle labelText: JamiStrings.tlsRequireConnections - fontPointSize: JamiTheme.settingsFontSize - checked: CurrentAccount.requireClientCertificate_TLS - onSwitchToggled: CurrentAccount.requireClientCertificate_TLS = checked } @@ -215,10 +193,7 @@ ColumnLayout { id: disableSecureDlgCheckToggle labelText: JamiStrings.disableSecureDlgCheck - fontPointSize: JamiTheme.settingsFontSize - checked: CurrentAccount.disableSecureDlgCheck_TLS - onSwitchToggled: CurrentAccount.disableSecureDlgCheck_TLS = checked } @@ -226,10 +201,8 @@ ColumnLayout { id: tlsProtocolComboBox Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.preferredFieldHeight labelText: JamiStrings.tlsProtocol - fontPointSize: JamiTheme.settingsFontSize comboModel: ListModel { ListElement{textDisplay: "Default"; firstArg: "Default"; secondArg: 0} ListElement{textDisplay: "TLSv1"; firstArg: "TLSv1"; secondArg: 1} @@ -250,7 +223,6 @@ ColumnLayout { id: outgoingTLSServerNameLineEdit Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.preferredFieldHeight itemWidth: root.itemWidth titleField: JamiStrings.tlsServerName diff --git a/src/app/settingsview/components/AdvancedSettings.qml b/src/app/settingsview/components/AdvancedSettings.qml index 0de80d3db..813b3fa6b 100644 --- a/src/app/settingsview/components/AdvancedSettings.qml +++ b/src/app/settingsview/components/AdvancedSettings.qml @@ -109,73 +109,6 @@ ColumnLayout { itemWidth: root.itemWidth } - AdvancedSIPSecuritySettings { - id: advancedSIPSecuritySettings - Layout.fillWidth: true - - visible: LRCInstance.currentAccountType === Profile.Type.SIP - itemWidth: root.itemWidth - } - - AdvancedNameServerSettings { - id: advancedNameServerSettings - - Layout.fillWidth: true - - visible: LRCInstance.currentAccountType === Profile.Type.JAMI - itemWidth: root.itemWidth - } - - AdvancedOpenDHTSettings { - id: advancedOpenDHTSettings - - Layout.fillWidth: true - - visible: LRCInstance.currentAccountType === Profile.Type.JAMI - itemWidth: root.itemWidth - } - - AdvancedJamiSecuritySettings { - id: advancedJamiSecuritySettings - - Layout.fillWidth: true - - visible: LRCInstance.currentAccountType === Profile.Type.JAMI - itemWidth: root.itemWidth - } - - AdvancedConnectivitySettings { - id: advancedConnectivitySettings - - Layout.fillWidth: true - - itemWidth: root.itemWidth - isSIP: LRCInstance.currentAccountType === Profile.Type.SIP - } - - AdvancedPublicAddressSettings { - id: advancedPublicAddressSettings - - Layout.fillWidth: true - - visible: isSIP - itemWidth: root.itemWidth - } - - AdvancedMediaSettings { - id: advancedMediaSettings - - Layout.fillWidth: true - } - - AdvancedSDPSettings { - id: advancedSDPStettings - - Layout.fillWidth: true - - visible: isSIP - itemWidth: root.itemWidth - } } } diff --git a/src/app/settingsview/components/AdvancedSettingsPage.qml b/src/app/settingsview/components/AdvancedSettingsPage.qml new file mode 100644 index 000000000..7d0b31440 --- /dev/null +++ b/src/app/settingsview/components/AdvancedSettingsPage.qml @@ -0,0 +1,122 @@ +/* + * Copyright (C) 2023 Savoir-faire Linux Inc. + * Author: Fadi Shehadeh <fadi.shehadeh@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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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 { + id: root + + property int itemWidth + signal showAdvancedSettingsRequest + + signal navigateToMainView + signal navigateToNewWizardView + + title: JamiStrings.advancedSettingsTitle + + flickableContent: ColumnLayout { + + id: currentAccountEnableColumnLayout + + width: contentFlickableWidth + spacing: JamiTheme.settingsBlockSpacing + anchors.left: parent.left + anchors.leftMargin: JamiTheme.preferredSettingsMarginSize + + Layout.bottomMargin: JamiTheme.preferredSettingsContentMarginSize + Layout.fillWidth: true + + AdvancedSIPSecuritySettings { + id: advancedSIPSecuritySettings + + width: parent.width + itemWidth: 250 + visible: CurrentAccount.type === Profile.Type.SIP + } + + AdvancedChatSettings { + id: advancedChatSettings + + width: parent.width + } + + AdvancedNameServerSettings { + id: advancedNameServerSettings + + width: parent.width + itemWidth: 250 + visible: CurrentAccount.type === Profile.Type.JAMI + } + + AdvancedOpenDHTSettings { + id: advancedOpenDHTSettings + + width: parent.width + itemWidth: 250 + visible: CurrentAccount.type === Profile.Type.JAMI + } + + AdvancedJamiSecuritySettings { + id: advancedJamiSecuritySettings + + width: parent.width + itemWidth: 250 + visible: CurrentAccount.type === Profile.Type.JAMI + } + + AdvancedConnectivitySettings { + id: advancedConnectivitySettings + + width: parent.width + itemWidth: 250 + isSIP: CurrentAccount.type === Profile.Type.SIP + } + + AdvancedPublicAddressSettings { + id: advancedPublicAddressSettings + + width: parent.width + itemWidth: 250 + visible: CurrentAccount.type === Profile.Type.SIP + } + + AdvancedMediaSettings { + id: advancedMediaSettings + + width: parent.width + } + + AdvancedSDPSettings { + id: advancedSDPStettings + + itemWidth: 250 + width: parent.width + visible: CurrentAccount.type === Profile.Type.SIP + } + } +} + diff --git a/src/app/settingsview/components/AppearenceSettingsPage.qml b/src/app/settingsview/components/AppearenceSettingsPage.qml new file mode 100644 index 000000000..8bfb5e6ee --- /dev/null +++ b/src/app/settingsview/components/AppearenceSettingsPage.qml @@ -0,0 +1,408 @@ +/* + * Copyright (C) 2023 Savoir-faire Linux Inc. + * Author: Fadi Shehadeh <fadi.shehadeh@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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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: 188 + + signal navigateToMainView + signal navigateToNewWizardView + + title: JamiStrings.appearence + + flickableContent: ColumnLayout { + id: appearenceSettingsColumnLayout + + width: contentFlickableWidth + spacing: JamiTheme.settingsBlockSpacing + anchors.left: parent.left + anchors.leftMargin: JamiTheme.preferredSettingsMarginSize + + ColumnLayout { + id: generalSettings + + width: parent.width + spacing: JamiTheme.settingsCategorySpacing + + Text { + id: enableAccountTitle + + Layout.alignment: Qt.AlignLeft + Layout.preferredWidth: parent.width + + text: JamiStrings.generalSettingsTitle + color: JamiTheme.textColor + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + wrapMode : Text.WordWrap + + font.pixelSize: JamiTheme.settingsTitlePixelSize + font.kerning: true + + } + + ToggleSwitch { + id: enableTypingIndicatorCheckbox + + Layout.fillWidth: true + + checked: UtilsAdapter.getAppValue(Settings.EnableTypingIndicator) + + labelText: JamiStrings.enableTypingIndicator + descText: JamiStrings.enableTypingIndicatorDescription + + tooltipText: JamiStrings.enableTypingIndicator + + onSwitchToggled: UtilsAdapter.setAppValue(Settings.Key.EnableTypingIndicator, checked) + } + + ToggleSwitch { + id: displayImagesCheckbox + visible: WITH_WEBENGINE + + Layout.fillWidth: true + + checked: UtilsAdapter.getAppValue(Settings.DisplayHyperlinkPreviews) + + labelText: JamiStrings.displayHyperlinkPreviews + descText: JamiStrings.displayHyperlinkPreviewsDescription + + tooltipText: JamiStrings.displayHyperlinkPreviews + + onSwitchToggled: { + UtilsAdapter.setAppValue(Settings.Key.DisplayHyperlinkPreviews, checked) + } + } + + SettingsComboBox { + id: outputComboBoxSetting + + Layout.fillWidth: true + Layout.preferredHeight: JamiTheme.preferredFieldHeight + + labelText: JamiStrings.layout + tipText: JamiStrings.layout + comboModel: ListModel { + id: layoutModel + Component.onCompleted: { + append({ textDisplay: JamiStrings.horizontalViewOpt }) + append({ textDisplay: JamiStrings.verticalViewOpt }) + } + } + widthOfComboBox: itemWidth + role: "textDisplay" + + modelIndex: UtilsAdapter.getAppValue(Settings.Key.ShowChatviewHorizontally) ? 1 : 0 + + onActivated: { + 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 + } + } + } + } + + ColumnLayout { + id: themeSettings + + Layout.preferredWidth: parent.width + spacing: JamiTheme.settingsCategorySpacing + + property var nativeDarkThemeShift: UtilsAdapter.hasNativeDarkTheme() ? 1 : 0 + + function isComplete() { + var theme = UtilsAdapter.getAppValue(Settings.Key.AppTheme) + if (themeSettings.nativeDarkThemeShift && theme === "System") + sysThemeButton.checked = true + if (theme === "Light") { + lightThemeButton.checked = true + } else if (theme === "Dark") { + darkThemeButton.checked = true + } + } + + Component.onCompleted: themeSettings.isComplete() + + Text { + + Layout.alignment: Qt.AlignLeft + Layout.preferredWidth: parent.width + + text: JamiStrings.theme + color: JamiTheme.textColor + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + wrapMode : Text.WordWrap + + font.pixelSize: JamiTheme.settingsTitlePixelSize + font.kerning: true + } + + ButtonGroup { id: optionsB } + + Flow { + + Layout.preferredWidth: parent.width + Layout.preferredHeight: childrenRect.height + spacing: 5 + + Rectangle { + id: lightThemeButtonBg + width: 165 + height: 60 + border.color: JamiTheme.darkTheme ? "transparent" : JamiTheme.tintedBlue + color: JamiTheme.whiteColor + radius: JamiTheme.settingsBoxRadius + + MaterialRadioButton { + id: lightThemeButton + + anchors.fill: parent + anchors.leftMargin: 19 + + text: JamiStrings.light + ButtonGroup.group: optionsB + color: JamiTheme.blackColor + bgColor: lightThemeButtonBg.color + + KeyNavigation.down: darkThemeButton + KeyNavigation.tab: KeyNavigation.down + + onCheckedChanged: { + if (checked) + UtilsAdapter.setAppValue(Settings.Key.AppTheme, "Light") + } + } + } + + Rectangle { + id: darkThemeButtonBg + + width: 165 + height: 60 + color: JamiTheme.darkTheme ? JamiTheme.blackColor : JamiTheme.bgDarkMode_ + border.color: JamiTheme.darkTheme ? JamiTheme.tintedBlue : "transparent" + radius: JamiTheme.settingsBoxRadius + + MaterialRadioButton { + id: darkThemeButton + + anchors.fill: parent + anchors.leftMargin: 19 + + text: JamiStrings.dark + ButtonGroup.group: optionsB + color: JamiTheme.whiteColor + bgColor: darkThemeButtonBg.color + + KeyNavigation.up: lightThemeButton + KeyNavigation.down: sysThemeButton + KeyNavigation.tab: KeyNavigation.down + + onCheckedChanged: { + if (checked) + UtilsAdapter.setAppValue(Settings.Key.AppTheme, "Dark") + } + } + } + + Rectangle { + id: sysThemeButtonBg + + width: 165 + height: 60 + color: JamiTheme.darkTheme ? "#515151" : JamiTheme.sysColor + radius: JamiTheme.settingsBoxRadius + + MaterialRadioButton { + id: sysThemeButton + + anchors.fill: parent + anchors.leftMargin: 19 + + text: JamiStrings.system + ButtonGroup.group: optionsB + color: JamiTheme.darkTheme ? JamiTheme.whiteColor : JamiTheme.blackColor + bgColor: sysThemeButtonBg.color + + KeyNavigation.up: darkThemeButton + + onCheckedChanged: { + if (checked) + UtilsAdapter.setAppValue(Settings.Key.AppTheme, "System") + } + } + } + } + } + + ColumnLayout { + id: zoomSettings + + width: parent.width + spacing: JamiTheme.settingsCategorySpacing + + Text { + + Layout.alignment: Qt.AlignLeft + Layout.preferredWidth: parent.width + + text: JamiStrings.zoomLevel + color: JamiTheme.textColor + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + wrapMode : Text.WordWrap + + font.pixelSize: JamiTheme.settingsTitlePixelSize + font.kerning: true + + } + + Slider { + id: zoomSpinBox + + Layout.maximumWidth: parent.width + Layout.alignment: Qt.AlignLeft + Layout.fillWidth: true + Layout.fillHeight: true + + value: Math.round(UtilsAdapter.getAppValue(Settings.BaseZoom) * 100.0) + + from: 50 + to: 200 + stepSize: 10 + snapMode: Slider.SnapAlways + + onMoved: { + UtilsAdapter.setAppValue(Settings.BaseZoom, value / 100.0) + } + + background: Rectangle { + implicitWidth: 200 + implicitHeight: 2 + width: zoomSpinBox.availableWidth + height: 2 + radius: 2 + color: JamiTheme.tintedBlue + } + + handle: ColumnLayout { + x: zoomSpinBox.visualPosition * zoomSpinBox.availableWidth - textSize.width / 2 + + + Rectangle { + Layout.topMargin: -12 + implicitWidth: 6 + implicitHeight: 25 + radius: implicitWidth + color: JamiTheme.tintedBlue + Layout.alignment: Qt.AlignHCenter + } + + Text { + id: zoomSpinBoxValueLabel + + TextMetrics{ + id: textSize + font.pointSize: JamiTheme.settingsFontSize + font.kerning: true + font.bold: true + text: zoomSpinBoxValueLabel.text + } + + color: JamiTheme.tintedBlue + text: zoomSpinBox.value + Layout.alignment: Qt.AlignHCenter + + font.pointSize: JamiTheme.settingsFontSize + font.kerning: true + font.bold: true + } + } + } + + Connections { + target: UtilsAdapter + + function onChangeFontSize() { + zoomSpinBox.value = Math.round(UtilsAdapter.getAppValue(Settings.BaseZoom) * 100.0) + } + } + } + + MaterialButton { + id: defaultSettings + + TextMetrics{ + id: defaultSettingsTextSize + font.weight: Font.Bold + font.pixelSize: JamiTheme.wizardViewButtonFontPixelSize + font.capitalization: Font.AllUppercase + text: defaultSettings.text + } + + secondary: true + + text: JamiStrings.defaultSettings + 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() + } + + } + } +} diff --git a/src/app/settingsview/components/AudioSettings.qml b/src/app/settingsview/components/AudioSettings.qml deleted file mode 100644 index 5b4a29adb..000000000 --- a/src/app/settingsview/components/AudioSettings.qml +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright (C) 2020-2023 Savoir-faire Linux Inc. - * Author: Aline Gondim Santos <aline.gondimsantos@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 - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * 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" - -ColumnLayout { - id:root - - property int itemWidth - - enum Setting { - AUDIOINPUT, - AUDIOOUTPUT, - RINGTONEDEVICE, - AUDIOMANAGER - } - - Connections { - target: UtilsAdapter - - function onChangeLanguage() { - 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() - } - audioManagerComboBoxSetting.visible = audioManagerComboBoxSetting.comboModel.rowCount() > 0 - } - - ElidedTextLabel { - Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.preferredFieldHeight - - eText: JamiStrings.audio - fontSize: JamiTheme.headerFontSize - maxWidth: width - } - - SettingsComboBox { - id: inputComboBoxSetting - - Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.preferredFieldHeight - Layout.leftMargin: JamiTheme.preferredMarginSize - - labelText: JamiStrings.microphone - fontPointSize: JamiTheme.settingsFontSize - comboModel: AudioDeviceModel { - id: inputAudioModel - lrcInstance: LRCInstance - type: AudioDeviceModel.Type.Record - } - widthOfComboBox: itemWidth - tipText: JamiStrings.selectAudioInputDevice - role: "DeviceName" - - onActivated: { - AvAdapter.stopAudioMeter() - AVModel.setInputDevice(modelIndex) - AvAdapter.startAudioMeter() - } - } - - // the audio level meter - LevelMeter { - id: audioInputMeter - - Layout.alignment: Qt.AlignHCenter - Layout.preferredWidth: itemWidth * 1.5 - Layout.preferredHeight: JamiTheme.preferredFieldHeight - - indeterminate: false - from: 0 - to: 100 - } - - SettingsComboBox { - id: outputComboBoxSetting - - Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.preferredFieldHeight - Layout.leftMargin: JamiTheme.preferredMarginSize - - labelText: JamiStrings.outputDevice - fontPointSize: JamiTheme.settingsFontSize - comboModel: AudioDeviceModel { - id: outputAudioModel - lrcInstance: LRCInstance - type: AudioDeviceModel.Type.Playback - } - widthOfComboBox: itemWidth - tipText: JamiStrings.selectAudioOutputDevice - role: "DeviceName" - - onActivated: { - AvAdapter.stopAudioMeter() - AVModel.setOutputDevice(modelIndex) - AvAdapter.startAudioMeter() - } - } - - SettingsComboBox { - id: ringtoneComboBoxSetting - - Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.preferredFieldHeight - Layout.leftMargin: JamiTheme.preferredMarginSize - - labelText: JamiStrings.ringtoneDevice - fontPointSize: JamiTheme.settingsFontSize - comboModel: AudioDeviceModel { - id: ringtoneAudioModel - lrcInstance: LRCInstance - type: AudioDeviceModel.Type.Ringtone - } - widthOfComboBox: itemWidth - tipText: JamiStrings.selectRingtoneOutputDevice - role: "DeviceName" - - onActivated: { - AvAdapter.stopAudioMeter() - AVModel.setRingtoneDevice(modelIndex) - AvAdapter.startAudioMeter() - } - } - - SettingsComboBox { - id: audioManagerComboBoxSetting - - Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.preferredFieldHeight - Layout.leftMargin: JamiTheme.preferredMarginSize - - labelText: JamiStrings.audioManager - fontPointSize: JamiTheme.settingsFontSize - comboModel: AudioManagerListModel { - lrcInstance: LRCInstance - } - widthOfComboBox: itemWidth - role: "ID_UTF8" - - onActivated: { - AvAdapter.stopAudioMeter() - var selectedAudioManager = comboModel.data( - comboModel.index(modelIndex, 0), AudioManagerListModel.AudioManagerID) - AVModel.setAudioManager(selectedAudioManager) - AvAdapter.startAudioMeter() - populateAudioSettings() - } - } -} diff --git a/src/app/settingsview/components/AudioSettingsPage.qml b/src/app/settingsview/components/AudioSettingsPage.qml new file mode 100644 index 000000000..067130fcd --- /dev/null +++ b/src/app/settingsview/components/AudioSettingsPage.qml @@ -0,0 +1,199 @@ +/* + * Copyright (C) 2023 Savoir-faire Linux Inc. + * Author: Fadi Shehadeh <fadi.shehadeh@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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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 { + id: root + + property int itemWidth: 188 + + signal navigateToMainView + signal navigateToNewWizardView + title: JamiStrings.audio + + flickableContent: ColumnLayout { + id: currentAccountEnableColumnLayout + + width: contentFlickableWidth + spacing: JamiTheme.settingsCategoryAudioVideoSpacing + 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() + } + } + + 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() + } + audioManagerComboBoxSetting.visible = audioManagerComboBoxSetting.comboModel.rowCount() > 0 + } + + SettingsComboBox { + id: inputComboBoxSetting + + Layout.fillWidth: true + + labelText: JamiStrings.microphone + fontPointSize: JamiTheme.settingsFontSize + comboModel: AudioDeviceModel { + id: inputAudioModel + lrcInstance: LRCInstance + type: AudioDeviceModel.Type.Record + } + widthOfComboBox: itemWidth + tipText: JamiStrings.selectAudioInputDevice + role: "DeviceName" + + onActivated: { + AvAdapter.stopAudioMeter() + AVModel.setInputDevice(modelIndex) + AvAdapter.startAudioMeter() + } + } + + RowLayout { + Layout.fillWidth: true + Layout.minimumHeight: JamiTheme.preferredFieldHeight + + Text { + Layout.fillWidth: true + + text: JamiStrings.soundTest + elide: Text.ElideRight + color: JamiTheme.textColor + font.pointSize: JamiTheme.settingsFontSize + font.kerning: true + + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + } + + // the audio level meter + LevelMeter { + id: audioInputMeter + + Layout.alignment: Qt.AlignRight + Layout.preferredWidth: itemWidth + + indeterminate: false + from: 0 + to: 100 + } + + + } + + SettingsComboBox { + id: outputComboBoxSetting + + Layout.fillWidth: true + + labelText: JamiStrings.outputDevice + fontPointSize: JamiTheme.settingsFontSize + comboModel: AudioDeviceModel { + id: outputAudioModel + lrcInstance: LRCInstance + type: AudioDeviceModel.Type.Playback + } + widthOfComboBox: itemWidth + tipText: JamiStrings.selectAudioOutputDevice + role: "DeviceName" + + onActivated: { + AvAdapter.stopAudioMeter() + AVModel.setOutputDevice(modelIndex) + AvAdapter.startAudioMeter() + } + } + + SettingsComboBox { + id: ringtoneComboBoxSetting + + Layout.fillWidth: true + + labelText: JamiStrings.ringtoneDevice + fontPointSize: JamiTheme.settingsFontSize + comboModel: AudioDeviceModel { + id: ringtoneAudioModel + lrcInstance: LRCInstance + type: AudioDeviceModel.Type.Ringtone + } + widthOfComboBox: itemWidth + tipText: JamiStrings.selectRingtoneOutputDevice + role: "DeviceName" + + onActivated: { + AvAdapter.stopAudioMeter() + AVModel.setRingtoneDevice(modelIndex) + AvAdapter.startAudioMeter() + } + } + + SettingsComboBox { + id: audioManagerComboBoxSetting + + Layout.fillWidth: true + + labelText: JamiStrings.audioManager + fontPointSize: JamiTheme.settingsFontSize + comboModel: AudioManagerListModel { + lrcInstance: LRCInstance + } + widthOfComboBox: itemWidth + role: "ID_UTF8" + + onActivated: { + AvAdapter.stopAudioMeter() + var selectedAudioManager = comboModel.data( + comboModel.index(modelIndex, 0), AudioManagerListModel.AudioManagerID) + AVModel.setAudioManager(selectedAudioManager) + AvAdapter.startAudioMeter() + currentAccountEnableColumnLayout.populateAudioSettings() + } + } + } +} + diff --git a/src/app/settingsview/components/BannedContacts.qml b/src/app/settingsview/components/BannedContacts.qml index 9dbefdbec..66e8bff72 100644 --- a/src/app/settingsview/components/BannedContacts.qml +++ b/src/app/settingsview/components/BannedContacts.qml @@ -28,88 +28,19 @@ import "../../commoncomponents" ColumnLayout { id: root - property bool isSIP - - visible: { - if (bannedListWidget.model.rowCount() <= 0) - return false - return true && !isSIP && CurrentAccount.managerUri === "" - } - - Connections { - target: ContactAdapter - - function onBannedStatusChanged(uri, banned) { - if (banned) { - bannedListWidget.model.reset() - root.visible = true - bannedContactsBtn.visible = true - bannedListWidget.visible = false - } else { - updateAndShowBannedContactsSlot() - } - } - } - - function toggleBannedContacts() { - var bannedContactsVisible = bannedListWidget.visible - bannedListWidget.visible = !bannedContactsVisible - updateAndShowBannedContactsSlot() - } - - function updateAndShowBannedContactsSlot() { - bannedListWidget.model.reset() - root.visible = bannedListWidget.model.rowCount() > 0 - if(bannedListWidget.model.rowCount() <= 0) { - bannedListWidget.visible = false - bannedContactsBtn.visible = false - } else { - bannedContactsBtn.visible = true - } - } - - RowLayout { - id: bannedContactsBtn - - Layout.fillWidth: true - - ElidedTextLabel { - Layout.fillWidth: true - - eText: JamiStrings.bannedContacts - fontSize: JamiTheme.headerFontSize - maxWidth: root.width - JamiTheme.preferredFieldHeight - - JamiTheme.preferredMarginSize * 4 - } - - PushButton { - Layout.alignment: Qt.AlignRight - Layout.preferredWidth: JamiTheme.preferredFieldHeight - Layout.preferredHeight: JamiTheme.preferredFieldHeight - - toolTipText: bannedListWidget.visible? - JamiStrings.tipBannedContactsHide : - JamiStrings.tipBannedContactsDisplay - imageColor: JamiTheme.textColor - - source: bannedListWidget.visible? - JamiResources.expand_less_24dp_svg : - JamiResources.expand_more_24dp_svg - - onClicked: toggleBannedContacts() - } - } - JamiListView { id: bannedListWidget - Layout.fillWidth: true - Layout.preferredHeight: 160 + property int bannedContactsSize: 0 - visible: false + Layout.fillWidth: true + Layout.preferredHeight: Math.min(bannedContactsSize, 5) * (74 + spacing) + spacing: JamiTheme.settingsListViewsSpacing model: BannedListModel { lrcInstance: LRCInstance + + onCountChanged: bannedListWidget.bannedContactsSize = count } delegate: ContactItemDelegate { @@ -121,7 +52,7 @@ ColumnLayout { contactName: ContactName contactID: ContactID - btnImgSource: JamiResources.round_remove_circle_24dp_svg + btnImgSource: JamiStrings.optionUnban btnToolTip: JamiStrings.reinstateContact onClicked: bannedListWidget.currentIndex = index diff --git a/src/app/settingsview/components/CallRecordingSettingsPage.qml b/src/app/settingsview/components/CallRecordingSettingsPage.qml new file mode 100644 index 000000000..d8f72b532 --- /dev/null +++ b/src/app/settingsview/components/CallRecordingSettingsPage.qml @@ -0,0 +1,292 @@ +/* + * Copyright (C) 2023 Savoir-faire Linux Inc. + * Author: Fadi Shehadeh <fadi.shehadeh@savoirfairelinux.com> + * Author: Aline Gondim Santos <aline.gondimsantos@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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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 { + id: root + + property string recordPath: AVModel.getRecordPath() + property string screenshotPath: UtilsAdapter.getDirScreenshot() + + property string recordPathBestName: UtilsAdapter.dirName(AVModel.getRecordPath()) + property string screenshotPathBestName: UtilsAdapter.dirName(UtilsAdapter.getDirScreenshot()) + + property int itemWidth: 188 + + signal navigateToMainView + signal navigateToNewWizardView + title: JamiStrings.callRecording + + onRecordPathChanged: { + if(recordPath === "") + return + + if(AVModel) { + AVModel.setRecordPath(recordPath) + } + } + + onScreenshotPathChanged: { + if (screenshotPath === "") + return + UtilsAdapter.setScreenshotPath(screenshotPath) + } + + flickableContent: ColumnLayout { + id: callSettingsColumnLayout + + width: contentFlickableWidth + spacing: JamiTheme.settingsBlockSpacing + anchors.left: parent.left + anchors.leftMargin: JamiTheme.preferredSettingsMarginSize + + ColumnLayout { + id: generalSettings + + width: parent.width + + FolderDialog { + id: recordPathDialog + + title: JamiStrings.selectFolder + currentFolder: UtilsAdapter.getDirScreenshot() + options: FolderDialog.ShowDirsOnly + + onAccepted: { + var dir = UtilsAdapter.getAbsPath(folder.toString()) + var dirName = UtilsAdapter.dirName(folder.toString()) + recordPath = dir + recordPathBestName = dirName + } + } + + FolderDialog { + id: screenshotPathDialog + + title: JamiStrings.selectFolder + currentFolder: StandardPaths.writableLocation(StandardPaths.PicturesLocation) + options: FolderDialog.ShowDirsOnly + + onAccepted: { + var dir = UtilsAdapter.getAbsPath(folder.toString()) + var dirName = UtilsAdapter.dirName(folder.toString()) + screenshotPath = dir + screenshotPathBestName = dirName + } + } + + Timer{ + id: updateRecordQualityTimer + + interval: 500 + + onTriggered: AVModel.setRecordQuality(recordQualitySlider.value * 100) + } + + + ToggleSwitch { + id: alwaysRecordingCheckBox + + Layout.fillWidth: true + checked: AVModel.getAlwaysRecord() + labelText: JamiStrings.alwaysRecordCalls + tooltipText: JamiStrings.alwaysRecordCalls + onSwitchToggled: AVModel.setAlwaysRecord(checked) + } + + ToggleSwitch { + id: recordPreviewCheckBox + + Layout.fillWidth: true + checked: AVModel.getRecordPreview() + labelText: JamiStrings.includeLocalVideo + onSwitchToggled: AVModel.setRecordPreview(checked) + } + + RowLayout { + Layout.fillWidth: true + Layout.preferredHeight: JamiTheme.preferredFieldHeight + + Text { + Layout.fillWidth: true + Layout.rightMargin: JamiTheme.preferredMarginSize / 2 + + color: JamiTheme.textColor + text: JamiStrings.quality + font.pointSize: JamiTheme.settingsFontSize + font.kerning: true + wrapMode: Text.WordWrap + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + } + + Text { + id: recordQualityValueLabel + + Layout.alignment: Qt.AlignRight + Layout.fillHeight: true + Layout.fillWidth: true + Layout.rightMargin: JamiTheme.preferredMarginSize / 2 + + color: JamiTheme.tintedBlue + text: UtilsAdapter.getRecordQualityString(AVModel.getRecordQuality() / 100) + wrapMode: Text.WordWrap + + font.pointSize: JamiTheme.settingsFontSize + font.kerning: true + font.weight: Font.Medium + horizontalAlignment: Text.AlignRight + verticalAlignment: Text.AlignVCenter + } + + Slider { + id: recordQualitySlider + + Layout.maximumWidth: itemWidth + Layout.alignment: Qt.AlignRight + Layout.fillWidth: true + Layout.fillHeight: true + + value: AVModel.getRecordQuality() / 100 + + from: 0 + to: 500 + stepSize: 1 + + onMoved: { + recordQualityValueLabel.text = UtilsAdapter.getRecordQualityString(value) + updateRecordQualityTimer.restart() + } + + background: Rectangle { + y: recordQualitySlider.height / 2 + implicitWidth: 200 + implicitHeight: 2 + width: recordQualitySlider.availableWidth + height: implicitHeight + radius: 2 + color: JamiTheme.tintedBlue + } + + handle: ColumnLayout { + x: recordQualitySlider.visualPosition * recordQualitySlider.availableWidth + y: recordQualitySlider.height / 2 + + Rectangle { + Layout.topMargin: -12 + implicitWidth: 6 + implicitHeight: 25 + radius: implicitWidth + color: JamiTheme.tintedBlue + Layout.alignment: Qt.AlignHCenter + } + } + + MaterialToolTip { + id: toolTip + text: JamiStrings.quality + visible: parent.hovered + delay: Qt.styleHints.mousePressAndHoldInterval + } + } + } + + RowLayout { + Layout.fillWidth: true + Layout.minimumHeight: JamiTheme.preferredFieldHeight + + Text { + Layout.fillWidth: true + Layout.fillHeight: true + + text: JamiStrings.saveRecordingsTo + wrapMode: Text.WordWrap + color: JamiTheme.textColor + font.pointSize: JamiTheme.settingsFontSize + font.kerning: true + + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + } + + MaterialButton { + id: recordPathButton + + Layout.alignment: Qt.AlignRight + + preferredWidth: itemWidth + buttontextHeightMargin: JamiTheme.buttontextHeightMargin + textLeftPadding: JamiTheme.buttontextWizzardPadding + textRightPadding: JamiTheme.buttontextWizzardPadding + + toolTipText: recordPath + text: recordPathBestName + secondary: true + + onClicked: recordPathDialog.open() + } + } + + RowLayout { + Layout.fillWidth: true + Layout.minimumHeight: JamiTheme.preferredFieldHeight + + Text { + Layout.fillWidth: true + Layout.fillHeight: true + + text: JamiStrings.saveScreenshotsTo + wrapMode: Text.WordWrap + color: JamiTheme.textColor + font.pointSize: JamiTheme.settingsFontSize + font.kerning: true + + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + } + + MaterialButton { + id: screenshotPathButton + + Layout.alignment: Qt.AlignRight + + preferredWidth: itemWidth + buttontextHeightMargin: JamiTheme.buttontextHeightMargin + textLeftPadding: JamiTheme.buttontextWizzardPadding + textRightPadding: JamiTheme.buttontextWizzardPadding + + toolTipText: screenshotPath + text: screenshotPathBestName + secondary: true + onClicked: screenshotPathDialog.open() + } + } + } + } +} diff --git a/src/app/settingsview/components/CallSettingsPage.qml b/src/app/settingsview/components/CallSettingsPage.qml new file mode 100644 index 000000000..6c30770da --- /dev/null +++ b/src/app/settingsview/components/CallSettingsPage.qml @@ -0,0 +1,330 @@ +/* + * Copyright (C) 2023 Savoir-faire Linux Inc. + * Author: Fadi Shehadeh <fadi.shehadeh@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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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 + + signal navigateToMainView + signal navigateToNewWizardView + title: JamiStrings.callSettingsTitle + + function updateAndShowModeratorsSlot() { + moderatorListWidget.model.reset() + moderatorListWidget.visible = moderatorListWidget.model.rowCount() > 0 + } + + Connections { + target: ContactAdapter + + function onDefaultModeratorsUpdated() { + updateAndShowModeratorsSlot() + } + } + + + flickableContent: ColumnLayout { + id: callSettingsColumnLayout + + width: contentFlickableWidth + spacing: JamiTheme.settingsBlockSpacing + anchors.left: parent.left + anchors.leftMargin: JamiTheme.preferredSettingsMarginSize + + ColumnLayout { + id: generalSettings + + width: parent.width + spacing: JamiTheme.settingsCategorySpacing + + Text { + id: enableAccountTitle + + Layout.alignment: Qt.AlignLeft + Layout.preferredWidth: parent.width + + text: JamiStrings.generalSettingsTitle + color: JamiTheme.textColor + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + wrapMode : Text.WordWrap + + font.pixelSize: JamiTheme.settingsTitlePixelSize + font.kerning: true + + } + + + ToggleSwitch { + id: checkBoxUntrusted + visible: !root.isSIP + + labelText: JamiStrings.allowCallsUnknownContacs + checked: CurrentAccount.PublicInCalls_DHT + onSwitchToggled: CurrentAccount.PublicInCalls_DHT = checked + } + + ToggleSwitch { + id: checkBoxAutoAnswer + + labelText: JamiStrings.autoAnswerCalls + checked: CurrentAccount.autoAnswer + onSwitchToggled: CurrentAccount.autoAnswer = checked + } + + } + + ColumnLayout { + id: ringtoneSettings + + width: parent.width + spacing: 9 + + Text { + + Layout.alignment: Qt.AlignLeft + Layout.preferredWidth: parent.width + + text: JamiStrings.ringtone + color: JamiTheme.textColor + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + wrapMode : Text.WordWrap + + font.pixelSize: JamiTheme.settingsTitlePixelSize + font.kerning: true + + } + + ToggleSwitch { + id: checkBoxCustomRingtone + + labelText: JamiStrings.enableCustomRingtone + checked: CurrentAccount.ringtoneEnabled_Ringtone + onSwitchToggled: CurrentAccount.ringtoneEnabled_Ringtone = checked + } + + SettingMaterialButton { + id: btnRingtone + + Layout.fillWidth: true + + enabled: checkBoxCustomRingtone.checked + + textField: UtilsAdapter.toFileInfoName(CurrentAccount.ringtonePath_Ringtone) + + titleField: JamiStrings.selectCustomRingtone + 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] + }) + dlg.fileAccepted.connect(function (file) { + var url = UtilsAdapter.getAbsPath(file.toString()) + if(url.length !== 0) { + CurrentAccount.ringtonePath_Ringtone = url + } + }) + } + } + } + + ColumnLayout { + id: rendezVousSettings + + width: parent.width + spacing: JamiTheme.settingsCategorySpacing + + Text { + + Layout.alignment: Qt.AlignLeft + Layout.preferredWidth: parent.width + + text: JamiStrings.rendezVousPoint + color: JamiTheme.textColor + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + wrapMode : Text.WordWrap + + font.pixelSize: JamiTheme.settingsTitlePixelSize + font.kerning: true + + } + + ToggleSwitch { + id: checkBoxRdv + + visible: !isSIP + + labelText: JamiStrings.rendezVous + checked: CurrentAccount.isRendezVous + onSwitchToggled: CurrentAccount.isRendezVous = checked + } + } + + ColumnLayout { + id: moderationSettings + + width: parent.width + spacing: 9 + + Text { + + Layout.alignment: Qt.AlignLeft + Layout.preferredWidth: parent.width + + text: JamiStrings.moderation + color: JamiTheme.textColor + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + wrapMode : Text.WordWrap + + font.pixelSize: JamiTheme.settingsTitlePixelSize + font.kerning: true + + } + + ToggleSwitch { + id: toggleLocalModerators + + labelText: JamiStrings.enableLocalModerators + checked: CurrentAccount.isLocalModeratorsEnabled + onSwitchToggled: CurrentAccount.isLocalModeratorsEnabled = checked + } + + + ToggleSwitch { + id: checkboxAllModerators + + labelText: JamiStrings.enableAllModerators + checked: CurrentAccount.isAllModeratorsEnabled + onSwitchToggled: CurrentAccount.isAllModeratorsEnabled = checked + } + + RowLayout { + Layout.fillWidth: true + Layout.minimumHeight: JamiTheme.preferredFieldHeight + + Text { + Layout.fillWidth: true + Layout.fillHeight: true + Layout.rightMargin: JamiTheme.preferredMarginSize + + color: JamiTheme.textColor + wrapMode : Text.WordWrap + text: JamiStrings.defaultModerators + font.pointSize: JamiTheme.settingsFontSize + font.kerning: true + + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + } + + MaterialButton { + id: addDefaultModeratorPushButton + + Layout.alignment: Qt.AlignCenter + + preferredWidth: textSize.width + 2*JamiTheme.buttontextWizzardPadding + buttontextHeightMargin: JamiTheme.buttontextHeightMargin + + primary: true + toolTipText: JamiStrings.addDefaultModerator + + text: JamiStrings.addModerator + + onClicked: { + ContactPickerCreation.presentContactPickerPopup( + ContactList.CONVERSATION, + appWindow) + } + + TextMetrics{ + id: textSize + font.weight: Font.Bold + font.pixelSize: JamiTheme.wizardViewButtonFontPixelSize + font.capitalization: Font.AllUppercase + text: addDefaultModeratorPushButton.text + } + } + } + + + JamiListView { + id: moderatorListWidget + + Layout.fillWidth: true + Layout.preferredHeight: 160 + spacing: JamiTheme.settingsListViewsSpacing + + visible: model.rowCount() > 0 + + model: ModeratorListModel { + lrcInstance: LRCInstance + } + + delegate: ContactItemDelegate { + id: moderatorListDelegate + + width: moderatorListWidget.width + height: 74 + + contactName: ContactName + contactID: ContactID + + btnImgSource: JamiStrings.optionRemove + btnToolTip: JamiStrings.removeDefaultModerator + + onClicked: moderatorListWidget.currentIndex = index + onBtnContactClicked: { + AccountAdapter.setDefaultModerator( + LRCInstance.currentAccountId, contactID, false) + updateAndShowModeratorsSlot() + } + } + } + } + } +} diff --git a/src/app/settingsview/components/ChatviewSettings.qml b/src/app/settingsview/components/ChatviewSettings.qml deleted file mode 100644 index 2be7ca2c2..000000000 --- a/src/app/settingsview/components/ChatviewSettings.qml +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (C) 2020-2023 Savoir-faire Linux Inc. - * Author: Sébastien Blin <sebastien.blin@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 - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * 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 "../../commoncomponents" - -ColumnLayout { - id:root - - property int itemWidth - - Label { - Layout.fillWidth: true - - text: JamiStrings.chat - font.pointSize: JamiTheme.headerFontSize - font.kerning: true - color: JamiTheme.textColor - - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignVCenter - } - - ToggleSwitch { - id: enableTypingIndicatorCheckbox - - Layout.fillWidth: true - Layout.leftMargin: JamiTheme.preferredMarginSize - - checked: UtilsAdapter.getAppValue(Settings.EnableTypingIndicator) - - labelText: JamiStrings.enableTypingIndicator - fontPointSize: JamiTheme.settingsFontSize - - tooltipText: JamiStrings.enableTypingIndicator - - onSwitchToggled: UtilsAdapter.setAppValue(Settings.Key.EnableTypingIndicator, checked) - } - - ToggleSwitch { - id: displayImagesCheckbox - visible: WITH_WEBENGINE - - Layout.fillWidth: true - Layout.leftMargin: JamiTheme.preferredMarginSize - - checked: UtilsAdapter.getAppValue(Settings.DisplayHyperlinkPreviews) - - labelText: JamiStrings.displayHyperlinkPreviews - fontPointSize: JamiTheme.settingsFontSize - - tooltipText: JamiStrings.displayHyperlinkPreviews - - onSwitchToggled: { - UtilsAdapter.setAppValue(Settings.Key.DisplayHyperlinkPreviews, checked) - } - } - - SettingsComboBox { - id: outputComboBoxSetting - - Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.preferredFieldHeight - Layout.leftMargin: JamiTheme.preferredMarginSize - - labelText: JamiStrings.layout - tipText: JamiStrings.layout - fontPointSize: JamiTheme.settingsFontSize - comboModel: ListModel { - id: layoutModel - Component.onCompleted: { - append({ textDisplay: JamiStrings.horizontalViewOpt }) - append({ textDisplay: JamiStrings.verticalViewOpt }) - } - } - widthOfComboBox: itemWidth - role: "textDisplay" - - modelIndex: UtilsAdapter.getAppValue(Settings.Key.ShowChatviewHorizontally) ? 1 : 0 - - onActivated: { - 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 - } - } - } -} diff --git a/src/app/settingsview/components/ContactItemDelegate.qml b/src/app/settingsview/components/ContactItemDelegate.qml index 897e39495..d758734e5 100644 --- a/src/app/settingsview/components/ContactItemDelegate.qml +++ b/src/app/settingsview/components/ContactItemDelegate.qml @@ -36,9 +36,10 @@ ItemDelegate { signal btnContactClicked - highlighted: ListView.isCurrentItem background: Rectangle { - color: highlighted? JamiTheme.selectedColor : JamiTheme.editBackgroundColor + color: JamiTheme.editBackgroundColor + height: root.height + radius: 5 } RowLayout { @@ -106,21 +107,29 @@ ItemDelegate { } } - PushButton { + MaterialButton { id: btnContact - Layout.alignment: Qt.AlignVCenter | Qt.AlignRight Layout.rightMargin: 16 - Layout.preferredWidth: JamiTheme.preferredFieldHeight - Layout.preferredHeight: JamiTheme.preferredFieldHeight - source: btnImgSource - imageColor: JamiTheme.textColor - normalColor: highlighted? JamiTheme.selectedColor : JamiTheme.editBackgroundColor + TextMetrics{ + id: textSize + font.weight: Font.Bold + font.pixelSize: JamiTheme.wizardViewButtonFontPixelSize + font.capitalization: Font.AllUppercase + text: btnContact.text + } + + secondary: true + buttontextHeightMargin: 14 + + text: btnImgSource + preferredWidth: textSize.width + 2*JamiTheme.buttontextWizzardPadding toolTipText: btnToolTip onClicked: btnContactClicked() + } } } diff --git a/src/app/settingsview/components/CurrentAccountSettings.qml b/src/app/settingsview/components/CurrentAccountSettings.qml index 4ced54f45..7b18082fe 100644 --- a/src/app/settingsview/components/CurrentAccountSettings.qml +++ b/src/app/settingsview/components/CurrentAccountSettings.qml @@ -31,7 +31,6 @@ Rectangle { id: root property bool isSIP - property int contentWidth: currentAccountSettingsColumnLayout.width property int preferredHeight: currentAccountSettingsColumnLayout.implicitHeight property int preferredColumnWidth : Math.min(root.width / 2 - 50, 350) @@ -56,30 +55,6 @@ Rectangle { width: Math.min(JamiTheme.maximumWidthSettingsView, root.width) - ToggleSwitch { - id: accountEnableCheckBox - - Layout.topMargin: JamiTheme.preferredMarginSize - Layout.leftMargin: JamiTheme.preferredMarginSize - Layout.rightMargin: JamiTheme.preferredMarginSize - - labelText: JamiStrings.enableAccount - fontPointSize: JamiTheme.headerFontSize - - checked: CurrentAccount.enabled - - onSwitchToggled: CurrentAccount.enableAccount(checked) - } - - AccountProfile { - id: accountProfile - - Layout.fillWidth: true - Layout.topMargin: JamiTheme.preferredMarginSize - Layout.leftMargin: JamiTheme.preferredMarginSize - Layout.rightMargin: JamiTheme.preferredMarginSize - } - UserIdentity { id: userIdentity isSIP: root.isSIP @@ -100,7 +75,7 @@ Rectangle { Layout.topMargin: JamiTheme.preferredMarginSize preferredWidth: JamiTheme.preferredFieldWidth - preferredHeight: JamiTheme.preferredFieldHeight + buttontextHeightMargin: JamiTheme.buttontextHeightMargin color: JamiTheme.buttonTintedBlack hoveredColor: JamiTheme.buttonTintedBlackHovered @@ -131,7 +106,7 @@ Rectangle { Layout.alignment: Qt.AlignHCenter preferredWidth: JamiTheme.preferredFieldWidth - preferredHeight: JamiTheme.preferredFieldHeight + buttontextHeightMargin: JamiTheme.buttontextHeightMargin color: JamiTheme.buttonTintedBlack hoveredColor: JamiTheme.buttonTintedBlackHovered @@ -188,7 +163,7 @@ Rectangle { Layout.rightMargin: JamiTheme.preferredMarginSize preferredWidth: JamiTheme.preferredFieldWidth - preferredHeight: JamiTheme.preferredFieldHeight + buttontextHeightMargin: JamiTheme.buttontextHeightMargin color: JamiTheme.buttonTintedRed hoveredColor: JamiTheme.buttonTintedRedHovered diff --git a/src/app/settingsview/components/CustomizeProfilePage.qml b/src/app/settingsview/components/CustomizeProfilePage.qml new file mode 100644 index 000000000..932b63b28 --- /dev/null +++ b/src/app/settingsview/components/CustomizeProfilePage.qml @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2023 Savoir-faire Linux Inc. + * Author: Fadi Shehadeh <fadi.shehadeh@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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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 { + id: root + + signal navigateToMainView + signal navigateToNewWizardView + title: JamiStrings.customizeProfile + + function stopBooth() { + currentAccountAvatar.stopBooth() + } + + + flickableContent: ColumnLayout { + id: currentAccountEnableColumnLayout + + width: contentFlickableWidth + spacing: JamiTheme.settingsBlockSpacing + anchors.left: parent.left + anchors.leftMargin: JamiTheme.preferredSettingsMarginSize + + RowLayout { + + spacing: 40 + Layout.preferredWidth: parent.width + + Connections { + target: settingsViewRect + + function onStopBooth() { + stopBooth() + } + } + + PhotoboothView { + id: currentAccountAvatar + width: avatarSize + height: avatarSize + + Layout.alignment: Qt.AlignCenter + + imageId: LRCInstance.currentAccountId + avatarSize: 150 + } + + ModalTextEdit { + id: displayNameLineEdit + + Layout.alignment: Qt.AlignCenter + Layout.preferredHeight: JamiTheme.preferredFieldHeight + 8 + Layout.fillWidth: true + + staticText: CurrentAccount.alias + placeholderText: JamiStrings.enterNickname + + onAccepted: AccountAdapter.setCurrAccDisplayName(dynamicText) + } + } + + Text { + id: description + + Layout.alignment: Qt.AlignLeft + Layout.preferredWidth: parent.width + Layout.bottomMargin: JamiTheme.preferredSettingsBottomMarginSize + + text: JamiStrings.customizeAccountDescription + color: JamiTheme.textColor + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + wrapMode : Text.WordWrap + + font.pixelSize: JamiTheme.settingsDescriptionPixelSize + font.kerning: true + lineHeight: JamiTheme.wizardViewTextLineHeight + } + } +} diff --git a/src/app/settingsview/components/DeviceItemDelegate.qml b/src/app/settingsview/components/DeviceItemDelegate.qml index 73bba9ced..fdf12b53c 100644 --- a/src/app/settingsview/components/DeviceItemDelegate.qml +++ b/src/app/settingsview/components/DeviceItemDelegate.qml @@ -1,6 +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 @@ -38,29 +39,27 @@ ItemDelegate { signal btnRemoveDeviceClicked - highlighted: ListView.isCurrentItem background: Rectangle { - color: highlighted? JamiTheme.selectedColor : JamiTheme.editBackgroundColor + color: JamiTheme.editBackgroundColor + height: root.height + radius: 5 } RowLayout { + id: rowLayout anchors.fill: root - Image { + ResponsiveImage { id: deviceImage + color: JamiTheme.tintedBlue + Layout.alignment: Qt.AlignVCenter Layout.preferredWidth: 24 Layout.preferredHeight: 24 Layout.leftMargin: JamiTheme.preferredMarginSize - layer { - enabled: true - effect: ColorOverlay { - color: JamiTheme.textColor - } - } source: JamiResources.baseline_desktop_windows_24dp_svg } @@ -69,12 +68,13 @@ ItemDelegate { Layout.fillWidth: true Layout.fillHeight: true - Layout.leftMargin: JamiTheme.preferredMarginSize + Layout.leftMargin: JamiTheme.preferredMarginSize / 2 + Layout.alignment: Qt.AlignVCenter MaterialLineEdit { id: editDeviceName - Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter + Layout.alignment: Qt.AlignLeft Layout.fillWidth: true Layout.preferredHeight: 30 @@ -115,9 +115,10 @@ ItemDelegate { Text { id: labelDeviceId - Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter + Layout.alignment: Qt.AlignLeft Layout.fillWidth: true Layout.leftMargin: editDeviceName.leftPadding + Layout.bottomMargin: 10 elide: Text.ElideRight font.pointSize: JamiTheme.textFontSize @@ -130,11 +131,11 @@ ItemDelegate { id: btnEditDevice Layout.alignment: Qt.AlignRight | Qt.AlignVCenter - Layout.rightMargin: 16 + Layout.rightMargin: 13 Layout.preferredWidth: JamiTheme.preferredFieldHeight Layout.preferredHeight: JamiTheme.preferredFieldHeight - imageColor: JamiTheme.textColor + imageColor: JamiTheme.tintedBlue normalColor: highlighted ? JamiTheme.selectedColor : JamiTheme.editBackgroundColor @@ -143,7 +144,7 @@ ItemDelegate { (editable ? JamiResources.round_save_alt_24dp_svg : JamiResources.round_edit_24dp_svg) : - JamiResources.round_remove_circle_24dp_svg + JamiResources.delete_24dp_svg toolTipText: isCurrent ? (editable ? @@ -153,23 +154,18 @@ ItemDelegate { onClicked: { if (isCurrent) { - if (!editable) + if (!editable) { editable = !editable - else + editDeviceName.forceActiveFocus() + } + else { editDeviceName.focus = false + editDeviceName.accepted() + } } else { btnRemoveDeviceClicked() } } } } - - CustomBorder { - commonBorder: false - lBorderwidth: 0 - rBorderwidth: 0 - tBorderwidth: 0 - bBorderwidth: 2 - borderColor: JamiTheme.selectedColor - } } diff --git a/src/app/settingsview/components/FileTransferSettings.qml b/src/app/settingsview/components/FileTransferSettings.qml deleted file mode 100644 index aa9cebdc0..000000000 --- a/src/app/settingsview/components/FileTransferSettings.qml +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2021-2023 Savoir-faire Linux Inc. - * Author: Sébastien Blin <sebastien.blin@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 - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * 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.Constants 1.1 - -ColumnLayout { - id:root - - property int itemWidth - - Label { - Layout.fillWidth: true - - text: JamiStrings.fileTransfer - font.pointSize: JamiTheme.headerFontSize - font.kerning: true - color: JamiTheme.textColor - - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignVCenter - } - - ToggleSwitch { - id: autoAcceptFilesCheckbox - Layout.fillWidth: true - Layout.leftMargin: JamiTheme.preferredMarginSize - - checked: CurrentAccount.autoTransferFromTrusted - - labelText: JamiStrings.autoAcceptFiles - fontPointSize: JamiTheme.settingsFontSize - - tooltipText: JamiStrings.autoAcceptFiles - - onSwitchToggled: CurrentAccount.autoTransferFromTrusted = checked - } - - SettingSpinBox { - id: acceptTransferBelowSpinBox - Layout.fillWidth: true - Layout.leftMargin: JamiTheme.preferredMarginSize - - title: JamiStrings.acceptTransferBelow - tooltipText: JamiStrings.acceptTransferTooltip - itemWidth: root.itemWidth - bottomValue: 0 - - valueField: CurrentAccount.autoTransferSizeThreshold - - onNewValue: CurrentAccount.autoTransferSizeThreshold = valueField - } -} diff --git a/src/app/settingsview/components/FileTransferSettingsPage.qml b/src/app/settingsview/components/FileTransferSettingsPage.qml new file mode 100644 index 000000000..c2c0a7e22 --- /dev/null +++ b/src/app/settingsview/components/FileTransferSettingsPage.qml @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2023 Savoir-faire Linux Inc. + * Author: Fadi Shehadeh <fadi.shehadeh@savoirfairelinux.com> + * Author: Sébastien Blin <sebastien.blin@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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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 { + id: root + + property int itemWidth: 164 + + signal navigateToMainView + signal navigateToNewWizardView + title: JamiStrings.fileTransfer + + + flickableContent: ColumnLayout { + id: callSettingsColumnLayout + + width: contentFlickableWidth + spacing: JamiTheme.settingsCategorySpacing + anchors.left: parent.left + anchors.leftMargin: JamiTheme.preferredSettingsMarginSize + + ToggleSwitch { + id: autoAcceptFilesCheckbox + Layout.fillWidth: true + + checked: CurrentAccount.autoTransferFromTrusted + labelText: JamiStrings.autoAcceptFiles + tooltipText: JamiStrings.autoAcceptFiles + onSwitchToggled: CurrentAccount.autoTransferFromTrusted = checked + } + + SettingSpinBox { + id: acceptTransferBelowSpinBox + Layout.fillWidth: true + + title: JamiStrings.acceptTransferBelow + tooltipText: JamiStrings.acceptTransferTooltip + itemWidth: root.itemWidth + bottomValue: 0 + + valueField: CurrentAccount.autoTransferSizeThreshold + onNewValue: CurrentAccount.autoTransferSizeThreshold = valueField + } + + MaterialButton { + id: defaultSettings + + TextMetrics{ + id: defaultSettingsTextSize + font.weight: Font.Bold + font.pixelSize: JamiTheme.wizardViewButtonFontPixelSize + font.capitalization: Font.AllUppercase + text: defaultSettings.text + } + + secondary: true + + text: JamiStrings.defaultSettings + 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) + } + } + } +} diff --git a/src/app/settingsview/components/GeneralSettingsPage.qml b/src/app/settingsview/components/GeneralSettingsPage.qml index e91e85bd8..07b7acd23 100644 --- a/src/app/settingsview/components/GeneralSettingsPage.qml +++ b/src/app/settingsview/components/GeneralSettingsPage.qml @@ -43,74 +43,6 @@ Rectangle { width: Math.min(JamiTheme.maximumWidthSettingsView, root.width) - // system setting panel - SystemSettings { - Layout.fillWidth: true - Layout.topMargin: JamiTheme.preferredMarginSize - Layout.leftMargin: JamiTheme.preferredMarginSize - Layout.rightMargin: JamiTheme.preferredMarginSize - itemWidth: preferredColumnWidth - } - - // chatview setting panel - ChatviewSettings { - Layout.fillWidth: true - Layout.topMargin: JamiTheme.preferredMarginSize - Layout.leftMargin: JamiTheme.preferredMarginSize - Layout.rightMargin: JamiTheme.preferredMarginSize - - itemWidth: preferredColumnWidth - } - - // location sharing setting panel - LocationSharingSettings { - Layout.fillWidth: true - Layout.topMargin: JamiTheme.preferredMarginSize - Layout.leftMargin: JamiTheme.preferredMarginSize - Layout.rightMargin: JamiTheme.preferredMarginSize - - itemWidth: preferredColumnWidth - } - - // file transfer setting panel - FileTransferSettings { - id: fileTransferSettings - Layout.fillWidth: true - Layout.topMargin: JamiTheme.preferredMarginSize - Layout.leftMargin: JamiTheme.preferredMarginSize - Layout.rightMargin: JamiTheme.preferredMarginSize - - itemWidth: preferredColumnWidth - } - - // call recording setting panel - RecordingSettings { - Layout.fillWidth: true - Layout.topMargin: JamiTheme.preferredMarginSize - Layout.leftMargin: JamiTheme.preferredMarginSize - Layout.rightMargin: JamiTheme.preferredMarginSize - - itemWidth: preferredColumnWidth - } - - // Trouble shooting setting panel - TroubleshootSettings { - Layout.fillWidth: true - Layout.topMargin: JamiTheme.preferredMarginSize - Layout.leftMargin: JamiTheme.preferredMarginSize - Layout.rightMargin: JamiTheme.preferredMarginSize - Layout.bottomMargin: JamiTheme.preferredMarginSize - itemWidth: preferredColumnWidth - } - - // update setting panel - UpdateSettings { - Layout.fillWidth: true - Layout.leftMargin: JamiTheme.preferredMarginSize - Layout.rightMargin: JamiTheme.preferredMarginSize - Layout.bottomMargin: JamiTheme.preferredMarginSize - visible: UpdateManager.isUpdaterEnabled() - } } } diff --git a/src/app/settingsview/components/LevelMeter.qml b/src/app/settingsview/components/LevelMeter.qml index ad17cf8fb..fbdc6a167 100644 --- a/src/app/settingsview/components/LevelMeter.qml +++ b/src/app/settingsview/components/LevelMeter.qml @@ -21,6 +21,7 @@ import QtQuick.Controls import net.jami.Models 1.1 import net.jami.Adapters 1.1 +import net.jami.Constants 1.1 ProgressBar { id: root @@ -31,6 +32,17 @@ ProgressBar { return clamp(rmsLevel * 300.0, 0.0, 100.0) } + contentItem: Item { + implicitWidth: parent.width + implicitHeight: parent.height + + Rectangle { + width: root.visualPosition * parent.width + height: parent.height + color: JamiTheme.tintedBlue + } + } + onVisibleChanged: { if (visible) { rmsLevel = 0 diff --git a/src/app/settingsview/components/LinkDeviceDialog.qml b/src/app/settingsview/components/LinkDeviceDialog.qml index d84bf6dfc..9e20a0d22 100644 --- a/src/app/settingsview/components/LinkDeviceDialog.qml +++ b/src/app/settingsview/components/LinkDeviceDialog.qml @@ -159,7 +159,7 @@ BaseModalDialog { Layout.alignment: Qt.AlignHCenter preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 - preferredHeight: JamiTheme.preferredFieldHeight + buttontextHeightMargin: JamiTheme.buttontextHeightMargin color: enabled? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey hoveredColor: JamiTheme.buttonTintedBlackHovered @@ -179,7 +179,7 @@ BaseModalDialog { Layout.alignment: Qt.AlignHCenter preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 - preferredHeight: JamiTheme.preferredFieldHeight + buttontextHeightMargin: JamiTheme.buttontextHeightMargin color: JamiTheme.buttonTintedBlack hoveredColor: JamiTheme.buttonTintedBlackHovered @@ -330,7 +330,7 @@ BaseModalDialog { Layout.bottomMargin: JamiTheme.preferredMarginSize preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 - preferredHeight: JamiTheme.preferredFieldHeight + buttontextHeightMargin: JamiTheme.buttontextHeightMargin color: enabled ? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey hoveredColor: JamiTheme.buttonTintedBlackHovered diff --git a/src/app/settingsview/components/LinkedDevices.qml b/src/app/settingsview/components/LinkedDevicesBase.qml similarity index 63% rename from src/app/settingsview/components/LinkedDevices.qml rename to src/app/settingsview/components/LinkedDevicesBase.qml index f59d1b84e..e8f78446c 100644 --- a/src/app/settingsview/components/LinkedDevices.qml +++ b/src/app/settingsview/components/LinkedDevicesBase.qml @@ -32,9 +32,16 @@ import "../../commoncomponents" ColumnLayout { id:root + width: parent.width + property bool inverted: false + property string title + property bool isCurrent: true + + visible: settingsListView.model.count > 0 + function removeDeviceSlot(index){ var deviceId = settingsListView.model.data(settingsListView.model.index(index,0), - DeviceItemListModel.DeviceID) + DeviceItemListModel.DeviceID) if(CurrentAccount.hasArchivePassword){ viewCoordinator.presentDialog( appWindow, @@ -49,7 +56,7 @@ ColumnLayout { infoText: JamiStrings.sureToRemoveDevice, buttonTitles: [JamiStrings.optionOk, JamiStrings.optionCancel], buttonStyles: [SimpleMessageDialog.ButtonStyle.TintedBlue, - SimpleMessageDialog.ButtonStyle.TintedBlack], + SimpleMessageDialog.ButtonStyle.TintedBlack], buttonCallBacks: [ function() { DeviceItemListModel.revokeDevice(deviceId, "") } ] @@ -57,13 +64,20 @@ ColumnLayout { } } - Label { - Layout.preferredHeight: JamiTheme.preferredFieldHeight + Text { + id: title - text: JamiStrings.linkedDevices + Layout.alignment: Qt.AlignLeft + Layout.preferredWidth: parent.width + + text: root.title color: JamiTheme.textColor + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + wrapMode : Text.WordWrap - font.pointSize: JamiTheme.headerFontSize + font.weight: Font.Medium + font.pixelSize: JamiTheme.settingsDescriptionPixelSize font.kerning: true } @@ -71,55 +85,34 @@ ColumnLayout { id: settingsListView Layout.fillWidth: true - Layout.preferredHeight: 160 + Layout.preferredHeight: Math.min(model.count, 5) * (70 + spacing) + spacing: JamiTheme.settingsListViewsSpacing + interactive: !isCurrent model: SortFilterProxyModel { sourceModel: DeviceItemListModel sorters: [ - RoleSorter { roleName: "IsCurrent"; sortOrder: Qt.DescendingOrder }, - StringSorter { - roleName: "DeviceName" - caseSensitivity: Qt.CaseInsensitive - } + RoleSorter { roleName: "DeviceName"; sortOrder: Qt.DescendingOrder} ] + + filters: ValueFilter { + roleName: "DeviceID" + value: CurrentAccount.deviceId + inverted: root.inverted + } } delegate: DeviceItemDelegate { id: settingsListDelegate - implicitWidth: settingsListView.width - width: settingsListView.width + Layout.fillWidth: true + implicitWidth: root.width height: 70 - - deviceName: DeviceName + deviceName: root.isCurrent ? DeviceName : "Device name: " + DeviceName deviceId: DeviceID - isCurrent: IsCurrent - onBtnRemoveDeviceClicked: removeDeviceSlot(index) + isCurrent: root.isCurrent } - } - - MaterialButton { - id: linkDevPushButton - - Layout.alignment: Qt.AlignCenter - - preferredWidth: JamiTheme.preferredFieldWidth - - visible: CurrentAccount.managerUri === "" && CurrentAccount.enabled - - color: JamiTheme.buttonTintedBlack - hoveredColor: JamiTheme.buttonTintedBlackHovered - pressedColor: JamiTheme.buttonTintedBlackPressed - secondary: true - toolTipText: JamiStrings.tipLinkNewDevice - - iconSource: JamiResources.round_add_24dp_svg - - text: JamiStrings.linkAnotherDevice - onClicked: viewCoordinator.presentDialog( - appWindow, - "settingsview/components/LinkDeviceDialog.qml") } } diff --git a/src/app/settingsview/components/LinkedDevicesPage.qml b/src/app/settingsview/components/LinkedDevicesPage.qml new file mode 100644 index 000000000..74c26b95d --- /dev/null +++ b/src/app/settingsview/components/LinkedDevicesPage.qml @@ -0,0 +1,134 @@ +/* + * Copyright (C) 2023 Savoir-faire Linux Inc. + * Author: Fadi Shehadeh <fadi.shehadeh@savoirfairelinux.com> + * Author: Franck Laurent <franck.laurent@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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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 { + id: root + + signal navigateToMainView + signal navigateToNewWizardView + title: JamiStrings.linkedDevicesSettingsTitle + + + flickableContent: ColumnLayout { + id: currentAccountEnableColumnLayout + + width: contentFlickableWidth + spacing: JamiTheme.settingsBlockSpacing + anchors.left: parent.left + anchors.leftMargin: JamiTheme.preferredSettingsMarginSize + + Text { + id: linkedDevicesTitle + + Layout.alignment: Qt.AlignLeft + Layout.preferredWidth: parent.width + + text: JamiStrings.linkedAccountList + color: JamiTheme.textColor + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + wrapMode : Text.WordWrap + + font.pixelSize: JamiTheme.settingsDescriptionPixelSize + font.kerning: true + } + + ColumnLayout { + id: linkedDevices + + width: parent.width + spacing: JamiTheme.settingsCategorySpacing + + LinkedDevicesBase { + id: thisDevice + + Layout.fillWidth: true + Layout.preferredWidth: parent.width + Layout.alignment: Qt.AlignHCenter + title: JamiStrings.linkedThisDevice + } + + LinkedDevicesBase { + id: otherDevices + + Layout.fillWidth: true + Layout.preferredWidth: parent.width + Layout.alignment: Qt.AlignHCenter + inverted: true + isCurrent: false + title: JamiStrings.linkedOtherDevices + } + } + + Text { + id: linkedDevicesDescription + + Layout.alignment: Qt.AlignLeft + Layout.preferredWidth: parent.width + visible: (CurrentAccount.managerUri === "" && CurrentAccount.enabled) + + text: JamiStrings.linkedAccountDescription + color: JamiTheme.textColor + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + wrapMode : Text.WordWrap + + font.pixelSize: JamiTheme.settingsDescriptionPixelSize + font.kerning: true + lineHeight: JamiTheme.wizardViewTextLineHeight + } + + MaterialButton { + id: linkDevPushButton + + TextMetrics{ + id: linkDevPushButtonTextSize + font.weight: Font.Bold + font.pixelSize: JamiTheme.wizardViewButtonFontPixelSize + text: linkDevPushButton.text + } + + Layout.alignment: Qt.AlignLeft + preferredWidth: linkDevPushButtonTextSize.width + 2*JamiTheme.buttontextWizzardPadding + + visible: CurrentAccount.managerUri === "" && CurrentAccount.enabled + + primary: true + toolTipText: JamiStrings.tipLinkNewDevice + text: JamiStrings.linkAnotherDevice + + onClicked: viewCoordinator.presentDialog( + appWindow, + "settingsview/components/LinkDeviceDialog.qml", + ) + } + } +} diff --git a/src/app/settingsview/components/LocationSharingSettings.qml b/src/app/settingsview/components/LocationSharingSettings.qml deleted file mode 100644 index 4f240a598..000000000 --- a/src/app/settingsview/components/LocationSharingSettings.qml +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (C) 2022-2023 Savoir-faire Linux Inc. - * Author: Nicolas Vengeon <nicolas.vengeon@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 - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * 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 "../../commoncomponents" - -ColumnLayout { - id: root - - property int itemWidth - - Label { - Layout.fillWidth: true - - text: JamiStrings.locationSharingLabel - font.pointSize: JamiTheme.headerFontSize - font.kerning: true - color: JamiTheme.textColor - - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignVCenter - } - - ToggleSwitch { - id: isTimeLimit - - visible: WITH_WEBENGINE - - Layout.fillWidth: true - Layout.leftMargin: JamiTheme.preferredMarginSize - - checked: UtilsAdapter.getAppValue(Settings.PositionShareLimit) - - labelText: JamiStrings.positionShareLimit - fontPointSize: JamiTheme.settingsFontSize - - tooltipText: JamiStrings.positionShareLimit - - onSwitchToggled: { - positionSharingLimitation = !UtilsAdapter.getAppValue(Settings.PositionShareLimit) - UtilsAdapter.setAppValue(Settings.PositionShareLimit, - positionSharingLimitation) - - } - property bool positionSharingLimitation: UtilsAdapter.getAppValue(Settings.PositionShareLimit) - } - - RowLayout { - id: timeSharingLocation - - Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.preferredFieldHeight - Layout.leftMargin: JamiTheme.preferredMarginSize - visible: isTimeLimit.positionSharingLimitation - - function standartCountdown(minutes) { - var hour = Math.floor(minutes / 60) - var min = minutes % 60 - if (hour) { - if (min) - return qsTr("%1h%2min").arg(hour).arg(min) - else - return qsTr("%1h").arg(hour) - } - return qsTr("%1min").arg(min) - } - - Text { - Layout.fillWidth: true - Layout.rightMargin: JamiTheme.preferredMarginSize / 2 - - color: JamiTheme.textColor - text: JamiStrings.positionShareDuration - font.pointSize: JamiTheme.settingsFontSize - font.kerning: true - elide: Text.ElideRight - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignVCenter - } - - Text { - id: timeSharingLocationValueLabel - - Layout.alignment: Qt.AlignRight - Layout.fillHeight: true - Layout.fillWidth: true - Layout.rightMargin: JamiTheme.preferredMarginSize / 2 - - color: JamiTheme.textColor - text: timeSharingLocation.standartCountdown(UtilsAdapter.getAppValue(Settings.PositionShareDuration)) - - font.pointSize: JamiTheme.settingsFontSize - font.kerning: true - - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter - } - - Slider { - id: timeSharingSlider - - Layout.maximumWidth: itemWidth - Layout.alignment: Qt.AlignRight - Layout.fillWidth: true - Layout.fillHeight: true - - value: Math.log(UtilsAdapter.getAppValue(Settings.PositionShareDuration)) - - from: 0.5 - to: Math.log(600) - stepSize: 0.05 - - onMoved: { - timeSharingLocationValueLabel.text = timeSharingLocation.standartCountdown(Math.floor(Math.exp(value))) - UtilsAdapter.setAppValue(Settings.PositionShareDuration, Math.floor(Math.exp(value))) - } - - MaterialToolTip { - id: toolTip - - text: JamiStrings.positionShareDuration - visible: parent.hovered - delay: Qt.styleHints.mousePressAndHoldInterval - } - } - } -} diff --git a/src/app/settingsview/components/LocationSharingSettingsPage.qml b/src/app/settingsview/components/LocationSharingSettingsPage.qml new file mode 100644 index 000000000..9c5479cdd --- /dev/null +++ b/src/app/settingsview/components/LocationSharingSettingsPage.qml @@ -0,0 +1,220 @@ +/* + * Copyright (C) 2023 Savoir-faire Linux Inc. + * Author: Fadi Shehadeh <fadi.shehadeh@savoirfairelinux.com> + * Author: Nicolas Vengeon <nicolas.vengeon@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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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 + + signal navigateToMainView + signal navigateToNewWizardView + title: JamiStrings.locationSharingLabel + + + flickableContent: ColumnLayout { + id: callSettingsColumnLayout + + width: contentFlickableWidth + spacing: JamiTheme.settingsCategorySpacing + anchors.left: parent.left + anchors.leftMargin: JamiTheme.preferredSettingsMarginSize + + RowLayout { + id: timeSharingLocation + + Layout.fillWidth: true + Layout.preferredHeight: JamiTheme.preferredFieldHeight + + function standartCountdown(minutes) { + var hour = Math.floor(minutes / 60) + var min = minutes % 60 + if (hour) { + if (min) + return qsTr("%1h%2min").arg(hour).arg(min) + else + return qsTr("%1h").arg(hour) + } + return qsTr("%1min").arg(min) + } + + Text { + Layout.fillWidth: true + Layout.rightMargin: JamiTheme.preferredMarginSize / 2 + + color: JamiTheme.textColor + text: JamiStrings.positionShareDuration + font.pointSize: JamiTheme.settingsFontSize + font.kerning: true + wrapMode : Text.WordWrap + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + } + } + + RowLayout { + + visible: WITH_WEBENGINE + Layout.preferredWidth: parent.width + Layout.preferredHeight: childrenRect.height + + Text { + id: minValue + + Layout.alignment: Qt.AlignLeft + Layout.fillHeight: true + + color: JamiTheme.tintedBlue + text: JamiStrings.minLocationDuration + + font.pointSize: JamiTheme.settingsFontSize + font.kerning: true + + verticalAlignment: Text.AlignVCenter + } + + Text { + id: maxValue + + Layout.alignment: Qt.AlignRight + Layout.fillHeight: true + + color: JamiTheme.tintedBlue + text: JamiStrings.maxLocationDuration + + font.pointSize: JamiTheme.settingsFontSize + font.kerning: true + verticalAlignment: Text.AlignVCenter + } + } + + Slider { + id: timeSharingSlider + + visible: WITH_WEBENGINE + + Layout.maximumWidth: itemWidth + Layout.alignment: Qt.AlignLeft + Layout.fillWidth: true + Layout.fillHeight: true + + 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 + } + } + + from: 0.5 + to: Math.log(600) + stepSize: 0.05 + + onMoved: valueLabel() + + Component.onCompleted: valueLabel() + + background: Rectangle { + implicitWidth: 200 + implicitHeight: 2 + width: timeSharingSlider.availableWidth + height: implicitHeight + radius: 2 + color: JamiTheme.tintedBlue + } + + handle: ColumnLayout { + x: timeSharingSlider.visualPosition * timeSharingSlider.availableWidth - textSize.width / 2 + + + Rectangle { + Layout.topMargin: -12 + implicitWidth: 6 + implicitHeight: 25 + radius: implicitWidth + color: JamiTheme.tintedBlue + Layout.alignment: Qt.AlignHCenter + } + + Text { + id: timeSharingLocationValueLabel + + TextMetrics{ + id: textSize + font.pointSize: JamiTheme.settingsFontSize + font.kerning: true + font.bold: true + text: timeSharingLocationValueLabel.text + } + + color: JamiTheme.tintedBlue + text: timeSharingLocation.standartCountdown(UtilsAdapter.getAppValue(Settings.PositionShareDuration)) + Layout.alignment: Qt.AlignHCenter + + font.pointSize: JamiTheme.settingsFontSize + font.kerning: true + font.bold: true + } + } + } + + MaterialButton { + id: defaultSettings + + TextMetrics{ + id: defaultSettingsTextSize + font.weight: Font.Bold + font.pixelSize: JamiTheme.wizardViewButtonFontPixelSize + font.capitalization: Font.AllUppercase + text: defaultSettings.text + } + + secondary: true + + text: JamiStrings.defaultSettings + preferredWidth: defaultSettingsTextSize.width + 2*JamiTheme.buttontextWizzardPadding + + onClicked: { + 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 6c519fa45..1308db7ff 100644 --- a/src/app/settingsview/components/LogsView.qml +++ b/src/app/settingsview/components/LogsView.qml @@ -121,7 +121,6 @@ Window { checked: false labelText: JamiStrings.logsViewDisplay - fontPointSize: JamiTheme.settingsFontSize onSwitchToggled: { logging = !logging @@ -145,7 +144,7 @@ Window { Layout.bottomMargin: JamiTheme.preferredMarginSize preferredWidth: itemWidth / widthDivisor - preferredHeight: JamiTheme.preferredFieldHeight + buttontextHeightMargin: JamiTheme.buttontextHeightMargin secondary: true color: JamiTheme.buttonTintedBlack @@ -170,7 +169,7 @@ Window { Layout.alignment: Qt.AlignHCenter preferredWidth: itemWidth / widthDivisor - preferredHeight: JamiTheme.preferredFieldHeight + buttontextHeightMargin: JamiTheme.buttontextHeightMargin color: JamiTheme.buttonTintedBlack hoveredColor: JamiTheme.buttonTintedBlackHovered @@ -210,7 +209,7 @@ Window { Layout.rightMargin: JamiTheme.preferredMarginSize preferredWidth: itemWidth / widthDivisor - preferredHeight: JamiTheme.preferredFieldHeight + buttontextHeightMargin: JamiTheme.buttontextHeightMargin color: JamiTheme.buttonTintedBlack hoveredColor: JamiTheme.buttonTintedBlackHovered diff --git a/src/app/settingsview/components/ManageAccountPage.qml b/src/app/settingsview/components/ManageAccountPage.qml new file mode 100644 index 000000000..807cf3a39 --- /dev/null +++ b/src/app/settingsview/components/ManageAccountPage.qml @@ -0,0 +1,447 @@ +/* + * Copyright (C) 2023 Savoir-faire Linux Inc. + * Author: Fadi Shehadeh <fadi.shehadeh@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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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 { + id: root + + property bool isSIP + property int itemWidth: 250 + + signal navigateToMainView + signal navigateToNewWizardView + title: JamiStrings.manageAccountSettingsTitle + + flickableContent: ColumnLayout { + + id: manageAccountColumnLayout + + width: contentFlickableWidth + spacing: JamiTheme.settingsBlockSpacing + anchors.left: parent.left + anchors.leftMargin: JamiTheme.preferredSettingsMarginSize + + ColumnLayout { + id: enableAccount + + width: parent.width + spacing: JamiTheme.settingsCategorySpacing + + Text { + id: enableAccountTitle + + Layout.alignment: Qt.AlignLeft + Layout.preferredWidth: parent.width + + text: JamiStrings.enableAccountSettingsTitle + color: JamiTheme.textColor + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + wrapMode : Text.WordWrap + + font.pixelSize: JamiTheme.settingsTitlePixelSize + font.kerning: true + + } + + ToggleSwitch { + id: accountEnableSwitch + + Layout.alignment: Qt.AlignLeft + Layout.preferredWidth: parent.width + labelText: JamiStrings.enableAccountDescription + + widthOfSwitch: 60 + heightOfSwitch: 30 + + checked: CurrentAccount.enabled + onSwitchToggled: CurrentAccount.enableAccount(checked) + } + + } + + ColumnLayout { + id: userIdentity + + width: parent.width + spacing: JamiTheme.settingsCategorySpacing + visible: isSIP + + Text { + id: userIdentityTitle + + Layout.alignment: Qt.AlignLeft + Layout.preferredWidth: parent.width + + text: JamiStrings.identity + color: JamiTheme.textColor + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + wrapMode : Text.WordWrap + + font.pixelSize: JamiTheme.settingsTitlePixelSize + font.kerning: true + + } + + SIPUserIdentity { + id: sipUserIdentity + itemWidth: root.itemWidth + + Layout.fillWidth: true + } + } + + ColumnLayout { + id: jamiIdentity + + width: parent.width + visible: !isSIP + spacing: JamiTheme.settingsCategorySpacing + + Text { + id: jamiIdentityTitle + + Layout.alignment: Qt.AlignLeft + Layout.preferredWidth: parent.width + text: JamiStrings.jamiIdentity + color: JamiTheme.textColor + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + wrapMode: Text.WordWrap + + font.pixelSize: JamiTheme.settingsTitlePixelSize + font.kerning: true + } + + JamiIdentifier { + id: jamiIdentifier + + Layout.alignment: Qt.AlignLeft + Layout.topMargin: 10 + Layout.preferredWidth: Math.min(360, root.width - JamiTheme.preferredSettingsMarginSize) + backgroundColor: JamiTheme.jamiIdColor + } + + Text { + id: jamiIdentifierDescription + + Layout.alignment: Qt.AlignLeft + Layout.preferredWidth: parent.width + + text: JamiStrings.usernameAccountDescription + color: JamiTheme.textColor + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + wrapMode : Text.WordWrap + + font.pixelSize: JamiTheme.settingsDescriptionPixelSize + font.kerning: true + lineHeight: JamiTheme.wizardViewTextLineHeight + } + + } + + ColumnLayout { + id: encryptAccount + + width: parent.width + visible: !isSIP && CurrentAccount.managerUri === "" + spacing: JamiTheme.settingsCategorySpacing + + + Text { + id: encryptTitle + + Layout.alignment: Qt.AlignLeft + Layout.preferredWidth: parent.width + + text: JamiStrings.encryptTitle + color: JamiTheme.textColor + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + wrapMode : Text.WordWrap + + font.pixelSize: JamiTheme.settingsTitlePixelSize + font.kerning: true + } + + Text { + id: encryptDescription + + Layout.alignment: Qt.AlignLeft + Layout.preferredWidth: parent.width + + text: JamiStrings.ecryptAccountDescription + color: JamiTheme.textColor + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + wrapMode : Text.WordWrap + + font.pixelSize: JamiTheme.settingsDescriptionPixelSize + font.kerning: true + lineHeight: JamiTheme.wizardViewTextLineHeight + } + + MaterialButton { + id: passwdPushButton + + TextMetrics{ + id: passwdPushButtonTextSize + font.weight: Font.Bold + font.pixelSize: JamiTheme.wizardViewButtonFontPixelSize + text: passwdPushButton.text + } + + 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 }) + } + } + + ColumnLayout { + + id: saveAccount + width: parent.width + visible: !isSIP && CurrentAccount.managerUri === "" + spacing: JamiTheme.settingsCategorySpacing + + Text { + id: saveTitle + + Layout.alignment: Qt.AlignLeft + Layout.preferredWidth: parent.width + + text: JamiStrings.saveAccountTitle + color: JamiTheme.textColor + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + wrapMode : Text.WordWrap + + font.pixelSize: JamiTheme.settingsTitlePixelSize + font.kerning: true + } + + Text { + id: saveDescription + + Layout.alignment: Qt.AlignLeft + Layout.preferredWidth: parent.width + + text: JamiStrings.saveAccountDescription + color: JamiTheme.textColor + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + wrapMode : Text.WordWrap + + font.pixelSize: JamiTheme.settingsDescriptionPixelSize + font.kerning: true + lineHeight: JamiTheme.wizardViewTextLineHeight + } + + + MaterialButton { + id: btnExportAccount + + TextMetrics{ + id: btnExportAccountTextSize + font.weight: Font.Bold + font.pixelSize: JamiTheme.wizardViewButtonFontPixelSize + text: btnExportAccount.text + } + + preferredWidth: btnExportAccountTextSize.width + 2*JamiTheme.buttontextWizzardPadding + primary: true + Layout.alignment: Qt.AlignLeft + + toolTipText: JamiStrings.tipBackupAccount + 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] + }) + 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] + }) + } + }) + } + } + + } + + ColumnLayout { + + id: bannedAccount + width: parent.width + visible: !isSIP && CurrentAccount.hasBannedContacts + spacing: JamiTheme.settingsCategorySpacing + + Text { + id: bannedAccountTitle + + Layout.alignment: Qt.AlignLeft + Layout.preferredWidth: parent.width + + text: JamiStrings.bannedContacts + color: JamiTheme.textColor + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + wrapMode : Text.WordWrap + + font.pixelSize: JamiTheme.settingsTitlePixelSize + font.kerning: true + } + + BannedContacts { + id: bannedContacts + Layout.fillWidth: true + } + } + + ColumnLayout { + id: manageAccountDeleteColumnLayout + width: parent.width + spacing: JamiTheme.settingsCategorySpacing + + Text { + id: deleteTitle + + Layout.alignment: Qt.AlignLeft + Layout.preferredWidth: parent.width + + text: JamiStrings.deleteAccountTitle + color: JamiTheme.textColor + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + wrapMode : Text.WordWrap + + font.pixelSize: JamiTheme.settingsTitlePixelSize + font.kerning: true + } + + Text { + id: deleteDescription + + Layout.alignment: Qt.AlignLeft + Layout.preferredWidth: parent.width + + text: JamiStrings.deleteAccountDescription + color: JamiTheme.textColor + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + wrapMode : Text.WordWrap + + font.pixelSize: JamiTheme.settingsDescriptionPixelSize + font.kerning: true + lineHeight: JamiTheme.wizardViewTextLineHeight + } + + + MaterialButton { + id: deleteAccountPushButton + + TextMetrics{ + id: deleteAccountPushButtonTextSize + font.weight: Font.Bold + font.pixelSize: JamiTheme.wizardViewButtonFontPixelSize + text: deleteAccountPushButton.text + } + + preferredWidth: deleteAccountPushButtonTextSize.width + 2*JamiTheme.buttontextWizzardPadding + + primary: true + Layout.alignment: Qt.AlignLeft + Layout.rightMargin: JamiTheme.preferredMarginSize + + color: JamiTheme.buttonTintedRed + 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) + } + } + + } + } +} diff --git a/src/app/settingsview/components/MediaCodecDelegate.qml b/src/app/settingsview/components/MediaCodecDelegate.qml index a81046ea7..044b6e802 100644 --- a/src/app/settingsview/components/MediaCodecDelegate.qml +++ b/src/app/settingsview/components/MediaCodecDelegate.qml @@ -38,8 +38,10 @@ ItemDelegate { highlighted: ListView.isCurrentItem background: Rectangle { - color: highlighted? JamiTheme.selectedColor : JamiTheme.editBackgroundColor + color: highlighted || hovered ? JamiTheme.smartListSelectedColor : JamiTheme.editBackgroundColor } + hoverEnabled: true + RowLayout { anchors.fill: parent @@ -61,7 +63,7 @@ ItemDelegate { layer { enabled: true effect: ColorOverlay { - color: JamiTheme.textColor + color: JamiTheme.tintedBlue } mipmap: false smooth: true diff --git a/src/app/settingsview/components/NameRegistrationDialog.qml b/src/app/settingsview/components/NameRegistrationDialog.qml index d61125fb4..1acf3affd 100644 --- a/src/app/settingsview/components/NameRegistrationDialog.qml +++ b/src/app/settingsview/components/NameRegistrationDialog.qml @@ -146,7 +146,7 @@ BaseModalDialog { Layout.alignment: Qt.AlignHCenter preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 - preferredHeight: JamiTheme.preferredFieldHeight + buttontextHeightMargin: JamiTheme.buttontextHeightMargin color: enabled? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey hoveredColor: JamiTheme.buttonTintedBlackHovered @@ -165,7 +165,7 @@ BaseModalDialog { Layout.alignment: Qt.AlignHCenter preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 - preferredHeight: JamiTheme.preferredFieldHeight + buttontextHeightMargin: JamiTheme.buttontextHeightMargin color: JamiTheme.buttonTintedBlack hoveredColor: JamiTheme.buttonTintedBlackHovered @@ -248,7 +248,7 @@ BaseModalDialog { Layout.bottomMargin: JamiTheme.preferredMarginSize preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 - preferredHeight: JamiTheme.preferredFieldHeight + buttontextHeightMargin: JamiTheme.buttontextHeightMargin color: JamiTheme.buttonTintedBlack hoveredColor: JamiTheme.buttonTintedBlackHovered diff --git a/src/app/settingsview/components/PluginListView.qml b/src/app/settingsview/components/PluginListView.qml index b130fc60f..1260a0e23 100644 --- a/src/app/settingsview/components/PluginListView.qml +++ b/src/app/settingsview/components/PluginListView.qml @@ -60,7 +60,7 @@ Rectangle { Layout.topMargin: JamiTheme.preferredMarginSize / 2 preferredWidth: JamiTheme.preferredFieldWidth - preferredHeight: JamiTheme.preferredFieldHeight + buttontextHeightMargin: JamiTheme.buttontextHeightMargin color: JamiTheme.buttonTintedBlack hoveredColor: JamiTheme.buttonTintedBlackHovered diff --git a/src/app/settingsview/components/PluginPreferencesListView.qml b/src/app/settingsview/components/PluginPreferencesListView.qml index 3cefe4015..4014834fa 100644 --- a/src/app/settingsview/components/PluginPreferencesListView.qml +++ b/src/app/settingsview/components/PluginPreferencesListView.qml @@ -269,7 +269,7 @@ Rectangle { Layout.alignment: Qt.AlignCenter preferredWidth: JamiTheme.preferredFieldWidth - preferredHeight: JamiTheme.preferredFieldHeight + buttontextHeightMargin: JamiTheme.buttontextHeightMargin color: JamiTheme.buttonTintedBlack hoveredColor: JamiTheme.buttonTintedBlackHovered diff --git a/src/app/settingsview/components/PluginPreferencesView.qml b/src/app/settingsview/components/PluginPreferencesView.qml index f958459ae..4bcf9bc02 100644 --- a/src/app/settingsview/components/PluginPreferencesView.qml +++ b/src/app/settingsview/components/PluginPreferencesView.qml @@ -162,7 +162,7 @@ Rectangle { Layout.alignment: Qt.AlignCenter preferredWidth: JamiTheme.preferredFieldWidth - preferredHeight: JamiTheme.preferredFieldHeight + buttontextHeightMargin: JamiTheme.buttontextHeightMargin color: JamiTheme.buttonTintedBlack hoveredColor: JamiTheme.buttonTintedBlackHovered diff --git a/src/app/settingsview/components/PluginSettingsPage.qml b/src/app/settingsview/components/PluginSettingsPage.qml index c0cba6432..dd62832fd 100644 --- a/src/app/settingsview/components/PluginSettingsPage.qml +++ b/src/app/settingsview/components/PluginSettingsPage.qml @@ -26,54 +26,51 @@ import net.jami.Constants 1.1 import "../../commoncomponents" -Rectangle { +SettingsPageBase { id: root - property int contentWidth: pluginSettingsColumnLayout.width - property int preferredHeight: pluginSettingsColumnLayout.implicitHeight + title: JamiStrings.pluginSettingsTitle - color: JamiTheme.secondaryBackgroundColor - ColumnLayout { + flickableContent: ColumnLayout { id: pluginSettingsColumnLayout - anchors.horizontalCenter: root.horizontalCenter + width: contentFlickableWidth + spacing: JamiTheme.settingsBlockSpacing + anchors.left: parent.left + anchors.leftMargin: JamiTheme.preferredSettingsMarginSize - width: Math.min(JamiTheme.maximumWidthSettingsView, root.width) - ToggleSwitch { - id: enabledplugin + ColumnLayout { + id: generalSettings - checked: PluginAdapter.isEnabled + width: parent.width + spacing: JamiTheme.settingsCategorySpacing - Layout.alignment: Qt.AlignTop | Qt.AlignHCenter - Layout.fillWidth: true - Layout.topMargin: JamiTheme.preferredMarginSize - Layout.leftMargin: JamiTheme.preferredMarginSize - Layout.rightMargin: JamiTheme.preferredMarginSize + ToggleSwitch { + id: enabledplugin - labelText: JamiStrings.enable - fontPointSize: JamiTheme.headerFontSize + checked: PluginAdapter.isEnabled + Layout.alignment: Qt.AlignTop | Qt.AlignHCenter + Layout.fillWidth: true + labelText: JamiStrings.enable - onSwitchToggled: { - PluginModel.setPluginsEnabled(checked) - PluginAdapter.isEnabled = checked + onSwitchToggled: { + PluginModel.setPluginsEnabled(checked) + PluginAdapter.isEnabled = checked + } } - } - - PluginListView { - id: pluginListView - visible: PluginAdapter.isEnabled + PluginListView { + id: pluginListView - Layout.alignment: Qt.AlignTop | Qt.AlignHCenter - Layout.fillWidth: true - Layout.leftMargin: JamiTheme.preferredMarginSize - Layout.rightMargin: JamiTheme.preferredMarginSize + visible: PluginAdapter.isEnabled - Layout.topMargin: JamiTheme.preferredMarginSize - Layout.minimumHeight: 0 - Layout.preferredHeight: childrenRect.height + Layout.alignment: Qt.AlignTop | Qt.AlignHCenter + Layout.preferredWidth: parent.width + Layout.minimumHeight: 0 + Layout.preferredHeight: childrenRect.height + } } } } diff --git a/src/app/settingsview/components/RecordingSettings.qml b/src/app/settingsview/components/RecordingSettings.qml deleted file mode 100644 index 3b7d56741..000000000 --- a/src/app/settingsview/components/RecordingSettings.qml +++ /dev/null @@ -1,260 +0,0 @@ -/* - * Copyright (C) 2020-2023 Savoir-faire Linux Inc. - * Author: Aline Gondim Santos <aline.gondimsantos@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 - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * 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" - -ColumnLayout { - id: root - - property int itemWidth - property string recordPath: AVModel.getRecordPath() - property string screenshotPath: UtilsAdapter.getDirScreenshot() - - onRecordPathChanged: { - if(recordPath === "") - return - - if(AVModel) { - AVModel.setRecordPath(recordPath) - } - } - - onScreenshotPathChanged: { - if (screenshotPath === "") - return - UtilsAdapter.setScreenshotPath(screenshotPath) - } - - FolderDialog { - id: recordPathDialog - - title: JamiStrings.selectFolder - currentFolder: UtilsAdapter.getDirScreenshot() - options: FolderDialog.ShowDirsOnly - - onAccepted: { - var dir = UtilsAdapter.getAbsPath(folder.toString()) - recordPath = dir - } - } - - FolderDialog { - id: screenshotPathDialog - - title: JamiStrings.selectFolder - currentFolder: StandardPaths.writableLocation(StandardPaths.PicturesLocation) - options: FolderDialog.ShowDirsOnly - - onAccepted: { - var dir = UtilsAdapter.getAbsPath(folder.toString()) - screenshotPath = dir - } - } - - Timer{ - id: updateRecordQualityTimer - - interval: 500 - - onTriggered: AVModel.setRecordQuality(recordQualitySlider.value * 100) - } - - ElidedTextLabel { - Layout.fillWidth: true - - eText: JamiStrings.callRecording - font.pointSize: JamiTheme.headerFontSize - maxWidth: width - } - - ToggleSwitch { - id: alwaysRecordingCheckBox - - Layout.fillWidth: true - Layout.leftMargin: JamiTheme.preferredMarginSize - - checked: AVModel.getAlwaysRecord() - - labelText: JamiStrings.alwaysRecordCalls - tooltipText: JamiStrings.alwaysRecordCalls - fontPointSize: JamiTheme.settingsFontSize - - onSwitchToggled: AVModel.setAlwaysRecord(checked) - } - - ToggleSwitch { - id: recordPreviewCheckBox - - Layout.fillWidth: true - Layout.leftMargin: JamiTheme.preferredMarginSize - - checked: AVModel.getRecordPreview() - - labelText: JamiStrings.includeLocalVideo - fontPointSize: JamiTheme.settingsFontSize - - onSwitchToggled: AVModel.setRecordPreview(checked) - } - - RowLayout { - Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.preferredFieldHeight - Layout.leftMargin: JamiTheme.preferredMarginSize - - Text { - Layout.fillWidth: true - Layout.rightMargin: JamiTheme.preferredMarginSize / 2 - - color: JamiTheme.textColor - text: JamiStrings.quality - font.pointSize: JamiTheme.settingsFontSize - font.kerning: true - elide: Text.ElideRight - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignVCenter - } - - Text { - id: recordQualityValueLabel - - Layout.alignment: Qt.AlignRight - Layout.fillHeight: true - Layout.fillWidth: true - Layout.rightMargin: JamiTheme.preferredMarginSize / 2 - - color: JamiTheme.textColor - text: UtilsAdapter.getRecordQualityString(AVModel.getRecordQuality() / 100) - - font.pointSize: JamiTheme.settingsFontSize - font.kerning: true - - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter - } - - Slider { - id: recordQualitySlider - - Layout.maximumWidth: itemWidth - Layout.alignment: Qt.AlignRight - Layout.fillWidth: true - Layout.fillHeight: true - - value: AVModel.getRecordQuality() / 100 - - from: 0 - to: 500 - stepSize: 1 - - onMoved: { - recordQualityValueLabel.text = UtilsAdapter.getRecordQualityString(value) - updateRecordQualityTimer.restart() - } - - MaterialToolTip { - id: toolTip - text: JamiStrings.quality - visible: parent.hovered - delay: Qt.styleHints.mousePressAndHoldInterval - } - } - } - - RowLayout { - Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.preferredFieldHeight - Layout.leftMargin: JamiTheme.preferredMarginSize - - Label { - Layout.fillWidth: true - Layout.fillHeight: true - - text: JamiStrings.saveRecordingsTo - color: JamiTheme.textColor - font.pointSize: JamiTheme.settingsFontSize - font.kerning: true - - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignVCenter - } - - MaterialButton { - id: recordPathButton - - Layout.alignment: Qt.AlignRight - - preferredWidth: itemWidth - preferredHeight: JamiTheme.preferredFieldHeight - - toolTipText: JamiStrings.tipRecordFolder - text: recordPath - iconSource: JamiResources.round_folder_24dp_svg - color: JamiTheme.buttonTintedGrey - hoveredColor: JamiTheme.buttonTintedGreyHovered - pressedColor: JamiTheme.buttonTintedGreyPressed - - onClicked: recordPathDialog.open() - } - } - - RowLayout { - Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.preferredFieldHeight - Layout.leftMargin: JamiTheme.preferredMarginSize - - Label { - Layout.fillWidth: true - Layout.fillHeight: true - - text: JamiStrings.saveScreenshotsTo - color: JamiTheme.textColor - font.pointSize: JamiTheme.settingsFontSize - font.kerning: true - - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignVCenter - } - - MaterialButton { - id: screenshotPathButton - - Layout.alignment: Qt.AlignRight - - preferredWidth: itemWidth - preferredHeight: JamiTheme.preferredFieldHeight - - toolTipText: UtilsAdapter.getDirScreenshot() - text: screenshotPath - iconSource: JamiResources.round_folder_24dp_svg - color: JamiTheme.buttonTintedGrey - hoveredColor: JamiTheme.buttonTintedGreyHovered - pressedColor: JamiTheme.buttonTintedGreyPressed - - onClicked: screenshotPathDialog.open() - } - } -} diff --git a/src/app/settingsview/components/RevokeDevicePasswordDialog.qml b/src/app/settingsview/components/RevokeDevicePasswordDialog.qml index ad108cebe..82594b35d 100644 --- a/src/app/settingsview/components/RevokeDevicePasswordDialog.qml +++ b/src/app/settingsview/components/RevokeDevicePasswordDialog.qml @@ -83,7 +83,7 @@ BaseModalDialog { Layout.alignment: Qt.AlignHCenter preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 - preferredHeight: JamiTheme.preferredFieldHeight + buttontextHeightMargin: JamiTheme.buttontextHeightMargin color: enabled? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey hoveredColor: JamiTheme.buttonTintedBlackHovered @@ -106,7 +106,7 @@ BaseModalDialog { Layout.alignment: Qt.AlignHCenter preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8 - preferredHeight: JamiTheme.preferredFieldHeight + buttontextHeightMargin: JamiTheme.buttontextHeightMargin color: JamiTheme.buttonTintedBlack hoveredColor: JamiTheme.buttonTintedBlackHovered diff --git a/src/app/settingsview/components/SIPUserIdentity.qml b/src/app/settingsview/components/SIPUserIdentity.qml index dce7e8628..2eb34dc9e 100644 --- a/src/app/settingsview/components/SIPUserIdentity.qml +++ b/src/app/settingsview/components/SIPUserIdentity.qml @@ -34,7 +34,6 @@ ColumnLayout { id: usernameSIP Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.preferredFieldHeight staticText: CurrentAccount.username @@ -48,7 +47,6 @@ ColumnLayout { id: hostnameSIP Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.preferredFieldHeight staticText: CurrentAccount.hostname @@ -62,7 +60,6 @@ ColumnLayout { id: passSIPlineEdit Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.preferredFieldHeight staticText: CurrentAccount.password @@ -77,7 +74,6 @@ ColumnLayout { id: proxySIP Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.preferredFieldHeight staticText: CurrentAccount.routeset diff --git a/src/app/settingsview/components/ScreenSharingSettingsPage.qml b/src/app/settingsview/components/ScreenSharingSettingsPage.qml new file mode 100644 index 000000000..171d26ca9 --- /dev/null +++ b/src/app/settingsview/components/ScreenSharingSettingsPage.qml @@ -0,0 +1,78 @@ + + +/* + * Copyright (C) 2023 Savoir-faire Linux Inc. + * Author: Fadi Shehadeh <fadi.shehadeh@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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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 { + id: root + + property int itemWidth: 150 + + signal navigateToMainView + signal navigateToNewWizardView + title: JamiStrings.screenSharing + + flickableContent: ColumnLayout { + id: currentAccountEnableColumnLayout + + width: contentFlickableWidth + spacing: JamiTheme.settingsBlockSpacing + anchors.left: parent.left + anchors.leftMargin: JamiTheme.preferredSettingsMarginSize + + SettingsComboBox { + id: screenSharingFPSComboBoxSetting + + visible: modelSize > 0 + + Layout.fillWidth: true + Layout.preferredHeight: JamiTheme.preferredFieldHeight + + widthOfComboBox: itemWidth + fontPointSize: JamiTheme.settingsFontSize + + tipText: JamiStrings.selectScreenSharingFPS + labelText: JamiStrings.fps + currentSelectionText: VideoDevices.screenSharingDefaultFps.toString() + placeholderText: VideoDevices.screenSharingDefaultFps.toString() + comboModel: ListModel { id: screenSharingFpsModel } + role: "FPS" + Component.onCompleted: { + var elements = VideoDevices.sharingFpsSourceModel + for (var item in elements) { + 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 0cfc62187..310d550e1 100644 --- a/src/app/settingsview/components/SettingMaterialButton.qml +++ b/src/app/settingsview/components/SettingMaterialButton.qml @@ -45,24 +45,23 @@ RowLayout { font.pointSize: JamiTheme.settingsFontSize font.kerning: true - + wrapMode: Text.WordWrap horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter color: JamiTheme.textColor - elide: Text.ElideRight } MaterialButton { id: button - Layout.fillHeight: true preferredWidth: root.itemWidth + buttontextHeightMargin: JamiTheme.buttontextHeightMargin + textLeftPadding: JamiTheme.buttontextWizzardPadding /2 + textRightPadding: JamiTheme.buttontextWizzardPadding /2 iconSource: root.source - color: JamiTheme.buttonTintedGrey - hoveredColor: JamiTheme.buttonTintedGreyHovered - pressedColor: JamiTheme.buttonTintedGreyPressed + secondary: true onClicked: click() } diff --git a/src/app/settingsview/components/SettingSpinBox.qml b/src/app/settingsview/components/SettingSpinBox.qml index 99d17da01..f2e863ad2 100644 --- a/src/app/settingsview/components/SettingSpinBox.qml +++ b/src/app/settingsview/components/SettingSpinBox.qml @@ -48,10 +48,9 @@ RowLayout { Layout.fillWidth: true Layout.rightMargin: JamiTheme.preferredMarginSize - Layout.preferredHeight: JamiTheme.preferredFieldHeight color: JamiTheme.textColor - elide: Text.ElideRight + wrapMode: Text.WordWrap font.pointSize: JamiTheme.settingsFontSize font.kerning: true verticalAlignment: Text.AlignVCenter @@ -64,9 +63,8 @@ RowLayout { hoverEnabled: true Layout.preferredWidth: root.itemWidth - Layout.preferredHeight: JamiTheme.preferredFieldHeight Layout.alignment: Qt.AlignCenter - font.pointSize: JamiTheme.buttonFontSize + font.pointSize: JamiTheme.settingsFontSize font.kerning: true onValueChanged: newValue() @@ -90,10 +88,12 @@ RowLayout { verticalAlignment: Qt.AlignVCenter inputMethodHints : Qt.ImhDigitsOnly validator: spinbox.validator + font.pointSize: JamiTheme.settingsFontSize } background: Rectangle { border.color: JamiTheme.spinboxBorderColor + implicitHeight: textInput.implicitHeight + JamiTheme.buttontextHeightMargin color: JamiTheme.transparentColor radius: JamiTheme.primaryRadius } diff --git a/src/app/settingsview/components/SettingsComboBox.qml b/src/app/settingsview/components/SettingsComboBox.qml index 30a00cd47..1c69fc7ec 100644 --- a/src/app/settingsview/components/SettingsComboBox.qml +++ b/src/app/settingsview/components/SettingsComboBox.qml @@ -26,7 +26,7 @@ import "../../commoncomponents" RowLayout { id: root - property alias labelText: label.eText + property alias labelText: title.text property alias comboModel: comboBoxOfLayout.model property alias tipText: comboBoxOfLayout.tooltipText property alias role: comboBoxOfLayout.textRole @@ -37,27 +37,27 @@ RowLayout { property alias modelIndex: comboBoxOfLayout.currentIndex property alias modelSize: comboBoxOfLayout.count - property int heightOfLayout: 30 property int widthOfComboBox: 50 signal activated - ElidedTextLabel { - id: label + Text { + id: title Layout.fillWidth: true - Layout.preferredHeight: heightOfLayout - Layout.rightMargin: JamiTheme.preferredMarginSize / 2 - - fontSize: JamiTheme.settingsFontSize - maxWidth: widthOfComboBox + Layout.rightMargin: JamiTheme.preferredMarginSize + font.pointSize: JamiTheme.settingsFontSize + font.kerning: true + color: JamiTheme.textColor + wrapMode: Text.WordWrap + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter } SettingParaCombobox { id: comboBoxOfLayout Layout.preferredWidth: widthOfComboBox - Layout.preferredHeight: JamiTheme.preferredFieldHeight font.pointSize: JamiTheme.buttonFontSize font.kerning: true diff --git a/src/app/settingsview/components/SettingsHeader.qml b/src/app/settingsview/components/SettingsHeader.qml index 49c365a5d..88f270b61 100644 --- a/src/app/settingsview/components/SettingsHeader.qml +++ b/src/app/settingsview/components/SettingsHeader.qml @@ -25,11 +25,14 @@ import net.jami.Constants 1.1 import "../../commoncomponents" + + RowLayout { id: root - property string title: "" + required property string title signal backArrowClicked + spacing: 10 BackButton { id: backToSettingsMenuButton @@ -44,11 +47,11 @@ RowLayout { Label { Layout.fillWidth: true - text: root.title - font.pointSize: JamiTheme.titleFontSize + font.pixelSize: JamiTheme.settingsHeaderPixelSize font.kerning: true color: JamiTheme.textColor + Layout.leftMargin: backToSettingsMenuButton.visible ? 0 : JamiTheme.preferredSettingsMarginSize horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter diff --git a/src/app/settingsview/components/SettingsMaterialTextEdit.qml b/src/app/settingsview/components/SettingsMaterialTextEdit.qml index a1d5f9826..b9b2a14a8 100644 --- a/src/app/settingsview/components/SettingsMaterialTextEdit.qml +++ b/src/app/settingsview/components/SettingsMaterialTextEdit.qml @@ -45,15 +45,13 @@ RowLayout { Layout.fillWidth: true Layout.rightMargin: JamiTheme.preferredMarginSize / 2 - font.pointSize: JamiTheme.settingsFontSize font.kerning: true - + wrapMode: Text.WordWrap horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter color: JamiTheme.textColor - elide: Text.ElideRight } ModalTextEdit { @@ -64,7 +62,6 @@ RowLayout { Layout.alignment: Qt.AlignCenter Layout.preferredWidth: itemWidth - Layout.maximumHeight: 40 staticText: root.staticText placeholderText: root.placeholderText ? root.placeholderText : root.titleField @@ -91,16 +88,17 @@ RowLayout { id: passwordTextEdit visible: root.isPassword + isSettings: true Layout.alignment: Qt.AlignCenter Layout.preferredWidth: itemWidth - Layout.maximumHeight: 40 staticText: root.staticText placeholderText: root.placeholderText ? root.placeholderText : root.titleField onAccepted: { root.dynamicText = dynamicText editFinished() + echoMode = TextInput.Password } } diff --git a/src/app/settingsview/components/SettingsMenuButton.qml b/src/app/settingsview/components/SettingsMenuButton.qml index 1a0173127..6a85a1194 100644 --- a/src/app/settingsview/components/SettingsMenuButton.qml +++ b/src/app/settingsview/components/SettingsMenuButton.qml @@ -31,10 +31,8 @@ PushButton { property int menuType: 0 preferredHeight: 64 - preferredMargin: 24 - - anchors.left: parent.left - anchors.right: parent.right + preferredLeftMargin: 24 + preferredRightMargin: 24 buttonTextFont.pointSize: JamiTheme.textFontSize + 2 textHAlign: Text.AlignLeft diff --git a/src/app/settingsview/components/SettingsPageBase.qml b/src/app/settingsview/components/SettingsPageBase.qml new file mode 100644 index 000000000..8ddfeaee0 --- /dev/null +++ b/src/app/settingsview/components/SettingsPageBase.qml @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2023 Savoir-faire Linux Inc. + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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 { + id: root + + required property Item flickableContent + + property real contentFlickableWidth: Math.min(JamiTheme.maximumWidthSettingsView, + root.width - 2 * JamiTheme.preferredSettingsMarginSize) + + property color backgroundColor: JamiTheme.secondaryBackgroundColor + + Rectangle { + width: parent.width + height: parent.height + color: backgroundColor + } + + header: Rectangle { + height: JamiTheme.settingsHeaderpreferredHeight + width: root.preferredWidth + color: backgroundColor + + SettingsHeader { + id: settingsHeader + title: root.title + anchors.fill: parent + onBackArrowClicked: viewNode.dismiss() + } + } + + JamiFlickable { + id: flickable + anchors.fill: parent + contentHeight: contentItem.childrenRect.height + contentItem.children: [flickableContent] + topMargin: JamiTheme.preferredSettingsBottomMarginSize + bottomMargin: JamiTheme.preferredSettingsBottomMarginSize + } +} diff --git a/src/app/settingsview/components/SystemSettings.qml b/src/app/settingsview/components/SystemSettings.qml deleted file mode 100644 index 1bea24113..000000000 --- a/src/app/settingsview/components/SystemSettings.qml +++ /dev/null @@ -1,269 +0,0 @@ -/* - * Copyright (C) 2020-2023 Savoir-faire Linux Inc. - * Author: Aline Gondim Santos <aline.gondimsantos@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 - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * 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.Enums 1.1 -import net.jami.Constants 1.1 - -import "../../commoncomponents" - -ColumnLayout { - id:root - - property int itemWidth - property string downloadPath: UtilsAdapter.getDirDownload() - - onDownloadPathChanged: { - if(downloadPath === "") return - UtilsAdapter.setDownloadPath(downloadPath) - } - - FolderDialog { - id: downloadPathDialog - - title: JamiStrings.selectFolder - currentFolder: StandardPaths.writableLocation(StandardPaths.DownloadLocation) - options: FolderDialog.ShowDirsOnly - - onAccepted: { - var dir = UtilsAdapter.getAbsPath(folder.toString()) - downloadPath = dir - } - } - - Label { - Layout.fillWidth: true - - text: JamiStrings.system - color: JamiTheme.textColor - font.pointSize: JamiTheme.headerFontSize - font.kerning: true - - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignVCenter - } - - - - SettingsComboBox { - id: themeComboBoxSettings - - Layout.fillWidth: true - Layout.leftMargin: JamiTheme.preferredMarginSize - - property var nativeDarkThemeShift: UtilsAdapter.hasNativeDarkTheme() ? 1 : 0 - - labelText: JamiStrings.applicationTheme - fontPointSize: JamiTheme.settingsFontSize - - comboModel: ListModel { - id: themeModel - Component.onCompleted: { - if (themeComboBoxSettings.nativeDarkThemeShift) - append({ textDisplay: JamiStrings.system }) - append({ textDisplay: JamiStrings.light }) - append({ textDisplay: JamiStrings.dark }) - } - } - widthOfComboBox: itemWidth - tipText: JamiStrings.applicationTheme - role: "textDisplay" - - modelIndex: { - var theme = UtilsAdapter.getAppValue(Settings.Key.AppTheme) - if (themeComboBoxSettings.nativeDarkThemeShift && theme === "System") - return 0 - if (theme === "Light") { - return 0 + nativeDarkThemeShift - } else if (theme === "Dark") { - return 1 + nativeDarkThemeShift - } - return nativeDarkThemeShift - } - - onActivated: { - if (modelIndex === 0 + nativeDarkThemeShift) - UtilsAdapter.setAppValue(Settings.Key.AppTheme, "Light") - else if (modelIndex === 1 + nativeDarkThemeShift) - UtilsAdapter.setAppValue(Settings.Key.AppTheme, "Dark") - else if (modelIndex === 0) - UtilsAdapter.setAppValue(Settings.Key.AppTheme, "System") - } - } - - ToggleSwitch { - id: notificationCheckBox - Layout.fillWidth: true - Layout.leftMargin: JamiTheme.preferredMarginSize - - checked: UtilsAdapter.getAppValue(Settings.EnableNotifications) - - labelText: JamiStrings.showNotifications - fontPointSize: JamiTheme.settingsFontSize - - tooltipText: JamiStrings.enableNotifications - - onSwitchToggled: UtilsAdapter.setAppValue(Settings.Key.EnableNotifications, checked) - } - - ToggleSwitch { - id: closeOrMinCheckBox - Layout.fillWidth: true - Layout.leftMargin: JamiTheme.preferredMarginSize - checked: UtilsAdapter.getAppValue(Settings.MinimizeOnClose) - - labelText: JamiStrings.keepMinimized - fontPointSize: JamiTheme.settingsFontSize - - onSwitchToggled: UtilsAdapter.setAppValue(Settings.Key.MinimizeOnClose, checked) - } - - ToggleSwitch { - id: applicationOnStartUpCheckBox - Layout.fillWidth: true - Layout.leftMargin: JamiTheme.preferredMarginSize - - checked: UtilsAdapter.checkStartupLink() - - labelText: JamiStrings.runStartup - fontPointSize: JamiTheme.settingsFontSize - - tooltipText: JamiStrings.tipRunStartup - - onSwitchToggled: UtilsAdapter.setRunOnStartUp(checked) - } - - RowLayout { - Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.preferredFieldHeight - Layout.leftMargin: JamiTheme.preferredMarginSize - - Label { - Layout.fillWidth: true - Layout.fillHeight: true - - color: JamiTheme.textColor - text: JamiStrings.downloadFolder - font.pointSize: JamiTheme.settingsFontSize - font.kerning: true - - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignVCenter - } - - MaterialButton { - id: downloadButton - - Layout.alignment: Qt.AlignRight - - preferredWidth: itemWidth - preferredHeight: JamiTheme.preferredFieldHeight - - toolTipText: JamiStrings.tipChooseDownloadFolder - text: downloadPath - iconSource: JamiResources.round_folder_24dp_svg - color: JamiTheme.buttonTintedGrey - hoveredColor: JamiTheme.buttonTintedGreyHovered - pressedColor: JamiTheme.buttonTintedGreyPressed - - onClicked: downloadPathDialog.open() - } - } - - SettingsComboBox { - id: langComboBoxSetting - - Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.preferredFieldHeight - Layout.leftMargin: JamiTheme.preferredMarginSize - - labelText: JamiStrings.language - tipText: JamiStrings.language - fontPointSize: JamiTheme.settingsFontSize - comboModel: ListModel { - id: langModel - Component.onCompleted: { - 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] }) - if (keys[i] == currentKey) - langComboBoxSetting.modelIndex = i - } - } - } - widthOfComboBox: itemWidth - role: "textDisplay" - - onActivated: { - UtilsAdapter.setAppValue(Settings.Key.LANG, comboModel.get(modelIndex).id) - } - } - - Connections { - target: UtilsAdapter - - function onChangeFontSize() { - zoomSpinBox.valueField = Math.round(UtilsAdapter.getAppValue(Settings.BaseZoom) * 100.0) - } - - function onChangeLanguage() { - var idx = themeComboBoxSettings.modelIndex - themeModel.clear() - if (themeComboBoxSettings.nativeDarkThemeShift) - themeModel.append({ textDisplay: JamiStrings.system }) - themeModel.append({ textDisplay: JamiStrings.light }) - themeModel.append({ textDisplay: JamiStrings.dark }) - themeComboBoxSettings.modelIndex = idx - - 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] }) - } - langComboBoxSetting.modelIndex = langIdx - } - } - - SettingSpinBox { - id: zoomSpinBox - Layout.fillWidth: true - Layout.leftMargin: JamiTheme.preferredMarginSize - - title: JamiStrings.textZoom - tooltipText: JamiStrings.changeTextSize - itemWidth: root.itemWidth - - bottomValue: 50 - topValue: 200 - step: 10 - - valueField: UtilsAdapter.getAppValue(Settings.BaseZoom) * 100.0 - - onNewValue: UtilsAdapter.setAppValue(Settings.BaseZoom, valueField / 100.0) - } -} diff --git a/src/app/settingsview/components/SystemSettingsPage.qml b/src/app/settingsview/components/SystemSettingsPage.qml new file mode 100644 index 000000000..bed6a358f --- /dev/null +++ b/src/app/settingsview/components/SystemSettingsPage.qml @@ -0,0 +1,260 @@ +/* + * Copyright (C) 2023 Savoir-faire Linux Inc. + * Author: Fadi Shehadeh <fadi.shehadeh@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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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 { + id: root + + property string downloadPath: UtilsAdapter.getDirDownload() + property string downloadPathBestName: UtilsAdapter.dirName(UtilsAdapter.getDirDownload()) + property int itemWidth: 188 + + property bool isSIP + + signal navigateToMainView + signal navigateToNewWizardView + title: JamiStrings.system + + + onDownloadPathChanged: { + if(downloadPath === "") return + UtilsAdapter.setDownloadPath(downloadPath) + } + + flickableContent: ColumnLayout { + + id: manageAccountEnableColumnLayout + width: contentFlickableWidth + spacing: JamiTheme.settingsBlockSpacing + anchors.left: parent.left + anchors.leftMargin: JamiTheme.preferredSettingsMarginSize + + ColumnLayout { + id: enableAccount + + width: parent.width + + FolderDialog { + id: downloadPathDialog + + title: JamiStrings.selectFolder + currentFolder: StandardPaths.writableLocation(StandardPaths.DownloadLocation) + options: FolderDialog.ShowDirsOnly + + onAccepted: { + var dir = UtilsAdapter.getAbsPath(folder.toString()) + var dirName = UtilsAdapter.dirName(folder.toString()) + downloadPath = dir + downloadPathBestName = dirName + } + + } + + ToggleSwitch { + id: notificationCheckBox + Layout.fillWidth: true + + checked: UtilsAdapter.getAppValue(Settings.EnableNotifications) + labelText: JamiStrings.showNotifications + tooltipText: JamiStrings.enableNotifications + onSwitchToggled: UtilsAdapter.setAppValue(Settings.Key.EnableNotifications, checked) + } + + ToggleSwitch { + id: closeOrMinCheckBox + Layout.fillWidth: true + + checked: UtilsAdapter.getAppValue(Settings.MinimizeOnClose) + labelText: JamiStrings.keepMinimized + onSwitchToggled: UtilsAdapter.setAppValue(Settings.Key.MinimizeOnClose, checked) + } + + ToggleSwitch { + id: applicationOnStartUpCheckBox + Layout.fillWidth: true + + checked: UtilsAdapter.checkStartupLink() + labelText: JamiStrings.runStartup + tooltipText: JamiStrings.tipRunStartup + onSwitchToggled: UtilsAdapter.setRunOnStartUp(checked) + } + + RowLayout { + Layout.fillWidth: true + Layout.minimumHeight: JamiTheme.preferredFieldHeight + + Text { + Layout.fillWidth: true + Layout.fillHeight: true + Layout.rightMargin: JamiTheme.preferredMarginSize + wrapMode: Text.WordWrap + color: JamiTheme.textColor + text: JamiStrings.downloadFolder + font.pointSize: JamiTheme.settingsFontSize + font.kerning: true + + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + } + + MaterialButton { + id: downloadButton + + Layout.alignment: Qt.AlignRight + + preferredWidth: itemWidth + buttontextHeightMargin: JamiTheme.buttontextHeightMargin + textLeftPadding: JamiTheme.buttontextWizzardPadding + textRightPadding: JamiTheme.buttontextWizzardPadding + + toolTipText: downloadPath + text: downloadPathBestName + secondary: true + + onClicked: downloadPathDialog.open() + } + } + + SettingsComboBox { + id: langComboBoxSetting + + Layout.fillWidth: true + Layout.preferredHeight: JamiTheme.preferredFieldHeight + + labelText: JamiStrings.language + tipText: JamiStrings.language + comboModel: ListModel { + id: langModel + Component.onCompleted: { + 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] }) + if (keys[i] === currentKey) + langComboBoxSetting.modelIndex = i + } + } + } + + widthOfComboBox: itemWidth + role: "textDisplay" + + onActivated: { + UtilsAdapter.setAppValue(Settings.Key.LANG, comboModel.get(modelIndex).id) + } + } + + Connections { + target: UtilsAdapter + + function onChangeLanguage() { + 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] }) + } + langComboBoxSetting.modelIndex = langIdx + } + } + + + } + + ColumnLayout { + + width: parent.width + spacing: JamiTheme.settingsCategorySpacing + + Text { + id: experimentalTitle + + Layout.alignment: Qt.AlignLeft + Layout.preferredWidth: parent.width + + text: JamiStrings.experimental + color: JamiTheme.textColor + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + wrapMode : Text.WordWrap + + font.pixelSize: JamiTheme.settingsTitlePixelSize + font.kerning: true + + } + + ToggleSwitch { + id: checkboxCallSwarm + Layout.fillWidth: true + checked: UtilsAdapter.getAppValue(Settings.EnableExperimentalSwarm) + labelText: JamiStrings.experimentalCallSwarm + tooltipText: JamiStrings.experimentalCallSwarmTooltip + onSwitchToggled: { + UtilsAdapter.setAppValue(Settings.Key.EnableExperimentalSwarm, checked) + } + } + + + } + + MaterialButton { + id: defaultSettings + + TextMetrics{ + id: textSize + font.weight: Font.Bold + font.pixelSize: JamiTheme.wizardViewButtonFontPixelSize + font.capitalization: Font.AllUppercase + text: defaultSettings.text + } + + secondary: true + + text: JamiStrings.defaultSettings + 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) + } + + } + + + } +} diff --git a/src/app/settingsview/components/ToggleSwitch.qml b/src/app/settingsview/components/ToggleSwitch.qml index 835a8e3dc..9522e2a6b 100644 --- a/src/app/settingsview/components/ToggleSwitch.qml +++ b/src/app/settingsview/components/ToggleSwitch.qml @@ -27,10 +27,9 @@ import "../../commoncomponents" RowLayout { id: root property string labelText: "" + property string descText: "" property int widthOfSwitch: 50 property int heightOfSwitch: 10 - property int heightOfLayout: 30 - property int fontPointSize: JamiTheme.headerFontSize property string tooltipText: "" @@ -39,19 +38,40 @@ RowLayout { signal switchToggled - Text { - Layout.fillWidth: true - Layout.preferredHeight: heightOfLayout - Layout.rightMargin: JamiTheme.preferredMarginSize - - text: root.labelText - font.pointSize: fontPointSize - font.kerning: true - elide: Text.ElideRight - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignVCenter + ColumnLayout { + id: toggleLayout + Layout.alignment: Qt.AlignVCenter + spacing: 5 + + Text { + id: title + Layout.fillWidth: true + Layout.rightMargin: JamiTheme.preferredMarginSize + visible: labelText !== "" + text: root.labelText + font.pixelSize: JamiTheme.settingsDescriptionPixelSize + font.kerning: true + wrapMode: Text.WordWrap + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + + color: JamiTheme.textColor + } - color: JamiTheme.textColor + Text { + id: description + Layout.fillWidth: true + Layout.rightMargin: JamiTheme.preferredMarginSize + visible: descText !== "" + text: root.descText + font.pixelSize: JamiTheme.settingToggleDescrpitonPixelSize + font.kerning: true + wrapMode: Text.WordWrap + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + + color: JamiTheme.textColor + } } JamiSwitch { @@ -59,7 +79,6 @@ RowLayout { Layout.alignment: Qt.AlignVCenter | Qt.AlignRight Layout.preferredWidth: widthOfSwitch - Layout.preferredHeight: heightOfSwitch hoverEnabled: true toolTipText: tooltipText @@ -80,4 +99,5 @@ RowLayout { switchToggled() } } + } diff --git a/src/app/settingsview/components/TroubleshootSettings.qml b/src/app/settingsview/components/TroubleshootSettings.qml deleted file mode 100644 index 60068fc29..000000000 --- a/src/app/settingsview/components/TroubleshootSettings.qml +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (C) 2021-2023 Savoir-faire Linux Inc. - * Author: Trevor Tabah <trevor.tabah@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 - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * 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 - -ColumnLayout { - id: root - - property int itemWidth - - Label { - Layout.fillWidth: true - - text: JamiStrings.troubleshootTitle - font.pointSize: JamiTheme.headerFontSize - font.kerning: true - color: JamiTheme.textColor - - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignVCenter - } - - RowLayout { - Layout.leftMargin: JamiTheme.preferredMarginSize - - Text { - Layout.fillWidth: true - Layout.preferredHeight: 30 - Layout.rightMargin: JamiTheme.preferredMarginSize - - text: JamiStrings.troubleshootText - font.pointSize: JamiTheme.settingsFontSize - font.kerning: true - elide: Text.ElideRight - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignVCenter - - color: JamiTheme.textColor - } - - MaterialButton { - id: enableTroubleshootingButton - - Layout.alignment: Qt.AlignRight - - preferredWidth: itemWidth / 1.5 - preferredHeight: JamiTheme.preferredFieldHeight - - color: JamiTheme.buttonTintedBlack - hoveredColor: JamiTheme.buttonTintedBlackHovered - pressedColor: JamiTheme.buttonTintedBlackPressed - secondary: true - - text: JamiStrings.troubleshootButton - toolTipText: JamiStrings.troubleshootButton - - onClicked: { - LogViewWindowCreation.createlogViewWindowObject() - LogViewWindowCreation.showLogViewWindow() - } - } - } - - ToggleSwitch { - id: checkboxCallSwarm - Layout.fillWidth: true - Layout.leftMargin: JamiTheme.preferredMarginSize - checked: UtilsAdapter.getAppValue(Settings.EnableExperimentalSwarm) - labelText: JamiStrings.experimentalCallSwarm - fontPointSize: JamiTheme.settingsFontSize - tooltipText: JamiStrings.experimentalCallSwarmTooltip - onSwitchToggled: { - UtilsAdapter.setAppValue(Settings.Key.EnableExperimentalSwarm, checked) - } - } -} diff --git a/src/app/settingsview/components/TroubleshootSettingsPage.qml b/src/app/settingsview/components/TroubleshootSettingsPage.qml new file mode 100644 index 000000000..7e2332272 --- /dev/null +++ b/src/app/settingsview/components/TroubleshootSettingsPage.qml @@ -0,0 +1,96 @@ +/* + * Copyright (C) 2021-2023 Savoir-faire Linux Inc. + * Author: Fadi Shehadeh <fadi.shehadeh@savoirfairelinux.com> + * Author: Trevor Tabah <trevor.tabah@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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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 + + property int itemWidth + + signal navigateToMainView + signal navigateToNewWizardView + title: JamiStrings.troubleshootTitle + + + flickableContent: ColumnLayout { + id: troubleshootSettingsColumnLayout + + width: contentFlickableWidth + spacing: JamiTheme.settingsBlockSpacing + anchors.left: parent.left + anchors.leftMargin: JamiTheme.preferredSettingsMarginSize + + RowLayout { + + Text { + Layout.fillWidth: true + Layout.preferredHeight: 30 + Layout.rightMargin: JamiTheme.preferredMarginSize + + text: JamiStrings.troubleshootText + font.pointSize: JamiTheme.settingsFontSize + font.kerning: true + wrapMode: Text.WordWrap + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + + color: JamiTheme.textColor + } + + MaterialButton { + id: enableTroubleshootingButton + + TextMetrics{ + id: enableTroubleshootingButtonTextSize + font.weight: Font.Bold + font.pixelSize: JamiTheme.wizardViewButtonFontPixelSize + font.capitalization: Font.AllUppercase + text: enableTroubleshootingButton.text + } + + Layout.alignment: Qt.AlignRight + + preferredWidth: enableTroubleshootingButtonTextSize.width + 2*JamiTheme.buttontextWizzardPadding + buttontextHeightMargin: JamiTheme.buttontextHeightMargin + + primary: true + + text: JamiStrings.troubleshootButton + toolTipText: JamiStrings.troubleshootButton + + onClicked: { + LogViewWindowCreation.createlogViewWindowObject() + LogViewWindowCreation.showLogViewWindow() + } + } + } + } +} diff --git a/src/app/settingsview/components/UpdateSettings.qml b/src/app/settingsview/components/UpdateSettings.qml deleted file mode 100644 index 2c4b53fc0..000000000 --- a/src/app/settingsview/components/UpdateSettings.qml +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright (C) 2020-2023 Savoir-faire Linux Inc. - * Author: Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com> - * Author: Andreas Traczyk <andreas.traczyk@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 - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * 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" - -ColumnLayout { - id: root - - Label { - Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.preferredFieldHeight - - text: JamiStrings.updatesTitle - font.pointSize: JamiTheme.headerFontSize - font.kerning: true - - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignVCenter - } - - ToggleSwitch { - id: autoUpdateCheckBox - - Layout.fillWidth: true - Layout.leftMargin: JamiTheme.preferredMarginSize - - checked: Qt.platform.os.toString() === "windows" ? - UtilsAdapter.getAppValue(Settings.Key.AutoUpdate) : - UpdateManager.isAutoUpdaterEnabled() - - labelText: JamiStrings.update - tooltipText: JamiStrings.enableAutoUpdates - fontPointSize: JamiTheme.settingsFontSize - - onSwitchToggled: { - UtilsAdapter.setAppValue(Settings.Key.AutoUpdate, checked) - UpdateManager.setAutoUpdateCheck(checked) - } - } - - MaterialButton { - id: checkUpdateButton - - Layout.alignment: Qt.AlignHCenter - - preferredWidth: JamiTheme.preferredFieldWidth - preferredHeight: JamiTheme.preferredFieldHeight - - color: enabled? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey - hoveredColor: JamiTheme.buttonTintedBlackHovered - pressedColor: JamiTheme.buttonTintedBlackPressed - secondary: true - autoAccelerator: true - - toolTipText: JamiStrings.checkForUpdates - text: JamiStrings.checkForUpdates - - onClicked: UpdateManager.checkForUpdates() - } - - MaterialButton { - id: installBetaButton - - visible: !UpdateManager.isCurrentVersionBeta() && Qt.platform.os.toString() === "windows" - - Layout.alignment: Qt.AlignHCenter - - preferredWidth: JamiTheme.preferredFieldWidth - preferredHeight: JamiTheme.preferredFieldHeight - - color: enabled? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey - hoveredColor: JamiTheme.buttonTintedBlackHovered - pressedColor: JamiTheme.buttonTintedBlackPressed - secondary: true - autoAccelerator: true - - toolTipText: JamiStrings.betaInstall - text: JamiStrings.betaInstall - - onClicked: presentConfirmInstallDialog(JamiStrings.confirmBeta, true) - } - - function presentInfoDialog(infoText) { - 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)}] - }) - } - - Connections { - target: UpdateManager - - function errorToString(error) { - 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 {} - } - } - - function onUpdateDownloadStarted() { - viewCoordinator.presentDialog( - appWindow, - "settingsview/components/UpdateDownloadDialog.qml", - {title: JamiStrings.updateDialogTitle}) - } - - function onUpdateCheckReplyReceived(ok, found) { - if (!ok) { - presentInfoDialog(JamiStrings.updateCheckError) - return - } - if (!found) { - presentInfoDialog(JamiStrings.updateNotFound) - } else { - presentConfirmInstallDialog(JamiStrings.updateFound, false) - } - } - - function onUpdateDownloadErrorOccurred(error) { - presentInfoDialog(errorToString(error)) - } - - function onUpdateCheckErrorOccurred(error) { - presentInfoDialog(errorToString(error)) - } - } -} diff --git a/src/app/settingsview/components/UpdatesSettingsPage.qml b/src/app/settingsview/components/UpdatesSettingsPage.qml new file mode 100644 index 000000000..ce4fa733a --- /dev/null +++ b/src/app/settingsview/components/UpdatesSettingsPage.qml @@ -0,0 +1,188 @@ +/* + * Copyright (C) 2021-2023 Savoir-faire Linux Inc. + * Author: Fadi Shehadeh <fadi.shehadeh@savoirfairelinux.com> + * Author: Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com> + * Author: Andreas Traczyk <andreas.traczyk@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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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 + + signal navigateToMainView + signal navigateToNewWizardView + 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: [] + }) + } + + 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)}] + }) + } + + flickableContent: ColumnLayout { + + id: manageAccountEnableColumnLayout + width: contentFlickableWidth + spacing: JamiTheme.settingsBlockSpacing + anchors.left: parent.left + anchors.leftMargin: JamiTheme.preferredSettingsMarginSize + + ToggleSwitch { + id: autoUpdateCheckBox + + Layout.fillWidth: true + + 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) + } + } + + MaterialButton { + id: checkUpdateButton + + TextMetrics{ + id: checkUpdateButtonTextSize + font.weight: Font.Bold + font.pixelSize: JamiTheme.wizardViewButtonFontPixelSize + font.capitalization: Font.AllUppercase + text: checkUpdateButton.text + } + + Layout.alignment: Qt.AlignLeft + + preferredWidth: checkUpdateButtonTextSize.width + 2*JamiTheme.buttontextWizzardPadding + + primary: true + autoAccelerator: true + + toolTipText: JamiStrings.checkForUpdates + text: JamiStrings.checkForUpdates + + onClicked: UpdateManager.checkForUpdates() + } + + MaterialButton { + id: installBetaButton + + visible: !UpdateManager.isCurrentVersionBeta() && Qt.platform.os.toString() === "windows" + + Layout.alignment: Qt.AlignHCenter + + preferredWidth: JamiTheme.preferredFieldWidth + + color: enabled? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey + hoveredColor: JamiTheme.buttonTintedBlackHovered + pressedColor: JamiTheme.buttonTintedBlackPressed + secondary: true + autoAccelerator: true + + toolTipText: JamiStrings.betaInstall + text: JamiStrings.betaInstall + + onClicked: presentConfirmInstallDialog(JamiStrings.confirmBeta, true) + } + + Connections { + target: UpdateManager + + function errorToString(error) { + 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 {} + } + } + + function onUpdateDownloadStarted() { + viewCoordinator.presentDialog( + appWindow, + "settingsview/components/UpdateDownloadDialog.qml", + {title: JamiStrings.updateDialogTitle}) + } + + function onUpdateCheckReplyReceived(ok, found) { + if (!ok) { + presentInfoDialog(JamiStrings.updateCheckError) + return + } + if (!found) { + presentInfoDialog(JamiStrings.updateNotFound) + } else { + presentConfirmInstallDialog(JamiStrings.updateFound, false) + } + } + + function onUpdateDownloadErrorOccurred(error) { + presentInfoDialog(errorToString(error)) + } + + function onUpdateCheckErrorOccurred(error) { + presentInfoDialog(errorToString(error)) + } + } + } +} diff --git a/src/app/settingsview/components/VideoSettings.qml b/src/app/settingsview/components/VideoSettings.qml deleted file mode 100644 index ad4132462..000000000 --- a/src/app/settingsview/components/VideoSettings.qml +++ /dev/null @@ -1,334 +0,0 @@ -/* - * Copyright (C) 2020-2023 Savoir-faire Linux Inc. - * Author: Aline Gondim Santos <aline.gondimsantos@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 - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * 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 "../../commoncomponents" - -ColumnLayout { - id: root - - property real aspectRatio: 0.75 - property int itemWidth - - function startPreviewing(force = false) { - if (!visible) { - return - } - previewWidget.startWithId(VideoDevices.getDefaultDevice(), force) - } - - onVisibleChanged: { - flipControl.checked = UtilsAdapter.getAppValue(Settings.FlipSelf) - if (visible) { - hardwareAccelControl.checked = AvAdapter.getHardwareAcceleration() - if (previewWidget.visible) - startPreviewing(true) - } else { - previewWidget.startWithId("") - } - } - - Connections { - target: VideoDevices - - function onDefaultResChanged() { - startPreviewing(true) - } - - function onDefaultFpsChanged() { - startPreviewing(true) - } - - function onDeviceAvailable() { - 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 - } - } - - ElidedTextLabel { - Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.preferredFieldHeight - - eText: JamiStrings.video - fontSize: JamiTheme.headerFontSize - maxWidth: itemWidth * 2 - } - - SettingsComboBox { - id: deviceComboBoxSetting - - Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.preferredFieldHeight - Layout.leftMargin: JamiTheme.preferredMarginSize - - enabled: VideoDevices.listSize !== 0 - opacity: enabled ? 1.0 : 0.5 - - fontPointSize: JamiTheme.settingsFontSize - widthOfComboBox: itemWidth - - labelText: JamiStrings.device - tipText: JamiStrings.selectVideoDevice - placeholderText: JamiStrings.noVideoDevice - currentSelectionText: VideoDevices.defaultName - - comboModel: SortFilterProxyModel { - id: filteredDevicesModel - sourceModel: SortFilterProxyModel { - id: deviceSourceModel - sourceModel: VideoDevices.deviceSourceModel - } - filters: ValueFilter { - roleName: "DeviceName" - value: VideoDevices.defaultName - inverted: true - enabled: deviceSourceModel.count > 1 - } - } - role: "DeviceName" - - onActivated: { - // TODO: start and stop preview logic in here should be in LRC - previewWidget.startWithId("") - VideoDevices.setDefaultDevice( - filteredDevicesModel.mapToSource(modelIndex)) - startPreviewing() - } - } - - SettingsComboBox { - id: resolutionComboBoxSetting - - Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.preferredFieldHeight - Layout.leftMargin: JamiTheme.preferredMarginSize - - enabled: VideoDevices.listSize !== 0 - opacity: enabled ? 1.0 : 0.5 - - widthOfComboBox: itemWidth - fontPointSize: JamiTheme.settingsFontSize - - labelText: JamiStrings.resolution - currentSelectionText: VideoDevices.defaultRes - tipText: JamiStrings.selectVideoResolution - - comboModel: SortFilterProxyModel { - id: filteredResModel - sourceModel: SortFilterProxyModel { - id: resSourceModel - sourceModel: VideoDevices.resSourceModel - } - filters: ValueFilter { - roleName: "Resolution" - value: VideoDevices.defaultRes - inverted: true - enabled: resSourceModel.count > 1 - } - } - role: "Resolution" - - onActivated: VideoDevices.setDefaultDeviceRes( - filteredResModel.mapToSource(modelIndex)) - } - - SettingsComboBox { - id: fpsComboBoxSetting - - Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.preferredFieldHeight - Layout.leftMargin: JamiTheme.preferredMarginSize - - enabled: VideoDevices.listSize !== 0 - opacity: enabled ? 1.0 : 0.5 - - widthOfComboBox: itemWidth - fontPointSize: JamiTheme.settingsFontSize - - tipText: JamiStrings.selectFPS - labelText: JamiStrings.fps - currentSelectionText: VideoDevices.defaultFps.toString() - comboModel: SortFilterProxyModel { - id: filteredFpsModel - sourceModel: SortFilterProxyModel { - id: fpsSourceModel - sourceModel: VideoDevices.fpsSourceModel - } - filters: ValueFilter { - roleName: "FPS" - value: VideoDevices.defaultFps - inverted: true - enabled: fpsSourceModel.count > 1 - } - } - role: "FPS" - - onActivated: VideoDevices.setDefaultDeviceFps( - filteredFpsModel.mapToSource(modelIndex)) - } - - ToggleSwitch { - id: hardwareAccelControl - - Layout.fillWidth: true - Layout.leftMargin: JamiTheme.preferredMarginSize - - labelText: JamiStrings.enableHWAccel - fontPointSize: JamiTheme.settingsFontSize - - onSwitchToggled: { - AvAdapter.setHardwareAcceleration(checked) - startPreviewing(true) - } - } - - ToggleSwitch { - id: flipControl - - Layout.fillWidth: true - Layout.leftMargin: JamiTheme.preferredMarginSize - - labelText: JamiStrings.mirrorLocalVideo - fontPointSize: JamiTheme.settingsFontSize - - onSwitchToggled: { - UtilsAdapter.setAppValue(Settings.FlipSelf, checked) - CurrentCall.flipSelf = UtilsAdapter.getAppValue(Settings.FlipSelf) - } - } - - // video Preview - Rectangle { - visible: VideoDevices.listSize !== 0 - - Layout.alignment: Qt.AlignHCenter - Layout.preferredHeight: width * previewWidget.invAspectRatio - - Layout.minimumWidth: 200 - Layout.maximumWidth: 400 - Layout.preferredWidth: itemWidth * 2 - Layout.bottomMargin: JamiTheme.preferredMarginSize - - color: JamiTheme.primaryForegroundColor - - LocalVideo { - id: previewWidget - - anchors.fill: parent - flip: flipControl.checked - - underlayItems: Text { - anchors.centerIn: parent - font.pointSize: 18 - font.capitalization: Font.AllUppercase - color: "white" - text: JamiStrings.noVideo - } - } - } - - Label { - visible: VideoDevices.listSize === 0 - - Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.preferredFieldHeight - Layout.bottomMargin: JamiTheme.preferredMarginSize - - text: JamiStrings.previewUnavailable - font.pointSize: JamiTheme.settingsFontSize - font.kerning: true - color: JamiTheme.primaryForegroundColor - - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } - - ElidedTextLabel { - id: screenSharingSetTitle - visible: screenSharingFPSComboBoxSetting.modelSize > 0 - Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.preferredFieldHeight - - eText: JamiStrings.screenSharing - fontSize: JamiTheme.headerFontSize - maxWidth: itemWidth * 2 - } - - SettingsComboBox { - id: screenSharingFPSComboBoxSetting - - visible: modelSize > 0 - - Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.preferredFieldHeight - Layout.leftMargin: JamiTheme.preferredMarginSize - Layout.bottomMargin: JamiTheme.preferredMarginSize - - widthOfComboBox: itemWidth - fontPointSize: JamiTheme.settingsFontSize - - tipText: JamiStrings.selectScreenSharingFPS - labelText: JamiStrings.fps - currentSelectionText: VideoDevices.screenSharingDefaultFps.toString() - placeholderText: VideoDevices.screenSharingDefaultFps.toString() - comboModel: ListModel { id: screenSharingFpsModel } - role: "FPS" - Component.onCompleted: { - var elements = VideoDevices.sharingFpsSourceModel - for (var item in elements) { - screenSharingFpsModel.append({"FPS": elements[item]}) - } - } - - onActivated: VideoDevices.setDisplayFPS(screenSharingFpsModel.get(modelIndex).FPS) - } -} diff --git a/src/app/settingsview/components/VideoSettingsPage.qml b/src/app/settingsview/components/VideoSettingsPage.qml new file mode 100644 index 000000000..c093404fc --- /dev/null +++ b/src/app/settingsview/components/VideoSettingsPage.qml @@ -0,0 +1,294 @@ +/* + * Copyright (C) 2023 Savoir-faire Linux Inc. + * Author: Fadi Shehadeh <fadi.shehadeh@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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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 { + id: root + + property int itemWidth: 266 + property real aspectRatio: 0.75 + + signal navigateToMainView + signal navigateToNewWizardView + title: JamiStrings.video + + flickableContent: ColumnLayout { + id: currentAccountEnableColumnLayout + + width: contentFlickableWidth + spacing: JamiTheme.settingsBlockSpacing + anchors.left: parent.left + anchors.leftMargin: JamiTheme.preferredSettingsMarginSize + + + ColumnLayout { + id: generalSettings + + width: parent.width + spacing: JamiTheme.settingsCategoryAudioVideoSpacing + + function startPreviewing(force = false) { + if (!visible) { + return + } + previewWidget.startWithId(VideoDevices.getDefaultDevice(), force) + } + + onVisibleChanged: { + flipControl.checked = UtilsAdapter.getAppValue(Settings.FlipSelf) + if (visible) { + hardwareAccelControl.checked = AvAdapter.getHardwareAcceleration() + if (previewWidget.visible) + generalSettings.startPreviewing(true) + } else { + previewWidget.startWithId("") + } + } + + Connections { + target: VideoDevices + + function onDefaultResChanged() { + generalSettings.startPreviewing(true) + } + + function onDefaultFpsChanged() { + generalSettings.startPreviewing(true) + } + + function onDeviceAvailable() { + 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 + } + } + + // video Preview + Rectangle { + visible: VideoDevices.listSize !== 0 + + Layout.alignment: Qt.AlignHCenter + Layout.preferredHeight: width * previewWidget.invAspectRatio + + Layout.minimumWidth: 200 + Layout.maximumWidth: 515 + Layout.preferredWidth: parent.width + Layout.bottomMargin: JamiTheme.preferredMarginSize + + color: JamiTheme.primaryForegroundColor + + LocalVideo { + id: previewWidget + + anchors.fill: parent + flip: flipControl.checked + + underlayItems: Text { + anchors.centerIn: parent + font.pointSize: 18 + font.capitalization: Font.AllUppercase + color: "white" + text: JamiStrings.noVideo + } + } + } + + ToggleSwitch { + id: flipControl + + Layout.fillWidth: true + labelText: JamiStrings.mirrorLocalVideo + + onSwitchToggled: { + UtilsAdapter.setAppValue(Settings.FlipSelf, checked) + CurrentCall.flipSelf = UtilsAdapter.getAppValue(Settings.FlipSelf) + } + } + + SettingsComboBox { + id: deviceComboBoxSetting + + Layout.fillWidth: true + + enabled: VideoDevices.listSize !== 0 + opacity: enabled ? 1.0 : 0.5 + + widthOfComboBox: itemWidth + + labelText: JamiStrings.device + tipText: JamiStrings.selectVideoDevice + placeholderText: JamiStrings.noVideoDevice + currentSelectionText: VideoDevices.defaultName + + comboModel: SortFilterProxyModel { + id: filteredDevicesModel + sourceModel: SortFilterProxyModel { + id: deviceSourceModel + sourceModel: VideoDevices.deviceSourceModel + } + filters: ValueFilter { + roleName: "DeviceName" + value: VideoDevices.defaultName + inverted: true + enabled: deviceSourceModel.count > 1 + } + } + role: "DeviceName" + + onActivated: { + // TODO: start and stop preview logic in here should be in LRC + previewWidget.startWithId("") + VideoDevices.setDefaultDevice( + filteredDevicesModel.mapToSource(modelIndex)) + generalSettings.startPreviewing() + } + } + + SettingsComboBox { + id: resolutionComboBoxSetting + + Layout.fillWidth: true + + enabled: VideoDevices.listSize !== 0 + opacity: enabled ? 1.0 : 0.5 + + widthOfComboBox: itemWidth + + labelText: JamiStrings.resolution + currentSelectionText: VideoDevices.defaultRes + tipText: JamiStrings.selectVideoResolution + + comboModel: SortFilterProxyModel { + id: filteredResModel + sourceModel: SortFilterProxyModel { + id: resSourceModel + sourceModel: VideoDevices.resSourceModel + } + filters: ValueFilter { + roleName: "Resolution" + value: VideoDevices.defaultRes + inverted: true + enabled: resSourceModel.count > 1 + } + } + role: "Resolution" + + onActivated: VideoDevices.setDefaultDeviceRes( + filteredResModel.mapToSource(modelIndex)) + } + + SettingsComboBox { + id: fpsComboBoxSetting + + Layout.fillWidth: true + + enabled: VideoDevices.listSize !== 0 + opacity: enabled ? 1.0 : 0.5 + + widthOfComboBox: itemWidth + + tipText: JamiStrings.selectFPS + labelText: JamiStrings.fps + currentSelectionText: VideoDevices.defaultFps.toString() + comboModel: SortFilterProxyModel { + id: filteredFpsModel + sourceModel: SortFilterProxyModel { + id: fpsSourceModel + sourceModel: VideoDevices.fpsSourceModel + } + filters: ValueFilter { + roleName: "FPS" + value: VideoDevices.defaultFps + inverted: true + enabled: fpsSourceModel.count > 1 + } + } + role: "FPS" + + onActivated: VideoDevices.setDefaultDeviceFps( + filteredFpsModel.mapToSource(modelIndex)) + } + + ToggleSwitch { + id: hardwareAccelControl + + Layout.fillWidth: true + + labelText: JamiStrings.enableHWAccel + + onSwitchToggled: { + AvAdapter.setHardwareAcceleration(checked) + generalSettings.startPreviewing(true) + } + } + + + + Text { + visible: VideoDevices.listSize === 0 + + Layout.fillWidth: true + Layout.preferredHeight: JamiTheme.preferredFieldHeight + + text: JamiStrings.previewUnavailable + font.pointSize: JamiTheme.settingsFontSize + font.kerning: true + color: JamiTheme.primaryForegroundColor + + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } + } + } +} diff --git a/src/app/utilsadapter.cpp b/src/app/utilsadapter.cpp index 4f7b71690..8adc0ba21 100644 --- a/src/app/utilsadapter.cpp +++ b/src/app/utilsadapter.cpp @@ -90,6 +90,18 @@ UtilsAdapter::setAppValue(const Settings::Key key, const QVariant& value) Q_EMIT appThemeChanged(); } +QVariant +UtilsAdapter::getDefault(const Settings::Key key) +{ + return settingsManager_->getDefault(key); +} + +void +UtilsAdapter::setToDefault(const Settings::Key key) +{ + setAppValue(key, settingsManager_->getDefault(key)); +} + const QString UtilsAdapter::getProjectCredits() { @@ -361,6 +373,13 @@ UtilsAdapter::fileName(const QString& path) return fi.fileName(); } +QString +UtilsAdapter::dirName(const QString& path) +{ + QDir dir(path); + return dir.dirName(); +} + QString UtilsAdapter::getExt(const QString& path) { diff --git a/src/app/utilsadapter.h b/src/app/utilsadapter.h index f12bb25ea..b7e79e822 100644 --- a/src/app/utilsadapter.h +++ b/src/app/utilsadapter.h @@ -77,6 +77,8 @@ public: Q_INVOKABLE void setAppValue(const QString& key, const QVariant& value); Q_INVOKABLE QVariant getAppValue(const Settings::Key key); Q_INVOKABLE void setAppValue(const Settings::Key key, const QVariant& value); + Q_INVOKABLE QVariant getDefault(const Settings::Key key); + Q_INVOKABLE void setToDefault(const Settings::Key key); Q_INVOKABLE const QString getProjectCredits(); Q_INVOKABLE const QString getVersionStr(); @@ -108,6 +110,7 @@ public: Q_INVOKABLE QString toFileInfoName(QString inputFileName); Q_INVOKABLE QString toFileAbsolutepath(QString inputFileName); Q_INVOKABLE QString getAbsPath(QString path); + Q_INVOKABLE QString dirName(const QString& path); Q_INVOKABLE QString fileName(const QString& path); Q_INVOKABLE QString getExt(const QString& path); Q_INVOKABLE bool isImage(const QString& fileExt); diff --git a/src/app/wizardview/components/CreateAccountPage.qml b/src/app/wizardview/components/CreateAccountPage.qml index 3b11cbf58..3fdab432d 100644 --- a/src/app/wizardview/components/CreateAccountPage.qml +++ b/src/app/wizardview/components/CreateAccountPage.qml @@ -238,10 +238,8 @@ Rectangle { KeyNavigation.up: backButton KeyNavigation.down: infoBox - } - Label { id: invalidLabel diff --git a/src/app/wizardview/components/CreateSIPAccountPage.qml b/src/app/wizardview/components/CreateSIPAccountPage.qml index 2245c19c8..a2005044c 100644 --- a/src/app/wizardview/components/CreateSIPAccountPage.qml +++ b/src/app/wizardview/components/CreateSIPAccountPage.qml @@ -167,6 +167,7 @@ Rectangle { text: JamiStrings.tls ButtonGroup.group: optionsB checked: true + bgColor: JamiTheme.secondaryBackgroundColor KeyNavigation.up: sipPasswordEdit KeyNavigation.down: udpRadioButton @@ -180,6 +181,7 @@ Rectangle { text: JamiStrings.udp ButtonGroup.group: optionsB color: JamiTheme.textColor + bgColor: JamiTheme.secondaryBackgroundColor KeyNavigation.up: tlsRadioButton KeyNavigation.down: createAccountButton -- GitLab