diff --git a/debian/control b/debian/control index 3f5eba0c8..98116aa70 100644 --- a/debian/control +++ b/debian/control @@ -2,73 +2,80 @@ Source: dde-dock Section: x11 Priority: optional Maintainer: Deepin Packages Builder -Build-Depends: debhelper-compat (= 10), - pkg-config, +Build-Depends: cmake, - qt5-qmake, - libxcb-image0-dev, - libxcb-composite0-dev, - libxcb-ewmh-dev, - libxtst-dev, - qttools5-dev-tools, - qtbase5-private-dev, - libxcb-icccm4-dev, - libqt5x11extras5-dev, - libxcb-damage0-dev, - libqt5svg5-dev, - libdtkwidget-dev (>=5.4.19), + debhelper-compat (= 10), + extra-cmake-modules, + libdbusmenu-qt5-dev, libdtkcore-dev (>=5.4.14), libdtkcore5-bin (>=5.4.14), libdtkgui-dev (>=5.4.13), - libgsettings-qt-dev, - libdbusmenu-qt5-dev, - libgtest-dev, - libgmock-dev, - qttools5-dev, - libxcursor-dev, - libxres-dev, - libqt5waylandclient5-dev, - qtwayland5-private-dev, - libxdamage-dev, + libdtkwidget-dev (>=5.4.19), libdwayland-dev, - extra-cmake-modules + libgmock-dev, + libgsettings-qt-dev, + libgtest-dev, + libqt5svg5-dev, + libqt5waylandclient5-dev, + libqt5x11extras5-dev, + libxcb-composite0-dev, + libxcb-damage0-dev, + libxcb-ewmh-dev, + libxcb-icccm4-dev, + libxcb-image0-dev, + libxcursor-dev, + libxdamage-dev, + libxres-dev, + libxtst-dev, + pkg-config, + qt5-qmake, + qtbase5-private-dev, + qttools5-dev, + qttools5-dev-tools, + qtwayland5-private-dev, Standards-Version: 3.9.8 Homepage: http://www.deepin.org/ Package: dde-dock Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, - deepin-desktop-schemas (>=5.9.14), - dde-qt5xcb-plugin (>=5.0.25), +Depends: + dbus-bin, dde-daemon (>=5.13.12), - startdde (>=5.8.9), + dde-qt5xcb-plugin (>=5.0.25), + deepin-desktop-schemas (>=5.9.14), lastore-daemon (>=5.2.9), qtxdg-dev-tools, - dbus-bin + startdde (>=5.8.9), + ${misc:Depends}, + ${shlibs:Depends}, Recommends: dde-disk-mount-plugin, dde-dock-onboard-plugin, + dde-network-dialog, dock-network-plugin, - dde-network-dialog Conflicts: - dde-workspace (<< 2.90.5), dde-dock-applets, dde-trash-plugin, - dock-hotspot-plugin + dde-workspace (<< 2.90.5), + dock-hotspot-plugin, Replaces: dde-dock-applets, - dde-trash-plugin + dde-trash-plugin, Description: deepin desktop-environment - dock module Dock module of deepin desktop-environment Package: dde-dock-dev Architecture: any -Depends: ${misc:Depends} +Depends: + ${misc:Depends}, Description: deepin desktop-environment - dock module development files Dock module development files of deepin desktop-environment Package: dde-dock-onboard-plugin Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, onboard +Depends: + onboard, + ${misc:Depends}, + ${shlibs:Depends}, Description: deepin desktop-environment - dock plugin for onboard Dock plugin for onboard of deepin desktop-environment diff --git a/frame/window/components/datetimedisplayer.cpp b/frame/window/components/datetimedisplayer.cpp index 24859b36a..2b78c06d2 100644 --- a/frame/window/components/datetimedisplayer.cpp +++ b/frame/window/components/datetimedisplayer.cpp @@ -35,6 +35,8 @@ static QMap timeFormat{{0, "h:mm"}, {1, "hh:mm"}}; const QString localeName_key = "localeName"; const QString shortDateFormat_key = "shortDateFormat"; const QString shortTimeFormat_key = "shortTimeFormat"; +const QString longDateFormat_key = "longDateFormat"; +const QString longTimeFormat_key = "longTimeFormat"; DateTimeDisplayer::DateTimeDisplayer(bool showMultiRow, QWidget *parent) : QWidget (parent) @@ -71,17 +73,34 @@ DateTimeDisplayer::DateTimeDisplayer(bool showMultiRow, QWidget *parent) m_tipPopupWindow->hide(); m_locale = QLocale::system(); + initDConfig(); +} + +void DateTimeDisplayer::initDConfig() +{ if (!m_config->isValid()) return; + if (!m_config->isDefaultValue(localeName_key)) { m_locale = QLocale(m_config->value(localeName_key).toString()); } + if (!m_config->isDefaultValue(shortDateFormat_key)) { m_shortDateFormatStr = m_config->value(shortDateFormat_key).toString(); } + if (!m_config->isDefaultValue(shortTimeFormat_key)) { m_shortTimeFormatStr = m_config->value(shortTimeFormat_key).toString(); } + + if (!m_config->isDefaultValue(longTimeFormat_key)) { + m_longTimeFormatStr = m_config->value(longTimeFormat_key).toString(); + } + + if (!m_config->isDefaultValue(longDateFormat_key)) { + m_longDateFormatStr = m_config->value(longDateFormat_key).toString(); + } + connect(m_config, &DTK_CORE_NAMESPACE::DConfig::valueChanged, this, [this] (const QString &key) { if (key == shortDateFormat_key) { m_shortDateFormatStr = m_config->value(key).toString(); @@ -89,7 +108,12 @@ DateTimeDisplayer::DateTimeDisplayer(bool showMultiRow, QWidget *parent) m_shortTimeFormatStr = m_config->value(key).toString(); } else if (key == localeName_key) { m_locale = QLocale(m_config->value(key).toString()); + } else if (key == longDateFormat_key) { + m_longDateFormatStr = m_config->value(key).toString(); + } else if (key == longTimeFormat_key) { + m_longTimeFormatStr = m_config->value(key).toString(); } + update(); }); } @@ -176,12 +200,6 @@ QString DateTimeDisplayer::getTimeString(const Dock::Position &position) const tFormat = timeFormat[m_shortDateFormat]; if (!m_shortTimeFormatStr.isEmpty()) tFormat = m_shortTimeFormatStr; - if (!m_use24HourFormat) { - if (position == Dock::Top || position == Dock::Bottom) - tFormat = tFormat.append(" AP"); - else - tFormat = tFormat.append("\nAP"); - } return m_locale.toString(QDateTime::currentDateTime(), tFormat); } @@ -266,12 +284,7 @@ DateTimeDisplayer::DateTimeInfo DateTimeDisplayer::dateTimeInfo(const Dock::Posi void DateTimeDisplayer::onTimeChanged() { - const QDateTime currentDateTime = QDateTime::currentDateTime(); - - if (m_use24HourFormat) - m_tipsWidget->setText(QLocale().toString(currentDateTime.date()) + currentDateTime.toString(" HH:mm:ss")); - else - m_tipsWidget->setText(QLocale().toString(currentDateTime.date()) + currentDateTime.toString(" hh:mm:ss AP")); + m_tipsWidget->setText(m_locale.toString(QDate::currentDate(), m_longDateFormatStr) + QString(" ") + m_locale.toString(QTime::currentTime(), m_longTimeFormatStr)); // 如果时间和日期有一个不等,则实时刷新界面 if (m_lastDateString != getDateString() || m_lastTimeString != getTimeString()) @@ -281,7 +294,6 @@ void DateTimeDisplayer::onTimeChanged() void DateTimeDisplayer::onDateTimeFormatChanged() { m_shortDateFormat = m_timedateInter->shortDateFormat(); - m_use24HourFormat = m_timedateInter->use24HourFormat(); // 此处需要强制重绘,因为在重绘过程中才会改变m_currentSize信息,方便在后面判断是否需要调整尺寸 repaint(); } @@ -294,7 +306,6 @@ void DateTimeDisplayer::paintEvent(QPaintEvent *e) QPainter painter(this); painter.setRenderHint(QPainter::Antialiasing); - int timeAlignFlag = Qt::AlignCenter; int dateAlignFlag = Qt::AlignCenter; @@ -377,17 +388,6 @@ void DateTimeDisplayer::updateFont() const void DateTimeDisplayer::createMenuItem() { - QAction *timeFormatAction = new QAction(this); - timeFormatAction->setText(m_use24HourFormat ? tr("12-hour time"): tr("24-hour time")); - - connect(timeFormatAction, &QAction::triggered, this, [ = ] { - bool use24hourformat = !m_use24HourFormat; - // 此时调用 dbus 更新时间格式但是本地 m_use24HourFormat 未更新,所以需要使用新变量,设置新格式 - m_timedateInter->setUse24HourFormat(use24hourformat); - timeFormatAction->setText(use24hourformat ? tr("12-hour time") : tr("24-hour time")); - }); - m_menu->addAction(timeFormatAction); - if (!QFile::exists(ICBC_CONF_FILE)) { QAction *timeSettingAction = new QAction(tr("Time settings"), this); connect(timeSettingAction, &QAction::triggered, this, [ = ] { diff --git a/frame/window/components/datetimedisplayer.h b/frame/window/components/datetimedisplayer.h index d4f055c88..cee295060 100644 --- a/frame/window/components/datetimedisplayer.h +++ b/frame/window/components/datetimedisplayer.h @@ -72,6 +72,7 @@ private: void createMenuItem(); QRect textRect(const QRect &sourceRect) const; + void initDConfig(); private Q_SLOTS: void onTimeChanged(); @@ -92,10 +93,11 @@ private: bool m_oneRow; bool m_showMultiRow; int m_shortDateFormat; - bool m_use24HourFormat; DTK_CORE_NAMESPACE::DConfig *m_config; QString m_shortDateFormatStr; QString m_shortTimeFormatStr; + QString m_longDateFormatStr; + QString m_longTimeFormatStr; QLocale m_locale; };