VAPOR3 3.9.4
TabManager.h
Go to the documentation of this file.
1//************************************************************************
2// *
3// Copyright (C) 2004 *
4// University Corporation for Atmospheric Research *
5// All Rights Reserved *
6// *
7//************************************************************************/
8//
9// File: TabManager.h
10//
11// Author: Alan Norton
12// National Center for Atmospheric Research
13// PO 3000, Boulder, Colorado
14//
15// Date: May 2015
16//
17// Description: Defines the TabManager class. This is the QTabWidget
18// that contains a tab for each of the Params classes
19//
20#ifndef TABMANAGER_H
21#define TABMANAGER_H
22#include <qtabwidget.h>
23#include <qwidget.h>
24#include <QKeyEvent>
25
27#include <vapor/ParamsMgr.h>
28#include <AnimationTab.h>
29#include <ViewpointTab.h>
32#include <QComboBox>
33class EventRouter;
34class RenderersPanel;
35
42
68
72//
73class TabManager : public QTabWidget {
74 Q_OBJECT
75
76public:
78
80 //
81 void Update();
82
86 //
87 void MoveToFront(string subTabName);
88
94 //
95 vector<string> GetInstalledTabNames(bool renderOnly) const;
96
97 virtual void GetWebHelp(string tabName, std::vector<std::pair<string, string>> &help) const;
98
100 //
101 void EnableRouters(bool onOff);
102 void Shutdown();
103 void Restart();
104 void Reinit();
105
108 void LoadDataNotify(string dataSetName);
109
110signals:
111
117 void ActiveEventRouterChanged(string type);
118
120 //
121 void Proj4StringChanged(string proj4String);
122
123public slots:
126 void ViewAll() { NavigationUtils::ViewAll(_controlExec); }
127 void AlignView(int axis)
128 {
129 NavigationUtils::AlignView(_controlExec, axis);
130
131 QComboBox *cb = (QComboBox *)sender();
132 cb->blockSignals(true);
133 cb->setCurrentIndex(0);
134 cb->blockSignals(false);
135 }
136
137protected slots:
138
139private slots:
140 void _setProj4String(string proj4String) { emit Proj4StringChanged(proj4String); }
141
145 void _setSubTab(int tabid);
146
149 //
150 void _setFrontTab(int tabnum);
151
152 void SetActiveViz(const QString &vizNameQ);
153
154private:
155 static const string _renderersTabName;
156 static const string _navigationTabName;
157 static const string _settingsTabName;
158
159 VAPoR::ControlExec *_controlExec;
160 RenderersPanel *_renderersPanel;
161
162 // ordered list of all top level tabs
163 //
164 std::vector<string> _tabNames;
165
166 // Top level tabs (widgets), one for each string in _tabNames
167 //
168 std::map<string, QWidget *> _tabWidgets;
169
170 // sub tabs - a vector of widgets for each top level tab
171 //
172 std::map<string, vector<QWidget *>> _subTabWidgets;
173 std::map<string, vector<string>> _subTabNames;
174
175 // Map top level widget name to current or previous subwidget name
176 //
177 std::map<string, string> _currentFrontSubTab;
178 std::map<string, string> _prevFrontSubTab;
179
180 string _currentFrontTab;
181 string _prevFrontTab;
182
183 // map tags to eventrouters
184 std::map<string, EventRouter *> _eventRouterMap;
185
186 bool _initialized;
187 AnimationTab * _animationEventRouter;
188 ViewpointTab * _navigationEventRouter;
189
190 TabManager() {}
191
192 virtual QSize sizeHint() const { return QSize(460, 800); }
193
194 // This prevents a "beep" from occuring when you press enter on the Mac.
195 virtual void keyPressEvent(QKeyEvent *e) { e->accept(); }
196
197 EventRouter *_getEventRouter(string erType) const;
198
199 // Find the position of the specified widget in subTab, or -1 if it isn't there.
200 //
201 int _getSubTabIndex(string tabName, string subTabName) const;
202 int _getSubTabIndex(string subTabName) const;
203 int _getTabIndex(string tabName) const;
204
205 string _getTabForSubTab(string subTabName) const;
206
207 QWidget *_getSubTabWidget(string subTabName) const;
208 QWidget *_getTabWidget(string tabName) const;
209
210 GUIStateParams *_getStateParams() const
211 {
212 VAssert(_controlExec != NULL);
213 VAPoR::ParamsMgr *paramsMgr = _controlExec->GetParamsMgr();
214 return ((GUIStateParams *)paramsMgr->GetParams(GUIStateParams::GetClassType()));
215 }
216
217 void _createAllDefaultTabs();
218
219 // method that creates an eventRouter, and installs it as one of the tabs.
220 // All extension EventRouter classes must call this during the
221 // InstallExtensions() method.
222 //
223 //
224 void _installTab(string tabName, string subTabName, EventRouter *eRouter);
225
226 void _registerEventRouter(const std::string subTabName, EventRouter *router);
227
228 // During initialization, after all the EventRouters have been created
229 // (and identified via _addSubTabWidget()), the installWidgets
230 // method must be called to set up the various widgets in each tab.
231 //
232 void _installWidgets();
233
234 // Method invoked by the VizWinMgr at the time all the EventRouters
235 // are created
236 // Each eventRouter and its associated tag are saved in arrays for
237 // subsequent use
238 //
239 // \param[in] evWid indicates the QWidget that is associated with
240 // an EventRouter
241 // \param[in] tag is the Params Tag associated with the EventRouter.
242 //
243 void _addSubTabWidget(QWidget *evWid, string Tag, string tagType);
244
245 void _updateRouters();
246};
247
248#endif // TABMANAGER_H
#define VAssert(expr)
Definition: VAssert.h:9
A pure virtual class specifying the common properties of all the parameter tabs in the VAPOR GUI.
Definition: EventRouter.h:107
static string GetClassType()
static void UseHomeViewpoint(ControlExec *ce)
static void ViewAll(ControlExec *ce)
static void AlignView(ControlExec *ce, int axis)
static void SetHomeViewpoint(ControlExec *ce)
A class that manages the contents of the parameter tabs in VAPOR GUI.
Definition: TabManager.h:73
void ActiveEventRouterChanged(string type)
virtual void GetWebHelp(string tabName, std::vector< std::pair< string, string > > &help) const
void Shutdown()
void UseHomeViewpoint()
Definition: TabManager.h:124
void Update()
Update from current state.
void Restart()
TabManager(QWidget *, VAPoR::ControlExec *ce)
void SetHomeViewpoint()
Definition: TabManager.h:125
void LoadDataNotify(string dataSetName)
void MoveToFront(string subTabName)
void Reinit()
void ViewAll()
Definition: TabManager.h:126
void EnableRouters(bool onOff)
Enable or disable widgets associated with all event routers.
void Proj4StringChanged(string proj4String)
Proj4 string changed.
void AlignView(int axis)
Definition: TabManager.h:127
vector< string > GetInstalledTabNames(bool renderOnly) const
Provides API for VAPOR visualizer User Interfaces (UIs)
ParamsMgr * GetParamsMgr() const
A singleton class for managing Params instances.
Definition: ParamsMgr.h:53
ParamsBase * GetParams(string classType)
Definition: ParamsMgr.h:371