1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
16 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights. These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
32 **************************************************************************/
34 #ifndef SETTINGSDIALOG_H
35 #define SETTINGSDIALOG_H
37 #include "coreplugin/dialogs/ioptionspage.h"
39 #include <QtCore/QList>
40 #include <QtCore/QSet>
41 #include <QtCore/QPointer>
42 #include <QtCore/QEventLoop>
43 #include <QtGui/QDialog>
47 class QSortFilterProxyModel;
63 class SettingsDialog : public QDialog
69 // Returns a settings dialog. This makes sure that always only
70 // a single settings dialog instance is running.
71 // The dialog will be deleted automatically on close.
72 static SettingsDialog *getSettingsDialog(QWidget *parent,
73 const QString &initialCategory = QString(),
74 const QString &initialPage = QString());
75 // Run the dialog and wait for it to finish.
76 // Returns if the changes have been applied.
79 virtual QSize sizeHint() const;
88 void currentChanged(const QModelIndex ¤t);
89 void currentTabChanged(int);
90 void filter(const QString &text);
91 void ensureAllCategoryWidgets();
94 SettingsDialog(QWidget *parent);
98 void showCategory(int index);
99 void showPage(const QString &categoryId, const QString &pageId);
100 void updateEnabledTabs(Category *category, const QString &searchText);
101 void ensureCategoryWidget(Category *category);
102 void disconnectTabWidgets();
104 const QList<Core::IOptionsPage*> m_pages;
106 QSet<Core::IOptionsPage*> m_visitedPages;
107 QSortFilterProxyModel *m_proxyModel;
108 CategoryModel *m_model;
109 QString m_currentCategory;
110 QString m_currentPage;
111 QStackedLayout *m_stackedLayout;
112 Utils::FilterLineEdit *m_filterLineEdit;
113 QListView *m_categoryList;
114 QLabel *m_headerLabel;
117 QList<QEventLoop *> m_eventLoops;
118 static QPointer<SettingsDialog> m_instance;
121 } // namespace Internal
124 #endif // SETTINGSDIALOG_H