-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathdialog_opening.cpp
executable file
·57 lines (45 loc) · 1.31 KB
/
dialog_opening.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
#include "dialog_opening.h"
#include "ui_dialog_opening.h"
Dialog_Opening::Dialog_Opening(QWidget *parent) :
QDialog(parent),
ui(new Ui::Dialog_Opening)
{
ui->setupUi(this);
// attach buttons to functions
connect(ui->btn_random, SIGNAL(released()), this, SLOT(randNewChar()));
connect(ui->btn_load, SIGNAL(released()), this, SLOT(loadChar()));
connect(ui->btn_createNew, SIGNAL(released()), this, SLOT(createNewChar()));
}
Dialog_Opening::~Dialog_Opening()
{
delete ui;
}
void Dialog_Opening::randNewChar()
{
/*
Because mainwindow drives a random new creation by
default, this just allows the opening menu to exit
*/
this->close();
}
void Dialog_Opening::createNewChar()
{
/*
* Create a new character according
* to user inputs
*/
game->isLoaded = false; // insure default
// create and interact with create new char dialog
Dialog_charSheet ui_create;
ui_create.exec();
// we can leave is char data was accepted
if (game->isLoaded)
this->close();
}
void Dialog_Opening::loadChar()
{
QString filename = QFileDialog::getOpenFileName(this, tr("Open PQ7 Save File"), ".", tr("Save Files (*.pqd)"));
if (filename.isEmpty()) return; // cancellation guard
game->load(filename);
this->close();
}