-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathprojectwizard.cpp
executable file
·91 lines (72 loc) · 2.41 KB
/
projectwizard.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
84
85
86
87
88
89
#include "projectwizard.h"
#include "ui_projectwizard.h"
#include "mainwindow.h"
ProjectWizard::ProjectWizard(AppContext *context, QWidget *parent) :
QWidget(parent),
ui(new Ui::ProjectWizard)
{
this->context = context;
ui->setupUi(this);
this->setWindowTitle("Project Wizard");
// novy projekt
this->window_newProject = new NewProject(this->context);
connect(this->window_newProject, SIGNAL(projectCreated()),
this, SLOT(projectCreated()));
// otevrit projekt
this->window_openProject = new OpenProject(this->context);
connect(this->window_openProject, SIGNAL(projectOpened()),
this, SLOT(projectCreated()));
// vytvori projekt z obrazku
this->window_projectFromImage = new ProjectFromImage(this->context);
connect(this->window_projectFromImage, SIGNAL(projectCreated()),
this, SLOT(projectCreated()));
this->hightLightButton(this->ui->pushButtonCreate);
this->selectWidget(this->window_newProject);
}
ProjectWizard::~ProjectWizard()
{
delete ui;
if(this->window_newProject) delete this->window_newProject;
}
void ProjectWizard::on_pushButtonCreate_clicked()
{
this->hightLightButton(this->ui->pushButtonCreate);
this->selectWidget(this->window_newProject);
}
void ProjectWizard::on_pushButtonOpen_clicked()
{
this->hightLightButton(this->ui->pushButtonOpen);
this->selectWidget(this->window_openProject);
}
void ProjectWizard::on_pushButtonFromImage_clicked()
{
this->hightLightButton(this->ui->pushButtonFromImage);
this->selectWidget(this->window_projectFromImage);
}
void ProjectWizard::projectCreated()
{
MainWindow *main = new MainWindow(this->context, NULL);
main->showMaximized();
this->close();
}
void ProjectWizard::hightLightButton(QPushButton *button)
{
this->ui->pushButtonCreate->setStyleSheet("");
this->ui->pushButtonOpen->setStyleSheet("");
this->ui->pushButtonFromImage->setStyleSheet("");
if(button != NULL) {
button->setStyleSheet("background: rgba(183, 134, 32, 20%); border: 1px solid #b78620;");
}
}
void ProjectWizard::selectWidget(QWidget *widget)
{
QLayoutItem *item = this->ui->verticalLayoutContainer->takeAt(0);
if(item != NULL) {
QWidget *w = item->widget();
w->setParent(NULL);
}
if(widget != NULL) {
this->ui->verticalLayoutContainer->addWidget(widget);
}
this->ui->widgetContainer->repaint();
}