From c0f3c028f8b64c7f9198b6a179bf620b471eaf70 Mon Sep 17 00:00:00 2001 From: sfb Date: Fri, 29 Apr 2011 13:34:18 -0500 Subject: [PATCH] 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();