00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef KONSOLE_H
00023 #define KONSOLE_H
00024
00025
00026 #include <qmainwindow.h>
00027 #include <qaction.h>
00028 #include <qpopupmenu.h>
00029 #include <qstrlist.h>
00030 #include <qintdict.h>
00031 #include <qptrdict.h>
00032 #include <qtabwidget.h>
00033 #include <qtoolbar.h>
00034 #include <qcombobox.h>
00035 #include <qcolor.h>
00036
00037 #include "MyPty.h"
00038 #include "TEWidget.h"
00039 #include "TEmuVt102.h"
00040 #include "session.h"
00041
00042 class EKNumTabWidget;
00043
00044 class Konsole : public QMainWindow
00045 {
00046 Q_OBJECT
00047
00048 public:
00049
00050 static QString appName()
00051 {
00052 return QString::fromLatin1("embeddedkonsole");
00053 }
00054
00055 Konsole(QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
00056 Konsole(const char * name, const char* pgm, QStrList & _args, int histon);
00057 ~Konsole();
00058 void setColLin(int columns, int lines);
00059 QToolBar *secondToolBar;
00060 void show();
00061 void setColor(int);
00062 int lastSelectedMenu;
00063 int startUp;
00064
00065 public slots:
00066 void changeFontSize(int);
00067 void toggleFullScreen();
00068 void setFullScreen(bool);
00069 void changeSession(int);
00070 void cycleZoom();
00071 void newSession();
00072
00073 private slots:
00074 void setDocument(const QString &);
00075 void doneSession(TEWidget*,int);
00076 void changeTitle(TEWidget*, const QString&);
00077 void changeColumns(int);
00078 void setFont(int);
00079
00080 void configMenuSelected(int );
00081 void colorMenuSelected(int);
00082 void colorMenuIsSelected(int);
00083 void tabMenuSelected(int);
00084 void sessionListSelected(int);
00085
00086 void enterCommand(int);
00087 void hitEnter();
00088 void hitSpace();
00089 void hitTab();
00090 void hitPaste();
00091 void hitUp();
00092 void hitDown();
00093 void switchSession(QWidget *);
00094 void changeCommand(const QString &, int);
00095 void initCommandList();
00096 void scrollMenuSelected(int);
00097 void editCommandListMenuSelected(int);
00098 void parseCommandLine();
00099 void changeForegroundColor(const QColor &);
00100 void changeBackgroundColor(const QColor &);
00101
00102 void historyDialog();
00103 void fullscreenTimeout();
00104 void closeSession();
00105
00106 private:
00107 void doWrap();
00108 void init(const char* _pgm, QStrList & _args);
00109 void initSession(const char* _pgm, QStrList & _args);
00110 void runSession(TESession* s);
00111 void setColorPixmaps();
00112 void setHistory(bool);
00113 void setColors(QColor foreground, QColor background);
00114 int findFont(const QString& name, int size, bool exact = false);
00115 QSize calcSize(int columns, int lines);
00116 TEWidget* getTe();
00117 QStringList commands;
00118 QLabel * msgLabel;
00119 QColor foreground, background;
00120 bool fromMenu;
00121
00122 bool fullscreen;
00123
00124 private:
00125 class VTFont
00126 {
00127 public:
00128 VTFont(const QString& name, QFont& font, const QString& family, int familyNum, int size)
00129 {
00130 this->name = name;
00131 this->font = font;
00132 this->family = family;
00133 this->size = size;
00134 this->familyNum = familyNum;
00135 }
00136
00137 QFont& getFont()
00138 {
00139 return font;
00140 }
00141 QString getName()
00142 {
00143 return name;
00144 }
00145 int getSize()
00146 {
00147 return(size);
00148 }
00149 QString getFamily()
00150 {
00151 return(family);
00152 }
00153 int getFamilyNum()
00154 {
00155 return(familyNum);
00156 }
00157
00158 private:
00159 QFont font;
00160 QString name;
00161 QString family;
00162 int familyNum;
00163 int size;
00164 };
00165
00166 EKNumTabWidget* tab;
00167 int tabPos;
00168 int nsessions;
00169 QList<VTFont> fonts;
00170 int cfont;
00171 QCString se_pgm;
00172 QStrList se_args;
00173
00174 QToolBar *menuToolBar;
00175 QToolBar *toolBar;
00176 QComboBox *commonCombo;
00177
00178 QPopupMenu *fontList,*configMenu,*colorMenu,*scrollMenu,*editCommandListMenu;
00179 QPopupMenu *sessionList, *tabMenu;
00180
00181 int sm_none, sm_left, sm_right;
00182 int cm_beep, cm_wrap;
00183 int cm_default;
00184 int cm_bw, cm_wb, cm_gb, cm_bt, cm_br, cm_rb, cm_gy, cm_bm, cm_mb, cm_cw, cm_wc, cm_bb, cm_ab;
00185 int tm_top, tm_bottom, tm_hidden;
00186 int ec_edit, ec_cmdlist, ec_quick;
00187
00188 bool show_fullscreen_msg;
00189 QTimer *fullscreen_timer;
00190 QLabel *fullscreen_msg;
00191
00192
00193
00194 bool b_scroll;
00195
00196 int n_keytab;
00197 int n_scroll;
00198 int n_render;
00199 QString pmPath;
00200 QString dropText;
00201 QFont defaultFont;
00202 QSize defaultSize;
00203
00204 };
00205
00206 #endif
00207