summaryrefslogtreecommitdiffstats
path: root/src/libgui/project_editor.cpp
blob: e9568854eda9dc3a31ce4334adf8abf6503b5ecd (plain)
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
/***************************************************************************
 *   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 <tqlabel.h>
#include <tqlayout.h>
#include <tdelocale.h>

#include "project.h"
#include "tools/list/compile_config.h"
#include "device_gui.h"

ProjectEditor::ProjectEditor(Project &project, TQWidget *parent)
  : Dialog(parent, "project_options", true, i18n("Project Options"), Ok|Cancel, Ok, false),
    _project(project)
{
   TQVBoxLayout *top = new TQVBoxLayout(mainWidget(), 0, 10);
  TabWidget *tabWidget = new TabWidget(mainWidget());
  top->addWidget(tabWidget);

// global
  TQWidget *tab = new TQWidget(tabWidget);
  tabWidget->addTab(tab, i18n("General"));
  TQGridLayout *grid = new TQGridLayout(tab, 0, 0, 10, 10);
  TQLabel *label = new TQLabel(i18n("Name:"), tab);
  grid->addWidget(label, 0, 0);
  label = new TQLabel(project.name(), tab);
  grid->addWidget(label, 0, 1);
  label = new TQLabel(i18n("Description:"), tab);
  grid->addWidget(label, 1, 0);
  _description = new TQTextEdit(tab);
  _description->setText(_project.description());
  grid->addMultiCellWidget(_description, 1,1, 1,2);
  label = new TQLabel(i18n("Version:"), tab);
  grid->addWidget(label, 2, 0);
  _version = new TQLineEdit(tab);
  _version->setText(_project.version());
  grid->addWidget(_version, 2, 1);
  label = new TQLabel(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 TQWidget(tabWidget);
  tabWidget->addTab(tab, i18n("Toochain"));
  grid = new TQGridLayout(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();
}

#include "project_editor.moc"