Commit 8d705fab authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Make it build against latest KDECompilerSettings

Use uppercase keywords

Wrap string literals
parent 8c5d9cfc
Pipeline #77214 passed with stage
in 17 seconds
......@@ -10,7 +10,7 @@ project(kweather)
set(PROJECT_VERSION "21.07")
set(QT_MIN_VERSION "5.15.0")
set(KF5_MIN_VERSION "5.82.0")
set(KF5_MIN_VERSION "5.85.0")
set(CMAKE_CXX_STANDARD 17)
Please register or sign in to reply
set(CMAKE_CXX_STANDARD_REQUIRED ON)
......
......@@ -26,7 +26,7 @@ static double convertTemp(double temp, const QString &unit)
enum class WindDirection { N, NW, W, SW, S, SE, E, NE };
enum class Backend { NMI, OWM };
struct ResolvedWeatherDesc {
QString icon = "weather-none-available", desc = "Unknown";
QString icon = QStringLiteral("weather-none-available"), desc = QStringLiteral("Unknown");
ResolvedWeatherDesc() = default;
ResolvedWeatherDesc(QString icon, QString desc)
{
......
......@@ -29,10 +29,10 @@ int LocationQueryModel::rowCount(const QModelIndex &parent) const
static QString buildResultName(const KWeatherCore::LocationQueryResult &result)
{
const auto &countryCode = result.countryCode();
if (result.subdivision() && countryCode == "US") {
return result.toponymName() + ", " + *result.subdivision() + " | " + result.countryName();
if (result.subdivision() && countryCode == QLatin1String("US")) {
return result.toponymName() + QLatin1String(", ") + *result.subdivision() + QLatin1String(" | ") + result.countryName();
}
return result.toponymName() + " | " + result.countryName();
return result.toponymName() + QLatin1String(" | ") + result.countryName();
}
QVariant LocationQueryModel::data(const QModelIndex &index, int role) const
......
......@@ -53,7 +53,7 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
KLocalizedString::setApplicationDomain("kweather");
engine.rootContext()->setContextObject(new KLocalizedContext(&engine));
KAboutData aboutData("kweather",
KAboutData aboutData(QStringLiteral("kweather"),
i18n("Weather"),
QStringLiteral(KWEATHER_VERSION_STRING),
i18n("A convergent weather application for Plasma"),
......@@ -65,8 +65,8 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
engine.rootContext()->setContextProperty(QStringLiteral("kweatherAboutData"), QVariant::fromValue(aboutData));
engine.rootContext()->setContextProperty("weatherLocationListModel", WeatherForecastManager::inst()->model());
engine.rootContext()->setContextProperty("settingsModel", KWeatherSettings::self());
engine.rootContext()->setContextProperty(QStringLiteral("weatherLocationListModel"), WeatherForecastManager::inst()->model());
engine.rootContext()->setContextProperty(QStringLiteral("settingsModel"), KWeatherSettings::self());
Formatter formatter;
qmlRegisterSingletonInstance<Formatter>("kweather", 1, 0, "Formatter", &formatter);
......
......@@ -38,7 +38,7 @@ public:
Q_INVOKABLE QStringList locationsInSystem();
Q_INVOKABLE void setLocation(const QString &location);
signals:
Q_SIGNALS:
void locationChanged();
void updated();
void needLocationChanged();
......
......@@ -129,10 +129,10 @@ void WeatherLocation::updateData(KWeatherCore::WeatherForecast forecasts)
}
Q_EMIT dayForecastsChanged();
emit weatherRefresh(m_forecast);
emit stopLoadingIndicator();
Q_EMIT weatherRefresh(m_forecast);
Q_EMIT stopLoadingIndicator();
emit propertyChanged();
Q_EMIT propertyChanged();
updateCurrentDateTime();
}
......@@ -208,7 +208,7 @@ void WeatherLocation::determineCurrentForecast()
m_iconColor = QStringLiteral("white");
m_isDarkTheme = true;
}
emit currentForecastChange();
Q_EMIT currentForecastChange();
}
void WeatherLocation::update()
......
......@@ -80,7 +80,7 @@ public:
}
QString lastUpdatedFormatted() const
{
return lastUpdated().toString("hh:mm ap");
return lastUpdated().toString(QStringLiteral("hh:mm ap"));
}
const QDateTime &lastUpdated() const
{
......@@ -88,11 +88,11 @@ public:
}
QString currentTimeFormatted() const
{
return currentDateTime().toString("hh:mm ap");
return currentDateTime().toString(QStringLiteral("hh:mm ap"));
}
QString currentDateFormatted() const
{
return currentDateTime().toString("dd MMM yyyy");
return currentDateTime().toString(QStringLiteral("dd MMM yyyy"));
}
QDateTime currentDateTime() const
{
......@@ -101,7 +101,7 @@ public:
void setLastUpdated(QDateTime lastUpdated)
{
m_lastUpdated = std::move(lastUpdated);
emit propertyChanged();
Q_EMIT propertyChanged();
}
const QString &backgroundComponent() const
{
......@@ -157,10 +157,10 @@ public:
void saveOrder(int index);
int index();
void deleteConfig();
public slots:
public Q_SLOTS:
void updateData(KWeatherCore::WeatherForecast forecasts);
signals:
Q_SIGNALS:
void weatherRefresh(KWeatherCore::WeatherForecast forecasts); // sent when weather data is refreshed
void currentForecastChange();
void propertyChanged(); // avoid warning
......@@ -172,7 +172,7 @@ signals:
void selectedDayChanged();
void chartListChanged();
private slots:
private Q_SLOTS:
void updateCurrentDateTime();
private:
......
Markdown is supported
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