File indexing completed on 2024-12-15 04:00:59
0001 /* 0002 * SPDX-FileCopyrightText: 2019-2023 Mattia Basaglia <dev@dragon.best> 0003 * 0004 * SPDX-License-Identifier: GPL-3.0-or-later 0005 */ 0006 0007 #include "format_selection_dialog.hpp" 0008 0009 #include <QPushButton> 0010 #include <QVBoxLayout> 0011 0012 #include <QDebug> 0013 0014 class glaxnimate::android::FormatSelectionDialog::Private 0015 { 0016 public: 0017 io::ImportExport* format = nullptr; 0018 }; 0019 0020 glaxnimate::android::FormatSelectionDialog::FormatSelectionDialog(QWidget *parent) 0021 : BaseDialog(parent), 0022 d(std::make_unique<Private>()) 0023 { 0024 QVBoxLayout* lay = new QVBoxLayout(this); 0025 setLayout(lay); 0026 0027 for ( const auto& fmt : io::IoRegistry::instance().registered() ) 0028 { 0029 if ( fmt->slug() == "raster" ) 0030 continue; 0031 QPushButton *btn = new QPushButton(this); 0032 lay->addWidget(btn); 0033 btn->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); 0034 btn->setText(fmt->name()); 0035 connect(btn, &QPushButton::clicked, this, [this, fmt=fmt.get()](){ 0036 d->format = fmt; 0037 accept(); 0038 }); 0039 } 0040 } 0041 0042 glaxnimate::android::FormatSelectionDialog::~FormatSelectionDialog() 0043 {} 0044 0045 glaxnimate::io::ImportExport *glaxnimate::android::FormatSelectionDialog::format() const 0046 { 0047 return d->format; 0048 }