LIDL Soundboard  1.9.0
A simple soundboard, yet better than EXP Soundboard forsenE
LIDL::Controller::SettingsController Class Reference

#include <SettingsController.h>

Inheritance diagram for LIDL::Controller::SettingsController:
Inheritance graph
Collaboration diagram for LIDL::Controller::SettingsController:
Collaboration graph

Public Slots

void SetDefaultMainVolume (int)
 SetDefaultMainVolume Sets the default main volume inside the controller, to be used when creating wrappers, and saved in the lidlsettings. More...
 
void SetDefaultVacVolume (int)
 SetDefaultVacVolume Sets the default VAC volume inside the controller, to be used when creating wrappers, and saved in the lidlsettings. More...
 
void SetRecentFileCount (int)
 
void ShowSettingsWindow ()
 
void buttonBrowseLidl ()
 buttonBrowseLidl Slot connected to a file browser button TODO: refactor as a lambda More...
 
void buttonBrowseSound ()
 buttonBrowseSound Slot connected to a file browser button TODO: refactor as a lambda More...
 
void addFileToRecent (QFileInfo fileInfo)
 addFileToRecent More...
 

Signals

void RecentFilesChanged ()
 RecentFilesChanged Signal is caught by the main UI to changes the Open Recent Menu. More...
 
void SettingsChanged ()
 
void ProfileConfigurationChanged ()
 

Public Member Functions

int GetDefaultMainVolume () const
 GetDefaultMainVolume. More...
 
int GetDefaultVacVolume () const
 GetDefaultVacVolume. More...
 
QString GetDefaultSoundboardFolder () const
 GetDefaultSoundboardFolder. More...
 
QString GetDefaultSoundFolder () const
 GetDefaultSoundFolder. More...
 
bool OpenSettings ()
 OpenSettings. More...
 
void SaveSettings ()
 SaveSettings. More...
 
QString GetLastOpenedSoundboard ()
 GetLastOpenedSoundboard. More...
 
std::deque< QFileInfo > GetRecentFiles ()
 GetRecentFiles. More...
 
int GetRecentFilesCount () const
 GetRecentFilesCount. More...
 
bool IsThisFirstTimeUser ()
 IsThisFirstTimeUser. More...
 
void unHoldPTT ()
 unHoldPTT More...
 
void holdPTT (int duration)
 holdPTT More...
 
void addShowFlag (LIDL::SHOW_SETTINGS addedFlag)
 addShowFlag Will add a flag to the list of things to be displayed (stored as flags) More...
 
void removeShowFlag (LIDL::SHOW_SETTINGS removedFlag)
 removeShowFlag Will remove a flag to the list of things to be displayed (stored as flags) More...
 
bool checkShowFlags (LIDL::SHOW_SETTINGS checkedFlag) const
 checkShowFlags More...
 
LIDL::SHOW_SETTINGS getShowFlags () const
 getShowFlags Get the flags More...
 
QStringList GetSupportedMimeTypes () const
 GetSupportedMimeTypes. More...
 
bool GetDragAndDropSeveralWrappers () const
 GetDragAndDropSeveralWrappers. More...
 
bool getEventProcessing () const
 
bool isEditing () const
 isEditing Is editing basically serves to know whether we should process shortcuts being pressed and play the sound, or not because the user is editing a sound (or in another menu for instance) The boolean will be set in the constructor of the soundwrapper (wrapperproperties) edition window, and unset in the destructor More...
 
void setEditing (bool)
 setEditing Allows shortcut to be dismissed if they are pressed while a user is editing a wrapper (see isEditing()) More...
 

Static Public Member Functions

static SettingsControllerGetInstance ()
 

Private Member Functions

 SettingsController ()
 

Private Attributes

QString fileName
 
bool _isEditing
 
QString defaultSoundboardFolder
 
QString defaultSoundsFolder
 
int recentFileCount
 
int defaultMainVolume
 
int defaultVacVolume
 
std::deque< QFileInfo > recentFiles
 
Ui::Settings * ui
 
QMenu * _recentMenu
 
QJsonObject oldObject
 
bool fileAlreadyExisted
 
QTimer _activePttTimer
 
int _activePttScanCode
 
int _activePttVitualKey
 
bool _eventProcessing
 
LIDL::SHOW_SETTINGS _showFlags
 
bool dragAndDropSeveralWrappers
 

Static Private Attributes

static SettingsControllerself = nullptr
 

Constructor & Destructor Documentation

◆ SettingsController()

LIDL::Controller::SettingsController::SettingsController ( )
private

Member Function Documentation

◆ addFileToRecent

void LIDL::Controller::SettingsController::addFileToRecent ( QFileInfo  fileInfo)
slot

addFileToRecent

Parameters
fileInfo

References recentFiles, and RecentFilesChanged().

Referenced by LIDL::Controller::SaveController::SaveController().

Here is the caller graph for this function:

◆ addShowFlag()

void LIDL::Controller::SettingsController::addShowFlag ( LIDL::SHOW_SETTINGS  addedFlag)

addShowFlag Will add a flag to the list of things to be displayed (stored as flags)

Parameters
addedFlag

References _showFlags.

Referenced by LIDL::Controller::SaveController::OpenSaveFile(), and SoundboardMainUI::setUpMenu().

Here is the caller graph for this function:

◆ buttonBrowseLidl

void LIDL::Controller::SettingsController::buttonBrowseLidl ( )
slot

buttonBrowseLidl Slot connected to a file browser button TODO: refactor as a lambda

References ui.

Referenced by ShowSettingsWindow().

Here is the caller graph for this function:

◆ buttonBrowseSound

void LIDL::Controller::SettingsController::buttonBrowseSound ( )
slot

buttonBrowseSound Slot connected to a file browser button TODO: refactor as a lambda

References ui.

Referenced by ShowSettingsWindow().

Here is the caller graph for this function:

◆ checkShowFlags()

bool LIDL::Controller::SettingsController::checkShowFlags ( LIDL::SHOW_SETTINGS  checkedFlag) const

checkShowFlags

Parameters
checkedFlag$Will check if a flag is activated (using &)
Returns

References _showFlags.

Referenced by SoundboardMainUI::refreshView().

Here is the caller graph for this function:

◆ GetDefaultMainVolume()

int LIDL::Controller::SettingsController::GetDefaultMainVolume ( ) const

GetDefaultMainVolume.

Returns
The default main volume (either 100 or defined by the opened json)

References defaultMainVolume.

Referenced by LIDL::Controller::SaveController::OpenSaveFile(), and LIDL::Controller::SaveController::ParseOldSave().

Here is the caller graph for this function:

◆ GetDefaultSoundboardFolder()

QString LIDL::Controller::SettingsController::GetDefaultSoundboardFolder ( ) const

GetDefaultSoundboardFolder.

Returns
The default soundboard folder (either the folder where lidl soundboard is installed, or set by the opened json)

References defaultSoundboardFolder.

◆ GetDefaultSoundFolder()

QString LIDL::Controller::SettingsController::GetDefaultSoundFolder ( ) const

GetDefaultSoundFolder.

Returns
The default soundboard folder (either the folder where lidl soundboard is installed, or set by the opened json)

References defaultSoundsFolder.

◆ GetDefaultVacVolume()

int LIDL::Controller::SettingsController::GetDefaultVacVolume ( ) const

GetDefaultVacVolume.

Returns
The default VAC volume (either 100 or defined by the opened json)

References defaultVacVolume.

Referenced by LIDL::Controller::SaveController::OpenSaveFile(), and LIDL::Controller::SaveController::ParseOldSave().

Here is the caller graph for this function:

◆ GetDragAndDropSeveralWrappers()

bool LIDL::Controller::SettingsController::GetDragAndDropSeveralWrappers ( ) const

GetDragAndDropSeveralWrappers.

Returns
The behavior of the drag and drop

References dragAndDropSeveralWrappers.

Referenced by SoundboardMainUI::dropEvent().

Here is the caller graph for this function:

◆ getEventProcessing()

bool LIDL::Controller::SettingsController::getEventProcessing ( ) const
Returns
bool

References _eventProcessing.

◆ GetInstance()

◆ GetLastOpenedSoundboard()

QString LIDL::Controller::SettingsController::GetLastOpenedSoundboard ( )

GetLastOpenedSoundboard.

Returns
The most recent opened soundboard, so we can open it automatically for the user

TODO: probably add an option to toggle this off

References recentFiles.

◆ GetRecentFiles()

std::deque< QFileInfo > LIDL::Controller::SettingsController::GetRecentFiles ( )

GetRecentFiles.

Returns
A deck of the recently opened files

References recentFiles.

◆ GetRecentFilesCount()

int LIDL::Controller::SettingsController::GetRecentFilesCount ( ) const

GetRecentFilesCount.

Returns
The count of recent files stored inside lidlsettings

References recentFileCount.

Referenced by SoundboardMainUI::SetUpRecentMenu().

Here is the caller graph for this function:

◆ getShowFlags()

LIDL::SHOW_SETTINGS LIDL::Controller::SettingsController::getShowFlags ( ) const

getShowFlags Get the flags

Returns
the flags :)

References _showFlags.

◆ GetSupportedMimeTypes()

QStringList LIDL::Controller::SettingsController::GetSupportedMimeTypes ( ) const

GetSupportedMimeTypes.

Returns
The list of supported MIME types for the player as a QStringList (QList<QString>)

Referenced by WrapperProperties::AddSoundFromUrl(), and SoundboardMainUI::dropEvent().

Here is the caller graph for this function:

◆ holdPTT()

void LIDL::Controller::SettingsController::holdPTT ( int  duration)

holdPTT

Will hold push to talk key for given duration. If several sounds are played, it will hold it for the longest duration. Interally this uses a timer that will be reset if (new duration > old duration)

Parameters
durationThe duration to hold the PTT for

References _activePttTimer, _eventProcessing, LIDL::Controller::ProfileController::GetActiveProfile(), LIDL::Controller::ProfileController::GetInstance(), Profile::GetPttScanCode(), and Profile::GetPttVirtualKey().

Referenced by SoundboardMainUI::addSound().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isEditing()

bool LIDL::Controller::SettingsController::isEditing ( ) const

isEditing Is editing basically serves to know whether we should process shortcuts being pressed and play the sound, or not because the user is editing a sound (or in another menu for instance) The boolean will be set in the constructor of the soundwrapper (wrapperproperties) edition window, and unset in the destructor

Returns
boolean

References _isEditing.

Referenced by SoundboardMainUI::winHotKeyPressed().

Here is the caller graph for this function:

◆ IsThisFirstTimeUser()

bool LIDL::Controller::SettingsController::IsThisFirstTimeUser ( )

IsThisFirstTimeUser.

Returns
true if first time user, so we show the welcome message

References fileAlreadyExisted.

◆ OpenSettings()

bool LIDL::Controller::SettingsController::OpenSettings ( )

OpenSettings.

Used to open the lidlsettings.json file, that contain several stuff such as default locations, default volumes, and recent files. Will probably contain profiles later on :)

Returns
true if it was opened, false otherwise

References defaultMainVolume, defaultSoundboardFolder, defaultSoundsFolder, defaultVacVolume, dragAndDropSeveralWrappers, fileAlreadyExisted, fileName, recentFileCount, recentFiles, RecentFilesChanged(), and SaveSettings().

Here is the call graph for this function:

◆ ProfileConfigurationChanged

void LIDL::Controller::SettingsController::ProfileConfigurationChanged ( )
signal

◆ RecentFilesChanged

void LIDL::Controller::SettingsController::RecentFilesChanged ( )
signal

RecentFilesChanged Signal is caught by the main UI to changes the Open Recent Menu.

Referenced by addFileToRecent(), OpenSettings(), and SoundboardMainUI::SoundboardMainUI().

Here is the caller graph for this function:

◆ removeShowFlag()

void LIDL::Controller::SettingsController::removeShowFlag ( LIDL::SHOW_SETTINGS  removedFlag)

removeShowFlag Will remove a flag to the list of things to be displayed (stored as flags)

Parameters
removedFlag

References _showFlags.

Referenced by SoundboardMainUI::setUpMenu().

Here is the caller graph for this function:

◆ SaveSettings()

void LIDL::Controller::SettingsController::SaveSettings ( )

SaveSettings.

Will save settings to lidlsettings.json

References defaultMainVolume, defaultSoundboardFolder, defaultSoundsFolder, defaultVacVolume, dragAndDropSeveralWrappers, fileName, recentFileCount, and recentFiles.

Referenced by SoundboardMainUI::closeEvent(), and OpenSettings().

Here is the caller graph for this function:

◆ SetDefaultMainVolume

void LIDL::Controller::SettingsController::SetDefaultMainVolume ( int  newVolume)
slot

SetDefaultMainVolume Sets the default main volume inside the controller, to be used when creating wrappers, and saved in the lidlsettings.

References defaultMainVolume.

Referenced by ShowSettingsWindow().

Here is the caller graph for this function:

◆ SetDefaultVacVolume

void LIDL::Controller::SettingsController::SetDefaultVacVolume ( int  newVolume)
slot

SetDefaultVacVolume Sets the default VAC volume inside the controller, to be used when creating wrappers, and saved in the lidlsettings.

References defaultVacVolume.

Referenced by ShowSettingsWindow().

Here is the caller graph for this function:

◆ setEditing()

void LIDL::Controller::SettingsController::setEditing ( bool  newState)

setEditing Allows shortcut to be dismissed if they are pressed while a user is editing a wrapper (see isEditing())

References _isEditing.

Referenced by WrapperProperties::closeEvent(), and WrapperProperties::WrapperProperties().

Here is the caller graph for this function:

◆ SetRecentFileCount

void LIDL::Controller::SettingsController::SetRecentFileCount ( int  count)
slot

References recentFileCount.

Referenced by ShowSettingsWindow().

Here is the caller graph for this function:

◆ SettingsChanged

void LIDL::Controller::SettingsController::SettingsChanged ( )
signal

Referenced by SoundboardMainUI::SoundboardMainUI().

Here is the caller graph for this function:

◆ ShowSettingsWindow

◆ unHoldPTT()

void LIDL::Controller::SettingsController::unHoldPTT ( )

unHoldPTT

Will unhold the push to talk (when using auto hold ptt)

References _activePttTimer, and LIDL::Controller::ProfileController::GetInstance().

Referenced by SettingsController(), SoundboardMainUI::SoundboardMainUI(), and SoundboardMainUI::winHotKeyPressed().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _activePttScanCode

int LIDL::Controller::SettingsController::_activePttScanCode
private

Referenced by SettingsController().

◆ _activePttTimer

QTimer LIDL::Controller::SettingsController::_activePttTimer
private

◆ _activePttVitualKey

int LIDL::Controller::SettingsController::_activePttVitualKey
private

Referenced by SettingsController().

◆ _eventProcessing

bool LIDL::Controller::SettingsController::_eventProcessing
private

boolean to be tested in MainUI to know if events (key sequences) should be processed

Referenced by getEventProcessing(), holdPTT(), and SettingsController().

◆ _isEditing

bool LIDL::Controller::SettingsController::_isEditing
private

◆ _recentMenu

QMenu* LIDL::Controller::SettingsController::_recentMenu
private

◆ _showFlags

LIDL::SHOW_SETTINGS LIDL::Controller::SettingsController::_showFlags
private

◆ defaultMainVolume

int LIDL::Controller::SettingsController::defaultMainVolume
private

◆ defaultSoundboardFolder

QString LIDL::Controller::SettingsController::defaultSoundboardFolder
private

◆ defaultSoundsFolder

QString LIDL::Controller::SettingsController::defaultSoundsFolder
private

◆ defaultVacVolume

int LIDL::Controller::SettingsController::defaultVacVolume
private

◆ dragAndDropSeveralWrappers

bool LIDL::Controller::SettingsController::dragAndDropSeveralWrappers
private

Boolean holding how drag and drop several files will be handled (several wrapper or one)

Referenced by GetDragAndDropSeveralWrappers(), OpenSettings(), SaveSettings(), SettingsController(), and ShowSettingsWindow().

◆ fileAlreadyExisted

bool LIDL::Controller::SettingsController::fileAlreadyExisted
private

◆ fileName

QString LIDL::Controller::SettingsController::fileName
private

◆ oldObject

QJsonObject LIDL::Controller::SettingsController::oldObject
private

◆ recentFileCount

int LIDL::Controller::SettingsController::recentFileCount
private

◆ recentFiles

std::deque<QFileInfo> LIDL::Controller::SettingsController::recentFiles
private

◆ self

SettingsController * LIDL::Controller::SettingsController::self = nullptr
staticprivate

◆ ui

Ui::Settings* LIDL::Controller::SettingsController::ui
private

The documentation for this class was generated from the following files: