Mooore

parent 26dbb412
......@@ -61,6 +61,7 @@ set( Redstart_Sources
"src/RedstartSessionExperimentalTalkthroughDialog.cpp"
"src/RedstartSessionExperimentalTalkthroughDialog.h"
"src/RedstartSessionList.h"
"src/RedstartSessionDetailsTreeView.h"
)
set( Redstart_UIs
......
/*
* --------------------------------------------------------------------------------------------
*
* VVV VVV A Virtual Acoustics (VA) | http://www.virtualacoustics.org
* VVV VVV AAA Licensed under the Apache License, Version 2.0
* VVV VVV AAA
* VVV VVV AAA Copyright 2015-2017
* VVVVVV AAA Institute of Technical Acoustics (ITA)
* VVVV AAA RWTH Aachen University
*
* --------------------------------------------------------------------------------------------
*/
#ifndef IW_REDSTART_SESSION_DETAILS_TREE_VIEW
#define IW_REDSTART_SESSION_DETAILS_TREE_VIEW
#include <QStandardItemModel>
#include <QStandardItem>
#include <QTreeView>
#include "RedstartUtils.h"
#include <VAStruct.h>
class RedstartSessionDetailModel : public QStandardItemModel
{};
class RedstartSessionDetailsTreeView : public QTreeView
{
Q_OBJECT
public:
inline RedstartSessionDetailsTreeView( QWidget* pParent )
: QTreeView( pParent )
, m_pModel( NULL )
{
m_pModel = new RedstartSessionDetailModel();
this->setModel( m_pModel );
m_pModel->setHorizontalHeaderLabels( QStringList() << "Key" << "Value" << "Type" );
//setEditTriggers( QAbstractItemView::NoEditTriggers );
//setSelectionMode( QAbstractItemView::SingleSelection );
};
void SetStruct( const CVAStruct& oStruct )
{
QStandardItem *rootNode = m_pModel->invisibleRootItem();
QStandardItem* item = new QStandardItem;
QList<QStandardItem *> qlDescriptors;
qlDescriptors << new QStandardItem( "Name" );
qlDescriptors << new QStandardItem( "Talkthrough" );
qlDescriptors << new QStandardItem( "String" );
rootNode->appendRow( qlDescriptors );
QList<QStandardItem *> qlDescriptor2;
qlDescriptor2 << new QStandardItem( "Name" );
rootNode->appendRow( qlDescriptor2 );
QList<QStandardItem *> qlDescriptor3;
qlDescriptor3 << new QStandardItem( "direction" );
qlDescriptor2.first()->appendRow( qlDescriptor3 );
QList<QStandardItem *> qlDescriptor4;
qlDescriptor4 << new QStandardItem( "x" );
qlDescriptor4 << new QStandardItem( "1.0" );
qlDescriptor4 << new QStandardItem( "Double" );
QList<QStandardItem *> qlDescriptor5;
qlDescriptor5 << new QStandardItem( "y" );
qlDescriptor5 << new QStandardItem( "1.0" );
qlDescriptor5 << new QStandardItem( "Double" );
qlDescriptor3.first()->appendRow( qlDescriptor4 );
qlDescriptor3.first()->appendRow( qlDescriptor5 );
};
inline ~RedstartSessionDetailsTreeView() {};
private slots:
private:
RedstartSessionDetailModel* m_pModel;
};
#endif // IW_REDSTART_SESSION_DETAILS_TREE_VIEW
......@@ -40,6 +40,11 @@ RedstartSessionExperimentalTalkthroughDialog::~RedstartSessionExperimentalTalkth
delete ui;
}
QString RedstartSessionExperimentalTalkthroughDialog::GetSessionName() const
{
return ui->lineEdit_session_name->text();
}
QVariantHash RedstartSessionExperimentalTalkthroughDialog::GetCoreConfig() const
{
QVariantHash oFinalCoreConfig;
......@@ -66,31 +71,41 @@ QVariantHash RedstartSessionExperimentalTalkthroughDialog::GetCoreConfig() const
oFinalCoreConfig[ "Macros" ] = oMacros;
QVariantHash oSetup;
QVariantHash oDevice;
oDevice[ "Type" ] = "LSS";
oDevice[ "Channels" ] = ui->lineEdit_output_channels->text();
oSetup[ "OutputDevice:MyHP" ] = oDevice;
QStringList vsDeviceChannels = ui->lineEdit_output_channels->text().split( ",", QString::SkipEmptyParts );
QString sDeviceNames;
int i = 0;
for( QString sChannelNumber : vsDeviceChannels )
{
QVariantHash oDevice;
oDevice[ "Type" ] = "LS";
oDevice[ "Channels" ] = sChannelNumber;
QString sID = "OutputDevice:GenericDevice" + sChannelNumber;
oFinalCoreConfig[ sID ] = oDevice;
if( i++ == 0 )
sDeviceNames = sID;
else
sDeviceNames += "," + sID;
}
QVariantHash oOutput;
oOutput[ "Devices" ] = "MyHP";
oOutput[ "Devices" ] = sDeviceNames;
oSetup[ "Output:MyDesktopHP" ] = oOutput;
oFinalCoreConfig[ "Output:MyGenericOutput" ] = oOutput;
QVariantHash oReproduction;
oReproduction[ "Class" ] = "Talktrough";
oReproduction[ "Outputs" ] = "MyDesktopHP";
oReproduction[ "Outputs" ] = "MyGenericOutput";
oFinalCoreConfig[ "Reproduction:MyTalkthroughHeadphones" ] = oReproduction;
oFinalCoreConfig[ "Reproduction:MyGenericTalkthrough" ] = oReproduction;
QVariantHash oRenderer;
oRenderer[ "Class" ] = "BinauralFreeField";
oRenderer[ "Outputs" ] = "MyTalkthroughHeadphones";
oRenderer[ "Class" ] = "PrototypeGenericPath";
oRenderer[ "NumChannels" ] = ui->spinBox_num_channels->value();
oRenderer[ "Outputs" ] = "MyGenericTalkthrough";
oFinalCoreConfig[ QString( "Renderer:" + ui->lineEdit_session_name->text() ) ] = oRenderer;
oFinalCoreConfig[ "Renderer:MyExperimentalRenderer" ] = oRenderer;
return oFinalCoreConfig;
}
......
......@@ -32,6 +32,7 @@ public:
explicit RedstartSessionExperimentalTalkthroughDialog( QWidget *parent );
~RedstartSessionExperimentalTalkthroughDialog();
QVariantHash GetCoreConfig() const;
QString GetSessionName() const;
private slots:
void on_pushButton_CreateSession_clicked();
......
......@@ -16,6 +16,7 @@
#include <QListView>
#include <QStringListModel>
#include <QSettings>
#include <qnamespace.h>
#include <VAException.h>
#include <VAStruct.h>
......@@ -52,7 +53,7 @@ public:
inline ~RedstartSessionListView()
{
QString sCurrentSessionName = m_pModel->data( currentIndex() ).toString();
QString sCurrentSessionName = m_pModel->data( currentIndex(), 0).toString();
m_qSettings.setValue( "Redstart/last_session", sCurrentSessionName );
};
......@@ -97,7 +98,7 @@ public:
if( m_pModel->rowCount() == 0 || !index.isValid() )
return QString();
QString sSessionName = m_pModel->data( index ).toString();
QString sSessionName = m_pModel->data( index, 0 ).toString();
return sSessionName;
};
......
......@@ -14,8 +14,66 @@
#define IW_REDSTART_UTILS
#include <QHash>
#include <QStandardItem>
#include <VAStruct.h>
#include <cassert>
inline void ConvertVAStructToStandardItem( const CVAStruct& oStruct, QStandardItem* pItem )
{
assert( pItem != nullptr );
// QList< QStandardItem* > qlpItems;
CVAStruct::const_iterator cit = oStruct.Begin();
/*
while( cit != oStruct.End() )
{
const QString sKey( cit->first.c_str() );
const CVAStructValue& oValue( cit->second );
cit++;
if( oValue.IsStruct() )
{
QStandardItem* pNewItem = new QStandardItem;
pItem->appendColumn( pNewItem );
ConvertVAStructToStandardItem( oValue, pNewItem );
}
switch( oValue.GetDatatype() )
{
case CVAStructValue::BOOL:
{
pItem->appendColumn()[ sKey ] = bool( oValue );
break;
}
case CVAStructValue::INT:
{
oHash[ sKey ] = int( oValue );
break;
}
case CVAStructValue::DOUBLE:
{
oHash[ sKey ] = double( oValue );
break;
}
case CVAStructValue::STRING:
{
oHash[ sKey ] = QString( std::string( oValue ).c_str() );
break;
}
case CVAStructValue::DATA:
{
oHash[ sKey ] = QByteArray( ( const char* ) oValue.GetData(), oValue.GetDataSize() );
break;
}
}
}
pItem->appendColumn( qlpItems );
*/
};
inline QVariantHash ConvertVAStructToQHash( const CVAStruct& oStruct )
{
QVariantHash oHash;
......
......@@ -15,6 +15,7 @@
#include <QUrl>
#include <QDesktopServices>
#include <QHash>
#include <QShortcut>
#include "RedstartWindow.h"
#include <ui_RedstartWindow.h>
......@@ -42,6 +43,17 @@ RedstartWindow::RedstartWindow( bool bFailSafeMode, bool bAutoStart, bool bSkipC
ui->statusBar->showMessage( "Welcome to VA." );
// Shortcuts
QShortcut* start_b = new QShortcut( this );
start_b->setKey( Qt::Key_F5 );
start_b->setContext( Qt::WindowShortcut );
QShortcut* start_c = new QShortcut( this );
start_c->setKey( QKeySequence( tr( "CTRL+R" ) ) );
start_c->setContext( Qt::WindowShortcut );
connect( start_b, SIGNAL( activated() ), this, SLOT( on_pushButton_start_stop_clicked() ) );
connect( start_c, SIGNAL( activated() ), this, SLOT( on_pushButton_start_stop_clicked() ) );
m_pVANetServer = IVANetServer::Create();
m_pVANetClient = IVANetClient::Create();
......@@ -458,8 +470,6 @@ void RedstartWindow::on_pushButton_start_stop_clicked()
if( m_pVANetClient->IsConnected() )
m_pVANetClient->Disconnect();
m_pVAInterface = NULL;
bool bOK;
int iPort = ui->lineEdit_redstart_network_port->text().toInt( &bOK );
int iStatus = -1;
......@@ -481,6 +491,13 @@ void RedstartWindow::on_pushButton_start_stop_clicked()
}
catch( const CVAException& ex )
{
if( m_pVAInterface )
{
delete m_pVAInterface;
m_pVAInterface = NULL;
}
ui->statusBar->showMessage( QString::fromStdString( ex.ToString() ) );
ui->checkBox_redstart_auto_start->setChecked( false );
}
......@@ -501,12 +518,12 @@ void RedstartWindow::on_pushButton_refresh_clicked()
PopulateAudioDevices();
}
void RedstartWindow::on_comboBox_audio_driver_currentIndexChanged( int iIndex )
void RedstartWindow::on_comboBox_audio_driver_currentIndexChanged( int )
{
PopulateAudioDevices();
}
void RedstartWindow::on_comboBox_audio_iface_device_currentIndexChanged( int index )
void RedstartWindow::on_comboBox_audio_iface_device_currentIndexChanged( int )
{
}
......@@ -557,12 +574,12 @@ void RedstartWindow::on_checkBox_portaudio_default_device_clicked()
void RedstartWindow::on_listView_redstart_session_list_clicked( const QModelIndex &index )
{
std::string sSessionName = ui->listView_redstart_session_list->model()->data( index ).toString().toStdString();
ui->listView_redstart_session_list;
return;
if( ui->listView_redstart_session_list->model()->data( index ).isValid() )
{
std::string sSessionName = ui->listView_redstart_session_list->model()->data( index ).toString().toStdString();
CVAStruct oStruct = ui->listView_redstart_session_list->GetCurrentConfig();
ui->treeView_session_details->SetStruct( oStruct );
}
}
void RedstartWindow::on_actionBinauralHeadphones_triggered()
......@@ -576,11 +593,7 @@ void RedstartWindow::on_actionDefault_experimental_session_triggered()
{
RedstartSessionExperimentalTalkthroughDialog d( this );
if( d.exec() )
{
QVariantHash oCoreConfig = d.GetCoreConfig();
// add session
return;
}
ui->listView_redstart_session_list->AddSession( d.GetSessionName(), d.GetCoreConfig() );
}
void RedstartWindow::on_actionRunSimpleExample_triggered()
......
......@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>576</width>
<width>538</width>
<height>316</height>
</rect>
</property>
......@@ -21,6 +21,9 @@
<property name="text">
<string>Demo sound</string>
</property>
<property name="buddy">
<cstring>lineEdit_macro_DemoSound</cstring>
</property>
</widget>
</item>
<item row="2" column="3">
......@@ -81,6 +84,9 @@
<property name="text">
<string>HRIR filter length</string>
</property>
<property name="buddy">
<cstring>spinBox_hrir_filter_length</cstring>
</property>
</widget>
</item>
<item row="0" column="0">
......@@ -88,6 +94,9 @@
<property name="text">
<string>Session name</string>
</property>
<property name="buddy">
<cstring>lineEdit_session_name</cstring>
</property>
</widget>
</item>
<item row="2" column="0">
......@@ -95,6 +104,9 @@
<property name="text">
<string>Default HRIR</string>
</property>
<property name="buddy">
<cstring>lineEdit_macro_DefaultHRIR</cstring>
</property>
</widget>
</item>
<item row="1" column="3">
......@@ -116,6 +128,9 @@
<property name="text">
<string>Headphone channels</string>
</property>
<property name="buddy">
<cstring>lineEdit_headphone_channels</cstring>
</property>
</widget>
</item>
<item row="4" column="1">
......@@ -162,7 +177,10 @@
<item row="1" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Inverse HPRI calibration gain</string>
<string>Inverse HPIR calibration gain</string>
</property>
<property name="buddy">
<cstring>doubleSpinBox_InvHPIRCalibrationGain</cstring>
</property>
</widget>
</item>
......@@ -181,6 +199,9 @@
<property name="text">
<string>Inverse HPIR file</string>
</property>
<property name="buddy">
<cstring>lineEdit</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
......@@ -205,6 +226,9 @@
<property name="text">
<string>HPIR filter length</string>
</property>
<property name="buddy">
<cstring>lineEdit_2</cstring>
</property>
</widget>
</item>
<item row="2" column="2">
......@@ -231,6 +255,24 @@
</item>
</layout>
</widget>
<tabstops>
<tabstop>pushButton_CreateSession</tabstop>
<tabstop>lineEdit_session_name</tabstop>
<tabstop>pushButton_BrowseDemoSound</tabstop>
<tabstop>lineEdit_macro_DemoSound</tabstop>
<tabstop>lineEdit_macro_DefaultHRIR</tabstop>
<tabstop>checkBox_folders_as_search_path</tabstop>
<tabstop>spinBox_hrir_filter_length</tabstop>
<tabstop>lineEdit_headphone_channels</tabstop>
<tabstop>groupBox</tabstop>
<tabstop>pushButton</tabstop>
<tabstop>lineEdit</tabstop>
<tabstop>doubleSpinBox_InvHPIRCalibrationGain</tabstop>
<tabstop>checkBox</tabstop>
<tabstop>lineEdit_2</tabstop>
<tabstop>checkBox_2</tabstop>
<tabstop>pushButton_BrowseHRIR</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>
......@@ -28,6 +28,9 @@
<property name="text">
<string>Demo sound</string>
</property>
<property name="buddy">
<cstring>lineEdit_macro_DemoSound</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
......@@ -49,6 +52,9 @@
<property name="text">
<string>Session name</string>
</property>
<property name="buddy">
<cstring>lineEdit_session_name</cstring>
</property>
</widget>
</item>
<item row="3" column="0">
......@@ -56,6 +62,9 @@
<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">
......@@ -83,6 +92,9 @@
<property name="text">
<string>Output channel routing</string>
</property>
<property name="buddy">
<cstring>lineEdit_output_channels</cstring>
</property>
</widget>
</item>
<item row="4" column="1">
......
......@@ -77,7 +77,7 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_5" stretch="0,0,0,0,1">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_redstart_session">
<layout class="QHBoxLayout" name="horizontalLayout_redstart_session" stretch="1,2">
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="autoFillBackground">
......@@ -110,44 +110,18 @@ background-color: rgb(254, 228, 255);</string>
<item>
<widget class="QGroupBox" name="groupBox_5">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="title">
<string>Configuration</string>
<string>Session details</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_8">
<item>
<widget class="QTreeView" name="treeView_3"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="enabled">
<bool>false</bool>
</property>
<property name="title">
<string>Rendering modules</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_11">
<item>
<widget class="QTreeView" name="treeView"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="enabled">
<bool>false</bool>
</property>
<property name="title">
<string>Reproduction modules</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_12">
<item>
<widget class="QTreeView" name="treeView_2"/>
<widget class="RedstartSessionDetailsTreeView" name="treeView_session_details">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
......@@ -1122,6 +1096,11 @@ background-color: rgb(208, 255, 188);</string>
<extends>QListView</extends>
<header location="global">RedstartSessionList.h</header>
</customwidget>
<customwidget>
<class>RedstartSessionDetailsTreeView</class>
<extends>QTreeView</extends>
<header location="global">RedstartSessionDetailsTreeView.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
......
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