remove pidumper, new SHSTKMacros
This commit is contained in:
@@ -27,7 +27,7 @@ endif()
|
||||
|
||||
shstk_is_parent_exists(hasParent PARENT_DIRECTORY)
|
||||
|
||||
shstk_set_find_dirs(qad)
|
||||
shstk_set_find_dirs(qad QAD)
|
||||
set(_SEARCH_DIR ${qad_LIBDIR})
|
||||
|
||||
qad_find_qt(Core QUIET)
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
find_package(PIP)
|
||||
if (PIP_FOUND)
|
||||
|
||||
project(pidumper)
|
||||
if(APPLE)
|
||||
set(APP_ICON "")
|
||||
elseif(WIN32)
|
||||
set(APP_ICON "")
|
||||
else()
|
||||
set(APP_ICON "")
|
||||
endif()
|
||||
set(APP_INFO "PIConnection GUI editor")
|
||||
qad_application(pidumper "Gui;Widgets" "qad_utils;qad_widgets;qad_piqt_utils")
|
||||
|
||||
endif()
|
||||
@@ -1,146 +0,0 @@
|
||||
#include "pidumper.h"
|
||||
#include "pifile.h"
|
||||
#include "pitime.h"
|
||||
#include "pidir.h"
|
||||
//#include "ccm.h"
|
||||
#include <QClipboard>
|
||||
#ifdef CC_GCC
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
PIDumper::PIDumper(QWidget * parent): QMainWindow(parent) {
|
||||
setupUi(this);
|
||||
#if QT_VERSION >= 0x050000
|
||||
treeDump->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||
#else
|
||||
treeDump->header()->setResizeMode(QHeaderView::ResizeToContents);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void PIDumper::changeEvent(QEvent * e) {
|
||||
QMainWindow::changeEvent(e);
|
||||
switch (e->type()) {
|
||||
case QEvent::LanguageChange:
|
||||
retranslateUi(this);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PIDumper::buildDump() {
|
||||
treeDump->clear();
|
||||
if (!dump.contains('{')) return;
|
||||
PIString app = dump.takeWord();
|
||||
if (app != "application") return;
|
||||
dump.takeLine();
|
||||
QTreeWidgetItem * ti;
|
||||
while (!dump.isEmpty()) {
|
||||
PIString line = dump.takeLine();
|
||||
if (line.contains('{')) {
|
||||
ti = new QTreeWidgetItem();
|
||||
dump.prepend(line + "\n");
|
||||
buildDumpSection(ti, dump);
|
||||
treeDump->addTopLevelItem(ti);
|
||||
continue;
|
||||
}
|
||||
int colon = line.find(":");
|
||||
if (colon < 0) continue;
|
||||
PIString name = line.takeLeft(colon).trim();
|
||||
PIString value = line.cutLeft(1).trim();
|
||||
if (value.startsWith("\"")) value.cutLeft(1);
|
||||
if (value.endsWith("\"")) value.cutRight(1);
|
||||
ti = new QTreeWidgetItem(QStringList() << PI2QString(name) << PI2QString(value));
|
||||
treeDump->addTopLevelItem(ti);
|
||||
}
|
||||
on_checkDumpHideService_toggled(checkDumpHideService->isChecked());
|
||||
}
|
||||
|
||||
|
||||
void PIDumper::buildDumpSection(QTreeWidgetItem * pi, PIString & str) {
|
||||
PIString section = str.takeLeft(str.find("{")).trim();
|
||||
PIString value;
|
||||
if (section.contains('(')) {
|
||||
value = section;
|
||||
section = value.takeLeft(value.find('('));
|
||||
value = value.takeRange("(", ")");
|
||||
}
|
||||
pi->setText(0, piqt(section));
|
||||
pi->setText(1, piqt(value));
|
||||
//if (section == "PIObjects")
|
||||
PIString range = str.takeRange("{", "}");
|
||||
QTreeWidgetItem * ti;
|
||||
PIString fs;
|
||||
if (section == "PIObjects" || section == "properties") fs = ":";
|
||||
if (section == "methodsEH") fs = " ";
|
||||
if (section == "connections") fs = "->";
|
||||
while (!range.isEmpty()) {
|
||||
PIString line = range.takeLine().trim();
|
||||
if (line.contains('{')) {
|
||||
ti = new QTreeWidgetItem(pi);
|
||||
range.prepend(line + "\n");
|
||||
buildDumpSection(ti, range);
|
||||
//treeDump->addTopLevelItem(ti);
|
||||
continue;
|
||||
}
|
||||
if (line.left(line.find(":")).trim() == "count") {
|
||||
pi->setText(1, "[" + PI2QString(line.right(line.length() - line.find(":") - 1).trim()) + "]");
|
||||
continue;
|
||||
}
|
||||
int colon = line.find(fs);
|
||||
if (colon < 0) continue;
|
||||
PIString name = line.takeLeft(colon).trim();
|
||||
PIString value = line.cutLeft(fs.size_s()).trim();
|
||||
if (value.startsWith("\"")) value.cutLeft(1);
|
||||
if (value.endsWith("\"")) value.cutRight(1);
|
||||
if (name.endsWith(":")) name.cutRight(1);
|
||||
if (name.isEmpty() && value.isEmpty()) continue;
|
||||
ti = new QTreeWidgetItem(pi, QStringList() << PI2QString(name) << PI2QString(value));
|
||||
//treeDump->addTopLevelItem(ti);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PIDumper::on_buttonDumpMake_clicked() {
|
||||
if (radioDumpCurrent->isChecked()) {
|
||||
PICout::setBufferActive(true, true);
|
||||
dumpApplication();
|
||||
dump = PICout::buffer();
|
||||
PICout::setBufferActive(false);
|
||||
} else {
|
||||
int pid = lineDumpCustom->text().toInt();
|
||||
if (pid == 0) return;
|
||||
if (system(QString("kill -USR1 %1").arg(pid).toLatin1().constData()) < 0) return;
|
||||
PIString dp = PIDir::home().path() + "/_PIP_DUMP_" + PIString::fromNumber(pid);
|
||||
PITimeMeasurer tm;
|
||||
while (tm.elapsed_s() < 5. && !PIFile::isExists(dp)) {
|
||||
piMSleep(10);
|
||||
}
|
||||
//piSleep(2.);
|
||||
PIFile f(dp, PIIODevice::ReadOnly);
|
||||
if (!f.isOpened()) return;
|
||||
dump = PIString(f.readAll());
|
||||
f.remove();
|
||||
}
|
||||
buildDump();
|
||||
}
|
||||
|
||||
|
||||
void PIDumper::on_buttonDumpClipboard_clicked() {
|
||||
dump = Q2PIString(QApplication::clipboard()->text());
|
||||
buildDump();
|
||||
}
|
||||
|
||||
|
||||
void PIDumper::on_checkDumpHideService_toggled(bool on) {
|
||||
QList<QTreeWidgetItem * > il = treeDump->findItems("", Qt::MatchContains | Qt::MatchRecursive);
|
||||
foreach (QTreeWidgetItem * i, il) {
|
||||
if (on) {
|
||||
if (i->text(0).startsWith("class"))
|
||||
i->setHidden(i->text(1).contains("__S__"));
|
||||
} else
|
||||
i->setHidden(false);
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
#ifndef PIDUMPER_H
|
||||
#define PIDUMPER_H
|
||||
|
||||
#include "ui_pidumper.h"
|
||||
#include <QImage>
|
||||
#include <QTime>
|
||||
#include <qmath.h>
|
||||
#include <QDebug>
|
||||
#include "piqt.h"
|
||||
#include "piconnection.h"
|
||||
|
||||
class PIDumper: public QMainWindow, private Ui::PIDumper
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PIDumper(QWidget * parent = 0);
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent * e);
|
||||
|
||||
void buildDump();
|
||||
void buildDumpSection(QTreeWidgetItem * pi, PIString & str);
|
||||
|
||||
PIString dump;
|
||||
|
||||
private slots:
|
||||
void on_buttonDumpMake_clicked();
|
||||
void on_buttonDumpClipboard_clicked();
|
||||
void on_checkDumpHideService_toggled(bool on);
|
||||
|
||||
public slots:
|
||||
|
||||
};
|
||||
|
||||
#endif // PIDUMPER_H
|
||||
@@ -1,207 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PIDumper</class>
|
||||
<widget class="QMainWindow" name="PIDumper">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1134</width>
|
||||
<height>854</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>PIP dump viewer</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkDumpHideService">
|
||||
<property name="text">
|
||||
<string>Hide service objects</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonDumpMake">
|
||||
<property name="text">
|
||||
<string>Make PIP dump</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonDumpClipboard">
|
||||
<property name="text">
|
||||
<string>Take PIP dump from clipboard</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_6">
|
||||
<property name="title">
|
||||
<string>Process</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioDumpCurrent">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Current</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioDumpCustom">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Custom:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineDumpCustom">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>1</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="treeDump">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="verticalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
<property name="headerHidden">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="columnCount">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<attribute name="headerVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="headerMinimumSectionSize">
|
||||
<number>20</number>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string notr="true">1</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string notr="true">2</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>radioDumpCustom</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>lineDumpCustom</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>439</x>
|
||||
<y>91</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>480</x>
|
||||
<y>90</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>radioDumpCustom</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>lineDumpCustom</receiver>
|
||||
<slot>setFocus()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>453</x>
|
||||
<y>91</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>480</x>
|
||||
<y>86</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<slots>
|
||||
<slot>configChanged()</slot>
|
||||
<slot>updateMap()</slot>
|
||||
</slots>
|
||||
</ui>
|
||||
@@ -1,11 +0,0 @@
|
||||
#include <QApplication>
|
||||
#include "pidumper.h"
|
||||
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
QApplication a(argc, argv);
|
||||
enableHighDPI();
|
||||
PIDumper w;
|
||||
w.show();
|
||||
return a.exec();
|
||||
}
|
||||
Reference in New Issue
Block a user