Skip to content

Commit

Permalink
Implemented stubs for inspector module
Browse files Browse the repository at this point in the history
  • Loading branch information
Eism authored and igorkorsukov committed Jan 22, 2021
1 parent 71267de commit 1a261e5
Show file tree
Hide file tree
Showing 13 changed files with 326 additions and 5 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ option(BUILD_USERSCORES_MODULE "Build userscores module" ON)
option(BUILD_EXTENSIONS_MODULE "Build extensions module" ON)
option(BUILD_LANGUAGES_MODULE "Build languages module" ON)
option(BUILD_INSTRUMENTS_MODULE "Build instruments module" ON)
option(BUILD_INSPECTOR_MODULE "Build inspector module" ON)

option(SOUNDFONT3 "Ogg Vorbis compressed fonts" ON) # Enable Ogg Vorbis compressed fonts, requires Ogg & Vorbis
option(DOWNLOAD_SOUNDFONT "Download the latest soundfont version as part of the build process" 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 @@ -48,6 +48,7 @@
#cmakedefine BUILD_EXTENSIONS_MODULE
#cmakedefine BUILD_LANGUAGES_MODULE
#cmakedefine BUILD_INSTRUMENTS_MODULE
#cmakedefine BUILD_INSPECTOR_MODULE

#cmakedefine WIN_SPARKLE_ENABLED
#cmakedefine MAC_SPARKLE_ENABLED
Expand Down
4 changes: 3 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ add_subdirectory(playback)

# Notation
add_subdirectory(palette)
add_subdirectory(inspector)
if (BUILD_INSTRUMENTS_MODULE)
add_subdirectory(instruments)
endif (BUILD_INSTRUMENTS_MODULE)
if (BUILD_INSPECTOR_MODULE)
add_subdirectory(inspector)
endif (BUILD_INSPECTOR_MODULE)

# Stubs
add_subdirectory(stubs)
Expand Down
7 changes: 3 additions & 4 deletions src/inspector/inspectormodule.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//=============================================================================

#ifndef MU_INSPECTOR_INSPECTORSETUP_H
#define MU_INSPECTOR_INSPECTORSETUP_H
#ifndef MU_INSPECTOR_INSPECTORMODULE_H
#define MU_INSPECTOR_INSPECTORMODULE_H

#include "modularity/imodulesetup.h"

Expand All @@ -35,4 +34,4 @@ class InspectorModule : public mu::framework::IModuleSetup
};
}

#endif // MU_INSPECTOR_INSPECTORSETUP_H
#endif // MU_INSPECTOR_INSPECTORMODULE_H
4 changes: 4 additions & 0 deletions src/stubs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ endif (NOT BUILD_LANGUAGES_MODULE)
if (NOT BUILD_INSTRUMENTS_MODULE)
add_subdirectory(instruments)
endif (NOT BUILD_INSTRUMENTS_MODULE)

if (NOT BUILD_INSPECTOR_MODULE)
add_subdirectory(inspector)
endif (NOT BUILD_INSPECTOR_MODULE)
32 changes: 32 additions & 0 deletions src/stubs/inspector/CMakeLists.txt
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.
#=============================================================================
set(MODULE "inspector")

set(MODULE_QRC ${CMAKE_CURRENT_LIST_DIR}/view/inspector_resources.qrc)

set(MODULE_QML_IMPORT ${CMAKE_CURRENT_LIST_DIR}/view/qml)

set(MODULE_SRC
${CMAKE_CURRENT_LIST_DIR}/inspectorstubmodule.cpp
${CMAKE_CURRENT_LIST_DIR}/inspectorstubmodule.h
${CMAKE_CURRENT_LIST_DIR}/inspectoradapterstub.cpp
${CMAKE_CURRENT_LIST_DIR}/inspectoradapterstub.h
)

include(${PROJECT_SOURCE_DIR}/build/module.cmake)
109 changes: 109 additions & 0 deletions src/stubs/inspector/inspectoradapterstub.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
//=============================================================================
// 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 "inspectoradapterstub.h"

using namespace mu::inspector;

bool InspectorAdapterStub::isNotationExisting() const
{
return false;
}

bool InspectorAdapterStub::isTextEditingStarted() const
{
return false;
}

mu::async::Notification InspectorAdapterStub::isTextEditingChanged() const
{
return mu::async::Notification();
}

void InspectorAdapterStub::beginCommand()
{
}

void InspectorAdapterStub::endCommand()
{
}

void InspectorAdapterStub::updateStyleValue(const Ms::Sid&, const QVariant&)
{
}

QVariant InspectorAdapterStub::styleValue(const Ms::Sid&)
{
return QVariant();
}

void InspectorAdapterStub::showSpecialCharactersDialog()
{
}

void InspectorAdapterStub::showStaffTextPropertiesDialog()
{
}

void InspectorAdapterStub::showPageSettingsDialog()
{
}

void InspectorAdapterStub::showStyleSettingsDialog()
{
}

void InspectorAdapterStub::showTimeSignaturePropertiesDialog()
{
}

void InspectorAdapterStub::showArticulationPropertiesDialog()
{
}

void InspectorAdapterStub::showGridConfigurationDialog()
{
}

void InspectorAdapterStub::updatePageMarginsVisibility(const bool)
{
}

void InspectorAdapterStub::updateFramesVisibility(const bool)
{
}

void InspectorAdapterStub::updateHorizontalGridSnapping(const bool)
{
}

void InspectorAdapterStub::updateVerticalGridSnapping(const bool)
{
}

void InspectorAdapterStub::updateUnprintableElementsVisibility(const bool)
{
}

void InspectorAdapterStub::updateInvisibleElementsDisplaying(const bool)
{
}

void InspectorAdapterStub::updateNotation()
{
}
62 changes: 62 additions & 0 deletions src/stubs/inspector/inspectoradapterstub.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
//=============================================================================
// 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_INSPECTOR_INSPECTORADAPTERSTUB_H
#define MU_INSPECTOR_INSPECTORADAPTERSTUB_H

#include "inspector/iinspectoradapter.h"

namespace mu::inspector {
class InspectorAdapterStub : public IInspectorAdapter
{
public:
bool isNotationExisting() const override;
bool isTextEditingStarted() const override;
async::Notification isTextEditingChanged() const override;

// notation commands
void beginCommand() override;
void endCommand() override;

// notation styling
void updateStyleValue(const Ms::Sid& styleId, const QVariant& newValue) override;
QVariant styleValue(const Ms::Sid& styleId) override;

// dialogs
void showSpecialCharactersDialog() override;
void showStaffTextPropertiesDialog() override;
void showPageSettingsDialog() override;
void showStyleSettingsDialog() override;
void showTimeSignaturePropertiesDialog() override;
void showArticulationPropertiesDialog() override;
void showGridConfigurationDialog() override;

// actions
void updatePageMarginsVisibility(const bool isVisible) override;
void updateFramesVisibility(const bool isVisible) override;
void updateHorizontalGridSnapping(const bool isSnapped) override;
void updateVerticalGridSnapping(const bool isSnapped) override;
void updateUnprintableElementsVisibility(const bool isVisible) override;
void updateInvisibleElementsDisplaying(const bool isVisible) override;

// notation layout
void updateNotation() override;
};
}

#endif // MU_INSPECTOR_INSPECTORADAPTERSTUB_H
52 changes: 52 additions & 0 deletions src/stubs/inspector/inspectorstubmodule.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
//=============================================================================
// 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 "inspectorstubmodule.h"

#include "modularity/ioc.h"
#include "ui/iuiengine.h"

#include "inspectoradapterstub.h"

using namespace mu::inspector;
using namespace mu::framework;

static void inspector_init_qrc()
{
Q_INIT_RESOURCE(inspector_resources);
}

std::string InspectorModule::moduleName() const
{
return "inspector";
}

void InspectorModule::registerExports()
{
ioc()->registerExport<IInspectorAdapter>(moduleName(), new InspectorAdapterStub());
}

void InspectorModule::registerResources()
{
inspector_init_qrc();
}

void InspectorModule::registerUiTypes()
{
ioc()->resolve<ui::IUiEngine>(moduleName())->addSourceImportPath(inspector_QML_IMPORT);
}
37 changes: 37 additions & 0 deletions src/stubs/inspector/inspectorstubmodule.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_INSPECTOR_INSPECTORSTUBMODULE_H
#define MU_INSPECTOR_INSPECTORSTUBMODULE_H

#include "modularity/imodulesetup.h"

namespace mu::inspector {
class InspectorModule : public mu::framework::IModuleSetup
{
public:
InspectorModule() = default;

std::string moduleName() const override;
void registerExports() override;
void registerResources() override;
void registerUiTypes() override;
};
}

#endif // MU_INSPECTOR_INSPECTORSTUBMODULE_H
6 changes: 6 additions & 0 deletions src/stubs/inspector/view/inspector_resources.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<RCC>
<qresource prefix="/">
<file>qml/MuseScore/Inspector/InspectorForm.qml</file>
<file>qml/MuseScore/Inspector/qmldir</file>
</qresource>
</RCC>
14 changes: 14 additions & 0 deletions src/stubs/inspector/view/qml/MuseScore/Inspector/InspectorForm.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import QtQuick 2.15

import MuseScore.UiComponents 1.0

Rectangle {
property var model: null

color: ui.theme.backgroundPrimaryColor

StyledTextLabel {
anchors.centerIn: parent
text: "Inspector Form Stub"
}
}
2 changes: 2 additions & 0 deletions src/stubs/inspector/view/qml/MuseScore/Inspector/qmldir
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module MuseScore.Inspector
InspectorForm 1.0 InspectorForm.qml

0 comments on commit 1a261e5

Please sign in to comment.