From f21cc14f439970167e8bed453fb1aa847b900daa Mon Sep 17 00:00:00 2001 From: Christophe Meynard Date: Fri, 21 Jun 2024 09:54:23 +0200 Subject: [PATCH] MMVII: update vMMVII with new argument semantics --- MMVII/src/Appli/cMMVII_Appli.cpp | 4 +-- MMVII/src/Appli/cMMVII_GenArgsSpec.cpp | 5 ++++ MMVII/vMMVII/cmdconfigurewidget.cpp | 4 ++- MMVII/vMMVII/commandspec.cpp | 2 ++ MMVII/vMMVII/commandspec.h | 3 ++- MMVII/vMMVII/inputwidget.cpp | 37 ++++++++++++++++++++++++-- MMVII/vMMVII/inputwidget.h | 12 +++++++++ 7 files changed, 61 insertions(+), 6 deletions(-) diff --git a/MMVII/src/Appli/cMMVII_Appli.cpp b/MMVII/src/Appli/cMMVII_Appli.cpp index ecc777a08a..b398a4f5b0 100755 --- a/MMVII/src/Appli/cMMVII_Appli.cpp +++ b/MMVII/src/Appli/cMMVII_Appli.cpp @@ -461,12 +461,12 @@ void cMMVII_Appli::InitParam(cGenArgsSpecContext *aArgsSpecs) if (HasMain0) { mArgFac << AOpt2007(mIntervFilterMS[0],GOP_Int0,"File Filter Interval, Main Set" ,{eTA2007::Shared,{eTA2007::FFI,"0"}}); - mArgFac << AOpt2007(mTransfoFFI[0],"Pat"+GOP_Int0,"Pattern Transfo File Filter Interval, Main Set" ,{eTA2007::Shared}); + mArgFac << AOpt2007(mTransfoFFI[0],"Pat"+GOP_Int0,"Pattern Transfo File Filter Interval, Main Set" ,{eTA2007::Shared,{eTA2007::ISizeV,"[2,2]"}}); } if (HasMain1) { mArgFac << AOpt2007(mIntervFilterMS[1],GOP_Int1,"File Filter Interval, Second Set",{eTA2007::Shared,{eTA2007::FFI,"1"}}); - mArgFac << AOpt2007(mTransfoFFI[1],"Pat"+GOP_Int1,"Pattern Transfo File Filter Interval, Main Set" ,{eTA2007::Shared}); + mArgFac << AOpt2007(mTransfoFFI[1],"Pat"+GOP_Int1,"Pattern Transfo File Filter Interval, Main Set" ,{eTA2007::Shared,{eTA2007::ISizeV,"[2,2]"}}); } } if (The_MMVII_DebugLevel >= The_MMVII_DebugLevel_InternalError_micro) diff --git a/MMVII/src/Appli/cMMVII_GenArgsSpec.cpp b/MMVII/src/Appli/cMMVII_GenArgsSpec.cpp index 4517ba19ee..28ef4a966c 100755 --- a/MMVII/src/Appli/cMMVII_GenArgsSpec.cpp +++ b/MMVII/src/Appli/cMMVII_GenArgsSpec.cpp @@ -21,6 +21,8 @@ static const std::vector prjSubDirList = // c eTA2007::MulTieP, eTA2007::RigBlock, eTA2007::SysCo, + eTA2007::Topo, + eTA2007::Clino, }; static const std::map> fileList = // clazy:exclude=non-pod-global-static @@ -29,6 +31,9 @@ static const std::map> fileList = // c {eTA2007::FileCloud,{".ply"}}, {eTA2007::File3DRegion,{".*"}}, {eTA2007::XmlOfTopTag,{".xml",".json"}}, + {eTA2007::FileTagged,{".xml",".json"}}, + {eTA2007::FileAny,{"*"}}, + {eTA2007::FileTxt,{"*"}}, }; } // namespace GenArgsInternal diff --git a/MMVII/vMMVII/cmdconfigurewidget.cpp b/MMVII/vMMVII/cmdconfigurewidget.cpp index 22bf293889..ed10a87317 100644 --- a/MMVII/vMMVII/cmdconfigurewidget.cpp +++ b/MMVII/vMMVII/cmdconfigurewidget.cpp @@ -96,11 +96,13 @@ InputWidget *CmdConfigureWidget::createInput(QWidget *widget, QGridLayout *layou case ArgSpec::T_STRING: if (contains(as.semantic,eTA2007::FFI)) return new InputFFI(widget, layout, as); - if (contains(as.semantic,{eTA2007::DirProject, eTA2007::FileDirProj,eTA2007::MPatFile, eTA2007::vMMVII_PhpPrjDir,eTA2007::vMMVII_FilesType})) + if (contains(as.semantic,{eTA2007::DirProject, eTA2007::FileDirProj,eTA2007::MPatFile, eTA2007::FolderAny, eTA2007::vMMVII_PhpPrjDir,eTA2007::vMMVII_FilesType})) return new InputFile(widget, layout, as, allSpecs); return new InputString(widget, layout, as); case ArgSpec::T_VEC_STRING: return new InputStrings(widget,layout,as,0); + case ArgSpec::T_VEC_VEC_STRING: + return new InputText(widget, layout, as); case ArgSpec::T_UNKNOWN: return new InputString(widget, layout, as); } diff --git a/MMVII/vMMVII/commandspec.cpp b/MMVII/vMMVII/commandspec.cpp index 74f01fb02c..861ce79662 100644 --- a/MMVII/vMMVII/commandspec.cpp +++ b/MMVII/vMMVII/commandspec.cpp @@ -13,6 +13,7 @@ const std::map eTA2007::enumMap= {eTA2007::DirProject,"DP"}, {eTA2007::FileDirProj,"FDP"}, {eTA2007::MPatFile,"MPF"}, + {eTA2007::FolderAny,"FolderAny"}, {eTA2007::Input,"In"}, {eTA2007::Output,"Out"}, {eTA2007::OptionalExist,"OptEx"}, @@ -59,6 +60,7 @@ static void typeNameToEnum(ArgSpec& as, const QString& command) {"std::vector",ArgSpec::T_VEC_INT}, {"std::vector",ArgSpec::T_VEC_DOUBLE}, {"std::vector",ArgSpec::T_VEC_STRING}, + {"std::vector>",ArgSpec::T_VEC_VEC_STRING}, {"cPtxd",ArgSpec::T_PTXD2_INT}, {"cPtxd",ArgSpec::T_PTXD3_INT}, {"cPtxd",ArgSpec::T_PTXD2_DOUBLE}, diff --git a/MMVII/vMMVII/commandspec.h b/MMVII/vMMVII/commandspec.h index e19221b7ce..fa42552fba 100644 --- a/MMVII/vMMVII/commandspec.h +++ b/MMVII/vMMVII/commandspec.h @@ -17,6 +17,7 @@ class eTA2007 { DirProject, ///< Exact Dir of Proj FileDirProj, ///< File that define the Dir Proj MPatFile, ///< Major PaternIm => "" or "0" in sem for set1, "1" or other for set2 + FolderAny, ///< Any folder, no more specificiation can be given FFI, ///< File Filter Interval Input, ///< Is this parameter used as input/read Output, ///< Is this parameter used as output/write @@ -46,7 +47,7 @@ class eTA2007 { struct ArgSpec { - enum Type {T_UNKNOWN, T_CHAR, T_BOOL, T_INT, T_DOUBLE, T_STRING, T_VEC_DOUBLE, T_VEC_INT, T_VEC_STRING, T_PTXD2_INT, T_PTXD3_INT, T_PTXD2_DOUBLE, T_PTXD3_DOUBLE, T_BOX2_INT, T_ENUM}; + enum Type {T_UNKNOWN, T_CHAR, T_BOOL, T_INT, T_DOUBLE, T_STRING, T_VEC_DOUBLE, T_VEC_INT, T_VEC_STRING, T_VEC_VEC_STRING, T_PTXD2_INT, T_PTXD3_INT, T_PTXD2_DOUBLE, T_PTXD3_DOUBLE, T_BOX2_INT, T_ENUM}; ArgSpec(bool mandatory=true) : mandatory(mandatory),hasInitValue(false) {} diff --git a/MMVII/vMMVII/inputwidget.cpp b/MMVII/vMMVII/inputwidget.cpp index c013314f33..ef0fcc4e86 100644 --- a/MMVII/vMMVII/inputwidget.cpp +++ b/MMVII/vMMVII/inputwidget.cpp @@ -202,6 +202,39 @@ InputWidget::State InputString::doCheckValue() return State::BAD; } +/*********************************************************************************/ +InputText::InputText(QWidget *parent, QGridLayout *layout, ArgSpec &as) : InputWidget(parent,layout,as) +{ + textEdit = new QTextEdit; + textEdit->setAcceptRichText(false); + addWidget(textEdit,2); + connect(textEdit,&QTextEdit::textChanged,this,[this]() {this->valueEdited(this->textEdit->toPlainText());}); + if (showDebug && as.cppType == ArgSpec::T_UNKNOWN) { + QLabel *l = new QLabel(); + l->setPixmap(style()->standardIcon(QStyle::SP_MessageBoxWarning).pixmap(16,16)); + addWidget(l,3); + } + finish(); +} + +void InputText::doReset() +{ + textEdit->setPlainText(as.def); +} + +void InputText::setInitialValue() +{ + if (as.hasInitValue) + textEdit->setPlainText(as.initValue); +} + +InputWidget::State InputText::doCheckValue() +{ + if (as.value.isEmpty()) + return State::EMPTY; + return State::OK; +} + /*********************************************************************************/ InputFFI::InputFFI(QWidget *parent, QGridLayout *layout, ArgSpec &as) : InputString(parent,layout,as) { @@ -279,9 +312,9 @@ InputFile::InputFile(QWidget *parent, QGridLayout *layout, ArgSpec &as, const MM return; } - if (contains(as.semantic, eTA2007::DirProject)) { + if (contains(as.semantic, {eTA2007::DirProject, eTA2007::FolderAny})) { mode = DIR_MODE; - caption = tr("Select a project directory"); + caption = contains(as.semantic, eTA2007::DirProject) ? tr("Select a project directory") : tr("Select a directory"); pb->setText(tr("Select Dir")); filter = ""; finish(); diff --git a/MMVII/vMMVII/inputwidget.h b/MMVII/vMMVII/inputwidget.h index 499b6db3b4..410459c934 100644 --- a/MMVII/vMMVII/inputwidget.h +++ b/MMVII/vMMVII/inputwidget.h @@ -10,6 +10,7 @@ #include #include #include +#include #include "commandspec.h" #include "spinboxdefault.h" @@ -75,6 +76,17 @@ class InputString: public InputWidget QLineEdit *lineEdit; }; +class InputText: public InputWidget +{ +public: + InputText(QWidget *parent, QGridLayout *layout, ArgSpec &as); +protected: + virtual void doReset() override; + virtual void setInitialValue() override; + State doCheckValue() override; + QTextEdit *textEdit; +}; + class InputFFI: public InputString { public: