summaryrefslogtreecommitdiff
authordrw <drw>2004-04-06 15:52:02 (UTC)
committer drw <drw>2004-04-06 15:52:02 (UTC)
commit31a82304d62ab4943c0926c35cce552e2164eaf4 (patch) (unidiff)
tree9c87a50ef57475a765dc16c26100372026dbdda2
parente97648cdac8aba383e69e87c2d60644eb3bcc18d (diff)
downloadopie-31a82304d62ab4943c0926c35cce552e2164eaf4.zip
opie-31a82304d62ab4943c0926c35cce552e2164eaf4.tar.gz
opie-31a82304d62ab4943c0926c35cce552e2164eaf4.tar.bz2
Do not override menu font size, use font as defined in Appearance settings, and fixed compiler warning
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/TEWidget.cpp4
-rw-r--r--core/apps/embeddedkonsole/konsole.cpp9
2 files changed, 2 insertions, 11 deletions
diff --git a/core/apps/embeddedkonsole/TEWidget.cpp b/core/apps/embeddedkonsole/TEWidget.cpp
index cc88555..93348f4 100644
--- a/core/apps/embeddedkonsole/TEWidget.cpp
+++ b/core/apps/embeddedkonsole/TEWidget.cpp
@@ -764,97 +764,97 @@ void TEWidget::mouseMoveEvent(QMouseEvent* ev)
764 pntSel.y() == iPntSel.y() && pntSel.x() < iPntSel.x() ); 764 pntSel.y() == iPntSel.y() && pntSel.x() < iPntSel.x() );
765 swapping = left_not_right != old_left_not_right; 765 swapping = left_not_right != old_left_not_right;
766 766
767 // Find left (left_not_right ? from here : from start) 767 // Find left (left_not_right ? from here : from start)
768 QPoint left = left_not_right ? here : iPntSel; 768 QPoint left = left_not_right ? here : iPntSel;
769 i = loc(left.x(),left.y()); 769 i = loc(left.x(),left.y());
770 selClass = charClass(image[i].c); 770 selClass = charClass(image[i].c);
771 while ( left.x() > 0 && charClass(image[i-1].c) == selClass ) 771 while ( left.x() > 0 && charClass(image[i-1].c) == selClass )
772 { i--; left.rx()--; } 772 { i--; left.rx()--; }
773 773
774 // Find left (left_not_right ? from start : from here) 774 // Find left (left_not_right ? from start : from here)
775 QPoint right = left_not_right ? iPntSel : here; 775 QPoint right = left_not_right ? iPntSel : here;
776 i = loc(right.x(),right.y()); 776 i = loc(right.x(),right.y());
777 selClass = charClass(image[i].c); 777 selClass = charClass(image[i].c);
778 while ( right.x() < columns-1 && charClass(image[i+1].c) == selClass ) 778 while ( right.x() < columns-1 && charClass(image[i+1].c) == selClass )
779 { i++; right.rx()++; } 779 { i++; right.rx()++; }
780 780
781 // Pick which is start (ohere) and which is extension (here) 781 // Pick which is start (ohere) and which is extension (here)
782 if ( left_not_right ) 782 if ( left_not_right )
783 { 783 {
784 here = left; ohere = right; 784 here = left; ohere = right;
785 } 785 }
786 else 786 else
787 { 787 {
788 here = right; ohere = left; 788 here = right; ohere = left;
789 } 789 }
790 } 790 }
791 791
792 if (here == pntSel && scroll == scrollbar->value()) return; // not moved 792 if (here == pntSel && scroll == scrollbar->value()) return; // not moved
793 793
794 if ( word_selection_mode ) { 794 if ( word_selection_mode ) {
795 if ( actSel < 2 || swapping ) { 795 if ( actSel < 2 || swapping ) {
796 emit beginSelectionSignal( ohere.x(), ohere.y() ); 796 emit beginSelectionSignal( ohere.x(), ohere.y() );
797 } 797 }
798 } else if ( actSel < 2 ) { 798 } else if ( actSel < 2 ) {
799 emit beginSelectionSignal( pntSel.x(), pntSel.y() ); 799 emit beginSelectionSignal( pntSel.x(), pntSel.y() );
800 } 800 }
801 801
802 actSel = 2; // within selection 802 actSel = 2; // within selection
803 pntSel = here; 803 pntSel = here;
804 emit extendSelectionSignal( here.x(), here.y() ); 804 emit extendSelectionSignal( here.x(), here.y() );
805} 805}
806 806
807void TEWidget::mouseReleaseEvent(QMouseEvent* ev) 807void TEWidget::mouseReleaseEvent(QMouseEvent* ev)
808{ 808{
809//printf("release [%d,%d] %d\n",ev->x()/font_w,ev->y()/font_h,ev->button()); 809//printf("release [%d,%d] %d\n",ev->x()/font_w,ev->y()/font_h,ev->button());
810 if ( ev->button() == LeftButton) 810 if ( ev->button() == LeftButton)
811 { 811 {
812 if (QABS(ev->x() - mouse_down_x) < 3 812 if (QABS(ev->x() - mouse_down_x) < 3
813 && QABS(ev->y() - mouse_down_y) < 3 813 && QABS(ev->y() - mouse_down_y) < 3
814 && ev->y() < qApp->desktop()->height()/8) { 814 && ev->y() < qApp->desktop()->height()/8) {
815 emit setFullScreen(false); 815 emit setFullScreen(false);
816 } 816 }
817 817
818 if ( actSel > 1 ) emit endSelectionSignal(preserve_line_breaks); 818 if ( actSel > 1 ) emit endSelectionSignal(preserve_line_breaks);
819 preserve_line_breaks = TRUE; 819 preserve_line_breaks = TRUE;
820 actSel = 0; 820 actSel = 0;
821 821
822 //FIXME: emits a release event even if the mouse is 822 //FIXME: emits a release event even if the mouse is
823 // outside the range. The procedure used in `mouseMoveEvent' 823 // outside the range. The procedure used in `mouseMoveEvent'
824 // applies here, too. 824 // applies here, too.
825 825
826 QPoint tL = contentsRect().topLeft(); 826 QPoint tL = contentsRect().topLeft();
827 int tLx = tL.x(); 827 int tLx = tL.x();
828 int tLy = tL.y(); 828 int tLy = tL.y();
829 829
830 if (!mouse_marks && !(ev->state() & ShiftButton)) 830 if (!mouse_marks && !(ev->state() & ShiftButton))
831 emit mouseSignal( 3, // release 831 emit mouseSignal( 3, // release
832 (ev->x()-tLx-blX)/font_w + 1, 832 (ev->x()-tLx-blX)/font_w + 1,
833 (ev->y()-tLy-bY)/font_h + 1 ); 833 (ev->y()-tLy-bY)/font_h + 1 );
834 releaseMouse(); 834 releaseMouse();
835 } 835 }
836} 836}
837 837
838void TEWidget::mouseDoubleClickEvent(QMouseEvent* ev) 838void TEWidget::mouseDoubleClickEvent(QMouseEvent* ev)
839{ 839{
840 if ( ev->button() != LeftButton) return; 840 if ( ev->button() != LeftButton) return;
841 841
842 QPoint tL = contentsRect().topLeft(); 842 QPoint tL = contentsRect().topLeft();
843 int tLx = tL.x(); 843 int tLx = tL.x();
844 int tLy = tL.y(); 844 int tLy = tL.y();
845 QPoint pos = QPoint((ev->x()-tLx-blX)/font_w,(ev->y()-tLy-bY)/font_h); 845 QPoint pos = QPoint((ev->x()-tLx-blX)/font_w,(ev->y()-tLy-bY)/font_h);
846 846
847 // pass on double click as two clicks. 847 // pass on double click as two clicks.
848 if (!mouse_marks && !(ev->state() & ShiftButton)) 848 if (!mouse_marks && !(ev->state() & ShiftButton))
849 { 849 {
850 emit mouseSignal( 0, pos.x()+1, pos.y()+1 ); // left button 850 emit mouseSignal( 0, pos.x()+1, pos.y()+1 ); // left button
851 emit mouseSignal( 3, pos.x()+1, pos.y()+1 ); // release 851 emit mouseSignal( 3, pos.x()+1, pos.y()+1 ); // release
852 emit mouseSignal( 0, pos.x()+1, pos.y()+1 ); // left button 852 emit mouseSignal( 0, pos.x()+1, pos.y()+1 ); // left button
853 return; 853 return;
854 } 854 }
855 855
856 856
857 emit clearSelectionSignal(); 857 emit clearSelectionSignal();
858 QPoint bgnSel = pos; 858 QPoint bgnSel = pos;
859 QPoint endSel = QPoint((ev->x()-tLx-blX)/font_w,(ev->y()-tLy-bY)/font_h); 859 QPoint endSel = QPoint((ev->x()-tLx-blX)/font_w,(ev->y()-tLy-bY)/font_h);
860 int i = loc(bgnSel.x(),bgnSel.y()); 860 int i = loc(bgnSel.x(),bgnSel.y());
@@ -1344,86 +1344,86 @@ void TEWidget::dropEvent(QDropEvent* event)
1344 int file_count = 0; 1344 int file_count = 0;
1345 dropText = ""; 1345 dropText = "";
1346 bool bPopup = true; 1346 bool bPopup = true;
1347 1347
1348 if(QUriDrag::decode(event, strlist)) { 1348 if(QUriDrag::decode(event, strlist)) {
1349 if (strlist.count()) { 1349 if (strlist.count()) {
1350 for(const char* p = strlist.first(); p; p = strlist.next()) { 1350 for(const char* p = strlist.first(); p; p = strlist.next()) {
1351 if(file_count++ > 0) { 1351 if(file_count++ > 0) {
1352 dropText += " "; 1352 dropText += " ";
1353 bPopup = false; // more than one file, don't popup 1353 bPopup = false; // more than one file, don't popup
1354 } 1354 }
1355 1355
1356/* 1356/*
1357 KURL url(p); 1357 KURL url(p);
1358 if (url.isLocalFile()) { 1358 if (url.isLocalFile()) {
1359 dropText += url.path(); // local URL : remove protocol 1359 dropText += url.path(); // local URL : remove protocol
1360 } 1360 }
1361 else { 1361 else {
1362 dropText += url.prettyURL(); 1362 dropText += url.prettyURL();
1363 bPopup = false; // a non-local file, don't popup 1363 bPopup = false; // a non-local file, don't popup
1364 } 1364 }
1365*/ 1365*/
1366 1366
1367 } 1367 }
1368 1368
1369 if (bPopup) 1369 if (bPopup)
1370 // m_drop->popup(pos() + event->pos()); 1370 // m_drop->popup(pos() + event->pos());
1371 m_drop->popup(mapToGlobal(event->pos())); 1371 m_drop->popup(mapToGlobal(event->pos()));
1372 else 1372 else
1373 { 1373 {
1374 if (currentSession) { 1374 if (currentSession) {
1375 currentSession->getEmulation()->sendString(dropText.local8Bit()); 1375 currentSession->getEmulation()->sendString(dropText.local8Bit());
1376 } 1376 }
1377// kdDebug() << "Drop:" << dropText.local8Bit() << "\n"; 1377// kdDebug() << "Drop:" << dropText.local8Bit() << "\n";
1378 } 1378 }
1379 } 1379 }
1380 } 1380 }
1381 else if(QTextDrag::decode(event, dropText)) { 1381 else if(QTextDrag::decode(event, dropText)) {
1382// kdDebug() << "Drop:" << dropText.local8Bit() << "\n"; 1382// kdDebug() << "Drop:" << dropText.local8Bit() << "\n";
1383 if (currentSession) { 1383 if (currentSession) {
1384 currentSession->getEmulation()->sendString(dropText.local8Bit()); 1384 currentSession->getEmulation()->sendString(dropText.local8Bit());
1385 } 1385 }
1386 // Paste it 1386 // Paste it
1387 } 1387 }
1388} 1388}
1389#endif 1389#endif
1390 1390
1391 1391
1392void TEWidget::drop_menu_activated(int item) 1392void TEWidget::drop_menu_activated(int /*item*/)
1393{ 1393{
1394#ifndef QT_NO_DRAGANDDROP 1394#ifndef QT_NO_DRAGANDDROP
1395 switch (item) 1395 switch (item)
1396 { 1396 {
1397 case 0: // paste 1397 case 0: // paste
1398 currentSession->getEmulation()->sendString(dropText.local8Bit()); 1398 currentSession->getEmulation()->sendString(dropText.local8Bit());
1399// KWM::activate((Window)this->winId()); 1399// KWM::activate((Window)this->winId());
1400 break; 1400 break;
1401 case 1: // cd ... 1401 case 1: // cd ...
1402 currentSession->getEmulation()->sendString("cd "); 1402 currentSession->getEmulation()->sendString("cd ");
1403 struct stat statbuf; 1403 struct stat statbuf;
1404 if ( ::stat( QFile::encodeName( dropText ), &statbuf ) == 0 ) 1404 if ( ::stat( QFile::encodeName( dropText ), &statbuf ) == 0 )
1405 { 1405 {
1406 if ( !S_ISDIR(statbuf.st_mode) ) 1406 if ( !S_ISDIR(statbuf.st_mode) )
1407 { 1407 {
1408/* 1408/*
1409 KURL url; 1409 KURL url;
1410 url.setPath( dropText ); 1410 url.setPath( dropText );
1411 dropText = url.directory( true, false ); // remove filename 1411 dropText = url.directory( true, false ); // remove filename
1412*/ 1412*/
1413 } 1413 }
1414 } 1414 }
1415 dropText.replace(QRegExp(" "), "\\ "); // escape spaces 1415 dropText.replace(QRegExp(" "), "\\ "); // escape spaces
1416 currentSession->getEmulation()->sendString(dropText.local8Bit()); 1416 currentSession->getEmulation()->sendString(dropText.local8Bit());
1417 currentSession->getEmulation()->sendString("\n"); 1417 currentSession->getEmulation()->sendString("\n");
1418// KWM::activate((Window)this->winId()); 1418// KWM::activate((Window)this->winId());
1419 break; 1419 break;
1420 } 1420 }
1421#endif 1421#endif
1422} 1422}
1423 1423
1424void TEWidget::setWrapAt(int columns) 1424void TEWidget::setWrapAt(int columns)
1425{ 1425{
1426 vcolumns = columns; 1426 vcolumns = columns;
1427 propagateSize(); 1427 propagateSize();
1428 update(); 1428 update();
1429} 1429}
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp
index c5df47f..cbea7bd 100644
--- a/core/apps/embeddedkonsole/konsole.cpp
+++ b/core/apps/embeddedkonsole/konsole.cpp
@@ -465,105 +465,96 @@ void Konsole::init(const char* _pgm, QStrList & _args)
465 last_width = fm.width("m"); 465 last_width = fm.width("m");
466 } 466 }
467 if (sizeMenu == NULL) 467 if (sizeMenu == NULL)
468 { 468 {
469 sizeMenu = new QPopupMenu(); 469 sizeMenu = new QPopupMenu();
470 } 470 }
471 int id = sizeMenu->insertItem(QString("%1").arg(size), fontIndex); 471 int id = sizeMenu->insertItem(QString("%1").arg(size), fontIndex);
472 sizeMenu->setItemParameter(id, fontIndex); 472 sizeMenu->setItemParameter(id, fontIndex);
473 sizeMenu->connectItem(id, this, SLOT(setFont(int))); 473 sizeMenu->connectItem(id, this, SLOT(setFont(int)));
474 QString name = s + " " + QString::number(size); 474 QString name = s + " " + QString::number(size);
475 fonts.append(new VTFont(name, f, familyNames[j], familyNum, size)); 475 fonts.append(new VTFont(name, f, familyNames[j], familyNum, size));
476 if (familyNames[j] == cfgFontName && size == cfgFontSize) 476 if (familyNames[j] == cfgFontName && size == cfgFontSize)
477 { 477 {
478 cfont = fontIndex; 478 cfont = fontIndex;
479 } 479 }
480 printf("FOUND: %s family %s size %d\n", name.latin1(), familyNames[j].latin1(), size); 480 printf("FOUND: %s family %s size %d\n", name.latin1(), familyNames[j].latin1(), size);
481 fontIndex++; 481 fontIndex++;
482 } 482 }
483 } 483 }
484 if (sizeMenu) 484 if (sizeMenu)
485 { 485 {
486 fontList->insertItem(s, sizeMenu, familyNum + 1000); 486 fontList->insertItem(s, sizeMenu, familyNum + 1000);
487 487
488 familyNum++; 488 familyNum++;
489 } 489 }
490 } 490 }
491 491
492 } 492 }
493 493
494 if (cfont < 0 || cfont >= (int)fonts.count()) 494 if (cfont < 0 || cfont >= (int)fonts.count())
495 { 495 {
496 cfont = 0; 496 cfont = 0;
497 } 497 }
498 498
499 // create terminal emulation framework //////////////////////////////////// 499 // create terminal emulation framework ////////////////////////////////////
500 nsessions = 0; 500 nsessions = 0;
501 501
502 tab = new EKNumTabWidget(this); 502 tab = new EKNumTabWidget(this);
503 // tab->setMargin(tab->margin()-5); 503 // tab->setMargin(tab->margin()-5);
504 connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*))); 504 connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*)));
505 505
506 // create terminal toolbar //////////////////////////////////////////////// 506 // create terminal toolbar ////////////////////////////////////////////////
507 setToolBarsMovable( FALSE ); 507 setToolBarsMovable( FALSE );
508 menuToolBar = new QToolBar( this ); 508 menuToolBar = new QToolBar( this );
509 menuToolBar->setHorizontalStretchable( TRUE ); 509 menuToolBar->setHorizontalStretchable( TRUE );
510 510
511 QMenuBar *menuBar = new QMenuBar( menuToolBar ); 511 QMenuBar *menuBar = new QMenuBar( menuToolBar );
512 512
513 bool c7xx = false;
514 if (qApp->desktop()->width() > 600 || qApp->desktop()->height() > 600)
515 {
516 c7xx = true;
517 }
518 QFont menuFont;
519 menuFont.setPointSize(c7xx? 18 : 10);
520 qApp->setFont(menuFont, true);
521
522 setFont(cfont); 513 setFont(cfont);
523 514
524 configMenu = new QPopupMenu( this); 515 configMenu = new QPopupMenu( this);
525 colorMenu = new QPopupMenu( this); 516 colorMenu = new QPopupMenu( this);
526 scrollMenu = new QPopupMenu( this); 517 scrollMenu = new QPopupMenu( this);
527 editCommandListMenu = new QPopupMenu( this); 518 editCommandListMenu = new QPopupMenu( this);
528 519
529 configMenu->insertItem(tr("Command List"), editCommandListMenu); 520 configMenu->insertItem(tr("Command List"), editCommandListMenu);
530 521
531 bool listHidden; 522 bool listHidden;
532 cfg.setGroup("Menubar"); 523 cfg.setGroup("Menubar");
533 if( cfg.readEntry("Hidden","FALSE") == "TRUE") 524 if( cfg.readEntry("Hidden","FALSE") == "TRUE")
534 { 525 {
535 ec_cmdlist = editCommandListMenu->insertItem( tr( "Show command list" )); 526 ec_cmdlist = editCommandListMenu->insertItem( tr( "Show command list" ));
536 listHidden=TRUE; 527 listHidden=TRUE;
537 } 528 }
538 else 529 else
539 { 530 {
540 ec_cmdlist = editCommandListMenu->insertItem( tr( "Hide command list" )); 531 ec_cmdlist = editCommandListMenu->insertItem( tr( "Hide command list" ));
541 listHidden=FALSE; 532 listHidden=FALSE;
542 } 533 }
543 534
544 cfg.setGroup("Tabs"); 535 cfg.setGroup("Tabs");
545 536
546 tabMenu = new QPopupMenu(this); 537 tabMenu = new QPopupMenu(this);
547 tm_bottom = tabMenu->insertItem(tr("Bottom" )); 538 tm_bottom = tabMenu->insertItem(tr("Bottom" ));
548 tm_top = tabMenu->insertItem(tr("Top")); 539 tm_top = tabMenu->insertItem(tr("Top"));
549 tm_hidden = tabMenu->insertItem(tr("Hidden")); 540 tm_hidden = tabMenu->insertItem(tr("Hidden"));
550 541
551 configMenu->insertItem(tr("Tabs"), tabMenu); 542 configMenu->insertItem(tr("Tabs"), tabMenu);
552 543
553 tmp=cfg.readEntry("Position","Top"); 544 tmp=cfg.readEntry("Position","Top");
554 if(tmp=="Top") 545 if(tmp=="Top")
555 { 546 {
556 tab->setTabPosition(QTabWidget::Top); 547 tab->setTabPosition(QTabWidget::Top);
557 tab->getTabBar()->show(); 548 tab->getTabBar()->show();
558 tabPos = tm_top; 549 tabPos = tm_top;
559 } 550 }
560 else if (tmp=="Bottom") 551 else if (tmp=="Bottom")
561 { 552 {
562 tab->setTabPosition(QTabWidget::Bottom); 553 tab->setTabPosition(QTabWidget::Bottom);
563 tab->getTabBar()->show(); 554 tab->getTabBar()->show();
564 tabPos = tm_bottom; 555 tabPos = tm_bottom;
565 } 556 }
566 else 557 else
567 { 558 {
568 tab->getTabBar()->hide(); 559 tab->getTabBar()->hide();
569 tab->setMargin(tab->margin()); 560 tab->setMargin(tab->margin());