From b5c5c837e870be0af1e58b532c03c9337da717c2 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Sun, 7 Apr 2019 18:29:04 +0100 Subject: [PATCH] Add new information in modules --- app/VideoSubWindow.cpp | 3 ++- app/dialog/ModulesHandleOptDialog.cpp | 3 ++- lib/CalypOptions.cpp | 17 ++++++++++++----- lib/CalypOptions.h | 10 +++++++--- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/app/VideoSubWindow.cpp b/app/VideoSubWindow.cpp index 57a4732..3e7c1a9 100644 --- a/app/VideoSubWindow.cpp +++ b/app/VideoSubWindow.cpp @@ -412,7 +412,8 @@ void VideoSubWindow::updateVideoWindowInfo() } if( m_pcCurrentDisplayModule->getModuleRequirements() & CLP_MODULES_HAS_INFO ) { - windowInfoList.append( QString::fromStdString( m_pcCurrentDisplayModule->moduleInfo() ) ); + QStringList list = QString::fromStdString( m_pcCurrentDisplayModule->moduleInfo() ).split( '\n' ); + windowInfoList.append( list ); } // qDebug( ) << sourceWindowList; if( windowInfoList.size() > 0 ) diff --git a/app/dialog/ModulesHandleOptDialog.cpp b/app/dialog/ModulesHandleOptDialog.cpp index 995c2b0..f5d1012 100644 --- a/app/dialog/ModulesHandleOptDialog.cpp +++ b/app/dialog/ModulesHandleOptDialog.cpp @@ -44,7 +44,8 @@ public: m_pcChecked = NULL; m_cName = option->opt_string; m_pcDescription = new QLabel; - m_pcDescription->setText( QString::fromStdString( option->opt_desc ) ); + QString desc = QString::fromStdString( option->opt_desc ); + m_pcDescription->setText( desc ); QHBoxLayout* layout = new QHBoxLayout; layout->addWidget( m_pcDescription, 0, Qt::AlignLeft ); if( !option->isBinary() ) diff --git a/lib/CalypOptions.cpp b/lib/CalypOptions.cpp index 125cd51..46a38d2 100644 --- a/lib/CalypOptions.cpp +++ b/lib/CalypOptions.cpp @@ -62,7 +62,7 @@ class boolOption : public OptionBase { public: boolOption( const ClpString& name, const ClpString& desc ) - : OptionBase( name, desc ) { is_binary = true; } + : OptionBase( name, desc, "(1-0)" ) { is_binary = true; } void parse( const ClpString& arg ) { arg_count++; } }; @@ -71,8 +71,8 @@ template class StandardOption : public OptionBase { public: - StandardOption( const ClpString& name, T& storage, const ClpString& desc ) - : OptionBase( name, desc ), opt_storage( storage ) + StandardOption( const ClpString& name, T& storage, const ClpString& desc, const ClpString& def ) + : OptionBase( name, desc, def ), opt_storage( storage ) { is_binary = false; } @@ -160,8 +160,8 @@ struct FunctionOption : public OptionBase public: typedef void( Func )( CalypOptions&, const ClpString& ); - FunctionOption( const ClpString& name, CalypOptions& parent_, Func* func_, const ClpString& desc ) - : OptionBase( name, desc ), parent( parent_ ), func( func_ ) + FunctionOption( const ClpString& name, CalypOptions& parent_, Func* func_, const ClpString& desc, const ClpString& def ) + : OptionBase( name, desc, def ), parent( parent_ ), func( func_ ) { is_binary = false; } @@ -198,6 +198,13 @@ CalypOptions& CalypOptions::operator()( const ClpString& name, const ClpString& */ template CalypOptions& CalypOptions::operator()( const ClpString& name, T& storage, const ClpString& desc ) +{ + addOption( new StandardOption( name, storage, desc, ClpString( "" ) ) ); + return *this; +} + +template +CalypOptions& CalypOptions::operator()( const ClpString& name, T& storage, const ClpString& desc, const ClpString& defaults ) { addOption( new StandardOption( name, storage, desc ) ); return *this; diff --git a/lib/CalypOptions.h b/lib/CalypOptions.h index 1e20eaf..8f4fe32 100644 --- a/lib/CalypOptions.h +++ b/lib/CalypOptions.h @@ -55,8 +55,8 @@ class OptionBase { public: - OptionBase( const ClpString& name, const ClpString& desc ) - : arg_count( 0 ), opt_string( name ), opt_desc( desc ) {} + OptionBase( const ClpString& name, const ClpString& desc, const ClpString& def ) + : arg_count( 0 ), opt_string( name ), opt_desc( desc ), opt_defaults( def ) {} virtual ~OptionBase() {} /* parse argument arg, to obtain a value for the option */ virtual void parse( const ClpString& arg ) = 0; @@ -65,6 +65,7 @@ public: int arg_count; ClpString opt_string; ClpString opt_desc; + ClpString opt_defaults; bool is_binary; }; @@ -117,11 +118,14 @@ public: * Add option described by name to the parent Options list, * with storage for the option's value * with default_val as the default value - * with desc as an optional help description + * description and range along with default value */ template CalypOptions& operator()( const ClpString& name, T& storage, const ClpString& desc ); + template + CalypOptions& operator()( const ClpString& name, T& storage, const ClpString& desc, const ClpString& defaults ); + bool checkListingOpts(); private: