LCOV - code coverage report
Current view: top level - muse/framework/workspace/internal - workspaceactioncontroller.cpp Coverage Total Hit
Test: filtered_coverage.info Lines: 0.0 % 20 0
Test Date: 2026-11-05 04:07:02

            Line data    Source code
       1              : /*
       2              :  * SPDX-License-Identifier: GPL-3.0-only
       3              :  * MuseScore-CLA-applies
       4              :  *
       5              :  * MuseScore Studio
       6              :  * Music Composition & Notation
       7              :  *
       8              :  * Copyright (C) 2021 MuseScore Limited and others
       9              :  *
      10              :  * This program is free software: you can redistribute it and/or modify
      11              :  * it under the terms of the GNU General Public License version 3 as
      12              :  * published by the Free Software Foundation.
      13              :  *
      14              :  * This program is distributed in the hope that it will be useful,
      15              :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      16              :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      17              :  * GNU General Public License for more details.
      18              :  *
      19              :  * You should have received a copy of the GNU General Public License
      20              :  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
      21              :  */
      22              : #include "workspaceactioncontroller.h"
      23              : 
      24              : #include "rcommand/actiontocommand.h"
      25              : 
      26              : #include "../workspacecommands.h"
      27              : 
      28              : #include "log.h"
      29              : 
      30              : using namespace muse::workspace;
      31              : using namespace muse::actions;
      32              : using namespace muse::rcommand;
      33              : 
      34            0 : void WorkspaceActionController::init()
      35              : {
      36            0 :     commandDispatcher()->onRequest(this, WORKSPACE_SELECT_COMMAND, [this](const rcommand::Params& params) {
      37            0 :         return selectWorkspace(params);
      38              :     });
      39            0 :     commandDispatcher()->onRequest(this, WORKSPACES_CONFIGURE_COMMAND, [this]() { openWorkspacesConfigure(); return muse::make_ok(); });
      40            0 :     commandDispatcher()->onRequest(this, WORKSPACE_CREATE_COMMAND, [this]() { createNewWorkspace(); return muse::make_ok(); });
      41              : 
      42              :     // compat
      43              :     {
      44              :         static const std::vector<ActionToCommand> actionToCommands = {
      45            0 :             { "select-workspace", WORKSPACE_SELECT_COMMAND, make_conv({ { "name", param<std::string> } }) },
      46              :             { "configure-workspaces", WORKSPACES_CONFIGURE_COMMAND, {} },
      47              :             { "create-workspace", WORKSPACE_CREATE_COMMAND, {} }
      48            0 :         };
      49              : 
      50            0 :         rcommand::registerActionToCommand(this, actionToCommands, commandDispatcher(), dispatcher());
      51              :     }
      52            0 : }
      53              : 
      54            0 : muse::Ret WorkspaceActionController::selectWorkspace(const muse::rcommand::Params& params)
      55              : {
      56            0 :     std::string selectedWorkspace = params.at("name").toString();
      57            0 :     manager()->changeCurrentWorkspace(selectedWorkspace);
      58            0 :     return muse::make_ok();
      59            0 : }
      60              : 
      61            0 : void WorkspaceActionController::openWorkspacesConfigure()
      62              : {
      63            0 :     manager()->openConfigureWorkspacesDialog();
      64            0 : }
      65              : 
      66            0 : void muse::workspace::WorkspaceActionController::createNewWorkspace()
      67              : {
      68            0 :     manager()->createAndAppendNewWorkspace();
      69            0 : }
        

Generated by: LCOV version 2.0-1