OSDN Git Service

Update license.
[qt-creator-jp/qt-creator-jp.git] / src / libs / utils / pathlisteditor.h
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
8 **
9 **
10 ** GNU Lesser General Public License Usage
11 **
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
15 ** Please review the following information to ensure the GNU Lesser General
16 ** Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 **
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 **
23 ** Other Usage
24 **
25 ** Alternatively, this file may be used in accordance with the terms and
26 ** conditions contained in a signed written agreement between you and Nokia.
27 **
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
30 **
31 **************************************************************************/
32
33 #ifndef PATHLISTEDITOR_H
34 #define PATHLISTEDITOR_H
35
36 #include "utils_global.h"
37
38 #include <QtGui/QWidget>
39 #include <QtCore/QStringList>
40
41 QT_BEGIN_NAMESPACE
42 class QAction;
43 QT_END_NAMESPACE
44
45 namespace Utils {
46
47 struct PathListEditorPrivate;
48
49 class QTCREATOR_UTILS_EXPORT PathListEditor : public QWidget
50 {
51     Q_DISABLE_COPY(PathListEditor)
52     Q_OBJECT
53     Q_PROPERTY(QStringList pathList READ pathList WRITE setPathList DESIGNABLE true)
54     Q_PROPERTY(QString fileDialogTitle READ fileDialogTitle WRITE setFileDialogTitle DESIGNABLE true)
55
56 public:
57     explicit PathListEditor(QWidget *parent = 0);
58     virtual ~PathListEditor();
59
60     QString pathListString() const;
61     QStringList pathList() const;
62     QString fileDialogTitle() const;
63
64     static QChar separator();
65
66     // Add a convenience action "Import from 'Path'" (environment variable)
67     void addEnvVariableImportAction(const QString &var);
68
69 public slots:
70     void clear();
71     void setPathList(const QStringList &l);
72     void setPathList(const QString &pathString);
73     void setPathListFromEnvVariable(const QString &var);
74     void setFileDialogTitle(const QString &l);
75
76 protected:
77     // Index after which to insert further "Add" actions
78     static int lastAddActionIndex();
79     QAction *insertAction(int index /* -1 */, const QString &text, QObject * receiver, const char *slotFunc);
80     QAction *addAction(const QString &text, QObject * receiver, const char *slotFunc);
81
82     QString text() const;
83     void setText(const QString &);
84
85 protected slots:
86     void insertPathAtCursor(const QString &);
87     void deletePathAtCursor();
88     void appendPath(const QString &);
89
90 private slots:
91     void slotAdd();
92     void slotInsert();
93
94 private:
95     PathListEditorPrivate *m_d;
96 };
97
98 } // namespace Utils
99
100 #endif // PATHLISTEDITOR_H