piintrospector fixes
This commit is contained in:
@@ -20,9 +20,9 @@ QPIIntrospector::QPIIntrospector(QWidget * parent): EMainWindow(parent), peer("_
|
||||
CONNECTU_QUEUED(&peer, peerConnectedEvent, this, peersChanged, this);
|
||||
CONNECTU_QUEUED(&peer, peerDisconnectedEvent, this, peersChanged, this);
|
||||
CONNECTU_QUEUED(&peer, dataReceivedEvent, this, peerReceived, this);
|
||||
CONNECTU(&peer, peerConnectedEvent, this, reqProcPIEvents);
|
||||
CONNECTU(&peer, peerDisconnectedEvent, this, reqProcPIEvents);
|
||||
CONNECTU(&peer, dataReceivedEvent, this, reqProcPIEvents);
|
||||
//CONNECTU(&peer, peerConnectedEvent, this, reqProcPIEvents);
|
||||
//CONNECTU(&peer, peerDisconnectedEvent, this, reqProcPIEvents);
|
||||
//CONNECTU(&peer, dataReceivedEvent, this, reqProcPIEvents);
|
||||
session.addEntry(this);
|
||||
session.addEntry(tabWidgetMain);
|
||||
PICodeInfo::EnumInfo * ei = PICodeInfo::enumsInfo->value("PIIntrospection::InfoTypes");
|
||||
@@ -35,7 +35,7 @@ QPIIntrospector::QPIIntrospector(QWidget * parent): EMainWindow(parent), peer("_
|
||||
session.addEntry(cb);
|
||||
}
|
||||
}
|
||||
//startTimer(100);
|
||||
pip_timer = startTimer(10);
|
||||
session.load();
|
||||
peer.start();
|
||||
}
|
||||
@@ -59,6 +59,8 @@ void QPIIntrospector::changeEvent(QEvent * e) {
|
||||
|
||||
|
||||
void QPIIntrospector::timerEvent(QTimerEvent * e) {
|
||||
if (e->timerId() == pip_timer)
|
||||
callQueuedEvents();
|
||||
if (e->timerId() == request_timer)
|
||||
buttonRequest->click();
|
||||
}
|
||||
@@ -158,7 +160,7 @@ QString QPIIntrospector::durationStr(PISystemTime t) {
|
||||
void QPIIntrospector::on_listApp_currentRowChanged(int r) {
|
||||
PIString cs;
|
||||
if (r < 0) cs.clear();
|
||||
else cs = Q2PIString(listApp->item(r)->text());
|
||||
else cs = Q2PIString(listApp->item(r)->data(Qt::UserRole).toString());
|
||||
if (cur_server != cs)
|
||||
widgetContainers->clear();
|
||||
cur_server = cs;
|
||||
@@ -172,34 +174,37 @@ void QPIIntrospector::peerReceived(const PIString & from, const PIByteArray & da
|
||||
if (ba.size_s() < 4) return;
|
||||
uint sign(0); ba >> sign;
|
||||
if (sign != PIIntrospection::sign) return;
|
||||
int cnt = 0;
|
||||
ba >> cnt;
|
||||
piCout << cnt << ba.size();
|
||||
PIChunkStream cs(ba);
|
||||
PIByteArray pba;
|
||||
while (!cs.atEnd()) {
|
||||
switch (cs.read()) {
|
||||
case PIIntrospection::itInfo: {
|
||||
cs.get(pba);
|
||||
pba.clear(); cs.get(pba);
|
||||
PIIntrospection::unpackInfo(pba, info);
|
||||
} break;
|
||||
case PIIntrospection::itProcStat: {
|
||||
cs.get(pba);
|
||||
pba.clear(); cs.get(pba);
|
||||
PIIntrospection::unpackProcStat(pba, stat);
|
||||
widgetThreads->setStat(stat.threads);
|
||||
//showInfo(info);
|
||||
} break;
|
||||
case PIIntrospection::itContainers: {
|
||||
cs.get(pba);
|
||||
pba.clear(); cs.get(pba);
|
||||
PIVector<PIIntrospectionContainers::TypeInfo> data;
|
||||
PIIntrospection::unpackContainers(pba, data);
|
||||
widgetContainers->showContainers(data);
|
||||
} break;
|
||||
case PIIntrospection::itObjects: {
|
||||
cs.get(pba);
|
||||
pba.clear(); cs.get(pba);
|
||||
PIVector<PIIntrospection::ObjectInfo> objects;
|
||||
PIIntrospection::unpackObjects(pba, objects);
|
||||
widgetObjects->showObjects(objects);
|
||||
} break;
|
||||
case PIIntrospection::itThreads: {
|
||||
cs.get(pba);
|
||||
pba.clear(); cs.get(pba);
|
||||
PIVector<PIIntrospectionThreads::ThreadInfo> threads;
|
||||
PIIntrospection::unpackThreads(pba, threads);
|
||||
widgetThreads->showThreads(threads);
|
||||
@@ -212,13 +217,17 @@ void QPIIntrospector::peerReceived(const PIString & from, const PIByteArray & da
|
||||
|
||||
|
||||
void QPIIntrospector::peersChanged(const PIString & name) {
|
||||
static QString tag = "__introspection__server_";
|
||||
listApp->blockSignals(true);
|
||||
QString cs = listApp->currentItem() ? listApp->currentItem()->text() : "";
|
||||
listApp->clear();
|
||||
peer.lock();
|
||||
piForeachC (PIPeer::PeerInfo & p, peer.allPeers()) {
|
||||
QString pn = PI2QString(p.name);
|
||||
listApp->addItem(pn);
|
||||
if (!pn.contains(tag)) continue;
|
||||
QListWidgetItem * li = new QListWidgetItem(pn.left(pn.indexOf(tag)));
|
||||
li->setData(Qt::UserRole, pn);
|
||||
listApp->addItem(li);
|
||||
if (pn == cs)
|
||||
listApp->setCurrentRow(listApp->count() - 1);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@ protected:
|
||||
|
||||
void buildDumpSection(QTreeWidgetItem * pi, PIString & str);
|
||||
void showInfo();
|
||||
EVENT_HANDLER(void, reqProcPIEvents) {QMetaObject::invokeMethod(this, "procPIEvents", Qt::QueuedConnection);}
|
||||
QString durationStr(PISystemTime t);
|
||||
|
||||
EVENT_HANDLER2(void, peerReceived, const PIString &, from, const PIByteArray &, data);
|
||||
@@ -36,10 +35,9 @@ protected:
|
||||
PIIntrospection::ProcessInfo info;
|
||||
PIIntrospection::ProcessStat stat;
|
||||
PIPeer peer;
|
||||
int request_timer;
|
||||
int request_timer, pip_timer;
|
||||
|
||||
private slots:
|
||||
void procPIEvents() {callQueuedEvents();}
|
||||
void buildTree(QByteArray d);
|
||||
void procRequestTimer();
|
||||
void on_listApp_currentRowChanged(int r);
|
||||
|
||||
Reference in New Issue
Block a user