forked from qt-creator/qt-creator
Perforce: Fix warnings and modernize
Change-Id: Id43718869aaf2bc24e6a6614bcddcc35715502fe Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -39,8 +39,8 @@ PendingChangesDialog::PendingChangesDialog(const QString &data, QWidget *parent)
|
||||
int pos = 0;
|
||||
QListWidgetItem *item;
|
||||
while ((pos = r.indexIn(data, pos)) != -1) {
|
||||
item = new QListWidgetItem(tr("Change %1: %2").arg(r.cap(1))
|
||||
.arg(r.cap(2).trimmed()), m_ui.listWidget);
|
||||
item = new QListWidgetItem(tr("Change %1: %2").arg(r.cap(1), r.cap(2).trimmed()),
|
||||
m_ui.listWidget);
|
||||
item->setData(234, r.cap(1).trimmed());
|
||||
++pos;
|
||||
}
|
||||
|
@@ -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,
|
||||
|
@@ -77,10 +77,10 @@ class PerforcePlugin : public VcsBase::VcsBasePlugin
|
||||
public:
|
||||
PerforcePlugin() = default;
|
||||
|
||||
bool initialize(const QStringList &arguments, QString *errorMessage);
|
||||
void extensionsInitialized();
|
||||
bool initialize(const QStringList &arguments, QString *errorMessage) override;
|
||||
void extensionsInitialized() override;
|
||||
|
||||
bool managesDirectory(const QString &directory, QString *topLevel = 0);
|
||||
bool managesDirectory(const QString &directory, QString *topLevel = nullptr);
|
||||
bool managesFile(const QString &workingDirectory, const QString &fileName) const;
|
||||
bool vcsOpen(const QString &workingDir, const QString &fileName, bool silently = false);
|
||||
bool vcsAdd(const QString &workingDir, const QString &fileName);
|
||||
@@ -104,8 +104,8 @@ public:
|
||||
const QString &revision, int lineNumber);
|
||||
|
||||
protected:
|
||||
void updateActions(VcsBase::VcsBasePlugin::ActionState);
|
||||
bool submitEditorAboutToClose();
|
||||
void updateActions(VcsBase::VcsBasePlugin::ActionState) override;
|
||||
bool submitEditorAboutToClose() override;
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
private slots:
|
||||
@@ -157,7 +157,7 @@ private:
|
||||
|
||||
Core::IEditor *showOutputInEditor(const QString &title, const QString &output,
|
||||
int editorType, const QString &source,
|
||||
QTextCodec *codec = 0);
|
||||
QTextCodec *codec = nullptr);
|
||||
|
||||
// Flags for runP4Cmd.
|
||||
enum RunFlags { CommandToWindow = 0x1, StdOutToWindow = 0x2,
|
||||
@@ -178,7 +178,7 @@ private:
|
||||
unsigned flags = CommandToWindow|StdErrToWindow|ErrorToWindow,
|
||||
const QStringList &extraArgs = QStringList(),
|
||||
const QByteArray &stdInput = QByteArray(),
|
||||
QTextCodec *outputCodec = 0);
|
||||
QTextCodec *outputCodec = nullptr);
|
||||
|
||||
static PerforceResponse synchronousProcess(const QString &workingDir,
|
||||
const QStringList &args,
|
||||
|
@@ -42,7 +42,7 @@ public:
|
||||
Core::Id id() const final;
|
||||
|
||||
bool isVcsFileOrDirectory(const Utils::FileName &fileName) const final;
|
||||
bool managesDirectory(const QString &directory, QString *topLevel = 0) const final;
|
||||
bool managesDirectory(const QString &directory, QString *topLevel = nullptr) const final;
|
||||
bool managesFile(const QString &workingDirectory, const QString &fileName) const final;
|
||||
|
||||
bool isConfigured() const final;
|
||||
|
@@ -43,7 +43,7 @@ class SettingsPageWidget : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SettingsPageWidget(QWidget *parent = 0);
|
||||
explicit SettingsPageWidget(QWidget *parent = nullptr);
|
||||
~SettingsPageWidget() override;
|
||||
|
||||
void setSettings(const PerforceSettings &);
|
||||
|
Reference in New Issue
Block a user