summaryrefslogtreecommitdiff
authorzecke <zecke>2004-02-25 20:55:24 (UTC)
committer zecke <zecke>2004-02-25 20:55:24 (UTC)
commitad8cbdb693ecccd2a67a8294014360b70ad4253a (patch) (unidiff)
treec0d3bdc8d3b3d143d195170fee2cc54045840fa6
parentddab47e21543e806a7de978985f77ea2b9e8c214 (diff)
downloadopie-ad8cbdb693ecccd2a67a8294014360b70ad4253a.zip
opie-ad8cbdb693ecccd2a67a8294014360b70ad4253a.tar.gz
opie-ad8cbdb693ecccd2a67a8294014360b70ad4253a.tar.bz2
remove the stupid #ifdef __i386__
We're on Opie and don't need to mess with Qtopia.. we fix up broken Qt usage of legacy via a __weak__ symbol hack
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/konsole.cpp2
1 files changed, 0 insertions, 2 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp
index 1c613a9..2c0001f 100644
--- a/core/apps/embeddedkonsole/konsole.cpp
+++ b/core/apps/embeddedkonsole/konsole.cpp
@@ -305,260 +305,258 @@ void Konsole::initCommandList()
305 } 305 }
306 } 306 }
307 items.sort(); 307 items.sort();
308 int n = items.count(); 308 int n = items.count();
309 if (n > 40) 309 if (n > 40)
310 { 310 {
311 n = 40; 311 n = 40;
312 } 312 }
313 for(int i=0; i<n; i++) 313 for(int i=0; i<n; i++)
314 { 314 {
315 // should insert start of command, but keep whole thing 315 // should insert start of command, but keep whole thing
316 if (items.at(items.count()-i-1)->line.length() < 30) 316 if (items.at(items.count()-i-1)->line.length() < 30)
317 { 317 {
318 commonCombo->insertItem(items.at(items.count()-i-1)->line); 318 commonCombo->insertItem(items.at(items.count()-i-1)->line);
319 } 319 }
320 } 320 }
321 histfile.close(); 321 histfile.close();
322 } 322 }
323 } 323 }
324 if (cfg.readEntry("Commands Set","FALSE") == "FALSE") 324 if (cfg.readEntry("Commands Set","FALSE") == "FALSE")
325 { 325 {
326 for (int i = 0; commonCmds[i] != NULL; i++) 326 for (int i = 0; commonCmds[i] != NULL; i++)
327 { 327 {
328 commonCombo->insertItem(commonCmds[i]); 328 commonCombo->insertItem(commonCmds[i]);
329 } 329 }
330 } 330 }
331 else 331 else
332 { 332 {
333 for (int i = 0; i < 100; i++) 333 for (int i = 0; i < 100; i++)
334 { 334 {
335 if (!(cfg.readEntry( QString::number(i),"")).isEmpty()) 335 if (!(cfg.readEntry( QString::number(i),"")).isEmpty())
336 commonCombo->insertItem(cfg.readEntry( QString::number(i),"")); 336 commonCombo->insertItem(cfg.readEntry( QString::number(i),""));
337 } 337 }
338 } 338 }
339 339
340 340
341} 341}
342 342
343static void sig_handler(int x) 343static void sig_handler(int x)
344{ 344{
345 printf("got signal %d\n",x); 345 printf("got signal %d\n",x);
346} 346}
347 347
348void Konsole::init(const char* _pgm, QStrList & _args) 348void Konsole::init(const char* _pgm, QStrList & _args)
349{ 349{
350 350
351#if 0 351#if 0
352 for(int i=1; i<=31; i++) 352 for(int i=1; i<=31; i++)
353 { 353 {
354 if (i != SIGPIPE && i != SIGPROF && i != SIGSEGV 354 if (i != SIGPIPE && i != SIGPROF && i != SIGSEGV
355 && i != SIGINT && i != SIGILL && i != SIGTERM 355 && i != SIGINT && i != SIGILL && i != SIGTERM
356 && i != SIGBUS) 356 && i != SIGBUS)
357 signal(i,sig_handler); 357 signal(i,sig_handler);
358 } 358 }
359#endif 359#endif
360 signal(SIGSTOP, sig_handler); 360 signal(SIGSTOP, sig_handler);
361 signal(SIGCONT, sig_handler); 361 signal(SIGCONT, sig_handler);
362 signal(SIGTSTP, sig_handler); 362 signal(SIGTSTP, sig_handler);
363 363
364 b_scroll = TRUE; // histon; 364 b_scroll = TRUE; // histon;
365 n_keytab = 0; 365 n_keytab = 0;
366 n_render = 0; 366 n_render = 0;
367 startUp=0; 367 startUp=0;
368 fromMenu = FALSE; 368 fromMenu = FALSE;
369 fullscreen = false; 369 fullscreen = false;
370 370
371 setCaption( tr( "Konsole" ) ); 371 setCaption( tr( "Konsole" ) );
372 setIcon( Resource::loadPixmap( "konsole/Terminal" ) ); 372 setIcon( Resource::loadPixmap( "konsole/Terminal" ) );
373 373
374 Config cfg( "Konsole" ); 374 Config cfg( "Konsole" );
375 cfg.setGroup("Font"); 375 cfg.setGroup("Font");
376 QString tmp; 376 QString tmp;
377 377
378 // initialize the list of allowed fonts /////////////////////////////////// 378 // initialize the list of allowed fonts ///////////////////////////////////
379 379
380 QString cfgFontName = cfg.readEntry("FontName","Lcfont"); 380 QString cfgFontName = cfg.readEntry("FontName","Lcfont");
381 int cfgFontSize = cfg.readNumEntry("FontSize",18); 381 int cfgFontSize = cfg.readNumEntry("FontSize",18);
382 382
383 cfont = -1; 383 cfont = -1;
384 384
385 // this code causes repeated access to all the font files 385 // this code causes repeated access to all the font files
386 // which does slow down startup 386 // which does slow down startup
387 QFontDatabase fontDB; 387 QFontDatabase fontDB;
388 QStringList familyNames; 388 QStringList familyNames;
389 familyNames = fontDB.families( FALSE ); 389 familyNames = fontDB.families( FALSE );
390 QString s; 390 QString s;
391 int fontIndex = 0; 391 int fontIndex = 0;
392 int familyNum = 0; 392 int familyNum = 0;
393 fontList = new QPopupMenu( this ); 393 fontList = new QPopupMenu( this );
394 394
395 for(uint j = 0; j < (uint)familyNames.count(); j++) 395 for(uint j = 0; j < (uint)familyNames.count(); j++)
396 { 396 {
397 s = familyNames[j]; 397 s = familyNames[j];
398 if ( s.contains('-') ) 398 if ( s.contains('-') )
399 { 399 {
400 int i = s.find('-'); 400 int i = s.find('-');
401 s = s.right( s.length() - i - 1 ) + " [" + s.left( i ) + "]"; 401 s = s.right( s.length() - i - 1 ) + " [" + s.left( i ) + "]";
402 } 402 }
403 s[0] = s[0].upper(); 403 s[0] = s[0].upper();
404 404
405 QValueList<int> sizes = fontDB.pointSizes( familyNames[j] ); 405 QValueList<int> sizes = fontDB.pointSizes( familyNames[j] );
406 406
407 printf("family[%d] = %s with %d sizes\n", j, familyNames[j].latin1(), 407 printf("family[%d] = %s with %d sizes\n", j, familyNames[j].latin1(),
408 sizes.count()); 408 sizes.count());
409 409
410 if (sizes.count() > 0) 410 if (sizes.count() > 0)
411 { 411 {
412 QPopupMenu *sizeMenu; 412 QPopupMenu *sizeMenu;
413 QFont f; 413 QFont f;
414 int last_width = -1; 414 int last_width = -1;
415 sizeMenu = NULL; 415 sizeMenu = NULL;
416 416
417 for(uint i = 0; i < (uint)sizes.count() + 4; i++) 417 for(uint i = 0; i < (uint)sizes.count() + 4; i++)
418 { 418 {
419 // printf("family %s size %d ", familyNames[j].latin1(), sizes[i]); 419 // printf("family %s size %d ", familyNames[j].latin1(), sizes[i]);
420 // need to divide by 10 on the Z, but not otherwise 420 // need to divide by 10 on the Z, but not otherwise
421 int size; 421 int size;
422 422
423 if (i >= (uint)sizes.count()) 423 if (i >= (uint)sizes.count())
424 { 424 {
425 // try for expandable fonts 425 // try for expandable fonts
426 size = sizes[sizes.count()-1] + 2 * (i - sizes.count() + 1); 426 size = sizes[sizes.count()-1] + 2 * (i - sizes.count() + 1);
427 } 427 }
428 else 428 else
429 { 429 {
430 printf("sizes[%d] = %d\n", i, sizes[i]); 430 printf("sizes[%d] = %d\n", i, sizes[i]);
431 size = sizes[i]; 431 size = sizes[i];
432 } 432 }
433#ifndef __i386__
434 // a hack, sizes on Z seem to be points*10 433 // a hack, sizes on Z seem to be points*10
435 size /= 10; 434 size /= 10;
436#endif
437 435
438 f = QFont(familyNames[j], size); 436 f = QFont(familyNames[j], size);
439 f.setFixedPitch(true); 437 f.setFixedPitch(true);
440 QFontMetrics fm(f); 438 QFontMetrics fm(f);
441 // don't trust f.fixedPitch() or f.exactMatch(), they lie!! 439 // don't trust f.fixedPitch() or f.exactMatch(), they lie!!
442 if (fm.width("l") == fm.width("m") 440 if (fm.width("l") == fm.width("m")
443 && (i < (uint)sizes.count() 441 && (i < (uint)sizes.count()
444 || fm.width("m") > last_width)) 442 || fm.width("m") > last_width))
445 { 443 {
446 if (i < (uint)sizes.count()) 444 if (i < (uint)sizes.count())
447 { 445 {
448 last_width = fm.width("m"); 446 last_width = fm.width("m");
449 } 447 }
450 if (sizeMenu == NULL) 448 if (sizeMenu == NULL)
451 { 449 {
452 sizeMenu = new QPopupMenu(); 450 sizeMenu = new QPopupMenu();
453 } 451 }
454 int id = sizeMenu->insertItem(QString("%1").arg(size), fontIndex); 452 int id = sizeMenu->insertItem(QString("%1").arg(size), fontIndex);
455 sizeMenu->setItemParameter(id, fontIndex); 453 sizeMenu->setItemParameter(id, fontIndex);
456 sizeMenu->connectItem(id, this, SLOT(setFont(int))); 454 sizeMenu->connectItem(id, this, SLOT(setFont(int)));
457 QString name = s + " " + QString::number(size); 455 QString name = s + " " + QString::number(size);
458 fonts.append(new VTFont(name, f, familyNames[j], familyNum, size)); 456 fonts.append(new VTFont(name, f, familyNames[j], familyNum, size));
459 if (familyNames[j] == cfgFontName && size == cfgFontSize) 457 if (familyNames[j] == cfgFontName && size == cfgFontSize)
460 { 458 {
461 cfont = fontIndex; 459 cfont = fontIndex;
462 } 460 }
463 printf("FOUND: %s family %s size %d\n", name.latin1(), familyNames[j].latin1(), size); 461 printf("FOUND: %s family %s size %d\n", name.latin1(), familyNames[j].latin1(), size);
464 fontIndex++; 462 fontIndex++;
465 } 463 }
466 } 464 }
467 if (sizeMenu) 465 if (sizeMenu)
468 { 466 {
469 fontList->insertItem(s, sizeMenu, familyNum + 1000); 467 fontList->insertItem(s, sizeMenu, familyNum + 1000);
470 468
471 familyNum++; 469 familyNum++;
472 } 470 }
473 } 471 }
474 472
475 } 473 }
476 474
477 if (cfont < 0 || cfont >= (int)fonts.count()) 475 if (cfont < 0 || cfont >= (int)fonts.count())
478 { 476 {
479 cfont = 0; 477 cfont = 0;
480 } 478 }
481 479
482 // create terminal emulation framework //////////////////////////////////// 480 // create terminal emulation framework ////////////////////////////////////
483 nsessions = 0; 481 nsessions = 0;
484 482
485 tab = new EKNumTabWidget(this); 483 tab = new EKNumTabWidget(this);
486 // tab->setMargin(tab->margin()-5); 484 // tab->setMargin(tab->margin()-5);
487 connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*))); 485 connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*)));
488 486
489 // create terminal toolbar //////////////////////////////////////////////// 487 // create terminal toolbar ////////////////////////////////////////////////
490 setToolBarsMovable( FALSE ); 488 setToolBarsMovable( FALSE );
491 menuToolBar = new QToolBar( this ); 489 menuToolBar = new QToolBar( this );
492 menuToolBar->setHorizontalStretchable( TRUE ); 490 menuToolBar->setHorizontalStretchable( TRUE );
493 491
494 QMenuBar *menuBar = new QMenuBar( menuToolBar ); 492 QMenuBar *menuBar = new QMenuBar( menuToolBar );
495 493
496 bool c7xx = false; 494 bool c7xx = false;
497 if (qApp->desktop()->width() > 600 || qApp->desktop()->height() > 600) 495 if (qApp->desktop()->width() > 600 || qApp->desktop()->height() > 600)
498 { 496 {
499 c7xx = true; 497 c7xx = true;
500 } 498 }
501 QFont menuFont; 499 QFont menuFont;
502 menuFont.setPointSize(c7xx? 18 : 10); 500 menuFont.setPointSize(c7xx? 18 : 10);
503 qApp->setFont(menuFont, true); 501 qApp->setFont(menuFont, true);
504 502
505 setFont(cfont); 503 setFont(cfont);
506 504
507 configMenu = new QPopupMenu( this); 505 configMenu = new QPopupMenu( this);
508 colorMenu = new QPopupMenu( this); 506 colorMenu = new QPopupMenu( this);
509 scrollMenu = new QPopupMenu( this); 507 scrollMenu = new QPopupMenu( this);
510 editCommandListMenu = new QPopupMenu( this); 508 editCommandListMenu = new QPopupMenu( this);
511 509
512 configMenu->insertItem(tr("Command List"), editCommandListMenu); 510 configMenu->insertItem(tr("Command List"), editCommandListMenu);
513 511
514 bool listHidden; 512 bool listHidden;
515 cfg.setGroup("Menubar"); 513 cfg.setGroup("Menubar");
516 if( cfg.readEntry("Hidden","FALSE") == "TRUE") 514 if( cfg.readEntry("Hidden","FALSE") == "TRUE")
517 { 515 {
518 ec_cmdlist = editCommandListMenu->insertItem( tr( "Show command list" )); 516 ec_cmdlist = editCommandListMenu->insertItem( tr( "Show command list" ));
519 listHidden=TRUE; 517 listHidden=TRUE;
520 } 518 }
521 else 519 else
522 { 520 {
523 ec_cmdlist = editCommandListMenu->insertItem( tr( "Hide command list" )); 521 ec_cmdlist = editCommandListMenu->insertItem( tr( "Hide command list" ));
524 listHidden=FALSE; 522 listHidden=FALSE;
525 } 523 }
526 524
527 cfg.setGroup("Tabs"); 525 cfg.setGroup("Tabs");
528 526
529 tabMenu = new QPopupMenu(this); 527 tabMenu = new QPopupMenu(this);
530 tm_bottom = tabMenu->insertItem(tr("Bottom" )); 528 tm_bottom = tabMenu->insertItem(tr("Bottom" ));
531 tm_top = tabMenu->insertItem(tr("Top")); 529 tm_top = tabMenu->insertItem(tr("Top"));
532 tm_hidden = tabMenu->insertItem(tr("Hidden")); 530 tm_hidden = tabMenu->insertItem(tr("Hidden"));
533 531
534 configMenu->insertItem(tr("Tabs"), tabMenu); 532 configMenu->insertItem(tr("Tabs"), tabMenu);
535 533
536 tmp=cfg.readEntry("Position","Top"); 534 tmp=cfg.readEntry("Position","Top");
537 if(tmp=="Top") 535 if(tmp=="Top")
538 { 536 {
539 tab->setTabPosition(QTabWidget::Top); 537 tab->setTabPosition(QTabWidget::Top);
540 tab->getTabBar()->show(); 538 tab->getTabBar()->show();
541 tabPos = tm_top; 539 tabPos = tm_top;
542 } 540 }
543 else if (tmp=="Bottom") 541 else if (tmp=="Bottom")
544 { 542 {
545 tab->setTabPosition(QTabWidget::Bottom); 543 tab->setTabPosition(QTabWidget::Bottom);
546 tab->getTabBar()->show(); 544 tab->getTabBar()->show();
547 tabPos = tm_bottom; 545 tabPos = tm_bottom;
548 } 546 }
549 else 547 else
550 { 548 {
551 tab->getTabBar()->hide(); 549 tab->getTabBar()->hide();
552 tab->setMargin(tab->margin()); 550 tab->setMargin(tab->margin());
553 tabPos = tm_hidden; 551 tabPos = tm_hidden;
554 } 552 }
555 553
556 cm_bw = colorMenu->insertItem(tr( "Black on White")); 554 cm_bw = colorMenu->insertItem(tr( "Black on White"));
557 cm_wb = colorMenu->insertItem(tr( "White on Black")); 555 cm_wb = colorMenu->insertItem(tr( "White on Black"));
558 cm_gb = colorMenu->insertItem(tr( "Green on Black")); 556 cm_gb = colorMenu->insertItem(tr( "Green on Black"));
559 // cm_bt = colorMenu->insertItem(tr( "Black on Transparent")); 557 // cm_bt = colorMenu->insertItem(tr( "Black on Transparent"));
560 cm_br = colorMenu->insertItem(tr( "Black on Pink")); 558 cm_br = colorMenu->insertItem(tr( "Black on Pink"));
561 cm_rb = colorMenu->insertItem(tr( "Pink on Black")); 559 cm_rb = colorMenu->insertItem(tr( "Pink on Black"));
562 cm_gy = colorMenu->insertItem(tr( "Green on Yellow")); 560 cm_gy = colorMenu->insertItem(tr( "Green on Yellow"));
563 cm_bm = colorMenu->insertItem(tr( "Blue on Magenta")); 561 cm_bm = colorMenu->insertItem(tr( "Blue on Magenta"));
564 cm_mb = colorMenu->insertItem(tr( "Magenta on Blue")); 562 cm_mb = colorMenu->insertItem(tr( "Magenta on Blue"));