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
c1e85765
Commit
c1e85765
authored
Jun 05, 2017
by
Ghislain MARY
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle version update check.
parent
e81c7a7e
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
169 additions
and
0 deletions
+169
-0
linphoneqt.cmake
cmake_builder/linphoneqt.cmake
+1
-0
CMakeLists.txt
linphone-desktop/CMakeLists.txt
+2
-0
en.ts
linphone-desktop/assets/languages/en.ts
+7
-0
fr.ts
linphone-desktop/assets/languages/fr.ts
+7
-0
linphonerc-factory
linphone-desktop/assets/linphonerc-factory
+3
-0
config.h.cmake
linphone-desktop/config.h.cmake
+1
-0
resources.qrc
linphone-desktop/resources.qrc
+2
-0
App.cpp
linphone-desktop/src/app/App.cpp
+4
-0
App.hpp
linphone-desktop/src/app/App.hpp
+1
-0
CoreHandlers.cpp
linphone-desktop/src/components/core/CoreHandlers.cpp
+25
-0
CoreHandlers.hpp
linphone-desktop/src/components/core/CoreHandlers.hpp
+7
-0
Notifier.cpp
linphone-desktop/src/components/notifier/Notifier.cpp
+16
-0
Notifier.hpp
linphone-desktop/src/components/notifier/Notifier.hpp
+2
-0
NotificationNewVersionAvailable.qml
...inphone/Notifications/NotificationNewVersionAvailable.qml
+68
-0
NotificationNewVersionAvailableStyle.qml
...es/Notifications/NotificationNewVersionAvailableStyle.qml
+22
-0
qmldir
linphone-desktop/ui/modules/Linphone/Styles/qmldir
+1
-0
No files found.
cmake_builder/linphoneqt.cmake
View file @
c1e85765
...
...
@@ -24,6 +24,7 @@ lcb_external_source_paths("../linphone-desktop")
lcb_dependencies
(
"linphone"
"ms2plugins"
)
lcb_groupable
(
YES
)
lcb_cmake_options
(
"-DENABLE_UPDATE_CHECK=
${
ENABLE_UPDATE_CHECK
}
"
)
# Add config step for packaging
set
(
LINPHONE_BUILDER_ADDITIONAL_CONFIG_STEPS
"
${
CMAKE_CURRENT_LIST_DIR
}
/additional_steps.cmake"
)
linphone-desktop/CMakeLists.txt
View file @
c1e85765
...
...
@@ -29,6 +29,8 @@ set(CMAKE_CXX_STANDARD 11)
set
(
ASSETS_DIR assets
)
option
(
ENABLE_UPDATE_CHECK
"Enable update check."
NO
)
include
(
GNUInstallDirs
)
include
(
CheckCXXCompilerFlag
)
...
...
linphone-desktop/assets/languages/en.ts
View file @
c1e85765
...
...
@@ -887,6 +887,13 @@ your friend's SIP address or username.</translation>
<
translation
>
Play
me
!<
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
Notifier
<
/name
>
<
message
>
<
source
>
newVersionAvailable
<
/source
>
<
translation
>
A
new
version
(
%
1
)
of
Linphone
is
available
!<
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
OutgoingMessage
<
/name
>
<
message
>
...
...
linphone-desktop/assets/languages/fr.ts
View file @
c1e85765
...
...
@@ -886,6 +886,13 @@ un chat ou ajouter un contact.</translation>
<
translation
>
Joue
-
moi
!<
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
Notifier
<
/name
>
<
message
>
<
source
>
newVersionAvailable
<
/source
>
<
translation
>
Une
nouvelle
version
(
%
1
)
de
Linphone
est
disponible
!<
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
OutgoingMessage
<
/name
>
<
message
>
...
...
linphone-desktop/assets/linphonerc-factory
View file @
c1e85765
[misc]
version_check_url_root=https://linphone.org/releases
[sound]
ec_filter=MSWebRTCAEC
linphone-desktop/config.h.cmake
View file @
c1e85765
...
...
@@ -21,3 +21,4 @@
*******************************************************************************/
#cmakedefine MSPLUGINS_DIR "${MSPLUGINS_DIR}"
#cmakedefine ENABLE_UPDATE_CHECK 1
\ No newline at end of file
linphone-desktop/resources.qrc
View file @
c1e85765
...
...
@@ -324,6 +324,7 @@
<file>
ui/modules/Linphone/Contact/MessagesCounter.qml
</file>
<file>
ui/modules/Linphone/Menus/SipAddressesMenu.qml
</file>
<file>
ui/modules/Linphone/Notifications/Notification.qml
</file>
<file>
ui/modules/Linphone/Notifications/NotificationNewVersionAvailable.qml
</file>
<file>
ui/modules/Linphone/Notifications/NotificationReceivedCall.qml
</file>
<file>
ui/modules/Linphone/Notifications/NotificationReceivedFileMessage.qml
</file>
<file>
ui/modules/Linphone/Notifications/NotificationReceivedMessage.qml
</file>
...
...
@@ -344,6 +345,7 @@
<file>
ui/modules/Linphone/Styles/Contact/ContactStyle.qml
</file>
<file>
ui/modules/Linphone/Styles/Contact/MessagesCounterStyle.qml
</file>
<file>
ui/modules/Linphone/Styles/Menus/SipAddressesMenuStyle.qml
</file>
<file>
ui/modules/Linphone/Styles/Notifications/NotificationNewVersionAvailableStyle.qml
</file>
<file>
ui/modules/Linphone/Styles/Notifications/NotificationReceivedCallStyle.qml
</file>
<file>
ui/modules/Linphone/Styles/Notifications/NotificationReceivedFileMessageStyle.qml
</file>
<file>
ui/modules/Linphone/Styles/Notifications/NotificationReceivedMessageStyle.qml
</file>
...
...
linphone-desktop/src/app/App.cpp
View file @
c1e85765
...
...
@@ -293,6 +293,10 @@ void App::smartShowWindow (QQuickWindow *window) {
window
->
requestActivate
();
}
void
App
::
checkForUpdate
()
{
CoreManager
::
getInstance
()
->
getCore
()
->
checkForUpdate
(
LINPHONE_QT_GIT_VERSION
);
}
QString
App
::
convertUrlToLocalPath
(
const
QUrl
&
url
)
{
return
QDir
::
toNativeSeparators
(
url
.
toLocalFile
());
}
...
...
linphone-desktop/src/app/App.hpp
View file @
c1e85765
...
...
@@ -77,6 +77,7 @@ public:
Q_INVOKABLE
QQuickWindow
*
getSettingsWindow
();
Q_INVOKABLE
static
void
smartShowWindow
(
QQuickWindow
*
window
);
Q_INVOKABLE
static
void
checkForUpdate
();
Q_INVOKABLE
static
QString
convertUrlToLocalPath
(
const
QUrl
&
url
);
public
slots
:
...
...
linphone-desktop/src/components/core/CoreHandlers.cpp
View file @
c1e85765
...
...
@@ -31,6 +31,11 @@
#include "CoreHandlers.hpp"
#include "config.h"
#define VERSION_UPDATE_CHECK_OBJECT_NAME "version-update-check-timer"
#define VERSION_UPDATE_CHECK_INTERVAL 86400000
/* 24 hours in milliseconds */
using
namespace
std
;
// =============================================================================
...
...
@@ -83,6 +88,15 @@ void CoreHandlers::notifyCoreStarted () {
[
this
]()
{
qInfo
()
<<
QStringLiteral
(
"Core started."
);
emit
coreStarted
();
#ifdef ENABLE_UPDATE_CHECK
QTimer
*
timer
=
new
QTimer
(
this
);
timer
->
setInterval
(
VERSION_UPDATE_CHECK_INTERVAL
);
timer
->
setObjectName
(
VERSION_UPDATE_CHECK_OBJECT_NAME
);
QObject
::
connect
(
timer
,
&
QTimer
::
timeout
,
this
,
&
App
::
checkForUpdate
);
timer
->
start
();
App
::
checkForUpdate
();
#endif
}
);
}
...
...
@@ -217,3 +231,14 @@ void CoreHandlers::onTransferStateChanged (
break
;
}
}
void
CoreHandlers
::
onVersionUpdateCheckResultReceived
(
const
shared_ptr
<
linphone
::
Core
>
&
,
linphone
::
VersionUpdateCheckResult
result
,
const
string
&
version
,
const
string
&
url
)
{
if
(
result
==
linphone
::
VersionUpdateCheckResultNewVersionAvailable
)
{
App
::
getInstance
()
->
getNotifier
()
->
notifyNewVersionAvailable
(
version
,
url
);
}
}
\ No newline at end of file
linphone-desktop/src/components/core/CoreHandlers.hpp
View file @
c1e85765
...
...
@@ -115,6 +115,13 @@ private:
linphone
::
CallState
state
)
override
;
void
onVersionUpdateCheckResultReceived
(
const
std
::
shared_ptr
<
linphone
::
Core
>
&
,
linphone
::
VersionUpdateCheckResult
result
,
const
std
::
string
&
version
,
const
std
::
string
&
url
)
override
;
// ---------------------------------------------------------------------------
bool
mCoreCreated
=
false
;
...
...
linphone-desktop/src/components/notifier/Notifier.cpp
View file @
c1e85765
...
...
@@ -54,6 +54,7 @@
#define QML_NOTIFICATION_PATH_RECEIVED_MESSAGE "qrc:/ui/modules/Linphone/Notifications/NotificationReceivedMessage.qml"
#define QML_NOTIFICATION_PATH_RECEIVED_FILE_MESSAGE "qrc:/ui/modules/Linphone/Notifications/NotificationReceivedFileMessage.qml"
#define QML_NOTIFICATION_PATH_RECEIVED_CALL "qrc:/ui/modules/Linphone/Notifications/NotificationReceivedCall.qml"
#define QML_NOTIFICATION_PATH_NEW_VERSION_AVAILABLE "qrc:/ui/modules/Linphone/Notifications/NotificationNewVersionAvailable.qml"
// -----------------------------------------------------------------------------
// Timeouts.
...
...
@@ -62,6 +63,7 @@
#define NOTIFICATION_TIMEOUT_RECEIVED_MESSAGE 10000
#define NOTIFICATION_TIMEOUT_RECEIVED_FILE_MESSAGE 10000
#define NOTIFICATION_TIMEOUT_RECEIVED_CALL 30000
#define NOTIFICATION_TIMEOUT_NEW_VERSION_AVAILABLE 30000
// -----------------------------------------------------------------------------
// Arbitrary hardcoded values.
...
...
@@ -106,6 +108,7 @@ Notifier::Notifier (QObject *parent) :
mComponents
[
Notifier
::
MessageReceived
]
=
new
QQmlComponent
(
engine
,
QUrl
(
QML_NOTIFICATION_PATH_RECEIVED_MESSAGE
));
mComponents
[
Notifier
::
FileMessageReceived
]
=
new
QQmlComponent
(
engine
,
QUrl
(
QML_NOTIFICATION_PATH_RECEIVED_FILE_MESSAGE
));
mComponents
[
Notifier
::
CallReceived
]
=
new
QQmlComponent
(
engine
,
QUrl
(
QML_NOTIFICATION_PATH_RECEIVED_CALL
));
mComponents
[
Notifier
::
NewVersionAvailable
]
=
new
QQmlComponent
(
engine
,
QUrl
(
QML_NOTIFICATION_PATH_NEW_VERSION_AVAILABLE
));
// Check errors.
for
(
int
i
=
0
;
i
<
Notifier
::
MaxNbTypes
;
++
i
)
{
...
...
@@ -271,3 +274,16 @@ void Notifier::notifyReceivedCall (const shared_ptr<linphone::Call> &call) {
::
setProperty
(
*
notification
,
NOTIFICATION_PROPERTY_DATA
,
map
);
showNotification
(
notification
,
NOTIFICATION_TIMEOUT_RECEIVED_CALL
);
}
void
Notifier
::
notifyNewVersionAvailable
(
const
std
::
string
&
version
,
const
std
::
string
&
url
)
{
QObject
*
notification
=
createNotification
(
Notifier
::
NewVersionAvailable
);
if
(
!
notification
)
return
;
QVariantMap
map
;
map
[
"message"
]
=
tr
(
"newVersionAvailable"
).
arg
(
::
Utils
::
coreStringToAppString
(
version
));
map
[
"url"
]
=
::
Utils
::
coreStringToAppString
(
url
);
::
setProperty
(
*
notification
,
NOTIFICATION_PROPERTY_DATA
,
map
);
showNotification
(
notification
,
NOTIFICATION_TIMEOUT_NEW_VERSION_AVAILABLE
);
}
\ No newline at end of file
linphone-desktop/src/components/notifier/Notifier.hpp
View file @
c1e85765
...
...
@@ -42,12 +42,14 @@ public:
MessageReceived
,
FileMessageReceived
,
CallReceived
,
NewVersionAvailable
,
MaxNbTypes
};
void
notifyReceivedMessage
(
const
std
::
shared_ptr
<
linphone
::
ChatMessage
>
&
message
);
void
notifyReceivedFileMessage
(
const
std
::
shared_ptr
<
linphone
::
ChatMessage
>
&
message
);
void
notifyReceivedCall
(
const
std
::
shared_ptr
<
linphone
::
Call
>
&
call
);
void
notifyNewVersionAvailable
(
const
std
::
string
&
version
,
const
std
::
string
&
url
);
public
slots
:
void
deleteNotification
(
QVariant
notification
);
...
...
linphone-desktop/ui/modules/Linphone/Notifications/NotificationNewVersionAvailable.qml
0 → 100644
View file @
c1e85765
import
QtQuick
2.7
import
QtQuick
.
Layouts
1.3
import
Common
1.0
import
Linphone
1.0
import
Linphone
.
Styles
1.0
import
Utils
1.0
// =============================================================================
Notification
{
id
:
notification
// ---------------------------------------------------------------------------
Rectangle
{
color
:
NotificationNewVersionAvailableStyle
.
color
height
:
NotificationNewVersionAvailableStyle
.
height
width
:
NotificationNewVersionAvailableStyle
.
width
Icon
{
anchors
{
left
:
parent
.
left
top
:
parent
.
top
}
icon
:
'
file_sign
'
iconSize
:
NotificationNewVersionAvailableStyle
.
iconSize
}
Loader
{
active
:
notificationData
.
url
.
length
>
0
anchors
{
fill
:
parent
leftMargin
:
NotificationNewVersionAvailableStyle
.
leftMargin
rightMargin
:
NotificationNewVersionAvailableStyle
.
rightMargin
}
sourceComponent
:
RowLayout
{
anchors.fill
:
parent
spacing
:
NotificationNewVersionAvailableStyle
.
spacing
Text
{
Layout.fillWidth
:
true
Layout.fillHeight
:
true
topPadding
:
NotificationNewVersionAvailableStyle
.
message
.
topPadding
color
:
NotificationNewVersionAvailableStyle
.
message
.
color
elide
:
Text
.
ElideRight
wrapMode
:
Text
.
Wrap
font.pointSize
:
NotificationNewVersionAvailableStyle
.
message
.
fontSize
text
:
notificationData
.
message
}
}
MouseArea
{
anchors.fill
:
parent
cursorShape
:
containsMouse
?
Qt
.
PointingHandCursor
:
Qt
.
ArrowCursor
hoverEnabled
:
true
onClicked
:
notification
.
_close
(
function
()
{
Qt
.
openUrlExternally
(
notificationData
.
url
)
})
}
}
}
}
linphone-desktop/ui/modules/Linphone/Styles/Notifications/NotificationNewVersionAvailableStyle.qml
0 → 100644
View file @
c1e85765
pragma
Singleton
import
QtQuick
2.7
import
Common
1.0
// =============================================================================
QtObject
{
property
color
color
:
Colors
.
k
property
int
height
:
55
property
int
iconSize
:
40
property
int
leftMargin
:
25
property
int
rightMargin
:
15
property
int
spacing
:
10
property
int
width
:
300
property
QtObject
message
:
QtObject
{
property
color
color
:
Colors
.
h
property
int
fontSize
:
10
property
real
topPadding
:
10
}
}
linphone-desktop/ui/modules/Linphone/Styles/qmldir
View file @
c1e85765
...
...
@@ -25,6 +25,7 @@ singleton MessagesCounterStyle 1.0 Contact/MessagesCounterStyle.
singleton SipAddressesMenuStyle 1.0 Menus/SipAddressesMenuStyle.qml
singleton NotificationNewVersionAvailableStyle 1.0 Notifications/NotificationNewVersionAvailableStyle.qml
singleton NotificationReceivedCallStyle 1.0 Notifications/NotificationReceivedCallStyle.qml
singleton NotificationReceivedMessageStyle 1.0 Notifications/NotificationReceivedMessageStyle.qml
singleton NotificationReceivedFileMessageStyle 1.0 Notifications/NotificationReceivedFileMessageStyle.qml
...
...
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