123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- #ifndef APPMODEL_H
- #define APPMODEL_H
- #include "../common/comm.h"
- #include "ImageProvider.h"
- #include <QObject>
- #include <QtCore/QObject>
- #include <QtCore/QString>
- #include <QtGui>
- #include <QtQml/qqml.h>
- class CarData : public QObject {
- Q_OBJECT
- Q_PROPERTY(int32_t uid READ uid WRITE setUid NOTIFY dataChanged)
- Q_PROPERTY(QString name READ name WRITE setName NOTIFY dataChanged)
- Q_PROPERTY(QString type READ type WRITE setType NOTIFY dataChanged)
- Q_PROPERTY(QString state READ state WRITE setState NOTIFY dataChanged)
- public:
- explicit CarData(QObject *parent = 0);
- CarData(const CarData &other);
- int32_t uid() const;
- QString name() const;
- QString type() const;
- QString state() const;
- int32_t carType() const;
- void setUid(const int32_t &value);
- void setName(const QString &value);
- void setType(const QString &value);
- void setState(const QString &value);
- void setCarType(const int32_t& value);
- signals:
- void dataChanged();
- private:
- int32_t m_uid;
- int32_t m_carType;
- QString m_name;
- QString m_type;
- QString m_state;
- };
- Q_DECLARE_METATYPE(CarData)
- class AppModelPrivate;
- class CFishEyeWindow;
- class AppModel : public QObject {
- Q_OBJECT
- Q_PROPERTY(bool ready READ ready WRITE setReady NOTIFY readyChanged)
- Q_PROPERTY(QQmlListProperty<CarData> car READ car NOTIFY carChanged)
-
-
- // Q_PROPERTY(int32_t Gear READ Gear WRITE SetGear NOTIFY gearChanged)
- Q_PROPERTY(QString Account READ Account WRITE setAccount NOTIFY accountChanged)
- Q_PROPERTY(QString Password READ Password WRITE setPassword NOTIFY passwordChanged)
- Q_PROPERTY(QString CarName READ CarName WRITE setCarName NOTIFY carNameChanged)
- Q_PROPERTY(QString DriveName READ DriveName WRITE setDriveName NOTIFY driveNameChanged)
-
- public:
- explicit AppModel(IMonitroNotify *n , IRemoteCtrl *c , QObject* qmlObj, QObject *parent = 0);
- ~AppModel();
- Q_INVOKABLE void userLogin(QString useName, QString password);
- Q_INVOKABLE void connectCar(int id);
- Q_INVOKABLE void leaveCar();
- Q_INVOKABLE void logout();
-
-
- // Q_INVOKABLE void switchDriver();
- //Q_INVOKABLE void areaChanged(int32_t area);
- Q_INVOKABLE void controlCar(int id);
-
-
-
- Q_INVOKABLE bool idle(int32_t uid);
- //Q_INVOKABLE void showTrackDlg();
- // Q_INVOKABLE void track();
- //Q_INVOKABLE void unTrack();
- //Q_INVOKABLE bool autoClose();
- //Q_INVOKABLE QString ReadyText();
-
- //int radar6() const;
- //int radar7() const;
- QString Account() const;
- QString Password() const;
- QString CarName() const;
- QString DriveName() const;
- bool ready() const;
-
-
- void SetVisible(const bool value);
- //void SetGear(const int32_t value);
- void SetCold(const int32_t value);
- void setReady(const bool value);
- //void setRadar6(const int32_t& value);
- //void setRadar7(const int32_t& value);
- void setAccount(const QString& value);
- void setPassword(const QString& password);
- void setCarName(const QString& carname);
- void setDriveName(const QString& drivename);
-
- //void setModelX(const int32_t value);
- //void setModelY(const int32_t value);
- //void setModelZ(const int32_t value);
-
- //void setRadar6(const int32_t &value);
-
- QQmlListProperty<CarData> car() const;
- public slots:
- void onLoginRst(bool rst);
- void onCarAppend(const UserDriver&info);
-
-
- void onNotifyState(int32_t uid, UserState state);
-
- void onNotifyDel(int32_t peer);
- void onKickoff();
- void onNotifyLeave(int32_t peer);
- void onNotifyFail(int32_t peer);
-
- void OnClose();
- //void OnPosition(float x, float y, float z);
- signals:
- void readyChanged();
-
- //void radar6Changed();
- //void radar7Changed();
- void accountChanged();
- void passwordChanged();
- void carNameChanged();
- void driveNameChanged();
- void sectionTextChanged();
-
- void gearChanged();
-
- void playAlertSound();
- void carConnected();
- void closeWin();
- void carChanged();
-
- private:
- IMonitroNotify *_notify;
- IRemoteCtrl *_control;
- // std::unique_ptr<CFishEyeWindow> _window;
- AppModelPrivate *d;
- std::vector<UserDriver> _users;
- QString m_account;
- QString m_password;
- QString m_carName;
- QString m_driveName;
-
- bool m_visible = true;
- //int32_t m_gear =0;
- //WorkArea m_area= WorkArea::Area_A;
- // int32_t m_no;
- bool m_ready;
- QObject* m_qmlObj = nullptr;
- int32_t m_peer = -1;
-
- };
- #endif // APPMODEL_H
|