Merge branch 'master' of https://git.shs.tools/SHS/qad
This commit is contained in:
@@ -34,8 +34,8 @@ void ContainersModel::update(const PIVector<PIIntrospectionContainers::TypeInfo>
|
|||||||
}
|
}
|
||||||
piForeachC (PIIntrospectionContainers::TypeInfo & i, t) {
|
piForeachC (PIIntrospectionContainers::TypeInfo & i, t) {
|
||||||
all[ccCount] += i.count;
|
all[ccCount] += i.count;
|
||||||
all[ccBytesAllocated] += i.allocated * i.item_size;
|
all[ccBytesAllocated] += i.allocated_bytes;
|
||||||
all[ccBytesUsed] += i.used * i.item_size;
|
all[ccBytesUsed] += i.used_bytes;
|
||||||
}
|
}
|
||||||
int pts = cur_data.size_s();
|
int pts = cur_data.size_s();
|
||||||
cur_data = t;
|
cur_data = t;
|
||||||
@@ -112,22 +112,20 @@ QVariant ContainersModel::data(const QModelIndex & index, int role) const {
|
|||||||
case ccType: return PI2QString(t.name);
|
case ccType: return PI2QString(t.name);
|
||||||
case ccItemSize:
|
case ccItemSize:
|
||||||
if (role == Qt::UserRole) return t.item_size;
|
if (role == Qt::UserRole) return t.item_size;
|
||||||
return PI2QString(PIString::readableSize(t.item_size));
|
return PI2QString(t.item_size_str);
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
if (mode_changes) {
|
if (mode_changes) {
|
||||||
switch (index.column()) {
|
switch (index.column()) {
|
||||||
case ccCount: return int(t.count) - int(prev_data.value(id).count);
|
case ccCount: return int(t.count) - int(prev_data.value(id).count);
|
||||||
case ccBytesAllocated:
|
case ccBytesAllocated:
|
||||||
v = t.allocated;
|
v = t.allocated_bytes;
|
||||||
v -= prev_data.value(id).allocated;
|
v -= prev_data.value(id).allocated_bytes;
|
||||||
v *= t.item_size;
|
|
||||||
if (role == Qt::UserRole) return piAbs(v);
|
if (role == Qt::UserRole) return piAbs(v);
|
||||||
return PI2QString(PIString::readableSize(v));
|
return PI2QString(PIString::readableSize(v));
|
||||||
case ccBytesUsed:
|
case ccBytesUsed:
|
||||||
v = t.used;
|
v = t.used_bytes;
|
||||||
v -= prev_data.value(id).used;
|
v -= prev_data.value(id).used_bytes;
|
||||||
v *= t.item_size;
|
|
||||||
if (role == Qt::UserRole) return piAbs(v);
|
if (role == Qt::UserRole) return piAbs(v);
|
||||||
return PI2QString(PIString::readableSize(v));
|
return PI2QString(PIString::readableSize(v));
|
||||||
}
|
}
|
||||||
@@ -135,13 +133,11 @@ QVariant ContainersModel::data(const QModelIndex & index, int role) const {
|
|||||||
switch (index.column()) {
|
switch (index.column()) {
|
||||||
case ccCount: return t.count;
|
case ccCount: return t.count;
|
||||||
case ccBytesAllocated:
|
case ccBytesAllocated:
|
||||||
v = t.allocated * t.item_size;
|
if (role == Qt::UserRole) return t.allocated_bytes;
|
||||||
if (role == Qt::UserRole) return v;
|
return PI2QString(t.allocated_str);
|
||||||
return PI2QString(PIString::readableSize(v));
|
|
||||||
case ccBytesUsed:
|
case ccBytesUsed:
|
||||||
v = t.used * t.item_size;
|
if (role == Qt::UserRole) return t.used_bytes;
|
||||||
if (role == Qt::UserRole) return v;
|
return PI2QString(t.used_str);
|
||||||
return PI2QString(PIString::readableSize(v));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -191,8 +187,8 @@ int cmp_func_name_d(const PIIntrospectionContainers::TypeInfo * t0, const PIIntr
|
|||||||
#endif
|
#endif
|
||||||
CMP_FUNC(item_size)
|
CMP_FUNC(item_size)
|
||||||
CMP_FUNC(count)
|
CMP_FUNC(count)
|
||||||
CMP_FUNC(allocated)
|
CMP_FUNC(allocated_bytes)
|
||||||
CMP_FUNC(used)
|
CMP_FUNC(used_bytes)
|
||||||
#undef CMP_FUNC
|
#undef CMP_FUNC
|
||||||
void ContainersModel::sort(int column, Qt::SortOrder order) {
|
void ContainersModel::sort(int column, Qt::SortOrder order) {
|
||||||
ls_column = column;
|
ls_column = column;
|
||||||
@@ -204,11 +200,12 @@ void ContainersModel::sort(int column, Qt::SortOrder order) {
|
|||||||
case ccType : cf = order == Qt::AscendingOrder ? cmp_func_name_a : cmp_func_name_d ; pf = print_func_name; break;
|
case ccType : cf = order == Qt::AscendingOrder ? cmp_func_name_a : cmp_func_name_d ; pf = print_func_name; break;
|
||||||
case ccItemSize : cf = order == Qt::AscendingOrder ? cmp_func_item_size_a : cmp_func_item_size_d; pf = print_func_item_size; break;
|
case ccItemSize : cf = order == Qt::AscendingOrder ? cmp_func_item_size_a : cmp_func_item_size_d; pf = print_func_item_size; break;
|
||||||
case ccCount : cf = order == Qt::AscendingOrder ? cmp_func_count_a : cmp_func_count_d ; pf = print_func_count; break;
|
case ccCount : cf = order == Qt::AscendingOrder ? cmp_func_count_a : cmp_func_count_d ; pf = print_func_count; break;
|
||||||
case ccBytesAllocated: cf = order == Qt::AscendingOrder ? cmp_func_allocated_a : cmp_func_allocated_d; pf = print_func_allocated; break;
|
case ccBytesAllocated: cf = order == Qt::AscendingOrder ? cmp_func_allocated_bytes_a : cmp_func_allocated_bytes_d; pf = print_func_allocated_bytes; break;
|
||||||
case ccBytesUsed : cf = order == Qt::AscendingOrder ? cmp_func_used_a : cmp_func_used_d ; pf = print_func_used; break;
|
case ccBytesUsed : cf = order == Qt::AscendingOrder ? cmp_func_used_bytes_a : cmp_func_used_bytes_d ; pf = print_func_used_bytes; break;
|
||||||
default : break;
|
default : break;
|
||||||
}
|
}
|
||||||
if (cf) {
|
if (cf) {
|
||||||
|
qDebug() << "\nsrc" << column << order;
|
||||||
cur_data.forEach(pf);
|
cur_data.forEach(pf);
|
||||||
cur_data.sort(cf);
|
cur_data.sort(cf);
|
||||||
qDebug() << "sort" << column << order;
|
qDebug() << "sort" << column << order;
|
||||||
|
|||||||
@@ -157,6 +157,17 @@ QString QPIIntrospector::durationStr(PISystemTime t) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void QPIIntrospector::prepareContainers(PIVector<PIIntrospectionContainers::TypeInfo> & data) {
|
||||||
|
for (PIIntrospectionContainers::TypeInfo & i: data) {
|
||||||
|
i.allocated_bytes = i.allocated * i.item_size;
|
||||||
|
i.used_bytes = i.used * i.item_size;
|
||||||
|
i.item_size_str.setReadableSize(i.item_size);
|
||||||
|
i.allocated_str.setReadableSize(i.allocated_bytes);
|
||||||
|
i.used_str.setReadableSize(i.used_bytes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void QPIIntrospector::on_listApp_currentRowChanged(int r) {
|
void QPIIntrospector::on_listApp_currentRowChanged(int r) {
|
||||||
PIString cs;
|
PIString cs;
|
||||||
if (r < 0) cs.clear();
|
if (r < 0) cs.clear();
|
||||||
@@ -192,6 +203,7 @@ void QPIIntrospector::peerReceived(const PIString & from, const PIByteArray & da
|
|||||||
pba.clear(); cs.get(pba);
|
pba.clear(); cs.get(pba);
|
||||||
PIVector<PIIntrospectionContainers::TypeInfo> data;
|
PIVector<PIIntrospectionContainers::TypeInfo> data;
|
||||||
PIIntrospection::unpackContainers(pba, data);
|
PIIntrospection::unpackContainers(pba, data);
|
||||||
|
prepareContainers(data);
|
||||||
widgetContainers->showContainers(data);
|
widgetContainers->showContainers(data);
|
||||||
} break;
|
} break;
|
||||||
case PIIntrospection::itObjects: {
|
case PIIntrospection::itObjects: {
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ protected:
|
|||||||
void buildDumpSection(QTreeWidgetItem * pi, PIString & str);
|
void buildDumpSection(QTreeWidgetItem * pi, PIString & str);
|
||||||
void showInfo();
|
void showInfo();
|
||||||
QString durationStr(PISystemTime t);
|
QString durationStr(PISystemTime t);
|
||||||
|
void prepareContainers(PIVector<PIIntrospectionContainers::TypeInfo> & data);
|
||||||
|
|
||||||
EVENT_HANDLER2(void, peerReceived, const PIString &, from, const PIByteArray &, data);
|
EVENT_HANDLER2(void, peerReceived, const PIString &, from, const PIByteArray &, data);
|
||||||
EVENT_HANDLER1(void, peersChanged, const PIString &, name);
|
EVENT_HANDLER1(void, peersChanged, const PIString &, name);
|
||||||
|
|||||||
Reference in New Issue
Block a user