/* connect.h */ #ifndef CONNECT_H #define CONNECT_H #include #include #include #include #include #include #include #include #include class AST; class StatementAST; class ParseSession; /* ----------------------------------------------------------------------- */ namespace ConnectModule { class ConnectPlugin; class PropertyFactory; class TreeFactory; /* ----------------------------------------------------------------------- */ enum ConnectKind { UnknownNode, ClassNode, FieldNode, SignalNode }; class ConnectItem : public QTreeWidgetItem { public: ConnectKind kind; QString id; KDevelop::DUChainPointer cachedDecl; KDevelop::DUContextPointer cachedContext; ConnectItem * init; public: ConnectItem () : kind (UnknownNode), init (NULL) { } }; /* ----------------------------------------------------------------------- */ class ConnectWidget : public QWidget { Q_OBJECT public: ConnectWidget (QWidget* parent); virtual ~ConnectWidget (); virtual void contextMenuEvent (QContextMenuEvent* e); private Q_SLOTS: void documentActivated (KDevelop::IDocument * doc); void documentClosed (KDevelop::IDocument * doc); void treeDoubleClick (QTreeWidgetItem * tree_item, int column); void editSlot (); private: ConnectItem * showText (QTreeWidgetItem * branch, QString text); ConnectItem * showAST (QTreeWidgetItem * branch, QString title, AST * ast); void showStatement (QTreeWidgetItem * branch, StatementAST * ast); void showStatements (QTreeWidgetItem * branch, AST * ast); void showFunction (ConnectItem * branch, const KDevelop::ClassFunctionDeclaration * decl); void showInitFunc (ConnectItem * branch, const KDevelop::Declaration * decl); void showSignal (QTreeWidgetItem * branch, const KDevelop::Declaration * decl); void showSignals (QTreeWidgetItem * branch, const KDevelop::Declaration * cls_decl); void showItem (QTreeWidgetItem * branch, const KDevelop::Declaration * decl); void showDecl (QTreeWidgetItem * branch, const KDevelop::Declaration * decl, bool nested = false); public: void display (); private: KDevelop::IDocument * m_doc; QTreeWidget* m_tree; KAction * m_editSlot; KDevelop::TopDUContext* m_topContext; ParseSession * m_session; }; /* ----------------------------------------------------------------------- */ class ConnectFactory: public KDevelop::IToolViewFactory { public: ConnectFactory (ConnectPlugin * plugin) : m_plugin (plugin), m_widget (NULL) {} virtual QWidget* create (QWidget *parent = 0) { m_widget = new ConnectWidget (parent); return m_widget; } virtual Qt::DockWidgetArea defaultPosition() { return Qt::LeftDockWidgetArea; } virtual QString id() const { return "org.kdevelop.Connect.Connect"; } private: ConnectPlugin * m_plugin; public: ConnectWidget * m_widget; }; /* ----------------------------------------------------------------------- */ class ConnectPlugin : public KDevelop::IPlugin { Q_OBJECT public: ConnectPlugin (QObject *parent, const QVariantList & args = QVariantList ()); virtual ~ ConnectPlugin (); virtual void unload (); private Q_SLOTS: void run (); public: Sublime::MainWindow * getMainWindow () { return m_mainWindow; } private: Sublime::MainWindow * m_mainWindow; public: ConnectFactory * m_connectFactory; PropertyFactory * m_propertyFactory; TreeFactory * m_treeFactory; KDevelop::IToolViewFactory * m_traceFactory; }; /* ----------------------------------------------------------------------- */ } // end of namespace #endif // CONNECT_H