Skip to content

Commit

Permalink
Implemented stubs for shortcuts module
Browse files Browse the repository at this point in the history
  • Loading branch information
Eism authored and igorkorsukov committed Jan 26, 2021
1 parent 41d47a0 commit 5029287
Show file tree
Hide file tree
Showing 22 changed files with 493 additions and 3 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ option(BUILD_TELEMETRY_MODULE "Build with telemetry module" ON)
set(TELEMETRY_TRACK_ID "" CACHE STRING "Telemetry track id")
set(CRASH_REPORT_URL "" CACHE STRING "URL where to send crash reports")

option(BUILD_SHORTCUTS_MODULE "Build shortcuts module" ON)
option(BUILD_SYSTEM_MODULE "Build system module" ON)
option(BUILD_NETWORK_MODULE "Build network module" ON)
option(BUILD_USERSCORES_MODULE "Build userscores module" ON)
Expand Down
1 change: 1 addition & 0 deletions build/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#cmakedefine BUILD_TELEMETRY_MODULE
#define TELEMETRY_TRACK_ID "${TELEMETRY_TRACK_ID}"

#cmakedefine BUILD_SHORTCUTS_MODULE
#cmakedefine BUILD_SYSTEM_MODULE
#cmakedefine BUILD_NETWORK_MODULE
#cmakedefine BUILD_USERSCORES_MODULE
Expand Down
5 changes: 4 additions & 1 deletion src/framework/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ add_subdirectory(ui)
add_subdirectory(uicomponents)
add_subdirectory(fonts)
add_subdirectory(actions)
add_subdirectory(shortcuts)

if (BUILD_SHORTCUTS_MODULE)
add_subdirectory(shortcuts)
endif (BUILD_SHORTCUTS_MODULE)

if (BUILD_NETWORK_MODULE)
add_subdirectory(network)
Expand Down
8 changes: 8 additions & 0 deletions src/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@
#include "framework/uicomponents/uicomponentsmodule.h"
#include "framework/fonts/fontsmodule.h"
#include "framework/actions/actionsmodule.h"
#ifdef BUILD_SHORTCUTS_MODULE
#include "framework/shortcuts/shortcutsmodule.h"
#else
#include "stubs/framework/shortcuts/shortcutsstubmodule.h"
#endif

#ifdef BUILD_SYSTEM_MODULE
#include "framework/system/systemmodule.h"
Expand Down Expand Up @@ -161,7 +165,11 @@ int main(int argc, char** argv)
app.addModule(new mu::appshell::AppShellModule());

app.addModule(new mu::context::ContextModule());
#ifdef BUILD_SHORTCUTS_MODULE
app.addModule(new mu::shortcuts::ShortcutsModule());
#else
app.addModule(new mu::shortcuts::ShortcutsStubModule());
#endif

app.addModule(new mu::audio::AudioModule());
app.addModule(new mu::midi::MidiModule());
Expand Down
2 changes: 0 additions & 2 deletions src/notation/view/notationpaintview.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include "context/iglobalcontext.h"
#include "async/asyncable.h"
#include "playback/iplaybackcontroller.h"
#include "shortcuts/ishortcutsregister.h"

#include "notationviewinputcontroller.h"
#include "noteinputcursor.h"
Expand All @@ -47,7 +46,6 @@ class NotationPaintView : public QQuickPaintedItem, public IControlledView, publ
INJECT(notation, context::IGlobalContext, globalContext)
INJECT(notation, playback::IPlaybackController, playbackController)
INJECT(notation, INotationContextMenu, notationContextMenu)
INJECT(notation, shortcuts::IShortcutsRegister, shortcutsRegister)

Q_PROPERTY(qreal startHorizontalScrollPosition READ startHorizontalScrollPosition NOTIFY horizontalScrollChanged)
Q_PROPERTY(qreal horizontalScrollSize READ horizontalScrollSize NOTIFY horizontalScrollChanged)
Expand Down
4 changes: 4 additions & 0 deletions src/stubs/framework/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@

if (NOT BUILD_SHORTCUTS_MODULE)
add_subdirectory(shortcuts)
endif (NOT BUILD_SHORTCUTS_MODULE)

if (NOT BUILD_NETWORK_MODULE)
add_subdirectory(network)
endif (NOT BUILD_NETWORK_MODULE)
Expand Down
42 changes: 42 additions & 0 deletions src/stubs/framework/shortcuts/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#=============================================================================
# MuseScore
# Music Composition & Notation
#
# Copyright (C) 2020 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 2.
#
# 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, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#=============================================================================

set(MODULE shortcuts)

set(MODULE_QRC shortcuts.qrc)

set(MODULE_QML_IMPORT ${CMAKE_CURRENT_LIST_DIR}/qml )

set(MODULE_SRC
${CMAKE_CURRENT_LIST_DIR}/shortcutsstubmodule.cpp
${CMAKE_CURRENT_LIST_DIR}/shortcutsstubmodule.h
${CMAKE_CURRENT_LIST_DIR}/shortcutsregisterstub.cpp
${CMAKE_CURRENT_LIST_DIR}/shortcutsregisterstub.h
${CMAKE_CURRENT_LIST_DIR}/shortcutscontrollerstub.cpp
${CMAKE_CURRENT_LIST_DIR}/shortcutscontrollerstub.h
${CMAKE_CURRENT_LIST_DIR}/shortcutsconfigurationstub.cpp
${CMAKE_CURRENT_LIST_DIR}/shortcutsconfigurationstub.h
${CMAKE_CURRENT_LIST_DIR}/shortcutcontextresolverstub.cpp
${CMAKE_CURRENT_LIST_DIR}/shortcutcontextresolverstub.h
${CMAKE_CURRENT_LIST_DIR}/midiremotestub.cpp
${CMAKE_CURRENT_LIST_DIR}/midiremotestub.h
)

include(${PROJECT_SOURCE_DIR}/build/module.cmake)

39 changes: 39 additions & 0 deletions src/stubs/framework/shortcuts/midiremotestub.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//=============================================================================
// MuseScore
// Music Composition & Notation
//
// Copyright (C) 2020 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 2.
//
// 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, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//=============================================================================
#include "midiremotestub.h"

using namespace mu::shortcuts;

void MidiRemoteStub::setIsSettingMode(bool)
{
}

bool MidiRemoteStub::isSettingMode() const
{
return false;
}

void MidiRemoteStub::setCurrentActionEvent(const mu::midi::Event&)
{
}

mu::Ret MidiRemoteStub::process(const mu::midi::Event&)
{
return make_ret(Ret::Code::NotSupported);
}
37 changes: 37 additions & 0 deletions src/stubs/framework/shortcuts/midiremotestub.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//=============================================================================
// MuseScore
// Music Composition & Notation
//
// Copyright (C) 2020 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 2.
//
// 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, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//=============================================================================
#ifndef MU_SHORTCUTS_MIDIREMOTESTUB_H
#define MU_SHORTCUTS_MIDIREMOTESTUB_H

#include "shortcuts/imidiremote.h"

namespace mu::shortcuts {
class MidiRemoteStub : public IMidiRemote
{
public:
void setIsSettingMode(bool arg) override;
bool isSettingMode() const override;

void setCurrentActionEvent(const midi::Event& ev) override;

Ret process(const midi::Event& ev) override;
};
}

#endif // MU_SHORTCUTS_MIDIREMOTESTUB_H
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import QtQuick 2.15

QtObject { }
2 changes: 2 additions & 0 deletions src/stubs/framework/shortcuts/qml/MuseScore/Shortcuts/qmldir
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module MuseScore.Shortcuts
Shortcuts 1.0 Shortcuts.qml
26 changes: 26 additions & 0 deletions src/stubs/framework/shortcuts/shortcutcontextresolverstub.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//=============================================================================
// MuseScore
// Music Composition & Notation
//
// Copyright (C) 2020 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 2.
//
// 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, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//=============================================================================
#include "shortcutcontextresolverstub.h"

using namespace mu::shortcuts;

ShortcutContext ShortcutContextResolverStub::currentShortcutContext() const
{
return ShortcutContext();
}
32 changes: 32 additions & 0 deletions src/stubs/framework/shortcuts/shortcutcontextresolverstub.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//=============================================================================
// MuseScore
// Music Composition & Notation
//
// Copyright (C) 2020 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 2.
//
// 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, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//=============================================================================
#ifndef MU_SHORTCUTS_SHORTCUTCONTEXTRESOLVERSTUB_H
#define MU_SHORTCUTS_SHORTCUTCONTEXTRESOLVERSTUB_H

#include "shortcuts/ishortcutcontextresolver.h"

namespace mu::shortcuts {
class ShortcutContextResolverStub : public IShortcutContextResolver
{
public:
ShortcutContext currentShortcutContext() const override;
};
}

#endif // MU_SHORTCUTS_SHORTCUTCONTEXTRESOLVERSTUB_H
6 changes: 6 additions & 0 deletions src/stubs/framework/shortcuts/shortcuts.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<RCC>
<qresource prefix="/">
<file>qml/MuseScore/Shortcuts/qmldir</file>
<file>qml/MuseScore/Shortcuts/Shortcuts.qml</file>
</qresource>
</RCC>
31 changes: 31 additions & 0 deletions src/stubs/framework/shortcuts/shortcutsconfigurationstub.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//=============================================================================
// MuseScore
// Music Composition & Notation
//
// Copyright (C) 2020 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 2.
//
// 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, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//=============================================================================
#include "shortcutsconfigurationstub.h"

using namespace mu::shortcuts;

mu::io::path ShortcutsConfigurationStub::shortcutsUserPath() const
{
return mu::io::path();
}

mu::io::path ShortcutsConfigurationStub::shortcutsDefaultPath() const
{
return mu::io::path();
}
33 changes: 33 additions & 0 deletions src/stubs/framework/shortcuts/shortcutsconfigurationstub.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//=============================================================================
// MuseScore
// Music Composition & Notation
//
// Copyright (C) 2020 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 2.
//
// 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, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//=============================================================================
#ifndef MU_SHORTCUTS_SHORTCUTSCONFIGURATIONSTUB_H
#define MU_SHORTCUTS_SHORTCUTSCONFIGURATIONSTUB_H

#include "shortcuts/ishortcutsconfiguration.h"

namespace mu::shortcuts {
class ShortcutsConfigurationStub : public IShortcutsConfiguration
{
public:
io::path shortcutsUserPath() const override;
io::path shortcutsDefaultPath() const override;
};
}

#endif // MU_SHORTCUTS_SHORTCUTSCONFIGURATIONSTUB_H
25 changes: 25 additions & 0 deletions src/stubs/framework/shortcuts/shortcutscontrollerstub.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//=============================================================================
// MuseScore
// Music Composition & Notation
//
// Copyright (C) 2020 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 2.
//
// 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, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//=============================================================================
#include "shortcutscontrollerstub.h"

using namespace mu::shortcuts;

void ShortcutsControllerStub::activate(const std::string&)
{
}
32 changes: 32 additions & 0 deletions src/stubs/framework/shortcuts/shortcutscontrollerstub.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//=============================================================================
// MuseScore
// Music Composition & Notation
//
// Copyright (C) 2020 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 2.
//
// 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, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//=============================================================================
#ifndef MU_SHORTCUTS_SHORTCUTSCONTROLLERSTUB_H
#define MU_SHORTCUTS_SHORTCUTSCONTROLLERSTUB_H

#include "shortcuts/ishortcutscontroller.h"

namespace mu::shortcuts {
class ShortcutsControllerStub : public IShortcutsController
{
public:
void activate(const std::string& sequence) override;
};
}

#endif // MU_SHORTCUTS_SHORTCUTSCONTROLLERSTUB_H
Loading

0 comments on commit 5029287

Please sign in to comment.