WSL/SLF GitLab Repository
Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
snow-models
inishell
Commits
5163e460
Commit
5163e460
authored
Feb 01, 2021
by
Michael Reisecker
Browse files
Fix insert missing keys in Preview Editor
parent
c7066cf1
Changes
4
Hide whitespace changes
Inline
Side-by-side
CHANGELOG.md
View file @
5163e460
...
...
@@ -38,6 +38,7 @@ Releases of the INIshell project will be documented in this file.
-
Fixed unit test
-
Transportation of unknown keys to preview and output
-
Example simulation paths with new working directory field
-
Insert missing and mandatory keys in Preview Editor
-
Several minor bugs
### Framework
...
...
src/gui/PreviewWindow.cc
View file @
5163e460
...
...
@@ -846,7 +846,7 @@ void PreviewWindow::insertText(const insert_text &mode)
}
INIParser
gui_ini
(
getMainWindow
()
->
getLogger
());
getMainWindow
()
->
getControlPanel
()
->
getSectionTab
()
->
setIniValuesFromGui
(
&
gui_ini
);
getMainWindow
()
->
getControlPanel
()
->
getSectionTab
()
->
setIniValuesFromGui
(
&
gui_ini
,
true
);
int
counter
=
0
;
for
(
auto
&
sec
:
*
gui_ini
.
getSections
())
{
for
(
auto
&
keyval
:
sec
.
getKeyValueList
())
{
...
...
@@ -854,12 +854,11 @@ void PreviewWindow::insertText(const insert_text &mode)
if
((
mode
==
MISSING
)
||
(
mode
==
MISSING_MANDATORY
&&
keyval
.
second
.
isMandatory
()))
{
QString
value
(
keyval
.
second
.
getValue
()
);
preview_ini_
.
set
(
sec
.
getName
(),
keyval
.
first
,
value
.
isEmpty
()
?
"MISSING"
:
value
);
preview_ini_
.
set
(
sec
.
getName
(),
keyval
.
first
,
value
);
counter
++
;
}
}
}
}
//endfor keyval
}
previewStatus
(
tr
(
"Inserted %1 keys"
).
arg
(
counter
));
}
...
...
src/gui/SectionTab.cc
View file @
5163e460
...
...
@@ -132,7 +132,7 @@ ScrollPanel * SectionTab::getSectionScrollArea(const int &index)
* @param[in] ini The INIParser for which to set the values (the one that will be output).
* @return A comma-separated list of missing mandatory INI keys.
*/
QString
SectionTab
::
setIniValuesFromGui
(
INIParser
*
ini
)
QString
SectionTab
::
setIniValuesFromGui
(
INIParser
*
ini
,
const
bool
&
insert_missing
)
{
//TODO: For some combination of properties (optional, will be defaulted by the
//software, ...) we may be able to skip output of some keys to avoid
...
...
@@ -149,7 +149,7 @@ QString SectionTab::setIniValuesFromGui(INIParser *ini)
if
(
!
panel
->
isVisibleTo
(
section_tab
))
//visible if section_tab was visible?
continue
;
QString
section
,
key
;
const
QString
value
(
panel
->
getIniValue
(
section
,
key
)
);
QString
value
(
panel
->
getIniValue
(
section
,
key
)
);
if
(
panel
->
property
(
"no_ini"
).
toBool
())
continue
;
if
(
key
.
isNull
())
//GUI element that is not an interactive panel
...
...
@@ -174,6 +174,10 @@ QString SectionTab::setIniValuesFromGui(INIParser *ini)
if
(
!
is_dynamic_widget
||
dyn_is_empty
)
//a dynamic panel is only missing if it's empty
missing
+=
section
+
"::"
+
key
+
",
\n
"
;
}
if
(
insert_missing
)
{
//this is used by the Preview Editor to insert missing values / get a full list
if
(
value
.
isEmpty
())
value
=
"#N/A"
;
}
if
(
!
value
.
isEmpty
())
ini
->
set
(
section
,
key
,
value
,
is_mandatory
);
}
//endfor panel_list
...
...
src/gui/SectionTab.h
View file @
5163e460
...
...
@@ -59,7 +59,7 @@ class SectionTab : public QTabWidget {
ScrollPanel
*
getSectionScrollArea
(
const
QString
&
section
,
const
QString
&
background_color
=
QString
(),
const
QString
&
color
=
"normal"
,
const
bool
&
no_create
=
false
,
const
int
&
insert_idx
=
-
1
);
ScrollPanel
*
getSectionScrollArea
(
const
int
&
index
);
QString
setIniValuesFromGui
(
INIParser
*
ini
);
QString
setIniValuesFromGui
(
INIParser
*
ini
,
const
bool
&
insert_missing
=
false
);
void
setSectionDynamic
(
const
QString
&
section
,
const
QDomNode
&
node
);
//register section as dynamic
bool
isDynamicParent
(
const
QString
&
section
)
const
;
int
isDynamicChild
(
const
QString
&
section
)
const
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment