Skip to content

Commit 389a5dc

Browse files
Merge pull request #32039 from RomanPudashkin/welcome_dialog_fix
Fix welcome dialog not appearing
2 parents b6d0dc2 + 465a2fa commit 389a5dc

5 files changed

Lines changed: 73 additions & 58 deletions

File tree

src/appshell/internal/istartupscenario.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include "modularity/imoduleinterface.h"
2626

2727
#include "project/types/projecttypes.h"
28-
#include "async/promise.h"
2928

3029
namespace mu::appshell {
3130
class IStartupScenario : MODULE_CONTEXT_INTERFACE
@@ -45,7 +44,5 @@ class IStartupScenario : MODULE_CONTEXT_INTERFACE
4544
virtual void runOnSplashScreen() = 0;
4645
virtual void runAfterSplashScreen() = 0;
4746
virtual bool startupCompleted() const = 0;
48-
49-
virtual std::vector<QVariantMap> welcomeDialogData() const = 0;
5047
};
5148
}

src/appshell/internal/startupscenario.cpp

Lines changed: 23 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -188,47 +188,6 @@ bool StartupScenario::startupCompleted() const
188188
return m_startupCompleted;
189189
}
190190

191-
std::vector<QVariantMap> StartupScenario::welcomeDialogData() const
192-
{
193-
QVariantMap item1;
194-
item1.insert("title", muse::qtrc("appshell/welcome", "Enjoy free cloud storage"));
195-
item1.insert("imageUrl", "qrc:/resources/welcomedialog/MuseScoreCom.png");
196-
item1.insert("description", muse::qtrc("appshell/welcome",
197-
"Save your scores privately on MuseScore.com to revisit past versions and invite others to view and comment – and when you’re ready, share your music with the world."));
198-
item1.insert("buttonText", muse::qtrc("appshell/welcome", "View my scores online"));
199-
item1.insert("destinationUrl",
200-
"https://musescore.com/my-scores?utm_source=mss-app-welcome-musescore-com&utm_medium=mss-app-welcome-musescore-com&utm_campaign=mss-app-welcome-musescore-com");
201-
202-
QVariantMap item2;
203-
item2.insert("title", muse::qtrc("appshell/welcome", "What’s new in MuseScore Studio"));
204-
item2.insert("imageUrl", "qrc:/resources/welcomedialog/WhatsNew.png");
205-
item2.insert("description", muse::qtrc("appshell/welcome",
206-
"Includes a new system for hiding empty staves, a new text editing widget, guitar notation improvements, engraving improvements and more."));
207-
item2.insert("buttonText", muse::qtrc("appshell/welcome", "Watch video"));
208-
item2.insert("destinationUrl",
209-
"https://www.youtube.com/watch?v=J2gY9CbMuoI&utm_source=mss-app-yt-4.6-release&utm_medium=mss-app-yt-4.6-release&utm_campaign=mss-app-yt-4.6-release");
210-
211-
QVariantMap item3;
212-
item3.insert("title", muse::qtrc("appshell/welcome", "Install our free MuseSounds libraries"));
213-
item3.insert("imageUrl", "qrc:/resources/welcomedialog/MuseSounds.png");
214-
item3.insert("description", muse::qtrc("appshell/welcome",
215-
"Explore our collection of realistic sample libraries, including solo instruments, marching percussion, and full orchestra - available for free on MuseHub."));
216-
item3.insert("buttonText", muse::qtrc("appshell/welcome", "Get it on MuseHub"));
217-
item3.insert("destinationUrl",
218-
"https://www.musehub.com/free-musesounds?utm_source=mss-app-welcome-free-musesounds&utm_medium=mss-app-welcome-free-musesounds&utm_campaign=mss-app-welcome-free-musesounds&utm_id=mss-app-welcome-free-musesounds");
219-
220-
QVariantMap item4;
221-
item4.insert("title", muse::qtrc("appshell/welcome", "Explore our tutorials"));
222-
item4.insert("imageUrl", "qrc:/resources/welcomedialog/ExploreTutorials.png");
223-
item4.insert("description", muse::qtrc("appshell/welcome",
224-
"We’ve put together a playlist of tutorials to help both beginners and experienced users get the most out of MuseScore Studio."));
225-
item4.insert("buttonText", muse::qtrc("appshell/welcome", "View tutorials"));
226-
item4.insert("destinationUrl",
227-
"https://www.youtube.com/playlist?list=PLTYuWi2LmaPECOZrC6bkPHBkYY9_WEexT&utm_source=mss-app-welcome-tutorials&utm_medium=mss-app-welcome-tutorials&utm_campaign=mss-app-welcome-tutorials&utm_id=mss-app-welcome-tutorials");
228-
229-
return { item1, item2, item3, item4 };
230-
}
231-
232191
StartupModeType StartupScenario::resolveStartupModeType() const
233192
{
234193
if (m_startupScoreFile.isValid()) {
@@ -266,20 +225,37 @@ void StartupScenario::onStartupPageOpened(StartupModeType modeType)
266225
} break;
267226
}
268227

228+
m_activeUpdateCheckCount = 0;
229+
269230
if (appUpdateScenario() && appUpdateScenario()->checkInProgress()) {
231+
m_activeUpdateCheckCount++;
270232
appUpdateScenario()->checkInProgressChanged().onNotify(this, [this, modeType]() {
271-
showStartupDialogsIfNeed(modeType);
272233
appUpdateScenario()->checkInProgressChanged().disconnect(this);
273-
});
274-
} else {
275-
showStartupDialogsIfNeed(modeType);
234+
m_activeUpdateCheckCount--;
235+
showStartupDialogsIfNeed(modeType);
236+
}, Asyncable::Mode::SetReplace);
237+
}
238+
239+
if (museSoundsUpdateScenario() && museSoundsUpdateScenario()->checkInProgress()) {
240+
m_activeUpdateCheckCount++;
241+
museSoundsUpdateScenario()->checkInProgressChanged().onNotify(this, [this, modeType]() {
242+
museSoundsUpdateScenario()->checkInProgressChanged().disconnect(this);
243+
m_activeUpdateCheckCount--;
244+
showStartupDialogsIfNeed(modeType);
245+
}, Asyncable::Mode::SetReplace);
276246
}
247+
248+
showStartupDialogsIfNeed(modeType);
277249
}
278250

279251
void StartupScenario::showStartupDialogsIfNeed(StartupModeType modeType)
280252
{
281253
TRACEFUNC;
282254

255+
if (m_activeUpdateCheckCount != 0) {
256+
return;
257+
}
258+
283259
//! NOTE: The welcome dialog should not show if the first launch setup has not been completed, or if we're going
284260
//! to show a MuseSounds update dialog (see ProjectActionsController::doFinishOpenProject). MuseSampler's update
285261
//! dialog should be shown after the welcome dialog.
@@ -336,10 +312,8 @@ bool StartupScenario::shouldShowWelcomeDialog(StartupModeType modeType) const
336312
return false;
337313
}
338314

339-
if (museSoundsUpdateScenario()) {
340-
if (museSoundsUpdateScenario()->checkInProgress() || museSoundsUpdateScenario()->hasUpdate()) {
341-
return false;
342-
}
315+
if (museSoundsUpdateScenario() && museSoundsUpdateScenario()->hasUpdate()) {
316+
return false;
343317
}
344318

345319
const Uri& startupUri = startupPageUri(modeType);

src/appshell/internal/startupscenario.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ class StartupScenario : public IStartupScenario, public muse::Contextable, publi
6868
void runAfterSplashScreen() override;
6969
bool startupCompleted() const override;
7070

71-
std::vector<QVariantMap> welcomeDialogData() const override;
72-
7371
private:
7472
void registerAudioPlugins();
7573

@@ -89,5 +87,6 @@ class StartupScenario : public IStartupScenario, public muse::Contextable, publi
8987
std::string m_startupTypeStr;
9088
project::ProjectFile m_startupScoreFile;
9189
bool m_startupCompleted = false;
90+
size_t m_activeUpdateCheckCount = 0;
9291
};
9392
}

src/appshell/qml/MuseScore/AppShell/welcomedialogmodel.cpp

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,65 @@
2121
*/
2222

2323
#include "welcomedialogmodel.h"
24+
25+
#include "translation.h"
2426
#include "log.h"
2527

2628
using namespace mu::appshell;
2729

30+
static std::vector<QVariantMap> welcomeDialogData()
31+
{
32+
QVariantMap item1;
33+
item1.insert("title", muse::qtrc("appshell/welcome", "Enjoy free cloud storage"));
34+
item1.insert("imageUrl", "qrc:/resources/welcomedialog/MuseScoreCom.png");
35+
item1.insert("description", muse::qtrc("appshell/welcome",
36+
"Save your scores privately on MuseScore.com to revisit past versions and invite others to view and comment – and when you’re ready, share your music with the world."));
37+
item1.insert("buttonText", muse::qtrc("appshell/welcome", "View my scores online"));
38+
item1.insert("destinationUrl",
39+
"https://musescore.com/my-scores?utm_source=mss-app-welcome-musescore-com&utm_medium=mss-app-welcome-musescore-com&utm_campaign=mss-app-welcome-musescore-com");
40+
41+
QVariantMap item2;
42+
item2.insert("title", muse::qtrc("appshell/welcome", "What’s new in MuseScore Studio"));
43+
item2.insert("imageUrl", "qrc:/resources/welcomedialog/WhatsNew.png");
44+
item2.insert("description", muse::qtrc("appshell/welcome",
45+
"Includes a new system for hiding empty staves, a new text editing widget, guitar notation improvements, engraving improvements and more."));
46+
item2.insert("buttonText", muse::qtrc("appshell/welcome", "Watch video"));
47+
item2.insert("destinationUrl",
48+
"https://www.youtube.com/watch?v=J2gY9CbMuoI&utm_source=mss-app-yt-4.6-release&utm_medium=mss-app-yt-4.6-release&utm_campaign=mss-app-yt-4.6-release");
49+
50+
QVariantMap item3;
51+
item3.insert("title", muse::qtrc("appshell/welcome", "Install our free MuseSounds libraries"));
52+
item3.insert("imageUrl", "qrc:/resources/welcomedialog/MuseSounds.png");
53+
item3.insert("description", muse::qtrc("appshell/welcome",
54+
"Explore our collection of realistic sample libraries, including solo instruments, marching percussion, and full orchestra - available for free on MuseHub."));
55+
item3.insert("buttonText", muse::qtrc("appshell/welcome", "Get it on MuseHub"));
56+
item3.insert("destinationUrl",
57+
"https://www.musehub.com/free-musesounds?utm_source=mss-app-welcome-free-musesounds&utm_medium=mss-app-welcome-free-musesounds&utm_campaign=mss-app-welcome-free-musesounds&utm_id=mss-app-welcome-free-musesounds");
58+
59+
QVariantMap item4;
60+
item4.insert("title", muse::qtrc("appshell/welcome", "Explore our tutorials"));
61+
item4.insert("imageUrl", "qrc:/resources/welcomedialog/ExploreTutorials.png");
62+
item4.insert("description", muse::qtrc("appshell/welcome",
63+
"We’ve put together a playlist of tutorials to help both beginners and experienced users get the most out of MuseScore Studio."));
64+
item4.insert("buttonText", muse::qtrc("appshell/welcome", "View tutorials"));
65+
item4.insert("destinationUrl",
66+
"https://www.youtube.com/playlist?list=PLTYuWi2LmaPECOZrC6bkPHBkYY9_WEexT&utm_source=mss-app-welcome-tutorials&utm_medium=mss-app-welcome-tutorials&utm_campaign=mss-app-welcome-tutorials&utm_id=mss-app-welcome-tutorials");
67+
68+
return { item1, item2, item3, item4 };
69+
}
70+
2871
WelcomeDialogModel::WelcomeDialogModel()
2972
: muse::Contextable(muse::iocCtxForQmlObject(this))
3073
{
3174
}
3275

3376
void WelcomeDialogModel::init()
3477
{
35-
IF_ASSERT_FAILED(startupScenario() && configuration()) {
78+
IF_ASSERT_FAILED(configuration()) {
3679
return;
3780
}
3881

39-
m_items = startupScenario()->welcomeDialogData();
82+
m_items = welcomeDialogData();
4083

4184
m_currentIndex = configuration()->welcomeDialogLastShownIndex();
4285
nextItem();
@@ -99,6 +142,10 @@ bool WelcomeDialogModel::showOnStartup() const
99142

100143
void WelcomeDialogModel::setShowOnStartup(bool show)
101144
{
145+
if (show == showOnStartup()) {
146+
return;
147+
}
148+
102149
configuration()->setWelcomeDialogShowOnStartup(show);
103150
emit showOnStartupChanged();
104151
}

src/appshell/qml/MuseScore/AppShell/welcomedialogmodel.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727

2828
#include "modularity/ioc.h"
2929
#include "iappshellconfiguration.h"
30-
#include "appshell/internal/istartupscenario.h"
3130

3231
namespace mu::appshell {
3332
class WelcomeDialogModel : public QObject, public muse::Contextable
@@ -44,7 +43,6 @@ class WelcomeDialogModel : public QObject, public muse::Contextable
4443
QML_ELEMENT
4544

4645
muse::GlobalInject<IAppShellConfiguration> configuration;
47-
muse::ContextInject<IStartupScenario> startupScenario = { this };
4846

4947
public:
5048
WelcomeDialogModel();

0 commit comments

Comments
 (0)