Skip to content

Commit 17db1cb

Browse files
committed
Last updates for 2.0
1 parent 84fc58a commit 17db1cb

6 files changed

Lines changed: 52 additions & 23 deletions

File tree

dialogengineupdate.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ void DialogEngineUpdate::updateReleaseText(QJsonArray& tab) {
6969
void DialogEngineUpdate::updateLabel(QString label) {
7070
ui->label->setText(label);
7171
ui->scrollArea->hide();
72-
setFixedSize(geometry().width(), geometry().height() - 300);
72+
ui->checkBoxShow->hide();
73+
setFixedSize(geometry().width(), geometry().height() - 370);
7374
}
7475

7576
// -------------------------------------------------------
@@ -90,6 +91,7 @@ void DialogEngineUpdate::accept() {
9091
else
9192
QMessageBox::information(this, "Done!", "Download finished correctly!");
9293
m_progress.close();
94+
qApp->quit();
9395
EngineUpdater::startEngineProcess();
9496

9597
QDialog::accept();
@@ -99,7 +101,14 @@ void DialogEngineUpdate::accept() {
99101

100102
void DialogEngineUpdate::reject() {
101103
this->hide();
104+
qApp->quit();
102105
EngineUpdater::startEngineProcess();
103106

104107
QDialog::reject();
105108
}
109+
110+
// -------------------------------------------------------
111+
112+
void DialogEngineUpdate::on_checkBoxShow_toggled(bool checked) {
113+
m_engineUpdater.changeNeedUpdate(checked);
114+
}

dialogengineupdate.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ class DialogEngineUpdate : public QDialog
5757
public slots:
5858
virtual void accept();
5959
virtual void reject();
60+
61+
private slots:
62+
void on_checkBoxShow_toggled(bool checked);
6063
};
6164

6265
#endif // DIALOGENGINEUPDATE_H

dialogengineupdate.ui

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,6 @@
1414
<string>New update(s)!</string>
1515
</property>
1616
<layout class="QGridLayout" name="gridLayout">
17-
<property name="leftMargin">
18-
<number>15</number>
19-
</property>
20-
<property name="topMargin">
21-
<number>10</number>
22-
</property>
23-
<property name="rightMargin">
24-
<number>15</number>
25-
</property>
26-
<property name="bottomMargin">
27-
<number>10</number>
28-
</property>
2917
<item row="0" column="0">
3018
<layout class="QVBoxLayout" name="verticalLayout_2">
3119
<property name="spacing">
@@ -63,7 +51,7 @@ Would you like to download it?</string>
6351
<rect>
6452
<x>0</x>
6553
<y>0</y>
66-
<width>524</width>
54+
<width>536</width>
6755
<height>368</height>
6856
</rect>
6957
</property>
@@ -73,14 +61,25 @@ Would you like to download it?</string>
7361
</layout>
7462
</item>
7563
<item>
76-
<widget class="QDialogButtonBox" name="buttonBox">
77-
<property name="orientation">
78-
<enum>Qt::Horizontal</enum>
79-
</property>
80-
<property name="standardButtons">
81-
<set>QDialogButtonBox::No|QDialogButtonBox::Yes</set>
82-
</property>
83-
</widget>
64+
<layout class="QHBoxLayout" name="horizontalLayout">
65+
<item>
66+
<widget class="QCheckBox" name="checkBoxShow">
67+
<property name="text">
68+
<string>Don't show this window again</string>
69+
</property>
70+
</widget>
71+
</item>
72+
<item>
73+
<widget class="QDialogButtonBox" name="buttonBox">
74+
<property name="orientation">
75+
<enum>Qt::Horizontal</enum>
76+
</property>
77+
<property name="standardButtons">
78+
<set>QDialogButtonBox::No|QDialogButtonBox::Yes</set>
79+
</property>
80+
</widget>
81+
</item>
82+
</layout>
8483
</item>
8584
</layout>
8685
</item>

engineupdater.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,19 @@ QString EngineUpdater::getVersionJson() const {
316316

317317
// -------------------------------------------------------
318318

319+
void EngineUpdater::changeNeedUpdate(bool checked) {
320+
QString path = Common::pathCombine(Common::pathCombine(Common::pathCombine(
321+
QDir::currentPath(), "Engine"), "Content"),
322+
"engineSettings.json");
323+
QJsonDocument doc;
324+
Common::readOtherJSON(path, doc);
325+
QJsonObject obj = doc.object();
326+
obj["updater"] = !checked;
327+
Common::writeOtherJSON(path, obj);
328+
}
329+
330+
// -------------------------------------------------------
331+
319332
void EngineUpdater::start() {
320333
emit needUpdate();
321334
}

engineupdater.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ class EngineUpdater : public QObject
9090
static int countObjUpdate(QJsonObject& obj);
9191
bool hasVersion() const;
9292
QString getVersionJson() const;
93+
void changeNeedUpdate(bool checked);
9394
void start();
9495
void updateVersion(QJsonObject& obj, QString &version);
9596
bool download(EngineUpdateFileKind action, QJsonObject& obj,

main.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <QApplication>
2424
#include <QMessageBox>
2525
#include <QDir>
26+
#include <QTimer>
2627

2728
int main(int argc, char *argv[])
2829
{
@@ -42,6 +43,7 @@ int main(int argc, char *argv[])
4243

4344
if (!engineUpdater.readDocumentVersion()) {
4445
EngineUpdater::startEngineProcess();
46+
QTimer::singleShot(5000, qApp, SLOT(quit()));
4547
return 0;
4648
}
4749

@@ -62,8 +64,10 @@ int main(int argc, char *argv[])
6264
dialog.updateReleaseText(tab);
6365
dialog.show();
6466
}
65-
else
67+
else {
6668
EngineUpdater::startEngineProcess();
69+
QTimer::singleShot(5000, qApp, SLOT(quit()));
70+
}
6771
}
6872
else {
6973
dialog.updateLabel("You can download the newest version of the "

0 commit comments

Comments
 (0)