forked from OpenPanzerProject/OP-Config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
combo_drivetype.h
52 lines (41 loc) · 1.83 KB
/
combo_drivetype.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef COMBO_DRIVETYPE_H
#define COMBO_DRIVETYPE_H
#include <QObject>
#include <QComboBox>
#include <op_defines.h>
enum MotorCategory
{ mcDrive,
mcTurretRotation,
mcTurretElevation
};
class DriveTypeComboBox : public QComboBox
{
Q_OBJECT
public:
explicit DriveTypeComboBox(QWidget *parent = 0);
void setCategory(MotorCategory mc);
// QStringList driveTypeList() const;
// int currentDriveType() const;
// These return the enum code or label
int getCode(QString label);
QString getLabel(int code);
Drive_t getCurrentDriveType(void);
boolean isSerial(); // Does the currently-selected drive type require serial communication
boolean isOnboard(); // Is the currently-selected drive type the on-board motors?
boolean isRCOutput(); // Is the currently-selected drive type an RC output (SERVO_ESC or SERVO_PAN)?
boolean isESC(); // Is the currently-selected drive type an ESC (SERVO_ESC)?
signals:
void currentDriveTypeChanged(QString); // Custom signal to tell us the new Drive type in String format
void currentDriveTypeChanged(QByteArray); // Custom signal to tell us the new Drive type, converting the enum to a ByteArray (used to save into data array)
void currentDriveTypeChanged(Drive_t); // here we pass back an actual drive type
public slots:
//void insertDriveType(const QString& newlabel); // For user-entered fields, we won't need this
void setCurrentDriveType(const Drive_t& driveType);
void setCurrentDriveType(int driveTypeCode);
private slots:
void emitCurrentDriveTypeChanged(); // We will connect this slot to the built-in index changed, and emit our custom signals
private:
protected:
int m_nextDriveTypeCode;
};
#endif // DRIVETYPECOMBOBOX_H