Kstars

wutdialog.cpp
1 /*
2  SPDX-FileCopyrightText: 2003 Thomas Kabelmann <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #include "wutdialog.h"
8 
9 #include "kstars.h"
10 #include "skymap.h"
11 #include "dialogs/detaildialog.h"
12 #include "dialogs/locationdialog.h"
13 #include "dialogs/timedialog.h"
14 #include "skyobjects/kssun.h"
15 #include "skyobjects/ksmoon.h"
16 #include "skycomponents/skymapcomposite.h"
17 #include "tools/observinglist.h"
18 #include "catalogsdb.h"
19 #include "Options.h"
20 
21 WUTDialogUI::WUTDialogUI(QWidget *p) : QFrame(p)
22 {
23  setupUi(this);
24 }
25 
26 WUTDialog::WUTDialog(QWidget *parent, bool _session, GeoLocation *_geo,
27  KStarsDateTime _lt)
28  : QDialog(parent), session(_session), T0(_lt), geo(_geo)
29 {
30 #ifdef Q_OS_OSX
32 #endif
33  WUT = new WUTDialogUI(this);
34 
35  QVBoxLayout *mainLayout = new QVBoxLayout(this);
36 
37  mainLayout->addWidget(WUT);
38 
39  setWindowTitle(i18nc("@title:window", "What's up Tonight"));
40 
42  mainLayout->addWidget(buttonBox);
43  connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
44 
45  setModal(false);
46 
47  //If the Time is earlier than 6:00 am, assume the user wants the night of the previous date
48  if (T0.time().hour() < 6)
49  T0 = T0.addDays(-1);
50 
51  //Now, set time T0 to midnight (of the following day)
52  T0.setTime(QTime(0, 0, 0));
53  T0 = T0.addDays(1);
54  UT0 = geo->LTtoUT(T0);
55 
56  //Set the Tomorrow date/time to Noon the following day
57  Tomorrow = T0.addSecs(12 * 3600);
58  TomorrowUT = geo->LTtoUT(Tomorrow);
59 
60  //Set the Evening date/time to 6:00 pm
61  Evening = T0.addSecs(-6 * 3600);
62  EveningUT = geo->LTtoUT(Evening);
63 
64  QString sGeo = geo->translatedName();
65  if (!geo->translatedProvince().isEmpty())
66  sGeo += ", " + geo->translatedProvince();
67  sGeo += ", " + geo->translatedCountry();
68  WUT->LocationLabel->setText(i18n("at %1", sGeo));
69  WUT->DateLabel->setText(
70  i18n("The night of %1", QLocale().toString(Evening.date(), QLocale::LongFormat)));
71  m_Mag = 10.0;
72  WUT->MagnitudeEdit->setValue(m_Mag);
73  //WUT->MagnitudeEdit->setSliderEnabled( true );
74  WUT->MagnitudeEdit->setSingleStep(0.100);
75  initCategories();
76 
77  makeConnections();
78 }
79 
80 void WUTDialog::makeConnections()
81 {
82  connect(WUT->DateButton, SIGNAL(clicked()), SLOT(slotChangeDate()));
83  connect(WUT->LocationButton, SIGNAL(clicked()), SLOT(slotChangeLocation()));
84  connect(WUT->CenterButton, SIGNAL(clicked()), SLOT(slotCenter()));
85  connect(WUT->DetailButton, SIGNAL(clicked()), SLOT(slotDetails()));
86  connect(WUT->ObslistButton, SIGNAL(clicked()), SLOT(slotObslist()));
87  connect(WUT->CategoryListWidget, SIGNAL(currentTextChanged(QString)),
88  SLOT(slotLoadList(QString)));
89  connect(WUT->ObjectListWidget, SIGNAL(currentTextChanged(QString)),
90  SLOT(slotDisplayObject(QString)));
91  connect(WUT->EveningMorningBox, SIGNAL(activated(int)),
92  SLOT(slotEveningMorning(int)));
93  connect(WUT->MagnitudeEdit, SIGNAL(valueChanged(double)),
94  SLOT(slotChangeMagnitude()));
95 }
96 
97 void WUTDialog::initCategories()
98 {
99  m_Categories << i18n("Planets") << i18n("Stars") << i18n("Nebulae")
100  << i18n("Galaxies") << i18n("Star Clusters") << i18n("Constellations")
101  << i18n("Asteroids") << i18n("Comets");
102 
103  foreach (const QString &c, m_Categories)
104  WUT->CategoryListWidget->addItem(c);
105 
106  WUT->CategoryListWidget->setCurrentRow(0);
107 }
108 
110 {
111  QString sRise, sSet, sDuration;
112  float Dur;
113  int hDur, mDur;
114  KStarsData *data = KStarsData::Instance();
115  // reset all lists
116  foreach (const QString &c, m_Categories)
117  {
118  if (m_VisibleList.contains(c))
119  visibleObjects(c).clear();
120  else
121  m_VisibleList[c] = QSet<const SkyObject *>();
122 
123  m_CategoryInitialized[c] = false;
124  }
125 
126  // sun almanac information
127  KSSun *oSun = dynamic_cast<KSSun *>(data->objectNamed(i18n("Sun")));
128 
129  Q_ASSERT(oSun);
130 
131  sunRiseTomorrow = oSun->riseSetTime(TomorrowUT, geo, true);
132  sunSetToday = oSun->riseSetTime(EveningUT, geo, false);
133  sunRiseToday = oSun->riseSetTime(EveningUT, geo, true);
134 
135  //check to see if Sun is circumpolar
136  KSNumbers *num = new KSNumbers(UT0.djd());
137  KSNumbers *oldNum = new KSNumbers(data->ut().djd());
138  CachingDms LST = geo->GSTtoLST(T0.gst());
139 
140  oSun->updateCoords(num, true, geo->lat(), &LST, true);
141  if (oSun->checkCircumpolar(geo->lat()))
142  {
143  if (oSun->alt().Degrees() > 0.0)
144  {
145  sRise = i18n("circumpolar");
146  sSet = i18n("circumpolar");
147  sDuration = "00:00";
148  Dur = hDur = mDur = 0;
149  }
150  else
151  {
152  sRise = i18n("does not rise");
153  sSet = i18n("does not rise");
154  sDuration = "24:00";
155  Dur = hDur = 24;
156  mDur = 0;
157  }
158  }
159  else
160  {
161  //Round times to the nearest minute by adding 30 seconds to the time
162  sRise = QLocale().toString(sunRiseTomorrow);
163  sSet = QLocale().toString(sunSetToday);
164 
165  Dur = 24.0 + (float)sunRiseTomorrow.hour() +
166  (float)sunRiseTomorrow.minute() / 60.0 +
167  (float)sunRiseTomorrow.second() / 3600.0 - (float)sunSetToday.hour() -
168  (float)sunSetToday.minute() / 60.0 - (float)sunSetToday.second() / 3600.0;
169  hDur = int(Dur);
170  mDur = int(60.0 * (Dur - (float)hDur));
171  QTime tDur(hDur, mDur);
172  //sDuration = QLocale().toString(tDur);
173  // Should always be in 24 hour format
174  sDuration = tDur.toString("hh:mm");
175  }
176 
177  WUT->SunSetLabel->setText(
178  i18nc("Sunset at time %1 on date %2", "Sunset: %1 on %2", sSet,
179  QLocale().toString(Evening.date(), QLocale::LongFormat)));
180  WUT->SunRiseLabel->setText(
181  i18nc("Sunrise at time %1 on date %2", "Sunrise: %1 on %2", sRise,
182  QLocale().toString(Tomorrow.date(), QLocale::LongFormat)));
183  if (Dur == 0)
184  WUT->NightDurationLabel->setText(i18n("Night duration: %1", sDuration));
185  else if (Dur > 1)
186  WUT->NightDurationLabel->setText(i18n("Night duration: %1 hours", sDuration));
187  else if (Dur == 1)
188  WUT->NightDurationLabel->setText(i18n("Night duration: %1 hour", sDuration));
189  else if (mDur > 1)
190  WUT->NightDurationLabel->setText(i18n("Night duration: %1 minutes", sDuration));
191  else if (mDur == 1)
192  WUT->NightDurationLabel->setText(i18n("Night duration: %1 minute", sDuration));
193 
194  // moon almanac information
195  KSMoon *oMoon = dynamic_cast<KSMoon *>(data->objectNamed(i18n("Moon")));
196  moonRise = oMoon->riseSetTime(UT0, geo, true);
197  moonSet = oMoon->riseSetTime(UT0, geo, false);
198 
199  //check to see if Moon is circumpolar
200  oMoon->updateCoords(num, true, geo->lat(), &LST, true);
201  if (oMoon->checkCircumpolar(geo->lat()))
202  {
203  if (oMoon->alt().Degrees() > 0.0)
204  {
205  sRise = i18n("circumpolar");
206  sSet = i18n("circumpolar");
207  }
208  else
209  {
210  sRise = i18n("does not rise");
211  sSet = i18n("does not rise");
212  }
213  }
214  else
215  {
216  //Round times to the nearest minute by adding 30 seconds to the time
217  sRise = QLocale().toString(moonRise.addSecs(30));
218  sSet = QLocale().toString(moonSet.addSecs(30));
219  }
220 
221  WUT->MoonRiseLabel->setText(
222  i18n("Moon rises at: %1 on %2", sRise,
223  QLocale().toString(Evening.date(), QLocale::LongFormat)));
224 
225  // If the moon rises and sets on the same day, this will be valid [ Unless
226  // the moon sets on the next day after staying on for over 24 hours ]
227 
228  if (moonSet > moonRise)
229  WUT->MoonSetLabel->setText(
230  i18n("Moon sets at: %1 on %2", sSet,
231  QLocale().toString(Evening.date(), QLocale::LongFormat)));
232  else
233  WUT->MoonSetLabel->setText(
234  i18n("Moon sets at: %1 on %2", sSet,
235  QLocale().toString(Tomorrow.date(), QLocale::LongFormat)));
236  oMoon->findPhase(nullptr);
237  WUT->MoonIllumLabel->setText(oMoon->phaseName() +
238  QString(" (%1%)").arg(int(100.0 * oMoon->illum())));
239 
240  //Restore Sun's and Moon's coordinates, and recompute Moon's original Phase
241  oMoon->updateCoords(oldNum, true, geo->lat(), data->lst(), true);
242  oSun->updateCoords(oldNum, true, geo->lat(), data->lst(), true);
243  oMoon->findPhase(nullptr);
244 
245  if (WUT->CategoryListWidget->currentItem())
246  slotLoadList(WUT->CategoryListWidget->currentItem()->text());
247 
248  delete num;
249  delete oldNum;
250 }
251 
252 QSet<const SkyObject *> &WUTDialog::visibleObjects(const QString &category)
253 {
254  return m_VisibleList[category];
255 }
256 
257 const SkyObject * WUTDialog::findVisibleObject(const QString &name)
258 {
259  for (const auto &oneList : m_VisibleList)
260  {
261  for (const auto &oneObject : oneList)
262  {
263  if (oneObject->name() == name)
264  return oneObject;
265  }
266  }
267 
268  return nullptr;
269 }
270 
271 bool WUTDialog::isCategoryInitialized(const QString &category)
272 {
273  return m_CategoryInitialized[category];
274 }
275 
276 QVector<QPair<QString, const SkyObject *>> WUTDialog::load_dso(const QString &category,
277  const std::vector<SkyObject::TYPE> &types)
278 {
279  CatalogsDB::DBManager db{ CatalogsDB::dso_db_path() };
281 
282  auto &lst = m_CatalogObjects[category];
283  lst.clear();
284 
285  for (const auto type : types)
286  {
287  lst.splice(lst.end(), db.get_objects(type, m_Mag));
288  }
289 
290  objects.reserve(lst.size());
291  for (const auto &obj : lst)
292  {
293  objects.push_back({ obj.name(), &obj });
294  }
295 
296  return objects;
297 }
298 
299 void WUTDialog::slotLoadList(const QString &c)
300 {
301  KStarsData *data = KStarsData::Instance();
302  if (!m_VisibleList.contains(c))
303  return;
304 
305  WUT->ObjectListWidget->clear();
306  setCursor(QCursor(Qt::WaitCursor));
307 
308  const bool isDSO = c == m_Categories[2] || c == m_Categories[3] || c == m_Categories[4];
309 
310  if (!isCategoryInitialized(c))
311  {
312  if (c == m_Categories[0]) //Planets
313  {
314  foreach (const QString &name,
315  data->skyComposite()->objectNames(SkyObject::PLANET))
316  {
317  SkyObject *o = data->skyComposite()->findByName(name);
318 
319  if (o->mag() <= m_Mag && checkVisibility(o))
320  visibleObjects(c).insert(o);
321  }
322 
323  m_CategoryInitialized[c] = true;
324  }
325 
326  else if (c == m_Categories[1]) //Stars
327  {
329  starObjects.append(data->skyComposite()->objectLists(SkyObject::STAR));
330  starObjects.append(
331  data->skyComposite()->objectLists(SkyObject::CATALOG_STAR));
332  starObjects.append(load_dso(c, { SkyObject::STAR, SkyObject::CATALOG_STAR }));
333 
334  for (const auto &object : starObjects)
335  {
336  const SkyObject *o = object.second;
337 
338  if (o->mag() <= m_Mag && checkVisibility(o))
339  {
340  visibleObjects(c).insert(o);
341  }
342  }
343  m_CategoryInitialized[c] = true;
344  }
345 
346  else if (c == m_Categories[5]) //Constellations
347  {
348  foreach (SkyObject *o, data->skyComposite()->constellationNames())
349  if (checkVisibility(o))
350  visibleObjects(c).insert(o);
351 
352  m_CategoryInitialized[c] = true;
353  }
354 
355  else if (c == m_Categories[6]) //Asteroids
356  {
357  foreach (SkyObject *o, data->skyComposite()->asteroids())
358  if (o->mag() <= m_Mag &&
359  o->name() != i18nc("Asteroid name (optional)", "Pluto") &&
360  checkVisibility(o))
361  visibleObjects(c).insert(o);
362 
363  m_CategoryInitialized[c] = true;
364  }
365 
366  else if (c == m_Categories[7]) //Comets
367  {
368  foreach (SkyObject *o, data->skyComposite()->comets())
369  if (o->mag() <= m_Mag && checkVisibility(o))
370  visibleObjects(c).insert(o);
371 
372  m_CategoryInitialized[c] = true;
373  }
374 
375  else //all deep-sky objects, need to split clusters, nebulae and galaxies
376  {
377  auto dsos{ load_dso(c,
378  {
379  SkyObject::OPEN_CLUSTER, SkyObject::GLOBULAR_CLUSTER,
380  SkyObject::GASEOUS_NEBULA, SkyObject::PLANETARY_NEBULA,
381  SkyObject::SUPERNOVA_REMNANT, SkyObject::SUPERNOVA,
382  SkyObject::GALAXY
383  }) };
384 
385  for (auto &dso : dsos)
386  {
387  const SkyObject *o = dso.second;
388  if (checkVisibility(o) && o->mag() <= m_Mag)
389  {
390  switch (o->type())
391  {
392  case SkyObject::OPEN_CLUSTER: //fall through
393  case SkyObject::GLOBULAR_CLUSTER:
394  visibleObjects(m_Categories[4]).insert(o); //star clusters
395  break;
396  case SkyObject::GASEOUS_NEBULA: //fall through
397  case SkyObject::PLANETARY_NEBULA: //fall through
398  case SkyObject::SUPERNOVA: //fall through
399  case SkyObject::SUPERNOVA_REMNANT:
400  visibleObjects(m_Categories[2]).insert(o); //nebulae
401  break;
402  case SkyObject::GALAXY:
403  visibleObjects(m_Categories[3]).insert(o); //galaxies
404  break;
405  }
406  }
407  }
408 
409  m_CategoryInitialized[m_Categories[2]] = true;
410  m_CategoryInitialized[m_Categories[3]] = true;
411  m_CategoryInitialized[m_Categories[4]] = true;
412  }
413  }
414 
415  //Now the category has been initialized, we can populate the list widget
416  if (isDSO)
417  {
418  for (const auto &oneObject : visibleObjects(c))
419  WUT->ObjectListWidget->addItem(oneObject->name());
420  }
421  else
422  {
423  for (const auto &oneObject : visibleObjects(c))
424  WUT->ObjectListWidget->addItem(oneObject->longname());
425  }
426 
427  setCursor(QCursor(Qt::ArrowCursor));
428 
429  // highlight first item
430  if (WUT->ObjectListWidget->count())
431  {
432  WUT->ObjectListWidget->setCurrentRow(0);
433  WUT->ObjectListWidget->setFocus();
434  }
435 }
436 
438 {
439  bool visible(false);
440  double minAlt =
441  6.0; //An object is considered 'visible' if it is above horizon during civil twilight.
442 
443  // reject objects that never rise
444  if (o->checkCircumpolar(geo->lat()) == true && o->alt().Degrees() <= 0)
445  return false;
446 
447  //Initial values for T1, T2 assume all night option of EveningMorningBox
448  KStarsDateTime T1 = Evening;
449  T1.setTime(sunSetToday);
450  KStarsDateTime T2 = Tomorrow;
451  T2.setTime(sunRiseTomorrow);
452 
453  //Check Evening/Morning only state:
454  if (EveningFlag == 0) //Evening only
455  {
456  T2 = T0; //midnight
457  }
458  else if (EveningFlag == 1) //Morning only
459  {
460  T1 = T0; //midnight
461  }
462 
463  for (KStarsDateTime test = T1; test < T2; test = test.addSecs(3600))
464  {
465  //Need LST of the test time, expressed as a dms object.
466  KStarsDateTime ut = geo->LTtoUT(test);
467  dms LST = geo->GSTtoLST(ut.gst());
468  SkyPoint sp = o->recomputeCoords(ut, geo);
469 
470  //check altitude of object at this time.
471  sp.EquatorialToHorizontal(&LST, geo->lat());
472 
473  if (sp.alt().Degrees() > minAlt)
474  {
475  visible = true;
476  break;
477  }
478  }
479 
480  return visible;
481 }
482 
483 void WUTDialog::slotDisplayObject(const QString &name)
484 {
485  QTime tRise, tSet, tTransit;
486  QString sRise, sTransit, sSet;
487 
488  sRise = "--:--";
489  sTransit = "--:--";
490  sSet = "--:--";
491  WUT->DetailButton->setEnabled(false);
492 
493  SkyObject *o = nullptr;
494  if (name.isEmpty())
495  {
496  //no object selected
497  WUT->ObjectBox->setTitle(i18n("No Object Selected"));
498  o = nullptr;
499  }
500  else
501  {
502  o = KStarsData::Instance()->objectNamed(name);
503 
504  if (!o) //should never get here
505  {
506  WUT->ObjectBox->setTitle(i18n("Object Not Found"));
507  }
508  }
509  if (o)
510  {
511  WUT->ObjectBox->setTitle(o->name());
512 
513  if (o->checkCircumpolar(geo->lat()))
514  {
515  if (o->alt().Degrees() > 0.0)
516  {
517  sRise = i18n("circumpolar");
518  sSet = i18n("circumpolar");
519  }
520  else
521  {
522  sRise = i18n("does not rise");
523  sSet = i18n("does not rise");
524  }
525  }
526  else
527  {
528  tRise = o->riseSetTime(T0, geo, true);
529  tSet = o->riseSetTime(T0, geo, false);
530 
531  sRise = QString("%1:%2").arg(tRise.hour(), 2, 10, QChar('0')).arg(tRise.minute(), 2, 10, QChar('0'));
532  sSet = QString("%1:%2").arg(tSet.hour(), 2, 10, QChar('0')).arg(tSet.minute(), 2, 10, QChar('0'));
533  }
534 
535  tTransit = o->transitTime(T0, geo);
536  sTransit = QString("%1:%2").arg(tTransit.hour(), 2, 10, QChar('0')).arg(tTransit.minute(), 2, 10, QChar('0'));
537 
538  WUT->DetailButton->setEnabled(true);
539  }
540 
541  WUT->ObjectRiseLabel->setText(i18n("Rises at: %1", sRise));
542  WUT->ObjectTransitLabel->setText(i18n("Transits at: %1", sTransit));
543  WUT->ObjectSetLabel->setText(i18n("Sets at: %1", sSet));
544 }
545 
546 void WUTDialog::slotCenter()
547 {
548  KStars *kstars = KStars::Instance();
549  SkyObject *o = nullptr;
550  // get selected item
551  if (WUT->ObjectListWidget->currentItem() != nullptr)
552  {
553  o = kstars->data()->objectNamed(WUT->ObjectListWidget->currentItem()->text());
554  }
555  if (o != nullptr)
556  {
557  kstars->map()->setFocusPoint(o);
558  kstars->map()->setFocusObject(o);
559  kstars->map()->setDestination(*kstars->map()->focusPoint());
560  }
561 }
562 
563 void WUTDialog::slotDetails()
564 {
565  KStars *kstars = KStars::Instance();
566  SkyObject *o = nullptr;
567  // get selected item
568  if (WUT->ObjectListWidget->currentItem() != nullptr)
569  {
570  o = kstars->data()->objectNamed(WUT->ObjectListWidget->currentItem()->text());
571  }
572  if (o != nullptr)
573  {
574  QPointer<DetailDialog> detail =
575  new DetailDialog(o, kstars->data()->ut(), geo, kstars);
576  detail->exec();
577  delete detail;
578  }
579 }
580 void WUTDialog::slotObslist()
581 {
582  SkyObject *o = nullptr;
583  // get selected item
584  if (WUT->ObjectListWidget->currentItem() != nullptr)
585  {
586  o = KStarsData::Instance()->objectNamed(
587  WUT->ObjectListWidget->currentItem()->text());
588  }
589  if (o != nullptr)
590  {
591  KStarsData::Instance()->observingList()->slotAddObject(o, session);
592  }
593 }
594 
595 void WUTDialog::slotChangeDate()
596 {
597  // Set the time T0 to the evening of today. This will make life easier for the user, who most probably
598  // wants to see what's up on the night of some date, rather than the night of the previous day
599  T0.setTime(QTime(18, 0, 0)); // 6 PM
600 
601  QPointer<TimeDialog> td = new TimeDialog(T0, KStarsData::Instance()->geo(), this);
602  if (td->exec() == QDialog::Accepted)
603  {
604  T0 = td->selectedDateTime();
605 
606  // If the time is set to 12 midnight, set it to 00:00:01, so that we don't have date interpretation problems
607  if (T0.time() == QTime(0, 0, 0))
608  T0.setTime(QTime(0, 0, 1));
609 
610  //If the Time is earlier than 6:00 am, assume the user wants the night of the previous date
611  if (T0.time().hour() < 6)
612  T0 = T0.addDays(-1);
613 
614  //Now, set time T0 to midnight (of the following day)
615  T0.setTime(QTime(0, 0, 0));
616  T0 = T0.addDays(1);
617  UT0 = geo->LTtoUT(T0);
618 
619  //Set the Tomorrow date/time to Noon the following day
620  Tomorrow = T0.addSecs(12 * 3600);
621  TomorrowUT = geo->LTtoUT(Tomorrow);
622 
623  //Set the Evening date/time to 6:00 pm
624  Evening = T0.addSecs(-6 * 3600);
625  EveningUT = geo->LTtoUT(Evening);
626 
627  WUT->DateLabel->setText(i18n(
628  "The night of %1", QLocale().toString(Evening.date(), QLocale::LongFormat)));
629 
630  init();
631  slotLoadList(WUT->CategoryListWidget->currentItem()->text());
632  }
633  delete td;
634 }
635 
636 void WUTDialog::slotChangeLocation()
637 {
638  QPointer<LocationDialog> ld = new LocationDialog(this);
639  if (ld->exec() == QDialog::Accepted)
640  {
641  GeoLocation *newGeo = ld->selectedCity();
642  if (newGeo)
643  {
644  geo = newGeo;
645  UT0 = geo->LTtoUT(T0);
646  TomorrowUT = geo->LTtoUT(Tomorrow);
647  EveningUT = geo->LTtoUT(Evening);
648 
649  WUT->LocationLabel->setText(i18n("at %1", geo->fullName()));
650 
651  init();
652  slotLoadList(WUT->CategoryListWidget->currentItem()->text());
653  }
654  }
655  delete ld;
656 }
657 
658 void WUTDialog::slotEveningMorning(int index)
659 {
660  if (EveningFlag != index)
661  {
662  EveningFlag = index;
663  init();
664  slotLoadList(WUT->CategoryListWidget->currentItem()->text());
665  }
666 }
667 
668 void WUTDialog::updateMag()
669 {
670  m_Mag = WUT->MagnitudeEdit->value();
671  init();
672  slotLoadList(WUT->CategoryListWidget->currentItem()->text());
673 }
674 
675 void WUTDialog::slotChangeMagnitude()
676 {
677  if (timer)
678  {
679  timer->stop();
680  }
681  else
682  {
683  timer = new QTimer(this);
684  timer->setSingleShot(true);
685  connect(timer, SIGNAL(timeout()), this, SLOT(updateMag()));
686  }
687  timer->start(500);
688 }
689 
690 void WUTDialog::showEvent(QShowEvent *event)
691 {
692  Q_UNUSED(event);
693  QTimer::singleShot(0, this, SLOT(init()));
694 };
const dms & alt() const
Definition: skypoint.h:281
Extension of QDateTime for KStars KStarsDateTime can represent the date/time as a Julian Day,...
bool checkCircumpolar(const dms *gLat) const
Check if this point is circumpolar at the given geographic latitude.
Definition: skypoint.cpp:1045
KStarsDateTime addDays(int nd) const
Modify the Date/Time by adding a number of days.
long double djd() const
virtual void reject()
Stores dms coordinates for a point in the sky. for converting between coordinate systems.
Definition: skypoint.h:44
a dms subclass that caches its sine and cosine values every time the angle is changed.
Definition: cachingdms.h:18
QString phaseName() const
Definition: ksmoon.cpp:288
QTime time() const const
void append(const T &value)
CachingDms * lst()
Definition: kstarsdata.h:223
SkyObject * objectNamed(const QString &name)
Find object by name.
Definition: kstarsdata.cpp:429
virtual QString name(void) const
Definition: skyobject.h:145
float mag() const
Definition: skyobject.h:206
SkyMap * map() const
Definition: kstars.h:143
Manages the catalog database and provides an interface to provide an interface to query and modify th...
Definition: catalogsdb.h:181
bool checkVisibility(const SkyObject *o)
Check visibility of object o the object to check.
Definition: wutdialog.cpp:437
void setModal(bool modal)
void EquatorialToHorizontal(const CachingDms *LST, const CachingDms *lat)
Determine the (Altitude, Azimuth) coordinates of the SkyPoint from its (RA, Dec) coordinates,...
Definition: skypoint.cpp:77
void setFocusObject(SkyObject *o)
Set the FocusObject pointer to the argument.
Definition: skymap.cpp:336
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
Provides necessary information about the Moon. A subclass of SkyObject that provides information need...
Definition: ksmoon.h:25
KStarsDateTime addSecs(double s) const
void addWidget(QWidget *widget, int stretch, Qt::Alignment alignment)
static KStars * Instance()
Definition: kstars.h:125
int type(void) const
Definition: skyobject.h:188
void updateCoords(const KSNumbers *num, bool includePlanets=true, const CachingDms *lat=nullptr, const CachingDms *LST=nullptr, bool forceRecompute=false) override
Update position of the planet (reimplemented from SkyPoint)
void setTime(const QTime &t)
Assign the Time according to a QTime object.
void setDestination(const SkyPoint &f)
sets the destination point of the sky map.
Definition: skymap.cpp:968
Provides necessary information about the Sun.
Definition: kssun.h:23
void rejected()
SkyObject * findByName(const QString &name, bool exact=true) override
Search the children of this SkyMapComposite for a SkyObject whose name matches the argument.
void clear()
QString i18n(const char *text, const TYPE &arg...)
void setWindowFlags(Qt::WindowFlags type)
Store several time-dependent astronomical quantities.
Definition: ksnumbers.h:42
char * toString(const T &value)
double illum() const
Definition: ksmoon.h:49
QTime riseSetTime(const KStarsDateTime &dt, const GeoLocation *geo, bool rst, bool exact=true) const
Determine the time at which the point will rise or set.
Definition: skyobject.cpp:93
bool isEmpty() const const
WaitCursor
QString translatedName() const
Definition: geolocation.cpp:76
void findPhase(const KSSun *Sun=nullptr)
Determine the phase angle of the moon, and assign the appropriate moon image.
Definition: ksmoon.cpp:268
void setWindowTitle(const QString &)
void setFocusPoint(SkyPoint *f)
set the FocusPoint; the position that is to be the next Destination.
Definition: skymap.h:203
QString toString(qlonglong i) const const
QString translatedCountry() const
Definition: geolocation.cpp:97
QString translatedProvince() const
Definition: geolocation.cpp:90
void init(KXmlGuiWindow *window, KgDifficulty *difficulty=nullptr)
SkyPoint recomputeCoords(const KStarsDateTime &dt, const GeoLocation *geo=nullptr) const
The equatorial coordinates for the object on date dt are computed and returned, but the object's inte...
Definition: skyobject.cpp:295
GeoCoordinates geo(const QVariant &location)
This is the main window for KStars. In addition to the GUI elements, the class contains the program c...
Definition: kstars.h:92
void setupUi(QWidget *widget)
int hour() const const
SkyMapComposite * skyComposite()
Definition: kstarsdata.h:165
An angle, stored as degrees, but expressible in many ways.
Definition: dms.h:37
const KStarsDateTime & ut() const
Definition: kstarsdata.h:156
Dialog for adjusting the Time and Date.
Definition: timedialog.h:37
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const
const double & Degrees() const
Definition: dms.h:141
QDate date() const const
QString i18nc(const char *context, const char *text, const TYPE &arg...)
QString toString(Qt::DateFormat format) const const
SkyPoint * focusPoint()
retrieve the FocusPoint position.
Definition: skymap.h:148
QTime transitTime(const KStarsDateTime &dt, const GeoLocation *geo) const
The same iteration technique described in riseSetTime() is used here.
Definition: skyobject.cpp:239
KStarsData * data() const
Definition: kstars.h:137
void init()
Determine which objects are visible, and store them in an array of lists, classified by object type.
Definition: wutdialog.cpp:109
WUTDialog(QWidget *ks, bool session=false, GeoLocation *geo=KStarsData::Instance() ->geo(), KStarsDateTime lt=KStarsData::Instance() ->lt())
Constructor.
Definition: wutdialog.cpp:26
Category category(StandardShortcut id)
Information about an object in the sky.
Definition: skyobject.h:41
int minute() const const
Relevant data about an observing location on Earth.
Definition: geolocation.h:27
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Tue Aug 9 2022 04:06:07 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.