Skip to content

Commit 02bd2b7

Browse files
committed
[4.4.3] MuseSound promo: added the ability to specify the name of the cancel button from the server
1 parent 85ff4ed commit 02bd2b7

File tree

5 files changed

+13
-4
lines changed

5 files changed

+13
-4
lines changed

src/framework/update/internal/musesoundscheckupdatescenario.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ using namespace muse::actions;
3939

4040
static const char* DEFAULT_IMAGE_URL = "qrc:/qml/Muse/Update/resources/muse_sounds_promo.png";
4141
static const TranslatableString DEFAULT_ACTION_TITLE("update", "Take me to Muse Hub");
42+
static const TranslatableString DEFAULT_CANCEL_TITLE("update", "No thanks");
4243

4344
void MuseSoundsCheckUpdateScenario::delayedInit()
4445
{
@@ -152,6 +153,12 @@ void MuseSoundsCheckUpdateScenario::showReleaseInfo(const ReleaseInfo& info)
152153
query.addParam("actionTitle", Val(QString::fromStdString(info.actionTitle)));
153154
}
154155

156+
if (info.cancelTitle.empty()) {
157+
query.addParam("cancelTitle", Val(DEFAULT_CANCEL_TITLE.qTranslated()));
158+
} else {
159+
query.addParam("cancelTitle", Val(QString::fromStdString(info.cancelTitle)));
160+
}
161+
155162
if (info.imageUrl.empty()) {
156163
query.addParam("imageUrl", Val(QString(DEFAULT_IMAGE_URL)));
157164
} else {

src/framework/update/internal/musesoundscheckupdateservice.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222

2323
#include "musesoundscheckupdateservice.h"
2424

25-
#include <QSslSocket>
26-
2725
#include <QBuffer>
2826
#include <QJsonParseError>
2927
#include <QJsonObject>
@@ -195,6 +193,8 @@ muse::RetVal<ReleaseInfo> MuseSoundsCheckUpdateService::parseRelease(const QByte
195193
result.val.additionInfo.insert({ "features", Val(featuresList) });
196194

197195
result.val.actionTitle = contentLocaleObj.value("action_title").toString().toStdString();
196+
result.val.cancelTitle = contentLocaleObj.value("cancel_title").toString().toStdString();
197+
198198
QJsonObject actionsObj = releaseObj.value("actions").toObject();
199199

200200
#ifdef Q_OS_WIN

src/framework/update/qml/Muse/Update/MuseSoundsReleaseInfoDialog.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ StyledDialogView {
3535
property alias features: featuresViewRepeater.model
3636
property alias imageUrl: image.source
3737
property alias actionTitle: buttons.defaultButtonName
38+
property alias cancelTitle: buttons.cancelButtonName
3839

3940
contentWidth: 530
4041
contentHeight: 510

src/framework/update/qml/Muse/Update/internal/MuseSoundsReleaseInfoBottomPanel.qml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ RowLayout {
2929
id: root
3030

3131
property alias defaultButtonName: openMuseHubButton.text
32+
property alias cancelButtonName: cancelBtn.text
3233

3334
property NavigationPanel navigationPanel: NavigationPanel {
3435
name: "UpdateBottomPanel"
@@ -45,11 +46,10 @@ RowLayout {
4546
}
4647

4748
FlatButton {
49+
id: cancelBtn
4850
Layout.alignment: Qt.AlignVCenter
4951
Layout.preferredWidth: (root.width - root.spacing) / 2
5052

51-
text: qsTrc("update", "No thanks")
52-
5353
navigation.name: "NoButton"
5454
navigation.panel: root.navigationPanel
5555
navigation.column: 2

src/framework/update/updatetypes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ struct ReleaseInfo {
5454
ValMap additionInfo;
5555

5656
std::string actionTitle; // title of action button
57+
std::string cancelTitle; // title of cancel button
5758
ValList actions; // open app or web page url, try in order
5859

5960
bool isValid() const

0 commit comments

Comments
 (0)