-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgui.h
More file actions
98 lines (74 loc) · 2.18 KB
/
Copy pathgui.h
File metadata and controls
98 lines (74 loc) · 2.18 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#pragma once
//C++ libraries
#include <ncurses.h>
#include <iostream>
#include <limits>
#include <experimental/filesystem>
#include <string>
#include <stemmer.h>
#include <cstring>
//Qt libraries
#include <qurl.h>
#include <qt5/QtGui/qdesktopservices.h>
//My libraries
#include <Index/indexinterface.h>
#include <Index/avlindex.h>
#include <Index/hashindex.h>
#include <Parser/parser.h>
#include <QueryProcessor/queryprocessor.h>
using namespace std;
/**
* The GUI class presents the user with all the functionality of the PDF
* search engine. The class uses the ncurses library to present the user
* with a simple user interface consisting of menus operated by the keyboard.
*
* The class contains functionality to build, load, and search the index, and
* will display analytics about the parsed PDFs when the index is built.
*
* This class will be used as a part of the PDF Search Engine final project
* in SMU CSE 2341.
*
* By: Oisin Coveney
*/
class GUI
{
private:
///The directory to parse files from
string directory{""};
///The main menu options
const char* options[7] =
{"Search", "Build Index", "Add Files",
"Clear Index", "Statistics", "Choose index type", "Exit"};
/// For Yes/No questions
const char* boolChoice[2] = {"Yes", "No"};
/// The PDF index
IndexInterface* index;
/// Max height and width of the terminal window
int row, col;
///Clears all variables of the GUI
void clearAll();
/// Searching the index
void searchIndex();
/// Build the index
void buildIndex();
void buildFromFile();
void buildFromScratch();
/// Add files
void addNewFiles();
void addDirectory();
void addFile();
/// Clear index
void clearIndex();
/// choose index type
void chooseIndex();
/// statistics
void displayAnalytics();
/// UI formatting
void highlightMenuItem(int highlight, const char** items, int menuSize, int x);
void windowBorder();
public:
GUI();
~GUI();
//Main menu
void menu();
};