mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 03:18:07 +00:00
App version & core user-agent
This commit is contained in:
parent
d8efaf1ac9
commit
213ba75585
17 changed files with 175 additions and 66 deletions
|
|
@ -59,6 +59,24 @@ set(LINPHONE_MICRO_VERSION)
|
|||
set(LINPHONE_BRANCH_VERSION)
|
||||
bc_parse_full_version(${LINPHONEAPP_VERSION} LINPHONE_MAJOR_VERSION LINPHONE_MINOR_VERSION LINPHONE_MICRO_VERSION LINPHONE_BRANCH_VERSION)
|
||||
|
||||
set(LINPHONEAPP_SHORT_VERSION "${LINPHONE_MAJOR_VERSION}.${LINPHONE_MINOR_VERSION}.${LINPHONE_MICRO_VERSION}")
|
||||
|
||||
set(GIT_BRANCH_NAME)
|
||||
execute_process(
|
||||
COMMAND git name-rev --name-only HEAD
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_BRANCH_NAME
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
set(LINPHONESDK_VERSION)
|
||||
execute_process(
|
||||
COMMAND git describe
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/external/linphone-sdk
|
||||
OUTPUT_VARIABLE LINPHONESDK_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
include(application_info.cmake)
|
||||
string(TIMESTAMP CURRENT_YEAR "%Y")
|
||||
if(NOT APPLICATION_START_LICENCE OR "${CURRENT_YEAR}" STREQUAL "${APPLICATION_START_LICENCE}")
|
||||
|
|
|
|||
|
|
@ -36,4 +36,6 @@
|
|||
#cmakedefine ENABLE_SCREENSHARING "${ENABLE_SCREENSHARING}"
|
||||
#cmakedefine QTKEYCHAIN_TARGET_NAME ${QTKEYCHAIN_TARGET_NAME}
|
||||
#cmakedefine PDF_ENABLED
|
||||
|
||||
#cmakedefine LINPHONEAPP_SHORT_VERSION "${LINPHONEAPP_SHORT_VERSION}"
|
||||
#cmakedefine GIT_BRANCH_NAME "${GIT_BRANCH_NAME}"
|
||||
#cmakedefine LINPHONESDK_VERSION "${LINPHONESDK_VERSION}"
|
||||
|
|
|
|||
|
|
@ -1069,3 +1069,31 @@ void App::setLocale(QString configLocale) {
|
|||
QLocale App::getLocale() {
|
||||
return mLocale;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Version infos.
|
||||
//-----------------------------------------------------------
|
||||
|
||||
QString App::getShortApplicationVersion() {
|
||||
#ifdef LINPHONEAPP_SHORT_VERSION
|
||||
return QStringLiteral(LINPHONEAPP_SHORT_VERSION);
|
||||
#else
|
||||
return tr("inconnue");
|
||||
#endif
|
||||
}
|
||||
|
||||
QString App::getGitBranchName() {
|
||||
#ifdef GIT_BRANCH_NAME
|
||||
return QStringLiteral(GIT_BRANCH_NAME);
|
||||
#else
|
||||
return tr("inconnue");
|
||||
#endif
|
||||
}
|
||||
|
||||
QString App::getSdkVersion() {
|
||||
#ifdef LINPHONESDK_VERSION
|
||||
return QStringLiteral(LINPHONESDK_VERSION);
|
||||
#else
|
||||
return tr("inconnue");
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,10 @@ class App : public SingleApplication, public AbstractObject {
|
|||
Q_PROPERTY(bool coreStarted READ getCoreStarted WRITE setCoreStarted NOTIFY coreStartedChanged)
|
||||
Q_PROPERTY(AccountList *accounts READ getAccounts NOTIFY accountsChanged)
|
||||
Q_PROPERTY(CallList *calls READ getCalls NOTIFY callsChanged)
|
||||
Q_PROPERTY(QString shortApplicationVersion READ getShortApplicationVersion CONSTANT)
|
||||
Q_PROPERTY(QString gitBranchName READ getGitBranchName CONSTANT)
|
||||
Q_PROPERTY(QString sdkVersion READ getSdkVersion CONSTANT)
|
||||
|
||||
public:
|
||||
App(int &argc, char *argv[]);
|
||||
~App();
|
||||
|
|
@ -137,6 +141,10 @@ public:
|
|||
|
||||
void onExitOnCloseChanged(); // Can be used for UniqueConnection
|
||||
|
||||
QString getShortApplicationVersion();
|
||||
QString getGitBranchName();
|
||||
QString getSdkVersion();
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
Q_INVOKABLE void exportDesktopFile();
|
||||
|
||||
|
|
|
|||
1
Linphone/data/image/app-window.svg
Normal file
1
Linphone/data/image/app-window.svg
Normal file
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm0,160H40V56H216V200ZM80,84A12,12,0,1,1,68,72,12,12,0,0,1,80,84Zm40,0a12,12,0,1,1-12-12A12,12,0,0,1,120,84Z"></path></svg>
|
||||
|
After Width: | Height: | Size: 326 B |
3
Linphone/data/image/resource-package.svg
Normal file
3
Linphone/data/image/resource-package.svg
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="#4e6074" viewBox="0 0 256 256">
|
||||
<path d="M223.68,66.15 L135.68,18a15.88,15.88 0,0 0,-15.36 0l-88,48.17a16,16 0,0 0,-8.32 14v95.64a16,16 0,0 0,8.32 14l88,48.17a15.88,15.88 0,0 0,15.36 0l88,-48.17a16,16 0,0 0,8.32 -14L232,80.18A16,16 0,0 0,223.68 66.15ZM128,32l80.34,44 -29.77,16.3 -80.35,-44ZM128,120 L47.66,76l33.9,-18.56 80.34,44ZM40,90l80,43.78v85.79L40,175.82ZM216,175.78h0l-80,43.79L136,133.82l32,-17.51L168,152a8,8 0,0 0,16 0L184,107.55L216,90v85.77Z" fill="#4e6074"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 550 B |
|
|
@ -31,6 +31,7 @@
|
|||
#include "core/App.hpp"
|
||||
#include "core/notifier/Notifier.hpp"
|
||||
#include "core/path/Paths.hpp"
|
||||
#include "model/tool/ToolModel.hpp"
|
||||
#include "tool/Utils.hpp"
|
||||
|
||||
// =============================================================================
|
||||
|
|
@ -90,6 +91,8 @@ void CoreModel::start() {
|
|||
}
|
||||
mCore->enableVideoPreview(false); // SDK doesn't write the state in configuration if not ready.
|
||||
config->setInt("video", "show_local", 0); // So : write ourself to turn off camera before starting the core.
|
||||
QString userAgent = ToolModel::computeUserAgent(config);
|
||||
mCore->setUserAgent(Utils::appStringToCoreString(userAgent), LINPHONESDK_VERSION);
|
||||
mCore->start();
|
||||
setPathAfterStart();
|
||||
mCore->enableFriendListSubscription(true);
|
||||
|
|
|
|||
|
|
@ -545,6 +545,15 @@ void SettingsModel::setCarddavListForNewFriends(std::string name) {
|
|||
}
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// Device name.
|
||||
// =============================================================================
|
||||
|
||||
QString SettingsModel::getDeviceName(const std::shared_ptr<linphone::Config> &config) {
|
||||
return Utils::coreStringToAppString(
|
||||
config->getString(UiSection, "device_name", Utils::appStringToCoreString(QSysInfo::machineHostName())));
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// Ui.
|
||||
// =============================================================================
|
||||
|
|
|
|||
|
|
@ -132,6 +132,8 @@ public:
|
|||
static const std::shared_ptr<linphone::FriendList> getCarddavListForNewFriends();
|
||||
static void setCarddavListForNewFriends(std::string listName);
|
||||
|
||||
static QString getDeviceName(const std::shared_ptr<linphone::Config> &config);
|
||||
|
||||
// UI
|
||||
DECLARE_GETSET(bool, disableChatFeature, DisableChatFeature)
|
||||
DECLARE_GETSET(bool, disableMeetingsFeature, DisableMeetingsFeature)
|
||||
|
|
|
|||
|
|
@ -358,3 +358,13 @@ QVariantMap ToolModel::createVariant(const std::shared_ptr<const linphone::Audio
|
|||
: tr("Unknown device"));
|
||||
return map;
|
||||
}
|
||||
|
||||
// User agent
|
||||
|
||||
QString ToolModel::computeUserAgent(const std::shared_ptr<linphone::Config> &config) {
|
||||
return QStringLiteral("%1 (%2) %3 Qt/%4 LinphoneSDK")
|
||||
.arg(Utils::getApplicationProduct())
|
||||
.arg(SettingsModel::getDeviceName(config).replace('\\', "\\\\").replace('(', "\\(").replace(')', "\\)"))
|
||||
.arg(Utils::getOsProduct())
|
||||
.arg(qVersion());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,6 +70,9 @@ public:
|
|||
|
||||
static QVariantMap createVariant(const std::shared_ptr<const linphone::AudioDevice> &device);
|
||||
|
||||
static QString getOsProduct();
|
||||
static QString computeUserAgent(const std::shared_ptr<linphone::Config> &config);
|
||||
|
||||
private:
|
||||
DECLARE_ABSTRACT_OBJECT
|
||||
};
|
||||
|
|
|
|||
|
|
@ -505,18 +505,6 @@ QString Utils::getOsProduct() {
|
|||
return product + "/" + version;
|
||||
}
|
||||
|
||||
QString Utils::computeUserAgent() {
|
||||
// Placeholder
|
||||
return "Linphone 6.0";
|
||||
/*
|
||||
const std::shared_ptr<linphone::Config> &config
|
||||
return QStringLiteral("%1 (%2) %3 Qt/%4 LinphoneSDK")
|
||||
.arg(Utils::getApplicationProduct())
|
||||
.arg(SettingsModel::getDeviceName(config).replace('\\', "\\\\").replace('(', "\\(").replace(')', "\\)"))
|
||||
.arg(Utils::getOsProduct())
|
||||
.arg(qVersion());
|
||||
*/
|
||||
}
|
||||
QString Utils::getCountryName(const QLocale::Territory &p_country) {
|
||||
QString countryName;
|
||||
switch (p_country) {
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ public:
|
|||
|
||||
static QString getApplicationProduct();
|
||||
static QString getOsProduct();
|
||||
static QString computeUserAgent();
|
||||
|
||||
static QList<QSharedPointer<DownloadablePayloadTypeCore>> getDownloadableVideoPayloadTypes();
|
||||
static void checkDownloadedCodecsUpdates();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,38 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* config.h.cmake
|
||||
* Copyright (C) 2017-2024 Belledonne Communications, Grenoble France
|
||||
*
|
||||
********************************************************************************
|
||||
*
|
||||
* 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 2
|
||||
* 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, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
#cmakedefine APPLICATION_DESCRIPTION "${APPLICATION_DESCRIPTION}"
|
||||
#cmakedefine APPLICATION_ID "${APPLICATION_ID}"
|
||||
#cmakedefine APPLICATION_NAME "${APPLICATION_NAME}"
|
||||
#cmakedefine APPLICATION_VENDOR "${APPLICATION_VENDOR}"
|
||||
#cmakedefine APPLICATION_URL "${APPLICATION_URL}"
|
||||
#cmakedefine APPLICATION_LICENCE "${APPLICATION_LICENCE}"
|
||||
#cmakedefine APPLICATION_LICENCE_URL "${APPLICATION_LICENCE_URL}"
|
||||
#cmakedefine APPLICATION_SEMVER "${APPLICATION_SEMVER}"
|
||||
#cmakedefine COPYRIGHT_RANGE_DATE "${COPYRIGHT_RANGE_DATE}"
|
||||
#cmakedefine ENABLE_UPDATE_CHECK 1
|
||||
#cmakedefine EXECUTABLE_NAME "${EXECUTABLE_NAME}"
|
||||
#cmakedefine MSPLUGINS_DIR "${MSPLUGINS_DIR}"
|
||||
#cmakedefine ENABLE_APP_WEBVIEW "${ENABLE_APP_WEBVIEW}"
|
||||
#cmakedefine QTKEYCHAIN_TARGET_NAME ${QTKEYCHAIN_TARGET_NAME}
|
||||
#cmakedefine PDF_ENABLED
|
||||
|
||||
|
|
@ -16,7 +16,12 @@ AbstractSettingsLayout {
|
|||
{
|
||||
title: "",
|
||||
subTitle: "",
|
||||
contentComponent: content
|
||||
contentComponent: versionContent
|
||||
},
|
||||
{
|
||||
title: "",
|
||||
subTitle: "",
|
||||
contentComponent: logContent
|
||||
}
|
||||
]
|
||||
|
||||
|
|
@ -53,9 +58,9 @@ AbstractSettingsLayout {
|
|||
}
|
||||
|
||||
Component {
|
||||
id: content
|
||||
id: logContent
|
||||
ColumnLayout {
|
||||
spacing: 40 * DefaultStyle.dp
|
||||
spacing: 20 * DefaultStyle.dp
|
||||
SwitchSetting {
|
||||
titleText: qsTr("Activer les traces de débogage")
|
||||
propertyName: "logsEnabled"
|
||||
|
|
@ -66,18 +71,83 @@ AbstractSettingsLayout {
|
|||
propertyName: "fullLogsEnabled"
|
||||
propertyOwner: SettingsCpp
|
||||
}
|
||||
MediumButton {
|
||||
text: qsTr("Supprimer les traces")
|
||||
onClicked: {
|
||||
deleteLogs.open()
|
||||
RowLayout {
|
||||
spacing: 20 * DefaultStyle.dp
|
||||
Layout.alignment: Qt.AlignRight
|
||||
MediumButton {
|
||||
text: qsTr("Supprimer les traces")
|
||||
onClicked: {
|
||||
deleteLogs.open()
|
||||
}
|
||||
}
|
||||
MediumButton {
|
||||
text: qsTr("Partager les traces")
|
||||
enabled: SettingsCpp.logsEnabled || SettingsCpp.fullLogsEnabled
|
||||
onClicked: {
|
||||
UtilsCpp.getMainWindow().showLoadingPopup(qsTr("Téléversement des traces en cours ..."))
|
||||
SettingsCpp.sendLogs()
|
||||
}
|
||||
}
|
||||
}
|
||||
MediumButton {
|
||||
text: qsTr("Partager les traces")
|
||||
enabled: SettingsCpp.logsEnabled || SettingsCpp.fullLogsEnabled
|
||||
onClicked: {
|
||||
UtilsCpp.getMainWindow().showLoadingPopup(qsTr("Téléversement des traces en cours ..."))
|
||||
SettingsCpp.sendLogs()
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: versionContent
|
||||
ColumnLayout {
|
||||
spacing: 20 * DefaultStyle.dp
|
||||
RowLayout {
|
||||
EffectImage {
|
||||
imageSource: AppIcons.appWindow
|
||||
colorizationColor: DefaultStyle.main1_500_main
|
||||
Layout.preferredWidth: 24 * DefaultStyle.dp
|
||||
Layout.preferredHeight: 24 * DefaultStyle.dp
|
||||
imageWidth: 24 * DefaultStyle.dp
|
||||
imageHeight: 24 * DefaultStyle.dp
|
||||
Layout.alignment: Qt.AlignTop
|
||||
}
|
||||
ColumnLayout {
|
||||
Text {
|
||||
text: qsTr("Version de l'application")
|
||||
font: Typography.p2l
|
||||
wrapMode: Text.WordWrap
|
||||
color: DefaultStyle.main2_600
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Text {
|
||||
text: AppCpp.applicationVersion + ' ('+ AppCpp.gitBranchName + ')'
|
||||
font: Typography.p1
|
||||
wrapMode: Text.WordWrap
|
||||
color: DefaultStyle.main2_600
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
}
|
||||
RowLayout {
|
||||
EffectImage {
|
||||
imageSource: AppIcons.resourcePackage
|
||||
colorizationColor: DefaultStyle.main1_500_main
|
||||
Layout.preferredWidth: 24 * DefaultStyle.dp
|
||||
Layout.preferredHeight: 24 * DefaultStyle.dp
|
||||
imageWidth: 24 * DefaultStyle.dp
|
||||
imageHeight: 24 * DefaultStyle.dp
|
||||
Layout.alignment: Qt.AlignTop
|
||||
}
|
||||
ColumnLayout {
|
||||
Text {
|
||||
text: qsTr("Version du SDK")
|
||||
font: Typography.p2l
|
||||
wrapMode: Text.WordWrap
|
||||
color: DefaultStyle.main2_600
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Text {
|
||||
text: AppCpp.sdkVersion
|
||||
font: Typography.p1
|
||||
wrapMode: Text.WordWrap
|
||||
color: DefaultStyle.main2_600
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ AbstractMainPage {
|
|||
Layout.fillWidth: true
|
||||
iconSource: AppIcons.info
|
||||
title: qsTr("Version")
|
||||
subTitle: qsTr("1.0")
|
||||
subTitle: AppCpp.shortApplicationVersion
|
||||
onClicked: {}
|
||||
}
|
||||
HelpIconLabelButton {
|
||||
|
|
|
|||
|
|
@ -122,4 +122,6 @@ QtObject {
|
|||
property string bellRinger: "image://internal/bell-ringer.svg"
|
||||
property string voicemail: "image://internal/voicemail.svg"
|
||||
property string power: "image://internal/power.svg"
|
||||
property string resourcePackage: "image://internal/resource-package.svg"
|
||||
property string appWindow: "image://internal/app-window.svg"
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue