8000 Cleaned up interactive provider by igorkorsukov · Pull Request #28121 · musescore/MuseScore · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Cleaned up interactive provider #28121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 33 additions & 2 deletions src/appshell/qml/DevTools/Interactive/InteractiveTests.qml
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,44 @@ Rectangle {
spacing: 16
columns: 2

FlatButton {
width: 200
navigation.panel: navPanel
navigation.row: 0
text: "[cpp] selectOpeningFile"
onClicked: testModel.selectOpeningFile()
}

FlatButton {
width: 200
navigation.panel: navPanel
navigation.row: 0
text: "[cpp] selectSavingFile"
onClicked: testModel.selectSavingFile()
}

FlatButton {
width: 200
navigation.panel: navPanel
navigation.row: 0
text: "[cpp] selectDirectory"
onClicked: testModel.selectDirectory()
}

FlatButton {
width: 200
navigation.panel: navPanel
navigation.row: 0
text: "[cpp] showProgress"
onClicked: testModel.showProgress()
}

FlatButton {
width: 200
navigation.panel: navPanel
navigation.row: 0
text: "[cpp] Sample dialog"
onClicked: testModel.openSampleDialog()
text: "[cpp] Sample dialog sync"
onClicked: testModel.openSampleDialogSync()
}

FlatButton {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,7 @@ Ret RegisterAudioPluginsScenario::registerNewPlugins()

void RegisterAudioPluginsScenario::processPluginsRegistration(const io::paths_t& pluginPaths)
{
Ret ret = interactive()->showProgress(muse::trc("audio", "Scanning audio plugins"), &m_progress);
if (!ret) {
LOGE() << ret.toString();
}
interactive()->showProgress(muse::trc("audio", "Scanning audio plugins"), &m_progress);

m_aborted = false;
m_progress.start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ TEST_F(AudioPlugins_RegisterAudioPluginsScenarioTest, RegisterNewPlugins)

// [THEN] The progress bar is shown
EXPECT_CALL(*m_interactive, showProgress(muse::trc("audio", "Scanning audio plugins"), _))
.WillOnce(Return(muse::make_ok()));
.Times(1);

// [THEN] Processes started only for unregistered plugins
for (const path_t& pluginPath : foundPluginPaths) {
Expand Down
4 changes: 2 additions & 2 deletions src/framework/autobot/internal/autobotinteractive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ async::Promise<IInteractive::Result> AutobotInteractive::error(const std::string
return m_real->error(contentTitle, text, buttons, defBtn, options, dialogTitle);
}

Ret AutobotInteractive::showProgress(const std::string& title, Progress* progress) const
void AutobotInteractive::showProgress(const std::string& title, Progress* progress)
{
return m_real->showProgress(title, progress);
m_real->showProgress(title, progress);
}

io::path_t AutobotInteractive::selectOpeningFile(const QString& title, const io::path_t& dir, const std::vector<std::string>& filter)
Expand Down
2 changes: 1 addition & 1 deletion src/framework/autobot/internal/autobotinteractive.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class AutobotInteractive : public IInteractive
const std::string& dialogTitle = "") override;

// progress
Ret showProgress(const std::string& title, Progress* progress) const override;
void showProgress(const std::string& title, Progress* progress) override;

// files
io::path_t selectOpeningFile(const QString& title, const io::path_t& dir, const std::vector<std::string>& filter) override;
Expand Down
6 changes: 5 additions & 1 deletion src/framework/global/async/promise.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@ namespace muse::async {
template<typename ... T>
using Promise = kors::async::Promise<T...>;

using PromiseType = kors::async::PromiseType;

template<typename ... T>
constexpr auto make_promise = kors::async::make_promise<T...>;
auto make_promise = [](typename Promise<T...>::Body f, PromiseType type = PromiseType::AsyncByPromise) {
return kors::async::make_promise<T...>(f, type);
};
}

#endif // MUSE_ASYNC_PROMISE_H
2 changes: 1 addition & 1 deletion src/framework/global/iinteractive.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ class IInteractive : MODULE_EXPORT_INTERFACE
}

// progress
virtual Ret showProgress(const std::string& title, Progress* progress) const = 0;
virtual void showProgress(const std::string& title, Progress* progress) = 0;

// files
virtual io::path_t selectOpeningFile(const QString& title, const io::path_t& dir, const std::vector<std::string>& filter) = 0;
Expand Down
Loading
Loading
0