Skip to content
Snippets Groups Projects
Commit 339f01da authored by Cyrille Valladeau's avatar Cyrille Valladeau
Browse files

ENH: refact Qt GUI in progress

parent 28271c71
No related branches found
No related tags found
No related merge requests found
......@@ -20,13 +20,14 @@
#include "otbWrapperApplication.h"
#include "otbWrapperApplicationRegistry.h"
#include "otbWrapperQtWidgetView.h"
#include "otbWrapperQtWidgetProgressReport.h"
#include "otbWrapperQtWidgetSimpleProgressReport.h"
#include "itksys/SystemTools.hxx"
using otb::Wrapper::Application;
using otb::Wrapper::ApplicationRegistry;
using otb::Wrapper::QtWidgetView;
using otb::Wrapper::QtWidgetProgressReport;
using otb::Wrapper::QtWidgetSimpleProgressReport;
int main(int argc, char* argv[])
{
......@@ -87,7 +88,7 @@ int main(int argc, char* argv[])
QObject::connect(gui, SIGNAL(QuitSignal()), mainWindow, SLOT(close()));
// Create a progressReport object
QtWidgetProgressReport* progressReport = new QtWidgetProgressReport(gui->GetModel());
QtWidgetSimpleProgressReport * progressReport = new QtWidgetSimpleProgressReport(gui->GetModel());
progressReport->SetApplication(app);
// Create a dock widget containg the progress widget
......
......@@ -22,6 +22,8 @@ set( WrappersQtWidget_MOC_HDR
otbQtFileSelectionWidget.h
itkQtProgressBar.h
otbWrapperQtWidgetFilenameParameter.h
otbQtLogOutput.h
otbWrapperQtWidgetSimpleProgressReport.h
)
QT4_WRAP_CPP(WrappersQtWidget_MOC_SRC ${WrappersQtWidget_MOC_HDR})
......
......@@ -26,6 +26,11 @@ QtWidgetModel::QtWidgetModel(Application* app)
: m_Application(app)
{
m_Application->Init();
m_LogOutput = QtLogOutput::New();
// Attach log output to the Application logger
m_Application->GetLogger()->SetTimeStampFormat(itk::LoggerBase::HUMANREADABLE);
m_Application->GetLogger()->AddLogOutput(m_LogOutput);
}
QtWidgetModel::~QtWidgetModel()
......
......@@ -20,6 +20,7 @@
#include <QtGui>
#include "otbWrapperApplication.h"
#include "otbQtLogOutput.h"
namespace otb
{
......@@ -80,6 +81,11 @@ public:
return m_Application;
}
QtLogOutput::Pointer GetLogOutput()
{
return m_LogOutput;
}
signals:
void SetApplicationReady(bool);
void SetProgressReportBegin();
......@@ -100,6 +106,8 @@ private:
void operator=(const QtWidgetModel&); //purposely not implemented
Application::Pointer m_Application;
QtLogOutput::Pointer m_LogOutput;
};
......
......@@ -48,10 +48,30 @@ public:
typedef itk::MemberCommand< QtWidgetProgressReport > AddProcessCommandType;
void ProcessEvent( itk::Object * caller, const itk::EventObject & event );
std::string GetCurrentDescription()
{
return m_CurrentDescription;
}
itk::ProcessObject* GetCurrentProcess()
{
return m_CurrentProcess;
}
QtWidgetModel * GetModel()
{
m_Model;
}
QVBoxLayout * GetLayout()
{
return m_Layout;
}
public slots:
void RemoveLayout();
void ReportProcess();
virtual void ReportProcess();
signals:
void AddNewProcessToReport();
......
......@@ -19,7 +19,7 @@
#include "otbWrapperQtWidgetParameterGroup.h"
#include "otbWrapperQtWidgetParameterFactory.h"
#include "otbWrapperQtWidgetProgressReport.h"
#include "otbWrapperOutputImageParameter.h"
#include "itksys/SystemTools.hxx"
......@@ -44,11 +44,19 @@ void QtWidgetView::CreateGui()
{
// Create a VBoxLayout with the header, the input widgets, and the footer
QVBoxLayout *mainLayout = new QVBoxLayout();
QTabWidget *tab = new QTabWidget();
mainLayout->addWidget(CreateHeader());
mainLayout->addWidget(CreateInputWidgets());
tab->addTab(CreateInputWidgets(), "Parameters");
mainLayout->addWidget(tab);
QTextEdit *log = new QTextEdit();
connect( m_Model->GetLogOutput(), SIGNAL(NewContentLog(QString)), log, SLOT(append(QString) ) );
tab->addTab(log, "Logs");
QtWidgetProgressReport* prog = new QtWidgetProgressReport(m_Model);
prog->SetApplication(m_Application);
tab->addTab(prog, "Progress Reporting ...");
//mainLayout->addWidget(CreateInputWidgets());
mainLayout->addWidget(CreateFooter());
//mainLayout->addStretch();
QGroupBox *mainGroup = new QGroupBox();
mainGroup->setLayout(mainLayout);
......@@ -62,7 +70,6 @@ void QtWidgetView::CreateGui()
QVBoxLayout *scrollLayout = new QVBoxLayout();
scrollLayout->addWidget(scrollArea);
//scrollLayout->addStretch();
// Make the scroll layout the main layout
this->setLayout(scrollLayout);
......
......@@ -40,4 +40,7 @@ add_test(NAME owTvQtWidgetShow_${app}
${app}
$<TARGET_FILE_DIR:otbapp_${app}> )
endforeach(app)
\ No newline at end of file
endforeach(app)
add_test(owTvQtLogOutputNew ${OTB_WRAPPER_QTWIDGET_TESTS}
otbQtLogOutputNew)
\ No newline at end of file
......@@ -96,7 +96,6 @@ void StdStreamLogOutput::Write(std::string const &content, double timestamp)
void StdStreamLogOutput::PrintSelf(std::ostream &os, Indent indent) const
{
Superclass::PrintSelf(os,indent);
os << indent << "Stream: " << m_Stream << std::endl;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment