forked from qt-creator/qt-creator
VCS: Use SubmitFileModel in SubmitEditorWidget
Much cleaner Change-Id: I090e5d04e5afae1023fa58eca1ef416ddc069165 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
committed by
Tobias Hunger
parent
34db64c752
commit
01084aaa38
@@ -131,10 +131,9 @@ void GitSubmitEditor::slotDiffSelected(const QStringList &files)
|
|||||||
QStringList unmergedFiles;
|
QStringList unmergedFiles;
|
||||||
QStringList unstagedFiles;
|
QStringList unstagedFiles;
|
||||||
QStringList stagedFiles;
|
QStringList stagedFiles;
|
||||||
const int fileColumn = fileNameColumn();
|
|
||||||
const int rowCount = m_model->rowCount();
|
const int rowCount = m_model->rowCount();
|
||||||
for (int r = 0; r < rowCount; r++) {
|
for (int r = 0; r < rowCount; r++) {
|
||||||
const QString fileName = m_model->item(r, fileColumn)->text();
|
const QString fileName = m_model->file(r);
|
||||||
if (files.contains(fileName)) {
|
if (files.contains(fileName)) {
|
||||||
const FileStates state = static_cast<FileStates>(m_model->extraData(r).toInt());
|
const FileStates state = static_cast<FileStates>(m_model->extraData(r).toInt());
|
||||||
if (state & UnmergedFile)
|
if (state & UnmergedFile)
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ bool PerforceSubmitEditor::parseText(QString text)
|
|||||||
|
|
||||||
void PerforceSubmitEditor::restrictToProjectFiles(const QStringList &knownProjectFiles)
|
void PerforceSubmitEditor::restrictToProjectFiles(const QStringList &knownProjectFiles)
|
||||||
{
|
{
|
||||||
m_fileModel->filter(knownProjectFiles, fileNameColumn());
|
m_fileModel->filterFiles(knownProjectFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerforceSubmitEditor::updateFields()
|
void PerforceSubmitEditor::updateFields()
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
#include "submiteditorwidget.h"
|
#include "submiteditorwidget.h"
|
||||||
#include "submitfieldwidget.h"
|
#include "submitfieldwidget.h"
|
||||||
|
#include "submitfilemodel.h"
|
||||||
#include "ui_submiteditorwidget.h"
|
#include "ui_submiteditorwidget.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
@@ -46,8 +47,6 @@
|
|||||||
enum { debug = 0 };
|
enum { debug = 0 };
|
||||||
enum { defaultLineWidth = 72 };
|
enum { defaultLineWidth = 72 };
|
||||||
|
|
||||||
enum { checkableColumn = 0 };
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class VcsBase::SubmitEditorWidget
|
\class VcsBase::SubmitEditorWidget
|
||||||
|
|
||||||
@@ -55,8 +54,8 @@ enum { checkableColumn = 0 };
|
|||||||
checkable list of modified files in a list window.
|
checkable list of modified files in a list window.
|
||||||
|
|
||||||
The user can delete files from the list by unchecking them or diff the selection
|
The user can delete files from the list by unchecking them or diff the selection
|
||||||
by doubleclicking. A list model which contains the file in a column
|
by doubleclicking. A list model which contains state and file columns should be
|
||||||
specified by fileNameColumn should be set using setFileModel().
|
set using setFileModel().
|
||||||
|
|
||||||
Additionally, standard creator actions can be registered:
|
Additionally, standard creator actions can be registered:
|
||||||
Undo/redo will be set up to work with the description editor.
|
Undo/redo will be set up to work with the description editor.
|
||||||
@@ -117,28 +116,6 @@ public slots:
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Helpers to retrieve model data
|
// Helpers to retrieve model data
|
||||||
static inline bool listModelChecked(const QAbstractItemModel *model, int row, int column = 0)
|
|
||||||
{
|
|
||||||
const QModelIndex checkableIndex = model->index(row, column, QModelIndex());
|
|
||||||
return model->data(checkableIndex, Qt::CheckStateRole).toInt() == Qt::Checked;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void setListModelChecked(QAbstractItemModel *model, bool checked, int column = 0)
|
|
||||||
{
|
|
||||||
const QVariant data = QVariant(int(checked ? Qt::Checked : Qt::Unchecked));
|
|
||||||
const int count = model->rowCount();
|
|
||||||
for (int i = 0; i < count; i++) {
|
|
||||||
const QModelIndex checkableIndex = model->index(i, column, QModelIndex());
|
|
||||||
model->setData(checkableIndex, data, Qt::CheckStateRole);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline QString listModelText(const QAbstractItemModel *model, int row, int column)
|
|
||||||
{
|
|
||||||
const QModelIndex index = model->index(row, column, QModelIndex());
|
|
||||||
return model->data(index, Qt::DisplayRole).toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convenience to extract a list of selected indexes
|
// Convenience to extract a list of selected indexes
|
||||||
QList<int> selectedRows(const QAbstractItemView *view)
|
QList<int> selectedRows(const QAbstractItemView *view)
|
||||||
{
|
{
|
||||||
@@ -163,7 +140,6 @@ struct SubmitEditorWidgetPrivate
|
|||||||
|
|
||||||
Ui::SubmitEditorWidget m_ui;
|
Ui::SubmitEditorWidget m_ui;
|
||||||
bool m_filesSelected;
|
bool m_filesSelected;
|
||||||
int m_fileNameColumn;
|
|
||||||
int m_activatedRow;
|
int m_activatedRow;
|
||||||
bool m_emptyFileListEnabled;
|
bool m_emptyFileListEnabled;
|
||||||
|
|
||||||
@@ -180,7 +156,6 @@ struct SubmitEditorWidgetPrivate
|
|||||||
|
|
||||||
SubmitEditorWidgetPrivate::SubmitEditorWidgetPrivate() :
|
SubmitEditorWidgetPrivate::SubmitEditorWidgetPrivate() :
|
||||||
m_filesSelected(false),
|
m_filesSelected(false),
|
||||||
m_fileNameColumn(1),
|
|
||||||
m_activatedRow(-1),
|
m_activatedRow(-1),
|
||||||
m_emptyFileListEnabled(false),
|
m_emptyFileListEnabled(false),
|
||||||
m_fieldLayout(0),
|
m_fieldLayout(0),
|
||||||
@@ -242,9 +217,8 @@ void SubmitEditorWidget::registerActions(QAction *editorUndoAction, QAction *edi
|
|||||||
|
|
||||||
if (submitAction) {
|
if (submitAction) {
|
||||||
if (debug) {
|
if (debug) {
|
||||||
int count = 0;
|
const SubmitFileModel *model = fileModel();
|
||||||
if (const QAbstractItemModel *model = d->m_ui.fileView->model())
|
int count = model ? model->rowCount() : 0;
|
||||||
count = model->rowCount();
|
|
||||||
qDebug() << Q_FUNC_INFO << submitAction << count << "items";
|
qDebug() << Q_FUNC_INFO << submitAction << count << "items";
|
||||||
}
|
}
|
||||||
d->m_commitEnabled = !canSubmit();
|
d->m_commitEnabled = !canSubmit();
|
||||||
@@ -385,16 +359,6 @@ void SubmitEditorWidget::setDescriptionMandatory(bool v)
|
|||||||
d->m_descriptionMandatory = v;
|
d->m_descriptionMandatory = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SubmitEditorWidget::fileNameColumn() const
|
|
||||||
{
|
|
||||||
return d->m_fileNameColumn;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SubmitEditorWidget::setFileNameColumn(int c)
|
|
||||||
{
|
|
||||||
d->m_fileNameColumn = c;
|
|
||||||
}
|
|
||||||
|
|
||||||
QAbstractItemView::SelectionMode SubmitEditorWidget::fileListSelectionMode() const
|
QAbstractItemView::SelectionMode SubmitEditorWidget::fileListSelectionMode() const
|
||||||
{
|
{
|
||||||
return d->m_ui.fileView->selectionMode();
|
return d->m_ui.fileView->selectionMode();
|
||||||
@@ -405,7 +369,7 @@ void SubmitEditorWidget::setFileListSelectionMode(QAbstractItemView::SelectionMo
|
|||||||
d->m_ui.fileView->setSelectionMode(sm);
|
d->m_ui.fileView->setSelectionMode(sm);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SubmitEditorWidget::setFileModel(QAbstractItemModel *model)
|
void SubmitEditorWidget::setFileModel(SubmitFileModel *model)
|
||||||
{
|
{
|
||||||
d->m_ui.fileView->clearSelection(); // trigger the change signals
|
d->m_ui.fileView->clearSelection(); // trigger the change signals
|
||||||
|
|
||||||
@@ -434,9 +398,9 @@ void SubmitEditorWidget::setFileModel(QAbstractItemModel *model)
|
|||||||
updateActions();
|
updateActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
QAbstractItemModel *SubmitEditorWidget::fileModel() const
|
SubmitFileModel *SubmitEditorWidget::fileModel() const
|
||||||
{
|
{
|
||||||
return d->m_ui.fileView->model();
|
return static_cast<SubmitFileModel *>(d->m_ui.fileView->model());
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList SubmitEditorWidget::selectedFiles() const
|
QStringList SubmitEditorWidget::selectedFiles() const
|
||||||
@@ -446,23 +410,23 @@ QStringList SubmitEditorWidget::selectedFiles() const
|
|||||||
return QStringList();
|
return QStringList();
|
||||||
|
|
||||||
QStringList rc;
|
QStringList rc;
|
||||||
const QAbstractItemModel *model = d->m_ui.fileView->model();
|
const SubmitFileModel *model = fileModel();
|
||||||
const int count = selection.size();
|
const int count = selection.size();
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
rc.push_back(listModelText(model, selection.at(i), fileNameColumn()));
|
rc.push_back(model->file(selection.at(i)));
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList SubmitEditorWidget::checkedFiles() const
|
QStringList SubmitEditorWidget::checkedFiles() const
|
||||||
{
|
{
|
||||||
QStringList rc;
|
QStringList rc;
|
||||||
const QAbstractItemModel *model = d->m_ui.fileView->model();
|
const SubmitFileModel *model = fileModel();
|
||||||
if (!model)
|
if (!model)
|
||||||
return rc;
|
return rc;
|
||||||
const int count = model->rowCount();
|
const int count = model->rowCount();
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
if (listModelChecked(model, i, checkableColumn))
|
if (model->checked(i))
|
||||||
rc.push_back(listModelText(model, i, fileNameColumn()));
|
rc.push_back(model->file(i));
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -480,7 +444,7 @@ void SubmitEditorWidget::triggerDiffSelected()
|
|||||||
|
|
||||||
void SubmitEditorWidget::diffActivatedDelayed()
|
void SubmitEditorWidget::diffActivatedDelayed()
|
||||||
{
|
{
|
||||||
const QStringList files = QStringList(listModelText(d->m_ui.fileView->model(), d->m_activatedRow, fileNameColumn()));
|
const QStringList files = QStringList(fileModel()->file(d->m_activatedRow));
|
||||||
emit diffSelected(files);
|
emit diffSelected(files);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -554,10 +518,10 @@ bool SubmitEditorWidget::hasSelection() const
|
|||||||
int SubmitEditorWidget::checkedFilesCount() const
|
int SubmitEditorWidget::checkedFilesCount() const
|
||||||
{
|
{
|
||||||
int checkedCount = 0;
|
int checkedCount = 0;
|
||||||
if (const QAbstractItemModel *model = d->m_ui.fileView->model()) {
|
if (const SubmitFileModel *model = fileModel()) {
|
||||||
const int count = model->rowCount();
|
const int count = model->rowCount();
|
||||||
for (int i = 0; i < count; ++i)
|
for (int i = 0; i < count; ++i)
|
||||||
if (listModelChecked(model, i, checkableColumn))
|
if (model->checked(i))
|
||||||
++checkedCount;
|
++checkedCount;
|
||||||
}
|
}
|
||||||
return checkedCount;
|
return checkedCount;
|
||||||
@@ -662,24 +626,20 @@ void SubmitEditorWidget::checkAllToggled()
|
|||||||
{
|
{
|
||||||
if (d->m_ignoreChange)
|
if (d->m_ignoreChange)
|
||||||
return;
|
return;
|
||||||
if (d->m_ui.checkAllCheckBox->checkState() == Qt::Checked
|
Qt::CheckState checkState = d->m_ui.checkAllCheckBox->checkState();
|
||||||
|| d->m_ui.checkAllCheckBox->checkState() == Qt::PartiallyChecked) {
|
fileModel()->setAllChecked(checkState == Qt::Checked || checkState == Qt::PartiallyChecked);
|
||||||
setListModelChecked(d->m_ui.fileView->model(), true, checkableColumn);
|
|
||||||
} else {
|
|
||||||
setListModelChecked(d->m_ui.fileView->model(), false, checkableColumn);
|
|
||||||
}
|
|
||||||
// Reset that again, so that the user can't do it
|
// Reset that again, so that the user can't do it
|
||||||
d->m_ui.checkAllCheckBox->setTristate(false);
|
d->m_ui.checkAllCheckBox->setTristate(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SubmitEditorWidget::checkAll()
|
void SubmitEditorWidget::checkAll()
|
||||||
{
|
{
|
||||||
setListModelChecked(d->m_ui.fileView->model(), true, checkableColumn);
|
fileModel()->setAllChecked(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SubmitEditorWidget::uncheckAll()
|
void SubmitEditorWidget::uncheckAll()
|
||||||
{
|
{
|
||||||
setListModelChecked(d->m_ui.fileView->model(), false, checkableColumn);
|
fileModel()->setAllChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SubmitEditorWidget::fileListCustomContextMenuRequested(const QPoint & pos)
|
void SubmitEditorWidget::fileListCustomContextMenuRequested(const QPoint & pos)
|
||||||
|
|||||||
@@ -38,23 +38,20 @@
|
|||||||
#include <QAbstractItemView>
|
#include <QAbstractItemView>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QListWidgetItem;
|
|
||||||
class QAction;
|
class QAction;
|
||||||
class QAbstractItemModel;
|
|
||||||
class QModelIndex;
|
class QModelIndex;
|
||||||
class QLineEdit;
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace VcsBase {
|
namespace VcsBase {
|
||||||
|
|
||||||
class SubmitFieldWidget;
|
class SubmitFieldWidget;
|
||||||
struct SubmitEditorWidgetPrivate;
|
struct SubmitEditorWidgetPrivate;
|
||||||
|
class SubmitFileModel;
|
||||||
|
|
||||||
class VCSBASE_EXPORT SubmitEditorWidget : public QWidget
|
class VCSBASE_EXPORT SubmitEditorWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(QString descriptionText READ descriptionText WRITE setDescriptionText DESIGNABLE true)
|
Q_PROPERTY(QString descriptionText READ descriptionText WRITE setDescriptionText DESIGNABLE true)
|
||||||
Q_PROPERTY(int fileNameColumn READ fileNameColumn WRITE setFileNameColumn DESIGNABLE false)
|
|
||||||
Q_PROPERTY(QAbstractItemView::SelectionMode fileListSelectionMode READ fileListSelectionMode WRITE setFileListSelectionMode DESIGNABLE true)
|
Q_PROPERTY(QAbstractItemView::SelectionMode fileListSelectionMode READ fileListSelectionMode WRITE setFileListSelectionMode DESIGNABLE true)
|
||||||
Q_PROPERTY(bool lineWrap READ lineWrap WRITE setLineWrap DESIGNABLE true)
|
Q_PROPERTY(bool lineWrap READ lineWrap WRITE setLineWrap DESIGNABLE true)
|
||||||
Q_PROPERTY(int lineWrapWidth READ lineWrapWidth WRITE setLineWrapWidth DESIGNABLE true)
|
Q_PROPERTY(int lineWrapWidth READ lineWrapWidth WRITE setLineWrapWidth DESIGNABLE true)
|
||||||
@@ -80,9 +77,6 @@ public:
|
|||||||
bool isEmptyFileListEnabled() const;
|
bool isEmptyFileListEnabled() const;
|
||||||
void setEmptyFileListEnabled(bool e);
|
void setEmptyFileListEnabled(bool e);
|
||||||
|
|
||||||
int fileNameColumn() const;
|
|
||||||
void setFileNameColumn(int c);
|
|
||||||
|
|
||||||
bool lineWrap() const;
|
bool lineWrap() const;
|
||||||
void setLineWrap(bool);
|
void setLineWrap(bool);
|
||||||
|
|
||||||
@@ -95,8 +89,8 @@ public:
|
|||||||
QAbstractItemView::SelectionMode fileListSelectionMode() const;
|
QAbstractItemView::SelectionMode fileListSelectionMode() const;
|
||||||
void setFileListSelectionMode(QAbstractItemView::SelectionMode sm);
|
void setFileListSelectionMode(QAbstractItemView::SelectionMode sm);
|
||||||
|
|
||||||
void setFileModel(QAbstractItemModel *model);
|
void setFileModel(SubmitFileModel *model);
|
||||||
QAbstractItemModel *fileModel() const;
|
SubmitFileModel *fileModel() const;
|
||||||
|
|
||||||
// Files to be included in submit
|
// Files to be included in submit
|
||||||
QStringList checkedFiles() const;
|
QStringList checkedFiles() const;
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ namespace VcsBase {
|
|||||||
// Helpers:
|
// Helpers:
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
enum { fileColumn = 1 };
|
||||||
|
|
||||||
static QList<QStandardItem *> createFileRow(const QString &fileName, const QString &status,
|
static QList<QStandardItem *> createFileRow(const QString &fileName, const QString &status,
|
||||||
CheckMode checked, const QVariant &v)
|
CheckMode checked, const QVariant &v)
|
||||||
{
|
{
|
||||||
@@ -87,15 +89,6 @@ QList<QStandardItem *> SubmitFileModel::addFile(const QString &fileName, const Q
|
|||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QStandardItem *> SubmitFileModel::rowAt(int row) const
|
|
||||||
{
|
|
||||||
const int colCount = columnCount();
|
|
||||||
QList<QStandardItem *> rc;
|
|
||||||
for (int c = 0; c < colCount; c++)
|
|
||||||
rc.push_back(item(row, c));
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString SubmitFileModel::state(int row) const
|
QString SubmitFileModel::state(int row) const
|
||||||
{
|
{
|
||||||
if (row < 0 || row >= rowCount())
|
if (row < 0 || row >= rowCount())
|
||||||
@@ -107,7 +100,7 @@ QString SubmitFileModel::file(int row) const
|
|||||||
{
|
{
|
||||||
if (row < 0 || row >= rowCount())
|
if (row < 0 || row >= rowCount())
|
||||||
return QString();
|
return QString();
|
||||||
return item(row, 1)->text();
|
return item(row, fileColumn)->text();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SubmitFileModel::checked(int row) const
|
bool SubmitFileModel::checked(int row) const
|
||||||
@@ -123,6 +116,13 @@ void SubmitFileModel::setChecked(int row, bool check)
|
|||||||
item(row)->setCheckState(check ? Qt::Checked : Qt::Unchecked);
|
item(row)->setCheckState(check ? Qt::Checked : Qt::Unchecked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SubmitFileModel::setAllChecked(bool check)
|
||||||
|
{
|
||||||
|
int rows = rowCount();
|
||||||
|
for (int row = 0; row < rows; ++row)
|
||||||
|
item(row)->setCheckState(check ? Qt::Checked : Qt::Unchecked);
|
||||||
|
}
|
||||||
|
|
||||||
QVariant SubmitFileModel::extraData(int row) const
|
QVariant SubmitFileModel::extraData(int row) const
|
||||||
{
|
{
|
||||||
if (row < 0 || row >= rowCount())
|
if (row < 0 || row >= rowCount())
|
||||||
@@ -139,25 +139,14 @@ bool SubmitFileModel::hasCheckedFiles() const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QStandardItem *> SubmitFileModel::findRow(const QString &text, int column) const
|
unsigned int SubmitFileModel::filterFiles(const QStringList &filter)
|
||||||
{
|
{
|
||||||
// Single item
|
unsigned int rc = 0;
|
||||||
const QList<QStandardItem *> items = findItems(text, Qt::MatchExactly, column);
|
|
||||||
if (items.empty())
|
|
||||||
return items;
|
|
||||||
// Compile row
|
|
||||||
return rowAt(items.front()->row());
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned SubmitFileModel::filter(const QStringList &filter, int column)
|
|
||||||
{
|
|
||||||
unsigned rc = 0;
|
|
||||||
for (int r = rowCount() - 1; r >= 0; r--)
|
for (int r = rowCount() - 1; r >= 0; r--)
|
||||||
if (const QStandardItem *i = item(r, column))
|
if (!filter.contains(file(r))) {
|
||||||
if (!filter.contains(i->text())) {
|
removeRow(r);
|
||||||
qDeleteAll(takeRow(r));
|
rc++;
|
||||||
rc++;
|
}
|
||||||
}
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,23 +53,18 @@ public:
|
|||||||
QList<QStandardItem *> addFile(const QString &fileName, const QString &status = QString(),
|
QList<QStandardItem *> addFile(const QString &fileName, const QString &status = QString(),
|
||||||
CheckMode checkMode = Checked, const QVariant &data = QVariant());
|
CheckMode checkMode = Checked, const QVariant &data = QVariant());
|
||||||
|
|
||||||
// Find convenience that returns the whole row (as opposed to QStandardItemModel::find).
|
|
||||||
QList<QStandardItem *> findRow(const QString &text, int column = 0) const;
|
|
||||||
|
|
||||||
// Convenience to obtain a row
|
|
||||||
QList<QStandardItem *> rowAt(int row) const;
|
|
||||||
|
|
||||||
QString state(int row) const;
|
QString state(int row) const;
|
||||||
QString file(int row) const;
|
QString file(int row) const;
|
||||||
bool checked(int row) const;
|
bool checked(int row) const;
|
||||||
void setChecked(int row, bool check);
|
void setChecked(int row, bool check);
|
||||||
|
void setAllChecked(bool check);
|
||||||
QVariant extraData(int row) const;
|
QVariant extraData(int row) const;
|
||||||
|
|
||||||
bool hasCheckedFiles() const;
|
bool hasCheckedFiles() const;
|
||||||
|
|
||||||
// Filter for entries contained in the filter list. Returns the
|
// Filter for entries contained in the filter list. Returns the
|
||||||
// number of deleted entries.
|
// number of deleted entries.
|
||||||
unsigned filter(const QStringList &filter, int column);
|
unsigned int filterFiles(const QStringList &filter);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace VcsBase
|
} // namespace VcsBase
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#include "submiteditorfile.h"
|
#include "submiteditorfile.h"
|
||||||
#include "submiteditorwidget.h"
|
#include "submiteditorwidget.h"
|
||||||
#include "submitfieldwidget.h"
|
#include "submitfieldwidget.h"
|
||||||
|
#include "submitfilemodel.h"
|
||||||
#include "vcsbaseoutputwindow.h"
|
#include "vcsbaseoutputwindow.h"
|
||||||
#include "vcsplugin.h"
|
#include "vcsplugin.h"
|
||||||
|
|
||||||
@@ -318,16 +319,6 @@ void VcsBaseSubmitEditor::unregisterActions(QAction *editorUndoAction, QAction
|
|||||||
d->m_diffAction = d->m_submitAction = 0;
|
d->m_diffAction = d->m_submitAction = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int VcsBaseSubmitEditor::fileNameColumn() const
|
|
||||||
{
|
|
||||||
return d->m_widget->fileNameColumn();
|
|
||||||
}
|
|
||||||
|
|
||||||
void VcsBaseSubmitEditor::setFileNameColumn(int c)
|
|
||||||
{
|
|
||||||
d->m_widget->setFileNameColumn(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
QAbstractItemView::SelectionMode VcsBaseSubmitEditor::fileListSelectionMode() const
|
QAbstractItemView::SelectionMode VcsBaseSubmitEditor::fileListSelectionMode() const
|
||||||
{
|
{
|
||||||
return d->m_widget->fileListSelectionMode();
|
return d->m_widget->fileListSelectionMode();
|
||||||
@@ -486,7 +477,7 @@ QStringList VcsBaseSubmitEditor::checkedFiles() const
|
|||||||
return d->m_widget->checkedFiles();
|
return d->m_widget->checkedFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VcsBaseSubmitEditor::setFileModel(QAbstractItemModel *m, const QString &repositoryDirectory)
|
void VcsBaseSubmitEditor::setFileModel(SubmitFileModel *m, const QString &repositoryDirectory)
|
||||||
{
|
{
|
||||||
d->m_widget->setFileModel(m);
|
d->m_widget->setFileModel(m);
|
||||||
|
|
||||||
@@ -495,8 +486,7 @@ void VcsBaseSubmitEditor::setFileModel(QAbstractItemModel *m, const QString &rep
|
|||||||
|
|
||||||
// Iterate over the files and get interesting symbols
|
// Iterate over the files and get interesting symbols
|
||||||
for (int row = 0; row < m->rowCount(); ++row) {
|
for (int row = 0; row < m->rowCount(); ++row) {
|
||||||
const QString fileName = m->data(m->index(row, d->m_widget->fileNameColumn())).toString();
|
const QFileInfo fileInfo(repositoryDirectory, m->file(row));
|
||||||
const QFileInfo fileInfo(repositoryDirectory, fileName);
|
|
||||||
|
|
||||||
// Add file name
|
// Add file name
|
||||||
uniqueSymbols.insert(fileInfo.fileName());
|
uniqueSymbols.insert(fileInfo.fileName());
|
||||||
@@ -539,7 +529,7 @@ void VcsBaseSubmitEditor::setFileModel(QAbstractItemModel *m, const QString &rep
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QAbstractItemModel *VcsBaseSubmitEditor::fileModel() const
|
SubmitFileModel *VcsBaseSubmitEditor::fileModel() const
|
||||||
{
|
{
|
||||||
return d->m_widget->fileModel();
|
return d->m_widget->fileModel();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,6 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QIcon;
|
class QIcon;
|
||||||
class QAbstractItemModel;
|
|
||||||
class QAction;
|
class QAction;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
@@ -48,6 +47,7 @@ namespace Internal {
|
|||||||
}
|
}
|
||||||
struct VcsBaseSubmitEditorPrivate;
|
struct VcsBaseSubmitEditorPrivate;
|
||||||
class SubmitEditorWidget;
|
class SubmitEditorWidget;
|
||||||
|
class SubmitFileModel;
|
||||||
|
|
||||||
class VCSBASE_EXPORT VcsBaseSubmitEditorParameters
|
class VCSBASE_EXPORT VcsBaseSubmitEditorParameters
|
||||||
{
|
{
|
||||||
@@ -61,7 +61,6 @@ public:
|
|||||||
class VCSBASE_EXPORT VcsBaseSubmitEditor : public Core::IEditor
|
class VCSBASE_EXPORT VcsBaseSubmitEditor : public Core::IEditor
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(int fileNameColumn READ fileNameColumn WRITE setFileNameColumn DESIGNABLE false)
|
|
||||||
Q_PROPERTY(QAbstractItemView::SelectionMode fileListSelectionMode READ fileListSelectionMode WRITE setFileListSelectionMode DESIGNABLE true)
|
Q_PROPERTY(QAbstractItemView::SelectionMode fileListSelectionMode READ fileListSelectionMode WRITE setFileListSelectionMode DESIGNABLE true)
|
||||||
Q_PROPERTY(bool lineWrap READ lineWrap WRITE setLineWrap DESIGNABLE true)
|
Q_PROPERTY(bool lineWrap READ lineWrap WRITE setLineWrap DESIGNABLE true)
|
||||||
Q_PROPERTY(int lineWrapWidth READ lineWrapWidth WRITE setLineWrapWidth DESIGNABLE true)
|
Q_PROPERTY(int lineWrapWidth READ lineWrapWidth WRITE setLineWrapWidth DESIGNABLE true)
|
||||||
@@ -94,9 +93,6 @@ public:
|
|||||||
bool forcePrompt = false,
|
bool forcePrompt = false,
|
||||||
bool canCommitOnFailure = true) const;
|
bool canCommitOnFailure = true) const;
|
||||||
|
|
||||||
int fileNameColumn() const;
|
|
||||||
void setFileNameColumn(int c);
|
|
||||||
|
|
||||||
QAbstractItemView::SelectionMode fileListSelectionMode() const;
|
QAbstractItemView::SelectionMode fileListSelectionMode() const;
|
||||||
void setFileListSelectionMode(QAbstractItemView::SelectionMode sm);
|
void setFileListSelectionMode(QAbstractItemView::SelectionMode sm);
|
||||||
|
|
||||||
@@ -131,8 +127,8 @@ public:
|
|||||||
|
|
||||||
QStringList checkedFiles() const;
|
QStringList checkedFiles() const;
|
||||||
|
|
||||||
void setFileModel(QAbstractItemModel *m, const QString &repositoryDirectory = QString());
|
void setFileModel(SubmitFileModel *m, const QString &repositoryDirectory = QString());
|
||||||
QAbstractItemModel *fileModel() const;
|
SubmitFileModel *fileModel() const;
|
||||||
virtual void updateFileModel() { }
|
virtual void updateFileModel() { }
|
||||||
|
|
||||||
// Utilities returning some predefined icons for actions
|
// Utilities returning some predefined icons for actions
|
||||||
|
|||||||
Reference in New Issue
Block a user