diff options
author | Mavridis Philippe <[email protected]> | 2021-04-08 14:13:16 +0300 |
---|---|---|
committer | Mavridis Philippe <[email protected]> | 2021-04-09 11:41:33 +0300 |
commit | ac7c1af9b4425f5c51eafd449ec253189113a57e (patch) | |
tree | 6d4a203be5b19b1273ad24f608a5f30af86985a0 | |
parent | 4a328e3a100247ae074959e9c27af05098fec620 (diff) | |
download | kompose-ac7c1af9b4425f5c51eafd449ec253189113a57e.tar.gz kompose-ac7c1af9b4425f5c51eafd449ec253189113a57e.zip |
Added window border styling options.
Signed-off-by: Mavridis Philippe <[email protected]>
-rw-r--r-- | src/komposepreferences.cpp | 48 | ||||
-rw-r--r-- | src/komposepreferences.h | 12 | ||||
-rw-r--r-- | src/komposesettings.cpp | 14 | ||||
-rw-r--r-- | src/komposesettings.h | 20 | ||||
-rw-r--r-- | src/komposetaskwidget.cpp | 21 |
5 files changed, 108 insertions, 7 deletions
diff --git a/src/komposepreferences.cpp b/src/komposepreferences.cpp index 19bd5b8..fa53a2a 100644 --- a/src/komposepreferences.cpp +++ b/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() ); diff --git a/src/komposepreferences.h b/src/komposepreferences.h index 9c72d80..352272d 100644 --- a/src/komposepreferences.h +++ b/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; diff --git a/src/komposesettings.cpp b/src/komposesettings.cpp index 3149523..202c8f2 100644 --- a/src/komposesettings.cpp +++ b/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); diff --git a/src/komposesettings.h b/src/komposesettings.h index a53f5a0..3169b71 100644 --- a/src/komposesettings.h +++ b/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; diff --git a/src/komposetaskwidget.cpp b/src/komposetaskwidget.cpp index 2d94343..d8f92f4 100644 --- a/src/komposetaskwidget.cpp +++ b/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(); } |