[Kde-imaging] Fwd: kdeextragear-libs-1/libkipi/libkipi

Jesper K. Pedersen blackie at blackie.dk
Thu May 20 13:01:09 CEST 2004


CVS commit by blackie:

CCMAIL:kde-imaging.kde.org
Added features: KIPI::ImagesHasTime and KIPI::SupportsDateRanges (See
documentation of the enums for their meaning)

Changed ImageInfo::time() to ImageInfo::time( TimeSpec spec = FromInfo )
this change did of course propogate to ImageInfoShared, so host apps needs
to update.

If your app do not support time ranges (like an image is from
1998-2000), then just return the time as always ignoring the spec argument.
Still you do need to update your app to override the correct virtual
method.

Added ImageInfo::setTime() and ImageInfoShared::setTime()

Added ImageInfo::isExactTime() and ImageInfoShared::isExactTime() to tell
whether an image has an exact time or a time range. The default
implementation is to return true, so unless your app supports time ranges,
you can ignore this method.


  M +20 -3     imageinfo.cpp   1.7
  M +6 -2      imageinfo.h   1.10
  M +10 -1     imageinfoshared.cpp   1.3
  M +6 -1      imageinfoshared.h   1.6
  M +11 -0     interface.cpp   1.7
  M +3 -1      interface.h   1.9


--- kdeextragear-libs-1/libkipi/libkipi/imageinfo.cpp  #1.6:1.7
@@ -37,9 +37,11 @@ QString KIPI::ImageInfo::description() c

 /**
-   PENDING(blackie) document
+   Returns the time of the image.
+   In case the host application supports time range, the spec argument
+   specifies if it is the start or end time that should be returned.
 */
-QDateTime KIPI::ImageInfo::time() const
+QDateTime KIPI::ImageInfo::time( TimeSpec spec ) const
 {
-    return _data->time();
+    return _data->time( spec );
 }

@@ -115,2 +117,17 @@ void KIPI::ImageInfo::setAngle( int angl
 }

+/**
+   In the case the application supports time ranges (like this image is
+   from 1998-2000), this method will return true if the time is an exact
+   specification, and thus not a range.
+*/
+bool KIPI::ImageInfo::isTimeExact() const
+{
+    return _data->isTimeExact();
+}
+
+void KIPI::ImageInfo::setTime( const QDateTime& time, TimeSpec spec )
+{
+    _data->setTime( time, spec );
+}
+

--- kdeextragear-libs-1/libkipi/libkipi/imageinfo.h  #1.9:1.10
@@ -11,4 +11,5 @@ namespace KIPI
 {
     class ImageInfoShared;
+    enum TimeSpec { FromInfo, ToInfo };

     class ImageInfo
@@ -27,6 +28,7 @@ namespace KIPI

         KURL path() const;
-        QDateTime time() const;
-        QString toString( const QVariant& ) const;
+        QDateTime time( TimeSpec spec = FromInfo ) const;
+        void setTime( const QDateTime& time, TimeSpec spec = FromInfo );
+        bool isTimeExact() const;
         int size() const;

@@ -34,4 +36,6 @@ namespace KIPI
         void setAngle( int );

+        QString toString( const QVariant& ) const;
+
         // Interface for host application + general stuff
         ImageInfo( ImageInfoShared* );

--- kdeextragear-libs-1/libkipi/libkipi/imageinfoshared.cpp  #1.2:1.3
@@ -23,5 +23,5 @@ int KIPI::ImageInfoShared::size()
 }

-QDateTime KIPI::ImageInfoShared::time()
+QDateTime KIPI::ImageInfoShared::time( KIPI::TimeSpec )
 {
     if ( ! _url.isLocalFile() ) {
@@ -54,2 +54,11 @@ void KIPI::ImageInfoShared::setAngle( in
 {
 }
+
+bool KIPI::ImageInfoShared::isTimeExact()
+{
+    return true;
+}
+
+void KIPI::ImageInfoShared::setTime( const QDateTime& time, TimeSpec spec )
+{
+}

--- kdeextragear-libs-1/libkipi/libkipi/imageinfoshared.h  #1.5:1.6
@@ -6,4 +6,5 @@
 #include <qdatetime.h>
 #include <qvariant.h>
+#include <libkipi/imageinfo.h>

 namespace KIPI
@@ -25,5 +26,9 @@ namespace KIPI

         virtual KURL path();
-        virtual QDateTime time();
+        virtual QDateTime time( KIPI::TimeSpec spec );
+        virtual void setTime( const QDateTime& time, TimeSpec spec =
 FromInfo ); +
+        virtual bool isTimeExact();
+
         virtual int size();


--- kdeextragear-libs-1/libkipi/libkipi/interface.cpp  #1.6:1.7
@@ -39,4 +39,15 @@
  */

+/*!
+  \enum KIPI::ImagesHasTime
+  This feature specifies that images has a date associated with it, which
 the host application can display and set +*/
+
+/*!
+  \enum KIPI::SupportsDateRanges
+  This feature specify whether the host application supports that the user
 can specify a date range for images, +  like 1998-2000.
+*/
+
 KIPI::Interface::Interface(QObject *parent, const char *name )

     : QObject(parent, name)

--- kdeextragear-libs-1/libkipi/libkipi/interface.h  #1.8:1.9
@@ -34,5 +34,7 @@ namespace KIPI
         AlbumsHaveDescriptions = 0x0001,
         AlbumEQDir             = 0x0002,
-        ImagesHasComments      = 0x0004
+        ImagesHasComments      = 0x0004,
+        ImagesHasTime          = 0x0008,
+        SupportsDateRanges     = 0x0010
     };


More information about the Kde-imaging mailing list