hg/feature/sound
rti 14 years ago
commit 46342e35db

@ -1,7 +1,7 @@
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${LIBXML2_INCLUDE_DIR} ${NEL_INCLUDE_DIR} ${QT_INCLUDES}) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${LIBXML2_INCLUDE_DIR} ${NEL_INCLUDE_DIR} ${QT_INCLUDES})
INCLUDE( ${QT_USE_FILE} ) INCLUDE( ${QT_USE_FILE} )
FILE(GLOB GEORGES_EDITOR_SRC *.cpp) FILE(GLOB GEORGES_EDITOR_SRC *.cpp *.h)
SET(GEORGES_EDITOR_HDR georges_dirtree_dialog.h georges_treeview_dialog.h main_window.h SET(GEORGES_EDITOR_HDR georges_dirtree_dialog.h georges_treeview_dialog.h main_window.h
objectviewer_dialog.h settings_dialog.h) objectviewer_dialog.h settings_dialog.h)
SET(GEORGES_EDITOR_UIS settings_form.ui objectviewer_form.ui log_form.ui georges_treeview_form.ui georges_dirtree_form.ui) SET(GEORGES_EDITOR_UIS settings_form.ui objectviewer_form.ui log_form.ui georges_treeview_form.ui georges_dirtree_form.ui)
@ -14,6 +14,10 @@ QT4_ADD_RESOURCES( GEORGES_EDITOR_RC_SRCS ${GEORGES_EDITOR_RCS} )
QT4_WRAP_CPP( GEORGES_EDITOR_MOC_SRCS ${GEORGES_EDITOR_HDR} ) QT4_WRAP_CPP( GEORGES_EDITOR_MOC_SRCS ${GEORGES_EDITOR_HDR} )
QT4_WRAP_UI( GEORGES_EDITOR_UI_HDRS ${GEORGES_EDITOR_UIS} ) QT4_WRAP_UI( GEORGES_EDITOR_UI_HDRS ${GEORGES_EDITOR_UIS} )
SOURCE_GROUP(QtResources FILES ${GEORGES_EDITOR_UIS} ${GEORGES_EDITOR_RCS})
SOURCE_GROUP(QtGeneratedUiHdr FILES ${GEORGES_EDITOR_UI_HDRS})
SOURCE_GROUP(QtGeneratedMocSrc FILES ${GEORGES_EDITOR_MOC_SRCS})
ADD_EXECUTABLE(georges_editor_qt WIN32 MACOSX_BUNDLE ${GEORGES_EDITOR_SRC} ${GEORGES_EDITOR_MOC_SRCS} ${GEORGES_EDITOR_RC_SRCS} ${GEORGES_EDITOR_UI_HDRS}) ADD_EXECUTABLE(georges_editor_qt WIN32 MACOSX_BUNDLE ${GEORGES_EDITOR_SRC} ${GEORGES_EDITOR_MOC_SRCS} ${GEORGES_EDITOR_RC_SRCS} ${GEORGES_EDITOR_UI_HDRS})
TARGET_LINK_LIBRARIES(georges_editor_qt TARGET_LINK_LIBRARIES(georges_editor_qt

@ -73,7 +73,7 @@ void CConfiguration::init()
} }
// setup config file callback // setup config file callback
Modules::config().setCallback("SearchPaths", CConfigCallback(this, &CConfiguration::cfcbSearchPaths)); Modules::config().setAndCallback("SearchPaths", CConfigCallback(this, &CConfiguration::cfcbSearchPaths));
} }

@ -274,6 +274,7 @@ namespace NLQT
Modules::mainWin().createEmptyView( Modules::mainWin().createEmptyView(
Modules::mainWin().getTreeViewList().takeFirst()); Modules::mainWin().getTreeViewList().takeFirst());
} }
Modules::mainWin().getTreeViewList().removeOne(this);
deleteLater(); deleteLater();
} }
} }

@ -79,22 +79,19 @@ namespace NLQT
QBrush defaultBrush = QBrush(QColor(255,0,0,30)); QBrush defaultBrush = QBrush(QColor(255,0,0,30));
QBrush parentBrush = QBrush(QColor(0,255,0,30)); QBrush parentBrush = QBrush(QColor(0,255,0,30));
switch (getItem(p_index)->nodeFrom()) // if elm not existing it must be some kind of default or type value
{ if(!getItem(p_index)->getFormElm())
case NLGEORGES::UFormElm::NodeParentForm:
{
switch (getItem(p_index)->valueFrom())
{
case NLGEORGES::UFormElm::ValueDefaultDfn:
{ {
return defaultBrush; return defaultBrush;
} }
default:
// else it might be some parent elm
switch (getItem(p_index)->nodeFrom())
{
case NLGEORGES::UFormElm::NodeParentForm:
{ {
return parentBrush; return parentBrush;
} }
}
}
case NLGEORGES::UFormElm::NodeForm: case NLGEORGES::UFormElm::NodeForm:
{ {
switch (getItem(p_index)->valueFrom()) switch (getItem(p_index)->valueFrom())
@ -103,21 +100,33 @@ namespace NLQT
{ {
return parentBrush; return parentBrush;
} }
case NLGEORGES::UFormElm::ValueDefaultDfn:
{
return defaultBrush;
}
default: default:
{ {
return QVariant(); // parent status test kindof ugly, testing only 2 steps deep
} // only needed for colorization as treeview default hides childs
} // when parent is hidden
} CFormItem *parent = getItem(p_index)->parent();
default: if (parent)
{ {
return QVariant(); if (parent->nodeFrom() == NLGEORGES::UFormElm::NodeParentForm)
{
return parentBrush;
} }
CFormItem *parentParent = parent->parent();
if (parentParent)
{
if (parentParent->nodeFrom() == NLGEORGES::UFormElm::NodeParentForm)
{
return parentBrush;
} }
} // endif parentParent
} // endif parent
} // end default
} // end switch valueFrom
} // end case nodeForm
} // end switch nodeFrom
return QVariant();
} }
case Qt::DecorationRole: case Qt::DecorationRole:
{ {
@ -136,7 +145,6 @@ namespace NLQT
} }
else if(value.contains(".tga") || value.contains(".png")) else if(value.contains(".tga") || value.contains(".png"))
{ {
qDebug() << p_index << p_role;
QString path = NLMISC::CPath::lookup(value.toStdString(),false).c_str(); QString path = NLMISC::CPath::lookup(value.toStdString(),false).c_str();
return QIcon(":/images/pqrticles.png"); return QIcon(":/images/pqrticles.png");
} }
@ -282,8 +290,7 @@ namespace NLQT
return; return;
uint num = 0; uint num = 0;
UFormElm::TWhereIsNode *whereN = new UFormElm::TWhereIsNode;
UFormElm::TWhereIsValue *whereV = new UFormElm::TWhereIsValue;
if (root->isStruct()) if (root->isStruct())
{ {
@ -292,6 +299,8 @@ namespace NLQT
root->getStructSize(structSize); root->getStructSize(structSize);
while (num < structSize) while (num < structSize)
{ {
UFormElm::TWhereIsNode *whereN = new UFormElm::TWhereIsNode;
UFormElm::TWhereIsValue *whereV = new UFormElm::TWhereIsValue;
// Append a new item to the current parent's list of children. // Append a new item to the current parent's list of children.
std::string elmName; std::string elmName;
if(root->getStructNodeName(num, elmName)) if(root->getStructNodeName(num, elmName))
@ -400,7 +409,6 @@ namespace NLQT
elmtType.append("_noValue"); elmtType.append("_noValue");
} }
columnData << QString(elmName.c_str()) << QString(value.c_str()) << "" << elmtType; columnData << QString(elmName.c_str()) << QString(value.c_str()) << "" << elmtType;
qDebug() << columnData;
parent->appendChild(new CFormItem(elmt, columnData, parent, *whereV, *whereN)); parent->appendChild(new CFormItem(elmt, columnData, parent, *whereV, *whereN));
//if (parents.last()->childCount() > 0) { //if (parents.last()->childCount() > 0) {
// parents << parents.last()->child(parents.last()->childCount()-1); // parents << parents.last()->child(parents.last()->childCount()-1);

@ -47,21 +47,19 @@ namespace NLQT
// item->nodeFrom(), // item->nodeFrom(),
// smodel->showParents(), // smodel->showParents(),
// (item->valueFrom() == NLGEORGES::UFormElm::NodeParentForm)); // (item->valueFrom() == NLGEORGES::UFormElm::NodeParentForm));
switch (item->nodeFrom())
{ // if elm not existing it must be some kind of default or type value
case NLGEORGES::UFormElm::NodeParentForm: if(!item->getFormElm())
{
switch (item->valueFrom())
{
case NLGEORGES::UFormElm::ValueDefaultDfn:
{ {
return smodel->showDefaults(); return smodel->showDefaults();
} }
default:
// else it might be some parent elm
switch (item->nodeFrom())
{ {
return smodel->showParents();; case NLGEORGES::UFormElm::NodeParentForm:
} {
} return smodel->showParents();
} }
case NLGEORGES::UFormElm::NodeForm: case NLGEORGES::UFormElm::NodeForm:
{ {
@ -71,21 +69,18 @@ namespace NLQT
{ {
return smodel->showParents(); return smodel->showParents();
} }
case NLGEORGES::UFormElm::ValueDefaultDfn:
{
return smodel->showDefaults();
}
default: default:
{ {
return true; CFormItem *parent = item->parent();
if (parent && (parent->nodeFrom() == NLGEORGES::UFormElm::NodeParentForm))
{
return smodel->showParents();
} }
} }
} }
default:
{
return true;
} }
} }
return true;
} }
/******************************************************************************/ /******************************************************************************/

@ -41,7 +41,7 @@ namespace NLQT
CMainWindow::CMainWindow(QWidget *parent) CMainWindow::CMainWindow(QWidget *parent)
: QMainWindow(parent), _GeorgesLogDialog(0), _ObjectViewerDialog(0), : QMainWindow(parent), _GeorgesLogDialog(0), _ObjectViewerDialog(0),
_GeorgesDirTreeDialog(0) _GeorgesDirTreeDialog(0),_emptyView(0)
{ {
setWindowTitle("Qt Georges Editor"); setWindowTitle("Qt Georges Editor");
@ -106,17 +106,31 @@ namespace NLQT
CMainWindow::~CMainWindow() CMainWindow::~CMainWindow()
{ {
// save state & geometry of window and widgets // save state & geometry of window and widgets
QSettings settings("georges_editor_qt.ini", QSettings::IniFormat);
settings.beginGroup("WindowSettings");
settings.setValue("QtWindowState", saveState());
settings.setValue("QtWindowGeometry", saveGeometry());
settings.endGroup();
_statusBarTimer->stop(); _statusBarTimer->stop();
delete _ObjectViewerDialog; delete _ObjectViewerDialog;
delete _GeorgesDirTreeDialog; delete _GeorgesDirTreeDialog;
delete _GeorgesLogDialog; delete _GeorgesLogDialog;
delete _emptyView;
}
void CMainWindow::closeEvent(QCloseEvent *event)
{
// TODO: dirty hack to have qt recognize possible state/geometry changes
// of new emptyView
CGeorgesTreeViewDialog *bla = new CGeorgesTreeViewDialog(this, true);
tabifyDockWidget(_emptyView, bla);
removeDockWidget(bla);
bla->deleteLater();
QSettings settings("georges_editor_qt.ini", QSettings::IniFormat);
settings.beginGroup("WindowSettings");
settings.setValue("QtWindowState", saveState());
settings.setValue("QtWindowGeometry", saveGeometry());
settings.endGroup();
event->accept();
} }
void CMainWindow::openTreeView(QString file) void CMainWindow::openTreeView(QString file)
@ -135,13 +149,12 @@ namespace NLQT
if (!newView) if (!newView)
{ {
newView = new CGeorgesTreeViewDialog(this); newView = new CGeorgesTreeViewDialog(this);
//newView->setAllowedAreas(Qt::TopDockWidgetArea | Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
newView->setWindowTitle(file); newView->setWindowTitle(file);
if (_treeViewList.isEmpty()) if (_treeViewList.isEmpty())
{ {
_emptyView->deleteLater();
tabifyDockWidget(_emptyView, newView); tabifyDockWidget(_emptyView, newView);
_emptyView->deleteLater();
} }
else else
{ {
@ -245,8 +258,10 @@ namespace NLQT
void CMainWindow::createEmptyView(QDockWidget* w) void CMainWindow::createEmptyView(QDockWidget* w)
{ {
_emptyView = new CGeorgesTreeViewDialog(this, true); _emptyView = new CGeorgesTreeViewDialog(this, true);
if(w) if(w)
{ {
addDockWidget(Qt::TopDockWidgetArea, _emptyView);
tabifyDockWidget(w, _emptyView); tabifyDockWidget(w, _emptyView);
} }
else else
@ -401,6 +416,7 @@ namespace NLQT
void CMainWindow::tabChanged(int index) void CMainWindow::tabChanged(int index)
{ {
nlinfo(QString("%1").arg(index).toStdString().c_str());
if (index == -1) if (index == -1)
{ {
setWindowTitle("Qt Georges Editor"); setWindowTitle("Qt Georges Editor");

@ -58,6 +58,7 @@ namespace NLQT
QList<CGeorgesTreeViewDialog*>& getTreeViewList() { return _treeViewList; } QList<CGeorgesTreeViewDialog*>& getTreeViewList() { return _treeViewList; }
QTabBar* getTabBar(); QTabBar* getTabBar();
void createEmptyView(QDockWidget* w = 0); void createEmptyView(QDockWidget* w = 0);
void closeEvent(QCloseEvent *event);
private Q_SLOTS: private Q_SLOTS:
void open(); void open();

Loading…
Cancel
Save