Commit 8670816e authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix some clazy warning + initialize variables in headers

parent 9fe1c85c
......@@ -10,7 +10,6 @@
InfoNotification::InfoNotification(QObject *parent)
: QObject(parent)
, m_enabled(false)
{
}
......
......@@ -52,7 +52,7 @@ Q_SIGNALS:
void acknowledgeActionTextChanged() const;
private:
bool m_enabled;
bool m_enabled = false;
QString m_iconName;
QString m_titleText;
QString m_text;
......
......@@ -13,7 +13,6 @@
DirectoryPicker::DirectoryPicker(QObject *parent)
: QObject(parent)
, m_dialog(nullptr)
{
}
......
......@@ -33,7 +33,7 @@ private Q_SLOTS:
void dialogAccepted();
private:
QFileDialog *m_dialog;
QFileDialog *m_dialog = nullptr;
QUrl m_url;
};
......
......@@ -13,8 +13,8 @@
PlacesModel::PlacesModel(QObject *parent)
: QSortFilterProxyModel(parent)
, m_sourceModel(new KFilePlacesModel(this))
{
m_sourceModel = new KFilePlacesModel(this);
connect(m_sourceModel, &KFilePlacesModel::rowsInserted, this, &PlacesModel::placesChanged);
connect(m_sourceModel, &KFilePlacesModel::rowsRemoved, this, &PlacesModel::placesChanged);
......
......@@ -39,7 +39,7 @@ protected:
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
private:
KFilePlacesModel *m_sourceModel;
KFilePlacesModel *const m_sourceModel;
bool m_showDesktopEntry = true;
};
......
......@@ -119,7 +119,7 @@ private:
QStringList m_positions;
bool m_deferApplyPositions;
QVariantList m_deferMovePositions;
QTimer *m_updatePositionsTimer;
QTimer *const m_updatePositionsTimer;
QHash<int, int> m_proxyToSource;
QHash<int, int> m_sourceToProxy;
......
......@@ -14,6 +14,9 @@
#include <KConfig>
#include <KConfigGroup>
#include <Plasma/Corona>
#include <chrono>
using namespace std::chrono_literals;
ScreenMapper *ScreenMapper::instance()
{
......@@ -33,15 +36,15 @@ ScreenMapper::ScreenMapper(QObject *parent)
return;
auto config = m_corona->config();
KConfigGroup group(config, QLatin1String("ScreenMapping"));
group.writeEntry(QLatin1String("screenMapping"), screenMapping());
KConfigGroup group(config, QStringLiteral("ScreenMapping"));
group.writeEntry(QStringLiteral("screenMapping"), screenMapping());
config->sync();
});
// used to compress screenMappingChanged signals when addMapping is called multiple times,
// eg. from FolderModel::filterAcceptRows. The timer interval is an arbitrary number,
// that doesn't delay too much the signal, but still compresses as much as possible
m_screenMappingChangedTimer->setInterval(100);
m_screenMappingChangedTimer->setInterval(100ms);
m_screenMappingChangedTimer->setSingleShot(true);
}
......@@ -171,8 +174,8 @@ void ScreenMapper::setSharedDesktop(bool sharedDesktops)
return;
auto config = m_corona->config();
KConfigGroup group(config, QLatin1String("ScreenMapping"));
group.writeEntry(QLatin1String("sharedDesktops"), m_sharedDesktops);
KConfigGroup group(config, QStringLiteral("ScreenMapping"));
group.writeEntry(QStringLiteral("sharedDesktops"), m_sharedDesktops);
}
}
......@@ -201,10 +204,10 @@ void ScreenMapper::setCorona(Plasma::Corona *corona)
});
auto config = m_corona->config();
KConfigGroup group(config, QLatin1String("ScreenMapping"));
const QStringList mapping = group.readEntry(QLatin1String("screenMapping"), QStringList{});
KConfigGroup group(config, QStringLiteral("ScreenMapping"));
const QStringList mapping = group.readEntry(QStringLiteral("screenMapping"), QStringList{});
setScreenMapping(mapping);
m_sharedDesktops = group.readEntry(QLatin1String("sharedDesktops"), false);
m_sharedDesktops = group.readEntry(QStringLiteral("sharedDesktops"), false);
readDisabledScreensMap();
}
}
......@@ -262,8 +265,8 @@ void ScreenMapper::readDisabledScreensMap()
return;
auto config = m_corona->config();
KConfigGroup group(config, QLatin1String("ScreenMapping"));
const QStringList serializedMap = group.readEntry(QLatin1String("itemsOnDisabledScreens"), QStringList{});
KConfigGroup group(config, QStringLiteral("ScreenMapping"));
const QStringList serializedMap = group.readEntry(QStringLiteral("itemsOnDisabledScreens"), QStringList{});
m_itemsOnDisabledScreensMap.clear();
bool readingScreenId = true;
int vectorSize = -1;
......@@ -295,7 +298,7 @@ void ScreenMapper::saveDisabledScreensMap() const
return;
auto config = m_corona->config();
KConfigGroup group(config, QLatin1String("ScreenMapping"));
KConfigGroup group(config, QStringLiteral("ScreenMapping"));
QStringList serializedMap;
auto it = m_itemsOnDisabledScreensMap.constBegin();
for (; it != m_itemsOnDisabledScreensMap.constEnd(); ++it) {
......@@ -307,5 +310,5 @@ void ScreenMapper::saveDisabledScreensMap() const
}
}
group.writeEntry(QLatin1String("itemsOnDisabledScreens"), serializedMap);
group.writeEntry(QStringLiteral("itemsOnDisabledScreens"), serializedMap);
}
......@@ -75,7 +75,7 @@ private:
QHash<QUrl, QVector<int>> m_screensPerPath; // screens per registered path
QVector<int> m_availableScreens;
Plasma::Corona *m_corona = nullptr;
QTimer *m_screenMappingChangedTimer = nullptr;
QTimer *const m_screenMappingChangedTimer;
bool m_sharedDesktops = false; // all screens share the same desktops, disabling the screen mapping
};
......
......@@ -47,9 +47,9 @@ void ComponentChooser::load()
return false;
}
QVariantMap application;
application["name"] = service->name();
application["icon"] = service->icon();
application["storageId"] = service->storageId();
application[QStringLiteral("name")] = service->name();
application[QStringLiteral("icon")] = service->icon();
application[QStringLiteral("storageId")] = service->storageId();
m_applications += application;
if ((preferredService && preferredService->storageId() == service->storageId())) {
m_index = m_applications.length() - 1;
......
......@@ -22,7 +22,7 @@ ComponentChooserEmail::ComponentChooserEmail(QObject *parent)
void ComponentChooserEmail::save()
{
const QString storageId = m_applications[m_index].toMap()["storageId"].toString();
const QString storageId = m_applications[m_index].toMap()[QStringLiteral("storageId")].toString();
const KService::Ptr emailClientService = KService::serviceByStorageId(storageId);
if (!emailClientService) {
return;
......
......@@ -17,5 +17,5 @@ ComponentChooserFileManager::ComponentChooserFileManager(QObject *parent)
void ComponentChooserFileManager::save()
{
saveMimeTypeAssociation(QStringLiteral("inode/directory"), m_applications[m_index].toMap()["storageId"].toString());
saveMimeTypeAssociation(QStringLiteral("inode/directory"), m_applications[m_index].toMap()[QStringLiteral("storageId")].toString());
}
......@@ -36,7 +36,7 @@ public:
bool isSaveNeeded() const override;
private:
ComponentChooserData *m_data;
ComponentChooserData *const m_data;
};
#endif
......@@ -38,7 +38,7 @@ private:
void setDefaultIndicatorVisible(KUrlRequester *widget, const QVariant &defaultValue);
QScopedPointer<Ui::DesktopPathsView> m_ui;
DesktopPathsData *m_data;
DesktopPathsData *const m_data;
};
#endif
......@@ -71,9 +71,9 @@ LibinputConfig::LibinputConfig(ConfigContainer *parent, InputBackend *backend)
kdeclarative.setupContext();
if (m_backend->mode() == InputBackendMode::XLibinput) {
m_view->setSource(QUrl("qrc:/libinput/main_deviceless.qml"));
m_view->setSource(QUrl(QStringLiteral("qrc:/libinput/main_deviceless.qml")));
} else {
m_view->setSource(QUrl("qrc:/libinput/main.qml"));
m_view->setSource(QUrl(QStringLiteral("qrc:/libinput/main.qml")));
}
if (m_initError) {
......@@ -91,12 +91,12 @@ LibinputConfig::LibinputConfig(ConfigContainer *parent, InputBackend *backend)
QSize LibinputConfig::sizeHint() const
{
return QQmlProperty::read(m_view->rootObject(), "sizeHint").toSize();
return QQmlProperty::read(m_view->rootObject(), QStringLiteral("sizeHint")).toSize();
}
QSize LibinputConfig::minimumSizeHint() const
{
return QQmlProperty::read(m_view->rootObject(), "minimumSizeHint").toSize();
return QQmlProperty::read(m_view->rootObject(), QStringLiteral("minimumSizeHint")).toSize();
}
void LibinputConfig::load()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment