-rw-r--r-- | core/apps/embeddedkonsole/Makefile.in | 124 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/TEWidget.cpp | 2 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/commandeditdialog.cpp | 1 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/commandeditdialogbase.cpp | 101 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/commandeditdialogbase.h | 46 |
5 files changed, 260 insertions, 14 deletions
diff --git a/core/apps/embeddedkonsole/Makefile.in b/core/apps/embeddedkonsole/Makefile.in index 1c24ded..44310a6 100644 --- a/core/apps/embeddedkonsole/Makefile.in +++ b/core/apps/embeddedkonsole/Makefile.in @@ -1,288 +1,388 @@ ############################################################################# ####### Compiler, tools and options CXX = $(SYSCONF_CXX) $(QT_CXX_MT) CXXFLAGS= $(SYSCONF_CXXFLAGS_QT) $(SYSCONF_CXXFLAGS) CC = $(SYSCONF_CC) $(QT_C_MT) CFLAGS = $(SYSCONF_CFLAGS) INCPATH = -I$(OPIEDIR)/include LFLAGS = $(SYSCONF_LFLAGS_QT) $(SYSCONF_RPATH_QT) $(SYSCONF_LFLAGS) $(QT_LFLAGS_MT) LIBS = $(SUBLIBS) -lqpe $(SYSCONF_LIBS_QT) $(SYSCONF_LIBS) $(SYSCONF_LIBS_QTAPP) MOC = $(SYSCONF_MOC) UIC = $(SYSCONF_UIC) ####### Target DESTDIR = $(OPIEDIR)/bin/ VER_MAJ = 1 VER_MIN = 0 VER_PATCH = 0 TARGET = embeddedkonsole TARGET1 = lib$(TARGET).so.$(VER_MAJ) ####### Files HEADERS = TEWidget.h \ TEScreen.h \ TECommon.h \ TEHistory.h \ TEmulation.h \ TEmuVt102.h \ session.h \ keytrans.h \ konsole.h \ + commandeditdialog.h \ + commandeditwidget.h \ + playlistselection.h \ MyPty.h SOURCES = TEScreen.cpp \ TEWidget.cpp \ TEHistory.cpp \ TEmulation.cpp \ TEmuVt102.cpp \ session.cpp \ keytrans.cpp \ konsole.cpp \ - main.cpp \ - MyPty.cpp + commandeditdialog.cpp \ + commandeditwidget.cpp \ + playlistselection.cpp \ + MyPty.cpp \ + main.cpp OBJECTS = TEScreen.o \ TEWidget.o \ TEHistory.o \ TEmulation.o \ TEmuVt102.o \ session.o \ keytrans.o \ konsole.o \ + commandeditdialog.o \ + commandeditwidget.o \ + playlistselection.o \ + MyPty.o \ main.o \ - MyPty.o -INTERFACES = -UICDECLS = -UICIMPLS = + commandeditdialogbase.o \ + smallcommandeditdialogbase.o +INTERFACES = commandeditdialogbase.ui \ + smallcommandeditdialogbase.ui +UICDECLS = commandeditdialogbase.h \ + smallcommandeditdialogbase.h +UICIMPLS = commandeditdialogbase.cpp \ + smallcommandeditdialogbase.cpp SRCMOC = moc_TEWidget.cpp \ moc_TEmulation.cpp \ moc_TEmuVt102.cpp \ moc_session.cpp \ moc_konsole.cpp \ - moc_MyPty.cpp + moc_commandeditdialog.cpp \ + moc_commandeditwidget.cpp \ + moc_playlistselection.cpp \ + moc_MyPty.cpp \ + moc_commandeditdialogbase.cpp \ + moc_smallcommandeditdialogbase.cpp OBJMOC = moc_TEWidget.o \ moc_TEmulation.o \ moc_TEmuVt102.o \ moc_session.o \ moc_konsole.o \ - moc_MyPty.o + moc_commandeditdialog.o \ + moc_commandeditwidget.o \ + moc_playlistselection.o \ + moc_MyPty.o \ + moc_commandeditdialogbase.o \ + moc_smallcommandeditdialogbase.o ####### Implicit rules .SUFFIXES: .cpp .cxx .cc .C .c .cpp.o: $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< .cxx.o: $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< .cc.o: $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< .C.o: $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< .c.o: $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< ####### Build rules all: $(DESTDIR)$(TARGET) $(DESTDIR)$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) $(SYSCONF_LINK) $(LFLAGS) -o $(DESTDIR)$(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) moc: $(SRCMOC) tmake: tmake embeddedkonsole.pro clean: -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) -rm -f *~ core -rm -f allmoc.cpp ####### Extension Modules listpromodules: @echo listallmodules: @echo listaddonpromodules: @echo listaddonentmodules: @echo REQUIRES=embeddedkonsole ####### Sub-libraries ###### Combined headers ####### Compile TEScreen.o: TEScreen.cpp \ TEScreen.h \ TECommon.h \ TEHistory.h TEWidget.o: TEWidget.cpp \ TEWidget.h \ TECommon.h \ session.h \ MyPty.h \ TEmuVt102.h \ TEScreen.h \ TEHistory.h \ TEmulation.h \ - keytrans.h + keytrans.h \ + $(OPIEDIR)/include/qpe/config.h TEHistory.o: TEHistory.cpp \ TEHistory.h \ TECommon.h TEmulation.o: TEmulation.cpp \ TEmulation.h \ TEWidget.h \ TECommon.h \ TEScreen.h \ TEHistory.h \ keytrans.h TEmuVt102.o: TEmuVt102.cpp \ TEmuVt102.h \ TEWidget.h \ TECommon.h \ TEScreen.h \ TEHistory.h \ TEmulation.h \ keytrans.h session.o: session.cpp \ session.h \ MyPty.h \ TEWidget.h \ TECommon.h \ TEmuVt102.h \ TEScreen.h \ TEHistory.h \ TEmulation.h \ keytrans.h keytrans.o: keytrans.cpp \ keytrans.h \ $(OPIEDIR)/include/qpe/qpeapplication.h \ default.keytab.h konsole.o: konsole.cpp \ $(OPIEDIR)/include/qpe/resource.h \ $(OPIEDIR)/include/qpe/qpetoolbar.h \ $(OPIEDIR)/include/qpe/qpemenubar.h \ $(OPIEDIR)/include/qpe/config.h \ konsole.h \ MyPty.h \ TEWidget.h \ TECommon.h \ TEmuVt102.h \ TEScreen.h \ TEHistory.h \ TEmulation.h \ keytrans.h \ - session.h + session.h \ + commandeditdialog.h \ + commandeditdialogbase.h + +commandeditdialog.o: commandeditdialog.cpp \ + commandeditdialog.h \ + commandeditdialogbase.h \ + playlistselection.h \ + $(OPIEDIR)/include/qpe/applnk.h \ + $(OPIEDIR)/include/qpe/config.h \ + $(OPIEDIR)/include/qpe/qpetoolbar.h \ + $(OPIEDIR)/include/qpe/qpemenubar.h \ + $(OPIEDIR)/include/qpe/resource.h \ + smallcommandeditdialogbase.h + +commandeditwidget.o: commandeditwidget.cpp \ + commandeditwidget.h \ + playlistselection.h \ + $(OPIEDIR)/include/qpe/applnk.h + +playlistselection.o: playlistselection.cpp \ + $(OPIEDIR)/include/qpe/applnk.h \ + $(OPIEDIR)/include/qpe/resource.h \ + playlistselection.h + +MyPty.o: MyPty.cpp \ + MyPty.h main.o: main.cpp \ konsole.h \ $(OPIEDIR)/include/qpe/qpetoolbar.h \ MyPty.h \ TEWidget.h \ TECommon.h \ TEmuVt102.h \ TEScreen.h \ TEHistory.h \ TEmulation.h \ keytrans.h \ session.h \ $(OPIEDIR)/include/qpe/qpeapplication.h -MyPty.o: MyPty.cpp \ - MyPty.h +commandeditdialogbase.h: commandeditdialogbase.ui + $(UIC) commandeditdialogbase.ui -o $(INTERFACE_DECL_PATH)/commandeditdialogbase.h + +commandeditdialogbase.cpp: commandeditdialogbase.ui + $(UIC) commandeditdialogbase.ui -i commandeditdialogbase.h -o commandeditdialogbase.cpp + +smallcommandeditdialogbase.h: smallcommandeditdialogbase.ui + $(UIC) smallcommandeditdialogbase.ui -o $(INTERFACE_DECL_PATH)/smallcommandeditdialogbase.h + +smallcommandeditdialogbase.cpp: smallcommandeditdialogbase.ui + $(UIC) smallcommandeditdialogbase.ui -i smallcommandeditdialogbase.h -o smallcommandeditdialogbase.cpp + +commandeditdialogbase.o: commandeditdialogbase.cpp \ + commandeditdialogbase.h \ + playlistselection.h \ + $(OPIEDIR)/include/qpe/applnk.h + +smallcommandeditdialogbase.o: smallcommandeditdialogbase.cpp \ + smallcommandeditdialogbase.h moc_TEWidget.o: moc_TEWidget.cpp \ TEWidget.h \ TECommon.h moc_TEmulation.o: moc_TEmulation.cpp \ TEmulation.h \ TEWidget.h \ TECommon.h \ TEScreen.h \ TEHistory.h \ keytrans.h moc_TEmuVt102.o: moc_TEmuVt102.cpp \ TEmuVt102.h \ TEWidget.h \ TECommon.h \ TEScreen.h \ TEHistory.h \ TEmulation.h \ keytrans.h moc_session.o: moc_session.cpp \ session.h \ MyPty.h \ TEWidget.h \ TECommon.h \ TEmuVt102.h \ TEScreen.h \ TEHistory.h \ TEmulation.h \ keytrans.h moc_konsole.o: moc_konsole.cpp \ konsole.h \ $(OPIEDIR)/include/qpe/qpetoolbar.h \ MyPty.h \ TEWidget.h \ TECommon.h \ TEmuVt102.h \ TEScreen.h \ TEHistory.h \ TEmulation.h \ keytrans.h \ session.h +moc_commandeditdialog.o: moc_commandeditdialog.cpp \ + commandeditdialog.h \ + commandeditdialogbase.h + +moc_commandeditwidget.o: moc_commandeditwidget.cpp \ + commandeditwidget.h + +moc_playlistselection.o: moc_playlistselection.cpp \ + playlistselection.h \ + $(OPIEDIR)/include/qpe/applnk.h + moc_MyPty.o: moc_MyPty.cpp \ MyPty.h +moc_commandeditdialogbase.o: moc_commandeditdialogbase.cpp \ + commandeditdialogbase.h + +moc_smallcommandeditdialogbase.o: moc_smallcommandeditdialogbase.cpp \ + smallcommandeditdialogbase.h + moc_TEWidget.cpp: TEWidget.h $(MOC) TEWidget.h -o moc_TEWidget.cpp moc_TEmulation.cpp: TEmulation.h $(MOC) TEmulation.h -o moc_TEmulation.cpp moc_TEmuVt102.cpp: TEmuVt102.h $(MOC) TEmuVt102.h -o moc_TEmuVt102.cpp moc_session.cpp: session.h $(MOC) session.h -o moc_session.cpp moc_konsole.cpp: konsole.h $(MOC) konsole.h -o moc_konsole.cpp +moc_commandeditdialog.cpp: commandeditdialog.h + $(MOC) commandeditdialog.h -o moc_commandeditdialog.cpp + +moc_commandeditwidget.cpp: commandeditwidget.h + $(MOC) commandeditwidget.h -o moc_commandeditwidget.cpp + +moc_playlistselection.cpp: playlistselection.h + $(MOC) playlistselection.h -o moc_playlistselection.cpp + moc_MyPty.cpp: MyPty.h $(MOC) MyPty.h -o moc_MyPty.cpp +moc_commandeditdialogbase.cpp: commandeditdialogbase.h + $(MOC) commandeditdialogbase.h -o moc_commandeditdialogbase.cpp + +moc_smallcommandeditdialogbase.cpp: smallcommandeditdialogbase.h + $(MOC) smallcommandeditdialogbase.h -o moc_smallcommandeditdialogbase.cpp + diff --git a/core/apps/embeddedkonsole/TEWidget.cpp b/core/apps/embeddedkonsole/TEWidget.cpp index a56dc50..dab0ea3 100644 --- a/core/apps/embeddedkonsole/TEWidget.cpp +++ b/core/apps/embeddedkonsole/TEWidget.cpp @@ -352,385 +352,385 @@ TEWidget::~TEWidget() /*! attributed string draw primitive */ void TEWidget::drawAttrStr(QPainter &paint, QRect rect, QString& str, ca attr, BOOL pm, BOOL clear) { if (pm && color_table[attr.b].transparent) { paint.setBackgroundMode( TransparentMode ); if (clear) erase(rect); } else { if (blinking) paint.fillRect(rect, color_table[attr.b].color); else { paint.setBackgroundMode( OpaqueMode ); paint.setBackgroundColor( color_table[attr.b].color ); } } if (color_table[attr.f].bold) paint.setPen(QColor( 0x8F, 0x00, 0x00 )); else paint.setPen(color_table[attr.f].color); paint.drawText(rect.x(),rect.y()+font_a, str); if (attr.r & RE_UNDERLINE) paint.drawLine(rect.left(), rect.y()+font_a+1, rect.right(),rect.y()+font_a+1 ); } /*! The image can only be set completely. The size of the new image may or may not match the size of the widget. */ void TEWidget::setImage(const ca* const newimg, int lines, int columns) { int y,x,len; const QPixmap* pm = backgroundPixmap(); QPainter paint; setUpdatesEnabled(FALSE); paint.begin( this ); HCNT("setImage"); QPoint tL = contentsRect().topLeft(); int tLx = tL.x(); int tLy = tL.y(); hasBlinker = FALSE; int cf = -1; // undefined int cb = -1; // undefined int cr = -1; // undefined int lins = QMIN(this->lines, QMAX(0,lines )); int cols = QMIN(this->columns,QMAX(0,columns)); QChar *disstrU = new QChar[cols]; //{ static int cnt = 0; printf("setImage %d\n",cnt++); } for (y = 0; y < lins; y++) { const ca* lcl = &image[y*this->columns]; const ca* const ext = &newimg[y*columns]; if (!resizing) // not while resizing, we're expecting a paintEvent for (x = 0; x < cols; x++) { hasBlinker |= (ext[x].r & RE_BLINK); if (ext[x] != lcl[x]) { cr = ext[x].r; cb = ext[x].b; if (ext[x].f != cf) cf = ext[x].f; int lln = cols - x; disstrU[0] = fontMap(ext[x+0].c); for (len = 1; len < lln; len++) { if (ext[x+len].f != cf || ext[x+len].b != cb || ext[x+len].r != cr || ext[x+len] == lcl[x+len] ) break; disstrU[len] = fontMap(ext[x+len].c); } QString unistr(disstrU,len); drawAttrStr(paint, QRect(blX+tLx+font_w*x,bY+tLy+font_h*y,font_w*len,font_h), unistr, ext[x], pm != NULL, true); x += len - 1; } } // finally, make `image' become `newimg'. memcpy((void*)lcl,(const void*)ext,cols*sizeof(ca)); } drawFrame( &paint ); paint.end(); setUpdatesEnabled(TRUE); if ( hasBlinker && !blinkT->isActive()) blinkT->start(1000); // 1000 ms if (!hasBlinker && blinkT->isActive()) { blinkT->stop(); blinking = FALSE; } delete [] disstrU; } // paint Event //////////////////////////////////////////////////// /*! The difference of this routine vs. the `setImage' is, that the drawing does not include a difference analysis between the old and the new image. Instead, the internal image is used and the painting bound by the PaintEvent box. */ void TEWidget::paintEvent( QPaintEvent* pe ) { //{ static int cnt = 0; printf("paint %d\n",cnt++); } const QPixmap* pm = backgroundPixmap(); QPainter paint; setUpdatesEnabled(FALSE); paint.begin( this ); paint.setBackgroundMode( TransparentMode ); HCNT("paintEvent"); // Note that the actual widget size can be slightly larger // that the image (the size is truncated towards the smaller // number of characters in `resizeEvent'. The paint rectangle // can thus be larger than the image, but less then the size // of one character. QRect rect = pe->rect().intersect(contentsRect()); QPoint tL = contentsRect().topLeft(); int tLx = tL.x(); int tLy = tL.y(); int lux = QMIN(columns-1, QMAX(0,(rect.left() - tLx - blX ) / font_w)); int luy = QMIN(lines-1, QMAX(0,(rect.top() - tLy - bY ) / font_h)); int rlx = QMIN(columns-1, QMAX(0,(rect.right() - tLx - blX ) / font_w)); int rly = QMIN(lines-1, QMAX(0,(rect.bottom() - tLy - bY ) / font_h)); /* printf("paintEvent: %d..%d, %d..%d (%d..%d, %d..%d)\n",lux,rlx,luy,rly, rect.left(), rect.right(), rect.top(), rect.bottom()); */ // if (pm != NULL && color_table[image->b].transparent) // erase(rect); // BL: I have no idea why we need this, and it breaks the refresh. QChar *disstrU = new QChar[columns]; for (int y = luy; y <= rly; y++) for (int x = lux; x <= rlx; x++) { int len = 1; disstrU[0] = fontMap(image[loc(x,y)].c); int cf = image[loc(x,y)].f; int cb = image[loc(x,y)].b; int cr = image[loc(x,y)].r; while (x+len <= rlx && image[loc(x+len,y)].f == cf && image[loc(x+len,y)].b == cb && image[loc(x+len,y)].r == cr ) { disstrU[len] = fontMap(image[loc(x+len,y)].c); len += 1; } QString unistr(disstrU,len); drawAttrStr(paint, QRect(blX+tLx+font_w*x,bY+tLy+font_h*y,font_w*len,font_h), unistr, image[loc(x,y)], pm != NULL, false); x += len - 1; } delete [] disstrU; drawFrame( &paint ); paint.end(); setUpdatesEnabled(TRUE); } void TEWidget::blinkEvent() { blinking = !blinking; repaint(FALSE); } /* ------------------------------------------------------------------------- */ /* */ /* Resizing */ /* */ /* ------------------------------------------------------------------------- */ void TEWidget::resizeEvent(QResizeEvent* ev) { - //printf("resize: %d,%d\n",ev->size().width(),ev->size().height()); +// printf("resize: %d,%d\n",ev->size().width(),ev->size().height()); //printf("approx: %d,%d\n",ev->size().width()/font_w,ev->size().height()/font_h); //printf("leaves: %d,%d\n",ev->size().width()%font_w,ev->size().height()%font_h); //printf("curren: %d,%d\n",width(),height()); HCNT("resizeEvent"); // see comment in `paintEvent' concerning the rounding. //FIXME: could make a routine here; check width(),height() assert(ev->size().width() == width()); assert(ev->size().height() == height()); propagateSize(); } void TEWidget::propagateSize() { ca* oldimg = image; int oldlin = lines; int oldcol = columns; makeImage(); // we copy the old image to reduce flicker int lins = QMIN(oldlin,lines); int cols = QMIN(oldcol,columns); if (oldimg) { for (int lin = 0; lin < lins; lin++) memcpy((void*)&image[columns*lin], (void*)&oldimg[oldcol*lin],cols*sizeof(ca)); free(oldimg); //FIXME: try new,delete } else clearImage(); //NOTE: control flows from the back through the chest right into the eye. // `emu' will call back via `setImage'. resizing = TRUE; emit changedImageSizeSignal(lines, columns); // expose resizeEvent resizing = FALSE; } /* ------------------------------------------------------------------------- */ /* */ /* Scrollbar */ /* */ /* ------------------------------------------------------------------------- */ void TEWidget::scrollChanged(int) { emit changedHistoryCursor(scrollbar->value()); //expose } void TEWidget::setScroll(int cursor, int slines) { disconnect(scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scrollChanged(int))); scrollbar->setRange(0,slines); scrollbar->setSteps(1,lines); scrollbar->setValue(cursor); connect(scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scrollChanged(int))); } void TEWidget::setScrollbarLocation(int loc) { if (scrollLoc == loc) return; // quickly scrollLoc = loc; propagateSize(); update(); } /* ------------------------------------------------------------------------- */ /* */ /* Mouse */ /* */ /* ------------------------------------------------------------------------- */ /*! Three different operations can be performed using the mouse, and the routines in this section serve all of them: 1) The press/release events are exposed to the application 2) Marking (press and move left button) and Pasting (press middle button) 3) The right mouse button is used from the configuration menu NOTE: During the marking process we attempt to keep the cursor within the bounds of the text as being displayed by setting the mouse position whenever the mouse has left the text area. Two reasons to do so: 1) QT does not allow the `grabMouse' to confine-to the TEWidget. Thus a `XGrapPointer' would have to be used instead. 2) Even if so, this would not help too much, since the text area of the TEWidget is normally not identical with it's bounds. The disadvantage of the current handling is, that the mouse can visibly leave the bounds of the widget and is then moved back. Because of the current construction, and the reasons mentioned above, we cannot do better without changing the overall construction. */ /*! */ void TEWidget::mousePressEvent(QMouseEvent* ev) { //printf("press [%d,%d] %d\n",ev->x()/font_w,ev->y()/font_h,ev->button()); if ( !contentsRect().contains(ev->pos()) ) return; QPoint tL = contentsRect().topLeft(); int tLx = tL.x(); int tLy = tL.y(); word_selection_mode = FALSE; //printf("press top left [%d,%d] by=%d\n",tLx,tLy, bY); if ( ev->button() == LeftButton) { QPoint pos = QPoint((ev->x()-tLx-blX)/font_w,(ev->y()-tLy-bY)/font_h); if ( ev->state() & ControlButton ) preserve_line_breaks = FALSE ; if (mouse_marks || (ev->state() & ShiftButton)) { emit clearSelectionSignal(); iPntSel = pntSel = pos; actSel = 1; // left mouse button pressed but nothing selected yet. grabMouse( /*crossCursor*/ ); // handle with care! } else { emit mouseSignal( 0, pos.x() + 1, pos.y() + 1 ); // left button } } if ( ev->button() == MidButton ) { emitSelection(); } if ( ev->button() == RightButton ) // Configure { emit configureRequest( this, ev->state()&(ShiftButton|ControlButton), ev->x(), ev->y() ); } } void TEWidget::mouseMoveEvent(QMouseEvent* ev) { // for auto-hiding the cursor, we need mouseTracking if (ev->state() == NoButton ) return; if (actSel == 0) return; // don't extend selection while pasting if (ev->state() & MidButton) return; //if ( !contentsRect().contains(ev->pos()) ) return; QPoint tL = contentsRect().topLeft(); int tLx = tL.x(); int tLy = tL.y(); int scroll = scrollbar->value(); // we're in the process of moving the mouse with the left button pressed // the mouse cursor will kept catched within the bounds of the text in // this widget. // Adjust position within text area bounds. See FIXME above. QPoint pos = ev->pos(); if ( pos.x() < tLx+blX ) pos.setX( tLx+blX ); if ( pos.x() > tLx+blX+columns*font_w-1 ) pos.setX( tLx+blX+columns*font_w ); if ( pos.y() < tLy+bY ) pos.setY( tLy+bY ); if ( pos.y() > tLy+bY+lines*font_h-1 ) pos.setY( tLy+bY+lines*font_h-1 ); // check if we produce a mouse move event by this if ( pos != ev->pos() ) cursor().setPos(mapToGlobal(pos)); if ( pos.y() == tLy+bY+lines*font_h-1 ) { scrollbar->setValue(scrollbar->value()+yMouseScroll); // scrollforward } if ( pos.y() == tLy+bY ) { scrollbar->setValue(scrollbar->value()-yMouseScroll); // scrollback } QPoint here = QPoint((pos.x()-tLx-blX)/font_w,(pos.y()-tLy-bY)/font_h); QPoint ohere; bool swapping = FALSE; if ( word_selection_mode ) { // Extend to word boundaries int i; int selClass; bool left_not_right = ( here.y() < iPntSel.y() || here.y() == iPntSel.y() && here.x() < iPntSel.x() ); bool old_left_not_right = ( pntSel.y() < iPntSel.y() || pntSel.y() == iPntSel.y() && pntSel.x() < iPntSel.x() ); diff --git a/core/apps/embeddedkonsole/commandeditdialog.cpp b/core/apps/embeddedkonsole/commandeditdialog.cpp index e8ef858..ce21c47 100644 --- a/core/apps/embeddedkonsole/commandeditdialog.cpp +++ b/core/apps/embeddedkonsole/commandeditdialog.cpp @@ -32,193 +32,192 @@ CommandEditDialog::CommandEditDialog(QWidget *parent, const char* name, WFlags f item = new QListViewItem( m_SuggestedCommandList,"ls "); item = new QListViewItem( m_SuggestedCommandList,"cat "); item = new QListViewItem( m_SuggestedCommandList,"cd "); item = new QListViewItem( m_SuggestedCommandList,"chmod "); item = new QListViewItem( m_SuggestedCommandList,"cp "); item = new QListViewItem( m_SuggestedCommandList,"dc "); item = new QListViewItem( m_SuggestedCommandList,"df "); item = new QListViewItem( m_SuggestedCommandList,"dmesg "); item = new QListViewItem( m_SuggestedCommandList,"echo "); item = new QListViewItem( m_SuggestedCommandList,"export "); item = new QListViewItem( m_SuggestedCommandList,"env "); item = new QListViewItem( m_SuggestedCommandList,"find "); item = new QListViewItem( m_SuggestedCommandList,"free "); item = new QListViewItem( m_SuggestedCommandList,"ifconfig "); item = new QListViewItem( m_SuggestedCommandList,"ipkg "); item = new QListViewItem( m_SuggestedCommandList,"mkdir "); item = new QListViewItem( m_SuggestedCommandList,"mv "); item = new QListViewItem( m_SuggestedCommandList,"nc localhost 7776 "); item = new QListViewItem( m_SuggestedCommandList,"nc localhost 7777 "); item = new QListViewItem( m_SuggestedCommandList,"nslookup "); item = new QListViewItem( m_SuggestedCommandList,"ping "); item = new QListViewItem( m_SuggestedCommandList,"ps aux"); item = new QListViewItem( m_SuggestedCommandList,"pwd "); item = new QListViewItem( m_SuggestedCommandList,"rm "); item = new QListViewItem( m_SuggestedCommandList,"rmdir "); item = new QListViewItem( m_SuggestedCommandList,"route "); item = new QListViewItem( m_SuggestedCommandList,"gzip "); item = new QListViewItem( m_SuggestedCommandList,"gunzip "); item = new QListViewItem( m_SuggestedCommandList,"chgrp "); item = new QListViewItem( m_SuggestedCommandList,"chown "); item = new QListViewItem( m_SuggestedCommandList,"date "); item = new QListViewItem( m_SuggestedCommandList,"dd "); item = new QListViewItem( m_SuggestedCommandList,"df "); item = new QListViewItem( m_SuggestedCommandList,"dmesg "); item = new QListViewItem( m_SuggestedCommandList,"fuser "); item = new QListViewItem( m_SuggestedCommandList,"hostname "); item = new QListViewItem( m_SuggestedCommandList,"kill "); item = new QListViewItem( m_SuggestedCommandList,"killall "); item = new QListViewItem( m_SuggestedCommandList,"ln "); item = new QListViewItem( m_SuggestedCommandList,"ln -s "); item = new QListViewItem( m_SuggestedCommandList,"mount "); item = new QListViewItem( m_SuggestedCommandList,"more "); item = new QListViewItem( m_SuggestedCommandList,"sort "); item = new QListViewItem( m_SuggestedCommandList,"touch "); item = new QListViewItem( m_SuggestedCommandList,"umount "); item = new QListViewItem( m_SuggestedCommandList,"mknod "); item = new QListViewItem( m_SuggestedCommandList,"netstat "); item = new QListViewItem( m_SuggestedCommandList,"cardctl eject "); m_SuggestedCommandList->setSelected(m_SuggestedCommandList->firstChild(),TRUE); m_SuggestedCommandList->sort(); connect( m_SuggestedCommandList, SIGNAL( clicked( QListViewItem * ) ), m_PlayListSelection, SLOT( addToSelection( QListViewItem *) ) ); ToolButton1->setTextLabel("new"); ToolButton1->setPixmap(Resource::loadPixmap("new")); ToolButton1->setAutoRaise(TRUE); ToolButton1->setFocusPolicy(QWidget::NoFocus); connect(ToolButton1,SIGNAL(clicked()),this,SLOT(showAddDialog())); ToolButton2->setTextLabel("edit"); ToolButton2->setPixmap(Resource::loadPixmap("edit")); ToolButton2->setAutoRaise(TRUE); ToolButton2->setFocusPolicy(QWidget::NoFocus); connect(ToolButton2,SIGNAL(clicked()),this,SLOT(showEditDialog())); ToolButton3->setTextLabel("delete"); ToolButton3->setPixmap(Resource::loadPixmap("editdelete")); ToolButton3->setAutoRaise(TRUE); ToolButton3->setFocusPolicy(QWidget::NoFocus); connect(ToolButton3,SIGNAL(clicked()),m_PlayListSelection,SLOT(removeSelected())); ToolButton4->setTextLabel("up"); ToolButton4->setPixmap(Resource::loadPixmap("up")); ToolButton4->setAutoRaise(TRUE); ToolButton4->setFocusPolicy(QWidget::NoFocus); connect(ToolButton4,SIGNAL(clicked()),m_PlayListSelection,SLOT(moveSelectedUp())); ToolButton5->setTextLabel("down"); ToolButton5->setPixmap(Resource::loadPixmap("down")); ToolButton5->setAutoRaise(TRUE); ToolButton5->setFocusPolicy(QWidget::NoFocus); connect(ToolButton5,SIGNAL(clicked()),m_PlayListSelection,SLOT(moveSelectedDown())); QListViewItem *current = m_SuggestedCommandList->selectedItem(); if ( current ) item->moveItem( current ); m_SuggestedCommandList->setSelected( item, TRUE ); m_SuggestedCommandList->ensureItemVisible( m_SuggestedCommandList->selectedItem() ); Config cfg("Konsole"); cfg.setGroup("Commands"); if (cfg.readEntry("Commands Set","FALSE") == "TRUE") { for (int i = 0; i < 100; i++) { QString tmp; tmp = cfg.readEntry( QString::number(i),""); if (!tmp.isEmpty()) m_PlayListSelection->addStringToSelection(tmp); } } else { m_PlayListSelection->addStringToSelection("ls "); m_PlayListSelection->addStringToSelection("cardctl eject"); m_PlayListSelection->addStringToSelection("cat "); m_PlayListSelection->addStringToSelection("cd "); m_PlayListSelection->addStringToSelection("chmod "); m_PlayListSelection->addStringToSelection("cp "); m_PlayListSelection->addStringToSelection("dc "); m_PlayListSelection->addStringToSelection("df "); m_PlayListSelection->addStringToSelection("dmesg"); m_PlayListSelection->addStringToSelection("echo "); m_PlayListSelection->addStringToSelection("env"); m_PlayListSelection->addStringToSelection("find "); m_PlayListSelection->addStringToSelection("free"); m_PlayListSelection->addStringToSelection("grep "); m_PlayListSelection->addStringToSelection("ifconfig "); m_PlayListSelection->addStringToSelection("ipkg "); m_PlayListSelection->addStringToSelection("mkdir "); m_PlayListSelection->addStringToSelection("mv "); m_PlayListSelection->addStringToSelection("nc localhost 7776"); m_PlayListSelection->addStringToSelection("nc localhost 7777"); m_PlayListSelection->addStringToSelection("nslookup "); m_PlayListSelection->addStringToSelection("ping "); m_PlayListSelection->addStringToSelection("ps aux"); m_PlayListSelection->addStringToSelection("pwd "); m_PlayListSelection->addStringToSelection("rm "); m_PlayListSelection->addStringToSelection("rmdir "); m_PlayListSelection->addStringToSelection("route "); m_PlayListSelection->addStringToSelection("set "); m_PlayListSelection->addStringToSelection("traceroute"); } } CommandEditDialog::~CommandEditDialog() { } void CommandEditDialog::accept() { int i = 0; Config *cfg = new Config("Konsole"); cfg->setGroup("Commands"); cfg->clearGroup(); QListViewItemIterator it( m_PlayListSelection ); for ( ; it.current(); ++it ) { // qDebug(it.current()->text(0)); cfg->writeEntry(QString::number(i),it.current()->text(0)); i++; } cfg->writeEntry("Commands Set","TRUE"); // qDebug("CommandEditDialog::accept() - written"); delete cfg; emit commandsEdited(); close(); } void CommandEditDialog::showEditDialog() { editCommandBase *d = new editCommandBase(this,"smalleditdialog", TRUE); d->setCaption("Edit command"); d->TextLabel->setText("Edit command:"); d->commandEdit->setText(m_PlayListSelection->currentItem()->text(0)); int i = d->exec(); if ((i==1) && (!(d->commandEdit->text()).isEmpty())) m_PlayListSelection->currentItem()->setText(0,(d->commandEdit->text())); } void CommandEditDialog::showAddDialog() { editCommandBase *d = new editCommandBase(this,"smalleditdialog", TRUE); int i = d->exec(); if ((i==1) && (!(d->commandEdit->text()).isEmpty())) m_PlayListSelection->addStringToSelection(d->commandEdit->text()); } - diff --git a/core/apps/embeddedkonsole/commandeditdialogbase.cpp b/core/apps/embeddedkonsole/commandeditdialogbase.cpp new file mode 100644 index 0000000..f25edb4 --- a/dev/null +++ b/core/apps/embeddedkonsole/commandeditdialogbase.cpp @@ -0,0 +1,101 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'commandeditdialogbase.ui' +** +** Created: Sun Feb 3 15:23:58 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "commandeditdialogbase.h" + +#include <qheader.h> +#include <qlabel.h> +#include <qlistview.h> +#include <qpushbutton.h> +#include <qtoolbutton.h> +#include "playlistselection.h" +#include <qlayout.h> +#include <qvariant.h> +#include <qtooltip.h> +#include <qwhatsthis.h> + +/* + * Constructs a CommandEditDialogBase which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + * + * The dialog will by default be modeless, unless you set 'modal' to + * TRUE to construct a modal dialog. + */ +CommandEditDialogBase::CommandEditDialogBase( QWidget* parent, const char* name, bool modal, WFlags fl ) + : QDialog( parent, name, modal, fl ) +{ + if ( !name ) + setName( "CommandEditDialogBase" ); + resize( 196, 414 ); + setCaption( tr( "Commands" ) ); + CommandEditDialogBaseLayout = new QGridLayout( this ); + CommandEditDialogBaseLayout->setSpacing( 6 ); + CommandEditDialogBaseLayout->setMargin( 11 ); + + TextLabel1 = new QLabel( this, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( tr( "<B>Commands</B>:" ) ); + + CommandEditDialogBaseLayout->addWidget( TextLabel1, 0, 0 ); + + Layout2 = new QVBoxLayout; + Layout2->setSpacing( 6 ); + Layout2->setMargin( 0 ); + + ToolButton1 = new QToolButton( this, "ToolButton1" ); + ToolButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, ToolButton1->sizePolicy().hasHeightForWidth() ) ); + Layout2->addWidget( ToolButton1 ); + + ToolButton2 = new QToolButton( this, "ToolButton2" ); + ToolButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, ToolButton2->sizePolicy().hasHeightForWidth() ) ); + Layout2->addWidget( ToolButton2 ); + + ToolButton3 = new QToolButton( this, "ToolButton3" ); + ToolButton3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, ToolButton3->sizePolicy().hasHeightForWidth() ) ); + Layout2->addWidget( ToolButton3 ); + + ToolButton4 = new QToolButton( this, "ToolButton4" ); + ToolButton4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, ToolButton4->sizePolicy().hasHeightForWidth() ) ); + Layout2->addWidget( ToolButton4 ); + + ToolButton5 = new QToolButton( this, "ToolButton5" ); + ToolButton5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, ToolButton5->sizePolicy().hasHeightForWidth() ) ); + Layout2->addWidget( ToolButton5 ); + + CommandEditDialogBaseLayout->addLayout( Layout2, 1, 2 ); + QSpacerItem* spacer = new QSpacerItem( 21, 20, QSizePolicy::Fixed, QSizePolicy::Minimum ); + CommandEditDialogBaseLayout->addItem( spacer, 0, 2 ); + + TextLabel1_2 = new QLabel( this, "TextLabel1_2" ); + TextLabel1_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, TextLabel1_2->sizePolicy().hasHeightForWidth() ) ); + TextLabel1_2->setText( tr( "<B>Suggested Commands</B>:" ) ); + + CommandEditDialogBaseLayout->addWidget( TextLabel1_2, 2, 0 ); + + m_PlayListSelection = new PlayListSelection( this, "m_PlayListSelection" ); + m_PlayListSelection->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, m_PlayListSelection->sizePolicy().hasHeightForWidth() ) ); + + CommandEditDialogBaseLayout->addMultiCellWidget( m_PlayListSelection, 1, 1, 0, 1 ); + QSpacerItem* spacer_2 = new QSpacerItem( 20, 30, QSizePolicy::Minimum, QSizePolicy::Fixed ); + CommandEditDialogBaseLayout->addItem( spacer_2, 2, 1 ); + QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Fixed ); + CommandEditDialogBaseLayout->addItem( spacer_3, 2, 2 ); + + m_SuggestedCommandList = new QListView( this, "m_SuggestedCommandList" ); + + CommandEditDialogBaseLayout->addMultiCellWidget( m_SuggestedCommandList, 3, 3, 0, 1 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +CommandEditDialogBase::~CommandEditDialogBase() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/core/apps/embeddedkonsole/commandeditdialogbase.h b/core/apps/embeddedkonsole/commandeditdialogbase.h new file mode 100644 index 0000000..6a37ec9 --- a/dev/null +++ b/core/apps/embeddedkonsole/commandeditdialogbase.h @@ -0,0 +1,46 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'commandeditdialogbase.ui' +** +** Created: Sun Feb 3 15:23:28 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef COMMANDEDITDIALOGBASE_H +#define COMMANDEDITDIALOGBASE_H + +#include <qvariant.h> +#include <qdialog.h> +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class PlayListSelection; +class QLabel; +class QListView; +class QListViewItem; +class QToolButton; + +class CommandEditDialogBase : public QDialog +{ + Q_OBJECT + +public: + CommandEditDialogBase( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~CommandEditDialogBase(); + + QLabel* TextLabel1; + QToolButton* ToolButton1; + QToolButton* ToolButton2; + QToolButton* ToolButton3; + QToolButton* ToolButton4; + QToolButton* ToolButton5; + QLabel* TextLabel1_2; + PlayListSelection* m_PlayListSelection; + QListView* m_SuggestedCommandList; + +protected: + QGridLayout* CommandEditDialogBaseLayout; + QVBoxLayout* Layout2; +}; + +#endif // COMMANDEDITDIALOGBASE_H |