|
24 | 24 | #include "CustomDeltaTEquationDialog.hpp" |
25 | 25 | #include "ConfigureScreenshotsDialog.hpp" |
26 | 26 | #include "StelMainView.hpp" |
| 27 | +#include "StelSpeechMgr.hpp" |
27 | 28 | #include "ui_configurationDialog.h" |
28 | 29 | #include "StelApp.hpp" |
29 | 30 | #include "StelFileMgr.hpp" |
@@ -801,6 +802,159 @@ void ConfigurationDialog::saveCustomSelectedInfo() |
801 | 802 | conf->endGroup(); |
802 | 803 | } |
803 | 804 |
|
| 805 | +void ConfigurationDialog::setSelectedNarrationFromCheckBoxes() |
| 806 | +{ |
| 807 | + StelObject::InfoStringGroup flags(StelObject::None); |
| 808 | + |
| 809 | + if (ui->checkBoxName_Narrate->isChecked()) |
| 810 | + flags |= StelObject::Name; |
| 811 | + if (ui->checkBoxCatalogNumbers_Narrate->isChecked()) |
| 812 | + flags |= StelObject::CatalogNumber; |
| 813 | + if (ui->checkBoxVisualMag_Narrate->isChecked()) |
| 814 | + flags |= StelObject::Magnitude; |
| 815 | + if (ui->checkBoxAbsoluteMag_Narrate->isChecked()) |
| 816 | + flags |= StelObject::AbsoluteMagnitude; |
| 817 | + if (ui->checkBoxRaDecJ2000_Narrate->isChecked()) |
| 818 | + flags |= StelObject::RaDecJ2000; |
| 819 | + if (ui->checkBoxRaDecOfDate_Narrate->isChecked()) |
| 820 | + flags |= StelObject::RaDecOfDate; |
| 821 | + if (ui->checkBoxHourAngle_Narrate->isChecked()) |
| 822 | + flags |= StelObject::HourAngle; |
| 823 | + if (ui->checkBoxAltAz_Narrate->isChecked()) |
| 824 | + flags |= StelObject::AltAzi; |
| 825 | + if (ui->checkBoxDistance_Narrate->isChecked()) |
| 826 | + flags |= StelObject::Distance; |
| 827 | + if (ui->checkBoxVelocity_Narrate->isChecked()) |
| 828 | + flags |= StelObject::Velocity; |
| 829 | + if (ui->checkBoxProperMotion_Narrate->isChecked()) |
| 830 | + flags |= StelObject::ProperMotion; |
| 831 | + if (ui->checkBoxSize_Narrate->isChecked()) |
| 832 | + flags |= StelObject::Size; |
| 833 | + if (ui->checkBoxExtra_Narrate->isChecked()) |
| 834 | + flags |= StelObject::Extra; |
| 835 | + if (ui->checkBoxGalacticCoordinates_Narrate->isChecked()) |
| 836 | + flags |= StelObject::GalacticCoord; |
| 837 | + if (ui->checkBoxSupergalacticCoordinates_Narrate->isChecked()) |
| 838 | + flags |= StelObject::SupergalacticCoord; |
| 839 | + if (ui->checkBoxOtherCoords_Narrate->isChecked()) |
| 840 | + flags |= StelObject::OtherCoord; |
| 841 | + if (ui->checkBoxElongation_Narrate->isChecked()) |
| 842 | + flags |= StelObject::Elongation; |
| 843 | + if (ui->checkBoxType_Narrate->isChecked()) |
| 844 | + flags |= StelObject::ObjectType; |
| 845 | + if (ui->checkBoxEclipticCoordsJ2000_Narrate->isChecked()) |
| 846 | + flags |= StelObject::EclipticCoordJ2000; |
| 847 | + if (ui->checkBoxEclipticCoordsOfDate_Narrate->isChecked()) |
| 848 | + flags |= StelObject::EclipticCoordOfDate; |
| 849 | + if (ui->checkBoxConstellation_Narrate->isChecked()) |
| 850 | + flags |= StelObject::IAUConstellation; |
| 851 | + if (ui->checkBoxSiderealTime_Narrate->isChecked()) |
| 852 | + flags |= StelObject::SiderealTime; |
| 853 | + if (ui->checkBoxRTSTime_Narrate->isChecked()) |
| 854 | + flags |= StelObject::RTSTime; |
| 855 | + if (ui->checkBoxSolarLunarPosition_Narrate->isChecked()) |
| 856 | + flags |= StelObject::SolarLunarPosition; |
| 857 | + |
| 858 | + StelApp::getInstance().getStelSpeechMgr()->setNarrationTextFilters(flags); |
| 859 | + // overwrite custom selected info settings |
| 860 | + saveCustomSelectedNarration(); |
| 861 | +} |
| 862 | + |
| 863 | +void ConfigurationDialog::setCustomSelectedNarration() |
| 864 | +{ |
| 865 | + StelObject::InfoStringGroup flags(StelObject::None); |
| 866 | + QSettings* conf = StelApp::getInstance().getSettings(); |
| 867 | + Q_ASSERT(conf); |
| 868 | + |
| 869 | + if (conf->value("custom_selected_info/flag_narration_name", false).toBool()) |
| 870 | + flags |= StelObject::Name; |
| 871 | + if (conf->value("custom_selected_info/flag_narration_catalognumber", false).toBool()) |
| 872 | + flags |= StelObject::CatalogNumber; |
| 873 | + if (conf->value("custom_selected_info/flag_narration_magnitude", false).toBool()) |
| 874 | + flags |= StelObject::Magnitude; |
| 875 | + if (conf->value("custom_selected_info/flag_narration_absolutemagnitude", false).toBool()) |
| 876 | + flags |= StelObject::AbsoluteMagnitude; |
| 877 | + if (conf->value("custom_selected_info/flag_narration_radecj2000", false).toBool()) |
| 878 | + flags |= StelObject::RaDecJ2000; |
| 879 | + if (conf->value("custom_selected_info/flag_narration_radecofdate", false).toBool()) |
| 880 | + flags |= StelObject::RaDecOfDate; |
| 881 | + if (conf->value("custom_selected_info/flag_narration_hourangle", false).toBool()) |
| 882 | + flags |= StelObject::HourAngle; |
| 883 | + if (conf->value("custom_selected_info/flag_narration_altaz", false).toBool()) |
| 884 | + flags |= StelObject::AltAzi; |
| 885 | + if (conf->value("custom_selected_info/flag_narration_elongation", false).toBool()) |
| 886 | + flags |= StelObject::Elongation; |
| 887 | + if (conf->value("custom_selected_info/flag_narration_distance", false).toBool()) |
| 888 | + flags |= StelObject::Distance; |
| 889 | + if (conf->value("custom_selected_info/flag_narration_velocity", false).toBool()) |
| 890 | + flags |= StelObject::Velocity; |
| 891 | + if (conf->value("custom_selected_info/flag_narration_propermotion", false).toBool()) |
| 892 | + flags |= StelObject::ProperMotion; |
| 893 | + if (conf->value("custom_selected_info/flag_narration_size", false).toBool()) |
| 894 | + flags |= StelObject::Size; |
| 895 | + if (conf->value("custom_selected_info/flag_narration_extra", false).toBool()) |
| 896 | + flags |= StelObject::Extra; |
| 897 | + if (conf->value("custom_selected_info/flag_narration_galcoord", false).toBool()) |
| 898 | + flags |= StelObject::GalacticCoord; |
| 899 | + if (conf->value("custom_selected_info/flag_narration_supergalcoord", false).toBool()) |
| 900 | + flags |= StelObject::SupergalacticCoord; |
| 901 | + if (conf->value("custom_selected_info/flag_narration_othercoord", false).toBool()) |
| 902 | + flags |= StelObject::OtherCoord; |
| 903 | + if (conf->value("custom_selected_info/flag_narration_type", false).toBool()) |
| 904 | + flags |= StelObject::ObjectType; |
| 905 | + if (conf->value("custom_selected_info/flag_narration_eclcoordofdate", false).toBool()) |
| 906 | + flags |= StelObject::EclipticCoordOfDate; |
| 907 | + if (conf->value("custom_selected_info/flag_narration_eclcoordj2000", false).toBool()) |
| 908 | + flags |= StelObject::EclipticCoordJ2000; |
| 909 | + if (conf->value("custom_selected_info/flag_narration_constellation", false).toBool()) |
| 910 | + flags |= StelObject::IAUConstellation; |
| 911 | + if (conf->value("custom_selected_info/flag_narration_sidereal_time", false).toBool()) |
| 912 | + flags |= StelObject::SiderealTime; |
| 913 | + if (conf->value("custom_selected_info/flag_narration_rts_time", false).toBool()) |
| 914 | + flags |= StelObject::RTSTime; |
| 915 | + if (conf->value("custom_selected_info/flag_narration_solar_lunar", false).toBool()) |
| 916 | + flags |= StelObject::SolarLunarPosition; |
| 917 | + |
| 918 | + StelApp::getInstance().getStelSpeechMgr()->setNarrationTextFilters(flags); |
| 919 | + updateSelectedInfoCheckBoxes(); |
| 920 | +} |
| 921 | + |
| 922 | +void ConfigurationDialog::saveCustomSelectedNarration() |
| 923 | +{ |
| 924 | + // configuration dialog / selected object info tab |
| 925 | + const StelObject::InfoStringGroup& flags = StelApp::getInstance().getStelSpeechMgr()->getNarrationTextFilters(); |
| 926 | + QSettings* conf = StelApp::getInstance().getSettings(); |
| 927 | + Q_ASSERT(conf); |
| 928 | + |
| 929 | + conf->beginGroup("custom_selected_info"); |
| 930 | + conf->setValue("flag_narration_name", static_cast<bool>(flags & StelObject::Name)); |
| 931 | + conf->setValue("flag_narration_catalognumber", static_cast<bool>(flags & StelObject::CatalogNumber)); |
| 932 | + conf->setValue("flag_narration_magnitude", static_cast<bool>(flags & StelObject::Magnitude)); |
| 933 | + conf->setValue("flag_narration_absolutemagnitude", static_cast<bool>(flags & StelObject::AbsoluteMagnitude)); |
| 934 | + conf->setValue("flag_narration_radecj2000", static_cast<bool>(flags & StelObject::RaDecJ2000)); |
| 935 | + conf->setValue("flag_narration_radecofdate", static_cast<bool>(flags & StelObject::RaDecOfDate)); |
| 936 | + conf->setValue("flag_narration_hourangle", static_cast<bool>(flags & StelObject::HourAngle)); |
| 937 | + conf->setValue("flag_narration_altaz", static_cast<bool>(flags & StelObject::AltAzi)); |
| 938 | + conf->setValue("flag_narration_elongation", static_cast<bool>(flags & StelObject::Elongation)); |
| 939 | + conf->setValue("flag_narration_distance", static_cast<bool>(flags & StelObject::Distance)); |
| 940 | + conf->setValue("flag_narration_velocity", static_cast<bool>(flags & StelObject::Velocity)); |
| 941 | + conf->setValue("flag_narration_propermotion", static_cast<bool>(flags & StelObject::ProperMotion)); |
| 942 | + conf->setValue("flag_narration_size", static_cast<bool>(flags & StelObject::Size)); |
| 943 | + conf->setValue("flag_narration_extra", static_cast<bool>(flags & StelObject::Extra)); |
| 944 | + conf->setValue("flag_narration_galcoord", static_cast<bool>(flags & StelObject::GalacticCoord)); |
| 945 | + conf->setValue("flag_narration_supergalcoord", static_cast<bool>(flags & StelObject::SupergalacticCoord)); |
| 946 | + conf->setValue("flag_narration_othercoord", static_cast<bool>(flags & StelObject::OtherCoord)); |
| 947 | + conf->setValue("flag_narration_type", static_cast<bool>(flags & StelObject::ObjectType)); |
| 948 | + conf->setValue("flag_narration_eclcoordofdate", static_cast<bool>(flags & StelObject::EclipticCoordOfDate)); |
| 949 | + conf->setValue("flag_narration_eclcoordj2000", static_cast<bool>(flags & StelObject::EclipticCoordJ2000)); |
| 950 | + conf->setValue("flag_narration_constellation", static_cast<bool>(flags & StelObject::IAUConstellation)); |
| 951 | + conf->setValue("flag_narration_sidereal_time", static_cast<bool>(flags & StelObject::SiderealTime)); |
| 952 | + conf->setValue("flag_narration_rts_time", static_cast<bool>(flags & StelObject::RTSTime)); |
| 953 | + conf->setValue("flag_narration_solar_lunar", static_cast<bool>(flags & StelObject::SolarLunarPosition)); |
| 954 | + conf->endGroup(); |
| 955 | +} |
| 956 | + |
| 957 | + |
804 | 958 | void ConfigurationDialog::browseForScreenshotDir() |
805 | 959 | { |
806 | 960 | const QString &oldScreenshotDir = StelFileMgr::getScreenshotDir(); |
@@ -1904,6 +2058,36 @@ void ConfigurationDialog::updateSelectedInfoCheckBoxes() |
1904 | 2058 | ui->checkBoxRTSTime->setChecked(flags & StelObject::RTSTime); |
1905 | 2059 | ui->checkBoxSolarLunarPosition->setChecked(flags & StelObject::SolarLunarPosition); |
1906 | 2060 |
|
| 2061 | +#if (QT_VERSION>=QT_VERSION_CHECK(6,6,0)) && defined(ENABLE_MEDIA) |
| 2062 | + static StelSpeechMgr *speech=StelApp::getInstance().getStelSpeechMgr(); |
| 2063 | + const StelObject::InfoStringGroup& nFlags = speech->getNarrationTextFilters(); |
| 2064 | + |
| 2065 | + ui->checkBoxName_Narrate->setChecked(nFlags & StelObject::Name); |
| 2066 | + ui->checkBoxCatalogNumbers_Narrate->setChecked(nFlags & StelObject::CatalogNumber); |
| 2067 | + ui->checkBoxVisualMag_Narrate->setChecked(nFlags & StelObject::Magnitude); |
| 2068 | + ui->checkBoxAbsoluteMag_Narrate->setChecked(nFlags & StelObject::AbsoluteMagnitude); |
| 2069 | + ui->checkBoxRaDecJ2000_Narrate->setChecked(nFlags & StelObject::RaDecJ2000); |
| 2070 | + ui->checkBoxRaDecOfDate_Narrate->setChecked(nFlags & StelObject::RaDecOfDate); |
| 2071 | + ui->checkBoxHourAngle_Narrate->setChecked(nFlags & StelObject::HourAngle); |
| 2072 | + ui->checkBoxAltAz_Narrate->setChecked(nFlags & StelObject::AltAzi); |
| 2073 | + ui->checkBoxDistance_Narrate->setChecked(nFlags & StelObject::Distance); |
| 2074 | + ui->checkBoxVelocity_Narrate->setChecked(nFlags & StelObject::Velocity); |
| 2075 | + ui->checkBoxProperMotion_Narrate->setChecked(nFlags & StelObject::ProperMotion); |
| 2076 | + ui->checkBoxSize_Narrate->setChecked(nFlags & StelObject::Size); |
| 2077 | + ui->checkBoxExtra_Narrate->setChecked(nFlags & StelObject::Extra); |
| 2078 | + ui->checkBoxGalacticCoordinates_Narrate->setChecked(nFlags & StelObject::GalacticCoord); |
| 2079 | + ui->checkBoxSupergalacticCoordinates_Narrate->setChecked(nFlags & StelObject::SupergalacticCoord); |
| 2080 | + ui->checkBoxOtherCoords_Narrate->setChecked(nFlags & StelObject::OtherCoord); |
| 2081 | + ui->checkBoxElongation_Narrate->setChecked(nFlags & StelObject::Elongation); |
| 2082 | + ui->checkBoxType_Narrate->setChecked(nFlags & StelObject::ObjectType); |
| 2083 | + ui->checkBoxEclipticCoordsJ2000_Narrate->setChecked(nFlags & StelObject::EclipticCoordJ2000); |
| 2084 | + ui->checkBoxEclipticCoordsOfDate_Narrate->setChecked(nFlags & StelObject::EclipticCoordOfDate); |
| 2085 | + ui->checkBoxConstellation_Narrate->setChecked(nFlags & StelObject::IAUConstellation); |
| 2086 | + ui->checkBoxSiderealTime_Narrate->setChecked(nFlags & StelObject::SiderealTime); |
| 2087 | + ui->checkBoxRTSTime_Narrate->setChecked(nFlags & StelObject::RTSTime); |
| 2088 | + ui->checkBoxSolarLunarPosition_Narrate->setChecked(nFlags & StelObject::SolarLunarPosition); |
| 2089 | +#endif |
| 2090 | + |
1907 | 2091 | if (StelApp::getInstance().getFlagImmediateSave()) |
1908 | 2092 | { |
1909 | 2093 | saveCustomSelectedInfo(); |
|
0 commit comments