summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp1
-rw-r--r--noncore/apps/opie-console/profile.h2
-rw-r--r--noncore/apps/opie-console/profileeditordialog.cpp1
-rw-r--r--noncore/apps/opie-console/terminalwidget.cpp21
4 files changed, 15 insertions, 10 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index 27bcc09..415259e 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -253,48 +253,49 @@ void MainWindow::slotConnect() {
253 253
254void MainWindow::slotDisconnect() { 254void MainWindow::slotDisconnect() {
255 if ( currentSession() ) 255 if ( currentSession() )
256 currentSession()->layer()->close(); 256 currentSession()->layer()->close();
257} 257}
258 258
259void MainWindow::slotTerminate() { 259void MainWindow::slotTerminate() {
260 if ( currentSession() ) 260 if ( currentSession() )
261 currentSession()->layer()->close(); 261 currentSession()->layer()->close();
262 262
263 slotClose(); 263 slotClose();
264 /* FIXME move to the next session */ 264 /* FIXME move to the next session */
265} 265}
266 266
267void MainWindow::slotConfigure() { 267void MainWindow::slotConfigure() {
268 qWarning("configure"); 268 qWarning("configure");
269 ConfigDialog conf( manager()->all(), factory() ); 269 ConfigDialog conf( manager()->all(), factory() );
270 conf.showMaximized(); 270 conf.showMaximized();
271 271
272 int ret = conf.exec(); 272 int ret = conf.exec();
273 273
274 if ( QDialog::Accepted == ret ) { 274 if ( QDialog::Accepted == ret ) {
275 qWarning("conf %d", conf.list().count() ); 275 qWarning("conf %d", conf.list().count() );
276 manager()->setProfiles( conf.list() ); 276 manager()->setProfiles( conf.list() );
277 manager()->save();
277 populateProfiles(); 278 populateProfiles();
278 } 279 }
279} 280}
280/* 281/*
281 * we will remove 282 * we will remove
282 * this window from the tabwidget 283 * this window from the tabwidget
283 * remove it from the list 284 * remove it from the list
284 * delete it 285 * delete it
285 * and set the currentSession() 286 * and set the currentSession()
286 */ 287 */
287void MainWindow::slotClose() { 288void MainWindow::slotClose() {
288 qWarning("close"); 289 qWarning("close");
289 if (!currentSession() ) 290 if (!currentSession() )
290 return; 291 return;
291 292
292 tabWidget()->remove( currentSession() ); 293 tabWidget()->remove( currentSession() );
293 /*it's autodelete */ 294 /*it's autodelete */
294 m_sessions.remove( m_curSession ); 295 m_sessions.remove( m_curSession );
295 m_curSession = m_sessions.first(); 296 m_curSession = m_sessions.first();
296 tabWidget()->setCurrent( m_curSession ); 297 tabWidget()->setCurrent( m_curSession );
297} 298}
298 299
299/* 300/*
300 * We will get the name 301 * We will get the name
diff --git a/noncore/apps/opie-console/profile.h b/noncore/apps/opie-console/profile.h
index 78fe6ab..1b71cda 100644
--- a/noncore/apps/opie-console/profile.h
+++ b/noncore/apps/opie-console/profile.h
@@ -1,45 +1,45 @@
1#ifndef OPIE_PROFILE_H 1#ifndef OPIE_PROFILE_H
2#define OPIE_PROFILE_H 2#define OPIE_PROFILE_H
3 3
4#include <qmap.h> 4#include <qmap.h>
5#include <qstring.h> 5#include <qstring.h>
6#include <qstringlist.h> 6#include <qstringlist.h>
7#include <qvaluelist.h> 7#include <qvaluelist.h>
8/** 8/**
9 * A session will be generated from a saved 9 * A session will be generated from a saved
10 * profile. A profile contains the iolayername 10 * profile. A profile contains the iolayername
11 * a name. 11 * a name.
12 * We can generate a Session from a Profile 12 * We can generate a Session from a Profile
13 * Configuration is contained here too 13 * Configuration is contained here too
14 */ 14 */
15class Profile { 15class Profile {
16public: 16public:
17 typedef QValueList<Profile> ValueList; 17 typedef QValueList<Profile> ValueList;
18 enum Color { Black = 0, 18 enum Color { Black = 0,
19 White, 19 White,
20 Gray }; 20 Gray };
21 enum Terminal {VT102 = 0 }; 21 enum Terminal {VT102 = 0, VT100 };
22 enum Font { Micro = 0, Small, Medium }; 22 enum Font { Micro = 0, Small, Medium };
23 Profile(); 23 Profile();
24 Profile( const QString& name, 24 Profile( const QString& name,
25 const QCString& iolayerName, 25 const QCString& iolayerName,
26 const QCString& termName, 26 const QCString& termName,
27 int background, 27 int background,
28 int foreground, 28 int foreground,
29 int terminal); 29 int terminal);
30 Profile( const Profile& ); 30 Profile( const Profile& );
31 Profile &operator=( const Profile& ); 31 Profile &operator=( const Profile& );
32 bool operator==( const Profile& prof ); 32 bool operator==( const Profile& prof );
33 33
34 ~Profile(); 34 ~Profile();
35 QString name()const; 35 QString name()const;
36 QCString ioLayerName()const; 36 QCString ioLayerName()const;
37 QCString terminalName()const; 37 QCString terminalName()const;
38 int foreground()const; 38 int foreground()const;
39 int background()const; 39 int background()const;
40 int terminal()const; 40 int terminal()const;
41 41
42 /* 42 /*
43 * config stuff 43 * config stuff
44 */ 44 */
45 QMap<QString, QString> conf()const; 45 QMap<QString, QString> conf()const;
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp
index 914fd25..094c871 100644
--- a/noncore/apps/opie-console/profileeditordialog.cpp
+++ b/noncore/apps/opie-console/profileeditordialog.cpp
@@ -37,48 +37,49 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact,
37 37
38ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) 38ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact )
39 : QDialog(0, 0, TRUE), m_fact( fact ) 39 : QDialog(0, 0, TRUE), m_fact( fact )
40{ 40{
41 // Default profile 41 // Default profile
42 m_prof = Profile("New Profile", "serial", "default", Profile::Black, Profile::White, Profile::VT102); 42 m_prof = Profile("New Profile", "serial", "default", Profile::Black, Profile::White, Profile::VT102);
43 43
44 initUI(); 44 initUI();
45 45
46 // Apply current profile 46 // Apply current profile
47 // plugin_plugin->load(profile); 47 // plugin_plugin->load(profile);
48} 48}
49 49
50Profile ProfileEditorDialog::profile() const 50Profile ProfileEditorDialog::profile() const
51{ 51{
52 return m_prof; 52 return m_prof;
53} 53}
54 54
55void ProfileEditorDialog::initUI() 55void ProfileEditorDialog::initUI()
56{ 56{
57 m_con = m_term = 0l; 57 m_con = m_term = 0l;
58 58
59 QVBoxLayout *mainLayout = new QVBoxLayout( this ); 59 QVBoxLayout *mainLayout = new QVBoxLayout( this );
60 OTabWidget *tabWidget = new OTabWidget( this ); 60 OTabWidget *tabWidget = new OTabWidget( this );
61 tabWidget->setTabStyle(OTabWidget::TextTab);
61 mainLayout->add(tabWidget); 62 mainLayout->add(tabWidget);
62 63
63 QWidget *tabprof; 64 QWidget *tabprof;
64 65
65 /* base tabs */ 66 /* base tabs */
66 tabprof = new QWidget(this); 67 tabprof = new QWidget(this);
67 m_tabTerm = new QWidget(this); 68 m_tabTerm = new QWidget(this);
68 m_tabCon = new QWidget(this); 69 m_tabCon = new QWidget(this);
69 70
70 /* base layout for tabs */ 71 /* base layout for tabs */
71 m_layCon = new QHBoxLayout( m_tabCon , 2 ); 72 m_layCon = new QHBoxLayout( m_tabCon , 2 );
72 m_layTerm = new QHBoxLayout( m_tabTerm, 2 ); 73 m_layTerm = new QHBoxLayout( m_tabTerm, 2 );
73 74
74 // profile tab 75 // profile tab
75 76
76 QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof); 77 QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof);
77 m_name = new QLineEdit(tabprof); 78 m_name = new QLineEdit(tabprof);
78 QLabel *con = new QLabel(tr("Connection"), tabprof ); 79 QLabel *con = new QLabel(tr("Connection"), tabprof );
79 QLabel *term = new QLabel(tr("Terminal"), tabprof ); 80 QLabel *term = new QLabel(tr("Terminal"), tabprof );
80 m_conCmb = new QComboBox( tabprof ); 81 m_conCmb = new QComboBox( tabprof );
81 m_termCmb = new QComboBox( tabprof ); 82 m_termCmb = new QComboBox( tabprof );
82 83
83 // layouting 84 // layouting
84 QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2); 85 QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2);
diff --git a/noncore/apps/opie-console/terminalwidget.cpp b/noncore/apps/opie-console/terminalwidget.cpp
index 80627c4..2d37be2 100644
--- a/noncore/apps/opie-console/terminalwidget.cpp
+++ b/noncore/apps/opie-console/terminalwidget.cpp
@@ -1,40 +1,40 @@
1#include <qbuttongroup.h> 1#include <qbuttongroup.h>
2#include <qlabel.h> 2#include <qlabel.h>
3#include <qcheckbox.h> 3#include <qcheckbox.h>
4#include <qcombobox.h> 4#include <qcombobox.h>
5#include <qradiobutton.h> 5#include <qradiobutton.h>
6#include <qgroupbox.h> 6#include <qgroupbox.h>
7#include <qvbox.h> 7#include <qvbox.h>
8#include <qhgroupbox.h> 8#include <qhgroupbox.h>
9#include <qlayout.h> 9#include <qlayout.h>
10 10
11#include "terminalwidget.h" 11#include "terminalwidget.h"
12 12
13namespace { 13namespace {
14 enum TermIds { 14 enum TermIds {
15 id_term_vt100, 15 id_term_vt100,
16 id_term_vt220, 16 id_term_vt102,
17 id_term_ansi 17 id_term_ansi
18 }; 18 };
19 19
20 enum ColourIds { 20 enum ColourIds {
21 id_term_black, 21 id_term_black,
22 id_term_white 22 id_term_white
23 }; 23 };
24 24
25 enum FontIds { 25 enum FontIds {
26 id_size_small, 26 id_size_small,
27 id_size_medium, 27 id_size_medium,
28 id_size_large 28 id_size_large
29 }; 29 };
30}; 30};
31 31
32TerminalWidget::TerminalWidget( const QString& name, QWidget* parent, 32TerminalWidget::TerminalWidget( const QString& name, QWidget* parent,
33 const char* na ) 33 const char* na )
34 : ProfileDialogTerminalWidget( name, parent, na ) { 34 : ProfileDialogTerminalWidget( name, parent, na ) {
35 35
36 m_terminal = new QLabel(tr("Terminal Type"), this ); 36 m_terminal = new QLabel(tr("Terminal Type"), this );
37 m_terminalBox = new QComboBox(this); 37 m_terminalBox = new QComboBox(this);
38 m_colorLabel = new QLabel(tr("Color scheme"), this); 38 m_colorLabel = new QLabel(tr("Color scheme"), this);
39 m_colorCmb = new QComboBox(this ); 39 m_colorCmb = new QComboBox(this );
40 40
@@ -52,135 +52,138 @@ TerminalWidget::TerminalWidget( const QString& name, QWidget* parent,
52 m_optionWrap = new QCheckBox(tr("Line wrap"), m_groupOptions ); 52 m_optionWrap = new QCheckBox(tr("Line wrap"), m_groupOptions );
53 53
54 m_lroot = new QVBoxLayout(this, 2 ); 54 m_lroot = new QVBoxLayout(this, 2 );
55 m_typeBox = new QVBoxLayout( m_lroot ); 55 m_typeBox = new QVBoxLayout( m_lroot );
56 m_hbox = new QHBoxLayout( m_groupSize, 2 ); 56 m_hbox = new QHBoxLayout( m_groupSize, 2 );
57 m_colorBox = new QVBoxLayout( m_lroot ); 57 m_colorBox = new QVBoxLayout( m_lroot );
58 58
59 // Layout 59 // Layout
60 m_typeBox->add(m_terminal ); 60 m_typeBox->add(m_terminal );
61 m_typeBox->add(m_terminalBox ); 61 m_typeBox->add(m_terminalBox );
62 62
63 m_hbox->add(m_sizeSmall ); 63 m_hbox->add(m_sizeSmall );
64 m_hbox->add(m_sizeMedium ); 64 m_hbox->add(m_sizeMedium );
65 m_hbox->add(m_sizeLarge ); 65 m_hbox->add(m_sizeLarge );
66 m_lroot->add(m_groupSize ); 66 m_lroot->add(m_groupSize );
67 67
68 m_colorBox->add( m_colorLabel ); 68 m_colorBox->add( m_colorLabel );
69 m_colorBox->add( m_colorCmb ); 69 m_colorBox->add( m_colorCmb );
70 70
71 m_lroot->add(m_groupConv ); 71 m_lroot->add(m_groupConv );
72 m_lroot->add(m_groupOptions ); 72 m_lroot->add(m_groupOptions );
73 73
74 // Fill in some options 74 // Fill in some options
75 m_terminalBox->insertItem( tr("VT 100"), id_term_vt100 ); 75 m_terminalBox->insertItem( tr("VT 100"), id_term_vt100 );
76 m_terminalBox->insertItem( tr("VT 220"), id_term_vt220 ); 76 m_terminalBox->insertItem( tr("VT 102"), id_term_vt102 );
77 m_terminalBox->insertItem( tr("ANSI"), id_term_ansi ); 77 //m_terminalBox->insertItem( tr("ANSI"), id_term_ansi );
78 78
79 m_colorCmb->insertItem( tr("black on white"), id_term_black ); 79 m_colorCmb->insertItem( tr("black on white"), id_term_black );
80 m_colorCmb->insertItem( tr("white on black"), id_term_white ); 80 m_colorCmb->insertItem( tr("white on black"), id_term_white );
81 81
82 // signals + slots 82 // signals + slots
83 /* 83 /*
84 connect(m_terminalBox, SIGNAL(activated(int) ), 84 connect(m_terminalBox, SIGNAL(activated(int) ),
85 this, SLOT(slotTermTerm(int) ) ); 85 this, SLOT(slotTermTerm(int) ) );
86 connect(m_colorBox, SIGNAL(activated(int) ), 86 connect(m_colorBox, SIGNAL(activated(int) ),
87 tis, SLOT(slotTermColor(int) ) ); 87 tis, SLOT(slotTermColor(int) ) );
88 connect(m_groupSize, SIGNAL(activated(int) ), 88 connect(m_groupSize, SIGNAL(activated(int) ),
89 this, SLOT(slotTermFont(int) ) ); 89 this, SLOT(slotTermFont(int) ) );
90 90
91 connect(m_optionEcho, SIGNAL(toggled(bool) ), 91 connect(m_optionEcho, SIGNAL(toggled(bool) ),
92 this, SLOT(slotTermEcho(bool) ) ); 92 this, SLOT(slotTermEcho(bool) ) );
93 connect(m_optionWrap, SIGNAL(toggled(bool) ), 93 connect(m_optionWrap, SIGNAL(toggled(bool) ),
94 this, SLOT(slotTermWrap(bool) ) ); 94 this, SLOT(slotTermWrap(bool) ) );
95 connect(m_convInbound, SIGNAL(toggled(bool) ), 95 connect(m_convInbound, SIGNAL(toggled(bool) ),
96 this, SLOT(slotTermInbound(bool) ) ); 96 this, SLOT(slotTermInbound(bool) ) );
97 connect(m_convOutbound, SIGNAL(toggled(bool) ), 97 connect(m_convOutbound, SIGNAL(toggled(bool) ),
98 this, SLOT(slotTermOutbound(bool) ) ); 98 this, SLOT(slotTermOutbound(bool) ) );
99*/ 99*/
100} 100}
101TerminalWidget::~TerminalWidget() { 101TerminalWidget::~TerminalWidget() {
102} 102}
103void TerminalWidget::load( const Profile& prof ) { 103void TerminalWidget::load( const Profile& prof ) {
104 int term = prof.readNumEntry("Terminal"); 104 int term = prof.readNumEntry("Terminal");
105 int color = prof.readNumEntry("Color"); 105 int color = prof.readNumEntry("Color");
106 int fontsize = prof.readNumEntry("Font"); 106 int fontsize = prof.readNumEntry("Font");
107 int opt_echo = prof.readNumEntry("Echo"); 107 int opt_echo = prof.readNumEntry("Echo");
108 int opt_wrap = prof.readNumEntry("Wrap"); 108 int opt_wrap = prof.readNumEntry("Wrap");
109 int opt_inbound = prof.readNumEntry("Inbound"); 109 int opt_inbound = prof.readNumEntry("Inbound");
110 int opt_outbound = prof.readNumEntry("Outbound"); 110 int opt_outbound = prof.readNumEntry("Outbound");
111 111
112 switch( term ) { 112 switch( term ) {
113 case Profile::VT102: 113 case Profile::VT100:
114 m_terminalBox->setCurrentItem(id_term_vt100 ); 114 m_terminalBox->setCurrentItem(id_term_vt100 );
115 break; 115 break;
116 case Profile::VT102:
117 m_terminalBox->setCurrentItem(id_term_vt102 );
118 break;
116 default: 119 default:
117 break; 120 break;
118 }; 121 };
119 122
120 switch( color ) { 123 switch( color ) {
121 case Profile::Black: 124 case Profile::Black:
122 m_colorCmb->setCurrentItem(id_term_black ); 125 m_colorCmb->setCurrentItem(id_term_black );
123 break; 126 break;
124 case Profile::White: 127 case Profile::White:
125 m_colorCmb->setCurrentItem(id_term_white ); 128 m_colorCmb->setCurrentItem(id_term_white );
126 break; 129 break;
127 default: 130 default:
128 break; 131 break;
129 }; 132 };
130 133
131 switch( fontsize ) { 134 switch( fontsize ) {
132 case Profile::Micro: 135 case Profile::Micro:
133 m_sizeSmall->setChecked(true ); 136 m_sizeSmall->setChecked(true );
134 break; 137 break;
135 case Profile::Small: 138 case Profile::Small:
136 m_sizeMedium->setChecked(true ); 139 m_sizeMedium->setChecked(true );
137 break; 140 break;
138 case Profile::Medium: 141 case Profile::Medium:
139 m_sizeLarge->setChecked( true ); 142 m_sizeLarge->setChecked( true );
140 break; 143 break;
141 m_sizeSmall->setChecked(true); 144 m_sizeSmall->setChecked(true);
142 default: 145 default:
143 break; 146 break;
144 }; 147 };
145 148
146 if (opt_echo) m_optionEcho->setChecked( true ); 149 if (opt_echo) m_optionEcho->setChecked( true );
147 if (opt_wrap) m_optionWrap->setChecked( true ); 150 if (opt_wrap) m_optionWrap->setChecked( true );
148 if (opt_inbound) m_convInbound->setChecked( true ); 151 if (opt_inbound) m_convInbound->setChecked( true );
149 if (opt_outbound) m_convOutbound->setChecked( true ); 152 if (opt_outbound) m_convOutbound->setChecked( true );
150 153
151} 154}
152void TerminalWidget::save( Profile& profile ) { 155void TerminalWidget::save( Profile& profile ) {
153 switch(m_terminalBox->currentItem() ) { 156 switch(m_terminalBox->currentItem() ) {
154 case id_term_vt100: 157 case id_term_vt100:
155 profile.writeEntry("Terminal", Profile::VT102 ); 158 profile.writeEntry("Terminal", Profile::VT100 );
156 break;
157 case id_term_vt220:
158 profile.writeEntry("Terminal", Profile::VT102 );
159 break; 159 break;
160 case id_term_ansi: 160 case id_term_vt102:
161 profile.writeEntry("Terminal", Profile::VT102 ); 161 profile.writeEntry("Terminal", Profile::VT102 );
162 break; 162 break;
163 //case id_term_ansi:
164 // profile.writeEntry("Terminal", Profile::VT102 );
165 // break;
163 default: 166 default:
164 break; 167 break;
165 }; 168 };
166 169
167 // color 170 // color
168 switch(m_colorCmb->currentItem() ) { 171 switch(m_colorCmb->currentItem() ) {
169 case id_term_black: 172 case id_term_black:
170 profile.writeEntry("Color", Profile::Black ); 173 profile.writeEntry("Color", Profile::Black );
171 break; 174 break;
172 case id_term_white: 175 case id_term_white:
173 profile.writeEntry("Color", Profile::White ); 176 profile.writeEntry("Color", Profile::White );
174 break; 177 break;
175 default: 178 default:
176 break; 179 break;
177 }; 180 };
178 181
179 if (m_sizeSmall->isChecked() ) { 182 if (m_sizeSmall->isChecked() ) {
180 profile.writeEntry("Font", Profile::Micro ); 183 profile.writeEntry("Font", Profile::Micro );
181 }else if (m_sizeMedium->isChecked() ) { 184 }else if (m_sizeMedium->isChecked() ) {
182 profile.writeEntry("Font", Profile::Small ); 185 profile.writeEntry("Font", Profile::Small );
183 }else { 186 }else {
184 profile.writeEntry("Font", Profile::Medium ); 187 profile.writeEntry("Font", Profile::Medium );
185 } 188 }
186 189