Fixes to avoid runtime warnings (#55)

main
Joel Smith 2020-09-25 17:19:24 -07:00 committed by GitHub
parent 30849e9ead
commit 12d4538a97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 31 additions and 9 deletions

View File

@ -58,6 +58,8 @@
#include <QPainter>
#include <QTextBlock>
#include "helpers/constants.h"
QColor currentLineHighlightColor = QColor(115, 191, 255);
CodeEditor::CodeEditor(QWidget *parent) : QPlainTextEdit(parent) {
@ -70,7 +72,7 @@ CodeEditor::CodeEditor(QWidget *parent) : QPlainTextEdit(parent) {
// customize for text/code editing
setLineWrapMode(LineWrapMode::NoWrap);
setTabChangesFocus(false);
QFont font("source code pro");
QFont font(Constants::codeFont());
font.setStyleHint(QFont::TypeWriter);
setFont(font);

View File

@ -16,7 +16,9 @@ TagEditor::TagEditor(QWidget *parent) : QWidget(parent) {
}
TagEditor::~TagEditor() {
disconnect(getTagsReply, &QNetworkReply::finished, this, &TagEditor::onGetTagsComplete);
if (getTagsReply != nullptr ) {
disconnect(getTagsReply, &QNetworkReply::finished, this, &TagEditor::onGetTagsComplete);
}
delete couldNotCreateTagMsg;
delete loading;
delete tagCompleteTextBox;

View File

@ -38,7 +38,9 @@ void TagWidget::mouseReleaseEvent(QMouseEvent* evt) {
void TagWidget::buildTag() {
QFont labelFont;
#ifdef Q_OS_MACOS
labelFont = QFont("Sans", 14);
labelFont = QFont("Arial", 14);
#elif defined(Q_OS_LINUX)
labelFont = QFont("Liberation Sans", 12);
#else
labelFont = QFont("Sans", 12);
#endif

View File

@ -35,7 +35,6 @@ enum ColumnIndexes {
static QStringList columnNames() {
static QStringList names;
if (names.count() == 0) {
names.insert(COL_ERROR_MSG, "Error");
names.insert(COL_DATE_CAPTURED, "Date Captured");
names.insert(COL_OPERATION, "Operation");
names.insert(COL_PATH, "Path");
@ -44,6 +43,7 @@ static QStringList columnNames() {
names.insert(COL_SUBMITTED, "Submitted");
names.insert(COL_DATE_SUBMITTED, "Date Submitted");
names.insert(COL_FAILED, "Failed");
names.insert(COL_ERROR_MSG, "Error");
}
return names;
}

View File

@ -69,6 +69,14 @@ class Constants {
return "https://github.com/theparanoids/ashirt/releases";
}
static QString codeFont() {
#ifdef Q_OS_MACX
return "monaco";
#endif
return "source code pro";
}
private:
enum RepoField {
owner = 0,

View File

@ -214,8 +214,10 @@ class NetMan : public QObject {
/// refreshOperationsList retrieves the operations currently visible to the user. Results should be
/// retrieved by listening for the operationListUpdated signal
void refreshOperationsList() {
allOpsReply = getAllOperations();
connect(allOpsReply, &QNetworkReply::finished, this, &NetMan::onGetOpsComplete);
if (allOpsReply == nullptr) {
allOpsReply = getAllOperations();
connect(allOpsReply, &QNetworkReply::finished, this, &NetMan::onGetOpsComplete);
}
}
/// getOperationTags retrieves the tags for specified operation from the ASHIRT API server

View File

@ -152,11 +152,17 @@ void TrayManager::closeEvent(QCloseEvent* event) {
}
void TrayManager::createActions() {
auto toTop = [](QDialog* window) {
window->show(); // display the window
window->raise(); // bring to the top (mac)
window->activateWindow(); // alternate bring to the top (windows)
};
quitAction = new QAction(tr("Quit"), this);
connect(quitAction, &QAction::triggered, qApp, &QCoreApplication::quit);
showSettingsAction = new QAction(tr("Settings"), this);
connect(showSettingsAction, &QAction::triggered, settingsWindow, &QWidget::show);
connect(showSettingsAction, &QAction::triggered, [this, toTop](){toTop(settingsWindow);});
currentOperationMenuAction = new QAction(this);
currentOperationMenuAction->setEnabled(false);
@ -168,10 +174,10 @@ void TrayManager::createActions() {
connect(captureWindowAction, &QAction::triggered, this, &TrayManager::captureWindowActionTriggered);
showEvidenceManagerAction = new QAction(tr("View Accumulated Evidence"), this);
connect(showEvidenceManagerAction, &QAction::triggered, evidenceManagerWindow, &QWidget::show);
connect(showEvidenceManagerAction, &QAction::triggered, [this, toTop](){toTop(evidenceManagerWindow);});
showCreditsAction = new QAction(tr("About"), this);
connect(showCreditsAction, &QAction::triggered, creditsWindow, &QWidget::show);
connect(showCreditsAction, &QAction::triggered, [this, toTop](){toTop(creditsWindow);});
addCodeblockAction = new QAction(tr("Add Codeblock from Clipboard"), this);
connect(addCodeblockAction, &QAction::triggered, this, &TrayManager::captureCodeblockActionTriggered);