![]() |
|
|
00001 /*************************************************************************** 00002 * inspectorJ - java profiler * 00003 * Copyright (C) 2006 by James May * 00004 * * 00005 * This program 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 * This program 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 this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00019 ***************************************************************************/ 00020 00027 #ifndef UI_INSPECTORJ_H_INCLUDED 00028 #define UI_INSPECTORJ_H_INCLUDED 00029 00030 #include "ui_inspectorj.h" 00031 #include "inspectorj/client/sessionprofiledialog.h" 00032 #include "inspectorj/model/bytecodehighlighter.h" 00033 #include "inspectorj/toolset/classtoolset.h" 00034 #include "inspectorj/toolset/profiletoolset.h" 00035 00036 #include <iostream> 00037 #include <QCloseEvent> 00038 #include <QHeaderView> 00039 #include <QFontDialog> 00040 #include <QList> 00041 #include <QProcess> 00042 #include <QToolButton> 00043 00044 namespace inspectorj { 00045 namespace client { 00046 00047 using inspectorj::toolset::ClassToolSet; 00048 using inspectorj::model::BytecodeHighlighter; 00049 00050 00059 class InspectorJ: public QMainWindow, Ui::MainWindow 00060 { 00061 Q_OBJECT 00062 00063 public: 00064 InspectorJ(QWidget *parent = 0, Qt::WindowFlags flags = 0); 00065 00066 protected: 00067 void closeEvent(QCloseEvent *event); 00068 00069 private slots: 00070 QString browseProfileDirectory(); 00071 void setProfileDirectory(); 00072 void getJvmInfo(); 00073 void showJvmInfo(JDWPPacket&); 00074 void showFontDlg(); 00075 void showSessionDlg(); 00076 void connected(bool, QString&); 00077 void updateClassTable(); 00078 void updateClassTree(); 00079 void setCurrentProfile(); 00080 void addClassFilter(); 00081 void removeClassFilter(); 00082 void disassembleBytecodes(); 00083 void updateBytecodeBtn(); 00084 void updateBytecodeTextEdit(); 00085 void javaAppErr(QProcess::ProcessError); 00086 void javaAppFinished(int, QProcess::ExitStatus); 00087 void javaAppStdErr(); 00088 void javaAppStdOut(); 00089 void javaAppStarted(); 00090 00091 00092 private: 00093 void setupConnections(); 00094 void loadProfiles(); 00095 QString& cleanConsoleText(QString&); 00096 00097 /* Menu Items */ 00098 QMenu *attachProfileMenuItem; 00099 QMenu *launchProfileMenuItem; 00100 QMenu *editProfileMenuItem; 00101 00102 QProcess javaAppProcess; 00103 00104 /* Actions */ 00105 QAction *disconnectAction; 00106 QAction *stopJavaAction; 00107 00108 /* Packet Actions */ 00109 JDWPAction *jvmInfoResponse; 00110 00112 ConnectionManager *connectionManager; 00113 00114 QMap<QString, SessionProfile> profiles; 00115 SessionProfile *profile; 00116 00117 /* Tool Sets */ 00118 ClassToolSet *classToolSet; 00119 00121 QToolButton *connectedStateBtn; 00122 00123 QString profileDir; 00124 00125 QHBoxLayout *bytecodeTableLayout; 00126 QWidget *bytecodeDockContents; 00127 BytecodeHighlighter *bytecodeHighlighter; 00128 00129 const int REFERENCE_TAB; 00130 const int BYTECODE_TAB; 00131 00132 void initWindow(); 00133 void loadSettings(); 00134 void saveSettings(); 00135 void createActions(); 00136 void createMenus(); 00137 void updateSessionsMenu(); 00138 void updateClassToolBox(bool); 00139 }; 00140 00141 } // end namespace client 00142 } // end namespace inspectorj 00143 00144 #endif // INSPECTORJUI_H_INCLUDED