ctkSettings.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*=========================================================================
  2. Library: CTK
  3. Copyright (c) Kitware Inc.
  4. All rights reserved.
  5. Distributed under a BSD License. See LICENSE.txt file.
  6. This software is distributed "AS IS" WITHOUT ANY WARRANTY; without even
  7. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the above copyright notice for more information.
  9. =========================================================================*/
  10. /*=========================================================================
  11. Program: ParaView
  12. Module: $RCSfile: pqSettings.h,v $
  13. Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc.
  14. All rights reserved.
  15. ParaView is a free software; you can redistribute it and/or modify it
  16. under the terms of the ParaView license version 1.2.
  17. See License_v1.2.txt for the full ParaView license.
  18. A copy of this license can be obtained by contacting
  19. Kitware Inc.
  20. 28 Corporate Drive
  21. Clifton Park, NY 12065
  22. USA
  23. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  24. ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  25. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  26. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
  27. CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  28. EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  29. PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  30. PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  31. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  32. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  33. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  34. =========================================================================*/
  35. /// \file ctkSettings.h
  36. ///
  37. /// \date 02/03/2010
  38. #ifndef __ctkSettings_h
  39. #define __ctkSettings_h
  40. // QT includes
  41. #include <QSettings>
  42. #include "CTKWidgetsExport.h"
  43. class QDialog;
  44. class QMainWindow;
  45. class CTK_WIDGETS_EXPORT ctkSettings : public QSettings
  46. {
  47. Q_OBJECT
  48. public:
  49. ctkSettings(
  50. const QString& organization,
  51. const QString& application,
  52. QObject* p);
  53. void saveState(const QMainWindow& window, const QString& key);
  54. void saveState(const QDialog& dialog, const QString& key);
  55. void restoreState(const QString& key, QMainWindow& window);
  56. void restoreState(const QString& key, QDialog& dialog);
  57. /// Calling this method will cause the modified signal to be emited.
  58. void alertSettingsModified();
  59. signals:
  60. void modified();
  61. };
  62. #endif