HulaLoop
Simple cross-platform audio loopback and recording.
Signals | Public Member Functions | Static Public Member Functions | Properties | List of all members
hula::QMLBridge Class Reference

Class for communicating between QML and C++. More...

#include <QMLBridge.h>

Inheritance diagram for hula::QMLBridge:
Inheritance graph
[legend]
Collaboration diagram for hula::QMLBridge:
Collaboration graph
[legend]

Signals

void stateChanged ()
 Signal emmitted when the Transport changes states. More...
 
void languageChanged ()
 Signal emmitted when the language changes.
 
void visData (const std::vector< qreal > &rawData, const std::vector< qreal > &dataIn)
 Signal emitted when the visualizer needs to update.
 
void discarded ()
 Signal emmitted when the Transport successfully discards.
 

Public Member Functions

 QMLBridge (QObject *parent=nullptr)
 Construct a new instance of the QMLBridge class. More...
 
virtual ~QMLBridge ()
 Destructor for QMLBridge.
 
Q_INVOKABLE void saveSettings ()
 Saves all settings into a JSON settings file.
 
void loadSettings ()
 Loads all settings stored in the JSON settings file.
 
QString getVisualizerType ()
 Return the current visualizer type. More...
 
void setVisualizerType (const QString &)
 Sets the current visualizer type. More...
 
Q_INVOKABLE void setActiveInputDevice (QString QDeviceName)
 Match a string that the user chose to the input device list and notify the backend.
 
Q_INVOKABLE void setActiveOutputDevice (QString QDeviceName)
 Match a string that the user chose to the output device list and notify the backend.
 
Q_INVOKABLE QString getInputDevices ()
 Get the current input devices. More...
 
Q_INVOKABLE QString getOutputDevices ()
 Get the current output devices. More...
 
Q_INVOKABLE void setShowRecordDevices (bool)
 Modifies settings to display record devices. More...
 
Q_INVOKABLE bool getShowRecordDevices ()
 Returns the setting value for showing record devices. More...
 
Q_INVOKABLE bool loadLanguage (const QString &)
 Modifies settings to load the specified language. More...
 
Q_INVOKABLE QString getSelectedLanguage ()
 Returns the setting value for showing record devices. More...
 
Q_INVOKABLE QString getTransportState () const
 Return the current state of the Transport instance as a QString. More...
 
Q_INVOKABLE bool record ()
 Trigger record in the Transport and update the UI state via signal.
 
Q_INVOKABLE bool stop ()
 Trigger stop in the Transport and update the UI state via signal.
 
Q_INVOKABLE bool play ()
 Trigger playback in the Transport and update the UI state via signal.
 
Q_INVOKABLE bool pause ()
 Trigger pause in the Transport and update the UI state via signal.
 
Q_INVOKABLE void discard ()
 Deletes all the temp files that the program has created.
 
QString getEmptyStr ()
 Return an empty QString to force QML to update when a new language is loaded. More...
 
Q_INVOKABLE void saveFile (QString dir)
 Get the directory the user wants to save to. More...
 
Q_INVOKABLE void cleanTempFiles ()
 Deletes all the temp files that the program has created.
 
Q_INVOKABLE bool wannaClose ()
 Get if the user has unsaved files. More...
 
void startVisThread ()
 Start the thread that reads the ring buffer and updates the visualizer.
 
void stopVisThread ()
 Stop the thread that updates the visualizer.
 
Q_INVOKABLE void launchUpdateProcess ()
 Launch the updater process.
 

Static Public Member Functions

static void updateVisualizer (QMLBridge *_this)
 Perform FFT and update the visualizer.
 
static void reverseBits (size_t x, int n)
 

Properties

QString emptyStr
 
QString visType
 

Detailed Description

Class for communicating between QML and C++.

This is designed to be added as a QML type and used in QML.

Constructor & Destructor Documentation

QMLBridge::QMLBridge ( QObject *  parent = nullptr)
explicit

Construct a new instance of the QMLBridge class.

Parameters
parentObject which QMLBridge should be child of.

Member Function Documentation

QString QMLBridge::getEmptyStr ( )

Return an empty QString to force QML to update when a new language is loaded.

Returns
QString - An empty QString
QString QMLBridge::getInputDevices ( )

Get the current input devices.

Returns
QString containing current input devices
QString QMLBridge::getOutputDevices ( )

Get the current output devices.

Returns
QString containing current output devices
QString QMLBridge::getSelectedLanguage ( )

Returns the setting value for showing record devices.

Returns
bool - True to show record devices, false otherwise
bool QMLBridge::getShowRecordDevices ( )

Returns the setting value for showing record devices.

Returns
bool - True to show record devices, false otherwise
QString QMLBridge::getTransportState ( ) const

Return the current state of the Transport instance as a QString.

Returns
state State of Transport instance
QString QMLBridge::getVisualizerType ( )

Return the current visualizer type.

Returns
QString - The name of the visualizer
bool QMLBridge::loadLanguage ( const QString &  id)

Modifies settings to load the specified language.

Returns
bool - True if loading the language was successful, false otherwise
void QMLBridge::saveFile ( QString  dir)

Get the directory the user wants to save to.

Parameters
QStringcontaining the directory
Returns
String containing the directory
void QMLBridge::setShowRecordDevices ( bool  val)

Modifies settings to display record devices.

Parameters
bool- True to show record devices, false otherwise
void QMLBridge::setVisualizerType ( const QString &  type)

Sets the current visualizer type.

Parameters
QString- The name of the visualizer
void hula::QMLBridge::stateChanged ( )
signal

Signal emmitted when the Transport changes states.

Keeps the UI's state machine on the same page.

bool QMLBridge::wannaClose ( )

Get if the user has unsaved files.

Returns
true if the user has unsaved files

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