forked from qt-creator/qt-creator
CVS: Aspectify settings
Change-Id: Ib5170405b33b3e521470407065e85c95dad6163b Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -7,5 +7,4 @@ add_qtc_plugin(CVS
|
|||||||
cvssettings.cpp cvssettings.h
|
cvssettings.cpp cvssettings.h
|
||||||
cvssubmiteditor.cpp cvssubmiteditor.h
|
cvssubmiteditor.cpp cvssubmiteditor.h
|
||||||
cvsutils.cpp cvsutils.h
|
cvsutils.cpp cvsutils.h
|
||||||
settingspage.cpp settingspage.h settingspage.ui
|
|
||||||
)
|
)
|
||||||
|
@@ -2,7 +2,6 @@ include(../../qtcreatorplugin.pri)
|
|||||||
|
|
||||||
HEADERS += annotationhighlighter.h \
|
HEADERS += annotationhighlighter.h \
|
||||||
cvsplugin.h \
|
cvsplugin.h \
|
||||||
settingspage.h \
|
|
||||||
cvseditor.h \
|
cvseditor.h \
|
||||||
cvssubmiteditor.h \
|
cvssubmiteditor.h \
|
||||||
cvssettings.h \
|
cvssettings.h \
|
||||||
@@ -10,10 +9,7 @@ HEADERS += annotationhighlighter.h \
|
|||||||
|
|
||||||
SOURCES += annotationhighlighter.cpp \
|
SOURCES += annotationhighlighter.cpp \
|
||||||
cvsplugin.cpp \
|
cvsplugin.cpp \
|
||||||
settingspage.cpp \
|
|
||||||
cvseditor.cpp \
|
cvseditor.cpp \
|
||||||
cvssubmiteditor.cpp \
|
cvssubmiteditor.cpp \
|
||||||
cvssettings.cpp \
|
cvssettings.cpp \
|
||||||
cvsutils.cpp
|
cvsutils.cpp
|
||||||
|
|
||||||
FORMS += settingspage.ui
|
|
||||||
|
@@ -23,8 +23,5 @@ QtcPlugin {
|
|||||||
"cvssubmiteditor.h",
|
"cvssubmiteditor.h",
|
||||||
"cvsutils.cpp",
|
"cvsutils.cpp",
|
||||||
"cvsutils.h",
|
"cvsutils.h",
|
||||||
"settingspage.cpp",
|
|
||||||
"settingspage.h",
|
|
||||||
"settingspage.ui",
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@@ -24,7 +24,6 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "cvsplugin.h"
|
#include "cvsplugin.h"
|
||||||
#include "settingspage.h"
|
|
||||||
#include "cvseditor.h"
|
#include "cvseditor.h"
|
||||||
#include "cvssubmiteditor.h"
|
#include "cvssubmiteditor.h"
|
||||||
#include "cvsutils.h"
|
#include "cvsutils.h"
|
||||||
@@ -170,32 +169,31 @@ static inline bool messageBoxQuestion(const QString &title, const QString &quest
|
|||||||
class CvsDiffConfig : public VcsBaseEditorConfig
|
class CvsDiffConfig : public VcsBaseEditorConfig
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CvsDiffConfig(VcsBaseClientSettings &settings, QToolBar *toolBar) :
|
CvsDiffConfig(CvsSettings &settings, QToolBar *toolBar) :
|
||||||
VcsBaseEditorConfig(toolBar),
|
VcsBaseEditorConfig(toolBar),
|
||||||
m_settings(settings)
|
m_settings(settings)
|
||||||
{
|
{
|
||||||
mapSetting(addToggleButton(QLatin1String("-w"), CvsPlugin::tr("Ignore Whitespace")),
|
mapSetting(addToggleButton("-w", CvsPlugin::tr("Ignore Whitespace")),
|
||||||
settings.boolPointer(CvsSettings::diffIgnoreWhiteSpaceKey));
|
&settings.diffIgnoreWhiteSpace);
|
||||||
mapSetting(addToggleButton(QLatin1String("-B"), CvsPlugin::tr("Ignore Blank Lines")),
|
mapSetting(addToggleButton("-B", CvsPlugin::tr("Ignore Blank Lines")),
|
||||||
settings.boolPointer(CvsSettings::diffIgnoreBlankLinesKey));
|
&settings.diffIgnoreBlankLines);
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList arguments() const override
|
QStringList arguments() const override
|
||||||
{
|
{
|
||||||
QStringList args;
|
QStringList args = m_settings.diffOptions.value().split(' ', SkipEmptyParts);
|
||||||
args = m_settings.stringValue(CvsSettings::diffOptionsKey).split(' ', SkipEmptyParts);
|
|
||||||
args += VcsBaseEditorConfig::arguments();
|
args += VcsBaseEditorConfig::arguments();
|
||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VcsBaseClientSettings &m_settings;
|
CvsSettings &m_settings;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CvsClient : public VcsBaseClient
|
class CvsClient : public VcsBaseClient
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit CvsClient(CvsSettings *settings) : VcsBaseClient(settings)
|
explicit CvsClient(CvsSettings *settings) : VcsBaseClient(nullptr, settings)
|
||||||
{
|
{
|
||||||
setDiffConfigCreator([settings](QToolBar *toolBar) {
|
setDiffConfigCreator([settings](QToolBar *toolBar) {
|
||||||
return new CvsDiffConfig(*settings, toolBar);
|
return new CvsDiffConfig(*settings, toolBar);
|
||||||
@@ -413,7 +411,7 @@ bool CvsPluginPrivate::isVcsFileOrDirectory(const Utils::FilePath &fileName) con
|
|||||||
|
|
||||||
bool CvsPluginPrivate::isConfigured() const
|
bool CvsPluginPrivate::isConfigured() const
|
||||||
{
|
{
|
||||||
const Utils::FilePath binary = m_settings.binaryPath();
|
const Utils::FilePath binary = m_settings.binaryPath.filePath();
|
||||||
if (binary.isEmpty())
|
if (binary.isEmpty())
|
||||||
return false;
|
return false;
|
||||||
QFileInfo fi = binary.toFileInfo();
|
QFileInfo fi = binary.toFileInfo();
|
||||||
@@ -491,7 +489,7 @@ Core::ShellCommand *CvsPluginPrivate::createInitialCheckoutCommand(const QString
|
|||||||
auto command = new VcsBase::VcsCommand(baseDirectory.toString(),
|
auto command = new VcsBase::VcsCommand(baseDirectory.toString(),
|
||||||
QProcessEnvironment::systemEnvironment());
|
QProcessEnvironment::systemEnvironment());
|
||||||
command->setDisplayName(tr("CVS Checkout"));
|
command->setDisplayName(tr("CVS Checkout"));
|
||||||
command->addJob({m_settings.binaryPath(), m_settings.addOptions(args)}, -1);
|
command->addJob({m_settings.binaryPath.filePath(), m_settings.addOptions(args)}, -1);
|
||||||
return command;
|
return command;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -766,8 +764,10 @@ bool CvsPluginPrivate::submitEditorAboutToClose()
|
|||||||
// Prompt user. Force a prompt unless submit was actually invoked (that
|
// Prompt user. Force a prompt unless submit was actually invoked (that
|
||||||
// is, the editor was closed or shutdown).
|
// is, the editor was closed or shutdown).
|
||||||
const VcsBaseSubmitEditor::PromptSubmitResult answer = editor->promptSubmit(
|
const VcsBaseSubmitEditor::PromptSubmitResult answer = editor->promptSubmit(
|
||||||
this, m_settings.boolPointer(CvsSettings::promptOnSubmitKey),
|
this, nullptr,
|
||||||
!m_submitActionTriggered);
|
!m_submitActionTriggered,
|
||||||
|
true,
|
||||||
|
&m_settings.promptOnSubmit);
|
||||||
m_submitActionTriggered = false;
|
m_submitActionTriggered = false;
|
||||||
switch (answer) {
|
switch (answer) {
|
||||||
case VcsBaseSubmitEditor::SubmitCanceled:
|
case VcsBaseSubmitEditor::SubmitCanceled:
|
||||||
@@ -873,7 +873,7 @@ void CvsPluginPrivate::revertAll()
|
|||||||
QStringList args;
|
QStringList args;
|
||||||
args << QLatin1String("update") << QLatin1String("-C") << state.topLevel();
|
args << QLatin1String("update") << QLatin1String("-C") << state.topLevel();
|
||||||
const CvsResponse revertResponse =
|
const CvsResponse revertResponse =
|
||||||
runCvs(state.topLevel(), args, m_settings.vcsTimeoutS(),
|
runCvs(state.topLevel(), args, m_settings.timeout.value(),
|
||||||
VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut);
|
VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut);
|
||||||
if (revertResponse.result == CvsResponse::Ok)
|
if (revertResponse.result == CvsResponse::Ok)
|
||||||
emit repositoryChanged(state.topLevel());
|
emit repositoryChanged(state.topLevel());
|
||||||
@@ -889,7 +889,7 @@ void CvsPluginPrivate::revertCurrentFile()
|
|||||||
QStringList args;
|
QStringList args;
|
||||||
args << QLatin1String("diff") << state.relativeCurrentFile();
|
args << QLatin1String("diff") << state.relativeCurrentFile();
|
||||||
const CvsResponse diffResponse =
|
const CvsResponse diffResponse =
|
||||||
runCvs(state.currentFileTopLevel(), args, m_settings.vcsTimeoutS(), 0);
|
runCvs(state.currentFileTopLevel(), args, m_settings.timeout.value(), 0);
|
||||||
switch (diffResponse.result) {
|
switch (diffResponse.result) {
|
||||||
case CvsResponse::Ok:
|
case CvsResponse::Ok:
|
||||||
return; // Not modified, diff exit code 0
|
return; // Not modified, diff exit code 0
|
||||||
@@ -911,7 +911,7 @@ void CvsPluginPrivate::revertCurrentFile()
|
|||||||
args.clear();
|
args.clear();
|
||||||
args << QLatin1String("update") << QLatin1String("-C") << state.relativeCurrentFile();
|
args << QLatin1String("update") << QLatin1String("-C") << state.relativeCurrentFile();
|
||||||
const CvsResponse revertResponse =
|
const CvsResponse revertResponse =
|
||||||
runCvs(state.currentFileTopLevel(), args, m_settings.vcsTimeoutS(),
|
runCvs(state.currentFileTopLevel(), args, m_settings.timeout.value(),
|
||||||
VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut);
|
VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut);
|
||||||
if (revertResponse.result == CvsResponse::Ok)
|
if (revertResponse.result == CvsResponse::Ok)
|
||||||
emit filesChanged(QStringList(state.currentFile()));
|
emit filesChanged(QStringList(state.currentFile()));
|
||||||
@@ -976,7 +976,7 @@ void CvsPluginPrivate::startCommit(const QString &workingDir, const QString &fil
|
|||||||
// where we are, so, have stdout/stderr channels merged.
|
// where we are, so, have stdout/stderr channels merged.
|
||||||
QStringList args = QStringList(QLatin1String("status"));
|
QStringList args = QStringList(QLatin1String("status"));
|
||||||
const CvsResponse response =
|
const CvsResponse response =
|
||||||
runCvs(workingDir, args, m_settings.vcsTimeoutS(), VcsCommand::MergeOutputChannels);
|
runCvs(workingDir, args, m_settings.timeout.value(), VcsCommand::MergeOutputChannels);
|
||||||
if (response.result != CvsResponse::Ok)
|
if (response.result != CvsResponse::Ok)
|
||||||
return;
|
return;
|
||||||
// Get list of added/modified/deleted files and purge out undesired ones
|
// Get list of added/modified/deleted files and purge out undesired ones
|
||||||
@@ -1022,7 +1022,7 @@ bool CvsPluginPrivate::commit(const QString &messageFile,
|
|||||||
args << QLatin1String("-F") << messageFile;
|
args << QLatin1String("-F") << messageFile;
|
||||||
args.append(fileList);
|
args.append(fileList);
|
||||||
const CvsResponse response =
|
const CvsResponse response =
|
||||||
runCvs(m_commitRepository, args, 10 * m_settings.vcsTimeoutS(),
|
runCvs(m_commitRepository, args, 10 * m_settings.timeout.value(),
|
||||||
VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut);
|
VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut);
|
||||||
return response.result == CvsResponse::Ok ;
|
return response.result == CvsResponse::Ok ;
|
||||||
}
|
}
|
||||||
@@ -1060,7 +1060,7 @@ void CvsPluginPrivate::filelog(const QString &workingDir,
|
|||||||
args << QLatin1String("log");
|
args << QLatin1String("log");
|
||||||
args.append(file);
|
args.append(file);
|
||||||
const CvsResponse response =
|
const CvsResponse response =
|
||||||
runCvs(workingDir, args, m_settings.vcsTimeoutS(),
|
runCvs(workingDir, args, m_settings.timeout.value(),
|
||||||
VcsCommand::SshPasswordPrompt, codec);
|
VcsCommand::SshPasswordPrompt, codec);
|
||||||
if (response.result != CvsResponse::Ok)
|
if (response.result != CvsResponse::Ok)
|
||||||
return;
|
return;
|
||||||
@@ -1101,7 +1101,7 @@ bool CvsPluginPrivate::update(const QString &topLevel, const QString &file)
|
|||||||
if (!file.isEmpty())
|
if (!file.isEmpty())
|
||||||
args.append(file);
|
args.append(file);
|
||||||
const CvsResponse response =
|
const CvsResponse response =
|
||||||
runCvs(topLevel, args, 10 * m_settings.vcsTimeoutS(),
|
runCvs(topLevel, args, 10 * m_settings.timeout.value(),
|
||||||
VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut);
|
VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut);
|
||||||
const bool ok = response.result == CvsResponse::Ok;
|
const bool ok = response.result == CvsResponse::Ok;
|
||||||
if (ok)
|
if (ok)
|
||||||
@@ -1148,7 +1148,7 @@ bool CvsPluginPrivate::edit(const QString &topLevel, const QStringList &files)
|
|||||||
QStringList args(QLatin1String("edit"));
|
QStringList args(QLatin1String("edit"));
|
||||||
args.append(files);
|
args.append(files);
|
||||||
const CvsResponse response =
|
const CvsResponse response =
|
||||||
runCvs(topLevel, args, m_settings.vcsTimeoutS(),
|
runCvs(topLevel, args, m_settings.timeout.value(),
|
||||||
VcsCommand::ShowStdOut | VcsCommand::SshPasswordPrompt);
|
VcsCommand::ShowStdOut | VcsCommand::SshPasswordPrompt);
|
||||||
return response.result == CvsResponse::Ok;
|
return response.result == CvsResponse::Ok;
|
||||||
}
|
}
|
||||||
@@ -1160,7 +1160,7 @@ bool CvsPluginPrivate::diffCheckModified(const QString &topLevel, const QStringL
|
|||||||
QStringList args(QLatin1String("-q"));
|
QStringList args(QLatin1String("-q"));
|
||||||
args << QLatin1String("diff");
|
args << QLatin1String("diff");
|
||||||
args.append(files);
|
args.append(files);
|
||||||
const CvsResponse response = runCvs(topLevel, args, m_settings.vcsTimeoutS(), 0);
|
const CvsResponse response = runCvs(topLevel, args, m_settings.timeout.value(), 0);
|
||||||
if (response.result == CvsResponse::OtherError)
|
if (response.result == CvsResponse::OtherError)
|
||||||
return false;
|
return false;
|
||||||
*modified = response.result == CvsResponse::NonNullExitCode;
|
*modified = response.result == CvsResponse::NonNullExitCode;
|
||||||
@@ -1188,7 +1188,7 @@ bool CvsPluginPrivate::unedit(const QString &topLevel, const QStringList &files)
|
|||||||
args.append(QLatin1String("-y"));
|
args.append(QLatin1String("-y"));
|
||||||
args.append(files);
|
args.append(files);
|
||||||
const CvsResponse response =
|
const CvsResponse response =
|
||||||
runCvs(topLevel, args, m_settings.vcsTimeoutS(),
|
runCvs(topLevel, args, m_settings.timeout.value(),
|
||||||
VcsCommand::ShowStdOut | VcsCommand::SshPasswordPrompt);
|
VcsCommand::ShowStdOut | VcsCommand::SshPasswordPrompt);
|
||||||
return response.result == CvsResponse::Ok;
|
return response.result == CvsResponse::Ok;
|
||||||
}
|
}
|
||||||
@@ -1207,7 +1207,7 @@ void CvsPluginPrivate::annotate(const QString &workingDir, const QString &file,
|
|||||||
args << QLatin1String("-r") << revision;
|
args << QLatin1String("-r") << revision;
|
||||||
args << file;
|
args << file;
|
||||||
const CvsResponse response =
|
const CvsResponse response =
|
||||||
runCvs(workingDir, args, m_settings.vcsTimeoutS(),
|
runCvs(workingDir, args, m_settings.timeout.value(),
|
||||||
VcsCommand::SshPasswordPrompt, codec);
|
VcsCommand::SshPasswordPrompt, codec);
|
||||||
if (response.result != CvsResponse::Ok)
|
if (response.result != CvsResponse::Ok)
|
||||||
return;
|
return;
|
||||||
@@ -1236,7 +1236,7 @@ bool CvsPluginPrivate::status(const QString &topLevel, const QString &file, cons
|
|||||||
if (!file.isEmpty())
|
if (!file.isEmpty())
|
||||||
args.append(file);
|
args.append(file);
|
||||||
const CvsResponse response =
|
const CvsResponse response =
|
||||||
runCvs(topLevel, args, m_settings.vcsTimeoutS(), 0);
|
runCvs(topLevel, args, m_settings.timeout.value(), 0);
|
||||||
const bool ok = response.result == CvsResponse::Ok;
|
const bool ok = response.result == CvsResponse::Ok;
|
||||||
if (ok)
|
if (ok)
|
||||||
showOutputInEditor(title, response.stdOut, commandLogEditorParameters.id, topLevel, nullptr);
|
showOutputInEditor(title, response.stdOut, commandLogEditorParameters.id, topLevel, nullptr);
|
||||||
@@ -1311,7 +1311,7 @@ bool CvsPluginPrivate::describe(const QString &toplevel, const QString &file, co
|
|||||||
QStringList args;
|
QStringList args;
|
||||||
args << QLatin1String("log") << (QLatin1String("-r") + changeNr) << file;
|
args << QLatin1String("log") << (QLatin1String("-r") + changeNr) << file;
|
||||||
const CvsResponse logResponse =
|
const CvsResponse logResponse =
|
||||||
runCvs(toplevel, args, m_settings.vcsTimeoutS(), VcsCommand::SshPasswordPrompt);
|
runCvs(toplevel, args, m_settings.timeout.value(), VcsCommand::SshPasswordPrompt);
|
||||||
if (logResponse.result != CvsResponse::Ok) {
|
if (logResponse.result != CvsResponse::Ok) {
|
||||||
*errorMessage = logResponse.message;
|
*errorMessage = logResponse.message;
|
||||||
return false;
|
return false;
|
||||||
@@ -1321,7 +1321,7 @@ bool CvsPluginPrivate::describe(const QString &toplevel, const QString &file, co
|
|||||||
*errorMessage = tr("Parsing of the log output failed.");
|
*errorMessage = tr("Parsing of the log output failed.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (m_settings.boolValue(CvsSettings::describeByCommitIdKey)) {
|
if (m_settings.describeByCommitId.value()) {
|
||||||
// Run a log command over the repo, filtering by the commit date
|
// Run a log command over the repo, filtering by the commit date
|
||||||
// and commit id, collecting all files touched by the commit.
|
// and commit id, collecting all files touched by the commit.
|
||||||
const QString commitId = fileLog.front().revisions.front().commitId;
|
const QString commitId = fileLog.front().revisions.front().commitId;
|
||||||
@@ -1333,7 +1333,7 @@ bool CvsPluginPrivate::describe(const QString &toplevel, const QString &file, co
|
|||||||
args << QLatin1String("log") << QLatin1String("-d") << (dateS + QLatin1Char('<') + nextDayS);
|
args << QLatin1String("log") << QLatin1String("-d") << (dateS + QLatin1Char('<') + nextDayS);
|
||||||
|
|
||||||
const CvsResponse repoLogResponse =
|
const CvsResponse repoLogResponse =
|
||||||
runCvs(toplevel, args, 10 * m_settings.vcsTimeoutS(), VcsCommand::SshPasswordPrompt);
|
runCvs(toplevel, args, 10 * m_settings.timeout.value(), VcsCommand::SshPasswordPrompt);
|
||||||
if (repoLogResponse.result != CvsResponse::Ok) {
|
if (repoLogResponse.result != CvsResponse::Ok) {
|
||||||
*errorMessage = repoLogResponse.message;
|
*errorMessage = repoLogResponse.message;
|
||||||
return false;
|
return false;
|
||||||
@@ -1370,7 +1370,7 @@ bool CvsPluginPrivate::describe(const QString &repositoryPath,
|
|||||||
QStringList args(QLatin1String("log"));
|
QStringList args(QLatin1String("log"));
|
||||||
args << (QLatin1String("-r") + it->revisions.front().revision) << it->file;
|
args << (QLatin1String("-r") + it->revisions.front().revision) << it->file;
|
||||||
const CvsResponse logResponse =
|
const CvsResponse logResponse =
|
||||||
runCvs(repositoryPath, args, m_settings.vcsTimeoutS(), VcsCommand::SshPasswordPrompt);
|
runCvs(repositoryPath, args, m_settings.timeout.value(), VcsCommand::SshPasswordPrompt);
|
||||||
if (logResponse.result != CvsResponse::Ok) {
|
if (logResponse.result != CvsResponse::Ok) {
|
||||||
*errorMessage = logResponse.message;
|
*errorMessage = logResponse.message;
|
||||||
return false;
|
return false;
|
||||||
@@ -1383,11 +1383,11 @@ bool CvsPluginPrivate::describe(const QString &repositoryPath,
|
|||||||
if (!isFirstRevision(revision)) {
|
if (!isFirstRevision(revision)) {
|
||||||
const QString previousRev = previousRevision(revision);
|
const QString previousRev = previousRevision(revision);
|
||||||
QStringList args(QLatin1String("diff"));
|
QStringList args(QLatin1String("diff"));
|
||||||
args << m_settings.stringValue(CvsSettings::diffOptionsKey)
|
args << m_settings.diffOptions.value()
|
||||||
<< QLatin1String("-r") << previousRev << QLatin1String("-r")
|
<< QLatin1String("-r") << previousRev << QLatin1String("-r")
|
||||||
<< it->revisions.front().revision << it->file;
|
<< it->revisions.front().revision << it->file;
|
||||||
const CvsResponse diffResponse =
|
const CvsResponse diffResponse =
|
||||||
runCvs(repositoryPath, args, m_settings.vcsTimeoutS(), 0, codec);
|
runCvs(repositoryPath, args, m_settings.timeout.value(), 0, codec);
|
||||||
switch (diffResponse.result) {
|
switch (diffResponse.result) {
|
||||||
case CvsResponse::Ok:
|
case CvsResponse::Ok:
|
||||||
case CvsResponse::NonNullExitCode: // Diff exit code != 0
|
case CvsResponse::NonNullExitCode: // Diff exit code != 0
|
||||||
@@ -1435,7 +1435,7 @@ CvsResponse CvsPluginPrivate::runCvs(const QString &workingDirectory,
|
|||||||
unsigned flags,
|
unsigned flags,
|
||||||
QTextCodec *outputCodec) const
|
QTextCodec *outputCodec) const
|
||||||
{
|
{
|
||||||
const FilePath executable = m_settings.binaryPath();
|
const FilePath executable = m_settings.binaryPath.filePath();
|
||||||
CvsResponse response;
|
CvsResponse response;
|
||||||
if (executable.isEmpty()) {
|
if (executable.isEmpty()) {
|
||||||
response.result = CvsResponse::OtherError;
|
response.result = CvsResponse::OtherError;
|
||||||
@@ -1494,7 +1494,7 @@ bool CvsPluginPrivate::vcsAdd(const QString &workingDir, const QString &rawFileN
|
|||||||
QStringList args;
|
QStringList args;
|
||||||
args << QLatin1String("add") << rawFileName;
|
args << QLatin1String("add") << rawFileName;
|
||||||
const CvsResponse response =
|
const CvsResponse response =
|
||||||
runCvs(workingDir, args, m_settings.vcsTimeoutS(),
|
runCvs(workingDir, args, m_settings.timeout.value(),
|
||||||
VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut);
|
VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut);
|
||||||
return response.result == CvsResponse::Ok;
|
return response.result == CvsResponse::Ok;
|
||||||
}
|
}
|
||||||
@@ -1504,7 +1504,7 @@ bool CvsPluginPrivate::vcsDelete(const QString &workingDir, const QString &rawFi
|
|||||||
QStringList args;
|
QStringList args;
|
||||||
args << QLatin1String("remove") << QLatin1String("-f") << rawFileName;
|
args << QLatin1String("remove") << QLatin1String("-f") << rawFileName;
|
||||||
const CvsResponse response =
|
const CvsResponse response =
|
||||||
runCvs(workingDir, args, m_settings.vcsTimeoutS(),
|
runCvs(workingDir, args, m_settings.timeout.value(),
|
||||||
VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut);
|
VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut);
|
||||||
return response.result == CvsResponse::Ok;
|
return response.result == CvsResponse::Ok;
|
||||||
}
|
}
|
||||||
@@ -1545,7 +1545,7 @@ bool CvsPluginPrivate::managesFile(const QString &workingDirectory, const QStrin
|
|||||||
QStringList args;
|
QStringList args;
|
||||||
args << QLatin1String("status") << fileName;
|
args << QLatin1String("status") << fileName;
|
||||||
const CvsResponse response =
|
const CvsResponse response =
|
||||||
runCvs(workingDirectory, args, m_settings.vcsTimeoutS(), VcsCommand::SshPasswordPrompt);
|
runCvs(workingDirectory, args, m_settings.timeout.value(), VcsCommand::SshPasswordPrompt);
|
||||||
if (response.result != CvsResponse::Ok)
|
if (response.result != CvsResponse::Ok)
|
||||||
return false;
|
return false;
|
||||||
return !response.stdOut.contains(QLatin1String("Status: Unknown"));
|
return !response.stdOut.contains(QLatin1String("Status: Unknown"));
|
||||||
|
@@ -25,40 +25,62 @@
|
|||||||
|
|
||||||
#include "cvssettings.h"
|
#include "cvssettings.h"
|
||||||
|
|
||||||
#include <utils/environment.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <utils/hostosinfo.h>
|
|
||||||
|
|
||||||
#include <QSettings>
|
#include <utils/layoutbuilder.h>
|
||||||
#include <QTextStream>
|
#include <utils/pathchooser.h>
|
||||||
|
|
||||||
|
#include <vcsbase/vcsbaseconstants.h>
|
||||||
|
|
||||||
|
using namespace Utils;
|
||||||
|
using namespace VcsBase;
|
||||||
|
|
||||||
namespace Cvs {
|
namespace Cvs {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
const QLatin1String CvsSettings::cvsRootKey("Root");
|
// CvsSettings
|
||||||
const QLatin1String CvsSettings::diffOptionsKey("DiffOptions");
|
|
||||||
const QLatin1String CvsSettings::describeByCommitIdKey("DescribeByCommitId");
|
|
||||||
const QLatin1String CvsSettings::diffIgnoreWhiteSpaceKey("DiffIgnoreWhiteSpace");
|
|
||||||
const QLatin1String CvsSettings::diffIgnoreBlankLinesKey("DiffIgnoreBlankLines");
|
|
||||||
|
|
||||||
CvsSettings::CvsSettings()
|
CvsSettings::CvsSettings()
|
||||||
{
|
{
|
||||||
setSettingsGroup(QLatin1String("CVS"));
|
setSettingsGroup("CVS");
|
||||||
declareKey(binaryPathKey, QLatin1String("cvs" QTC_HOST_EXE_SUFFIX));
|
|
||||||
declareKey(cvsRootKey, QString());
|
|
||||||
declareKey(diffOptionsKey, QLatin1String("-du"));
|
|
||||||
declareKey(describeByCommitIdKey, true);
|
|
||||||
declareKey(diffIgnoreWhiteSpaceKey, false);
|
|
||||||
declareKey(diffIgnoreBlankLinesKey, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
int CvsSettings::timeOutMs() const
|
registerAspect(&binaryPath);
|
||||||
{
|
binaryPath.setDefaultValue("cvs" QTC_HOST_EXE_SUFFIX);
|
||||||
return 1000 * intValue(timeoutKey);
|
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");
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList CvsSettings::addOptions(const QStringList &args) const
|
QStringList CvsSettings::addOptions(const QStringList &args) const
|
||||||
{
|
{
|
||||||
const QString cvsRoot = stringValue(cvsRootKey);
|
const QString cvsRoot = this->cvsRoot.value();
|
||||||
if (cvsRoot.isEmpty())
|
if (cvsRoot.isEmpty())
|
||||||
return args;
|
return args;
|
||||||
|
|
||||||
@@ -69,5 +91,65 @@ QStringList CvsSettings::addOptions(const QStringList &args) const
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
// CvsSettingsPage
|
||||||
} // namespace Cvs
|
|
||||||
|
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;
|
||||||
|
const Break nl;
|
||||||
|
|
||||||
|
Column {
|
||||||
|
Group {
|
||||||
|
Title(tr("Configuration")),
|
||||||
|
Form {
|
||||||
|
s.binaryPath, nl,
|
||||||
|
s.cvsRoot
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Group {
|
||||||
|
Title(tr("Miscellaneous")),
|
||||||
|
Form {
|
||||||
|
s.timeout, nl,
|
||||||
|
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
|
||||||
|
@@ -25,26 +25,34 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <coreplugin/dialogs/ioptionspage.h>
|
||||||
|
|
||||||
#include <vcsbase/vcsbaseclientsettings.h>
|
#include <vcsbase/vcsbaseclientsettings.h>
|
||||||
|
|
||||||
namespace Cvs {
|
namespace Cvs {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class CvsSettings : public VcsBase::VcsBaseClientSettings
|
class CvsSettings : public VcsBase::VcsBaseSettings
|
||||||
{
|
{
|
||||||
|
Q_DECLARE_TR_FUNCTIONS(Cvs::Internal::SettingsPage)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static const QLatin1String cvsRootKey;
|
Utils::StringAspect cvsRoot;
|
||||||
static const QLatin1String diffOptionsKey;
|
Utils::StringAspect diffOptions;
|
||||||
static const QLatin1String describeByCommitIdKey;
|
Utils::BoolAspect diffIgnoreWhiteSpace;
|
||||||
static const QLatin1String diffIgnoreWhiteSpaceKey;
|
Utils::BoolAspect diffIgnoreBlankLines;
|
||||||
static const QLatin1String diffIgnoreBlankLinesKey;
|
Utils::BoolAspect describeByCommitId;
|
||||||
|
|
||||||
CvsSettings();
|
CvsSettings();
|
||||||
|
|
||||||
int timeOutMs() const;
|
|
||||||
|
|
||||||
QStringList addOptions(const QStringList &args) const;
|
QStringList addOptions(const QStringList &args) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CvsSettingsPage final : public Core::IOptionsPage
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CvsSettingsPage(const std::function<void()> &onApply, CvsSettings *settings);
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Cvs
|
} // namespace Cvs
|
||||||
|
@@ -1,101 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** 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 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.
|
|
||||||
**
|
|
||||||
** 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.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "settingspage.h"
|
|
||||||
|
|
||||||
#include "cvssettings.h"
|
|
||||||
#include "ui_settingspage.h"
|
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
|
||||||
#include <vcsbase/vcsbaseconstants.h>
|
|
||||||
#include <utils/pathchooser.h>
|
|
||||||
|
|
||||||
#include <QCoreApplication>
|
|
||||||
|
|
||||||
using namespace Utils;
|
|
||||||
using namespace VcsBase;
|
|
||||||
|
|
||||||
namespace Cvs {
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
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:
|
|
||||||
Ui::SettingsPage m_ui;
|
|
||||||
std::function<void()> m_onApply;
|
|
||||||
CvsSettings *m_settings;
|
|
||||||
};
|
|
||||||
|
|
||||||
CvsSettingsPageWidget::CvsSettingsPageWidget(const std::function<void()> &onApply, CvsSettings *settings)
|
|
||||||
: m_onApply(onApply), m_settings(settings)
|
|
||||||
{
|
|
||||||
m_ui.setupUi(this);
|
|
||||||
m_ui.commandPathChooser->setExpectedKind(PathChooser::ExistingCommand);
|
|
||||||
m_ui.commandPathChooser->setHistoryCompleter(QLatin1String("Cvs.Command.History"));
|
|
||||||
m_ui.commandPathChooser->setPromptDialogTitle(tr("CVS Command"));
|
|
||||||
|
|
||||||
const VcsBaseClientSettings &s = *settings;
|
|
||||||
m_ui.commandPathChooser->setFilePath(s.binaryPath());
|
|
||||||
m_ui.rootLineEdit->setText(s.stringValue(CvsSettings::cvsRootKey));
|
|
||||||
m_ui.diffOptionsLineEdit->setText(s.stringValue(CvsSettings::diffOptionsKey));
|
|
||||||
m_ui.timeOutSpinBox->setValue(s.intValue(CvsSettings::timeoutKey));
|
|
||||||
m_ui.promptToSubmitCheckBox->setChecked(s.boolValue(CvsSettings::promptOnSubmitKey));
|
|
||||||
m_ui.describeByCommitIdCheckBox->setChecked(s.boolValue(CvsSettings::describeByCommitIdKey));
|
|
||||||
}
|
|
||||||
|
|
||||||
void CvsSettingsPageWidget::apply()
|
|
||||||
{
|
|
||||||
CvsSettings rc = *m_settings;
|
|
||||||
rc.setValue(CvsSettings::binaryPathKey, m_ui.commandPathChooser->rawPath());
|
|
||||||
rc.setValue(CvsSettings::cvsRootKey, m_ui.rootLineEdit->text());
|
|
||||||
rc.setValue(CvsSettings::diffOptionsKey, m_ui.diffOptionsLineEdit->text());
|
|
||||||
rc.setValue(CvsSettings::timeoutKey, m_ui.timeOutSpinBox->value());
|
|
||||||
rc.setValue(CvsSettings::promptOnSubmitKey, m_ui.promptToSubmitCheckBox->isChecked());
|
|
||||||
rc.setValue(CvsSettings::describeByCommitIdKey, m_ui.describeByCommitIdCheckBox->isChecked());
|
|
||||||
|
|
||||||
if (rc == *m_settings)
|
|
||||||
return;
|
|
||||||
|
|
||||||
*m_settings = rc;
|
|
||||||
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
|
|
@@ -1,42 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** 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 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.
|
|
||||||
**
|
|
||||||
** 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.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <coreplugin/dialogs/ioptionspage.h>
|
|
||||||
|
|
||||||
namespace Cvs {
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class CvsSettings;
|
|
||||||
|
|
||||||
class CvsSettingsPage final : public Core::IOptionsPage
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
CvsSettingsPage(const std::function<void()> &onApply, CvsSettings *settings);
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Cvs
|
|
||||||
} // namespace Internal
|
|
@@ -1,144 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>Cvs::Internal::SettingsPage</class>
|
|
||||||
<widget class="QWidget" name="Cvs::Internal::SettingsPage">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>447</width>
|
|
||||||
<height>281</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="configGroupBox">
|
|
||||||
<property name="title">
|
|
||||||
<string>Configuration</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QFormLayout" name="formLayout_2">
|
|
||||||
<property name="fieldGrowthPolicy">
|
|
||||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="commandLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>CVS command:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="Utils::PathChooser" name="commandPathChooser" native="true"/>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="rootLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>CVS root:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QLineEdit" name="rootLineEdit"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="miscGroupBox">
|
|
||||||
<property name="title">
|
|
||||||
<string>Miscellaneous</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QFormLayout" name="formLayout">
|
|
||||||
<property name="fieldGrowthPolicy">
|
|
||||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
|
||||||
</property>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="diffOptionsLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Diff options:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QLineEdit" name="diffOptionsLineEdit"/>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0" colspan="2">
|
|
||||||
<widget class="QCheckBox" name="promptToSubmitCheckBox">
|
|
||||||
<property name="text">
|
|
||||||
<string>Prompt on submit</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0" colspan="2">
|
|
||||||
<widget class="QCheckBox" name="describeByCommitIdCheckBox">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>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.</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Describe all files matching commit id</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="timeOutLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Timeout:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QSpinBox" name="timeOutSpinBox">
|
|
||||||
<property name="suffix">
|
|
||||||
<string>s</string>
|
|
||||||
</property>
|
|
||||||
<property name="minimum">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>360</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>30</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<customwidgets>
|
|
||||||
<customwidget>
|
|
||||||
<class>Utils::PathChooser</class>
|
|
||||||
<extends>QWidget</extends>
|
|
||||||
<header location="global">utils/pathchooser.h</header>
|
|
||||||
<container>1</container>
|
|
||||||
<slots>
|
|
||||||
<signal>editingFinished()</signal>
|
|
||||||
<signal>browsingFinished()</signal>
|
|
||||||
</slots>
|
|
||||||
</customwidget>
|
|
||||||
</customwidgets>
|
|
||||||
<tabstops>
|
|
||||||
<tabstop>rootLineEdit</tabstop>
|
|
||||||
<tabstop>timeOutSpinBox</tabstop>
|
|
||||||
<tabstop>diffOptionsLineEdit</tabstop>
|
|
||||||
<tabstop>promptToSubmitCheckBox</tabstop>
|
|
||||||
<tabstop>describeByCommitIdCheckBox</tabstop>
|
|
||||||
</tabstops>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
@@ -267,8 +267,8 @@ void VcsBaseClientImpl::saveSettings()
|
|||||||
m_baseSettings->writeSettings(Core::ICore::settings());
|
m_baseSettings->writeSettings(Core::ICore::settings());
|
||||||
}
|
}
|
||||||
|
|
||||||
VcsBaseClient::VcsBaseClient(VcsBaseClientSettings *settings) :
|
VcsBaseClient::VcsBaseClient(VcsBaseClientSettings *settings, VcsBaseSettings *baseSettings) :
|
||||||
VcsBaseClientImpl(settings)
|
VcsBaseClientImpl(settings, baseSettings)
|
||||||
{
|
{
|
||||||
qRegisterMetaType<QVariant>();
|
qRegisterMetaType<QVariant>();
|
||||||
}
|
}
|
||||||
|
@@ -148,7 +148,8 @@ public:
|
|||||||
QString file;
|
QString file;
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit VcsBaseClient(VcsBaseClientSettings *settings);
|
explicit VcsBaseClient(VcsBaseClientSettings *settings,
|
||||||
|
VcsBaseSettings *baseSettings = nullptr);
|
||||||
|
|
||||||
virtual bool synchronousCreateRepository(const QString &workingDir,
|
virtual bool synchronousCreateRepository(const QString &workingDir,
|
||||||
const QStringList &extraOptions = QStringList());
|
const QStringList &extraOptions = QStringList());
|
||||||
|
@@ -514,12 +514,13 @@ static QString withUnusedMnemonic(QString string, const QList<QPushButton *> &ot
|
|||||||
|
|
||||||
VcsBaseSubmitEditor::PromptSubmitResult
|
VcsBaseSubmitEditor::PromptSubmitResult
|
||||||
VcsBaseSubmitEditor::promptSubmit(VcsBasePluginPrivate *plugin,
|
VcsBaseSubmitEditor::promptSubmit(VcsBasePluginPrivate *plugin,
|
||||||
bool *promptSetting,
|
bool *promptSettingOld,
|
||||||
bool forcePrompt,
|
bool forcePrompt,
|
||||||
bool canCommitOnFailure)
|
bool canCommitOnFailure,
|
||||||
|
BoolAspect *promptSetting)
|
||||||
{
|
{
|
||||||
bool dummySetting = false;
|
BoolAspect dummySetting;
|
||||||
if (!promptSetting)
|
if (!promptSetting && !promptSettingOld)
|
||||||
promptSetting = &dummySetting;
|
promptSetting = &dummySetting;
|
||||||
auto submitWidget = static_cast<SubmitEditorWidget *>(this->widget());
|
auto submitWidget = static_cast<SubmitEditorWidget *>(this->widget());
|
||||||
|
|
||||||
@@ -530,7 +531,8 @@ VcsBaseSubmitEditor::PromptSubmitResult
|
|||||||
|
|
||||||
QString errorMessage;
|
QString errorMessage;
|
||||||
|
|
||||||
const bool prompt = forcePrompt || *promptSetting;
|
const bool value = promptSettingOld ? *promptSettingOld : promptSetting->value();
|
||||||
|
const bool prompt = forcePrompt || value;
|
||||||
|
|
||||||
// Pop up a message depending on whether the check succeeded and the
|
// Pop up a message depending on whether the check succeeded and the
|
||||||
// user wants to be prompted
|
// user wants to be prompted
|
||||||
@@ -552,9 +554,9 @@ VcsBaseSubmitEditor::PromptSubmitResult
|
|||||||
}
|
}
|
||||||
mb.setText(message);
|
mb.setText(message);
|
||||||
mb.setCheckBoxText(tr("Prompt to %1").arg(commitName.toLower()));
|
mb.setCheckBoxText(tr("Prompt to %1").arg(commitName.toLower()));
|
||||||
mb.setChecked(*promptSetting);
|
mb.setChecked(value);
|
||||||
// Provide check box to turn off prompt ONLY if it was not forced
|
// Provide check box to turn off prompt ONLY if it was not forced
|
||||||
mb.setCheckBoxVisible(*promptSetting && !forcePrompt);
|
mb.setCheckBoxVisible(value && !forcePrompt);
|
||||||
QDialogButtonBox::StandardButtons buttons = QDialogButtonBox::Close | QDialogButtonBox::Cancel;
|
QDialogButtonBox::StandardButtons buttons = QDialogButtonBox::Close | QDialogButtonBox::Cancel;
|
||||||
if (canCommit || canCommitOnFailure)
|
if (canCommit || canCommitOnFailure)
|
||||||
buttons |= QDialogButtonBox::Ok;
|
buttons |= QDialogButtonBox::Ok;
|
||||||
@@ -570,8 +572,12 @@ VcsBaseSubmitEditor::PromptSubmitResult
|
|||||||
commitButton->setText(withUnusedMnemonic(commitName,
|
commitButton->setText(withUnusedMnemonic(commitName,
|
||||||
{cancelButton, mb.button(QDialogButtonBox::Close)}));
|
{cancelButton, mb.button(QDialogButtonBox::Close)}));
|
||||||
}
|
}
|
||||||
if (mb.exec() == QDialog::Accepted)
|
if (mb.exec() == QDialog::Accepted) {
|
||||||
*promptSetting = mb.isChecked();
|
if (promptSettingOld)
|
||||||
|
*promptSettingOld = mb.isChecked();
|
||||||
|
else
|
||||||
|
promptSetting->setValue(mb.isChecked());
|
||||||
|
}
|
||||||
QAbstractButton *chosen = mb.clickedButton();
|
QAbstractButton *chosen = mb.clickedButton();
|
||||||
if (!chosen || chosen == cancelButton)
|
if (!chosen || chosen == cancelButton)
|
||||||
return SubmitCanceled;
|
return SubmitCanceled;
|
||||||
|
@@ -29,6 +29,8 @@
|
|||||||
|
|
||||||
#include <coreplugin/editormanager/ieditor.h>
|
#include <coreplugin/editormanager/ieditor.h>
|
||||||
|
|
||||||
|
#include <utils/aspects.h>
|
||||||
|
|
||||||
#include <QAbstractItemView>
|
#include <QAbstractItemView>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
@@ -85,9 +87,10 @@ public:
|
|||||||
// prompt setting. The user can uncheck it from the message box.
|
// prompt setting. The user can uncheck it from the message box.
|
||||||
enum PromptSubmitResult { SubmitConfirmed, SubmitCanceled, SubmitDiscarded };
|
enum PromptSubmitResult { SubmitConfirmed, SubmitCanceled, SubmitDiscarded };
|
||||||
PromptSubmitResult promptSubmit(VcsBasePluginPrivate *plugin,
|
PromptSubmitResult promptSubmit(VcsBasePluginPrivate *plugin,
|
||||||
bool *promptSetting,
|
bool *promptSettingOld,
|
||||||
bool forcePrompt = false,
|
bool forcePrompt = false,
|
||||||
bool canCommitOnFailure = true);
|
bool canCommitOnFailure = true,
|
||||||
|
Utils::BoolAspect *promptSetting = nullptr);
|
||||||
|
|
||||||
QAbstractItemView::SelectionMode fileListSelectionMode() const;
|
QAbstractItemView::SelectionMode fileListSelectionMode() const;
|
||||||
void setFileListSelectionMode(QAbstractItemView::SelectionMode sm);
|
void setFileListSelectionMode(QAbstractItemView::SelectionMode sm);
|
||||||
|
Reference in New Issue
Block a user