Browse Source

Added window border styling options.

Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
pull/7/head
Mavridis Philippe 1 year ago
parent
commit
ac7c1af9b4
No known key found for this signature in database
GPG Key ID: F8D2D7E2F989A494
  1. 48
      src/komposepreferences.cpp
  2. 12
      src/komposepreferences.h
  3. 14
      src/komposesettings.cpp
  4. 20
      src/komposesettings.h
  5. 21
      src/komposetaskwidget.cpp

48
src/komposepreferences.cpp

@ -29,6 +29,7 @@
#include <tqgrid.h>
#include <tqvgroupbox.h>
#include <tqradiobutton.h>
#include <tqcombobox.h>
#include <kiconloader.h>
#include <kcolorbutton.h>
@ -205,6 +206,39 @@ KomposePreferences::KomposePreferences()
page2Layout->addWidget(windowTitleGroupBox);
// see komposetaskwidget.cpp:207
TQGroupBox *windowBorderGroupBox = new TQGroupBox( 2, Vertical, i18n("Window Border"), page2 );
TQGrid *gridWindowBorderOpts = new TQGrid(2, windowBorderGroupBox);
windowBorderActiveColorLabel = new TQLabel(i18n("Active border color:"), gridWindowBorderOpts);
windowBorderActiveColor = new KColorButton(TQt::black, gridWindowBorderOpts);
windowBorderActiveStyleLabel = new TQLabel(i18n("Active border style:"), gridWindowBorderOpts);
TQHBox *hBoxWindowBorderActiveStyle = new TQHBox(gridWindowBorderOpts);
windowBorderActiveWidth = new TQSpinBox(1, 255, 1, hBoxWindowBorderActiveStyle);
windowBorderActiveWidth->setSuffix("px");
windowBorderActiveStyle = new TQComboBox(false, hBoxWindowBorderActiveStyle);
windowBorderActiveStyle->insertItem(i18n("None"));
windowBorderActiveStyle->insertItem(i18n("Solid"));
windowBorderActiveStyle->insertItem(i18n("Dashed"));
windowBorderActiveStyle->insertItem(i18n("Dotted"));
windowBorderActiveStyle->insertItem(i18n("Dash-Dot"));
windowBorderActiveStyle->insertItem(i18n("Dash-Dot-Dot"));
windowBorderInactiveColorLabel = new TQLabel(i18n("Inctive border color:"), gridWindowBorderOpts);
windowBorderInactiveColor = new KColorButton(TQt::gray, gridWindowBorderOpts);
windowBorderInactiveStyleLabel = new TQLabel(i18n("Inactive border style:"), gridWindowBorderOpts);
TQHBox *hBoxWindowBorderInactiveStyle = new TQHBox(gridWindowBorderOpts);
windowBorderInactiveWidth = new TQSpinBox(1, 255, 1, hBoxWindowBorderInactiveStyle);
windowBorderInactiveWidth->setSuffix("px");
windowBorderInactiveStyle = new TQComboBox(false, hBoxWindowBorderInactiveStyle);
windowBorderInactiveStyle->insertItem(i18n("None"));
windowBorderInactiveStyle->insertItem(i18n("Solid"));
windowBorderInactiveStyle->insertItem(i18n("Dashed"));
windowBorderInactiveStyle->insertItem(i18n("Dotted"));
windowBorderInactiveStyle->insertItem(i18n("Dash-Dot"));
windowBorderInactiveStyle->insertItem(i18n("Dash-Dot-Dot"));
page2Layout->addWidget(windowBorderGroupBox);
TQGroupBox *iconGroupBox = new TQGroupBox( 3, Vertical, i18n("Task Icons"), page2 );
@ -322,6 +356,13 @@ void KomposePreferences::fillPages()
showWindowTitleShadow->setEnabled( KomposeSettings::instance()->getShowWindowTitles() );
windowTitleFontShadowColor->setEnabled( KomposeSettings::instance()->getShowWindowTitles() || KomposeSettings::instance()->getShowWindowTitleShadow() );
windowBorderActiveColor->setColor( KomposeSettings::instance()->getWindowBorderActiveColor() );
windowBorderInactiveColor->setColor( KomposeSettings::instance()->getWindowBorderInactiveColor() );
windowBorderActiveWidth->setValue( KomposeSettings::instance()->getWindowBorderActiveWidth() );
windowBorderInactiveWidth->setValue( KomposeSettings::instance()->getWindowBorderInactiveWidth() );
windowBorderActiveStyle->setCurrentItem( KomposeSettings::instance()->getWindowBorderActiveStyle() );
windowBorderInactiveStyle->setCurrentItem( KomposeSettings::instance()->getWindowBorderInactiveStyle() );
desktopTitleFont = new TQFont(KomposeSettings::instance()->getDesktopTitleFont());
desktopTitleFontColor->setColor( KomposeSettings::instance()->getDesktopTitleFontColor() );
desktopTitleFontHighlightColor->setColor( KomposeSettings::instance()->getDesktopTitleFontHighlightColor() );
@ -377,6 +418,13 @@ void KomposePreferences::slotApply()
KomposeSettings::instance()->setWindowTitleFontShadowColor( windowTitleFontShadowColor->color() );
KomposeSettings::instance()->setShowWindowTitleShadow( showWindowTitleShadow->isChecked() );
KomposeSettings::instance()->setWindowBorderActiveColor( windowBorderActiveColor->color() );
KomposeSettings::instance()->setWindowBorderInactiveColor( windowBorderInactiveColor->color() );
KomposeSettings::instance()->setWindowBorderActiveWidth( windowBorderActiveWidth->value() );
KomposeSettings::instance()->setWindowBorderInactiveWidth( windowBorderInactiveWidth->value() );
KomposeSettings::instance()->setWindowBorderActiveStyle( windowBorderActiveStyle->currentItem() );
KomposeSettings::instance()->setWindowBorderInactiveStyle( windowBorderInactiveStyle->currentItem() );
KomposeSettings::instance()->setDesktopTitleFont( *desktopTitleFont );
KomposeSettings::instance()->setDesktopTitleFontColor( desktopTitleFontColor->color() );
KomposeSettings::instance()->setDesktopTitleFontHighlightColor( desktopTitleFontHighlightColor->color() );

12
src/komposepreferences.h

@ -25,6 +25,7 @@ class TQSlider;
class TQPushButton;
class TQFont;
class TQRadioButton;
class TQComboBox;
/**
@author Hans Oischinger
@ -78,6 +79,17 @@ private:
TQPushButton *windowTitleFontBtn;
TQFont *windowTitleFont;
TQLabel *windowBorderActiveColorLabel;
TQLabel *windowBorderInactiveColorLabel;
TQLabel *windowBorderActiveStyleLabel;
TQLabel *windowBorderInactiveStyleLabel;
KColorButton *windowBorderActiveColor;
KColorButton *windowBorderInactiveColor;
TQComboBox *windowBorderActiveStyle;
TQComboBox *windowBorderInactiveStyle;
TQSpinBox *windowBorderActiveWidth;
TQSpinBox *windowBorderInactiveWidth;
KColorButton *windowTitleFontColor;
TQCheckBox *showWindowTitleShadow;
KColorButton *windowTitleFontShadowColor;

14
src/komposesettings.cpp

@ -110,6 +110,13 @@ void KomposeSettings::readConfig()
showWindowTitleShadow = kapp->config()->readBoolEntry("showWindowTitleShadow", true );
windowTitleFontShadowColor = kapp->config()->readColorEntry("windowTitleFontShadowColor", new TQColor(TQt::lightGray) );
windowBorderActiveColor = kapp->config()->readColorEntry("windowBorderActiveColor", new TQColor(TQt::gray) );
windowBorderInactiveColor = kapp->config()->readColorEntry("windowBorderInactiveColor", new TQColor(TQt::black) );
windowBorderActiveWidth = kapp->config()->readNumEntry("windowBorderActiveWidth", 2 );
windowBorderInactiveWidth = kapp->config()->readNumEntry("windowBorderInactiveWidth", 1 );
windowBorderActiveStyle = kapp->config()->readNumEntry("windowBorderActiveStyle", 3 ); // dotted
windowBorderInactiveStyle = kapp->config()->readNumEntry("windowBorderInactiveStyle", 1 ); // solid
desktopTitleFont = kapp->config()->readFontEntry("desktopTitleFont", new TQFont( "arial", 10 ) );
desktopTitleFontColor = kapp->config()->readColorEntry("desktopTitleFontColor", new TQColor(TQt::gray) );
desktopTitleFontHighlightColor = kapp->config()->readColorEntry("desktopTitleFontHighlightColor", new TQColor(TQt::black) );
@ -167,6 +174,13 @@ void KomposeSettings::writeConfig()
kapp->config()->writeEntry("showWindowTitleShadow", showWindowTitleShadow);
kapp->config()->writeEntry("windowTitleFontShadowColor", windowTitleFontShadowColor);
kapp->config()->writeEntry("windowBorderActiveColor", windowBorderActiveColor);
kapp->config()->writeEntry("windowBorderInactiveColor", windowBorderInactiveColor );
kapp->config()->writeEntry("windowBorderActiveWidth", windowBorderActiveWidth );
kapp->config()->writeEntry("windowBorderInactiveWidth", windowBorderInactiveWidth );
kapp->config()->writeEntry("windowBorderActiveStyle", windowBorderActiveStyle );
kapp->config()->writeEntry("windowBorderInactiveStyle", windowBorderInactiveStyle );
kapp->config()->writeEntry("desktopTitleFont", desktopTitleFont);
kapp->config()->writeEntry("desktopTitleFontColor", desktopTitleFontColor);
kapp->config()->writeEntry("desktopTitleFontHighlightColor", desktopTitleFontHighlightColor);

20
src/komposesettings.h

@ -76,6 +76,19 @@ public:
const TQColor& getWindowTitleFontShadowColor() const { return windowTitleFontShadowColor; }
void setWindowTitleFontShadowColor( TQColor c ) { windowTitleFontShadowColor = c; }
const TQColor& getWindowBorderActiveColor() const { return windowBorderActiveColor; }
void setWindowBorderActiveColor( TQColor c ) { windowBorderActiveColor = c; }
const TQColor& getWindowBorderInactiveColor() const { return windowBorderInactiveColor; }
void setWindowBorderInactiveColor( TQColor c ) { windowBorderInactiveColor = c; }
int getWindowBorderActiveWidth() const { return windowBorderActiveWidth; }
void setWindowBorderActiveWidth( int i ) { windowBorderActiveWidth = i; }
int getWindowBorderInactiveWidth() const { return windowBorderInactiveWidth; }
void setWindowBorderInactiveWidth( int i ) { windowBorderInactiveWidth = i; }
int getWindowBorderActiveStyle() const { return windowBorderActiveStyle; }
void setWindowBorderActiveStyle( int i ) { windowBorderActiveStyle = i; }
int getWindowBorderInactiveStyle() const { return windowBorderInactiveStyle; }
void setWindowBorderInactiveStyle( int i ) { windowBorderInactiveStyle = i; }
const TQFontMetrics* getWindowTitleFontMetrics() { return windowTitleFontMetrics; }
int getWindowTitleFontAscent() { return windowTitleFontAscent; }
int getWindowTitleFontHeight() { return windowTitleFontHeight; }
@ -152,6 +165,13 @@ private:
bool showWindowTitleShadow;
TQColor windowTitleFontShadowColor;
TQColor windowBorderActiveColor;
TQColor windowBorderInactiveColor;
int windowBorderActiveWidth;
int windowBorderInactiveWidth;
int windowBorderActiveStyle;
int windowBorderInactiveStyle;
TQFont desktopTitleFont;
TQColor desktopTitleFontColor;
TQColor desktopTitleFontHighlightColor;

21
src/komposetaskwidget.cpp

@ -205,19 +205,26 @@ void KomposeTaskWidget::drawWidget()
}
// Border
if (!highlight)
TQColor borderColor;
int borderWidth, borderStyle;
if (highlight)
{
TQPen pen( gray, 1, TQt::SolidLine );
p.setPen( pen );
p.drawRect(rect());
borderColor = KomposeSettings::instance()->getWindowBorderActiveColor();
borderWidth = KomposeSettings::instance()->getWindowBorderActiveWidth();
borderStyle = KomposeSettings::instance()->getWindowBorderActiveStyle();
}
else
{
TQPen pen( black, 2, TQt::DotLine );
p.setPen( pen );
p.drawRect( TQRect( 1, 1, rect().width()-1, rect().height()-1 ) );
borderColor = KomposeSettings::instance()->getWindowBorderInactiveColor();
borderWidth = KomposeSettings::instance()->getWindowBorderInactiveWidth();
borderStyle = KomposeSettings::instance()->getWindowBorderInactiveStyle();
}
TQPen pen(borderColor, borderWidth, static_cast<TQt::PenStyle>(borderStyle));
p.setPen(pen);
p.drawRect(rect());
p.end();
}

Loading…
Cancel
Save