summaryrefslogtreecommitdiff
path: root/core
authorllornkcor <llornkcor>2004-01-18 00:31:12 (UTC)
committer llornkcor <llornkcor>2004-01-18 00:31:12 (UTC)
commit933d897346745d3d51e41591c59387ef6d2bb917 (patch) (unidiff)
treec3f0caba0922d2f9ce8f73c6a4d60eb48f3efcb3 /core
parente9700698b2d664a688af20008095551624c995ae (diff)
downloadopie-933d897346745d3d51e41591c59387ef6d2bb917.zip
opie-933d897346745d3d51e41591c59387ef6d2bb917.tar.gz
opie-933d897346745d3d51e41591c59387ef6d2bb917.tar.bz2
add unifont from somewhere
Diffstat (limited to 'core') (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/konsole.cpp103
1 files changed, 88 insertions, 15 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp
index fff2f68..a5adc03 100644
--- a/core/apps/embeddedkonsole/konsole.cpp
+++ b/core/apps/embeddedkonsole/konsole.cpp
@@ -19,7 +19,9 @@
19/* */ 19/* */
20/* -------------------------------------------------------------------------- */ 20/* -------------------------------------------------------------------------- */
21// enhancements added by L.J. Potter <ljp@llornkcor.com> 21// enhancements added by L.J. Potter <ljp@llornkcor.com>
22#define QT_QWS_OPIE 22//#define QT_QWS_OPIE
23
24#include "signal.h"
23 25
24#include <qpe/resource.h> 26#include <qpe/resource.h>
25 27
@@ -49,7 +51,7 @@
49#include <unistd.h> 51#include <unistd.h>
50#include <pwd.h> 52#include <pwd.h>
51#include <sys/types.h> 53#include <sys/types.h>
52#include <sys/wait.h> 54//#include <sys/wait.h>
53#include <stdio.h> 55#include <stdio.h>
54#include <stdlib.h> 56#include <stdlib.h>
55#include <assert.h> 57#include <assert.h>
@@ -62,6 +64,10 @@
62#include <opie/colorpopupmenu.h> 64#include <opie/colorpopupmenu.h>
63#endif 65#endif
64 66
67 #include <qfontdatabase.h>// U.B.
68 #include <qstringlist.h>// U.B.
69 #include <qvaluelist.h> // U.B.
70
65class EKNumTabBar : public QTabBar { 71class EKNumTabBar : public QTabBar {
66public: 72public:
67 void numberTabs() 73 void numberTabs()
@@ -178,17 +184,18 @@ static void konsoleInit(const char** shell) {
178 if(setuid(getuid()) !=0) qDebug("setuid failed"); 184 if(setuid(getuid()) !=0) qDebug("setuid failed");
179 if(setgid(getgid()) != 0) qDebug("setgid failed"); // drop privileges 185 if(setgid(getgid()) != 0) qDebug("setgid failed"); // drop privileges
180 186
181 187 // signal (SIGSTOP, SIG_IGN);
188
182// QPEApplication::grabKeyboard(); // for CTRL and ALT 189// QPEApplication::grabKeyboard(); // for CTRL and ALT
183 190
184 qDebug("keyboard grabbed"); 191// qDebug("keyboard grabbed");
185#ifdef FAKE_CTRL_AND_ALT 192#ifdef FAKE_CTRL_AND_ALT
186 qDebug("Fake Ctrl and Alt defined"); 193 qDebug("Fake Ctrl and Alt defined");
187 QPEApplication::grabKeyboard(); // for CTRL and ALT 194 QPEApplication::grabKeyboard(); // for CTRL and ALT
188#endif 195#endif
189 196
190 *shell = getenv("SHELL"); 197 *shell = getenv("SHELL");
191 qWarning("SHell initially is %s", *shell ); 198// qWarning("SHell initially is %s", *shell );
192 199
193 if (shell == NULL || *shell == '\0') { 200 if (shell == NULL || *shell == '\0') {
194 struct passwd *ent = 0; 201 struct passwd *ent = 0;
@@ -205,7 +212,7 @@ static void konsoleInit(const char** shell) {
205 endpwent(); 212 endpwent();
206 } 213 }
207 214
208 qWarning("SHELL now is %s", *shell ); 215// qWarning("SHELL now is %s", *shell );
209 216
210 if( putenv((char*)"COLORTERM=") !=0) 217 if( putenv((char*)"COLORTERM=") !=0)
211 qDebug("putenv failed"); // to trigger mc's color detection 218 qDebug("putenv failed"); // to trigger mc's color detection
@@ -219,7 +226,7 @@ Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) :
219 setCaption( tr("Terminal") ); 226 setCaption( tr("Terminal") );
220 227
221 konsoleInit( &shell); 228 konsoleInit( &shell);
222 qWarning("Using shell %s", shell); 229// qWarning("Using shell %s", shell);
223 init(shell,tmp); 230 init(shell,tmp);
224} 231}
225 232
@@ -261,6 +268,7 @@ void Konsole::init(const char* _pgm, QStrList & _args)
261 QString tmp; 268 QString tmp;
262 // initialize the list of allowed fonts /////////////////////////////////// 269 // initialize the list of allowed fonts ///////////////////////////////////
263 cfont = cfg.readNumEntry("FontID", 1); 270 cfont = cfg.readNumEntry("FontID", 1);
271
264 QFont f = QFont("Micro", 4, QFont::Normal); 272 QFont f = QFont("Micro", 4, QFont::Normal);
265 f.setFixedPitch(TRUE); 273 f.setFixedPitch(TRUE);
266 fonts.append(new VTFont(tr("Micro"), f)); 274 fonts.append(new VTFont(tr("Micro"), f));
@@ -273,7 +281,70 @@ void Konsole::init(const char* _pgm, QStrList & _args)
273 f.setFixedPitch(TRUE); 281 f.setFixedPitch(TRUE);
274 fonts.append(new VTFont(tr("Medium Fixed"), f)); 282 fonts.append(new VTFont(tr("Medium Fixed"), f));
275 283
276 // create terminal emulation framework //////////////////////////////////// 284// NEW STUFF
285
286 QStringList ignfont = cfg.readListEntry("IgnFont", ',');
287 /* If there is no "IgnFont = ..." entry in "myonsole.conf",
288 * put some Japanese fonts of the SL-C7x0 to "ignfont". */
289
290 if (ignfont.isEmpty()) {
291 ignfont = QStringList::split (',',"jisupasp,mmkjg1,mmkjg4,mmkjg5");
292 }
293
294 //QFont
295 f = QFont("Fixed", 16, QFont::Normal);
296 f.setFixedPitch(true);
297 fonts.append(new VTFont(tr("Default"), f));
298
299 int fcount = 1;
300
301 f.setCharSet(QFont::AnyCharSet);
302 f.setStyleHint(QFont::TypeWriter, QFont::PreferMatch);
303// f.setWeight(QFont::Normal);
304
305 /*
306 * Look for installed font families. If the family is not in
307 * the "ignfont" list, look for available sizes.
308 * If it is fixed pitch font, put the font and the size
309 * to the fontlist.
310 */
311 QFontDatabase fdb;
312 QStringList ff = fdb.families(false);
313
314 for (QStringList::Iterator it = ff.begin(); it != ff.end(); ++it ) {
315 QString fit = *it;
316
317 if( fit != "fixed" && fit != "micro" ) {
318 if ( ignfont.contains(*it) == 0) {
319 QValueList<int> pt = fdb.pointSizes(*it);
320
321 for (QValueList<int>::Iterator itv = pt.begin();
322 itv != pt.end(); ++itv ) {
323 int size = (*itv)/10;
324 if(size > 0) {
325 f.setFamily(*it);
326 f.setPointSize(size);
327 }
328
329 QFontMetrics fm(f);
330
331//qDebug("%s %d:\twidth('i')=%d, width('w')=%d", (*it).latin1(), (*itv)/10, fm.width('i'), fm.width('w'));
332
333 if (fm.width('i') == fm.width('w') ) {
334 qDebug((*it));
335 f.setFixedPitch(true);
336 fonts.append(new VTFont(*it + ' ' + QString::number(size), f));
337 fcount++;
338 }
339 }
340 }
341 }
342 }
343
344// END NEW STUFF
345
346
347// create terminal emulation framework ////////////////////////////////////
277 nsessions = 0; 348 nsessions = 0;
278 349
279 tab = new EKNumTabWidget(this); 350 tab = new EKNumTabWidget(this);
@@ -292,6 +363,7 @@ void Konsole::init(const char* _pgm, QStrList & _args)
292 VTFont *fnt = fonts.at(i); 363 VTFont *fnt = fonts.at(i);
293 fontList->insertItem(fnt->getName(), i); 364 fontList->insertItem(fnt->getName(), i);
294 } 365 }
366
295 fontChanged(cfont); 367 fontChanged(cfont);
296 368
297 configMenu = new QPopupMenu( this); 369 configMenu = new QPopupMenu( this);
@@ -625,13 +697,14 @@ void Konsole::setFont(int fontno)
625// --| color selection |------------------------------------------------------- 697// --| color selection |-------------------------------------------------------
626 698
627void Konsole::changeColumns(int columns) 699void Konsole::changeColumns(int columns)
628{ //FIXME this seems to cause silliness when reset command is executed 700{
629// qDebug("change columns"); 701 //FIXME this seems to cause silliness when reset command is executed
630// TEWidget* te = getTe(); 702 // qDebug("change columns");
631// if (te != 0) { 703 // TEWidget* te = getTe();
632// setColLin(columns,te->Lines()); 704 // if (te != 0) {
633// te->update(); 705 // setColLin(columns,te->Lines());
634// } 706 // te->update();
707 // }
635} 708}
636 709
637//FIXME: If a child dies during session swap, 710//FIXME: If a child dies during session swap,