mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 23:44:09 +02:00
Buttons are connected and execting old functions
This commit is contained in:
parent
edce36f5a1
commit
7aee293df4
5 changed files with 24 additions and 77 deletions
interface
libraries/auto-update/src
|
@ -110,7 +110,6 @@ DialogContainer {
|
|||
leftMargin: updateDialog.borderWidth
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
|
@ -125,38 +124,19 @@ DialogContainer {
|
|||
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()
|
||||
MouseArea {
|
||||
id: downloadButtonAction
|
||||
anchors.fill: parent
|
||||
onClicked: updateDialog.triggerUpgrade()
|
||||
cursorShape: "PointingHandCursor"
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
|
@ -171,12 +151,6 @@ DialogContainer {
|
|||
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"
|
||||
|
@ -185,22 +159,12 @@ DialogContainer {
|
|||
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()
|
||||
MouseArea {
|
||||
id: cancelButtonAction
|
||||
anchors.fill: parent
|
||||
onClicked: updateDialog.closeDialog()
|
||||
cursorShape: "PointingHandCursor"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
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();
|
||||
|
@ -23,10 +22,6 @@ UpdateDialog::UpdateDialog(QQuickItem* parent) : OffscreenQmlDialog(parent) {
|
|||
_releaseNotes = applicationUpdater.data()->getBuildData()[latestVersion]["releaseNotes"];
|
||||
}
|
||||
|
||||
UpdateDialog::~UpdateDialog() {
|
||||
|
||||
}
|
||||
|
||||
QString UpdateDialog::updateAvailableDetails() const {
|
||||
return _updateAvailableDetails;
|
||||
}
|
||||
|
@ -35,8 +30,7 @@ QString UpdateDialog::releaseNotes() const {
|
|||
return _releaseNotes;
|
||||
}
|
||||
|
||||
void UpdateDialog::closeUpdateDialog() {
|
||||
qDebug() << "[LEOTEST] Closing update dialog";
|
||||
void UpdateDialog::closeDialog() {
|
||||
hide();
|
||||
}
|
||||
|
||||
|
@ -45,5 +39,6 @@ void UpdateDialog::hide() {
|
|||
}
|
||||
|
||||
void UpdateDialog::triggerUpgrade() {
|
||||
qDebug() << "[LEOTEST] Triggering download of build number";
|
||||
auto applicationUpdater = DependencyManager::get<AutoUpdate>();
|
||||
applicationUpdater.data()->performAutoUpdate(applicationUpdater.data()->getBuildData().lastKey());
|
||||
}
|
|
@ -23,7 +23,6 @@ class UpdateDialog : public OffscreenQmlDialog {
|
|||
|
||||
public:
|
||||
UpdateDialog(QQuickItem* parent = nullptr);
|
||||
~UpdateDialog();
|
||||
QString updateAvailableDetails() const;
|
||||
QString releaseNotes() const;
|
||||
|
||||
|
@ -34,7 +33,7 @@ private:
|
|||
protected:
|
||||
void hide();
|
||||
Q_INVOKABLE void triggerUpgrade();
|
||||
Q_INVOKABLE void closeUpdateDialog();
|
||||
Q_INVOKABLE void closeDialog();
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -29,10 +29,6 @@ AutoUpdate::AutoUpdate() {
|
|||
_builds = new QMap<int, QMap<QString, QString>>;
|
||||
}
|
||||
|
||||
AutoUpdate::~AutoUpdate() {
|
||||
qDebug() << "[LEOTEST] The object is now destroyed";
|
||||
}
|
||||
|
||||
void AutoUpdate::checkForUpdate() {
|
||||
this->getLatestVersionData();
|
||||
|
||||
|
@ -113,18 +109,7 @@ void AutoUpdate::parseLatestVersionData() {
|
|||
emit latestVersionDataParsed();
|
||||
}
|
||||
|
||||
void AutoUpdate::debugBuildData() {
|
||||
qDebug() << "[LEOTEST] We finished parsing the xml build data";
|
||||
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];
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
void AutoUpdate::checkVersionAndNotify() {
|
||||
qDebug() << "[LEOTEST] We are checking and notifying for updates";
|
||||
int latestVersionAvailable = _builds->lastKey();
|
||||
if (QCoreApplication::applicationVersion() != "dev" &&
|
||||
QCoreApplication::applicationVersion().toInt() < latestVersionAvailable) {
|
||||
|
@ -133,7 +118,12 @@ void AutoUpdate::checkVersionAndNotify() {
|
|||
}
|
||||
|
||||
void AutoUpdate::performAutoUpdate(int version) {
|
||||
|
||||
// NOTE: This is not yet auto updating - however this is a checkpoint towards that end
|
||||
// Next PR will handle the automatic download, upgrading and application restart
|
||||
QMap<QString, QString> chosenVersion = _builds->value(version);
|
||||
QUrl downloadUrl = chosenVersion.value("downloadUrl");
|
||||
QDesktopServices::openUrl(downloadUrl);
|
||||
QCoreApplication::quit();
|
||||
}
|
||||
|
||||
void AutoUpdate::downloadUpdateVersion(int version) {
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include <QtCore/QObject>
|
||||
#include <QtCore/QSettings>
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QDesktopServices>
|
||||
#include <QDebug>
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
|
@ -40,10 +41,10 @@ class AutoUpdate : public QObject, public Dependency {
|
|||
public:
|
||||
// Methods
|
||||
AutoUpdate();
|
||||
~AutoUpdate();
|
||||
|
||||
void checkForUpdate();
|
||||
QMap<int, QMap<QString, QString>> &getBuildData() { return *_builds; }
|
||||
void performAutoUpdate(int version);
|
||||
|
||||
public slots:
|
||||
|
||||
|
@ -63,9 +64,7 @@ private:
|
|||
|
||||
private slots:
|
||||
void parseLatestVersionData();
|
||||
void debugBuildData();
|
||||
void checkVersionAndNotify();
|
||||
void performAutoUpdate(int version);
|
||||
|
||||
signals:
|
||||
void latestVersionDataParsed();
|
||||
|
|
Loading…
Reference in a new issue