fix: column index desync after reorder
This commit is contained in:
@@ -75,6 +75,16 @@ class ProcessModel : public QAbstractListModel {
|
||||
void sortAscendingChanged();
|
||||
|
||||
private:
|
||||
struct FuzzyCacheEntry {
|
||||
quint64 starttime = 0;
|
||||
QString command;
|
||||
QString commandChars;
|
||||
QVector<quint8> commandClasses;
|
||||
QString commandLineChars;
|
||||
QVector<quint8> commandLineClasses;
|
||||
bool hasCommandLine = false;
|
||||
};
|
||||
|
||||
struct RawStat {
|
||||
pid_t pid = 0;
|
||||
pid_t ppid = 0;
|
||||
@@ -116,6 +126,18 @@ class ProcessModel : public QAbstractListModel {
|
||||
quint64 writeBytes = 0;
|
||||
};
|
||||
|
||||
struct ScanContext {
|
||||
double uptime = 0.0;
|
||||
double deltaSecs = -1.0;
|
||||
const QHash<pid_t, int>* prevPidToAll = nullptr;
|
||||
const QVector<ProcessEntry>* prevAll = nullptr;
|
||||
long clockTicksPerSec = 100;
|
||||
const QHash<QString, QString>* execPathToIcon = nullptr;
|
||||
const QHash<QString, QString>* execNameToIcon = nullptr;
|
||||
bool iconsChanged = false;
|
||||
uid_t selfEuid = 0;
|
||||
};
|
||||
|
||||
struct ScanResult {
|
||||
QVector<ProcessEntry> entries;
|
||||
QHash<uid_t, QString> newUidNames;
|
||||
@@ -130,6 +152,12 @@ class ProcessModel : public QAbstractListModel {
|
||||
static QString resolveUsername(uid_t uid, QHash<uid_t, QString>& cache);
|
||||
static QString resolveProcessExe(pid_t pid);
|
||||
|
||||
static void scanChunk(
|
||||
const ScanContext& ctx,
|
||||
const QVector<pid_t>& pids,
|
||||
QVector<ProcessEntry>& out,
|
||||
QHash<uid_t, QString>& uidCache);
|
||||
|
||||
static ScanResult scanProcesses(
|
||||
double uptime,
|
||||
double deltaSecs,
|
||||
@@ -153,6 +181,7 @@ class ProcessModel : public QAbstractListModel {
|
||||
|
||||
QVector<ProcessEntry> mAll;
|
||||
QHash<pid_t, int> mPidToAll;
|
||||
QHash<pid_t, FuzzyCacheEntry> mFuzzyCache;
|
||||
|
||||
QVector<ProcessEntry> mProcesses;
|
||||
QHash<uid_t, QString> mUidToName;
|
||||
|
||||
Reference in New Issue
Block a user