author | llornkcor <llornkcor> | 2002-07-07 15:42:29 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-07-07 15:42:29 (UTC) |
commit | 1d6f229e63930e7af2b691a4715dd94649257048 (patch) (unidiff) | |
tree | 2189c3cf19019ad38a45847efdef572ed06d5a2d /core/apps/embeddedkonsole/konsole.cpp | |
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
Diffstat (limited to 'core/apps/embeddedkonsole/konsole.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 68 |
1 files changed, 64 insertions, 4 deletions
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 | |||
@@ -54,6 +54,8 @@ | |||
54 | #include "keytrans.h" | 54 | #include "keytrans.h" |
55 | #include "commandeditdialog.h" | 55 | #include "commandeditdialog.h" |
56 | 56 | ||
57 | #include <opie/colorpopupmenu.h> | ||
58 | |||
57 | class EKNumTabBar : public QTabBar { | 59 | class EKNumTabBar : public QTabBar { |
58 | public: | 60 | public: |
59 | void numberTabs() | 61 | void numberTabs() |
@@ -206,6 +208,8 @@ void Konsole::init(const char* _pgm, QStrList & _args) | |||
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 | ||
@@ -288,11 +292,12 @@ void Konsole::init(const char* _pgm, QStrList & _args) | |||
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 ); |
@@ -614,6 +619,11 @@ void Konsole::switchSession(QWidget* w) { | |||
614 | } | 619 | } |
615 | } | 620 | } |
616 | 621 | ||
622 | void 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 |
618 | void Konsole::colorMenuSelected(int iD) | 628 | void 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 |
@@ -622,8 +632,8 @@ void Konsole::colorMenuSelected(int 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(); |
@@ -634,7 +644,7 @@ void Konsole::colorMenuSelected(int iD) | |||
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 { |
@@ -712,6 +722,22 @@ void Konsole::colorMenuSelected(int iD) | |||
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) { |
@@ -727,6 +753,7 @@ void Konsole::colorMenuSelected(int iD) | |||
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 | ||
732 | void Konsole::configMenuSelected(int iD) | 759 | void Konsole::configMenuSelected(int iD) |
@@ -885,3 +912,36 @@ void Konsole::parseCommandLine() { | |||
885 | } | 912 | } |
886 | startUp++; | 913 | startUp++; |
887 | } | 914 | } |
915 | |||
916 | void 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 | |||
927 | qDebug("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 | |||
935 | void 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 | } | ||