]> Some of my projects - localmylist.git/commitdiff
Make anime episode counts more useful.
authorAPTX <marek321@gmail.com>
Tue, 16 Apr 2013 15:40:28 +0000 (17:40 +0200)
committerAPTX <marek321@gmail.com>
Tue, 16 Apr 2013 15:40:28 +0000 (17:40 +0200)
Show how many episodes you have for how many episode the anime has.
Show that the total episode number is unknown and a guess is displayed instead.

Watched episodes are now in relation the amount of episodes in mylist, not the total episode count.

localmylist/mylistnode.cpp
localmylist/mylistnode.h

index d2d43224ff0f6a2e69958c033e5a8a509c1214bc..339778b45f7cc4de0cc80251ab4316a420ee2ffc 100644 (file)
@@ -336,7 +336,13 @@ QVariant MyListAnimeNode::data(int column, int role) const
                                case 0:
                                        return animeData.data.titleRomaji;
                                case 1:
-                                       return watchedEpisodes();
+                                       if (animeData.data.totalEpisodeCount)
+                                               return QString("%1 of %2")
+                                                               .arg(animeData.episodesInMyList).arg(animeData.data.totalEpisodeCount);
+                                       return QString("%1 of (%2)")
+                                                       .arg(animeData.episodesInMyList)
+                                                       .arg(qMax(animeData.data.highestEpno,
+                                                                       animeData.episodesInMyList));
                                case 2:
                                        if (animeData.data.rating < 1)
                                                return "n/a";
@@ -347,7 +353,7 @@ QVariant MyListAnimeNode::data(int column, int role) const
                                        return QString::number(animeData.data.myVote, 'f', 2);
                                case 4:
                                        return QString("%1 of %2").arg(animeData.watchedEpisodes)
-                                                       .arg(watchedEpisodes());
+                                                       .arg(animeData.episodesInMyList);
                        }
                case Qt::ToolTipRole:
                        switch (column)
@@ -366,13 +372,6 @@ QVariant MyListAnimeNode::data(int column, int role) const
        return QVariant();
 }
 
-int MyListAnimeNode::watchedEpisodes() const
-{
-       return qMax(animeData.data.totalEpisodeCount,
-                               qMax(animeData.data.highestEpno,
-                                        animeData.episodesInMyList));
-}
-
 void MyListAnimeNode::fetchMore()
 {
        qDebug() << "fetching some more for aid" << id();
index ecb12f143d801c1bdf5d6c381bd863752b7678e1..ff4319d7e80c4001139abb9471ff282ec695b243 100644 (file)
@@ -110,7 +110,6 @@ public:
        static void fillAnimeData(AnimeData &data, SqlResultIteratorInterface &q);
 
 private:
-       int watchedEpisodes() const;
        AnimeData animeData;
 };