soundboard/include/mainwindow.h

75 lines
1.4 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-21 15:44:51 +01:00
void reloadButtonConfig();
2021-12-17 01:26:28 +01:00
private slots:
void alwaysOnTopSettingChange(int status);
2021-12-20 21:59:20 +01:00
void saveConfig();
2021-12-21 01:30:18 +01:00
void openButtonManager();
2022-04-02 23:42:56 +02:00
void openSettings();
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();
2022-02-26 16:37:01 +01:00
void loadShortcuts();
2021-12-14 10:23:06 +01:00
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
2022-02-26 16:37:01 +01:00
QxtGlobalShortcut* loadShortcut(const std::string& key);
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