1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the tools applications of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:GPL-EXCEPT$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
21 ** included in the packaging of this file. Please review the following
22 ** information to ensure the GNU General Public License requirements will
23 ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
24 **
25 ** $QT_END_LICENSE$
26 **
27 ****************************************************************************/
28 
29 #ifndef OPTIONSWIDGET_H
30 #define OPTIONSWIDGET_H
31 
32 #include <QtGui>
33 #include <QtWidgets>
34 
35 class OptionsWidget : public QWidget
36 {
37 Q_OBJECT
38 public:
OptionsWidget()39     OptionsWidget()
40         :QWidget()
41     {
42         QVBoxLayout *m_layout = new QVBoxLayout;
43 
44         m_refresh = new QPushButton(this);
45         m_refresh->setText(QLatin1String("Refresh"));
46         m_layout->addWidget(m_refresh);
47         connect(m_refresh, SIGNAL(clicked()), SIGNAL(refreshClicked()));
48 
49         m_hideInvisibleItems = new QCheckBox(this);
50         m_layout->addWidget(m_hideInvisibleItems);
51         m_hideInvisibleItems->setText("Hide Invisible Items");
52         m_hideInvisibleItems->setChecked(true);
53         connect(m_hideInvisibleItems, SIGNAL(toggled(bool)), SIGNAL(optionsChanged()));
54 
55         m_hideOffscreenItems = new QCheckBox(this);
56         m_layout->addWidget(m_hideOffscreenItems);
57         m_hideOffscreenItems->setText("Hide Offscreen Items");
58         m_hideOffscreenItems->setChecked(true);
59         connect(m_hideOffscreenItems, SIGNAL(toggled(bool)), SIGNAL(optionsChanged()));
60 
61         m_hidePaneItems = new QCheckBox(this);
62         m_layout->addWidget(m_hidePaneItems);
63         m_hidePaneItems->setText("Hide Items with the Pane role");
64         m_hidePaneItems->setChecked(true);
65         connect(m_hidePaneItems, SIGNAL(toggled(bool)), SIGNAL(optionsChanged()));
66 
67         m_hideNullObjectItems = new QCheckBox(this);
68         m_layout->addWidget(m_hideNullObjectItems);
69         m_hideNullObjectItems->setText("Hide Items with a null QObject pointer");
70         m_hideNullObjectItems->setChecked(true);
71         connect(m_hideNullObjectItems, SIGNAL(toggled(bool)), SIGNAL(optionsChanged()));
72 
73         m_hideNullRectItems = new QCheckBox(this);
74         m_layout->addWidget(m_hideNullRectItems);
75         m_hideNullRectItems->setText("Hide Items with a null rect");
76         m_hideNullRectItems->setChecked(true);
77         connect(m_hideNullRectItems, SIGNAL(toggled(bool)), SIGNAL(optionsChanged()));
78 
79         m_enableTextToSpeach = new QCheckBox(this);
80         m_layout->addWidget(m_enableTextToSpeach);
81         m_enableTextToSpeach->setText("Enable Text To Speech");
82         m_enableTextToSpeach->setChecked(false);
83         connect(m_enableTextToSpeach, SIGNAL(toggled(bool)), SIGNAL(optionsChanged()));
84 
85 
86         m_scale = new QSlider(Qt::Horizontal);
87 //        m_layout->addWidget(m_scale);
88         m_scale->setRange(5, 30);
89         m_scale->setValue(1);
90         connect(m_scale, SIGNAL(valueChanged(int)), SIGNAL(scaleChanged(int)));
91 
92         this->setLayout(m_layout);
93     }
94 
hideInvisibleItems()95     bool hideInvisibleItems() { return m_hideInvisibleItems->isChecked(); }
hideOffscreenItems()96     bool hideOffscreenItems() { return m_hideOffscreenItems->isChecked(); }
hidePaneItems()97     bool hidePaneItems() { return m_hidePaneItems->isChecked(); }
hideNullObjectItems()98     bool hideNullObjectItems() { return m_hideNullObjectItems->isChecked(); }
hideNullRectItems()99     bool hideNullRectItems() { return m_hideNullRectItems->isChecked(); }
enableTextToSpeach()100     bool enableTextToSpeach() { return m_enableTextToSpeach->isChecked(); }
101 signals:
102     void optionsChanged();
103     void refreshClicked();
104     void scaleChanged(int);
105 
106 private:
107     QVBoxLayout *m_layout;
108 
109     QPushButton *m_refresh;
110     QCheckBox *m_hideInvisibleItems;
111     QCheckBox *m_hideOffscreenItems;
112     QCheckBox *m_hidePaneItems;
113     QCheckBox *m_hideNullObjectItems;
114     QCheckBox *m_hideNullRectItems;
115     QCheckBox *m_enableTextToSpeach;
116     QSlider *m_scale;
117 };
118 
119 
120 #endif // OPTIONSWIDGET_H
121