diff --git a/fix-the-bug-about-process-filesystem.patch b/fix-the-bug-about-process-filesystem.patch new file mode 100644 index 0000000..df17b9b --- /dev/null +++ b/fix-the-bug-about-process-filesystem.patch @@ -0,0 +1,2538 @@ +diff -Naur ukui-system-monitor-1.0.1/debian/changelog ukui-system-monitor-1.0.1~/debian/changelog +--- ukui-system-monitor-1.0.1/debian/changelog 2021-12-08 22:01:33.505280350 +0800 ++++ ukui-system-monitor-1.0.1~/debian/changelog 2021-12-08 22:53:56.646804171 +0800 +@@ -1,29 +1,16 @@ +-ukui-system-monitor (2.0.2-10) v101; urgency=medium +- +- * 优化功能:1、进程列表信息增加锁保护;2、进程列表的icon对象放到ui线程中处理 +- * 修复bug:修复关于界面邮箱链接不可点击问题 +- +- -- Yang Min Sat, 06 Mar 2021 16:48:06 +0800 +- +-ukui-system-monitor (2.0.2-9) v101; urgency=medium +- +- * 优化功能:优化进程列表显示 +- * 修复bug:1、修复搜索输入框偶现不显示内容问题;2、修复触摸屏无法触摸点击问题 +- +- -- Yang Min Tue, 02 Mar 2021 16:57:00 +0800 + ukui-system-monitor (1.0.2-1) unstable; urgency=medium + + * New upstream release. + * d/control: Remove useless depends to allow migration. + +- -- handsome_feng Thu, 26 Nov 2020 10:12:45 +- ++ -- handsome_feng Thu, 26 Nov 2020 10:12:45 +0800 + +-ukui-system-monitor (1.0.0-1+1027) focal; urgency=medium ++ukui-system-monitor (1.0.0-2) unstable; urgency=medium + +- * Daily build. ++ * Team upload. ++ * No change rebuild to allow migration + +- -- liuliang Mon, 27 May 2019 15:48:18 +0800 ++ -- Aron Xu Tue, 29 Sep 2020 14:42:29 +0800 + + ukui-system-monitor (1.0.0-1) unstable; urgency=medium + +diff -Naur ukui-system-monitor-1.0.1/README.md ukui-system-monitor-1.0.1~/README.md +--- ukui-system-monitor-1.0.1/README.md 2021-12-08 22:01:33.502030300 +0800 ++++ ukui-system-monitor-1.0.1~/README.md 2021-12-08 22:53:56.624053825 +0800 +@@ -4,8 +4,8 @@ + (such as CPU and memory) and File Systems on your system. + + ## Build +-mkdir build +-qmake .. ++./autogen.sh ++make + sudo make install + + ## Bug report +diff -Naur ukui-system-monitor-1.0.1/shell/macro.h ukui-system-monitor-1.0.1~/shell/macro.h +--- ukui-system-monitor-1.0.1/shell/macro.h 2019-05-27 15:48:18.000000000 +0800 ++++ ukui-system-monitor-1.0.1~/shell/macro.h 2021-12-08 22:53:56.672804568 +0800 +@@ -46,6 +46,7 @@ + #define MAINWINDOWHEIGHT 590 + #define MAINWINDOWWIDTH 760 + #define SEARCHBUTTON 16 ++#define DEFAULT_FONT_SIZE 14 + + #define SERVICE_NAME_SIZE 64 + #define UKUI_SYSTEM_MONITOR_PATH "/" +diff -Naur ukui-system-monitor-1.0.1/src/cpuballwidget.cpp ukui-system-monitor-1.0.1~/src/cpuballwidget.cpp +--- ukui-system-monitor-1.0.1/src/cpuballwidget.cpp 2019-05-27 15:48:18.000000000 +0800 ++++ ukui-system-monitor-1.0.1~/src/cpuballwidget.cpp 2021-12-08 22:53:56.843973846 +0800 +@@ -54,11 +54,9 @@ + m_prevPercentValue = 0.0; + m_percentValue = 0.0; + m_progressText = QString("%1%").arg(QString::number(m_percentValue, 'f', 1)); //把小数转化为字符串,1是小数点后几位,此为小数点后1位 +- qDebug()<<"m_progressText----------------"<setOffset(0, 0); +-// m_shadowEffect->setColor(QColor(232, 232, 232, 127)); + m_shadowEffect->setColor(QColor("transparent")); + m_shadowEffect->setBlurRadius(10); + this->setGraphicsEffect(m_shadowEffect); +diff -Naur ukui-system-monitor-1.0.1/src/cpuratewidget.cpp ukui-system-monitor-1.0.1~/src/cpuratewidget.cpp +--- ukui-system-monitor-1.0.1/src/cpuratewidget.cpp 2021-12-08 22:01:33.494446850 +0800 ++++ ukui-system-monitor-1.0.1~/src/cpuratewidget.cpp 2021-12-08 22:53:56.923058385 +0800 +@@ -75,12 +75,13 @@ + while (!file.atEnd()) { + if (content.contains("processor")) + cpuCounts ++; +- qDebug()<<"cpuCounts"<width()<<"qqqqqqqqqqqqqqqqqqqqq"<height(); + // w->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + m_labelLayout = new QVBoxLayout(w); + m_labelLayout->setContentsMargins(0, 0, 0, 0); +@@ -342,13 +338,11 @@ + m_title->setStyleSheet("background:transparent;font-size:24px;color:palette(windowText)"); //#000000 + + m_cpuRateTitle = new QLabel; +-// m_cpuRateTitle->setStyleSheet("QLabel{background:transparent;font-size:12px;color:palette(windowText);}"); //#999999 + m_cpuRateTitle->setText(tr("Occupancy rate")); + m_cpuRateText = new QLabel; + m_cpuRateText->setStyleSheet("QLabel{background:transparent;font-size:20px;color:palette(windowTexg);}"); //#000000 + + m_cpuIdleRateTitle = new QLabel; +-// m_cpuIdleRateTitle->setStyleSheet("QLabel{background:transparent;font-size:12px;color:palette(windowTexg);}"); + m_cpuIdleRateTitle->setText(tr("Idle rate")); + m_cpuIdleRateText = new QLabel; + m_cpuIdleRateText->setStyleSheet("QLabel{background:transparent;font-size:20px;color:palette(windowTexg);}"); +@@ -357,13 +351,11 @@ + m_cpuIdleRateTitle->hide(); + + m_cpuRunTimeTitle = new QLabel; +-// m_cpuRunTimeTitle->setStyleSheet("QLabel{background:transparent;font-size:12px;color:palette(windowTexg);}"); + m_cpuRunTimeTitle->setText(tr("The running time of system")); + m_cpuRunTimeText = new QLabel; + m_cpuRunTimeText->setStyleSheet("QLabel{background:transparent;font-size:20px;color:palette(windowTexg);}"); + + m_cpuIdleTimeTitle = new QLabel; +-// m_cpuIdleTimeTitle->setStyleSheet("QLabel{background:transparent;font-size:12px;color:palette(windowTexg);}"); + m_cpuIdleTimeTitle->setText(tr("The idle time of system")); + m_cpuIdleTimeText = new QLabel; + m_cpuIdleTimeText->setStyleSheet("QLabel{background:transparent;font-size:20px;color:palette(windowTexg);}"); +@@ -393,8 +385,6 @@ + cpuIdleTimeLayout->addWidget(m_cpuIdleTimeTitle); + cpuIdleTimeLayout->addWidget(m_cpuIdleTimeText); + +- +- + m_labelLayout->setContentsMargins(0, 0, 0, 0); + m_labelLayout->setSpacing(50); + m_labelLayout->addWidget(m_title); +@@ -415,11 +405,8 @@ + unsigned long idletime; + QString rate = getIdelRate(runtime, idletime); + m_cpuIdleRateText->setText(rate); +-// qDebug()<<"rate-----------"<setText(convertTimeToString(runtime)); +-// qDebug()<<"runtime----------"<setText(convertTimeToString(idletime)); +-// qDebug()<<"idletime---------"< + + FileSystemListItem::FileSystemListItem(FileSystemData *info) ++ :fontSettings(nullptr) + { + m_data = info; + iconSize = 20; +@@ -46,7 +47,6 @@ + + if(QGSettings::isSchemaInstalled(id)) + { +- qDebug()<<"installl fontSettings----->"<get(key).toString(); +-// qApp->setStyle(new InternalStyle(style)); + currentThemeMode = qtSettings->get(MODE_QT_KEY).toString(); +- qDebug()<<"监听主题改变-------------------->"<setStyle(new InternalStyle(currentThemeMode)); +- //repaint(); ++ qDebug() <<" Current theme mode change to: "<get(MODE_QT_KEY).toString(); +@@ -87,24 +86,19 @@ + + void FileSystemListItem::initFontSize() + { +- connect(fontSettings,&QGSettings::changed,this,[=](QString key) ++ if (!fontSettings) { ++ fontSize = DEFAULT_FONT_SIZE; ++ return; ++ } ++ ++ connect(fontSettings, &QGSettings::changed, this, [=](QString key) + { + if("systemFont" == key || "systemFontSize" == key) + { +- qDebug()<<"i have come in 111"; +- +- fontSize = fontSettings->get(FONT_SIZE).toInt(); +-// repaint(); +-// for(auto widget:qApp->allWidgets()) +-// { +-// widget->repaint(); +-// widget->setFont(fSize); +-// } +- qDebug()<get(FONT_SIZE).toString().toFloat(); + } +- qDebug()<<"i have come in 222"; + }); +- fontSize = fontSettings->get(FONT_SIZE).toInt(); ++ fontSize = fontSettings->get(FONT_SIZE).toString().toFloat(); + } + + bool FileSystemListItem::isSameItem(FileSystemListItem *item) +@@ -151,7 +145,7 @@ + QFont font = painter->font(); + QFontMetrics fm(font); + QString deviceName = fm.elidedText(m_data->deviceName(), Qt::ElideRight, nameMaxWidth);//Qt::ElideMiddle +- painter->drawText(QRect(rect.x() + iconSize + padding * 2, rect.y(), nameMaxWidth, rect.height()), Qt::AlignLeft | Qt::AlignVCenter, deviceName); ++ painter->drawText(QRect(rect.x() + iconSize + padding * 2, rect.y(), nameMaxWidth, rect.height()), Qt::AlignCenter, deviceName); + if (!isSeparator) { + painter->setOpacity(0.8); + QPainterPath separatorPath; +@@ -165,7 +159,7 @@ + QFont font = painter->font(); + QFontMetrics fm(font); + QString mountDir = fm.elidedText(m_data->mountDir(), Qt::ElideMiddle, maxWidth); +- painter->drawText(QRect(rect.x(), rect.y(), rect.width() - textPadding, rect.height()), Qt::AlignLeft | Qt::AlignVCenter, mountDir); ++ painter->drawText(QRect(rect.x(), rect.y(), rect.width() - textPadding, rect.height()), Qt::AlignCenter, mountDir); + } + if (!isSeparator) { + painter->setOpacity(0.8); +@@ -180,7 +174,7 @@ + QFont font = painter->font(); + QFontMetrics fm(font); + QString diskType = fm.elidedText(m_data->diskType(), Qt::ElideRight, maxWidth); +- painter->drawText(QRect(rect.x(), rect.y(), rect.width() - textPadding, rect.height()), Qt::AlignRight | Qt::AlignVCenter, diskType); ++ painter->drawText(QRect(rect.x(), rect.y(), rect.width() - textPadding, rect.height()), Qt::AlignCenter, diskType); + } + if (!isSeparator) { + painter->setOpacity(0.8); +@@ -195,7 +189,7 @@ + QFont font = painter->font(); + QFontMetrics fm(font); + QString tCapacity = fm.elidedText(m_data->totalCapacity(), Qt::ElideRight, maxWidth); +- painter->drawText(QRect(rect.x(), rect.y(), rect.width() - textPadding, rect.height()), Qt::AlignRight | Qt::AlignVCenter, tCapacity); ++ painter->drawText(QRect(rect.x(), rect.y(), rect.width() - textPadding, rect.height()), Qt::AlignCenter, tCapacity); + } + if (!isSeparator) { + painter->setOpacity(0.8); +@@ -210,7 +204,7 @@ + QFont font = painter->font(); + QFontMetrics fm(font); + QString fCapacity = fm.elidedText(m_data->freeCapacity(), Qt::ElideRight, maxWidth); +- painter->drawText(QRect(rect.x(), rect.y(), rect.width() - textPadding, rect.height()), Qt::AlignRight | Qt::AlignVCenter, fCapacity); ++ painter->drawText(QRect(rect.x(), rect.y(), rect.width() - textPadding, rect.height()), Qt::AlignCenter, fCapacity); + } + if (!isSeparator) { + painter->setOpacity(0.8); +@@ -225,7 +219,7 @@ + QFont font = painter->font(); + QFontMetrics fm(font); + QString aCapacity = fm.elidedText(m_data->availCapacity(), Qt::ElideRight, maxWidth); +- painter->drawText(QRect(rect.x(), rect.y(), rect.width() - textPadding, rect.height()), Qt::AlignRight | Qt::AlignVCenter, aCapacity); ++ painter->drawText(QRect(rect.x(), rect.y(), rect.width() - textPadding, rect.height()), Qt::AlignCenter, aCapacity); + } + if (!isSeparator) { + painter->setOpacity(0.8); +@@ -235,6 +229,7 @@ + } + } + else if (column == 6) { ++ int maxWidth = rect.width(); + int leftPadding = 10; + int topPadding = 5; + int progressWidth = 100; +@@ -243,22 +238,27 @@ + if (!m_data->usedCapactiy().isEmpty()) { + QFont font = painter->font(); + QFontMetrics fm(font); +- QString uCapacity = fm.elidedText(m_data->usedCapactiy(), Qt::ElideRight, textMaxWidth - textPadding); +- painter->drawText(QRect(rect.x() + textPadding, rect.y(), textMaxWidth - textPadding, rect.height()), Qt::AlignLeft | Qt::AlignVCenter, uCapacity); +- } +- QPainterPath bgPath; +- bgPath.addRect(QRectF(rect.x() + textMaxWidth + leftPadding, rect.y() + topPadding, progressWidth, progressHeight)); +- painter->fillPath(bgPath, QColor("#C4BDBD")); +-// painter->fillPath(bgPath,QColor("palette(Base)")); ++ QString uCapacity = fm.elidedText(m_data->usedCapactiy(), Qt::ElideRight, maxWidth); ++// painter->drawText(QRect(rect.x() + textPadding, rect.y(), textMaxWidth - textPadding, rect.height()), Qt::AlignCenter, uCapacity); ++ painter->drawText(QRect(rect.x() , rect.y(), rect.width(), rect.height()), Qt::AlignCenter, uCapacity); ++ } ++//这部分代码为原来绘制未占用区域的灰色部分。////////////// ++// QPainterPath bgPath; ++//// bgPath.addRect(QRectF(rect.x() + textMaxWidth + leftPadding, rect.y() + topPadding, progressWidth, progressHeight)); ++// bgPath.addRect(QRectF(rect.x() + textMaxWidth + leftPadding, rect.y() + topPadding, progressWidth, 2)); ++// painter->fillPath(bgPath, QColor("#C4BDBD")); ++//// painter->fillPath(bgPath,QColor("palette(Base)")); ++///////////////////////////////////////////////// + QPainterPath fillPath; +- fillPath.addRect(QRectF(rect.x() + textMaxWidth + leftPadding, rect.y() + topPadding, m_data->usedPercentage(), progressHeight)); ++// fillPath.addRect(QRectF(rect.x() + textMaxWidth + leftPadding, rect.y() + topPadding, m_data->usedPercentage(), progressHeight)); ++ fillPath.addRect(QRectF(rect.x() + rect.width() - m_data->usedPercentage(), rect.y() + rect.height() -2, m_data->usedPercentage(), 2)); + painter->setOpacity(0.5); + if (m_data->usedPercentage() < 75) + painter->fillPath(fillPath, QColor("#0288d1")); + else + painter->fillPath(fillPath, QColor("#f8b551")); +- painter->setOpacity(1); +- painter->drawText(QRect(rect.x() + textMaxWidth + leftPadding, rect.y() + topPadding, progressWidth, progressHeight), Qt::AlignHCenter | Qt::AlignVCenter, QString::number(m_data->usedPercentage()).append("%")); ++// painter->setOpacity(1); ++// painter->drawText(QRect(rect.x() + textMaxWidth + leftPadding, rect.y() + topPadding, progressWidth, progressHeight), Qt::AlignCenter, nullptr); + + /* + QStyleOptionProgressBar progressBarStyle;//progressBarStyle.initFrom(this); +diff -Naur ukui-system-monitor-1.0.1/src/filesystemlistwidget.cpp ukui-system-monitor-1.0.1~/src/filesystemlistwidget.cpp +--- ukui-system-monitor-1.0.1/src/filesystemlistwidget.cpp 2019-05-27 15:48:18.000000000 +0800 ++++ ukui-system-monitor-1.0.1~/src/filesystemlistwidget.cpp 2021-12-08 22:53:56.895974639 +0800 +@@ -43,6 +43,7 @@ + ,m_titlePressColumn(-1) + ,m_mouseAtScrollArea(false) + ,m_mouseDragScrollbar(false) ++ ,fontSettings(nullptr) + { + const QByteArray idd(THEME_QT_SCHEMA); + +@@ -66,7 +67,7 @@ + + this->columnTitles << tr("Device") << tr("Directory") << tr("Type") << tr("Total") << tr("Free") << tr("Available") << tr("Used"); + QList widths; +- widths << 150 << -1 << 80 << 80 << 80 << 80 << 180;//-1时让该行填充所有剩余空间 ++ widths << 150 << -1 << 80 << 80 << 80 << 80 << 120;//-1时让该行填充所有剩余空间 + + QFont font; + font.setPixelSize(12);//需要和填充所有剩余空间的那个的文字字体大小一致 font.setPointSize(9) +@@ -142,14 +143,18 @@ + + void FileSystemListWidget::initFontSize() + { ++ if (!fontSettings) { ++ fontSize = DEFAULT_FONT_SIZE; ++ return; ++ } + connect(fontSettings,&QGSettings::changed,[=](QString key) + { + if("systemFont" == key || "systemFontSize" == key) + { +- fontSize = fontSettings->get(FONT_SIZE).toInt(); ++ fontSize = fontSettings->get(FONT_SIZE).toString().toFloat(); + } + }); +- fontSize = fontSettings->get(FONT_SIZE).toInt(); ++ fontSize = fontSettings->get(FONT_SIZE).toString().toFloat(); + } + + void FileSystemListWidget::addSelectedItems(QList items, bool recordLastItem) +diff -Naur ukui-system-monitor-1.0.1/src/filesystemlistwidget.h ukui-system-monitor-1.0.1~/src/filesystemlistwidget.h +--- ukui-system-monitor-1.0.1/src/filesystemlistwidget.h 2019-05-27 15:48:18.000000000 +0800 ++++ ukui-system-monitor-1.0.1~/src/filesystemlistwidget.h 2021-12-08 22:53:56.934975234 +0800 +@@ -99,7 +99,7 @@ + int m_titlePadding; + int m_titlePressColumn; + +- int fontSize; ++ float fontSize; + + QGSettings * qtSettings; + QGSettings *fontSettings; +diff -Naur ukui-system-monitor-1.0.1/src/filesystemworker.cpp ukui-system-monitor-1.0.1~/src/filesystemworker.cpp +--- ukui-system-monitor-1.0.1/src/filesystemworker.cpp 2019-05-27 15:48:18.000000000 +0800 ++++ ukui-system-monitor-1.0.1~/src/filesystemworker.cpp 2021-12-08 22:53:56.866724192 +0800 +@@ -75,18 +75,13 @@ + guint64 bused, bfree, bavail, btotal; + gint percentage; + glibtop_get_fsusage(&usage, entry->mountdir); +- qDebug()<mountdir<<"1111111111111111111mountdir"; +- qDebug()<<"usage.blocks----"<devname,"none")==0 || strcmp(entry->devname,"tmpfs")==0){ +- qDebug()<<"333333"; + return disk; + } + if(strstr(entry->type, "tmpfs")) { +- qDebug()<<"444444"; + return disk; + } + fsusage_stats(&usage, &bused, &bfree, &bavail, &btotal, &percentage); +@@ -147,18 +142,15 @@ + guint i; + gboolean show_all_fs = TRUE; + entries = glibtop_get_mountlist(&mountlist, show_all_fs); +- qDebug()<<"number---"<isDeviceContains(dev_name)) { +- qDebug()<<"if iiiiiiiiii"; + FileSystemData *info = new FileSystemData(this); + info->setDevName(dev_name); + +@@ -180,9 +172,7 @@ + g_free(freeSize); + g_free(availSize); + g_free(usedSize); +- } +- else {//update info which had exists +- qDebug()<<"elseelseelseelse"; ++ } else {//update info which had exists + FileSystemData *info = this->getDiskInfo(dev_name); + if (info) { + char *totalSize = g_format_size_full(disk.btotal, G_FORMAT_SIZE_DEFAULT); +diff -Naur ukui-system-monitor-1.0.1/src/linebandwith.cpp ukui-system-monitor-1.0.1~/src/linebandwith.cpp +--- ukui-system-monitor-1.0.1/src/linebandwith.cpp 2021-12-08 22:01:33.495530200 +0800 ++++ ukui-system-monitor-1.0.1~/src/linebandwith.cpp 2021-12-08 22:53:57.005392975 +0800 +@@ -36,14 +36,10 @@ + + QString lineBandwith::new_count(qint64 count ,int pid) + { +-// quint64 bandwith = count-count_prev; + qint64 bandwith = count - countMap[pid]; +- qDebug()<<"count---yayaya" < + #include + #include ++#include + + #include "framelessExtended/framelesshandle.h" + #include "systemmonitor.h" +@@ -33,23 +34,25 @@ + + int main(int argc, char *argv[]) + { +- Display *disp = XOpenDisplay(NULL); +- Screen *scrn = DefaultScreenOfDisplay(disp); +- if (NULL == scrn) { +- return 0; +- } +- int width = scrn->width; +- +- if (width > 2560) { +- #if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) +- QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); +- QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); +- #endif +- } +- if (NULL != disp) { +- XCloseDisplay(disp); +- } ++// Display *disp = XOpenDisplay(NULL); ++// Screen *scrn = DefaultScreenOfDisplay(disp); ++// if (NULL == scrn) { ++// return 0; ++// } ++// int width = scrn->width; ++ ++// if (width > 2560) { ++// #if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) ++// QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); ++// QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); ++// #endif ++// } ++// if (NULL != disp) { ++// XCloseDisplay(disp); ++// } + ++ QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); ++ QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); + + QString id = QString("ukui-system-monitor"+QLatin1String(getenv("DISPLAY"))); + QtSingleApplication app(id,argc,argv); +@@ -77,6 +80,7 @@ + SystemMonitor *monitor=new SystemMonitor(); + // monitor->setAttribute(Qt::WA_TranslucentBackground); + // monitor->setProperty("useSystemStyleBlur",true); ++ KWindowEffects::enableBlurBehind(monitor->winId(),true); + + monitor->setAttribute(Qt::WA_DeleteOnClose); + +diff -Naur ukui-system-monitor-1.0.1/src/memorywidget.cpp ukui-system-monitor-1.0.1~/src/memorywidget.cpp +--- ukui-system-monitor-1.0.1/src/memorywidget.cpp 2019-05-27 15:48:18.000000000 +0800 ++++ ukui-system-monitor-1.0.1~/src/memorywidget.cpp 2021-12-08 22:53:56.955558881 +0800 +@@ -31,7 +31,6 @@ + mainLayout->setContentsMargins(0, 0, 0, 0); + + QWidget *w = new QWidget; +- qDebug()<<"wodew"<width()<height(); + m_widgetLayout = new QVBoxLayout(w); + m_widgetLayout->setContentsMargins(0, 0, 0, 0); + m_widgetLayout->setSpacing(0); +diff -Naur ukui-system-monitor-1.0.1/src/monitortitlewidget.cpp ukui-system-monitor-1.0.1~/src/monitortitlewidget.cpp +--- ukui-system-monitor-1.0.1/src/monitortitlewidget.cpp 2019-05-27 15:48:18.000000000 +0800 ++++ ukui-system-monitor-1.0.1~/src/monitortitlewidget.cpp 2021-12-08 22:53:56.964225680 +0800 +@@ -42,6 +42,7 @@ + MonitorTitleWidget::MonitorTitleWidget(QSettings *settings, QWidget *parent) + :QFrame(parent) + ,proSettings(settings) ++ ,fontSettings(nullptr) + { + whichBox = new QList(); + const QByteArray idd(THEME_QT_SCHEMA); +@@ -72,13 +73,6 @@ + m_changeBox->addItem(tr("My Processes")); + m_changeBox->addItem(tr("All Process")); + m_changeBox->setFocusPolicy(Qt::NoFocus); +- qDebug()<itemText(0)<<"m_changeBox->itemText"; +- //m_changeBox->setCurrentIndex(0); +-// QStandardItemModel *pItemModel = qobject_cast(m_changeBox->model()); +-// pItemModel->item(0)->setForeground(QColor(255, 0, 0)); +- //m_changeBox->setFont(); +- +- + m_changeBox->setView(new QListView()); + + QFont changeBoxFont; +@@ -118,18 +112,8 @@ + m_searchTimer->setSingleShot(true); + connect(m_searchTimer, SIGNAL(timeout()), this, SLOT(onRefreshSearchResult())); + +-// this->setStyleSheet("QWidget{" +-// "background:rgba(19,19,20,1);" +-// "border-top-left-radius:6px;" +-// "border-top-right-radius:6px;" +-// "}"); +- +- +- +- + initWidgets(); + this->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); +- + } + + void MonitorTitleWidget::initThemeMode() +@@ -137,25 +121,15 @@ + //监听主题改变 + connect(qtSettings, &QGSettings::changed, this, [=](const QString &key) + { +- + if (key == "styleName") + { +- qDebug()<<"yes this is in"; +-// auto style = qtSettings->get(key).toString(); +-// qApp->setStyle(new InternalStyle(style)); + currentThemeMode = qtSettings->get(MODE_QT_KEY).toString(); +- qDebug()<<"监听主题改变-------------------->"<setStyle(new InternalStyle(currentThemeMode)); +- //repaint(); + if (currentThemeMode == "ukui-light" || currentThemeMode == "ukui-default" || currentThemeMode == "ukui-white") + { +- qDebug()<<"the theme is white"; ++ qDebug() << "The theme change to white"; + m_changeBox->setStyleSheet("QComboBox{background:rgba(13,14,14,0.08);border-radius:6px;color:rgba(0,0,0,0.57)}" + "QComboBox::drop-down{border:0px;width:30px;}" + "QComboBox::down-arrow{image:url(:/img/down_arrow.png);}" +- "QComboBox QAbstractItemView {margin:0px 0px 0px 0px;padding: 0px 0px;border-radius:0px;background-color:palette(windowText);outline:0px;}" +- "QComboBox QAbstractItemView::item{border-radius:0px;color:rgba(0,0,0,0.57);height: 32px;background-color:palette(base);outline:0px;}" +- "QComboBox QAbstractItemView::item:hover{border-radius:0px;color(palette(windowText));background-color:#3D6BE5;outline:0px;}" + ); + this->setObjectName("MonitorTitle"); + this->setStyleSheet("QFrame#MonitorTitle{background:rgba(255,255,255,0);border-top-left-radius:6px;border-top-right-radius:6px;color: palette(windowText);}"); +@@ -164,31 +138,24 @@ + + if (currentThemeMode == "ukui-dark" || currentThemeMode == "ukui-black") + { +- qDebug()<<"the theme is black"; ++ qDebug() << "The theme change to black"; + m_changeBox->setStyleSheet("QComboBox{background:rgba(255,255,255,0.08);border-radius:6px;color:rgba(255,255,255,0.57)}" + "QComboBox::drop-down{border:0px;width:30px;}" + "QComboBox::down-arrow{image:url(:/img/down_arrow.png);}" +- "QComboBox QAbstractItemView {margin:0px 0px 0px 0px;padding: 0px 0px;border-radius:0px;background-color:palette(windowText);outline:0px;}" +- "QComboBox QAbstractItemView::item{border-radius:0px;font-size:13px;color:rgba(255,255,255,0.57);height: 32px;background-color:palette(base);outline:0px;}" +- "QComboBox QAbstractItemView::item:hover{border-radius:0px;font-size:13px;color(palette(windowText));background-color:#3D6BE5;outline:0px;}" + ); + this->setObjectName("MonitorTitle"); + this->setStyleSheet("QFrame#MonitorTitle{background:rgba(13,14,14,0);border-top-left-radius:6px;border-top-right-radius:6px;color: palette(windowText);}"); +- qDebug()<<"if monitorTiltWidgetEffect"; + } + + } + }); +- qDebug()<<"come in Monitor opacity"; ++ + currentThemeMode = qtSettings->get(MODE_QT_KEY).toString(); + if (currentThemeMode == "ukui-light" || currentThemeMode == "ukui-default" || currentThemeMode == "ukui-white") + { + m_changeBox->setStyleSheet("QComboBox{background:rgba(13,14,14,0.08);border-radius:6px;color:rgba(0,0,0,0.57)}" + "QComboBox::drop-down{border:0px;width:30px;}" + "QComboBox::down-arrow{image:url(:/img/down_arrow.png);}" +- "QComboBox QAbstractItemView {margin:0px 0px 0px 0px;padding: 0px 0px;border-radius:0px;background-color:palette(windowText);outline:0px;}" +- "QComboBox QAbstractItemView::item{border-radius:0px;font-size:13px;color:rgba(0,0,0,0.57);height: 32px;background-color:palette(base);outline:0px;}" +- "QComboBox QAbstractItemView::item:hover{border-radius:0px;font-size:13px;color(palette(windowText));background-color:#3D6BE5;outline:0px;}" + ); + this->setObjectName("MonitorTitle"); + this->setStyleSheet("QFrame#MonitorTitle{background:rgba(255,255,255,0);border-top-left-radius:6px;border-top-right-radius:6px;color: palette(windowText);}"); +@@ -199,9 +166,6 @@ + m_changeBox->setStyleSheet("QComboBox{background:rgba(255,255,255,0.08);border-radius:6px;color:rgba(255,255,255,0.57)}" + "QComboBox::drop-down{border:0px;width:30px;}" + "QComboBox::down-arrow{image:url(:/img/down_arrow.png);}" +- "QComboBox QAbstractItemView {margin:0px 0px 0px 0px;padding: 0px 0px;border-radius:0px;background-color:palette(windowText);outline:0px;}" +- "QComboBox QAbstractItemView::item{border-radius:0px;font-size:13px;color:rgba(255,255,255,0.57);height: 32px;background-color:palette(base);outline:0px;}" +- "QComboBox QAbstractItemView::item:hover{border-radius:0px;font-size:13px;color(palette(windowText));background-color:#3D6BE5;outline:0px;}" + ); + this->setObjectName("MonitorTitle"); + this->setStyleSheet("QFrame#MonitorTitle{background:rgba(13,14,14,0);border-top-left-radius:6px;border-top-right-radius:6px;color: palette(windowText);}"); +@@ -211,11 +175,15 @@ + + void MonitorTitleWidget::initFontSize() + { ++ if (!fontSettings) { ++ fontSize = DEFAULT_FONT_SIZE; ++ return; ++ } + connect(fontSettings,&QGSettings::changed,[=](QString key) + { + if("systemFont" == key || "systemFontSize" == key) + { +- fontSize = fontSettings->get(FONT_SIZE).toInt(); ++ fontSize = fontSettings->get(FONT_SIZE).toString().toFloat(); + } + QFont font; + font.setPointSize(fontSize-2); +@@ -225,7 +193,7 @@ + changeBoxFont.setPointSize(fontSize-2); + m_changeBox->setFont(changeBoxFont); + }); +- fontSize = fontSettings->get(FONT_SIZE).toInt(); ++ fontSize = fontSettings->get(FONT_SIZE).toString().toFloat(); + } + + MonitorTitleWidget::~MonitorTitleWidget() +@@ -413,40 +381,39 @@ + { + QWidget *w = new QWidget; + m_titleMiddleLayout = new QHBoxLayout(w); +- m_titleMiddleLayout->setContentsMargins(0, 18, 0, 0); ++ m_titleMiddleLayout->setContentsMargins(0, 0, 0, 0); + + titleLabel = new QLabel; + QLabel *picLabel = new QLabel; + QFont font; + font.setPointSize(fontSize-2); + titleLabel->setFont(font); +- titleLabel->setStyleSheet("QLabel{background-color:transparent;color:palette(windowText);}"); ++// titleLabel->setStyleSheet("QLabel{background-color:transparent;color:palette(windowText);}"); + titleLabel->setText(tr("Kylin System Monitor")); + picLabel->setPixmap(QPixmap(":img/ukui-system-monitor.png")); + m_titleMiddleLayout->addWidget(picLabel); + m_titleMiddleLayout->addWidget(titleLabel); + m_topLayout->addWidget(w); ++// m_topLayout->setContentsMargins(0,0,0,20); + } + + void MonitorTitleWidget::initTitlebarRightContent() + { + QWidget *w = new QWidget; + m_titleRightLayout = new QHBoxLayout(w); +- m_titleRightLayout->setContentsMargins(0, 0, 1, 0); ++ m_titleRightLayout->setContentsMargins(0, 8, 8, 0); + m_titleRightLayout->setSpacing(0); + + m_topLayout->addWidget(w, 1, Qt::AlignRight); + + // MyTristateButton *minBtn = new MyTristateButton; +- QIcon iconMin(tr(":/img/minimize.png")); + QPushButton *minBtn = new QPushButton(this); + minBtn->setToolTip(tr("minimize")); +- //minBtn->setStyleSheet("QPushButton{background-color:transparent;}"); +- minBtn->setIcon(iconMin); +- minBtn->setIconSize(QSize(25,25)); +- //minBtn->setObjectName("MinButton"); +- minBtn->setProperty("useIconHighlightEffect", true); +- minBtn->setProperty("iconHighlightEffectMode", 1); ++ minBtn->setIcon(QIcon::fromTheme("window-minimize-symbolic")); ++// minBtn->setProperty("useIconHighlightEffect", true); ++// minBtn->setProperty("iconHighlightEffectMode", 1); ++ minBtn->setProperty("isWindowButton", 0x1); ++ minBtn->setProperty("useIconHighlightEffect", 0x2); + minBtn->setFlat(true); + connect(minBtn, SIGNAL(clicked()), this, SLOT(onMinBtnClicked())); + // connect(minBtn, &MyTristateButton::clicked, this, [=] { +@@ -461,12 +428,14 @@ + // maxBtn->setStyleSheet("QPushButton{background-color:#ffffff;}"); + // maxBtn->setObjectName("MaxButton"); + +- maxTitleBtn->setIconSize(QSize(25,25)); +- maxTitleBtn->setProperty("useIconHighlightEffect", true); +- maxTitleBtn->setProperty("iconHighlightEffectMode", 1); ++// maxTitleBtn->setIconSize(QSize(25,25)); ++// maxTitleBtn->setProperty("useIconHighlightEffect", true); ++// maxTitleBtn->setProperty("iconHighlightEffectMode", 1); ++ maxTitleBtn->setProperty("isWindowButton", 0x1); ++ maxTitleBtn->setProperty("useIconHighlightEffect", 0x2); + maxTitleBtn->setFlat(true); +- QIcon iconMax(tr(":/img/fullscreen.png")); +- maxTitleBtn->setIcon(iconMax); ++// QIcon iconMax(tr(":/img/fullscreen.png")); ++ maxTitleBtn->setIcon(QIcon::fromTheme("window-maximize-symbolic")); + // maxTitleBtn->setIcon(QIcon::fromTheme("window-maximize-symbolic")); + connect(maxTitleBtn, SIGNAL(clicked()), this, SLOT(onMaxBtnClicked())); + // connect(maxBtn, &MyTristateButton::clicked, sthis, [=] { +@@ -487,17 +456,18 @@ + // } + // }); + // MyTristateButton *closeBtn = new MyTristateButton; +- QIcon iconClose(tr(":/img/close.png")); ++// QIcon iconClose(tr(":/img/close.png")); + QPushButton *closeBtn = new QPushButton(this); + closeBtn->setToolTip(tr("close")); + //closeBtn->setStyleSheet("QPushButton{background-color:transparent;}"); +- closeBtn->setIcon(iconClose); +- closeBtn->setIconSize(QSize(25,25)); +- //closeBtn->setObjectName("CloseButton"); +- closeBtn->setProperty("useIconHighlightEffect", true); +- closeBtn->setProperty("iconHighlightEffectMode", 1); ++// closeBtn->setIcon(iconClose); ++// closeBtn->setIconSize(QSize(25,25)); ++ closeBtn->setIcon(QIcon::fromTheme("window-close-symbolic")); + closeBtn->setFlat(true); ++ closeBtn->setProperty("isWindowButton", 0x2); ++ closeBtn->setProperty("useIconHighlightEffect", 0x8); + connect(closeBtn, SIGNAL(clicked()), this, SLOT(onCloseBtnClicked())); ++ //进行GSettings设置,记忆用户选择的combox的内容 + whichNum = ifsettings->get(WHICH_MENU).toInt(); + m_changeBox->setCurrentIndex(whichNum); + connect(m_changeBox,SIGNAL(currentIndexChanged(int)),this,SLOT(switchChangeItemProcessSignal(int))); +@@ -544,8 +514,6 @@ + + void MonitorTitleWidget::resizeEvent(QResizeEvent *event) + { +- qDebug()<geometry().x()<<"-----------------------"<geometry().y(); +- + if(window()->isMaximized()) + { + maxTitleBtn->setIcon(QIcon::fromTheme("window-restore-symbolic")); +@@ -555,8 +523,7 @@ + else + { + // maxTitleBtn->setIcon(QIcon::fromTheme("window-restore-symbolic")); +- QIcon iconMax(tr(":/img/fullscreen.png")); +- maxTitleBtn->setIcon(iconMax); ++ maxTitleBtn->setIcon(QIcon::fromTheme("window-maximize-symbolic")); + } + } + +diff -Naur ukui-system-monitor-1.0.1/src/monitortitlewidget.h ukui-system-monitor-1.0.1~/src/monitortitlewidget.h +--- ukui-system-monitor-1.0.1/src/monitortitlewidget.h 2019-05-27 15:48:18.000000000 +0800 ++++ ukui-system-monitor-1.0.1~/src/monitortitlewidget.h 2021-12-08 22:53:56.806056602 +0800 +@@ -107,7 +107,7 @@ + QWidget *emptyWidget = nullptr; + QWidget *emptyWidget2 = nullptr; + +- int fontSize; ++ float fontSize; + + QGSettings *qtSettings; + QGSettings *fontSettings; +diff -Naur ukui-system-monitor-1.0.1/src/networkflow.cpp ukui-system-monitor-1.0.1~/src/networkflow.cpp +--- ukui-system-monitor-1.0.1/src/networkflow.cpp 2019-05-27 15:48:18.000000000 +0800 ++++ ukui-system-monitor-1.0.1~/src/networkflow.cpp 2021-12-08 22:53:56.969642429 +0800 +@@ -111,7 +111,6 @@ + + if(QGSettings::isSchemaInstalled(idd)) + { +- qDebug()<<";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"; + qtSettings = new QGSettings(idd); + } + +diff -Naur ukui-system-monitor-1.0.1/src/processcategory.h ukui-system-monitor-1.0.1~/src/processcategory.h +--- ukui-system-monitor-1.0.1/src/processcategory.h 2019-05-27 15:48:18.000000000 +0800 ++++ ukui-system-monitor-1.0.1~/src/processcategory.h 2021-12-08 22:53:56.820140149 +0800 +@@ -29,11 +29,11 @@ + class ProcessCategory : public QWidget + { + Q_OBJECT +- ++ + public: + explicit ProcessCategory(int tabIndex, QWidget *parent = 0); + ~ProcessCategory(); +- ++ + signals: + void activeWhoseProcessList(int index); + +diff -Naur ukui-system-monitor-1.0.1/src/processdialog.cpp ukui-system-monitor-1.0.1~/src/processdialog.cpp +--- ukui-system-monitor-1.0.1/src/processdialog.cpp 2019-05-27 15:48:18.000000000 +0800 ++++ ukui-system-monitor-1.0.1~/src/processdialog.cpp 2021-12-08 22:53:56.981559277 +0800 +@@ -117,21 +117,22 @@ + connect(m_processListWidget, &ProcessListWidget::rightMouseClickedItems, this, &ProcessDialog::popupMenu, Qt::QueuedConnection); + m_layout->addWidget(m_processListWidget); + ++//记录要显示进程的内容类别 + whose_processes = "user"; + proSettings->beginGroup("PROCESS"); + whose_processes = proSettings->value("WhoseProcesses", whose_processes).toString(); + proSettings->endGroup(); + +- int tabIndex = 1; +- if (whose_processes == "active") { +- tabIndex = 0; +- } +- else if (whose_processes == "all") { +- tabIndex = 2; +- } +- else { +- tabIndex = 1; +- } ++// int tabIndex = 1; ++// if (whose_processes == "active") { ++// tabIndex = 0; ++// } ++// else if (whose_processes == "all") { ++// tabIndex = 2; ++// } ++// else { ++// tabIndex = 1; ++// } + + + // QWidget *w = new QWidget; +@@ -457,37 +458,28 @@ + ** should probably have a total_time_last gint in the ProcInfo structure */ + glibtop_get_cpu(&cpu); + +- + this->frequency = cpu.frequency; + + this->cpu_total_time = MAX(cpu.total - this->cpu_total_time_last, 1); + this->cpu_total_time_last = cpu.total; + +- +- +- + // FIXME: not sure if glibtop always returns a sorted list of pid + // but it is important otherwise refresh_list won't find the parent + std::sort(pid_list, pid_list + proclist.number); + +- //---------------start---------------------- + typedef std::list ProcList; + ProcList addition; + guint i; +-// int addPid; + for(i = 0; i < proclist.number; ++i) + { + ProcessWorker *info = ProcessWorker::find(pid_list[i]); + +- qDebug()<<"refreshProcessList:mapsize2"<addFlowNetPerSec = pidMap[pid_list[i]]; +- qDebug()<<"---------------------------------------wwj"<addFlowNetPerSec; + info = new ProcessWorker(pid_list[i], this->num_cpus, this->cpu_total_time,this->addFlowNetPerSec); + ProcessWorker::all[info->pid] = info; + info->mNumFlownet = numAddFlowNetPerSec; +@@ -497,8 +489,7 @@ + //create the process object when the pid's object doesn't exist + else + { +- qDebug()<<"refreshProcessList:else"<num_cpus, this->cpu_total_time,"0 KB/S"); ++ info = new ProcessWorker(pid_list[i], this->num_cpus, this->cpu_total_time, "0 KB/S"); + ProcessWorker::all[info->pid] = info; + info->mNumFlownet = 0; + } +@@ -520,10 +511,6 @@ + glibtop_proc_mem procmem; + glibtop_get_proc_mem(&procmem, info->pid); + info->mem = procmem.resident - procmem.share; +-// if(info->mem == 0) +-// { +- +-// } + + glibtop_get_proc_state(&procstate, info->pid); + info->status = procstate.state; +@@ -661,16 +648,13 @@ + info.m_numDiskIo = numDiskioPersec; //磁盘读写整数值 + // info.commandLine = QString::fromStdString(it->second->arguments); //命令行 + +- + item = new ProcessListItem(info); + items << item; + } + +- + this->updateStatus(items); + + g_free (pid_list); +- //---------------end---------------------- + } + + void ProcessDialog::refreshLine(const QString &procname, quint64 rcv, quint64 sent, int pid, unsigned int uid, const QString &devname) +@@ -686,20 +670,19 @@ + { + flowNetPrevMap[pid] = 0;//save prev data + } +- qDebug()<<"ProcessDialog::refreshLine:pid<new_count(tmptotalFlowNetPerSec - flowNetPrevMap[pid],pid); +- qDebug()<<"ProcessDialog::refreshLine:deltaFlowNetPerSec"<::const_iterator it = pidMap.find(pid); +- qDebug()<<"ProcessDialog::pidMap"< + #include + #include ++#include + + class ProcessManager; + class ProcessCategory; +diff -Naur ukui-system-monitor-1.0.1/src/processlistitem.cpp ukui-system-monitor-1.0.1~/src/processlistitem.cpp +--- ukui-system-monitor-1.0.1/src/processlistitem.cpp 2019-05-27 15:48:18.000000000 +0800 ++++ ukui-system-monitor-1.0.1~/src/processlistitem.cpp 2021-12-08 22:53:56.861307443 +0800 +@@ -27,6 +27,8 @@ + static int number = 0; + + ProcessListItem::ProcessListItem(ProcData info) ++ :qtSettings(nullptr) ++ ,fontSettings(nullptr) + { + + const QByteArray idd(THEME_QT_SCHEMA); +@@ -53,28 +55,27 @@ + ProcessListItem::~ProcessListItem() + { + if (qtSettings) { +- delete qtSettings; ++ qtSettings->deleteLater(); + } +- if(fontSettings) +- { +- delete fontSettings; ++ ++ if (fontSettings) { ++ fontSettings->deleteLater(); + } + } + + void ProcessListItem::initThemeMode() + { ++ if (!qtSettings) { ++ return; ++ } + //监听主题改变 + connect(qtSettings, &QGSettings::changed, this, [=](const QString &key) + { +- + if (key == "styleName") + { +-// auto style = qtSettings->get(key).toString(); +-// qApp->setStyle(new InternalStyle(style)); + currentThemeMode = qtSettings->get(MODE_QT_KEY).toString(); +- qDebug()<<"监听主题改变-------------------->"<setStyle(new InternalStyle(currentThemeMode)); +- //repaint(); ++ qDebug() << "Current theme mode: "<< currentThemeMode << endl; ++// repaint(); + } + }); + currentThemeMode = qtSettings->get(MODE_QT_KEY).toString(); +@@ -82,14 +83,19 @@ + + void ProcessListItem::initFontSize() + { +- connect(fontSettings,&QGSettings::changed,this,[=](QString key) ++ if (!fontSettings) { ++ fontSize = DEFAULT_FONT_SIZE; ++ return; ++ } ++ ++ connect(fontSettings, &QGSettings::changed, this, [=](QString key) + { + if("systemFont" == key || "systemFontSize" == key) + { +- fontSize = fontSettings->get(FONT_SIZE).toInt(); ++ fontSize = fontSettings->get(FONT_SIZE).toString().toFloat(); + } + }); +- fontSize = fontSettings->get(FONT_SIZE).toInt(); ++ fontSize = fontSettings->get(FONT_SIZE).toString().toFloat(); + } + + bool ProcessListItem::isSameItem(ProcessListItem *item) +@@ -102,18 +108,6 @@ + QPainterPath path; + path.addRect(QRectF(rect.x(), rect.y(), rect.width(), rect.height())); + painter->setOpacity(0.5);//0.1 +- if (level == 0) { +- //painter->fillPath(path, QColor("#131414")); +- //painter->setOpacity(0.08); +- } +- else if (level == 1) { +-// painter->fillPath(path, QColor("#131414")); +-// painter->setOpacity(0.08); +- } +- else { +-// painter->fillPath(path, QColor("#131414")); +-// painter->setOpacity(0.08); +- } + } + + void ProcessListItem::drawBackground(QRect rect, QPainter *painter, int index, bool isSelect ,QString currentThemeMode) +@@ -122,23 +116,10 @@ + path.addRect(QRectF(rect)); + + if (isSelect) { +-//// painter->setOpacity(0.08); +-// if(currentThemeMode == "ukui-white") +-// { +-// painter->setOpacity(0.08); +-// painter->fillPath(path, QColor("#000000")); +-// } +- +-// if(currentThemeMode == "ukui-black") +-// { +-// painter->setOpacity(0.08); +-// painter->fillPath(path, QColor("#ffffff")); +-// } + painter->setOpacity(0.08); + painter->fillPath(path,QColor("palette(windowText)")); + +- } +- else { ++ } else { + painter->setOpacity(0.08); + if(currentThemeMode == "ukui-light" || currentThemeMode == "ukui-default" || currentThemeMode == "ukui-white") + { +@@ -149,18 +130,12 @@ + { + painter->fillPath(path,QColor("#131414")); + } +- +-// if (index % 2 == 0) { +-// painter->fillPath(path, QColor("#ffffff")); +-// } else { +-// painter->fillPath(path, QColor("#e9eef0")); +-// } + } + } + + void ProcessListItem::drawForeground(QRect rect, QPainter *painter, int column, int, bool isSelect, bool isSeparator) + { +- setFontSize(*painter, fontSize+2); ++ setFontSize(*painter, fontSize + 2); + painter->setOpacity(0.85); + //painter->setPen(QPen(QColor(QPalette::Base))); + if (column == 0) { +@@ -184,22 +159,21 @@ + QFont font = painter->font(); + QFontMetrics fm(font); + QString procName = fm.elidedText(name, Qt::ElideRight, nameMaxWidth); +- painter->drawText(QRect(rect.x() + iconSize + padding * 2, rect.y(), nameMaxWidth, rect.height()), Qt::AlignLeft | Qt::AlignVCenter, procName); ++ painter->drawText(QRect(rect.x() + iconSize + padding * 2, rect.y(), nameMaxWidth, rect.height()), Qt::AlignCenter, procName); + if (!isSeparator) { + painter->setOpacity(0.8); + QPainterPath separatorPath; + separatorPath.addRect(QRectF(rect.x() + rect.width() - 1, rect.y(), 1, rect.height())); + painter->fillPath(separatorPath, QColor("#e0e0e0")); + } +- } +- else if (column == 1) { ++ } else if (column == 1) { + if (!m_data.user.isEmpty()) { + QString name = m_data.user; + int userMaxWidth = rect.width() - padding * PADDING ; + QFont font = painter->font(); + QFontMetrics fm(font); + QString userName = fm.elidedText(name, Qt::ElideRight, userMaxWidth); +- painter->drawText(QRect(rect.x(), rect.y(), rect.width() - textPadding, rect.height()), Qt::AlignLeft | Qt::AlignVCenter, userName); ++ painter->drawText(QRect(rect.x(), rect.y(), rect.width() - textPadding, rect.height()), Qt::AlignCenter, userName); + } + if (!isSeparator) { + painter->setOpacity(0.8); +@@ -210,7 +184,7 @@ + } + else if (column == 2) { + // if (!m_data.m_status.isEmpty()) { +- painter->drawText(QRect(rect.x(), rect.y(), rect.width() - textPadding, rect.height()), Qt::AlignRight | Qt::AlignVCenter, m_data.m_diskio); ++ painter->drawText(QRect(rect.x(), rect.y(), rect.width() - textPadding, rect.height()), Qt::AlignCenter, m_data.m_diskio); + // } + if (!isSeparator) { + painter->setOpacity(0.8); +@@ -229,7 +203,7 @@ + else { + //this->drawCellBackground(QRect(rect.x(), rect.y(), rect.width(), rect.height()), painter, 2); + } +- painter->drawText(QRect(rect.x(), rect.y(), rect.width() - textPadding, rect.height()), Qt::AlignRight | Qt::AlignVCenter, QString("%1%").arg(m_data.cpu)); ++ painter->drawText(QRect(rect.x(), rect.y(), rect.width() - textPadding, rect.height()), Qt::AlignCenter, QString("%1%").arg(m_data.cpu)); + if (!isSeparator) { + painter->setOpacity(0.8); + QPainterPath separatorPath; +@@ -238,7 +212,7 @@ + } + } + else if (column == 4) { +- painter->drawText(QRect(rect.x(), rect.y(), rect.width() - padding, rect.height()), Qt::AlignRight | Qt::AlignVCenter, QString("%1").arg(m_data.pid)); ++ painter->drawText(QRect(rect.x(), rect.y(), rect.width() - padding, rect.height()), Qt::AlignCenter, QString("%1").arg(m_data.pid)); + if (!isSeparator) { + painter->setOpacity(0.8); + // QPainterPath separatorPath; +@@ -251,7 +225,7 @@ + QFont font = painter->font(); + QFontMetrics fm(font); + QString flownet = fm.elidedText(m_data.m_flownet, Qt::ElideRight, flownetMaxWidth); +- painter->drawText(QRect(rect.x(), rect.y(), flownetMaxWidth, rect.height()), Qt::AlignCenter | Qt::AlignVCenter, flownet); ++ painter->drawText(QRect(rect.x(), rect.y(), flownetMaxWidth, rect.height()), Qt::AlignCenter, flownet); + if (!isSeparator) { + painter->setOpacity(0.8); + // QPainterPath separatorPath; +@@ -273,13 +247,13 @@ + else { + //this->drawCellBackground(QRect(rect.x(), rect.y(), rect.width(), rect.height()), painter, 2); + } +- painter->drawText(QRect(rect.x(), rect.y(), rect.width() - textPadding, rect.height()), Qt::AlignRight | Qt::AlignVCenter, Memory); ++ painter->drawText(QRect(rect.x(), rect.y(), rect.width() - textPadding, rect.height()), Qt::AlignCenter, Memory); + g_free(memory); + } + else + { + QString Memory = "0 MiB"; +- painter->drawText(QRect(rect.x(), rect.y(), rect.width() - textPadding, rect.height()), Qt::AlignRight | Qt::AlignVCenter, Memory); ++ painter->drawText(QRect(rect.x(), rect.y(), rect.width() - textPadding, rect.height()), Qt::AlignCenter, Memory); + } + if (!isSeparator) { + painter->setOpacity(0.8); +@@ -289,7 +263,7 @@ + } + } + else if (column == 7) { +- painter->drawText(QRect(rect.x(), rect.y(), rect.width() - textPadding, rect.height()), Qt::AlignLeft | Qt::AlignVCenter, getNiceLevel(m_data.m_nice)); ++ painter->drawText(QRect(rect.x(), rect.y(), rect.width() - textPadding, rect.height()), Qt::AlignCenter, getNiceLevel(m_data.m_nice)); + if (!isSeparator) { + painter->setOpacity(0.8); + QPainterPath separatorPath; +diff -Naur ukui-system-monitor-1.0.1/src/processlistitem.h ukui-system-monitor-1.0.1~/src/processlistitem.h +--- ukui-system-monitor-1.0.1/src/processlistitem.h 2019-05-27 15:48:18.000000000 +0800 ++++ ukui-system-monitor-1.0.1~/src/processlistitem.h 2021-12-08 22:53:56.817973450 +0800 +@@ -81,7 +81,7 @@ + int padding; + int textPadding; + +- int fontSize; ++ float fontSize; + + QGSettings *qtSettings; + QGSettings *fontSettings; +diff -Naur ukui-system-monitor-1.0.1/src/processlistwidget.cpp ukui-system-monitor-1.0.1~/src/processlistwidget.cpp +--- ukui-system-monitor-1.0.1/src/processlistwidget.cpp 2019-05-27 15:48:18.000000000 +0800 ++++ ukui-system-monitor-1.0.1~/src/processlistwidget.cpp 2021-12-08 22:53:56.879724391 +0800 +@@ -52,8 +52,7 @@ + ,m_mouseAtScrollArea(false) + ,m_mouseDragScrollbar(false) + { +- installEventFilter(this); +-//theme settings ++ + const QByteArray idd(THEME_QT_SCHEMA); + + if(QGSettings::isSchemaInstalled(idd)) +@@ -69,7 +68,7 @@ + } + + initFontSize(); +-//other settings ++ + this->m_searchFunc = NULL; + this->m_searchText = ""; + this->m_lastItem = NULL; +@@ -115,18 +114,6 @@ + + } + +-void ProcessListWidget::resizeEvent(QResizeEvent *event) +-{ +-// if(window()->isMaximized()) +-// { +-// widths<<300; +-// } +-// else +-// { +-// widths << 170 << 90 << 80 << 70 << 80 << -1 << 80 << 80;//-1时让该行填充所有剩余空间 +-// } +-} +- + void ProcessListWidget::initThemeMode() + { + //监听主题改变 +@@ -521,9 +508,9 @@ + + void ProcessListWidget::hideScrollbar() + { +- this->m_mouseAtScrollArea = true; ++ this->m_mouseAtScrollArea = false; + this->m_origOffset = this->m_offSet; +-qDebug()<<"hideScrollbar"; ++ + repaint(); + } + +@@ -850,45 +837,18 @@ + //标题文字左上方的排序箭头图标 + if (this->m_currentSortIndex == counter) + { +- if(counter == 0) ++ if(counter == 0 || counter == 5) + { + qDebug()<<"m_currentSortIndex------"<m_isSort) + { + qDebug()<<"m_isSort----------"<m_isSort) +- { +- qDebug()<<"m_isSort----------"<isMaximized()) +- { +- painter.drawPixmap(QPoint(rect().x() + posX + 580, rect().y() + 20), m_downArrowPixmap); +- } +- else +- { +- painter.drawPixmap(QPoint(rect().x() + posX + 80, rect().y() + 20), m_downArrowPixmap); +- } +- } +- else +- { +- if(window()->isMaximized()) +- { +- painter.drawPixmap(QPoint(rect().x() + posX + 580, rect().y() + 20), m_upArrowPixmap); +- } +- else +- { +- painter.drawPixmap(QPoint(rect().x() + posX + 80, rect().y() + 20), m_upArrowPixmap); +- } ++ painter.drawPixmap(QPoint(rect().x() + posX + 100, rect().y() + 20), m_upArrowPixmap); + } + } + else +@@ -905,23 +865,13 @@ + painter.drawPixmap(QPoint(rect().x() + posX + 60, rect().y() + 20), m_upArrowPixmap); + } + } +-// opacity = 0; +-// if (this->m_mouseDragScrollbar) { +-// opacity = 0.8; +-// } +-// else { +-// if (this->m_mouseAtScrollArea) +-// opacity = 0.7; +-// else +-// opacity = 0.5; +-// } + } + + //标题文字 + painter.setOpacity(0.57); + QFont font = painter.font(); + // font.setPointSize(10); +- font.setPixelSize(fontSize+1); ++ font.setPixelSize(fontSize); + painter.setFont(font); + if(currentThemeMode == "ukui-light" || currentThemeMode == "ukui-default" || currentThemeMode == "ukui-white") + { +@@ -936,7 +886,7 @@ + + // if (this->columnTitles[counter] == tr("Process Name") || this->columnTitles[counter] == tr("Flownet Persec")) + if (this->columnTitles[counter] == tr("Process Name")) +- painter.drawText(QRect(posX + this->m_titlePadding, 0, itemWidth, this->m_titleHeight), Qt::AlignLeft | Qt::AlignVCenter, this->columnTitles[counter]); ++ painter.drawText(QRect(posX + this->m_titlePadding, 0, itemWidth, this->m_titleHeight), Qt::AlignCenter, this->columnTitles[counter]); + else + painter.drawText(QRect(posX, 0, itemWidth - this->m_titlePadding, this->m_titleHeight), Qt::AlignCenter, this->columnTitles[counter]); + +@@ -967,11 +917,11 @@ + painter.setOpacity(1); + QPainterPath backgroundPath; + backgroundPath.addRect(QRectF(rect().x(), rect().y() + this->m_titleHeight, rect().width(), rect().height() - this->m_titleHeight)); +-// painter.fillPath(backgroundPath, QColor("#ffffff")); ++// painter.fillPath(backgroundPath, QColor("#CC00FF")); + + //进程信息 + QPainterPath scrollAreaPath; +- scrollAreaPath.addRect(QRectF(rect().x(), rect().y() + this->m_titleHeight, rect().width(), getTheScrollAreaHeight())); ++ scrollAreaPath.addRect(QRectF(rect().x(), rect().y() + this->m_titleHeight, rect().width(), getTheScrollAreaHeight() - 5)); + + int rowCounter = 0; + +@@ -1037,61 +987,37 @@ + //垂直滚动条 + if (this->m_mouseAtScrollArea) { + paintScrollbar(&painter); +- } else if (this->m_origOffset != this->m_offSet) { ++ } else/* if (this->m_origOffset != this->m_offSet) */{ + paintScrollbar(&painter); + readyToHideScrollbar(); + } + } + +-bool ProcessListWidget::eventFilter(QObject *obj, QEvent *event) ++void ProcessListWidget::paintScrollbar(QPainter *painter) + { +- if(event->type() == QEvent::Enter) +- { +- opacity = 0; ++ if (this->getItemsTotalHeight() > getTheScrollAreaHeight()) { ++ qreal opacitry = 0; + if (this->m_mouseDragScrollbar) { +- opacity = 0.8; ++ opacitry = 0.8; + } + else { + if (this->m_mouseAtScrollArea) +- opacity = 0.7; ++ opacitry = 0.7; + else +- opacity = 0.5; ++ opacitry = 0.5; + } +- repaint(); +- } +- +- if(event->type() == QEvent::Leave) +- { +- opacity =0.2; +- } +- return false; +-} +- +-void ProcessListWidget::paintScrollbar(QPainter *painter) +-{ +- if (this->getItemsTotalHeight() > getTheScrollAreaHeight()) { +-// qreal opacitry = 0; +-// if (this->m_mouseDragScrollbar) { +-// opacitry = 0.8; +-// } +-// else { +-// if (this->m_mouseAtScrollArea) +-// opacitry = 0.7; +-// else +-// opacitry = 0.5; +-// } + + int barWidth = (this->m_mouseAtScrollArea || this->m_mouseDragScrollbar) ? this->m_scrollbarWidth : 6; + int barY = getScrollbarY(); + int barHeight = getScrollbarHeight(); +- painter->setOpacity(opacity); ++ painter->setOpacity(opacitry); + QPainterPath path; + path.addRoundedRect( + QRectF(rect().x() + rect().width() - barWidth - 4, barY + 2, barWidth, barHeight - 2 * 2), 2, 2);//2 is radius +- painter->fillPath(path, QColor("#0B95D7")); ++ painter->fillPath(path, QColor("#808080")); + + QPen pen; +- pen.setColor(QColor("#0B95D7")); ++ pen.setColor(QColor("#808080")); + pen.setWidth(1); + painter->setOpacity(0); + painter->setPen(pen); +@@ -1195,7 +1121,7 @@ + + int ProcessListWidget::getScrollbarHeight() + { +- return std::max(static_cast(getTheScrollAreaHeight() / (this->getItemsTotalHeight() * 1.0) * rect().height()), 30);//30 is min height ++ return std::max(static_cast(getTheScrollAreaHeight() / (this->getItemsTotalHeight() * 1.0) * rect().height()), 80);//30 is min height + } + + QList ProcessListWidget::getSearchedItems(QList items) +diff -Naur ukui-system-monitor-1.0.1/src/processlistwidget.h ukui-system-monitor-1.0.1~/src/processlistwidget.h +--- ukui-system-monitor-1.0.1/src/processlistwidget.h 2019-05-27 15:48:18.000000000 +0800 ++++ ukui-system-monitor-1.0.1~/src/processlistwidget.h 2021-12-08 22:53:56.793056404 +0800 +@@ -100,8 +100,8 @@ + void paintEvent(QPaintEvent *); + void wheelEvent(QWheelEvent *event); + void paintScrollbar(QPainter *painter); +- bool eventFilter(QObject *obj, QEvent *event); +- void resizeEvent(QResizeEvent *event); ++// bool eventFilter(QObject *obj, QEvent *event); ++// void resizeEvent(QResizeEvent *event); + + private: + QTimer *m_hideScrollbarTimer = nullptr; +@@ -135,7 +135,7 @@ + QPixmap m_downArrowPixmap; + QPixmap m_upArrowPixmap; + +- int fontSize; ++ float fontSize; + + QGSettings *qtSettings; + QGSettings *fontSettings; +diff -Naur ukui-system-monitor-1.0.1/src/propertiesdialog.cpp ukui-system-monitor-1.0.1~/src/propertiesdialog.cpp +--- ukui-system-monitor-1.0.1/src/propertiesdialog.cpp 2021-12-08 22:01:33.491196799 +0800 ++++ ukui-system-monitor-1.0.1~/src/propertiesdialog.cpp 2021-12-08 22:53:56.927391785 +0800 +@@ -43,7 +43,7 @@ + this->setWindowFlags(this->windowFlags() | Qt::FramelessWindowHint/* | Qt::WindowCloseButtonHint*/| Qt::WindowStaysOnTopHint); + // this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint);//Attention: Qt::WindowCloseButtonHint make showMinimized() valid + +-// this->setAttribute(Qt::WA_TranslucentBackground); ++ this->setAttribute(Qt::WA_TranslucentBackground); + this->setAttribute(Qt::WA_Resized, false); + // this->setMaximumSize(480, 600); + // this->setMinimumWidth(320); +@@ -83,9 +83,8 @@ + m_logoLabel->setPixmap(QPixmap(":/res/sub_logo.png")); + + closeButton = new QPushButton(this); +-// closeButton->setAutoDefault(true); +-// closeButton->setFocusPolicy(Qt::NoFocus); +-// closeButton->setEnabled(false); ++ closeButton->setProperty("isWindowButton", 0x2); ++ closeButton->setProperty("useIconHighlightEffect", 0x8); + closeButton->setObjectName("CloseButton"); + closeButton->setIcon(QIcon::fromTheme("window-close-symbolic")); + closeButton->setFlat(true); +@@ -99,12 +98,12 @@ + // }); + + m_iconLabel = new QLabel(); +- m_iconLabel->setStyleSheet("QLabel{background:transparent;border:none;}"); ++// m_iconLabel->setStyleSheet("QLabel{background:transparent;border:none;}"); + m_iconLabel->setFixedSize(48, 48); + m_iconLabel->setContentsMargins(0, 0, 0, 0); + + m_titleLabel = new QLabel(); +- m_titleLabel->setStyleSheet("QLabel{background-color:transparent;font-size:18px;color:#000000;}"); ++// m_titleLabel->setStyleSheet("QLabel{background-color:transparent;font-size:18px;color:#000000;}"); + m_titleLabel->setFixedWidth(230); + m_titleLabel->setWordWrap(true); + +@@ -113,14 +112,15 @@ + + m_topRightLayout->addWidget(m_logoLabel, 0, Qt::AlignTop | Qt::AlignRight); + m_topRightLayout->addWidget(closeButton, 0, Qt::AlignTop | Qt::AlignRight); ++ m_topRightLayout->setContentsMargins(0,8,8,0); + + QLabel *topSplit = new QLabel(); +- topSplit->setStyleSheet("QLabel{background: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0 #f1f1f1, stop:1 #e0e0e0);}"); ++// topSplit->setStyleSheet("QLabel{background: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0 #f1f1f1, stop:1 #e0e0e0);}"); + // topSplit->setStyleSheet("QLabel{background: qlineargradient(x1:0, y1:0, x2:1, y2:0,stop:0 #f1f1f1, stop:1 #e0e0e0);}"); + topSplit->setFixedSize(320, 1); + + QLabel *bottomSplit = new QLabel(); +- bottomSplit->setStyleSheet("QLabel{background: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0 #f1f1f1, stop:1 #e0e0e0);}"); ++// bottomSplit->setStyleSheet("QLabel{background: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0 #f1f1f1, stop:1 #e0e0e0);}"); + // bottomSplit->setStyleSheet("QLabel{background: qlineargradient(x1:0, y1:0, x2:1, y2:0,stop:0 #f1f1f1, stop:1 #e0e0e0);}"); + bottomSplit->setFixedSize(320, 1); + +@@ -165,11 +165,11 @@ + titleList << QObject::tr("User name:") << QObject::tr("Process name:") << QObject::tr("flownet per second:") << QObject::tr("CPU Time:") << QObject::tr("Started Time:"); + for (int i = 0; i < titleList.length(); ++i) { + QLabel *titleLabel = new QLabel(titleList.value(i)); +- titleLabel->setStyleSheet("QLabel{background-color:transparent;font-size:12px;color:#999999;}"); ++// titleLabel->setStyleSheet("QLabel{background-color:transparent;font-size:12px;color:#999999;}"); + titleLabel->setMinimumHeight(20); + + QLabel *infoLabel = new QLabel(); +- infoLabel->setStyleSheet("QLabel{background-color:transparent;font-size:12px;color:#000000;}"); ++// infoLabel->setStyleSheet("QLabel{background-color:transparent;font-size:12px;color:#000000;}"); + infoLabel->setWordWrap(true); + infoLabel->setMinimumHeight(28); + infoLabel->setMinimumWidth(220); +@@ -181,85 +181,6 @@ + infoGrid->addWidget(infoLabel); + } + +- /*userTitleLabel = new QLabel(QString("%1:").arg(tr("User name"))); +- userTitleLabel->setStyleSheet("QLabel { background-color : transparent; color : #666666; }"); +- userTitleLabel->setFixedWidth(100); +- userTitleLabel->setAlignment(Qt::AlignRight); +- +- userLabel = new QLabel(); +- userLabel->setStyleSheet("QLabel { background-color : transparent; color : #000000; }"); +- +- userLayout->addWidget(userTitleLabel); +- userLayout->addWidget(userLabel); +- userLayout->addSpacing(20); +- +- nameTitleLabel = new QLabel(QString("%1:").arg(tr("Process name"))); +- nameTitleLabel->setStyleSheet("QLabel { background-color : transparent; color : #666666; }"); +- nameTitleLabel->setFixedWidth(100); +- nameTitleLabel->setAlignment(Qt::AlignRight); +- +- m_appNameLabel = new QLabel(); +- m_appNameLabel->setStyleSheet("QLabel { background-color : transparent; color : #000000; }"); +- +- nameLayout->addWidget(nameTitleLabel); +- nameLayout->addWidget(m_appNameLabel); +- nameLayout->addSpacing(20); +- +- cmdlineTitleLabel = new QLabel(QString("%1:").arg(tr("Command line"))); +- cmdlineTitleLabel->setStyleSheet("QLabel { background-color : transparent; color : #666666; }"); +- cmdlineTitleLabel->setFixedWidth(100); +- cmdlineTitleLabel->setAlignment(Qt::AlignRight); +-// cmdlineTitleLabel->setWordWrap(true); +-// cmdlineTitleLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); +- +- cmdlineLabel = new QLabel(); +- cmdlineLabel->setStyleSheet("QLabel { background-color : transparent; color : #000000; }"); +- cmdlineLabel->setWordWrap(true); +- cmdlineLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); +- +- cmdlineLayout->addWidget(cmdlineTitleLabel); +- cmdlineLayout->addWidget(cmdlineLabel); +- cmdlineLayout->addSpacing(20); +- +- cpuDurationTitleLabel = new QLabel(QString("%1:").arg(tr("CPU Time"))); +- cpuDurationTitleLabel->setStyleSheet("QLabel { background-color : transparent; color : #666666; }"); +- cpuDurationTitleLabel->setFixedWidth(100); +- cpuDurationTitleLabel->setAlignment(Qt::AlignRight); +- +- cpuDurationLabel = new QLabel(); +- cpuDurationLabel->setStyleSheet("QLabel { background-color : transparent; color : #000000; }"); +- cpuDurationLabel->setWordWrap(true); +- +- cpuDurationLayout->addWidget(cpuDurationTitleLabel); +- cpuDurationLayout->addWidget(cpuDurationLabel); +- cpuDurationLayout->addSpacing(20); +- +- startTimeTitleLabel = new QLabel(QString("%1:").arg(tr("Started Time"))); +- startTimeTitleLabel->setStyleSheet("QLabel { background-color : transparent; color : #666666; }"); +- startTimeTitleLabel->setFixedWidth(100); +- startTimeTitleLabel->setAlignment(Qt::AlignRight); +- +- startTimeLabel = new QLabel(); +- startTimeLabel->setStyleSheet("QLabel { background-color : transparent; color : #000000; }"); +- startTimeLabel->setWordWrap(true); +- +- startTimeLayout->addWidget(startTimeTitleLabel); +- startTimeLayout->addWidget(startTimeLabel); +- startTimeLayout->addSpacing(20); +- +- m_layout->addWidget(closeButton, 0, Qt::AlignTop | Qt::AlignRight); +- m_layout->addSpacing(20); +- m_layout->addWidget(m_iconLabel, 0, Qt::AlignHCenter); +- m_layout->addSpacing(14); +- m_layout->addWidget(m_titleLabel, 0, Qt::AlignHCenter); +- m_layout->addSpacing(20); +- m_layout->addLayout(userLayout); +- m_layout->addLayout(nameLayout); +- m_layout->addLayout(cmdlineLayout); +- m_layout->addLayout(cpuDurationLayout); +- m_layout->addLayout(startTimeLayout); +- m_layout->addSpacing(20);*/ +- + this->moveToCenter(); + + this->initProcproperties(); +@@ -474,7 +395,7 @@ + QPainter painter(this); + + //绘制圆角矩形 +- painter.setPen(QPen(QColor("#808080"), 0));//边框颜色 #3f96e4 ++ painter.setPen(QPen(QColor("#808080"), 0) );//边框颜色 #3f96e4 + // painter.setPen(Qt::NoPen); + painter.setBrush(this->palette().base());//背景色 + painter.setRenderHint(QPainter::Antialiasing, true); +diff -Naur ukui-system-monitor-1.0.1/src/renicedialog.cpp ukui-system-monitor-1.0.1~/src/renicedialog.cpp +--- ukui-system-monitor-1.0.1/src/renicedialog.cpp 2019-05-27 15:48:18.000000000 +0800 ++++ ukui-system-monitor-1.0.1~/src/renicedialog.cpp 2021-12-08 22:53:56.856974044 +0800 +@@ -36,9 +36,9 @@ + { + this->setWindowFlags(Qt::FramelessWindowHint); + this->setFixedSize(464, 240); +- this->setFixedSize(464+SHADOW_LEFT_TOP_PADDING+SHADOW_LEFT_TOP_PADDING, 240+SHADOW_RIGHT_BOTTOM_PADDING+SHADOW_RIGHT_BOTTOM_PADDING); +- this->setContentsMargins(SHADOW_LEFT_TOP_PADDING,SHADOW_LEFT_TOP_PADDING,SHADOW_RIGHT_BOTTOM_PADDING,SHADOW_RIGHT_BOTTOM_PADDING); +- this->setStyleSheet("QDialog{border: 1px solid white;border-radius:1px;background-color: #ffffff;}"); ++ this->setFixedSize(464+SHADOW_LEFT_TOP_PADDING+SHADOW_LEFT_TOP_PADDING, 300+SHADOW_RIGHT_BOTTOM_PADDING+SHADOW_RIGHT_BOTTOM_PADDING); ++// this->setContentsMargins(SHADOW_LEFT_TOP_PADDING,SHADOW_LEFT_TOP_PADDING,SHADOW_RIGHT_BOTTOM_PADDING,SHADOW_RIGHT_BOTTOM_PADDING); ++// this->setStyleSheet("QDialog{border: 1px solid white;border-radius:1px;background-color: #ffffff;}"); + this->setWindowIcon(QIcon(":/res/ukui-system-monitor.png")); + this->setAttribute(Qt::WA_DeleteOnClose); + +@@ -48,8 +48,24 @@ + m_mainLayout->setContentsMargins(0,0,0,0); + m_mainLayout->setSpacing(20); + m_mainLayout->setMargin(0); +- m_titleBar = new MyTitleBar(title, false, this); +- m_titleBar->setFixedSize(this->width(), TITLE_BAR_HEIGHT); ++// m_titleBar = new MyTitleBar(title, false, this); ++ QLabel *titleLabel = new QLabel; ++ titleLabel->setText(title); ++ QPushButton *closeButton = new QPushButton(this); ++ closeButton->setFlat(true); ++ closeButton->setIcon(QIcon::fromTheme("window-close-symbolic")); ++ closeButton->setProperty("isWindowButton", 0x2); ++ closeButton->setProperty("useIconHighlightEffect", 0x8); ++ ++ QHBoxLayout *title_H_BoxLayout = new QHBoxLayout(); ++ QHBoxLayout *closeBtn_H_BoxLayout = new QHBoxLayout(); ++ title_H_BoxLayout->setContentsMargins(0,0,0,0); ++ title_H_BoxLayout->setSpacing(0); ++ title_H_BoxLayout->addSpacing(15); ++ title_H_BoxLayout->addWidget(titleLabel); ++ closeBtn_H_BoxLayout->addWidget(closeButton,1,Qt::AlignRight); ++ closeBtn_H_BoxLayout->setContentsMargins(0,8,17,0); ++// m_titleBar->setFixedSize(this->width(), TITLE_BAR_HEIGHT); + + m_titleLabel = new QLabel(); + m_titleLabel->setFixedWidth(80); +@@ -69,12 +85,12 @@ + h_layout->addWidget(m_valueLabel); + + m_valueStrLabel = new QLabel; +- m_valueStrLabel->setStyleSheet("QLabel{background-color:transparent;color:#000000;font-size:13px;font-weight:bold;}"); ++// m_valueStrLabel->setStyleSheet("QLabel{background-color:transparent;color:#000000;font-size:13px;font-weight:bold;}"); + m_valueStrLabel->setAlignment(Qt::AlignCenter); + m_valueStrLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + + m_tipTitle = new QLabel; +- m_tipTitle->setStyleSheet("QLabel{background-color:transparent;color:#000000;font-size:12px;font-weight:bold;}"); ++// m_tipTitle->setStyleSheet("QLabel{background-color:transparent;color:#000000;font-size:12px;font-weight:bold;}"); + m_tipTitle->setText(tr("Note:")); + m_tipLabel = new QLabel; + m_tipLabel->setWordWrap(true);//QLabel自动换行 +@@ -116,7 +132,8 @@ + v_layout->addLayout(tip_layout); + v_layout->addLayout(btn_layout); + +- m_mainLayout->addWidget(m_titleBar); ++ m_mainLayout->addLayout(closeBtn_H_BoxLayout); ++ m_mainLayout->addLayout(title_H_BoxLayout); + m_mainLayout->addLayout(v_layout); + + connect(m_slider, &QSlider::valueChanged, [=] (int value) { +@@ -125,20 +142,20 @@ + m_valueStrLabel->setText(levelStr); + }); + +- connect(m_titleBar, SIGNAL(minSignal()), this, SLOT(hide())); +- connect(m_titleBar, SIGNAL(closeSignal()), this, SLOT(onClose())); ++// connect(m_titleBar, SIGNAL(minSignal()), this, SLOT(hide())); ++// connect(m_titleBar, SIGNAL(closeSignal()), this, SLOT(onClose())); + connect(m_cancelbtn, SIGNAL(clicked(bool)), this, SLOT(onClose())); +- ++ connect(closeButton,SIGNAL(clicked(bool)),this,SLOT(onClose())); + connect(m_changeBtn, &QPushButton::clicked, [=] (bool b) { + emit this->resetReniceValue(m_slider->value()); + }); + + //边框阴影效果 +- QGraphicsDropShadowEffect *shadow_effect = new QGraphicsDropShadowEffect(this); +- shadow_effect->setBlurRadius(5); +- shadow_effect->setColor(QColor(0, 0, 0, 127)); +- shadow_effect->setOffset(2, 4); +- this->setGraphicsEffect(shadow_effect); ++// QGraphicsDropShadowEffect *shadow_effect = new QGraphicsDropShadowEffect(this); ++// shadow_effect->setBlurRadius(5); ++// shadow_effect->setColor(QColor(0, 0, 0, 127)); ++// shadow_effect->setOffset(2, 4); ++// this->setGraphicsEffect(shadow_effect); + + // this->moveCenter(); + +@@ -148,7 +165,7 @@ + + ReniceDialog::~ReniceDialog() + { +- delete m_titleBar; ++// delete m_titleBar; + delete m_valueStrLabel; + + QLayoutItem *child; +@@ -233,3 +250,26 @@ + + QDialog::mouseMoveEvent(event); + } ++ ++void ReniceDialog::paintEvent(QPaintEvent *event) ++{ ++ QPainter painter(this); ++ ++ //绘制圆角矩形 ++ painter.setPen(QPen(QColor("#808080"), 0));//边框颜色 ++// painter.setBrush(QColor("#e9eef0"));//背景色 #0d87ca ++ painter.setBrush(this->palette().base()); ++ painter.setRenderHint(QPainter::Antialiasing, true); ++ painter.setOpacity(1); ++ QRectF r(0 / 2.0, 0 / 2.0, width() - 0, height() - 0);//左边 上边 右边 下边 ++ painter.drawRoundedRect(r, 4, 4); ++ ++ ++ //绘制背景色 ++// QPainterPath path; ++// path.addRect(QRectF(rect())); ++// painter.setOpacity(1); ++// painter.fillPath(path, QColor("#ffffff")); ++ ++ QDialog::paintEvent(event); ++} +diff -Naur ukui-system-monitor-1.0.1/src/renicedialog.h ukui-system-monitor-1.0.1~/src/renicedialog.h +--- ukui-system-monitor-1.0.1/src/renicedialog.h 2019-05-27 15:48:18.000000000 +0800 ++++ ukui-system-monitor-1.0.1~/src/renicedialog.h 2021-12-08 22:53:56.911141537 +0800 +@@ -51,6 +51,7 @@ + void mousePressEvent(QMouseEvent *event); + void mouseReleaseEvent(QMouseEvent *event); + void mouseMoveEvent(QMouseEvent *event); ++ void paintEvent(QPaintEvent *event); + + private: + QVBoxLayout *m_mainLayout = nullptr; +diff -Naur ukui-system-monitor-1.0.1/src/resourcesdialog.cpp ukui-system-monitor-1.0.1~/src/resourcesdialog.cpp +--- ukui-system-monitor-1.0.1/src/resourcesdialog.cpp 2019-05-27 15:48:18.000000000 +0800 ++++ ukui-system-monitor-1.0.1~/src/resourcesdialog.cpp 2021-12-08 22:53:56.838557096 +0800 +@@ -171,17 +171,13 @@ + m_stack->setCurrentWidget(m_cpuWidget); + + /*m_hlayout->addWidget(m_resourcesCategory); +-// m_hlayout->addLayout(m_vlayout); ++ m_hlayout->addLayout(m_vlayout); + m_hlayout->addWidget(m_stack);*/ + QWidget *placeWidget = new QWidget(); + placeWidget->setFixedWidth(34); + splitter->addWidget(m_resourcesCategory); + splitter->addWidget(placeWidget); + splitter->addWidget(m_stack); +- qDebug()<<"m_resourcesCategory"<width()<height(); +- qDebug()<<"m_stack"<width()<height(); +- qDebug()<<"m_resourcesCategory"<geometry().x()<geometry().y(); +- qDebug()<<"m_stack"<geometry().x()<geometry().y(); + m_hlayout->addWidget(splitter); + + connect(this, SIGNAL(updateNetworkStatus(long,long,long,long)), m_networkWidget, SLOT(onUpdateNetworkStatus(long,long,long,long)), Qt::QueuedConnection); +diff -Naur ukui-system-monitor-1.0.1/src/resourcesindicator.cpp ukui-system-monitor-1.0.1~/src/resourcesindicator.cpp +--- ukui-system-monitor-1.0.1/src/resourcesindicator.cpp 2019-05-27 15:48:18.000000000 +0800 ++++ ukui-system-monitor-1.0.1~/src/resourcesindicator.cpp 2021-12-08 22:53:57.008643024 +0800 +@@ -41,7 +41,6 @@ + ,m_outsideBorderColor(Qt::transparent) + { + typeObject = flag; +- qDebug()<<"typeObject---"<get(key).toString(); +-// qApp->setStyle(new InternalStyle(style)); + currentThemeMode = qtSettings->get(MODE_QT_KEY).toString(); +- qDebug()<<"监听主题改变-------------------->"<setStyle(new InternalStyle(currentThemeMode)); + repaint(); + updateBgColor(); + } +@@ -168,11 +157,8 @@ + + void ResourcesIndicator::updateBgColor() + { +- qDebug()<<"Resoruce"; + switch (m_state) { + case Hover: +- qDebug()<<"Hover---"; +-// if() + this->m_outsideBorderColor = Qt::transparent; + if(currentThemeMode == "ukui-light" || currentThemeMode == "ukui-default" || currentThemeMode == "ukui-white") + { +@@ -184,37 +170,26 @@ + } + break; + case Press: +- qDebug()<<"press---"; + this->m_outsideBorderColor = Qt::transparent; + this->m_bgColor = QColor("#f6fcfe"); + break; + case Checked: +- qDebug()<<"1234567879.000"; + // this->m_outsideBorderColor = QColor("#0973b4"); + this->m_outsideBorderColor = Qt::transparent; +- if(currentThemeMode == "ukui-light" || currentThemeMode == "ukui-default" || currentThemeMode == "ukui-white") +- { ++ if (currentThemeMode == "ukui-light" || currentThemeMode == "ukui-default" || currentThemeMode == "ukui-white") { + this->m_bgColor = QColor(0x13,0x14,0x14,19); //#e9f8fd +- } +- else +- { ++ } else { + this->m_bgColor = QColor(0xff,0xff,0xff,9); + } + // this->m_bgColor = palette().color(QPalette::Base); + break; + default: +- qDebug()<<"123456789."; + this->m_outsideBorderColor = Qt::transparent; + // this->m_bgColor = QColor("#ffffff"); + // this->m_outsideBorderColor = palette().color(QPalette::Base); +- if(currentThemeMode == "ukui-light" || currentThemeMode == "ukui-default" || currentThemeMode == "ukui-white") +- { +- qDebug()<<"ifiamcommingin"; ++ if (currentThemeMode == "ukui-light" || currentThemeMode == "ukui-default" || currentThemeMode == "ukui-white") { + this->m_bgColor = QColor(0xff,0xff,0xff,0); +- } +- else if(currentThemeMode == "ukui-dark" || currentThemeMode == "ukui-black") +- { +- qDebug()<<"iiiiiiiiiiiii"; ++ } else if (currentThemeMode == "ukui-dark" || currentThemeMode == "ukui-black") { + this->m_bgColor = QColor(0x13,0x14,0x14,0); + } + break; +@@ -226,11 +201,7 @@ + { + if (m_state == state) + return; +- qDebug()<<"9517538246"; +- qDebug()<<"normal"<m_posX, this->m_rectTopPadding, this->m_rectTotalWidth, this->height()-(this->m_rectTotalHeight - convertPercent)); +-// if(typeObject == 0) +-// { +-// painter.setOpacity(0.06); +-// painter.setBrush(QColor("#0973b4")); +-// } +- +-// if(typeObject == 1) +-// { +-// painter.setOpacity(0.06); +-// painter.setBrush(QColor("#9528b4")); +-// } + + QRect occupyRect(this->m_posX, this->m_rectTopPadding + this->m_rectTotalHeight - convertPercent, this->m_rectTotalWidth, convertPercent); + // painter.drawRoundedRect(occupyRect); + painter.drawRect(this->m_posX, this->m_rectTopPadding + this->m_rectTotalHeight - convertPercent, this->m_rectTotalWidth, convertPercent); +- qDebug()<<"this->->->->"<m_posX<m_rectTopPadding + this->m_rectTotalHeight - convertPercent<m_rectTotalWidth<->->->"<m_posX<m_rectTopPadding + this->m_rectTotalHeight - convertPercent<m_rectTotalWidth<m_title); + +diff -Naur ukui-system-monitor-1.0.1/src/singleProcessNet/inode2prog.cpp ukui-system-monitor-1.0.1~/src/singleProcessNet/inode2prog.cpp +--- ukui-system-monitor-1.0.1/src/singleProcessNet/inode2prog.cpp 2021-12-08 22:01:33.495530200 +0800 ++++ ukui-system-monitor-1.0.1~/src/singleProcessNet/inode2prog.cpp 2021-12-08 22:53:57.415982570 +0800 +@@ -192,7 +192,7 @@ + DIR * proc = opendir ("/proc"); + + if (proc == 0) { +- std::cerr << "Error reading /proc, needed to get inode-to-pid-maping\n"; ++ std::cerr << "Error reading /proc, needed to get inode-to-pid-maping\n"; + exit(1); + } + +diff -Naur ukui-system-monitor-1.0.1/src/systemmonitor.cpp ukui-system-monitor-1.0.1~/src/systemmonitor.cpp +--- ukui-system-monitor-1.0.1/src/systemmonitor.cpp 2021-12-08 22:01:33.491196799 +0800 ++++ ukui-system-monitor-1.0.1~/src/systemmonitor.cpp 2021-12-08 22:53:56.871057592 +0800 +@@ -54,6 +54,8 @@ + SystemMonitor::SystemMonitor(QWidget *parent) + : QFrame(parent) + , mousePressed(false) ++ , opacitySettings(nullptr) ++ , qtSettings(nullptr) + { + // this->setStyleSheet("QFrame{border: 1px solid #121212;border-radius:1px;background-color:#1f1f1f;}"); + // this->setAttribute(Qt::WA_DeleteOnClose); +@@ -61,22 +63,8 @@ + this->setObjectName("SystemMonitor"); + + this->setWindowFlags(Qt::FramelessWindowHint); //set for no windowhint +-// this->setAttribute(Qt::WA_TranslucentBackground);//背景透明 ++ this->setAttribute(Qt::WA_TranslucentBackground);//背景透明 + this->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); +-// QPainterPath path; +-// auto rect = this->rect(); +-// rect.adjust(0,0,-0,-0); +-// path.addRoundedRect(rect, 6, 6); +-// setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon())); +-// this->setStyleSheet("QWidget{border:none;border-radius:6px;}"); +- +-// this->setObjectName("ParentObjectOnly"); +-// this->setStyleSheet("QFrame#ParentObjectOnly{""background:rgba(19,19,20,0.7);" +-// "border:1px solid rgba(255, 255, 255, 0.05);" +-// "border-radius:6px;" +-// "}"); +- +-// this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint);//Attention: Qt::WindowCloseButtonHint make showMinimized() valid + + const QByteArray idd(THEME_QT_SCHEMA); + +@@ -92,15 +80,14 @@ + opacitySettings = new QGSettings(idtrans); + } + ++ getOsRelease(); ++ + this->setAutoFillBackground(true); + // this->setMouseTracking(true); + // installEventFilter(this); + + this->setWindowTitle(tr("Kylin System Monitor")); +-// this->setWindowIcon(QIcon(":/model/res/plugin/processmanager.png")); +-// this->setWindowIcon(QIcon(":/img/processmanager.png")); +- +- this->setWindowIcon(QIcon::fromTheme("ukui-system-monitor")); ++ this->setWindowIcon(QIcon::fromTheme("ukui-system-monitor")); + + + //this->setFixedSize(900, 600); +@@ -114,17 +101,10 @@ + this->initPanelStack(); + this->initConnections(); + initThemeMode(); +- connect(m_titleWidget,SIGNAL(changeProcessItemDialog(int)),process_dialog,SLOT(onActiveWhoseProcess(int))); ++ connect(m_titleWidget,SIGNAL(changeProcessItemDialog(int)),process_dialog,SLOT(onActiveWhoseProcess(int))); //配置文件中为whoseprocess赋值 + getTransparentData(); +- //边框阴影效果 +-// QGraphicsDropShadowEffect *shadow_effect = new QGraphicsDropShadowEffect(this); +-// shadow_effect->setBlurRadius(5); +-// shadow_effect->setColor(QColor(0, 0, 0, 127)); +-// shadow_effect->setOffset(2, 4); +-// this->setGraphicsEffect(shadow_effect); +- +- + this->moveCenter(); ++ qDebug()<<"--+--"<get(key).toString(); +-// qApp->setStyle(new InternalStyle(style)); + currentThemeMode = qtSettings->get(MODE_QT_KEY).toString(); +- qDebug()<<"监听主题改变-------------------->"<setStyle(new InternalStyle(currentThemeMode)); + } + }); + currentThemeMode = qtSettings->get(MODE_QT_KEY).toString(); +- qDebug()<<"hahahahaaha"<keys(); + if (keys.contains("transparency")) + { +- m_transparency = opacitySettings->get("transparency").toDouble(); ++ m_transparency = opacitySettings->get("transparency").toString().toDouble(); + } + } + repaint(); + }); +- m_transparency = opacitySettings->get("transparency").toDouble(); +-// if(!opacitySettings) +-// { +-// m_transparency = 0.7; +-// return; +-// } +-// QStringList keys = opacitySettings->keys(); +-// if(keys.contains("transparenty")) +-// { +-// m_transparency = opacitySettings->get("transparency").toDouble(); +-// } ++ ++ QStringList keys = opacitySettings->keys(); ++ if(keys.contains("transparency")) ++ { ++ m_transparency = opacitySettings->get("transparency").toString().toDouble(); ++ } + } + + SystemMonitor::~SystemMonitor() +@@ -261,23 +232,17 @@ + // 绘制一个背景 + p.save(); + p.fillPath(rectPath,palette().color(QPalette::Base)); +-// p.fillPath(rectPath,QColor(0,0,0)); + p.restore(); + + QStyleOption opt; + opt.init(this); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); +- KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(rectPath.toFillPolygon().toPolygon())); + } + + void SystemMonitor::resizeEvent(QResizeEvent *e) + { + if (m_titleWidget) { + m_titleWidget->resize(width() - 2, MONITOR_TITLE_WIDGET_HEIGHT); +-// if (e->oldSize() != e->size()) { +-// emit m_titleWidget->updateMaxBtn(); +-// m_titleWidget->onUpdateMaxBtnStatusChanged(); +-// } + } + if (m_sysMonitorStack) { + m_sysMonitorStack->resize(width() - 2, this->height() - MONITOR_TITLE_WIDGET_HEIGHT - 2); +@@ -405,7 +370,7 @@ + + m_sysMonitorStack->resize(width() - 2, this->height() - TITLE_WIDGET_HEIGHT); + m_sysMonitorStack->move(1, TITLE_WIDGET_HEIGHT); +- qDebug()<width()<<"---------------------"<height(); ++// qDebug() << "System monitor size(w x h): " << m_sysMonitorStack->width() << " x " << m_sysMonitorStack->height(); + //m_sysMonitorStack->setFixedSize(898,500); + + // m_sysMonitorStack->setMouseTracking(false); +@@ -565,6 +530,20 @@ + primaryGeometry.y() + (primaryGeometry.height() - this->height())/2); + } + ++void SystemMonitor::getOsRelease() ++{ ++ QFile file("/etc/lsb-release"); ++ if (!file.open(QIODevice::ReadOnly)) qDebug() << "Read file Failed."; ++ while (!file.atEnd()) { ++ QByteArray line = file.readLine(); ++ QString str(line); ++ if (str.contains("DISTRIB_ID")){ ++ version=str.remove("DISTRIB_ID="); ++ version=str.remove("\n"); ++ } ++ } ++} ++ + void SystemMonitor::closeEvent(QCloseEvent *event) + { + event->accept(); +@@ -621,11 +600,14 @@ + + void SystemMonitor::keyPressEvent(QKeyEvent *event) + { +- if(event->key() == Qt::Key_F1) ++ if(version != "Ubuntu") + { +- if(!daemonIsNotRunning()) ++ if(event->key() == Qt::Key_F1) + { +- showGuide(qAppName()); ++ if(!daemonIsNotRunning()) ++ { ++ showGuide(qAppName()); ++ } + } + } + } +diff -Naur ukui-system-monitor-1.0.1/src/systemmonitor.h ukui-system-monitor-1.0.1~/src/systemmonitor.h +--- ukui-system-monitor-1.0.1/src/systemmonitor.h 2019-05-27 15:48:18.000000000 +0800 ++++ ukui-system-monitor-1.0.1~/src/systemmonitor.h 2021-12-08 22:53:57.011893074 +0800 +@@ -82,6 +82,7 @@ + private: + int daemonIsNotRunning(); + void showGuide(QString appName); ++ void getOsRelease(); + private: + // WId mWindow; + QStackedWidget *m_sysMonitorStack = nullptr; +@@ -100,6 +101,7 @@ + + QGSettings *opacitySettings; + double m_transparency; ++ QString version; + }; + + #endif // SYSTEMMONITOR_H +diff -Naur ukui-system-monitor-1.0.1/widgets/mydialog.cpp ukui-system-monitor-1.0.1~/widgets/mydialog.cpp +--- ukui-system-monitor-1.0.1/widgets/mydialog.cpp 2021-12-08 22:01:33.492280149 +0800 ++++ ukui-system-monitor-1.0.1~/widgets/mydialog.cpp 2021-12-08 22:53:56.760555909 +0800 +@@ -39,7 +39,7 @@ + this->setWindowFlags(this->windowFlags() | Qt::FramelessWindowHint | Qt::WindowCloseButtonHint); + // this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint);//Attention: Qt::WindowCloseButtonHint make showMinimized() valid + +-// this->setAttribute(Qt::WA_TranslucentBackground); ++ this->setAttribute(Qt::WA_TranslucentBackground); + // this->setAttribute(Qt::WA_DeleteOnClose, false); + this->setAttribute(Qt::WA_Resized, false); + +diff -Naur ukui-system-monitor-1.0.1/widgets/mysearchedit.cpp ukui-system-monitor-1.0.1~/widgets/mysearchedit.cpp +--- ukui-system-monitor-1.0.1/widgets/mysearchedit.cpp 2019-05-27 15:48:18.000000000 +0800 ++++ ukui-system-monitor-1.0.1~/widgets/mysearchedit.cpp 2021-12-08 22:53:56.747555711 +0800 +@@ -31,12 +31,12 @@ + : QFrame(parent) + ,m_showCurve(QEasingCurve::OutCubic) + ,m_hideCurve(QEasingCurve::InCubic) ++ ,fontSettings(nullptr) + { + const QByteArray idd(THEME_QT_SCHEMA); + + if(QGSettings::isSchemaInstalled(idd)) + { +-// qDebug()<<"MySearchEdit--------------1------------->"<setWindowFlags(Qt::FramelessWindowHint); +- //this->setStyleSheet("QFrame{background-color:#00376a;border-radius:0px;}"); +-// this->setFixedSize(200,32); +- qDebug()<<"mySearchEdit.width"<width()<<"mySearchEidt.height"<height(); + +-// this->setObjectName("SearchBtn"); +-// this->setStyleSheet("QFrame#SearchBtn{background:rgba(77,88,99,0.08);border-radius:4px;}"); + m_searchBtn = new QLabel; + m_searchBtn->setStyleSheet("QLabel{background-color:transparent;border:none;background-image:url(:/img/search.png);}"); + m_searchBtn->setFixedSize(SEARCHBUTTON, SEARCHBUTTON); +@@ -103,17 +98,12 @@ + connect(m_pClearTextButton, &QPushButton::clicked, this, [=](){ + m_edit->setText(""); + }); +- //m_edit->setPlaceholderText("enter process info"); +- +- + + m_placeHolder = new QLabel; //about the font + QFont font; + font.setPointSize(fontSize-2); + m_placeHolder->setFont(font); + +-// m_placeHolder->setStyleSheet("QLabel{background-color:transparent;color:rgba(0,0,0,0.57);margin: 2 0 0 0 px;}"); +- + initThemeMode(); + + m_animation = new QPropertyAnimation(m_edit, "minimumWidth"); +@@ -143,8 +133,6 @@ + // layout->addWidget(m_clearBtn); + // layout->setAlignment(m_clearBtn, Qt::AlignCenter); + +- +- + layout->setSpacing(0); + layout->setContentsMargins(0, 0, 0, 0); + +@@ -156,14 +144,11 @@ + // connect(m_clearBtn, &MyTristateButton::clicked, this, [=] { + // this->clearAndFocusEdit(); + // }); +- +-// qDebug()<width()<<"----------------------------------------------"<height(); + } + + + QPixmap MySearchEdit::drawSymbolicColoredPixmap(const QPixmap &source) + { +-// qDebug()<<"wwj,wozhendeshishishishsishishsishsihsishsishsishsihs"< 0) + { +- color.setRed(255); +- color.setGreen(255); +- color.setBlue(255); +- img.setPixelColor(x, y, color); ++ color.setRed(255); ++ color.setGreen(255); ++ color.setBlue(255); ++ img.setPixelColor(x, y, color); + } + } + } + return QPixmap::fromImage(img); +- } +- +- else +- { ++ } else { + QImage img = source.toImage(); + for (int x = 0; x < img.width(); x++) + { +@@ -214,10 +193,10 @@ + auto color = img.pixelColor(x, y); + if (color.alpha() > 0) + { +- color.setRed(0); +- color.setGreen(0); +- color.setBlue(0); +- img.setPixelColor(x, y, color); ++ color.setRed(0); ++ color.setGreen(0); ++ color.setBlue(0); ++ img.setPixelColor(x, y, color); + } + } + } +@@ -401,7 +380,7 @@ + + if(currentThemeMode == "ukui-light" || currentThemeMode == "ukui-default" || currentThemeMode == "ukui-white") + { +- m_edit->setStyleSheet("QLineEdit{background:transparent;border-radius:4px;color:#00000;padding-right:12px;padding-bottom: 2px;}"); //#CC00FF transparent ++ m_edit->setStyleSheet("QLineEdit{background:transparent;border-radius:4px;color:#000000;padding-right:12px;padding-bottom: 2px;}"); //#CC00FF transparent + m_placeHolder->setStyleSheet("QLabel{background-color:transparent;color:rgba(0,0,0,0.57);margin: 2 0 0 0 px;}"); + this->setObjectName("SearchBtn"); + this->setStyleSheet("QFrame#SearchBtn{background:rgba(13,14,14,0.08);border-radius:4px;}"); +@@ -424,7 +403,7 @@ + m_pClearTextButton->setIcon(drawSymbolicColoredPixmap(QPixmap::fromImage(QIcon::fromTheme(":/img/button-close-default-add-background-three.svg").pixmap(24,24).toImage()))); + if(currentThemeMode == "ukui-light" || currentThemeMode == "ukui-default" || currentThemeMode == "ukui-white") + { +- m_edit->setStyleSheet("QLineEdit{background:transparent;border-radius:4px;color:#00000;padding-right:12px;padding-bottom: 2px;}"); //#CC00FF transparent ++ m_edit->setStyleSheet("QLineEdit{background:transparent;border-radius:4px;color:#000000;padding-right:12px;padding-bottom: 2px;}"); //#CC00FF transparent + m_placeHolder->setStyleSheet("QLabel{background-color:transparent;color:rgba(0,0,0,0.57);margin: 2 0 0 0 px;}"); + this->setObjectName("SearchBtn"); + this->setStyleSheet("QFrame#SearchBtn{background:rgba(13,14,14,0.08);border-radius:4px;}"); +@@ -441,11 +420,15 @@ + + void MySearchEdit::initFontSize() + { ++ if (!fontSettings) { ++ fontSize = DEFAULT_FONT_SIZE; ++ return; ++ } + connect(fontSettings,&QGSettings::changed,[=](QString key) + { + if("systemFont" == key || "systemFontSize" == key) + { +- fontSize = fontSettings->get(FONT_SIZE).toInt(); ++ fontSize = fontSettings->get(FONT_SIZE).toString().toFloat(); + } + QFont font; + font.setPointSize(fontSize - 2); +@@ -454,5 +437,5 @@ + searchLineFont.setPointSize(fontSize); + m_edit->setFont(searchLineFont); + }); +- fontSize = fontSettings->get(FONT_SIZE).toInt(); ++ fontSize = fontSettings->get(FONT_SIZE).toString().toFloat(); + } +diff -Naur ukui-system-monitor-1.0.1/widgets/mysearchedit.h ukui-system-monitor-1.0.1~/widgets/mysearchedit.h +--- ukui-system-monitor-1.0.1/widgets/mysearchedit.h 2019-05-27 15:48:18.000000000 +0800 ++++ ukui-system-monitor-1.0.1~/widgets/mysearchedit.h 2021-12-08 22:53:56.771389407 +0800 +@@ -85,7 +85,7 @@ + QPushButton *m_pClearTextButton =nullptr; + QPixmap drawSymbolicColoredPixmap(const QPixmap &source); + +- int fontSize; ++ float fontSize; + + QGSettings *qtSettings; + QGSettings *fontSettings; +diff -Naur ukui-system-monitor-1.0.1/widgets/myunderlinebutton.cpp ukui-system-monitor-1.0.1~/widgets/myunderlinebutton.cpp +--- ukui-system-monitor-1.0.1/widgets/myunderlinebutton.cpp 2019-05-27 15:48:18.000000000 +0800 ++++ ukui-system-monitor-1.0.1~/widgets/myunderlinebutton.cpp 2021-12-08 22:53:56.768139358 +0800 +@@ -30,6 +30,7 @@ + : QWidget(parent) + ,m_state(Normal) + ,m_isChecked(false) ++ ,fontSettings(nullptr) + { + const QByteArray idd(THEME_QT_SCHEMA); + +@@ -112,18 +113,22 @@ + + void MyUnderLineButton::initFontSize() + { +- connect(fontSettings,&QGSettings::changed,[=](QString key) ++ if (!fontSettings) { ++ fontSize = DEFAULT_FONT_SIZE; ++ return; ++ } ++ connect(fontSettings, &QGSettings::changed, [=](QString key) + { + if("systemFont" == key || "systemFontSize" == key) + { +- fontSize = fontSettings->get(FONT_SIZE).toInt(); ++ fontSize = fontSettings->get(FONT_SIZE).toString().toFloat(); + } + // repaint(); + QFont font; + font.setPointSize(fontSize -2); + m_textLabel->setFont(font); + }); +- fontSize = fontSettings->get(FONT_SIZE).toInt(); ++ fontSize = fontSettings->get(FONT_SIZE).toString().toFloat(); + QFont font; + font.setPointSize(fontSize -2); + m_textLabel->setFont(font); +diff -Naur ukui-system-monitor-1.0.1/widgets/myunderlinebutton.h ukui-system-monitor-1.0.1~/widgets/myunderlinebutton.h +--- ukui-system-monitor-1.0.1/widgets/myunderlinebutton.h 2019-05-27 15:48:18.000000000 +0800 ++++ ukui-system-monitor-1.0.1~/widgets/myunderlinebutton.h 2021-12-08 22:53:56.744305662 +0800 +@@ -75,7 +75,7 @@ + //QLabel *m_underlineLabel = nullptr; + QVBoxLayout *m_layout = nullptr; + +- int fontSize; ++ float fontSize; + + QGSettings *qtSettings; + QGSettings *fontSettings; diff --git a/ukui-system-monitor.spec b/ukui-system-monitor.spec index 3d21ae3..14dee72 100644 --- a/ukui-system-monitor.spec +++ b/ukui-system-monitor.spec @@ -1,7 +1,7 @@ %define debug_package %{nil} Name: ukui-system-monitor Version: 1.0.1 -Release: 9 +Release: 10 Summary: A simple system monitor written in QT License: GPL-3+ GPL-2+ URL: http://www.ukui.org @@ -40,7 +40,7 @@ patch4: 0003-Add-libglib2.0-bin-to-Depends.patch patch5: 0004-Update-README.md.patch patch6: 0005-Remove-LICENSE-which-is-same-with-COPYING.patch patch7: 0006-Update-modification-record-in-changelog.patch - +patch8: fix-the-bug-about-process-filesystem.patch %description A simple system monitor written in QT @@ -54,6 +54,7 @@ A simple system monitor written in QT %patch5 -p1 %patch6 -p1 %patch7 -p1 +%patch8 -p1 %build export PATH=%{_qt5_bindir}:$PATH @@ -84,6 +85,9 @@ rm -rf $RPM_BUILD_ROOT %{_datadir}/glib-2.0/schemas/org.ukui.system-monitor.menu.gschema.xml %changelog +* Tue Dec 09 2021 douyan - 1.0.1-10 +- fix the bug about process and filesystem + * Tue Dec 07 2021 tanyulong - 1.0.1-9 - Update modification record in changelog