]> Some of my projects - aniplayer2.git/commitdiff
Add MArkStatus to distinguish why a file has been marked/not marked.
authorAPTX <marek321@gmail.com>
Sat, 16 Aug 2014 10:53:54 +0000 (12:53 +0200)
committerAPTX <marek321@gmail.com>
Sat, 16 Aug 2014 10:53:54 +0000 (12:53 +0200)
aniplayer/aniplayer.cpp
aniplayer/aniplayer.h

index ea46629c727cf31613df6ef656899644dbae944d..9079fe1b0bff2d74a48e9bfef220a8ee9eb95829 100644 (file)
@@ -10,7 +10,7 @@
 AniPlayer::AniPlayer(QObject *parent) : QObject(parent), m_state(NoFileLoaded)
 {
        m_automark = 0;
-       marked = false;
+       marked = NotMarked;
 
        LocalMyList::instance()->loadLocalSettings();
 /*     if (!LocalMyList::instance()->database()->connect())
@@ -73,7 +73,7 @@ bool AniPlayer::open(const QString &file)
 
        setState(Stopped);
        m_currentFile = file;
-       marked = false;
+       marked = NotMarked;
        emit currentFileChanged(m_currentFile);
        emit totalTimeChanged(totalTime());
        emit videoSizeChanged(videoSize());
@@ -184,12 +184,18 @@ bool AniPlayer::changeToStream(int i)
 
 void AniPlayer::markWatched()
 {
-       if (marked)
+       if (marked == Marked)
        {
                emit message(tr("File already marked"));
                return;
        }
 
+       if (marked == NotInMyList)
+       {
+               emit message(tr("File not in LocalMyList"));
+               return;
+       }
+
        if (currentFile().isEmpty())
                return;
 
@@ -202,18 +208,20 @@ void AniPlayer::markWatched()
                if (!f.fid)
                {
                        emit message(tr("File not in LocalMyList!"));
+                       marked = NotInMyList;
                        return;
                }
        }
        if (f.myWatched.isValid())
        {
                emit message(tr("File already marked watched"));
+               marked = Marked;
                return;
        }
        MyList::instance()->markWatched(f.fid);
        emit message(tr("Mark watched request submitted to LocalMyList"));
 
-       marked = true;
+       marked = Marked;
 }
 
 void AniPlayer::setAutomark(int mark)
index daad0179cc782a78728d8d48d9e62673f415523e..52d96b642c77cf5b9030d0a74e177565b0fc1771 100644 (file)
@@ -182,7 +182,13 @@ protected:
 
        // LML
        int m_automark;
-       bool marked;
+
+       enum MarkStatus {
+               NotMarked, Marked, NotInMyList
+       };
+
+       MarkStatus marked;
+
 };
 
 #endif // ANIPLAYER_H