Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/gui/qt/gui_general.cc @ 8192

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

trunk: merged the gui back
merged with command:
svn merge -r8114:HEAD https://svn.orxonox.net/orxonox/branches/gui .
→ no conflicts

File size: 2.8 KB
RevLine 
[4777]1/*
[2581]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,
[4777]18   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
[2581]19
20
21   ### File Specific:
22   main-programmer: Benjamin Grauer
23
24*/
25
26
[7585]27#include "gui_general.h"
[7484]28
[7534]29#include <QtGui/QLayout>
[7593]30#include <QtGui/QFileDialog>
31
[7481]32#include "debug.h"
[7601]33#include "globals.h"
[3624]34
[7539]35#include "qt_gui_elements.h"
[7484]36
[7481]37namespace OrxGui
[2018]38{
[7481]39  /**
[7585]40   *  Creates the General-Option-Frame
[7481]41  */
[7585]42  GuiGeneral::GuiGeneral(OrxGui::Gui* gui)
[8144]43  : QGroupBox(), Element(CONFIG_SECTION_GENERAL, gui)
[4064]44  {
[7484]45    QGridLayout* layout = new QGridLayout(this);
46    {
[7585]47      QLabel* dataDirLabel = new QLabel("DataDirectory");
48      layout->addWidget(dataDirLabel, 0,0);
[7632]49      this->dataDir = new QtGuiInputLine(CONFIG_NAME_DATADIR, this, DEFAULT_DATA_DIR);
[7585]50      layout->addWidget(dataDir, 0, 1, 1, 2);
[7593]51      QPushButton* dataFileDialogButton = new QPushButton("browse");
52      layout->addWidget(dataFileDialogButton, 0, 3, 1, 1);
53      connect(dataFileDialogButton, SIGNAL(released()), this, SLOT(openDataFileDialog()));
[7484]54
[7593]55
[7585]56      QLabel* debugLabel = new QLabel("debug-mode");
57      layout->addWidget(debugLabel, 1,0);
[7632]58      QtGuiComboBox* debug = new QtGuiComboBox(CONFIG_NAME_DEBUG_LEVEL, this, "3 - information");
[7585]59      layout->addWidget(debug, 1, 1, 1, 2);
[7493]60
[7585]61      debug->addItem("0 - minimal");
[7855]62#if DEBUG_LEVEL >=1
[7585]63      debug->addItem("1 - errors");
[7640]64#endif
[7855]65#if DEBUG_LEVEL >=2
[7585]66      debug->addItem("2 - warnings");
[7640]67#endif
[7855]68#if DEBUG_LEVEL >=3
[7585]69      debug->addItem("3 - information");
[7640]70#endif
[7855]71#if DEBUG_LEVEL >=4
[7585]72      debug->addItem("4 - debug");
[7640]73#endif
[7855]74#if DEBUG_LEVEL >=5
[7585]75      debug->addItem("5 - extremely debug");
[7640]76#endif
[7484]77    }
[4064]78  }
[2018]79
[7481]80  /**
[7585]81   *  Destructs the General-stuff
[7481]82  */
[7585]83  GuiGeneral::~GuiGeneral()
[7481]84  {
85    // nothing to do here.
86  }
[3423]87
[7593]88  void GuiGeneral::openDataFileDialog()
89  {
[7634]90    QString browsePath = this->dataDir->text();
91    if (browsePath.isEmpty())
92      browsePath = ".";
93
[7593]94    QString s = QFileDialog::getOpenFileName(
[7640]95                  this,
96                  "Choose the ORXONOX DATA DIRECTORY",
97                  browsePath,
98                  "ORXONOX DATA INDEX (" DEFAULT_DATA_DIR_CHECKFILE ")" );
[7603]99
100    s.remove("data.oxd");
101    if (!s.isNull())
102      this->dataDir->setText(s);
[7593]103  }
[3423]104
[7593]105
[3624]106}
Note: See TracBrowser for help on using the repository browser.