mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 11:58:10 +02:00
Update upgrade dialog
- Strip out "<br />"s - Show information for all new versions since current, not just latest - Display scrollbar if content too long to show all at once - "version" / "versions" behind depending on if one or more - Align buttons with heading and text - Darken text so that is more readable
This commit is contained in:
parent
21562c0766
commit
5046f4c1ac
2 changed files with 30 additions and 19 deletions
|
@ -1,5 +1,6 @@
|
||||||
import Hifi 1.0
|
import Hifi 1.0
|
||||||
import QtQuick 2.3
|
import QtQuick 2.3
|
||||||
|
import QtQuick.Controls 1.3
|
||||||
import QtQuick.Controls.Styles 1.3
|
import QtQuick.Controls.Styles 1.3
|
||||||
import QtGraphicalEffects 1.0
|
import QtGraphicalEffects 1.0
|
||||||
import "controls"
|
import "controls"
|
||||||
|
@ -85,33 +86,31 @@ DialogContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Flickable {
|
ScrollView {
|
||||||
id: scrollArea
|
id: scrollArea
|
||||||
anchors {
|
anchors {
|
||||||
top: dialogTitle.bottom
|
top: dialogTitle.bottom
|
||||||
|
topMargin: updateDialog.closeMargin
|
||||||
|
left: dialogTitle.left
|
||||||
}
|
}
|
||||||
contentWidth: updateDialog.inputWidth
|
|
||||||
contentHeight: backgroundRectangle.height - (dialogTitle.height * 2.5)
|
|
||||||
width: updateDialog.inputWidth
|
width: updateDialog.inputWidth
|
||||||
height: backgroundRectangle.height - (dialogTitle.height * 2.5)
|
height: backgroundRectangle.height - (dialogTitle.height * 2.5) - updateDialog.closeMargin
|
||||||
flickableDirection: Flickable.VerticalFlick
|
horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff
|
||||||
clip: true
|
verticalScrollBarPolicy: Qt.ScrollBarAsNeeded
|
||||||
|
|
||||||
TextEdit {
|
Text {
|
||||||
id: releaseNotes
|
id: releaseNotes
|
||||||
wrapMode: TextEdit.Wrap
|
wrapMode: Text.Wrap
|
||||||
width: parent.width
|
width: parent.width - updateDialog.closeMargin
|
||||||
readOnly: true
|
|
||||||
text: updateDialog.releaseNotes
|
text: updateDialog.releaseNotes
|
||||||
font.pixelSize: 14
|
font.pixelSize: 14
|
||||||
color: hifi.colors.text
|
color: "#000000"
|
||||||
anchors {
|
anchors {
|
||||||
left: parent.left
|
left: parent.left
|
||||||
leftMargin: updateDialog.borderWidth
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: downloadButton
|
id: downloadButton
|
||||||
width: updateDialog.buttonWidth
|
width: updateDialog.buttonWidth
|
||||||
|
@ -122,7 +121,7 @@ DialogContainer {
|
||||||
top: scrollArea.bottom
|
top: scrollArea.bottom
|
||||||
topMargin: 10
|
topMargin: 10
|
||||||
right: backgroundRectangle.right
|
right: backgroundRectangle.right
|
||||||
rightMargin: 15
|
rightMargin: updateDialog.borderWidth
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
text: "Upgrade"
|
text: "Upgrade"
|
||||||
|
@ -169,4 +168,4 @@ DialogContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,9 +24,21 @@ UpdateDialog::UpdateDialog(QQuickItem* parent) :
|
||||||
int currentVersion = QCoreApplication::applicationVersion().toInt();
|
int currentVersion = QCoreApplication::applicationVersion().toInt();
|
||||||
int latestVersion = applicationUpdater.data()->getBuildData().lastKey();
|
int latestVersion = applicationUpdater.data()->getBuildData().lastKey();
|
||||||
int versionsBehind = latestVersion - currentVersion;
|
int versionsBehind = latestVersion - currentVersion;
|
||||||
_updateAvailableDetails = "v" + QString::number(latestVersion) + " released on " + applicationUpdater.data()->getBuildData()[latestVersion]["releaseTime"];
|
_updateAvailableDetails = "v" + QString::number(latestVersion) + " released on "
|
||||||
_updateAvailableDetails += "\nYou are " + QString::number(versionsBehind) + " versions behind";
|
+ applicationUpdater.data()->getBuildData()[latestVersion]["releaseTime"];
|
||||||
_releaseNotes = applicationUpdater.data()->getBuildData()[latestVersion]["releaseNotes"];
|
_updateAvailableDetails += "\nYou are " + QString::number(versionsBehind) + " version"
|
||||||
|
+ (versionsBehind > 1 ? "s" : "") + " behind";
|
||||||
|
|
||||||
|
_releaseNotes = "";
|
||||||
|
for (int i = latestVersion; i > currentVersion; i--) {
|
||||||
|
QString releaseNotes = applicationUpdater.data()->getBuildData()[i]["releaseNotes"];
|
||||||
|
releaseNotes.remove("<br />");
|
||||||
|
releaseNotes.remove(QRegExp("^\n"));
|
||||||
|
_releaseNotes += releaseNotes;
|
||||||
|
if (i > currentVersion + 1) {
|
||||||
|
_releaseNotes += "\n\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString& UpdateDialog::updateAvailableDetails() const {
|
const QString& UpdateDialog::updateAvailableDetails() const {
|
||||||
|
|
Loading…
Reference in a new issue