OSDN Git Service

Update license.
[qt-creator-jp/qt-creator-jp.git] / src / plugins / qt4projectmanager / qt-maemo / maemodeployablelistmodel.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 MAEMOPACKAGECONTENTS_H
34 #define MAEMOPACKAGECONTENTS_H
35
36 #include "maemodeployable.h"
37
38 #include <qt4projectmanager/qt4nodes.h>
39
40 #include <QtCore/QAbstractTableModel>
41 #include <QtCore/QHash>
42 #include <QtCore/QList>
43 #include <QtCore/QScopedPointer>
44 #include <QtCore/QString>
45
46 namespace Qt4ProjectManager {
47 class QtVersion;
48 namespace Internal {
49
50 class MaemoDeployableListModel : public QAbstractTableModel
51 {
52     Q_OBJECT
53 public:
54     enum ProFileUpdateSetting {
55         UpdateProFile, DontUpdateProFile, AskToUpdateProFile
56     };
57
58     MaemoDeployableListModel(const Qt4ProFileNode *proFileNode,
59         ProFileUpdateSetting updateSetting, QObject *parent);
60     ~MaemoDeployableListModel();
61
62     virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
63
64     MaemoDeployable deployableAt(int row) const;
65     bool isModified() const { return m_modified; }
66     void setUnModified() { m_modified = false; }
67     QString localExecutableFilePath() const;
68     QString remoteExecutableFilePath() const;
69     QString projectName() const { return m_projectName; }
70     QString projectDir() const;
71     QString proFilePath() const { return m_proFilePath; }
72     bool isApplicationProject() const { return m_projectType == ApplicationTemplate; }
73     QString applicationName() const { return m_targetInfo.target; }
74     bool hasTargetPath() const { return m_hasTargetPath; }
75     bool canAddDesktopFile() const { return isApplicationProject() && !hasDesktopFile(); }
76     QString localDesktopFilePath() const;
77     bool hasDesktopFile() const { return !localDesktopFilePath().isEmpty(); }
78     bool addDesktopFile(QString &error);
79     bool canAddIcon() const { return isApplicationProject() && remoteIconFilePath().isEmpty(); }
80     bool addIcon(const QString &fileName, QString &error);
81     QString remoteIconFilePath() const;
82     ProFileUpdateSetting proFileUpdateSetting() const {
83         return m_proFileUpdateSetting;
84     }
85     void setProFileUpdateSetting(ProFileUpdateSetting updateSetting);
86
87 private:
88     virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
89     virtual QVariant data(const QModelIndex &index,
90                           int role = Qt::DisplayRole) const;
91     virtual QVariant headerData(int section, Qt::Orientation orientation,
92                                 int role = Qt::DisplayRole) const;
93     virtual Qt::ItemFlags flags(const QModelIndex &index) const;
94     virtual bool setData(const QModelIndex &index, const QVariant &value,
95                          int role = Qt::EditRole);
96
97     bool isEditable(const QModelIndex &index) const;
98     bool buildModel();
99     bool addLinesToProFile(const QStringList &lines);
100     const QtVersion *qtVersion() const;
101     QString proFileScope() const;
102     QString installPrefix() const;
103
104     const Qt4ProjectType m_projectType;
105     const QString m_proFilePath;
106     const QString m_projectName;
107     const TargetInformation m_targetInfo;
108     const InstallsList m_installsList;
109     const QStringList m_config;
110     QList<MaemoDeployable> m_deployables;
111     mutable bool m_modified;
112     ProFileUpdateSetting m_proFileUpdateSetting;
113     bool m_hasTargetPath;
114 };
115
116 } // namespace Qt4ProjectManager
117 } // namespace Internal
118
119 #endif // MAEMOPACKAGECONTENTS_H