Skip to content

Commit

Permalink
MMVII: update vMMVII with new argument semantics
Browse files Browse the repository at this point in the history
  • Loading branch information
meynardc committed Jun 21, 2024
1 parent 558603e commit f21cc14
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 6 deletions.
4 changes: 2 additions & 2 deletions MMVII/src/Appli/cMMVII_Appli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions MMVII/src/Appli/cMMVII_GenArgsSpec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ static const std::vector<eTA2007> prjSubDirList = // c
eTA2007::MulTieP,
eTA2007::RigBlock,
eTA2007::SysCo,
eTA2007::Topo,
eTA2007::Clino,
};

static const std::map<eTA2007,std::vector<std::string>> fileList = // clazy:exclude=non-pod-global-static
Expand All @@ -29,6 +31,9 @@ static const std::map<eTA2007,std::vector<std::string>> fileList = // c
{eTA2007::FileCloud,{".ply"}},
{eTA2007::File3DRegion,{".*"}},
{eTA2007::XmlOfTopTag,{".xml",".json"}},
{eTA2007::FileTagged,{".xml",".json"}},
{eTA2007::FileAny,{"*"}},
{eTA2007::FileTxt,{"*"}},
};

} // namespace GenArgsInternal
Expand Down
4 changes: 3 additions & 1 deletion MMVII/vMMVII/cmdconfigurewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 2 additions & 0 deletions MMVII/vMMVII/commandspec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const std::map<eTA2007::Enum,QString> eTA2007::enumMap=
{eTA2007::DirProject,"DP"},
{eTA2007::FileDirProj,"FDP"},
{eTA2007::MPatFile,"MPF"},
{eTA2007::FolderAny,"FolderAny"},
{eTA2007::Input,"In"},
{eTA2007::Output,"Out"},
{eTA2007::OptionalExist,"OptEx"},
Expand Down Expand Up @@ -59,6 +60,7 @@ static void typeNameToEnum(ArgSpec& as, const QString& command)
{"std::vector<int>",ArgSpec::T_VEC_INT},
{"std::vector<double>",ArgSpec::T_VEC_DOUBLE},
{"std::vector<std::string>",ArgSpec::T_VEC_STRING},
{"std::vector<std::vector<std::string>>",ArgSpec::T_VEC_VEC_STRING},
{"cPtxd<int,2>",ArgSpec::T_PTXD2_INT},
{"cPtxd<int,3>",ArgSpec::T_PTXD3_INT},
{"cPtxd<double,2>",ArgSpec::T_PTXD2_DOUBLE},
Expand Down
3 changes: 2 additions & 1 deletion MMVII/vMMVII/commandspec.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {}
Expand Down
37 changes: 35 additions & 2 deletions MMVII/vMMVII/inputwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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();
Expand Down
12 changes: 12 additions & 0 deletions MMVII/vMMVII/inputwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <QCheckBox>
#include <QLabel>
#include <QPushButton>
#include <QTextEdit>
#include "commandspec.h"
#include "spinboxdefault.h"

Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit f21cc14

Please sign in to comment.