mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 19:04:32 +02:00
Auto Update checkpoint - dialog is QML and populated with real data
This commit is contained in:
parent
83b7054138
commit
bd85ce1312
5 changed files with 123 additions and 86 deletions
|
@ -4,69 +4,108 @@ import QtQuick.Controls.Styles 1.3
|
|||
import "controls"
|
||||
import "styles"
|
||||
|
||||
UpdateDialog {
|
||||
DialogContainer {
|
||||
HifiConstants { id: hifi }
|
||||
id: updateDialog
|
||||
id: root
|
||||
objectName: "UpdateDialog"
|
||||
implicitWidth: backgroundImage.width
|
||||
implicitHeight: backgroundImage.height + releaseNotes.height
|
||||
implicitWidth: updateDialog.width
|
||||
implicitHeight: updateDialog.height
|
||||
x: parent ? parent.width / 2 - width / 2 : 0
|
||||
y: parent ? parent.height / 2 - height / 2 : 0
|
||||
|
||||
Image {
|
||||
id: backgroundImage
|
||||
source: "../images/update-available.svg"
|
||||
width: 576
|
||||
height: 80
|
||||
smooth: true
|
||||
UpdateDialog {
|
||||
id: updateDialog
|
||||
|
||||
Text {
|
||||
id: updateAvailableTitle
|
||||
text: "Update available"
|
||||
color: "#000000"
|
||||
x: 90
|
||||
y: 17
|
||||
}
|
||||
implicitWidth: backgroundRectangle.width
|
||||
implicitHeight: backgroundRectangle.height
|
||||
|
||||
Text {
|
||||
id: updateAvailableDetails
|
||||
text: updateDialog.updateAvailableDetails
|
||||
width: parent.width
|
||||
anchors.top: updateAvailableTitle.bottom
|
||||
anchors.topMargin: 3
|
||||
font.pixelSize: 15
|
||||
color: "#545454"
|
||||
x: 90
|
||||
readonly property int inputWidth: 500
|
||||
readonly property int inputHeight: 60
|
||||
readonly property int borderWidth: 30
|
||||
readonly property int closeMargin: 16
|
||||
readonly property int inputSpacing: 16
|
||||
|
||||
Column {
|
||||
id: mainContent
|
||||
width: updateDialog.inputWidth
|
||||
spacing: updateDialog.inputSpacing
|
||||
anchors {
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: backgroundRectangle
|
||||
color: "#2c86b1"
|
||||
opacity: 0.85
|
||||
radius: updateDialog.closeMargin * 2
|
||||
|
||||
width: updateDialog.inputWidth + updateDialog.borderWidth * 2
|
||||
height: updateDialog.inputHeight * 6 + updateDialog.closeMargin * 2
|
||||
|
||||
Rectangle {
|
||||
id: dialogTitle
|
||||
width: updateDialog.inputWidth
|
||||
height: updateDialog.inputHeight
|
||||
radius: height / 2
|
||||
color: "#ebebeb"
|
||||
|
||||
anchors {
|
||||
top: parent.top
|
||||
topMargin: updateDialog.inputSpacing
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
Text {
|
||||
id: updateAvailableText
|
||||
text: "Update Available"
|
||||
anchors {
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
leftMargin: updateDialog.inputSpacing
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
text: updateDialog.updateAvailableDetails
|
||||
font.pixelSize: 14
|
||||
color: hifi.colors.text
|
||||
anchors {
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: updateAvailableText.right
|
||||
leftMargin: 13
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Flickable {
|
||||
id: scrollArea
|
||||
anchors {
|
||||
top: dialogTitle.bottom
|
||||
}
|
||||
contentWidth: updateDialog.inputWidth
|
||||
contentHeight: backgroundRectangle.height - (dialogTitle.height * 2)
|
||||
width: updateDialog.inputWidth
|
||||
height: backgroundRectangle.height - (dialogTitle.height * 2)
|
||||
flickableDirection: Flickable.VerticalFlick
|
||||
clip: true
|
||||
|
||||
TextEdit {
|
||||
id: releaseNotes
|
||||
wrapMode: TextEdit.Wrap
|
||||
width: parent.width
|
||||
readOnly: true
|
||||
text: updateDialog.releaseNotes
|
||||
font.pixelSize: 14
|
||||
color: hifi.colors.text
|
||||
anchors {
|
||||
left: parent.left
|
||||
leftMargin: updateDialog.borderWidth
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: releaseNotes
|
||||
color: "#CCE8E8E8"
|
||||
anchors.top: backgroundImage.bottom
|
||||
anchors.topMargin: 0
|
||||
width: backgroundImage.width - 90
|
||||
height: releaseNotesContent.height
|
||||
x: 50
|
||||
radius: 10
|
||||
|
||||
|
||||
TextEdit {
|
||||
id: releaseNotesContent
|
||||
readOnly: true
|
||||
font.pixelSize: 13
|
||||
width: parent.width
|
||||
x: 10
|
||||
y: 10
|
||||
color: "#111111"
|
||||
text:
|
||||
"These are the release notes: \n" +
|
||||
"And some more text about what this includes: \n" +
|
||||
"These are the release notes: \n" +
|
||||
"And some more text about what this includes: \n" +
|
||||
"These are the release notes: \n" +
|
||||
"And some more text about what this includes: \n";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -52,13 +52,7 @@ void DialogsManager::showLoginDialog() {
|
|||
}
|
||||
|
||||
void DialogsManager::showUpdateDialog() {
|
||||
qDebug() << "[LEOTEST] We should be showing the update dialog";
|
||||
if (!_updateDialog) {
|
||||
_updateDialog = new UpdateDialog();
|
||||
connect(_updateDialog, SIGNAL(closed()), _updateDialog, SLOT(deleteLater()));
|
||||
_updateDialog->setUpdateAvailableDetails("");
|
||||
_updateDialog->show();
|
||||
}
|
||||
UpdateDialog::show();
|
||||
}
|
||||
|
||||
void DialogsManager::octreeStatsDetails() {
|
||||
|
|
|
@ -13,30 +13,30 @@
|
|||
HIFI_QML_DEF(UpdateDialog)
|
||||
|
||||
UpdateDialog::UpdateDialog(QQuickItem* parent) : OffscreenQmlDialog(parent) {
|
||||
|
||||
qDebug() << "[LEOTEST] We are creating the dialog";
|
||||
auto applicationUpdater = DependencyManager::get<AutoUpdate>();
|
||||
int currentVersion = QCoreApplication::applicationVersion().toInt();
|
||||
int latestVersion = applicationUpdater.data()->getBuildData().lastKey();
|
||||
int versionsBehind = latestVersion - currentVersion;
|
||||
_updateAvailableDetails = "v." + QString::number(latestVersion) + " released on " + applicationUpdater.data()->getBuildData()[latestVersion]["releaseTime"];
|
||||
_updateAvailableDetails += "\nYou are " + QString::number(versionsBehind) + " versions behind";
|
||||
_releaseNotes = applicationUpdater.data()->getBuildData()[latestVersion]["releaseNotes"];
|
||||
qDebug() << "[LEOTEST] Release time " << applicationUpdater.data()->getBuildData()[latestVersion]["releaseTime"];
|
||||
qDebug() << "[LEOTEST] Release notes: " << applicationUpdater.data()->getBuildData()[latestVersion]["releaseNotes"];
|
||||
}
|
||||
|
||||
UpdateDialog::~UpdateDialog() {
|
||||
}
|
||||
|
||||
void UpdateDialog::displayDialog() {
|
||||
setUpdateAvailableDetails("");
|
||||
show();
|
||||
}
|
||||
|
||||
void UpdateDialog::setUpdateAvailableDetails(const QString& updateAvailableDetails) {
|
||||
if (updateAvailableDetails == "") {
|
||||
auto applicationUpdater = DependencyManager::get<AutoUpdate>();
|
||||
_updateAvailableDetails = "This is just a test " + QString::number(applicationUpdater.data()->getBuildData().lastKey());
|
||||
qDebug() << "[LEOTEST] We are updating the text in the dialog";
|
||||
emit updateAvailableDetailsChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QString UpdateDialog::updateAvailableDetails() const {
|
||||
return _updateAvailableDetails;
|
||||
}
|
||||
|
||||
QString UpdateDialog::releaseNotes() const {
|
||||
return _releaseNotes;
|
||||
}
|
||||
|
||||
void UpdateDialog::hide() {
|
||||
((QQuickItem*)parent())->setEnabled(false);
|
||||
}
|
||||
|
|
|
@ -10,31 +10,29 @@
|
|||
#ifndef __hifi__UpdateDialog__
|
||||
#define __hifi__UpdateDialog__
|
||||
|
||||
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <OffscreenQmlDialog.h>
|
||||
|
||||
class UpdateDialog : public OffscreenQmlDialog {
|
||||
Q_OBJECT
|
||||
HIFI_QML_DECL
|
||||
|
||||
Q_PROPERTY(QString updateAvailableDetails READ updateAvailableDetails WRITE setUpdateAvailableDetails NOTIFY updateAvailableDetailsChanged)
|
||||
Q_PROPERTY(QString updateAvailableDetails READ updateAvailableDetails)
|
||||
Q_PROPERTY(QString releaseNotes READ releaseNotes)
|
||||
|
||||
public:
|
||||
UpdateDialog(QQuickItem* parent = nullptr);
|
||||
~UpdateDialog();
|
||||
|
||||
void displayDialog();
|
||||
void setUpdateAvailableDetails(const QString& updateAvailableDetails);
|
||||
QString updateAvailableDetails() const;
|
||||
|
||||
signals:
|
||||
void updateAvailableDetailsChanged();
|
||||
QString releaseNotes() const;
|
||||
|
||||
protected:
|
||||
void hide();
|
||||
|
||||
|
||||
private:
|
||||
QString _updateAvailableDetails;
|
||||
QString _releaseNotes;
|
||||
|
||||
protected:
|
||||
Q_INVOKABLE void triggerBuildDownload(const int& buildNumber);
|
||||
|
|
|
@ -140,11 +140,17 @@ void AutoUpdate::downloadUpdateVersion(int version) {
|
|||
emit newVersionIsDownloaded();
|
||||
}
|
||||
|
||||
void AutoUpdate::appendBuildData(int versionNumber, QString downloadURL, QString releaseTime, QString releaseNotes, QString pullRequestNumber) {
|
||||
void AutoUpdate::appendBuildData(int versionNumber,
|
||||
QString downloadURL,
|
||||
QString releaseTime,
|
||||
QString releaseNotes,
|
||||
QString pullRequestNumber) {
|
||||
|
||||
QMap<QString, QString> thisBuildDetails;
|
||||
thisBuildDetails.insert("downloadUrl", downloadURL);
|
||||
thisBuildDetails.insert("releaseTime", releaseTime);
|
||||
thisBuildDetails.insert("releaseNotes", releaseNotes);
|
||||
thisBuildDetails.insert("pullRequestNumber", pullRequestNumber);
|
||||
_builds->insert(versionNumber, thisBuildDetails);
|
||||
|
||||
}
|
Loading…
Reference in a new issue