Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/gui/qt/gui_video.cc @ 8261

Last change on this file since 8261 was 8145, checked in by bensch, 19 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: 4.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
[4047]27#include "gui_video.h"
[7484]28
[7534]29#include <QtGui/QLayout>
[7598]30#include "globals.h"
[7481]31#include "debug.h"
[3624]32
[7547]33#include "qt_gui_elements.h"
[7484]34
[7481]35namespace OrxGui
[2018]36{
[7481]37  /**
38   *  Creates the Video-Option-Frame
39  */
[7549]40  GuiVideo::GuiVideo(OrxGui::Gui* gui)
[7598]41  : Element(CONFIG_SECTION_VIDEO, gui), QGroupBox()
[4064]42  {
[7484]43    QGridLayout* layout = new QGridLayout(this);
[7493]44
[7484]45    {
[7632]46      QtGuiCheckBox* fullscreen = new QtGuiCheckBox(CONFIG_NAME_FULLSCREEN, this, false);
[7484]47      //fullscreen->setName();
[7493]48      layout->addWidget(fullscreen, 0, 0);
[7484]49
[7632]50      QtGuiCheckBox* wireframe = new QtGuiCheckBox(CONFIG_NAME_WIREFRAME, this, false);
[7493]51      layout->addWidget(wireframe, 1, 0);
52
[7529]53      {
[7632]54        QComboBox* resolution = new QtGuiComboBox(CONFIG_NAME_RESOLUTION, this, "640x480");
[7639]55        resolution->setEditable(true);
[7529]56        layout->addWidget(resolution, 2, 0);
[7531]57        std::vector<QString> resolutions;
[7529]58        this->getResolutions(resolutions);
59        for (unsigned int i = 0; i < resolutions.size(); ++i)
[7534]60          resolution->addItem(resolutions[i]);
[7529]61      }
[7493]62
[7484]63
[7598]64      QGroupBox* advanced = new GuiAdvancedVideo(gui);
[4064]65
[7598]66
[7547]67      layout->addWidget(advanced, 0, 2, 4, 1);
[7481]68
[4064]69    }
70  }
[2018]71
[7481]72  /**
73   *  Destructs the Video-stuff
74  */
75  GuiVideo::~GuiVideo()
76  {
77    // nothing to do here.
78  }
[3423]79
[7481]80  /**
81   *  sets all resolutions to the menu
82   * @param menu the Menu to set The resolutions to.
83  */
[7531]84  void GuiVideo::getResolutions(std::vector<QString>& resolutionList)
[4064]85  {
[7481]86    SDL_Init(SDL_INIT_VIDEO);
87    SDL_Rect **modes;
88    int i;
89    int x = 0,y =0; // check for difference
90    char tmpChar[100];
[3423]91
[7481]92    /* Get available fullscreen/hardware modes */
93    modes=SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_HWSURFACE);
94
95    /* Check is there are any modes available */
96    if(modes == (SDL_Rect **)0)
[4064]97    {
[7481]98      PRINTF(2)("No video-modes available!\n");
99      exit(-1);
100    }
[3423]101
[7481]102    /* Check if our resolution is restricted */
103    if(modes == (SDL_Rect **)-1)
104    {
105      PRINTF(2)("All resolutions available.\n");
[4064]106    }
[7481]107    else
108    {
109      /* Print valid modes */
110      PRINT(5)("Available Modes\n");
111      for(i = 0; modes[i] ;++i)
[3624]112      {
[4777]113        if (x != modes[i]->w || y != modes[i]->h)
[7481]114        {
115          PRINTF(5)("  %d x %d\n", modes[i]->w, modes[i]->h);
116          sprintf(tmpChar, "%dx%d", modes[i]->w, modes[i]->h);
[7534]117          resolutionList.push_back(QString(tmpChar));
[7481]118          x = modes[i]->w; y = modes[i]->h;
119        }
[3624]120      }
[7481]121    }
122    SDL_QuitSubSystem(SDL_INIT_VIDEO);
123    SDL_Quit();
[3624]124  }
[7481]125
[7598]126
127
128  GuiAdvancedVideo::GuiAdvancedVideo(OrxGui::Gui* gui)
129  : Element(CONFIG_SECTION_VIDEO_ADVANCED ,gui)
130  {
131    {
132      QGridLayout* advLayout = new QGridLayout(this);              //!< Advanced Layout
133      {
[7633]134        QtGuiCheckBox* shadows = new QtGuiCheckBox(CONFIG_NAME_SHADOWS, this, true);         //!< CheckBox for shadows
[7598]135        advLayout->addWidget(shadows, 0,0);
[7633]136        QtGuiCheckBox* fog = new QtGuiCheckBox(CONFIG_NAME_FOG, this, true);                 //!< CheckBox for fog.
[7598]137        advLayout->addWidget(fog, 1,0);
[7633]138        QtGuiCheckBox* reflections = new QtGuiCheckBox(CONFIG_NAME_REFLECTIONS, this, true);  //!< CheckBox for reflections
[7598]139        advLayout->addWidget(reflections, 2, 0);
[7633]140        QtGuiCheckBox* textures = new QtGuiCheckBox(CONFIG_NAME_TEXTURES, this, true);       //!< CheckBox for textures
[7598]141        advLayout->addWidget(textures, 3, 0);
142          /*
143        Menu* textureDetail;      //!< Menu for the Texture-Detail.
144        Label* modelDetailLabel;  //!< Label for model-detail.
145        Menu* modelDetail;        //!< model-detail.
146        CheckBox* particles;   //!< If the Particles should be enabled
147        Label* antiAliasingLabel; //!< Label for the anti-aliasing mode.
148        Menu* antiAliasing;       //!< Menu for the Antialiasing-mode.
149        Label* filterMethodLabel; //!< Label for filtering-Method.
150        Menu* filterMethod;       //!< Menu for filtering Method.
151        Button* closeButton;      //!< A Button to close the Advanced-settingsWindow.
152          */
153      }
154    }
155  }
156
157  GuiAdvancedVideo::~GuiAdvancedVideo()
158  {
159  }
160
[3624]161}
Note: See TracBrowser for help on using the repository browser.