• 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
  • skycomponents
notifyupdatesui.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  notifyupdatesui.cpp - K Desktop Planetarium
3  -------------------
4  begin : 2012/05/03
5  copyright : (C) 2012 by Samikshan Bairagya
6  email : samikshan@gmail.com
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 
19 #include "skyobjects/supernova.h"
20 #include "supernovaecomponent.h"
21 #include "notifyupdatesui.h"
22 #include "ui_notifyupdatesui.h"
23 #include "kstars.h"
24 #include "kstarsdata.h"
25 #include "skymap.h"
26 #include "kdebug.h"
27 #include "QTreeWidget"
28 #include <QtGui/QApplication>
29 
30 NotifyUpdatesUI::NotifyUpdatesUI(QWidget *parent) :
31  QDialog(parent),
32  ui(new Ui::NotifyUpdatesUI)
33 {
34  ui->setupUi(this);
35  setWindowTitle(i18n("New Supernova(e) discovered!"));
36  connect(ui->centrePushButton, SIGNAL( clicked() ), SLOT( slotCenter() ));
37 }
38 
39 NotifyUpdatesUI::~NotifyUpdatesUI()
40 {
41  delete ui;
42 }
43 
44 void NotifyUpdatesUI::addItems(QList<SkyObject*> updatesList)
45 {
46  //int len = updatesList.size();
47  foreach (SkyObject *so , updatesList)
48  {
49  Supernova * sup = (Supernova *)so;
50 
51  QString name = sup->name();
52  QString hostGalaxy = i18n("Host Galaxy :: %1", sup->getHostGalaxy());
53  QString magnitude = i18n("Magnitude :: %1", QString::number(sup->getMagnitude()));
54  QString type = i18n("Type :: %1", sup->getType());
55  QString position = i18n("Position :: RA : %1 Dec : %2", sup->getRA().toHMSString(), sup->getDec().toDMSString());
56  QString date = i18n("Date :: %1", sup->getDate());
57 
58  QTreeWidgetItem *info = new QTreeWidgetItem(ui->infoTreeWidget);
59  QTreeWidgetItem *hGalaxy = new QTreeWidgetItem(info);
60  QTreeWidgetItem *t = new QTreeWidgetItem(info);
61  QTreeWidgetItem *mag = new QTreeWidgetItem(info);
62  QTreeWidgetItem *pos = new QTreeWidgetItem(info);
63  QTreeWidgetItem *dt = new QTreeWidgetItem(info);
64 
65  info->setText(0, name);
66  hGalaxy->setText(0, hostGalaxy);
67  pos->setText(0, position);
68  mag->setText(0, magnitude);
69  t->setText(0, type);
70  dt->setText(0, date);
71  ui->infoTreeWidget->addTopLevelItem(info);
72  }
73 }
74 
75 void NotifyUpdatesUI::slotCenter()
76 {
77  KStars* kstars = KStars::Instance();
78  SkyObject *o = 0;
79  // get selected item
80  if ( ui->infoTreeWidget->currentItem() != 0) {
81  if (ui->infoTreeWidget->currentItem()->childCount() > 0) //Serial No. is selected
82  o = kstars->data()->objectNamed( ui->infoTreeWidget->currentItem()->text(0) );
83  else
84  o = kstars->data()->objectNamed( ui->infoTreeWidget->currentItem()->parent()->text(0) );
85  }
86  if (o != 0) {
87  kstars->map()->setFocusPoint( o );
88  kstars->map()->setFocusObject( o );
89  kstars->map()->setDestination( *kstars->map()->focusPoint() );
90  }
91 }
KStarsData::objectNamed
SkyObject * objectNamed(const QString &name)
Find object by name.
Definition: kstarsdata.cpp:345
notifyupdatesui.h
supernova.h
KStars::map
SkyMap * map() const
Definition: kstars.h:134
Supernova::getDec
dms getDec()
Definition: supernova.h:68
QDialog
SkyMap::setFocusObject
void setFocusObject(SkyObject *o)
Set the FocusObject pointer to the argument.
Definition: skymap.cpp:365
Supernova::getHostGalaxy
QString getHostGalaxy()
Definition: supernova.h:83
Supernova::getMagnitude
float getMagnitude()
Definition: supernova.h:73
SkyMap::setDestination
void setDestination(const SkyPoint &f)
sets the destination point of the sky map.
Definition: skymap.cpp:812
NotifyUpdatesUI
Definition: notifyupdatesui.h:30
QWidget
KStars::Instance
static KStars * Instance()
Definition: kstars.h:125
SkyMap::focusPoint
SkyPoint * focusPoint()
retrieve the FocusPoint position.
Definition: skymap.h:140
KStars
This is the main window for KStars.
Definition: kstars.h:94
NotifyUpdatesUI::~NotifyUpdatesUI
~NotifyUpdatesUI()
Definition: notifyupdatesui.cpp:39
NotifyUpdatesUI::addItems
void addItems(QList< SkyObject * > updatesList)
Definition: notifyupdatesui.cpp:44
Supernova::getType
QString getType()
Definition: supernova.h:78
Supernova
Represents the supernova object.
Definition: supernova.h:44
skymap.h
Supernova::getRA
dms getRA()
Definition: supernova.h:63
NotifyUpdatesUI::NotifyUpdatesUI
NotifyUpdatesUI(QWidget *parent=0)
Definition: notifyupdatesui.cpp:30
Supernova::getDate
QString getDate()
Definition: supernova.h:88
KStars::data
KStarsData * data() const
Definition: kstars.h:131
kstarsdata.h
SkyMap::setFocusPoint
void setFocusPoint(SkyPoint *f)
set the FocusPoint; the position that is to be the next Destination.
Definition: skymap.h:191
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
Supernova::name
virtual QString name(void) const
Definition: supernova.h:58
kstars.h
QList
supernovaecomponent.h
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