File indexing completed on 2024-05-19 16:38:51

0001 /*
0002     This file is part of the KDE Control Center Module for Joysticks
0003 
0004     SPDX-FileCopyrightText: 2003, 2005, 2006 Martin Koller <kollix@aon.at>
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #pragma once
0009 
0010 #include <QWidget>
0011 
0012 class JoyDevice;
0013 
0014 class PosWidget;
0015 class QTableWidget;
0016 class QTimer;
0017 class KComboBox;
0018 class KMessageWidget;
0019 class QPushButton;
0020 class QCheckBox;
0021 
0022 // the widget which displays all buttons, values, etc.
0023 class JoyWidget : public QWidget
0024 {
0025     Q_OBJECT
0026 
0027 public:
0028     JoyWidget(QWidget *parent = nullptr);
0029 
0030     ~JoyWidget() override;
0031 
0032     // initialize list of possible devices and open the first available
0033     void init();
0034 
0035 public Q_SLOTS:
0036     // reset calibration values to their value when this KCM was started
0037     void resetCalibration();
0038 
0039 private Q_SLOTS:
0040     void checkDevice();
0041     void deviceChanged(const QString &dev);
0042     void traceChanged(bool);
0043     void calibrateDevice();
0044 
0045 private:
0046     void showDeviceProps(JoyDevice *joy); // fill widgets with given device parameters
0047     void restoreCurrDev(); // restores the content of the combobox to reflect the current open device
0048 
0049 private:
0050     KMessageWidget *messageBox; // in case of no device, show here a message rather than in a dialog
0051     KComboBox *device;
0052     PosWidget *xyPos;
0053     QTableWidget *buttonTbl;
0054     QTableWidget *axesTbl;
0055     QCheckBox *trace;
0056     QPushButton *calibrate;
0057 
0058     QTimer *idle;
0059 
0060     JoyDevice *joydev;
0061 };