forked from arcadia-xenos/progress-quest
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdialog_opening.cpp
More file actions
60 lines (48 loc) · 1.38 KB
/
Copy pathdialog_opening.cpp
File metadata and controls
60 lines (48 loc) · 1.38 KB
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
#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, &QAbstractButton::released, this, &Dialog_Opening::randNewChar);
connect(ui->btn_load, &QAbstractButton::released, this, &Dialog_Opening::loadChar);
connect(ui->btn_createNew, &QAbstractButton::released, this, &Dialog_Opening::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();
}