LCOV - code coverage report
Current view: top level - muse/framework/ui - graphicsapiprovider.h Coverage Total Hit
Test: filtered_coverage.info Lines: 0.0 % 1 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) 2024 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 <functional>
      25              : #include <QString>
      26              : #include <QTimer>
      27              : #include <QQuickPaintedItem>
      28              : 
      29              : #include "global/types/version.h"
      30              : #include "uitypes.h"
      31              : 
      32              : namespace muse::ui {
      33              : class GraphicsProblemsDetectorLogDest;
      34              : class GraphicsTestObject;
      35              : class GraphicsApiProvider
      36              : {
      37              : public:
      38              : 
      39              :     GraphicsApiProvider(const Version& appVersion);
      40              :     ~GraphicsApiProvider();
      41              : 
      42              :     enum class Status {
      43              :         NeedCheck = 1, // switched to this api
      44              :         Checking,      // try checking
      45              :         Checked        // all good
      46              :     };
      47              : 
      48              :     static void setGraphicsApi(GraphicsApi api);
      49              :     static GraphicsApi graphicsApi();
      50              :     static QString graphicsApiName();
      51              : 
      52              :     static GraphicsApi apiByName(const QString& name);
      53              :     static QString apiName(GraphicsApi api);
      54              : 
      55              :     GraphicsApi requiredGraphicsApi();
      56              :     void setGraphicsApiStatus(GraphicsApi api, Status status);
      57              : 
      58              :     GraphicsApi nextGraphicsApi(GraphicsApi current) const;
      59              :     GraphicsApi switchToNextGraphicsApi(GraphicsApi current);
      60              : 
      61              :     using OnResult = std::function<void (bool res)>;
      62              :     void listen(const OnResult& f);
      63              :     void destroy();
      64              : 
      65              :     inline static bool testObjectIsAlive = false;
      66              :     inline static bool testObjectHasPainted = false;
      67              : 
      68              : private:
      69              : 
      70              :     QString dataFilePath() const;
      71              : 
      72              :     struct Data {
      73              :         QString appVersion;
      74              :         QString apiName;
      75              :         Status status = Status::NeedCheck;
      76              : 
      77            0 :         bool isValid() const { return !apiName.isEmpty(); }
      78              :     };
      79              : 
      80              :     Data readData() const;
      81              :     void writeData(const Data& d);
      82              : 
      83              :     Version m_appVersion;
      84              :     GraphicsProblemsDetectorLogDest* m_logDest = nullptr;
      85              :     OnResult m_onResult;
      86              :     QTimer m_timer;
      87              : };
      88              : }
        

Generated by: LCOV version 2.0-1