• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

kstars

  • sources
  • kde-4.12
  • kdeedu
  • kstars
  • kstars
kstarsactions.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  kstarsactions.cpp - K Desktop Planetarium
3  -------------------
4  begin : Mon Feb 25 2002
5  copyright : (C) 2002 by Jason Harris
6  email : jharris@30doradus.org
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 //needed in slotRunScript() for chmod() syscall (remote script downloaded to temp file)
19 
20 #ifdef _WIN32
21 #include <windows.h>
22 #undef interface
23 #endif
24 #include <sys/stat.h>
25 
26 #include <QCheckBox>
27 #include <QDir>
28 #include <QTextStream>
29 #include <QDialog>
30 #include <QDockWidget>
31 #include <QPointer>
32 
33 #include <kdebug.h>
34 #include <kaction.h>
35 #include <kactioncollection.h>
36 #include <kactionmenu.h>
37 #include <ktoggleaction.h>
38 #include <kmessagebox.h>
39 #include <ktemporaryfile.h>
40 #include <ktip.h>
41 #include <kstandarddirs.h>
42 #include <kconfigdialog.h>
43 #include <kfiledialog.h>
44 #include <kinputdialog.h>
45 #include <kmenu.h>
46 #include <kstatusbar.h>
47 #include <kprocess.h>
48 #include <ktoolbar.h>
49 #include <kicon.h>
50 #include <knewstuff3/downloaddialog.h>
51 #include <kio/netaccess.h>
52 
53 #include "options/opscatalog.h"
54 #include "options/opsguides.h"
55 #include "options/opssolarsystem.h"
56 #include "options/opssatellites.h"
57 #include "options/opssupernovae.h"
58 #include "options/opscolors.h"
59 #include "options/opsadvanced.h"
60 
61 #include "Options.h"
62 #include "kstars.h"
63 #include "kstarsdata.h"
64 #include "kstarsdatetime.h"
65 #include "skymap.h"
66 #include "skyobjects/skyobject.h"
67 #include "skyobjects/ksplanetbase.h"
68 #include "simclock.h"
69 #include "dialogs/timedialog.h"
70 #include "dialogs/locationdialog.h"
71 #include "dialogs/finddialog.h"
72 #include "dialogs/focusdialog.h"
73 #include "dialogs/fovdialog.h"
74 #include "dialogs/exportimagedialog.h"
75 #include "printing/printingwizard.h"
76 #include "kswizard.h"
77 #include "tools/astrocalc.h"
78 #include "tools/altvstime.h"
79 #include "tools/wutdialog.h"
80 #include "tools/whatsinteresting/wiview.h"
81 #include "tools/whatsinteresting/wilpsettings.h"
82 #include "tools/whatsinteresting/wiequipsettings.h"
83 #include "tools/skycalendar.h"
84 #include "tools/scriptbuilder.h"
85 #include "tools/planetviewer.h"
86 #include "tools/jmoontool.h"
87 #include "tools/moonphasetool.h"
88 #include "tools/flagmanager.h"
89 #include "oal/execute.h"
90 #include "projections/projector.h"
91 #include "imageexporter.h"
92 
93 #include <config-kstars.h>
94 
95 #ifdef HAVE_INDI_H
96 #include "indi/telescopewizardprocess.h"
97 #include "indi/opsindi.h"
98 #include "indi/drivermanager.h"
99 #include "indi/guimanager.h"
100 #endif
101 
102 #include "skycomponents/catalogcomponent.h"
103 #include "skycomponents/skymapcomposite.h"
104 #include "skycomponents/solarsystemcomposite.h"
105 #include "skycomponents/cometscomponent.h"
106 #include "skycomponents/asteroidscomponent.h"
107 #include "skycomponents/supernovaecomponent.h"
108 
109 #ifdef HAVE_CFITSIO_H
110 #include "fitsviewer/fitsviewer.h"
111 #ifdef HAVE_INDI_H
112 #include "ekos/ekosmanager.h"
113 #include "ekos/opsekos.h"
114 #endif
115 #endif
116 
117 #ifdef HAVE_XPLANET
118 #include "xplanet/opsxplanet.h"
119 #endif
120 
121 // #include "libkdeedu/kdeeduui/kdeeduglossary.h"
122 
123 //This file contains function definitions for Actions declared in kstars.h
124 
127 void KStars::slotViewToolBar() {
128  KToggleAction *a = (KToggleAction*)sender();
129  KConfigDialog *kcd = KConfigDialog::exists( "settings" );
130 
131  if ( a == actionCollection()->action( "show_stars" ) ) {
132  Options::setShowStars( a->isChecked() );
133  if ( kcd ) {
134  opcatalog->kcfg_ShowStars->setChecked( a->isChecked() );
135  }
136  } else if ( a == actionCollection()->action( "show_deepsky" ) ) {
137  Options::setShowDeepSky( a->isChecked() );
138  if ( kcd ) {
139  opcatalog->kcfg_ShowDeepSky->setChecked( a->isChecked() );
140  }
141  } else if ( a == actionCollection()->action( "show_planets" ) ) {
142  Options::setShowSolarSystem( a->isChecked() );
143  if ( kcd ) {
144  opsolsys->kcfg_ShowSolarSystem->setChecked( a->isChecked() );
145  }
146  } else if ( a == actionCollection()->action( "show_clines" ) ) {
147  Options::setShowCLines( a->isChecked() );
148  if ( kcd ) {
149  opguides->kcfg_ShowCLines->setChecked( a->isChecked() );
150  }
151  } else if ( a == actionCollection()->action( "show_cnames" ) ) {
152  Options::setShowCNames( a->isChecked() );
153  if ( kcd ) {
154  opguides->kcfg_ShowCNames->setChecked( a->isChecked() );
155  }
156  } else if ( a == actionCollection()->action( "show_cbounds" ) ) {
157  Options::setShowCBounds( a->isChecked() );
158  if ( kcd ) {
159  opguides->kcfg_ShowCBounds->setChecked( a->isChecked() );
160  }
161  } else if ( a == actionCollection()->action( "show_mw" ) ) {
162  Options::setShowMilkyWay( a->isChecked() );
163  if ( kcd ) {
164  opguides->kcfg_ShowMilkyWay->setChecked( a->isChecked() );
165  }
166  } else if ( a == actionCollection()->action( "show_equatorial_grid" ) ) {
167  Options::setShowEquatorialGrid( a->isChecked() );
168  if ( kcd ) {
169  opguides->kcfg_ShowEquatorialGrid->setChecked( a->isChecked() );
170  }
171  } else if ( a == actionCollection()->action( "show_horizontal_grid" ) ) {
172  Options::setShowHorizontalGrid( a->isChecked() );
173  if ( kcd ) {
174  opguides->kcfg_ShowHorizontalGrid->setChecked( a->isChecked() );
175  }
176  } else if ( a == actionCollection()->action( "show_horizon" ) ) {
177  Options::setShowGround( a->isChecked() );
178  if( !a->isChecked() && Options::useRefraction() ) {
179  QString caption = i18n( "Refraction effects disabled" );
180  QString message = i18n( "When the horizon is switched off, refraction effects are temporarily disabled." );
181 
182  KMessageBox::information( this, message, caption, "dag_refract_hide_ground" );
183  }
184  if ( kcd ) {
185  opguides->kcfg_ShowGround->setChecked( a->isChecked() );
186  }
187  } else if ( a == actionCollection()->action( "show_flags" ) ) {
188  Options::setShowFlags( a->isChecked() );
189  if ( kcd ) {
190  opguides->kcfg_ShowFlags->setChecked( a->isChecked() );
191  }
192  } else if ( a == actionCollection()->action( "show_satellites" ) ) {
193  Options::setShowSatellites( a->isChecked() );
194  if ( kcd ) {
195  opssatellites->kcfg_ShowSatellites->setChecked( a->isChecked() );
196  }
197  } else if ( a == actionCollection()->action( "show_supernovae" ) ) {
198  Options::setShowSupernovae( a->isChecked() );
199  if ( kcd ) {
200  opssupernovae->kcfg_ShowSupernovae->setChecked ( a->isChecked() ) ;
201  }
202  }
203 
204  // update time for all objects because they might be not initialized
205  // it's needed when using horizontal coordinates
206  data()->setFullTimeUpdate();
207  updateTime();
208 
209  map()->forceUpdate();
210 }
211 
214 void KStars::slotCalculator() {
215  if( ! astrocalc )
216  astrocalc = new AstroCalc (this);
217  astrocalc->show();
218 }
219 
220 void KStars::slotWizard() {
221  QPointer<KSWizard> wizard = new KSWizard(this);
222  if ( wizard->exec() == QDialog::Accepted ) {
223  Options::setRunStartupWizard( false ); //don't run on startup next time
224 
225  data()->setLocation( *(wizard->geo()) );
226 
227  // adjust local time to keep UT the same.
228  // create new LT without DST offset
229  KStarsDateTime ltime = data()->geo()->UTtoLT( data()->ut() );
230 
231  // reset timezonerule to compute next dst change
232  data()->geo()->tzrule()->reset_with_ltime( ltime, data()->geo()->TZ0(), data()->isTimeRunningForward() );
233 
234  // reset next dst change time
235  data()->setNextDSTChange( data()->geo()->tzrule()->nextDSTChange() );
236 
237  // reset local sideral time
238  data()->syncLST();
239 
240  // Make sure Numbers, Moon, planets, and sky objects are updated immediately
241  data()->setFullTimeUpdate();
242 
243  // If the sky is in Horizontal mode and not tracking, reset focus such that
244  // Alt/Az remain constant.
245  if ( ! Options::isTracking() && Options::useAltAz() ) {
246  map()->focus()->HorizontalToEquatorial( data()->lst(), data()->geo()->lat() );
247  }
248 
249  // recalculate new times and objects
250  data()->setSnapNextFocus();
251  updateTime();
252  }
253  delete wizard;
254 }
255 
256 void KStars::slotDownload() {
257  QPointer<KNS3::DownloadDialog> dlg( new KNS3::DownloadDialog( this ) );
258  dlg->exec();
259 
260  // Get the list of all the installed entries.
261  KNS3::Entry::List entries;
262  if (dlg) {
263  entries = dlg->installedEntries();
264  }
265 
266  delete dlg;
267 
268  foreach (const KNS3::Entry &entry, entries) {
269  foreach (const QString &name, entry.installedFiles()) {
270  if ( name.endsWith( QLatin1String( ".cat" ) ) ) {
271  // To start displaying the custom catalog, add it to SkyMapComposite
272  Options::setCatalogFile(Options::catalogFile() << name);
273  Options::setShowCatalog(Options::showCatalog() << 1);
274  data()->skyComposite()->addCustomCatalog(name, Options::catalogFile().size() - 1);
275  }
276  }
277  }
278 }
279 
280 void KStars::slotAVT() {
281  if ( ! avt ) avt = new AltVsTime(this);
282  avt->show();
283 }
284 
285 void KStars::slotWUT() {
286  if ( ! wut ) wut = new WUTDialog(this);
287  wut->show();
288 }
289 
290 void KStars::slotWISettings()
291 {
292  if (wi && !wiDock->isVisible())
293  {
294  slotShowWIView(1);
295  return;
296  }
297 
298  if (KConfigDialog::showDialog("wisettings"))
299  {
300  wiEquipSettings->populateScopeListWidget();
301  return;
302  }
303 
304  KConfigDialog* dialog = new KConfigDialog(this, "wisettings", Options::self());
305 
306  connect(dialog, SIGNAL(settingsChanged(const QString &)), this, SLOT(slotApplyWIConfigChanges()));
307  connect(dialog, SIGNAL(finished(int)), this, SLOT(slotShowWIView(int)));
308 
309  wiLPSettings = new WILPSettings(this);
310  wiEquipSettings = new WIEquipSettings(this);
311  dialog->addPage(wiLPSettings, i18n("Light Pollution Settings"));
312  dialog->addPage(wiEquipSettings, i18n("Equipment Settings - Equipment Type and Parameters"));
313  dialog->show();
314 }
315 
316 void KStars::slotShowWIView(int status)
317 {
318  if (status == 0) return; //Cancelled
319 
320  int bortle = Options::bortleClass();
321  wiEquipSettings->setAperture();
322 
323  /* NOTE This part of the code dealing with equipment type is presently not required
324  * as WI does not differentiate between Telescope and Binoculars. It only needs the
325  * aperture of the equipment whichever available. However this is kept as a part of
326  * the code as support to be utilised in the future.
327  */
328  ObsConditions::Equipment equip = Options::noEquipCheck()
329  ? (ObsConditions::None) : (Options::telescopeCheck()
330  ? (Options::binocularsCheck() ? ObsConditions::Both : ObsConditions::Telescope)
331  : (Options::binocularsCheck() ? ObsConditions::Binoculars : ObsConditions::None));
332 
333  ObsConditions::TelescopeType telType = (equip == ObsConditions::Telescope)
334  ? wiEquipSettings->getTelType() : ObsConditions::Invalid;
335 
336  int aperture = wiEquipSettings->getAperture();
337 
338  //Update observing conditions for What's Interesting
339  if (!wiObsConditions)
340  wiObsConditions = new ObsConditions(bortle, aperture, equip, telType);
341  else
342  wiObsConditions->setObsConditions(bortle, aperture, equip, telType);
343 
344  if (!wi)
345  {
346  wi = new WIView(0, wiObsConditions);
347  wiDock = new QDockWidget(this);
348  wiDock->setObjectName("What's Interesting");
349  wiDock->setAllowedAreas(Qt::RightDockWidgetArea);
350  wiDock->setWidget(wi->getWIBaseView());
351  wiDock->setMinimumWidth(wi->getWIBaseView()->width());
352  addDockWidget(Qt::RightDockWidgetArea, wiDock);
353  wiDock->setVisible(true);
354  }
355  else
356  {
357  wi->updateModels(wiObsConditions);
358  wiDock->setVisible(true);
359  }
360 }
361 
362 void KStars::slotCalendar() {
363  if ( ! skycal ) skycal = new SkyCalendar(this);
364  skycal->show();
365 }
366 
367 void KStars::slotGlossary(){
368  // GlossaryDialog *dlg = new GlossaryDialog( this, true );
369  // QString glossaryfile =data()->stdDirs->findResource( "data", "kstars/glossary.xml" );
370  // KUrl u = glossaryfile;
371  // Glossary *g = new Glossary( u );
372  // g->setName( i18n( "Knowledge" ) );
373  // dlg->addGlossary( g );
374  // dlg->show();
375 }
376 
377 void KStars::slotScriptBuilder() {
378  if ( ! sb ) sb = new ScriptBuilder(this);
379  sb->show();
380 }
381 
382 void KStars::slotSolarSystem() {
383  if ( ! pv ) pv = new PlanetViewer(this);
384  pv->show();
385 }
386 
387 void KStars::slotJMoonTool() {
388  if ( ! jmt ) jmt = new JMoonTool(this);
389  jmt->show();
390 }
391 
392 void KStars::slotMoonPhaseTool() {
393  if( ! mpt ) mpt = new MoonPhaseTool( this );
394  mpt->show();
395 }
396 
397 void KStars::slotFlagManager() {
398  if ( ! fm ) fm = new FlagManager(this);
399  fm->show();
400 }
401 
402 void KStars::slotTelescopeWizard()
403 {
404 #ifdef HAVE_INDI_H
405  if (KStandardDirs::findExe("indiserver").isEmpty())
406  {
407  KMessageBox::error(NULL, i18n("Unable to find INDI server. Please make sure the package that provides the 'indiserver' binary is installed."));
408  return;
409  }
410 
411  QPointer<telescopeWizardProcess> twiz = new telescopeWizardProcess(this);
412  twiz->exec();
413  delete twiz;
414 #endif
415 }
416 
417 void KStars::slotINDIPanel()
418 {
419 #ifdef HAVE_INDI_H
420  if (KStandardDirs::findExe("indiserver").isEmpty())
421  {
422  KMessageBox::error(NULL, i18n("Unable to find INDI server. Please make sure the package that provides the 'indiserver' binary is installed."));
423  return;
424  }
425  GUIManager::Instance()->updateStatus();
426 #endif
427 }
428 
429 void KStars::slotINDIDriver()
430 {
431 #ifdef HAVE_INDI_H
432  if (KStandardDirs::findExe("indiserver").isEmpty())
433  {
434  KMessageBox::error(NULL, i18n("Unable to find INDI server. Please make sure the package that provides the 'indiserver' binary is installed."));
435  return;
436  }
437 
438  DriverManager::Instance()->show();
439 #endif
440 }
441 
442 void KStars::slotEkos()
443 {
444 #ifdef HAVE_CFITSIO_H
445 #ifdef HAVE_INDI_H
446 
447  if (KStandardDirs::findExe("indiserver").isEmpty())
448  {
449  KMessageBox::error(NULL, i18n("Unable to find INDI server. Please make sure the package that provides the 'indiserver' binary is installed."));
450  return;
451  }
452 
453  if (ekosmenu == NULL)
454  ekosmenu = new EkosManager();
455 
456  ekosmenu->show();
457 #endif
458 #endif
459 }
460 
461 void KStars::slotGeoLocator() {
462  QPointer<LocationDialog> locationdialog = new LocationDialog(this);
463  if ( locationdialog->exec() == QDialog::Accepted ) {
464  GeoLocation *newLocation = locationdialog->selectedCity();
465  if ( newLocation ) {
466  // set new location in options
467  data()->setLocation( *newLocation );
468 
469  // adjust local time to keep UT the same.
470  // create new LT without DST offset
471  KStarsDateTime ltime = newLocation->UTtoLT( data()->ut() );
472 
473  // reset timezonerule to compute next dst change
474  newLocation->tzrule()->reset_with_ltime( ltime, newLocation->TZ0(), data()->isTimeRunningForward() );
475 
476  // reset next dst change time
477  data()->setNextDSTChange( newLocation->tzrule()->nextDSTChange() );
478 
479  // reset local sideral time
480  data()->syncLST();
481 
482  // Make sure Numbers, Moon, planets, and sky objects are updated immediately
483  data()->setFullTimeUpdate();
484 
485  // If the sky is in Horizontal mode and not tracking, reset focus such that
486  // Alt/Az remain constant.
487  if ( ! Options::isTracking() && Options::useAltAz() ) {
488  map()->focus()->HorizontalToEquatorial( data()->lst(), data()->geo()->lat() );
489  }
490 
491  // recalculate new times and objects
492  data()->setSnapNextFocus();
493  updateTime();
494  }
495  }
496  delete locationdialog;
497 }
498 
499 void KStars::slotViewOps() {
500  //An instance of your dialog could be already created and could be cached,
501  //in which case you want to display the cached dialog instead of creating
502  //another one
503  if ( KConfigDialog::showDialog( "settings" ) ) return;
504 
505  //KConfigDialog didn't find an instance of this dialog, so lets create it :
506  KConfigDialog* dialog = new KConfigDialog( this, "settings",
507  Options::self() );
508 
509  connect( dialog, SIGNAL( settingsChanged( const QString &) ), this, SLOT( slotApplyConfigChanges() ) );
510 
511  opcatalog = new OpsCatalog( this );
512  opguides = new OpsGuides( this );
513  opsolsys = new OpsSolarSystem( this );
514  opssatellites= new OpsSatellites( this );
515  opssupernovae= new OpsSupernovae( this );
516  opcolors = new OpsColors( this );
517  opadvanced = new OpsAdvanced( this );
518 
519  dialog->addPage(opcatalog, i18n("Catalogs"), "kstars_catalog");
520  dialog->addPage(opsolsys, i18n("Solar System"), "kstars_solarsystem");
521  dialog->addPage(opssatellites, i18n("Satellites"), "kstars_satellites");
522  dialog->addPage(opssupernovae, i18n("Supernovae"), "kstars_supernovae");
523  dialog->addPage(opguides, i18n("Guides"), "kstars_guides");
524  dialog->addPage(opcolors, i18n("Colors"), "kstars_colors");
525 
526  #ifdef HAVE_INDI_H
527  opsindi = new OpsINDI (this);
528  dialog->addPage(opsindi, i18n("INDI"), "kstars");
529 
530  #ifdef HAVE_CFITSIO_H
531  opsekos = new OpsEkos(this);
532  dialog->addPage(opsekos, i18n("Ekos"), "kstars");
533  #endif
534 
535  #endif
536 
537 #ifdef HAVE_XPLANET
538  opsxplanet = new OpsXplanet( this );
539  dialog->addPage(opsxplanet, i18n("Xplanet"), "kstars_xplanet");
540 #endif
541 
542  dialog->addPage(opadvanced, i18n("Advanced"), "kstars_advanced");
543 
544  dialog->setHelp(QString(), "kstars");
545  dialog->show();
546 }
547 
548 void KStars::slotApplyConfigChanges() {
549  Options::self()->writeConfig();
550 
551  // If the focus object was a constellation and the sky culture has changed, remove the focus object
552  if( map()->focusObject() && map()->focusObject()->type() == SkyObject::CONSTELLATION ) {
553  if( kstarsData->skyComposite()->currentCulture() != kstarsData->skyComposite()->getCultureName( (int)Options::skyCulture() ) || kstarsData->skyComposite()->isLocalCNames() != Options::useLocalConstellNames() ) {
554  map()->setClickedObject( NULL );
555  map()->setFocusObject( NULL );
556  }
557  }
558 
559  applyConfig();
560  data()->setFullTimeUpdate();
561  map()->forceUpdate();
562 
563  kstarsData->skyComposite()->setCurrentCulture( kstarsData->skyComposite()->getCultureName( (int)Options::skyCulture() ) );
564  kstarsData->skyComposite()->reloadCLines();
565  kstarsData->skyComposite()->reloadCNames();
566 }
567 
568 void KStars::slotApplyWIConfigChanges() {
569  Options::self()->writeConfig();
570  applyConfig();
571 }
572 
573 void KStars::slotSetTime() {
574  QPointer<TimeDialog> timedialog = new TimeDialog( data()->lt(), data()->geo(), this );
575 
576  if ( timedialog->exec() == QDialog::Accepted ) {
577  data()->changeDateTime( data()->geo()->LTtoUT( timedialog->selectedDateTime() ) );
578 
579  if ( Options::useAltAz() ) {
580  if ( map()->focusObject() ) {
581  map()->focusObject()->EquatorialToHorizontal( data()->lst(), data()->geo()->lat() );
582  map()->setFocus( map()->focusObject() );
583  } else
584  map()->focus()->HorizontalToEquatorial( data()->lst(), data()->geo()->lat() );
585  }
586 
587  map()->forceUpdateNow();
588 
589  //If focusObject has a Planet Trail, clear it and start anew.
590  KSPlanetBase* planet = dynamic_cast<KSPlanetBase*>( map()->focusObject() );
591  if( planet && planet->hasTrail() ) {
592  planet->clearTrail();
593  planet->addToTrail();
594  }
595  }
596  delete timedialog;
597 }
598 
599 //Set Time to CPU clock
600 void KStars::slotSetTimeToNow() {
601  data()->changeDateTime( KStarsDateTime::currentUtcDateTime() );
602 
603  if ( Options::useAltAz() ) {
604  if ( map()->focusObject() ) {
605  map()->focusObject()->EquatorialToHorizontal( data()->lst(), data()->geo()->lat() );
606  map()->setFocus( map()->focusObject() );
607  } else
608  map()->focus()->HorizontalToEquatorial( data()->lst(), data()->geo()->lat() );
609  }
610 
611  map()->forceUpdateNow();
612 
613  //If focusObject has a Planet Trail, clear it and start anew.
614  KSPlanetBase* planet = dynamic_cast<KSPlanetBase*>( map()->focusObject() );
615  if( planet && planet->hasTrail() ) {
616  planet->clearTrail();
617  planet->addToTrail();
618  }
619 }
620 
621 void KStars::slotFind() {
622  clearCachedFindDialog();
623  if ( !findDialog ) { // create new dialog if no dialog is existing
624  findDialog = new FindDialog( this );
625  }
626 
627  if ( !findDialog ) kWarning() << i18n( "KStars::slotFind() - Not enough memory for dialog" ) ;
628  SkyObject *targetObject;
629  if ( findDialog->exec() == QDialog::Accepted && ( targetObject = findDialog->selectedObject() ) ) {
630  map()->setClickedObject( targetObject );
631  map()->setClickedPoint( map()->clickedObject() );
632  map()->slotCenter();
633  }
634 
635  // check if data has changed while dialog was open
636  if ( DialogIsObsolete )
637  clearCachedFindDialog();
638 }
639 
640 void KStars::slotOpenFITS()
641 {
642 #ifdef HAVE_CFITSIO_H
643 
644  KUrl fileURL = KFileDialog::getOpenUrl( QDir::homePath(), "*.fits *.fit *.fts|Flexible Image Transport System" );
645 
646  if (fileURL.isEmpty())
647  return;
648 
649  FITSViewer * fv = new FITSViewer(this);
650  // Error opening file
651  if (fv->addFITS(&fileURL) == -2)
652  delete (fv);
653  else
654  fv->show();
655 #endif
656 }
657 
658 void KStars::slotExportImage() {
659  KUrl fileURL = KFileDialog::getSaveUrl( QDir::homePath(), "image/png image/jpeg image/gif image/x-portable-pixmap image/bmp image/svg+xml" );
660 
661  //User cancelled file selection dialog - abort image export
662  if ( fileURL.isEmpty() ) {
663  return;
664  }
665 
666  //Warn user if file exists!
667  if (QFile::exists(fileURL.path()))
668  {
669  int r=KMessageBox::warningContinueCancel(parentWidget(),
670  i18n( "A file named \"%1\" already exists. Overwrite it?" , fileURL.fileName()),
671  i18n( "Overwrite File?" ),
672  KStandardGuiItem::overwrite() );
673  if(r == KMessageBox::Cancel)
674  return;
675  }
676 
677  // execute image export dialog
678 
679  // Note: We don't let ExportImageDialog create its own ImageExporter because we want legend settings etc to be remembered between UI use and DBus scripting interface use.
680  if ( !imageExporter )
681  imageExporter = new ImageExporter( this );
682 
683  if ( !imgExportDialog ) {
684  imgExportDialog = new ExportImageDialog( fileURL.url(), QSize( map()->width(), map()->height() ), imageExporter );
685  } else {
686  imgExportDialog->setOutputUrl( fileURL.url() );
687  imgExportDialog->setOutputSize( QSize ( map()->width(), map()->height() ) );
688  }
689 
690  imgExportDialog->show();
691 }
692 
693 void KStars::slotRunScript() {
694  KUrl fileURL = KFileDialog::getOpenUrl( QDir::homePath(), "*.kstars|" + i18nc("Filter by file type: KStars Scripts.", "KStars Scripts (*.kstars)") );
695  QFile f;
696  QString fname;
697 
698  if ( fileURL.isValid() ) {
699  if ( ! fileURL.isLocalFile() ) {
700  //Warn the user about executing remote code.
701  QString message = i18n( "Warning: You are about to execute a remote shell script on your machine. " );
702  message += i18n( "If you absolutely trust the source of this script, press Continue to execute the script; " );
703  message += i18n( "to save the file without executing it, press Save; " );
704  message += i18n( "to cancel the download, press Cancel. " );
705 
706  int result = KMessageBox::warningYesNoCancel( 0, message, i18n( "Really Execute Remote Script?" ),
707  KStandardGuiItem::cont(), KStandardGuiItem::save() );
708 
709  if ( result == KMessageBox::Cancel ) return;
710  if ( result == KMessageBox::No ) { //save file
711  KUrl saveURL = KFileDialog::getSaveUrl( QDir::homePath(), "*.kstars|" + i18nc("Filter by file type: KStars Scripts.", "KStars Scripts (*.kstars)") );
712  KTemporaryFile tmpfile;
713  tmpfile.open();
714 
715  while ( ! saveURL.isValid() ) {
716  message = i18n( "Save location is invalid. Try another location?" );
717  if ( KMessageBox::warningYesNo( 0, message, i18n( "Invalid Save Location" ), KGuiItem(i18n("Try Another")), KGuiItem(i18n("Do Not Try")) ) == KMessageBox::No ) return;
718  saveURL = KFileDialog::getSaveUrl( QDir::homePath(), "*.kstars|" + i18nc("Filter by file type: KStars Scripts.", "KStars Scripts (*.kstars)") );
719  }
720 
721  if ( saveURL.isLocalFile() ) {
722  fname = saveURL.toLocalFile();
723  } else {
724  fname = tmpfile.fileName();
725  }
726 
727  if( KIO::NetAccess::download( fileURL, fname, this ) ) {
728  chmod( fname.toAscii(), S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH ); //make it executable
729 
730  if ( tmpfile.fileName() == fname ) { //upload to remote location
731  if ( ! KIO::NetAccess::upload( tmpfile.fileName(), fileURL, this ) ) {
732  QString message = i18n( "Could not upload image to remote location: %1", fileURL.prettyUrl() );
733  KMessageBox::sorry( 0, message, i18n( "Could not upload file" ) );
734  }
735  }
736  } else {
737  KMessageBox::sorry( 0, i18n( "Could not download the file." ), i18n( "Download Error" ) );
738  }
739 
740  return;
741  }
742  }
743 
744  //Damn the torpedos and full speed ahead, we're executing the script!
745  KTemporaryFile tmpfile;
746  tmpfile.open();
747 
748  if ( ! fileURL.isLocalFile() ) {
749  fname = tmpfile.fileName();
750  if( KIO::NetAccess::download( fileURL, fname, this ) ) {
751  chmod( fname.toAscii(), S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH );
752  f.setFileName( fname );
753  }
754  } else {
755  f.setFileName( fileURL.toLocalFile() );
756  }
757 
758  if ( !f.open( QIODevice::ReadOnly) ) {
759  QString message = i18n( "Could not open file %1", f.fileName() );
760  KMessageBox::sorry( 0, message, i18n( "Could Not Open File" ) );
761  return;
762  }
763 
764  // Before we run the script, make sure that it's safe. Each line must either begin with "#"
765  // or begin with "dbus-send". INDI scripts are much more complicated, so this simple test is not
766  // suitable. INDI Scripting will return in KDE 4.1
767 
768  QTextStream istream(&f);
769  QString line;
770  bool fileOK( true );
771 
772  while ( ! istream.atEnd() ) {
773  line = istream.readLine();
774  if ( line.left(1) != "#" && line.left(9) != "dbus-send")
775  {
776  fileOK = false;
777  break;
778  }
779  }
780 
781  if ( ! fileOK )
782  {
783  int answer;
784  answer = KMessageBox::warningContinueCancel( 0, i18n( "The selected script contains unrecognized elements, "
785  "indicating that it was not created using the KStars script builder. "
786  "This script may not function properly, and it may even contain malicious code. "
787  "Would you like to execute it anyway?" ),
788  i18n( "Script Validation Failed" ), KGuiItem( i18n( "Run Nevertheless" ) ), KStandardGuiItem::cancel(), "daExecuteScript" );
789  if ( answer == KMessageBox::Cancel ) return;
790  }
791 
792  //Add statusbar message that script is running
793  statusBar()->changeItem( i18n( "Running script: %1", fileURL.fileName() ), 0 );
794 
795  KProcess p;
796  p << f.fileName();
797  p.start();
798  if( !p.waitForStarted() )
799  return;
800 
801  while ( !p.waitForFinished( 10 ) )
802  {
803  qApp->processEvents(); //otherwise tempfile may get deleted before script completes.
804  if( p.state() != QProcess::Running )
805  break;
806  }
807 
808  statusBar()->changeItem( i18n( "Script finished."), 0 );
809  }
810 }
811 
812 void KStars::slotPrint() {
813  bool switchColors(false);
814 
815  //Suggest Chart color scheme
816  if ( data()->colorScheme()->colorNamed( "SkyColor" ) != "#FFFFFF" ) {
817  QString message = i18n( "You can save printer ink by using the \"Star Chart\" "
818  "color scheme, which uses a white background. Would you like to "
819  "temporarily switch to the Star Chart color scheme for printing?" );
820 
821  int answer;
822  answer = KMessageBox::questionYesNoCancel( 0, message, i18n( "Switch to Star Chart Colors?" ),
823  KGuiItem(i18n("Switch Color Scheme")), KGuiItem(i18n("Do Not Switch")), KStandardGuiItem::cancel(), "askAgainPrintColors" );
824 
825  if ( answer == KMessageBox::Cancel )
826  return;
827  if ( answer == KMessageBox::Yes )
828  switchColors = true;
829  }
830 
831  printImage( true, switchColors );
832 }
833 
834 void KStars::slotPrintingWizard() {
835  if(printingWizard) {
836  delete printingWizard;
837  }
838 
839  printingWizard = new PrintingWizard(this);
840  printingWizard->show();
841 }
842 
843 void KStars::slotToggleTimer() {
844  if ( data()->clock()->isActive() ) {
845  data()->clock()->stop();
846  updateTime();
847  } else {
848  if ( fabs( data()->clock()->scale() ) > Options::slewTimeScale() )
849  data()->clock()->setManualMode( true );
850  data()->clock()->start();
851  if ( data()->clock()->isManualMode() )
852  map()->forceUpdate();
853  }
854 
855  // Update clock state in options
856  Options::setRunClock( data()->clock()->isActive() );
857 }
858 
859 void KStars::slotStepForward() {
860  if ( data()->clock()->isActive() )
861  data()->clock()->stop();
862  data()->clock()->manualTick( true );
863  map()->forceUpdate();
864 }
865 
866 void KStars::slotStepBackward() {
867  if ( data()->clock()->isActive() )
868  data()->clock()->stop();
869  data()->clock()->setClockScale( -1.0 * data()->clock()->scale() ); //temporarily need negative time step
870  data()->clock()->manualTick( true );
871  data()->clock()->setClockScale( -1.0 * data()->clock()->scale() ); //reset original sign of time step
872  map()->forceUpdate();
873 }
874 
875 //Pointing
876 void KStars::slotPointFocus() {
877  // In the following cases, we set slewing=true in order to disengage tracking
878  map()->stopTracking();
879 
880  if ( sender() == actionCollection()->action("zenith") )
881  map()->setDestinationAltAz( dms(90.0), map()->focus()->az() );
882  else if ( sender() == actionCollection()->action("north") )
883  map()->setDestinationAltAz( dms(15.0), dms(0.0001) );
884  else if ( sender() == actionCollection()->action("east") )
885  map()->setDestinationAltAz( dms(15.0), dms(90.0) );
886  else if ( sender() == actionCollection()->action("south") )
887  map()->setDestinationAltAz( dms(15.0), dms(180.0) );
888  else if ( sender() == actionCollection()->action("west") )
889  map()->setDestinationAltAz( dms(15.0), dms(270.0) );
890 }
891 
892 void KStars::slotTrack() {
893  if ( Options::isTracking() ) {
894  Options::setIsTracking( false );
895  actionCollection()->action("track_object")->setText( i18n( "Engage &Tracking" ) );
896  actionCollection()->action("track_object")->setIcon( KIcon("document-decrypt") );
897 
898  KSPlanetBase* planet = dynamic_cast<KSPlanetBase*>( map()->focusObject() );
899  if( planet && data()->temporaryTrail ) {
900  planet->clearTrail();
901  data()->temporaryTrail = false;
902  }
903 
904  map()->setClickedObject( NULL );
905  map()->setFocusObject( NULL );//no longer tracking focusObject
906  map()->setFocusPoint( NULL );
907  } else {
908  map()->setClickedPoint( map()->focus() );
909  map()->setClickedObject( NULL );
910  map()->setFocusObject( NULL );//no longer tracking focusObject
911  map()->setFocusPoint( map()->clickedPoint() );
912  Options::setIsTracking( true );
913  actionCollection()->action("track_object")->setText( i18n( "Stop &Tracking" ) );
914  actionCollection()->action("track_object")->setIcon( KIcon("document-encrypt") );
915  }
916 
917  map()->forceUpdate();
918 }
919 
920 void KStars::slotManualFocus() {
921  QPointer<FocusDialog> focusDialog = new FocusDialog( this ); // = new FocusDialog( this );
922  if ( Options::useAltAz() ) focusDialog->activateAzAltPage();
923 
924  if ( focusDialog->exec() == QDialog::Accepted ) {
925  //DEBUG
926  kDebug() << "focusDialog point: " << &focusDialog;
927 
928  //If the requested position is very near the pole, we need to point first
929  //to an intermediate location just below the pole in order to get the longitudinal
930  //position (RA/Az) right.
931  double realAlt( focusDialog->point().alt().Degrees() );
932  double realDec( focusDialog->point().dec().Degrees() );
933  if ( Options::useAltAz() && realAlt > 89.0 ) {
934  focusDialog->point().setAlt( 89.0 );
935  focusDialog->point().HorizontalToEquatorial( data()->lst(), data()->geo()->lat() );
936  }
937  if ( ! Options::useAltAz() && realDec > 89.0 ) {
938  focusDialog->point().setDec( 89.0 );
939  focusDialog->point().EquatorialToHorizontal( data()->lst(), data()->geo()->lat() );
940  }
941 
942  map()->setClickedPoint( & focusDialog->point() );
943  if ( Options::isTracking() ) slotTrack();
944 
945  map()->slotCenter();
946 
947  //The slew takes some time to complete, and this often causes the final focus point to be slightly
948  //offset from the user's requested coordinates (because EquatorialToHorizontal() is called
949  //throughout the process, which depends on the sidereal time). So we now "polish" the final
950  //position by resetting the final focus to the focusDialog point.
951  //
952  //Also, if the requested position was within 1 degree of the coordinate pole, this will
953  //automatically correct the final pointing from the intermediate offset position to the final position
954  data()->setSnapNextFocus();
955  if ( Options::useAltAz() ) {
956  map()->setDestinationAltAz( focusDialog->point().alt(), focusDialog->point().az() );
957  } else {
958  map()->setDestination( focusDialog->point().ra(), focusDialog->point().dec() );
959  }
960 
961  //Now, if the requested point was near a pole, we need to reset the Alt/Dec of the focus.
962  if ( Options::useAltAz() && realAlt > 89.0 ) map()->focus()->setAlt( realAlt );
963  if ( ! Options::useAltAz() && realDec > 89.0 ) map()->focus()->setDec( realAlt );
964 
965  //Don't track if we set Alt/Az coordinates. This way, Alt/Az remain constant.
966  if ( focusDialog->usedAltAz() )
967  map()->stopTracking();
968  }
969  delete focusDialog;
970 }
971 
972 void KStars::slotZoomChanged() {
973  // Enable/disable actions
974  actionCollection()->action("zoom_out")->setEnabled( Options::zoomFactor() > MINZOOM );
975  actionCollection()->action("zoom_in" )->setEnabled( Options::zoomFactor() < MAXZOOM );
976  // Update status bar
977  map()->setupProjector(); // this needs to be run redundantly, so that the FOV returned below is up-to-date.
978  float fov = map()->projector()->fov();
979  KLocalizedString fovi18nstring = ki18nc( "approximate field of view", "Approximate FOV: %1 degrees" );
980  if ( fov < 1.0 ) {
981  fov = fov * 60.0;
982  fovi18nstring = ki18nc( "approximate field of view", "Approximate FOV: %1 arcminutes" );
983  }
984  if ( fov < 1.0 ) {
985  fov = fov * 60.0;
986  fovi18nstring = ki18nc( "approximate field of view", "Approximate FOV: %1 arcseconds" );
987  }
988  QString fovstring = fovi18nstring.subs( QString::number( fov, 'f', 1 ) ).toString();
989  statusBar()->changeItem( fovstring, 0 );
990 }
991 
992 void KStars::slotSetZoom() {
993  bool ok;
994  double currentAngle = map()->width() / ( Options::zoomFactor() * dms::DegToRad );
995  double minAngle = map()->width() / ( MAXZOOM * dms::DegToRad );
996  double maxAngle = map()->width() / ( MINZOOM * dms::DegToRad );
997 
998  double angSize = KInputDialog::getDouble( i18nc( "The user should enter an angle for the field-of-view of the display",
999  "Enter Desired Field-of-View Angle" ),
1000  i18n( "Enter a field-of-view angle in degrees: " ),
1001  currentAngle, minAngle, maxAngle, 0.1, 1, &ok );
1002 
1003  if( ok ) {
1004  map()->setZoomFactor( map()->width() / ( angSize * dms::DegToRad ) );
1005  }
1006 }
1007 
1008 void KStars::slotCoordSys() {
1009  if ( Options::useAltAz() ) {
1010  Options::setUseAltAz( false );
1011  if ( Options::useRefraction() ) {
1012  if ( map()->focusObject() ) //simply update focus to focusObject's position
1013  map()->setFocus( map()->focusObject() );
1014  else { //need to recompute focus for unrefracted position
1015  map()->setFocusAltAz( SkyPoint::unrefract( map()->focus()->alt() ),
1016  map()->focus()->az() );
1017  map()->focus()->HorizontalToEquatorial( data()->lst(), data()->geo()->lat() );
1018  }
1019  }
1020  actionCollection()->action("coordsys")->setText( i18n("Switch to horizonal view (Horizontal &Coordinates)") );
1021  } else {
1022  Options::setUseAltAz( true );
1023  if ( Options::useRefraction() ) {
1024  map()->setFocusAltAz( map()->focus()->altRefracted(), map()->focus()->az() );
1025  }
1026  actionCollection()->action("coordsys")->setText( i18n("Switch to star globe view (Equatorial &Coordinates)") );
1027  }
1028  map()->forceUpdate();
1029 }
1030 
1031 void KStars::slotMapProjection() {
1032  if ( sender() == actionCollection()->action("project_lambert") )
1033  Options::setProjection( SkyMap::Lambert );
1034  if ( sender() == actionCollection()->action("project_azequidistant") )
1035  Options::setProjection( SkyMap::AzimuthalEquidistant );
1036  if ( sender() == actionCollection()->action("project_orthographic") )
1037  Options::setProjection( SkyMap::Orthographic );
1038  if ( sender() == actionCollection()->action("project_equirectangular") )
1039  Options::setProjection( SkyMap::Equirectangular );
1040  if ( sender() == actionCollection()->action("project_stereographic") )
1041  Options::setProjection( SkyMap::Stereographic );
1042  if ( sender() == actionCollection()->action("project_gnomonic") )
1043  Options::setProjection( SkyMap::Gnomonic );
1044 
1045  //DEBUG
1046  kDebug() << i18n( "Projection system: %1", Options::projection() );
1047 
1048  skymap->forceUpdate();
1049 }
1050 
1051 //Settings Menu:
1052 void KStars::slotColorScheme() {
1053  //use mid(3) to exclude the leading "cs_" prefix from the action name
1054  QString filename = QString( sender()->objectName() ).mid(3) + ".colors";
1055  loadColorScheme( filename );
1056 }
1057 
1058 void KStars::slotTargetSymbol(bool flag) {
1059  kDebug() << QString("slotTargetSymbol: %1 %2").arg( sender()->objectName() ).arg( flag);
1060 
1061  QStringList names = Options::fOVNames();
1062  if( flag ) {
1063  // Add FOV to list
1064  names.append( sender()->objectName() );
1065  } else {
1066  // Remove FOV from list
1067  int ix = names.indexOf( sender()->objectName() );
1068  if( ix >= 0 )
1069  names.removeAt(ix);
1070  }
1071  Options::setFOVNames( names );
1072 
1073  // Sync visibleFOVs with fovNames
1074  data()->syncFOV();
1075 
1076  map()->forceUpdate();
1077 }
1078 
1079 void KStars::slotFOVEdit() {
1080  QPointer<FOVDialog> fovdlg = new FOVDialog( this );
1081  if ( fovdlg->exec() == QDialog::Accepted ) {
1082  fovdlg->writeFOVList();
1083  repopulateFOV();
1084  }
1085  delete fovdlg;
1086 }
1087 
1088 void KStars::slotObsList() {
1089  obsList->show();
1090 }
1091 
1092 void KStars::slotEquipmentWriter() {
1093  eWriter->loadEquipment();
1094  eWriter->show();
1095 }
1096 
1097 void KStars::slotObserverAdd() {
1098  oAdd->show();
1099 }
1100 
1101 void KStars::slotExecute() {
1102  getExecute()->init();
1103  getExecute()->show();
1104 }
1105 
1106 //Help Menu
1107 void KStars::slotTipOfDay() {
1108  KTipDialog::showTip(this, "kstars/tips", true);
1109 }
1110 
1111 // Toggle to and from full screen mode
1112 void KStars::slotFullScreen()
1113 {
1114  if ( topLevelWidget()->isFullScreen() ) {
1115  topLevelWidget()->setWindowState( topLevelWidget()->windowState() & ~Qt::WindowFullScreen ); // reset
1116  } else {
1117  topLevelWidget()->setWindowState( topLevelWidget()->windowState() | Qt::WindowFullScreen ); // set
1118  }
1119 }
1120 
1121 void KStars::slotClearAllTrails() {
1122  //Exclude object with temporary trail
1123  SkyObject *exOb( NULL );
1124  if ( map()->focusObject() && map()->focusObject()->isSolarSystem() && data()->temporaryTrail ) {
1125  exOb = map()->focusObject();
1126  }
1127 
1128  TrailObject::clearTrailsExcept( exOb );
1129 
1130  map()->forceUpdate();
1131 }
1132 
1133 //toggle display of GUI Items on/off
1134 void KStars::slotShowGUIItem( bool show ) {
1135  //Toolbars
1136  if ( sender() == actionCollection()->action( "show_statusBar" ) ) {
1137  Options::setShowStatusBar( show );
1138  statusBar()->setVisible(show);
1139  }
1140 
1141  if ( sender() == actionCollection()->action( "show_sbAzAlt" ) ) {
1142  Options::setShowAltAzField( show );
1143  if( !show )
1144  statusBar()->changeItem( QString(), 1 );
1145  }
1146 
1147  if ( sender() == actionCollection()->action( "show_sbRADec" ) ) {
1148  Options::setShowRADecField( show );
1149  if( ! show )
1150  statusBar()->changeItem( QString(), 2 );
1151  }
1152 
1153 }
1154 void KStars::addColorMenuItem( const QString &name, const QString &actionName ) {
1155  KToggleAction *kta = actionCollection()->add<KToggleAction>( actionName );
1156  kta->setText( name );
1157  kta->setObjectName( actionName );
1158  kta->setActionGroup( cschemeGroup );
1159  connect( kta, SIGNAL( toggled( bool ) ), this, SLOT( slotColorScheme() ) );
1160  colorActionMenu->addAction( kta );
1161 
1162  KConfigGroup cg = KGlobal::config()->group( "Colors" );
1163  if ( actionName.mid( 3 ) == cg.readEntry( "ColorSchemeFile", "moonless-night.colors" ).remove( ".colors" ) ) {
1164  kta->setChecked( true );
1165  }
1166 }
1167 
1168 void KStars::removeColorMenuItem( const QString &actionName ) {
1169  kDebug() << "removing " << actionName;
1170  colorActionMenu->removeAction( actionCollection()->action( actionName ) );
1171 }
1172 
1173 /*
1174 
1175 void KStars::establishINDI()
1176 {
1177 #ifdef HAVE_INDI_H
1178  if (indimenu == NULL)
1179  indimenu = GUIManager::Instance();
1180  if (indidriver == NULL)
1181  indidriver = new DriverManager();
1182 #endif
1183 }
1184 */
1185 
1186 void KStars::slotAboutToQuit()
1187 {
1188  // Delete skymap. This required to run destructors and save
1189  // current state in the option.
1190  delete skymap;
1191 
1192  //Store Window geometry in Options object
1193  Options::setWindowWidth( width() );
1194  Options::setWindowHeight( height() );
1195 
1196  //explicitly save the colorscheme data to the config file
1197  data()->colorScheme()->saveToConfig();
1198 
1199  //synch the config file with the Config object
1200  writeConfig();
1201 
1202  if( !Options::obsListSaveImage() ) {
1203  foreach ( const QString& file, obsList->imageList() )
1204  QFile::remove( KStandardDirs::locateLocal( "appdata", file ) );
1205  }
1206 }
1207 
1208 void KStars::slotShowPositionBar(SkyPoint* p ) {
1209  if ( Options::showAltAzField() ) {
1210  dms a = p->alt();
1211  if ( Options::useAltAz() )
1212  a = p->altRefracted();
1213  QString s = QString("%1, %2").arg( p->az().toDMSString(true), //true: force +/- symbol
1214  a.toDMSString(true) ); //true: force +/- symbol
1215  statusBar()->changeItem( s, 1 );
1216  }
1217  if ( Options::showRADecField() ) {
1218  QString s = QString("%1, %2").arg(p->ra().toHMSString(),
1219  p->dec().toDMSString(true) ); //true: force +/- symbol
1220  statusBar()->changeItem( s, 2 );
1221  }
1222 }
1223 
1224 void KStars::slotUpdateComets() {
1225  data()->skyComposite()->solarSystemComposite()->cometsComponent()->updateDataFile();
1226 }
1227 
1228 void KStars::slotUpdateAsteroids() {
1229  data()->skyComposite()->solarSystemComposite()->asteroidsComponent()->updateDataFile();
1230 }
1231 
1232 void KStars::slotUpdateSupernovae()
1233 {
1234  data()->skyComposite()->supernovaeComponent()->slotTriggerDataFileUpdate();
1235 }
Options::setFOVNames
static void setFOVNames(const QStringList &v)
Set Name of selected FOV indicators.
Definition: Options.h:970
Options::setShowSupernovae
static void setShowSupernovae(bool v)
Set Draw supernovae in the sky map?
Definition: Options.h:1426
TrailObject::hasTrail
bool hasTrail() const
Definition: trailobject.h:46
KStars::addColorMenuItem
void addColorMenuItem(const QString &name, const QString &actionName)
Add an item to the color-scheme action manu.
Definition: kstarsactions.cpp:1154
ObsConditions::Binoculars
Definition: obsconditions.h:38
ksplanetbase.h
SkyPoint::ra
const dms & ra() const
Definition: skypoint.h:171
LocationDialog
Dialog for changing the geographic location of the observer.
Definition: locationdialog.h:57
Options::skyCulture
static uint skyCulture()
Get Sky culture.
Definition: Options.h:1151
SkyMap::AzimuthalEquidistant
Definition: skymap.h:97
Options::showAltAzField
static bool showAltAzField()
Get Display Alt/Az coordinates in the statusbar?
Definition: Options.h:334
SimClock::setManualMode
void setManualMode(bool on=true)
Sets Manual Mode on/off according to the bool argument.
Definition: simclock.cpp:73
KStarsData::clock
SimClock * clock()
Definition: kstarsdata.h:158
Options::showRADecField
static bool showRADecField()
Get Display RA/Dec coordinates in the statusbar?
Definition: Options.h:353
TrailObject::clearTrailsExcept
static void clearTrailsExcept(SkyObject *o)
Remove trail for all objects but one which is passed as parameter.
Definition: trailobject.cpp:71
Options::showCatalog
static QList< int > showCatalog()
Get List of toggles for displaying custom object catalogs.
Definition: Options.h:448
SkyPoint::az
const dms & az() const
Definition: skypoint.h:177
KStars::map
SkyMap * map() const
Definition: kstars.h:134
MoonPhaseTool
Shows a moon phase calendar for an entire month.
Definition: moonphasetool.h:46
SkyMap::slotCenter
void slotCenter()
Center the display at the point ClickedPoint.
Definition: skymap.cpp:373
SkyMap::setFocusObject
void setFocusObject(SkyObject *o)
Set the FocusObject pointer to the argument.
Definition: skymap.cpp:365
ekosmanager.h
Options::noEquipCheck
static bool noEquipCheck()
Get Availability of both telescope and binoculars.
Definition: Options.h:4521
opssolarsystem.h
opsekos.h
KStarsData::colorScheme
ColorScheme * colorScheme()
Definition: kstarsdata.h:149
kswizard.h
timedialog.h
telescopewizardprocess.h
skyobject.h
AsteroidsComponent::updateDataFile
void updateDataFile()
Definition: asteroidscomponent.cpp:224
wiview.h
SkyMap::setDestination
void setDestination(const SkyPoint &f)
sets the destination point of the sky map.
Definition: skymap.cpp:812
exportimagedialog.h
SkyMap::setClickedObject
void setClickedObject(SkyObject *o)
Set the ClickedObject pointer to the argument.
Definition: skymap.cpp:361
SkyMap::setFocus
void setFocus(SkyPoint *f)
sets the central focus point of the sky map.
Definition: skymap.cpp:789
SkyMap::Gnomonic
Definition: skymap.h:101
KStars::slotApplyWIConfigChanges
void slotApplyWIConfigChanges()
Apply new settings for WI.
Definition: kstarsactions.cpp:568
opscolors.h
Options::setCatalogFile
static void setCatalogFile(const QStringList &v)
Set Filenames of defined custom object catalogs.
Definition: Options.h:419
moonphasetool.h
WIView
Manages the QML user interface for What's Interesting.
Definition: wiview.h:37
SkyMap::forceUpdate
void forceUpdate(bool now=false)
Recalculates the positions of objects in the sky, and then repaints the sky map.
Definition: skymap.cpp:985
ImageExporter
Backends for exporting a sky image, either raster or vector, with a legend.
Definition: imageexporter.h:35
KStarsData::geo
GeoLocation * geo()
Definition: kstarsdata.h:164
KStarsData::setFullTimeUpdate
void setFullTimeUpdate()
The Sky is updated more frequently than the moon, which is updated more frequently than the planets...
Definition: kstarsdata.cpp:260
opsguides.h
SkyMapComposite::setCurrentCulture
void setCurrentCulture(QString culture)
Definition: skymapcomposite.cpp:597
Options::isTracking
static bool isTracking()
Get Is tracking engaged?
Definition: Options.h:1075
SolarSystemComposite::asteroidsComponent
AsteroidsComponent * asteroidsComponent()
Definition: solarsystemcomposite.cpp:127
altvstime.h
SkyMap::Lambert
Definition: skymap.h:96
ObsConditions::None
Definition: obsconditions.h:38
GeoLocation::tzrule
TimeZoneRule * tzrule()
Definition: geolocation.h:124
fovdialog.h
SkyMap::setupProjector
void setupProjector()
Call to set up the projector before a draw cycle.
Definition: skymap.cpp:1010
KStars::removeColorMenuItem
void removeColorMenuItem(const QString &actionName)
Remove an item from the color-scheme action manu.
Definition: kstarsactions.cpp:1168
SkyMapComposite::reloadCNames
void reloadCNames()
Definition: skymapcomposite.cpp:499
wiequipsettings.h
SkyMap::stopTracking
void stopTracking()
Definition: skymapevents.cpp:374
Options::setShowCBounds
static void setShowCBounds(bool v)
Set Draw constellation boundaries in the sky map?
Definition: Options.h:1540
solarsystemcomposite.h
Options::setShowStatusBar
static void setShowStatusBar(bool v)
Set Display the statusbar?
Definition: Options.h:305
guimanager.h
Options::catalogFile
static QStringList catalogFile()
Get Filenames of defined custom object catalogs.
Definition: Options.h:429
MAXZOOM
#define MAXZOOM
Definition: kstarsdata.h:39
KStars::getExecute
Execute * getExecute()
Definition: kstars.cpp:363
SkyMapComposite::isLocalCNames
bool isLocalCNames()
Definition: skymapcomposite.cpp:544
TrailObject::clearTrail
void clearTrail()
clear the Trail
Definition: trailobject.cpp:66
astrocalc.h
Options::setProjection
static void setProjection(uint v)
Set Mapping projection algorithm.
Definition: Options.h:2300
SkyMapComposite::reloadCLines
void reloadCLines()
Definition: skymapcomposite.cpp:490
SkyMapComposite::addCustomCatalog
void addCustomCatalog(const QString &filename, int index)
Definition: skymapcomposite.cpp:468
TimeDialog
A class for adjusting the Time and Date.
Definition: timedialog.h:47
NaN::f
const float f
Definition: nan.h:36
ObsConditions::Telescope
Definition: obsconditions.h:38
KStars::slotSetZoom
void slotSetZoom()
action slot: Allow user to specify a field-of-view angle for the display window in degrees...
Definition: kstarsactions.cpp:992
Options::setShowCLines
static void setShowCLines(bool v)
Set Draw constellation lines in the sky map?
Definition: Options.h:1578
Options::projection
static uint projection()
Get Mapping projection algorithm.
Definition: Options.h:2310
planetviewer.h
SkyPoint
The sky coordinates of a point in the sky.
Definition: skypoint.h:50
opscatalog.h
KStars::applyConfig
void applyConfig(bool doApplyFocus=true)
Apply config options throughout the program.
Definition: kstars.cpp:165
Options::fOVNames
static QStringList fOVNames()
Get Name of selected FOV indicators.
Definition: Options.h:980
ObsConditions::Equipment
Equipment
Equipment available to the user.
Definition: obsconditions.h:38
Options::setShowCNames
static void setShowCNames(bool v)
Set Draw constellation names in the sky map?
Definition: Options.h:1597
Options::setShowFlags
static void setShowFlags(bool v)
Set Draw flags in the sky map?
Definition: Options.h:1768
Options::slewTimeScale
static double slewTimeScale()
Get Minimum timescale for forced-slewing mode.
Definition: Options.h:2272
SkyMapComposite::getCultureName
QString getCultureName(int index)
Definition: skymapcomposite.cpp:593
TimeZoneRule::nextDSTChange
KStarsDateTime nextDSTChange()
Definition: timezonerule.h:103
SkyMap::setZoomFactor
void setZoomFactor(double factor)
@ Set zoom factor.
Definition: skymap.cpp:976
KStars::slotShowPositionBar
void slotShowPositionBar(SkyPoint *)
Display position in the status bar.
Definition: kstarsactions.cpp:1208
TrailObject::addToTrail
void addToTrail()
adds a point to the planet's trail
Definition: trailobject.cpp:54
skymapcomposite.h
Options::setShowMilkyWay
static void setShowMilkyWay(bool v)
Set Draw Milky Way contour in the sky map?
Definition: Options.h:1882
AstroCalc
Astrocalc is the base class for the KStars astronomical calculator.
Definition: astrocalc.h:37
KStarsData::changeDateTime
void changeDateTime(const KStarsDateTime &newDate)
change the current simulation date/time to the KStarsDateTime argument.
Definition: kstarsdata.cpp:272
SkyMap::focus
SkyPoint * focus()
Retrieve the Focus point; the position on the sky at the center of the skymap.
Definition: skymap.h:120
locationdialog.h
GeoLocation
Contains all relevant information for specifying a location on Earth: City Name, State/Province name...
Definition: geolocation.h:39
Options::setShowHorizontalGrid
static void setShowHorizontalGrid(bool v)
Set Draw horizontal coordinate grid in the sky map?
Definition: Options.h:1711
SupernovaeComponent::slotTriggerDataFileUpdate
void slotTriggerDataFileUpdate()
This initiates updating of the data file by using supernovae_updates_parser.py.
Definition: supernovaecomponent.cpp:228
Options::setIsTracking
static void setIsTracking(bool v)
Set Is tracking engaged?
Definition: Options.h:1065
MINZOOM
#define MINZOOM
Definition: kstarsdata.h:38
JMoonTool
Display the positions of Jupiter's moons as a function of time.
Definition: jmoontool.h:31
KStars::slotGeoLocator
void slotGeoLocator()
action slot: open dialog for selecting a new geographic location
Definition: kstarsactions.cpp:461
Projector::fov
double fov() const
Return the FOV of this projection.
Definition: projector.cpp:88
Options::setShowRADecField
static void setShowRADecField(bool v)
Set Display RA/Dec coordinates in the statusbar?
Definition: Options.h:343
Options::obsListSaveImage
static bool obsListSaveImage()
Get Save the DSS/SDSS images to disk.
Definition: Options.h:2816
Options::setRunClock
static void setRunClock(bool v)
Set Run clock.
Definition: Options.h:2749
KSWizard
The Setup Wizard will be automatically opened when KStars runs for the first time.
Definition: kswizard.h:56
SkyMapComposite::supernovaeComponent
SupernovaeComponent * supernovaeComponent()
Definition: skymapcomposite.cpp:618
Options::setShowCatalog
static void setShowCatalog(const QList< int > &v)
Set List of toggles for displaying custom object catalogs.
Definition: Options.h:438
skymap.h
i18nc
i18nc("string from libindi, used in the config dialog","100x")
SkyMap::setFocusAltAz
void setFocusAltAz(const dms &alt, const dms &az)
sets the focus point of the sky map, using its alt/az coordinates
Definition: skymap.cpp:801
KStars::updateTime
void updateTime(const bool automaticDSTchange=true)
Update time-dependent data and (possibly) repaint the sky map.
Definition: kstars.cpp:334
SimClock::stop
Q_SCRIPTABLE Q_NOREPLY void stop()
DBUS function to stop the SimClock.
Definition: simclock.cpp:104
KStars::writeConfig
Q_SCRIPTABLE Q_NOREPLY void writeConfig()
DBUS interface function.
Definition: kstarsdcop.cpp:260
execute.h
SkyPoint::HorizontalToEquatorial
void HorizontalToEquatorial(const dms *LST, const dms *lat)
Determine the (RA, Dec) coordinates of the SkyPoint from its (Altitude, Azimuth) coordinates, given the local sidereal time and the observer's latitude.
Definition: skypoint.cpp:102
KStarsDateTime
Extension of KDateTime for KStars KStarsDateTime can represent the date/time as a Julian Day...
Definition: kstarsdatetime.h:45
jmoontool.h
opsadvanced.h
KStarsData::skyComposite
SkyMapComposite * skyComposite()
Definition: kstarsdata.h:146
Options::setUseAltAz
static void setUseAltAz(bool v)
Set Use horizontal coordinate system?
Definition: Options.h:2376
skycalendar.h
dms
An angle, stored as degrees, but expressible in many ways.
Definition: dms.h:42
simclock.h
KStars::slotFlagManager
void slotFlagManager()
action slot: open Flag Manager
Definition: kstarsactions.cpp:397
KStars::slotTrack
void slotTrack()
action slot: Toggle whether kstars is tracking current position
Definition: kstarsactions.cpp:892
SkyPoint::dec
const dms & dec() const
Definition: skypoint.h:174
PrintingWizard
Class representing Printing Wizard for KStars printed documents (currently only finder charts)...
Definition: printingwizard.h:66
SkyPoint::EquatorialToHorizontal
void EquatorialToHorizontal(const dms *LST, const dms *lat)
Determine the (Altitude, Azimuth) coordinates of the SkyPoint from its (RA, Dec) coordinates, given the local sidereal time and the observer's latitude.
Definition: skypoint.cpp:55
imageexporter.h
opsindi.h
KStars::slotZoomChanged
void slotZoomChanged()
Called when zoom level is changed.
Definition: kstarsactions.cpp:972
SkyMap::forceUpdateNow
void forceUpdateNow()
Convenience function; simply calls forceUpdate(true).
Definition: skymap.h:306
ObsConditions::setObsConditions
void setObsConditions(int bortle, double aperture, Equipment equip, TelescopeType telType)
Set new observing conditions.
Definition: obsconditions.cpp:107
FITSViewer::addFITS
int addFITS(const KUrl *imageName, FITSMode mode=FITS_NORMAL, FITSScale filter=FITS_NONE)
Definition: fitsviewer.cpp:196
TimeZoneRule::reset_with_ltime
void reset_with_ltime(KStarsDateTime &ltime, const double TZoffset, const bool time_runs_forward, const bool automaticDSTchange=false)
Recalculate next dst change and if DST is active by a given local time with timezone offset and time ...
Definition: timezonerule.cpp:301
SkyMap::Equirectangular
Definition: skymap.h:99
Options::useRefraction
static bool useRefraction()
Get Correct positions for atmospheric refraction?
Definition: Options.h:2462
KStarsData::syncFOV
void syncFOV()
Synchronize list of visible FOVs and list of selected FOVs in Options.
Definition: kstarsdata.cpp:1045
printingwizard.h
Options.h
SkyPoint::altRefracted
dms altRefracted() const
Definition: skypoint.cpp:754
scriptbuilder.h
QTextStream
SimClock::setClockScale
Q_SCRIPTABLE Q_NOREPLY void setClockScale(float s)
DBUS function to set scale of simclock.
Definition: simclock.cpp:157
GUIManager::Instance
static GUIManager * Instance()
Definition: guimanager.cpp:47
opssatellites.h
Options::setWindowHeight
static void setWindowHeight(uint v)
Set Height of main window, in pixels.
Definition: Options.h:381
WIView::getWIBaseView
QDeclarativeView * getWIBaseView() const
Definition: wiview.h:64
KStars::printImage
Q_SCRIPTABLE Q_NOREPLY void printImage(bool usePrintDialog, bool useChartColors)
DBUS interface function.
Definition: kstarsdcop.cpp:528
GeoLocation::TZ0
double TZ0() const
Definition: geolocation.h:118
asteroidscomponent.h
ObsConditions::Invalid
Definition: obsconditions.h:44
KStars::slotSetTimeToNow
void slotSetTimeToNow()
action slot: sync kstars clock to system time
Definition: kstarsactions.cpp:600
finddialog.h
SkyMap::setClickedPoint
void setClickedPoint(SkyPoint *f)
Set the ClickedPoint to the skypoint given as an argument.
Definition: skymap.cpp:829
focusdialog.h
KStarsData::setSnapNextFocus
void setSnapNextFocus(bool b=true)
Disable or re-enable the slewing animation for the next Focus change.
Definition: kstarsdata.h:194
CometsComponent::updateDataFile
void updateDataFile()
Definition: cometscomponent.cpp:199
SkyObject::CONSTELLATION
Definition: skyobject.h:110
SimClock::manualTick
void manualTick(bool force=false)
Equivalent of tick() for manual mode.
Definition: simclock.cpp:90
SkyMapComposite::solarSystemComposite
SolarSystemComposite * solarSystemComposite()
Definition: skymapcomposite.cpp:613
Options::zoomFactor
static double zoomFactor()
Get Zoom Factor, in pixels per radian.
Definition: Options.h:2531
cometscomponent.h
KStarsData::setNextDSTChange
void setNextDSTChange(const KStarsDateTime &dt)
Set the NextDSTChange member.
Definition: kstarsdata.h:106
Options::setShowSatellites
static void setShowSatellites(bool v)
Set Draw satellites in the sky map?
Definition: Options.h:4302
opssupernovae.h
GUIManager::updateStatus
void updateStatus()
Definition: guimanager.cpp:91
ColorScheme::saveToConfig
void saveToConfig()
Save color-scheme data to the Config object.
Definition: colorscheme.cpp:277
KStars::slotApplyConfigChanges
void slotApplyConfigChanges()
Apply new settings and redraw skymap.
Definition: kstarsactions.cpp:548
ObsConditions
This class deals with the observing conditions of the night sky.
Definition: obsconditions.h:31
projector.h
Options::useAltAz
static bool useAltAz()
Get Use horizontal coordinate system?
Definition: Options.h:2386
KStars::data
KStarsData * data() const
Definition: kstars.h:131
SkyPoint::unrefract
static double unrefract(const double alt)
Remove refraction correction.
Definition: skypoint.cpp:778
KStars::clearCachedFindDialog
void clearCachedFindDialog()
Delete FindDialog because ObjNames list has changed in KStarsData due to reloading star data...
Definition: kstars.cpp:152
KSPlanetBase
A subclass of TrailObject that provides additional information needed for most solar system objects...
Definition: ksplanetbase.h:63
telescopeWizardProcess
Definition: telescopewizardprocess.h:26
SimClock::start
Q_SCRIPTABLE Q_NOREPLY void start()
DBUS function to start the SimClock.
Definition: simclock.cpp:117
KStarsData::isTimeRunningForward
bool isTimeRunningForward()
Returns true if time is running forward else false.
Definition: kstarsdata.h:111
Options::setRunStartupWizard
static void setRunStartupWizard(bool v)
Set Run Startup Wizard when KStars launches?
Definition: Options.h:400
kstarsdatetime.h
Options::setShowAltAzField
static void setShowAltAzField(bool v)
Set Display Alt/Az coordinates in the statusbar?
Definition: Options.h:324
SkyPoint::setAlt
void setAlt(dms alt)
Sets Alt, the Altitude.
Definition: skypoint.h:141
fitsviewer.h
Options::binocularsCheck
static bool binocularsCheck()
Get Availability of binoculars.
Definition: Options.h:4502
SkyPoint::setDec
void setDec(dms d)
Sets Dec, the current Declination.
Definition: skypoint.h:130
GeoLocation::UTtoLT
KStarsDateTime UTtoLT(const KStarsDateTime &ut) const
Definition: geolocation.h:233
SkyMap::Stereographic
Definition: skymap.h:100
kstarsdata.h
SolarSystemComposite::cometsComponent
CometsComponent * cometsComponent()
Definition: solarsystemcomposite.cpp:122
SkyPoint::alt
const dms & alt() const
Definition: skypoint.h:180
flagmanager.h
KStars::loadColorScheme
Q_SCRIPTABLE Q_NOREPLY void loadColorScheme(const QString &name)
DBUS interface function.
Definition: kstarsdcop.cpp:406
Options::self
static Options * self()
Definition: Options.cpp:17
Options::setShowGround
static void setShowGround(bool v)
Set Draw opaque ground in the sky map?
Definition: Options.h:1730
ObsConditions::Both
Definition: obsconditions.h:38
SkyMap::setFocusPoint
void setFocusPoint(SkyPoint *f)
set the FocusPoint; the position that is to be the next Destination.
Definition: skymap.h:191
SkyMap::focusObject
SkyObject * focusObject() const
Retrieve the object which is centered in the sky map.
Definition: skymap.h:229
SkyMap::Orthographic
Definition: skymap.h:98
SkyObject
Provides all necessary information about an object in the sky: its coordinates, name(s), type, magnitude, and QStringLists of URLs for images and webpages regarding the object.
Definition: skyobject.h:46
Options::setShowDeepSky
static void setShowDeepSky(bool v)
Set Draw "deep sky" objects in the sky map?
Definition: Options.h:1616
SkyMap::projector
const Projector * projector() const
Get the current projector.
Definition: skymap.h:264
FITSViewer
Definition: fitsviewer.h:51
opsxplanet.h
SkyMap::setDestinationAltAz
void setDestinationAltAz(const dms &alt, const dms &az)
sets the destination point of the sky map, using its alt/az coordinates.
Definition: skymap.cpp:822
wilpsettings.h
ObsConditions::TelescopeType
TelescopeType
Telescope Type (Reflector/Refractor)
Definition: obsconditions.h:44
kstars.h
catalogcomponent.h
Options::telescopeCheck
static bool telescopeCheck()
Get Availability of telescope.
Definition: Options.h:4483
Options::useLocalConstellNames
static bool useLocalConstellNames()
Get Use localized constellation names?
Definition: Options.h:2367
Options::setShowStars
static void setShowStars(bool v)
Set Draw stars in the sky map?
Definition: Options.h:2167
Options::setShowSolarSystem
static void setShowSolarSystem(bool v)
Set Meta-option for all planets in the sky map.
Definition: Options.h:1920
WIView::updateModels
void updateModels(ObsConditions *obs)
Updates sky-object list models.
Definition: wiview.cpp:149
wutdialog.h
SkyMapComposite::currentCulture
QString currentCulture()
Definition: skymapcomposite.cpp:601
Options::setShowEquatorialGrid
static void setShowEquatorialGrid(bool v)
Set Draw equatorial coordinate grid in the sky map?
Definition: Options.h:1692
drivermanager.h
Options::bortleClass
static uint bortleClass()
Get Bortle dark-sky rating.
Definition: Options.h:4464
KStars::slotClearAllTrails
void slotClearAllTrails()
Remove all trails which may have been added to solar system bodies.
Definition: kstarsactions.cpp:1121
DriverManager::Instance
static DriverManager * Instance()
Definition: drivermanager.cpp:91
KStarsData::setLocation
void setLocation(const GeoLocation &l)
Set the GeoLocation according to the argument.
Definition: kstarsdata.cpp:323
supernovaecomponent.h
Options::setWindowWidth
static void setWindowWidth(uint v)
Set Width of main window, in pixels.
Definition: Options.h:362
KStarsData::syncLST
void syncLST()
Sync the LST with the simulation clock.
Definition: kstarsdata.cpp:268
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:36:20 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kstars

Skip menu "kstars"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal