introducing hinspector widget
|
@ -38,7 +38,7 @@ IF(UNIX)
|
||||||
)
|
)
|
||||||
|
|
||||||
FIND_PATH(HURRICANE_VIEWER_INCLUDE_PATH
|
FIND_PATH(HURRICANE_VIEWER_INCLUDE_PATH
|
||||||
NAMES CellViewer.h
|
NAMES CellViewer.h HInspectorWidget.h
|
||||||
PATHS ${HURRICANE_DIR_SEARCH}
|
PATHS ${HURRICANE_DIR_SEARCH}
|
||||||
PATH_SUFFIXES include/hurricane
|
PATH_SUFFIXES include/hurricane
|
||||||
# Help the user find it if we cannot.
|
# Help the user find it if we cannot.
|
||||||
|
@ -46,7 +46,15 @@ IF(UNIX)
|
||||||
)
|
)
|
||||||
|
|
||||||
FIND_LIBRARY(HURRICANE_VIEWER_LIBRARY_PATH
|
FIND_LIBRARY(HURRICANE_VIEWER_LIBRARY_PATH
|
||||||
NAMES hurricaneviewer
|
NAMES hviewer
|
||||||
|
PATHS ${HURRICANE_DIR_SEARCH}
|
||||||
|
PATH_SUFFIXES lib
|
||||||
|
# Help the user find it if we cannot.
|
||||||
|
DOC "The ${HURRICANE_INCLUDE_PATH_DESCRIPTION}"
|
||||||
|
)
|
||||||
|
|
||||||
|
FIND_LIBRARY(HURRICANE_INSPECTOR_LIBRARY_PATH
|
||||||
|
NAMES hinspector
|
||||||
PATHS ${HURRICANE_DIR_SEARCH}
|
PATHS ${HURRICANE_DIR_SEARCH}
|
||||||
PATH_SUFFIXES lib
|
PATH_SUFFIXES lib
|
||||||
# Help the user find it if we cannot.
|
# Help the user find it if we cannot.
|
||||||
|
@ -81,6 +89,10 @@ IF(UNIX)
|
||||||
ENDIF(HURRICANE_VIEWER_LIBRARY_PATH)
|
ENDIF(HURRICANE_VIEWER_LIBRARY_PATH)
|
||||||
ENDIF(HURRICANE_VIEWER_INCLUDE_PATH)
|
ENDIF(HURRICANE_VIEWER_INCLUDE_PATH)
|
||||||
|
|
||||||
|
IF (HURRICANE_INSPECTOR_LIBRARY_PATH)
|
||||||
|
SET(HURRICANE_GRAPHICAL_LIBRARIES ${HURRICANE_GRAPHICAL_LIBRARIES} ${HURRICANE_INSPECTOR_LIBRARY_PATH})
|
||||||
|
ENDIF(HURRICANE_INSPECTOR_LIBRARY_PATH)
|
||||||
|
|
||||||
IF(HURRICANE_FOUND)
|
IF(HURRICANE_FOUND)
|
||||||
IF(NOT HURRICANE_FIND_QUIETLY)
|
IF(NOT HURRICANE_FIND_QUIETLY)
|
||||||
MESSAGE(STATUS "Found HURRICANE : ${HURRICANE_LIBRARIES}")
|
MESSAGE(STATUS "Found HURRICANE : ${HURRICANE_LIBRARIES}")
|
||||||
|
@ -96,6 +108,7 @@ IF(UNIX)
|
||||||
HURRICANE_LIBRARY_PATH
|
HURRICANE_LIBRARY_PATH
|
||||||
HURRICANE_GRAPHICAL_INCLUDE_PATH
|
HURRICANE_GRAPHICAL_INCLUDE_PATH
|
||||||
HURRICANE_GRAPHICAL_LIBRARY_PATH
|
HURRICANE_GRAPHICAL_LIBRARY_PATH
|
||||||
|
HURRICANE_INSPECTOR_LIBRARY_PATH
|
||||||
)
|
)
|
||||||
|
|
||||||
ENDIF(UNIX)
|
ENDIF(UNIX)
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
ADD_SUBDIRECTORY(hurricane)
|
add_subdirectory(hurricane)
|
||||||
ADD_SUBDIRECTORY(viewer)
|
add_subdirectory(hinspector)
|
||||||
ADD_SUBDIRECTORY(pyext)
|
add_subdirectory(hviewer)
|
||||||
|
add_subdirectory(pyext)
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
include(${QT_USE_FILE})
|
||||||
|
|
||||||
|
include_directories(${HURRICANE_SOURCE_DIR}/src/hurricane)
|
||||||
|
|
||||||
|
set(mocincludes RecordModel.h HInspectorWidget.h)
|
||||||
|
set(cpps RecordModel.cpp HInspectorWidget.cpp)
|
||||||
|
|
||||||
|
QT4_WRAP_CPP(MOC_SRCS ${mocincludes})
|
||||||
|
|
||||||
|
add_library(hinspector SHARED ${cpps} ${MOC_SRCS})
|
||||||
|
target_link_libraries(hinspector ${QT_LIBRARIES} hurricane)
|
||||||
|
|
||||||
|
install(FILES HInspectorWidget.h DESTINATION /include/hurricane)
|
||||||
|
install(TARGETS hinspector DESTINATION /lib)
|
|
@ -0,0 +1,44 @@
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
|
#include "RecordModel.h"
|
||||||
|
#include "HInspectorWidget.h"
|
||||||
|
|
||||||
|
HInspectorWidget::HInspectorWidget(QWidget* parent):
|
||||||
|
QWidget(parent),
|
||||||
|
recordModels(),
|
||||||
|
slotsTableView(NULL)
|
||||||
|
{
|
||||||
|
|
||||||
|
slotsTableView = new QTableView;
|
||||||
|
slotsTableView->setAlternatingRowColors(true);
|
||||||
|
slotsTableView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||||
|
|
||||||
|
|
||||||
|
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||||
|
mainLayout->addWidget(slotsTableView);
|
||||||
|
setLayout(mainLayout);
|
||||||
|
|
||||||
|
setWindowTitle(tr("Inspector"));
|
||||||
|
resize(1000, 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
HInspectorWidget::~HInspectorWidget() {
|
||||||
|
for (RecordModels::iterator rmit = recordModels.begin();
|
||||||
|
rmit != recordModels.end();
|
||||||
|
++rmit) {
|
||||||
|
delete rmit->second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HInspectorWidget::setRecord(Record* record) {
|
||||||
|
RecordModel* recordModel = NULL;
|
||||||
|
|
||||||
|
RecordModels::iterator rmit = recordModels.find(record);
|
||||||
|
if (rmit != recordModels.end()) {
|
||||||
|
recordModel = rmit->second;
|
||||||
|
} else {
|
||||||
|
recordModel = new RecordModel(record);
|
||||||
|
recordModels[record] = recordModel;
|
||||||
|
}
|
||||||
|
slotsTableView->setModel(recordModel);
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
#ifndef HINSPECTORWIDGET_H
|
||||||
|
#define HINSPECTORWIDGET_H
|
||||||
|
|
||||||
|
#include "Commons.h"
|
||||||
|
using namespace Hurricane;
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QTableView>
|
||||||
|
|
||||||
|
class RecordModel;
|
||||||
|
|
||||||
|
class HInspectorWidget : public QWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
typedef map<Record*, RecordModel*> RecordModels;
|
||||||
|
HInspectorWidget(QWidget* parent=0);
|
||||||
|
~HInspectorWidget();
|
||||||
|
void setRecord(Record* record);
|
||||||
|
|
||||||
|
private:
|
||||||
|
RecordModels recordModels;
|
||||||
|
QTableView* slotsTableView;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // HINSPECTORWIDGET_H
|
|
@ -0,0 +1,34 @@
|
||||||
|
#include "RecordModel.h"
|
||||||
|
|
||||||
|
RecordModel::RecordModel(Record* r, QObject* parent):
|
||||||
|
QAbstractTableModel(parent),
|
||||||
|
record(r)
|
||||||
|
{}
|
||||||
|
|
||||||
|
QVariant RecordModel::data(const QModelIndex &index, int role) const {
|
||||||
|
if (!index.isValid())
|
||||||
|
return QVariant();
|
||||||
|
|
||||||
|
if (role != Qt::DisplayRole)
|
||||||
|
return QVariant();
|
||||||
|
|
||||||
|
unsigned row = index.row();
|
||||||
|
Slot* slot = record->getSlot(row);
|
||||||
|
if (slot) {
|
||||||
|
switch (index.column()) {
|
||||||
|
case 0:
|
||||||
|
return QVariant(getString(slot->getName()).c_str());
|
||||||
|
case 1:
|
||||||
|
return QVariant(slot->getDataString().c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
|
|
||||||
|
int RecordModel::rowCount(const QModelIndex &parent) const {
|
||||||
|
return record->_getSlotList().size();
|
||||||
|
}
|
||||||
|
|
||||||
|
int RecordModel::columnCount(const QModelIndex &parent) const {
|
||||||
|
return 2;
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
#ifndef RECORDMODEL_H
|
||||||
|
#define RECORDMODEL_H
|
||||||
|
|
||||||
|
#include <QAbstractTableModel>
|
||||||
|
|
||||||
|
#include "Commons.h"
|
||||||
|
using namespace Hurricane;
|
||||||
|
|
||||||
|
class RecordModel : public QAbstractTableModel {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
RecordModel(Record* record, QObject* parent=0);
|
||||||
|
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||||
|
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||||
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||||
|
private:
|
||||||
|
Record* record;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // RECORDMODEL_H
|
|
@ -26,13 +26,13 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ifndef __RECORD__
|
#ifndef __RECORD__
|
||||||
# define __RECORD__
|
#define __RECORD__
|
||||||
|
|
||||||
|
|
||||||
# ifndef __HURRICANE_COMMONS__
|
#ifndef __HURRICANE_COMMONS__
|
||||||
# error "Record.h musn't be included alone, please uses Commons.h."
|
#error "Record.h musn't be included alone, please uses Commons.h."
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
namespace Hurricane {
|
namespace Hurricane {
|
||||||
|
|
|
@ -25,13 +25,13 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ifndef __HURRICANE_SLOT__
|
#ifndef __HURRICANE_SLOT__
|
||||||
# define __HURRICANE_SLOT__
|
#define __HURRICANE_SLOT__
|
||||||
|
|
||||||
|
|
||||||
# ifndef __HURRICANE_COMMONS__
|
#ifndef __HURRICANE_COMMONS__
|
||||||
# error "Slot.h musn't be included alone, please uses Commons.h."
|
#error "Slot.h musn't be included alone, please uses Commons.h."
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,8 @@ set(cpps ScreenUtilities.cpp DisplayStyle.cpp ScreenLayer.cpp LayersList.cpp Cel
|
||||||
QT4_WRAP_CPP(MOC_SRCS ${mocincludes})
|
QT4_WRAP_CPP(MOC_SRCS ${mocincludes})
|
||||||
QT4_ADD_RESOURCES(RCC_SRCS CellViewer.qrc)
|
QT4_ADD_RESOURCES(RCC_SRCS CellViewer.qrc)
|
||||||
|
|
||||||
add_library(hurricaneviewer SHARED ${cpps} ${MOC_SRCS} ${RCC_SRCS})
|
add_library(hviewer SHARED ${cpps} ${MOC_SRCS} ${RCC_SRCS})
|
||||||
target_link_libraries(hurricaneviewer ${QT_LIBRARIES} hurricane)
|
target_link_libraries(hviewer ${QT_LIBRARIES} hurricane)
|
||||||
|
|
||||||
install(FILES ${exports} DESTINATION /include/hurricane)
|
install(FILES ${exports} DESTINATION /include/hurricane)
|
||||||
install(TARGETS hurricaneviewer DESTINATION /lib)
|
install(TARGETS hviewer DESTINATION /lib)
|
Before Width: | Height: | Size: 536 B After Width: | Height: | Size: 536 B |
Before Width: | Height: | Size: 522 B After Width: | Height: | Size: 522 B |
Before Width: | Height: | Size: 523 B After Width: | Height: | Size: 523 B |
Before Width: | Height: | Size: 605 B After Width: | Height: | Size: 605 B |
Before Width: | Height: | Size: 923 B After Width: | Height: | Size: 923 B |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 394 B After Width: | Height: | Size: 394 B |
Before Width: | Height: | Size: 850 B After Width: | Height: | Size: 850 B |
|
@ -53,14 +53,14 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ifndef __PYINSTANCELOCATOR__
|
#ifndef __PYINSTANCELOCATOR__
|
||||||
# define __PYINSTANCELOCATOR__
|
#define __PYINSTANCELOCATOR__
|
||||||
|
|
||||||
|
|
||||||
# include "PyHurricane.h"
|
#include "PyHurricane.h"
|
||||||
|
|
||||||
# include "Locator.h"
|
#include "Locator.h"
|
||||||
# include "Instance.h"
|
#include "Instance.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Isobar {
|
namespace Isobar {
|
||||||
|
@ -83,15 +83,15 @@ extern "C" {
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Functions & Types exported to "PyHurricane.ccp".
|
// Functions & Types exported to "PyHurricane.ccp".
|
||||||
|
|
||||||
extern PyTypeObject PyTypeInstanceLocator;
|
extern PyTypeObject PyTypeInstanceLocator;
|
||||||
extern PyMethodDef PyInstanceLocator_Methods[];
|
extern PyMethodDef PyInstanceLocator_Methods[];
|
||||||
|
|
||||||
extern void PyInstanceLocator_LinkPyType ();
|
extern void PyInstanceLocator_LinkPyType ();
|
||||||
|
|
||||||
|
|
||||||
# define IsPyInstanceLocator(v) ( (v)->ob_type == &PyTypeInstanceLocator )
|
#define IsPyInstanceLocator(v) ( (v)->ob_type == &PyTypeInstanceLocator )
|
||||||
# define PYINSTANCELOCATOR(v) ( (PyInstanceLocator*)(v) )
|
#define PYINSTANCELOCATOR(v) ( (PyInstanceLocator*)(v) )
|
||||||
# define PYINSTANCELOCATOR_O(v) ( PYINSTANCELOCATOR(v)->_object )
|
#define PYINSTANCELOCATOR_O(v) ( PYINSTANCELOCATOR(v)->_object )
|
||||||
|
|
||||||
|
|
||||||
} // End of extern "C".
|
} // End of extern "C".
|
||||||
|
@ -104,4 +104,4 @@ extern "C" {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# endif
|
#endif
|
||||||
|
|