@ -4,12 +4,24 @@
# include <kconfig.h>
# include <kglobal.h>
// increment this when you add a color type (mosfet)
# define KWINCOLORS 8
Options : : Options ( ) {
Options : : Options ( )
{
int i ;
for ( i = 0 ; i < KWINCOLORS * 2 ; + + i )
cg [ i ] = NULL ;
reload ( ) ;
}
Options : : ~ Options ( ) {
int i ;
for ( i = 0 ; i < KWINCOLORS * 2 ; + + i ) {
if ( cg [ i ] ) {
delete cg [ i ] ;
cg [ i ] = NULL ;
}
}
}
const QColor & Options : : color ( ColorType type , bool active )
{
return ( colors [ type + ( active ? 0 : KWINCOLORS ) ] ) ;
@ -20,6 +32,17 @@ const QFont& Options::font(bool active)
return ( active ? activeFont : inactiveFont ) ;
}
const QColorGroup & Options : : colorGroup ( ColorType type , bool active )
{
int idx = type + ( active ? 0 : KWINCOLORS ) ;
if ( cg [ idx ] )
return ( * cg [ idx ] ) ;
cg [ idx ] = new QColorGroup ( Qt : : black , colors [ idx ] , colors [ idx ] . light ( 150 ) ,
colors [ idx ] . dark ( ) , colors [ idx ] . dark ( 120 ) ,
Qt : : black , QApplication : : palette ( ) . normal ( ) .
base ( ) ) ;
return ( * cg [ idx ] ) ;
}
void Options : : reload ( )
{
@ -35,9 +58,9 @@ void Options::reload()
colors [ Frame ] = Qt : : lightGray ;
colors [ Frame ] = config - > readColorEntry ( " frame " , & colors [ Frame ] ) ;
colors [ Handle ] = config - > readColorEntry ( " handle " , & colors [ Frame ] ) ;
colors [ ButtonBg ] = config - > readColorEntry ( " buttonBackground " ,
colors [ ButtonBg ] = config - > readColorEntry ( " buttonBackground Down " ,
& colors [ Frame ] ) ;
colors [ ButtonBlend ] = config - > readColorEntry ( " buttonBlend " ,
colors [ ButtonBlend ] = config - > readColorEntry ( " buttonBlend Down " ,
& colors [ ButtonBg ] ) ;
colors [ TitleBar ] = Qt : : darkBlue ;
colors [ TitleBar ] = config - > readColorEntry ( " activeBackground " ,
@ -48,34 +71,42 @@ void Options::reload()
colors [ Font ] = Qt : : white ;
colors [ Font ] = config - > readColorEntry ( " activeForeground " , & colors [ Font ] ) ;
colors [ ButtonFg ] = Qt : : lightGray ;
colors [ ButtonFg ] = config - > readColorEntry ( " buttonForeground " ,
colors [ ButtonFg ] = config - > readColorEntry ( " buttonForeground Down " ,
& colors [ ButtonFg ] ) ;
// inactive
colors [ Frame + KWINCOLORS ] = colors [ Frame ] ;
colors [ Frame + KWINCOLORS ] =
config - > readColorEntry ( " inactiveFrame " , & colors [ Frame + KWINCOLORS ] ) ;
colors [ Handle + KWINCOLORS ] =
config - > readColorEntry ( " inactiveHandle " , & colors [ Frame + KWINCOLORS ] ) ;
config - > readColorEntry ( " inactiveFrame " , & colors [ Frame ] ) ;
colors [ TitleBar + KWINCOLORS ] = Qt : : darkGray ;
colors [ TitleBar + KWINCOLORS ] = config - >
readColorEntry ( " inactiveBackground " , & colors [ TitleBar + KWINCOLORS ] ) ;
colors [ TitleBlend + KWINCOLORS ] =
config - > readColorEntry ( " inactiveBlend " , & colors [ TitleBar + KWINCOLORS ] ) ;
colors [ ButtonBg + KWINCOLORS ] =
config - > readColorEntry ( " inactiveB uttonBackground" ,
& colors [ Frame+ KWINCOLORS ] ) ;
config - > readColorEntry ( " b uttonBackground" ,
& colors [ ButtonBg ] ) ;
colors [ ButtonBlend + KWINCOLORS ] =
config - > readColorEntry ( " inactiveButtonBlend " ,
& colors [ ButtonBg + KWINCOLORS ] ) ;
config - > readColorEntry ( " buttonBlend " ,
& colors [ ButtonBlend ] ) ;
colors [ ButtonFg + KWINCOLORS ] = config - >
readColorEntry ( " buttonForeground " , & colors [ ButtonFg ] ) ;
colors [ Handle + KWINCOLORS ] =
config - > readColorEntry ( " inactiveHandle " , & colors [ Handle ] ) ;
colors [ Font + KWINCOLORS ] = Qt : : lightGray ;
colors [ Font + KWINCOLORS ] = config - > readColorEntry ( " inactiveForeground " ,
& colors [ Font + KWINCOLORS ] ) ;
colors [ ButtonFg + KWINCOLORS ] = config - >
readColorEntry ( " inactiveButtonForeground " , & colors [ ButtonFg ] ) ;
activeFont = QFont ( " Helvetica " , 12 , QFont : : Bold ) ;
activeFont = config - > readFontEntry ( " activeFont " , & activeFont ) ;
inactiveFont = config - > readFontEntry ( " inactiveFont " , & activeFont ) ;
int i ;
for ( i = 0 ; i < KWINCOLORS * 2 ; + + i ) {
if ( cg [ i ] ) {
delete cg [ i ] ;
cg [ i ] = NULL ;
}
}
}