diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 279aa3d49..446a0d19c 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -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) diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index 70113e11b..3862e0a70 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -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 ) diff --git a/code/nel/samples/3d/CMakeLists.txt b/code/nel/samples/3d/CMakeLists.txt index 6cd2e49ef..458adc804 100644 --- a/code/nel/samples/3d/CMakeLists.txt +++ b/code/nel/samples/3d/CMakeLists.txt @@ -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) diff --git a/code/nel/samples/3d/nel_qt/CMakeLists.txt b/code/nel/samples/3d/nel_qt/CMakeLists.txt new file mode 100644 index 000000000..1d2b4f056 --- /dev/null +++ b/code/nel/samples/3d/nel_qt/CMakeLists.txt @@ -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) diff --git a/code/nel/samples/3d/nel_qt/command_log.cpp b/code/nel/samples/3d/nel_qt/command_log.cpp index a1c846efd..556dbcf68 100644 --- a/code/nel/samples/3d/nel_qt/command_log.cpp +++ b/code/nel/samples/3d/nel_qt/command_log.cpp @@ -20,7 +20,7 @@ // STL includes // Qt includes -#include +#include // NeL includes #include @@ -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(); diff --git a/code/nel/samples/3d/nel_qt/command_log.h b/code/nel/samples/3d/nel_qt/command_log.h index d8053eb39..c7e38667c 100644 --- a/code/nel/samples/3d/nel_qt/command_log.h +++ b/code/nel/samples/3d/nel_qt/command_log.h @@ -21,9 +21,9 @@ // STL includes // Qt includes -#include -#include -#include +#include +#include +#include // NeL includes #include diff --git a/code/nel/samples/3d/nel_qt/graphics_config.cpp b/code/nel/samples/3d/nel_qt/graphics_config.cpp index 74e8ad2b4..9100e5728 100644 --- a/code/nel/samples/3d/nel_qt/graphics_config.cpp +++ b/code/nel/samples/3d/nel_qt/graphics_config.cpp @@ -20,9 +20,9 @@ // STL includes // Qt includes -#include -#include -#include +#include +#include +#include // NeL includes // #include diff --git a/code/nel/samples/3d/nel_qt/graphics_config.h b/code/nel/samples/3d/nel_qt/graphics_config.h index 9044ef8a8..3faabc800 100644 --- a/code/nel/samples/3d/nel_qt/graphics_config.h +++ b/code/nel/samples/3d/nel_qt/graphics_config.h @@ -21,13 +21,13 @@ // STL includes // Qt includes -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include // NeL includes #include @@ -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(); } diff --git a/code/nel/samples/3d/nel_qt/graphics_viewport.cpp b/code/nel/samples/3d/nel_qt/graphics_viewport.cpp index 611e0d440..2c94a36bd 100644 --- a/code/nel/samples/3d/nel_qt/graphics_viewport.cpp +++ b/code/nel/samples/3d/nel_qt/graphics_viewport.cpp @@ -20,7 +20,7 @@ // STL includes // Qt includes -#include +#include // NeL includes #include @@ -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)), diff --git a/code/nel/samples/3d/nel_qt/graphics_viewport.h b/code/nel/samples/3d/nel_qt/graphics_viewport.h index 0b9dde03a..ac9fadbc3 100644 --- a/code/nel/samples/3d/nel_qt/graphics_viewport.h +++ b/code/nel/samples/3d/nel_qt/graphics_viewport.h @@ -21,7 +21,7 @@ // STL includes // Qt includes -#include +#include // NeL includes #include diff --git a/code/nel/samples/3d/nel_qt/main_window.cpp b/code/nel/samples/3d/nel_qt/main_window.cpp index bf83e625c..a566723ef 100644 --- a/code/nel/samples/3d/nel_qt/main_window.cpp +++ b/code/nel/samples/3d/nel_qt/main_window.cpp @@ -20,11 +20,20 @@ // STL includes // Qt includes -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // NeL includes // #include @@ -69,10 +78,6 @@ CMainWindow::CMainWindow(const QMap &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 diff --git a/code/nel/samples/3d/nel_qt/main_window.h b/code/nel/samples/3d/nel_qt/main_window.h index dedbf18c7..7fbafa6a6 100644 --- a/code/nel/samples/3d/nel_qt/main_window.h +++ b/code/nel/samples/3d/nel_qt/main_window.h @@ -21,7 +21,7 @@ // STL includes // Qt includes -#include +#include // NeL includes #include @@ -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; diff --git a/code/nel/samples/3d/nel_qt/nel_qt.cpp b/code/nel/samples/3d/nel_qt/nel_qt.cpp index 178943aa8..cd06ee136 100644 --- a/code/nel/samples/3d/nel_qt/nel_qt.cpp +++ b/code/nel/samples/3d/nel_qt/nel_qt.cpp @@ -26,9 +26,10 @@ #endif // Qt includes -#include +#include #include #include +#include // NeL includes #include @@ -36,6 +37,7 @@ #include #include #include +#include // 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(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 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; } diff --git a/code/nel/samples/3d/nel_qt/qtcolorpicker.h b/code/nel/samples/3d/nel_qt/qtcolorpicker.h index 9363cd0cc..446abbdcb 100644 --- a/code/nel/samples/3d/nel_qt/qtcolorpicker.h +++ b/code/nel/samples/3d/nel_qt/qtcolorpicker.h @@ -46,13 +46,13 @@ #ifndef QTCOLORPICKER_H #define QTCOLORPICKER_H -#include +#include #include -#include +#include -#include +#include #include -#include +#include #define QT_QTCOLORPICKER_EXPORT diff --git a/code/nel/samples/3d/nel_qt/qtcolorpicker_cpp.h b/code/nel/samples/3d/nel_qt/qtcolorpicker_cpp.h index 2386ff939..b45f22816 100644 --- a/code/nel/samples/3d/nel_qt/qtcolorpicker_cpp.h +++ b/code/nel/samples/3d/nel_qt/qtcolorpicker_cpp.h @@ -44,24 +44,24 @@ ** ****************************************************************************/ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include "qtcolorpicker.h" diff --git a/code/nel/samples/3d/nel_qt/undo_redo_binders.cpp b/code/nel/samples/3d/nel_qt/undo_redo_binders.cpp index 52bd2c02a..2b955825d 100644 --- a/code/nel/samples/3d/nel_qt/undo_redo_binders.cpp +++ b/code/nel/samples/3d/nel_qt/undo_redo_binders.cpp @@ -20,10 +20,10 @@ // STL includes // Qt includes -#include -#include -#include -#include +#include +#include +#include +#include // NeL includes #include diff --git a/code/nel/samples/3d/nel_qt/undo_redo_binders.h b/code/nel/samples/3d/nel_qt/undo_redo_binders.h index 2a3d4afa0..12fc29f67 100644 --- a/code/nel/samples/3d/nel_qt/undo_redo_binders.h +++ b/code/nel/samples/3d/nel_qt/undo_redo_binders.h @@ -23,8 +23,8 @@ // Qt includes #include #include -#include -#include +#include +#include // NeL includes diff --git a/code/nel/tools/3d/CMakeLists.txt b/code/nel/tools/3d/CMakeLists.txt index cb709ffaa..3c6c4f3ff 100644 --- a/code/nel/tools/3d/CMakeLists.txt +++ b/code/nel/tools/3d/CMakeLists.txt @@ -61,6 +61,10 @@ IF(WITH_NEL_TOOLS AND WITH_3D) ADD_SUBDIRECTORY(tile_edit_qt) ADD_SUBDIRECTORY(object_viewer_widget) ENDIF(WITH_QT) + + IF(WITH_QT5) + ADD_SUBDIRECTORY(panoply_preview) + ENDIF() IF(SQUISH_FOUND) ADD_SUBDIRECTORY(s3tc_compressor_lib) diff --git a/code/nel/tools/3d/panoply_preview/CMakeLists.txt b/code/nel/tools/3d/panoply_preview/CMakeLists.txt new file mode 100644 index 000000000..48dac7e01 --- /dev/null +++ b/code/nel/tools/3d/panoply_preview/CMakeLists.txt @@ -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) diff --git a/code/nel/tools/3d/panoply_preview/command_log.cpp b/code/nel/tools/3d/panoply_preview/command_log.cpp new file mode 100644 index 000000000..8a530f7f9 --- /dev/null +++ b/code/nel/tools/3d/panoply_preview/command_log.cpp @@ -0,0 +1,195 @@ +// NeL - MMORPG Framework +// 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 . + +#include +#include "command_log.h" + +// STL includes + +// Qt includes +#include + +// NeL includes +#include +#include +#include + +// 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(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(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 */ diff --git a/code/nel/tools/3d/panoply_preview/command_log.h b/code/nel/tools/3d/panoply_preview/command_log.h new file mode 100644 index 000000000..a8d1521b7 --- /dev/null +++ b/code/nel/tools/3d/panoply_preview/command_log.h @@ -0,0 +1,74 @@ +// NeL - MMORPG Framework +// 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 . + +#ifndef NLTOOLS_COMMAND_LOG_H +#define NLTOOLS_COMMAND_LOG_H +#include + +// STL includes + +// Qt includes +#include +#include +#include + +// NeL includes +#include +#include + +// 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 */ diff --git a/code/nel/tools/3d/panoply_preview/greenpill.ico b/code/nel/tools/3d/panoply_preview/greenpill.ico new file mode 100644 index 000000000..d2b9e8a20 Binary files /dev/null and b/code/nel/tools/3d/panoply_preview/greenpill.ico differ diff --git a/code/nel/tools/3d/panoply_preview/icon.rc b/code/nel/tools/3d/panoply_preview/icon.rc new file mode 100644 index 000000000..64e741cac --- /dev/null +++ b/code/nel/tools/3d/panoply_preview/icon.rc @@ -0,0 +1 @@ +IDI_ICON1 ICON DISCARDABLE "greenpill.ico" \ No newline at end of file diff --git a/code/nel/tools/3d/panoply_preview/main_window.cpp b/code/nel/tools/3d/panoply_preview/main_window.cpp new file mode 100644 index 000000000..b04cd36bb --- /dev/null +++ b/code/nel/tools/3d/panoply_preview/main_window.cpp @@ -0,0 +1,138 @@ +// NeL - MMORPG Framework +// 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 . + +#include +#include "main_window.h" + +// STL includes + +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// NeL includes +// #include +#include +#include + +// 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 &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 */ diff --git a/code/nel/tools/3d/panoply_preview/main_window.h b/code/nel/tools/3d/panoply_preview/main_window.h new file mode 100644 index 000000000..7bf96388a --- /dev/null +++ b/code/nel/tools/3d/panoply_preview/main_window.h @@ -0,0 +1,92 @@ +// NeL - MMORPG Framework +// 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 . + +#ifndef NLTOOLS_MAIN_WINDOW_H +#define NLTOOLS_MAIN_WINDOW_H +#include + +// STL includes + +// Qt includes +#include + +// NeL includes +#include +#include +#include +#include +#include + +// 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 &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 */ diff --git a/code/nel/tools/3d/panoply_preview/panoply_preview.cpp b/code/nel/tools/3d/panoply_preview/panoply_preview.cpp new file mode 100644 index 000000000..964711eea --- /dev/null +++ b/code/nel/tools/3d/panoply_preview/panoply_preview.cpp @@ -0,0 +1,523 @@ +// NeL - MMORPG Framework +// 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 . + +#include +#include "panoply_preview.h" + +// STL includes + +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// NeL includes +#include +#include +#include +#include +#include +#include +#include + +// 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 */ diff --git a/code/nel/tools/3d/panoply_preview/panoply_preview.h b/code/nel/tools/3d/panoply_preview/panoply_preview.h new file mode 100644 index 000000000..9fbe2bad3 --- /dev/null +++ b/code/nel/tools/3d/panoply_preview/panoply_preview.h @@ -0,0 +1,125 @@ +// NeL - MMORPG Framework +// 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 . + +#ifndef NLTOOLS_PANOPLY_PREVIEW_H +#define NLTOOLS_PANOPLY_PREVIEW_H +#include + +// STL includes + +// Qt includes +#include +#include +#include +#include +#include +#include + +// NeL includes +#include +#include + +// 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 */ diff --git a/code/nel/tools/3d/panoply_preview/tool_config.h b/code/nel/tools/3d/panoply_preview/tool_config.h new file mode 100644 index 000000000..94e53d2dc --- /dev/null +++ b/code/nel/tools/3d/panoply_preview/tool_config.h @@ -0,0 +1,105 @@ +// NeL - MMORPG Framework +// 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 . + +#ifndef NLTOOLS_CONFIG_H +#define NLTOOLS_CONFIG_H +#include + + + +// 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 */ diff --git a/code/nel/tools/3d/panoply_preview/tool_main.cpp b/code/nel/tools/3d/panoply_preview/tool_main.cpp new file mode 100644 index 000000000..d9b85efe7 --- /dev/null +++ b/code/nel/tools/3d/panoply_preview/tool_main.cpp @@ -0,0 +1,189 @@ +// NeL - MMORPG Framework +// 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 . + +#include +#include "tool_main.h" + +// STL includes +#include +#ifdef NL_OS_WINDOWS +# include +# include +# include +#endif + +// Qt includes +#include +#include +#include +#include + +// NeL includes +#include +#include +#include +#include +#include +#include + +// 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 x] ..."; + exit(1); +} + +QMap parseCustomSizeHints(int argc, char **argv) +{ + /* from Qt sample */ + + QMap 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(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 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 */ diff --git a/code/nel/tools/3d/panoply_preview/tool_main.h b/code/nel/tools/3d/panoply_preview/tool_main.h new file mode 100644 index 000000000..75eae7204 --- /dev/null +++ b/code/nel/tools/3d/panoply_preview/tool_main.h @@ -0,0 +1,33 @@ +// NeL - MMORPG Framework +// 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 . + +#ifndef NLTOOLS_MAIN_H +#define NLTOOLS_MAIN_H +#include + +// STL includes + +// NeL includes + +// Project includes + +namespace NLTOOLS { + +} /* namespace NLTOOLS */ + +#endif /* #ifndef NLTOOLS_MAIN_H */ + +/* end of file */ diff --git a/code/studio/src/3rdparty/qtpropertybrowser/CMakeLists.txt b/code/studio/src/3rdparty/qtpropertybrowser/CMakeLists.txt index fa834dabf..49e8aafe1 100644 --- a/code/studio/src/3rdparty/qtpropertybrowser/CMakeLists.txt +++ b/code/studio/src/3rdparty/qtpropertybrowser/CMakeLists.txt @@ -1,5 +1,8 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${QT_INCLUDES}) -INCLUDE(${QT_USE_FILE}) + +IF(WITH_QT) + INCLUDE(${QT_USE_FILE}) +ENDIF(WITH_QT) FILE(GLOB SRC *.cpp *.h) @@ -16,34 +19,44 @@ SET(QT_PROPERTY_EDITOR_RCS qtpropertybrowser.qrc) SET(QT_USE_QTGUI TRUE) -QT4_ADD_RESOURCES(QT_PROPERTY_EDITOR_RC_SRCS ${QT_PROPERTY_EDITOR_RCS}) -QT4_WRAP_CPP(QT_PROPERTY_EDITOR_MOC_SRC ${QT_PROPERTY_EDITOR_HDR}) +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}) -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 - ${CMAKE_CURRENT_BINARY_DIR}/moc_qteditorfactory.cxx - ${CMAKE_CURRENT_BINARY_DIR}/moc_qtgroupboxpropertybrowser.cxx - ${CMAKE_CURRENT_BINARY_DIR}/moc_qtpropertybrowser.cxx - ${CMAKE_CURRENT_BINARY_DIR}/moc_qtpropertymanager.cxx - ${CMAKE_CURRENT_BINARY_DIR}/moc_qttreepropertybrowser.cxx - ${CMAKE_CURRENT_BINARY_DIR}/moc_qtvariantproperty.cxx) - -# We need to add new depencencies on removed files because we need them to be still generated -SET_PROPERTY(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/qtbuttonpropertybrowser.cpp APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/moc_qtbuttonpropertybrowser.cxx) -SET_PROPERTY(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/qteditorfactory.cpp APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/moc_qteditorfactory.cxx) -SET_PROPERTY(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/qtgroupboxpropertybrowser.cpp APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/moc_qtgroupboxpropertybrowser.cxx) -SET_PROPERTY(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/qtpropertybrowser.cpp APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/moc_qtpropertybrowser.cxx) -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) +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 + ${CMAKE_CURRENT_BINARY_DIR}/moc_qteditorfactory.cxx + ${CMAKE_CURRENT_BINARY_DIR}/moc_qtgroupboxpropertybrowser.cxx + ${CMAKE_CURRENT_BINARY_DIR}/moc_qtpropertybrowser.cxx + ${CMAKE_CURRENT_BINARY_DIR}/moc_qtpropertymanager.cxx + ${CMAKE_CURRENT_BINARY_DIR}/moc_qttreepropertybrowser.cxx + ${CMAKE_CURRENT_BINARY_DIR}/moc_qtvariantproperty.cxx) + + # We need to add new depencencies on removed files because we need them to be still generated + SET_PROPERTY(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/qtbuttonpropertybrowser.cpp APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/moc_qtbuttonpropertybrowser.cxx) + SET_PROPERTY(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/qteditorfactory.cpp APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/moc_qteditorfactory.cxx) + SET_PROPERTY(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/qtgroupboxpropertybrowser.cpp APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/moc_qtgroupboxpropertybrowser.cxx) + SET_PROPERTY(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/qtpropertybrowser.cpp APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/moc_qtpropertybrowser.cxx) + 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} - ${QT_PROPERTY_EDITOR_MOC_SRC} - ${QT_PROPERTY_EDITOR_RC_SRCS} - ${CMAKE_CURRENT_BINARY_DIR}/qtpropertymanager.moc - ${CMAKE_CURRENT_BINARY_DIR}/qttreepropertybrowser.moc - ${CMAKE_CURRENT_BINARY_DIR}/qteditorfactory.moc) - -TARGET_LINK_LIBRARIES(qt_property_browser ${QT_LIBRARIES}) +INCLUDE_DIRECTORIES(${QT_INCLUDES}) + +IF(WITH_QT5) + ADD_LIBRARY(qt_property_browser SHARED + ${SRC} + ${QT_PROPERTY_EDITOR_MOC_SRC} + ${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) diff --git a/code/studio/src/3rdparty/qtpropertybrowser/qtbuttonpropertybrowser.cpp b/code/studio/src/3rdparty/qtpropertybrowser/qtbuttonpropertybrowser.cpp index d5ebd4fc2..60895721e 100644 --- a/code/studio/src/3rdparty/qtpropertybrowser/qtbuttonpropertybrowser.cpp +++ b/code/studio/src/3rdparty/qtpropertybrowser/qtbuttonpropertybrowser.cpp @@ -86,69 +86,18 @@ ****************************************************************************/ #include "qtbuttonpropertybrowser.h" -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #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 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 m_indexToItem; - QMap m_itemToIndex; - QMap m_widgetToItem; - QMap m_buttonToItem; - QGridLayout *m_mainLayout; - QList m_children; - QList 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" diff --git a/code/studio/src/3rdparty/qtpropertybrowser/qtbuttonpropertybrowser.h b/code/studio/src/3rdparty/qtpropertybrowser/qtbuttonpropertybrowser.h index 518e047e8..6b684519f 100644 --- a/code/studio/src/3rdparty/qtpropertybrowser/qtbuttonpropertybrowser.h +++ b/code/studio/src/3rdparty/qtpropertybrowser/qtbuttonpropertybrowser.h @@ -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 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 m_indexToItem; + QMap m_itemToIndex; + QMap m_widgetToItem; + QMap m_buttonToItem; + QGridLayout *m_mainLayout; + QList m_children; + QList m_recreateQueue; +}; + #if QT_VERSION >= 0x040400 QT_END_NAMESPACE #endif diff --git a/code/studio/src/3rdparty/qtpropertybrowser/qteditorfactory.cpp b/code/studio/src/3rdparty/qtpropertybrowser/qteditorfactory.cpp index 2c45b77be..3d054fae7 100644 --- a/code/studio/src/3rdparty/qtpropertybrowser/qteditorfactory.cpp +++ b/code/studio/src/3rdparty/qtpropertybrowser/qteditorfactory.cpp @@ -87,29 +87,29 @@ #include "qteditorfactory.h" #include "qtpropertybrowserutils_p.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include -#include -#include -#include +#include +#include +#include #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 EditorFactoryPrivate -{ -public: - - typedef QList EditorList; - typedef QMap PropertyToEditorListMap; - typedef QMap EditorToPropertyMap; - - Editor *createEditor(QtProperty *property, QWidget *parent); - void initializeEditor(QtProperty *property, Editor *e); - void slotEditorDestroyed(QObject *object); - - PropertyToEditorListMap m_createdEditors; - EditorToPropertyMap m_editorToProperty; -}; - -template -Editor *EditorFactoryPrivate::createEditor(QtProperty *property, QWidget *parent) -{ - Editor *editor = new Editor(parent); - initializeEditor(property, editor); - return editor; -} - -template -void EditorFactoryPrivate::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 -void EditorFactoryPrivate::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 -{ - 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 -{ - 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 -{ - 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 -{ - 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 -{ - 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 editors = m_createdEditors[property]; @@ -969,18 +857,6 @@ void QtDoubleSpinBoxFactory::disconnectPropertyManager(QtDoublePropertyManager * // QtLineEditFactory -class QtLineEditFactoryPrivate : public EditorFactoryPrivate -{ - QtLineEditFactory *q_ptr; - Q_DECLARE_PUBLIC(QtLineEditFactory) -public: - - void slotPropertyChanged(QtProperty *property, const QString &value); - void slotRegExpChanged(QtProperty *property, const QRegExp ®Exp); - 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 -{ - 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 -{ - 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 -{ - 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 -{ - 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 -{ - 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 -{ - 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 &); - 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 m_propertyToEnum; - QMap m_enumToProperty; - QMap > m_enumToEditors; - QMap 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 -{ - 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 -{ - 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 -{ - 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" diff --git a/code/studio/src/3rdparty/qtpropertybrowser/qteditorfactory.h b/code/studio/src/3rdparty/qtpropertybrowser/qteditorfactory.h index fe47d5f16..54bd9b140 100644 --- a/code/studio/src/3rdparty/qtpropertybrowser/qteditorfactory.h +++ b/code/studio/src/3rdparty/qtpropertybrowser/qteditorfactory.h @@ -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 EditorFactoryPrivate +{ +public: + + typedef QList EditorList; + typedef QMap PropertyToEditorListMap; + typedef QMap EditorToPropertyMap; + + Editor *createEditor(QtProperty *property, QWidget *parent); + void initializeEditor(QtProperty *property, Editor *e); + void slotEditorDestroyed(QObject *object); + + PropertyToEditorListMap m_createdEditors; + EditorToPropertyMap m_editorToProperty; +}; + +template +Editor *EditorFactoryPrivate::createEditor(QtProperty *property, QWidget *parent) +{ + Editor *editor = new Editor(parent); + initializeEditor(property, editor); + return editor; +} + +template +void EditorFactoryPrivate::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 +void EditorFactoryPrivate::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 +{ + 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 +{ + 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 +{ + 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 +{ + QtCheckBoxFactory *q_ptr; + Q_DECLARE_PUBLIC(QtCheckBoxFactory) +public: + void slotPropertyChanged(QtProperty *property, bool value); + void slotSetValue(bool value); + void slotResetProperty(); +}; + +class QtDoubleSpinBoxFactoryPrivate : public EditorFactoryPrivate +{ + 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 +{ + QtLineEditFactory *q_ptr; + Q_DECLARE_PUBLIC(QtLineEditFactory) +public: + + void slotPropertyChanged(QtProperty *property, const QString &value); + void slotRegExpChanged(QtProperty *property, const QRegExp ®Exp); + void slotSetValue(const QString &value); + void slotEditingFinished(); +}; + +class QtDateEditFactoryPrivate : public EditorFactoryPrivate +{ + 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 +{ + QtTimeEditFactory *q_ptr; + Q_DECLARE_PUBLIC(QtTimeEditFactory) +public: + + void slotPropertyChanged(QtProperty *property, const QTime &value); + void slotSetValue(const QTime &value); +}; + +class QtDateTimeEditFactoryPrivate : public EditorFactoryPrivate +{ + QtDateTimeEditFactory *q_ptr; + Q_DECLARE_PUBLIC(QtDateTimeEditFactory) +public: + + void slotPropertyChanged(QtProperty *property, const QDateTime &value); + void slotSetValue(const QDateTime &value); + +}; + +class QtKeySequenceEditorFactoryPrivate : public EditorFactoryPrivate +{ + 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 +{ + 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 +{ + 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 &); + 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 m_propertyToEnum; + QMap m_enumToProperty; + QMap > m_enumToEditors; + QMap 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 +{ + 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 +{ + 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 +{ + 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 diff --git a/code/studio/src/3rdparty/qtpropertybrowser/qtgroupboxpropertybrowser.cpp b/code/studio/src/3rdparty/qtpropertybrowser/qtgroupboxpropertybrowser.cpp index d789c8695..fb67ddc78 100644 --- a/code/studio/src/3rdparty/qtpropertybrowser/qtgroupboxpropertybrowser.cpp +++ b/code/studio/src/3rdparty/qtpropertybrowser/qtgroupboxpropertybrowser.cpp @@ -86,63 +86,17 @@ ****************************************************************************/ #include "qtgroupboxpropertybrowser.h" -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #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 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 m_indexToItem; - QMap m_itemToIndex; - QMap m_widgetToItem; - QGridLayout *m_mainLayout; - QList m_children; - QList 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" diff --git a/code/studio/src/3rdparty/qtpropertybrowser/qtgroupboxpropertybrowser.h b/code/studio/src/3rdparty/qtpropertybrowser/qtgroupboxpropertybrowser.h index 075f3286e..d9ba9632c 100644 --- a/code/studio/src/3rdparty/qtpropertybrowser/qtgroupboxpropertybrowser.h +++ b/code/studio/src/3rdparty/qtpropertybrowser/qtgroupboxpropertybrowser.h @@ -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 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 m_indexToItem; + QMap m_itemToIndex; + QMap m_widgetToItem; + QGridLayout *m_mainLayout; + QList m_children; + QList m_recreateQueue; +}; + #if QT_VERSION >= 0x040400 QT_END_NAMESPACE #endif diff --git a/code/studio/src/3rdparty/qtpropertybrowser/qtpropertybrowser.cpp b/code/studio/src/3rdparty/qtpropertybrowser/qtpropertybrowser.cpp index 9b7d98b09..45da766f1 100644 --- a/code/studio/src/3rdparty/qtpropertybrowser/qtpropertybrowser.cpp +++ b/code/studio/src/3rdparty/qtpropertybrowser/qtpropertybrowser.cpp @@ -86,9 +86,9 @@ ****************************************************************************/ #include "qtpropertybrowser.h" -#include -#include -#include +#include +#include +#include #if defined(Q_CC_MSVC) # pragma warning(disable: 4786) /* MS VS 6: truncating debug info after 255 characters */ @@ -1258,40 +1258,6 @@ typedef QMap m_subItems; - QMap > m_managerToProperties; - QMap > m_propertyToParents; - - QMap m_topLevelPropertyToIndex; - QList m_topLevelIndexes; - QMap > 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" diff --git a/code/studio/src/3rdparty/qtpropertybrowser/qtpropertybrowser.h b/code/studio/src/3rdparty/qtpropertybrowser/qtpropertybrowser.h index 5b63d3917..0b87b6ada 100644 --- a/code/studio/src/3rdparty/qtpropertybrowser/qtpropertybrowser.h +++ b/code/studio/src/3rdparty/qtpropertybrowser/qtpropertybrowser.h @@ -88,8 +88,21 @@ #ifndef QTPROPERTYBROWSER_H #define QTPROPERTYBROWSER_H -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #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 m_subItems; + QMap > m_managerToProperties; + QMap > m_propertyToParents; + + QMap m_topLevelPropertyToIndex; + QList m_topLevelIndexes; + QMap > m_propertyToIndexes; + + QtBrowserItem *m_currentItem; +}; + #if QT_VERSION >= 0x040400 QT_END_NAMESPACE #endif diff --git a/code/studio/src/3rdparty/qtpropertybrowser/qtpropertybrowserutils.cpp b/code/studio/src/3rdparty/qtpropertybrowser/qtpropertybrowserutils.cpp index 9b482a569..ad0161f01 100644 --- a/code/studio/src/3rdparty/qtpropertybrowser/qtpropertybrowserutils.cpp +++ b/code/studio/src/3rdparty/qtpropertybrowser/qtpropertybrowserutils.cpp @@ -86,14 +86,14 @@ ****************************************************************************/ #include "qtpropertybrowserutils_p.h" -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #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()); } diff --git a/code/studio/src/3rdparty/qtpropertybrowser/qtpropertybrowserutils_p.h b/code/studio/src/3rdparty/qtpropertybrowser/qtpropertybrowserutils_p.h index 66156c5d4..ae6ac8934 100644 --- a/code/studio/src/3rdparty/qtpropertybrowser/qtpropertybrowserutils_p.h +++ b/code/studio/src/3rdparty/qtpropertybrowser/qtpropertybrowserutils_p.h @@ -99,10 +99,10 @@ #ifndef QTPROPERTYBROWSERUTILS_H #define QTPROPERTYBROWSERUTILS_H -#include -#include -#include -#include +#include +#include +#include +#include #if QT_VERSION >= 0x040400 QT_BEGIN_NAMESPACE diff --git a/code/studio/src/3rdparty/qtpropertybrowser/qtpropertymanager.cpp b/code/studio/src/3rdparty/qtpropertybrowser/qtpropertymanager.cpp index fe8ea92c9..91be479a8 100644 --- a/code/studio/src/3rdparty/qtpropertybrowser/qtpropertymanager.cpp +++ b/code/studio/src/3rdparty/qtpropertybrowser/qtpropertymanager.cpp @@ -87,18 +87,18 @@ #include "qtpropertymanager.h" #include "qtpropertybrowserutils_p.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -134,36 +134,6 @@ static void setSimpleMaximumData(PrivateData *data, const Value &maxVal) data->val = data->maxVal; } -template -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 -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 static SizeValue qBoundSize(const SizeValue &minVal, const SizeValue &val, const SizeValue &maxVal) { @@ -239,7 +209,7 @@ static Value getData(const QMap &propertyMap, const QtProperty *property, const Value &defaultValue = Value()) { typedef QMap 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 &propertyMap, QtProperty *property, const Value &val) { typedef QMap 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 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 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 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 PropertyValueMap; - PropertyValueMap m_values; - - QtEnumPropertyManager *m_enumPropertyManager; - - QMap m_propertyToLanguage; - QMap m_propertyToCountry; - - QMap m_languageToProperty; - QMap 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 PropertyValueMap; - PropertyValueMap m_values; - - QtIntPropertyManager *m_intPropertyManager; - - QMap m_propertyToX; - QMap m_propertyToY; - - QMap m_xToProperty; - QMap 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 PropertyValueMap; - PropertyValueMap m_values; - - QtDoublePropertyManager *m_doublePropertyManager; - - QMap m_propertyToX; - QMap m_propertyToY; - - QMap m_xToProperty; - QMap 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 PropertyValueMap; - PropertyValueMap m_values; - - QtIntPropertyManager *m_intPropertyManager; - - QMap m_propertyToW; - QMap m_propertyToH; - - QMap m_wToProperty; - QMap 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 PropertyValueMap; - PropertyValueMap m_values; - - QtDoublePropertyManager *m_doublePropertyManager; - - QMap m_propertyToW; - QMap m_propertyToH; - - QMap m_wToProperty; - QMap 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 PropertyValueMap; - PropertyValueMap m_values; - - QtIntPropertyManager *m_intPropertyManager; - - QMap m_propertyToX; - QMap m_propertyToY; - QMap m_propertyToW; - QMap m_propertyToH; - - QMap m_xToProperty; - QMap m_yToProperty; - QMap m_wToProperty; - QMap 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 PropertyValueMap; - PropertyValueMap m_values; - - QtDoublePropertyManager *m_doublePropertyManager; - - QMap m_propertyToX; - QMap m_propertyToY; - QMap m_propertyToW; - QMap m_propertyToH; - - QMap m_xToProperty; - QMap m_yToProperty; - QMap m_wToProperty; - QMap 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 enumIcons; - }; - - typedef QMap 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 PropertyValueMap; - PropertyValueMap m_values; - - QtBoolPropertyManager *m_boolPropertyManager; - - QMap > m_propertyToFlags; - - QMap 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 PropertyValueMap; - PropertyValueMap m_values; - - QtIntPropertyManager *m_intPropertyManager; - QtEnumPropertyManager *m_enumPropertyManager; - - QMap m_propertyToHPolicy; - QMap m_propertyToVPolicy; - QMap m_propertyToHStretch; - QMap m_propertyToVStretch; - - QMap m_hPolicyToProperty; - QMap m_vPolicyToProperty; - QMap m_hStretchToProperty; - QMap 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 PropertyValueMap; - PropertyValueMap m_values; - - QtIntPropertyManager *m_intPropertyManager; - QtEnumPropertyManager *m_enumPropertyManager; - QtBoolPropertyManager *m_boolPropertyManager; - - QMap m_propertyToFamily; - QMap m_propertyToPointSize; - QMap m_propertyToBold; - QMap m_propertyToItalic; - QMap m_propertyToUnderline; - QMap m_propertyToStrikeOut; - QMap m_propertyToKerning; - - QMap m_familyToProperty; - QMap m_pointSizeToProperty; - QMap m_boldToProperty; - QMap m_italicToProperty; - QMap m_underlineToProperty; - QMap m_strikeOutToProperty; - QMap 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 PropertyValueMap; - PropertyValueMap m_values; - - QtIntPropertyManager *m_intPropertyManager; - - QMap m_propertyToR; - QMap m_propertyToG; - QMap m_propertyToB; - QMap m_propertyToA; - - QMap m_rToProperty; - QMap m_gToProperty; - QMap m_bToProperty; - QMap 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 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" diff --git a/code/studio/src/3rdparty/qtpropertybrowser/qtpropertymanager.h b/code/studio/src/3rdparty/qtpropertybrowser/qtpropertymanager.h index a19dd6e03..e25c1e1fe 100644 --- a/code/studio/src/3rdparty/qtpropertybrowser/qtpropertymanager.h +++ b/code/studio/src/3rdparty/qtpropertybrowser/qtpropertymanager.h @@ -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 PropertyValueMap; + PropertyValueMap m_values; + + QtEnumPropertyManager *m_enumPropertyManager; + + QMap m_propertyToLanguage; + QMap m_propertyToCountry; + + QMap m_languageToProperty; + QMap m_countryToProperty; +}; + +class QtPointPropertyManagerPrivate +{ + QtPointPropertyManager *q_ptr; + Q_DECLARE_PUBLIC(QtPointPropertyManager) +public: + + void slotIntChanged(QtProperty *property, int value); + void slotPropertyDestroyed(QtProperty *property); + + typedef QMap PropertyValueMap; + PropertyValueMap m_values; + + QtIntPropertyManager *m_intPropertyManager; + + QMap m_propertyToX; + QMap m_propertyToY; + + QMap m_xToProperty; + QMap 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 PropertyValueMap; + PropertyValueMap m_values; + + QtDoublePropertyManager *m_doublePropertyManager; + + QMap m_propertyToX; + QMap m_propertyToY; + + QMap m_xToProperty; + QMap m_yToProperty; +}; + +template +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 +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 PropertyValueMap; + PropertyValueMap m_values; + + QtIntPropertyManager *m_intPropertyManager; + + QMap m_propertyToW; + QMap m_propertyToH; + + QMap m_wToProperty; + QMap 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 PropertyValueMap; + PropertyValueMap m_values; + + QtDoublePropertyManager *m_doublePropertyManager; + + QMap m_propertyToW; + QMap m_propertyToH; + + QMap m_wToProperty; + QMap 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 PropertyValueMap; + PropertyValueMap m_values; + + QtIntPropertyManager *m_intPropertyManager; + + QMap m_propertyToX; + QMap m_propertyToY; + QMap m_propertyToW; + QMap m_propertyToH; + + QMap m_xToProperty; + QMap m_yToProperty; + QMap m_wToProperty; + QMap 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 PropertyValueMap; + PropertyValueMap m_values; + + QtDoublePropertyManager *m_doublePropertyManager; + + QMap m_propertyToX; + QMap m_propertyToY; + QMap m_propertyToW; + QMap m_propertyToH; + + QMap m_xToProperty; + QMap m_yToProperty; + QMap m_wToProperty; + QMap m_hToProperty; +}; + +class QtEnumPropertyManagerPrivate +{ + QtEnumPropertyManager *q_ptr; + Q_DECLARE_PUBLIC(QtEnumPropertyManager) +public: + + struct Data + { + Data() : val(-1) {} + int val; + QStringList enumNames; + QMap enumIcons; + }; + + typedef QMap 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 PropertyValueMap; + PropertyValueMap m_values; + + QtBoolPropertyManager *m_boolPropertyManager; + + QMap > m_propertyToFlags; + + QMap 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 PropertyValueMap; + PropertyValueMap m_values; + + QtIntPropertyManager *m_intPropertyManager; + QtEnumPropertyManager *m_enumPropertyManager; + + QMap m_propertyToHPolicy; + QMap m_propertyToVPolicy; + QMap m_propertyToHStretch; + QMap m_propertyToVStretch; + + QMap m_hPolicyToProperty; + QMap m_vPolicyToProperty; + QMap m_hStretchToProperty; + QMap 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 PropertyValueMap; + PropertyValueMap m_values; + + QtIntPropertyManager *m_intPropertyManager; + QtEnumPropertyManager *m_enumPropertyManager; + QtBoolPropertyManager *m_boolPropertyManager; + + QMap m_propertyToFamily; + QMap m_propertyToPointSize; + QMap m_propertyToBold; + QMap m_propertyToItalic; + QMap m_propertyToUnderline; + QMap m_propertyToStrikeOut; + QMap m_propertyToKerning; + + QMap m_familyToProperty; + QMap m_pointSizeToProperty; + QMap m_boldToProperty; + QMap m_italicToProperty; + QMap m_underlineToProperty; + QMap m_strikeOutToProperty; + QMap 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 PropertyValueMap; + PropertyValueMap m_values; + + QtIntPropertyManager *m_intPropertyManager; + + QMap m_propertyToR; + QMap m_propertyToG; + QMap m_propertyToB; + QMap m_propertyToA; + + QMap m_rToProperty; + QMap m_gToProperty; + QMap m_bToProperty; + QMap m_aToProperty; +}; + +class QtCursorPropertyManagerPrivate +{ + QtCursorPropertyManager *q_ptr; + Q_DECLARE_PUBLIC(QtCursorPropertyManager) +public: + typedef QMap PropertyValueMap; + PropertyValueMap m_values; +}; + #if QT_VERSION >= 0x040400 QT_END_NAMESPACE #endif diff --git a/code/studio/src/3rdparty/qtpropertybrowser/qttreepropertybrowser.cpp b/code/studio/src/3rdparty/qtpropertybrowser/qttreepropertybrowser.cpp index eb9b37515..616211a2e 100644 --- a/code/studio/src/3rdparty/qtpropertybrowser/qttreepropertybrowser.cpp +++ b/code/studio/src/3rdparty/qtpropertybrowser/qttreepropertybrowser.cpp @@ -86,17 +86,17 @@ ****************************************************************************/ #include "qttreepropertybrowser.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #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 m_indexToItem; - QMap m_itemToIndex; - - QMap 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" diff --git a/code/studio/src/3rdparty/qtpropertybrowser/qttreepropertybrowser.h b/code/studio/src/3rdparty/qtpropertybrowser/qttreepropertybrowser.h index f664609d7..287c8207f 100644 --- a/code/studio/src/3rdparty/qtpropertybrowser/qttreepropertybrowser.h +++ b/code/studio/src/3rdparty/qtpropertybrowser/qttreepropertybrowser.h @@ -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 m_indexToItem; + QMap m_itemToIndex; + + QMap 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 diff --git a/code/studio/src/3rdparty/qtpropertybrowser/qtvariantproperty.cpp b/code/studio/src/3rdparty/qtpropertybrowser/qtvariantproperty.cpp index 820e6e2f1..0106419df 100644 --- a/code/studio/src/3rdparty/qtpropertybrowser/qtvariantproperty.cpp +++ b/code/studio/src/3rdparty/qtpropertybrowser/qtvariantproperty.cpp @@ -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$ ** ****************************************************************************/ @@ -88,18 +42,16 @@ #include "qtvariantproperty.h" #include "qtpropertymanager.h" #include "qteditorfactory.h" -#include -#include -#include -#include +#include +#include +#include +#include #if defined(Q_CC_MSVC) # pragma warning(disable: 4786) /* MS VS 6: truncating debug info after 255 characters */ #endif -#if QT_VERSION >= 0x040400 QT_BEGIN_NAMESPACE -#endif class QtEnumPropertyType { @@ -115,17 +67,13 @@ class QtGroupPropertyType { }; -#if QT_VERSION >= 0x040400 QT_END_NAMESPACE -#endif Q_DECLARE_METATYPE(QtEnumPropertyType) Q_DECLARE_METATYPE(QtFlagPropertyType) Q_DECLARE_METATYPE(QtGroupPropertyType) -#if QT_VERSION >= 0x040400 QT_BEGIN_NAMESPACE -#endif /*! Returns the type id for an enum property. @@ -192,7 +140,6 @@ static QtProperty *wrappedProperty(QtProperty *property) class QtVariantPropertyPrivate { - QtVariantProperty *q_ptr; public: QtVariantPropertyPrivate(QtVariantPropertyManager *m) : manager(m) {} @@ -201,6 +148,9 @@ public: /*! \class QtVariantProperty + \internal + \inmodule QtDesigner + \since 4.4 \brief The QtVariantProperty class is a convenience class handling QVariant based properties. @@ -214,21 +164,11 @@ public: For example, instead of writing: - \code - QtVariantPropertyManager *variantPropertyManager; - QtProperty *property; - - variantPropertyManager->setValue(property, 10); - \endcode + \snippet doc/src/snippets/code/tools_shared_qtpropertybrowser_qtvariantproperty.cpp 0 you can write: - \code - QtVariantPropertyManager *variantPropertyManager; - QtVariantProperty *property; - - property->setValue(10); - \endcode + \snippet doc/src/snippets/code/tools_shared_qtpropertybrowser_qtvariantproperty.cpp 1 QtVariantProperty instances can only be created by the QtVariantPropertyManager class. @@ -247,9 +187,8 @@ public: \sa QtVariantPropertyManager */ QtVariantProperty::QtVariantProperty(QtVariantPropertyManager *manager) - : QtProperty(manager), d_ptr(new QtVariantPropertyPrivate(manager)) + : QtProperty(manager), d_ptr(new QtVariantPropertyPrivate(manager)) { - } /*! @@ -259,7 +198,6 @@ QtVariantProperty::QtVariantProperty(QtVariantPropertyManager *manager) */ QtVariantProperty::~QtVariantProperty() { - delete d_ptr; } /*! @@ -340,85 +278,6 @@ void QtVariantProperty::setAttribute(const QString &attribute, const QVariant &v d_ptr->manager->setAttribute(this, attribute, value); } -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 ®Exp); - 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 &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 m_typeToPropertyManager; - QMap > m_typeToAttributeToAttributeType; - - QMap > m_propertyToType; - - QMap m_typeToValueType; - - - QMap 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; -}; - QtVariantPropertyManagerPrivate::QtVariantPropertyManagerPrivate() : m_constraintAttribute(QLatin1String("constraint")), m_singleStepAttribute(QLatin1String("singleStep")), @@ -610,7 +469,7 @@ void QtVariantPropertyManagerPrivate::slotValueChanged(QtProperty *property, con void QtVariantPropertyManagerPrivate::slotValueChanged(QtProperty *property, const QKeySequence &val) { QVariant v; - qVariantSetValue(v, val); + v.setValue(val); valueChanged(property, v); } @@ -697,7 +556,7 @@ void QtVariantPropertyManagerPrivate::slotEnumIconsChanged(QtProperty *property, { if (QtVariantProperty *varProp = m_internalToProperty.value(property, 0)) { QVariant v; - qVariantSetValue(v, enumIcons); + v.setValue(enumIcons); emit q_ptr->attributeChanged(varProp, m_enumIconsAttribute, v); } } @@ -727,6 +586,9 @@ void QtVariantPropertyManagerPrivate::slotFlagNamesChanged(QtProperty *property, /*! \class QtVariantPropertyManager + \internal + \inmodule QtDesigner + \since 4.4 \brief The QtVariantPropertyManager class provides and manages QVariant based properties. @@ -757,77 +619,77 @@ void QtVariantPropertyManagerPrivate::slotFlagNamesChanged(QtProperty *property, \table \header - \o Property Type - \o Property Type Id + \li Property Type + \li Property Type Id \row - \o int - \o QVariant::Int + \li int + \li QVariant::Int \row - \o double - \o QVariant::Double + \li double + \li QVariant::Double \row - \o bool - \o QVariant::Bool + \li bool + \li QVariant::Bool \row - \o QString - \o QVariant::String + \li QString + \li QVariant::String \row - \o QDate - \o QVariant::Date + \li QDate + \li QVariant::Date \row - \o QTime - \o QVariant::Time + \li QTime + \li QVariant::Time \row - \o QDateTime - \o QVariant::DateTime + \li QDateTime + \li QVariant::DateTime \row - \o QKeySequence - \o QVariant::KeySequence + \li QKeySequence + \li QVariant::KeySequence \row - \o QChar - \o QVariant::Char + \li QChar + \li QVariant::Char \row - \o QLocale - \o QVariant::Locale + \li QLocale + \li QVariant::Locale \row - \o QPoint - \o QVariant::Point + \li QPoint + \li QVariant::Point \row - \o QPointF - \o QVariant::PointF + \li QPointF + \li QVariant::PointF \row - \o QSize - \o QVariant::Size + \li QSize + \li QVariant::Size \row - \o QSizeF - \o QVariant::SizeF + \li QSizeF + \li QVariant::SizeF \row - \o QRect - \o QVariant::Rect + \li QRect + \li QVariant::Rect \row - \o QRectF - \o QVariant::RectF + \li QRectF + \li QVariant::RectF \row - \o QColor - \o QVariant::Color + \li QColor + \li QVariant::Color \row - \o QSizePolicy - \o QVariant::SizePolicy + \li QSizePolicy + \li QVariant::SizePolicy \row - \o QFont - \o QVariant::Font + \li QFont + \li QVariant::Font \row - \o QCursor - \o QVariant::Cursor + \li QCursor + \li QVariant::Cursor \row - \o enum - \o enumTypeId() + \li enum + \li enumTypeId() \row - \o flag - \o flagTypeId() + \li flag + \li flagTypeId() \row - \o group - \o groupTypeId() + \li group + \li groupTypeId() \endtable Each property type can provide additional attributes, @@ -836,97 +698,97 @@ void QtVariantPropertyManagerPrivate::slotFlagNamesChanged(QtProperty *property, \table \header - \o Property Type - \o Attribute Name - \o Attribute Type + \li Property Type + \li Attribute Name + \li Attribute Type \row - \o \c int - \o minimum - \o QVariant::Int + \li \c int + \li minimum + \li QVariant::Int \row - \o - \o maximum - \o QVariant::Int + \li + \li maximum + \li QVariant::Int \row - \o - \o singleStep - \o QVariant::Int + \li + \li singleStep + \li QVariant::Int \row - \o \c double - \o minimum - \o QVariant::Double + \li \c double + \li minimum + \li QVariant::Double \row - \o - \o maximum - \o QVariant::Double + \li + \li maximum + \li QVariant::Double \row - \o - \o singleStep - \o QVariant::Double + \li + \li singleStep + \li QVariant::Double \row - \o - \o decimals - \o QVariant::Int + \li + \li decimals + \li QVariant::Int \row - \o QString - \o regExp - \o QVariant::RegExp + \li QString + \li regExp + \li QVariant::RegExp \row - \o QDate - \o minimum - \o QVariant::Date + \li QDate + \li minimum + \li QVariant::Date \row - \o - \o maximum - \o QVariant::Date + \li + \li maximum + \li QVariant::Date \row - \o QPointF - \o decimals - \o QVariant::Int + \li QPointF + \li decimals + \li QVariant::Int \row - \o QSize - \o minimum - \o QVariant::Size + \li QSize + \li minimum + \li QVariant::Size \row - \o - \o maximum - \o QVariant::Size + \li + \li maximum + \li QVariant::Size \row - \o QSizeF - \o minimum - \o QVariant::SizeF + \li QSizeF + \li minimum + \li QVariant::SizeF \row - \o - \o maximum - \o QVariant::SizeF + \li + \li maximum + \li QVariant::SizeF \row - \o - \o decimals - \o QVariant::Int + \li + \li decimals + \li QVariant::Int \row - \o QRect - \o constraint - \o QVariant::Rect + \li QRect + \li constraint + \li QVariant::Rect \row - \o QRectF - \o constraint - \o QVariant::RectF + \li QRectF + \li constraint + \li QVariant::RectF \row - \o - \o decimals - \o QVariant::Int + \li + \li decimals + \li QVariant::Int \row - \o \c enum - \o enumNames - \o QVariant::StringList + \li \c enum + \li enumNames + \li QVariant::StringList \row - \o - \o enumIcons - \o iconMapTypeId() + \li + \li enumIcons + \li iconMapTypeId() \row - \o \c flag - \o flagNames - \o QVariant::StringList + \li \c flag + \li flagNames + \li QVariant::StringList \endtable The attributes for a given property type can be retrieved using @@ -968,9 +830,8 @@ void QtVariantPropertyManagerPrivate::slotFlagNamesChanged(QtProperty *property, Creates a manager with the given \a parent. */ QtVariantPropertyManager::QtVariantPropertyManager(QObject *parent) - : QtAbstractPropertyManager(parent) + : QtAbstractPropertyManager(parent), d_ptr(new QtVariantPropertyManagerPrivate) { - d_ptr = new QtVariantPropertyManagerPrivate; d_ptr->q_ptr = this; d_ptr->m_creatingProperty = false; @@ -985,12 +846,12 @@ QtVariantPropertyManager::QtVariantPropertyManager(QObject *parent) d_ptr->m_typeToAttributeToAttributeType[QVariant::Int][d_ptr->m_maximumAttribute] = QVariant::Int; d_ptr->m_typeToAttributeToAttributeType[QVariant::Int][d_ptr->m_singleStepAttribute] = QVariant::Int; d_ptr->m_typeToValueType[QVariant::Int] = QVariant::Int; - connect(intPropertyManager, SIGNAL(valueChanged(QtProperty *, int)), - this, SLOT(slotValueChanged(QtProperty *, int))); - connect(intPropertyManager, SIGNAL(rangeChanged(QtProperty *, int, int)), - this, SLOT(slotRangeChanged(QtProperty *, int, int))); - connect(intPropertyManager, SIGNAL(singleStepChanged(QtProperty *, int)), - this, SLOT(slotSingleStepChanged(QtProperty *, int))); + connect(intPropertyManager, SIGNAL(valueChanged(QtProperty*,int)), + this, SLOT(slotValueChanged(QtProperty*,int))); + connect(intPropertyManager, SIGNAL(rangeChanged(QtProperty*,int,int)), + this, SLOT(slotRangeChanged(QtProperty*,int,int))); + connect(intPropertyManager, SIGNAL(singleStepChanged(QtProperty*,int)), + this, SLOT(slotSingleStepChanged(QtProperty*,int))); // DoublePropertyManager QtDoublePropertyManager *doublePropertyManager = new QtDoublePropertyManager(this); d_ptr->m_typeToPropertyManager[QVariant::Double] = doublePropertyManager; @@ -1003,30 +864,30 @@ QtVariantPropertyManager::QtVariantPropertyManager(QObject *parent) d_ptr->m_typeToAttributeToAttributeType[QVariant::Double][d_ptr->m_decimalsAttribute] = QVariant::Int; d_ptr->m_typeToValueType[QVariant::Double] = QVariant::Double; - connect(doublePropertyManager, SIGNAL(valueChanged(QtProperty *, double)), - this, SLOT(slotValueChanged(QtProperty *, double))); - connect(doublePropertyManager, SIGNAL(rangeChanged(QtProperty *, double, double)), - this, SLOT(slotRangeChanged(QtProperty *, double, double))); - connect(doublePropertyManager, SIGNAL(singleStepChanged(QtProperty *, double)), - this, SLOT(slotSingleStepChanged(QtProperty *, double))); - connect(doublePropertyManager, SIGNAL(decimalsChanged(QtProperty *, int)), - this, SLOT(slotDecimalsChanged(QtProperty *, int))); + connect(doublePropertyManager, SIGNAL(valueChanged(QtProperty*,double)), + this, SLOT(slotValueChanged(QtProperty*,double))); + connect(doublePropertyManager, SIGNAL(rangeChanged(QtProperty*,double,double)), + this, SLOT(slotRangeChanged(QtProperty*,double,double))); + connect(doublePropertyManager, SIGNAL(singleStepChanged(QtProperty*,double)), + this, SLOT(slotSingleStepChanged(QtProperty*,double))); + connect(doublePropertyManager, SIGNAL(decimalsChanged(QtProperty*,int)), + this, SLOT(slotDecimalsChanged(QtProperty*,int))); // BoolPropertyManager QtBoolPropertyManager *boolPropertyManager = new QtBoolPropertyManager(this); d_ptr->m_typeToPropertyManager[QVariant::Bool] = boolPropertyManager; d_ptr->m_typeToValueType[QVariant::Bool] = QVariant::Bool; - connect(boolPropertyManager, SIGNAL(valueChanged(QtProperty *, bool)), - this, SLOT(slotValueChanged(QtProperty *, bool))); + connect(boolPropertyManager, SIGNAL(valueChanged(QtProperty*,bool)), + this, SLOT(slotValueChanged(QtProperty*,bool))); // StringPropertyManager QtStringPropertyManager *stringPropertyManager = new QtStringPropertyManager(this); d_ptr->m_typeToPropertyManager[QVariant::String] = stringPropertyManager; d_ptr->m_typeToValueType[QVariant::String] = QVariant::String; d_ptr->m_typeToAttributeToAttributeType[QVariant::String][d_ptr->m_regExpAttribute] = QVariant::RegExp; - connect(stringPropertyManager, SIGNAL(valueChanged(QtProperty *, const QString &)), - this, SLOT(slotValueChanged(QtProperty *, const QString &))); - connect(stringPropertyManager, SIGNAL(regExpChanged(QtProperty *, const QRegExp &)), - this, SLOT(slotRegExpChanged(QtProperty *, const QRegExp &))); + connect(stringPropertyManager, SIGNAL(valueChanged(QtProperty*,QString)), + this, SLOT(slotValueChanged(QtProperty*,QString))); + connect(stringPropertyManager, SIGNAL(regExpChanged(QtProperty*,QRegExp)), + this, SLOT(slotRegExpChanged(QtProperty*,QRegExp))); // DatePropertyManager QtDatePropertyManager *datePropertyManager = new QtDatePropertyManager(this); d_ptr->m_typeToPropertyManager[QVariant::Date] = datePropertyManager; @@ -1035,74 +896,74 @@ QtVariantPropertyManager::QtVariantPropertyManager(QObject *parent) QVariant::Date; d_ptr->m_typeToAttributeToAttributeType[QVariant::Date][d_ptr->m_maximumAttribute] = QVariant::Date; - connect(datePropertyManager, SIGNAL(valueChanged(QtProperty *, const QDate &)), - this, SLOT(slotValueChanged(QtProperty *, const QDate &))); - connect(datePropertyManager, SIGNAL(rangeChanged(QtProperty *, const QDate &, const QDate &)), - this, SLOT(slotRangeChanged(QtProperty *, const QDate &, const QDate &))); + connect(datePropertyManager, SIGNAL(valueChanged(QtProperty*,QDate)), + this, SLOT(slotValueChanged(QtProperty*,QDate))); + connect(datePropertyManager, SIGNAL(rangeChanged(QtProperty*,QDate,QDate)), + this, SLOT(slotRangeChanged(QtProperty*,QDate,QDate))); // TimePropertyManager QtTimePropertyManager *timePropertyManager = new QtTimePropertyManager(this); d_ptr->m_typeToPropertyManager[QVariant::Time] = timePropertyManager; d_ptr->m_typeToValueType[QVariant::Time] = QVariant::Time; - connect(timePropertyManager, SIGNAL(valueChanged(QtProperty *, const QTime &)), - this, SLOT(slotValueChanged(QtProperty *, const QTime &))); + connect(timePropertyManager, SIGNAL(valueChanged(QtProperty*,QTime)), + this, SLOT(slotValueChanged(QtProperty*,QTime))); // DateTimePropertyManager QtDateTimePropertyManager *dateTimePropertyManager = new QtDateTimePropertyManager(this); d_ptr->m_typeToPropertyManager[QVariant::DateTime] = dateTimePropertyManager; d_ptr->m_typeToValueType[QVariant::DateTime] = QVariant::DateTime; - connect(dateTimePropertyManager, SIGNAL(valueChanged(QtProperty *, const QDateTime &)), - this, SLOT(slotValueChanged(QtProperty *, const QDateTime &))); + connect(dateTimePropertyManager, SIGNAL(valueChanged(QtProperty*,QDateTime)), + this, SLOT(slotValueChanged(QtProperty*,QDateTime))); // KeySequencePropertyManager QtKeySequencePropertyManager *keySequencePropertyManager = new QtKeySequencePropertyManager(this); d_ptr->m_typeToPropertyManager[QVariant::KeySequence] = keySequencePropertyManager; d_ptr->m_typeToValueType[QVariant::KeySequence] = QVariant::KeySequence; - connect(keySequencePropertyManager, SIGNAL(valueChanged(QtProperty *, const QKeySequence &)), - this, SLOT(slotValueChanged(QtProperty *, const QKeySequence &))); + connect(keySequencePropertyManager, SIGNAL(valueChanged(QtProperty*,QKeySequence)), + this, SLOT(slotValueChanged(QtProperty*,QKeySequence))); // CharPropertyManager QtCharPropertyManager *charPropertyManager = new QtCharPropertyManager(this); d_ptr->m_typeToPropertyManager[QVariant::Char] = charPropertyManager; d_ptr->m_typeToValueType[QVariant::Char] = QVariant::Char; - connect(charPropertyManager, SIGNAL(valueChanged(QtProperty *, const QChar &)), - this, SLOT(slotValueChanged(QtProperty *, const QChar &))); + connect(charPropertyManager, SIGNAL(valueChanged(QtProperty*,QChar)), + this, SLOT(slotValueChanged(QtProperty*,QChar))); // LocalePropertyManager QtLocalePropertyManager *localePropertyManager = new QtLocalePropertyManager(this); d_ptr->m_typeToPropertyManager[QVariant::Locale] = localePropertyManager; d_ptr->m_typeToValueType[QVariant::Locale] = QVariant::Locale; - connect(localePropertyManager, SIGNAL(valueChanged(QtProperty *, const QLocale &)), - this, SLOT(slotValueChanged(QtProperty *, const QLocale &))); - connect(localePropertyManager->subEnumPropertyManager(), SIGNAL(valueChanged(QtProperty *, int)), - this, SLOT(slotValueChanged(QtProperty *, int))); - connect(localePropertyManager, SIGNAL(propertyInserted(QtProperty *, QtProperty *, QtProperty *)), - this, SLOT(slotPropertyInserted(QtProperty *, QtProperty *, QtProperty *))); - connect(localePropertyManager, SIGNAL(propertyRemoved(QtProperty *, QtProperty *)), - this, SLOT(slotPropertyRemoved(QtProperty *, QtProperty *))); + connect(localePropertyManager, SIGNAL(valueChanged(QtProperty*,QLocale)), + this, SLOT(slotValueChanged(QtProperty*,QLocale))); + connect(localePropertyManager->subEnumPropertyManager(), SIGNAL(valueChanged(QtProperty*,int)), + this, SLOT(slotValueChanged(QtProperty*,int))); + connect(localePropertyManager, SIGNAL(propertyInserted(QtProperty*,QtProperty*,QtProperty*)), + this, SLOT(slotPropertyInserted(QtProperty*,QtProperty*,QtProperty*))); + connect(localePropertyManager, SIGNAL(propertyRemoved(QtProperty*,QtProperty*)), + this, SLOT(slotPropertyRemoved(QtProperty*,QtProperty*))); // PointPropertyManager QtPointPropertyManager *pointPropertyManager = new QtPointPropertyManager(this); d_ptr->m_typeToPropertyManager[QVariant::Point] = pointPropertyManager; d_ptr->m_typeToValueType[QVariant::Point] = QVariant::Point; - connect(pointPropertyManager, SIGNAL(valueChanged(QtProperty *, const QPoint &)), - this, SLOT(slotValueChanged(QtProperty *, const QPoint &))); - connect(pointPropertyManager->subIntPropertyManager(), SIGNAL(valueChanged(QtProperty *, int)), - this, SLOT(slotValueChanged(QtProperty *, int))); - connect(pointPropertyManager, SIGNAL(propertyInserted(QtProperty *, QtProperty *, QtProperty *)), - this, SLOT(slotPropertyInserted(QtProperty *, QtProperty *, QtProperty *))); - connect(pointPropertyManager, SIGNAL(propertyRemoved(QtProperty *, QtProperty *)), - this, SLOT(slotPropertyRemoved(QtProperty *, QtProperty *))); + connect(pointPropertyManager, SIGNAL(valueChanged(QtProperty*,QPoint)), + this, SLOT(slotValueChanged(QtProperty*,QPoint))); + connect(pointPropertyManager->subIntPropertyManager(), SIGNAL(valueChanged(QtProperty*,int)), + this, SLOT(slotValueChanged(QtProperty*,int))); + connect(pointPropertyManager, SIGNAL(propertyInserted(QtProperty*,QtProperty*,QtProperty*)), + this, SLOT(slotPropertyInserted(QtProperty*,QtProperty*,QtProperty*))); + connect(pointPropertyManager, SIGNAL(propertyRemoved(QtProperty*,QtProperty*)), + this, SLOT(slotPropertyRemoved(QtProperty*,QtProperty*))); // PointFPropertyManager QtPointFPropertyManager *pointFPropertyManager = new QtPointFPropertyManager(this); d_ptr->m_typeToPropertyManager[QVariant::PointF] = pointFPropertyManager; d_ptr->m_typeToValueType[QVariant::PointF] = QVariant::PointF; d_ptr->m_typeToAttributeToAttributeType[QVariant::PointF][d_ptr->m_decimalsAttribute] = QVariant::Int; - connect(pointFPropertyManager, SIGNAL(valueChanged(QtProperty *, const QPointF &)), - this, SLOT(slotValueChanged(QtProperty *, const QPointF &))); - connect(pointFPropertyManager, SIGNAL(decimalsChanged(QtProperty *, int)), - this, SLOT(slotDecimalsChanged(QtProperty *, int))); - connect(pointFPropertyManager->subDoublePropertyManager(), SIGNAL(valueChanged(QtProperty *, double)), - this, SLOT(slotValueChanged(QtProperty *, double))); - connect(pointFPropertyManager, SIGNAL(propertyInserted(QtProperty *, QtProperty *, QtProperty *)), - this, SLOT(slotPropertyInserted(QtProperty *, QtProperty *, QtProperty *))); - connect(pointFPropertyManager, SIGNAL(propertyRemoved(QtProperty *, QtProperty *)), - this, SLOT(slotPropertyRemoved(QtProperty *, QtProperty *))); + connect(pointFPropertyManager, SIGNAL(valueChanged(QtProperty*,QPointF)), + this, SLOT(slotValueChanged(QtProperty*,QPointF))); + connect(pointFPropertyManager, SIGNAL(decimalsChanged(QtProperty*,int)), + this, SLOT(slotDecimalsChanged(QtProperty*,int))); + connect(pointFPropertyManager->subDoublePropertyManager(), SIGNAL(valueChanged(QtProperty*,double)), + this, SLOT(slotValueChanged(QtProperty*,double))); + connect(pointFPropertyManager, SIGNAL(propertyInserted(QtProperty*,QtProperty*,QtProperty*)), + this, SLOT(slotPropertyInserted(QtProperty*,QtProperty*,QtProperty*))); + connect(pointFPropertyManager, SIGNAL(propertyRemoved(QtProperty*,QtProperty*)), + this, SLOT(slotPropertyRemoved(QtProperty*,QtProperty*))); // SizePropertyManager QtSizePropertyManager *sizePropertyManager = new QtSizePropertyManager(this); d_ptr->m_typeToPropertyManager[QVariant::Size] = sizePropertyManager; @@ -1111,18 +972,18 @@ QtVariantPropertyManager::QtVariantPropertyManager(QObject *parent) QVariant::Size; d_ptr->m_typeToAttributeToAttributeType[QVariant::Size][d_ptr->m_maximumAttribute] = QVariant::Size; - connect(sizePropertyManager, SIGNAL(valueChanged(QtProperty *, const QSize &)), - this, SLOT(slotValueChanged(QtProperty *, const QSize &))); - connect(sizePropertyManager, SIGNAL(rangeChanged(QtProperty *, const QSize &, const QSize &)), - this, SLOT(slotRangeChanged(QtProperty *, const QSize &, const QSize &))); - connect(sizePropertyManager->subIntPropertyManager(), SIGNAL(valueChanged(QtProperty *, int)), - this, SLOT(slotValueChanged(QtProperty *, int))); - connect(sizePropertyManager->subIntPropertyManager(), SIGNAL(rangeChanged(QtProperty *, int, int)), - this, SLOT(slotRangeChanged(QtProperty *, int, int))); - connect(sizePropertyManager, SIGNAL(propertyInserted(QtProperty *, QtProperty *, QtProperty *)), - this, SLOT(slotPropertyInserted(QtProperty *, QtProperty *, QtProperty *))); - connect(sizePropertyManager, SIGNAL(propertyRemoved(QtProperty *, QtProperty *)), - this, SLOT(slotPropertyRemoved(QtProperty *, QtProperty *))); + connect(sizePropertyManager, SIGNAL(valueChanged(QtProperty*,QSize)), + this, SLOT(slotValueChanged(QtProperty*,QSize))); + connect(sizePropertyManager, SIGNAL(rangeChanged(QtProperty*,QSize,QSize)), + this, SLOT(slotRangeChanged(QtProperty*,QSize,QSize))); + connect(sizePropertyManager->subIntPropertyManager(), SIGNAL(valueChanged(QtProperty*,int)), + this, SLOT(slotValueChanged(QtProperty*,int))); + connect(sizePropertyManager->subIntPropertyManager(), SIGNAL(rangeChanged(QtProperty*,int,int)), + this, SLOT(slotRangeChanged(QtProperty*,int,int))); + connect(sizePropertyManager, SIGNAL(propertyInserted(QtProperty*,QtProperty*,QtProperty*)), + this, SLOT(slotPropertyInserted(QtProperty*,QtProperty*,QtProperty*))); + connect(sizePropertyManager, SIGNAL(propertyRemoved(QtProperty*,QtProperty*)), + this, SLOT(slotPropertyRemoved(QtProperty*,QtProperty*))); // SizeFPropertyManager QtSizeFPropertyManager *sizeFPropertyManager = new QtSizeFPropertyManager(this); d_ptr->m_typeToPropertyManager[QVariant::SizeF] = sizeFPropertyManager; @@ -1133,38 +994,38 @@ QtVariantPropertyManager::QtVariantPropertyManager(QObject *parent) QVariant::SizeF; d_ptr->m_typeToAttributeToAttributeType[QVariant::SizeF][d_ptr->m_decimalsAttribute] = QVariant::Int; - connect(sizeFPropertyManager, SIGNAL(valueChanged(QtProperty *, const QSizeF &)), - this, SLOT(slotValueChanged(QtProperty *, const QSizeF &))); - connect(sizeFPropertyManager, SIGNAL(rangeChanged(QtProperty *, const QSizeF &, const QSizeF &)), - this, SLOT(slotRangeChanged(QtProperty *, const QSizeF &, const QSizeF &))); - connect(sizeFPropertyManager, SIGNAL(decimalsChanged(QtProperty *, int)), - this, SLOT(slotDecimalsChanged(QtProperty *, int))); - connect(sizeFPropertyManager->subDoublePropertyManager(), SIGNAL(valueChanged(QtProperty *, double)), - this, SLOT(slotValueChanged(QtProperty *, double))); - connect(sizeFPropertyManager->subDoublePropertyManager(), SIGNAL(rangeChanged(QtProperty *, double, double)), - this, SLOT(slotRangeChanged(QtProperty *, double, double))); - connect(sizeFPropertyManager, SIGNAL(propertyInserted(QtProperty *, QtProperty *, QtProperty *)), - this, SLOT(slotPropertyInserted(QtProperty *, QtProperty *, QtProperty *))); - connect(sizeFPropertyManager, SIGNAL(propertyRemoved(QtProperty *, QtProperty *)), - this, SLOT(slotPropertyRemoved(QtProperty *, QtProperty *))); + connect(sizeFPropertyManager, SIGNAL(valueChanged(QtProperty*,QSizeF)), + this, SLOT(slotValueChanged(QtProperty*,QSizeF))); + connect(sizeFPropertyManager, SIGNAL(rangeChanged(QtProperty*,QSizeF,QSizeF)), + this, SLOT(slotRangeChanged(QtProperty*,QSizeF,QSizeF))); + connect(sizeFPropertyManager, SIGNAL(decimalsChanged(QtProperty*,int)), + this, SLOT(slotDecimalsChanged(QtProperty*,int))); + connect(sizeFPropertyManager->subDoublePropertyManager(), SIGNAL(valueChanged(QtProperty*,double)), + this, SLOT(slotValueChanged(QtProperty*,double))); + connect(sizeFPropertyManager->subDoublePropertyManager(), SIGNAL(rangeChanged(QtProperty*,double,double)), + this, SLOT(slotRangeChanged(QtProperty*,double,double))); + connect(sizeFPropertyManager, SIGNAL(propertyInserted(QtProperty*,QtProperty*,QtProperty*)), + this, SLOT(slotPropertyInserted(QtProperty*,QtProperty*,QtProperty*))); + connect(sizeFPropertyManager, SIGNAL(propertyRemoved(QtProperty*,QtProperty*)), + this, SLOT(slotPropertyRemoved(QtProperty*,QtProperty*))); // RectPropertyManager QtRectPropertyManager *rectPropertyManager = new QtRectPropertyManager(this); d_ptr->m_typeToPropertyManager[QVariant::Rect] = rectPropertyManager; d_ptr->m_typeToValueType[QVariant::Rect] = QVariant::Rect; d_ptr->m_typeToAttributeToAttributeType[QVariant::Rect][d_ptr->m_constraintAttribute] = QVariant::Rect; - connect(rectPropertyManager, SIGNAL(valueChanged(QtProperty *, const QRect &)), - this, SLOT(slotValueChanged(QtProperty *, const QRect &))); - connect(rectPropertyManager, SIGNAL(constraintChanged(QtProperty *, const QRect &)), - this, SLOT(slotConstraintChanged(QtProperty *, const QRect &))); - connect(rectPropertyManager->subIntPropertyManager(), SIGNAL(valueChanged(QtProperty *, int)), - this, SLOT(slotValueChanged(QtProperty *, int))); - connect(rectPropertyManager->subIntPropertyManager(), SIGNAL(rangeChanged(QtProperty *, int, int)), - this, SLOT(slotRangeChanged(QtProperty *, int, int))); - connect(rectPropertyManager, SIGNAL(propertyInserted(QtProperty *, QtProperty *, QtProperty *)), - this, SLOT(slotPropertyInserted(QtProperty *, QtProperty *, QtProperty *))); - connect(rectPropertyManager, SIGNAL(propertyRemoved(QtProperty *, QtProperty *)), - this, SLOT(slotPropertyRemoved(QtProperty *, QtProperty *))); + connect(rectPropertyManager, SIGNAL(valueChanged(QtProperty*,QRect)), + this, SLOT(slotValueChanged(QtProperty*,QRect))); + connect(rectPropertyManager, SIGNAL(constraintChanged(QtProperty*,QRect)), + this, SLOT(slotConstraintChanged(QtProperty*,QRect))); + connect(rectPropertyManager->subIntPropertyManager(), SIGNAL(valueChanged(QtProperty*,int)), + this, SLOT(slotValueChanged(QtProperty*,int))); + connect(rectPropertyManager->subIntPropertyManager(), SIGNAL(rangeChanged(QtProperty*,int,int)), + this, SLOT(slotRangeChanged(QtProperty*,int,int))); + connect(rectPropertyManager, SIGNAL(propertyInserted(QtProperty*,QtProperty*,QtProperty*)), + this, SLOT(slotPropertyInserted(QtProperty*,QtProperty*,QtProperty*))); + connect(rectPropertyManager, SIGNAL(propertyRemoved(QtProperty*,QtProperty*)), + this, SLOT(slotPropertyRemoved(QtProperty*,QtProperty*))); // RectFPropertyManager QtRectFPropertyManager *rectFPropertyManager = new QtRectFPropertyManager(this); d_ptr->m_typeToPropertyManager[QVariant::RectF] = rectFPropertyManager; @@ -1173,32 +1034,32 @@ QtVariantPropertyManager::QtVariantPropertyManager(QObject *parent) QVariant::RectF; d_ptr->m_typeToAttributeToAttributeType[QVariant::RectF][d_ptr->m_decimalsAttribute] = QVariant::Int; - connect(rectFPropertyManager, SIGNAL(valueChanged(QtProperty *, const QRectF &)), - this, SLOT(slotValueChanged(QtProperty *, const QRectF &))); - connect(rectFPropertyManager, SIGNAL(constraintChanged(QtProperty *, const QRectF &)), - this, SLOT(slotConstraintChanged(QtProperty *, const QRectF &))); - connect(rectFPropertyManager, SIGNAL(decimalsChanged(QtProperty *, int)), - this, SLOT(slotDecimalsChanged(QtProperty *, int))); - connect(rectFPropertyManager->subDoublePropertyManager(), SIGNAL(valueChanged(QtProperty *, double)), - this, SLOT(slotValueChanged(QtProperty *, double))); - connect(rectFPropertyManager->subDoublePropertyManager(), SIGNAL(rangeChanged(QtProperty *, double, double)), - this, SLOT(slotRangeChanged(QtProperty *, double, double))); - connect(rectFPropertyManager, SIGNAL(propertyInserted(QtProperty *, QtProperty *, QtProperty *)), - this, SLOT(slotPropertyInserted(QtProperty *, QtProperty *, QtProperty *))); - connect(rectFPropertyManager, SIGNAL(propertyRemoved(QtProperty *, QtProperty *)), - this, SLOT(slotPropertyRemoved(QtProperty *, QtProperty *))); + connect(rectFPropertyManager, SIGNAL(valueChanged(QtProperty*,QRectF)), + this, SLOT(slotValueChanged(QtProperty*,QRectF))); + connect(rectFPropertyManager, SIGNAL(constraintChanged(QtProperty*,QRectF)), + this, SLOT(slotConstraintChanged(QtProperty*,QRectF))); + connect(rectFPropertyManager, SIGNAL(decimalsChanged(QtProperty*,int)), + this, SLOT(slotDecimalsChanged(QtProperty*,int))); + connect(rectFPropertyManager->subDoublePropertyManager(), SIGNAL(valueChanged(QtProperty*,double)), + this, SLOT(slotValueChanged(QtProperty*,double))); + connect(rectFPropertyManager->subDoublePropertyManager(), SIGNAL(rangeChanged(QtProperty*,double,double)), + this, SLOT(slotRangeChanged(QtProperty*,double,double))); + connect(rectFPropertyManager, SIGNAL(propertyInserted(QtProperty*,QtProperty*,QtProperty*)), + this, SLOT(slotPropertyInserted(QtProperty*,QtProperty*,QtProperty*))); + connect(rectFPropertyManager, SIGNAL(propertyRemoved(QtProperty*,QtProperty*)), + this, SLOT(slotPropertyRemoved(QtProperty*,QtProperty*))); // ColorPropertyManager QtColorPropertyManager *colorPropertyManager = new QtColorPropertyManager(this); d_ptr->m_typeToPropertyManager[QVariant::Color] = colorPropertyManager; d_ptr->m_typeToValueType[QVariant::Color] = QVariant::Color; - connect(colorPropertyManager, SIGNAL(valueChanged(QtProperty *, const QColor &)), - this, SLOT(slotValueChanged(QtProperty *, const QColor &))); - connect(colorPropertyManager->subIntPropertyManager(), SIGNAL(valueChanged(QtProperty *, int)), - this, SLOT(slotValueChanged(QtProperty *, int))); - connect(colorPropertyManager, SIGNAL(propertyInserted(QtProperty *, QtProperty *, QtProperty *)), - this, SLOT(slotPropertyInserted(QtProperty *, QtProperty *, QtProperty *))); - connect(colorPropertyManager, SIGNAL(propertyRemoved(QtProperty *, QtProperty *)), - this, SLOT(slotPropertyRemoved(QtProperty *, QtProperty *))); + connect(colorPropertyManager, SIGNAL(valueChanged(QtProperty*,QColor)), + this, SLOT(slotValueChanged(QtProperty*,QColor))); + connect(colorPropertyManager->subIntPropertyManager(), SIGNAL(valueChanged(QtProperty*,int)), + this, SLOT(slotValueChanged(QtProperty*,int))); + connect(colorPropertyManager, SIGNAL(propertyInserted(QtProperty*,QtProperty*,QtProperty*)), + this, SLOT(slotPropertyInserted(QtProperty*,QtProperty*,QtProperty*))); + connect(colorPropertyManager, SIGNAL(propertyRemoved(QtProperty*,QtProperty*)), + this, SLOT(slotPropertyRemoved(QtProperty*,QtProperty*))); // EnumPropertyManager int enumId = enumTypeId(); QtEnumPropertyManager *enumPropertyManager = new QtEnumPropertyManager(this); @@ -1208,58 +1069,58 @@ QtVariantPropertyManager::QtVariantPropertyManager(QObject *parent) QVariant::StringList; d_ptr->m_typeToAttributeToAttributeType[enumId][d_ptr->m_enumIconsAttribute] = iconMapTypeId(); - connect(enumPropertyManager, SIGNAL(valueChanged(QtProperty *, int)), - this, SLOT(slotValueChanged(QtProperty *, int))); - connect(enumPropertyManager, SIGNAL(enumNamesChanged(QtProperty *, const QStringList &)), - this, SLOT(slotEnumNamesChanged(QtProperty *, const QStringList &))); - connect(enumPropertyManager, SIGNAL(enumIconsChanged(QtProperty *, const QMap &)), - this, SLOT(slotEnumIconsChanged(QtProperty *, const QMap &))); + connect(enumPropertyManager, SIGNAL(valueChanged(QtProperty*,int)), + this, SLOT(slotValueChanged(QtProperty*,int))); + connect(enumPropertyManager, SIGNAL(enumNamesChanged(QtProperty*,QStringList)), + this, SLOT(slotEnumNamesChanged(QtProperty*,QStringList))); + connect(enumPropertyManager, SIGNAL(enumIconsChanged(QtProperty*,QMap)), + this, SLOT(slotEnumIconsChanged(QtProperty*,QMap))); // SizePolicyPropertyManager QtSizePolicyPropertyManager *sizePolicyPropertyManager = new QtSizePolicyPropertyManager(this); d_ptr->m_typeToPropertyManager[QVariant::SizePolicy] = sizePolicyPropertyManager; d_ptr->m_typeToValueType[QVariant::SizePolicy] = QVariant::SizePolicy; - connect(sizePolicyPropertyManager, SIGNAL(valueChanged(QtProperty *, const QSizePolicy &)), - this, SLOT(slotValueChanged(QtProperty *, const QSizePolicy &))); - connect(sizePolicyPropertyManager->subIntPropertyManager(), SIGNAL(valueChanged(QtProperty *, int)), - this, SLOT(slotValueChanged(QtProperty *, int))); - connect(sizePolicyPropertyManager->subIntPropertyManager(), SIGNAL(rangeChanged(QtProperty *, int, int)), - this, SLOT(slotRangeChanged(QtProperty *, int, int))); - connect(sizePolicyPropertyManager->subEnumPropertyManager(), SIGNAL(valueChanged(QtProperty *, int)), - this, SLOT(slotValueChanged(QtProperty *, int))); + connect(sizePolicyPropertyManager, SIGNAL(valueChanged(QtProperty*,QSizePolicy)), + this, SLOT(slotValueChanged(QtProperty*,QSizePolicy))); + connect(sizePolicyPropertyManager->subIntPropertyManager(), SIGNAL(valueChanged(QtProperty*,int)), + this, SLOT(slotValueChanged(QtProperty*,int))); + connect(sizePolicyPropertyManager->subIntPropertyManager(), SIGNAL(rangeChanged(QtProperty*,int,int)), + this, SLOT(slotRangeChanged(QtProperty*,int,int))); + connect(sizePolicyPropertyManager->subEnumPropertyManager(), SIGNAL(valueChanged(QtProperty*,int)), + this, SLOT(slotValueChanged(QtProperty*,int))); connect(sizePolicyPropertyManager->subEnumPropertyManager(), - SIGNAL(enumNamesChanged(QtProperty *, const QStringList &)), - this, SLOT(slotEnumNamesChanged(QtProperty *, const QStringList &))); - connect(sizePolicyPropertyManager, SIGNAL(propertyInserted(QtProperty *, QtProperty *, QtProperty *)), - this, SLOT(slotPropertyInserted(QtProperty *, QtProperty *, QtProperty *))); - connect(sizePolicyPropertyManager, SIGNAL(propertyRemoved(QtProperty *, QtProperty *)), - this, SLOT(slotPropertyRemoved(QtProperty *, QtProperty *))); + SIGNAL(enumNamesChanged(QtProperty*,QStringList)), + this, SLOT(slotEnumNamesChanged(QtProperty*,QStringList))); + connect(sizePolicyPropertyManager, SIGNAL(propertyInserted(QtProperty*,QtProperty*,QtProperty*)), + this, SLOT(slotPropertyInserted(QtProperty*,QtProperty*,QtProperty*))); + connect(sizePolicyPropertyManager, SIGNAL(propertyRemoved(QtProperty*,QtProperty*)), + this, SLOT(slotPropertyRemoved(QtProperty*,QtProperty*))); // FontPropertyManager QtFontPropertyManager *fontPropertyManager = new QtFontPropertyManager(this); d_ptr->m_typeToPropertyManager[QVariant::Font] = fontPropertyManager; d_ptr->m_typeToValueType[QVariant::Font] = QVariant::Font; - connect(fontPropertyManager, SIGNAL(valueChanged(QtProperty *, const QFont &)), - this, SLOT(slotValueChanged(QtProperty *, const QFont &))); - connect(fontPropertyManager->subIntPropertyManager(), SIGNAL(valueChanged(QtProperty *, int)), - this, SLOT(slotValueChanged(QtProperty *, int))); - connect(fontPropertyManager->subIntPropertyManager(), SIGNAL(rangeChanged(QtProperty *, int, int)), - this, SLOT(slotRangeChanged(QtProperty *, int, int))); - connect(fontPropertyManager->subEnumPropertyManager(), SIGNAL(valueChanged(QtProperty *, int)), - this, SLOT(slotValueChanged(QtProperty *, int))); + connect(fontPropertyManager, SIGNAL(valueChanged(QtProperty*,QFont)), + this, SLOT(slotValueChanged(QtProperty*,QFont))); + connect(fontPropertyManager->subIntPropertyManager(), SIGNAL(valueChanged(QtProperty*,int)), + this, SLOT(slotValueChanged(QtProperty*,int))); + connect(fontPropertyManager->subIntPropertyManager(), SIGNAL(rangeChanged(QtProperty*,int,int)), + this, SLOT(slotRangeChanged(QtProperty*,int,int))); + connect(fontPropertyManager->subEnumPropertyManager(), SIGNAL(valueChanged(QtProperty*,int)), + this, SLOT(slotValueChanged(QtProperty*,int))); connect(fontPropertyManager->subEnumPropertyManager(), - SIGNAL(enumNamesChanged(QtProperty *, const QStringList &)), - this, SLOT(slotEnumNamesChanged(QtProperty *, const QStringList &))); - connect(fontPropertyManager->subBoolPropertyManager(), SIGNAL(valueChanged(QtProperty *, bool)), - this, SLOT(slotValueChanged(QtProperty *, bool))); - connect(fontPropertyManager, SIGNAL(propertyInserted(QtProperty *, QtProperty *, QtProperty *)), - this, SLOT(slotPropertyInserted(QtProperty *, QtProperty *, QtProperty *))); - connect(fontPropertyManager, SIGNAL(propertyRemoved(QtProperty *, QtProperty *)), - this, SLOT(slotPropertyRemoved(QtProperty *, QtProperty *))); + SIGNAL(enumNamesChanged(QtProperty*,QStringList)), + this, SLOT(slotEnumNamesChanged(QtProperty*,QStringList))); + connect(fontPropertyManager->subBoolPropertyManager(), SIGNAL(valueChanged(QtProperty*,bool)), + this, SLOT(slotValueChanged(QtProperty*,bool))); + connect(fontPropertyManager, SIGNAL(propertyInserted(QtProperty*,QtProperty*,QtProperty*)), + this, SLOT(slotPropertyInserted(QtProperty*,QtProperty*,QtProperty*))); + connect(fontPropertyManager, SIGNAL(propertyRemoved(QtProperty*,QtProperty*)), + this, SLOT(slotPropertyRemoved(QtProperty*,QtProperty*))); // CursorPropertyManager QtCursorPropertyManager *cursorPropertyManager = new QtCursorPropertyManager(this); d_ptr->m_typeToPropertyManager[QVariant::Cursor] = cursorPropertyManager; d_ptr->m_typeToValueType[QVariant::Cursor] = QVariant::Cursor; - connect(cursorPropertyManager, SIGNAL(valueChanged(QtProperty *, const QCursor &)), - this, SLOT(slotValueChanged(QtProperty *, const QCursor &))); + connect(cursorPropertyManager, SIGNAL(valueChanged(QtProperty*,QCursor)), + this, SLOT(slotValueChanged(QtProperty*,QCursor))); // FlagPropertyManager int flagId = flagTypeId(); QtFlagPropertyManager *flagPropertyManager = new QtFlagPropertyManager(this); @@ -1267,16 +1128,16 @@ QtVariantPropertyManager::QtVariantPropertyManager(QObject *parent) d_ptr->m_typeToValueType[flagId] = QVariant::Int; d_ptr->m_typeToAttributeToAttributeType[flagId][d_ptr->m_flagNamesAttribute] = QVariant::StringList; - connect(flagPropertyManager, SIGNAL(valueChanged(QtProperty *, int)), - this, SLOT(slotValueChanged(QtProperty *, int))); - connect(flagPropertyManager, SIGNAL(flagNamesChanged(QtProperty *, const QStringList &)), - this, SLOT(slotFlagNamesChanged(QtProperty *, const QStringList &))); - connect(flagPropertyManager->subBoolPropertyManager(), SIGNAL(valueChanged(QtProperty *, bool)), - this, SLOT(slotValueChanged(QtProperty *, bool))); - connect(flagPropertyManager, SIGNAL(propertyInserted(QtProperty *, QtProperty *, QtProperty *)), - this, SLOT(slotPropertyInserted(QtProperty *, QtProperty *, QtProperty *))); - connect(flagPropertyManager, SIGNAL(propertyRemoved(QtProperty *, QtProperty *)), - this, SLOT(slotPropertyRemoved(QtProperty *, QtProperty *))); + connect(flagPropertyManager, SIGNAL(valueChanged(QtProperty*,int)), + this, SLOT(slotValueChanged(QtProperty*,int))); + connect(flagPropertyManager, SIGNAL(flagNamesChanged(QtProperty*,QStringList)), + this, SLOT(slotFlagNamesChanged(QtProperty*,QStringList))); + connect(flagPropertyManager->subBoolPropertyManager(), SIGNAL(valueChanged(QtProperty*,bool)), + this, SLOT(slotValueChanged(QtProperty*,bool))); + connect(flagPropertyManager, SIGNAL(propertyInserted(QtProperty*,QtProperty*,QtProperty*)), + this, SLOT(slotPropertyInserted(QtProperty*,QtProperty*,QtProperty*))); + connect(flagPropertyManager, SIGNAL(propertyRemoved(QtProperty*,QtProperty*)), + this, SLOT(slotPropertyRemoved(QtProperty*,QtProperty*))); // FlagPropertyManager int groupId = groupTypeId(); QtGroupPropertyManager *groupPropertyManager = new QtGroupPropertyManager(this); @@ -1290,7 +1151,6 @@ QtVariantPropertyManager::QtVariantPropertyManager(QObject *parent) QtVariantPropertyManager::~QtVariantPropertyManager() { clear(); - delete d_ptr; } /*! @@ -1384,7 +1244,7 @@ QVariant QtVariantPropertyManager::value(const QtProperty *property) const } else if (QtDateTimePropertyManager *dateTimeManager = qobject_cast(manager)) { return dateTimeManager->value(internProp); } else if (QtKeySequencePropertyManager *keySequenceManager = qobject_cast(manager)) { - return keySequenceManager->value(internProp); + return QVariant::fromValue(keySequenceManager->value(internProp)); } else if (QtCharPropertyManager *charManager = qobject_cast(manager)) { return charManager->value(internProp); } else if (QtLocalePropertyManager *localeManager = qobject_cast(manager)) { @@ -1548,7 +1408,7 @@ QVariant QtVariantPropertyManager::attributeValue(const QtProperty *property, co return enumManager->enumNames(internProp); if (attribute == d_ptr->m_enumIconsAttribute) { QVariant v; - qVariantSetValue(v, enumManager->enumIcons(internProp)); + v.setValue(enumManager->enumIcons(internProp)); return v; } return QVariant(); @@ -1628,73 +1488,73 @@ void QtVariantPropertyManager::setValue(QtProperty *property, const QVariant &va QtAbstractPropertyManager *manager = internProp->propertyManager(); if (QtIntPropertyManager *intManager = qobject_cast(manager)) { - intManager->setValue(internProp, qVariantValue(val)); + intManager->setValue(internProp, qvariant_cast(val)); return; } else if (QtDoublePropertyManager *doubleManager = qobject_cast(manager)) { - doubleManager->setValue(internProp, qVariantValue(val)); + doubleManager->setValue(internProp, qvariant_cast(val)); return; } else if (QtBoolPropertyManager *boolManager = qobject_cast(manager)) { - boolManager->setValue(internProp, qVariantValue(val)); + boolManager->setValue(internProp, qvariant_cast(val)); return; } else if (QtStringPropertyManager *stringManager = qobject_cast(manager)) { - stringManager->setValue(internProp, qVariantValue(val)); + stringManager->setValue(internProp, qvariant_cast(val)); return; } else if (QtDatePropertyManager *dateManager = qobject_cast(manager)) { - dateManager->setValue(internProp, qVariantValue(val)); + dateManager->setValue(internProp, qvariant_cast(val)); return; } else if (QtTimePropertyManager *timeManager = qobject_cast(manager)) { - timeManager->setValue(internProp, qVariantValue(val)); + timeManager->setValue(internProp, qvariant_cast(val)); return; } else if (QtDateTimePropertyManager *dateTimeManager = qobject_cast(manager)) { - dateTimeManager->setValue(internProp, qVariantValue(val)); + dateTimeManager->setValue(internProp, qvariant_cast(val)); return; } else if (QtKeySequencePropertyManager *keySequenceManager = qobject_cast(manager)) { - keySequenceManager->setValue(internProp, qVariantValue(val)); + keySequenceManager->setValue(internProp, qvariant_cast(val)); return; } else if (QtCharPropertyManager *charManager = qobject_cast(manager)) { - charManager->setValue(internProp, qVariantValue(val)); + charManager->setValue(internProp, qvariant_cast(val)); return; } else if (QtLocalePropertyManager *localeManager = qobject_cast(manager)) { - localeManager->setValue(internProp, qVariantValue(val)); + localeManager->setValue(internProp, qvariant_cast(val)); return; } else if (QtPointPropertyManager *pointManager = qobject_cast(manager)) { - pointManager->setValue(internProp, qVariantValue(val)); + pointManager->setValue(internProp, qvariant_cast(val)); return; } else if (QtPointFPropertyManager *pointFManager = qobject_cast(manager)) { - pointFManager->setValue(internProp, qVariantValue(val)); + pointFManager->setValue(internProp, qvariant_cast(val)); return; } else if (QtSizePropertyManager *sizeManager = qobject_cast(manager)) { - sizeManager->setValue(internProp, qVariantValue(val)); + sizeManager->setValue(internProp, qvariant_cast(val)); return; } else if (QtSizeFPropertyManager *sizeFManager = qobject_cast(manager)) { - sizeFManager->setValue(internProp, qVariantValue(val)); + sizeFManager->setValue(internProp, qvariant_cast(val)); return; } else if (QtRectPropertyManager *rectManager = qobject_cast(manager)) { - rectManager->setValue(internProp, qVariantValue(val)); + rectManager->setValue(internProp, qvariant_cast(val)); return; } else if (QtRectFPropertyManager *rectFManager = qobject_cast(manager)) { - rectFManager->setValue(internProp, qVariantValue(val)); + rectFManager->setValue(internProp, qvariant_cast(val)); return; } else if (QtColorPropertyManager *colorManager = qobject_cast(manager)) { - colorManager->setValue(internProp, qVariantValue(val)); + colorManager->setValue(internProp, qvariant_cast(val)); return; } else if (QtEnumPropertyManager *enumManager = qobject_cast(manager)) { - enumManager->setValue(internProp, qVariantValue(val)); + enumManager->setValue(internProp, qvariant_cast(val)); return; } else if (QtSizePolicyPropertyManager *sizePolicyManager = qobject_cast(manager)) { - sizePolicyManager->setValue(internProp, qVariantValue(val)); + sizePolicyManager->setValue(internProp, qvariant_cast(val)); return; } else if (QtFontPropertyManager *fontManager = qobject_cast(manager)) { - fontManager->setValue(internProp, qVariantValue(val)); + fontManager->setValue(internProp, qvariant_cast(val)); return; #ifndef QT_NO_CURSOR } else if (QtCursorPropertyManager *cursorManager = qobject_cast(manager)) { - cursorManager->setValue(internProp, qVariantValue(val)); + cursorManager->setValue(internProp, qvariant_cast(val)); return; #endif } else if (QtFlagPropertyManager *flagManager = qobject_cast(manager)) { - flagManager->setValue(internProp, qVariantValue(val)); + flagManager->setValue(internProp, qvariant_cast(val)); return; } } @@ -1732,75 +1592,75 @@ void QtVariantPropertyManager::setAttribute(QtProperty *property, QtAbstractPropertyManager *manager = internProp->propertyManager(); if (QtIntPropertyManager *intManager = qobject_cast(manager)) { if (attribute == d_ptr->m_maximumAttribute) - intManager->setMaximum(internProp, qVariantValue(value)); + intManager->setMaximum(internProp, qvariant_cast(value)); else if (attribute == d_ptr->m_minimumAttribute) - intManager->setMinimum(internProp, qVariantValue(value)); + intManager->setMinimum(internProp, qvariant_cast(value)); else if (attribute == d_ptr->m_singleStepAttribute) - intManager->setSingleStep(internProp, qVariantValue(value)); + intManager->setSingleStep(internProp, qvariant_cast(value)); return; } else if (QtDoublePropertyManager *doubleManager = qobject_cast(manager)) { if (attribute == d_ptr->m_maximumAttribute) - doubleManager->setMaximum(internProp, qVariantValue(value)); + doubleManager->setMaximum(internProp, qvariant_cast(value)); if (attribute == d_ptr->m_minimumAttribute) - doubleManager->setMinimum(internProp, qVariantValue(value)); + doubleManager->setMinimum(internProp, qvariant_cast(value)); if (attribute == d_ptr->m_singleStepAttribute) - doubleManager->setSingleStep(internProp, qVariantValue(value)); + doubleManager->setSingleStep(internProp, qvariant_cast(value)); if (attribute == d_ptr->m_decimalsAttribute) - doubleManager->setDecimals(internProp, qVariantValue(value)); + doubleManager->setDecimals(internProp, qvariant_cast(value)); return; } else if (QtStringPropertyManager *stringManager = qobject_cast(manager)) { if (attribute == d_ptr->m_regExpAttribute) - stringManager->setRegExp(internProp, qVariantValue(value)); + stringManager->setRegExp(internProp, qvariant_cast(value)); return; } else if (QtDatePropertyManager *dateManager = qobject_cast(manager)) { if (attribute == d_ptr->m_maximumAttribute) - dateManager->setMaximum(internProp, qVariantValue(value)); + dateManager->setMaximum(internProp, qvariant_cast(value)); if (attribute == d_ptr->m_minimumAttribute) - dateManager->setMinimum(internProp, qVariantValue(value)); + dateManager->setMinimum(internProp, qvariant_cast(value)); return; } else if (QtPointFPropertyManager *pointFManager = qobject_cast(manager)) { if (attribute == d_ptr->m_decimalsAttribute) - pointFManager->setDecimals(internProp, qVariantValue(value)); + pointFManager->setDecimals(internProp, qvariant_cast(value)); return; } else if (QtSizePropertyManager *sizeManager = qobject_cast(manager)) { if (attribute == d_ptr->m_maximumAttribute) - sizeManager->setMaximum(internProp, qVariantValue(value)); + sizeManager->setMaximum(internProp, qvariant_cast(value)); if (attribute == d_ptr->m_minimumAttribute) - sizeManager->setMinimum(internProp, qVariantValue(value)); + sizeManager->setMinimum(internProp, qvariant_cast(value)); return; } else if (QtSizeFPropertyManager *sizeFManager = qobject_cast(manager)) { if (attribute == d_ptr->m_maximumAttribute) - sizeFManager->setMaximum(internProp, qVariantValue(value)); + sizeFManager->setMaximum(internProp, qvariant_cast(value)); if (attribute == d_ptr->m_minimumAttribute) - sizeFManager->setMinimum(internProp, qVariantValue(value)); + sizeFManager->setMinimum(internProp, qvariant_cast(value)); if (attribute == d_ptr->m_decimalsAttribute) - sizeFManager->setDecimals(internProp, qVariantValue(value)); + sizeFManager->setDecimals(internProp, qvariant_cast(value)); return; } else if (QtRectPropertyManager *rectManager = qobject_cast(manager)) { if (attribute == d_ptr->m_constraintAttribute) - rectManager->setConstraint(internProp, qVariantValue(value)); + rectManager->setConstraint(internProp, qvariant_cast(value)); return; } else if (QtRectFPropertyManager *rectFManager = qobject_cast(manager)) { if (attribute == d_ptr->m_constraintAttribute) - rectFManager->setConstraint(internProp, qVariantValue(value)); + rectFManager->setConstraint(internProp, qvariant_cast(value)); if (attribute == d_ptr->m_decimalsAttribute) - rectFManager->setDecimals(internProp, qVariantValue(value)); + rectFManager->setDecimals(internProp, qvariant_cast(value)); return; } else if (QtEnumPropertyManager *enumManager = qobject_cast(manager)) { if (attribute == d_ptr->m_enumNamesAttribute) - enumManager->setEnumNames(internProp, qVariantValue(value)); + enumManager->setEnumNames(internProp, qvariant_cast(value)); if (attribute == d_ptr->m_enumIconsAttribute) - enumManager->setEnumIcons(internProp, qVariantValue(value)); + enumManager->setEnumIcons(internProp, qvariant_cast(value)); return; } else if (QtFlagPropertyManager *flagManager = qobject_cast(manager)) { if (attribute == d_ptr->m_flagNamesAttribute) - flagManager->setFlagNames(internProp, qVariantValue(value)); + flagManager->setFlagNames(internProp, qvariant_cast(value)); return; } } /*! - \reimp + \internal */ bool QtVariantPropertyManager::hasValue(const QtProperty *property) const { @@ -1810,7 +1670,7 @@ bool QtVariantPropertyManager::hasValue(const QtProperty *property) const } /*! - \reimp + \internal */ QString QtVariantPropertyManager::valueText(const QtProperty *property) const { @@ -1819,7 +1679,7 @@ QString QtVariantPropertyManager::valueText(const QtProperty *property) const } /*! - \reimp + \internal */ QIcon QtVariantPropertyManager::valueIcon(const QtProperty *property) const { @@ -1828,7 +1688,7 @@ QIcon QtVariantPropertyManager::valueIcon(const QtProperty *property) const } /*! - \reimp + \internal */ void QtVariantPropertyManager::initializeProperty(QtProperty *property) { @@ -1859,7 +1719,7 @@ void QtVariantPropertyManager::initializeProperty(QtProperty *property) } /*! - \reimp + \internal */ void QtVariantPropertyManager::uninitializeProperty(QtProperty *property) { @@ -1882,7 +1742,7 @@ void QtVariantPropertyManager::uninitializeProperty(QtProperty *property) } /*! - \reimp + \internal */ QtProperty *QtVariantPropertyManager::createProperty() { @@ -1923,6 +1783,9 @@ public: /*! \class QtVariantEditorFactory + \internal + \inmodule QtDesigner + \since 4.4 \brief The QtVariantEditorFactory class provides widgets for properties created by QtVariantPropertyManager objects. @@ -1932,41 +1795,41 @@ public: \table \header - \o Property Type - \o Widget + \li Property Type + \li Widget \row - \o \c int - \o QSpinBox + \li \c int + \li QSpinBox \row - \o \c double - \o QDoubleSpinBox + \li \c double + \li QDoubleSpinBox \row - \o \c bool - \o QCheckBox + \li \c bool + \li QCheckBox \row - \o QString - \o QLineEdit + \li QString + \li QLineEdit \row - \o QDate - \o QDateEdit + \li QDate + \li QDateEdit \row - \o QTime - \o QTimeEdit + \li QTime + \li QTimeEdit \row - \o QDateTime - \o QDateTimeEdit + \li QDateTime + \li QDateTimeEdit \row - \o QKeySequence - \o customized editor + \li QKeySequence + \li customized editor \row - \o QChar - \o customized editor + \li QChar + \li customized editor \row - \o \c enum - \o QComboBox + \li \c enum + \li QComboBox \row - \o QCursor - \o QComboBox + \li QCursor + \li QComboBox \endtable Note that QtVariantPropertyManager supports several additional property @@ -1982,9 +1845,8 @@ public: Creates a factory with the given \a parent. */ QtVariantEditorFactory::QtVariantEditorFactory(QObject *parent) - : QtAbstractEditorFactory(parent) + : QtAbstractEditorFactory(parent), d_ptr(new QtVariantEditorFactoryPrivate()) { - d_ptr = new QtVariantEditorFactoryPrivate(); d_ptr->q_ptr = this; d_ptr->m_spinBoxFactory = new QtSpinBoxFactory(this); @@ -2046,7 +1908,6 @@ QtVariantEditorFactory::QtVariantEditorFactory(QObject *parent) */ QtVariantEditorFactory::~QtVariantEditorFactory() { - delete d_ptr; } /*! @@ -2056,87 +1917,87 @@ QtVariantEditorFactory::~QtVariantEditorFactory() */ void QtVariantEditorFactory::connectPropertyManager(QtVariantPropertyManager *manager) { - QList intPropertyManagers = qFindChildren(manager); + QList intPropertyManagers = manager->findChildren(); QListIterator itInt(intPropertyManagers); while (itInt.hasNext()) d_ptr->m_spinBoxFactory->addPropertyManager(itInt.next()); - QList doublePropertyManagers = qFindChildren(manager); + QList doublePropertyManagers = manager->findChildren(); QListIterator itDouble(doublePropertyManagers); while (itDouble.hasNext()) d_ptr->m_doubleSpinBoxFactory->addPropertyManager(itDouble.next()); - QList boolPropertyManagers = qFindChildren(manager); + QList boolPropertyManagers = manager->findChildren(); QListIterator itBool(boolPropertyManagers); while (itBool.hasNext()) d_ptr->m_checkBoxFactory->addPropertyManager(itBool.next()); - QList stringPropertyManagers = qFindChildren(manager); + QList stringPropertyManagers = manager->findChildren(); QListIterator itString(stringPropertyManagers); while (itString.hasNext()) d_ptr->m_lineEditFactory->addPropertyManager(itString.next()); - QList datePropertyManagers = qFindChildren(manager); + QList datePropertyManagers = manager->findChildren(); QListIterator itDate(datePropertyManagers); while (itDate.hasNext()) d_ptr->m_dateEditFactory->addPropertyManager(itDate.next()); - QList timePropertyManagers = qFindChildren(manager); + QList timePropertyManagers = manager->findChildren(); QListIterator itTime(timePropertyManagers); while (itTime.hasNext()) d_ptr->m_timeEditFactory->addPropertyManager(itTime.next()); - QList dateTimePropertyManagers = qFindChildren(manager); + QList dateTimePropertyManagers = manager->findChildren(); QListIterator itDateTime(dateTimePropertyManagers); while (itDateTime.hasNext()) d_ptr->m_dateTimeEditFactory->addPropertyManager(itDateTime.next()); - QList keySequencePropertyManagers = qFindChildren(manager); + QList keySequencePropertyManagers = manager->findChildren(); QListIterator itKeySequence(keySequencePropertyManagers); while (itKeySequence.hasNext()) d_ptr->m_keySequenceEditorFactory->addPropertyManager(itKeySequence.next()); - QList charPropertyManagers = qFindChildren(manager); + QList charPropertyManagers = manager->findChildren(); QListIterator itChar(charPropertyManagers); while (itChar.hasNext()) d_ptr->m_charEditorFactory->addPropertyManager(itChar.next()); - QList localePropertyManagers = qFindChildren(manager); + QList localePropertyManagers = manager->findChildren(); QListIterator itLocale(localePropertyManagers); while (itLocale.hasNext()) d_ptr->m_comboBoxFactory->addPropertyManager(itLocale.next()->subEnumPropertyManager()); - QList pointPropertyManagers = qFindChildren(manager); + QList pointPropertyManagers = manager->findChildren(); QListIterator itPoint(pointPropertyManagers); while (itPoint.hasNext()) d_ptr->m_spinBoxFactory->addPropertyManager(itPoint.next()->subIntPropertyManager()); - QList pointFPropertyManagers = qFindChildren(manager); + QList pointFPropertyManagers = manager->findChildren(); QListIterator itPointF(pointFPropertyManagers); while (itPointF.hasNext()) d_ptr->m_doubleSpinBoxFactory->addPropertyManager(itPointF.next()->subDoublePropertyManager()); - QList sizePropertyManagers = qFindChildren(manager); + QList sizePropertyManagers = manager->findChildren(); QListIterator itSize(sizePropertyManagers); while (itSize.hasNext()) d_ptr->m_spinBoxFactory->addPropertyManager(itSize.next()->subIntPropertyManager()); - QList sizeFPropertyManagers = qFindChildren(manager); + QList sizeFPropertyManagers = manager->findChildren(); QListIterator itSizeF(sizeFPropertyManagers); while (itSizeF.hasNext()) d_ptr->m_doubleSpinBoxFactory->addPropertyManager(itSizeF.next()->subDoublePropertyManager()); - QList rectPropertyManagers = qFindChildren(manager); + QList rectPropertyManagers = manager->findChildren(); QListIterator itRect(rectPropertyManagers); while (itRect.hasNext()) d_ptr->m_spinBoxFactory->addPropertyManager(itRect.next()->subIntPropertyManager()); - QList rectFPropertyManagers = qFindChildren(manager); + QList rectFPropertyManagers = manager->findChildren(); QListIterator itRectF(rectFPropertyManagers); while (itRectF.hasNext()) d_ptr->m_doubleSpinBoxFactory->addPropertyManager(itRectF.next()->subDoublePropertyManager()); - QList colorPropertyManagers = qFindChildren(manager); + QList colorPropertyManagers = manager->findChildren(); QListIterator itColor(colorPropertyManagers); while (itColor.hasNext()) { QtColorPropertyManager *manager = itColor.next(); @@ -2144,12 +2005,12 @@ void QtVariantEditorFactory::connectPropertyManager(QtVariantPropertyManager *ma d_ptr->m_spinBoxFactory->addPropertyManager(manager->subIntPropertyManager()); } - QList enumPropertyManagers = qFindChildren(manager); + QList enumPropertyManagers = manager->findChildren(); QListIterator itEnum(enumPropertyManagers); while (itEnum.hasNext()) d_ptr->m_comboBoxFactory->addPropertyManager(itEnum.next()); - QList sizePolicyPropertyManagers = qFindChildren(manager); + QList sizePolicyPropertyManagers = manager->findChildren(); QListIterator itSizePolicy(sizePolicyPropertyManagers); while (itSizePolicy.hasNext()) { QtSizePolicyPropertyManager *manager = itSizePolicy.next(); @@ -2157,7 +2018,7 @@ void QtVariantEditorFactory::connectPropertyManager(QtVariantPropertyManager *ma d_ptr->m_comboBoxFactory->addPropertyManager(manager->subEnumPropertyManager()); } - QList fontPropertyManagers = qFindChildren(manager); + QList fontPropertyManagers = manager->findChildren(); QListIterator itFont(fontPropertyManagers); while (itFont.hasNext()) { QtFontPropertyManager *manager = itFont.next(); @@ -2167,12 +2028,12 @@ void QtVariantEditorFactory::connectPropertyManager(QtVariantPropertyManager *ma d_ptr->m_checkBoxFactory->addPropertyManager(manager->subBoolPropertyManager()); } - QList cursorPropertyManagers = qFindChildren(manager); + QList cursorPropertyManagers = manager->findChildren(); QListIterator itCursor(cursorPropertyManagers); while (itCursor.hasNext()) d_ptr->m_cursorEditorFactory->addPropertyManager(itCursor.next()); - QList flagPropertyManagers = qFindChildren(manager); + QList flagPropertyManagers = manager->findChildren(); QListIterator itFlag(flagPropertyManagers); while (itFlag.hasNext()) d_ptr->m_checkBoxFactory->addPropertyManager(itFlag.next()->subBoolPropertyManager()); @@ -2200,87 +2061,87 @@ QWidget *QtVariantEditorFactory::createEditor(QtVariantPropertyManager *manager, */ void QtVariantEditorFactory::disconnectPropertyManager(QtVariantPropertyManager *manager) { - QList intPropertyManagers = qFindChildren(manager); + QList intPropertyManagers = manager->findChildren(); QListIterator itInt(intPropertyManagers); while (itInt.hasNext()) d_ptr->m_spinBoxFactory->removePropertyManager(itInt.next()); - QList doublePropertyManagers = qFindChildren(manager); + QList doublePropertyManagers = manager->findChildren(); QListIterator itDouble(doublePropertyManagers); while (itDouble.hasNext()) d_ptr->m_doubleSpinBoxFactory->removePropertyManager(itDouble.next()); - QList boolPropertyManagers = qFindChildren(manager); + QList boolPropertyManagers = manager->findChildren(); QListIterator itBool(boolPropertyManagers); while (itBool.hasNext()) d_ptr->m_checkBoxFactory->removePropertyManager(itBool.next()); - QList stringPropertyManagers = qFindChildren(manager); + QList stringPropertyManagers = manager->findChildren(); QListIterator itString(stringPropertyManagers); while (itString.hasNext()) d_ptr->m_lineEditFactory->removePropertyManager(itString.next()); - QList datePropertyManagers = qFindChildren(manager); + QList datePropertyManagers = manager->findChildren(); QListIterator itDate(datePropertyManagers); while (itDate.hasNext()) d_ptr->m_dateEditFactory->removePropertyManager(itDate.next()); - QList timePropertyManagers = qFindChildren(manager); + QList timePropertyManagers = manager->findChildren(); QListIterator itTime(timePropertyManagers); while (itTime.hasNext()) d_ptr->m_timeEditFactory->removePropertyManager(itTime.next()); - QList dateTimePropertyManagers = qFindChildren(manager); + QList dateTimePropertyManagers = manager->findChildren(); QListIterator itDateTime(dateTimePropertyManagers); while (itDateTime.hasNext()) d_ptr->m_dateTimeEditFactory->removePropertyManager(itDateTime.next()); - QList keySequencePropertyManagers = qFindChildren(manager); + QList keySequencePropertyManagers = manager->findChildren(); QListIterator itKeySequence(keySequencePropertyManagers); while (itKeySequence.hasNext()) d_ptr->m_keySequenceEditorFactory->removePropertyManager(itKeySequence.next()); - QList charPropertyManagers = qFindChildren(manager); + QList charPropertyManagers = manager->findChildren(); QListIterator itChar(charPropertyManagers); while (itChar.hasNext()) d_ptr->m_charEditorFactory->removePropertyManager(itChar.next()); - QList localePropertyManagers = qFindChildren(manager); + QList localePropertyManagers = manager->findChildren(); QListIterator itLocale(localePropertyManagers); while (itLocale.hasNext()) d_ptr->m_comboBoxFactory->removePropertyManager(itLocale.next()->subEnumPropertyManager()); - QList pointPropertyManagers = qFindChildren(manager); + QList pointPropertyManagers = manager->findChildren(); QListIterator itPoint(pointPropertyManagers); while (itPoint.hasNext()) d_ptr->m_spinBoxFactory->removePropertyManager(itPoint.next()->subIntPropertyManager()); - QList pointFPropertyManagers = qFindChildren(manager); + QList pointFPropertyManagers = manager->findChildren(); QListIterator itPointF(pointFPropertyManagers); while (itPointF.hasNext()) d_ptr->m_doubleSpinBoxFactory->removePropertyManager(itPointF.next()->subDoublePropertyManager()); - QList sizePropertyManagers = qFindChildren(manager); + QList sizePropertyManagers = manager->findChildren(); QListIterator itSize(sizePropertyManagers); while (itSize.hasNext()) d_ptr->m_spinBoxFactory->removePropertyManager(itSize.next()->subIntPropertyManager()); - QList sizeFPropertyManagers = qFindChildren(manager); + QList sizeFPropertyManagers = manager->findChildren(); QListIterator itSizeF(sizeFPropertyManagers); while (itSizeF.hasNext()) d_ptr->m_doubleSpinBoxFactory->removePropertyManager(itSizeF.next()->subDoublePropertyManager()); - QList rectPropertyManagers = qFindChildren(manager); + QList rectPropertyManagers = manager->findChildren(); QListIterator itRect(rectPropertyManagers); while (itRect.hasNext()) d_ptr->m_spinBoxFactory->removePropertyManager(itRect.next()->subIntPropertyManager()); - QList rectFPropertyManagers = qFindChildren(manager); + QList rectFPropertyManagers = manager->findChildren(); QListIterator itRectF(rectFPropertyManagers); while (itRectF.hasNext()) d_ptr->m_doubleSpinBoxFactory->removePropertyManager(itRectF.next()->subDoublePropertyManager()); - QList colorPropertyManagers = qFindChildren(manager); + QList colorPropertyManagers = manager->findChildren(); QListIterator itColor(colorPropertyManagers); while (itColor.hasNext()) { QtColorPropertyManager *manager = itColor.next(); @@ -2288,12 +2149,12 @@ void QtVariantEditorFactory::disconnectPropertyManager(QtVariantPropertyManager d_ptr->m_spinBoxFactory->removePropertyManager(manager->subIntPropertyManager()); } - QList enumPropertyManagers = qFindChildren(manager); + QList enumPropertyManagers = manager->findChildren(); QListIterator itEnum(enumPropertyManagers); while (itEnum.hasNext()) d_ptr->m_comboBoxFactory->removePropertyManager(itEnum.next()); - QList sizePolicyPropertyManagers = qFindChildren(manager); + QList sizePolicyPropertyManagers = manager->findChildren(); QListIterator itSizePolicy(sizePolicyPropertyManagers); while (itSizePolicy.hasNext()) { QtSizePolicyPropertyManager *manager = itSizePolicy.next(); @@ -2301,7 +2162,7 @@ void QtVariantEditorFactory::disconnectPropertyManager(QtVariantPropertyManager d_ptr->m_comboBoxFactory->removePropertyManager(manager->subEnumPropertyManager()); } - QList fontPropertyManagers = qFindChildren(manager); + QList fontPropertyManagers = manager->findChildren(); QListIterator itFont(fontPropertyManagers); while (itFont.hasNext()) { QtFontPropertyManager *manager = itFont.next(); @@ -2311,19 +2172,17 @@ void QtVariantEditorFactory::disconnectPropertyManager(QtVariantPropertyManager d_ptr->m_checkBoxFactory->removePropertyManager(manager->subBoolPropertyManager()); } - QList cursorPropertyManagers = qFindChildren(manager); + QList cursorPropertyManagers = manager->findChildren(); QListIterator itCursor(cursorPropertyManagers); while (itCursor.hasNext()) d_ptr->m_cursorEditorFactory->removePropertyManager(itCursor.next()); - QList flagPropertyManagers = qFindChildren(manager); + QList flagPropertyManagers = manager->findChildren(); QListIterator itFlag(flagPropertyManagers); while (itFlag.hasNext()) d_ptr->m_checkBoxFactory->removePropertyManager(itFlag.next()->subBoolPropertyManager()); } -#if QT_VERSION >= 0x040400 QT_END_NAMESPACE -#endif -#include "moc_qtvariantproperty.cxx" +//#include "moc_qtvariantproperty.cpp" diff --git a/code/studio/src/3rdparty/qtpropertybrowser/qtvariantproperty.h b/code/studio/src/3rdparty/qtpropertybrowser/qtvariantproperty.h index 9f20d3dd4..2d3b5d4a8 100644 --- a/code/studio/src/3rdparty/qtpropertybrowser/qtvariantproperty.h +++ b/code/studio/src/3rdparty/qtpropertybrowser/qtvariantproperty.h @@ -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 -#include +#include +#include -#if QT_VERSION >= 0x040400 QT_BEGIN_NAMESPACE -#endif typedef QMap 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 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 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 +class QtVariantEditorFactory : public QtAbstractEditorFactory { Q_OBJECT public: @@ -218,14 +165,91 @@ protected: QWidget *parent); void disconnectPropertyManager(QtVariantPropertyManager *manager); private: - QtVariantEditorFactoryPrivate *d_ptr; + QScopedPointer 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 ®Exp); + 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 &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 m_typeToPropertyManager; + QMap > m_typeToAttributeToAttributeType; + + QMap > m_propertyToType; + + QMap m_typeToValueType; + + + QMap 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) diff --git a/code/studio/src/CMakeLists.txt b/code/studio/src/CMakeLists.txt index 510f0f93b..683c70098 100644 --- a/code/studio/src/CMakeLists.txt +++ b/code/studio/src/CMakeLists.txt @@ -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}) -INCLUDE( ${QT_USE_FILE} ) + +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) -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}) +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} ) + ${STUDIO_SRC} + ${STUDIO_MOC_SRCS} + ${STUDIO_RC_SRCS} + ${STUDIO_RC} + ${STUDIO_PLUGIN_UIS}) +ENDIF(WITH_QT5) TARGET_LINK_LIBRARIES(studio - nelmisc + nelmisc) + +IF(WITH_QT5) + TARGET_LINK_LIBRARIES(studio + Qt5::Widgets) +ELSE(WITH_QT5) + TARGET_LINK_LIBRARIES(studio ${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) diff --git a/code/studio/src/extension_system/iplugin.h b/code/studio/src/extension_system/iplugin.h index 973f80e14..6b3e9d7d7 100644 --- a/code/studio/src/extension_system/iplugin.h +++ b/code/studio/src/extension_system/iplugin.h @@ -19,9 +19,9 @@ #ifndef IPLUGIN_H #define IPLUGIN_H -#include -#include -#include +#include +#include +#include #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 diff --git a/code/studio/src/extension_system/iplugin_manager.h b/code/studio/src/extension_system/iplugin_manager.h index f60f45890..5abb3da91 100644 --- a/code/studio/src/extension_system/iplugin_manager.h +++ b/code/studio/src/extension_system/iplugin_manager.h @@ -21,10 +21,10 @@ #include "iplugin_spec.h" -#include -#include -#include -#include +#include +#include +#include +#include namespace ExtensionSystem { diff --git a/code/studio/src/extension_system/iplugin_spec.h b/code/studio/src/extension_system/iplugin_spec.h index 2aefbb894..4e1569562 100644 --- a/code/studio/src/extension_system/iplugin_spec.h +++ b/code/studio/src/extension_system/iplugin_spec.h @@ -19,7 +19,7 @@ #ifndef IPLUGINSPEC_H #define IPLUGINSPEC_H -#include +#include namespace ExtensionSystem { diff --git a/code/studio/src/extension_system/plugin_spec.cpp b/code/studio/src/extension_system/plugin_spec.cpp index 97a08ea64..8f23db976 100644 --- a/code/studio/src/extension_system/plugin_spec.cpp +++ b/code/studio/src/extension_system/plugin_spec.cpp @@ -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; diff --git a/code/studio/src/main.cpp b/code/studio/src/main.cpp index dc1e7efb6..2a32ab309 100644 --- a/code/studio/src/main.cpp +++ b/code/studio/src/main.cpp @@ -35,11 +35,11 @@ #include #include #include -#include -#include +#include +#include //#include -#include -#include +#include +#include #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 diff --git a/code/studio/src/plugins/CMakeLists.txt b/code/studio/src/plugins/CMakeLists.txt index 5916be455..0a8a5176e 100644 --- a/code/studio/src/plugins/CMakeLists.txt +++ b/code/studio/src/plugins/CMakeLists.txt @@ -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) diff --git a/code/studio/src/plugins/core/CMakeLists.txt b/code/studio/src/plugins/core/CMakeLists.txt index db99b807c..d021c7c02 100644 --- a/code/studio/src/plugins/core/CMakeLists.txt +++ b/code/studio/src/plugins/core/CMakeLists.txt @@ -45,9 +45,16 @@ ENDIF(NOT WIN32) SET(QT_USE_QTGUI TRUE) SET(QT_USE_QTOPENGL TRUE) -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}) +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) diff --git a/code/studio/src/plugins/core/Nel3DWidget/nel3d_widget.cpp b/code/studio/src/plugins/core/Nel3DWidget/nel3d_widget.cpp index bc83b5d78..7ac7c468e 100644 --- a/code/studio/src/plugins/core/Nel3DWidget/nel3d_widget.cpp +++ b/code/studio/src/plugins/core/Nel3DWidget/nel3d_widget.cpp @@ -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 ) diff --git a/code/studio/src/plugins/core/context_manager.cpp b/code/studio/src/plugins/core/context_manager.cpp index 203738faf..e3b712e81 100644 --- a/code/studio/src/plugins/core/context_manager.cpp +++ b/code/studio/src/plugins/core/context_manager.cpp @@ -24,8 +24,8 @@ #include // Qt includes -#include -#include +#include +#include namespace Core { diff --git a/code/studio/src/plugins/core/context_manager.h b/code/studio/src/plugins/core/context_manager.h index 9b0a62c7e..4f17f4748 100644 --- a/code/studio/src/plugins/core/context_manager.h +++ b/code/studio/src/plugins/core/context_manager.h @@ -22,7 +22,7 @@ #include "core_global.h" // Qt includes -#include +#include QT_BEGIN_NAMESPACE class QTabWidget; diff --git a/code/studio/src/plugins/core/core_global.h b/code/studio/src/plugins/core/core_global.h index 48fe0ece9..550151961 100644 --- a/code/studio/src/plugins/core/core_global.h +++ b/code/studio/src/plugins/core/core_global.h @@ -19,7 +19,7 @@ #ifndef CORE_GLOBAL_H #define CORE_GLOBAL_H -#include +#include #if defined(CORE_LIBRARY) # define CORE_EXPORT Q_DECL_EXPORT diff --git a/code/studio/src/plugins/core/core_plugin.cpp b/code/studio/src/plugins/core/core_plugin.cpp index a72a68ccc..8ec5cbb7c 100644 --- a/code/studio/src/plugins/core/core_plugin.cpp +++ b/code/studio/src/plugins/core/core_plugin.cpp @@ -27,12 +27,12 @@ #include "nel/misc/debug.h" // Qt includes -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include using namespace Core; @@ -101,4 +101,4 @@ void CorePlugin::addAutoReleasedObject(QObject *obj) m_autoReleaseObjects.prepend(obj); } -Q_EXPORT_PLUGIN(CorePlugin) +// Q_EXPORT_PLUGIN(CorePlugin) diff --git a/code/studio/src/plugins/core/core_plugin.h b/code/studio/src/plugins/core/core_plugin.h index 5062227e3..08719e91b 100644 --- a/code/studio/src/plugins/core/core_plugin.h +++ b/code/studio/src/plugins/core/core_plugin.h @@ -23,7 +23,7 @@ #include "nel/misc/app_context.h" -#include +#include 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: diff --git a/code/studio/src/plugins/core/general_settings_page.cpp b/code/studio/src/plugins/core/general_settings_page.cpp index bfbb06d66..ac321fae7 100644 --- a/code/studio/src/plugins/core/general_settings_page.cpp +++ b/code/studio/src/plugins/core/general_settings_page.cpp @@ -24,12 +24,12 @@ #include // Qt includes -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/code/studio/src/plugins/core/general_settings_page.h b/code/studio/src/plugins/core/general_settings_page.h index 66eacd189..7dbe8d21d 100644 --- a/code/studio/src/plugins/core/general_settings_page.h +++ b/code/studio/src/plugins/core/general_settings_page.h @@ -19,7 +19,7 @@ #ifndef GENERAL_SETTINGS_PAGE_H #define GENERAL_SETTINGS_PAGE_H -#include +#include #include "ioptions_page.h" diff --git a/code/studio/src/plugins/core/icontext.h b/code/studio/src/plugins/core/icontext.h index 616e0db14..5ba37d826 100644 --- a/code/studio/src/plugins/core/icontext.h +++ b/code/studio/src/plugins/core/icontext.h @@ -22,9 +22,9 @@ #include "core_global.h" // Qt includes -#include -#include -#include +#include +#include +#include QT_BEGIN_NAMESPACE class QWidget; diff --git a/code/studio/src/plugins/core/icore.h b/code/studio/src/plugins/core/icore.h index 4f1ee474f..eabe6e6fa 100644 --- a/code/studio/src/plugins/core/icore.h +++ b/code/studio/src/plugins/core/icore.h @@ -21,7 +21,7 @@ #include "core_global.h" -#include +#include QT_BEGIN_NAMESPACE class QMainWindow; diff --git a/code/studio/src/plugins/core/icore_listener.h b/code/studio/src/plugins/core/icore_listener.h index c27e40242..1fffaef0e 100644 --- a/code/studio/src/plugins/core/icore_listener.h +++ b/code/studio/src/plugins/core/icore_listener.h @@ -23,7 +23,7 @@ #include "core_global.h" // Qt includes -#include +#include QT_BEGIN_NAMESPACE class QWidget; diff --git a/code/studio/src/plugins/core/ioptions_page.h b/code/studio/src/plugins/core/ioptions_page.h index 4d9ed6fda..303e932f9 100644 --- a/code/studio/src/plugins/core/ioptions_page.h +++ b/code/studio/src/plugins/core/ioptions_page.h @@ -23,7 +23,7 @@ #include "core_global.h" // Qt includes -#include +#include QT_BEGIN_NAMESPACE class QWidget; diff --git a/code/studio/src/plugins/core/main_window.cpp b/code/studio/src/plugins/core/main_window.cpp index c181376e8..df1b87937 100644 --- a/code/studio/src/plugins/core/main_window.cpp +++ b/code/studio/src/plugins/core/main_window.cpp @@ -29,9 +29,14 @@ #include // Qt includes -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include namespace Core { diff --git a/code/studio/src/plugins/core/main_window.h b/code/studio/src/plugins/core/main_window.h index d258a5eba..df139fed3 100644 --- a/code/studio/src/plugins/core/main_window.h +++ b/code/studio/src/plugins/core/main_window.h @@ -25,9 +25,9 @@ // STL includes // Qt includes -#include -#include -#include +#include +#include +#include namespace Core { diff --git a/code/studio/src/plugins/core/menu_manager.h b/code/studio/src/plugins/core/menu_manager.h index fd6af8f3a..3336d6476 100644 --- a/code/studio/src/plugins/core/menu_manager.h +++ b/code/studio/src/plugins/core/menu_manager.h @@ -22,12 +22,12 @@ #include "core_global.h" // Qt includes -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include namespace Core { diff --git a/code/studio/src/plugins/core/plugin_view_dialog.cpp b/code/studio/src/plugins/core/plugin_view_dialog.cpp index cccc98509..7ef960606 100644 --- a/code/studio/src/plugins/core/plugin_view_dialog.cpp +++ b/code/studio/src/plugins/core/plugin_view_dialog.cpp @@ -21,10 +21,10 @@ #include "nel/misc/debug.h" // Qt includes -#include -#include -#include -#include +#include +#include +#include +#include #include #include diff --git a/code/studio/src/plugins/core/plugin_view_dialog.h b/code/studio/src/plugins/core/plugin_view_dialog.h index e7c1123c1..4db2ec214 100644 --- a/code/studio/src/plugins/core/plugin_view_dialog.h +++ b/code/studio/src/plugins/core/plugin_view_dialog.h @@ -20,8 +20,8 @@ #include "ui_plugin_view_dialog.h" -#include -#include +#include +#include namespace ExtensionSystem { diff --git a/code/studio/src/plugins/core/search_paths_settings_page.cpp b/code/studio/src/plugins/core/search_paths_settings_page.cpp index 516d3d3f3..e9b99836c 100644 --- a/code/studio/src/plugins/core/search_paths_settings_page.cpp +++ b/code/studio/src/plugins/core/search_paths_settings_page.cpp @@ -24,9 +24,9 @@ #include // Qt includes -#include -#include -#include +#include +#include +#include #if !defined NL_OS_WINDOWS #include "core_config.h" diff --git a/code/studio/src/plugins/core/search_paths_settings_page.h b/code/studio/src/plugins/core/search_paths_settings_page.h index c45b29571..1e860e957 100644 --- a/code/studio/src/plugins/core/search_paths_settings_page.h +++ b/code/studio/src/plugins/core/search_paths_settings_page.h @@ -19,7 +19,7 @@ #ifndef SEARCH_PATHS_SETTINGS_PAGE_H #define SEARCH_PATHS_SETTINGS_PAGE_H -#include +#include #include "ioptions_page.h" diff --git a/code/studio/src/plugins/core/settings_dialog.cpp b/code/studio/src/plugins/core/settings_dialog.cpp index b1027212c..2a5b7d2ed 100644 --- a/code/studio/src/plugins/core/settings_dialog.cpp +++ b/code/studio/src/plugins/core/settings_dialog.cpp @@ -21,8 +21,8 @@ #include "ioptions_page.h" // Qt includes -#include -#include +#include +#include struct PageData { diff --git a/code/studio/src/plugins/core/settings_dialog.h b/code/studio/src/plugins/core/settings_dialog.h index 9e1c86444..9aa3e9e69 100644 --- a/code/studio/src/plugins/core/settings_dialog.h +++ b/code/studio/src/plugins/core/settings_dialog.h @@ -22,7 +22,7 @@ #include "ui_settings_dialog.h" // Qt includes -#include +#include // Project includes #include "../../extension_system/iplugin_manager.h"