forked from MrBesen/soundboard
basics for settings Dialog
This commit is contained in:
parent
b9b5ebf3f8
commit
1f90b37abd
|
@ -1,10 +1,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QAbstractButton>
|
#include <QAbstractButton>
|
||||||
#include <QDialog>
|
|
||||||
#include <QTreeWidgetItem>
|
#include <QTreeWidgetItem>
|
||||||
|
|
||||||
#include "config.h"
|
#include "configdialog.h"
|
||||||
#include "buttonmanageritems.h"
|
#include "buttonmanageritems.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
|
@ -12,7 +11,7 @@ namespace Ui {
|
||||||
class ButtonManager;
|
class ButtonManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
class ButtonManager : public QDialog
|
class ButtonManager : public ConfigDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -20,10 +19,6 @@ public:
|
||||||
explicit ButtonManager(Config& conf, MainWindow *parent = nullptr);
|
explicit ButtonManager(Config& conf, MainWindow *parent = nullptr);
|
||||||
~ButtonManager();
|
~ButtonManager();
|
||||||
|
|
||||||
public slots:
|
|
||||||
virtual void accept();
|
|
||||||
virtual void reject();
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
//buttons:
|
//buttons:
|
||||||
void addButton();
|
void addButton();
|
||||||
|
@ -35,17 +30,15 @@ private slots:
|
||||||
void itemSelected();
|
void itemSelected();
|
||||||
void itemChanged(QTreeWidgetItem* item, int column);
|
void itemChanged(QTreeWidgetItem* item, int column);
|
||||||
void itemDoubleClicked(QTreeWidgetItem* item);
|
void itemDoubleClicked(QTreeWidgetItem* item);
|
||||||
void dialogButtonPressed(QAbstractButton* btn);
|
|
||||||
void saveChanges();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::ButtonManager *ui;
|
Ui::ButtonManager *ui;
|
||||||
MainWindow* mainW = nullptr;
|
MainWindow* mainW = nullptr;
|
||||||
|
|
||||||
Config& mainConfig;
|
virtual void saveChanges() override;
|
||||||
Config::RootConfig workingConfig;
|
virtual void loadConfig() override;
|
||||||
|
|
||||||
void loadConfig();
|
virtual QDialogButtonBox* getButtonBox() override;
|
||||||
|
|
||||||
void select(QTreeWidgetItem* item);
|
void select(QTreeWidgetItem* item);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QDialogButtonBox>
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
class ConfigDialog : public QDialog {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit ConfigDialog(Config& conf, QWidget* parent = nullptr);
|
||||||
|
~ConfigDialog();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
virtual void accept() override;
|
||||||
|
virtual void reject() override;
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
virtual void saveChanges();
|
||||||
|
void dialogButtonPressed(QAbstractButton* btn);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
Config& mainConfig;
|
||||||
|
Config::RootConfig workingConfig;
|
||||||
|
|
||||||
|
virtual void loadConfig();
|
||||||
|
virtual QDialogButtonBox* getButtonBox() = 0;
|
||||||
|
|
||||||
|
};
|
|
@ -38,6 +38,7 @@ private slots:
|
||||||
void alwaysOnTopSettingChange(int status);
|
void alwaysOnTopSettingChange(int status);
|
||||||
void saveConfig();
|
void saveConfig();
|
||||||
void openButtonManager();
|
void openButtonManager();
|
||||||
|
void openSettings();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void newStatusMessage(const QString&);
|
void newStatusMessage(const QString&);
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
#ifndef SETTINGS_H
|
||||||
|
#define SETTINGS_H
|
||||||
|
|
||||||
|
#include "configdialog.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class Settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
class Settings : public ConfigDialog {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit Settings(Config& conf, QWidget *parent = nullptr);
|
||||||
|
~Settings();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void selectAudioPath();
|
||||||
|
void masterVolumeChange(int val);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::Settings *ui;
|
||||||
|
|
||||||
|
void setAudioPath();
|
||||||
|
|
||||||
|
virtual QDialogButtonBox* getButtonBox() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // SETTINGS_H
|
|
@ -31,6 +31,9 @@ public:
|
||||||
SampleReader* openFile(const std::string& name);
|
SampleReader* openFile(const std::string& name);
|
||||||
std::vector<std::string> getOutputs();
|
std::vector<std::string> getOutputs();
|
||||||
|
|
||||||
|
void setMasterVolume(float m);
|
||||||
|
float getMasterVolume() const;
|
||||||
|
|
||||||
static std::string FOLDER;
|
static std::string FOLDER;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -53,6 +56,8 @@ private:
|
||||||
std::mutex devicesMutex;
|
std::mutex devicesMutex;
|
||||||
std::vector<SoundDevice*> devices;
|
std::vector<SoundDevice*> devices;
|
||||||
|
|
||||||
|
float masterVolume = 1.0;
|
||||||
|
|
||||||
static Sound* inst;
|
static Sound* inst;
|
||||||
|
|
||||||
friend void sound_callback(ma_device* pDevice, void* pOutput, const void* pInput, ma_uint32 frameCount);
|
friend void sound_callback(ma_device* pDevice, void* pOutput, const void* pInput, ma_uint32 frameCount);
|
||||||
|
|
|
@ -0,0 +1,814 @@
|
||||||
|
{
|
||||||
|
"audio": {
|
||||||
|
"devices": [
|
||||||
|
"",
|
||||||
|
"VirtualMic"
|
||||||
|
],
|
||||||
|
"volume": 1.0
|
||||||
|
},
|
||||||
|
"audioPath": "/home/yannis/prog/ts3/soundboardsounds/neuesSB/",
|
||||||
|
"buttons": [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"key": "Shift+Num+5",
|
||||||
|
"name": "UwU",
|
||||||
|
"samples": [
|
||||||
|
{
|
||||||
|
"file": "Uwu_voice-xjrU3N8M4eo-251.mp3",
|
||||||
|
"length": 518,
|
||||||
|
"offset": 11760
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "uwu2.mp3",
|
||||||
|
"length": 591
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "uwu2.mp3",
|
||||||
|
"length": 741,
|
||||||
|
"offset": 831
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"width": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Onii Chan",
|
||||||
|
"samples": [
|
||||||
|
{
|
||||||
|
"file": "oniichan.mp3",
|
||||||
|
"length": 927
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "oniichan.mp3",
|
||||||
|
"offset": 913
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"width": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "ARA_ARA.mp3",
|
||||||
|
"key": "Shift+Num+2",
|
||||||
|
"name": "Ara-Ara",
|
||||||
|
"offset": 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "bonk.wav",
|
||||||
|
"key": "Shift+F6",
|
||||||
|
"name": "Bonk",
|
||||||
|
"offset": 500
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "sigma.mp3",
|
||||||
|
"length": 21000,
|
||||||
|
"name": "Sigma",
|
||||||
|
"offset": 800
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "sigma.mp3",
|
||||||
|
"key": "Shift+Num+9",
|
||||||
|
"name": "SigmaDrop",
|
||||||
|
"offset": 21800
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"file": "Yeet.mp3",
|
||||||
|
"key": "Shift+F2",
|
||||||
|
"name": "Yeet",
|
||||||
|
"width": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "scream.mp3",
|
||||||
|
"length": 1466,
|
||||||
|
"name": "Scream",
|
||||||
|
"offset": 322,
|
||||||
|
"width": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "Nani.mp3",
|
||||||
|
"name": "NANI"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "niconiconii.mp3",
|
||||||
|
"name": "Nico Nico Nii",
|
||||||
|
"offset": 200
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "Spoiler.mp3",
|
||||||
|
"name": "Cyberpunk",
|
||||||
|
"offset": 21000
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "Spoiler.mp3",
|
||||||
|
"name": "CyberpunkDrop",
|
||||||
|
"offset": 41000
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"file": "neee.mp3",
|
||||||
|
"key": "Shift+F8",
|
||||||
|
"length": 1050,
|
||||||
|
"name": "Neeee",
|
||||||
|
"offset": 1700,
|
||||||
|
"width": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "neee.mp3",
|
||||||
|
"length": 2200,
|
||||||
|
"name": "Lügen darf man nicht sagen!",
|
||||||
|
"offset": 19500,
|
||||||
|
"width": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "pornhubintro.mp3",
|
||||||
|
"name": "pornhub Intro",
|
||||||
|
"offset": 400
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "haltstop.mp3",
|
||||||
|
"length": 1400,
|
||||||
|
"name": "Halt Stop",
|
||||||
|
"volume": 0.800000011920929,
|
||||||
|
"width": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "neinjetzt.mp3",
|
||||||
|
"name": "Nein Jetzt hälst du die Schnautze",
|
||||||
|
"volume": 1.7999999523162842,
|
||||||
|
"width": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "wii.mp3",
|
||||||
|
"name": "Wii"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "ohnononono.mp3",
|
||||||
|
"length": 4872,
|
||||||
|
"name": "OhNo",
|
||||||
|
"offset": 13200
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"file": "begonethot.mp3",
|
||||||
|
"name": "Begone Thot",
|
||||||
|
"offset": 500
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "startedasSpiel.mp3",
|
||||||
|
"name": "Starte das Spiel",
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "echtergangster.mp3",
|
||||||
|
"length": 1500,
|
||||||
|
"name": "Aus dem Weg",
|
||||||
|
"offset": 44350,
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "echtergangster.mp3",
|
||||||
|
"length": 1200,
|
||||||
|
"name": "Schrei",
|
||||||
|
"offset": 67900,
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "alarm.mp3",
|
||||||
|
"length": 2000,
|
||||||
|
"name": "Was suchst du den Hier?",
|
||||||
|
"offset": 141500,
|
||||||
|
"volume": 3.0,
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "alarm.mp3",
|
||||||
|
"length": 1150,
|
||||||
|
"name": "Die wolltest du wohl klauen",
|
||||||
|
"offset": 147000,
|
||||||
|
"volume": 3.0,
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "alarm.mp3",
|
||||||
|
"length": 3500,
|
||||||
|
"name": "Alarm",
|
||||||
|
"offset": 150000,
|
||||||
|
"volume": 3.0,
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "IsErDrin?",
|
||||||
|
"samples": [
|
||||||
|
{
|
||||||
|
"file": "iserschondrin.mp3",
|
||||||
|
"length": 1297,
|
||||||
|
"offset": 5947
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "iserschondrin.mp3",
|
||||||
|
"length": 700,
|
||||||
|
"offset": 11329
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "iserschondrin.mp3",
|
||||||
|
"length": 800,
|
||||||
|
"offset": 15400
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "iserschondrin.mp3",
|
||||||
|
"length": 868,
|
||||||
|
"offset": 23000
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Puta",
|
||||||
|
"samples": [
|
||||||
|
{
|
||||||
|
"file": "puuutttaaa.mp3",
|
||||||
|
"length": 1210,
|
||||||
|
"offset": 1001
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "puuutttaaa.mp3",
|
||||||
|
"length": 1626,
|
||||||
|
"offset": 2200
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"file": "ahri.mp3",
|
||||||
|
"length": 2280,
|
||||||
|
"name": "le Bonc",
|
||||||
|
"offset": 282000,
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "Shift+Num+1",
|
||||||
|
"name": "Janna",
|
||||||
|
"samples": [
|
||||||
|
{
|
||||||
|
"file": "ahri.mp3",
|
||||||
|
"length": 1000,
|
||||||
|
"offset": 198300
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "ahri.mp3",
|
||||||
|
"length": 2000,
|
||||||
|
"offset": 201000
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "ahri.mp3",
|
||||||
|
"length": 1000,
|
||||||
|
"offset": 204000
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "ahri.mp3",
|
||||||
|
"length": 4300,
|
||||||
|
"name": "Ahri",
|
||||||
|
"offset": 19000,
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Vayne",
|
||||||
|
"samples": [
|
||||||
|
{
|
||||||
|
"file": "vayne.mp3",
|
||||||
|
"length": 4000,
|
||||||
|
"offset": 500
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "vayne.mp3",
|
||||||
|
"length": 6000,
|
||||||
|
"offset": 8500
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "vayne.mp3",
|
||||||
|
"length": 6000,
|
||||||
|
"offset": 16500
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "vayne.mp3",
|
||||||
|
"offset": 23000
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "ahri.mp3",
|
||||||
|
"length": 2000,
|
||||||
|
"name": "Lux",
|
||||||
|
"offset": 334000,
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "ahri.mp3",
|
||||||
|
"length": 1800,
|
||||||
|
"name": "Kayle",
|
||||||
|
"offset": 267000,
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "ahri.mp3",
|
||||||
|
"length": 3500,
|
||||||
|
"name": "LuLu",
|
||||||
|
"offset": 324700,
|
||||||
|
"volume": 0.5,
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "explosion.mp3",
|
||||||
|
"key": "Shift+F5",
|
||||||
|
"name": "Explosion",
|
||||||
|
"offset": 700,
|
||||||
|
"volume": 0.5,
|
||||||
|
"width": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "Nasheed - Liyakun Yawmuka.mp3",
|
||||||
|
"length": 9000,
|
||||||
|
"name": "Arab"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "Nasheed - Liyakun Yawmuka.mp3",
|
||||||
|
"name": "Arab2",
|
||||||
|
"offset": 9000
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"file": "spongebob.mp3",
|
||||||
|
"key": "Shift+F7",
|
||||||
|
"name": "Spongebob"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "lux.mp3",
|
||||||
|
"length": 2000,
|
||||||
|
"name": "Lux - Aber nur Händchen...",
|
||||||
|
"offset": 195000,
|
||||||
|
"width": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "lux.mp3",
|
||||||
|
"length": 2000,
|
||||||
|
"name": "Lux - hier war ich...",
|
||||||
|
"offset": 93000,
|
||||||
|
"width": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "butz.mp3",
|
||||||
|
"key": "Shift+Num+3",
|
||||||
|
"length": 500,
|
||||||
|
"name": "Butz",
|
||||||
|
"offset": 3500,
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "schlitz.mp3",
|
||||||
|
"key": "Shift+Num+6",
|
||||||
|
"length": 900,
|
||||||
|
"name": "Schlitz",
|
||||||
|
"offset": 21700,
|
||||||
|
"volume": 0.699999988079071,
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "dasistjagesternnichtsogutgelaufen.mp3",
|
||||||
|
"length": 1900,
|
||||||
|
"name": "Das ist ja gestern nicht so gut gelaufen",
|
||||||
|
"offset": 137500,
|
||||||
|
"volume": 4.0,
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "mayonnaise on an escalator (full song) [9K2Y-rfUy_4].mp3",
|
||||||
|
"name": "Mayo",
|
||||||
|
"offset": 4500
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "helloDarkness.mp3",
|
||||||
|
"name": "Darkness",
|
||||||
|
"offset": 3500
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"file": "Thecutestthingihaveseenmyentirelife.mp3",
|
||||||
|
"length": 3000,
|
||||||
|
"name": "cutest fucking thing",
|
||||||
|
"offset": 8500,
|
||||||
|
"volume": 5.0,
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "Thecutestthingihaveseenmyentirelife.mp3",
|
||||||
|
"length": 1000,
|
||||||
|
"name": "Pfeil",
|
||||||
|
"offset": 11500,
|
||||||
|
"volume": 4.0,
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "Thecutestthingihaveseenmyentirelife.mp3",
|
||||||
|
"key": "Shift+Num+7",
|
||||||
|
"length": 700,
|
||||||
|
"name": "Ahu",
|
||||||
|
"offset": 12700,
|
||||||
|
"volume": 4.0,
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "Herewego.mp3",
|
||||||
|
"key": "Shift+Num+4",
|
||||||
|
"name": "Here we go",
|
||||||
|
"offset": 700
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "fbiopenup.mp3",
|
||||||
|
"length": 3000,
|
||||||
|
"name": "FBI open up",
|
||||||
|
"offset": 14000,
|
||||||
|
"volume": 0.20000000298023224
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "roblox.mp3",
|
||||||
|
"length": 1366,
|
||||||
|
"name": "Roblox",
|
||||||
|
"offset": 500
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "minecraftDamage.mp3",
|
||||||
|
"length": 1000,
|
||||||
|
"name": "Minercraft",
|
||||||
|
"offset": 500
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"file": "HisNameIsjohnCena.mp3",
|
||||||
|
"length": 5450,
|
||||||
|
"name": "His Name is John Cena",
|
||||||
|
"offset": 2400,
|
||||||
|
"width": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "Watchout.mp3",
|
||||||
|
"name": "Watch Out",
|
||||||
|
"offset": 3100,
|
||||||
|
"width": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "ItsCalledHentai.mp3",
|
||||||
|
"name": "Its called Hentai",
|
||||||
|
"offset": 40000
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "ICQ.mp3",
|
||||||
|
"name": "ICQ",
|
||||||
|
"offset": 200
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "theRock.mp3",
|
||||||
|
"name": "TheRock"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "amongus.mp3",
|
||||||
|
"name": "Amongus"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "Knocking",
|
||||||
|
"samples": [
|
||||||
|
{
|
||||||
|
"file": "knocking.mp3",
|
||||||
|
"length": 1400,
|
||||||
|
"offset": 4000
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "knocking.mp3",
|
||||||
|
"length": 1400,
|
||||||
|
"offset": 10500
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "richardUwU3.mp3",
|
||||||
|
"name": "Richard UwU",
|
||||||
|
"offset": 2440
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "beep.mp3",
|
||||||
|
"length": 970,
|
||||||
|
"name": "Beep",
|
||||||
|
"offset": 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "totalerkrieg.mp3",
|
||||||
|
"length": 2763,
|
||||||
|
"name": "Totaler Krieg",
|
||||||
|
"offset": 16600
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "totalerkrieg.mp3",
|
||||||
|
"length": 2000,
|
||||||
|
"name": "Jaaa",
|
||||||
|
"offset": 19277
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"file": "uhhh.mp3",
|
||||||
|
"length": 598,
|
||||||
|
"name": "Uhhh",
|
||||||
|
"offset": 22606
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "No",
|
||||||
|
"samples": [
|
||||||
|
{
|
||||||
|
"file": "TikTok_ailaughtatmyownjokes_9h782ikvkmb81.mp3",
|
||||||
|
"length": 1117,
|
||||||
|
"offset": 36040
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "TikTok_ailaughtatmyownjokes_9h782ikvkmb81.mp3",
|
||||||
|
"length": 718,
|
||||||
|
"offset": 37600
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "Uwu_voice-xjrU3N8M4eo-251.mp3",
|
||||||
|
"key": "Shift+Num+8",
|
||||||
|
"length": 1067,
|
||||||
|
"name": "Ah No!",
|
||||||
|
"offset": 12658
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "sieg.mp3",
|
||||||
|
"length": 800,
|
||||||
|
"name": "Sieg",
|
||||||
|
"offset": 8001
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "sieg.mp3",
|
||||||
|
"length": 700,
|
||||||
|
"name": "Heil",
|
||||||
|
"offset": 8600
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"file": "kranfahrerRonny2.mp3",
|
||||||
|
"length": 2272,
|
||||||
|
"name": "Nein das geht so nicht",
|
||||||
|
"offset": 46779,
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "kranfahrerRonny2.mp3",
|
||||||
|
"length": 2408,
|
||||||
|
"name": "So was hab ich noch nie erlebt",
|
||||||
|
"offset": 248103,
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "kranfahrerRonny2.mp3",
|
||||||
|
"length": 2925,
|
||||||
|
"name": "60t abstellen",
|
||||||
|
"offset": 360500,
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Die leute kommen ihrer Arbeit nicht nach",
|
||||||
|
"samples": [
|
||||||
|
{
|
||||||
|
"file": "kranfahrerRonny2.mp3",
|
||||||
|
"length": 3363,
|
||||||
|
"offset": 366300
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "kranfahrerRonny2.mp3",
|
||||||
|
"length": 6277,
|
||||||
|
"offset": 370000
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "kranfahrerRonny2.mp3",
|
||||||
|
"length": 3730,
|
||||||
|
"name": "Kranplätze...",
|
||||||
|
"offset": 384300,
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "kranfahrerRonny2.mp3",
|
||||||
|
"length": 3619,
|
||||||
|
"name": "Leute einfach keine Lust?",
|
||||||
|
"offset": 392700,
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "kranfahrerRonny2.mp3",
|
||||||
|
"length": 5913,
|
||||||
|
"name": "mal fragen",
|
||||||
|
"offset": 396400,
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "kranfahrerRonny2.mp3",
|
||||||
|
"length": 3076,
|
||||||
|
"name": "Kran wiegt",
|
||||||
|
"offset": 405400,
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "kranfahrerRonny2.mp3",
|
||||||
|
"length": 2800,
|
||||||
|
"name": "Ultra Übel",
|
||||||
|
"offset": 410000,
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Bum",
|
||||||
|
"samples": [
|
||||||
|
{
|
||||||
|
"file": "rage_tense1983.mp3",
|
||||||
|
"length": 2195,
|
||||||
|
"offset": 151500
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "rage_tense1983.mp3",
|
||||||
|
"length": 1287,
|
||||||
|
"offset": 403500
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "chingChengHanji.mp3",
|
||||||
|
"name": "ChingChangHanji",
|
||||||
|
"offset": 5600
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"file": "kranfahrerRonny2.mp3",
|
||||||
|
"length": 5500,
|
||||||
|
"name": "Wild hier",
|
||||||
|
"offset": 413000,
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "kranfahrerRonny2.mp3",
|
||||||
|
"key": "Shift+F3",
|
||||||
|
"length": 2010,
|
||||||
|
"name": "Jetz reichts mir langsam",
|
||||||
|
"offset": 437200,
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "kranfahrerRonny2.mp3",
|
||||||
|
"length": 2600,
|
||||||
|
"name": "Haben die kein 8m Maß",
|
||||||
|
"offset": 443000,
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "kranfahrerRonny2.mp3",
|
||||||
|
"length": 1700,
|
||||||
|
"name": "Originale Nichtskönner",
|
||||||
|
"offset": 465000,
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "kranfahrerRonny2.mp3",
|
||||||
|
"length": 4000,
|
||||||
|
"name": "Vollidioten wie die Norweger",
|
||||||
|
"offset": 468000,
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "kranfahrerRonny2.mp3",
|
||||||
|
"length": 5500,
|
||||||
|
"name": "nicht in der EU",
|
||||||
|
"offset": 473000,
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "kranfahrerRonny2.mp3",
|
||||||
|
"length": 2000,
|
||||||
|
"name": "Sind wir schon wieder schneller",
|
||||||
|
"offset": 640500,
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "kranfahrerRonny2.mp3",
|
||||||
|
"length": 3500,
|
||||||
|
"name": "Junge Junge Junge",
|
||||||
|
"offset": 453800,
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "kranfahrerRonny2.mp3",
|
||||||
|
"length": 2500,
|
||||||
|
"name": "Einpacken",
|
||||||
|
"offset": 482200,
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "fastafboi.mp3",
|
||||||
|
"length": 2700,
|
||||||
|
"name": "how fast i am",
|
||||||
|
"offset": 7000
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "fastafboi.mp3",
|
||||||
|
"length": 2145,
|
||||||
|
"name": "Fast AF",
|
||||||
|
"offset": 10000
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"file": "kinski.mp3",
|
||||||
|
"length": 1300,
|
||||||
|
"name": "Leck mich doch am Arch",
|
||||||
|
"offset": 8500,
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "kinski.mp3",
|
||||||
|
"length": 2564,
|
||||||
|
"name": "Dies mal schlagich",
|
||||||
|
"offset": 13000,
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "kinski.mp3",
|
||||||
|
"length": 1815,
|
||||||
|
"name": "Mach doch dein Scheiß",
|
||||||
|
"offset": 39800,
|
||||||
|
"width": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "brumbrum.mp3",
|
||||||
|
"name": "BrumBrum",
|
||||||
|
"width": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "meepmeep.mp3",
|
||||||
|
"length": 420,
|
||||||
|
"name": "MeepMeep",
|
||||||
|
"width": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "thx.mp3",
|
||||||
|
"name": "THX",
|
||||||
|
"offset": 14000
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "iWillKillyou.mp3",
|
||||||
|
"length": 5000,
|
||||||
|
"name": "I Will Kill you",
|
||||||
|
"offset": 38000
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "mariospeedrunanimated.mp3",
|
||||||
|
"length": 7303,
|
||||||
|
"name": "GayBowser",
|
||||||
|
"offset": 186500
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"file": "wide.mp3",
|
||||||
|
"length": 45000,
|
||||||
|
"name": "WIDE",
|
||||||
|
"offset": 6000,
|
||||||
|
"width": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "wide.mp3",
|
||||||
|
"name": "WIDE",
|
||||||
|
"offset": 45500,
|
||||||
|
"width": 3
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"shortcuts": {
|
||||||
|
"down": "Shift+Down",
|
||||||
|
"left": "Shift+Left",
|
||||||
|
"play": "Shift+Num+Enter",
|
||||||
|
"right": "Shift+Right",
|
||||||
|
"stop": "Shift+Num+0",
|
||||||
|
"up": "Shift+Up"
|
||||||
|
}
|
||||||
|
}
|
|
@ -25,10 +25,12 @@ SOURCES += \
|
||||||
src/sounddevice.cpp \
|
src/sounddevice.cpp \
|
||||||
src/soundbutton.cpp \
|
src/soundbutton.cpp \
|
||||||
src/config.cpp \
|
src/config.cpp \
|
||||||
|
src/configdialog.cpp \
|
||||||
src/editbutton.cpp \
|
src/editbutton.cpp \
|
||||||
src/editsample.cpp \
|
src/editsample.cpp \
|
||||||
src/soundview.cpp \
|
src/soundview.cpp \
|
||||||
src/samplereader.cpp \
|
src/samplereader.cpp \
|
||||||
|
src/settings.cpp \
|
||||||
src/buttonmanager.cpp \
|
src/buttonmanager.cpp \
|
||||||
src/buttonmanageritems.cpp \
|
src/buttonmanageritems.cpp \
|
||||||
src/addnewwhat.cpp \
|
src/addnewwhat.cpp \
|
||||||
|
@ -41,10 +43,12 @@ HEADERS += \
|
||||||
include/sounddevice.h \
|
include/sounddevice.h \
|
||||||
include/soundbutton.h \
|
include/soundbutton.h \
|
||||||
include/config.h \
|
include/config.h \
|
||||||
|
include/configdialog.h \
|
||||||
include/editbutton.h \
|
include/editbutton.h \
|
||||||
include/editsample.h \
|
include/editsample.h \
|
||||||
include/soundview.h \
|
include/soundview.h \
|
||||||
include/samplereader.h \
|
include/samplereader.h \
|
||||||
|
include/settings.h \
|
||||||
include/buttonmanager.h \
|
include/buttonmanager.h \
|
||||||
include/buttonmanageritems.h \
|
include/buttonmanageritems.h \
|
||||||
include/addnewwhat.h \
|
include/addnewwhat.h \
|
||||||
|
@ -61,7 +65,8 @@ FORMS += \
|
||||||
ui/buttonmanager.ui \
|
ui/buttonmanager.ui \
|
||||||
ui/editbutton.ui \
|
ui/editbutton.ui \
|
||||||
ui/editsample.ui \
|
ui/editsample.ui \
|
||||||
ui/mainwindow.ui
|
ui/mainwindow.ui \
|
||||||
|
ui/settings.ui
|
||||||
|
|
||||||
TRANSLATIONS += \
|
TRANSLATIONS += \
|
||||||
testqt_de_DE.ts
|
testqt_de_DE.ts
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
#include <Log.h>
|
#include <Log.h>
|
||||||
|
|
||||||
ButtonManager::ButtonManager(Config& conf, MainWindow* parent) : QDialog(parent), ui(new Ui::ButtonManager), mainW(parent), mainConfig(conf) {
|
ButtonManager::ButtonManager(Config& conf, MainWindow* parent) : ConfigDialog(conf, parent), ui(new Ui::ButtonManager), mainW(parent) {
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
loadConfig();
|
loadConfig();
|
||||||
|
@ -34,17 +34,6 @@ ButtonManager::~ButtonManager() {
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ButtonManager::accept() {
|
|
||||||
saveChanges();
|
|
||||||
|
|
||||||
QDialog::accept();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ButtonManager::reject() {
|
|
||||||
// nothing?
|
|
||||||
QDialog::reject();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ButtonManager::addButton() {
|
void ButtonManager::addButton() {
|
||||||
AddNewWhat whatshouldbeadded(this);
|
AddNewWhat whatshouldbeadded(this);
|
||||||
whatshouldbeadded.exec();
|
whatshouldbeadded.exec();
|
||||||
|
@ -188,8 +177,6 @@ void ButtonManager::itemChanged(QTreeWidgetItem* item, int column) {
|
||||||
} else if(column == 2) {
|
} else if(column == 2) {
|
||||||
//shortcut
|
//shortcut
|
||||||
button->keyWasChanged();
|
button->keyWasChanged();
|
||||||
} else {
|
|
||||||
Log::warn << "column: " << column << " of button was edited";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -201,28 +188,15 @@ void ButtonManager::itemDoubleClicked(QTreeWidgetItem* item) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ButtonManager::dialogButtonPressed(QAbstractButton* btn) {
|
|
||||||
QDialogButtonBox::ButtonRole role = ui->buttonBox->buttonRole(btn);
|
|
||||||
if(role == QDialogButtonBox::ButtonRole::ResetRole) {
|
|
||||||
// reset
|
|
||||||
loadConfig();
|
|
||||||
} else if(role == QDialogButtonBox::ButtonRole::ApplyRole) {
|
|
||||||
// apply
|
|
||||||
saveChanges();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ButtonManager::saveChanges() {
|
void ButtonManager::saveChanges() {
|
||||||
// store working config to main config and save
|
// store working config to main config and save
|
||||||
mainConfig.rootConfig = workingConfig;
|
ConfigDialog::saveChanges();
|
||||||
mainConfig.save();
|
|
||||||
|
|
||||||
mainW->reloadButtonConfig();
|
mainW->reloadButtonConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ButtonManager::loadConfig() {
|
void ButtonManager::loadConfig() {
|
||||||
workingConfig = mainConfig.rootConfig;
|
ConfigDialog::loadConfig();
|
||||||
|
|
||||||
while(ui->buttonTreeWidget->invisibleRootItem()->childCount()) {
|
while(ui->buttonTreeWidget->invisibleRootItem()->childCount()) {
|
||||||
auto kid = ui->buttonTreeWidget->invisibleRootItem()->takeChild(0);
|
auto kid = ui->buttonTreeWidget->invisibleRootItem()->takeChild(0);
|
||||||
|
@ -236,6 +210,10 @@ void ButtonManager::loadConfig() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QDialogButtonBox* ButtonManager::getButtonBox() {
|
||||||
|
return ui->buttonBox;
|
||||||
|
}
|
||||||
|
|
||||||
void ButtonManager::select(QTreeWidgetItem* item) {
|
void ButtonManager::select(QTreeWidgetItem* item) {
|
||||||
QList<QTreeWidgetItem*> selected = ui->buttonTreeWidget->selectedItems();
|
QList<QTreeWidgetItem*> selected = ui->buttonTreeWidget->selectedItems();
|
||||||
for(QTreeWidgetItem* selectedItem : selected) {
|
for(QTreeWidgetItem* selectedItem : selected) {
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
#include "configdialog.h"
|
||||||
|
|
||||||
|
#include <QAbstractButton>
|
||||||
|
#include <QDialogButtonBox>
|
||||||
|
|
||||||
|
ConfigDialog::ConfigDialog(Config& conf, QWidget* parent) : QDialog(parent), mainConfig(conf) {
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigDialog::~ConfigDialog() {}
|
||||||
|
|
||||||
|
void ConfigDialog::accept() {
|
||||||
|
saveChanges();
|
||||||
|
|
||||||
|
QDialog::accept();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConfigDialog::reject() {
|
||||||
|
// nothing?
|
||||||
|
QDialog::reject();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ConfigDialog::saveChanges() {
|
||||||
|
mainConfig.rootConfig = workingConfig;
|
||||||
|
mainConfig.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConfigDialog::dialogButtonPressed(QAbstractButton* btn) {
|
||||||
|
QDialogButtonBox::ButtonRole role = getButtonBox()->buttonRole(btn);
|
||||||
|
if(role == QDialogButtonBox::ButtonRole::ResetRole) {
|
||||||
|
// reset
|
||||||
|
loadConfig();
|
||||||
|
} else if(role == QDialogButtonBox::ButtonRole::ApplyRole) {
|
||||||
|
// apply
|
||||||
|
saveChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConfigDialog::loadConfig() {
|
||||||
|
// make a copy
|
||||||
|
workingConfig = mainConfig.rootConfig;
|
||||||
|
}
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "buttonmanager.h"
|
#include "buttonmanager.h"
|
||||||
#include "editsample.h"
|
#include "editsample.h"
|
||||||
|
#include "settings.h"
|
||||||
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
@ -17,10 +18,11 @@ MainWindow::MainWindow(const std::string& binary, QWidget* parent) : QMainWindow
|
||||||
|
|
||||||
reloadConfig();
|
reloadConfig();
|
||||||
|
|
||||||
QObject::connect(ui->reloadButton, SIGNAL(clicked()), this, SLOT(reloadConfig()));
|
|
||||||
QObject::connect(ui->stopButton, SIGNAL( clicked() ), this, SLOT( stop() ));
|
QObject::connect(ui->stopButton, SIGNAL( clicked() ), this, SLOT( stop() ));
|
||||||
QObject::connect(ui->actionSaveConfig, SIGNAL( triggered() ), this, SLOT( saveConfig() ));
|
QObject::connect(ui->actionSaveConfig, SIGNAL( triggered() ), this, SLOT( saveConfig() ));
|
||||||
QObject::connect(ui->actionButtonManager, SIGNAL( triggered() ), this, SLOT( openButtonManager() ));
|
QObject::connect(ui->actionButtonManager, SIGNAL( triggered() ), this, SLOT( openButtonManager() ));
|
||||||
|
QObject::connect(ui->actionSettings, SIGNAL( triggered() ), this, SLOT( openSettings() ));
|
||||||
|
QObject::connect(ui->actionReloadConfig, SIGNAL( triggered() ), this, SLOT(reloadConfig()));
|
||||||
QObject::connect(ui->alwaysOnTop, SIGNAL( stateChanged(int) ), this, SLOT( alwaysOnTopSettingChange(int) ));
|
QObject::connect(ui->alwaysOnTop, SIGNAL( stateChanged(int) ), this, SLOT( alwaysOnTopSettingChange(int) ));
|
||||||
QObject::connect(this, SIGNAL(newStatusMessage(const QString&)), ui->statusbar, SLOT(showMessage(const QString&)));
|
QObject::connect(this, SIGNAL(newStatusMessage(const QString&)), ui->statusbar, SLOT(showMessage(const QString&)));
|
||||||
}
|
}
|
||||||
|
@ -129,8 +131,19 @@ void MainWindow::openButtonManager() {
|
||||||
|
|
||||||
// reload button config
|
// reload button config
|
||||||
if(buttonManager.result() == QMessageBox::ButtonRole::AcceptRole) {
|
if(buttonManager.result() == QMessageBox::ButtonRole::AcceptRole) {
|
||||||
removeAllButtons();
|
reloadButtonConfig();
|
||||||
loadButtonsFromConfig();
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::openSettings() {
|
||||||
|
Log::info << "openSettings";
|
||||||
|
|
||||||
|
Settings settings(config, this);
|
||||||
|
settings.exec();
|
||||||
|
|
||||||
|
// reload complete config
|
||||||
|
if(settings.result() == QMessageBox::ButtonRole::AcceptRole) {
|
||||||
|
reloadConfig();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,6 +164,8 @@ void MainWindow::loadSoundFromConfig() {
|
||||||
|
|
||||||
Log::debug << "Sound devices loaded";
|
Log::debug << "Sound devices loaded";
|
||||||
|
|
||||||
|
sound.setMasterVolume(config.rootConfig.audio.volume);
|
||||||
|
|
||||||
Sound::FOLDER = config.rootConfig.audioPath;
|
Sound::FOLDER = config.rootConfig.audioPath;
|
||||||
Log::debug << "Sound::FOLDER: " << Sound::FOLDER;
|
Log::debug << "Sound::FOLDER: " << Sound::FOLDER;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
#include "settings.h"
|
||||||
|
#include "ui_settings.h"
|
||||||
|
|
||||||
|
#include <QFileDialog>
|
||||||
|
|
||||||
|
#include <Log.h>
|
||||||
|
|
||||||
|
#include "sound.h"
|
||||||
|
|
||||||
|
Settings::Settings(Config& conf, QWidget *parent) : ConfigDialog(conf, parent), ui(new Ui::Settings) {
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
setAudioPath();
|
||||||
|
}
|
||||||
|
|
||||||
|
Settings::~Settings() {
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Settings::selectAudioPath() {
|
||||||
|
Log::info << "select Audiopath";
|
||||||
|
|
||||||
|
QFileDialog fileselector(this);
|
||||||
|
fileselector.setFileMode(QFileDialog::Directory);
|
||||||
|
fileselector.setOption(QFileDialog::Option::ShowDirsOnly, true);
|
||||||
|
fileselector.setDirectory(QString::fromStdString(Sound::FOLDER));
|
||||||
|
fileselector.exec();
|
||||||
|
|
||||||
|
QStringList filelist = fileselector.selectedFiles();
|
||||||
|
if(filelist.size() != 1) {
|
||||||
|
Log::error << "no folder selected";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string folder = filelist.at(0).toStdString();
|
||||||
|
workingConfig.audioPath = folder;
|
||||||
|
setAudioPath();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Settings::masterVolumeChange(int val) {
|
||||||
|
std::string text = "Master Volume: " + std::to_string(val) + "%";
|
||||||
|
ui->masterVolumeLabel->setText(QString::fromStdString(text));
|
||||||
|
workingConfig.audio.volume = (val / 100.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Settings::setAudioPath() {
|
||||||
|
QString path = QString::fromStdString("Audio Folder: " + workingConfig.audioPath);
|
||||||
|
ui->audioFolderLabel->setText(path);
|
||||||
|
ui->audioFolderLabel->setToolTip(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
QDialogButtonBox* Settings::getButtonBox() {
|
||||||
|
return ui->buttonBox;
|
||||||
|
}
|
|
@ -33,6 +33,7 @@
|
||||||
|
|
||||||
#include "extras/stb_vorbis.c" //vorbis
|
#include "extras/stb_vorbis.c" //vorbis
|
||||||
|
|
||||||
|
#define MA_NO_WAV // disable wav encoding implementation
|
||||||
#define MINIAUDIO_IMPLEMENTATION
|
#define MINIAUDIO_IMPLEMENTATION
|
||||||
#include "miniaudio.h"
|
#include "miniaudio.h"
|
||||||
|
|
||||||
|
@ -68,6 +69,8 @@ void Sound::addPlayback(const std::string& name, float volume, uint64_t beginms,
|
||||||
if(volume < 0.00001f)
|
if(volume < 0.00001f)
|
||||||
volume = 0.00001f;
|
volume = 0.00001f;
|
||||||
|
|
||||||
|
volume *= masterVolume;
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(devicesMutex);
|
std::lock_guard<std::mutex> lock(devicesMutex);
|
||||||
for(SoundDevice* sd : devices) {
|
for(SoundDevice* sd : devices) {
|
||||||
sd->addPlayback(name, volume, beginms, length);
|
sd->addPlayback(name, volume, beginms, length);
|
||||||
|
@ -78,6 +81,8 @@ void Sound::addPlayback(const std::string& audioDeviceName, const std::string& n
|
||||||
if(volume < 0.00001f)
|
if(volume < 0.00001f)
|
||||||
volume = 0.00001f;
|
volume = 0.00001f;
|
||||||
|
|
||||||
|
volume *= masterVolume;
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(devicesMutex);
|
std::lock_guard<std::mutex> lock(devicesMutex);
|
||||||
for(SoundDevice* sd : devices) {
|
for(SoundDevice* sd : devices) {
|
||||||
if(sd->getName() == audioDeviceName) {
|
if(sd->getName() == audioDeviceName) {
|
||||||
|
@ -119,6 +124,8 @@ void Sound::reset() {
|
||||||
deinit();
|
deinit();
|
||||||
init();
|
init();
|
||||||
|
|
||||||
|
masterVolume = 1.0;
|
||||||
|
|
||||||
Log::info << "ResetAudio done";
|
Log::info << "ResetAudio done";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,6 +143,13 @@ std::vector<std::string> Sound::getOutputs() {
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Sound::setMasterVolume(float m) {
|
||||||
|
masterVolume = m;
|
||||||
|
}
|
||||||
|
float Sound::getMasterVolume() const {
|
||||||
|
return masterVolume;
|
||||||
|
}
|
||||||
|
|
||||||
Sound::Sound() {
|
Sound::Sound() {
|
||||||
init();
|
init();
|
||||||
startBackgroundThread();
|
startBackgroundThread();
|
||||||
|
|
|
@ -68,6 +68,14 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<tabstops>
|
||||||
|
<tabstop>addButton</tabstop>
|
||||||
|
<tabstop>editButton</tabstop>
|
||||||
|
<tabstop>deleteButton</tabstop>
|
||||||
|
<tabstop>moveUpButton</tabstop>
|
||||||
|
<tabstop>moveDownButton</tabstop>
|
||||||
|
<tabstop>buttonTreeWidget</tabstop>
|
||||||
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
|
@ -142,7 +150,7 @@
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>878</x>
|
<x>878</x>
|
||||||
<y>113</y>
|
<y>101</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>803</x>
|
<x>803</x>
|
||||||
|
@ -174,7 +182,7 @@
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>878</x>
|
<x>878</x>
|
||||||
<y>187</y>
|
<y>167</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>804</x>
|
<x>804</x>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Dialog</string>
|
<string>Edit Button</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
|
|
|
@ -26,13 +26,6 @@
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="topRow">
|
<layout class="QHBoxLayout" name="topRow">
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="reloadButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>reload Config</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="stopButton">
|
<widget class="QPushButton" name="stopButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -77,7 +70,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>615</width>
|
<width>615</width>
|
||||||
<height>25</height>
|
<height>24</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menuEdit">
|
<widget class="QMenu" name="menuEdit">
|
||||||
|
@ -86,6 +79,8 @@
|
||||||
</property>
|
</property>
|
||||||
<addaction name="actionButtonManager"/>
|
<addaction name="actionButtonManager"/>
|
||||||
<addaction name="actionSaveConfig"/>
|
<addaction name="actionSaveConfig"/>
|
||||||
|
<addaction name="actionSettings"/>
|
||||||
|
<addaction name="actionReloadConfig"/>
|
||||||
</widget>
|
</widget>
|
||||||
<addaction name="menuEdit"/>
|
<addaction name="menuEdit"/>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -114,6 +109,22 @@
|
||||||
<string>Ctrl+B</string>
|
<string>Ctrl+B</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionSettings">
|
||||||
|
<property name="text">
|
||||||
|
<string>Settings</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+.</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionReloadConfig">
|
||||||
|
<property name="text">
|
||||||
|
<string>Reload Config</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+R</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
|
|
@ -0,0 +1,179 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>Settings</class>
|
||||||
|
<widget class="QDialog" name="Settings">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>409</width>
|
||||||
|
<height>285</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>SoundboardSettings</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>30</x>
|
||||||
|
<y>240</y>
|
||||||
|
<width>341</width>
|
||||||
|
<height>32</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Reset|QDialogButtonBox::Save</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="verticalLayoutWidget">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>10</y>
|
||||||
|
<width>381</width>
|
||||||
|
<height>221</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="sizeConstraint">
|
||||||
|
<enum>QLayout::SetDefaultConstraint</enum>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="audioFolderRow">
|
||||||
|
<property name="sizeConstraint">
|
||||||
|
<enum>QLayout::SetDefaultConstraint</enum>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="audioFolderLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Audio Folder:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="audioFolder">
|
||||||
|
<property name="text">
|
||||||
|
<string>Choose</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="masterVolumeRow">
|
||||||
|
<property name="sizeConstraint">
|
||||||
|
<enum>QLayout::SetDefaultConstraint</enum>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="masterVolumeLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Master Volume: 100%</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSlider" name="masterVolume">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>200</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>100</number>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>Settings</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>248</x>
|
||||||
|
<y>254</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>157</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>Settings</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>316</x>
|
||||||
|
<y>260</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>audioFolder</sender>
|
||||||
|
<signal>clicked()</signal>
|
||||||
|
<receiver>Settings</receiver>
|
||||||
|
<slot>selectAudioPath()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>282</x>
|
||||||
|
<y>65</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>285</x>
|
||||||
|
<y>118</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>masterVolume</sender>
|
||||||
|
<signal>valueChanged(int)</signal>
|
||||||
|
<receiver>Settings</receiver>
|
||||||
|
<slot>masterVolumeChange(int)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>305</x>
|
||||||
|
<y>176</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>363</x>
|
||||||
|
<y>206</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
<slots>
|
||||||
|
<slot>selectAudioPath()</slot>
|
||||||
|
<slot>masterVolumeChange(int)</slot>
|
||||||
|
</slots>
|
||||||
|
</ui>
|
Loading…
Reference in New Issue