Modernize using clang-tidy

This commit is contained in:
Jonah Brüchert 2018-12-31 04:13:55 +01:00
parent c614e3229a
commit 47bcdee043
19 changed files with 37 additions and 43 deletions

View file

@ -43,8 +43,7 @@ FullScreenPanel::FullScreenPanel(QQuickWindow *parent)
} }
FullScreenPanel::~FullScreenPanel() FullScreenPanel::~FullScreenPanel()
{ = default;
}
void FullScreenPanel::initWayland() void FullScreenPanel::initWayland()
{ {
@ -56,7 +55,7 @@ void FullScreenPanel::initWayland()
if (!connection) { if (!connection) {
return; return;
} }
Registry *registry = new Registry(this); auto *registry = new Registry(this);
registry->create(connection); registry->create(connection);
m_surface = Surface::fromWindow(this); m_surface = Surface::fromWindow(this);

View file

@ -40,14 +40,14 @@ class FullScreenPanel : public QQuickWindow
Q_PROPERTY(bool active READ isActive NOTIFY activeChanged) Q_PROPERTY(bool active READ isActive NOTIFY activeChanged)
public: public:
FullScreenPanel(QQuickWindow *parent = 0); FullScreenPanel(QQuickWindow *parent = nullptr);
~FullScreenPanel(); ~FullScreenPanel() override;
Q_SIGNALS: Q_SIGNALS:
void activeChanged(); void activeChanged();
protected: protected:
void showEvent(QShowEvent *event); void showEvent(QShowEvent *event) override;
private: private:
void initWayland(); void initWayland();

View file

@ -31,7 +31,7 @@ class PlasmaMobileShellPrivatePlugin : public QQmlExtensionPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
public: public:
void registerTypes(const char *uri); void registerTypes(const char *uri) override;
}; };
#endif #endif

View file

@ -46,8 +46,7 @@ ApplicationListModel::ApplicationListModel(QObject *parent)
} }
ApplicationListModel::~ApplicationListModel() ApplicationListModel::~ApplicationListModel()
{ = default;
}
QHash<int, QByteArray> ApplicationListModel::roleNames() const QHash<int, QByteArray> ApplicationListModel::roleNames() const
{ {
@ -188,7 +187,7 @@ QVariant ApplicationListModel::data(const QModelIndex &index, int role) const
Qt::ItemFlags ApplicationListModel::flags(const QModelIndex &index) const Qt::ItemFlags ApplicationListModel::flags(const QModelIndex &index) const
{ {
if (!index.isValid()) if (!index.isValid())
return 0; return nullptr;
return Qt::ItemIsDragEnabled|QAbstractItemModel::flags(index); return Qt::ItemIsDragEnabled|QAbstractItemModel::flags(index);
} }
@ -249,7 +248,7 @@ void ApplicationListModel::runApplication(const QString &storageId)
KService::Ptr service = KService::serviceByStorageId(storageId); KService::Ptr service = KService::serviceByStorageId(storageId);
KRun::runService(*service, QList<QUrl>(), 0); KRun::runService(*service, QList<QUrl>(), nullptr);
} }
QStringList ApplicationListModel::appOrder() const QStringList ApplicationListModel::appOrder() const

View file

@ -41,8 +41,8 @@ class ApplicationListModel : public QAbstractListModel {
Q_PROPERTY(QStringList appOrder READ appOrder WRITE setAppOrder NOTIFY appOrderChanged) Q_PROPERTY(QStringList appOrder READ appOrder WRITE setAppOrder NOTIFY appOrderChanged)
public: public:
ApplicationListModel(QObject *parent = 0); ApplicationListModel(QObject *parent = nullptr);
virtual ~ApplicationListModel(); ~ApplicationListModel() override;
int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
@ -52,7 +52,7 @@ public:
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
Qt::ItemFlags flags(const QModelIndex &index) const; Qt::ItemFlags flags(const QModelIndex &index) const override;
QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE; QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE;

View file

@ -32,8 +32,7 @@ HomeScreen::HomeScreen(QObject *parent, const QVariantList &args)
} }
HomeScreen::~HomeScreen() HomeScreen::~HomeScreen()
{ = default;
}
ApplicationListModel *HomeScreen::applicationListModel() ApplicationListModel *HomeScreen::applicationListModel()
{ {

View file

@ -33,7 +33,7 @@ class HomeScreen : public Plasma::Containment
public: public:
HomeScreen( QObject *parent, const QVariantList &args ); HomeScreen( QObject *parent, const QVariantList &args );
~HomeScreen(); ~HomeScreen() override;
ApplicationListModel *applicationListModel(); ApplicationListModel *applicationListModel();

View file

@ -30,8 +30,7 @@ PhonePanel::PhonePanel(QObject *parent, const QVariantList &args)
} }
PhonePanel::~PhonePanel() PhonePanel::~PhonePanel()
{ = default;
}
void PhonePanel::executeCommand(const QString &command) void PhonePanel::executeCommand(const QString &command)
{ {
@ -42,7 +41,7 @@ void PhonePanel::executeCommand(const QString &command)
void PhonePanel::toggleTorch() void PhonePanel::toggleTorch()
{ {
if (!m_running) { if (!m_running) {
gst_init(NULL, NULL); gst_init(nullptr, nullptr);
// create elements // create elements
m_source = gst_element_factory_make("droidcamsrc", "source"); m_source = gst_element_factory_make("droidcamsrc", "source");
m_sink = gst_element_factory_make("fakesink", "sink"); m_sink = gst_element_factory_make("fakesink", "sink");

View file

@ -33,7 +33,7 @@ class PhonePanel : public Plasma::Containment
public: public:
PhonePanel( QObject *parent, const QVariantList &args ); PhonePanel( QObject *parent, const QVariantList &args );
~PhonePanel(); ~PhonePanel() override;
public Q_SLOTS: public Q_SLOTS:
void executeCommand(const QString &command); void executeCommand(const QString &command);

View file

@ -47,7 +47,7 @@ class TaskPanel : public Plasma::Containment
public: public:
TaskPanel( QObject *parent, const QVariantList &args ); TaskPanel( QObject *parent, const QVariantList &args );
~TaskPanel(); ~TaskPanel() override;
QWindow *panel(); QWindow *panel();
void setPanel(QWindow *panel); void setPanel(QWindow *panel);

View file

@ -47,11 +47,11 @@ public:
}; };
Q_ENUMS(Role) Q_ENUMS(Role)
KPeopleHelper(QObject *parent = 0); KPeopleHelper(QObject *parent = nullptr);
~KPeopleHelper(); ~KPeopleHelper() override;
virtual QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE; QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE;
virtual QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE; QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE;
private: private:
KPeople::PersonsModel *m_model; KPeople::PersonsModel *m_model;

View file

@ -29,7 +29,7 @@ class KPeopleHelperPlugin : public QQmlExtensionPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
public: public:
void registerTypes(const char *uri); void registerTypes(const char *uri) override;
}; };

View file

@ -54,8 +54,7 @@ CallHandler::CallHandler(DialerUtils *utils)
} }
CallHandler::~CallHandler() CallHandler::~CallHandler()
{ = default;
}
bool CallHandler::bypassApproval() const bool CallHandler::bypassApproval() const
{ {

View file

@ -26,16 +26,16 @@ class CallHandler : public QObject, public Tp::AbstractClientHandler
Q_OBJECT Q_OBJECT
public: public:
CallHandler(DialerUtils *utils); CallHandler(DialerUtils *utils);
virtual ~CallHandler(); ~CallHandler() override;
virtual bool bypassApproval() const; bool bypassApproval() const override;
virtual void handleChannels(const Tp::MethodInvocationContextPtr<> & context, void handleChannels(const Tp::MethodInvocationContextPtr<> & context,
const Tp::AccountPtr & account, const Tp::AccountPtr & account,
const Tp::ConnectionPtr & connection, const Tp::ConnectionPtr & connection,
const QList<Tp::ChannelPtr> & channels, const QList<Tp::ChannelPtr> & channels,
const QList<Tp::ChannelRequestPtr> & requestsSatisfied, const QList<Tp::ChannelRequestPtr> & requestsSatisfied,
const QDateTime & userActionTime, const QDateTime & userActionTime,
const Tp::AbstractClientHandler::HandlerInfo & handlerInfo); const Tp::AbstractClientHandler::HandlerInfo & handlerInfo) override;
private: private:
QList<Tp::CallChannelPtr> handledCallChannels; QList<Tp::CallChannelPtr> handledCallChannels;
DialerUtils *m_dialerUtils; DialerUtils *m_dialerUtils;

View file

@ -131,7 +131,7 @@ void CallManager::onCallStateChanged(Tp::CallState state)
//show approver; //show approver;
(void) d->callChannel->setRinging(); (void) d->callChannel->setRinging();
if (!d->ringingNotification) { if (!d->ringingNotification) {
d->ringingNotification = new KNotification("ringing", KNotification::Persistent | KNotification::LoopSound, 0); d->ringingNotification = new KNotification("ringing", KNotification::Persistent | KNotification::LoopSound, nullptr);
d->ringingNotification->setComponentName("plasma_dialer"); d->ringingNotification->setComponentName("plasma_dialer");
} }
d->ringingNotification->sendEvent(); d->ringingNotification->sendEvent();
@ -180,7 +180,7 @@ void CallManager::onCallStateChanged(Tp::CallState state)
qDebug() << "Adding notification"; qDebug() << "Adding notification";
d->missedCalls++; d->missedCalls++;
if (!d->callsNotification) { if (!d->callsNotification) {
d->callsNotification = new KNotification("callMissed", KNotification::Persistent, 0); d->callsNotification = new KNotification("callMissed", KNotification::Persistent, nullptr);
} }
d->callsNotification->setComponentName("plasma_dialer"); d->callsNotification->setComponentName("plasma_dialer");
d->callsNotification->setIconName("call-start"); d->callsNotification->setIconName("call-start");

View file

@ -26,8 +26,8 @@ class CallManager : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit CallManager(const Tp::CallChannelPtr &callChannel, DialerUtils *dialerUtils, QObject *parent = 0); explicit CallManager(const Tp::CallChannelPtr &callChannel, DialerUtils *dialerUtils, QObject *parent = nullptr);
virtual ~CallManager(); ~CallManager() override;
private Q_SLOTS: private Q_SLOTS:
void onCallStateChanged(Tp::CallState state); void onCallStateChanged(Tp::CallState state);

View file

@ -50,8 +50,7 @@ DialerUtils::DialerUtils(const Tp::AccountPtr &simAccount, QObject *parent)
} }
DialerUtils::~DialerUtils() DialerUtils::~DialerUtils()
{ = default;
}
void DialerUtils::dial(const QString &number) void DialerUtils::dial(const QString &number)
{ {

View file

@ -36,8 +36,8 @@ class DialerUtils : public QObject
public: public:
DialerUtils(const Tp::AccountPtr &simAccount, QObject *parent = 0); DialerUtils(const Tp::AccountPtr &simAccount, QObject *parent = nullptr);
virtual ~DialerUtils(); ~DialerUtils() override;
QString callState() const; QString callState() const;
void setCallState(const QString &state); void setCallState(const QString &state);

View file

@ -151,13 +151,13 @@ int main(int argc, char **argv)
const QString packagePath("org.kde.phone.dialer"); const QString packagePath("org.kde.phone.dialer");
//usually we have an ApplicationWindow here, so we do not need to create a window by ourselves //usually we have an ApplicationWindow here, so we do not need to create a window by ourselves
KDeclarative::QmlObject *obj = new KDeclarative::QmlObject(); auto *obj = new KDeclarative::QmlObject();
obj->setTranslationDomain(packagePath); obj->setTranslationDomain(packagePath);
obj->setInitializationDelayed(true); obj->setInitializationDelayed(true);
obj->loadPackage(packagePath); obj->loadPackage(packagePath);
obj->engine()->rootContext()->setContextProperty("commandlineArguments", parser.positionalArguments()); obj->engine()->rootContext()->setContextProperty("commandlineArguments", parser.positionalArguments());
DialerUtils *dialerUtils = new DialerUtils(simAccount); auto *dialerUtils = new DialerUtils(simAccount);
obj->engine()->rootContext()->setContextProperty("dialerUtils", QVariant::fromValue(dialerUtils)); obj->engine()->rootContext()->setContextProperty("dialerUtils", QVariant::fromValue(dialerUtils));
obj->completeInitialization(); obj->completeInitialization();