summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-10-07 18:05:43 (UTC)
committer harlekin <harlekin>2002-10-07 18:05:43 (UTC)
commitd55aa591770675008da9e3290617e463a77e4c98 (patch) (side-by-side diff)
tree93d779cc85298545673f4d5f2ea0fcc7d4d301b7
parentd25a925e70982b86539b98362ab2cd75c7883110 (diff)
downloadopie-d55aa591770675008da9e3290617e463a77e4c98.zip
opie-d55aa591770675008da9e3290617e463a77e4c98.tar.gz
opie-d55aa591770675008da9e3290617e463a77e4c98.tar.bz2
reworked config dialog gui a bit and adapted it to opie
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp10
-rw-r--r--noncore/apps/opie-console/profileeditordialog.cpp36
-rw-r--r--noncore/apps/opie-console/profileeditordialog.h25
-rw-r--r--noncore/apps/opie-console/profileeditorplugins.cpp139
-rw-r--r--noncore/apps/opie-console/widget_layer.h22
5 files changed, 110 insertions, 122 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index dce08ca..31f1138 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -1,42 +1,42 @@
#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"
#include "tabwidget.h"
MainWindow::MainWindow() {
m_factory = new MetaFactory();
m_sessions.setAutoDelete( TRUE );
m_curSession = 0;
- m_manager = new ProfileManager(m_factory);
+ 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() ) );
@@ -75,50 +75,50 @@ void MainWindow::initUI() {
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) ) );
+ connect( m_sessionsPop, SIGNAL(activated( int ) ),
+ this, SLOT(slotProfile( int ) ) );
m_consoleWindow = new TabWidget( this, "blah");
setCentralWidget( m_consoleWindow );
}
ProfileManager* MainWindow::manager() {
return m_manager;
}
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;
}
MetaFactory* MainWindow::factory() {
return m_factory;
@@ -147,30 +147,30 @@ void MainWindow::slotDisconnect() {
}
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) {
+void MainWindow::slotProfile( int ) {
+
}
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp
index 8e63429..be23eff 100644
--- a/noncore/apps/opie-console/profileeditordialog.cpp
+++ b/noncore/apps/opie-console/profileeditordialog.cpp
@@ -1,75 +1,81 @@
+#include <opie/otabwidget.h>
#include "profileeditordialog.h"
#include "qlayout.h"
#include "qlineedit.h"
#include "qlabel.h"
#include "qmessagebox.h"
#include "qstringlist.h"
#include "qcombobox.h"
#include "profileeditorplugins.h"
#include "metafactory.h"
ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact,
const Profile& prof )
- : QTabDialog(0, 0, TRUE), m_fact( fact ), m_prof( prof )
+ : QDialog(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 )
+ : QDialog(0, 0, TRUE), m_fact( fact )
{
// Default profile
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;
+
+ QVBoxLayout *mainLayout = new QVBoxLayout( this );
+ OTabWidget *tabWidget = new OTabWidget( this );
+ mainLayout->add(tabWidget);
+
+ 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);
// connection tab, fixed part
QLabel *device = new QLabel(QObject::tr("Device"), tabconn);
device_box = new QComboBox(tabconn);
QStringList w = m_fact->configWidgets();
for(QStringList::Iterator it = w.begin(); it != w.end(); it++)
device_box->insertItem(m_fact->name((*it)));
// connection tab, factory part
plugin_base = new QWidget(tabconn);
plugin_layout = new QHBoxLayout(plugin_base, 0);
@@ -77,112 +83,106 @@ void ProfileEditorDialog::initUI()
plugin_layout->add(plugin_plugin->widget());
// connection tab, general part
QWidget *conn_widget = plugin_plugin->connection_widget();
conn_widget->reparent(tabconn, 0, QPoint(), true);
// terminal tab
QWidget *term_widget = plugin_plugin->terminal_widget();
term_widget->reparent(tabterm, 0, QPoint(), true);
// layouting
QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2);
vbox3->add(name);
vbox3->add(name_line);
vbox3->addStretch(1);
QVBoxLayout *vbox = new QVBoxLayout(tabconn, 2);
vbox->add(device);
vbox->add(device_box);
vbox->add(plugin_base);
vbox->add(conn_widget);
+ vbox->setStretchFactor(device, 1);
+ vbox->setStretchFactor(device_box, 1);
+ vbox->setStretchFactor(plugin_base, 1);
+ vbox->setStretchFactor(conn_widget, 7);
QVBoxLayout *vbox2 = new QVBoxLayout(tabterm, 2);
vbox2->add(term_widget);
- addTab(tabprof, QObject::tr("Profile"));
- addTab(tabconn, QObject::tr("Connection"));
- addTab(tabterm, QObject::tr("Terminal"));
-
- setOkButton(QObject::tr("OK"));
- setCancelButton(QObject::tr("Cancel"));
+ tabWidget->addTab(tabprof, "", QObject::tr("Profile"));
+ tabWidget->addTab(tabconn, "", QObject::tr("Connection"));
+ tabWidget->addTab(tabterm, "", QObject::tr("Terminal"));
// load profile values
-
name_line->setText(m_prof.name());
for(int i = 0; i < device_box->count(); i++)
{
device_box->setCurrentItem(i);
if(prof_type() == m_prof.ioLayerName())
{
slotDevice(i);
break;
}
}
// signals
-
- connect(this, SIGNAL(cancelButtonPressed()), SLOT(slotCancel()));
- connect(device_box, SIGNAL(activated(int)), SLOT(slotDevice(int)));
+ 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());
m_prof.setIOLayer(prof_type());
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;
}
diff --git a/noncore/apps/opie-console/profileeditordialog.h b/noncore/apps/opie-console/profileeditordialog.h
index 18e2ec0..8e830f1 100644
--- a/noncore/apps/opie-console/profileeditordialog.h
+++ b/noncore/apps/opie-console/profileeditordialog.h
@@ -1,53 +1,50 @@
#ifndef PROFILE_EDITOR_DIALOG
#define PROFILE_EDITOR_DIALOG
-#include <qtabdialog.h>
+#include <qdialog.h>
#include "profile.h"
class MetaFactory;
class EditBase;
class QTabWidget;
class QHBoxLayout;
class QLineEdit;
class QComboBox;
class QLabel;
class ProfileEditorPlugin;
-class ProfileEditorDialog : public QTabDialog {
+class ProfileEditorDialog : public QDialog {
Q_OBJECT
public:
ProfileEditorDialog(MetaFactory* fact,
const Profile& prof );
ProfileEditorDialog(MetaFactory* fact );
~ProfileEditorDialog();
Profile profile()const;
- QString prof_name();
- QString prof_type();
+ QString prof_name();
+ QString prof_type();
public slots:
- void accept();
- //void slotOk();
- void slotCancel();
-
- void slotDevice(int id);
+ void accept();
+ void slotDevice(int id);
private:
void initUI();
MetaFactory* m_fact;
EditBase* m_base;
QTabWidget* m_tab;
QHBoxLayout* m_lay;
Profile m_prof;
- QLineEdit *name_line;
- QComboBox *device_box;
+ QLineEdit *name_line;
+ QComboBox *device_box;
- QWidget *plugin_base;
- ProfileEditorPlugin *plugin_plugin;
- QHBoxLayout *plugin_layout;
+ QWidget *plugin_base;
+ ProfileEditorPlugin *plugin_plugin;
+ QHBoxLayout *plugin_layout;
};
#endif
diff --git a/noncore/apps/opie-console/profileeditorplugins.cpp b/noncore/apps/opie-console/profileeditorplugins.cpp
index b63fa1c..c11c854 100644
--- a/noncore/apps/opie-console/profileeditorplugins.cpp
+++ b/noncore/apps/opie-console/profileeditorplugins.cpp
@@ -1,186 +1,179 @@
#include "profileeditorplugins.h"
#include "profile.h"
#include "qframe.h"
#include "qlabel.h"
#include "qlineedit.h"
#include "qlayout.h"
#include "qcombobox.h"
#include "qradiobutton.h"
#include "qcheckbox.h"
#include "qbuttongroup.h"
+#include "qhgroupbox.h"
+#include "qvbox.h"
#include "io_serial.h"
// Base class
ProfileEditorPlugin::ProfileEditorPlugin(QWidget *parent, Profile *p)
: QObject()
{
m_parent = parent;
m_profile = p;
m_widget = NULL;
}
ProfileEditorPlugin::~ProfileEditorPlugin()
{
if(m_widget) delete m_widget;
}
QWidget *ProfileEditorPlugin::connection_widget()
{
QWidget *root;
QVBoxLayout *lroot;
root = new QWidget();
// Build GUI
+ QLabel *speedlabel = new QLabel(QObject::tr("Speed"), root);
QComboBox *speed_box = new QComboBox(root);
speed_box->insertItem("115200 baud", id_baud_115200);
speed_box->insertItem("57600 baud", id_baud_57600);
speed_box->insertItem("38400 baud", id_baud_38400);
speed_box->insertItem("19200 baud", id_baud_19200);
speed_box->insertItem("9600 baud", id_baud_9600);
- QLabel *speedlabel = new QLabel(QObject::tr("Speed"), root);
- QLabel *flow = new QLabel(QObject::tr("Flow control"), root);
- QLabel *parity = new QLabel(QObject::tr("Parity"), root);
-
- QButtonGroup *group_flow = new QButtonGroup(root);
- group_flow->hide();
- QRadioButton *flow_hw = new QRadioButton(QObject::tr("Hardware"), root);
- QRadioButton *flow_sw = new QRadioButton(QObject::tr("Software"), root);
- group_flow->insert(flow_hw, id_flow_hw);
- group_flow->insert(flow_sw, id_flow_sw);
-
- QButtonGroup *group_parity = new QButtonGroup(root);
- group_parity->hide();
- QRadioButton *parity_odd = new QRadioButton(QObject::tr("Odd"), root);
- QRadioButton *parity_even = new QRadioButton(QObject::tr("Even"), root);
- group_parity->insert(parity_odd, id_parity_odd);
- group_parity->insert(parity_even, id_parity_even);
+ QButtonGroup *group_flow = new QButtonGroup(QObject::tr("Flow control"), root);
- // Build Layout
+ QRadioButton *flow_hw = new QRadioButton(QObject::tr("Hardware"), group_flow);
+ QRadioButton *flow_sw = new QRadioButton(QObject::tr("Software"), group_flow);
+
+ QButtonGroup *group_parity = new QButtonGroup(QObject::tr("Parity"), root);
+ QRadioButton *parity_odd = new QRadioButton(QObject::tr("Odd"), group_parity);
+ QRadioButton *parity_even = new QRadioButton(QObject::tr("Even"), group_parity);
+ // Build Layout
lroot = new QVBoxLayout(root);
lroot->add(speedlabel);
lroot->add(speed_box);
- lroot->add(flow);
- QHBoxLayout *hbox = new QHBoxLayout(lroot, 2);
+ lroot->setStretchFactor(speedlabel, 1);
+ lroot->setStretchFactor(speed_box, 1);
+
+ QHBoxLayout *hbox = new QHBoxLayout(group_flow, 2);
hbox->add(flow_hw);
hbox->add(flow_sw);
- lroot->add(parity);
- QHBoxLayout *hbox2 = new QHBoxLayout(lroot, 2);
- hbox2->add(parity_odd);
- hbox2->add(parity_even);
-
+ lroot->add(group_flow);
+ lroot->setStretchFactor(group_flow, 2);
+
+ QHBoxLayout *hboxPar = new QHBoxLayout( group_parity, 2);
+ hboxPar->add(parity_odd);
+ hboxPar->add(parity_even);
+ lroot->add(group_parity);
+ lroot->setStretchFactor(group_parity, 2);
// Apply profile settings
int rad_flow = m_profile->readNumEntry("Flow");
int rad_parity = m_profile->readNumEntry("Parity");
int speed = m_profile->readNumEntry("Speed");
if(rad_flow == IOSerial::FlowHW) flow_hw->setChecked(true);
else flow_sw->setChecked(true);
if(rad_parity == IOSerial::ParityEven) parity_even->setChecked(true);
else parity_odd->setChecked(true);
if(speed == 115200) speed_box->setCurrentItem(id_baud_115200);
if(speed == 57600) speed_box->setCurrentItem(id_baud_57600);
if(speed == 38400) speed_box->setCurrentItem(id_baud_38400);
if(speed == 19200) speed_box->setCurrentItem(id_baud_19200);
if(speed == 9600) speed_box->setCurrentItem(id_baud_9600);
// Signals
connect(group_flow, SIGNAL(clicked(int)), SLOT(slotConnFlow(int)));
connect(group_parity, SIGNAL(clicked(int)), SLOT(slotConnParity(int)));
connect(speed_box, SIGNAL(activated(int)), SLOT(slotConnSpeed(int)));
return root;
}
QWidget *ProfileEditorPlugin::terminal_widget()
{
QWidget *root;
QVBoxLayout *lroot;
root = new QWidget();
// Build GUI
+
+ QLabel *terminal = new QLabel(QObject::tr("Terminal type"), root);
+
QComboBox *terminal_box = new QComboBox(root);
terminal_box->insertItem("VT 100", id_term_vt100);
terminal_box->insertItem("VT 220", id_term_vt220);
terminal_box->insertItem("ANSI", id_term_ansi);
- QLabel *terminal = new QLabel(QObject::tr("Terminal type"), root);
- QLabel *colourlabel = new QLabel(QObject::tr("Colour scheme"), root);
- QLabel *sizelabel = new QLabel(QObject::tr("Font size"), root);
- QLabel *options = new QLabel(QObject::tr("Options"), root);
- QLabel *conversions = new QLabel(QObject::tr("Line-break conversions"), root);
-
+ QLabel *colourlabel = new QLabel(QObject::tr("Colour scheme"), root);
QComboBox *colour_box = new QComboBox(root);
colour_box->insertItem(QObject::tr("black on white"), id_term_black);
colour_box->insertItem(QObject::tr("white on black"), id_term_white);
- QButtonGroup *group_size = new QButtonGroup(root);
- group_size->hide();
- QRadioButton *size_small = new QRadioButton(QObject::tr("small"), root);
- QRadioButton *size_medium = new QRadioButton(QObject::tr("medium"), root);
- QRadioButton *size_large = new QRadioButton(QObject::tr("large"), root);
- group_size->insert(size_small);
- group_size->insert(size_medium);
- group_size->insert(size_large);
+ QButtonGroup *group_size = new QButtonGroup( QObject::tr("Font size"), root );
+ QRadioButton *size_small = new QRadioButton(QObject::tr("small"), group_size );
+ QRadioButton *size_medium = new QRadioButton(QObject::tr("medium"), group_size );
+ QRadioButton *size_large = new QRadioButton(QObject::tr("large"), group_size );
- QCheckBox *option_echo = new QCheckBox(QObject::tr("Local echo"), root);
- QCheckBox *option_wrap = new QCheckBox(QObject::tr("Line wrap"), root);
+ QHGroupBox *group_conv = new QHGroupBox( QObject::tr("Line-break conversions"), root );
+ QCheckBox *conv_inbound = new QCheckBox(QObject::tr("Inbound"), group_conv);
+ QCheckBox *conv_outbound = new QCheckBox(QObject::tr("Outbound"), group_conv);
- QCheckBox *conv_inbound = new QCheckBox(QObject::tr("Inbound"), root);
- QCheckBox *conv_outbound = new QCheckBox(QObject::tr("Outbound"), root);
+ QHGroupBox *group_options = new QHGroupBox( QObject::tr("Options"), root );
+ QCheckBox *option_echo = new QCheckBox(QObject::tr("Local echo"), group_options);
+ QCheckBox *option_wrap = new QCheckBox(QObject::tr("Line wrap"), group_options);
// Build Layout
-
lroot = new QVBoxLayout(root, 2);
- lroot->add(terminal);
- lroot->add(terminal_box);
- lroot->add(sizelabel);
- QHBoxLayout *hbox = new QHBoxLayout(lroot, 2);
+
+ QVBoxLayout *typeBox = new QVBoxLayout( lroot );
+ typeBox->add(terminal);
+ typeBox->add(terminal_box);
+
+ QHBoxLayout *hbox = new QHBoxLayout( group_size, 2);
hbox->add(size_small);
hbox->add(size_medium);
hbox->add(size_large);
- lroot->add(colourlabel);
- lroot->add(colour_box);
- lroot->add(conversions);
- QHBoxLayout *hbox2 = new QHBoxLayout(lroot, 2);
- hbox2->add(conv_inbound);
- hbox2->add(conv_outbound);
- lroot->add(options);
- QHBoxLayout *hbox3 = new QHBoxLayout(lroot, 2);
- hbox3->add(option_wrap);
- hbox3->add(option_echo);
+ lroot->add( group_size );
+
+ QVBoxLayout *colourBox = new QVBoxLayout( lroot );
+ colourBox->add(colourlabel);
+ colourBox->add(colour_box);
+
+ lroot->add(group_conv);
+ lroot->add(group_options);
// Apply profile settings
int term = m_profile->readNumEntry("Terminal");
int colour = m_profile->readNumEntry("Colour");
int fontsize = m_profile->readNumEntry("Font");
int opt_echo = m_profile->readNumEntry("Echo");
int opt_wrap = m_profile->readNumEntry("Wrap");
int opt_inbound = m_profile->readNumEntry("Inbound");
int opt_outbound = m_profile->readNumEntry("Outbound");
if(term == Profile::VT102) terminal_box->setCurrentItem(id_term_vt100);
if(colour == Profile::Black) colour_box->setCurrentItem(id_term_black);
if(colour == Profile::White) colour_box->setCurrentItem(id_term_white);
if(fontsize == Profile::Micro) size_small->setChecked(true);
if(fontsize == Profile::Small) size_medium->setChecked(true);
if(fontsize == Profile::Medium) size_large->setChecked(true);
if(opt_echo) option_echo->setChecked(true);
if(opt_wrap) option_wrap->setChecked(true);
if(opt_inbound) conv_inbound->setChecked(true);
if(opt_outbound) conv_outbound->setChecked(true);
@@ -297,161 +290,159 @@ void ProfileEditorPlugin::slotTermEcho(bool on)
{
m_profile->writeEntry("Echo", on ? 1 : 0);
}
void ProfileEditorPlugin::slotTermWrap(bool on)
{
m_profile->writeEntry("Wrap", on ? 1 : 0);
}
void ProfileEditorPlugin::slotTermInbound(bool on)
{
m_profile->writeEntry("Inbound", on ? 1 : 0);
}
void ProfileEditorPlugin::slotTermOutbound(bool on)
{
m_profile->writeEntry("Outbound", on ? 1 : 0);
}
// Inherited classes
class ProfileEditorPluginSerial : public ProfileEditorPlugin
{
public:
-
+
ProfileEditorPluginSerial(QWidget *parent, Profile *p)
: ProfileEditorPlugin(parent, p)
{
}
~ProfileEditorPluginSerial()
{
}
QWidget *widget()
{
if(!m_widget)
{
- QFrame *device_frame = new QFrame(m_parent);
- device_frame->setFrameStyle(QFrame::Panel | QFrame::Sunken);
- QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame);
+ QWidget *device_frame = new QWidget( m_parent );
+ QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame);
- device_line = new QLineEdit("/dev/ttyS0", device_frame);
+ device_line = new QLineEdit("/dev/ttyS0", device_frame);
- QVBoxLayout *vbox_frame = new QVBoxLayout(device_frame, 2);
- vbox_frame->add(frame_device);
- vbox_frame->add(device_line);
+ QVBoxLayout *vbox_frame = new QVBoxLayout(device_frame, 2);
+ vbox_frame->add(frame_device);
+ vbox_frame->add(device_line);
- m_widget = device_frame;
+ m_widget = device_frame;
- // Load special settings
+ // Load special settings
- QString dev = m_profile->readEntry("Device");
- if(!dev.isNull()) device_line->setText(dev);
+ QString dev = m_profile->readEntry("Device");
+ if(!dev.isNull()) device_line->setText(dev);
}
return m_widget;
}
void save()
{
// special settings
m_profile->writeEntry("Device", device_line->text());
}
private:
QLineEdit *device_line;
};
class ProfileEditorPluginIrda : public ProfileEditorPlugin
{
public:
ProfileEditorPluginIrda(QWidget *parent, Profile *p)
: ProfileEditorPlugin(parent, p)
{
}
~ProfileEditorPluginIrda()
{
}
QWidget *widget()
{
if(!m_widget)
{
- QFrame *device_frame = new QFrame(m_parent);
- device_frame->setFrameStyle(QFrame::Panel | QFrame::Sunken);
+ QWidget *device_frame = new QWidget(m_parent);
+
QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame);
device_line = new QLineEdit("/dev/ircomm0", device_frame);
QVBoxLayout *vbox_frame = new QVBoxLayout(device_frame, 2);
vbox_frame->add(frame_device);
vbox_frame->add(device_line);
m_widget = device_frame;
// Load special settings
QString dev = m_profile->readEntry("Device");
if(!dev.isNull()) device_line->setText(dev);
}
return m_widget;
}
void save()
{
// special settings
m_profile->writeEntry("Device", device_line->text());
}
private:
QLineEdit *device_line;
};
class ProfileEditorPluginModem : public ProfileEditorPlugin
{
public:
ProfileEditorPluginModem(QWidget *parent, Profile *p)
: ProfileEditorPlugin(parent, p)
{
}
~ProfileEditorPluginModem()
{
}
QWidget *widget()
{
if(!m_widget)
{
- QFrame *device_frame = new QFrame(m_parent);
- device_frame->setFrameStyle(QFrame::Panel | QFrame::Sunken);
+ QWidget *device_frame = new QWidget(m_parent);
QLabel *frame_device = new QLabel(QObject::tr("Device"), device_frame);
QLabel *frame_number = new QLabel(QObject::tr("Phone number"), device_frame);
device_line = new QLineEdit("/dev/ttyS0", device_frame);
number_line = new QLineEdit(device_frame);
QVBoxLayout *vbox_frame = new QVBoxLayout(device_frame, 2);
vbox_frame->add(frame_device);
vbox_frame->add(device_line);
vbox_frame->add(frame_number);
vbox_frame->add(number_line);
m_widget = device_frame;
// Load special settings
QString dev = m_profile->readEntry("Device");
QString num = m_profile->readEntry("Number");
if(!dev.isNull()) device_line->setText(dev);
number_line->setText(num);
}
return m_widget;
}
diff --git a/noncore/apps/opie-console/widget_layer.h b/noncore/apps/opie-console/widget_layer.h
index 99d248e..adf2038 100644
--- a/noncore/apps/opie-console/widget_layer.h
+++ b/noncore/apps/opie-console/widget_layer.h
@@ -1,92 +1,92 @@
/* -------------------------------------------------------------------------- */
/* */
/* [widget_layer.h] Widget Layer */
/* */
/* -------------------------------------------------------------------------- */
// proposal of a widget Layer in opie-console
//
// fellow devels:
-// just mail me (ibotty@web.de), what you additionally need from the main widget
+// just mail me (ibotty@web.de), what you additionally need from the main widget
// (or say in chat)
#ifndef WIDGET_LAYER_H
#define WIDGET_LAYER_H
// qt includes
#include <qapplication.h>
#include <qframe.h>
#include <qarray.h>
#include <qtimer.h>
#include <qkeycode.h>
#include <qclipboard.h>
// opie-console includes
#include "session.h"
#include "common.h"
/*
* given a pseudo location ( column, line ),
* returns the actual index, in the QArray<Character>
*/
#define loc(X,Y) ((Y)*m_columns+(X))
class WidgetLayer : public QFrame
{ Q_OBJECT
public:
/**
* constructor
*/
WidgetLayer( QWidget *parent=0, const char *name=0 );
/**
* destructor
*/
virtual ~WidgetLayer();
public:
/**
* sets the image
*/
- virtual void setImage( QArray<Character> const newimg, int lines, int colums );
+ virtual void setImage( QArray<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
*/
void pasteClipboard();
@@ -99,119 +99,119 @@ signals:
void keyPressed( QKeyEvent *e );
/**
* whenever Mouse selects something
* 0 left Button
* 3 Button released
* // numbering due to layout in old TEWidget
*/
void mousePressed( int button, int x, int y );
/**
* size of image changed
*/
void imageSizeChanged( int lines, int columns );
/**
* cursor in history changed
*/
void historyCursorChanged( int value );
/**
* selection should be cleared
*/
void selectionCleared();
-
+
/**
* 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();
/**
*determines count of lines and columns
*/
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
- *
+ *
* a Character at loc( column, line )
* has the actual index:
* ix = line * m_columns + column;
- *
+ *
* use loc( x, y ) macro to access.
*/
QArray<Character> m_image;
/**
* lines count
*/
int m_lines;
/**
* columns count
*/
int m_columns;
/**
* clipboard
*/
QClipboard* m_clipboard;
/**
- * whether widget is resizing
+ * whether widget is resizing
*/
bool m_resizing;
};
#endif // WIDGET_LAYER_H