From 51dbf76486cb81a7cb34c07483b344c8ea7a8a24 Mon Sep 17 00:00:00 2001 From: harlekin Date: Thu, 17 Oct 2002 22:49:55 +0000 Subject: buttonbar added --- (limited to 'noncore') 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 @@ #include "function_keyboard.h" #include "emulation_handler.h" #include "script.h" +#include "quick_button.h" @@ -172,6 +173,20 @@ void MainWindow::initUI() { m_openKeys->addTo(m_icons); + /* + * action that open/closes the keyboard + */ + m_openButtons = new QAction ( tr( "Open Buttons..." ), + Resource::loadPixmap( "down" ), + QString::null, 0, this, 0 ); + + m_openButtons->setToggleAction( true ); + + connect ( m_openButtons, SIGNAL( toggled( bool ) ), + this, SLOT( slotOpenButtons( bool ) ) ); + m_openButtons->addTo( m_icons ); + + /* insert the submenu */ m_console->insertItem(tr("New from Profile"), m_sessionsPop, -1, 0); @@ -195,6 +210,14 @@ void MainWindow::initUI() { connect(m_kb, SIGNAL(keyPressed(ushort, ushort, bool, bool, bool)), this, SLOT(slotKeyReceived(ushort, ushort, bool, bool, bool))); + m_buttonBar = new QToolBar( this ); + addToolBar( m_buttonBar, "Buttons", QMainWindow::Top, TRUE ); + m_buttonBar->setHorizontalStretchable( TRUE ); + m_buttonBar->hide(); + + m_qb = new QuickButton( m_buttonBar ); + connect( m_qb, SIGNAL( keyPressed( ushort, ushort, bool, bool, bool) ), + this, SLOT( slotKeyReceived( ushort, ushort, bool, bool, bool) ) ); m_connect->setEnabled( false ); @@ -431,6 +454,19 @@ void MainWindow::slotOpenKeb(bool state) { else m_keyBar->hide(); } + + +void MainWindow::slotOpenButtons( bool state ) { + + if ( state ) { + m_buttonBar->show(); + } else { + m_buttonBar->hide(); + } +} + + + void MainWindow::slotSessionChanged( Session* ses ) { qWarning("changed!"); 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; class ProfileManager; class Profile; class FunctionKeyboard; +class QuickButton; + class MainWindow : public QMainWindow { Q_OBJECT public: @@ -59,6 +61,7 @@ private slots: void slotProfile(int); void slotTransfer(); void slotOpenKeb(bool); + void slotOpenButtons(bool); void slotRecordScript(); void slotSaveScript(); void slotRunScript(); @@ -90,6 +93,7 @@ private: QToolBar* m_tool; QToolBar* m_icons; QToolBar* m_keyBar; + QToolBar* m_buttonBar; QMenuBar* m_bar; QPopupMenu* m_console; QPopupMenu* m_settings; @@ -101,6 +105,7 @@ private: QAction* m_transfer; QAction* m_setProfiles; QAction* m_openKeys; + QAction* m_openButtons; QAction* m_recordScript; QAction* m_saveScript; QAction* m_runScript; @@ -108,6 +113,7 @@ private: QAction* m_closewindow; FunctionKeyboard *m_kb; + QuickButton *m_qb; 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 @@ -23,7 +23,7 @@ HEADERS = io_layer.h io_serial.h io_irda.h io_bt.h io_modem.h \ btconfigwidget.h modemconfigwidget.h \ atconfigdialog.h dialdialog.h \ procctl.h \ - function_keyboard.h \ + function_keyboard.h quick_button.h \ receive_layer.h filereceive.h \ script.h \ dialer.h \ @@ -52,7 +52,7 @@ SOURCES = io_layer.cpp io_serial.cpp io_irda.cpp io_bt.cpp io_modem.cpp \ btconfigwidget.cpp modemconfigwidget.cpp \ atconfigdialog.cpp dialdialog.cpp \ default.cpp procctl.cpp \ - function_keyboard.cpp \ + function_keyboard.cpp quick_button.cpp \ receive_layer.cpp filereceive.cpp \ script.cpp \ 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 @@ +#include +#include +#include + +#include +#include "quick_button.h" + +QuickButton::QuickButton(QWidget *parent) : QFrame(parent) { + + QAction *a; + + // Button Commands + a = new QAction( tr("Enter"), Resource::loadPixmap( "console/enter" ), QString::null, 0, this, 0 ); + connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); + a->addTo( parent ); + a = new QAction( tr("Space"), Resource::loadPixmap( "console/space" ), QString::null, 0, this, 0 ); + connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); + a->addTo( parent ); + a = new QAction( tr("Tab"), Resource::loadPixmap( "console/tab" ), QString::null, 0, this, 0 ); + connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); + a->addTo( parent ); + a = new QAction( tr("Up"), Resource::loadPixmap( "console/up" ), QString::null, 0, this, 0 ); + connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); + a->addTo( parent ); + a = new QAction( tr("Down"), Resource::loadPixmap( "console/down" ), QString::null, 0, this, 0 ); + connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); + a->addTo( parent ); + a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); + connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); + a->addTo( parent ); + + +} + +QuickButton::~QuickButton() { +} + + +void QuickButton::hitEnter() { + emit keyPressed( QKeyEvent::KeyPress, Qt::Key_Enter, 0, 1, 0); +} + +void QuickButton::hitSpace() { + emit keyPressed( QKeyEvent::KeyPress, Qt::Key_Space, 0, 1, 0); +} + +void QuickButton::hitTab() { + emit keyPressed( QKeyEvent::KeyPress, Qt::Key_Tab, 0, 1, 0); +} + +void QuickButton::hitPaste() { + /* + TEWidget* te = getTe(); + if (te != 0) { + te->pasteClipboard(); + } + */ +} + +void QuickButton::hitUp() { + emit keyPressed( QKeyEvent::KeyPress, Qt::Key_Up, 0, 1, 0); +} + +void QuickButton::hitDown() { + emit keyPressed( QKeyEvent::KeyPress, Qt::Key_Down, 0, 1, 0); +} + 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 @@ +#ifndef QUICK_BUTTON_H +#define QUICK_BUTTON_H + +#include + +class QuickButton : public QFrame { + + Q_OBJECT + +public: + QuickButton( QWidget *parent = 0 ); + ~QuickButton(); + + signals: + + void keyPressed( ushort, ushort, bool, bool, bool ); + +private slots: + void hitEnter(); + void hitSpace(); + void hitTab(); + void hitPaste(); + void hitUp(); + void hitDown(); +}; + +#endif -- cgit v0.9.0.2