3 Copyright (c) 2012 Jakob Leben & Tim Blechmann
4 http://www.audiosynth.com
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 #include "ui_settings_dialog.h"
23 #include "general_page.hpp"
24 #include "sclang_page.hpp"
25 #include "editor_page.hpp"
26 #include "shortcuts_page.hpp"
27 #include "../../core/settings/manager.hpp"
28 #include "../../core/main.hpp"
30 #include <QVBoxLayout>
31 #include <QHBoxLayout>
32 #include <QDialogButtonBox>
33 #include <QStackedWidget>
34 #include <QListWidget>
37 #include <QPushButton>
39 namespace ScIDE
{ namespace Settings
{
41 Dialog::Dialog( Manager
*settings
, QWidget
* parent
):
44 ui( new Ui::ConfigDialog
)
51 ui
->configPageStack
->addWidget(w
);
52 ui
->configPageList
->addItem (
53 new QListWidgetItem(QIcon::fromTheme("preferences-system"), "General"));
54 connect(this, SIGNAL(storeRequest(Manager
*)), w
, SLOT(store(Manager
*)));
55 connect(this, SIGNAL(loadRequest(Manager
*)), w
, SLOT(load(Manager
*)));
58 ui
->configPageStack
->addWidget(w
);
59 ui
->configPageList
->addItem (
60 new QListWidgetItem(QIcon::fromTheme("applications-system"), "Interpreter"));
61 connect(this, SIGNAL(storeRequest(Manager
*)), w
, SLOT(store(Manager
*)));
62 connect(this, SIGNAL(loadRequest(Manager
*)), w
, SLOT(load(Manager
*)));
65 ui
->configPageStack
->addWidget(w
);
66 ui
->configPageList
->addItem (
67 new QListWidgetItem(QIcon::fromTheme("accessories-text-editor"), "Editor"));
68 connect(this, SIGNAL(storeRequest(Manager
*)), w
, SLOT(store(Manager
*)));
69 connect(this, SIGNAL(loadRequest(Manager
*)), w
, SLOT(load(Manager
*)));
71 w
= new ShortcutsPage
;
72 ui
->configPageStack
->addWidget(w
);
73 ui
->configPageList
->addItem (
74 new QListWidgetItem(QIcon::fromTheme("input-keyboard"), "Shortcuts"));
75 connect(this, SIGNAL(storeRequest(Manager
*)), w
, SLOT(store(Manager
*)));
76 connect(this, SIGNAL(loadRequest(Manager
*)), w
, SLOT(load(Manager
*)));
78 connect(ui
->buttonBox
, SIGNAL(accepted()), this, SLOT(accept()));
79 connect(ui
->buttonBox
, SIGNAL(rejected()), this, SLOT(reject()));
80 connect(ui
->buttonBox
->button(QDialogButtonBox::Apply
), SIGNAL(clicked()), this, SLOT(apply()));
81 connect(ui
->buttonBox
->button(QDialogButtonBox::Reset
), SIGNAL(clicked()), this, SLOT(reset()));
93 Q_EMIT( storeRequest(mManager
) );
105 Q_EMIT( storeRequest(mManager
) );
106 Main::instance()->applySettings();
111 Q_EMIT( loadRequest(mManager
) );
114 }} // namespace ScIDE::Settings