00001 #ifndef QTGUI_MAINWINDOW_H 00002 #define QTGUI_MAINWINDOW_H 00003 00004 /* 00005 * RebeccaAIML, Artificial Intelligence Markup Language 00006 * C++ api and engine. 00007 * 00008 * Copyright (C) 2005 Frank Hassanabad 00009 * 00010 * This library is free software; you can redistribute it and/or 00011 * modify it under the terms of the GNU Lesser General Public 00012 * License as published by the Free Software Foundation; either 00013 * version 2.1 of the License, or (at your option) any later version. 00014 * 00015 * This library is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 * Lesser General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU Lesser General Public 00021 * License along with this library; if not, write to the Free Software 00022 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00023 */ 00024 00025 //Qt includes 00026 #include <QMainWindow> 00027 #include <QTextEdit> 00028 00029 //qtgui includes 00030 #include "AIMLEngineThread.h" 00031 00032 /* 00033 * Forward declerations 00034 */ 00035 class QPushButton; 00036 class QLineEdit; 00037 class QMenu; 00038 class QToolBar; 00039 00040 namespace qtgui 00041 { 00042 class CustomTextEdit; 00043 00050 class MainWindow : public QMainWindow 00051 { 00052 Q_OBJECT 00053 00054 public: 00055 00060 MainWindow(); 00061 00062 public slots: 00063 00068 void input(); 00069 00076 void addBotText(const QString &text); 00077 00083 void addBotName(const QString &text); 00084 00089 void about(); 00090 00095 void openFile(); 00096 00101 void newFile(); 00102 00107 void openDir(); 00108 00112 void aimlLoading(); 00113 00117 void aimlDoneLoading(); 00118 00123 bool save(); 00124 00129 bool saveAs(); 00130 00131 signals: 00132 00140 void userTextEntered(const QString &text); 00141 00149 void aimlFileToOpen(const QString &fileName); 00150 00155 void aimlClear(); 00156 00164 void aimlDirectoryToOpen(const QString &dirName); 00165 00166 private: 00167 00171 void setupInitialProperties(); 00172 00177 void createStatusBar(); 00178 00185 void setupLayout(); 00186 00191 void setupConnections(); 00192 00196 void createMenus(); 00197 00201 void createActions(); 00202 00206 void createToolBars(); 00207 00216 void setCurrentFile(const QString &fileName); 00217 00224 bool saveFile(const QString &fileName); 00225 00231 QString strippedName(const QString &fullFileName); 00232 00236 QPushButton *m_okButton; 00237 00242 QLineEdit *m_userInputField; 00243 00248 CustomTextEdit *m_botOutputField; 00249 00259 AIMLEngineThread m_AIMLEngineThread; 00260 00264 QString m_botName; 00265 00271 QString m_curFile; 00272 00276 QMenu *m_fileMenu; 00277 00281 QMenu *m_helpMenu; 00282 00286 QAction *m_openAct; 00287 00291 QAction *m_openDirAct; 00292 00296 QAction *m_aboutAct; 00297 00301 QAction *m_newAct; 00302 00306 QAction *m_saveAct; 00307 00311 QAction *m_saveAsAct; 00312 00316 QAction *m_exitAct; 00317 00321 QToolBar *m_fileToolBar; 00322 }; 00323 00324 00325 } //end of qtgui namespace 00326 00327 #endif 00328 00329