12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- #ifndef MAINCLASS_H
- #define MAINCLASS_H
-
- #include <QObject>
- #include <QStringList>
- #include <ptsocket/ptsocket.h>
- #include "../defs.h"
-
- #define qinfo qDebug()<<(m_colored ? "[\033[1m\033[36mInfo\033[m ]" : "[Info ]")
- #define qerror qDebug()<<(m_colored ? "[\033[1m\033[31mError\033[m]" : "[Error]")
- #define qok qDebug()<<(m_colored ? "[ \033[1m\033[32mOK\033[m ]" : "[ OK ]")
-
- class MainClass : public QObject
- {
- Q_OBJECT
- public:
- explicit MainClass(QObject *parent = 0);
-
- public slots:
- void send(QString cmd, bool print);
- void setCloseOnNextQuery(bool m);
- void setShowOnlyResponse(bool m);
- void setColored(bool m);
- void addCommands(QStringList cmds);
- void connectToDaemon();
-
- private slots:
- void stateChanged(PTSocket::State s);
- void packetReceived(int type, QByteArray data);
- void readStdin();
- void mayDisconnect();
-
- private:
- PTSocket* m_sock;
- bool m_closeOnNextQuery;
- QStringList m_cmds;
- bool m_showOnlyResponse;
- bool m_colored;
- bool m_lastQueryResult;
- int m_responsesCount;
- };
-
- #endif // MAINCLASS_H
|