Use A Common Base Class for Dialogs (#142)
Co-authored-by: Chris Rizzitello <crizzitello@ics.com>main
parent
885cad6ea7
commit
6604901c5f
|
@ -1,6 +1,7 @@
|
||||||
|
|
||||||
add_library (FORMS STATIC
|
add_library (FORMS STATIC
|
||||||
add_operation/createoperation.cpp add_operation/createoperation.h
|
add_operation/createoperation.cpp add_operation/createoperation.h
|
||||||
|
ashirtdialog/ashirtdialog.cpp ashirtdialog/ashirtdialog.h
|
||||||
credits/credits.cpp credits/credits.h
|
credits/credits.cpp credits/credits.h
|
||||||
evidence/evidencemanager.cpp evidence/evidencemanager.h
|
evidence/evidencemanager.cpp evidence/evidencemanager.h
|
||||||
evidence_filter/evidencefilter.cpp evidence_filter/evidencefilter.h
|
evidence_filter/evidencefilter.cpp evidence_filter/evidencefilter.h
|
||||||
|
|
|
@ -7,13 +7,14 @@
|
||||||
#include "dtos/ashirt_error.h"
|
#include "dtos/ashirt_error.h"
|
||||||
#include "appsettings.h"
|
#include "appsettings.h"
|
||||||
|
|
||||||
CreateOperation::CreateOperation(QWidget* parent) : QDialog(parent) {
|
CreateOperation::CreateOperation(QWidget* parent)
|
||||||
|
: AShirtDialog(parent, AShirtDialog::commonWindowFlags)
|
||||||
|
{
|
||||||
buildUi();
|
buildUi();
|
||||||
wireUi();
|
wireUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
CreateOperation::~CreateOperation() {
|
CreateOperation::~CreateOperation() {
|
||||||
delete closeWindowAction;
|
|
||||||
delete submitButton;
|
delete submitButton;
|
||||||
delete _operationLabel;
|
delete _operationLabel;
|
||||||
delete responseLabel;
|
delete responseLabel;
|
||||||
|
@ -55,18 +56,9 @@ void CreateOperation::buildUi() {
|
||||||
// row 2
|
// row 2
|
||||||
gridLayout->addWidget(submitButton, 2, 2);
|
gridLayout->addWidget(submitButton, 2, 2);
|
||||||
|
|
||||||
closeWindowAction = new QAction(this);
|
|
||||||
closeWindowAction->setShortcut(QKeySequence::Close);
|
|
||||||
this->addAction(closeWindowAction);
|
|
||||||
|
|
||||||
this->setLayout(gridLayout);
|
this->setLayout(gridLayout);
|
||||||
this->resize(400, 1);
|
this->resize(400, 1);
|
||||||
this->setWindowTitle(tr("Create Operation"));
|
this->setWindowTitle(tr("Create Operation"));
|
||||||
|
|
||||||
Qt::WindowFlags flags = this->windowFlags();
|
|
||||||
flags |= Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint | Qt::WindowMinMaxButtonsHint |
|
|
||||||
Qt::WindowCloseButtonHint;
|
|
||||||
this->setWindowFlags(flags);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateOperation::wireUi() {
|
void CreateOperation::wireUi() {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QAction>
|
#include "ashirtdialog/ashirtdialog.h"
|
||||||
#include <QDialog>
|
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
#include "components/loading_button/loadingbutton.h"
|
#include "components/loading_button/loadingbutton.h"
|
||||||
|
|
||||||
class CreateOperation : public QDialog {
|
class CreateOperation : public AShirtDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -35,7 +35,6 @@ class CreateOperation : public QDialog {
|
||||||
|
|
||||||
// ui elements
|
// ui elements
|
||||||
QGridLayout* gridLayout = nullptr;
|
QGridLayout* gridLayout = nullptr;
|
||||||
QAction* closeWindowAction = nullptr;
|
|
||||||
LoadingButton* submitButton = nullptr;
|
LoadingButton* submitButton = nullptr;
|
||||||
QLabel* _operationLabel = nullptr;
|
QLabel* _operationLabel = nullptr;
|
||||||
QLabel* responseLabel = nullptr;
|
QLabel* responseLabel = nullptr;
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
#include "ashirtdialog.h"
|
||||||
|
#include <QKeySequence>
|
||||||
|
|
||||||
|
AShirtDialog::AShirtDialog(QWidget *parent, Qt::WindowFlags windowFlags) : QDialog(parent, windowFlags)
|
||||||
|
{
|
||||||
|
addAction(QString(), QKeySequence::Close, this, &AShirtDialog::close);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AShirtDialog::show()
|
||||||
|
{
|
||||||
|
QDialog::show(); // display the window
|
||||||
|
raise(); // bring to the top (mac)
|
||||||
|
activateWindow(); // alternate bring to the top (windows)
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The AShirtDialog class represents a base class used for all dialogs.
|
||||||
|
*/
|
||||||
|
class AShirtDialog : public QDialog {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
///Create a AShirtDialog.
|
||||||
|
AShirtDialog(QWidget* parent = nullptr, Qt::WindowFlags windowFlags = Qt::WindowFlags());
|
||||||
|
|
||||||
|
/// show Overridden Show forces window to top
|
||||||
|
void show();
|
||||||
|
|
||||||
|
///Commonly used windowFlags
|
||||||
|
inline static const Qt::WindowFlags commonWindowFlags =
|
||||||
|
Qt::WindowFlags()
|
||||||
|
| Qt::CustomizeWindowHint
|
||||||
|
| Qt::WindowStaysOnTopHint
|
||||||
|
| Qt::WindowMinMaxButtonsHint
|
||||||
|
| Qt::WindowCloseButtonHint;
|
||||||
|
};
|
|
@ -105,7 +105,9 @@ static std::string normalBodyMarkdown() {
|
||||||
// clang-format on
|
// clang-format on
|
||||||
}
|
}
|
||||||
|
|
||||||
Credits::Credits(QWidget* parent) : QDialog(parent) {
|
Credits::Credits(QWidget* parent)
|
||||||
|
: AShirtDialog(parent, AShirtDialog::commonWindowFlags)
|
||||||
|
{
|
||||||
buildUi();
|
buildUi();
|
||||||
wireUi();
|
wireUi();
|
||||||
}
|
}
|
||||||
|
@ -158,29 +160,17 @@ void Credits::buildUi() {
|
||||||
// row 2
|
// row 2
|
||||||
gridLayout->addWidget(buttonBox, 2, 0);
|
gridLayout->addWidget(buttonBox, 2, 0);
|
||||||
|
|
||||||
closeWindowAction = new QAction(this);
|
|
||||||
closeWindowAction->setShortcut(QKeySequence::Close);
|
|
||||||
this->addAction(closeWindowAction);
|
|
||||||
|
|
||||||
this->setLayout(gridLayout);
|
this->setLayout(gridLayout);
|
||||||
this->resize(640, 500);
|
this->resize(640, 500);
|
||||||
this->setWindowTitle("About");
|
this->setWindowTitle("About");
|
||||||
|
|
||||||
// Make the dialog pop up above any other windows but retain title bar and buttons
|
|
||||||
Qt::WindowFlags flags = this->windowFlags();
|
|
||||||
flags |= Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint | Qt::WindowMinMaxButtonsHint |
|
|
||||||
Qt::WindowCloseButtonHint;
|
|
||||||
this->setWindowFlags(flags);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Credits::wireUi() {
|
void Credits::wireUi() {
|
||||||
connect(closeWindowAction, &QAction::triggered, this, &QDialog::close);
|
|
||||||
connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::close);
|
connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::close);
|
||||||
connect(&NetMan::getInstance(), &NetMan::releasesChecked, this, &Credits::onReleasesUpdate);
|
connect(&NetMan::getInstance(), &NetMan::releasesChecked, this, &Credits::onReleasesUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
Credits::~Credits() {
|
Credits::~Credits() {
|
||||||
delete closeWindowAction;
|
|
||||||
delete updateLabel;
|
delete updateLabel;
|
||||||
delete creditsArea;
|
delete creditsArea;
|
||||||
delete buttonBox;
|
delete buttonBox;
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QAction>
|
#include "ashirtdialog/ashirtdialog.h"
|
||||||
#include <QDialog>
|
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QTextBrowser>
|
#include <QTextBrowser>
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
#include "dtos/github_release.h"
|
#include "dtos/github_release.h"
|
||||||
|
|
||||||
class Credits : public QDialog {
|
class Credits : public AShirtDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -32,8 +32,6 @@ class Credits : public QDialog {
|
||||||
void updateRelease();
|
void updateRelease();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QAction* closeWindowAction = nullptr;
|
|
||||||
|
|
||||||
// UI Components
|
// UI Components
|
||||||
QGridLayout* gridLayout = nullptr;
|
QGridLayout* gridLayout = nullptr;
|
||||||
QTextBrowser* creditsArea = nullptr;
|
QTextBrowser* creditsArea = nullptr;
|
||||||
|
|
|
@ -48,7 +48,9 @@ static QStringList columnNames() {
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
|
||||||
EvidenceManager::EvidenceManager(DatabaseConnection* db, QWidget* parent) : QDialog(parent) {
|
EvidenceManager::EvidenceManager(DatabaseConnection* db, QWidget* parent)
|
||||||
|
: AShirtDialog(parent)
|
||||||
|
{
|
||||||
this->db = db;
|
this->db = db;
|
||||||
buildUi();
|
buildUi();
|
||||||
wireUi();
|
wireUi();
|
||||||
|
@ -59,7 +61,6 @@ EvidenceManager::~EvidenceManager() {
|
||||||
delete deleteEvidenceAction;
|
delete deleteEvidenceAction;
|
||||||
delete copyPathToClipboardAction;
|
delete copyPathToClipboardAction;
|
||||||
delete deleteTableContentsAction;
|
delete deleteTableContentsAction;
|
||||||
delete closeWindowAction;
|
|
||||||
delete evidenceTableContextMenu;
|
delete evidenceTableContextMenu;
|
||||||
delete filterForm;
|
delete filterForm;
|
||||||
delete evidenceEditor;
|
delete evidenceEditor;
|
||||||
|
@ -174,10 +175,6 @@ void EvidenceManager::buildUi() {
|
||||||
gridLayout->addWidget(cancelEditButton, 3, 2);
|
gridLayout->addWidget(cancelEditButton, 3, 2);
|
||||||
gridLayout->addWidget(editButton, 3, 3);
|
gridLayout->addWidget(editButton, 3, 3);
|
||||||
|
|
||||||
closeWindowAction = new QAction(this);
|
|
||||||
closeWindowAction->setShortcut(QKeySequence::Close);
|
|
||||||
this->addAction(closeWindowAction);
|
|
||||||
|
|
||||||
this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding);
|
this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding);
|
||||||
this->resize(800, 600);
|
this->resize(800, 600);
|
||||||
this->setWindowTitle(tr("Evidence Manager"));
|
this->setWindowTitle(tr("Evidence Manager"));
|
||||||
|
@ -197,7 +194,6 @@ void EvidenceManager::wireUi() {
|
||||||
|
|
||||||
connect(submitEvidenceAction, actionTriggered, this, &EvidenceManager::submitEvidenceTriggered);
|
connect(submitEvidenceAction, actionTriggered, this, &EvidenceManager::submitEvidenceTriggered);
|
||||||
connect(deleteEvidenceAction, actionTriggered, this, &EvidenceManager::deleteEvidenceTriggered);
|
connect(deleteEvidenceAction, actionTriggered, this, &EvidenceManager::deleteEvidenceTriggered);
|
||||||
connect(closeWindowAction, actionTriggered, this, &EvidenceManager::close);
|
|
||||||
connect(copyPathToClipboardAction, actionTriggered, this, &EvidenceManager::copyPathTriggered);
|
connect(copyPathToClipboardAction, actionTriggered, this, &EvidenceManager::copyPathTriggered);
|
||||||
connect(deleteTableContentsAction, actionTriggered, this, &EvidenceManager::deleteAllTriggered);
|
connect(deleteTableContentsAction, actionTriggered, this, &EvidenceManager::deleteAllTriggered);
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,9 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "ashirtdialog/ashirtdialog.h"
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QDialog>
|
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
|
@ -34,7 +35,7 @@ struct EvidenceRow {
|
||||||
* @brief The EvidenceManager class represents the Evidence Manager window that is shown
|
* @brief The EvidenceManager class represents the Evidence Manager window that is shown
|
||||||
* when selecting "View Accumulated Evidence."
|
* when selecting "View Accumulated Evidence."
|
||||||
*/
|
*/
|
||||||
class EvidenceManager : public QDialog {
|
class EvidenceManager : public AShirtDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -126,7 +127,6 @@ class EvidenceManager : public QDialog {
|
||||||
|
|
||||||
QAction* submitEvidenceAction = nullptr;
|
QAction* submitEvidenceAction = nullptr;
|
||||||
QAction* deleteEvidenceAction = nullptr;
|
QAction* deleteEvidenceAction = nullptr;
|
||||||
QAction* closeWindowAction = nullptr;
|
|
||||||
QAction* copyPathToClipboardAction = nullptr;
|
QAction* copyPathToClipboardAction = nullptr;
|
||||||
QAction* deleteTableContentsAction = nullptr;
|
QAction* deleteTableContentsAction = nullptr;
|
||||||
|
|
||||||
|
|
|
@ -24,14 +24,12 @@ static void initializeDateEdit(QDateEdit *dateEdit) {
|
||||||
}
|
}
|
||||||
|
|
||||||
EvidenceFilterForm::EvidenceFilterForm(QWidget *parent)
|
EvidenceFilterForm::EvidenceFilterForm(QWidget *parent)
|
||||||
: QDialog(parent) {
|
: AShirtDialog(parent) {
|
||||||
buildUi();
|
buildUi();
|
||||||
wireUi();
|
wireUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
EvidenceFilterForm::~EvidenceFilterForm() {
|
EvidenceFilterForm::~EvidenceFilterForm() {
|
||||||
delete closeWindowAction;
|
|
||||||
|
|
||||||
delete _operationLabel;
|
delete _operationLabel;
|
||||||
delete _contentTypeLabel;
|
delete _contentTypeLabel;
|
||||||
delete _hadErrorLabel;
|
delete _hadErrorLabel;
|
||||||
|
@ -140,10 +138,6 @@ void EvidenceFilterForm::buildUi() {
|
||||||
// row 6
|
// row 6
|
||||||
gridLayout->addWidget(buttonBox, 6, 0, 1, gridLayout->columnCount());
|
gridLayout->addWidget(buttonBox, 6, 0, 1, gridLayout->columnCount());
|
||||||
|
|
||||||
closeWindowAction = new QAction(this);
|
|
||||||
closeWindowAction->setShortcut(QKeySequence::Close);
|
|
||||||
this->addAction(closeWindowAction);
|
|
||||||
|
|
||||||
this->setLayout(gridLayout);
|
this->setLayout(gridLayout);
|
||||||
this->setWindowTitle(tr("Evidence Filters"));
|
this->setWindowTitle(tr("Evidence Filters"));
|
||||||
this->resize(320, 245);
|
this->resize(320, 245);
|
||||||
|
@ -163,8 +157,6 @@ void EvidenceFilterForm::wireUi() {
|
||||||
[this](bool checked) { fromDateEdit->setEnabled(checked); });
|
[this](bool checked) { fromDateEdit->setEnabled(checked); });
|
||||||
connect(includeEndDateCheckBox, &QCheckBox::stateChanged, this,
|
connect(includeEndDateCheckBox, &QCheckBox::stateChanged, this,
|
||||||
[this](bool checked) { toDateEdit->setEnabled(checked); });
|
[this](bool checked) { toDateEdit->setEnabled(checked); });
|
||||||
|
|
||||||
connect(closeWindowAction, &QAction::triggered, this, &EvidenceFilterForm::writeAndClose);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EvidenceFilterForm::writeAndClose() {
|
void EvidenceFilterForm::writeAndClose() {
|
||||||
|
|
|
@ -3,9 +3,8 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QComboBox>
|
#include "ashirtdialog/ashirtdialog.h"
|
||||||
#include <QDialog>
|
|
||||||
#include <QAction>
|
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
|
@ -16,7 +15,7 @@
|
||||||
#include "db/databaseconnection.h"
|
#include "db/databaseconnection.h"
|
||||||
#include "dtos/operation.h"
|
#include "dtos/operation.h"
|
||||||
|
|
||||||
class EvidenceFilterForm : public QDialog {
|
class EvidenceFilterForm : public AShirtDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -49,8 +48,6 @@ class EvidenceFilterForm : public QDialog {
|
||||||
EvidenceFilters encodeForm();
|
EvidenceFilters encodeForm();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QAction* closeWindowAction = nullptr;
|
|
||||||
|
|
||||||
// UI Components
|
// UI Components
|
||||||
QGridLayout* gridLayout = nullptr;
|
QGridLayout* gridLayout = nullptr;
|
||||||
QLabel* _operationLabel = nullptr;
|
QLabel* _operationLabel = nullptr;
|
||||||
|
|
|
@ -13,10 +13,10 @@
|
||||||
#include "helpers/ui_helpers.h"
|
#include "helpers/ui_helpers.h"
|
||||||
|
|
||||||
GetInfo::GetInfo(DatabaseConnection* db, qint64 evidenceID, QWidget* parent)
|
GetInfo::GetInfo(DatabaseConnection* db, qint64 evidenceID, QWidget* parent)
|
||||||
: QDialog(parent), db(db), evidenceID(evidenceID) {
|
: AShirtDialog(parent, AShirtDialog::commonWindowFlags)
|
||||||
this->db = db;
|
, db(db)
|
||||||
this->evidenceID = evidenceID;
|
, evidenceID(evidenceID)
|
||||||
|
{
|
||||||
buildUi();
|
buildUi();
|
||||||
wireUi();
|
wireUi();
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,6 @@ GetInfo::~GetInfo() {
|
||||||
delete evidenceEditor;
|
delete evidenceEditor;
|
||||||
delete submitButton;
|
delete submitButton;
|
||||||
delete deleteButton;
|
delete deleteButton;
|
||||||
delete closeWindowAction;
|
|
||||||
|
|
||||||
delete gridLayout;
|
delete gridLayout;
|
||||||
stopReply(&uploadAssetReply);
|
stopReply(&uploadAssetReply);
|
||||||
|
@ -62,27 +61,17 @@ void GetInfo::buildUi() {
|
||||||
gridLayout->addWidget(deleteButton, 1, 0);
|
gridLayout->addWidget(deleteButton, 1, 0);
|
||||||
gridLayout->addWidget(submitButton, 1, 2);
|
gridLayout->addWidget(submitButton, 1, 2);
|
||||||
|
|
||||||
closeWindowAction = new QAction(this);
|
|
||||||
closeWindowAction->setShortcut(QKeySequence::Close);
|
|
||||||
this->addAction(closeWindowAction);
|
|
||||||
|
|
||||||
this->setLayout(gridLayout);
|
this->setLayout(gridLayout);
|
||||||
this->setAttribute(Qt::WA_DeleteOnClose);
|
this->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
this->resize(720, 480);
|
this->resize(720, 480);
|
||||||
this->setWindowTitle(tr("Add Evidence Details"));
|
this->setWindowTitle(tr("Add Evidence Details"));
|
||||||
|
|
||||||
// Make the dialog pop up above any other windows but retain title bar and buttons
|
|
||||||
Qt::WindowFlags flags = this->windowFlags();
|
|
||||||
flags |= Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint | Qt::WindowMinMaxButtonsHint |
|
|
||||||
Qt::WindowCloseButtonHint;
|
|
||||||
this->setWindowFlags(flags);
|
|
||||||
setFocus(); // ensure focus is not on the submit button
|
setFocus(); // ensure focus is not on the submit button
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetInfo::wireUi() {
|
void GetInfo::wireUi() {
|
||||||
connect(submitButton, &QPushButton::clicked, this, &GetInfo::submitButtonClicked);
|
connect(submitButton, &QPushButton::clicked, this, &GetInfo::submitButtonClicked);
|
||||||
connect(deleteButton, &QPushButton::clicked, this, &GetInfo::deleteButtonClicked);
|
connect(deleteButton, &QPushButton::clicked, this, &GetInfo::deleteButtonClicked);
|
||||||
connect(closeWindowAction, &QAction::triggered, this, &GetInfo::deleteButtonClicked);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetInfo::showEvent(QShowEvent* evt) {
|
void GetInfo::showEvent(QShowEvent* evt) {
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "ashirtdialog/ashirtdialog.h"
|
||||||
|
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QAction>
|
|
||||||
#include <QDialog>
|
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
|
|
||||||
#include "components/evidence_editor/evidenceeditor.h"
|
#include "components/evidence_editor/evidenceeditor.h"
|
||||||
|
@ -18,7 +18,7 @@ namespace Ui {
|
||||||
class GetInfo;
|
class GetInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
class GetInfo : public QDialog {
|
class GetInfo : public AShirtDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -49,9 +49,6 @@ class GetInfo : public QDialog {
|
||||||
|
|
||||||
QNetworkReply *uploadAssetReply = nullptr;
|
QNetworkReply *uploadAssetReply = nullptr;
|
||||||
|
|
||||||
// Actions
|
|
||||||
QAction* closeWindowAction = nullptr;
|
|
||||||
|
|
||||||
// Ui Components
|
// Ui Components
|
||||||
QGridLayout* gridLayout;
|
QGridLayout* gridLayout;
|
||||||
QPushButton* deleteButton;
|
QPushButton* deleteButton;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
PortingDialog::PortingDialog(PortType dialogType, DatabaseConnection* db, QWidget *parent)
|
PortingDialog::PortingDialog(PortType dialogType, DatabaseConnection* db, QWidget *parent)
|
||||||
: QDialog(parent) {
|
: AShirtDialog(parent) {
|
||||||
this->dialogType = dialogType;
|
this->dialogType = dialogType;
|
||||||
this->db = db;
|
this->db = db;
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@ PortingDialog::PortingDialog(PortType dialogType, DatabaseConnection* db, QWidge
|
||||||
}
|
}
|
||||||
|
|
||||||
PortingDialog::~PortingDialog() {
|
PortingDialog::~PortingDialog() {
|
||||||
delete closeWindowAction;
|
|
||||||
|
|
||||||
delete _selectFileLabel;
|
delete _selectFileLabel;
|
||||||
delete portConfigCheckBox;
|
delete portConfigCheckBox;
|
||||||
|
@ -92,10 +91,6 @@ void PortingDialog::buildUi() {
|
||||||
// row 5
|
// row 5
|
||||||
gridLayout->addWidget(submitButton, 5, 2);
|
gridLayout->addWidget(submitButton, 5, 2);
|
||||||
|
|
||||||
closeWindowAction = new QAction(this);
|
|
||||||
closeWindowAction->setShortcut(QKeySequence::Close);
|
|
||||||
this->addAction(closeWindowAction);
|
|
||||||
|
|
||||||
this->setLayout(gridLayout);
|
this->setLayout(gridLayout);
|
||||||
this->resize(500, 1);
|
this->resize(500, 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QAction>
|
#include "ashirtdialog/ashirtdialog.h"
|
||||||
|
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QDialog>
|
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
* while Export will render an export window.
|
* while Export will render an export window.
|
||||||
* @see PortType
|
* @see PortType
|
||||||
*/
|
*/
|
||||||
class PortingDialog : public QDialog {
|
class PortingDialog : public AShirtDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -94,8 +94,6 @@ class PortingDialog : public QDialog {
|
||||||
/// Saved so that it can be cleaned up post-execution
|
/// Saved so that it can be cleaned up post-execution
|
||||||
porting::SystemManifest* executedManifest = nullptr;
|
porting::SystemManifest* executedManifest = nullptr;
|
||||||
|
|
||||||
QAction* closeWindowAction = nullptr;
|
|
||||||
|
|
||||||
// UI Components
|
// UI Components
|
||||||
QGridLayout* gridLayout = nullptr;
|
QGridLayout* gridLayout = nullptr;
|
||||||
QLabel* _selectFileLabel = nullptr;
|
QLabel* _selectFileLabel = nullptr;
|
||||||
|
|
|
@ -18,7 +18,9 @@
|
||||||
#include "hotkeymanager.h"
|
#include "hotkeymanager.h"
|
||||||
#include "components/custom_keyseq_edit/singlestrokekeysequenceedit.h"
|
#include "components/custom_keyseq_edit/singlestrokekeysequenceedit.h"
|
||||||
|
|
||||||
Settings::Settings(HotkeyManager *hotkeyManager, QWidget *parent) : QDialog(parent) {
|
Settings::Settings(HotkeyManager *hotkeyManager, QWidget *parent)
|
||||||
|
: AShirtDialog(parent, AShirtDialog::commonWindowFlags)
|
||||||
|
{
|
||||||
this->hotkeyManager = hotkeyManager;
|
this->hotkeyManager = hotkeyManager;
|
||||||
buildUi();
|
buildUi();
|
||||||
wireUi();
|
wireUi();
|
||||||
|
@ -53,7 +55,6 @@ Settings::~Settings() {
|
||||||
|
|
||||||
delete couldNotSaveSettingsMsg;
|
delete couldNotSaveSettingsMsg;
|
||||||
stopReply(¤tTestReply);
|
stopReply(¤tTestReply);
|
||||||
delete closeWindowAction;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings::buildUi() {
|
void Settings::buildUi() {
|
||||||
|
@ -157,20 +158,10 @@ void Settings::buildUi() {
|
||||||
// row 9
|
// row 9
|
||||||
gridLayout->addWidget(buttonBox, 9, 0, 1, gridLayout->columnCount());
|
gridLayout->addWidget(buttonBox, 9, 0, 1, gridLayout->columnCount());
|
||||||
|
|
||||||
closeWindowAction = new QAction(this);
|
|
||||||
closeWindowAction->setShortcut(QKeySequence::Close);
|
|
||||||
this->addAction(closeWindowAction);
|
|
||||||
|
|
||||||
this->setLayout(gridLayout);
|
this->setLayout(gridLayout);
|
||||||
this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding);
|
this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding);
|
||||||
this->resize(760, 300);
|
this->resize(760, 300);
|
||||||
this->setWindowTitle(tr("Settings"));
|
this->setWindowTitle(tr("Settings"));
|
||||||
|
|
||||||
// Make the dialog pop up above any other windows but retain title bar and buttons
|
|
||||||
Qt::WindowFlags flags = this->windowFlags();
|
|
||||||
flags |= Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint | Qt::WindowMinMaxButtonsHint |
|
|
||||||
Qt::WindowCloseButtonHint;
|
|
||||||
this->setWindowFlags(flags);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings::wireUi() {
|
void Settings::wireUi() {
|
||||||
|
@ -178,7 +169,6 @@ void Settings::wireUi() {
|
||||||
connect(buttonBox, &QDialogButtonBox::rejected, this, &Settings::onCancelClicked);
|
connect(buttonBox, &QDialogButtonBox::rejected, this, &Settings::onCancelClicked);
|
||||||
connect(testConnectionButton, &QPushButton::clicked, this, &Settings::onTestConnectionClicked);
|
connect(testConnectionButton, &QPushButton::clicked, this, &Settings::onTestConnectionClicked);
|
||||||
connect(eviRepoBrowseButton, &QPushButton::clicked, this, &Settings::onBrowseClicked);
|
connect(eviRepoBrowseButton, &QPushButton::clicked, this, &Settings::onBrowseClicked);
|
||||||
connect(closeWindowAction, &QAction::triggered, this, &Settings::onSaveClicked);
|
|
||||||
connect(clearHotkeysButton, &QPushButton::clicked, this, &Settings::onClearShortcutsClicked);
|
connect(clearHotkeysButton, &QPushButton::clicked, this, &Settings::onClearShortcutsClicked);
|
||||||
|
|
||||||
connect(captureAreaShortcutTextBox, &QKeySequenceEdit::keySequenceChanged, this, [this](const QKeySequence &keySequence){
|
connect(captureAreaShortcutTextBox, &QKeySequenceEdit::keySequenceChanged, this, [this](const QKeySequence &keySequence){
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QAction>
|
#include "ashirtdialog/ashirtdialog.h"
|
||||||
|
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
#include <QDialog>
|
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
#include <QErrorMessage>
|
#include <QErrorMessage>
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
* @brief The Settings class represents the settings dialog that displays when
|
* @brief The Settings class represents the settings dialog that displays when
|
||||||
* a user chooses the "settings" option in the tray menu
|
* a user chooses the "settings" option in the tray menu
|
||||||
*/
|
*/
|
||||||
class Settings : public QDialog {
|
class Settings : public AShirtDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -68,7 +68,6 @@ class Settings : public QDialog {
|
||||||
HotkeyManager* hotkeyManager;
|
HotkeyManager* hotkeyManager;
|
||||||
|
|
||||||
QNetworkReply* currentTestReply = nullptr;
|
QNetworkReply* currentTestReply = nullptr;
|
||||||
QAction* closeWindowAction = nullptr;
|
|
||||||
|
|
||||||
// UI components
|
// UI components
|
||||||
QGridLayout* gridLayout = nullptr;
|
QGridLayout* gridLayout = nullptr;
|
||||||
|
|
Loading…
Reference in New Issue