[Digikam-devel] [libkipi] /: new deprecated methods in ImageInfo class : description(), setDescription(), angle() setAngle().

Gilles Caulier caulier.gilles at gmail.com
Wed Feb 1 12:55:59 GMT 2012


Git commit b9af6e3c35c9b43847615f4eb6e2c96be1167fa4 by Gilles Caulier.
Committed on 01/02/2012 at 13:52.
Pushed by cgilles into branch 'master'.

new deprecated methods in ImageInfo class : description(), setDescription(), angle() setAngle().
Use more universal attributes() and setAttributes() methods instead.
CCMAIL: kde-imaging at kde.org
CCMAIL: digikam-devel at kde.org

M  +2    -0    CMakeLists.txt
M  +42   -40   libkipi/imageinfo.cpp
M  +33   -27   libkipi/imageinfo.h
M  +24   -24   libkipi/imageinfoshared.cpp
M  +10   -10   libkipi/imageinfoshared.h

http://commits.kde.org/libkipi/b9af6e3c35c9b43847615f4eb6e2c96be1167fa4

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3e26c1c..4f54f12 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -63,6 +63,8 @@ ADD_DEFINITIONS(-DKDE_DEFAULT_DEBUG_AREA=${LIBKIPI_AREA_CODE_GENERAL})
 # 1.3.0 => 8.0.1  (released with KDE 4.7.1 - Set deprecated ImageInfo::title() and ImageInfo::setTitle(). Add ImageInfo::name() and ImageInfo::setName().
 # 1.4.0 => 8.0.2  (released with KDE 4.8.0 - Add 2 new slots in ConfigWidget class).
 # 1.5.0 => 9.0.0  (released with KDE 4.8.1 - Add Progress Manager feature support from Host application. Remove deprecated methods.
+#                                            Add new deprecated methods in ImageInfo class: description(), setDescription(), 
+#                                            angle(), and setAngle().
 
 # Library API version
 SET(KIPI_LIB_MAJOR_VERSION "1")
diff --git a/libkipi/imageinfo.cpp b/libkipi/imageinfo.cpp
index bbb00bf..01b5062 100644
--- a/libkipi/imageinfo.cpp
+++ b/libkipi/imageinfo.cpp
@@ -40,35 +40,35 @@
 namespace KIPI
 {
 
-QString ImageInfo::toString( const QVariant& data ) const
+ImageInfo::ImageInfo( ImageInfoShared* const shared )
+    : d( shared )
 {
-    QString string = data.toString();
-    return string;
 }
 
-QString ImageInfo::name() const
+ImageInfo::ImageInfo( const ImageInfo& rhs )
 {
-    return d->name();
+    d = rhs.d;
+    d->addRef();
 }
 
-void ImageInfo::setName( const QString& name )
+ImageInfo::~ImageInfo()
 {
-    d->setName( name );
+    d->removeRef();
 }
 
-KUrl ImageInfo::path() const
+QString ImageInfo::name() const
 {
-    return d->path();
+    return d->name();
 }
 
-QString ImageInfo::description() const
+void ImageInfo::setName( const QString& name )
 {
-    return d->description();
+    d->setName( name );
 }
 
-QDateTime ImageInfo::time( TimeSpec spec ) const
+KUrl ImageInfo::path() const
 {
-    return d->time( spec );
+    return d->path();
 }
 
 int ImageInfo::size() const
@@ -76,70 +76,72 @@ int ImageInfo::size() const
     return d->size();
 }
 
-ImageInfo::ImageInfo( ImageInfoShared* const shared )
-         : d( shared )
+QMap<QString,QVariant> ImageInfo::attributes() const
 {
+    return d->attributes();
 }
 
-ImageInfo::ImageInfo( const ImageInfo& rhs )
+void ImageInfo::addAttributes( const QMap<QString,QVariant>& attributes )
 {
-    d = rhs.d;
-    d->addRef();
+    d->addAttributes( attributes );
 }
 
-ImageInfo::~ImageInfo()
+void ImageInfo::delAttributes( const QStringList& attributes )
 {
-    d->removeRef();
+    d->delAttributes( attributes );
 }
 
-void ImageInfo::setDescription( const QString& description )
+void ImageInfo::clearAttributes()
 {
-    d->setDescription( description );
+    d->clearAttributes();
 }
 
-QMap<QString,QVariant> ImageInfo::attributes() const
+void ImageInfo::cloneData( const ImageInfo& other )
 {
-    return d->attributes();
+    d->cloneData( other.d );
 }
 
-void ImageInfo::addAttributes( const QMap<QString,QVariant>& attributes )
+QDateTime ImageInfo::time( TimeSpec spec ) const
 {
-    d->addAttributes( attributes );
+    return d->time( spec );
 }
 
-void ImageInfo::delAttributes( const QStringList& attributes )
+void ImageInfo::setTime( const QDateTime& time, TimeSpec spec )
 {
-    d->delAttributes( attributes );
+    d->setTime( time, spec );
 }
 
-void ImageInfo::clearAttributes()
+bool ImageInfo::isTimeExact() const
 {
-    d->clearAttributes();
+    return d->isTimeExact();
 }
 
-int ImageInfo::angle() const
+QString ImageInfo::toString( const QVariant& data ) const
 {
-    return d->angle();
+    QString string = data.toString();
+    return string;
 }
 
-void ImageInfo::setAngle( int angle )
+// Deprecated methods --------------------------------------------------------------
+
+QString ImageInfo::description() const
 {
-    d->setAngle( angle );
+    return d->description();
 }
 
-bool ImageInfo::isTimeExact() const
+void ImageInfo::setDescription( const QString& description )
 {
-    return d->isTimeExact();
+    d->setDescription( description );
 }
 
-void ImageInfo::setTime( const QDateTime& time, TimeSpec spec )
+int ImageInfo::angle() const
 {
-    d->setTime( time, spec );
+    return d->angle();
 }
 
-void ImageInfo::cloneData( const ImageInfo& other )
+void ImageInfo::setAngle( int angle )
 {
-    d->cloneData( other.d );
+    d->setAngle( angle );
 }
 
 } // namespace KIPI
diff --git a/libkipi/imageinfo.h b/libkipi/imageinfo.h
index 7bcefe4..d67873d 100644
--- a/libkipi/imageinfo.h
+++ b/libkipi/imageinfo.h
@@ -69,11 +69,38 @@ class LIBKIPI_EXPORT ImageInfo
 
 public:
 
+    /** constructor
+        Interface for host application + general stuff
+     */
+    ImageInfo( ImageInfoShared* const );
+    ImageInfo( const ImageInfo& );
+    ~ImageInfo();
+
     QString name() const;
     void setName( const QString& name );
 
-    QString description() const;
-    void setDescription( const QString& description);
+    /** replaced by attributes(QString("comment"))
+     */
+    KDE_DEPRECATED QString description() const;
+
+    /** replaced by addAttributes(QMap < QString("comment"), QString("...") >)
+     */
+    KDE_DEPRECATED void setDescription( const QString& description);
+
+    /**
+        Returns the angle the application rotates the image with when displaying it.
+        Certain host applications may choose to rotate the image on disk, and will always return 0,
+        while other host application will rotate the image when displaying it, and will thus not rotate
+        the image on disk.
+        replaced by attributes(QString("angle"))
+    */
+    KDE_DEPRECATED int angle() const;
+
+    /**
+        See \ref angle
+        replaced by addAttributes(QMap < QString("angle"), int >)
+    */
+    KDE_DEPRECATED void setAngle(int);
 
     /**
         Returns a Map of attributes of the image
@@ -127,8 +154,6 @@ public:
      */
     void clearAttributes();
 
-    KUrl path() const;
-
     /**
         Returns the time of the image.
         In case the host application supports time range, the spec argument
@@ -148,34 +173,15 @@ public:
     */
     bool isTimeExact() const;
 
-    int size() const;
-
-    /**
-        Returns the angle the application rotates the image with when displaying it.
-        Certain host applications may choose to rotate the image on disk, and will always return 0,
-        while other host application will rotate the image when displaying it, and will thus not rotate
-        the image on disk.
-    */
-    int angle() const;
-
-    /**
-        See \ref angle
-    */
-    void setAngle(int);
-
-    QString toString( const QVariant& ) const;
 
     /**
-        Copies all the attibutes, description etc from the other imageinfo
+        Copies all the attributes from the other imageinfo
     */
     void cloneData( const ImageInfo& other );
 
-    /** constructor
-        Interface for host application + general stuff
-     */
-    ImageInfo( ImageInfoShared* const );
-    ImageInfo( const ImageInfo& );
-    ~ImageInfo();
+    int  size() const;
+    KUrl path() const;
+    QString toString( const QVariant& ) const;
 
 private:
 
diff --git a/libkipi/imageinfoshared.cpp b/libkipi/imageinfoshared.cpp
index 94dd055..a750fce 100644
--- a/libkipi/imageinfoshared.cpp
+++ b/libkipi/imageinfoshared.cpp
@@ -55,6 +55,20 @@ ImageInfoShared::~ImageInfoShared()
 {
 }
 
+void ImageInfoShared::addRef()
+{
+    m_count++;
+}
+
+void ImageInfoShared::removeRef()
+{
+    m_count--;
+    if ( m_count == 0 )
+    {
+        delete this;
+    }
+}
+
 KUrl ImageInfoShared::path()
 {
     return _url;
@@ -86,26 +100,7 @@ QDateTime ImageInfoShared::time( TimeSpec )
     }
 }
 
-void ImageInfoShared::addRef()
-{
-    m_count++;
-}
-
-void ImageInfoShared::removeRef()
-{
-    m_count--;
-    if ( m_count == 0 )
-    {
-        delete this;
-    }
-}
-
-int ImageInfoShared::angle()
-{
-    return 0;
-}
-
-void ImageInfoShared::setAngle( int )
+void ImageInfoShared::setTime( const QDateTime& /*time*/, TimeSpec /*spec*/ )
 {
 }
 
@@ -114,10 +109,6 @@ bool ImageInfoShared::isTimeExact()
     return true;
 }
 
-void ImageInfoShared::setTime( const QDateTime& /*time*/, TimeSpec /*spec*/ )
-{
-}
-
 void ImageInfoShared::setName( const QString& )
 {
     kWarning() << "This method should only be invoked if the host application "
@@ -149,4 +140,13 @@ void ImageInfoShared::cloneData( ImageInfoShared* const other )
     setAngle( other->angle() );
 }
 
+int ImageInfoShared::angle()
+{
+    return 0;
+}
+
+void ImageInfoShared::setAngle( int )
+{
+}
+
 } // namespace KIPI
diff --git a/libkipi/imageinfoshared.h b/libkipi/imageinfoshared.h
index d338abd..3e2623a 100644
--- a/libkipi/imageinfoshared.h
+++ b/libkipi/imageinfoshared.h
@@ -62,31 +62,31 @@ public:
     ImageInfoShared( KIPI::Interface* const interface, const KUrl& url );
     virtual ~ImageInfoShared();
 
+    QString toString(const QVariant&);
+
     virtual QString name();
     virtual void    setName(const QString&);
 
-    virtual QString description() = 0;
-    virtual void    setDescription(const QString&) = 0;
-
     virtual QMap<QString, QVariant> attributes() = 0;
     virtual void clearAttributes() = 0;
     virtual void addAttributes(const QMap<QString, QVariant>&) = 0;
     virtual void delAttributes(const QStringList& ) = 0;
 
     virtual QDateTime time(KIPI::TimeSpec spec);
-    virtual void setTime(const QDateTime& time, TimeSpec spec = FromInfo);
-
-    virtual int  angle();
-    virtual void setAngle(int);
+    virtual void      setTime(const QDateTime& time, TimeSpec spec = FromInfo);
+    virtual bool      isTimeExact();
 
-    virtual bool isTimeExact();
     virtual int  size();
     virtual KUrl path();
 
-    QString toString(const QVariant&);
-
     virtual void cloneData(ImageInfoShared* const other);
 
+    KDE_DEPRECATED virtual QString description() = 0;
+    KDE_DEPRECATED virtual void    setDescription(const QString&) = 0;
+
+    KDE_DEPRECATED virtual int  angle();
+    KDE_DEPRECATED virtual void setAngle(int);
+
 protected:
 
     KUrl _url;



More information about the Digikam-devel mailing list