diff options
author | Michele Calgaro <[email protected]> | 2020-06-13 22:45:28 +0900 |
---|---|---|
committer | Michele Calgaro <[email protected]> | 2020-06-13 22:45:28 +0900 |
commit | 5f44f7b187093ef290315b7f8766b540a31de35f (patch) | |
tree | 27ffb7b218199ca04f240c390c52426c65f45dce /src/app/analyzer.h | |
download | codeine-5f44f7b187093ef290315b7f8766b540a31de35f.tar.gz codeine-5f44f7b187093ef290315b7f8766b540a31de35f.zip |
Initial code import from debian snapshot
https://snapshot.debian.org/package/codeine/1.0.1-3.dfsg-3.1/
Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'src/app/analyzer.h')
-rw-r--r-- | src/app/analyzer.h | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/src/app/analyzer.h b/src/app/analyzer.h new file mode 100644 index 0000000..6fdb12f --- /dev/null +++ b/src/app/analyzer.h @@ -0,0 +1,75 @@ +// (c) 2004 Max Howell ([email protected])
+// See COPYING file for licensing information
+
+#ifndef ANALYZER_H
+#define ANALYZER_H
+
+#ifdef __FreeBSD__
+ #include <sys/types.h>
+#endif
+
+#include <qpixmap.h> //stack allocated and convenience
+#include <qtimer.h> //stack allocated
+#include <qwidget.h> //baseclass
+#include <vector> //included for convenience
+
+namespace Analyzer
+{
+ typedef std::vector<float> Scope;
+
+ template<class W> class Base : public W
+ {
+ public:
+ uint timeout() const { return m_timeout; }
+
+ protected:
+ Base( QWidget*, uint );
+
+ virtual void transform( Scope& ) = 0;
+ virtual void analyze( const Scope& ) = 0;
+
+ private:
+ virtual bool event( QEvent* );
+
+ protected:
+ QTimer m_timer;
+ uint m_timeout;
+ };
+
+ class Base2D : public Base<QWidget>
+ {
+ Q_OBJECT
+ public:
+ const QPixmap *canvas() const { return &m_canvas; }
+
+ private slots:
+ void draw();
+
+ protected:
+ Base2D( QWidget*, uint timeout );
+
+ QPixmap *canvas() { return &m_canvas; }
+
+ void paintEvent( QPaintEvent* ) { if( !m_canvas.isNull() ) bitBlt( this, 0, 0, canvas() ); }
+ void resizeEvent( QResizeEvent* );
+
+ private:
+ QPixmap m_canvas;
+ };
+
+ class Block : public Analyzer::Base2D
+ {
+ public:
+ Block( QWidget* );
+
+ protected:
+ virtual void transform( Analyzer::Scope& );
+ virtual void analyze( const Analyzer::Scope& );
+
+ virtual int heightForWidth( int ) const;
+
+ virtual void show() {} //TODO temporary as the scope plugin causes freezes
+ };
+}
+
+#endif
|