mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-19 21:56:13 +00:00
Changed: #1150 Added splash screen & new dialog + minor changes
This commit is contained in:
parent
b436e7a8f6
commit
1b552d66cc
33 changed files with 1939 additions and 435 deletions
|
@ -67,11 +67,12 @@ namespace NLQT
|
||||||
virtual NL3D::UDriver *getDriver() = 0;
|
virtual NL3D::UDriver *getDriver() = 0;
|
||||||
virtual NL3D::UScene *getScene() = 0;
|
virtual NL3D::UScene *getScene() = 0;
|
||||||
virtual NL3D::UPlayListManager *getPlayListManager() = 0;
|
virtual NL3D::UPlayListManager *getPlayListManager() = 0;
|
||||||
virtual void setCamera(NLMISC::CAABBox &bbox, NL3D::UTransform &entity, bool high_z) = 0;
|
virtual void setCamera(NL3D::UScene *scene, NLMISC::CAABBox &bbox, NL3D::UTransform &entity, bool high_z) = 0;
|
||||||
virtual bool setupLight(const NLMISC::CVector &position, const NLMISC::CVector &direction) = 0;
|
virtual bool setupLight(const NLMISC::CVector &position, const NLMISC::CVector &direction) = 0;
|
||||||
virtual void setVisible(bool visible) = 0;
|
virtual void setVisible(bool visible) = 0;
|
||||||
virtual QWidget* getWidget() = 0;
|
virtual QWidget* getWidget() = 0;
|
||||||
virtual void setNelContext(NLMISC::INelContext &nelContext) = 0;
|
virtual void setNelContext(NLMISC::INelContext &nelContext) = 0;
|
||||||
|
virtual QIcon* saveOneImage(std::string shapename) = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include <nel/3d/u_3d_mouse_listener.h>
|
#include <nel/3d/u_3d_mouse_listener.h>
|
||||||
#include <nel/3d/bloom_effect.h>
|
#include <nel/3d/bloom_effect.h>
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
|
#include <QIcon>
|
||||||
|
|
||||||
// Project includes
|
// Project includes
|
||||||
|
|
||||||
Q_EXPORT_PLUGIN2(object_viewer_widget_qt, NLQT::CObjectViewerWidget)
|
Q_EXPORT_PLUGIN2(object_viewer_widget_qt, NLQT::CObjectViewerWidget)
|
||||||
|
@ -432,7 +435,7 @@ namespace NLQT
|
||||||
|
|
||||||
CAABBox bbox;
|
CAABBox bbox;
|
||||||
Entity.getShapeAABBox(bbox);
|
Entity.getShapeAABBox(bbox);
|
||||||
setCamera(bbox , Entity, true);
|
setCamera(_Scene, bbox , Entity, true);
|
||||||
|
|
||||||
_MouseListener->setMatrix(_Scene->getCam().getMatrix());
|
_MouseListener->setMatrix(_Scene->getCam().getMatrix());
|
||||||
|
|
||||||
|
@ -576,7 +579,7 @@ namespace NLQT
|
||||||
_Entities.clear();
|
_Entities.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CObjectViewerWidget::setCamera(CAABBox &bbox, UTransform &entity, bool high_z)
|
void CObjectViewerWidget::setCamera(NL3D::UScene *scene, CAABBox &bbox, UTransform &entity, bool high_z)
|
||||||
{
|
{
|
||||||
CVector pos(0.f, 0.f, 0.f);
|
CVector pos(0.f, 0.f, 0.f);
|
||||||
CQuat quat(0.f, 0.f, 0.f, 0.f);
|
CQuat quat(0.f, 0.f, 0.f, 0.f);
|
||||||
|
@ -586,87 +589,29 @@ namespace NLQT
|
||||||
{
|
{
|
||||||
inst.getDefaultPos(pos);
|
inst.getDefaultPos(pos);
|
||||||
inst.getDefaultRotQuat(quat);
|
inst.getDefaultRotQuat(quat);
|
||||||
/*
|
|
||||||
if (quat.getAxis().isNull())
|
|
||||||
{
|
|
||||||
quat.set(0, 0, 0, 0);
|
|
||||||
inst.setRotQuat(quat);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
// quat.set(1.f, 1.f, 0.f, 0.f);
|
|
||||||
|
|
||||||
// inst.setRotQuat(quat);
|
|
||||||
// inst.getRotQuat(quat);
|
|
||||||
|
|
||||||
// check for presence of all textures from each sets
|
|
||||||
//bool allGood = true;
|
|
||||||
|
|
||||||
//for(uint s = 0; s < 5; ++s)
|
|
||||||
//{
|
|
||||||
// inst.selectTextureSet(s);
|
|
||||||
|
|
||||||
// uint numMat = inst.getNumMaterials();
|
|
||||||
|
|
||||||
// // by default, all textures are present
|
|
||||||
// allGood = true;
|
|
||||||
|
|
||||||
// for(uint i = 0; i < numMat; ++i)
|
|
||||||
// {
|
|
||||||
// UInstanceMaterial mat = inst.getMaterial(i);
|
|
||||||
|
|
||||||
// for(sint j = 0; j <= mat.getLastTextureStage(); ++j)
|
|
||||||
// {
|
|
||||||
// // if a texture is missing
|
|
||||||
// if (mat.isTextureFile(j) && mat.getTextureFileName(j) == "CTextureMultiFile:Dummy")
|
|
||||||
// allGood = false;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // if all textures have been found for this set, skip other sets
|
|
||||||
// if (allGood)
|
|
||||||
// break;
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// fix scale (some shapes have a different value)
|
// fix scale (some shapes have a different value)
|
||||||
entity.setScale(1.f, 1.f, 1.f);
|
entity.setScale(1.f, 1.f, 1.f);
|
||||||
|
|
||||||
UCamera Camera = _Scene->getCam();
|
UCamera Camera = scene->getCam();
|
||||||
CVector max_radius = bbox.getHalfSize();
|
CVector max_radius = bbox.getHalfSize();
|
||||||
|
|
||||||
CVector center = bbox.getCenter();
|
CVector center = bbox.getCenter();
|
||||||
entity.setPivot(center);
|
entity.setPivot(center);
|
||||||
center += pos;
|
center += pos;
|
||||||
|
|
||||||
//_Scene->getCam().setPerspective(_CameraFocal * (float)Pi/180.f, (float)w/h, 0.1f, 1000);
|
//scene->getCam().setPerspective(_CameraFocal * (float)Pi/180.f, (float)w/h, 0.1f, 1000);
|
||||||
float fov = float(_CameraFocal * (float)Pi/180.0);
|
float fov = float(_CameraFocal * (float)Pi/180.0);
|
||||||
//Camera.setPerspective (fov, 1.0f, 0.1f, 1000.0f);
|
//Camera.setPerspective (fov, 1.0f, 0.1f, 1000.0f);
|
||||||
float radius = max(max(max_radius.x, max_radius.y), max_radius.z);
|
float radius = max(max(max_radius.x, max_radius.y), max_radius.z);
|
||||||
if (radius == 0.f) radius = 1.f;
|
if (radius == 0.f) radius = 1.f;
|
||||||
float left, right, bottom, top, znear, zfar;
|
float left, right, bottom, top, znear, zfar;
|
||||||
Camera.getFrustum(left, right, bottom, top, znear, zfar);
|
Camera.getFrustum(left, right, bottom, top, znear, zfar);
|
||||||
float dist = radius / (tan(fov/2));
|
float dist = (radius / (tan(fov/2))) * 0.2;
|
||||||
CVector eye(center);
|
CVector eye(center);
|
||||||
/* if (axis == CVector::I)
|
|
||||||
eye.y -= dist+radius;
|
|
||||||
else if (axis == CVector::J)
|
|
||||||
eye.x += dist+radius;
|
|
||||||
*/
|
|
||||||
// quat.normalize();
|
|
||||||
|
|
||||||
CVector ax(quat.getAxis());
|
CVector ax(quat.getAxis());
|
||||||
|
|
||||||
// float angle = quat.getAngle();
|
|
||||||
/*
|
|
||||||
if (ax.isNull())
|
|
||||||
{
|
|
||||||
if (int(angle*100.f) == int(NLMISC::Pi * 200.f))
|
|
||||||
{
|
|
||||||
ax = CVector::J;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
*/
|
|
||||||
if (ax.isNull() || ax == CVector::I)
|
if (ax.isNull() || ax == CVector::I)
|
||||||
{
|
{
|
||||||
ax = CVector::J;
|
ax = CVector::J;
|
||||||
|
@ -675,12 +620,6 @@ namespace NLQT
|
||||||
{
|
{
|
||||||
ax = -CVector::J;
|
ax = -CVector::J;
|
||||||
}
|
}
|
||||||
/* else if (ax.x < -0.9f && ax.y == 0.f && ax.z == 0.f)
|
|
||||||
{
|
|
||||||
ax = -CVector::J ;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
// ax.normalize();
|
|
||||||
|
|
||||||
eye -= ax * (dist+radius);
|
eye -= ax * (dist+radius);
|
||||||
if (high_z)
|
if (high_z)
|
||||||
|
@ -713,6 +652,73 @@ namespace NLQT
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QIcon* CObjectViewerWidget::saveOneImage(string shapename)
|
||||||
|
{
|
||||||
|
int output_width = 128;
|
||||||
|
int output_height = 128;
|
||||||
|
|
||||||
|
// Create a scene
|
||||||
|
NL3D::UScene* Scene = _Driver->createScene(true);
|
||||||
|
if (!Scene) return 0;
|
||||||
|
|
||||||
|
// get scene camera
|
||||||
|
if (Scene->getCam().empty())
|
||||||
|
{
|
||||||
|
nlwarning("can't get camera from scene");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// add an entity to the scene
|
||||||
|
UInstance Entity = Scene->createInstance(shapename.c_str());
|
||||||
|
|
||||||
|
// if we can't create entity, skip it
|
||||||
|
if (Entity.empty())
|
||||||
|
{
|
||||||
|
nlwarning("can't create instance from %s", shapename.c_str());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get AABox of Entity
|
||||||
|
CAABBox bbox;
|
||||||
|
Entity.getShapeAABBox(bbox);
|
||||||
|
setCamera(Scene, bbox , Entity, true);
|
||||||
|
Scene->getCam().setPerspective(_CameraFocal * (float)Pi/180.f, (float)output_width/output_height, 0.1f, 1000);
|
||||||
|
|
||||||
|
string filename = CPath::standardizePath("") + toString("%s.%s", shapename.c_str(), "png");
|
||||||
|
|
||||||
|
// the background is white
|
||||||
|
_Driver->clearBuffers();
|
||||||
|
|
||||||
|
// render the scene
|
||||||
|
Scene->render();
|
||||||
|
|
||||||
|
CBitmap btm;
|
||||||
|
_Driver->getBuffer(btm);
|
||||||
|
|
||||||
|
btm.resample(output_width, output_height);
|
||||||
|
|
||||||
|
COFile fs;
|
||||||
|
|
||||||
|
if (fs.open(filename))
|
||||||
|
{
|
||||||
|
if (!btm.writePNG(fs, 24))
|
||||||
|
{
|
||||||
|
nlwarning("can't save image to PNG");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nlwarning("can't create %s", "test.png");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
fs.close();
|
||||||
|
|
||||||
|
QIcon *icon = new QIcon(QString(filename.c_str()));
|
||||||
|
//CFile::deleteFile(filename);
|
||||||
|
return icon;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(NL_OS_WINDOWS)
|
#if defined(NL_OS_WINDOWS)
|
||||||
|
|
||||||
typedef bool (*winProc)(NL3D::IDriver *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
typedef bool (*winProc)(NL3D::IDriver *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
|
@ -45,6 +45,7 @@ namespace NL3D
|
||||||
class U3dMouseListener;
|
class U3dMouseListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class QIcon;
|
||||||
/**
|
/**
|
||||||
namespace NLQT
|
namespace NLQT
|
||||||
@brief namespace NLQT
|
@brief namespace NLQT
|
||||||
|
@ -153,9 +154,11 @@ namespace NLQT
|
||||||
/// @return pointer to the UPlayListManager
|
/// @return pointer to the UPlayListManager
|
||||||
inline NL3D::UPlayListManager *getPlayListManager() { return _PlayListManager; }
|
inline NL3D::UPlayListManager *getPlayListManager() { return _PlayListManager; }
|
||||||
|
|
||||||
void setCamera(NLMISC::CAABBox &bbox, NL3D::UTransform &entity, bool high_z);
|
void setCamera(NL3D::UScene *scene, NLMISC::CAABBox &bbox, NL3D::UTransform &entity, bool high_z=false);
|
||||||
bool setupLight(const NLMISC::CVector &position, const NLMISC::CVector &direction);
|
bool setupLight(const NLMISC::CVector &position, const NLMISC::CVector &direction);
|
||||||
|
|
||||||
|
QIcon* saveOneImage(std::string shapename);
|
||||||
|
|
||||||
virtual void setVisible(bool visible);
|
virtual void setVisible(bool visible);
|
||||||
|
|
||||||
QWidget* getWidget() {return this;}
|
QWidget* getWidget() {return this;}
|
||||||
|
|
|
@ -8,9 +8,27 @@ INCLUDE_DIRECTORIES(
|
||||||
INCLUDE( ${QT_USE_FILE} )
|
INCLUDE( ${QT_USE_FILE} )
|
||||||
|
|
||||||
FILE(GLOB GEORGES_EDITOR_SRC *.cpp *.h)
|
FILE(GLOB GEORGES_EDITOR_SRC *.cpp *.h)
|
||||||
SET(GEORGES_EDITOR_HDR georges_dirtree_dialog.h georges_treeview_dialog.h main_window.h
|
|
||||||
objectviewer_dialog.h settings_dialog.h progress_dialog.h)
|
SET(GEORGES_EDITOR_HDR
|
||||||
SET(GEORGES_EDITOR_UIS settings_form.ui objectviewer_form.ui log_form.ui georges_treeview_form.ui georges_dirtree_form.ui)
|
georges_dirtree_dialog.h
|
||||||
|
georges_treeview_dialog.h
|
||||||
|
main_window.h
|
||||||
|
objectviewer_dialog.h
|
||||||
|
settings_dialog.h
|
||||||
|
progress_dialog.h
|
||||||
|
new_dialog.h
|
||||||
|
completer_line_edit.h
|
||||||
|
georges_splash.h)
|
||||||
|
|
||||||
|
SET(GEORGES_EDITOR_UIS
|
||||||
|
settings_form.ui
|
||||||
|
objectviewer_form.ui
|
||||||
|
log_form.ui
|
||||||
|
georges_treeview_form.ui
|
||||||
|
georges_dirtree_form.ui
|
||||||
|
new_form.ui
|
||||||
|
splash.ui)
|
||||||
|
|
||||||
SET(GEORGES_EDITOR_RCS georges_editor_qt.qrc)
|
SET(GEORGES_EDITOR_RCS georges_editor_qt.qrc)
|
||||||
|
|
||||||
SET(QT_USE_QTGUI TRUE)
|
SET(QT_USE_QTGUI TRUE)
|
||||||
|
|
|
@ -0,0 +1,150 @@
|
||||||
|
|
||||||
|
|
||||||
|
#include "completer_line_edit.h"
|
||||||
|
|
||||||
|
#include <QKeyEvent>
|
||||||
|
#include <QtGui/QListView>
|
||||||
|
#include <QtGui/QStringListModel>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QScrollBar>
|
||||||
|
|
||||||
|
CompleteLineEdit::CompleteLineEdit(QWidget *parent, QStringList words)
|
||||||
|
: QLineEdit(parent), _words(words)
|
||||||
|
{
|
||||||
|
listView = new QListView(this);
|
||||||
|
model = new QStringListModel(this);
|
||||||
|
listView->setModel(model);
|
||||||
|
listView->setWindowFlags(Qt::ToolTip);
|
||||||
|
listView->setUniformItemSizes(true);
|
||||||
|
|
||||||
|
connect(this, SIGNAL(textChanged(const QString &)), this, SLOT(setCompleter(const QString &)));
|
||||||
|
connect(listView, SIGNAL(clicked(const QModelIndex &)), this, SLOT(completeText(const QModelIndex &)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CompleteLineEdit::setStringList(QStringList list)
|
||||||
|
{
|
||||||
|
_words = list;
|
||||||
|
}
|
||||||
|
|
||||||
|
//void CompleteLineEdit::focusOutEvent(QFocusEvent *e)
|
||||||
|
//{
|
||||||
|
// listView->hide();
|
||||||
|
//}
|
||||||
|
|
||||||
|
void CompleteLineEdit::keyPressEvent(QKeyEvent *e)
|
||||||
|
{
|
||||||
|
if (!listView->isHidden())
|
||||||
|
{
|
||||||
|
int key = e->key();
|
||||||
|
int count = listView->model()->rowCount();
|
||||||
|
QModelIndex currentIndex = listView->currentIndex();
|
||||||
|
|
||||||
|
if (Qt::Key_Down == key)
|
||||||
|
{
|
||||||
|
int row = currentIndex.row() + 1;
|
||||||
|
if (row >= count)
|
||||||
|
{
|
||||||
|
row = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
QModelIndex index = listView->model()->index(row, 0);
|
||||||
|
listView->setCurrentIndex(index);
|
||||||
|
}
|
||||||
|
else if (Qt::Key_Up == key)
|
||||||
|
{
|
||||||
|
int row = currentIndex.row() - 1;
|
||||||
|
if (row < 0)
|
||||||
|
{
|
||||||
|
row = count - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
QModelIndex index = listView->model()->index(row, 0);
|
||||||
|
listView->setCurrentIndex(index);
|
||||||
|
}
|
||||||
|
else if (Qt::Key_Escape == key)
|
||||||
|
{
|
||||||
|
listView->hide();
|
||||||
|
}
|
||||||
|
else if (Qt::Key_Enter == key || Qt::Key_Return == key)
|
||||||
|
{
|
||||||
|
if (currentIndex.isValid())
|
||||||
|
{
|
||||||
|
QString text = listView->currentIndex().data().toString();
|
||||||
|
setText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
listView->hide();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//listView->hide();
|
||||||
|
QLineEdit::keyPressEvent(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QLineEdit::keyPressEvent(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CompleteLineEdit::setCompleter(const QString &text)
|
||||||
|
{
|
||||||
|
if (text.isEmpty())
|
||||||
|
{
|
||||||
|
listView->hide();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((text.length() > 1) && (!listView->isHidden()))
|
||||||
|
{
|
||||||
|
//return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList sl;
|
||||||
|
Q_FOREACH(QString word, _words)
|
||||||
|
{
|
||||||
|
if (word.contains(text))
|
||||||
|
{
|
||||||
|
sl << word;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sl.isEmpty())
|
||||||
|
{
|
||||||
|
if (_words.isEmpty())
|
||||||
|
{
|
||||||
|
setText(tr("No files found"));
|
||||||
|
setEnabled(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
model->setStringList(_words);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
model->setStringList(sl);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Position the text edit
|
||||||
|
listView->setMinimumWidth(width());
|
||||||
|
listView->setMaximumWidth(width());
|
||||||
|
//listView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
|
|
||||||
|
QPoint p(0, height());
|
||||||
|
int x = mapToGlobal(p).x();
|
||||||
|
int y = mapToGlobal(p).y() + 1;
|
||||||
|
|
||||||
|
listView->move(x, y);
|
||||||
|
if(!listView->isVisible())
|
||||||
|
listView->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CompleteLineEdit::completeText(const QModelIndex &index)
|
||||||
|
{
|
||||||
|
QString text = index.data().toString();
|
||||||
|
setText(text);
|
||||||
|
listView->hide();
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
#ifndef COMPLETELINEEDIT_H
|
||||||
|
#define COMPLETELINEEDIT_H
|
||||||
|
|
||||||
|
|
||||||
|
// code from
|
||||||
|
// http://www.cppblog.com/biao/archive/2009/10/31/99873.html
|
||||||
|
// there was no license attached
|
||||||
|
|
||||||
|
#include <QtGui/QLineEdit>
|
||||||
|
#include <QStringList>
|
||||||
|
|
||||||
|
class QListView;
|
||||||
|
class QStringListModel;
|
||||||
|
class QModelIndex;
|
||||||
|
|
||||||
|
class CompleteLineEdit : public QLineEdit
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
CompleteLineEdit(QWidget *parent = 0, QStringList words = QStringList());
|
||||||
|
|
||||||
|
void setStringList(QStringList list);
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
|
void setCompleter(const QString &text);
|
||||||
|
void completeText(const QModelIndex &index);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void keyPressEvent(QKeyEvent *e);
|
||||||
|
//virtual void focusOutEvent(QFocusEvent *e);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QStringList _words;
|
||||||
|
QListView *listView;
|
||||||
|
QStringListModel *model;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // COMPLETELINEEDIT_H
|
|
@ -1,19 +1,19 @@
|
||||||
/*
|
/*
|
||||||
Georges Editor Qt
|
Georges Editor Qt
|
||||||
Copyright (C) 2010 Adrian Jaekel <aj at elane2k dot com>
|
Copyright (C) 2010 Adrian Jaekel <aj at elane2k dot com>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -38,188 +38,200 @@ using namespace std;
|
||||||
using namespace NLMISC;
|
using namespace NLMISC;
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT {
|
||||||
|
|
||||||
CConfiguration::CConfiguration()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
CConfiguration::~CConfiguration()
|
CConfiguration::CConfiguration() : _progressCB(0)
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void CConfiguration::init()
|
|
||||||
{
|
|
||||||
// load config
|
|
||||||
QFile file(NLQT_CONFIG_FILE);
|
|
||||||
if (!file.exists()) {
|
|
||||||
file.open( QIODevice::WriteOnly | QIODevice::Text );
|
|
||||||
file.write("GraphicsDrivers = { \"OpenGL\", \"Direct3D\" };");
|
|
||||||
file.write("\nSearchPaths = {\"\"};");
|
|
||||||
file.write("\nRemapExtensions = { \"png\", \"tga\" };");
|
|
||||||
file.write("\nBackgroundColor = { 0, 0, 0 };");
|
|
||||||
//file.write("\nQtStyle = \"\";");
|
|
||||||
//file.write("\nQtPalette = \"\";");
|
|
||||||
file.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
ConfigFile.load(NLQT_CONFIG_FILE);
|
|
||||||
} catch(...) {
|
|
||||||
}
|
|
||||||
|
|
||||||
addLeveldesignPath();
|
|
||||||
addSearchPaths();
|
|
||||||
configRemapExtensions();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CConfiguration::release()
|
|
||||||
{
|
|
||||||
//Modules::config().dropCallback("SearchPaths");
|
|
||||||
|
|
||||||
// save and release the config file
|
|
||||||
if (ConfigFile.exists("SaveConfig") && ConfigFile.getVarPtr("SaveConfig")->asBool())
|
|
||||||
{
|
{
|
||||||
ConfigFile.save();
|
|
||||||
}
|
}
|
||||||
ConfigFile.clear();
|
|
||||||
|
|
||||||
// release the search paths etc
|
|
||||||
CPath::releaseInstance();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CConfiguration::updateUtilities()
|
|
||||||
{
|
|
||||||
//H_AUTO2
|
|
||||||
CConfigFile::checkConfigFiles();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CConfiguration::addLeveldesignPath()
|
CConfiguration::~CConfiguration()
|
||||||
{
|
|
||||||
std::vector<std::string> list;
|
|
||||||
list.push_back(Modules::config().getValue("LeveldesignPath", QString("").toStdString()));
|
|
||||||
addSearchPaths(&list);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CConfiguration::configRemapExtensions()
|
|
||||||
{
|
|
||||||
CConfigFile::CVar *var;
|
|
||||||
var = ConfigFile.getVarPtr("RemapExtensions");
|
|
||||||
uint varsize = var->size();
|
|
||||||
for (uint i = 0; i < varsize; i += 2)
|
|
||||||
CPath::remapExtension(var->asString(i), var->asString(i + 1), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
float CConfiguration::getValue(const string &varName, float defaultValue)
|
|
||||||
{
|
|
||||||
if (ConfigFile.exists(varName)) return ConfigFile.getVar(varName).asFloat();
|
|
||||||
CConfigFile::CVar varToCopy;
|
|
||||||
varToCopy.forceAsDouble((double)defaultValue);
|
|
||||||
ConfigFile.insertVar(varName, varToCopy);
|
|
||||||
return defaultValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
double CConfiguration::getValue(const string &varName, double defaultValue)
|
|
||||||
{
|
|
||||||
if (ConfigFile.exists(varName)) return ConfigFile.getVar(varName).asDouble();
|
|
||||||
CConfigFile::CVar varToCopy;
|
|
||||||
varToCopy.forceAsDouble(defaultValue);
|
|
||||||
ConfigFile.insertVar(varName, varToCopy);
|
|
||||||
return defaultValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
int CConfiguration::getValue(const string &varName, int defaultValue)
|
|
||||||
{
|
|
||||||
if (ConfigFile.exists(varName)) return ConfigFile.getVar(varName).asInt();
|
|
||||||
CConfigFile::CVar varToCopy;
|
|
||||||
varToCopy.forceAsInt(defaultValue);
|
|
||||||
ConfigFile.insertVar(varName, varToCopy);
|
|
||||||
return defaultValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
string CConfiguration::getValue(const string &varName, const string &defaultValue)
|
|
||||||
{
|
|
||||||
if (ConfigFile.exists(varName)) return ConfigFile.getVar(varName).asString();
|
|
||||||
CConfigFile::CVar varToCopy;
|
|
||||||
varToCopy.forceAsString(defaultValue);
|
|
||||||
ConfigFile.insertVar(varName, varToCopy);
|
|
||||||
return defaultValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
ucstring CConfiguration::getValue(const string &varName, const ucstring &defaultValue)
|
|
||||||
{
|
|
||||||
if (ConfigFile.exists(varName)) return ucstring::makeFromUtf8(ConfigFile.getVar(varName).asString());
|
|
||||||
CConfigFile::CVar varToCopy;
|
|
||||||
varToCopy.forceAsString(defaultValue.toUtf8());
|
|
||||||
ConfigFile.insertVar(varName, varToCopy);
|
|
||||||
return defaultValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CConfiguration::getValue(const string &varName, bool defaultValue)
|
|
||||||
{
|
|
||||||
if (ConfigFile.exists(varName)) return ConfigFile.getVar(varName).asBool();
|
|
||||||
CConfigFile::CVar varToCopy;
|
|
||||||
varToCopy.forceAsInt(defaultValue ? 1 : 0);
|
|
||||||
ConfigFile.insertVar(varName, varToCopy);
|
|
||||||
return defaultValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
CRGBA CConfiguration::getValue(const string &varName, const CRGBA &defaultValue)
|
|
||||||
{
|
|
||||||
if (ConfigFile.exists(varName))
|
|
||||||
{
|
{
|
||||||
return getValue(ConfigFile.getVar(varName), defaultValue);
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
// create a new value only if one doesn't exist
|
|
||||||
CConfigFile::CVar varToCopy;
|
|
||||||
varToCopy.forceAsInt(defaultValue.R);
|
|
||||||
varToCopy.setAsInt(defaultValue.G, 1);
|
|
||||||
varToCopy.setAsInt(defaultValue.B, 2);
|
|
||||||
varToCopy.setAsInt(defaultValue.A, 3);
|
|
||||||
ConfigFile.insertVar(varName, varToCopy);
|
|
||||||
}
|
|
||||||
return defaultValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
CRGBA CConfiguration::getValue(const CConfigFile::CVar &var, const CRGBA &defaultValue)
|
void CConfiguration::init()
|
||||||
{
|
{
|
||||||
if (var.size() >= 3)
|
// load config
|
||||||
{
|
QFile file(NLQT_CONFIG_FILE);
|
||||||
if (var.size() > 4) nlwarning("RGBA value in config value '%s' is too long, ignoring unused values");
|
if (!file.exists()) {
|
||||||
return CRGBA((uint8)var.asInt(0), (uint8)var.asInt(1), (uint8)var.asInt(2), var.size() >= 4 ? (uint8)var.asInt(3) : 255);
|
file.open( QIODevice::WriteOnly | QIODevice::Text );
|
||||||
}
|
file.write("GraphicsDrivers = { \"OpenGL\", \"Direct3D\" };");
|
||||||
nlwarning("Invalid RGBA value in config value '%s', reverting to default { %i, %i, %i, %i }", var.Name.c_str(), (sint)defaultValue.R, (sint)defaultValue.G, (sint)defaultValue.B, (sint)defaultValue.A);
|
file.write("\nSearchPaths = {\"\"};");
|
||||||
return defaultValue;
|
file.write("\nRemapExtensions = { \"png\", \"tga\" };");
|
||||||
}
|
file.write("\nBackgroundColor = { 0, 0, 0 };");
|
||||||
|
//file.write("\nQtStyle = \"\";");
|
||||||
void CConfiguration::addSearchPaths(std::vector<std::string>* list)
|
//file.write("\nQtPalette = \"\";");
|
||||||
{
|
file.close();
|
||||||
//Modules::config().getConfigFile().getVar("SearchPaths");
|
|
||||||
|
|
||||||
std::vector<std::string> *tmpList = list;
|
|
||||||
if (!tmpList)
|
|
||||||
{
|
|
||||||
NLMISC::CConfigFile::CVar v = getConfigFile().getVar("SearchPaths");
|
|
||||||
tmpList = new std::vector<std::string>();
|
|
||||||
for (uint i = 0; i < v.size(); ++i)
|
|
||||||
{
|
|
||||||
tmpList->push_back(v.asString(i));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
ConfigFile.load(NLQT_CONFIG_FILE);
|
||||||
|
} catch(...) {
|
||||||
|
}
|
||||||
|
|
||||||
|
addLeveldesignPath();
|
||||||
|
addSearchPaths();
|
||||||
|
configRemapExtensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint listsize = tmpList->size();
|
void CConfiguration::release()
|
||||||
for (uint i = 0; i < listsize; ++i)
|
|
||||||
{
|
{
|
||||||
CProgressDialog pcb;
|
//Modules::config().dropCallback("SearchPaths");
|
||||||
pcb.DisplayString = tmpList->at(i);
|
|
||||||
pcb.show();
|
// save and release the config file
|
||||||
CPath::addSearchPath(tmpList->at(i), true, false, &pcb);
|
if (ConfigFile.exists("SaveConfig") && ConfigFile.getVarPtr("SaveConfig")->asBool())
|
||||||
|
{
|
||||||
|
ConfigFile.save();
|
||||||
|
}
|
||||||
|
ConfigFile.clear();
|
||||||
|
|
||||||
|
// release the search paths etc
|
||||||
|
CPath::releaseInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConfiguration::updateUtilities()
|
||||||
|
{
|
||||||
|
//H_AUTO2
|
||||||
|
CConfigFile::checkConfigFiles();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConfiguration::addLeveldesignPath()
|
||||||
|
{
|
||||||
|
std::vector<std::string> list;
|
||||||
|
list.push_back(Modules::config().getValue("LeveldesignPath", QString("").toStdString()));
|
||||||
|
addSearchPaths(&list);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConfiguration::configRemapExtensions()
|
||||||
|
{
|
||||||
|
CConfigFile::CVar *var;
|
||||||
|
var = ConfigFile.getVarPtr("RemapExtensions");
|
||||||
|
uint varsize = var->size();
|
||||||
|
for (uint i = 0; i < varsize; i += 2)
|
||||||
|
CPath::remapExtension(var->asString(i), var->asString(i + 1), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
float CConfiguration::getValue(const string &varName, float defaultValue)
|
||||||
|
{
|
||||||
|
if (ConfigFile.exists(varName)) return ConfigFile.getVar(varName).asFloat();
|
||||||
|
CConfigFile::CVar varToCopy;
|
||||||
|
varToCopy.forceAsDouble((double)defaultValue);
|
||||||
|
ConfigFile.insertVar(varName, varToCopy);
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
double CConfiguration::getValue(const string &varName, double defaultValue)
|
||||||
|
{
|
||||||
|
if (ConfigFile.exists(varName)) return ConfigFile.getVar(varName).asDouble();
|
||||||
|
CConfigFile::CVar varToCopy;
|
||||||
|
varToCopy.forceAsDouble(defaultValue);
|
||||||
|
ConfigFile.insertVar(varName, varToCopy);
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CConfiguration::getValue(const string &varName, int defaultValue)
|
||||||
|
{
|
||||||
|
if (ConfigFile.exists(varName)) return ConfigFile.getVar(varName).asInt();
|
||||||
|
CConfigFile::CVar varToCopy;
|
||||||
|
varToCopy.forceAsInt(defaultValue);
|
||||||
|
ConfigFile.insertVar(varName, varToCopy);
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
string CConfiguration::getValue(const string &varName, const string &defaultValue)
|
||||||
|
{
|
||||||
|
if (ConfigFile.exists(varName)) return ConfigFile.getVar(varName).asString();
|
||||||
|
CConfigFile::CVar varToCopy;
|
||||||
|
varToCopy.forceAsString(defaultValue);
|
||||||
|
ConfigFile.insertVar(varName, varToCopy);
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
ucstring CConfiguration::getValue(const string &varName, const ucstring &defaultValue)
|
||||||
|
{
|
||||||
|
if (ConfigFile.exists(varName)) return ucstring::makeFromUtf8(ConfigFile.getVar(varName).asString());
|
||||||
|
CConfigFile::CVar varToCopy;
|
||||||
|
varToCopy.forceAsString(defaultValue.toUtf8());
|
||||||
|
ConfigFile.insertVar(varName, varToCopy);
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CConfiguration::getValue(const string &varName, bool defaultValue)
|
||||||
|
{
|
||||||
|
if (ConfigFile.exists(varName)) return ConfigFile.getVar(varName).asBool();
|
||||||
|
CConfigFile::CVar varToCopy;
|
||||||
|
varToCopy.forceAsInt(defaultValue ? 1 : 0);
|
||||||
|
ConfigFile.insertVar(varName, varToCopy);
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
CRGBA CConfiguration::getValue(const string &varName, const CRGBA &defaultValue)
|
||||||
|
{
|
||||||
|
if (ConfigFile.exists(varName))
|
||||||
|
{
|
||||||
|
return getValue(ConfigFile.getVar(varName), defaultValue);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// create a new value only if one doesn't exist
|
||||||
|
CConfigFile::CVar varToCopy;
|
||||||
|
varToCopy.forceAsInt(defaultValue.R);
|
||||||
|
varToCopy.setAsInt(defaultValue.G, 1);
|
||||||
|
varToCopy.setAsInt(defaultValue.B, 2);
|
||||||
|
varToCopy.setAsInt(defaultValue.A, 3);
|
||||||
|
ConfigFile.insertVar(varName, varToCopy);
|
||||||
|
}
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
CRGBA CConfiguration::getValue(const CConfigFile::CVar &var, const CRGBA &defaultValue)
|
||||||
|
{
|
||||||
|
if (var.size() >= 3)
|
||||||
|
{
|
||||||
|
if (var.size() > 4) nlwarning("RGBA value in config value '%s' is too long, ignoring unused values");
|
||||||
|
return CRGBA((uint8)var.asInt(0), (uint8)var.asInt(1), (uint8)var.asInt(2), var.size() >= 4 ? (uint8)var.asInt(3) : 255);
|
||||||
|
}
|
||||||
|
nlwarning("Invalid RGBA value in config value '%s', reverting to default { %i, %i, %i, %i }", var.Name.c_str(), (sint)defaultValue.R, (sint)defaultValue.G, (sint)defaultValue.B, (sint)defaultValue.A);
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConfiguration::addSearchPaths(std::vector<std::string>* list)
|
||||||
|
{
|
||||||
|
//Modules::config().getConfigFile().getVar("SearchPaths");
|
||||||
|
|
||||||
|
std::vector<std::string> *tmpList = list;
|
||||||
|
if (!tmpList)
|
||||||
|
{
|
||||||
|
NLMISC::CConfigFile::CVar v = getConfigFile().getVar("SearchPaths");
|
||||||
|
tmpList = new std::vector<std::string>();
|
||||||
|
for (uint i = 0; i < v.size(); ++i)
|
||||||
|
{
|
||||||
|
tmpList->push_back(v.asString(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint listsize = tmpList->size();
|
||||||
|
for (uint i = 0; i < listsize; ++i)
|
||||||
|
{
|
||||||
|
if(_progressCB) {
|
||||||
|
_progressCB->DisplayString = tmpList->at(i);
|
||||||
|
CPath::addSearchPath(tmpList->at(i), true, false, _progressCB);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CProgressDialog pcb;
|
||||||
|
pcb.DisplayString = tmpList->at(i);
|
||||||
|
pcb.show();
|
||||||
|
CPath::addSearchPath(tmpList->at(i), true, false, &pcb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!list)
|
||||||
|
delete tmpList;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConfiguration::setProgressCallback(NLMISC::IProgressCallback *cb)
|
||||||
|
{
|
||||||
|
_progressCB = cb;
|
||||||
}
|
}
|
||||||
if (!list)
|
|
||||||
delete tmpList;
|
|
||||||
}
|
|
||||||
|
|
||||||
} /* namespace NLQT */
|
} /* namespace NLQT */
|
|
@ -1,19 +1,19 @@
|
||||||
/*
|
/*
|
||||||
Georges Editor Qt
|
Georges Editor Qt
|
||||||
Copyright (C) 2010 Adrian Jaekel <aj at elane2k dot com>
|
Copyright (C) 2010 Adrian Jaekel <aj at elane2k dot com>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -34,46 +34,54 @@
|
||||||
|
|
||||||
#define NLQT_CONFIG_FILE "georges_editor.cfg"
|
#define NLQT_CONFIG_FILE "georges_editor.cfg"
|
||||||
|
|
||||||
|
namespace NLMISC {
|
||||||
|
class IProgressCallback;
|
||||||
|
}
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CConfiguration
|
* CConfiguration
|
||||||
* \brief CConfiguration
|
* \brief CConfiguration
|
||||||
* \date 2010-02-05 15:44GMT
|
* \date 2010-02-05 15:44GMT
|
||||||
* \author Jan Boon (Kaetemi)
|
* \author Jan Boon (Kaetemi)
|
||||||
*/
|
*/
|
||||||
class CConfiguration
|
class CConfiguration
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CConfiguration();
|
CConfiguration();
|
||||||
virtual ~CConfiguration();
|
virtual ~CConfiguration();
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
void release();
|
void release();
|
||||||
|
|
||||||
void updateUtilities();
|
|
||||||
void configRemapExtensions();
|
|
||||||
void addSearchPaths(std::vector<std::string>* list = 0);
|
|
||||||
void addLeveldesignPath();
|
|
||||||
|
|
||||||
float getValue(const std::string &varName, float defaultValue);
|
void updateUtilities();
|
||||||
double getValue(const std::string &varName, double defaultValue);
|
void configRemapExtensions();
|
||||||
int getValue(const std::string &varName, int defaultValue);
|
void addSearchPaths(std::vector<std::string>* list = 0);
|
||||||
std::string getValue(const std::string &varName, const std::string &defaultValue);
|
void addLeveldesignPath();
|
||||||
ucstring getValue(const std::string &varName, const ucstring &defaultValue);
|
|
||||||
bool getValue(const std::string &varName, bool defaultValue);
|
|
||||||
NLMISC::CRGBA getValue(const std::string &varName, const NLMISC::CRGBA &defaultValue);
|
|
||||||
NLMISC::CRGBA getValue(const NLMISC::CConfigFile::CVar &var, const NLMISC::CRGBA &defaultValue);
|
|
||||||
|
|
||||||
inline NLMISC::CConfigFile &getConfigFile() { return ConfigFile; }
|
|
||||||
|
|
||||||
private:
|
void setProgressCallback(NLMISC::IProgressCallback *_progressCB);
|
||||||
CConfiguration(const CConfiguration &);
|
|
||||||
CConfiguration &operator=(const CConfiguration &);
|
|
||||||
|
|
||||||
NLMISC::CConfigFile ConfigFile;
|
float getValue(const std::string &varName, float defaultValue);
|
||||||
|
double getValue(const std::string &varName, double defaultValue);
|
||||||
};/* class CConfiguration */
|
int getValue(const std::string &varName, int defaultValue);
|
||||||
|
std::string getValue(const std::string &varName, const std::string &defaultValue);
|
||||||
|
ucstring getValue(const std::string &varName, const ucstring &defaultValue);
|
||||||
|
bool getValue(const std::string &varName, bool defaultValue);
|
||||||
|
NLMISC::CRGBA getValue(const std::string &varName, const NLMISC::CRGBA &defaultValue);
|
||||||
|
NLMISC::CRGBA getValue(const NLMISC::CConfigFile::CVar &var, const NLMISC::CRGBA &defaultValue);
|
||||||
|
|
||||||
|
inline NLMISC::CConfigFile &getConfigFile() { return ConfigFile; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
CConfiguration(const CConfiguration &);
|
||||||
|
CConfiguration &operator=(const CConfiguration &);
|
||||||
|
|
||||||
|
NLMISC::CConfigFile ConfigFile;
|
||||||
|
|
||||||
|
NLMISC::IProgressCallback *_progressCB;
|
||||||
|
|
||||||
|
};/* class CConfiguration */
|
||||||
|
|
||||||
} /* namespace NLQT */
|
} /* namespace NLQT */
|
||||||
|
|
||||||
|
|
|
@ -76,23 +76,23 @@ CEntity::~CEntity(void)
|
||||||
if (_PlayList != NULL)
|
if (_PlayList != NULL)
|
||||||
{
|
{
|
||||||
_PlayList->resetAllChannels();
|
_PlayList->resetAllChannels();
|
||||||
Modules::objViewInt().getPlayListManager()->deletePlayList (_PlayList);
|
Modules::objViewInt()->getPlayListManager()->deletePlayList (_PlayList);
|
||||||
_PlayList = NULL;
|
_PlayList = NULL;
|
||||||
}
|
}
|
||||||
if (_AnimationSet != NULL)
|
if (_AnimationSet != NULL)
|
||||||
{
|
{
|
||||||
Modules::objViewInt().getDriver()->deleteAnimationSet(_AnimationSet);
|
Modules::objViewInt()->getDriver()->deleteAnimationSet(_AnimationSet);
|
||||||
_AnimationSet = NULL;
|
_AnimationSet = NULL;
|
||||||
}
|
}
|
||||||
if (!_Skeleton.empty())
|
if (!_Skeleton.empty())
|
||||||
{
|
{
|
||||||
_Skeleton.detachSkeletonSon(_Instance);
|
_Skeleton.detachSkeletonSon(_Instance);
|
||||||
Modules::objViewInt().getScene()->deleteSkeleton(_Skeleton);
|
Modules::objViewInt()->getScene()->deleteSkeleton(_Skeleton);
|
||||||
_Skeleton = NULL;
|
_Skeleton = NULL;
|
||||||
}
|
}
|
||||||
if (!_Instance.empty())
|
if (!_Instance.empty())
|
||||||
{
|
{
|
||||||
Modules::objViewInt().getScene()->deleteInstance(_Instance);
|
Modules::objViewInt()->getScene()->deleteInstance(_Instance);
|
||||||
_Instance = NULL;
|
_Instance = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,13 @@ namespace NLQT
|
||||||
if (value.isEmpty() || !mp || !m)
|
if (value.isEmpty() || !mp || !m)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
const NLGEORGES::UType *type = m->getItem(mp->mapToSource(index))->getFormElm()->getType();
|
CFormItem* curItem = m->getItem(mp->mapToSource(index));
|
||||||
|
NLGEORGES::UFormElm *curElm = curItem->getFormElm();
|
||||||
|
if (!curElm) {
|
||||||
|
// TODO: create new Element
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
const NLGEORGES::UType *type = curElm->getType();
|
||||||
if(type)
|
if(type)
|
||||||
{
|
{
|
||||||
int numDefinitions = type->getNumDefinition();
|
int numDefinitions = type->getNumDefinition();
|
||||||
|
@ -273,36 +279,36 @@ namespace NLQT
|
||||||
//option.decorationAlignment = QStyleOptionViewItem::Right;
|
//option.decorationAlignment = QStyleOptionViewItem::Right;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
//void FormDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||||
{
|
//{
|
||||||
QStyleOptionViewItemV4 optionV4 = option;
|
// QStyleOptionViewItemV4 optionV4 = option;
|
||||||
optionV4.decorationPosition = QStyleOptionViewItem::Right;
|
// optionV4.decorationPosition = QStyleOptionViewItem::Right;
|
||||||
//optionV4.decorationSize = QSize(32,32);
|
// //optionV4.decorationSize = QSize(32,32);
|
||||||
initStyleOption(&optionV4, index);
|
// initStyleOption(&optionV4, index);
|
||||||
|
|
||||||
QStyledItemDelegate::paint(painter,optionV4,index);
|
// QStyledItemDelegate::paint(painter,optionV4,index);
|
||||||
|
|
||||||
//QStyle *style = optionV4.widget? optionV4.widget->style() : QApplication::style();
|
// //QStyle *style = optionV4.widget? optionV4.widget->style() : QApplication::style();
|
||||||
|
|
||||||
//QTextDocument doc;
|
// //QTextDocument doc;
|
||||||
//doc.setHtml(optionV4.text);
|
// //doc.setHtml(optionV4.text);
|
||||||
|
|
||||||
///// Painting item without text
|
// ///// Painting item without text
|
||||||
//optionV4.text = QString();
|
// //optionV4.text = QString();
|
||||||
//style->drawControl(QStyle::CE_ItemViewItem, &optionV4, painter);
|
// //style->drawControl(QStyle::CE_ItemViewItem, &optionV4, painter);
|
||||||
|
|
||||||
//QAbstractTextDocumentLayout::PaintContext ctx;
|
// //QAbstractTextDocumentLayout::PaintContext ctx;
|
||||||
|
|
||||||
//// Highlighting text if item is selected
|
// //// Highlighting text if item is selected
|
||||||
//if (optionV4.state & QStyle::State_Selected)
|
// //if (optionV4.state & QStyle::State_Selected)
|
||||||
// ctx.palette.setColor(QPalette::Text, optionV4.palette.color(QPalette::Active, QPalette::HighlightedText));
|
// // ctx.palette.setColor(QPalette::Text, optionV4.palette.color(QPalette::Active, QPalette::HighlightedText));
|
||||||
|
|
||||||
//QRect textRect = style->subElementRect(QStyle::SE_ItemViewItemText, &optionV4);
|
// //QRect textRect = style->subElementRect(QStyle::SE_ItemViewItemText, &optionV4);
|
||||||
//painter->save();
|
// //painter->save();
|
||||||
//painter->translate(textRect.topLeft());
|
// //painter->translate(textRect.topLeft());
|
||||||
//painter->setClipRect(textRect.translated(-textRect.topLeft()));
|
// //painter->setClipRect(textRect.translated(-textRect.topLeft()));
|
||||||
//doc.documentLayout()->draw(painter, ctx);
|
// //doc.documentLayout()->draw(painter, ctx);
|
||||||
//painter->restore();
|
// //painter->restore();
|
||||||
}
|
//}
|
||||||
|
|
||||||
} /* namespace NLQT */
|
} /* namespace NLQT */
|
||||||
|
|
|
@ -37,8 +37,8 @@ namespace NLQT
|
||||||
const QModelIndex &index) const;
|
const QModelIndex &index) const;
|
||||||
void updateEditorGeometry(QWidget *editor,
|
void updateEditorGeometry(QWidget *editor,
|
||||||
const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||||
void paint ( QPainter * painter, const QStyleOptionViewItem & option,
|
//void paint ( QPainter * painter, const QStyleOptionViewItem & option,
|
||||||
const QModelIndex & index ) const;
|
// const QModelIndex & index ) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
// NeL includes
|
// NeL includes
|
||||||
|
#include <nel/misc/o_xml.h>
|
||||||
#include <nel/georges/u_type.h>
|
#include <nel/georges/u_type.h>
|
||||||
|
#include <nel/georges/form.h>
|
||||||
|
|
||||||
namespace NLQT
|
namespace NLQT
|
||||||
{
|
{
|
||||||
|
@ -101,19 +103,61 @@ namespace NLQT
|
||||||
case NLGEORGES::UType::SignedInt:
|
case NLGEORGES::UType::SignedInt:
|
||||||
case NLGEORGES::UType::Double:
|
case NLGEORGES::UType::Double:
|
||||||
case NLGEORGES::UType::String:
|
case NLGEORGES::UType::String:
|
||||||
nldebug(QString("string %1 %2")
|
if (parentItem->formElm->isArray())
|
||||||
.arg(itemData[0].toString()).arg(value.toString())
|
{
|
||||||
.toStdString().c_str());
|
//((NLGEORGES::CFormElm*)parentItem->formElm);//->arrayInsertNodeByName(
|
||||||
parentItem->formElm->setValueByName(
|
//if(parentItem->formElm->getArrayNode(elmName, num))
|
||||||
value.toString().toStdString().c_str(),itemData[0].toString().toStdString().c_str());
|
//{
|
||||||
|
//}
|
||||||
|
|
||||||
|
bool ok;
|
||||||
|
// TODO: the node can be renamed from eg "#0" to "foobar"
|
||||||
|
int arrayIndex = itemData[0].toString().remove("#").toInt(&ok);
|
||||||
|
if(ok)
|
||||||
|
{
|
||||||
|
NLGEORGES::UFormElm *elmt = 0;
|
||||||
|
if(parentItem->formElm->getArrayNode(&elmt, arrayIndex) && elmt)
|
||||||
|
{
|
||||||
|
if (elmt->isAtom())
|
||||||
|
{
|
||||||
|
((NLGEORGES::CFormElmAtom*)elmt)->setValue(value.toString().toStdString().c_str());
|
||||||
|
nldebug(QString("array element string %1 %2")
|
||||||
|
.arg(itemData[0].toString()).arg(value.toString())
|
||||||
|
.toStdString().c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(parentItem->formElm->setValueByName(
|
||||||
|
value.toString().toStdString().c_str(),
|
||||||
|
itemData[0].toString().toStdString().c_str()))
|
||||||
|
{
|
||||||
|
nldebug(QString("string %1 %2")
|
||||||
|
.arg(itemData[0].toString()).arg(value.toString())
|
||||||
|
.toStdString().c_str());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nldebug(QString("FAILED string %1 %2")
|
||||||
|
.arg(itemData[0].toString()).arg(value.toString())
|
||||||
|
.toStdString().c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case NLGEORGES::UType::Color:
|
case NLGEORGES::UType::Color:
|
||||||
|
nldebug("Color is TODO");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nldebug("setting sth other than Atom");
|
||||||
|
}
|
||||||
//formElm->setValueByName();
|
//formElm->setValueByName();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
// NeL includes
|
// NeL includes
|
||||||
#include <nel/georges/u_form_loader.h>
|
#include <nel/georges/u_form_loader.h>
|
||||||
#include <nel/georges/u_form.h>
|
#include <nel/georges/u_form.h>
|
||||||
|
#include <nel/georges/u_type.h>
|
||||||
|
|
||||||
// Project includes
|
// Project includes
|
||||||
|
|
||||||
|
@ -48,4 +49,18 @@ namespace NLQT
|
||||||
return form;
|
return form;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UFormDfn *CGeorges::loadFormDfn(std::string formName)
|
||||||
|
{
|
||||||
|
UFormDfn *formdfn = FormLoader->loadFormDfn(formName.c_str());
|
||||||
|
|
||||||
|
return formdfn;
|
||||||
|
}
|
||||||
|
|
||||||
|
UType *CGeorges::loadFormType(std::string formName)
|
||||||
|
{
|
||||||
|
UType *type = FormLoader->loadFormType(formName.c_str());
|
||||||
|
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
} /* namespace NLQT */
|
} /* namespace NLQT */
|
||||||
|
|
|
@ -32,7 +32,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
namespace NLGEORGES
|
namespace NLGEORGES
|
||||||
{
|
{
|
||||||
|
class UType;
|
||||||
class UForm;
|
class UForm;
|
||||||
|
class UFormDfn;
|
||||||
class UFormLoader;
|
class UFormLoader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,6 +56,10 @@ namespace NLQT
|
||||||
|
|
||||||
// Load the given form root
|
// Load the given form root
|
||||||
UForm* loadForm(std::string formName);
|
UForm* loadForm(std::string formName);
|
||||||
|
// Load a dfn
|
||||||
|
UFormDfn* loadFormDfn(std::string formName);
|
||||||
|
// Load a type
|
||||||
|
UType *loadFormType (std::string formName);
|
||||||
|
|
||||||
// A form loader
|
// A form loader
|
||||||
UFormLoader *FormLoader;
|
UFormLoader *FormLoader;
|
||||||
|
|
|
@ -48,7 +48,7 @@ namespace NLQT
|
||||||
QString _ldPath;
|
QString _ldPath;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void selectedForm(QString);
|
void selectedForm(const QString);
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void ldPathChanged(QString path);
|
void ldPathChanged(QString path);
|
||||||
|
|
|
@ -9,5 +9,7 @@
|
||||||
<file>images/preferences.png</file>
|
<file>images/preferences.png</file>
|
||||||
<file>images/pqrticles.png</file>
|
<file>images/pqrticles.png</file>
|
||||||
<file>images/khead.png</file>
|
<file>images/khead.png</file>
|
||||||
|
<file>images/georges_logo.png</file>
|
||||||
|
<file>images/mp_generic.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
|
@ -0,0 +1,73 @@
|
||||||
|
/*
|
||||||
|
Georges Editor Qt
|
||||||
|
Copyright (C) 2010 Adrian Jaekel <aj at elane2k dot com>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "georges_splash.h"
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
|
#include <QtGui/QWidget>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QFileInfo>
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
namespace NLMISC {
|
||||||
|
class IProgressCallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
|
CGeorgesSplash::CGeorgesSplash(QWidget *parent)
|
||||||
|
: QWidget(parent)
|
||||||
|
{
|
||||||
|
_ui.setupUi(this);
|
||||||
|
|
||||||
|
setWindowFlags(Qt::SplashScreen);
|
||||||
|
_ui.imageLabel->setPixmap(
|
||||||
|
QPixmap(":/images/georges_logo.png").
|
||||||
|
scaledToHeight(_ui.imageLabel->height(),Qt::SmoothTransformation));
|
||||||
|
//setWindowIcon(QIcon(":/images/georges_logo.png"));
|
||||||
|
}
|
||||||
|
|
||||||
|
CGeorgesSplash::~CGeorgesSplash()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGeorgesSplash::progress (float progressValue)
|
||||||
|
{
|
||||||
|
QString display = DisplayString.c_str();
|
||||||
|
|
||||||
|
// UNCOMMENT if shorter strings are needed
|
||||||
|
//QFileInfo info(display);
|
||||||
|
//display = info.filePath();
|
||||||
|
//QString sec = display.section("/",-2,-1,
|
||||||
|
// QString::SectionSkipEmpty |
|
||||||
|
// QString::SectionIncludeTrailingSep |
|
||||||
|
// QString::SectionIncludeLeadingSep);
|
||||||
|
//if(display != sec)
|
||||||
|
// display = sec.prepend("...");
|
||||||
|
|
||||||
|
_ui.splashLabel->setText(QString(tr("Adding Folder:\n%1")).arg(display));
|
||||||
|
_ui.progressBar->setValue(getCropedValue(progressValue) * 100);
|
||||||
|
QApplication::processEvents();
|
||||||
|
}
|
||||||
|
} /* namespace NLQT */
|
|
@ -0,0 +1,56 @@
|
||||||
|
/*
|
||||||
|
Georges Editor Qt
|
||||||
|
Copyright (C) 2010 Adrian Jaekel <aj at elane2k dot com>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GEORGES_SPLASH_H
|
||||||
|
#define GEORGES_SPLASH_H
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
|
#include <QtGui/QWidget>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
#include <nel/misc/progress_callback.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "ui_splash.h"
|
||||||
|
|
||||||
|
namespace NLMISC {
|
||||||
|
class IProgressCallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace NLQT
|
||||||
|
{
|
||||||
|
class CGeorgesSplash: public QWidget, public NLMISC::IProgressCallback
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
Ui::CGeorgesSplash _ui;
|
||||||
|
|
||||||
|
void progress (float progressValue);
|
||||||
|
|
||||||
|
public:
|
||||||
|
CGeorgesSplash(QWidget *parent = 0);
|
||||||
|
~CGeorgesSplash();
|
||||||
|
}; /* CGeorgesSplash */
|
||||||
|
|
||||||
|
} /* namespace NLQT */
|
||||||
|
|
||||||
|
#endif // GEORGES_SPLASH_H
|
|
@ -25,10 +25,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
|
||||||
// NeL includes
|
// NeL includes
|
||||||
#include <nel/georges/u_form.h>
|
|
||||||
#include <nel/misc/path.h>
|
#include <nel/misc/path.h>
|
||||||
#include <nel/misc/file.h>
|
#include <nel/misc/file.h>
|
||||||
#include <nel/misc/o_xml.h>
|
#include <nel/misc/o_xml.h>
|
||||||
|
#include <nel/georges/form.h>
|
||||||
|
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "modules.h"
|
#include "modules.h"
|
||||||
|
@ -47,7 +47,7 @@ namespace NLQT
|
||||||
CGeorgesTreeViewDialog::CGeorgesTreeViewDialog(QWidget *parent /*= 0*/, bool emptyView /*= false*/)
|
CGeorgesTreeViewDialog::CGeorgesTreeViewDialog(QWidget *parent /*= 0*/, bool emptyView /*= false*/)
|
||||||
: QDockWidget(parent)
|
: QDockWidget(parent)
|
||||||
{
|
{
|
||||||
_georges = new NLQT::CGeorges;
|
_georges = new NLQT::CGeorges;
|
||||||
|
|
||||||
loadedForm = "";
|
loadedForm = "";
|
||||||
_modified = false;
|
_modified = false;
|
||||||
|
@ -80,14 +80,65 @@ namespace NLQT
|
||||||
CGeorgesTreeViewDialog::~CGeorgesTreeViewDialog()
|
CGeorgesTreeViewDialog::~CGeorgesTreeViewDialog()
|
||||||
{
|
{
|
||||||
delete _ui.treeView->itemDelegateForColumn(1);
|
delete _ui.treeView->itemDelegateForColumn(1);
|
||||||
|
delete _form;
|
||||||
deleteLater();
|
deleteLater();
|
||||||
//QSettings settings("RyzomCore", "GeorgesQt");
|
//QSettings settings("RyzomCore", "GeorgesQt");
|
||||||
//settings.setValue("dirViewGeometry", saveGeometry());
|
//settings.setValue("dirViewGeometry", saveGeometry());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGeorgesTreeViewDialog::selectedForm(QString formName)
|
void CGeorgesTreeViewDialog::setForm(const CForm *form)
|
||||||
{
|
{
|
||||||
_form = _georges->loadForm(formName.toStdString());
|
_form = (UForm*)form;
|
||||||
|
}
|
||||||
|
|
||||||
|
CForm* CGeorgesTreeViewDialog::getFormByName(const QString formName)
|
||||||
|
{
|
||||||
|
if(NLMISC::CPath::exists(formName.toStdString()))
|
||||||
|
{
|
||||||
|
return (CForm*)_georges->loadForm(formName.toStdString());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CForm *form = 0;
|
||||||
|
// Load the DFN
|
||||||
|
std::string extStr = NLMISC::CFile::getExtension( formName.toStdString() );
|
||||||
|
QString dfnName = QString("%1.dfn").arg(extStr.c_str());
|
||||||
|
UFormDfn *formdfn;
|
||||||
|
if (NLMISC::CPath::exists(dfnName.toStdString()))
|
||||||
|
{
|
||||||
|
formdfn = _georges->loadFormDfn (dfnName.toStdString());
|
||||||
|
if (!formdfn)
|
||||||
|
{
|
||||||
|
nlwarning("Failed to load dfn: %s", dfnName.toStdString().c_str());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nlwarning("Cannot find dfn: %s", dfnName.toStdString().c_str());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
form = new CForm;
|
||||||
|
|
||||||
|
// Build the root element
|
||||||
|
((CFormElmStruct*)&form->getRootNode())->build((CFormDfn*)formdfn);
|
||||||
|
|
||||||
|
uint i;
|
||||||
|
for (i=0; i<CForm::HeldElementCount; i++)
|
||||||
|
{
|
||||||
|
((CFormElmStruct*)(((CForm*)form)->HeldElements[i]))->build ((CFormDfn*)formdfn);
|
||||||
|
}
|
||||||
|
return form;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGeorgesTreeViewDialog::loadFormIntoDialog(CForm *form)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(form)
|
||||||
|
_form = form;
|
||||||
|
|
||||||
if (_form)
|
if (_form)
|
||||||
{
|
{
|
||||||
|
@ -118,7 +169,7 @@ namespace NLQT
|
||||||
Q_FOREACH(std::string str, dependencies)
|
Q_FOREACH(std::string str, dependencies)
|
||||||
{
|
{
|
||||||
QString file = str.c_str();
|
QString file = str.c_str();
|
||||||
if (file == formName) continue;
|
if (str == _form->getFilename()) continue;
|
||||||
deps[file.remove(0,file.indexOf(".")+1)] << str.c_str();
|
deps[file.remove(0,file.indexOf(".")+1)] << str.c_str();
|
||||||
}
|
}
|
||||||
nlinfo("typ's %d",deps["typ"].count());
|
nlinfo("typ's %d",deps["typ"].count());
|
||||||
|
@ -127,7 +178,7 @@ namespace NLQT
|
||||||
//nlwarning(strList.join(";").toStdString().c_str());
|
//nlwarning(strList.join(";").toStdString().c_str());
|
||||||
if (root)
|
if (root)
|
||||||
{
|
{
|
||||||
loadedForm = formName;
|
loadedForm = _form->getFilename().c_str();
|
||||||
|
|
||||||
CGeorgesFormModel *model = new CGeorgesFormModel(root,deps,comments,parents);
|
CGeorgesFormModel *model = new CGeorgesFormModel(root,deps,comments,parents);
|
||||||
CGeorgesFormProxyModel *proxyModel = new CGeorgesFormProxyModel();
|
CGeorgesFormProxyModel *proxyModel = new CGeorgesFormProxyModel();
|
||||||
|
@ -145,12 +196,17 @@ namespace NLQT
|
||||||
connect(model, SIGNAL(dataChanged(const QModelIndex, const QModelIndex)),
|
connect(model, SIGNAL(dataChanged(const QModelIndex, const QModelIndex)),
|
||||||
this, SLOT(modifiedFile()));
|
this, SLOT(modifiedFile()));
|
||||||
|
|
||||||
Modules::mainWin().setWindowTitle("Qt Georges Editor - " + formName);
|
Modules::mainWin().setWindowTitle("Qt Georges Editor - " + loadedForm);
|
||||||
//Modules::mainWin().getTabBar();
|
//Modules::mainWin().getTabBar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CGeorgesTreeViewDialog::addParentForm(CForm *form)
|
||||||
|
{
|
||||||
|
((CForm*)_form)->insertParent(((CForm*)_form)->getParentCount(), form->getFilename().c_str(), form);
|
||||||
|
}
|
||||||
|
|
||||||
void CGeorgesTreeViewDialog::modifiedFile( )
|
void CGeorgesTreeViewDialog::modifiedFile( )
|
||||||
{
|
{
|
||||||
if (!_modified)
|
if (!_modified)
|
||||||
|
@ -249,7 +305,7 @@ namespace NLQT
|
||||||
CGeorgesFormModel *m =
|
CGeorgesFormModel *m =
|
||||||
dynamic_cast<CGeorgesFormModel *>(mp->sourceModel());
|
dynamic_cast<CGeorgesFormModel *>(mp->sourceModel());
|
||||||
QModelIndex in = mp->mapToSource(index);
|
QModelIndex in = mp->mapToSource(index);
|
||||||
|
|
||||||
// col containing additional stuff like icons
|
// col containing additional stuff like icons
|
||||||
if (index.column() == 2)
|
if (index.column() == 2)
|
||||||
{
|
{
|
||||||
|
@ -279,9 +335,12 @@ namespace NLQT
|
||||||
{
|
{
|
||||||
if (path.contains(".shape"))
|
if (path.contains(".shape"))
|
||||||
{
|
{
|
||||||
Modules::objViewInt().resetScene();
|
if (Modules::objViewInt())
|
||||||
//Modules::config().configRemapExtensions();
|
{
|
||||||
Modules::objViewInt().loadMesh(path.toStdString(),"");
|
Modules::objViewInt()->resetScene();
|
||||||
|
//Modules::config().configRemapExtensions();
|
||||||
|
Modules::objViewInt()->loadMesh(path.toStdString(),"");
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -289,7 +348,7 @@ namespace NLQT
|
||||||
// open eg parent files
|
// open eg parent files
|
||||||
if (!path.isEmpty())
|
if (!path.isEmpty())
|
||||||
Q_EMIT changeFile(path);
|
Q_EMIT changeFile(path);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
namespace NLGEORGES
|
namespace NLGEORGES
|
||||||
{
|
{
|
||||||
class UForm;
|
class UForm;
|
||||||
|
class CForm;
|
||||||
}
|
}
|
||||||
|
|
||||||
using namespace NLGEORGES;
|
using namespace NLGEORGES;
|
||||||
|
@ -53,6 +54,9 @@ namespace NLQT
|
||||||
bool modified() {return _modified;}
|
bool modified() {return _modified;}
|
||||||
void setModified(bool m) {_modified = m;}
|
void setModified(bool m) {_modified = m;}
|
||||||
|
|
||||||
|
CForm* getFormByName(const QString);
|
||||||
|
void addParentForm(CForm *form);
|
||||||
|
|
||||||
void write ( );
|
void write ( );
|
||||||
|
|
||||||
QString loadedForm;
|
QString loadedForm;
|
||||||
|
@ -64,10 +68,11 @@ namespace NLQT
|
||||||
void changeFile(QString);
|
void changeFile(QString);
|
||||||
void modified(bool);
|
void modified(bool);
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void selectedForm(QString);
|
void setForm(const CForm*);
|
||||||
|
void loadFormIntoDialog(CForm *form = 0);
|
||||||
|
void modifiedFile( );
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void doubleClicked ( const QModelIndex & index );
|
void doubleClicked ( const QModelIndex & index );
|
||||||
void modifiedFile( );
|
|
||||||
void filterRows();
|
void filterRows();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -35,6 +35,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
// project includes
|
// project includes
|
||||||
#include "formitem.h"
|
#include "formitem.h"
|
||||||
|
#include "modules.h"
|
||||||
|
|
||||||
using namespace NLGEORGES;
|
using namespace NLGEORGES;
|
||||||
|
|
||||||
|
@ -141,7 +142,21 @@ namespace NLQT
|
||||||
|
|
||||||
if (value.contains(".shape"))
|
if (value.contains(".shape"))
|
||||||
{
|
{
|
||||||
return QIcon(":/images/pqrticles.png");
|
if (Modules::objViewInt())
|
||||||
|
{
|
||||||
|
QIcon *icon = Modules::objViewInt()->saveOneImage(value.toStdString());
|
||||||
|
if (icon)
|
||||||
|
{
|
||||||
|
if(icon->isNull())
|
||||||
|
return QIcon(":/images/pqrticles.png");
|
||||||
|
else
|
||||||
|
return QIcon(*icon);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return QIcon();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(value.contains(".tga") || value.contains(".png"))
|
else if(value.contains(".tga") || value.contains(".png"))
|
||||||
{
|
{
|
||||||
|
@ -166,7 +181,14 @@ namespace NLQT
|
||||||
|
|
||||||
if (value.contains(".shape"))
|
if (value.contains(".shape"))
|
||||||
{
|
{
|
||||||
return QIcon(":/images/pqrticles.png");
|
if (Modules::objViewInt())
|
||||||
|
{
|
||||||
|
QIcon *icon = Modules::objViewInt()->saveOneImage(value.toStdString());
|
||||||
|
if (icon->isNull())
|
||||||
|
return QIcon(":/images/pqrticles.png");
|
||||||
|
else
|
||||||
|
return QIcon(*icon);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(value.contains(".tga") || value.contains(".png"))
|
else if(value.contains(".tga") || value.contains(".png"))
|
||||||
{
|
{
|
||||||
|
@ -218,6 +240,7 @@ namespace NLQT
|
||||||
if (result)
|
if (result)
|
||||||
Q_EMIT dataChanged(index, this->index(index.row(),index.column()+1,index.parent()));
|
Q_EMIT dataChanged(index, this->index(index.row(),index.column()+1,index.parent()));
|
||||||
|
|
||||||
|
setupModelData();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -385,6 +408,10 @@ namespace NLQT
|
||||||
elmtType.append("_unknownType");
|
elmtType.append("_unknownType");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
elmtType.append("_noType");
|
||||||
|
}
|
||||||
|
|
||||||
if (numDefinitions)
|
if (numDefinitions)
|
||||||
{
|
{
|
||||||
|
@ -485,9 +512,6 @@ namespace NLQT
|
||||||
|
|
||||||
columnData << QString(elmName.c_str()) << QString(value.c_str()) << "" << elmtType;
|
columnData << QString(elmName.c_str()) << QString(value.c_str()) << "" << elmtType;
|
||||||
parent->appendChild(new CFormItem(elmt, columnData, parent, *whereV, *whereN));
|
parent->appendChild(new CFormItem(elmt, columnData, parent, *whereV, *whereN));
|
||||||
|
|
||||||
//columnData << QString(elmName.c_str()) << QString("default") << QString("default");
|
|
||||||
//parent->appendChild(new CFormItem(elmt, columnData, parent, UFormElm::ValueDefaultDfn, UFormElm::NodeDfn));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -510,7 +534,6 @@ namespace NLQT
|
||||||
QList<QVariant> columnData;
|
QList<QVariant> columnData;
|
||||||
std::string value;
|
std::string value;
|
||||||
QString elmtType = "";
|
QString elmtType = "";
|
||||||
//root->getValueByName(value, elmName.c_str());
|
|
||||||
|
|
||||||
UFormElm *elmt = 0;
|
UFormElm *elmt = 0;
|
||||||
if(root->getArrayNode(&elmt,0) && elmt)
|
if(root->getArrayNode(&elmt,0) && elmt)
|
||||||
|
@ -527,6 +550,8 @@ namespace NLQT
|
||||||
}
|
}
|
||||||
if (elmt->isVirtualStruct())
|
if (elmt->isVirtualStruct())
|
||||||
elmtType = "VirtualStruct";
|
elmtType = "VirtualStruct";
|
||||||
|
|
||||||
|
elmtType.append("_arrayValue");
|
||||||
columnData << QString(elmName.c_str()) << QString(value.c_str()) << "" << elmtType;
|
columnData << QString(elmName.c_str()) << QString(value.c_str()) << "" << elmtType;
|
||||||
parent->appendChild(new CFormItem(elmt, columnData, parent));
|
parent->appendChild(new CFormItem(elmt, columnData, parent));
|
||||||
loadFormData(elmt, parent->child(parent->childCount()-1));
|
loadFormData(elmt, parent->child(parent->childCount()-1));
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
|
@ -7,6 +7,7 @@
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
|
#include <QSplashScreen>
|
||||||
|
|
||||||
// NeL includes
|
// NeL includes
|
||||||
#include <nel/misc/debug.h>
|
#include <nel/misc/debug.h>
|
||||||
|
@ -18,6 +19,7 @@
|
||||||
|
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "modules.h"
|
#include "modules.h"
|
||||||
|
#include "georges_splash.h"
|
||||||
|
|
||||||
// nel_qt log file name
|
// nel_qt log file name
|
||||||
#define NLQT_LOG_FILE "nel_qt.log"
|
#define NLQT_LOG_FILE "nel_qt.log"
|
||||||
|
@ -84,6 +86,11 @@ void messageHandler(QtMsgType p_type, const char* p_msg)
|
||||||
sint main(int argc, char **argv)
|
sint main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
QPixmap pixmap(":/images/georges_logo.png");
|
||||||
|
NLQT::CGeorgesSplash splash;
|
||||||
|
splash.show();
|
||||||
|
app.processEvents();
|
||||||
|
|
||||||
NLMISC::CApplicationContext myApplicationContext;
|
NLMISC::CApplicationContext myApplicationContext;
|
||||||
|
|
||||||
#if defined(NL_OS_MAC)
|
#if defined(NL_OS_MAC)
|
||||||
|
@ -120,9 +127,10 @@ sint main(int argc, char **argv)
|
||||||
NLMISC::CPath::remapExtension("tga", "png", true);
|
NLMISC::CPath::remapExtension("tga", "png", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Modules::init();
|
Modules::init(&splash);
|
||||||
//Modules::mainWin().resize(800,600);
|
//Modules::mainWin().resize(800,600);
|
||||||
Modules::mainWin().show();
|
Modules::mainWin().show();
|
||||||
|
splash.close();
|
||||||
int result = app.exec();
|
int result = app.exec();
|
||||||
Modules::release();
|
Modules::release();
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -24,11 +24,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include <QtGui/QtGui>
|
#include <QtGui/QtGui>
|
||||||
|
|
||||||
// NeL includes
|
// NeL includes
|
||||||
|
#include <nel/misc/path.h>
|
||||||
|
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "modules.h"
|
#include "modules.h"
|
||||||
#include "settings_dialog.h"
|
#include "settings_dialog.h"
|
||||||
#include "log_dialog.h"
|
#include "log_dialog.h"
|
||||||
|
#include "new_dialog.h"
|
||||||
#include "objectviewer_dialog.h"
|
#include "objectviewer_dialog.h"
|
||||||
#include "georges_dirtree_dialog.h"
|
#include "georges_dirtree_dialog.h"
|
||||||
#include "georges_treeview_dialog.h"
|
#include "georges_treeview_dialog.h"
|
||||||
|
@ -60,16 +62,16 @@ namespace NLQT
|
||||||
_currentView = 0;
|
_currentView = 0;
|
||||||
|
|
||||||
// load and set leveldesign path from config
|
// load and set leveldesign path from config
|
||||||
QString ldPath = Modules::config().
|
_leveldesignPath = Modules::config().
|
||||||
getValue("LeveldesignPath", QString("").toStdString()).c_str();
|
getValue("LeveldesignPath", QString("").toStdString()).c_str();
|
||||||
QFileInfo info(ldPath);
|
QFileInfo info(_leveldesignPath);
|
||||||
if (!info.isDir())
|
if (!info.isDir())
|
||||||
ldPath = "";
|
_leveldesignPath = "";
|
||||||
|
|
||||||
// create georges dir dock widget
|
// create georges dir dock widget
|
||||||
_GeorgesDirTreeDialog = new CGeorgesDirTreeDialog(ldPath, this);
|
_GeorgesDirTreeDialog = new CGeorgesDirTreeDialog(_leveldesignPath, this);
|
||||||
addDockWidget(Qt::LeftDockWidgetArea, _GeorgesDirTreeDialog);
|
addDockWidget(Qt::LeftDockWidgetArea, _GeorgesDirTreeDialog);
|
||||||
if (ldPath == "")
|
if (_leveldesignPath == "")
|
||||||
{
|
{
|
||||||
if (QMessageBox::information(this, tr("Missing leveldesign path"),
|
if (QMessageBox::information(this, tr("Missing leveldesign path"),
|
||||||
tr("Your leveldesign path seems to be empty or incorrect.\nDo you want to set it now?"),
|
tr("Your leveldesign path seems to be empty or incorrect.\nDo you want to set it now?"),
|
||||||
|
@ -101,8 +103,8 @@ namespace NLQT
|
||||||
connect(_statusBarTimer, SIGNAL(timeout()), this, SLOT(updateStatusBar()));
|
connect(_statusBarTimer, SIGNAL(timeout()), this, SLOT(updateStatusBar()));
|
||||||
_statusBarTimer->start(5000);
|
_statusBarTimer->start(5000);
|
||||||
|
|
||||||
connect(_GeorgesDirTreeDialog, SIGNAL(selectedForm(QString)),
|
connect(_GeorgesDirTreeDialog, SIGNAL(selectedForm(const QString)),
|
||||||
this, SLOT(openTreeView(QString)));
|
this, SLOT(loadFile(const QString)));
|
||||||
}
|
}
|
||||||
|
|
||||||
CMainWindow::~CMainWindow()
|
CMainWindow::~CMainWindow()
|
||||||
|
@ -135,11 +137,11 @@ namespace NLQT
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMainWindow::openTreeView(QString file)
|
CGeorgesTreeViewDialog * CMainWindow::createTreeView(QString file)
|
||||||
{
|
{
|
||||||
// create or/and raise tree view dock widget for current file
|
// create or/and raise tree view dock widget for current file
|
||||||
|
|
||||||
setCurrentFile(file);
|
//setCurrentFile(file);
|
||||||
|
|
||||||
CGeorgesTreeViewDialog *newView = 0;
|
CGeorgesTreeViewDialog *newView = 0;
|
||||||
|
|
||||||
|
@ -172,7 +174,9 @@ namespace NLQT
|
||||||
}
|
}
|
||||||
|
|
||||||
_treeViewList.append(newView);
|
_treeViewList.append(newView);
|
||||||
newView->selectedForm(file);
|
|
||||||
|
//newView->selectedForm(file);
|
||||||
|
|
||||||
_currentView = newView;
|
_currentView = newView;
|
||||||
|
|
||||||
connect(newView, SIGNAL(changeFile(QString)),
|
connect(newView, SIGNAL(changeFile(QString)),
|
||||||
|
@ -182,6 +186,8 @@ namespace NLQT
|
||||||
}
|
}
|
||||||
QApplication::processEvents();
|
QApplication::processEvents();
|
||||||
newView->raise();
|
newView->raise();
|
||||||
|
|
||||||
|
return newView;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMainWindow::settings()
|
void CMainWindow::settings()
|
||||||
|
@ -210,33 +216,9 @@ namespace NLQT
|
||||||
|
|
||||||
void CMainWindow::open()
|
void CMainWindow::open()
|
||||||
{
|
{
|
||||||
/*QStringList fileNames = QFileDialog::getOpenFileNames(this,
|
// TODO: FileDialog & loadFile();
|
||||||
tr("Open NeL data file"), _lastDir,
|
QString fileName = QFileDialog::getOpenFileName();
|
||||||
tr("All NeL files (*.shape *.ps);;"
|
loadFile(fileName);
|
||||||
"NeL shape files (*.shape);;"
|
|
||||||
"NeL particle system files (*.ps)"));
|
|
||||||
|
|
||||||
setCursor(Qt::WaitCursor);
|
|
||||||
if (!fileNames.isEmpty())
|
|
||||||
{
|
|
||||||
QStringList list = fileNames;
|
|
||||||
QStringList::Iterator it = list.begin();
|
|
||||||
_lastDir = QFileInfo(*it).absolutePath();
|
|
||||||
|
|
||||||
QString skelFileName = QFileDialog::getOpenFileName(this,
|
|
||||||
tr("Open skeleton file"), _lastDir,
|
|
||||||
tr("NeL skeleton file (*.skel)"));
|
|
||||||
|
|
||||||
while(it != list.end())
|
|
||||||
{
|
|
||||||
loadFile(*it, skelFileName);
|
|
||||||
++it;
|
|
||||||
}
|
|
||||||
_AnimationSetDialog->updateListObject();
|
|
||||||
_AnimationSetDialog->updateListAnim();
|
|
||||||
_SlotManagerDialog->updateUiSlots();
|
|
||||||
}
|
|
||||||
setCursor(Qt::ArrowCursor);*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMainWindow::save()
|
void CMainWindow::save()
|
||||||
|
@ -246,6 +228,21 @@ namespace NLQT
|
||||||
|
|
||||||
setCursor(Qt::WaitCursor);
|
setCursor(Qt::WaitCursor);
|
||||||
|
|
||||||
|
//TODO: if not exists open FileDialog SaveAs...
|
||||||
|
if(!CPath::exists(_currentView->loadedForm.toStdString()))
|
||||||
|
{
|
||||||
|
QString fileName = QFileDialog::getSaveFileName(
|
||||||
|
this,
|
||||||
|
QString(),
|
||||||
|
_currentView->loadedForm
|
||||||
|
);
|
||||||
|
QFile file(fileName);
|
||||||
|
file.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text);
|
||||||
|
file.close();
|
||||||
|
CPath::addSearchFile(fileName.toStdString());
|
||||||
|
//QFileInfo info = QFileInfo(file);
|
||||||
|
//m->setData(in2, info.fileName());
|
||||||
|
}
|
||||||
_currentView->write();
|
_currentView->write();
|
||||||
setWindowTitle(windowTitle().remove("*"));
|
setWindowTitle(windowTitle().remove("*"));
|
||||||
_saveAction->setEnabled(false);
|
_saveAction->setEnabled(false);
|
||||||
|
@ -255,6 +252,31 @@ namespace NLQT
|
||||||
|
|
||||||
void CMainWindow::create()
|
void CMainWindow::create()
|
||||||
{
|
{
|
||||||
|
QStringList lst;
|
||||||
|
CGeorgesNewDialog dlg(lst);
|
||||||
|
dlg.exec();
|
||||||
|
qDebug() << lst;
|
||||||
|
if (!lst.isEmpty() && !lst.at(0).isEmpty())
|
||||||
|
{
|
||||||
|
QString formName = lst.takeFirst();
|
||||||
|
CGeorgesTreeViewDialog * newView = 0;
|
||||||
|
newView = createTreeView(formName);
|
||||||
|
CForm* form = newView->getFormByName(formName);
|
||||||
|
newView->setForm(form);
|
||||||
|
|
||||||
|
Q_FOREACH(QString dep, lst)
|
||||||
|
{
|
||||||
|
newView->addParentForm(newView->getFormByName(dep));
|
||||||
|
}
|
||||||
|
newView->loadFormIntoDialog();
|
||||||
|
//TODO: look into setFilename for new Form object
|
||||||
|
if(newView->loadedForm.isEmpty())
|
||||||
|
{
|
||||||
|
newView->loadedForm = formName;
|
||||||
|
setWindowTitle("Qt Georges Editor - " + formName);
|
||||||
|
}
|
||||||
|
newView->modifiedFile();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMainWindow::createEmptyView(QDockWidget* w)
|
void CMainWindow::createEmptyView(QDockWidget* w)
|
||||||
|
@ -442,6 +464,24 @@ namespace NLQT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CMainWindow::loadFile(QString fileName){
|
||||||
|
QFileInfo info(fileName);
|
||||||
|
fileName = info.fileName();
|
||||||
|
// TODO: make georges static and stuff
|
||||||
|
CGeorgesTreeViewDialog *newView = new CGeorgesTreeViewDialog;
|
||||||
|
CForm *form = newView->getFormByName(fileName);
|
||||||
|
if (form)
|
||||||
|
{
|
||||||
|
delete newView;
|
||||||
|
newView = createTreeView(fileName);
|
||||||
|
newView->setForm(form);
|
||||||
|
newView->loadFormIntoDialog(form);
|
||||||
|
setCurrentFile(fileName);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
delete newView;
|
||||||
|
}
|
||||||
|
|
||||||
void CMainWindow::openRecentFile()
|
void CMainWindow::openRecentFile()
|
||||||
{
|
{
|
||||||
QAction *action = qobject_cast<QAction *>(sender());
|
QAction *action = qobject_cast<QAction *>(sender());
|
||||||
|
@ -496,28 +536,6 @@ namespace NLQT
|
||||||
|
|
||||||
_separatorAction->setVisible(numRecentFiles > 0);
|
_separatorAction->setVisible(numRecentFiles > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMainWindow::loadFile(const QString &fileName)
|
|
||||||
{
|
|
||||||
/*QFile file(fileName);
|
|
||||||
if (!file.open(QFile::ReadOnly | QFile::Text)) {
|
|
||||||
QMessageBox::warning(this, tr("Recent Files"),
|
|
||||||
tr("Cannot read file %1:\n%2.")
|
|
||||||
.arg(fileName)
|
|
||||||
.arg(file.errorString()));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QTextStream in(&file);
|
|
||||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
|
||||||
textEdit->setPlainText(in.readAll());
|
|
||||||
QApplication::restoreOverrideCursor();*/
|
|
||||||
|
|
||||||
openTreeView(fileName);
|
|
||||||
setCurrentFile(fileName);
|
|
||||||
//statusBar()->showMessage(tr("File loaded"), 2000);
|
|
||||||
}
|
|
||||||
|
|
||||||
} /* namespace NLQT */
|
} /* namespace NLQT */
|
||||||
|
|
||||||
/* end of file */
|
/* end of file */
|
||||||
|
|
|
@ -60,6 +60,8 @@ namespace NLQT
|
||||||
void createEmptyView(QDockWidget* w = 0);
|
void createEmptyView(QDockWidget* w = 0);
|
||||||
void closeEvent(QCloseEvent *event);
|
void closeEvent(QCloseEvent *event);
|
||||||
|
|
||||||
|
QString leveldesignPath() { return _leveldesignPath; }
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void open();
|
void open();
|
||||||
void create();
|
void create();
|
||||||
|
@ -67,9 +69,10 @@ namespace NLQT
|
||||||
void settings();
|
void settings();
|
||||||
void about();
|
void about();
|
||||||
void updateStatusBar();
|
void updateStatusBar();
|
||||||
void openTreeView(QString);
|
CGeorgesTreeViewDialog * createTreeView(QString);
|
||||||
void tabChanged(int);
|
void tabChanged(int);
|
||||||
void openRecentFile();
|
void openRecentFile();
|
||||||
|
void loadFile(QString fileName);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void createActions();
|
void createActions();
|
||||||
|
@ -77,8 +80,7 @@ namespace NLQT
|
||||||
void createToolBars();
|
void createToolBars();
|
||||||
void createStatusBar();
|
void createStatusBar();
|
||||||
void createDialogs();
|
void createDialogs();
|
||||||
|
|
||||||
void loadFile(const QString &fileName);
|
|
||||||
void updateRecentFileActions();
|
void updateRecentFileActions();
|
||||||
void setCurrentFile(const QString &fileName);
|
void setCurrentFile(const QString &fileName);
|
||||||
|
|
||||||
|
@ -113,6 +115,7 @@ namespace NLQT
|
||||||
QAction *_aboutQtAction;
|
QAction *_aboutQtAction;
|
||||||
QAction *_separatorAction;
|
QAction *_separatorAction;
|
||||||
|
|
||||||
|
QString _leveldesignPath;
|
||||||
|
|
||||||
enum { MaxRecentFiles = 5 };
|
enum { MaxRecentFiles = 5 };
|
||||||
QAction *recentFileActs[MaxRecentFiles];
|
QAction *recentFileActs[MaxRecentFiles];
|
||||||
|
|
|
@ -29,14 +29,17 @@ NLQT::CConfiguration *Modules::_configuration = NULL;
|
||||||
NLQT::IObjectViewer *Modules::_objViewerInterface = NULL;
|
NLQT::IObjectViewer *Modules::_objViewerInterface = NULL;
|
||||||
NLQT::CMainWindow *Modules::_mainWindow = NULL;
|
NLQT::CMainWindow *Modules::_mainWindow = NULL;
|
||||||
|
|
||||||
void Modules::init()
|
void Modules::init(NLMISC::IProgressCallback *cb)
|
||||||
{
|
{
|
||||||
loadPlugin();
|
if (loadPlugin())
|
||||||
|
{
|
||||||
_objViewerInterface->setNelContext(NLMISC::INelContext::getInstance());
|
_objViewerInterface->setNelContext(NLMISC::INelContext::getInstance());
|
||||||
|
}
|
||||||
|
|
||||||
if (_configuration == NULL) _configuration = new NLQT::CConfiguration;
|
if (_configuration == NULL) _configuration = new NLQT::CConfiguration;
|
||||||
|
_configuration->setProgressCallback(cb);
|
||||||
config().init();
|
config().init();
|
||||||
|
_configuration->setProgressCallback(0);
|
||||||
|
|
||||||
if (_mainWindow == NULL) _mainWindow = new NLQT::CMainWindow;
|
if (_mainWindow == NULL) _mainWindow = new NLQT::CMainWindow;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,14 +23,18 @@
|
||||||
#include "main_window.h"
|
#include "main_window.h"
|
||||||
#include "interfaces.h"
|
#include "interfaces.h"
|
||||||
|
|
||||||
|
namespace NLMISC {
|
||||||
|
class IProgressCallback;
|
||||||
|
}
|
||||||
|
|
||||||
class Modules
|
class Modules
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void init();
|
static void init(NLMISC::IProgressCallback *cb);
|
||||||
static void release();
|
static void release();
|
||||||
|
|
||||||
static NLQT::CConfiguration &config() { return *_configuration; }
|
static NLQT::CConfiguration &config() { return *_configuration; }
|
||||||
static NLQT::IObjectViewer &objViewInt() { return *_objViewerInterface; }
|
static NLQT::IObjectViewer* objViewInt() { return _objViewerInterface; }
|
||||||
static NLQT::CMainWindow &mainWin() { return *_mainWindow; }
|
static NLQT::CMainWindow &mainWin() { return *_mainWindow; }
|
||||||
private:
|
private:
|
||||||
static bool loadPlugin();
|
static bool loadPlugin();
|
||||||
|
|
|
@ -0,0 +1,341 @@
|
||||||
|
/*
|
||||||
|
Georges Editor Qt
|
||||||
|
Copyright (C) 2010 Adrian Jaekel <aj at elane2k dot com>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "new_dialog.h"
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
|
#include <QtGui/QWidget>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QDateTime>
|
||||||
|
#include <QTextStream>
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
#include <nel/misc/path.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "modules.h"
|
||||||
|
#include "completer_line_edit.h"
|
||||||
|
|
||||||
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
|
CGeorgesNewDialog::CGeorgesNewDialog(QStringList& result, QWidget *parent)
|
||||||
|
: QDialog(parent),
|
||||||
|
_result(result),
|
||||||
|
_descriptionTemplate(QString())
|
||||||
|
{
|
||||||
|
_ui.setupUi(this);
|
||||||
|
|
||||||
|
setWindowIcon(QIcon(":/images/georges_logo.png"));
|
||||||
|
|
||||||
|
_ui.parentLineEdit->setEnabled(false);
|
||||||
|
_ui.addParentButton->setEnabled(true);
|
||||||
|
|
||||||
|
// wizard page
|
||||||
|
connect(_ui.wizardBtn, SIGNAL(clicked(bool)),
|
||||||
|
this, SLOT(wizardBtnClicked(bool)));
|
||||||
|
connect(_ui.wizardList, SIGNAL(itemClicked(QListWidgetItem*)),
|
||||||
|
this, SLOT(wizardItemActivated(QListWidgetItem *)));
|
||||||
|
|
||||||
|
// form page
|
||||||
|
connect(_ui.formBtn, SIGNAL(clicked(bool)),
|
||||||
|
this, SLOT(formBtnClicked(bool)));
|
||||||
|
connect(_ui.addParentButton, SIGNAL(clicked()),
|
||||||
|
this, SLOT(addParentClicked()));
|
||||||
|
connect(_ui.deleteParentButton, SIGNAL(clicked()),
|
||||||
|
this, SLOT(deleteParentClicked()));
|
||||||
|
connect(_ui.formList, SIGNAL(itemActivated(QListWidgetItem*)),
|
||||||
|
this, SLOT(formItemActivated(QListWidgetItem *)));
|
||||||
|
connect(_ui.formList, SIGNAL(itemClicked(QListWidgetItem*)),
|
||||||
|
this, SLOT(formItemActivated(QListWidgetItem *)));
|
||||||
|
connect(_ui.parentLineEdit, SIGNAL(editingFinished()),
|
||||||
|
this, SLOT(validateParentCombo()));
|
||||||
|
|
||||||
|
// dfn page
|
||||||
|
connect(_ui.dfnTypeBtn, SIGNAL(clicked(bool)),
|
||||||
|
this, SLOT(dfnTypeClicked(bool)));
|
||||||
|
|
||||||
|
connect(_ui.buttonBox, SIGNAL(accepted()),
|
||||||
|
this, SLOT(buttonBoxAccepted()));
|
||||||
|
connect(_ui.buttonBox, SIGNAL(rejected()),
|
||||||
|
this, SLOT(buttonBoxRejected()));
|
||||||
|
|
||||||
|
// wizard list
|
||||||
|
QListWidgetItem *mpWiz = new QListWidgetItem(QIcon(":/images/mp_generic.png"),tr("Raw Material Generator"));
|
||||||
|
_ui.wizardList->addItem(mpWiz);
|
||||||
|
|
||||||
|
// form list
|
||||||
|
QString path = Modules::mainWin().leveldesignPath();
|
||||||
|
QStringList typelist;
|
||||||
|
//nlinfo ("Searching files in directory '%s'...", dir.c_str());
|
||||||
|
NLMISC::CPath::getPathContent(path.toStdString(),true,false,true,_files);
|
||||||
|
|
||||||
|
getTypes(path.toStdString());
|
||||||
|
//nlinfo ("%d supported file types :",FileTypeToId.size());
|
||||||
|
for ( std::map<std::string,uint8>::iterator it = FileTypeToId.begin(); it != FileTypeToId.end(); ++it )
|
||||||
|
{
|
||||||
|
typelist.append(QString((*it).first.c_str()));
|
||||||
|
//nlinfo("%s",(*it).first.c_str());
|
||||||
|
}
|
||||||
|
_ui.formList->addItems(typelist);
|
||||||
|
|
||||||
|
for(uint i = 0; i < _files.size(); i++)
|
||||||
|
{
|
||||||
|
std::string extStr = NLMISC::CFile::getExtension( _files[i] );
|
||||||
|
|
||||||
|
// filter files without existing dfn
|
||||||
|
if (!NLMISC::CPath::exists(QString("%1.dfn").arg(extStr.c_str()).toStdString()) &&
|
||||||
|
!NLMISC::CPath::exists(QString("%1.typ").arg(extStr.c_str()).toStdString()))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
_filelist.append(QString(NLMISC::CFile::getFilename(_files[i]).c_str()));
|
||||||
|
}
|
||||||
|
|
||||||
|
_ui.parentFrame->hide();
|
||||||
|
|
||||||
|
// replace "Heading" and "Descriptive Text" with your string
|
||||||
|
_descriptionTemplate =
|
||||||
|
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\""
|
||||||
|
"\"http://www.w3.org/TR/REC-html40/strict.dtd\">"
|
||||||
|
"\n<html><head><meta name=\"qrichtext\" content=\"1\" />"
|
||||||
|
"<style type=\"text/css\">\np, li { white-space: pre-wrap; }\n</style>"
|
||||||
|
"</head><body style=\" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;\">"
|
||||||
|
"\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">"
|
||||||
|
"<span style=\" font-size:8pt; font-weight:600;\">Heading</span></p>"
|
||||||
|
"\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">"
|
||||||
|
"<span style=\" font-size:8pt;\">Descriptive Text</span></p></body></html>";
|
||||||
|
}
|
||||||
|
|
||||||
|
CGeorgesNewDialog::~CGeorgesNewDialog()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGeorgesNewDialog::wizardBtnClicked(bool p_checked)
|
||||||
|
{
|
||||||
|
if(p_checked)
|
||||||
|
_ui.stackedWidget->setCurrentWidget(_ui.wizardPage);
|
||||||
|
else
|
||||||
|
_ui.wizardBtn->setChecked(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGeorgesNewDialog::formBtnClicked(bool p_checked)
|
||||||
|
{
|
||||||
|
if(p_checked)
|
||||||
|
_ui.stackedWidget->setCurrentWidget(_ui.formPage);
|
||||||
|
else
|
||||||
|
_ui.formBtn->setChecked(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGeorgesNewDialog::dfnTypeClicked(bool p_checked)
|
||||||
|
{
|
||||||
|
if(p_checked)
|
||||||
|
_ui.stackedWidget->setCurrentWidget(_ui.dfnTypePage);
|
||||||
|
else
|
||||||
|
_ui.dfnTypeBtn->setChecked(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGeorgesNewDialog::addParentClicked()
|
||||||
|
{
|
||||||
|
if (!_filelist.contains(_ui.parentLineEdit->text()))
|
||||||
|
{
|
||||||
|
_ui.parentLineEdit->clear();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_ui.parentFrame->show();
|
||||||
|
|
||||||
|
QList<QListWidgetItem *> itemList = _ui.parentList->
|
||||||
|
findItems(_ui.parentLineEdit->text(), Qt::MatchFixedString);
|
||||||
|
if ((itemList.count() == 0) && (!_ui.parentLineEdit->text().isEmpty()))
|
||||||
|
{
|
||||||
|
_ui.parentList->insertItem(_ui.parentList->count(), _ui.parentLineEdit->text());
|
||||||
|
}
|
||||||
|
_ui.parentLineEdit->clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGeorgesNewDialog::deleteParentClicked()
|
||||||
|
{
|
||||||
|
_ui.parentList->takeItem(_ui.parentList->currentRow());
|
||||||
|
|
||||||
|
if (_ui.parentList->count() == 0)
|
||||||
|
{
|
||||||
|
_ui.parentFrame->hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGeorgesNewDialog::buttonBoxAccepted()
|
||||||
|
{
|
||||||
|
if (_ui.stackedWidget->currentWidget() == _ui.formPage)
|
||||||
|
{
|
||||||
|
_result << _ui.formFileNameEdit->text();
|
||||||
|
for (int i = 0; i < _ui.parentList->count(); i++)
|
||||||
|
{
|
||||||
|
_result << _ui.parentList->item(i)->text();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QMessageBox::information(this,"Information","Not yet included.\nSoon to come! :)");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGeorgesNewDialog::buttonBoxRejected()
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGeorgesNewDialog::formItemActivated(QListWidgetItem *item)
|
||||||
|
{
|
||||||
|
_ui.formFileNameEdit->setText(QString(tr("newfile.%1").arg(item->text())));
|
||||||
|
_ui.parentLineEdit->setEnabled(true);
|
||||||
|
_ui.parentLineEdit->setText("");
|
||||||
|
//_ui.addParentButton->setEnabled(false);
|
||||||
|
|
||||||
|
QStringList list = _filelist.filter(item->text());
|
||||||
|
_ui.parentLineEdit->setStringList(list);
|
||||||
|
_ui.formFileNameEdit->setFocus();
|
||||||
|
_ui.formFileNameEdit->setSelection(0, tr("newfile").size());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGeorgesNewDialog::wizardItemActivated(QListWidgetItem *item)
|
||||||
|
{
|
||||||
|
QString myDescription = _descriptionTemplate;
|
||||||
|
myDescription = myDescription.replace("Heading", item->text());
|
||||||
|
|
||||||
|
if (item->text() == tr("Raw Material Generator"))
|
||||||
|
{
|
||||||
|
myDescription = myDescription.replace("Descriptive Text",
|
||||||
|
tr("Automatically creates MP (resources) for every creature in the assets."));
|
||||||
|
}
|
||||||
|
|
||||||
|
_ui.wizDescLabel->setText(myDescription);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGeorgesNewDialog::getTypes( std::string& dir )
|
||||||
|
{
|
||||||
|
//nlinfo ("Found %d files in directory '%s'", files.size(), dir.c_str());
|
||||||
|
for(uint i = 0; i < _files.size(); i++)
|
||||||
|
{
|
||||||
|
addType(NLMISC::CFile::getFilename(_files[i]));
|
||||||
|
QApplication::processEvents();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGeorgesNewDialog::addType( std::string fileName )
|
||||||
|
{
|
||||||
|
if(fileName.empty() || fileName=="." || fileName==".." || fileName[0]=='_' || fileName.find(".#")==0)
|
||||||
|
{
|
||||||
|
//nlinfo("Discarding file '%s'", fileName.c_str());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::string extStr = NLMISC::CFile::getExtension( fileName );
|
||||||
|
|
||||||
|
if (!NLMISC::CPath::exists(QString("%1.dfn").arg(extStr.c_str()).toStdString()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// if the file is new
|
||||||
|
std::map<std::string,TFormId>::iterator itFI = FormToId.find( fileName );
|
||||||
|
if( itFI == FormToId.end() )
|
||||||
|
{
|
||||||
|
// double check : if file not found we check with lower case version of filename
|
||||||
|
std::map<std::string,TFormId>::iterator itFILwr = FormToId.find( NLMISC::toLower(fileName) );
|
||||||
|
if( itFILwr != FormToId.end() )
|
||||||
|
{
|
||||||
|
nlwarning("Trying to add %s but the file %s is already known ! be careful with lower case and upper case.", fileName.c_str(), NLMISC::toLower(fileName).c_str());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string fileType;
|
||||||
|
if( getFileType( fileName, fileType ) )
|
||||||
|
{
|
||||||
|
std::map<std::string,uint8>::iterator itFTI = FileTypeToId.find( fileType );
|
||||||
|
TFormId fid;
|
||||||
|
memset( &fid, 0, sizeof(TFormId) );
|
||||||
|
|
||||||
|
// if the type of this file is a new type
|
||||||
|
if( itFTI == FileTypeToId.end() )
|
||||||
|
{
|
||||||
|
sint16 firstFreeFileTypeId = getFirstFreeFileTypeId();
|
||||||
|
if( firstFreeFileTypeId == -1 )
|
||||||
|
{
|
||||||
|
nlwarning("MORE THAN 256 FILE TYPES!!!!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FileTypeToId.insert( std::make_pair(fileType,(uint8)firstFreeFileTypeId) );
|
||||||
|
IdToFileType.insert( std::make_pair((uint8)firstFreeFileTypeId,fileType) );
|
||||||
|
|
||||||
|
fid.FormIDInfos.Type = (uint8)firstFreeFileTypeId;
|
||||||
|
fid.FormIDInfos.Id = 0;
|
||||||
|
|
||||||
|
//nlinfo("Adding file type '%s' with id %d", fileType.c_str(), firstFreeFileTypeId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
FormToId.insert( make_pair(fileName,fid) );
|
||||||
|
//nlinfo("Adding file '%s' id %d with type '%s' id %d", fileName.c_str(), fid.FormIDInfos.Id, fileType.c_str(), fid.FormIDInfos.Type);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nlinfo("Unknown file type for the file : '%s' --> not added",fileName.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nlinfo("Skipping file '%s', already in the file", fileName.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CGeorgesNewDialog::getFileType( std::string& fileName, std::string& fileType )
|
||||||
|
{
|
||||||
|
fileType = NLMISC::CFile::getExtension(NLMISC::CFile::getFilename(fileName));
|
||||||
|
return !fileType.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
sint16 CGeorgesNewDialog::getFirstFreeFileTypeId()
|
||||||
|
{
|
||||||
|
for( sint16 id=0; id<256; ++id )
|
||||||
|
{
|
||||||
|
if( IdToFileType.find((uint8)id) == IdToFileType.end() )
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGeorgesNewDialog::validateParentCombo() {
|
||||||
|
// TODO: clear if no valid text
|
||||||
|
//if (!_filelist.contains(_ui.parentLineEdit->text()))
|
||||||
|
// _ui.parentLineEdit->clear();
|
||||||
|
}
|
||||||
|
} /* namespace NLQT */
|
|
@ -0,0 +1,88 @@
|
||||||
|
/*
|
||||||
|
Georges Editor Qt
|
||||||
|
Copyright (C) 2010 Adrian Jaekel <aj at elane2k dot com>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef NEW_DIALOG_H
|
||||||
|
#define NEW_DIALOG_H
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
|
#include <QtGui/QWidget>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include <nel/misc/file.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "ui_new_form.h"
|
||||||
|
|
||||||
|
namespace NLQT
|
||||||
|
{
|
||||||
|
class CGeorgesNewDialog: public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
union TFormId
|
||||||
|
{
|
||||||
|
uint32 Id;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
uint32 Type : 8;
|
||||||
|
uint32 Id : 24;
|
||||||
|
} FormIDInfos;
|
||||||
|
void serial(NLMISC::IStream &f) { f.serial(Id); };
|
||||||
|
};
|
||||||
|
|
||||||
|
Ui::CGeorgesNewDialog _ui;
|
||||||
|
QStringList _filelist;
|
||||||
|
QStringList &_result;
|
||||||
|
QString _descriptionTemplate;
|
||||||
|
|
||||||
|
std::map<std::string,TFormId> FormToId;
|
||||||
|
std::map<std::string,uint8> FileTypeToId;
|
||||||
|
std::map<uint8,std::string> IdToFileType;
|
||||||
|
|
||||||
|
std::vector<std::string> _files;
|
||||||
|
|
||||||
|
void getTypes( std::string& dir );
|
||||||
|
void addType( std::string fileName );
|
||||||
|
bool getFileType( std::string& fileName, std::string& fileType );
|
||||||
|
sint16 getFirstFreeFileTypeId();
|
||||||
|
|
||||||
|
public:
|
||||||
|
CGeorgesNewDialog(QStringList& result, QWidget *parent = 0);
|
||||||
|
~CGeorgesNewDialog();
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void wizardBtnClicked(bool checked);
|
||||||
|
void formBtnClicked (bool checked);
|
||||||
|
void dfnTypeClicked (bool p_checked);
|
||||||
|
void addParentClicked();
|
||||||
|
void deleteParentClicked();
|
||||||
|
void formItemActivated(QListWidgetItem *);
|
||||||
|
void wizardItemActivated(QListWidgetItem *);
|
||||||
|
void validateParentCombo();
|
||||||
|
void buttonBoxAccepted();
|
||||||
|
void buttonBoxRejected();
|
||||||
|
|
||||||
|
friend class CMainWindow;
|
||||||
|
}; /* CGeorgesNewDialog */
|
||||||
|
|
||||||
|
} /* namespace NLQT */
|
||||||
|
|
||||||
|
#endif // NEW_DIALOG_H
|
428
code/ryzom/tools/leveldesign/georges_editor_qt/src/new_form.ui
Normal file
428
code/ryzom/tools/leveldesign/georges_editor_qt/src/new_form.ui
Normal file
|
@ -0,0 +1,428 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CGeorgesNewDialog</class>
|
||||||
|
<widget class="QDialog" name="CGeorgesNewDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>885</width>
|
||||||
|
<height>520</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Create new form ...</string>
|
||||||
|
</property>
|
||||||
|
<property name="modal">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="2" rowspan="2">
|
||||||
|
<widget class="Line" name="line">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="3" rowspan="2">
|
||||||
|
<widget class="QStackedWidget" name="stackedWidget">
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="wizardPage">
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QGroupBox" name="wizardGroupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Choose a wizard ...</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_4">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QListWidget" name="wizardList">
|
||||||
|
<property name="viewMode">
|
||||||
|
<enum>QListView::IconMode</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QGroupBox" name="wizDescGroupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Description</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_10">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="wizDescLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||||
|
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||||
|
p, li { white-space: pre-wrap; }
|
||||||
|
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
||||||
|
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"></p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="formPage">
|
||||||
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QGroupBox" name="formGroupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Choose type of form ...</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_9">
|
||||||
|
<item row="0" column="0" colspan="3">
|
||||||
|
<widget class="QSplitter" name="splitter">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<widget class="QListWidget" name="formList">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QFrame" name="parentFrame">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>55</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>55</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_5">
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0" rowspan="2">
|
||||||
|
<widget class="QListWidget" name="parentList">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>55</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QPushButton" name="deleteParentButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Delete</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<spacer name="verticalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="formAddParentLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Add Parent</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="CompleteLineEdit" name="parentLineEdit"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QPushButton" name="addParentButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Add</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="formFilenameLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Filename</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QLineEdit" name="formFileNameEdit"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="dfnTypePage">
|
||||||
|
<layout class="QGridLayout" name="gridLayout_6">
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QGroupBox" name="dfnTypeGroupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Create a new dfn or typ file ...</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_7">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QRadioButton" name="dfnRadioButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>DFN</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QRadioButton" name="typeRadioButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Type</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" colspan="3">
|
||||||
|
<widget class="QLineEdit" name="filenameLineEdit"/>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0" colspan="3">
|
||||||
|
<spacer name="verticalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1" colspan="3">
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0" rowspan="3" colspan="2">
|
||||||
|
<widget class="QFrame" name="frame">
|
||||||
|
<layout class="QGridLayout" name="gridLayout_8">
|
||||||
|
<property name="horizontalSpacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="verticalSpacing">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QCommandLinkButton" name="wizardBtn">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Wizards ...</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="autoExclusive">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="autoDefault">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QCommandLinkButton" name="formBtn">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Create New Form ...</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="autoExclusive">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="autoDefault">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QCommandLinkButton" name="dfnTypeBtn">
|
||||||
|
<property name="text">
|
||||||
|
<string>Create DFN or Type ...</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="autoExclusive">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="autoDefault">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>169</width>
|
||||||
|
<height>308</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>CompleteLineEdit</class>
|
||||||
|
<extends>QLineEdit</extends>
|
||||||
|
<header>completer_line_edit.h</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<tabstops>
|
||||||
|
<tabstop>wizardBtn</tabstop>
|
||||||
|
<tabstop>formBtn</tabstop>
|
||||||
|
<tabstop>dfnTypeBtn</tabstop>
|
||||||
|
<tabstop>wizardList</tabstop>
|
||||||
|
<tabstop>formList</tabstop>
|
||||||
|
<tabstop>parentList</tabstop>
|
||||||
|
<tabstop>formFileNameEdit</tabstop>
|
||||||
|
<tabstop>dfnRadioButton</tabstop>
|
||||||
|
<tabstop>typeRadioButton</tabstop>
|
||||||
|
<tabstop>filenameLineEdit</tabstop>
|
||||||
|
<tabstop>buttonBox</tabstop>
|
||||||
|
</tabstops>
|
||||||
|
<resources/>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>CGeorgesNewDialog</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>350</x>
|
||||||
|
<y>598</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>157</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>CGeorgesNewDialog</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>418</x>
|
||||||
|
<y>598</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
|
@ -41,14 +41,17 @@ using namespace NL3D;
|
||||||
namespace NLQT
|
namespace NLQT
|
||||||
{
|
{
|
||||||
|
|
||||||
CObjectViewerDialog::CObjectViewerDialog(QWidget *parent)
|
CObjectViewerDialog::CObjectViewerDialog(QWidget *parent) :QDockWidget(parent),
|
||||||
: QDockWidget(parent)
|
_nlw(0)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
|
|
||||||
_nlw = dynamic_cast<QNLWidget*>(Modules::objViewInt().getWidget());
|
if (Modules::objViewInt())
|
||||||
//_nlw->setObjectName(QString::fromUtf8("nlwidget"));
|
{
|
||||||
_ui.gridLayout->addWidget(_nlw, 0, 0);
|
_nlw = dynamic_cast<QNLWidget*>(Modules::objViewInt()->getWidget());
|
||||||
|
//_nlw->setObjectName(QString::fromUtf8("nlwidget"));
|
||||||
|
_ui.gridLayout->addWidget(_nlw, 0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CObjectViewerDialog::~CObjectViewerDialog()
|
CObjectViewerDialog::~CObjectViewerDialog()
|
||||||
|
@ -97,8 +100,10 @@ namespace NLQT
|
||||||
{
|
{
|
||||||
//nldebug("%d %d",_nlw->width(), _nlw->height());
|
//nldebug("%d %d",_nlw->width(), _nlw->height());
|
||||||
QDockWidget::resizeEvent(resizeEvent);
|
QDockWidget::resizeEvent(resizeEvent);
|
||||||
if (Modules::objViewInt().getDriver())
|
if (Modules::objViewInt()) {
|
||||||
Modules::objViewInt().setSizeViewport(resizeEvent->size().width(), resizeEvent->size().height());
|
if (Modules::objViewInt()->getDriver())
|
||||||
|
Modules::objViewInt()->setSizeViewport(resizeEvent->size().width(), resizeEvent->size().height());
|
||||||
|
}
|
||||||
// The OpenGL driver does not resize automatically.
|
// The OpenGL driver does not resize automatically.
|
||||||
// The Direct3D driver breaks the window mode to include window borders when calling setMode windowed.
|
// The Direct3D driver breaks the window mode to include window borders when calling setMode windowed.
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QProgressBar>
|
#include <QProgressBar>
|
||||||
|
#include <QIcon>
|
||||||
// STL includes
|
// STL includes
|
||||||
|
|
||||||
// NeL includes
|
// NeL includes
|
||||||
|
@ -47,6 +48,7 @@ namespace NLQT
|
||||||
resize(250, 100);
|
resize(250, 100);
|
||||||
_progressBar->setMinimum(0);
|
_progressBar->setMinimum(0);
|
||||||
_progressBar->setMaximum(100);
|
_progressBar->setMaximum(100);
|
||||||
|
setWindowIcon(QIcon(":/images/georges_logo.png"));
|
||||||
}
|
}
|
||||||
|
|
||||||
CProgressDialog::~CProgressDialog()
|
CProgressDialog::~CProgressDialog()
|
||||||
|
|
76
code/ryzom/tools/leveldesign/georges_editor_qt/src/splash.ui
Normal file
76
code/ryzom/tools/leveldesign/georges_editor_qt/src/splash.ui
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CGeorgesSplash</class>
|
||||||
|
<widget class="QWidget" name="CGeorgesSplash">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>337</width>
|
||||||
|
<height>214</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="2" column="0" colspan="2">
|
||||||
|
<widget class="QProgressBar" name="progressBar">
|
||||||
|
<property name="value">
|
||||||
|
<number>24</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" colspan="2">
|
||||||
|
<widget class="QLabel" name="splashLabel">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Initializing ...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||||
|
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||||
|
p, li { white-space: pre-wrap; }
|
||||||
|
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
||||||
|
<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt; font-weight:600;">Georges Editor Qt</span></p>
|
||||||
|
<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">for</span></p>
|
||||||
|
<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Ryzom Core</span></p>
|
||||||
|
<p align="center" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"></p>
|
||||||
|
<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">by</span></p>
|
||||||
|
<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">aquiles</span></p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="imageLabel">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>150</width>
|
||||||
|
<height>150</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>150</width>
|
||||||
|
<height>150</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
Loading…
Reference in a new issue