summaryrefslogtreecommitdiffstats
path: root/src/MainWidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/MainWidget.cpp')
-rw-r--r--src/MainWidget.cpp39
1 files changed, 34 insertions, 5 deletions
diff --git a/src/MainWidget.cpp b/src/MainWidget.cpp
index e57ff39..ff7dc62 100644
--- a/src/MainWidget.cpp
+++ b/src/MainWidget.cpp
@@ -38,7 +38,7 @@
#include <tqfontdialog.h>
#include <tdeconfig.h>
#include <tdeapplication.h>
-
+#include <tqcolordialog.h>
#define R1LEN 13
@@ -73,15 +73,15 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
int stx=15;
int sty=15;
extent_visible=false;
+
TDEConfig *cfg = TDEApplication::kApplication()->config();
if (cfg)
{
extent_visible = cfg->readBoolEntry("numpad_visible", false);
+ TQString backgroundC = cfg->readEntry("keyboardBackgroundColor", "#cdc0b0");
+ setPaletteBackgroundColor(TQColor(backgroundC));
}
-// resize ( 550,235 );
-// move(0,0);
-
VButton *esc = new VButton ( this,"" );
esc->setKeyCode ( 9 );
esc->move ( stx,sty );
@@ -409,7 +409,6 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
connect ( t, TQT_SIGNAL ( timeout() ), this, TQT_SLOT ( queryModState() ) );
t->start ( 500, FALSE );
- setPaletteBackgroundColor ( TQt::black );
setFocusPolicy ( TQ_NoFocus );
int padx= 550;
@@ -525,6 +524,10 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
bool fnt_autores = cfg->readBoolEntry("autoresfont",true);
m->setItemChecked(mnu_autores, fnt_autores);
+ m->insertItem ( i18n ("Background color"), this, TQT_SLOT ( chooseBackgroundColor() ) );
+ m->insertItem ( i18n ("Keys color (requires restart)"), this, TQT_SLOT ( chooseKeysColor() ) );
+
+ m->insertSeparator();
mnu_dock = m->insertItem ( "Dock widget", this, TQT_SLOT ( showDock() ) );
bool show_dock = cfg->readBoolEntry("showdock",false);
m->setItemChecked(mnu_dock, show_dock);
@@ -572,6 +575,32 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
}
}
+void MainWidget::chooseBackgroundColor()
+{
+ TDEConfig *cfg = TDEApplication::kApplication()->config();
+ TQString backgroundC = cfg->readEntry("keyboardBackgroundColor", "#cdc0b0");
+ TQColor newBackgroundC = TQColorDialog::getColor(TQColor(backgroundC));
+ if (newBackgroundC.isValid())
+ {
+ cfg->writeEntry("keyboardBackgroundColor", newBackgroundC.name()); // save as #rrbbgg
+ cfg->sync();
+ setPaletteBackgroundColor(newBackgroundC);
+ }
+}
+
+void MainWidget::chooseKeysColor()
+{
+ TDEConfig *cfg = TDEApplication::kApplication()->config();
+ TQString keysC = cfg->readEntry("keysColor", "#f0f0f0");
+ TQColor newkeysC = TQColorDialog::getColor(TQColor(keysC));
+ if (newkeysC.isValid())
+ {
+ cfg->writeEntry("keysColor", newkeysC.name()); // save as #rrbbgg
+ cfg->sync();
+ // can't set PaletteBackgroundColor because it's in VButton::VButton - needs restart to read configuration entry
+ }
+}
+
void MainWidget::finishInit()
{
TDEConfig *cfg = TDEApplication::kApplication()->config();