parent
cb7886c8ee
commit
030c99cd46
@ -0,0 +1,82 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2011-2015,2018 by Jonathan Naylor G4KLX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "DStarRepeaterConfigIcomSet.h"
|
||||||
|
#include "SerialPortSelector.h"
|
||||||
|
|
||||||
|
const unsigned int BORDER_SIZE = 5U;
|
||||||
|
const unsigned int CONTROL_WIDTH1 = 150U;
|
||||||
|
|
||||||
|
const unsigned int PORT_LENGTH = 5U;
|
||||||
|
|
||||||
|
|
||||||
|
CDStarRepeaterConfigIcomSet::CDStarRepeaterConfigIcomSet(wxWindow* parent, int id, const wxString& port) :
|
||||||
|
wxDialog(parent, id, wxString(_("Icom Settings"))),
|
||||||
|
m_port(NULL)
|
||||||
|
{
|
||||||
|
wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
|
||||||
|
wxFlexGridSizer* sizer = new wxFlexGridSizer(2);
|
||||||
|
|
||||||
|
wxStaticText* portLabel = new wxStaticText(this, -1, _("Port"));
|
||||||
|
sizer->Add(portLabel, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE);
|
||||||
|
|
||||||
|
m_port = new wxChoice(this, -1, wxDefaultPosition, wxSize(CONTROL_WIDTH1, -1));
|
||||||
|
sizer->Add(m_port, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE);
|
||||||
|
|
||||||
|
wxArrayString ports = CSerialPortSelector::getDevices();
|
||||||
|
for (unsigned int i = 0U; i < ports.GetCount(); i++)
|
||||||
|
m_port->Append(ports.Item(i));
|
||||||
|
|
||||||
|
bool found = m_port->SetStringSelection(port);
|
||||||
|
if (!found)
|
||||||
|
m_port->SetSelection(0);
|
||||||
|
|
||||||
|
topSizer->Add(sizer);
|
||||||
|
|
||||||
|
topSizer->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxALL | wxALIGN_RIGHT, BORDER_SIZE);
|
||||||
|
|
||||||
|
SetAutoLayout(true);
|
||||||
|
|
||||||
|
topSizer->Fit(this);
|
||||||
|
topSizer->SetSizeHints(this);
|
||||||
|
|
||||||
|
SetSizer(topSizer);
|
||||||
|
}
|
||||||
|
|
||||||
|
CDStarRepeaterConfigIcomSet::~CDStarRepeaterConfigIcomSet()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CDStarRepeaterConfigIcomSet::Validate()
|
||||||
|
{
|
||||||
|
if (m_port->GetCurrentSelection() == wxNOT_FOUND)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxString CDStarRepeaterConfigIcomSet::getPort() const
|
||||||
|
{
|
||||||
|
int n = m_port->GetCurrentSelection();
|
||||||
|
|
||||||
|
if (n == wxNOT_FOUND)
|
||||||
|
return wxEmptyString;
|
||||||
|
|
||||||
|
return m_port->GetStringSelection();
|
||||||
|
}
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2011-2015,2018 by Jonathan Naylor G4KLX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef DStarRepeaterConfigIcomSet_H
|
||||||
|
#define DStarRepeaterConfigIcomSet_H
|
||||||
|
|
||||||
|
#include "DStarRepeaterConfigDefs.h"
|
||||||
|
#include "DStarDefines.h"
|
||||||
|
|
||||||
|
#include <wx/wx.h>
|
||||||
|
|
||||||
|
class CDStarRepeaterConfigIcomSet : public wxDialog {
|
||||||
|
public:
|
||||||
|
CDStarRepeaterConfigIcomSet(wxWindow* parent, int id, const wxString& port);
|
||||||
|
virtual ~CDStarRepeaterConfigIcomSet();
|
||||||
|
|
||||||
|
virtual bool Validate();
|
||||||
|
|
||||||
|
virtual wxString getPort() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
wxChoice* m_port;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
Loading…
Reference in new issue