Developer documentation | Axl-2.5.1

axlInspectorSidePane.cpp
Go to the documentation of this file.
1 /* axlInspectorSidePane.cpp ---
2  *
3  * Author: Julien Wintz
4  * Copyright (C) 2008 - Julien Wintz, Inria.
5  * Created: Tue Mar 15 14:09:00 2011 (+0100)
6  * Version: $Id$
7  * Last-Updated: Wed Nov 9 16:22:02 2011 (+0100)
8  * By: Julien Wintz
9  * Update #: 54
10  */
11 
12 /* Commentary:
13  *
14  */
15 
16 /* Change log:
17  *
18  */
19 
20 #include "axlInspectorSidePane.h"
21 
22 #include <dtkCoreSupport/dtkGlobal.h>
23 
24 #include <dtkGuiSupport/dtkSpacer.h>
25 
26 #include <QtGui>
27 
28 class axlInspectorSidePanePrivate
29 {
30 public:
31  QAction *side_pane_action_world_camera;
32  QAction *side_pane_action_object_camera;
33  QAction *side_pane_action_joystick_interactor;
34  QAction *side_pane_action_trackball_interactor;
35  QAction *side_pane_action_settings;
36  QAction *side_pane_action_switch_fullScreen_normal;
37 };
38 
39 axlInspectorSidePane::axlInspectorSidePane(QWidget *parent) : QToolBar(parent), d(new axlInspectorSidePanePrivate)
40 {
41  d->side_pane_action_world_camera = new QAction("World mode", this);
42  d->side_pane_action_world_camera->setShortcut(Qt::Key_C);
43  d->side_pane_action_world_camera->setCheckable(true);
44  d->side_pane_action_world_camera->setChecked(true);
45  d->side_pane_action_world_camera->setToolTip("Set world mode");
46  d->side_pane_action_world_camera->setIcon(QPixmap(":axlGui/pixmaps/video-camera.png"));
47 
48  d->side_pane_action_object_camera = new QAction("Object mode", this);
49  d->side_pane_action_object_camera->setShortcut(Qt::Key_A);
50  d->side_pane_action_object_camera->setCheckable(true);
51  d->side_pane_action_object_camera->setChecked(false);
52  d->side_pane_action_object_camera->setToolTip("Set object mode");
53  d->side_pane_action_object_camera->setIcon(QPixmap(":axlGui/pixmaps/emblem-generic.png"));
54 
55  d->side_pane_action_trackball_interactor = new QAction("Trackball mode", this);
56  d->side_pane_action_trackball_interactor->setShortcut(Qt::Key_T);
57  d->side_pane_action_trackball_interactor->setCheckable(true);
58  d->side_pane_action_trackball_interactor->setChecked(true);
59  d->side_pane_action_trackball_interactor->setToolTip("Set trackball mode");
60  d->side_pane_action_trackball_interactor->setIcon(QPixmap(":axlGui/pixmaps/applications-science.png"));
61 
62  d->side_pane_action_joystick_interactor = new QAction("Joystick mode", this);
63  d->side_pane_action_joystick_interactor->setShortcut(Qt::Key_J);
64  d->side_pane_action_joystick_interactor->setCheckable(true);
65  d->side_pane_action_joystick_interactor->setChecked(false);
66  d->side_pane_action_joystick_interactor->setToolTip("Set joytick mode");
67  d->side_pane_action_joystick_interactor->setIcon(QPixmap(":axlGui/pixmaps/applications-games.png"));
68 
69  d->side_pane_action_settings = new QAction("Setting...", this);
70  d->side_pane_action_settings->setShortcut(Qt::ControlModifier + Qt::AltModifier + Qt::Key_I);
71  d->side_pane_action_settings->setCheckable(true);
72  d->side_pane_action_settings->setChecked(false);
73  d->side_pane_action_settings->setToolTip("Configure Axel");
74  d->side_pane_action_settings->setIcon(QPixmap(":axlGui/pixmaps/applications-engineering.png"));
75 
76  d->side_pane_action_switch_fullScreen_normal = new QAction(QIcon(QPixmap(":axlGui/pixmaps/view-fullscreen.png")), QString("Show fullscreen"), this);
77  d->side_pane_action_switch_fullScreen_normal->setShortcut(Qt::ControlModifier + Qt::Key_F);
78 
79  QActionGroup *camera_action_group = new QActionGroup(this);
80  camera_action_group->addAction(d->side_pane_action_world_camera);
81  camera_action_group->addAction(d->side_pane_action_object_camera);
82  camera_action_group->setExclusive(true);
83 
84  QActionGroup *interactor_action_group = new QActionGroup(this);
85  interactor_action_group->addAction(d->side_pane_action_trackball_interactor);
86  interactor_action_group->addAction(d->side_pane_action_joystick_interactor);
87  interactor_action_group->setExclusive(true);
88 
89  QAction *inspectorAction = new QAction("Inspector", this);
90  inspectorAction->setIcon(QIcon(":axlGui/pixmaps/info2.png"));
91  inspectorAction->setShortcut(Qt::ControlModifier + Qt::Key_I);
92  inspectorAction->setCheckable(true);
93  inspectorAction->setChecked(false);
94 
95  this->addAction(inspectorAction);
96  this->addWidget(new dtkSpacer(this, 0, 50));
97  this->addAction(d->side_pane_action_world_camera);
98  this->addAction(d->side_pane_action_object_camera);
99  this->addAction(d->side_pane_action_trackball_interactor);
100  this->addAction(d->side_pane_action_joystick_interactor);
101  this->addWidget(new dtkSpacer(this));
102  this->addAction(d->side_pane_action_settings);
103  this->addWidget(new dtkSpacer(this, 0, 50));
104  this->addAction(d->side_pane_action_switch_fullScreen_normal);
105 
106  this->setFloatable(false);
107  this->setIconSize(QSize(24, 24));
108  this->setMovable(false);
109  this->setOrientation(Qt::Vertical);
110  this->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
111  this->setStyleSheet(dtkReadFile(":axlGui/axlInspectorSidePane.qss"));
112 
113  connect(d->side_pane_action_world_camera, SIGNAL(triggered()), this, SIGNAL(worldCamera()));
114  connect(d->side_pane_action_object_camera, SIGNAL(triggered()), this, SIGNAL(objectCamera()));
115  connect(d->side_pane_action_trackball_interactor, SIGNAL(triggered()), this, SIGNAL(trackballCamera()));
116  connect(d->side_pane_action_joystick_interactor, SIGNAL(triggered()), this, SIGNAL(joystickCamera()));
117  connect(d->side_pane_action_settings, SIGNAL(triggered(bool)), this, SIGNAL(showSettings(bool)));
118  connect(d->side_pane_action_switch_fullScreen_normal, SIGNAL(triggered()), this, SIGNAL(switchFullScreen()));
119 
120  connect(inspectorAction, SIGNAL(triggered(bool)), this, SIGNAL(showInspector(bool)));
121 }
122 
124 {
125  delete d;
126 
127  d = NULL;
128 }
129 
131 {
132  return QSize(30, 100);
133 }
void objectCamera(void)
axlInspectorSidePane(QWidget *parent=0)
void showSettings(bool)
void trackballCamera(void)
void joystickCamera(void)
QSize sizeHint(void) const
void worldCamera(void)
void switchFullScreen(void)
void showInspector(bool)