2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 AudioCodes Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2011-06-05 17:58:02 +03:00
|
|
|
|
2013-03-12 11:53:14 +01:00
|
|
|
#include "settingspage.h"
|
2022-08-03 06:55:06 +02:00
|
|
|
|
2011-06-05 17:58:02 +03:00
|
|
|
#include "clearcaseconstants.h"
|
|
|
|
|
#include "clearcaseplugin.h"
|
2022-08-03 06:55:06 +02:00
|
|
|
#include "clearcasesettings.h"
|
2022-09-29 14:47:34 +02:00
|
|
|
#include "clearcasetr.h"
|
2011-06-05 17:58:02 +03:00
|
|
|
|
2020-01-15 14:32:19 +01:00
|
|
|
#include <vcsbase/vcsbaseconstants.h>
|
|
|
|
|
|
2012-09-02 11:26:26 +03:00
|
|
|
#include <utils/environment.h>
|
2012-09-19 11:15:13 +02:00
|
|
|
#include <utils/hostosinfo.h>
|
2022-09-28 17:19:55 +02:00
|
|
|
#include <utils/layoutbuilder.h>
|
2011-06-05 17:58:02 +03:00
|
|
|
#include <utils/pathchooser.h>
|
|
|
|
|
|
2022-09-28 17:19:55 +02:00
|
|
|
#include <QCheckBox>
|
2011-06-05 17:58:02 +03:00
|
|
|
#include <QCoreApplication>
|
2022-09-28 17:19:55 +02:00
|
|
|
#include <QLabel>
|
|
|
|
|
#include <QLineEdit>
|
|
|
|
|
#include <QRadioButton>
|
|
|
|
|
#include <QSpinBox>
|
2011-06-05 17:58:02 +03:00
|
|
|
|
|
|
|
|
using namespace Utils;
|
|
|
|
|
|
2022-09-28 17:19:55 +02:00
|
|
|
namespace ClearCase::Internal {
|
2020-01-10 16:13:25 +01:00
|
|
|
|
|
|
|
|
class SettingsPageWidget final : public Core::IOptionsPageWidget
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
SettingsPageWidget();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void apply() final;
|
|
|
|
|
|
2022-09-28 17:19:55 +02:00
|
|
|
Utils::PathChooser *commandPathChooser;
|
|
|
|
|
QRadioButton *graphicalDiffRadioButton;
|
|
|
|
|
QRadioButton *externalDiffRadioButton;
|
|
|
|
|
QLineEdit *diffArgsEdit;
|
|
|
|
|
QSpinBox *historyCountSpinBox;
|
|
|
|
|
QSpinBox *timeOutSpinBox;
|
|
|
|
|
QCheckBox *autoCheckOutCheckBox;
|
|
|
|
|
QCheckBox *promptCheckBox;
|
|
|
|
|
QCheckBox *disableIndexerCheckBox;
|
|
|
|
|
QLineEdit *indexOnlyVOBsEdit;
|
|
|
|
|
QCheckBox *autoAssignActivityCheckBox;
|
|
|
|
|
QCheckBox *noCommentCheckBox;
|
2020-01-10 16:13:25 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
SettingsPageWidget::SettingsPageWidget()
|
2011-06-05 17:58:02 +03:00
|
|
|
{
|
2022-09-28 17:19:55 +02:00
|
|
|
resize(512, 589);
|
|
|
|
|
|
|
|
|
|
commandPathChooser = new PathChooser;
|
2023-02-16 17:32:49 +01:00
|
|
|
commandPathChooser->setPromptDialogTitle(Tr::tr("ClearCase Command"));
|
2022-09-28 17:19:55 +02:00
|
|
|
commandPathChooser->setExpectedKind(PathChooser::ExistingCommand);
|
|
|
|
|
commandPathChooser->setHistoryCompleter("ClearCase.Command.History");
|
|
|
|
|
|
2022-09-29 14:47:34 +02:00
|
|
|
graphicalDiffRadioButton = new QRadioButton(Tr::tr("&Graphical (single file only)"));
|
2022-09-28 17:19:55 +02:00
|
|
|
graphicalDiffRadioButton->setChecked(true);
|
|
|
|
|
|
|
|
|
|
auto diffWidget = new QWidget;
|
|
|
|
|
diffWidget->setEnabled(false);
|
|
|
|
|
|
2022-09-29 14:47:34 +02:00
|
|
|
externalDiffRadioButton = new QRadioButton(Tr::tr("&External"));
|
2022-09-28 17:19:55 +02:00
|
|
|
QObject::connect(externalDiffRadioButton, &QRadioButton::toggled, diffWidget, &QWidget::setEnabled);
|
|
|
|
|
|
|
|
|
|
diffArgsEdit = new QLineEdit(diffWidget);
|
|
|
|
|
|
|
|
|
|
QPalette palette;
|
|
|
|
|
QBrush brush(QColor(255, 0, 0, 255));
|
|
|
|
|
brush.setStyle(Qt::SolidPattern);
|
|
|
|
|
palette.setBrush(QPalette::Active, QPalette::WindowText, brush);
|
|
|
|
|
palette.setBrush(QPalette::Inactive, QPalette::WindowText, brush);
|
|
|
|
|
QBrush brush1(QColor(68, 96, 92, 255));
|
|
|
|
|
brush1.setStyle(Qt::SolidPattern);
|
|
|
|
|
palette.setBrush(QPalette::Disabled, QPalette::WindowText, brush1);
|
|
|
|
|
|
|
|
|
|
auto diffWarningLabel = new QLabel;
|
|
|
|
|
diffWarningLabel->setPalette(palette);
|
|
|
|
|
diffWarningLabel->setWordWrap(true);
|
|
|
|
|
|
|
|
|
|
historyCountSpinBox = new QSpinBox;
|
|
|
|
|
historyCountSpinBox->setMaximum(10000);
|
|
|
|
|
|
|
|
|
|
timeOutSpinBox = new QSpinBox;
|
2022-09-29 14:47:34 +02:00
|
|
|
timeOutSpinBox->setSuffix(Tr::tr("s", nullptr));
|
2022-09-28 17:19:55 +02:00
|
|
|
timeOutSpinBox->setRange(1, 360);
|
|
|
|
|
timeOutSpinBox->setValue(30);
|
|
|
|
|
|
2022-09-29 14:47:34 +02:00
|
|
|
autoCheckOutCheckBox = new QCheckBox(Tr::tr("&Automatically check out files on edit"));
|
2022-09-28 17:19:55 +02:00
|
|
|
|
2022-09-29 14:47:34 +02:00
|
|
|
promptCheckBox = new QCheckBox(Tr::tr("&Prompt on check-in"));
|
2022-09-28 17:19:55 +02:00
|
|
|
|
2022-09-29 14:47:34 +02:00
|
|
|
disableIndexerCheckBox = new QCheckBox(Tr::tr("Di&sable indexer"));
|
2022-09-28 17:19:55 +02:00
|
|
|
|
|
|
|
|
indexOnlyVOBsEdit = new QLineEdit;
|
2022-09-29 14:47:34 +02:00
|
|
|
indexOnlyVOBsEdit->setToolTip(Tr::tr("VOBs list, separated by comma. Indexer will only traverse "
|
2022-09-28 17:19:55 +02:00
|
|
|
"the specified VOBs. If left blank, all active VOBs will be indexed."));
|
|
|
|
|
|
2022-09-29 14:47:34 +02:00
|
|
|
autoAssignActivityCheckBox = new QCheckBox(Tr::tr("Aut&o assign activity names"));
|
|
|
|
|
autoAssignActivityCheckBox->setToolTip(Tr::tr("Check this if you have a trigger that renames "
|
2022-09-28 17:19:55 +02:00
|
|
|
"the activity automatically. You will not be prompted for activity name."));
|
|
|
|
|
|
2022-09-29 14:47:34 +02:00
|
|
|
noCommentCheckBox = new QCheckBox(Tr::tr("Do ¬ prompt for comment during checkout or check-in"));
|
|
|
|
|
noCommentCheckBox->setToolTip(Tr::tr("Check out or check in files with no comment (-nc/omment)."));
|
2022-09-28 17:19:55 +02:00
|
|
|
|
|
|
|
|
using namespace Layouting;
|
|
|
|
|
|
2022-11-24 13:23:07 +01:00
|
|
|
Form {
|
|
|
|
|
Tr::tr("Arg&uments:"), diffArgsEdit
|
2022-09-28 17:19:55 +02:00
|
|
|
}.attachTo(diffWidget, WithoutMargins);
|
|
|
|
|
|
|
|
|
|
Column {
|
|
|
|
|
Group {
|
2022-09-29 14:47:34 +02:00
|
|
|
title(Tr::tr("Configuration")),
|
2022-09-28 17:19:55 +02:00
|
|
|
Form {
|
2022-09-29 14:47:34 +02:00
|
|
|
Tr::tr("&Command:"), commandPathChooser
|
2022-09-28 17:19:55 +02:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
Group {
|
2022-09-29 14:47:34 +02:00
|
|
|
title(Tr::tr("Diff")),
|
2022-09-28 17:19:55 +02:00
|
|
|
Form {
|
|
|
|
|
graphicalDiffRadioButton, br,
|
|
|
|
|
externalDiffRadioButton, diffWidget, br,
|
|
|
|
|
Span(2, diffWarningLabel)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
Group {
|
2022-09-29 14:47:34 +02:00
|
|
|
title(Tr::tr("Miscellaneous")),
|
2022-09-28 17:19:55 +02:00
|
|
|
Form {
|
2022-09-29 14:47:34 +02:00
|
|
|
Tr::tr("&History count:"), historyCountSpinBox, br,
|
|
|
|
|
Tr::tr("&Timeout:"), timeOutSpinBox, br,
|
2022-09-28 17:19:55 +02:00
|
|
|
autoCheckOutCheckBox, br,
|
|
|
|
|
autoAssignActivityCheckBox, br,
|
|
|
|
|
noCommentCheckBox, br,
|
|
|
|
|
promptCheckBox, br,
|
|
|
|
|
disableIndexerCheckBox, br,
|
2022-09-29 14:47:34 +02:00
|
|
|
Tr::tr("&Index only VOBs:"), indexOnlyVOBsEdit,
|
2022-09-28 17:19:55 +02:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
st
|
|
|
|
|
}.attachTo(this);
|
|
|
|
|
|
2011-06-05 17:58:02 +03:00
|
|
|
|
2020-02-06 17:49:35 +01:00
|
|
|
const ClearCaseSettings &s = ClearCasePlugin::settings();
|
2011-06-05 17:58:02 +03:00
|
|
|
|
2022-09-28 17:19:55 +02:00
|
|
|
commandPathChooser->setFilePath(FilePath::fromString(s.ccCommand));
|
|
|
|
|
timeOutSpinBox->setValue(s.timeOutS);
|
|
|
|
|
autoCheckOutCheckBox->setChecked(s.autoCheckOut);
|
|
|
|
|
noCommentCheckBox->setChecked(s.noComment);
|
2015-02-03 23:56:02 +02:00
|
|
|
bool extDiffAvailable = !Environment::systemEnvironment().searchInPath(QLatin1String("diff")).isEmpty();
|
2012-09-02 11:26:26 +03:00
|
|
|
if (extDiffAvailable) {
|
2022-09-28 17:19:55 +02:00
|
|
|
diffWarningLabel->setVisible(false);
|
2012-09-02 11:26:26 +03:00
|
|
|
} else {
|
2022-09-29 14:47:34 +02:00
|
|
|
QString diffWarning = Tr::tr("In order to use External diff, \"diff\" command needs to be accessible.");
|
2012-09-19 11:15:13 +02:00
|
|
|
if (HostOsInfo::isWindowsHost()) {
|
2013-10-17 14:52:10 +02:00
|
|
|
diffWarning += QLatin1Char(' ');
|
2022-09-29 14:47:34 +02:00
|
|
|
diffWarning.append(Tr::tr("DiffUtils is available for free download at "
|
|
|
|
|
"http://gnuwin32.sourceforge.net/packages/diffutils.htm. "
|
|
|
|
|
"Extract it to a directory in your PATH."));
|
2012-09-19 11:15:13 +02:00
|
|
|
}
|
2022-09-28 17:19:55 +02:00
|
|
|
diffWarningLabel->setText(diffWarning);
|
|
|
|
|
externalDiffRadioButton->setEnabled(false);
|
2011-06-05 17:58:02 +03:00
|
|
|
}
|
2012-09-02 11:26:26 +03:00
|
|
|
if (extDiffAvailable && s.diffType == ExternalDiff)
|
2022-09-28 17:19:55 +02:00
|
|
|
externalDiffRadioButton->setChecked(true);
|
2012-09-02 11:26:26 +03:00
|
|
|
else
|
2022-09-28 17:19:55 +02:00
|
|
|
graphicalDiffRadioButton->setChecked(true);
|
|
|
|
|
autoAssignActivityCheckBox->setChecked(s.autoAssignActivityName);
|
|
|
|
|
historyCountSpinBox->setValue(s.historyCount);
|
|
|
|
|
disableIndexerCheckBox->setChecked(s.disableIndexer);
|
|
|
|
|
diffArgsEdit->setText(s.diffArgs);
|
|
|
|
|
indexOnlyVOBsEdit->setText(s.indexOnlyVOBs);
|
2011-06-05 17:58:02 +03:00
|
|
|
}
|
|
|
|
|
|
2020-01-10 16:13:25 +01:00
|
|
|
void SettingsPageWidget::apply()
|
2011-06-05 17:58:02 +03:00
|
|
|
{
|
2020-01-10 16:13:25 +01:00
|
|
|
ClearCaseSettings rc;
|
2022-09-28 17:19:55 +02:00
|
|
|
rc.ccCommand = commandPathChooser->rawFilePath().toString();
|
|
|
|
|
rc.ccBinaryPath = commandPathChooser->filePath();
|
|
|
|
|
rc.timeOutS = timeOutSpinBox->value();
|
|
|
|
|
rc.autoCheckOut = autoCheckOutCheckBox->isChecked();
|
|
|
|
|
rc.noComment = noCommentCheckBox->isChecked();
|
|
|
|
|
if (graphicalDiffRadioButton->isChecked())
|
2020-01-10 16:13:25 +01:00
|
|
|
rc.diffType = GraphicalDiff;
|
2022-09-28 17:19:55 +02:00
|
|
|
else if (externalDiffRadioButton->isChecked())
|
2020-01-10 16:13:25 +01:00
|
|
|
rc.diffType = ExternalDiff;
|
2022-09-28 17:19:55 +02:00
|
|
|
rc.autoAssignActivityName = autoAssignActivityCheckBox->isChecked();
|
|
|
|
|
rc.historyCount = historyCountSpinBox->value();
|
|
|
|
|
rc.disableIndexer = disableIndexerCheckBox->isChecked();
|
|
|
|
|
rc.diffArgs = diffArgsEdit->text();
|
|
|
|
|
rc.indexOnlyVOBs = indexOnlyVOBsEdit->text();
|
|
|
|
|
rc.extDiffAvailable = externalDiffRadioButton->isEnabled();
|
2011-06-05 17:58:02 +03:00
|
|
|
|
2020-02-06 17:49:35 +01:00
|
|
|
ClearCasePlugin::setSettings(rc);
|
2011-06-05 17:58:02 +03:00
|
|
|
}
|
|
|
|
|
|
2020-02-06 18:51:46 +01:00
|
|
|
ClearCaseSettingsPage::ClearCaseSettingsPage()
|
2011-06-05 17:58:02 +03:00
|
|
|
{
|
2020-01-10 16:13:25 +01:00
|
|
|
setId(ClearCase::Constants::VCS_ID_CLEARCASE);
|
2022-09-29 14:47:34 +02:00
|
|
|
setDisplayName(Tr::tr("ClearCase"));
|
2020-01-15 14:32:19 +01:00
|
|
|
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
|
2020-01-10 16:13:25 +01:00
|
|
|
setWidgetCreator([] { return new SettingsPageWidget; });
|
2011-06-05 17:58:02 +03:00
|
|
|
}
|
2020-01-10 16:13:25 +01:00
|
|
|
|
2022-09-28 17:19:55 +02:00
|
|
|
} // ClearCase::Internal
|