2021-12-13 14:48:43 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <QtCore/QObject>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <cstdint>
|
|
|
|
|
|
|
|
#include "qxtglobalshortcut.h"
|
|
|
|
|
|
|
|
class SoundButton : public QObject {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
SoundButton(const std::string& filename, const std::string& name_ = "", const std::string& keycombo = "");
|
|
|
|
~SoundButton();
|
|
|
|
|
|
|
|
const std::string& getName() const;
|
|
|
|
const std::string& getFile() const;
|
|
|
|
const std::string& getKeyCombo() const;
|
|
|
|
|
2021-12-13 17:28:32 +01:00
|
|
|
uint64_t getStartMS() const;
|
|
|
|
uint64_t getLengthMS() const;
|
|
|
|
float getVolume() const;
|
|
|
|
|
|
|
|
void setStartMS(uint64_t startms);
|
|
|
|
void setLengthMS(uint64_t lengthms);
|
|
|
|
void setVolume(float v);
|
|
|
|
|
2021-12-13 14:48:43 +01:00
|
|
|
QPushButton* getButton();
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void play();
|
|
|
|
|
|
|
|
private:
|
2021-12-14 10:32:23 +01:00
|
|
|
void setDisabled();
|
|
|
|
|
2021-12-13 14:48:43 +01:00
|
|
|
static uint64_t nextid;
|
2021-12-13 17:28:32 +01:00
|
|
|
|
2021-12-13 14:48:43 +01:00
|
|
|
uint64_t id;
|
|
|
|
std::string name;
|
|
|
|
std::string file;
|
|
|
|
std::string keycombo;
|
2021-12-13 17:28:32 +01:00
|
|
|
uint64_t startms = 0;
|
|
|
|
uint64_t lengthms = 0; // ignored when length = 0
|
|
|
|
float volume = 1.f;
|
2021-12-13 14:48:43 +01:00
|
|
|
|
2021-12-14 10:32:23 +01:00
|
|
|
bool disabled = false;
|
|
|
|
|
2021-12-13 14:48:43 +01:00
|
|
|
QxtGlobalShortcut* globalShortcut = nullptr;
|
|
|
|
QPushButton* button = nullptr;
|
|
|
|
};
|