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,2006,2007 Frank Hassanabad 00009 * 00010 * This file is part of RebeccaAIML. 00011 * 00012 * RebeccaAIML is free software; you can redistribute it and/or modify 00013 * it under the terms of the GNU General Public License as published by 00014 * the Free Software Foundation; either version 3 of the License, or 00015 * (at your option) any later version. 00016 * 00017 * RebeccaAIML is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 * GNU General Public License for more details. 00021 * 00022 * You should have received a copy of the GNU General Public License 00023 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00024 */ 00025 00026 //Qt includes 00027 #include <QMainWindow> 00028 #include <QTextEdit> 00029 00030 //qtgui includes 00031 #include "AIMLEngineThread.h" 00032 00033 /* 00034 * Forward declerations 00035 */ 00036 class QPushButton; 00037 class QLineEdit; 00038 class QMenu; 00039 class QToolBar; 00040 00041 namespace qtgui 00042 { 00043 class CustomTextEdit; 00044 00051 class MainWindow : public QMainWindow 00052 { 00053 Q_OBJECT 00054 00055 public: 00056 00061 MainWindow(); 00062 00063 public slots: 00064 00069 void input(); 00070 00077 void addBotText(const QString &text); 00078 00084 void addBotName(const QString &text); 00085 00090 void about(); 00091 00096 void openFile(); 00097 00102 void newFile(); 00103 00108 void openDir(); 00109 00113 void aimlLoading(); 00114 00118 void aimlDoneLoading(); 00119 00124 bool save(); 00125 00130 bool saveAs(); 00131 00132 signals: 00133 00141 void userTextEntered(const QString &text); 00142 00150 void aimlFileToOpen(const QString &fileName); 00151 00156 void aimlClear(); 00157 00165 void aimlDirectoryToOpen(const QString &dirName); 00166 00167 private: 00168 00172 void setupInitialProperties(); 00173 00178 void createStatusBar(); 00179 00186 void setupLayout(); 00187 00192 void setupConnections(); 00193 00197 void createMenus(); 00198 00202 void createActions(); 00203 00207 void createToolBars(); 00208 00217 void setCurrentFile(const QString &fileName); 00218 00225 bool saveFile(const QString &fileName); 00226 00232 QString strippedName(const QString &fullFileName); 00233 00237 QPushButton *m_okButton; 00238 00243 QLineEdit *m_userInputField; 00244 00249 CustomTextEdit *m_botOutputField; 00250 00260 AIMLEngineThread m_AIMLEngineThread; 00261 00265 QString m_botName; 00266 00272 QString m_curFile; 00273 00277 QMenu *m_fileMenu; 00278 00282 QMenu *m_helpMenu; 00283 00287 QAction *m_openAct; 00288 00292 QAction *m_openDirAct; 00293 00297 QAction *m_aboutAct; 00298 00302 QAction *m_newAct; 00303 00307 QAction *m_saveAct; 00308 00312 QAction *m_saveAsAct; 00313 00317 QAction *m_exitAct; 00318 00322 QToolBar *m_fileToolBar; 00323 }; 00324 00325 00326 } //end of qtgui namespace 00327 00328 #endif 00329 00330