-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 | |||
@@ -30,2 +30,3 @@ | |||
30 | #include "script.h" | 30 | #include "script.h" |
31 | #include "quick_button.h" | ||
31 | 32 | ||
@@ -174,2 +175,16 @@ void MainWindow::initUI() { | |||
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 */ |
@@ -197,2 +212,10 @@ void MainWindow::initUI() { | |||
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 | ||
@@ -433,2 +456,15 @@ void MainWindow::slotOpenKeb(bool state) { | |||
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 ) { |
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 | |||
@@ -22,2 +22,4 @@ class Profile; | |||
22 | class FunctionKeyboard; | 22 | class FunctionKeyboard; |
23 | class QuickButton; | ||
24 | |||
23 | class MainWindow : public QMainWindow { | 25 | class MainWindow : public QMainWindow { |
@@ -61,2 +63,3 @@ private slots: | |||
61 | void slotOpenKeb(bool); | 63 | void slotOpenKeb(bool); |
64 | void slotOpenButtons(bool); | ||
62 | void slotRecordScript(); | 65 | void slotRecordScript(); |
@@ -92,2 +95,3 @@ private: | |||
92 | QToolBar* m_keyBar; | 95 | QToolBar* m_keyBar; |
96 | QToolBar* m_buttonBar; | ||
93 | QMenuBar* m_bar; | 97 | QMenuBar* m_bar; |
@@ -103,2 +107,3 @@ private: | |||
103 | QAction* m_openKeys; | 107 | QAction* m_openKeys; |
108 | QAction* m_openButtons; | ||
104 | QAction* m_recordScript; | 109 | QAction* m_recordScript; |
@@ -110,2 +115,3 @@ private: | |||
110 | FunctionKeyboard *m_kb; | 115 | FunctionKeyboard *m_kb; |
116 | QuickButton *m_qb; | ||
111 | bool m_isFullscreen; | 117 | bool m_isFullscreen; |
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 | |||
@@ -25,3 +25,3 @@ HEADERS = io_layer.h io_serial.h io_irda.h io_bt.h io_modem.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 \ |
@@ -54,3 +54,3 @@ SOURCES = io_layer.cpp io_serial.cpp io_irda.cpp io_bt.cpp io_modem.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 \ |
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 | ||