LCOV - code coverage report
Current view: top level - muse/framework/toast - toastitem.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-Studio-CLA-applies
       4              :  *
       5              :  * MuseScore Studio
       6              :  * Music Composition & Notation
       7              :  *
       8              :  * Copyright (C) 2026 MuseScore Limited
       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 <chrono>
      25              : #include <memory>
      26              : #include <string>
      27              : #include <vector>
      28              : 
      29              : #include "global/async/notification.h"
      30              : #include "ui/view/iconcodes.h"
      31              : #include "global/progress.h"
      32              : 
      33              : #include "toasttypes.h"
      34              : 
      35              : namespace muse::toast {
      36              : class ToastItem
      37              : {
      38              : public:
      39              :     ToastItem(const std::string& title, const std::string& message, muse::ui::IconCode::Code iconCode, bool dismissible,
      40              :               std::chrono::seconds timeout = std::chrono::seconds(0), std::vector<ToastAction> actions = {});
      41              : 
      42              :     ToastItem(const std::string& title, const std::string& message, muse::ui::IconCode::Code iconCode, bool dismissible,
      43              :               std::vector<ToastAction> actions, std::shared_ptr<muse::Progress> progress, bool showProgressInfo);
      44            0 :     ~ToastItem() = default;
      45              : 
      46              :     int id() const;
      47              :     std::string title() const;
      48              :     std::string message() const;
      49              :     muse::ui::IconCode::Code iconCode() const;
      50              :     bool isDismissible() const;
      51              :     const std::vector<ToastAction>& actions() const;
      52              :     std::chrono::seconds timeout() const;
      53              : 
      54              :     double currentProgress() const;
      55              :     void setCurrentProgress(double progress);
      56              :     muse::async::Notification progressChanged() const;
      57              :     std::shared_ptr<muse::Progress> progress() const;
      58              :     bool showProgressInfo() const;
      59              :     int timeElapsed() const;
      60              : 
      61              : private:
      62              :     int m_id = 0;
      63              :     std::string m_title = "Title";
      64              :     std::string m_message = "Message";
      65              :     muse::ui::IconCode::Code m_iconCode = muse::ui::IconCode::Code::NONE;
      66              :     bool m_dismissible = true;
      67              :     std::chrono::seconds m_timeout = std::chrono::seconds(0);
      68              :     std::vector<ToastAction> m_actions;
      69              : 
      70              :     double m_currentProgress = 0;
      71              :     muse::async::Notification m_progressChanged;
      72              :     std::shared_ptr<muse::Progress> m_progress;
      73              :     bool m_showProgressInfo = false;
      74              : 
      75              :     std::chrono::steady_clock::time_point m_creationTime = std::chrono::steady_clock::now();
      76              : };
      77              : }
        

Generated by: LCOV version 2.0-1