author | mickeyl <mickeyl> | 2004-02-25 11:27:48 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-02-25 11:27:48 (UTC) |
commit | 25e87d9ccc92b7a4c12518532576f55b11726b26 (patch) (side-by-side diff) | |
tree | 39c21854f8b6845736126a05f2cc89e552484881 | |
parent | 50aef52b265bc8c8e5e5c6a871affe94142d74fb (diff) | |
download | opie-25e87d9ccc92b7a4c12518532576f55b11726b26.zip opie-25e87d9ccc92b7a4c12518532576f55b11726b26.tar.gz opie-25e87d9ccc92b7a4c12518532576f55b11726b26.tar.bz2 |
fix most of zecke's comments. Someone should look into the open issues though
(see mail to opie-devel)
-rw-r--r-- | core/apps/embeddedkonsole/MyPty.cpp | 7 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 21 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/konsole.h | 6 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/session.h | 2 |
4 files changed, 17 insertions, 19 deletions
diff --git a/core/apps/embeddedkonsole/MyPty.cpp b/core/apps/embeddedkonsole/MyPty.cpp index e7d8274..5a8519a 100644 --- a/core/apps/embeddedkonsole/MyPty.cpp +++ b/core/apps/embeddedkonsole/MyPty.cpp @@ -34,97 +34,96 @@ Within the terminal emulation framework, this class represents the host side of the terminal together with the connecting serial line. One can create many instances of this class within a program. As a side effect of using this class, a signal(2) handler is installed on SIGCHLD. \par FIXME [NOTE: much of the technical stuff below will be replaced by forkpty.] publish the SIGCHLD signal if not related to an instance. clearify TEPty::done vs. TEPty::~TEPty semantics. check if pty is restartable via run after done. \par Pseudo terminals Pseudo terminals are a unique feature of UNIX, and always come in form of pairs of devices (/dev/ptyXX and /dev/ttyXX), which are connected to each other by the operating system. One may think of them as two serial devices linked by a null-modem cable. Being based on devices the number of simultanous instances of this class is (globally) limited by the number of those device pairs, which is 256. Another technic are UNIX 98 PTY's. These are supported also, and prefered over the (obsolete) predecessor. There's a sinister ioctl(2), signal(2) and job control stuff nessesary to make everything work as it should. */ #include <qfileinfo.h> #include <qapplication.h> #include <qsocketnotifier.h> #include <qstring.h> #include <stdlib.h> #include <stdio.h> #include <signal.h> #include <fcntl.h> #include <unistd.h> #include <termios.h> #include <sys/types.h> #include <sys/ioctl.h> #include <sys/wait.h> -#undef HAVE_OPENPTY #ifdef HAVE_OPENPTY #include <pty.h> #endif #include "MyPty.h" #undef VERBOSE_DEBUG /* -------------------------------------------------------------------------- */ /*! Informs the client program about the actual size of the window. */ void MyPty::setSize(int lines, int columns) { struct winsize wsize; wsize.ws_row = (unsigned short)lines; wsize.ws_col = (unsigned short)columns; if(fd < 0) return; ioctl(fd,TIOCSWINSZ,(char *)&wsize); } void MyPty::donePty() { // This is code from the Qt DumbTerminal example int status = 0; ::close(fd); if (cpid) { kill(cpid, SIGHUP); waitpid(cpid, &status, 0); } emit done(status); } const char* MyPty::deviceName() { return ttynam; } @@ -215,76 +214,76 @@ int MyPty::openPty() if (geteuid() != 0 && !access(ttynam,R_OK|W_OK) == 0) { ::close(ptyfd); ptyfd = -1; } } } } #endif if ( ptyfd < 0 ) { qApp->exit(1); return -1; } return ptyfd; } /*! Create an instance. */ MyPty::MyPty() : cpid(0) { fd = openPty(); } /*! Destructor. Note that the related client program is not killed (yet) when a instance is deleted. */ MyPty::~MyPty() { donePty(); } /*! sends len bytes through the line */ void MyPty::send_bytes(const char* s, int len) { #ifdef VERBOSE_DEBUG // verbose debug printf("sending bytes:\n"); for (int i = 0; i < len; i++) printf("%c", s[i]); printf("\n"); #endif - ::write(fd, s, len); + ::write(fd, s, len); } /*! indicates that a block of data is received */ void MyPty::readPty() -{ +{ char buf[4096]; int len = ::read( fd, buf, 4096 ); if (len == -1) donePty(); if (len < 0) return; emit block_in(buf,len); - + #ifdef VERBOSE_DEBUG // verbose debug printf("read bytes:\n"); for (int i = 0; i < len; i++) printf("%c", buf[i]); printf("\n"); #endif } diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index b8f009d..1c613a9 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp @@ -1,72 +1,71 @@ /* ---------------------------------------------------------------------- */ /* */ /* [main.C] Konsole */ /* */ /* ---------------------------------------------------------------------- */ /* */ /* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ /* */ /* This file is part of Konsole, an X terminal. */ /* */ /* The material contained in here more or less directly orginates from */ /* kvt, which is copyright (c) 1996 by Matthias Ettrich <ettrich@kde.org> */ /* */ /* ---------------------------------------------------------------------- */ /* */ /* Ported Konsole to Qt/Embedded */ /* */ /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ /* */ /* -------------------------------------------------------------------------- */ // enhancements added by L.J. Potter <ljp@llornkcor.com> // enhancements added by Phillip Kuhn -//#define QT_QWS_OPIE #include <stdlib.h> #ifdef QT_QWS_OPIE #include <opie2/ocolorpopupmenu.h> #endif #include <qpe/resource.h> #include <qdir.h> #include <qevent.h> #include <qdragobject.h> #include <qobjectlist.h> #include <qtoolbutton.h> #include <qtoolbar.h> #include <qpushbutton.h> #include <qfontdialog.h> #include <qglobal.h> #include <qpainter.h> #include <qmenubar.h> #include <qmessagebox.h> #include <qaction.h> #include <qapplication.h> #include <qfontmetrics.h> #include <qcombobox.h> #include <qevent.h> #include <qtabwidget.h> #include <qtabbar.h> #include <qpe/config.h> #include <qstringlist.h> #include <qpalette.h> #include <qfontdatabase.h> #include <qfile.h> #include <qspinbox.h> #include <qlayout.h> #include <qvbox.h> #include <sys/wait.h> #include <stdio.h> #include <stdlib.h> #include <assert.h> #include "konsole.h" #include "keytrans.h" #include "commandeditdialog.h" class EKNumTabBar : public QTabBar { @@ -324,98 +323,98 @@ void Konsole::initCommandList() } if (cfg.readEntry("Commands Set","FALSE") == "FALSE") { for (int i = 0; commonCmds[i] != NULL; i++) { commonCombo->insertItem(commonCmds[i]); } } else { for (int i = 0; i < 100; i++) { if (!(cfg.readEntry( QString::number(i),"")).isEmpty()) commonCombo->insertItem(cfg.readEntry( QString::number(i),"")); } } } static void sig_handler(int x) { printf("got signal %d\n",x); } void Konsole::init(const char* _pgm, QStrList & _args) { #if 0 for(int i=1; i<=31; i++) { if (i != SIGPIPE && i != SIGPROF && i != SIGSEGV && i != SIGINT && i != SIGILL && i != SIGTERM && i != SIGBUS) signal(i,sig_handler); } #endif signal(SIGSTOP, sig_handler); signal(SIGCONT, sig_handler); signal(SIGTSTP, sig_handler); b_scroll = TRUE; // histon; n_keytab = 0; n_render = 0; startUp=0; fromMenu = FALSE; fullscreen = false; - setCaption( "Konsole" ); - setIcon( Resource::loadPixmap( "qkonsole/qkonsole" ) ); + setCaption( tr( "Konsole" ) ); + setIcon( Resource::loadPixmap( "konsole/Terminal" ) ); Config cfg( "Konsole" ); cfg.setGroup("Font"); QString tmp; // initialize the list of allowed fonts /////////////////////////////////// QString cfgFontName = cfg.readEntry("FontName","Lcfont"); int cfgFontSize = cfg.readNumEntry("FontSize",18); cfont = -1; // this code causes repeated access to all the font files // which does slow down startup QFontDatabase fontDB; QStringList familyNames; familyNames = fontDB.families( FALSE ); QString s; int fontIndex = 0; int familyNum = 0; fontList = new QPopupMenu( this ); for(uint j = 0; j < (uint)familyNames.count(); j++) { s = familyNames[j]; if ( s.contains('-') ) { int i = s.find('-'); s = s.right( s.length() - i - 1 ) + " [" + s.left( i ) + "]"; } s[0] = s[0].upper(); QValueList<int> sizes = fontDB.pointSizes( familyNames[j] ); printf("family[%d] = %s with %d sizes\n", j, familyNames[j].latin1(), sizes.count()); if (sizes.count() > 0) { QPopupMenu *sizeMenu; QFont f; int last_width = -1; sizeMenu = NULL; for(uint i = 0; i < (uint)sizes.count() + 4; i++) { // printf("family %s size %d ", familyNames[j].latin1(), sizes[i]); // need to divide by 10 on the Z, but not otherwise @@ -532,97 +531,97 @@ void Konsole::init(const char* _pgm, QStrList & _args) tm_top = tabMenu->insertItem(tr("Top")); tm_hidden = tabMenu->insertItem(tr("Hidden")); configMenu->insertItem(tr("Tabs"), tabMenu); tmp=cfg.readEntry("Position","Top"); if(tmp=="Top") { tab->setTabPosition(QTabWidget::Top); tab->getTabBar()->show(); tabPos = tm_top; } else if (tmp=="Bottom") { tab->setTabPosition(QTabWidget::Bottom); tab->getTabBar()->show(); tabPos = tm_bottom; } else { tab->getTabBar()->hide(); tab->setMargin(tab->margin()); tabPos = tm_hidden; } cm_bw = colorMenu->insertItem(tr( "Black on White")); cm_wb = colorMenu->insertItem(tr( "White on Black")); cm_gb = colorMenu->insertItem(tr( "Green on Black")); // cm_bt = colorMenu->insertItem(tr( "Black on Transparent")); cm_br = colorMenu->insertItem(tr( "Black on Pink")); cm_rb = colorMenu->insertItem(tr( "Pink on Black")); cm_gy = colorMenu->insertItem(tr( "Green on Yellow")); cm_bm = colorMenu->insertItem(tr( "Blue on Magenta")); cm_mb = colorMenu->insertItem(tr( "Magenta on Blue")); cm_cw = colorMenu->insertItem(tr( "Cyan on White")); cm_wc = colorMenu->insertItem(tr( "White on Cyan")); cm_bb = colorMenu->insertItem(tr( "Blue on Black")); cm_ab = colorMenu->insertItem(tr( "Amber on Black")); cm_default = colorMenu->insertItem(tr("default")); #ifdef QT_QWS_OPIE colorMenu->insertItem(tr( "Custom")); #endif configMenu->insertItem(tr( "Colors") ,colorMenu); sessionList = new QPopupMenu(this); - sessionList-> insertItem ( Resource::loadPixmap ( "qkonsole/qkonsole" ), tr( "new session" ), this, + sessionList-> insertItem ( Resource::loadPixmap ( "konsole/Terminal" ), tr( "new session" ), this, SLOT(newSession()) ); // connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuIsSelected(int) )); connect( tabMenu, SIGNAL( activated(int) ), this, SLOT( tabMenuSelected(int) )); connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); connect( editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int))); connect( sessionList, SIGNAL(activated(int)), this, SLOT( sessionListSelected(int) ) ); menuBar->insertItem( tr("View"), configMenu ); menuBar->insertItem( tr("Fonts"), fontList ); menuBar->insertItem( tr("Sessions"), sessionList ); toolBar = new QToolBar( this ); QAction *a; // Button Commands a = new QAction( tr("New"), Resource::loadPixmap( "konsole/Terminal" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); a->addTo( toolBar ); a = new QAction( tr("Full Screen"), Resource::loadPixmap( "fullscreen" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( toggleFullScreen() ) ); a->addTo( toolBar ); a = new QAction( tr("Zoom"), Resource::loadPixmap( "zoom" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( cycleZoom() ) ); a->addTo( toolBar ); /* a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolBar ); a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolBar ); a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolBar ); */ /* a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolBar ); a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolBar ); */ a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); @@ -834,97 +833,97 @@ void Konsole::changeFontSize(int delta) { // printf("delta font size %d\n", delta); TEWidget* te = getTe(); QFont font = te->getVTFont(); int size = font.pointSize(); int closest = delta > 0? 10000 : -10000; int closest_font = -1; for(uint i = 0; i < fonts.count(); i++) { if (fonts.at(i)->getFont() == font) { if (delta > 0) { if (i+1 < fonts.count() && fonts.at(i+1)->getFamilyNum() == fonts.at(i)->getFamilyNum()) { setFont(i+1); printf("font %d\n", i+1); return; } } else if (delta < 0) { if (i > 0 && fonts.at(i-1)->getFamilyNum() == fonts.at(i)->getFamilyNum()) { setFont(i-1); printf("font %d\n", i-1); return; } } } int fsize = fonts.at(i)->getSize(); printf("%d size=%d fsize=%d closest=%d\n", i, size, fsize, closest); if ((delta > 0 && fsize > size && fsize < closest) || (delta < 0 && fsize < size && fsize > closest)) { closest = fsize; closest_font = i; } } if (closest_font >= 0) { printf("font closest %d (%d)\n", closest_font, closest); setFont(closest_font); } } -int Konsole::findFont(QString name, int size, bool exactMatch) +int Konsole::findFont(const QString& name, int size, bool exactMatch) { for(uint i = 0; i < fonts.count(); i++) { if (fonts.at(i)->getName() == name && fonts.at(i)->getSize() == size) { return(i); } } if (exactMatch) { return(-1); } for(uint i = 0; i < fonts.count(); i++) { if (fonts.at(i)->getSize() == size) { return(i); } } return(-1); } void Konsole::setFont(int f) { VTFont* font = fonts.at(f); if (font) { TEWidget* te = getTe(); if (te != 0) { te->setVTFont(font->getFont()); } cfont = f; int familyNum = font->getFamilyNum(); int size = font->getSize(); printf("familyNum = %d size = %d count=%d\n", familyNum, size, fontList->count()); for(int i = 0; i < (int)fontList->count(); i++) { fontList->setItemChecked(i + 1000, i == familyNum); } for(int i = 0; i < (int)fonts.count(); i++) { fontList->setItemChecked(i, fonts.at(i)->getFamilyNum() == familyNum && fonts.at(i)->getSize() == size); } @@ -1114,139 +1113,139 @@ void Konsole::changeColumns(int /*columns*/) // qDebug("change columns"); // TEWidget* te = getTe(); // if (te != 0) { // setColLin(columns,te->Lines()); // te->update(); // } } //FIXME: If a child dies during session swap, // this routine might be called before // session swap is completed. void Konsole::doneSession(TEWidget* te, int ) { // TEWidget *te = NULL; // if (sess->currentSession == tab->currentPage()) { // printf("done current session\n"); // te = getTe(); // } else { // int currentPage = tab->currentPageIndex(); // printf("done not current session\n"); // for(int i = 0; i < nsessions; i++) { // tab->setCurrentPage(i); // printf("find session %d tab page %x session %x\n", // i, tab->currentPage(), sess->currentSession); // if (tab->currentPage() == sess->currentSession) { // printf("found session %d\n", i); // te = tab->currentPage(); // break; // } // } // tab->setCurrentPage(currentPage); // } if (te != 0) { te->currentSession->setConnect(FALSE); tab->removeTab(te); delete te->currentSession; delete te; sessionList->removeItem(nsessions); nsessions--; } if (nsessions == 0) { close(); } } -void Konsole::changeTitle(TEWidget* te, QString newTitle ) +void Konsole::changeTitle(TEWidget* te, const QString& newTitle ) { if (te == getTe()) { - setCaption(newTitle + " - QKonsole"); + setCaption( newTitle + " - " + tr( "Konsole " ) ); } } void Konsole::newSession() { if(nsessions < 15) { // seems to be something weird about 16 tabs on the Zaurus.... memory? TEWidget* te = new TEWidget(tab); Config cfg( "Konsole" ); cfg.setGroup("Menubar"); // FIXME use more defaults from config file te->useBeep=cfg.readBoolEntry("useBeep",0); // te->setBackgroundMode(PaletteBase); //we want transparent!! cfg.setGroup("Font"); QString sn = "Session" + QString::number(nsessions+1); printf("read font session %s\n", sn.latin1()); QString fontName = cfg.readEntry("FontName"+sn, cfg.readEntry("FontName", fonts.at(cfont)->getFamily())); int fontSize = cfg.readNumEntry("FontSize"+sn, cfg.readNumEntry("FontSize", fonts.at(cfont)->getSize())); cfont = findFont(fontName, fontSize, false); printf("lookup font %s size %d got %d\n", fontName.latin1(), fontSize, cfont); if (cfont < 0) cfont = 0; te->setVTFont(fonts.at(cfont)->getFont()); tab->addTab(te); TESession* se = new TESession(this, te, se_pgm, se_args, "xterm"); te->currentSession = se; connect( se, SIGNAL(done(TEWidget*,int)), this, SLOT(doneSession(TEWidget*,int)) ); - connect( se, SIGNAL(changeTitle(TEWidget*,QString)), this, - SLOT(changeTitle(TEWidget*,QString)) ); + connect( se, SIGNAL(changeTitle(TEWidget*,const QString&)), this, + SLOT(changeTitle(TEWidget*,const QString&)) ); connect(te, SIGNAL(changeFontSize(int)), this, SLOT(changeFontSize(int))); connect(te, SIGNAL(changeSession(int)), this, SLOT(changeSession(int))); connect(te, SIGNAL(newSession()), this, SLOT(newSession())); connect(te, SIGNAL(toggleFullScreen()), this, SLOT(toggleFullScreen())); connect(te, SIGNAL(setFullScreen(bool)), this, SLOT(setFullScreen(bool))); se->run(); se->setConnect(TRUE); se->setHistory(b_scroll); nsessions++; sessionList->insertItem(QString::number(nsessions), nsessions); sessionListSelected(nsessions); doWrap(); setColor(nsessions-1); } } TEWidget* Konsole::getTe() { if (nsessions) { return (TEWidget *) tab->currentPage(); } else { return 0; } } void Konsole::sessionListSelected(int id) { if (id < 0) { return; } QString selected = sessionList->text(id); EKNumTabBar *tabBar = tab->getTabBar(); int n = 0; for(int i = 0; n < tabBar->count(); i++) { if (tabBar->tab(i)) { // printf("selected = %s tab %d = %s\n", selected.latin1(), // i, tabBar->tab(i)->text().latin1()); if (tabBar->tab(i)->text() == selected) { tab->setCurrentPage(i); break; @@ -1264,101 +1263,101 @@ void Konsole::changeSession(int delta) int i = tabBar->tab(tabBar->currentTab())->text().toInt() - 1; i += delta; if (i < 0) i += tabBar->count(); if (i >= tabBar->count()) i -= tabBar->count(); QString selected = QString::number(i+1); int n = 0; for(int i = 0; n < tabBar->count(); i++) { if (tabBar->tab(i)) { printf("selected = %s tab %d = %s\n", selected.latin1(), i, tabBar->tab(i)->text().latin1()); if (tabBar->tab(i)->text() == selected) { tab->setCurrentPage(i); break; } n++; } } } void Konsole::switchSession(QWidget* w) { TEWidget* te = (TEWidget *) w; QFont teFnt = te->getVTFont(); int familyNum = -1; for(uint i = 0; i < fonts.count(); i++) { VTFont *fnt = fonts.at(i); bool cf = fnt->getFont() == teFnt; fontList->setItemChecked(i, cf); if (cf) { cfont = i; familyNum = fnt->getFamilyNum(); } } for(int i = 0; i < (int)fontList->count(); i++) { fontList->setItemChecked(i + 1000, i == familyNum); } if (! te->currentSession->Title().isEmpty() ) { - setCaption(te->currentSession->Title() + " - QKonsole"); + setCaption( te->currentSession->Title() + " - " + tr( "Konsole" ) ); } else { - setCaption( "Konsole" ); + setCaption( tr( "Konsole" ) ); } // colorMenuSelected(te->color_menu_item); } void Konsole::toggleFullScreen() { setFullScreen(! fullscreen); } void Konsole::setFullScreen ( bool b ) { static QSize normalsize; static bool listHidden; if (b == fullscreen) { return; } fullscreen = b; if ( b ) { if ( !normalsize. isValid ( )) { normalsize = size ( ); } setFixedSize ( qApp-> desktop ( )-> size ( )); showNormal ( ); reparent ( 0, WStyle_Customize | WStyle_NoBorder, QPoint ( 0, 0 )); showFullScreen ( ); menuToolBar->hide(); toolBar->hide(); listHidden = secondToolBar->isHidden(); secondToolBar->hide(); // commonCombo->hide(); tab->getTabBar()->hide(); tab->setMargin(tab->margin()); if (show_fullscreen_msg) { fullscreen_msg-> move(tab->x() + tab->width()/2 - fullscreen_msg->width()/2, qApp->desktop()->height()/16 - fullscreen_msg->height()/2); fullscreen_msg->show(); diff --git a/core/apps/embeddedkonsole/konsole.h b/core/apps/embeddedkonsole/konsole.h index 37babbb..e163cb8 100644 --- a/core/apps/embeddedkonsole/konsole.h +++ b/core/apps/embeddedkonsole/konsole.h @@ -28,148 +28,148 @@ #include <qpopupmenu.h> #include <qstrlist.h> #include <qintdict.h> #include <qptrdict.h> #include <qtabwidget.h> #include <qtoolbar.h> #include <qcombobox.h> #include <qcolor.h> #include "MyPty.h" #include "TEWidget.h" #include "TEmuVt102.h" #include "session.h" class EKNumTabWidget; class Konsole : public QMainWindow { Q_OBJECT public: static QString appName() { return QString::fromLatin1("embeddedkonsole"); } Konsole(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); Konsole(const char * name, const char* pgm, QStrList & _args, int histon); ~Konsole(); void setColLin(int columns, int lines); QToolBar *secondToolBar; void show(); void setColor(int); int lastSelectedMenu; int startUp; public slots: void changeFontSize(int); void toggleFullScreen(); void setFullScreen(bool); void changeSession(int); void cycleZoom(); void newSession(); private slots: void setDocument(const QString &); void doneSession(TEWidget*,int); - void changeTitle(TEWidget*,QString); + void changeTitle(TEWidget*, const QString&); void changeColumns(int); void setFont(int); // void fontChanged(int); void configMenuSelected(int ); void colorMenuSelected(int); void colorMenuIsSelected(int); void tabMenuSelected(int); void sessionListSelected(int); void enterCommand(int); void hitEnter(); void hitSpace(); void hitTab(); void hitPaste(); void hitUp(); void hitDown(); void switchSession(QWidget *); void changeCommand(const QString &, int); void initCommandList(); void scrollMenuSelected(int); void editCommandListMenuSelected(int); void parseCommandLine(); void changeForegroundColor(const QColor &); void changeBackgroundColor(const QColor &); void historyDialog(); void fullscreenTimeout(); private: void doWrap(); void init(const char* _pgm, QStrList & _args); void initSession(const char* _pgm, QStrList & _args); void runSession(TESession* s); void setColorPixmaps(); void setHistory(bool); void setColors(QColor foreground, QColor background); - int findFont(QString name, int size, bool exact = false); + int findFont(const QString& name, int size, bool exact = false); QSize calcSize(int columns, int lines); TEWidget* getTe(); QStringList commands; QLabel * msgLabel; QColor foreground, background; bool fromMenu; bool fullscreen; private: class VTFont { public: - VTFont(QString name, QFont& font, QString family, int familyNum, int size) + VTFont(const QString& name, QFont& font, const QString& family, int familyNum, int size) { this->name = name; this->font = font; this->family = family; this->size = size; this->familyNum = familyNum; } QFont& getFont() { return font; } QString getName() { return name; } int getSize() { return(size); } QString getFamily() { return(family); } int getFamilyNum() { return(familyNum); } private: QFont font; QString name; QString family; int familyNum; int size; }; EKNumTabWidget* tab; int tabPos; int nsessions; QList<VTFont> fonts; int cfont; QCString se_pgm; QStrList se_args; QToolBar *menuToolBar; QToolBar *toolBar; QComboBox *commonCombo; diff --git a/core/apps/embeddedkonsole/session.h b/core/apps/embeddedkonsole/session.h index f399e96..a4b33e2 100644 --- a/core/apps/embeddedkonsole/session.h +++ b/core/apps/embeddedkonsole/session.h @@ -23,72 +23,72 @@ #include <qmainwindow.h> #include <qstrlist.h> #include "MyPty.h" #include "TEWidget.h" #include "TEmuVt102.h" class TESession : public QObject { Q_OBJECT public: TESession(QMainWindow* main, TEWidget* w, const char* pgm, QStrList & _args, const char* term); ~TESession(); public: void setConnect(bool r); TEmulation* getEmulation(); // to control emulation bool isSecure(); public: int schemaNo(); int fontNo(); const char* emuName(); const QString& Title(); bool history(); int keymap(); void setHistory(bool on); void setSchemaNo(int sn); void setKeymapNo(int kn); void setFontNo(int fn); void kill(int signal); public slots: void run(); void done(int status); void terminate(); void changeTitle(int, const QString& title); signals: void done(TEWidget*, int); - void changeTitle(TEWidget*, QString); + void changeTitle(TEWidget*, const QString&); private: // TEPty* sh; MyPty* sh; TEWidget* te; TEmulation* em; //FIXME: using the indices here // is propably very bad. We should // use a persistent reference instead. int schema_no; int font_no; int keymap_no; QString title; const char* pgm; QStrList args; QCString term; }; #endif |