LP-311 Remove basic/advanced stabilization tab auto-switch (autotune/txpid lock issues)
[librepilot.git] / ground / gcs / src / libs / utils / submitfieldwidget.h
blob4dc3ea39429f0ef7114d53d4e50eee19504bd48b
1 /**
2 ******************************************************************************
4 * @file submitfieldwidget.h
5 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
6 * Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
7 * @brief
8 * @see The GNU Public License (GPL) Version 3
9 * @defgroup
10 * @{
12 *****************************************************************************/
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 3 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 * for more details.
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 #ifndef SUBMITFIELDWIDGET_H
30 #define SUBMITFIELDWIDGET_H
32 #include "utils_global.h"
34 #include <QWidget>
36 QT_BEGIN_NAMESPACE
37 class QCompleter;
38 QT_END_NAMESPACE
40 namespace Utils {
41 struct SubmitFieldWidgetPrivate;
43 /* A widget for editing submit message fields like "reviewed-by:",
44 * "signed-off-by:". It displays them in a vertical row of combo/line edit fields
45 * that is modeled after the target address controls of mail clients.
46 * When choosing a different field in the combo, a new row is opened if text
47 * has been entered for the current field. Optionally, a "Browse..." button and
48 * completer can be added. */
49 class QTCREATOR_UTILS_EXPORT SubmitFieldWidget : public QWidget {
50 Q_OBJECT Q_PROPERTY(QStringList fields READ fields WRITE setFields DESIGNABLE true)
51 Q_PROPERTY(bool hasBrowseButton READ hasBrowseButton WRITE setHasBrowseButton DESIGNABLE true)
52 Q_PROPERTY(bool allowDuplicateFields READ allowDuplicateFields WRITE setAllowDuplicateFields DESIGNABLE true)
54 public:
55 explicit SubmitFieldWidget(QWidget *parent = 0);
56 virtual ~SubmitFieldWidget();
58 QStringList fields() const;
59 void setFields(const QStringList &);
61 bool hasBrowseButton() const;
62 void setHasBrowseButton(bool d);
64 // Allow several entries for fields ("reviewed-by: a", "reviewed-by: b")
65 bool allowDuplicateFields() const;
66 void setAllowDuplicateFields(bool);
68 QCompleter *completer() const;
69 void setCompleter(QCompleter *c);
71 QString fieldValue(int pos) const;
72 void setFieldValue(int pos, const QString &value);
74 QString fieldValues() const;
76 signals:
77 void browseButtonClicked(int pos, const QString &field);
79 private slots:
80 void slotRemove();
81 void slotComboIndexChanged(int);
82 void slotBrowseButtonClicked();
84 private:
85 void removeField(int index);
86 bool comboIndexChange(int fieldNumber, int index);
87 void createField(const QString &f);
89 SubmitFieldWidgetPrivate *m_d;
93 #endif // SUBMITFIELDWIDGET_H