Skip to content

Commit

Permalink
Review issues fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Eism authored and igorkorsukov committed Feb 10, 2021
1 parent 3783f84 commit 4c663f2
Show file tree
Hide file tree
Showing 24 changed files with 861 additions and 615 deletions.
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@ if (BUILD_FOR_WINSTORE)
set(FOR_WINSTORE 1)
endif(BUILD_FOR_WINSTORE)

set(APP_UPDATABLE 1)
if (OS_IS_MAC OR OS_IS_WIN)
if (WIN_PORTABLE OR FOR_WINSTORE)
set(APP_UPDATABLE 0)
endif(WIN_PORTABLE OR FOR_WINSTORE)
endif(OS_IS_MAC OR OS_IS_WIN)

###########################################
# Setup compiler and build environment
###########################################
Expand Down
2 changes: 2 additions & 0 deletions build/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@

#cmakedefine Q_WS_UIKIT

#cmakedefine APP_UPDATABLE

#define USE_BSP true

// does not work on windows/mac:
Expand Down
7 changes: 5 additions & 2 deletions src/appshell/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,17 @@ set(MODULE_SRC
${CMAKE_CURRENT_LIST_DIR}/appshell.h
${CMAKE_CURRENT_LIST_DIR}/commandlinecontroller.cpp
${CMAKE_CURRENT_LIST_DIR}/commandlinecontroller.h
${CMAKE_CURRENT_LIST_DIR}/iappshellconfiguration.h
${CMAKE_CURRENT_LIST_DIR}/internal/applicationactions.cpp
${CMAKE_CURRENT_LIST_DIR}/internal/applicationactions.h
${CMAKE_CURRENT_LIST_DIR}/internal/appshellconfiguration.cpp
${CMAKE_CURRENT_LIST_DIR}/internal/appshellconfiguration.h
${CMAKE_CURRENT_LIST_DIR}/internal/applicationactioncontroller.cpp
${CMAKE_CURRENT_LIST_DIR}/internal/applicationactioncontroller.h
${CMAKE_CURRENT_LIST_DIR}/view/settings/settingslistmodel.cpp
${CMAKE_CURRENT_LIST_DIR}/view/settings/settingslistmodel.h
${CMAKE_CURRENT_LIST_DIR}/view/menumodel.cpp
${CMAKE_CURRENT_LIST_DIR}/view/menumodel.h
${CMAKE_CURRENT_LIST_DIR}/view/appmenumodel.cpp
${CMAKE_CURRENT_LIST_DIR}/view/appmenumodel.h
${DOCKWINDOW_SRC}
)

Expand Down
17 changes: 12 additions & 5 deletions src/appshell/appshellmodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,17 @@

#include "internal/applicationactions.h"
#include "internal/applicationactioncontroller.h"
#include "internal/appshellconfiguration.h"
#include "view/dockwindow/docksetup.h"
#include "view/settings/settingslistmodel.h"
#include "view/menumodel.h"
#include "view/appmenumodel.h"

using namespace mu::appshell;
using namespace mu::framework;
using namespace mu::ui;

static std::shared_ptr<ApplicationActionController> s_actionController = std::make_shared<ApplicationActionController>();
static std::shared_ptr<ApplicationActionController> s_applicationActionController = std::make_shared<ApplicationActionController>();
static std::shared_ptr<AppShellConfiguration> s_appShellConfiguration = std::make_shared<AppShellConfiguration>();

static void appshell_init_qrc()
{
Expand All @@ -52,9 +54,14 @@ std::string AppShellModule::moduleName() const
return "appshell";
}

void AppShellModule::registerExports()
{
ioc()->registerExport<IAppShellConfiguration>(moduleName(), s_appShellConfiguration);
}

void AppShellModule::resolveImports()
{
auto ar = framework::ioc()->resolve<actions::IActionsRegister>(moduleName());
auto ar = ioc()->resolve<actions::IActionsRegister>(moduleName());
if (ar) {
ar->reg(std::make_shared<ApplicationActions>());
}
Expand All @@ -80,10 +87,10 @@ void AppShellModule::registerUiTypes()
dock::DockSetup::registerQmlTypes();

qmlRegisterType<SettingListModel>("MuseScore.Settings", 1, 0, "SettingListModel");
qmlRegisterType<MenuModel>("MuseScore.Menu", 1, 0, "MenuModel");
qmlRegisterType<AppMenuModel>("MuseScore.AppMenu", 1, 0, "AppMenuModel");
}

void AppShellModule::onInit(const IApplication::RunMode&)
{
s_actionController->init();
s_applicationActionController->init();
}
1 change: 1 addition & 0 deletions src/appshell/appshellmodule.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class AppShellModule : public framework::IModuleSetup

std::string moduleName() const override;

void registerExports() override;
void resolveImports() override;

void registerResources() override;
Expand Down
36 changes: 36 additions & 0 deletions src/appshell/iappshellconfiguration.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//=============================================================================
// MuseScore
// Music Composition & Notation
//
// Copyright (C) 2021 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_APPSHELL_IAPPSHELLCONFIGURATION_H
#define MU_APPSHELL_IAPPSHELLCONFIGURATION_H

#include "modularity/imoduleexport.h"

namespace mu::appshell {
class IAppShellConfiguration : MODULE_EXPORT_INTERFACE
{
INTERFACE_ID(IAppshellConfiguration)

public:
virtual ~IAppShellConfiguration() = default;

virtual bool isAppUpdatable() const = 0;
};
}

#endif // MU_APPSHELL_IAPPSHELLCONFIGURATION_H
2 changes: 1 addition & 1 deletion src/appshell/internal/applicationactioncontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// MuseScore
// Music Composition & Notation
//
// Copyright (C) 2020 MuseScore BVBA and others
// Copyright (C) 2021 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.
Expand Down
2 changes: 1 addition & 1 deletion src/appshell/internal/applicationactioncontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// MuseScore
// Music Composition & Notation
//
// Copyright (C) 2020 MuseScore BVBA and others
// Copyright (C) 2021 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.
Expand Down
2 changes: 1 addition & 1 deletion src/appshell/internal/applicationactions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// MuseScore
// Music Composition & Notation
//
// Copyright (C) 2020 MuseScore BVBA and others
// Copyright (C) 2021 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.
Expand Down
2 changes: 1 addition & 1 deletion src/appshell/internal/applicationactions.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// MuseScore
// Music Composition & Notation
//
// Copyright (C) 2020 MuseScore BVBA and others
// Copyright (C) 2021 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.
Expand Down
30 changes: 30 additions & 0 deletions src/appshell/internal/appshellconfiguration.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//=============================================================================
// MuseScore
// Music Composition & Notation
//
// Copyright (C) 2021 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 "appshellconfiguration.h"

using namespace mu::appshell;

bool AppShellConfiguration::isAppUpdatable() const
{
#if defined(APP_UPDATABLE)
return true;
#else
return false;
#endif
}
32 changes: 32 additions & 0 deletions src/appshell/internal/appshellconfiguration.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//=============================================================================
// MuseScore
// Music Composition & Notation
//
// Copyright (C) 2021 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_APPSHELL_APPSHELLCONFIGURATION_H
#define MU_APPSHELL_APPSHELLCONFIGURATION_H

#include "iappshellconfiguration.h"

namespace mu::appshell {
class AppShellConfiguration : public IAppShellConfiguration
{
public:
bool isAppUpdatable() const override;
};
}

#endif // MU_APPSHELL_APPSHELLCONFIGURATION_H
19 changes: 12 additions & 7 deletions src/appshell/qml/Window.qml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import MuseScore.Dock 1.0
import MuseScore.Ui 1.0
import MuseScore.Playback 1.0
import MuseScore.NotationScene 1.0
import MuseScore.Menu 1.0
import MuseScore.AppMenu 1.0
import MuseScore.Shortcuts 1.0

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

Component.onCompleted: {
shortcutsModel.load()
menuModel.load()
appMenuModel.load()
api.launcher.open(homePage.uri)
}

Expand All @@ -36,12 +36,17 @@ DockWindow {
readonly property int toolbarHeight: 48
property bool isNotationPage: currentPageUri === notationPage.uri

property ShortcutsInstanceModel shortcutsModel: ShortcutsInstanceModel { }
property var menuModel: MenuModel {}
property ShortcutsInstanceModel shortcutsModel: ShortcutsInstanceModel {}
property var appMenuModel: AppMenuModel {}

menues: menuModel.items
onActionTriggered: {
menuModel.handleAction(action)
menuBar: DockMenuBar {
objectName: "mainMenuBar"

items: appMenuModel.items

onActionTringgered: {
appMenuModel.handleAction(action)
}
}

toolbars: [
Expand Down
Loading

0 comments on commit 4c663f2

Please sign in to comment.