author | harlekin <harlekin> | 2002-10-14 21:59:07 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-10-14 21:59:07 (UTC) |
commit | f5d1ce4b3887e0f09704abad5b9414c9cd90be4b (patch) (unidiff) | |
tree | 7dde2bf517755d43316c6ee5e08dd74aea4f1b0e | |
parent | 09ba6b7531801dde243469f05f5e5c31596cdd2d (diff) | |
download | opie-f5d1ce4b3887e0f09704abad5b9414c9cd90be4b.zip opie-f5d1ce4b3887e0f09704abad5b9414c9cd90be4b.tar.gz opie-f5d1ce4b3887e0f09704abad5b9414c9cd90be4b.tar.bz2 |
enable some entries not before a profile is loaded
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 39 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.h | 3 |
2 files changed, 40 insertions, 2 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index b143361..89cdf51 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -1,76 +1,78 @@ | |||
1 | #include <assert.h> | 1 | #include <assert.h> |
2 | 2 | ||
3 | 3 | ||
4 | 4 | ||
5 | #include <qaction.h> | 5 | #include <qaction.h> |
6 | #include <qmenubar.h> | 6 | #include <qmenubar.h> |
7 | #include <qlabel.h> | 7 | #include <qlabel.h> |
8 | #include <qpopupmenu.h> | 8 | #include <qpopupmenu.h> |
9 | #include <qtoolbar.h> | 9 | #include <qtoolbar.h> |
10 | #include <qmessagebox.h> | ||
11 | |||
10 | #include <qpe/resource.h> | 12 | #include <qpe/resource.h> |
11 | #include <opie/ofiledialog.h> | 13 | #include <opie/ofiledialog.h> |
12 | #include <qmessagebox.h> | 14 | |
13 | 15 | ||
14 | #include "keytrans.h" | 16 | #include "keytrans.h" |
15 | #include "profileeditordialog.h" | 17 | #include "profileeditordialog.h" |
16 | #include "configdialog.h" | 18 | #include "configdialog.h" |
17 | #include "default.h" | 19 | #include "default.h" |
18 | #include "metafactory.h" | 20 | #include "metafactory.h" |
19 | #include "profile.h" | 21 | #include "profile.h" |
20 | #include "profilemanager.h" | 22 | #include "profilemanager.h" |
21 | #include "mainwindow.h" | 23 | #include "mainwindow.h" |
22 | #include "tabwidget.h" | 24 | #include "tabwidget.h" |
23 | #include "transferdialog.h" | 25 | #include "transferdialog.h" |
24 | #include "function_keyboard.h" | 26 | #include "function_keyboard.h" |
25 | #include "script.h" | 27 | #include "script.h" |
26 | 28 | ||
27 | MainWindow::MainWindow() { | 29 | MainWindow::MainWindow() { |
28 | KeyTrans::loadAll(); | 30 | KeyTrans::loadAll(); |
29 | for (int i = 0; i < KeyTrans::count(); i++ ) { | 31 | for (int i = 0; i < KeyTrans::count(); i++ ) { |
30 | KeyTrans* s = KeyTrans::find(i ); | 32 | KeyTrans* s = KeyTrans::find(i ); |
31 | assert( s ); | 33 | assert( s ); |
32 | } | 34 | } |
33 | m_factory = new MetaFactory(); | 35 | m_factory = new MetaFactory(); |
34 | Default def(m_factory); | 36 | Default def(m_factory); |
35 | m_sessions.setAutoDelete( TRUE ); | 37 | m_sessions.setAutoDelete( TRUE ); |
36 | m_curSession = 0; | 38 | m_curSession = 0; |
37 | m_manager = new ProfileManager( m_factory ); | 39 | m_manager = new ProfileManager( m_factory ); |
38 | m_manager->load(); | 40 | m_manager->load(); |
39 | 41 | ||
40 | initUI(); | 42 | initUI(); |
41 | populateProfiles(); | 43 | populateProfiles(); |
42 | } | 44 | } |
43 | void MainWindow::initUI() { | 45 | void MainWindow::initUI() { |
44 | setToolBarsMovable( FALSE ); | 46 | setToolBarsMovable( FALSE ); |
45 | 47 | ||
46 | /* tool bar for the menu */ | 48 | /* tool bar for the menu */ |
47 | m_tool = new QToolBar( this ); | 49 | m_tool = new QToolBar( this ); |
48 | m_tool->setHorizontalStretchable( TRUE ); | 50 | m_tool->setHorizontalStretchable( TRUE ); |
49 | 51 | ||
50 | m_bar = new QMenuBar( m_tool ); | 52 | m_bar = new QMenuBar( m_tool ); |
51 | m_console = new QPopupMenu( this ); | 53 | m_console = new QPopupMenu( this ); |
52 | m_scripts = new QPopupMenu( this ); | 54 | m_scripts = new QPopupMenu( this ); |
53 | m_sessionsPop= new QPopupMenu( this ); | 55 | m_sessionsPop= new QPopupMenu( this ); |
54 | m_settings = new QPopupMenu( this ); | 56 | m_settings = new QPopupMenu( this ); |
55 | 57 | ||
56 | /* add a toolbar for icons */ | 58 | /* add a toolbar for icons */ |
57 | m_icons = new QToolBar(this); | 59 | m_icons = new QToolBar(this); |
58 | 60 | ||
59 | /* | 61 | /* |
60 | * new Action for new sessions | 62 | * new Action for new sessions |
61 | */ | 63 | */ |
62 | QAction* a = new QAction(tr("New Connection"), | 64 | QAction* a = new QAction(tr("New Connection"), |
63 | Resource::loadPixmap( "new" ), | 65 | Resource::loadPixmap( "new" ), |
64 | QString::null, 0, this, 0); | 66 | QString::null, 0, this, 0); |
65 | a->addTo( m_console ); | 67 | a->addTo( m_console ); |
66 | a->addTo( m_icons ); | 68 | a->addTo( m_icons ); |
67 | connect(a, SIGNAL(activated() ), | 69 | connect(a, SIGNAL(activated() ), |
68 | this, SLOT(slotNew() ) ); | 70 | this, SLOT(slotNew() ) ); |
69 | 71 | ||
70 | /* | 72 | /* |
71 | * connect action | 73 | * connect action |
72 | */ | 74 | */ |
73 | m_connect = new QAction(); | 75 | m_connect = new QAction(); |
74 | m_connect->setText( tr("Connect") ); | 76 | m_connect->setText( tr("Connect") ); |
75 | m_connect->addTo( m_console ); | 77 | m_connect->addTo( m_console ); |
76 | connect(m_connect, SIGNAL(activated() ), | 78 | connect(m_connect, SIGNAL(activated() ), |
@@ -106,128 +108,138 @@ void MainWindow::initUI() { | |||
106 | connect(a, SIGNAL(activated() ), | 108 | connect(a, SIGNAL(activated() ), |
107 | this, SLOT(slotClose() ) ); | 109 | this, SLOT(slotClose() ) ); |
108 | 110 | ||
109 | /* | 111 | /* |
110 | * the settings action | 112 | * the settings action |
111 | */ | 113 | */ |
112 | m_setProfiles = new QAction(tr("Configure Profiles"), | 114 | m_setProfiles = new QAction(tr("Configure Profiles"), |
113 | Resource::loadPixmap( "SettingsIcon" ), | 115 | Resource::loadPixmap( "SettingsIcon" ), |
114 | QString::null, 0, this, 0); | 116 | QString::null, 0, this, 0); |
115 | m_setProfiles->addTo( m_settings ); | 117 | m_setProfiles->addTo( m_settings ); |
116 | m_setProfiles->addTo( m_icons ); | 118 | m_setProfiles->addTo( m_icons ); |
117 | connect( m_setProfiles, SIGNAL(activated() ), | 119 | connect( m_setProfiles, SIGNAL(activated() ), |
118 | this, SLOT(slotConfigure() ) ); | 120 | this, SLOT(slotConfigure() ) ); |
119 | 121 | ||
120 | /* | 122 | /* |
121 | * script actions | 123 | * script actions |
122 | */ | 124 | */ |
123 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); | 125 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); |
124 | m_recordScript->addTo(m_scripts); | 126 | m_recordScript->addTo(m_scripts); |
125 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); | 127 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); |
126 | 128 | ||
127 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); | 129 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); |
128 | m_saveScript->addTo(m_scripts); | 130 | m_saveScript->addTo(m_scripts); |
129 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); | 131 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); |
130 | 132 | ||
131 | m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0); | 133 | m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0); |
132 | m_runScript->addTo(m_scripts); | 134 | m_runScript->addTo(m_scripts); |
133 | connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript())); | 135 | connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript())); |
134 | 136 | ||
135 | /* | 137 | /* |
136 | * action that open/closes the keyboard | 138 | * action that open/closes the keyboard |
137 | */ | 139 | */ |
138 | m_openKeys = new QAction (tr("Open Keyboard..."), | 140 | m_openKeys = new QAction (tr("Open Keyboard..."), |
139 | Resource::loadPixmap( "down" ), | 141 | Resource::loadPixmap( "down" ), |
140 | QString::null, 0, this, 0); | 142 | QString::null, 0, this, 0); |
141 | 143 | ||
142 | m_openKeys->setToggleAction(true); | 144 | m_openKeys->setToggleAction(true); |
143 | 145 | ||
144 | connect (m_openKeys, SIGNAL(toggled(bool)), | 146 | connect (m_openKeys, SIGNAL(toggled(bool)), |
145 | this, SLOT(slotOpenKeb(bool))); | 147 | this, SLOT(slotOpenKeb(bool))); |
146 | m_openKeys->addTo(m_icons); | 148 | m_openKeys->addTo(m_icons); |
147 | 149 | ||
148 | 150 | ||
149 | /* insert the submenu */ | 151 | /* insert the submenu */ |
150 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, | 152 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, |
151 | -1, 0); | 153 | -1, 0); |
152 | 154 | ||
153 | /* insert the connection menu */ | 155 | /* insert the connection menu */ |
154 | m_bar->insertItem( tr("Connection"), m_console ); | 156 | m_bar->insertItem( tr("Connection"), m_console ); |
155 | 157 | ||
156 | /* the scripts menu */ | 158 | /* the scripts menu */ |
157 | m_bar->insertItem( tr("Scripts"), m_scripts ); | 159 | m_bar->insertItem( tr("Scripts"), m_scripts ); |
158 | 160 | ||
159 | /* the settings menu */ | 161 | /* the settings menu */ |
160 | m_bar->insertItem( tr("Settings"), m_settings ); | 162 | m_bar->insertItem( tr("Settings"), m_settings ); |
161 | 163 | ||
162 | /* and the keyboard */ | 164 | /* and the keyboard */ |
163 | m_keyBar = new QToolBar(this); | 165 | m_keyBar = new QToolBar(this); |
164 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); | 166 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); |
165 | m_keyBar->setHorizontalStretchable( TRUE ); | 167 | m_keyBar->setHorizontalStretchable( TRUE ); |
166 | m_keyBar->hide(); | 168 | m_keyBar->hide(); |
167 | 169 | ||
168 | m_kb = new FunctionKeyboard(m_keyBar); | 170 | m_kb = new FunctionKeyboard(m_keyBar); |
169 | 171 | ||
172 | |||
173 | |||
174 | m_connect->setEnabled( false ); | ||
175 | m_disconnect->setEnabled( false ); | ||
176 | m_terminate->setEnabled( false ); | ||
177 | m_transfer->setEnabled( false ); | ||
178 | m_recordScript->setEnabled( false ); | ||
179 | m_saveScript->setEnabled( false ); | ||
180 | m_runScript->setEnabled( false ); | ||
181 | |||
170 | /* | 182 | /* |
171 | * connect to the menu activation | 183 | * connect to the menu activation |
172 | */ | 184 | */ |
173 | connect( m_sessionsPop, SIGNAL(activated( int ) ), | 185 | connect( m_sessionsPop, SIGNAL(activated( int ) ), |
174 | this, SLOT(slotProfile( int ) ) ); | 186 | this, SLOT(slotProfile( int ) ) ); |
175 | 187 | ||
176 | m_consoleWindow = new TabWidget( this, "blah"); | 188 | m_consoleWindow = new TabWidget( this, "blah"); |
177 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), | 189 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), |
178 | this, SLOT(slotSessionChanged(Session*) ) ); | 190 | this, SLOT(slotSessionChanged(Session*) ) ); |
179 | setCentralWidget( m_consoleWindow ); | 191 | setCentralWidget( m_consoleWindow ); |
180 | 192 | ||
181 | } | 193 | } |
182 | 194 | ||
183 | ProfileManager* MainWindow::manager() { | 195 | ProfileManager* MainWindow::manager() { |
184 | return m_manager; | 196 | return m_manager; |
185 | } | 197 | } |
186 | TabWidget* MainWindow::tabWidget() { | 198 | TabWidget* MainWindow::tabWidget() { |
187 | return m_consoleWindow; | 199 | return m_consoleWindow; |
188 | } | 200 | } |
189 | void MainWindow::populateProfiles() { | 201 | void MainWindow::populateProfiles() { |
190 | m_sessionsPop->clear(); | 202 | m_sessionsPop->clear(); |
191 | Profile::ValueList list = manager()->all(); | 203 | Profile::ValueList list = manager()->all(); |
192 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { | 204 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { |
193 | m_sessionsPop->insertItem( (*it).name() ); | 205 | m_sessionsPop->insertItem( (*it).name() ); |
194 | } | 206 | } |
195 | 207 | ||
196 | } | 208 | } |
197 | MainWindow::~MainWindow() { | 209 | MainWindow::~MainWindow() { |
198 | delete m_factory; | 210 | delete m_factory; |
199 | manager()->save(); | 211 | manager()->save(); |
200 | } | 212 | } |
201 | 213 | ||
202 | MetaFactory* MainWindow::factory() { | 214 | MetaFactory* MainWindow::factory() { |
203 | return m_factory; | 215 | return m_factory; |
204 | } | 216 | } |
205 | 217 | ||
206 | Session* MainWindow::currentSession() { | 218 | Session* MainWindow::currentSession() { |
207 | return m_curSession; | 219 | return m_curSession; |
208 | } | 220 | } |
209 | 221 | ||
210 | QList<Session> MainWindow::sessions() { | 222 | QList<Session> MainWindow::sessions() { |
211 | return m_sessions; | 223 | return m_sessions; |
212 | } | 224 | } |
213 | 225 | ||
214 | void MainWindow::slotNew() { | 226 | void MainWindow::slotNew() { |
215 | qWarning("New Connection"); | 227 | qWarning("New Connection"); |
216 | ProfileEditorDialog dlg(factory() ); | 228 | ProfileEditorDialog dlg(factory() ); |
217 | dlg.showMaximized(); | 229 | dlg.showMaximized(); |
218 | int ret = dlg.exec(); | 230 | int ret = dlg.exec(); |
219 | 231 | ||
220 | if ( ret == QDialog::Accepted ) { | 232 | if ( ret == QDialog::Accepted ) { |
221 | create( dlg.profile() ); | 233 | create( dlg.profile() ); |
222 | } | 234 | } |
223 | } | 235 | } |
224 | 236 | ||
225 | void MainWindow::slotRecordScript() { | 237 | void MainWindow::slotRecordScript() { |
226 | /* if (currentSession()) { | 238 | /* if (currentSession()) { |
227 | currentSession()->emulationLayer()->startRecording(); | 239 | currentSession()->emulationLayer()->startRecording(); |
228 | } | 240 | } |
229 | */ | 241 | */ |
230 | } | 242 | } |
231 | 243 | ||
232 | void MainWindow::slotSaveScript() { | 244 | void MainWindow::slotSaveScript() { |
233 | /* if (currentSession() && currentSession()->emulationLayer()->isRecording()) { | 245 | /* if (currentSession() && currentSession()->emulationLayer()->isRecording()) { |
@@ -279,88 +291,113 @@ void MainWindow::slotTerminate() { | |||
279 | currentSession()->layer()->close(); | 291 | currentSession()->layer()->close(); |
280 | 292 | ||
281 | slotClose(); | 293 | slotClose(); |
282 | /* FIXME move to the next session */ | 294 | /* FIXME move to the next session */ |
283 | } | 295 | } |
284 | 296 | ||
285 | void MainWindow::slotConfigure() { | 297 | void MainWindow::slotConfigure() { |
286 | qWarning("configure"); | 298 | qWarning("configure"); |
287 | ConfigDialog conf( manager()->all(), factory() ); | 299 | ConfigDialog conf( manager()->all(), factory() ); |
288 | conf.showMaximized(); | 300 | conf.showMaximized(); |
289 | 301 | ||
290 | int ret = conf.exec(); | 302 | int ret = conf.exec(); |
291 | 303 | ||
292 | if ( QDialog::Accepted == ret ) { | 304 | if ( QDialog::Accepted == ret ) { |
293 | qWarning("conf %d", conf.list().count() ); | 305 | qWarning("conf %d", conf.list().count() ); |
294 | manager()->setProfiles( conf.list() ); | 306 | manager()->setProfiles( conf.list() ); |
295 | manager()->save(); | 307 | manager()->save(); |
296 | populateProfiles(); | 308 | populateProfiles(); |
297 | } | 309 | } |
298 | } | 310 | } |
299 | /* | 311 | /* |
300 | * we will remove | 312 | * we will remove |
301 | * this window from the tabwidget | 313 | * this window from the tabwidget |
302 | * remove it from the list | 314 | * remove it from the list |
303 | * delete it | 315 | * delete it |
304 | * and set the currentSession() | 316 | * and set the currentSession() |
305 | */ | 317 | */ |
306 | void MainWindow::slotClose() { | 318 | void MainWindow::slotClose() { |
307 | qWarning("close"); | 319 | qWarning("close"); |
308 | if (!currentSession() ) | 320 | if (!currentSession() ) |
309 | return; | 321 | return; |
310 | 322 | ||
311 | tabWidget()->remove( currentSession() ); | 323 | tabWidget()->remove( currentSession() ); |
312 | /*it's autodelete */ | 324 | /*it's autodelete */ |
313 | m_sessions.remove( m_curSession ); | 325 | m_sessions.remove( m_curSession ); |
314 | m_curSession = m_sessions.first(); | 326 | m_curSession = m_sessions.first(); |
315 | tabWidget()->setCurrent( m_curSession ); | 327 | tabWidget()->setCurrent( m_curSession ); |
316 | } | 328 | } |
317 | 329 | ||
318 | /* | 330 | /* |
319 | * We will get the name | 331 | * We will get the name |
320 | * Then the profile | 332 | * Then the profile |
321 | * and then we will make a profile | 333 | * and then we will make a profile |
322 | */ | 334 | */ |
323 | void MainWindow::slotProfile( int id) { | 335 | void MainWindow::slotProfile( int id) { |
324 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); | 336 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); |
325 | create( prof ); | 337 | create( prof ); |
326 | } | 338 | } |
327 | void MainWindow::create( const Profile& prof ) { | 339 | void MainWindow::create( const Profile& prof ) { |
328 | Session *ses = manager()->fromProfile( prof, tabWidget() ); | 340 | Session *ses = manager()->fromProfile( prof, tabWidget() ); |
329 | 341 | ||
330 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) | 342 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) |
331 | { | 343 | { |
332 | QMessageBox::warning(this, | 344 | QMessageBox::warning(this, |
333 | QObject::tr("Session failed"), | 345 | QObject::tr("Session failed"), |
334 | QObject::tr("Cannot open session: Not all components were found.")); | 346 | QObject::tr("Cannot open session: Not all components were found.")); |
335 | //if(ses) delete ses; | 347 | //if(ses) delete ses; |
336 | return; | 348 | return; |
337 | } | 349 | } |
338 | 350 | ||
339 | m_sessions.append( ses ); | 351 | m_sessions.append( ses ); |
340 | tabWidget()->add( ses ); | 352 | tabWidget()->add( ses ); |
341 | m_curSession = ses; | 353 | m_curSession = ses; |
342 | 354 | ||
355 | // dicide if its a local term ( then no connction and no tranfer) | ||
356 | m_connect->setEnabled( true ); | ||
357 | m_disconnect->setEnabled( true ); | ||
358 | m_terminate->setEnabled( true ); | ||
359 | m_transfer->setEnabled( true ); | ||
360 | m_recordScript->setEnabled( true ); | ||
361 | m_saveScript->setEnabled( true ); | ||
362 | m_runScript->setEnabled( true ); | ||
363 | |||
364 | |||
343 | } | 365 | } |
344 | 366 | ||
345 | void MainWindow::slotTransfer() | 367 | void MainWindow::slotTransfer() |
346 | { | 368 | { |
347 | // if ( currentSession() ) { | 369 | // if ( currentSession() ) { |
348 | TransferDialog dlg(this); | 370 | TransferDialog dlg(this); |
349 | dlg.showMaximized(); | 371 | dlg.showMaximized(); |
350 | dlg.exec(); | 372 | dlg.exec(); |
351 | // } | 373 | // } |
352 | } | 374 | } |
353 | 375 | ||
354 | 376 | ||
355 | void MainWindow::slotOpenKeb(bool state) { | 377 | void MainWindow::slotOpenKeb(bool state) { |
356 | 378 | ||
357 | if (state) m_keyBar->show(); | 379 | if (state) m_keyBar->show(); |
358 | else m_keyBar->hide(); | 380 | else m_keyBar->hide(); |
359 | 381 | ||
360 | } | 382 | } |
361 | void MainWindow::slotSessionChanged( Session* ses ) { | 383 | void MainWindow::slotSessionChanged( Session* ses ) { |
362 | if ( ses ) { | 384 | if ( ses ) { |
363 | qWarning("changing %s", ses->name().latin1() ); | 385 | qWarning("changing %s", ses->name().latin1() ); |
364 | m_curSession = ses; | 386 | m_curSession = ses; |
365 | } | 387 | } |
366 | } | 388 | } |
389 | |||
390 | void MainWindow::setOn() { | ||
391 | |||
392 | /* | ||
393 | m_connect | ||
394 | m_disconnect | ||
395 | m_terminate | ||
396 | m_transfer | ||
397 | m_recordScript | ||
398 | m_saveScript | ||
399 | m_runScript | ||
400 | */ | ||
401 | |||
402 | |||
403 | } | ||
diff --git a/noncore/apps/opie-console/mainwindow.h b/noncore/apps/opie-console/mainwindow.h index d16d6af..378870a 100644 --- a/noncore/apps/opie-console/mainwindow.h +++ b/noncore/apps/opie-console/mainwindow.h | |||
@@ -1,109 +1,110 @@ | |||
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 MainWindow : public QMainWindow { | 23 | class MainWindow : public QMainWindow { |
24 | Q_OBJECT | 24 | Q_OBJECT |
25 | public: | 25 | public: |
26 | MainWindow(); | 26 | MainWindow(); |
27 | ~MainWindow(); | 27 | ~MainWindow(); |
28 | 28 | ||
29 | /** | 29 | /** |
30 | * our factory to generate IOLayer and so on | 30 | * our factory to generate IOLayer and so on |
31 | * | 31 | * |
32 | */ | 32 | */ |
33 | MetaFactory* factory(); | 33 | MetaFactory* factory(); |
34 | 34 | ||
35 | /** | 35 | /** |
36 | * A session contains a QWidget*, | 36 | * A session contains a QWidget*, |
37 | * an IOLayer* and some infos for us | 37 | * an IOLayer* and some infos for us |
38 | */ | 38 | */ |
39 | Session* currentSession(); | 39 | Session* currentSession(); |
40 | 40 | ||
41 | /** | 41 | /** |
42 | * the session list | 42 | * the session list |
43 | */ | 43 | */ |
44 | QList<Session> sessions(); | 44 | QList<Session> sessions(); |
45 | 45 | ||
46 | /** | 46 | /** |
47 | * | 47 | * |
48 | */ | 48 | */ |
49 | ProfileManager* manager(); | 49 | ProfileManager* manager(); |
50 | TabWidget* tabWidget(); | 50 | TabWidget* tabWidget(); |
51 | 51 | ||
52 | private slots: | 52 | private slots: |
53 | void slotNew(); | 53 | void slotNew(); |
54 | void slotConnect(); | 54 | void slotConnect(); |
55 | void slotDisconnect(); | 55 | void slotDisconnect(); |
56 | void slotTerminate(); | 56 | void slotTerminate(); |
57 | void slotConfigure(); | 57 | void slotConfigure(); |
58 | void slotClose(); | 58 | void slotClose(); |
59 | void slotProfile(int); | 59 | void slotProfile(int); |
60 | void slotTransfer(); | 60 | void slotTransfer(); |
61 | void slotOpenKeb(bool); | 61 | void slotOpenKeb(bool); |
62 | void slotRecordScript(); | 62 | void slotRecordScript(); |
63 | void slotSaveScript(); | 63 | void slotSaveScript(); |
64 | void slotRunScript(); | 64 | void slotRunScript(); |
65 | void setOn(); | ||
65 | void slotSessionChanged( Session* ); | 66 | void slotSessionChanged( Session* ); |
66 | private: | 67 | private: |
67 | void initUI(); | 68 | void initUI(); |
68 | void populateProfiles(); | 69 | void populateProfiles(); |
69 | void create( const Profile& ); | 70 | void create( const Profile& ); |
70 | /** | 71 | /** |
71 | * the current session | 72 | * the current session |
72 | */ | 73 | */ |
73 | Session* m_curSession; | 74 | Session* m_curSession; |
74 | 75 | ||
75 | /** | 76 | /** |
76 | * the session list | 77 | * the session list |
77 | */ | 78 | */ |
78 | QList<Session> m_sessions; | 79 | QList<Session> m_sessions; |
79 | 80 | ||
80 | /** | 81 | /** |
81 | * the metafactory | 82 | * the metafactory |
82 | */ | 83 | */ |
83 | MetaFactory* m_factory; | 84 | MetaFactory* m_factory; |
84 | ProfileManager* m_manager; | 85 | ProfileManager* m_manager; |
85 | 86 | ||
86 | TabWidget* m_consoleWindow; | 87 | TabWidget* m_consoleWindow; |
87 | QToolBar* m_tool; | 88 | QToolBar* m_tool; |
88 | QToolBar* m_icons; | 89 | QToolBar* m_icons; |
89 | QToolBar* m_keyBar; | 90 | QToolBar* m_keyBar; |
90 | QMenuBar* m_bar; | 91 | QMenuBar* m_bar; |
91 | QPopupMenu* m_console; | 92 | QPopupMenu* m_console; |
92 | QPopupMenu* m_settings; | 93 | QPopupMenu* m_settings; |
93 | QPopupMenu* m_sessionsPop; | 94 | QPopupMenu* m_sessionsPop; |
94 | QPopupMenu* m_scripts; | 95 | QPopupMenu* m_scripts; |
95 | QAction* m_connect; | 96 | QAction* m_connect; |
96 | QAction* m_disconnect; | 97 | QAction* m_disconnect; |
97 | QAction* m_terminate; | 98 | QAction* m_terminate; |
98 | QAction* m_transfer; | 99 | QAction* m_transfer; |
99 | QAction* m_setProfiles; | 100 | QAction* m_setProfiles; |
100 | QAction* m_openKeys; | 101 | QAction* m_openKeys; |
101 | QAction* m_recordScript; | 102 | QAction* m_recordScript; |
102 | QAction* m_saveScript; | 103 | QAction* m_saveScript; |
103 | QAction* m_runScript; | 104 | QAction* m_runScript; |
104 | 105 | ||
105 | FunctionKeyboard *m_kb; | 106 | FunctionKeyboard *m_kb; |
106 | }; | 107 | }; |
107 | 108 | ||
108 | 109 | ||
109 | #endif | 110 | #endif |