Changeset View
Changeset View
Standalone View
Standalone View
kstars/ekos/observatory/observatory.cpp
Show All 30 Lines | 17 | { | |||
---|---|---|---|---|---|
31 | 31 | | |||
32 | setDomeModel(new ObservatoryDomeModel()); | 32 | setDomeModel(new ObservatoryDomeModel()); | ||
33 | setWeatherModel(new ObservatoryWeatherModel()); | 33 | setWeatherModel(new ObservatoryWeatherModel()); | ||
34 | statusDefinitionBox->setVisible(true); | 34 | statusDefinitionBox->setVisible(true); | ||
35 | statusDefinitionBox->setEnabled(true); | 35 | statusDefinitionBox->setEnabled(true); | ||
36 | // make invisible, since not implemented yet | 36 | // make invisible, since not implemented yet | ||
37 | weatherWarningSchedulerCB->setVisible(false); | 37 | weatherWarningSchedulerCB->setVisible(false); | ||
38 | weatherAlertSchedulerCB->setVisible(false); | 38 | weatherAlertSchedulerCB->setVisible(false); | ||
39 | // initialize the weather sensor data group box | ||||
40 | sensorDataBoxLayout = new QFormLayout(); | ||||
41 | sensorDataBox->setLayout(sensorDataBoxLayout); | ||||
39 | } | 42 | } | ||
40 | 43 | | |||
41 | void Observatory::setObseratoryStatusControl(ObservatoryStatusControl control) | 44 | void Observatory::setObseratoryStatusControl(ObservatoryStatusControl control) | ||
42 | { | 45 | { | ||
43 | if (mObservatoryModel != nullptr) | 46 | if (mObservatoryModel != nullptr) | ||
44 | { | 47 | { | ||
45 | useDomeCB->setChecked(control.useDome); | 48 | useDomeCB->setChecked(control.useDome); | ||
46 | useShutterCB->setChecked(control.useShutter); | 49 | useShutterCB->setChecked(control.useShutter); | ||
▲ Show 20 Lines • Show All 457 Lines • ▼ Show 20 Line(s) | 505 | case ISD::Weather::WEATHER_ALERT: | |||
504 | appendLogText(i18n("Weather Alert")); | 507 | appendLogText(i18n("Weather Alert")); | ||
505 | break; | 508 | break; | ||
506 | default: | 509 | default: | ||
507 | label = ""; | 510 | label = ""; | ||
508 | break; | 511 | break; | ||
509 | } | 512 | } | ||
510 | 513 | | |||
511 | weatherStatusLabel->setPixmap(QIcon::fromTheme(label.c_str()).pixmap(QSize(48, 48))); | 514 | weatherStatusLabel->setPixmap(QIcon::fromTheme(label.c_str()).pixmap(QSize(48, 48))); | ||
515 | | ||||
516 | std::vector<ISD::Weather::WeatherData> weatherData = getWeatherModel()->getWeatherData(); | ||||
517 | | ||||
518 | // update weather sensor data | ||||
519 | int row_nr = 0; | ||||
520 | std::vector<ISD::Weather::WeatherData>::iterator it; | ||||
521 | for (it=weatherData.begin(); it != weatherData.end(); ++it) | ||||
522 | { | ||||
523 | if (sensorDataBoxLayout->rowCount() > row_nr) | ||||
524 | { | ||||
525 | sensorDataWidgets.value(row_nr)->first->setText(QString(it->label)); | ||||
526 | sensorDataWidgets.value(row_nr)->second->setText(QString().setNum(it->value, 'f', 2)); | ||||
527 | } | ||||
528 | else | ||||
529 | { | ||||
530 | QLabel* labelWidget = new QLabel(it->label); | ||||
531 | QLineEdit* valueWidget = new QLineEdit(QString().setNum(it->value, 'f', 2)); | ||||
532 | valueWidget->setReadOnly(false); | ||||
533 | valueWidget->setAlignment(Qt::AlignRight); | ||||
534 | | ||||
535 | sensorDataWidgets.append(new QPair<QLabel*, QLineEdit*>(labelWidget, valueWidget)); | ||||
536 | | ||||
537 | sensorDataBoxLayout->addRow(labelWidget, valueWidget); | ||||
538 | } | ||||
539 | row_nr++; | ||||
540 | } | ||||
541 | | ||||
512 | } | 542 | } | ||
513 | 543 | | |||
514 | 544 | | |||
515 | void Observatory::weatherWarningSettingsChanged() | 545 | void Observatory::weatherWarningSettingsChanged() | ||
516 | { | 546 | { | ||
517 | struct WeatherActions actions; | 547 | struct WeatherActions actions; | ||
518 | actions.parkDome = weatherWarningDomeCB->isChecked(); | 548 | actions.parkDome = weatherWarningDomeCB->isChecked(); | ||
519 | actions.closeShutter = weatherWarningShutterCB->isChecked(); | 549 | actions.closeShutter = weatherWarningShutterCB->isChecked(); | ||
520 | actions.delay = weatherWarningDelaySB->value(); | 550 | actions.delay = static_cast<unsigned int>(weatherWarningDelaySB->value()); | ||
521 | 551 | | |||
522 | getWeatherModel()->setWarningActions(actions); | 552 | getWeatherModel()->setWarningActions(actions); | ||
523 | } | 553 | } | ||
524 | 554 | | |||
525 | void Observatory::weatherAlertSettingsChanged() | 555 | void Observatory::weatherAlertSettingsChanged() | ||
526 | { | 556 | { | ||
527 | struct WeatherActions actions; | 557 | struct WeatherActions actions; | ||
528 | actions.parkDome = weatherAlertDomeCB->isChecked(); | 558 | actions.parkDome = weatherAlertDomeCB->isChecked(); | ||
529 | actions.closeShutter = weatherAlertShutterCB->isChecked(); | 559 | actions.closeShutter = weatherAlertShutterCB->isChecked(); | ||
530 | actions.delay = weatherAlertDelaySB->value(); | 560 | actions.delay = static_cast<unsigned int>(weatherAlertDelaySB->value()); | ||
531 | 561 | | |||
532 | getWeatherModel()->setAlertActions(actions); | 562 | getWeatherModel()->setAlertActions(actions); | ||
533 | } | 563 | } | ||
534 | 564 | | |||
535 | void Observatory::observatoryStatusChanged(bool ready) | 565 | void Observatory::observatoryStatusChanged(bool ready) | ||
536 | { | 566 | { | ||
537 | // statusReadyButton->setEnabled(!ready); | 567 | // statusReadyButton->setEnabled(!ready); | ||
538 | statusReadyButton->setChecked(ready); | 568 | statusReadyButton->setChecked(ready); | ||
539 | emit newStatus(ready); | 569 | emit newStatus(ready); | ||
540 | } | 570 | } | ||
541 | 571 | | |||
542 | void Observatory::domeAzimuthChanged(double position) | 572 | void Observatory::domeAzimuthChanged(double position) | ||
543 | { | 573 | { | ||
544 | domeAzimuthPosition->setText(QString::number(position, 'f', 2)); | 574 | domeAzimuthPosition->setText(QString::number(position, 'f', 2)); | ||
545 | } | 575 | } | ||
546 | 576 | | |||
547 | 577 | | |||
548 | void Observatory::setWarningActions(WeatherActions actions) | 578 | void Observatory::setWarningActions(WeatherActions actions) | ||
549 | { | 579 | { | ||
550 | weatherWarningDomeCB->setChecked(actions.parkDome); | 580 | weatherWarningDomeCB->setChecked(actions.parkDome); | ||
551 | weatherWarningShutterCB->setChecked(actions.closeShutter); | 581 | weatherWarningShutterCB->setChecked(actions.closeShutter); | ||
552 | weatherWarningDelaySB->setValue(actions.delay); | 582 | weatherWarningDelaySB->setValue(static_cast<int>(actions.delay)); | ||
553 | } | 583 | } | ||
554 | 584 | | |||
555 | 585 | | |||
556 | void Observatory::setAlertActions(WeatherActions actions) | 586 | void Observatory::setAlertActions(WeatherActions actions) | ||
557 | { | 587 | { | ||
558 | weatherAlertDomeCB->setChecked(actions.parkDome); | 588 | weatherAlertDomeCB->setChecked(actions.parkDome); | ||
559 | weatherAlertShutterCB->setChecked(actions.closeShutter); | 589 | weatherAlertShutterCB->setChecked(actions.closeShutter); | ||
560 | weatherAlertDelaySB->setValue(actions.delay); | 590 | weatherAlertDelaySB->setValue(static_cast<int>(actions.delay)); | ||
561 | } | 591 | } | ||
562 | 592 | | |||
563 | void Observatory::toggleButtons(QPushButton *buttonPressed, QString titlePressed, QPushButton *buttonCounterpart, QString titleCounterpart) | 593 | void Observatory::toggleButtons(QPushButton *buttonPressed, QString titlePressed, QPushButton *buttonCounterpart, QString titleCounterpart) | ||
564 | { | 594 | { | ||
565 | buttonPressed->setEnabled(false); | 595 | buttonPressed->setEnabled(false); | ||
566 | buttonPressed->setText(titlePressed); | 596 | buttonPressed->setText(titlePressed); | ||
567 | 597 | | |||
568 | buttonCounterpart->setEnabled(true); | 598 | buttonCounterpart->setEnabled(true); | ||
▲ Show 20 Lines • Show All 49 Lines • Show Last 20 Lines |