summaryrefslogtreecommitdiffstats
path: root/libk9copy/k9dvdtitleset.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-17 00:32:19 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-17 00:32:19 +0000
commit0d382a262c0638d0f572fc37193ccc5ed3dc895f (patch)
tree8578dcddfce4191f3f7a142a37769df7add48475 /libk9copy/k9dvdtitleset.cpp
downloadk9copy-0d382a262c0638d0f572fc37193ccc5ed3dc895f.tar.gz
k9copy-0d382a262c0638d0f572fc37193ccc5ed3dc895f.zip
Added old abandoned version of k9copy
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/k9copy@1091546 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'libk9copy/k9dvdtitleset.cpp')
-rw-r--r--libk9copy/k9dvdtitleset.cpp138
1 files changed, 138 insertions, 0 deletions
diff --git a/libk9copy/k9dvdtitleset.cpp b/libk9copy/k9dvdtitleset.cpp
new file mode 100644
index 0000000..cfa445a
--- /dev/null
+++ b/libk9copy/k9dvdtitleset.cpp
@@ -0,0 +1,138 @@
+//
+// C++ Implementation: k9dvdtitleset
+//
+// Description:
+//
+//
+// Author: Jean-Michel PETIT <[email protected]>, (C) 2006
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+
+#include "k9dvdtitleset.h"
+#include <string.h>
+#include <sys/stat.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <qvaluelist.h>
+
+k9DVDTitleset::k9DVDTitleset( uint _num,uint32_t _size) {
+ m_num=_num;
+ m_size=_size;
+ m_selected=false;
+ m_updating=false;
+ for (uint i=0;i<8;i++)
+ m_audioStreams[i]=false;
+};
+
+
+const QString k9DVDTitleset::getsize_mb()
+{
+ double size_mb=(double)m_size /512;
+ QString c;
+ c.sprintf("%.2f",size_mb);
+ return c;
+}
+
+int k9DVDTitleset::getnum()
+{
+ return m_num;
+}
+
+void k9DVDTitleset::add(k9DVDTitle * _title)
+{
+ titles.append(_title);
+}
+
+int k9DVDTitleset::count()
+{
+ return titles.count();
+}
+
+k9DVDTitle * k9DVDTitleset::gettitle(uint _pos)
+{
+ return titles.at(_pos);
+}
+
+uint32_t k9DVDTitleset::getsize()
+{
+ return m_size;
+}
+
+bool k9DVDTitleset::getselected()
+{
+ return m_selected;
+}
+
+void k9DVDTitleset::setselected(bool _state)
+{
+ // selectionner / d�electionner tous les titres
+ for (int i=0; i<count();i++)
+ {
+ k9DVDTitle *title=titles.at(i);
+ for (int j=0; j <title->getaudioStreamCount();j++)
+ title->getaudioStream(j)->setselected(_state);
+ for (int j=0;j<title->getsubPictureCount();j++)
+ title->getsubtitle(j)->setselected(_state);
+ title->setforceSelection(_state);
+ }
+ m_selected=_state;;
+}
+
+void k9DVDTitleset::updateSelection()
+{
+ if (m_updating)
+ return;
+ m_updating=true;
+
+
+ bool selected=m_selected;
+ m_selected=false;
+ //check if at least on title is selected
+ for (int i=0; i<count() && (!m_selected);i++)
+ {
+ k9DVDTitle *title=titles.at(i);
+ if (title->isSelected() && title->getIndexed())
+ m_selected=true;
+ }
+
+ //if titleset selected, we select all features. otherwise they are unselected
+ if (selected !=m_selected)
+ for (int i=0; i<count();i++)
+ {
+ k9DVDTitle *title=titles.at(i);
+ //FIXED : parts of title selection
+ if (title->getIndexed() && title->isSelected())
+ for (uint iTitle=0;iTitle <title->getTitles().count();iTitle++)
+ {
+ k9DVDTitle *title2=title->getTitles().at(iTitle);
+ for (int j=0; j <title2->getaudioStreamCount();j++)
+ title2->getaudioStream(j)->setselected(title->getaudioStream(j)->getselected());
+ for (int j=0;j<title2->getsubPictureCount();j++)
+ title2->getsubtitle(j)->setselected(title2->getsubtitle(j)->getselected());
+ title2->setforceSelection(true);
+ }
+ }
+ m_updating=false;
+}
+
+void k9DVDTitleset::setAudio(int _id,bool _selected) {
+ m_audioStreams[_id -1]=_selected;
+}
+
+int k9DVDTitleset::getNewAudioStreamId(int _oldId) {
+ int newId=0;
+ //Returns the new stream Id, only if the stream is selected. Otherwise, returns 0
+ if (m_audioStreams[_oldId-1]) {
+/* for (int i=0; i<_oldId;i++) {
+ if (m_audioStreams[i])
+ newId++;
+ }
+*/
+ return _oldId;
+ }
+ return newId;
+}
+