-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 47 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.h | 1 |
2 files changed, 17 insertions, 31 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 745efaf..44ef458 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -1,597 +1,584 @@ | |||
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 | 13 | ||
14 | #include <opie/ofiledialog.h> | 14 | #include <opie/ofiledialog.h> |
15 | 15 | ||
16 | #include "keytrans.h" | 16 | #include "keytrans.h" |
17 | #include "profileeditordialog.h" | 17 | #include "profileeditordialog.h" |
18 | #include "configdialog.h" | 18 | #include "configdialog.h" |
19 | #include "default.h" | 19 | #include "default.h" |
20 | #include "metafactory.h" | 20 | #include "metafactory.h" |
21 | #include "profile.h" | 21 | #include "profile.h" |
22 | #include "profilemanager.h" | 22 | #include "profilemanager.h" |
23 | #include "mainwindow.h" | 23 | #include "mainwindow.h" |
24 | #include "tabwidget.h" | 24 | #include "tabwidget.h" |
25 | #include "transferdialog.h" | 25 | #include "transferdialog.h" |
26 | #include "function_keyboard.h" | 26 | #include "function_keyboard.h" |
27 | #include "emulation_handler.h" | 27 | #include "emulation_handler.h" |
28 | #include "script.h" | 28 | #include "script.h" |
29 | 29 | ||
30 | 30 | ||
31 | 31 | ||
32 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { | 32 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { |
33 | KeyTrans::loadAll(); | 33 | KeyTrans::loadAll(); |
34 | for (int i = 0; i < KeyTrans::count(); i++ ) { | 34 | for (int i = 0; i < KeyTrans::count(); i++ ) { |
35 | KeyTrans* s = KeyTrans::find(i ); | 35 | KeyTrans* s = KeyTrans::find(i ); |
36 | assert( s ); | 36 | assert( s ); |
37 | } | 37 | } |
38 | m_factory = new MetaFactory(); | 38 | m_factory = new MetaFactory(); |
39 | Default def(m_factory); | 39 | Default def(m_factory); |
40 | m_sessions.setAutoDelete( TRUE ); | 40 | m_sessions.setAutoDelete( TRUE ); |
41 | m_curSession = 0; | 41 | m_curSession = 0; |
42 | m_manager = new ProfileManager( m_factory ); | 42 | m_manager = new ProfileManager( m_factory ); |
43 | m_manager->load(); | 43 | m_manager->load(); |
44 | 44 | ||
45 | initUI(); | 45 | initUI(); |
46 | populateProfiles(); | 46 | populateProfiles(); |
47 | } | 47 | } |
48 | void MainWindow::initUI() { | 48 | void MainWindow::initUI() { |
49 | setToolBarsMovable( FALSE ); | 49 | setToolBarsMovable( FALSE ); |
50 | 50 | ||
51 | /* tool bar for the menu */ | 51 | /* tool bar for the menu */ |
52 | m_tool = new QToolBar( this ); | 52 | m_tool = new QToolBar( this ); |
53 | m_tool->setHorizontalStretchable( TRUE ); | 53 | m_tool->setHorizontalStretchable( TRUE ); |
54 | 54 | ||
55 | m_bar = new QMenuBar( m_tool ); | 55 | m_bar = new QMenuBar( m_tool ); |
56 | m_console = new QPopupMenu( this ); | 56 | m_console = new QPopupMenu( this ); |
57 | m_scripts = new QPopupMenu( this ); | 57 | m_scripts = new QPopupMenu( this ); |
58 | m_sessionsPop= new QPopupMenu( this ); | 58 | m_sessionsPop= new QPopupMenu( this ); |
59 | //m_settings = new QPopupMenu( this ); | ||
60 | 59 | ||
61 | /* add a toolbar for icons */ | 60 | /* add a toolbar for icons */ |
62 | m_icons = new QToolBar(this); | 61 | m_icons = new QToolBar(this); |
63 | 62 | ||
64 | |||
65 | |||
66 | |||
67 | /* | 63 | /* |
68 | * the settings action | 64 | * the settings action |
69 | */ | 65 | */ |
70 | m_setProfiles = new QAction(tr("Configure Profiles"), | 66 | m_setProfiles = new QAction(tr("Configure Profiles"), |
71 | Resource::loadPixmap( "SettingsIcon" ), | 67 | Resource::loadPixmap( "SettingsIcon" ), |
72 | QString::null, 0, this, 0); | 68 | QString::null, 0, this, 0); |
73 | // m_setProfiles->addTo( m_settings ); | ||
74 | m_setProfiles->addTo( m_icons ); | ||
75 | m_setProfiles->addTo( m_console ); | 69 | m_setProfiles->addTo( m_console ); |
76 | connect( m_setProfiles, SIGNAL(activated() ), | 70 | connect( m_setProfiles, SIGNAL(activated() ), |
77 | this, SLOT(slotConfigure() ) ); | 71 | this, SLOT(slotConfigure() ) ); |
78 | 72 | ||
79 | m_console->insertSeparator(); | 73 | m_console->insertSeparator(); |
80 | /* | 74 | /* |
81 | * new Action for new sessions | 75 | * new Action for new sessions |
82 | */ | 76 | */ |
83 | QAction* a = new QAction(tr("New Connection"), | 77 | QAction* newCon = new QAction(tr("New Connection"), |
84 | Resource::loadPixmap( "new" ), | 78 | Resource::loadPixmap( "new" ), |
85 | QString::null, 0, this, 0); | 79 | QString::null, 0, this, 0); |
86 | a->addTo( m_console ); | 80 | newCon->addTo( m_console ); |
87 | a->addTo( m_icons ); | 81 | connect( newCon, SIGNAL(activated() ), |
88 | connect(a, SIGNAL(activated() ), | ||
89 | this, SLOT(slotNew() ) ); | 82 | this, SLOT(slotNew() ) ); |
90 | 83 | ||
91 | m_console->insertSeparator(); | 84 | m_console->insertSeparator(); |
92 | /* save icon is not available */ | 85 | /* save icon is not available */ |
93 | a = new QAction(tr("Save Connection"), | 86 | |
87 | QAction *saveCon = new QAction(tr("Save Connection"), | ||
94 | Resource::loadPixmap("save"), QString::null, | 88 | Resource::loadPixmap("save"), QString::null, |
95 | 0, this, 0 ); | 89 | 0, this, 0 ); |
96 | a->addTo( m_console ); | 90 | saveCon->addTo( m_console ); |
97 | connect(a, SIGNAL(activated() ), | 91 | connect( saveCon, SIGNAL(activated() ), |
98 | this, SLOT(slotSaveSession() ) ); | 92 | this, SLOT(slotSaveSession() ) ); |
99 | m_console->insertSeparator(); | 93 | m_console->insertSeparator(); |
100 | 94 | ||
101 | /* | 95 | /* |
102 | * connect action | 96 | * connect action |
103 | */ | 97 | */ |
104 | m_connect = new QAction(); | 98 | m_connect = new QAction(); |
105 | m_connect->setText( tr("Connect") ); | 99 | m_connect->setText( tr("Connect") ); |
106 | m_connect->addTo( m_console ); | 100 | m_connect->addTo( m_console ); |
107 | connect(m_connect, SIGNAL(activated() ), | 101 | connect(m_connect, SIGNAL(activated() ), |
108 | this, SLOT(slotConnect() ) ); | 102 | this, SLOT(slotConnect() ) ); |
109 | 103 | ||
110 | /* | 104 | /* |
111 | * disconnect action | 105 | * disconnect action |
112 | */ | 106 | */ |
113 | m_disconnect = new QAction(); | 107 | m_disconnect = new QAction(); |
114 | m_disconnect->setText( tr("Disconnect") ); | 108 | m_disconnect->setText( tr("Disconnect") ); |
115 | m_disconnect->addTo( m_console ); | 109 | m_disconnect->addTo( m_console ); |
116 | connect(m_disconnect, SIGNAL(activated() ), | 110 | connect(m_disconnect, SIGNAL(activated() ), |
117 | this, SLOT(slotDisconnect() ) ); | 111 | this, SLOT(slotDisconnect() ) ); |
118 | 112 | ||
119 | m_console->insertSeparator(); | 113 | m_console->insertSeparator(); |
120 | 114 | ||
121 | m_transfer = new QAction(); | 115 | m_transfer = new QAction(); |
122 | m_transfer->setText( tr("Transfer file...") ); | 116 | m_transfer->setText( tr("Transfer file...") ); |
123 | m_transfer->addTo( m_console ); | 117 | m_transfer->addTo( m_console ); |
124 | connect(m_transfer, SIGNAL(activated() ), | 118 | connect(m_transfer, SIGNAL(activated() ), |
125 | this, SLOT(slotTransfer() ) ); | 119 | this, SLOT(slotTransfer() ) ); |
126 | 120 | ||
127 | 121 | ||
128 | /* | 122 | /* |
129 | * fullscreen | 123 | * fullscreen |
130 | */ | 124 | */ |
131 | m_isFullscreen = false; | 125 | m_isFullscreen = false; |
132 | 126 | ||
133 | m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) | 127 | m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) |
134 | , QString::null, 0, this, 0); | 128 | , QString::null, 0, this, 0); |
135 | m_fullscreen->addTo( m_console ); | 129 | m_fullscreen->addTo( m_console ); |
136 | m_fullscreen->addTo( m_icons ); | ||
137 | connect( m_fullscreen, SIGNAL( activated() ), | 130 | connect( m_fullscreen, SIGNAL( activated() ), |
138 | this, SLOT( slotFullscreen() ) ); | 131 | this, SLOT( slotFullscreen() ) ); |
139 | 132 | ||
140 | m_console->insertSeparator(); | 133 | m_console->insertSeparator(); |
141 | /* | 134 | /* |
142 | * terminate action | 135 | * terminate action |
143 | */ | 136 | */ |
144 | m_terminate = new QAction(); | 137 | m_terminate = new QAction(); |
145 | m_terminate->setText( tr("Terminate") ); | 138 | m_terminate->setText( tr("Terminate") ); |
146 | m_terminate->addTo( m_console ); | 139 | m_terminate->addTo( m_console ); |
147 | connect(m_terminate, SIGNAL(activated() ), | 140 | connect(m_terminate, SIGNAL(activated() ), |
148 | this, SLOT(slotTerminate() ) ); | 141 | this, SLOT(slotTerminate() ) ); |
149 | 142 | ||
150 | m_closewindow = new QAction(); | 143 | m_closewindow = new QAction(); |
151 | m_closewindow->setText( tr("Close Window") ); | 144 | m_closewindow->setText( tr("Close Window") ); |
152 | m_closewindow->addTo( m_console ); | 145 | m_closewindow->addTo( m_console ); |
153 | connect( m_closewindow, SIGNAL(activated() ), | 146 | connect( m_closewindow, SIGNAL(activated() ), |
154 | this, SLOT(slotClose() ) ); | 147 | this, SLOT(slotClose() ) ); |
155 | 148 | ||
156 | 149 | ||
157 | /* | 150 | /* |
158 | * script actions | 151 | * script actions |
159 | */ | 152 | */ |
160 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); | 153 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); |
161 | m_recordScript->addTo(m_scripts); | 154 | m_recordScript->addTo(m_scripts); |
162 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); | 155 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); |
163 | 156 | ||
164 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); | 157 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); |
165 | m_saveScript->addTo(m_scripts); | 158 | m_saveScript->addTo(m_scripts); |
166 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); | 159 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); |
167 | 160 | ||
168 | m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0); | 161 | m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0); |
169 | m_runScript->addTo(m_scripts); | 162 | m_runScript->addTo(m_scripts); |
170 | connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript())); | 163 | connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript())); |
171 | 164 | ||
172 | /* | 165 | /* |
173 | * action that open/closes the keyboard | 166 | * action that open/closes the keyboard |
174 | */ | 167 | */ |
175 | m_openKeys = new QAction (tr("Open Keyboard..."), | 168 | m_openKeys = new QAction (tr("Open Keyboard..."), |
176 | Resource::loadPixmap( "console/keys/keyboard_icon" ), | 169 | Resource::loadPixmap( "console/keys/keyboard_icon" ), |
177 | QString::null, 0, this, 0); | 170 | QString::null, 0, this, 0); |
178 | |||
179 | m_openKeys->setToggleAction(true); | 171 | m_openKeys->setToggleAction(true); |
180 | 172 | connect (m_openKeys, SIGNAL(toggled(bool)), this, SLOT(slotOpenKeb(bool))); | |
181 | connect (m_openKeys, SIGNAL(toggled(bool)), | ||
182 | this, SLOT(slotOpenKeb(bool))); | ||
183 | m_openKeys->addTo(m_icons); | ||
184 | 173 | ||
185 | /* insert the submenu */ | 174 | /* insert the submenu */ |
186 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, | 175 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, |
187 | -1, 0); | 176 | -1, 0); |
188 | 177 | ||
189 | /* insert the connection menu */ | 178 | /* insert the connection menu */ |
190 | m_bar->insertItem( tr("Connection"), m_console ); | 179 | m_bar->insertItem( tr("Connection"), m_console ); |
191 | 180 | ||
192 | /* the scripts menu */ | 181 | /* the scripts menu */ |
193 | m_bar->insertItem( tr("Scripts"), m_scripts ); | 182 | m_bar->insertItem( tr("Scripts"), m_scripts ); |
194 | 183 | ||
195 | /* the settings menu */ | ||
196 | // m_bar->insertItem( tr("Settings"), m_settings ); | ||
197 | |||
198 | /* and the keyboard */ | 184 | /* and the keyboard */ |
199 | m_keyBar = new QToolBar(this); | 185 | m_keyBar = new QToolBar(this); |
200 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); | 186 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); |
201 | m_keyBar->setHorizontalStretchable( TRUE ); | 187 | m_keyBar->setHorizontalStretchable( TRUE ); |
202 | m_keyBar->hide(); | 188 | m_keyBar->hide(); |
203 | 189 | ||
204 | m_kb = new FunctionKeyboard(m_keyBar); | 190 | m_kb = new FunctionKeyboard(m_keyBar); |
205 | connect(m_kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)), | 191 | connect(m_kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)), |
206 | this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool))); | 192 | this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool))); |
207 | 193 | ||
208 | m_buttonBar = new QToolBar( this ); | ||
209 | addToolBar( m_buttonBar, "Buttons", QMainWindow::Top, TRUE ); | ||
210 | m_buttonBar->setHorizontalStretchable( TRUE ); | ||
211 | m_buttonBar->hide(); | ||
212 | 194 | ||
213 | a = new QAction(tr("Copy"), | 195 | QAction *a = new QAction(tr("Copy"), |
214 | Resource::loadPixmap("copy"), QString::null, | 196 | Resource::loadPixmap("copy"), QString::null, |
215 | 0, this, 0 ); | 197 | 0, this, 0 ); |
216 | //a->addTo( m_icons ); | 198 | //a->addTo( m_icons ); |
217 | connect( a, SIGNAL(activated() ), | 199 | connect( a, SIGNAL(activated() ), |
218 | this, SLOT(slotCopy() ) ); | 200 | this, SLOT(slotCopy() ) ); |
219 | 201 | ||
220 | a = new QAction(tr("Paste"), | 202 | QAction *paste = new QAction(tr("Paste"), |
221 | Resource::loadPixmap("paste"), QString::null, | 203 | Resource::loadPixmap("paste"), QString::null, |
222 | 0, this, 0 ); | 204 | 0, this, 0 ); |
223 | a->addTo( m_icons ); | 205 | connect( paste, SIGNAL(activated() ), |
224 | connect( a, SIGNAL(activated() ), | ||
225 | this, SLOT(slotPaste() ) ); | 206 | this, SLOT(slotPaste() ) ); |
226 | 207 | ||
227 | 208 | ||
209 | newCon->addTo( m_icons ); | ||
210 | m_setProfiles->addTo( m_icons ); | ||
211 | paste->addTo( m_icons ); | ||
212 | m_openKeys->addTo(m_icons); | ||
213 | m_fullscreen->addTo( m_icons ); | ||
214 | |||
228 | m_connect->setEnabled( false ); | 215 | m_connect->setEnabled( false ); |
229 | m_disconnect->setEnabled( false ); | 216 | m_disconnect->setEnabled( false ); |
230 | m_terminate->setEnabled( false ); | 217 | m_terminate->setEnabled( false ); |
231 | m_transfer->setEnabled( false ); | 218 | m_transfer->setEnabled( false ); |
232 | m_recordScript->setEnabled( false ); | 219 | m_recordScript->setEnabled( false ); |
233 | m_saveScript->setEnabled( false ); | 220 | m_saveScript->setEnabled( false ); |
234 | m_runScript->setEnabled( false ); | 221 | m_runScript->setEnabled( false ); |
235 | m_fullscreen->setEnabled( false ); | 222 | m_fullscreen->setEnabled( false ); |
236 | m_closewindow->setEnabled( false ); | 223 | m_closewindow->setEnabled( false ); |
237 | 224 | ||
238 | /* | 225 | /* |
239 | * connect to the menu activation | 226 | * connect to the menu activation |
240 | */ | 227 | */ |
241 | connect( m_sessionsPop, SIGNAL(activated( int ) ), | 228 | connect( m_sessionsPop, SIGNAL(activated( int ) ), |
242 | this, SLOT(slotProfile( int ) ) ); | 229 | this, SLOT(slotProfile( int ) ) ); |
243 | 230 | ||
244 | m_consoleWindow = new TabWidget( this, "blah"); | 231 | m_consoleWindow = new TabWidget( this, "blah"); |
245 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), | 232 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), |
246 | this, SLOT(slotSessionChanged(Session*) ) ); | 233 | this, SLOT(slotSessionChanged(Session*) ) ); |
247 | setCentralWidget( m_consoleWindow ); | 234 | setCentralWidget( m_consoleWindow ); |
248 | 235 | ||
249 | } | 236 | } |
250 | 237 | ||
251 | ProfileManager* MainWindow::manager() { | 238 | ProfileManager* MainWindow::manager() { |
252 | return m_manager; | 239 | return m_manager; |
253 | } | 240 | } |
254 | TabWidget* MainWindow::tabWidget() { | 241 | TabWidget* MainWindow::tabWidget() { |
255 | return m_consoleWindow; | 242 | return m_consoleWindow; |
256 | } | 243 | } |
257 | void MainWindow::populateProfiles() { | 244 | void MainWindow::populateProfiles() { |
258 | m_sessionsPop->clear(); | 245 | m_sessionsPop->clear(); |
259 | Profile::ValueList list = manager()->all(); | 246 | Profile::ValueList list = manager()->all(); |
260 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { | 247 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { |
261 | m_sessionsPop->insertItem( (*it).name() ); | 248 | m_sessionsPop->insertItem( (*it).name() ); |
262 | } | 249 | } |
263 | 250 | ||
264 | } | 251 | } |
265 | MainWindow::~MainWindow() { | 252 | MainWindow::~MainWindow() { |
266 | delete m_factory; | 253 | delete m_factory; |
267 | manager()->save(); | 254 | manager()->save(); |
268 | } | 255 | } |
269 | 256 | ||
270 | MetaFactory* MainWindow::factory() { | 257 | MetaFactory* MainWindow::factory() { |
271 | return m_factory; | 258 | return m_factory; |
272 | } | 259 | } |
273 | 260 | ||
274 | Session* MainWindow::currentSession() { | 261 | Session* MainWindow::currentSession() { |
275 | return m_curSession; | 262 | return m_curSession; |
276 | } | 263 | } |
277 | 264 | ||
278 | QList<Session> MainWindow::sessions() { | 265 | QList<Session> MainWindow::sessions() { |
279 | return m_sessions; | 266 | return m_sessions; |
280 | } | 267 | } |
281 | 268 | ||
282 | void MainWindow::slotNew() { | 269 | void MainWindow::slotNew() { |
283 | ProfileEditorDialog dlg(factory() ); | 270 | ProfileEditorDialog dlg(factory() ); |
284 | dlg.showMaximized(); | 271 | dlg.showMaximized(); |
285 | int ret = dlg.exec(); | 272 | int ret = dlg.exec(); |
286 | 273 | ||
287 | if ( ret == QDialog::Accepted ) { | 274 | if ( ret == QDialog::Accepted ) { |
288 | create( dlg.profile() ); | 275 | create( dlg.profile() ); |
289 | } | 276 | } |
290 | } | 277 | } |
291 | 278 | ||
292 | void MainWindow::slotRecordScript() { | 279 | void MainWindow::slotRecordScript() { |
293 | if (currentSession()) { | 280 | if (currentSession()) { |
294 | currentSession()->emulationHandler()->startRecording(); | 281 | currentSession()->emulationHandler()->startRecording(); |
295 | } | 282 | } |
296 | } | 283 | } |
297 | 284 | ||
298 | void MainWindow::slotSaveScript() { | 285 | void MainWindow::slotSaveScript() { |
299 | if (currentSession() && currentSession()->emulationHandler()->isRecording()) { | 286 | if (currentSession() && currentSession()->emulationHandler()->isRecording()) { |
300 | MimeTypes types; | 287 | MimeTypes types; |
301 | QStringList script; | 288 | QStringList script; |
302 | script << "text/plain"; | 289 | script << "text/plain"; |
303 | script << "text/all"; | 290 | script << "text/all"; |
304 | script << "application/octet-stream"; | 291 | script << "application/octet-stream"; |
305 | types.insert("Script", script); | 292 | types.insert("Script", script); |
306 | QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types); | 293 | QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types); |
307 | if (!filename.isEmpty()) { | 294 | if (!filename.isEmpty()) { |
308 | currentSession()->emulationHandler()->script()->saveTo(filename); | 295 | currentSession()->emulationHandler()->script()->saveTo(filename); |
309 | currentSession()->emulationHandler()->clearScript(); | 296 | currentSession()->emulationHandler()->clearScript(); |
310 | } | 297 | } |
311 | } | 298 | } |
312 | } | 299 | } |
313 | 300 | ||
314 | void MainWindow::slotRunScript() { | 301 | void MainWindow::slotRunScript() { |
315 | if (currentSession()) { | 302 | if (currentSession()) { |
316 | MimeTypes types; | 303 | MimeTypes types; |
317 | QStringList script; | 304 | QStringList script; |
318 | script << "text/plain"; | 305 | script << "text/plain"; |
319 | script << "text/all"; | 306 | script << "text/all"; |
320 | script << "application/octet-stream"; | 307 | script << "application/octet-stream"; |
321 | types.insert("Script", script); | 308 | types.insert("Script", script); |
322 | QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types); | 309 | QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types); |
323 | if (!filename.isEmpty()) { | 310 | if (!filename.isEmpty()) { |
324 | Script script(DocLnk(filename).file()); | 311 | Script script(DocLnk(filename).file()); |
325 | currentSession()->emulationHandler()->runScript(&script); | 312 | currentSession()->emulationHandler()->runScript(&script); |
326 | } | 313 | } |
327 | } | 314 | } |
328 | } | 315 | } |
329 | 316 | ||
330 | void MainWindow::slotConnect() { | 317 | void MainWindow::slotConnect() { |
331 | if ( currentSession() ) { | 318 | if ( currentSession() ) { |
332 | bool ret = currentSession()->layer()->open(); | 319 | bool ret = currentSession()->layer()->open(); |
333 | if(!ret) QMessageBox::warning(currentSession()->widgetStack(), | 320 | if(!ret) QMessageBox::warning(currentSession()->widgetStack(), |
334 | QObject::tr("Failed"), | 321 | QObject::tr("Failed"), |
335 | QObject::tr("Connecting failed for this session.")); | 322 | QObject::tr("Connecting failed for this session.")); |
336 | else { | 323 | else { |
337 | m_connect->setEnabled( false ); | 324 | m_connect->setEnabled( false ); |
338 | m_disconnect->setEnabled( true ); | 325 | m_disconnect->setEnabled( true ); |
339 | m_transfer->setEnabled( true ); | 326 | m_transfer->setEnabled( true ); |
340 | m_recordScript->setEnabled( true ); | 327 | m_recordScript->setEnabled( true ); |
341 | m_saveScript->setEnabled( true ); | 328 | m_saveScript->setEnabled( true ); |
342 | m_runScript->setEnabled( true ); | 329 | m_runScript->setEnabled( true ); |
343 | } | 330 | } |
344 | } | 331 | } |
345 | } | 332 | } |
346 | 333 | ||
347 | void MainWindow::slotDisconnect() { | 334 | void MainWindow::slotDisconnect() { |
348 | if ( currentSession() ) { | 335 | if ( currentSession() ) { |
349 | currentSession()->layer()->close(); | 336 | currentSession()->layer()->close(); |
350 | m_connect->setEnabled( true ); | 337 | m_connect->setEnabled( true ); |
351 | m_disconnect->setEnabled( false ); | 338 | m_disconnect->setEnabled( false ); |
352 | m_transfer->setEnabled( false ); | 339 | m_transfer->setEnabled( false ); |
353 | m_recordScript->setEnabled( false); | 340 | m_recordScript->setEnabled( false); |
354 | m_saveScript->setEnabled( false ); | 341 | m_saveScript->setEnabled( false ); |
355 | m_runScript->setEnabled( false ); | 342 | m_runScript->setEnabled( false ); |
356 | } | 343 | } |
357 | } | 344 | } |
358 | 345 | ||
359 | void MainWindow::slotTerminate() { | 346 | void MainWindow::slotTerminate() { |
360 | if ( currentSession() ) | 347 | if ( currentSession() ) |
361 | currentSession()->layer()->close(); | 348 | currentSession()->layer()->close(); |
362 | 349 | ||
363 | slotClose(); | 350 | slotClose(); |
364 | /* FIXME move to the next session */ | 351 | /* FIXME move to the next session */ |
365 | } | 352 | } |
366 | 353 | ||
367 | void MainWindow::slotConfigure() { | 354 | void MainWindow::slotConfigure() { |
368 | ConfigDialog conf( manager()->all(), factory() ); | 355 | ConfigDialog conf( manager()->all(), factory() ); |
369 | conf.showMaximized(); | 356 | conf.showMaximized(); |
370 | 357 | ||
371 | int ret = conf.exec(); | 358 | int ret = conf.exec(); |
372 | 359 | ||
373 | if ( QDialog::Accepted == ret ) { | 360 | if ( QDialog::Accepted == ret ) { |
374 | manager()->setProfiles( conf.list() ); | 361 | manager()->setProfiles( conf.list() ); |
375 | manager()->save(); | 362 | manager()->save(); |
376 | populateProfiles(); | 363 | populateProfiles(); |
377 | } | 364 | } |
378 | } | 365 | } |
379 | /* | 366 | /* |
380 | * we will remove | 367 | * we will remove |
381 | * this window from the tabwidget | 368 | * this window from the tabwidget |
382 | * remove it from the list | 369 | * remove it from the list |
383 | * delete it | 370 | * delete it |
384 | * and set the currentSession() | 371 | * and set the currentSession() |
385 | */ | 372 | */ |
386 | void MainWindow::slotClose() { | 373 | void MainWindow::slotClose() { |
387 | if (!currentSession() ) | 374 | if (!currentSession() ) |
388 | return; | 375 | return; |
389 | 376 | ||
390 | Session* ses = currentSession(); | 377 | Session* ses = currentSession(); |
391 | qWarning("removing! currentSession %s", currentSession()->name().latin1() ); | 378 | qWarning("removing! currentSession %s", currentSession()->name().latin1() ); |
392 | /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ | 379 | /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ |
393 | m_curSession = NULL; | 380 | m_curSession = NULL; |
394 | tabWidget()->remove( /*currentSession()*/ses ); | 381 | tabWidget()->remove( /*currentSession()*/ses ); |
395 | /*it's autodelete */ | 382 | /*it's autodelete */ |
396 | m_sessions.remove( ses ); | 383 | m_sessions.remove( ses ); |
397 | qWarning("after remove!!"); | 384 | qWarning("after remove!!"); |
398 | 385 | ||
399 | if (!currentSession() ) { | 386 | if (!currentSession() ) { |
400 | m_connect->setEnabled( false ); | 387 | m_connect->setEnabled( false ); |
401 | m_disconnect->setEnabled( false ); | 388 | m_disconnect->setEnabled( false ); |
402 | m_terminate->setEnabled( false ); | 389 | m_terminate->setEnabled( false ); |
403 | m_transfer->setEnabled( false ); | 390 | m_transfer->setEnabled( false ); |
404 | m_recordScript->setEnabled( false ); | 391 | m_recordScript->setEnabled( false ); |
405 | m_saveScript->setEnabled( false ); | 392 | m_saveScript->setEnabled( false ); |
406 | m_runScript->setEnabled( false ); | 393 | m_runScript->setEnabled( false ); |
407 | m_fullscreen->setEnabled( false ); | 394 | m_fullscreen->setEnabled( false ); |
408 | m_closewindow->setEnabled( false ); | 395 | m_closewindow->setEnabled( false ); |
409 | } | 396 | } |
410 | 397 | ||
411 | m_kb->loadDefaults(); | 398 | m_kb->loadDefaults(); |
412 | } | 399 | } |
413 | 400 | ||
414 | /* | 401 | /* |
415 | * We will get the name | 402 | * We will get the name |
416 | * Then the profile | 403 | * Then the profile |
417 | * and then we will make a profile | 404 | * and then we will make a profile |
418 | */ | 405 | */ |
419 | void MainWindow::slotProfile( int id) { | 406 | void MainWindow::slotProfile( int id) { |
420 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); | 407 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); |
421 | create( prof ); | 408 | create( prof ); |
422 | } | 409 | } |
423 | void MainWindow::create( const Profile& prof ) { | 410 | void MainWindow::create( const Profile& prof ) { |
424 | Session *ses = manager()->fromProfile( prof, tabWidget() ); | 411 | Session *ses = manager()->fromProfile( prof, tabWidget() ); |
425 | 412 | ||
426 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) | 413 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) |
427 | { | 414 | { |
428 | QMessageBox::warning(this, | 415 | QMessageBox::warning(this, |
429 | QObject::tr("Session failed"), | 416 | QObject::tr("Session failed"), |
430 | QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); | 417 | QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); |
431 | //if(ses) delete ses; | 418 | //if(ses) delete ses; |
432 | return; | 419 | return; |
433 | } | 420 | } |
434 | 421 | ||
435 | m_sessions.append( ses ); | 422 | m_sessions.append( ses ); |
436 | tabWidget()->add( ses ); | 423 | tabWidget()->add( ses ); |
437 | tabWidget()->repaint(); | 424 | tabWidget()->repaint(); |
438 | m_curSession = ses; | 425 | m_curSession = ses; |
439 | 426 | ||
440 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it | 427 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it |
441 | m_connect->setEnabled( true ); | 428 | m_connect->setEnabled( true ); |
442 | m_disconnect->setEnabled( false ); | 429 | m_disconnect->setEnabled( false ); |
443 | m_terminate->setEnabled( true ); | 430 | m_terminate->setEnabled( true ); |
444 | m_fullscreen->setEnabled( true ); | 431 | m_fullscreen->setEnabled( true ); |
445 | m_closewindow->setEnabled( true ); | 432 | m_closewindow->setEnabled( true ); |
446 | m_transfer->setEnabled( false ); | 433 | m_transfer->setEnabled( false ); |
447 | m_recordScript->setEnabled( false ); | 434 | m_recordScript->setEnabled( false ); |
448 | m_saveScript->setEnabled( false ); | 435 | m_saveScript->setEnabled( false ); |
449 | m_runScript->setEnabled( false ); | 436 | m_runScript->setEnabled( false ); |
450 | 437 | ||
451 | // is io_layer wants direct connection, then autoconnect | 438 | // is io_layer wants direct connection, then autoconnect |
452 | //if ( ( m_curSession->layer() )->supports()[0] == 1 ) { | 439 | //if ( ( m_curSession->layer() )->supports()[0] == 1 ) { |
453 | if (prof.autoConnect()) { | 440 | if (prof.autoConnect()) { |
454 | slotConnect(); | 441 | slotConnect(); |
455 | } | 442 | } |
456 | 443 | ||
457 | 444 | ||
458 | 445 | ||
459 | QWidget *w = currentSession()->widget(); | 446 | QWidget *w = currentSession()->widget(); |
460 | if(w) w->setFocus(); | 447 | if(w) w->setFocus(); |
461 | 448 | ||
462 | m_kb->load(currentSession()->profile()); | 449 | m_kb->load(currentSession()->profile()); |
463 | } | 450 | } |
464 | 451 | ||
465 | void MainWindow::slotTransfer() | 452 | void MainWindow::slotTransfer() |
466 | { | 453 | { |
467 | if ( currentSession() ) { | 454 | if ( currentSession() ) { |
468 | TransferDialog dlg(currentSession()->widgetStack(), this); | 455 | TransferDialog dlg(currentSession()->widgetStack(), this); |
469 | dlg.showMaximized(); | 456 | dlg.showMaximized(); |
470 | //currentSession()->widgetStack()->add(dlg); | 457 | //currentSession()->widgetStack()->add(dlg); |
471 | dlg.exec(); | 458 | dlg.exec(); |
472 | } | 459 | } |
473 | } | 460 | } |
474 | 461 | ||
475 | 462 | ||
476 | void MainWindow::slotOpenKeb(bool state) { | 463 | void MainWindow::slotOpenKeb(bool state) { |
477 | 464 | ||
478 | if (state) m_keyBar->show(); | 465 | if (state) m_keyBar->show(); |
479 | else m_keyBar->hide(); | 466 | else m_keyBar->hide(); |
480 | 467 | ||
481 | } | 468 | } |
482 | 469 | ||
483 | 470 | ||
484 | void MainWindow::slotOpenButtons( bool state ) { | 471 | void MainWindow::slotOpenButtons( bool state ) { |
485 | 472 | ||
486 | if ( state ) { | 473 | if ( state ) { |
487 | m_buttonBar->show(); | 474 | m_buttonBar->show(); |
488 | } else { | 475 | } else { |
489 | m_buttonBar->hide(); | 476 | m_buttonBar->hide(); |
490 | } | 477 | } |
491 | } | 478 | } |
492 | 479 | ||
493 | 480 | ||
494 | 481 | ||
495 | void MainWindow::slotSessionChanged( Session* ses ) { | 482 | void MainWindow::slotSessionChanged( Session* ses ) { |
496 | qWarning("changed!"); | 483 | qWarning("changed!"); |
497 | if ( ses ) { | 484 | if ( ses ) { |
498 | m_curSession = ses; | 485 | m_curSession = ses; |
499 | qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) ); | 486 | qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) ); |
500 | if ( m_curSession->layer()->isConnected() ) { | 487 | if ( m_curSession->layer()->isConnected() ) { |
501 | m_connect->setEnabled( false ); | 488 | m_connect->setEnabled( false ); |
502 | m_disconnect->setEnabled( true ); | 489 | m_disconnect->setEnabled( true ); |
503 | m_recordScript->setEnabled( true ); | 490 | m_recordScript->setEnabled( true ); |
504 | m_saveScript->setEnabled( true ); | 491 | m_saveScript->setEnabled( true ); |
505 | m_runScript->setEnabled( true ); | 492 | m_runScript->setEnabled( true ); |
506 | } else { | 493 | } else { |
507 | m_connect->setEnabled( true ); | 494 | m_connect->setEnabled( true ); |
508 | m_disconnect->setEnabled( false ); | 495 | m_disconnect->setEnabled( false ); |
509 | m_recordScript->setEnabled( false ); | 496 | m_recordScript->setEnabled( false ); |
510 | m_saveScript->setEnabled( false ); | 497 | m_saveScript->setEnabled( false ); |
511 | m_runScript->setEnabled( false ); | 498 | m_runScript->setEnabled( false ); |
512 | } | 499 | } |
513 | 500 | ||
514 | if ( ( m_curSession->layer() )->supports()[1] == 0 ) { | 501 | if ( ( m_curSession->layer() )->supports()[1] == 0 ) { |
515 | m_transfer->setEnabled( false ); | 502 | m_transfer->setEnabled( false ); |
516 | } else { | 503 | } else { |
517 | m_transfer->setEnabled( true ); | 504 | m_transfer->setEnabled( true ); |
518 | } | 505 | } |
519 | 506 | ||
520 | 507 | ||
521 | 508 | ||
522 | 509 | ||
523 | 510 | ||
524 | QWidget *w = m_curSession->widget(); | 511 | QWidget *w = m_curSession->widget(); |
525 | if(w) w->setFocus(); | 512 | if(w) w->setFocus(); |
526 | 513 | ||
527 | m_kb->load(currentSession()->profile()); | 514 | m_kb->load(currentSession()->profile()); |
528 | } | 515 | } |
529 | } | 516 | } |
530 | 517 | ||
531 | void MainWindow::slotFullscreen() { | 518 | void MainWindow::slotFullscreen() { |
532 | 519 | ||
533 | 520 | ||
534 | 521 | ||
535 | if ( m_isFullscreen ) { | 522 | if ( m_isFullscreen ) { |
536 | ( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), true ); | 523 | ( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), true ); |
537 | ( m_curSession->widgetStack() )->resize( savedParentFullscreen->width(), savedParentFullscreen->height() ); | 524 | ( m_curSession->widgetStack() )->resize( savedParentFullscreen->width(), savedParentFullscreen->height() ); |
538 | ( m_curSession->emulationHandler() )->cornerButton()->hide(); | 525 | ( m_curSession->emulationHandler() )->cornerButton()->hide(); |
539 | disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); | 526 | disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); |
540 | 527 | ||
541 | } else { | 528 | } else { |
542 | savedParentFullscreen = ( m_curSession->widgetStack() )->parentWidget(); | 529 | savedParentFullscreen = ( m_curSession->widgetStack() )->parentWidget(); |
543 | ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame ); | 530 | ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame ); |
544 | ( m_curSession->widgetStack() )->reparent( 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop | 531 | ( m_curSession->widgetStack() )->reparent( 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop |
545 | , QPoint(0,0), false ); | 532 | , QPoint(0,0), false ); |
546 | ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() ); | 533 | ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() ); |
547 | ( m_curSession->widgetStack() )->setFocus(); | 534 | ( m_curSession->widgetStack() )->setFocus(); |
548 | ( m_curSession->widgetStack() )->show(); | 535 | ( m_curSession->widgetStack() )->show(); |
549 | 536 | ||
550 | ( ( m_curSession->emulationHandler() )->cornerButton() )->show(); | 537 | ( ( m_curSession->emulationHandler() )->cornerButton() )->show(); |
551 | 538 | ||
552 | connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); | 539 | connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); |
553 | } | 540 | } |
554 | 541 | ||
555 | m_isFullscreen = !m_isFullscreen; | 542 | m_isFullscreen = !m_isFullscreen; |
556 | } | 543 | } |
557 | 544 | ||
558 | 545 | ||
559 | void MainWindow::slotKeyReceived(FKey k, ushort, ushort, bool pressed) { | 546 | void MainWindow::slotKeyReceived(FKey k, ushort, ushort, bool pressed) { |
560 | 547 | ||
561 | if ( m_curSession ) { | 548 | if ( m_curSession ) { |
562 | 549 | ||
563 | QEvent::Type state; | 550 | QEvent::Type state; |
564 | 551 | ||
565 | if (pressed) state = QEvent::KeyPress; | 552 | if (pressed) state = QEvent::KeyPress; |
566 | else state = QEvent::KeyRelease; | 553 | else state = QEvent::KeyRelease; |
567 | 554 | ||
568 | QKeyEvent ke(state, k.qcode, k.unicode, 0, QString(QChar(k.unicode))); | 555 | QKeyEvent ke(state, k.qcode, k.unicode, 0, QString(QChar(k.unicode))); |
569 | 556 | ||
570 | // is this the best way to do this? cant figure out any other way to work | 557 | // is this the best way to do this? cant figure out any other way to work |
571 | QApplication::sendEvent((QObject *)m_curSession->widget(), &ke); | 558 | QApplication::sendEvent((QObject *)m_curSession->widget(), &ke); |
572 | ke.ignore(); | 559 | ke.ignore(); |
573 | } | 560 | } |
574 | } | 561 | } |
575 | void MainWindow::slotCopy() { | 562 | void MainWindow::slotCopy() { |
576 | if (!currentSession() ) return; | 563 | if (!currentSession() ) return; |
577 | currentSession()->emulationHandler()->copy(); | 564 | currentSession()->emulationHandler()->copy(); |
578 | } | 565 | } |
579 | void MainWindow::slotPaste() { | 566 | void MainWindow::slotPaste() { |
580 | if (!currentSession() ) return; | 567 | if (!currentSession() ) return; |
581 | currentSession()->emulationHandler()->paste(); | 568 | currentSession()->emulationHandler()->paste(); |
582 | } | 569 | } |
583 | 570 | ||
584 | /* | 571 | /* |
585 | * Save the session | 572 | * Save the session |
586 | */ | 573 | */ |
587 | 574 | ||
588 | void MainWindow::slotSaveSession() { | 575 | void MainWindow::slotSaveSession() { |
589 | if (!currentSession() ) { | 576 | if (!currentSession() ) { |
590 | QMessageBox::information(this, tr("Save Connection"), | 577 | QMessageBox::information(this, tr("Save Connection"), |
591 | tr("<qt>There is no Connection.</qt>"), 1 ); | 578 | tr("<qt>There is no Connection.</qt>"), 1 ); |
592 | return; | 579 | return; |
593 | } | 580 | } |
594 | manager()->add( currentSession()->profile() ); | 581 | manager()->add( currentSession()->profile() ); |
595 | manager()->save(); | 582 | manager()->save(); |
596 | populateProfiles(); | 583 | populateProfiles(); |
597 | } | 584 | } |
diff --git a/noncore/apps/opie-console/mainwindow.h b/noncore/apps/opie-console/mainwindow.h index 7cc2aa5..19d3a3d 100644 --- a/noncore/apps/opie-console/mainwindow.h +++ b/noncore/apps/opie-console/mainwindow.h | |||
@@ -1,130 +1,129 @@ | |||
1 | #ifndef OPIE_MAIN_WINDOW_H | 1 | #ifndef OPIE_MAIN_WINDOW_H |
2 | #define OPIE_MAIN_WINDOW_H | 2 | #define OPIE_MAIN_WINDOW_H |
3 | 3 | ||
4 | #include <qmainwindow.h> | 4 | #include <qmainwindow.h> |
5 | #include <qlist.h> | 5 | #include <qlist.h> |
6 | 6 | ||
7 | #include "session.h" | 7 | #include "session.h" |
8 | 8 | ||
9 | /** | 9 | /** |
10 | * this is the MainWindow of the new opie console | 10 | * this is the MainWindow of the new opie console |
11 | * it's also the dispatcher between the different | 11 | * it's also the dispatcher between the different |
12 | * actions supported by the gui | 12 | * actions supported by the gui |
13 | */ | 13 | */ |
14 | class QToolBar; | 14 | class QToolBar; |
15 | class QToolButton; | 15 | class QToolButton; |
16 | class QMenuBar; | 16 | class QMenuBar; |
17 | class QAction; | 17 | class QAction; |
18 | class MetaFactory; | 18 | class MetaFactory; |
19 | class TabWidget; | 19 | class TabWidget; |
20 | class ProfileManager; | 20 | class ProfileManager; |
21 | class Profile; | 21 | class Profile; |
22 | class FunctionKeyboard; | 22 | class FunctionKeyboard; |
23 | class FKey; | 23 | class FKey; |
24 | 24 | ||
25 | 25 | ||
26 | class MainWindow : public QMainWindow { | 26 | class MainWindow : public QMainWindow { |
27 | Q_OBJECT | 27 | Q_OBJECT |
28 | public: | 28 | public: |
29 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 ); | 29 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 ); |
30 | ~MainWindow(); | 30 | ~MainWindow(); |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * our factory to generate IOLayer and so on | 33 | * our factory to generate IOLayer and so on |
34 | * | 34 | * |
35 | */ | 35 | */ |
36 | MetaFactory* factory(); | 36 | MetaFactory* factory(); |
37 | 37 | ||
38 | /** | 38 | /** |
39 | * A session contains a QWidget*, | 39 | * A session contains a QWidget*, |
40 | * an IOLayer* and some infos for us | 40 | * an IOLayer* and some infos for us |
41 | */ | 41 | */ |
42 | Session* currentSession(); | 42 | Session* currentSession(); |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * the session list | 45 | * the session list |
46 | */ | 46 | */ |
47 | QList<Session> sessions(); | 47 | QList<Session> sessions(); |
48 | 48 | ||
49 | /** | 49 | /** |
50 | * | 50 | * |
51 | */ | 51 | */ |
52 | ProfileManager* manager(); | 52 | ProfileManager* manager(); |
53 | TabWidget* tabWidget(); | 53 | TabWidget* tabWidget(); |
54 | 54 | ||
55 | private slots: | 55 | private slots: |
56 | void slotNew(); | 56 | void slotNew(); |
57 | void slotConnect(); | 57 | void slotConnect(); |
58 | void slotDisconnect(); | 58 | void slotDisconnect(); |
59 | void slotTerminate(); | 59 | void slotTerminate(); |
60 | void slotConfigure(); | 60 | void slotConfigure(); |
61 | void slotClose(); | 61 | void slotClose(); |
62 | void slotProfile(int); | 62 | void slotProfile(int); |
63 | void slotTransfer(); | 63 | void slotTransfer(); |
64 | void slotOpenKeb(bool); | 64 | void slotOpenKeb(bool); |
65 | void slotOpenButtons(bool); | 65 | void slotOpenButtons(bool); |
66 | void slotRecordScript(); | 66 | void slotRecordScript(); |
67 | void slotSaveScript(); | 67 | void slotSaveScript(); |
68 | void slotRunScript(); | 68 | void slotRunScript(); |
69 | void slotFullscreen(); | 69 | void slotFullscreen(); |
70 | void slotSessionChanged( Session* ); | 70 | void slotSessionChanged( Session* ); |
71 | void slotKeyReceived(FKey, ushort, ushort, bool); | 71 | void slotKeyReceived(FKey, ushort, ushort, bool); |
72 | 72 | ||
73 | /* what could these both slot do? */ | 73 | /* what could these both slot do? */ |
74 | void slotCopy(); | 74 | void slotCopy(); |
75 | void slotPaste(); | 75 | void slotPaste(); |
76 | 76 | ||
77 | /* save the currentSession() to Profiles */ | 77 | /* save the currentSession() to Profiles */ |
78 | void slotSaveSession(); | 78 | void slotSaveSession(); |
79 | 79 | ||
80 | private: | 80 | private: |
81 | void initUI(); | 81 | void initUI(); |
82 | void populateProfiles(); | 82 | void populateProfiles(); |
83 | void create( const Profile& ); | 83 | void create( const Profile& ); |
84 | /** | 84 | /** |
85 | * the current session | 85 | * the current session |
86 | */ | 86 | */ |
87 | Session* m_curSession; | 87 | Session* m_curSession; |
88 | 88 | ||
89 | /** | 89 | /** |
90 | * the session list | 90 | * the session list |
91 | */ | 91 | */ |
92 | QList<Session> m_sessions; | 92 | QList<Session> m_sessions; |
93 | 93 | ||
94 | /** | 94 | /** |
95 | * the metafactory | 95 | * the metafactory |
96 | */ | 96 | */ |
97 | MetaFactory* m_factory; | 97 | MetaFactory* m_factory; |
98 | ProfileManager* m_manager; | 98 | ProfileManager* m_manager; |
99 | 99 | ||
100 | TabWidget* m_consoleWindow; | 100 | TabWidget* m_consoleWindow; |
101 | QToolBar* m_tool; | 101 | QToolBar* m_tool; |
102 | QToolBar* m_icons; | 102 | QToolBar* m_icons; |
103 | QToolBar* m_keyBar; | 103 | QToolBar* m_keyBar; |
104 | QToolBar* m_buttonBar; | 104 | QToolBar* m_buttonBar; |
105 | QMenuBar* m_bar; | 105 | QMenuBar* m_bar; |
106 | QPopupMenu* m_console; | 106 | QPopupMenu* m_console; |
107 | QPopupMenu* m_settings; | ||
108 | QPopupMenu* m_sessionsPop; | 107 | QPopupMenu* m_sessionsPop; |
109 | QPopupMenu* m_scripts; | 108 | QPopupMenu* m_scripts; |
110 | QAction* m_connect; | 109 | QAction* m_connect; |
111 | QAction* m_disconnect; | 110 | QAction* m_disconnect; |
112 | QAction* m_terminate; | 111 | QAction* m_terminate; |
113 | QAction* m_transfer; | 112 | QAction* m_transfer; |
114 | QAction* m_setProfiles; | 113 | QAction* m_setProfiles; |
115 | QAction* m_openKeys; | 114 | QAction* m_openKeys; |
116 | QAction* m_openButtons; | 115 | QAction* m_openButtons; |
117 | QAction* m_recordScript; | 116 | QAction* m_recordScript; |
118 | QAction* m_saveScript; | 117 | QAction* m_saveScript; |
119 | QAction* m_runScript; | 118 | QAction* m_runScript; |
120 | QAction* m_fullscreen; | 119 | QAction* m_fullscreen; |
121 | QAction* m_closewindow; | 120 | QAction* m_closewindow; |
122 | 121 | ||
123 | FunctionKeyboard *m_kb; | 122 | FunctionKeyboard *m_kb; |
124 | bool m_isFullscreen; | 123 | bool m_isFullscreen; |
125 | 124 | ||
126 | QWidget* savedParentFullscreen; | 125 | QWidget* savedParentFullscreen; |
127 | }; | 126 | }; |
128 | 127 | ||
129 | 128 | ||
130 | #endif | 129 | #endif |