summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkarsh Simha <akarsh@kde.org>2016-08-18 09:29:55 (GMT)
committerAkarsh Simha <akarsh@kde.org>2016-08-18 09:29:55 (GMT)
commit247a6e1dee9ddb48512c21e757f1aa69e508efb9 (patch)
tree1ed4c4bc28ad044d03c3eeb42795b3808d4f0842
parent67bf490da3e13d8636193c05c527949a90ba2725 (diff)
Include a SkyObject::NUMBER_OF_KNOWN_TYPES enum entry + Cosmetics
The purpose of this entry is to figure out how many types there are in the enum. FIXME: SkyGLPainter still uses TYPE_UNKNOWN to determine how many types there are. But that code is unmaintained anyway...
-rw-r--r--kstars/kstarsdata.cpp25
-rw-r--r--kstars/kstarsinit.cpp1
-rw-r--r--kstars/skycomponents/skymapcomposite.cpp4
-rw-r--r--kstars/skyobjects/skyobject.h6
4 files changed, 31 insertions, 5 deletions
diff --git a/kstars/kstarsdata.cpp b/kstars/kstarsdata.cpp
index ca17cfe..5edfa50 100644
--- a/kstars/kstarsdata.cpp
+++ b/kstars/kstarsdata.cpp
@@ -555,6 +555,7 @@ bool KStarsData::openUrlFile(const QString &urlfile, QFile & file) {
return fileFound;
}
+// FIXME: This is a significant contributor to KStars start-up time
bool KStarsData::readURLData( const QString &urlfile, int type, bool deepOnly ) {
QFile file;
if (!openUrlFile(urlfile, file)) return false;
@@ -600,6 +601,28 @@ bool KStarsData::readURLData( const QString &urlfile, int type, bool deepOnly )
return true;
}
+// FIXME: Improve the user log system
+
+// Note: It might be very nice to keep the log in plaintext files, for
+// portability, human-readability, and greppability. However, it takes
+// a lot of time to parse and look up, is very messy from the
+// reliability and programming point of view, needs to be parsed at
+// start, can become corrupt easily because of a missing bracket...
+
+// An SQLite database is a good compromise. A user can easily view it
+// using an SQLite browser. There is no need to read at start-up, one
+// can read the log when required. Easy to edit logs / update logs
+// etc. Will not become corrupt. Needn't be parsed.
+
+// However, IMHO, it is best to put these kinds of things in separate
+// databases, instead of unifying them as a table under the user
+// database. This ensures portability and a certain robustness that if
+// a user opens it, they cannot incorrectly edit a part of the DB they
+// did not intend to edit.
+
+// --asimha 2016 Aug 17
+
+// FIXME: This is a significant contributor to KStars startup time.
bool KStarsData::readUserLog()
{
QFile file;
@@ -616,7 +639,7 @@ bool KStarsData::readUserLog()
int startIndex, endIndex;
startIndex = buffer.indexOf(QLatin1String("[KSLABEL:"));
- sub = buffer.mid(startIndex);
+ sub = buffer.mid(startIndex); // FIXME: This is inefficient because we are making a copy of a huge string!
endIndex = sub.indexOf(QLatin1String("[KSLogEnd]"));
// Read name after KSLABEL identifer
diff --git a/kstars/kstarsinit.cpp b/kstars/kstarsinit.cpp
index de5682a..842b6fe 100644
--- a/kstars/kstarsinit.cpp
+++ b/kstars/kstarsinit.cpp
@@ -146,7 +146,6 @@ void KStars::initActions() {
<< QIcon::fromTheme("document-open")
<< QKeySequence( Qt::CTRL+Qt::Key_O );
#endif
-
actionCollection()->addAction("export_image", this, SLOT( slotExportImage() ) )
<< i18n("&Save Sky Image...")
<< QIcon::fromTheme("document-export-image")
diff --git a/kstars/skycomponents/skymapcomposite.cpp b/kstars/skycomponents/skymapcomposite.cpp
index af40e80..34488b8 100644
--- a/kstars/skycomponents/skymapcomposite.cpp
+++ b/kstars/skycomponents/skymapcomposite.cpp
@@ -84,7 +84,7 @@ SkyMapComposite::SkyMapComposite(SkyComposite *parent ) :
addComponent( m_CBoundLines = new ConstellationBoundaryLines( this ), 80);
m_Cultures = new CultureList();
addComponent( m_CLines = new ConstellationLines( this, m_Cultures ), 85);
- addComponent( m_CNames = new ConstellationNamesComponent( this, m_Cultures ), 90);
+ addComponent( m_CNames = new ConstellationNamesComponent( this, m_Cultures ), 90);
addComponent( m_Equator = new Equator( this ), 95);
addComponent( m_Ecliptic = new Ecliptic( this ), 95);
addComponent( m_Horizon = new HorizonComponent( this ), 100);
@@ -288,7 +288,7 @@ void SkyMapComposite::draw( SkyPainter *skyp )
m_StarHopRouteList->pen = QPen( QColor(data->colorScheme()->colorNamed( "StarHopRouteColor" )), 1. );
m_StarHopRouteList->draw( skyp );
-
+
m_ArtificialHorizon->draw( skyp );
m_Horizon->draw( skyp );
diff --git a/kstars/skyobjects/skyobject.h b/kstars/skyobjects/skyobject.h
index 5024241..96e340b 100644
--- a/kstars/skyobjects/skyobject.h
+++ b/kstars/skyobjects/skyobject.h
@@ -107,12 +107,16 @@ public:
/**
*@enum TYPE
*The type classification of the SkyObject.
+ * @note Keep TYPE_UNKNOWN at 255. To find out how many known
+ * types exist, keep the NUMBER_OF_KNOWN_TYPES at the highest
+ * non-Unknown value. This is a fake type that can be used in
+ * comparisons and for loops.
*/
enum TYPE { STAR=0, CATALOG_STAR=1, PLANET=2, OPEN_CLUSTER=3, GLOBULAR_CLUSTER=4,
GASEOUS_NEBULA=5, PLANETARY_NEBULA=6, SUPERNOVA_REMNANT=7, GALAXY=8,
COMET=9, ASTEROID=10, CONSTELLATION=11, MOON=12, ASTERISM=13,
GALAXY_CLUSTER=14, DARK_NEBULA=15, QUASAR=16, MULT_STAR=17, RADIO_SOURCE=18,
- SATELLITE=19, SUPERNOVA=20, TYPE_UNKNOWN=255 };
+ SATELLITE=19, SUPERNOVA=20, NUMBER_OF_KNOWN_TYPES=21, TYPE_UNKNOWN=255 };
/**
*@return A translated string indicating the type name for a given type number