Added window border styling options.

Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
pull/7/head
Mavridis Philippe 4 years ago
parent 4a328e3a10
commit ac7c1af9b4
No known key found for this signature in database
GPG Key ID: F8D2D7E2F989A494

@ -29,6 +29,7 @@
#include <tqgrid.h> #include <tqgrid.h>
#include <tqvgroupbox.h> #include <tqvgroupbox.h>
#include <tqradiobutton.h> #include <tqradiobutton.h>
#include <tqcombobox.h>
#include <kiconloader.h> #include <kiconloader.h>
#include <kcolorbutton.h> #include <kcolorbutton.h>
@ -205,6 +206,39 @@ KomposePreferences::KomposePreferences()
page2Layout->addWidget(windowTitleGroupBox); 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 ); TQGroupBox *iconGroupBox = new TQGroupBox( 3, Vertical, i18n("Task Icons"), page2 );
@ -322,6 +356,13 @@ void KomposePreferences::fillPages()
showWindowTitleShadow->setEnabled( KomposeSettings::instance()->getShowWindowTitles() ); showWindowTitleShadow->setEnabled( KomposeSettings::instance()->getShowWindowTitles() );
windowTitleFontShadowColor->setEnabled( KomposeSettings::instance()->getShowWindowTitles() || KomposeSettings::instance()->getShowWindowTitleShadow() ); 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()); desktopTitleFont = new TQFont(KomposeSettings::instance()->getDesktopTitleFont());
desktopTitleFontColor->setColor( KomposeSettings::instance()->getDesktopTitleFontColor() ); desktopTitleFontColor->setColor( KomposeSettings::instance()->getDesktopTitleFontColor() );
desktopTitleFontHighlightColor->setColor( KomposeSettings::instance()->getDesktopTitleFontHighlightColor() ); desktopTitleFontHighlightColor->setColor( KomposeSettings::instance()->getDesktopTitleFontHighlightColor() );
@ -377,6 +418,13 @@ void KomposePreferences::slotApply()
KomposeSettings::instance()->setWindowTitleFontShadowColor( windowTitleFontShadowColor->color() ); KomposeSettings::instance()->setWindowTitleFontShadowColor( windowTitleFontShadowColor->color() );
KomposeSettings::instance()->setShowWindowTitleShadow( showWindowTitleShadow->isChecked() ); 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()->setDesktopTitleFont( *desktopTitleFont );
KomposeSettings::instance()->setDesktopTitleFontColor( desktopTitleFontColor->color() ); KomposeSettings::instance()->setDesktopTitleFontColor( desktopTitleFontColor->color() );
KomposeSettings::instance()->setDesktopTitleFontHighlightColor( desktopTitleFontHighlightColor->color() ); KomposeSettings::instance()->setDesktopTitleFontHighlightColor( desktopTitleFontHighlightColor->color() );

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

@ -110,6 +110,13 @@ void KomposeSettings::readConfig()
showWindowTitleShadow = kapp->config()->readBoolEntry("showWindowTitleShadow", true ); showWindowTitleShadow = kapp->config()->readBoolEntry("showWindowTitleShadow", true );
windowTitleFontShadowColor = kapp->config()->readColorEntry("windowTitleFontShadowColor", new TQColor(TQt::lightGray) ); 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 ) ); desktopTitleFont = kapp->config()->readFontEntry("desktopTitleFont", new TQFont( "arial", 10 ) );
desktopTitleFontColor = kapp->config()->readColorEntry("desktopTitleFontColor", new TQColor(TQt::gray) ); desktopTitleFontColor = kapp->config()->readColorEntry("desktopTitleFontColor", new TQColor(TQt::gray) );
desktopTitleFontHighlightColor = kapp->config()->readColorEntry("desktopTitleFontHighlightColor", new TQColor(TQt::black) ); desktopTitleFontHighlightColor = kapp->config()->readColorEntry("desktopTitleFontHighlightColor", new TQColor(TQt::black) );
@ -167,6 +174,13 @@ void KomposeSettings::writeConfig()
kapp->config()->writeEntry("showWindowTitleShadow", showWindowTitleShadow); kapp->config()->writeEntry("showWindowTitleShadow", showWindowTitleShadow);
kapp->config()->writeEntry("windowTitleFontShadowColor", windowTitleFontShadowColor); 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("desktopTitleFont", desktopTitleFont);
kapp->config()->writeEntry("desktopTitleFontColor", desktopTitleFontColor); kapp->config()->writeEntry("desktopTitleFontColor", desktopTitleFontColor);
kapp->config()->writeEntry("desktopTitleFontHighlightColor", desktopTitleFontHighlightColor); kapp->config()->writeEntry("desktopTitleFontHighlightColor", desktopTitleFontHighlightColor);

@ -76,6 +76,19 @@ public:
const TQColor& getWindowTitleFontShadowColor() const { return windowTitleFontShadowColor; } const TQColor& getWindowTitleFontShadowColor() const { return windowTitleFontShadowColor; }
void setWindowTitleFontShadowColor( TQColor c ) { windowTitleFontShadowColor = c; } 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; } const TQFontMetrics* getWindowTitleFontMetrics() { return windowTitleFontMetrics; }
int getWindowTitleFontAscent() { return windowTitleFontAscent; } int getWindowTitleFontAscent() { return windowTitleFontAscent; }
int getWindowTitleFontHeight() { return windowTitleFontHeight; } int getWindowTitleFontHeight() { return windowTitleFontHeight; }
@ -152,6 +165,13 @@ private:
bool showWindowTitleShadow; bool showWindowTitleShadow;
TQColor windowTitleFontShadowColor; TQColor windowTitleFontShadowColor;
TQColor windowBorderActiveColor;
TQColor windowBorderInactiveColor;
int windowBorderActiveWidth;
int windowBorderInactiveWidth;
int windowBorderActiveStyle;
int windowBorderInactiveStyle;
TQFont desktopTitleFont; TQFont desktopTitleFont;
TQColor desktopTitleFontColor; TQColor desktopTitleFontColor;
TQColor desktopTitleFontHighlightColor; TQColor desktopTitleFontHighlightColor;

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

Loading…
Cancel
Save