ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ccGamepadManager.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 // ##########################################################################
10 // # #
11 // # CLOUDVIEWER #
12 // # #
13 // # This program is free software; you can redistribute it and/or modify #
14 // # it under the terms of the GNU General Public License as published by #
15 // # the Free Software Foundation; version 2 or later of the License. #
16 // # #
17 // # This program is distributed in the hope that it will be useful, #
18 // # but WITHOUT ANY WARRANTY; without even the implied warranty of #
19 // # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
20 // # GNU General Public License for more details. #
21 // # #
22 // # COPYRIGHT: ACloudViewer project #
23 // # #
24 // ##########################################################################
25 
26 #include "CVAppCommon.h"
27 
28 // Qt
29 #include <QObject>
30 
31 class QAction;
32 class QMenu;
33 class QString;
34 
36 class GamepadInput;
37 
39 class CVAPPCOMMON_LIB_API ccGamepadManager : public QObject {
40  Q_OBJECT
41 
42 public:
43  ccGamepadManager(ecvMainAppInterface* appInterface, QObject* parent);
45 
47  QMenu* menu() { return m_menu; }
48 
49 protected:
50  void enableDevice(bool state, bool silent, int deviceID = -1);
51  void releaseDevice();
52 
53  void showMessage(QString message, bool asWarning);
54  void setupMenu();
55  void setupGamepadInput();
56 
57  void onGamepadInput();
58 
59 private:
60  ecvMainAppInterface* m_appInterface;
61  GamepadInput* m_gamepadInput;
62  QMenu* m_menu;
63  QAction* m_actionEnable;
64 };
ecvMainAppInterface::increasePointSize
virtual void increasePointSize()=0
ccGamepadManager::ccGamepadManager
ccGamepadManager(ecvMainAppInterface *appInterface, QObject *parent)
Definition: ccGamepadManager.cpp:20
ccGamepadManager::onGamepadInput
void onGamepadInput()
Definition: ccGamepadManager.cpp:233
GamepadInput::stop
void stop()
Definition: GamepadInput.cpp:32
ccPickOneElementDlg::getSelectedIndex
int getSelectedIndex()
Returns the combo box current index (after completion)
Definition: ecvPickOneElementDlg.cpp:42
GamepadInput
Gaempad handler.
Definition: GamepadInput.h:41
ecvMainAppInterface::toggleActiveWindowViewerBasedPerspective
virtual void toggleActiveWindowViewerBasedPerspective()=0
ecvMainAppInterface::setGlobalZoom
virtual void setGlobalZoom()=0
ecvMainAppInterface::getMainWindow
virtual QMainWindow * getMainWindow()=0
Returns main window.
ccGamepadManager::menu
QMenu * menu()
Returns the menu associated with gamepads.
Definition: ccGamepadManager.h:47
CVLog::Print
static bool Print(const char *format,...)
Prints out a formatted message in console.
Definition: CVLog.cpp:113
ccGamepadManager::setupGamepadInput
void setupGamepadInput()
Definition: ccGamepadManager.cpp:150
ecvMainAppInterface.h
ccGamepadManager::~ccGamepadManager
~ccGamepadManager()
Definition: ccGamepadManager.cpp:35
GamepadInput::start
void start()
Definition: GamepadInput.cpp:30
ccGamepadManager::enableDevice
void enableDevice(bool state, bool silent, int deviceID=-1)
Definition: ccGamepadManager.cpp:51
CVLog::Error
static bool Error(const char *format,...)
Display an error dialog with formatted message.
Definition: CVLog.cpp:143
CVAppCommon.h
ecvMainAppInterface
Main application interface (for plugins)
Definition: ecvMainAppInterface.h:24
ccPickOneElementDlg
Minimal dialog to pick one element in a list (combox box)
Definition: ecvPickOneElementDlg.h:18
ccGamepadManager::releaseDevice
void releaseDevice()
Definition: ccGamepadManager.cpp:140
ccGamepadManager
Gamepad manager.
Definition: ccGamepadManager.h:39
ecvMainAppInterface::decreasePointSize
virtual void decreasePointSize()=0
CVAPPCOMMON_LIB_API
#define CVAPPCOMMON_LIB_API
Definition: CVAppCommon.h:15
CVLog::Warning
static bool Warning(const char *format,...)
Prints out a formatted warning message in console.
Definition: CVLog.cpp:133
GamepadInput::updated
void updated()
ecvMainAppInterface::toggleActiveWindowCenteredPerspective
virtual void toggleActiveWindowCenteredPerspective()=0
GamepadInput.h
GamepadInput::update
void update(QMainWindow *win)
Updates a window with the current gamepad state.
Definition: GamepadInput.cpp:34
ecvPickOneElementDlg.h
ccGamepadManager.h
ccPickOneElementDlg::addElement
void addElement(const QString &elementName)
Add an element to the combo box.
Definition: ecvPickOneElementDlg.cpp:34
ccGamepadManager::showMessage
void showMessage(QString message, bool asWarning)
Definition: ccGamepadManager.cpp:43
ccGamepadManager::setupMenu
void setupMenu()
Definition: ccGamepadManager.cpp:216
name
std::string name
Definition: FileIOFactory.cpp:129