LCOV - code coverage report
Current view: top level - muse/framework/global/internal - baseapplication.h Coverage Total Hit
Test: filtered_coverage.info Lines: 0.0 % 7 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              : #pragma once
      23              : 
      24              : #include <vector>
      25              : #include <memory>
      26              : 
      27              : #include "../iapplication.h"
      28              : 
      29              : #include "global/modularity/ioc.h"
      30              : #include "global/itickerprovider.h"
      31              : #include "global/modularity/imodulesetup.h"
      32              : 
      33              : #include "cmdoptions.h"
      34              : 
      35              : namespace muse {
      36              : class GlobalModule;
      37              : class BaseApplication : public IApplication, public std::enable_shared_from_this<BaseApplication>
      38              : {
      39              :     GlobalInject<ITickerProvider> tickerProvider;
      40              : public:
      41              : 
      42              :     BaseApplication(const std::shared_ptr<CmdOptions>& appOptions);
      43              : 
      44              :     static String appName();
      45              :     static String appTitle();
      46              :     static bool appUnstable();
      47              :     static Version appVersion();
      48              :     static Version appFullVersion();
      49              :     static String appBuild();
      50              :     static String appRevision();
      51              : 
      52            0 :     String name() const override { return appName(); }
      53            0 :     String title() const override { return appTitle(); }
      54            0 :     bool unstable() const override { return appUnstable(); }
      55            0 :     Version version() const override { return appVersion(); }
      56            0 :     Version fullVersion() const override { return appFullVersion(); }
      57            0 :     String build() const override { return appBuild(); }
      58            0 :     String revision() const override { return appRevision(); }
      59              : 
      60              :     void setRunMode(const RunMode& mode);
      61              :     RunMode runMode() const override;
      62              :     bool noGui() const override;
      63              : 
      64              :     void addModule(modularity::IModuleSetup* module);
      65              : 
      66              :     // application lifecycle
      67              :     void setup() override;
      68              :     void restart() override;
      69              :     void finish() override;
      70              : 
      71              :     // context management
      72              :     muse::modularity::ContextPtr setupNewContext(const muse::StringList& args = {}) override;
      73              :     void destroyContext(const muse::modularity::ContextPtr& ctx) override;
      74              :     size_t contextCount() const override;
      75              :     std::vector<muse::modularity::ContextPtr> contexts() const override;
      76              : 
      77              :     // runtime
      78              :     void processEvents() override;
      79              : 
      80              : #ifndef NO_QT_SUPPORT
      81              :     QWindow* focusWindow() const override;
      82              :     bool notify(QObject* object, QEvent* event) override;
      83              : 
      84              :     Qt::KeyboardModifiers keyboardModifiers() const override;
      85              : #endif
      86              : 
      87              : protected:
      88              : 
      89              :     struct ContextData {
      90              :         muse::modularity::ContextPtr ctxId;
      91              :         bool initializing = false;
      92              :         std::shared_ptr<CmdOptions> options;
      93              :         std::vector<muse::modularity::IContextSetup*> setups;
      94              : 
      95              :         bool isValid() const { return ctxId != nullptr && !setups.empty(); }
      96              :     };
      97              : 
      98              :     virtual void doSetup(const std::shared_ptr<CmdOptions>& options);
      99              :     virtual void doFinish();
     100              :     virtual void applyCommandLineOptions(const std::shared_ptr<CmdOptions>& options);
     101              : 
     102              :     ContextData& contextData(const muse::modularity::ContextPtr& ctx);
     103              :     virtual std::shared_ptr<CmdOptions> makeContextOptions(const muse::StringList& args) const;
     104              :     virtual void showContextSplash(const muse::modularity::ContextPtr& ctx);
     105              :     virtual void setupContext(const muse::modularity::ContextPtr& ctx);
     106              :     virtual void startupScenario(const muse::modularity::ContextPtr& ctx) = 0;
     107              :     virtual void doDestroyContext(const ContextData& data);
     108              : 
     109              :     RunMode m_runMode = RunMode::GuiApp;
     110              : 
     111              :     //! NOTE Separately to initialize logger and profiler as early as possible
     112              :     muse::GlobalModule* m_globalModule = nullptr;
     113              :     std::vector<muse::modularity::IModuleSetup*> m_modules;
     114              :     std::shared_ptr<CmdOptions> m_appOptions;
     115              : 
     116              :     std::vector<ContextData> m_contexts;
     117              : 
     118              :     FinishMode m_finishMode = FinishMode::Default;
     119              : };
     120              : }
        

Generated by: LCOV version 2.0-1