mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-10 09:19:01 +00:00
Changed: Added QSettings load/save to Zone Painter plugin
This commit is contained in:
parent
e997b36b4f
commit
c0f3c028f8
2 changed files with 27 additions and 0 deletions
|
@ -5,6 +5,7 @@
|
||||||
#include <QSignalMapper>
|
#include <QSignalMapper>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include <QColorDialog>
|
#include <QColorDialog>
|
||||||
|
#include <QSettings>
|
||||||
|
|
||||||
#include "qnel_widget.h"
|
#include "qnel_widget.h"
|
||||||
#include "painter_dock_widget.h"
|
#include "painter_dock_widget.h"
|
||||||
|
@ -21,6 +22,9 @@ ZonePainterMainWindow::ZonePainterMainWindow(QWidget *parent) :
|
||||||
m_nelWidget = new NLQT::QNLWidget(this);
|
m_nelWidget = new NLQT::QNLWidget(this);
|
||||||
setCentralWidget(m_nelWidget);
|
setCentralWidget(m_nelWidget);
|
||||||
|
|
||||||
|
// Load the settings.
|
||||||
|
loadConfig();
|
||||||
|
|
||||||
// Set up dock widget(s) and toolbar.
|
// Set up dock widget(s) and toolbar.
|
||||||
m_painterDockWidget = new PainterDockWidget(this);
|
m_painterDockWidget = new PainterDockWidget(this);
|
||||||
addDockWidget(Qt::RightDockWidgetArea, m_painterDockWidget);
|
addDockWidget(Qt::RightDockWidgetArea, m_painterDockWidget);
|
||||||
|
@ -135,6 +139,26 @@ void ZonePainterMainWindow::setBackgroundColor() {
|
||||||
m_nelWidget->setBackgroundColor(NLMISC::CRGBA(color.red(), color.green(), color.blue()));
|
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<QColor>();
|
||||||
|
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()
|
ZonePainterMainWindow::~ZonePainterMainWindow()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
|
|
|
@ -24,6 +24,9 @@ public:
|
||||||
explicit ZonePainterMainWindow(QWidget *parent = 0);
|
explicit ZonePainterMainWindow(QWidget *parent = 0);
|
||||||
~ZonePainterMainWindow();
|
~ZonePainterMainWindow();
|
||||||
|
|
||||||
|
void loadConfig();
|
||||||
|
void saveConfig();
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void setToolMode(int value);
|
void setToolMode(int value);
|
||||||
void setToolMode();
|
void setToolMode();
|
||||||
|
|
Loading…
Reference in a new issue