]> git.lyx.org Git - lyx.git/blobdiff - src/support/Systemcall.cpp
Add `override` specifiers to improve code maintainability
[lyx.git] / src / support / Systemcall.cpp
index a270b4118dbfc59584518317b37bc948b525e7c3..815223d378bb9e843c1da22c88070d63eecee316 100644 (file)
@@ -29,7 +29,7 @@
 #include <iostream>
 
 #include <QProcess>
-#include <QTime>
+#include <QElapsedTimer>
 #include <QThread>
 #include <QCoreApplication>
 #include <QDebug>
@@ -59,26 +59,26 @@ class ProgressDummy : public ProgressInterface
 public:
        ProgressDummy() {}
 
-       void processStarted(QString const &) {}
-       void processFinished(QString const &) {}
-       void appendMessage(QString const &) {}
-       void appendError(QString const &) {}
-       void clearMessages() {}
-       void lyxerrFlush() {}
+       void processStarted(QString const &) override {}
+       void processFinished(QString const &) override {}
+       void appendMessage(QString const &) override {}
+       void appendError(QString const &) override {}
+       void clearMessages() override {}
+       void lyxerrFlush() override {}
 
-       void lyxerrConnect() {}
-       void lyxerrDisconnect() {}
+       void lyxerrConnect() override {}
+       void lyxerrDisconnect() override {}
 
-       void warning(QString const &, QString const &) {}
-       void toggleWarning(QString const &, QString const &, QString const &) {}
-       void error(QString const &, QString const &, QString const &) {}
-       void information(QString const &, QString const &) {}
+       void warning(QString const &, QString const &) override {}
+       void toggleWarning(QString const &, QString const &, QString const &) override {}
+       void error(QString const &, QString const &, QString const &) override {}
+       void information(QString const &, QString const &) override {}
        int prompt(docstring const &, docstring const &, int default_but, int,
-                  docstring const &, docstring const &) { return default_but; }
+                  docstring const &, docstring const &) override { return default_but; }
 };
 
 
-static ProgressInterface * progress_instance = 0;
+static ProgressInterface * progress_instance = nullptr;
 
 void ProgressInterface::setInstance(ProgressInterface* p)
 {
@@ -440,7 +440,7 @@ bool SystemcallPrivate::waitWhile(State waitwhile, bool process_events, int time
                        while (!timedout) {
                                if (process_->waitForFinished(timeout))
                                        return true;
-                               bool stop = queryStopCommand(cmd_);
+                               bool const stop = queryStopCommand(cmd_);
                                // The command may have finished in the meantime
                                if (process_->state() == QProcess::NotRunning)
                                        return true;
@@ -467,7 +467,7 @@ bool SystemcallPrivate::waitWhile(State waitwhile, bool process_events, int time
        }
 
        // process events while waiting with timeout
-       QTime timer;
+       QElapsedTimer timer;
        timer.start();
        while (state == waitwhile && state != Error && !timedout) {
                // check for cancellation of background process
@@ -475,7 +475,7 @@ bool SystemcallPrivate::waitWhile(State waitwhile, bool process_events, int time
                        return false;
 
                if (timer.elapsed() > timeout) {
-                       bool stop = queryStopCommand(cmd_);
+                       bool const stop = queryStopCommand(cmd_);
                        // The command may have finished in the meantime
                        if (process_->state() == QProcess::NotRunning)
                                break;
@@ -639,7 +639,7 @@ int SystemcallPrivate::exitCode()
 QProcess* SystemcallPrivate::releaseProcess()
 {
        QProcess* released = process_;
-       process_ = 0;
+       process_ = nullptr;
        return released;
 }