Merge with qt5

--HG--
branch : feature-crashreport+qt5
hg/feature/qt5
kaetemi 10 years ago
commit 46c4bf1c24

@ -146,6 +146,14 @@ IF(WITH_QT)
FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui QtXml QtOpenGL REQUIRED)
ENDIF(WITH_QT)
IF(WITH_QT5)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11 FATAL_ERROR)
FIND_PACKAGE(Qt5Core)
FIND_PACKAGE(Qt5Widgets)
FIND_PACKAGE(Qt5LinguistTools)
ADD_DEFINITIONS(-DQT_NO_DEBUG)
ENDIF(WITH_QT5)
IF(WITH_NEL)
IF(WITH_NEL_TESTS)
FIND_PACKAGE(CppTest)

@ -232,9 +232,9 @@ Remove the CMakeCache.txt file and try again from another folder, e.g.:
ENDMACRO(CHECK_OUT_OF_SOURCE)
MACRO(NL_SETUP_DEFAULT_OPTIONS)
IF(WITH_QT)
IF(WITH_QT OR WITH_QT5)
OPTION(WITH_STUDIO "Build Core Studio" OFF )
ENDIF(WITH_QT)
ENDIF(WITH_QT OR WITH_QT5)
###
# Features
@ -278,7 +278,8 @@ MACRO(NL_SETUP_DEFAULT_OPTIONS)
# GUI toolkits
###
OPTION(WITH_GTK "With GTK Support" OFF)
OPTION(WITH_QT "With QT Support" OFF)
OPTION(WITH_QT "With QT4 Support" OFF)
OPTION(WITH_QT5 "With QT5 Support" OFF)
IF(WIN32 AND MFC_FOUND)
OPTION(WITH_MFC "With MFC Support" ON )

@ -6,6 +6,6 @@ IF(WITH_NEL_CEGUI)
ADD_SUBDIRECTORY(cegui)
ENDIF(WITH_NEL_CEGUI)
#IF(WITH_QT)
# ADD_SUBDIRECTORY(qtnel)
#ENDIF(WITH_QT)
IF(WITH_QT5)
ADD_SUBDIRECTORY(nel_qt)
ENDIF(WITH_QT5)

@ -0,0 +1,27 @@
FILE(GLOB SRCS *.cpp)
FILE(GLOB HDRS *.h)
FILE(GLOB RESOURCES *.qrc)
SET(CMAKE_AUTOMOC ON)
QT5_ADD_RESOURCES(RESOURCE_ADDED ${RESOURCES})
ADD_EXECUTABLE(nl_sample_qt WIN32 ${SRC}
${SRCS}
${HDRS}
${RESOURCE_ADDED}
)
TARGET_LINK_LIBRARIES(nl_sample_qt
nelmisc
nel3d
nelsound
Qt5::Widgets)
NL_DEFAULT_PROPS(nl_sample_qt "NeL, Samples, 3D: Qt")
NL_ADD_RUNTIME_FLAGS(nl_sample_qt)
qt5_use_modules(nl_sample_qt Widgets)
INSTALL(TARGETS nl_sample_qt RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT samples3d)

@ -20,7 +20,7 @@
// STL includes
// Qt includes
#include <QtGui/QVBoxLayout>
#include <QVBoxLayout>
// NeL includes
#include <nel/misc/debug.h>
@ -173,7 +173,7 @@ void CCommandLog::returnPressed()
if (text.isEmpty())
return;
std::string cmd = text.toAscii().data();
std::string cmd = text.toLocal8Bit().data();
ICommand::execute(cmd, InfoLog());
m_CommandInput->clear();

@ -21,9 +21,9 @@
// STL includes
// Qt includes
#include <QtGui/QWidget>
#include <QtGui/QTextEdit>
#include <QtGui/QLineEdit>
#include <QWidget>
#include <QTextEdit>
#include <QLineEdit>
// NeL includes
#include <nel/misc/log.h>

@ -20,9 +20,9 @@
// STL includes
// Qt includes
#include <QtGui/QVBoxLayout>
#include <QtGui/QHBoxLayout>
#include <QtGui/QUndoStack>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QUndoStack>
// NeL includes
// #include <nel/misc/debug.h>

@ -21,13 +21,13 @@
// STL includes
// Qt includes
#include <QtGui/QWidget>
#include <QtGui/QCheckBox>
#include <QtGui/QPushButton>
#include <QtGui/QGroupBox>
#include <QtGui/QComboBox>
#include <QtGui/QLabel>
#include <QtGui/QLineEdit>
#include <QWidget>
#include <QCheckBox>
#include <QPushButton>
#include <QGroupBox>
#include <QComboBox>
#include <QLabel>
#include <QLineEdit>
// NeL includes
#include <nel/misc/config_file.h>
@ -60,8 +60,8 @@ public:
void incbTranslate();
inline bool getGraphicsEnabled() const { return m_Enabled->isChecked(); }
inline std::string getGraphicsDriver() const { std::string v = std::string(m_Driver->currentText().toAscii()); return v; }
inline std::string getFontName() const { std::string v = std::string(m_FontName->text().toAscii()); return v; }
inline std::string getGraphicsDriver() const { std::string v = std::string(m_Driver->currentText().toLocal8Bit()); return v; }
inline std::string getFontName() const { std::string v = std::string(m_FontName->text().toLocal8Bit()); return v; }
inline NLMISC::CRGBA getBackgroundColor() const { QColor c = m_BackgroundColor->currentColor(); NLMISC::CRGBA v(c.red(), c.green(), c.blue()); return v; }
inline bool getFontShadow() const { return m_FontShadow->isChecked(); }

@ -20,7 +20,7 @@
// STL includes
// Qt includes
#include <QtGui/QAction>
#include <QAction>
// NeL includes
#include <nel/misc/debug.h>
@ -92,7 +92,7 @@ void CGraphicsViewport::init(CGraphicsConfig *graphicsConfig)
nlassert(m_Driver);
// initialize the window with config file values
m_Driver->setDisplay(winId(), NL3D::UDriver::CMode(width(), height(), 32));
m_Driver->setDisplay((nlWindow)winId(), NL3D::UDriver::CMode(width(), height(), 32));
// register config callbacks
connect(m_GraphicsConfig, SIGNAL(onBackgroundColor(NLMISC::CRGBA)),

@ -21,7 +21,7 @@
// STL includes
// Qt includes
#include <QtGui/QWidget>
#include <QWidget>
// NeL includes
#include <nel/misc/config_file.h>

@ -20,11 +20,20 @@
// STL includes
// Qt includes
#include <QtGui/QtGui>
#include <QtGui/QTreeView>
#include <QtGui/QDirModel>
#include <QtGui/QUndoStack>
#include <QtGui/QScrollArea>
#include <QtGui>
#include <QTreeView>
#include <QDirModel>
#include <QUndoStack>
#include <QScrollArea>
#include <QApplication>
#include <QAction>
#include <QMenuBar>
#include <QMenu>
#include <QDockWidget>
#include <QToolBar>
#include <QStatusBar>
#include <QStyleFactory>
#include <QMessageBox>
// NeL includes
// #include <nel/misc/debug.h>
@ -69,10 +78,6 @@ CMainWindow::CMainWindow(const QMap<QString, QSize> &customSizeHints, QWidget *p
m_Configuration.init();
m_OriginalPalette = QApplication::palette();
m_Configuration.setAndCallback("QtStyle", CConfigCallback(this, &CMainWindow::cfcbQtStyle));
m_Configuration.setAndCallback("QtPalette", CConfigCallback(this, &CMainWindow::cfcbQtPalette));
m_Internationalization.init(&m_Configuration);
m_Internationalization.enableCallback(CEmptyCallback(this, &CMainWindow::incbLanguageCode));
@ -361,18 +366,6 @@ void CMainWindow::recalculateMinimumWidth()
m_GraphicsConfigScroll->setMinimumWidth(m_GraphicsConfig->minimumSizeHint().width() + m_GraphicsConfigScroll->minimumSizeHint().width());
}
void CMainWindow::cfcbQtStyle(NLMISC::CConfigFile::CVar &var)
{
QApplication::setStyle(QStyleFactory::create(var.asString().c_str()));
recalculateMinimumWidth();
}
void CMainWindow::cfcbQtPalette(NLMISC::CConfigFile::CVar &var)
{
if (var.asBool()) QApplication::setPalette(QApplication::style()->standardPalette());
else QApplication::setPalette(m_OriginalPalette);
}
void CMainWindow::applyGraphicsConfig()
{
// reinitializes the graphics system completely

@ -21,7 +21,7 @@
// STL includes
// Qt includes
#include <QtGui/QMainWindow>
#include <QMainWindow>
// NeL includes
#include <nel/misc/rgba.h>
@ -105,9 +105,6 @@ private:
void recalculateMinimumWidth();
void cfcbQtStyle(NLMISC::CConfigFile::CVar &var);
void cfcbQtPalette(NLMISC::CConfigFile::CVar &var);
void cfcbSoundEnabled(NLMISC::CConfigFile::CVar &var);
void incbLanguageCode();
@ -123,8 +120,6 @@ private:
QUndoStack *m_UndoStack;
QPalette m_OriginalPalette;
bool m_IsGraphicsInitialized, m_IsGraphicsEnabled;
bool m_IsSoundInitialized, m_IsSoundEnabled;

@ -26,9 +26,10 @@
#endif
// Qt includes
#include <QtGui/QApplication>
#include <QApplication>
#include <QtCore/QMap>
#include <QtCore/qdebug.h>
#include <QStyleFactory>
// NeL includes
#include <nel/misc/debug.h>
@ -36,6 +37,7 @@
#include <nel/misc/file.h>
#include <nel/misc/path.h>
#include <nel/misc/command.h>
#include <nel/misc/sheet_id.h>
// Project includes
#include "nel_qt_config.h"
@ -178,15 +180,39 @@ sint main(int argc, char **argv)
hr = hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
bool coInitOk = (hr == S_OK) || (hr == S_FALSE);
#endif
CSheetId::initWithoutSheet();
QApplication app(argc, const_cast<char **>(argv));
QApplication::setStyle(QStyleFactory::create("Fusion"));
QPalette palette = app.palette();
palette.setColor(QPalette::Window, QColor(64, 64, 64));
palette.setColor(QPalette::WindowText, Qt::white);
palette.setColor(QPalette::Base, QColor(48, 48, 48));
palette.setColor(QPalette::AlternateBase, QColor(64, 64, 64));
palette.setColor(QPalette::ToolTipBase, Qt::white);
palette.setColor(QPalette::ToolTipText, Qt::white);
palette.setColor(QPalette::Text, Qt::white);
palette.setColor(QPalette::Button, QColor(64, 64, 64));
palette.setColor(QPalette::ButtonText, Qt::white);
palette.setColor(QPalette::BrightText, Qt::red);
palette.setColor(QPalette::Highlight, QColor(64, 128, 96));
palette.setColor(QPalette::HighlightedText, Qt::white);
app.setPalette(palette);
QMap<QString, QSize> customSizeHints = parseCustomSizeHints(argc, argv);
NLQT::CMainWindow mainWin(customSizeHints);
mainWin.resize(800, 600);
mainWin.show(); // calls isVisible(true)
int result = app.exec();
#ifdef NL_OS_WINDOWS
if (coInitOk) CoUninitialize();
#endif
return result;
}

@ -46,13 +46,13 @@
#ifndef QTCOLORPICKER_H
#define QTCOLORPICKER_H
#include <QtGui/QPushButton>
#include <QPushButton>
#include <QtCore/QString>
#include <QtGui/QColor>
#include <QColor>
#include <QtGui/QLabel>
#include <QLabel>
#include <QtCore/QEvent>
#include <QtGui/QFocusEvent>
#include <QFocusEvent>
#define QT_QTCOLORPICKER_EXPORT

@ -44,24 +44,24 @@
**
****************************************************************************/
#include <QtGui/QApplication>
#include <QtGui/QDesktopWidget>
#include <QtGui/QPainter>
#include <QtGui/QPushButton>
#include <QtGui/QColorDialog>
#include <QApplication>
#include <QDesktopWidget>
#include <QPainter>
#include <QPushButton>
#include <QColorDialog>
#include <QtCore/QMap>
#include <QtGui/QLayout>
#include <QtGui/QStyle>
#include <QtGui/QLabel>
#include <QtGui/QToolTip>
#include <QtGui/QPixmap>
#include <QtGui/QFocusEvent>
#include <QtGui/QPaintEvent>
#include <QtGui/QGridLayout>
#include <QtGui/QHideEvent>
#include <QtGui/QKeyEvent>
#include <QtGui/QShowEvent>
#include <QtGui/QMouseEvent>
#include <QLayout>
#include <QStyle>
#include <QLabel>
#include <QToolTip>
#include <QPixmap>
#include <QFocusEvent>
#include <QPaintEvent>
#include <QGridLayout>
#include <QHideEvent>
#include <QKeyEvent>
#include <QShowEvent>
#include <QMouseEvent>
#include <math.h>
#include "qtcolorpicker.h"

@ -20,10 +20,10 @@
// STL includes
// Qt includes
#include <QtGui/QUndoStack>
#include <QtGui/QAbstractButton>
#include <QtGui/QLineEdit>
#include <QtGui/QComboBox>
#include <QUndoStack>
#include <QAbstractButton>
#include <QLineEdit>
#include <QComboBox>
// NeL includes
#include <nel/misc/debug.h>

@ -23,8 +23,8 @@
// Qt includes
#include <QtCore/QObject>
#include <QtCore/QString>
#include <QtGui/QColor>
#include <QtGui/QUndoCommand>
#include <QColor>
#include <QUndoCommand>
// NeL includes

@ -62,6 +62,10 @@ IF(WITH_NEL_TOOLS AND WITH_3D)
ADD_SUBDIRECTORY(object_viewer_widget)
ENDIF(WITH_QT)
IF(WITH_QT5)
ADD_SUBDIRECTORY(panoply_preview)
ENDIF()
IF(SQUISH_FOUND)
ADD_SUBDIRECTORY(s3tc_compressor_lib)
ADD_SUBDIRECTORY(panoply_maker)

@ -0,0 +1,36 @@
FILE(GLOB SRCS *.cpp)
FILE(GLOB HDRS *.h)
IF (WIN32)
FILE(GLOB RSRC *.rc)
ENDIF (WIN32)
FILE(GLOB RESOURCES *.qrc)
FILE(GLOB PANOPLY_MAKER ../panoply_maker/color_modifier.cpp ../panoply_maker/color_modifier.h)
SOURCE_GROUP("" FILES ${SRCS} ${HDRS} ${RSRC} ${RESOURCES})
SOURCE_GROUP("panoply_maker" FILES ${PANOPLY_MAKER})
SET(CMAKE_AUTOMOC ON)
QT5_ADD_RESOURCES(RESOURCE_ADDED ${RESOURCES})
ADD_EXECUTABLE(nl_panoply_preview WIN32 ${SRC}
${SRCS}
${HDRS}
${RSRC}
${RESOURCE_ADDED}
${PANOPLY_MAKER}
)
TARGET_LINK_LIBRARIES(nl_panoply_preview
nelmisc
nel3d
Qt5::Widgets)
NL_DEFAULT_PROPS(nl_panoply_preview "NeL, Tools, 3D: panoply_preview")
NL_ADD_RUNTIME_FLAGS(nl_panoply_preview)
QT5_USE_MODULES(nl_panoply_preview Widgets)
INSTALL(TARGETS nl_panoply_preview RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT samples3d)

@ -0,0 +1,195 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2014 Jan BOON (jan.boon@kaetemi.be)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <nel/misc/types_nl.h>
#include "command_log.h"
// STL includes
// Qt includes
#include <QVBoxLayout>
// NeL includes
#include <nel/misc/debug.h>
#include <nel/misc/command.h>
#include <nel/misc/path.h>
// Project includes
using namespace std;
using namespace NLMISC;
namespace NLTOOLS {
CCommandLog::CCommandLog(QWidget *parent) : QWidget(parent)
{
m_DisplayerOutput = new QTextEdit();
m_DisplayerOutput->setReadOnly(true);
m_DisplayerOutput->setFocusPolicy(Qt::NoFocus);
m_CommandInput = new QLineEdit();
QVBoxLayout *layout = new QVBoxLayout();
layout->addWidget(m_DisplayerOutput);
layout->addWidget(m_CommandInput);
setLayout(layout);
connect(m_CommandInput, SIGNAL(returnPressed()), this, SLOT(returnPressed()));
connect(this, SIGNAL(tSigDisplay(const QColor &, const QString &)), this, SLOT(tSlotDisplay(const QColor &, const QString &)));
DebugLog->addDisplayer(this);
InfoLog->addDisplayer(this);
WarningLog->addDisplayer(this);
AssertLog->addDisplayer(this);
ErrorLog->addDisplayer(this);
}
CCommandLog::~CCommandLog()
{
DebugLog->removeDisplayer(this);
InfoLog->removeDisplayer(this);
WarningLog->removeDisplayer(this);
AssertLog->removeDisplayer(this);
ErrorLog->removeDisplayer(this);
}
void CCommandLog::doDisplay(const CLog::TDisplayInfo& args, const char *message)
{
QColor color;
switch (args.LogType)
{
case CLog::LOG_DEBUG:
color = Qt::gray;
break;
case CLog::LOG_STAT:
color = Qt::green;
break;
case CLog::LOG_NO:
case CLog::LOG_UNKNOWN:
case CLog::LOG_INFO:
color = Qt::white;
break;
case CLog::LOG_WARNING:
color = Qt::yellow;
break;
case CLog::LOG_ERROR:
case CLog::LOG_ASSERT:
color = Qt::red;
break;
default:
color = Qt::black;
break;
}
bool needSpace = false;
//stringstream ss;
string str;
if (args.LogType != CLog::LOG_NO)
{
str += logTypeToString(args.LogType);
needSpace = true;
}
// Write thread identifier
if (args.ThreadId != 0)
{
if (needSpace) { str += " "; needSpace = false; }
#ifdef NL_OS_WINDOWS
str += NLMISC::toString("%4x", args.ThreadId);
#else
str += NLMISC::toString("%08x", args.ThreadId);
#endif
needSpace = true;
}
if (args.FileName != NULL)
{
if (needSpace) { str += " "; needSpace = false; }
str += NLMISC::toString("%20s", CFile::getFilename(args.FileName).c_str());
needSpace = true;
}
if (args.Line != -1)
{
if (needSpace) { str += " "; needSpace = false; }
str += NLMISC::toString("%4u", args.Line);
//ss << setw(4) << args.Line;
needSpace = true;
}
if (args.FuncName != NULL)
{
if (needSpace) { str += " "; needSpace = false; }
str += NLMISC::toString("%20s", args.FuncName);
needSpace = true;
}
if (needSpace) { str += ": "; needSpace = false; }
uint nbl = 1;
char *npos, *pos = const_cast<char *>(message);
while ((npos = strchr (pos, '\n')))
{
*npos = '\0';
str += pos;
/*if (needSlashR)
str += "\r";*/
str += "\n";
*npos = '\n';
pos = npos+1;
nbl++;
}
str += pos;
pos = const_cast<char *>(args.CallstackAndLog.c_str());
while ((npos = strchr (pos, '\n')))
{
*npos = '\0';
str += pos;
/*if (needSlashR)
str += "\r";*/
str += "\n";
*npos = '\n';
pos = npos+1;
nbl++;
}
str += pos;
tSigDisplay(color, str.substr(0, str.size() - 1).c_str());
}
void CCommandLog::tSlotDisplay(const QColor &c, const QString &text)
{
m_DisplayerOutput->setTextColor(c);
m_DisplayerOutput->append(text);
}
void CCommandLog::returnPressed()
{
QString text = m_CommandInput->text();
if (text.isEmpty())
return;
std::string cmd = text.toLocal8Bit().data();
ICommand::execute(cmd, InfoLog());
m_CommandInput->clear();
}
} /* namespace NLTOOLS */
/* end of file */

@ -0,0 +1,74 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2014 Jan BOON (jan.boon@kaetemi.be)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NLTOOLS_COMMAND_LOG_H
#define NLTOOLS_COMMAND_LOG_H
#include <nel/misc/types_nl.h>
// STL includes
// Qt includes
#include <QWidget>
#include <QTextEdit>
#include <QLineEdit>
// NeL includes
#include <nel/misc/log.h>
#include <nel/misc/displayer.h>
// Project includes
namespace NLTOOLS {
/**
* CCommandLog
* \brief CCommandLog
* \date 2010-02-05 20:27GMT
* \author Jan BOON (jan.boon@kaetemi.be)
*/
class CCommandLog : public QWidget, public NLMISC::IDisplayer
{
Q_OBJECT
public:
CCommandLog(QWidget *parent);
virtual ~CCommandLog();
protected:
virtual void doDisplay(const NLMISC::CLog::TDisplayInfo& args, const char *message);
signals:
void tSigDisplay(const QColor &c, const QString &text);
private slots:
void returnPressed();
void tSlotDisplay(const QColor &c, const QString &text);
private:
QTextEdit *m_DisplayerOutput;
QLineEdit *m_CommandInput;
private:
CCommandLog(const CCommandLog &);
CCommandLog &operator=(const CCommandLog &);
}; /* class CCommandLog */
} /* namespace NLTOOLS */
#endif /* #ifndef NLTOOLS_COMMAND_LOG_H */
/* end of file */

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

@ -0,0 +1 @@
IDI_ICON1 ICON DISCARDABLE "greenpill.ico"

@ -0,0 +1,138 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2014 Jan BOON (jan.boon@kaetemi.be)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <nel/misc/types_nl.h>
#include "main_window.h"
// STL includes
// Qt includes
#include <QtGui>
#include <QTreeView>
#include <QDirModel>
#include <QUndoStack>
#include <QScrollArea>
#include <QApplication>
#include <QAction>
#include <QMenuBar>
#include <QMenu>
#include <QDockWidget>
#include <QToolBar>
#include <QStatusBar>
#include <QStyleFactory>
#include <QMessageBox>
// NeL includes
// #include <nel/misc/debug.h>
#include <nel/misc/i18n.h>
#include <nel/3d/u_driver.h>
// Project includes
#include "command_log.h"
#include "panoply_preview.h"
using namespace std;
using namespace NLMISC;
namespace NLTOOLS {
namespace {
QString nli18n(const char *label)
{
return QString::fromUtf16(CI18N::get(label).c_str());
}
} /* anonymous namespace */
CMainWindow::CMainWindow(const QMap<QString, QSize> &customSizeHints, QWidget *parent, Qt::WindowFlags flags)
: QMainWindow(parent, flags),
m_PanoplyPreview(NULL),
m_CommandLog(NULL), m_CommandLogDock(NULL),
m_WidgetsMenu(NULL), m_HelpMenu(NULL),
m_AboutAct(NULL)
{
setObjectName("CMainWindow");
setWindowTitle(tr("NeL Panoply Preview"));
createActions();
createMenus();
createToolBars();
createStatusBar();
m_PanoplyPreview = new CPanoplyPreview(this);
setCentralWidget(m_PanoplyPreview);
createDockWindows();
}
CMainWindow::~CMainWindow()
{
}
void CMainWindow::createActions()
{
m_AboutAct = new QAction(this);
connect(m_AboutAct, SIGNAL(triggered()), this, SLOT(about()));
m_AboutAct->setText(tr("About"));
m_AboutAct->setStatusTip(tr("About"));
}
void CMainWindow::createMenus()
{
m_WidgetsMenu = menuBar()->addMenu(QString::null);
m_HelpMenu = menuBar()->addMenu(QString::null);
m_HelpMenu->addAction(m_AboutAct);
m_WidgetsMenu->setTitle(tr("Widgets"));
m_HelpMenu->setTitle(tr("Help"));
}
void CMainWindow::createToolBars()
{
}
void CMainWindow::createStatusBar()
{
statusBar()->showMessage(tr("Ready"));
}
void CMainWindow::createDockWindows()
{
// CommandLog (Console)
{
m_CommandLogDock = new QDockWidget(this);
m_CommandLogDock->setWindowTitle(tr("Console"));
m_CommandLogDock->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea);
m_CommandLog = new CCommandLog(m_CommandLogDock);
m_CommandLogDock->setWidget(m_CommandLog);
addDockWidget(Qt::BottomDockWidgetArea, m_CommandLogDock);
m_WidgetsMenu->addAction(m_CommandLogDock->toggleViewAction());
}
}
void CMainWindow::about()
{
QMessageBox::about(this, tr("Panoply Preview"), tr("Copyright (C) 2014 Jan BOON (jan.boon@kaetemi.be)"));
}
} /* namespace NLTOOLS */
/* end of file */

@ -0,0 +1,92 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2014 Jan BOON (jan.boon@kaetemi.be)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NLTOOLS_MAIN_WINDOW_H
#define NLTOOLS_MAIN_WINDOW_H
#include <nel/misc/types_nl.h>
// STL includes
// Qt includes
#include <QMainWindow>
// NeL includes
#include <nel/misc/rgba.h>
#include <nel/misc/ucstring.h>
#include <nel/misc/time_nl.h>
#include <nel/3d/animation_time.h>
#include <nel/net/login_cookie.h>
// Project includes
// ...
class QTreeView;
class QDirModel;
class QUndoStack;
class QScrollArea;
namespace NLTOOLS {
class CCommandLog;
class CPanoplyPreview;
/**
* CMainWindow
* \brief CMainWindow
* \date 2014-09-19 09:38GMT
* \author Jan BOON (jan.boon@kaetemi.be)
*/
class CMainWindow : public QMainWindow
{
Q_OBJECT
public:
CMainWindow(const QMap<QString, QSize> &customSizeHints, QWidget *parent = 0, Qt::WindowFlags flags = 0);
virtual ~CMainWindow();
inline QMenu *widgetsMenu() { return m_WidgetsMenu; }
private slots:
void about();
private:
void createActions();
void createMenus();
void createToolBars();
void createStatusBar();
void createDockWindows();
private:
CMainWindow(const CMainWindow &);
CMainWindow &operator=(const CMainWindow &);
private:
CPanoplyPreview *m_PanoplyPreview;
CCommandLog *m_CommandLog;
QDockWidget *m_CommandLogDock;
QMenu *m_WidgetsMenu;
QMenu *m_HelpMenu;
QAction *m_AboutAct;
}; /* class CMainWindow */
} /* namespace NLTOOLS */
#endif /* #ifndef NLTOOLS_MAIN_WINDOW_H */
/* end of file */

@ -0,0 +1,523 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2014 Jan BOON (jan.boon@kaetemi.be)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <nel/misc/types_nl.h>
#include "panoply_preview.h"
// STL includes
// Qt includes
#include <QVBoxLayout>
#include <QDockWidget>
#include <QMenu>
#include <QGroupBox>
#include <QLineEdit>
#include <QSlider>
#include <QScrollArea>
#include <QPushButton>
#include <QLabel>
#include <QPainter>
// NeL includes
#include <nel/misc/debug.h>
#include <nel/misc/command.h>
#include <nel/misc/path.h>
#include <nel/misc/thread.h>
#include <nel/misc/mutex.h>
#include <nel/misc/bitmap.h>
#include <nel/misc/file.h>
// Project includes
#include "main_window.h"
#include "../panoply_maker/color_modifier.h"
using namespace std;
using namespace NLMISC;
namespace NLTOOLS {
class CColorThread : public NLMISC::IRunnable
{
public:
// Called when a thread is run.
virtual void run()
{
while (Running)
{
SettingsMutex.enter();
if (!Running)
{
SettingsMutex.leave();
return;
}
if (!Process)
{
SettingsMutex.leave();
nlSleep(10); // TODO: Should wait on an event signal...
continue;
}
// nldebug("Update color modifier");
m_ColorModifier.Hue = Hue;
m_ColorModifier.Lightness = Lightness;
m_ColorModifier.Saturation = Saturation;
m_ColorModifier.Luminosity = Luminosity;
m_ColorModifier.Contrast = Contrast;
Process = false;
SettingsMutex.leave();
BitmapMutex.enter();
if (!Running)
{
BitmapMutex.leave();
return;
}
if (!BitmapsOk)
{
nldebug("Bitmaps not ready");
BitmapMutex.leave();
nlSleep(500);
continue;
}
float retDeltaHue;
DestBitmap = ColorBitmap;
m_ColorModifier.convertBitmap(DestBitmap, ColorBitmap, MaskBitmap, retDeltaHue);
BitmapMutex.leave();
PanoplyPreview->displayBitmap(DestBitmap);
nlSleep(10); // TODO: Should wait on an event signal...
}
}
CColorThread() : PanoplyPreview(NULL), BitmapsOk(false), Hue(0), Lightness(0), Saturation(0), Luminosity(0), Contrast(0), Process(false), Running(true) { }
virtual ~CColorThread() { }
virtual void getName (std::string &result) const { result = "CColorThread"; }
private:
CColorModifier m_ColorModifier;
public:
CPanoplyPreview *PanoplyPreview;
NLMISC::CMutex BitmapMutex;
NLMISC::CBitmap ColorBitmap;
NLMISC::CBitmap MaskBitmap;
bool BitmapsOk;
NLMISC::CBitmap DestBitmap;
NLMISC::CMutex SettingsMutex;
float Hue;
float Lightness;
float Saturation;
float Luminosity;
float Contrast;
bool Process;
bool Running;
};
// *****************************************************************
CPanoplyPreview::CPanoplyPreview(CMainWindow *parent) : QWidget(parent)
{
connect(this, SIGNAL(tSigBitmap()), this, SLOT(tSlotBitmap()));
createDockWindows(parent);
m_Image = new QImage(512, 512, QImage::Format_RGB32);
m_Pixmap = new QPixmap(512, 512);
setMinimumWidth(512);
setMinimumHeight(512);
m_ColorThread = new CColorThread();
m_ColorThread->PanoplyPreview = this;
m_Thread = IThread::create(m_ColorThread);
m_Thread->start();
}
CPanoplyPreview::~CPanoplyPreview()
{
m_ColorThread->SettingsMutex.enter();
m_ColorThread->BitmapMutex.enter();
m_ColorThread->Running = false;
m_ColorThread->BitmapMutex.leave();
m_ColorThread->SettingsMutex.leave();
m_Thread->wait();
delete m_Thread;
delete m_ColorThread;
}
void CPanoplyPreview::paintEvent(QPaintEvent* e)
{
QPainter painter(this);
painter.drawPixmap(0, 0, *m_Pixmap);
}
void CPanoplyPreview::displayBitmap(const CBitmap &bitmap) // Called from thread!
{
// nldebug("received bitmap");
m_ColorThread->BitmapMutex.enter();
m_ImageMutex.enter();
const char *buffer = (const char *)&bitmap.getPixels()[0];
if (bitmap.getWidth() != m_Image->width() || bitmap.getHeight() != m_Image->height())
{
QImage *image = m_Image;
m_Image = new QImage(bitmap.getWidth(), bitmap.getHeight(), QImage::Format_RGB32);
delete image;
}
for (uint32 y = 0; y < bitmap.getHeight(); ++y)
{
uint8 *dst = (uint8 *)m_Image->scanLine(y);
const uint8 *src = (const uint8 *)&buffer[y * bitmap.getWidth() * sizeof(uint32)];
for (uint32 x = 0; x < bitmap.getWidth(); ++x)
{
uint32 xb = x * 4;
dst[xb + 0] = src[xb + 2];
dst[xb + 1] = src[xb + 1];
dst[xb + 2] = src[xb + 0];
dst[xb + 3] = src[xb + 3];
}
//memcpy(m_Image->scanLine(y), &buffer[y * bitmap.getWidth() * sizeof(uint32)], sizeof(uint32) * bitmap.getWidth());
}
m_ImageMutex.leave();
m_ColorThread->BitmapMutex.leave();
tSigBitmap();
}
void CPanoplyPreview::tSlotBitmap()
{
// nldebug("display bitmap");
m_ImageMutex.enter();
if (m_Image->width() != m_Pixmap->width()
|| m_Image->height() != m_Pixmap->height())
{
QPixmap *pixmap = m_Pixmap;
m_Pixmap = new QPixmap(m_Image->width(), m_Image->height());
setMinimumWidth(m_Pixmap->width());
setMinimumHeight(m_Pixmap->height());
delete pixmap;
}
m_Pixmap->convertFromImage(*m_Image);
repaint();
m_ImageMutex.leave();
}
void CPanoplyPreview::colorEdited(const QString &text)
{
m_ColorFile = text;
}
void CPanoplyPreview::maskEdited(const QString &text)
{
m_MaskFile = text;
}
void CPanoplyPreview::goPushed(bool)
{
// nldebug("push bitmaps");
m_ColorThread->SettingsMutex.enter();
m_ColorThread->BitmapMutex.enter();
m_ColorThread->BitmapsOk = false;
try
{
{
NLMISC::CIFile is;
if (!is.open(m_ColorFile.toLocal8Bit().data()))
throw NLMISC::Exception("Cannot open file '%s'", m_ColorFile.toLocal8Bit().data());
uint32 depth = m_ColorThread->ColorBitmap.load(is);
if (depth == 0 || m_ColorThread->ColorBitmap.getPixels().empty())
throw NLMISC::Exception("Failed to load bitmap '%s'", m_ColorFile.toLocal8Bit().data());
if (m_ColorThread->ColorBitmap.PixelFormat != NLMISC::CBitmap::RGBA)
m_ColorThread->ColorBitmap.convertToType(NLMISC::CBitmap::RGBA);
}
{
NLMISC::CIFile is;
if (!is.open(m_MaskFile.toLocal8Bit().data()))
throw NLMISC::Exception("Cannot open file '%s'", m_MaskFile.toLocal8Bit().data());
uint32 depth = m_ColorThread->MaskBitmap.load(is);
if (depth == 0 || m_ColorThread->MaskBitmap.getPixels().empty())
throw NLMISC::Exception("Failed to load bitmap '%s'", m_MaskFile.toLocal8Bit().data());
if (m_ColorThread->MaskBitmap.PixelFormat != NLMISC::CBitmap::RGBA)
m_ColorThread->MaskBitmap.convertToType(NLMISC::CBitmap::RGBA);
}
{
m_ColorThread->BitmapsOk = true;
m_ColorThread->Process = true;
}
}
catch (const NLMISC::Exception &e)
{
nlwarning("Exception: '%s'", e.what());
}
m_ColorThread->BitmapMutex.leave();
m_ColorThread->SettingsMutex.leave();
// nldebug("done pushing butmaps");
}
void CPanoplyPreview::hueChanged(int value)
{
float v = (float)value;
m_ColorThread->SettingsMutex.enter();
m_ColorThread->Hue = v;
m_ColorThread->Process = true;
m_ColorThread->SettingsMutex.leave();
}
void CPanoplyPreview::lightnessChanged(int value)
{
float v = (float)value * 0.01f;
m_ColorThread->SettingsMutex.enter();
m_ColorThread->Lightness = v;
m_ColorThread->Process = true;
m_ColorThread->SettingsMutex.leave();
}
void CPanoplyPreview::saturationChanged(int value)
{
float v = (float)value * 0.01f;
m_ColorThread->SettingsMutex.enter();
m_ColorThread->Saturation = v;
m_ColorThread->Process = true;
m_ColorThread->SettingsMutex.leave();
}
void CPanoplyPreview::luminosityChanged(int value)
{
float v = (float)value;
m_ColorThread->SettingsMutex.enter();
m_ColorThread->Luminosity = v;
m_ColorThread->Process = true;
m_ColorThread->SettingsMutex.leave();
}
void CPanoplyPreview::contrastChanged(int value)
{
float v = (float)value;
m_ColorThread->SettingsMutex.enter();
m_ColorThread->Contrast = v;
m_ColorThread->Process = true;
m_ColorThread->SettingsMutex.leave();
}
// *****************************************************************
CSliderTextEdit::CSliderTextEdit(QWidget *parent, QLineEdit *lineEdit, float scale) : QSlider(Qt::Horizontal, parent), m_LineEdit(lineEdit), m_Updating(false), m_Scale(scale)
{
connect(this, SIGNAL(valueChanged(int)), this, SLOT(sliderValueChanged(int)));
connect(lineEdit, SIGNAL(textEdited(const QString &)), this, SLOT(lineEditTextEdited(const QString &)));
}
CSliderTextEdit::~CSliderTextEdit()
{
}
void CSliderTextEdit::lineEditTextEdited(const QString &text)
{
if (!m_Updating)
{
m_Updating = true;
setValue((int)(text.toFloat() * m_Scale));
m_Updating = false;
}
}
void CSliderTextEdit::sliderValueChanged(int value)
{
if (!m_Updating)
{
m_Updating = true;
m_LineEdit->setText(QString::number((double)value / (double)m_Scale));
m_Updating = false;
}
}
// *****************************************************************
void CPanoplyPreview::createDockWindows(CMainWindow *mainWindow)
{
nlassert(mainWindow);
// Color Modifier
{
QDockWidget *dockWidget = new QDockWidget(mainWindow);
nlassert(dockWidget);
dockWidget->setWindowTitle(tr("Color Modifier"));
dockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
QScrollArea *scrollArea = new QScrollArea(dockWidget);
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
scrollArea->setWidgetResizable(true);
QWidget *widget = new QWidget(scrollArea);
QVBoxLayout *vboxLayout = new QVBoxLayout(widget);
// Input File Paths
{
QGroupBox *groupBox = new QGroupBox(widget);
groupBox->setTitle(tr("Input File Paths"));
QGridLayout *groupLayout = new QGridLayout(groupBox);
QLabel *colorLabel = new QLabel(groupBox);
colorLabel->setText(tr("Color: "));
groupLayout->addWidget(colorLabel, 0, 0);
QLineEdit *colorFile = new QLineEdit(groupBox);
colorFile->setText("W:\\database\\stuff\\fyros\\agents\\_textures\\actors\\fy_hof_armor00_arm01_c1.png");
groupLayout->addWidget(colorFile, 0, 1);
m_ColorFile = colorFile->text();
connect(colorFile, SIGNAL(textEdited(const QString &)), this, SLOT(colorEdited(const QString &)));
QLabel *maskLabel = new QLabel(groupBox);
maskLabel->setText(tr("Mask: "));
groupLayout->addWidget(maskLabel, 1, 0);
QLineEdit *maskFile = new QLineEdit(groupBox);
maskFile->setText("W:\\database\\stuff\\fyros\\agents\\_textures\\actors\\mask\\fy_hof_armor00_arm01_c1_skin.png");
groupLayout->addWidget(maskFile, 1, 1);
m_MaskFile = maskFile->text();
connect(maskFile, SIGNAL(textEdited(const QString &)), this, SLOT(maskEdited(const QString &)));
QPushButton *go = new QPushButton(groupBox);
go->setText(tr("Go"));
groupLayout->addWidget(go, 2, 0, 1, 2);
connect(go, SIGNAL(clicked(bool)), this, SLOT(goPushed(bool)));
groupBox->setLayout(groupLayout);
vboxLayout->addWidget(groupBox);
}
// Color Modifier
{
QGroupBox *groupBox = new QGroupBox(widget);
groupBox->setTitle(tr("Color Modifier"));
QGridLayout *groupLayout = new QGridLayout(groupBox);
QLabel *label;
QLineEdit *edit;
CSliderTextEdit *slider;
label = new QLabel(groupBox);
label->setText(tr("Hue [0, 360]: "));
groupLayout->addWidget(label, 0, 0);
edit = new QLineEdit(groupBox);
edit->setText("0");
groupLayout->addWidget(edit, 0, 1);
slider = new CSliderTextEdit(groupBox, edit, 1.0f);
slider->setMinimum(0);
slider->setMaximum(360);
slider->setValue(0);
groupLayout->addWidget(slider, 1, 0, 1, 2);
connect(slider, SIGNAL(valueChanged(int)), this, SLOT(hueChanged(int)));
label = new QLabel(groupBox);
label->setText(tr("Lightness [-1, 1]: "));
groupLayout->addWidget(label, 2, 0);
edit = new QLineEdit(groupBox);
edit->setText("0");
groupLayout->addWidget(edit, 2, 1);
slider = new CSliderTextEdit(groupBox, edit, 100.0f);
slider->setMinimum(-100);
slider->setMaximum(100);
slider->setValue(0);
groupLayout->addWidget(slider, 3, 0, 1, 2);
connect(slider, SIGNAL(valueChanged(int)), this, SLOT(lightnessChanged(int)));
label = new QLabel(groupBox);
label->setText(tr("Saturation [-1, 1]: "));
groupLayout->addWidget(label, 4, 0);
edit = new QLineEdit(groupBox);
edit->setText("0");
groupLayout->addWidget(edit, 4, 1);
slider = new CSliderTextEdit(groupBox, edit, 100.0f);
slider->setMinimum(-100);
slider->setMaximum(100);
slider->setValue(0);
groupLayout->addWidget(slider, 5, 0, 1, 2);
connect(slider, SIGNAL(valueChanged(int)), this, SLOT(saturationChanged(int)));
label = new QLabel(groupBox);
label->setText(tr("Luminosity [-100, 100]: "));
groupLayout->addWidget(label, 6, 0);
edit = new QLineEdit(groupBox);
edit->setText("0");
groupLayout->addWidget(edit, 6, 1);
slider = new CSliderTextEdit(groupBox, edit, 1.0f);
slider->setMinimum(-100);
slider->setMaximum(100);
slider->setValue(0);
groupLayout->addWidget(slider, 7, 0, 1, 2);
connect(slider, SIGNAL(valueChanged(int)), this, SLOT(luminosityChanged(int)));
label = new QLabel(groupBox);
label->setText(tr("Contrast [-100, 100]: "));
groupLayout->addWidget(label, 8, 0);
edit = new QLineEdit(groupBox);
edit->setText("0");
groupLayout->addWidget(edit, 8, 1);
slider = new CSliderTextEdit(groupBox, edit, 1.0f);
slider->setMinimum(-100);
slider->setMaximum(100);
slider->setValue(0);
groupLayout->addWidget(slider, 9, 0, 1, 2);
connect(slider, SIGNAL(valueChanged(int)), this, SLOT(contrastChanged(int)));
groupBox->setLayout(groupLayout);
vboxLayout->addWidget(groupBox);
}
vboxLayout->addStretch();
widget->setLayout(vboxLayout);
scrollArea->setWidget(widget);
dockWidget->setWidget(scrollArea);
mainWindow->addDockWidget(Qt::LeftDockWidgetArea, dockWidget);
mainWindow->widgetsMenu()->addAction(dockWidget->toggleViewAction());
}
}
} /* namespace NLTOOLS */
/* end of file */

@ -0,0 +1,125 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2014 Jan BOON (jan.boon@kaetemi.be)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NLTOOLS_PANOPLY_PREVIEW_H
#define NLTOOLS_PANOPLY_PREVIEW_H
#include <nel/misc/types_nl.h>
// STL includes
// Qt includes
#include <QWidget>
#include <QTextEdit>
#include <QLineEdit>
#include <QSlider>
#include <QImage>
#include <QPixmap>
// NeL includes
#include <nel/misc/log.h>
#include <nel/misc/displayer.h>
// Project includes
namespace NLMISC {
class CBitmap;
class IThread;
}
namespace NLTOOLS {
class CMainWindow;
class CColorThread;
/**
* CPanoplyPreview
* \brief CPanoplyPreview
* \date 2014-09-19 09:38GMT
* \author Jan BOON (jan.boon@kaetemi.be)
*/
class CPanoplyPreview : public QWidget
{
Q_OBJECT
public:
CPanoplyPreview(CMainWindow *parent);
virtual ~CPanoplyPreview();
void displayBitmap(const NLMISC::CBitmap &bitmap); // Called from thread!
protected:
virtual void paintEvent(QPaintEvent *e);
signals:
void tSigBitmap();
private slots:
void tSlotBitmap();
void colorEdited(const QString &text);
void maskEdited(const QString &text);
void goPushed(bool);
void hueChanged(int value);
void lightnessChanged(int value);
void saturationChanged(int value);
void luminosityChanged(int value);
void contrastChanged(int value);
private:
void createDockWindows(CMainWindow *mainWindow);
private:
NLMISC::IThread *m_Thread;
CColorThread *m_ColorThread;
QString m_ColorFile;
QString m_MaskFile;
QImage *m_Image;
QPixmap *m_Pixmap;
NLMISC::CMutex m_ImageMutex;
private:
CPanoplyPreview(const CPanoplyPreview &);
CPanoplyPreview &operator=(const CPanoplyPreview &);
}; /* class CPanoplyPreview */
class CSliderTextEdit : public QSlider
{
Q_OBJECT
public:
CSliderTextEdit(QWidget *parent, QLineEdit *lineEdit, float scale);
virtual ~CSliderTextEdit();
private slots:
void lineEditTextEdited(const QString &text);
void sliderValueChanged(int value);
private:
QLineEdit *m_LineEdit;
bool m_Updating;
float m_Scale;
};
} /* namespace NLTOOLS */
#endif /* #ifndef NLTOOLS_PANOPLY_PREVIEW_H */
/* end of file */

@ -0,0 +1,105 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NLTOOLS_CONFIG_H
#define NLTOOLS_CONFIG_H
#include <nel/misc/types_nl.h>
// use the default log.log file (not erased on use)
// #define NLTOOLS_USE_LOG_LOG false
// the config file name
// #define NLTOOLS_CONFIG_FILE "panoply_preview.cfg"
// #define NLTOOLS_CONFIG_FILE_DEFAULT "panoply_preview_default.cfg"
// use panoply_preview log file
// #define NLTOOLS_USE_LOG 1
// panoply_preview log file name
#define NLTOOLS_LOG_FILE "panoply_preview.log"
// clear panoply_preview log before use
#define NLTOOLS_ERASE_LOG true
// version number
#define NLTOOLS_VERSION "0.10.0"
// use the low fragmentation heap (windows feature)
// #define NLTOOLS_LOW_FRAGMENTATION_HEAP 1
// temporary dev tags
//#define NL_DEV_STEREO 0
//#define NL_DEV_MEMLEAK 1
//#define NL_DEV_NET 0
//#define NL_DEV_NETNEW 1
//#define NL_DEV_CG 0
//#define NL_DEV_BULLET 0
// some default defines
#if FINAL_VERSION
# if !defined(NLTOOLS_USE_LOG_LOG)
# define NLTOOLS_USE_LOG_LOG false
# endif
# if !defined(NLTOOLS_USE_LOG)
# define NLTOOLS_USE_LOG 0
# endif
#endif
#if !defined (NLTOOLS_USE_LOG_LOG)
# define NLTOOLS_USE_LOG_LOG true
#endif
#if !defined (NLTOOLS_USE_LOG)
# define NLTOOLS_USE_LOG 1
#endif
#if !defined (NLTOOLS_LOW_FRAGMENTATION_HEAP)
# ifdef NL_OS_WINDOWS
# define NLTOOLS_LOW_FRAGMENTATION_HEAP 1
# else
# define NLTOOLS_LOW_FRAGMENTATION_HEAP 0
# endif
#endif
// for compatibility with old configuration
#ifndef NLTOOLS_CONFIG_FILE
# ifndef NLTOOLS_CONFIG
# define NLTOOLS_CONFIG_FILE "panoply_preview.cfg"
# else
# define NLTOOLS_CONFIG_FILE NLTOOLS_CONFIG "panoply_preview.cfg"
# endif
#endif
#ifndef NLTOOLS_CONFIG_FILE_DEFAULT
# define NLTOOLS_CONFIG_FILE_DEFAULT "panoply_preview_default.cfg"
#endif
#endif /* #ifndef NLTOOLS_CONFIG_H */
/* end of file */

@ -0,0 +1,189 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2014 Jan BOON (jan.boon@kaetemi.be)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <nel/misc/types_nl.h>
#include "tool_main.h"
// STL includes
#include <stdio.h>
#ifdef NL_OS_WINDOWS
# include <windows.h>
# include <direct.h>
# include <tchar.h>
#endif
// Qt includes
#include <QApplication>
#include <QtCore/QMap>
#include <QtCore/qdebug.h>
#include <QStyleFactory>
// NeL includes
#include <nel/misc/debug.h>
#include <nel/misc/common.h>
#include <nel/misc/file.h>
#include <nel/misc/path.h>
#include <nel/misc/command.h>
#include <nel/misc/sheet_id.h>
// Project includes
#include "tool_config.h"
#include "main_window.h"
using namespace std;
using namespace NLMISC;
namespace NLTOOLS {
namespace {
CFileDisplayer *s_FileDisplayer = NULL;
} /* anonymous namespace */
} /* namespace NLTOOLS */
void usage()
{
/* from Qt sample */
qWarning() << "Usage: mainwindow [-SizeHint<color> <width>x<height>] ...";
exit(1);
}
QMap<QString, QSize> parseCustomSizeHints(int argc, char **argv)
{
/* from Qt sample */
QMap<QString, QSize> result;
for (int i = 1; i < argc; ++i) {
QString arg = QString::fromLocal8Bit(argv[i]);
if (arg.startsWith(QLatin1String("-SizeHint"))) {
QString name = arg.mid(9);
if (name.isEmpty())
usage();
if (++i == argc)
usage();
QString sizeStr = QString::fromLocal8Bit(argv[i]);
int idx = sizeStr.indexOf(QLatin1Char('x'));
if (idx == -1)
usage();
bool ok;
int w = sizeStr.left(idx).toInt(&ok);
if (!ok)
usage();
int h = sizeStr.mid(idx + 1).toInt(&ok);
if (!ok)
usage();
result[name] = QSize(w, h);
}
}
return result;
}
#ifdef NL_OS_WINDOWS
# ifdef _UNICODE
# define tstring wstring
# else
# define tstring string
# endif
#endif
sint main(int argc, char **argv)
{
// go nel!
{
// use log.log if NEL_LOG_IN_FILE and NLTOOLS_USE_LOG_LOG defined as 1
createDebug(NULL, NLTOOLS_USE_LOG_LOG, false);
#if NLTOOLS_USE_LOG
// create toverhex_client.log
// filedisplayer only deletes the 001 etc
if (NLTOOLS_ERASE_LOG && CFile::isExists(NLTOOLS_LOG_FILE))
CFile::deleteFile(NLTOOLS_LOG_FILE);
// initialize the log file
NLTOOLS::s_FileDisplayer = new CFileDisplayer();
NLTOOLS::s_FileDisplayer->setParam(NLTOOLS_LOG_FILE, NLTOOLS_ERASE_LOG);
DebugLog->addDisplayer(NLTOOLS::s_FileDisplayer);
InfoLog->addDisplayer(NLTOOLS::s_FileDisplayer);
WarningLog->addDisplayer(NLTOOLS::s_FileDisplayer);
AssertLog->addDisplayer(NLTOOLS::s_FileDisplayer);
ErrorLog->addDisplayer(NLTOOLS::s_FileDisplayer);
#endif
nlinfo("Welcome to NeL!");
}
// low fragmentation heap (windows)
#if NLTOOLS_LOW_FRAGMENTATION_HEAP
ULONG heapFragValue = 2; // enable low fragmentation heap
if (HeapSetInformation(GetProcessHeap(),
HeapCompatibilityInformation,
&heapFragValue, sizeof(heapFragValue)))
{
nlinfo("HeapSetInformation OK!\n");
}
else
{
nlwarning("HeapSetInformation FAIL! (%d)\n", GetLastError());
}
#endif
#ifdef NL_OS_WINDOWS
HRESULT hr;
hr = hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
bool coInitOk = (hr == S_OK) || (hr == S_FALSE);
#endif
CSheetId::initWithoutSheet();
QApplication app(argc, const_cast<char **>(argv));
QApplication::setStyle(QStyleFactory::create("Fusion"));
QPalette palette = app.palette();
palette.setColor(QPalette::Window, QColor(64, 64, 64));
palette.setColor(QPalette::WindowText, Qt::white);
palette.setColor(QPalette::Base, QColor(48, 48, 48));
palette.setColor(QPalette::AlternateBase, QColor(64, 64, 64));
palette.setColor(QPalette::ToolTipBase, Qt::white);
palette.setColor(QPalette::ToolTipText, Qt::white);
palette.setColor(QPalette::Text, Qt::white);
palette.setColor(QPalette::Button, QColor(64, 64, 64));
palette.setColor(QPalette::ButtonText, Qt::white);
palette.setColor(QPalette::BrightText, Qt::red);
palette.setColor(QPalette::Highlight, QColor(64, 128, 96));
palette.setColor(QPalette::HighlightedText, Qt::white);
app.setPalette(palette);
QMap<QString, QSize> customSizeHints = parseCustomSizeHints(argc, argv);
NLTOOLS::CMainWindow mainWin(customSizeHints);
mainWin.resize(800, 600);
mainWin.show(); // calls isVisible(true)
int result = app.exec();
#ifdef NL_OS_WINDOWS
if (coInitOk) CoUninitialize();
#endif
return result;
}
/* end of file */

@ -0,0 +1,33 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2014 Jan BOON (jan.boon@kaetemi.be)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NLTOOLS_MAIN_H
#define NLTOOLS_MAIN_H
#include <nel/misc/types_nl.h>
// STL includes
// NeL includes
// Project includes
namespace NLTOOLS {
} /* namespace NLTOOLS */
#endif /* #ifndef NLTOOLS_MAIN_H */
/* end of file */

@ -1,5 +1,8 @@
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${QT_INCLUDES})
IF(WITH_QT)
INCLUDE(${QT_USE_FILE})
ENDIF(WITH_QT)
FILE(GLOB SRC *.cpp *.h)
@ -16,19 +19,28 @@ SET(QT_PROPERTY_EDITOR_RCS qtpropertybrowser.qrc)
SET(QT_USE_QTGUI TRUE)
IF(WITH_QT5)
SET(CMAKE_AUTOMOC OFF)
QT5_ADD_RESOURCES(QT_PROPERTY_EDITOR_RC_SRCS ${QT_PROPERTY_EDITOR_RCS})
QT5_WRAP_CPP(QT_PROPERTY_EDITOR_MOC_SRC ${QT_PROPERTY_EDITOR_HDR})
ELSE(WITH_QT5)
QT4_ADD_RESOURCES(QT_PROPERTY_EDITOR_RC_SRCS ${QT_PROPERTY_EDITOR_RCS})
QT4_WRAP_CPP(QT_PROPERTY_EDITOR_MOC_SRC ${QT_PROPERTY_EDITOR_HDR})
ENDIF(WITH_QT5)
SOURCE_GROUP(QtResources FILES ${QT_PROPERTY_EDITOR_RCS})
SOURCE_GROUP(QtGeneratedMocSrc FILES ${QT_PROPERTY_EDITOR_MOC_SRC})
SOURCE_GROUP("Qt Property Editor Source" FILES ${SRC})
IF(WITH_QT5)
ELSE(WITH_QT5)
qt4_generate_moc(qtpropertymanager.cpp ${CMAKE_CURRENT_BINARY_DIR}/qtpropertymanager.moc)
qt4_generate_moc(qteditorfactory.cpp ${CMAKE_CURRENT_BINARY_DIR}/qteditorfactory.moc)
qt4_generate_moc(qttreepropertybrowser.cpp ${CMAKE_CURRENT_BINARY_DIR}/qttreepropertybrowser.moc)
# Need to remove these so that they are not linked as they are inline included.
LIST(REMOVE_ITEM QT_PROPERTY_EDITOR_MOC_SRC ${CMAKE_CURRENT_BINARY_DIR}/moc_qtbuttonpropertybrowser.cxx
LIST(REMOVE_ITEM QT_PROPERTY_EDITOR_MOC_SRC
${CMAKE_CURRENT_BINARY_DIR}/moc_qtbuttonpropertybrowser.cxx
${CMAKE_CURRENT_BINARY_DIR}/moc_qteditorfactory.cxx
${CMAKE_CURRENT_BINARY_DIR}/moc_qtgroupboxpropertybrowser.cxx
${CMAKE_CURRENT_BINARY_DIR}/moc_qtpropertybrowser.cxx
@ -44,6 +56,7 @@ SET_PROPERTY(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/qtpropertybrowser.cpp APPEND PRO
SET_PROPERTY(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/qtpropertymanager.cpp APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/moc_qtpropertymanager.cxx)
SET_PROPERTY(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/qttreepropertybrowser.cpp APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/moc_qttreepropertybrowser.cxx)
SET_PROPERTY(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/qtvariantproperty.cpp APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/moc_qtvariantproperty.cxx)
ENDIF(WITH_QT5)
#set(
# qtpropertyeditor_HEADERS_ONLY_MOC
@ -77,14 +90,32 @@ SET_PROPERTY(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/qtvariantproperty.cpp APPEND PRO
# ${qtpropertyeditor_HEADERS_ONLY_MOC}
#)
ADD_LIBRARY(qt_property_browser SHARED ${SRC}
INCLUDE_DIRECTORIES(${QT_INCLUDES})
IF(WITH_QT5)
ADD_LIBRARY(qt_property_browser SHARED
${SRC}
${QT_PROPERTY_EDITOR_MOC_SRC}
${QT_PROPERTY_EDITOR_RC_SRCS}
${QT_PROPERTY_EDITOR_RC_SRCS})
ELSE(WITH_QT5)
ADD_LIBRARY(qt_property_browser SHARED
${SRC}
${QT_PROPERTY_EDITOR_MOC_SRC}
${QT_PROPERTY_EDITOR_RC_SRCS})
ENDIF(WITH_QT5)
IF(WITH_QT)
ADD_LIBRARY(qt_property_browser SHARED
${CMAKE_CURRENT_BINARY_DIR}/qtpropertymanager.moc
${CMAKE_CURRENT_BINARY_DIR}/qttreepropertybrowser.moc
${CMAKE_CURRENT_BINARY_DIR}/qteditorfactory.moc)
ENDIF(WITH_QT)
IF(WITH_QT5)
TARGET_LINK_LIBRARIES(qt_property_browser Qt5::Widgets)
ELSE(WITH_QT5)
TARGET_LINK_LIBRARIES(qt_property_browser ${QT_LIBRARIES})
ENDIF(WITH_QT5)
ADD_DEFINITIONS(${QT_DEFINITIONS})
ADD_DEFINITIONS(-DQT_DLL)

@ -86,69 +86,18 @@
****************************************************************************/
#include "qtbuttonpropertybrowser.h"
#include <QtCore/QSet>
#include <QtGui/QGridLayout>
#include <QtGui/QLabel>
#include <QtCore/QTimer>
#include <QtCore/QMap>
#include <QtGui/QToolButton>
#include <QtGui/QStyle>
#include <QSet>
#include <QGridLayout>
#include <QLabel>
#include <QTimer>
#include <QMap>
#include <QToolButton>
#include <QStyle>
#if QT_VERSION >= 0x040400
QT_BEGIN_NAMESPACE
#endif
class QtButtonPropertyBrowserPrivate
{
QtButtonPropertyBrowser *q_ptr;
Q_DECLARE_PUBLIC(QtButtonPropertyBrowser)
public:
void init(QWidget *parent);
void propertyInserted(QtBrowserItem *index, QtBrowserItem *afterIndex);
void propertyRemoved(QtBrowserItem *index);
void propertyChanged(QtBrowserItem *index);
QWidget *createEditor(QtProperty *property, QWidget *parent) const
{ return q_ptr->createEditor(property, parent); }
void slotEditorDestroyed();
void slotUpdate();
void slotToggled(bool checked);
struct WidgetItem
{
WidgetItem() : widget(0), label(0), widgetLabel(0),
button(0), container(0), layout(0), /*line(0), */parent(0), expanded(false) { }
QWidget *widget; // can be null
QLabel *label; // main label with property name
QLabel *widgetLabel; // label substitute showing the current value if there is no widget
QToolButton *button; // expandable button for items with children
QWidget *container; // container which is expanded when the button is clicked
QGridLayout *layout; // layout in container
WidgetItem *parent;
QList<WidgetItem *> children;
bool expanded;
};
private:
void updateLater();
void updateItem(WidgetItem *item);
void insertRow(QGridLayout *layout, int row) const;
void removeRow(QGridLayout *layout, int row) const;
int gridRow(WidgetItem *item) const;
int gridSpan(WidgetItem *item) const;
void setExpanded(WidgetItem *item, bool expanded);
QToolButton *createButton(QWidget *panret = 0) const;
QMap<QtBrowserItem *, WidgetItem *> m_indexToItem;
QMap<WidgetItem *, QtBrowserItem *> m_itemToIndex;
QMap<QWidget *, WidgetItem *> m_widgetToItem;
QMap<QObject *, WidgetItem *> m_buttonToItem;
QGridLayout *m_mainLayout;
QList<WidgetItem *> m_children;
QList<WidgetItem *> m_recreateQueue;
};
QToolButton *QtButtonPropertyBrowserPrivate::createButton(QWidget *parent) const
{
QToolButton *button = new QToolButton(parent);
@ -673,4 +622,4 @@ bool QtButtonPropertyBrowser::isExpanded(QtBrowserItem *item) const
QT_END_NAMESPACE
#endif
#include "moc_qtbuttonpropertybrowser.cxx"
//#include "moc_qtbuttonpropertybrowser.cxx"

@ -128,6 +128,57 @@ private:
};
class QtButtonPropertyBrowserPrivate
{
QtButtonPropertyBrowser *q_ptr;
Q_DECLARE_PUBLIC(QtButtonPropertyBrowser)
public:
void init(QWidget *parent);
void propertyInserted(QtBrowserItem *index, QtBrowserItem *afterIndex);
void propertyRemoved(QtBrowserItem *index);
void propertyChanged(QtBrowserItem *index);
QWidget *createEditor(QtProperty *property, QWidget *parent) const
{ return q_ptr->createEditor(property, parent); }
void slotEditorDestroyed();
void slotUpdate();
void slotToggled(bool checked);
struct WidgetItem
{
WidgetItem() : widget(0), label(0), widgetLabel(0),
button(0), container(0), layout(0), /*line(0), */parent(0), expanded(false) { }
QWidget *widget; // can be null
QLabel *label; // main label with property name
QLabel *widgetLabel; // label substitute showing the current value if there is no widget
QToolButton *button; // expandable button for items with children
QWidget *container; // container which is expanded when the button is clicked
QGridLayout *layout; // layout in container
WidgetItem *parent;
QList<WidgetItem *> children;
bool expanded;
};
private:
void updateLater();
void updateItem(WidgetItem *item);
void insertRow(QGridLayout *layout, int row) const;
void removeRow(QGridLayout *layout, int row) const;
int gridRow(WidgetItem *item) const;
int gridSpan(WidgetItem *item) const;
void setExpanded(WidgetItem *item, bool expanded);
QToolButton *createButton(QWidget *panret = 0) const;
QMap<QtBrowserItem *, WidgetItem *> m_indexToItem;
QMap<WidgetItem *, QtBrowserItem *> m_itemToIndex;
QMap<QWidget *, WidgetItem *> m_widgetToItem;
QMap<QObject *, WidgetItem *> m_buttonToItem;
QGridLayout *m_mainLayout;
QList<WidgetItem *> m_children;
QList<WidgetItem *> m_recreateQueue;
};
#if QT_VERSION >= 0x040400
QT_END_NAMESPACE
#endif

@ -87,29 +87,29 @@
#include "qteditorfactory.h"
#include "qtpropertybrowserutils_p.h"
#include <QtGui/QSpinBox>
#include <QtGui/QScrollBar>
#include <QtGui/QComboBox>
#include <QtGui/QAbstractItemView>
#include <QtGui/QLineEdit>
#include <QtGui/QDateTimeEdit>
#include <QtGui/QHBoxLayout>
#include <QtGui/QMenu>
#include <QtGui/QKeyEvent>
#include <QtGui/QApplication>
#include <QtGui/QLabel>
#include <QtGui/QToolButton>
#include <QtGui/QColorDialog>
#include <QtGui/QFontDialog>
#include <QtGui/QDialog>
#include <QtGui/QPlainTextEdit>
#include <QtGui/QTextEdit>
#include <QSpinBox>
#include <QScrollBar>
#include <QComboBox>
#include <QAbstractItemView>
#include <QLineEdit>
#include <QDateTimeEdit>
#include <QHBoxLayout>
#include <QMenu>
#include <QKeyEvent>
#include <QApplication>
#include <QLabel>
#include <QToolButton>
#include <QColorDialog>
#include <QFontDialog>
#include <QDialog>
#include <QPlainTextEdit>
#include <QTextEdit>
#include <QCompleter>
#include <QColumnView>
#include <QStandardItemModel>
#include <QtGui/QDialogButtonBox>
#include <QtGui/QSpacerItem>
#include <QtCore/QMap>
#include <QDialogButtonBox>
#include <QSpacerItem>
#include <QMap>
#if defined(Q_CC_MSVC)
# pragma warning(disable: 4786) /* MS VS 6: truncating debug info after 255 characters */
@ -134,75 +134,8 @@ static inline void setupTreeViewEditorMargin(QLayout *lt)
// ---------- EditorFactoryPrivate :
// Base class for editor factory private classes. Manages mapping of properties to editors and vice versa.
template <class Editor>
class EditorFactoryPrivate
{
public:
typedef QList<Editor *> EditorList;
typedef QMap<QtProperty *, EditorList> PropertyToEditorListMap;
typedef QMap<Editor *, QtProperty *> EditorToPropertyMap;
Editor *createEditor(QtProperty *property, QWidget *parent);
void initializeEditor(QtProperty *property, Editor *e);
void slotEditorDestroyed(QObject *object);
PropertyToEditorListMap m_createdEditors;
EditorToPropertyMap m_editorToProperty;
};
template <class Editor>
Editor *EditorFactoryPrivate<Editor>::createEditor(QtProperty *property, QWidget *parent)
{
Editor *editor = new Editor(parent);
initializeEditor(property, editor);
return editor;
}
template <class Editor>
void EditorFactoryPrivate<Editor>::initializeEditor(QtProperty *property, Editor *editor)
{
Q_TYPENAME PropertyToEditorListMap::iterator it = m_createdEditors.find(property);
if (it == m_createdEditors.end())
it = m_createdEditors.insert(property, EditorList());
it.value().append(editor);
m_editorToProperty.insert(editor, property);
}
template <class Editor>
void EditorFactoryPrivate<Editor>::slotEditorDestroyed(QObject *object)
{
const Q_TYPENAME EditorToPropertyMap::iterator ecend = m_editorToProperty.end();
for (Q_TYPENAME EditorToPropertyMap::iterator itEditor = m_editorToProperty.begin(); itEditor != ecend; ++itEditor) {
if (itEditor.key() == object) {
Editor *editor = itEditor.key();
QtProperty *property = itEditor.value();
const Q_TYPENAME PropertyToEditorListMap::iterator pit = m_createdEditors.find(property);
if (pit != m_createdEditors.end()) {
pit.value().removeAll(editor);
if (pit.value().empty())
m_createdEditors.erase(pit);
}
m_editorToProperty.erase(itEditor);
return;
}
}
}
// ------------ QtSpinBoxFactory
class QtSpinBoxFactoryPrivate : public EditorFactoryPrivate<QSpinBox>
{
QtSpinBoxFactory *q_ptr;
Q_DECLARE_PUBLIC(QtSpinBoxFactory)
public:
void slotPropertyChanged(QtProperty *property, int value);
void slotRangeChanged(QtProperty *property, int min, int max);
void slotSingleStepChanged(QtProperty *property, int step);
void slotSetValue(int value);
};
void QtSpinBoxFactoryPrivate::slotPropertyChanged(QtProperty *property, int value)
{
if (!m_createdEditors.contains(property))
@ -347,17 +280,6 @@ void QtSpinBoxFactory::disconnectPropertyManager(QtIntPropertyManager *manager)
// QtSliderFactory
class QtSliderFactoryPrivate : public EditorFactoryPrivate<QSlider>
{
QtSliderFactory *q_ptr;
Q_DECLARE_PUBLIC(QtSliderFactory)
public:
void slotPropertyChanged(QtProperty *property, int value);
void slotRangeChanged(QtProperty *property, int min, int max);
void slotSingleStepChanged(QtProperty *property, int step);
void slotSetValue(int value);
};
void QtSliderFactoryPrivate::slotPropertyChanged(QtProperty *property, int value)
{
if (!m_createdEditors.contains(property))
@ -500,17 +422,6 @@ void QtSliderFactory::disconnectPropertyManager(QtIntPropertyManager *manager)
// QtSliderFactory
class QtScrollBarFactoryPrivate : public EditorFactoryPrivate<QScrollBar>
{
QtScrollBarFactory *q_ptr;
Q_DECLARE_PUBLIC(QtScrollBarFactory)
public:
void slotPropertyChanged(QtProperty *property, int value);
void slotRangeChanged(QtProperty *property, int min, int max);
void slotSingleStepChanged(QtProperty *property, int step);
void slotSetValue(int value);
};
void QtScrollBarFactoryPrivate::slotPropertyChanged(QtProperty *property, int value)
{
if (!m_createdEditors.contains(property))
@ -652,16 +563,6 @@ void QtScrollBarFactory::disconnectPropertyManager(QtIntPropertyManager *manager
// QtCheckBoxFactory
class QtCheckBoxFactoryPrivate : public EditorFactoryPrivate<QtBoolEdit>
{
QtCheckBoxFactory *q_ptr;
Q_DECLARE_PUBLIC(QtCheckBoxFactory)
public:
void slotPropertyChanged(QtProperty *property, bool value);
void slotSetValue(bool value);
void slotResetProperty();
};
void QtCheckBoxFactoryPrivate::slotPropertyChanged(QtProperty *property, bool value)
{
if (!m_createdEditors.contains(property))
@ -781,19 +682,6 @@ void QtCheckBoxFactory::disconnectPropertyManager(QtBoolPropertyManager *manager
// QtDoubleSpinBoxFactory
class QtDoubleSpinBoxFactoryPrivate : public EditorFactoryPrivate<QDoubleSpinBox>
{
QtDoubleSpinBoxFactory *q_ptr;
Q_DECLARE_PUBLIC(QtDoubleSpinBoxFactory)
public:
void slotPropertyChanged(QtProperty *property, double value);
void slotRangeChanged(QtProperty *property, double min, double max);
void slotSingleStepChanged(QtProperty *property, double step);
void slotDecimalsChanged(QtProperty *property, int prec);
void slotSetValue(double value);
};
void QtDoubleSpinBoxFactoryPrivate::slotPropertyChanged(QtProperty *property, double value)
{
QList<QDoubleSpinBox *> editors = m_createdEditors[property];
@ -969,18 +857,6 @@ void QtDoubleSpinBoxFactory::disconnectPropertyManager(QtDoublePropertyManager *
// QtLineEditFactory
class QtLineEditFactoryPrivate : public EditorFactoryPrivate<QLineEdit>
{
QtLineEditFactory *q_ptr;
Q_DECLARE_PUBLIC(QtLineEditFactory)
public:
void slotPropertyChanged(QtProperty *property, const QString &value);
void slotRegExpChanged(QtProperty *property, const QRegExp &regExp);
void slotSetValue(const QString &value);
void slotEditingFinished();
};
void QtLineEditFactoryPrivate::slotPropertyChanged(QtProperty *property,
const QString &value)
{
@ -1133,17 +1009,6 @@ void QtLineEditFactory::disconnectPropertyManager(QtStringPropertyManager *manag
// QtDateEditFactory
class QtDateEditFactoryPrivate : public EditorFactoryPrivate<QDateEdit>
{
QtDateEditFactory *q_ptr;
Q_DECLARE_PUBLIC(QtDateEditFactory)
public:
void slotPropertyChanged(QtProperty *property, const QDate &value);
void slotRangeChanged(QtProperty *property, const QDate &min, const QDate &max);
void slotSetValue(const QDate &value);
};
void QtDateEditFactoryPrivate::slotPropertyChanged(QtProperty *property, const QDate &value)
{
if (!m_createdEditors.contains(property))
@ -1269,16 +1134,6 @@ void QtDateEditFactory::disconnectPropertyManager(QtDatePropertyManager *manager
// QtTimeEditFactory
class QtTimeEditFactoryPrivate : public EditorFactoryPrivate<QTimeEdit>
{
QtTimeEditFactory *q_ptr;
Q_DECLARE_PUBLIC(QtTimeEditFactory)
public:
void slotPropertyChanged(QtProperty *property, const QTime &value);
void slotSetValue(const QTime &value);
};
void QtTimeEditFactoryPrivate::slotPropertyChanged(QtProperty *property, const QTime &value)
{
if (!m_createdEditors.contains(property))
@ -1378,17 +1233,6 @@ void QtTimeEditFactory::disconnectPropertyManager(QtTimePropertyManager *manager
// QtDateTimeEditFactory
class QtDateTimeEditFactoryPrivate : public EditorFactoryPrivate<QDateTimeEdit>
{
QtDateTimeEditFactory *q_ptr;
Q_DECLARE_PUBLIC(QtDateTimeEditFactory)
public:
void slotPropertyChanged(QtProperty *property, const QDateTime &value);
void slotSetValue(const QDateTime &value);
};
void QtDateTimeEditFactoryPrivate::slotPropertyChanged(QtProperty *property,
const QDateTime &value)
{
@ -1490,16 +1334,6 @@ void QtDateTimeEditFactory::disconnectPropertyManager(QtDateTimePropertyManager
// QtKeySequenceEditorFactory
class QtKeySequenceEditorFactoryPrivate : public EditorFactoryPrivate<QtKeySequenceEdit>
{
QtKeySequenceEditorFactory *q_ptr;
Q_DECLARE_PUBLIC(QtKeySequenceEditorFactory)
public:
void slotPropertyChanged(QtProperty *property, const QKeySequence &value);
void slotSetValue(const QKeySequence &value);
};
void QtKeySequenceEditorFactoryPrivate::slotPropertyChanged(QtProperty *property,
const QKeySequence &value)
{
@ -1601,32 +1435,7 @@ void QtKeySequenceEditorFactory::disconnectPropertyManager(QtKeySequenceProperty
// QtCharEdit
class QtCharEdit : public QWidget
{
Q_OBJECT
public:
QtCharEdit(QWidget *parent = 0);
QChar value() const;
bool eventFilter(QObject *o, QEvent *e);
public Q_SLOTS:
void setValue(const QChar &value);
Q_SIGNALS:
void valueChanged(const QChar &value);
protected:
void focusInEvent(QFocusEvent *e);
void focusOutEvent(QFocusEvent *e);
void keyPressEvent(QKeyEvent *e);
void keyReleaseEvent(QKeyEvent *e);
bool event(QEvent *e);
private slots:
void slotClearChar();
private:
void handleKeyEvent(QKeyEvent *e);
QChar m_value;
QLineEdit *m_lineEdit;
};
QtCharEdit::QtCharEdit(QWidget *parent)
: QWidget(parent), m_lineEdit(new QLineEdit(this))
@ -1770,17 +1579,6 @@ bool QtCharEdit::event(QEvent *e)
// QtCharEditorFactory
class QtCharEditorFactoryPrivate : public EditorFactoryPrivate<QtCharEdit>
{
QtCharEditorFactory *q_ptr;
Q_DECLARE_PUBLIC(QtCharEditorFactory)
public:
void slotPropertyChanged(QtProperty *property, const QChar &value);
void slotSetValue(const QChar &value);
};
void QtCharEditorFactoryPrivate::slotPropertyChanged(QtProperty *property,
const QChar &value)
{
@ -1881,29 +1679,6 @@ void QtCharEditorFactory::disconnectPropertyManager(QtCharPropertyManager *manag
}
class QtEnumEditWidget : public QWidget {
Q_OBJECT
public:
QtEnumEditWidget(QWidget *parent);
bool blockComboBoxSignals(bool block);
void addItems(const QStringList &texts);
void clearComboBox();
void setItemIcon(int index, const QIcon &icon);
public Q_SLOTS:
void setValue(int value);
void setStateResetButton(bool enabled);
Q_SIGNALS:
void valueChanged(int value);
void resetProperty();
private:
QComboBox *m_comboBox;
QToolButton *m_defaultButton;
};
QtEnumEditWidget::QtEnumEditWidget(QWidget *parent) :
QWidget(parent),
@ -1960,19 +1735,6 @@ void QtEnumEditWidget::setItemIcon(int index, const QIcon &icon)
// QtEnumEditorFactory
class QtEnumEditorFactoryPrivate : public EditorFactoryPrivate<QtEnumEditWidget>
{
QtEnumEditorFactory *q_ptr;
Q_DECLARE_PUBLIC(QtEnumEditorFactory)
public:
void slotPropertyChanged(QtProperty *property, int value);
void slotEnumNamesChanged(QtProperty *property, const QStringList &);
void slotEnumIconsChanged(QtProperty *property, const QMap<int, QIcon> &);
void slotSetValue(int value);
void slotResetProperty();
};
void QtEnumEditorFactoryPrivate::slotResetProperty()
{
QObject *object = q_ptr->sender();
@ -2152,27 +1914,6 @@ void QtEnumEditorFactory::disconnectPropertyManager(QtEnumPropertyManager *manag
Q_GLOBAL_STATIC(QtCursorDatabase, cursorDatabase)
class QtCursorEditorFactoryPrivate
{
QtCursorEditorFactory *q_ptr;
Q_DECLARE_PUBLIC(QtCursorEditorFactory)
public:
QtCursorEditorFactoryPrivate();
void slotPropertyChanged(QtProperty *property, const QCursor &cursor);
void slotEnumChanged(QtProperty *property, int value);
void slotEditorDestroyed(QObject *object);
QtEnumEditorFactory *m_enumEditorFactory;
QtEnumPropertyManager *m_enumPropertyManager;
QMap<QtProperty *, QtProperty *> m_propertyToEnum;
QMap<QtProperty *, QtProperty *> m_enumToProperty;
QMap<QtProperty *, QList<QWidget *> > m_enumToEditors;
QMap<QWidget *, QtProperty *> m_editorToEnum;
bool m_updatingEnum;
};
QtCursorEditorFactoryPrivate::QtCursorEditorFactoryPrivate()
: m_updatingEnum(false)
{
@ -2317,30 +2058,6 @@ void QtCursorEditorFactory::disconnectPropertyManager(QtCursorPropertyManager *m
// QtColorEditWidget
class QtColorEditWidget : public QWidget {
Q_OBJECT
public:
QtColorEditWidget(QWidget *parent);
bool eventFilter(QObject *obj, QEvent *ev);
public Q_SLOTS:
void setValue(const QColor &value);
private Q_SLOTS:
void buttonClicked();
Q_SIGNALS:
void valueChanged(const QColor &value);
private:
QColor m_color;
QLabel *m_pixmapLabel;
QLabel *m_label;
QToolButton *m_button;
};
QtColorEditWidget::QtColorEditWidget(QWidget *parent) :
QWidget(parent),
m_pixmapLabel(new QLabel),
@ -2412,16 +2129,6 @@ bool QtColorEditWidget::eventFilter(QObject *obj, QEvent *ev)
// QtColorEditorFactoryPrivate
class QtColorEditorFactoryPrivate : public EditorFactoryPrivate<QtColorEditWidget>
{
QtColorEditorFactory *q_ptr;
Q_DECLARE_PUBLIC(QtColorEditorFactory)
public:
void slotPropertyChanged(QtProperty *property, const QColor &value);
void slotSetValue(const QColor &value);
};
void QtColorEditorFactoryPrivate::slotPropertyChanged(QtProperty *property,
const QColor &value)
{
@ -2515,30 +2222,6 @@ void QtColorEditorFactory::disconnectPropertyManager(QtColorPropertyManager *man
// QtFontEditWidget
class QtFontEditWidget : public QWidget {
Q_OBJECT
public:
QtFontEditWidget(QWidget *parent);
bool eventFilter(QObject *obj, QEvent *ev);
public Q_SLOTS:
void setValue(const QFont &value);
private Q_SLOTS:
void buttonClicked();
Q_SIGNALS:
void valueChanged(const QFont &value);
private:
QFont m_font;
QLabel *m_pixmapLabel;
QLabel *m_label;
QToolButton *m_button;
};
QtFontEditWidget::QtFontEditWidget(QWidget *parent) :
QWidget(parent),
m_pixmapLabel(new QLabel),
@ -2623,16 +2306,6 @@ bool QtFontEditWidget::eventFilter(QObject *obj, QEvent *ev)
// QtFontEditorFactoryPrivate
class QtFontEditorFactoryPrivate : public EditorFactoryPrivate<QtFontEditWidget>
{
QtFontEditorFactory *q_ptr;
Q_DECLARE_PUBLIC(QtFontEditorFactory)
public:
void slotPropertyChanged(QtProperty *property, const QFont &value);
void slotSetValue(const QFont &value);
};
void QtFontEditorFactoryPrivate::slotPropertyChanged(QtProperty *property,
const QFont &value)
{
@ -2724,31 +2397,6 @@ void QtFontEditorFactory::disconnectPropertyManager(QtFontPropertyManager *manag
disconnect(manager, SIGNAL(valueChanged(QtProperty*,QFont)), this, SLOT(slotPropertyChanged(QtProperty*,QFont)));
}
class QtTextEditWidget : public QWidget {
Q_OBJECT
public:
QtTextEditWidget(QWidget *parent);
bool eventFilter(QObject *obj, QEvent *ev);
public Q_SLOTS:
void setValue(const QString &value);
void setStateResetButton(bool enabled);
private Q_SLOTS:
void buttonClicked();
Q_SIGNALS:
void valueChanged(const QString &value);
void resetProperty();
private:
QLineEdit *m_lineEdit;
QToolButton *m_defaultButton;
QToolButton *m_button;
};
QtTextEditWidget::QtTextEditWidget(QWidget *parent) :
QWidget(parent),
m_lineEdit(new QLineEdit),
@ -2857,17 +2505,6 @@ bool QtTextEditWidget::eventFilter(QObject *obj, QEvent *ev)
// QtLineEditFactory
class QtTextEditorFactoryPrivate : public EditorFactoryPrivate<QtTextEditWidget>
{
QtTextEditorFactory *q_ptr;
Q_DECLARE_PUBLIC(QtTextEditorFactory)
public:
void slotPropertyChanged(QtProperty *property, const QString &value);
void slotSetValue(const QString &value);
void slotResetProperty();
};
void QtTextEditorFactoryPrivate::slotPropertyChanged(QtProperty *property,
const QString &value)
{
@ -2989,5 +2626,5 @@ void QtTextEditorFactory::disconnectPropertyManager(QtTextPropertyManager *manag
QT_END_NAMESPACE
#endif
#include "moc_qteditorfactory.cxx"
//#include "moc_qteditorfactory.cxx"
#include "qteditorfactory.moc"

@ -89,6 +89,7 @@
#define QTEDITORFACTORY_H
#include "qtpropertymanager.h"
#include "qtpropertybrowserutils_p.h"
#if QT_VERSION >= 0x040400
QT_BEGIN_NAMESPACE
@ -466,6 +467,374 @@ private:
Q_PRIVATE_SLOT(d_func(), void slotResetProperty())
};
template <class Editor>
class EditorFactoryPrivate
{
public:
typedef QList<Editor *> EditorList;
typedef QMap<QtProperty *, EditorList> PropertyToEditorListMap;
typedef QMap<Editor *, QtProperty *> EditorToPropertyMap;
Editor *createEditor(QtProperty *property, QWidget *parent);
void initializeEditor(QtProperty *property, Editor *e);
void slotEditorDestroyed(QObject *object);
PropertyToEditorListMap m_createdEditors;
EditorToPropertyMap m_editorToProperty;
};
template <class Editor>
Editor *EditorFactoryPrivate<Editor>::createEditor(QtProperty *property, QWidget *parent)
{
Editor *editor = new Editor(parent);
initializeEditor(property, editor);
return editor;
}
template <class Editor>
void EditorFactoryPrivate<Editor>::initializeEditor(QtProperty *property, Editor *editor)
{
typename PropertyToEditorListMap::iterator it = m_createdEditors.find(property);
if (it == m_createdEditors.end())
it = m_createdEditors.insert(property, EditorList());
it.value().append(editor);
m_editorToProperty.insert(editor, property);
}
template <class Editor>
void EditorFactoryPrivate<Editor>::slotEditorDestroyed(QObject *object)
{
const typename EditorToPropertyMap::iterator ecend = m_editorToProperty.end();
for (typename EditorToPropertyMap::iterator itEditor = m_editorToProperty.begin(); itEditor != ecend; ++itEditor) {
if (itEditor.key() == object) {
Editor *editor = itEditor.key();
QtProperty *property = itEditor.value();
const typename PropertyToEditorListMap::iterator pit = m_createdEditors.find(property);
if (pit != m_createdEditors.end()) {
pit.value().removeAll(editor);
if (pit.value().empty())
m_createdEditors.erase(pit);
}
m_editorToProperty.erase(itEditor);
return;
}
}
}
class QtSpinBoxFactoryPrivate : public EditorFactoryPrivate<QSpinBox>
{
QtSpinBoxFactory *q_ptr;
Q_DECLARE_PUBLIC(QtSpinBoxFactory)
public:
void slotPropertyChanged(QtProperty *property, int value);
void slotRangeChanged(QtProperty *property, int min, int max);
void slotSingleStepChanged(QtProperty *property, int step);
void slotSetValue(int value);
};
class QtSliderFactoryPrivate : public EditorFactoryPrivate<QSlider>
{
QtSliderFactory *q_ptr;
Q_DECLARE_PUBLIC(QtSliderFactory)
public:
void slotPropertyChanged(QtProperty *property, int value);
void slotRangeChanged(QtProperty *property, int min, int max);
void slotSingleStepChanged(QtProperty *property, int step);
void slotSetValue(int value);
};
class QtScrollBarFactoryPrivate : public EditorFactoryPrivate<QScrollBar>
{
QtScrollBarFactory *q_ptr;
Q_DECLARE_PUBLIC(QtScrollBarFactory)
public:
void slotPropertyChanged(QtProperty *property, int value);
void slotRangeChanged(QtProperty *property, int min, int max);
void slotSingleStepChanged(QtProperty *property, int step);
void slotSetValue(int value);
};
class QtCheckBoxFactoryPrivate : public EditorFactoryPrivate<QtBoolEdit>
{
QtCheckBoxFactory *q_ptr;
Q_DECLARE_PUBLIC(QtCheckBoxFactory)
public:
void slotPropertyChanged(QtProperty *property, bool value);
void slotSetValue(bool value);
void slotResetProperty();
};
class QtDoubleSpinBoxFactoryPrivate : public EditorFactoryPrivate<QDoubleSpinBox>
{
QtDoubleSpinBoxFactory *q_ptr;
Q_DECLARE_PUBLIC(QtDoubleSpinBoxFactory)
public:
void slotPropertyChanged(QtProperty *property, double value);
void slotRangeChanged(QtProperty *property, double min, double max);
void slotSingleStepChanged(QtProperty *property, double step);
void slotDecimalsChanged(QtProperty *property, int prec);
void slotSetValue(double value);
};
class QtLineEditFactoryPrivate : public EditorFactoryPrivate<QLineEdit>
{
QtLineEditFactory *q_ptr;
Q_DECLARE_PUBLIC(QtLineEditFactory)
public:
void slotPropertyChanged(QtProperty *property, const QString &value);
void slotRegExpChanged(QtProperty *property, const QRegExp &regExp);
void slotSetValue(const QString &value);
void slotEditingFinished();
};
class QtDateEditFactoryPrivate : public EditorFactoryPrivate<QDateEdit>
{
QtDateEditFactory *q_ptr;
Q_DECLARE_PUBLIC(QtDateEditFactory)
public:
void slotPropertyChanged(QtProperty *property, const QDate &value);
void slotRangeChanged(QtProperty *property, const QDate &min, const QDate &max);
void slotSetValue(const QDate &value);
};
class QtTimeEditFactoryPrivate : public EditorFactoryPrivate<QTimeEdit>
{
QtTimeEditFactory *q_ptr;
Q_DECLARE_PUBLIC(QtTimeEditFactory)
public:
void slotPropertyChanged(QtProperty *property, const QTime &value);
void slotSetValue(const QTime &value);
};
class QtDateTimeEditFactoryPrivate : public EditorFactoryPrivate<QDateTimeEdit>
{
QtDateTimeEditFactory *q_ptr;
Q_DECLARE_PUBLIC(QtDateTimeEditFactory)
public:
void slotPropertyChanged(QtProperty *property, const QDateTime &value);
void slotSetValue(const QDateTime &value);
};
class QtKeySequenceEditorFactoryPrivate : public EditorFactoryPrivate<QtKeySequenceEdit>
{
QtKeySequenceEditorFactory *q_ptr;
Q_DECLARE_PUBLIC(QtKeySequenceEditorFactory)
public:
void slotPropertyChanged(QtProperty *property, const QKeySequence &value);
void slotSetValue(const QKeySequence &value);
};
class QtCharEdit : public QWidget
{
Q_OBJECT
public:
QtCharEdit(QWidget *parent = 0);
QChar value() const;
bool eventFilter(QObject *o, QEvent *e);
public Q_SLOTS:
void setValue(const QChar &value);
Q_SIGNALS:
void valueChanged(const QChar &value);
protected:
void focusInEvent(QFocusEvent *e);
void focusOutEvent(QFocusEvent *e);
void keyPressEvent(QKeyEvent *e);
void keyReleaseEvent(QKeyEvent *e);
bool event(QEvent *e);
private slots:
void slotClearChar();
private:
void handleKeyEvent(QKeyEvent *e);
QChar m_value;
QLineEdit *m_lineEdit;
};
class QtCharEditorFactoryPrivate : public EditorFactoryPrivate<QtCharEdit>
{
QtCharEditorFactory *q_ptr;
Q_DECLARE_PUBLIC(QtCharEditorFactory)
public:
void slotPropertyChanged(QtProperty *property, const QChar &value);
void slotSetValue(const QChar &value);
};
class QtEnumEditWidget : public QWidget {
Q_OBJECT
public:
QtEnumEditWidget(QWidget *parent);
bool blockComboBoxSignals(bool block);
void addItems(const QStringList &texts);
void clearComboBox();
void setItemIcon(int index, const QIcon &icon);
public Q_SLOTS:
void setValue(int value);
void setStateResetButton(bool enabled);
Q_SIGNALS:
void valueChanged(int value);
void resetProperty();
private:
QComboBox *m_comboBox;
QToolButton *m_defaultButton;
};
class QtEnumEditorFactoryPrivate : public EditorFactoryPrivate<QtEnumEditWidget>
{
QtEnumEditorFactory *q_ptr;
Q_DECLARE_PUBLIC(QtEnumEditorFactory)
public:
void slotPropertyChanged(QtProperty *property, int value);
void slotEnumNamesChanged(QtProperty *property, const QStringList &);
void slotEnumIconsChanged(QtProperty *property, const QMap<int, QIcon> &);
void slotSetValue(int value);
void slotResetProperty();
};
class QtCursorEditorFactoryPrivate
{
QtCursorEditorFactory *q_ptr;
Q_DECLARE_PUBLIC(QtCursorEditorFactory)
public:
QtCursorEditorFactoryPrivate();
void slotPropertyChanged(QtProperty *property, const QCursor &cursor);
void slotEnumChanged(QtProperty *property, int value);
void slotEditorDestroyed(QObject *object);
QtEnumEditorFactory *m_enumEditorFactory;
QtEnumPropertyManager *m_enumPropertyManager;
QMap<QtProperty *, QtProperty *> m_propertyToEnum;
QMap<QtProperty *, QtProperty *> m_enumToProperty;
QMap<QtProperty *, QList<QWidget *> > m_enumToEditors;
QMap<QWidget *, QtProperty *> m_editorToEnum;
bool m_updatingEnum;
};
class QtColorEditWidget : public QWidget {
Q_OBJECT
public:
QtColorEditWidget(QWidget *parent);
bool eventFilter(QObject *obj, QEvent *ev);
public Q_SLOTS:
void setValue(const QColor &value);
private Q_SLOTS:
void buttonClicked();
Q_SIGNALS:
void valueChanged(const QColor &value);
private:
QColor m_color;
QLabel *m_pixmapLabel;
QLabel *m_label;
QToolButton *m_button;
};
class QtColorEditorFactoryPrivate : public EditorFactoryPrivate<QtColorEditWidget>
{
QtColorEditorFactory *q_ptr;
Q_DECLARE_PUBLIC(QtColorEditorFactory)
public:
void slotPropertyChanged(QtProperty *property, const QColor &value);
void slotSetValue(const QColor &value);
};
class QtFontEditWidget : public QWidget {
Q_OBJECT
public:
QtFontEditWidget(QWidget *parent);
bool eventFilter(QObject *obj, QEvent *ev);
public Q_SLOTS:
void setValue(const QFont &value);
private Q_SLOTS:
void buttonClicked();
Q_SIGNALS:
void valueChanged(const QFont &value);
private:
QFont m_font;
QLabel *m_pixmapLabel;
QLabel *m_label;
QToolButton *m_button;
};
class QtFontEditorFactoryPrivate : public EditorFactoryPrivate<QtFontEditWidget>
{
QtFontEditorFactory *q_ptr;
Q_DECLARE_PUBLIC(QtFontEditorFactory)
public:
void slotPropertyChanged(QtProperty *property, const QFont &value);
void slotSetValue(const QFont &value);
};
class QtTextEditWidget : public QWidget {
Q_OBJECT
public:
QtTextEditWidget(QWidget *parent);
bool eventFilter(QObject *obj, QEvent *ev);
public Q_SLOTS:
void setValue(const QString &value);
void setStateResetButton(bool enabled);
private Q_SLOTS:
void buttonClicked();
Q_SIGNALS:
void valueChanged(const QString &value);
void resetProperty();
private:
QLineEdit *m_lineEdit;
QToolButton *m_defaultButton;
QToolButton *m_button;
};
class QtTextEditorFactoryPrivate : public EditorFactoryPrivate<QtTextEditWidget>
{
QtTextEditorFactory *q_ptr;
Q_DECLARE_PUBLIC(QtTextEditorFactory)
public:
void slotPropertyChanged(QtProperty *property, const QString &value);
void slotSetValue(const QString &value);
void slotResetProperty();
};
#if QT_VERSION >= 0x040400
QT_END_NAMESPACE
#endif

@ -86,63 +86,17 @@
****************************************************************************/
#include "qtgroupboxpropertybrowser.h"
#include <QtCore/QSet>
#include <QtGui/QGridLayout>
#include <QtGui/QLabel>
#include <QtGui/QGroupBox>
#include <QtCore/QTimer>
#include <QtCore/QMap>
#include <QSet>
#include <QGridLayout>
#include <QLabel>
#include <QGroupBox>
#include <QTimer>
#include <QMap>
#if QT_VERSION >= 0x040400
QT_BEGIN_NAMESPACE
#endif
class QtGroupBoxPropertyBrowserPrivate
{
QtGroupBoxPropertyBrowser *q_ptr;
Q_DECLARE_PUBLIC(QtGroupBoxPropertyBrowser)
public:
void init(QWidget *parent);
void propertyInserted(QtBrowserItem *index, QtBrowserItem *afterIndex);
void propertyRemoved(QtBrowserItem *index);
void propertyChanged(QtBrowserItem *index);
QWidget *createEditor(QtProperty *property, QWidget *parent) const
{ return q_ptr->createEditor(property, parent); }
void slotEditorDestroyed();
void slotUpdate();
struct WidgetItem
{
WidgetItem() : widget(0), label(0), widgetLabel(0),
groupBox(0), layout(0), line(0), parent(0) { }
QWidget *widget; // can be null
QLabel *label;
QLabel *widgetLabel;
QGroupBox *groupBox;
QGridLayout *layout;
QFrame *line;
WidgetItem *parent;
QList<WidgetItem *> children;
};
private:
void updateLater();
void updateItem(WidgetItem *item);
void insertRow(QGridLayout *layout, int row) const;
void removeRow(QGridLayout *layout, int row) const;
bool hasHeader(WidgetItem *item) const;
QMap<QtBrowserItem *, WidgetItem *> m_indexToItem;
QMap<WidgetItem *, QtBrowserItem *> m_itemToIndex;
QMap<QWidget *, WidgetItem *> m_widgetToItem;
QGridLayout *m_mainLayout;
QList<WidgetItem *> m_children;
QList<WidgetItem *> m_recreateQueue;
};
void QtGroupBoxPropertyBrowserPrivate::init(QWidget *parent)
{
m_mainLayout = new QGridLayout();
@ -575,4 +529,4 @@ void QtGroupBoxPropertyBrowser::itemChanged(QtBrowserItem *item)
QT_END_NAMESPACE
#endif
#include "moc_qtgroupboxpropertybrowser.cxx"
//#include "moc_qtgroupboxpropertybrowser.cpp"

@ -119,6 +119,52 @@ private:
};
class QtGroupBoxPropertyBrowserPrivate
{
QtGroupBoxPropertyBrowser *q_ptr;
Q_DECLARE_PUBLIC(QtGroupBoxPropertyBrowser)
public:
void init(QWidget *parent);
void propertyInserted(QtBrowserItem *index, QtBrowserItem *afterIndex);
void propertyRemoved(QtBrowserItem *index);
void propertyChanged(QtBrowserItem *index);
QWidget *createEditor(QtProperty *property, QWidget *parent) const
{ return q_ptr->createEditor(property, parent); }
void slotEditorDestroyed();
void slotUpdate();
struct WidgetItem
{
WidgetItem() : widget(0), label(0), widgetLabel(0),
groupBox(0), layout(0), line(0), parent(0) { }
QWidget *widget; // can be null
QLabel *label;
QLabel *widgetLabel;
QGroupBox *groupBox;
QGridLayout *layout;
QFrame *line;
WidgetItem *parent;
QList<WidgetItem *> children;
};
private:
void updateLater();
void updateItem(WidgetItem *item);
void insertRow(QGridLayout *layout, int row) const;
void removeRow(QGridLayout *layout, int row) const;
bool hasHeader(WidgetItem *item) const;
QMap<QtBrowserItem *, WidgetItem *> m_indexToItem;
QMap<WidgetItem *, QtBrowserItem *> m_itemToIndex;
QMap<QWidget *, WidgetItem *> m_widgetToItem;
QGridLayout *m_mainLayout;
QList<WidgetItem *> m_children;
QList<WidgetItem *> m_recreateQueue;
};
#if QT_VERSION >= 0x040400
QT_END_NAMESPACE
#endif

@ -86,9 +86,9 @@
****************************************************************************/
#include "qtpropertybrowser.h"
#include <QtCore/QSet>
#include <QtCore/QMap>
#include <QtGui/QIcon>
#include <QSet>
#include <QMap>
#include <QIcon>
#if defined(Q_CC_MSVC)
# pragma warning(disable: 4786) /* MS VS 6: truncating debug info after 255 characters */
@ -1258,40 +1258,6 @@ typedef QMap<QtAbstractPropertyManager *, QMap<QtAbstractEditorFactoryBase *,
Q_GLOBAL_STATIC(Map1, m_viewToManagerToFactory)
Q_GLOBAL_STATIC(Map2, m_managerToFactoryToViews)
class QtAbstractPropertyBrowserPrivate
{
QtAbstractPropertyBrowser *q_ptr;
Q_DECLARE_PUBLIC(QtAbstractPropertyBrowser)
public:
QtAbstractPropertyBrowserPrivate();
void insertSubTree(QtProperty *property,
QtProperty *parentProperty);
void removeSubTree(QtProperty *property,
QtProperty *parentProperty);
void createBrowserIndexes(QtProperty *property, QtProperty *parentProperty, QtProperty *afterProperty);
void removeBrowserIndexes(QtProperty *property, QtProperty *parentProperty);
QtBrowserItem *createBrowserIndex(QtProperty *property, QtBrowserItem *parentIndex, QtBrowserItem *afterIndex);
void removeBrowserIndex(QtBrowserItem *index);
void clearIndex(QtBrowserItem *index);
void slotPropertyInserted(QtProperty *property,
QtProperty *parentProperty, QtProperty *afterProperty);
void slotPropertyRemoved(QtProperty *property, QtProperty *parentProperty);
void slotPropertyDestroyed(QtProperty *property);
void slotPropertyDataChanged(QtProperty *property);
QList<QtProperty *> m_subItems;
QMap<QtAbstractPropertyManager *, QList<QtProperty *> > m_managerToProperties;
QMap<QtProperty *, QList<QtProperty *> > m_propertyToParents;
QMap<QtProperty *, QtBrowserItem *> m_topLevelPropertyToIndex;
QList<QtBrowserItem *> m_topLevelIndexes;
QMap<QtProperty *, QList<QtBrowserItem *> > m_propertyToIndexes;
QtBrowserItem *m_currentItem;
};
QtAbstractPropertyBrowserPrivate::QtAbstractPropertyBrowserPrivate() :
m_currentItem(0)
{
@ -2055,4 +2021,4 @@ void QtAbstractPropertyBrowser::setCurrentItem(QtBrowserItem *item)
QT_END_NAMESPACE
#endif
#include "moc_qtpropertybrowser.cxx"
//#include "moc_qtpropertybrowser.cpp"

@ -88,8 +88,21 @@
#ifndef QTPROPERTYBROWSER_H
#define QTPROPERTYBROWSER_H
#include <QtGui/QWidget>
#include <QtCore/QSet>
#include <QWidget>
#include <QSet>
#include <QLabel>
#include <QGroupBox>
#include <QGridLayout>
#include <QFrame>
#include <QMap>
#include <QToolButton>
#include <QSpinBox>
#include <QSlider>
#include <QScrollBar>
#include <QDateEdit>
#include <QTimeEdit>
#include <QComboBox>
#include <QLineEdit>
#if QT_VERSION >= 0x040400
QT_BEGIN_NAMESPACE
@ -374,6 +387,40 @@ private:
};
class QtAbstractPropertyBrowserPrivate
{
QtAbstractPropertyBrowser *q_ptr;
Q_DECLARE_PUBLIC(QtAbstractPropertyBrowser)
public:
QtAbstractPropertyBrowserPrivate();
void insertSubTree(QtProperty *property,
QtProperty *parentProperty);
void removeSubTree(QtProperty *property,
QtProperty *parentProperty);
void createBrowserIndexes(QtProperty *property, QtProperty *parentProperty, QtProperty *afterProperty);
void removeBrowserIndexes(QtProperty *property, QtProperty *parentProperty);
QtBrowserItem *createBrowserIndex(QtProperty *property, QtBrowserItem *parentIndex, QtBrowserItem *afterIndex);
void removeBrowserIndex(QtBrowserItem *index);
void clearIndex(QtBrowserItem *index);
void slotPropertyInserted(QtProperty *property,
QtProperty *parentProperty, QtProperty *afterProperty);
void slotPropertyRemoved(QtProperty *property, QtProperty *parentProperty);
void slotPropertyDestroyed(QtProperty *property);
void slotPropertyDataChanged(QtProperty *property);
QList<QtProperty *> m_subItems;
QMap<QtAbstractPropertyManager *, QList<QtProperty *> > m_managerToProperties;
QMap<QtProperty *, QList<QtProperty *> > m_propertyToParents;
QMap<QtProperty *, QtBrowserItem *> m_topLevelPropertyToIndex;
QList<QtBrowserItem *> m_topLevelIndexes;
QMap<QtProperty *, QList<QtBrowserItem *> > m_propertyToIndexes;
QtBrowserItem *m_currentItem;
};
#if QT_VERSION >= 0x040400
QT_END_NAMESPACE
#endif

@ -86,14 +86,14 @@
****************************************************************************/
#include "qtpropertybrowserutils_p.h"
#include <QtGui/QApplication>
#include <QtGui/QPainter>
#include <QtGui/QHBoxLayout>
#include <QtGui/QMouseEvent>
#include <QtGui/QCheckBox>
#include <QtGui/QToolButton>
#include <QtGui/QLineEdit>
#include <QtGui/QMenu>
#include <QApplication>
#include <QPainter>
#include <QHBoxLayout>
#include <QMouseEvent>
#include <QCheckBox>
#include <QToolButton>
#include <QLineEdit>
#include <QMenu>
#if QT_VERSION >= 0x040400
QT_BEGIN_NAMESPACE
@ -102,43 +102,43 @@ QT_BEGIN_NAMESPACE
QtCursorDatabase::QtCursorDatabase()
{
appendCursor(Qt::ArrowCursor, QApplication::translate("QtCursorDatabase", "Arrow", 0,
QApplication::UnicodeUTF8), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-arrow.png")));
-1), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-arrow.png")));
appendCursor(Qt::UpArrowCursor, QApplication::translate("QtCursorDatabase", "Up Arrow", 0,
QApplication::UnicodeUTF8), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-uparrow.png")));
-1), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-uparrow.png")));
appendCursor(Qt::CrossCursor, QApplication::translate("QtCursorDatabase", "Cross", 0,
QApplication::UnicodeUTF8), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-cross.png")));
-1), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-cross.png")));
appendCursor(Qt::WaitCursor, QApplication::translate("QtCursorDatabase", "Wait", 0,
QApplication::UnicodeUTF8), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-wait.png")));
-1), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-wait.png")));
appendCursor(Qt::IBeamCursor, QApplication::translate("QtCursorDatabase", "IBeam", 0,
QApplication::UnicodeUTF8), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-ibeam.png")));
-1), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-ibeam.png")));
appendCursor(Qt::SizeVerCursor, QApplication::translate("QtCursorDatabase", "Size Vertical", 0,
QApplication::UnicodeUTF8), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-sizev.png")));
-1), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-sizev.png")));
appendCursor(Qt::SizeHorCursor, QApplication::translate("QtCursorDatabase", "Size Horizontal", 0,
QApplication::UnicodeUTF8), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-sizeh.png")));
-1), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-sizeh.png")));
appendCursor(Qt::SizeFDiagCursor, QApplication::translate("QtCursorDatabase", "Size Backslash", 0,
QApplication::UnicodeUTF8), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-sizef.png")));
-1), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-sizef.png")));
appendCursor(Qt::SizeBDiagCursor, QApplication::translate("QtCursorDatabase", "Size Slash", 0,
QApplication::UnicodeUTF8), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-sizeb.png")));
-1), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-sizeb.png")));
appendCursor(Qt::SizeAllCursor, QApplication::translate("QtCursorDatabase", "Size All", 0,
QApplication::UnicodeUTF8), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-sizeall.png")));
-1), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-sizeall.png")));
appendCursor(Qt::BlankCursor, QApplication::translate("QtCursorDatabase", "Blank", 0,
QApplication::UnicodeUTF8), QIcon());
-1), QIcon());
appendCursor(Qt::SplitVCursor, QApplication::translate("QtCursorDatabase", "Split Vertical", 0,
QApplication::UnicodeUTF8), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-vsplit.png")));
-1), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-vsplit.png")));
appendCursor(Qt::SplitHCursor, QApplication::translate("QtCursorDatabase", "Split Horizontal", 0,
QApplication::UnicodeUTF8), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-hsplit.png")));
-1), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-hsplit.png")));
appendCursor(Qt::PointingHandCursor, QApplication::translate("QtCursorDatabase", "Pointing Hand", 0,
QApplication::UnicodeUTF8), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-hand.png")));
-1), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-hand.png")));
appendCursor(Qt::ForbiddenCursor, QApplication::translate("QtCursorDatabase", "Forbidden", 0,
QApplication::UnicodeUTF8), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-forbidden.png")));
-1), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-forbidden.png")));
appendCursor(Qt::OpenHandCursor, QApplication::translate("QtCursorDatabase", "Open Hand", 0,
QApplication::UnicodeUTF8), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-openhand.png")));
-1), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-openhand.png")));
appendCursor(Qt::ClosedHandCursor, QApplication::translate("QtCursorDatabase", "Closed Hand", 0,
QApplication::UnicodeUTF8), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-closedhand.png")));
-1), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-closedhand.png")));
appendCursor(Qt::WhatsThisCursor, QApplication::translate("QtCursorDatabase", "What's This", 0,
QApplication::UnicodeUTF8), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-whatsthis.png")));
-1), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-whatsthis.png")));
appendCursor(Qt::BusyCursor, QApplication::translate("QtCursorDatabase", "Busy", 0,
QApplication::UnicodeUTF8), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-busy.png")));
-1), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-busy.png")));
}
void QtCursorDatabase::appendCursor(Qt::CursorShape shape, const QString &name, const QIcon &icon)
@ -222,7 +222,7 @@ QIcon QtPropertyBrowserUtils::brushValueIcon(const QBrush &b)
QString QtPropertyBrowserUtils::colorValueText(const QColor &c)
{
return QApplication::translate("QtPropertyBrowserUtils", "[%1, %2, %3] (%4)", 0, QApplication::UnicodeUTF8)
return QApplication::translate("QtPropertyBrowserUtils", "[%1, %2, %3] (%4)", 0, -1)
.arg(QString::number(c.red()))
.arg(QString::number(c.green()))
.arg(QString::number(c.blue()))
@ -252,7 +252,7 @@ QIcon QtPropertyBrowserUtils::fontValueIcon(const QFont &f)
QString QtPropertyBrowserUtils::fontValueText(const QFont &f)
{
return QApplication::translate("QtPropertyBrowserUtils", "[%1, %2]", 0, QApplication::UnicodeUTF8)
return QApplication::translate("QtPropertyBrowserUtils", "[%1, %2]", 0, -1)
.arg(f.family())
.arg(f.pointSize());
}

@ -99,10 +99,10 @@
#ifndef QTPROPERTYBROWSERUTILS_H
#define QTPROPERTYBROWSERUTILS_H
#include <QtCore/QMap>
#include <QtGui/QIcon>
#include <QtGui/QWidget>
#include <QtCore/QStringList>
#include <QMap>
#include <QIcon>
#include <QWidget>
#include <QStringList>
#if QT_VERSION >= 0x040400
QT_BEGIN_NAMESPACE

@ -87,18 +87,18 @@
#include "qtpropertymanager.h"
#include "qtpropertybrowserutils_p.h"
#include <QtCore/QDateTime>
#include <QtCore/QLocale>
#include <QtCore/QMap>
#include <QtCore/QTimer>
#include <QtGui/QIcon>
#include <QtCore/QMetaEnum>
#include <QtGui/QFontDatabase>
#include <QtGui/QStyleOption>
#include <QtGui/QStyle>
#include <QtGui/QApplication>
#include <QtGui/QPainter>
#include <QtGui/QLabel>
#include <QDateTime>
#include <QLocale>
#include <QMap>
#include <QTimer>
#include <QIcon>
#include <QMetaEnum>
#include <QFontDatabase>
#include <QStyleOption>
#include <QStyle>
#include <QApplication>
#include <QPainter>
#include <QLabel>
#include <QStringRef>
#include <limits.h>
@ -134,36 +134,6 @@ static void setSimpleMaximumData(PrivateData *data, const Value &maxVal)
data->val = data->maxVal;
}
template <class PrivateData, class Value>
static void setSizeMinimumData(PrivateData *data, const Value &newMinVal)
{
data->minVal = newMinVal;
if (data->maxVal.width() < data->minVal.width())
data->maxVal.setWidth(data->minVal.width());
if (data->maxVal.height() < data->minVal.height())
data->maxVal.setHeight(data->minVal.height());
if (data->val.width() < data->minVal.width())
data->val.setWidth(data->minVal.width());
if (data->val.height() < data->minVal.height())
data->val.setHeight(data->minVal.height());
}
template <class PrivateData, class Value>
static void setSizeMaximumData(PrivateData *data, const Value &newMaxVal)
{
data->maxVal = newMaxVal;
if (data->minVal.width() > data->maxVal.width())
data->minVal.setWidth(data->maxVal.width());
if (data->minVal.height() > data->maxVal.height())
data->minVal.setHeight(data->maxVal.height());
if (data->val.width() > data->maxVal.width())
data->val.setWidth(data->maxVal.width());
if (data->val.height() > data->maxVal.height())
data->val.setHeight(data->maxVal.height());
}
template <class SizeValue>
static SizeValue qBoundSize(const SizeValue &minVal, const SizeValue &val, const SizeValue &maxVal)
{
@ -239,7 +209,7 @@ static Value getData(const QMap<const QtProperty *, PrivateData> &propertyMap,
const QtProperty *property, const Value &defaultValue = Value())
{
typedef QMap<const QtProperty *, PrivateData> PropertyToData;
typedef Q_TYPENAME PropertyToData::const_iterator PropertyToDataConstIterator;
typedef typename PropertyToData::const_iterator PropertyToDataConstIterator;
const PropertyToDataConstIterator it = propertyMap.constFind(property);
if (it == propertyMap.constEnd())
return defaultValue;
@ -275,7 +245,7 @@ static void setSimpleValue(QMap<const QtProperty *, Value> &propertyMap,
QtProperty *property, const Value &val)
{
typedef QMap<const QtProperty *, Value> PropertyToData;
typedef Q_TYPENAME PropertyToData::iterator PropertyToDataIterator;
typedef typename PropertyToData::iterator PropertyToDataIterator;
const PropertyToDataIterator it = propertyMap.find(property);
if (it == propertyMap.end())
return;
@ -296,9 +266,9 @@ static void setValueInRange(PropertyManager *manager, PropertyManagerPrivate *ma
QtProperty *property, const Value &val,
void (PropertyManagerPrivate::*setSubPropertyValue)(QtProperty *, ValueChangeParameter))
{
typedef Q_TYPENAME PropertyManagerPrivate::Data PrivateData;
typedef typename PropertyManagerPrivate::Data PrivateData;
typedef QMap<const QtProperty *, PrivateData> PropertyToData;
typedef Q_TYPENAME PropertyToData::iterator PropertyToDataIterator;
typedef typename PropertyToData::iterator PropertyToDataIterator;
const PropertyToDataIterator it = managerPrivate->m_values.find(property);
if (it == managerPrivate->m_values.end())
return;
@ -331,9 +301,9 @@ static void setBorderValues(PropertyManager *manager, PropertyManagerPrivate *ma
void (PropertyManagerPrivate::*setSubPropertyRange)(QtProperty *,
ValueChangeParameter, ValueChangeParameter, ValueChangeParameter))
{
typedef Q_TYPENAME PropertyManagerPrivate::Data PrivateData;
typedef typename PropertyManagerPrivate::Data PrivateData;
typedef QMap<const QtProperty *, PrivateData> PropertyToData;
typedef Q_TYPENAME PropertyToData::iterator PropertyToDataIterator;
typedef typename PropertyToData::iterator PropertyToDataIterator;
const PropertyToDataIterator it = managerPrivate->m_values.find(property);
if (it == managerPrivate->m_values.end())
return;
@ -376,7 +346,7 @@ static void setBorderValue(PropertyManager *manager, PropertyManagerPrivate *man
ValueChangeParameter, ValueChangeParameter, ValueChangeParameter))
{
typedef QMap<const QtProperty *, PrivateData> PropertyToData;
typedef Q_TYPENAME PropertyToData::iterator PropertyToDataIterator;
typedef typename PropertyToData::iterator PropertyToDataIterator;
const PropertyToDataIterator it = managerPrivate->m_values.find(property);
if (it == managerPrivate->m_values.end())
return;
@ -2287,29 +2257,6 @@ void QtCharPropertyManager::uninitializeProperty(QtProperty *property)
// QtLocalePropertyManager
class QtLocalePropertyManagerPrivate
{
QtLocalePropertyManager *q_ptr;
Q_DECLARE_PUBLIC(QtLocalePropertyManager)
public:
QtLocalePropertyManagerPrivate();
void slotEnumChanged(QtProperty *property, int value);
void slotPropertyDestroyed(QtProperty *property);
typedef QMap<const QtProperty *, QLocale> PropertyValueMap;
PropertyValueMap m_values;
QtEnumPropertyManager *m_enumPropertyManager;
QMap<const QtProperty *, QtProperty *> m_propertyToLanguage;
QMap<const QtProperty *, QtProperty *> m_propertyToCountry;
QMap<const QtProperty *, QtProperty *> m_languageToProperty;
QMap<const QtProperty *, QtProperty *> m_countryToProperty;
};
QtLocalePropertyManagerPrivate::QtLocalePropertyManagerPrivate()
{
}
@ -2536,27 +2483,6 @@ void QtLocalePropertyManager::uninitializeProperty(QtProperty *property)
// QtPointPropertyManager
class QtPointPropertyManagerPrivate
{
QtPointPropertyManager *q_ptr;
Q_DECLARE_PUBLIC(QtPointPropertyManager)
public:
void slotIntChanged(QtProperty *property, int value);
void slotPropertyDestroyed(QtProperty *property);
typedef QMap<const QtProperty *, QPoint> PropertyValueMap;
PropertyValueMap m_values;
QtIntPropertyManager *m_intPropertyManager;
QMap<const QtProperty *, QtProperty *> m_propertyToX;
QMap<const QtProperty *, QtProperty *> m_propertyToY;
QMap<const QtProperty *, QtProperty *> m_xToProperty;
QMap<const QtProperty *, QtProperty *> m_yToProperty;
};
void QtPointPropertyManagerPrivate::slotIntChanged(QtProperty *property, int value)
{
if (QtProperty *xprop = m_xToProperty.value(property, 0)) {
@ -2748,34 +2674,6 @@ void QtPointPropertyManager::uninitializeProperty(QtProperty *property)
// QtPointFPropertyManager
class QtPointFPropertyManagerPrivate
{
QtPointFPropertyManager *q_ptr;
Q_DECLARE_PUBLIC(QtPointFPropertyManager)
public:
struct Data
{
Data() : decimals(2) {}
QPointF val;
int decimals;
};
void slotDoubleChanged(QtProperty *property, double value);
void slotPropertyDestroyed(QtProperty *property);
typedef QMap<const QtProperty *, Data> PropertyValueMap;
PropertyValueMap m_values;
QtDoublePropertyManager *m_doublePropertyManager;
QMap<const QtProperty *, QtProperty *> m_propertyToX;
QMap<const QtProperty *, QtProperty *> m_propertyToY;
QMap<const QtProperty *, QtProperty *> m_xToProperty;
QMap<const QtProperty *, QtProperty *> m_yToProperty;
};
void QtPointFPropertyManagerPrivate::slotDoubleChanged(QtProperty *property, double value)
{
if (QtProperty *prop = m_xToProperty.value(property, 0)) {
@ -3024,42 +2922,6 @@ void QtPointFPropertyManager::uninitializeProperty(QtProperty *property)
// QtSizePropertyManager
class QtSizePropertyManagerPrivate
{
QtSizePropertyManager *q_ptr;
Q_DECLARE_PUBLIC(QtSizePropertyManager)
public:
void slotIntChanged(QtProperty *property, int value);
void slotPropertyDestroyed(QtProperty *property);
void setValue(QtProperty *property, const QSize &val);
void setRange(QtProperty *property,
const QSize &minVal, const QSize &maxVal, const QSize &val);
struct Data
{
Data() : val(QSize(0, 0)), minVal(QSize(0, 0)), maxVal(QSize(INT_MAX, INT_MAX)) {}
QSize val;
QSize minVal;
QSize maxVal;
QSize minimumValue() const { return minVal; }
QSize maximumValue() const { return maxVal; }
void setMinimumValue(const QSize &newMinVal) { setSizeMinimumData(this, newMinVal); }
void setMaximumValue(const QSize &newMaxVal) { setSizeMaximumData(this, newMaxVal); }
};
typedef QMap<const QtProperty *, Data> PropertyValueMap;
PropertyValueMap m_values;
QtIntPropertyManager *m_intPropertyManager;
QMap<const QtProperty *, QtProperty *> m_propertyToW;
QMap<const QtProperty *, QtProperty *> m_propertyToH;
QMap<const QtProperty *, QtProperty *> m_wToProperty;
QMap<const QtProperty *, QtProperty *> m_hToProperty;
};
void QtSizePropertyManagerPrivate::slotIntChanged(QtProperty *property, int value)
{
if (QtProperty *prop = m_wToProperty.value(property, 0)) {
@ -3368,43 +3230,6 @@ void QtSizePropertyManager::uninitializeProperty(QtProperty *property)
// QtSizeFPropertyManager
class QtSizeFPropertyManagerPrivate
{
QtSizeFPropertyManager *q_ptr;
Q_DECLARE_PUBLIC(QtSizeFPropertyManager)
public:
void slotDoubleChanged(QtProperty *property, double value);
void slotPropertyDestroyed(QtProperty *property);
void setValue(QtProperty *property, const QSizeF &val);
void setRange(QtProperty *property,
const QSizeF &minVal, const QSizeF &maxVal, const QSizeF &val);
struct Data
{
Data() : val(QSizeF(0, 0)), minVal(QSizeF(0, 0)), maxVal(QSizeF(INT_MAX, INT_MAX)), decimals(2) {}
QSizeF val;
QSizeF minVal;
QSizeF maxVal;
int decimals;
QSizeF minimumValue() const { return minVal; }
QSizeF maximumValue() const { return maxVal; }
void setMinimumValue(const QSizeF &newMinVal) { setSizeMinimumData(this, newMinVal); }
void setMaximumValue(const QSizeF &newMaxVal) { setSizeMaximumData(this, newMaxVal); }
};
typedef QMap<const QtProperty *, Data> PropertyValueMap;
PropertyValueMap m_values;
QtDoublePropertyManager *m_doublePropertyManager;
QMap<const QtProperty *, QtProperty *> m_propertyToW;
QMap<const QtProperty *, QtProperty *> m_propertyToH;
QMap<const QtProperty *, QtProperty *> m_wToProperty;
QMap<const QtProperty *, QtProperty *> m_hToProperty;
};
void QtSizeFPropertyManagerPrivate::slotDoubleChanged(QtProperty *property, double value)
{
if (QtProperty *prop = m_wToProperty.value(property, 0)) {
@ -3768,39 +3593,6 @@ void QtSizeFPropertyManager::uninitializeProperty(QtProperty *property)
// QtRectPropertyManager
class QtRectPropertyManagerPrivate
{
QtRectPropertyManager *q_ptr;
Q_DECLARE_PUBLIC(QtRectPropertyManager)
public:
void slotIntChanged(QtProperty *property, int value);
void slotPropertyDestroyed(QtProperty *property);
void setConstraint(QtProperty *property, const QRect &constraint, const QRect &val);
struct Data
{
Data() : val(0, 0, 0, 0) {}
QRect val;
QRect constraint;
};
typedef QMap<const QtProperty *, Data> PropertyValueMap;
PropertyValueMap m_values;
QtIntPropertyManager *m_intPropertyManager;
QMap<const QtProperty *, QtProperty *> m_propertyToX;
QMap<const QtProperty *, QtProperty *> m_propertyToY;
QMap<const QtProperty *, QtProperty *> m_propertyToW;
QMap<const QtProperty *, QtProperty *> m_propertyToH;
QMap<const QtProperty *, QtProperty *> m_xToProperty;
QMap<const QtProperty *, QtProperty *> m_yToProperty;
QMap<const QtProperty *, QtProperty *> m_wToProperty;
QMap<const QtProperty *, QtProperty *> m_hToProperty;
};
void QtRectPropertyManagerPrivate::slotIntChanged(QtProperty *property, int value)
{
if (QtProperty *prop = m_xToProperty.value(property, 0)) {
@ -4176,40 +3968,6 @@ void QtRectPropertyManager::uninitializeProperty(QtProperty *property)
// QtRectFPropertyManager
class QtRectFPropertyManagerPrivate
{
QtRectFPropertyManager *q_ptr;
Q_DECLARE_PUBLIC(QtRectFPropertyManager)
public:
void slotDoubleChanged(QtProperty *property, double value);
void slotPropertyDestroyed(QtProperty *property);
void setConstraint(QtProperty *property, const QRectF &constraint, const QRectF &val);
struct Data
{
Data() : val(0, 0, 0, 0), decimals(2) {}
QRectF val;
QRectF constraint;
int decimals;
};
typedef QMap<const QtProperty *, Data> PropertyValueMap;
PropertyValueMap m_values;
QtDoublePropertyManager *m_doublePropertyManager;
QMap<const QtProperty *, QtProperty *> m_propertyToX;
QMap<const QtProperty *, QtProperty *> m_propertyToY;
QMap<const QtProperty *, QtProperty *> m_propertyToW;
QMap<const QtProperty *, QtProperty *> m_propertyToH;
QMap<const QtProperty *, QtProperty *> m_xToProperty;
QMap<const QtProperty *, QtProperty *> m_yToProperty;
QMap<const QtProperty *, QtProperty *> m_wToProperty;
QMap<const QtProperty *, QtProperty *> m_hToProperty;
};
void QtRectFPropertyManagerPrivate::slotDoubleChanged(QtProperty *property, double value)
{
if (QtProperty *prop = m_xToProperty.value(property, 0)) {
@ -4646,24 +4404,6 @@ void QtRectFPropertyManager::uninitializeProperty(QtProperty *property)
// QtEnumPropertyManager
class QtEnumPropertyManagerPrivate
{
QtEnumPropertyManager *q_ptr;
Q_DECLARE_PUBLIC(QtEnumPropertyManager)
public:
struct Data
{
Data() : val(-1) {}
int val;
QStringList enumNames;
QMap<int, QIcon> enumIcons;
};
typedef QMap<const QtProperty *, Data> PropertyValueMap;
PropertyValueMap m_values;
};
/*!
\class QtEnumPropertyManager
@ -4915,32 +4655,6 @@ void QtEnumPropertyManager::uninitializeProperty(QtProperty *property)
// QtFlagPropertyManager
class QtFlagPropertyManagerPrivate
{
QtFlagPropertyManager *q_ptr;
Q_DECLARE_PUBLIC(QtFlagPropertyManager)
public:
void slotBoolChanged(QtProperty *property, bool value);
void slotPropertyDestroyed(QtProperty *property);
struct Data
{
Data() : val(-1) {}
int val;
QStringList flagNames;
};
typedef QMap<const QtProperty *, Data> PropertyValueMap;
PropertyValueMap m_values;
QtBoolPropertyManager *m_boolPropertyManager;
QMap<const QtProperty *, QList<QtProperty *> > m_propertyToFlags;
QMap<const QtProperty *, QtProperty *> m_flagToProperty;
};
void QtFlagPropertyManagerPrivate::slotBoolChanged(QtProperty *property, bool value)
{
QtProperty *prop = m_flagToProperty.value(property, 0);
@ -5242,35 +4956,6 @@ void QtFlagPropertyManager::uninitializeProperty(QtProperty *property)
// QtSizePolicyPropertyManager
class QtSizePolicyPropertyManagerPrivate
{
QtSizePolicyPropertyManager *q_ptr;
Q_DECLARE_PUBLIC(QtSizePolicyPropertyManager)
public:
QtSizePolicyPropertyManagerPrivate();
void slotIntChanged(QtProperty *property, int value);
void slotEnumChanged(QtProperty *property, int value);
void slotPropertyDestroyed(QtProperty *property);
typedef QMap<const QtProperty *, QSizePolicy> PropertyValueMap;
PropertyValueMap m_values;
QtIntPropertyManager *m_intPropertyManager;
QtEnumPropertyManager *m_enumPropertyManager;
QMap<const QtProperty *, QtProperty *> m_propertyToHPolicy;
QMap<const QtProperty *, QtProperty *> m_propertyToVPolicy;
QMap<const QtProperty *, QtProperty *> m_propertyToHStretch;
QMap<const QtProperty *, QtProperty *> m_propertyToVStretch;
QMap<const QtProperty *, QtProperty *> m_hPolicyToProperty;
QMap<const QtProperty *, QtProperty *> m_vPolicyToProperty;
QMap<const QtProperty *, QtProperty *> m_hStretchToProperty;
QMap<const QtProperty *, QtProperty *> m_vStretchToProperty;
};
QtSizePolicyPropertyManagerPrivate::QtSizePolicyPropertyManagerPrivate()
{
}
@ -5567,50 +5252,6 @@ void QtSizePolicyPropertyManager::uninitializeProperty(QtProperty *property)
Q_GLOBAL_STATIC(QFontDatabase, fontDatabase)
class QtFontPropertyManagerPrivate
{
QtFontPropertyManager *q_ptr;
Q_DECLARE_PUBLIC(QtFontPropertyManager)
public:
QtFontPropertyManagerPrivate();
void slotIntChanged(QtProperty *property, int value);
void slotEnumChanged(QtProperty *property, int value);
void slotBoolChanged(QtProperty *property, bool value);
void slotPropertyDestroyed(QtProperty *property);
void slotFontDatabaseChanged();
void slotFontDatabaseDelayedChange();
QStringList m_familyNames;
typedef QMap<const QtProperty *, QFont> PropertyValueMap;
PropertyValueMap m_values;
QtIntPropertyManager *m_intPropertyManager;
QtEnumPropertyManager *m_enumPropertyManager;
QtBoolPropertyManager *m_boolPropertyManager;
QMap<const QtProperty *, QtProperty *> m_propertyToFamily;
QMap<const QtProperty *, QtProperty *> m_propertyToPointSize;
QMap<const QtProperty *, QtProperty *> m_propertyToBold;
QMap<const QtProperty *, QtProperty *> m_propertyToItalic;
QMap<const QtProperty *, QtProperty *> m_propertyToUnderline;
QMap<const QtProperty *, QtProperty *> m_propertyToStrikeOut;
QMap<const QtProperty *, QtProperty *> m_propertyToKerning;
QMap<const QtProperty *, QtProperty *> m_familyToProperty;
QMap<const QtProperty *, QtProperty *> m_pointSizeToProperty;
QMap<const QtProperty *, QtProperty *> m_boldToProperty;
QMap<const QtProperty *, QtProperty *> m_italicToProperty;
QMap<const QtProperty *, QtProperty *> m_underlineToProperty;
QMap<const QtProperty *, QtProperty *> m_strikeOutToProperty;
QMap<const QtProperty *, QtProperty *> m_kerningToProperty;
bool m_settingValue;
QTimer *m_fontDatabaseChangeTimer;
};
QtFontPropertyManagerPrivate::QtFontPropertyManagerPrivate() :
m_settingValue(false),
m_fontDatabaseChangeTimer(0)
@ -6042,31 +5683,6 @@ void QtFontPropertyManager::uninitializeProperty(QtProperty *property)
// QtColorPropertyManager
class QtColorPropertyManagerPrivate
{
QtColorPropertyManager *q_ptr;
Q_DECLARE_PUBLIC(QtColorPropertyManager)
public:
void slotIntChanged(QtProperty *property, int value);
void slotPropertyDestroyed(QtProperty *property);
typedef QMap<const QtProperty *, QColor> PropertyValueMap;
PropertyValueMap m_values;
QtIntPropertyManager *m_intPropertyManager;
QMap<const QtProperty *, QtProperty *> m_propertyToR;
QMap<const QtProperty *, QtProperty *> m_propertyToG;
QMap<const QtProperty *, QtProperty *> m_propertyToB;
QMap<const QtProperty *, QtProperty *> m_propertyToA;
QMap<const QtProperty *, QtProperty *> m_rToProperty;
QMap<const QtProperty *, QtProperty *> m_gToProperty;
QMap<const QtProperty *, QtProperty *> m_bToProperty;
QMap<const QtProperty *, QtProperty *> m_aToProperty;
};
void QtColorPropertyManagerPrivate::slotIntChanged(QtProperty *property, int value)
{
if (QtProperty *prop = m_rToProperty.value(property, 0)) {
@ -6325,15 +5941,6 @@ void QtColorPropertyManager::uninitializeProperty(QtProperty *property)
Q_GLOBAL_STATIC(QtCursorDatabase, cursorDatabase)
class QtCursorPropertyManagerPrivate
{
QtCursorPropertyManager *q_ptr;
Q_DECLARE_PUBLIC(QtCursorPropertyManager)
public:
typedef QMap<const QtProperty *, QCursor> PropertyValueMap;
PropertyValueMap m_values;
};
/*!
\class QtCursorPropertyManager
@ -6476,5 +6083,5 @@ QString QtTextPropertyManager::valueText(const QtProperty *property) const
QT_END_NAMESPACE
#endif
#include "moc_qtpropertymanager.cxx"
//#include "moc_qtpropertymanager.cxx"
#include "qtpropertymanager.moc"

@ -801,6 +801,399 @@ protected:
virtual QString valueText(const QtProperty *property) const;
};
class QtLocalePropertyManagerPrivate
{
QtLocalePropertyManager *q_ptr;
Q_DECLARE_PUBLIC(QtLocalePropertyManager)
public:
QtLocalePropertyManagerPrivate();
void slotEnumChanged(QtProperty *property, int value);
void slotPropertyDestroyed(QtProperty *property);
typedef QMap<const QtProperty *, QLocale> PropertyValueMap;
PropertyValueMap m_values;
QtEnumPropertyManager *m_enumPropertyManager;
QMap<const QtProperty *, QtProperty *> m_propertyToLanguage;
QMap<const QtProperty *, QtProperty *> m_propertyToCountry;
QMap<const QtProperty *, QtProperty *> m_languageToProperty;
QMap<const QtProperty *, QtProperty *> m_countryToProperty;
};
class QtPointPropertyManagerPrivate
{
QtPointPropertyManager *q_ptr;
Q_DECLARE_PUBLIC(QtPointPropertyManager)
public:
void slotIntChanged(QtProperty *property, int value);
void slotPropertyDestroyed(QtProperty *property);
typedef QMap<const QtProperty *, QPoint> PropertyValueMap;
PropertyValueMap m_values;
QtIntPropertyManager *m_intPropertyManager;
QMap<const QtProperty *, QtProperty *> m_propertyToX;
QMap<const QtProperty *, QtProperty *> m_propertyToY;
QMap<const QtProperty *, QtProperty *> m_xToProperty;
QMap<const QtProperty *, QtProperty *> m_yToProperty;
};
class QtPointFPropertyManagerPrivate
{
QtPointFPropertyManager *q_ptr;
Q_DECLARE_PUBLIC(QtPointFPropertyManager)
public:
struct Data
{
Data() : decimals(2) {}
QPointF val;
int decimals;
};
void slotDoubleChanged(QtProperty *property, double value);
void slotPropertyDestroyed(QtProperty *property);
typedef QMap<const QtProperty *, Data> PropertyValueMap;
PropertyValueMap m_values;
QtDoublePropertyManager *m_doublePropertyManager;
QMap<const QtProperty *, QtProperty *> m_propertyToX;
QMap<const QtProperty *, QtProperty *> m_propertyToY;
QMap<const QtProperty *, QtProperty *> m_xToProperty;
QMap<const QtProperty *, QtProperty *> m_yToProperty;
};
template <class PrivateData, class Value>
static void setSizeMinimumData(PrivateData *data, const Value &newMinVal)
{
data->minVal = newMinVal;
if (data->maxVal.width() < data->minVal.width())
data->maxVal.setWidth(data->minVal.width());
if (data->maxVal.height() < data->minVal.height())
data->maxVal.setHeight(data->minVal.height());
if (data->val.width() < data->minVal.width())
data->val.setWidth(data->minVal.width());
if (data->val.height() < data->minVal.height())
data->val.setHeight(data->minVal.height());
}
template <class PrivateData, class Value>
static void setSizeMaximumData(PrivateData *data, const Value &newMaxVal)
{
data->maxVal = newMaxVal;
if (data->minVal.width() > data->maxVal.width())
data->minVal.setWidth(data->maxVal.width());
if (data->minVal.height() > data->maxVal.height())
data->minVal.setHeight(data->maxVal.height());
if (data->val.width() > data->maxVal.width())
data->val.setWidth(data->maxVal.width());
if (data->val.height() > data->maxVal.height())
data->val.setHeight(data->maxVal.height());
}
class QtSizePropertyManagerPrivate
{
QtSizePropertyManager *q_ptr;
Q_DECLARE_PUBLIC(QtSizePropertyManager)
public:
void slotIntChanged(QtProperty *property, int value);
void slotPropertyDestroyed(QtProperty *property);
void setValue(QtProperty *property, const QSize &val);
void setRange(QtProperty *property,
const QSize &minVal, const QSize &maxVal, const QSize &val);
struct Data
{
Data() : val(QSize(0, 0)), minVal(QSize(0, 0)), maxVal(QSize(INT_MAX, INT_MAX)) {}
QSize val;
QSize minVal;
QSize maxVal;
QSize minimumValue() const { return minVal; }
QSize maximumValue() const { return maxVal; }
void setMinimumValue(const QSize &newMinVal) { setSizeMinimumData(this, newMinVal); }
void setMaximumValue(const QSize &newMaxVal) { setSizeMaximumData(this, newMaxVal); }
};
typedef QMap<const QtProperty *, Data> PropertyValueMap;
PropertyValueMap m_values;
QtIntPropertyManager *m_intPropertyManager;
QMap<const QtProperty *, QtProperty *> m_propertyToW;
QMap<const QtProperty *, QtProperty *> m_propertyToH;
QMap<const QtProperty *, QtProperty *> m_wToProperty;
QMap<const QtProperty *, QtProperty *> m_hToProperty;
};
class QtSizeFPropertyManagerPrivate
{
QtSizeFPropertyManager *q_ptr;
Q_DECLARE_PUBLIC(QtSizeFPropertyManager)
public:
void slotDoubleChanged(QtProperty *property, double value);
void slotPropertyDestroyed(QtProperty *property);
void setValue(QtProperty *property, const QSizeF &val);
void setRange(QtProperty *property,
const QSizeF &minVal, const QSizeF &maxVal, const QSizeF &val);
struct Data
{
Data() : val(QSizeF(0, 0)), minVal(QSizeF(0, 0)), maxVal(QSizeF(INT_MAX, INT_MAX)), decimals(2) {}
QSizeF val;
QSizeF minVal;
QSizeF maxVal;
int decimals;
QSizeF minimumValue() const { return minVal; }
QSizeF maximumValue() const { return maxVal; }
void setMinimumValue(const QSizeF &newMinVal) { setSizeMinimumData(this, newMinVal); }
void setMaximumValue(const QSizeF &newMaxVal) { setSizeMaximumData(this, newMaxVal); }
};
typedef QMap<const QtProperty *, Data> PropertyValueMap;
PropertyValueMap m_values;
QtDoublePropertyManager *m_doublePropertyManager;
QMap<const QtProperty *, QtProperty *> m_propertyToW;
QMap<const QtProperty *, QtProperty *> m_propertyToH;
QMap<const QtProperty *, QtProperty *> m_wToProperty;
QMap<const QtProperty *, QtProperty *> m_hToProperty;
};
class QtRectPropertyManagerPrivate
{
QtRectPropertyManager *q_ptr;
Q_DECLARE_PUBLIC(QtRectPropertyManager)
public:
void slotIntChanged(QtProperty *property, int value);
void slotPropertyDestroyed(QtProperty *property);
void setConstraint(QtProperty *property, const QRect &constraint, const QRect &val);
struct Data
{
Data() : val(0, 0, 0, 0) {}
QRect val;
QRect constraint;
};
typedef QMap<const QtProperty *, Data> PropertyValueMap;
PropertyValueMap m_values;
QtIntPropertyManager *m_intPropertyManager;
QMap<const QtProperty *, QtProperty *> m_propertyToX;
QMap<const QtProperty *, QtProperty *> m_propertyToY;
QMap<const QtProperty *, QtProperty *> m_propertyToW;
QMap<const QtProperty *, QtProperty *> m_propertyToH;
QMap<const QtProperty *, QtProperty *> m_xToProperty;
QMap<const QtProperty *, QtProperty *> m_yToProperty;
QMap<const QtProperty *, QtProperty *> m_wToProperty;
QMap<const QtProperty *, QtProperty *> m_hToProperty;
};
class QtRectFPropertyManagerPrivate
{
QtRectFPropertyManager *q_ptr;
Q_DECLARE_PUBLIC(QtRectFPropertyManager)
public:
void slotDoubleChanged(QtProperty *property, double value);
void slotPropertyDestroyed(QtProperty *property);
void setConstraint(QtProperty *property, const QRectF &constraint, const QRectF &val);
struct Data
{
Data() : val(0, 0, 0, 0), decimals(2) {}
QRectF val;
QRectF constraint;
int decimals;
};
typedef QMap<const QtProperty *, Data> PropertyValueMap;
PropertyValueMap m_values;
QtDoublePropertyManager *m_doublePropertyManager;
QMap<const QtProperty *, QtProperty *> m_propertyToX;
QMap<const QtProperty *, QtProperty *> m_propertyToY;
QMap<const QtProperty *, QtProperty *> m_propertyToW;
QMap<const QtProperty *, QtProperty *> m_propertyToH;
QMap<const QtProperty *, QtProperty *> m_xToProperty;
QMap<const QtProperty *, QtProperty *> m_yToProperty;
QMap<const QtProperty *, QtProperty *> m_wToProperty;
QMap<const QtProperty *, QtProperty *> m_hToProperty;
};
class QtEnumPropertyManagerPrivate
{
QtEnumPropertyManager *q_ptr;
Q_DECLARE_PUBLIC(QtEnumPropertyManager)
public:
struct Data
{
Data() : val(-1) {}
int val;
QStringList enumNames;
QMap<int, QIcon> enumIcons;
};
typedef QMap<const QtProperty *, Data> PropertyValueMap;
PropertyValueMap m_values;
};
class QtFlagPropertyManagerPrivate
{
QtFlagPropertyManager *q_ptr;
Q_DECLARE_PUBLIC(QtFlagPropertyManager)
public:
void slotBoolChanged(QtProperty *property, bool value);
void slotPropertyDestroyed(QtProperty *property);
struct Data
{
Data() : val(-1) {}
int val;
QStringList flagNames;
};
typedef QMap<const QtProperty *, Data> PropertyValueMap;
PropertyValueMap m_values;
QtBoolPropertyManager *m_boolPropertyManager;
QMap<const QtProperty *, QList<QtProperty *> > m_propertyToFlags;
QMap<const QtProperty *, QtProperty *> m_flagToProperty;
};
class QtSizePolicyPropertyManagerPrivate
{
QtSizePolicyPropertyManager *q_ptr;
Q_DECLARE_PUBLIC(QtSizePolicyPropertyManager)
public:
QtSizePolicyPropertyManagerPrivate();
void slotIntChanged(QtProperty *property, int value);
void slotEnumChanged(QtProperty *property, int value);
void slotPropertyDestroyed(QtProperty *property);
typedef QMap<const QtProperty *, QSizePolicy> PropertyValueMap;
PropertyValueMap m_values;
QtIntPropertyManager *m_intPropertyManager;
QtEnumPropertyManager *m_enumPropertyManager;
QMap<const QtProperty *, QtProperty *> m_propertyToHPolicy;
QMap<const QtProperty *, QtProperty *> m_propertyToVPolicy;
QMap<const QtProperty *, QtProperty *> m_propertyToHStretch;
QMap<const QtProperty *, QtProperty *> m_propertyToVStretch;
QMap<const QtProperty *, QtProperty *> m_hPolicyToProperty;
QMap<const QtProperty *, QtProperty *> m_vPolicyToProperty;
QMap<const QtProperty *, QtProperty *> m_hStretchToProperty;
QMap<const QtProperty *, QtProperty *> m_vStretchToProperty;
};
class QtFontPropertyManagerPrivate
{
QtFontPropertyManager *q_ptr;
Q_DECLARE_PUBLIC(QtFontPropertyManager)
public:
QtFontPropertyManagerPrivate();
void slotIntChanged(QtProperty *property, int value);
void slotEnumChanged(QtProperty *property, int value);
void slotBoolChanged(QtProperty *property, bool value);
void slotPropertyDestroyed(QtProperty *property);
void slotFontDatabaseChanged();
void slotFontDatabaseDelayedChange();
QStringList m_familyNames;
typedef QMap<const QtProperty *, QFont> PropertyValueMap;
PropertyValueMap m_values;
QtIntPropertyManager *m_intPropertyManager;
QtEnumPropertyManager *m_enumPropertyManager;
QtBoolPropertyManager *m_boolPropertyManager;
QMap<const QtProperty *, QtProperty *> m_propertyToFamily;
QMap<const QtProperty *, QtProperty *> m_propertyToPointSize;
QMap<const QtProperty *, QtProperty *> m_propertyToBold;
QMap<const QtProperty *, QtProperty *> m_propertyToItalic;
QMap<const QtProperty *, QtProperty *> m_propertyToUnderline;
QMap<const QtProperty *, QtProperty *> m_propertyToStrikeOut;
QMap<const QtProperty *, QtProperty *> m_propertyToKerning;
QMap<const QtProperty *, QtProperty *> m_familyToProperty;
QMap<const QtProperty *, QtProperty *> m_pointSizeToProperty;
QMap<const QtProperty *, QtProperty *> m_boldToProperty;
QMap<const QtProperty *, QtProperty *> m_italicToProperty;
QMap<const QtProperty *, QtProperty *> m_underlineToProperty;
QMap<const QtProperty *, QtProperty *> m_strikeOutToProperty;
QMap<const QtProperty *, QtProperty *> m_kerningToProperty;
bool m_settingValue;
QTimer *m_fontDatabaseChangeTimer;
};
class QtColorPropertyManagerPrivate
{
QtColorPropertyManager *q_ptr;
Q_DECLARE_PUBLIC(QtColorPropertyManager)
public:
void slotIntChanged(QtProperty *property, int value);
void slotPropertyDestroyed(QtProperty *property);
typedef QMap<const QtProperty *, QColor> PropertyValueMap;
PropertyValueMap m_values;
QtIntPropertyManager *m_intPropertyManager;
QMap<const QtProperty *, QtProperty *> m_propertyToR;
QMap<const QtProperty *, QtProperty *> m_propertyToG;
QMap<const QtProperty *, QtProperty *> m_propertyToB;
QMap<const QtProperty *, QtProperty *> m_propertyToA;
QMap<const QtProperty *, QtProperty *> m_rToProperty;
QMap<const QtProperty *, QtProperty *> m_gToProperty;
QMap<const QtProperty *, QtProperty *> m_bToProperty;
QMap<const QtProperty *, QtProperty *> m_aToProperty;
};
class QtCursorPropertyManagerPrivate
{
QtCursorPropertyManager *q_ptr;
Q_DECLARE_PUBLIC(QtCursorPropertyManager)
public:
typedef QMap<const QtProperty *, QCursor> PropertyValueMap;
PropertyValueMap m_values;
};
#if QT_VERSION >= 0x040400
QT_END_NAMESPACE
#endif

@ -86,17 +86,17 @@
****************************************************************************/
#include "qttreepropertybrowser.h"
#include <QtCore/QSet>
#include <QtGui/QIcon>
#include <QtGui/QTreeWidget>
#include <QtGui/QItemDelegate>
#include <QtGui/QHBoxLayout>
#include <QtGui/QHeaderView>
#include <QtGui/QPainter>
#include <QtGui/QApplication>
#include <QtGui/QFocusEvent>
#include <QtGui/QStyle>
#include <QtGui/QPalette>
#include <QSet>
#include <QIcon>
#include <QTreeWidget>
#include <QItemDelegate>
#include <QHBoxLayout>
#include <QHeaderView>
#include <QPainter>
#include <QApplication>
#include <QFocusEvent>
#include <QStyle>
#include <QPalette>
#if QT_VERSION >= 0x040400
QT_BEGIN_NAMESPACE
@ -104,63 +104,6 @@ QT_BEGIN_NAMESPACE
class QtPropertyEditorView;
class QtTreePropertyBrowserPrivate
{
QtTreePropertyBrowser *q_ptr;
Q_DECLARE_PUBLIC(QtTreePropertyBrowser)
public:
QtTreePropertyBrowserPrivate();
void init(QWidget *parent);
void propertyInserted(QtBrowserItem *index, QtBrowserItem *afterIndex);
void propertyRemoved(QtBrowserItem *index);
void propertyChanged(QtBrowserItem *index);
QWidget *createEditor(QtProperty *property, QWidget *parent) const
{ return q_ptr->createEditor(property, parent); }
QtProperty *indexToProperty(const QModelIndex &index) const;
QTreeWidgetItem *indexToItem(const QModelIndex &index) const;
QtBrowserItem *indexToBrowserItem(const QModelIndex &index) const;
bool lastColumn(int column) const;
void disableItem(QTreeWidgetItem *item) const;
void enableItem(QTreeWidgetItem *item) const;
bool hasValue(QTreeWidgetItem *item) const;
void slotCollapsed(const QModelIndex &index);
void slotExpanded(const QModelIndex &index);
QColor calculatedBackgroundColor(QtBrowserItem *item) const;
QtPropertyEditorView *treeWidget() const { return m_treeWidget; }
bool markPropertiesWithoutValue() const { return m_markPropertiesWithoutValue; }
QtBrowserItem *currentItem() const;
void setCurrentItem(QtBrowserItem *browserItem, bool block);
void editItem(QtBrowserItem *browserItem);
void slotCurrentBrowserItemChanged(QtBrowserItem *item);
void slotCurrentTreeItemChanged(QTreeWidgetItem *newItem, QTreeWidgetItem *);
QTreeWidgetItem *editedItem() const;
private:
void updateItem(QTreeWidgetItem *item);
QMap<QtBrowserItem *, QTreeWidgetItem *> m_indexToItem;
QMap<QTreeWidgetItem *, QtBrowserItem *> m_itemToIndex;
QMap<QtBrowserItem *, QColor> m_indexToBackgroundColor;
QtPropertyEditorView *m_treeWidget;
bool m_headerVisible;
QtTreePropertyBrowser::ResizeMode m_resizeMode;
class QtPropertyEditorDelegate *m_delegate;
bool m_markPropertiesWithoutValue;
bool m_browserChangedBlocked;
QIcon m_expandIcon;
};
// ------------ QtPropertyEditorView
class QtPropertyEditorView : public QTreeWidget
{
@ -491,16 +434,16 @@ void QtTreePropertyBrowserPrivate::init(QWidget *parent)
m_treeWidget->setColumnCount(2);
QStringList labels;
labels.append(QApplication::translate("QtTreePropertyBrowser", "Property", 0, QApplication::UnicodeUTF8));
labels.append(QApplication::translate("QtTreePropertyBrowser", "Value", 0, QApplication::UnicodeUTF8));
labels.append(QApplication::translate("QtTreePropertyBrowser", "Property", 0, -1));
labels.append(QApplication::translate("QtTreePropertyBrowser", "Value", 0, -1));
m_treeWidget->setHeaderLabels(labels);
m_treeWidget->setAlternatingRowColors(true);
m_treeWidget->setEditTriggers(QAbstractItemView::EditKeyPressed);
m_delegate = new QtPropertyEditorDelegate(parent);
m_delegate->setEditorPrivate(this);
m_treeWidget->setItemDelegate(m_delegate);
m_treeWidget->header()->setMovable(false);
m_treeWidget->header()->setResizeMode(QHeaderView::Stretch);
//m_treeWidget->header()->setMovable(false);
//m_treeWidget->header()->setResizeMode(QHeaderView::Stretch);
m_expandIcon = drawIndicatorIcon(q_ptr->palette(), q_ptr->style());
@ -912,7 +855,7 @@ void QtTreePropertyBrowser::setResizeMode(QtTreePropertyBrowser::ResizeMode mode
case QtTreePropertyBrowser::Stretch:
default: m = QHeaderView::Stretch; break;
}
d_ptr->m_treeWidget->header()->setResizeMode(m);
//d_ptr->m_treeWidget->header()->setResizeMode(m);
}
/*!
@ -1091,5 +1034,5 @@ void QtTreePropertyBrowser::editItem(QtBrowserItem *item)
QT_END_NAMESPACE
#endif
#include "moc_qttreepropertybrowser.cxx"
//#include "moc_qttreepropertybrowser.cxx"
#include "qttreepropertybrowser.moc"

@ -96,6 +96,7 @@ QT_BEGIN_NAMESPACE
class QTreeWidgetItem;
class QtTreePropertyBrowserPrivate;
class QtPropertyEditorView;
class QT_QTPROPERTYBROWSER_EXPORT QtTreePropertyBrowser : public QtAbstractPropertyBrowser
{
@ -177,6 +178,63 @@ private:
};
class QtTreePropertyBrowserPrivate
{
QtTreePropertyBrowser *q_ptr;
Q_DECLARE_PUBLIC(QtTreePropertyBrowser)
public:
QtTreePropertyBrowserPrivate();
void init(QWidget *parent);
void propertyInserted(QtBrowserItem *index, QtBrowserItem *afterIndex);
void propertyRemoved(QtBrowserItem *index);
void propertyChanged(QtBrowserItem *index);
QWidget *createEditor(QtProperty *property, QWidget *parent) const
{ return q_ptr->createEditor(property, parent); }
QtProperty *indexToProperty(const QModelIndex &index) const;
QTreeWidgetItem *indexToItem(const QModelIndex &index) const;
QtBrowserItem *indexToBrowserItem(const QModelIndex &index) const;
bool lastColumn(int column) const;
void disableItem(QTreeWidgetItem *item) const;
void enableItem(QTreeWidgetItem *item) const;
bool hasValue(QTreeWidgetItem *item) const;
void slotCollapsed(const QModelIndex &index);
void slotExpanded(const QModelIndex &index);
QColor calculatedBackgroundColor(QtBrowserItem *item) const;
QtPropertyEditorView *treeWidget() const { return m_treeWidget; }
bool markPropertiesWithoutValue() const { return m_markPropertiesWithoutValue; }
QtBrowserItem *currentItem() const;
void setCurrentItem(QtBrowserItem *browserItem, bool block);
void editItem(QtBrowserItem *browserItem);
void slotCurrentBrowserItemChanged(QtBrowserItem *item);
void slotCurrentTreeItemChanged(QTreeWidgetItem *newItem, QTreeWidgetItem *);
QTreeWidgetItem *editedItem() const;
private:
void updateItem(QTreeWidgetItem *item);
QMap<QtBrowserItem *, QTreeWidgetItem *> m_indexToItem;
QMap<QTreeWidgetItem *, QtBrowserItem *> m_itemToIndex;
QMap<QtBrowserItem *, QColor> m_indexToBackgroundColor;
QtPropertyEditorView *m_treeWidget;
bool m_headerVisible;
QtTreePropertyBrowser::ResizeMode m_resizeMode;
class QtPropertyEditorDelegate *m_delegate;
bool m_markPropertiesWithoutValue;
bool m_browserChangedBlocked;
QIcon m_expandIcon;
};
#if QT_VERSION >= 0x040400
QT_END_NAMESPACE
#endif

File diff suppressed because it is too large Load Diff

@ -1,62 +1,18 @@
/****************************************************************************
**
** This file is part of a Qt Solutions component.
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Solutions Commercial License Agreement provided
** with the Software or, alternatively, in accordance with the terms
** contained in a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain
** additional rights. These rights are described in the Nokia Qt LGPL
** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
** package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** Please note Third Party Software included with Qt Solutions may impose
** additional restrictions and it is the user's responsibility to ensure
** that they have met the licensing requirements of the GPL, LGPL, or Qt
** Solutions Commercial license and the relevant license of the Third
** Party Software they are using.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
****************************************************************************/
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the tools applications of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the either Technology Preview License Agreement or the
** Beta Release License Agreement.
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@ -66,10 +22,9 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain
** additional rights. These rights are described in the Nokia Qt LGPL
** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
** package.
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
@ -79,8 +34,7 @@
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
** $QT_END_LICENSE$
**
****************************************************************************/
@ -89,19 +43,16 @@
#define QTVARIANTPROPERTY_H
#include "qtpropertybrowser.h"
#include <QtCore/QVariant>
#include <QtGui/QIcon>
#include <QVariant>
#include <QIcon>
#if QT_VERSION >= 0x040400
QT_BEGIN_NAMESPACE
#endif
typedef QMap<int, QIcon> QtIconMap;
class QtVariantPropertyManager;
class QtVariantPropertyPrivate;
class QT_QTPROPERTYBROWSER_EXPORT QtVariantProperty : public QtProperty
class QtVariantProperty : public QtProperty
{
public:
~QtVariantProperty();
@ -116,12 +67,10 @@ protected:
QtVariantProperty(QtVariantPropertyManager *manager);
private:
friend class QtVariantPropertyManager;
QtVariantPropertyPrivate *d_ptr;
QScopedPointer<class QtVariantPropertyPrivate> d_ptr;
};
class QtVariantPropertyManagerPrivate;
class QT_QTPROPERTYBROWSER_EXPORT QtVariantPropertyManager : public QtAbstractPropertyManager
class QtVariantPropertyManager : public QtAbstractPropertyManager
{
Q_OBJECT
public:
@ -162,7 +111,7 @@ protected:
virtual void uninitializeProperty(QtProperty *property);
virtual QtProperty *createProperty();
private:
QtVariantPropertyManagerPrivate *d_ptr;
QScopedPointer<class QtVariantPropertyManagerPrivate> d_ptr;
Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, int))
Q_PRIVATE_SLOT(d_func(), void slotRangeChanged(QtProperty *, int, int))
Q_PRIVATE_SLOT(d_func(), void slotSingleStepChanged(QtProperty *, int))
@ -204,9 +153,7 @@ private:
Q_DISABLE_COPY(QtVariantPropertyManager)
};
class QtVariantEditorFactoryPrivate;
class QT_QTPROPERTYBROWSER_EXPORT QtVariantEditorFactory : public QtAbstractEditorFactory<QtVariantPropertyManager>
class QtVariantEditorFactory : public QtAbstractEditorFactory<QtVariantPropertyManager>
{
Q_OBJECT
public:
@ -218,14 +165,91 @@ protected:
QWidget *parent);
void disconnectPropertyManager(QtVariantPropertyManager *manager);
private:
QtVariantEditorFactoryPrivate *d_ptr;
QScopedPointer<class QtVariantEditorFactoryPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtVariantEditorFactory)
Q_DISABLE_COPY(QtVariantEditorFactory)
};
#if QT_VERSION >= 0x040400
class QtVariantPropertyManagerPrivate
{
QtVariantPropertyManager *q_ptr;
Q_DECLARE_PUBLIC(QtVariantPropertyManager)
public:
QtVariantPropertyManagerPrivate();
bool m_creatingProperty;
bool m_creatingSubProperties;
bool m_destroyingSubProperties;
int m_propertyType;
void slotValueChanged(QtProperty *property, int val);
void slotRangeChanged(QtProperty *property, int min, int max);
void slotSingleStepChanged(QtProperty *property, int step);
void slotValueChanged(QtProperty *property, double val);
void slotRangeChanged(QtProperty *property, double min, double max);
void slotSingleStepChanged(QtProperty *property, double step);
void slotDecimalsChanged(QtProperty *property, int prec);
void slotValueChanged(QtProperty *property, bool val);
void slotValueChanged(QtProperty *property, const QString &val);
void slotRegExpChanged(QtProperty *property, const QRegExp &regExp);
void slotValueChanged(QtProperty *property, const QDate &val);
void slotRangeChanged(QtProperty *property, const QDate &min, const QDate &max);
void slotValueChanged(QtProperty *property, const QTime &val);
void slotValueChanged(QtProperty *property, const QDateTime &val);
void slotValueChanged(QtProperty *property, const QKeySequence &val);
void slotValueChanged(QtProperty *property, const QChar &val);
void slotValueChanged(QtProperty *property, const QLocale &val);
void slotValueChanged(QtProperty *property, const QPoint &val);
void slotValueChanged(QtProperty *property, const QPointF &val);
void slotValueChanged(QtProperty *property, const QSize &val);
void slotRangeChanged(QtProperty *property, const QSize &min, const QSize &max);
void slotValueChanged(QtProperty *property, const QSizeF &val);
void slotRangeChanged(QtProperty *property, const QSizeF &min, const QSizeF &max);
void slotValueChanged(QtProperty *property, const QRect &val);
void slotConstraintChanged(QtProperty *property, const QRect &val);
void slotValueChanged(QtProperty *property, const QRectF &val);
void slotConstraintChanged(QtProperty *property, const QRectF &val);
void slotValueChanged(QtProperty *property, const QColor &val);
void slotEnumChanged(QtProperty *property, int val);
void slotEnumNamesChanged(QtProperty *property, const QStringList &enumNames);
void slotEnumIconsChanged(QtProperty *property, const QMap<int, QIcon> &enumIcons);
void slotValueChanged(QtProperty *property, const QSizePolicy &val);
void slotValueChanged(QtProperty *property, const QFont &val);
void slotValueChanged(QtProperty *property, const QCursor &val);
void slotFlagChanged(QtProperty *property, int val);
void slotFlagNamesChanged(QtProperty *property, const QStringList &flagNames);
void slotPropertyInserted(QtProperty *property, QtProperty *parent, QtProperty *after);
void slotPropertyRemoved(QtProperty *property, QtProperty *parent);
void valueChanged(QtProperty *property, const QVariant &val);
int internalPropertyToType(QtProperty *property) const;
QtVariantProperty *createSubProperty(QtVariantProperty *parent, QtVariantProperty *after,
QtProperty *internal);
void removeSubProperty(QtVariantProperty *property);
QMap<int, QtAbstractPropertyManager *> m_typeToPropertyManager;
QMap<int, QMap<QString, int> > m_typeToAttributeToAttributeType;
QMap<const QtProperty *, QPair<QtVariantProperty *, int> > m_propertyToType;
QMap<int, int> m_typeToValueType;
QMap<QtProperty *, QtVariantProperty *> m_internalToProperty;
const QString m_constraintAttribute;
const QString m_singleStepAttribute;
const QString m_decimalsAttribute;
const QString m_enumIconsAttribute;
const QString m_enumNamesAttribute;
const QString m_flagNamesAttribute;
const QString m_maximumAttribute;
const QString m_minimumAttribute;
const QString m_regExpAttribute;
};
QT_END_NAMESPACE
#endif
Q_DECLARE_METATYPE(QIcon)
Q_DECLARE_METATYPE(QtIconMap)

@ -1,7 +1,9 @@
ADD_SUBDIRECTORY(3rdparty)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${LIBXML2_INCLUDE_DIR} ${NEL_INCLUDE_DIR} ${QT_INCLUDES})
IF(WITH_QT)
INCLUDE(${QT_USE_FILE})
ENDIF(WITH_QT)
CONFIGURE_FILE(translations/translations.qrc ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc COPYONLY)
@ -31,30 +33,54 @@ IF(WIN32)
SET(STUDIO_RC studio.rc)
ENDIF(WIN32)
IF(WITH_QT5)
SET(CMAKE_AUTOMOC ON)
QT5_ADD_TRANSLATION(STUDIO_QM ${STUDIO_TS})
QT5_ADD_RESOURCES( STUDIO_RC_SRCS ${STUDIO_RCS})
QT5_WRAP_CPP( STUDIO_MOC_SRCS ${STUDIO_HDR} )
QT5_WRAP_UI( STUDIO_PLUGIN_UI_HDRS ${STUDIO_PLUGIN_UIS})
ELSE(WITH_QT5)
QT4_ADD_TRANSLATION(STUDIO_QM ${STUDIO_TS})
QT4_ADD_RESOURCES( STUDIO_RC_SRCS ${STUDIO_RCS})
QT4_WRAP_CPP( STUDIO_MOC_SRCS ${STUDIO_HDR} )
QT4_WRAP_UI( STUDIO_PLUGIN_UI_HDRS ${STUDIO_PLUGIN_UIS})
ENDIF(WITH_QT5)
SOURCE_GROUP(QtResources FILES ${STUDIO_RCS} ${STUDIO_PLUGIN_UIS} )
SOURCE_GROUP(QtGeneratedMocQrcSrc FILES ${STUDIO_MOC_SRCS} ${STUDIO_RC_SRCS})
IF(WITH_QT5)
ADD_EXECUTABLE(studio WIN32 MACOSX_BUNDLE
${STUDIO_SRC}
${STUDIO_RC_SRCS}
${STUDIO_RC}
${STUDIO_PLUGIN_UIS})
ELSE(WITH_QT5)
ADD_EXECUTABLE(studio WIN32 MACOSX_BUNDLE
${STUDIO_SRC}
${STUDIO_MOC_SRCS}
${STUDIO_RC_SRCS}
${STUDIO_RC}
${STUDIO_PLUGIN_UIS})
ENDIF(WITH_QT5)
TARGET_LINK_LIBRARIES(studio
nelmisc)
IF(WITH_QT5)
TARGET_LINK_LIBRARIES(studio
Qt5::Widgets)
ELSE(WITH_QT5)
TARGET_LINK_LIBRARIES(studio
nelmisc
${QT_LIBRARIES}
${QT_QTMAIN_LIBRARY})
ENDIF(WITH_QT5)
ADD_DEFINITIONS(-DQT_NO_KEYWORDS ${LIBXML2_DEFINITIONS} ${QT_DEFINITIONS})
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} ${QT_DEFINITIONS})
NL_DEFAULT_PROPS(studio "Tools: Studio")
NL_ADD_RUNTIME_FLAGS(studio)
ADD_SUBDIRECTORY(3rdparty)
ADD_SUBDIRECTORY(plugins)
INSTALL(TARGETS studio RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT runtime BUNDLE DESTINATION /Applications)

@ -19,9 +19,9 @@
#ifndef IPLUGIN_H
#define IPLUGIN_H
#include <QtCore/QtPlugin>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtPlugin>
#include <QString>
#include <QStringList>
#include "iplugin_manager.h"
@ -99,6 +99,7 @@ public:
}; //namespace ExtensionSystem
Q_DECLARE_INTERFACE(ExtensionSystem::IPlugin, "dev.ryzom.com.ObjectViewerQt.IPlugin/0.9.2")
#define NL_STUDIO_IPLUGIN_IID "org.ryzomcore.Studio.IPlugin/0.10.0"
Q_DECLARE_INTERFACE(ExtensionSystem::IPlugin, NL_STUDIO_IPLUGIN_IID)
#endif // IPLUGIN_H

@ -21,10 +21,10 @@
#include "iplugin_spec.h"
#include <QtCore/QList>
#include <QtCore/QObject>
#include <QtCore/QStringList>
#include <QtCore/QSettings>
#include <QList>
#include <QObject>
#include <QStringList>
#include <QSettings>
namespace ExtensionSystem
{

@ -19,7 +19,7 @@
#ifndef IPLUGINSPEC_H
#define IPLUGINSPEC_H
#include <QtCore/QString>
#include <QString>
namespace ExtensionSystem
{

@ -427,7 +427,7 @@ void PluginSpec::kill()
bool b = loader->unload();
if( !b )
{
nlinfo( "Plugin %s couldn't be unloaded.", this->m_name.toAscii().data() );
nlinfo( "Plugin %s couldn't be unloaded.", this->m_name.toLocal8Bit().data() );
}
//delete m_plugin;

@ -35,11 +35,11 @@
#include <QtCore/QLibraryInfo>
#include <QtCore/QLocale>
#include <QtCore/QSettings>
#include <QtGui/QMessageBox>
#include <QtGui/QApplication>
#include <QtWidgets/QMessageBox>
#include <QtWidgets/QApplication>
//#include <QtGui/QSplashScreen>
#include <QtGui/QFileDialog>
#include <QtGui/QInputDialog>
#include <QtWidgets/QFileDialog>
#include <QtWidgets/QInputDialog>
#include "startup_settings_dlg.h"
#include "splash_screen.h"
@ -137,7 +137,7 @@ int main(int argc, char **argv)
nlinfo("Welcome to NeL Object Viewer Qt!");
}
QApplication::setGraphicsSystem("raster");
#ifdef NL_OS_WINDOWS
QApplication app(__argc, __argv);
#else // NL_OS_WINDOWS

@ -1,24 +1,24 @@
ADD_SUBDIRECTORY(core)
ADD_SUBDIRECTORY(example)
ADD_SUBDIRECTORY(ovqt_sheet_builder)
ADD_SUBDIRECTORY(landscape_editor)
ADD_SUBDIRECTORY(log)
ADD_SUBDIRECTORY(disp_sheet_id)
ADD_SUBDIRECTORY(object_viewer)
ADD_SUBDIRECTORY(georges_editor)
#ADD_SUBDIRECTORY(example)
#ADD_SUBDIRECTORY(ovqt_sheet_builder)
#ADD_SUBDIRECTORY(landscape_editor)
#ADD_SUBDIRECTORY(log)
#ADD_SUBDIRECTORY(disp_sheet_id)
#ADD_SUBDIRECTORY(object_viewer)
#ADD_SUBDIRECTORY(georges_editor)
ADD_SUBDIRECTORY(world_editor)
IF(WITH_GUI)
ADD_SUBDIRECTORY(gui_editor)
ENDIF(WITH_GUI)
#ADD_SUBDIRECTORY(world_editor)
#IF(WITH_GUI)
# ADD_SUBDIRECTORY(gui_editor)
#ENDIF(WITH_GUI)
ADD_SUBDIRECTORY(translation_manager)
ADD_SUBDIRECTORY(tile_editor)
ADD_SUBDIRECTORY(bnp_manager)
#ADD_SUBDIRECTORY(translation_manager)
#ADD_SUBDIRECTORY(tile_editor)
#ADD_SUBDIRECTORY(bnp_manager)
# Note: Temporarily disabled until development continues.
#ADD_SUBDIRECTORY(zone_painter)
# Ryzom Specific Plugins
IF(WITH_RYZOM AND WITH_RYZOM_TOOLS)
ADD_SUBDIRECTORY(mission_compiler)
ENDIF(WITH_RYZOM AND WITH_RYZOM_TOOLS)
#IF(WITH_RYZOM AND WITH_RYZOM_TOOLS)
# ADD_SUBDIRECTORY(mission_compiler)
#ENDIF(WITH_RYZOM AND WITH_RYZOM_TOOLS)

@ -45,9 +45,16 @@ ENDIF(NOT WIN32)
SET(QT_USE_QTGUI TRUE)
SET(QT_USE_QTOPENGL TRUE)
IF(WITH_QT5)
SET(CMAKE_AUTOMOC OFF)
QT5_ADD_RESOURCES(OVQT_CORE_PLUGIN_RC_SRCS ${OVQT_CORE_PLUGIN_RCS})
QT5_WRAP_CPP(OVQT_CORE_PLUGIN_MOC_SRC ${OVQT_CORE_PLUGIN_HDR})
QT5_WRAP_UI(OVQT_CORE_PLUGIN_UI_HDRS ${OVQT_CORE_PLUGIN_UIS})
ELSE(WITH_QT5)
QT4_ADD_RESOURCES(OVQT_CORE_PLUGIN_RC_SRCS ${OVQT_CORE_PLUGIN_RCS})
QT4_WRAP_CPP(OVQT_CORE_PLUGIN_MOC_SRC ${OVQT_CORE_PLUGIN_HDR})
QT4_WRAP_UI(OVQT_CORE_PLUGIN_UI_HDRS ${OVQT_CORE_PLUGIN_UIS})
ENDIF(WITH_QT5)
SOURCE_GROUP(QtResources FILES ${OVQT_CORE_PLUGIN_UIS} ${OVQT_CORE_PLUGIN_RCS})
SOURCE_GROUP(QtGeneratedUiHdr FILES ${OVQT_CORE_PLUGIN_UI_HDRS})
@ -57,7 +64,15 @@ SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC})
ADD_LIBRARY(studio_plugin_core SHARED ${SRC} ${OVQT_CORE_PLUGIN_MOC_SRC} ${OVQT_EXT_SYS_SRC} ${OVQT_CORE_PLUGIN_RC_SRCS} ${OVQT_CORE_PLUGIN_UI_HDRS})
TARGET_LINK_LIBRARIES(studio_plugin_core nelmisc nel3d ${QT_LIBRARIES})
TARGET_LINK_LIBRARIES(studio_plugin_core nelmisc nel3d)
IF(WITH_QT5)
TARGET_LINK_LIBRARIES(studio_plugin_core
Qt5::Widgets)
ELSE(WITH_QT5)
TARGET_LINK_LIBRARIES(studio_plugin_core
${QT_LIBRARIES})
ENDIF(WITH_QT5)
NL_DEFAULT_PROPS(studio_plugin_core "Tools: Studio Plugin: Core")
NL_ADD_RUNTIME_FLAGS(studio_plugin_core)

@ -62,7 +62,7 @@ void Nel3DWidget::init()
nlassert( driver == NULL );
driver = NL3D::UDriver::createDriver( 0, false, 0 );
driver->setDisplay( winId(), NL3D::UDriver::CMode( width(), height(), 32, true ) );
driver->setDisplay( (nlWindow)winId(), NL3D::UDriver::CMode( width(), height(), 32, true ) );
}
void Nel3DWidget::createTextContext( std::string fontFile )

@ -24,8 +24,8 @@
#include <nel/misc/debug.h>
// Qt includes
#include <QtGui/QTabWidget>
#include <QtGui/QGridLayout>
#include <QTabWidget>
#include <QGridLayout>
namespace Core
{

@ -22,7 +22,7 @@
#include "core_global.h"
// Qt includes
#include <QtCore/QObject>
#include <QObject>
QT_BEGIN_NAMESPACE
class QTabWidget;

@ -19,7 +19,7 @@
#ifndef CORE_GLOBAL_H
#define CORE_GLOBAL_H
#include <QtCore/qglobal.h>
#include <qglobal.h>
#if defined(CORE_LIBRARY)
# define CORE_EXPORT Q_DECL_EXPORT

@ -27,12 +27,12 @@
#include "nel/misc/debug.h"
// Qt includes
#include <QtCore/QObject>
#include <QtGui/QMessageBox>
#include <QtGui/QMainWindow>
#include <QtGui/QMenu>
#include <QtGui/QAction>
#include <QtGui/QMenuBar>
#include <QObject>
#include <QMessageBox>
#include <QMainWindow>
#include <QMenu>
#include <QAction>
#include <QMenuBar>
using namespace Core;
@ -101,4 +101,4 @@ void CorePlugin::addAutoReleasedObject(QObject *obj)
m_autoReleaseObjects.prepend(obj);
}
Q_EXPORT_PLUGIN(CorePlugin)
// Q_EXPORT_PLUGIN(CorePlugin)

@ -23,7 +23,7 @@
#include "nel/misc/app_context.h"
#include <QtCore/QObject>
#include <QObject>
namespace NLMISC
{
@ -41,6 +41,7 @@ namespace Core
class CorePlugin : public QObject, public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID NL_STUDIO_IPLUGIN_IID)
Q_INTERFACES(ExtensionSystem::IPlugin)
public:

@ -24,12 +24,12 @@
#include <nel/misc/path.h>
// Qt includes
#include <QtCore/QSettings>
#include <QtGui/QWidget>
#include <QtGui/QMessageBox>
#include <QtGui/QFileDialog>
#include <QtGui/QStyleFactory>
#include <QtGui/QStyle>
#include <QSettings>
#include <QWidget>
#include <QMessageBox>
#include <QFileDialog>
#include <QStyleFactory>
#include <QStyle>
#ifdef HAVE_CONFIG_H
#include "config.h"

@ -19,7 +19,7 @@
#ifndef GENERAL_SETTINGS_PAGE_H
#define GENERAL_SETTINGS_PAGE_H
#include <QtCore/QObject>
#include <QObject>
#include "ioptions_page.h"

@ -22,9 +22,9 @@
#include "core_global.h"
// Qt includes
#include <QtCore/QObject>
#include <QtCore/QString>
#include <QtGui/QIcon>
#include <QObject>
#include <QString>
#include <QIcon>
QT_BEGIN_NAMESPACE
class QWidget;

@ -21,7 +21,7 @@
#include "core_global.h"
#include <QtCore/QObject>
#include <QObject>
QT_BEGIN_NAMESPACE
class QMainWindow;

@ -23,7 +23,7 @@
#include "core_global.h"
// Qt includes
#include <QtCore/QObject>
#include <QObject>
QT_BEGIN_NAMESPACE
class QWidget;

@ -23,7 +23,7 @@
#include "core_global.h"
// Qt includes
#include <QtCore/QObject>
#include <QObject>
QT_BEGIN_NAMESPACE
class QWidget;

@ -29,9 +29,14 @@
#include <nel/misc/debug.h>
// Qt includes
#include <QtCore/QCoreApplication>
#include <QtGui/QUndoView>
#include <QtGui/QtGui>
#include <QCoreApplication>
#include <QUndoView>
#include <QtGui>
#include <QMessageBox>
#include <QDockWidget>
#include <QStatusBar>
#include <QUndoGroup>
#include <QUndoStack>
namespace Core
{

@ -25,9 +25,9 @@
// STL includes
// Qt includes
#include <QtGui/QMainWindow>
#include <QtGui/QUndoGroup>
#include <QtCore/QSettings>
#include <QMainWindow>
#include <QUndoGroup>
#include <QSettings>
namespace Core
{

@ -22,12 +22,12 @@
#include "core_global.h"
// Qt includes
#include <QtCore/QHash>
#include <QtCore/QObject>
#include <QtCore/QList>
#include <QtGui/QMenu>
#include <QtGui/QAction>
#include <QtGui/QMenuBar>
#include <QHash>
#include <QObject>
#include <QList>
#include <QMenu>
#include <QAction>
#include <QMenuBar>
namespace Core
{

@ -21,10 +21,10 @@
#include "nel/misc/debug.h"
// Qt includes
#include <QtCore/QDir>
#include <QtGui/QIcon>
#include <QtGui/QStyle>
#include <QtGui/QTreeWidgetItem>
#include <QDir>
#include <QIcon>
#include <QStyle>
#include <QTreeWidgetItem>
#include <QMessageBox>
#include <QFileDialog>

@ -20,8 +20,8 @@
#include "ui_plugin_view_dialog.h"
#include <QtCore/QMap>
#include <QtCore/QStringList>
#include <QMap>
#include <QStringList>
namespace ExtensionSystem
{

@ -24,9 +24,9 @@
#include <nel/misc/path.h>
// Qt includes
#include <QtCore/QSettings>
#include <QtGui/QWidget>
#include <QtGui/QFileDialog>
#include <QSettings>
#include <QWidget>
#include <QFileDialog>
#if !defined NL_OS_WINDOWS
#include "core_config.h"

@ -19,7 +19,7 @@
#ifndef SEARCH_PATHS_SETTINGS_PAGE_H
#define SEARCH_PATHS_SETTINGS_PAGE_H
#include <QtCore/QObject>
#include <QObject>
#include "ioptions_page.h"

@ -21,8 +21,8 @@
#include "ioptions_page.h"
// Qt includes
#include <QtGui/QHeaderView>
#include <QtGui/QPushButton>
#include <QHeaderView>
#include <QPushButton>
struct PageData
{

@ -22,7 +22,7 @@
#include "ui_settings_dialog.h"
// Qt includes
#include <QtCore/QList>
#include <QList>
// Project includes
#include "../../extension_system/iplugin_manager.h"

Loading…
Cancel
Save