git-svn-id: svn://db.shs.com.ru/libs@83 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -5,9 +5,11 @@
|
||||
#include <QClipboard>
|
||||
|
||||
|
||||
QPIIntrospector::QPIIntrospector(QWidget * parent): QMainWindow(parent) {
|
||||
QPIIntrospector::QPIIntrospector(QWidget * parent): QMainWindow(parent), peer("__introspection_client__") {
|
||||
setupUi(this);
|
||||
tree->header()->setResizeMode(QHeaderView::ResizeToContents);
|
||||
CONNECTU(&peer, dataReceivedEvent, this, peerReceived)
|
||||
startTimer(100);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,9 +25,55 @@ void QPIIntrospector::changeEvent(QEvent * e) {
|
||||
}
|
||||
|
||||
|
||||
void QPIIntrospector::buildDump() {
|
||||
void QPIIntrospector::timerEvent(QTimerEvent * ) {
|
||||
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 == cs)
|
||||
listApp->setCurrentRow(listApp->count() - 1);
|
||||
}
|
||||
peer.unlock();
|
||||
listApp->blockSignals(false);
|
||||
}
|
||||
|
||||
|
||||
void QPIIntrospector::buildTree(QByteArray d) {
|
||||
PIVector<PIIntrospectionThreads::ThreadInfo> threads;
|
||||
PIByteArray pd = Q2PIByteArray(d);
|
||||
pd >> threads;
|
||||
tree->clear();
|
||||
piForeachC (PIIntrospectionThreads::ThreadInfo & t, threads) {
|
||||
QTreeWidgetItem * ti = new QTreeWidgetItem();
|
||||
ti->setText(0, QString(PI2QString(t.name) + " (%1)").arg(t.id));
|
||||
tree->addTopLevelItem(ti);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void QPIIntrospector::buildDumpSection(QTreeWidgetItem * pi, PIString & str) {
|
||||
}
|
||||
|
||||
|
||||
void QPIIntrospector::on_listApp_currentRowChanged(int r) {
|
||||
if (r < 0) cur_server.clear();
|
||||
else cur_server = Q2PIString(listApp->item(r)->text());
|
||||
}
|
||||
|
||||
|
||||
void QPIIntrospector::peerReceived(const PIString & from, const PIByteArray & data) {
|
||||
if (from != cur_server) return;
|
||||
PIString appname;
|
||||
PIIntrospectionContainers cont;
|
||||
PIByteArray ba(data);
|
||||
ba >> appname >> cont;// >> threads.threads;
|
||||
QMetaObject::invokeMethod(labelAppname, "setText", Qt::QueuedConnection, Q_ARG(QString, PI2QString(appname)));
|
||||
QMetaObject::invokeMethod(labelCount, "setText", Qt::QueuedConnection, Q_ARG(QString, QString::number(cont.count)));
|
||||
QMetaObject::invokeMethod(labelAlloc, "setText", Qt::QueuedConnection, Q_ARG(QString, PI2QString(PIString::readableSize(cont.bytes_allocated))));
|
||||
QMetaObject::invokeMethod(labelUsed, "setText", Qt::QueuedConnection, Q_ARG(QString, PI2QString(PIString::readableSize(cont.bytes_used))));
|
||||
QMetaObject::invokeMethod(this, "buildTree", Qt::QueuedConnection, Q_ARG(QByteArray, PI2QByteArray(ba)));
|
||||
//piCout << appname;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user