1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- /*=========================================================================
- Library: CTK
- Copyright (c) Kitware Inc.
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0.txt
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- =========================================================================*/
- #ifndef __ctkSettingsDialog_h
- #define __ctkSettingsDialog_h
- // Qt includes
- #include <QDialog>
- // CTK includes
- #include "ctkWidgetsExport.h"
- class QAbstractButton;
- class QSettings;
- class QTreeWidgetItem;
- class ctkSettingsDialogPrivate;
- class ctkSettingsPanel;
- /// \ingroup Widgets
- class CTK_WIDGETS_EXPORT ctkSettingsDialog : public QDialog
- {
- Q_OBJECT
- public:
- /// Superclass typedef
- typedef QDialog Superclass;
- /// Constructor
- explicit ctkSettingsDialog(QWidget* parent = 0);
- /// Destructor
- virtual ~ctkSettingsDialog();
- QSettings* settings()const;
- void setSettings(QSettings* settings);
- ctkSettingsPanel* panel(const QString& panel)const;
- ctkSettingsPanel* currentPanel()const;
- /// Uses the ctkSettingsPanel::windowTitle property to show in the list
- void addPanel(ctkSettingsPanel* panel, ctkSettingsPanel* parentPanel = 0);
- /// Utility function
- void addPanel(const QString& label, ctkSettingsPanel* panel, ctkSettingsPanel* parentPanel = 0);
- void addPanel(const QString& label, const QIcon& icon, ctkSettingsPanel* panel, ctkSettingsPanel* parentPanel = 0);
- void adjustTreeWidgetToContents();
- public Q_SLOTS:
- void setCurrentPanel(ctkSettingsPanel* panel);
- void setCurrentPanel(const QString& label);
- void applySettings();
- void resetSettings();
- void restoreDefaultSettings();
-
- virtual void accept();
- virtual void reject();
- Q_SIGNALS:
- void settingChanged(const QString& key, const QVariant& value);
- protected Q_SLOTS:
- void onSettingChanged(const QString& key, const QVariant& newVal);
- void onCurrentItemChanged(QTreeWidgetItem* currentItem, QTreeWidgetItem* previous);
- void onDialogButtonClicked(QAbstractButton* button);
- protected:
- virtual bool event(QEvent *);
- protected:
- QScopedPointer<ctkSettingsDialogPrivate> d_ptr;
- private:
- Q_DECLARE_PRIVATE(ctkSettingsDialog);
- Q_DISABLE_COPY(ctkSettingsDialog);
- };
- #endif
|