├── README.md ├── cmdu.json ├── cmdu.pro ├── cmduplugin.cpp ├── cmduplugin.h ├── cmduwidget.cpp ├── cmduwidget.h ├── icon.png ├── preview.png ├── preview90.png └── res.qrc /README.md: -------------------------------------------------------------------------------- 1 | # CMDU_DDE_DOCK 2 | 深度 Linux 系统网速任务栏插件,鼠标悬浮显示开机时间、CPU使用率、内存使用率、下载字节、上传字节。 3 | 4 | ![alt](preview.png) 5 | 内存占用大于90%时显示为红色以示警告,注意减少内存预防死机。 6 | ![alt](preview90.png) 7 | 8 | 安装:终端 ./install.sh 9 | 卸载:终端 ./uninstall.sh 10 | 11 | ### 系统版本对应插件版本 12 | 13 | 14 | 15 | 16 |
DeepinDock Plugin
20> 1.2
15.11> 1.1.1
-------------------------------------------------------------------------------- /cmdu.json: -------------------------------------------------------------------------------- 1 | { 2 | "api": "1.2" 3 | } -------------------------------------------------------------------------------- /cmdu.pro: -------------------------------------------------------------------------------- 1 | QT += widgets 2 | TEMPLATE = lib 3 | CONFIG += c++11 plugin 4 | 5 | TARGET = HTYCMDU 6 | DISTFILES += cmdu.json 7 | 8 | HEADERS += \ 9 | cmduplugin.h \ 10 | cmduwidget.h 11 | 12 | SOURCES += \ 13 | cmduplugin.cpp \ 14 | cmduwidget.cpp 15 | 16 | RESOURCES += res.qrc -------------------------------------------------------------------------------- /cmduplugin.cpp: -------------------------------------------------------------------------------- 1 | #include "cmduplugin.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | CMDUPlugin::CMDUPlugin(QObject *parent) 12 | : QObject(parent), 13 | m_tipsLabel(new QLabel), 14 | m_refershTimer(new QTimer(this)), 15 | m_settings("deepin", "HTYCMDU") 16 | { 17 | i=db=ub=dbt=ubt=dbt1=ubt1=dbt0=ubt0=0; 18 | m_tipsLabel->setObjectName("cmdu"); 19 | m_tipsLabel->setStyleSheet("color:white; padding:0px 3px;"); 20 | m_refershTimer->setInterval(1000); 21 | m_refershTimer->start(); 22 | m_centralWidget = new CMDUWidget; 23 | connect(m_centralWidget, &CMDUWidget::requestUpdateGeometry, [this] { m_proxyInter->itemUpdate(this, pluginName()); }); 24 | connect(m_refershTimer, &QTimer::timeout, this, &CMDUPlugin::updateCMDU); 25 | 26 | // Boot time 27 | QProcess *process = new QProcess; 28 | process->start("systemd-analyze"); 29 | process->waitForFinished(); 30 | QString PO = process->readAllStandardOutput(); 31 | QString SD = PO.mid(PO.indexOf("=") + 1, PO.indexOf("\n") - PO.indexOf("=") - 1); 32 | startup = "SUT: " + SD; 33 | } 34 | 35 | const QString CMDUPlugin::pluginName() const 36 | { 37 | return "HTYCMDU"; 38 | } 39 | 40 | const QString CMDUPlugin::pluginDisplayName() const 41 | { 42 | return "HTYCMDU"; 43 | } 44 | 45 | void CMDUPlugin::init(PluginProxyInterface *proxyInter) 46 | { 47 | m_proxyInter = proxyInter; 48 | if (m_centralWidget->enabled()) 49 | m_proxyInter->itemAdded(this, pluginName()); 50 | } 51 | 52 | void CMDUPlugin::pluginStateSwitched() 53 | { 54 | m_centralWidget->setEnabled(!m_centralWidget->enabled()); 55 | if (m_centralWidget->enabled()) 56 | m_proxyInter->itemAdded(this, pluginName()); 57 | else 58 | m_proxyInter->itemRemoved(this, pluginName()); 59 | } 60 | 61 | bool CMDUPlugin::pluginIsDisable() 62 | { 63 | return !m_centralWidget->enabled(); 64 | } 65 | 66 | int CMDUPlugin::itemSortKey(const QString &itemKey) 67 | { 68 | Q_UNUSED(itemKey); 69 | 70 | const QString key = QString("pos_%1").arg(displayMode()); 71 | return m_settings.value(key, 0).toInt(); 72 | } 73 | 74 | void CMDUPlugin::setSortKey(const QString &itemKey, const int order) 75 | { 76 | Q_UNUSED(itemKey); 77 | 78 | const QString key = QString("pos_%1").arg(displayMode()); 79 | m_settings.setValue(key, order); 80 | } 81 | 82 | QWidget *CMDUPlugin::itemWidget(const QString &itemKey) 83 | { 84 | Q_UNUSED(itemKey); 85 | return m_centralWidget; 86 | } 87 | 88 | QWidget *CMDUPlugin::itemTipsWidget(const QString &itemKey) 89 | { 90 | Q_UNUSED(itemKey); 91 | return m_tipsLabel; 92 | } 93 | 94 | const QString CMDUPlugin::itemCommand(const QString &itemKey) 95 | { 96 | Q_UNUSED(itemKey); 97 | return ""; 98 | } 99 | 100 | const QString CMDUPlugin::itemContextMenu(const QString &itemKey) 101 | { 102 | Q_UNUSED(itemKey); 103 | 104 | QList items; 105 | items.reserve(1); 106 | 107 | QMap about; 108 | about["itemId"] = "about"; 109 | about["itemText"] = tr("About"); 110 | about["isActive"] = true; 111 | items.push_back(about); 112 | 113 | QMap changelog; 114 | changelog["itemId"] = "changelog"; 115 | changelog["itemText"] = tr("Changelog"); 116 | changelog["isActive"] = true; 117 | items.push_back(changelog); 118 | 119 | QMap boot_analyze; 120 | boot_analyze["itemId"] = "boot_analyze"; 121 | boot_analyze["itemText"] = tr("Boot analyze"); 122 | boot_analyze["isActive"] = true; 123 | items.push_back(boot_analyze); 124 | 125 | QMap boot_record; 126 | boot_record["itemId"] = "boot_record"; 127 | boot_record["itemText"] = tr("Boot record"); 128 | boot_record["isActive"] = true; 129 | items.push_back(boot_record); 130 | 131 | QMap system_monitor; 132 | system_monitor["itemId"] = "system_monitor"; 133 | system_monitor["itemText"] = tr("System monitor"); 134 | system_monitor["isActive"] = true; 135 | items.push_back(system_monitor); 136 | 137 | QMap menu; 138 | menu["items"] = items; 139 | menu["checkableMenu"] = false; 140 | menu["singleCheck"] = false; 141 | return QJsonDocument::fromVariant(menu).toJson(); 142 | } 143 | 144 | void CMDUPlugin::invokedMenuItem(const QString &itemKey, const QString &menuId, const bool checked) 145 | { 146 | Q_UNUSED(itemKey); 147 | Q_UNUSED(checked); 148 | if (menuId == "about") { 149 | about(); 150 | } else if (menuId == "changelog") { 151 | changelog(); 152 | } else if (menuId == "boot_analyze") { 153 | bootAnalyze(); 154 | } else if (menuId == "boot_record") { 155 | bootRecord(); 156 | } else if (menuId == "system_monitor") { 157 | QProcess::startDetached("deepin-system-monitor"); 158 | } 159 | } 160 | 161 | void CMDUPlugin::about() 162 | { 163 | QMessageBox aboutMB(QMessageBox::NoIcon, "HTYCMDU 3.12", "[About]\n\nDeepin Linux DDE Dock netspeed plugin.\nAuthor:海天鹰\nE-mail: sonichy@163.com\nSource:https://github.com/sonichy/CMDU_DDE_DOCK"); 164 | aboutMB.setIconPixmap(QPixmap(":/icon.png")); 165 | aboutMB.exec(); 166 | } 167 | 168 | void CMDUPlugin::changelog() 169 | { 170 | QString s = "Changelog\n\n3.12 (2023-03-07)\nRemove fix net speed unit KB.\nImprove to 3 digit number.\n\n3.11 (2019-09-25)\nRight menu add [System monitor] to launch deepin-system-monitor.\n\n3.10 (2019-01-10)\n1.Change DDE-Dock API version 1.1 to 1.1.1。\n\n3.9 (2018-12-23)\n1.Use monospace font to fix width.\n\n3.8 (2018-12-14)\n1.Change DDE-Dock API 1.0 version to 1.1.\n\n3.7 (2018-10-12)\n1.Change memory vertial percent line green color to white, change above 90% red background to red line.\n2.Insert bit + monospace font, solve align.\n3.Netspeed unit fix to KB/s.\n\n3.6 (2018-07-30)\n1.Add memory vertical percent line and CPU usage percent vertical line.\n\n3.5 (2018-06-25)\n1.Add boot analyze and boot record.\n\n3.4 (2018-06-03)\n1.Support dock reorder.\n\n3.3 (2018-05-17)\n1.Turn to red background when memory percent over 90%.\n2.Netspeed <999 bytes to 0.00 KB.\n3.Use safty QString.right() replace QStringList.at(), \"ms\" replace \"毫秒\".\n\n3.2 (2018-05-08)\nCalculate all net speed line, no need to choose line.\nRemove startup float window.\n\n3.1 (2018-03-17)\nModigfy free memory algorithm.\n\n3.0 (2018-02-25)\nModify from dock plugin source code, solve right click crash and switch.\n\n2.4 (2017-11-11)\nAdd boot duration.\n\n2.3 (2017-09-05)\nAuto get current netspeed line.\n\n2.2 (2017-07-08)\n1.Set current netspeed line.\n\n2.1 (2017-02-01)\n1.Upload and download support GB, int parameter change to long, solve bytes unit convert overflow.\n\n2.0 (2016-12-07)\n1.Add right click menu.\n\n1.0 (2016-11-01)\n1.Change Qt program to DDE-DOCK."; 171 | QDialog *dialog = new QDialog; 172 | dialog->setWindowTitle("HTYCMDU"); 173 | dialog->setFixedSize(400,300); 174 | QVBoxLayout *vbox = new QVBoxLayout; 175 | QTextBrowser *textBrowser = new QTextBrowser; 176 | textBrowser->setText(s); 177 | textBrowser->zoomIn(); 178 | vbox->addWidget(textBrowser); 179 | QHBoxLayout *hbox = new QHBoxLayout; 180 | QPushButton *pushbutton_confirm = new QPushButton(tr("Confirm")); 181 | hbox->addStretch(); 182 | hbox->addWidget(pushbutton_confirm); 183 | hbox->addStretch(); 184 | vbox->addLayout(hbox); 185 | dialog->setLayout(vbox); 186 | dialog->show(); 187 | connect(pushbutton_confirm, SIGNAL(clicked()), dialog, SLOT(accept())); 188 | if (dialog->exec() == QDialog::Accepted) { 189 | dialog->close(); 190 | } 191 | } 192 | 193 | QString CMDUPlugin::KB(long k) 194 | { 195 | QString s = ""; 196 | if (k > 999999) { 197 | s = QString::number(k/(1024*1024.0),'f',2) + "GB"; 198 | } else { 199 | if (k > 999) { 200 | s = QString::number(k/1024.0,'f',2) + "MB"; 201 | } else { 202 | s = QString::number(k/1.0,'f',2) + "KB"; 203 | } 204 | } 205 | return s; 206 | } 207 | 208 | QString CMDUPlugin::BS(long b) 209 | { 210 | QString s = ""; 211 | if (b > 999999999) { 212 | float f = b / (1024*1024*1024.0); 213 | if (f >= 100) 214 | s = " " + QString::number(f, 'f', 0) + "GB"; 215 | else if (f >= 10) 216 | s = QString::number(f, 'f', 1) + "GB"; 217 | else 218 | s = QString::number(f, 'f', 2) + "GB"; 219 | } else { 220 | if (b > 999999) { 221 | float f = b / (1024*1024.0); 222 | if (f >= 100) 223 | s = " " + QString::number(f, 'f', 0) + "MB"; 224 | else if (f >= 10) 225 | s = QString::number(f, 'f', 1) + "MB"; 226 | else 227 | s = QString::number(f, 'f', 2) + "MB"; 228 | } else { 229 | if (b > 999) { 230 | float f = b / 1024.0; 231 | if (f >= 100) 232 | s = " " + QString::number(f, 'f', 0) + "KB"; 233 | else if (f >= 10) 234 | s = QString::number(f, 'f', 1) + "KB"; 235 | else 236 | s = QString::number(f, 'f', 2) + "KB"; 237 | } else { 238 | if (b > 100) 239 | s = " " + QString::number(b) + " B"; 240 | else if (b > 10) 241 | s = " " + QString::number(b) + " B"; 242 | else 243 | s = " " + QString::number(b) + " B"; 244 | } 245 | } 246 | } 247 | return s; 248 | } 249 | 250 | QString CMDUPlugin::NB(long b) 251 | { 252 | QString s = ""; 253 | if (b>999) { 254 | s = QString("%1").arg(b/1024, 5, 'f', 0, QLatin1Char(' ')) + "KB"; 255 | } else { // <1K => 0 256 | s = QString("%1").arg(0, 5, 'f', 0, QLatin1Char(' ')) + "KB"; 257 | } 258 | return s; 259 | } 260 | 261 | void CMDUPlugin::updateCMDU() 262 | { 263 | // uptime 264 | QFile file("/proc/uptime"); 265 | file.open(QIODevice::ReadOnly); 266 | QString l = file.readLine(); 267 | file.close(); 268 | QTime t(0,0,0); 269 | t = t.addSecs(l.left(l.indexOf(".")).toInt()); 270 | QString uptime = "UTM: " + t.toString("hh:mm:ss"); 271 | 272 | // memory 273 | file.setFileName("/proc/meminfo"); 274 | file.open(QIODevice::ReadOnly); 275 | l = file.readLine(); 276 | long mt = l.replace("MemTotal:","").replace("kB","").replace(" ","").toLong(); 277 | l = file.readLine(); 278 | l = file.readLine(); 279 | long ma = l.replace("MemAvailable:","").replace("kB","").replace(" ","").toLong(); 280 | l = file.readLine(); 281 | l = file.readLine(); 282 | file.close(); 283 | long mu = mt - ma; 284 | int mp = mu*100/mt; 285 | QString mem = "MEM: " + QString("%1 / %2 = %3").arg(KB(mu)).arg(KB(mt)).arg(QString::number(mp) + "%"); 286 | 287 | // CPU 288 | file.setFileName("/proc/stat"); 289 | file.open(QIODevice::ReadOnly); 290 | l = file.readLine(); 291 | QByteArray ba; 292 | ba = l.toLatin1(); 293 | const char *ch; 294 | ch = ba.constData(); 295 | char cpu[5]; 296 | long user, nice, sys, idle, iowait, irq, softirq, tt; 297 | sscanf(ch,"%s%ld%ld%ld%ld%ld%ld%ld", cpu, &user, &nice, &sys, &idle, &iowait, &irq, &softirq); 298 | tt = user + nice + sys + idle + iowait + irq + softirq; 299 | file.close(); 300 | QString cusage = ""; 301 | int cp = ((tt-tt0)-(idle-idle0))*100/(tt-tt0); 302 | if (i > 0) 303 | cusage = "CPU: " + QString::number(cp) + "%"; 304 | idle0 = idle; 305 | tt0 = tt; 306 | 307 | // net 308 | file.setFileName("/proc/net/dev"); 309 | file.open(QIODevice::ReadOnly); 310 | l = file.readLine(); 311 | l = file.readLine(); 312 | dbt1 = ubt1 = 0; 313 | while (!file.atEnd()) { 314 | l = file.readLine(); 315 | QStringList list = l.split(QRegExp("\\s{1,}")); 316 | db = list.at(1).toLong(); 317 | ub = list.at(9).toLong(); 318 | dbt1 += db; 319 | ubt1 += ub; 320 | } 321 | file.close(); 322 | QString uss = ""; 323 | QString dss = ""; 324 | if (i > 0) { 325 | long us = ubt1 - ubt0; 326 | long ds = dbt1 - dbt0; 327 | uss = BS(us) + "/s"; 328 | dss = BS(ds) + "/s"; 329 | ubt0 = ubt1; 330 | dbt0 = dbt1; 331 | } 332 | QString netspeed = "↑" + uss + "\n↓" + dss; 333 | QString net = "UPB: " + BS(ubt1) + " " + uss + "\nDNB: " + BS(dbt1) + " " + dss; 334 | 335 | i++; 336 | if (i>2) 337 | i = 2; 338 | 339 | // draw 340 | m_tipsLabel->setText(startup + "\n" + uptime + "\n" + cusage + "\n" + mem + "\n" + net); 341 | m_centralWidget->text = netspeed; 342 | m_centralWidget->mp = mp; 343 | m_centralWidget->cp = cp; 344 | m_centralWidget->update(); 345 | } 346 | 347 | void CMDUPlugin::bootRecord() 348 | { 349 | QProcess *process = new QProcess; 350 | process->start("last reboot"); 351 | process->waitForFinished(); 352 | QString PO = process->readAllStandardOutput(); 353 | QDialog *dialog = new QDialog; 354 | dialog->setWindowTitle(tr("Boot record")); 355 | dialog->setFixedSize(600,400); 356 | QVBoxLayout *vbox = new QVBoxLayout; 357 | QTextBrowser *textBrowser = new QTextBrowser; 358 | textBrowser->setText(PO); 359 | textBrowser->zoomIn(); 360 | vbox->addWidget(textBrowser); 361 | QHBoxLayout *hbox = new QHBoxLayout; 362 | QPushButton *pushButton_confirm = new QPushButton(tr("Confirm")); 363 | hbox->addStretch(); 364 | hbox->addWidget(pushButton_confirm); 365 | hbox->addStretch(); 366 | vbox->addLayout(hbox); 367 | dialog->setLayout(vbox); 368 | dialog->show(); 369 | connect(pushButton_confirm, SIGNAL(clicked()), dialog, SLOT(accept())); 370 | if (dialog->exec() == QDialog::Accepted) { 371 | dialog->close(); 372 | } 373 | } 374 | 375 | void CMDUPlugin::bootAnalyze() 376 | { 377 | QProcess *process = new QProcess; 378 | process->start("systemd-analyze blame"); 379 | process->waitForFinished(); 380 | QString PO = process->readAllStandardOutput(); 381 | QDialog *dialog = new QDialog; 382 | dialog->setWindowTitle(tr("Boot analyze")); 383 | dialog->setFixedSize(500,400); 384 | QVBoxLayout *vbox = new QVBoxLayout; 385 | QTextBrowser *textBrowser = new QTextBrowser; 386 | textBrowser->setText(PO); 387 | textBrowser->zoomIn(); 388 | vbox->addWidget(textBrowser); 389 | QHBoxLayout *hbox = new QHBoxLayout; 390 | QPushButton *pushButton_confirm = new QPushButton(tr("Confirm")); 391 | hbox->addStretch(); 392 | hbox->addWidget(pushButton_confirm); 393 | hbox->addStretch(); 394 | vbox->addLayout(hbox); 395 | dialog->setLayout(vbox); 396 | dialog->show(); 397 | connect(pushButton_confirm, SIGNAL(clicked()), dialog, SLOT(accept())); 398 | if (dialog->exec() == QDialog::Accepted) { 399 | dialog->close(); 400 | } 401 | } -------------------------------------------------------------------------------- /cmduplugin.h: -------------------------------------------------------------------------------- 1 | #ifndef CMDUPlugin_H 2 | #define CMDUPlugin_H 3 | 4 | #include "dde-dock/pluginsiteminterface.h" 5 | #include "cmduwidget.h" 6 | #include 7 | #include 8 | 9 | class CMDUPlugin : public QObject, PluginsItemInterface 10 | { 11 | Q_OBJECT 12 | Q_INTERFACES(PluginsItemInterface) 13 | Q_PLUGIN_METADATA(IID "com.deepin.dock.PluginsItemInterface" FILE "cmdu.json") 14 | 15 | public: 16 | explicit CMDUPlugin(QObject *parent = 0); 17 | 18 | const QString pluginName() const override; 19 | const QString pluginDisplayName() const override; 20 | void init(PluginProxyInterface *proxyInter) override; 21 | 22 | void pluginStateSwitched() override; 23 | bool pluginIsAllowDisable() override { return true; } 24 | bool pluginIsDisable() override; 25 | 26 | int itemSortKey(const QString &itemKey); 27 | void setSortKey(const QString &itemKey, const int order); 28 | 29 | QWidget *itemWidget(const QString &itemKey) override; 30 | QWidget *itemTipsWidget(const QString &itemKey) override; 31 | 32 | const QString itemCommand(const QString &itemKey) override; 33 | const QString itemContextMenu(const QString &itemKey) override; 34 | 35 | void invokedMenuItem(const QString &itemKey, const QString &menuId, const bool checked) override; 36 | 37 | private slots: 38 | void updateCMDU(); 39 | 40 | private: 41 | long int i, db, ub, dbt, ubt, dbt1, ubt1, dbt0, ubt0, tt0, idle0; 42 | QPointer m_centralWidget; 43 | QPointer m_tipsLabel; 44 | QTimer *m_refershTimer; 45 | QSettings m_settings; 46 | QString KB(long k); 47 | QString BS(long b); 48 | QString NB(long b); 49 | QString startup; 50 | //QLabel *labelStartupDuration; 51 | void about(); 52 | void changelog(); 53 | void bootRecord(); 54 | void bootAnalyze(); 55 | 56 | }; 57 | 58 | #endif // CMDUPlugin_H 59 | -------------------------------------------------------------------------------- /cmduwidget.cpp: -------------------------------------------------------------------------------- 1 | #include "cmduwidget.h" 2 | #include "dde-dock/constants.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #define PLUGIN_STATE_KEY "enable" 9 | 10 | CMDUWidget::CMDUWidget(QWidget *parent) 11 | : QWidget(parent), 12 | m_settings("deepin", "dde-dock-cmdu") 13 | { 14 | text = " ↑0.00KB/s \n ↓0.00KB/s "; 15 | mp = 0; 16 | cp = 0; 17 | } 18 | 19 | bool CMDUWidget::enabled() 20 | { 21 | return m_settings.value(PLUGIN_STATE_KEY, true).toBool(); 22 | } 23 | 24 | void CMDUWidget::setEnabled(const bool b) 25 | { 26 | m_settings.setValue(PLUGIN_STATE_KEY, b); 27 | } 28 | 29 | QSize CMDUWidget::sizeHint() const 30 | { 31 | QFont font = qApp->font(); 32 | font.setFamily("Noto Mono"); 33 | QFontMetrics FM(font); 34 | return FM.boundingRect(" ↑0.00KB/s ").size() + QSize(0, FM.boundingRect(" ↓0.00KB/s ").height()); 35 | } 36 | 37 | void CMDUWidget::resizeEvent(QResizeEvent *e) 38 | { 39 | QWidget::resizeEvent(e); 40 | } 41 | 42 | void CMDUWidget::paintEvent(QPaintEvent *e) 43 | { 44 | Q_UNUSED(e); 45 | QPainter painter(this); 46 | painter.setRenderHint(QPainter::Antialiasing); 47 | painter.setPen(Qt::white); 48 | QFont font = qApp->font(); 49 | font.setFamily("Noto Mono"); 50 | painter.setFont(font); 51 | painter.drawText(rect().adjusted(2,0,0,0), Qt::AlignLeft | Qt::AlignVCenter, text); 52 | if (mp < 90) { 53 | painter.fillRect(0, height()*(100-mp)/100, 2, height()*mp/100, Qt::white); 54 | } else { 55 | painter.fillRect(0, height()*(100-mp)/100, 2, height()*mp/100, Qt::red); 56 | } 57 | if (cp < 90) { 58 | painter.fillRect(width()-2, height()*(100-cp)/100, 2, height()*cp/100, Qt::white); 59 | } else { 60 | painter.fillRect(width()-2, height()*(100-cp)/100, 2, height()*cp/100, Qt::red); 61 | } 62 | } -------------------------------------------------------------------------------- /cmduwidget.h: -------------------------------------------------------------------------------- 1 | #ifndef CMDUWIDGET_H 2 | #define CMDUWIDGET_H 3 | 4 | #include 5 | #include 6 | 7 | class CMDUWidget : public QWidget 8 | { 9 | Q_OBJECT 10 | 11 | public: 12 | explicit CMDUWidget(QWidget *parent = 0); 13 | bool enabled(); 14 | void setEnabled(const bool b); 15 | QString text; 16 | int mp, cp; 17 | 18 | signals: 19 | void requestUpdateGeometry() const; 20 | 21 | private: 22 | QSize sizeHint() const; 23 | void resizeEvent(QResizeEvent *e); 24 | void paintEvent(QPaintEvent *e); 25 | QPixmap m_cachedIcon; 26 | QString m_cachedTime; 27 | QSettings m_settings; 28 | bool m_24HourFormat; 29 | 30 | }; 31 | 32 | #endif // CMDUWIDGET_H -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonichy/dde-dock-cmud/33c7d30576ba6c0f90e0092a4ba4adc98ce6543d/icon.png -------------------------------------------------------------------------------- /preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonichy/dde-dock-cmud/33c7d30576ba6c0f90e0092a4ba4adc98ce6543d/preview.png -------------------------------------------------------------------------------- /preview90.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonichy/dde-dock-cmud/33c7d30576ba6c0f90e0092a4ba4adc98ce6543d/preview90.png -------------------------------------------------------------------------------- /res.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | icon.png 4 | 5 | 6 | --------------------------------------------------------------------------------