-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.h
117 lines (98 loc) · 2.79 KB
/
mainwindow.h
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <map>
#include <vector>
#include "bnode.h"
#include "srtl-driver.hh"
#include <QPushButton>
#include <QSlider>
#include <QGraphicsView>
#include <QGraphicsScene>
#include <QListView>
#include <QModelIndex>
#include <QLabel>
#include "mytextedit.h"
#include <QRadioButton>
#include "mygraphicsscene.h"
#include "util.h"
#include "pattern_dto.h"
class MyTextEdit;
class MyGraphicsScence;
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
void setNodeMap(std::map<int, std::vector<BNode*> > aMap);
static const int ELLIPSE_HEIGHT = 40;
static const int ELLIPSE_WIDTH = 40;
srtl_driver* m_driver;
void setIsDirty(bool aDirty);
bool isDirty();
void setIsSaved(bool aSaved);
bool isSaved();
void performMutation(QPointF aPoint);
PatternDTO* getSelectedIndexMap(){
return util::NodeMap::m_mapVec[m_selectedIndex];
}
std::map<int, std::vector<BNode*> >& getMap(){
return m_nodeMap;
}
void checkEditRadioButton(bool aCheked){
m_edit->setChecked(aCheked);
}
void mutateBranch(std::map<int,vector<BNode*> >::iterator aM, std::vector<BNode*>::iterator aV, bool aIsCollapsed);
private slots:
void on_m_browzeFileBut_clicked();
void on_m_parseBut_clicked();
void on_m_changeColorBut_clicked();
void on_m_zoomSlider_valueChanged(int value);
void on_m_listView_clicked(QModelIndex index);
void on_m_edit_clicked(bool isClicked);
void on_m_browse_clicked(bool isClicked);
void on_m_new_clicked(bool isClicked);
void on_m_save_clicked(bool isClicked);
private:
void createComponents();
int getWidthOfEllipseVector(vector<BNode*> aVec);
void initComponents();
void showMessage(string aMsg);
void hightLightText();
void save();
bool isItemAtScenePos(BNode* aNode, QPointF aPoint);
void cleanUI(bool aReadOnlyText);
void nothingToSaveMessage();
Ui::MainWindow *ui;
MyGraphicsScence *m_scene;
QGraphicsView* m_graphicsView;
QSlider* m_zoomSlider;
QPushButton* m_browzeFileBut;
QPushButton* m_parseBut;
QPushButton* m_changeColorBut;
QListView* m_listView;
QLabel* m_totalPatterns;
QLabel* m_selectedPattern;
MyTextEdit* m_textEdit;
QRadioButton* m_edit;
QRadioButton* m_browse;
QRadioButton* m_new;
QRadioButton* m_save;
QButtonGroup* m_buttonGroup;
int m_selectedIndex;
std::map<int, std::vector<BNode*> > m_nodeMap;
int m_pos;
char* m_file;
string m_patternName;
int m_begin;
int m_end;
QString m_selectedFile;
QString m_tempFile;
bool m_isDirty;
bool m_isSaved;
};
#endif // MAINWINDOW_H