Skip to content
Open
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
4 changes: 2 additions & 2 deletions src/appshell/internal/startupscenario.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include "project/iprojectautosaver.h"
#include "audioplugins/iregisteraudiopluginsscenario.h"

#include "update/iupdatescenario.h"
#include "update/iappupdatescenario.h"
#include "musesounds/imusesoundscheckupdatescenario.h"
#include "musesounds/imusesamplercheckupdatescenario.h"

Expand All @@ -50,7 +50,7 @@ class StartupScenario : public IStartupScenario, public muse::Injectable, public
muse::Inject<project::IProjectAutoSaver> projectAutoSaver = { this };
muse::Inject<muse::audioplugins::IRegisterAudioPluginsScenario> registerAudioPluginsScenario = { this };

muse::Inject<muse::update::IUpdateScenario> appUpdateScenario = { this };
muse::Inject<muse::update::IAppUpdateScenario> appUpdateScenario = { this };
muse::Inject<mu::musesounds::IMuseSoundsCheckUpdateScenario> museSoundsUpdateScenario = { this };
muse::Inject<musesounds::IMuseSamplerCheckUpdateScenario> museSamplerCheckForUpdateScenario = { this };

Expand Down
5 changes: 5 additions & 0 deletions src/framework/global/async/processevents.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
#include "../thirdparty/kors_async/async/processevents.h"

namespace muse::async {
inline void processMessages()
{
kors::async::processMessages();
}

inline void processMessages(const std::thread::id& th)
{
kors::async::processMessages(th);
Expand Down
28 changes: 11 additions & 17 deletions src/framework/network/tests/mocks/networkmanagermock.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2024 MuseScore Limited and others
* Copyright (C) 2025 MuseScore Limited and others
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
Expand All @@ -19,28 +19,22 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MUSE_NETWORK_NETWORKMANAGERMOCK_H
#define MUSE_NETWORK_NETWORKMANAGERMOCK_H

#pragma once

#include <gmock/gmock.h>

#include "network/deprecated/inetworkmanager.h"
#include "network/inetworkmanager.h"

namespace muse::network::deprecated {
namespace muse::network {
class NetworkManagerMock : public INetworkManager
{
public:
MOCK_METHOD(Ret, get, (const QUrl&, IncomingDevice*, const RequestHeaders&), (override));
MOCK_METHOD(Ret, head, (const QUrl&, const RequestHeaders&), (override));
MOCK_METHOD(Ret, post, (const QUrl&, OutgoingDevice*, IncomingDevice*, const RequestHeaders&), (override));
MOCK_METHOD(Ret, put, (const QUrl&, OutgoingDevice*, IncomingDevice*, const RequestHeaders&), (override));
MOCK_METHOD(Ret, patch, (const QUrl&, OutgoingDevice*, IncomingDevice*, const RequestHeaders&), (override));
MOCK_METHOD(Ret, del, (const QUrl&, IncomingDevice*, const RequestHeaders&), (override));

MOCK_METHOD(Progress, progress, (), (const, override));

MOCK_METHOD(void, abort, (), (override));
MOCK_METHOD(RetVal<Progress>, get, (const QUrl&, IncomingDevicePtr, const RequestHeaders&), (override));
MOCK_METHOD(RetVal<Progress>, head, (const QUrl&, const RequestHeaders&), (override));
MOCK_METHOD(RetVal<Progress>, post, (const QUrl&, OutgoingDeviceVar, IncomingDevicePtr, const RequestHeaders&), (override));
MOCK_METHOD(RetVal<Progress>, put, (const QUrl&, OutgoingDeviceVar, IncomingDevicePtr, const RequestHeaders&), (override));
MOCK_METHOD(RetVal<Progress>, patch, (const QUrl&, OutgoingDeviceVar, IncomingDevicePtr, const RequestHeaders&), (override));
MOCK_METHOD(RetVal<Progress>, del, (const QUrl&, IncomingDevicePtr, const RequestHeaders&), (override));
};
}

#endif // MUSE_NETWORK_NETWORKMANAGERMOCK_H
8 changes: 4 additions & 4 deletions src/framework/stubs/update/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ set(MODULE_SRC
${CMAKE_CURRENT_LIST_DIR}/updatestubmodule.h
${CMAKE_CURRENT_LIST_DIR}/updateconfigurationstub.cpp
${CMAKE_CURRENT_LIST_DIR}/updateconfigurationstub.h
${CMAKE_CURRENT_LIST_DIR}/updatescenariostub.cpp
${CMAKE_CURRENT_LIST_DIR}/updatescenariostub.h
${CMAKE_CURRENT_LIST_DIR}/updateservicestub.cpp
${CMAKE_CURRENT_LIST_DIR}/updateservicestub.h
${CMAKE_CURRENT_LIST_DIR}/appupdatescenariostub.cpp
${CMAKE_CURRENT_LIST_DIR}/appupdatescenariostub.h
${CMAKE_CURRENT_LIST_DIR}/appupdateservicestub.cpp
${CMAKE_CURRENT_LIST_DIR}/appupdateservicestub.h
)

set(MODULE_IS_STUB ON)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2021 MuseScore Limited and others
* Copyright (C) 2025 MuseScore Limited and others
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
Expand All @@ -19,28 +19,28 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "updatescenariostub.h"
#include "appupdatescenariostub.h"

using namespace muse::update;

bool UpdateScenarioStub::needCheckForUpdate() const
bool AppUpdateScenarioStub::needCheckForUpdate() const
{
return false;
}

muse::async::Promise<muse::Ret> UpdateScenarioStub::checkForUpdate(bool)
muse::async::Promise<muse::Ret> AppUpdateScenarioStub::checkForUpdate(bool)
{
return muse::async::Promise<muse::Ret>([](auto /*resolve*/, auto reject) {
return reject(int(muse::Ret::Code::UnknownError), "stub");
});
}

bool UpdateScenarioStub::hasUpdate() const
bool AppUpdateScenarioStub::hasUpdate() const
{
return false;
}

muse::async::Promise<muse::Ret> UpdateScenarioStub::showUpdate()
muse::async::Promise<muse::Ret> AppUpdateScenarioStub::showUpdate()
{
return muse::async::Promise<muse::Ret>([](auto /*resolve*/, auto reject) {
return reject(int(muse::Ret::Code::UnknownError), "stub");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2021 MuseScore Limited and others
* Copyright (C) 2025 MuseScore Limited and others
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
Expand All @@ -19,13 +19,13 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MU_APPSHELL_UPDATESCENARIOSTUB_H
#define MU_APPSHELL_UPDATESCENARIOSTUB_H

#include "update/iupdatescenario.h"
#pragma once

#include "update/iappupdatescenario.h"

namespace muse::update {
class UpdateScenarioStub : public IUpdateScenario
class AppUpdateScenarioStub : public IAppUpdateScenario
{
public:
bool needCheckForUpdate() const override;
Expand All @@ -35,5 +35,3 @@ class UpdateScenarioStub : public IUpdateScenario
muse::async::Promise<Ret> showUpdate() override;
};
}

#endif // MU_APPSHELL_UPDATESCENARIOSTUB_H
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2021 MuseScore Limited and others
* Copyright (C) 2025 MuseScore Limited and others
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
Expand All @@ -19,31 +19,26 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "updateservicestub.h"
#include "appupdateservicestub.h"

using namespace muse;
using namespace muse::update;
using namespace muse::async;

RetVal<ReleaseInfo> UpdateServiceStub::checkForUpdate()
Promise<RetVal<ReleaseInfo> > AppUpdateServiceStub::checkForUpdate()
{
return make_ret(Ret::Code::NotSupported);
return Promise<RetVal<ReleaseInfo> >([this](auto resolve, auto) {
return resolve(make_ret(Ret::Code::NotSupported));
});
}

RetVal<ReleaseInfo> UpdateServiceStub::lastCheckResult() const
const RetVal<ReleaseInfo>& AppUpdateServiceStub::lastCheckResult() const
{
return make_ret(Ret::Code::NotSupported);
static const auto dummyInfo = RetVal<ReleaseInfo>::make_ret(Ret::Code::NotSupported);
return dummyInfo;
}

RetVal<io::path_t> UpdateServiceStub::downloadRelease()
RetVal<Progress> AppUpdateServiceStub::downloadRelease()
{
return make_ret(Ret::Code::NotSupported);
}

void UpdateServiceStub::cancelUpdate()
{
}

Progress UpdateServiceStub::updateProgress()
{
return Progress();
return RetVal<Progress>::make_ret(Ret::Code::NotSupported);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2021 MuseScore Limited and others
* Copyright (C) 2025 MuseScore Limited and others
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
Expand All @@ -19,22 +19,17 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MUSE_UPDATE_UPDATESERVICESTUB_H
#define MUSE_UPDATE_UPDATESERVICESTUB_H

#pragma once

#include "update/iappupdateservice.h"

namespace muse::update {
class UpdateServiceStub : public IAppUpdateService
class AppUpdateServiceStub : public IAppUpdateService
{
public:
RetVal<ReleaseInfo> checkForUpdate() override;
RetVal<ReleaseInfo> lastCheckResult() const override;

RetVal<io::path_t> downloadRelease() override;
void cancelUpdate() override;
Progress updateProgress() override;
async::Promise<muse::RetVal<ReleaseInfo> > checkForUpdate() override;
const RetVal<ReleaseInfo>& lastCheckResult() const override;
RetVal<Progress> downloadRelease() override;
};
}

#endif // MUSE_UPDATE_UPDATESERVICESTUB_H
17 changes: 7 additions & 10 deletions src/framework/stubs/update/updatestubmodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2021 MuseScore Limited and others
* Copyright (C) 2025 MuseScore Limited and others
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
Expand All @@ -23,25 +23,22 @@

#include "modularity/ioc.h"

#include "appupdatescenariostub.h"
#include "appupdateservicestub.h"

#include "updateconfigurationstub.h"
#include "updatescenariostub.h"
#include "updateservicestub.h"

using namespace muse::update;
using namespace muse::modularity;

static std::shared_ptr<UpdateScenarioStub> s_scenario = std::make_shared<UpdateScenarioStub>();
static std::shared_ptr<UpdateServiceStub> s_service = std::make_shared<UpdateServiceStub>();
static std::shared_ptr<UpdateConfigurationStub> s_configuration = std::make_shared<UpdateConfigurationStub>();

std::string UpdateModule::moduleName() const
{
return "update_stub";
}

void UpdateModule::registerExports()
{
ioc()->registerExport<IUpdateScenario>(moduleName(), s_scenario);
ioc()->registerExport<IAppUpdateService>(moduleName(), s_service);
ioc()->registerExport<IUpdateConfiguration>(moduleName(), s_configuration);
ioc()->registerExport<IAppUpdateService>(moduleName(), std::make_shared<AppUpdateServiceStub>());
ioc()->registerExport<IAppUpdateScenario>(moduleName(), std::make_shared<AppUpdateScenarioStub>());
ioc()->registerExport<IUpdateConfiguration>(moduleName(), std::make_shared<UpdateConfigurationStub>());
}
8 changes: 3 additions & 5 deletions src/framework/stubs/update/updatestubmodule.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2021 MuseScore Limited and others
* Copyright (C) 2025 MuseScore Limited and others
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
Expand All @@ -19,8 +19,8 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MUSE_UPDATE_UPDATESTUBMODULE_H
#define MUSE_UPDATE_UPDATESTUBMODULE_H

#pragma once

#include "modularity/imodulesetup.h"

Expand All @@ -32,5 +32,3 @@ class UpdateModule : public modularity::IModuleSetup
void registerExports() override;
};
}

#endif // MUSE_UPDATE_UPDATESTUBMODULE_H
10 changes: 5 additions & 5 deletions src/framework/update/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,22 @@ set(MODULE_SRC
${CMAKE_CURRENT_LIST_DIR}/updatetypes.h
${CMAKE_CURRENT_LIST_DIR}/updateerrors.h
${CMAKE_CURRENT_LIST_DIR}/iupdateconfiguration.h
${CMAKE_CURRENT_LIST_DIR}/iupdatescenario.h
${CMAKE_CURRENT_LIST_DIR}/iappupdatescenario.h
${CMAKE_CURRENT_LIST_DIR}/iappupdateservice.h

${CMAKE_CURRENT_LIST_DIR}/internal/updateconfiguration.cpp
${CMAKE_CURRENT_LIST_DIR}/internal/updateconfiguration.h
${CMAKE_CURRENT_LIST_DIR}/internal/updatescenario.cpp
${CMAKE_CURRENT_LIST_DIR}/internal/updatescenario.h
${CMAKE_CURRENT_LIST_DIR}/internal/updateuiactions.cpp
${CMAKE_CURRENT_LIST_DIR}/internal/updateuiactions.h
${CMAKE_CURRENT_LIST_DIR}/internal/updateactioncontroller.cpp
${CMAKE_CURRENT_LIST_DIR}/internal/updateactioncontroller.h
${CMAKE_CURRENT_LIST_DIR}/internal/appupdatescenario.cpp
${CMAKE_CURRENT_LIST_DIR}/internal/appupdatescenario.h
${CMAKE_CURRENT_LIST_DIR}/internal/appupdateservice.cpp
${CMAKE_CURRENT_LIST_DIR}/internal/appupdateservice.h

${CMAKE_CURRENT_LIST_DIR}/view/updatemodel.cpp
${CMAKE_CURRENT_LIST_DIR}/view/updatemodel.h
${CMAKE_CURRENT_LIST_DIR}/view/appupdatemodel.cpp
${CMAKE_CURRENT_LIST_DIR}/view/appupdatemodel.h
)

if (QT_SUPPORT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2021 MuseScore Limited and others
* Copyright (C) 2025 MuseScore Limited and others
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
Expand All @@ -19,29 +19,26 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MUSE_UPDATE_IUPDATESCENARIO_H
#define MUSE_UPDATE_IUPDATESCENARIO_H

#pragma once

#include "types/ret.h"
#include "async/promise.h"

#include "modularity/imoduleinterface.h"

namespace muse::update {
class IUpdateScenario : MODULE_EXPORT_INTERFACE
class IAppUpdateScenario : MODULE_EXPORT_INTERFACE
{
INTERFACE_ID(IUpdateScenario)
INTERFACE_ID(IAppUpdateScenario)

public:
using CheckForUpdateCompleteCallback = std::function<void ()>;
virtual ~IAppUpdateScenario() = default;

virtual ~IUpdateScenario() = default;
virtual bool needCheckForUpdate() const = 0;
virtual muse::async::Promise<Ret> checkForUpdate(bool manual) = 0;
virtual async::Promise<Ret> checkForUpdate(bool manual) = 0;

virtual bool hasUpdate() const = 0;
virtual muse::async::Promise<Ret> showUpdate() = 0;
virtual async::Promise<Ret> showUpdate() = 0;
};
}

#endif // MUSE_UPDATE_IUPDATESCENARIO_H
Loading
Loading