forked from qt-creator/qt-creator
Version control: Compile with QT_NO_CAST_FROM_ASCII.
Change-Id: I85c007045efdb207f397b42fbce7a554ac9c9819 Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
committed by
Tobias Hunger
parent
cdae5f2102
commit
e2ace515e2
@@ -152,7 +152,7 @@ public:
|
||||
}
|
||||
return names;
|
||||
}
|
||||
return QStringList(fullName().join(QString('/')));
|
||||
return QStringList(fullName().join(QString(QLatin1Char('/'))));
|
||||
}
|
||||
|
||||
BranchNode *parent;
|
||||
@@ -371,7 +371,7 @@ QString BranchModel::branchName(const QModelIndex &idx) const
|
||||
if (!node->isLeaf())
|
||||
return QString();
|
||||
QStringList path = node->fullName();
|
||||
return path.join(QString('/'));
|
||||
return path.join(QString(QLatin1Char('/')));
|
||||
}
|
||||
|
||||
QStringList BranchModel::localBranchNames() const
|
||||
@@ -520,7 +520,7 @@ QModelIndex BranchModel::addBranch(const QString &branchName, bool track, const
|
||||
output = toolTip(branchName); // abuse toolTip to get the data;-)
|
||||
QStringList lines = output.split(QLatin1Char('\n'));
|
||||
foreach (const QString &l, lines) {
|
||||
if (l.startsWith("commit ")) {
|
||||
if (l.startsWith(QLatin1String("commit "))) {
|
||||
newNode->sha = l.mid(7, 8);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ bool CloneWizardPagePrivate::urlIsLocal(const QString &url)
|
||||
{
|
||||
if (url.startsWith(QLatin1String("file://"))
|
||||
|| url.startsWith(QLatin1Char('/'))
|
||||
|| (url.at(0).isLetter() && url.at(1) == QChar(':') && url.at(2) == QChar('\\')))
|
||||
|| (url.at(0).isLetter() && url.at(1) == QLatin1Char(':') && url.at(2) == QLatin1Char('\\')))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
@@ -103,10 +103,9 @@ QString CloneWizardPage::directoryFromRepository(const QString &urlIn) const
|
||||
/* Try to figure out a good directory name from something like:
|
||||
* 'user@host:qt/qt.git', 'http://host/qt/qt.git' 'local repo'
|
||||
* ------> 'qt' . */
|
||||
|
||||
QString url = urlIn.trimmed().replace(QChar('\\'), QChar('/'));
|
||||
|
||||
const QChar slash = QLatin1Char('/');
|
||||
QString url = urlIn.trimmed().replace(QLatin1Char('\\'), slash);
|
||||
|
||||
// remove host
|
||||
const int protocolDelimiterPos = url.indexOf(d->protocolDelimiter); // "://"
|
||||
const int startRepoSearchPos = protocolDelimiterPos == -1 ? 0 : protocolDelimiterPos + d->protocolDelimiter.size();
|
||||
|
||||
@@ -116,7 +116,7 @@ static bool checkLine(const QString &stateInfo, const QString &file, QList<Commi
|
||||
QTC_ASSERT(stateInfo.count() == 2, return false);
|
||||
QTC_ASSERT(files, return false);
|
||||
|
||||
if (stateInfo == "??") {
|
||||
if (stateInfo == QLatin1String("??")) {
|
||||
files->append(qMakePair(CommitData::UntrackedFile, file));
|
||||
return true;
|
||||
}
|
||||
@@ -157,12 +157,12 @@ bool CommitData::parseFilesFromStatus(const QString &output)
|
||||
if (line.isEmpty())
|
||||
continue;
|
||||
|
||||
if (line.startsWith("## ")) {
|
||||
if (line.startsWith(QLatin1String("## "))) {
|
||||
// Branch indication:
|
||||
panelInfo.branch = line.mid(3);
|
||||
continue;
|
||||
}
|
||||
QTC_ASSERT(line.at(2) == ' ', continue);
|
||||
QTC_ASSERT(line.at(2) == QLatin1Char(' '), continue);
|
||||
if (!checkLine(line.mid(0, 2), line.mid(3), &files))
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
TEMPLATE = lib
|
||||
TARGET = ScmGit
|
||||
DEFINES += QT_NO_CAST_FROM_ASCII
|
||||
include(../../qtcreatorplugin.pri)
|
||||
include(../../plugins/projectexplorer/projectexplorer.pri)
|
||||
include(../../plugins/texteditor/texteditor.pri)
|
||||
|
||||
@@ -99,7 +99,7 @@ public:
|
||||
m_patienceButton = addToggleButton(QLatin1String("--patience"), tr("Patience"),
|
||||
tr("Use the patience algorithm for calculating the differences."));
|
||||
mapSetting(m_patienceButton, client->settings()->boolPointer(GitSettings::diffPatienceKey));
|
||||
m_ignoreWSButton = addToggleButton("--ignore-space-change", tr("Ignore Whitespace"),
|
||||
m_ignoreWSButton = addToggleButton(QLatin1String("--ignore-space-change"), tr("Ignore Whitespace"),
|
||||
tr("Ignore whitespace only changes."));
|
||||
mapSetting(m_ignoreWSButton, m_client->settings()->boolPointer(GitSettings::ignoreSpaceChangesInDiffKey));
|
||||
|
||||
@@ -229,7 +229,7 @@ public:
|
||||
mapSetting(addToggleButton(QString(), tr("Omit Date"),
|
||||
tr("Hide the date of a change from the output.")),
|
||||
m_client->settings()->boolPointer(GitSettings::omitAnnotationDateKey));
|
||||
mapSetting(addToggleButton(QString("-w"), tr("Ignore Whitespace"),
|
||||
mapSetting(addToggleButton(QLatin1String("-w"), tr("Ignore Whitespace"),
|
||||
tr("Ignore whitespace only changes.")),
|
||||
m_client->settings()->boolPointer(GitSettings::ignoreSpaceChangesInBlameKey));
|
||||
|
||||
@@ -385,7 +385,7 @@ QString GitClient::findRepositoryForDirectory(const QString &dir)
|
||||
QStringList arguments;
|
||||
arguments << QLatin1String("rev-parse") << QLatin1String("--show-toplevel");
|
||||
fullySynchronousGit(directory.absolutePath(), arguments, &outputText, 0, false);
|
||||
return outputText.trimmed();
|
||||
return QString::fromLocal8Bit(outputText.trimmed());
|
||||
} else {
|
||||
// Check for ".git/config"
|
||||
const QString checkFile = QLatin1String(GIT_DIRECTORY) + QLatin1String("/config");
|
||||
@@ -612,7 +612,7 @@ void GitClient::log(const QString &workingDirectory, const QStringList &fileName
|
||||
bool enableAnnotationContextMenu, const QStringList &args)
|
||||
{
|
||||
const QString msgArg = fileNames.empty() ? workingDirectory :
|
||||
fileNames.join(QString(", "));
|
||||
fileNames.join(QLatin1String(", "));
|
||||
const QString title = tr("Git Log \"%1\"").arg(msgArg);
|
||||
const Core::Id editorId = Git::Constants::GIT_LOG_EDITOR_ID;
|
||||
const QString sourceFile = VcsBase::VcsBaseEditorWidget::getSource(workingDirectory, fileNames);
|
||||
@@ -1559,14 +1559,14 @@ QStringList GitClient::synchronousRepositoryBranches(const QString &repositoryUR
|
||||
VcsBase::VcsBasePlugin::SuppressFailMessageInLogWindow;
|
||||
const Utils::SynchronousProcessResponse resp = synchronousGit(QString(), arguments, flags);
|
||||
QStringList branches;
|
||||
branches << "<detached HEAD>";
|
||||
branches << QLatin1String("<detached HEAD>");
|
||||
QString headSha;
|
||||
if (resp.result == Utils::SynchronousProcessResponse::Finished) {
|
||||
// split "82bfad2f51d34e98b18982211c82220b8db049b<tab>refs/heads/master"
|
||||
foreach(const QString &line, resp.stdOut.split(QLatin1Char('\n'))) {
|
||||
if (line.endsWith("\tHEAD")) {
|
||||
if (line.endsWith(QLatin1String("\tHEAD"))) {
|
||||
QTC_CHECK(headSha.isNull());
|
||||
headSha = line.left(line.indexOf(QChar('\t')));
|
||||
headSha = line.left(line.indexOf(QLatin1Char('\t')));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1588,14 +1588,14 @@ void GitClient::launchGitK(const QString &workingDirectory)
|
||||
{
|
||||
const QFileInfo binaryInfo(gitBinaryPath());
|
||||
QDir foundBinDir(binaryInfo.dir());
|
||||
const bool foundBinDirIsCmdDir = foundBinDir.dirName() == "cmd";
|
||||
const bool foundBinDirIsCmdDir = foundBinDir.dirName() == QLatin1String("cmd");
|
||||
QProcessEnvironment env = processEnvironment();
|
||||
if (tryLauchingGitK(env, workingDirectory, foundBinDir.path(), foundBinDirIsCmdDir))
|
||||
return;
|
||||
if (!foundBinDirIsCmdDir)
|
||||
return;
|
||||
foundBinDir.cdUp();
|
||||
tryLauchingGitK(env, workingDirectory, foundBinDir.path() + "/bin", false);
|
||||
tryLauchingGitK(env, workingDirectory, foundBinDir.path() + QLatin1String("/bin"), false);
|
||||
}
|
||||
|
||||
bool GitClient::tryLauchingGitK(const QProcessEnvironment &env,
|
||||
@@ -1739,7 +1739,9 @@ bool GitClient::getCommitData(const QString &workingDirectory,
|
||||
if (amend) {
|
||||
// Amend: get last commit data as "SHA1@message".
|
||||
QStringList args(QLatin1String("log"));
|
||||
const QString format = synchronousGitVersion(true) > 0x010701 ? "%h@%B" : "%h@%s%n%n%b";
|
||||
const QString format = synchronousGitVersion(true) > 0x010701 ?
|
||||
QLatin1String("%h@%B") :
|
||||
QLatin1String("%h@%s%n%n%b");
|
||||
args << QLatin1String("--max-count=1") << QLatin1String("--pretty=format:") + format;
|
||||
QTextCodec *codec = QTextCodec::codecForName(commitData->commitEncoding.toLocal8Bit());
|
||||
const Utils::SynchronousProcessResponse sp = synchronousGit(repoDirectory, args, 0, codec);
|
||||
@@ -2228,7 +2230,7 @@ bool GitClient::cloneRepository(const QString &directory,const QByteArray &url)
|
||||
return false;
|
||||
|
||||
QStringList arguments(QLatin1String("remote"));
|
||||
arguments << QLatin1String("add") << QLatin1String("origin") << url;
|
||||
arguments << QLatin1String("add") << QLatin1String("origin") << QLatin1String(url);
|
||||
if (!fullySynchronousGit(workingDirectory.path(), arguments, 0, 0, true))
|
||||
return false;
|
||||
|
||||
@@ -2256,7 +2258,7 @@ bool GitClient::cloneRepository(const QString &directory,const QByteArray &url)
|
||||
return true;
|
||||
} else {
|
||||
QStringList arguments(QLatin1String("clone"));
|
||||
arguments << url << workingDirectory.dirName();
|
||||
arguments << QLatin1String(url) << workingDirectory.dirName();
|
||||
workingDirectory.cdUp();
|
||||
const Utils::SynchronousProcessResponse resp =
|
||||
synchronousGit(workingDirectory.path(), arguments, flags);
|
||||
@@ -2326,7 +2328,7 @@ unsigned GitClient::synchronousGitVersion(bool silent, QString *errorMessage) co
|
||||
// run git --version
|
||||
QByteArray outputText;
|
||||
QByteArray errorText;
|
||||
const bool rc = fullySynchronousGit(QString(), QStringList("--version"), &outputText, &errorText);
|
||||
const bool rc = fullySynchronousGit(QString(), QStringList(QLatin1String("--version")), &outputText, &errorText);
|
||||
if (!rc) {
|
||||
const QString msg = tr("Cannot determine git version: %1").arg(commandOutputFromLocal8Bit(errorText));
|
||||
if (errorMessage) {
|
||||
|
||||
@@ -98,7 +98,7 @@ GitoriousHostWidget::GitoriousHostWidget(QWidget *parent) :
|
||||
ui->browseToolButton->setIcon(style()->standardIcon(QStyle::SP_MessageBoxInformation));
|
||||
connect(ui->browseToolButton, SIGNAL(clicked()), this, SLOT(slotBrowse()));
|
||||
ui->browseToolButton->setEnabled(false);
|
||||
ui->deleteToolButton->setIcon(QIcon(Core::Constants::ICON_MINUS));
|
||||
ui->deleteToolButton->setIcon(QIcon(QLatin1String(Core::Constants::ICON_MINUS)));
|
||||
connect(ui->deleteToolButton, SIGNAL(clicked()), this, SLOT(slotDelete()));
|
||||
ui->deleteToolButton->setEnabled(false);
|
||||
|
||||
|
||||
@@ -378,7 +378,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
Core::Id("Git.DiffProject"),
|
||||
globalcontext, true,
|
||||
SLOT(diffCurrentProject()));
|
||||
parameterActionCommand.second->setDefaultKeySequence(QKeySequence("Alt+G,Alt+Shift+D"));
|
||||
parameterActionCommand.second->setDefaultKeySequence(QKeySequence(tr("Alt+G,Alt+Shift+D")));
|
||||
|
||||
parameterActionCommand
|
||||
= createProjectAction(actionManager, gitContainer,
|
||||
|
||||
@@ -39,10 +39,10 @@ namespace Internal {
|
||||
// Parse a branch line: " *name sha description".
|
||||
bool RemoteModel::Remote::parse(const QString &line)
|
||||
{
|
||||
if (!line.endsWith(" (fetch)"))
|
||||
if (!line.endsWith(QLatin1String(" (fetch)")))
|
||||
return false;
|
||||
|
||||
QStringList tokens = line.split(QRegExp("\\s"), QString::SkipEmptyParts);
|
||||
QStringList tokens = line.split(QRegExp(QLatin1String("\\s")), QString::SkipEmptyParts);
|
||||
if (tokens.count() != 3)
|
||||
return false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user