Brief description of class still missing. More...
#include <WaranGpsWidget.h>
Public Types | |
| enum | Mode { NoGps, Gps } |
Public Member Functions | |
| void | setCoordinates (QString fileName=QString::null, QString coordinateFormat=QString::null) |
| void | setGpsStations (quint16 port=2974) |
| void | setMode (Mode m) |
| WaranGpsWidget (QWidget *parent=0) | |
| ~WaranGpsWidget () | |
Brief description of class still missing.
Full description of class still missing
| enum WaranGpsWidget::Mode |
| WaranGpsWidget::WaranGpsWidget | ( | QWidget * | parent = 0 | ) |
Description of constructor still missing
References QGpCoreTools::SamplingParameters::setCount(), QGpCoreTools::SamplingParameters::setRange(), GpsTableModel::setStations(), QGpCoreTools::SamplingParameters::setType(), QGpCoreTools::tr(), and TRACE.
: QWidget(parent)
{
TRACE;
setupUi(this);
_distanceMapErrors=new CircleViewer(distanceMap);
theoreticalResponse->createObjects(true);
// TODO: set these value in the command line
SamplingParameters frequencySampling;
frequencySampling.setCount(200);
frequencySampling.setRange(0.1,50);
frequencySampling.setType(SamplingParameters::Log);
theoreticalResponse->setFrequencySampling(frequencySampling);
ringEditor->setCoArrayGraph(coArrayMap);
coArrayMap->mapLayer()->setShowNames(false);
_arrayEditAction=arrayMap->mapLayer()->addTrackingAction(tr("&Edit"), NameLineLayer::Edit, tr("Edit points."));
connect(arrayMap->mapLayer(),SIGNAL(lineEdited(int)), this, SLOT(arrayMapChanged()));
StationCoordinatesItem * arrayModel=new StationCoordinatesItem(this);
arrayModel->setStations(&_arrayMultiplied);
connect(arrayModel,SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(arrayTableChanged()));
arrayTable->setModel(arrayModel);
arrayTable->setItemDelegate(new StationCoordinatesDelegate(this) );
GpsTableModel * gpsModel=new GpsTableModel(this);
gpsModel->setStations(&_gpsStations);
gpsTable->setModel(gpsModel);
gpsTable->setEditTriggers(QAbstractItemView::AllEditTriggers);
gpsTable->setSelectionMode(QAbstractItemView::SingleSelection);
connect(&_gpsUpdate, SIGNAL(timeout()), this, SLOT(updateGps()));
_gpsUpdate.setInterval(10000);
_gpsUpdate.start();
}
| void WaranGpsWidget::setCoordinates | ( | QString | fileName = QString::null, |
| QString | coordinateFormat = QString::null |
||
| ) |
References QGpGuiTools::CoordinateFile::points(), QGpGuiTools::CoordinateFile::read(), and TRACE.
Referenced by main().
{
TRACE;
CoordinateFile cf;
if(cf.read(fileName, coordinateFormat)) {
_arrayBase=cf.points();
arrayChanged();
}
}
| void WaranGpsWidget::setGpsStations | ( | quint16 | port = 2974 | ) |
References MSG_ID, GpsStation::setHostName(), GpsStation::setName(), GpsStation::setPort(), QGpCoreTools::LineParser::setString(), QGpCoreTools::LineParser::toString(), QGpCoreTools::tr(), and TRACE.
Referenced by main(), and setMode().
{
TRACE;
QFile f("/etc/hosts");
if(!f.open(QIODevice::ReadOnly)) {
Message::warning(MSG_ID, tr("Reading station list"), tr("Cannot read station list in file %1").arg("/etc/hosts"));
return;
}
QTextStream s(&f);
LineParser lp;
qDeleteAll(_gpsStations);
_gpsStations.clear();
bool ok=true;
int lineNumber=0;
while(!s.atEnd()) {
QString l=s.readLine();
lineNumber++;
if(l.isEmpty() || l[0]=='#') {
continue;
}
lp.setString(l);
QString name=lp.toString(1, ok);
if(name.startsWith("WAU")) {
GpsStation * stat=new GpsStation;
stat->setName(name);
stat->setHostName(lp.toString(0, ok));
stat->setPort(port);
_gpsStations.append(stat);
}
if(!ok) {
Message::warning(MSG_ID, tr("Reading station list"),
tr("Error reading line %1 in file %2").arg(lineNumber).arg("/etc/hosts"),
Message::ok(), true);
ok=true;
}
}
// Force reset of table
static_cast<GpsTableModel *>(gpsTable->model())->setStations(&_gpsStations);
}
| void WaranGpsWidget::setMode | ( | Mode | m | ) |
References Gps, NoGps, and setGpsStations().
Referenced by main().
{
if(m==Gps) {
if(_gpsStations.isEmpty()) {
setGpsStations();
if(_gpsStations.isEmpty()) {
m=NoGps;
}
}
}
if(m==Gps) {
arrayTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
arrayTable->setSelectionMode(QAbstractItemView::NoSelection);
_arrayEditAction->setEnabled(false);
} else {
arrayTable->setEditTriggers(QAbstractItemView::AllEditTriggers);
arrayTable->setSelectionMode(QAbstractItemView::SingleSelection);
_arrayEditAction->setEnabled(true);
}
gpsTab->setEnabled(m==Gps);
distancesTab->setEnabled(m==Gps);
arrayLoadBut->setEnabled(m==NoGps);
arrayGenerateBut->setEnabled(m==NoGps);
modeCombo->blockSignals(true);
modeCombo->setCurrentIndex(m==Gps ? 0 : 1);
modeCombo->blockSignals(false);
}