Frontend to the famous GRBL.

grbloptionsdialog.cpp 1.2KB

    /* Part of x2grbl * * Copyright Johann Wilhelm <johann.wilhelm@9mal6.de> 2015 * * see Readme.md for detailed license and usage information! */ #include "grbloptionsdialog.h" #include "ui_grbloptionsdialog.h" #include <QSettings> GrblOptionsDialog::GrblOptionsDialog(QWidget *parent) : QDialog(parent), ui(new Ui::GrblOptionsDialog) { ui->setupUi(this); QSettings settings(QSettings::IniFormat, QSettings::UserScope, QString("2.5d Grbl-Commander")); settings.beginGroup("Grbl"); if (settings.contains(QString("GrblPort"))) ui->grblPort->setText(settings.value("GrblPort").toString()); if (settings.contains(QString("GrblInitCommands"))) ui->grblInitCommands->document()->setPlainText(settings.value("GrblInitCommands").toString()); settings.endGroup(); } GrblOptionsDialog::~GrblOptionsDialog() { delete ui; } void GrblOptionsDialog::accept() { QSettings settings(QSettings::IniFormat, QSettings::UserScope, QString("2.5d Grbl-Commander")); settings.beginGroup("Grbl"); settings.setValue("GrblPort", ui->grblPort->text()); settings.setValue("GrblInitCommands", ui->grblInitCommands->document()->toPlainText()); settings.endGroup(); QDialog::accept(); }