1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-08-31 20:23:30 +02:00

recordbox: fix focus policy on record box

The focus policy was broken and this patch fix also the tests
due to an incorrect conversationModel.

Change-Id: I9e7f76b0dff80548d3b92296f22bdd7b848ee931
This commit is contained in:
Sébastien Blin 2023-05-15 09:31:36 -04:00
parent 2ce880670d
commit 73419e417a
3 changed files with 69 additions and 6 deletions

View file

@ -80,6 +80,6 @@ protected:
using Role = ConversationList::Role;
// Convenience pointer to be pulled from lrcinstance
ConversationModel* model_;
ConversationModel* model_ {nullptr};
QString accountId_;
};

View file

@ -149,6 +149,7 @@ Popup {
PushButton {
id: cancelBtn
objectName: "cancelBtn"
z: 1
normalColor: "transparent"
@ -164,6 +165,7 @@ Popup {
anchors.top: box.top
anchors.margins: 8
focusPolicy: Qt.TabFocus
onClicked: {
closeRecorder();
updateState(RecordBox.States.INIT);
@ -253,7 +255,7 @@ Popup {
PushButton {
id: recordButton
objectName: "recordButton"
Layout.alignment: Qt.AlignCenter
preferredSize: btnSize
@ -264,6 +266,7 @@ Popup {
source: JamiResources.fiber_manual_record_24dp_svg
imageColor: JamiTheme.recordIconColor
focusPolicy: Qt.TabFocus
onClicked: {
updateState(RecordBox.States.RECORDING);
if (!root.isPhoto)
@ -273,7 +276,7 @@ Popup {
PushButton {
id: screenshotBtn
objectName: "screenshotBtn"
Layout.alignment: Qt.AlignCenter
preferredSize: btnSize
@ -286,6 +289,7 @@ Popup {
source: JamiResources.fiber_manual_record_24dp_svg
imageColor: UtilsAdapter.luma(JamiTheme.backgroundColor) ? "white" : JamiTheme.redColor
focusPolicy: Qt.TabFocus
onClicked: {
root.photo = videoProvider.captureVideoFrame(VideoDevices.getDefaultDevice());
updateState(RecordBox.States.REC_SUCCESS);
@ -294,7 +298,7 @@ Popup {
PushButton {
id: btnStop
objectName: "btnStop"
Layout.alignment: Qt.AlignCenter
preferredSize: btnSize
@ -307,6 +311,7 @@ Popup {
border.width: 1
border.color: imageColor
focusPolicy: Qt.TabFocus
onClicked: {
if (!root.isPhoto)
stopRecording();
@ -316,7 +321,7 @@ Popup {
PushButton {
id: btnRestart
objectName: "btnRestart"
Layout.alignment: Qt.AlignCenter
preferredSize: btnSize
@ -329,6 +334,7 @@ Popup {
border.width: 1
border.color: imageColor
focusPolicy: Qt.TabFocus
onClicked: {
if (!root.isPhoto)
stopRecording();
@ -338,7 +344,7 @@ Popup {
PushButton {
id: btnSend
objectName: "btnSend"
Layout.alignment: Qt.AlignCenter
preferredSize: btnSize
@ -350,6 +356,7 @@ Popup {
border.width: 1
border.color: imageColor
focusPolicy: Qt.TabFocus
onClicked: {
if (!root.isPhoto) {
stopRecording();

View file

@ -0,0 +1,56 @@
/*
* 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 QtTest
import "../../../src/app/"
import "../../../src/app/mainview/components"
ColumnLayout {
id: root
spacing: 0
width: 300
height: 300
RecordBox {
id: uut
TestCase {
name: "Take picture"
when: windowShown
function test_takePicture() {
// Open the recorder and take a picture
uut.openRecorder(true)
compare(uut.state, RecordBox.States.INIT)
var screenshotBtn = findChild(uut, "screenshotBtn")
screenshotBtn.clicked()
compare(uut.state, RecordBox.States.REC_SUCCESS)
uut.closeRecorder()
}
}
}
}