summaryrefslogtreecommitdiff
path: root/core/apps/embeddedkonsole
Unidiff
Diffstat (limited to 'core/apps/embeddedkonsole') (more/less context) (ignore whitespace changes)
-rwxr-xr-xcore/apps/embeddedkonsole/embeddedkonsole.pro28
-rw-r--r--core/apps/embeddedkonsole/konsole.cpp68
-rw-r--r--core/apps/embeddedkonsole/konsole.h8
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 \
28 MyPty.cpp \ 28 MyPty.cpp \
29 main.cpp 29 main.cpp
30INTERFACES = commandeditdialogbase.ui smallcommandeditdialogbase.ui 30INTERFACES = commandeditdialogbase.ui smallcommandeditdialogbase.ui
31TARGET = embeddedkonsole 31TARGET = embeddedkonsole
32INCLUDEPATH += $(OPIEDIR)/include 32INCLUDEPATH += $(OPIEDIR)/include
33DEPENDPATH += $(OPIEDIR)/include 33DEPENDPATH += $(OPIEDIR)/include
34LIBS += -lqpe 34LIBS += -lqpe -lopie
35REQUIRES = embeddedkonsole 35REQUIRES = embeddedkonsole
36 36
37TRANSLATIONS = ../../../i18n/de/embeddedkonsole.ts \ 37TRANSLATIONS = ../../../i18n/de/embeddedkonsole.ts \
38 ../../../i18n/en/embeddedkonsole.ts \ 38 ../../../i18n/en/embeddedkonsole.ts \
39 ../../../i18n/es/embeddedkonsole.ts \ 39 ../../../i18n/es/embeddedkonsole.ts \
40 ../../../i18n/fr/embeddedkonsole.ts \ 40 ../../../i18n/fr/embeddedkonsole.ts \
41 ../../../i18n/hu/embeddedkonsole.ts \ 41 ../../../i18n/hu/embeddedkonsole.ts \
42 ../../../i18n/ja/embeddedkonsole.ts \ 42 ../../../i18n/ja/embeddedkonsole.ts \
43 ../../../i18n/ko/embeddedkonsole.ts \ 43 ../../../i18n/ko/embeddedkonsole.ts \
44 ../../../i18n/no/embeddedkonsole.ts \ 44 ../../../i18n/no/embeddedkonsole.ts \
45 ../../../i18n/pl/embeddedkonsole.ts \ 45 ../../../i18n/pl/embeddedkonsole.ts \
46 ../../../i18n/pt/embeddedkonsole.ts \ 46 ../../../i18n/pt/embeddedkonsole.ts \
47 ../../../i18n/pt_BR/embeddedkonsole.ts \ 47 ../../../i18n/pt_BR/embeddedkonsole.ts \
48 ../../../i18n/sl/embeddedkonsole.ts \ 48 ../../../i18n/sl/embeddedkonsole.ts \
49 ../../../i18n/zh_CN/embeddedkonsole.ts \ 49 ../../../i18n/zh_CN/embeddedkonsole.ts \
50 ../../../i18n/zh_TW/embeddedkonsole.ts 50 ../../../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 @@
51#include <assert.h> 51#include <assert.h>
52 52
53#include "konsole.h" 53#include "konsole.h"
54#include "keytrans.h" 54#include "keytrans.h"
55#include "commandeditdialog.h" 55#include "commandeditdialog.h"
56 56
57#include <opie/colorpopupmenu.h>
58
57class EKNumTabBar : public QTabBar { 59class EKNumTabBar : public QTabBar {
58public: 60public:
59 void numberTabs() 61 void numberTabs()
60 { 62 {
61 // Yes, it really is this messy. QTabWidget needs functions 63 // Yes, it really is this messy. QTabWidget needs functions
62 // that provide acces to tabs in a sequential way. 64 // that provide acces to tabs in a sequential way.
@@ -203,12 +205,14 @@ void Konsole::initCommandList()
203void Konsole::init(const char* _pgm, QStrList & _args) 205void Konsole::init(const char* _pgm, QStrList & _args)
204{ 206{
205 b_scroll = TRUE; // histon; 207 b_scroll = TRUE; // histon;
206 n_keytab = 0; 208 n_keytab = 0;
207 n_render = 0; 209 n_render = 0;
208 startUp=0; 210 startUp=0;
211 fromMenu = FALSE;
212
209 setCaption( tr("Terminal") ); 213 setCaption( tr("Terminal") );
210 setIcon( Resource::loadPixmap( "konsole" ) ); 214 setIcon( Resource::loadPixmap( "konsole" ) );
211 215
212 Config cfg("Konsole"); 216 Config cfg("Konsole");
213 cfg.setGroup("Konsole"); 217 cfg.setGroup("Konsole");
214 QString tmp; 218 QString tmp;
@@ -285,17 +289,18 @@ void Konsole::init(const char* _pgm, QStrList & _args)
285 colorMenu->insertItem(tr( "Blue on Magenta")); 289 colorMenu->insertItem(tr( "Blue on Magenta"));
286 colorMenu->insertItem(tr( "Magenta on Blue")); 290 colorMenu->insertItem(tr( "Magenta on Blue"));
287 colorMenu->insertItem(tr( "Cyan on White")); 291 colorMenu->insertItem(tr( "Cyan on White"));
288 colorMenu->insertItem(tr( "White on Cyan")); 292 colorMenu->insertItem(tr( "White on Cyan"));
289 colorMenu->insertItem(tr( "Blue on Black")); 293 colorMenu->insertItem(tr( "Blue on Black"));
290 colorMenu->insertItem(tr( "Amber on Black")); 294 colorMenu->insertItem(tr( "Amber on Black"));
295 colorMenu->insertItem(tr( "Custom"));
291 configMenu->insertItem(tr( "Colors") ,colorMenu); 296 configMenu->insertItem(tr( "Colors") ,colorMenu);
292 297
293 connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); 298 connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) ));
294 connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); 299 connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) ));
295 connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuSelected(int) )); 300 connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuIsSelected(int) ));
296 connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); 301 connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int)));
297 connect(editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int))); 302 connect(editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int)));
298 menuBar->insertItem( tr("Font"), fontList ); 303 menuBar->insertItem( tr("Font"), fontList );
299 menuBar->insertItem( tr("Options"), configMenu ); 304 menuBar->insertItem( tr("Options"), configMenu );
300 305
301 QPEToolBar *toolbar = new QPEToolBar( this ); 306 QPEToolBar *toolbar = new QPEToolBar( this );
@@ -611,33 +616,38 @@ void Konsole::switchSession(QWidget* w) {
611 if (cf) { 616 if (cf) {
612 cfont = i; 617 cfont = i;
613 } 618 }
614 } 619 }
615} 620}
616 621
622void Konsole::colorMenuIsSelected(int iD) {
623 fromMenu = TRUE;
624 colorMenuSelected(iD);
625}
626
617/// ------------------------------- some new stuff by L.J. Potter 627/// ------------------------------- some new stuff by L.J. Potter
618void Konsole::colorMenuSelected(int iD) 628void Konsole::colorMenuSelected(int iD)
619{ // this is NOT pretty, elegant or anything else besides functional 629{ // this is NOT pretty, elegant or anything else besides functional
620// QString temp; 630// QString temp;
621// qDebug( temp.sprintf("colormenu %d", iD)); 631// qDebug( temp.sprintf("colormenu %d", iD));
622 TEWidget* te = getTe(); 632 TEWidget* te = getTe();
623 Config cfg("Konsole"); 633 Config cfg("Konsole");
624 cfg.setGroup("Colors"); 634 cfg.setGroup("Colors");
625 QColor foreground; 635// QColor foreground;
626 QColor background; 636// QColor background;
627 colorMenu->setItemChecked(lastSelectedMenu,FALSE); 637 colorMenu->setItemChecked(lastSelectedMenu,FALSE);
628 ColorEntry m_table[TABLE_COLORS]; 638 ColorEntry m_table[TABLE_COLORS];
629 const ColorEntry * defaultCt=te->getdefaultColorTable(); 639 const ColorEntry * defaultCt=te->getdefaultColorTable();
630 /////////// fore back 640 /////////// fore back
631 int i; 641 int i;
632 if(iD==-9) { // default default 642 if(iD==-9) { // default default
633 for (i = 0; i < TABLE_COLORS; i++) { 643 for (i = 0; i < TABLE_COLORS; i++) {
634 m_table[i].color = defaultCt[i].color; 644 m_table[i].color = defaultCt[i].color;
635 if(i==1 || i == 11) 645 if(i==1 || i == 11)
636 m_table[i].transparent=1; 646 m_table[i].transparent=1;
637 cfg.writeEntry("Schema","98"); 647 cfg.writeEntry("Schema","9");
638 colorMenu->setItemChecked(-9,TRUE); 648 colorMenu->setItemChecked(-9,TRUE);
639 } 649 }
640 } else { 650 } else {
641 if(iD==-6) { // green black 651 if(iD==-6) { // green black
642 foreground.setRgb(0x18,255,0x18); 652 foreground.setRgb(0x18,255,0x18);
643 background.setRgb(0x00,0x00,0x00); 653 background.setRgb(0x00,0x00,0x00);
@@ -709,12 +719,28 @@ void Konsole::colorMenuSelected(int iD)
709 if(iD==-18) {// Black, Gold 719 if(iD==-18) {// Black, Gold
710 background.setRgb(0x00,0x00,0x00); 720 background.setRgb(0x00,0x00,0x00);
711 foreground.setRgb(255,215,0); 721 foreground.setRgb(255,215,0);
712 cfg.writeEntry("Schema","18"); 722 cfg.writeEntry("Schema","18");
713 colorMenu->setItemChecked(-18,TRUE); 723 colorMenu->setItemChecked(-18,TRUE);
714 } 724 }
725 if(iD==-19) {// Custom
726 qDebug("do custom");
727 if(fromMenu) {
728 ColorPopupMenu* penColorPopupMenu = new ColorPopupMenu(Qt::black, this, "foreground color");
729 connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this,
730 SLOT(changeForegroundColor(const QColor&)));
731 penColorPopupMenu->exec();
732 }
733 cfg.writeEntry("Schema","19");
734 if(!fromMenu) {
735 foreground.setNamedColor(cfg.readEntry("foreground",""));
736 background.setNamedColor(cfg.readEntry("background",""));
737 }
738 fromMenu=FALSE;
739 colorMenu->setItemChecked(-19,TRUE);
740 }
715 741
716 for (i = 0; i < TABLE_COLORS; i++) { 742 for (i = 0; i < TABLE_COLORS; i++) {
717 if(i==0 || i == 10) { 743 if(i==0 || i == 10) {
718 m_table[i].color = foreground; 744 m_table[i].color = foreground;
719 } 745 }
720 else if(i==1 || i == 11) { 746 else if(i==1 || i == 11) {
@@ -724,12 +750,13 @@ void Konsole::colorMenuSelected(int iD)
724 m_table[i].color = defaultCt[i].color; 750 m_table[i].color = defaultCt[i].color;
725 } 751 }
726 } 752 }
727 lastSelectedMenu = iD; 753 lastSelectedMenu = iD;
728 te->setColorTable(m_table); 754 te->setColorTable(m_table);
729 update(); 755 update();
756
730} 757}
731 758
732void Konsole::configMenuSelected(int iD) 759void Konsole::configMenuSelected(int iD)
733{ 760{
734// QString temp; 761// QString temp;
735// qDebug( temp.sprintf("configmenu %d",iD)); 762// qDebug( temp.sprintf("configmenu %d",iD));
@@ -882,6 +909,39 @@ void Konsole::parseCommandLine() {
882 system(cmd.latin1()); 909 system(cmd.latin1());
883 exit(0);//close(); 910 exit(0);//close();
884 } // end -e switch 911 } // end -e switch
885 } 912 }
886 startUp++; 913 startUp++;
887} 914}
915
916void Konsole::changeForegroundColor(const QColor &color) {
917 Config cfg("Konsole");
918 cfg.setGroup("Colors");
919 int r, g, b;
920 color.rgb(&r,&g,&b);
921 foreground.setRgb(r,g,b);
922// QString colors;
923// colors.sprintf("%d,%d,%d"color.red,color.green,color.blue);
924 cfg.writeEntry("foreground",color.name());
925 cfg.write();
926
927qDebug("do other dialog");
928 ColorPopupMenu* penColorPopupMenu2 = new ColorPopupMenu(Qt::black, this,"background color");
929 connect(penColorPopupMenu2, SIGNAL(colorSelected(const QColor&)), this,
930 SLOT(changeBackgroundColor(const QColor&)));
931 penColorPopupMenu2->exec();
932
933}
934
935void Konsole::changeBackgroundColor(const QColor &color) {
936
937 qDebug("Change background");
938 Config cfg("Konsole");
939 cfg.setGroup("Colors");
940 int r, g, b;
941 color.rgb(&r,&g,&b);
942 background.setRgb(r,g,b);
943// QString colors;
944// colors.sprintf("%d,%d,%d"color.red,color.green,color.blue);
945 cfg.writeEntry("background",color.name());
946 cfg.write();
947}
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 @@
29#include <qstrlist.h> 29#include <qstrlist.h>
30#include <qintdict.h> 30#include <qintdict.h>
31#include <qptrdict.h> 31#include <qptrdict.h>
32#include <qtabwidget.h> 32#include <qtabwidget.h>
33#include <qpe/qpetoolbar.h> 33#include <qpe/qpetoolbar.h>
34#include <qcombobox.h> 34#include <qcombobox.h>
35#include <qcolor.h>
35 36
36#include "MyPty.h" 37#include "MyPty.h"
37#include "TEWidget.h" 38#include "TEWidget.h"
38#include "TEmuVt102.h" 39#include "TEmuVt102.h"
39#include "session.h" 40#include "session.h"
40 41
@@ -59,12 +60,13 @@ private slots:
59 void setDocument(const QString &); 60 void setDocument(const QString &);
60 void doneSession(TESession*,int); 61 void doneSession(TESession*,int);
61 void changeColumns(int); 62 void changeColumns(int);
62 void fontChanged(int); 63 void fontChanged(int);
63 void configMenuSelected(int ); 64 void configMenuSelected(int );
64 void colorMenuSelected(int); 65 void colorMenuSelected(int);
66 void colorMenuIsSelected(int);
65 void enterCommand(int); 67 void enterCommand(int);
66 void hitEnter(); 68 void hitEnter();
67 void hitSpace(); 69 void hitSpace();
68 void hitTab(); 70 void hitTab();
69 void hitPaste(); 71 void hitPaste();
70 void hitUp(); 72 void hitUp();
@@ -73,22 +75,26 @@ private slots:
73 void newSession(); 75 void newSession();
74 void changeCommand(const QString &, int); 76 void changeCommand(const QString &, int);
75 void initCommandList(); 77 void initCommandList();
76 void scrollMenuSelected(int); 78 void scrollMenuSelected(int);
77 void editCommandListMenuSelected(int); 79 void editCommandListMenuSelected(int);
78 void parseCommandLine(); 80 void parseCommandLine();
81 void changeForegroundColor(const QColor &);
82 void changeBackgroundColor(const QColor &);
79private: 83private:
80 void init(const char* _pgm, QStrList & _args); 84 void init(const char* _pgm, QStrList & _args);
81 void initSession(const char* _pgm, QStrList & _args); 85 void initSession(const char* _pgm, QStrList & _args);
82 void runSession(TESession* s); 86 void runSession(TESession* s);
83 void setColorPixmaps(); 87 void setColorPixmaps();
84 void setHistory(bool); 88 void setHistory(bool);
85 QSize calcSize(int columns, int lines); 89 QSize calcSize(int columns, int lines);
86 TEWidget* getTe(); 90 TEWidget* getTe();
87 QStringList commands; 91 QStringList commands;
88 92 QLabel * msgLabel;
93 QColor foreground, background;
94bool fromMenu;
89private: 95private:
90 class VTFont 96 class VTFont
91 { 97 {
92 public: 98 public:
93 VTFont(QString name, QFont& font) 99 VTFont(QString name, QFont& font)
94 { 100 {