diff options
author | Robert Bieber <robby@bieberphoto.com> | 2010-07-15 21:39:09 +0000 |
---|---|---|
committer | Robert Bieber <robby@bieberphoto.com> | 2010-07-15 21:39:09 +0000 |
commit | c272144867f94dc7e99f8333bec5dd052878ecd8 (patch) | |
tree | 6ceb4ce5111b05da666ab2c0a1fda571d84ccd42 /utils/themeeditor/gui/newprojectdialog.cpp | |
parent | e700e195d88f09a94fe681fd2906564ade2be0d0 (diff) | |
download | rockbox-c272144867f94dc7e99f8333bec5dd052878ecd8.tar.gz rockbox-c272144867f94dc7e99f8333bec5dd052878ecd8.zip |
Theme Editor: Added New Project feature
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27439 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/themeeditor/gui/newprojectdialog.cpp')
-rw-r--r-- | utils/themeeditor/gui/newprojectdialog.cpp | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/utils/themeeditor/gui/newprojectdialog.cpp b/utils/themeeditor/gui/newprojectdialog.cpp new file mode 100644 index 0000000000..50a8bc4631 --- /dev/null +++ b/utils/themeeditor/gui/newprojectdialog.cpp | |||
@@ -0,0 +1,105 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2010 Robert Bieber | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #include "newprojectdialog.h" | ||
23 | #include "ui_newprojectdialog.h" | ||
24 | |||
25 | #include <QSettings> | ||
26 | #include <QFileDialog> | ||
27 | #include <QDir> | ||
28 | |||
29 | NewProjectDialog::NewProjectDialog(QWidget *parent) : | ||
30 | QDialog(parent), | ||
31 | ui(new Ui::NewProjectDialog) | ||
32 | { | ||
33 | ui->setupUi(this); | ||
34 | |||
35 | /* Getting the default directory from the application settings */ | ||
36 | QSettings settings; | ||
37 | settings.beginGroup("NewProjectDialog"); | ||
38 | |||
39 | ui->locationBox->setText(settings.value("defaultDir", | ||
40 | QDir::home().absolutePath()) | ||
41 | .toString()); | ||
42 | |||
43 | settings.endGroup(); | ||
44 | |||
45 | /* Connecting the browse button */ | ||
46 | QObject::connect(ui->browseButton, SIGNAL(clicked()), | ||
47 | this, SLOT(browse())); | ||
48 | } | ||
49 | |||
50 | NewProjectDialog::~NewProjectDialog() | ||
51 | { | ||
52 | delete ui; | ||
53 | } | ||
54 | |||
55 | void NewProjectDialog::accept() | ||
56 | { | ||
57 | status.name = ui->nameBox->text(); | ||
58 | status.path = ui->locationBox->text(); | ||
59 | status.sbs = ui->sbsBox->isChecked(); | ||
60 | status.wps = ui->wpsBox->isChecked(); | ||
61 | status.fms = ui->fmsBox->isChecked(); | ||
62 | status.rsbs = ui->rsbsBox->isChecked(); | ||
63 | status.rwps = ui->rwpsBox->isChecked(); | ||
64 | status.rfms = ui->rfmsBox->isChecked(); | ||
65 | |||
66 | QSettings settings; | ||
67 | settings.beginGroup("NewProjectDialog"); | ||
68 | |||
69 | settings.setValue("defaultDir", ui->locationBox->text()); | ||
70 | |||
71 | settings.endGroup(); | ||
72 | |||
73 | QDialog::accept(); | ||
74 | } | ||
75 | |||
76 | void NewProjectDialog::reject() | ||
77 | { | ||
78 | ui->nameBox->setText(status.name); | ||
79 | ui->locationBox->setText(status.path); | ||
80 | ui->sbsBox->setChecked(status.sbs); | ||
81 | ui->wpsBox->setChecked(status.wps); | ||
82 | ui->fmsBox->setChecked(status.fms); | ||
83 | ui->rsbsBox->setChecked(status.rsbs); | ||
84 | ui->rwpsBox->setChecked(status.rwps); | ||
85 | ui->rfmsBox->setChecked(status.rfms); | ||
86 | |||
87 | QSettings settings; | ||
88 | settings.beginGroup("NewProjectDialog"); | ||
89 | |||
90 | ui->locationBox->setText(settings.value("defaultDir", | ||
91 | QDir::home().absolutePath()) | ||
92 | .toString()); | ||
93 | |||
94 | settings.endGroup(); | ||
95 | |||
96 | QDialog::reject(); | ||
97 | } | ||
98 | |||
99 | void NewProjectDialog::browse() | ||
100 | { | ||
101 | QString path; | ||
102 | path = QFileDialog::getExistingDirectory(this, "New Project Location", | ||
103 | ui->locationBox->text()); | ||
104 | ui->locationBox->setText(path); | ||
105 | } | ||