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 <QDialog> 0010 #include <QVBoxLayout> 0011 #include <QDialogButtonBox> 0012 0013 #include "widgets/timeline/keyframe_editor_widget.hpp" 0014 0015 namespace glaxnimate::gui { 0016 0017 class KeyframeEditorDialog : public QDialog 0018 { 0019 public: 0020 KeyframeEditorDialog(const model::KeyframeTransition& trans = {}, QWidget* parent = nullptr) 0021 : QDialog(parent) 0022 { 0023 lay = new QVBoxLayout(this); 0024 setLayout(lay); 0025 editor = new KeyframeEditorWidget(this); 0026 set_transition(trans); 0027 lay->addWidget(editor); 0028 box = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel, this); 0029 lay->addWidget(box); 0030 connect(box, &QDialogButtonBox::accepted, this, &QDialog::accept); 0031 connect(box, &QDialogButtonBox::rejected, this, &QDialog::reject); 0032 } 0033 0034 void set_transition(const model::KeyframeTransition& trans) 0035 { 0036 this->trans = trans; 0037 editor->set_target(&this->trans); 0038 } 0039 0040 const model::KeyframeTransition& transition() const 0041 { 0042 return trans; 0043 } 0044 0045 private: 0046 QVBoxLayout* lay; 0047 KeyframeEditorWidget* editor; 0048 QDialogButtonBox* box; 0049 model::KeyframeTransition trans; 0050 }; 0051 0052 } // namespace glaxnimate::gui