Skip to content

Commit 12d4538

Browse files
authored
Fixes to avoid runtime warnings (#55)
1 parent 30849e9 commit 12d4538

File tree

7 files changed

+31
-9
lines changed

7 files changed

+31
-9
lines changed

src/components/code_editor/codeeditor.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@
5858
#include <QPainter>
5959
#include <QTextBlock>
6060

61+
#include "helpers/constants.h"
62+
6163
QColor currentLineHighlightColor = QColor(115, 191, 255);
6264

6365
CodeEditor::CodeEditor(QWidget *parent) : QPlainTextEdit(parent) {
@@ -70,7 +72,7 @@ CodeEditor::CodeEditor(QWidget *parent) : QPlainTextEdit(parent) {
7072
// customize for text/code editing
7173
setLineWrapMode(LineWrapMode::NoWrap);
7274
setTabChangesFocus(false);
73-
QFont font("source code pro");
75+
QFont font(Constants::codeFont());
7476
font.setStyleHint(QFont::TypeWriter);
7577
setFont(font);
7678

src/components/tagging/tageditor.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ TagEditor::TagEditor(QWidget *parent) : QWidget(parent) {
1616
}
1717

1818
TagEditor::~TagEditor() {
19-
disconnect(getTagsReply, &QNetworkReply::finished, this, &TagEditor::onGetTagsComplete);
19+
if (getTagsReply != nullptr ) {
20+
disconnect(getTagsReply, &QNetworkReply::finished, this, &TagEditor::onGetTagsComplete);
21+
}
2022
delete couldNotCreateTagMsg;
2123
delete loading;
2224
delete tagCompleteTextBox;

src/components/tagging/tagwidget.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ void TagWidget::mouseReleaseEvent(QMouseEvent* evt) {
3838
void TagWidget::buildTag() {
3939
QFont labelFont;
4040
#ifdef Q_OS_MACOS
41-
labelFont = QFont("Sans", 14);
41+
labelFont = QFont("Arial", 14);
42+
#elif defined(Q_OS_LINUX)
43+
labelFont = QFont("Liberation Sans", 12);
4244
#else
4345
labelFont = QFont("Sans", 12);
4446
#endif

src/forms/evidence/evidencemanager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ enum ColumnIndexes {
3535
static QStringList columnNames() {
3636
static QStringList names;
3737
if (names.count() == 0) {
38-
names.insert(COL_ERROR_MSG, "Error");
3938
names.insert(COL_DATE_CAPTURED, "Date Captured");
4039
names.insert(COL_OPERATION, "Operation");
4140
names.insert(COL_PATH, "Path");
@@ -44,6 +43,7 @@ static QStringList columnNames() {
4443
names.insert(COL_SUBMITTED, "Submitted");
4544
names.insert(COL_DATE_SUBMITTED, "Date Submitted");
4645
names.insert(COL_FAILED, "Failed");
46+
names.insert(COL_ERROR_MSG, "Error");
4747
}
4848
return names;
4949
}

src/helpers/constants.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,14 @@ class Constants {
6969
return "https://github.com/theparanoids/ashirt/releases";
7070
}
7171

72+
static QString codeFont() {
73+
#ifdef Q_OS_MACX
74+
return "monaco";
75+
#endif
76+
77+
return "source code pro";
78+
}
79+
7280
private:
7381
enum RepoField {
7482
owner = 0,

src/helpers/netman.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,10 @@ class NetMan : public QObject {
214214
/// refreshOperationsList retrieves the operations currently visible to the user. Results should be
215215
/// retrieved by listening for the operationListUpdated signal
216216
void refreshOperationsList() {
217-
allOpsReply = getAllOperations();
218-
connect(allOpsReply, &QNetworkReply::finished, this, &NetMan::onGetOpsComplete);
217+
if (allOpsReply == nullptr) {
218+
allOpsReply = getAllOperations();
219+
connect(allOpsReply, &QNetworkReply::finished, this, &NetMan::onGetOpsComplete);
220+
}
219221
}
220222

221223
/// getOperationTags retrieves the tags for specified operation from the ASHIRT API server

src/traymanager.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,17 @@ void TrayManager::closeEvent(QCloseEvent* event) {
152152
}
153153

154154
void TrayManager::createActions() {
155+
auto toTop = [](QDialog* window) {
156+
window->show(); // display the window
157+
window->raise(); // bring to the top (mac)
158+
window->activateWindow(); // alternate bring to the top (windows)
159+
};
160+
155161
quitAction = new QAction(tr("Quit"), this);
156162
connect(quitAction, &QAction::triggered, qApp, &QCoreApplication::quit);
157163

158164
showSettingsAction = new QAction(tr("Settings"), this);
159-
connect(showSettingsAction, &QAction::triggered, settingsWindow, &QWidget::show);
165+
connect(showSettingsAction, &QAction::triggered, [this, toTop](){toTop(settingsWindow);});
160166

161167
currentOperationMenuAction = new QAction(this);
162168
currentOperationMenuAction->setEnabled(false);
@@ -168,10 +174,10 @@ void TrayManager::createActions() {
168174
connect(captureWindowAction, &QAction::triggered, this, &TrayManager::captureWindowActionTriggered);
169175

170176
showEvidenceManagerAction = new QAction(tr("View Accumulated Evidence"), this);
171-
connect(showEvidenceManagerAction, &QAction::triggered, evidenceManagerWindow, &QWidget::show);
177+
connect(showEvidenceManagerAction, &QAction::triggered, [this, toTop](){toTop(evidenceManagerWindow);});
172178

173179
showCreditsAction = new QAction(tr("About"), this);
174-
connect(showCreditsAction, &QAction::triggered, creditsWindow, &QWidget::show);
180+
connect(showCreditsAction, &QAction::triggered, [this, toTop](){toTop(creditsWindow);});
175181

176182
addCodeblockAction = new QAction(tr("Add Codeblock from Clipboard"), this);
177183
connect(addCodeblockAction, &QAction::triggered, this, &TrayManager::captureCodeblockActionTriggered);

0 commit comments

Comments
 (0)