2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2009-07-15 12:28:40 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2009-07-15 12:28:40 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2009-07-15 12:28:40 +02: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-07-15 12:28:40 +02: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-07-15 12:28:40 +02:00
|
|
|
|
|
|
|
|
#include "cvssettings.h"
|
|
|
|
|
|
2021-03-16 16:55:02 +01:00
|
|
|
#include <coreplugin/icore.h>
|
2012-08-21 14:45:42 +03:00
|
|
|
|
2021-03-16 16:55:02 +01:00
|
|
|
#include <utils/layoutbuilder.h>
|
|
|
|
|
#include <utils/pathchooser.h>
|
|
|
|
|
|
|
|
|
|
#include <vcsbase/vcsbaseconstants.h>
|
|
|
|
|
|
|
|
|
|
using namespace Utils;
|
|
|
|
|
using namespace VcsBase;
|
2009-07-15 12:28:40 +02:00
|
|
|
|
2012-01-07 16:55:09 +01:00
|
|
|
namespace Cvs {
|
2010-04-12 16:34:21 +02:00
|
|
|
namespace Internal {
|
2009-07-15 12:28:40 +02:00
|
|
|
|
2021-03-16 16:55:02 +01:00
|
|
|
// CvsSettings
|
2009-07-15 12:28:40 +02:00
|
|
|
|
2013-10-15 20:03:22 +02:00
|
|
|
CvsSettings::CvsSettings()
|
2009-07-15 12:28:40 +02:00
|
|
|
{
|
2021-03-16 16:55:02 +01:00
|
|
|
setSettingsGroup("CVS");
|
2009-07-15 12:28:40 +02:00
|
|
|
|
2021-03-16 16:55:02 +01:00
|
|
|
registerAspect(&binaryPath);
|
|
|
|
|
binaryPath.setDefaultValue("cvs" QTC_HOST_EXE_SUFFIX);
|
|
|
|
|
binaryPath.setDisplayStyle(StringAspect::PathChooserDisplay);
|
|
|
|
|
binaryPath.setExpectedKind(PathChooser::ExistingCommand);
|
|
|
|
|
binaryPath.setHistoryCompleter(QLatin1String("Cvs.Command.History"));
|
|
|
|
|
binaryPath.setDisplayName(tr("CVS Command"));
|
|
|
|
|
binaryPath.setLabelText(tr("CVS command:"));
|
|
|
|
|
|
|
|
|
|
registerAspect(&cvsRoot);
|
|
|
|
|
cvsRoot.setDisplayStyle(StringAspect::LineEditDisplay);
|
|
|
|
|
cvsRoot.setSettingsKey("Root");
|
|
|
|
|
cvsRoot.setLabelText(tr("CVS root:"));
|
|
|
|
|
|
|
|
|
|
registerAspect(&diffOptions);
|
|
|
|
|
diffOptions.setDisplayStyle(StringAspect::LineEditDisplay);
|
|
|
|
|
diffOptions.setSettingsKey("DiffOptions");
|
|
|
|
|
diffOptions.setDefaultValue("-du");
|
|
|
|
|
diffOptions.setLabelText("Diff options:");
|
|
|
|
|
|
|
|
|
|
registerAspect(&describeByCommitId);
|
|
|
|
|
describeByCommitId.setSettingsKey("DescribeByCommitId");
|
|
|
|
|
describeByCommitId.setDefaultValue(true);
|
|
|
|
|
describeByCommitId.setLabelText(tr("Describe all files matching commit id"));
|
|
|
|
|
describeByCommitId.setToolTip(tr("When checked, all files touched by a commit will be "
|
|
|
|
|
"displayed when clicking on a revision number in the annotation view "
|
|
|
|
|
"(retrieved via commit ID). Otherwise, only the respective file will be displayed."));
|
|
|
|
|
|
|
|
|
|
registerAspect(&diffIgnoreWhiteSpace);
|
|
|
|
|
diffIgnoreWhiteSpace.setSettingsKey("DiffIgnoreWhiteSpace");
|
|
|
|
|
|
|
|
|
|
registerAspect(&diffIgnoreBlankLines);
|
|
|
|
|
diffIgnoreBlankLines.setSettingsKey("DiffIgnoreBlankLines");
|
2009-07-15 12:28:40 +02:00
|
|
|
}
|
|
|
|
|
|
2012-01-07 16:55:09 +01:00
|
|
|
QStringList CvsSettings::addOptions(const QStringList &args) const
|
2009-07-15 12:28:40 +02:00
|
|
|
{
|
2021-03-16 16:55:02 +01:00
|
|
|
const QString cvsRoot = this->cvsRoot.value();
|
2009-07-15 12:28:40 +02:00
|
|
|
if (cvsRoot.isEmpty())
|
|
|
|
|
return args;
|
|
|
|
|
|
|
|
|
|
QStringList rc;
|
|
|
|
|
rc.push_back(QLatin1String("-d"));
|
|
|
|
|
rc.push_back(cvsRoot);
|
|
|
|
|
rc.append(args);
|
|
|
|
|
return rc;
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-16 16:55:02 +01:00
|
|
|
// CvsSettingsPage
|
|
|
|
|
|
|
|
|
|
class CvsSettingsPageWidget final : public Core::IOptionsPageWidget
|
|
|
|
|
{
|
|
|
|
|
Q_DECLARE_TR_FUNCTIONS(Cvs::Internal::SettingsPageWidget)
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
CvsSettingsPageWidget(const std::function<void()> & onApply, CvsSettings *settings);
|
|
|
|
|
|
|
|
|
|
void apply() final;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
std::function<void()> m_onApply;
|
|
|
|
|
CvsSettings *m_settings;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
CvsSettingsPageWidget::CvsSettingsPageWidget(const std::function<void()> &onApply, CvsSettings *settings)
|
|
|
|
|
: m_onApply(onApply), m_settings(settings)
|
|
|
|
|
{
|
|
|
|
|
CvsSettings &s = *settings;
|
|
|
|
|
using namespace Layouting;
|
|
|
|
|
|
|
|
|
|
Column {
|
|
|
|
|
Group {
|
|
|
|
|
Title(tr("Configuration")),
|
|
|
|
|
Form {
|
2021-03-23 10:38:16 +01:00
|
|
|
s.binaryPath,
|
2021-03-16 16:55:02 +01:00
|
|
|
s.cvsRoot
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
Group {
|
|
|
|
|
Title(tr("Miscellaneous")),
|
|
|
|
|
Form {
|
2021-03-23 10:38:16 +01:00
|
|
|
s.timeout,
|
2021-03-16 16:55:02 +01:00
|
|
|
s.diffOptions,
|
|
|
|
|
},
|
|
|
|
|
s.promptOnSubmit,
|
|
|
|
|
s.describeByCommitId,
|
|
|
|
|
},
|
|
|
|
|
Stretch()
|
|
|
|
|
}.attachTo(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CvsSettingsPageWidget::apply()
|
|
|
|
|
{
|
|
|
|
|
if (m_settings->isDirty()) {
|
|
|
|
|
m_settings->apply();
|
|
|
|
|
m_onApply();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CvsSettingsPage::CvsSettingsPage(const std::function<void()> &onApply, CvsSettings *settings)
|
|
|
|
|
{
|
|
|
|
|
setId(VcsBase::Constants::VCS_ID_CVS);
|
|
|
|
|
setDisplayName(CvsSettingsPageWidget::tr("CVS"));
|
|
|
|
|
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
|
|
|
|
|
setWidgetCreator([onApply, settings] { return new CvsSettingsPageWidget(onApply, settings); });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // Internal
|
|
|
|
|
} // Cvs
|