summaryrefslogtreecommitdiff
authorzecke <zecke>2004-10-13 19:50:45 (UTC)
committer zecke <zecke>2004-10-13 19:50:45 (UTC)
commit2e51b60e861912fa525597f6b9de6b83c9cedf94 (patch) (unidiff)
treec212077850c4cdf9570f7d47bb2805fe33d6bfe6
parent43fdc7bdf61f0e16be759c4083bd340afcf826f8 (diff)
downloadopie-2e51b60e861912fa525597f6b9de6b83c9cedf94.zip
opie-2e51b60e861912fa525597f6b9de6b83c9cedf94.tar.gz
opie-2e51b60e861912fa525597f6b9de6b83c9cedf94.tar.bz2
Remove odebug/owarn
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/widget.cpp5
1 files changed, 0 insertions, 5 deletions
diff --git a/noncore/apps/opie-console/widget.cpp b/noncore/apps/opie-console/widget.cpp
index c51983f..4a578be 100644
--- a/noncore/apps/opie-console/widget.cpp
+++ b/noncore/apps/opie-console/widget.cpp
@@ -870,300 +870,295 @@ void Widget::focusOutEvent( QFocusEvent * )
870} 870}
871 871
872bool Widget::focusNextPrevChild( bool next ) 872bool Widget::focusNextPrevChild( bool next )
873{ 873{
874 if (next) 874 if (next)
875 return false; // This disables changing the active part in konqueror 875 return false; // This disables changing the active part in konqueror
876 // when pressing Tab 876 // when pressing Tab
877 return QFrame::focusNextPrevChild( next ); 877 return QFrame::focusNextPrevChild( next );
878} 878}
879 879
880 880
881int Widget::charClass(char ch) const 881int Widget::charClass(char ch) const
882{ 882{
883 // This might seem like overkill, but imagine if ch was a Unicode 883 // This might seem like overkill, but imagine if ch was a Unicode
884 // character (Qt 2.0 QChar) - it might then be sensible to separate 884 // character (Qt 2.0 QChar) - it might then be sensible to separate
885 // the different language ranges, etc. 885 // the different language ranges, etc.
886 886
887 if ( isspace(ch) ) return ' '; 887 if ( isspace(ch) ) return ' ';
888 888
889 static const char *word_characters = ":@-./_~"; 889 static const char *word_characters = ":@-./_~";
890 if ( isalnum(ch) || strchr(word_characters, ch) ) 890 if ( isalnum(ch) || strchr(word_characters, ch) )
891 return 'a'; 891 return 'a';
892 892
893 // Everything else is weird 893 // Everything else is weird
894 return 1; 894 return 1;
895} 895}
896 896
897void Widget::setMouseMarks(bool on) 897void Widget::setMouseMarks(bool on)
898{ 898{
899 mouse_marks = on; 899 mouse_marks = on;
900 setCursor( mouse_marks ? ibeamCursor : arrowCursor ); 900 setCursor( mouse_marks ? ibeamCursor : arrowCursor );
901} 901}
902 902
903/* ------------------------------------------------------------------------- */ 903/* ------------------------------------------------------------------------- */
904/* */ 904/* */
905/* Clipboard */ 905/* Clipboard */
906/* */ 906/* */
907/* ------------------------------------------------------------------------- */ 907/* ------------------------------------------------------------------------- */
908 908
909#undef KeyPress 909#undef KeyPress
910 910
911void Widget::emitSelection() 911void Widget::emitSelection()
912// Paste Clipboard by simulating keypress events 912// Paste Clipboard by simulating keypress events
913{ 913{
914#ifndef QT_NO_CLIPBOARD 914#ifndef QT_NO_CLIPBOARD
915 QString text = QApplication::clipboard()->text(); 915 QString text = QApplication::clipboard()->text();
916 if ( ! text.isNull() ) 916 if ( ! text.isNull() )
917 { 917 {
918 text.replace(QRegExp("\n"), "\r"); 918 text.replace(QRegExp("\n"), "\r");
919 QKeyEvent e(QEvent::KeyPress, 0, -1, 0, text); 919 QKeyEvent e(QEvent::KeyPress, 0, -1, 0, text);
920 emit keyPressedSignal(&e); // expose as a big fat keypress event 920 emit keyPressedSignal(&e); // expose as a big fat keypress event
921 emit clearSelectionSignal(); 921 emit clearSelectionSignal();
922 } 922 }
923#endif 923#endif
924} 924}
925 925
926void Widget::emitText(QString text) 926void Widget::emitText(QString text)
927{ 927{
928 QKeyEvent e(QEvent::KeyPress, 0, -1, 0, text); 928 QKeyEvent e(QEvent::KeyPress, 0, -1, 0, text);
929 emit keyPressedSignal(&e); // expose as a big fat keypress event 929 emit keyPressedSignal(&e); // expose as a big fat keypress event
930} 930}
931 931
932void Widget::pasteClipboard( ) 932void Widget::pasteClipboard( )
933{ 933{
934 emitSelection(); 934 emitSelection();
935} 935}
936 936
937void Widget::setSelection(const QString& t) 937void Widget::setSelection(const QString& t)
938{ 938{
939#ifndef QT_NO_CLIPBOARD 939#ifndef QT_NO_CLIPBOARD
940 // Disconnect signal while WE set the clipboard 940 // Disconnect signal while WE set the clipboard
941 QObject *cb = QApplication::clipboard(); 941 QObject *cb = QApplication::clipboard();
942 QObject::disconnect( cb, SIGNAL(dataChanged()), 942 QObject::disconnect( cb, SIGNAL(dataChanged()),
943 this, SLOT(onClearSelection()) ); 943 this, SLOT(onClearSelection()) );
944 944
945 QApplication::clipboard()->setText(t); 945 QApplication::clipboard()->setText(t);
946 946
947 QObject::connect( cb, SIGNAL(dataChanged()), 947 QObject::connect( cb, SIGNAL(dataChanged()),
948 this, SLOT(onClearSelection()) ); 948 this, SLOT(onClearSelection()) );
949#endif 949#endif
950} 950}
951 951
952void Widget::onClearSelection() 952void Widget::onClearSelection()
953{ 953{
954 emit clearSelectionSignal(); 954 emit clearSelectionSignal();
955} 955}
956 956
957/* ------------------------------------------------------------------------- */ 957/* ------------------------------------------------------------------------- */
958/* */ 958/* */
959/* Keyboard */ 959/* Keyboard */
960/* */ 960/* */
961/* ------------------------------------------------------------------------- */ 961/* ------------------------------------------------------------------------- */
962 962
963//FIXME: an `eventFilter' has been installed instead of a `keyPressEvent' 963//FIXME: an `eventFilter' has been installed instead of a `keyPressEvent'
964// due to a bug in `QT' or the ignorance of the author to prevent 964// due to a bug in `QT' or the ignorance of the author to prevent
965// repaint events being emitted to the screen whenever one leaves 965// repaint events being emitted to the screen whenever one leaves
966// or reenters the screen to/from another application. 966// or reenters the screen to/from another application.
967// 967//
968// Troll says one needs to change focusInEvent() and focusOutEvent(), 968// Troll says one needs to change focusInEvent() and focusOutEvent(),
969// which would also let you have an in-focus cursor and an out-focus 969// which would also let you have an in-focus cursor and an out-focus
970// cursor like xterm does. 970// cursor like xterm does.
971 971
972// for the auto-hide cursor feature, I added empty focusInEvent() and 972// for the auto-hide cursor feature, I added empty focusInEvent() and
973// focusOutEvent() so that update() isn't called. 973// focusOutEvent() so that update() isn't called.
974// For auto-hide, we need to get keypress-events, but we only get them when 974// For auto-hide, we need to get keypress-events, but we only get them when
975// we have focus. 975// we have focus.
976 976
977void Widget::doScroll(int lines) 977void Widget::doScroll(int lines)
978{ 978{
979 scrollbar->setValue(scrollbar->value()+lines); 979 scrollbar->setValue(scrollbar->value()+lines);
980} 980}
981 981
982bool Widget::eventFilter( QObject *obj, QEvent *e ) 982bool Widget::eventFilter( QObject *obj, QEvent *e )
983{ 983{
984 if ( (e->type() == QEvent::Accel || 984 if ( (e->type() == QEvent::Accel ||
985 e->type() == QEvent::AccelAvailable ) && qApp->focusWidget() == this ) { 985 e->type() == QEvent::AccelAvailable ) && qApp->focusWidget() == this ) {
986 static_cast<QKeyEvent *>( e )->ignore(); 986 static_cast<QKeyEvent *>( e )->ignore();
987 return true; 987 return true;
988 } 988 }
989 if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ ) 989 if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ )
990 return FALSE; // not us 990 return FALSE; // not us
991 if ( e->type() == QEvent::Wheel) { 991 if ( e->type() == QEvent::Wheel) {
992 QApplication::sendEvent(scrollbar, e); 992 QApplication::sendEvent(scrollbar, e);
993 } 993 }
994 994
995#ifdef FAKE_CTRL_AND_ALT 995#ifdef FAKE_CTRL_AND_ALT
996 static bool control = FALSE; 996 static bool control = FALSE;
997 static bool alt = FALSE; 997 static bool alt = FALSE;
998// odebug << " Has a keyboard with no CTRL and ALT keys, but we fake it:" << oendl;
999 bool dele=FALSE; 998 bool dele=FALSE;
1000 if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { 999 if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) {
1001 QKeyEvent* ke = (QKeyEvent*)e; 1000 QKeyEvent* ke = (QKeyEvent*)e;
1002 bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat(); 1001 bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat();
1003 switch (ke->key()) { 1002 switch (ke->key()) {
1004 case Key_F9: // let this be "Control" 1003 case Key_F9: // let this be "Control"
1005 control = keydown; 1004 control = keydown;
1006 e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state()); 1005 e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state());
1007 dele=TRUE; 1006 dele=TRUE;
1008 break; 1007 break;
1009 case Key_F13: // let this be "Alt" 1008 case Key_F13: // let this be "Alt"
1010 alt = keydown; 1009 alt = keydown;
1011 e = new QKeyEvent(QEvent::KeyPress, Key_Alt, 0, ke->state()); 1010 e = new QKeyEvent(QEvent::KeyPress, Key_Alt, 0, ke->state());
1012 dele=TRUE; 1011 dele=TRUE;
1013 break; 1012 break;
1014 default: 1013 default:
1015 if ( control ) { 1014 if ( control ) {
1016 int a = toupper(ke->ascii())-64; 1015 int a = toupper(ke->ascii())-64;
1017 if ( a >= 0 && a < ' ' ) { 1016 if ( a >= 0 && a < ' ' ) {
1018 e = new QKeyEvent(e->type(), ke->key(), 1017 e = new QKeyEvent(e->type(), ke->key(),
1019 a, ke->state()|ControlButton, QChar(a,0)); 1018 a, ke->state()|ControlButton, QChar(a,0));
1020 dele=TRUE; 1019 dele=TRUE;
1021 } 1020 }
1022 } 1021 }
1023 if ( alt ) { 1022 if ( alt ) {
1024 e = new QKeyEvent(e->type(), ke->key(), 1023 e = new QKeyEvent(e->type(), ke->key(),
1025 ke->ascii(), ke->state()|AltButton, ke->text()); 1024 ke->ascii(), ke->state()|AltButton, ke->text());
1026 dele=TRUE; 1025 dele=TRUE;
1027 } 1026 }
1028 } 1027 }
1029 } 1028 }
1030#endif 1029#endif
1031 1030
1032 if ( e->type() == QEvent::KeyPress ) { 1031 if ( e->type() == QEvent::KeyPress ) {
1033 QKeyEvent* ke = (QKeyEvent*)e; 1032 QKeyEvent* ke = (QKeyEvent*)e;
1034 actSel=0; // Key stroke implies a screen update, so Widget won't 1033 actSel=0; // Key stroke implies a screen update, so Widget won't
1035 // know where the current selection is. 1034 // know where the current selection is.
1036 1035
1037// odebug << "key pressed is 0x" << ke->key() << "" << oendl;
1038
1039 if( ke->state() == ShiftButton && ke->key() == Key_Tab) { //lets hardcode this sucker 1036 if( ke->state() == ShiftButton && ke->key() == Key_Tab) { //lets hardcode this sucker
1040
1041// odebug << "key pressed 2 is 0x" << ke->key() << "" << oendl;
1042 emitText("\\"); // expose 1037 emitText("\\"); // expose
1043 } else 1038 } else
1044 emit keyPressedSignal(ke); // expose 1039 emit keyPressedSignal(ke); // expose
1045 ke->accept(); 1040 ke->accept();
1046#ifdef FAKE_CTRL_AND_ALT 1041#ifdef FAKE_CTRL_AND_ALT
1047 if ( dele ) delete e; 1042 if ( dele ) delete e;
1048#endif 1043#endif
1049 return true; // stop the event 1044 return true; // stop the event
1050 } 1045 }
1051 if ( e->type() == QEvent::Enter ) { 1046 if ( e->type() == QEvent::Enter ) {
1052 QObject::disconnect( (QObject*)cb, SIGNAL(dataChanged()), 1047 QObject::disconnect( (QObject*)cb, SIGNAL(dataChanged()),
1053 this, SLOT(onClearSelection()) ); 1048 this, SLOT(onClearSelection()) );
1054 } 1049 }
1055 if ( e->type() == QEvent::Leave ) { 1050 if ( e->type() == QEvent::Leave ) {
1056 QObject::connect( (QObject*)cb, SIGNAL(dataChanged()), 1051 QObject::connect( (QObject*)cb, SIGNAL(dataChanged()),
1057 this, SLOT(onClearSelection()) ); 1052 this, SLOT(onClearSelection()) );
1058 } 1053 }
1059 return QFrame::eventFilter( obj, e ); 1054 return QFrame::eventFilter( obj, e );
1060} 1055}
1061 1056
1062/* ------------------------------------------------------------------------- */ 1057/* ------------------------------------------------------------------------- */
1063/* */ 1058/* */
1064/* Frame */ 1059/* Frame */
1065/* */ 1060/* */
1066/* ------------------------------------------------------------------------- */ 1061/* ------------------------------------------------------------------------- */
1067 1062
1068void Widget::frameChanged() 1063void Widget::frameChanged()
1069{ 1064{
1070 propagateSize(); 1065 propagateSize();
1071 update(); 1066 update();
1072} 1067}
1073 1068
1074/* ------------------------------------------------------------------------- */ 1069/* ------------------------------------------------------------------------- */
1075/* */ 1070/* */
1076/* Sound */ 1071/* Sound */
1077/* */ 1072/* */
1078/* ------------------------------------------------------------------------- */ 1073/* ------------------------------------------------------------------------- */
1079 1074
1080void Widget::Bell() 1075void Widget::Bell()
1081{ 1076{
1082 QApplication::beep(); 1077 QApplication::beep();
1083} 1078}
1084 1079
1085/* ------------------------------------------------------------------------- */ 1080/* ------------------------------------------------------------------------- */
1086/* */ 1081/* */
1087/* Auxiluary */ 1082/* Auxiluary */
1088/* */ 1083/* */
1089/* ------------------------------------------------------------------------- */ 1084/* ------------------------------------------------------------------------- */
1090 1085
1091void Widget::clearImage() 1086void Widget::clearImage()
1092// initialize the image 1087// initialize the image
1093// for internal use only 1088// for internal use only
1094{ 1089{
1095 for (int y = 0; y < lines; y++) 1090 for (int y = 0; y < lines; y++)
1096 for (int x = 0; x < columns; x++) 1091 for (int x = 0; x < columns; x++)
1097 { 1092 {
1098 image[loc(x,y)].c = 0xff; //' '; 1093 image[loc(x,y)].c = 0xff; //' ';
1099 image[loc(x,y)].f = 0xff; //DEFAULT_FORE_COLOR; 1094 image[loc(x,y)].f = 0xff; //DEFAULT_FORE_COLOR;
1100 image[loc(x,y)].b = 0xff; //DEFAULT_BACK_COLOR; 1095 image[loc(x,y)].b = 0xff; //DEFAULT_BACK_COLOR;
1101 image[loc(x,y)].r = 0xff; //DEFAULT_RENDITION; 1096 image[loc(x,y)].r = 0xff; //DEFAULT_RENDITION;
1102 } 1097 }
1103} 1098}
1104 1099
1105// Create Image /////////////////////////////////////////////////////// 1100// Create Image ///////////////////////////////////////////////////////
1106 1101
1107void Widget::calcGeometry() 1102void Widget::calcGeometry()
1108{ 1103{
1109 //FIXME: set rimX == rimY == 0 when running in full screen mode. 1104 //FIXME: set rimX == rimY == 0 when running in full screen mode.
1110 1105
1111 scrollbar->resize(QApplication::style().scrollBarExtent().width(), 1106 scrollbar->resize(QApplication::style().scrollBarExtent().width(),
1112 contentsRect().height()); 1107 contentsRect().height());
1113 switch(scrollLoc) 1108 switch(scrollLoc)
1114 { 1109 {
1115 case SCRNONE : 1110 case SCRNONE :
1116 columns = ( contentsRect().width() - 2 * rimX ) / font_w; 1111 columns = ( contentsRect().width() - 2 * rimX ) / font_w;
1117 blX = (contentsRect().width() - (columns*font_w) ) / 2; 1112 blX = (contentsRect().width() - (columns*font_w) ) / 2;
1118 brX = blX; 1113 brX = blX;
1119 scrollbar->hide(); 1114 scrollbar->hide();
1120 break; 1115 break;
1121 case SCRLEFT : 1116 case SCRLEFT :
1122 columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w; 1117 columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w;
1123 brX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2; 1118 brX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2;
1124 blX = brX + scrollbar->width(); 1119 blX = brX + scrollbar->width();
1125 scrollbar->move(contentsRect().topLeft()); 1120 scrollbar->move(contentsRect().topLeft());
1126 scrollbar->show(); 1121 scrollbar->show();
1127 break; 1122 break;
1128 case SCRRIGHT: 1123 case SCRRIGHT:
1129 columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w; 1124 columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w;
1130 blX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2; 1125 blX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2;
1131 brX = blX; 1126 brX = blX;
1132 scrollbar->move(contentsRect().topRight() - QPoint(scrollbar->width()-1,0)); 1127 scrollbar->move(contentsRect().topRight() - QPoint(scrollbar->width()-1,0));
1133 scrollbar->show(); 1128 scrollbar->show();
1134 break; 1129 break;
1135 } 1130 }
1136 //FIXME: support 'rounding' styles 1131 //FIXME: support 'rounding' styles
1137 lines = ( contentsRect().height() - 2 * rimY ) / font_h; 1132 lines = ( contentsRect().height() - 2 * rimY ) / font_h;
1138 bY = (contentsRect().height() - (lines *font_h)) / 2; 1133 bY = (contentsRect().height() - (lines *font_h)) / 2;
1139} 1134}
1140 1135
1141void Widget::makeImage() 1136void Widget::makeImage()
1142//FIXME: rename 'calcGeometry? 1137//FIXME: rename 'calcGeometry?
1143{ 1138{
1144 calcGeometry(); 1139 calcGeometry();
1145 image = (Character*) malloc(lines*columns*sizeof(Character)); 1140 image = (Character*) malloc(lines*columns*sizeof(Character));
1146 clearImage(); 1141 clearImage();
1147} 1142}
1148 1143
1149// calculate the needed size 1144// calculate the needed size
1150QSize Widget::calcSize(int cols, int lins) const 1145QSize Widget::calcSize(int cols, int lins) const
1151{ 1146{
1152 int frw = width() - contentsRect().width(); 1147 int frw = width() - contentsRect().width();
1153 int frh = height() - contentsRect().height(); 1148 int frh = height() - contentsRect().height();
1154 int scw = (scrollLoc==SCRNONE?0:scrollbar->width()); 1149 int scw = (scrollLoc==SCRNONE?0:scrollbar->width());
1155 return QSize( font_w*cols + 2*rimX + frw + scw, font_h*lins + 2*rimY + frh ); 1150 return QSize( font_w*cols + 2*rimX + frw + scw, font_h*lins + 2*rimY + frh );
1156} 1151}
1157 1152
1158QSize Widget::sizeHint() const 1153QSize Widget::sizeHint() const
1159{ 1154{
1160 return size(); 1155 return size();
1161} 1156}
1162 1157
1163void Widget::styleChange(QStyle &) 1158void Widget::styleChange(QStyle &)
1164{ 1159{
1165 propagateSize(); 1160 propagateSize();
1166} 1161}
1167 1162
1168#ifndef QT_NO_DRAGANDDROP 1163#ifndef QT_NO_DRAGANDDROP
1169 1164