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
|
/***************************************************************************
* Copyright (C) 2005-2006 Nicolas Hadacek <hadacek@kde.org> *
* Copyright (C) 2003 Alain Gibaud <alain.gibaud@free.fr> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#include "project_editor.h"
#include <qlabel.h>
#include <qlayout.h>
#include <klocale.h>
#include "project.h"
#include "tools/list/compile_config.h"
#include "device_gui.h"
ProjectEditor::ProjectEditor(Project &project, QWidget *parent)
: Dialog(parent, "project_options", true, i18n("Project Options"), Ok|Cancel, Ok, false),
_project(project)
{
QVBoxLayout *top = new QVBoxLayout(mainWidget(), 0, 10);
TabWidget *tabWidget = new TabWidget(mainWidget());
top->addWidget(tabWidget);
// global
QWidget *tab = new QWidget(tabWidget);
tabWidget->addTab(tab, i18n("General"));
QGridLayout *grid = new QGridLayout(tab, 0, 0, 10, 10);
QLabel *label = new QLabel(i18n("Name:"), tab);
grid->addWidget(label, 0, 0);
label = new QLabel(project.name(), tab);
grid->addWidget(label, 0, 1);
label = new QLabel(i18n("Description:"), tab);
grid->addWidget(label, 1, 0);
_description = new QTextEdit(tab);
_description->setText(_project.description());
grid->addMultiCellWidget(_description, 1,1, 1,2);
label = new QLabel(i18n("Version:"), tab);
grid->addWidget(label, 2, 0);
_version = new QLineEdit(tab);
_version->setText(_project.version());
grid->addWidget(_version, 2, 1);
label = new QLabel(i18n("Device:"), tab);
grid->addWidget(label, 3, 0);
_device = new DeviceChooser::Button(false, tab);
_device->setDevice(Compile::Config::device(&_project));
grid->addWidget(_device, 3, 1);
grid->setRowStretch(4, 1);
grid->setColStretch(2, 1);
// toochain
tab = new QWidget(tabWidget);
tabWidget->addTab(tab, i18n("Toochain"));
grid = new QGridLayout(tab, 0, 0, 10, 10);
_tools = new ToolsConfigWidget(&project, tab);
_tools->loadConfig();
grid->addMultiCellWidget(_tools, 0,0, 0,2);
grid->setRowStretch(1, 1);
grid->setColStretch(2, 1);
}
void ProjectEditor::slotOk()
{
_project.setDescription(_description->text());
_project.setVersion(_version->text());
Compile::Config::setDevice(&_project, _device->device());
_tools->saveConfig();
accept();
}
|