Commit 4d92b1d3 authored by Don Gagne's avatar Don Gagne

Rename SettingsDialog->SerialSettingsDialog

This avoids collision with main app SettingsDialog class
parent 69d34ea8
...@@ -44,9 +44,9 @@ This file is part of the APM_PLANNER project ...@@ -44,9 +44,9 @@ This file is part of the APM_PLANNER project
QT_USE_NAMESPACE QT_USE_NAMESPACE
SettingsDialog::SettingsDialog(QWidget *parent) : SerialSettingsDialog::SerialSettingsDialog(QWidget *parent) :
QDialog(parent), QDialog(parent),
ui(new Ui::SettingsDialog) ui(new Ui::SerialSettingsDialog)
{ {
ui->setupUi(this); ui->setupUi(this);
...@@ -67,17 +67,17 @@ SettingsDialog::SettingsDialog(QWidget *parent) : ...@@ -67,17 +67,17 @@ SettingsDialog::SettingsDialog(QWidget *parent) :
updateSettings(); updateSettings();
} }
SettingsDialog::~SettingsDialog() SerialSettingsDialog::~SerialSettingsDialog()
{ {
delete ui; delete ui;
} }
const SerialSettings& SettingsDialog::settings() const const SerialSettings& SerialSettingsDialog::settings() const
{ {
return m_currentSettings; return m_currentSettings;
} }
void SettingsDialog::showPortInfo(int idx) void SerialSettingsDialog::showPortInfo(int idx)
{ {
if (idx != -1) { if (idx != -1) {
QStringList list = ui->serialPortInfoListBox->itemData(idx).toStringList(); QStringList list = ui->serialPortInfoListBox->itemData(idx).toStringList();
...@@ -89,13 +89,13 @@ void SettingsDialog::showPortInfo(int idx) ...@@ -89,13 +89,13 @@ void SettingsDialog::showPortInfo(int idx)
} }
} }
void SettingsDialog::apply() void SerialSettingsDialog::apply()
{ {
updateSettings(); updateSettings();
hide(); hide();
} }
void SettingsDialog::checkCustomBaudRatePolicy(int idx) void SerialSettingsDialog::checkCustomBaudRatePolicy(int idx)
{ {
bool isCustomBaudRate = !ui->baudRateBox->itemData(idx).isValid(); bool isCustomBaudRate = !ui->baudRateBox->itemData(idx).isValid();
ui->baudRateBox->setEditable(isCustomBaudRate); ui->baudRateBox->setEditable(isCustomBaudRate);
...@@ -106,7 +106,7 @@ void SettingsDialog::checkCustomBaudRatePolicy(int idx) ...@@ -106,7 +106,7 @@ void SettingsDialog::checkCustomBaudRatePolicy(int idx)
} }
} }
void SettingsDialog::fillPortsParameters() void SerialSettingsDialog::fillPortsParameters()
{ {
// fill baud rate (is not the entire list of available values, // fill baud rate (is not the entire list of available values,
// desired values??, add your independently) // desired values??, add your independently)
...@@ -145,7 +145,7 @@ void SettingsDialog::fillPortsParameters() ...@@ -145,7 +145,7 @@ void SettingsDialog::fillPortsParameters()
ui->flowControlBox->addItem(QLatin1String("XON/XOFF"), QSerialPort::SoftwareControl); ui->flowControlBox->addItem(QLatin1String("XON/XOFF"), QSerialPort::SoftwareControl);
} }
void SettingsDialog::fillPortsInfo() void SerialSettingsDialog::fillPortsInfo()
{ {
ui->serialPortInfoListBox->clear(); ui->serialPortInfoListBox->clear();
foreach (const QSerialPortInfo &info, QSerialPortInfo::availablePorts()) { foreach (const QSerialPortInfo &info, QSerialPortInfo::availablePorts()) {
...@@ -161,7 +161,7 @@ void SettingsDialog::fillPortsInfo() ...@@ -161,7 +161,7 @@ void SettingsDialog::fillPortsInfo()
} }
} }
void SettingsDialog::updateSettings() void SerialSettingsDialog::updateSettings()
{ {
m_currentSettings.name = ui->serialPortInfoListBox->currentText(); m_currentSettings.name = ui->serialPortInfoListBox->currentText();
......
...@@ -33,14 +33,14 @@ This file is part of the APM_PLANNER project ...@@ -33,14 +33,14 @@ This file is part of the APM_PLANNER project
* *
*/ */
#ifndef SETTINGSDIALOG_H #ifndef SERIALSETTINGSDIALOG_H
#define SETTINGSDIALOG_H #define SERIALSETTINGSDIALOG_H
#include <QDialog> #include <QDialog>
#include <QSerialPort> #include <QSerialPort>
namespace Ui { namespace Ui {
class SettingsDialog; class SerialSettingsDialog;
} }
class QIntValidator; class QIntValidator;
...@@ -62,13 +62,13 @@ public: ...@@ -62,13 +62,13 @@ public:
QSerialPort::FlowControl flowControl; QSerialPort::FlowControl flowControl;
}; };
class SettingsDialog : public QDialog class SerialSettingsDialog : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit SettingsDialog(QWidget *parent = 0); explicit SerialSettingsDialog(QWidget *parent = 0);
~SettingsDialog(); ~SerialSettingsDialog();
const SerialSettings &settings() const; const SerialSettings &settings() const;
...@@ -83,9 +83,9 @@ private: ...@@ -83,9 +83,9 @@ private:
void updateSettings(); void updateSettings();
private: private:
Ui::SettingsDialog *ui; Ui::SerialSettingsDialog *ui;
SerialSettings m_currentSettings; SerialSettings m_currentSettings;
QIntValidator *m_intValidator; QIntValidator *m_intValidator;
}; };
#endif // SETTINGSDIALOG_H #endif
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>SettingsDialog</class> <class>SerialSettingsDialog</class>
<widget class="QDialog" name="SettingsDialog"> <widget class="QDialog" name="SerialSettingsDialog">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
......
...@@ -66,7 +66,7 @@ TerminalConsole::TerminalConsole(QWidget *parent) : ...@@ -66,7 +66,7 @@ TerminalConsole::TerminalConsole(QWidget *parent) :
layout->addWidget(m_statusBar); layout->addWidget(m_statusBar);
m_serial = new QSerialPort(this); m_serial = new QSerialPort(this);
m_settingsDialog = new SettingsDialog; m_settingsDialog = new SerialSettingsDialog;
ui->connectButton->setEnabled(true); ui->connectButton->setEnabled(true);
ui->disconnectButton->setEnabled(false); ui->disconnectButton->setEnabled(false);
......
...@@ -88,7 +88,7 @@ private: ...@@ -88,7 +88,7 @@ private:
Console *m_console; Console *m_console;
QStatusBar *m_statusBar; QStatusBar *m_statusBar;
SettingsDialog *m_settingsDialog; SerialSettingsDialog *m_settingsDialog;
QSerialPort *m_serial; QSerialPort *m_serial;
SerialSettings m_settings; SerialSettings m_settings;
ConsoleMode m_consoleMode; ConsoleMode m_consoleMode;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment