git-svn-id: svn://db.shs.com.ru/libs@558 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -3,9 +3,11 @@
|
|||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <qpiconfig.h>
|
#include <qpiconfig.h>
|
||||||
#include <evalspinbox.h>
|
#include <evalspinbox.h>
|
||||||
|
#include <piintrospection_server.h>
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char * argv[]) {
|
int main(int argc, char * argv[]) {
|
||||||
|
PIINTROSPECTION_START
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
a.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
|
a.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
project(piintrospector)
|
project(piintrospector)
|
||||||
file(GLOB SRC "*.h" "*.cpp" "*.ui" "*.qrc" "lang/*.ts")
|
file(GLOB SRC "*.h" "*.cpp" "*.ui" "*.qrc" "lang/*.ts")
|
||||||
|
pip_code_model(CCM "../../pip/src_main/introspection/piintrospection_server_p.h" OPTIONS "-DPIP_EXPORT" "-Es")
|
||||||
find_qt(${QtVersions} Core Gui)
|
find_qt(${QtVersions} Core Gui)
|
||||||
qt_wrap(${SRC} HDRS out_HDR CPPS out_CPP QMS out_QM)
|
qt_wrap(${SRC} HDRS out_HDR CPPS out_CPP QMS out_QM)
|
||||||
qt_add_executable(${PROJECT_NAME} WIN32 out_CPP)
|
qt_add_executable(${PROJECT_NAME} WIN32 out_CPP CCM)
|
||||||
qt_target_link_libraries(${PROJECT_NAME} pip qad_utils qad_widgets qad_application piqt_utils)
|
qt_target_link_libraries(${PROJECT_NAME} pip qad_utils qad_widgets qad_application piqt_utils)
|
||||||
message(STATUS "Building ${PROJECT_NAME}")
|
message(STATUS "Building ${PROJECT_NAME}")
|
||||||
if(LIB)
|
if(LIB)
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
#include "piintrospector.h"
|
#include "piintrospector.h"
|
||||||
|
#include <QClipboard>
|
||||||
|
#include <QScrollBar>
|
||||||
#include "pifile.h"
|
#include "pifile.h"
|
||||||
#include "pitime.h"
|
#include "pitime.h"
|
||||||
#include "pidir.h"
|
#include "pidir.h"
|
||||||
#include "pichunkstream.h"
|
#include "pichunkstream.h"
|
||||||
#include <QClipboard>
|
#include "ccm_piintrospector.h"
|
||||||
#include <QScrollBar>
|
|
||||||
|
|
||||||
#include <cxxabi.h>
|
#include <cxxabi.h>
|
||||||
const QString demangle(const char * name) {
|
const QString demangle(const char * name) {
|
||||||
@@ -34,6 +35,7 @@ enum ColumnObjects {
|
|||||||
|
|
||||||
QPIIntrospector::QPIIntrospector(QWidget * parent): EMainWindow(parent), peer("__introspection_client__") {
|
QPIIntrospector::QPIIntrospector(QWidget * parent): EMainWindow(parent), peer("__introspection_client__") {
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
request_timer = 0;
|
||||||
session.setFile("qpiintrospector_session.conf");
|
session.setFile("qpiintrospector_session.conf");
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
//treeContainers->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
//treeContainers->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||||
@@ -46,6 +48,14 @@ QPIIntrospector::QPIIntrospector(QWidget * parent): EMainWindow(parent), peer("_
|
|||||||
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);
|
||||||
|
PICodeInfo::EnumInfo * ei = PICodeInfo::enumsInfo->value("PIIntrospection::InfoTypes");
|
||||||
|
if (ei) {
|
||||||
|
piForeachC (PICodeInfo::EnumeratorInfo & e, ei->members) {
|
||||||
|
QCheckBox * cb = new QCheckBox(PI2QString(e.name.mid(2)));
|
||||||
|
cb->setProperty("__value__", e.value);
|
||||||
|
layoutRequestFlags->addWidget(cb);
|
||||||
|
}
|
||||||
|
}
|
||||||
//startTimer(100);
|
//startTimer(100);
|
||||||
session.addEntry(this);
|
session.addEntry(this);
|
||||||
session.load();
|
session.load();
|
||||||
@@ -71,7 +81,9 @@ void QPIIntrospector::changeEvent(QEvent * e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QPIIntrospector::timerEvent(QTimerEvent * ) {
|
void QPIIntrospector::timerEvent(QTimerEvent * e) {
|
||||||
|
if (e->timerId() == request_timer)
|
||||||
|
buttonRequest->click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -88,6 +100,14 @@ void QPIIntrospector::buildTree(QByteArray d) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void QPIIntrospector::procRequestTimer() {
|
||||||
|
if (request_timer != 0) killTimer(request_timer);
|
||||||
|
request_timer = 0;
|
||||||
|
if (!checkRequestTimer->isChecked()) return;
|
||||||
|
request_timer = startTimer(1000 / spinRequestTimerHz->value());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void QPIIntrospector::buildDumpSection(QTreeWidgetItem * pi, PIString & str) {
|
void QPIIntrospector::buildDumpSection(QTreeWidgetItem * pi, PIString & str) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,3 +223,18 @@ void QPIIntrospector::peersChanged(const PIString & name) {
|
|||||||
peer.unlock();
|
peer.unlock();
|
||||||
listApp->blockSignals(false);
|
listApp->blockSignals(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void QPIIntrospector::on_buttonRequest_clicked() {
|
||||||
|
if (cur_server.isEmpty()) return;
|
||||||
|
PIIntrospection::RequiredInfo info;
|
||||||
|
for (int i = 0; i < layoutRequestFlags->count(); ++i) {
|
||||||
|
QCheckBox * cb = qobject_cast<QCheckBox*>(layoutRequestFlags->itemAt(i)->widget());
|
||||||
|
if (!cb) continue;
|
||||||
|
if (!cb->isChecked()) continue;
|
||||||
|
info.types |= cb->property("__value__").toInt();
|
||||||
|
}
|
||||||
|
PIByteArray ba;
|
||||||
|
ba << PIIntrospection::sign << info;
|
||||||
|
peer.send(cur_server, ba);
|
||||||
|
}
|
||||||
|
|||||||
@@ -35,11 +35,14 @@ protected:
|
|||||||
|
|
||||||
PIString cur_server;
|
PIString cur_server;
|
||||||
PIPeer peer;
|
PIPeer peer;
|
||||||
|
int request_timer;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void procPIEvents() {callQueuedEvents();}
|
void procPIEvents() {callQueuedEvents();}
|
||||||
void buildTree(QByteArray d);
|
void buildTree(QByteArray d);
|
||||||
|
void procRequestTimer();
|
||||||
void on_listApp_currentRowChanged(int r);
|
void on_listApp_currentRowChanged(int r);
|
||||||
|
void on_buttonRequest_clicked();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,85 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
|
<property name="title">
|
||||||
|
<string>Request</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="widgetRequestFlags" native="true">
|
||||||
|
<layout class="QVBoxLayout" name="layoutRequestFlags">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="buttonRequest">
|
||||||
|
<property name="text">
|
||||||
|
<string>Request</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkRequestTimer">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Timer</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDoubleSpinBox" name="spinRequestTimerHz">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="suffix">
|
||||||
|
<string> Hz</string>
|
||||||
|
</property>
|
||||||
|
<property name="decimals">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<double>0.010000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>1000.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<double>0.500000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<double>1.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="layoutWidget">
|
<widget class="QWidget" name="layoutWidget">
|
||||||
@@ -199,9 +278,41 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>checkRequestTimer</sender>
|
||||||
|
<signal>toggled(bool)</signal>
|
||||||
|
<receiver>QPIIntrospector</receiver>
|
||||||
|
<slot>procRequestTimer()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>65</x>
|
||||||
|
<y>552</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>6</x>
|
||||||
|
<y>546</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>spinRequestTimerHz</sender>
|
||||||
|
<signal>valueChanged(double)</signal>
|
||||||
|
<receiver>QPIIntrospector</receiver>
|
||||||
|
<slot>procRequestTimer()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>150</x>
|
||||||
|
<y>552</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>140</x>
|
||||||
|
<y>605</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
<slots>
|
<slots>
|
||||||
<slot>configChanged()</slot>
|
<slot>procRequestTimer()</slot>
|
||||||
<slot>updateMap()</slot>
|
|
||||||
</slots>
|
</slots>
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
@@ -41,7 +41,10 @@ ConnectionEdit::ConnectionEdit(QWidget * parent): QDialog(parent) {
|
|||||||
|
|
||||||
|
|
||||||
ConnectionEdit::~ConnectionEdit() {
|
ConnectionEdit::~ConnectionEdit() {
|
||||||
if (conn) delete conn;
|
if (conn) {
|
||||||
|
conn->stop();
|
||||||
|
delete conn;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user