Skip to content

Commit

Permalink
Implemented stubs for workspace 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 b2ff7d6 commit 15d4d47
Show file tree
Hide file tree
Showing 24 changed files with 618 additions and 3 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ set(CRASH_REPORT_URL "" CACHE STRING "URL where to send crash reports")

option(BUILD_NETWORK_MODULE "Build network module" ON)
option(BUILD_USERSCORES_MODULE "Build userscores module" ON)
option(BUILD_WORKSPACE_MODULE "Build workspace module" ON)
option(BUILD_CLOUD_MODULE "Build cloud module" ON)
option(BUILD_EXTENSIONS_MODULE "Build extensions module" ON)
option(BUILD_LANGUAGES_MODULE "Build languages 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 @@ -45,6 +45,7 @@

#cmakedefine BUILD_NETWORK_MODULE
#cmakedefine BUILD_USERSCORES_MODULE
#cmakedefine BUILD_WORKSPACE_MODULE
#cmakedefine BUILD_CLOUD_MODULE
#cmakedefine BUILD_EXTENSIONS_MODULE
#cmakedefine BUILD_LANGUAGES_MODULE
Expand Down
5 changes: 4 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ if (BUILD_USERSCORES_MODULE)
endif (BUILD_USERSCORES_MODULE)

add_subdirectory(converter)
add_subdirectory(workspace)

if (BUILD_WORKSPACE_MODULE)
add_subdirectory(workspace)
endif (BUILD_WORKSPACE_MODULE)

if (NOT OS_IS_WASM)
add_subdirectory(importexport)
Expand Down
9 changes: 8 additions & 1 deletion src/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
#include "stubs/instruments/instrumentsstubmodule.h"
#endif
#include "converter/convertermodule.h"
#include "workspace/workspacemodule.h"

#ifdef BUILD_VST
#include "framework/vst/vstmodule.h"
Expand All @@ -81,7 +80,11 @@
#endif

#ifndef Q_OS_WASM
#ifdef BUILD_WORKSPACE_MODULE
#include "workspace/workspacemodule.h"
#else
#include "stubs/workspace/workspacestubmodule.h"
#endif
#ifdef BUILD_PLUGINS_MODULE
#include "plugins/pluginsmodule.h"
#else
Expand Down Expand Up @@ -187,7 +190,11 @@ int main(int argc, char** argv)
app.addModule(new mu::importexport::ImportExportModule());
app.addModule(new mu::iex::bb::BBModule());
app.addModule(new mu::iex::musicxml::MusicXmlModule());
#ifdef BUILD_WORKSPACE_MODULE
app.addModule(new mu::workspace::WorkspaceModule());
#else
app.addModule(new mu::workspace::WorkspaceStubModule());
#endif
#ifdef BUILD_PLUGINS_MODULE
app.addModule(new mu::plugins::PluginsModule());
#else
Expand Down
4 changes: 4 additions & 0 deletions src/stubs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ if (NOT BUILD_USERSCORES_MODULE)
add_subdirectory(userscores)
endif (NOT BUILD_USERSCORES_MODULE)

if (NOT BUILD_WORKSPACE_MODULE)
add_subdirectory(workspace)
endif (NOT BUILD_WORKSPACE_MODULE)

if (NOT BUILD_CLOUD_MODULE)
add_subdirectory(cloud)
endif (NOT BUILD_CLOUD_MODULE)
Expand Down
39 changes: 39 additions & 0 deletions src/stubs/workspace/CMakeLists.txt
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.
#=============================================================================

set(MODULE workspace)
set(MODULE_QRC workspace.qrc)

set(MODULE_SRC
${CMAKE_CURRENT_LIST_DIR}/workspacestubmodule.cpp
${CMAKE_CURRENT_LIST_DIR}/workspacestubmodule.h
${CMAKE_CURRENT_LIST_DIR}/workspacestub.cpp
${CMAKE_CURRENT_LIST_DIR}/workspacestub.h
${CMAKE_CURRENT_LIST_DIR}/workspacemanagerstub.cpp
${CMAKE_CURRENT_LIST_DIR}/workspacemanagerstub.h
${CMAKE_CURRENT_LIST_DIR}/workspaceconfigurationstub.cpp
${CMAKE_CURRENT_LIST_DIR}/workspaceconfigurationstub.h
${CMAKE_CURRENT_LIST_DIR}/workspacedatastreamregisterstub.cpp
${CMAKE_CURRENT_LIST_DIR}/workspacedatastreamregisterstub.h
${CMAKE_CURRENT_LIST_DIR}/internal/workspacecreatorstub.cpp
${CMAKE_CURRENT_LIST_DIR}/internal/workspacecreatorstub.h
)

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

28 changes: 28 additions & 0 deletions src/stubs/workspace/internal/workspacecreatorstub.cpp
Original file line number Diff line number Diff line change
@@ -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 "workspacecreatorstub.h"

#include "workspacestub.h"

using namespace mu::workspace;

IWorkspacePtr WorkspaceCreatorStub::newWorkspace(const std::string&) const
{
return std::make_shared<WorkspaceStub>();
}
32 changes: 32 additions & 0 deletions src/stubs/workspace/internal/workspacecreatorstub.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_WORKSPACE_WORKSPACECREATORSTUB_H
#define MU_WORKSPACE_WORKSPACECREATORSTUB_H

#include "workspace/internal/iworkspacecreator.h"

namespace mu::workspace {
class WorkspaceCreatorStub : public IWorkspaceCreator
{
public:
IWorkspacePtr newWorkspace(const std::string& workspaceName) const override;
};
}

#endif // MU_WORKSPACE_WORKSPACECREATORSTUB_H
21 changes: 21 additions & 0 deletions src/stubs/workspace/qml/MuseScore/Workspace/NewWorkspaceDialog.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import QtQuick 2.15

import MuseScore.Ui 1.0
import MuseScore.UiComponents 1.0

QmlDialog {
id: root

height: 600
width: 1024

Rectangle {
anchors.fill: parent
color: ui.theme.backgroundPrimaryColor

StyledTextLabel {
anchors.centerIn: parent
text: "New Workspace Dialog Stub"
}
}
}
12 changes: 12 additions & 0 deletions src/stubs/workspace/qml/MuseScore/Workspace/WorkspacesControl.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import QtQuick 2.15

import MuseScore.UiComponents 1.0

Rectangle {
color: ui.theme.backgroundPrimaryColor

StyledTextLabel {
anchors.centerIn: parent
text: "Workspace Control Stub"
}
}
21 changes: 21 additions & 0 deletions src/stubs/workspace/qml/MuseScore/Workspace/WorkspacesDialog.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import QtQuick 2.15

import MuseScore.Ui 1.0
import MuseScore.UiComponents 1.0

QmlDialog {
id: root

height: 600
width: 1024

Rectangle {
anchors.fill: parent
color: ui.theme.backgroundPrimaryColor

StyledTextLabel {
anchors.centerIn: parent
text: "Workspaces Dialog Stub"
}
}
}
4 changes: 4 additions & 0 deletions src/stubs/workspace/qml/MuseScore/Workspace/qmldir
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module MuseScore.Workspace
WorkspacesControl 1.0 WorkspacesControl.qml
WorkspacesDialog 1.0 WorkspacesDialog.qml
NewWorkspaceDialog 1.0 NewWorkspaceDialog.qml
8 changes: 8 additions & 0 deletions src/stubs/workspace/workspace.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<RCC>
<qresource prefix="/">
<file>qml/MuseScore/Workspace/WorkspacesControl.qml</file>
<file>qml/MuseScore/Workspace/WorkspacesDialog.qml</file>
<file>qml/MuseScore/Workspace/NewWorkspaceDialog.qml</file>
<file>qml/MuseScore/Workspace/qmldir</file>
</qresource>
</RCC>
46 changes: 46 additions & 0 deletions src/stubs/workspace/workspaceconfigurationstub.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
//=============================================================================
// 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 "workspaceconfigurationstub.h"

using namespace mu::workspace;
using namespace mu;

io::paths WorkspaceConfigurationStub::workspacePaths() const
{
return {};
}

io::path WorkspaceConfigurationStub::userWorkspacesDirPath() const
{
return io::path();
}

io::path WorkspaceConfigurationStub::userWorkspacePath(const std::string&) const
{
return io::path();
}

ValCh<std::string> WorkspaceConfigurationStub::currentWorkspaceName() const
{
return ValCh<std::string>();
}

void WorkspaceConfigurationStub::setCurrentWorkspaceName(const std::string&)
{
}
38 changes: 38 additions & 0 deletions src/stubs/workspace/workspaceconfigurationstub.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//=============================================================================
// 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_WORKSPACE_WORKSPACECONFIGURATIONSTUB_H
#define MU_WORKSPACE_WORKSPACECONFIGURATIONSTUB_H

#include "workspace/iworkspaceconfiguration.h"

namespace mu::workspace {
class WorkspaceConfigurationStub : public IWorkspaceConfiguration
{
public:
io::paths workspacePaths() const override;

io::path userWorkspacesDirPath() const override;
io::path userWorkspacePath(const std::string& workspaceName) const override;

ValCh<std::string> currentWorkspaceName() const override;
void setCurrentWorkspaceName(const std::string& workspaceName) override;
};
}

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

using namespace mu::workspace;

void WorkspaceDataStreamRegisterStub::regStream(IWorkspaceDataStreamPtr)
{
}

IWorkspaceDataStreamPtrList WorkspaceDataStreamRegisterStub::streams() const
{
return {};
}
33 changes: 33 additions & 0 deletions src/stubs/workspace/workspacedatastreamregisterstub.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_WORKSPACE_WORKSPACEDATASTREAMREGISTERSTUB_H
#define MU_WORKSPACE_WORKSPACEDATASTREAMREGISTERSTUB_H

#include "workspace/iworkspacedatastreamregister.h"

namespace mu::workspace {
class WorkspaceDataStreamRegisterStub : public IWorkspaceDataStreamRegister
{
public:
void regStream(IWorkspaceDataStreamPtr stream) override;
IWorkspaceDataStreamPtrList streams() const override;
};
}

#endif // MU_WORKSPACE_WORKSPACEDATASTREAMREGISTERSTUB_H
Loading

0 comments on commit 15d4d47

Please sign in to comment.