Skip to content
Permalink
Browse files

display of STIGCheck contents

  • Loading branch information
squinky86 committed Mar 12, 2020
1 parent f9f9d65 commit 7a29a29daf5c012130461e2ae065c02bbd752aa1
Showing with 102 additions and 27 deletions.
  1. +48 −5 src/stigedit.cpp
  2. +5 −0 src/stigedit.h
  3. +49 −22 src/stigedit.ui
@@ -17,6 +17,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include "stig.h"
#include "stigcheck.h"
#include "stigedit.h"

#include "ui_stigedit.h"
@@ -29,14 +31,15 @@
* Main Constructor
*/
STIGEdit::STIGEdit(STIG &stig, QWidget *parent) : TabViewWidget (parent),
ui(new Ui::STIGEdit)
ui(new Ui::STIGEdit),
_s(stig)
{
ui->setupUi(this);

ui->txtTitle->setText(stig.title);
ui->txtDescription->setText(stig.description);
ui->txtVersion->setText(QString::number(stig.version));
QString tmpRelease = stig.release;
ui->txtTitle->setText(_s.title);
ui->txtDescription->setText(_s.description);
ui->txtVersion->setText(QString::number(_s.version));
QString tmpRelease = _s.release;
if (tmpRelease.contains(QStringLiteral("Release: ")))
{
tmpRelease = tmpRelease.right(tmpRelease.size() - 9);
@@ -52,6 +55,8 @@ STIGEdit::STIGEdit(STIG &stig, QWidget *parent) : TabViewWidget (parent),
QDate d = QDate::fromString(tmpRelease, QStringLiteral("dd MMM yyyy"));
ui->date->setDate(d);
}

UpdateChecks();
}

/**
@@ -92,3 +97,41 @@ TabType STIGEdit::GetTabType()
{
return TabType::stig;
}

/**
* @brief STIGEdit::UpdateChecks
*
* Update the list of STIGChecks
*/
void STIGEdit::UpdateChecks()
{
Q_FOREACH(auto sc, _s.GetSTIGChecks())
{
auto *tmpItem = new QListWidgetItem(); //memory managed by ui->lstChecks container
tmpItem->setData(Qt::UserRole, QVariant::fromValue<STIGCheck>(sc));
tmpItem->setText(PrintSTIGCheck(sc));
ui->lstChecks->addItem(tmpItem);
}
}

/**
* @brief STIGEdit::SelectCheck
*
* A new STIGCheck has been selected
*/
void STIGEdit::SelectCheck()
{
Q_FOREACH(QListWidgetItem *i, ui->lstChecks->selectedItems())
{
auto sc = i->data(Qt::UserRole).value<STIGCheck>();
ui->txtCheckRule->setText(sc.rule);
ui->txtCheckRuleVersion->setText(sc.ruleVersion);
ui->txtCheckTitle->setText(sc.title);
ui->txtDiscussion->setText(sc.vulnDiscussion);
ui->txtFalsePositives->setText(sc.falsePositives);
ui->txtFalseNegatives->setText(sc.falseNegatives);
ui->txtFix->setText(sc.fix);
ui->txtCheck->setText(sc.check);
//set CCI selector
}
}
@@ -43,6 +43,11 @@ class STIGEdit : public TabViewWidget

private:
Ui::STIGEdit *ui;
STIG _s;
void UpdateChecks();

private Q_SLOTS:
void SelectCheck();
};

#endif // STIGEDIT_H
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>438</width>
<height>453</height>
<height>474</height>
</rect>
</property>
<property name="windowTitle">
@@ -112,7 +112,7 @@
<widget class="QWidget" name="layoutWidget_2">
<layout class="QVBoxLayout" name="col2">
<item>
<widget class="QLineEdit" name="lblCheckRule">
<widget class="QLineEdit" name="txtCheckRule">
<property name="toolTip">
<string>Check Rule</string>
</property>
@@ -122,7 +122,14 @@
</widget>
</item>
<item>
<widget class="QLineEdit" name="lblCheckTitle">
<widget class="QLineEdit" name="txtCheckRuleVersion">
<property name="text">
<string>Rule Version</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="txtCheckTitle">
<property name="toolTip">
<string>Check Title</string>
</property>
@@ -198,15 +205,15 @@
<string>STIG Details</string>
</property>
<property name="currentIndex">
<number>2</number>
<number>0</number>
</property>
<widget class="QWidget" name="Discussion">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>150</width>
<height>85</height>
<width>136</width>
<height>81</height>
</rect>
</property>
<attribute name="label">
@@ -229,7 +236,7 @@
<number>2</number>
</property>
<item>
<widget class="QTextEdit" name="lblDiscussion">
<widget class="QTextEdit" name="txtDiscussion">
<property name="readOnly">
<bool>false</bool>
</property>
@@ -251,8 +258,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>150</width>
<height>85</height>
<width>136</width>
<height>81</height>
</rect>
</property>
<attribute name="label">
@@ -275,7 +282,7 @@
<number>2</number>
</property>
<item>
<widget class="QTextEdit" name="lblFalsePositives">
<widget class="QTextEdit" name="txtFalsePositives">
<property name="readOnly">
<bool>false</bool>
</property>
@@ -298,7 +305,7 @@
<x>0</x>
<y>0</y>
<width>136</width>
<height>86</height>
<height>81</height>
</rect>
</property>
<attribute name="label">
@@ -321,7 +328,7 @@
<number>2</number>
</property>
<item>
<widget class="QTextEdit" name="lblFalseNegatives">
<widget class="QTextEdit" name="txtFalseNegatives">
<property name="readOnly">
<bool>false</bool>
</property>
@@ -343,8 +350,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>133</width>
<height>75</height>
<width>136</width>
<height>81</height>
</rect>
</property>
<attribute name="label">
@@ -367,7 +374,7 @@
<number>2</number>
</property>
<item>
<widget class="QTextEdit" name="lblFix">
<widget class="QTextEdit" name="txtFix">
<property name="readOnly">
<bool>false</bool>
</property>
@@ -389,8 +396,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>133</width>
<height>75</height>
<width>136</width>
<height>81</height>
</rect>
</property>
<attribute name="label">
@@ -413,7 +420,7 @@
<number>2</number>
</property>
<item>
<widget class="QTextEdit" name="lblCheck">
<widget class="QTextEdit" name="txtCheck">
<property name="readOnly">
<bool>false</bool>
</property>
@@ -435,8 +442,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>133</width>
<height>75</height>
<width>136</width>
<height>81</height>
</rect>
</property>
<attribute name="label">
@@ -459,7 +466,7 @@
<number>2</number>
</property>
<item>
<widget class="QTextEdit" name="lblCcis">
<widget class="QTextEdit" name="txtCcis">
<property name="readOnly">
<bool>false</bool>
</property>
@@ -523,5 +530,25 @@
</layout>
</widget>
<resources/>
<connections/>
<connections>
<connection>
<sender>lstChecks</sender>
<signal>itemSelectionChanged()</signal>
<receiver>STIGEdit</receiver>
<slot>SelectCheck()</slot>
<hints>
<hint type="sourcelabel">
<x>76</x>
<y>291</y>
</hint>
<hint type="destinationlabel">
<x>218</x>
<y>236</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>SelectCheck()</slot>
</slots>
</ui>

0 comments on commit 7a29a29

Please sign in to comment.
You can’t perform that action at this time.