Lipstik widget style for TDE
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.
 
 
 
 
 
 

765 lines
31 KiB

  1. /*
  2. Copyright (C) 2004-2007 Patrice Tremblay <tremblaypatrice@yahoo.fr>
  3. http://www.poplix.info/lipstik
  4. based on plastik:
  5. Copyright (C) 2003 Sandro Giessl <ceebx@users.sourceforge.net>
  6. based on the Keramik configuration dialog:
  7. Copyright (c) 2003 Maksim Orlovich <maksim.orlovich@kdemail.net>
  8. Permission is hereby granted, free of charge, to any person obtaining a
  9. copy of this software and associated documentation files (the "Software"),
  10. to deal in the Software without restriction, including without limitation
  11. the rights to use, copy, modify, merge, publish, distribute, sublicense,
  12. and/or sell copies of the Software, and to permit persons to whom the
  13. Software is furnished to do so, subject to the following conditions:
  14. The above copyright notice and this permission notice shall be included in
  15. all copies or substantial portions of the Software.
  16. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  19. THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  21. FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  22. DEALINGS IN THE SOFTWARE.
  23. */
  24. #include <tqcheckbox.h>
  25. #include <tqlayout.h>
  26. #include <tqhbox.h>
  27. #include <tqsettings.h>
  28. #include <tqcolor.h>
  29. #include <tqlabel.h>
  30. #include <tqcombobox.h>
  31. #include <tdeglobal.h>
  32. #include <tdelocale.h>
  33. #include <kcolorbutton.h>
  34. #include <tqtabwidget.h>
  35. #include <tqvgroupbox.h>
  36. #include <tqspinbox.h>
  37. #include <tqgrid.h>
  38. #include "lipstikconf.h"
  39. extern "C"
  40. {
  41. TQWidget* allocate_tdestyle_config(TQWidget* parent)
  42. {
  43. TDEGlobal::locale()->insertCatalogue("tdestyle_lipstik_config");
  44. return new LipstikStyleConfig(parent);
  45. }
  46. }
  47. LipstikStyleConfig::LipstikStyleConfig(TQWidget* parent): TQWidget(parent)
  48. {
  49. TQVBoxLayout* layout = new TQVBoxLayout(this, 0, 0);
  50. TQGridLayout* tabLayout = new TQGridLayout(this, 2, 1, 10);
  51. TDEGlobal::locale()->insertCatalogue("tdestyle_lipstik_config");
  52. ///Init tabs
  53. TQTabWidget *tabWidget = new TQTabWidget(this);
  54. layout->addWidget(tabWidget);
  55. ///Init tab1
  56. TQWidget *page1 = new TQWidget(tabWidget);
  57. layout = new TQVBoxLayout(page1);
  58. tabWidget->insertTab(page1, i18n("Configuration"));
  59. layout->addLayout(tabLayout);
  60. ///General group
  61. TQVGroupBox *generalGrp = new TQVGroupBox(i18n("General"), page1);
  62. reverseGradients = new TQCheckBox(i18n("Plastik gradients"), generalGrp );
  63. drawTriangularExpander = new TQCheckBox(i18n("Triangular tree expander"), generalGrp);
  64. drawStatusBarFrame = new TQCheckBox(i18n("Draw status bar frame"), generalGrp);
  65. animateProgressBar = new TQCheckBox(i18n("Animate progress bars"), generalGrp);
  66. flatHeaders = new TQCheckBox(i18n("Flatten column headers"), generalGrp);
  67. tickCheckMark = new TQCheckBox(i18n("Use a tick for checkmarks"), generalGrp);
  68. tabLayout->addWidget(generalGrp,0,0,0);
  69. ///Toolbar group
  70. TQVGroupBox *toolbarGrp = new TQVGroupBox(i18n("Toolbars"), page1);
  71. TQLabel* toolBarSpacingLabel;
  72. drawToolBarSeparator = new TQCheckBox(i18n("Draw separators"), toolbarGrp);
  73. drawToolBarItemSeparator = new TQCheckBox(i18n("Draw item separators"), toolbarGrp);
  74. drawToolBarHandle = new TQCheckBox(i18n("Draw handles"), toolbarGrp);
  75. drawToolBarGradient = new TQCheckBox(i18n("Draw gradients"), toolbarGrp);
  76. invertBarGrad = new TQCheckBox(i18n("Invert gradients"), toolbarGrp);
  77. toolBarSpacingLabel = new TQLabel(toolbarGrp);
  78. toolBarSpacingLabel->setText(i18n("Items spacing :"));
  79. toolBarSpacing = new TQSpinBox ( 0, 6, 1, toolbarGrp );
  80. tabLayout->addWidget(toolbarGrp,0,1,0);
  81. ///Menus group
  82. TQVGroupBox *menusGrp = new TQVGroupBox(i18n("Menus"), page1);
  83. TQLabel* menuSpacingLabel;
  84. alterMenuGradients = new TQCheckBox(i18n("Button-like menu gradients"), menusGrp);
  85. sharperMenuGradient = new TQCheckBox(i18n("Sharper menu gradients"), menusGrp);
  86. menuLeftSideBar = new TQCheckBox(i18n("Menu Stripe"), menusGrp);
  87. flatStripe = new TQCheckBox(i18n("Flatten Stripe"), menusGrp);
  88. customMenuStripeColor = new TQCheckBox(i18n("Custom Stripe color :"), menusGrp);
  89. TQHBox *menuColorBox = new TQHBox(menusGrp);
  90. menuColorBox->layout()->addItem(new TQSpacerItem(20, 0, TQSizePolicy::Fixed, TQSizePolicy::Minimum) );
  91. menuStripeColor = new KColorButton(menuColorBox);
  92. menuSpacingLabel = new TQLabel(menusGrp);
  93. menuSpacingLabel->setText(i18n("Menu spacing :"));
  94. menuSpacing = new TQSpinBox ( 0, 8, 1, menusGrp );
  95. tabLayout->addWidget(menusGrp,1,0,0);
  96. ///Scrollbar group
  97. TQVGroupBox *scrollGrp = new TQVGroupBox(i18n("Scrollbars and Sliders"), page1);
  98. TQLabel* scrollBarStyleLabel;
  99. TQLabel* scrollBarWidthLabel;
  100. TQLabel* sliderStyleLabel;
  101. paintGroove = new TQCheckBox(i18n("Draw Scrollbar grooves"), scrollGrp);
  102. scrollBarStyleLabel = new TQLabel(scrollGrp);
  103. scrollBarStyleLabel->setText(i18n("Scrollbar style : "));
  104. scrollBarStyle = new TQComboBox(i18n("Scrollbar style"), scrollGrp);
  105. scrollBarStyle->setEditable(false);
  106. scrollBarStyle->insertItem("Windows style");
  107. scrollBarStyle->insertItem("Platinum style");
  108. scrollBarStyle->insertItem("KDE style");
  109. scrollBarStyle->insertItem("Next style");
  110. scrollBarWidthLabel = new TQLabel(scrollGrp);
  111. scrollBarWidthLabel->setText(i18n("Scrollbar width : "));
  112. scrollBarWidth = new TQComboBox(i18n("Scrollbar width"), scrollGrp);
  113. scrollBarWidth->setEditable(false);
  114. scrollBarWidth->insertItem("Small");
  115. scrollBarWidth->insertItem("Normal");
  116. scrollBarWidth->insertItem("Large");
  117. sliderStyleLabel = new TQLabel(scrollGrp);
  118. sliderStyleLabel->setText(i18n("Slider handle size : "));
  119. sliderStyle = new TQComboBox(i18n("Slider handle size"), scrollGrp);
  120. sliderStyle->setEditable(false);
  121. sliderStyle->insertItem("Small");
  122. sliderStyle->insertItem("Medium");
  123. sliderStyle->insertItem("Large");
  124. tabLayout->addWidget(scrollGrp,1,1,0);
  125. ///Highlighting group
  126. TQVGroupBox *lightGrp = new TQVGroupBox(i18n("Highlighting"), page1);
  127. drawFocusRect = new TQCheckBox(i18n("Colored focus rectangle"), lightGrp);
  128. comboboxColored = new TQCheckBox(i18n("Colored comboboxes handles"), lightGrp);
  129. coloredMenuBar = new TQCheckBox(i18n("Colored menu bar items"), lightGrp);
  130. drawTabHighlight = new TQCheckBox(i18n("Highlight active tab"), lightGrp);
  131. inputFocusHighlight = new TQCheckBox(i18n("Highlight focused input fields"), lightGrp);
  132. tabLayout->addWidget(lightGrp,0,2,0);
  133. ///Other colors group
  134. TQVGroupBox *otherGrp = new TQVGroupBox(i18n("Custom colors"), page1);
  135. customFocusHighlightColor = new TQCheckBox(i18n("Input fields highlight :"), otherGrp);
  136. TQHBox *hbox1 = new TQHBox(otherGrp);
  137. hbox1->layout()->addItem(new TQSpacerItem(20, 0, TQSizePolicy::Fixed, TQSizePolicy::Minimum) );
  138. focusHighlightColor = new KColorButton(hbox1);
  139. customOverHighlightColor = new TQCheckBox(i18n("Mouse hover highlight :"), otherGrp);
  140. TQHBox *hbox2 = new TQHBox(otherGrp);
  141. hbox2->layout()->addItem(new TQSpacerItem(20, 0, TQSizePolicy::Fixed, TQSizePolicy::Minimum) );
  142. overHighlightColor = new KColorButton(hbox2);
  143. customCheckMarkColor = new TQCheckBox(i18n("Checkmark/Radiobuttons :"), otherGrp);
  144. TQHBox *hbox3 = new TQHBox(otherGrp);
  145. hbox3->layout()->addItem(new TQSpacerItem(20, 0, TQSizePolicy::Fixed, TQSizePolicy::Minimum) );
  146. checkMarkColor = new KColorButton(hbox3);
  147. customTabHighlightColor = new TQCheckBox(i18n("Active tab highlight :"), otherGrp);
  148. TQHBox *hbox4 = new TQHBox(otherGrp);
  149. hbox4->layout()->addItem(new TQSpacerItem(20, 0, TQSizePolicy::Fixed, TQSizePolicy::Minimum) );
  150. tabHighlightColor = new KColorButton(hbox4);
  151. tabLayout->addWidget(otherGrp,1,2,0);
  152. ///Init tab2
  153. TQWidget *page2 = new TQWidget(tabWidget);
  154. TQLabel* lipstikLabel;
  155. TQLabel* authorLabel;
  156. TQLabel* authorAddressLabel;
  157. TQLabel* authorWebLabel;
  158. TQLabel* plastikLabel;
  159. TQLabel* alsoLabel;
  160. TQLabel* cuLabel;
  161. TQLabel* dnLabel;
  162. TQLabel* pqLabel;
  163. TQLabel* cxLabel;
  164. TQLabel* kpLabel;
  165. TQLabel* blLabel;
  166. TQLabel* ksLabel;
  167. TQLabel* peLabel;
  168. TQLabel* bastianLabel;
  169. TQLabel* pcbsdLabel;
  170. TQLabel* othersLabel;
  171. layout = new TQVBoxLayout(page2, 10, -1);
  172. tabWidget->insertTab(page2, i18n("About"));
  173. lipstikLabel = new TQLabel(page2);
  174. lipstikLabel->setText(i18n("Lipstik 2.2.3"));
  175. lipstikLabel->setFrameStyle( TQFrame::StyledPanel | TQFrame::Raised );
  176. authorLabel = new TQLabel(page2);
  177. authorLabel->setText(i18n(" Copyright 2004-2005-2006-2007 (C) Patrice Tremblay (Poplix)"));
  178. authorAddressLabel = new TQLabel(page2);
  179. authorAddressLabel->setText(i18n(" poplixos@gmail.com"));
  180. authorWebLabel = new TQLabel(page2);
  181. authorWebLabel->setText(i18n(" http://poplix.homelinux.com/lipstik"));
  182. plastikLabel = new TQLabel(page2);
  183. plastikLabel->setText(i18n("Based on plastik [thanks to Sandro Giessl]"));
  184. alsoLabel = new TQLabel(page2);
  185. alsoLabel->setText(i18n("Also based on :"));
  186. cuLabel = new TQLabel(page2);
  187. cuLabel->setText(i18n(" TQtCurve [thanks to Craig Drummond],"));
  188. dnLabel = new TQLabel(page2);
  189. dnLabel->setText(i18n(" DotNET [thanks to Chris Lee],"));
  190. pqLabel = new TQLabel(page2);
  191. pqLabel->setText(i18n(" PlastikQ [thanks to Martin Beck],"));
  192. cxLabel = new TQLabel(page2);
  193. cxLabel->setText(i18n(" Comix [thanks to Jens Luetkens],"));
  194. kpLabel = new TQLabel(page2);
  195. kpLabel->setText(i18n(" Krisp [thanks to Keith Meehl],"));
  196. blLabel = new TQLabel(page2);
  197. blLabel->setText(i18n(" Ballistik [thanks to Florian Merz],"));
  198. ksLabel = new TQLabel(page2);
  199. ksLabel->setText(i18n(" Kerastik [thanks to Victor Perez Q],"));
  200. peLabel = new TQLabel(page2);
  201. peLabel->setText(i18n(" Polyester [thanks to Marco Martin]."));
  202. bastianLabel = new TQLabel(page2);
  203. bastianLabel->setText(i18n("Thanks to Bastian Venthur, the Debian maintainer of tde-style-lipstik."));
  204. pcbsdLabel = new TQLabel(page2);
  205. pcbsdLabel->setText(i18n("Thanks to Charles A. Landemaine, of PC-BSD, for the feature suggestion."));
  206. othersLabel = new TQLabel(page2);
  207. othersLabel->setText(i18n("Special thanks to Dominique and all the kde-look.org users."));
  208. layout->add(lipstikLabel);
  209. layout->add(authorLabel);
  210. layout->add(authorAddressLabel);
  211. layout->add(authorWebLabel);
  212. layout->addSpacing(10);
  213. layout->add(plastikLabel);
  214. layout->addSpacing(10);
  215. layout->add(alsoLabel);
  216. layout->add(cuLabel);
  217. layout->add(dnLabel);
  218. layout->add(pqLabel);
  219. layout->add(cxLabel);
  220. layout->add(kpLabel);
  221. layout->add(blLabel);
  222. layout->add(ksLabel);
  223. layout->add(peLabel);
  224. layout->addSpacing(10);
  225. layout->add(bastianLabel);
  226. layout->add(pcbsdLabel);
  227. layout->add(othersLabel);
  228. ///Populate!
  229. TQSettings s;
  230. origReverseGradients = s.readBoolEntry("/lipstikstyle/Settings/reverseGradients", false);
  231. reverseGradients->setChecked(origReverseGradients);
  232. origPaintGroove = s.readBoolEntry("/lipstikstyle/Settings/paintGroove", true);
  233. paintGroove->setChecked(origPaintGroove);
  234. origSharperMenuGradient = s.readBoolEntry("/lipstikstyle/Settings/sharperMenuGradient", false);
  235. sharperMenuGradient->setChecked(origSharperMenuGradient);
  236. origAlterMenuGradients = s.readBoolEntry("/lipstikstyle/Settings/alterMenuGradients", true);
  237. alterMenuGradients->setChecked(origAlterMenuGradients);
  238. origMenuLeftSideBar = s.readBoolEntry("/lipstikstyle/Settings/menuLeftSideBar", true);
  239. menuLeftSideBar->setChecked(origMenuLeftSideBar);
  240. origFlatStripe = s.readBoolEntry("/lipstikstyle/Settings/flatStripe", false);
  241. flatStripe->setChecked(origFlatStripe);
  242. origComboboxColored = s.readBoolEntry("/lipstikstyle/Settings/comboboxColored", false);
  243. comboboxColored->setChecked(origComboboxColored);
  244. origColoredMenuBar = s.readBoolEntry("/lipstikstyle/Settings/coloredMenuBar", false);
  245. coloredMenuBar->setChecked(origColoredMenuBar);
  246. origDrawTabHighlight = s.readBoolEntry("/lipstikstyle/Settings/drawTabHighlight", true);
  247. drawTabHighlight->setChecked(origDrawTabHighlight);
  248. origMenuSpacing = s.readNumEntry("/lipstikstyle/Settings/menuSpacing", 5);
  249. menuSpacing->setValue(origMenuSpacing);
  250. origToolBarSpacing = s.readNumEntry("/lipstikstyle/Settings/toolBarSpacing", 0);
  251. toolBarSpacing->setValue(origToolBarSpacing);
  252. origScrollBarStyle = s.readEntry("/lipstikstyle/Settings/scrollBarStyle", "WindowsStyleScrollBar");
  253. scrollBarStyle->setCurrentItem(scrollBarItem(origScrollBarStyle));
  254. origScrollBarWidth = s.readEntry("/lipstikstyle/Settings/scrollBarWidth", "Small");
  255. scrollBarWidth->setCurrentItem(scrollBarWidthItem(origScrollBarWidth));
  256. origSliderStyle = s.readEntry("/lipstikstyle/Settings/sliderStyle", "sliderLipstikStyle");
  257. sliderStyle->setCurrentItem(sliderItem(origSliderStyle));
  258. origDrawStatusBarFrame = s.readBoolEntry("/lipstikstyle/Settings/drawStatusBarFrame", false);
  259. drawStatusBarFrame->setChecked(origDrawStatusBarFrame);
  260. origDrawToolBarHandle = s.readBoolEntry("/lipstikstyle/Settings/drawToolBarHandle", true);
  261. drawToolBarHandle->setChecked(origDrawToolBarHandle);
  262. origAnimProgressBar = s.readBoolEntry("/lipstikstyle/Settings/animateProgressBar", false);
  263. animateProgressBar->setChecked(origAnimProgressBar);
  264. origDrawToolBarSeparator = s.readBoolEntry("/lipstikstyle/Settings/drawToolBarSeparator", true);
  265. drawToolBarSeparator->setChecked(origDrawToolBarSeparator);
  266. origDrawToolBarGradient = s.readBoolEntry("/lipstikstyle/Settings/drawToolBarGradient", false);
  267. drawToolBarGradient->setChecked(origDrawToolBarGradient);
  268. origInvertBarGrad = s.readBoolEntry("/lipstikstyle/Settings/invertBarGrad", true);
  269. invertBarGrad->setChecked(origInvertBarGrad);
  270. origDrawToolBarItemSeparator = s.readBoolEntry("/lipstikstyle/Settings/drawToolBarItemSeparator", true);
  271. drawToolBarItemSeparator->setChecked(origDrawToolBarItemSeparator);
  272. origDrawFocusRect = s.readBoolEntry("/lipstikstyle/Settings/drawFocusRect", true);
  273. drawFocusRect->setChecked(origDrawFocusRect);
  274. origFlatHeaders = s.readBoolEntry("/lipstikstyle/Settings/flatHeaders", true);
  275. flatHeaders->setChecked(origFlatHeaders);
  276. origTickCheckMark = s.readBoolEntry("/lipstikstyle/Settings/tickCheckMark", true);
  277. tickCheckMark->setChecked(origTickCheckMark);
  278. origDrawTriangularExpander = s.readBoolEntry("/lipstikstyle/Settings/drawTriangularExpander", false);
  279. drawTriangularExpander->setChecked(origDrawTriangularExpander);
  280. origInputFocusHighlight = s.readBoolEntry("/lipstikstyle/Settings/inputFocusHighlight", true);
  281. inputFocusHighlight->setChecked(origInputFocusHighlight);
  282. origCustomOverHighlightColor = s.readBoolEntry("/lipstikstyle/Settings/customOverHighlightColor", false);
  283. customOverHighlightColor->setChecked(origCustomOverHighlightColor);
  284. origOverHighlightColor = s.readEntry("/lipstikstyle/Settings/overHighlightColor", "/TQt/KWinPalette/activeBackground");
  285. overHighlightColor->setColor(origOverHighlightColor);
  286. origCustomMenuStripeColor = s.readBoolEntry("/lipstikstyle/Settings/customMenuStripeColor", false);
  287. customMenuStripeColor->setChecked(origCustomMenuStripeColor);
  288. origMenuStripeColor = s.readEntry("/lipstikstyle/Settings/menuStripeColor", "/TQt/KWinPalette/activeBackground");
  289. menuStripeColor->setColor(origMenuStripeColor);
  290. origCustomFocusHighlightColor = s.readBoolEntry("/lipstikstyle/Settings/customFocusHighlightColor", false);
  291. customFocusHighlightColor->setChecked(origCustomFocusHighlightColor);
  292. origFocusHighlightColor = s.readEntry("/lipstikstyle/Settings/focusHighlightColor", "/TQt/KWinPalette/activeBackground");
  293. focusHighlightColor->setColor(origFocusHighlightColor);
  294. origCustomCheckMarkColor = s.readBoolEntry("/lipstikstyle/Settings/customCheckMarkColor", false);
  295. customCheckMarkColor->setChecked(origCustomCheckMarkColor);
  296. origCheckMarkColor = s.readEntry("/lipstikstyle/Settings/checkMarkColor", "/TQt/KWinPalette/activeBackground");
  297. checkMarkColor->setColor(origCheckMarkColor);
  298. origCustomTabHighlightColor = s.readBoolEntry("/lipstikstyle/Settings/customTabHighlightColor", false);
  299. customTabHighlightColor->setChecked(origCustomTabHighlightColor);
  300. origTabHighlightColor = s.readEntry("/lipstikstyle/Settings/tabHighlightColor", "/TQt/KWinPalette/activeBackground");
  301. tabHighlightColor->setColor(origTabHighlightColor);
  302. connect(reverseGradients, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
  303. connect(paintGroove, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
  304. connect(sharperMenuGradient, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
  305. connect(alterMenuGradients, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
  306. connect(menuLeftSideBar, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
  307. connect(flatStripe, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
  308. connect(drawStatusBarFrame, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
  309. connect(drawToolBarHandle, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
  310. connect(comboboxColored, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
  311. connect(coloredMenuBar, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
  312. connect(drawTabHighlight, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
  313. connect(menuSpacing, TQT_SIGNAL( valueChanged(int) ), TQT_SLOT( updateChanged() ) );
  314. connect(toolBarSpacing, TQT_SIGNAL( valueChanged(int) ), TQT_SLOT( updateChanged() ) );
  315. connect(scrollBarStyle, TQT_SIGNAL( activated(int) ), TQT_SLOT( updateChanged() ) );
  316. connect(scrollBarWidth, TQT_SIGNAL( activated(int) ), TQT_SLOT( updateChanged() ) );
  317. connect(sliderStyle, TQT_SIGNAL( activated(int) ), TQT_SLOT( updateChanged() ) );
  318. connect(animateProgressBar, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
  319. connect(drawToolBarSeparator, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
  320. connect(drawToolBarGradient, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
  321. connect(invertBarGrad, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
  322. connect(drawToolBarItemSeparator, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
  323. connect(drawFocusRect, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
  324. connect(flatHeaders, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
  325. connect(tickCheckMark, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
  326. connect(drawTriangularExpander, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
  327. connect(inputFocusHighlight, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
  328. connect(customOverHighlightColor, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
  329. connect(overHighlightColor, TQT_SIGNAL( pressed() ), TQT_SLOT( updateChanged() ) );
  330. connect(customMenuStripeColor, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
  331. connect(menuStripeColor, TQT_SIGNAL( pressed() ), TQT_SLOT( updateChanged() ) );
  332. connect(customFocusHighlightColor, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
  333. connect(focusHighlightColor, TQT_SIGNAL( pressed() ), TQT_SLOT( updateChanged() ) );
  334. connect(customCheckMarkColor, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
  335. connect(checkMarkColor, TQT_SIGNAL( pressed() ), TQT_SLOT( updateChanged() ) );
  336. connect(customTabHighlightColor, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
  337. connect(tabHighlightColor, TQT_SIGNAL( pressed() ), TQT_SLOT( updateChanged() ) );
  338. //Menu Stripe
  339. if ( menuLeftSideBar->isChecked() ) {
  340. customMenuStripeColor->setEnabled(true);
  341. flatStripe->setEnabled(true);
  342. } else {
  343. customMenuStripeColor->setEnabled(false);
  344. flatStripe->setEnabled(false);
  345. }
  346. //Toolbar gradients.
  347. if ( drawToolBarGradient->isChecked() ) {
  348. invertBarGrad->setEnabled(true);
  349. } else {
  350. invertBarGrad->setEnabled(false);
  351. }
  352. if ( customMenuStripeColor->isChecked() && customMenuStripeColor->isEnabled())
  353. menuStripeColor->setEnabled(true);
  354. else
  355. menuStripeColor->setEnabled(false);
  356. //Input Focus
  357. if ( inputFocusHighlight->isChecked() )
  358. customFocusHighlightColor->setEnabled(true);
  359. else
  360. customFocusHighlightColor->setEnabled(false);
  361. if ( customFocusHighlightColor->isChecked() && customFocusHighlightColor->isEnabled())
  362. focusHighlightColor->setEnabled(true);
  363. else
  364. focusHighlightColor->setEnabled(false);
  365. //Custom checkmark color.
  366. if ( customCheckMarkColor->isChecked() )
  367. checkMarkColor->setEnabled(true);
  368. else
  369. checkMarkColor->setEnabled(false);
  370. //Custom tab highlight color.
  371. if ( customTabHighlightColor->isChecked() )
  372. tabHighlightColor->setEnabled(true);
  373. else
  374. tabHighlightColor->setEnabled(false);
  375. if ( customOverHighlightColor->isChecked() )
  376. overHighlightColor->setEnabled(true);
  377. else
  378. overHighlightColor->setEnabled(false);
  379. }
  380. LipstikStyleConfig::~LipstikStyleConfig()
  381. {
  382. }
  383. void LipstikStyleConfig::save()
  384. {
  385. TQSettings s;
  386. s.writeEntry("/lipstikstyle/Settings/reverseGradients", reverseGradients->isChecked());
  387. s.writeEntry("/lipstikstyle/Settings/paintGroove", paintGroove->isChecked());
  388. s.writeEntry("/lipstikstyle/Settings/sharperMenuGradient", sharperMenuGradient->isChecked());
  389. s.writeEntry("/lipstikstyle/Settings/alterMenuGradients", alterMenuGradients->isChecked());
  390. s.writeEntry("/lipstikstyle/Settings/menuLeftSideBar", menuLeftSideBar->isChecked());
  391. s.writeEntry("/lipstikstyle/Settings/flatStripe", flatStripe->isChecked());
  392. s.writeEntry("/lipstikstyle/Settings/drawStatusBarFrame", drawStatusBarFrame->isChecked());
  393. s.writeEntry("/lipstikstyle/Settings/drawToolBarHandle", drawToolBarHandle->isChecked());
  394. s.writeEntry("/lipstikstyle/Settings/comboboxColored", comboboxColored->isChecked());
  395. s.writeEntry("/lipstikstyle/Settings/coloredMenuBar", coloredMenuBar->isChecked());
  396. s.writeEntry("/lipstikstyle/Settings/drawTabHighlight", drawTabHighlight->isChecked());
  397. s.writeEntry("/lipstikstyle/Settings/menuSpacing", menuSpacing->value());
  398. s.writeEntry("/lipstikstyle/Settings/toolBarSpacing", toolBarSpacing->value());
  399. s.writeEntry("/lipstikstyle/Settings/scrollBarStyle", scrollBarType(scrollBarStyle->currentItem()));
  400. s.writeEntry("/lipstikstyle/Settings/scrollBarWidth", scrollBarWidthType(scrollBarWidth->currentItem()));
  401. s.writeEntry("/lipstikstyle/Settings/sliderStyle", sliderType(sliderStyle->currentItem()));
  402. s.writeEntry("/lipstikstyle/Settings/animateProgressBar", animateProgressBar->isChecked());
  403. s.writeEntry("/lipstikstyle/Settings/drawToolBarSeparator", drawToolBarSeparator->isChecked());
  404. s.writeEntry("/lipstikstyle/Settings/drawToolBarGradient", drawToolBarGradient->isChecked());
  405. s.writeEntry("/lipstikstyle/Settings/invertBarGrad", invertBarGrad->isChecked());
  406. s.writeEntry("/lipstikstyle/Settings/drawToolBarItemSeparator", drawToolBarItemSeparator->isChecked());
  407. s.writeEntry("/lipstikstyle/Settings/drawFocusRect", drawFocusRect->isChecked());
  408. s.writeEntry("/lipstikstyle/Settings/flatHeaders", flatHeaders->isChecked());
  409. s.writeEntry("/lipstikstyle/Settings/tickCheckMark", tickCheckMark->isChecked());
  410. s.writeEntry("/lipstikstyle/Settings/drawTriangularExpander", drawTriangularExpander->isChecked());
  411. s.writeEntry("/lipstikstyle/Settings/inputFocusHighlight", inputFocusHighlight->isChecked());
  412. s.writeEntry("/lipstikstyle/Settings/customOverHighlightColor", customOverHighlightColor->isChecked());
  413. s.writeEntry("/lipstikstyle/Settings/overHighlightColor", TQColor(overHighlightColor->color()).name());
  414. s.writeEntry("/lipstikstyle/Settings/customMenuStripeColor", customMenuStripeColor->isChecked());
  415. s.writeEntry("/lipstikstyle/Settings/menuStripeColor", TQColor(menuStripeColor->color()).name());
  416. s.writeEntry("/lipstikstyle/Settings/customFocusHighlightColor", customFocusHighlightColor->isChecked());
  417. s.writeEntry("/lipstikstyle/Settings/focusHighlightColor", TQColor(focusHighlightColor->color()).name());
  418. s.writeEntry("/lipstikstyle/Settings/customCheckMarkColor", customCheckMarkColor->isChecked());
  419. s.writeEntry("/lipstikstyle/Settings/checkMarkColor", TQColor(checkMarkColor->color()).name());
  420. s.writeEntry("/lipstikstyle/Settings/customTabHighlightColor", customTabHighlightColor->isChecked());
  421. s.writeEntry("/lipstikstyle/Settings/tabHighlightColor", TQColor(tabHighlightColor->color()).name());
  422. }
  423. void LipstikStyleConfig::defaults()
  424. {
  425. reverseGradients->setChecked(false);
  426. paintGroove->setChecked(true);
  427. sharperMenuGradient->setChecked(false);
  428. alterMenuGradients->setChecked(true);
  429. menuLeftSideBar->setChecked(true);
  430. flatStripe->setChecked(false);
  431. menuSpacing->setValue(5);
  432. toolBarSpacing->setValue(0);
  433. drawStatusBarFrame->setChecked(false);
  434. drawToolBarHandle->setChecked(true);
  435. comboboxColored->setChecked(false);
  436. coloredMenuBar->setChecked(false);
  437. drawTabHighlight->setChecked(true);
  438. scrollBarStyle->setCurrentItem(0);
  439. scrollBarWidth->setCurrentItem(0);
  440. sliderStyle->setCurrentItem(1);
  441. animateProgressBar->setChecked(false);
  442. drawToolBarSeparator->setChecked(true);
  443. drawToolBarGradient->setChecked(false);
  444. invertBarGrad->setChecked(true);
  445. drawToolBarItemSeparator->setChecked(true);
  446. drawFocusRect->setChecked(true);
  447. flatHeaders->setChecked(true);
  448. tickCheckMark->setChecked(true);
  449. drawTriangularExpander->setChecked(false);
  450. inputFocusHighlight->setChecked(true);
  451. customOverHighlightColor->setChecked(false);
  452. overHighlightColor->setColor("/TQt/KWinPalette/activeBackground");
  453. customMenuStripeColor->setChecked(false);
  454. menuStripeColor->setColor("/TQt/KWinPalette/activeBackground");
  455. customFocusHighlightColor->setChecked(false);
  456. focusHighlightColor->setColor("/TQt/KWinPalette/activeBackground");
  457. customCheckMarkColor->setChecked(false);
  458. checkMarkColor->setColor("/TQt/KWinPalette/activeBackground");
  459. customTabHighlightColor->setChecked(false);
  460. tabHighlightColor->setColor("/TQt/KWinPalette/activeBackground");
  461. //updateChanged would be done by setChecked already
  462. }
  463. void LipstikStyleConfig::updateChanged()
  464. {
  465. if ( customOverHighlightColor->isChecked() )
  466. overHighlightColor->setEnabled(true);
  467. else
  468. overHighlightColor->setEnabled(false);
  469. if ( drawToolBarGradient->isChecked() )
  470. invertBarGrad->setEnabled(true);
  471. else
  472. invertBarGrad->setEnabled(false);
  473. //Stripe
  474. if ( menuLeftSideBar->isChecked() ) {
  475. customMenuStripeColor->setEnabled(true);
  476. flatStripe->setEnabled(true);
  477. if ( customMenuStripeColor->isEnabled() )
  478. menuStripeColor->setEnabled(true);
  479. else
  480. menuStripeColor->setEnabled(false);
  481. } else {
  482. customMenuStripeColor->setEnabled(false);
  483. menuStripeColor->setEnabled(false);
  484. flatStripe->setEnabled(false);
  485. }
  486. if ( customMenuStripeColor->isChecked() && customMenuStripeColor->isEnabled() )
  487. menuStripeColor->setEnabled(true);
  488. else
  489. menuStripeColor->setEnabled(false);
  490. //Input Focus
  491. if ( inputFocusHighlight->isChecked() ) {
  492. customFocusHighlightColor->setEnabled(true);
  493. if ( customFocusHighlightColor->isEnabled() )
  494. focusHighlightColor->setEnabled(true);
  495. else
  496. focusHighlightColor->setEnabled(false);
  497. } else {
  498. customFocusHighlightColor->setEnabled(false);
  499. focusHighlightColor->setEnabled(false);
  500. }
  501. if ( customFocusHighlightColor->isChecked() && customFocusHighlightColor->isEnabled() )
  502. focusHighlightColor->setEnabled(true);
  503. else
  504. focusHighlightColor->setEnabled(false);
  505. if ( customCheckMarkColor->isChecked() )
  506. checkMarkColor->setEnabled(true);
  507. else
  508. checkMarkColor->setEnabled(false);
  509. if ( customTabHighlightColor->isChecked() )
  510. tabHighlightColor->setEnabled(true);
  511. else
  512. tabHighlightColor->setEnabled(false);
  513. if ((animateProgressBar->isChecked() == origAnimProgressBar) &&
  514. (reverseGradients->isChecked() == origReverseGradients) &&
  515. (paintGroove->isChecked() == origPaintGroove) &&
  516. (sharperMenuGradient->isChecked() == origSharperMenuGradient) &&
  517. (alterMenuGradients->isChecked() == origAlterMenuGradients) &&
  518. (menuLeftSideBar->isChecked() == origMenuLeftSideBar) &&
  519. (flatStripe->isChecked() == origFlatStripe) &&
  520. (menuSpacing->value() == origMenuSpacing) &&
  521. (toolBarSpacing->value() == origToolBarSpacing) &&
  522. (drawStatusBarFrame->isChecked() == origDrawStatusBarFrame) &&
  523. (drawToolBarHandle->isChecked() == origDrawToolBarHandle) &&
  524. (comboboxColored->isChecked() == origComboboxColored) &&
  525. (coloredMenuBar->isChecked() == origColoredMenuBar) &&
  526. (drawTabHighlight->isChecked() == origDrawTabHighlight) &&
  527. (drawToolBarSeparator->isChecked() == origDrawToolBarSeparator) &&
  528. (drawToolBarGradient->isChecked() == origDrawToolBarGradient) &&
  529. (invertBarGrad->isChecked() == origInvertBarGrad) &&
  530. (drawToolBarItemSeparator->isChecked() == origDrawToolBarItemSeparator) &&
  531. (drawFocusRect->isChecked() == origDrawFocusRect) &&
  532. (flatHeaders->isChecked() == origFlatHeaders) &&
  533. (tickCheckMark->isChecked() == origTickCheckMark) &&
  534. (drawTriangularExpander->isChecked() == origDrawTriangularExpander) &&
  535. (inputFocusHighlight->isChecked() == origInputFocusHighlight) &&
  536. (customOverHighlightColor->isChecked() == origCustomOverHighlightColor) &&
  537. (overHighlightColor->color() == origOverHighlightColor) &&
  538. (customMenuStripeColor->isChecked() == origCustomMenuStripeColor) &&
  539. (menuStripeColor->color() == origMenuStripeColor) &&
  540. (customFocusHighlightColor->isChecked() == origCustomFocusHighlightColor) &&
  541. (focusHighlightColor->color() == origFocusHighlightColor) &&
  542. (customCheckMarkColor->isChecked() == origCustomCheckMarkColor) &&
  543. (checkMarkColor->color() == origCheckMarkColor) &&
  544. (customTabHighlightColor->isChecked() == origCustomTabHighlightColor) &&
  545. (tabHighlightColor->color() == origTabHighlightColor) &&
  546. (scrollBarStyle->currentText() == origScrollBarStyle) &&
  547. (scrollBarWidth->currentText() == origScrollBarWidth) &&
  548. (sliderStyle->currentText() == origSliderStyle)
  549. )
  550. emit changed(false);
  551. else
  552. emit changed(true);
  553. }
  554. //Scrollbar types
  555. TQString LipstikStyleConfig::scrollBarType( int listnr )
  556. {
  557. switch ( listnr ) {
  558. case 0:
  559. return TQString("WindowsStyleScrollBar");
  560. case 1:
  561. return TQString("PlatinumStyleScrollBar");
  562. case 2:
  563. return TQString("ThreeButtonScrollBar");
  564. case 3:
  565. return TQString("NextStyleScrollBar");
  566. default:
  567. return TQString("PlatinumStyleScrollBar");
  568. }
  569. }
  570. int LipstikStyleConfig::scrollBarItem( TQString kSBType )
  571. {
  572. if( !strcmp(kSBType,"WindowsStyleScrollBar") )
  573. return 0;
  574. else if( !strcmp(kSBType,"PlatinumStyleScrollBar") )
  575. return 1;
  576. else if( !strcmp(kSBType,"ThreeButtonScrollBar") )
  577. return 2;
  578. else if( !strcmp(kSBType,"NextStyleScrollBar") )
  579. return 3;
  580. else
  581. return 1;
  582. }
  583. //Scrollbar Widths
  584. TQString LipstikStyleConfig::scrollBarWidthType( int widthListnr )
  585. {
  586. switch ( widthListnr ) {
  587. case 0:
  588. return TQString("Small");
  589. case 1:
  590. return TQString("Normal");
  591. case 2:
  592. return TQString("Large");
  593. default:
  594. return TQString("Small");
  595. }
  596. }
  597. int LipstikStyleConfig::scrollBarWidthItem( TQString kSBWidthType )
  598. {
  599. if( !strcmp(kSBWidthType,"Small") )
  600. return 0;
  601. else if( !strcmp(kSBWidthType,"Normal") )
  602. return 1;
  603. else if( !strcmp(kSBWidthType,"Large") )
  604. return 2;
  605. else
  606. return 0;
  607. }
  608. //Slider types
  609. int LipstikStyleConfig::sliderItem( TQString kSliderType )
  610. {
  611. if( !strcmp(kSliderType,"sliderPlastikStyle") )
  612. return 0;
  613. else if( !strcmp(kSliderType,"sliderLipstikStyle") )
  614. return 1;
  615. else if( !strcmp(kSliderType,"sliderGtkStyle") )
  616. return 2;
  617. else
  618. return 2;
  619. }
  620. TQString LipstikStyleConfig::sliderType( int sliderlistnr )
  621. {
  622. switch ( sliderlistnr ) {
  623. case 0:
  624. return TQString("sliderPlastikStyle");
  625. case 1:
  626. return TQString("sliderLipstikStyle");
  627. case 2:
  628. return TQString("sliderGtkStyle");
  629. default:
  630. return TQString("sliderGtkStyle");
  631. }
  632. }
  633. #include "lipstikconf.moc"