From 09010bd26692b57512960d16d6853eb6a48b2cca Mon Sep 17 00:00:00 2001 From: sfb Date: Thu, 28 Apr 2011 15:56:57 -0500 Subject: [PATCH 1/4] Changed: Added background color changer to Zone Painter --- .../zone_painter/painter_dock_widget.ui | 12 +-- .../zone_painter/zone_painter_main_window.cpp | 102 ++++++++++++++++-- .../zone_painter/zone_painter_main_window.h | 17 +++ 3 files changed, 115 insertions(+), 16 deletions(-) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/painter_dock_widget.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/painter_dock_widget.ui index 1a2d7c988..569caa302 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/painter_dock_widget.ui +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/painter_dock_widget.ui @@ -6,13 +6,13 @@ 0 0 - 361 + 206 555 - 300 + 200 83 @@ -33,21 +33,21 @@ - 0 + 2 - Paint Tiles + Tiles - Paint Colors + Colors - Paint Displacement + Displacement diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_main_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_main_window.cpp index c187e2ddc..068896799 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_main_window.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_main_window.cpp @@ -1,9 +1,18 @@ #include "zone_painter_main_window.h" #include "ui_zone_painter_main_window.h" +#include +#include +#include +#include + #include "qnel_widget.h" #include "painter_dock_widget.h" +#include "../core/icore.h" +#include "../core/imenu_manager.h" +#include "../core/core_constants.h" + ZonePainterMainWindow::ZonePainterMainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::ZonePainterMainWindow) @@ -23,34 +32,107 @@ ZonePainterMainWindow::ZonePainterMainWindow(QWidget *parent) : ui->painterToolBar->addAction(_toolModeMenu->menuAction()); //connect(_renderModeMenu->menuAction(), SIGNAL(triggered()), this, SLOT(setRenderMode())); - //QSignalMapper *modeMapper = new QSignalMapper(this); + QSignalMapper *modeMapper = new QSignalMapper(this); _toolPaintModeAction = _toolModeMenu->addAction(tr("Paint Mode")); _toolPaintModeAction->setIcon(QIcon(":/painterTools/images/draw-brush.png")); _toolPaintModeAction->setStatusTip(tr("Set paint mode")); - //connect(_pointRenderModeAction, SIGNAL(triggered()), modeMapper, SLOT(map())); - //modeMapper->setMapping(_pointRenderModeAction, 0); + connect(_toolPaintModeAction, SIGNAL(triggered()), modeMapper, SLOT(map())); + modeMapper->setMapping(_toolPaintModeAction, 0); _toolFillModeAction = _toolModeMenu->addAction(tr("Fill Mode")); _toolFillModeAction->setStatusTip(tr("Set fill mode")); _toolFillModeAction->setIcon(QIcon(":/painterTools/images/color-fill.png")); - //connect(_lineRenderModeAction, SIGNAL(triggered()), modeMapper, SLOT(map())); - //modeMapper->setMapping(_lineRenderModeAction, 1); + connect(_toolFillModeAction, SIGNAL(triggered()), modeMapper, SLOT(map())); + modeMapper->setMapping(_toolFillModeAction, 1); _toolSelectModeAction = _toolModeMenu->addAction(tr("Select mode")); _toolSelectModeAction->setIcon(QIcon(":/painterTools/images/go-jump-4.png")); _toolSelectModeAction->setStatusTip(tr("Set select mode")); - //connect(_fillRenderModeAction, SIGNAL(triggered()), modeMapper, SLOT(map())); - //modeMapper->setMapping(_fillRenderModeAction, 2); + connect(_toolSelectModeAction, SIGNAL(triggered()), modeMapper, SLOT(map())); + modeMapper->setMapping(_toolSelectModeAction, 2); _toolPickModeAction = _toolModeMenu->addAction(tr("Pick mode")); _toolPickModeAction->setIcon(QIcon(":/painterTools/images/color-picker-black.png")); _toolPickModeAction->setStatusTip(tr("Set color picking mode")); - //connect(_fillRenderModeAction, SIGNAL(triggered()), modeMapper, SLOT(map())); - //modeMapper->setMapping(_fillRenderModeAction, 2); + connect(_toolPickModeAction, SIGNAL(triggered()), modeMapper, SLOT(map())); + modeMapper->setMapping(_toolPickModeAction, 2); - //connect(modeMapper, SIGNAL(mapped(int)), this, SLOT(setRenderMode(int))); + connect(modeMapper, SIGNAL(mapped(int)), this, SLOT(setToolMode(int))); + + m_statusBarTimer = new QTimer(this); + connect(m_statusBarTimer, SIGNAL(timeout()), this, SLOT(updateStatusBar())); + m_statusInfo = new QLabel(this); + m_statusInfo->hide(); + + // Set Background Color Toolbar + + connect(ui->actionBackground_Dlg, SIGNAL(triggered()), this, SLOT(setBackgroundColor())); + + + Core::ICore::instance()->mainWindow()->statusBar()->addPermanentWidget(m_statusInfo); + + +} + +void ZonePainterMainWindow::showEvent(QShowEvent *showEvent) +{ + QMainWindow::showEvent(showEvent); + m_statusBarTimer->start(1000); + m_statusInfo->show(); +} + +void ZonePainterMainWindow::hideEvent(QHideEvent *hideEvent) +{ + m_statusBarTimer->stop(); + m_statusInfo->hide(); + QMainWindow::hideEvent(hideEvent); +} + +void ZonePainterMainWindow::updateStatusBar() +{ + m_statusInfo->setText(QString("Tool Mode: Paint Mode")); +} + +void ZonePainterMainWindow::setToolMode(int value) +{ + switch (value) + { + case 0: + //Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Point); + break; + case 1: + //Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Line); + break; + case 2: + //Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Filled); + break; + } +} + +void ZonePainterMainWindow::setToolMode() +{ + //switch (Modules::objView().getDriver()->getPolygonMode()) + //{ + //case NL3D::UDriver::Filled: + // Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Line); + // break; + //case NL3D::UDriver::Line: + // Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Point); + // break; + //case NL3D::UDriver::Point: + // Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Filled); + // break; + //} +} + +void ZonePainterMainWindow::setBackgroundColor() { + QColor color = QColorDialog::getColor(QColor(m_nelWidget->backgroundColor().R, + m_nelWidget->backgroundColor().G, + m_nelWidget->backgroundColor().B)); + if (color.isValid()) + m_nelWidget->setBackgroundColor(NLMISC::CRGBA(color.red(), color.green(), color.blue())); } ZonePainterMainWindow::~ZonePainterMainWindow() diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_main_window.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_main_window.h index d4d1584ba..fdc38d7c0 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_main_window.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_main_window.h @@ -2,6 +2,9 @@ #define ZONE_PAINTER_MAIN_WINDOW_H #include +#include +#include +#include namespace NLQT { class QNLWidget; @@ -21,16 +24,30 @@ public: explicit ZonePainterMainWindow(QWidget *parent = 0); ~ZonePainterMainWindow(); +public Q_SLOTS: + void setToolMode(int value); + void setToolMode(); + void updateStatusBar(); + void setBackgroundColor(); + +protected: + virtual void showEvent(QShowEvent *showEvent); + virtual void hideEvent(QHideEvent *hideEvent); + private: Ui::ZonePainterMainWindow *ui; NLQT::QNLWidget *m_nelWidget; PainterDockWidget *m_painterDockWidget; + QTimer *m_statusBarTimer; + QLabel *m_statusInfo; QAction *_toolPaintModeAction; QAction *_toolFillModeAction; QAction *_toolSelectModeAction; QAction *_toolPickModeAction; QMenu *_toolModeMenu; + + //QAction *m_setBackColorAction; }; #endif // ZONE_PAINTER_MAIN_WINDOW_H From c0f3c028f8b64c7f9198b6a179bf620b471eaf70 Mon Sep 17 00:00:00 2001 From: sfb Date: Fri, 29 Apr 2011 13:34:18 -0500 Subject: [PATCH 2/4] Changed: Added QSettings load/save to Zone Painter plugin --- .../zone_painter/zone_painter_main_window.cpp | 24 +++++++++++++++++++ .../zone_painter/zone_painter_main_window.h | 3 +++ 2 files changed, 27 insertions(+) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_main_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_main_window.cpp index 413527fae..1bd91f667 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_main_window.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_main_window.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include "qnel_widget.h" #include "painter_dock_widget.h" @@ -21,6 +22,9 @@ ZonePainterMainWindow::ZonePainterMainWindow(QWidget *parent) : m_nelWidget = new NLQT::QNLWidget(this); setCentralWidget(m_nelWidget); + // Load the settings. + loadConfig(); + // Set up dock widget(s) and toolbar. m_painterDockWidget = new PainterDockWidget(this); addDockWidget(Qt::RightDockWidgetArea, m_painterDockWidget); @@ -135,6 +139,26 @@ void ZonePainterMainWindow::setBackgroundColor() { m_nelWidget->setBackgroundColor(NLMISC::CRGBA(color.red(), color.green(), color.blue())); } +void ZonePainterMainWindow::loadConfig() { + QSettings *settings = Core::ICore::instance()->settings(); + settings->beginGroup("ZonePainter"); + + QColor color; + color = settings->value("BackgroundColor", QColor(80, 80, 80)).value(); + m_nelWidget->setBackgroundColor(NLMISC::CRGBA(color.red(), color.green(), color.blue(), color.alpha())); +} + +void ZonePainterMainWindow::saveConfig() { + QSettings *settings = Core::ICore::instance()->settings(); + settings->beginGroup("ZonePainter" ); + + QColor color(m_nelWidget->backgroundColor().R, m_nelWidget->backgroundColor().G, m_nelWidget->backgroundColor().B, m_nelWidget->backgroundColor().A); + settings->setValue("BackgroundColor", color); + + settings->endGroup(); + settings->sync(); +} + ZonePainterMainWindow::~ZonePainterMainWindow() { delete ui; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_main_window.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_main_window.h index fdc38d7c0..d55eb39e5 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_main_window.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_main_window.h @@ -24,6 +24,9 @@ public: explicit ZonePainterMainWindow(QWidget *parent = 0); ~ZonePainterMainWindow(); + void loadConfig(); + void saveConfig(); + public Q_SLOTS: void setToolMode(int value); void setToolMode(); From a290dcf3b8b3a11618bc6db1e55c3464a2800533 Mon Sep 17 00:00:00 2001 From: cemycc Date: Fri, 29 Apr 2011 22:58:59 +0300 Subject: [PATCH 4/4] Create directory for the Translation Manager plugin --- .../object_viewer_qt/src/plugins/translation_manager/README | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/README diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/README b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/README new file mode 100644 index 000000000..b182bfdcf --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/README @@ -0,0 +1,5 @@ +Translation Manager Plugin +-------------------------- +GSoC 2011 Project +http://dev.ryzom.com/wiki/ryzom/OVQTTranslationPluginGSoc2011 +