File indexing completed on 2024-04-21 14:46:33

0001 /*
0002     SPDX-FileCopyrightText: 2005 Thomas Kabelmann <thomas.kabelmann@gmx.de>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "binarylistcomponent.h"
0010 #include "ksparser.h"
0011 #include "typedef.h"
0012 #include "skyobjects/ksasteroid.h"
0013 #include "solarsystemlistcomponent.h"
0014 #include "filedownloader.h"
0015 
0016 #include <QList>
0017 #include <QPointer>
0018 
0019 /**
0020  * @class AsteroidsComponent
0021  * Represents the asteroids on the sky map.
0022  *
0023  * @author Thomas Kabelmann
0024  * @version 0.1
0025  */
0026 class AsteroidsComponent : public QObject, public SolarSystemListComponent,
0027     virtual public BinaryListComponent<KSAsteroid, AsteroidsComponent>
0028 {
0029         Q_OBJECT
0030 
0031         friend class BinaryListComponent<KSAsteroid, AsteroidsComponent>;
0032     public:
0033         /**
0034          * @short Default constructor.
0035          *
0036          * @p parent pointer to the parent SolarSystemComposite
0037          */
0038         explicit AsteroidsComponent(SolarSystemComposite *parent);
0039         virtual ~AsteroidsComponent() override = default;
0040 
0041         void draw(SkyPainter *skyp) override;
0042         bool selected() override;
0043         SkyObject *objectNearest(SkyPoint *p, double &maxrad) override;
0044 
0045         void updateDataFile(bool isAutoUpdate = false);
0046 
0047     protected slots:
0048         void downloadReady();
0049         void downloadError(const QString &errorString);
0050 
0051     private:
0052         void loadDataFromText() override;
0053 
0054         QPointer<FileDownloader> downloadJob;
0055 };