WIP

parent 100912e9
......@@ -91,6 +91,8 @@ void RedstartSessionImportDialog::on_pushButton_select_import_file_clicked()
m_oLastBasePath = fd.directory();
ui->lineEdit_import_config_file->setText( m_oConfigFileBasePath.fileName() );
if( ui->lineEdit_session_name->text().isEmpty() )
ui->lineEdit_session_name->setText( m_oConfigFileBasePath.baseName() );
}
}
}
......@@ -53,7 +53,7 @@ public:
inline ~RedstartSessionListView()
{
QString sCurrentSessionName = m_pModel->data( currentIndex(), 0).toString();
QString sCurrentSessionName = m_pModel->data( currentIndex(), 0 ).toString();
m_qSettings.setValue( "Redstart/last_session", sCurrentSessionName );
};
......@@ -81,18 +81,18 @@ public:
{
QMap< QString, QVariant > sessions = m_qSettings.value( "Redstart/Sessions" ).toMap();
if( sessions.count() == 0 )
return;
QStringList list;
QMap< QString, QVariant>::const_iterator cit = sessions.constBegin();
while( cit != sessions.constEnd() )
list.push_back( cit++.key() );
if( sessions.count() > 0 )
{
QMap< QString, QVariant>::const_iterator cit = sessions.constBegin();
while( cit != sessions.constEnd() )
list.push_back( cit++.key() );
}
m_pModel->setStringList( list );
};
QString GetCurrentSessionID() const
inline QString GetCurrentSessionID() const
{
QModelIndex index = currentIndex();
if( m_pModel->rowCount() == 0 || !index.isValid() )
......@@ -102,6 +102,19 @@ public:
return sSessionName;
};
inline void RemoveCurrentSession()
{
QMap< QString, QVariant > sessions = m_qSettings.value( "Redstart/Sessions" ).toMap();
sessions.remove( GetCurrentSessionID() );
m_qSettings.setValue( "Redstart/Sessions", sessions );
m_qSettings.sync();
UpdateSessionList();
if( m_pModel->rowCount() > 0 )
setCurrentIndex( m_pModel->index( 0, 0 ) );
};
inline void AddSession( const QString& sID, const QVariantHash& oCoreConfig, const bool bMakeCurrent = true )
{
QMap< QString, QVariant > sessions = m_qSettings.value( "Redstart/Sessions" ).toMap();
......@@ -135,7 +148,7 @@ public:
if( !oMacros.HasKey( "ProjectName" ) )
oMacros[ "ProjectName" ] = "Redstart";
return oCoreConfig;
return oCoreConfig;
};
public slots :
......
......@@ -149,6 +149,9 @@ void RedstartWindow::LoadConfiguration()
ui->comboBox_core_settings_log_level->addItem( QString::fromStdString( m_pVAInterface->GetLogLevelStr( IVAInterface::VA_LOG_LEVEL_VERBOSE ) ) );
ui->comboBox_core_settings_log_level->addItem( QString::fromStdString( m_pVAInterface->GetLogLevelStr( IVAInterface::VA_LOG_LEVEL_TRACE ) ) );
if( ui->listView_redstart_session_list->GetCurrentSessionID().isEmpty() == false )
ui->treeView_session_details->SetStruct( ui->listView_redstart_session_list->GetCurrentConfig() );
}
void RedstartWindow::StoreConfiguration()
......@@ -627,7 +630,11 @@ void RedstartWindow::on_actionBinauralHeadphones_triggered()
{
RedstartSessionBinauralHeadphonesDialog d( this );
if( d.exec() )
{
ui->listView_redstart_session_list->AddSession( d.GetSessionName(), d.GetCoreConfig() );
CVAStruct oStruct = ui->listView_redstart_session_list->GetCurrentConfig();
ui->treeView_session_details->SetStruct( oStruct );
}
}
void RedstartWindow::on_actionImport_session_triggered()
......@@ -638,6 +645,9 @@ void RedstartWindow::on_actionImport_session_triggered()
try
{
ui->listView_redstart_session_list->AddSession( d.GetSessionName(), d.GetCoreConfig() );
CVAStruct oStruct = ui->listView_redstart_session_list->GetCurrentConfig();
ui->treeView_session_details->SetStruct( oStruct );
}
catch( CVAException& e )
{
......@@ -653,24 +663,10 @@ void RedstartWindow::on_actionDefault_experimental_session_triggered()
{
RedstartSessionExperimentalTalkthroughDialog d( this );
if( d.exec() )
ui->listView_redstart_session_list->AddSession( d.GetSessionName(), d.GetCoreConfig() );
}
void RedstartWindow::on_actionRunSimpleExample_triggered()
{
try
{
if( !m_pVAInterface )
VA_EXCEPT2( INVALID_PARAMETER, "No VA interface available. Please start a session, first." );
RunSimpleExample( m_pVAInterface );
}
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();
ui->listView_redstart_session_list->AddSession( d.GetSessionName(), d.GetCoreConfig() );
CVAStruct oStruct = ui->listView_redstart_session_list->GetCurrentConfig();
ui->treeView_session_details->SetStruct( oStruct );
}
}
......@@ -725,6 +721,68 @@ void RedstartWindow::on_actionExport_to_file_triggered()
}
}
}
}
void RedstartWindow::on_actionRemove_triggered()
{
ui->listView_redstart_session_list->RemoveCurrentSession();
CVAStruct oStruct;
if( !ui->listView_redstart_session_list->GetCurrentSessionID().isEmpty() )
oStruct = ui->listView_redstart_session_list->GetCurrentConfig();
ui->treeView_session_details->SetStruct( oStruct );
}
void RedstartWindow::on_actionEdit_session_triggered()
{
RedstartSessionWizardDialog d( this );
QString sCurrentSessionID = ui->listView_redstart_session_list->GetCurrentSessionID();
CVAStruct oCurrentConfig;
if( !sCurrentSessionID.isEmpty() )
{
oCurrentConfig = ui->listView_redstart_session_list->GetCurrentConfig();
d.SetSession( sCurrentSessionID, ConvertVAStructToQHash( oCurrentConfig ) );
}
if( d.exec() )
{
QVariantHash oNewConfig = d.GetCoreConfig();
if( d.GetSessionName() != sCurrentSessionID )
ui->listView_redstart_session_list->AddSession( d.GetSessionName(), oNewConfig );
else
ui->listView_redstart_session_list->UpdateSession( d.GetSessionName(), oNewConfig );
ui->treeView_session_details->SetStruct( ConvertQHashToVAStruct( oNewConfig ) );
}
}
void RedstartWindow::on_actionDuplicate_current_session_triggered()
{
RedstartSessionDuplicateCurrentDialog d( this );
if( d.exec() )
{
CVAStruct oStruct = ui->listView_redstart_session_list->GetCurrentConfig();
ui->listView_redstart_session_list->AddSession( d.GetSessionName(), ConvertVAStructToQHash( oStruct ) );
ui->treeView_session_details->SetStruct( oStruct );
}
}
void RedstartWindow::on_actionRunSimpleExample_triggered()
{
try
{
if( !m_pVAInterface )
VA_EXCEPT2( INVALID_PARAMETER, "No VA interface available. Please start a session, first." );
RunSimpleExample( m_pVAInterface );
}
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();
}
}
\ No newline at end of file
......@@ -147,6 +147,9 @@ private slots:
void on_actionAmbisonics_triggered();
void on_actionExport_to_file_triggered();
void on_actionRemove_triggered();
void on_actionEdit_session_triggered();
void on_actionDuplicate_current_session_triggered();
private:
void PostCoreStart();
......
......@@ -36,7 +36,7 @@
<item row="0" column="1">
<widget class="QLineEdit" name="lineEdit_session_name">
<property name="text">
<string>MyImportedSession</string>
<string/>
</property>
</widget>
</item>
......
......@@ -843,13 +843,11 @@ background-color: rgb(208, 255, 188);</string>
<property name="title">
<string>New session</string>
</property>
<addaction name="actionAmbisonics"/>
<addaction name="actionBinauralHeadphones"/>
<addaction name="actionDefault_experimental_session"/>
<addaction name="separator"/>
<addaction name="actionSession_wizard"/>
<addaction name="separator"/>
<addaction name="actionEmpty_session"/>
<addaction name="separator"/>
<addaction name="actionImport_session"/>
</widget>
......@@ -1076,7 +1074,7 @@ background-color: rgb(208, 255, 188);</string>
</action>
<action name="actionEdit_session">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="text">
<string>Edit session</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