iVS3D v2.0.9
Loading...
Searching...
No Matches
nthframe.h
1#pragma once
2
3#include <QObject>
4#include <QWidget>
5#include <QString>
6#include <QMap>
7#include <QVariant>
8#include <memory>
9#include <vector>
10
11#include "ibase.h"
12#include "iselection.h"
13
31class NthFrame : public PLUG::IBase, public PLUG::ISelection {
32 Q_OBJECT
33 Q_PLUGIN_METADATA(IID "iVS3D.IBase")
34 Q_PLUGIN_METADATA(IID "iVS3D.ISelection")
35 Q_INTERFACES(PLUG::IBase PLUG::ISelection)
36
37public:
39 NthFrame();
40
42 ~NthFrame() = default;
43
44 // IBase interface implementation
45 QString getName() const override;
47 QMap<QString, QVariant> getSettings() const override;
48 PLUG::ApplySettingsResult applySettings(const QMap<QString, QVariant>& settings) override;
49 void activate() override;
50 void deactivate() override;
51 void onCudaChanged(bool enabled) override;
53
54 // ISelection interface implementation
55 PLUG::SelectionResult selectImages(const PLUG::SelectionData& data, volatile bool& cancelFlag) override;
56
57signals:
58 void syncSettingsWidget(uint n, bool keepIsolated);
59
60private slots:
61 void slot_nChanged(int n);
62 void slot_checkboxToggled(bool checked);
63
64private:
65 std::unique_ptr<QWidget> createSettingsWidget();
66
67 // Settings
68 unsigned int m_n = 1;
69 bool m_keepIsolated = true;
70 int m_fps = 30;
71 uint m_numFrames = 0;
72
73 // UI components
74};
75
The NthFrame class implements the IBase and ISelection plugin interfaces to select every Nth frame as...
Definition nthframe.h:31
int m_fps
Frames per second from video (for default N calculation)
Definition nthframe.h:70
void activate() override
activate is called when the plugin is activated in iVS3D. Plugins can override this method to perform...
Definition nthframe.cpp:78
~NthFrame()=default
Destructor.
NthFrame()
Constructor initializing N to 1 and default settings.
Definition nthframe.cpp:33
PLUG::SelectionResult selectImages(const PLUG::SelectionData &data, volatile bool &cancelFlag) override
Selects images based on the provided selection data.
Definition nthframe.cpp:111
bool m_keepIsolated
Keep isolated images outside the N-frame pattern.
Definition nthframe.h:69
PLUG::SettingsWidgetResult getSettingsWidget() override
getSettingsWidget creates and returns a settings QWidget for this plugin.
Definition nthframe.cpp:45
void deactivate() override
deactivate is called when the plugin is deactivated in iVS3D. Plugins can override this method to per...
Definition nthframe.cpp:82
QString getName() const override
getName returns the name of the plugin which will be displayed in the iVS3D interface.
Definition nthframe.cpp:41
QMap< QString, QVariant > getSettings() const override
getSettings retrieves the current settings of the plugin as a map of key-value pairs....
Definition nthframe.cpp:49
unsigned int m_n
Frame interval (select every Nth frame)
Definition nthframe.h:68
PLUG::InputLoadedResult onInputLoaded(const PLUG::InputData &input) override
onInputLoaded is called when a new input video or image set is loaded.
Definition nthframe.cpp:91
uint m_numFrames
Total frame count of the current input.
Definition nthframe.h:71
PLUG::ApplySettingsResult applySettings(const QMap< QString, QVariant > &settings) override
applySettings applies the provided settings to the plugin. This method is used to restore plugin conf...
Definition nthframe.cpp:56
void onCudaChanged(bool enabled) override
onCudaChanged is called when the CUDA usage setting is changed in iVS3D.
Definition nthframe.cpp:86
The IBase interface provides a base class for all plugin interfaces in iVS3D. It inherits from QObjec...
Definition ibase.h:102
Interface for keyframe/image-selection plugins in iVS3D.
Definition iselection.h:53
tl::expected< void, Error > InputLoadedResult
Type alias for the result of handling an input loaded event, which can be either a successful void re...
Definition ibase.h:58
tl::expected< void, Error > ApplySettingsResult
Type alias for the result of applying settings to a plugin, which can be either a successful void res...
Definition ibase.h:51
tl::expected< std::unique_ptr< QWidget >, Error > SettingsWidgetResult
Type alias for the result of a settings widget creation operation, which can be either a successful u...
Definition ibase.h:44
Struct to encapsulate data related to the input loaded event in iVS3D.
Definition ibase.h:71
Data available for image selection in ISelection plugins.
Definition iselection.h:31