Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-client-windows
Commits
82a08677
Commit
82a08677
authored
Feb 14, 2019
by
Andreas Traczyk
Browse files
settings: use one combo box to change resolution and rate
Change-Id: Ide11e4ec28a0813a8102115d6901d5dd486f33ea
parent
6f962ff9
Changes
3
Hide whitespace changes
Inline
Side-by-side
settingswidget.cpp
View file @
82a08677
...
...
@@ -130,7 +130,6 @@ SettingsWidget::leaveSettingsSlot()
}
Video
::
PreviewManager
::
instance
().
stopPreview
();
saveSizeIndex
();
emit
NavigationRequested
(
ScreenEnum
::
CallScreen
);
}
...
...
@@ -159,8 +158,6 @@ SettingsWidget::resize(int size)
void
SettingsWidget
::
setSelected
(
Button
sel
)
{
saveSizeIndex
();
switch
(
sel
)
{
case
Button
::
accountSettingsButton
:
...
...
@@ -820,14 +817,19 @@ SettingsWidget::openRecordFolderSlot()
void
SettingsWidget
::
populateAVSettings
()
{
ui
->
deviceBox
->
setModel
(
deviceModel_
);
connect
(
deviceModel_
,
SIGNAL
(
currentIndexChanged
(
int
)),
this
,
SLOT
(
deviceIndexChanged
(
int
)));
// Audio settings
// audio
auto
inputModel
=
Audio
::
Settings
::
instance
().
inputDeviceModel
();
auto
outputModel
=
Audio
::
Settings
::
instance
().
outputDeviceModel
();
disconnect
(
ui
->
outputComboBox
,
QOverload
<
int
>::
of
(
&
QComboBox
::
currentIndexChanged
),
this
,
&
SettingsWidget
::
outputDevIndexChangedSlot
);
disconnect
(
ui
->
inputComboBox
,
QOverload
<
int
>::
of
(
&
QComboBox
::
currentIndexChanged
),
this
,
&
SettingsWidget
::
inputdevIndexChangedSlot
);
connect
(
ui
->
outputComboBox
,
QOverload
<
int
>::
of
(
&
QComboBox
::
currentIndexChanged
),
this
,
&
SettingsWidget
::
outputDevIndexChangedSlot
);
connect
(
ui
->
inputComboBox
,
QOverload
<
int
>::
of
(
&
QComboBox
::
currentIndexChanged
),
this
,
&
SettingsWidget
::
inputdevIndexChangedSlot
);
ui
->
inputComboBox
->
setModel
(
inputModel
);
ui
->
outputComboBox
->
setModel
(
outputModel
);
...
...
@@ -837,116 +839,147 @@ SettingsWidget::populateAVSettings()
ui
->
inputComboBox
->
setCurrentIndex
(
inputIndex
.
row
());
ui
->
outputComboBox
->
setCurrentIndex
(
outputIndex
.
row
());
if
(
ui
->
deviceBox
->
count
()
>
0
)
{
deviceBoxCurrentIndexChangedSlot
(
0
);
}
if
(
currentResIndex
>=
0
)
{
ui
->
sizeBox
->
setCurrentIndex
(
currentResIndex
);
}
connect
(
ui
->
outputComboBox
,
QOverload
<
int
>::
of
(
&
QComboBox
::
currentIndexChanged
),
this
,
&
SettingsWidget
::
outputDevIndexChangedSlot
);
connect
(
ui
->
inputComboBox
,
QOverload
<
int
>::
of
(
&
QComboBox
::
currentIndexChanged
),
this
,
&
SettingsWidget
::
inputdevIndexChangedSlot
);
// video
disconnect
(
deviceModel_
,
SIGNAL
(
currentIndexChanged
(
int
)),
this
,
SLOT
(
deviceModelIndexChanged
(
int
)));
disconnect
(
ui
->
deviceBox
,
QOverload
<
int
>::
of
(
&
QComboBox
::
currentIndexChanged
),
this
,
&
SettingsWidget
::
slotDeviceBoxCurrentIndexChanged
);
disconnect
(
ui
->
formatBox
,
QOverload
<
int
>::
of
(
&
QComboBox
::
currentIndexChanged
),
this
,
&
SettingsWidget
::
slotFormatBoxCurrentIndexChanged
);
connect
(
deviceModel_
,
SIGNAL
(
currentIndexChanged
(
int
)),
this
,
SLOT
(
deviceModelIndexChanged
(
int
)));
connect
(
ui
->
deviceBox
,
QOverload
<
int
>::
of
(
&
QComboBox
::
currentIndexChanged
),
this
,
&
SettingsWidget
::
slotDeviceBoxCurrentIndexChanged
);
connect
(
ui
->
formatBox
,
QOverload
<
int
>::
of
(
&
QComboBox
::
currentIndexChanged
),
this
,
&
SettingsWidget
::
slotFormatBoxCurrentIndexChanged
);
connect
(
ui
->
deviceBox
,
QOverload
<
int
>::
of
(
&
QComboBox
::
currentIndexChanged
),
this
,
&
SettingsWidget
::
deviceBoxCurrentIndexChangedSlot
);
connect
(
ui
->
sizeBox
,
QOverload
<
int
>::
of
(
&
QComboBox
::
currentIndexChanged
),
this
,
&
SettingsWidget
::
sizeBoxCurrentIndexChangedSlot
);
ui
->
deviceBox
->
setModel
(
deviceModel_
);
currentDeviceName_
=
deviceModel_
->
activeDevice
()
->
name
();
setFormatListForDevice
(
deviceModel_
->
activeDevice
());
showPreview
();
}
void
SettingsWidget
::
saveSizeI
ndex
(
)
SettingsWidget
::
outputDevIndexChangedSlot
(
int
i
ndex
)
{
currentResIndex
=
ui
->
sizeBox
->
currentIndex
();
auto
outputModel
=
Audio
::
Settings
::
instance
().
outputDeviceModel
();
outputModel
->
selectionModel
()
->
setCurrentIndex
(
outputModel
->
index
(
index
),
QItemSelectionModel
::
ClearAndSelect
);
}
void
SettingsWidget
::
showPreview
(
)
SettingsWidget
::
inputdevIndexChangedSlot
(
int
index
)
{
if
(
!
CallModel
::
instance
().
getActiveCalls
().
size
())
{
ui
->
previewUnavailableLabel
->
hide
();
ui
->
videoWidget
->
show
();
startVideo
();
ui
->
videoWidget
->
setIsFullPreview
(
true
);
}
else
{
ui
->
previewUnavailableLabel
->
show
();
ui
->
videoWidget
->
hide
();
}
auto
inputModel
=
Audio
::
Settings
::
instance
().
inputDeviceModel
();
inputModel
->
selectionModel
()
->
setCurrentIndex
(
inputModel
->
index
(
index
),
QItemSelectionModel
::
ClearAndSelect
);
}
void
SettingsWidget
::
device
BoxCurrent
IndexChanged
Slot
(
int
index
)
SettingsWidget
::
device
Model
IndexChanged
(
int
index
)
{
if
(
index
<
0
)
{
currentDeviceName_
=
""
;
toggleVideoSettings
(
false
);
toggleVideoPreview
(
false
);
return
;
}
deviceModel_
->
setActive
(
index
);
auto
device
=
deviceModel_
->
activeDevice
();
ui
->
sizeBox
->
clear
();
if
(
device
->
channelList
().
size
()
>
0
)
{
for
(
auto
resolution
:
device
->
channelList
()[
0
]
->
validResolutions
())
{
ui
->
sizeBox
->
addItem
(
resolution
->
name
());
}
}
ui
->
sizeBox
->
setCurrentIndex
(
device
->
channelList
()[
0
]
->
activeResolution
()
->
relativeIndex
());
toggleVideoSettings
(
true
);
toggleVideoPreview
(
true
);
ui
->
deviceBox
->
setCurrentIndex
(
index
);
setFormatListForDevice
(
deviceModel_
->
activeDevice
());
currentDeviceName_
=
deviceModel_
->
activeDevice
()
->
name
();
}
void
SettingsWidget
::
s
iz
eBoxCurrentIndexChanged
Slot
(
int
index
)
SettingsWidget
::
s
lotDevic
eBoxCurrentIndexChanged
(
int
index
)
{
if
(
index
<
0
)
{
if
(
index
<
0
)
return
;
auto
deviceList
=
deviceModel_
->
devices
();
if
(
!
deviceList
.
isEmpty
()
&&
currentDeviceName_
!=
deviceList
[
index
]
->
name
())
{
deviceModel_
->
setActive
(
index
);
}
currentDeviceName_
=
deviceModel_
->
activeDevice
()
->
name
();
}
auto
device
=
deviceModel_
->
activeDevice
();
device
->
channelList
()[
0
]
->
setActiveResolution
(
device
->
channelList
()[
0
]
->
validResolutions
()[
index
]);
QTimer
::
singleShot
(
200
,
this
,
[
this
]()
{
deviceModel_
->
setActive
(
ui
->
deviceBox
->
currentIndex
());
});
void
SettingsWidget
::
slotFormatBoxCurrentIndexChanged
(
int
index
)
{
if
(
index
<
0
)
return
;
if
(
auto
activeChannel
=
deviceModel_
->
activeDevice
()
->
activeChannel
())
{
auto
resolutionIndex
=
formatIndexList_
.
at
(
index
).
first
;
auto
rateIndex
=
formatIndexList_
.
at
(
index
).
second
;
activeChannel
->
setActiveMode
(
resolutionIndex
,
rateIndex
);
}
}
void
SettingsWidget
::
deviceIndexChanged
(
int
index
)
SettingsWidget
::
startVideo
(
)
{
ui
->
deviceBox
->
setCurrentIndex
(
index
);
Video
::
PreviewManager
::
instance
().
stopPreview
();
Video
::
PreviewManager
::
instance
().
startPreview
();
}
ui
->
videoLayout
->
update
();
void
SettingsWidget
::
stopVideo
()
{
Video
::
PreviewManager
::
instance
().
stopPreview
();
}
void
SettingsWidget
::
outputDevIndexChangedSlot
(
int
index
)
SettingsWidget
::
toggleVideoSettings
(
bool
enabled
)
{
auto
outputModel
=
Audio
::
Settings
::
instance
().
outputDeviceModel
();
outputModel
->
selectionModel
()
->
setCurrentIndex
(
outputModel
->
index
(
index
),
QItemSelectionModel
::
ClearAndSelect
);
ui
->
formatBox
->
clear
();
ui
->
deviceBox
->
clear
();
ui
->
formatBox
->
setEnabled
(
enabled
);
ui
->
deviceBox
->
setEnabled
(
enabled
);
}
void
SettingsWidget
::
inputdevIndexChangedSlot
(
int
index
)
SettingsWidget
::
toggleVideoPreview
(
bool
enabled
)
{
auto
inputModel
=
Audio
::
Settings
::
instance
().
inputDeviceModel
(
);
inputModel
->
selectionModel
()
->
setCurrentIndex
(
inputModel
->
index
(
index
),
QItemSelectionModel
::
ClearAndSelect
);
ui
->
previewUnavailableLabel
->
setVisible
(
!
enabled
);
ui
->
videoLayoutWidget
->
setVisible
(
enabled
);
}
void
SettingsWidget
::
s
tartVideo
()
SettingsWidget
::
s
howPreview
()
{
Video
::
PreviewManager
::
instance
().
stopPreview
();
Video
::
PreviewManager
::
instance
().
startPreview
();
if
(
!
CallModel
::
instance
().
getActiveCalls
().
size
())
{
ui
->
previewUnavailableLabel
->
hide
();
ui
->
videoLayoutWidget
->
show
();
startVideo
();
ui
->
videoWidget
->
setIsFullPreview
(
true
);
}
else
{
ui
->
previewUnavailableLabel
->
show
();
ui
->
videoLayoutWidget
->
hide
();
}
}
void
SettingsWidget
::
s
topVideo
(
)
SettingsWidget
::
s
etFormatListForDevice
(
Video
::
Device
*
device
)
{
Video
::
PreviewManager
::
instance
().
stopPreview
();
auto
activeChannel
=
device
->
activeChannel
();
if
(
!
activeChannel
)
return
;
auto
activeResolution
=
activeChannel
->
activeResolution
();
auto
activeRate
=
activeResolution
->
activeRate
();
ui
->
formatBox
->
blockSignals
(
true
);
ui
->
formatBox
->
clear
();
formatIndexList_
.
clear
();
for
(
auto
resolution
:
activeChannel
->
validResolutions
())
{
auto
resolutionIndex
=
activeChannel
->
validResolutions
().
indexOf
(
resolution
);
for
(
auto
rate
:
resolution
->
validRates
())
{
auto
ratenIndex
=
resolution
->
validRates
().
indexOf
(
rate
);
formatIndexList_
.
append
(
QPair
<
int
,
int
>
(
resolutionIndex
,
ratenIndex
));
auto
fr
=
rate
->
name
().
toDouble
();
auto
sizeRateString
=
QString
(
"%1 [%2 fps]"
).
arg
(
resolution
->
name
()).
arg
(
round
(
fr
));
ui
->
formatBox
->
addItem
(
sizeRateString
);
if
(
resolution
==
activeResolution
&&
rate
==
activeRate
)
{
ui
->
formatBox
->
setCurrentIndex
(
ui
->
formatBox
->
count
()
-
1
);
}
ui
->
formatBox
->
count
();
}
}
ui
->
formatBox
->
blockSignals
(
false
);
}
settingswidget.h
View file @
82a08677
...
...
@@ -137,21 +137,24 @@ private slots:
// ************************* Audio/Visual Settings *************************
private:
void
populateAVSettings
();
void
saveSizeIndex
();
QList
<
QPair
<
int
,
int
>>
formatIndexList_
;
Video
::
DeviceModel
*
deviceModel_
;
void
showPreview
();
bool
isLoading_
;
int
currentResIndex
=
-
1
;
QString
currentDeviceName_
;
void
populateAVSettings
();
void
setFormatListForDevice
(
Video
::
Device
*
device
);
void
showPreview
();
void
startVideo
();
void
stopVideo
();
void
toggleVideoSettings
(
bool
enabled
);
void
toggleVideoPreview
(
bool
enabled
);
private
slots
:
void
deviceIndexChanged
(
int
index
);
void
deviceBoxCurrentIndexChangedSlot
(
int
index
);
void
sizeBoxCurrentIndexChangedSlot
(
int
index
);
void
outputDevIndexChangedSlot
(
int
index
);
void
inputdevIndexChangedSlot
(
int
index
);
void
deviceModelIndexChanged
(
int
index
);
void
slotDeviceBoxCurrentIndexChanged
(
int
index
);
void
slotFormatBoxCurrentIndexChanged
(
int
index
);
};
settingswidget.ui
View file @
82a08677
...
...
@@ -422,7 +422,7 @@
<string
notr=
"true"
/>
</property>
<property
name=
"currentIndex"
>
<number>
1
</number>
<number>
2
</number>
</property>
<widget
class=
"QWidget"
name=
"generalSettings"
>
<property
name=
"sizePolicy"
>
...
...
@@ -1117,8 +1117,8 @@ QPushButton:pressed {background: rgb(230,230, 230); border: 0px; border-radius:
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
6
96
</width>
<height>
781
</height>
<width>
6
25
</width>
<height>
560
</height>
</rect>
</property>
<property
name=
"styleSheet"
>
...
...
@@ -2815,6 +2815,9 @@ padding-left: 15px;
<property
name=
"leftMargin"
>
<number>
20
</number>
</property>
<property
name=
"bottomMargin"
>
<number>
0
</number>
</property>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_33"
>
<property
name=
"spacing"
>
...
...
@@ -2876,27 +2879,27 @@ padding-left: 15px;
</layout>
</item>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_
34
"
>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_
8
"
>
<property
name=
"spacing"
>
<number>
0
</number>
</property>
<property
name=
"topMargin"
>
<number>
0
</number>
</property>
<item>
<widget
class=
"QLabel"
name=
"label_
21
"
>
<widget
class=
"QLabel"
name=
"label_
8
"
>
<property
name=
"font"
>
<font>
<pointsize>
11
</pointsize>
</font>
</property>
<property
name=
"text"
>
<string>
Resolution
</string>
</property>
<property
name=
"textInteractionFlags"
>
<set>
Qt::NoTextInteraction
</set>
<string>
Format
</string>
</property>
</widget>
</item>
<item>
<spacer
name=
"horizontalSpacer_2
2
"
>
<spacer
name=
"horizontalSpacer_2
7
"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
...
...
@@ -2909,7 +2912,7 @@ padding-left: 15px;
</spacer>
</item>
<item>
<widget
class=
"QComboBox"
name=
"
size
Box"
>
<widget
class=
"QComboBox"
name=
"
format
Box"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"MinimumExpanding"
vsizetype=
"Fixed"
>
<horstretch>
0
</horstretch>
...
...
@@ -2929,7 +2932,7 @@ padding-left: 15px;
</size>
</property>
<property
name=
"toolTip"
>
<string>
Video device
resolution
selector
</string>
<string>
Video device
framerate
selector
</string>
</property>
</widget>
</item>
...
...
@@ -2956,7 +2959,7 @@ padding-left: 15px;
</spacer>
</item>
<item>
<widget
class=
"QWidget"
name=
"videoLayoutWidget
_2
"
native=
"true"
>
<widget
class=
"QWidget"
name=
"videoLayoutWidget"
native=
"true"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"MinimumExpanding"
vsizetype=
"MinimumExpanding"
>
<horstretch>
0
</horstretch>
...
...
@@ -3071,7 +3074,7 @@ padding-left: 15px;
</font>
</property>
<property
name=
"text"
>
<string>
Preview unavailable
during call
</string>
<string>
Preview unavailable
</string>
</property>
<property
name=
"alignment"
>
<set>
Qt::AlignCenter
</set>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment