Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-client-qt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-client-qt
Commits
ab8c3645
Commit
ab8c3645
authored
2 years ago
by
Nicolas Vengeon
Committed by
Sébastien Blin
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
issue: Maximize and then Restore `Select a screen to share` window
GitLab:
#634
Change-Id: I4c95622297e52d4b7fb5ea42426353a3b3579186
parent
399defe5
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/app/mainview/components/ScreensharingElementPreview.qml
+85
-0
85 additions, 0 deletions
src/app/mainview/components/ScreensharingElementPreview.qml
src/app/mainview/components/SelectScreen.qml
+140
-307
140 additions, 307 deletions
src/app/mainview/components/SelectScreen.qml
with
225 additions
and
307 deletions
src/app/mainview/components/ScreensharingElementPreview.qml
0 → 100644
+
85
−
0
View file @
ab8c3645
/*
* Copyright (C) 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 <https://www.gnu.org/licenses/>.
*/
import
QtQuick
import
QtQuick
.
Controls
import
QtQuick
.
Layouts
import
net
.
jami
.
Adapters
1.1
import
net
.
jami
.
Models
1.1
import
net
.
jami
.
Constants
1.1
import
"
../../commoncomponents
"
Rectangle
{
id
:
root
color
:
JamiTheme
.
secondaryBackgroundColor
border.color
:
selectedScreenNumber
===
elementIndex
?
JamiTheme
.
screenSelectionBorderColor
:
JamiTheme
.
tabbarBorderColor
width
:
elementWidth
height
:
3
*
width
/
4
property
var
elementIndex
property
string
rectTitle
property
var
rId
property
bool
isSelectAllScreens
Text
{
id
:
textTitle
anchors.top
:
root
.
top
anchors.topMargin
:
marginSize
anchors.horizontalCenter
:
root
.
horizontalCenter
width
:
root
.
width
-
2
*
marginSize
font.pointSize
:
JamiTheme
.
textFontSize
text
:
rectTitle
elide
:
Text
.
ElideRight
horizontalAlignment
:
Text
.
AlignHCenter
color
:
JamiTheme
.
textColor
}
VideoView
{
anchors.top
:
textTitle
.
bottom
anchors.topMargin
:
10
anchors.horizontalCenter
:
root
.
horizontalCenter
height
:
root
.
height
-
50
width
:
root
.
width
-
50
Component.onDestruction
:
{
VideoDevices
.
stopDevice
(
rendererId
)
}
Component.onCompleted
:
{
if
(
root
.
rId
!==
""
)
{
rendererId
=
VideoDevices
.
startDevice
(
root
.
rId
)
}
}
}
MouseArea
{
anchors.fill
:
parent
acceptedButtons
:
Qt
.
LeftButton
onClicked
:
{
if
(
selectedScreenNumber
!==
root
.
elementIndex
)
{
selectedScreenNumber
=
root
.
elementIndex
}
}
}
}
This diff is collapsed.
Click to expand it.
src/app/mainview/components/SelectScreen.qml
+
140
−
307
View file @
ab8c3645
/*
/*
* Copyright (C) 2020-202
2
Savoir-faire Linux Inc.
* Copyright (C) 2020-202
3
Savoir-faire Linux Inc.
* Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com>
* Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com>
* Author: Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com>
* Author: Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com>
*
* Author: Nicolas Vengeon <Nicolas.vengeon@savoirfairelinux.com>
* This program is free software; you can redistribute it and/or modify
* 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
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* the Free Software Foundation; either version 3 of the License, or
...
@@ -35,305 +36,138 @@ import "../../commoncomponents"
...
@@ -35,305 +36,138 @@ import "../../commoncomponents"
Window
{
Window
{
id
:
root
id
:
root
property
bool
window
:
false
minimumHeight
:
minimumWidth
*
3
/
4
minimumWidth
:
componentMinWidth
+
2
*
marginSize
modality
:
Qt
.
ApplicationModal
title
:
window
?
JamiStrings
.
selectWindow
:
JamiStrings
.
selectScreen
property
int
selectedScreenNumber
:
-
1
property
bool
window
:
false
property
bool
selectAllScreens
:
false
property
int
selectedScreenNumber
:
-
2
property
bool
selectAllScreens
:
selectedScreenNumber
==
-
1
property
string
currentPreview
:
""
property
string
currentPreview
:
""
property
var
screens
:
[]
property
var
listModel
:
[]
property
real
componentMinWidth
:
200
property
real
componentMinWidth
:
350
property
real
componentWidthDoubleColumn
:
screenSelectionScrollView
.
width
/
2
-
property
real
marginSize
:
JamiTheme
.
preferredMarginSize
screenSelectionScrollViewFlow
.
spacing
/
2
-
JamiTheme
.
preferredMarginSize
property
real
elementWidth
:
{
property
real
componentWidthSingleColumn
:
screenSelectionScrollView
.
width
-
var
layoutWidth
=
selectScreenWindowLayout
.
width
2
*
JamiTheme
.
preferredMarginSize
var
minSize
=
componentMinWidth
+
2
*
marginSize
var
numberElementPerRow
=
Math
.
floor
(
layoutWidth
/
minSize
)
if
(
numberElementPerRow
==
1
&&
layoutWidth
>
componentMinWidth
*
1.5
)
{
numberElementPerRow
=
2
}
if
(
window
)
numberElementPerRow
=
Math
.
min
(
listModel
.
length
,
numberElementPerRow
)
else
numberElementPerRow
=
Math
.
min
(
listModel
.
length
+
1
,
numberElementPerRow
)
var
spacingLength
=
marginSize
*
(
numberElementPerRow
+
2
)
modality
:
Qt
.
ApplicationModal
return
(
layoutWidth
-
spacingLength
)
/
numberElementPerRow
title
:
window
?
JamiStrings
.
selectWindow
:
JamiStrings
.
selectScreen
}
// How many rows the ScrollView should have.
function
calculateRepeaterModel
()
{
function
calculateRepeaterModel
()
{
screens
=
[]
listModel
=
[]
var
idx
var
idx
if
(
!
root
.
window
)
{
for
(
idx
in
Qt
.
application
.
screens
)
{
for
(
idx
in
Qt
.
application
.
screens
)
{
screens
.
push
(
JamiStrings
.
screen
.
arg
(
idx
))
listModel
.
push
(
JamiStrings
.
screen
.
arg
(
idx
))
}
}
}
else
{
AvAdapter
.
getListWindows
()
AvAdapter
.
getListWindows
()
for
(
idx
in
AvAdapter
.
windowsNames
)
{
for
(
idx
in
AvAdapter
.
windowsNames
)
{
screens
.
push
(
AvAdapter
.
windowsNames
[
idx
])
listModel
.
push
(
AvAdapter
.
windowsNames
[
idx
])
}
}
}
return
screens
.
length
}
}
onVisibleChanged
:
{
onVisibleChanged
:
{
if
(
!
visible
)
if
(
!
visible
)
return
return
if
(
!
active
)
{
if
(
!
active
)
{
selectedScreenNumber
=
-
1
selectedScreenNumber
=
-
2
selectAllScreens
=
false
}
}
screenInfo
.
model
=
{}
screenInfo
.
model
=
{}
screenInfo2
.
model
=
{}
calculateRepeaterModel
()
calculateRepeaterModel
()
screenInfo
.
model
=
screens
.
length
screenInfo
.
model
=
root
.
listModel
screenInfo2
.
model
=
screens
.
length
windowsText
.
visible
=
root
.
window
}
}
Rectangle
{
Rectangle
{
id
:
selectScreenWindowRect
id
:
selectScreenWindowRect
anchors.fill
:
parent
anchors.fill
:
parent
color
:
JamiTheme
.
backgroundColor
color
:
JamiTheme
.
backgroundColor
ScrollView
{
ColumnLayout
{
id
:
screenSelectionScrollView
id
:
selectScreenWindowLayout
anchors.topMargin
:
JamiTheme
.
preferredMarginSize
anchors.horizontalCenter
:
selectScreenWindowRect
.
horizontalCenter
width
:
selectScreenWindowRect
.
width
height
:
selectScreenWindowRect
.
height
-
(
selectButton
.
height
+
JamiTheme
.
preferredMarginSize
*
4
)
clip
:
true
ScrollBar.horizontal.policy
:
ScrollBar
.
AlwaysOff
ScrollBar.vertical.policy
:
ScrollBar
.
AlwaysOn
Flow
{
id
:
screenSelectionScrollViewFlow
anchors.fill
:
parent
anchors.fill
:
parent
topPadding
:
JamiTheme
.
preferredMarginSize
rightPadding
:
JamiTheme
.
preferredMarginSize
leftPadding
:
JamiTheme
.
preferredMarginSize
spacing
:
JamiTheme
.
preferredMarginSize
Text
{
Text
{
width
:
screenSelectionScrollView
.
width
height
:
JamiTheme
.
preferredFieldHeight
font.pointSize
:
JamiTheme
.
menuFontSize
font.pointSize
:
JamiTheme
.
menuFontSize
font.bold
:
true
font.bold
:
true
text
:
JamiStrings
.
screens
text
:
root
.
window
?
JamiStrings
.
windows
:
JamiStrings
.
screens
verticalAlignment
:
Text
.
AlignBottom
verticalAlignment
:
Text
.
AlignBottom
color
:
JamiTheme
.
textColor
color
:
JamiTheme
.
textColor
visible
:
!
root
.
window
Layout.margins
:
marginSize
}
}
Repeater
{
ScrollView
{
id
:
screenInfo
id
:
screenSelectionScrollView
model
:
screens
?
screens
.
length
:
0
delegate
:
Rectangle
{
id
:
screenItem
color
:
JamiTheme
.
secondaryBackgroundColor
width
:
componentWidthDoubleColumn
>
componentMinWidth
?
componentWidthDoubleColumn
:
componentWidthSingleColumn
height
:
3
*
width
/
4
border.color
:
selectedScreenNumber
===
index
?
JamiTheme
.
screenSelectionBorderColor
:
JamiTheme
.
tabbarBorderColor
visible
:
!
root
.
window
&&
JamiStrings
.
selectScreen
!==
screens
[
index
]
&&
index
<
Qt
.
application
.
screens
.
length
Text
{
id
:
screenName
anchors.top
:
screenItem
.
top
anchors.topMargin
:
10
anchors.horizontalCenter
:
screenItem
.
horizontalCenter
width
:
parent
.
width
font.pointSize
:
JamiTheme
.
textFontSize
text
:
screens
[
index
]
?
screens
[
index
]
:
""
elide
:
Text
.
ElideMiddle
horizontalAlignment
:
Text
.
AlignHCenter
color
:
JamiTheme
.
textColor
}
VideoView
{
id
:
screenPreview
anchors.top
:
screenName
.
bottom
Layout.alignment
:
Qt
.
AlignCenter
anchors.topMargin
:
10
Layout.preferredWidth
:
selectScreenWindowLayout
.
width
anchors.horizontalCenter
:
screenItem
.
horizontalCenter
Layout.fillHeight
:
true
height
:
screenItem
.
height
-
50
width
:
screenItem
.
width
-
50
Component.onDestruction
:
{
clip
:
true
VideoDevices
.
stopDevice
(
rendererId
)
ScrollBar.horizontal.policy
:
ScrollBar
.
AlwaysOff
}
ScrollBar.vertical.policy
:
ScrollBar
.
AsNeeded
Component.onCompleted
:
{
if
(
visible
)
{
const
rId
=
AvAdapter
.
getSharingResource
(
index
)
if
(
rId
!==
""
)
{
rendererId
=
VideoDevices
.
startDevice
(
rId
)
}
}
}
}
MouseArea
{
Flow
{
anchors.fill
:
screenItem
id
:
screenSelectionScrollViewFlow
acceptedButtons
:
Qt
.
LeftButton
onClicked
:
{
// https://bugreports.qt.io/browse/QTBUG-110323
selectAllScreens
=
false
width
:
screenSelectionScrollView
.
width
if
(
selectedScreenNumber
==
-
1
height
:
screenSelectionScrollView
.
height
||
selectedScreenNumber
!==
index
)
{
selectedScreenNumber
=
index
}
}
}
Connections
{
topPadding
:
marginSize
target
:
AvAdapter
rightPadding
:
marginSize
leftPadding
:
marginSize
spacing
:
marginSize
function
onScreenCaptured
(
screenNumber
,
source
)
{
ScreensharingElementPreview
{
if
(
screenNumber
===
-
1
)
screenShotAll
.
source
=
JamiQmlUtils
.
base64StringTitle
+
source
}
}
}
}
Rectangle
{
id
:
screenSelectionRectAll
id
:
screenSelectionRectAll
color
:
JamiTheme
.
secondaryBackgroundColor
width
:
componentWidthDoubleColumn
>
componentMinWidth
?
componentWidthDoubleColumn
:
componentWidthSingleColumn
height
:
3
*
width
/
4
border.color
:
selectAllScreens
?
JamiTheme
.
screenSelectionBorderColor
:
JamiTheme
.
tabbarBorderColor
visible
:
!
root
.
window
&&
Qt
.
application
.
screens
.
length
>
1
&&
Qt
.
platform
.
os
.
toString
()
!==
"
windows
"
visible
:
!
root
.
window
&&
Qt
.
application
.
screens
.
length
>
1
&&
Qt
.
platform
.
os
.
toString
()
!==
"
windows
"
elementIndex
:
-
1
Text
{
rectTitle
:
JamiStrings
.
allScreens
id
:
screenNameAll
rId
:
AvAdapter
.
getSharingResource
(
-
1
,
""
)
isSelectAllScreens
:
true
anchors.top
:
screenSelectionRectAll
.
top
anchors.topMargin
:
10
anchors.horizontalCenter
:
screenSelectionRectAll
.
horizontalCenter
font.pointSize
:
JamiTheme
.
textFontSize
text
:
JamiStrings
.
allScreens
color
:
JamiTheme
.
textColor
}
VideoView
{
id
:
screenShotAll
anchors.top
:
screenNameAll
.
bottom
anchors.topMargin
:
10
anchors.horizontalCenter
:
screenSelectionRectAll
.
horizontalCenter
height
:
screenSelectionRectAll
.
height
-
50
width
:
screenSelectionRectAll
.
width
-
50
Component.onDestruction
:
{
VideoDevices
.
stopDevice
(
rendererId
)
}
Component.onCompleted
:
{
if
(
visible
)
{
const
rId
=
AvAdapter
.
getSharingResource
(
-
1
)
if
(
rId
!==
""
)
{
rendererId
=
VideoDevices
.
startDevice
(
rId
)
}
}
}
}
}
MouseArea
{
anchors.fill
:
parent
acceptedButtons
:
Qt
.
LeftButton
onClicked
:
{
selectedScreenNumber
=
-
1
selectAllScreens
=
true
}
}
}
Text
{
id
:
windowsText
width
:
screenSelectionScrollView
.
width
height
:
JamiTheme
.
preferredFieldHeight
font.pointSize
:
JamiTheme
.
menuFontSize
font.bold
:
true
text
:
JamiStrings
.
windows
verticalAlignment
:
Text
.
AlignBottom
color
:
JamiTheme
.
textColor
visible
:
root
.
window
}
Repeater
{
Repeater
{
id
:
screenInfo2
id
:
screenInfo
model
:
screens
?
screens
.
length
:
0
delegate
:
Rectangle
{
id
:
screenItem2
color
:
JamiTheme
.
secondaryBackgroundColor
width
:
componentWidthDoubleColumn
>
componentMinWidth
?
componentWidthDoubleColumn
:
componentWidthSingleColumn
height
:
3
*
width
/
4
border.color
:
selectedScreenNumber
===
index
?
JamiTheme
.
screenSelectionBorderColor
:
JamiTheme
.
tabbarBorderColor
visible
:
root
.
window
&&
JamiStrings
.
selectScreen
!==
screens
[
index
]
&&
index
>=
Qt
.
application
.
screens
.
length
Text
{
id
:
screenName2
anchors.top
:
screenItem2
.
top
anchors.topMargin
:
10
anchors.horizontalCenter
:
screenItem2
.
horizontalCenter
width
:
parent
.
width
font.pointSize
:
JamiTheme
.
textFontSize
text
:
screens
[
index
]
?
screens
[
index
]
:
""
elide
:
Text
.
ElideMiddle
horizontalAlignment
:
Text
.
AlignHCenter
color
:
JamiTheme
.
textColor
}
VideoView
{
model
:
listModel
.
length
id
:
screenPreview2
anchors.top
:
screenName2
.
bottom
delegate
:
ScreensharingElementPreview
{
anchors.topMargin
:
10
id
:
screenItem
anchors.horizontalCenter
:
screenItem2
.
horizontalCenter
anchors.leftMargin
:
25
anchors.rightMargin
:
25
height
:
screenItem2
.
height
-
60
width
:
screenItem2
.
width
-
50
Component.onDestruction
:
{
visible
:
JamiStrings
.
selectScreen
!==
listModel
[
index
]
VideoDevices
.
stopDevice
(
rendererId
)
elementIndex
:
index
}
rectTitle
:
listModel
[
index
]
?
listModel
[
index
]
:
""
Component.onCompleted
:
{
rId
:
{
if
(
visible
)
{
if
(
root
.
window
)
const
rId
=
AvAdapter
.
getSharingResource
(
-
2
,
AvAdapter
.
windowsIds
[
index
-
Qt
.
application
.
screens
.
length
],
AvAdapter
.
windowsNames
[
index
-
Qt
.
application
.
screens
.
length
])
return
rId
=
AvAdapter
.
getSharingResource
(
-
2
,
AvAdapter
.
windowsIds
[
index
])
if
(
rId
!==
""
)
{
return
rId
=
AvAdapter
.
getSharingResource
(
index
,
""
)
rendererId
=
VideoDevices
.
startDevice
(
rId
)
}
}
}
}
}
isSelectAllScreens
:
false
MouseArea
{
Connections
{
anchors.fill
:
screenItem2
target
:
AvAdapter
acceptedButtons
:
Qt
.
LeftButton
onClicked
:
{
function
onScreenCaptured
(
screenNumber
,
source
)
{
selectAllScreens
=
false
if
(
screenNumber
===
-
1
&&
!
root
.
window
)
if
(
selectedScreenNumber
==
-
1
screenShotAll
.
source
=
JamiQmlUtils
.
base64StringTitle
+
source
||
selectedScreenNumber
!==
index
)
{
selectedScreenNumber
=
index
}
}
}
}
}
}
}
}
...
@@ -342,13 +176,10 @@ Window {
...
@@ -342,13 +176,10 @@ Window {
}
}
RowLayout
{
RowLayout
{
anchors.bottom
:
selectScreenWindowRect
.
bottom
Layout.margins
:
marginSize
anchors.bottomMargin
:
JamiTheme
.
preferredMarginSize
Layout.preferredWidth
:
selectScreenWindowLayout
.
width
anchors.horizontalCenter
:
selectScreenWindowRect
.
horizontalCenter
Layout.preferredHeight
:
childrenRect
.
height
spacing
:
marginSize
width
:
parent
.
width
height
:
childrenRect
.
height
spacing
:
JamiTheme
.
preferredMarginSize
MaterialButton
{
MaterialButton
{
id
:
selectButton
id
:
selectButton
...
@@ -356,9 +187,9 @@ Window {
...
@@ -356,9 +187,9 @@ Window {
Layout.maximumWidth
:
200
Layout.maximumWidth
:
200
Layout.fillWidth
:
true
Layout.fillWidth
:
true
Layout.alignment
:
Qt
.
AlignHCenter
Layout.alignment
:
Qt
.
AlignHCenter
Layout.leftMargin
:
JamiTheme
.
preferredM
arginSize
Layout.leftMargin
:
m
arginSize
enabled
:
selectedScreenNumber
!=
-
1
||
selectAllScreens
enabled
:
selectedScreenNumber
!=
-
2
opacity
:
enabled
?
1.0
:
0.5
opacity
:
enabled
?
1.0
:
0.5
color
:
JamiTheme
.
buttonTintedBlack
color
:
JamiTheme
.
buttonTintedBlack
...
@@ -373,10 +204,10 @@ Window {
...
@@ -373,10 +204,10 @@ Window {
if
(
selectAllScreens
)
if
(
selectAllScreens
)
AvAdapter
.
shareAllScreens
()
AvAdapter
.
shareAllScreens
()
else
{
else
{
if
(
selectedScreenNumber
<
Qt
.
application
.
screens
.
length
)
if
(
!
root
.
window
)
AvAdapter
.
shareEntireScreen
(
selectedScreenNumber
)
AvAdapter
.
shareEntireScreen
(
selectedScreenNumber
)
else
{
else
{
AvAdapter
.
shareWindow
(
AvAdapter
.
windowsIds
[
selectedScreenNumber
-
Qt
.
application
.
screens
.
length
],
AvAdapter
.
windowsNames
[
selectedScreenNumber
-
Qt
.
application
.
screens
.
length
])
AvAdapter
.
shareWindow
(
AvAdapter
.
windowsIds
[
selectedScreenNumber
])
}
}
}
}
root
.
close
()
root
.
close
()
...
@@ -389,7 +220,7 @@ Window {
...
@@ -389,7 +220,7 @@ Window {
Layout.maximumWidth
:
200
Layout.maximumWidth
:
200
Layout.fillWidth
:
true
Layout.fillWidth
:
true
Layout.alignment
:
Qt
.
AlignHCenter
Layout.alignment
:
Qt
.
AlignHCenter
Layout.rightMargin
:
JamiTheme
.
preferredM
arginSize
Layout.rightMargin
:
m
arginSize
color
:
JamiTheme
.
buttonTintedBlack
color
:
JamiTheme
.
buttonTintedBlack
hoveredColor
:
JamiTheme
.
buttonTintedBlackHovered
hoveredColor
:
JamiTheme
.
buttonTintedBlackHovered
...
@@ -403,3 +234,5 @@ Window {
...
@@ -403,3 +234,5 @@ Window {
}
}
}
}
}
}
}
}
This diff is collapsed.
Click to expand it.
Aline Gondim Santos
@agsantos
mentioned in commit
d1d466aa
·
2 years ago
mentioned in commit
d1d466aa
mentioned in commit d1d466aa7aadcb364115c26e81287a7ba1b168bb
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment