summaryrefslogtreecommitdiff
authorzecke <zecke>2002-10-12 22:43:12 (UTC)
committer zecke <zecke>2002-10-12 22:43:12 (UTC)
commit9333a4005b30aaa723447a044c9fce5a1e580317 (patch) (side-by-side diff)
tree275ed089a65fd0f38918b812e0b1f68a1f78f980
parent97dc4008b5194ec0aa131fcf9b8753a61fe6fb74 (diff)
downloadopie-9333a4005b30aaa723447a044c9fce5a1e580317.zip
opie-9333a4005b30aaa723447a044c9fce5a1e580317.tar.gz
opie-9333a4005b30aaa723447a044c9fce5a1e580317.tar.bz2
Header file clean up
use <> for global header "" for local 1. system header 2. Qt header 3. QPE Header 4. Opie Header 5. local header 6. the class declaration..
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/configdialog.cpp7
-rw-r--r--noncore/apps/opie-console/file_layer.cpp3
-rw-r--r--noncore/apps/opie-console/profileeditorplugins.cpp25
-rw-r--r--noncore/apps/opie-console/profileeditorplugins.h3
4 files changed, 19 insertions, 19 deletions
diff --git a/noncore/apps/opie-console/configdialog.cpp b/noncore/apps/opie-console/configdialog.cpp
index 50512b6..8745305 100644
--- a/noncore/apps/opie-console/configdialog.cpp
+++ b/noncore/apps/opie-console/configdialog.cpp
@@ -1,114 +1,115 @@
+#include <qdialog.h>
+#include <qlistview.h>
+
#include "profile.h"
-#include "qlistview.h"
#include "configdialog.h"
-#include "profileeditordialog.h"
#include "metafactory.h"
-#include "qdialog.h"
+#include "profileeditordialog.h"
class ConfigListItem : public QListViewItem {
public:
ConfigListItem( QListView* item, const Profile& );
~ConfigListItem();
Profile profile()const;
private:
Profile m_prof;
};
ConfigListItem::ConfigListItem( QListView* item, const Profile& prof )
: QListViewItem( item ), m_prof( prof )
{
setText(0, prof.name() );
}
ConfigListItem::~ConfigListItem() {
}
Profile ConfigListItem::profile()const {
return m_prof;
}
/* Dialog */
ConfigDialog::ConfigDialog( const Profile::ValueList& lis, MetaFactory* fa,
QWidget* parent )
: ConfigureBase( parent, 0, TRUE ), m_fact( fa )
{
//init();
{
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 = ((ConfigListItem*)lstView->currentItem())->profile();
ProfileEditorDialog dlg(m_fact, p);
dlg.setCaption("Edit Connection Profile");
dlg.showMaximized();
int ret = dlg.exec();
if(ret == QDialog::Accepted)
{
if(lstView->currentItem()) delete lstView->currentItem();
// use dlg.terminal()!
Profile p = dlg.profile();
new ConfigListItem(lstView, p);
}
}
void ConfigDialog::slotAdd() {
qWarning("slotAdd");
ProfileEditorDialog dlg(m_fact);
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();
new ConfigListItem(lstView, p);
}
}
diff --git a/noncore/apps/opie-console/file_layer.cpp b/noncore/apps/opie-console/file_layer.cpp
index 79caa8a..43e9c8f 100644
--- a/noncore/apps/opie-console/file_layer.cpp
+++ b/noncore/apps/opie-console/file_layer.cpp
@@ -1,22 +1,23 @@
-#include "file_layer.h"
#include <qfile.h>
#include <opie/oprocess.h>
+#include "file_layer.h"
+
FileTransferLayer::FileTransferLayer(IOLayer *layer)
: QObject(), m_layer( layer )
{
}
FileTransferLayer::~FileTransferLayer() {
}
void FileTransferLayer::sendFile(const QFile& file) {
}
void FileTransferLayer::sendFile(const QString& file) {
}
IOLayer* FileTransferLayer::layer() {
return m_layer;
}
diff --git a/noncore/apps/opie-console/profileeditorplugins.cpp b/noncore/apps/opie-console/profileeditorplugins.cpp
index 937516c..45b2148 100644
--- a/noncore/apps/opie-console/profileeditorplugins.cpp
+++ b/noncore/apps/opie-console/profileeditorplugins.cpp
@@ -1,208 +1,207 @@
-#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 <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"
+#include "profile.h"
+#include "profileeditorplugins.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);
QButtonGroup *group_flow = new QButtonGroup(QObject::tr("Flow control"), root);
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->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(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 *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( 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 );
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);
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);
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( 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);
// Signals
connect(terminal_box, SIGNAL(activated(int)), SLOT(slotTermTerm(int)));
connect(colour_box, SIGNAL(activated(int)), SLOT(slotTermColour(int)));
connect(group_size, SIGNAL(clicked(int)), SLOT(slotTermFont(int)));
connect(option_echo, SIGNAL(toggled(bool)), SLOT(slotTermEcho(bool)));
connect(option_wrap, SIGNAL(toggled(bool)), SLOT(slotTermWrap(bool)));
connect(conv_inbound, SIGNAL(toggled(bool)), SLOT(slotTermInbound(bool)));
connect(conv_outbound, SIGNAL(toggled(bool)), SLOT(slotTermOutbound(bool)));
return root;
}
void ProfileEditorPlugin::slotConnFlow(int id)
{
switch(id)
{
case id_flow_hw:
m_profile->writeEntry("Flow", IOSerial::FlowHW);
break;
case id_flow_sw:
m_profile->writeEntry("Flow", IOSerial::FlowSW);
break;
case id_flow_sw:
m_profile->writeEntry("None", IOSerial::None);
break;
}
diff --git a/noncore/apps/opie-console/profileeditorplugins.h b/noncore/apps/opie-console/profileeditorplugins.h
index 4ca780e..f576143 100644
--- a/noncore/apps/opie-console/profileeditorplugins.h
+++ b/noncore/apps/opie-console/profileeditorplugins.h
@@ -1,97 +1,96 @@
#ifndef PROFILE_EDITOR_PLUGINS_H
#define PROFILE_EDITOR_PLUGINS_H
-#include "profile.h"
#include <qobject.h>
class QWidget;
-
+class Profile;
class ProfileEditorPlugin : public QObject
{
Q_OBJECT
public:
ProfileEditorPlugin(QWidget *parent);
virtual ~ProfileEditorPlugin();
virtual void save() = 0;
virtual QWidget *widget() = 0;
QWidget *connection_widget();
QWidget *terminal_widget();
public slots:
void slotConnFlow(int id);
void slotConnParity(int id);
void slotConnSpeed(int id);
void slotTermTerm(int id);
void slotTermColour(int id);
void slotTermFont(int id);
void slotTermEcho(bool on);
void slotTermWrap(bool on);
void slotTermInbound(bool on);
void slotTermOutbound(bool on);
protected:
QWidget *m_parent, *m_widget;
Profile *m_profile;
private:
enum ParityIds
{
id_parity_odd,
id_parity_even
};
enum FlowIds
{
id_flow_hw,
id_flow_sw
};
enum SpeedIds
{
id_baud_115200,
id_baud_57600,
id_baud_38400,
id_baud_19200,
id_baud_9600
};
enum TermIds
{
id_term_vt100,
id_term_vt220,
id_term_ansi
};
enum ColourIds
{
id_term_black,
id_term_white
};
enum FontIds
{
id_size_small,
id_size_medium,
id_size_large
};
};
//#ifdef __cplusplus
//extern "C" {
//#endif
ProfileEditorPlugin *factory_serial(QWidget *parent, Profile *p);
ProfileEditorPlugin *factory_irda(QWidget *parent, Profile *p);
ProfileEditorPlugin *factory_modem(QWidget *parent, Profile *p);
//#ifdef __cplusplus
//}
//#endif
#endif