Skip to content

Commit

Permalink
Update code consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
squinky86 committed Feb 11, 2020
1 parent 5fef595 commit 5fc34ae
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
12 changes: 6 additions & 6 deletions src/assetview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ void AssetView::UpdateSTIGCheck(const STIGCheck &stigCheck)
ui->lblFix->setText(stigCheck.fix);
ui->lblCheck->setText(stigCheck.check);
QString ccis(QStringLiteral("Relevant CCI(s):\n"));
foreach (auto cci, stigCheck.GetCCIs())
Q_FOREACH (auto cci, stigCheck.GetCCIs())
{
ccis.append(PrintCCI(cci) + QStringLiteral(": ") + cci.definition + QStringLiteral("\n"));
}
Expand Down Expand Up @@ -415,13 +415,13 @@ void AssetView::RunTests()

//step 6: update asset
std::cout << "\t\tTest " << onTest++ << ": Change Asset" << std::endl;
ui->txtFQDN->setText("test.example.org");
ui->txtIP->setText("127.0.0.1");
ui->txtMAC->setText("00:00:00:00:00:00");
ui->txtFQDN->setText(QStringLiteral("test.example.org"));
ui->txtIP->setText(QStringLiteral("127.0.0.1"));
ui->txtMAC->setText(QStringLiteral("00:00:00:00:00:00"));

//step 7: save CKL
std::cout << "\t\tSaving CKL" << std::endl;
SaveCKL("tests/monolithic.ckl");
SaveCKL(QStringLiteral("tests/monolithic.ckl"));
ProcEvents();

//step 8: Count Checks
Expand All @@ -430,7 +430,7 @@ void AssetView::RunTests()

//step 9: import XCCDF
std::cout << "\t\tTest " << onTest++ << ": Importing XCCDF" << std::endl;
ImportXCCDF("tests/xccdf_lol.xml");
ImportXCCDF(QStringLiteral("tests/xccdf_lol.xml"));

ProcEvents();

Expand Down
6 changes: 3 additions & 3 deletions src/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ bool DownloadFile(const QUrl &url, QFile *file)
{
//log HTTP headers, STIG Rule SV-83997r1_rule
//log IP address, STIG Rule SV-84045r1_rule
Warning("Downloading File", "Downloading " + url.toString() + " (ip address " + addresses.first().toString() + ") with header User-Agent: " + userAgent, true);
Warning(QStringLiteral("Downloading File"), "Downloading " + url.toString() + " (ip address " + addresses.first().toString() + ") with header User-Agent: " + userAgent, true);

//clean up the socket event when the response is finished reading
QNetworkReply *response = manager.get(req);
Expand Down Expand Up @@ -214,7 +214,7 @@ QString DownloadPage(const QUrl &url)
{
//log HTTP headers, STIG Rule SV-83997r1_rule
//log IP address, STIG Rule SV-84045r1_rule
Warning("Downloading Page", "Downloading " + url.toString() + " (ip address " + addresses.first().toString() + ") with header User-Agent: " + userAgent, true);
Warning(QStringLiteral("Downloading Page"), "Downloading " + url.toString() + " (ip address " + addresses.first().toString() + ") with header User-Agent: " + userAgent, true);

//send request and get response
QNetworkReply *response = manager.get(req);
Expand Down Expand Up @@ -428,7 +428,7 @@ QString TrimFileName(const QString &fileName)
void Warning(const QString &title, const QString &message, const bool quiet, const int level)
{
DbManager db;
db.Log(level, "", title + ": " + message);
db.Log(level, QString(), title + ": " + message);
if (!IgnoreWarnings && !quiet && (QThread::currentThread() == QApplication::instance()->thread())) //make sure we're in the GUI thread before popping a message box
{
int ret = QMessageBox::warning(nullptr, title, message, QMessageBox::Ignore | QMessageBox::Ok);
Expand Down
6 changes: 3 additions & 3 deletions src/dbmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1085,7 +1085,7 @@ QList<CCI> DbManager::GetCCIs(QVector<int> ccis)
*/
QList<CCI> DbManager::GetCCIs(const Control &c)
{
return GetCCIs("WHERE ControlId = :id", {std::make_tuple<QString, QVariant>(QStringLiteral(":id"), c.id)});
return GetCCIs(QStringLiteral("WHERE ControlId = :id"), {std::make_tuple<QString, QVariant>(QStringLiteral(":id"), c.id)});
}

/**
Expand Down Expand Up @@ -1366,7 +1366,7 @@ QList<CKLCheck> DbManager::GetCKLChecks(const Asset &asset, const STIG *stig)
*/
QList<CKLCheck> DbManager::GetCKLChecks(const CCI &cci)
{
return GetCKLChecks("WHERE STIGCheckId IN (SELECT STIGCheckId FROM STIGCheckCCI WHERE CCIId = :CCIId)", {std::make_tuple<QString, QVariant>(":CCIId", cci.id)});
return GetCKLChecks(QStringLiteral("WHERE STIGCheckId IN (SELECT STIGCheckId FROM STIGCheckCCI WHERE CCIId = :CCIId)"), {std::make_tuple<QString, QVariant>(":CCIId", cci.id)});
}

/**
Expand Down Expand Up @@ -1531,7 +1531,7 @@ QList<STIGCheck> DbManager::GetSTIGChecks(const STIG &stig)
*/
QList<STIGCheck> DbManager::GetSTIGChecks(const CCI &cci)
{
return GetSTIGChecks("WHERE id IN (SELECT STIGCheckId FROM STIGCheckCCI WHERE CCIId = :CCIId)", {std::make_tuple<QString, QVariant>(QStringLiteral(":CCIId"), cci.id)});
return GetSTIGChecks(QStringLiteral("WHERE id IN (SELECT STIGCheckId FROM STIGCheckCCI WHERE CCIId = :CCIId)"), {std::make_tuple<QString, QVariant>(QStringLiteral(":CCIId"), cci.id)});
}

/**
Expand Down
14 changes: 7 additions & 7 deletions src/dbmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,29 +66,29 @@ class DbManager
Asset GetAsset(int id);
Asset GetAsset(const QString &hostName);
Asset GetAsset(const Asset &asset);
QList<Asset> GetAssets(const QString &whereClause = "", const QList<std::tuple<QString, QVariant>> &variables = {});
QList<Asset> GetAssets(const QString &whereClause = QString(), const QList<std::tuple<QString, QVariant>> &variables = {});
QList<Asset> GetAssets(const STIG &stig);
CCI GetCCI(int id);
CCI GetCCI(const CCI &cci, const STIG *stig = nullptr);
QList<CCI> GetCCIs(QVector<int> ccis);
QList<CCI> GetCCIs(const Control &c);
QList<CCI> GetCCIs(int STIGCheckId);
CCI GetCCIByCCI(int cci, const STIG *stig = nullptr);
QList<CCI> GetCCIs(const QString &whereClause = "", const QList<std::tuple<QString, QVariant>> &variables = {});
QList<CCI> GetCCIs(const QString &whereClause = QString(), const QList<std::tuple<QString, QVariant>> &variables = {});
CKLCheck GetCKLCheck(int id);
CKLCheck GetCKLCheck(const CKLCheck &ckl);
CKLCheck GetCKLCheckByDISAId(int assetId, const QString &disaId);
QList<CKLCheck> GetCKLChecks(const Asset &asset, const STIG *stig = nullptr);
QList<CKLCheck> GetCKLChecks(const CCI &cci);
QList<CKLCheck> GetCKLChecks(const QString &whereClause = "", const QList<std::tuple<QString, QVariant>> &variables = {});
QList<CKLCheck> GetCKLChecks(const QString &whereClause = QString(), const QList<std::tuple<QString, QVariant>> &variables = {});
Control GetControl(int id);
Control GetControl(const QString &control);
QList<Control> GetControls(const QString &whereClause = "", const QList<std::tuple<QString, QVariant>> &variables = {});
QList<Control> GetControls(const QString &whereClause = QString(), const QList<std::tuple<QString, QVariant>> &variables = {});
QString GetDBPath();
Family GetFamily(const QString &acronym);
Family GetFamily(int id);
int GetLogLevel();
QList<Family> GetFamilies(const QString &whereClause = "", const QList<std::tuple<QString, QVariant>> &variables = {});
QList<Family> GetFamilies(const QString &whereClause = QString(), const QList<std::tuple<QString, QVariant>> &variables = {});
STIG GetSTIG(int id);
STIG GetSTIG(const QString &title, int version, const QString &release);
STIG GetSTIG(const STIG &stig);
Expand All @@ -97,9 +97,9 @@ class DbManager
STIGCheck GetSTIGCheck(const STIGCheck &stigcheck);
QList<STIGCheck> GetSTIGChecks(const STIG &stig);
QList<STIGCheck> GetSTIGChecks(const CCI &cci);
QList<STIGCheck> GetSTIGChecks(const QString &whereClause = "", const QList<std::tuple<QString, QVariant>> &variables = {});
QList<STIGCheck> GetSTIGChecks(const QString &whereClause = QString(), const QList<std::tuple<QString, QVariant>> &variables = {});
QList<STIG> GetSTIGs(const Asset &asset);
QList<STIG> GetSTIGs(const QString &whereClause = "", const QList<std::tuple<QString, QVariant> > &variables = {});
QList<STIG> GetSTIGs(const QString &whereClause = QString(), const QList<std::tuple<QString, QVariant> > &variables = {});
QString GetVariable(const QString &name);

bool IsEmassImport();
Expand Down
2 changes: 1 addition & 1 deletion src/help.ui
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ copied and put under another distribution licence&lt;br /&gt;
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>&lt;html&gt;&lt;head /&gt;&lt;hr /&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;h1&gt;libxlsxwriter&lt;/h1&gt;&lt;/p&gt;&lt;p&gt;Copyright 2014-2019, John McNamara &amp;lt;jmcnamara@cpan.org&amp;gt;&lt;br /&gt;All rights reserved.&lt;/p&gt;
<string>&lt;html&gt;&lt;head /&gt;&lt;hr /&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;h1&gt;libxlsxwriter&lt;/h1&gt;&lt;/p&gt;&lt;p&gt;Copyright 2014-2020, John McNamara &amp;lt;jmcnamara@cpan.org&amp;gt;&lt;br /&gt;All rights reserved.&lt;/p&gt;
&lt;p&gt;Libxlsxwriter is licensed under a FreeBSD license and is available from &lt;a href=&quot;http://libxlsxwriter.github.io/&quot;&gt;libxlsxwriter.github.io&lt;/a&gt;.&lt;/p&gt;
&lt;/body&gt;&lt;/html&gt;</string>
</property>
Expand Down

0 comments on commit 5fc34ae

Please sign in to comment.