git-svn-id: svn://db.shs.com.ru/libs@562 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -29,7 +29,7 @@ ContainersModel::ContainersModel() {
|
||||
prev_all.resize(all.size(), 0L);
|
||||
}
|
||||
|
||||
|
||||
#ifdef PIP_INTROSPECTION
|
||||
void ContainersModel::update(const PIMap<uint, PIIntrospectionContainers::Type> & td, const PIMap<uint, PIString> & tn) {
|
||||
prev_typedata = typedata;
|
||||
typedata = td;
|
||||
@@ -52,9 +52,11 @@ void ContainersModel::update(const PIMap<uint, PIIntrospectionContainers::Type>
|
||||
dataChanged(index(1, 0), index(columnCount(), typeids.size_s() - 1));
|
||||
emit headerDataChanged(Qt::Horizontal, 1, columnCount());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void ContainersModel::clear() {
|
||||
#ifdef PIP_INTROSPECTION
|
||||
beginRemoveRows(QModelIndex(), 0, typeids.size_s() - 1);
|
||||
typedata.clear();
|
||||
prev_typedata.clear();
|
||||
@@ -62,9 +64,9 @@ void ContainersModel::clear() {
|
||||
typeids.clear();
|
||||
all.fill(0L);
|
||||
endRemoveRows();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int ContainersModel::rowCount(const QModelIndex & parent) const {
|
||||
return typeids.size_s();
|
||||
}
|
||||
@@ -76,7 +78,9 @@ int ContainersModel::columnCount(const QModelIndex & parent) const {
|
||||
|
||||
|
||||
QModelIndex ContainersModel::index(int row, int column, const QModelIndex & parent) const {
|
||||
#ifdef PIP_INTROSPECTION
|
||||
if (row >= typenames.size_s() || row >= typedata.size_s()) return QModelIndex();
|
||||
#endif
|
||||
return createIndex(row, column, typeids[row]);
|
||||
}
|
||||
|
||||
@@ -107,6 +111,7 @@ QVariant ContainersModel::headerData(int section, Qt::Orientation orientation, i
|
||||
|
||||
QVariant ContainersModel::data(const QModelIndex & index, int role) const {
|
||||
if (role != Qt::DisplayRole && role != Qt::UserRole) return QVariant();
|
||||
#ifdef PIP_INTROSPECTION
|
||||
uint id = uint(index.internalId());
|
||||
llong v = 0L;
|
||||
if (mode_changes) {
|
||||
@@ -138,6 +143,7 @@ QVariant ContainersModel::data(const QModelIndex & index, int role) const {
|
||||
return PI2QString(PIString::readableSize(v));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
@@ -183,13 +189,13 @@ void ContainersView::changeEvent(QEvent * e) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef PIP_INTROSPECTION
|
||||
void ContainersView::showContainers(const PIMap<uint, PIIntrospectionContainers::Type> & data, const PIMap<uint, PIString> & typenames) {
|
||||
model->update(data, typenames);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void ContainersView::clear() {
|
||||
model->clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,15 +5,18 @@
|
||||
#include <QDebug>
|
||||
#include <QWidget>
|
||||
#include "piqt.h"
|
||||
#include "piintrospection_containers_p.h"
|
||||
|
||||
#ifdef PIP_INTROSPECTION
|
||||
# include "piintrospection_containers_p.h"
|
||||
#endif
|
||||
|
||||
class ContainersModel: public QAbstractItemModel {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ContainersModel();
|
||||
|
||||
#ifdef PIP_INTROSPECTION
|
||||
void update(const PIMap<uint, PIIntrospectionContainers::Type> & td, const PIMap<uint, PIString> & tn);
|
||||
#endif
|
||||
void clear();
|
||||
|
||||
int rowCount(const QModelIndex & parent = QModelIndex()) const override;
|
||||
@@ -26,7 +29,9 @@ public:
|
||||
Qt::ItemFlags flags(const QModelIndex & index) const override;
|
||||
|
||||
protected:
|
||||
#ifdef PIP_INTROSPECTION
|
||||
PIMap<uint, PIIntrospectionContainers::Type> typedata, prev_typedata;
|
||||
#endif
|
||||
PIMap<uint, PIString> typenames;
|
||||
PIVector<uint> typeids;
|
||||
PIVector<llong> all, prev_all;
|
||||
@@ -46,10 +51,10 @@ class ContainersView: public QWidget, private Ui::ContainersView
|
||||
public:
|
||||
ContainersView(QWidget * parent = 0);
|
||||
~ContainersView();
|
||||
|
||||
#ifdef PIP_INTROSPECTION
|
||||
void showContainers(const PIMap<uint, PIIntrospectionContainers::Type> & data, const PIMap<uint, PIString> & typenames);
|
||||
#endif
|
||||
void clear();
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent * e);
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ void ObjectsView::changeEvent(QEvent * e) {
|
||||
}
|
||||
|
||||
|
||||
#ifdef PIP_INTROSPECTION
|
||||
void ObjectsView::showObjects(const PIVector<PIIntrospection::ObjectInfo> & objects) {
|
||||
QHash<QString, int> stat;
|
||||
|
||||
@@ -58,3 +59,4 @@ void ObjectsView::showObjects(const PIVector<PIIntrospection::ObjectInfo> & obje
|
||||
}
|
||||
treeObjectsStat->verticalScrollBar()->setValue(vpos);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -13,9 +13,9 @@ class ObjectsView: public QWidget, private Ui::ObjectsView
|
||||
public:
|
||||
ObjectsView(QWidget * parent = 0);
|
||||
~ObjectsView();
|
||||
|
||||
#ifdef PIP_INTROSPECTION
|
||||
void showObjects(const PIVector<PIIntrospection::ObjectInfo> & objects);
|
||||
|
||||
#endif
|
||||
protected:
|
||||
void changeEvent(QEvent * e);
|
||||
|
||||
|
||||
@@ -90,6 +90,7 @@ void QPIIntrospector::buildDumpSection(QTreeWidgetItem * pi, PIString & str) {
|
||||
}
|
||||
|
||||
|
||||
#ifdef PIP_INTROSPECTION
|
||||
void QPIIntrospector::showInfo(const PIIntrospection::ProcessInfo & info) {
|
||||
PIString s;
|
||||
s << info.execCommand << "\n";
|
||||
@@ -99,6 +100,7 @@ void QPIIntrospector::showInfo(const PIIntrospection::ProcessInfo & info) {
|
||||
s << info.build_options.join(", ");
|
||||
labelInfo->setText(PI2QString(s));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void QPIIntrospector::on_listApp_currentRowChanged(int r) {
|
||||
@@ -114,6 +116,7 @@ void QPIIntrospector::on_listApp_currentRowChanged(int r) {
|
||||
void QPIIntrospector::peerReceived(const PIString & from, const PIByteArray & data) {
|
||||
if (from != cur_server) return;
|
||||
//piCout << "rec" << data.size();
|
||||
#ifdef PIP_INTROSPECTION
|
||||
PIByteArray ba(data);
|
||||
if (ba.size_s() < 4) return;
|
||||
uint sign(0); ba >> sign;
|
||||
@@ -144,6 +147,7 @@ void QPIIntrospector::peerReceived(const PIString & from, const PIByteArray & da
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -165,6 +169,7 @@ void QPIIntrospector::peersChanged(const PIString & name) {
|
||||
|
||||
void QPIIntrospector::on_buttonRequest_clicked() {
|
||||
if (cur_server.isEmpty()) return;
|
||||
#ifdef PIP_INTROSPECTION
|
||||
PIIntrospection::RequiredInfo info;
|
||||
for (int i = 0; i < layoutRequestFlags->count(); ++i) {
|
||||
QCheckBox * cb = qobject_cast<QCheckBox*>(layoutRequestFlags->itemAt(i)->widget());
|
||||
@@ -175,4 +180,5 @@ void QPIIntrospector::on_buttonRequest_clicked() {
|
||||
PIByteArray ba;
|
||||
ba << PIIntrospection::sign << info;
|
||||
peer.send(cur_server, ba);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -24,8 +24,9 @@ protected:
|
||||
void timerEvent(QTimerEvent * );
|
||||
|
||||
void buildDumpSection(QTreeWidgetItem * pi, PIString & str);
|
||||
#ifdef PIP_INTROSPECTION
|
||||
void showInfo(const PIIntrospection::ProcessInfo & info);
|
||||
|
||||
#endif
|
||||
EVENT_HANDLER(void, reqProcPIEvents) {QMetaObject::invokeMethod(this, "procPIEvents", Qt::QueuedConnection);}
|
||||
|
||||
EVENT_HANDLER2(void, peerReceived, const PIString &, from, const PIByteArray &, data);
|
||||
|
||||
Reference in New Issue
Block a user