Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/widgets/centertopwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const int TOP_TIP_SPACING = 10;

#ifdef ENABLE_DSS_SNIPE
static const QString localeNameKey = "localeName";
static const QString longDateFormatKey = "longDateFormat";
static const QString shortDateFormatKey = "shortDateFormat";
static const QString shortTimeFormatKey = "shortTimeFormat";
#endif // ENABLE_DSS_SNIPE

Expand Down Expand Up @@ -178,7 +178,7 @@ void CenterTopWidget::onUserRegionFormatValueChanged(const QDBusMessage &dbusMes
return;

QString key = dbusMessage.arguments().at(0).toString();
if (key == localeNameKey || key == shortTimeFormatKey || key == longDateFormatKey) {
if (key == localeNameKey || key == shortTimeFormatKey || key == shortDateFormatKey) {
updateUserDateTimeFormat();
}
}
Expand Down Expand Up @@ -251,8 +251,8 @@ void CenterTopWidget::updateUserDateTimeFormat()

QString localeName = qApp->applicationName() == "dde-lock" ? QLocale::system().name() : getRegionFormatValue(userConfigDbusPath, localeNameKey);
QString shortTimeFormat = getRegionFormatValue(userConfigDbusPath, shortTimeFormatKey);
QString longDateFormat = getRegionFormatValue(userConfigDbusPath, longDateFormatKey);
QString shortDateFormat = getRegionFormatValue(userConfigDbusPath, shortDateFormatKey);

m_timeWidget->updateLocale(localeName, shortTimeFormat, longDateFormat);
m_timeWidget->updateLocale(localeName, shortTimeFormat, shortDateFormat);
}
#endif // ENABLE_DSS_SNIPE
10 changes: 5 additions & 5 deletions src/widgets/timewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ void TimeWidget::refreshTime()
m_dateLabel->setText(m_locale.toString(QDateTime::currentDateTime(), date_format));

#ifdef ENABLE_DSS_SNIPE
if (!m_shortTimeFormat.isEmpty() && !m_longDateFormat.isEmpty()) {
if (!m_shortTimeFormat.isEmpty() && !m_shortDateFormat.isEmpty()) {
m_timeLabel->setText(m_locale.toString(QTime::currentTime(), m_shortTimeFormat));
m_dateLabel->setText(m_locale.toString(QDate::currentDate(), m_longDateFormat));
m_dateLabel->setText(m_locale.toString(QDate::currentDate(), m_shortDateFormat + " " + weekdayFormat.at(m_weekdayIndex)));
}
#endif // ENABLE_DSS_SNIPE
}
Expand Down Expand Up @@ -131,13 +131,13 @@ QSize TimeWidget::sizeHint() const
}

#ifdef ENABLE_DSS_SNIPE
void TimeWidget::updateLocale(const QString &locale, const QString &shortTimeFormat, const QString &longDateFormat)
void TimeWidget::updateLocale(const QString &locale, const QString &shortTimeFormat, const QString &shortDateFormat)
{
m_locale = QLocale(locale);
if (!shortTimeFormat.isEmpty())
m_shortTimeFormat = shortTimeFormat;
if (!longDateFormat.isEmpty())
m_longDateFormat = longDateFormat;
if (!shortDateFormat.isEmpty())
m_shortDateFormat = shortDateFormat;

refreshTime();
}
Expand Down
4 changes: 2 additions & 2 deletions src/widgets/timewidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
QSize sizeHint() const override;

#ifdef ENABLE_DSS_SNIPE
void updateLocale(const QString &locale, const QString &shortTimeFormat = "", const QString &longDateFormat = "");
void updateLocale(const QString &locale, const QString &shortTimeFormat = "", const QString &shortDateFormat = "");
#endif // ENABLE_DSS_SNIPE

public Q_SLOTS:

Check warning on line 30 in src/widgets/timewidget.h

View workflow job for this annotation

GitHub Actions / cppcheck

There is an unknown macro here somewhere. Configuration is required. If Q_SLOTS is a macro then please configure it.
void setWeekdayFormatType(int type);
void setShortDateFormat(int type);
void setShortTimeFormat(int type);
Expand All @@ -49,7 +49,7 @@

#ifdef ENABLE_DSS_SNIPE
QString m_shortTimeFormat;
QString m_longDateFormat;
QString m_shortDateFormat;
#endif // ENABLE_DSS_SNIPE
};

Expand Down
Loading