##// END OF EJS Templates
Remove unused pending request of worker since it's already in the VC....
Remove unused pending request of worker since it's already in the VC. Fix bug with progress asynchrone computation

File last commit:

r1369:b20dcec1c57b
r1387:3f0567bfecb5 HEAD
Show More
VisualizationMultiZoneSelectionDialog.cpp
69 lines | 2.4 KiB | text/x-c | CppLexer
/ gui / src / Visualization / VisualizationMultiZoneSelectionDialog.cpp
Selection of stacked zone via a dialog box
r1120 #include "Visualization/VisualizationMultiZoneSelectionDialog.h"
#include "ui_VisualizationMultiZoneSelectionDialog.h"
#include "Common/DateUtils.h"
#include "Visualization/VisualizationSelectionZoneItem.h"
Fix bug time precision with catalogue
r1369 const auto DATETIME_FORMAT_S = QStringLiteral("yyyy/MM/dd hh:mm:ss");
Selection of stacked zone via a dialog box
r1120
struct VisualizationMultiZoneSelectionDialog::VisualizationMultiZoneSelectionDialogPrivate {
QVector<VisualizationSelectionZoneItem *> m_Zones;
};
VisualizationMultiZoneSelectionDialog::VisualizationMultiZoneSelectionDialog(QWidget *parent)
: QDialog(parent, Qt::Tool),
ui(new Ui::VisualizationMultiZoneSelectionDialog),
impl{spimpl::make_unique_impl<VisualizationMultiZoneSelectionDialogPrivate>()}
{
ui->setupUi(this);
connect(ui->buttonBox, &QDialogButtonBox::accepted, this,
&VisualizationMultiZoneSelectionDialog::accept);
connect(ui->buttonBox, &QDialogButtonBox::rejected, this,
&VisualizationMultiZoneSelectionDialog::reject);
}
VisualizationMultiZoneSelectionDialog::~VisualizationMultiZoneSelectionDialog()
{
delete ui;
}
void VisualizationMultiZoneSelectionDialog::setZones(
const QVector<VisualizationSelectionZoneItem *> &zones)
{
impl->m_Zones = zones;
// Sorts the zones to display them in temporal order
std::sort(impl->m_Zones.begin(), impl->m_Zones.end(), [](auto zone1, auto zone2) {
return zone1->range().m_TStart < zone2->range().m_TStart;
});
// Adds the zones in the listwidget
for (auto zone : impl->m_Zones) {
auto name = zone->name();
if (!name.isEmpty()) {
name += tr(": ");
}
auto range = zone->range();
Fix bug time precision with catalogue
r1369 name += DateUtils::dateTime(range.m_TStart).toString(DATETIME_FORMAT_S);
Selection of stacked zone via a dialog box
r1120 name += " - ";
Fix bug time precision with catalogue
r1369 name += DateUtils::dateTime(range.m_TEnd).toString(DATETIME_FORMAT_S);
Selection of stacked zone via a dialog box
r1120
auto item = new QListWidgetItem(name, ui->listWidget);
item->setSelected(zone->selected());
}
}
QMap<VisualizationSelectionZoneItem *, bool>
VisualizationMultiZoneSelectionDialog::selectedZones() const
{
QMap<VisualizationSelectionZoneItem *, bool> selectedZones;
for (auto i = 0; i < ui->listWidget->count(); ++i) {
auto item = ui->listWidget->item(i);
selectedZones[impl->m_Zones[i]] = item->isSelected();
}
return selectedZones;
}