diff options
Diffstat (limited to 'src/plugins/Visual')
| -rw-r--r-- | src/plugins/Visual/analyzer/analyzer.cpp | 23 | ||||
| -rw-r--r-- | src/plugins/Visual/analyzer/analyzer.h | 14 | ||||
| -rw-r--r-- | src/plugins/Visual/projectm/projectmwidget.h | 2 | ||||
| -rw-r--r-- | src/plugins/Visual/projectm/projectmwrapper.cpp | 4 | ||||
| -rw-r--r-- | src/plugins/Visual/projectm/projectmwrapper.h | 4 |
5 files changed, 19 insertions, 28 deletions
diff --git a/src/plugins/Visual/analyzer/analyzer.cpp b/src/plugins/Visual/analyzer/analyzer.cpp index 30708f676..75b305a86 100644 --- a/src/plugins/Visual/analyzer/analyzer.cpp +++ b/src/plugins/Visual/analyzer/analyzer.cpp @@ -33,14 +33,6 @@ Analyzer::Analyzer (QWidget *parent) : Visual (parent) { - m_intern_vis_data = nullptr; - m_peaks = nullptr; - m_x_scale = nullptr; - m_rows = 0; - m_cols = 0; - m_update = false; - m_running = false; - setWindowTitle (tr("Qmmp Analyzer")); setMinimumSize(2*300-30,105); m_timer = new QTimer (this); @@ -234,8 +226,6 @@ void Analyzer::process() short dest_l[256]; short dest_r[256]; - short yl, yr; - int j, k, magnitude_l, magnitude_r; calc_freq (dest_l, m_left_buffer); calc_freq (dest_r, m_right_buffer); @@ -244,16 +234,18 @@ void Analyzer::process() for (int i = 0; i < m_cols; i++) { - j = m_cols * 2 - i - 1; //mirror index - yl = yr = 0; - magnitude_l = magnitude_r = 0; + int j = m_cols * 2 - i - 1; //mirror index + short yl = 0; + short yr = 0; + int magnitude_l = 0; + int magnitude_r = 0; if(m_x_scale[i] == m_x_scale[i + 1]) { yl = dest_l[i]; yr = dest_r[i]; } - for (k = m_x_scale[i]; k < m_x_scale[i + 1]; k++) + for (int k = m_x_scale[i]; k < m_x_scale[i + 1]; k++) { yl = qMax(dest_l[k], yl); yr = qMax(dest_r[k], yr); @@ -293,12 +285,11 @@ void Analyzer::process() void Analyzer::draw(QPainter *p) { QBrush brush(Qt::SolidPattern); - int x = 0; int rdx = qMax(0, width() - 2 * m_cell_size.width() * m_cols); for (int j = 0; j < m_cols * 2; ++j) { - x = j * m_cell_size.width() + 1; + int x = j * m_cell_size.width() + 1; if(j >= m_cols) x += rdx; //correct right part position diff --git a/src/plugins/Visual/analyzer/analyzer.h b/src/plugins/Visual/analyzer/analyzer.h index 076948adb..3d77d30f1 100644 --- a/src/plugins/Visual/analyzer/analyzer.h +++ b/src/plugins/Visual/analyzer/analyzer.h @@ -37,7 +37,7 @@ class Analyzer : public Visual Q_OBJECT public: - Analyzer( QWidget *parent = nullptr); + explicit Analyzer( QWidget *parent = nullptr); virtual ~Analyzer(); public slots: @@ -61,17 +61,17 @@ private: void draw(QPainter *p); void createMenu(); QTimer *m_timer; - double *m_intern_vis_data; - double *m_peaks; - int *m_x_scale; + double *m_intern_vis_data = nullptr; + double *m_peaks = nullptr; + int *m_x_scale = nullptr; double m_peaks_falloff; double m_analyzer_falloff; bool m_show_peaks; float m_left_buffer[QMMP_VISUAL_NODE_SIZE]; float m_right_buffer[QMMP_VISUAL_NODE_SIZE]; - int m_cols, m_rows; - bool m_update; - bool m_running; + int m_cols = 0, m_rows = 0; + bool m_update = false; + bool m_running = false; //colors QColor m_color1; QColor m_color2; diff --git a/src/plugins/Visual/projectm/projectmwidget.h b/src/plugins/Visual/projectm/projectmwidget.h index 7dbdc2594..d67742a07 100644 --- a/src/plugins/Visual/projectm/projectmwidget.h +++ b/src/plugins/Visual/projectm/projectmwidget.h @@ -35,7 +35,7 @@ class ProjectMWidget : public QOpenGLWidget { Q_OBJECT public: - ProjectMWidget(QListWidget *listWidget, QWidget *parent = nullptr); + explicit ProjectMWidget(QListWidget *listWidget, QWidget *parent = nullptr); ~ProjectMWidget(); diff --git a/src/plugins/Visual/projectm/projectmwrapper.cpp b/src/plugins/Visual/projectm/projectmwrapper.cpp index 5078cffe2..16449a432 100644 --- a/src/plugins/Visual/projectm/projectmwrapper.cpp +++ b/src/plugins/Visual/projectm/projectmwrapper.cpp @@ -20,12 +20,12 @@ #include "projectmwrapper.h" -ProjectMWrapper::ProjectMWrapper(std::string config_file, int flags, QObject *parent) : +ProjectMWrapper::ProjectMWrapper(const std::string &config_file, int flags, QObject *parent) : QObject(parent), projectM(config_file, flags) { } -ProjectMWrapper::ProjectMWrapper(projectM::Settings settings, int flags, QObject *parent) : +ProjectMWrapper::ProjectMWrapper(const projectM::Settings &settings, int flags, QObject *parent) : QObject(parent), projectM(settings, flags) { } diff --git a/src/plugins/Visual/projectm/projectmwrapper.h b/src/plugins/Visual/projectm/projectmwrapper.h index 99b226ac7..fead927ed 100644 --- a/src/plugins/Visual/projectm/projectmwrapper.h +++ b/src/plugins/Visual/projectm/projectmwrapper.h @@ -28,8 +28,8 @@ class ProjectMWrapper : public QObject, public projectM { Q_OBJECT public: - explicit ProjectMWrapper(std::string config_file, int flags, QObject *parent = nullptr); - explicit ProjectMWrapper(Settings settings, int flags, QObject *parent = nullptr); + explicit ProjectMWrapper(const std::string &config_file, int flags, QObject *parent = nullptr); + explicit ProjectMWrapper(const Settings &settings, int flags, QObject *parent = nullptr); virtual ~ProjectMWrapper(); |
