-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new Welcome Page and firstrunWizard (#235)
Co-authored-by: Chris Rizzitello <[email protected]>
- Loading branch information
1 parent
3e1ba34
commit 26fb82e
Showing
34 changed files
with
1,845 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,6 +64,7 @@ find_package(Qt6 6.5.0 REQUIRED COMPONENTS | |
Network | ||
Sql | ||
Core | ||
Svg | ||
) | ||
|
||
add_subdirectory(deploy) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
#include "apikeyspage.h" | ||
|
||
#include <QFileDialog> | ||
#include <QLabel> | ||
#include <QLineEdit> | ||
#include <QPushButton> | ||
#include <QVBoxLayout> | ||
#include <appconfig.h> | ||
|
||
bool ApiKeysPage::validatePage() | ||
{ | ||
if (!field("host.accessKey").isValid()) | ||
return false; | ||
|
||
if (!field("host.secretKey").isValid()) | ||
return false; | ||
|
||
return true; | ||
} | ||
|
||
void ApiKeysPage::initializePage() | ||
{ | ||
QString accessKey = AppConfig::value(CONFIG::ACCESSKEY); | ||
setField("host.accessKey", accessKey); | ||
accessKeyLine->setText(accessKey); | ||
|
||
QString secretKey = AppConfig::value(CONFIG::SECRETKEY); | ||
setField("host.secretKey", secretKey); | ||
secretKeyLine->setText(secretKey); | ||
} | ||
|
||
ApiKeysPage::ApiKeysPage(QWidget *parent) | ||
: WizardPage{Page_Api, parent} | ||
{ | ||
|
||
auto f = font(); | ||
auto _lblTitleLabel = new QLabel(this); | ||
f.setPointSize(titleFont.first); | ||
f.setWeight(titleFont.second); | ||
_lblTitleLabel->setFont(f); | ||
_lblTitleLabel->setText(tr("API Keys")); | ||
|
||
auto _lblSubtitle = new QLabel(this); | ||
f.setPointSize(subTitleFont.first); | ||
f.setWeight(subTitleFont.second); | ||
_lblSubtitle->setFont(f); | ||
_lblSubtitle->setWordWrap(true); | ||
_lblSubtitle->setText(tr("Input Api keys for the server")); | ||
|
||
auto _lblBody = new QLabel(this); | ||
f.setPointSize(bodyFont.first); | ||
f.setWeight(bodyFont.second); | ||
_lblBody->setFont(f); | ||
_lblBody->setWordWrap(true); | ||
_lblBody->setText(tr("• Login to the Ashirt server click the profile icon in the top right then select <i>Account Settings</i><br>")); | ||
|
||
auto _lblBody2 = new QLabel(this); | ||
_lblBody2->setFont(f); | ||
_lblBody2->setWordWrap(true); | ||
_lblBody2->setText(tr("• Select <i>API Keys</i> on the left, select click <i>Generate New API Key</i><br>")); | ||
|
||
auto _lblBody3 = new QLabel(this); | ||
_lblBody3->setFont(f); | ||
_lblBody3->setWordWrap(true); | ||
_lblBody3->setText(tr("• Enter your keys below")); | ||
|
||
auto _lblAKey = new QLabel(this); | ||
f.setPointSize(smallFont.first); | ||
f.setWeight(smallFont.second); | ||
_lblAKey->setFont(f); | ||
_lblAKey->setText(tr("Access Key")); | ||
|
||
accessKeyLine = new QLineEdit(this); | ||
accessKeyLine->setMaxLength(24); | ||
accessKeyLine->setTextMargins(3,0,3,0); | ||
accessKeyLine->setMaximumWidth(fontMetrics().averageCharWidth() * 27); | ||
registerField("host.accessKey*", accessKeyLine); | ||
|
||
auto t1 = new QVBoxLayout(); | ||
t1->setSpacing(1); | ||
t1->addWidget(_lblAKey); | ||
t1->addWidget(accessKeyLine); | ||
|
||
auto _lblBKey = new QLabel(this); | ||
f.setPointSize(smallFont.first); | ||
f.setWeight(smallFont.second); | ||
_lblBKey->setFont(f); | ||
_lblBKey->setText(tr("Secret Key")); | ||
|
||
secretKeyLine = new QLineEdit(this); | ||
secretKeyLine->setTextMargins(3,0,3,0); | ||
registerField("host.secretKey*", secretKeyLine); | ||
|
||
auto t2 = new QVBoxLayout(); | ||
t2->setSpacing(1); | ||
t2->addWidget(_lblBKey); | ||
t2->addWidget(secretKeyLine); | ||
|
||
auto tLayout = new QHBoxLayout(); | ||
tLayout->addLayout(t1); | ||
tLayout->addLayout(t2); | ||
|
||
auto layout = new QVBoxLayout(); | ||
layout->addWidget(_lblTitleLabel); | ||
layout->addWidget(_lblSubtitle); | ||
layout->addSpacerItem(new QSpacerItem(0,30,QSizePolicy::Minimum, QSizePolicy::Fixed)); | ||
layout->addWidget(_lblBody); | ||
layout->addWidget(_lblBody2); | ||
layout->addWidget(_lblBody3); | ||
layout->addSpacerItem(new QSpacerItem(0,30,QSizePolicy::Minimum, QSizePolicy::Fixed)); | ||
layout->addLayout(tLayout); | ||
layout->addSpacerItem(new QSpacerItem(0,0,QSizePolicy::Minimum, QSizePolicy::Expanding)); | ||
setLayout(layout); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#pragma once | ||
|
||
#include "wizardpage.h" | ||
#include <QObject> | ||
|
||
class QLineEdit; | ||
class ApiKeysPage : public WizardPage | ||
{ | ||
Q_OBJECT | ||
public: | ||
bool validatePage() override; | ||
void initializePage() override; | ||
ApiKeysPage(QWidget *parent = nullptr); | ||
private: | ||
QLineEdit * accessKeyLine = nullptr; | ||
QLineEdit * secretKeyLine = nullptr; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
#include "captureareapage.h" | ||
|
||
#include <QFileDialog> | ||
#include <QLabel> | ||
#include <QLineEdit> | ||
#include <QPushButton> | ||
#include <QVBoxLayout> | ||
#include <appconfig.h> | ||
|
||
#include "hotkeymanager.h" | ||
#include "components/custom_keyseq_edit/singlestrokekeysequenceedit.h" | ||
|
||
bool CaptureAreaPage::validatePage() | ||
{ | ||
if(!field("command.area").isValid()) | ||
return false; | ||
AppConfig::setValue(CONFIG::COMMAND_SCREENSHOT, field("command.area").toString()); | ||
|
||
if(!field("keySequence.area").isValid()) | ||
return false; | ||
auto keyCombo = QKeySequence::fromString(field("keySequence.area").toString(), QKeySequence::NativeText); | ||
AppConfig::setValue(CONFIG::SHORTCUT_SCREENSHOT, keyCombo.toString(QKeySequence::PortableText)); | ||
HotkeyManager::updateHotkeys(); | ||
return true; | ||
} | ||
|
||
void CaptureAreaPage::initializePage() | ||
{ | ||
HotkeyManager::unregisterKey(HotkeyManager::ACTION_CAPTURE_AREA); | ||
QString captureAreaCommand = AppConfig::value(CONFIG::COMMAND_SCREENSHOT); | ||
if(!captureAreaCommand.isEmpty()) { | ||
setField("command.area", captureAreaCommand); | ||
captureAreaLine->setText(captureAreaCommand); | ||
} | ||
|
||
QString sequence = AppConfig::value(CONFIG::SHORTCUT_SCREENSHOT); | ||
if(!sequence.isEmpty()) { | ||
setField("keySequence.area", sequence); | ||
captureAreaKeySequenceEdit->setKeySequence(QKeySequence::fromString(sequence)); | ||
} | ||
} | ||
|
||
void CaptureAreaPage::cleanupPage() | ||
{ | ||
HotkeyManager::updateHotkeys(); | ||
} | ||
|
||
CaptureAreaPage::CaptureAreaPage(QWidget *parent) | ||
: WizardPage{Page_CaptureArea, parent} | ||
{ | ||
auto f = font(); | ||
auto _lblTitleLabel = new QLabel(this); | ||
f.setPointSize(titleFont.first); | ||
f.setWeight(titleFont.second); | ||
_lblTitleLabel->setFont(f); | ||
_lblTitleLabel->setText(tr("Capture Area")); | ||
|
||
auto _lblSubtitle = new QLabel(this); | ||
f.setPointSize(subTitleFont.first); | ||
f.setWeight(subTitleFont.second); | ||
_lblSubtitle->setFont(f); | ||
_lblSubtitle->setWordWrap(true); | ||
_lblSubtitle->setText(tr("Set the capture area command and shortcut.")); | ||
|
||
auto _lblB1 = new QLabel(this); | ||
f.setPointSize(bodyFont.first); | ||
f.setWeight(bodyFont.second); | ||
_lblB1->setFont(f); | ||
_lblB1->setText(tr("<html><br><br>• Enter the command ashirt will use to capture area screenshots<br><br>• Enter a key combination that will trigger the capture area command<html>")); | ||
|
||
auto hLayout = new QHBoxLayout(); | ||
hLayout->addWidget(_lblB1, 0, Qt::AlignHCenter); | ||
|
||
auto _lblAKey = new QLabel(this); | ||
f.setPointSize(smallFont.first); | ||
f.setWeight(smallFont.second); | ||
_lblAKey->setFont(f); | ||
_lblAKey->setText(tr("Capture Area Command")); | ||
|
||
captureAreaLine = new QLineEdit(this); | ||
captureAreaLine->setTextMargins(3,0,3,0); | ||
registerField("command.area*", captureAreaLine); | ||
|
||
auto t1 = new QVBoxLayout(); | ||
t1->setSpacing(1); | ||
t1->addWidget(_lblAKey); | ||
t1->addWidget(captureAreaLine); | ||
|
||
auto _lblBKey = new QLabel(this); | ||
f.setPointSize(smallFont.first); | ||
f.setWeight(smallFont.second); | ||
_lblBKey->setFont(f); | ||
_lblBKey->setText(tr("Shortcut")); | ||
|
||
captureAreaKeySequenceEdit = new SingleStrokeKeySequenceEdit(this); | ||
registerField("keySequence.area*", captureAreaKeySequenceEdit, "keySequence", SIGNAL(keySequenceChanged(const QKeySequence &))); | ||
|
||
auto t2 = new QVBoxLayout(); | ||
t2->setSpacing(1); | ||
t2->addWidget(_lblBKey); | ||
t2->addWidget(captureAreaKeySequenceEdit); | ||
|
||
auto tLayout = new QHBoxLayout(); | ||
tLayout->addLayout(t1, 8); | ||
tLayout->addLayout(t2, 2); | ||
|
||
auto layout = new QVBoxLayout(); | ||
layout->addWidget(_lblTitleLabel); | ||
layout->addWidget(_lblSubtitle); | ||
layout->addLayout(hLayout); | ||
layout->addSpacerItem(new QSpacerItem(0,60,QSizePolicy::Minimum, QSizePolicy::Fixed)); | ||
layout->addLayout(tLayout); | ||
layout->addSpacerItem(new QSpacerItem(0,0,QSizePolicy::Minimum, QSizePolicy::Expanding)); | ||
setLayout(layout); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#pragma once | ||
|
||
#include "wizardpage.h" | ||
#include <QObject> | ||
|
||
class QLineEdit; | ||
class SingleStrokeKeySequenceEdit; | ||
class CaptureAreaPage : public WizardPage | ||
{ | ||
Q_OBJECT | ||
public: | ||
bool validatePage() override; | ||
void initializePage() override; | ||
void cleanupPage() override; | ||
CaptureAreaPage(QWidget *parent = nullptr); | ||
private: | ||
QLineEdit *captureAreaLine = nullptr; | ||
SingleStrokeKeySequenceEdit *captureAreaKeySequenceEdit = nullptr; | ||
}; |
Oops, something went wrong.