10#include "kstarsdata.h"
12#include <QDesktopServices>
15OpsXplanet::OpsXplanet(
KStars *_ks) :
QFrame(_ks), ksw(_ks)
20 connect(kcfg_xplanetIsInternal, SIGNAL(clicked()),
this, SLOT(toggleXPlanetInternal()));
21 kcfg_xplanetIsInternal->setToolTip(
i18n(
"Internal or External XPlanet?"));
23 if (Options::xplanetIsInternal())
24 kcfg_XplanetPath->setEnabled(
false);
27 kcfg_xplanetIsInternal->setVisible(
false);
31 kcfg_XplanetProjection->addItem(
i18nc(
"Map projection method",
"No projection"),
"no projection");
32 kcfg_XplanetProjection->addItem(
i18nc(
"Map projection method",
"Ancient"),
"ancient");
33 kcfg_XplanetProjection->addItem(
i18nc(
"Map projection method",
"Azimuthal"),
"azimuthal");
34 kcfg_XplanetProjection->addItem(
i18nc(
"Map projection method",
"Bonne"),
"bonne");
35 kcfg_XplanetProjection->addItem(
i18nc(
"Map projection method",
"Gnomonic"),
"gnomonic");
36 kcfg_XplanetProjection->addItem(
i18nc(
"Map projection method",
"Hemisphere"),
"hemisphere");
37 kcfg_XplanetProjection->addItem(
i18nc(
"Map projection method",
"Lambert"),
"lambert");
38 kcfg_XplanetProjection->addItem(
i18nc(
"Map projection method",
"Mercator"),
"mercator");
39 kcfg_XplanetProjection->addItem(
i18nc(
"Map projection method",
"Mollweide"),
"mollweide");
40 kcfg_XplanetProjection->addItem(
i18nc(
"Map projection method",
"Orthographic"),
"orthographic");
41 kcfg_XplanetProjection->addItem(
i18nc(
"Map projection method",
"Peters"),
"peters");
42 kcfg_XplanetProjection->addItem(
i18nc(
"Map projection method",
"Polyconic"),
"polyconic");
43 kcfg_XplanetProjection->addItem(
i18nc(
"Map projection method",
"Rectangular"),
"rectangular");
44 kcfg_XplanetProjection->addItem(
i18nc(
"Map projection method",
"TSC"),
"tsc");
47 connect(kcfg_XplanetConfigFile, SIGNAL(toggled(
bool)), SLOT(slotConfigFileWidgets(
bool)));
48 connect(kcfg_XplanetStarmap, SIGNAL(toggled(
bool)), SLOT(slotStarmapFileWidgets(
bool)));
49 connect(kcfg_XplanetArcFile, SIGNAL(toggled(
bool)), SLOT(slotArcFileWidgets(
bool)));
50 connect(kcfg_XplanetLabel, SIGNAL(toggled(
bool)), SLOT(slotLabelWidgets(
bool)));
51 connect(kcfg_XplanetMarkerFile, SIGNAL(toggled(
bool)), SLOT(slotMarkerFileWidgets(
bool)));
52 connect(kcfg_XplanetMarkerBounds, SIGNAL(toggled(
bool)), SLOT(slotMarkerBoundsWidgets(
bool)));
53 connect(kcfg_XplanetProjection, SIGNAL(currentIndexChanged(
int)), SLOT(slotProjectionWidgets(
int)));
54 connect(kcfg_XplanetBackground, SIGNAL(toggled(
bool)), SLOT(slotBackgroundWidgets(
bool)));
56 kcfg_XplanetConfigFilePath->setEnabled(Options::xplanetConfigFile());
57 configFileB->setEnabled(Options::xplanetConfigFile());
60 connect(configFileB, SIGNAL(clicked()),
this, SLOT(slotSelectConfigFile()));
61 kcfg_XplanetStarmapPath->setEnabled(Options::xplanetStarmap());
62 starmapFileB->setEnabled(Options::xplanetStarmap());
65 connect(starmapFileB, SIGNAL(clicked()),
this, SLOT(slotSelectStarMapFile()));
66 kcfg_XplanetArcFilePath->setEnabled(Options::xplanetArcFile());
67 arcFileB->setEnabled(Options::xplanetArcFile());
70 connect(arcFileB, SIGNAL(clicked()),
this, SLOT(slotSelectArcFile()));
71 kcfg_XplanetLabelLocalTime->setEnabled(Options::xplanetLabel());
72 kcfg_XplanetLabelGMT->setEnabled(Options::xplanetLabel());
73 textLabelXplanetLabelString->setEnabled(Options::xplanetLabel());
74 kcfg_XplanetLabelString->setEnabled(Options::xplanetLabel());
75 textLabelXplanetDateFormat->setEnabled(Options::xplanetLabel());
76 kcfg_XplanetDateFormat->setEnabled(Options::xplanetLabel());
77 textLabelXplanetFontSize->setEnabled(Options::xplanetLabel());
78 kcfg_XplanetFontSize->setEnabled(Options::xplanetLabel());
79 textLabelXplanetColor->setEnabled(Options::xplanetLabel());
80 kcfg_XplanetColor->setEnabled(Options::xplanetLabel());
81 textLabelLabelPos->setEnabled(Options::xplanetLabel());
82 kcfg_XplanetLabelTL->setEnabled(Options::xplanetLabel());
83 kcfg_XplanetLabelTR->setEnabled(Options::xplanetLabel());
84 kcfg_XplanetLabelBR->setEnabled(Options::xplanetLabel());
85 kcfg_XplanetLabelBL->setEnabled(Options::xplanetLabel());
86 kcfg_XplanetMarkerFilePath->setEnabled(Options::xplanetMarkerFile());
87 kcfg_XplanetMarkerBounds->setEnabled(Options::xplanetMarkerFile());
88 if (Options::xplanetMarkerFile() && Options::xplanetMarkerBounds())
89 kcfg_XplanetMarkerBoundsPath->setEnabled(
true);
91 kcfg_XplanetMarkerBoundsPath->setEnabled(
false);
92 if (Options::xplanetProjection() == 0)
93 groupBoxBackground->setEnabled(
false);
94 kcfg_XplanetBackgroundImage->setEnabled(Options::xplanetBackgroundImage());
95 kcfg_XplanetBackgroundImagePath->setEnabled(Options::xplanetBackgroundImage());
96 kcfg_XplanetBackgroundColor->setEnabled(Options::xplanetBackgroundImage());
97 kcfg_XplanetBackgroundColorValue->setEnabled(Options::xplanetBackgroundImage());
98 if (Options::xplanetProjection() == 0)
99 groupBoxBackground->setEnabled(
false);
102 kcfg_XplanetUseFIFO->setChecked(
false);
103 kcfg_XplanetUseFIFO->setDisabled(
true);
104 kcfg_XplanetUseFIFO->setToolTip(
i18n(
"FIFO files are not supported on Windows"));
107 connect(openXPlanetMaps, SIGNAL(clicked()),
this,SLOT(showXPlanetMapsDirectory()));
110void OpsXplanet::showXPlanetMapsDirectory()
119QString OpsXplanet::XPlanetShareDirectory()
122 const QFileInfo xPlanetLocationInfo(Options::xplanetPath());
123 return xPlanetLocationInfo.dir().absolutePath() +
QDir::separator() +
"xplanet";
126 if (Options::xplanetIsInternal())
129 return Options::xplanetPath() +
"../share/xplanet";
132void OpsXplanet::toggleXPlanetInternal()
134 kcfg_XplanetPath->setEnabled(!kcfg_xplanetIsInternal->isChecked());
135 if (kcfg_xplanetIsInternal->isChecked())
136 kcfg_XplanetPath->setText(
"*Internal XPlanet*");
138 kcfg_XplanetPath->setText(KSUtils::getDefaultPath(
"XplanetPath"));
141void OpsXplanet::slotConfigFileWidgets(
bool on)
143 kcfg_XplanetConfigFilePath->setEnabled(on);
144 configFileB->setEnabled(on);
147void OpsXplanet::slotStarmapFileWidgets(
bool on)
149 kcfg_XplanetStarmapPath->setEnabled(on);
150 starmapFileB->setEnabled(on);
153void OpsXplanet::slotArcFileWidgets(
bool on)
155 kcfg_XplanetArcFilePath->setEnabled(on);
156 arcFileB->setEnabled(on);
159void OpsXplanet::slotLabelWidgets(
bool on)
161 kcfg_XplanetLabelLocalTime->setEnabled(on);
162 kcfg_XplanetLabelGMT->setEnabled(on);
163 textLabelXplanetLabelString->setEnabled(on);
164 kcfg_XplanetLabelString->setEnabled(on);
165 textLabelXplanetDateFormat->setEnabled(on);
166 kcfg_XplanetDateFormat->setEnabled(on);
167 textLabelXplanetFontSize->setEnabled(on);
168 kcfg_XplanetFontSize->setEnabled(on);
169 textLabelXplanetColor->setEnabled(on);
170 kcfg_XplanetColor->setEnabled(on);
171 textLabelLabelPos->setEnabled(on);
172 kcfg_XplanetLabelTL->setEnabled(on);
173 kcfg_XplanetLabelTR->setEnabled(on);
174 kcfg_XplanetLabelBR->setEnabled(on);
175 kcfg_XplanetLabelBL->setEnabled(on);
178void OpsXplanet::slotMarkerFileWidgets(
bool on)
180 kcfg_XplanetMarkerFilePath->setEnabled(on);
181 kcfg_XplanetMarkerBounds->setEnabled(on);
182 if (kcfg_XplanetMarkerBounds->isChecked())
183 kcfg_XplanetMarkerBoundsPath->setEnabled(on);
186void OpsXplanet::slotMarkerBoundsWidgets(
bool on)
188 kcfg_XplanetMarkerBoundsPath->setEnabled(on);
191void OpsXplanet::slotProjectionWidgets(
int index)
194 groupBoxBackground->setEnabled(
false);
196 groupBoxBackground->setEnabled(
true);
198 if (!kcfg_XplanetBackground->isChecked())
200 kcfg_XplanetBackgroundImage->setEnabled(
false);
201 kcfg_XplanetBackgroundImagePath->setEnabled(
false);
202 kcfg_XplanetBackgroundColor->setEnabled(
false);
203 kcfg_XplanetBackgroundColorValue->setEnabled(
false);
207void OpsXplanet::slotBackgroundWidgets(
bool on)
209 kcfg_XplanetBackgroundImage->setEnabled(on);
210 kcfg_XplanetBackgroundImagePath->setEnabled(on);
211 kcfg_XplanetBackgroundColor->setEnabled(on);
212 kcfg_XplanetBackgroundColorValue->setEnabled(on);
215void OpsXplanet::slotSelectConfigFile()
222 kcfg_XplanetConfigFilePath->setText(
QFileInfo(file).completeBaseName());
226void OpsXplanet::slotSelectStarMapFile()
234 kcfg_XplanetStarmapPath->setText(
QFileInfo(file).completeBaseName());
238void OpsXplanet::slotSelectArcFile()
247 kcfg_XplanetArcFilePath->setText(
QFileInfo(file).completeBaseName());
This is the main window for KStars.
static KStars * Instance()
QString i18nc(const char *context, const char *text, const TYPE &arg...)
QString i18n(const char *text, const TYPE &arg...)
QString path(const QString &relativePath)
bool openUrl(const QUrl &url)
QString getOpenFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, Options options)
QIcon fromTheme(const QString &name)
QString locate(StandardLocation type, const QString &fileName, LocateOptions options)
bool isEmpty() const const
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
QUrl fromLocalFile(const QString &localFile)