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 <QColor>
|
||||
#include <QColorDialog>
|
||||
#include <QSettings>
|
||||
|
||||
#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<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()
|
||||
{
|
||||
delete ui;
|
||||
|
|
|
@ -24,6 +24,9 @@ public:
|
|||
explicit ZonePainterMainWindow(QWidget *parent = 0);
|
||||
~ZonePainterMainWindow();
|
||||
|
||||
void loadConfig();
|
||||
void saveConfig();
|
||||
|
||||
public Q_SLOTS:
|
||||
void setToolMode(int value);
|
||||
void setToolMode();
|
||||
|
|
Loading…
Reference in a new issue