Skip to content
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
1 change: 1 addition & 0 deletions framework/global/modularity/imodulesetup.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class IContextSetup
virtual void onPreInit(const IApplication::RunMode& mode) { (void)mode; }
virtual void onInit(const IApplication::RunMode& mode) { (void)mode; }
virtual void onAllInited(const IApplication::RunMode& mode) { (void)mode; }
virtual void onDelayedInit() {}
virtual void onDeinit() {}
virtual void onDestroy() {}

Expand Down
4 changes: 0 additions & 4 deletions framework/stubs/update/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,3 @@ target_sources(muse_update PRIVATE
appupdateservicestub.cpp
appupdateservicestub.h
)

if (MUSE_MODULE_UPDATE_QML)
add_subdirectory(qml/Muse/Update)
endif()
46 changes: 0 additions & 46 deletions framework/stubs/update/appupdatescenariostub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,49 +31,3 @@ bool AppUpdateScenarioStub::needCheckForUpdate() const
void AppUpdateScenarioStub::checkForUpdate(bool)
{
}

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

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

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

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

void AppUpdateScenarioStub::installReadyUpdate()
{
}

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

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

void AppUpdateScenarioStub::dismissCompletedUpdate()
{
}

void AppUpdateScenarioStub::showReadyUpdateInfo()
{
}

void AppUpdateScenarioStub::dismissReadyUpdate()
{
}
14 changes: 0 additions & 14 deletions framework/stubs/update/appupdatescenariostub.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,5 @@ class AppUpdateScenarioStub : public IAppUpdateScenario
public:
bool needCheckForUpdate() const override;
void checkForUpdate(bool manual) override;

bool hasUpdate() const override;

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

void installReadyUpdate() override;
void showReadyUpdateInfo() override;
void dismissReadyUpdate() override;

bool hasCompletedUpdate() const override;
async::Notification hasCompletedUpdateChanged() const override;
void dismissCompletedUpdate() override;
};
}
9 changes: 2 additions & 7 deletions framework/stubs/update/appupdateservicestub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,12 @@ 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&)
Ret AppUpdateServiceStub::installUpdate()
{
return make_ret(Ret::Code::NotSupported);
}

bool AppUpdateServiceStub::isReleaseDownloaded() const
bool AppUpdateServiceStub::isReleaseReadyToInstall() const
{
return false;
}
Expand Down
5 changes: 2 additions & 3 deletions framework/stubs/update/appupdateservicestub.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@ class AppUpdateServiceStub : public IAppUpdateService
RetVal<Progress> downloadRelease() override;

bool canAutoInstall() const override;
RetVal<muse::io::path_t> prepareUpdate(const muse::io::path_t& packagePath) override;
Ret finalizeUpdate(const muse::io::path_t& preparedPath) override;
Ret installUpdate() override;

bool isReleaseDownloaded() const override;
bool isReleaseReadyToInstall() const override;
muse::io::path_t downloadedReleasePath() const override;
void removeDownloadedRelease() override;
};
Expand Down
30 changes: 0 additions & 30 deletions framework/stubs/update/qml/Muse/Update/CMakeLists.txt

This file was deleted.

29 changes: 0 additions & 29 deletions framework/stubs/update/qml/Muse/Update/UpdateBanner.qml

This file was deleted.

4 changes: 2 additions & 2 deletions framework/stubs/update/updateconfigurationstub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ muse::async::Notification UpdateConfigurationStub::needCheckForUpdateChanged() c
return n;
}

bool UpdateConfigurationStub::autoDownloadEnabled() const
bool UpdateConfigurationStub::autoUpdateEnabled() const
{
return false;
}

void UpdateConfigurationStub::setAutoDownloadEnabled(bool)
void UpdateConfigurationStub::setAutoUpdateEnabled(bool)
{
}

Expand Down
4 changes: 2 additions & 2 deletions framework/stubs/update/updateconfigurationstub.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class UpdateConfigurationStub : public IUpdateConfiguration
void setNeedCheckForUpdate(bool needCheck) override;
muse::async::Notification needCheckForUpdateChanged() const override;

bool autoDownloadEnabled() const override;
void setAutoDownloadEnabled(bool enabled) override;
bool autoUpdateEnabled() const override;
void setAutoUpdateEnabled(bool enabled) override;

std::string skippedReleaseVersion() const override;
void setSkippedReleaseVersion(const std::string& version) override;
Expand Down
26 changes: 25 additions & 1 deletion framework/ui/internal/guiapplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

#include "guiapplication.h"

#include <algorithm>

#include <QTimer>
#include <QQuickWindow>
#include <QQmlApplicationEngine>
Expand All @@ -38,6 +40,8 @@
using namespace muse;
using namespace muse::ui;

static constexpr int DELAYED_INIT_INTERVAL_MS = 5000;

GuiApplication::GuiApplication(const std::shared_ptr<CmdOptions>& options)
: BaseApplication(options)
{
Expand All @@ -51,7 +55,7 @@ void GuiApplication::doSetup(const std::shared_ptr<CmdOptions>& options)
// Setup modules: onDelayedInit
// ====================================================
m_delayedInitTimer.setSingleShot(true);
m_delayedInitTimer.setInterval(5000);
m_delayedInitTimer.setInterval(DELAYED_INIT_INTERVAL_MS);
QObject::connect(&m_delayedInitTimer, &QTimer::timeout, [this]() {
m_globalModule->onDelayedInit();
for (modularity::IModuleSetup* m : m_modules) {
Expand Down Expand Up @@ -123,11 +127,31 @@ void GuiApplication::startupScenario(const muse::modularity::ContextPtr& ctxId)
if (ok) {
QMetaObject::invokeMethod(qApp, [this, ctxId]() {
doStartupScenario(ctxId);

QTimer::singleShot(DELAYED_INIT_INTERVAL_MS, qApp, [this, ctxId]() {
contextDelayedInit(ctxId);
});
}, Qt::QueuedConnection);
}
}, Qt::QueuedConnection);
}

void GuiApplication::contextDelayedInit(const muse::modularity::ContextPtr& ctxId)
{
//! NOTE: The context may have been destroyed (its window closed) in the meantime
auto it = std::find_if(m_contexts.begin(), m_contexts.end(), [&ctxId](const ContextData& c) {
return c.ctxId->id == ctxId->id;
});

if (it == m_contexts.end()) {
return;
}

for (modularity::IContextSetup* s : it->setups) {
s->onDelayedInit();
}
}

bool GuiApplication::loadMainWindow(const muse::modularity::ContextPtr& ctxId)
{
TRACEFUNC;
Expand Down
1 change: 1 addition & 0 deletions framework/ui/internal/guiapplication.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class GuiApplication : public BaseApplication
void setupGraphicsApi();

void startupScenario(const muse::modularity::ContextPtr& ctxId) override;
void contextDelayedInit(const muse::modularity::ContextPtr& ctxId);

virtual QString mainWindowQmlPath(const QString& platform) const = 0;
virtual bool loadMainWindow(const muse::modularity::ContextPtr& ctxId);
Expand Down
20 changes: 0 additions & 20 deletions framework/update/iappupdatescenario.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

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

#include "modularity/imoduleinterface.h"

Expand All @@ -38,24 +37,5 @@ class IAppUpdateScenario : MODULE_CONTEXT_INTERFACE

virtual bool needCheckForUpdate() const = 0;
virtual void checkForUpdate(bool manual) = 0;

virtual bool hasUpdate() const = 0;

//! A downloaded update is ready to be installed in-place.
virtual bool hasReadyUpdate() const = 0;
virtual async::Notification hasReadyUpdateChanged() const = 0;
virtual std::string readyUpdateVersion() const = 0;

//! Install the already-downloaded update (asks to restart, then applies it).
virtual void installReadyUpdate() = 0;
//! Show the release notes of the ready update, with install/skip actions.
virtual void showReadyUpdateInfo() = 0;
//! Hide the ready update banner for this session (the package is kept).
virtual void dismissReadyUpdate() = 0;

//! This launch is the first one after an update was installed.
virtual bool hasCompletedUpdate() const = 0;
virtual async::Notification hasCompletedUpdateChanged() const = 0;
virtual void dismissCompletedUpdate() = 0;
};
}
5 changes: 2 additions & 3 deletions framework/update/iappupdateservice.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,12 @@ class IAppUpdateService : MODULE_CONTEXT_INTERFACE
virtual const RetVal<ReleaseInfo>& lastCheckResult() const = 0;
virtual RetVal<Progress> downloadRelease() = 0;

virtual bool isReleaseDownloaded() const = 0;
virtual bool isReleaseReadyToInstall() const = 0;
virtual muse::io::path_t downloadedReleasePath() const = 0;
virtual void removeDownloadedRelease() = 0;

virtual bool canAutoInstall() const = 0;

virtual RetVal<muse::io::path_t> prepareUpdate(const muse::io::path_t& packagePath) = 0;
virtual Ret finalizeUpdate(const muse::io::path_t& preparedPath) = 0;
virtual Ret installUpdate() = 0;
};
}
Loading