mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 17:03:58 +02:00
Checkpoint - buttons in place
This commit is contained in:
parent
bd85ce1312
commit
edce36f5a1
3 changed files with 110 additions and 11 deletions
|
@ -1,6 +1,7 @@
|
|||
import Hifi 1.0
|
||||
import QtQuick 2.3
|
||||
import QtQuick.Controls.Styles 1.3
|
||||
import QtGraphicalEffects 1.0
|
||||
import "controls"
|
||||
import "styles"
|
||||
|
||||
|
@ -24,6 +25,12 @@ DialogContainer {
|
|||
readonly property int borderWidth: 30
|
||||
readonly property int closeMargin: 16
|
||||
readonly property int inputSpacing: 16
|
||||
readonly property int buttonWidth: 150
|
||||
readonly property int buttonHeight: 50
|
||||
readonly property int buttonRadius: 15
|
||||
|
||||
signal triggerBuildDownload
|
||||
signal closeUpdateDialog
|
||||
|
||||
Column {
|
||||
id: mainContent
|
||||
|
@ -84,9 +91,9 @@ DialogContainer {
|
|||
top: dialogTitle.bottom
|
||||
}
|
||||
contentWidth: updateDialog.inputWidth
|
||||
contentHeight: backgroundRectangle.height - (dialogTitle.height * 2)
|
||||
contentHeight: backgroundRectangle.height - (dialogTitle.height * 2.5)
|
||||
width: updateDialog.inputWidth
|
||||
height: backgroundRectangle.height - (dialogTitle.height * 2)
|
||||
height: backgroundRectangle.height - (dialogTitle.height * 2.5)
|
||||
flickableDirection: Flickable.VerticalFlick
|
||||
clip: true
|
||||
|
||||
|
@ -105,6 +112,96 @@ DialogContainer {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: downloadButton
|
||||
width: updateDialog.buttonWidth
|
||||
height: updateDialog.buttonHeight
|
||||
radius: updateDialog.buttonRadius
|
||||
color: "green"
|
||||
anchors {
|
||||
top: scrollArea.bottom
|
||||
topMargin: 10
|
||||
right: backgroundRectangle.right
|
||||
rightMargin: 15
|
||||
}
|
||||
Accessible.name: "Upgrade"
|
||||
Accessible.description: "Download and update to latest version"
|
||||
Accessible.role: Accessible.Button
|
||||
Accessible.onPressAction: {
|
||||
updateDialog.triggerBuildDownload()
|
||||
}
|
||||
|
||||
|
||||
Text {
|
||||
text: "Upgrade"
|
||||
anchors {
|
||||
verticalCenter: parent.verticalCenter
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
DropShadow {
|
||||
anchors.fill: downloadButton
|
||||
horizontalOffset: 2
|
||||
verticalOffset: 2
|
||||
radius: updateDialog.buttonRadius
|
||||
samples: 16
|
||||
color: "#80000000"
|
||||
source: downloadButton
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: downloadButtonAction
|
||||
anchors.fill: downloadButton
|
||||
onClicked: updateDialog.triggerBuildDownload()
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: cancelButton
|
||||
width: updateDialog.buttonWidth
|
||||
height: updateDialog.buttonHeight
|
||||
radius: updateDialog.buttonRadius
|
||||
color: "red"
|
||||
anchors {
|
||||
top: scrollArea.bottom
|
||||
topMargin: 10
|
||||
right: downloadButton.left
|
||||
rightMargin: 15
|
||||
}
|
||||
Accessible.name: "Cancel"
|
||||
Accessible.description: "Do not upgrade your current version"
|
||||
Accessible.role: Accessible.Button
|
||||
Accessible.onPressAction: {
|
||||
updateDialog.closeUpdateDialog()
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "Cancel"
|
||||
anchors {
|
||||
verticalCenter: parent.verticalCenter
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DropShadow {
|
||||
anchors.fill: cancelButton
|
||||
horizontalOffset: 2
|
||||
verticalOffset: 2
|
||||
radius: updateDialog.buttonRadius
|
||||
samples: 16
|
||||
color: "#80000000"
|
||||
source: cancelButton
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: cancelButtonAction
|
||||
anchors.fill: cancelButton
|
||||
onClicked: updateDialog.closeUpdateDialog()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,11 +18,9 @@ UpdateDialog::UpdateDialog(QQuickItem* parent) : OffscreenQmlDialog(parent) {
|
|||
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 = "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() {
|
||||
|
@ -37,10 +35,15 @@ QString UpdateDialog::releaseNotes() const {
|
|||
return _releaseNotes;
|
||||
}
|
||||
|
||||
void UpdateDialog::closeUpdateDialog() {
|
||||
qDebug() << "[LEOTEST] Closing update dialog";
|
||||
hide();
|
||||
}
|
||||
|
||||
void UpdateDialog::hide() {
|
||||
((QQuickItem*)parent())->setEnabled(false);
|
||||
}
|
||||
|
||||
void UpdateDialog::triggerBuildDownload(const int &buildNumber) {
|
||||
qDebug() << "[LEOTEST] Triggering download of build number: " << QString::number(buildNumber);
|
||||
void UpdateDialog::triggerUpgrade() {
|
||||
qDebug() << "[LEOTEST] Triggering download of build number";
|
||||
}
|
|
@ -27,15 +27,14 @@ public:
|
|||
QString updateAvailableDetails() const;
|
||||
QString releaseNotes() const;
|
||||
|
||||
protected:
|
||||
void hide();
|
||||
|
||||
private:
|
||||
QString _updateAvailableDetails;
|
||||
QString _releaseNotes;
|
||||
|
||||
protected:
|
||||
Q_INVOKABLE void triggerBuildDownload(const int& buildNumber);
|
||||
void hide();
|
||||
Q_INVOKABLE void triggerUpgrade();
|
||||
Q_INVOKABLE void closeUpdateDialog();
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue