Changeset View
Changeset View
Standalone View
Standalone View
plugins/dockers/animation/timeline_insert_keyframe_dialog.cpp
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright (c) 2018 Emmet O'Neill <emmetoneill.pdx@gmail.com> | ||||
3 | * Copyright (c) 2018 Eoin O'Neill <eoinoneill1991@gmail.com> | ||||
4 | * | ||||
5 | * This program is free software; you can redistribute it and/or modify | ||||
6 | * it under the terms of the GNU General Public License as published by | ||||
7 | * the Free Software Foundation; either version 2 of the License, or | ||||
8 | * (at your option) any later version. | ||||
9 | * | ||||
10 | * This program is distributed in the hope that it will be useful, | ||||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
13 | * GNU General Public License for more details. | ||||
14 | * | ||||
15 | * You should have received a copy of the GNU General Public License | ||||
16 | * along with this program; if not, write to the Free Software | ||||
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||||
18 | */ | ||||
19 | | ||||
1 | #include "timeline_insert_keyframe_dialog.h" | 20 | #include "timeline_insert_keyframe_dialog.h" | ||
21 | #include "timeline_frames_view.h" | ||||
2 | 22 | | |||
3 | #include <QLabel> | 23 | #include <QLabel> | ||
24 | #include <QGroupBox> | ||||
4 | #include <QSpinBox> | 25 | #include <QSpinBox> | ||
26 | #include <QRadioButton> | ||||
5 | #include <QDialogButtonBox> | 27 | #include <QDialogButtonBox> | ||
6 | #include <QVBoxLayout> | 28 | #include <QVBoxLayout> | ||
7 | #include <QFormLayout> | 29 | #include <QFormLayout> | ||
Context not available. | |||||
14 | setModal(true); | 36 | setModal(true); | ||
15 | setLayout(new QVBoxLayout(this)); | 37 | setLayout(new QVBoxLayout(this)); | ||
16 | 38 | | |||
17 | frameCountSpinbox.setMinimum(1); | 39 | { // Count and Spacing Forms. | ||
18 | frameCountSpinbox.setValue(1); | 40 | QWidget *forms = new QWidget(this); | ||
41 | layout()->addWidget(forms); | ||||
42 | | ||||
43 | frameCountSpinbox.setMinimum(1); | ||||
44 | frameCountSpinbox.setValue(1); | ||||
45 | | ||||
46 | frameTimingSpinbox.setMinimum(1); | ||||
47 | frameTimingSpinbox.setValue(1); | ||||
48 | | ||||
49 | QFormLayout *LO = new QFormLayout(this); | ||||
50 | forms->setLayout(LO); | ||||
51 | | ||||
52 | LO->addRow(QString(i18nc("@label:spinbox", "Number of frames:")), &frameCountSpinbox); | ||||
53 | LO->addRow(QString(i18nc("@label:spinbox", "Frame timing:")), &frameTimingSpinbox); | ||||
54 | } | ||||
55 | | ||||
56 | { // Side Buttons. | ||||
57 | QGroupBox *sideRadioButtons = new QGroupBox(i18nc("@label:group","Side:"), this); | ||||
58 | layout()->addWidget(sideRadioButtons); | ||||
19 | 59 | | |||
20 | frameTimingSpinbox.setMinimum(1); | 60 | leftBefore = new QRadioButton(i18nc("@label:radio", "Left / Before"), sideRadioButtons); | ||
21 | frameTimingSpinbox.setValue(1); | 61 | rightAfter = new QRadioButton(i18nc("@label:radio", "Right / After"), sideRadioButtons); | ||
62 | leftBefore->setChecked(true); | ||||
22 | 63 | | |||
23 | QWidget *formsWidget = new QWidget(); | 64 | QVBoxLayout *LO = new QVBoxLayout(this); | ||
24 | QFormLayout *formLayout = new QFormLayout(); | 65 | sideRadioButtons->setLayout(LO); | ||
25 | formsWidget->setLayout( formLayout ); | | |||
26 | layout()->addWidget(formsWidget); | | |||
27 | 66 | | |||
28 | QDialogButtonBox *buttonbox = new QDialogButtonBox(QDialogButtonBox::Cancel | QDialogButtonBox::Ok); | 67 | LO->addWidget(leftBefore); | ||
29 | layout()->addWidget(buttonbox); | 68 | LO->addWidget(rightAfter); | ||
69 | } | ||||
30 | 70 | | |||
31 | formLayout->addRow(QString(i18nc("@label:spinbox", "Number of frames:")), &frameCountSpinbox); | 71 | { // Cancel / OK Buttons. | ||
32 | formLayout->addRow(QString(i18nc("@label:spinbox", "Frame timing:")), &frameTimingSpinbox); | 72 | QDialogButtonBox *buttonbox = new QDialogButtonBox(QDialogButtonBox::Cancel | QDialogButtonBox::Ok); | ||
73 | layout()->addWidget(buttonbox); | ||||
33 | 74 | | |||
34 | connect(buttonbox, SIGNAL(accepted()), this, SLOT(accept())); | 75 | connect(buttonbox, SIGNAL(accepted()), this, SLOT(accept())); | ||
35 | connect(buttonbox, SIGNAL(rejected()), this, SLOT(reject())); | 76 | connect(buttonbox, SIGNAL(rejected()), this, SLOT(reject())); | ||
77 | } | ||||
36 | } | 78 | } | ||
37 | 79 | | |||
38 | bool TimelineInsertKeyframeDialog::promptUserSettings(int &out_count, int &out_timing){ | 80 | bool TimelineInsertKeyframeDialog::promptUserSettings(int &out_count, int &out_timing, TimelineDirection &out_direction) | ||
39 | if(exec() == QDialog::Accepted){ | 81 | { | ||
82 | if (exec() == QDialog::Accepted) { | ||||
40 | out_count = frameCountSpinbox.value(); | 83 | out_count = frameCountSpinbox.value(); | ||
41 | out_timing = frameTimingSpinbox.value(); | 84 | out_timing = frameTimingSpinbox.value(); | ||
85 | | ||||
86 | out_direction = TimelineDirection::LEFT; // Default | ||||
87 | if (rightAfter && rightAfter->isChecked()) { | ||||
88 | out_direction = TimelineDirection::RIGHT; | ||||
89 | } | ||||
90 | | ||||
42 | return true; | 91 | return true; | ||
43 | } | 92 | } | ||
44 | return false; | 93 | return false; | ||
Context not available. |