most files - check if this is all we need
This commit is contained in:
267
device.h
Normal file
267
device.h
Normal file
@ -0,0 +1,267 @@
|
||||
#include <stddef.h>
|
||||
#include <qlayout.h>
|
||||
#ifndef DEVICE_H
|
||||
#define DEVICE_H
|
||||
|
||||
#include <qdict.h>
|
||||
#include <qtabbar.h>
|
||||
#include <qgrid.h>
|
||||
#include <qvbox.h>
|
||||
#include <qscrollview.h>
|
||||
#include <qcheckbox.h>
|
||||
#include <qcombobox.h>
|
||||
#include <qradiobutton.h>
|
||||
#include "seaset.h"
|
||||
#include "command.h"
|
||||
|
||||
class Device;
|
||||
class Group;
|
||||
|
||||
class LineInput : public QHBox {
|
||||
Q_OBJECT
|
||||
public:
|
||||
LineInput(QWidget *parent, QString &labelText, const char *var);
|
||||
void setLength(int l);
|
||||
int stdWidth();
|
||||
void setEraseColor(const QColor & color);
|
||||
signals:
|
||||
void sendCmd(const char *cmd);
|
||||
void changed();
|
||||
public slots:
|
||||
void handleReturn();
|
||||
void focusLost();
|
||||
void setValue(const QString &value);
|
||||
public:
|
||||
QLineEdit *le;
|
||||
QLabel *label;
|
||||
// bool graphOn;
|
||||
private:
|
||||
QString value;
|
||||
};
|
||||
|
||||
class RdOnly : public QHBox {
|
||||
Q_OBJECT
|
||||
public:
|
||||
RdOnly(QWidget *parent, QString &labelText, QString &val, const char *var);
|
||||
void setLength(int l);
|
||||
public slots:
|
||||
void setValue(const QString &val);
|
||||
public:
|
||||
QLabel *label, *value;
|
||||
private:
|
||||
unsigned int len;
|
||||
};
|
||||
|
||||
class CheckBox : public QCheckBox {
|
||||
Q_OBJECT
|
||||
public:
|
||||
CheckBox(const QString &label, QWidget *parent, const char *var);
|
||||
signals:
|
||||
void sendCmd(const char *cmd);
|
||||
void changed();
|
||||
public slots:
|
||||
void handleReturn();
|
||||
void setValue(const QString &value);
|
||||
};
|
||||
|
||||
class ClickButton : public QPushButton {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ClickButton(QWidget *parent, const char *var);
|
||||
void setLabel(const QString &label);
|
||||
signals:
|
||||
void sendCmd(const char *cmd);
|
||||
void changed();
|
||||
public slots:
|
||||
void handleReturn();
|
||||
private:
|
||||
int dx;
|
||||
};
|
||||
|
||||
class RadioButton : public QRadioButton {
|
||||
Q_OBJECT
|
||||
public:
|
||||
RadioButton(const QString &label, QWidget *parent, const QString &cmd, const char *value);
|
||||
signals:
|
||||
void sendCmd(const char *cmd);
|
||||
void clearOthers(const QString &cmd);
|
||||
void changed();
|
||||
public slots:
|
||||
void handleClick();
|
||||
void setValue(const QString &value);
|
||||
private:
|
||||
QString cmd;
|
||||
};
|
||||
|
||||
class Menu : public QComboBox {
|
||||
Q_OBJECT
|
||||
public:
|
||||
Menu(const QString &label, QWidget *parent, const char *var);
|
||||
signals:
|
||||
void sendCmd(const char *cmd);
|
||||
void changed();
|
||||
public slots:
|
||||
void handleAct(const QString &value);
|
||||
void setValue(const QString &value);
|
||||
};
|
||||
|
||||
class ColorMenu : public QComboBox {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ColorMenu(QWidget *parent, const char *var);
|
||||
ColorMenu(QString &color, QWidget *parent);
|
||||
int getColorIndex();
|
||||
void setLength(int min, int max=0);
|
||||
signals:
|
||||
void sendCmd(const char *cmd);
|
||||
void changed();
|
||||
public slots:
|
||||
void handleAct(int index);
|
||||
void handleChange(const QString &value);
|
||||
void setValue(const QString &value);
|
||||
private:
|
||||
QString value;
|
||||
void init();
|
||||
bool nochange;
|
||||
};
|
||||
|
||||
class Item {
|
||||
public:
|
||||
QWidget *w;
|
||||
bool used;
|
||||
char wStyle;
|
||||
QFont normalFont;
|
||||
Group *grp;
|
||||
// QPushButton *graphButton;
|
||||
Item() {
|
||||
this->used = true;
|
||||
this->w = 0;
|
||||
this->wStyle = 0;
|
||||
// this->graphButton = 0;
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
class GraphButton : public QPushButton {
|
||||
Q_OBJECT
|
||||
public:
|
||||
GraphButton(QWidget *parent, const char *name);
|
||||
signals:
|
||||
void selectItem(const char *id);
|
||||
void changed();
|
||||
public slots:
|
||||
void handleClick();
|
||||
};
|
||||
*/
|
||||
|
||||
class Group : public QVBox {
|
||||
Q_OBJECT
|
||||
public:
|
||||
Group(Device *p, const char *name, bool selectMenu=false);
|
||||
Group(Group *p, const QString &tit, const char *name);
|
||||
void updateLayout(QStringList::Iterator &it);
|
||||
void appendTo(QString &c);
|
||||
void hideContents();
|
||||
void autocloseAll();
|
||||
bool openGroup(QString &path);
|
||||
Group* findGroup(QString &path);
|
||||
bool shown;
|
||||
bool autoclose;
|
||||
|
||||
signals:
|
||||
void changeHeight();
|
||||
void clearRadioButtons(const QString &except);
|
||||
|
||||
public slots:
|
||||
void toggle();
|
||||
|
||||
private:
|
||||
void init();
|
||||
void add(Item *item, QWidget *w = 0);
|
||||
void initItem(Item *item, QWidget *w, const char *line, bool active = false);
|
||||
Item *findItem(const char *name);
|
||||
void showIt(bool show);
|
||||
void newline();
|
||||
|
||||
QPushButton *arrow;
|
||||
QLabel *title;
|
||||
Device *device;
|
||||
Group *parentGroup;
|
||||
QDict<Item> items;
|
||||
int indent; // x indentation
|
||||
bool sameRow;
|
||||
bool tight;
|
||||
QString tip;
|
||||
char wStyle;
|
||||
bool isSelectMenu;
|
||||
int colDiv;
|
||||
//bool closeLater;
|
||||
};
|
||||
|
||||
typedef enum {select_idle, select_open} SelectState;
|
||||
|
||||
class Device : public QScrollView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
friend class Group;
|
||||
|
||||
public:
|
||||
Device(QWidget* parent);
|
||||
void init(Command *command, SeaSet *initSet);
|
||||
|
||||
signals:
|
||||
void restart(const char *vars);
|
||||
|
||||
public slots:
|
||||
void update(bool refresh = true);
|
||||
void timedUpdate();
|
||||
void switchLayout();
|
||||
void selectIt();
|
||||
void setSelectCmd(const char *cmd);
|
||||
// void graphToggle();
|
||||
// void selectGraphItem(const char *id);
|
||||
void rebuild();
|
||||
void activate();
|
||||
void closeMarkedGroups();
|
||||
void openGrps(const char *groups);
|
||||
|
||||
private:
|
||||
void resizeEvent(QResizeEvent *e);
|
||||
void updateStart();
|
||||
void updateComplete();
|
||||
|
||||
QString selectCmd;
|
||||
SeaSet *set;
|
||||
Group *mainGroup;
|
||||
Group *device;
|
||||
Group *select;
|
||||
Command *com;
|
||||
// GraphButton *gButton;
|
||||
QStringList code;
|
||||
int x, y;
|
||||
int nextY;
|
||||
int maxWid;
|
||||
int xspace, yspace;
|
||||
int labelWidth;
|
||||
int leWidth;
|
||||
int columnWidth;
|
||||
// int graphButtonWidth;
|
||||
int lineHeight;
|
||||
QString graphDesc;
|
||||
// bool graphOn;
|
||||
// QString visibleGr;
|
||||
// bool doJump;
|
||||
QString openGroup; /* group path to open */
|
||||
SelectState selectState;
|
||||
//int yJump;
|
||||
bool stopUpdate;
|
||||
double updateInterval;
|
||||
double lastUpdate;
|
||||
double rebuildTime;
|
||||
// Group *closeGroup;
|
||||
enum {update_idle, update_start, update_complete} updateMode;
|
||||
QTime tmot;
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user