Skip to content
Snippets Groups Projects
Commit 39e9b714 authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen
Browse files

Merge branch 'master' of http://git.rwth-aachen.de/ita/Redstart

parents ae0f0bea d8bc5857
Branches
Tags v2018.b
No related merge requests found
...@@ -67,6 +67,8 @@ set( Redstart_Sources ...@@ -67,6 +67,8 @@ set( Redstart_Sources
"src/RedstartSessionExperimentalTalkthroughDialog.h" "src/RedstartSessionExperimentalTalkthroughDialog.h"
"src/RedstartSessionImportDialog.cpp" "src/RedstartSessionImportDialog.cpp"
"src/RedstartSessionImportDialog.h" "src/RedstartSessionImportDialog.h"
"src/RedstartSessionExportDialog.cpp"
"src/RedstartSessionExportDialog.h"
"src/RedstartSessionWizardDialog.cpp" "src/RedstartSessionWizardDialog.cpp"
"src/RedstartSessionWizardDialog.h" "src/RedstartSessionWizardDialog.h"
"src/RedstartSessionList.h" "src/RedstartSessionList.h"
...@@ -83,6 +85,7 @@ set( Redstart_UIs ...@@ -83,6 +85,7 @@ set( Redstart_UIs
"ui/RedstartSessionBinauralHeadphonesDialog.ui" "ui/RedstartSessionBinauralHeadphonesDialog.ui"
"ui/RedstartSessionExperimentalTalkthroughDialog.ui" "ui/RedstartSessionExperimentalTalkthroughDialog.ui"
"ui/RedstartSessionImportDialog.ui" "ui/RedstartSessionImportDialog.ui"
"ui/RedstartSessionExportDialog.ui"
"ui/RedstartSessionWizardDialog.ui" "ui/RedstartSessionWizardDialog.ui"
"ui/RedstartRunCirculatingSourceDialog.ui" "ui/RedstartRunCirculatingSourceDialog.ui"
"ui/RedstartAboutDialog.ui" "ui/RedstartAboutDialog.ui"
...@@ -93,6 +96,7 @@ qt5_wrap_ui( "ui_RedstartWindow.h" "ui/RedstartWindow.ui" ) ...@@ -93,6 +96,7 @@ qt5_wrap_ui( "ui_RedstartWindow.h" "ui/RedstartWindow.ui" )
qt5_wrap_ui( "ui_RedstartSessionBinauralHeadphonesDialog.h" "ui/RedstartSessionBinauralHeadphonesDialog.ui" ) qt5_wrap_ui( "ui_RedstartSessionBinauralHeadphonesDialog.h" "ui/RedstartSessionBinauralHeadphonesDialog.ui" )
qt5_wrap_ui( "ui_RedstartSessionExperimentalTalkthroughDialog.h" "ui/RedstartSessionExperimentalTalkthroughDialog.ui" ) qt5_wrap_ui( "ui_RedstartSessionExperimentalTalkthroughDialog.h" "ui/RedstartSessionExperimentalTalkthroughDialog.ui" )
qt5_wrap_ui( "ui_RedstartSessionImportDialog.h" "ui/RedstartSessionImportDialog.ui" ) qt5_wrap_ui( "ui_RedstartSessionImportDialog.h" "ui/RedstartSessionImportDialog.ui" )
qt5_wrap_ui( "ui_RedstartSessionExportDialog.h" "ui/RedstartSessionExportDialog.ui" )
qt5_wrap_ui( "ui_RedstartSessionWizardDialog.h" "ui/RedstartSessionWizardDialog.ui" ) qt5_wrap_ui( "ui_RedstartSessionWizardDialog.h" "ui/RedstartSessionWizardDialog.ui" )
qt5_wrap_ui( "ui_RedstartRunCirculatingSourceDialog.h" "ui/RedstartRunCirculatingSourceDialog.ui" ) qt5_wrap_ui( "ui_RedstartRunCirculatingSourceDialog.h" "ui/RedstartRunCirculatingSourceDialog.ui" )
qt5_wrap_ui( "ui_RedstartAboutDialog.h" "ui/RedstartAboutDialog.ui" ) qt5_wrap_ui( "ui_RedstartAboutDialog.h" "ui/RedstartAboutDialog.ui" )
......
/*
* --------------------------------------------------------------------------------------------
*
* 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
*
* --------------------------------------------------------------------------------------------
*/
#include "RedstartSessionExportDialog.h"
#include <ui_RedstartSessionExportDialog.h>
#include "RedstartUtils.h"
#include <VAException.h>
#include <VAStruct.h>
#include <VACore.h>
#include <QFileDialog>
#include <QSettings>
RedstartSessionExportDialog::RedstartSessionExportDialog( QWidget *parent )
: QDialog( parent ),
ui( new Ui::RedstartSessionExportDialog )
, m_bStartImmediately( false )
{
ui->setupUi( this );
QDialog::setWindowTitle( "Export session" );
QSettings qSettings;
QString sLastBrowseFolder = qSettings.value( "Redstart/last_browse_folder" ).toString();
std::string s = sLastBrowseFolder.toStdString();
if( QDir( sLastBrowseFolder ).exists() )
m_oLastBasePath.setCurrent( sLastBrowseFolder );
}
RedstartSessionExportDialog::~RedstartSessionExportDialog()
{
if( m_oLastBasePath.exists() )
m_qSettings.setValue( "Redstart/last_browse_folder", m_oLastBasePath.absolutePath() );
delete ui;
}
QString RedstartSessionExportDialog::GetSessionName() const
{
return ui->lineEdit_Export_config_file->text();
}
bool RedstartSessionExportDialog::ValidFile() const
{
return m_oConfigFileBasePath.exists() && !m_oConfigFileBasePath.isDir();
}
bool RedstartSessionExportDialog::GetStartImmediately() const
{
return m_bStartImmediately;
}
QVariantHash RedstartSessionExportDialog::GetCoreConfig() const
{
if( !ValidFile() )
VA_EXCEPT2( INVALID_PARAMETER, "Can not import from a directory or non-existing file" );
CVAStruct oCoreConfig = VACore::LoadCoreConfigFromFile( m_oConfigFileBasePath.absoluteFilePath().toStdString() );
return ConvertVAStructToQHash( oCoreConfig );
}
void RedstartSessionExportDialog::on_pushButton_CreateSession_clicked()
{
accept();
close();
}
void RedstartSessionExportDialog::on_pushButton_CreateAndStartSession_clicked()
{
m_bStartImmediately = true;
accept();
close();
}
void RedstartSessionExportDialog::on_pushButton_select_import_file_clicked()
{
QFileDialog fd;
fd.setNameFilters( QStringList() << "INI files (*.ini)" << "Any file (*.*)" );
fd.setViewMode( QFileDialog::Detail );
if( m_oLastBasePath.exists() )
fd.setDirectory( m_oLastBasePath );
else
fd.setDirectory( QDir( QApplication::applicationDirPath() ) );
if( fd.exec() )
{
QStringList lFiles = fd.selectedFiles();
if( lFiles.empty() == false )
{
QString sFilePath = lFiles[ 0 ];
m_oConfigFileBasePath.setFile( sFilePath );
if( m_oConfigFileBasePath.exists() )
m_oLastBasePath = fd.directory();
ui->lineEdit_Export_config_file->setText( m_oConfigFileBasePath.fileName() );
}
}
}
/*
* --------------------------------------------------------------------------------------------
*
* 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_EXPORT_DIALOG
#define IW_REDSTART_SESSION_EXPORT_DIALOG
#include <QDialog>
#include <QDir>
#include <QFileInfo>
#include <QString>
#include <QSettings>
#include <QHash>
namespace Ui
{
class RedstartSessionExportDialog;
}
class RedstartSessionExportDialog : public QDialog
{
Q_OBJECT
public:
explicit RedstartSessionExportDialog( QWidget *parent );
~RedstartSessionExportDialog();
QVariantHash GetCoreConfig() const;
QString GetSessionName() const;
bool ValidFile() const;
bool GetStartImmediately() const;
private slots:
void on_pushButton_CreateSession_clicked();
void on_pushButton_CreateAndStartSession_clicked();
void on_pushButton_select_import_file_clicked();
private:
Ui::RedstartSessionExportDialog* ui;
QDir m_oLastBasePath;
QFileInfo m_oConfigFileBasePath;
QSettings m_qSettings;
bool m_bStartImmediately;
};
#endif // IW_REDSTART_SESSION_EXPORT_DIALOG
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>RedstartSessionExportDialog</class>
<widget class="QDialog" name="RedstartSessionExportDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>507</width>
<height>148</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="3" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton_ExportSession">
<property name="text">
<string>Export</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Export</string>
</property>
<property name="buddy">
<cstring>lineEdit_Export_config_file</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEdit_Export_config_file">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButton_select_Export_file">
<property name="text">
<string>Select</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="checkBox_include_audio_settings">
<property name="text">
<string>Include audio interface settings</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<tabstops>
<tabstop>lineEdit_Export_config_file</tabstop>
<tabstop>pushButton_select_Export_file</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>401</width> <width>507</width>
<height>100</height> <height>100</height>
</rect> </rect>
</property> </property>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment