-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 100 |
1 files changed, 1 insertions, 99 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 01468ca..abcdb84 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -1,289 +1,191 @@ | |||
1 | #include <assert.h> | 1 | #include <assert.h> |
2 | 2 | ||
3 | #include <qaction.h> | 3 | #include <qaction.h> |
4 | #include <qmenubar.h> | 4 | #include <qmenubar.h> |
5 | #include <qlabel.h> | 5 | #include <qlabel.h> |
6 | #include <qpopupmenu.h> | 6 | #include <qpopupmenu.h> |
7 | #include <qtoolbar.h> | 7 | #include <qtoolbar.h> |
8 | #include <qmessagebox.h> | 8 | #include <qmessagebox.h> |
9 | #include <qpushbutton.h> | 9 | #include <qpushbutton.h> |
10 | #include <qwhatsthis.h> | 10 | #include <qwhatsthis.h> |
11 | #include <qfileinfo.h> | 11 | #include <qfileinfo.h> |
12 | #include <qtextstream.h> | 12 | #include <qtextstream.h> |
13 | 13 | ||
14 | #include <qpe/resource.h> | 14 | #include <qpe/resource.h> |
15 | #include <qpe/qpeapplication.h> | 15 | #include <qpe/qpeapplication.h> |
16 | #include <qpe/filemanager.h> | 16 | #include <qpe/filemanager.h> |
17 | #include <qpe/mimetype.h> | 17 | #include <qpe/mimetype.h> |
18 | 18 | ||
19 | #include <opie/ofiledialog.h> | 19 | #include <opie/ofiledialog.h> |
20 | 20 | ||
21 | #include "TEmulation.h" | 21 | #include "TEmulation.h" |
22 | #include "keytrans.h" | 22 | #include "keytrans.h" |
23 | #include "profileeditordialog.h" | 23 | #include "profileeditordialog.h" |
24 | #include "configdialog.h" | 24 | #include "configdialog.h" |
25 | #include "default.h" | 25 | #include "default.h" |
26 | #include "metafactory.h" | 26 | #include "metafactory.h" |
27 | #include "profile.h" | 27 | #include "profile.h" |
28 | #include "profilemanager.h" | 28 | #include "profilemanager.h" |
29 | #include "mainwindow.h" | 29 | #include "mainwindow.h" |
30 | #include "tabwidget.h" | 30 | #include "tabwidget.h" |
31 | #include "transferdialog.h" | 31 | #include "transferdialog.h" |
32 | #include "function_keyboard.h" | 32 | #include "function_keyboard.h" |
33 | #include "emulation_handler.h" | 33 | #include "emulation_handler.h" |
34 | #include "script.h" | 34 | #include "script.h" |
35 | 35 | ||
36 | static char * filesave_xpm[] = { | ||
37 | "16 16 78 1", | ||
38 | " c None", | ||
39 | ". c #343434", | ||
40 | "+ c #A0A0A0", | ||
41 | "@ c #565656", | ||
42 | "# c #9E9E9E", | ||
43 | "$ c #525252", | ||
44 | "% c #929292", | ||
45 | "& c #676767", | ||
46 | "* c #848484", | ||
47 | "= c #666666", | ||
48 | "- c #D8D8D8", | ||
49 | "; c #FFFFFF", | ||
50 | "> c #DBDBDB", | ||
51 | ", c #636363", | ||
52 | "' c #989898", | ||
53 | ") c #2D2D2D", | ||
54 | "! c #909090", | ||
55 | "~ c #AEAEAE", | ||
56 | "{ c #EAEAEA", | ||
57 | "] c #575757", | ||
58 | "^ c #585858", | ||
59 | "/ c #8A8A8A", | ||
60 | "( c #828282", | ||
61 | "_ c #6F6F6F", | ||
62 | ": c #C9C9C9", | ||
63 | "< c #050505", | ||
64 | "[ c #292929", | ||
65 | "} c #777777", | ||
66 | "| c #616161", | ||
67 | "1 c #3A3A3A", | ||
68 | "2 c #BEBEBE", | ||
69 | "3 c #2C2C2C", | ||
70 | "4 c #7C7C7C", | ||
71 | "5 c #F6F6F6", | ||
72 | "6 c #FCFCFC", | ||
73 | "7 c #6B6B6B", | ||
74 | "8 c #959595", | ||
75 | "9 c #4F4F4F", | ||
76 | "0 c #808080", | ||
77 | "a c #767676", | ||
78 | "b c #818181", | ||
79 | "c c #B8B8B8", | ||
80 | "d c #FBFBFB", | ||
81 | "e c #F9F9F9", | ||
82 | "f c #CCCCCC", | ||
83 | "g c #030303", | ||
84 | "h c #737373", | ||
85 | "i c #7A7A7A", | ||
86 | "j c #7E7E7E", | ||
87 | "k c #6A6A6A", | ||
88 | "l c #FAFAFA", | ||
89 | "m c #505050", | ||
90 | "n c #9D9D9D", | ||
91 | "o c #333333", | ||
92 | "p c #7B7B7B", | ||
93 | "q c #787878", | ||
94 | "r c #696969", | ||
95 | "s c #494949", | ||
96 | "t c #555555", | ||
97 | "u c #949494", | ||
98 | "v c #E6E6E6", | ||
99 | "w c #424242", | ||
100 | "x c #515151", | ||
101 | "y c #535353", | ||
102 | "z c #3E3E3E", | ||
103 | "A c #D4D4D4", | ||
104 | "B c #0C0C0C", | ||
105 | "C c #353535", | ||
106 | "D c #474747", | ||
107 | "E c #ECECEC", | ||
108 | "F c #919191", | ||
109 | "G c #7D7D7D", | ||
110 | "H c #000000", | ||
111 | "I c #404040", | ||
112 | "J c #858585", | ||
113 | "K c #323232", | ||
114 | "L c #D0D0D0", | ||
115 | "M c #1C1C1C", | ||
116 | " ...+ ", | ||
117 | " @#$%&..+ ", | ||
118 | " .*=-;;>,..+ ", | ||
119 | " ')!~;;;;;;{]..", | ||
120 | " ^/(-;;;;;;;_:<", | ||
121 | " [}|;;;;;;;{12$", | ||
122 | " #34-55;;;;678$+", | ||
123 | " 90ab=c;dd;e1fg ", | ||
124 | " [ahij((kbl0mn$ ", | ||
125 | " op^q^^7r&]s/$+ ", | ||
126 | "@btu;vbwxy]zAB ", | ||
127 | "CzDEvEv;;DssF$ ", | ||
128 | "G.H{E{E{IxsJ$+ ", | ||
129 | " +...vEKxzLM ", | ||
130 | " +...z]n$ ", | ||
131 | " +... "}; | ||
132 | |||
133 | |||
134 | 36 | ||
135 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { | 37 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { |
136 | KeyTrans::loadAll(); | 38 | KeyTrans::loadAll(); |
137 | for (int i = 0; i < KeyTrans::count(); i++ ) { | 39 | for (int i = 0; i < KeyTrans::count(); i++ ) { |
138 | KeyTrans* s = KeyTrans::find(i ); | 40 | KeyTrans* s = KeyTrans::find(i ); |
139 | assert( s ); | 41 | assert( s ); |
140 | } | 42 | } |
141 | m_factory = new MetaFactory(); | 43 | m_factory = new MetaFactory(); |
142 | Default def(m_factory); | 44 | Default def(m_factory); |
143 | m_sessions.setAutoDelete( TRUE ); | 45 | m_sessions.setAutoDelete( TRUE ); |
144 | m_curSession = 0; | 46 | m_curSession = 0; |
145 | m_manager = new ProfileManager( m_factory ); | 47 | m_manager = new ProfileManager( m_factory ); |
146 | m_manager->load(); | 48 | m_manager->load(); |
147 | m_scriptsData.setAutoDelete(TRUE); | 49 | m_scriptsData.setAutoDelete(TRUE); |
148 | 50 | ||
149 | initUI(); | 51 | initUI(); |
150 | populateProfiles(); | 52 | populateProfiles(); |
151 | populateScripts(); | 53 | populateScripts(); |
152 | } | 54 | } |
153 | void MainWindow::initUI() { | 55 | void MainWindow::initUI() { |
154 | setToolBarsMovable( FALSE ); | 56 | setToolBarsMovable( FALSE ); |
155 | 57 | ||
156 | /* tool bar for the menu */ | 58 | /* tool bar for the menu */ |
157 | m_tool = new QToolBar( this ); | 59 | m_tool = new QToolBar( this ); |
158 | m_tool->setHorizontalStretchable( TRUE ); | 60 | m_tool->setHorizontalStretchable( TRUE ); |
159 | 61 | ||
160 | m_bar = new QMenuBar( m_tool ); | 62 | m_bar = new QMenuBar( m_tool ); |
161 | m_console = new QPopupMenu( this ); | 63 | m_console = new QPopupMenu( this ); |
162 | m_scripts = new QPopupMenu( this ); | 64 | m_scripts = new QPopupMenu( this ); |
163 | m_sessionsPop= new QPopupMenu( this ); | 65 | m_sessionsPop= new QPopupMenu( this ); |
164 | m_scriptsPop = new QPopupMenu( this ); | 66 | m_scriptsPop = new QPopupMenu( this ); |
165 | 67 | ||
166 | /* add a toolbar for icons */ | 68 | /* add a toolbar for icons */ |
167 | m_icons = new QToolBar(this); | 69 | m_icons = new QToolBar(this); |
168 | 70 | ||
169 | /* | 71 | /* |
170 | * the settings action | 72 | * the settings action |
171 | */ | 73 | */ |
172 | m_setProfiles = new QAction(tr("Configure Profiles"), | 74 | m_setProfiles = new QAction(tr("Configure Profiles"), |
173 | Resource::loadPixmap( "SettingsIcon" ), | 75 | Resource::loadPixmap( "SettingsIcon" ), |
174 | QString::null, 0, this, 0); | 76 | QString::null, 0, this, 0); |
175 | m_setProfiles->addTo( m_console ); | 77 | m_setProfiles->addTo( m_console ); |
176 | connect( m_setProfiles, SIGNAL(activated() ), | 78 | connect( m_setProfiles, SIGNAL(activated() ), |
177 | this, SLOT(slotConfigure() ) ); | 79 | this, SLOT(slotConfigure() ) ); |
178 | 80 | ||
179 | m_console->insertSeparator(); | 81 | m_console->insertSeparator(); |
180 | /* | 82 | /* |
181 | * new Action for new sessions | 83 | * new Action for new sessions |
182 | */ | 84 | */ |
183 | QAction* newCon = new QAction(tr("New Connection"), | 85 | QAction* newCon = new QAction(tr("New Connection"), |
184 | Resource::loadPixmap( "new" ), | 86 | Resource::loadPixmap( "new" ), |
185 | QString::null, 0, this, 0); | 87 | QString::null, 0, this, 0); |
186 | newCon->addTo( m_console ); | 88 | newCon->addTo( m_console ); |
187 | connect( newCon, SIGNAL(activated() ), | 89 | connect( newCon, SIGNAL(activated() ), |
188 | this, SLOT(slotNew() ) ); | 90 | this, SLOT(slotNew() ) ); |
189 | 91 | ||
190 | m_console->insertSeparator(); | 92 | m_console->insertSeparator(); |
191 | 93 | ||
192 | QAction *saveCon = new QAction(tr("Save Connection"), | 94 | QAction *saveCon = new QAction(tr("Save Connection"), |
193 | QPixmap( ( const char** ) filesave_xpm ) , QString::null, | 95 | Resource::loadPixmap( "save" ), QString::null, |
194 | 0, this, 0 ); | 96 | 0, this, 0 ); |
195 | saveCon->addTo( m_console ); | 97 | saveCon->addTo( m_console ); |
196 | connect( saveCon, SIGNAL(activated() ), | 98 | connect( saveCon, SIGNAL(activated() ), |
197 | this, SLOT(slotSaveSession() ) ); | 99 | this, SLOT(slotSaveSession() ) ); |
198 | m_console->insertSeparator(); | 100 | m_console->insertSeparator(); |
199 | 101 | ||
200 | /* | 102 | /* |
201 | * connect action | 103 | * connect action |
202 | */ | 104 | */ |
203 | m_connect = new QAction( tr("Connect"), Resource::loadPixmap("console/connected"), | 105 | m_connect = new QAction( tr("Connect"), Resource::loadPixmap("console/connected"), |
204 | QString::null, 0, this, 0 ); | 106 | QString::null, 0, this, 0 ); |
205 | m_connect->addTo( m_console ); | 107 | m_connect->addTo( m_console ); |
206 | connect(m_connect, SIGNAL(activated() ), | 108 | connect(m_connect, SIGNAL(activated() ), |
207 | this, SLOT(slotConnect() ) ); | 109 | this, SLOT(slotConnect() ) ); |
208 | 110 | ||
209 | /* | 111 | /* |
210 | * disconnect action | 112 | * disconnect action |
211 | */ | 113 | */ |
212 | m_disconnect = new QAction( tr("Disconnect"), Resource::loadPixmap("console/notconnected"), | 114 | m_disconnect = new QAction( tr("Disconnect"), Resource::loadPixmap("console/notconnected"), |
213 | QString::null, 0, this, 0 ); | 115 | QString::null, 0, this, 0 ); |
214 | m_disconnect->addTo( m_console ); | 116 | m_disconnect->addTo( m_console ); |
215 | connect(m_disconnect, SIGNAL(activated() ), | 117 | connect(m_disconnect, SIGNAL(activated() ), |
216 | this, SLOT(slotDisconnect() ) ); | 118 | this, SLOT(slotDisconnect() ) ); |
217 | 119 | ||
218 | m_console->insertSeparator(); | 120 | m_console->insertSeparator(); |
219 | 121 | ||
220 | m_transfer = new QAction( tr("Transfer file..."), Resource::loadPixmap("pass") , QString::null, | 122 | m_transfer = new QAction( tr("Transfer file..."), Resource::loadPixmap("pass") , QString::null, |
221 | 0, this, 0 ); | 123 | 0, this, 0 ); |
222 | m_transfer->addTo( m_console ); | 124 | m_transfer->addTo( m_console ); |
223 | connect(m_transfer, SIGNAL(activated() ), | 125 | connect(m_transfer, SIGNAL(activated() ), |
224 | this, SLOT(slotTransfer() ) ); | 126 | this, SLOT(slotTransfer() ) ); |
225 | 127 | ||
226 | /* | 128 | /* |
227 | * immediate change of line wrap policy | 129 | * immediate change of line wrap policy |
228 | */ | 130 | */ |
229 | m_isWrapped = false; | 131 | m_isWrapped = false; |
230 | m_wrap = new QAction( tr("Line wrap"), Resource::loadPixmap( "linewrap" ), QString::null, 0, this, 0 ); | 132 | m_wrap = new QAction( tr("Line wrap"), Resource::loadPixmap( "linewrap" ), QString::null, 0, this, 0 ); |
231 | m_wrap->addTo( m_console ); | 133 | m_wrap->addTo( m_console ); |
232 | connect( m_wrap, SIGNAL( activated() ), SLOT( slotWrap() ) ); | 134 | connect( m_wrap, SIGNAL( activated() ), SLOT( slotWrap() ) ); |
233 | 135 | ||
234 | /* | 136 | /* |
235 | * fullscreen | 137 | * fullscreen |
236 | */ | 138 | */ |
237 | m_isFullscreen = false; | 139 | m_isFullscreen = false; |
238 | 140 | ||
239 | m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) | 141 | m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) |
240 | , QString::null, 0, this, 0); | 142 | , QString::null, 0, this, 0); |
241 | m_fullscreen->addTo( m_console ); | 143 | m_fullscreen->addTo( m_console ); |
242 | connect( m_fullscreen, SIGNAL( activated() ), | 144 | connect( m_fullscreen, SIGNAL( activated() ), |
243 | this, SLOT( slotFullscreen() ) ); | 145 | this, SLOT( slotFullscreen() ) ); |
244 | 146 | ||
245 | m_console->insertSeparator(); | 147 | m_console->insertSeparator(); |
246 | 148 | ||
247 | QAction *a = new QAction(); | 149 | QAction *a = new QAction(); |
248 | a->setText( tr("Save history") ); | 150 | a->setText( tr("Save history") ); |
249 | a->addTo( m_console ); | 151 | a->addTo( m_console ); |
250 | connect(a, SIGNAL(activated() ), | 152 | connect(a, SIGNAL(activated() ), |
251 | this, SLOT(slotSaveHistory() ) ); | 153 | this, SLOT(slotSaveHistory() ) ); |
252 | /* | 154 | /* |
253 | * terminate action | 155 | * terminate action |
254 | */ | 156 | */ |
255 | m_terminate = new QAction(); | 157 | m_terminate = new QAction(); |
256 | m_terminate->setText( tr("Terminate") ); | 158 | m_terminate->setText( tr("Terminate") ); |
257 | m_terminate->addTo( m_console ); | 159 | m_terminate->addTo( m_console ); |
258 | connect(m_terminate, SIGNAL(activated() ), | 160 | connect(m_terminate, SIGNAL(activated() ), |
259 | this, SLOT(slotTerminate() ) ); | 161 | this, SLOT(slotTerminate() ) ); |
260 | 162 | ||
261 | m_closewindow = new QAction(); | 163 | m_closewindow = new QAction(); |
262 | m_closewindow->setText( tr("Close Window") ); | 164 | m_closewindow->setText( tr("Close Window") ); |
263 | m_closewindow->addTo( m_console ); | 165 | m_closewindow->addTo( m_console ); |
264 | connect( m_closewindow, SIGNAL(activated() ), | 166 | connect( m_closewindow, SIGNAL(activated() ), |
265 | this, SLOT(slotClose() ) ); | 167 | this, SLOT(slotClose() ) ); |
266 | 168 | ||
267 | 169 | ||
268 | /* | 170 | /* |
269 | * script actions | 171 | * script actions |
270 | */ | 172 | */ |
271 | m_runScript_id = m_scripts->insertItem(tr("Run Script"), m_scriptsPop, -1, 0); | 173 | m_runScript_id = m_scripts->insertItem(tr("Run Script"), m_scriptsPop, -1, 0); |
272 | connect(m_scriptsPop, SIGNAL(activated(int)), this, SLOT(slotRunScript(int))); | 174 | connect(m_scriptsPop, SIGNAL(activated(int)), this, SLOT(slotRunScript(int))); |
273 | 175 | ||
274 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); | 176 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); |
275 | m_recordScript->addTo(m_scripts); | 177 | m_recordScript->addTo(m_scripts); |
276 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); | 178 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); |
277 | 179 | ||
278 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); | 180 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); |
279 | m_saveScript->addTo(m_scripts); | 181 | m_saveScript->addTo(m_scripts); |
280 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); | 182 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); |
281 | 183 | ||
282 | 184 | ||
283 | /* | 185 | /* |
284 | * action that open/closes the keyboard | 186 | * action that open/closes the keyboard |
285 | */ | 187 | */ |
286 | m_openKeys = new QAction (tr("Open Keyboard..."), | 188 | m_openKeys = new QAction (tr("Open Keyboard..."), |
287 | Resource::loadPixmap( "console/keys/keyboard_icon" ), | 189 | Resource::loadPixmap( "console/keys/keyboard_icon" ), |
288 | QString::null, 0, this, 0); | 190 | QString::null, 0, this, 0); |
289 | m_openKeys->setToggleAction(true); | 191 | m_openKeys->setToggleAction(true); |