Skip to content

Commit

Permalink
implemented tours system
Browse files Browse the repository at this point in the history
  • Loading branch information
Eism committed Jan 31, 2025
1 parent 559bf1e commit a04b5ff
Show file tree
Hide file tree
Showing 57 changed files with 1,600 additions and 15 deletions.
4 changes: 4 additions & 0 deletions src/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ if (MUSE_MODULE_UI)
list(APPEND LINK_LIB muse::dockwindow)
endif()

if (MUSE_MODULE_TOURS)
list(APPEND LINK_LIB muse::tours)
endif()

if (MUSE_MODULE_AUDIOPLUGINS)
list(APPEND LINK_LIB muse::audioplugins)
endif()
Expand Down
8 changes: 8 additions & 0 deletions src/app/appfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@
#include "framework/stubs/shortcuts/shortcutsstubmodule.h"
#endif

#ifdef MUSE_MODULE_TOURS
#include "framework/tours/toursmodule.h"
#else
#include "framework/stubs/tours/toursstubmodule.h"
#endif

#ifdef MUSE_MODULE_UI
#include "framework/dockwindow/dockmodule.h"
#include "framework/ui/uimodule.h"
Expand Down Expand Up @@ -254,6 +260,7 @@ std::shared_ptr<muse::IApplication> AppFactory::newGuiApp(const CmdOptions& opti
app->addModule(new muse::uicomponents::UiComponentsModule());
app->addModule(new muse::dock::DockModule());
#endif
app->addModule(new muse::tours::ToursModule());
app->addModule(new muse::vst::VSTModule());

// modules
Expand Down Expand Up @@ -360,6 +367,7 @@ std::shared_ptr<muse::IApplication> AppFactory::newConsoleApp(const CmdOptions&
app->addModule(new muse::uicomponents::UiComponentsModule());
app->addModule(new muse::dock::DockModule());
#endif
app->addModule(new muse::tours::ToursModule());
app->addModule(new muse::vst::VSTModule());

// modules
Expand Down
4 changes: 4 additions & 0 deletions src/appshell/qml/AppWindow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import Muse.Ui 1.0
import Muse.Shortcuts 1.0
import MuseScore.AppShell 1.0

import Muse.Tours 1.0

ApplicationWindow {
id: root

Expand Down Expand Up @@ -69,6 +71,8 @@ ApplicationWindow {

ToolTipProvider { }

ToursProvider { }

//! NOTE Need only create
Shortcuts { }

Expand Down
4 changes: 4 additions & 0 deletions src/framework/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ if (MUSE_MODULE_SHORTCUTS)
add_subdirectory(shortcuts)
endif()

if (MUSE_MODULE_TOURS)
add_subdirectory(tours)
endif()

if (MUSE_MODULE_MULTIINSTANCES)
add_subdirectory(multiinstances)
endif()
Expand Down
2 changes: 2 additions & 0 deletions src/framework/cmake/MuseDeclareOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ option(MUSE_MODULE_NETWORK_WEBSOCKET "Enable websocket support" OFF)

declare_muse_module_opt(SHORTCUTS ON)

declare_muse_module_opt(TOURS ON)

declare_muse_module_opt(UI ON)
option(MUSE_MODULE_UI_DISABLE_MODALITY "Disable dialogs modality for testing purpose" OFF)

Expand Down
4 changes: 4 additions & 0 deletions src/framework/cmake/muse_framework_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@
#cmakedefine MUSE_MODULE_SHORTCUTS_TESTS 1
#cmakedefine MUSE_MODULE_SHORTCUTS_API 1

#cmakedefine MUSE_MODULE_TOURS 1
#cmakedefine MUSE_MODULE_TOURS_TESTS 1
#cmakedefine MUSE_MODULE_TOURS_API 1

#cmakedefine MUSE_MODULE_UI 1
#cmakedefine MUSE_MODULE_UI_TESTS 1
#cmakedefine MUSE_MODULE_UI_API 1
Expand Down
2 changes: 1 addition & 1 deletion src/framework/dockwindow/view/dockpageview.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class DockPageView : public QQuickItem, public muse::Injectable
Q_PROPERTY(muse::dock::DockCentralView * centralDock READ centralDock WRITE setCentralDock NOTIFY centralDockChanged)
Q_PROPERTY(muse::dock::DockStatusBarView * statusBar READ statusBar WRITE setStatusBar NOTIFY statusBarChanged)

muse::Inject<ui::INavigationController> navigationController = { this };
Inject<ui::INavigationController> navigationController = { this };

public:
explicit DockPageView(QQuickItem* parent = nullptr);
Expand Down
9 changes: 9 additions & 0 deletions src/framework/global/types/uri.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,13 @@ inline muse::logger::Stream& operator<<(muse::logger::Stream& s, const muse::Uri
return s;
}

template<>
struct std::hash<muse::Uri>
{
std::size_t operator()(const muse::Uri& uri) const noexcept
{
return std::hash<std::string> {}(uri.toString());
}
};

#endif // MUSE_GLOBAL_URI_H
4 changes: 4 additions & 0 deletions src/framework/stubs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ if (NOT MUSE_MODULE_SHORTCUTS)
add_subdirectory(shortcuts)
endif()

if (NOT MUSE_MODULE_TOURS)
add_subdirectory(tours)
endif()

if (NOT MUSE_MODULE_UPDATE)
add_subdirectory(update)
endif()
Expand Down
41 changes: 41 additions & 0 deletions src/framework/stubs/tours/CMakeLists.txt
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
# Music Composition & Notation
#
# Copyright (C) 2025 MuseScore BVBA 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/>.

declare_module(muse_tours)
set(MODULE_ALIAS muse::tours)

set(MODULE_QRC tours.qrc)

set(MODULE_QML_IMPORT ${CMAKE_CURRENT_LIST_DIR}/qml)

set(MODULE_SRC
${CMAKE_CURRENT_LIST_DIR}/toursstubmodule.cpp
${CMAKE_CURRENT_LIST_DIR}/toursstubmodule.h
${CMAKE_CURRENT_LIST_DIR}/toursconfigurationstub.cpp
${CMAKE_CURRENT_LIST_DIR}/toursconfigurationstub.h
${CMAKE_CURRENT_LIST_DIR}/toursservicestub.cpp
${CMAKE_CURRENT_LIST_DIR}/toursservicestub.h

${CMAKE_CURRENT_LIST_DIR}/view/toursproviderstub.cpp
${CMAKE_CURRENT_LIST_DIR}/view/toursproviderstub.h
)

set(MODULE_IS_STUB ON)
setup_module()
25 changes: 25 additions & 0 deletions src/framework/stubs/tours/qml/Muse/Tours/ToursProvider.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-CLA-applies
*
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2025 MuseScore BVBA 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/>.
*/
import QtQuick 2.15

Item {
}
2 changes: 2 additions & 0 deletions src/framework/stubs/tours/qml/Muse/Tours/qmldir
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module Muse.Tours
ToursProvider 1.0 ToursProvider.qml
6 changes: 6 additions & 0 deletions src/framework/stubs/tours/tours.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<RCC>
<qresource prefix="/">
<file>qml/Muse/Tours/qmldir</file>
<file>qml/Muse/Tours/ToursProvider.qml</file>
</qresource>
</RCC>
38 changes: 38 additions & 0 deletions src/framework/stubs/tours/toursconfigurationstub.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-CLA-applies
*
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2025 MuseScore BVBA 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 "toursconfigurationstub.h"

using namespace muse::tours;

muse::String ToursConfigurationStub::lastShownTourIdForEvent(const String&) const
{
return u"";
}

void ToursConfigurationStub::setLastShownTourIdForEvent(const String&, const String&)
{
}

muse::io::path_t ToursConfigurationStub::toursFilePath() const
{
return "";
}
36 changes: 36 additions & 0 deletions src/framework/stubs/tours/toursconfigurationstub.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
* Music Composition & Notation
*
* Copyright (C) 2025 MuseScore BVBA 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 "tours/itoursconfiguration.h"

namespace muse::tours {
class ToursConfigurationStub : public IToursConfiguration
{
public:
String lastShownTourIdForEvent(const String& eventCode) const override;
void setLastShownTourIdForEvent(const String& eventCode, const String& tourId) override;

io::path_t toursFilePath() const override;
};
}
28 changes: 28 additions & 0 deletions src/framework/stubs/tours/toursservicestub.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-CLA-applies
*
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2025 MuseScore BVBA 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 "toursservicestub.h"

using namespace muse::tours;

void ToursServiceStub::onEvent(const String&)
{
}
33 changes: 33 additions & 0 deletions src/framework/stubs/tours/toursservicestub.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-CLA-applies
*
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2025 MuseScore BVBA 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 "tours/itoursservice.h"

namespace muse::tours {
class ToursServiceStub : public IToursService
{
public:
void onEvent(const String& eventCode) override;
};
}
54 changes: 54 additions & 0 deletions src/framework/stubs/tours/toursstubmodule.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-CLA-applies
*
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2025 MuseScore BVBA 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 "toursstubmodule.h"

#include "modularity/ioc.h"

#include "toursconfigurationstub.h"
#include "toursservicestub.h"

#include "view/toursproviderstub.h"

using namespace muse::tours;
using namespace muse::modularity;

static void tours_init_qrc()
{
Q_INIT_RESOURCE(tours);
}

std::string ToursModule::moduleName() const
{
return "tours_stub";
}

void ToursModule::registerExports()
{
ioc()->registerExport<IToursConfiguration>(moduleName(), new ToursConfigurationStub());
ioc()->registerExport<IToursService>(moduleName(), new ToursServiceStub());
ioc()->registerExport<IToursProvider>(moduleName(), new ToursProviderStub());
}

void ToursModule::registerResources()
{
tours_init_qrc();
}
Loading

0 comments on commit a04b5ff

Please sign in to comment.