Skip to content

Commit 9586fda

Browse files
committed
Show change history in update notification.
1 parent 825ecd3 commit 9586fda

File tree

1 file changed

+30
-12
lines changed

1 file changed

+30
-12
lines changed

SerialPrograms/Source/CommonFramework/Startup/NewVersionCheck.cpp

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@ bool compare_version(Logger& logger, const JsonObject* json){
6666

6767
return false;
6868
}
69+
std::string get_changes(const JsonObject* json){
70+
const std::string* changes = json->get_string("Changes");
71+
if (changes == nullptr){
72+
return "";
73+
}
74+
return "<br><br>" + *changes;
75+
}
76+
6977
void check_new_version(Logger& logger){
7078
bool check_release = GlobalSettings::instance().CHECK_FOR_UPDATES->RELEASE;
7179
bool check_beta = GlobalSettings::instance().CHECK_FOR_UPDATES->BETA;
@@ -102,19 +110,23 @@ void check_new_version(Logger& logger){
102110
return;
103111
}
104112

113+
// cout << json.dump() << endl;
105114

106115
if (check_private_beta){
107116
const JsonObject* node = obj->get_object("PrivateBeta");
108117
if (compare_version(logger, node)){
109118
QMessageBox box;
110119
box.setTextFormat(Qt::RichText);
120+
std::string text = "A new private beta is available!<br>";
121+
text += make_text_url(
122+
"https://discord.com/channels/695809740428673034/732736538965704726",
123+
"Download from our Discord!"
124+
);
125+
text += get_changes(node);
111126
box.information(
112127
nullptr,
113128
"A new private beta is available!",
114-
QString::fromStdString(
115-
"A new private beta is available!<br>" +
116-
make_text_url("https://discord.com/channels/695809740428673034/732736538965704726", "Download from our Discord!")
117-
)
129+
QString::fromStdString(text)
118130
);
119131
return;
120132
}
@@ -124,13 +136,16 @@ void check_new_version(Logger& logger){
124136
if (compare_version(logger, node)){
125137
QMessageBox box;
126138
box.setTextFormat(Qt::RichText);
139+
std::string text = "A new beta is available!<br>";
140+
text += make_text_url(
141+
"https://github.com/PokemonAutomation/ComputerControl/releases",
142+
"Download here."
143+
);
144+
text += get_changes(node);
127145
box.information(
128146
nullptr,
129147
"A new beta is available!",
130-
QString::fromStdString(
131-
"A new beta is available!<br>" +
132-
make_text_url("https://github.com/PokemonAutomation/ComputerControl/releases", "Download here.")
133-
)
148+
QString::fromStdString(text)
134149
);
135150
return;
136151
}
@@ -140,13 +155,16 @@ void check_new_version(Logger& logger){
140155
if (compare_version(logger, node)){
141156
QMessageBox box;
142157
box.setTextFormat(Qt::RichText);
158+
std::string text = "A new version is available!<br>";
159+
text += make_text_url(
160+
"https://github.com/PokemonAutomation/ComputerControl/releases",
161+
"Download here."
162+
);
163+
text += get_changes(node);
143164
box.information(
144165
nullptr,
145166
"New Version Available!",
146-
QString::fromStdString(
147-
"A new version is available!<br>" +
148-
make_text_url("https://github.com/PokemonAutomation/ComputerControl/releases", "Download here.")
149-
)
167+
QString::fromStdString(text)
150168
);
151169
return;
152170
}

0 commit comments

Comments
 (0)