~ubuntu-branches/ubuntu/wily/qgis/wily

« back to all changes in this revision

Viewing changes to src/plugins/grass/qtermwidget/qtermwidget.h

  • Committer: Bazaar Package Importer
  • Author(s): Johan Van de Wauw
  • Date: 2010-07-11 20:23:24 UTC
  • mfrom: (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100711202324-5ktghxa7hracohmr
Tags: 1.4.0+12730-3ubuntu1
* Merge from Debian unstable (LP: #540941).
* Fix compilation issues with QT 4.7
* Add build-depends on libqt4-webkit-dev 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*  Copyright (C) 2008 e_k (e_k@users.sourceforge.net)
 
2
    Copyright (C) 2009 Lorenzo "Il Rugginoso" Masini <lorenxo86@gmail.com>
 
3
 
 
4
    This library is free software; you can redistribute it and/or
 
5
    modify it under the terms of the GNU Library General Public
 
6
    License as published by the Free Software Foundation; either
 
7
    version 2 of the License, or (at your option) any later version.
 
8
 
 
9
    This library is distributed in the hope that it will be useful,
 
10
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
    Library General Public License for more details.
 
13
 
 
14
    You should have received a copy of the GNU Library General Public License
 
15
    along with this library; see the file COPYING.LIB.  If not, write to
 
16
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
17
    Boston, MA 02110-1301, USA.
 
18
*/
 
19
 
 
20
 
 
21
#ifndef _Q_TERM_WIDGET
 
22
#define _Q_TERM_WIDGET
 
23
 
 
24
#include <QtGui>
 
25
 
 
26
struct TermWidgetImpl;
 
27
 
 
28
enum COLOR_SCHEME {     COLOR_SCHEME_WHITE_ON_BLACK = 1,
 
29
                        COLOR_SCHEME_GREEN_ON_BLACK,
 
30
                        COLOR_SCHEME_BLACK_ON_LIGHT_YELLOW
 
31
                  };
 
32
 
 
33
class QTermWidget : public QWidget
 
34
{
 
35
    Q_OBJECT
 
36
  public:
 
37
 
 
38
    enum ScrollBarPosition
 
39
    {
 
40
      /** Do not show the scroll bar. */
 
41
      NoScrollBar = 0,
 
42
      /** Show the scroll bar on the left side of the display. */
 
43
      ScrollBarLeft = 1,
 
44
      /** Show the scroll bar on the right side of the display. */
 
45
      ScrollBarRight = 2
 
46
    };
 
47
 
 
48
 
 
49
    //Creation of widget
 
50
    QTermWidget( int startnow = 1, //start shell program immediately
 
51
                 QWidget *parent = 0 );
 
52
    ~QTermWidget();
 
53
 
 
54
    //start shell program if it was not started in constructor
 
55
    void startShellProgram();
 
56
 
 
57
    //look-n-feel, if you don`t like defaults
 
58
 
 
59
    //  Terminal font
 
60
    // Default is application font with family Monospace, size 10
 
61
    // USE ONLY FIXED-PITCH FONT!
 
62
    // otherwise symbols' position could be incorrect
 
63
    void setTerminalFont( QFont &font );
 
64
 
 
65
    //environment
 
66
    void setEnvironment( const QStringList& environment );
 
67
 
 
68
    //  Shell program, default is /bin/bash
 
69
    void setShellProgram( const QString &progname );
 
70
 
 
71
    //working directory
 
72
    void setWorkingDirectory( const QString& dir );
 
73
 
 
74
    // Shell program args, default is none
 
75
    void setArgs( QStringList &args );
 
76
 
 
77
    //Text codec, default is UTF-8
 
78
    void setTextCodec( QTextCodec *codec );
 
79
 
 
80
    //Color scheme, default is white on black
 
81
    void setColorScheme( int scheme );
 
82
 
 
83
    //set size
 
84
    void setSize( int h, int v );
 
85
 
 
86
    //set fixed size
 
87
    void setFixedSize( int h, int v );
 
88
 
 
89
    // History size for scrolling
 
90
    void setHistorySize( int lines ); //infinite if lines < 0
 
91
 
 
92
    // Presence of scrollbar
 
93
    void setScrollBarPosition( ScrollBarPosition );
 
94
 
 
95
    // Send some text to terminal
 
96
    void sendText( QString &text );
 
97
 
 
98
    // Sets whether flow control is enabled
 
99
    void setFlowControlEnabled( bool enabled );
 
100
 
 
101
    // Returns whether flow control is enabled
 
102
    bool flowControlEnabled( void );
 
103
 
 
104
    /**
 
105
     * Sets whether the flow control warning box should be shown
 
106
     * when the flow control stop key (Ctrl+S) is pressed.
 
107
     */
 
108
    void setFlowControlWarningEnabled( bool enabled );
 
109
 
 
110
    QSize minimumSizeHint() const;
 
111
    QSize sizeHint() const;
 
112
 
 
113
  signals:
 
114
    void finished();
 
115
    void receivedData( const QString &data );
 
116
 
 
117
  public slots:
 
118
    // Paste clipboard content to terminal
 
119
    void copyClipboard();
 
120
 
 
121
    // Copies selection to clipboard
 
122
    void pasteClipboard();
 
123
 
 
124
  protected:
 
125
    virtual void resizeEvent( QResizeEvent * );
 
126
 
 
127
  protected slots:
 
128
    void sessionFinished();
 
129
 
 
130
  private:
 
131
    void init();
 
132
    TermWidgetImpl *m_impl;
 
133
};
 
134
 
 
135
 
 
136
//Maybe useful, maybe not
 
137
 
 
138
#ifdef __cplusplus
 
139
extern "C"
 
140
#endif
 
141
void *createTermWidget( int startnow, void *parent );
 
142
 
 
143
#endif
 
144