diff --git a/effects/effectloaders.cpp b/effects/effectloaders.cpp index d53390ab5..d6bf208c1 100644 --- a/effects/effectloaders.cpp +++ b/effects/effectloaders.cpp @@ -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(); diff --git a/effects/effectloaders.h b/effects/effectloaders.h index a5370df41..e4a3da21e 100644 --- a/effects/effectloaders.h +++ b/effects/effectloaders.h @@ -24,12 +24,26 @@ #include #include -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(); }; diff --git a/panels/panels.cpp b/panels/panels.cpp index 0f01dee03..30af5c7f2 100644 --- a/panels/panels.cpp +++ b/panels/panels.cpp @@ -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"); diff --git a/ui/audiomonitor.h b/ui/audiomonitor.h index b2e72c1d6..39a40d39a 100644 --- a/ui/audiomonitor.h +++ b/ui/audiomonitor.h @@ -24,28 +24,79 @@ #include #include +/** + * @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& 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& 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 values; - QTimer clear_timer; + /** + * @brief Internal gradient object from red to yellow to green + */ + QLinearGradient gradient; + + /** + * @brief Internal value storage + */ + QVector 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 diff --git a/ui/blur.h b/ui/blur.h index ddf44fb86..6e56ea032 100644 --- a/ui/blur.h +++ b/ui/blur.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); } }