]> Some of my projects - aniplayer-old.git/commitdiff
Fix opening files with single application.
authorAPTX <marek321@gmail.com>
Fri, 30 Oct 2009 12:50:05 +0000 (13:50 +0100)
committerAPTX <marek321@gmail.com>
Fri, 30 Oct 2009 12:50:05 +0000 (13:50 +0100)
src/aniplayer.cpp
src/videowindow.cpp
src/videowindow.h

index 65635de3c76545c74c2b0262a779fdd40decc518..f7d18b31cbdce9fd11380dd3c2f666304ec965ca 100644 (file)
@@ -34,7 +34,7 @@ qDebug() << "handleMessage" << message;
 
        int pos = -1;
        if ((pos = message.indexOf(' ')) != -1)
-               w->play(message.mid(pos));
+               w->play(message.mid(pos + 1));
 }
 
 AniPlayer *AniPlayer::m_instance = 0;
index 38b5ed16ff88a7398aff57b813b345ed0b089836..d9353d2b2d24436959cd7807852d3f34873605ca 100644 (file)
@@ -212,7 +212,7 @@ void VideoWindow::setMenuVisible(bool visible)
        menu->setVisible(visible);
 }
 
-void VideoWindow::open(bool closeOnStop)
+bool VideoWindow::open(bool closeOnStop)
 {
        QString dir;
 
@@ -238,22 +238,23 @@ void VideoWindow::open(bool closeOnStop)
                );
 
        if (file == "")
-               return;
+               return false;
 
 //     open(file, closeOnStop);
        play(file, closeOnStop);
+       return true;
 }
 
-void VideoWindow::open(const QString &file, bool closeOnStop)
+bool VideoWindow::open(const QString &file, bool closeOnStop)
 {
        if (file == "")
-               return;
+               return false;
 
        QFileInfo fileInfo(file);
        if (!fileInfo.exists())
        {
                menu->showMessage(tr("File %1 does not exist").arg(file));
-               return;
+               return false;
        }
 
        playlist->setDirectory(fileInfo.absoluteDir());
@@ -271,6 +272,7 @@ void VideoWindow::open(const QString &file, bool closeOnStop)
        m_closeOnStop = closeOnStop;
 
        updateWindowTitle(fileInfo);
+       return true;
 }
 
 void VideoWindow::openUrl(const QString &urlstr)
@@ -291,7 +293,8 @@ void VideoWindow::play(bool closeOnStop)
 {
        if (videoPlayer->currentSource().type() == Phonon::MediaSource::Invalid)
        {
-               open(closeOnStop);
+               if (!open(closeOnStop))
+                       return;
        }
 
        videoPlayer->play();
index 0a5e03e84f73728c69db10f73e0e73c19c1367fd..f835645579613d7ece93d232d4e88ac559e960bf 100644 (file)
@@ -68,8 +68,8 @@ public slots:
        void toggleMenu();
        void setMenuVisible(bool visible);
 
-       void open(bool closeOnStop = false);
-       void open(const QString &file, bool closeOnStop = false);
+       bool open(bool closeOnStop = false);
+       bool open(const QString &file, bool closeOnStop = false);
        void openUrl(const QString &url);
        void play(bool closeOnStop = false);
        void play(const QString &file, bool closeOnStop = false);