-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 36 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.h | 6 | ||||
-rw-r--r-- | noncore/apps/opie-console/opie-console.pro | 4 | ||||
-rw-r--r-- | noncore/apps/opie-console/quick_button.cpp | 67 | ||||
-rw-r--r-- | noncore/apps/opie-console/quick_button.h | 27 |
5 files changed, 138 insertions, 2 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index f0130e1..b813442 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -25,12 +25,13 @@ | |||
25 | #include "mainwindow.h" | 25 | #include "mainwindow.h" |
26 | #include "tabwidget.h" | 26 | #include "tabwidget.h" |
27 | #include "transferdialog.h" | 27 | #include "transferdialog.h" |
28 | #include "function_keyboard.h" | 28 | #include "function_keyboard.h" |
29 | #include "emulation_handler.h" | 29 | #include "emulation_handler.h" |
30 | #include "script.h" | 30 | #include "script.h" |
31 | #include "quick_button.h" | ||
31 | 32 | ||
32 | 33 | ||
33 | 34 | ||
34 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { | 35 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { |
35 | KeyTrans::loadAll(); | 36 | KeyTrans::loadAll(); |
36 | for (int i = 0; i < KeyTrans::count(); i++ ) { | 37 | for (int i = 0; i < KeyTrans::count(); i++ ) { |
@@ -169,12 +170,26 @@ void MainWindow::initUI() { | |||
169 | 170 | ||
170 | connect (m_openKeys, SIGNAL(toggled(bool)), | 171 | connect (m_openKeys, SIGNAL(toggled(bool)), |
171 | this, SLOT(slotOpenKeb(bool))); | 172 | this, SLOT(slotOpenKeb(bool))); |
172 | m_openKeys->addTo(m_icons); | 173 | m_openKeys->addTo(m_icons); |
173 | 174 | ||
174 | 175 | ||
176 | /* | ||
177 | * action that open/closes the keyboard | ||
178 | */ | ||
179 | m_openButtons = new QAction ( tr( "Open Buttons..." ), | ||
180 | Resource::loadPixmap( "down" ), | ||
181 | QString::null, 0, this, 0 ); | ||
182 | |||
183 | m_openButtons->setToggleAction( true ); | ||
184 | |||
185 | connect ( m_openButtons, SIGNAL( toggled( bool ) ), | ||
186 | this, SLOT( slotOpenButtons( bool ) ) ); | ||
187 | m_openButtons->addTo( m_icons ); | ||
188 | |||
189 | |||
175 | /* insert the submenu */ | 190 | /* insert the submenu */ |
176 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, | 191 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, |
177 | -1, 0); | 192 | -1, 0); |
178 | 193 | ||
179 | /* insert the connection menu */ | 194 | /* insert the connection menu */ |
180 | m_bar->insertItem( tr("Connection"), m_console ); | 195 | m_bar->insertItem( tr("Connection"), m_console ); |
@@ -192,12 +207,20 @@ void MainWindow::initUI() { | |||
192 | m_keyBar->hide(); | 207 | m_keyBar->hide(); |
193 | 208 | ||
194 | m_kb = new FunctionKeyboard(m_keyBar); | 209 | m_kb = new FunctionKeyboard(m_keyBar); |
195 | connect(m_kb, SIGNAL(keyPressed(ushort, ushort, bool, bool, bool)), | 210 | connect(m_kb, SIGNAL(keyPressed(ushort, ushort, bool, bool, bool)), |
196 | this, SLOT(slotKeyReceived(ushort, ushort, bool, bool, bool))); | 211 | this, SLOT(slotKeyReceived(ushort, ushort, bool, bool, bool))); |
197 | 212 | ||
213 | m_buttonBar = new QToolBar( this ); | ||
214 | addToolBar( m_buttonBar, "Buttons", QMainWindow::Top, TRUE ); | ||
215 | m_buttonBar->setHorizontalStretchable( TRUE ); | ||
216 | m_buttonBar->hide(); | ||
217 | |||
218 | m_qb = new QuickButton( m_buttonBar ); | ||
219 | connect( m_qb, SIGNAL( keyPressed( ushort, ushort, bool, bool, bool) ), | ||
220 | this, SLOT( slotKeyReceived( ushort, ushort, bool, bool, bool) ) ); | ||
198 | 221 | ||
199 | 222 | ||
200 | m_connect->setEnabled( false ); | 223 | m_connect->setEnabled( false ); |
201 | m_disconnect->setEnabled( false ); | 224 | m_disconnect->setEnabled( false ); |
202 | m_terminate->setEnabled( false ); | 225 | m_terminate->setEnabled( false ); |
203 | m_transfer->setEnabled( false ); | 226 | m_transfer->setEnabled( false ); |
@@ -428,12 +451,25 @@ void MainWindow::slotTransfer() | |||
428 | void MainWindow::slotOpenKeb(bool state) { | 451 | void MainWindow::slotOpenKeb(bool state) { |
429 | 452 | ||
430 | if (state) m_keyBar->show(); | 453 | if (state) m_keyBar->show(); |
431 | else m_keyBar->hide(); | 454 | else m_keyBar->hide(); |
432 | 455 | ||
433 | } | 456 | } |
457 | |||
458 | |||
459 | void MainWindow::slotOpenButtons( bool state ) { | ||
460 | |||
461 | if ( state ) { | ||
462 | m_buttonBar->show(); | ||
463 | } else { | ||
464 | m_buttonBar->hide(); | ||
465 | } | ||
466 | } | ||
467 | |||
468 | |||
469 | |||
434 | void MainWindow::slotSessionChanged( Session* ses ) { | 470 | void MainWindow::slotSessionChanged( Session* ses ) { |
435 | qWarning("changed!"); | 471 | qWarning("changed!"); |
436 | if ( ses ) { | 472 | if ( ses ) { |
437 | m_curSession = ses; | 473 | m_curSession = ses; |
438 | qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) ); | 474 | qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) ); |
439 | if ( m_curSession->layer()->isConnected() ) { | 475 | if ( m_curSession->layer()->isConnected() ) { |
diff --git a/noncore/apps/opie-console/mainwindow.h b/noncore/apps/opie-console/mainwindow.h index 35338b7..7d074b6 100644 --- a/noncore/apps/opie-console/mainwindow.h +++ b/noncore/apps/opie-console/mainwindow.h | |||
@@ -17,12 +17,14 @@ 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 QuickButton; | ||
24 | |||
23 | class MainWindow : public QMainWindow { | 25 | class MainWindow : public QMainWindow { |
24 | Q_OBJECT | 26 | Q_OBJECT |
25 | public: | 27 | public: |
26 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 ); | 28 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 ); |
27 | ~MainWindow(); | 29 | ~MainWindow(); |
28 | 30 | ||
@@ -56,12 +58,13 @@ private slots: | |||
56 | void slotTerminate(); | 58 | void slotTerminate(); |
57 | void slotConfigure(); | 59 | void slotConfigure(); |
58 | void slotClose(); | 60 | void slotClose(); |
59 | void slotProfile(int); | 61 | void slotProfile(int); |
60 | void slotTransfer(); | 62 | void slotTransfer(); |
61 | void slotOpenKeb(bool); | 63 | void slotOpenKeb(bool); |
64 | void slotOpenButtons(bool); | ||
62 | void slotRecordScript(); | 65 | void slotRecordScript(); |
63 | void slotSaveScript(); | 66 | void slotSaveScript(); |
64 | void slotRunScript(); | 67 | void slotRunScript(); |
65 | void slotFullscreen(); | 68 | void slotFullscreen(); |
66 | void slotSessionChanged( Session* ); | 69 | void slotSessionChanged( Session* ); |
67 | void slotKeyReceived(ushort, ushort, bool, bool, bool); | 70 | void slotKeyReceived(ushort, ushort, bool, bool, bool); |
@@ -87,29 +90,32 @@ private: | |||
87 | ProfileManager* m_manager; | 90 | ProfileManager* m_manager; |
88 | 91 | ||
89 | TabWidget* m_consoleWindow; | 92 | TabWidget* m_consoleWindow; |
90 | QToolBar* m_tool; | 93 | QToolBar* m_tool; |
91 | QToolBar* m_icons; | 94 | QToolBar* m_icons; |
92 | QToolBar* m_keyBar; | 95 | QToolBar* m_keyBar; |
96 | QToolBar* m_buttonBar; | ||
93 | QMenuBar* m_bar; | 97 | QMenuBar* m_bar; |
94 | QPopupMenu* m_console; | 98 | QPopupMenu* m_console; |
95 | QPopupMenu* m_settings; | 99 | QPopupMenu* m_settings; |
96 | QPopupMenu* m_sessionsPop; | 100 | QPopupMenu* m_sessionsPop; |
97 | QPopupMenu* m_scripts; | 101 | QPopupMenu* m_scripts; |
98 | QAction* m_connect; | 102 | QAction* m_connect; |
99 | QAction* m_disconnect; | 103 | QAction* m_disconnect; |
100 | QAction* m_terminate; | 104 | QAction* m_terminate; |
101 | QAction* m_transfer; | 105 | QAction* m_transfer; |
102 | QAction* m_setProfiles; | 106 | QAction* m_setProfiles; |
103 | QAction* m_openKeys; | 107 | QAction* m_openKeys; |
108 | QAction* m_openButtons; | ||
104 | QAction* m_recordScript; | 109 | QAction* m_recordScript; |
105 | QAction* m_saveScript; | 110 | QAction* m_saveScript; |
106 | QAction* m_runScript; | 111 | QAction* m_runScript; |
107 | QAction* m_fullscreen; | 112 | QAction* m_fullscreen; |
108 | QAction* m_closewindow; | 113 | QAction* m_closewindow; |
109 | 114 | ||
110 | FunctionKeyboard *m_kb; | 115 | FunctionKeyboard *m_kb; |
116 | QuickButton *m_qb; | ||
111 | bool m_isFullscreen; | 117 | bool m_isFullscreen; |
112 | }; | 118 | }; |
113 | 119 | ||
114 | 120 | ||
115 | #endif | 121 | #endif |
diff --git a/noncore/apps/opie-console/opie-console.pro b/noncore/apps/opie-console/opie-console.pro index c2fb558..51b42bf 100644 --- a/noncore/apps/opie-console/opie-console.pro +++ b/noncore/apps/opie-console/opie-console.pro | |||
@@ -20,13 +20,13 @@ HEADERS = io_layer.h io_serial.h io_irda.h io_bt.h io_modem.h \ | |||
20 | default.h \ | 20 | default.h \ |
21 | iolayerbase.h \ | 21 | iolayerbase.h \ |
22 | serialconfigwidget.h irdaconfigwidget.h \ | 22 | serialconfigwidget.h irdaconfigwidget.h \ |
23 | btconfigwidget.h modemconfigwidget.h \ | 23 | btconfigwidget.h modemconfigwidget.h \ |
24 | atconfigdialog.h dialdialog.h \ | 24 | atconfigdialog.h dialdialog.h \ |
25 | procctl.h \ | 25 | procctl.h \ |
26 | function_keyboard.h \ | 26 | function_keyboard.h quick_button.h \ |
27 | receive_layer.h filereceive.h \ | 27 | receive_layer.h filereceive.h \ |
28 | script.h \ | 28 | script.h \ |
29 | dialer.h \ | 29 | dialer.h \ |
30 | terminalwidget.h \ | 30 | terminalwidget.h \ |
31 | emulation_handler.h TECommon.h \ | 31 | emulation_handler.h TECommon.h \ |
32 | TEHistroy.h TEScreen.h TEWidget.h \ | 32 | TEHistroy.h TEScreen.h TEWidget.h \ |
@@ -49,13 +49,13 @@ SOURCES = io_layer.cpp io_serial.cpp io_irda.cpp io_bt.cpp io_modem.cpp \ | |||
49 | profileeditordialog.cpp \ | 49 | profileeditordialog.cpp \ |
50 | iolayerbase.cpp \ | 50 | iolayerbase.cpp \ |
51 | serialconfigwidget.cpp irdaconfigwidget.cpp \ | 51 | serialconfigwidget.cpp irdaconfigwidget.cpp \ |
52 | btconfigwidget.cpp modemconfigwidget.cpp \ | 52 | btconfigwidget.cpp modemconfigwidget.cpp \ |
53 | atconfigdialog.cpp dialdialog.cpp \ | 53 | atconfigdialog.cpp dialdialog.cpp \ |
54 | default.cpp procctl.cpp \ | 54 | default.cpp procctl.cpp \ |
55 | function_keyboard.cpp \ | 55 | function_keyboard.cpp quick_button.cpp \ |
56 | receive_layer.cpp filereceive.cpp \ | 56 | receive_layer.cpp filereceive.cpp \ |
57 | script.cpp \ | 57 | script.cpp \ |
58 | dialer.cpp \ | 58 | dialer.cpp \ |
59 | terminalwidget.cpp \ | 59 | terminalwidget.cpp \ |
60 | emulation_handler.cpp TEHistory.cpp \ | 60 | emulation_handler.cpp TEHistory.cpp \ |
61 | TEScreen.cpp TEWidget.cpp \ | 61 | TEScreen.cpp TEWidget.cpp \ |
diff --git a/noncore/apps/opie-console/quick_button.cpp b/noncore/apps/opie-console/quick_button.cpp new file mode 100644 index 0000000..09df901 --- a/dev/null +++ b/noncore/apps/opie-console/quick_button.cpp | |||
@@ -0,0 +1,67 @@ | |||
1 | #include <qevent.h> | ||
2 | #include <qapplication.h> | ||
3 | #include <qaction.h> | ||
4 | |||
5 | #include <qpe/resource.h> | ||
6 | #include "quick_button.h" | ||
7 | |||
8 | QuickButton::QuickButton(QWidget *parent) : QFrame(parent) { | ||
9 | |||
10 | QAction *a; | ||
11 | |||
12 | // Button Commands | ||
13 | a = new QAction( tr("Enter"), Resource::loadPixmap( "console/enter" ), QString::null, 0, this, 0 ); | ||
14 | connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); | ||
15 | a->addTo( parent ); | ||
16 | a = new QAction( tr("Space"), Resource::loadPixmap( "console/space" ), QString::null, 0, this, 0 ); | ||
17 | connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); | ||
18 | a->addTo( parent ); | ||
19 | a = new QAction( tr("Tab"), Resource::loadPixmap( "console/tab" ), QString::null, 0, this, 0 ); | ||
20 | connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); | ||
21 | a->addTo( parent ); | ||
22 | a = new QAction( tr("Up"), Resource::loadPixmap( "console/up" ), QString::null, 0, this, 0 ); | ||
23 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); | ||
24 | a->addTo( parent ); | ||
25 | a = new QAction( tr("Down"), Resource::loadPixmap( "console/down" ), QString::null, 0, this, 0 ); | ||
26 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); | ||
27 | a->addTo( parent ); | ||
28 | a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); | ||
29 | connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); | ||
30 | a->addTo( parent ); | ||
31 | |||
32 | |||
33 | } | ||
34 | |||
35 | QuickButton::~QuickButton() { | ||
36 | } | ||
37 | |||
38 | |||
39 | void QuickButton::hitEnter() { | ||
40 | emit keyPressed( QKeyEvent::KeyPress, Qt::Key_Enter, 0, 1, 0); | ||
41 | } | ||
42 | |||
43 | void QuickButton::hitSpace() { | ||
44 | emit keyPressed( QKeyEvent::KeyPress, Qt::Key_Space, 0, 1, 0); | ||
45 | } | ||
46 | |||
47 | void QuickButton::hitTab() { | ||
48 | emit keyPressed( QKeyEvent::KeyPress, Qt::Key_Tab, 0, 1, 0); | ||
49 | } | ||
50 | |||
51 | void QuickButton::hitPaste() { | ||
52 | /* | ||
53 | TEWidget* te = getTe(); | ||
54 | if (te != 0) { | ||
55 | te->pasteClipboard(); | ||
56 | } | ||
57 | */ | ||
58 | } | ||
59 | |||
60 | void QuickButton::hitUp() { | ||
61 | emit keyPressed( QKeyEvent::KeyPress, Qt::Key_Up, 0, 1, 0); | ||
62 | } | ||
63 | |||
64 | void QuickButton::hitDown() { | ||
65 | emit keyPressed( QKeyEvent::KeyPress, Qt::Key_Down, 0, 1, 0); | ||
66 | } | ||
67 | |||
diff --git a/noncore/apps/opie-console/quick_button.h b/noncore/apps/opie-console/quick_button.h new file mode 100644 index 0000000..d3eb1bb --- a/dev/null +++ b/noncore/apps/opie-console/quick_button.h | |||
@@ -0,0 +1,27 @@ | |||
1 | #ifndef QUICK_BUTTON_H | ||
2 | #define QUICK_BUTTON_H | ||
3 | |||
4 | #include <qframe.h> | ||
5 | |||
6 | class QuickButton : public QFrame { | ||
7 | |||
8 | Q_OBJECT | ||
9 | |||
10 | public: | ||
11 | QuickButton( QWidget *parent = 0 ); | ||
12 | ~QuickButton(); | ||
13 | |||
14 | signals: | ||
15 | |||
16 | void keyPressed( ushort, ushort, bool, bool, bool ); | ||
17 | |||
18 | private slots: | ||
19 | void hitEnter(); | ||
20 | void hitSpace(); | ||
21 | void hitTab(); | ||
22 | void hitPaste(); | ||
23 | void hitUp(); | ||
24 | void hitDown(); | ||
25 | }; | ||
26 | |||
27 | #endif | ||