diff --git a/gui/SensorBrowser.h b/gui/SensorBrowser.h --- a/gui/SensorBrowser.h +++ b/gui/SensorBrowser.h @@ -45,13 +45,13 @@ Q_OBJECT public: SensorBrowserModel(); - ~SensorBrowserModel() Q_DECL_OVERRIDE; - int columnCount( const QModelIndex &) const Q_DECL_OVERRIDE; - QVariant data( const QModelIndex & parent, int role) const Q_DECL_OVERRIDE; - QVariant headerData ( int section, Qt::Orientation orientation, int role) const Q_DECL_OVERRIDE; - QModelIndex index ( int row, int column, const QModelIndex & parent) const Q_DECL_OVERRIDE; - QModelIndex parent ( const QModelIndex & index ) const Q_DECL_OVERRIDE; - int rowCount ( const QModelIndex & parent = QModelIndex() ) const Q_DECL_OVERRIDE; + ~SensorBrowserModel() override; + int columnCount( const QModelIndex &) const override; + QVariant data( const QModelIndex & parent, int role) const override; + QVariant headerData ( int section, Qt::Orientation orientation, int role) const override; + QModelIndex index ( int row, int column, const QModelIndex & parent) const override; + QModelIndex parent ( const QModelIndex & index ) const override; + int rowCount ( const QModelIndex & parent = QModelIndex() ) const override; QStringList listSensors( const QString &hostName ) const; ///Returns a list of sensors names. E.g. (cpu/0, mem/free, mem/cache, etc) @@ -68,8 +68,8 @@ void disconnectHost(uint id); void disconnectHost(const HostInfo *hostInfo); void disconnectHost(const QString &hostname); - Qt::ItemFlags flags ( const QModelIndex & index ) const Q_DECL_OVERRIDE; - QMimeData * mimeData ( const QModelIndexList & indexes ) const Q_DECL_OVERRIDE; + Qt::ItemFlags flags ( const QModelIndex & index ) const override; + QMimeData * mimeData ( const QModelIndexList & indexes ) const override; void retranslate(); /// Retranslate the model Q_SIGNALS: void sensorsAddedToHost(const QModelIndex &index ); @@ -85,7 +85,7 @@ void hostRemoved(const QString &hostName); private: - void answerReceived( int id, const QList& ) Q_DECL_OVERRIDE; + void answerReceived( int id, const QList& ) override; void removeEmptyParentTreeBranches(int hostId, int id, int parentid); HostInfo* findHostInfoByHostName(const QString &hostName) const; void removeAllSensorUnderBranch(HostInfo* hostInfo, int parentId); @@ -122,7 +122,7 @@ void updateView(); private: void retranslateUi(); - void changeEvent( QEvent * event ) Q_DECL_OVERRIDE; + void changeEvent( QEvent * event ) override; KSGRD::SensorManager* mSensorManager; diff --git a/gui/SensorBrowser.cpp b/gui/SensorBrowser.cpp --- a/gui/SensorBrowser.cpp +++ b/gui/SensorBrowser.cpp @@ -8,7 +8,7 @@ published by the Free Software Foundation; either version 2 of the License or (at your option) version 3 or any later version accepted by the membership of KDE e.V. (or its successor approved - by the membership of KDE e.V.), which shall act as a proxy + by the membership of KDE e.V.), which shall act as a proxy defined in Section 14 of version 3 of the license. This program is distributed in the hope that it will be useful, @@ -244,6 +244,7 @@ mParentsTreeMap.remove(idCount); SensorInfo *sensorInfo = mSensorInfoMap.take(idCount); delete sensorInfo; + sensorInfo = nullptr; mHostSensorsMap[hostInfo->id()].remove(sensorName); endRemoveRows(); @@ -643,7 +644,3 @@ { return mHostInfo; } - - - - diff --git a/gui/SensorDisplayLib/BarGraph.h b/gui/SensorDisplayLib/BarGraph.h --- a/gui/SensorDisplayLib/BarGraph.h +++ b/gui/SensorDisplayLib/BarGraph.h @@ -34,7 +34,7 @@ public: explicit BarGraph( QWidget *parent ); - ~BarGraph() Q_DECL_OVERRIDE; + ~BarGraph() override; bool addBar( const QString &footer ); bool removeBar( uint idx ); @@ -70,7 +70,7 @@ void changeRange( double min, double max ); protected: - void paintEvent( QPaintEvent* ) Q_DECL_OVERRIDE; + void paintEvent( QPaintEvent* ) override; private: double minValue; diff --git a/gui/SensorDisplayLib/DancingBars.h b/gui/SensorDisplayLib/DancingBars.h --- a/gui/SensorDisplayLib/DancingBars.h +++ b/gui/SensorDisplayLib/DancingBars.h @@ -40,23 +40,23 @@ DancingBars( QWidget *parent, const QString &title, SharedSettings *workSheetSettings ); virtual ~DancingBars(); - void configureSettings() Q_DECL_OVERRIDE; + void configureSettings() override; bool addSensor( const QString &hostName, const QString &name, - const QString &type, const QString &title ) Q_DECL_OVERRIDE; - bool removeSensor( uint pos ) Q_DECL_OVERRIDE; + const QString &type, const QString &title ) override; + bool removeSensor( uint pos ) override; void updateSamples( const QVector &samples ); - void answerReceived( int id, const QList &answerlist ) Q_DECL_OVERRIDE; + void answerReceived( int id, const QList &answerlist ) override; - bool restoreSettings( QDomElement& ) Q_DECL_OVERRIDE; - bool saveSettings( QDomDocument&, QDomElement& ) Q_DECL_OVERRIDE; + bool restoreSettings( QDomElement& ) override; + bool saveSettings( QDomDocument&, QDomElement& ) override; - bool hasSettingsDialog() const Q_DECL_OVERRIDE; + bool hasSettingsDialog() const override; public Q_SLOTS: - void applyStyle() Q_DECL_OVERRIDE; + void applyStyle() override; private: int mBars; diff --git a/gui/SensorDisplayLib/DummyDisplay.h b/gui/SensorDisplayLib/DummyDisplay.h --- a/gui/SensorDisplayLib/DummyDisplay.h +++ b/gui/SensorDisplayLib/DummyDisplay.h @@ -32,9 +32,9 @@ public: DummyDisplay( QWidget* parent, SharedSettings *workSheetSettings); - ~DummyDisplay() Q_DECL_OVERRIDE {} + ~DummyDisplay() override {} - bool eventFilter( QObject*, QEvent* ) Q_DECL_OVERRIDE; + bool eventFilter( QObject*, QEvent* ) override; }; #endif diff --git a/gui/SensorDisplayLib/FancyPlotter.h b/gui/SensorDisplayLib/FancyPlotter.h --- a/gui/SensorDisplayLib/FancyPlotter.h +++ b/gui/SensorDisplayLib/FancyPlotter.h @@ -64,42 +64,42 @@ public: FancyPlotter( QWidget* parent, const QString& title, SharedSettings *workSheetSettings); - ~FancyPlotter() Q_DECL_OVERRIDE; + ~FancyPlotter() override; - void configureSettings() Q_DECL_OVERRIDE; + void configureSettings() override; bool addSensor( const QString &hostName, const QString &name, - const QString &type, const QString &title ) Q_DECL_OVERRIDE; + const QString &type, const QString &title ) override; bool addSensor( const QString &hostName, const QString &name, const QString &type, const QString &title, const QColor &color, const QString ®expName = QString(), int sumToSensor = -1, const QString &summationName = QString()); bool removeBeam( uint beamId ); - void setTitle( const QString &title ) Q_DECL_OVERRIDE; + void setTitle( const QString &title ) override; - void answerReceived( int id, const QList &answerlist ) Q_DECL_OVERRIDE; + void answerReceived( int id, const QList &answerlist ) override; - bool restoreSettings( QDomElement &element ) Q_DECL_OVERRIDE; - bool saveSettings( QDomDocument &doc, QDomElement &element ) Q_DECL_OVERRIDE; + bool restoreSettings( QDomElement &element ) override; + bool saveSettings( QDomDocument &doc, QDomElement &element ) override; - bool hasSettingsDialog() const Q_DECL_OVERRIDE; + bool hasSettingsDialog() const override; void setBeamColor(int i, const QColor &color); public Q_SLOTS: - void applyStyle() Q_DECL_OVERRIDE; + void applyStyle() override; private Q_SLOTS: void settingsFinished(); - void applySettings() Q_DECL_OVERRIDE; + void applySettings() override; void plotterAxisScaleChanged(); protected: /** When we receive a timer tick, draw the beams and request new information to update the beams*/ - void timerTick( ) Q_DECL_OVERRIDE; - bool eventFilter( QObject*, QEvent* ) Q_DECL_OVERRIDE; + void timerTick( ) override; + bool eventFilter( QObject*, QEvent* ) override; virtual void reorderBeams(const QList & orderOfBeams); - void resizeEvent( QResizeEvent* ) Q_DECL_OVERRIDE; + void resizeEvent( QResizeEvent* ) override; void setTooltip(); private: diff --git a/gui/SensorDisplayLib/FancyPlotter.cpp b/gui/SensorDisplayLib/FancyPlotter.cpp --- a/gui/SensorDisplayLib/FancyPlotter.cpp +++ b/gui/SensorDisplayLib/FancyPlotter.cpp @@ -8,7 +8,7 @@ published by the Free Software Foundation; either version 2 of the License or (at your option) version 3 or any later version accepted by the membership of KDE e.V. (or its successor approved - by the membership of KDE e.V.), which shall act as a proxy + by the membership of KDE e.V.), which shall act as a proxy defined in Section 14 of version 3 of the license. This program is distributed in the hope that it will be useful, @@ -60,7 +60,7 @@ textMargin = 0; setLayoutDirection(Qt::LeftToRight); //We do this because we organise the strings ourselves.. is this going to muck it up though for RTL languages? } - ~FancyPlotterLabel() Q_DECL_OVERRIDE { + ~FancyPlotterLabel() override { } void setLabel(const QString &name, const QColor &color) { labelName = name; @@ -80,7 +80,7 @@ resizeEvent(nullptr); update(); } - void resizeEvent( QResizeEvent * ) Q_DECL_OVERRIDE { + void resizeEvent( QResizeEvent * ) override { QFontMetrics fm = fontMetrics(); if(valueText.isEmpty()) { @@ -163,7 +163,7 @@ mLabelsWidget = nullptr; //The unicode character 0x25CF is a big filled in circle. We would prefer to use this in the tooltip. - //However it's maybe possible that the font used to draw the tooltip won't have it. So we fall back to a + //However it's maybe possible that the font used to draw the tooltip won't have it. So we fall back to a //"#" instead. QFontMetrics fm(QToolTip::font()); if(fm.inFont(QChar(0x25CF))) @@ -457,6 +457,7 @@ QWidget *label = (static_cast(mLabelLayout->takeAt( beamId )))->widget(); mLabelLayout->removeWidget(label); delete label; + label = nullptr; mSensorReportedMax = 0; mSensorReportedMin = 0; @@ -556,7 +557,7 @@ void FancyPlotter::sendDataToPlotter( ) { - if(!mSampleBuf.isEmpty() && mBeams != 0) { + if(!mSampleBuf.isEmpty() && mBeams != 0) { if((uint)mSampleBuf.count() > mBeams) { mSampleBuf.clear(); return; //ignore invalid results - can happen if a sensor is deleted @@ -936,6 +937,3 @@ { return mColor; } - - - diff --git a/gui/SensorDisplayLib/ListView.h b/gui/SensorDisplayLib/ListView.h --- a/gui/SensorDisplayLib/ListView.h +++ b/gui/SensorDisplayLib/ListView.h @@ -8,7 +8,7 @@ published by the Free Software Foundation; either version 2 of the License or (at your option) version 3 or any later version accepted by the membership of KDE e.V. (or its successor approved - by the membership of KDE e.V.), which shall act as a proxy + by the membership of KDE e.V.), which shall act as a proxy defined in Section 14 of version 3 of the license. This program is distributed in the hope that it will be useful, @@ -33,11 +33,11 @@ class ListViewModel : public QStandardItemModel { public: - ListViewModel(QObject * parent = 0 ) : QStandardItemModel(parent) + ListViewModel(QObject * parent = nullptr ) : QStandardItemModel(parent) { } - ListViewModel(int rows, int columns, QObject * parent = 0) : QStandardItemModel(rows, columns, parent) + ListViewModel(int rows, int columns, QObject * parent = nullptr) : QStandardItemModel(rows, columns, parent) { } @@ -52,7 +52,7 @@ mAlignment.clear(); } - QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE + QVariant data(const QModelIndex &index, int role) const override { int column = index.column(); @@ -73,28 +73,28 @@ ListView(QWidget* parent, const QString& title, SharedSettings *workSheetSettings); ~ListView() {} - bool addSensor(const QString& hostName, const QString& sensorName, const QString& sensorType, const QString& sensorDescr) Q_DECL_OVERRIDE; - void answerReceived(int id, const QList& answerlist) Q_DECL_OVERRIDE; + bool addSensor(const QString& hostName, const QString& sensorName, const QString& sensorType, const QString& sensorDescr) override; + void answerReceived(int id, const QList& answerlist) override; void updateList(); - bool restoreSettings(QDomElement& element) Q_DECL_OVERRIDE; - bool saveSettings(QDomDocument& doc, QDomElement& element) Q_DECL_OVERRIDE; + bool restoreSettings(QDomElement& element) override; + bool saveSettings(QDomDocument& doc, QDomElement& element) override; - bool hasSettingsDialog() const Q_DECL_OVERRIDE + bool hasSettingsDialog() const override { return true; } - void timerTick() Q_DECL_OVERRIDE + void timerTick() override { updateList(); } - void configureSettings() Q_DECL_OVERRIDE; + void configureSettings() override; public Q_SLOTS: - void applySettings() Q_DECL_OVERRIDE; - void applyStyle() Q_DECL_OVERRIDE; + void applySettings() override; + void applyStyle() override; void showColumnContextMenu(const QPoint &point); private: diff --git a/gui/SensorDisplayLib/ListView.cpp b/gui/SensorDisplayLib/ListView.cpp --- a/gui/SensorDisplayLib/ListView.cpp +++ b/gui/SensorDisplayLib/ListView.cpp @@ -216,6 +216,7 @@ else if (result == actionTB) mUnits = UnitsTB; delete menu; + menu = nullptr; } bool diff --git a/gui/SensorDisplayLib/ListViewSettings.cpp b/gui/SensorDisplayLib/ListViewSettings.cpp --- a/gui/SensorDisplayLib/ListViewSettings.cpp +++ b/gui/SensorDisplayLib/ListViewSettings.cpp @@ -90,4 +90,3 @@ /* vim: et sw=2 ts=2 */ - diff --git a/gui/SensorDisplayLib/LogFile.h b/gui/SensorDisplayLib/LogFile.h --- a/gui/SensorDisplayLib/LogFile.h +++ b/gui/SensorDisplayLib/LogFile.h @@ -37,32 +37,32 @@ Q_OBJECT public: LogFile(QWidget *parent, const QString& title, SharedSettings *workSheetSettings); - ~LogFile() Q_DECL_OVERRIDE; + ~LogFile() override; bool addSensor(const QString& hostName, const QString& sensorName, - const QString& sensorType, const QString& sensorDescr) Q_DECL_OVERRIDE; - void answerReceived(int id, const QList& answer) Q_DECL_OVERRIDE; + const QString& sensorType, const QString& sensorDescr) override; + void answerReceived(int id, const QList& answer) override; - bool restoreSettings(QDomElement& element) Q_DECL_OVERRIDE; - bool saveSettings(QDomDocument& doc, QDomElement& element) Q_DECL_OVERRIDE; + bool restoreSettings(QDomElement& element) override; + bool saveSettings(QDomDocument& doc, QDomElement& element) override; void updateMonitor(void); - void configureSettings(void) Q_DECL_OVERRIDE; + void configureSettings(void) override; - void timerTick() Q_DECL_OVERRIDE + void timerTick() override { updateMonitor(); } - bool hasSettingsDialog() const Q_DECL_OVERRIDE + bool hasSettingsDialog() const override { return true; } public Q_SLOTS: - void applySettings() Q_DECL_OVERRIDE; - void applyStyle() Q_DECL_OVERRIDE; + void applySettings() override; + void applyStyle() override; void settingsAddRule(); void settingsDeleteRule(); diff --git a/gui/SensorDisplayLib/MultiMeter.h b/gui/SensorDisplayLib/MultiMeter.h --- a/gui/SensorDisplayLib/MultiMeter.h +++ b/gui/SensorDisplayLib/MultiMeter.h @@ -34,25 +34,25 @@ public: MultiMeter(QWidget* parent, const QString& title, SharedSettings *workSheetSettings); - ~MultiMeter() Q_DECL_OVERRIDE + ~MultiMeter() override { } bool addSensor(const QString& hostName, const QString& sensorName, - const QString& sensorType, const QString& sensorDescr) Q_DECL_OVERRIDE; - void answerReceived(int id, const QList& answerlist) Q_DECL_OVERRIDE; - bool restoreSettings(QDomElement& element) Q_DECL_OVERRIDE; - bool saveSettings(QDomDocument& doc, QDomElement& element) Q_DECL_OVERRIDE; + const QString& sensorType, const QString& sensorDescr) override; + void answerReceived(int id, const QList& answerlist) override; + bool restoreSettings(QDomElement& element) override; + bool saveSettings(QDomDocument& doc, QDomElement& element) override; - bool hasSettingsDialog() const Q_DECL_OVERRIDE + bool hasSettingsDialog() const override { return true; } - void configureSettings() Q_DECL_OVERRIDE; + void configureSettings() override; public Q_SLOTS: - void applyStyle() Q_DECL_OVERRIDE; + void applyStyle() override; private: void setDigitColor(const QColor&); diff --git a/gui/SensorDisplayLib/MultiMeterSettings.cpp b/gui/SensorDisplayLib/MultiMeterSettings.cpp --- a/gui/SensorDisplayLib/MultiMeterSettings.cpp +++ b/gui/SensorDisplayLib/MultiMeterSettings.cpp @@ -51,6 +51,7 @@ MultiMeterSettings::~MultiMeterSettings() { delete m_settingsWidget; + m_settingsWidget = nullptr; } QString MultiMeterSettings::title() @@ -147,4 +148,3 @@ /* vim: et sw=2 ts=2 */ - diff --git a/gui/SensorDisplayLib/ProcessController.h b/gui/SensorDisplayLib/ProcessController.h --- a/gui/SensorDisplayLib/ProcessController.h +++ b/gui/SensorDisplayLib/ProcessController.h @@ -47,28 +47,28 @@ public: ProcessController(QWidget* parent, SharedSettings *workSheetSettings); - ~ProcessController() Q_DECL_OVERRIDE { } + ~ProcessController() override { } /* Functions for SensorDisplay*/ - bool restoreSettings(QDomElement& element) Q_DECL_OVERRIDE; + bool restoreSettings(QDomElement& element) override; - bool saveSettings(QDomDocument& doc, QDomElement& element) Q_DECL_OVERRIDE; + bool saveSettings(QDomDocument& doc, QDomElement& element) override; - void timerTick() Q_DECL_OVERRIDE; + void timerTick() override; - bool addSensor(const QString&, const QString&, const QString&, const QString&) Q_DECL_OVERRIDE; + bool addSensor(const QString&, const QString&, const QString&, const QString&) override; - void sensorError(int, bool err) Q_DECL_OVERRIDE; + void sensorError(int, bool err) override; - void configureSettings() Q_DECL_OVERRIDE { } + void configureSettings() override { } - bool hasSettingsDialog() const Q_DECL_OVERRIDE + bool hasSettingsDialog() const override { return false; } - void answerReceived(int id, const QList& answer ) Q_DECL_OVERRIDE; + void answerReceived(int id, const QList& answer ) override; KSysGuardProcessList* processList() { diff --git a/gui/SensorDisplayLib/SensorDisplay.h b/gui/SensorDisplayLib/SensorDisplay.h --- a/gui/SensorDisplayLib/SensorDisplay.h +++ b/gui/SensorDisplayLib/SensorDisplay.h @@ -67,7 +67,7 @@ /** Destructor. */ - ~SensorDisplay() Q_DECL_OVERRIDE; + ~SensorDisplay() override; /** Sets the title of the display. If you override, please call this @@ -179,7 +179,7 @@ /** Normaly you shouldn't reimplement this methode */ - void sensorLost( int reqId ) Q_DECL_OVERRIDE; + void sensorLost( int reqId ) override; /** * Sets the object where the delete events will be sent to. @@ -221,8 +221,8 @@ void translatedTitleChanged(const QString&); protected: - bool eventFilter( QObject*, QEvent* ) Q_DECL_OVERRIDE; - void changeEvent( QEvent * event ) Q_DECL_OVERRIDE; + bool eventFilter( QObject*, QEvent* ) override; + void changeEvent( QEvent * event ) override; void registerSensor( SensorProperties *sp ); void unregisterSensor( uint pos ); diff --git a/gui/SensorDisplayLib/SensorLogger.h b/gui/SensorDisplayLib/SensorLogger.h --- a/gui/SensorDisplayLib/SensorLogger.h +++ b/gui/SensorDisplayLib/SensorLogger.h @@ -35,9 +35,9 @@ public: explicit LogSensor( QObject *parent ); - ~LogSensor() Q_DECL_OVERRIDE; + ~LogSensor() override; - void answerReceived( int id, const QList&answer ) Q_DECL_OVERRIDE; + void answerReceived( int id, const QList&answer ) override; void setHostName( const QString& name ); QString hostName() const; @@ -78,7 +78,7 @@ void changed(); protected: - void timerEvent ( QTimerEvent * event ) Q_DECL_OVERRIDE; + void timerEvent ( QTimerEvent * event ) override; private: QString mSensorName; @@ -102,13 +102,13 @@ Q_OBJECT public: - LogSensorView( QWidget *parent = 0 ); + LogSensorView( QWidget *parent = nullptr ); Q_SIGNALS: void contextMenuRequest( const QModelIndex &index, const QPoint &pos ); protected: - void contextMenuEvent( QContextMenuEvent *event ) Q_DECL_OVERRIDE; + void contextMenuEvent( QContextMenuEvent *event ) override; }; class SensorLogger : public KSGRD::SensorDisplay @@ -120,24 +120,24 @@ ~SensorLogger(); bool addSensor( const QString& hostName, const QString& sensorName, - const QString& sensorType, const QString& sensorDescr) Q_DECL_OVERRIDE; + const QString& sensorType, const QString& sensorDescr) override; bool editSensor( LogSensor* ); - void answerReceived( int, const QList& ) Q_DECL_OVERRIDE; + void answerReceived( int, const QList& ) override; - bool restoreSettings( QDomElement& ) Q_DECL_OVERRIDE; - bool saveSettings( QDomDocument&, QDomElement& ) Q_DECL_OVERRIDE; + bool restoreSettings( QDomElement& ) override; + bool saveSettings( QDomDocument&, QDomElement& ) override; - void configureSettings() Q_DECL_OVERRIDE; + void configureSettings() override; - bool hasSettingsDialog() const Q_DECL_OVERRIDE + bool hasSettingsDialog() const override { return true; } public Q_SLOTS: - void applyStyle() Q_DECL_OVERRIDE; + void applyStyle() override; void contextMenuRequest( const QModelIndex &index, const QPoint &pos ); private: diff --git a/gui/SensorDisplayLib/SensorLogger.cpp b/gui/SensorDisplayLib/SensorLogger.cpp --- a/gui/SensorDisplayLib/SensorLogger.cpp +++ b/gui/SensorDisplayLib/SensorLogger.cpp @@ -65,21 +65,21 @@ { } - int columnCount( const QModelIndex &parent = QModelIndex() ) const Q_DECL_OVERRIDE + int columnCount( const QModelIndex &parent = QModelIndex() ) const override { Q_UNUSED( parent ); return 5; } - int rowCount( const QModelIndex &parent = QModelIndex() ) const Q_DECL_OVERRIDE + int rowCount( const QModelIndex &parent = QModelIndex() ) const override { Q_UNUSED( parent ); return mSensors.count(); } - QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const Q_DECL_OVERRIDE + QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const override { if ( !index.isValid() ) return QVariant(); @@ -122,7 +122,7 @@ return QVariant(); } - QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const Q_DECL_OVERRIDE + QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const override { if ( orientation == Qt::Vertical ) return QVariant(); diff --git a/gui/SensorDisplayLib/SensorLoggerDlg.cpp b/gui/SensorDisplayLib/SensorLoggerDlg.cpp --- a/gui/SensorDisplayLib/SensorLoggerDlg.cpp +++ b/gui/SensorDisplayLib/SensorLoggerDlg.cpp @@ -49,6 +49,7 @@ SensorLoggerDlg::~SensorLoggerDlg() { delete m_loggerWidget; + m_loggerWidget = nullptr; } void SensorLoggerDlg::fileNameTextChanged() @@ -120,4 +121,3 @@ /* vim: et sw=2 ts=2 */ - diff --git a/gui/SensorDisplayLib/SensorLoggerSettings.cpp b/gui/SensorDisplayLib/SensorLoggerSettings.cpp --- a/gui/SensorDisplayLib/SensorLoggerSettings.cpp +++ b/gui/SensorDisplayLib/SensorLoggerSettings.cpp @@ -45,6 +45,7 @@ SensorLoggerSettings::~SensorLoggerSettings() { delete m_settingsWidget; + m_settingsWidget = nullptr; } QString SensorLoggerSettings::title() @@ -91,4 +92,3 @@ /* vim: et sw=2 ts=2 */ - diff --git a/gui/SensorDisplayLib/SensorModel.h b/gui/SensorDisplayLib/SensorModel.h --- a/gui/SensorDisplayLib/SensorModel.h +++ b/gui/SensorDisplayLib/SensorModel.h @@ -79,10 +79,10 @@ void moveUpSensor(const QModelIndex &index); void setHasLabel( bool hasLabel ); - int columnCount( const QModelIndex &parent = QModelIndex() ) const Q_DECL_OVERRIDE; - int rowCount( const QModelIndex &parent = QModelIndex() ) const Q_DECL_OVERRIDE; - QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const Q_DECL_OVERRIDE; - QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const Q_DECL_OVERRIDE; + int columnCount( const QModelIndex &parent = QModelIndex() ) const override; + int rowCount( const QModelIndex &parent = QModelIndex() ) const override; + QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const override; + QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const override; QList order() const; QList deleted() const; void clearDeleted(); diff --git a/gui/WorkSheet.h b/gui/WorkSheet.h --- a/gui/WorkSheet.h +++ b/gui/WorkSheet.h @@ -50,7 +50,7 @@ public: explicit WorkSheet( QWidget* parent); WorkSheet( int rows, int columns, float interval, QWidget* parent); - ~WorkSheet() Q_DECL_OVERRIDE; + ~WorkSheet() override; bool load( const QString &fileName ); bool save( const QString &fileName ); @@ -90,12 +90,12 @@ protected: - void changeEvent( QEvent * event ) Q_DECL_OVERRIDE; - QSize sizeHint() const Q_DECL_OVERRIDE; - void dragMoveEvent( QDragMoveEvent* ) Q_DECL_OVERRIDE; - void dragEnterEvent( QDragEnterEvent* ) Q_DECL_OVERRIDE; - void dropEvent( QDropEvent* ) Q_DECL_OVERRIDE; - bool event( QEvent* ) Q_DECL_OVERRIDE; + void changeEvent( QEvent * event ) override; + QSize sizeHint() const override; + void dragMoveEvent( QDragMoveEvent* ) override; + void dragEnterEvent( QDragEnterEvent* ) override; + void dropEvent( QDropEvent* ) override; + bool event( QEvent* ) override; void setUpdateInterval( float interval); private: diff --git a/gui/WorkSheet.cpp b/gui/WorkSheet.cpp --- a/gui/WorkSheet.cpp +++ b/gui/WorkSheet.cpp @@ -8,7 +8,7 @@ published by the Free Software Foundation; either version 2 of the License or (at your option) version 3 or any later version accepted by the membership of KDE e.V. (or its successor approved - by the membership of KDE e.V.), which shall act as a proxy + by the membership of KDE e.V.), which shall act as a proxy defined in Section 14 of version 3 of the license. This program is distributed in the hope that it will be useful, @@ -325,16 +325,16 @@ { KSGRD::SensorDisplay* newDisplay = nullptr; switch(displayType) { - case DisplayDummy: + case DisplayDummy: newDisplay = new DummyDisplay( this, &mSharedSettings ); break; case DisplayFancyPlotter: newDisplay = new FancyPlotter( this, displayTitle, &mSharedSettings ); break; case DisplayMultiMeter: newDisplay = new MultiMeter( this, displayTitle, &mSharedSettings); break; - case DisplayDancingBars: + case DisplayDancingBars: newDisplay = new DancingBars( this, displayTitle, &mSharedSettings); break; case DisplaySensorLogger: @@ -396,7 +396,7 @@ displayType = DisplayDancingBars; else if (execed == a4) displayType = DisplaySensorLogger; - else + else return nullptr; } else if ( sensorType == QLatin1String("listview") ) { displayType = DisplayListView; @@ -466,7 +466,7 @@ static_cast(mGridLayout->itemAt(i)->widget())->applyStyle(); } -void WorkSheet::dragEnterEvent( QDragEnterEvent* event) +void WorkSheet::dragEnterEvent( QDragEnterEvent* event) { if ( !event->mimeData()->hasFormat(QStringLiteral("application/x-ksysguard")) ) return; @@ -620,6 +620,7 @@ if (item->widget() != Toplevel->localProcessController()) delete item->widget(); delete item; + item = nullptr; for (int i = oldDisplayRow; i < oldDisplayRow + oldDisplayRowSpan; i++) for (int j = oldDisplayColumn; j < oldDisplayColumn + oldDisplayColumnSpan; j++) @@ -682,7 +683,7 @@ mGridLayout->setRowStretch( r, 100 ); for ( int c = 0; c < mColumns; ++c ) mGridLayout->setColumnStretch( c, 100 ); - + for (int r = 0; r < mRows; r++) for (int c = 0; c < mColumns; c++) replaceDisplay(r, c); @@ -715,7 +716,7 @@ for (int j = 0; j < mColumns; ++j) if (i >= oldRows || j >= oldColumns) replaceDisplay(i, j); - + /* set stretch factors for new rows and columns (if any) */ for ( int r = oldRows; r < mRows; ++r ) mGridLayout->setRowStretch( r, 100 ); @@ -808,5 +809,3 @@ else return 0; } - - diff --git a/gui/Workspace.cpp b/gui/Workspace.cpp --- a/gui/Workspace.cpp +++ b/gui/Workspace.cpp @@ -265,6 +265,7 @@ removeTab(indexOf( sheet )); mSheetList.removeAll( sheet ); delete sheet; + sheet = nullptr; } } @@ -277,6 +278,7 @@ removeTab(indexOf( sheet )); mSheetList.removeAt( i ); delete sheet; + sheet = nullptr; return; } } @@ -334,6 +336,7 @@ sheet->setFileName( baseName ); if ( !sheet->load( fileName ) ) { delete sheet; + sheet = nullptr; return false; } mSheetList.append( sheet ); @@ -389,5 +392,3 @@ if ( current ) current->applyStyle(); } - - diff --git a/gui/ksortfilterproxymodel.h b/gui/ksortfilterproxymodel.h --- a/gui/ksortfilterproxymodel.h +++ b/gui/ksortfilterproxymodel.h @@ -42,7 +42,7 @@ /*! Constructs a sorting filter model with the given parent. */ explicit KSortFilterProxyModel(QObject * parent = nullptr); /*! Destroys this sorting filter model. */ - ~KSortFilterProxyModel() Q_DECL_OVERRIDE; + ~KSortFilterProxyModel() override; /*! Whether to show the children of a matching parent. * This is false by default. */ @@ -53,7 +53,7 @@ protected: /*! \reimp */ - bool filterAcceptsRow ( int source_row, const QModelIndex & source_parent ) const Q_DECL_OVERRIDE; + bool filterAcceptsRow ( int source_row, const QModelIndex & source_parent ) const override; KSortFilterProxyModelPrivate * const d_ptr; Q_DISABLE_COPY( KSortFilterProxyModel ) diff --git a/gui/ksortfilterproxymodel.cpp b/gui/ksortfilterproxymodel.cpp --- a/gui/ksortfilterproxymodel.cpp +++ b/gui/ksortfilterproxymodel.cpp @@ -26,11 +26,11 @@ //@cond PRIVATE class KSortFilterProxyModelPrivate { public: - KSortFilterProxyModelPrivate() { + KSortFilterProxyModelPrivate() { showAllChildren = false; } ~KSortFilterProxyModelPrivate() {} - + bool showAllChildren; }; @@ -42,6 +42,7 @@ KSortFilterProxyModel::~KSortFilterProxyModel() { delete d_ptr; + d_ptr = nullptr; } bool KSortFilterProxyModel::filterAcceptsRow ( int source_row, const QModelIndex & source_parent ) const @@ -81,4 +82,3 @@ d_ptr->showAllChildren = showAllChildren; invalidateFilter(); } - diff --git a/gui/ksysguard.h b/gui/ksysguard.h --- a/gui/ksysguard.h +++ b/gui/ksysguard.h @@ -46,10 +46,10 @@ public: TopLevel(); - void saveProperties( KConfigGroup& ) Q_DECL_OVERRIDE; - void readProperties( const KConfigGroup& ) Q_DECL_OVERRIDE; + void saveProperties( KConfigGroup& ) override; + void readProperties( const KConfigGroup& ) override; - void answerReceived( int id, const QList & ) Q_DECL_OVERRIDE; + void answerReceived( int id, const QList & ) override; void initStatusBar(); void setLocalProcessController(ProcessController * localProcessController); @@ -65,9 +65,9 @@ protected: - bool event( QEvent* ) Q_DECL_OVERRIDE; - void timerEvent( QTimerEvent* ) Q_DECL_OVERRIDE; - bool queryClose() Q_DECL_OVERRIDE; + bool event( QEvent* ) override; + void timerEvent( QTimerEvent* ) override; + bool queryClose() override; protected Q_SLOTS: void connectHost(); @@ -79,7 +79,7 @@ private: void setSwapInfo( qlonglong, qlonglong, const QString& ); - void changeEvent( QEvent * event ) Q_DECL_OVERRIDE; + void changeEvent( QEvent * event ) override; void retranslateUi(); QDBusMessage mDBusReply; diff --git a/gui/ksysguard.cpp b/gui/ksysguard.cpp --- a/gui/ksysguard.cpp +++ b/gui/ksysguard.cpp @@ -9,7 +9,7 @@ published by the Free Software Foundation; either version 2 of the License or (at your option) version 3 or any later version accepted by the membership of KDE e.V. (or its successor approved - by the membership of KDE e.V.), which shall act as a proxy + by the membership of KDE e.V.), which shall act as a proxy defined in Section 14 of version 3 of the license. This program is distributed in the hope that it will be useful, @@ -176,6 +176,7 @@ mQuitAction->setWhatsThis(tmpQuitAction->whatsThis()); mQuitAction->setToolTip(tmpQuitAction->toolTip()); delete tmpQuitAction; + tmpQuitAction = nullptr; } else mQuitAction = KStandardAction::quit( this, SLOT(close()), actionCollection() ); } @@ -591,7 +592,7 @@ // create top-level widget Toplevel->readProperties( KConfigGroup( KSharedConfig::openConfig(), "MainWindow" ) ); // setup the statusbar, toolbar etc. - // Note that this comes after creating the top-level widgets whcih also + // Note that this comes after creating the top-level widgets whcih also // sets up the various QActions that the user may have added to the toolbar Toplevel->initStatusBar(); @@ -613,5 +614,3 @@ return result; } - -