kstars
observinglist.cpp
Go to the documentation of this file.
75 : QDialog((QWidget *)KStars::Instance()), LogObject(nullptr), m_CurrentObject(nullptr), isModified(false), m_dl(nullptr)
98 QStringList() << i18n("Name") << i18n("Alternate Name") << i18nc("Right Ascension", "RA (J2000)")
102 QStringList() << i18n("Name") << i18n("Alternate Name") << i18nc("Right Ascension", "RA (J2000)")
142 connect(ui->SessionView->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
182 .scaled(ui->ImagePreview->width(), ui->ImagePreview->height(), Qt::KeepAspectRatio, Qt::FastTransformation);
215 // qCDebug(KSTARS) << "Updating altitude for " << p.ra().toHMSString() << " " << p.dec().toDMSString() << " alt = " << p.alt().toDMSString() << " info to " << itemText;
285 _obj->clone()); // Use a clone in case the original SkyObject is deleted due to change in catalog configuration.
290 KStars::Instance()->statusBar()->showMessage(i18n("%1 is already in the session plan.", finalObjectName), 0);
294 // JM: If we are loading observing list from disk, solar system objects magnitudes are not calculated until later
296 if ((obj->type() == SkyObject::COMET || obj->type() == SkyObject::ASTEROID || obj->type() == SkyObject::MOON ||
307 smag = QString::number(obj->mag(), 'f', 2); // The lower limit to avoid display of unrealistic comet magnitudes
320 // Fill itemlist with items that are common to both wishlist additions and session plan additions
325 keyItem->setData(QVariant::fromValue<void *>(static_cast<void *>(obj.data())), Qt::UserRole + 1);
327 << keyItem // NOTE: The rest of the methods assume that the SkyObject pointer is available in the first column!
346 // - Weight by declination - latitude (in the northern hemisphere, southern objects get higher precedence)
348 SkyPoint p = obj->recomputeHorizontalCoords(KStarsDateTime::currentDateTimeUtc(), geo); // Current => now
353 KStars::Instance()->statusBar()->showMessage(i18n("Added %1 to observing list.", finalObjectName), 0);
383 KStarsData::Instance()->skyComposite()->constellationBoundary()->constellationName(obj.data())))
391 KStars::Instance()->statusBar()->showMessage(i18n("Added %1 to session list.", finalObjectName), 0);
403 else if (sessionView) //else if is needed as clickedObject should not be removed from the session list.
512 getActiveSortModel()->mapSelectionToSource(getActiveView()->selectionModel()->selection()).indexes();
579 QString ImagePath = KSPaths::locate(QStandardPaths::GenericDataLocation, m_currentImageFileName);
587 ImagePreviewHash[o.data()] = QPixmap(ksdi.getFileName()).scaledToHeight(ui->ImagePreview->width());
589 //ui->ImagePreview->setPixmap(QPixmap(ksdi.getFileName()).scaledToHeight(ui->ImagePreview->width()));
618 labelText += ":</b> " + i18nc("%1 magnitude of object, %2 type of sky object (planet, asteroid "
783 // TODO: Think and see if there's a more efficient way to do this. I can't seem to think of any, but this code looks like it could be improved. - Akarsh
786 m_SessionSortModel->mapSelectionToSource(ui->SessionView->selectionModel()->selection()).indexes() :
787 m_WishListSortModel->mapSelectionToSource(ui->WishListView->selectionModel()->selection()).indexes());
831 QUrl fileURL = QFileDialog::getOpenFileUrl(KStars::Instance(), i18n("Open Observing List"), QUrl(),
937 if (KMessageBox::questionYesNo(this, message, i18n("Save Current session?"), KStandardGuiItem::save(),
949 QUrl fileURL = QFileDialog::getSaveFileUrl(KStars::Instance(), i18n("Save Observing List"), QUrl(),
966 &fileContents); // We first write to a QString to prevent truncating the file in case there is a crash.
993 f.setFileName(KSPaths::writableLocation(QStandardPaths::GenericDataLocation) + "wishlist.obslist");
996 qWarning() << "Cannot save wish list to file!"; // TODO: This should be presented as a message box to the user
1007 f.setFileName(KSPaths::writableLocation(QStandardPaths::GenericDataLocation) + "wishlist.obslist");
1069 if (KMessageBox::warningYesNo(nullptr, message, i18n("Could Not Open File"), KGuiItem(i18n("Try Different")),
1130 ui->avt->setDawnDuskTimes(ksal->getDawnAstronomicalTwilight(), ksal->getDuskAstronomicalTwilight());
1194 //Creating a copy of the lists, we can't use the original lists as they'll keep getting modified as the loop iterates
1233 int width = QInputDialog::getInt(this, i18n("Customized DSS Download"), i18n("Specify image width (arcminutes): "),
1245 QInputDialog::getItem(this, i18n("Customized DSS Download"), i18n("Specify version: "), strList, 0, false, &ok);
1247 QUrl srcUrl(KSDssDownloader::getDSSURL(currentObject()->ra0(), currentObject()->dec0(), width, height, "gif",
1261 o == currentObject()); // FIXME: Meaningless to operate on m_currentImageFileName unless o == currentObject()!
1273 qWarning() << "FIXME: Removed support for SDSS. Until reintroduction, we will supply a DSS image";
1274 std::function<void(bool)> slot = std::bind(&ObservingList::downloadReady, this, std::placeholders::_1);
1293 if( QFile( KSPaths::writableLocation(QStandardPaths::GenericDataLocation) + QDir::separator() + m_currentImageFileName ).size() > 13000)
1297 ui->ImagePreview->setPixmap(QPixmap(getCurrentImagePath()).scaledToHeight(ui->ImagePreview->width()));
1320 QString currentImagePath = KSPaths::locate(QStandardPaths::GenericDataLocation, m_currentImageFileName);
1325 currentImagePath = KSPaths::locate(QStandardPaths::GenericDataLocation, m_currentThumbImageFileName);
1338 m_currentImageFileName = "Image_J" + RAString.remove(' ').remove( ':' ) + DecString.remove(' ').remove( ':' ); // Note: Changed naming convention to standard 2016-08-25 asimha; old images shall have to be re-downloaded.
1348 if ( QFile::exists( imagePath)) // New convention -- append filename extension so file is usable on Windows etc.
1358 QString currentImagePath = KSPaths::locate(QStandardPaths::GenericDataLocation, m_currentImageFileName);
1364 return (KSPaths::writableLocation(QStandardPaths::GenericDataLocation) + m_currentImageFileName);
1382 // QUrl url( ( Options::obsListPreferDSS() ) ? DSSUrl : SDSSUrl ); // FIXME: We have removed SDSS support!
1417 if (KMessageBox::warningYesNo(nullptr, i18n("This will delete all saved images. Are you sure you want to do this?"),
1432 // TODO: Probably, there should be a different directory for cached images in the observing list.
1515 QPointer<ThumbnailPicker> tp = new ThumbnailPicker(currentObject(), *pm, this, 200, 200, i18n("Image Chooser"));
1544 if (!QFile::exists(KSPaths::writableLocation(QStandardPaths::GenericDataLocation) + m_currentThumbImageFileName))
1548 img.save(KSPaths::writableLocation(QStandardPaths::GenericDataLocation) + m_currentThumbImageFileName);
1580 m_WishListSortModel->mapSelectionToSource(ui->WishListView->selectionModel()->selection()).indexes();
1589 true); // FIXME: Better if there is a QSharedPointer override for this, although the check will ensure that we don't duplicate.
1647 // qCDebug(KSTARS) << "Updating altitudes in observation planner @ JD - J2000 = " << double( now.djd() - J2000 );
1655 m_WishListSortModel->mapToSource(m_WishListSortModel->index(irow, m_WishListSortModel->columnCount() - 1));
QString next()
Sort best observation times by reimplementing lessThan() to work on the transit times of objects...
Definition: sessionsortfilterproxymodel.h:38
void slotSaveAllImages()
Downloads the images of all the objects in the session list Note: This downloads the SDSS image...
Definition: observinglist.cpp:1367
void setSaveImagesButton()
decides on whether to enable the SaveImages button or not
Definition: observinglist.cpp:1443
void event(const QLatin1String &name, const QString &message, EventType type)
Definition: ksnotification.cpp:78
DetailDialog is a window showing detailed information for a selected object.
Definition: detaildialog.h:80
Type type() const
void setupUi(QWidget *widget)
void setIcon(const QPixmap &i)
void slotAddToEkosScheduler()
slotAddToEkosScheduler Add object to Ekos scheduler
Definition: observinglist.cpp:718
QString getItem(QWidget *parent, const QString &title, const QString &label, const QStringList &items, int current, bool editable, bool *ok, QFlags< Qt::WindowType > flags, QFlags< Qt::InputMethodHint > inputMethodHints)
void slotSaveSessionAs(bool nativeSave=true)
save the current observing session plan to disk, specify filename.
Definition: observinglist.cpp:944
QString readLine(qint64 maxlen)
SkyPoint recomputeHorizontalCoords(const KStarsDateTime &dt, const GeoLocation *geo) const
Like recomputeCoords, but also calls EquatorialToHorizontal before returning.
Definition: skyobject.cpp:348
QString getCurrentImagePath()
Returns a path to the current image, or a writable image.
Definition: observinglist.cpp:1356
bool remove()
void slotCustomDSS()
Present the user with options to get the right DSS image for the job.
Definition: observinglist.cpp:1224
void setFocusPolicy(Qt::FocusPolicy policy)
bool save(const QString &fileName, const char *format, int quality) const
bool removeRow(int row, const QModelIndex &parent)
Definition: skyobject.h:117
virtual INDI::BaseDevice * getBaseDevice()=0
void saveImage(QUrl url, QString filename, const SkyObject *o=nullptr)
saves the image synchronously from a given URL into a given file url the url from which the image has...
Definition: observinglist.cpp:1389
void setClickedObject(SkyObject *o)
Set the ClickedObject pointer to the argument.
Definition: skymap.cpp:331
QString fileName() const
SkyObject * findStarByGenetiveName(const QString name)
Definition: skymapcomposite.cpp:629
virtual const char * getDeviceName()=0
void setCurrentImage(const SkyObject *o)
Sets the image parameters for the current object o The passed object for setting the parameters...
Definition: observinglist.cpp:1310
void setFileName(const QString &name)
QString version
Used for DSS – Indicates which version of scans to pull.
Definition: ksdssimage.h:76
void setAttribute(Qt::WidgetAttribute attribute, bool on)
T value() const
void sorry(const QString &message, const QString &title)
Definition: ksnotification.cpp:42
void EquatorialToHorizontal(const CachingDms *LST, const CachingDms *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:70
Definition: indistd.h:39
static QString writableLocation(QStandardPaths::StandardLocation type)
Definition: kspaths.h:38
void forceUpdate(bool now=false)
Recalculates the positions of objects in the sky, and then repaints the sky map.
Definition: skymap.cpp:1192
QString fileName() const
void setDate(const QDate &d)
Assign the Date according to a QDate object.
Definition: kstarsdatetime.cpp:149
void error(const QString &message, const QString &title)
Definition: ksnotification.cpp:32
A class that implements methods to find sun rise, sun set, twilight begin / end times, moon rise and moon set times.
Definition: ksalmanac.h:40
void slotSaveSession(bool nativeSave=true)
save the current session
Definition: observinglist.cpp:1052
bool exists() const
QString & remove(int position, int n)
QString text() const
Definition: skyobject.h:124
virtual void setData(const QVariant &value, int role)
void setTime(const QTime &t)
Assign the Time according to a QTime object.
Definition: kstarsdatetime.cpp:166
int indexOf(const T &value, int from) const
double findAltitude(SkyPoint *p, double hour=0)
Return the altitude of the given SkyObject for the given hour.
Definition: observinglist.cpp:1144
void clear()
width
void slotWizard()
construct a new observing list using the wizard.
Definition: observinglist.cpp:1084
int getInt(QWidget *parent, const QString &title, const QString &label, int value, int min, int max, int step, bool *ok, QFlags< Qt::WindowType > flags)
Definition: observinglist.h:47
void setEnabled(bool)
void addWidget(QWidget *widget, int stretch, QFlags< Qt::AlignmentFlag > alignment)
QString number(int n, int base)
QTime transitTime(const KStarsDateTime &dt, const GeoLocation *geo) const
The same iteration technique described in riseSetTime() is used here.
Definition: skyobject.cpp:258
bool atEnd() const
void setLayout(QLayout *layout)
void installEventFilter(QObject *filterObj)
static KStarsDateTime currentDateTime()
Definition: kstarsdatetime.cpp:78
Qt::MouseButton button() const
void slotEyepieceView(SkyPoint *sp, const QString &imagePath=QString())
Show the eyepiece view tool.
Definition: kstarsactions.cpp:1701
bool isEmpty() const
int row() const
void setDefaultImage()
set the default image in the image preview.
Definition: observinglist.cpp:1620
void move(int x, int y)
QString constNameToAbbrev(const QString &fullName_)
Return the abbreviation of the constellation, given the full name.
Definition: ksutils.cpp:555
void slotGetImage(bool _dss=false, const SkyObject *o=nullptr)
Downloads the corresponding DSS or SDSS image from the web and displays it.
Definition: observinglist.cpp:1256
QSharedPointer< SkyObject > findObject(const SkyObject *o, bool session=false)
Definition: observinglist.cpp:1666
QPixmap scaled(int width, int height, Qt::AspectRatioMode aspectRatioMode, Qt::TransformationMode transformMode) const
void selectObject(const SkyObject *o)
make a selection in the session view
Definition: observinglist.cpp:1605
void slotClearList()
slotClearList Remove all objects from current list
Definition: observinglist.cpp:896
void slotDeleteAllImages()
Removes all the save DSS/SDSS images from the disk.
Definition: observinglist.cpp:1415
void slotNewSelection()
Tasks needed when changing the selected object Save the user log of the previous selected object...
Definition: observinglist.cpp:496
virtual bool open(QFlags< QIODevice::OpenModeFlag > mode)
Extension of QDateTime for KStars KStarsDateTime can represent the date/time as a Julian Day...
Definition: kstarsdatetime.h:46
Definition: skyobject.h:127
static bool obsListPreferDSS()
Get Prefer Digitized Sky Survey imagery in the observing list.
Definition: Options.h:3285
void slotSetTime()
Takes the time from the QTimeEdit box and sets it as the time parameter in the tableview of the Sessi...
Definition: observinglist.cpp:1216
bool eventFilter(QObject *obj, QEvent *event) override
This is the declaration of the event filter function which is installed on the KImageFilePreview and ...
Definition: observinglist.cpp:1454
void update(infostruct *, infostruct *, pliststruct *)
QString toLocalFile() const
static bool obsListDemoteHole()
Get While sorting by percentage altitude in the observing list, demote objects present in the Dobsoni...
Definition: Options.h:3323
QString toLower() const
int key() const
void slotUpdateAltitudes()
Recalculate and update the values of the altitude in the wishlist for the current time...
Definition: observinglist.cpp:1643
QStandardItem * item(int row, int column) const
bool contains(QChar ch, Qt::CaseSensitivity cs) const
static double obsListHoleSize()
Get This is the angular distance from the zenith, in degrees, below which you can easily point your t...
Definition: Options.h:3342
void saveThumbImage()
saves a thumbnail image for the details dialog from the downloaded image
Definition: observinglist.cpp:1542
virtual void close()
void slotChangeTab(int index)
toggle the setEnabled flags according to current view set the m_currentItem to nullptr and clear sele...
Definition: observinglist.cpp:1156
ConstellationBoundaryLines * constellationBoundary()
Definition: skymapcomposite.h:186
virtual DeviceFamily getType()=0
void setWindowFlags(QFlags< Qt::WindowType > type)
There are several time-dependent values used in position calculations, that are not specific to an ob...
Definition: ksnumbers.h:54
bool isValid() const
QDate date() const
QVariant data(int role) const
int globalX() const
int globalY() const
void setClickedPoint(SkyPoint *f)
Set the ClickedPoint to the skypoint given as an argument.
Definition: skymap.cpp:1002
SkyObject * findObjectByName(QString name)
return the object with the name as the passed QString from the Session List, return null otherwise ...
Definition: observinglist.cpp:1595
Definition: skyobject.h:126
QTime scheduledTime(SkyObject *o) const
Definition: observinglist.cpp:1557
void setWindowTitle(const QString &)
void slotUpdate()
Updates the tableviews for the new geolocation and date.
Definition: observinglist.cpp:1190
virtual bool setProperty(QObject *)=0
void slotOALExport()
Export a target list to the oal compliant format.
Definition: observinglist.cpp:1567
void saveCurrentList()
If the current list has unsaved changes, ask the user about saving it.
Definition: observinglist.cpp:928
virtual int rowCount(const QModelIndex &parent) const
int column() const
void slotRemoveObject(const SkyObject *o=nullptr, bool session=false, bool update=false)
Remove skyobject from the observing list.
Definition: observinglist.cpp:397
Definition: skyobject.h:125
static QString locate(QStandardPaths::StandardLocation location, const QString &fileName, QStandardPaths::LocateOptions options=QStandardPaths::LocateFile)
Definition: kspaths.cpp:4
void plot(SkyObject *o)
Plot the SkyObject's Altitude vs Time in the AVTPlotWidget.
Definition: observinglist.cpp:1111
QIcon fromTheme(const QString &name, const QIcon &fallback)
void slotDetails()
Show the details window for the selected object.
Definition: observinglist.cpp:727
static KStarsDateTime currentDateTimeUtc()
Definition: kstarsdatetime.cpp:87
QString getObjectName(const SkyObject *o, bool translated=true)
get object name.
Definition: observinglist.cpp:1626
SkyObject * clickedObject() const
Retrieve the object nearest to a mouse click event.
Definition: skymap.h:244
QString constellationName(SkyPoint *p)
Definition: constellationboundarylines.cpp:277
Definition: indicommon.h:165
virtual bool runCommand(int command, void *ptr=nullptr)=0
void slotRemoveSelectedObjects()
Remove skyobjects which are highlighted in the observing list tool from the observing list...
Definition: observinglist.cpp:461
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
Definition: indicommon.h:193
bool hasNext() const
void slotAddObject(const SkyObject *o=nullptr, bool session=false, bool update=false)
add a new object to list o pointer to the object to add to the list session flag toggle adding the ob...
Definition: observinglist.cpp:247
QString readAll()
Definition: skyobject.h:115
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:43
QChar * data()
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
QString toString() const
GDInterface is the Generic Device Interface for INDI devices.
Definition: indistd.h:63
virtual QVariant data(int role) const
a dms subclass that caches its sine and cosine values every time the angle is changed.
Definition: cachingdms.h:29
height
QImage scaled(int width, int height, Qt::AspectRatioMode aspectRatioMode, Qt::TransformationMode transformMode) const
void slotLocation()
Opens the Location dialog to set the GeoLocation for the sessionlist.
Definition: observinglist.cpp:1179
QUrl fromLocalFile(const QString &localFile)
QString filePath() const
static QString getDSSURL(const SkyPoint *const p, const QString &version="all", struct KSDssImage::Metadata *md=nullptr)
High-level method to create a URL to obtain a DSS image for a given SkyPoint.
Definition: ksdssdownloader.cpp:60
This file is part of the KDE documentation.
Documentation copyright © 1996-2019 The KDE developers.
Generated on Fri Dec 13 2019 02:57:12 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2019 The KDE developers.
Generated on Fri Dec 13 2019 02:57:12 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.