LCOV - code coverage report
Current view: top level - src/appshell/internal - appshellcommandscontroller.h Coverage Total Hit
Test: filtered_coverage.info Lines: 0.0 % 3 0
Test Date: 2026-11-05 04:07:02

            Line data    Source code
       1              : /*
       2              :  * SPDX-License-Identifier: GPL-3.0-only
       3              :  * MuseScore-Studio-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              : #ifndef MU_APPSHELL_APPLICATIONCONTROLLER_H
      23              : #define MU_APPSHELL_APPLICATIONCONTROLLER_H
      24              : 
      25              : #include <QObject>
      26              : 
      27              : #include "async/asyncable.h"
      28              : #include "rcommand/commandable.h"
      29              : #include "rcommand/commandtypes.h"
      30              : 
      31              : #include "modularity/ioc.h"
      32              : #include "rcommand/icommanddispatcher.h"
      33              : #include "ui/imainwindow.h"
      34              : #include "languages/ilanguagesservice.h"
      35              : #include "interactive/iinteractive.h"
      36              : #include "interactive/iplatforminteractive.h"
      37              : #include "iappshellconfiguration.h"
      38              : #include "multiwindows/imultiwindowsprovider.h"
      39              : #include "project/iopenprojectscenario.h"
      40              : #include "project/icloseprojectscenario.h"
      41              : #include "project/iconvertfiletoscorescenario.h"
      42              : #include "project/iprojectsession.h"
      43              : #include "update/iappupdateservice.h"
      44              : #include "audio/main/isoundfontinstallscenario.h"
      45              : #include "istartupscenario.h"
      46              : #include "iapplication.h"
      47              : #include "extensions/iextensioninstaller.h"
      48              : #include "playback/iplaybackcontroller.h"
      49              : 
      50              : #include "iappshellcommandscontroller.h"
      51              : 
      52              : class QDragEnterEvent;
      53              : class QDragMoveEvent;
      54              : class QDropEvent;
      55              : 
      56              : namespace mu::appshell {
      57              : class AppshellCommandsController : public QObject, public IAppshellCommandsController, public muse::Contextable,
      58              :     public muse::async::Asyncable, public muse::rcommand::Commandable
      59              : {
      60              :     muse::GlobalInject<muse::mi::IMultiWindowsProvider> multiwindowsProvider;
      61              :     muse::GlobalInject<IAppShellConfiguration> configuration;
      62              :     muse::GlobalInject<muse::languages::ILanguagesService> languagesService;
      63              :     muse::GlobalInject<muse::IApplication> application;
      64              :     muse::GlobalInject<muse::IPlatformInteractive> platformInteractive;
      65              :     muse::ContextInject<muse::extensions::IExtensionInstaller> extensionInstaller = { this };
      66              :     muse::ContextInject<muse::rcommand::ICommandDispatcher> commandDispatcher = { this };
      67              :     muse::ContextInject<muse::ui::IMainWindow> mainWindow = { this };
      68              :     muse::ContextInject<muse::IInteractive> interactive = { this };
      69              :     muse::ContextInject<project::IOpenProjectScenario> openProjectScenario = { this };
      70              :     muse::ContextInject<project::ICloseProjectScenario> closeProjectScenario = { this };
      71              :     muse::ContextInject<project::IConvertFileToScoreScenario> convertFileToScoreScenario = { this };
      72              :     muse::ContextInject<muse::update::IAppUpdateService> appUpdateService = { this };
      73              :     muse::ContextInject<muse::audio::ISoundFontInstallScenario> soundFontInstallScenario = { this };
      74              :     muse::ContextInject<IStartupScenario> startupScenario = { this };
      75              :     muse::ContextInject<project::IProjectSession> projectSession = { this };
      76              :     muse::ContextInject<playback::IPlaybackState> playbackState = { this };
      77              : 
      78              : public:
      79            0 :     AppshellCommandsController(const muse::modularity::ContextPtr& iocCtx)
      80            0 :         : muse::Contextable(iocCtx)
      81              :     {
      82            0 :     }
      83              : 
      84              :     void preInit();
      85              :     void init();
      86              : 
      87              :     // IAppshellCommandsController
      88              :     muse::rcommand::Command dockToggleCommand(const DockName& dockName) const override;
      89              :     DockName commandDockName(const muse::rcommand::Command& command) const override;
      90              :     muse::async::Channel<DockName> dockToggleRequested() const override;
      91              :     // ------------------------------
      92              : 
      93              :     muse::ValCh<bool> isFullScreen() const;
      94              : 
      95              : private:
      96              : 
      97              :     enum DragTarget {
      98              :         Unknown = 0,
      99              :         ProjectFile,
     100              :         SoundFont,
     101              :         Extension,
     102              :         ConvertibleFile
     103              :     };
     104              : 
     105              :     bool eventFilter(QObject* watched, QEvent* event) override;
     106              : 
     107              :     QWindow* qWindow() const;
     108              : 
     109              :     DragTarget dragTarget(const QUrl& url) const;
     110              :     bool onDragEnterEvent(QDragEnterEvent* event);
     111              :     bool onDragMoveEvent(QDragMoveEvent* event);
     112              :     bool onDropEvent(QDropEvent* event);
     113              : 
     114              :     void setupConnections();
     115              : 
     116              :     static muse::async::Promise<muse::Ret> resolvedPromise(const muse::Ret& ret);
     117              : 
     118              :     muse::async::Promise<muse::Ret> quit(const muse::rcommand::Params& params);
     119              :     muse::async::Promise<muse::Ret> quit(bool isAllInstances, const muse::io::path_t& installerPath = muse::io::path_t());
     120              :     void doQuit(bool isAllInstances, const muse::io::path_t& installerPath);
     121              :     void restart();
     122              : 
     123              :     void toggleFullScreen();
     124              :     void openAboutDialog();
     125              :     void openAboutQtDialog();
     126              :     void openAboutMusicXMLDialog();
     127              : 
     128              :     void openOnlineHandbookPage();
     129              :     void openAskForHelpPage();
     130              :     void openAccessibilityStatementPage();
     131              :     void openPreferencesDialog();
     132              :     void doOpenPreferencesDialog();
     133              :     void openExtensions();
     134              : 
     135              :     void revertToFactorySettings();
     136              : 
     137              :     bool m_quiting = false;
     138              : 
     139              :     muse::async::Channel<DockName> m_dockToggleRequested;
     140              : };
     141              : }
     142              : 
     143              : #endif // MU_APPSHELL_APPLICATIONCONTROLLER_H
        

Generated by: LCOV version 2.0-1