[Kstars-devel] branches/kstars/summer/kstars/kstars

Prakash Mohan prak902000 at gmail.com
Fri Jul 17 22:36:43 CEST 2009


SVN commit 998517 by prakash:

Reverting an earlier patch, making the class Log usable with multiple instances as we need them now to maintiain different forms of equipmentlist, etc. 
1. We'll need one list for all the objects used( a global list, hence will have a pointer to the log object in the kstarsdata class )
2. We'll need a list for the objects read from a file
3. We'll need a list for objects to be written into a file.
So, making multiple instances available will take care of the tasks 2 and 3. The need for a global object will be taken care of by the pointer in kstars->data() rather than a single instance.

CCMAIL: kstars-devel at kde.org


 M  +0 -8      comast/log.cpp  
 M  +0 -2      comast/log.h  
 M  +4 -4      tools/observinglist.cpp  


--- branches/kstars/summer/kstars/kstars/comast/log.cpp #998516:998517
@@ -22,14 +22,6 @@
 #include "skycomponents/constellationboundary.h"
 #include "kstarsdatetime.h"
 
-Comast::Log *pinstance = NULL;
-
-Comast::Log* Comast::Log::Instance() {
-    if( !pinstance ) 
-        pinstance = new Comast::Log;
-    return pinstance;
-}
-
 void Comast::Log::writeBegin() {
     writer = new QXmlStreamWriter(&output);
     writer->setAutoFormatting( true );
--- branches/kstars/summer/kstars/kstars/comast/log.h #998516:998517
@@ -38,7 +38,6 @@
 
 class Comast::Log {
     public:
-        static Comast::Log* Instance();
         QString writeLog( bool native = true );
         void writeBegin();
         void writeGeoDate();
@@ -87,7 +86,6 @@
         void readGeoDate();
         QString readResult();
     private:
-        Log() {}
         QList<SkyObject *> m_targetList;
         QList<Comast::Observer *> m_observerList;
         QList<Comast::Eyepiece *> m_eyepieceList; 
--- branches/kstars/summer/kstars/kstars/tools/observinglist.cpp #998516:998517
@@ -860,8 +860,8 @@
         QTextStream istream( &f );
         QString input;
         input = istream.readAll();
-        Comast::Log *logObject = Comast::Log::Instance();
-        logObject->readBegin( input );
+        Comast::Log logObject;
+        logObject.readBegin( input );
         //Update the location and user set times from file
         slotUpdate();
         //Newly-opened list should not trigger isModified flag
@@ -963,8 +963,8 @@
     return;
     }
     QTextStream ostream( &f );
-    Comast::Log *logObject = Comast::Log::Instance();
-    ostream<< logObject->writeLog( nativeSave );
+    Comast::Log log;
+    ostream<< log.writeLog( nativeSave );
     f.close();
     isModified = false;//We've saved the session, so reset the modified flag.
 }


More information about the Kstars-devel mailing list