#ifndef APPMODEL_H #define APPMODEL_H #include "../common/comm.h" #include "ImageProvider.h" #include #include #include #include #include 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 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 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 _window; AppModelPrivate *d; std::vector _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