-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfirsttimedialog.cpp
64 lines (54 loc) · 1.69 KB
/
firsttimedialog.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
#include "firsttimedialog.h"
#include "ui_firsttimedialog.h"
#include <QFileDialog>
#include <QStandardPaths>
#include <QStyle>
FirstTimeDialog::FirstTimeDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::FirstTimeDialog)
{
ui->setupUi(this);
savePath = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation) + "/" + "Savestates";
ui->directoryPathLabel->setText(savePath);
ui->pushButton->setIcon(style()->standardPixmap(QStyle::SP_DialogOpenButton));
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
pathChanged = false;
}
FirstTimeDialog::~FirstTimeDialog()
{
delete ui;
}
QString FirstTimeDialog::selectedMode()
{
if (ui->classicCheckBox->isChecked())
return "SNESClassic";
if (ui->nwaCheckBox->isChecked())
return "NWAccess";
return "USB2Snes";
}
void FirstTimeDialog::on_pushButton_clicked()
{
QString dir = QFileDialog::getExistingDirectory(this, tr("Savestates directory"), QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation), QFileDialog::ShowDirsOnly);
if (dir.isEmpty())
return;
pathChanged = true;
savePath = dir;
ui->directoryPathLabel->setText(dir);
}
void FirstTimeDialog::on_buttonBox_accepted()
{
if (!pathChanged)
QDir("/").mkdir(savePath);
}
void FirstTimeDialog::on_versionsCheckBox_toggled(bool checked)
{
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(checked);
}
void FirstTimeDialog::on_classicCheckBox_toggled(bool checked)
{
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(checked);
}
void FirstTimeDialog::on_nwaCheckBox_toggled(bool checked)
{
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(checked);
}