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: 0 additions & 4 deletions framework/cmake/MuseSetupConfiguration.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ if (NOT MUSE_MODULE_MULTIWINDOWS)
set(MUSE_MODULE_MULTIWINDOWS_QML OFF) # Stub does not have QML
endif()

if (NOT MUSE_MODULE_UPDATE)
set(MUSE_MODULE_UPDATE_QML OFF) # Stub does not have QML
endif()

if (NOT MUSE_MODULE_VST)
set(MUSE_MODULE_VST_QML OFF) # Stub does not have QML
endif()
Expand Down
2 changes: 1 addition & 1 deletion framework/diagnostics/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ if (MUSE_MODULE_DIAGNOSTICS_CRASHPAD_CLIENT)
message(FATAL_ERROR "Crashpad handler not found: ${MUSE_MODULE_DIAGNOSTICS_CRASHPAD_HANDLER_PATH}")
endif()
if (OS_IS_LIN OR OS_IS_WIN OR OS_IS_MAC)
install(PROGRAMS ${MUSE_MODULE_DIAGNOSTICS_CRASHPAD_HANDLER_PATH} DESTINATION ${INSTALL_BIN_DIR})
install(PROGRAMS ${MUSE_MODULE_DIAGNOSTICS_CRASHPAD_HANDLER_PATH} DESTINATION ${INSTALL_SUBDIR})
endif()
endif() # MUSE_MODULE_DIAGNOSTICS_CRASHPAD_CLIENT
# ----------------
Expand Down
3 changes: 3 additions & 0 deletions framework/network/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,16 @@ target_sources(muse_network PRIVATE
inetworkmanager.h
inetworkmanagercreator.h
inetworkconfiguration.h
inetworkinformation.h

internal/networkmanager.cpp
internal/networkmanager.h
internal/networkmanagercreator.cpp
internal/networkmanagercreator.h
internal/networkconfiguration.cpp
internal/networkconfiguration.h
internal/networkinformation.cpp
internal/networkinformation.h
)

target_link_libraries(muse_network PUBLIC Qt::Network)
Expand Down
36 changes: 36 additions & 0 deletions framework/network/inetworkinformation.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-CLA-applies
*
* MuseScore Studio
* Music Composition & Notation
*
* Copyright (C) 2026 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
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once

#include "modularity/imoduleinterface.h"

namespace muse::network {
class INetworkInformation : MODULE_GLOBAL_INTERFACE
{
INTERFACE_ID(INetworkInformation)

public:
virtual ~INetworkInformation() = default;

virtual bool isMetered() const = 0;
};
}
41 changes: 41 additions & 0 deletions framework/network/internal/networkinformation.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-CLA-applies
*
* MuseScore Studio
* Music Composition & Notation
*
* Copyright (C) 2026 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
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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 "networkinformation.h"

#include <QNetworkInformation>

using namespace muse::network;

bool NetworkInformation::isMetered() const
{
QNetworkInformation* info = QNetworkInformation::instance();
if (!info) {
if (!QNetworkInformation::loadBackendByFeatures(QNetworkInformation::Features(QNetworkInformation::Feature::Metered))) {
//! NOTE: No backend able to report metering on this platform - assume unmetered
return false;
}

info = QNetworkInformation::instance();
}

return info && info->isMetered();
}
32 changes: 32 additions & 0 deletions framework/network/internal/networkinformation.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-CLA-applies
*
* MuseScore Studio
* Music Composition & Notation
*
* Copyright (C) 2026 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
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once

#include "inetworkinformation.h"

namespace muse::network {
class NetworkInformation : public INetworkInformation
{
public:
bool isMetered() const override;
};
}
8 changes: 7 additions & 1 deletion framework/network/internal/networkmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@

#include "networkerrors.h"

#include "log.h"

using namespace muse;
using namespace muse::network;
using namespace muse::async;
Expand Down Expand Up @@ -190,7 +192,11 @@ RetVal<Progress> NetworkManager::execRequest(RequestType requestType, const QUrl
return;
}

data.incomingData->write(data.reply->readAll());
const QByteArray chunk = data.reply->readAll();
if (data.incomingData->write(chunk) != chunk.size()) {
LOGE() << "failed to store incoming data: " << data.incomingData->errorString();
data.reply->abort();
}
});
}

Expand Down
2 changes: 2 additions & 0 deletions framework/network/networkmodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "modularity/ioc.h"
#include "internal/networkmanagercreator.h"
#include "internal/networkconfiguration.h"
#include "internal/networkinformation.h"

#include "global/api/iapiregister.h"

Expand All @@ -45,6 +46,7 @@ void NetworkModule::registerExports()

globalIoc()->registerExport<INetworkManagerCreator>(moduleName(), new NetworkManagerCreator());
globalIoc()->registerExport<INetworkConfiguration>(moduleName(), m_configuration);
globalIoc()->registerExport<INetworkInformation>(moduleName(), new NetworkInformation());
}

void NetworkModule::registerApi()
Expand Down
35 changes: 35 additions & 0 deletions framework/network/tests/mocks/networkinformationmock.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-CLA-applies
*
* MuseScore Studio
* Music Composition & Notation
*
* Copyright (C) 2026 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
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

#pragma once

#include <gmock/gmock.h>

#include "network/inetworkinformation.h"

namespace muse::network {
class NetworkInformationMock : public INetworkInformation
{
public:
MOCK_METHOD(bool, isMetered, (), (const, override));
};
}
2 changes: 2 additions & 0 deletions framework/stubs/network/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,6 @@ target_sources(muse_network PRIVATE
networkmanagerstub.h
networkconfigurationstub.cpp
networkconfigurationstub.h
networkinformationstub.cpp
networkinformationstub.h
)
29 changes: 29 additions & 0 deletions framework/stubs/network/networkinformationstub.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-CLA-applies
*
* MuseScore Studio
* Music Composition & Notation
*
* Copyright (C) 2026 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
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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 "networkinformationstub.h"

using namespace muse::network;

bool NetworkInformationStub::isMetered() const
{
return false;
}
32 changes: 32 additions & 0 deletions framework/stubs/network/networkinformationstub.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-CLA-applies
*
* MuseScore Studio
* Music Composition & Notation
*
* Copyright (C) 2026 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
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once

#include "network/inetworkinformation.h"

namespace muse::network {
class NetworkInformationStub : public INetworkInformation
{
public:
bool isMetered() const override;
};
}
2 changes: 2 additions & 0 deletions framework/stubs/network/networkstubmodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#include "networkmanagercreatorstub.h"
#include "networkconfigurationstub.h"
#include "networkinformationstub.h"

using namespace muse::network;
using namespace muse::modularity;
Expand All @@ -38,4 +39,5 @@ void NetworkModule::registerExports()
{
globalIoc()->registerExport<INetworkManagerCreator>(moduleName(), new NetworkManagerCreatorStub());
globalIoc()->registerExport<INetworkConfiguration>(moduleName(), new NetworkConfigurationStub());
globalIoc()->registerExport<INetworkInformation>(moduleName(), new NetworkInformationStub());
}
6 changes: 5 additions & 1 deletion framework/stubs/update/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,8 @@ target_sources(muse_update PRIVATE
appupdatescenariostub.h
appupdateservicestub.cpp
appupdateservicestub.h
)
)

if (MUSE_MODULE_UPDATE_QML)
add_subdirectory(qml/Muse/Update)
endif()
18 changes: 10 additions & 8 deletions framework/stubs/update/appupdatescenariostub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,26 @@ void AppUpdateScenarioStub::checkForUpdate(bool)
{
}

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

bool AppUpdateScenarioStub::hasReadyUpdate() const
{
return false;
}

muse::async::Notification AppUpdateScenarioStub::checkInProgressChanged() const
muse::async::Notification AppUpdateScenarioStub::hasReadyUpdateChanged() const
{
return {};
}

bool AppUpdateScenarioStub::hasUpdate() const
std::string AppUpdateScenarioStub::readyUpdateVersion() const
{
return false;
return {};
}

muse::async::Promise<muse::Ret> AppUpdateScenarioStub::showUpdate()
void AppUpdateScenarioStub::installReadyUpdate()
{
return muse::async::Promise<muse::Ret>([](auto /*resolve*/, auto reject) {
return reject(int(muse::Ret::Code::UnknownError), "stub");
});
}
10 changes: 6 additions & 4 deletions framework/stubs/update/appupdatescenariostub.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ class AppUpdateScenarioStub : public IAppUpdateScenario
bool needCheckForUpdate() const override;
void checkForUpdate(bool manual) override;

bool checkInProgress() const override;
async::Notification checkInProgressChanged() const override;

bool hasUpdate() const override;
muse::async::Promise<Ret> showUpdate() override;

bool hasReadyUpdate() const override;
async::Notification hasReadyUpdateChanged() const override;
std::string readyUpdateVersion() const override;

void installReadyUpdate() override;
};
}
25 changes: 25 additions & 0 deletions framework/stubs/update/appupdateservicestub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,28 @@ RetVal<Progress> AppUpdateServiceStub::downloadRelease()
{
return RetVal<Progress>::make_ret(Ret::Code::NotSupported);
}

bool AppUpdateServiceStub::canAutoInstall() const
{
return false;
}

RetVal<muse::io::path_t> AppUpdateServiceStub::prepareUpdate(const muse::io::path_t&)
{
return RetVal<muse::io::path_t>(make_ret(Ret::Code::NotSupported));
}

Ret AppUpdateServiceStub::finalizeUpdate(const muse::io::path_t&)
{
return make_ret(Ret::Code::NotSupported);
}

bool AppUpdateServiceStub::isReleaseDownloaded() const
{
return false;
}

muse::io::path_t AppUpdateServiceStub::downloadedReleasePath() const
{
return {};
}
Loading