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