File indexing completed on 2025-02-02 04:11:25

0001 /*
0002  * SPDX-FileCopyrightText: 2019-2023 Mattia Basaglia <dev@dragon.best>
0003  *
0004  * SPDX-License-Identifier: GPL-3.0-or-later
0005  */
0006 
0007 #pragma once
0008 
0009 #include <memory>
0010 
0011 #include <QDialog>
0012 
0013 #include "io/base.hpp"
0014 
0015 namespace glaxnimate::gui {
0016 
0017 class IoStatusDialog : public QDialog
0018 {
0019     Q_OBJECT
0020 
0021 public:
0022     IoStatusDialog(const QIcon& icon, const QString& title, bool delete_on_close, QWidget* parent = nullptr);
0023     ~IoStatusDialog();
0024 
0025     void reset(io::ImportExport* ie, const QString& label);
0026     void disconnect_import_export();
0027 
0028     bool has_errors() const;
0029     void show_errors(const QString& success, const QString& failure);
0030 
0031 protected:
0032     void closeEvent(QCloseEvent* ev) override;
0033     void changeEvent(QEvent *e) override;
0034 
0035 private:
0036     void _on_error(const QString& message, app::log::Severity severity);
0037     void _on_progress_max_changed(int max);
0038     void _on_progress(int value);
0039     void _on_completed(bool success);
0040 
0041     class Private;
0042     std::unique_ptr<Private> d;
0043 };
0044 
0045 } // namespace glaxnimate::gui