/*************************************************************************** * Copyright 2012 Marco Martin * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 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 General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * ***************************************************************************/ #ifndef FULLSCREENDIALOG_P #define FULLSCREENDIALOG_P #include #include #include #include #include #include #include "enums.h" class QGraphicsObject; class QGraphicsView; class QGraphicsScene; class DeclarativeItemContainer; class Background; class FullScreenDialog : public QDeclarativeItem { Q_OBJECT Q_PROPERTY(QDeclarativeListProperty title READ title DESIGNABLE false) Q_PROPERTY(QDeclarativeListProperty content READ content DESIGNABLE false) Q_PROPERTY(QDeclarativeListProperty buttons READ buttons DESIGNABLE false) Q_PROPERTY(DialogStatus::Status status READ status NOTIFY statusChanged) public: FullScreenDialog(QDeclarativeItem *parent = 0); ~FullScreenDialog(); QGraphicsObject *mainItem() const; void setMainItem(QGraphicsObject *mainItem); bool isVisible() const; void setVisible(const bool visible); //QML properties QDeclarativeListProperty title(); QDeclarativeListProperty content(); QDeclarativeListProperty buttons(); DialogStatus::Status status() const; Q_INVOKABLE void open(); Q_INVOKABLE void accept(); Q_INVOKABLE void reject(); Q_INVOKABLE void close(); Q_SIGNALS: void accepted(); void rejected(); void clickedOutside(); void statusChanged(); private Q_SLOTS: void syncMainItem(); void statusHasChanged(); protected: bool eventFilter(QObject *watched, QEvent *event); private: QGraphicsView *m_view; QWeakPointer m_mainItem; DeclarativeItemContainer *m_declarativeItemContainer; QGraphicsScene *m_scene; QWeakPointer m_rootObject; static uint s_numItems; Background *m_background; //those only used in case of error, to not make plasma crash QList m_dummyTitleElements; QList m_dummyContentElements; QList m_dummyButtonsElements; }; #endif