You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
2.3 KiB

/*
* 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();
}

Powered by TurnKey Linux.