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;
|
int pos = 0;
|
||||||
QListWidgetItem *item;
|
QListWidgetItem *item;
|
||||||
while ((pos = r.indexIn(data, pos)) != -1) {
|
while ((pos = r.indexIn(data, pos)) != -1) {
|
||||||
item = new QListWidgetItem(tr("Change %1: %2").arg(r.cap(1))
|
item = new QListWidgetItem(tr("Change %1: %2").arg(r.cap(1), r.cap(2).trimmed()),
|
||||||
.arg(r.cap(2).trimmed()), m_ui.listWidget);
|
m_ui.listWidget);
|
||||||
item->setData(234, r.cap(1).trimmed());
|
item->setData(234, r.cap(1).trimmed());
|
||||||
++pos;
|
++pos;
|
||||||
}
|
}
|
||||||
|
@@ -167,7 +167,7 @@ PerforceResponse::PerforceResponse() :
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
PerforcePlugin *PerforcePlugin::m_instance = NULL;
|
PerforcePlugin *PerforcePlugin::m_instance = nullptr;
|
||||||
|
|
||||||
static const VcsBaseSubmitEditorParameters submitParameters = {
|
static const VcsBaseSubmitEditorParameters submitParameters = {
|
||||||
SUBMIT_MIMETYPE,
|
SUBMIT_MIMETYPE,
|
||||||
@@ -847,7 +847,7 @@ bool PerforcePlugin::vcsOpen(const QString &workingDir, const QString &fileName,
|
|||||||
QStringList args;
|
QStringList args;
|
||||||
args << QLatin1String("edit") << QDir::toNativeSeparators(fileName);
|
args << QLatin1String("edit") << QDir::toNativeSeparators(fileName);
|
||||||
|
|
||||||
int flags = CommandToWindow|StdOutToWindow|StdErrToWindow|ErrorToWindow;
|
uint flags = CommandToWindow|StdOutToWindow|StdErrToWindow|ErrorToWindow;
|
||||||
if (silently) {
|
if (silently) {
|
||||||
flags |= SilentStdOut;
|
flags |= SilentStdOut;
|
||||||
}
|
}
|
||||||
@@ -1140,20 +1140,21 @@ IEditor *PerforcePlugin::showOutputInEditor(const QString &title,
|
|||||||
QTextCodec *codec)
|
QTextCodec *codec)
|
||||||
{
|
{
|
||||||
const VcsBaseEditorParameters *params = findType(editorType);
|
const VcsBaseEditorParameters *params = findType(editorType);
|
||||||
QTC_ASSERT(params, return 0);
|
QTC_ASSERT(params, return nullptr);
|
||||||
const Id id = params->id;
|
const Id id = params->id;
|
||||||
QString s = title;
|
QString s = title;
|
||||||
QString content = output;
|
QString content = output;
|
||||||
const int maxSize = int(EditorManager::maxTextFileSize() / 2 - 1000L); // ~25 MB, 600000 lines
|
const int maxSize = int(EditorManager::maxTextFileSize() / 2 - 1000L); // ~25 MB, 600000 lines
|
||||||
if (content.size() >= maxSize) {
|
if (content.size() >= maxSize) {
|
||||||
content = content.left(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());
|
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());
|
auto e = qobject_cast<PerforceEditorWidget*>(editor->widget());
|
||||||
if (!e)
|
if (!e)
|
||||||
return 0;
|
return nullptr;
|
||||||
connect(e, &VcsBaseEditorWidget::annotateRevisionRequested, this, &PerforcePlugin::annotate);
|
connect(e, &VcsBaseEditorWidget::annotateRevisionRequested, this, &PerforcePlugin::annotate);
|
||||||
e->setForceReadOnly(true);
|
e->setForceReadOnly(true);
|
||||||
e->setSource(source);
|
e->setSource(source);
|
||||||
@@ -1266,7 +1267,8 @@ void PerforcePlugin::p4Diff(const PerforceDiffParameters &p)
|
|||||||
|
|
||||||
void PerforcePlugin::describe(const QString & source, const QString &n)
|
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;
|
QStringList args;
|
||||||
args << QLatin1String("describe") << QLatin1String("-du") << n;
|
args << QLatin1String("describe") << QLatin1String("-du") << n;
|
||||||
const PerforceResponse result = runP4Cmd(m_settings.topLevel(), args, CommandToWindow|StdErrToWindow|ErrorToWindow,
|
const PerforceResponse result = runP4Cmd(m_settings.topLevel(), args, CommandToWindow|StdErrToWindow|ErrorToWindow,
|
||||||
|
@@ -77,10 +77,10 @@ class PerforcePlugin : public VcsBase::VcsBasePlugin
|
|||||||
public:
|
public:
|
||||||
PerforcePlugin() = default;
|
PerforcePlugin() = default;
|
||||||
|
|
||||||
bool initialize(const QStringList &arguments, QString *errorMessage);
|
bool initialize(const QStringList &arguments, QString *errorMessage) override;
|
||||||
void extensionsInitialized();
|
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 managesFile(const QString &workingDirectory, const QString &fileName) const;
|
||||||
bool vcsOpen(const QString &workingDir, const QString &fileName, bool silently = false);
|
bool vcsOpen(const QString &workingDir, const QString &fileName, bool silently = false);
|
||||||
bool vcsAdd(const QString &workingDir, const QString &fileName);
|
bool vcsAdd(const QString &workingDir, const QString &fileName);
|
||||||
@@ -104,8 +104,8 @@ public:
|
|||||||
const QString &revision, int lineNumber);
|
const QString &revision, int lineNumber);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void updateActions(VcsBase::VcsBasePlugin::ActionState);
|
void updateActions(VcsBase::VcsBasePlugin::ActionState) override;
|
||||||
bool submitEditorAboutToClose();
|
bool submitEditorAboutToClose() override;
|
||||||
|
|
||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
private slots:
|
private slots:
|
||||||
@@ -157,7 +157,7 @@ private:
|
|||||||
|
|
||||||
Core::IEditor *showOutputInEditor(const QString &title, const QString &output,
|
Core::IEditor *showOutputInEditor(const QString &title, const QString &output,
|
||||||
int editorType, const QString &source,
|
int editorType, const QString &source,
|
||||||
QTextCodec *codec = 0);
|
QTextCodec *codec = nullptr);
|
||||||
|
|
||||||
// Flags for runP4Cmd.
|
// Flags for runP4Cmd.
|
||||||
enum RunFlags { CommandToWindow = 0x1, StdOutToWindow = 0x2,
|
enum RunFlags { CommandToWindow = 0x1, StdOutToWindow = 0x2,
|
||||||
@@ -178,7 +178,7 @@ private:
|
|||||||
unsigned flags = CommandToWindow|StdErrToWindow|ErrorToWindow,
|
unsigned flags = CommandToWindow|StdErrToWindow|ErrorToWindow,
|
||||||
const QStringList &extraArgs = QStringList(),
|
const QStringList &extraArgs = QStringList(),
|
||||||
const QByteArray &stdInput = QByteArray(),
|
const QByteArray &stdInput = QByteArray(),
|
||||||
QTextCodec *outputCodec = 0);
|
QTextCodec *outputCodec = nullptr);
|
||||||
|
|
||||||
static PerforceResponse synchronousProcess(const QString &workingDir,
|
static PerforceResponse synchronousProcess(const QString &workingDir,
|
||||||
const QStringList &args,
|
const QStringList &args,
|
||||||
|
@@ -42,7 +42,7 @@ public:
|
|||||||
Core::Id id() const final;
|
Core::Id id() const final;
|
||||||
|
|
||||||
bool isVcsFileOrDirectory(const Utils::FileName &fileName) 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 managesFile(const QString &workingDirectory, const QString &fileName) const final;
|
||||||
|
|
||||||
bool isConfigured() const final;
|
bool isConfigured() const final;
|
||||||
|
@@ -43,7 +43,7 @@ class SettingsPageWidget : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit SettingsPageWidget(QWidget *parent = 0);
|
explicit SettingsPageWidget(QWidget *parent = nullptr);
|
||||||
~SettingsPageWidget() override;
|
~SettingsPageWidget() override;
|
||||||
|
|
||||||
void setSettings(const PerforceSettings &);
|
void setSettings(const PerforceSettings &);
|
||||||
|
Reference in New Issue
Block a user