diff --git a/src/app/settingsview/components/AudioSettingsPage.qml b/src/app/settingsview/components/AudioSettingsPage.qml index b0e3bd41fd9d9b841198ea85028aa25ed918ddb5..094bb34fec9d7c889a12b866b9a796b37260c544 100644 --- a/src/app/settingsview/components/AudioSettingsPage.qml +++ b/src/app/settingsview/components/AudioSettingsPage.qml @@ -30,7 +30,7 @@ SettingsPageBase { title: JamiStrings.audio flickableContent: ColumnLayout { - id: currentAccountEnableColumnLayout + id: rootLayout width: contentFlickableWidth spacing: JamiTheme.settingsCategoryAudioVideoSpacing @@ -169,14 +169,14 @@ SettingsPageBase { widthOfComboBox: itemWidth role: "ID_UTF8" - Component.onCompleted: currentAccountEnableColumnLayout.populateAudioSettings() + Component.onCompleted: rootLayout.populateAudioSettings() onActivated: { AvAdapter.stopAudioMeter(); var selectedAudioManager = comboModel.data(comboModel.index(modelIndex, 0), AudioManagerListModel.AudioManagerID); AVModel.setAudioManager(selectedAudioManager); AvAdapter.startAudioMeter(); - currentAccountEnableColumnLayout.populateAudioSettings(); + rootLayout.populateAudioSettings(); } } } diff --git a/src/app/settingsview/components/VideoSettingsPage.qml b/src/app/settingsview/components/VideoSettingsPage.qml index 5777856e1eae73e89c93318771473594097a3c7b..3b7da3dfda5bcac7f5409a61c94c51c6f3c48284 100644 --- a/src/app/settingsview/components/VideoSettingsPage.qml +++ b/src/app/settingsview/components/VideoSettingsPage.qml @@ -35,219 +35,213 @@ SettingsPageBase { title: JamiStrings.video flickableContent: ColumnLayout { - id: currentAccountEnableColumnLayout + id: rootLayout width: contentFlickableWidth - spacing: JamiTheme.settingsBlockSpacing + spacing: JamiTheme.settingsCategoryAudioVideoSpacing 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); + function startPreviewing(force = false) { + if (!visible) { + return; } + previewWidget.startWithId(VideoDevices.getDefaultDevice(), force); + } - Connections { - target: VideoDevices - - function onDefaultResChanged() { - generalSettings.startPreviewing(true); - } - - function onDefaultFpsChanged() { - generalSettings.startPreviewing(true); - } + Connections { + target: VideoDevices - function onDeviceAvailable() { - generalSettings.startPreviewing(); - } + function onDefaultResChanged() { + rootLayout.startPreviewing(true); + } - 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; - } + function onDefaultFpsChanged() { + rootLayout.startPreviewing(true); } - Component.onCompleted: { - flipControl.checked = UtilsAdapter.getAppValue(Settings.FlipSelf); - hardwareAccelControl.checked = AvAdapter.getHardwareAcceleration(); - if (previewWidget.visible) - startPreviewing(true); + function onDeviceAvailable() { + rootLayout.startPreviewing(); } - Component.onDestruction: { - previewWidget.startWithId(""); + 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 + Component.onCompleted: { + flipControl.checked = UtilsAdapter.getAppValue(Settings.FlipSelf); + hardwareAccelControl.checked = AvAdapter.getHardwareAcceleration(); + if (previewWidget.visible) + startPreviewing(true); + } - Layout.alignment: Qt.AlignHCenter - Layout.preferredHeight: width * previewWidget.invAspectRatio + Component.onDestruction: { + previewWidget.startWithId(""); + } - Layout.minimumWidth: 200 - Layout.maximumWidth: 515 - Layout.preferredWidth: parent.width - Layout.bottomMargin: JamiTheme.preferredMarginSize + // video Preview + Rectangle { + visible: VideoDevices.listSize !== 0 - color: JamiTheme.primaryForegroundColor + Layout.alignment: Qt.AlignHCenter + Layout.preferredHeight: width * previewWidget.invAspectRatio - LocalVideo { - id: previewWidget + Layout.minimumWidth: 200 + Layout.maximumWidth: 515 + Layout.preferredWidth: parent.width - anchors.fill: parent - flip: flipControl.checked + Layout.bottomMargin: JamiTheme.preferredMarginSize - underlayItems: Text { - anchors.centerIn: parent - font.pointSize: 18 - font.capitalization: Font.AllUppercase - color: "white" - text: JamiStrings.noVideo - } - } - } + color: JamiTheme.primaryForegroundColor - ToggleSwitch { - id: flipControl + LocalVideo { + id: previewWidget - Layout.fillWidth: true - labelText: JamiStrings.mirrorLocalVideo + anchors.fill: parent + flip: flipControl.checked - onSwitchToggled: { - UtilsAdapter.setAppValue(Settings.FlipSelf, checked); - CurrentCall.flipSelf = UtilsAdapter.getAppValue(Settings.FlipSelf); + underlayItems: Text { + anchors.centerIn: parent + font.pointSize: 18 + font.capitalization: Font.AllUppercase + color: "white" + text: JamiStrings.noVideo } } + } - 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" + ToggleSwitch { + id: flipControl - onActivated: { - // TODO: start and stop preview logic in here should be in LRC - previewWidget.startWithId(""); - VideoDevices.setDefaultDevice(filteredDevicesModel.mapToSource(modelIndex)); - generalSettings.startPreviewing(); - } + Layout.fillWidth: true + labelText: JamiStrings.mirrorLocalVideo + + onSwitchToggled: { + UtilsAdapter.setAppValue(Settings.FlipSelf, checked); + CurrentCall.flipSelf = UtilsAdapter.getAppValue(Settings.FlipSelf); } + } - SettingsComboBox { - id: resolutionComboBoxSetting + SettingsComboBox { + id: deviceComboBoxSetting - Layout.fillWidth: true + Layout.fillWidth: true - enabled: VideoDevices.listSize !== 0 - opacity: enabled ? 1.0 : 0.5 + enabled: VideoDevices.listSize !== 0 + opacity: enabled ? 1.0 : 0.5 - widthOfComboBox: itemWidth + widthOfComboBox: itemWidth - labelText: JamiStrings.resolution - currentSelectionText: VideoDevices.defaultRes - tipText: JamiStrings.selectVideoResolution + labelText: JamiStrings.device + tipText: JamiStrings.selectVideoDevice + placeholderText: JamiStrings.noVideoDevice + currentSelectionText: VideoDevices.defaultName - comboModel: SortFilterProxyModel { - id: filteredResModel - sourceModel: SortFilterProxyModel { - id: resSourceModel - sourceModel: VideoDevices.resSourceModel - } - filters: ValueFilter { - roleName: "Resolution" - value: VideoDevices.defaultRes - inverted: true - enabled: resSourceModel.count > 1 - } + comboModel: SortFilterProxyModel { + id: filteredDevicesModel + sourceModel: SortFilterProxyModel { + id: deviceSourceModel + sourceModel: VideoDevices.deviceSourceModel } - role: "Resolution" + filters: ValueFilter { + roleName: "DeviceName" + value: VideoDevices.defaultName + inverted: true + enabled: deviceSourceModel.count > 1 + } + } + role: "DeviceName" - onActivated: VideoDevices.setDefaultDeviceRes(filteredResModel.mapToSource(modelIndex)) + onActivated: { + // TODO: start and stop preview logic in here should be in LRC + previewWidget.startWithId(""); + VideoDevices.setDefaultDevice(filteredDevicesModel.mapToSource(modelIndex)); + rootLayout.startPreviewing(); } + } - 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" + SettingsComboBox { + id: resolutionComboBoxSetting + + Layout.fillWidth: true - onActivated: VideoDevices.setDefaultDeviceFps(filteredFpsModel.mapToSource(modelIndex)) + 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" - ToggleSwitch { - id: hardwareAccelControl + onActivated: VideoDevices.setDefaultDeviceRes(filteredResModel.mapToSource(modelIndex)) + } + + SettingsComboBox { + id: fpsComboBoxSetting + + Layout.fillWidth: true - Layout.fillWidth: true + enabled: VideoDevices.listSize !== 0 + opacity: enabled ? 1.0 : 0.5 - labelText: JamiStrings.enableHWAccel + widthOfComboBox: itemWidth - onSwitchToggled: { - AvAdapter.setHardwareAcceleration(checked); - generalSettings.startPreviewing(true); + 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); + rootLayout.startPreviewing(true); } } }