Adding feature that a session can be started immediately after creation

parent 1731e5ed
......@@ -20,8 +20,9 @@
#include "RedstartDefaultCoreConfig.h"
RedstartSessionBinauralHeadphonesDialog::RedstartSessionBinauralHeadphonesDialog( QWidget *parent )
: QDialog( parent ),
ui( new Ui::RedstartDialogSessionBinauralHeadphones )
: QDialog( parent )
, ui( new Ui::RedstartDialogSessionBinauralHeadphones )
, m_bStartImmediately( false )
{
ui->setupUi( this );
......@@ -146,12 +147,24 @@ QString RedstartSessionBinauralHeadphonesDialog::GetSessionName() const
return ui->lineEdit_session_name->text();
}
bool RedstartSessionBinauralHeadphonesDialog::GetStartImmediately() const
{
return m_bStartImmediately;
}
void RedstartSessionBinauralHeadphonesDialog::on_pushButton_CreateSession_clicked()
{
accept();
close();
}
void RedstartSessionBinauralHeadphonesDialog::on_pushButton_CreateAndStartSession_clicked()
{
m_bStartImmediately = true;
accept();
close();
}
void RedstartSessionBinauralHeadphonesDialog::on_pushButton_BrowseDemoSound_clicked()
{
QFileDialog fd;
......
......@@ -33,9 +33,11 @@ public:
~RedstartSessionBinauralHeadphonesDialog();
QVariantHash GetCoreConfig() const;
QString GetSessionName() const;
bool GetStartImmediately() const;
private slots:
private slots:
void on_pushButton_CreateSession_clicked();
void on_pushButton_CreateAndStartSession_clicked();
void on_pushButton_BrowseDemoSound_clicked();
void on_pushButton_BrowseHRIR_clicked();
void on_pushButton_inverse_hpir_file_select_clicked();
......@@ -48,6 +50,7 @@ private:
QDir m_oInverseHPIRBasePath;
QDir m_oDemoSoundBasePath;
QSettings m_qSettings;
bool m_bStartImmediately;
};
#endif // IW_REDSTART_SESSION_BINAURAL_HEADPHONES_DIALOG
......@@ -18,8 +18,9 @@
#include <QSettings>
RedstartSessionExperimentalTalkthroughDialog::RedstartSessionExperimentalTalkthroughDialog( QWidget *parent )
: QDialog( parent ),
ui( new Ui::RedstartSessionExperimentalTalkthroughDialog )
: QDialog( parent )
, ui( new Ui::RedstartSessionExperimentalTalkthroughDialog )
, m_bStartImmediately( false )
{
ui->setupUi( this );
......@@ -31,6 +32,8 @@ RedstartSessionExperimentalTalkthroughDialog::RedstartSessionExperimentalTalkthr
if( QDir( sLastBrowseFolder ).exists() )
m_oLastBasePath.setCurrent( sLastBrowseFolder );
connect( ui->spinBox_num_channels, SIGNAL( valueChanged( int ) ), this, SLOT( NumChannelsChanged( int ) ) );
}
RedstartSessionExperimentalTalkthroughDialog::~RedstartSessionExperimentalTalkthroughDialog()
......@@ -45,6 +48,11 @@ QString RedstartSessionExperimentalTalkthroughDialog::GetSessionName() const
return ui->lineEdit_session_name->text();
}
bool RedstartSessionExperimentalTalkthroughDialog::GetStartImmediately() const
{
return m_bStartImmediately;
}
QVariantHash RedstartSessionExperimentalTalkthroughDialog::GetCoreConfig() const
{
QVariantHash oFinalCoreConfig;
......@@ -116,6 +124,13 @@ void RedstartSessionExperimentalTalkthroughDialog::on_pushButton_CreateSession_c
close();
}
void RedstartSessionExperimentalTalkthroughDialog::on_pushButton_CreateAndStartSession_clicked()
{
m_bStartImmediately = true;
accept();
close();
}
void RedstartSessionExperimentalTalkthroughDialog::on_pushButton_select_demo_sound()
{
QFileDialog fd;
......@@ -143,3 +158,16 @@ void RedstartSessionExperimentalTalkthroughDialog::on_pushButton_select_demo_sou
}
}
}
void RedstartSessionExperimentalTalkthroughDialog::NumChannelsChanged( int iNumChannels )
{
QString sChannelLayout;
for( int i = 0; i < iNumChannels; i++ )
{
if( i > 0 )
sChannelLayout += ",";
sChannelLayout += QString::number( i + 1 );
}
ui->lineEdit_output_channels->setText( sChannelLayout );
}
......@@ -33,10 +33,13 @@ public:
~RedstartSessionExperimentalTalkthroughDialog();
QVariantHash GetCoreConfig() const;
QString GetSessionName() const;
bool GetStartImmediately() const;
private slots:
private slots:
void on_pushButton_CreateSession_clicked();
void on_pushButton_CreateAndStartSession_clicked();
void on_pushButton_select_demo_sound();
void NumChannelsChanged( int );
private:
Ui::RedstartSessionExperimentalTalkthroughDialog* ui;
......@@ -45,6 +48,7 @@ private:
QDir m_oDemoSoundBasePath;
QString m_sFileBaseName;
QSettings m_qSettings;
bool m_bStartImmediately;
};
#endif // IW_REDSTART_SESSION_EXPERIMENTAL_TALKTHROUGH_DIALOG
......@@ -25,6 +25,7 @@
RedstartSessionImportDialog::RedstartSessionImportDialog( QWidget *parent )
: QDialog( parent ),
ui( new Ui::RedstartSessionImportDialog )
, m_bStartImmediately( false )
{
ui->setupUi( this );
......@@ -55,6 +56,11 @@ bool RedstartSessionImportDialog::ValidFile() const
return m_oConfigFileBasePath.exists() && !m_oConfigFileBasePath.isDir();
}
bool RedstartSessionImportDialog::GetStartImmediately() const
{
return m_bStartImmediately;
}
QVariantHash RedstartSessionImportDialog::GetCoreConfig() const
{
if( !ValidFile() )
......@@ -69,6 +75,13 @@ void RedstartSessionImportDialog::on_pushButton_CreateSession_clicked()
close();
}
void RedstartSessionImportDialog::on_pushButton_CreateAndStartSession_clicked()
{
m_bStartImmediately = true;
accept();
close();
}
void RedstartSessionImportDialog::on_pushButton_select_import_file_clicked()
{
QFileDialog fd;
......
......@@ -35,9 +35,11 @@ public:
QVariantHash GetCoreConfig() const;
QString GetSessionName() const;
bool ValidFile() const;
bool GetStartImmediately() const;
private slots:
private slots:
void on_pushButton_CreateSession_clicked();
void on_pushButton_CreateAndStartSession_clicked();
void on_pushButton_select_import_file_clicked();
private:
......@@ -45,6 +47,7 @@ private:
QDir m_oLastBasePath;
QFileInfo m_oConfigFileBasePath;
QSettings m_qSettings;
bool m_bStartImmediately;
};
#endif // IW_REDSTART_SESSION_IMPORT_DIALOG
......@@ -83,13 +83,18 @@ RedstartWindow::RedstartWindow( bool bFailSafeMode, bool bAutoStart, bool bSkipC
m_iPortaudioDefaultDevice = -1;
if( !m_qSettings.contains( "first_start" ) || m_qSettings.value( "first_start" ) == true )
{
m_qSettings.setValue( "first_start", false );
ui->comboBox_audio_driver->setCurrentIndex( 1 );
}
if( !bSkipConfig )
LoadConfiguration();
// Signals & slots
ConnectSignalsAndSlots();
ui->menuRun->setEnabled( false );
if( ui->checkBox_redstart_network_connect_as_client->isChecked() )
......@@ -294,6 +299,7 @@ void RedstartWindow::PostCoreStart()
ui->groupBox_paths->setEnabled( true );
ui->groupBox_macros->setEnabled( true );
ui->menuRun->setEnabled( true );
ui->menuNew_session->setEnabled( false );
ui->groupBox_core_control->setEnabled( true );
ui->graphicsView_input_levels->setEnabled( true );
ui->graphicsView_output_levels->setEnabled( true );
......@@ -353,6 +359,7 @@ void RedstartWindow::PostCoreStop()
ui->groupBox_paths->setEnabled( false );
ui->groupBox_macros->setEnabled( false );
ui->menuRun->setEnabled( false );
ui->menuNew_session->setEnabled( true );
ui->groupBox_core_control->setEnabled( false );
ui->graphicsView_input_levels->setEnabled( false );
ui->graphicsView_output_levels->setEnabled( false );
......@@ -431,7 +438,7 @@ void RedstartWindow::HandleVAEvent( const CVAEvent* pEvent )
void RedstartWindow::UpdateMeasures( const std::vector< float >& vfInputRMSs, const std::vector< float >& vfInputPeaks, const std::vector< float >& vfOutputRMSs, const std::vector< float >& vfOutputPeaks )
{
int iNumInputChannels = (int) vfInputRMSs.size();
int iNumInputChannels = ( int ) vfInputRMSs.size();
assert( vfInputRMSs.size() == vfInputPeaks.size() );
if( ui->graphicsView_input_levels->GetNumChannels() != iNumInputChannels )
ui->graphicsView_input_levels->SetNumChannels( iNumInputChannels );
......@@ -814,6 +821,9 @@ void RedstartWindow::on_actionBinauralHeadphones_triggered()
CVAStruct oStruct = ui->listView_redstart_session_list->GetCurrentConfig();
ui->treeView_session_details->SetStruct( oStruct );
if( d.GetStartImmediately() )
on_pushButton_start_stop_clicked();
}
}
......@@ -822,24 +832,16 @@ void RedstartWindow::on_actionImport_session_triggered()
RedstartSessionImportDialog d( this );
if( d.exec() )
{
try
{
// Enforce unique session id if id is already existing
QString sNewID = d.GetSessionName();
while( ui->listView_redstart_session_list->SessionNameExists( sNewID ) )
sNewID += "_new";
ui->listView_redstart_session_list->AddSession( sNewID, d.GetCoreConfig() ); // In any case save the session so no data is lost
CVAStruct oStruct = ui->listView_redstart_session_list->GetCurrentConfig();
ui->treeView_session_details->SetStruct( oStruct );
// Enforce unique session id if id is already existing
QString sNewID = d.GetSessionName();
while( ui->listView_redstart_session_list->SessionNameExists( sNewID ) )
sNewID += "_new";
ui->listView_redstart_session_list->AddSession( sNewID, d.GetCoreConfig() ); // In any case save the session so no data is lost
CVAStruct oStruct = ui->listView_redstart_session_list->GetCurrentConfig();
ui->treeView_session_details->SetStruct( oStruct );
}
catch( CVAException& e )
{
QString sErrorMessage = QString( "Could not run simple example scene: %1" ).arg( QString::fromStdString( e.ToString() ) );
QErrorMessage oErrMsg;
oErrMsg.showMessage( sErrorMessage );
oErrMsg.exec();
}
if( d.GetStartImmediately() )
on_pushButton_start_stop_clicked();
}
}
......@@ -856,6 +858,9 @@ void RedstartWindow::on_actionDefault_experimental_session_triggered()
CVAStruct oStruct = ui->listView_redstart_session_list->GetCurrentConfig();
ui->treeView_session_details->SetStruct( oStruct );
if( d.GetStartImmediately() )
on_pushButton_start_stop_clicked();
}
}
......@@ -1255,6 +1260,6 @@ void RedstartWindow::on_pushButton_core_control_reset_clicked()
void RedstartWindow::on_actionReset_triggered()
{
if( m_pVAInterface )
m_pVAInterface->Reset();
if( m_pVAInterface )
m_pVAInterface->Reset();
}
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>538</width>
<height>316</height>
<width>550</width>
<height>336</height>
</rect>
</property>
<property name="windowTitle">
......@@ -260,16 +260,26 @@
</layout>
</item>
<item>
<widget class="QPushButton" name="pushButton_CreateSession">
<property name="text">
<string>Create</string>
</property>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="pushButton_CreateSession">
<property name="text">
<string>Create</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_CreateAndStartSession">
<property name="text">
<string>Create and start immediately</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<tabstops>
<tabstop>pushButton_CreateSession</tabstop>
<tabstop>lineEdit_session_name</tabstop>
<tabstop>pushButton_BrowseDemoSound</tabstop>
<tabstop>lineEdit_macro_DemoSound</tabstop>
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>468</width>
<height>173</height>
<width>476</width>
<height>183</height>
</rect>
</property>
<property name="windowTitle">
......@@ -16,20 +16,20 @@
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="1">
<widget class="QLineEdit" name="lineEdit_macro_DemoSound">
<item row="2" column="1" colspan="2">
<widget class="QCheckBox" name="checkBox_folders_as_search_path">
<property name="text">
<string>WelcomeToVA.wav</string>
<string>Add all folders as search paths (instead of using absolute paths)</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<item row="1" column="1">
<widget class="QLineEdit" name="lineEdit_macro_DemoSound">
<property name="text">
<string>Demo sound</string>
</property>
<property name="buddy">
<cstring>lineEdit_macro_DemoSound</cstring>
<string>WelcomeToVA.wav</string>
</property>
</widget>
</item>
......@@ -40,10 +40,13 @@
</property>
</widget>
</item>
<item row="5" column="0" colspan="3">
<widget class="QPushButton" name="pushButton_CreateSession">
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Create</string>
<string>Demo sound</string>
</property>
<property name="buddy">
<cstring>lineEdit_macro_DemoSound</cstring>
</property>
</widget>
</item>
......@@ -57,23 +60,6 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Number of channels</string>
</property>
<property name="buddy">
<cstring>spinBox_num_channels</cstring>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButton_select_demo_sound">
<property name="text">
<string>Select</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="spinBox_num_channels">
<property name="minimum">
......@@ -87,6 +73,13 @@
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButton_select_demo_sound">
<property name="text">
<string>Select</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
......@@ -97,6 +90,16 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Number of channels</string>
</property>
<property name="buddy">
<cstring>spinBox_num_channels</cstring>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="lineEdit_output_channels">
<property name="text">
......@@ -104,13 +107,21 @@
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QCheckBox" name="checkBox_folders_as_search_path">
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="pushButton_CreateSession">
<property name="text">
<string>Add all folders as search paths (instead of using absolute paths)</string>
<string>Create</string>
</property>
<property name="checked">
<bool>true</bool>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_CreateAndStartSession">
<property name="text">
<string>Create and start immediately</string>
</property>
</widget>
</item>
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>625</width>
<height>133</height>
<width>401</width>
<height>100</height>
</rect>
</property>
<property name="windowTitle">
......@@ -50,13 +50,6 @@
</property>
</widget>
</item>
<item row="2" column="0" colspan="3">
<widget class="QPushButton" name="pushButton_CreateSession">
<property name="text">
<string>Create</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButton_select_import_file">
<property name="text">
......@@ -64,12 +57,29 @@
</property>
</widget>
</item>
<item row="4" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="pushButton_CreateSession">
<property name="text">
<string>Create</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_CreateAndStartSession">
<property name="text">
<string>Create and start immediately</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<tabstops>
<tabstop>pushButton_CreateSession</tabstop>
<tabstop>lineEdit_session_name</tabstop>
<tabstop>lineEdit_import_config_file</tabstop>
<tabstop>pushButton_select_import_file</tabstop>
......
......@@ -92,8 +92,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1085</width>
<height>736</height>
<width>1071</width>
<height>788</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="1,2">
......
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