Compare commits

...

26 Commits

Author SHA1 Message Date
kaetemi 65d842a7ff Some more tweaks
--HG--
branch : qt5
10 years ago
kaetemi 44bb0e85c2 Qt5 service displayer
--HG--
branch : qt5
10 years ago
kaetemi 958e6f80bd Restructure qt displayer for thread separation
--HG--
branch : qt5
10 years ago
kaetemi f3a1fb0b83 Restructure displayer to have reusable stringify
--HG--
branch : qt5
10 years ago
kaetemi 95c54682b5 Library-ize some things
--HG--
branch : qt5
10 years ago
kaetemi 20835ab697 Remove deprecated command
--HG--
branch : qt5
10 years ago
kaetemi 9faa981d82 Merge with develop
--HG--
branch : qt5
10 years ago
kaetemi 8a254846a2 Merge with feature-crashreport+qt5
--HG--
branch : qt5
10 years ago
kaetemi 27b7b7cb42 Merge with feature-crashreport+develop
--HG--
branch : feature-crashreport+qt5
10 years ago
kaetemi 47ae5b5013 Merge with feature-crashreport+develop
--HG--
branch : feature-crashreport+qt5
10 years ago
kaetemi fee4849b3a Merge with feature-crashreport+develop
--HG--
branch : feature-crashreport+qt5
10 years ago
kaetemi c5ec0a9223 Qt5 compile settings for crash report tool
--HG--
branch : feature-crashreport+qt5
10 years ago
kaetemi 46c4bf1c24 Merge with qt5
--HG--
branch : feature-crashreport+qt5
10 years ago
kaetemi 8efecd19d4 Branch feature-crashreport+qt5 (for development of qt5 support for crash report tool)
--HG--
branch : feature-crashreport+qt5
10 years ago
kaetemi ad0571888e Bigfux
--HG--
branch : qt5
10 years ago
kaetemi c7f729a198 Remove some debugging
--HG--
branch : qt5
10 years ago
kaetemi 8cf1f7108d Implement panoply_preview tool
--HG--
branch : qt5
10 years ago
kaetemi f3631745a1 Implement panoply_preview interface
--HG--
branch : qt5
10 years ago
kaetemi 6f8435de20 Add panoply_preview tool placeholder
--HG--
branch : qt5
10 years ago
kaetemi fdb90b8b43 Qt5 no debug
--HG--
branch : qt5
10 years ago
kaetemi 6c1feef403 Merge with develop
--HG--
branch : qt5
10 years ago
kaetemi f79b66ca82 Qt5 build fixes (plugins/core)
--HG--
branch : qt5
10 years ago
kaetemi 885a7570f2 Qt5 build fixes
--HG--
branch : qt5
10 years ago
kaetemi 0cd6da40bf Qt5 build fixes
--HG--
branch : qt5
10 years ago
kaetemi ef81ffc4d9 Qt5 build fixes
--HG--
branch : qt5
10 years ago
kaetemi 86ed0efc65 Qt5 NeL sample
--HG--
branch : qt5
10 years ago

@ -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)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/nelqt/include)
ENDIF(WITH_QT5)
IF(WITH_NEL)
IF(WITH_NEL_TESTS)
FIND_PACKAGE(CppTest)
@ -186,6 +194,10 @@ IF(WITH_NEL)
ADD_SUBDIRECTORY(nel)
ENDIF(WITH_NEL)
IF(WITH_QT5)
ADD_SUBDIRECTORY(nelqt)
ENDIF(WITH_QT5)
IF(WITH_RYZOM)
ADD_SUBDIRECTORY(ryzom)
ENDIF(WITH_RYZOM)

@ -78,6 +78,7 @@ ENDMACRO(NL_GEN_REVISION_H)
#
###
MACRO(NL_TARGET_LIB name)
CMAKE_POLICY(SET CMP0020 NEW)
IF(WITH_STATIC)
ADD_LIBRARY(${name} STATIC ${ARGN})
ELSE(WITH_STATIC)
@ -232,9 +233,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 +279,9 @@ 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)
OPTION(WITH_NET_QT5 "Use QT5 inside NLNET" OFF)
IF(WIN32 AND MFC_FOUND)
OPTION(WITH_MFC "With MFC Support" ON )

@ -37,6 +37,10 @@ IF(WITH_GTK)
FIND_PACKAGE(GTK2)
ENDIF(WITH_GTK)
IF(WITH_QT5 AND WITH_NET_QT5)
ADD_DEFINITIONS(-DNLNET_USE_QT5)
ENDIF(WITH_QT5 AND WITH_NET_QT5)
IF(WITH_LIBOVR)
FIND_PACKAGE(LibOVR)
ENDIF(WITH_LIBOVR)

@ -54,7 +54,7 @@ private:
void updateLabels ();
// called by DT only
void open (std::string titleBar, bool iconified, sint x, sint y, sint w, sint h, sint hs, sint fs, const std::string &fn, bool ww, CLog *log);
void open (int argc, char **argv, std::string titleBar, bool iconified, sint x, sint y, sint w, sint h, sint hs, sint fs, const std::string &fn, bool ww, CLog *log);
// called by DT only
void clear ();
// called by DT only

@ -73,7 +73,7 @@ private:
void updateLabels ();
// called by DT only
void open (std::string titleBar, bool iconified, sint x, sint y, sint w, sint h, sint hs, sint fs, const std::string &fn, bool ww, CLog *log);
void open(int argc, char **argv, std::string titleBar, bool iconified, sint x, sint y, sint w, sint h, sint hs, sint fs, const std::string &fn, bool ww, CLog *log);
// called by DT only
void clear ();
// called by DT only

@ -48,7 +48,7 @@ public:
virtual ~CWindowDisplayer ();
// open the window and run the display thread (MT)
void create (std::string titleBar = "", bool iconified = false, sint x = -1, sint y = -1, sint w = -1, sint h = -1, sint hs = -1, sint fs = 0, const std::string &fn = "", bool ww = false, CLog *log = InfoLog);
void create(int argc, char **argv, std::string titleBar = "", bool iconified = false, sint x = -1, sint y = -1, sint w = -1, sint h = -1, sint hs = -1, sint fs = 0, const std::string &fn = "", bool ww = false, CLog *log = InfoLog);
// create a new label. empty string mean separator. start with @ means that is a command (MT)
uint createLabel (const char *value = "?");
@ -62,12 +62,13 @@ public:
// set a special title to the window bar
virtual void setTitleBar (const std::string &/* titleBar */) { }
virtual void getWindowPos (uint32 &x, uint32 &y, uint32 &w, uint32 &h) { x=y=w=h=0; }
virtual void getWindowPos(uint32 &x, uint32 &y, uint32 &w, uint32 &h) { x = y = w = h = 0; }
protected:
static std::string stringifyMessage(const NLMISC::CLog::TDisplayInfo &args, const char *message, bool needSlashR = false);
protected:
// display a string (MT)
virtual void doDisplay (const NLMISC::CLog::TDisplayInfo &args, const char *message);
virtual void doDisplay(const NLMISC::CLog::TDisplayInfo &args, const char *message);
// true for windows
bool needSlashR;
@ -87,7 +88,7 @@ protected:
CSynchronized<std::vector<std::string> > _CommandsToExecute;
// called by DT only
virtual void open (std::string titleBar, bool iconified, sint x, sint y, sint w, sint h, sint hs, sint fs, const std::string &fn, bool ww, CLog *log) = 0;
virtual void open(int argc, char **argv, std::string titleBar, bool iconified, sint x, sint y, sint w, sint h, sint hs, sint fs, const std::string &fn, bool ww, CLog *log) = 0;
// called by DT only
virtual void display_main () = 0;

@ -14,7 +14,6 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NL_SERVICE_H
#define NL_SERVICE_H
@ -124,7 +123,7 @@ int APIENTRY WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdL
scn->setArgs (lpCmdLine); \
createDebug(NULL,!scn->haveLongArg("nolog"));\
scn->setCallbackArray (__ServiceCallbackArray, sizeof(__ServiceCallbackArray)/sizeof(__ServiceCallbackArray[0])); \
sint retval = scn->main (__ServiceShortName, __ServiceLongName, __ServicePort, __ConfigDir, __LogDir, __DATE__" "__TIME__); \
sint retval = scn->main (__argc, __argv, __ServiceShortName, __ServiceLongName, __ServicePort, __ConfigDir, __LogDir, __DATE__" "__TIME__); \
delete scn; \
return retval; \
}
@ -132,14 +131,14 @@ int APIENTRY WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdL
#else
#define NLNET_SERVICE_MAIN(__ServiceClassName, __ServiceShortName, __ServiceLongName, __ServicePort, __ServiceCallbackArray, __ConfigDir, __LogDir) \
\
int main(int argc, const char **argv) \
int main(int argc, char **argv) \
{ \
NLMISC::CApplicationContext serviceContext; \
__ServiceClassName *scn = new __ServiceClassName; \
scn->setArgs (argc, argv); \
scn->setArgs (argc, (const char **)argv); \
createDebug(NULL,!scn->haveLongArg("nolog"));\
scn->setCallbackArray (__ServiceCallbackArray, sizeof(__ServiceCallbackArray)/sizeof(__ServiceCallbackArray[0])); \
sint retval = scn->main (__ServiceShortName, __ServiceLongName, __ServicePort, __ConfigDir, __LogDir, __DATE__" "__TIME__); \
sint retval = scn->main (argc, argv, __ServiceShortName, __ServiceLongName, __ServicePort, __ConfigDir, __LogDir, __DATE__" "__TIME__); \
delete scn; \
return retval; \
}
@ -335,7 +334,7 @@ public:
// @{
/// This main is called by the macro (service5 says if we have to use layer5 or not)
sint main (const char *serviceShortName, const char *serviceLongName, uint16 servicePort, const char *configDir, const char *logDir, const char *compilationDate);
sint main(int argc, char **argv, const char *serviceShortName, const char *serviceLongName, uint16 servicePort, const char *configDir, const char *logDir, const char *compilationDate);
/// Sets the command line and init _Args variable. You must call this before calling main()
void setArgs (int argc, const char **argv);

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

@ -0,0 +1,25 @@
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)
INSTALL(TARGETS nl_sample_qt RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT samples3d)

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -2,8 +2,6 @@ ADD_EXECUTABLE(nl_sample_chatclient client.cpp kbhit.cpp kbhit.h)
ADD_EXECUTABLE(nl_sample_chatserver WIN32 server.cpp)
ADD_DEFINITIONS(-DCHAT_DIR="\\"${NL_SHARE_ABSOLUTE_PREFIX}/nl_sample_chat/\\"")
TARGET_LINK_LIBRARIES(nl_sample_chatclient nelmisc nelnet)
NL_DEFAULT_PROPS(nl_sample_chatclient "NeL, Samples, Net, Chat: Chat Client")
NL_ADD_RUNTIME_FLAGS(nl_sample_chatclient)

@ -266,7 +266,7 @@ void CGtkDisplayer::setTitleBar (const string &titleBar)
gtk_window_set_title (GTK_WINDOW (RootWindow), wn.c_str());
}
void CGtkDisplayer::open (std::string titleBar, bool iconified, sint x, sint y, sint w, sint h, sint hs, sint fs, const std::string &fn, bool ww, CLog *log)
void CGtkDisplayer::open (int argc, char **argv, std::string titleBar, bool iconified, sint x, sint y, sint w, sint h, sint hs, sint fs, const std::string &fn, bool ww, CLog *log)
{
_HistorySize = hs;

@ -357,7 +357,7 @@ void CWinDisplayer::setTitleBar (const string &titleBar)
SetWindowTextW (_HWnd, (LPWSTR)ucstring::makeFromUtf8(wn).c_str());
}
void CWinDisplayer::open (string titleBar, bool iconified, sint x, sint y, sint w, sint h, sint hs, sint fs, const std::string &fn, bool ww, CLog *log)
void CWinDisplayer::open(int argc, char **argv, string titleBar, bool iconified, sint x, sint y, sint w, sint h, sint hs, sint fs, const std::string &fn, bool ww, CLog *log)
{
if (w == -1)
w = 700;

@ -33,6 +33,8 @@ namespace NLMISC {
class CUpdateThread : public IRunnable
{
CWindowDisplayer *Disp;
int ArgC;
char **ArgV;
string WindowNameEx;
sint X, Y, W, H, HS;
bool Iconified;
@ -42,14 +44,14 @@ class CUpdateThread : public IRunnable
CLog *Log;
public:
CUpdateThread (CWindowDisplayer *disp, string windowNameEx, bool iconified, sint x, sint y, sint w, sint h, sint hs, sint fs, const std::string &fn, bool ww, CLog *log) :
Disp(disp), WindowNameEx(windowNameEx), X(x), Y(y), W(w), H(h), HS(hs), Iconified(iconified), FS(fs), FN(fn), WW(ww), Log(log)
CUpdateThread(CWindowDisplayer *disp, int argc, char **argv, string windowNameEx, bool iconified, sint x, sint y, sint w, sint h, sint hs, sint fs, const std::string &fn, bool ww, CLog *log) :
Disp(disp), ArgC(argc), ArgV(argv), WindowNameEx(windowNameEx), X(x), Y(y), W(w), H(h), HS(hs), Iconified(iconified), FS(fs), FN(fn), WW(ww), Log(log)
{
}
void run()
{
Disp->open (WindowNameEx, Iconified, X, Y, W, H, HS, FS, FN, WW, Log);
Disp->open(ArgC, ArgV, WindowNameEx, Iconified, X, Y, W, H, HS, FS, FN, WW, Log);
Disp->display_main ();
}
};
@ -68,8 +70,7 @@ bool CWindowDisplayer::update ()
vector<string> copy;
{
CSynchronized<std::vector<std::string> >::CAccessor access (&_CommandsToExecute);
copy = access.value();
access.value().clear ();
copy.swap(access.value());
}
// execute all commands in the main thread
@ -106,36 +107,30 @@ void CWindowDisplayer::setLabel (uint label, const string &value)
}
}
void CWindowDisplayer::create (string windowNameEx, bool iconified, sint x, sint y, sint w, sint h, sint hs, sint fs, const std::string &fn, bool ww, CLog *log)
void CWindowDisplayer::create(int argc, char **argv, string windowNameEx, bool iconified, sint x, sint y, sint w, sint h, sint hs, sint fs, const std::string &fn, bool ww, CLog *log)
{
nlassert (_Thread == NULL);
_Thread = IThread::create (new CUpdateThread(this, windowNameEx, iconified, x, y, w, h, hs, fs, fn, ww, log));
_Thread = IThread::create(new CUpdateThread(this, argc, argv, windowNameEx, iconified, x, y, w, h, hs, fs, fn, ww, log));
Log = log;
_Thread->start ();
}
void CWindowDisplayer::doDisplay (const NLMISC::CLog::TDisplayInfo &args, const char *message)
std::string CWindowDisplayer::stringifyMessage(const NLMISC::CLog::TDisplayInfo &args, const char *message, bool needSlashR)
{
bool needSpace = false;
//stringstream ss;
string str;
uint32 color = 0xFF000000;
if (args.LogType != CLog::LOG_NO)
{
str += logTypeToString(args.LogType);
if (args.LogType == CLog::LOG_ERROR || args.LogType == CLog::LOG_ASSERT) color = 0x00FF0000;
else if (args.LogType == CLog::LOG_WARNING) color = 0x00800000;
else if (args.LogType == CLog::LOG_DEBUG) color = 0x00808080;
else color = 0;
str += CWindowDisplayer::logTypeToString(args.LogType);
needSpace = true;
}
// Write thread identifier
if ( args.ThreadId != 0 )
if (args.ThreadId != 0)
{
if (needSpace) { str += " "; needSpace = false; }
#ifdef NL_OS_WINDOWS
@ -173,7 +168,7 @@ void CWindowDisplayer::doDisplay (const NLMISC::CLog::TDisplayInfo &args, const
uint nbl = 1;
char *npos, *pos = const_cast<char *>(message);
while ((npos = strchr (pos, '\n')))
while ((npos = strchr(pos, '\n')))
{
*npos = '\0';
str += pos;
@ -181,13 +176,13 @@ void CWindowDisplayer::doDisplay (const NLMISC::CLog::TDisplayInfo &args, const
str += "\r";
str += "\n";
*npos = '\n';
pos = npos+1;
pos = npos + 1;
nbl++;
}
str += pos;
pos = const_cast<char *>(args.CallstackAndLog.c_str());
while ((npos = strchr (pos, '\n')))
while ((npos = strchr(pos, '\n')))
{
*npos = '\0';
str += pos;
@ -195,11 +190,28 @@ void CWindowDisplayer::doDisplay (const NLMISC::CLog::TDisplayInfo &args, const
str += "\r";
str += "\n";
*npos = '\n';
pos = npos+1;
pos = npos + 1;
nbl++;
}
str += pos;
return str;
}
void CWindowDisplayer::doDisplay (const NLMISC::CLog::TDisplayInfo &args, const char *message)
{
uint32 color = 0xFF000000;
if (args.LogType != CLog::LOG_NO)
{
if (args.LogType == CLog::LOG_ERROR || args.LogType == CLog::LOG_ASSERT) color = 0x00FF0000;
else if (args.LogType == CLog::LOG_WARNING) color = 0x00800000;
else if (args.LogType == CLog::LOG_DEBUG) color = 0x00808080;
else color = 0;
}
std::string str = stringifyMessage(args, message, needSlashR);
{
CSynchronized<std::list<std::pair<uint32, std::string> > >::CAccessor access (&_Buffer);
if (_HistorySize > 0 && access.value().size() >= (uint)_HistorySize)

@ -12,6 +12,10 @@ IF(WITH_GTK)
ENDIF(GTK2_FOUND)
ENDIF(WITH_GTK)
IF(WITH_QT5 AND WITH_NET_QT5)
TARGET_LINK_LIBRARIES(nelnet nelqtdisplayer)
ENDIF(WITH_QT5 AND WITH_NET_QT5)
TARGET_LINK_LIBRARIES(nelnet nelmisc)
SET_TARGET_PROPERTIES(nelnet PROPERTIES LINK_INTERFACE_LIBRARIES "")
NL_DEFAULT_PROPS(nelnet "NeL, Library: NeL Net")

@ -40,6 +40,10 @@
#include "nel/misc/system_info.h"
#include "nel/misc/timeout_assertion_thread.h"
#if NLNET_USE_QT5
# include <nelqt/displayer/service_displayer.h>
#endif
#include "nel/net/naming_client.h"
#include "nel/net/service.h"
#include "nel/net/unified_network.h"
@ -551,7 +555,7 @@ void cbExecuteCommands (CConfigFile::CVar &var)
// The main function of the service
//
sint IService::main (const char *serviceShortName, const char *serviceLongName, uint16 servicePort, const char *configDir, const char *logDir, const char *compilationDate)
sint IService::main(int argc, char **argv, const char *serviceShortName, const char *serviceLongName, uint16 servicePort, const char *configDir, const char *logDir, const char *compilationDate)
{
bool userInitCalled = false;
CConfigFile::CVar *var = NULL;
@ -773,17 +777,24 @@ sint IService::main (const char *serviceShortName, const char *serviceLongName,
#ifdef NL_USE_GTK
if (disp == "GTK")
{
WindowDisplayer = new CGtkDisplayer ("DEFAULT_WD");
WindowDisplayer = new CGtkDisplayer("DEFAULT_WD");
}
#endif // NL_USE_GTK
#ifdef NL_OS_WINDOWS
if (disp == "WIN")
{
WindowDisplayer = new CWinDisplayer ("DEFAULT_WD");
WindowDisplayer = new CWinDisplayer("DEFAULT_WD");
}
#endif // NL_OS_WINDOWS
#ifdef NLNET_USE_QT5
if (disp == "QT5")
{
WindowDisplayer = new NLQT::CServiceDisplayer("DEFAULT_WD");
}
#endif // NLNET_USE_QT5
if (WindowDisplayer == NULL && disp != "NONE")
{
nlinfo ("SERVICE: Unknown value for the WindowStyle (should be GTK, WIN or NONE), use no window displayer");
@ -814,7 +825,7 @@ sint IService::main (const char *serviceShortName, const char *serviceLongName,
if (haveArg('I')) iconified = true;
WindowDisplayer->create (string("*INIT* ") + _ShortName + " " + _LongName, iconified, x, y, w, h, history, fs, fn, ww, &CommandLog);
WindowDisplayer->create(argc, argv, string("*INIT* ") + _ShortName + " " + _LongName, iconified, x, y, w, h, history, fs, fn, ww, &CommandLog);
DebugLog->addDisplayer (WindowDisplayer);
InfoLog->addDisplayer (WindowDisplayer);

@ -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)

@ -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})
CMAKE_POLICY(SET CMP0020 NEW)
ADD_EXECUTABLE(nl_panoply_preview WIN32 ${SRC}
${SRCS}
${HDRS}
${RSRC}
${RESOURCE_ADDED}
${PANOPLY_MAKER}
)
TARGET_LINK_LIBRARIES(nl_panoply_preview
nelmisc
nel3d
nelqtdisplayer
Qt5::Widgets)
NL_DEFAULT_PROPS(nl_panoply_preview "NeL, Tools, 3D: panoply_preview")
NL_ADD_RUNTIME_FLAGS(nl_panoply_preview)
INSTALL(TARGETS nl_panoply_preview RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT samples3d)

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

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

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

@ -0,0 +1,95 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2014 Jan BOON (jan.boon@kaetemi.be)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NLTOOLS_MAIN_WINDOW_H
#define NLTOOLS_MAIN_WINDOW_H
#include <nel/misc/types_nl.h>
// STL includes
// Qt includes
#include <QMainWindow>
// NeL includes
#include <nel/misc/rgba.h>
#include <nel/misc/ucstring.h>
#include <nel/misc/time_nl.h>
#include <nel/3d/animation_time.h>
#include <nel/net/login_cookie.h>
// Project includes
// ...
class QTreeView;
class QDirModel;
class QUndoStack;
class QScrollArea;
namespace NLQT {
class CCommandLogDisplayer;
}
namespace NLTOOLS {
class CPanoplyPreview;
/**
* CMainWindow
* \brief CMainWindow
* \date 2014-09-19 09:38GMT
* \author Jan BOON (jan.boon@kaetemi.be)
*/
class CMainWindow : public QMainWindow
{
Q_OBJECT
public:
CMainWindow(const QMap<QString, QSize> &customSizeHints, QWidget *parent = 0, Qt::WindowFlags flags = 0);
virtual ~CMainWindow();
inline QMenu *widgetsMenu() { return m_WidgetsMenu; }
private slots:
void about();
private:
void createActions();
void createMenus();
void createToolBars();
void createStatusBar();
void createDockWindows();
private:
CMainWindow(const CMainWindow &);
CMainWindow &operator=(const CMainWindow &);
private:
CPanoplyPreview *m_PanoplyPreview;
NLQT::CCommandLogDisplayer *m_CommandLog;
QDockWidget *m_CommandLogDock;
QMenu *m_WidgetsMenu;
QMenu *m_HelpMenu;
QAction *m_AboutAct;
}; /* class CMainWindow */
} /* namespace NLTOOLS */
#endif /* #ifndef NLTOOLS_MAIN_WINDOW_H */
/* end of file */

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

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

@ -0,0 +1,105 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NLTOOLS_CONFIG_H
#define NLTOOLS_CONFIG_H
#include <nel/misc/types_nl.h>
// use the default log.log file (not erased on use)
// #define NLTOOLS_USE_LOG_LOG false
// the config file name
// #define NLTOOLS_CONFIG_FILE "panoply_preview.cfg"
// #define NLTOOLS_CONFIG_FILE_DEFAULT "panoply_preview_default.cfg"
// use panoply_preview log file
// #define NLTOOLS_USE_LOG 1
// panoply_preview log file name
#define NLTOOLS_LOG_FILE "panoply_preview.log"
// clear panoply_preview log before use
#define NLTOOLS_ERASE_LOG true
// version number
#define NLTOOLS_VERSION "0.10.0"
// use the low fragmentation heap (windows feature)
// #define NLTOOLS_LOW_FRAGMENTATION_HEAP 1
// temporary dev tags
//#define NL_DEV_STEREO 0
//#define NL_DEV_MEMLEAK 1
//#define NL_DEV_NET 0
//#define NL_DEV_NETNEW 1
//#define NL_DEV_CG 0
//#define NL_DEV_BULLET 0
// some default defines
#if FINAL_VERSION
# if !defined(NLTOOLS_USE_LOG_LOG)
# define NLTOOLS_USE_LOG_LOG false
# endif
# if !defined(NLTOOLS_USE_LOG)
# define NLTOOLS_USE_LOG 0
# endif
#endif
#if !defined (NLTOOLS_USE_LOG_LOG)
# define NLTOOLS_USE_LOG_LOG true
#endif
#if !defined (NLTOOLS_USE_LOG)
# define NLTOOLS_USE_LOG 1
#endif
#if !defined (NLTOOLS_LOW_FRAGMENTATION_HEAP)
# ifdef NL_OS_WINDOWS
# define NLTOOLS_LOW_FRAGMENTATION_HEAP 1
# else
# define NLTOOLS_LOW_FRAGMENTATION_HEAP 0
# endif
#endif
// for compatibility with old configuration
#ifndef NLTOOLS_CONFIG_FILE
# ifndef NLTOOLS_CONFIG
# define NLTOOLS_CONFIG_FILE "panoply_preview.cfg"
# else
# define NLTOOLS_CONFIG_FILE NLTOOLS_CONFIG "panoply_preview.cfg"
# endif
#endif
#ifndef NLTOOLS_CONFIG_FILE_DEFAULT
# define NLTOOLS_CONFIG_FILE_DEFAULT "panoply_preview_default.cfg"
#endif
#endif /* #ifndef NLTOOLS_CONFIG_H */
/* end of file */

@ -0,0 +1,176 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2014 Jan BOON (jan.boon@kaetemi.be)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <nel/misc/types_nl.h>
#include "tool_main.h"
// STL includes
#include <stdio.h>
#ifdef NL_OS_WINDOWS
# include <windows.h>
# include <direct.h>
# include <tchar.h>
#endif
// Qt includes
#include <QApplication>
#include <QtCore/QMap>
#include <QtCore/qdebug.h>
#include <QStyleFactory>
// NeL includes
#include <nel/misc/debug.h>
#include <nel/misc/common.h>
#include <nel/misc/file.h>
#include <nel/misc/path.h>
#include <nel/misc/command.h>
#include <nel/misc/sheet_id.h>
#include <nelqt/common.h>
// Project includes
#include "tool_config.h"
#include "main_window.h"
using namespace std;
using namespace NLMISC;
namespace NLTOOLS {
namespace {
CFileDisplayer *s_FileDisplayer = NULL;
} /* anonymous namespace */
} /* namespace NLTOOLS */
void usage()
{
/* from Qt sample */
qWarning() << "Usage: mainwindow [-SizeHint<color> <width>x<height>] ...";
exit(1);
}
QMap<QString, QSize> parseCustomSizeHints(int argc, char **argv)
{
/* from Qt sample */
QMap<QString, QSize> result;
for (int i = 1; i < argc; ++i) {
QString arg = QString::fromLocal8Bit(argv[i]);
if (arg.startsWith(QLatin1String("-SizeHint"))) {
QString name = arg.mid(9);
if (name.isEmpty())
usage();
if (++i == argc)
usage();
QString sizeStr = QString::fromLocal8Bit(argv[i]);
int idx = sizeStr.indexOf(QLatin1Char('x'));
if (idx == -1)
usage();
bool ok;
int w = sizeStr.left(idx).toInt(&ok);
if (!ok)
usage();
int h = sizeStr.mid(idx + 1).toInt(&ok);
if (!ok)
usage();
result[name] = QSize(w, h);
}
}
return result;
}
#ifdef NL_OS_WINDOWS
# ifdef _UNICODE
# define tstring wstring
# else
# define tstring string
# endif
#endif
sint main(int argc, char **argv)
{
// go nel!
{
// use log.log if NEL_LOG_IN_FILE and NLTOOLS_USE_LOG_LOG defined as 1
createDebug(NULL, NLTOOLS_USE_LOG_LOG, false);
#if NLTOOLS_USE_LOG
// create toverhex_client.log
// filedisplayer only deletes the 001 etc
if (NLTOOLS_ERASE_LOG && CFile::isExists(NLTOOLS_LOG_FILE))
CFile::deleteFile(NLTOOLS_LOG_FILE);
// initialize the log file
NLTOOLS::s_FileDisplayer = new CFileDisplayer();
NLTOOLS::s_FileDisplayer->setParam(NLTOOLS_LOG_FILE, NLTOOLS_ERASE_LOG);
DebugLog->addDisplayer(NLTOOLS::s_FileDisplayer);
InfoLog->addDisplayer(NLTOOLS::s_FileDisplayer);
WarningLog->addDisplayer(NLTOOLS::s_FileDisplayer);
AssertLog->addDisplayer(NLTOOLS::s_FileDisplayer);
ErrorLog->addDisplayer(NLTOOLS::s_FileDisplayer);
#endif
nlinfo("Welcome to NeL!");
}
// low fragmentation heap (windows)
#if NLTOOLS_LOW_FRAGMENTATION_HEAP
ULONG heapFragValue = 2; // enable low fragmentation heap
if (HeapSetInformation(GetProcessHeap(),
HeapCompatibilityInformation,
&heapFragValue, sizeof(heapFragValue)))
{
nlinfo("HeapSetInformation OK!\n");
}
else
{
nlwarning("HeapSetInformation FAIL! (%d)\n", GetLastError());
}
#endif
#ifdef NL_OS_WINDOWS
HRESULT hr;
hr = hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
bool coInitOk = (hr == S_OK) || (hr == S_FALSE);
#endif
CSheetId::initWithoutSheet();
NLQT::preApplication();
QApplication app(argc, const_cast<char **>(argv));
NLQT::postApplication();
QMap<QString, QSize> customSizeHints = parseCustomSizeHints(argc, argv);
NLTOOLS::CMainWindow mainWin(customSizeHints);
mainWin.resize(800, 600);
mainWin.show(); // calls isVisible(true)
int result = app.exec();
#ifdef NL_OS_WINDOWS
if (coInitOk) CoUninitialize();
#endif
return result;
}
/* end of file */

@ -0,0 +1,33 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2014 Jan BOON (jan.boon@kaetemi.be)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NLTOOLS_MAIN_H
#define NLTOOLS_MAIN_H
#include <nel/misc/types_nl.h>
// STL includes
// NeL includes
// Project includes
namespace NLTOOLS {
} /* namespace NLTOOLS */
#endif /* #ifndef NLTOOLS_MAIN_H */
/* end of file */

@ -3,8 +3,10 @@ SUBDIRS(bnp_make disp_sheet_id extract_filename lock make_sheet_id xml_packer)
IF(WITH_QT)
ADD_SUBDIRECTORY(words_dic_qt)
ADD_SUBDIRECTORY(message_box_qt)
ADD_SUBDIRECTORY(crash_report)
ENDIF(WITH_QT)
IF(WITH_QT OR WITH_QT5)
ADD_SUBDIRECTORY(crash_report)
ENDIF(WITH_QT OR WITH_QT5)
IF(WIN32)
ADD_SUBDIRECTORY(exec_timeout)

@ -1,39 +1,65 @@
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SRC_DIR} ${QT_INCLUDES})
FILE(GLOB CRASHREPORT_SRC *.cpp)
FILE(GLOB CRASHREPORT_HDR *h)
FILE(GLOB CRASHREPORT_HDR *.h)
FILE(GLOB CRASHREPORT_UI *.ui)
SET(CRASHREPORT_MOC_HDR
crash_report_socket.h
crash_report_widget.h
FILE(GLOB CRASHREPORT_MOC_HDR
crash_report_socket.h
crash_report_widget.h
)
SET(CRASHREPORT_UI
crash_report_widget.ui
)
find_package(Qt5Network)
SET(QT_USE_QTGUI TRUE)
SET(QT_USE_QTNETWORK TRUE)
SET(QT_USE_QTMAIN TRUE)
SET(QT_USE_QTOPENGL FALSE)
SET(QT_USE_QTXML FALSE)
IF(!WITH_QT5)
SET(QT_USE_QTGUI TRUE)
SET(QT_USE_QTNETWORK TRUE)
SET(QT_USE_QTMAIN TRUE)
SET(QT_USE_QTOPENGL FALSE)
SET(QT_USE_QTXML FALSE)
INCLUDE(${QT_USE_FILE})
ENDIF(!WITH_QT5)
INCLUDE(${QT_USE_FILE})
ADD_DEFINITIONS(${QT_DEFINITIONS})
QT4_WRAP_CPP(CRASHREPORT_MOC_SRC ${CRASHREPORT_MOC_HDR})
QT4_WRAP_UI(CRASHREPORT_UI_HDR ${CRASHREPORT_UI})
IF(WITH_QT5)
SET(CMAKE_AUTOMOC ON)
QT5_WRAP_CPP(CRASHREPORT_MOC_SRC ${CRASHREPORT_MOC_HDR})
QT5_WRAP_UI(CRASHREPORT_UI_HDR ${CRASHREPORT_UI})
ELSE(WITH_QT5)
QT4_WRAP_CPP(CRASHREPORT_MOC_SRC ${CRASHREPORT_MOC_HDR})
QT4_WRAP_UI(CRASHREPORT_UI_HDR ${CRASHREPORT_UI})
ENDIF(WITH_QT5)
SOURCE_GROUP(resources FILES ${CRASHREPORT_UI})
IF(!WITH_QT5)
SOURCE_GROUP(generated FILES ${CRASHREPORT_UI_HDR} ${CRASHREPORT_MOC_SRC})
ENDIF(!WITH_QT5)
SOURCE_GROUP("" FILES ${CRASHREPORT_SRC} ${CRASHREPORT_HDR})
SOURCE_GROUP(QtResources FILES ${CRASHREPORT_UI})
SOURCE_GROUP(QtGeneratedUiHdr FILES ${CRASHREPORT_UI_HDR})
SOURCE_GROUP(QtGeneratedMocQrcSrc FILES ${CRASHREPORT_MOC_SRC})
SOURCE_GROUP("source files" FILES ${CRASHREPORT_SRC})
SOURCE_GROUP("header files" FILES ${CRASHREPORT_HDR})
IF(WITH_QT5)
ADD_EXECUTABLE(crash_report WIN32 MACOSX_BUNDLE
${CRASHREPORT_SRC}
${CRASHREPORT_HDR}
${CRASHREPORT_UI}
)
ELSE(WITH_QT5)
ADD_EXECUTABLE(crash_report WIN32 MACOSX_BUNDLE
${CRASHREPORT_SRC}
${CRASHREPORT_MOC_HDR}
${CRASHREPORT_MOC_SRC}
${CRASHREPORT_UI_HDR}
)
ENDIF(WITH_QT5)
ADD_EXECUTABLE(crash_report WIN32 MACOSX_BUNDLE ${CRASHREPORT_SRC} ${CRASHREPORT_MOC_HDR} ${CRASHREPORT_MOC_SRC} ${CRASHREPORT_UI_HDR})
TARGET_LINK_LIBRARIES(crash_report ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY})
IF(WITH_QT5)
TARGET_LINK_LIBRARIES(crash_report
Qt5::Widgets
Qt5::Network)
ELSE(WITH_QT5)
TARGET_LINK_LIBRARIES(crash_report ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY})
ENDIF(WITH_QT5)
NL_DEFAULT_PROPS(crash_report "NeL, Tools, Misc: Crash Report")
NL_ADD_RUNTIME_FLAGS(crash_report)
INSTALL(TARGETS crash_report RUNTIME DESTINATION ${NL_BIN_PREFIX})

@ -18,8 +18,10 @@
#include "crash_report_widget.h"
#include <nelqt/common.h>
#include <QApplication>
#include <QMessageBox>
#include <QDir>
#include <stack>
#include <vector>
@ -91,7 +93,9 @@ int main( int argc, char **argv )
}
#endif
QApplication app( argc, argv );
NLQT::preApplication();
QApplication app(argc, argv);
NLQT::postApplication();
std::vector< std::pair< std::string, std::string > > params;

@ -0,0 +1,2 @@
ADD_SUBDIRECTORY(src)

@ -0,0 +1,87 @@
/*
Copyright (C) 2015 by authors
Author: Jan Boon <jan.boon@kaetemi.be>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef NLQT_COMMON_H
#define NLQT_COMMON_H
#include <nel/misc/types_nl.h>
// STL includes
// Qt includes
#include <QApplication>
#include <QStyleFactory>
#include <QDir>
#include <QPalette>
// NeL includes
// Project includes
namespace NLQT {
namespace {
void preApplication()
{
QCoreApplication::libraryPaths();
QString app_location = QCoreApplication::applicationFilePath();
app_location.truncate(app_location.lastIndexOf(QLatin1Char('/')));
app_location = QDir(app_location).canonicalPath();
QCoreApplication::removeLibraryPath(app_location);
QCoreApplication::addLibraryPath("./platforms");
QCoreApplication::addLibraryPath("./qtwebengine");
QCoreApplication::addLibraryPath("./imageformats");
QCoreApplication::addLibraryPath("./iconengines");
QCoreApplication::addLibraryPath("./designer");
}
void postApplication()
{
QApplication::setStyle(QStyleFactory::create("Fusion"));
QPalette palette = qApp->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);
qApp->setPalette(palette);
}
}
} /* namespace NLQT */
#endif /* #ifndef NLQT_SERVICE_WINDOW_H */
/* end of file */

@ -0,0 +1,111 @@
/*
Copyright (C) 2010-2015 by authors
Author: Jan Boon <jan.boon@kaetemi.be>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef NLQT_COMMAND_LOG_H
#define NLQT_COMMAND_LOG_H
#include <nel/misc/types_nl.h>
// STL includes
// Qt includes
#include <QWidget>
#include <QTextEdit>
#include <QLineEdit>
// NeL includes
#include <nel/misc/log.h>
#include <nel/misc/displayer.h>
#include <nel/misc/callback.h>
// Project includes
namespace NLQT {
typedef NLMISC::CCallback<void, const std::string &> TCommandExecute;
class CCommandLog : public QWidget
{
Q_OBJECT
public:
CCommandLog(QWidget *parent);
virtual ~CCommandLog();
void setExecCommand(const TCommandExecute &func) { m_Func = func; }
void doDisplay(const NLMISC::CLog::TDisplayInfo& args, const char *message);
void clear() { m_DisplayerOutput->clear(); }
signals:
void tSigDisplay(const QColor &c, const QString &text);
void execCommand(const std::string &cmd);
private slots:
void returnPressed();
void tSlotDisplay(const QColor &c, const QString &text);
private:
QTextEdit *m_DisplayerOutput;
QLineEdit *m_CommandInput;
TCommandExecute m_Func;
private:
CCommandLog(const CCommandLog &);
CCommandLog &operator=(const CCommandLog &);
}; /* class CCommandLog */
class CCommandLogDisplayer : public CCommandLog, public NLMISC::IDisplayer
{
Q_OBJECT
public:
CCommandLogDisplayer(QWidget *parent);
virtual ~CCommandLogDisplayer();
protected:
virtual void doDisplay(const NLMISC::CLog::TDisplayInfo& args, const char *message);
private slots:
void execCommandLog(const std::string &cmd);
private:
NLMISC::CLog m_Log;
private:
CCommandLogDisplayer(const CCommandLogDisplayer &);
CCommandLogDisplayer &operator=(const CCommandLogDisplayer &);
}; /* class CCommandLogDisplayer */
} /* namespace NLQT */
#endif /* #ifndef NLQT_COMMAND_LOG_H */
/* end of file */

@ -0,0 +1,88 @@
/*
Copyright (C) 2015 by authors
Author: Jan Boon <jan.boon@kaetemi.be>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef NLQT_SERVICE_DISPLAYER_H
#define NLQT_SERVICE_DISPLAYER_H
#include <nel/misc/types_nl.h>
// STL includes
// NeL includes
#include <nel/misc/log.h>
#include <nel/misc/displayer.h>
#include <nel/misc/window_displayer.h>
// Project includes
class QWidget;
namespace NLQT {
class CServiceWindow;
class CCommandLog;
class CServiceDisplayer : public NLMISC::CWindowDisplayer
{
public:
CServiceDisplayer(const char *displayerName);
virtual ~CServiceDisplayer();
virtual void setTitleBar(const std::string &titleBar);
protected:
virtual void doDisplay(const NLMISC::CLog::TDisplayInfo& args, const char *message);
virtual void open(int argc, char **argv, std::string titleBar, bool iconified, sint x, sint y, sint w, sint h, sint hs, sint fs, const std::string &fn, bool ww, NLMISC::CLog *log);
virtual void display_main();
void commandExecute(const std::string &cmd);
void buttonCallback(QWidget *sender);
void timerCallback();
void exitCallback();
private:
CServiceWindow *m_ServiceWindow;
CCommandLog *m_CommandLog;
NLMISC::CLog *m_Log;
NLMISC::CSynchronized<std::vector<std::pair<NLMISC::CLog::TDisplayInfo, std::string> > > m_DelayLog;
NLMISC::CSynchronized<std::string> m_SetTitleBar;
bool m_DoSetTitleBar;
private:
CServiceDisplayer(const CServiceDisplayer &);
CServiceDisplayer &operator=(const CServiceDisplayer &);
}; /* class CServiceDisplayer */
} /* namespace NLQT */
#endif /* #ifndef NLQT_SERVICE_DISPLAYER_H */
/* end of file */

@ -0,0 +1,99 @@
/*
Copyright (C) 2015 by authors
Author: Jan Boon <jan.boon@kaetemi.be>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef NLQT_SERVICE_WINDOW_H
#define NLQT_SERVICE_WINDOW_H
#include <nel/misc/types_nl.h>
// STL includes
// Qt includes
#include <QMainWindow>
#include <QFont>
// NeL includes
#include <nel/misc/log.h>
#include <nel/misc/displayer.h>
#include <nel/misc/callback.h>
// Project includes
class QHBoxLayout;
class QVBoxLayout;
namespace NLQT {
class CCommandLog;
typedef NLMISC::CCallback<void, QWidget *> TDisplayerButtonCallback;
typedef NLMISC::CCallback<void> TDisplayerTimerCallback;
typedef NLMISC::CCallback<void> TDisplayerExitCallback;
class CServiceWindow : public QMainWindow
{
Q_OBJECT
public:
CServiceWindow(QWidget *parent = NULL, Qt::WindowFlags flags = 0);
virtual ~CServiceWindow();
inline void setButtonCallback(const TDisplayerButtonCallback &cb) { m_ButtonCallback = cb; }
inline void setTimerCallback(const TDisplayerTimerCallback &cb) { m_TimerCallback = cb; }
inline void setExitCallback(const TDisplayerExitCallback &cb) { m_ExitCallback = cb; }
inline CCommandLog *commandLog() { return m_CommandLog; }
QWidget *addLabel();
QWidget *addButton();
void addLine();
private slots:
void buttonCallback();
void timerCallback();
private:
CCommandLog *m_CommandLog;
TDisplayerButtonCallback m_ButtonCallback;
TDisplayerTimerCallback m_TimerCallback;
TDisplayerExitCallback m_ExitCallback;
QVBoxLayout *m_LabelVBox;
QHBoxLayout *m_LabelHBox;
QFont m_Font;
private:
CServiceWindow(const CServiceWindow &);
CServiceWindow &operator=(const CServiceWindow &);
}; /* class CServiceWindow */
} /* namespace NLQT */
#endif /* #ifndef NLQT_SERVICE_WINDOW_H */
/* end of file */

@ -0,0 +1,2 @@
ADD_SUBDIRECTORY(displayer)

@ -0,0 +1,18 @@
FILE(GLOB SRCS *.cpp *.h)
FILE(GLOB HDRS ../../include/nelqt/displayer/*.h)
SOURCE_GROUP("" FILES ${SRCS} ${HDRS})
SET(CMAKE_AUTOMOC ON)
NL_TARGET_LIB(nelqtdisplayer ${SRCS} ${HDRS})
TARGET_LINK_LIBRARIES(nelqtdisplayer nelmisc Qt5::Widgets)
NL_DEFAULT_PROPS(nelqtdisplayer "NeLQt, Library: Displayer")
NL_ADD_RUNTIME_FLAGS(nelqtdisplayer)
NL_ADD_LIB_SUFFIX(nelqtdisplayer)
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
INSTALL(TARGETS nelqtdisplayer LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT libraries)
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)

@ -0,0 +1,159 @@
/*
Copyright (C) 2010-2015 by authors
Author: Jan Boon <jan.boon@kaetemi.be>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <nel/misc/types_nl.h>
#include <nelqt/displayer/command_log.h>
// STL includes
// Qt includes
#include <QVBoxLayout>
// NeL includes
#include <nel/misc/debug.h>
#include <nel/misc/command.h>
#include <nel/misc/path.h>
#include <nel/misc/window_displayer.h>
// Project includes
using namespace std;
using namespace NLMISC;
namespace NLQT {
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 &)));
}
CCommandLog::~CCommandLog()
{
}
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;
}
std::string str = NLMISC::CWindowDisplayer::stringifyMessage(args, message);
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();
execCommand(cmd);
if (m_Func) m_Func(cmd);
m_CommandInput->clear();
}
CCommandLogDisplayer::CCommandLogDisplayer(QWidget *parent) : CCommandLog(parent)
{
connect(this, SIGNAL(execCommand(const std::string &)), this, SLOT(execCommandLog(const std::string &)));
DebugLog->addDisplayer(this);
InfoLog->addDisplayer(this);
WarningLog->addDisplayer(this);
AssertLog->addDisplayer(this);
ErrorLog->addDisplayer(this);
m_Log.addDisplayer(this);
}
CCommandLogDisplayer::~CCommandLogDisplayer()
{
DebugLog->removeDisplayer(this);
InfoLog->removeDisplayer(this);
WarningLog->removeDisplayer(this);
AssertLog->removeDisplayer(this);
ErrorLog->removeDisplayer(this);
m_Log.removeDisplayer(this);
}
void CCommandLogDisplayer::doDisplay(const NLMISC::CLog::TDisplayInfo& args, const char *message)
{
CCommandLog::doDisplay(args, message);
}
void CCommandLogDisplayer::execCommandLog(const std::string &cmd)
{
m_Log.displayRawNL("> %s", cmd.c_str());
ICommand::execute(cmd, m_Log);
}
} /* namespace NLQT */
/* end of file */

@ -0,0 +1,271 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <nel/misc/types_nl.h>
#include <nelqt/displayer/service_displayer.h>
// STL includes
// Qt includes
#include <QApplication>
#include <QVBoxLayout>
#include <QLabel>
#include <QPushButton>
// NeL includes
#include <nel/misc/debug.h>
#include <nel/misc/command.h>
#include <nel/misc/path.h>
// Project includes
#include <nelqt/common.h>
#include <nelqt/displayer/command_log.h>
#include <nelqt/displayer/service_window.h>
using namespace std;
using namespace NLMISC;
namespace NLQT {
CServiceDisplayer::CServiceDisplayer(const char *displayerName) : CWindowDisplayer(displayerName), m_DelayLog("CServiceDisplayer::m_DelayLog"), m_SetTitleBar("CServiceDisplayer::m_SetTitleBar"), m_CommandLog(NULL), m_DoSetTitleBar(false)
{
createLabel("@Clear|CLEAR");
INelContext::getInstance().setWindowedApplication(true);
}
CServiceDisplayer::~CServiceDisplayer()
{
}
void CServiceDisplayer::doDisplay(const CLog::TDisplayInfo& args, const char *message)
{
if (!m_Log)
return;
if (m_CommandLog)
{
m_CommandLog->doDisplay(args, message);
}
else
{
NLMISC::CSynchronized<std::vector<std::pair<CLog::TDisplayInfo, std::string> > >::CAccessor access(&m_DelayLog);
access.value().push_back(std::pair<CLog::TDisplayInfo, std::string>(args, message));
}
}
void CServiceDisplayer::open(int argc, char **argv, std::string titleBar, bool iconified, sint x, sint y, sint w, sint h, sint hs, sint fs, const std::string &fn, bool ww, NLMISC::CLog *log)
{
if (w == -1)
w = 700;
if (h == -1)
h = 300;
if (hs == -1)
hs = 1000;
m_Log = log;
NLQT::preApplication();
QApplication app(argc, argv);
NLQT::postApplication();
CServiceWindow serviceWindow;
// serviceWindow.move(x, y);
serviceWindow.resize(w, h);
serviceWindow.setWindowTitle(QString::fromUtf8(titleBar.c_str()));
m_ServiceWindow = &serviceWindow;
; {
NLMISC::CSynchronized<std::vector<std::pair<CLog::TDisplayInfo, std::string> > >::CAccessor access(&m_DelayLog);
for (std::vector<std::pair<CLog::TDisplayInfo, std::string> >::iterator it(access.value().begin()), end(access.value().end()); it != end; ++it)
serviceWindow.commandLog()->doDisplay(it->first, it->second.c_str());
access.value().clear();
}
m_CommandLog = serviceWindow.commandLog();
; {
NLMISC::CSynchronized<std::vector<std::pair<CLog::TDisplayInfo, std::string> > >::CAccessor access(&m_DelayLog);
for (std::vector<std::pair<CLog::TDisplayInfo, std::string> >::iterator it(access.value().begin()), end(access.value().end()); it != end; ++it)
serviceWindow.commandLog()->doDisplay(it->first, it->second.c_str());
access.value().clear();
}
serviceWindow.setButtonCallback(TDisplayerButtonCallback(this, &CServiceDisplayer::buttonCallback));
serviceWindow.setTimerCallback(TDisplayerTimerCallback(this, &CServiceDisplayer::timerCallback));
serviceWindow.setExitCallback(TDisplayerExitCallback(this, &CServiceDisplayer::exitCallback));
m_CommandLog->setExecCommand(TCommandExecute(this, &CServiceDisplayer::commandExecute));
serviceWindow.show();
app.exec();
}
void CServiceDisplayer::display_main()
{
}
void CServiceDisplayer::commandExecute(const std::string &cmd) // DT
{
m_Log->displayRawNL("> %s", cmd.c_str());
{
CSynchronized<std::vector<std::string> >::CAccessor access(&_CommandsToExecute);
access.value().push_back(cmd);
}
}
void CServiceDisplayer::setTitleBar(const std::string &titleBar)
{
string wn;
if (!titleBar.empty())
{
wn += titleBar;
wn += ": ";
}
wn += "Nel Service Console (compiled " __DATE__ " " __TIME__ " in " + nlMode + " mode)";
nldebug("SERVICE: Set title bar to '%s'", wn.c_str());
NLMISC::CSynchronized<std::string>::CAccessor access(&m_SetTitleBar);
access.value() = wn;
m_DoSetTitleBar = true;
}
namespace {
QString rstrip(const QString& str)
{
int n = str.size() - 1;
for (; n >= 0; --n)
{
if (!str.at(n).isSpace())
{
return str.left(n + 1);
}
}
return "";
}
}
void CServiceDisplayer::buttonCallback(QWidget *sender) // DT
{
CSynchronized<std::vector<CWindowDisplayer::CLabelEntry> >::CAccessor access(&_Labels);
for (uint i = 0; i < access.value().size(); i++)
{
if (access.value()[i].Hwnd == sender)
{
if (access.value()[i].Value == "@Clear|CLEAR")
{
// special commands because the clear must be called by the display thread and not main thread
m_CommandLog->clear();
}
else
{
// the button was found, add the command in the command stack
CSynchronized<std::vector<std::string> >::CAccessor accessCommands(&_CommandsToExecute);
string str;
nlassert(!access.value()[i].Value.empty());
nlassert(access.value()[i].Value[0] == '@');
string::size_type pos = access.value()[i].Value.find("|");
if (pos != string::npos)
{
str = access.value()[i].Value.substr(pos + 1);
}
else
{
str = access.value()[i].Value.substr(1);
}
if (!str.empty())
accessCommands.value().push_back(str);
}
break;
}
}
}
void CServiceDisplayer::timerCallback() // DT
{
if (m_DoSetTitleBar)
{
NLMISC::CSynchronized<std::string>::CAccessor access(&m_SetTitleBar);
m_ServiceWindow->setWindowTitle(QString::fromUtf8(access.value().c_str()));
m_DoSetTitleBar = false;
access.value().clear();
}
; {
CSynchronized<std::vector<CLabelEntry> >::CAccessor access(&_Labels);
for (uint i = 0; i < access.value().size(); i++)
{
if (access.value()[i].NeedUpdate && !access.value()[i].Value.empty())
{
if (access.value()[i].Hwnd == NULL)
{
// empty char (on previous) is separator
if (i > 0 && access.value()[i - 1].Value.empty())
{
m_ServiceWindow->addLine();
}
// create a button for command and label for variables
if (access.value()[i].Value[0] == '@')
{
access.value()[i].Hwnd = m_ServiceWindow->addButton();
}
else
{
access.value()[i].Hwnd = m_ServiceWindow->addLabel();
}
}
string n;
// do this tricks to be sure that windows will clear what is after the number
if (access.value()[i].Value[0] != '@')
n = access.value()[i].Value + " ";
else
{
string::size_type pos = access.value()[i].Value.find('|');
if (pos != string::npos)
{
n = access.value()[i].Value.substr(1, pos - 1);
}
else
{
n = access.value()[i].Value.substr(1);
}
}
if (access.value()[i].Value[0] == '@')
{
((QPushButton *)access.value()[i].Hwnd)->setText(rstrip(QString::fromUtf8(n.c_str())));
}
else
{
((QLabel *)access.value()[i].Hwnd)->setText(rstrip(QString::fromUtf8(n.c_str())));
}
}
}
}
}
void CServiceDisplayer::exitCallback() // DT
{
_Continue = false;
m_Log = NULL;
m_CommandLog = NULL;
m_ServiceWindow = NULL;
}
} /* namespace NLQT */
/* end of file */

@ -0,0 +1,128 @@
/*
Copyright (C) 2015 by authors
Author: Jan Boon <jan.boon@kaetemi.be>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <nel/misc/types_nl.h>
#include <nelqt/displayer/service_window.h>
// STL includes
// Qt includes
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QTimer>
#include <QLabel>
#include <QPushButton>
#include <QFontDatabase>
// NeL includes
#include <nel/misc/debug.h>
#include <nel/misc/command.h>
#include <nel/misc/path.h>
// Project includes
#include <nelqt/displayer/command_log.h>
using namespace std;
using namespace NLMISC;
namespace NLQT {
CServiceWindow::CServiceWindow(QWidget *parent, Qt::WindowFlags flags) : QMainWindow(parent, flags), m_Font(QFontDatabase::systemFont(QFontDatabase::FixedFont))
{
m_LabelVBox = new QVBoxLayout(this);
m_LabelHBox = new QHBoxLayout(this);
m_LabelVBox->addLayout(m_LabelHBox);
QWidget *widget = new QWidget(this);
QVBoxLayout *vbox = new QVBoxLayout(widget);
vbox->addLayout(m_LabelVBox);
m_CommandLog = new CCommandLog(this);
m_CommandLog->layout()->setMargin(0);
vbox->addWidget(m_CommandLog);
widget->setLayout(vbox);
setCentralWidget(widget);
QTimer *timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(timerCallback()));
timer->start(25);
}
QWidget *CServiceWindow::addLabel()
{
QLabel *label = new QLabel(this);
label->setFont(m_Font);
m_LabelHBox->addWidget(label);
return label;
}
QWidget *CServiceWindow::addButton()
{
QPushButton *button = new QPushButton(this);
// button->setFont(m_Font);
connect(button, SIGNAL(clicked()), this, SLOT(buttonCallback()));
m_LabelHBox->addWidget(button);
return button;
}
void CServiceWindow::addLine()
{
m_LabelHBox = new QHBoxLayout(this);
m_LabelVBox->addLayout(m_LabelHBox);
}
CServiceWindow::~CServiceWindow()
{
if (m_ExitCallback)
{
m_ExitCallback();
}
}
void CServiceWindow::timerCallback()
{
if (m_TimerCallback)
{
m_TimerCallback();
}
}
void CServiceWindow::buttonCallback()
{
if (m_ButtonCallback)
{
QWidget *s = (QWidget *)sender();
m_ButtonCallback(s);
}
}
} /* namespace NLQT */
/* end of file */

@ -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)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File diff suppressed because it is too large Load Diff

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

@ -1,7 +1,9 @@
ADD_SUBDIRECTORY(3rdparty)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${LIBXML2_INCLUDE_DIR} ${NEL_INCLUDE_DIR} ${QT_INCLUDES})
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)

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

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

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

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

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

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

@ -45,9 +45,16 @@ ENDIF(NOT WIN32)
SET(QT_USE_QTGUI TRUE)
SET(QT_USE_QTOPENGL TRUE)
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)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Loading…
Cancel
Save