2011-06-05 17:58:02 +03:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
2014-01-07 13:27:11 +01:00
|
|
|
** Copyright (c) 2014 AudioCodes Ltd.
|
2011-06-05 17:58:02 +03:00
|
|
|
** Author: Orgad Shaneh <orgad.shaneh@audiocodes.com>
|
2012-10-02 09:12:39 +02:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
2011-06-05 17:58:02 +03:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2011-06-05 17:58:02 +03: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
|
2014-10-01 13:21:18 +02:00
|
|
|
** conditions see http://www.qt.io/licensing. For further information
|
|
|
|
|
** use the contact form at http://www.qt.io/contact-us.
|
2011-06-05 17:58:02 +03: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
|
2014-10-01 13:21:18 +02:00
|
|
|
** General Public License version 2.1 or version 3 as published by the Free
|
|
|
|
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
|
|
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
|
|
|
** following information to ensure the GNU Lesser General Public License
|
|
|
|
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2012-10-02 09:12:39 +02:00
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
2011-06-05 17:58:02 +03:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2011-06-05 17:58:02 +03:00
|
|
|
|
2013-03-12 11:53:14 +01:00
|
|
|
#include "settingspage.h"
|
2011-06-05 17:58:02 +03:00
|
|
|
#include "clearcaseconstants.h"
|
|
|
|
|
#include "clearcasesettings.h"
|
|
|
|
|
#include "clearcaseplugin.h"
|
|
|
|
|
|
|
|
|
|
#include <coreplugin/icore.h>
|
|
|
|
|
#include <extensionsystem/pluginmanager.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>
|
2011-06-05 17:58:02 +03:00
|
|
|
#include <utils/pathchooser.h>
|
|
|
|
|
|
|
|
|
|
#include <QCoreApplication>
|
|
|
|
|
#include <QFileDialog>
|
|
|
|
|
#include <QTextStream>
|
|
|
|
|
|
|
|
|
|
using namespace ClearCase::Internal;
|
|
|
|
|
using namespace Utils;
|
|
|
|
|
|
|
|
|
|
SettingsPageWidget::SettingsPageWidget(QWidget *parent) :
|
|
|
|
|
QWidget(parent)
|
|
|
|
|
{
|
|
|
|
|
m_ui.setupUi(this);
|
|
|
|
|
m_ui.commandPathChooser->setPromptDialogTitle(tr("ClearCase Command"));
|
|
|
|
|
m_ui.commandPathChooser->setExpectedKind(PathChooser::ExistingCommand);
|
2013-11-25 14:32:16 +01:00
|
|
|
m_ui.commandPathChooser->setHistoryCompleter(QLatin1String("ClearCase.Command.History"));
|
2011-06-05 17:58:02 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ClearCaseSettings SettingsPageWidget::settings() const
|
|
|
|
|
{
|
|
|
|
|
ClearCaseSettings rc;
|
2012-08-21 10:06:05 +03:00
|
|
|
rc.ccCommand = m_ui.commandPathChooser->rawPath();
|
|
|
|
|
rc.ccBinaryPath = m_ui.commandPathChooser->path();
|
2011-06-05 17:58:02 +03:00
|
|
|
rc.timeOutS = m_ui.timeOutSpinBox->value();
|
|
|
|
|
rc.autoCheckOut = m_ui.autoCheckOutCheckBox->isChecked();
|
|
|
|
|
if (m_ui.graphicalDiffRadioButton->isChecked())
|
|
|
|
|
rc.diffType = GraphicalDiff;
|
|
|
|
|
else if (m_ui.externalDiffRadioButton->isChecked())
|
|
|
|
|
rc.diffType = ExternalDiff;
|
|
|
|
|
rc.autoAssignActivityName = m_ui.autoAssignActivityCheckBox->isChecked();
|
|
|
|
|
rc.historyCount = m_ui.historyCountSpinBox->value();
|
|
|
|
|
rc.promptToCheckIn = m_ui.promptCheckBox->isChecked();
|
|
|
|
|
rc.disableIndexer = m_ui.disableIndexerCheckBox->isChecked();
|
|
|
|
|
rc.diffArgs = m_ui.diffArgsEdit->text();
|
|
|
|
|
rc.indexOnlyVOBs = m_ui.indexOnlyVOBsEdit->text();
|
2012-09-02 11:26:26 +03:00
|
|
|
rc.extDiffAvailable = m_ui.externalDiffRadioButton->isEnabled();
|
2011-06-05 17:58:02 +03:00
|
|
|
return rc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SettingsPageWidget::setSettings(const ClearCaseSettings &s)
|
|
|
|
|
{
|
|
|
|
|
m_ui.commandPathChooser->setPath(s.ccCommand);
|
|
|
|
|
m_ui.timeOutSpinBox->setValue(s.timeOutS);
|
|
|
|
|
m_ui.autoCheckOutCheckBox->setChecked(s.autoCheckOut);
|
2012-09-02 11:26:26 +03:00
|
|
|
bool extDiffAvailable = !Utils::Environment::systemEnvironment().searchInPath(QLatin1String("diff")).isEmpty();
|
|
|
|
|
if (extDiffAvailable) {
|
|
|
|
|
m_ui.diffWarningLabel->setVisible(false);
|
|
|
|
|
} else {
|
|
|
|
|
QString diffWarning = 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(' ');
|
|
|
|
|
diffWarning.append(tr("DiffUtils is available for free download "
|
2012-09-19 11:15:13 +02:00
|
|
|
"<a href=\"http://gnuwin32.sourceforge.net/packages/diffutils.htm\">here</a>. "
|
|
|
|
|
"Please extract it to a directory in your PATH."));
|
|
|
|
|
}
|
2012-09-02 11:26:26 +03:00
|
|
|
m_ui.diffWarningLabel->setText(diffWarning);
|
|
|
|
|
m_ui.externalDiffRadioButton->setEnabled(false);
|
2011-06-05 17:58:02 +03:00
|
|
|
}
|
2012-09-02 11:26:26 +03:00
|
|
|
if (extDiffAvailable && s.diffType == ExternalDiff)
|
|
|
|
|
m_ui.externalDiffRadioButton->setChecked(true);
|
|
|
|
|
else
|
|
|
|
|
m_ui.graphicalDiffRadioButton->setChecked(true);
|
2011-06-05 17:58:02 +03:00
|
|
|
m_ui.autoAssignActivityCheckBox->setChecked(s.autoAssignActivityName);
|
|
|
|
|
m_ui.historyCountSpinBox->setValue(s.historyCount);
|
|
|
|
|
m_ui.promptCheckBox->setChecked(s.promptToCheckIn);
|
|
|
|
|
m_ui.disableIndexerCheckBox->setChecked(s.disableIndexer);
|
|
|
|
|
m_ui.diffArgsEdit->setText(s.diffArgs);
|
|
|
|
|
m_ui.indexOnlyVOBsEdit->setText(s.indexOnlyVOBs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SettingsPage::SettingsPage() :
|
|
|
|
|
m_widget(0)
|
|
|
|
|
{
|
2013-01-16 15:22:58 +01:00
|
|
|
setId(ClearCase::Constants::VCS_ID_CLEARCASE);
|
2011-06-05 17:58:02 +03:00
|
|
|
setDisplayName(tr("ClearCase"));
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-03 14:17:03 +01:00
|
|
|
QWidget *SettingsPage::widget()
|
2011-06-05 17:58:02 +03:00
|
|
|
{
|
2013-12-03 14:17:03 +01:00
|
|
|
if (!m_widget)
|
|
|
|
|
m_widget = new SettingsPageWidget;
|
2011-06-05 17:58:02 +03:00
|
|
|
m_widget->setSettings(ClearCasePlugin::instance()->settings());
|
|
|
|
|
return m_widget;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SettingsPage::apply()
|
|
|
|
|
{
|
|
|
|
|
ClearCasePlugin::instance()->setSettings(m_widget->settings());
|
|
|
|
|
}
|