Skip to content

Commit

Permalink
Implemented stubs for palette module
Browse files Browse the repository at this point in the history
  • Loading branch information
Eism authored and igorkorsukov committed Jan 25, 2021
1 parent b75fb05 commit 3c5d0ea
Show file tree
Hide file tree
Showing 31 changed files with 519 additions and 22 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ option(BUILD_CLOUD_MODULE "Build cloud module" ON)
option(BUILD_EXTENSIONS_MODULE "Build extensions module" ON)
option(BUILD_LANGUAGES_MODULE "Build languages module" ON)
option(BUILD_PLAYBACK_MODULE "Build playback module" ON)
option(BUILD_PALETTE_MODULE "Build palette module" ON)
option(BUILD_INSTRUMENTS_MODULE "Build instruments module" ON)
option(BUILD_INSPECTOR_MODULE "Build inspector 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 @@ -49,6 +49,7 @@
#cmakedefine BUILD_EXTENSIONS_MODULE
#cmakedefine BUILD_LANGUAGES_MODULE
#cmakedefine BUILD_PLAYBACK_MODULE
#cmakedefine BUILD_PALETTE_MODULE
#cmakedefine BUILD_INSTRUMENTS_MODULE
#cmakedefine BUILD_INSPECTOR_MODULE

Expand Down
4 changes: 3 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ if (BUILD_PLAYBACK_MODULE)
endif (BUILD_PLAYBACK_MODULE)

# Notation
add_subdirectory(palette)
if (BUILD_PALETTE_MODULE)
add_subdirectory(palette)
endif (BUILD_PALETTE_MODULE)
if (BUILD_INSTRUMENTS_MODULE)
add_subdirectory(instruments)
endif (BUILD_INSTRUMENTS_MODULE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ PopupViewButton {
property alias model: horizontalFramePopup.model

icon: IconCode.HORIZONTAL_FRAME
text: qsTrc("palette", "Horizontal frames")
text: qsTrc("inspector", "Horizontal frames")

visible: root.model ? !root.model.isEmpty : false

Expand Down
8 changes: 8 additions & 0 deletions src/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@
#include "importexport/importexportmodule.h"
#include "importexport/musicxml/musicxmlmodule.h"
#include "commonscene/commonscenemodule.h"
#ifdef BUILD_PALETTE_MODULE
#include "palette/palettemodule.h"
#else
#include "stubs/palette/palettestubmodule.h"
#endif
#include "inspector/inspectormodule.h"
#ifdef BUILD_PLAYBACK_MODULE
#include "playback/playbackmodule.h"
Expand Down Expand Up @@ -168,7 +172,11 @@ int main(int argc, char** argv)
#endif

app.addModule(new mu::inspector::InspectorModule());
#ifdef BUILD_PALETTE_MODULE
app.addModule(new mu::palette::PaletteModule());
#else
app.addModule(new mu::palette::PaletteStubModule());
#endif
app.addModule(new mu::converter::ConverterModule());

#ifndef Q_OS_WASM
Expand Down
22 changes: 11 additions & 11 deletions src/palette/palette.qrc
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<RCC>
<qresource prefix="/">
<file>qml/MuseScore/Palette/MoreElementsPopup.qml</file>
<file>qml/MuseScore/Palette/Palette.qml</file>
<file>qml/MuseScore/Palette/PaletteGrid.qml</file>
<file>qml/MuseScore/Palette/PalettesListPopup.qml</file>
<file>qml/MuseScore/Palette/PalettesWidget.qml</file>
<file>qml/MuseScore/Palette/PalettesWidgetHeader.qml</file>
<file>qml/MuseScore/Palette/PaletteTree.qml</file>
<file>qml/MuseScore/Palette/PlaceholderManager.qml</file>
<file>qml/MuseScore/Palette/TreePaletteHeader.qml</file>
<file>qml/MuseScore/Palette/utils.js</file>
<file>qml/MuseScore/Palette/qmldir</file>
<file>qml/MuseScore/Palette/CreateCustomPalettePopup.qml</file>
<file>qml/MuseScore/Palette/PalettePropertiesDialog.qml</file>
<file>qml/MuseScore/Palette/internal/CreateCustomPalettePopup.qml</file>
<file>qml/MuseScore/Palette/internal/MoreElementsPopup.qml</file>
<file>qml/MuseScore/Palette/internal/Palette.qml</file>
<file>qml/MuseScore/Palette/internal/PaletteGrid.qml</file>
<file>qml/MuseScore/Palette/internal/PalettesListPopup.qml</file>
<file>qml/MuseScore/Palette/internal/PalettesWidgetHeader.qml</file>
<file>qml/MuseScore/Palette/internal/PaletteTree.qml</file>
<file>qml/MuseScore/Palette/internal/PlaceholderManager.qml</file>
<file>qml/MuseScore/Palette/internal/TreePaletteHeader.qml</file>
<file>qml/MuseScore/Palette/internal/utils.js</file>
<file>qml/MuseScore/Palette/PaletteCellPropertiesDialog.qml</file>
<file>qml/MuseScore/Palette/PalettePropertiesDialog.qml</file>
</qresource>
</RCC>
2 changes: 2 additions & 0 deletions src/palette/qml/MuseScore/Palette/PalettesWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import MuseScore.Palette 1.0
// TODO: make some properties 'property alias`?
// and `readonly property`?

import "internal"

Rectangle {
id: palettesWidget

Expand Down
File renamed without changes.
9 changes: 0 additions & 9 deletions src/palette/qml/MuseScore/Palette/qmldir
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
module MuseScore.Palette
MoreElementsPopup 1.0 MoreElementsPopup.qml
PaletteGrid 1.0 PaletteGrid.qml
Palette 1.0 Palette.qml
PalettesListPopup 1.0 PalettesListPopup.qml
PalettesWidgetHeader 1.0 PalettesWidgetHeader.qml
PalettesWidget 1.0 PalettesWidget.qml
PaletteTree 1.0 PaletteTree.qml
PlaceholderManager 1.0 PlaceholderManager.qml
TreePaletteHeader 1.0 TreePaletteHeader.qml
CreateCustomPalettePopup 1.0 CreateCustomPalettePopup.qml
PalettePropertiesDialog 1.0 PalettePropertiesDialog.qml
PaletteCellPropertiesDialog 1.0 PaletteCellPropertiesDialog.qml
4 changes: 4 additions & 0 deletions src/stubs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ if (NOT BUILD_PLAYBACK_MODULE)
add_subdirectory(playback)
endif (NOT BUILD_PLAYBACK_MODULE)

if (NOT BUILD_PALETTE_MODULE)
add_subdirectory(palette)
endif (NOT BUILD_PALETTE_MODULE)

if (NOT BUILD_INSTRUMENTS_MODULE)
add_subdirectory(instruments)
endif (NOT BUILD_INSTRUMENTS_MODULE)
Expand Down
35 changes: 35 additions & 0 deletions src/stubs/palette/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#=============================================================================
# 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 palette)

set(MODULE_QRC ${CMAKE_CURRENT_LIST_DIR}/palette.qrc)

set(MODULE_QML_IMPORT ${CMAKE_CURRENT_LIST_DIR}/qml)

set(MODULE_SRC
${CMAKE_CURRENT_LIST_DIR}/palettestubmodule.cpp
${CMAKE_CURRENT_LIST_DIR}/palettestubmodule.h
${CMAKE_CURRENT_LIST_DIR}/paletteadapterstub.cpp
${CMAKE_CURRENT_LIST_DIR}/paletteadapterstub.h
${CMAKE_CURRENT_LIST_DIR}/paletteconfigurationstub.cpp
${CMAKE_CURRENT_LIST_DIR}/paletteconfigurationstub.h
)

include(${PROJECT_SOURCE_DIR}/build/module.cmake)
8 changes: 8 additions & 0 deletions src/stubs/palette/palette.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<RCC>
<qresource prefix="/">
<file>qml/MuseScore/Palette/PalettesWidget.qml</file>
<file>qml/MuseScore/Palette/qmldir</file>
<file>qml/MuseScore/Palette/PaletteCellPropertiesDialog.qml</file>
<file>qml/MuseScore/Palette/PalettePropertiesDialog.qml</file>
</qresource>
</RCC>
79 changes: 79 additions & 0 deletions src/stubs/palette/paletteadapterstub.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
//=============================================================================
// 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 "paletteadapterstub.h"

#include <QAction>

using namespace mu::palette;

QAction* PaletteAdapterStub::getAction(const char*) const
{
return new QAction();
}

QString PaletteAdapterStub::actionHelp(const char*) const
{
return QString();
}

void PaletteAdapterStub::showMasterPalette(const QString&)
{
}

bool PaletteAdapterStub::isSelected() const
{
return false;
}

bool PaletteAdapterStub::applyPaletteElement(Ms::Element*, Qt::KeyboardModifiers)
{
return false;
}

Ms::PaletteWorkspace* PaletteAdapterStub::paletteWorkspace() const
{
return nullptr;
}

mu::ValCh<bool> PaletteAdapterStub::paletteEnabled() const
{
return mu::ValCh<bool>();
}

void PaletteAdapterStub::setPaletteEnabled(bool)
{
}

void PaletteAdapterStub::requestPaletteSearch()
{
}

mu::async::Notification PaletteAdapterStub::paletteSearchRequested() const
{
return mu::async::Notification();
}

void PaletteAdapterStub::notifyElementDraggedToScoreView()
{
}

mu::async::Notification PaletteAdapterStub::elementDraggedToScoreView() const
{
return mu::async::Notification();
}
48 changes: 48 additions & 0 deletions src/stubs/palette/paletteadapterstub.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
//=============================================================================
// 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_PALETTE_PALETTEADAPTERSTUB_H
#define MU_PALETTE_PALETTEADAPTERSTUB_H

#include "palette/ipaletteadapter.h"

namespace mu::palette {
class PaletteAdapterStub : public IPaletteAdapter
{
public:
QAction* getAction(const char* id) const override;
QString actionHelp(const char* id) const override;

void showMasterPalette(const QString&) override;

// score
bool isSelected() const override;
bool applyPaletteElement(Ms::Element* element, Qt::KeyboardModifiers modifiers = {}) override;

// qml
Ms::PaletteWorkspace* paletteWorkspace() const override;
mu::ValCh<bool> paletteEnabled() const override;
void setPaletteEnabled(bool arg) override;
void requestPaletteSearch() override;
async::Notification paletteSearchRequested() const override;
void notifyElementDraggedToScoreView() override;
async::Notification elementDraggedToScoreView() const override;
};
}

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

using namespace mu::palette;

double PaletteConfigurationStub::paletteScaling() const
{
return 0.f;
}

bool PaletteConfigurationStub::isSinglePalette() const
{
return false;
}

QColor PaletteConfigurationStub::elementsBackgroundColor() const
{
return QColor();
}

QColor PaletteConfigurationStub::elementsColor() const
{
return QColor();
}

QColor PaletteConfigurationStub::gridColor() const
{
return QColor();
}

QColor PaletteConfigurationStub::accentColor() const
{
return QColor();
}

mu::async::Notification PaletteConfigurationStub::colorsChanged() const
{
return mu::async::Notification();
}

mu::io::path PaletteConfigurationStub::keySignaturesDirPath() const
{
return mu::io::path();
}

mu::io::path PaletteConfigurationStub::timeSignaturesDirPath() const
{
return mu::io::path();
}

bool PaletteConfigurationStub::useFactorySettings() const
{
return false;
}

bool PaletteConfigurationStub::enableExperimental() const
{
return false;
}

mu::ValCh<IPaletteConfiguration::PaletteConfig> PaletteConfigurationStub::paletteConfig(const QString&) const
{
return mu::ValCh<IPaletteConfiguration::PaletteConfig>();
}

void PaletteConfigurationStub::setPaletteConfig(const QString&, const IPaletteConfiguration::PaletteConfig&)
{
}

mu::ValCh<IPaletteConfiguration::PaletteCellConfig> PaletteConfigurationStub::paletteCellConfig(const QString&) const
{
return mu::ValCh<IPaletteConfiguration::PaletteCellConfig>();
}

void PaletteConfigurationStub::setPaletteCellConfig(const QString&, const IPaletteConfiguration::PaletteCellConfig&)
{
}
Loading

0 comments on commit 3c5d0ea

Please sign in to comment.