summaryrefslogtreecommitdiff
authorjosef <josef>2002-10-07 10:02:58 (UTC)
committer josef <josef>2002-10-07 10:02:58 (UTC)
commit46171dcd991e8c3bfff8e662b3913f454714560a (patch) (side-by-side diff)
treec596e53f6b308ffef0f2da1ccf538c79693bd5e5
parentd4c3a54affe5497b84e48f52d411391818790cba (diff)
downloadopie-46171dcd991e8c3bfff8e662b3913f454714560a.zip
opie-46171dcd991e8c3bfff8e662b3913f454714560a.tar.gz
opie-46171dcd991e8c3bfff8e662b3913f454714560a.tar.bz2
- load profiles correctly when editing them
- save their general values after editing them - fix compilation of widget_layer (temporary workaround?)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/configdialog.cpp4
-rw-r--r--noncore/apps/opie-console/opie-console.pro6
-rw-r--r--noncore/apps/opie-console/profileeditordialog.cpp12
-rw-r--r--noncore/apps/opie-console/widget_layer.h4
4 files changed, 19 insertions, 7 deletions
diff --git a/noncore/apps/opie-console/configdialog.cpp b/noncore/apps/opie-console/configdialog.cpp
index 23e94b1..655d649 100644
--- a/noncore/apps/opie-console/configdialog.cpp
+++ b/noncore/apps/opie-console/configdialog.cpp
@@ -37,66 +37,68 @@ ConfigDialog::ConfigDialog( const Profile::ValueList& lis, QWidget* parent )
Profile::ValueList::ConstIterator it;
for (it = lis.begin(); it != lis.end(); ++it ) {
new ConfigListItem( lstView, (*it) );
}
}
}
ConfigDialog::~ConfigDialog() {
}
Profile::ValueList ConfigDialog::list()const {
/* iterate over the list */
Profile::ValueList lst;
QListViewItemIterator it(lstView);
for ( ; it.current(); ++it ) {
ConfigListItem* item = (ConfigListItem*)it.current();
lst.append( item->profile() );
}
return lst;
}
/* our slots */
void ConfigDialog::slotRemove() {
ConfigListItem* item = (ConfigListItem*)lstView->currentItem();
if (!item )
return;
lstView->takeItem( item );
delete item;
}
void ConfigDialog::slotEdit() {
Profile p;
+ if(!lstView->currentItem()) return;
+
// Load profile
- // p = currentItem()->profile();
+ p = ((ConfigListItem*)lstView->currentItem())->profile();
ProfileEditorDialog dlg(new MetaFactory(), p);
dlg.setCaption("Edit Connection Profile");
dlg.showMaximized();
int ret = dlg.exec();
if(ret == QDialog::Accepted)
{
// if(listView->current()) delete lstView->current(); ...
// use dlg.terminal()!
new ConfigListItem(lstView, Profile(dlg.prof_name(), dlg.prof_type(), Profile::White, Profile::Black, Profile::VT102));
}
}
void ConfigDialog::slotAdd() {
ProfileEditorDialog dlg(new MetaFactory());
dlg.setCaption("New Connection");
dlg.showMaximized();
int ret = dlg.exec();
if(ret == QDialog::Accepted)
{
// TODO: Move into general profile save part
// assignments
//QString type = dlg.term_type();
//if(type == "VT102") profile = Profile::VT102;
// get profile from editor
Profile p = dlg.profile();
diff --git a/noncore/apps/opie-console/opie-console.pro b/noncore/apps/opie-console/opie-console.pro
index 6d70dfd..768e453 100644
--- a/noncore/apps/opie-console/opie-console.pro
+++ b/noncore/apps/opie-console/opie-console.pro
@@ -1,53 +1,55 @@
TEMPLATE = app
#CONFIG = qt warn_on release
CONFIG = qt debug
DESTDIR = $(OPIEDIR)/bin
HEADERS = io_layer.h io_serial.h \
file_layer.h sz_transfer.h \
metafactory.h \
session.h \
mainwindow.h \
profile.h \
profileconfig.h \
profilemanager.h \
configwidget.h \
tabwidget.h \
configdialog.h \
profileeditordialog.h \
profileeditorplugins.h \
emulation_layer.h \
widget.h \
vt102emulation.h \
common.h \
history.h \
screen.h \
keytrans.h \
- widget_layer.h
+ widget_layer.h \
+ transferdialog.h
SOURCES = io_layer.cpp io_serial.cpp \
file_layer.cpp sz_transfer.cpp \
main.cpp \
metafactory.cpp \
session.cpp \
mainwindow.cpp \
profile.cpp \
profileconfig.cpp \
profilemanager.cpp \
tabwidget.cpp \
configdialog.cpp \
profileeditordialog.cpp \
profileeditorplugins.cpp \
emulation_layer.cpp \
widget.cpp \
vt102emulation.cpp \
history.cpp \
screen.cpp \
keytrans.cpp \
- widget_layer.cpp
+ widget_layer.cpp \
+ transferdialog.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
index fbe0f23..fc95e56 100644
--- a/noncore/apps/opie-console/profileeditordialog.cpp
+++ b/noncore/apps/opie-console/profileeditordialog.cpp
@@ -1,64 +1,64 @@
#include "profileeditordialog.h"
#include "qlayout.h"
#include "qlineedit.h"
#include "qlabel.h"
#include "qradiobutton.h"
#include "qcombobox.h"
#include "qcheckbox.h"
#include "qmessagebox.h"
#include "qbuttongroup.h"
#include "qstringlist.h"
#include "profileeditorplugins.h"
#include "metafactory.h"
ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact,
const Profile& prof )
: QTabDialog(0, 0, TRUE), m_fact( fact ), m_prof( prof )
{
initUI();
// Apply current profile
// plugin_plugin->load(profile);
// ... (reset profile name line edit etc.)
}
ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact )
: QTabDialog(0, 0, TRUE), m_fact( fact )
{
// Default profile
- m_prof = Profile("serial", QString::null, Profile::Black, Profile::White, Profile::VT102);
+ m_prof = Profile(QString::null, "serial", Profile::Black, Profile::White, Profile::VT102);
initUI();
// Apply current profile
// plugin_plugin->load(profile);
}
Profile ProfileEditorDialog::profile() const
{
return m_prof;
}
void ProfileEditorDialog::initUI()
{
QWidget *tabterm, *tabconn, *tabprof;
tabprof = new QWidget(this);
tabterm = new QWidget(this);
tabconn = new QWidget(this);
// for the time being: fake factory
m_fact->addConfigWidgetFactory("serial", QObject::tr("Serial cable"), factory_serial);
m_fact->addConfigWidgetFactory("irda", QObject::tr("IrDA port"), factory_irda);
m_fact->addConfigWidgetFactory("modem", QObject::tr("Serial via modem"), factory_modem);
// profile tab
QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof);
name_line = new QLineEdit(tabprof);
@@ -165,101 +165,109 @@ void ProfileEditorDialog::initUI()
QHBoxLayout *hbox2 = new QHBoxLayout(vbox, 2);
hbox2->add(parity_odd);
hbox2->add(parity_even);
//vbox->add(group_parity);
QVBoxLayout *vbox2 = new QVBoxLayout(tabterm, 2);
vbox2->add(terminal);
vbox2->add(terminal_box);
vbox2->add(size);
QHBoxLayout *hbox3 = new QHBoxLayout(vbox2, 2);
hbox3->add(size_small);
hbox3->add(size_medium);
hbox3->add(size_large);
//vbox2->add(group_size);
vbox2->add(colour);
vbox2->add(colour_box);
vbox2->add(conversions);
QHBoxLayout *hbox5 = new QHBoxLayout(vbox2, 2);
hbox5->add(conv_inbound);
hbox5->add(conv_outbound);
vbox2->add(options);
QHBoxLayout *hbox4 = new QHBoxLayout(vbox2, 2);
hbox4->add(option_wrap);
hbox4->add(option_echo);
addTab(tabprof, QObject::tr("Profile"));
addTab(tabconn, QObject::tr("Connection"));
addTab(tabterm, QObject::tr("Terminal"));
setOkButton(QObject::tr("OK"));
setCancelButton(QObject::tr("Cancel"));
- connect(this, SIGNAL(cancelButtonPressed()), SLOT(slotCancel()));
+ // load profile values
+
+ name_line->setText(m_prof.name());
+
+ // signals
+ connect(this, SIGNAL(cancelButtonPressed()), SLOT(slotCancel()));
connect(device_box, SIGNAL(activated(int)), SLOT(slotDevice(int)));
}
ProfileEditorDialog::~ProfileEditorDialog() {
}
void ProfileEditorDialog::slotDevice(int id)
{
delete plugin_plugin;
plugin_plugin = m_fact->newConfigPlugin(prof_type(), plugin_base, m_prof);
plugin_layout->add(plugin_plugin->widget());
// Reload profile associated to device, including e.g. conn_device()
// m_prof = plugin_plugin->profile()
// or, keeping the profile name: m_prof->reload(plugin_plugin->profile())
//plugin_plugin->show();
plugin_plugin->widget()->show();
}
void ProfileEditorDialog::accept()
{
if(prof_name().isEmpty())
{
QMessageBox::information(this,
QObject::tr("Invalid profile"),
QObject::tr("Please enter a profile name."));
return;
}
// Save profile and plugin profile
if(plugin_plugin) plugin_plugin->save();
+ // Save general values
+ m_prof.setName(prof_name());
+
QDialog::accept();
}
void ProfileEditorDialog::slotCancel()
{
reject();
}
QString ProfileEditorDialog::prof_name()
{
return name_line->text();
}
QString ProfileEditorDialog::prof_type()
{
QStringList w = m_fact->configWidgets();
for(QStringList::Iterator it = w.begin(); it != w.end(); it++)
if(device_box->currentText() == m_fact->name((*it))) return (*it);
return QString::null;
}
QString ProfileEditorDialog::conn_device()
{
//return frame_device_line->text();
return "/dev/ttyS0";
}
QString ProfileEditorDialog::term_type()
{
return terminal_box->currentText();
}
diff --git a/noncore/apps/opie-console/widget_layer.h b/noncore/apps/opie-console/widget_layer.h
index 3cdd6aa..07ec12a 100644
--- a/noncore/apps/opie-console/widget_layer.h
+++ b/noncore/apps/opie-console/widget_layer.h
@@ -14,65 +14,65 @@
#define WIDGET_LAYER_H
// qt includes
#include <qapplication.h>
#include <qtimer.h>
#include <qkeycode.h>
#include <qclipboard.h>
// opie-console includes
#include "session.h"
#include "common.h"
class WidgetLayer : public QObject
{ Q_OBJECT
public:
/**
* constructor
*/
WidgetLayer( QObject *parent=0, const char *name=0 );
/**
* destructor
*/
virtual ~WidgetLayer();
public:
/**
* sets the image
*/
- virtual void setImage( const Character* const newimg, int lines, int colums );
+ virtual void setImage( const Character* const newimg, int lines, int colums ) = 0;
/**
* annoy the user
*/
void bell();
/**
* return the lines count
*/
int lines() { return m_lines; }
/**
* return the columns count
*/
int columns() { return m_columns; }
/**
* insert current selection (currently this is only the clipboard)
*/
void insertSelection();
/**
* insert text
*/
void insertText( QString text );
/**
* set selection (clipboard) to text
*/
void setSelection( const QString &text );
/**
* paste content of clipboard
@@ -114,65 +114,65 @@ signals:
* selection begin
*/
void selectionBegin( const int x, const int y );
/**
* selection extended
* (from begin (s.a.) to x, y)
*/
void selectionExtended( const int x, const int y );
/**
* selection end
* bool: preserve line breaks in selection
*/
void selectionEnd( const bool lineBreakPreserve );
// protected methods
protected:
// image operations
/**
* changes image, to suit new size
* TODO: find meaningful name!
*/
void propagateSize();
/**
*
*/
- virtual void calcGeometry();
+ virtual void calcGeometry() = 0;
/**
* makes an empty image
*/
void makeImage();
/**
* clears the image
*/
void clearImage();
protected slots:
/**
* clear selection
*/
void onClearSelection();
// protected vars
protected:
/**
* current Session
*/
Session *m_session;
/**
* current character image
*/
QArray<Character> m_image;