]> Some of my projects - aniplayer-old.git/commitdiff
- Some cleanup.
authorunknown <APTX@.(none)>
Sat, 28 Mar 2009 11:36:26 +0000 (12:36 +0100)
committerunknown <APTX@.(none)>
Sat, 28 Mar 2009 11:36:26 +0000 (12:36 +0100)
lib/anidbudpclient/mylistaddcommand.cpp
src/videowindow.cpp
src/videowindow.h

index e8fa659b327accd1b70b36d3b93281aa636b267c..8f687eb4a2beac8f8fe6f206e0944fc984ddef51 100644 (file)
@@ -4,6 +4,7 @@
 #include <QCryptographicHash>
 #include <QtConcurrentRun>
 #include <QStringList>
+#include <QThread>
 
 #include "anidbudpclient.h"
 
@@ -143,6 +144,8 @@ qDebug() << "WTF?";
 QByteArray MylistAddCommand::doHash(QString file)
 {
 qDebug() << "hash thread init";
+       QThread::currentThread()->setPriority(QThread::LowPriority);
+
        QFile f(file);
        if (!f.open(QIODevice::ReadOnly))
                return QByteArray();
index 244c660f30cbe3bd028be2cf6210fa5eb2ef8a2a..8cb21be159aea8e5312daedf52d30d778f9db817 100644 (file)
@@ -39,7 +39,7 @@ VideoWindow::VideoWindow(QWidget *parent) : QMainWindow(parent)
 
        addCommand = 0;
        destroyed = menuMoving = windowMoving = m_closeOnStop = false;
-       m_automarked = true;
+       m_marked = true;
        m_automark = 0;
        m_currentFile = "";
 
@@ -410,11 +410,11 @@ qDebug() << "Media changed state from" << oldstate << "to" << newstate;
                        if (!isFullScreen())
                                resizeToVideo();
 #endif
-                       if (addCommand)
+                       if (!m_marked)
                                addCommand->deleteLater();
 
                        addCommand = new MylistAddCommand(m_currentFile, this);
-                       m_automarked = false;
+                       m_marked = false;
                break;
                case Phonon::PlayingState:
                        if (newstate == Phonon::PausedState && mediaObject->remainingTime() == 0)
@@ -428,7 +428,7 @@ void VideoWindow::tick(qint64 time)
 {
        menu->tick(time);
 
-       if (!m_automark || m_automarked)
+       if (!m_automark || m_marked)
                return;
 
        int percentPlayed = int(double(time) / double(mediaObject->totalTime()) * double(100));
@@ -436,7 +436,7 @@ void VideoWindow::tick(qint64 time)
                return;
 
        markWatched();
-       m_automarked = true;
+       m_marked = true;
 }
 
 void VideoWindow::updateChapters()
@@ -572,13 +572,14 @@ void VideoWindow::moveWithMenu()
 
 void VideoWindow::markWatched()
 {
-       if (!addCommand)
+       if (m_marked)
        {
                menu->showMessage("File already Marked");
                return;
        }
        menu->showMessage("Hashing file");
 
+       m_marked = true;
        connect(addCommand, SIGNAL(hashComplete()), this, SLOT(doMarkWatched()));
        addCommand->setMarkWatched(true);
 qDebug() << "hashing file...";
index 83dee8950b239978b4a1289ed5bbe382b4e5e104..18d80ec3a8573c7a6e9cc07c7497ce1665a55dba 100644 (file)
@@ -159,7 +159,7 @@ private:
        bool m_closeOnStop;
 
        int m_automark;
-       bool m_automarked;
+       bool m_marked;
 
        DirectoryPlaylist *playlist;
        AniDBUdpClient *anidb;