-
Notifications
You must be signed in to change notification settings - Fork 0
/
mini_search.cpp
83 lines (67 loc) · 1.53 KB
/
mini_search.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#pragma once
#pragma execution_character_set("UTF-8")
#include "mini_search.h"
#include "ui_mini_search.h"
#include "dialog.h"
#include <QMessageBox>
#include <QAbstractButton>
#include <QDebug>
extern "C"
{
#include "test.h"
};
#ifdef __cplusplus
extern "C"
{
#endif // _cplusplus
DOCFEEDBACK* query_and(COREDATA* pcoredata, char* src);
DOCFEEDBACK* query_or(COREDATA* pcoredata, char* src);
DOCFEEDBACK* query(COREDATA* pcoredata, char* src);
COREDATA* pcoredata = build();
}
mini_search::mini_search(QWidget *parent)
: QMainWindow(parent)
{
ui.setupUi(this);
COREDATA* pcoredata = build();
}
mini_search::~mini_search()
{
}
void mini_search::on_pushButton_clicked()
{
QString str = NULL;
QByteArray ba = NULL;
char* ch = NULL;
DOCFEEDBACK *pdocfeedback = NULL;
str = ui.lineEdit->text();
ba = str.toLocal8Bit();
ch = ba.data();
if (strcmp(ch, "") != 0)
{
if (ui.radioButton->isChecked() == true)
{
ui.radioButton_2->released();
pdocfeedback = query_and(pcoredata, ch);
}
if (ui.radioButton_2->isChecked() == true)
{
pdocfeedback = query_or(pcoredata, ch);
}
if (ui.radioButton->isChecked() == false && ui.radioButton_2->isChecked() == false)
{
pdocfeedback = query(pcoredata, ch);
}
if (pdocfeedback == NULL)
{
QMessageBox::information(this, "Results", "Sorry,Not Found these words!");
}
else
{
dialog = new Dialog;
dialog->show_word(pcoredata, pdocfeedback);
dialog->show();
}
}
return;
}