TDE core libraries
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

plastitdeconf.cpp 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. /*
  2. Copyright (C) 2003 Sandro Giessl <ceebx@users.sourceforge.net>
  3. based on the Keramik configuration dialog:
  4. Copyright (c) 2003 Maksim Orlovich <maksim.orlovich@kdemail.net>
  5. Permission is hereby granted, free of charge, to any person obtaining a
  6. copy of this software and associated documentation files (the "Software"),
  7. to deal in the Software without restriction, including without limitation
  8. the rights to use, copy, modify, merge, publish, distribute, sublicense,
  9. and/or sell copies of the Software, and to permit persons to whom the
  10. Software is furnished to do so, subject to the following conditions:
  11. The above copyright notice and this permission notice shall be included in
  12. all copies or substantial portions of the Software.
  13. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  16. THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  18. FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  19. DEALINGS IN THE SOFTWARE.
  20. */
  21. #include <tqcheckbox.h>
  22. #include <tqlayout.h>
  23. #include <tqhbox.h>
  24. #include <tqsettings.h>
  25. #include <tqcolor.h>
  26. #include <tqgroupbox.h>
  27. #include <tdeglobal.h>
  28. #include <tdelocale.h>
  29. #include <kcolorbutton.h>
  30. #include <kdemacros.h>
  31. #include "plastitdeconf.h"
  32. extern "C"
  33. {
  34. KDE_EXPORT TQWidget* allocate_kstyle_config(TQWidget* parent)
  35. {
  36. TDEGlobal::locale()->insertCatalogue("kstyle_plastik_config");
  37. return new PlastikStyleConfig(parent);
  38. }
  39. }
  40. PlastikStyleConfig::PlastikStyleConfig(TQWidget* parent): TQWidget(parent)
  41. {
  42. //Should have no margins here, the dialog provides them
  43. TQVBoxLayout* layout = new TQVBoxLayout(this, 0, 0);
  44. TDEGlobal::locale()->insertCatalogue("kstyle_plastik_config");
  45. // scrollBarLines = new TQCheckBox(i18n("Scrollbar handle lines"), this);
  46. animateProgressBar = new TQCheckBox(i18n("Animate progress bars"), this);
  47. drawToolBarSeparator = new TQCheckBox(i18n("Draw toolbar separator"), this);
  48. drawToolBarItemSeparator = new TQCheckBox(i18n("Draw toolbar item separators"), this);
  49. // drawFocusRect = new TQCheckBox(i18n("Draw focus rectangles"), this);
  50. drawTriangularExpander = new TQCheckBox(i18n("Triangular tree expander"), this);
  51. inputFocusHighlight = new TQCheckBox(i18n("Highlight focused text input fields"), this);
  52. customFocusHighlightColor = new TQCheckBox(i18n("Custom text input highlight color:"), this);
  53. TQHBox *hbox1 = new TQHBox(this);
  54. hbox1->layout()->addItem(new TQSpacerItem(20, 0, TQSizePolicy::Fixed, TQSizePolicy::Minimum) );
  55. focusHighlightColor = new KColorButton(hbox1);
  56. customOverHighlightColor = new TQCheckBox(i18n("Custom mouseover highlight color:"), this);
  57. TQHBox *hbox2 = new TQHBox(this);
  58. hbox2->layout()->addItem(new TQSpacerItem(20, 0, TQSizePolicy::Fixed, TQSizePolicy::Minimum) );
  59. overHighlightColor = new KColorButton(hbox2);
  60. customCheckMarkColor = new TQCheckBox(i18n("Custom checkmark color:"), this);
  61. TQHBox *hbox3 = new TQHBox(this);
  62. hbox3->layout()->addItem(new TQSpacerItem(20, 0, TQSizePolicy::Fixed, TQSizePolicy::Minimum) );
  63. checkMarkColor = new KColorButton(hbox3);
  64. // layout->add(scrollBarLines);
  65. layout->add(animateProgressBar);
  66. layout->add(drawToolBarSeparator);
  67. layout->add(drawToolBarItemSeparator);
  68. // layout->add(drawFocusRect);
  69. layout->add(drawTriangularExpander);
  70. layout->add(inputFocusHighlight);
  71. layout->add(customFocusHighlightColor);
  72. layout->add(hbox1);
  73. layout->add(customOverHighlightColor);
  74. layout->add(hbox2);
  75. layout->add(customCheckMarkColor);
  76. layout->add(hbox3);
  77. layout->addStretch(1);
  78. TQSettings s;
  79. // origScrollBarLines = s.readBoolEntry("/plastikstyle/Settings/scrollBarLines", false);
  80. // scrollBarLines->setChecked(origScrollBarLines);
  81. origAnimProgressBar = s.readBoolEntry("/plastikstyle/Settings/animateProgressBar", false);
  82. animateProgressBar->setChecked(origAnimProgressBar);
  83. origDrawToolBarSeparator = s.readBoolEntry("/plastikstyle/Settings/drawToolBarSeparator", false);
  84. drawToolBarSeparator->setChecked(origDrawToolBarSeparator);
  85. origDrawToolBarItemSeparator = s.readBoolEntry("/plastikstyle/Settings/drawToolBarItemSeparator", true);
  86. drawToolBarItemSeparator->setChecked(origDrawToolBarItemSeparator);
  87. // origDrawFocusRect = s.readBoolEntry("/plastikstyle/Settings/drawFocusRect", true);
  88. // drawFocusRect->setChecked(origDrawFocusRect);
  89. origDrawTriangularExpander = s.readBoolEntry("/plastikstyle/Settings/drawTriangularExpander", false);
  90. drawTriangularExpander->setChecked(origDrawTriangularExpander);
  91. origInputFocusHighlight = s.readBoolEntry("/plastikstyle/Settings/inputFocusHighlight", true);
  92. inputFocusHighlight->setChecked(origInputFocusHighlight);
  93. origCustomOverHighlightColor = s.readBoolEntry("/plastikstyle/Settings/customOverHighlightColor", false);
  94. customOverHighlightColor->setChecked(origCustomOverHighlightColor);
  95. origOverHighlightColor = s.readEntry("/plastikstyle/Settings/overHighlightColor", "black");
  96. overHighlightColor->setColor(origOverHighlightColor);
  97. origCustomFocusHighlightColor = s.readBoolEntry("/plastikstyle/Settings/customFocusHighlightColor", false);
  98. customFocusHighlightColor->setChecked(origCustomFocusHighlightColor);
  99. origFocusHighlightColor = s.readEntry("/plastikstyle/Settings/focusHighlightColor", "black");
  100. focusHighlightColor->setColor(origFocusHighlightColor);
  101. origCustomCheckMarkColor = s.readBoolEntry("/plastikstyle/Settings/customCheckMarkColor", false);
  102. customCheckMarkColor->setChecked(origCustomCheckMarkColor);
  103. origCheckMarkColor = s.readEntry("/plastikstyle/Settings/checkMarkColor", "black");
  104. checkMarkColor->setColor(origCheckMarkColor);
  105. // connect(scrollBarLines, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
  106. connect(animateProgressBar, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
  107. connect(drawToolBarSeparator, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
  108. connect(drawToolBarItemSeparator, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
  109. // connect(drawFocusRect, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
  110. connect(drawTriangularExpander, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
  111. connect(inputFocusHighlight, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
  112. connect(customOverHighlightColor, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
  113. connect(overHighlightColor, TQT_SIGNAL( changed(const TQColor&) ), TQT_SLOT( updateChanged() ) );
  114. connect(customFocusHighlightColor, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
  115. connect(focusHighlightColor, TQT_SIGNAL( changed(const TQColor&) ), TQT_SLOT( updateChanged() ) );
  116. connect(customCheckMarkColor, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
  117. connect(checkMarkColor, TQT_SIGNAL( changed(const TQColor&) ), TQT_SLOT( updateChanged() ) );
  118. if ( customOverHighlightColor->isChecked() )
  119. overHighlightColor->setEnabled(true);
  120. else
  121. overHighlightColor->setEnabled(false);
  122. if ( customFocusHighlightColor->isChecked() )
  123. focusHighlightColor->setEnabled(true);
  124. else
  125. focusHighlightColor->setEnabled(false);
  126. if ( customCheckMarkColor->isChecked() )
  127. checkMarkColor->setEnabled(true);
  128. else
  129. checkMarkColor->setEnabled(false);
  130. }
  131. PlastikStyleConfig::~PlastikStyleConfig()
  132. {
  133. }
  134. void PlastikStyleConfig::save()
  135. {
  136. TQSettings s;
  137. // s.writeEntry("/plastikstyle/Settings/scrollBarLines", scrollBarLines->isChecked());
  138. s.writeEntry("/plastikstyle/Settings/animateProgressBar", animateProgressBar->isChecked());
  139. s.writeEntry("/plastikstyle/Settings/drawToolBarSeparator", drawToolBarSeparator->isChecked());
  140. s.writeEntry("/plastikstyle/Settings/drawToolBarItemSeparator", drawToolBarItemSeparator->isChecked());
  141. // s.writeEntry("/plastikstyle/Settings/drawFocusRect", drawFocusRect->isChecked());
  142. s.writeEntry("/plastikstyle/Settings/drawTriangularExpander", drawTriangularExpander->isChecked());
  143. s.writeEntry("/plastikstyle/Settings/inputFocusHighlight", inputFocusHighlight->isChecked());
  144. s.writeEntry("/plastikstyle/Settings/customOverHighlightColor", customOverHighlightColor->isChecked());
  145. s.writeEntry("/plastikstyle/Settings/overHighlightColor", TQColor(overHighlightColor->color()).name());
  146. s.writeEntry("/plastikstyle/Settings/customFocusHighlightColor", customFocusHighlightColor->isChecked());
  147. s.writeEntry("/plastikstyle/Settings/focusHighlightColor", TQColor(focusHighlightColor->color()).name());
  148. s.writeEntry("/plastikstyle/Settings/customCheckMarkColor", customCheckMarkColor->isChecked());
  149. s.writeEntry("/plastikstyle/Settings/checkMarkColor", TQColor(checkMarkColor->color()).name());
  150. }
  151. void PlastikStyleConfig::defaults()
  152. {
  153. // scrollBarLines->setChecked(false);
  154. animateProgressBar->setChecked(false);
  155. drawToolBarSeparator->setChecked(false);
  156. drawToolBarItemSeparator->setChecked(true);
  157. // drawFocusRect->setChecked(true);
  158. drawTriangularExpander->setChecked(false);
  159. inputFocusHighlight->setChecked(true);
  160. customOverHighlightColor->setChecked(false);
  161. overHighlightColor->setColor("black");
  162. customFocusHighlightColor->setChecked(false);
  163. focusHighlightColor->setColor("black");
  164. customCheckMarkColor->setChecked(false);
  165. checkMarkColor->setColor("black");
  166. //updateChanged would be done by setChecked already
  167. }
  168. void PlastikStyleConfig::updateChanged()
  169. {
  170. if ( customOverHighlightColor->isChecked() )
  171. overHighlightColor->setEnabled(true);
  172. else
  173. overHighlightColor->setEnabled(false);
  174. if ( customFocusHighlightColor->isChecked() )
  175. focusHighlightColor->setEnabled(true);
  176. else
  177. focusHighlightColor->setEnabled(false);
  178. if ( customCheckMarkColor->isChecked() )
  179. checkMarkColor->setEnabled(true);
  180. else
  181. checkMarkColor->setEnabled(false);
  182. if (/*(scrollBarLines->isChecked() == origScrollBarLines) &&*/
  183. (animateProgressBar->isChecked() == origAnimProgressBar) &&
  184. (drawToolBarSeparator->isChecked() == origDrawToolBarSeparator) &&
  185. (drawToolBarItemSeparator->isChecked() == origDrawToolBarItemSeparator) &&
  186. // (drawFocusRect->isChecked() == origDrawFocusRect) &&
  187. (drawTriangularExpander->isChecked() == origDrawTriangularExpander) &&
  188. (inputFocusHighlight->isChecked() == origInputFocusHighlight) &&
  189. (customOverHighlightColor->isChecked() == origCustomOverHighlightColor) &&
  190. (overHighlightColor->color() == origOverHighlightColor) &&
  191. (customFocusHighlightColor->isChecked() == origCustomFocusHighlightColor) &&
  192. (focusHighlightColor->color() == origFocusHighlightColor) &&
  193. (customCheckMarkColor->isChecked() == origCustomCheckMarkColor) &&
  194. (checkMarkColor->color() == origCheckMarkColor)
  195. )
  196. emit changed(false);
  197. else
  198. emit changed(true);
  199. }
  200. #include "plastitdeconf.moc"