added more documentation
This commit is contained in:
@@ -187,7 +187,7 @@ void load_shader_effects() {
|
||||
}
|
||||
}
|
||||
|
||||
void init_effects() {
|
||||
void EffectInit::StartLoading() {
|
||||
EffectInit* init_thread = new EffectInit();
|
||||
QObject::connect(init_thread, SIGNAL(finished()), init_thread, SLOT(deleteLater()));
|
||||
init_thread->start();
|
||||
|
||||
+16
-2
@@ -24,12 +24,26 @@
|
||||
#include <QList>
|
||||
#include <QThread>
|
||||
|
||||
void init_effects();
|
||||
|
||||
/**
|
||||
* @brief The EffectInit class
|
||||
*
|
||||
* A separate thread for loading effects in the background while the rest of the program's initiation takes place.
|
||||
* The program can even run before the effects have finished loading, but any point the software needs to access
|
||||
* effects, it will have to wait for this thread to finish before it can. Fortunately this thread is usually very
|
||||
* quick and is over before the MainWindow shows.
|
||||
*/
|
||||
class EffectInit : public QThread {
|
||||
public:
|
||||
EffectInit();
|
||||
|
||||
/**
|
||||
* @brief A static convenience function to set up the EffectInit thread, start it, and free itself when complete.
|
||||
*/
|
||||
static void StartLoading();
|
||||
protected:
|
||||
/**
|
||||
* @brief Function that runs in the other thread.
|
||||
*/
|
||||
void run();
|
||||
};
|
||||
|
||||
|
||||
+1
-2
@@ -83,7 +83,6 @@ QDockWidget *get_focused_panel(bool force_hover) {
|
||||
}
|
||||
|
||||
void alloc_panels(QWidget* parent) {
|
||||
// TODO maybe replace these with non-pointers later on?
|
||||
panel_sequence_viewer = new Viewer(parent);
|
||||
panel_sequence_viewer->setObjectName("seq_viewer");
|
||||
panel_footage_viewer = new Viewer(parent);
|
||||
@@ -91,7 +90,7 @@ void alloc_panels(QWidget* parent) {
|
||||
panel_project = new Project(parent);
|
||||
panel_project->setObjectName("proj_root");
|
||||
panel_effect_controls = new EffectControls(parent);
|
||||
init_effects();
|
||||
EffectInit::StartLoading();
|
||||
panel_effect_controls->setObjectName("fx_controls");
|
||||
panel_timeline = new Timeline(parent);
|
||||
panel_timeline->setObjectName("timeline");
|
||||
|
||||
+60
-9
@@ -24,28 +24,79 @@
|
||||
#include <QWidget>
|
||||
#include <QTimer>
|
||||
|
||||
/**
|
||||
* @brief The AudioMonitor class
|
||||
*
|
||||
* Used to show a visual representation of audio currently playing
|
||||
*/
|
||||
class AudioMonitor : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit AudioMonitor(QWidget *parent = 0);
|
||||
void set_value(const QVector<double>& values);
|
||||
/**
|
||||
* @brief AudioMonitor Constructor
|
||||
* @param parent
|
||||
*
|
||||
* QWidget parent object.
|
||||
*/
|
||||
explicit AudioMonitor(QWidget *parent = nullptr);
|
||||
|
||||
/**
|
||||
* @brief Set the current audio value
|
||||
*
|
||||
* The main interface for updating the audio monitor. Using this function will redraw the monitor with the values
|
||||
* specified.
|
||||
*
|
||||
* @param values
|
||||
*
|
||||
* An array of doubles between 0.0 and 1.0 to display the amplitude. 0.0 is no audio, 1.0 is full volume. Each array
|
||||
* entry is a channel and the audio monitor will automatically adjust to the channel count in the array.
|
||||
*/
|
||||
void set_value(const QVector<double>& values);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *);
|
||||
void resizeEvent(QResizeEvent *);
|
||||
/**
|
||||
* @brief Internal paint event
|
||||
*
|
||||
* Paints the
|
||||
*/
|
||||
void paintEvent(QPaintEvent *);
|
||||
|
||||
/**
|
||||
* @brief Internal resize event handler
|
||||
*
|
||||
* Triggers a repaint when the widget is resized.
|
||||
*/
|
||||
void resizeEvent(QResizeEvent *);
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
private:
|
||||
QLinearGradient gradient;
|
||||
QVector<double> values;
|
||||
QTimer clear_timer;
|
||||
/**
|
||||
* @brief Internal gradient object from red to yellow to green
|
||||
*/
|
||||
QLinearGradient gradient;
|
||||
|
||||
/**
|
||||
* @brief Internal value storage
|
||||
*/
|
||||
QVector<double> values;
|
||||
|
||||
/**
|
||||
* @brief Internal timer to clear the audio monitor after a certain amount of time
|
||||
*
|
||||
* If it doesn't receive any values within a certain amount of time, it's assumed audio is no longer playing and the
|
||||
* monitor is cleared.
|
||||
*/
|
||||
QTimer clear_timer;
|
||||
|
||||
private slots:
|
||||
void clear();
|
||||
/**
|
||||
* @brief Slot to clear the audio monitor
|
||||
*/
|
||||
void clear();
|
||||
};
|
||||
|
||||
#endif // AUDIOMONITOR_H
|
||||
|
||||
@@ -6,6 +6,25 @@
|
||||
|
||||
namespace olive {
|
||||
namespace ui {
|
||||
/**
|
||||
* @brief Convenience function for blurring a QImage
|
||||
*
|
||||
* @param result
|
||||
*
|
||||
* QImage to blur
|
||||
*
|
||||
* @param rect
|
||||
*
|
||||
* The rectangle of the QImage to blur. Use QImage::rect() to blur the entire image.
|
||||
*
|
||||
* @param radius
|
||||
*
|
||||
* The blur radius - how much to blur the image.
|
||||
*
|
||||
* @param alphaOnly
|
||||
*
|
||||
* True if only the alpha channel should be blurred rather than the entire RGBA space.
|
||||
*/
|
||||
void blur(QImage& result, const QRect& rect, int radius, bool alphaOnly);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user