-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 | |||
@@ -28,6 +28,7 @@ | |||
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 | ||
@@ -172,6 +173,20 @@ void MainWindow::initUI() { | |||
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); |
@@ -195,6 +210,14 @@ void MainWindow::initUI() { | |||
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 ); |
@@ -431,6 +454,19 @@ void MainWindow::slotOpenKeb(bool state) { | |||
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 ) { |
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 | |||
@@ -20,6 +20,8 @@ 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: |
@@ -59,6 +61,7 @@ private slots: | |||
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(); |
@@ -90,6 +93,7 @@ private: | |||
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; |
@@ -101,6 +105,7 @@ private: | |||
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; |
@@ -108,6 +113,7 @@ private: | |||
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 | ||
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 | |||
@@ -23,7 +23,7 @@ HEADERS = io_layer.h io_serial.h io_irda.h io_bt.h io_modem.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 \ |
@@ -52,7 +52,7 @@ SOURCES = io_layer.cpp io_serial.cpp io_irda.cpp io_bt.cpp io_modem.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 \ |
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 | ||