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.

highcontrastconfig.cpp 2.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. Copyright (c) 2005 Luciano Montanaro <mikelima@cirulla.net>
  3. based on the Keramick 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 <tqsettings.h>
  24. #include <kdialog.h>
  25. #include <tdeglobal.h>
  26. #include <tdelocale.h>
  27. #include "highcontrastconfig.h"
  28. extern "C" KDE_EXPORT TQWidget*
  29. allocate_kstyle_config(TQWidget* parent)
  30. {
  31. return new HighContrastStyleConfig(parent);
  32. }
  33. HighContrastStyleConfig::HighContrastStyleConfig(
  34. TQWidget* parent): TQWidget(parent)
  35. {
  36. // Should have no margins here, the dialog provides them
  37. TQVBoxLayout* layout = new TQVBoxLayout(this, 0, 0);
  38. TDEGlobal::locale()->insertCatalogue("kstyle_highcontrast_config");
  39. wideLinesBox = new TQCheckBox(i18n("Use wider lines"), this);
  40. layout->add(wideLinesBox);
  41. layout->addStretch(1);
  42. TQSettings s;
  43. originalWideLinesState = s.readBoolEntry(
  44. "/highcontraststyle/Settings/wideLines", false);
  45. wideLinesBox->setChecked(originalWideLinesState);
  46. connect(wideLinesBox, TQT_SIGNAL(toggled(bool)), TQT_SLOT(updateChanged()));
  47. }
  48. HighContrastStyleConfig::~HighContrastStyleConfig()
  49. {
  50. TDEGlobal::locale()->removeCatalogue("kstyle_keramik_config");
  51. }
  52. void
  53. HighContrastStyleConfig::save()
  54. {
  55. TQSettings s;
  56. s.writeEntry("/highcontraststyle/Settings/wideLines",
  57. wideLinesBox->isChecked());
  58. }
  59. void
  60. HighContrastStyleConfig::defaults()
  61. {
  62. wideLinesBox->setChecked(false);
  63. // updateChanged would be done by setChecked already
  64. }
  65. void
  66. HighContrastStyleConfig::updateChanged()
  67. {
  68. if ((wideLinesBox->isChecked() == originalWideLinesState)) {
  69. emit changed(false);
  70. } else {
  71. emit changed(true);
  72. }
  73. }
  74. #include "highcontrastconfig.moc"