2011-02-28 13:40:06 +01:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Copyright (c) 2012 Hugues Delorme
|
|
|
|
|
** Contact: http://www.qt-project.org/legal
|
2011-02-28 13:40:06 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2011-02-28 13:40:06 +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
|
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
|
** use the contact form at http://qt.digia.com/contact-us.
|
2011-02-28 13:40:06 +01:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
2011-02-28 13:40:06 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2011-02-28 13:40:06 +01:00
|
|
|
#include "branchinfo.h"
|
|
|
|
|
#include "commiteditor.h"
|
|
|
|
|
#include "bazaarcommitwidget.h"
|
|
|
|
|
|
|
|
|
|
#include <vcsbase/submitfilemodel.h>
|
|
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QDebug>
|
2011-02-28 13:40:06 +01:00
|
|
|
|
|
|
|
|
#include <QDir> //TODO REMOVE WHEN BASE FILE CHANGES ARE PULLED
|
|
|
|
|
|
|
|
|
|
using namespace Bazaar::Internal;
|
|
|
|
|
|
2012-01-07 12:31:48 +01:00
|
|
|
CommitEditor::CommitEditor(const VcsBase::VcsBaseSubmitEditorParameters *parameters, QWidget *parent)
|
|
|
|
|
: VcsBase::VcsBaseSubmitEditor(parameters, new BazaarCommitWidget(parent)),
|
2011-11-10 16:06:19 +01:00
|
|
|
m_fileModel(0)
|
2011-02-28 13:40:06 +01:00
|
|
|
{
|
|
|
|
|
setDisplayName(tr("Commit Editor"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const BazaarCommitWidget *CommitEditor::commitWidget() const
|
|
|
|
|
{
|
2011-09-21 11:43:58 +02:00
|
|
|
CommitEditor *nonConstThis = const_cast<CommitEditor *>(this);
|
2011-02-28 13:40:06 +01:00
|
|
|
return static_cast<const BazaarCommitWidget *>(nonConstThis->widget());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BazaarCommitWidget *CommitEditor::commitWidget()
|
|
|
|
|
{
|
|
|
|
|
return static_cast<BazaarCommitWidget *>(widget());
|
|
|
|
|
}
|
|
|
|
|
|
2011-12-05 15:37:19 +01:00
|
|
|
void CommitEditor::setFields(const QString &repositoryRoot,
|
|
|
|
|
const BranchInfo &branch, const QString &userName,
|
2012-01-07 12:31:48 +01:00
|
|
|
const QString &email, const QList<VcsBase::VcsBaseClient::StatusItem> &repoStatus)
|
2011-02-28 13:40:06 +01:00
|
|
|
{
|
|
|
|
|
BazaarCommitWidget *bazaarWidget = commitWidget();
|
|
|
|
|
if (!bazaarWidget)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
bazaarWidget->setFields(branch, userName, email);
|
|
|
|
|
|
2012-01-07 12:31:48 +01:00
|
|
|
m_fileModel = new VcsBase::SubmitFileModel(this);
|
|
|
|
|
foreach (const VcsBase::VcsBaseClient::StatusItem &item, repoStatus)
|
2011-08-22 15:33:03 +00:00
|
|
|
if (item.flags != QLatin1String("Unknown"))
|
|
|
|
|
m_fileModel->addFile(item.file, item.flags, true);
|
2011-12-05 15:37:19 +01:00
|
|
|
setFileModel(m_fileModel, repositoryRoot);
|
2011-02-28 13:40:06 +01:00
|
|
|
}
|