summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp13
-rw-r--r--noncore/apps/opie-console/opie-console.pro8
-rw-r--r--noncore/apps/opie-console/profileeditordialog.cpp20
-rw-r--r--noncore/apps/opie-console/profileeditordialog.h28
-rw-r--r--noncore/apps/opie-console/profilemanager.cpp15
-rw-r--r--noncore/apps/opie-console/profilemanager.h2
-rw-r--r--noncore/apps/opie-console/settings.ui23
7 files changed, 104 insertions, 5 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index 3c1c8ea..88d5823 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -1,156 +1,167 @@
#include <qaction.h>
#include <qmenubar.h>
#include <qlabel.h>
#include <qpopupmenu.h>
#include <qtoolbar.h>
+#include "configdialog.h"
#include "metafactory.h"
#include "profilemanager.h"
#include "mainwindow.h"
MainWindow::MainWindow() {
m_factory = new MetaFactory();
m_sessions.setAutoDelete( TRUE );
m_curSession = 0;
m_manager = new ProfileManager(m_factory);
+ m_manager->load();
initUI();
populateProfiles();
}
void MainWindow::initUI() {
setToolBarsMovable( FALSE );
m_tool = new QToolBar( this );
m_tool->setHorizontalStretchable( TRUE );
m_bar = new QMenuBar( m_tool );
m_console = new QPopupMenu( this );
m_sessionsPop= new QPopupMenu( this );
m_settings = new QPopupMenu( this );
/*
* new Action for new sessions
*/
QAction* a = new QAction();
a->setText( tr("New Connection") );
a->addTo( m_console );
connect(a, SIGNAL(activated() ),
this, SLOT(slotNew() ) );
/*
* 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() ) );
/*
* terminate action
*/
m_terminate = new QAction();
m_terminate->setText( tr("Terminate") );
m_terminate->addTo( m_console );
connect(m_disconnect, SIGNAL(activated() ),
this, SLOT(slotTerminate() ) );
a = new QAction();
a->setText( tr("Close Window") );
a->addTo( m_console );
connect(a, SIGNAL(activated() ),
this, SLOT(slotClose() ) );
/*
* the settings action
*/
m_setProfiles = new QAction();
m_setProfiles->setText( tr("Configure Profiles") );
m_setProfiles->addTo( m_settings );
connect( m_setProfiles, SIGNAL(activated() ),
this, SLOT(slotConfigure() ) );
/* 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 settings menu */
m_bar->insertItem( tr("Settings"), m_settings );
/*
* connect to the menu activation
*/
connect( m_sessionsPop, SIGNAL(activated(int) ),
this, SLOT(slotProfile(int) ) );
}
ProfileManager* MainWindow::manager() {
return m_manager;
}
void MainWindow::populateProfiles() {
- manager()->load();
+ 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;
}
MetaFactory* MainWindow::factory() {
return m_factory;
}
Session* MainWindow::currentSession() {
return m_curSession;
}
QList<Session> MainWindow::sessions() {
return m_sessions;
}
void MainWindow::slotNew() {
qWarning("New Connection");
}
void MainWindow::slotConnect() {
if ( currentSession() )
currentSession()->layer()->open();
}
void MainWindow::slotDisconnect() {
if ( currentSession() )
currentSession()->layer()->close();
}
void MainWindow::slotTerminate() {
if ( currentSession() )
currentSession()->layer()->close();
delete m_curSession;
m_curSession = 0l;
/* FIXME move to the next session */
}
void MainWindow::slotConfigure() {
qWarning("configure");
+ ConfigDialog conf( manager()->all() );
+ conf.showMaximized();
+
+ int ret = conf.exec();
+
+ if ( QDialog::Accepted == ret ) {
+ manager()->setProfiles( conf.list() );
+ populateProfiles();
+ }
}
void MainWindow::slotClose() {
}
void MainWindow::slotProfile(int) {
}
diff --git a/noncore/apps/opie-console/opie-console.pro b/noncore/apps/opie-console/opie-console.pro
index e045a48..9e44ab0 100644
--- a/noncore/apps/opie-console/opie-console.pro
+++ b/noncore/apps/opie-console/opie-console.pro
@@ -1,28 +1,30 @@
TEMPLATE = app
CONFIG = qt warn_on release
DESTDIR = $(OPIEDIR)/bin
HEADERS = io_layer.h io_serial.h \
file_layer.h \
metafactory.h \
session.h \
mainwindow.h \
profile.h \
profileconfig.h \
profilemanager.h \
configwidget.h \
- tabwidget.h
+ tabwidget.h \
+ configdialog.h
SOURCES = io_layer.cpp io_serial.cpp \
file_layer.cpp main.cpp \
metafactory.cpp \
session.cpp \
mainwindow.cpp \
profile.cpp \
profileconfig.cpp \
profilemanager.cpp \
- tabwidget.cpp
-INTERFACES =
+ tabwidget.cpp \
+ configdialog.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/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp
new file mode 100644
index 0000000..a4246e1
--- a/dev/null
+++ b/noncore/apps/opie-console/profileeditordialog.cpp
@@ -0,0 +1,20 @@
+
+#include "profileeditordialog.h"
+
+
+ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact,
+ const Profile& prof )
+ : QDialog(0, 0, TRUE), m_fact( fact ), m_prof( prof )
+{
+ initUI();
+ /* now set the widgets */
+}
+ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact )
+ : QDialog(0, 0, TRUE), m_fact( fact )
+{
+
+}
+ProfileEditorDialog::~ProfileEditorDialog() {
+
+}
+
diff --git a/noncore/apps/opie-console/profileeditordialog.h b/noncore/apps/opie-console/profileeditordialog.h
new file mode 100644
index 0000000..5ccc691
--- a/dev/null
+++ b/noncore/apps/opie-console/profileeditordialog.h
@@ -0,0 +1,28 @@
+#ifndef PROFILE_EDITOR_DIALOG
+#define PROFILE_EDITOR_DIALOG
+
+#include <qdialog.h>
+
+#include "profile.h"
+
+class MetaFactory;
+class EditBase;
+class QTabWidget;
+class QHBoxLayout;
+class ProfileEditorDialog : public QDialog {
+ Q_OBJECT
+public:
+ ProfileEditorDialog(MetaFactory* fact,
+ const Profile& prof );
+ ProfileEditorDialog(MetaFactory* fact );
+ Profile profile()const;
+private:
+ void initUI();
+ MetaFactory* m_fact;
+ EditBase* m_base;
+ QTabWidget* m_tab;
+ QHBoxLayout* m_lay;
+ Profile m_prof;
+};
+
+#endif
diff --git a/noncore/apps/opie-console/profilemanager.cpp b/noncore/apps/opie-console/profilemanager.cpp
index 24256a5..72a5117 100644
--- a/noncore/apps/opie-console/profilemanager.cpp
+++ b/noncore/apps/opie-console/profilemanager.cpp
@@ -31,50 +31,63 @@ void ProfileManager::load() {
prof.setIOLayer( conf.readEntry("iolayer") );
prof.setBackground( conf.readNumEntry("back") );
prof.setForeground( conf.readNumEntry("fore") );
prof.setTerminal( conf.readNumEntry("terminal") );
prof.setConf( conf.items( (*it) ) );
/* now add it */
m_list.append( prof );
}
}
void ProfileManager::clear() {
m_list.clear();
}
Profile::ValueList ProfileManager::all()const {
return m_list;
}
Session* ProfileManager::fromProfile( const Profile& prof) {
Session* session = new Session();
session->setName( prof.name() );
session->setIOLayer(m_fact->newIOLayer(prof.ioLayerName(),
prof) );
/*
* FIXME
* load emulation
* load widget?
* set colors + fonts
*/
return session;
}
void ProfileManager::save( ) {
ProfileConfig conf("opie-console-profiles");
conf.clearAll();
Profile::ValueList::Iterator it;
for (it = m_list.begin(); it != m_list.end(); ++it ) {
conf.setGroup( (*it).name() );
conf.writeEntry( "name", (*it).name() );
conf.writeEntry( "ioplayer", (*it).ioLayerName() );
conf.writeEntry( "back", (*it).background() );
conf.writeEntry( "fore", (*it).foreground() );
conf.writeEntry( "terminal", (*it).terminal() );
/* now the config stuff */
QMap<QString, QString> map = (*it).conf();
QMap<QString, QString>::Iterator it;
for ( it = map.begin(); it != map.end(); ++it ) {
conf.writeEntry( it.key(), it.data() );
}
}
- // FIXME save
+}
+void ProfileManager::setProfiles( const Profile::ValueList& list ) {
+ m_list = list;
+};
+Profile ProfileManager::profile( const QString& name )const {
+ Profile prof;
+ Profile::ValueList::ConstIterator it;
+ for ( it = m_list.begin(); it != m_list.end(); ++it ) {
+ if ( name == (*it).name() ) {
+ prof = (*it);
+ break;
+ }
+ }
+ return prof;
}
diff --git a/noncore/apps/opie-console/profilemanager.h b/noncore/apps/opie-console/profilemanager.h
index d4d0fd0..1387247 100644
--- a/noncore/apps/opie-console/profilemanager.h
+++ b/noncore/apps/opie-console/profilemanager.h
@@ -1,30 +1,32 @@
#ifndef OPIE_PROFILE_MANAGER_H
#define OPIE_PROFILE_MANAGER_H
#include <qlist.h>
#include "session.h"
#include "profile.h"
class MetaFactory;
class ConfigWidget;
class ProfileManager {
public:
ProfileManager(MetaFactory*);
~ProfileManager();
void load();
Profile::ValueList all()const;
void clear();
/**
* also replaces the item
*/
void add( const Profile& prof );
void remove( const Profile& prof );
+ Profile profile(const QString& name )const;
Session* fromProfile( const Profile& );
+ void setProfiles( const Profile::ValueList& );
void save();
private:
MetaFactory* m_fact;
Profile::ValueList m_list;
};
#endif
diff --git a/noncore/apps/opie-console/settings.ui b/noncore/apps/opie-console/settings.ui
new file mode 100644
index 0000000..6944dd0
--- a/dev/null
+++ b/noncore/apps/opie-console/settings.ui
@@ -0,0 +1,23 @@
+<!DOCTYPE UI><UI>
+<class>Settings</class>
+<widget>
+ <class>QDialog</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Settings</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>596</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>caption</name>
+ <string>Settings</string>
+ </property>
+</widget>
+</UI>