author | llornkcor <llornkcor> | 2002-07-07 15:42:29 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-07-07 15:42:29 (UTC) |
commit | 1d6f229e63930e7af2b691a4715dd94649257048 (patch) (side-by-side diff) | |
tree | 2189c3cf19019ad38a45847efdef572ed06d5a2d | |
parent | b61380e31f6fa19acb20c5c603441d9ff64e344e (diff) | |
download | opie-1d6f229e63930e7af2b691a4715dd94649257048.zip opie-1d6f229e63930e7af2b691a4715dd94649257048.tar.gz opie-1d6f229e63930e7af2b691a4715dd94649257048.tar.bz2 |
fixed bug in transparent color schemebeing shown properly, and added custom color. Still a bug when using the 'more' option, cant figure out, I think its in colorpopupmenu
-rwxr-xr-x | core/apps/embeddedkonsole/embeddedkonsole.pro | 28 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 68 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/konsole.h | 8 |
3 files changed, 85 insertions, 19 deletions
diff --git a/core/apps/embeddedkonsole/embeddedkonsole.pro b/core/apps/embeddedkonsole/embeddedkonsole.pro index de0cfa1..6b7af27 100755 --- a/core/apps/embeddedkonsole/embeddedkonsole.pro +++ b/core/apps/embeddedkonsole/embeddedkonsole.pro @@ -28,23 +28,23 @@ SOURCES = TEScreen.cpp \ MyPty.cpp \ main.cpp INTERFACES = commandeditdialogbase.ui smallcommandeditdialogbase.ui TARGET = embeddedkonsole INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe +LIBS += -lqpe -lopie REQUIRES = embeddedkonsole TRANSLATIONS = ../../../i18n/de/embeddedkonsole.ts \ - ../../../i18n/en/embeddedkonsole.ts \ - ../../../i18n/es/embeddedkonsole.ts \ - ../../../i18n/fr/embeddedkonsole.ts \ - ../../../i18n/hu/embeddedkonsole.ts \ - ../../../i18n/ja/embeddedkonsole.ts \ - ../../../i18n/ko/embeddedkonsole.ts \ - ../../../i18n/no/embeddedkonsole.ts \ - ../../../i18n/pl/embeddedkonsole.ts \ - ../../../i18n/pt/embeddedkonsole.ts \ - ../../../i18n/pt_BR/embeddedkonsole.ts \ - ../../../i18n/sl/embeddedkonsole.ts \ - ../../../i18n/zh_CN/embeddedkonsole.ts \ - ../../../i18n/zh_TW/embeddedkonsole.ts + ../../../i18n/en/embeddedkonsole.ts \ + ../../../i18n/es/embeddedkonsole.ts \ + ../../../i18n/fr/embeddedkonsole.ts \ + ../../../i18n/hu/embeddedkonsole.ts \ + ../../../i18n/ja/embeddedkonsole.ts \ + ../../../i18n/ko/embeddedkonsole.ts \ + ../../../i18n/no/embeddedkonsole.ts \ + ../../../i18n/pl/embeddedkonsole.ts \ + ../../../i18n/pt/embeddedkonsole.ts \ + ../../../i18n/pt_BR/embeddedkonsole.ts \ + ../../../i18n/sl/embeddedkonsole.ts \ + ../../../i18n/zh_CN/embeddedkonsole.ts \ + ../../../i18n/zh_TW/embeddedkonsole.ts diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index b0d28fc..8b1e066 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp @@ -51,12 +51,14 @@ #include <assert.h> #include "konsole.h" #include "keytrans.h" #include "commandeditdialog.h" +#include <opie/colorpopupmenu.h> + class EKNumTabBar : public QTabBar { public: void numberTabs() { // Yes, it really is this messy. QTabWidget needs functions // that provide acces to tabs in a sequential way. @@ -203,12 +205,14 @@ void Konsole::initCommandList() void Konsole::init(const char* _pgm, QStrList & _args) { b_scroll = TRUE; // histon; n_keytab = 0; n_render = 0; startUp=0; + fromMenu = FALSE; + setCaption( tr("Terminal") ); setIcon( Resource::loadPixmap( "konsole" ) ); Config cfg("Konsole"); cfg.setGroup("Konsole"); QString tmp; @@ -285,17 +289,18 @@ void Konsole::init(const char* _pgm, QStrList & _args) colorMenu->insertItem(tr( "Blue on Magenta")); colorMenu->insertItem(tr( "Magenta on Blue")); colorMenu->insertItem(tr( "Cyan on White")); colorMenu->insertItem(tr( "White on Cyan")); colorMenu->insertItem(tr( "Blue on Black")); colorMenu->insertItem(tr( "Amber on Black")); + colorMenu->insertItem(tr( "Custom")); configMenu->insertItem(tr( "Colors") ,colorMenu); 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( colorMenuSelected(int) )); + connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuIsSelected(int) )); connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); connect(editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int))); menuBar->insertItem( tr("Font"), fontList ); menuBar->insertItem( tr("Options"), configMenu ); QPEToolBar *toolbar = new QPEToolBar( this ); @@ -611,33 +616,38 @@ void Konsole::switchSession(QWidget* w) { if (cf) { cfont = i; } } } +void Konsole::colorMenuIsSelected(int iD) { + fromMenu = TRUE; + colorMenuSelected(iD); +} + /// ------------------------------- some new stuff by L.J. Potter void Konsole::colorMenuSelected(int iD) { // this is NOT pretty, elegant or anything else besides functional // QString temp; // qDebug( temp.sprintf("colormenu %d", iD)); TEWidget* te = getTe(); Config cfg("Konsole"); cfg.setGroup("Colors"); - QColor foreground; - QColor background; +// QColor foreground; +// QColor background; colorMenu->setItemChecked(lastSelectedMenu,FALSE); ColorEntry m_table[TABLE_COLORS]; const ColorEntry * defaultCt=te->getdefaultColorTable(); /////////// fore back int i; if(iD==-9) { // default default for (i = 0; i < TABLE_COLORS; i++) { m_table[i].color = defaultCt[i].color; if(i==1 || i == 11) m_table[i].transparent=1; - cfg.writeEntry("Schema","98"); + cfg.writeEntry("Schema","9"); colorMenu->setItemChecked(-9,TRUE); } } else { if(iD==-6) { // green black foreground.setRgb(0x18,255,0x18); background.setRgb(0x00,0x00,0x00); @@ -709,12 +719,28 @@ void Konsole::colorMenuSelected(int iD) if(iD==-18) {// Black, Gold background.setRgb(0x00,0x00,0x00); foreground.setRgb(255,215,0); cfg.writeEntry("Schema","18"); colorMenu->setItemChecked(-18,TRUE); } + if(iD==-19) {// Custom + qDebug("do custom"); + if(fromMenu) { + ColorPopupMenu* penColorPopupMenu = new ColorPopupMenu(Qt::black, this, "foreground color"); + connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, + SLOT(changeForegroundColor(const QColor&))); + penColorPopupMenu->exec(); + } + cfg.writeEntry("Schema","19"); + if(!fromMenu) { + foreground.setNamedColor(cfg.readEntry("foreground","")); + background.setNamedColor(cfg.readEntry("background","")); + } + fromMenu=FALSE; + colorMenu->setItemChecked(-19,TRUE); + } for (i = 0; i < TABLE_COLORS; i++) { if(i==0 || i == 10) { m_table[i].color = foreground; } else if(i==1 || i == 11) { @@ -724,12 +750,13 @@ void Konsole::colorMenuSelected(int iD) m_table[i].color = defaultCt[i].color; } } lastSelectedMenu = iD; te->setColorTable(m_table); update(); + } void Konsole::configMenuSelected(int iD) { // QString temp; // qDebug( temp.sprintf("configmenu %d",iD)); @@ -882,6 +909,39 @@ void Konsole::parseCommandLine() { system(cmd.latin1()); exit(0);//close(); } // end -e switch } startUp++; } + +void Konsole::changeForegroundColor(const QColor &color) { + Config cfg("Konsole"); + cfg.setGroup("Colors"); + int r, g, b; + color.rgb(&r,&g,&b); + foreground.setRgb(r,g,b); +// QString colors; +// colors.sprintf("%d,%d,%d"color.red,color.green,color.blue); + cfg.writeEntry("foreground",color.name()); + cfg.write(); + +qDebug("do other dialog"); + ColorPopupMenu* penColorPopupMenu2 = new ColorPopupMenu(Qt::black, this,"background color"); + connect(penColorPopupMenu2, SIGNAL(colorSelected(const QColor&)), this, + SLOT(changeBackgroundColor(const QColor&))); + penColorPopupMenu2->exec(); + +} + +void Konsole::changeBackgroundColor(const QColor &color) { + + qDebug("Change background"); + Config cfg("Konsole"); + cfg.setGroup("Colors"); + int r, g, b; + color.rgb(&r,&g,&b); + background.setRgb(r,g,b); +// QString colors; +// colors.sprintf("%d,%d,%d"color.red,color.green,color.blue); + cfg.writeEntry("background",color.name()); + cfg.write(); +} diff --git a/core/apps/embeddedkonsole/konsole.h b/core/apps/embeddedkonsole/konsole.h index 40edaec..0bf3fb3 100644 --- a/core/apps/embeddedkonsole/konsole.h +++ b/core/apps/embeddedkonsole/konsole.h @@ -29,12 +29,13 @@ #include <qstrlist.h> #include <qintdict.h> #include <qptrdict.h> #include <qtabwidget.h> #include <qpe/qpetoolbar.h> #include <qcombobox.h> +#include <qcolor.h> #include "MyPty.h" #include "TEWidget.h" #include "TEmuVt102.h" #include "session.h" @@ -59,12 +60,13 @@ private slots: void setDocument(const QString &); void doneSession(TESession*,int); void changeColumns(int); void fontChanged(int); void configMenuSelected(int ); void colorMenuSelected(int); + void colorMenuIsSelected(int); void enterCommand(int); void hitEnter(); void hitSpace(); void hitTab(); void hitPaste(); void hitUp(); @@ -73,22 +75,26 @@ private slots: void newSession(); void changeCommand(const QString &, int); void initCommandList(); void scrollMenuSelected(int); void editCommandListMenuSelected(int); void parseCommandLine(); + void changeForegroundColor(const QColor &); + void changeBackgroundColor(const QColor &); private: void init(const char* _pgm, QStrList & _args); void initSession(const char* _pgm, QStrList & _args); void runSession(TESession* s); void setColorPixmaps(); void setHistory(bool); QSize calcSize(int columns, int lines); TEWidget* getTe(); QStringList commands; - + QLabel * msgLabel; + QColor foreground, background; +bool fromMenu; private: class VTFont { public: VTFont(QString name, QFont& font) { |