2 ******************************************************************************
5 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
6 * Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
8 * @see The GNU Public License (GPL) Version 3
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
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
32 #include "utils_global.h"
35 #include <QAbstractButton>
38 struct PathChooserPrivate
;
41 * A control that let's the user choose a path, consisting of a QLineEdit and
42 * a "Browse" button. Has some validation logic for embedding into QWizardPage.
44 class QTCREATOR_UTILS_EXPORT PathChooser
: public QWidget
{
45 Q_DISABLE_COPY(PathChooser
)
48 Q_PROPERTY(QString path READ path WRITE setPath DESIGNABLE
true)
49 Q_PROPERTY(QString promptDialogTitle READ promptDialogTitle WRITE setPromptDialogTitle DESIGNABLE
true)
50 Q_PROPERTY(Kind expectedKind READ expectedKind WRITE setExpectedKind DESIGNABLE
true)
53 static const char *const browseButtonLabel
;
55 explicit PathChooser(QWidget
*parent
= 0);
56 virtual ~PathChooser();
65 // Default is <Directory>
66 void setExpectedKind(Kind expected
);
67 Kind
expectedKind() const;
69 void setPromptDialogTitle(const QString
&title
);
70 QString
promptDialogTitle() const;
72 void setPromptDialogFilter(const QString
&filter
);
73 QString
promptDialogFilter() const;
75 void setInitialBrowsePathBackup(const QString
&path
);
78 QString
errorMessage() const;
82 /** Returns the suggested label title when used in a form layout. */
83 static QString
label();
85 virtual bool validatePath(const QString
&path
, QString
*errorMessage
= 0);
87 /** Return the home directory, which needs some fixing under Windows. */
88 static QString
homePath();
90 void addButton(const QString
&text
, QObject
*receiver
, const char *slotFunc
);
91 QAbstractButton
*buttonAtIndex(int index
) const;
94 // Returns overridden title or the one from <title>
95 QString
makeDialogTitle(const QString
&title
);
99 void validChanged(bool validState
);
100 void changed(const QString
&text
);
101 void editingFinished();
102 void beforeBrowsing();
103 void browsingFinished();
104 void returnPressed();
107 void setPath(const QString
&);
113 PathChooserPrivate
*m_d
;
118 #endif // PATHCHOOSER_H