Skip to content

Commit b1c009d

Browse files
committed
update 250528
1 parent 136de9c commit b1c009d

40 files changed

+598
-730
lines changed

framework/audioplugins/internal/registeraudiopluginsscenario.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,7 @@ Ret RegisterAudioPluginsScenario::registerNewPlugins()
7777

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

8582
m_aborted = false;
8683
m_progress.start();

framework/audioplugins/tests/registeraudiopluginsscenariotest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ TEST_F(AudioPlugins_RegisterAudioPluginsScenarioTest, RegisterNewPlugins)
155155

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

160160
// [THEN] Processes started only for unregistered plugins
161161
for (const path_t& pluginPath : foundPluginPaths) {

framework/autobot/internal/autobotinteractive.cpp

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ async::Promise<IInteractive::Result> AutobotInteractive::error(const std::string
9595
return m_real->error(contentTitle, text, buttons, defBtn, options, dialogTitle);
9696
}
9797

98-
Ret AutobotInteractive::showProgress(const std::string& title, Progress* progress) const
98+
void AutobotInteractive::showProgress(const std::string& title, Progress* progress)
9999
{
100-
return m_real->showProgress(title, progress);
100+
m_real->showProgress(title, progress);
101101
}
102102

103103
io::path_t AutobotInteractive::selectOpeningFile(const QString& title, const io::path_t& dir, const std::vector<std::string>& filter)
@@ -115,7 +115,7 @@ io::path_t AutobotInteractive::selectSavingFile(const QString& title, const io::
115115
}
116116

117117
LOGD() << title << " dir:" << dir << ", filter: " << filterList << ", confirmOverwrite: " << confirmOverwrite;
118-
m_real->open("muse://autobot/selectfile?sync=true&filePath=" + dir.toStdString());
118+
m_real->openSync("muse://autobot/selectfile?sync=true&filePath=" + dir.toStdString());
119119
m_selectedFilePath = dir;
120120
return m_selectedFilePath;
121121
}
@@ -141,27 +141,17 @@ bool AutobotInteractive::isSelectColorOpened() const
141141
return m_real->isSelectColorOpened();
142142
}
143143

144-
RetVal<Val> AutobotInteractive::open(const std::string& uri) const
144+
RetVal<Val> AutobotInteractive::openSync(const UriQuery& uri)
145145
{
146-
return m_real->open(uri);
147-
}
148-
149-
RetVal<Val> AutobotInteractive::open(const Uri& uri) const
150-
{
151-
return m_real->open(uri);
146+
return m_real->openSync(uri);
152147
}
153148

154-
RetVal<Val> AutobotInteractive::open(const UriQuery& uri) const
149+
async::Promise<Val> AutobotInteractive::open(const UriQuery& uri)
155150
{
156151
return m_real->open(uri);
157152
}
158153

159-
async::Promise<Val> AutobotInteractive::openAsync(const UriQuery& uri)
160-
{
161-
return m_real->openAsync(uri);
162-
}
163-
164-
RetVal<bool> AutobotInteractive::isOpened(const std::string& uri) const
154+
RetVal<bool> AutobotInteractive::isOpened(const UriQuery& uri) const
165155
{
166156
return m_real->isOpened(uri);
167157
}
@@ -171,11 +161,6 @@ RetVal<bool> AutobotInteractive::isOpened(const Uri& uri) const
171161
return m_real->isOpened(uri);
172162
}
173163

174-
RetVal<bool> AutobotInteractive::isOpened(const UriQuery& uri) const
175-
{
176-
return m_real->isOpened(uri);
177-
}
178-
179164
async::Channel<Uri> AutobotInteractive::opened() const
180165
{
181166
return m_real->opened();
@@ -186,7 +171,7 @@ void AutobotInteractive::raise(const UriQuery& uri)
186171
m_real->raise(uri);
187172
}
188173

189-
void AutobotInteractive::close(const std::string& uri)
174+
void AutobotInteractive::close(const UriQuery& uri)
190175
{
191176
m_real->close(uri);
192177
}
@@ -196,11 +181,6 @@ void AutobotInteractive::close(const Uri& uri)
196181
m_real->close(uri);
197182
}
198183

199-
void AutobotInteractive::close(const UriQuery& uri)
200-
{
201-
m_real->close(uri);
202-
}
203-
204184
void AutobotInteractive::closeAllDialogs()
205185
{
206186
m_real->closeAllDialogs();

framework/autobot/internal/autobotinteractive.h

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class AutobotInteractive : public IInteractive
6969
const std::string& dialogTitle = "") override;
7070

7171
// progress
72-
Ret showProgress(const std::string& title, Progress* progress) const override;
72+
void showProgress(const std::string& title, Progress* progress) override;
7373

7474
// files
7575
io::path_t selectOpeningFile(const QString& title, const io::path_t& dir, const std::vector<std::string>& filter) override;
@@ -85,20 +85,16 @@ class AutobotInteractive : public IInteractive
8585
bool isSelectColorOpened() const override;
8686

8787
// custom
88-
RetVal<Val> open(const std::string& uri) const override;
89-
RetVal<Val> open(const Uri& uri) const override;
90-
RetVal<Val> open(const UriQuery& uri) const override;
91-
async::Promise<Val> openAsync(const UriQuery& uri) override;
92-
RetVal<bool> isOpened(const std::string& uri) const override;
93-
RetVal<bool> isOpened(const Uri& uri) const override;
88+
RetVal<Val> openSync(const UriQuery& uri) override;
89+
async::Promise<Val> open(const UriQuery& uri) override;
9490
RetVal<bool> isOpened(const UriQuery& uri) const override;
91+
RetVal<bool> isOpened(const Uri& uri) const override;
9592
async::Channel<Uri> opened() const override;
9693

9794
void raise(const UriQuery& uri) override;
9895

99-
void close(const std::string& uri) override;
100-
void close(const Uri& uri) override;
10196
void close(const UriQuery& uri) override;
97+
void close(const Uri& uri) override;
10298
void closeAllDialogs() override;
10399

104100
ValCh<Uri> currentUri() const override;

framework/cloud/internal/abstractcloudservice.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ RetVal<Val> AbstractCloudService::ensureAuthorization(bool publishingScore, cons
309309
query.addParam("text", Val(text));
310310
query.addParam("cloudCode", Val(cloudInfo().code));
311311
query.addParam("publishingScore", Val(publishingScore));
312-
return interactive()->open(query);
312+
return interactive()->openSync(query);
313313
}
314314

315315
ValCh<bool> AbstractCloudService::userAuthorized() const

framework/extensions/internal/extensionsprovider.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ muse::Ret ExtensionsProvider::perform(const UriQuery& uri)
151151
if (!q.contains("modal")) {
152152
q.addParam("modal", Val(a.modal));
153153
}
154-
return interactive()->open(q).ret;
154+
return interactive()->openSync(q).ret;
155155
} break;
156156
case Type::Macros:
157157
return run(uri);

framework/extensions/view/extensionslistmodel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ void ExtensionsListModel::editShortcut(const QString& extensionUri)
207207
params["shortcutCodeKey"] = actionCodeBase;
208208
preferencesUri.addParam("params", Val::fromQVariant(params));
209209

210-
RetVal<Val> retVal = interactive()->open(preferencesUri);
210+
RetVal<Val> retVal = interactive()->openSync(preferencesUri);
211211

212212
if (!retVal.ret) {
213213
LOGE() << retVal.ret.toString();

framework/global/async/promise.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,12 @@ namespace muse::async {
2828
template<typename ... T>
2929
using Promise = kors::async::Promise<T...>;
3030

31+
using PromiseType = kors::async::PromiseType;
32+
3133
template<typename ... T>
32-
constexpr auto make_promise = kors::async::make_promise<T...>;
34+
auto make_promise = [](typename Promise<T...>::Body f, PromiseType type = PromiseType::AsyncByPromise) {
35+
return kors::async::make_promise<T...>(f, type);
36+
};
3337
}
3438

3539
#endif // MUSE_ASYNC_PROMISE_H

framework/global/iinteractive.h

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,12 @@ class IInteractive : MODULE_EXPORT_INTERFACE
186186

187187
// warning
188188
virtual async::Promise<Result> warning(const std::string& contentTitle, const Text& text, const ButtonDatas& buttons = {},
189-
int defBtn = int(Button::NoButton), const Options& options = {},
189+
int defBtn = int(Button::NoButton), const Options& options = { WithIcon },
190190
const std::string& dialogTitle = "") = 0;
191191

192192
async::Promise<Result> warning(const std::string& contentTitle, const std::string& text, const Buttons& buttons,
193-
Button defBtn = Button::NoButton, const Options& options = {}, const std::string& dialogTitle = "")
193+
Button defBtn = Button::NoButton, const Options& options = { WithIcon },
194+
const std::string& dialogTitle = "")
194195
{
195196
return warning(contentTitle, Text(text), buttonDataList(buttons), (int)defBtn, options, dialogTitle);
196197
}
@@ -208,7 +209,7 @@ class IInteractive : MODULE_EXPORT_INTERFACE
208209
}
209210

210211
// progress
211-
virtual Ret showProgress(const std::string& title, Progress* progress) const = 0;
212+
virtual void showProgress(const std::string& title, Progress* progress) = 0;
212213

213214
// files
214215
virtual io::path_t selectOpeningFile(const QString& title, const io::path_t& dir, const std::vector<std::string>& filter) = 0;
@@ -224,22 +225,17 @@ class IInteractive : MODULE_EXPORT_INTERFACE
224225
virtual bool isSelectColorOpened() const = 0;
225226

226227
// custom
227-
virtual RetVal<Val> open(const std::string& uri) const = 0;
228-
virtual RetVal<Val> open(const Uri& uri) const = 0;
229-
virtual RetVal<Val> open(const UriQuery& uri) const = 0;
230-
virtual async::Promise<Val> openAsync(const UriQuery& uri) = 0;
231-
async::Promise<Val> openAsync(const std::string& uri) { return openAsync(UriQuery(uri)); }
232-
async::Promise<Val> openAsync(const Uri& uri) { return openAsync(UriQuery(uri)); }
233-
virtual RetVal<bool> isOpened(const std::string& uri) const = 0;
234-
virtual RetVal<bool> isOpened(const Uri& uri) const = 0;
228+
virtual async::Promise<Val> open(const UriQuery& uri) = 0;
229+
async::Promise<Val> open(const std::string& uri) { return open(UriQuery(uri)); }
230+
async::Promise<Val> open(const Uri& uri) { return open(UriQuery(uri)); }
235231
virtual RetVal<bool> isOpened(const UriQuery& uri) const = 0;
232+
virtual RetVal<bool> isOpened(const Uri& uri) const = 0;
236233
virtual async::Channel<Uri> opened() const = 0;
237234

238235
virtual void raise(const UriQuery& uri) = 0;
239236

240-
virtual void close(const std::string& uri) = 0;
241-
virtual void close(const Uri& uri) = 0;
242237
virtual void close(const UriQuery& uri) = 0;
238+
virtual void close(const Uri& uri) = 0;
243239
virtual void closeAllDialogs() = 0;
244240

245241
virtual ValCh<Uri> currentUri() const = 0;
@@ -257,7 +253,9 @@ class IInteractive : MODULE_EXPORT_INTERFACE
257253
/// and selects the file at filePath on OSs that support it
258254
virtual Ret revealInFileBrowser(const io::path_t& filePath) const = 0;
259255

256+
//! =================================
260257
//! NOTE Please don't use this
258+
//! =================================
261259
virtual Result questionSync(const std::string& contentTitle, const Text& text, const ButtonDatas& buttons,
262260
int defBtn = int(Button::NoButton), const Options& options = {}, const std::string& dialogTitle = "") = 0;
263261

@@ -277,12 +275,13 @@ class IInteractive : MODULE_EXPORT_INTERFACE
277275
}
278276

279277
virtual Result warningSync(const std::string& contentTitle, const Text& text, const ButtonDatas& buttons = {},
280-
int defBtn = int(Button::NoButton), const Options& options = {}, const std::string& dialogTitle = "") = 0;
278+
int defBtn = int(Button::NoButton), const Options& options = { WithIcon },
279+
const std::string& dialogTitle = "") = 0;
281280

282281
Result warningSync(const std::string& contentTitle, const std::string& text, const Buttons& buttons,
283-
const Button& defBtn = Button::NoButton, const Options& options = {}, const std::string& dialogTitle = "")
282+
const Button& defBtn = Button::NoButton, const Options& options = { WithIcon }, const std::string& dialogTitle = "")
284283
{
285-
return infoSync(contentTitle, Text(text), buttonDataList(buttons), (int)defBtn, options, dialogTitle);
284+
return warningSync(contentTitle, Text(text), buttonDataList(buttons), (int)defBtn, options, dialogTitle);
286285
}
287286

288287
virtual Result errorSync(const std::string& contentTitle, const Text& text, const ButtonDatas& buttons = {},
@@ -292,8 +291,13 @@ class IInteractive : MODULE_EXPORT_INTERFACE
292291
Result errorSync(const std::string& contentTitle, const std::string& text, const Buttons& buttons,
293292
const Button& defBtn = Button::NoButton, const Options& options = { WithIcon }, const std::string& dialogTitle = "")
294293
{
295-
return infoSync(contentTitle, Text(text), buttonDataList(buttons), (int)defBtn, options, dialogTitle);
294+
return errorSync(contentTitle, Text(text), buttonDataList(buttons), (int)defBtn, options, dialogTitle);
296295
}
296+
297+
virtual RetVal<Val> openSync(const UriQuery& uri) = 0;
298+
RetVal<Val> openSync(const std::string& uri) { return openSync(UriQuery(uri)); }
299+
RetVal<Val> openSync(const Uri& uri) { return openSync(UriQuery(uri)); }
300+
//! ==============================
297301
};
298302
DECLARE_OPERATORS_FOR_FLAGS(IInteractive::Options)
299303
}

0 commit comments

Comments
 (0)