[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [tellico] src: Rename method to be a little more explicit
From:       Robby Stephenson <null () kde ! org>
Date:       2017-08-01 0:49:16
Message-ID: E1dcLN6-0001gt-Ik () code ! kde ! org
[Download RAW message or body]

Git commit 4f58d9b3166bf249c78a57384f04bd406e3b53de by Robby Stephenson.
Committed on 01/08/2017 at 00:33.
Pushed by rstephenson into branch 'master'.

Rename method to be a little more explicit

M  +1    -1    src/core/filehandler.cpp
M  +5    -5    src/images/imagefactory.cpp
M  +1    -1    src/images/imagefactory.h

https://commits.kde.org/tellico/4f58d9b3166bf249c78a57384f04bd406e3b53de

diff --git a/src/core/filehandler.cpp b/src/core/filehandler.cpp
index 7966ff84..5aa09833 100644
--- a/src/core/filehandler.cpp
+++ b/src/core/filehandler.cpp
@@ -214,7 +214,7 @@ Tellico::Data::Image* FileHandler::readImageFile(const QUrl& url_, const QString
   return img;
 }
 
-// really, this should be decoupled from the writeBackupFile() function
+// TODO: really, this should be decoupled from the writeBackupFile() function
 // but every other function that calls it would need to be updated
 bool FileHandler::queryExists(const QUrl& url_) {
   if(url_.isEmpty() || !QFile::exists(url_.toLocalFile())) {
diff --git a/src/images/imagefactory.cpp b/src/images/imagefactory.cpp
index 58bb801c..518fd7d3 100644
--- a/src/images/imagefactory.cpp
+++ b/src/images/imagefactory.cpp
@@ -149,7 +149,7 @@ const Tellico::Data::Image& ImageFactory::addImageImpl(const QUrl& url_, bool qu
     img->setID(url_.url());
   }
 
-  if(hasImage(img->id())) {
+  if(hasImageInMemory(img->id())) {
     const Data::Image& img2 = imageById(img->id());
     if(!img2.isNull()) {
       delete img;
@@ -176,7 +176,7 @@ QString ImageFactory::addImage(const QPixmap& pix_, const QString& format_) {
 
 const Tellico::Data::Image& ImageFactory::addImageImpl(const QImage& image_, const QString& format_) {
   Data::Image* img = new Data::Image(image_, format_);
-  if(hasImage(img->id())) {
+  if(hasImageInMemory(img->id())) {
     const Data::Image& img2 = imageById(img->id());
     if(!img2.isNull()) {
       delete img;
@@ -322,7 +322,7 @@ bool ImageFactory::writeCachedImage(const QString& id_, ImageDirectory* imgDir_,
 }
 
 const Tellico::Data::Image& ImageFactory::imageById(const QString& id_) {
-  Q_ASSERT(factory);
+  Q_ASSERT(factory && "ImageFactory is not initialized!");
   if(id_.isEmpty() || !factory) {
     return Data::Image::null;
   }
@@ -485,7 +485,7 @@ bool ImageFactory::hasImageInfo(const QString& id_) {
 
 bool ImageFactory::validImage(const QString& id_) {
   // don't try s_imageInfoMap[id_] cause it inserts an empty image info
-  return s_imageInfoMap.contains(id_) || factory->hasImage(id_) || !imageById(id_).isNull();
+  return s_imageInfoMap.contains(id_) || factory->hasImageInMemory(id_) || !imageById(id_).isNull();
 }
 
 QPixmap ImageFactory::pixmap(const QString& id_, int width_, int height_) {
@@ -618,7 +618,7 @@ Tellico::StringSet ImageFactory::imagesNotInCache() {
   return set;
 }
 
-bool ImageFactory::hasImage(const QString& id_) const {
+bool ImageFactory::hasImageInMemory(const QString& id_) const {
   return d->imageCache.contains(id_) || d->imageDict.contains(id_);
 }
 
diff --git a/src/images/imagefactory.h b/src/images/imagefactory.h
index eeac1d79..c5b841e1 100644
--- a/src/images/imagefactory.h
+++ b/src/images/imagefactory.h
@@ -200,7 +200,7 @@ private:
   ImageFactory();
   ~ImageFactory();
 
-  bool hasImage(const QString& id) const;
+  bool hasImageInMemory(const QString& id) const;
   void releaseImages();
   void emitImageMismatch();
 

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic