Canorus
0.7
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
widgets
pyconsole.h
Go to the documentation of this file.
1
8
#ifndef PYCONSOLE_H_
9
#define PYCONSOLE_H_
10
11
#include <QObject>
12
#include <QTextEdit>
13
#include <QMutex>
14
#include <QWaitCondition>
15
#include <QToolBar>
16
#include "
core/document.h
"
17
18
class
CAPyConsole
:
public
QTextEdit
{
19
Q_OBJECT
20
public
:
21
enum
TxtType
{
22
txtNormal
,
23
txtStdout
,
24
txtStderr
25
};
26
27
CAPyConsole
(
CADocument
*doc,
QWidget
*parent=0);
28
29
QString
asyncBufferedInput
(QString prompt);
30
void
asyncBufferedOutput
(QString bufInp,
bool
bStdErr);
31
void
asyncPluginInit
();
32
void
asyncKeyboardInterrupt
();
33
34
protected
:
35
void
keyPressEvent
(QKeyEvent * e);
36
37
private
slots:
38
void
txtAppend
(
const
QString & text,
TxtType
txtType =
txtNormal
);
39
void
on_txtChanged
();
40
void
on_posChanged
();
41
void
on_selChanged
();
42
void
on_fmtChanged
();
43
void
syncPluginInit
();
44
45
signals:
46
void
sig_txtAppend
(
const
QString & text,
TxtType
stdType);
47
void
sig_syncPluginInit
();
48
49
private
:
50
enum
HistLay
{
51
histPrev
,
52
histNext
53
};
54
55
struct
TxtFragment
{
56
QString
text
;
57
TxtType
type
;
58
};
59
60
// void txtAppend(...) -> is in signals
61
void
txtRevert
();
62
QString
txtGetInput
(
bool
bReadText =
false
);
63
void
txtSetInput
(QString input,
bool
bUpdateText =
true
);
64
65
void
histAdd
();
66
void
histGet
(
HistLay
histLay);
67
68
// text in the console
69
QTextCursor
_curInput
,
_curNew
;
70
int
_iCurStart
,
_iCurNowOld
,
_iCurNow
;
71
bool
_bIgnTxtChange
;
72
73
TxtFragment
*
_tf
;
74
QList<TxtFragment*>
_txtFixed
;
75
QString
_strInput
;
76
77
// history
78
int
_histIndex
;
79
QList<QString>
_histList
;
80
QString
_histOldInput
;
// old _strInput
81
82
QTextCharFormat
_fmtNormal
;
83
QTextCharFormat
_fmtStdout
;
84
QTextCharFormat
_fmtStderr
;
85
86
// thread
87
QString
_bufSend
;
88
QMutex *
_thrWaitMut
;
89
QWaitCondition *
_thrWait
;
90
QMutex *
_thrIntrWaitMut
;
91
QWaitCondition *
_thrIntrWait
;
92
93
// pyconsole '/' commands
94
bool
cmdIntern
(QString strCmd);
95
QString
_strEntryFunc
;
96
97
// rarely used
98
CADocument
*
_canorusDoc
;
99
QWidget
*
_parent
;
100
};
101
102
#endif
/* PYCONSOLE_H_ */
Generated on Fri Jan 11 2013 14:40:13 for Canorus by
1.8.3