Perforce: Fix warnings and modernize

Change-Id: Id43718869aaf2bc24e6a6614bcddcc35715502fe
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Eike Ziller
2018-08-28 10:24:13 +02:00
parent f06f9122d7
commit bd59472f40
5 changed files with 20 additions and 18 deletions

View File

@@ -167,7 +167,7 @@ PerforceResponse::PerforceResponse() :
{
}
PerforcePlugin *PerforcePlugin::m_instance = NULL;
PerforcePlugin *PerforcePlugin::m_instance = nullptr;
static const VcsBaseSubmitEditorParameters submitParameters = {
SUBMIT_MIMETYPE,
@@ -847,7 +847,7 @@ bool PerforcePlugin::vcsOpen(const QString &workingDir, const QString &fileName,
QStringList args;
args << QLatin1String("edit") << QDir::toNativeSeparators(fileName);
int flags = CommandToWindow|StdOutToWindow|StdErrToWindow|ErrorToWindow;
uint flags = CommandToWindow|StdOutToWindow|StdErrToWindow|ErrorToWindow;
if (silently) {
flags |= SilentStdOut;
}
@@ -1140,20 +1140,21 @@ IEditor *PerforcePlugin::showOutputInEditor(const QString &title,
QTextCodec *codec)
{
const VcsBaseEditorParameters *params = findType(editorType);
QTC_ASSERT(params, return 0);
QTC_ASSERT(params, return nullptr);
const Id id = params->id;
QString s = title;
QString content = output;
const int maxSize = int(EditorManager::maxTextFileSize() / 2 - 1000L); // ~25 MB, 600000 lines
if (content.size() >= maxSize) {
content = content.left(maxSize);
content += QLatin1Char('\n') + tr("[Only %n MB of output shown]", 0, maxSize / 1024 / 1024);
content += QLatin1Char('\n')
+ tr("[Only %n MB of output shown]", nullptr, maxSize / 1024 / 1024);
}
IEditor *editor = EditorManager::openEditorWithContents(id, &s, content.toUtf8());
QTC_ASSERT(editor, return 0);
QTC_ASSERT(editor, return nullptr);
auto e = qobject_cast<PerforceEditorWidget*>(editor->widget());
if (!e)
return 0;
return nullptr;
connect(e, &VcsBaseEditorWidget::annotateRevisionRequested, this, &PerforcePlugin::annotate);
e->setForceReadOnly(true);
e->setSource(source);
@@ -1266,7 +1267,8 @@ void PerforcePlugin::p4Diff(const PerforceDiffParameters &p)
void PerforcePlugin::describe(const QString & source, const QString &n)
{
QTextCodec *codec = source.isEmpty() ? static_cast<QTextCodec *>(0) : VcsBaseEditor::getCodec(source);
QTextCodec *codec = source.isEmpty() ? static_cast<QTextCodec *>(nullptr)
: VcsBaseEditor::getCodec(source);
QStringList args;
args << QLatin1String("describe") << QLatin1String("-du") << n;
const PerforceResponse result = runP4Cmd(m_settings.topLevel(), args, CommandToWindow|StdErrToWindow|ErrorToWindow,