LIDL Soundboard  1.9.0
A simple soundboard, yet better than EXP Soundboard forsenE
soundboardMainUI.h
Go to the documentation of this file.
1 
2 #ifndef SOUNDBOARDMAINUI_H
3 #define SOUNDBOARDMAINUI_H
4 
29 #include <QWidget>
30 #include <QVector>
31 #include <QHBoxLayout>
32 #include <QVBoxLayout>
33 #include <QStandardItemModel>
34 #include <QTableView>
35 // QHeaderView is needed to hide the vertical headers forsenT
36 #include <QHeaderView>
37 #include <QPushButton>
38 #include <QGridLayout>
39 #include <QLabel>
40 
41 #include <QComboBox>
42 
43 
44 // Property window
45 
46 #include <QVector>
47 #include <QModelIndex>
48 // custom table view to reimplement focus out
49 #include "CustomTableView.h"
50 #include <QShortcut>
51 #include <QKeySequence>
52 #include <string>
53 
54 #include <QMenuBar>
55 #include <QMenu>
56 #include <QAction>
57 #include <QAudio>
58 
59 
60 //#include "Utility.h"
61 
62 #define MOD_NOREPEAT 0x4000
63 #define MOD_ALT 0x0001
64 #define MOD_CONTROL 0x0002
65 
66 #include <QCloseEvent>
67 #include "CustomShortcutEdit.h"
68 
69 #include <QJsonObject>
70 #include <QJsonDocument>
71 #include <QJsonArray>
72 #include <QTextStream>
73 #include <QDesktopServices>
74 
75 //#include <QUrl>
76 // need for gachiBASS animation
77 #include <QMovie>
78 // mod_shift already defined for some reason
79 //#define MOD_SHIFT 0x0003
80 
81 //#include "QSimpleUpdater.h"
82 #include <QMainWindow>
83 #include <QStatusBar>
84 #include "CustomTableModel.h"
85 #include <QFontMetrics>
86 #include <QTextEdit>
87 #include <QTimer>
88 #include "SettingsController.h"
89 #include "soundwrapper.h"
90 #include "wrapperproperties.h"
91 #include <QFileInfo>
92 #include <deque>
93 //#include "updater.h"
94 
95 #include <QProcess>
96 #include <ui_guideUI.h>
97 #include <QDesktopWidget>
98 #include "OverlayWidget.h"
99 #include "EnumsAndStructs.h"
100 #include <QFontMetrics>
101 #include <QHeaderView>
102 #include <QStyleFactory>
103 #include <QRegExp>
104 #include <QMimeData>
105 #include <QMimeDatabase>
106 #include <QProgressBar>
107 #include <QThread>
108 
109 #include "PresetWizard.h"
110 
111 #include <QDebug>
112 #include "OverlayController.h"
113 #include "GameSelector.h"
114 #include "HookController.h"
115 #include "ProfileController.h"
116 #include "SaveController.h"
117 #include <QSplashScreen>
118 
119 
136 class SoundboardMainUI : public QMainWindow
137 {
138  Q_OBJECT
139 
140 private:
141  // All pointers will be deleted if their parents is killed. => parenting everything to this
142 
143  QVector<std::shared_ptr<SoundWrapper>> _sounds;
146  QVector<QKeySequence> _keySequence;
147  QVector<unsigned int> _keyVirtualKey;
148  // Windows Shorcut HANDLE for the sound shortcuts
149  QVector<int> _winShorcutHandle;
152  QGridLayout *_gLayout;
156  QVector<QList< QStandardItem* >> _data;
157  QVector<QList< QStandardItem* >> _displayedData;
159  /***************************************************
160  MENU
161  ****************************************************/
162  //QMenuBar *_menuBar;
163  // We already have this->MenuBar() since we QMainWindow now
164  QVector<QAction*> _actions;
167  //Game detection selection
168 
169 
171 
172  // buttons
173  QPushButton * _btnAdd;
174  QPushButton * _btnDelete;
175  QPushButton * _btnEdit;
176  QPushButton * _btnPlay;
177  QPushButton * _btnStop;
179  // Device selection
180  QLabel * _label1;
181  QComboBox * _deviceListOutput;
183  QLabel * _label2;
184  QComboBox * _deviceListVAC;
186  // Open windows settings button
187  QLabel * _label3;
188  QPushButton *_btnMicInjection;
190  // Auto-hold ptt
191  QLabel * _label4;
193  QPushButton *_btnClearPTT;
194  // Stop button
195  QLabel * _label5;
197  QPushButton *_btnClearStop;
199  // Radial menu button
200  // QLabel * _label6;
201  QPushButton *_btnRadialSettings;
202 
203  // The property window
213  void fetchDeviceList(QComboBox* comboBox,QAudio::Mode mode = QAudio::AudioOutput);
217  void setUpMenu();
222  void closeEvent (QCloseEvent *event);
226  QTextEdit * _statusEdit;
233  void Open(QString fileName);
234 
235  //void ScrollStatusText(int howMuch);
236  QMenu * _openRecentMenu;
242 
245  QWidget * _guideWidget;
246  Ui::Guide *_guideUI;
251  void refreshView();
252 
253  QSplashScreen * _splash;
254 
255 
256 
257 
258 
259 public:
264  explicit SoundboardMainUI(QWidget *parent = nullptr);
265 
266 signals:
270  void lidlJsonDetected(QFileInfo); // forsenBee (to deal with recent saved or opened files)*
271 
272  // We save soundboard state once we open a file or when we save it,
273  // Than we can compare it when closing it to tell the user it hasn't been saved
274 
278  void SaveSoundboardState();
279 
280 
281  void OnConstructionDone();
282 
283 public slots:
290  void addSound(std::shared_ptr<SoundWrapper> modifiedSound, int whereToInsert = -1, bool generateShortcuts = true, bool refreshView = true);
291 
292 
297  void editSoundDialog();
298 
310  void winHotKeyPressed(int handle);
311 
312 
319 
324  void setStopShortcut(unsigned int);
325 
326 
327 
328 
329 
330 
339  QJsonObject * GenerateSaveFile();
340 
344  void Save();
345 
349  void SaveAs();
350 
356  void OpenSlot();
357 
363  void ClearAllSounds();
364 
368  void OpenEXPSounboard();
369 
375  void HelpGuide();
376 
377 
383  void HelpAbout();
384 
385 
386 
387 
388 
389 
390 
396  void ToolClearShortcut();
403  void DealDragAndDrop(int);
404 
412  void SwapWrappers(int firstRow, int secondRow);
413 
414 
415 
421  void SetStatusTextEditText(QString);
422 
426  void PostConstruction();
427  //void ErrorOnPlaying(QString);
428 
429 
435  void SetUpRecentMenu();
443  void CheckForUpdates();
444 
448  void resizeEvent ( QResizeEvent * event );
449 
458  void dragEnterEvent(QDragEnterEvent *e);
459 
467  void dropEvent(QDropEvent *e);
468 
477  void ProfileSwitched(QVector<std::shared_ptr<SoundWrapper> > wrappers);
482  void ClearAll();
483 };
484 
485 
486 
487 
488 #endif // SOUNDBOARDMAINUI_H
void dragEnterEvent(QDragEnterEvent *e)
This function checks for the MIME type of files being dragged onto the sounboard.
Definition: soundboardMainUI.cpp:2210
void OpenSlot()
This function Opens a Open prompt, and opens .lidljson file.
Definition: soundboardMainUI.cpp:1316
void editSoundDialog()
This function opens the Sound Entry Editor to open the selected sound. It is used by both the EDIT bu...
Definition: soundboardMainUI.cpp:848
QPushButton * _btnMicInjection
Definition: soundboardMainUI.h:188
void ClearAll()
ClearAll Clear everything including profiles.
Definition: soundboardMainUI.cpp:1247
void SetUpRecentMenu()
This function sets up the recent menu.
Definition: soundboardMainUI.cpp:2102
void PostConstruction()
PostConstruction is called after the mainUI is done constructing forsenE.
Definition: soundboardMainUI.cpp:493
CustomShortcutEdit * _shortcutEditStop
Definition: soundboardMainUI.h:196
QWidget * _guideWidget
Definition: soundboardMainUI.h:245
QPushButton * _btnClearStop
Definition: soundboardMainUI.h:197
QVector< QKeySequence > _keySequence
Definition: soundboardMainUI.h:146
void fetchDeviceList(QComboBox *comboBox, QAudio::Mode mode=QAudio::AudioOutput)
This function fetches the devices list, and sets up the given combo box.
Definition: soundboardMainUI.cpp:530
void SetStatusTextEditText(QString)
This function set the text of the permanent widget in the status bar.
Definition: soundboardMainUI.cpp:2059
Definition: CustomTableView.h:20
void CheckForUpdates()
This function check for updates.
Definition: soundboardMainUI.cpp:2126
QComboBox * _deviceListOutput
Definition: soundboardMainUI.h:181
Ui::Guide * _guideUI
Definition: soundboardMainUI.h:246
QVector< std::shared_ptr< SoundWrapper > > _sounds
Definition: soundboardMainUI.h:143
QJsonObject * GenerateSaveFile()
Function to generate the .lidljson save file.
Definition: soundboardMainUI.cpp:1394
WrapperProperties * _propertiesWindow
Definition: soundboardMainUI.h:204
void dropEvent(QDropEvent *e)
This function checks for the MIME type of files being dragged onto the sounboard.
Definition: soundboardMainUI.cpp:2242
void Open(QString fileName)
This function Open a saved soundboard and add all the entries in the CustomTableView.
void ClearAllSounds()
This function clears the soundboard, as if it was just opened without any file.
Definition: soundboardMainUI.cpp:1262
Code of the mainUI.
void SaveAs()
This function Opens a Save As prompt, and save the active soundboard as a .lidljson file.
Definition: soundboardMainUI.cpp:1533
CustomTableModel * _model
Definition: soundboardMainUI.h:154
void closeEvent(QCloseEvent *event)
This function adds all the entries of the QMenuBar.(Reimplementation of the QMainWindow close event).
Definition: soundboardMainUI.cpp:1172
The CustomShortcutEdit class.
Definition: CustomShortcutEdit.h:36
CustomTableView * resultView
Definition: soundboardMainUI.h:165
int lastSelectedRow
Definition: soundboardMainUI.h:223
void setStopShortcut(unsigned int)
Function to register the Stop ALL Shortcut. It is used by the associated CustomShortcutEdit and the O...
Definition: soundboardMainUI.cpp:1227
QGridLayout * _gLayout
Definition: soundboardMainUI.h:152
void ProfileSwitched(QVector< std::shared_ptr< SoundWrapper > > wrappers)
ProfileSwitched.
Definition: soundboardMainUI.cpp:444
QLabel * _label1
Definition: soundboardMainUI.h:180
void HelpAbout()
This function will open the about window.
Definition: soundboardMainUI.cpp:1871
QSplashScreen * _splash
Definition: soundboardMainUI.h:253
Definition: CustomTableModel.h:10
void GenerateGlobalShortcuts()
Function to register all the Shortcuts being used by the LIDL Soundboard.
Definition: soundboardMainUI.cpp:881
void winHotKeyPressed(int handle)
Function to deal with Shortcut being pressed.
Definition: soundboardMainUI.cpp:938
QPushButton * _btnStop
Definition: soundboardMainUI.h:177
Inherits QWidget.
Definition: wrapperproperties.h:79
QPushButton * _btnRadialSettings
Definition: soundboardMainUI.h:201
Inherits QMainWindow.
Definition: soundboardMainUI.h:136
CustomShortcutEdit * _shortcutEditPTT
Definition: soundboardMainUI.h:192
void OpenEXPSounboard()
This function allows the opening of .json files written by EXP Soundboard.
Definition: soundboardMainUI.cpp:1326
void SaveSoundboardState()
Signal to be emitted whenever a file is saved or opened. So that its save can be saved and compared t...
void ToolClearShortcut()
This function will clear all the shortcuts in the soundboard.
Definition: soundboardMainUI.cpp:1985
QPushButton * _btnAdd
Definition: soundboardMainUI.h:173
void lidlJsonDetected(QFileInfo)
Signal to be emitted whenever a file is saved or opened. So that it appears in the recent menu.
void OnConstructionDone()
void resizeEvent(QResizeEvent *event)
This function is called whenever the window is resized, and just resizerowstocontent()....
Definition: soundboardMainUI.cpp:1861
SoundboardMainUI(QWidget *parent=nullptr)
SoundboardMainUI Default constructor.
Definition: soundboardMainUI.cpp:3
QLabel * _label3
Definition: soundboardMainUI.h:187
void Save()
Function save the active lidljson file. If no file is already set, it will open the Save As prompt.
Definition: soundboardMainUI.cpp:1517
void setUpMenu()
This function adds all the entries of the QMenuBar.
Definition: soundboardMainUI.cpp:974
QLabel * _label5
Definition: soundboardMainUI.h:195
void DealDragAndDrop(int)
This function deals with drag and drop in the view, or at least, attempts to.
Definition: soundboardMainUI.cpp:2020
void refreshView()
This function deals with editing the data that will be displayed according to user settings....
Definition: soundboardMainUI.cpp:666
QVector< QList< QStandardItem * > > _data
Definition: soundboardMainUI.h:156
QVector< QList< QStandardItem * > > _displayedData
Definition: soundboardMainUI.h:157
void HelpShowFirstUserDialog()
This function construct and display the first-time user dialog.
Definition: soundboardMainUI.cpp:1926
QPushButton * _btnClearPTT
Definition: soundboardMainUI.h:193
QVector< unsigned int > _keyVirtualKey
Definition: soundboardMainUI.h:147
QPushButton * _btnDelete
Definition: soundboardMainUI.h:174
GameSelector * _gameSelector
Definition: soundboardMainUI.h:170
void SwapWrappers(int firstRow, int secondRow)
This function swaps two soundwrappers in the view.
Definition: soundboardMainUI.cpp:2026
QLabel * _label2
Definition: soundboardMainUI.h:183
QVector< int > _winShorcutHandle
Definition: soundboardMainUI.h:149
QMenu * _openRecentMenu
Definition: soundboardMainUI.h:236
File describing the Profile Controller. The class dealing with storing and swapping profile.
void addSound(std::shared_ptr< SoundWrapper > modifiedSound, int whereToInsert=-1, bool generateShortcuts=true, bool refreshView=true)
This function add a soundwrapper to the main UI display, and adds/modify the entries in the private m...
Definition: soundboardMainUI.cpp:559
File handling the Hook Controller Singleton as well as the definition of the CallBack.
QPushButton * _btnEdit
Definition: soundboardMainUI.h:175
QComboBox * _deviceListVAC
Definition: soundboardMainUI.h:184
Definition: GameSelector.h:12
QLabel * _label4
Definition: soundboardMainUI.h:191
void HelpGuide()
This function will open the application tour guide.
Definition: soundboardMainUI.cpp:1551
QVector< QAction * > _actions
Definition: soundboardMainUI.h:164
QTextEdit * _statusEdit
Definition: soundboardMainUI.h:226
bool _updateScheduled
Definition: soundboardMainUI.h:243