Add a settings to change URL of version check

Add an option to Form to overwrite max width of cell
This commit is contained in:
Julien Wadel 2021-11-03 14:17:30 +01:00
parent a638ce0b77
commit 1d217faf4d
23 changed files with 116 additions and 86 deletions

View file

@ -2526,7 +2526,7 @@ Klicken Sie hier: <a href="%1">%1</a>
<extracomment>&apos;Check for updates&apos; : Label switch for enabling check for updates</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<message>
<source>mipmapLabel</source>
<extracomment>&apos;Enable Mipmap&apos;</extracomment>
<translation type="unfinished"></translation>

View file

@ -2548,8 +2548,8 @@ Click here: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<source>checkForUpdateLabel</source>
<extracomment>&apos;Check for updates&apos; : Label switch for enabling check for updates</extracomment>
<translation>Check for updates</translation>
</message>
<message>
</message>
<message>
<source>mipmapLabel</source>
<extracomment>&apos;Enable Mipmap&apos;</extracomment>
<translation>Enable Mipmap</translation>

View file

@ -2524,9 +2524,9 @@ Haga clic aquí: &lt;a href=&quot;%1&quot;&gt;%1 &lt;/a&gt;
<message>
<source>checkForUpdateLabel</source>
<extracomment>&apos;Check for updates&apos; : Label switch for enabling check for updates</extracomment>
<translation type="unfinished"></translation>
<translation type="unfinished"></translation>
</message>
<message>
<message>
<source>mipmapLabel</source>
<extracomment>&apos;Enable Mipmap&apos;</extracomment>
<translation type="unfinished"></translation>

View file

@ -2526,7 +2526,7 @@ Cliquez ici : &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;Check for updates&apos; : Label switch for enabling check for updates</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<message>
<source>mipmapLabel</source>
<extracomment>&apos;Enable Mipmap&apos;</extracomment>
<translation type="unfinished"></translation>

View file

@ -2516,7 +2516,7 @@ Kattintson ide: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;Check for updates&apos; : Label switch for enabling check for updates</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<message>
<source>mipmapLabel</source>
<extracomment>&apos;Enable Mipmap&apos;</extracomment>
<translation type="unfinished"></translation>

View file

@ -2526,7 +2526,7 @@ Clicca: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;Check for updates&apos; : Label switch for enabling check for updates</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<message>
<source>mipmapLabel</source>
<extracomment>&apos;Enable Mipmap&apos;</extracomment>
<translation type="unfinished"></translation>

View file

@ -2516,7 +2516,7 @@
<extracomment>&apos;Check for updates&apos; : Label switch for enabling check for updates</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<message>
<source>mipmapLabel</source>
<extracomment>&apos;Enable Mipmap&apos;</extracomment>
<translation type="unfinished"></translation>

View file

@ -2536,7 +2536,7 @@ Spustelėkite čia: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;Check for updates&apos; : Label switch for enabling check for updates</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<message>
<source>mipmapLabel</source>
<extracomment>&apos;Enable Mipmap&apos;</extracomment>
<translation type="unfinished"></translation>

View file

@ -2526,7 +2526,7 @@ Clique aqui: &lt;a href=&quot;%1&quot;&gt;%1 &lt;/a&gt;
<extracomment>&apos;Check for updates&apos; : Label switch for enabling check for updates</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<message>
<source>mipmapLabel</source>
<extracomment>&apos;Enable Mipmap&apos;</extracomment>
<translation type="unfinished"></translation>

View file

@ -2536,7 +2536,7 @@
<extracomment>&apos;Check for updates&apos; : Label switch for enabling check for updates</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<message>
<source>mipmapLabel</source>
<extracomment>&apos;Enable Mipmap&apos;</extracomment>
<translation type="unfinished"></translation>

View file

@ -2526,7 +2526,7 @@ Klicka här: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;Check for updates&apos; : Label switch for enabling check for updates</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<message>
<source>mipmapLabel</source>
<extracomment>&apos;Enable Mipmap&apos;</extracomment>
<translation type="unfinished"></translation>

View file

@ -2516,7 +2516,7 @@ Buraya tıklayın: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;Check for updates&apos; : Label switch for enabling check for updates</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<message>
<source>mipmapLabel</source>
<extracomment>&apos;Enable Mipmap&apos;</extracomment>
<translation type="unfinished"></translation>

View file

@ -2536,7 +2536,7 @@
<extracomment>&apos;Check for updates&apos; : Label switch for enabling check for updates</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<message>
<source>mipmapLabel</source>
<extracomment>&apos;Enable Mipmap&apos;</extracomment>
<translation type="unfinished"></translation>

View file

@ -2516,7 +2516,7 @@
<extracomment>&apos;Check for updates&apos; : Label switch for enabling check for updates</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<message>
<source>mipmapLabel</source>
<extracomment>&apos;Enable Mipmap&apos;</extracomment>
<translation type="unfinished"></translation>

View file

@ -1,5 +1,4 @@
[misc]
version_check_url_root=https://linphone.org/releases
log_collection_upload_server_url=https://www.linphone.org:444/lft.php
[sound]

View file

@ -1268,6 +1268,14 @@ void SettingsModel::setCheckForUpdateEnabled(bool enable){
emit checkForUpdateEnabledChanged();
}
QString SettingsModel::getVersionCheckUrl() const{
return Utils::coreStringToAppString(mConfig->getString("misc", "version_check_url_root", Constants::VersionCheckUrl));
}
void SettingsModel::setVersionCheckUrl(const QString& url){
mConfig->setString("misc", "version_check_url_root", Utils::appStringToCoreString(url));
emit versionCheckUrlChanged();
}
// -----------------------------------------------------------------------------
bool SettingsModel::getShowLocalSipAccount()const{

View file

@ -179,6 +179,7 @@ class SettingsModel : public QObject {
Q_PROPERTY(bool exitOnClose READ getExitOnClose WRITE setExitOnClose NOTIFY exitOnCloseChanged)
Q_PROPERTY(bool checkForUpdateEnabled READ isCheckForUpdateEnabled WRITE setCheckForUpdateEnabled NOTIFY checkForUpdateEnabledChanged)
Q_PROPERTY(QString versionCheckUrl READ getVersionCheckUrl WRITE setVersionCheckUrl NOTIFY versionCheckUrlChanged)
Q_PROPERTY(bool showLocalSipAccount READ getShowLocalSipAccount CONSTANT)
Q_PROPERTY(bool showStartChatButton READ getShowStartChatButton CONSTANT)
@ -463,6 +464,10 @@ public:
bool isCheckForUpdateEnabled() const;
void setCheckForUpdateEnabled(bool enable);
QString getVersionCheckUrl() const;
void setVersionCheckUrl(const QString& url);
Q_INVOKABLE bool getShowLocalSipAccount () const;
Q_INVOKABLE bool getShowStartChatButton () const;
Q_INVOKABLE bool getShowStartVideoCallButton () const;
@ -640,6 +645,7 @@ signals:
void mipmapEnabledChanged();
void checkForUpdateEnabledChanged();
void versionCheckUrlChanged();
// Advanced. -----------------------------------------------------------------

View file

@ -98,6 +98,7 @@ constexpr char Constants::DefaultContactParameters[];
constexpr char Constants::DefaultContactParametersOnRemove[];
constexpr int Constants::DefaultExpires;
constexpr char Constants::DownloadUrl[];
constexpr char Constants::VersionCheckUrl[];
constexpr char Constants::PasswordRecoveryUrl[];

View file

@ -55,6 +55,7 @@ public:
static constexpr char DefaultContactParametersOnRemove[] = "message-expires=0";
static constexpr int DefaultExpires = 3600;
static constexpr char DownloadUrl[] = "https://www.linphone.org/technical-corner/linphone";
static constexpr char VersionCheckUrl[] = "https://linphone.org/releases";
static constexpr char PasswordRecoveryUrl[] = "https://subscribe.linphone.org/login";
static constexpr char LinphoneBZip2_exe[] = "http://www.linphone.org/releases/windows/tools/bzip2/bzip2.exe";

View file

@ -1,5 +1,6 @@
import QtQuick 2.7
import Common.Styles 1.0
// =============================================================================
Loader {
@ -11,7 +12,8 @@ Loader {
readonly property int orientation: parent.orientation
default property var _content: null
property int maxWidth: orientation === Qt.Horizontal ? FormHGroupStyle.content.maxWidth : FormVGroupStyle.content.maxWidth
// ---------------------------------------------------------------------------
sourceComponent: orientation === Qt.Horizontal ? hGroup : vGroup
@ -21,19 +23,19 @@ Loader {
Component {
id: hGroup
FormHGroup {
_content: loader._content
label: loader.label
maxWidth: loader.maxWidth
}
}
Component {
id: vGroup
FormVGroup {
_content: loader._content
label: loader.label
maxWidth: loader.maxWidth
}
}
}

View file

@ -10,7 +10,7 @@ RowLayout {
property alias label: label.text
default property var _content: null
property int maxWidth: FormHGroupStyle.content.maxWidth
// ---------------------------------------------------------------------------
spacing: FormHGroupStyle.spacing
@ -63,7 +63,7 @@ RowLayout {
Component.onCompleted: _content.width = Qt.binding(function () {
var contentWidth = content.width
var wishedWidth = FormHGroupStyle.content.maxWidth
var wishedWidth = parent.parent.parent.maxWidth
return contentWidth > wishedWidth ? wishedWidth : contentWidth
})
}

View file

@ -7,58 +7,59 @@ import Common.Styles 1.0
// =============================================================================
ColumnLayout {
property alias label: label.text
default property var _content: null
// ---------------------------------------------------------------------------
spacing: FormVGroupStyle.spacing
width: parent.maxItemWidth
// ---------------------------------------------------------------------------
Text {
id: label
Layout.fillWidth: true
color: FormVGroupStyle.legend.color
elide: Text.ElideRight
font.pointSize: FormVGroupStyle.legend.pointSize
verticalAlignment: Text.AlignVCenter
TooltipArea {
delay: 0
text: parent.text
visible: parent.truncated
}
}
// ---------------------------------------------------------------------------
Item {
readonly property int currentHeight: _content ? _content.height : 0
Layout.fillWidth: true
Layout.preferredHeight: currentHeight
Loader {
active: !!_content
anchors.fill: parent
sourceComponent: Item {
id: content
data: [ _content ]
width: parent.width
Component.onCompleted: _content.width = Qt.binding(function () {
var contentWidth = content.width
var wishedWidth = FormVGroupStyle.content.maxWidth
return contentWidth > wishedWidth ? wishedWidth : contentWidth
})
}
}
}
property alias label: label.text
default property var _content: null
property int maxWidth: FormVGroupStyle.content.maxWidth
// ---------------------------------------------------------------------------
spacing: FormVGroupStyle.spacing
width: parent.maxItemWidth
// ---------------------------------------------------------------------------
Text {
id: label
Layout.fillWidth: true
color: FormVGroupStyle.legend.color
elide: Text.ElideRight
font.pointSize: FormVGroupStyle.legend.pointSize
verticalAlignment: Text.AlignVCenter
TooltipArea {
delay: 0
text: parent.text
visible: parent.truncated
}
}
// ---------------------------------------------------------------------------
Item {
readonly property int currentHeight: _content ? _content.height : 0
Layout.fillWidth: true
Layout.preferredHeight: currentHeight
Loader {
active: !!_content
anchors.fill: parent
sourceComponent: Item {
id: content
data: [ _content ]
width: parent.width
Component.onCompleted: _content.width = Qt.binding(function () {
var contentWidth = content.width
var wishedWidth = parent.parent.parent.maxWidth
return contentWidth > wishedWidth ? wishedWidth : contentWidth
})
}
}
}
}

View file

@ -204,16 +204,6 @@ TabContainer {
onClicked: App.autoStart = !checked
}
}
FormGroup {
//: 'Check for updates' : Label switch for enabling check for updates
label: qsTr('checkForUpdateLabel')
Switch {
checked: SettingsModel.checkForUpdateEnabled
onClicked: SettingsModel.checkForUpdateEnabled = !checked
}
}
}
FormLine {
FormGroup {
@ -233,6 +223,28 @@ TabContainer {
}
}
}
FormLine {
FormGroup {
//: 'Check for updates' : Label switch for enabling check for updates
label: qsTr('checkForUpdateLabel')
maxWidth: 150
width: 150
Switch {
checked: SettingsModel.checkForUpdateEnabled
onClicked: SettingsModel.checkForUpdateEnabled = !checked
}
}
FormGroup {
maxWidth: parent.width - 200
width: parent.width - 200
TextField {
text: SettingsModel.versionCheckUrl
onEditingFinished: SettingsModel.versionCheckUrl = text
}
}
}
}
}
}