Stellarium 0.14.3
Scenery3dDialog_p.hpp
1 /*
2  * Stellarium Scenery3d Plug-in
3  *
4  * Copyright (C) 2011-2015 Simon Parzer, Peter Neubauer, Georg Zotti, Andrei Borza, Florian Schaukowitsch
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) 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
18  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
19  */
20 
21 #ifndef _SCENERY3DDIALOG_P_HPP_
22 #define _SCENERY3DDIALOG_P_HPP_
23 
24 #include "S3DEnum.hpp"
25 #include "Scenery3dMgr.hpp"
26 
27 #include "StelApp.hpp"
28 #include "StelModuleMgr.hpp"
29 #include "StelTranslator.hpp"
30 
31 #include <QAbstractListModel>
32 
33 class CubemapModeListModel : public QAbstractListModel
34 {
35  Q_OBJECT
36 private:
37  Scenery3dMgr* mgr;
38 public:
39 
40 
41  CubemapModeListModel(QObject* parent = NULL) : QAbstractListModel(parent)
42  {
43  mgr = GETSTELMODULE(Scenery3dMgr);
44  Q_ASSERT(mgr);
45  }
46 
47  int rowCount(const QModelIndex &parent) const
48  {
49  Q_UNUSED(parent);
50  if(mgr->getIsANGLE())
51  {
52  return 1;
53  }
54  if(!mgr->getIsGeometryShaderSupported())
55  {
56  return 2;
57  }
58  return 3;
59  }
60 
61  QVariant data(const QModelIndex &index, int role) const
62  {
63  if(role == Qt::DisplayRole || role == Qt::EditRole)
64  {
65  switch (index.row())
66  {
67  case S3DEnum::CM_TEXTURES:
68  return QVariant(QString(q_("6 Textures")));
69  case S3DEnum::CM_CUBEMAP:
70  return QVariant(QString(q_("Cubemap")));
71  case S3DEnum::CM_CUBEMAP_GSACCEL:
72  return QVariant(QString(q_("Geometry shader")));
73  }
74  }
75  return QVariant();
76  }
77 };
78 
79 
80 #endif
#define q_(str)
Main class of the module, inherits from StelModule.