-
Notifications
You must be signed in to change notification settings - Fork 0
/
view.h
104 lines (85 loc) · 2.77 KB
/
view.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
#ifndef VIEW_H
#define VIEW_H
#include <QWidget>
#include "textBox.h"
#include "matrix.h"
#include "chart.h"
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QScrollArea>
#include <QMenu>
#include <QMenuBar>
#include <QPushButton>
#include <QString>
#include <QChartView>
#include <QtCharts>
#include <QInputDialog>
#include <QDialog>
#include <QMessageBox>
#include <QFileDialog>
#include <QJsonDocument>
class Controller;
class View : public QWidget
{
Q_OBJECT
private:
QVector<QVector<TextBox*>*>* textBoxMatrix;
QVector<TextBox*>* textBoxTitles;
QMenuBar* menuBar;
QMenu* file;
QMenu* edit;
QMenu* view;
QMenu* help;
Controller* controller;
QHBoxLayout* mainLayout;
//left layout
QVBoxLayout* leftArea;
QScrollArea* dataAreaScroll;
QWidget* scrollWidget;
QGridLayout* dataArea;
QHBoxLayout* leftButtons;
QPushButton* saveDataButton;
QPushButton* loadDataButton;
QPushButton* addRowButton;
QPushButton* deleteRowButton;
QPushButton* addColumnButton;
QPushButton* deleteColumnButton;
//right layout
QVBoxLayout* createChartButtons;
QPushButton* createLineChart;
QPushButton* createBarChart;
QPushButton* createPieChart;
QVBoxLayout* chartViewer;
QChartView* chartView;
QPushButton* closeChart;
void addMenus();
void setUpLeftLayout();
void linkButtons();
void connectNewTextBox(TextBox* tmp);
void setUpRightLayout();
public:
View(QWidget *parent = nullptr);
~View();
void setController(Controller *);
//TEXTBOX GRID RELATED METHODS
void addRow();
void deleteRow(unsigned int);
void addColumn(bool);
void deleteColumn(unsigned int);
void loadData(const Matrix*); //given a Matrix, genereates the TextBox grid and loads every cell with the right data from the Matrix.
void clean(); //resets the view
//USER DIALOG INTERACTION METHODS
QString showSelectNewColumnType(); //input dialog to choose the type of data of the new column (Text or Numeric)
QString showSaveFile(); //file dialog to choose a JSON file to save data into
QString showLoadFile(); //file dialog to choose a JSON file to import data from
int showConfirmClear(); //message box dialog asking to confirm the removal of all data
int showColumnSelectionDialogOptionalSingleText(QVector<int>*, const QString&); //input dialog for asking to select a textData column, if needed by the type of chart selected
int showColumnSelectionDialogNumeric(QVector<int>*); //input dialog for asking to select a numericData column, not optional
//CHART RELATED METHODS
void drawChart(QChart*);
void closeChartView();
QString showChartTitleSelector();
signals:
void senderPosition(unsigned int, unsigned int);
};
#endif // VIEW_H