-
Notifications
You must be signed in to change notification settings - Fork 14
/
MainDialog.cpp
57 lines (47 loc) · 1.83 KB
/
MainDialog.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Desc: Main dialog handler
#include "stdafx.h"
#include "MainDialog.h"
#include <QtWidgets/QDialogButtonBox>
extern void AltFileBtnHandler();
MainDialog::MainDialog(BOOL &optionPlaceComments, BOOL &optionSingleThread, BOOL &optionVerbose) : QDialog(QApplication::activeWindow(), 0)
{
Ui::MainCIDialog::setupUi(this);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
buttonBox->addButton("CONTINUE", QDialogButtonBox::AcceptRole);
buttonBox->addButton("CANCEL", QDialogButtonBox::RejectRole);
#define INITSTATE(obj,state) obj->setCheckState((state == TRUE) ? Qt::Checked : Qt::Unchecked);
INITSTATE(checkBox1, optionPlaceComments);
INITSTATE(checkBox2, optionSingleThread);
INITSTATE(checkBox3, optionVerbose);
#undef INITSTATE
// Apply style sheet
QFile file(STYLE_PATH "style.qss");
if (file.open(QFile::ReadOnly | QFile::Text))
setStyleSheet(QTextStream(&file).readAll());
}
// On "LOAD ALT RULES" press
void MainDialog::pressSelect()
{
AltFileBtnHandler();
}
// Do main dialog, return TRUE if canceled
BOOL doMainDialog(BOOL &optionPlaceComments, BOOL &optionSingleThread, BOOL &optionVerbose)
{
BOOL result = TRUE;
MainDialog *dlg = new MainDialog(optionPlaceComments, optionSingleThread, optionVerbose);
// Set Dialog title with version number
qstring version, tmp;
version.sprnt("Yara for IDA %s", GetVersionString(MY_VERSION, tmp).c_str());
dlg->setWindowTitle(version.c_str());
if (dlg->exec())
{
#define CHECKSTATE(obj,var) var = dlg->obj->isChecked()
CHECKSTATE(checkBox1, optionPlaceComments);
CHECKSTATE(checkBox2, optionSingleThread);
CHECKSTATE(checkBox3, optionVerbose);
#undef CHECKSTATE
result = FALSE;
}
delete dlg;
return(result);
}