diff options
Diffstat (limited to 'kcontrol/fonts/fonts.cpp')
-rw-r--r-- | kcontrol/fonts/fonts.cpp | 84 |
1 files changed, 51 insertions, 33 deletions
diff --git a/kcontrol/fonts/fonts.cpp b/kcontrol/fonts/fonts.cpp index 4d1083365..5913662ce 100644 --- a/kcontrol/fonts/fonts.cpp +++ b/kcontrol/fonts/fonts.cpp @@ -270,13 +270,13 @@ FontAASettings::FontAASettings(TQWidget *parent) enableWidgets(); setMainWidget(mw); - connect(excludeRange, TQT_SIGNAL(toggled(bool)), TQT_SLOT(changed())); - connect(useSubPixel, TQT_SIGNAL(toggled(bool)), TQT_SLOT(changed())); - connect(excludeFrom, TQT_SIGNAL(valueChanged(double)), TQT_SLOT(changed())); - connect(excludeTo, TQT_SIGNAL(valueChanged(double)), TQT_SLOT(changed())); - connect(subPixelType, TQT_SIGNAL(activated(const TQString &)), TQT_SLOT(changed())); + connect(excludeRange, TQ_SIGNAL(toggled(bool)), TQ_SLOT(changed())); + connect(useSubPixel, TQ_SIGNAL(toggled(bool)), TQ_SLOT(changed())); + connect(excludeFrom, TQ_SIGNAL(valueChanged(double)), TQ_SLOT(changed())); + connect(excludeTo, TQ_SIGNAL(valueChanged(double)), TQ_SLOT(changed())); + connect(subPixelType, TQ_SIGNAL(activated(const TQString &)), TQ_SLOT(changed())); #ifdef HAVE_FONTCONFIG - connect(hintingStyle, TQT_SIGNAL(activated(const TQString &)), TQT_SLOT(changed())); + connect(hintingStyle, TQ_SIGNAL(activated(const TQString &)), TQ_SLOT(changed())); #endif } @@ -596,7 +596,7 @@ TDEFonts::TDEFonts(TQWidget *parent, const char *name, const TQStringList &) ); fontUseList.append(i); - connect(i, TQT_SIGNAL(fontSelected(const TQFont &)), TQT_SLOT(fontSelected())); + connect(i, TQ_SIGNAL(fontSelected(const TQFont &)), TQ_SLOT(fontSelected())); TQLabel * fontUse = new TQLabel(name+":", this); TQWhatsThis::add(fontUse, *quickHelpIt++); @@ -612,7 +612,7 @@ TDEFonts::TDEFonts(TQWidget *parent, const char *name, const TQStringList &) TQPushButton * fontAdjustButton = new TQPushButton(i18n("Ad&just All Fonts..."), this); TQWhatsThis::add(fontAdjustButton, i18n("Click to change all fonts")); hblay->addWidget( fontAdjustButton ); - connect(fontAdjustButton, TQT_SIGNAL(clicked()), TQT_SLOT(slotApplyFontDiff())); + connect(fontAdjustButton, TQ_SIGNAL(clicked()), TQ_SLOT(slotApplyFontDiff())); layout->addSpacing(KDialog::spacingHint()); @@ -627,33 +627,30 @@ TDEFonts::TDEFonts(TQWidget *parent, const char *name, const TQStringList &) TQWhatsThis::add(cbAA, i18n("If this option is selected, TDE will smooth the edges of curves in " "fonts.")); aaSettingsButton = new TQPushButton( i18n( "Configure..." ), this); - connect(aaSettingsButton, TQT_SIGNAL(clicked()), TQT_SLOT(slotCfgAa())); + connect(aaSettingsButton, TQ_SIGNAL(clicked()), TQ_SLOT(slotCfgAa())); label->setBuddy( cbAA ); lay->addWidget( cbAA, 0, 1 ); lay->addWidget( aaSettingsButton, 0, 2 ); - connect(cbAA, TQT_SIGNAL(activated(int)), TQT_SLOT(slotUseAntiAliasing())); + connect(cbAA, TQ_SIGNAL(activated(int)), TQ_SLOT(slotUseAntiAliasing())); label = new TQLabel( i18n( "Force fonts DPI:" ), this ); lay->addWidget( label, 1, 0 ); comboForceDpi = new TQComboBox( this ); label->setBuddy( comboForceDpi ); - comboForceDpi->insertItem( i18n( "Disabled" )); // change DPISetti ng type if order changes - comboForceDpi->insertItem( i18n( "96 DPI" )); - comboForceDpi->insertItem( i18n( "120 DPI" )); + comboForceDpi->insertItem( i18n( "Disabled" )); + comboForceDpi->insertItem( i18n( "Enabled" )); TQString whatsthis = i18n( "<p>This option forces a specific DPI value for fonts. It may be useful" " when the real DPI of the hardware is not detected properly and it" " is also often misused when poor quality fonts are used that do not" - " look well with DPI values other than 96 or 120 DPI.</p>" - "<p>The use of this option is generally discouraged. For selecting proper DPI" - " value a better option is explicitly configuring it for the whole X server if" - " possible (e.g. DisplaySize in xorg.conf or adding <i>-dpi value</i> to" - " ServerLocalArgs= in $TDEDIR/share/config/tdm/tdmrc). When fonts do not render" - " properly with real DPI value better fonts should be used or configuration" - " of font hinting should be checked.</p>" ); + " look well with DPI values other than 96 or 120 DPI.</p>"); TQWhatsThis::add(comboForceDpi, whatsthis); - connect( comboForceDpi, TQT_SIGNAL( activated( int )), TQT_SLOT( changed())); + connect(comboForceDpi, TQ_SIGNAL(activated(int)), TQ_SLOT(slotUseFontDPI())); + sbDpiValue = new KIntSpinBox(64, 512, 1, 96, 10, this); + TQWhatsThis::add(sbDpiValue, whatsthis); + connect(sbDpiValue, TQ_SIGNAL(valueChanged(int)), TQ_SLOT(changed())); lay->addWidget( comboForceDpi, 1, 1 ); + lay->addWidget( sbDpiValue, 1, 2 ); layout->addStretch(1); @@ -695,10 +692,22 @@ void TDEFonts::load( bool useDefaults ) TDEConfig cfgfonts("kcmfonts", true); cfgfonts.setGroup("General"); - int dpicfg = cfgfonts.readNumEntry( "forceFontDPI", 0 ); - DPISetting dpi = dpicfg == 120 ? DPI120 : dpicfg == 96 ? DPI96 : DPINone; - comboForceDpi->setCurrentItem( dpi ); - dpi_original = dpi; + int dpicfg = cfgfonts.readNumEntry("forceFontDPI", 0); + // "forceFontDPIEnable" must be read after "forceFontDPI" to make sure it is + // correctly initialized on the first run when upgrading to the new format, + // without the user even noticying it. The first time "forceFontDPIEnable" + // will not exist and its correct value will be deduced by the existing value + // of "forceFontDPI", which contains the value prior to the update. + bool dpiEnable = cfgfonts.readBoolEntry("forceFontDPIEnable", dpicfg > 0); + dpi_original = dpiEnable ? DPIValue : DPINone; + dpi_value_original = dpicfg; + if (dpi_value_original < 64 || dpi_value_original > 512) + { + dpi_value_original = 96; + } + comboForceDpi->setCurrentItem(dpi_original); + sbDpiValue->setValue(dpi_value_original); + sbDpiValue->setEnabled(dpi_original != DPINone); if( cfgfonts.readBoolEntry( "dontChangeAASettings", true )) { useAA_original = useAA = AASystem; cbAA->setCurrentItem( useAA ); @@ -717,14 +726,16 @@ void TDEFonts::save() TDEConfig cfgfonts("kcmfonts"); cfgfonts.setGroup("General"); - DPISetting dpi = static_cast< DPISetting >( comboForceDpi->currentItem()); - const int dpi2value[] = { 0, 96, 120 }; - cfgfonts.writeEntry( "forceFontDPI", dpi2value[ dpi ] ); + DPISetting dpi = (DPISetting)comboForceDpi->currentItem(); + int dpival = sbDpiValue->value(); + cfgfonts.writeEntry( "forceFontDPIEnable", dpi != DPINone ); + cfgfonts.writeEntry( "forceFontDPI", dpival ); cfgfonts.writeEntry( "dontChangeAASettings", cbAA->currentItem() == AASystem ); cfgfonts.sync(); // if the setting is reset in the module, remove the dpi value, // otherwise don't explicitly remove it and leave any possible system-wide value - if( dpi == DPINone && dpi_original != DPINone ) { + if(dpi == DPINone) + { KProcIO proc; proc << "xrdb" << "-quiet" << "-remove" << "-nocpp"; proc.writeStdin( TQCString( "Xft.dpi" ), true ); @@ -755,11 +766,11 @@ void TDEFonts::save() if( cbAA->currentItem() != AASystem ) aaSave = aaSettings->save( useAA == AAEnabled ); - if( aaSave || (useAA != useAA_original) || dpi != dpi_original) { + if( aaSave || (useAA != useAA_original) || dpival != dpi_value_original || dpi != dpi_original) + { KMessageBox::information(this, - i18n( - "<p>Some changes such as anti-aliasing will only affect newly started applications.</p>" - ), i18n("Font Settings Changed"), "FontSettingsChanged", false); + i18n( "<p>Some changes such as anti-aliasing will only affect newly started applications.</p>"), + i18n("Font Settings Changed"), "FontSettingsChanged", false); useAA_original = useAA; dpi_original = dpi; } @@ -791,6 +802,13 @@ void TDEFonts::slotUseAntiAliasing() emit changed(true); } +void TDEFonts::slotUseFontDPI() +{ + DPISetting dpi = (DPISetting)(comboForceDpi->currentItem()); + sbDpiValue->setEnabled(dpi != DPINone); + emit changed(true); +} + void TDEFonts::slotCfgAa() { if(aaSettings->exec()) |