Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/qt_gui/src/lib/gui/qt_gui/gui_general.cc @ 7603

Last change on this file since 7603 was 7603, checked in by bensch, 18 years ago

DataDirectory-selection works

File size: 2.5 KB
Line 
1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
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, or (at your option)
9   any later version.
10
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.
15
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 Foundation,
18   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
20
21   ### File Specific:
22   main-programmer: Benjamin Grauer
23
24*/
25
26
27#include "gui_general.h"
28
29#include <QtGui/QLayout>
30#include <QtGui/QFileDialog>
31
32#include "debug.h"
33#include "globals.h"
34
35#include "qt_gui_elements.h"
36
37namespace OrxGui
38{
39  /**
40   *  Creates the General-Option-Frame
41  */
42  GuiGeneral::GuiGeneral(OrxGui::Gui* gui)
43  : Element(CONFIG_SECTION_GENERAL, gui), QGroupBox()
44  {
45    QGridLayout* layout = new QGridLayout(this);
46    {
47      QLabel* dataDirLabel = new QLabel("DataDirectory");
48      layout->addWidget(dataDirLabel, 0,0);
49      this->dataDir = new QtGuiInputLine(CONFIG_NAME_DATADIR, this);
50      layout->addWidget(dataDir, 0, 1, 1, 2);
51      QPushButton* dataFileDialogButton = new QPushButton("browse");
52      layout->addWidget(dataFileDialogButton, 0, 3, 1, 1);
53      connect(dataFileDialogButton, SIGNAL(released()), this, SLOT(openDataFileDialog()));
54
55
56      QLabel* debugLabel = new QLabel("debug-mode");
57      layout->addWidget(debugLabel, 1,0);
58      QtGuiComboBox* debug = new QtGuiComboBox(CONFIG_NAME_DEBUG_LEVEL, this);
59      layout->addWidget(debug, 1, 1, 1, 2);
60
61      debug->addItem("0 - minimal");
62      debug->addItem("1 - errors");
63      debug->addItem("2 - warnings");
64      debug->addItem("3 - information");
65      debug->addItem("4 - debug");
66      debug->addItem("5 - extremely debug");
67    }
68  }
69
70  /**
71   *  Destructs the General-stuff
72  */
73  GuiGeneral::~GuiGeneral()
74  {
75    // nothing to do here.
76  }
77
78  void GuiGeneral::openDataFileDialog()
79  {
80    QString s = QFileDialog::getOpenFileName(
81        this,
82    "Choose the ORXONOX DATA DIRECTORY",
83    ".",
84    "ORXONOX DATA INDEX (" DEFAULT_DATA_DIR_CHECKFILE ")" );
85
86    s.remove("data.oxd");
87    if (!s.isNull())
88      this->dataDir->setText(s);
89  }
90
91
92}
Note: See TracBrowser for help on using the repository browser.