Skip to content

Commit

Permalink
Merge pull request #6163 from igorkorsukov/mu4/notation
Browse files Browse the repository at this point in the history
Added notation view skeleton
  • Loading branch information
igorkorsukov committed Jun 4, 2020
2 parents 5b8aa39 + 9e74bd3 commit 4650a2f
Show file tree
Hide file tree
Showing 52 changed files with 1,230 additions and 48 deletions.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Expand Up @@ -940,9 +940,12 @@ if (MSVC)
endif (MSVC)

add_subdirectory(framework)
add_subdirectory(mu4)
add_subdirectory(global) #todo remove

if (BUILD_UI_MU4)
add_subdirectory(mu4)
endif(BUILD_UI_MU4)

## TEMP: Display all variables!
### message(STATUS "===========================================================")
### message(STATUS "VARIABLES:")
Expand Down
14 changes: 8 additions & 6 deletions build/module.cmake
Expand Up @@ -18,12 +18,14 @@
#=============================================================================

## Setup
# set(MODULE somename)
# set(MODULE_INCLUDE ...)
# set(MODULE_QRC somename.qrc)
# set(MODULE_QML_IMPORT ...)
# set(MODULE_SRC ...)
# set(MODULE_LINK ...)
# set(MODULE somename) - set module (target) name
# set(MODULE_INCLUDE ...) - set include (by default see below include_directories)
# set(MODULE_SRC ...) - set sources and headers files
# set(MODULE_LINK ...) - set libraries for link
# set(MODULE_QRC somename.qrc) - set resource (qrc) file
# set(MODULE_QML_IMPORT ...) - set Qml import for QtCreator (so that there is code highlighting, jump, etc.)

# After all the settings you need to do:
# include(${PROJECT_SOURCE_DIR}/build/module.cmake)

message(STATUS "Configuring " ${MODULE})
Expand Down
1 change: 1 addition & 0 deletions framework/global/CMakeLists.txt
Expand Up @@ -26,6 +26,7 @@ set(MODULE_SRC
${CMAKE_CURRENT_LIST_DIR}/log.h
${CMAKE_CURRENT_LIST_DIR}/dataformatter.cpp
${CMAKE_CURRENT_LIST_DIR}/dataformatter.h
${CMAKE_CURRENT_LIST_DIR}/interfaces/iinteractive.h
)

include(${PROJECT_SOURCE_DIR}/build/module.cmake)
40 changes: 40 additions & 0 deletions framework/global/interfaces/iinteractive.h
@@ -0,0 +1,40 @@
//=============================================================================
// 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_FRAMEWORK_IINTERACTIVE_H
#define MU_FRAMEWORK_IINTERACTIVE_H

#include <QString>

#include "modularity/imoduleexport.h"

namespace mu {
namespace framework {
class IInteractive : MODULE_EXPORT_INTERFACE
{
INTERFACE_ID(IInteractive)

public:
virtual ~IInteractive() = default;

virtual QString selectOpeningFile(const QString& title, const QString& dir, const QString& filter) = 0;
};
}
}

#endif // MU_FRAMEWORK_IINTERACTIVE_H
2 changes: 2 additions & 0 deletions framework/ui/CMakeLists.txt
Expand Up @@ -28,6 +28,8 @@ set(MODULE_SRC
${CMAKE_CURRENT_LIST_DIR}/qmltheme.cpp
${CMAKE_CURRENT_LIST_DIR}/qmltheme.h
${CMAKE_CURRENT_LIST_DIR}/iconcodes.h
${CMAKE_CURRENT_LIST_DIR}/uiinteractive.cpp
${CMAKE_CURRENT_LIST_DIR}/uiinteractive.h
)

include(${PROJECT_SOURCE_DIR}/build/module.cmake)
28 changes: 28 additions & 0 deletions framework/ui/uiinteractive.cpp
@@ -0,0 +1,28 @@
//=============================================================================
// 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 "uiinteractive.h"

#include <QFileDialog>

using namespace mu::framework;

QString UiInteractive::selectOpeningFile(const QString& title, const QString& dir, const QString& filter)
{
return QFileDialog::getOpenFileName(nullptr /*parent*/, title, dir, filter);
}
37 changes: 37 additions & 0 deletions framework/ui/uiinteractive.h
@@ -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_FRAMEWORK_UIINTERACTIVE_H
#define MU_FRAMEWORK_UIINTERACTIVE_H

#include "interfaces/iinteractive.h"

namespace mu {
namespace framework {
class UiInteractive : public IInteractive
{
public:

UiInteractive() = default;

QString selectOpeningFile(const QString& title, const QString& dir, const QString& filter) override;
};
}
}

#endif // MU_FRAMEWORK_UIINTERACTIVE_H
3 changes: 3 additions & 0 deletions framework/ui/uimodule.cpp
Expand Up @@ -8,6 +8,8 @@
#include "qmltheme.h"
#include "iconcodes.h"

#include "uiinteractive.h"

using namespace mu::framework;

std::string UiModule::moduleName() const
Expand All @@ -19,6 +21,7 @@ std::string UiModule::moduleName() const
void UiModule::registerExports()
{
ioc()->registerExport<IUiEngine>(moduleName(), UiEngine::instance());
ioc()->registerExport<IInteractive>(moduleName(), new UiInteractive());
}

void UiModule::registerUiTypes()
Expand Down
1 change: 0 additions & 1 deletion framework/uicomponents/CMakeLists.txt
Expand Up @@ -33,4 +33,3 @@ set(MODULE_SRC
include(${PROJECT_SOURCE_DIR}/build/module.cmake)



9 changes: 8 additions & 1 deletion libmscore/CMakeLists.txt
Expand Up @@ -103,10 +103,17 @@ add_library (
unrollrepeats.cpp
)

set (LINK_LIBS )
if (AVSOMR)
target_link_libraries(libmscore avsomr)
set(LINK_LIBS ${LINK_LIBS} avsomr)
endif (AVSOMR)

if (BUILD_UI_MU4)
set(LINK_LIBS ${LINK_LIBS} audio)
endif(BUILD_UI_MU4)

target_link_libraries(libmscore ${LINK_LIBS})

##
## Code coverage. Only affects DEBUG builds.
##
Expand Down
22 changes: 12 additions & 10 deletions main/CMakeLists.txt
Expand Up @@ -77,17 +77,19 @@ target_include_directories(mscore PRIVATE
${PROJECT_SOURCE_DIR}/thirdparty
)

target_link_libraries(mscore
mscoreapp
global
global_old #todo remove
ui
uicomponents
appshell
scores
extensions
)

set(LINK_LIB mscoreapp global global_old ui uicomponents)
if (BUILD_UI_MU4)
set(LINK_LIB ${LINK_LIB}
appshell
scores
extensions
notation
notation_scene
)
endif(BUILD_UI_MU4)

target_link_libraries(mscore ${LINK_LIB} )

if (APPLE)
set_target_properties (mscore
Expand Down
10 changes: 9 additions & 1 deletion main/main.cpp
Expand Up @@ -60,7 +60,15 @@ int main(int argc, char** argv)

initResources();

#ifndef BUILD_UI_MU4
ModulesSetup::instance()->setup();
#else
//! HACK A temporary hack is required because some modules
//! can only be initialized after the creation of the QApplication
auto moduleSetup = []() {
ModulesSetup::instance()->setup();
};
#endif

#if (defined (_MSCVER) || defined (_MSC_VER))
// On MSVC under Windows, we need to manually retrieve the command-line arguments and convert them from UTF-16 to UTF-8.
Expand Down Expand Up @@ -98,7 +106,7 @@ int main(int argc, char** argv)

#ifdef BUILD_UI_MU4
mu::appshell::AppShell app;
return app.run(argcFinal, argvFinal);
return app.run(argcFinal, argvFinal, moduleSetup);
#else
return Ms::runApplication(argcFinal, argvFinal);
#endif
Expand Down
6 changes: 6 additions & 0 deletions main/modulessetup.cpp
Expand Up @@ -25,6 +25,8 @@
#include "mu4/appshell/appshellmodule.h"
#include "mu4/scores/scoresmodule.h"
#include "mu4/extensions/extensionsmodule.h"
#include "mu4/domain/notation/notationdomainmodule.h"
#include "mu4/scenes/notation/notationscenemodule.h"

#ifdef BUILD_TELEMETRY_MODULE
#include "framework/telemetry/telemetrysetup.h"
Expand All @@ -43,11 +45,15 @@
ModulesSetup::ModulesSetup()
{
m_modulesSetupList
#ifdef BUILD_UI_MU4
<< new mu::framework::UiModule()
<< new mu::framework::UiComponentsModule()
<< new mu::appshell::AppShellModule()
<< new mu::scores::ScoresModule()
<< new mu::extensions::ExtensionsModule()
<< new mu::domain::notation::NotationDomainModule()
<< new mu::scene::notation::NotationSceneModule()
#endif

#ifdef BUILD_TELEMETRY_MODULE
<< new TelemetrySetup()
Expand Down
5 changes: 5 additions & 0 deletions mu4/CMakeLists.txt
Expand Up @@ -2,7 +2,12 @@

add_subdirectory(appshell)

# Domain
add_subdirectory(domain/notation)

# Home
add_subdirectory(scores)
add_subdirectory(extensions)

# Notation
add_subdirectory(scenes/notation)
4 changes: 3 additions & 1 deletion mu4/appshell/appshell.cpp
Expand Up @@ -32,7 +32,7 @@ AppShell::AppShell()
{
}

int AppShell::run(int argc, char** argv)
int AppShell::run(int argc, char** argv, std::function<void()> moduleSetup)
{
LOGI() << "start run";

Expand All @@ -41,6 +41,8 @@ int AppShell::run(int argc, char** argv)

QApplication app(argc, argv);

moduleSetup();

QQmlApplicationEngine* engine = new QQmlApplicationEngine();
//! NOTE Move ownership to UiEngine
framework::UiEngine::instance()->moveQQmlEngine(engine);
Expand Down
2 changes: 1 addition & 1 deletion mu4/appshell/appshell.h
Expand Up @@ -29,7 +29,7 @@ class AppShell
public:
AppShell();

int run(int argc, char** argv);
int run(int argc, char** argv, std::function<void()> moduleSetup);
};
}
}
Expand Down
1 change: 1 addition & 0 deletions mu4/appshell/appshell.qrc
Expand Up @@ -7,5 +7,6 @@
<file>qml/HomePage/HomePage.qml</file>
<file>qml/HomePage/HomeMenu.qml</file>
<file>qml/NotationPage/NotationPage.qml</file>
<file>qml/NotationPage/NotationToolBar.qml</file>
</qresource>
</RCC>
4 changes: 2 additions & 2 deletions mu4/appshell/dockwindow/qmllistproperty.h
Expand Up @@ -44,9 +44,9 @@ template<typename T>
class QmlListProperty
{
public:

explicit QmlListProperty(QObject* parent)
: _parent(parent),
_notifier(new QmlListPropertyNotifier())
: _parent(parent), _notifier(new QmlListPropertyNotifier())
{}
~QmlListProperty() { delete _notifier; }

Expand Down
2 changes: 1 addition & 1 deletion mu4/appshell/qml/HomePage/HomeMenu.qml
@@ -1,4 +1,4 @@
import QtQuick 2.9
import QtQuick 2.7
import QtQuick.Controls 2.2

Rectangle {
Expand Down
2 changes: 1 addition & 1 deletion mu4/appshell/qml/HomePage/HomePage.qml
@@ -1,4 +1,4 @@
import QtQuick 2.9
import QtQuick 2.7
import MuseScore.Ui 1.0
import MuseScore.Dock 1.0

Expand Down
4 changes: 2 additions & 2 deletions mu4/appshell/qml/Main.qml
@@ -1,4 +1,4 @@
import QtQuick 2.9
import QtQuick 2.7
import MuseScore.Dock 1.0

import "./HomePage"
Expand All @@ -12,7 +12,7 @@ DockWindow {

color: ui.theme.window

currentPageName: "notation"
currentPageName: "home"

toolbar: DockToolBar {

Expand Down
2 changes: 1 addition & 1 deletion mu4/appshell/qml/MainToolBar.qml
@@ -1,4 +1,4 @@
import QtQuick 2.9
import QtQuick 2.7

Rectangle {

Expand Down

0 comments on commit 4650a2f

Please sign in to comment.