Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jami-libclient
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
savoirfairelinux
jami-libclient
Commits
dcf6195e
Commit
dcf6195e
authored
9 years ago
by
Alexandre Lision
Committed by
gerrit2
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
sourcemodel: use prefixes exposed by the daemon
Tuleap: #267 Change-Id: Id8fc189d9b5312a50d2ffe62ce884be69e23b951
parent
a8c52734
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/video/sourcemodel.cpp
+31
-26
31 additions, 26 deletions
src/video/sourcemodel.cpp
with
31 additions
and
26 deletions
src/video/sourcemodel.cpp
+
31
−
26
View file @
dcf6195e
...
...
@@ -20,7 +20,7 @@
#include
<QtCore/QCoreApplication>
#include
"../dbus/videomanager.h"
#include
"devicemodel.h"
#include
"callmodel
.h
"
#include
<media_const
.h
>
namespace
Video
{
class
SourceModelPrivate
...
...
@@ -28,15 +28,6 @@ class SourceModelPrivate
public:
SourceModelPrivate
();
//Constants
class
ProtocolPrefix
{
public:
constexpr
static
const
char
*
NONE
=
""
;
constexpr
static
const
char
*
DISPLAY
=
"display://"
;
constexpr
static
const
char
*
FILE
=
"file://"
;
constexpr
static
const
char
*
CAMERA
=
"camera://"
;
};
struct
Display
{
Display
()
:
rect
(
0
,
0
,
0
,
0
),
index
(
0
){}
QRect
rect
;
...
...
@@ -137,26 +128,36 @@ void Video::SourceModel::switchTo(const QModelIndex& idx)
///This model is designed for "live" switching rather than configuration
void
Video
::
SourceModel
::
switchTo
(
const
int
idx
)
{
switch
(
idx
)
{
auto
newIdx
=
idx
>
-
1
?
idx
:
ExtendedDeviceList
::
NONE
;
QString
sep
=
DRing
::
Media
::
VideoProtocolPrefix
::
SEPARATOR
;
switch
(
newIdx
)
{
case
ExtendedDeviceList
::
NONE
:
VideoManager
::
instance
().
switchInput
(
Video
::
SourceModelPrivate
::
ProtocolPrefix
::
NONE
);
VideoManager
::
instance
().
switchInput
(
DRing
::
Media
::
Video
ProtocolPrefix
::
NONE
);
break
;
case
ExtendedDeviceList
::
SCREEN
:
VideoManager
::
instance
().
switchInput
(
QString
(
Video
::
SourceModelPrivate
::
ProtocolPrefix
::
DISPLAY
)
+
QString
(
":%1+%2,%3 %4x%5"
)
.
arg
(
d_ptr
->
m_Display
.
index
)
.
arg
(
d_ptr
->
m_Display
.
rect
.
x
())
.
arg
(
d_ptr
->
m_Display
.
rect
.
y
())
.
arg
(
d_ptr
->
m_Display
.
rect
.
width
())
.
arg
(
d_ptr
->
m_Display
.
rect
.
height
()));
VideoManager
::
instance
().
switchInput
(
QString
(
"%1%2:%3+%4,%5 %6x%7"
)
.
arg
(
DRing
::
Media
::
VideoProtocolPrefix
::
DISPLAY
)
.
arg
(
sep
)
.
arg
(
d_ptr
->
m_Display
.
index
)
.
arg
(
d_ptr
->
m_Display
.
rect
.
x
())
.
arg
(
d_ptr
->
m_Display
.
rect
.
y
())
.
arg
(
d_ptr
->
m_Display
.
rect
.
width
())
.
arg
(
d_ptr
->
m_Display
.
rect
.
height
()));
break
;
case
ExtendedDeviceList
::
FILE
:
VideoManager
::
instance
().
switchInput
(
!
d_ptr
->
m_CurrentFile
.
isEmpty
()
?+
Video
::
SourceModelPrivate
::
ProtocolPrefix
::
FILE
+
d_ptr
->
m_CurrentFile
.
toLocalFile
()
:
Video
::
SourceModelPrivate
::
ProtocolPrefix
::
NONE
!
d_ptr
->
m_CurrentFile
.
isEmpty
()
?
QString
(
"%1%2%3"
)
.
arg
(
DRing
::
Media
::
VideoProtocolPrefix
::
FILE
)
.
arg
(
sep
)
.
arg
(
d_ptr
->
m_CurrentFile
.
toLocalFile
())
:
DRing
::
Media
::
VideoProtocolPrefix
::
NONE
);
break
;
default:
VideoManager
::
instance
().
switchInput
(
Video
::
SourceModelPrivate
::
ProtocolPrefix
::
CAMERA
+
Video
::
DeviceModel
::
instance
().
index
(
idx
-
ExtendedDeviceList
::
COUNT__
,
0
).
data
(
Qt
::
DisplayRole
).
toString
());
VideoManager
::
instance
().
switchInput
(
QString
(
"%1%2%3"
)
.
arg
(
DRing
::
Media
::
VideoProtocolPrefix
::
CAMERA
)
.
arg
(
sep
)
.
arg
(
Video
::
DeviceModel
::
instance
().
index
(
idx
-
ExtendedDeviceList
::
COUNT__
,
0
).
data
(
Qt
::
DisplayRole
).
toString
()));
break
;
};
}
...
...
@@ -169,15 +170,19 @@ void Video::SourceModel::setUsedIndex(QString &deviceStr)
if
(
deviceStr
.
length
()
<=
0
)
{
idx
=
ExtendedDeviceList
::
NONE
;
}
else
if
(
deviceStr
.
indexOf
(
Video
::
SourceModelPrivate
::
ProtocolPrefix
::
DISPLAY
)
==
0
)
{
// Look for the display string into the incom
m
ing device string
else
if
(
deviceStr
.
indexOf
(
DRing
::
Media
::
Video
ProtocolPrefix
::
DISPLAY
)
==
0
)
{
// Look for the display string into the incoming device string
idx
=
ExtendedDeviceList
::
SCREEN
;
}
else
if
(
deviceStr
.
indexOf
(
Video
::
SourceModelPrivate
::
ProtocolPrefix
::
FILE
)
==
0
)
{
else
if
(
deviceStr
.
indexOf
(
DRing
::
Media
::
Video
ProtocolPrefix
::
FILE
)
==
0
)
{
idx
=
ExtendedDeviceList
::
FILE
;
}
else
if
(
deviceStr
.
indexOf
(
Video
::
SourceModelPrivate
::
ProtocolPrefix
::
CAMERA
)
==
0
)
{
Video
::
Device
*
dev
=
Video
::
DeviceModel
::
instance
().
getDevice
(
deviceStr
.
replace
(
Video
::
SourceModelPrivate
::
ProtocolPrefix
::
CAMERA
,
""
));
else
if
(
deviceStr
.
indexOf
(
DRing
::
Media
::
VideoProtocolPrefix
::
CAMERA
)
==
0
)
{
QString
sep
=
DRing
::
Media
::
VideoProtocolPrefix
::
SEPARATOR
;
auto
fullPrefix
=
QString
(
"%1%2"
)
.
arg
(
DRing
::
Media
::
VideoProtocolPrefix
::
CAMERA
)
.
arg
(
DRing
::
Media
::
VideoProtocolPrefix
::
SEPARATOR
);
Video
::
Device
*
dev
=
Video
::
DeviceModel
::
instance
().
getDevice
(
deviceStr
.
replace
(
fullPrefix
,
""
));
if
(
dev
==
nullptr
)
{
// Device not found we dont know what camera is used
idx
=
ExtendedDeviceList
::
NONE
;
...
...
This diff is collapsed.
Click to expand it.
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