WIP

parent 86b415b0
......@@ -71,6 +71,7 @@ set( Redstart_Sources
"src/RedstartSessionWizardDialog.h"
"src/RedstartSessionList.h"
"src/RedstartSessionDetailsTreeView.h"
"src/RedstartCoreOutputPlainTextEdit.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_CORE_OUTPUT_PLAIN_TEXT_EDIT
#define IW_REDSTART_CORE_OUTPUT_PLAIN_TEXT_EDIT
#include <QPlainTextEdit>
#include <QStringListModel>
#include <iostream>
class RedstartCoreOutputPlainTextEdit : public QPlainTextEdit
{
class CStreamBuffer : public std::streambuf
{
public:
CStreamBuffer( RedstartCoreOutputPlainTextEdit* pParent )
: m_pParent( pParent )
{
setp( 0, 0 );
setg( 0, 0, 0 );
};
virtual int_type overflow( int_type c )
{
if( c != EOF )
m_pParent->write( ( char ) c );
return c;
};
private:
RedstartCoreOutputPlainTextEdit* m_pParent;
};
class COutStream : public std::ostream
{
public:
inline COutStream( RedstartCoreOutputPlainTextEdit* pParent )
: sb( pParent )
, std::ostream( &sb )
, std::ios( 0 )
{
};
inline ~COutStream()
{
sb.pubsync();
};
private:
CStreamBuffer sb;
};
Q_OBJECT
public:
inline RedstartCoreOutputPlainTextEdit( QWidget* pParent )
: QPlainTextEdit( pParent )
{
m_pOutStream = new COutStream( this );
};
inline ~RedstartCoreOutputPlainTextEdit()
{
delete m_pOutStream;
m_pOutStream = NULL;
};
inline std::ostream* GetOutputStream()
{
return m_pOutStream;
};
inline void write( char c )
{
appendPlainText( QString( &c ) );
};
inline void write( const std::string& str )
{
};
public slots :
private:
COutStream* m_pOutStream;
};
#endif // IW_REDSTART_CORE_OUTPUT_PLAIN_TEXT_EDIT
......@@ -27,6 +27,7 @@
#include "RedstartSessionImportDialog.h"
#include "RedstartSessionWizardDialog.h"
#include "RedstartUtils.h"
#include "RedstartCoreOutputPlainTextEdit.h"
#include <VA.h>
#include <VACore.h>
......@@ -232,6 +233,8 @@ void RedstartWindow::PostCoreStart()
ui->groupBox_paths->setEnabled( true );
ui->groupBox_macros->setEnabled( true );
ui->menuRun->setEnabled( true );
ui->groupBox_core_control->setEnabled( true );
ui->groupBox_level_meters->setEnabled( true );
CVAVersionInfo oVersion;
m_pVAInterface->GetVersionInfo( &oVersion );
......@@ -257,6 +260,8 @@ void RedstartWindow::PostCoreStop()
ui->groupBox_paths->setEnabled( false );
ui->groupBox_macros->setEnabled( false );
ui->menuRun->setEnabled( false );
ui->groupBox_core_control->setEnabled( false );
ui->groupBox_level_meters->setEnabled( false );
}
void RedstartWindow::RestoreWindowSize()
......@@ -508,8 +513,8 @@ void RedstartWindow::on_pushButton_start_stop_clicked()
m_pVAInterface = VACore::CreateCoreInstance( oVAConfigArgs );
m_pVAInterface->Initialize();
// @todo attach event handler
m_pVAInterface->AttachEventHandler( this );
m_pVAInterface->SetDebugStream( ui->plainTextEdit_core_output->GetOutputStream() );
m_pVANetServer->SetCoreInstance( m_pVAInterface );
......@@ -558,7 +563,7 @@ void RedstartWindow::on_pushButton_start_stop_clicked()
m_pVAInterface = m_pVANetClient->GetCoreInstance();
// @todo attach event handler
// @todo attach network event handler to detect server connection loss or abortion
//m_pVANetClient->AttachEventHandler( this );
}
}
......@@ -947,3 +952,8 @@ void RedstartWindow::on_actionRunSimpleExample_triggered()
oErrMsg.exec();
}
}
void RedstartWindow::on_pushButton_core_control_reset_clicked()
{
if( m_pVAInterface )
m_pVAInterface->Reset();
}
......@@ -140,6 +140,7 @@ private slots:
void on_actionDefault_experimental_session_triggered();
void on_actionRunSimpleExample_triggered();
void on_pushButton_core_control_reset_clicked();
void on_actionCirculating_source_triggered();
......
......@@ -406,14 +406,7 @@ background-color: rgb(208, 255, 188);</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_13">
<item>
<widget class="QListView" name="listView_output">
<property name="minimumSize">
<size>
<width>400</width>
<height>0</height>
</size>
</property>
</widget>
<widget class="RedstartCoreOutputPlainTextEdit" name="plainTextEdit_core_output"/>
</item>
</layout>
</widget>
......@@ -434,7 +427,7 @@ background-color: rgb(208, 255, 188);</string>
</widget>
</item>
<item row="1" column="5" rowspan="2">
<widget class="QGroupBox" name="groupBox">
<widget class="QGroupBox" name="groupBox_level_meters">
<property name="title">
<string>Level meters</string>
</property>
......@@ -1150,6 +1143,11 @@ background-color: rgb(208, 255, 188);</string>
<extends>QTreeView</extends>
<header location="global">RedstartSessionDetailsTreeView.h</header>
</customwidget>
<customwidget>
<class>RedstartCoreOutputPlainTextEdit</class>
<extends>QPlainTextEdit</extends>
<header location="global">RedstartCoreOutputPlainTextEdit.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