diff --git a/Code/Wrappers/ApplicationLauncherQt/otbApplicationLauncherQt.cxx b/Code/Wrappers/ApplicationLauncherQt/otbApplicationLauncherQt.cxx index 436186614ebf276d2902d1c7fe8e74394f7ff1bb..40c4062733ac059d2d72661961ea197035f071bf 100644 --- a/Code/Wrappers/ApplicationLauncherQt/otbApplicationLauncherQt.cxx +++ b/Code/Wrappers/ApplicationLauncherQt/otbApplicationLauncherQt.cxx @@ -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 diff --git a/Code/Wrappers/QtWidget/CMakeLists.txt b/Code/Wrappers/QtWidget/CMakeLists.txt index 1e2182a68ab71047c7e35f7141316c8abba52dfb..59ee9df970d7807529f2829059637549e9790003 100644 --- a/Code/Wrappers/QtWidget/CMakeLists.txt +++ b/Code/Wrappers/QtWidget/CMakeLists.txt @@ -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}) diff --git a/Code/Wrappers/QtWidget/otbWrapperQtWidgetModel.cxx b/Code/Wrappers/QtWidget/otbWrapperQtWidgetModel.cxx index fdb66d21c74c182e22a61ee30da9e97f47f7c503..857984f3ce032bad588e3522cc94d4ab85f7a028 100644 --- a/Code/Wrappers/QtWidget/otbWrapperQtWidgetModel.cxx +++ b/Code/Wrappers/QtWidget/otbWrapperQtWidgetModel.cxx @@ -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() diff --git a/Code/Wrappers/QtWidget/otbWrapperQtWidgetModel.h b/Code/Wrappers/QtWidget/otbWrapperQtWidgetModel.h index de9705927cb80ca23e36ec8b136b0061c00e81d6..616ecbc47921abfcc9ba674873d5cfbb037c08a1 100644 --- a/Code/Wrappers/QtWidget/otbWrapperQtWidgetModel.h +++ b/Code/Wrappers/QtWidget/otbWrapperQtWidgetModel.h @@ -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; }; diff --git a/Code/Wrappers/QtWidget/otbWrapperQtWidgetProgressReport.h b/Code/Wrappers/QtWidget/otbWrapperQtWidgetProgressReport.h index 22eb854ca3d2cfa7e9a97e10711b403ae39039b9..7ca0721058bf56025cf68b1b12a5eba9659f35b6 100644 --- a/Code/Wrappers/QtWidget/otbWrapperQtWidgetProgressReport.h +++ b/Code/Wrappers/QtWidget/otbWrapperQtWidgetProgressReport.h @@ -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(); diff --git a/Code/Wrappers/QtWidget/otbWrapperQtWidgetView.cxx b/Code/Wrappers/QtWidget/otbWrapperQtWidgetView.cxx index 4921900aec9704ef06e0378caf13f5b1500f2c8d..4746e7d1b27641af9580afa2a614f3e7666c9ed4 100644 --- a/Code/Wrappers/QtWidget/otbWrapperQtWidgetView.cxx +++ b/Code/Wrappers/QtWidget/otbWrapperQtWidgetView.cxx @@ -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); diff --git a/Testing/Code/Wrappers/Qt/CMakeLists.txt b/Testing/Code/Wrappers/Qt/CMakeLists.txt index 246bcf661f4ea6f6e946c28029e4643aa35a2bc3..dbc5528c10dc0509e2c765dd1a15faef82e1cb3a 100644 --- a/Testing/Code/Wrappers/Qt/CMakeLists.txt +++ b/Testing/Code/Wrappers/Qt/CMakeLists.txt @@ -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 diff --git a/Utilities/ITK/Code/Common/itkStdStreamLogOutput.cxx b/Utilities/ITK/Code/Common/itkStdStreamLogOutput.cxx index 91eaf72f55b84142ec2087d378614db5da600dd2..2ac072f8302177f9e60094ced68304c71e05a288 100644 --- a/Utilities/ITK/Code/Common/itkStdStreamLogOutput.cxx +++ b/Utilities/ITK/Code/Common/itkStdStreamLogOutput.cxx @@ -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; } }