Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linphone-desktop
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
linphone-desktop
Commits
a6dfdd1c
Commit
a6dfdd1c
authored
Jun 05, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(ui/views/App/Calls/CallsWindow): QML must close the window if necessary, not the c++
parent
060927b8
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
48 additions
and
45 deletions
+48
-45
CallsListModel.cpp
linphone-desktop/src/components/calls/CallsListModel.cpp
+3
-11
ConferenceHelperModel.cpp
...sktop/src/components/conference/ConferenceHelperModel.cpp
+0
-14
ConferenceHelperModel.hpp
...sktop/src/components/conference/ConferenceHelperModel.hpp
+2
-8
ApplicationWindow.qml
...ne-desktop/ui/modules/Common/Window/ApplicationWindow.qml
+9
-0
Window.js
linphone-desktop/ui/modules/Common/Window/Window.js
+4
-6
Window.qml
linphone-desktop/ui/modules/Common/Window/Window.qml
+9
-0
CallsWindow.js
linphone-desktop/ui/views/App/Calls/CallsWindow.js
+18
-6
CallsWindow.qml
linphone-desktop/ui/views/App/Calls/CallsWindow.qml
+3
-0
No files found.
linphone-desktop/src/components/calls/CallsListModel.cpp
View file @
a6dfdd1c
...
@@ -147,8 +147,7 @@ void CallsListModel::handleCallStateChanged (const std::shared_ptr<linphone::Cal
...
@@ -147,8 +147,7 @@ void CallsListModel::handleCallStateChanged (const std::shared_ptr<linphone::Cal
case
linphone
:
:
CallStateStreamsRunning
:
{
case
linphone
:
:
CallStateStreamsRunning
:
{
int
index
=
findCallIndex
(
mList
,
call
);
int
index
=
findCallIndex
(
mList
,
call
);
emit
callRunning
(
index
,
&
call
->
getData
<
CallModel
>
(
"call-model"
));
emit
callRunning
(
index
,
&
call
->
getData
<
CallModel
>
(
"call-model"
));
}
}
break
;
break
;
default:
default:
break
;
break
;
...
@@ -186,12 +185,10 @@ void CallsListModel::addCall (const shared_ptr<linphone::Call> &call) {
...
@@ -186,12 +185,10 @@ void CallsListModel::addCall (const shared_ptr<linphone::Call> &call) {
App
::
getInstance
()
->
getEngine
()
->
setObjectOwnership
(
callModel
,
QQmlEngine
::
CppOwnership
);
App
::
getInstance
()
->
getEngine
()
->
setObjectOwnership
(
callModel
,
QQmlEngine
::
CppOwnership
);
// This connection is (only) useful for `CallsListProxyModel`.
// This connection is (only) useful for `CallsListProxyModel`.
QObject
::
connect
(
QObject
::
connect
(
callModel
,
&
CallModel
::
isInConferenceChanged
,
this
,
[
this
,
callModel
](
bool
)
{
callModel
,
&
CallModel
::
isInConferenceChanged
,
this
,
[
this
,
callModel
](
bool
)
{
int
id
=
findCallIndex
(
mList
,
*
callModel
);
int
id
=
findCallIndex
(
mList
,
*
callModel
);
emit
dataChanged
(
index
(
id
,
0
),
index
(
id
,
0
));
emit
dataChanged
(
index
(
id
,
0
),
index
(
id
,
0
));
}
});
);
int
row
=
mList
.
count
();
int
row
=
mList
.
count
();
...
@@ -223,9 +220,4 @@ void CallsListModel::removeCallCb (CallModel *callModel) {
...
@@ -223,9 +220,4 @@ void CallsListModel::removeCallCb (CallModel *callModel) {
int
index
=
mList
.
indexOf
(
callModel
);
int
index
=
mList
.
indexOf
(
callModel
);
if
(
index
==
-
1
||
!
removeRow
(
index
))
if
(
index
==
-
1
||
!
removeRow
(
index
))
qWarning
()
<<
QStringLiteral
(
"Unable to remove call:"
)
<<
callModel
;
qWarning
()
<<
QStringLiteral
(
"Unable to remove call:"
)
<<
callModel
;
if
(
mList
.
empty
()
&&
ConferenceHelperModel
::
getInstancesNumber
()
==
0
)
{
qInfo
()
<<
QStringLiteral
(
"Last call terminated, close calls window."
);
App
::
getInstance
()
->
getCallsWindow
()
->
close
();
}
}
}
linphone-desktop/src/components/conference/ConferenceHelperModel.cpp
View file @
a6dfdd1c
...
@@ -31,8 +31,6 @@ using namespace std;
...
@@ -31,8 +31,6 @@ using namespace std;
// =============================================================================
// =============================================================================
int
ConferenceHelperModel
::
mInstancesNumber
=
0
;
ConferenceHelperModel
::
ConferenceHelperModel
(
QObject
*
parent
)
:
QSortFilterProxyModel
(
parent
)
{
ConferenceHelperModel
::
ConferenceHelperModel
(
QObject
*
parent
)
:
QSortFilterProxyModel
(
parent
)
{
shared_ptr
<
linphone
::
Core
>
core
=
CoreManager
::
getInstance
()
->
getCore
();
shared_ptr
<
linphone
::
Core
>
core
=
CoreManager
::
getInstance
()
->
getCore
();
...
@@ -44,18 +42,6 @@ ConferenceHelperModel::ConferenceHelperModel (QObject *parent) : QSortFilterProx
...
@@ -44,18 +42,6 @@ ConferenceHelperModel::ConferenceHelperModel (QObject *parent) : QSortFilterProx
App
::
getInstance
()
->
getEngine
()
->
setObjectOwnership
(
mConferenceAddModel
,
QQmlEngine
::
CppOwnership
);
App
::
getInstance
()
->
getEngine
()
->
setObjectOwnership
(
mConferenceAddModel
,
QQmlEngine
::
CppOwnership
);
setSourceModel
(
new
SipAddressesProxyModel
(
this
));
setSourceModel
(
new
SipAddressesProxyModel
(
this
));
mInstancesNumber
++
;
}
ConferenceHelperModel
::~
ConferenceHelperModel
()
{
mInstancesNumber
--
;
Q_ASSERT
(
mInstancesNumber
>=
0
);
if
(
mInstancesNumber
==
0
&&
CoreManager
::
getInstance
()
->
getCallsListModel
()
->
rowCount
()
==
0
)
{
qInfo
()
<<
QStringLiteral
(
"Conference terminated and no calls, close calls window."
);
App
::
getInstance
()
->
getCallsWindow
()
->
close
();
}
}
}
QHash
<
int
,
QByteArray
>
ConferenceHelperModel
::
roleNames
()
const
{
QHash
<
int
,
QByteArray
>
ConferenceHelperModel
::
roleNames
()
const
{
...
...
linphone-desktop/src/components/conference/ConferenceHelperModel.hpp
View file @
a6dfdd1c
...
@@ -42,20 +42,16 @@ namespace linphone {
...
@@ -42,20 +42,16 @@ namespace linphone {
class
ConferenceHelperModel
:
public
QSortFilterProxyModel
{
class
ConferenceHelperModel
:
public
QSortFilterProxyModel
{
Q_OBJECT
;
Q_OBJECT
;
Q_PROPERTY
(
ConferenceHelperModel
::
ConferenceAddModel
*
toAdd
READ
getConferenceAddModel
CONSTANT
);
Q_PROPERTY
(
ConferenceHelperModel
::
ConferenceAddModel
*
toAdd
READ
getConferenceAddModel
CONSTANT
);
public:
public:
class
ConferenceAddModel
;
class
ConferenceAddModel
;
ConferenceHelperModel
(
QObject
*
parent
=
Q_NULLPTR
);
ConferenceHelperModel
(
QObject
*
parent
=
Q_NULLPTR
);
~
ConferenceHelperModel
();
~
ConferenceHelperModel
()
=
default
;
QHash
<
int
,
QByteArray
>
roleNames
()
const
override
;
QHash
<
int
,
QByteArray
>
roleNames
()
const
override
;
static
int
getInstancesNumber
()
{
return
mInstancesNumber
;
}
Q_INVOKABLE
void
setFilter
(
const
QString
&
pattern
);
Q_INVOKABLE
void
setFilter
(
const
QString
&
pattern
);
protected:
protected:
...
@@ -69,8 +65,6 @@ private:
...
@@ -69,8 +65,6 @@ private:
ConferenceAddModel
*
mConferenceAddModel
;
ConferenceAddModel
*
mConferenceAddModel
;
std
::
shared_ptr
<
linphone
::
Conference
>
mConference
;
std
::
shared_ptr
<
linphone
::
Conference
>
mConference
;
static
int
mInstancesNumber
;
};
};
#endif // CONFERENCE_HELPER_MODEL_H_
#endif // CONFERENCE_HELPER_MODEL_H_
linphone-desktop/ui/modules/Common/Window/ApplicationWindow.qml
View file @
a6dfdd1c
...
@@ -6,8 +6,17 @@ import 'Window.js' as Logic
...
@@ -6,8 +6,17 @@ import 'Window.js' as Logic
// =============================================================================
// =============================================================================
ApplicationWindow
{
ApplicationWindow
{
id
:
window
default
property
alias
_content
:
content
.
data
default
property
alias
_content
:
content
.
data
readonly
property
bool
virtualWindowVisible
:
virtualWindow
.
visible
// ---------------------------------------------------------------------------
signal
attachedVirtualWindow
signal
detachedVirtualWindow
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
function
attachVirtualWindow
()
{
function
attachVirtualWindow
()
{
...
...
linphone-desktop/ui/modules/Common/Window/Window.js
View file @
a6dfdd1c
...
@@ -23,19 +23,17 @@ function attachVirtualWindow (component, properties, exitStatusHandler) {
...
@@ -23,19 +23,17 @@ function attachVirtualWindow (component, properties, exitStatusHandler) {
if
(
exitStatusHandler
)
{
if
(
exitStatusHandler
)
{
object
.
exitStatus
.
connect
(
exitStatusHandler
)
object
.
exitStatus
.
connect
(
exitStatusHandler
)
}
}
object
.
exitStatus
.
connect
(
function
()
{
object
.
exitStatus
.
connect
(
detachVirtualWindow
)
var
content
=
virtualWindow
.
unsetContent
()
if
(
content
)
{
content
.
destroy
()
}
})
virtualWindow
.
setContent
(
object
)
virtualWindow
.
setContent
(
object
)
window
.
attachedVirtualWindow
()
}
}
function
detachVirtualWindow
()
{
function
detachVirtualWindow
()
{
var
object
=
virtualWindow
.
unsetContent
()
var
object
=
virtualWindow
.
unsetContent
()
if
(
object
)
{
if
(
object
)
{
object
.
destroy
()
object
.
destroy
()
window
.
detachedVirtualWindow
()
}
}
}
}
linphone-desktop/ui/modules/Common/Window/Window.qml
View file @
a6dfdd1c
...
@@ -6,8 +6,17 @@ import 'Window.js' as Logic
...
@@ -6,8 +6,17 @@ import 'Window.js' as Logic
// =============================================================================
// =============================================================================
Window
{
Window
{
id
:
window
default
property
alias
_content
:
content
.
data
default
property
alias
_content
:
content
.
data
readonly
property
bool
virtualWindowVisible
:
virtualWindow
.
visible
// ---------------------------------------------------------------------------
signal
attachedVirtualWindow
signal
detachedVirtualWindow
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
function
attachVirtualWindow
()
{
function
attachVirtualWindow
()
{
...
...
linphone-desktop/ui/views/App/Calls/CallsWindow.js
View file @
a6dfdd1c
...
@@ -8,16 +8,12 @@
...
@@ -8,16 +8,12 @@
// =============================================================================
// =============================================================================
var
forceClose
=
false
function
handleClosing
(
close
)
{
function
handleClosing
(
close
)
{
var
callsList
=
Linphone
.
CallsListModel
var
callsList
=
Linphone
.
CallsListModel
window
.
detachVirtualWindow
()
window
.
detachVirtualWindow
()
if
(
forceClose
||
callsList
.
getRunningCallsNumber
()
===
0
)
{
if
(
callsList
.
getRunningCallsNumber
()
===
0
)
{
forceClose
=
false
callsList
.
terminateAllCalls
()
return
return
}
}
...
@@ -25,7 +21,7 @@ function handleClosing (close) {
...
@@ -25,7 +21,7 @@ function handleClosing (close) {
descriptionText
:
qsTr
(
'
acceptClosingDescription
'
)
descriptionText
:
qsTr
(
'
acceptClosingDescription
'
)
},
function
(
status
)
{
},
function
(
status
)
{
if
(
status
)
{
if
(
status
)
{
forceClose
=
true
callsList
.
terminateAllCalls
()
window
.
close
()
window
.
close
()
}
}
})
})
...
@@ -84,3 +80,19 @@ function handleCallTransferAsked (call) {
...
@@ -84,3 +80,19 @@ function handleCallTransferAsked (call) {
call
:
call
call
:
call
})
})
}
}
function
handleDetachedVirtualWindow
()
{
handleCountChanged
(
calls
.
count
)
}
function
windowMustBeClosed
()
{
return
calls
.
count
===
0
&&
!
window
.
virtualWindowVisible
}
function
handleCountChanged
()
{
if
(
windowMustBeClosed
())
{
// Workaround, it's necessary to use a timeout because at last call termination
// a segfault is emit in `QOpenGLContext::functions() const ()`.
Utils
.
setTimeout
(
window
,
0
,
function
()
{
windowMustBeClosed
()
&&
window
.
close
()
})
}
}
linphone-desktop/ui/views/App/Calls/CallsWindow.qml
View file @
a6dfdd1c
...
@@ -55,6 +55,7 @@ Window {
...
@@ -55,6 +55,7 @@ Window {
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
onClosing
:
Logic
.
handleClosing
(
close
)
onClosing
:
Logic
.
handleClosing
(
close
)
onDetachedVirtualWindow
:
Logic
.
handleDetachedVirtualWindow
()
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
...
@@ -123,6 +124,8 @@ Window {
...
@@ -123,6 +124,8 @@ Window {
conferenceModel
:
ConferenceModel
{}
conferenceModel
:
ConferenceModel
{}
model
:
CallsListProxyModel
{}
model
:
CallsListProxyModel
{}
onCountChanged
:
Logic
.
handleCountChanged
(
count
)
}
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
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