mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 19:04:32 +02:00
Styling update dialog and working towards passing build details from c++ to qml
This commit is contained in:
parent
01236e0159
commit
dea80d1757
7 changed files with 118 additions and 21 deletions
|
@ -4,16 +4,67 @@ import QtQuick.Controls.Styles 1.3
|
|||
import "controls"
|
||||
import "styles"
|
||||
|
||||
Rectangle {
|
||||
id: page
|
||||
width: 320; height: 480
|
||||
color: "lightgray"
|
||||
|
||||
Text {
|
||||
id: helloText
|
||||
text: "Hello world!"
|
||||
y: 30
|
||||
anchors.horizontalCenter: page.horizontalCenter
|
||||
font.pointSize: 24; font.bold: true
|
||||
Item {
|
||||
id: updateDialog
|
||||
implicitWidth: backgroundImage.width
|
||||
implicitHeight: backgroundImage.height + releaseNotes.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
|
||||
|
||||
Text {
|
||||
id: updateAvailableTitle
|
||||
text: "Update available"
|
||||
color: "#000000"
|
||||
x: 90
|
||||
y: 17
|
||||
}
|
||||
|
||||
Text {
|
||||
id: updateAvailableDetails
|
||||
text: updateDialog.updateAvailableDetails
|
||||
width: parent.width
|
||||
anchors.top: updateAvailableTitle.bottom
|
||||
anchors.topMargin: 3
|
||||
font.pixelSize: 15
|
||||
color: "#545454"
|
||||
x: 90
|
||||
}
|
||||
}
|
||||
|
||||
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";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -53,7 +53,12 @@ void DialogsManager::showLoginDialog() {
|
|||
|
||||
void DialogsManager::showUpdateDialog() {
|
||||
qDebug() << "[LEOTEST] We should be showing the update dialog";
|
||||
UpdateDialog::show();
|
||||
if (!_updateDialog) {
|
||||
_updateDialog = new UpdateDialog();
|
||||
connect(_updateDialog, SIGNAL(closed()), _updateDialog, SLOT(deleteLater()));
|
||||
_updateDialog->setUpdateAvailableDetails("");
|
||||
_updateDialog->show();
|
||||
}
|
||||
}
|
||||
|
||||
void DialogsManager::octreeStatsDetails() {
|
||||
|
|
|
@ -105,6 +105,7 @@ private:
|
|||
QPointer<ScriptEditorWindow> _scriptEditor;
|
||||
QPointer<AvatarAppearanceDialog> _avatarAppearanceDialog;
|
||||
QPointer<DomainConnectionDialog> _domainConnectionDialog;
|
||||
QPointer<UpdateDialog> _updateDialog;
|
||||
};
|
||||
|
||||
#endif // hifi_DialogsManager_h
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "UpdateDialog.h"
|
||||
#include "DependencyManager.h"
|
||||
#include <AutoUpdate.h>
|
||||
|
||||
HIFI_QML_DEF(UpdateDialog)
|
||||
|
||||
|
@ -15,6 +16,32 @@ UpdateDialog::UpdateDialog(QQuickItem* parent) : OffscreenQmlDialog(parent) {
|
|||
|
||||
}
|
||||
|
||||
UpdateDialog::~UpdateDialog() {
|
||||
}
|
||||
|
||||
void UpdateDialog::displayDialog() {
|
||||
setUpdateAvailableDetails("");
|
||||
show();
|
||||
}
|
||||
|
||||
void UpdateDialog::setUpdateAvailableDetails(const QString& updateAvailableDetails) {
|
||||
if (updateAvailableDetails != _updateAvailableDetails) {
|
||||
auto applicationUpdater = DependencyManager::get<AutoUpdate>();
|
||||
foreach (int key, applicationUpdater.data()->getBuildData().keys()) {
|
||||
qDebug() << "[LEOTEST] Build number: " << QString::number(key);
|
||||
}
|
||||
_updateAvailableDetails = "This is just a test " + QString::number(applicationUpdater.data()->getBuildData().lastKey());
|
||||
}
|
||||
}
|
||||
|
||||
QString UpdateDialog::updateAvailableDetails() const {
|
||||
return _updateAvailableDetails;
|
||||
}
|
||||
|
||||
void UpdateDialog::hide() {
|
||||
((QQuickItem*)parent())->setEnabled(false);
|
||||
}
|
||||
|
||||
void UpdateDialog::triggerBuildDownload(const int &buildNumber) {
|
||||
qDebug() << "[LEOTEST] Triggering download of build number: " << QString::number(buildNumber);
|
||||
}
|
|
@ -16,16 +16,28 @@ class UpdateDialog : public OffscreenQmlDialog {
|
|||
Q_OBJECT
|
||||
HIFI_QML_DECL
|
||||
|
||||
Q_PROPERTY(QString updateAvailableDetails READ updateAvailableDetails WRITE setUpdateAvailableDetails NOTIFY updateAvailableDetailsChanged)
|
||||
|
||||
public:
|
||||
UpdateDialog(QQuickItem* parent = nullptr);
|
||||
~UpdateDialog();
|
||||
|
||||
void displayDialog();
|
||||
void setUpdateAvailableDetails(const QString& updateAvailableDetails);
|
||||
QString updateAvailableDetails() const;
|
||||
|
||||
signals:
|
||||
void updateAvailableDetailsChanged();
|
||||
|
||||
protected:
|
||||
void hide();
|
||||
|
||||
private:
|
||||
|
||||
private:
|
||||
QString _updateAvailableDetails;
|
||||
|
||||
protected:
|
||||
Q_INVOKABLE void triggerBuildDownload(const int& buildNumber);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ AutoUpdate::AutoUpdate() {
|
|||
_operatingSystem = "ubuntu";
|
||||
#endif
|
||||
connect(this, SIGNAL(latestVersionDataParsed()), this, SLOT(checkVersionAndNotify()));
|
||||
_builds = new QMap<int, QMap<QString, QString>>;
|
||||
}
|
||||
|
||||
AutoUpdate::~AutoUpdate() {
|
||||
|
@ -114,17 +115,17 @@ void AutoUpdate::parseLatestVersionData() {
|
|||
|
||||
void AutoUpdate::debugBuildData() {
|
||||
qDebug() << "[LEOTEST] We finished parsing the xml build data";
|
||||
foreach (int key, _builds.keys()) {
|
||||
foreach (int key, _builds->keys()) {
|
||||
qDebug() << "[LEOTEST] Build number: " << QString::number(key);
|
||||
foreach (QString detailsKey, _builds[key].keys()) {
|
||||
qDebug() << "[LEOTEST] Key: " << detailsKey << " Value: " << _builds[key][detailsKey];
|
||||
}
|
||||
//foreach (QString detailsKey, _builds[key].keys()) {
|
||||
// qDebug() << "[LEOTEST] Key: " << detailsKey << " Value: " << _builds[key][detailsKey];
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
void AutoUpdate::checkVersionAndNotify() {
|
||||
qDebug() << "[LEOTEST] We are checking and notifying for updates";
|
||||
int latestVersionAvailable = _builds.lastKey();
|
||||
int latestVersionAvailable = _builds->lastKey();
|
||||
if (QCoreApplication::applicationVersion() != "dev" &&
|
||||
QCoreApplication::applicationVersion().toInt() < latestVersionAvailable) {
|
||||
emit newVersionIsAvailable();
|
||||
|
@ -145,5 +146,5 @@ void AutoUpdate::appendBuildData(int versionNumber, QString downloadURL, QString
|
|||
thisBuildDetails.insert("releaseTime", releaseTime);
|
||||
thisBuildDetails.insert("releaseNotes", releaseNotes);
|
||||
thisBuildDetails.insert("pullRequestNumber", pullRequestNumber);
|
||||
_builds.insert(versionNumber, thisBuildDetails);
|
||||
_builds->insert(versionNumber, thisBuildDetails);
|
||||
}
|
|
@ -43,13 +43,13 @@ public:
|
|||
~AutoUpdate();
|
||||
|
||||
void checkForUpdate();
|
||||
QMap<int, QMap<QString, QString>> getBuildData() { return _builds; }
|
||||
QMap<int, QMap<QString, QString>> &getBuildData() { return *_builds; }
|
||||
|
||||
public slots:
|
||||
|
||||
private:
|
||||
// Members
|
||||
QMap<int, QMap<QString, QString>> _builds;
|
||||
QMap<int, QMap<QString, QString>> *_builds;
|
||||
QString _operatingSystem;
|
||||
|
||||
// Methods
|
||||
|
|
Loading…
Reference in a new issue