diff --git a/app/src/actioncommands.cpp b/app/src/actioncommands.cpp index 347779eeb..bc3506653 100644 --- a/app/src/actioncommands.cpp +++ b/app/src/actioncommands.cpp @@ -46,6 +46,7 @@ GNU General Public License for more details. #include "vectorimage.h" #include "soundclip.h" #include "camera.h" +#include "previewframesdialog.h" #include "importimageseqdialog.h" #include "importpositiondialog.h" diff --git a/app/src/mainwindow2.cpp b/app/src/mainwindow2.cpp index 480ff2e38..3764e4570 100644 --- a/app/src/mainwindow2.cpp +++ b/app/src/mainwindow2.cpp @@ -17,6 +17,7 @@ GNU General Public License for more details. */ #include "mainwindow2.h" +#include "previewframesdialog.h" #include "ui_mainwindow2.h" // Qt headers @@ -323,6 +324,7 @@ void MainWindow2::createMenus() connect(ui->actionHorizontal_Flip, &QAction::triggered, mEditor->view(), &ViewManager::flipHorizontal); connect(ui->actionVertical_Flip, &QAction::triggered, mEditor->view(), &ViewManager::flipVertical); connect(mEditor->view(), &ViewManager::viewFlipped, this, &MainWindow2::viewFlipped); + connect(ui->actionPreview_frames, &QAction::triggered, this , &MainWindow2::previewFrames); PreferenceManager* prefs = mEditor->preference(); connect(ui->actionStatusBar, &QAction::triggered, ui->statusBar, &QStatusBar::setVisible); @@ -959,6 +961,18 @@ void MainWindow2::importAnimatedImage() mSuppressAutoSaveDialog = false; } +void MainWindow2::previewFrames() +{ + int currFrame = mEditor->currentFrame(); + auto layer = mEditor->layers()->currentLayer(); + if (layer->type() == Layer::SOUND || layer->type() == Layer::CAMERA) + return; + + int maxFrame = layer->getMaxKeyFramePosition(); + PreviewFramesDialog* preview = new PreviewFramesDialog(maxFrame, currFrame); + preview->open(); +} + void MainWindow2::lockWidgets(bool shouldLock) { QDockWidget::DockWidgetFeatures feat = shouldLock diff --git a/app/src/mainwindow2.h b/app/src/mainwindow2.h index 9f1b683f6..08f4d1b6e 100644 --- a/app/src/mainwindow2.h +++ b/app/src/mainwindow2.h @@ -45,6 +45,7 @@ class BackupElement; class LayerOpacityDialog; class PegBarAlignmentDialog; class RepositionFramesDialog; +class PreviewFramesDialog; class StatusBar; enum class SETTING; @@ -92,6 +93,8 @@ public slots: void importMovieVideo(); void importAnimatedImage(); + void previewFrames(); + void lockWidgets(bool shouldLock); void setOpacity(int opacity); @@ -173,6 +176,7 @@ private slots: PegBarAlignmentDialog* mPegAlign = nullptr; RepositionFramesDialog* mReposDialog = nullptr; LayerOpacityDialog* mLayerOpacityDialog = nullptr; + PreviewFramesDialog* mPreviewFramesDialog = nullptr; void createToolbars(); private: diff --git a/app/src/previewframesdialog.cpp b/app/src/previewframesdialog.cpp index 547f42179..68443ffd0 100644 --- a/app/src/previewframesdialog.cpp +++ b/app/src/previewframesdialog.cpp @@ -1,25 +1,28 @@ #include "previewframesdialog.h" #include "ui_previewframesdialog.h" -previewFramesDialog::previewFramesDialog(int maxFrame, int currentFrame) : +PreviewFramesDialog::PreviewFramesDialog(int maxFrame, int currentFrame) : QDialog(), - ui(new Ui::previewFramesDialog) + ui(new Ui::PreviewFramesDialog) { ui->setupUi(this); ui->frameSpinBox->setMinimum(1); ui->frameSpinBox->setMaximum(maxFrame); ui->frameSpinBox->setValue(currentFrame); - connect(ui->frameSpinBox, QOverload::of(&QSpinBox::valueChanged), this, &previewFramesDialog::frameChanged); - + setCurrentFrame(currentFrame); + setMaxFrame(maxFrame); + ui->labMaxNum->setText(QString::number(maxFrame)); + connect(ui->frameSpinBox, QOverload::of(&QSpinBox::valueChanged), this, &PreviewFramesDialog::frameChanged); } -previewFramesDialog::~previewFramesDialog() +PreviewFramesDialog::~PreviewFramesDialog() { delete ui; } -void previewFramesDialog::frameChanged(int frame) +void PreviewFramesDialog::frameChanged(int frame) { - + setCurrentFrame(frame); + ui->labFrame->setText(QString::number(frame)); } diff --git a/app/src/previewframesdialog.h b/app/src/previewframesdialog.h index 3b27c11cd..fae7c11b2 100644 --- a/app/src/previewframesdialog.h +++ b/app/src/previewframesdialog.h @@ -4,27 +4,33 @@ #include namespace Ui { -class previewFramesDialog; +class PreviewFramesDialog; } -class previewFramesDialog : public QDialog +class PreviewFramesDialog : public QDialog { Q_OBJECT public: - explicit previewFramesDialog(int maxFrame, int currentFrame); - ~previewFramesDialog(); + explicit PreviewFramesDialog(int maxFrame, int currentFrame); + ~PreviewFramesDialog(); void gotoFrame(); void frameChanged(int frame); void setMaxFrame(int max) { mMaxFrame = max; } int getMaxFrame() { return mMaxFrame; } + void setCurrentFrame(int curr) { mCurrentFrame = curr; } + int getCurrentFrame() { return mCurrentFrame; } + +signals: + void currentFrameChanged(int); private: int mMinFrame = 1; int mMaxFrame = 100; - Ui::previewFramesDialog *ui; + int mCurrentFrame = 1; + Ui::PreviewFramesDialog *ui; }; #endif // PREVIEWFRAMESDIALOG_H diff --git a/app/ui/previewframesdialog.ui b/app/ui/previewframesdialog.ui index e8416eb98..48bc0849b 100644 --- a/app/ui/previewframesdialog.ui +++ b/app/ui/previewframesdialog.ui @@ -1,7 +1,7 @@ - previewFramesDialog - + PreviewFramesDialog + 0 @@ -13,13 +13,13 @@ Dialog - + 9 10 1081 - 701 + 691 @@ -28,76 +28,58 @@ Preview frames - - - - 14 - 30 - 101 - 661 - - - - - - - - - Frame: - - - - - - - 1 - - - 100 - - - 1 - - - - - - - - - Max: 100 - - - - - - - Previous - - - - - - - Next - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - + + + + + Frame: + + + + + + + 1 + + + 100 + + + 1 + + + + + + + Maximum: + + + + + + + 1 + + + Qt::AlignCenter + + + + + + + Qt::Vertical + + + + 20 + 529 + + + + +