forked from MrBesen/soundboard
38 lines
710 B
C++
38 lines
710 B
C++
#pragma once
|
|
|
|
#include <QtWidgets/QGraphicsView>
|
|
|
|
#include "samplereader.h"
|
|
|
|
class SoundView : public QGraphicsView {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit SoundView(QWidget* parent = nullptr);
|
|
~SoundView();
|
|
|
|
void loadFile(const std::string& file);
|
|
|
|
void redraw();
|
|
|
|
void paintEvent(QPaintEvent*) override;
|
|
void resizeEvent(QResizeEvent*) override;
|
|
|
|
public slots:
|
|
void updatePosition(unsigned long newpos);
|
|
void updateStartPosition(unsigned long newpos);
|
|
void updateEndPosition(unsigned long newpos);
|
|
|
|
private:
|
|
void drawCursor(uint64_t pos, QPen pen);
|
|
|
|
QGraphicsScene scene;
|
|
|
|
SampleReader* samples = nullptr;
|
|
|
|
std::string file;
|
|
|
|
uint64_t currentPosition = 0;
|
|
uint64_t startPos = 0;
|
|
uint64_t endPos = 0;
|
|
}; |