author | harlekin <harlekin> | 2002-10-24 20:22:59 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-10-24 20:22:59 (UTC) |
commit | b3d13ad799eebbee3a1a73c4fe5b38167070ab87 (patch) (unidiff) | |
tree | 14f248b29279dec45ff94ced71fbb18b212cf897 | |
parent | 0b49e3192d9b7694c28fa82cf1ae509b86124e07 (diff) | |
download | opie-b3d13ad799eebbee3a1a73c4fe5b38167070ab87.zip opie-b3d13ad799eebbee3a1a73c4fe5b38167070ab87.tar.gz opie-b3d13ad799eebbee3a1a73c4fe5b38167070ab87.tar.bz2 |
more icons
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 895fa9e..888ab90 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -1,602 +1,601 @@ | |||
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 | 11 | ||
12 | #include <qpe/resource.h> | 12 | #include <qpe/resource.h> |
13 | #include <qpe/qpeapplication.h> | 13 | #include <qpe/qpeapplication.h> |
14 | #include <qpe/filemanager.h> | 14 | #include <qpe/filemanager.h> |
15 | #include <qpe/mimetype.h> | 15 | #include <qpe/mimetype.h> |
16 | 16 | ||
17 | #include <opie/ofiledialog.h> | 17 | #include <opie/ofiledialog.h> |
18 | 18 | ||
19 | #include "keytrans.h" | 19 | #include "keytrans.h" |
20 | #include "profileeditordialog.h" | 20 | #include "profileeditordialog.h" |
21 | #include "configdialog.h" | 21 | #include "configdialog.h" |
22 | #include "default.h" | 22 | #include "default.h" |
23 | #include "metafactory.h" | 23 | #include "metafactory.h" |
24 | #include "profile.h" | 24 | #include "profile.h" |
25 | #include "profilemanager.h" | 25 | #include "profilemanager.h" |
26 | #include "mainwindow.h" | 26 | #include "mainwindow.h" |
27 | #include "tabwidget.h" | 27 | #include "tabwidget.h" |
28 | #include "transferdialog.h" | 28 | #include "transferdialog.h" |
29 | #include "function_keyboard.h" | 29 | #include "function_keyboard.h" |
30 | #include "emulation_handler.h" | 30 | #include "emulation_handler.h" |
31 | #include "script.h" | 31 | #include "script.h" |
32 | 32 | ||
33 | static char * filesave_xpm[] = { | 33 | static char * filesave_xpm[] = { |
34 | "16 16 78 1", | 34 | "16 16 78 1", |
35 | " c None", | 35 | " c None", |
36 | ". c #343434", | 36 | ". c #343434", |
37 | "+ c #A0A0A0", | 37 | "+ c #A0A0A0", |
38 | "@ c #565656", | 38 | "@ c #565656", |
39 | "# c #9E9E9E", | 39 | "# c #9E9E9E", |
40 | "$ c #525252", | 40 | "$ c #525252", |
41 | "% c #929292", | 41 | "% c #929292", |
42 | "& c #676767", | 42 | "& c #676767", |
43 | "* c #848484", | 43 | "* c #848484", |
44 | "= c #666666", | 44 | "= c #666666", |
45 | "- c #D8D8D8", | 45 | "- c #D8D8D8", |
46 | "; c #FFFFFF", | 46 | "; c #FFFFFF", |
47 | "> c #DBDBDB", | 47 | "> c #DBDBDB", |
48 | ", c #636363", | 48 | ", c #636363", |
49 | "' c #989898", | 49 | "' c #989898", |
50 | ") c #2D2D2D", | 50 | ") c #2D2D2D", |
51 | "! c #909090", | 51 | "! c #909090", |
52 | "~ c #AEAEAE", | 52 | "~ c #AEAEAE", |
53 | "{ c #EAEAEA", | 53 | "{ c #EAEAEA", |
54 | "] c #575757", | 54 | "] c #575757", |
55 | "^ c #585858", | 55 | "^ c #585858", |
56 | "/ c #8A8A8A", | 56 | "/ c #8A8A8A", |
57 | "( c #828282", | 57 | "( c #828282", |
58 | "_ c #6F6F6F", | 58 | "_ c #6F6F6F", |
59 | ": c #C9C9C9", | 59 | ": c #C9C9C9", |
60 | "< c #050505", | 60 | "< c #050505", |
61 | "[ c #292929", | 61 | "[ c #292929", |
62 | "} c #777777", | 62 | "} c #777777", |
63 | "| c #616161", | 63 | "| c #616161", |
64 | "1 c #3A3A3A", | 64 | "1 c #3A3A3A", |
65 | "2 c #BEBEBE", | 65 | "2 c #BEBEBE", |
66 | "3 c #2C2C2C", | 66 | "3 c #2C2C2C", |
67 | "4 c #7C7C7C", | 67 | "4 c #7C7C7C", |
68 | "5 c #F6F6F6", | 68 | "5 c #F6F6F6", |
69 | "6 c #FCFCFC", | 69 | "6 c #FCFCFC", |
70 | "7 c #6B6B6B", | 70 | "7 c #6B6B6B", |
71 | "8 c #959595", | 71 | "8 c #959595", |
72 | "9 c #4F4F4F", | 72 | "9 c #4F4F4F", |
73 | "0 c #808080", | 73 | "0 c #808080", |
74 | "a c #767676", | 74 | "a c #767676", |
75 | "b c #818181", | 75 | "b c #818181", |
76 | "c c #B8B8B8", | 76 | "c c #B8B8B8", |
77 | "d c #FBFBFB", | 77 | "d c #FBFBFB", |
78 | "e c #F9F9F9", | 78 | "e c #F9F9F9", |
79 | "f c #CCCCCC", | 79 | "f c #CCCCCC", |
80 | "g c #030303", | 80 | "g c #030303", |
81 | "h c #737373", | 81 | "h c #737373", |
82 | "i c #7A7A7A", | 82 | "i c #7A7A7A", |
83 | "j c #7E7E7E", | 83 | "j c #7E7E7E", |
84 | "k c #6A6A6A", | 84 | "k c #6A6A6A", |
85 | "l c #FAFAFA", | 85 | "l c #FAFAFA", |
86 | "m c #505050", | 86 | "m c #505050", |
87 | "n c #9D9D9D", | 87 | "n c #9D9D9D", |
88 | "o c #333333", | 88 | "o c #333333", |
89 | "p c #7B7B7B", | 89 | "p c #7B7B7B", |
90 | "q c #787878", | 90 | "q c #787878", |
91 | "r c #696969", | 91 | "r c #696969", |
92 | "s c #494949", | 92 | "s c #494949", |
93 | "t c #555555", | 93 | "t c #555555", |
94 | "u c #949494", | 94 | "u c #949494", |
95 | "v c #E6E6E6", | 95 | "v c #E6E6E6", |
96 | "w c #424242", | 96 | "w c #424242", |
97 | "x c #515151", | 97 | "x c #515151", |
98 | "y c #535353", | 98 | "y c #535353", |
99 | "z c #3E3E3E", | 99 | "z c #3E3E3E", |
100 | "A c #D4D4D4", | 100 | "A c #D4D4D4", |
101 | "B c #0C0C0C", | 101 | "B c #0C0C0C", |
102 | "C c #353535", | 102 | "C c #353535", |
103 | "D c #474747", | 103 | "D c #474747", |
104 | "E c #ECECEC", | 104 | "E c #ECECEC", |
105 | "F c #919191", | 105 | "F c #919191", |
106 | "G c #7D7D7D", | 106 | "G c #7D7D7D", |
107 | "H c #000000", | 107 | "H c #000000", |
108 | "I c #404040", | 108 | "I c #404040", |
109 | "J c #858585", | 109 | "J c #858585", |
110 | "K c #323232", | 110 | "K c #323232", |
111 | "L c #D0D0D0", | 111 | "L c #D0D0D0", |
112 | "M c #1C1C1C", | 112 | "M c #1C1C1C", |
113 | " ...+ ", | 113 | " ...+ ", |
114 | " @#$%&..+ ", | 114 | " @#$%&..+ ", |
115 | " .*=-;;>,..+ ", | 115 | " .*=-;;>,..+ ", |
116 | " ')!~;;;;;;{]..", | 116 | " ')!~;;;;;;{]..", |
117 | " ^/(-;;;;;;;_:<", | 117 | " ^/(-;;;;;;;_:<", |
118 | " [}|;;;;;;;{12$", | 118 | " [}|;;;;;;;{12$", |
119 | " #34-55;;;;678$+", | 119 | " #34-55;;;;678$+", |
120 | " 90ab=c;dd;e1fg ", | 120 | " 90ab=c;dd;e1fg ", |
121 | " [ahij((kbl0mn$ ", | 121 | " [ahij((kbl0mn$ ", |
122 | " op^q^^7r&]s/$+ ", | 122 | " op^q^^7r&]s/$+ ", |
123 | "@btu;vbwxy]zAB ", | 123 | "@btu;vbwxy]zAB ", |
124 | "CzDEvEv;;DssF$ ", | 124 | "CzDEvEv;;DssF$ ", |
125 | "G.H{E{E{IxsJ$+ ", | 125 | "G.H{E{E{IxsJ$+ ", |
126 | " +...vEKxzLM ", | 126 | " +...vEKxzLM ", |
127 | " +...z]n$ ", | 127 | " +...z]n$ ", |
128 | " +... "}; | 128 | " +... "}; |
129 | 129 | ||
130 | 130 | ||
131 | 131 | ||
132 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { | 132 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { |
133 | KeyTrans::loadAll(); | 133 | KeyTrans::loadAll(); |
134 | for (int i = 0; i < KeyTrans::count(); i++ ) { | 134 | for (int i = 0; i < KeyTrans::count(); i++ ) { |
135 | KeyTrans* s = KeyTrans::find(i ); | 135 | KeyTrans* s = KeyTrans::find(i ); |
136 | assert( s ); | 136 | assert( s ); |
137 | } | 137 | } |
138 | m_factory = new MetaFactory(); | 138 | m_factory = new MetaFactory(); |
139 | Default def(m_factory); | 139 | Default def(m_factory); |
140 | m_sessions.setAutoDelete( TRUE ); | 140 | m_sessions.setAutoDelete( TRUE ); |
141 | m_curSession = 0; | 141 | m_curSession = 0; |
142 | m_manager = new ProfileManager( m_factory ); | 142 | m_manager = new ProfileManager( m_factory ); |
143 | m_manager->load(); | 143 | m_manager->load(); |
144 | 144 | ||
145 | initUI(); | 145 | initUI(); |
146 | populateProfiles(); | 146 | populateProfiles(); |
147 | populateScripts(); | 147 | populateScripts(); |
148 | } | 148 | } |
149 | void MainWindow::initUI() { | 149 | void MainWindow::initUI() { |
150 | setToolBarsMovable( FALSE ); | 150 | setToolBarsMovable( FALSE ); |
151 | 151 | ||
152 | /* tool bar for the menu */ | 152 | /* tool bar for the menu */ |
153 | m_tool = new QToolBar( this ); | 153 | m_tool = new QToolBar( this ); |
154 | m_tool->setHorizontalStretchable( TRUE ); | 154 | m_tool->setHorizontalStretchable( TRUE ); |
155 | 155 | ||
156 | m_bar = new QMenuBar( m_tool ); | 156 | m_bar = new QMenuBar( m_tool ); |
157 | m_console = new QPopupMenu( this ); | 157 | m_console = new QPopupMenu( this ); |
158 | m_scripts = new QPopupMenu( this ); | 158 | m_scripts = new QPopupMenu( this ); |
159 | m_sessionsPop= new QPopupMenu( this ); | 159 | m_sessionsPop= new QPopupMenu( this ); |
160 | m_scriptsPop = new QPopupMenu( this ); | 160 | m_scriptsPop = new QPopupMenu( this ); |
161 | 161 | ||
162 | /* add a toolbar for icons */ | 162 | /* add a toolbar for icons */ |
163 | m_icons = new QToolBar(this); | 163 | m_icons = new QToolBar(this); |
164 | 164 | ||
165 | /* | 165 | /* |
166 | * the settings action | 166 | * the settings action |
167 | */ | 167 | */ |
168 | m_setProfiles = new QAction(tr("Configure Profiles"), | 168 | m_setProfiles = new QAction(tr("Configure Profiles"), |
169 | Resource::loadPixmap( "SettingsIcon" ), | 169 | Resource::loadPixmap( "SettingsIcon" ), |
170 | QString::null, 0, this, 0); | 170 | QString::null, 0, this, 0); |
171 | m_setProfiles->addTo( m_console ); | 171 | m_setProfiles->addTo( m_console ); |
172 | connect( m_setProfiles, SIGNAL(activated() ), | 172 | connect( m_setProfiles, SIGNAL(activated() ), |
173 | this, SLOT(slotConfigure() ) ); | 173 | this, SLOT(slotConfigure() ) ); |
174 | 174 | ||
175 | m_console->insertSeparator(); | 175 | m_console->insertSeparator(); |
176 | /* | 176 | /* |
177 | * new Action for new sessions | 177 | * new Action for new sessions |
178 | */ | 178 | */ |
179 | QAction* newCon = new QAction(tr("New Connection"), | 179 | QAction* newCon = new QAction(tr("New Connection"), |
180 | Resource::loadPixmap( "new" ), | 180 | Resource::loadPixmap( "new" ), |
181 | QString::null, 0, this, 0); | 181 | QString::null, 0, this, 0); |
182 | newCon->addTo( m_console ); | 182 | newCon->addTo( m_console ); |
183 | connect( newCon, SIGNAL(activated() ), | 183 | connect( newCon, SIGNAL(activated() ), |
184 | this, SLOT(slotNew() ) ); | 184 | this, SLOT(slotNew() ) ); |
185 | 185 | ||
186 | m_console->insertSeparator(); | 186 | m_console->insertSeparator(); |
187 | /* save icon is not available */ | ||
188 | 187 | ||
189 | QAction *saveCon = new QAction(tr("Save Connection"), | 188 | QAction *saveCon = new QAction(tr("Save Connection"), |
190 | QPixmap( ( const char** ) filesave_xpm ) , QString::null, | 189 | QPixmap( ( const char** ) filesave_xpm ) , QString::null, |
191 | 0, this, 0 ); | 190 | 0, this, 0 ); |
192 | saveCon->addTo( m_console ); | 191 | saveCon->addTo( m_console ); |
193 | connect( saveCon, SIGNAL(activated() ), | 192 | connect( saveCon, SIGNAL(activated() ), |
194 | this, SLOT(slotSaveSession() ) ); | 193 | this, SLOT(slotSaveSession() ) ); |
195 | m_console->insertSeparator(); | 194 | m_console->insertSeparator(); |
196 | 195 | ||
197 | /* | 196 | /* |
198 | * connect action | 197 | * connect action |
199 | */ | 198 | */ |
200 | m_connect = new QAction(); | 199 | m_connect = new QAction( tr("Connect"), Resource::loadPixmap("console/connected"), |
201 | m_connect->setText( tr("Connect") ); | 200 | QString::null, 0, this, 0 ); |
202 | m_connect->addTo( m_console ); | 201 | m_connect->addTo( m_console ); |
203 | connect(m_connect, SIGNAL(activated() ), | 202 | connect(m_connect, SIGNAL(activated() ), |
204 | this, SLOT(slotConnect() ) ); | 203 | this, SLOT(slotConnect() ) ); |
205 | 204 | ||
206 | /* | 205 | /* |
207 | * disconnect action | 206 | * disconnect action |
208 | */ | 207 | */ |
209 | m_disconnect = new QAction(); | 208 | m_disconnect = new QAction( tr("Disconnect"), Resource::loadPixmap("console/notconnected"), |
210 | m_disconnect->setText( tr("Disconnect") ); | 209 | QString::null, 0, this, 0 ); |
211 | m_disconnect->addTo( m_console ); | 210 | m_disconnect->addTo( m_console ); |
212 | connect(m_disconnect, SIGNAL(activated() ), | 211 | connect(m_disconnect, SIGNAL(activated() ), |
213 | this, SLOT(slotDisconnect() ) ); | 212 | this, SLOT(slotDisconnect() ) ); |
214 | 213 | ||
215 | m_console->insertSeparator(); | 214 | m_console->insertSeparator(); |
216 | 215 | ||
217 | m_transfer = new QAction(); | 216 | m_transfer = new QAction( tr("Transfer file..."), Resource::loadPixmap("pass") , QString::null, |
218 | m_transfer->setText( tr("Transfer file...") ); | 217 | 0, this, 0 ); |
219 | m_transfer->addTo( m_console ); | 218 | m_transfer->addTo( m_console ); |
220 | connect(m_transfer, SIGNAL(activated() ), | 219 | connect(m_transfer, SIGNAL(activated() ), |
221 | this, SLOT(slotTransfer() ) ); | 220 | this, SLOT(slotTransfer() ) ); |
222 | 221 | ||
223 | 222 | ||
224 | /* | 223 | /* |
225 | * fullscreen | 224 | * fullscreen |
226 | */ | 225 | */ |
227 | m_isFullscreen = false; | 226 | m_isFullscreen = false; |
228 | 227 | ||
229 | m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) | 228 | m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) |
230 | , QString::null, 0, this, 0); | 229 | , QString::null, 0, this, 0); |
231 | m_fullscreen->addTo( m_console ); | 230 | m_fullscreen->addTo( m_console ); |
232 | connect( m_fullscreen, SIGNAL( activated() ), | 231 | connect( m_fullscreen, SIGNAL( activated() ), |
233 | this, SLOT( slotFullscreen() ) ); | 232 | this, SLOT( slotFullscreen() ) ); |
234 | 233 | ||
235 | m_console->insertSeparator(); | 234 | m_console->insertSeparator(); |
236 | /* | 235 | /* |
237 | * terminate action | 236 | * terminate action |
238 | */ | 237 | */ |
239 | m_terminate = new QAction(); | 238 | m_terminate = new QAction(); |
240 | m_terminate->setText( tr("Terminate") ); | 239 | m_terminate->setText( tr("Terminate") ); |
241 | m_terminate->addTo( m_console ); | 240 | m_terminate->addTo( m_console ); |
242 | connect(m_terminate, SIGNAL(activated() ), | 241 | connect(m_terminate, SIGNAL(activated() ), |
243 | this, SLOT(slotTerminate() ) ); | 242 | this, SLOT(slotTerminate() ) ); |
244 | 243 | ||
245 | m_closewindow = new QAction(); | 244 | m_closewindow = new QAction(); |
246 | m_closewindow->setText( tr("Close Window") ); | 245 | m_closewindow->setText( tr("Close Window") ); |
247 | m_closewindow->addTo( m_console ); | 246 | m_closewindow->addTo( m_console ); |
248 | connect( m_closewindow, SIGNAL(activated() ), | 247 | connect( m_closewindow, SIGNAL(activated() ), |
249 | this, SLOT(slotClose() ) ); | 248 | this, SLOT(slotClose() ) ); |
250 | 249 | ||
251 | 250 | ||
252 | /* | 251 | /* |
253 | * script actions | 252 | * script actions |
254 | */ | 253 | */ |
255 | m_runScript_id = m_scripts->insertItem(tr("Run Script"), m_scriptsPop, -1, 0); | 254 | m_runScript_id = m_scripts->insertItem(tr("Run Script"), m_scriptsPop, -1, 0); |
256 | connect(m_scriptsPop, SIGNAL(activated(int)), this, SLOT(slotRunScript(int))); | 255 | connect(m_scriptsPop, SIGNAL(activated(int)), this, SLOT(slotRunScript(int))); |
257 | 256 | ||
258 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); | 257 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); |
259 | m_recordScript->addTo(m_scripts); | 258 | m_recordScript->addTo(m_scripts); |
260 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); | 259 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); |
261 | 260 | ||
262 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); | 261 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); |
263 | m_saveScript->addTo(m_scripts); | 262 | m_saveScript->addTo(m_scripts); |
264 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); | 263 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); |
265 | 264 | ||
266 | 265 | ||
267 | /* | 266 | /* |
268 | * action that open/closes the keyboard | 267 | * action that open/closes the keyboard |
269 | */ | 268 | */ |
270 | m_openKeys = new QAction (tr("Open Keyboard..."), | 269 | m_openKeys = new QAction (tr("Open Keyboard..."), |
271 | Resource::loadPixmap( "console/keys/keyboard_icon" ), | 270 | Resource::loadPixmap( "console/keys/keyboard_icon" ), |
272 | QString::null, 0, this, 0); | 271 | QString::null, 0, this, 0); |
273 | m_openKeys->setToggleAction(true); | 272 | m_openKeys->setToggleAction(true); |
274 | connect (m_openKeys, SIGNAL(toggled(bool)), this, SLOT(slotOpenKeb(bool))); | 273 | connect (m_openKeys, SIGNAL(toggled(bool)), this, SLOT(slotOpenKeb(bool))); |
275 | 274 | ||
276 | /* insert the submenu */ | 275 | /* insert the submenu */ |
277 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, | 276 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, |
278 | -1, 0); | 277 | -1, 0); |
279 | 278 | ||
280 | /* insert the connection menu */ | 279 | /* insert the connection menu */ |
281 | m_bar->insertItem( tr("Connection"), m_console ); | 280 | m_bar->insertItem( tr("Connection"), m_console ); |
282 | 281 | ||
283 | /* the scripts menu */ | 282 | /* the scripts menu */ |
284 | m_bar->insertItem( tr("Scripts"), m_scripts ); | 283 | m_bar->insertItem( tr("Scripts"), m_scripts ); |
285 | 284 | ||
286 | /* and the keyboard */ | 285 | /* and the keyboard */ |
287 | m_keyBar = new QToolBar(this); | 286 | m_keyBar = new QToolBar(this); |
288 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); | 287 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); |
289 | m_keyBar->setHorizontalStretchable( TRUE ); | 288 | m_keyBar->setHorizontalStretchable( TRUE ); |
290 | m_keyBar->hide(); | 289 | m_keyBar->hide(); |
291 | 290 | ||
292 | m_kb = new FunctionKeyboard(m_keyBar); | 291 | m_kb = new FunctionKeyboard(m_keyBar); |
293 | connect(m_kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)), | 292 | connect(m_kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)), |
294 | this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool))); | 293 | this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool))); |
295 | 294 | ||
296 | 295 | ||
297 | QAction *a = new QAction(tr("Copy"), | 296 | QAction *a = new QAction(tr("Copy"), |
298 | Resource::loadPixmap("copy"), QString::null, | 297 | Resource::loadPixmap("copy"), QString::null, |
299 | 0, this, 0 ); | 298 | 0, this, 0 ); |
300 | //a->addTo( m_icons ); | 299 | //a->addTo( m_icons ); |
301 | connect( a, SIGNAL(activated() ), | 300 | connect( a, SIGNAL(activated() ), |
302 | this, SLOT(slotCopy() ) ); | 301 | this, SLOT(slotCopy() ) ); |
303 | 302 | ||
304 | QAction *paste = new QAction(tr("Paste"), | 303 | QAction *paste = new QAction(tr("Paste"), |
305 | Resource::loadPixmap("paste"), QString::null, | 304 | Resource::loadPixmap("paste"), QString::null, |
306 | 0, this, 0 ); | 305 | 0, this, 0 ); |
307 | connect( paste, SIGNAL(activated() ), | 306 | connect( paste, SIGNAL(activated() ), |
308 | this, SLOT(slotPaste() ) ); | 307 | this, SLOT(slotPaste() ) ); |
309 | 308 | ||
310 | 309 | ||
311 | newCon->addTo( m_icons ); | 310 | newCon->addTo( m_icons ); |
312 | m_setProfiles->addTo( m_icons ); | 311 | m_setProfiles->addTo( m_icons ); |
313 | paste->addTo( m_icons ); | 312 | paste->addTo( m_icons ); |
314 | m_openKeys->addTo(m_icons); | 313 | m_openKeys->addTo(m_icons); |
315 | m_fullscreen->addTo( m_icons ); | 314 | m_fullscreen->addTo( m_icons ); |
316 | 315 | ||
317 | m_connect->setEnabled( false ); | 316 | m_connect->setEnabled( false ); |
318 | m_disconnect->setEnabled( false ); | 317 | m_disconnect->setEnabled( false ); |
319 | m_terminate->setEnabled( false ); | 318 | m_terminate->setEnabled( false ); |
320 | m_transfer->setEnabled( false ); | 319 | m_transfer->setEnabled( false ); |
321 | m_scripts->setItemEnabled(m_runScript_id, false); | 320 | m_scripts->setItemEnabled(m_runScript_id, false); |
322 | m_recordScript->setEnabled( false ); | 321 | m_recordScript->setEnabled( false ); |
323 | m_saveScript->setEnabled( false ); | 322 | m_saveScript->setEnabled( false ); |
324 | m_fullscreen->setEnabled( false ); | 323 | m_fullscreen->setEnabled( false ); |
325 | m_closewindow->setEnabled( false ); | 324 | m_closewindow->setEnabled( false ); |
326 | 325 | ||
327 | /* | 326 | /* |
328 | * connect to the menu activation | 327 | * connect to the menu activation |
329 | */ | 328 | */ |
330 | connect( m_sessionsPop, SIGNAL(activated( int ) ), | 329 | connect( m_sessionsPop, SIGNAL(activated( int ) ), |
331 | this, SLOT(slotProfile( int ) ) ); | 330 | this, SLOT(slotProfile( int ) ) ); |
332 | 331 | ||
333 | m_consoleWindow = new TabWidget( this, "blah"); | 332 | m_consoleWindow = new TabWidget( this, "blah"); |
334 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), | 333 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), |
335 | this, SLOT(slotSessionChanged(Session*) ) ); | 334 | this, SLOT(slotSessionChanged(Session*) ) ); |
336 | setCentralWidget( m_consoleWindow ); | 335 | setCentralWidget( m_consoleWindow ); |
337 | 336 | ||
338 | } | 337 | } |
339 | 338 | ||
340 | ProfileManager* MainWindow::manager() { | 339 | ProfileManager* MainWindow::manager() { |
341 | return m_manager; | 340 | return m_manager; |
342 | } | 341 | } |
343 | TabWidget* MainWindow::tabWidget() { | 342 | TabWidget* MainWindow::tabWidget() { |
344 | return m_consoleWindow; | 343 | return m_consoleWindow; |
345 | } | 344 | } |
346 | void MainWindow::populateProfiles() { | 345 | void MainWindow::populateProfiles() { |
347 | m_sessionsPop->clear(); | 346 | m_sessionsPop->clear(); |
348 | Profile::ValueList list = manager()->all(); | 347 | Profile::ValueList list = manager()->all(); |
349 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { | 348 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { |
350 | m_sessionsPop->insertItem( (*it).name() ); | 349 | m_sessionsPop->insertItem( (*it).name() ); |
351 | } | 350 | } |
352 | 351 | ||
353 | } | 352 | } |
354 | 353 | ||
355 | void MainWindow::populateScripts() { | 354 | void MainWindow::populateScripts() { |
356 | m_scriptsPop->clear(); | 355 | m_scriptsPop->clear(); |
357 | m_scriptsData.clear(); | 356 | m_scriptsData.clear(); |
358 | DocLnkSet files(QPEApplication::documentDir(), "text/plain"); | 357 | DocLnkSet files(QPEApplication::documentDir(), "text/plain"); |
359 | QListIterator<DocLnk> dit(files.children()); | 358 | QListIterator<DocLnk> dit(files.children()); |
360 | for (; dit.current(); ++dit) { | 359 | for (; dit.current(); ++dit) { |
361 | if (*dit && (*dit)->name().length()>0) { | 360 | if (*dit && (*dit)->name().length()>0) { |
362 | m_scriptsData.append((*dit)); | 361 | m_scriptsData.append((*dit)); |
363 | m_scriptsPop->insertItem((*dit)->name()); | 362 | m_scriptsPop->insertItem((*dit)->name()); |
364 | } | 363 | } |
365 | } | 364 | } |
366 | 365 | ||
367 | } | 366 | } |
368 | 367 | ||
369 | MainWindow::~MainWindow() { | 368 | MainWindow::~MainWindow() { |
370 | delete m_factory; | 369 | delete m_factory; |
371 | manager()->save(); | 370 | manager()->save(); |
372 | } | 371 | } |
373 | 372 | ||
374 | MetaFactory* MainWindow::factory() { | 373 | MetaFactory* MainWindow::factory() { |
375 | return m_factory; | 374 | return m_factory; |
376 | } | 375 | } |
377 | 376 | ||
378 | Session* MainWindow::currentSession() { | 377 | Session* MainWindow::currentSession() { |
379 | return m_curSession; | 378 | return m_curSession; |
380 | } | 379 | } |
381 | 380 | ||
382 | QList<Session> MainWindow::sessions() { | 381 | QList<Session> MainWindow::sessions() { |
383 | return m_sessions; | 382 | return m_sessions; |
384 | } | 383 | } |
385 | 384 | ||
386 | void MainWindow::slotNew() { | 385 | void MainWindow::slotNew() { |
387 | ProfileEditorDialog dlg(factory() ); | 386 | ProfileEditorDialog dlg(factory() ); |
388 | dlg.showMaximized(); | 387 | dlg.showMaximized(); |
389 | int ret = dlg.exec(); | 388 | int ret = dlg.exec(); |
390 | 389 | ||
391 | if ( ret == QDialog::Accepted ) { | 390 | if ( ret == QDialog::Accepted ) { |
392 | create( dlg.profile() ); | 391 | create( dlg.profile() ); |
393 | } | 392 | } |
394 | } | 393 | } |
395 | 394 | ||
396 | void MainWindow::slotRecordScript() { | 395 | void MainWindow::slotRecordScript() { |
397 | if (currentSession()) { | 396 | if (currentSession()) { |
398 | currentSession()->emulationHandler()->startRecording(); | 397 | currentSession()->emulationHandler()->startRecording(); |
399 | m_saveScript->setEnabled(true); | 398 | m_saveScript->setEnabled(true); |
400 | m_recordScript->setEnabled(false); | 399 | m_recordScript->setEnabled(false); |
401 | } | 400 | } |
402 | } | 401 | } |
403 | 402 | ||
404 | void MainWindow::slotSaveScript() { | 403 | void MainWindow::slotSaveScript() { |
405 | if (currentSession() && currentSession()->emulationHandler()->isRecording()) { | 404 | if (currentSession() && currentSession()->emulationHandler()->isRecording()) { |
406 | QMap<QString, QStringList> map; | 405 | QMap<QString, QStringList> map; |
407 | QStringList text; | 406 | QStringList text; |
408 | text << "text/plain"; | 407 | text << "text/plain"; |
409 | map.insert(tr("Script"), text ); | 408 | map.insert(tr("Script"), text ); |
410 | QString filename = OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); | 409 | QString filename = OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); |
411 | if (!filename.isEmpty()) { | 410 | if (!filename.isEmpty()) { |
412 | DocLnk nf; | 411 | DocLnk nf; |
413 | nf.setType("text/plain"); | 412 | nf.setType("text/plain"); |
414 | nf.setFile(filename); | 413 | nf.setFile(filename); |
415 | nf.setName(filename); | 414 | nf.setName(filename); |
416 | FileManager fm; | 415 | FileManager fm; |
417 | fm.saveFile(nf, currentSession()->emulationHandler()->script()->script()); | 416 | fm.saveFile(nf, currentSession()->emulationHandler()->script()->script()); |
418 | currentSession()->emulationHandler()->clearScript(); | 417 | currentSession()->emulationHandler()->clearScript(); |
419 | m_saveScript->setEnabled(false); | 418 | m_saveScript->setEnabled(false); |
420 | m_recordScript->setEnabled(true); | 419 | m_recordScript->setEnabled(true); |
421 | populateScripts(); | 420 | populateScripts(); |
422 | } | 421 | } |
423 | } | 422 | } |
424 | } | 423 | } |
425 | 424 | ||
426 | void MainWindow::slotRunScript(int id) { | 425 | void MainWindow::slotRunScript(int id) { |
427 | if (currentSession()) { | 426 | if (currentSession()) { |
428 | DocLnk *lnk = m_scriptsData.at(m_scriptsPop->indexOf(id)); | 427 | DocLnk *lnk = m_scriptsData.at(m_scriptsPop->indexOf(id)); |
429 | QString filePath = lnk->file(); | 428 | QString filePath = lnk->file(); |
430 | printf("path is : %s\n", filePath.latin1()); | 429 | printf("path is : %s\n", filePath.latin1()); |
431 | Script script(filePath); | 430 | Script script(filePath); |
432 | currentSession()->emulationHandler()->runScript(&script); | 431 | currentSession()->emulationHandler()->runScript(&script); |
433 | } | 432 | } |
434 | } | 433 | } |
435 | 434 | ||
436 | void MainWindow::slotConnect() { | 435 | void MainWindow::slotConnect() { |
437 | if ( currentSession() ) { | 436 | if ( currentSession() ) { |
438 | bool ret = currentSession()->layer()->open(); | 437 | bool ret = currentSession()->layer()->open(); |
439 | if(!ret) QMessageBox::warning(currentSession()->widgetStack(), | 438 | if(!ret) QMessageBox::warning(currentSession()->widgetStack(), |
440 | QObject::tr("Failed"), | 439 | QObject::tr("Failed"), |
441 | QObject::tr("Connecting failed for this session.")); | 440 | QObject::tr("Connecting failed for this session.")); |
442 | else { | 441 | else { |
443 | m_connect->setEnabled( false ); | 442 | m_connect->setEnabled( false ); |
444 | m_disconnect->setEnabled( true ); | 443 | m_disconnect->setEnabled( true ); |
445 | m_transfer->setEnabled( true ); | 444 | m_transfer->setEnabled( true ); |
446 | m_recordScript->setEnabled( true ); | 445 | m_recordScript->setEnabled( true ); |
447 | m_scripts->setItemEnabled(m_runScript_id, true); | 446 | m_scripts->setItemEnabled(m_runScript_id, true); |
448 | } | 447 | } |
449 | } | 448 | } |
450 | } | 449 | } |
451 | 450 | ||
452 | void MainWindow::slotDisconnect() { | 451 | void MainWindow::slotDisconnect() { |
453 | if ( currentSession() ) { | 452 | if ( currentSession() ) { |
454 | currentSession()->layer()->close(); | 453 | currentSession()->layer()->close(); |
455 | m_connect->setEnabled( true ); | 454 | m_connect->setEnabled( true ); |
456 | m_disconnect->setEnabled( false ); | 455 | m_disconnect->setEnabled( false ); |
457 | m_transfer->setEnabled( false ); | 456 | m_transfer->setEnabled( false ); |
458 | m_recordScript->setEnabled( false); | 457 | m_recordScript->setEnabled( false); |
459 | m_saveScript->setEnabled( false ); | 458 | m_saveScript->setEnabled( false ); |
460 | m_scripts->setItemEnabled(m_runScript_id, false); | 459 | m_scripts->setItemEnabled(m_runScript_id, false); |
461 | } | 460 | } |
462 | } | 461 | } |
463 | 462 | ||
464 | void MainWindow::slotTerminate() { | 463 | void MainWindow::slotTerminate() { |
465 | if ( currentSession() ) | 464 | if ( currentSession() ) |
466 | currentSession()->layer()->close(); | 465 | currentSession()->layer()->close(); |
467 | 466 | ||
468 | slotClose(); | 467 | slotClose(); |
469 | /* FIXME move to the next session */ | 468 | /* FIXME move to the next session */ |
470 | } | 469 | } |
471 | 470 | ||
472 | void MainWindow::slotConfigure() { | 471 | void MainWindow::slotConfigure() { |
473 | ConfigDialog conf( manager()->all(), factory() ); | 472 | ConfigDialog conf( manager()->all(), factory() ); |
474 | conf.showMaximized(); | 473 | conf.showMaximized(); |
475 | 474 | ||
476 | int ret = conf.exec(); | 475 | int ret = conf.exec(); |
477 | 476 | ||
478 | if ( QDialog::Accepted == ret ) { | 477 | if ( QDialog::Accepted == ret ) { |
479 | manager()->setProfiles( conf.list() ); | 478 | manager()->setProfiles( conf.list() ); |
480 | manager()->save(); | 479 | manager()->save(); |
481 | populateProfiles(); | 480 | populateProfiles(); |
482 | } | 481 | } |
483 | } | 482 | } |
484 | /* | 483 | /* |
485 | * we will remove | 484 | * we will remove |
486 | * this window from the tabwidget | 485 | * this window from the tabwidget |
487 | * remove it from the list | 486 | * remove it from the list |
488 | * delete it | 487 | * delete it |
489 | * and set the currentSession() | 488 | * and set the currentSession() |
490 | */ | 489 | */ |
491 | void MainWindow::slotClose() { | 490 | void MainWindow::slotClose() { |
492 | if (!currentSession() ) | 491 | if (!currentSession() ) |
493 | return; | 492 | return; |
494 | 493 | ||
495 | Session* ses = currentSession(); | 494 | Session* ses = currentSession(); |
496 | qWarning("removing! currentSession %s", currentSession()->name().latin1() ); | 495 | qWarning("removing! currentSession %s", currentSession()->name().latin1() ); |
497 | /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ | 496 | /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ |
498 | m_curSession = NULL; | 497 | m_curSession = NULL; |
499 | tabWidget()->remove( /*currentSession()*/ses ); | 498 | tabWidget()->remove( /*currentSession()*/ses ); |
500 | /*it's autodelete */ | 499 | /*it's autodelete */ |
501 | m_sessions.remove( ses ); | 500 | m_sessions.remove( ses ); |
502 | qWarning("after remove!!"); | 501 | qWarning("after remove!!"); |
503 | 502 | ||
504 | if (!currentSession() ) { | 503 | if (!currentSession() ) { |
505 | m_connect->setEnabled( false ); | 504 | m_connect->setEnabled( false ); |
506 | m_disconnect->setEnabled( false ); | 505 | m_disconnect->setEnabled( false ); |
507 | m_terminate->setEnabled( false ); | 506 | m_terminate->setEnabled( false ); |
508 | m_transfer->setEnabled( false ); | 507 | m_transfer->setEnabled( false ); |
509 | m_recordScript->setEnabled( false ); | 508 | m_recordScript->setEnabled( false ); |
510 | m_saveScript->setEnabled( false ); | 509 | m_saveScript->setEnabled( false ); |
511 | m_scripts->setItemEnabled(m_runScript_id, false); | 510 | m_scripts->setItemEnabled(m_runScript_id, false); |
512 | m_fullscreen->setEnabled( false ); | 511 | m_fullscreen->setEnabled( false ); |
513 | m_closewindow->setEnabled( false ); | 512 | m_closewindow->setEnabled( false ); |
514 | } | 513 | } |
515 | 514 | ||
516 | m_kb->loadDefaults(); | 515 | m_kb->loadDefaults(); |
517 | } | 516 | } |
518 | 517 | ||
519 | /* | 518 | /* |
520 | * We will get the name | 519 | * We will get the name |
521 | * Then the profile | 520 | * Then the profile |
522 | * and then we will make a profile | 521 | * and then we will make a profile |
523 | */ | 522 | */ |
524 | void MainWindow::slotProfile( int id) { | 523 | void MainWindow::slotProfile( int id) { |
525 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); | 524 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); |
526 | create( prof ); | 525 | create( prof ); |
527 | } | 526 | } |
528 | void MainWindow::create( const Profile& prof ) { | 527 | void MainWindow::create( const Profile& prof ) { |
529 | Session *ses = manager()->fromProfile( prof, tabWidget() ); | 528 | Session *ses = manager()->fromProfile( prof, tabWidget() ); |
530 | 529 | ||
531 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) | 530 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) |
532 | { | 531 | { |
533 | QMessageBox::warning(this, | 532 | QMessageBox::warning(this, |
534 | QObject::tr("Session failed"), | 533 | QObject::tr("Session failed"), |
535 | QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); | 534 | QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); |
536 | //if(ses) delete ses; | 535 | //if(ses) delete ses; |
537 | return; | 536 | return; |
538 | } | 537 | } |
539 | 538 | ||
540 | m_sessions.append( ses ); | 539 | m_sessions.append( ses ); |
541 | tabWidget()->add( ses ); | 540 | tabWidget()->add( ses ); |
542 | tabWidget()->repaint(); | 541 | tabWidget()->repaint(); |
543 | m_curSession = ses; | 542 | m_curSession = ses; |
544 | 543 | ||
545 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it | 544 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it |
546 | m_connect->setEnabled( true ); | 545 | m_connect->setEnabled( true ); |
547 | m_disconnect->setEnabled( false ); | 546 | m_disconnect->setEnabled( false ); |
548 | m_terminate->setEnabled( true ); | 547 | m_terminate->setEnabled( true ); |
549 | m_fullscreen->setEnabled( true ); | 548 | m_fullscreen->setEnabled( true ); |
550 | m_closewindow->setEnabled( true ); | 549 | m_closewindow->setEnabled( true ); |
551 | m_transfer->setEnabled( false ); | 550 | m_transfer->setEnabled( false ); |
552 | m_recordScript->setEnabled( false ); | 551 | m_recordScript->setEnabled( false ); |
553 | m_saveScript->setEnabled( false ); | 552 | m_saveScript->setEnabled( false ); |
554 | m_scripts->setItemEnabled(m_runScript_id, false); | 553 | m_scripts->setItemEnabled(m_runScript_id, false); |
555 | 554 | ||
556 | // is io_layer wants direct connection, then autoconnect | 555 | // is io_layer wants direct connection, then autoconnect |
557 | //if ( ( m_curSession->layer() )->supports()[0] == 1 ) { | 556 | //if ( ( m_curSession->layer() )->supports()[0] == 1 ) { |
558 | if (prof.autoConnect()) { | 557 | if (prof.autoConnect()) { |
559 | slotConnect(); | 558 | slotConnect(); |
560 | } | 559 | } |
561 | 560 | ||
562 | 561 | ||
563 | 562 | ||
564 | QWidget *w = currentSession()->widget(); | 563 | QWidget *w = currentSession()->widget(); |
565 | if(w) w->setFocus(); | 564 | if(w) w->setFocus(); |
566 | 565 | ||
567 | m_kb->load(currentSession()->profile()); | 566 | m_kb->load(currentSession()->profile()); |
568 | } | 567 | } |
569 | 568 | ||
570 | void MainWindow::slotTransfer() | 569 | void MainWindow::slotTransfer() |
571 | { | 570 | { |
572 | if ( currentSession() ) { | 571 | if ( currentSession() ) { |
573 | TransferDialog dlg(currentSession()->widgetStack(), this); | 572 | TransferDialog dlg(currentSession()->widgetStack(), this); |
574 | dlg.showMaximized(); | 573 | dlg.showMaximized(); |
575 | //currentSession()->widgetStack()->add(dlg); | 574 | //currentSession()->widgetStack()->add(dlg); |
576 | dlg.exec(); | 575 | dlg.exec(); |
577 | } | 576 | } |
578 | } | 577 | } |
579 | 578 | ||
580 | 579 | ||
581 | void MainWindow::slotOpenKeb(bool state) { | 580 | void MainWindow::slotOpenKeb(bool state) { |
582 | 581 | ||
583 | if (state) m_keyBar->show(); | 582 | if (state) m_keyBar->show(); |
584 | else m_keyBar->hide(); | 583 | else m_keyBar->hide(); |
585 | 584 | ||
586 | } | 585 | } |
587 | 586 | ||
588 | 587 | ||
589 | void MainWindow::slotOpenButtons( bool state ) { | 588 | void MainWindow::slotOpenButtons( bool state ) { |
590 | 589 | ||
591 | if ( state ) { | 590 | if ( state ) { |
592 | m_buttonBar->show(); | 591 | m_buttonBar->show(); |
593 | } else { | 592 | } else { |
594 | m_buttonBar->hide(); | 593 | m_buttonBar->hide(); |
595 | } | 594 | } |
596 | } | 595 | } |
597 | 596 | ||
598 | 597 | ||
599 | 598 | ||
600 | void MainWindow::slotSessionChanged( Session* ses ) { | 599 | void MainWindow::slotSessionChanged( Session* ses ) { |
601 | qWarning("changed!"); | 600 | qWarning("changed!"); |
602 | if ( ses ) { | 601 | if ( ses ) { |