summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp47
-rw-r--r--noncore/apps/opie-console/mainwindow.h1
2 files changed, 17 insertions, 31 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index 745efaf..44ef458 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -11,265 +11,252 @@
#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"
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 );
m_tool->setHorizontalStretchable( TRUE );
m_bar = new QMenuBar( m_tool );
m_console = new QPopupMenu( this );
m_scripts = new QPopupMenu( this );
m_sessionsPop= new QPopupMenu( this );
- //m_settings = new QPopupMenu( this );
/* add a toolbar for icons */
m_icons = new QToolBar(this);
-
-
-
/*
* the settings action
*/
m_setProfiles = new QAction(tr("Configure Profiles"),
Resource::loadPixmap( "SettingsIcon" ),
QString::null, 0, this, 0);
- // m_setProfiles->addTo( m_settings );
- m_setProfiles->addTo( m_icons );
m_setProfiles->addTo( m_console );
connect( m_setProfiles, SIGNAL(activated() ),
this, SLOT(slotConfigure() ) );
m_console->insertSeparator();
/*
* new Action for new sessions
*/
- QAction* a = new QAction(tr("New Connection"),
+ QAction* newCon = new QAction(tr("New Connection"),
Resource::loadPixmap( "new" ),
QString::null, 0, this, 0);
- a->addTo( m_console );
- a->addTo( m_icons );
- connect(a, SIGNAL(activated() ),
+ newCon->addTo( m_console );
+ connect( newCon, SIGNAL(activated() ),
this, SLOT(slotNew() ) );
m_console->insertSeparator();
/* save icon is not available */
- a = new QAction(tr("Save Connection"),
+
+ QAction *saveCon = new QAction(tr("Save Connection"),
Resource::loadPixmap("save"), QString::null,
0, this, 0 );
- a->addTo( m_console );
- connect(a, SIGNAL(activated() ),
+ saveCon->addTo( m_console );
+ connect( saveCon, SIGNAL(activated() ),
this, SLOT(slotSaveSession() ) );
m_console->insertSeparator();
/*
* connect action
*/
m_connect = new QAction();
m_connect->setText( tr("Connect") );
m_connect->addTo( m_console );
connect(m_connect, SIGNAL(activated() ),
this, SLOT(slotConnect() ) );
/*
* disconnect action
*/
m_disconnect = new QAction();
m_disconnect->setText( tr("Disconnect") );
m_disconnect->addTo( m_console );
connect(m_disconnect, SIGNAL(activated() ),
this, SLOT(slotDisconnect() ) );
m_console->insertSeparator();
m_transfer = new QAction();
m_transfer->setText( tr("Transfer file...") );
m_transfer->addTo( m_console );
connect(m_transfer, SIGNAL(activated() ),
this, SLOT(slotTransfer() ) );
/*
* fullscreen
*/
m_isFullscreen = false;
m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" )
, QString::null, 0, this, 0);
m_fullscreen->addTo( m_console );
- m_fullscreen->addTo( m_icons );
connect( m_fullscreen, SIGNAL( activated() ),
this, SLOT( slotFullscreen() ) );
m_console->insertSeparator();
/*
* terminate action
*/
m_terminate = new QAction();
m_terminate->setText( tr("Terminate") );
m_terminate->addTo( m_console );
connect(m_terminate, SIGNAL(activated() ),
this, SLOT(slotTerminate() ) );
m_closewindow = new QAction();
m_closewindow->setText( tr("Close Window") );
m_closewindow->addTo( m_console );
connect( m_closewindow, SIGNAL(activated() ),
this, SLOT(slotClose() ) );
/*
* script actions
*/
m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0);
m_recordScript->addTo(m_scripts);
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( "console/keys/keyboard_icon" ),
QString::null, 0, this, 0);
-
m_openKeys->setToggleAction(true);
-
- connect (m_openKeys, SIGNAL(toggled(bool)),
- this, SLOT(slotOpenKeb(bool)));
- m_openKeys->addTo(m_icons);
+ connect (m_openKeys, SIGNAL(toggled(bool)), this, SLOT(slotOpenKeb(bool)));
/* 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(FKey, ushort, ushort, bool)),
this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool)));
- m_buttonBar = new QToolBar( this );
- addToolBar( m_buttonBar, "Buttons", QMainWindow::Top, TRUE );
- m_buttonBar->setHorizontalStretchable( TRUE );
- m_buttonBar->hide();
- a = new QAction(tr("Copy"),
+ QAction *a = new QAction(tr("Copy"),
Resource::loadPixmap("copy"), QString::null,
0, this, 0 );
//a->addTo( m_icons );
connect( a, SIGNAL(activated() ),
this, SLOT(slotCopy() ) );
- a = new QAction(tr("Paste"),
+ QAction *paste = new QAction(tr("Paste"),
Resource::loadPixmap("paste"), QString::null,
0, this, 0 );
- a->addTo( m_icons );
- connect( a, SIGNAL(activated() ),
+ connect( paste, SIGNAL(activated() ),
this, SLOT(slotPaste() ) );
+ newCon->addTo( m_icons );
+ m_setProfiles->addTo( m_icons );
+ paste->addTo( m_icons );
+ m_openKeys->addTo(m_icons);
+ m_fullscreen->addTo( m_icons );
+
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 );
}
ProfileManager* MainWindow::manager() {
return m_manager;
}
TabWidget* MainWindow::tabWidget() {
return m_consoleWindow;
}
void MainWindow::populateProfiles() {
m_sessionsPop->clear();
Profile::ValueList list = manager()->all();
for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) {
m_sessionsPop->insertItem( (*it).name() );
}
}
MainWindow::~MainWindow() {
delete m_factory;
manager()->save();
}
MetaFactory* MainWindow::factory() {
return m_factory;
}
Session* MainWindow::currentSession() {
return m_curSession;
diff --git a/noncore/apps/opie-console/mainwindow.h b/noncore/apps/opie-console/mainwindow.h
index 7cc2aa5..19d3a3d 100644
--- a/noncore/apps/opie-console/mainwindow.h
+++ b/noncore/apps/opie-console/mainwindow.h
@@ -59,72 +59,71 @@ private slots:
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(FKey, ushort, ushort, bool);
/* what could these both slot do? */
void slotCopy();
void slotPaste();
/* save the currentSession() to Profiles */
void slotSaveSession();
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;
bool m_isFullscreen;
QWidget* savedParentFullscreen;
};
#endif