mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 21:13:35 +00:00
[traffic][qt] Make HttpTraffSource configurable from Qt GUI
Signed-off-by: mvglasow <michael -at- vonglasow.com>
This commit is contained in:
@@ -183,6 +183,31 @@ namespace qt
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
QLabel * trafficHttpUrlLabel = new QLabel("Traffic API URL:");
|
||||||
|
|
||||||
|
QLineEdit * trafficHttpUrlLineEdit = new QLineEdit();
|
||||||
|
{
|
||||||
|
trafficHttpUrlLineEdit->setText(QString::fromStdString(framework.LoadTrafficHttpUrl()));
|
||||||
|
connect(trafficHttpUrlLineEdit, &QLineEdit::editingFinished, [&framework, trafficHttpUrlLineEdit]()
|
||||||
|
{
|
||||||
|
framework.SaveTrafficHttpUrl(trafficHttpUrlLineEdit->text().toStdString());
|
||||||
|
framework.SetTrafficHttpUrl(trafficHttpUrlLineEdit->text().toStdString());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
QCheckBox * trafficHttpEnabledCheckBox = new QCheckBox("Enable live traffic data");
|
||||||
|
{
|
||||||
|
trafficHttpEnabledCheckBox->setChecked(framework.LoadTrafficHttpEnabled());
|
||||||
|
connect(trafficHttpEnabledCheckBox, &QCheckBox::stateChanged, [&framework, trafficHttpUrlLabel, trafficHttpUrlLineEdit](int i)
|
||||||
|
{
|
||||||
|
bool const enable = i > 0;
|
||||||
|
framework.SaveTrafficHttpEnabled(enable);
|
||||||
|
framework.SetTrafficHttpEnabled(enable);
|
||||||
|
trafficHttpUrlLabel->setEnabled(enable);
|
||||||
|
trafficHttpUrlLineEdit->setEnabled(enable);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
QHBoxLayout * bottomLayout = new QHBoxLayout();
|
QHBoxLayout * bottomLayout = new QHBoxLayout();
|
||||||
{
|
{
|
||||||
QPushButton * closeButton = new QPushButton(tr("Close"));
|
QPushButton * closeButton = new QPushButton(tr("Close"));
|
||||||
@@ -206,6 +231,9 @@ namespace qt
|
|||||||
#ifdef BUILD_DESIGNER
|
#ifdef BUILD_DESIGNER
|
||||||
finalLayout->addWidget(indexRegenCheckBox);
|
finalLayout->addWidget(indexRegenCheckBox);
|
||||||
#endif
|
#endif
|
||||||
|
finalLayout->addWidget(trafficHttpEnabledCheckBox);
|
||||||
|
finalLayout->addWidget(trafficHttpUrlLabel);
|
||||||
|
finalLayout->addWidget(trafficHttpUrlLineEdit);
|
||||||
finalLayout->addLayout(bottomLayout);
|
finalLayout->addLayout(bottomLayout);
|
||||||
setLayout(finalLayout);
|
setLayout(finalLayout);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user