Adding a lot of new features for GUI elements, on first apprearance only...

Adding a lot of new features for GUI elements, on first apprearance only auramodes and level meters are @todo
parent 3e8d2add
......@@ -72,6 +72,15 @@ RedstartWindow::RedstartWindow( bool bFailSafeMode, bool bAutoStart, bool bSkipC
ui->comboBox_audio_iface_buffer_size->addItem( "AUTO", AudioBufferSize::AUTO );
m_pPathsModel = new QStringListModel( ui->listView_paths );
ui->listView_paths->setModel( m_pPathsModel );
m_pMacrosModel = new QStringListModel( ui->listView_macros );
ui->listView_macros->setModel( m_pMacrosModel );
m_pNetServerClientsModel = new QStringListModel( ui->listView_server_connected_clients );
ui->listView_server_connected_clients->setModel( m_pNetServerClientsModel );
m_iPortaudioDefaultDevice = -1;
if( !bSkipConfig )
......@@ -91,11 +100,17 @@ RedstartWindow::RedstartWindow( bool bFailSafeMode, bool bAutoStart, bool bSkipC
m_pCirculatingSourceDialog = new RedstartRunCirculatingSourceDialog( this );
m_qSporadicTimer.setTimerType( Qt::TimerType::VeryCoarseTimer );
m_qSporadicTimer.setInterval( m_qSettings.value( "sporadic_timeout_interval", 200 ).toInt() );
m_qSporadicTimer.start();
}
RedstartWindow::~RedstartWindow()
{
m_qSporadicTimer.stop();
StoreConfiguration();
if( m_pVANetServer->IsClientConnected() )
{
m_pVANetServer->Finalize();
......@@ -106,6 +121,9 @@ RedstartWindow::~RedstartWindow()
if( m_pVANetClient->IsConnected() )
m_pVANetClient->Disconnect();
delete m_pVANetClient;
delete m_pPathsModel;
delete m_pMacrosModel;
}
void RedstartWindow::ConnectSignalsAndSlots()
......@@ -126,7 +144,14 @@ void RedstartWindow::ConnectSignalsAndSlots()
connect( this, SIGNAL( OutputIsMutedChanged( bool ) ), ui->checkBox_core_control_output_mute, SLOT( setChecked( bool ) ) );
connect( ui->checkBox_core_control_output_mute, SIGNAL( stateChanged( int ) ), this, SLOT( CoreChangeOutputIsMuted( int ) ) );
//connect( &m_qRenderTimer, SIGNAL( timeout() ), this, SLOT( Render() ) );
// Auralization modes
connect( this, SIGNAL( GlobalAuralizationModeChanged( int ) ), this, SLOT( CoreChangeGlobalAuralizationMode( int ) ) );
connect( this, SIGNAL( AuralizationModeDSChanged( bool ) ), ui->checkBox_am_ds, SLOT( setChecked( bool ) ) );
connect( ui->checkBox_am_ds, SIGNAL( stateChanged( int ) ), this, SLOT( CoreChangeAuralizationModeDS( int ) ) );
connect( ui->comboBox_core_settings_log_level, SIGNAL( currentIndexChanged( int ) ), this, SLOT( CoreChangeLogLevel( int ) ) );
connect( &m_qSporadicTimer, SIGNAL( timeout() ), this, SLOT( SporadicTimeout() ) );
}
......@@ -206,7 +231,7 @@ void RedstartWindow::StoreConfiguration()
m_qSettings.setValue( "Redstart/network/port", iPort );
m_qSettings.setValue( "Redstart/network/client_mode", ui->checkBox_redstart_network_connect_as_client->isChecked() );
bool bAutostart = ui->checkBox_redstart_auto_start->isChecked();
m_qSettings.setValue( "Redstart/autostart", bAutostart );
......@@ -221,6 +246,8 @@ void RedstartWindow::StoreConfiguration()
voAudioDevices.push_back( oDevice.asHash() );
m_qSettings.setValue( "Redstart/audio/devicelist", voAudioDevices );
m_qSettings.setValue( "sporadic_timeout_interval", m_qSporadicTimer.interval() );
}
void RedstartWindow::on_actionQuit_triggered()
......@@ -246,6 +273,7 @@ void RedstartWindow::PostCoreStart()
ui->graphicsView_output_levels->setEnabled( true );
ui->groupBox_global_am->setEnabled( true );
ui->groupBox_output->setEnabled( true );
ui->groupBox_clients->setEnabled( true );
CVAVersionInfo oVersion;
m_pVAInterface->GetVersionInfo( &oVersion );
......@@ -253,6 +281,7 @@ void RedstartWindow::PostCoreStart()
CVAStruct oArgs;
oArgs[ "getloglevel" ] = true;
oArgs[ "getmacros" ] = true;
const CVAStruct oReturn = m_pVAInterface->CallModule( "VACore", oArgs );
const int iCurrentLogLevel = oReturn[ "loglevel" ];
ui->comboBox_core_settings_log_level->setCurrentIndex( iCurrentLogLevel );
......@@ -266,7 +295,24 @@ void RedstartWindow::PostCoreStart()
if( oValue.IsString() )
sPathList << std::string( oValue ).c_str();
}
ui->listView_paths; // @todo
m_pPathsModel->setStringList( sPathList );
if( oReturn.HasKey( "macros" ) )
{
CVAStruct oMacros = oReturn[ "macros" ];
QStringList sMacrosList;
CVAStruct::const_iterator cit = oMacros.Begin();
while( cit != oMacros.End() )
{
std::string sName( cit->first );
const CVAStructValue& oValue( cit++->second );
if( oValue.IsString() )
sMacrosList << ( sName + " = " + std::string( oValue ) ).c_str();
}
m_pMacrosModel->setStringList( sMacrosList );
}
}
void RedstartWindow::PostCoreStop()
......@@ -287,6 +333,8 @@ void RedstartWindow::PostCoreStop()
ui->graphicsView_output_levels->setEnabled( false );
ui->groupBox_global_am->setEnabled( false );
ui->groupBox_output->setEnabled( false );
ui->groupBox_clients->setEnabled( false );
ui->pushButton_add_local_path->setEnabled( false );
// Clear
......@@ -328,6 +376,13 @@ void RedstartWindow::HandleVAEvent( const CVAEvent* pEvent )
return;
*/
switch( pEvent->iEventType )
{
case CVAEvent::VA_EVENT_GLOBAL_AURALIZATION_MODE_CHANGED:
emit GlobalAuralizationModeChanged( pEvent->iAuralizationMode );
break;
}
switch( pEvent->iEventType )
{
case CVAEvent::VA_EVENT_INPUT_GAIN_CHANGED:
......@@ -501,7 +556,7 @@ void RedstartWindow::on_pushButton_start_stop_clicked()
{
try
{
if( !ui->checkBox_redstart_network_connect_as_client->isChecked() )
if( ui->checkBox_redstart_network_connect_as_client->isChecked() == false )
{
if( m_pVAInterface )
{
......@@ -569,6 +624,8 @@ void RedstartWindow::on_pushButton_start_stop_clicked()
{
ui->statusBar->showMessage( "VA core successfully initialized and network server started. Running session " + ui->listView_redstart_session_list->GetCurrentSessionID() + "." );
ui->pushButton_add_local_path->setEnabled( true );
PostCoreStart();
}
else
......@@ -602,6 +659,8 @@ void RedstartWindow::on_pushButton_start_stop_clicked()
m_pVAInterface = m_pVANetClient->GetCoreInstance();
ui->pushButton_add_local_path->setEnabled( false );
// @todo attach network event handler to detect server connection loss or abortion
//m_pVANetClient->AttachEventHandler( this );
}
......@@ -979,6 +1038,56 @@ void RedstartWindow::CoreChangeOutputIsMuted( int iMuted )
}
void RedstartWindow::CoreChangeAuralizationModeDS( int iState )
{
emit AuralizationModeDSChanged( ( bool ) iState );
if( !m_pVAInterface )
return;
int iAM = m_pVAInterface->GetGlobalAuralizationMode();
if( iState > 0 )
iAM |= IVAInterface::VA_AURAMODE_DIRECT_SOUND;
else
iAM &= ~IVAInterface::VA_AURAMODE_DIRECT_SOUND;
m_pVAInterface->SetGlobalAuralizationMode( iAM );
}
void RedstartWindow::CoreChangeGlobalAuralizationMode( int iAM )
{
// Only emit update when not matching UI state - in that case toggle
if( ( iAM & IVAInterface::VA_AURAMODE_DIRECT_SOUND ) ^ ui->checkBox_am_ds->isChecked() )
emit AuralizationModeDSChanged( !ui->checkBox_am_ds->isChecked() );
}
void RedstartWindow::CoreChangeLogLevel( int iLogLevel )
{
if( !m_pVAInterface )
return;
CVAStruct oArgs;
oArgs[ "setloglevel" ] = iLogLevel;
m_pVAInterface->CallModule( "VACore", oArgs );
}
void RedstartWindow::SporadicTimeout()
{
if( m_pVANetServer->GetNumConnectedClients() != m_pNetServerClientsModel->rowCount() )
{
QStringList sHosts;
for( int n = 0; n < m_pVANetServer->GetNumConnectedClients(); n++ )
sHosts << m_pVANetServer->GetClientHostname( n ).c_str();
m_pNetServerClientsModel->setStringList( sHosts );
}
if( m_pVAInterface )
{
ui->lineEdit_core_settings_core_clock->setText( QString::number( m_pVAInterface->GetCoreClock(), 'f', 1 ) );
}
}
void RedstartWindow::on_actionRunSimpleExample_triggered()
{
try
......
......@@ -16,6 +16,7 @@
#include <QMainWindow>
#include <QSettings>
#include <QStringList>
#include <QTimer>
#include "RedstartSessionList.h"
......@@ -112,40 +113,40 @@ public:
};
private slots:
void on_actionQuit_triggered();
private slots:
void on_actionQuit_triggered();
void on_pushButton_start_stop_clicked();
void on_pushButton_start_stop_clicked();
void on_pushButton_refresh_clicked();
void on_pushButton_refresh_clicked();
void on_comboBox_audio_driver_currentIndexChanged(int index);
void on_comboBox_audio_driver_currentIndexChanged( int index );
void on_comboBox_audio_iface_device_currentIndexChanged(int index);
void on_comboBox_audio_iface_device_currentIndexChanged( int index );
void on_actionWebsite_triggered();
void on_actionWebsite_triggered();
void on_actionGet_started_triggered();
void on_actionGet_started_triggered();
void on_actionDocumentation_triggered();
void on_actionDocumentation_triggered();
void on_actionGet_help_triggered();
void on_actionGet_help_triggered();
void on_checkBox_redstart_network_connect_as_client_clicked();
void on_checkBox_portaudio_default_device_clicked();
void on_listView_redstart_session_list_clicked( const QModelIndex &index );
void on_actionBinauralHeadphones_triggered();
void on_actionBinauralHeadphones_triggered();
void on_actionImport_session_triggered();
void on_actionDefault_experimental_session_triggered();
void on_actionDefault_experimental_session_triggered();
void on_actionRunSimpleExample_triggered();
void on_actionRunSimpleExample_triggered();
void on_actionCirculating_source_triggered();
void on_pushButton_core_control_reset_clicked();
void on_actionAmbisonics_triggered();
void on_actionAmbisonics_triggered();
void on_actionExport_to_file_triggered();
void on_actionRemove_triggered();
......@@ -161,6 +162,13 @@ private slots:
void CoreChangeOutputSignalDecibel( double );
void CoreChangeOutputIsMuted( int );
void CoreChangeAuralizationModeDS( int );
void CoreChangeGlobalAuralizationMode( int );
void CoreChangeLogLevel( int );
void SporadicTimeout();
signals:
void InputSignalChangedDecibel( int );
void InputSignalChangedDecibel( double );
......@@ -169,6 +177,9 @@ signals:
void InputIsMutedChanged( bool );
void OutputIsMutedChanged( bool );
void AuralizationModeDSChanged( bool );
void GlobalAuralizationModeChanged( int );
private:
Ui::RedstartWindow* ui;
......@@ -179,7 +190,12 @@ private:
std::vector< CAudioDeviceSpecs > m_voAudioDevices;
int m_iPortaudioDefaultDevice;
QStringListModel* m_pPathsModel;
QStringListModel* m_pMacrosModel;
QStringListModel* m_pNetServerClientsModel;
QSettings m_qSettings;
QTimer m_qSporadicTimer;
RedstartSessionListView* pSessionListModel;
......@@ -187,17 +203,17 @@ private:
void LoadConfiguration();
void StoreConfiguration();
void RestoreWindowSize();
void ConnectSignalsAndSlots();
void PopulateAudioDevices();
void AcquireAsioDevices();
void AcquirePortaudioDevices();
void PostCoreStart();
void PostCoreStop();
void HandleVAEvent( const CVAEvent* );
void UpdateMeasures( const std::vector< float >& vfInputRMSs, const std::vector< float >& vfInputPeaks, const std::vector< float >& vfOutputRMSs, const std::vector< float >& vfOutputPeaks );
......
......@@ -351,7 +351,7 @@ background-color: rgb(208, 255, 188);</string>
<item row="0" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox_core">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="title">
<string>Core</string>
......@@ -369,7 +369,7 @@ background-color: rgb(208, 255, 188);</string>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEdit_core_settings_version">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
</widget>
</item>
......@@ -393,7 +393,7 @@ background-color: rgb(208, 255, 188);</string>
<item row="3" column="1">
<widget class="QLineEdit" name="lineEdit_core_settings_core_clock">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
</widget>
</item>
......@@ -418,7 +418,7 @@ background-color: rgb(208, 255, 188);</string>
<item row="0" column="2">
<widget class="QGroupBox" name="groupBox_clients">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="title">
<string>Clients</string>
......@@ -433,7 +433,7 @@ background-color: rgb(208, 255, 188);</string>
<item row="2" column="0" colspan="3">
<widget class="QGroupBox" name="groupBox_macros">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="title">
<string>Macros</string>
......@@ -448,7 +448,7 @@ background-color: rgb(208, 255, 188);</string>
<item row="1" column="0" colspan="3">
<widget class="QGroupBox" name="groupBox_paths">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="title">
<string>Paths</string>
......@@ -484,7 +484,7 @@ background-color: rgb(208, 255, 188);</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_12">
<item>
<widget class="QCheckBox" name="checkBox">
<widget class="QCheckBox" name="checkBox_am_ds">
<property name="text">
<string>Direct sound</string>
</property>
......@@ -494,7 +494,7 @@ background-color: rgb(208, 255, 188);</string>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_2">
<widget class="QCheckBox" name="checkBox_am_er">
<property name="text">
<string>Early reflections</string>
</property>
......@@ -504,7 +504,7 @@ background-color: rgb(208, 255, 188);</string>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_3">
<widget class="QCheckBox" name="checkBox_am_dd">
<property name="text">
<string>Diffuse decay</string>
</property>
......@@ -514,7 +514,7 @@ background-color: rgb(208, 255, 188);</string>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_4">
<widget class="QCheckBox" name="checkBox_am_dir">
<property name="text">
<string>Source directivity</string>
</property>
......@@ -524,7 +524,7 @@ background-color: rgb(208, 255, 188);</string>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_10">
<widget class="QCheckBox" name="checkBox_am_ma">
<property name="text">
<string>Medium absorption</string>
</property>
......@@ -534,7 +534,7 @@ background-color: rgb(208, 255, 188);</string>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_9">
<widget class="QCheckBox" name="checkBox_am_tv">
<property name="text">
<string>Temporal variations</string>
</property>
......@@ -544,7 +544,7 @@ background-color: rgb(208, 255, 188);</string>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_11">
<widget class="QCheckBox" name="checkBox_am_sca">
<property name="text">
<string>Scattering</string>
</property>
......@@ -554,7 +554,7 @@ background-color: rgb(208, 255, 188);</string>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_7">
<widget class="QCheckBox" name="checkBox_am_dif">
<property name="text">
<string>Diffraction</string>
</property>
......@@ -564,7 +564,7 @@ background-color: rgb(208, 255, 188);</string>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_12">
<widget class="QCheckBox" name="checkBox_am_nf">
<property name="text">
<string>Near-field</string>
</property>
......@@ -574,7 +574,7 @@ background-color: rgb(208, 255, 188);</string>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_6">
<widget class="QCheckBox" name="checkBox_am_dp">
<property name="text">
<string>Doppler</string>
</property>
......@@ -584,7 +584,7 @@ background-color: rgb(208, 255, 188);</string>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_5">
<widget class="QCheckBox" name="checkBox_am_sl">
<property name="text">
<string>Spreading loss</string>
</property>
......@@ -594,7 +594,7 @@ background-color: rgb(208, 255, 188);</string>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_8">
<widget class="QCheckBox" name="checkBox_am_tr">
<property name="text">
<string>Transmission</string>
</property>
......@@ -604,7 +604,7 @@ background-color: rgb(208, 255, 188);</string>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_13">
<widget class="QCheckBox" name="checkBox_am_ab">
<property name="text">
<string>Absorption</string>
</property>
......@@ -853,7 +853,7 @@ background-color: rgb(208, 255, 188);</string>
<item row="3" column="0" colspan="5">
<widget class="QGroupBox" name="groupBox_output">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="title">
<string>Output</string>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment