summaryrefslogtreecommitdiff
path: root/core/apps/embeddedkonsole/konsole.h
blob: 0bf3fb3e94f9c901aef579ec6f84f0a4d4892375 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/* ----------------------------------------------------------------------- */
/*                                                                         */
/* [konsole.h]                      Konsole                                   */
/*                                                                            */
/* -------------------------------------------------------------------------- */
/*                                                                            */
/* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de>            */
/*                                                                            */
/* This file is part of Konsole, an X terminal.                               */
/*                                                                            */
/* The material contained in here more or less directly orginates from        */
/* kvt, which is copyright (c) 1996 by Matthias Ettrich <ettrich@kde.org>     */
/*                                                                            */
/* -------------------------------------------------------------------------- */
/*                        */
/* Ported Konsole to Qt/Embedded                                              */
/*                        */
/* Copyright (C) 2000 by John Ryland <jryland@trolltech.com>                  */
/*                        */
/* -------------------------------------------------------------------------- */

#ifndef KONSOLE_H
#define KONSOLE_H


#include <qmainwindow.h>
#include <qaction.h>
#include <qpopupmenu.h>
#include <qstrlist.h>
#include <qintdict.h>
#include <qptrdict.h>
#include <qtabwidget.h>
#include <qpe/qpetoolbar.h>
#include <qcombobox.h>
#include <qcolor.h>

#include "MyPty.h"
#include "TEWidget.h"
#include "TEmuVt102.h"
#include "session.h"

class EKNumTabWidget;

class Konsole : public QMainWindow
{
Q_OBJECT

public:

  Konsole(QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
  Konsole(const char * name, const char* pgm, QStrList & _args, int histon);
  ~Konsole();
  void setColLin(int columns, int lines);
  QPEToolBar *secondToolBar; 
  void show();
  void setColor();
  int lastSelectedMenu;
  int startUp;
private slots:
  void setDocument(const QString &);
  void doneSession(TESession*,int);
  void changeColumns(int);
  void fontChanged(int);
  void configMenuSelected(int );
  void colorMenuSelected(int);
  void colorMenuIsSelected(int);
  void enterCommand(int);
  void hitEnter();
  void hitSpace();
  void hitTab();
  void hitPaste();
  void hitUp();
  void hitDown();
  void switchSession(QWidget *);
  void newSession();
  void changeCommand(const QString &, int);
  void initCommandList();
  void scrollMenuSelected(int);
  void editCommandListMenuSelected(int);
  void parseCommandLine();
    void changeForegroundColor(const QColor &);
    void changeBackgroundColor(const QColor &);
private:
  void init(const char* _pgm, QStrList & _args);
  void initSession(const char* _pgm, QStrList & _args);
  void runSession(TESession* s);
  void setColorPixmaps();
  void setHistory(bool);
  QSize calcSize(int columns, int lines);
  TEWidget* getTe();
  QStringList commands;
  QLabel * msgLabel;
  QColor foreground, background;
bool fromMenu;
private:
  class VTFont 
  {
  public:
    VTFont(QString name, QFont& font) 
    {
      this->name = name;
      this->font = font;
    }

    QFont& getFont() 
    {
      return font;
    }

    QString getName() 
    {
      return name;
    }

  private:
    QString name;
    QFont font;
  };

  EKNumTabWidget* tab;
  int nsessions;
  QList<VTFont> fonts;
  int cfont;
  QCString se_pgm;
  QStrList se_args;

  QPopupMenu *fontList,*configMenu,*colorMenu,*scrollMenu,*editCommandListMenu;
  QComboBox *commonCombo;
    // history scrolling I think
  bool        b_scroll;

  int         n_keytab;
  int         n_scroll;
  int         n_render;
  QString     pmPath; // pixmap path
  QString     dropText;
  QFont       defaultFont;
  QSize       defaultSize;

};

#endif