oopapidocs  2.0
qobjectbrowser.h
00001 /****************************************************************************
00002  This file is part of ChainLink
00003  Copyright (C) 2007 Jeremy Magland (Jeremy.Magland@gmail.com)
00004 
00005  ChainLink is free software; you can redistribute it and/or modify
00006  it under the terms of the GNU General Public License as published by
00007  the Free Software Foundation; either version 2 of the License, or
00008  (at your option) any later version.
00009 
00010  ChainLink is distributed in the hope that it will be useful,
00011  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  GNU General Public License for more details.
00014 
00015  You should have received a copy of the GNU General Public License
00016  along with ChainLink; if not, write to the Free Software
00017  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 
00019 *****************************************************************************/
00020 
00021 
00022 #ifndef QOBJECTBROWSER_H
00023 #define QOBJECTBROWSER_H
00024 #include "obexport.h"
00025 
00026 #include <QWidget>
00027 #include <QDialog>
00028 #include <QMetaObject>
00029 #include <QMetaProperty>
00030 #include <QObject>
00031 #include <QSignalMapper>
00032 #include <QMainWindow>
00033 #include <QSplitter>
00034 #include <QTreeWidget>
00035 #include "qobjecttree.h"
00036 class Ui_qobjectbrowser;
00037 
00038 
00040 class QOB_signal_record {
00041 public:
00042     QSignalMapper *m_sigmapper;
00043     long m_count;
00044 
00045         QOB_signal_record();
00046         virtual ~QOB_signal_record();
00047 };
00048 
00051 class QObjectBrowserControl : public QWidget {
00052         Q_OBJECT
00053 public:
00054     QList<QOB_signal_record *> m_signal_records;
00055     QObject *m_obj;
00056 
00057     explicit QObjectBrowserControl(QWidget *parent = 0);
00058         virtual ~QObjectBrowserControl();
00059 
00060 
00061         void clear_signal_records();
00062         void clear();
00063         void set_object(QObject *obj_in);
00064         void set_children();
00065         void set_properties();
00066         void set_signals();
00067         void update_signal_values();
00068         void update_signal_value(int sig_num);
00069         void set_slots();
00070         void set_methods();
00071     bool hasdescendent(QObject *m_obj);
00072 public slots:
00073         void on_signal_triggered(int signal_num);
00074         void on_update_children();
00075         void on_update_properties();
00076         void on_up_to_parent();
00077         void on_children_table_cell_clicked(int row, int column);
00078         void on_object_destroyed();
00079 signals:
00080     void object_changed(QObject *m_obj);
00081 
00082 private:
00083     Ui_qobjectbrowser* ui;
00084 };
00085 
00095 class OBJECTBROWSER_EXPORT QObjectBrowser : public QWidget {
00096         Q_OBJECT
00097 public:
00098     explicit QObjectBrowser(QWidget* parent=0);
00099 
00100     QScopedPointer<QObjectBrowserControl> m_control;
00101     QScopedPointer<QObjectTree> m_tree;
00102     QObjectTreeModel m_model;
00103     QWidget* m_last_focus_window;
00104 
00105     void closeEvent(QCloseEvent*);   
00106     void set_object(QObject* obj);
00107     bool valid_object(QObject* obj);
00108         QObject* get_current_object();
00109 public slots:
00110         void on_current_item_changed();
00111         void on_object_changed(QObject *obj);
00112         void on_update();
00113     void dumpObject();
00114         void on_focus_changed( QWidget *old, QWidget *now);
00115         void on_browse_focus();
00116 
00117         void on_show_widget();
00118         void on_hide_widget();
00119         void on_focus_widget();
00120 signals:
00121     void hidden();
00122 protected:
00123     void restoreSettings();
00124     void saveSettings();
00125 };
00126 
00127 
00128 #endif
00129 
 All Classes Namespaces Functions Enumerations