-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 10 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.h | 3 |
2 files changed, 3 insertions, 10 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 02a3fa9..ddaaf1b 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -5,49 +5,48 @@ | |||
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 | #include "quick_button.h" | ||
30 | 29 | ||
31 | 30 | ||
32 | 31 | ||
33 | 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) { |
34 | KeyTrans::loadAll(); | 33 | KeyTrans::loadAll(); |
35 | for (int i = 0; i < KeyTrans::count(); i++ ) { | 34 | for (int i = 0; i < KeyTrans::count(); i++ ) { |
36 | KeyTrans* s = KeyTrans::find(i ); | 35 | KeyTrans* s = KeyTrans::find(i ); |
37 | assert( s ); | 36 | assert( s ); |
38 | } | 37 | } |
39 | m_factory = new MetaFactory(); | 38 | m_factory = new MetaFactory(); |
40 | Default def(m_factory); | 39 | Default def(m_factory); |
41 | m_sessions.setAutoDelete( TRUE ); | 40 | m_sessions.setAutoDelete( TRUE ); |
42 | m_curSession = 0; | 41 | m_curSession = 0; |
43 | m_manager = new ProfileManager( m_factory ); | 42 | m_manager = new ProfileManager( m_factory ); |
44 | m_manager->load(); | 43 | m_manager->load(); |
45 | 44 | ||
46 | initUI(); | 45 | initUI(); |
47 | populateProfiles(); | 46 | populateProfiles(); |
48 | } | 47 | } |
49 | void MainWindow::initUI() { | 48 | void MainWindow::initUI() { |
50 | setToolBarsMovable( FALSE ); | 49 | setToolBarsMovable( FALSE ); |
51 | 50 | ||
52 | /* tool bar for the menu */ | 51 | /* tool bar for the menu */ |
53 | m_tool = new QToolBar( this ); | 52 | m_tool = new QToolBar( this ); |
@@ -153,49 +152,49 @@ void MainWindow::initUI() { | |||
153 | m_closewindow->addTo( m_console ); | 152 | m_closewindow->addTo( m_console ); |
154 | connect( m_closewindow, SIGNAL(activated() ), | 153 | connect( m_closewindow, SIGNAL(activated() ), |
155 | this, SLOT(slotClose() ) ); | 154 | this, SLOT(slotClose() ) ); |
156 | 155 | ||
157 | 156 | ||
158 | /* | 157 | /* |
159 | * script actions | 158 | * script actions |
160 | */ | 159 | */ |
161 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); | 160 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); |
162 | m_recordScript->addTo(m_scripts); | 161 | m_recordScript->addTo(m_scripts); |
163 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); | 162 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); |
164 | 163 | ||
165 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); | 164 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); |
166 | m_saveScript->addTo(m_scripts); | 165 | m_saveScript->addTo(m_scripts); |
167 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); | 166 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); |
168 | 167 | ||
169 | m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0); | 168 | m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0); |
170 | m_runScript->addTo(m_scripts); | 169 | m_runScript->addTo(m_scripts); |
171 | connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript())); | 170 | connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript())); |
172 | 171 | ||
173 | /* | 172 | /* |
174 | * action that open/closes the keyboard | 173 | * action that open/closes the keyboard |
175 | */ | 174 | */ |
176 | m_openKeys = new QAction (tr("Open Keyboard..."), | 175 | m_openKeys = new QAction (tr("Open Keyboard..."), |
177 | Resource::loadPixmap( "down" ), | 176 | Resource::loadPixmap( "console/keys/keyboard_icon" ), |
178 | QString::null, 0, this, 0); | 177 | QString::null, 0, this, 0); |
179 | 178 | ||
180 | m_openKeys->setToggleAction(true); | 179 | m_openKeys->setToggleAction(true); |
181 | 180 | ||
182 | connect (m_openKeys, SIGNAL(toggled(bool)), | 181 | connect (m_openKeys, SIGNAL(toggled(bool)), |
183 | this, SLOT(slotOpenKeb(bool))); | 182 | this, SLOT(slotOpenKeb(bool))); |
184 | m_openKeys->addTo(m_icons); | 183 | m_openKeys->addTo(m_icons); |
185 | 184 | ||
186 | 185 | ||
187 | /* | 186 | /* |
188 | * action that open/closes the keyboard | 187 | * action that open/closes the keyboard |
189 | 188 | ||
190 | m_openButtons = new QAction ( tr( "Open Buttons..." ), | 189 | m_openButtons = new QAction ( tr( "Open Buttons..." ), |
191 | Resource::loadPixmap( "" ), | 190 | Resource::loadPixmap( "" ), |
192 | QString::null, 0, this, 0 ); | 191 | QString::null, 0, this, 0 ); |
193 | 192 | ||
194 | m_openButtons->setToggleAction( true ); | 193 | m_openButtons->setToggleAction( true ); |
195 | 194 | ||
196 | connect ( m_openButtons, SIGNAL( toggled( bool ) ), | 195 | connect ( m_openButtons, SIGNAL( toggled( bool ) ), |
197 | this, SLOT( slotOpenButtons( bool ) ) ); | 196 | this, SLOT( slotOpenButtons( bool ) ) ); |
198 | m_openButtons->addTo( m_icons ); | 197 | m_openButtons->addTo( m_icons ); |
199 | 198 | ||
200 | */ | 199 | */ |
201 | 200 | ||
@@ -206,54 +205,48 @@ void MainWindow::initUI() { | |||
206 | /* insert the connection menu */ | 205 | /* insert the connection menu */ |
207 | m_bar->insertItem( tr("Connection"), m_console ); | 206 | m_bar->insertItem( tr("Connection"), m_console ); |
208 | 207 | ||
209 | /* the scripts menu */ | 208 | /* the scripts menu */ |
210 | m_bar->insertItem( tr("Scripts"), m_scripts ); | 209 | m_bar->insertItem( tr("Scripts"), m_scripts ); |
211 | 210 | ||
212 | /* the settings menu */ | 211 | /* the settings menu */ |
213 | // m_bar->insertItem( tr("Settings"), m_settings ); | 212 | // m_bar->insertItem( tr("Settings"), m_settings ); |
214 | 213 | ||
215 | /* and the keyboard */ | 214 | /* and the keyboard */ |
216 | m_keyBar = new QToolBar(this); | 215 | m_keyBar = new QToolBar(this); |
217 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); | 216 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); |
218 | m_keyBar->setHorizontalStretchable( TRUE ); | 217 | m_keyBar->setHorizontalStretchable( TRUE ); |
219 | m_keyBar->hide(); | 218 | m_keyBar->hide(); |
220 | 219 | ||
221 | m_kb = new FunctionKeyboard(m_keyBar); | 220 | m_kb = new FunctionKeyboard(m_keyBar); |
222 | connect(m_kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)), | 221 | connect(m_kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)), |
223 | this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool))); | 222 | this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool))); |
224 | 223 | ||
225 | m_buttonBar = new QToolBar( this ); | 224 | m_buttonBar = new QToolBar( this ); |
226 | addToolBar( m_buttonBar, "Buttons", QMainWindow::Top, TRUE ); | 225 | addToolBar( m_buttonBar, "Buttons", QMainWindow::Top, TRUE ); |
227 | m_buttonBar->setHorizontalStretchable( TRUE ); | 226 | m_buttonBar->setHorizontalStretchable( TRUE ); |
228 | m_buttonBar->hide(); | 227 | m_buttonBar->hide(); |
229 | 228 | ||
230 | /* | ||
231 | m_qb = new QuickButton( m_buttonBar ); | ||
232 | connect( m_qb, SIGNAL( keyPressed( ushort, ushort, bool, bool, bool) ), | ||
233 | this, SLOT( slotKeyReceived( ushort, ushort, bool, bool, bool) ) ); | ||
234 | */ | ||
235 | /* now add the copy and paste actions */ | ||
236 | a = new QAction(tr("Copy"), | 229 | a = new QAction(tr("Copy"), |
237 | Resource::loadPixmap("copy"), QString::null, | 230 | Resource::loadPixmap("copy"), QString::null, |
238 | 0, this, 0 ); | 231 | 0, this, 0 ); |
239 | //a->addTo( m_icons ); | 232 | //a->addTo( m_icons ); |
240 | connect( a, SIGNAL(activated() ), | 233 | connect( a, SIGNAL(activated() ), |
241 | this, SLOT(slotCopy() ) ); | 234 | this, SLOT(slotCopy() ) ); |
242 | 235 | ||
243 | a = new QAction(tr("Paste"), | 236 | a = new QAction(tr("Paste"), |
244 | Resource::loadPixmap("paste"), QString::null, | 237 | Resource::loadPixmap("paste"), QString::null, |
245 | 0, this, 0 ); | 238 | 0, this, 0 ); |
246 | a->addTo( m_icons ); | 239 | a->addTo( m_icons ); |
247 | connect( a, SIGNAL(activated() ), | 240 | connect( a, SIGNAL(activated() ), |
248 | this, SLOT(slotPaste() ) ); | 241 | this, SLOT(slotPaste() ) ); |
249 | 242 | ||
250 | 243 | ||
251 | m_connect->setEnabled( false ); | 244 | m_connect->setEnabled( false ); |
252 | m_disconnect->setEnabled( false ); | 245 | m_disconnect->setEnabled( false ); |
253 | m_terminate->setEnabled( false ); | 246 | m_terminate->setEnabled( false ); |
254 | m_transfer->setEnabled( false ); | 247 | m_transfer->setEnabled( false ); |
255 | m_recordScript->setEnabled( false ); | 248 | m_recordScript->setEnabled( false ); |
256 | m_saveScript->setEnabled( false ); | 249 | m_saveScript->setEnabled( false ); |
257 | m_runScript->setEnabled( false ); | 250 | m_runScript->setEnabled( false ); |
258 | m_fullscreen->setEnabled( false ); | 251 | m_fullscreen->setEnabled( false ); |
259 | m_closewindow->setEnabled( false ); | 252 | m_closewindow->setEnabled( false ); |
@@ -426,48 +419,49 @@ void MainWindow::slotClose() { | |||
426 | 419 | ||
427 | /* | 420 | /* |
428 | * We will get the name | 421 | * We will get the name |
429 | * Then the profile | 422 | * Then the profile |
430 | * and then we will make a profile | 423 | * and then we will make a profile |
431 | */ | 424 | */ |
432 | void MainWindow::slotProfile( int id) { | 425 | void MainWindow::slotProfile( int id) { |
433 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); | 426 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); |
434 | create( prof ); | 427 | create( prof ); |
435 | } | 428 | } |
436 | void MainWindow::create( const Profile& prof ) { | 429 | void MainWindow::create( const Profile& prof ) { |
437 | Session *ses = manager()->fromProfile( prof, tabWidget() ); | 430 | Session *ses = manager()->fromProfile( prof, tabWidget() ); |
438 | 431 | ||
439 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) | 432 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) |
440 | { | 433 | { |
441 | QMessageBox::warning(this, | 434 | QMessageBox::warning(this, |
442 | QObject::tr("Session failed"), | 435 | QObject::tr("Session failed"), |
443 | QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); | 436 | QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); |
444 | //if(ses) delete ses; | 437 | //if(ses) delete ses; |
445 | return; | 438 | return; |
446 | } | 439 | } |
447 | 440 | ||
448 | m_sessions.append( ses ); | 441 | m_sessions.append( ses ); |
449 | tabWidget()->add( ses ); | 442 | tabWidget()->add( ses ); |
443 | tabWidget()->repaint(); | ||
450 | m_curSession = ses; | 444 | m_curSession = ses; |
451 | 445 | ||
452 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it | 446 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it |
453 | m_connect->setEnabled( true ); | 447 | m_connect->setEnabled( true ); |
454 | m_disconnect->setEnabled( false ); | 448 | m_disconnect->setEnabled( false ); |
455 | m_terminate->setEnabled( true ); | 449 | m_terminate->setEnabled( true ); |
456 | m_transfer->setEnabled( true ); | 450 | m_transfer->setEnabled( true ); |
457 | m_recordScript->setEnabled( true ); | 451 | m_recordScript->setEnabled( true ); |
458 | m_saveScript->setEnabled( true ); | 452 | m_saveScript->setEnabled( true ); |
459 | m_runScript->setEnabled( true ); | 453 | m_runScript->setEnabled( true ); |
460 | m_fullscreen->setEnabled( true ); | 454 | m_fullscreen->setEnabled( true ); |
461 | m_closewindow->setEnabled( true ); | 455 | m_closewindow->setEnabled( true ); |
462 | 456 | ||
463 | 457 | ||
464 | // is io_layer wants direct connection, then autoconnect | 458 | // is io_layer wants direct connection, then autoconnect |
465 | //if ( ( m_curSession->layer() )->supports()[0] == 1 ) { | 459 | //if ( ( m_curSession->layer() )->supports()[0] == 1 ) { |
466 | if (prof.autoConnect()) { | 460 | if (prof.autoConnect()) { |
467 | slotConnect(); | 461 | slotConnect(); |
468 | } | 462 | } |
469 | 463 | ||
470 | QWidget *w = currentSession()->widget(); | 464 | QWidget *w = currentSession()->widget(); |
471 | if(w) w->setFocus(); | 465 | if(w) w->setFocus(); |
472 | } | 466 | } |
473 | 467 | ||
diff --git a/noncore/apps/opie-console/mainwindow.h b/noncore/apps/opie-console/mainwindow.h index 16b6252..7cc2aa5 100644 --- a/noncore/apps/opie-console/mainwindow.h +++ b/noncore/apps/opie-console/mainwindow.h | |||
@@ -1,48 +1,48 @@ | |||
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 | class QuickButton; | 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 | ||
@@ -100,32 +100,31 @@ private: | |||
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; | 107 | QPopupMenu* m_settings; |
108 | QPopupMenu* m_sessionsPop; | 108 | QPopupMenu* m_sessionsPop; |
109 | QPopupMenu* m_scripts; | 109 | QPopupMenu* m_scripts; |
110 | QAction* m_connect; | 110 | QAction* m_connect; |
111 | QAction* m_disconnect; | 111 | QAction* m_disconnect; |
112 | QAction* m_terminate; | 112 | QAction* m_terminate; |
113 | QAction* m_transfer; | 113 | QAction* m_transfer; |
114 | QAction* m_setProfiles; | 114 | QAction* m_setProfiles; |
115 | QAction* m_openKeys; | 115 | QAction* m_openKeys; |
116 | QAction* m_openButtons; | 116 | QAction* m_openButtons; |
117 | QAction* m_recordScript; | 117 | QAction* m_recordScript; |
118 | QAction* m_saveScript; | 118 | QAction* m_saveScript; |
119 | QAction* m_runScript; | 119 | QAction* m_runScript; |
120 | QAction* m_fullscreen; | 120 | QAction* m_fullscreen; |
121 | QAction* m_closewindow; | 121 | QAction* m_closewindow; |
122 | 122 | ||
123 | FunctionKeyboard *m_kb; | 123 | FunctionKeyboard *m_kb; |
124 | QuickButton *m_qb; | ||
125 | bool m_isFullscreen; | 124 | bool m_isFullscreen; |
126 | 125 | ||
127 | QWidget* savedParentFullscreen; | 126 | QWidget* savedParentFullscreen; |
128 | }; | 127 | }; |
129 | 128 | ||
130 | 129 | ||
131 | #endif | 130 | #endif |