-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 103 |
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 | |||
@@ -21,3 +21,5 @@ | |||
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 | ||
@@ -51,3 +53,3 @@ | |||
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> |
@@ -64,2 +66,6 @@ | |||
64 | 66 | ||
67 | #include <qfontdatabase.h>// U.B. | ||
68 | #include <qstringlist.h>// U.B. | ||
69 | #include <qvaluelist.h> // U.B. | ||
70 | |||
65 | class EKNumTabBar : public QTabBar { | 71 | class EKNumTabBar : public QTabBar { |
@@ -180,6 +186,7 @@ static void konsoleInit(const char** shell) { | |||
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 |
@@ -190,3 +197,3 @@ static void konsoleInit(const char** shell) { | |||
190 | *shell = getenv("SHELL"); | 197 | *shell = getenv("SHELL"); |
191 | qWarning("SHell initially is %s", *shell ); | 198 | // qWarning("SHell initially is %s", *shell ); |
192 | 199 | ||
@@ -207,3 +214,3 @@ static void konsoleInit(const char** shell) { | |||
207 | 214 | ||
208 | qWarning("SHELL now is %s", *shell ); | 215 | // qWarning("SHELL now is %s", *shell ); |
209 | 216 | ||
@@ -221,3 +228,3 @@ Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) : | |||
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); |
@@ -263,2 +270,3 @@ void Konsole::init(const char* _pgm, QStrList & _args) | |||
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); |
@@ -275,3 +283,66 @@ void Konsole::init(const char* _pgm, QStrList & _args) | |||
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; |
@@ -294,2 +365,3 @@ void Konsole::init(const char* _pgm, QStrList & _args) | |||
294 | } | 365 | } |
366 | |||
295 | fontChanged(cfont); | 367 | fontChanged(cfont); |
@@ -627,9 +699,10 @@ void Konsole::setFont(int fontno) | |||
627 | void Konsole::changeColumns(int columns) | 699 | void 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 | } |