2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2009-01-12 17:44:04 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2009-01-12 17:44:04 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2009-01-12 17:44:04 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2009-01-12 17:44:04 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2010-12-17 16:01:08 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2009-01-12 17:44:04 +01:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2009-01-12 17:44:04 +01:00
|
|
|
|
|
|
|
|
#include "vcsbase_global.h"
|
|
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QStandardItemModel>
|
2009-01-12 17:44:04 +01:00
|
|
|
|
2015-03-11 17:52:26 +01:00
|
|
|
#include <functional>
|
|
|
|
|
|
2012-01-07 12:31:48 +01:00
|
|
|
namespace VcsBase {
|
2009-01-12 17:44:04 +01:00
|
|
|
|
2012-12-25 19:38:07 +02:00
|
|
|
enum CheckMode
|
|
|
|
|
{
|
|
|
|
|
Unchecked,
|
|
|
|
|
Checked,
|
|
|
|
|
Uncheckable
|
|
|
|
|
};
|
|
|
|
|
|
2009-01-12 17:44:04 +01:00
|
|
|
class VCSBASE_EXPORT SubmitFileModel : public QStandardItemModel
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
explicit SubmitFileModel(QObject *parent = 0);
|
|
|
|
|
|
2015-03-09 17:10:25 +01:00
|
|
|
const QString &repositoryRoot() const;
|
|
|
|
|
void setRepositoryRoot(const QString &repoRoot);
|
|
|
|
|
|
2009-01-13 10:06:06 +01:00
|
|
|
// Convenience to create and add rows containing a file plus status text.
|
2011-10-19 15:49:13 +00:00
|
|
|
QList<QStandardItem *> addFile(const QString &fileName, const QString &status = QString(),
|
2012-12-25 19:38:07 +02:00
|
|
|
CheckMode checkMode = Checked, const QVariant &data = QVariant());
|
2009-01-12 17:44:04 +01:00
|
|
|
|
2011-10-19 14:58:12 +00:00
|
|
|
QString state(int row) const;
|
|
|
|
|
QString file(int row) const;
|
2013-06-14 17:51:53 +03:00
|
|
|
bool isCheckable(int row) const;
|
2011-10-19 14:58:12 +00:00
|
|
|
bool checked(int row) const;
|
2012-12-25 18:27:38 +02:00
|
|
|
void setChecked(int row, bool check);
|
2013-01-02 22:19:04 +02:00
|
|
|
void setAllChecked(bool check);
|
2012-01-19 15:33:20 +01:00
|
|
|
QVariant extraData(int row) const;
|
2011-10-19 14:58:12 +00:00
|
|
|
|
|
|
|
|
bool hasCheckedFiles() const;
|
|
|
|
|
|
2009-01-12 17:44:04 +01:00
|
|
|
// Filter for entries contained in the filter list. Returns the
|
|
|
|
|
// number of deleted entries.
|
2013-01-02 22:19:04 +02:00
|
|
|
unsigned int filterFiles(const QStringList &filter);
|
2013-01-02 23:21:30 +02:00
|
|
|
|
|
|
|
|
virtual void updateSelections(SubmitFileModel *source);
|
2015-03-09 17:10:25 +01:00
|
|
|
|
2015-03-11 17:52:26 +01:00
|
|
|
enum FileStatusHint
|
|
|
|
|
{
|
|
|
|
|
FileStatusUnknown,
|
|
|
|
|
FileAdded,
|
|
|
|
|
FileModified,
|
|
|
|
|
FileDeleted,
|
|
|
|
|
FileRenamed
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Function that converts(qualifies) a QString/QVariant pair to FileStatusHint
|
|
|
|
|
// 1st arg is the file status string as passed to addFile()
|
|
|
|
|
// 2nd arg is the file extra data as passed to addFile()
|
|
|
|
|
typedef std::function<FileStatusHint (const QString &, const QVariant &)>
|
|
|
|
|
FileStatusQualifier;
|
|
|
|
|
|
|
|
|
|
const FileStatusQualifier &fileStatusQualifier() const;
|
|
|
|
|
void setFileStatusQualifier(FileStatusQualifier &&func);
|
|
|
|
|
|
2015-03-09 17:10:25 +01:00
|
|
|
private:
|
|
|
|
|
QString m_repositoryRoot;
|
2015-03-11 17:52:26 +01:00
|
|
|
FileStatusQualifier m_fileStatusQualifier;
|
2009-01-12 17:44:04 +01:00
|
|
|
};
|
|
|
|
|
|
2012-01-07 12:31:48 +01:00
|
|
|
} // namespace VcsBase
|