summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-10-17 22:49:55 (UTC)
committer harlekin <harlekin>2002-10-17 22:49:55 (UTC)
commit51dbf76486cb81a7cb34c07483b344c8ea7a8a24 (patch) (side-by-side diff)
tree422713323f2631e6432cfe3e07e735206446e7fc
parent943c09096f11827470b9cd3e311329ac422aaf20 (diff)
downloadopie-51dbf76486cb81a7cb34c07483b344c8ea7a8a24.zip
opie-51dbf76486cb81a7cb34c07483b344c8ea7a8a24.tar.gz
opie-51dbf76486cb81a7cb34c07483b344c8ea7a8a24.tar.bz2
buttonbar added
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp36
-rw-r--r--noncore/apps/opie-console/mainwindow.h6
-rw-r--r--noncore/apps/opie-console/opie-console.pro4
-rw-r--r--noncore/apps/opie-console/quick_button.cpp67
-rw-r--r--noncore/apps/opie-console/quick_button.h27
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
@@ -7,48 +7,49 @@
#include <qlabel.h>
#include <qpopupmenu.h>
#include <qtoolbar.h>
#include <qmessagebox.h>
#include <qpushbutton.h>
#include <qwhatsthis.h>
#include <qpe/resource.h>
#include <opie/ofiledialog.h>
#include "keytrans.h"
#include "profileeditordialog.h"
#include "configdialog.h"
#include "default.h"
#include "metafactory.h"
#include "profile.h"
#include "profilemanager.h"
#include "mainwindow.h"
#include "tabwidget.h"
#include "transferdialog.h"
#include "function_keyboard.h"
#include "emulation_handler.h"
#include "script.h"
+#include "quick_button.h"
MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) {
KeyTrans::loadAll();
for (int i = 0; i < KeyTrans::count(); i++ ) {
KeyTrans* s = KeyTrans::find(i );
assert( s );
}
m_factory = new MetaFactory();
Default def(m_factory);
m_sessions.setAutoDelete( TRUE );
m_curSession = 0;
m_manager = new ProfileManager( m_factory );
m_manager->load();
initUI();
populateProfiles();
}
void MainWindow::initUI() {
setToolBarsMovable( FALSE );
/* tool bar for the menu */
m_tool = new QToolBar( this );
@@ -151,71 +152,93 @@ void MainWindow::initUI() {
connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript()));
m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0);
m_saveScript->addTo(m_scripts);
connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript()));
m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0);
m_runScript->addTo(m_scripts);
connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript()));
/*
* action that open/closes the keyboard
*/
m_openKeys = new QAction (tr("Open Keyboard..."),
Resource::loadPixmap( "down" ),
QString::null, 0, this, 0);
m_openKeys->setToggleAction(true);
connect (m_openKeys, SIGNAL(toggled(bool)),
this, SLOT(slotOpenKeb(bool)));
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);
/* insert the connection menu */
m_bar->insertItem( tr("Connection"), m_console );
/* the scripts menu */
m_bar->insertItem( tr("Scripts"), m_scripts );
/* the settings menu */
// m_bar->insertItem( tr("Settings"), m_settings );
/* and the keyboard */
m_keyBar = new QToolBar(this);
addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE );
m_keyBar->setHorizontalStretchable( TRUE );
m_keyBar->hide();
m_kb = new FunctionKeyboard(m_keyBar);
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 );
m_disconnect->setEnabled( false );
m_terminate->setEnabled( false );
m_transfer->setEnabled( false );
m_recordScript->setEnabled( false );
m_saveScript->setEnabled( false );
m_runScript->setEnabled( false );
m_fullscreen->setEnabled( false );
m_closewindow->setEnabled( false );
/*
* connect to the menu activation
*/
connect( m_sessionsPop, SIGNAL(activated( int ) ),
this, SLOT(slotProfile( int ) ) );
m_consoleWindow = new TabWidget( this, "blah");
connect(m_consoleWindow, SIGNAL(activated(Session*) ),
this, SLOT(slotSessionChanged(Session*) ) );
setCentralWidget( m_consoleWindow );
}
@@ -410,48 +433,61 @@ void MainWindow::create( const Profile& prof ) {
m_transfer->setEnabled( true );
m_recordScript->setEnabled( true );
m_saveScript->setEnabled( true );
m_runScript->setEnabled( true );
m_fullscreen->setEnabled( true );
m_closewindow->setEnabled( true );
}
void MainWindow::slotTransfer()
{
if ( currentSession() ) {
TransferDialog dlg(this);
dlg.showMaximized();
dlg.exec();
}
}
void MainWindow::slotOpenKeb(bool state) {
if (state) m_keyBar->show();
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 ) {
m_curSession = ses;
qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) );
if ( m_curSession->layer()->isConnected() ) {
m_connect->setEnabled( false );
m_disconnect->setEnabled( true );
} else {
m_connect->setEnabled( true );
m_disconnect->setEnabled( false );
}
}
}
void MainWindow::slotFullscreen() {
if ( m_isFullscreen ) {
( m_curSession->widgetStack() )->reparent( m_consoleWindow, 0, QPoint(0,0), false );
( m_curSession->widgetStack() )->setFrameStyle( QFrame::Panel | QFrame::Sunken );
setCentralWidget( m_consoleWindow );
( m_curSession->widgetStack() )->show();
( m_curSession->emulationHandler() )->cornerButton()->hide();
disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) );
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
@@ -1,115 +1,121 @@
#ifndef OPIE_MAIN_WINDOW_H
#define OPIE_MAIN_WINDOW_H
#include <qmainwindow.h>
#include <qlist.h>
#include "session.h"
/**
* this is the MainWindow of the new opie console
* it's also the dispatcher between the different
* actions supported by the gui
*/
class QToolBar;
class QToolButton;
class QMenuBar;
class QAction;
class MetaFactory;
class TabWidget;
class ProfileManager;
class Profile;
class FunctionKeyboard;
+class QuickButton;
+
class MainWindow : public QMainWindow {
Q_OBJECT
public:
MainWindow( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 );
~MainWindow();
/**
* our factory to generate IOLayer and so on
*
*/
MetaFactory* factory();
/**
* A session contains a QWidget*,
* an IOLayer* and some infos for us
*/
Session* currentSession();
/**
* the session list
*/
QList<Session> sessions();
/**
*
*/
ProfileManager* manager();
TabWidget* tabWidget();
private slots:
void slotNew();
void slotConnect();
void slotDisconnect();
void slotTerminate();
void slotConfigure();
void slotClose();
void slotProfile(int);
void slotTransfer();
void slotOpenKeb(bool);
+ void slotOpenButtons(bool);
void slotRecordScript();
void slotSaveScript();
void slotRunScript();
void slotFullscreen();
void slotSessionChanged( Session* );
void slotKeyReceived(ushort, ushort, bool, bool, bool);
private:
void initUI();
void populateProfiles();
void create( const Profile& );
/**
* the current session
*/
Session* m_curSession;
/**
* the session list
*/
QList<Session> m_sessions;
/**
* the metafactory
*/
MetaFactory* m_factory;
ProfileManager* m_manager;
TabWidget* m_consoleWindow;
QToolBar* m_tool;
QToolBar* m_icons;
QToolBar* m_keyBar;
+ QToolBar* m_buttonBar;
QMenuBar* m_bar;
QPopupMenu* m_console;
QPopupMenu* m_settings;
QPopupMenu* m_sessionsPop;
QPopupMenu* m_scripts;
QAction* m_connect;
QAction* m_disconnect;
QAction* m_terminate;
QAction* m_transfer;
QAction* m_setProfiles;
QAction* m_openKeys;
+ QAction* m_openButtons;
QAction* m_recordScript;
QAction* m_saveScript;
QAction* m_runScript;
QAction* m_fullscreen;
QAction* m_closewindow;
FunctionKeyboard *m_kb;
+ QuickButton *m_qb;
bool m_isFullscreen;
};
#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
@@ -2,69 +2,69 @@ TEMPLATE = app
#CONFIG = qt warn_on release
CONFIG = qt debug
DESTDIR = $(OPIEDIR)/bin
HEADERS = io_layer.h io_serial.h io_irda.h io_bt.h io_modem.h \
file_layer.h filetransfer.h \
metafactory.h \
session.h \
mainwindow.h \
profile.h \
profileconfig.h \
profilemanager.h \
configwidget.h \
tabwidget.h \
configdialog.h \
keytrans.h \
transferdialog.h \
profiledialogwidget.h \
profileeditordialog.h \
default.h \
iolayerbase.h \
serialconfigwidget.h irdaconfigwidget.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 \
terminalwidget.h \
emulation_handler.h TECommon.h \
TEHistroy.h TEScreen.h TEWidget.h \
TEmuVt102.h TEmulation.h MyPty.h
SOURCES = io_layer.cpp io_serial.cpp io_irda.cpp io_bt.cpp io_modem.cpp \
file_layer.cpp filetransfer.cpp \
main.cpp \
metafactory.cpp \
session.cpp \
mainwindow.cpp \
profile.cpp \
profileconfig.cpp \
profilemanager.cpp \
tabwidget.cpp \
configdialog.cpp \
keytrans.cpp \
transferdialog.cpp \
profiledialogwidget.cpp \
profileeditordialog.cpp \
iolayerbase.cpp \
serialconfigwidget.cpp irdaconfigwidget.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 \
terminalwidget.cpp \
emulation_handler.cpp TEHistory.cpp \
TEScreen.cpp TEWidget.cpp \
TEmuVt102.cpp TEmulation.cpp MyPty.cpp
INTERFACES = configurebase.ui editbase.ui
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe -lopie
TARGET = opie-console
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 <qevent.h>
+#include <qapplication.h>
+#include <qaction.h>
+
+#include <qpe/resource.h>
+#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 <qframe.h>
+
+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