soundboard/include/mainwindow.h

68 lines
1.3 KiB
C
Raw Normal View History

2021-12-13 00:28:04 +01:00
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
2021-12-15 01:46:54 +01:00
#include <qlayoutitem.h>
2021-12-13 14:48:43 +01:00
#include <vector>
2021-12-15 15:25:09 +01:00
#include <functional>
2021-12-13 00:28:04 +01:00
2021-12-13 14:48:43 +01:00
#include "config.h"
2021-12-13 00:28:04 +01:00
#include "sound.h"
2021-12-13 14:48:43 +01:00
#include "soundbutton.h"
2021-12-13 00:28:04 +01:00
QT_BEGIN_NAMESPACE
2021-12-13 14:48:43 +01:00
namespace Ui { class Soundboard; }
2021-12-13 00:28:04 +01:00
QT_END_NAMESPACE
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(const std::string& binary, QWidget *parent = nullptr);
2021-12-13 00:28:04 +01:00
~MainWindow();
public slots:
2021-12-13 14:48:43 +01:00
void reloadConfig();
2021-12-14 12:46:57 +01:00
void stop();
2021-12-13 14:48:43 +01:00
void moveUp();
void moveDown();
void moveLeft();
void moveRight();
void playCurrent();
2021-12-17 01:26:28 +01:00
private slots:
void alwaysOnTopSettingChange(int status);
2021-12-20 00:19:35 +01:00
void addSample();
2021-12-17 01:26:28 +01:00
2021-12-13 14:48:43 +01:00
signals:
void newStatusMessage(const QString&);
2021-12-13 00:28:04 +01:00
private:
2021-12-14 10:23:06 +01:00
void loadSoundFromConfig();
void removeAllButtons();
void loadButtonsFromConfig();
2021-12-13 00:28:04 +01:00
2021-12-15 15:25:09 +01:00
void reselectNext(std::function<void(uint8_t&,uint8_t&)> stepf);
QLayoutItem* findNextButton(std::function<void(uint8_t&,uint8_t&)> stepf);
2021-12-15 01:46:54 +01:00
2021-12-13 14:48:43 +01:00
Ui::Soundboard *ui;
std::vector<SoundButton*> soundbuttons;
2021-12-14 12:46:57 +01:00
QxtGlobalShortcut* stopGlobal = nullptr;
QxtGlobalShortcut* up = nullptr;
QxtGlobalShortcut* down = nullptr;
QxtGlobalShortcut* left = nullptr;
QxtGlobalShortcut* right = nullptr;
QxtGlobalShortcut* play = nullptr;
2021-12-15 15:25:09 +01:00
// "real" coordinates
uint8_t xCoord = 0;
uint8_t yCoord = 0;
2021-12-15 01:46:54 +01:00
2021-12-13 14:48:43 +01:00
Config config;
2021-12-13 00:28:04 +01:00
};
#endif // MAINWINDOW_H