[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: style, color and font changes: now or after RC1/beta2?
From: Karol Szwed <gallium () physos ! info>
Date: 2002-01-27 9:07:07
[Download RAW message or body]
On Sat, 26 Jan 2002 23:27:04 -0800, Waldo Bastian wrote:
>On Saturday 26 January 2002 06:23 am, Aaron J. Seigo wrote:
>> i understand that CVS is to be tagged on monday for an RC/beta ... i h=
ave a
>> patch for kapplication that i posted earlier that makes it listen to t=
he Qt
>> style/color/font change msgs instead of the KIPC one...
>
>Can you repost it?
I think you just missed him, so here is my copy.
["kapplication_qtstyles.patch" (text/x-diff)]
Index: kapplication.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdecore/kapplication.cpp,v
retrieving revision 1.504
diff -u -3 -d -p -r1.504 kapplication.cpp
--- kapplication.cpp 2002/01/20 22:50:47 1.504
+++ kapplication.cpp 2002/01/22 17:36:32
@@ -696,7 +696,7 @@ void KApplication::init(bool GUIenabled)
if( KProcessController::theKProcessController == 0 )
(void) new KProcessController();
- QApplication::setDesktopSettingsAware( false );
+ QApplication::setDesktopSettingsAware( true );
KApp = this;
@@ -739,9 +739,6 @@ void KApplication::init(bool GUIenabled)
}
}
- kdisplaySetStyle();
- kdisplaySetFont();
-// kdisplaySetPalette(); done by kdisplaySetStyle
propagateSettings(SETTINGS_QT);
// Set default mime-source factory
@@ -1446,7 +1443,6 @@ bool KApplication::x11EventFilter( XEven
switch (id)
{
case KIPC::StyleChanged:
- KGlobal::config()->reparseConfiguration();
kdisplaySetStyle();
break;
@@ -1457,14 +1453,13 @@ bool KApplication::x11EventFilter( XEven
break;
case KIPC::PaletteChanged:
- KGlobal::config()->reparseConfiguration();
- kdisplaySetPalette();
+ applyGUIStyle();
+ //kdisplaySetPalette();
break;
case KIPC::FontChanged:
- KGlobal::config()->reparseConfiguration();
- KGlobalSettings::rereadFontSettings();
- kdisplaySetFont();
+ applyGUIStyle();
+ //kdisplaySetFont();
break;
case KIPC::BackgroundChanged:
@@ -1535,38 +1530,8 @@ void KApplication::disableStyles()
void KApplication::applyGUIStyle()
{
- if ( !useStyles ) return;
-
- KSimpleConfig pConfig(d->styleFile , true );
- QString oldGroup = pConfig.group();
- pConfig.setGroup("KDE");
- QString styleStr = pConfig.readEntry("WidgetStyle",
- QPixmap::defaultDepth() > 8 ? "HighColor" : "Default");
-
-#if 0
- // default style is not yet ported - currently looking into it
- if(styleStr == "Default"){
- pKStyle = new KDEStyle;
- setStyle(pKStyle);
- styleHandle=0;
- }
- else
-#endif
- if(styleStr == "Windows 95"){
- setStyle("Windows");
- }
- else if(styleStr == "Qt SGI"){
- setStyle("SGI");
- }
- else {
- QStyle* sp = QStyleFactory::create( styleStr );
- if ( !sp )
- sp = QStyleFactory::create( *(QStyleFactory::keys().begin()) );
- setStyle(sp);
- }
-
- // Reread palette from config file.
- kdisplaySetPalette();
+ if (useStyles)
+ QApplication::x11_apply_settings();
}
QString KApplication::caption() const
@@ -1609,87 +1574,7 @@ QString KApplication::makeStdCaption( co
void KApplication::kdisplaySetPalette()
{
- int contrast_ = KGlobalSettings::contrast();
-
- // the following is temporary and will soon dissappear (Matthias, 3.August 1999 )
- KConfigBase* config = KGlobal::config();
- KConfigGroupSaver saver( config, "General" );
-
- QColor kde2Gray(220, 220, 220);
- QColor kde2Blue;
- if (QPixmap::defaultDepth() > 8)
- kde2Blue.setRgb(84, 112, 152);
- else
- kde2Blue.setRgb(0, 0, 192);
-
- QColor background = config->readColorEntry( "background", &kde2Gray );
- QColor foreground = config->readColorEntry( "foreground", &black );
- QColor button = config->readColorEntry( "buttonBackground", &background );
- QColor buttonText = config->readColorEntry( "buttonForeground", &foreground );
- QColor highlight = config->readColorEntry( "selectBackground", &kde2Blue);
- QColor highlightedText = config->readColorEntry( "selectForeground", &white );
- QColor base = config->readColorEntry( "windowBackground", &white );
- QColor baseText = config->readColorEntry( "windowForeground", &black );
-
- int highlightVal, lowlightVal;
- highlightVal = 100 + (2*contrast_+4)*16/10;
- lowlightVal = 100 + (2*contrast_+4)*10;
-
- QColor disfg = foreground;
-
- int h, s, v;
- disfg.hsv( &h, &s, &v );
- if (v > 128)
- // dark bg, light fg - need a darker disabled fg
- disfg = disfg.dark(lowlightVal);
- else if (disfg != black)
- // light bg, dark fg - need a lighter disabled fg - but only if !black
- disfg = disfg.light(highlightVal);
- else
- // black fg - use darkgrey disabled fg
- disfg = Qt::darkGray;
-
- QColorGroup disabledgrp(disfg, background,
- background.light(highlightVal),
- background.dark(lowlightVal),
- background.dark(120),
- background.dark(120), base);
-
- QColorGroup colgrp(foreground, background, background.light(highlightVal),
- background.dark(lowlightVal),
- background.dark(120),
- baseText, base);
-
- int inlowlightVal = lowlightVal-25;
- if(inlowlightVal < 120)
- inlowlightVal = 120;
-
- colgrp.setColor(QColorGroup::Highlight, highlight);
- colgrp.setColor(QColorGroup::HighlightedText, highlightedText);
- colgrp.setColor(QColorGroup::Button, button);
- colgrp.setColor(QColorGroup::ButtonText, buttonText);
- colgrp.setColor(QColorGroup::Midlight, background.light(110));
-
- disabledgrp.setColor(QColorGroup::Button, button);
- disabledgrp.setColor(QColorGroup::ButtonText, buttonText);
- disabledgrp.setColor(QColorGroup::Midlight, background.light(110));
-
- QPalette newPal(colgrp, disabledgrp, colgrp);
-/*
- if(QPixmap::defaultDepth() > 8){
- QColorGroup iGrp(colgrp);
- iGrp.setColor(QColorGroup::Button, colgrp.button().light(115));
- iGrp.setColor(QColorGroup::ButtonText, colgrp.buttonText().light(115));
- iGrp.setColor(QColorGroup::Text, colgrp.text().light(115));
- iGrp.setColor(QColorGroup::Dark, colgrp.dark().light(115));
- iGrp.setColor(QColorGroup::Mid, colgrp.mid().light(115));
- iGrp.setColor(QColorGroup::Midlight, colgrp.midlight().light(115));
- iGrp.setColor(QColorGroup::Light, colgrp.light().light(115));
- newPal.setInactive(iGrp);
- }
-*/
- QApplication::setPalette(newPal, true);
-
+ QApplication::x11_apply_settings();
//style().polish(newPal);
emit kdisplayPaletteChanged();
emit appearanceChanged();
@@ -1697,16 +1582,7 @@ void KApplication::kdisplaySetPalette()
void KApplication::kdisplaySetFont()
{
- QApplication::setFont(KGlobalSettings::generalFont(), true);
- QApplication::setFont(KGlobalSettings::menuFont(), true, "QMenuBar");
- QApplication::setFont(KGlobalSettings::menuFont(), true, "QPopupMenu");
- QApplication::setFont(KGlobalSettings::menuFont(), true, "KPopupTitle");
-
- // "patch" standard QStyleSheet to follow our fonts
- QStyleSheet* sheet = QStyleSheet::defaultSheet();
- sheet->item ("pre")->setFontFamily (KGlobalSettings::fixedFont().family());
- sheet->item ("code")->setFontFamily (KGlobalSettings::fixedFont().family());
- sheet->item ("tt")->setFontFamily (KGlobalSettings::fixedFont().family());
+ QApplication::x11_apply_settings();
emit kdisplayFontChanged();
emit appearanceChanged();
@@ -1729,30 +1605,12 @@ void KApplication::propagateSettings(Set
KConfigBase* config = KGlobal::config();
KConfigGroupSaver saver( config, "KDE" );
- int num = config->readNumEntry("CursorBlinkRate", QApplication::cursorFlashTime());
- if (num < 200)
- num = 200;
- if (num > 2000)
- num = 2000;
- QApplication::setCursorFlashTime(num);
- num = config->readNumEntry("DoubleClickInterval", QApplication::doubleClickInterval());
- QApplication::setDoubleClickInterval(num);
- num = config->readNumEntry("StartDragTime", QApplication::startDragTime());
+ int num = config->readNumEntry("StartDragTime", QApplication::startDragTime());
QApplication::setStartDragTime(num);
num = config->readNumEntry("StartDragDist", QApplication::startDragDistance());
QApplication::setStartDragDistance(num);
- num = config->readNumEntry("WheelScrollLines", QApplication::wheelScrollLines());
- QApplication::setWheelScrollLines(num);
- bool b = config->readBoolEntry("EffectAnimateMenu", false);
- QApplication::setEffectEnabled( Qt::UI_AnimateMenu, b);
- b = config->readBoolEntry("EffectFadeMenu", false);
- QApplication::setEffectEnabled( Qt::UI_FadeMenu, b);
- b = config->readBoolEntry("EffectAnimateCombo", false);
- QApplication::setEffectEnabled( Qt::UI_AnimateCombo, b);
- b = config->readBoolEntry("EffectAnimateTooltip", false);
- QApplication::setEffectEnabled( Qt::UI_AnimateTooltip, b);
- b = config->readBoolEntry("EffectFadeTooltip", false);
+ bool b = config->readBoolEntry("EffectFadeTooltip", false);
QApplication::setEffectEnabled( Qt::UI_FadeTooltip, b);
if(config->readBoolEntry("EffectNoTooltip", false))
QToolTip::setGloballyEnabled(false);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic