/* QCD Utils - Qt bindings/utilites for CD Utils Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef QCD_VIEW_H #define QCD_VIEW_H #include #include "piobject.h" #include "cd_qt_export.h" namespace CDUtils { class CDType; class CDSection; } class CDItemModel; class QSortFilterProxyModel; class CD_QT_EXPORT CDView: public QTreeView, public PIObject { Q_OBJECT PIOBJECT(CDView); public: explicit CDView(QWidget *parent = 0); ~CDView(); void setType(int cdt); void setFile(const QString & filename); bool inProgress() const; void startX(double freq = 20.); CDUtils::CDSection * root(); QString typeLetter() const; CDItemModel * CDModel() {return model_;} protected: void mousePressEvent(QMouseEvent * ); void mouseReleaseEvent(QMouseEvent * ); void currentChanged(const QModelIndex & cur, const QModelIndex & prev); public slots: void refresh(); void refreshValues(); void send(); void receive(); void save(); void load(); void clear(); void buildFromHeader(const QString & description, int mode = 2); void calculate(); void filter(const QString & f); private slots: void indexClicked(const QModelIndex & i); void cd_sendFailed(); void cd_sendSucceed(); void cd_receiveFailed(); void cd_receiveSucceed(); void cd_receivedX(); void cd_changedGlobal(); private: bool filterTree(const QModelIndex & ti, const QString & filter); EVENT_HANDLER(void, pi_cd_sendFailed) {emit _qcd_sendFailed();} EVENT_HANDLER(void, pi_cd_sendSucceed) {emit _qcd_sendSucceed();} EVENT_HANDLER(void, pi_cd_receiveFailed) {emit _qcd_receiveFailed();} EVENT_HANDLER(void, pi_cd_receiveSucceed) {emit _qcd_receiveSucceed();} EVENT_HANDLER(void, pi_cd_receivedX) {emit _qcd_receivedX();} EVENT_HANDLER(void, pi_cd_changedGlobal) {emit _qcd_changedGlobal();} EVENT_HANDLER3(void, pi_cd_messageReceived, PIDeque, path, int, type, PIString, msg); CDItemModel * model_; QSortFilterProxyModel * proxy_; int type_; signals: void sendFailed(); void sendSucceed(); void receiveFailed(); void receiveSucceed(); void receivedX(); void changedGlobal(); void messageStatus(QString msg); void commandSended(QString msg); void messageReceived(QString path, int type, QString msg); void busyStatusChanged(bool busy); void _qcd_sendFailed(); // PRIVATE void _qcd_sendSucceed(); // PRIVATE void _qcd_receiveFailed(); // PRIVATE void _qcd_receiveSucceed(); // PRIVATE void _qcd_receivedX(); // PRIVATE void _qcd_changedGlobal(); // PRIVATE }; #endif // QCD_VIEW_H