Commit e2ace515 authored by Friedemann Kleint's avatar Friedemann Kleint Committed by Tobias Hunger

Version control: Compile with QT_NO_CAST_FROM_ASCII.

Change-Id: I85c007045efdb207f397b42fbce7a554ac9c9819
Reviewed-by: default avatarTobias Hunger <tobias.hunger@nokia.com>
parent cdae5f21
......@@ -2,6 +2,7 @@ TARGET = Bazaar
TEMPLATE = lib
include(../../qtcreatorplugin.pri)
include(bazaar_dependencies.pri)
DEFINES += QT_NO_CAST_FROM_ASCII
SOURCES += \
bazaarclient.cpp \
bazaarcontrol.cpp \
......
......@@ -62,9 +62,8 @@ bool BazaarClient::synchronousSetUserId()
{
QStringList args;
args << QLatin1String("whoami")
<< QString("%1 <%2>")
.arg(settings()->stringValue(BazaarSettings::userNameKey))
.arg(settings()->stringValue(BazaarSettings::userEmailKey));
<< (settings()->stringValue(BazaarSettings::userNameKey) + QLatin1String(" <")
+ settings()->stringValue(BazaarSettings::userEmailKey) + QLatin1Char('>'));
QByteArray stdOut;
return vcsFullySynchronousExec(QDir::currentPath(), args, &stdOut);
}
......@@ -80,8 +79,8 @@ BranchInfo BazaarClient::synchronousBranchQuery(const QString &repositoryRoot) c
QTextStream ts(&branchConfFile);
QString branchLocation;
QString isBranchBound;
const QRegExp branchLocationRx("bound_location\\s*=\\s*(.+)$");
const QRegExp isBranchBoundRx("bound\\s*=\\s*(.+)$");
const QRegExp branchLocationRx(QLatin1String("bound_location\\s*=\\s*(.+)$"));
const QRegExp isBranchBoundRx(QLatin1String("bound\\s*=\\s*(.+)$"));
while (!ts.atEnd() && (branchLocation.isEmpty() || isBranchBound.isEmpty())) {
const QString line = ts.readLine();
if (branchLocationRx.indexIn(line) != -1)
......
......@@ -153,7 +153,7 @@ QString BazaarCommitWidget::committer() const
QStringList BazaarCommitWidget::fixedBugs() const
{
return m_bazaarCommitPanelUi.fixedBugsLineEdit->text().split(QRegExp("\\s+"));
return m_bazaarCommitPanelUi.fixedBugsLineEdit->text().split(QRegExp(QLatin1String("\\s+")));
}
bool BazaarCommitWidget::isLocalOptionEnabled() const
......
......@@ -388,7 +388,7 @@ void BazaarPlugin::logRepository()
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
QStringList extraOptions;
extraOptions += QString("--limit=%1").arg(settings().intValue(BazaarSettings::logCountKey));
extraOptions += QLatin1String("--limit=") + QString::number(settings().intValue(BazaarSettings::logCountKey));
m_client->log(state.topLevel(), QStringList(), extraOptions);
}
......@@ -647,7 +647,7 @@ bool BazaarPlugin::submitEditorAboutToClose(VcsBase::VcsBaseSubmitEditor *submit
//rewrite entries of the form 'file => newfile' to 'newfile' because
//this would mess the commit command
for (QStringList::iterator iFile = files.begin(); iFile != files.end(); ++iFile) {
const QStringList parts = iFile->split(" => ", QString::SkipEmptyParts);
const QStringList parts = iFile->split(QLatin1String(" => "), QString::SkipEmptyParts);
if (!parts.isEmpty())
*iFile = parts.last();
}
......
......@@ -8,6 +8,7 @@ include(../../plugins/coreplugin/coreplugin.pri)
include(../../plugins/vcsbase/vcsbase.pri)
include(../../libs/utils/utils.pri)
DEFINES += QT_NO_CAST_FROM_ASCII
HEADERS += annotationhighlighter.h \
cvsplugin.h \
cvscontrol.h \
......
......@@ -1293,7 +1293,7 @@ IEditor *CvsPlugin::showOutputInEditor(const QString& title, const QString &outp
qDebug() << "CVSPlugin::showOutputInEditor" << title << id.name()
<< "source=" << source << "Size= " << output.size() << " Type=" << editorType << debugCodec(codec);
QString s = title;
IEditor *editor = EditorManager::instance()->openEditorWithContents(id, &s, output.toLocal8Bit());
IEditor *editor = EditorManager::instance()->openEditorWithContents(id, &s, output);
connect(editor, SIGNAL(annotateRevisionRequested(QString,QString,int)),
this, SLOT(vcsAnnotate(QString,QString,int)));
CvsEditor *e = qobject_cast<CvsEditor*>(editor->widget());
......
......@@ -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;
}
......
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;
......
......@@ -2,6 +2,7 @@ TARGET = Mercurial
TEMPLATE = lib
include(../../qtcreatorplugin.pri)
include(mercurial_dependencies.pri)
DEFINES += QT_NO_CAST_FROM_ASCII
SOURCES += mercurialplugin.cpp \
optionspage.cpp \
mercurialcontrol.cpp \
......
......@@ -111,8 +111,9 @@ bool MercurialClient::synchronousClone(const QString &workingDir,
}
// By now, there is no hgrc file -> create it
Utils::FileSaver saver(workingDirectory.path()+"/.hg/hgrc");
saver.write(QString("[paths]\ndefault = %1\n").arg(dstLocation).toUtf8());
Utils::FileSaver saver(workingDirectory.path() + QLatin1String("/.hg/hgrc"));
const QString hgrc = QLatin1String("[paths]\ndefault = ") + dstLocation + QLatin1Char('\n');
saver.write(hgrc.toUtf8());
if (!saver.finalize()) {
VcsBase::VcsBaseOutputWindow::instance()->appendError(saver.errorString());
return false;
......
......@@ -168,7 +168,7 @@ bool MercurialControl::sccManaged(const QString &filename)
bool MercurialControl::vcsCheckout(const QString &directory, const QByteArray &url)
{
return mercurialClient->synchronousClone(QString(), directory, url);
return mercurialClient->synchronousClone(QString(), directory, QLatin1String(url));
}
QString MercurialControl::vcsGetRepositoryURL(const QString &directory)
......
......@@ -41,7 +41,7 @@ PendingChangesDialog::PendingChangesDialog(const QString &data, QWidget *parent)
{
m_ui.setupUi(this);
if (!data.isEmpty()) {
QRegExp r("Change\\s(\\d+).*\\s\\*pending\\*\\s(.+)\n");
QRegExp r(QLatin1String("Change\\s(\\d+).*\\s\\*pending\\*\\s(.+)\n"));
r.setMinimal(true);
int pos = 0;
QListWidgetItem *item;
......
......@@ -4,6 +4,8 @@ TARGET = Perforce
include(../../qtcreatorplugin.pri)
include(perforce_dependencies.pri)
DEFINES += QT_NO_CAST_FROM_ASCII
HEADERS += \
perforceplugin.h \
perforcechecker.h \
......
......@@ -883,7 +883,8 @@ bool PerforcePlugin::managesDirectoryFstat(const QString &directory)
args << QLatin1String("fstat") << QLatin1String("-m1") << perforceRelativeFileArguments(relativeDirArgs);
const PerforceResponse result = runP4Cmd(m_settings.topLevel(), args,
RunFullySynchronous);
managed = result.stdOut.contains("depotFile") || result.stdErr.contains("... - no such file(s)");
managed = result.stdOut.contains(QLatin1String("depotFile"))
|| result.stdErr.contains(QLatin1String("... - no such file(s)"));
} while(false);
m_managedDirectoryCache.insert(directory, managed);
......
......@@ -8,6 +8,8 @@ include(../../plugins/coreplugin/coreplugin.pri)
include(../../plugins/vcsbase/vcsbase.pri)
include(../../libs/utils/utils.pri)
DEFINES += QT_NO_CAST_FROM_ASCII
HEADERS += annotationhighlighter.h \
subversionplugin.h \
subversioncontrol.h \
......
......@@ -1304,14 +1304,14 @@ bool SubversionPlugin::vcsCheckout(const QString &directory, const QByteArray &u
// authentication will always fail (if the username and password data are not stored locally),
// if for example we are logging into a new host for the first time using svn. There seems to
// be a bug in subversion, so this might get fixed in the future.
tempUrl.setUserInfo("");
args << tempUrl.toEncoded() << directory;
tempUrl.setUserInfo(QString());
args << QLatin1String(tempUrl.toEncoded()) << directory;
const SubversionResponse response = runSvn(directory, username, password, args,
m_settings.longTimeOutMS(),
VcsBase::VcsBasePlugin::SshPasswordPrompt);
return !response.error;
} else {
args << url << directory;
args << QLatin1String(url) << directory;
const SubversionResponse response = runSvn(directory, args, m_settings.longTimeOutMS(),
VcsBase::VcsBasePlugin::SshPasswordPrompt);
return !response.error;
......
......@@ -53,7 +53,7 @@ public:
BaseVcsSubmitEditorFactoryPrivate::BaseVcsSubmitEditorFactoryPrivate(const VcsBaseSubmitEditorParameters *parameters) :
m_parameters(parameters),
m_id(parameters->id),
m_displayName(parameters->displayName),
m_displayName(QLatin1String(parameters->displayName)),
m_mimeTypes(QLatin1String(parameters->mimeType))
{
}
......
TEMPLATE = lib
TARGET = VCSBase
DEFINES += VCSBASE_LIBRARY
DEFINES += VCSBASE_LIBRARY QT_NO_CAST_FROM_ASCII
include(../../qtcreatorplugin.pri)
include(vcsbase_dependencies.pri)
HEADERS += vcsbase_global.h \
......
......@@ -1397,7 +1397,7 @@ void VcsBaseEditorWidget::slotPaste()
// Retrieve service by soft dependency.
QObject *pasteService =
ExtensionSystem::PluginManager::instance()
->getObjectByClassName("CodePaster::CodePasterService");
->getObjectByClassName(QLatin1String("CodePaster::CodePasterService"));
if (pasteService) {
QMetaObject::invokeMethod(pasteService, "postCurrentEditor");
} else {
......
......@@ -823,14 +823,14 @@ static SynchronousProcessResponse runVcsFullySynchronously(const QString &workin
&stdOut, &stdErr, true);
if (!stdErr.isEmpty()) {
response.stdErr = QString::fromLocal8Bit(stdErr).remove('\r');
response.stdErr = QString::fromLocal8Bit(stdErr).remove(QLatin1Char('\r'));
if (!(flags & VcsBasePlugin::SuppressStdErrInLogWindow))
outputWindow->append(response.stdErr);
}
if (!stdOut.isEmpty()) {
response.stdOut = (outputCodec ? outputCodec->toUnicode(stdOut) : QString::fromLocal8Bit(stdOut))
.remove('\r');
.remove(QLatin1Char('\r'));
if (flags & VcsBasePlugin::ShowStdOutInLogWindow)
outputWindow->append(response.stdOut);
}
......
......@@ -510,14 +510,14 @@ void VcsBaseSubmitEditor::setFileModel(QAbstractItemModel *m, const QString &rep
if ((sym->isClass() || sym->isFunction() || sym->isNamespace())
&& (symId != 0 && acceptsWordForCompletion(symId->chars())))
{
uniqueSymbols.insert(symId->chars());
uniqueSymbols.insert(QString::fromUtf8(symId->chars()));
}
// Handle specific case : get "Foo" in "void Foo::function() {}"
if (sym->isFunction() && !sym->asFunction()->isDeclaration()) {
const char *className = belongingClassName(sym->asFunction());
if (acceptsWordForCompletion(className))
uniqueSymbols.insert(className);
uniqueSymbols.insert(QString::fromUtf8(className));
}
++symPtr;
......
......@@ -94,7 +94,8 @@ bool VcsConfigurationPage::isComplete() const
void VcsConfigurationPage::openConfiguration()
{
Core::ICore::showOptionsDialog(VcsBase::Constants::VCS_SETTINGS_CATEGORY, d->m_versionControl->id().toString());
Core::ICore::showOptionsDialog(QLatin1String(VcsBase::Constants::VCS_SETTINGS_CATEGORY),
d->m_versionControl->id().toString());
}
} // namespace VcsBase
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment