-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.cpp
68 lines (54 loc) · 1.76 KB
/
mainwindow.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
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QLabel>
#include <QPushButton>
#include <QVBoxLayout>
#include <QScrollArea>
#include <QListWidget>
#include "Blocks/dfsblock.h"
#include "Blocks/sortblock.h"
#include "globalvararea.h"
#include "Algorithms/dfsalgorithm.h"
#include "Algorithms/sortalgorithm.h"
#include "vars/integervar.h"
#include "vars/intarrayvar.h"
void DebugFirstStage(AvailableBlockList *av);
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
globalVarViewer = new GlobalVarAreaViewer(this);
blockViewerWidget = new BlockViewer(this);
blockManager = new BlockManager(blockViewerWidget, this);
QGroupBox *mainWi = new QGroupBox(this);
QVBoxLayout *mainLay = new QVBoxLayout(mainWi);
mainLay->addWidget(globalVarViewer);
mainLay->addWidget(blockViewerWidget);
mainWi->setLayout(mainLay);
setCentralWidget(mainWi);
QListWidget *listBlocks = new QListWidget(this);
ui->dockWidget->setWidget(listBlocks);
availableBlockList = new AvailableBlockList(listBlocks, blockManager);
registerVars();
DebugFirstStage(availableBlockList);
}
MainWindow::~MainWindow()
{
delete ui;
delete availableBlockList;
}
//Отладка первого этапа разработки
void DebugFirstStage(AvailableBlockList *av){
// av->addBlockToList(DFSAlgorithm::name(), new DFSBlockCreator);
av->addBlockToList(SortAlgorithm::name(), new SortBlockCreator);
}
void MainWindow::on_actionRun_triggered()
{
blockManager->executeBlockList();
}
void MainWindow::registerVars()
{
GlobalVarArea::varRegister(IntegerVar::SVarTitle(), new IntegerVarCreator);
GlobalVarArea::varRegister(IntArrayVar::SVarTitle(), new IntArrayVarCreator);
}