LP-311 Remove basic/advanced stabilization tab auto-switch (autotune/txpid lock issues)
[librepilot.git] / ground / gcs / src / libs / utils / parameteraction.h
blob52cee193f654b42830b7299db5a9557c5b158eb2
1 /**
2 ******************************************************************************
4 * @file parameteraction.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 PARAMETERACTION_H
30 #define PARAMETERACTION_H
32 #include "utils_global.h"
34 #include <QAction>
36 namespace Utils {
37 /* ParameterAction: Intended for actions that act on a 'current',
38 * string-type parameter (typically file name) and have 2 states:
39 * 1) <no current parameter> displaying "Do XX" (empty text)
40 * 2) <parameter present> displaying "Do XX with %1".
41 * Provides a slot to set the parameter, changing display
42 * and enabled state accordingly.
43 * The text passed in should already be translated; parameterText
44 * should contain a %1 where the parameter is to be inserted. */
46 class QTCREATOR_UTILS_EXPORT ParameterAction : public QAction {
47 Q_ENUMS(EnablingMode)
48 Q_PROPERTY(QString emptyText READ emptyText WRITE setEmptyText)
49 Q_PROPERTY(QString parameterText READ parameterText WRITE setParameterText)
50 Q_PROPERTY(EnablingMode enablingMode READ enablingMode WRITE setEnablingMode)
51 Q_OBJECT
52 public:
53 enum EnablingMode { AlwaysEnabled, EnabledWithParameter };
55 explicit ParameterAction(const QString &emptyText,
56 const QString &parameterText,
57 EnablingMode em = AlwaysEnabled,
58 QObject *parent = 0);
60 QString emptyText() const;
61 void setEmptyText(const QString &);
63 QString parameterText() const;
64 void setParameterText(const QString &);
66 EnablingMode enablingMode() const;
67 void setEnablingMode(EnablingMode m);
69 public slots:
70 void setParameter(const QString &);
72 private:
73 QString m_emptyText;
74 QString m_parameterText;
75 EnablingMode m_enablingMode;
79 #endif // PARAMETERACTION_H