Skip to content

Commit

Permalink
Made previevFramesDialog, and made preparations for dof-features
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlamhauge committed Mar 8, 2024
1 parent 84b8322 commit 37806eb
Show file tree
Hide file tree
Showing 10 changed files with 188 additions and 8 deletions.
3 changes: 3 additions & 0 deletions app/app.pro
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ HEADERS += \
src/onionskinwidget.h \
src/predefinedsetmodel.h \
src/pegbaralignmentdialog.h \
src/previewframesdialog.h \
src/shortcutfilter.h \
src/actioncommands.h \
src/preferencesdialog.h \
Expand Down Expand Up @@ -121,6 +122,7 @@ SOURCES += \
src/onionskinwidget.cpp \
src/predefinedsetmodel.cpp \
src/pegbaralignmentdialog.cpp \
src/previewframesdialog.cpp \
src/shortcutfilter.cpp \
src/actioncommands.cpp \
src/preferencesdialog.cpp \
Expand Down Expand Up @@ -165,6 +167,7 @@ SOURCES += \
src/cameraoptionswidget.cpp

FORMS += \
ui/previewframesdialog.ui \
ui/cameraoptionswidget.ui \
ui/camerapropertiesdialog.ui \
ui/importimageseqpreview.ui \
Expand Down
25 changes: 25 additions & 0 deletions app/src/previewframesdialog.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include "previewframesdialog.h"
#include "ui_previewframesdialog.h"

previewFramesDialog::previewFramesDialog(int maxFrame, int currentFrame) :
QDialog(),
ui(new Ui::previewFramesDialog)
{
ui->setupUi(this);
ui->frameSpinBox->setMinimum(1);
ui->frameSpinBox->setMaximum(maxFrame);
ui->frameSpinBox->setValue(currentFrame);
connect(ui->frameSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &previewFramesDialog::frameChanged);

}

previewFramesDialog::~previewFramesDialog()
{
delete ui;
}


void previewFramesDialog::frameChanged(int frame)
{

}
30 changes: 30 additions & 0 deletions app/src/previewframesdialog.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#ifndef PREVIEWFRAMESDIALOG_H
#define PREVIEWFRAMESDIALOG_H

#include <QDialog>

namespace Ui {
class previewFramesDialog;
}

class previewFramesDialog : public QDialog
{
Q_OBJECT

public:
explicit previewFramesDialog(int maxFrame, int currentFrame);
~previewFramesDialog();

void gotoFrame();
void frameChanged(int frame);

void setMaxFrame(int max) { mMaxFrame = max; }
int getMaxFrame() { return mMaxFrame; }

private:
int mMinFrame = 1;
int mMaxFrame = 100;
Ui::previewFramesDialog *ui;
};

#endif // PREVIEWFRAMESDIALOG_H
2 changes: 1 addition & 1 deletion app/src/timelinecells.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1185,6 +1185,7 @@ void TimeLineCells::editCameraLayerProperties(LayerCamera* cameraLayer) const
cameraLayer->setViewRect(QRect(-dialog.getWidth() / 2, -dialog.getHeight() / 2, dialog.getWidth(), dialog.getHeight()));
cameraLayer->setAperture(dialog.getAperture());
cameraLayer->setDistance(dialog.getDistance());
emit cameraLayer->settingsChanged(cameraLayer->getDistance(), cameraLayer->getAperture());
mEditor->view()->forceUpdateViewTransform();
}

Expand Down Expand Up @@ -1225,7 +1226,6 @@ void TimeLineCells::editLayerSettings(Layer *layer) const
QString name = dialog.updateName().replace(regex, "");
artLayer->setName(name);
artLayer->setDistance(dialog.updateDistance());

}

void TimeLineCells::hScrollChange(int x)
Expand Down
8 changes: 7 additions & 1 deletion app/ui/mainwindow2.ui
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<x>0</x>
<y>0</y>
<width>831</width>
<height>24</height>
<height>26</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
Expand Down Expand Up @@ -213,6 +213,7 @@
<addaction name="actionShowOutlinesOnly"/>
<addaction name="separator"/>
<addaction name="actionPreview"/>
<addaction name="actionPreview_frames"/>
</widget>
<widget class="QMenu" name="menuAnimation">
<property name="title">
Expand Down Expand Up @@ -1285,6 +1286,11 @@
<string>30°</string>
</property>
</action>
<action name="actionPreview_frames">
<property name="text">
<string>Preview frames</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
Expand Down
111 changes: 111 additions & 0 deletions app/ui/previewframesdialog.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>previewFramesDialog</class>
<widget class="QDialog" name="previewFramesDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1096</width>
<height>711</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>9</x>
<y>10</y>
<width>1081</width>
<height>701</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Preview frames</string>
</property>
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>14</x>
<y>30</y>
<width>101</width>
<height>661</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="labFrame">
<property name="text">
<string>Frame:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="frameSpinBox">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="labMax">
<property name="text">
<string>Max: 100</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnPrevious">
<property name="text">
<string>Previous</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnNext">
<property name="text">
<string>Next</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QGraphicsView" name="graphicsView"/>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>
6 changes: 3 additions & 3 deletions core_lib/src/interface/editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ bool Editor::init()

makeConnections();

mIsAutosave = mPreferenceManager->isOn(SETTING::AUTO_SAVE);
mAutosaveNumber = mPreferenceManager->getInt(SETTING::AUTO_SAVE_NUMBER);
mIsAutosave = mPreferenceManager->isOn(::AUTO_SAVE);
mAutosaveNumber = mPreferenceManager->getInt(::AUTO_SAVE_NUMBER);

return true;
}
Expand All @@ -113,7 +113,7 @@ int Editor::fps()

void Editor::setFps(int fps)
{
mPreferenceManager->set(SETTING::FPS, fps);
mPreferenceManager->set(::FPS, fps);
emit fpsChanged(fps);
}

Expand Down
4 changes: 3 additions & 1 deletion core_lib/src/structure/layerbitmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ GNU General Public License for more details.
*/
#include "layerbitmap.h"
#include "blurutils.h"

#include <QDebug>
#include <QDir>
Expand Down Expand Up @@ -60,7 +61,8 @@ QRect LayerBitmap::getFrameBounds(int frame)

void LayerBitmap::updateDistanceNearFar()
{

qreal distance = getDistance();
qreal hyperFocalDist = getHyperfocalDistance(50.0f, 2.8f);
}

void LayerBitmap::loadImageAtFrame(QString path, QPoint topLeft, int frameNumber, qreal opacity)
Expand Down
3 changes: 3 additions & 0 deletions core_lib/src/structure/layercamera.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ class LayerCamera : public Layer
void setDistance(qreal dist) { mDistance = dist; }
qreal getDistance() { return mDistance; }

signals:
void settingsChanged(qreal mDistance, qreal mAperture);

protected:
Status saveKeyFrameFile(KeyFrame*, QString path) override;
KeyFrame* createKeyFrame(int position) override;
Expand Down
4 changes: 2 additions & 2 deletions core_lib/src/util/blurutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ inline qreal getDistanceFar(qreal h, qreal s, qreal fLength)
return (s*(h-fLength))/(h-s);
}

/** Get hyperfocal distance using coc, focal length and f-number.
/** Get hyperfocal distance using coc, focal length and f-number/aperture.
*
* Hyperfoacal distance is a distance beyond which,
* Hyperfocal distance is a distance beyond which,
* all objects can be brought into an "acceptable" focus.
* coc is Circle of confusion (=0.03)
* \param fLength in the cameras focal length, can vary from 30-300 mm (standard is 50 mm)
Expand Down

0 comments on commit 37806eb

Please sign in to comment.