Skip to content

Commit 4771334

Browse files
authored
Merge pull request #141 from game1024/release/v1.7
ignore upper and lower case for processName sort
2 parents e0724f3 + a3c1e72 commit 4771334

File tree

5 files changed

+172
-157
lines changed

5 files changed

+172
-157
lines changed

OpenSpeedy_en_US.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -931,43 +931,43 @@ Origin</translation>
931931
</message>
932932
<message>
933933
<location filename="processmonitor.cpp" line="236"/>
934-
<location filename="processmonitor.cpp" line="289"/>
934+
<location filename="processmonitor.cpp" line="290"/>
935935
<source>高</source>
936936
<translation>High</translation>
937937
</message>
938938
<message>
939939
<location filename="processmonitor.cpp" line="239"/>
940-
<location filename="processmonitor.cpp" line="292"/>
940+
<location filename="processmonitor.cpp" line="293"/>
941941
<source>中</source>
942942
<translation>Medium</translation>
943943
</message>
944944
<message>
945945
<location filename="processmonitor.cpp" line="242"/>
946-
<location filename="processmonitor.cpp" line="295"/>
946+
<location filename="processmonitor.cpp" line="296"/>
947947
<source>低</source>
948948
<translation>Low</translation>
949949
</message>
950950
<message>
951951
<location filename="processmonitor.cpp" line="245"/>
952-
<location filename="processmonitor.cpp" line="298"/>
952+
<location filename="processmonitor.cpp" line="299"/>
953953
<source>实时</source>
954954
<translation>RT</translation>
955955
</message>
956956
<message>
957957
<location filename="processmonitor.cpp" line="248"/>
958-
<location filename="processmonitor.cpp" line="301"/>
958+
<location filename="processmonitor.cpp" line="302"/>
959959
<source>未知</source>
960960
<translation>Unknown</translation>
961961
</message>
962962
<message>
963-
<location filename="processmonitor.cpp" line="398"/>
964-
<location filename="processmonitor.cpp" line="409"/>
963+
<location filename="processmonitor.cpp" line="399"/>
964+
<location filename="processmonitor.cpp" line="410"/>
965965
<source>正常</source>
966966
<translation>Normal</translation>
967967
</message>
968968
<message>
969-
<location filename="processmonitor.cpp" line="403"/>
970-
<location filename="processmonitor.cpp" line="414"/>
969+
<location filename="processmonitor.cpp" line="404"/>
970+
<location filename="processmonitor.cpp" line="415"/>
971971
<source>异常退出</source>
972972
<translation>Error Exit</translation>
973973
</message>

OpenSpeedy_zh_CN.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -914,43 +914,43 @@
914914
</message>
915915
<message>
916916
<location filename="processmonitor.cpp" line="236"/>
917-
<location filename="processmonitor.cpp" line="289"/>
917+
<location filename="processmonitor.cpp" line="290"/>
918918
<source>高</source>
919919
<translation type="unfinished"></translation>
920920
</message>
921921
<message>
922922
<location filename="processmonitor.cpp" line="239"/>
923-
<location filename="processmonitor.cpp" line="292"/>
923+
<location filename="processmonitor.cpp" line="293"/>
924924
<source>中</source>
925925
<translation type="unfinished"></translation>
926926
</message>
927927
<message>
928928
<location filename="processmonitor.cpp" line="242"/>
929-
<location filename="processmonitor.cpp" line="295"/>
929+
<location filename="processmonitor.cpp" line="296"/>
930930
<source>低</source>
931931
<translation type="unfinished"></translation>
932932
</message>
933933
<message>
934934
<location filename="processmonitor.cpp" line="245"/>
935-
<location filename="processmonitor.cpp" line="298"/>
935+
<location filename="processmonitor.cpp" line="299"/>
936936
<source>实时</source>
937937
<translation type="unfinished"></translation>
938938
</message>
939939
<message>
940940
<location filename="processmonitor.cpp" line="248"/>
941-
<location filename="processmonitor.cpp" line="301"/>
941+
<location filename="processmonitor.cpp" line="302"/>
942942
<source>未知</source>
943943
<translation type="unfinished"></translation>
944944
</message>
945945
<message>
946-
<location filename="processmonitor.cpp" line="398"/>
947-
<location filename="processmonitor.cpp" line="409"/>
946+
<location filename="processmonitor.cpp" line="399"/>
947+
<location filename="processmonitor.cpp" line="410"/>
948948
<source>正常</source>
949949
<translation type="unfinished"></translation>
950950
</message>
951951
<message>
952-
<location filename="processmonitor.cpp" line="403"/>
953-
<location filename="processmonitor.cpp" line="414"/>
952+
<location filename="processmonitor.cpp" line="404"/>
953+
<location filename="processmonitor.cpp" line="415"/>
954954
<source>异常退出</source>
955955
<translation type="unfinished"></translation>
956956
</message>

OpenSpeedy_zh_TW.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -915,43 +915,43 @@
915915
</message>
916916
<message>
917917
<location filename="processmonitor.cpp" line="236"/>
918-
<location filename="processmonitor.cpp" line="289"/>
918+
<location filename="processmonitor.cpp" line="290"/>
919919
<source>高</source>
920920
<translation>高</translation>
921921
</message>
922922
<message>
923923
<location filename="processmonitor.cpp" line="239"/>
924-
<location filename="processmonitor.cpp" line="292"/>
924+
<location filename="processmonitor.cpp" line="293"/>
925925
<source>中</source>
926926
<translation>中</translation>
927927
</message>
928928
<message>
929929
<location filename="processmonitor.cpp" line="242"/>
930-
<location filename="processmonitor.cpp" line="295"/>
930+
<location filename="processmonitor.cpp" line="296"/>
931931
<source>低</source>
932932
<translation>低</translation>
933933
</message>
934934
<message>
935935
<location filename="processmonitor.cpp" line="245"/>
936-
<location filename="processmonitor.cpp" line="298"/>
936+
<location filename="processmonitor.cpp" line="299"/>
937937
<source>实时</source>
938938
<translation>實時</translation>
939939
</message>
940940
<message>
941941
<location filename="processmonitor.cpp" line="248"/>
942-
<location filename="processmonitor.cpp" line="301"/>
942+
<location filename="processmonitor.cpp" line="302"/>
943943
<source>未知</source>
944944
<translation>未知</translation>
945945
</message>
946946
<message>
947-
<location filename="processmonitor.cpp" line="398"/>
948-
<location filename="processmonitor.cpp" line="409"/>
947+
<location filename="processmonitor.cpp" line="399"/>
948+
<location filename="processmonitor.cpp" line="410"/>
949949
<source>正常</source>
950950
<translation>正常</translation>
951951
</message>
952952
<message>
953-
<location filename="processmonitor.cpp" line="403"/>
954-
<location filename="processmonitor.cpp" line="414"/>
953+
<location filename="processmonitor.cpp" line="404"/>
954+
<location filename="processmonitor.cpp" line="415"/>
955955
<source>异常退出</source>
956956
<translation>異常退出</translation>
957957
</message>

processmonitor.cpp

Lines changed: 58 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@
2727
#include <QtConcurrent/QtConcurrent>
2828
#include <QtWinExtras/QtWin>
2929
#include <psapi.h>
30-
ProcessMonitor::ProcessMonitor(QSettings* settings,
30+
ProcessMonitor::ProcessMonitor(QSettings* settings,
3131
QTreeWidget* treeWidget,
32-
QLabel* treeStatusLabel,
33-
QLabel* injector32StatusLabel,
34-
QLabel* injector64StatusLabel,
35-
QObject* parent)
36-
: m_treeWidget(treeWidget)
37-
, m_treeStatusLabel(treeStatusLabel)
38-
, m_injector32StatusLabel(injector32StatusLabel)
39-
, m_injector64StatusLabel(injector64StatusLabel)
40-
, m_settings(settings)
32+
QLabel* treeStatusLabel,
33+
QLabel* injector32StatusLabel,
34+
QLabel* injector64StatusLabel,
35+
QObject* parent)
36+
: m_treeWidget(treeWidget)
37+
, m_treeStatusLabel(treeStatusLabel)
38+
, m_injector32StatusLabel(injector32StatusLabel)
39+
, m_injector64StatusLabel(injector64StatusLabel)
40+
, m_settings(settings)
4141
{
4242
m_treeWidget->header()->setMinimumHeight(40);
4343
m_treeWidget->setColumnWidth(0, 300);
@@ -80,8 +80,8 @@ ProcessMonitor::refresh()
8080
{
8181
update(processList);
8282
m_treeStatusLabel->setText(QString(tr("搜索到%1个进程, 已过滤展示%2个"))
83-
.arg(processList.size())
84-
.arg(processList.size()));
83+
.arg(processList.size())
84+
.arg(processList.size()));
8585
}
8686
else
8787
{
@@ -93,8 +93,8 @@ ProcessMonitor::refresh()
9393
}
9494
update(filtered);
9595
m_treeStatusLabel->setText(QString(tr("搜索到%1个进程, 已过滤展示%2个"))
96-
.arg(processList.size())
97-
.arg(filtered.size()));
96+
.arg(processList.size())
97+
.arg(filtered.size()));
9898
}
9999
}
100100

@@ -152,7 +152,7 @@ void
152152
ProcessMonitor::init()
153153
{
154154
QStringList targetNames =
155-
m_settings->value(CONFIG_TARGETNAMES_KEY).toStringList();
155+
m_settings->value(CONFIG_TARGETNAMES_KEY).toStringList();
156156
m_targetNames = QSet<QString>(targetNames.begin(), targetNames.end());
157157
}
158158

@@ -232,21 +232,21 @@ ProcessMonitor::update(const QList<ProcessInfo>& processList)
232232
QString priority;
233233
switch (info.priorityClass)
234234
{
235-
case HIGH_PRIORITY_CLASS:
236-
priority = tr("");
237-
break;
238-
case NORMAL_PRIORITY_CLASS:
239-
priority = tr("");
240-
break;
241-
case IDLE_PRIORITY_CLASS:
242-
priority = tr("");
243-
break;
244-
case REALTIME_PRIORITY_CLASS:
245-
priority = tr("实时");
246-
break;
247-
default:
248-
priority = tr("未知");
249-
break;
235+
case HIGH_PRIORITY_CLASS:
236+
priority = tr("");
237+
break;
238+
case NORMAL_PRIORITY_CLASS:
239+
priority = tr("");
240+
break;
241+
case IDLE_PRIORITY_CLASS:
242+
priority = tr("");
243+
break;
244+
case REALTIME_PRIORITY_CLASS:
245+
priority = tr("实时");
246+
break;
247+
default:
248+
priority = tr("未知");
249+
break;
250250
}
251251
item->setText(4, priority);
252252
if (m_targetNames.contains(info.name))
@@ -270,6 +270,7 @@ ProcessMonitor::update(const QList<ProcessInfo>& processList)
270270
QTreeWidgetItem* item = new SortTreeWidgetItem();
271271

272272
item->setText(0, info.name);
273+
item->setData(0, Qt::UserRole, info.name.toLower());
273274
item->setText(1, QString::number(info.pid));
274275
item->setData(1, Qt::UserRole, (long long)info.pid);
275276
item->setText(2,
@@ -285,21 +286,21 @@ ProcessMonitor::update(const QList<ProcessInfo>& processList)
285286
QString priority;
286287
switch (info.priorityClass)
287288
{
288-
case HIGH_PRIORITY_CLASS:
289-
priority = tr("");
290-
break;
291-
case NORMAL_PRIORITY_CLASS:
292-
priority = tr("");
293-
break;
294-
case IDLE_PRIORITY_CLASS:
295-
priority = tr("");
296-
break;
297-
case REALTIME_PRIORITY_CLASS:
298-
priority = tr("实时");
299-
break;
300-
default:
301-
priority = tr("未知");
302-
break;
289+
case HIGH_PRIORITY_CLASS:
290+
priority = tr("");
291+
break;
292+
case NORMAL_PRIORITY_CLASS:
293+
priority = tr("");
294+
break;
295+
case IDLE_PRIORITY_CLASS:
296+
priority = tr("");
297+
break;
298+
case REALTIME_PRIORITY_CLASS:
299+
priority = tr("实时");
300+
break;
301+
default:
302+
priority = tr("未知");
303+
break;
303304
}
304305
item->setText(4, priority);
305306
item->setCheckState(5, Qt::Unchecked);
@@ -359,10 +360,10 @@ ProcessMonitor::startBridge32()
359360
connect(m_bridge32,
360361
&QProcess::readyReadStandardOutput,
361362
[&]()
362-
{
363-
QByteArray data = m_bridge32->readAllStandardOutput();
364-
qDebug() << "收到输出:" << QString(data).trimmed();
365-
});
363+
{
364+
QByteArray data = m_bridge32->readAllStandardOutput();
365+
qDebug() << "收到输出:" << QString(data).trimmed();
366+
});
366367
}
367368

368369
void
@@ -383,10 +384,10 @@ ProcessMonitor::startBridge64()
383384
connect(m_bridge64,
384385
&QProcess::readyReadStandardOutput,
385386
[&]()
386-
{
387-
QByteArray data = m_bridge64->readAllStandardOutput();
388-
qDebug() << "收到输出:" << QString(data).trimmed();
389-
});
387+
{
388+
QByteArray data = m_bridge64->readAllStandardOutput();
389+
qDebug() << "收到输出:" << QString(data).trimmed();
390+
});
390391
}
391392

392393
void
@@ -463,7 +464,7 @@ ProcessMonitor::getDefaultIcon(const QString& processName)
463464
&sfi,
464465
sizeof(SHFILEINFO),
465466
SHGFI_USEFILEATTRIBUTES | SHGFI_ICON |
466-
SHGFI_SMALLICON))
467+
SHGFI_SMALLICON))
467468
{
468469
// 将HICON转换为QIcon
469470
icon = QtWin::fromHICON(sfi.hIcon);
@@ -483,7 +484,7 @@ ProcessMonitor::getDefaultIcon(const QString& processName)
483484
&sfi,
484485
sizeof(SHFILEINFO),
485486
SHGFI_USEFILEATTRIBUTES | SHGFI_ICON |
486-
SHGFI_SMALLICON))
487+
SHGFI_SMALLICON))
487488
{
488489
// 将HICON转换为QIcon
489490
icon = QtWin::fromHICON(sfi.hIcon);
@@ -499,7 +500,7 @@ QIcon
499500
ProcessMonitor::getProcessIcon(QString processPath)
500501
{
501502
int lastSlashPos =
502-
std::max(processPath.lastIndexOf('/'), processPath.lastIndexOf('\\'));
503+
std::max(processPath.lastIndexOf('/'), processPath.lastIndexOf('\\'));
503504
QString processName;
504505
if (lastSlashPos == -1)
505506
{
@@ -533,7 +534,7 @@ ProcessMonitor::getProcessIcon(QString processPath)
533534
}
534535

535536
HICON hIcon =
536-
ExtractIconW(nullptr, reinterpret_cast<LPCWSTR>(processPath.utf16()), 0);
537+
ExtractIconW(nullptr, reinterpret_cast<LPCWSTR>(processPath.utf16()), 0);
537538
if (hIcon)
538539
{
539540
QIcon icon = QtWin::fromHICON(hIcon);

0 commit comments

Comments
 (0)