-
Notifications
You must be signed in to change notification settings - Fork 0
/
startupmenu.cpp
92 lines (81 loc) · 3.03 KB
/
startupmenu.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
90
91
92
#include "startupmenu.h"
#include "ui_startupmenu.h"
#include <QSettings>
#include <QFileDialog>
#include <QDebug>
StartupMenu::StartupMenu(QWidget *parent) :
QDialog(parent),
ui(new Ui::StartupMenu)
{
ui->setupUi(this);
QSettings settings("TeamLamhauge", "daStoryboard");
mLastFolder = settings.value("lastProjPath", "").toString();
mProjectPath = settings.value("project", "").toString();
ui->labProject->setText(mProjectPath);
mStoryBoardPath = settings.value("storyboard", "").toString();
ui->labStoryboard->setText(mStoryBoardPath);
settings.setValue("ratio", "Standard");
settings.setValue("fps", 25);
if (mProjectPath.isEmpty() || mStoryBoardPath.isEmpty())
ui->btnReady->setEnabled(false);
connect(ui->btnSelectProject, &QPushButton::clicked, this, &StartupMenu::getProjectName);
connect(ui->btnSelectStoryboard, &QPushButton::clicked, this, &StartupMenu::getStoryboardName);
connect(ui->btnReady, &QPushButton::clicked, this, &StartupMenu::close);
connect(ui->sbFPS, QOverload<int>::of(&QSpinBox::valueChanged), this, &StartupMenu::setFps);
connect(ui->rbHD, &QRadioButton::toggled, this, &StartupMenu::setRatio);
connect(ui->rbStandard, &QRadioButton::toggled, this, &StartupMenu::setRatio);
}
StartupMenu::~StartupMenu()
{
delete ui;
}
void StartupMenu::getProjectName()
{
mProjectPath = QFileDialog::getExistingDirectory(this,
tr("Select/Create project folder"),
mLastFolder,
QFileDialog::ShowDirsOnly);
if (!mProjectPath.isEmpty())
{
mLastFolder = mProjectPath;
ui->labProject->setText(mProjectPath);
QSettings settings("TeamLamhauge", "daStoryboard");
settings.setValue("project", mProjectPath);
checkProgress();
}
}
void StartupMenu::getStoryboardName()
{
mStoryBoardPath = QFileDialog::getExistingDirectory(this,
tr("Select/Create storyboard folder"),
mLastFolder,
QFileDialog::ShowDirsOnly);
if (!mStoryBoardPath.isEmpty())
{
mLastFolder = mStoryBoardPath;
ui->labStoryboard->setText(mStoryBoardPath);
QSettings settings("TeamLamhauge", "daStoryboard");
settings.setValue("storyboard", mStoryBoardPath);
checkProgress();
}
}
void StartupMenu::setFps(int fps)
{
QSettings settings("TeamLamhauge", "daStoryboard");
settings.setValue("fps", fps);
}
void StartupMenu::setRatio()
{
QSettings settings("TeamLamhauge", "daStoryboard");
if (ui->rbStandard->isChecked())
settings.setValue("ratio", "Standard");
else
settings.setValue("ratio", "HD");
}
void StartupMenu::checkProgress()
{
if (mProjectPath != mStoryBoardPath && mStoryBoardPath.startsWith(mProjectPath))
ui->btnReady->setEnabled(true);
else
ui->btnReady->setEnabled(false);
}