summaryrefslogtreecommitdiffstats
path: root/k9author
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 /k9author
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 'k9author')
-rw-r--r--k9author/Makefile.am18
-rw-r--r--k9author/chapterEdit.cpp212
-rw-r--r--k9author/chapterEdit.ui359
-rw-r--r--k9author/import.cpp130
-rw-r--r--k9author/import.ui207
-rw-r--r--k9author/k9avidecode.cpp265
-rw-r--r--k9author/k9avidecode.h112
-rw-r--r--k9author/k9avifile.cpp185
-rw-r--r--k9author/k9avifile.h80
-rw-r--r--k9author/k9canvasselection.cpp330
-rw-r--r--k9author/k9canvasselection.h71
-rw-r--r--k9author/k9chapteredit.cpp200
-rw-r--r--k9author/k9chapteredit.h60
-rw-r--r--k9author/k9import.cpp250
-rw-r--r--k9author/k9import.h79
-rw-r--r--k9author/k9importfiles.cpp52
-rw-r--r--k9author/k9importfiles.h42
-rw-r--r--k9author/k9lvitemimport.cpp54
-rw-r--r--k9author/k9lvitemimport.h43
-rw-r--r--k9author/k9menu.cpp333
-rw-r--r--k9author/k9menu.h71
-rw-r--r--k9author/k9menubutton.cpp296
-rw-r--r--k9author/k9menubutton.h116
-rw-r--r--k9author/k9menuedit.cpp319
-rw-r--r--k9author/k9menuedit.h85
-rw-r--r--k9author/k9menueditor.cpp237
-rw-r--r--k9author/k9menueditor.h64
-rw-r--r--k9author/k9newdvd.cpp439
-rw-r--r--k9author/k9newdvd.h95
-rw-r--r--k9author/k9newtitle.cpp171
-rw-r--r--k9author/k9newtitle.h52
-rw-r--r--k9author/k9title.cpp64
-rw-r--r--k9author/k9title.h57
-rw-r--r--k9author/menuEdit.cpp211
-rw-r--r--k9author/menuEdit.ui342
-rw-r--r--k9author/newTitle.cpp158
-rw-r--r--k9author/newTitle.ui284
37 files changed, 6143 insertions, 0 deletions
diff --git a/k9author/Makefile.am b/k9author/Makefile.am
new file mode 100644
index 0000000..afe0945
--- /dev/null
+++ b/k9author/Makefile.am
@@ -0,0 +1,18 @@
+AM_CPPFLAGS= -I$(srcdir) $(all_includes)
+
+KDE_CXXFLAGS = $(ENABLE_PERMISSIVE_FLAG)
+
+METASOURCES = AUTO
+
+noinst_LTLIBRARIES = libk9author.la
+libk9author_la_LDFLAGS = $(all_libraries)
+libk9author_la_SOURCES = chapterEdit.ui import.ui k9avidecode.cpp k9avifile.cpp \
+ k9canvasselection.cpp k9chapteredit.cpp k9import.cpp k9importfiles.cpp k9lvitemimport.cpp \
+ k9menu.cpp k9menubutton.cpp k9menuedit.cpp k9menueditor.cpp k9newdvd.cpp \
+ k9newtitle.cpp k9title.cpp menuEdit.ui newTitle.ui
+noinst_HEADERS = k9avidecode.h k9avifile.h k9canvasselection.h k9chapteredit.h \
+ k9import.h k9importfiles.h k9lvitemimport.h k9menu.h k9menubutton.h k9menuedit.h \
+ k9menueditor.h k9newdvd.h k9newtitle.h k9title.h
+libk9author_la_LIBADD = $(top_builddir)/libk9copy/libk9copy.la $(LIB_KDEUI)
+INCLUDES = -I$(top_srcdir)/dvdread -I$(top_srcdir)/k9devices \
+ -I$(top_srcdir)/k9vamps -I$(top_srcdir)/libk9copy -I$(top_srcdir)/src $(all_includes)
diff --git a/k9author/chapterEdit.cpp b/k9author/chapterEdit.cpp
new file mode 100644
index 0000000..d344b5e
--- /dev/null
+++ b/k9author/chapterEdit.cpp
@@ -0,0 +1,212 @@
+#include <klocale.h>
+/****************************************************************************
+** Form implementation generated from reading ui file './chapterEdit.ui'
+**
+** Created: dim. oct. 26 08:56:28 2008
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+
+#include "chapterEdit.h"
+
+#include <qvariant.h>
+#include <qpushbutton.h>
+#include <ktimewidget.h>
+#include <qlabel.h>
+#include <kurlrequester.h>
+#include <kpushbutton.h>
+#include <qcheckbox.h>
+#include <qslider.h>
+#include <qlayout.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+#include "ktimewidget.h"
+#include "kurlrequester.h"
+#include "klineedit.h"
+#include "kpushbutton.h"
+
+/*
+ * Constructs a chapterEdit as a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'.
+ */
+chapterEdit::chapterEdit( QWidget* parent, const char* name, WFlags fl )
+ : QWidget( parent, name, fl )
+{
+ if ( !name )
+ setName( "chapterEdit" );
+ setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, sizePolicy().hasHeightForWidth() ) );
+ chapterEditLayout = new QGridLayout( this, 1, 1, 11, 6, "chapterEditLayout");
+
+ twstart = new KTimeWidget( this, "twstart" );
+ twstart->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, twstart->sizePolicy().hasHeightForWidth() ) );
+
+ chapterEditLayout->addWidget( twstart, 1, 2 );
+
+ textLabel1 = new QLabel( this, "textLabel1" );
+
+ chapterEditLayout->addWidget( textLabel1, 1, 1 );
+
+ textLabel3 = new QLabel( this, "textLabel3" );
+
+ chapterEditLayout->addWidget( textLabel3, 0, 1 );
+
+ urFile = new KURLRequester( this, "urFile" );
+ urFile->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)5, 0, 0, urFile->sizePolicy().hasHeightForWidth() ) );
+ urFile->setMinimumSize( QSize( 200, 0 ) );
+
+ chapterEditLayout->addMultiCellWidget( urFile, 0, 0, 2, 4 );
+
+ bStart = new KPushButton( this, "bStart" );
+ bStart->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, bStart->sizePolicy().hasHeightForWidth() ) );
+
+ chapterEditLayout->addWidget( bStart, 1, 3 );
+ spacer2 = new QSpacerItem( 16, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ chapterEditLayout->addMultiCell( spacer2, 1, 2, 4, 4 );
+
+ ckBreakStart = new QCheckBox( this, "ckBreakStart" );
+
+ chapterEditLayout->addMultiCellWidget( ckBreakStart, 2, 2, 2, 3 );
+ spacer1 = new QSpacerItem( 21, 60, QSizePolicy::Minimum, QSizePolicy::Expanding );
+ chapterEditLayout->addItem( spacer1, 6, 2 );
+
+ textLabel2 = new QLabel( this, "textLabel2" );
+
+ chapterEditLayout->addWidget( textLabel2, 4, 1 );
+
+ ckBreakEnd = new QCheckBox( this, "ckBreakEnd" );
+
+ chapterEditLayout->addMultiCellWidget( ckBreakEnd, 5, 5, 2, 3 );
+
+ twend = new KTimeWidget( this, "twend" );
+ twend->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, twend->sizePolicy().hasHeightForWidth() ) );
+
+ chapterEditLayout->addWidget( twend, 4, 2 );
+ spacer3 = new QSpacerItem( 20, 31, QSizePolicy::Minimum, QSizePolicy::Fixed );
+ chapterEditLayout->addItem( spacer3, 3, 2 );
+
+ layout3 = new QGridLayout( 0, 1, 1, 0, 6, "layout3");
+
+ lPosition = new QLabel( this, "lPosition" );
+ lPosition->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, lPosition->sizePolicy().hasHeightForWidth() ) );
+
+ layout3->addWidget( lPosition, 1, 1 );
+
+ slider = new QSlider( this, "slider" );
+ slider->setOrientation( QSlider::Horizontal );
+
+ layout3->addWidget( slider, 1, 0 );
+
+ image = new QLabel( this, "image" );
+ image->setMinimumSize( QSize( 320, 200 ) );
+ image->setPaletteBackgroundColor( QColor( 0, 0, 0 ) );
+ image->setScaledContents( TRUE );
+
+ layout3->addMultiCellWidget( image, 0, 0, 0, 1 );
+
+ chapterEditLayout->addMultiCellLayout( layout3, 0, 6, 0, 0 );
+
+ bEnd = new KPushButton( this, "bEnd" );
+ bEnd->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, bEnd->sizePolicy().hasHeightForWidth() ) );
+
+ chapterEditLayout->addWidget( bEnd, 4, 3 );
+
+ bTitleButton = new QPushButton( this, "bTitleButton" );
+ bTitleButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, bTitleButton->sizePolicy().hasHeightForWidth() ) );
+
+ chapterEditLayout->addWidget( bTitleButton, 7, 0 );
+ languageChange();
+ resize( QSize(627, 300).expandedTo(minimumSizeHint()) );
+ clearWState( WState_Polished );
+
+ // signals and slots connections
+ connect( urFile, SIGNAL( urlSelected(const QString&) ), this, SLOT( urlSelected(const QString&) ) );
+ connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
+ connect( slider, SIGNAL( valueChanged(int) ), this, SLOT( sliderChanged() ) );
+ connect( bStart, SIGNAL( clicked() ), this, SLOT( bStartClick() ) );
+ connect( bEnd, SIGNAL( clicked() ), this, SLOT( bEndClick() ) );
+ connect( twstart, SIGNAL( valueChanged(const QTime&) ), this, SLOT( startChanged(const QTime&) ) );
+ connect( twend, SIGNAL( valueChanged(const QTime&) ), this, SLOT( endChanged(const QTime&) ) );
+ connect( ckBreakEnd, SIGNAL( clicked() ), this, SLOT( ckBreakEndClick() ) );
+ connect( ckBreakStart, SIGNAL( clicked() ), this, SLOT( ckBreakStartClick() ) );
+ connect( bTitleButton, SIGNAL( clicked() ), this, SLOT( bTitleButtonClick() ) );
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+chapterEdit::~chapterEdit()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ * Sets the strings of the subwidgets using the current
+ * language.
+ */
+void chapterEdit::languageChange()
+{
+ setCaption( tr2i18n( "Chapter properties" ) );
+ textLabel1->setText( tr2i18n( "start" ) );
+ textLabel3->setText( tr2i18n( "video" ) );
+ urFile->setFilter( tr2i18n( "*.avi\n"
+"*.mpeg" ) );
+ bStart->setText( tr2i18n( "set Current Frame" ) );
+ ckBreakStart->setText( tr2i18n( "break continuity" ) );
+ textLabel2->setText( tr2i18n( "end" ) );
+ ckBreakEnd->setText( tr2i18n( "break continuity" ) );
+ lPosition->setText( tr2i18n( "--:--:--" ) );
+ bEnd->setText( tr2i18n( "set Current Frame" ) );
+ bTitleButton->setText( tr2i18n( "set Title button" ) );
+}
+
+void chapterEdit::urlSelected(const QString&)
+{
+ qWarning( "chapterEdit::urlSelected(const QString&): Not implemented yet" );
+}
+
+void chapterEdit::sliderReleased()
+{
+ qWarning( "chapterEdit::sliderReleased(): Not implemented yet" );
+}
+
+void chapterEdit::sliderChanged()
+{
+ qWarning( "chapterEdit::sliderChanged(): Not implemented yet" );
+}
+
+void chapterEdit::bStartClick()
+{
+ qWarning( "chapterEdit::bStartClick(): Not implemented yet" );
+}
+
+void chapterEdit::startChanged(const QTime&)
+{
+ qWarning( "chapterEdit::startChanged(const QTime&): Not implemented yet" );
+}
+
+void chapterEdit::endChanged(const QTime&)
+{
+ qWarning( "chapterEdit::endChanged(const QTime&): Not implemented yet" );
+}
+
+void chapterEdit::bEndClick()
+{
+ qWarning( "chapterEdit::bEndClick(): Not implemented yet" );
+}
+
+void chapterEdit::ckBreakStartClick()
+{
+ qWarning( "chapterEdit::ckBreakStartClick(): Not implemented yet" );
+}
+
+void chapterEdit::ckBreakEndClick()
+{
+ qWarning( "chapterEdit::ckBreakEndClick(): Not implemented yet" );
+}
+
+void chapterEdit::bTitleButtonClick()
+{
+ qWarning( "chapterEdit::bTitleButtonClick(): Not implemented yet" );
+}
+
+#include "chapterEdit.moc"
diff --git a/k9author/chapterEdit.ui b/k9author/chapterEdit.ui
new file mode 100644
index 0000000..d61622b
--- /dev/null
+++ b/k9author/chapterEdit.ui
@@ -0,0 +1,359 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>chapterEdit</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>chapterEdit</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>627</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="caption">
+ <string>Chapter properties</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KTimeWidget" row="1" column="2">
+ <property name="name">
+ <cstring>twstart</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="1">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>start</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="1">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>video</string>
+ </property>
+ </widget>
+ <widget class="KURLRequester" row="0" column="2" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>urFile</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>200</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="filter">
+ <string>*.avi
+*.mpeg</string>
+ </property>
+ </widget>
+ <widget class="KPushButton" row="1" column="3">
+ <property name="name">
+ <cstring>bStart</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>set Current Frame</string>
+ </property>
+ </widget>
+ <spacer row="1" column="4" rowspan="2" colspan="1">
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>16</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QCheckBox" row="2" column="2" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>ckBreakStart</cstring>
+ </property>
+ <property name="text">
+ <string>break continuity</string>
+ </property>
+ </widget>
+ <spacer row="6" column="2">
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>21</width>
+ <height>60</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel" row="4" column="1">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>end</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="5" column="2" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>ckBreakEnd</cstring>
+ </property>
+ <property name="text">
+ <string>break continuity</string>
+ </property>
+ </widget>
+ <widget class="KTimeWidget" row="4" column="2">
+ <property name="name">
+ <cstring>twend</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <spacer row="3" column="2">
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>31</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget" row="0" column="0" rowspan="7" colspan="1">
+ <property name="name">
+ <cstring>layout3</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="1" column="1">
+ <property name="name">
+ <cstring>lPosition</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>--:--:--</string>
+ </property>
+ </widget>
+ <widget class="QSlider" row="1" column="0">
+ <property name="name">
+ <cstring>slider</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>image</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>320</width>
+ <height>200</height>
+ </size>
+ </property>
+ <property name="paletteBackgroundColor">
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </property>
+ <property name="scaledContents">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="KPushButton" row="4" column="3">
+ <property name="name">
+ <cstring>bEnd</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>set Current Frame</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="7" column="0">
+ <property name="name">
+ <cstring>bTitleButton</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>set Title button</string>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>urFile</sender>
+ <signal>urlSelected(const QString&amp;)</signal>
+ <receiver>chapterEdit</receiver>
+ <slot>urlSelected(const QString&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>slider</sender>
+ <signal>sliderReleased()</signal>
+ <receiver>chapterEdit</receiver>
+ <slot>sliderReleased()</slot>
+ </connection>
+ <connection>
+ <sender>slider</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>chapterEdit</receiver>
+ <slot>sliderChanged()</slot>
+ </connection>
+ <connection>
+ <sender>bStart</sender>
+ <signal>clicked()</signal>
+ <receiver>chapterEdit</receiver>
+ <slot>bStartClick()</slot>
+ </connection>
+ <connection>
+ <sender>bEnd</sender>
+ <signal>clicked()</signal>
+ <receiver>chapterEdit</receiver>
+ <slot>bEndClick()</slot>
+ </connection>
+ <connection>
+ <sender>twstart</sender>
+ <signal>valueChanged(const QTime&amp;)</signal>
+ <receiver>chapterEdit</receiver>
+ <slot>startChanged(const QTime&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>twend</sender>
+ <signal>valueChanged(const QTime&amp;)</signal>
+ <receiver>chapterEdit</receiver>
+ <slot>endChanged(const QTime&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>ckBreakEnd</sender>
+ <signal>clicked()</signal>
+ <receiver>chapterEdit</receiver>
+ <slot>ckBreakEndClick()</slot>
+ </connection>
+ <connection>
+ <sender>ckBreakStart</sender>
+ <signal>clicked()</signal>
+ <receiver>chapterEdit</receiver>
+ <slot>ckBreakStartClick()</slot>
+ </connection>
+ <connection>
+ <sender>bTitleButton</sender>
+ <signal>clicked()</signal>
+ <receiver>chapterEdit</receiver>
+ <slot>bTitleButtonClick()</slot>
+ </connection>
+</connections>
+<slots>
+ <slot>urlSelected( const QString &amp;)</slot>
+ <slot>sliderReleased()</slot>
+ <slot>sliderChanged()</slot>
+ <slot>bStartClick()</slot>
+ <slot>startChanged(const QTime &amp;)</slot>
+ <slot>endChanged(const QTime &amp;)</slot>
+ <slot>bEndClick()</slot>
+ <slot>ckBreakStartClick()</slot>
+ <slot>ckBreakEndClick()</slot>
+ <slot>bTitleButtonClick()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>ktimewidget.h</includehint>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>ktimewidget.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/k9author/import.cpp b/k9author/import.cpp
new file mode 100644
index 0000000..b81705a
--- /dev/null
+++ b/k9author/import.cpp
@@ -0,0 +1,130 @@
+#include <klocale.h>
+/****************************************************************************
+** Form implementation generated from reading ui file './import.ui'
+**
+** Created: dim. oct. 26 08:56:28 2008
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+
+#include "import.h"
+
+#include <qvariant.h>
+#include <qpushbutton.h>
+#include <qlabel.h>
+#include <qheader.h>
+#include <qlistview.h>
+#include <kcombobox.h>
+#include <qcombobox.h>
+#include <kselect.h>
+#include <qlayout.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+#include "kcombobox.h"
+#include "kselect.h"
+
+/*
+ * Constructs a import as a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'.
+ */
+import::import( QWidget* parent, const char* name, WFlags fl )
+ : QWidget( parent, name, fl )
+{
+ if ( !name )
+ setName( "import" );
+ importLayout = new QGridLayout( this, 1, 1, 11, 6, "importLayout");
+
+ textLabel1 = new QLabel( this, "textLabel1" );
+ textLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)5, 0, 0, textLabel1->sizePolicy().hasHeightForWidth() ) );
+
+ importLayout->addWidget( textLabel1, 0, 0 );
+
+ layout2 = new QGridLayout( 0, 1, 1, 0, 6, "layout2");
+
+ lvDVD = new QListView( this, "lvDVD" );
+ lvDVD->addColumn( tr2i18n( "Video files" ) );
+ lvDVD->header()->setClickEnabled( FALSE, lvDVD->header()->count() - 1 );
+ lvDVD->addColumn( tr2i18n( "..." ) );
+ lvDVD->header()->setClickEnabled( FALSE, lvDVD->header()->count() - 1 );
+ lvDVD->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, lvDVD->sizePolicy().hasHeightForWidth() ) );
+ lvDVD->setMinimumSize( QSize( 0, 200 ) );
+ lvDVD->setRootIsDecorated( FALSE );
+ lvDVD->setResizeMode( QListView::AllColumns );
+
+ layout2->addMultiCellWidget( lvDVD, 0, 1, 0, 0 );
+
+ importLayout->addMultiCellLayout( layout2, 1, 1, 0, 3 );
+
+ cbOutputDev = new KComboBox( FALSE, this, "cbOutputDev" );
+
+ importLayout->addWidget( cbOutputDev, 0, 1 );
+
+ cbFormat = new QComboBox( FALSE, this, "cbFormat" );
+ cbFormat->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, cbFormat->sizePolicy().hasHeightForWidth() ) );
+
+ importLayout->addWidget( cbFormat, 0, 2 );
+
+ lTotal = new QLabel( this, "lTotal" );
+ lTotal->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, lTotal->sizePolicy().hasHeightForWidth() ) );
+
+ importLayout->addWidget( lTotal, 2, 3 );
+
+ gsTotal = new KGradientSelector( this, "gsTotal" );
+ gsTotal->setEnabled( FALSE );
+ gsTotal->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, gsTotal->sizePolicy().hasHeightForWidth() ) );
+ gsTotal->setMaximumSize( QSize( 32767, 13 ) );
+ gsTotal->setValue( 0 );
+ gsTotal->setMaxValue( 180 );
+ gsTotal->setFirstColor( QColor( 255, 77, 6 ) );
+ gsTotal->setSecondColor( QColor( 85, 255, 0 ) );
+
+ importLayout->addMultiCellWidget( gsTotal, 2, 2, 0, 2 );
+ languageChange();
+ resize( QSize(524, 416).expandedTo(minimumSizeHint()) );
+ clearWState( WState_Polished );
+
+ // signals and slots connections
+ connect( lvDVD, SIGNAL( selectionChanged(QListViewItem*) ), this, SLOT( lvDVDItemSelected(QListViewItem*) ) );
+ connect( cbFormat, SIGNAL( activated(const QString&) ), this, SLOT( cbFormatActivated(const QString&) ) );
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+import::~import()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ * Sets the strings of the subwidgets using the current
+ * language.
+ */
+void import::languageChange()
+{
+ setCaption( tr2i18n( "import" ) );
+ textLabel1->setText( tr2i18n( "Output" ) );
+ lvDVD->header()->setLabel( 0, tr2i18n( "Video files" ) );
+ lvDVD->header()->setLabel( 1, tr2i18n( "..." ) );
+ cbFormat->clear();
+ cbFormat->insertItem( tr2i18n( "PAL" ) );
+ cbFormat->insertItem( tr2i18n( "NTSC" ) );
+ lTotal->setText( tr2i18n( "--:--:--" ) );
+}
+
+void import::lvDVDItemSelected(QListViewItem*)
+{
+ qWarning( "import::lvDVDItemSelected(QListViewItem*): Not implemented yet" );
+}
+
+void import::bAddClick()
+{
+ qWarning( "import::bAddClick(): Not implemented yet" );
+}
+
+void import::cbFormatActivated(const QString&)
+{
+ qWarning( "import::cbFormatActivated(const QString&): Not implemented yet" );
+}
+
+#include "import.moc"
diff --git a/k9author/import.ui b/k9author/import.ui
new file mode 100644
index 0000000..fc42a9e
--- /dev/null
+++ b/k9author/import.ui
@@ -0,0 +1,207 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>import</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>import</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>524</width>
+ <height>416</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>import</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Output</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="1" column="0" rowspan="1" colspan="4">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QListView" row="0" column="0" rowspan="2" colspan="1">
+ <column>
+ <property name="text">
+ <string>Video files</string>
+ </property>
+ <property name="clickable">
+ <bool>false</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>...</string>
+ </property>
+ <property name="clickable">
+ <bool>false</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>lvDVD</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>200</height>
+ </size>
+ </property>
+ <property name="rootIsDecorated">
+ <bool>false</bool>
+ </property>
+ <property name="resizeMode">
+ <enum>AllColumns</enum>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="KComboBox" row="0" column="1">
+ <property name="name">
+ <cstring>cbOutputDev</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="0" column="2">
+ <item>
+ <property name="text">
+ <string>PAL</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>NTSC</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>cbFormat</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="3">
+ <property name="name">
+ <cstring>lTotal</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>--:--:--</string>
+ </property>
+ </widget>
+ <widget class="KGradientSelector" row="2" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>gsTotal</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>13</height>
+ </size>
+ </property>
+ <property name="value">
+ <number>0</number>
+ </property>
+ <property name="maxValue">
+ <number>180</number>
+ </property>
+ <property name="firstColor">
+ <color>
+ <red>255</red>
+ <green>77</green>
+ <blue>6</blue>
+ </color>
+ </property>
+ <property name="secondColor">
+ <color>
+ <red>85</red>
+ <green>255</green>
+ <blue>0</blue>
+ </color>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>lvDVD</sender>
+ <signal>selectionChanged(QListViewItem*)</signal>
+ <receiver>import</receiver>
+ <slot>lvDVDItemSelected(QListViewItem*)</slot>
+ </connection>
+ <connection>
+ <sender>cbFormat</sender>
+ <signal>activated(const QString&amp;)</signal>
+ <receiver>import</receiver>
+ <slot>cbFormatActivated(const QString&amp;)</slot>
+ </connection>
+</connections>
+<slots>
+ <slot>lvDVDItemSelected(QListViewItem *)</slot>
+ <slot>bAddClick()</slot>
+ <slot>cbFormatActivated(const QString &amp;)</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kcombobox.h</includehint>
+ <includehint>kselect.h</includehint>
+</includehints>
+</UI>
diff --git a/k9author/k9avidecode.cpp b/k9author/k9avidecode.cpp
new file mode 100644
index 0000000..1ef120d
--- /dev/null
+++ b/k9author/k9avidecode.cpp
@@ -0,0 +1,265 @@
+//
+// C++ Implementation: k9avidecode
+//
+// Description:
+//
+//
+// Author: Jean-Michel PETIT <k9copy@free.fr>, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#include "k9avidecode.h"
+
+#ifdef OLD_FFMPEG
+#include <ffmpeg/avcodec.h>
+#endif
+#ifdef NEW_FFMPEG
+#include <libavcodec/avcodec.h>
+#endif
+
+#include <qimage.h>
+#include <dlfcn.h>
+#include <klocale.h>
+#include <cstdlib>
+#include "ac.h"
+
+void *CodecHandle=0;
+void *FormatHandle=0;
+int glibref=0;
+
+k9AviDecode::k9AviDecode(QObject *parent, const char *name)
+ : QObject(parent, name) {
+ if (glibref==0) {
+ CodecHandle=dlopen("libavcodec.so",RTLD_LAZY | RTLD_GLOBAL);
+ FormatHandle=dlopen("libavformat.so",RTLD_LAZY | RTLD_GLOBAL);
+ }
+ if (!CodecHandle) {
+ m_error =i18n("Cannot open then library %1").arg("libavcodec");
+ return;
+ }
+ if (!FormatHandle) {
+ m_error =i18n("Cannot open then library %1").arg("libavformat");
+ return;
+ }
+ m_error="";
+ av_register_all = (av_register_all_t)dlsym(FormatHandle,"av_register_all");
+ av_open_input_file = (av_open_input_file_t)dlsym(FormatHandle,"av_open_input_file");
+ av_find_stream_info = (av_find_stream_info_t)dlsym(FormatHandle,"av_find_stream_info");
+ avcodec_find_decoder =(avcodec_find_decoder_t) dlsym(CodecHandle,"avcodec_find_decoder");
+ avcodec_open = (avcodec_open_t)dlsym(CodecHandle,"avcodec_open");
+ avcodec_alloc_frame = (avcodec_alloc_frame_t)dlsym(CodecHandle,"avcodec_alloc_frame");
+ avpicture_get_size = (avpicture_get_size_t)dlsym(CodecHandle,"avpicture_get_size");
+ av_malloc = (av_malloc_t)dlsym(CodecHandle,"av_malloc");
+ avpicture_fill = (avpicture_fill_t)dlsym(CodecHandle,"avpicture_fill");
+ av_read_frame = (av_read_frame_t)dlsym(FormatHandle,"av_read_frame");
+ avcodec_decode_video = (avcodec_decode_video_t)dlsym(CodecHandle,"avcodec_decode_video");
+ img_convert = (img_convert_t)dlsym(CodecHandle,"img_convert");
+ av_free = (av_free_t)dlsym(CodecHandle,"av_free");
+ avcodec_close = (avcodec_close_t)dlsym(FormatHandle,"avcodec_close");
+ av_close_input_file = (av_close_input_file_t)dlsym(FormatHandle,"av_close_input_file");
+ av_seek_frame=(av_seek_frame_t)dlsym(FormatHandle,"av_seek_frame");
+ av_rescale_q=(av_rescale_q_t)dlsym(FormatHandle,"av_rescale_q");
+ avcodec_flush_buffers=(avcodec_flush_buffers_t)dlsym(CodecHandle,"avcodec_flush_buffers");
+
+ av_gettime=(av_gettime_t)dlsym(FormatHandle,"av_gettime");
+ av_register_all();
+ m_opened=false;
+
+ glibref++;
+}
+
+
+k9AviDecode::~k9AviDecode() {
+ if (m_opened)
+ close();
+ glibref--;
+ if (glibref==0) {
+ dlclose(FormatHandle);
+ dlclose(CodecHandle);
+ }
+
+}
+
+
+#include "k9avidecode.moc"
+
+
+bool k9AviDecode::open(const QString & _fileName) {
+ m_error="";
+ if (m_opened)
+ close();
+
+ // Open video file
+ if (av_open_input_file(&m_FormatCtx, _fileName.utf8(), NULL, 0, NULL)!=0) {
+ m_error=i18n("Couldn't open the file %1").arg(_fileName);
+ return false; // Couldn't open file}
+ }
+// Retrieve stream information
+ if (av_find_stream_info(m_FormatCtx)<0) {
+ m_error =i18n("Couldn't find stream information");
+ return false; // Couldn't find stream information
+ }
+ int i;
+
+// Find the first video stream
+ m_videoStream=-1;
+ for (i=0; i<m_FormatCtx->nb_streams; i++)
+ if (m_FormatCtx->streams[i]->codec->codec_type==CODEC_TYPE_VIDEO) {
+ m_videoStream=i;
+ break;
+ }
+ if (m_videoStream==-1) {
+ m_error=i18n("The file doesn't contain any video stream");
+ return false; // Didn't find a video stream
+ }
+
+ // Get a pointer to the codec context for the video stream
+ m_CodecCtx=m_FormatCtx->streams[m_videoStream]->codec;
+
+
+// Find the decoder for the video stream
+ m_Codec=avcodec_find_decoder(m_CodecCtx->codec_id);
+ if (m_Codec==NULL) {
+ m_error=i18n("Unsupported codec");
+ return false; // Codec not found
+ }
+// Open codec
+ if (avcodec_open(m_CodecCtx, m_Codec)<0) {
+ m_error =i18n("Could'nt open the codec");
+ return false; // Could not open codec
+ }
+
+
+// Allocate video frame
+ m_Frame=avcodec_alloc_frame();
+
+// Allocate an AVFrame structure
+ m_FrameRGB=avcodec_alloc_frame();
+ if (m_FrameRGB==NULL) {
+ m_error =i18n ("Unable to allocate memory for frames");
+ return false;
+ }
+
+
+ int numBytes;
+// Determine required buffer size and allocate buffer
+ numBytes=avpicture_get_size(PIX_FMT_RGB24, m_CodecCtx->width,
+ m_CodecCtx->height);
+ m_buffer=(uint8_t *)av_malloc(numBytes*sizeof(uint8_t));
+
+// Assign appropriate parts of buffer to image planes in pFrameRGB
+// Note that pFrameRGB is an AVFrame, but AVFrame is a superset
+// of AVPicture
+ avpicture_fill((AVPicture *)m_FrameRGB, m_buffer, PIX_FMT_RGB24,
+ m_CodecCtx->width, m_CodecCtx->height);
+
+ m_duration=(double)m_FormatCtx->duration / AV_TIME_BASE;
+ m_opened=true;
+ m_fileName=_fileName;
+ return true;
+}
+
+void k9AviDecode::seek(double _seconds) {
+ AVRational time_base = m_FormatCtx->streams[m_videoStream]->time_base;
+ int64_t fspos = (int64_t)(_seconds * AV_TIME_BASE);
+ fspos=av_rescale_q(fspos, AV_TIME_BASE_Q, time_base);
+ int i=av_seek_frame(m_FormatCtx, m_videoStream, fspos, AVSEEK_FLAG_BACKWARD );
+ double pos=av_gettime() / 1000000;
+}
+
+void k9AviDecode::readFrame(double _seconds) {
+ AVRational time_base = m_FormatCtx->streams[m_videoStream]->time_base;
+ int64_t fspos = (int64_t)(_seconds * AV_TIME_BASE);
+ fspos=av_rescale_q(fspos, AV_TIME_BASE_Q, time_base);
+ int res=av_seek_frame(m_FormatCtx, m_videoStream, fspos, AVSEEK_FLAG_BACKWARD );
+ avcodec_flush_buffers(m_CodecCtx);
+ int frameFinished=0;
+ AVPacket packet;
+
+ bool bFound=false;
+ while (av_read_frame(m_FormatCtx, &packet)>=0 && !bFound) {
+ // Is this a packet from the video stream?
+ if (packet.stream_index==m_videoStream) {
+ // Decode video frame
+ avcodec_decode_video(m_CodecCtx, m_Frame, &frameFinished,
+ packet.data, packet.size);
+
+ // Did we get a video frame?
+ if (frameFinished) {
+// if (m_Frame->pts >=fspos)
+ int64_t cur_dts=fspos;
+ if (m_FormatCtx->cur_st)
+ cur_dts= m_FormatCtx->cur_st->cur_dts;
+ if (cur_dts >=fspos) {
+ bFound=true;
+ // Convert the image from its native format to RGB
+ img_convert((AVPicture *)m_FrameRGB, PIX_FMT_RGB24,
+ (AVPicture*)m_Frame, m_CodecCtx->pix_fmt,
+ m_CodecCtx->width, m_CodecCtx->height);
+
+ // convert frame to QImage
+ SaveFrame(m_FrameRGB, m_CodecCtx->width,
+ m_CodecCtx->height);
+ }
+ }
+ }
+
+ // Free the packet that was allocated by av_read_frame
+ av_free_packet(&packet);
+ }
+
+}
+
+void k9AviDecode::SaveFrame(AVFrame *pFrame, int width, int height) {
+ QImage pix;
+ int len =(int) (3*width*height);
+ char c[255];
+ // Write header
+ sprintf(c,"P6\n%d %d\n255\n", width, height);
+ char *s= (char*) malloc(len+strlen(c));
+ tc_memcpy(s,c,strlen(c));
+ tc_memcpy(s+strlen(c),pFrame->data[0], len);
+ pix.loadFromData((uchar*)s,strlen(c)+len);
+ free(s);
+ emit drawFrame( &pix);
+
+}
+
+void k9AviDecode::close() {
+ if (m_opened) {
+ // Free the RGB image
+ av_free(m_buffer);
+ av_free(m_FrameRGB);
+
+ // Free the YUV frame
+ av_free(m_Frame);
+
+ // Close the codec
+ avcodec_close(m_CodecCtx);
+
+ // Close the video file
+ av_close_input_file(m_FormatCtx);
+ m_opened=false;
+ }
+}
+
+
+double k9AviDecode::getDuration() const {
+ return m_duration;
+}
+
+
+bool k9AviDecode::opened() const {
+ return m_opened;
+}
+
+
+QString k9AviDecode::getFileName() const {
+ return m_fileName;
+}
+
+
+QString k9AviDecode::getError() const {
+ return m_error;
+}
diff --git a/k9author/k9avidecode.h b/k9author/k9avidecode.h
new file mode 100644
index 0000000..53f6029
--- /dev/null
+++ b/k9author/k9avidecode.h
@@ -0,0 +1,112 @@
+//
+// C++ Interface: k9avidecode
+//
+// Description:
+//
+//
+// Author: Jean-Michel PETIT <k9copy@free.fr>, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#ifndef K9AVIDECODE_H
+#define K9AVIDECODE_H
+
+#include "k9common.h"
+#include <qobject.h>
+#ifdef OLD_FFMPEG
+#include <ffmpeg/avformat.h>
+#endif
+#ifdef NEW_FFMPEG
+#include <libavformat/avformat.h>
+#endif
+
+
+#include <qimage.h>
+
+/**
+ @author Jean-Michel PETIT <k9copy@free.fr>
+*/
+
+
+//typedef dvd_file_t * (*DVDOpenFile_t) ( dvd_reader_t *, int, dvd_read_domain_t );
+typedef void (*av_register_all_t) (void);
+typedef int64_t (*av_gettime_t) (void);
+typedef int (*av_open_input_file_t)(AVFormatContext **, const char *,AVInputFormat *,int, AVFormatParameters *);
+typedef int (*av_find_stream_info_t)(AVFormatContext *);
+typedef AVCodec* (*avcodec_find_decoder_t)(enum CodecID);
+typedef int (*avcodec_open_t)(AVCodecContext *, AVCodec *);
+typedef AVFrame * (*avcodec_alloc_frame_t)(void);
+
+typedef int (*avpicture_get_size_t)(int , int , int );
+typedef void * (*av_malloc_t)(unsigned int );
+typedef int (*avpicture_fill_t)(AVPicture *, uint8_t *,int , int , int);
+typedef int (*av_read_frame_t)(AVFormatContext *, AVPacket *);
+
+typedef int (*avcodec_decode_video_t)(AVCodecContext *, AVFrame *,int *, uint8_t *, int );
+typedef int (*img_convert_t)(AVPicture *, int , const AVPicture *, int ,int, int);
+typedef void (*av_free_t)(void *);
+typedef int (*avcodec_close_t)(AVCodecContext *);
+typedef void (*av_close_input_file_t)(AVFormatContext *);
+typedef int (*av_seek_frame_t)(AVFormatContext *,int,int64_t timestamp,int flags); typedef int64_t (*av_rescale_q_t)(int64_t , AVRational , AVRational ) ;
+typedef void (*avcodec_flush_buffers_t)(AVCodecContext *);
+
+
+
+
+class k9AviDecode : public QObject
+{
+Q_OBJECT
+public:
+ k9AviDecode(QObject *parent = 0, const char *name = 0);
+
+ ~k9AviDecode();
+ bool open(const QString & _fileName);
+ void readFrame(double _seconds);
+ void seek(double _seconds);
+ void close();
+ double getDuration() const;
+ bool opened() const;
+
+ QString getFileName() const;
+
+ QString getError() const;
+
+private:
+ av_register_all_t av_register_all;
+ av_open_input_file_t av_open_input_file;
+ av_find_stream_info_t av_find_stream_info;
+ avcodec_find_decoder_t avcodec_find_decoder;
+ avcodec_open_t avcodec_open;
+ avcodec_alloc_frame_t avcodec_alloc_frame;
+ av_seek_frame_t av_seek_frame;
+ avpicture_get_size_t avpicture_get_size;
+ av_malloc_t av_malloc;
+ avpicture_fill_t avpicture_fill;
+ av_read_frame_t av_read_frame;
+ avcodec_decode_video_t avcodec_decode_video;
+ img_convert_t img_convert;
+ av_free_t av_free;
+ avcodec_close_t avcodec_close;
+ av_close_input_file_t av_close_input_file;
+ av_rescale_q_t av_rescale_q;
+ av_gettime_t av_gettime;
+ avcodec_flush_buffers_t avcodec_flush_buffers;
+
+
+ AVFormatContext *m_FormatCtx;
+ AVCodecContext *m_CodecCtx;
+ AVCodec *m_Codec;
+ AVFrame *m_Frame,*m_FrameRGB;
+ uint8_t *m_buffer;
+ int m_videoStream;
+ bool m_opened;
+ double m_duration;
+ QString m_fileName;
+ QString m_error;
+ void SaveFrame(AVFrame *pFrame, int width, int height);
+signals:
+ void drawFrame(QImage*);
+};
+
+#endif
diff --git a/k9author/k9avifile.cpp b/k9author/k9avifile.cpp
new file mode 100644
index 0000000..1ace5f6
--- /dev/null
+++ b/k9author/k9avifile.cpp
@@ -0,0 +1,185 @@
+//
+// C++ Implementation: k9avifile
+//
+// Description:
+//
+//
+// Author: Jean-Michel PETIT <k9copy@free.fr>, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#include "k9common.h"
+#include "k9avifile.h"
+#include "k9title.h"
+
+k9AviFile::k9AviFile(k9Title *parent, const char *name)
+ : QObject(parent, name)
+{
+ m_num=parent->getFiles()->count();
+ setTitle(parent);
+ m_previous=NULL;
+ m_next=NULL;
+ m_breakNext=false;
+ m_breakPrevious=false;
+}
+
+
+k9AviFile::~k9AviFile()
+{
+}
+
+
+#include "k9avifile.moc"
+
+
+QString k9AviFile::getFileName() const
+{
+ return m_fileName;
+}
+
+
+void k9AviFile::setFileName ( const QString& _value )
+{
+ m_fileName = _value;
+ emit aviFileUpdated (this);
+}
+
+
+QTime k9AviFile::getStart() const
+{
+ return m_start;
+}
+
+
+void k9AviFile::setStart ( const QTime& _value )
+{
+ m_start = _value;
+ emit aviFileUpdated (this);
+}
+
+
+QTime k9AviFile::getEnd() const
+{
+ return m_end;
+}
+
+
+void k9AviFile::setEnd ( const QTime& _value )
+{
+ m_end = _value;
+ emit aviFileUpdated (this);
+}
+
+
+QString k9AviFile::getLabel() const
+{
+ return m_label;
+}
+
+
+void k9AviFile::setLabel ( const QString& _value )
+{
+ m_label = _value;
+ emit aviFileUpdated (this);
+}
+
+
+k9Title* k9AviFile::getTitle() const
+{
+ return m_title;
+}
+
+
+void k9AviFile::setTitle ( k9Title* _value )
+{
+ m_title = _value;
+ m_title->getFiles()->append(this);
+ m_title->getFiles()->sort();
+}
+
+
+int k9AviFile::getNum() const
+{
+ return m_num;
+}
+
+
+
+
+k9AviFile* k9AviFile::getPrevious() const
+{
+ return m_previous;
+}
+
+
+void k9AviFile::setPrevious ( k9AviFile* _value )
+{
+ m_previous = _value;
+ m_breakPrevious=false;
+}
+
+
+k9AviFile* k9AviFile::getNext() const
+{
+ return m_next;
+}
+
+
+void k9AviFile::setNext ( k9AviFile* _value )
+{
+ m_next = _value;
+ m_breakPrevious=false;
+}
+
+void k9AviFile::setBreakPrevious(bool _state) {
+ m_breakPrevious=_state;
+ if ( ! _state){
+ if (m_previous !=NULL) {
+ m_previous->setEnd(this->getStart());
+ m_previous->m_breakNext=false;
+ }
+ } else {
+ if (m_previous!=NULL) {
+ m_previous ->m_breakNext=true;
+ }
+ }
+
+}
+
+bool k9AviFile::getBreakPrevious() {
+ return m_breakPrevious;
+}
+
+void k9AviFile::setBreakNext(bool _state) {
+ m_breakNext=_state;
+ if ( ! _state){
+ if (m_next !=NULL) {
+ m_next->setStart(this->getEnd());
+ m_next->m_breakPrevious=false;
+ }
+ } else {
+ if (m_next!=NULL) {
+ m_next ->m_breakPrevious=true;
+ }
+ }
+
+
+}
+
+bool k9AviFile::getBreakNext() {
+ return m_breakNext;
+}
+
+
+
+QImage k9AviFile::getImage() const {
+ return m_image;
+}
+
+
+void k9AviFile::setImage(const QImage& _value) {
+ m_image = _value;
+ emit aviFileUpdated (this);
+ emit imageChanged(_value);
+}
diff --git a/k9author/k9avifile.h b/k9author/k9avifile.h
new file mode 100644
index 0000000..83a6f17
--- /dev/null
+++ b/k9author/k9avifile.h
@@ -0,0 +1,80 @@
+//
+// C++ Interface: k9avifile
+//
+// Description:
+//
+//
+// Author: Jean-Michel PETIT <k9copy@free.fr>, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#ifndef K9AVIFILE_H
+#define K9AVIFILE_H
+
+#include <qobject.h>
+#include <qdatetime.h>
+#include <qimage.h>
+
+/**
+ @author Jean-Michel PETIT <k9copy@free.fr>
+*/
+class k9Title;
+class k9AviFile : public QObject
+{
+Q_OBJECT
+public:
+ k9AviFile(k9Title *parent = 0, const char *name = 0);
+
+ ~k9AviFile();
+
+ void setFileName ( const QString& _value );
+ QString getFileName() const;
+
+ void setStart ( const QTime& _value );
+ QTime getStart() const;
+
+ void setEnd ( const QTime& _value );
+ QTime getEnd() const;
+
+ void setLabel ( const QString& _value );
+ QString getLabel() const;
+
+ k9Title* getTitle() const;
+
+ int getNum() const;
+
+ void setPrevious ( k9AviFile* _value );
+ k9AviFile* getPrevious() const;
+
+ void setNext ( k9AviFile* _value );
+ k9AviFile* getNext() const;
+
+ void setBreakPrevious(bool _state);
+ bool getBreakPrevious();
+
+ void setBreakNext(bool _state);
+ bool getBreakNext();
+
+ void setImage(const QImage& _value);
+ QImage getImage() const;
+
+
+private:
+ QString m_fileName;
+ QTime m_start;
+ QString m_label;
+ QTime m_end;
+ k9Title *m_title;
+ QImage m_image;
+ int m_num;
+ bool m_breakNext,m_breakPrevious;
+ k9AviFile *m_previous;
+ k9AviFile *m_next;
+ void setTitle ( k9Title* _value );
+signals:
+ void aviFileUpdated(k9AviFile *_aviFile);
+ void imageChanged(const QImage &);
+};
+
+#endif
diff --git a/k9author/k9canvasselection.cpp b/k9author/k9canvasselection.cpp
new file mode 100644
index 0000000..8b9d72f
--- /dev/null
+++ b/k9author/k9canvasselection.cpp
@@ -0,0 +1,330 @@
+// //
+// C++ Implementation: k9canvasselection
+//
+// Description:
+//
+//
+// Author: Jean-Michel PETIT <k9copy@free.fr>, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#include "k9canvasselection.h"
+#include "k9menubutton.h"
+
+k9CanvasSelectionRedim::k9CanvasSelectionRedim (ePosition _position,int _x,int _y,int _w,int _h,QCanvas *canvas,k9CanvasSelection *selection):QCanvasRectangle(_x,_y,_w,_h,canvas) {
+ m_position=_position;
+ m_selection=selection;
+}
+
+void k9CanvasSelectionRedim::moveBy(double _x,double _y) {
+ m_offsetX=_x;
+ m_offsetY=_y;
+ QCanvasRectangle::moveBy(_x,_y);
+}
+
+void k9CanvasSelectionRedim::updateSelection() {
+ int w,h;
+ int w1=m_selection->getWidth();
+ int h1=m_selection->getHeight();
+ int x1=m_selection->getLeft();
+ int y1=m_selection->getTop();
+ switch (m_position) {
+ case RedimTopLeft:
+ w=m_selection->getWidth()-m_offsetX;
+ h=m_selection->getHeight()-m_offsetY;
+ if (m_selection->canScale(-m_offsetX,-m_offsetY)) {
+ m_selection->setWidth(w);
+ m_selection->setHeight(h);
+ m_selection->moveBy(m_offsetX,m_offsetY);
+ }
+ break;
+ case RedimMiddleRight :
+ w= m_selection->getWidth()+ m_offsetX;
+ if (m_selection->canScale(m_offsetX,0))
+ m_selection->setWidth(w);
+ break;
+ case RedimTopMiddle:
+ h=m_selection->getHeight()-m_offsetY;
+ if (m_selection->canScale(0,-m_offsetY)) {
+ m_selection->setHeight(h);
+ m_selection->moveBy(0,m_offsetY);
+ }
+ break;
+ case RedimTopRight:
+ h=m_selection->getHeight()-m_offsetY;
+ w=m_selection->getWidth()+ m_offsetX;
+ if (m_selection->canScale(m_offsetX,-m_offsetY)) {
+ m_selection->setHeight(h);
+ m_selection->setWidth( w);
+ m_selection->moveBy(0,m_offsetY);
+ }
+ break;
+ case RedimMiddleLeft:
+ w=m_selection->getWidth()-m_offsetX;
+ if (m_selection->canScale(-m_offsetX,0)) {
+ m_selection->setWidth(w);
+ m_selection->moveBy(m_offsetX,0);
+ }
+ break;
+ case RedimBottomLeft:
+ w=m_selection->getWidth()-m_offsetX;
+ h=m_selection->getHeight()+m_offsetY;
+ if (m_selection->canScale(-m_offsetX,+m_offsetY)) {
+ m_selection->setWidth(w);
+ m_selection->setHeight(h);
+ m_selection->moveBy(m_offsetX,0);
+ }
+ break;
+ case RedimBottomMiddle:
+ h=m_selection->getHeight()+m_offsetY;
+ if (m_selection->canScale(0,+m_offsetY))
+ m_selection->setHeight(h);
+ break;
+
+ case RedimBottomRight:
+ w=m_selection->getWidth()+m_offsetX;
+ h=m_selection->getHeight()+m_offsetY;
+ if (m_selection->canScale(+m_offsetX,+m_offsetY)) {
+ m_selection->setWidth(w);
+ m_selection->setHeight(h);
+ }
+ break;
+ }
+ m_selection->scale(m_selection->getLeft()-x1,m_selection->getTop()-y1, m_selection->getWidth()-w1,m_selection->getHeight()-h1);
+ m_selection->update();
+
+}
+
+
+k9CanvasSelection::k9CanvasSelection(k9MenuEditor *_editor)
+ : QObject(_editor) {
+ m_rect=NULL;
+ m_editor=_editor;
+}
+
+
+k9CanvasSelection::~k9CanvasSelection() {}
+
+void k9CanvasSelection::setPosition(QPoint _p) {
+ if (m_rect==NULL) {
+ QCanvas *m_canvas=m_editor->canvas();
+ m_rect=new QCanvasRectangle(m_editor->canvas());
+ QBrush brush(Qt::green);
+ m_rm=new k9CanvasSelectionRedim(k9CanvasSelectionRedim::RedimMiddleRight,0,0,10,10,m_canvas,this);
+ m_rm->setPen(Qt::black);
+ m_rm->setBrush(brush);
+
+ m_lt=new k9CanvasSelectionRedim(k9CanvasSelectionRedim::RedimTopLeft,0,0,10,10,m_canvas,this);
+ m_lt->setPen(Qt::black);
+ m_lt->setBrush(brush);
+
+ m_mt=new k9CanvasSelectionRedim(k9CanvasSelectionRedim::RedimTopMiddle,0,0,10,10,m_canvas,this);
+ m_mt->setPen(Qt::black);
+ m_mt->setBrush(brush);
+
+ m_mt=new k9CanvasSelectionRedim(k9CanvasSelectionRedim::RedimTopMiddle,0,0,10,10,m_canvas,this);
+ m_mt->setPen(Qt::black);
+ m_mt->setBrush(brush);
+
+ m_rt=new k9CanvasSelectionRedim(k9CanvasSelectionRedim::RedimTopRight,0,0,10,10,m_canvas,this);
+ m_rt->setPen(Qt::black);
+ m_rt->setBrush(brush);
+
+ m_lm=new k9CanvasSelectionRedim(k9CanvasSelectionRedim::RedimMiddleLeft,0,0,10,10,m_canvas,this);
+ m_lm->setPen(Qt::black);
+ m_lm->setBrush(brush);
+
+ m_lb=new k9CanvasSelectionRedim(k9CanvasSelectionRedim::RedimBottomLeft,0,0,10,10,m_canvas,this);
+ m_lb->setPen(Qt::black);
+ m_lb->setBrush(brush);
+
+ m_mb=new k9CanvasSelectionRedim(k9CanvasSelectionRedim::RedimBottomMiddle,0,0,10,10,m_canvas,this);
+ m_mb->setPen(Qt::black);
+ m_mb->setBrush(brush);
+
+ m_rb=new k9CanvasSelectionRedim(k9CanvasSelectionRedim::RedimBottomRight,0,0,10,10,m_canvas,this);
+ m_rb->setPen(Qt::black);
+ m_rb->setBrush(brush);
+ } else {
+ m_rect->setCanvas(m_editor->canvas());
+ m_lt->setCanvas(m_editor->canvas());
+ m_mt->setCanvas(m_editor->canvas());
+ m_rt->setCanvas(m_editor->canvas());
+ m_lm->setCanvas(m_editor->canvas());
+ m_rm->setCanvas(m_editor->canvas());
+ m_lb->setCanvas(m_editor->canvas());
+ m_mb->setCanvas(m_editor->canvas());
+ m_rb->setCanvas(m_editor->canvas());
+ ;
+ }
+ m_rect->setPen(QPen(Qt::red));
+ m_rect->setX(_p.x());
+ m_rect->setY(_p.y());
+ m_rect->setSize(0,0);
+
+}
+
+void k9CanvasSelection::release() {
+ if (m_rect) {
+ if (m_editor->getSelection()->count() !=0) {
+ drawSelection();
+ } else {
+ hide();
+ hideRedim();
+ }
+ m_editor->canvas()->update();
+ }
+}
+
+void k9CanvasSelection::drawSelection() {
+ int left=720,top=576,right=0,bottom=0;
+ QPtrList <k9MenuButton> *selection=m_editor->getSelection();
+
+ for (k9MenuButton *b=selection->first();b;b=selection->next()) {
+ left=QMIN(left,b->getLeft());
+ top=QMIN(top,b->getTop());
+ right=QMAX(right,b->getWidth()+b->getLeft());
+ bottom=QMAX(bottom,b->getTop()+b->getHeight());
+ }
+ m_rect->setX(left-2);
+ m_rect->setY(top-2);
+ m_rect->setSize(right-left+4,bottom-top+4);
+ update();
+}
+
+void k9CanvasSelection::update() {
+ int x=(int)m_rect->x() -5;
+ int y=(int)m_rect->y()-5;
+ int w=getWidth();
+ int h=getHeight();
+
+ int count=m_editor->canvas()->allItems().count();
+
+ m_lt->move(x,y);
+ m_lt->setZ(count--);
+
+ m_mt->move(x+w/2,y);
+ m_mt->setZ(count--);
+
+ m_rt->move(x+w,y);
+ m_rt->setZ(count--);
+
+ m_lm->move(x,y+h/2);
+ m_lm->setZ(count--);
+
+ m_rm->move(x+w,y+h/2);
+ m_rm->setZ(count--);
+
+ m_lb->move(x,y+h);
+ m_lb->setZ(count--);
+
+ m_mb->move(x+w/2,y+h);
+ m_mb->setZ(count--);
+
+ m_rb->move(x+w,y+h);
+ m_rb->setZ(count--);
+
+ m_rect->setZ(count--);
+
+ QCanvasItemList l=m_editor->canvas()->allItems();
+ for (QCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it) {
+ QCanvasItem *item=*it;
+ if (item != m_rect && item !=m_lt && item !=m_rt && item != m_mt && item !=m_lm && item != m_rm && item != m_lb && item != m_mb && item !=m_rb)
+ item->setZ(count--);
+ }
+
+ showRedim();
+ show();
+}
+
+void k9CanvasSelection::scale(int _x,int _y,int _w, int _h) {
+ QPtrList <k9MenuButton> *buttons=m_editor->getSelection();
+ for (k9MenuButton *b=buttons->first();b;b=buttons->next()) {
+ b->moveBy(_x,_y,false);
+ if (b->getWidth() + _w >10)
+ b->setWidth(b->getWidth()+_w,false);
+ if (b->getHeight() +_h >10)
+ b->setHeight(b->getHeight()+_h);
+ }
+
+}
+
+bool k9CanvasSelection::canScale(int _w, int _h) {
+ QPtrList <k9MenuButton> *buttons=m_editor->getSelection();
+ for (k9MenuButton *b=buttons->first();b;b=buttons->next()) {
+ if (b->getWidth() + _w <10)
+ return false;
+ if (b->getHeight() +_h <10)
+ return false;
+ }
+ return true;
+}
+
+
+void k9CanvasSelection::hide() {
+ m_rect->hide();
+ hideRedim();
+}
+void k9CanvasSelection::hideRedim() {
+ m_lt->hide();
+ m_mt->hide();
+ m_rt->hide();
+ m_lm->hide();
+ m_rm->hide();
+ m_lb->hide();
+ m_mb->hide();
+ m_rb->hide();
+
+}
+
+void k9CanvasSelection::show() {
+ m_rect->show();
+}
+void k9CanvasSelection::showRedim() {
+ m_lt->show();
+ m_mt->show();
+ m_rt->show();
+ m_lm->show();
+ m_rm->show();
+ m_lb->show();
+ m_mb->show();
+ m_rb->show();
+
+}
+
+
+void k9CanvasSelection::setSize(int _w,int _h) {
+ m_rect->setSize(_w,_h);
+}
+
+QRect k9CanvasSelection::getRect() {
+ return m_rect->rect();
+
+}
+
+void k9CanvasSelection::moveBy(int _x,int _y) {
+ m_rect->moveBy(_x,_y);
+}
+
+int k9CanvasSelection::getWidth() {
+ return m_rect->width();
+}
+void k9CanvasSelection::setWidth(int _w) {
+ m_rect->setSize(_w,m_rect->height());
+}
+int k9CanvasSelection::getHeight() {
+ return m_rect->height();
+}
+void k9CanvasSelection::setHeight(int _h) {
+ m_rect->setSize(m_rect->width(),_h);
+}
+
+int k9CanvasSelection::getLeft() {
+ return (int)m_rect->x();
+}
+int k9CanvasSelection::getTop() {
+ return (int)m_rect->y();
+}
+
+#include "k9canvasselection.moc"
diff --git a/k9author/k9canvasselection.h b/k9author/k9canvasselection.h
new file mode 100644
index 0000000..e5ff0fb
--- /dev/null
+++ b/k9author/k9canvasselection.h
@@ -0,0 +1,71 @@
+//
+// C++ Interface: k9canvasselection
+//
+// Description:
+//
+//
+// Author: Jean-Michel PETIT <k9copy@free.fr>, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#ifndef K9CANVASSELECTION_H
+#define K9CANVASSELECTION_H
+
+#include "k9menueditor.h"
+#include <qcanvas.h>
+/**
+ @author Jean-Michel PETIT <k9copy@free.fr>
+*/
+
+class k9CanvasSelection;
+class k9CanvasSelectionRedim : public QCanvasRectangle {
+public:
+ enum ePosition { RedimTopLeft=2002,RedimTopMiddle=2003,RedimTopRight=2004,RedimMiddleLeft=2005,RedimBottomLeft=2006,RedimBottomMiddle=2007,RedimBottomRight=2008,RedimMiddleRight=2009} ;
+ k9CanvasSelectionRedim (ePosition _position,int _x,int _y,int _w,int _h,QCanvas *canvas,k9CanvasSelection *selection);
+ void updateSelection();
+ virtual int rtti() const {
+ return m_position;
+ }
+ virtual void moveBy(double _x,double _y);
+private:
+ k9CanvasSelection *m_selection;
+ ePosition m_position;
+ double m_offsetX,m_offsetY;
+};
+
+
+class k9CanvasSelection : public QObject
+{
+Q_OBJECT
+public:
+ k9CanvasSelection(k9MenuEditor *_editor);
+
+ ~k9CanvasSelection();
+ void setPosition (QPoint _p);
+ void release();
+ void hide();
+ void hideRedim();
+ void showRedim();
+ void show();
+ void setSize(int _w,int _h);
+ QRect getRect();
+ void moveBy(int _x,int _y);
+ int getWidth();
+ void setWidth(int _w);
+ int getHeight();
+ void setHeight(int _h);
+ int getLeft();
+ int getTop();
+ void update();
+ void scale(int _x,int _y, int _w,int _h);
+ void drawSelection();
+ bool canScale(int _w, int _h);
+
+private:
+ k9MenuEditor *m_editor;
+ QCanvasRectangle *m_rect;
+ k9CanvasSelectionRedim *m_lt,*m_mt,*m_rt,*m_lm,*m_rm,*m_lb,*m_mb,*m_rb;
+};
+
+#endif
diff --git a/k9author/k9chapteredit.cpp b/k9author/k9chapteredit.cpp
new file mode 100644
index 0000000..e199477
--- /dev/null
+++ b/k9author/k9chapteredit.cpp
@@ -0,0 +1,200 @@
+//
+// C++ Implementation:
+//
+// Description:
+//
+//
+// Author: Jean-Michel PETIT <k9copy@free.fr>, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+
+
+#include "k9chapteredit.h"
+#include "k9drawimage.h"
+#include <ktimewidget.h>
+#include <qlabel.h>
+#include <qpixmap.h>
+#include <qslider.h>
+#include <qlayout.h>
+#include <kurlrequester.h>
+#include <qcheckbox.h>
+#include "k9title.h"
+#include <kpushbutton.h>
+#include <kiconloader.h>
+
+k9ChapterEdit::k9ChapterEdit(QWidget* parent, const char* name, WFlags fl)
+: chapterEdit(parent,name,fl)
+{
+ m_wimage=new k9DrawImage(image,0);
+ QGridLayout *l=new QGridLayout(image,1,1);
+ l->addWidget(m_wimage,0,0);
+ m_wimage->setPaletteBackgroundColor(Qt::black);
+ connect(&m_aviDecode,SIGNAL(drawFrame(QImage*)),this,SLOT(drawImage(QImage*)));
+ bTitleButton->setIconSet (SmallIcon("frame_image"));
+
+}
+
+k9ChapterEdit::~k9ChapterEdit()
+{
+}
+
+/*$SPECIALIZATION$*/
+
+void k9ChapterEdit::sliderReleased() {
+ // m_aviDecode.seek((double)slider->value() / 100);
+ // m_aviDecode.readFrame();
+}
+void k9ChapterEdit::sliderChanged() {
+ if (m_aviDecode.opened()) {
+ //m_aviDecode.seek((double)slider->value() / 100);
+ m_aviDecode.readFrame((double)slider->value() / 1000);
+ QTime t;
+ t=t.addMSecs((double)slider->value());
+ lPosition->setText(t.toString("hh:mm:ss"));
+ }
+}
+
+
+void k9ChapterEdit::urlSelected(const QString& _fileName) {
+ m_aviDecode.open(_fileName);
+ if (!m_noUpdate) {
+ if (_fileName !=m_aviFile->getFileName()) {
+ ckBreakEnd->setChecked(false);
+ ckBreakStart->setChecked(false);
+ ckBreakEndClick();
+ ckBreakStartClick();
+ }
+ m_aviFile->setFileName(_fileName);
+ }
+
+ QTime t;
+ int sec=t.msecsTo(m_aviFile->getStart());
+ slider->setMaxValue((int)(m_aviDecode.getDuration()*1000));
+
+ slider->setValue(sec);
+
+}
+
+void k9ChapterEdit::drawImage(QImage * _image) {
+ //QPixmap p(*_image);
+ //image->setPixmap(p);
+ m_wimage->setImage(*_image);
+ m_image=*_image;
+}
+
+void k9ChapterEdit::bStartClick() {
+ QTime t;
+ int secs=slider->value()/1000;
+ t=t.addSecs(secs);
+ twstart->setTime(t);
+}
+
+void k9ChapterEdit::bEndClick() {
+ QTime t;
+ int secs=slider->value()/1000;
+ t=t.addSecs(secs);
+ twend->setTime(t);
+}
+
+void k9ChapterEdit::setAviFile(k9AviFile *_aviFile) {
+ this->setEnabled(_aviFile!=NULL);
+ m_aviFile=_aviFile;
+ if (_aviFile) {
+ m_noUpdate=true;
+ k9AviFile *p=m_aviFile->getPrevious();
+ k9AviFile *n=m_aviFile->getNext();
+ m_minTime=m_aviFile->getStart();
+ m_maxTime=m_aviFile->getEnd();
+ if (p) {
+ if(p->getFileName() !=_aviFile->getFileName()) {
+ ckBreakStart->setEnabled(false);
+ m_minTime.setHMS(0,0,0,0);
+ } else {
+ ckBreakStart->setEnabled(true);
+ m_minTime=p->getStart();
+ }
+ }
+ if (n) {
+ if(n->getFileName() !=_aviFile->getFileName()) {
+ ckBreakEnd->setEnabled(false);
+ m_maxTime=_aviFile->getEnd();
+ } else {
+ ckBreakEnd->setEnabled(true);
+ m_maxTime=n->getEnd();
+ }
+ }
+
+
+ twstart->setTime(m_aviFile->getStart());
+ twend->setTime(m_aviFile->getEnd());
+ urFile->setURL(m_aviFile->getFileName());
+ urlSelected(m_aviFile->getFileName());
+ ckBreakStart->setChecked(m_aviFile->getBreakPrevious());
+ ckBreakEnd->setChecked(m_aviFile->getBreakNext());
+ }
+ m_noUpdate=false;
+
+}
+
+void k9ChapterEdit::startChanged(const QTime& _time) {
+ if (!m_noUpdate) {
+ QTime t=_time;
+ if (t > m_maxTime )
+ t=m_maxTime;
+ else if (t < m_minTime)
+ t=m_minTime;
+ else if (t >m_aviFile->getEnd())
+ t=m_aviFile->getEnd();
+ if (t!=_time)
+ twstart->setTime(t);
+ m_aviFile->setStart(t);
+ if (!m_aviFile->getBreakPrevious() && m_aviFile->getPrevious()!=NULL) {
+ m_aviFile->getPrevious()->setEnd(t);
+ }
+ QTime t2;
+ slider->setValue(t2.msecsTo(t));
+ m_aviFile->setImage(m_image);
+ }
+}
+
+void k9ChapterEdit::endChanged(const QTime& _time) {
+ if (!m_noUpdate) {
+ QTime t=_time;
+ if (t > m_maxTime )
+ t=m_maxTime;
+ else if (t < m_minTime)
+ t=m_minTime;
+ else if (t <m_aviFile->getStart())
+ t=m_aviFile->getStart();
+ if (t!=_time)
+ twend->setTime(t);
+ m_aviFile->setEnd(t);
+ QTime t2;
+ if (!m_aviFile->getBreakNext() && m_aviFile->getNext()!=NULL) {
+ QImage i=m_image;
+ m_aviDecode.readFrame((double)t2.msecsTo(t)/1000.0);
+ m_aviFile->getNext()->setImage(m_image);
+ m_image=i;
+ m_aviFile->getNext()->setStart(t);
+ }
+ slider->setValue(t2.msecsTo(t));
+ }
+}
+
+void k9ChapterEdit::ckBreakStartClick() {
+ m_aviFile->setBreakPrevious(ckBreakStart->isOn());
+
+}
+
+void k9ChapterEdit::bTitleButtonClick() {
+ m_aviFile->getTitle()->getButton()->setImage(m_image);
+}
+
+void k9ChapterEdit::ckBreakEndClick() {
+ m_aviFile->setBreakNext(ckBreakEnd->isOn());
+}
+
+#include "k9chapteredit.moc"
+
diff --git a/k9author/k9chapteredit.h b/k9author/k9chapteredit.h
new file mode 100644
index 0000000..87be4f8
--- /dev/null
+++ b/k9author/k9chapteredit.h
@@ -0,0 +1,60 @@
+//
+// C++ Interface:
+//
+// Description:
+//
+//
+// Author: Jean-Michel PETIT <k9copy@free.fr>, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+
+#ifndef K9CHAPTEREDIT_H
+#define K9CHAPTEREDIT_H
+
+#include "k9common.h"
+#include "../k9author/chapterEdit.h"
+#include "k9avidecode.h"
+#include "k9avifile.h"
+
+class k9DrawImage;
+class k9ChapterEdit : public chapterEdit
+{
+ Q_OBJECT
+
+public:
+ k9ChapterEdit(QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+ ~k9ChapterEdit();
+ /*$PUBLIC_FUNCTIONS$*/
+
+public slots:
+ /*$PUBLIC_SLOTS$*/
+private:
+ k9AviDecode m_aviDecode;
+ k9DrawImage *m_wimage;
+ k9AviFile *m_aviFile;
+ QTime m_minTime,m_maxTime;
+ bool m_noUpdate;
+ QImage m_image;
+protected:
+ /*$PROTECTED_FUNCTIONS$*/
+ virtual void sliderReleased();
+ virtual void sliderChanged();
+ virtual void bStartClick();
+ virtual void bEndClick();
+ virtual void ckBreakStartClick();
+ virtual void ckBreakEndClick();
+ virtual void urlSelected(const QString&);
+ virtual void startChanged(const QTime&);
+ virtual void endChanged(const QTime&);
+ virtual void bTitleButtonClick();
+protected slots:
+ /*$PROTECTED_SLOTS$*/
+ void drawImage(QImage *);
+public slots:
+ void setAviFile(k9AviFile *_aviFile);
+};
+
+#endif
+
diff --git a/k9author/k9import.cpp b/k9author/k9import.cpp
new file mode 100644
index 0000000..774bc8e
--- /dev/null
+++ b/k9author/k9import.cpp
@@ -0,0 +1,250 @@
+//
+// C++ Implementation:
+//
+// Description:
+//
+//
+// Author: Jean-Michel PETIT <k9copy@free.fr>, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+
+
+#include "k9import.h"
+#include "k9title.h"
+#include "k9avifile.h"
+#include "k9lvitemimport.h"
+#include <klocale.h>
+#include "k9menuedit.h"
+#include "k9haldevice.h"
+#include "k9config.h"
+#include "k9burndvd.h"
+#include <qdir.h>
+#include <kfiledialog.h>
+#include <kcombobox.h>
+#include <kiconloader.h>
+#include <kselect.h>
+#include "k9processlist.h"
+
+k9Import::k9Import(QWidget* parent, const char* name,k9CdDrives *_drives)
+ : import(parent,name) {
+ m_parent=(k9Copy*) parent;
+ drives=_drives;
+
+ connect(&m_newDVD,SIGNAL(sigAddTitle()),this,SLOT(titleAdded()));
+}
+
+k9Import::~k9Import() {}
+
+
+
+/*$SPECIALIZATION$*/
+
+void k9Import::init() {
+ m_root=new QListViewItem(lvDVD,i18n("Root Menu"));
+ m_root->setOpen(true);
+ m_root->setPixmap(0,SmallIcon("dvd_unmount"));
+ emit aviFileSelected(NULL);
+
+ connect(drives,SIGNAL(deviceAdded( k9CdDrive*)),this,SLOT(deviceAdded( k9CdDrive* )));
+ connect(drives,SIGNAL(deviceRemoved( k9CdDrive*)),this,SLOT(deviceRemoved( k9CdDrive* )));
+
+ readDrives();
+ m_root->setSelected(true);
+ emit rootSelected(&m_newDVD);
+
+
+}
+
+void k9Import::readDrives() {
+ cbOutputDev->clear();
+ recorderList.clear();
+ cbOutputDev->insertItem(i18n("ISO Image"));
+ cbOutputDev->insertItem(i18n("Folder"));
+
+ drives->scanDrives();
+
+}
+
+void k9Import::deviceAdded(k9CdDrive *_drive) {
+ addDrive(_drive);
+}
+
+void k9Import::deviceRemoved(k9CdDrive *_drive) {
+
+ int i=recorderList.find(_drive);
+ recorderList.remove( i);
+ cbOutputDev->removeItem(i+2);
+
+}
+
+void k9Import::addDrive(k9CdDrive *drive) {
+#ifdef HAVE_HAL
+ if (drive->getDevice()!=NULL) {
+ k9HalDevice *dev=drive->getDevice();
+ connect(dev,SIGNAL(volumeChanged( const QString &,const QString &)),this,SLOT(volumeChanged(const QString&,const QString&)));
+ }
+#endif
+ if (drive->canWriteDVD) {
+ cbOutputDev->insertItem(drive->name+ " ("+drive->device+")",-1);
+ recorderList.append(drive);
+ }
+
+}
+
+void k9Import::volumeChanged(const QString &device,const QString &volumeName) {}
+
+
+#include "k9import.moc"
+
+
+
+QListViewItem* k9Import::getRoot() const {
+ return m_root;
+}
+
+
+void k9Import::aviFileUpdated(k9AviFile *_aviFile) {
+ k9LvItemImport *itemTitle = (k9LvItemImport*)m_root->firstChild();
+ while (itemTitle) {
+ k9LvItemImport *itemChapter = (k9LvItemImport*)itemTitle->firstChild();
+ while (itemChapter) {
+ if (itemChapter->getAviFile()==_aviFile) {
+ itemChapter->setText(1,_aviFile->getStart().toString("hh:mm:ss") +" - "+_aviFile->getEnd().toString("hh:mm:ss"));
+ itemChapter->setPixmap(0,QPixmap(_aviFile->getImage().smoothScale(50,40)));
+ }
+ itemChapter=(k9LvItemImport*)itemChapter->nextSibling();
+ }
+ itemTitle=(k9LvItemImport*)itemTitle->nextSibling();
+ }
+ updateTotalTime();
+}
+
+void k9Import::buttonUpdated(k9MenuButton *_button, const QImage &_image) {
+ k9LvItemImport *itemTitle = (k9LvItemImport*)m_root->firstChild();
+ while (itemTitle) {
+ if (itemTitle->getTitle()->getButton()==_button) {
+ QImage img=_image.smoothScale(50,40,QImage::ScaleFree);
+ QPixmap pix(img);
+ itemTitle->setPixmap(0,pix);
+ }
+ itemTitle=(k9LvItemImport*)itemTitle->nextSibling();
+ }
+}
+
+
+
+void k9Import::lvDVDItemSelected (QListViewItem *_item) {
+ k9LvItemImport *item=(k9LvItemImport*)_item;
+
+ switch (_item->rtti()) {
+ case 1002:
+ emit aviFileSelected(item->getAviFile());
+ emit titleSelected(item->getTitle());
+ break;
+ case 1001:
+ emit titleSelected(item->getTitle());
+ break;
+ default:
+ emit rootSelected(&m_newDVD);
+ break;
+ }
+}
+
+void k9Import::setProgressWindow(QWidget *_widget) {
+ m_toolView=m_parent->setToolWindow(_widget,KDockWidget::DockRight,i18n("processing"),i18n("processing"));
+ m_dockWidget = m_parent->getVisibleDock();
+ m_parent->setActions( false);
+ m_toolView->show();
+// this->setEnabled(false);
+
+}
+
+void k9Import::removeProgressWindow() {
+ m_parent->setActions(true);
+
+ m_parent->removeToolWindow( m_toolView);
+ this->setEnabled(true);
+ if (m_dockWidget!=NULL)
+ m_dockWidget->changeHideShowState();
+}
+
+void k9Import::execute() {
+ QString filename;
+ k9Config config;
+ QString outputDir=config.getPrefOutput();
+ if (cbOutputDev->currentItem() ==0) {
+ filename=KFileDialog::getSaveFileName (QDir::homeDirPath(),"*.iso", 0,i18n("Save image to disk"));
+ if (filename =="")
+ return;
+ } else if (cbOutputDev->currentItem()==1) {
+ outputDir= KFileDialog::getExistingDirectory(QDir::homeDirPath());
+ if (outputDir=="")
+ return;
+ }
+
+// k9Progress *progress=new k9Progress(m_parent,0);
+// m_newDVD.setProgress(progress);
+// setProgressWindow(progress);
+ k9ProcessList *p=new k9ProcessList(this,0,0);
+ setProgressWindow(p);
+ m_newDVD.setProcessList(p);
+ m_newDVD.setWorkDir(outputDir);
+ m_newDVD.execute();
+ removeProgressWindow();
+ bool burn=(m_newDVD.getError()=="") ;
+ if (burn && cbOutputDev->currentItem()!=1) {
+ //changeStatusbar(i18n("Burning DVD"),sbMessage);
+
+ k9BurnDVD b;
+
+ setProgressWindow( b.getDialog());
+ b.setworkDir(config.getPrefOutput() );
+ b.setUseK3b(config.getPrefK3b() );
+ b.setAutoBurn(config.getPrefAutoBurn());
+ b.setvolId("DVD");
+ b.setSpeed( i18n("default"));
+ if (cbOutputDev->currentItem() !=0) {
+ k9CdDrive * drive=(k9CdDrive*)recorderList.at(cbOutputDev->currentItem()-2);
+ b.setburnDevice(drive->device);
+ } else
+ b.makeIso(filename);
+ b.burn();
+ removeProgressWindow();
+ }
+
+
+}
+
+
+void k9Import::cbFormatActivated(const QString &_format) {
+ if (_format == "PAL") {
+ m_newDVD.setFormat(k9NewDVD::PAL);
+ m_menuEdit->setFormat(k9MenuEdit::PAL);
+ } else {
+ m_newDVD.setFormat(k9NewDVD::NTSC);
+ m_menuEdit->setFormat(k9MenuEdit::NTSC);
+ }
+
+}
+
+void k9Import::setMenuEdit(k9MenuEdit* _value) {
+ m_menuEdit = _value;
+}
+
+void k9Import::setEnableCreate(bool _state) {
+ m_parent->setEnabledCreateDVD(true);
+}
+
+void k9Import::titleAdded() {
+ emit rootSelected(&m_newDVD);
+}
+
+void k9Import::updateTotalTime() {
+ int total=m_newDVD.getTotalTime();
+ gsTotal->setValue(total/60);
+ QTime t(0,0,0);
+ t=t.addSecs(total);
+ lTotal->setText(t.toString("hh:mm:ss"));
+}
diff --git a/k9author/k9import.h b/k9author/k9import.h
new file mode 100644
index 0000000..e883bed
--- /dev/null
+++ b/k9author/k9import.h
@@ -0,0 +1,79 @@
+//
+// C++ Interface:
+//
+// Description:
+//
+//
+// Author: Jean-Michel PETIT <k9copy@free.fr>, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+
+#ifndef K9IMPORT_H
+#define K9IMPORT_H
+
+#include "k9common.h"
+#include <qlistview.h>
+#include "k9copy.h"
+#include "../k9author/import.h"
+#include "../k9author/k9newdvd.h"
+
+
+class k9AviFile;
+class k9MenuButton;
+class k9MenuEdit;
+class k9Import : public import {
+ Q_OBJECT
+private:
+ QListViewItem *m_root;
+ k9NewDVD m_newDVD;
+ KMdiToolViewAccessor *m_toolView;
+ KDockWidget *m_dockWidget;
+ k9Copy *m_parent;
+ QPtrList <k9CdDrive> recorderList;
+ k9CdDrives *drives;
+ k9MenuEdit *m_menuEdit;
+
+public:
+ k9Import(QWidget* parent = 0, const char* name = 0,k9CdDrives *_drives=0 );
+ ~k9Import();
+ /*$PUBLIC_FUNCTIONS$*/
+ void init();
+ void execute();
+ QListViewItem* getRoot() const;
+ k9NewDVD *getNewDVD() {
+ return &m_newDVD;
+ }
+
+public slots:
+ /*$PUBLIC_SLOTS$*/
+ void aviFileUpdated(k9AviFile *_aviFile);
+ void buttonUpdated(k9MenuButton *_button, const QImage &_image);
+ void setMenuEdit(k9MenuEdit* _value);
+ void setEnableCreate(bool _state);
+ void updateTotalTime();
+ void titleAdded();
+protected:
+ /*$PROTECTED_FUNCTIONS$*/
+ void setProgressWindow(QWidget *_widget);
+ void removeProgressWindow();
+ void readDrives();
+ void addDrive (k9CdDrive *_drive);
+
+protected slots:
+ /*$PROTECTED_SLOTS$*/
+ void lvDVDItemSelected (QListViewItem *);
+ void cbFormatActivated(const QString &_format);
+ virtual void deviceAdded(k9CdDrive *_drive);
+ virtual void deviceRemoved(k9CdDrive *_drive);
+ virtual void volumeChanged(const QString &device,const QString &volumeName);
+
+signals:
+ void aviFileSelected(k9AviFile *_aviFile);
+ void titleSelected(k9Title *);
+ void rootSelected(k9NewDVD *);
+};
+
+#endif
+
diff --git a/k9author/k9importfiles.cpp b/k9author/k9importfiles.cpp
new file mode 100644
index 0000000..2cb6138
--- /dev/null
+++ b/k9author/k9importfiles.cpp
@@ -0,0 +1,52 @@
+//
+// C++ Implementation: k9importfiles
+//
+// Description:
+//
+//
+// Author: Jean-Michel PETIT <k9copy@free.fr>, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#include "k9importfiles.h"
+#include "k9import.h"
+#include "k9newtitle.h"
+#include "klocale.h"
+#include "kapplication.h"
+#include "k9chapteredit.h"
+#include "k9avifile.h"
+#include "k9menuedit.h"
+
+k9ImportFiles::k9ImportFiles(QWidget *parent, const char *name)
+ : KMdiMainFrm( parent, name ,KMdi::IDEAlMode )
+{
+ this->setCaption(kapp->makeStdCaption(i18n("Create new DVD"),true));
+ m_k9Import=new k9Import(this);
+ m_k9ImportView=createWrapper( m_k9Import,"","");
+ addWindow(m_k9ImportView, KMdi::StandardAdd);
+
+
+ k9MenuEdit *menu=new k9MenuEdit(this);
+ addToolWindow(menu, KDockWidget::DockRight, getMainDockWidget(),0,i18n("Edit menu"),i18n("Edit Menu"));
+
+ k9ChapterEdit *ch=new k9ChapterEdit(this);
+ addToolWindow(ch, KDockWidget::DockBottom, getMainDockWidget(),0,i18n("Chapter properties"),i18n("Chapter properties"));
+
+ connect(m_k9Import,SIGNAL(aviFileSelected(k9AviFile*)),ch,SLOT(setAviFile(k9AviFile*)));
+
+ m_k9NewTitle=new k9NewTitle(this);
+ m_k9NewTitle->setK9Import(m_k9Import);
+ addToolWindow(m_k9NewTitle, KDockWidget::DockBottom, getMainDockWidget(),0,i18n("Add title"),i18n("Add title"));
+
+ m_k9Import->init();
+
+}
+
+
+k9ImportFiles::~k9ImportFiles()
+{
+}
+
+
+#include "k9importfiles.moc"
diff --git a/k9author/k9importfiles.h b/k9author/k9importfiles.h
new file mode 100644
index 0000000..136c131
--- /dev/null
+++ b/k9author/k9importfiles.h
@@ -0,0 +1,42 @@
+//
+// C++ Interface: k9importfiles
+//
+// Description:
+//
+//
+// Author: Jean-Michel PETIT <k9copy@free.fr>, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#ifndef K9IMPORTFILES_H
+#define K9IMPORTFILES_H
+
+#include "k9common.h"
+
+#include <qobject.h>
+#include <kmdidefines.h>
+#include <kmdichildarea.h>
+#include <kmdimainfrm.h>
+
+/**
+ @author Jean-Michel PETIT <k9copy@free.fr>
+*/
+
+class k9Import;
+class k9NewTitle;
+class k9ImportFiles : public KMdiMainFrm
+{
+Q_OBJECT
+public:
+ k9ImportFiles(QWidget *parent = 0, const char *name = 0);
+
+ ~k9ImportFiles();
+private:
+ k9Import *m_k9Import;
+ KMdiChildView *m_k9ImportView;
+ k9NewTitle *m_k9NewTitle;
+ KMdiChildView *m_k9NewTitleView;
+};
+
+#endif
diff --git a/k9author/k9lvitemimport.cpp b/k9author/k9lvitemimport.cpp
new file mode 100644
index 0000000..e946c8a
--- /dev/null
+++ b/k9author/k9lvitemimport.cpp
@@ -0,0 +1,54 @@
+//
+// C++ Implementation: k9lvitemimport
+//
+// Description:
+//
+//
+// Author: Jean-Michel PETIT <k9copy@free.fr>, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#include "k9lvitemimport.h"
+
+
+k9LvItemImport::k9LvItemImport( QListViewItem *parent,eObjectType _objectType)
+ : QListViewItem( parent) {
+ m_objectType=_objectType;
+ m_title=NULL;
+ m_aviFile=NULL;
+}
+
+int k9LvItemImport::rtti () const {
+ switch(m_objectType) {
+ case TITLE:
+ return 1001;
+ case CHAPTER:
+ return 1002;
+ default:
+ return 1000;
+ }
+}
+
+int k9LvItemImport::compare(QListViewItem *i,int col,bool ascending) const {
+ int res;
+ if (i->rtti()== 1001) {
+ k9LvItemImport *item2=(k9LvItemImport*)i;
+ return this->getTitle()->getNum()-item2->getTitle()->getNum();
+ }
+ if (i->rtti()== 1002) {
+ k9LvItemImport *item2=(k9LvItemImport*)i;
+ return this->getAviFile()->getNum() - item2->getAviFile()->getNum() ;
+ }
+ return QListViewItem::compare(i,col,ascending);
+}
+
+
+void k9LvItemImport::setTitle(k9Title* _value) {
+ m_title = _value;
+ QPixmap pix(m_title->getButton()->getImage());
+ setPixmap(0,pix);
+}
+
+k9LvItemImport::~k9LvItemImport() {
+}
diff --git a/k9author/k9lvitemimport.h b/k9author/k9lvitemimport.h
new file mode 100644
index 0000000..22aa3a2
--- /dev/null
+++ b/k9author/k9lvitemimport.h
@@ -0,0 +1,43 @@
+//
+// C++ Interface: k9lvitemimport
+//
+// Description:
+//
+//
+// Author: Jean-Michel PETIT <k9copy@free.fr>, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#ifndef K9LVITEMIMPORT_H
+#define K9LVITEMIMPORT_H
+
+#include "k9common.h"
+#include <qlistview.h>
+#include "k9avifile.h"
+#include "k9title.h"
+/**
+ @author Jean-Michel PETIT <k9copy@free.fr>
+*/
+class k9LvItemImport: public QListViewItem {
+public:
+ enum eObjectType {ROOT,TITLE,CHAPTER};
+
+ k9LvItemImport( QListViewItem *parent,eObjectType _objectType);
+ ~k9LvItemImport();
+ virtual int rtti () const;
+ eObjectType getObjectType() { return m_objectType;};
+
+ void setAviFile ( k9AviFile* _value ){m_aviFile = _value;}
+ k9AviFile* getAviFile() const { return m_aviFile;}
+
+ void setTitle(k9Title* _value);
+ k9Title* getTitle() const { return m_title;}
+ virtual int compare (QListViewItem *i,int col,bool ascending) const;
+private:
+ eObjectType m_objectType;
+ k9AviFile *m_aviFile;
+ k9Title *m_title;
+};
+
+#endif
diff --git a/k9author/k9menu.cpp b/k9author/k9menu.cpp
new file mode 100644
index 0000000..b219ba3
--- /dev/null
+++ b/k9author/k9menu.cpp
@@ -0,0 +1,333 @@
+//
+// C++ Implementation: k9menu
+//
+// Description:
+//
+//
+// Author: Jean-Michel PETIT <k9copy@free.fr>, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#include "k9menu.h"
+#include "k9menubutton.h"
+#include "k9process.h"
+#include <qpainter.h>
+#include <qbitmap.h>
+#include <kapplication.h>
+#include <qfile.h>
+#include <qdom.h>
+#include "k9tools.h"
+
+k9Menu::k9Menu(QObject *parent, const char *name)
+ : QObject(parent, name),m_format(PAL) {
+ m_buttons.setAutoDelete(false);
+ m_canvas=new QCanvas(this);
+ QPixmap pix(720,576);
+ pix.fill(Qt::black);
+ m_canvas->setBackgroundPixmap(pix);
+ m_startScript=m_startScript2=m_endScript="";
+}
+
+
+k9Menu::~k9Menu() {}
+
+
+#include "k9menu.moc"
+
+
+
+k9MenuButton *k9Menu::addButton() {
+ k9MenuButton *button=new k9MenuButton(m_canvas);
+ m_buttons.append(button);
+ return button;
+
+}
+
+
+
+void k9Menu::createMenus(QDomElement *_rootNode) {
+
+ m_config=new k9Config();
+ int height=m_format==PAL?576:480;
+
+ QImage img;
+
+ //create menu image
+ QCanvasItemList l=m_canvas->allItems();
+ for (QCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it) {
+ if ( (*it)->rtti() > 1001 || (*it)->rtti()==QCanvasItem::Rtti_Rectangle )
+ (*it)->hide();
+ }
+
+
+ QPixmap pixbg(720,height);
+ QPainter pbg(&pixbg);
+ m_canvas->resize(720,height);
+ m_canvas->update();
+ m_canvas->drawArea(QRect(0,0,720,height),&pbg);
+
+ //create the hilite picture
+ int lineWidth=2;
+ img.create(720,height,8,3,QImage::IgnoreEndian);
+ QPixmap pixhi;
+ pixhi.convertFromImage(img,0);
+ pixhi.fill(Qt::white);
+ QPainter phi(&pixhi);
+ QPen penhi;
+ penhi.setColor(m_config->getPrefButtonHiliteColor());
+ penhi.setWidth(lineWidth*2);
+ phi.setPen(penhi);
+ phi.setBrush(Qt::NoBrush);
+ //create the hilite mask
+ QBitmap mask(720,height);
+ mask.fill(Qt::color0);
+ QPainter pmk(&mask);
+ QPen penmk;
+ penmk.setColor(Qt::color1);
+ penmk.setWidth(lineWidth*2);
+ pmk.setPen(penmk);
+ pmk.setBrush(Qt::NoBrush);
+
+ //draw buttons
+ for (k9MenuButton *button=m_buttons.first();button;button=m_buttons.next()) {
+ //draw hilight
+ phi.drawRect(button->getLeft()+lineWidth,button->getTop()+lineWidth,button->getWidth()-lineWidth,button->getHeight()-lineWidth);
+ pmk.drawRect(button->getLeft()+lineWidth,button->getTop()+lineWidth,button->getWidth()-lineWidth,button->getHeight()-lineWidth);
+
+ }
+ pbg.end();
+ phi.end();
+ pmk.end();
+ pixhi.setMask(mask);
+ //save menu image
+
+ QString bgFileName=m_workDir+KApplication::randomString(8)+".jpg";
+ QString hiFileName=m_workDir+KApplication::randomString(8)+".png";
+ QString m2vFileName= m_workDir+KApplication::randomString(8)+".m2v";
+ QString mpaFileName= m_workDir+KApplication::randomString(8)+".m2v";
+ QString mpgFileName= m_workDir+KApplication::randomString(8)+".mpg";
+
+ pixbg.save(bgFileName,"JPEG",-1);
+ pixhi.save(hiFileName,"PNG",-1);
+
+ convertJpegToMpeg(bgFileName,m2vFileName);
+ createAudio(mpaFileName);
+ multiplex(mpaFileName,m2vFileName,mpgFileName);
+ spumux(hiFileName,mpgFileName);
+ appendMenu(_rootNode);
+
+// mask.save(m_workDir+"/mask.bmp","BMP",-1);
+
+ QFile::remove(bgFileName);
+ QFile::remove(m2vFileName);
+ QFile::remove(mpaFileName);
+ QFile::remove(mpgFileName);
+ QFile::remove(hiFileName);
+ delete m_config;
+}
+
+void k9Menu::convertJpegToMpeg(const QString &_imageJpg,const QString &_imageMpg) {
+ k9Process *process=new k9Process(0,0);
+ process->setWorkingDirectory(m_workDir);
+ process->setUseShell(true);
+ if (m_format==NTSC) {
+ *process << "jpeg2yuv" << "-n" << "50" << "-I" << "p" << "-f" << "29.97" << "-j" << _imageJpg << "|";
+ *process << "mpeg2enc" << "-n" << "n" <<"-f" << "8" << "-o" << _imageMpg;
+ } else {
+ *process << "jpeg2yuv" << "-n" << "50" << "-I" << "p" << "-f" << "25" << "-j" << _imageJpg << "|";
+ *process << "mpeg2enc" << "-n" << "p" <<"-f" << "8" << "-o" << _imageMpg;
+ }
+ process->start();
+ process->sync();
+ if (!process->normalExit()) {
+ qDebug("error converting jpeg to mpeg");
+ }
+ qDebug(process->debug().latin1());
+}
+
+void k9Menu::createAudio(const QString & _audioFile) {
+ k9Process *process=new k9Process(0,0);
+ process->setWorkingDirectory(m_workDir);
+ process->setUseShell(true);
+ if (k9Tools::checkProgram("toolame"))
+ *process << "dd" << "if=/dev/zero" << "bs=4" << "count=1920" << "|" << "toolame" << "-b" << "128" << "-s" << "48" << "/dev/stdin" << _audioFile;
+ else
+ *process << "dd" << "if=/dev/zero" << "bs=4" << "count=1920" << "|" << "twolame" <<"-r" << "-b" << "128" << "-s" << "48000" << "/dev/stdin" << _audioFile;
+
+ process->start();
+ process->sync();
+ if (!process->normalExit()) {
+ qDebug("error creating audio stream");
+ }
+}
+void k9Menu::multiplex(const QString &_audio, const QString &_video, const QString _result) {
+ k9Process *process=new k9Process(0,0);
+ process->setWorkingDirectory(m_workDir);
+ process->setUseShell(true);
+ *process << "mplex" << "-f" << "8" << "-o" << _result << _video << _audio;
+ process->start();
+ process->sync();
+ if (!process->normalExit()) {
+ qDebug("error multiplexing audio and video");
+ }
+}
+
+void k9Menu::spumux(const QString &_hiFileName,const QString &_mpgFileName) {
+ QDomElement stream,spu;
+
+ QDomDocument xml;
+
+ QDomElement root = xml.createElement( "subpictures" );
+ xml.appendChild( root );
+
+ stream=xml.createElement("stream");
+ root.appendChild(stream);
+
+ spu=xml.createElement("spu");
+ stream.appendChild(spu);
+
+ spu.setAttribute("start","00:00:00.0");
+ spu.setAttribute("end","00:00:00.0");
+ spu.setAttribute("highlight",_hiFileName);
+ spu.setAttribute("select",_hiFileName);
+
+ //spu.setAttribute("autooutline","infer");
+ spu.setAttribute("force","yes");
+ // spu.setAttribute("autoorder","rows");
+ spu.setAttribute("xoffset","0");
+ spu.setAttribute("yoffset","0");
+
+ int i=1;
+ for (k9MenuButton *button=m_buttons.first();button;button=m_buttons.next()) {
+ QDomElement eButton = xml.createElement("button");
+ spu.appendChild(eButton);
+ eButton.setAttribute("name",QString("button%1").arg(i));
+ eButton.setAttribute("x0", QString::number(button->getLeft()));
+ eButton.setAttribute("y0",QString::number(button->getTop()));
+ eButton.setAttribute("x1",QString::number(button->getLeft()+button->getWidth()));
+ eButton.setAttribute("y1",QString::number(button->getTop()+button->getHeight()));
+ i++;
+ }
+
+ QString spuFileName(m_workDir + KApplication::randomString(8)+ ".xml");
+ QFile file( spuFileName );
+ if ( file.open( IO_WriteOnly ) ) {
+ QTextStream stream( &file );
+ xml.save(stream,1);
+ file.close();
+ }
+
+
+ k9Process *process=new k9Process(0,0);
+ process->setWorkingDirectory(m_workDir);
+ process->setUseShell(true);
+// *process << "mplex" << "-f" << "8" << "-o" << _result << _video << _audio;
+ *process << "spumux" << spuFileName << "<" << _mpgFileName << ">" << m_menuFileName;
+ process->start();
+ process->sync();
+ if (!process->normalExit()) {
+ qDebug("error multiplexing audio and video");
+ }
+
+ file.remove();
+}
+
+void k9Menu::appendMenu(QDomElement *_rootNode) {
+ QDomDocument doc=_rootNode->ownerDocument();
+ QDomNodeList l=_rootNode->elementsByTagName("menus");
+ QDomNode menus;
+ if (l.count()==0) {
+ menus=doc.createElement("menus");
+ _rootNode->appendChild(menus);
+ } else {
+ menus=l.item(0);
+ }
+
+ QDomElement pgc=doc.createElement("pgc");
+ menus.appendChild(pgc);
+ QDomElement pre=doc.createElement("pre");
+ pgc.appendChild(pre);
+ QDomText txt=doc.createTextNode(m_startScript +m_startScript2);
+ pre.appendChild(txt);
+
+ QDomElement vob=doc.createElement("vob");
+ pgc.appendChild(vob);
+ vob.setAttribute("file",m_menuFileName);
+ vob.setAttribute("pause","inf");
+ int i=1;
+ for (k9MenuButton *button=m_buttons.first();button;button=m_buttons.next()) {
+ QDomElement eButton = doc.createElement("button");
+ pgc.appendChild(eButton);
+ QDomText eButtonTxt=doc.createTextNode(button->getScript());
+ eButton.appendChild(eButtonTxt);
+ eButton.setAttribute("name",QString("button%1").arg(i));
+ i++;
+ }
+
+
+}
+
+QString k9Menu::getWorkDir() const {
+ return m_workDir;
+}
+
+
+void k9Menu::setWorkDir(const QString& _value) {
+ m_workDir = _value;
+}
+
+
+void k9Menu::setFormat(const eFormat& _value) {
+ m_format = _value;
+}
+
+
+QString k9Menu::getMenuFileName() const {
+ return m_menuFileName;
+}
+
+
+void k9Menu::setMenuFileName(const QString& _value) {
+ m_menuFileName = _value;
+}
+
+
+
+
+QCanvas* k9Menu::getCanvas() const {
+ return m_canvas;
+}
+
+
+void k9Menu::setCanvas(QCanvas* _value) {
+ m_canvas = _value;
+}
+
+void k9Menu::setStartScript(const QString &_value) {
+ m_startScript=_value;
+}
+
+
+QString k9Menu::getStartScript() const {
+ return m_startScript;
+}
+
+void k9Menu::setStartScript2(const QString &_value) {
+ m_startScript2=_value;
+}
+
+
+QString k9Menu::getStartScript2() const {
+ return m_startScript2;
+}
+
+
+QString k9Menu::getEndScript() const {
+ return m_endScript;
+}
+
+
+void k9Menu::setEndScript(const QString& _value) {
+ m_endScript = _value;
+}
diff --git a/k9author/k9menu.h b/k9author/k9menu.h
new file mode 100644
index 0000000..91e8a20
--- /dev/null
+++ b/k9author/k9menu.h
@@ -0,0 +1,71 @@
+//
+// C++ Interface: k9menu
+//
+// Description:
+//
+//
+// Author: Jean-Michel PETIT <k9copy@free.fr>, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#ifndef K9MENU_H
+#define K9MENU_H
+
+#include "k9common.h"
+#include "k9config.h"
+#include <qobject.h>
+#include <qptrlist.h>
+#include <qimage.h>
+#include <qfont.h>
+#include <qdom.h>
+#include <qcanvas.h>
+/**
+ @author Jean-Michel PETIT <k9copy@free.fr>
+*/
+class k9MenuButton;
+class k9Menu : public QObject {
+ Q_OBJECT
+public slots:
+ void setStartScript(const QString &);
+ void setStartScript2(const QString &);
+ void setEndScript(const QString& _value);
+
+public:
+ enum eFormat {
+ PAL=1,NTSC=2
+ };
+ k9Menu(QObject *parent = 0, const char *name = 0);
+ ~k9Menu();
+ k9MenuButton *addButton();
+ void createMenus(QDomElement *_rootNode);
+ void setWorkDir(const QString& _value);
+ QString getWorkDir() const;
+ void setFormat(const eFormat& _value);
+ void setMenuFileName(const QString& _value);
+ QString getMenuFileName() const;
+
+ void setCanvas(QCanvas* _value);
+ QCanvas* getCanvas() const;
+
+ QString getStartScript() const;
+ QString getEndScript() const;
+ QString getStartScript2() const;
+private:
+ QPtrList <k9MenuButton> m_buttons;
+ QString m_workDir;
+ QString m_menuFileName;
+ eFormat m_format;
+ QCanvas *m_canvas;
+ QString m_startScript;
+ QString m_startScript2;
+ QString m_endScript;
+ k9Config *m_config;
+ void convertJpegToMpeg(const QString &_imageJpg,const QString &_imageMpg) ;
+ void createAudio(const QString & _audioFile);
+ void multiplex(const QString &_audio, const QString &_video, const QString _result);
+ void spumux(const QString &_hiFileName,const QString &_mpgFileName);
+ void appendMenu(QDomElement *_rootNode);
+};
+
+#endif
diff --git a/k9author/k9menubutton.cpp b/k9author/k9menubutton.cpp
new file mode 100644
index 0000000..73908e9
--- /dev/null
+++ b/k9author/k9menubutton.cpp
@@ -0,0 +1,296 @@
+//
+// C++ Implementation: k9menubutton
+//
+// Description:
+//
+//
+// Author: Jean-Michel PETIT <k9copy@free.fr>, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#include "k9menubutton.h"
+#include <qpainter.h>
+#include <qwmatrix.h>
+#include <qbitmap.h>
+
+k9CanvasSprite::k9CanvasSprite (QCanvasPixmapArray *a,QCanvas *canvas,k9MenuButton *button) : QCanvasSprite(a,canvas) {
+ m_button=button;
+}
+
+void k9CanvasSprite::update() {
+ m_button->update();
+}
+
+
+k9MenuButton* k9CanvasSprite::getButton() const {
+ return m_button;
+}
+
+void k9MenuButton::select(bool _value) {
+ /* if (_value) {
+ m_lt->show();
+ m_mt->show();
+ m_rt->show();
+ m_lm->show();
+ m_rm->show();
+ m_lb->show();
+ m_mb->show();
+ m_rb->show();
+ } else {
+ m_lt->hide();
+ m_mt->hide();
+ m_rt->hide();
+ m_lm->hide();
+ m_rm->hide();
+ m_lb->hide();
+ m_mb->hide();
+ m_rb->hide();
+ }*/
+}
+
+void k9MenuButton::update() {
+ int x=m_sprite->x()-5;
+ int y=m_sprite->y()-5;
+ int w=m_width;
+ int h=m_height;
+
+ int count=m_canvas->allItems().count();
+/*
+ m_lt->move(x,y);
+ m_lt->setZ(count--);
+
+ m_mt->move(x+w/2,y);
+ m_mt->setZ(count--);
+
+ m_rt->move(x+w,y);
+ m_rt->setZ(count--);
+
+ m_lm->move(x,y+h/2);
+ m_lm->setZ(count--);
+
+ m_rm->move(x+w,y+h/2);
+ m_rm->setZ(count--);
+
+ m_lb->move(x,y+h);
+ m_lb->setZ(count--);
+
+ m_mb->move(x+w/2,y+h);
+ m_mb->setZ(count--);
+
+ m_rb->move(x+w,y+h);
+ m_rb->setZ(count--);
+*/
+ switch(m_textPosition) {
+ case RIGHT:
+ m_text->move(x+2+w,y+2+h/2-m_text->boundingRect().height()/2);
+ break;
+ case BOTTOM:
+ m_text->move(x+2+w/2 - m_text->boundingRect().width()/2,y+2+h);
+ break;
+ }
+ m_text->show();
+ m_text->setZ(count --);
+
+ m_sprite->setZ(count--);
+ emit sigsetLeft(getLeft());
+ emit sigsetTop(getTop());
+ emit sigsetWidth(getWidth());
+ emit sigsetHeight(getHeight());
+}
+
+k9MenuButton::k9MenuButton(QCanvas *parent, const char *name)
+ : QObject(parent, name),m_width(0),m_height(0)
+{
+ m_canvas=parent;
+ m_sprite=NULL;
+ m_pixmap=NULL;
+ m_text=new QCanvasText("",m_canvas);
+ m_text->setColor(Qt::yellow);
+
+}
+
+
+k9MenuButton::~k9MenuButton()
+{
+}
+
+void k9MenuButton::setImage(const QImage &_image) {
+ m_image=_image;
+ emit sigsetImage(this,_image);
+ loadImage();
+
+}
+
+void k9MenuButton::setImage(const QString &_fileName){
+ m_image.load(_fileName);
+ emit sigsetImage(this,m_image);
+ loadImage();
+}
+
+void k9MenuButton::loadImage() {
+ QImage tmp=m_image.smoothScale(m_width,m_height);
+ int x=0,y=0;
+ if (m_sprite) {
+ x=m_sprite->x();
+ y=m_sprite->y();
+ delete m_sprite;
+ }
+ QPixmap pix;
+ pix.convertFromImage(tmp);
+
+ m_pixmap=new QCanvasPixmap(pix,QPoint(0,0));
+
+
+ m_pixmapArray.setImage(0,m_pixmap);
+ m_sprite = new k9CanvasSprite(&m_pixmapArray,m_canvas,this);
+ m_sprite->move(x,y);
+ m_sprite->show();
+ update();
+ m_canvas->update();
+}
+
+void k9MenuButton::setWidth(int _value,bool _reload) {
+ m_width=_value;
+ emit sigsetWidth(_value);
+ if (_reload)
+ loadImage();
+}
+
+int k9MenuButton::getWidth() {
+ return m_width;
+}
+
+void k9MenuButton::setHeight(int _value,bool _reload) {
+ m_height=_value;
+ emit sigsetHeight(_value);
+ if (_reload)
+ loadImage();
+}
+
+int k9MenuButton::getHeight() {
+ return m_height;
+}
+
+void k9MenuButton::setTop(int _value,bool _reload) {
+ m_sprite->setY(_value);
+ emit sigsetTop(_value);
+ if (_reload)
+ loadImage();
+}
+
+void k9MenuButton::setLeft(int _value,bool _reload) {
+ m_sprite->setX(_value);
+ emit sigsetLeft(_value);
+ if (_reload)
+ loadImage();
+}
+
+int k9MenuButton::getTop() {
+ return m_sprite->y();
+}
+
+int k9MenuButton::getLeft() {
+ return m_sprite->x();
+}
+
+void k9MenuButton::setFont(QFont _font) {
+ m_text->setFont(_font);
+ update();
+ m_canvas->update();
+ emit sigsetFont(_font);
+}
+
+QFont k9MenuButton::getFont() {
+ return m_text->font();
+}
+
+void k9MenuButton::setColor(QColor _color) {
+ m_text->setColor(_color);
+ m_canvas->update();
+ emit sigsetColor(_color);
+}
+
+QColor k9MenuButton::getColor() {
+ return m_text->color();
+}
+
+void k9MenuButton::setText(QString _text) {
+ m_text->setText(_text);
+ update();
+ m_canvas->update();
+ emit sigsetText(_text);
+}
+
+QString k9MenuButton::getText() {
+ return m_text->text();
+}
+
+
+
+void k9MenuButton::moveBy(int _x,int _y,bool _reload) {
+ int x=getLeft();
+ int y=getTop();
+ m_sprite->moveBy(_x,_y);
+ emit sigsetLeft(x+_x);
+ emit sigsetTop(y+_y);
+
+ if(_reload)
+ loadImage();
+}
+#include "k9menubutton.moc"
+
+
+
+
+k9MenuButton::eTextPosition k9MenuButton::getTextPosition() const {
+ return m_textPosition;
+}
+
+
+void k9MenuButton::setTextPosition(const eTextPosition& _value) {
+ m_textPosition = _value;
+ update();
+ m_canvas->update();
+ emit sigsetTextPosition(_value);
+}
+
+
+QImage k9MenuButton::getImage() const {
+ return m_image;
+}
+
+
+QString k9MenuButton::getScript() const {
+ return m_script;
+}
+
+
+void k9MenuButton::setScript(const QString& _value) {
+ m_script = _value;
+}
+
+
+int k9MenuButton::getAngle() const {
+ return m_angle;
+}
+
+
+void k9MenuButton::setAngle(int _value) {
+ m_angle = _value;
+}
+
+
+k9CanvasSprite* k9MenuButton::getSprite() const {
+ return m_sprite;
+}
+
+
+int k9MenuButton::getNum() const {
+ return m_num;
+}
+
+
+void k9MenuButton::setNum(int _value) {
+ m_num = _value;
+}
diff --git a/k9author/k9menubutton.h b/k9author/k9menubutton.h
new file mode 100644
index 0000000..135340e
--- /dev/null
+++ b/k9author/k9menubutton.h
@@ -0,0 +1,116 @@
+//
+// C++ Interface: k9menubutton
+//
+// Description:
+//
+//
+// Author: Jean-Michel PETIT <k9copy@free.fr>, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#ifndef K9MENUBUTTON_H
+#define K9MENUBUTTON_H
+
+#include <qobject.h>
+#include <qpixmap.h>
+#include <qimage.h>
+#include <qcanvas.h>
+
+/**
+ @author Jean-Michel PETIT <k9copy@free.fr>
+*/
+class k9MenuButton;
+class k9CanvasSprite : public QCanvasSprite {
+public:
+ k9CanvasSprite (QCanvasPixmapArray *a,QCanvas *canvas,k9MenuButton *button);
+ virtual int rtti() const {
+ return 1000;
+ }
+ void update();
+
+ k9MenuButton* getButton() const;
+
+private:
+ k9MenuButton *m_button;
+};
+
+
+class k9MenuButton : public QObject {
+ Q_OBJECT
+public:
+ enum eTextPosition {BOTTOM=1,RIGHT=2};
+
+ k9MenuButton(QCanvas *parent = 0, const char *name = 0);
+
+ ~k9MenuButton();
+ void setWidth(int _value,bool _reload=true);
+ int getWidth();
+ void setHeight(int _value,bool _reload=true);
+ int getHeight();
+ void setTop(int _value,bool _reload=true);
+ void setLeft(int _value,bool _reload=true);
+ void setFont(QFont _font);
+ QFont getFont();
+ void setColor(QColor _color);
+ QColor getColor();
+ void setText(QString _text);
+ QString getText();
+ void select(bool);
+ int getTop();
+ int getLeft();
+
+ void moveBy(int x,int y,bool _reload=true);
+ void update();
+public slots:
+ void setImage(const QImage &_image);
+ void setImage(const QString &_fileName);
+
+ void setTextPosition(const eTextPosition& _value);
+ eTextPosition getTextPosition() const;
+
+ QImage getImage() const;
+
+ void setScript(const QString& _value);
+ QString getScript() const;
+
+ void setAngle(int _value);
+ int getAngle() const;
+
+ k9CanvasSprite* getSprite() const;
+
+ void setNum(int _value);
+
+
+ int getNum() const;
+
+
+
+private:
+ QCanvas *m_canvas;
+ QCanvasPixmapArray m_pixmapArray;
+ QCanvasPixmap *m_pixmap;
+ k9CanvasSprite *m_sprite;
+ int m_num;
+ QCanvasText *m_text;
+ QImage m_image;
+ int m_width;
+ int m_height;
+ int m_angle;
+ eTextPosition m_textPosition;
+ QString m_script;
+ void loadImage();
+signals:
+ void sigsetTop(int);
+ void sigsetLeft(int);
+ void sigsetWidth(int);
+ void sigsetHeight(int);
+
+ void sigsetFont(const QFont &);
+ void sigsetColor(const QColor &);
+ void sigsetImage(k9MenuButton *,const QImage &);
+ void sigsetText(const QString &);
+ void sigsetTextPosition(int);
+};
+
+#endif
diff --git a/k9author/k9menuedit.cpp b/k9author/k9menuedit.cpp
new file mode 100644
index 0000000..8ab0bc5
--- /dev/null
+++ b/k9author/k9menuedit.cpp
@@ -0,0 +1,319 @@
+//
+// C++ Implementation:
+//
+// Description:
+//
+//
+// Author: Jean-Michel PETIT <k9copy@free.fr>, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+
+#include "k9common.h"
+#include "k9menuedit.h"
+#include "k9menueditor.h"
+#include "k9menu.h"
+#include "k9title.h"
+#include "k9newdvd.h"
+#include <qwmatrix.h>
+#include <qlayout.h>
+#include <kfontdialog.h>
+#include "k9menubutton.h"
+#include <kurlrequester.h>
+#include <kcolorbutton.h>
+#include <qcombobox.h>
+#include <klocale.h>
+#include <qlabel.h>
+#include <kiconloader.h>
+
+
+
+
+k9MenuEdit::k9MenuEdit(QWidget* parent, const char* name,QCanvas *_canvas)
+ : menuEdit(parent,name) {
+ bAddText->setPixmap (SmallIcon("add"));
+ m_noUpdate=false;
+ m_canvas=_canvas;
+ m_format=PAL;
+ m_imageHeight=576;
+ QGridLayout *grid=new QGridLayout(frame,1,1);
+ m_menuEditor=new k9MenuEditor(*m_canvas,frame);
+ grid->addWidget(m_menuEditor,0,0);
+ m_canvas->resize(720,m_imageHeight);
+ m_text=NULL;
+ m_menuEditor->setMenu(this);
+ connect(m_menuEditor,SIGNAL(itemSelected()),this,SLOT(itemSelected()));
+ cbPosTitle->setEnabled(false);
+}
+void k9MenuEdit::updateTextPos(const QPoint &_point) {
+ emit updatePos(_point);
+}
+
+void k9MenuEdit::itemSelected() {
+ bool unselect=true;
+ m_noUpdate=true;
+ m_canvas->update();
+ urBackground->setURL("");
+ if (m_menuEditor->getSelected()) {
+ // m_menuEditor->getSelected()->select(true);
+ cbColor->setColor(m_menuEditor->getSelected()->getColor());
+ leTitle->setText(m_menuEditor->getSelected()->getText());
+ cbPosTitle->setEnabled(true);
+ cbPosTitle->setCurrentItem(m_menuEditor->getSelected()->getTextPosition()-1);
+ urBackground->setEnabled(true);
+ m_canvas->update();
+ } else if (m_menuEditor->getMoving()) {
+ if (m_menuEditor->getMoving()->rtti()==QCanvasItem::Rtti_Text) {
+ m_text=(QCanvasText*)m_menuEditor->getMoving();
+ leTitle->setText(m_text->text());
+ cbColor->setColor(m_text->color());
+ cbPosTitle->setEnabled(false);
+ urBackground->setEnabled(false);
+ }
+ } else {
+ urBackground->setEnabled(true);
+ cbPosTitle->setEnabled(false);
+ }
+ m_noUpdate=false;
+}
+
+
+
+
+
+k9MenuEdit::~k9MenuEdit() {}
+
+/*$SPECIALIZATION$*/
+
+
+void k9MenuEdit::bFontClick() {
+ if (m_menuEditor->getSelected()) {
+ k9MenuButton *b=m_menuEditor->getSelected();
+ QFont myFont(b->getFont());
+ int result = KFontDialog::getFont( myFont );
+ if ( result == KFontDialog::Accepted && m_menuEditor->getSelected() ) {
+ QPtrList <k9MenuButton> *l=m_menuEditor->getSelection();
+ for (b=l->first();b;b=l->next()) {
+ b->setFont(myFont);
+ }
+ }
+ } else {
+ if (m_text) {
+ QFont myFont(m_text->font());
+ int result = KFontDialog::getFont( myFont );
+ if ( result == KFontDialog::Accepted )
+ setFont(myFont);
+ }
+
+ }
+}
+
+void k9MenuEdit::urBackgroundSelected(const QString &_fileName) {
+ if ( m_menuEditor->getSelected() ) {
+//If a button is selected, set the button image ...
+ k9MenuButton *b=(k9MenuButton*)m_menuEditor->getSelected();
+ QImage img;
+ img.load(_fileName);
+ b->setImage(img);
+ } else {
+//...otherwise, set the menu background image
+ QImage img;
+ img.load(_fileName);
+ img=img.smoothScale(720,m_imageHeight,QImage::ScaleMax);
+ setBackgroundImage(img);
+ }
+}
+
+void k9MenuEdit::cbColorChanged(const QColor &_color) {
+ if (m_noUpdate)
+ return;
+ if ( m_menuEditor->getSelected() ) {
+ QPtrList <k9MenuButton> *l=m_menuEditor->getSelection();
+ for (k9MenuButton *b=l->first();b;b=l->next()) {
+ b->setColor(_color);
+ }
+ //m_menuEditor->getSelected()->setColor(_color);
+ } else {
+ setColor(_color);
+ }
+
+}
+
+void k9MenuEdit::cbPosTitleActivated(int _value) {
+ if (m_noUpdate)
+ return;
+ if ( m_menuEditor->getSelected() ) {
+ QPtrList <k9MenuButton> *l=m_menuEditor->getSelection();
+ for (k9MenuButton *b=l->first();b;b=l->next()) {
+ b->setTextPosition((k9MenuButton::eTextPosition)(_value+1));
+ }
+ }
+}
+
+void k9MenuEdit::setBackgroundImage(const QImage &_image) {
+ m_background=_image;
+ m_canvas->setBackgroundPixmap(QPixmap(_image));
+ emit backgroundImageChanged(_image);
+}
+
+void k9MenuEdit::leTitleChanged(const QString &_value) {
+ if (m_noUpdate)
+ return;
+ if ( m_menuEditor->getSelected() ) {
+ QPtrList <k9MenuButton> *l=m_menuEditor->getSelection();
+ for (k9MenuButton *b=l->first();b;b=l->next()) {
+ QString c=_value;
+ b->setText(c.replace("%n",QString::number(b->getNum())));
+ }
+ //m_menuEditor->getSelected()->setText(_value);
+ } else {
+ setText(_value);
+ }
+}
+
+#include "k9menuedit.moc"
+
+
+
+
+
+void k9MenuEdit::setText(const QString &_value) {
+ if (m_text)
+ m_text->setText(_value);
+ m_canvas->update();
+ emit textChanged(_value);
+}
+
+void k9MenuEdit::setFont(const QFont &_value) {
+ if (m_text)
+ m_text->setFont(_value);
+ m_canvas->update();
+ emit textFontChanged(_value);
+}
+
+void k9MenuEdit::setColor(const QColor &_value) {
+ if (m_text)
+ m_text->setColor(_value);
+ m_canvas->update();
+ emit textColorChanged(_value);
+}
+
+QCanvasText* k9MenuEdit::getText() const {
+ return m_text;
+}
+
+
+k9MenuEdit::eFormat k9MenuEdit::getFormat() const {
+ return m_format;
+}
+
+
+void k9MenuEdit::setFormat(const eFormat& _value) {
+ m_format = _value;
+ if (_value==NTSC)
+ m_imageHeight=480;
+ else
+ m_imageHeight=576;
+ QPixmap pix=m_canvas->backgroundPixmap();
+ QImage img=pix.convertToImage().smoothScale(720,m_imageHeight);
+ m_canvas->resize(720,m_imageHeight);
+ m_menuEditor->setMaximumSize(QSize(724,m_imageHeight+4));
+ m_canvas->setBackgroundPixmap(QPixmap(img));
+}
+
+
+QCanvas *k9MenuEdit::getCanvas() {
+ return m_canvas;
+}
+
+
+void k9MenuEdit::setCanvas(QCanvas* _value) {
+ m_canvas = _value;
+ m_text=NULL;
+ m_menuEditor->setCanvas(_value);
+ m_canvas->resize(720,m_imageHeight);
+ m_canvas->update();
+ m_menuEditor->updateContents();
+}
+
+void k9MenuEdit::titleSelected(k9Title *_title) {
+ disconnect (this,SIGNAL(startScriptChanged(const QString&)),0,0);
+ disconnect (this,SIGNAL(endScriptChanged(const QString&)),0,0);
+ cbEnd->setEnabled(true);
+ m_menuEditor->clearSelection();
+ lTitle->setText(i18n("Title %1 Menu").arg(_title->getNum()+1));
+ setCanvas(_title->getMenu()->getCanvas());
+ m_menuType=TITLEMENU;
+ cbStart->clear();
+ cbEnd->clear();
+ m_startScripts.clear();
+ m_endScripts.clear();
+
+
+ cbStart->insertItem(i18n("Play Menu"));
+ m_startScripts << "";
+ cbStart->insertItem(i18n("Play Title"));
+ m_startScripts << "if (g1==0) {g1=1; jump title 1 chapter 1;}";
+ if (_title->getMenu()->getStartScript() !="")
+ cbStart->setCurrentItem(cbStart->count()-1);
+ connect (this,SIGNAL(startScriptChanged(const QString&)),_title->getMenu(),SLOT(setStartScript(const QString&)));
+
+ cbEnd->insertItem(i18n("Play Root Menu"));
+ m_endScripts << "g6=0; call vmgm menu;";
+ cbEnd->insertItem(i18n("Play Title Menu"));
+ m_endScripts << "call menu;";
+ k9NewDVD *newDVD=(k9NewDVD*)_title->parent() ;
+ k9NewDVDItems *items=newDVD->getTitles();
+ for (k9Title *title=items->first();title;title=items->next()) {
+ cbEnd->insertItem(i18n("Play Title %1").arg(title->getNum()+1));
+ QString script=QString("g6=%1; call vmgm menu;" ).arg(title->getNum()+1);
+ m_endScripts << script;
+ }
+ for (int i=0;i<m_endScripts.count();i++ ){
+ if (_title->getMenu()->getEndScript()== *(m_endScripts.at(i)))
+ cbEnd->setCurrentItem(i);
+ }
+ connect (this,SIGNAL(endScriptChanged(const QString&)),_title->getMenu(),SLOT(setEndScript(const QString&)));
+
+}
+
+void k9MenuEdit::rootSelected(k9NewDVD *_newDVD) {
+ disconnect (this,SIGNAL(startScriptChanged(const QString&)),0,0);
+ disconnect (this,SIGNAL(endScriptChanged(const QString&)),0,0);
+ cbEnd->setEnabled(false);
+ m_menuEditor->clearSelection();
+ lTitle->setText(i18n("Root Menu"));
+ setCanvas(_newDVD->getRootMenu()->getCanvas());
+ m_menuType=ROOTMENU;
+ cbStart->clear();
+ m_startScripts.clear();
+ cbStart->insertItem(i18n("Play Menu"));
+ m_startScripts << "";
+ k9NewDVDItems *items=_newDVD->getTitles();
+ for (k9Title *title=items->first();title;title=items->next()) {
+ cbStart->insertItem(i18n("Play Title %1").arg(title->getNum()+1));
+ // QString script=QString("if (g5==0) {g5=1; jump title %1;}" ).arg(title->getNum()+1);
+ QString script=QString("g6=%1;" ).arg(title->getNum()+1);
+ m_startScripts << script;
+ if (script==_newDVD->getRootMenu()->getStartScript())
+ cbStart->setCurrentItem(cbStart->count()-1);
+ }
+ connect (this,SIGNAL(startScriptChanged(const QString&)),_newDVD->getRootMenu(),SLOT(setStartScript(const QString&)));
+}
+
+void k9MenuEdit::bAddTextClick() {
+ m_text=new QCanvasText(m_canvas);
+ m_text->show();
+ m_menuEditor->setMoving(m_text);
+ setText(leTitle->text());
+ setColor(cbColor->color());
+}
+
+void k9MenuEdit::cbStartActivated (int _value) {
+ emit startScriptChanged(m_startScripts[_value]);
+}
+
+void k9MenuEdit::cbEndActivated (int _value) {
+ emit endScriptChanged(m_endScripts[_value]);
+}
diff --git a/k9author/k9menuedit.h b/k9author/k9menuedit.h
new file mode 100644
index 0000000..f11a6b7
--- /dev/null
+++ b/k9author/k9menuedit.h
@@ -0,0 +1,85 @@
+//
+// C++ Interface:
+//
+// Description:
+//
+//
+// Author: Jean-Michel PETIT <k9copy@free.fr>, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+
+#ifndef K9MENUEDIT_H
+#define K9MENUEDIT_H
+
+#include "../k9author/menuEdit.h"
+#include <qcanvas.h>
+#include <qimage.h>
+
+class k9MenuButton;
+class k9MenuEdit;
+class k9Title;
+class k9NewDVD;
+class k9MenuEditor;
+
+
+class k9MenuEdit : public menuEdit {
+ Q_OBJECT
+public:
+ enum eFormat {PAL=1,NTSC=2};
+ enum eMenuType {ROOTMENU,TITLEMENU};
+
+ k9MenuEdit(QWidget* parent = 0, const char* name = 0,QCanvas *_canvas=0);
+ ~k9MenuEdit();
+ /*$PUBLIC_FUNCTIONS$*/
+ void setBackgroundImage(const QImage &_image);
+ void setText(const QString &_value);
+ void setFont(const QFont &_value);
+ void setColor(const QColor &_value);
+ void updateTextPos(const QPoint &_point);
+public slots:
+ /*$PUBLIC_SLOTS$*/
+ void itemSelected();
+ QCanvasText* getText() const;
+ void setFormat(const eFormat& _value);
+ k9MenuEdit::eFormat getFormat() const;
+ QCanvas *getCanvas();
+ void setCanvas(QCanvas* _value);
+ void titleSelected(k9Title *);
+ void rootSelected(k9NewDVD *);
+
+protected:
+ /*$PROTECTED_FUNCTIONS$*/
+ virtual void bFontClick();
+ virtual void urBackgroundSelected(const QString &_fileName);
+ virtual void cbColorChanged(const QColor &_color);
+ virtual void leTitleChanged(const QString &_value);
+ virtual void cbPosTitleActivated(int _value);
+ virtual void bAddTextClick();
+ virtual void cbStartActivated (int _value);
+ virtual void cbEndActivated (int _value);
+ k9MenuEditor *m_menuEditor;
+ QCanvas *m_canvas;
+ QImage m_background;
+ QCanvasText *m_text;
+ eFormat m_format;
+ int m_imageHeight;
+ eMenuType m_menuType;
+ QStringList m_startScripts;
+ QStringList m_endScripts;
+ bool m_noUpdate;
+protected slots:
+ /*$PROTECTED_SLOTS$*/
+signals:
+ void backgroundImageChanged(const QImage &);
+ void textChanged(const QString&);
+ void startScriptChanged(const QString&);
+ void endScriptChanged(const QString&);
+ void textColorChanged(const QColor &);
+ void textFontChanged(const QFont&);
+ void updatePos(const QPoint &);
+};
+
+#endif
+
diff --git a/k9author/k9menueditor.cpp b/k9author/k9menueditor.cpp
new file mode 100644
index 0000000..1af07a1
--- /dev/null
+++ b/k9author/k9menueditor.cpp
@@ -0,0 +1,237 @@
+//
+// C++ Implementation: k9menueditor
+//
+// Description:
+//
+//
+// Author: Jean-Michel PETIT <k9copy@free.fr>, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#include "k9menueditor.h"
+#include "k9menubutton.h"
+#include "k9menuedit.h"
+#include "k9canvasselection.h"
+#include <qwmatrix.h>
+#include <qcursor.h>
+#include <kcursor.h>
+k9MenuEditor::k9MenuEditor(
+ QCanvas& c, QWidget* parent,
+ const char* name, WFlags f) :
+ QCanvasView(&c,parent,name,f) {
+ this->setMaximumSize(QSize(724,580));
+ moving=NULL;
+ m_canvasSelection=new k9CanvasSelection(this);
+ viewport()->setMouseTracking(true);
+}
+
+
+void k9MenuEditor::contentsMouseReleaseEvent(QMouseEvent* e) {
+ m_canvasSelection->release();
+ emit itemSelected();
+}
+
+
+void k9MenuEditor::contentsMousePressEvent(QMouseEvent* e) {
+ QPoint p = inverseWorldMatrix().map(e->pos());
+ moving_start = p;
+ QCanvasItemList l=canvas()->collisions(p);
+ moving=0;
+ for (QCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it) {
+ QCanvasItem *item=*it;
+ if (item->rtti()==QCanvasItem::Rtti_Rectangle)
+ moving = item;
+ if (item->rtti()>2000) {
+ moving=item;
+ return;
+ }
+ }
+ if (moving)
+ return;
+ for (QCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it) {
+// if ((*it)->rtti()==QCanvasItem::Rtti_Rectangle)
+// continue;
+ moving = *it;
+ if (moving->rtti()==1000) {
+ if (e->state() & QMouseEvent::ControlButton)
+ addSelection(moving);
+ else {
+ if (!isSelected(moving)) {
+ clearSelection();
+ addSelection(moving);
+ }
+ }
+ m_canvasSelection->setPosition(p);
+ m_canvasSelection->drawSelection();
+ } else if (moving->rtti() <1001 )
+ clearSelection();
+ emit itemSelected();
+ return;
+ }
+ m_canvasSelection->setPosition(p);
+ clearSelection();
+ emit itemSelected();
+}
+
+void k9MenuEditor::clear() {
+ QCanvasItemList list = canvas()->allItems();
+ QCanvasItemList::Iterator it = list.begin();
+ for (; it != list.end(); ++it) {
+ if ( *it )
+ delete *it;
+ }
+}
+
+void k9MenuEditor::clearSelection() {
+ for (k9MenuButton *b=m_selection.first();b;b=m_selection.next())
+ b->select(false);
+ m_selection.clear();
+}
+
+bool k9MenuEditor::isSelected(QCanvasItem *_item) {
+ k9CanvasSprite *s=(k9CanvasSprite *)_item;
+ k9MenuButton *button=s->getButton();
+ if (m_selection.find(button) !=-1)
+ return true;
+ else
+ return false;
+}
+
+void k9MenuEditor::addSelection(QCanvasItem *_item) {
+ k9CanvasSprite *s=(k9CanvasSprite *)_item;
+ k9MenuButton *button=s->getButton();
+ if (m_selection.find(button) !=-1) {
+ button->select(false);
+ m_selection.remove(button);
+ } else {
+ button->select(true);
+ m_selection.append(button);
+ }
+}
+
+void k9MenuEditor::updateCursor(QMouseEvent *e) {
+ QPoint p = inverseWorldMatrix().map(e->pos());
+ QCanvasItemList l=canvas()->collisions(p);
+ for (QCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it) {
+ QCanvasItem *item=*it;
+ switch (item->rtti()) {
+ case QCanvasItem::Rtti_Rectangle :
+ setCursor(KCursor::sizeAllCursor());
+ return;
+ case 2002 :
+ case 2008:
+ setCursor(KCursor::sizeFDiagCursor());
+ return;
+ case 2003:
+ case 2007:
+ setCursor(KCursor::sizeVerCursor());
+ return;
+ case 2004:
+ case 2006:
+ setCursor(KCursor::sizeBDiagCursor());
+ return;
+ case 2005:
+ case 2009:
+ setCursor(KCursor::sizeHorCursor());
+ return;
+ default:
+ setCursor(KCursor::arrowCursor());
+ }
+ }
+ setCursor(KCursor::arrowCursor());
+}
+
+void k9MenuEditor::contentsMouseMoveEvent(QMouseEvent* e) {
+ updateCursor(e);
+ if ( moving && (e->state() & Qt::LeftButton ==Qt::LeftButton) ) {
+ if (moving->rtti() !=QCanvasItem::Rtti_Text || moving==m_menu->getText()) {
+ QPoint p = inverseWorldMatrix().map(e->pos());
+ int offsetX=p.x() - moving_start.x();
+ int offsetY=p.y() - moving_start.y();
+ moving_start = p;
+ if (moving->rtti()==1000 || moving->rtti() == QCanvasItem::Rtti_Rectangle) {
+ for (k9MenuButton *b=m_selection.first();b;b=m_selection.next()) {
+ k9CanvasSprite*spr=b->getSprite();
+ spr->moveBy(offsetX,offsetY);
+ spr->update();
+ }
+
+ } else
+ moving->moveBy(offsetX,offsetY);
+
+ if (moving->rtti() >2001 && moving->rtti() <2010) {
+ k9CanvasSelectionRedim *ssr=(k9CanvasSelectionRedim*)moving;
+ ssr->updateSelection();
+ } else if (moving->rtti() != QCanvasItem::Rtti_Text ){
+ //if selection not resized, move the selection
+ m_canvasSelection->moveBy(offsetX,offsetY);
+ m_canvasSelection->update();
+ }
+
+ if (moving==m_menu->getText())
+ emit m_menu->updateTextPos(QPoint(moving->x(),moving->y()));
+ canvas()->update();
+ }
+ } else if ((e->state() & Qt::LeftButton) ==Qt::LeftButton ) {
+ m_canvasSelection->hide();
+ canvas()->update();
+ QPoint p = inverseWorldMatrix().map(e->pos());
+ int offsetX=p.x() - moving_start.x();
+ int offsetY=p.y() - moving_start.y();
+ m_canvasSelection->setSize(offsetX,offsetY);
+ m_canvasSelection->show();
+ canvas()->update();
+ clearSelection();
+ QCanvasItemList l=canvas()->collisions(m_canvasSelection->getRect());
+ for (QCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it) {
+ QCanvasItem *item = *it;
+ if (item->rtti()==1000) {
+ addSelection(item);
+ }
+ }
+ }
+}
+
+void k9MenuEditor::resizeEvent ( QResizeEvent * e ) {
+ QWMatrix m;
+ double scalex=(e->size().width()-4.0)/720.0;
+ double scaley=(e->size().height()-4.0)/576.0;
+ m.scale(QMIN(scalex,scaley),QMIN(scalex,scaley));
+ this->setWorldMatrix(m);
+
+}
+
+k9MenuButton * k9MenuEditor::getSelected() {
+/* if (moving) {
+ if (moving->rtti()==1000) {
+ k9CanvasSprite *s=(k9CanvasSprite *)moving;
+ return s->getButton();
+ }
+ }
+*/
+ if (m_selection.count() >0)
+ return m_selection.first();
+ return NULL;
+}
+
+QCanvasItem* k9MenuEditor::getMoving() const {
+ return moving;
+}
+
+
+void k9MenuEditor::setMoving(QCanvasItem* _value) {
+ moving = _value;
+}
+
+
+
+QPtrList< k9MenuButton > *k9MenuEditor::getSelection() {
+ return &m_selection;
+}
+
+void k9MenuEditor::hideSelection() {
+ m_canvasSelection->hide();
+}
+
+#include "k9menueditor.moc"
diff --git a/k9author/k9menueditor.h b/k9author/k9menueditor.h
new file mode 100644
index 0000000..53c1921
--- /dev/null
+++ b/k9author/k9menueditor.h
@@ -0,0 +1,64 @@
+//
+// C++ Interface: k9menueditor
+//
+// Description:
+//
+//
+// Author: Jean-Michel PETIT <k9copy@free.fr>, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#ifndef K9MENUEDITOR_H
+#define K9MENUEDITOR_H
+
+#include <qcanvas.h>
+
+/**
+ @author Jean-Michel PETIT <k9copy@free.fr>
+*/
+
+class k9MenuButton;
+class k9MenuEdit;
+class k9CanvasSelection;
+class k9MenuEditor : public QCanvasView {
+ Q_OBJECT
+
+public:
+ k9MenuEditor(QCanvas&, QWidget* parent=0, const char* name=0, WFlags f=0);
+ void clear();
+
+ k9MenuButton* getSelected() ;
+ void setMenu(k9MenuEdit *_menu) {
+ m_menu=_menu;
+ }
+
+ QCanvasItem* getMoving() const;
+
+ void setMoving(QCanvasItem* _value);
+ QPtrList< k9MenuButton > *getSelection() ;
+ void clearSelection();
+ void hideSelection();
+protected:
+ void contentsMousePressEvent(QMouseEvent*);
+ void contentsMouseMoveEvent(QMouseEvent*);
+ void contentsMouseReleaseEvent(QMouseEvent* e);
+ void updateCursor(QMouseEvent *e);
+ virtual void resizeEvent ( QResizeEvent * e );
+ void addSelection(QCanvasItem *_item);
+ bool isSelected(QCanvasItem *_item);
+ void drawSelection();
+signals:
+ void status(const QString&);
+ void itemSelected();
+
+private:
+ QCanvasItem* moving;
+ QCanvasRectangle *m_rect;
+ QPoint moving_start;
+ k9MenuEdit *m_menu;
+ QPtrList <k9MenuButton> m_selection;
+ k9CanvasSelection *m_canvasSelection;
+};
+
+#endif
diff --git a/k9author/k9newdvd.cpp b/k9author/k9newdvd.cpp
new file mode 100644
index 0000000..7cc73bd
--- /dev/null
+++ b/k9author/k9newdvd.cpp
@@ -0,0 +1,439 @@
+//
+// C++ Implementation: k9newdvd
+//
+// Description:
+//
+//
+// Author: Jean-Michel PETIT <k9copy@free.fr>, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#include "k9newdvd.h"
+#include "k9title.h"
+#include "k9tools.h"
+#include <qfile.h>
+#include <stdio.h>
+#include <qtextstream.h>
+#include <kstandarddirs.h>
+#include <qapplication.h>
+#include <ktempfile.h>
+#include <kapplication.h>
+#include <klocale.h>
+#include <qimage.h>
+#include <kmessagebox.h>
+#include "k9menu.h"
+#include "k9menubutton.h"
+#include "k9processlist.h"
+#include <qthread.h>
+#include <qfileinfo.h>
+
+k9NewDVD::k9NewDVD(QObject *parent, const char *name)
+ : QObject(parent, name) {
+ m_workDir=locateLocal("tmp", "k9copy/" ) ;
+ m_rootMenu=new k9Menu(this);
+ m_format=PAL;
+}
+
+
+k9NewDVD::~k9NewDVD() {}
+
+int k9NewDVDItems::compareItems(QPtrCollection::Item item1,QPtrCollection::Item item2) {
+ k9Title *_i1=(k9Title*) item1;
+ k9Title *_i2=(k9Title*) item2;
+
+ return (_i1->getNum() - _i2->getNum());
+
+
+}
+
+void k9NewDVD::execute() {
+ m_cancel=false;
+ m_error="";
+ m_config=new k9Config();
+ // connect(m_process, SIGNAL(receivedStderr(KProcess *, char *, int)),this, SLOT(getStderr(KProcess *, char *, int) ));
+
+ connect(&m_aviDecode,SIGNAL(drawFrame(QImage*)),this,SLOT(drawImage(QImage*)));
+ k9Tools::clearOutput(m_workDir+"dvd");
+ createXML();
+ disconnect(&m_aviDecode,SIGNAL(drawFrame(QImage*)),this,SLOT(drawImage(QImage*)));
+ delete m_config;
+}
+
+#include "k9newdvd.moc"
+
+
+void k9NewDVD::drawImage(QImage * _image) {
+// m_progress->setImage(*_image);
+}
+
+void k9NewDVD::setFormat ( const eFormat& _value ) {
+ m_format = _value;
+ m_rootMenu->setFormat((k9Menu::eFormat)_value);
+ for (k9Title *title=m_titles.first();title;title=m_titles.next()) {
+ title->getMenu()->setFormat((k9Menu::eFormat)_value);
+ }
+
+}
+
+void k9NewDVD::createXML() {
+
+ m_rootMenu->setWorkDir(m_workDir);
+
+ QString menuFileName=m_workDir+KApplication::randomString(8)+".mpg";
+ m_rootMenu->setMenuFileName(menuFileName);
+
+ m_xml=new QDomDocument();
+ QDomElement root = m_xml->createElement( "dvdauthor" );
+ root.setAttribute ("dest",m_workDir+"dvd");
+ m_xml->appendChild( root );
+
+ // Create vmgm menu
+ QDomElement vmgm = m_xml->createElement("vmgm");
+ root.appendChild(vmgm);
+ m_processList->addProgress(i18n("Creating root menu"));
+ m_rootMenu->createMenus(&vmgm);
+
+ addTitles(root);
+ m_processList->execute();
+ m_totalEncodedSize=0;
+ m_offset=0;
+ m_lastvalue=0;
+ for ( QStringList::Iterator it = m_tmpFiles.begin(); it != m_tmpFiles.end(); ++it ) {
+ QString file= *it;
+ if (file.endsWith(".mpeg")) {
+ QFileInfo f(file);
+ m_totalEncodedSize+=f.size();
+ }
+ }
+ m_totalEncodedSize/=1024*1024;
+ m_cancel=m_processList->getCancel();
+ bool error=false;
+ if (!m_cancel) {
+ QString dvdAuthor(m_workDir+"/"+KApplication::randomString(8)+".xml");
+ QFile file( dvdAuthor);
+
+ file.open(IO_WriteOnly);
+ QTextStream stream( &file );
+ m_xml->save(stream,1);
+ file.close();
+
+ m_processList->clear();
+ k9Process *process=m_processList->addProcess(i18n("authoring"));
+ connect(process, SIGNAL(receivedStderr(KProcess *, char *, int)),this, SLOT(getStderr(KProcess *, char *, int) ));
+ *process << "dvdauthor" << "-x" << dvdAuthor;
+ m_processList->execute();
+ m_cancel=m_processList->getCancel();
+ error=m_processList->getError();
+ // else
+ // m_error=i18n("An error occured while running dvdauthor");
+
+ file.remove();
+ }
+ if (m_cancel)
+ m_error=i18n("The dvd authoring was canceled");
+ else if (error)
+ m_error=i18n("An error occured while running DVDAuthor:\n")+ m_stdout;
+ QFile::remove(menuFileName);
+ for ( QStringList::Iterator it = m_tmpFiles.begin(); it != m_tmpFiles.end(); ++it ) {
+ QFile::remove(*it);
+ }
+ m_tmpFiles.clear();
+ if (m_error !="") {
+ KMessageBox::error( 0, m_error, i18n("Authoring"));
+ }
+ delete m_xml;
+
+}
+
+void k9NewDVD::addTitles (QDomElement &_root) {
+ calcVideoBitrate();
+ for (k9Title *title=m_titles.first();title && !m_cancel;title=m_titles.next()) {
+ QDomElement titleSet = m_xml->createElement("titleset");
+ _root.appendChild(titleSet);
+ QDomElement pgc;
+ k9Menu *menu=title->getMenu();
+ menu->setWorkDir(m_workDir);
+ QString menuFileName=m_workDir+KApplication::randomString(8)+".mpg";
+ m_tmpFiles << menuFileName,
+ menu->setMenuFileName(menuFileName);
+ m_processList->addProgress(i18n("Creating menu for title %1").arg(title->getNum()+1));
+ menu->createMenus(&titleSet);
+
+ QDomElement eTitle=m_xml->createElement("titles");
+ titleSet.appendChild(eTitle);
+ QDomElement e=m_xml->createElement("video");
+ e.setAttribute("aspect","16:9");
+ e.setAttribute("format",m_format==PAL?"PAL":"NTSC");
+// if (l_track->getaspectRatio()!="4:3") {
+ e.setAttribute("widescreen","nopanscan");
+// }setProgressWindow
+ eTitle.appendChild(e);
+
+ e=m_xml->createElement("audio");
+ e.setAttribute("format","ac3");
+ e.setAttribute("channels","2");
+ eTitle.appendChild(e);
+
+ pgc=m_xml->createElement("pgc");
+ eTitle.appendChild(pgc);
+ QDomElement post=m_xml->createElement("post");
+ pgc.appendChild(post);
+ QDomText txt=m_xml->createTextNode(title->getMenu()->getEndScript());
+ post.appendChild(txt);
+
+ QPtrList <k9AviFile > *l=title->getFiles();
+ for (k9AviFile *aviFile= l->first();aviFile && !m_cancel;aviFile=l->next()) {
+ if ( aviFile->getPrevious()==NULL || aviFile->getBreakPrevious()) {
+ QString cmd="",chapters="";
+ createMencoderCmd(cmd,chapters,aviFile);
+ e=m_xml->createElement("vob");
+ e.setAttribute("file",cmd);
+ e.setAttribute("chapters",chapters);
+ pgc.appendChild(e);
+ m_tmpFiles << cmd;
+ }
+ }
+ }
+
+}
+
+void k9NewDVD::setWorkDir ( const QString& _value ) {
+ m_workDir = _value;
+ if (!m_workDir.endsWith("/"))
+ m_workDir +="/";
+}
+
+void k9NewDVD::createMencoderCmd(QString &_cmd,QString &_chapters, k9AviFile *_aviFile) {
+ // m_aviDecode.open(_aviFile->getFileName());
+ m_timer.start();
+ m_timer2.start();
+ m_timer3.start();
+ QTime end;
+ k9AviFile *file=_aviFile;
+ bool bEnd;
+ _chapters="0";
+ do {
+ end=file->getEnd();
+ bEnd= (file->getNext()==NULL) || (file->getBreakNext());
+ file=file->getNext();
+ if (!bEnd) {
+ int lt=_aviFile->getStart().msecsTo(end);
+ QTime t;
+ t=t.addMSecs(lt);
+ _chapters +="," + t.toString("hh:mm:ss");
+ }
+ } while (!bEnd);
+
+ QString fileName= m_workDir + KApplication::randomString(8)+".mpeg";
+ QString t1=_aviFile->getStart().toString("hh:mm:ss.zzz");
+ int length=_aviFile->getStart().msecsTo(end);
+ QTime l;
+ l=l.addMSecs(length);
+ QString t2=l.toString("hh:mm:ss.zzz");
+ QString scale;
+ QString fps;
+ switch (m_format) {
+ case PAL:
+ scale="720:576";
+ fps="25";
+ break;
+ case NTSC:
+ scale="720:480";
+ fps="30000/1001";
+ break;
+ }
+
+ k9Process *process=m_processList->addProcess(i18n("Encoding %1").arg(_aviFile->getFileName()));
+ m_processList->setFileName(process,_aviFile->getFileName());
+
+ QTime t(0,0);
+ t.start();
+ m_timers[process]=t;
+ connect(process, SIGNAL(receivedStdout(KProcess *, char *, int)),this, SLOT(getStdout(KProcess *, char *, int) ));
+ //m_progress->setTitle(i18n("Encoding file"));
+ //m_process->clearArguments();
+ *process << "mencoder" << "-oac" << "lavc" << "-ovc" << "lavc" << "-of" << "mpeg" <<"-afm" <<"libmad";
+ *process << "-mpegopts" << "format=dvd" << "-vf" << "scale="+scale+",harddup" << "-srate" << "48000" << "-af" << "lavcresample=48000";
+ *process << "-lavcopts" << QString("vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=%1:keyint=15:acodec=%3:abitrate=%2:aspect=16/9").arg(m_videoBitrate).arg(m_config->getPrefAudioBitrate()).arg(m_config->getPrefAudioFormat().lower());
+ *process << "-ofps" << fps << "-o" << fileName << "-ss" << t1 << "-endpos" << t2 << _aviFile->getFileName();
+ qDebug(process->debug());
+/*
+ if (!m_progress->execute()) {
+ m_cancel=true;
+ if (m_progress->getCanceled())
+ m_error=i18n("The dvd authoring was canceled");
+ else
+ m_error=i18n("An error occured while transcoding video");
+ }
+*/
+
+ _cmd=fileName;
+// m_aviDecode.close();
+}
+
+void k9NewDVD::getStderr(KProcess *_process, char *_buffer, int _length) {
+ QCString tmp(_buffer,_length);
+ m_stdout=tmp;
+ int pos;
+ if (tmp.contains("STAT:")) {
+ pos=tmp.find("fixing VOBU");
+ if (pos!=-1) {
+ QString tmp2=tmp;
+// m_progress->setTitle(i18n("Authoring"));
+// m_progress->setLabelText(i18n("Fixing VOBUS"));
+ int end=tmp2.find("%");
+ if (end!=-1) {
+ pos =end -2;
+ tmp2=tmp2.mid(pos,end-pos);
+ tmp2=tmp2.stripWhiteSpace();
+// m_progress->setProgress(tmp2.toInt(),100);
+ }
+ } else {
+ pos=tmp.find("STAT: VOBU ");
+ if (pos !=-1) {
+ QCString tmp2(_buffer+pos,_length-pos);
+ int vobu,mb;
+ sscanf(tmp2.data(),"STAT: VOBU %d at %dMB",&vobu,&mb);
+ if (mb <m_lastvalue)
+ m_offset+=m_lastvalue;
+ m_lastvalue=mb;
+ m_processList->setProgress((k9Process*)_process,mb+m_offset,m_totalEncodedSize);
+ }
+ }
+
+//STAT: VOBU 16 at 3MB, 1 PGCS
+
+ }
+
+}
+
+void k9NewDVD::getStdout(KProcess *_process, char *_buffer, int _length) {
+ k9Process *process=(k9Process*) _process;
+ if (m_timers[process].elapsed() >500) {
+ QCString tmp(_buffer,_length);
+ int pos=tmp.find("Pos:");
+ if (pos!=-1) {
+ QString tmp2=tmp.mid(pos);
+ tmp2=tmp2.replace(":",": ").replace("(","").replace(")","").simplifyWhiteSpace();
+ QStringList sl=QStringList::split(" ",tmp2);
+ float position;
+ sscanf(sl[1].latin1(),"%fs",&position);
+ int frame;
+ sscanf(sl[2].latin1(),"%df",&frame);
+ int percent;
+ sscanf(sl[3].latin1(),"%d",&percent);
+ int fps;
+ sscanf(sl[4].latin1(),"%d",&fps);
+ m_processList->setProgress(process,percent,100);
+ m_processList->setPos(process,position);
+ //m_progress->setProgress(percent,100);
+ // if (percent>0 &&m_timer3.elapsed() >1000 ) {
+ if (percent>0 ) {
+ int elapsed=process->getElapsed();
+ QTime time2(0,0);
+ time2=time2.addMSecs(elapsed);
+ QTime time3(0,0);
+ float fprc=percent/100.0;
+ time3=time3.addMSecs((uint32_t)(elapsed*(1.0/fprc)));
+ m_processList->setText(process,time2.toString("hh:mm:ss") +" / " + time3.toString("hh:mm:ss"),1);
+ m_timer3.restart();
+ }
+
+ QString text;//=i18n("filename") + " : " + m_aviDecode.getFileName();
+ text=i18n("fps")+ " : "+QString::number(fps);
+ m_processList->setText(process,text,2);
+ /*
+ m_progress->setLabelText(text);
+ if (m_timer.elapsed() > 5000) {
+ m_timer.restart();
+ if (m_aviDecode.opened()) {
+ m_aviDecode.readFrame(position);
+ }
+ }
+ */
+ }
+ m_timers[process].restart();
+ }
+}
+
+void k9NewDVD::appendTitle(k9Title *_title) {
+ m_config=new k9Config();
+ m_titles.append(_title);
+ m_titles.sort();
+ //create the menu button
+ k9MenuButton *btn=m_rootMenu->addButton();
+ _title->setButton(btn);
+ btn->setNum(_title->getNum()+1);
+ QPixmap px(m_config->getPrefButtonWidth(),m_config->getPrefButtonHeight());
+ px.fill(Qt::black);
+ QImage img=px.convertToImage();
+ btn->setImage(img);
+ int nbColumn=(720-50)/(m_config->getPrefButtonWidth()+50);
+ int top=(int) _title->getNum()/nbColumn ;
+ int left=_title->getNum() %nbColumn;
+ btn->setTop(top*(m_config->getPrefButtonHeight()+20) +50);
+ btn->setLeft(left*(m_config->getPrefButtonWidth()+50) +50);
+ btn->setWidth(m_config->getPrefButtonWidth());
+ btn->setHeight(m_config->getPrefButtonHeight());
+ btn->setScript(QString("g1=0;jump titleset %1 menu;").arg(_title->getNum()+1));
+ btn->setTextPosition(k9MenuButton::RIGHT);
+ btn->setText(i18n("title %1").arg(_title->getNum()+1));
+ btn->setColor(m_config->getPrefButtonTextColor());
+ btn->setFont(m_config->getPrefButtonFont());
+
+ QString script="\n";
+ for (k9Title *t = m_titles.first();t;t=m_titles.next()) {
+ script +=QString("if (g6== %1) { g6=0; jump titleset %2 menu;}\n").arg(t->getNum()+1).arg(t->getNum()+1);
+ }
+ m_rootMenu->setStartScript2(script);
+ emit sigAddTitle();
+ delete m_config;
+}
+
+
+
+void k9NewDVD::setProcessList(k9ProcessList *_value) {
+ m_processList=_value;
+}
+
+
+k9NewDVD::eFormat k9NewDVD::getFormat() const {
+ return m_format;
+}
+
+
+k9Menu* k9NewDVD::getRootMenu() const {
+ return m_rootMenu;
+}
+
+void k9NewDVD::calcVideoBitrate() {
+ // bitrate video = (MB *8388.608) /SEC - bitrate audio
+ int length=0;
+ for (k9Title *title=m_titles.first();title;title=m_titles.next()) {
+ k9TitleItems *chapters=title->getFiles();
+ for (k9AviFile *chapter=chapters->first();chapter;chapter=chapters->next()) {
+ length+=chapter->getStart().msecsTo(chapter->getEnd());
+ }
+ }
+ int size=m_config->getPrefSize();
+ double sec=(double)length/1000.0;
+ // m_videoBitrate=(int)( (size * 8388.608)/sec - 192);
+ m_videoBitrate=8*((size*1024 - (m_config->getPrefAudioBitrate() * sec/8))/sec);
+ m_videoBitrate=QMIN(m_videoBitrate,9800);
+}
+
+int k9NewDVD::getTotalTime() {
+ int total=0;
+ for (k9Title * title=m_titles.first();title;title=m_titles.next()) {
+ k9TitleItems *chapters=title->getFiles();
+ for (k9AviFile *chapter=chapters->first();chapter;chapter=chapters->next()) {
+ total+=chapter->getStart().secsTo(chapter->getEnd());
+ }
+ }
+ return total;
+}
+
+QString k9NewDVD::getError() const {
+ return m_error;
+}
diff --git a/k9author/k9newdvd.h b/k9author/k9newdvd.h
new file mode 100644
index 0000000..bc56b95
--- /dev/null
+++ b/k9author/k9newdvd.h
@@ -0,0 +1,95 @@
+//
+// C++ Interface: k9newdvd
+//
+// Description:
+//
+//
+// Author: Jean-Michel PETIT <k9copy@free.fr>, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#ifndef K9NEWDVD_H
+#define K9NEWDVD_H
+
+#include "k9common.h"
+#include <qobject.h>
+#include <qptrlist.h>
+#include <qdom.h>
+#include <qdatetime.h>
+#include "k9process.h"
+#include "k9progress.h"
+#include "k9avidecode.h"
+#include "k9config.h"
+
+
+/**
+ @author Jean-Michel PETIT <k9copy@free.fr>
+*/
+class k9Title;
+class k9AviFile;
+class k9Menu;
+class k9ProcessList;
+class k9NewDVDItems : public QPtrList<k9Title> {
+protected:
+ virtual int compareItems ( QPtrCollection::Item item1,QPtrCollection::Item item2 );
+};
+
+class k9NewDVD : public QObject {
+ Q_OBJECT
+public:
+ enum eFormat {NTSC=2,PAL=1};
+ k9NewDVD ( QObject *parent = 0, const char *name = 0 );
+ ~k9NewDVD();
+ k9NewDVDItems* getTitles() {
+ return &m_titles;
+ }
+ eFormat m_format;
+
+ void execute();
+ void createXML();
+ void addTitles ( QDomElement &_root );
+ void setFormat ( const eFormat& _value );
+
+ void setWorkDir ( const QString& _value );
+ void appendTitle ( k9Title *_title );
+
+ void setProcessList(k9ProcessList *_value);
+ eFormat getFormat() const;
+
+ int getTotalTime();
+ k9Menu* getRootMenu() const;
+
+ QString getError() const;
+
+private:
+ k9NewDVDItems m_titles;
+ QStringList m_tmpFiles;
+ QDomDocument *m_xml;
+ QString m_workDir;
+ k9ProcessList *m_processList;
+ QTime m_timer;
+ QTime m_timer2;
+ QTime m_timer3;
+ k9Menu *m_rootMenu;
+ bool m_cancel;
+ QString m_error;
+ QString m_stdout;
+ int m_videoBitrate;
+ k9AviDecode m_aviDecode;
+ int m_totalEncodedSize;
+ int m_offset;
+ int m_lastvalue;
+ QMap <k9Process*,QTime> m_timers;
+ void calcVideoBitrate();
+ void createMencoderCmd ( QString &_cmd,QString &_chapters, k9AviFile *_aviFile );
+ k9Config *m_config;
+protected slots:
+ void getStdout ( KProcess *, char *, int );
+ void getStderr ( KProcess *, char *, int );
+ void drawImage ( QImage * _image );
+signals:
+ void sigAddTitle();
+};
+
+#endif
diff --git a/k9author/k9newtitle.cpp b/k9author/k9newtitle.cpp
new file mode 100644
index 0000000..a229812
--- /dev/null
+++ b/k9author/k9newtitle.cpp
@@ -0,0 +1,171 @@
+//
+// C++ Implementation:
+//
+// Description:
+//
+//
+// Author: Jean-Michel PETIT <k9copy@free.fr>, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+
+
+#include "k9newtitle.h"
+#include "k9import.h"
+#include <qradiobutton.h>
+#include <knuminput.h>
+#include <ktimewidget.h>
+#include <k9avidecode.h>
+#include <klocale.h>
+#include "k9menu.h"
+#include "k9menubutton.h"
+#include "kpushbutton.h"
+#include <kmessagebox.h>
+#include <kcursor.h>
+k9NewTitle::k9NewTitle(QWidget* parent, const char* name, WFlags fl)
+ : newTitle(parent,name,fl) {
+ m_fileName="";
+}
+
+k9NewTitle::~k9NewTitle() {}
+
+/*$SPECIALIZATION$*/
+
+void k9NewTitle::fileSelected(const QString &_fileName) {
+ m_fileName=_fileName;
+ k9AviDecode fileInfo(0,0);
+ fileInfo.open(m_fileName);
+ double duration=fileInfo.getDuration();
+ fileInfo.close();
+ QTime t(0,0,0);
+ t=t.addSecs(duration);
+ lTotalTime->setText(t.toString("hh:mm:ss"));
+ bAdd->setEnabled(true);
+}
+
+void k9NewTitle::drawImage (QImage *_image) {
+ m_image=*_image;
+}
+
+void k9NewTitle::bAddClicked() {
+ k9Config config;
+ k9AviDecode fileInfo(0,0);
+ if (!fileInfo.open(m_fileName)) {
+ KMessageBox::error(this,fileInfo.getError(),i18n("Add title"));
+ return;
+ }
+ this->setCursor(KCursor::waitCursor());
+
+ k9LvItemImport * item=new k9LvItemImport(m_k9Import->getRoot(),k9LvItemImport::TITLE);
+ item->setOpen(true);
+ k9Title *title=new k9Title( m_k9Import->getNewDVD());
+ item->setText(0,i18n("title %1").arg(title->getNum() +1));
+
+ connect( title->getButton(),SIGNAL(sigsetImage(k9MenuButton*, const QImage&)),m_k9Import,SLOT(buttonUpdated(k9MenuButton*, const QImage&)));
+ item->setTitle(title);
+
+
+ connect(&fileInfo,SIGNAL(drawFrame(QImage*)),this,SLOT(drawImage(QImage*)));
+
+
+
+ QTime t;
+ m_k9Import->getRoot()->listView()->setColumnWidthMode(0,QListView::Maximum);
+ item->setText(1,t.addSecs(fileInfo.getDuration()).toString("hh:mm:ss"));
+
+ double increment;
+ int maxCh;
+ if (rbLength->isOn()) {
+ QTime t;
+ increment=t.secsTo(twLength->time());
+ maxCh=999;
+ }
+
+ if (rbNumber->isOn()) {
+ increment=fileInfo.getDuration() /nbChapters->value();
+ maxCh=nbChapters->value();
+ }
+
+ double pos=0;
+ k9AviFile *last=NULL;
+ int width=config.getPrefButtonWidth();
+ int height=config.getPrefButtonHeight();
+ int left=-width+20;
+ int top=50;
+
+ int i=-1;
+ while ( pos <fileInfo.getDuration() && i <maxCh-1){
+ //fileInfo.open(m_fileName);
+ i++;
+ fileInfo.readFrame(pos);
+ k9AviFile *file=new k9AviFile(title,0);
+ file->setImage(m_image);
+ if (i==0)
+ title->getButton()->setImage(m_image);
+
+ file->setPrevious(last);
+ if (last !=NULL)
+ last->setNext(file);
+ last=file;
+
+ file->setFileName(m_fileName);
+ file->setStart(t.addMSecs(pos*1000));
+ pos+=increment;
+ file->setEnd(t.addMSecs(QMIN(pos,fileInfo.getDuration()) *1000));
+ k9LvItemImport * itemch=new k9LvItemImport(item,k9LvItemImport::CHAPTER);
+ itemch->setText(0,i18n("chapter %1").arg(i+1));
+ itemch->setText(1,file->getStart().toString("hh:mm:ss") +" - "+file->getEnd().toString("hh:mm:ss") );
+ itemch->setAviFile(file);
+ itemch->setTitle(title);
+ itemch->setPixmap(0,QPixmap(m_image.smoothScale(50,40)));
+ connect(file,SIGNAL(aviFileUpdated(k9AviFile*)),m_k9Import,SLOT(aviFileUpdated(k9AviFile*)));
+
+ k9MenuButton *btn=title->getMenu()->addButton();
+ btn->setNum(i+1);
+ //_title->setButton(btn);
+ btn->setImage(m_image);
+ left +=width+10;
+ if (left +width >720) {
+ left=30;
+ top+=height+25;
+ }
+ btn->setTop(top);
+ btn->setLeft(left);
+ btn->setWidth(width);
+ btn->setHeight(height);
+ btn->setScript(QString("jump title 1 chapter %1 ;").arg(i+1));
+ btn->setTextPosition(k9MenuButton::BOTTOM);
+ btn->setText(i18n("chapter %1").arg(i+1));
+ btn->setColor(config.getPrefButtonTextColor());
+ btn->setFont(config.getPrefButtonFont());
+ connect(file,SIGNAL(imageChanged(const QImage&)),btn,SLOT(setImage(const QImage&)));
+
+ }
+ title->getMenu()->setEndScript("call vmgm menu;");
+ fileInfo.close();
+ m_k9Import->lvDVD->setSortColumn(0);
+ m_k9Import->lvDVD->sort();
+ m_k9Import->setEnableCreate(true);
+ m_k9Import->updateTotalTime();
+ this->setCursor(KCursor::arrowCursor());
+}
+
+void k9NewTitle::rbNumberClicked() {
+ twLength->setEnabled(false);
+ nbChapters->setEnabled(true);
+}
+
+void k9NewTitle::rbLengthClicked() {
+ twLength->setEnabled(true);
+ nbChapters->setEnabled(false);
+
+}
+
+#include "k9newtitle.moc"
+
+
+
+void k9NewTitle::setK9Import ( k9Import* _value ) {
+ m_k9Import = _value;
+}
diff --git a/k9author/k9newtitle.h b/k9author/k9newtitle.h
new file mode 100644
index 0000000..8df44f3
--- /dev/null
+++ b/k9author/k9newtitle.h
@@ -0,0 +1,52 @@
+//
+// C++ Interface:
+//
+// Description:
+//
+//
+// Author: Jean-Michel PETIT <k9copy@free.fr>, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+
+#ifndef K9NEWTITLE_H
+#define K9NEWTITLE_H
+
+#include "k9common.h"
+#include "../k9author/newTitle.h"
+#include "k9lvitemimport.h"
+#include <qstring.h>
+
+class k9Import;
+class k9NewTitle : public newTitle
+{
+ Q_OBJECT
+private:
+ k9Import *m_k9Import;
+ QString m_fileName;
+ QImage m_image;
+public:
+ k9NewTitle(QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+ ~k9NewTitle();
+ void setK9Import ( k9Import* _value );
+
+ /*$PUBLIC_FUNCTIONS$*/
+
+public slots:
+ /*$PUBLIC_SLOTS$*/
+
+protected:
+ /*$PROTECTED_FUNCTIONS$*/
+
+protected slots:
+ /*$PROTECTED_SLOTS$*/
+ virtual void fileSelected(const QString &);
+ virtual void bAddClicked();
+ virtual void rbNumberClicked();
+ virtual void rbLengthClicked();
+ virtual void drawImage (QImage *_image);
+};
+
+#endif
+
diff --git a/k9author/k9title.cpp b/k9author/k9title.cpp
new file mode 100644
index 0000000..d2603e5
--- /dev/null
+++ b/k9author/k9title.cpp
@@ -0,0 +1,64 @@
+//
+// C++ Implementation: k9title
+//
+// Description:
+//
+//
+// Author: Jean-Michel PETIT <k9copy@free.fr>, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#include "k9title.h"
+#include "k9newdvd.h"
+#include "k9menu.h"
+
+k9Title::k9Title(k9NewDVD *parent, const char *name)
+ : QObject(parent, name)
+{
+ m_num=parent->getTitles()->count();
+ parent->appendTitle(this);
+ m_menu=new k9Menu(this,0);
+ m_menu->setFormat((k9Menu::eFormat)parent->getFormat());
+}
+
+
+k9Title::~k9Title()
+{
+}
+
+int k9TitleItems::compareItems(QPtrCollection::Item item1,QPtrCollection::Item item2) {
+ k9AviFile *i1,*i2;
+ i1=(k9AviFile*) item1;
+ i2=(k9AviFile*) item2;
+ return (i1->getNum() - i2->getNum());
+}
+
+#include "k9title.moc"
+
+
+k9TitleItems *k9Title::getFiles()
+{
+ return &m_files;
+}
+
+
+int k9Title::getNum() const
+{
+ return m_num;
+}
+
+
+k9MenuButton* k9Title::getButton() const {
+ return m_button;
+}
+
+
+void k9Title::setButton(k9MenuButton* _value) {
+ m_button = _value;
+}
+
+
+k9Menu* k9Title::getMenu() const {
+ return m_menu;
+}
diff --git a/k9author/k9title.h b/k9author/k9title.h
new file mode 100644
index 0000000..8828a7d
--- /dev/null
+++ b/k9author/k9title.h
@@ -0,0 +1,57 @@
+//
+// C++ Interface: k9title
+//
+// Description:
+//
+//
+// Author: Jean-Michel PETIT <k9copy@free.fr>, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#ifndef K9TITLE_H
+#define K9TITLE_H
+
+#include "k9common.h"
+#include <qobject.h>
+#include <qptrlist.h>
+#include "k9avifile.h"
+#include "k9menubutton.h"
+/**
+ @author Jean-Michel PETIT <k9copy@free.fr>
+*/
+class k9NewDVD;
+class k9Menu;
+
+class k9TitleItems : public QPtrList<k9AviFile> {
+protected:
+ virtual int compareItems(QPtrCollection::Item item1,QPtrCollection::Item item2);
+};
+
+class k9Title : public QObject {
+ Q_OBJECT
+public:
+ k9Title(k9NewDVD *parent = 0, const char *name = 0);
+ ~k9Title();
+
+ k9TitleItems *getFiles();
+
+ int getNum() const;
+
+ void setButton(k9MenuButton* _value);
+
+
+ k9MenuButton* getButton() const;
+
+ k9Menu* getMenu() const;
+
+
+
+private:
+ k9TitleItems m_files;
+ int m_num;
+ k9MenuButton *m_button;
+ k9Menu *m_menu;
+};
+
+#endif
diff --git a/k9author/menuEdit.cpp b/k9author/menuEdit.cpp
new file mode 100644
index 0000000..db313d2
--- /dev/null
+++ b/k9author/menuEdit.cpp
@@ -0,0 +1,211 @@
+#include <klocale.h>
+/****************************************************************************
+** Form implementation generated from reading ui file './menuEdit.ui'
+**
+** Created: dim. oct. 26 08:56:28 2008
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+
+#include "menuEdit.h"
+
+#include <qvariant.h>
+#include <qlabel.h>
+#include <kurlrequester.h>
+#include <kcolorbutton.h>
+#include <kpushbutton.h>
+#include <qcombobox.h>
+#include <qlineedit.h>
+#include <qframe.h>
+#include <qlayout.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+#include "kurlrequester.h"
+#include "klineedit.h"
+#include "kpushbutton.h"
+#include "kcolorbutton.h"
+
+/*
+ * Constructs a menuEdit as a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'.
+ */
+menuEdit::menuEdit( QWidget* parent, const char* name, WFlags fl )
+ : QWidget( parent, name, fl )
+{
+ if ( !name )
+ setName( "menuEdit" );
+ menuEditLayout = new QGridLayout( this, 1, 1, 2, 6, "menuEditLayout");
+
+ textLabel2 = new QLabel( this, "textLabel2" );
+ textLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)5, 0, 0, textLabel2->sizePolicy().hasHeightForWidth() ) );
+
+ menuEditLayout->addMultiCellWidget( textLabel2, 5, 6, 0, 0 );
+
+ textLabel1 = new QLabel( this, "textLabel1" );
+ textLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)5, 0, 0, textLabel1->sizePolicy().hasHeightForWidth() ) );
+
+ menuEditLayout->addWidget( textLabel1, 4, 0 );
+
+ urBackground = new KURLRequester( this, "urBackground" );
+
+ menuEditLayout->addMultiCellWidget( urBackground, 4, 4, 1, 5 );
+
+ cbColor = new KColorButton( this, "cbColor" );
+ cbColor->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, cbColor->sizePolicy().hasHeightForWidth() ) );
+
+ menuEditLayout->addWidget( cbColor, 6, 1 );
+
+ bFont = new KPushButton( this, "bFont" );
+ bFont->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, bFont->sizePolicy().hasHeightForWidth() ) );
+
+ menuEditLayout->addWidget( bFont, 6, 2 );
+
+ cbPosTitle = new QComboBox( FALSE, this, "cbPosTitle" );
+ cbPosTitle->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, cbPosTitle->sizePolicy().hasHeightForWidth() ) );
+
+ menuEditLayout->addWidget( cbPosTitle, 6, 3 );
+ spacer1 = new QSpacerItem( 51, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ menuEditLayout->addMultiCell( spacer1, 6, 6, 4, 5 );
+
+ leTitle = new QLineEdit( this, "leTitle" );
+
+ menuEditLayout->addMultiCellWidget( leTitle, 5, 5, 1, 4 );
+
+ bAddText = new KPushButton( this, "bAddText" );
+ bAddText->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)4, (QSizePolicy::SizeType)4, 0, 0, bAddText->sizePolicy().hasHeightForWidth() ) );
+ bAddText->setMinimumSize( QSize( 24, 24 ) );
+ bAddText->setMaximumSize( QSize( 24, 24 ) );
+
+ menuEditLayout->addWidget( bAddText, 5, 5 );
+
+ lTitle = new QLabel( this, "lTitle" );
+ lTitle->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, lTitle->sizePolicy().hasHeightForWidth() ) );
+ QFont lTitle_font( lTitle->font() );
+ lTitle_font.setBold( TRUE );
+ lTitle->setFont( lTitle_font );
+
+ menuEditLayout->addMultiCellWidget( lTitle, 0, 0, 0, 5 );
+
+ textLabel1_2 = new QLabel( this, "textLabel1_2" );
+
+ menuEditLayout->addWidget( textLabel1_2, 2, 0 );
+
+ cbStart = new QComboBox( FALSE, this, "cbStart" );
+
+ menuEditLayout->addMultiCellWidget( cbStart, 2, 2, 1, 5 );
+
+ textLabel1_2_2 = new QLabel( this, "textLabel1_2_2" );
+
+ menuEditLayout->addWidget( textLabel1_2_2, 3, 0 );
+
+ cbEnd = new QComboBox( FALSE, this, "cbEnd" );
+
+ menuEditLayout->addMultiCellWidget( cbEnd, 3, 3, 1, 5 );
+
+ frame = new QFrame( this, "frame" );
+ frame->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)7, 0, 0, frame->sizePolicy().hasHeightForWidth() ) );
+ frame->setFrameShape( QFrame::StyledPanel );
+ frame->setFrameShadow( QFrame::Raised );
+
+ menuEditLayout->addMultiCellWidget( frame, 1, 1, 0, 5 );
+ languageChange();
+ resize( QSize(576, 682).expandedTo(minimumSizeHint()) );
+ clearWState( WState_Polished );
+
+ // signals and slots connections
+ connect( bFont, SIGNAL( clicked() ), this, SLOT( bFontClick() ) );
+ connect( urBackground, SIGNAL( urlSelected(const QString&) ), this, SLOT( urBackgroundSelected(const QString&) ) );
+ connect( cbColor, SIGNAL( changed(const QColor&) ), this, SLOT( cbColorChanged(const QColor&) ) );
+ connect( leTitle, SIGNAL( textChanged(const QString&) ), this, SLOT( leTitleChanged(const QString&) ) );
+ connect( cbPosTitle, SIGNAL( activated(int) ), this, SLOT( cbPosTitleActivated(int) ) );
+ connect( bAddText, SIGNAL( clicked() ), this, SLOT( bAddTextClick() ) );
+ connect( cbStart, SIGNAL( activated(int) ), this, SLOT( cbStartActivated(int) ) );
+ connect( cbEnd, SIGNAL( activated(int) ), this, SLOT( cbEndActivated(int) ) );
+
+ // tab order
+ setTabOrder( cbStart, cbEnd );
+ setTabOrder( cbEnd, urBackground );
+ setTabOrder( urBackground, leTitle );
+ setTabOrder( leTitle, bAddText );
+ setTabOrder( bAddText, cbColor );
+ setTabOrder( cbColor, bFont );
+ setTabOrder( bFont, cbPosTitle );
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+menuEdit::~menuEdit()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ * Sets the strings of the subwidgets using the current
+ * language.
+ */
+void menuEdit::languageChange()
+{
+ setCaption( tr2i18n( "Edit Menu" ) );
+ textLabel2->setText( tr2i18n( "Text" ) );
+ textLabel1->setText( tr2i18n( "Background picture" ) );
+ cbColor->setText( QString::null );
+ bFont->setText( tr2i18n( "Font" ) );
+ cbPosTitle->clear();
+ cbPosTitle->insertItem( tr2i18n( "Bottom" ) );
+ cbPosTitle->insertItem( tr2i18n( "Right" ) );
+ bAddText->setText( QString::null );
+ bAddText->setAccel( QKeySequence( QString::null ) );
+ lTitle->setText( tr2i18n( "Root Menu" ) );
+ textLabel1_2->setText( tr2i18n( "At start" ) );
+ cbStart->clear();
+ cbStart->insertItem( tr2i18n( "Play menu" ) );
+ cbStart->insertItem( tr2i18n( "Play title 1" ) );
+ textLabel1_2_2->setText( tr2i18n( "At End" ) );
+ cbEnd->clear();
+ cbEnd->insertItem( tr2i18n( "Play root menu" ) );
+ cbEnd->insertItem( tr2i18n( "Play title menu" ) );
+ cbEnd->insertItem( tr2i18n( "Play title 1" ) );
+}
+
+void menuEdit::bFontClick()
+{
+ qWarning( "menuEdit::bFontClick(): Not implemented yet" );
+}
+
+void menuEdit::urBackgroundSelected(const QString&)
+{
+ qWarning( "menuEdit::urBackgroundSelected(const QString&): Not implemented yet" );
+}
+
+void menuEdit::cbColorChanged(const QColor&)
+{
+ qWarning( "menuEdit::cbColorChanged(const QColor&): Not implemented yet" );
+}
+
+void menuEdit::leTitleChanged(const QString&)
+{
+ qWarning( "menuEdit::leTitleChanged(const QString&): Not implemented yet" );
+}
+
+void menuEdit::cbPosTitleActivated(int)
+{
+ qWarning( "menuEdit::cbPosTitleActivated(int): Not implemented yet" );
+}
+
+void menuEdit::bAddTextClick()
+{
+ qWarning( "menuEdit::bAddTextClick(): Not implemented yet" );
+}
+
+void menuEdit::cbStartActivated(int)
+{
+ qWarning( "menuEdit::cbStartActivated(int): Not implemented yet" );
+}
+
+void menuEdit::cbEndActivated(int)
+{
+ qWarning( "menuEdit::cbEndActivated(int): Not implemented yet" );
+}
+
+#include "menuEdit.moc"
diff --git a/k9author/menuEdit.ui b/k9author/menuEdit.ui
new file mode 100644
index 0000000..02c0776
--- /dev/null
+++ b/k9author/menuEdit.ui
@@ -0,0 +1,342 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>menuEdit</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>menuEdit</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>576</width>
+ <height>682</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Edit Menu</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>2</number>
+ </property>
+ <widget class="QLabel" row="5" column="0" rowspan="2" colspan="1">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Text</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Background picture</string>
+ </property>
+ </widget>
+ <widget class="KURLRequester" row="4" column="1" rowspan="1" colspan="5">
+ <property name="name">
+ <cstring>urBackground</cstring>
+ </property>
+ </widget>
+ <widget class="KColorButton" row="6" column="1">
+ <property name="name">
+ <cstring>cbColor</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="KPushButton" row="6" column="2">
+ <property name="name">
+ <cstring>bFont</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Font</string>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="6" column="3">
+ <item>
+ <property name="text">
+ <string>Bottom</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Right</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>cbPosTitle</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <spacer row="6" column="4" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>51</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLineEdit" row="5" column="1" rowspan="1" colspan="4">
+ <property name="name">
+ <cstring>leTitle</cstring>
+ </property>
+ </widget>
+ <widget class="KPushButton" row="5" column="5">
+ <property name="name">
+ <cstring>bAddText</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>4</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>24</width>
+ <height>24</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>24</width>
+ <height>24</height>
+ </size>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0" rowspan="1" colspan="6">
+ <property name="name">
+ <cstring>lTitle</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Root Menu</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>At start</string>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="2" column="1" rowspan="1" colspan="5">
+ <item>
+ <property name="text">
+ <string>Play menu</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Play title 1</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>cbStart</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel1_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>At End</string>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="3" column="1" rowspan="1" colspan="5">
+ <item>
+ <property name="text">
+ <string>Play root menu</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Play title menu</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Play title 1</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>cbEnd</cstring>
+ </property>
+ </widget>
+ <widget class="QFrame" row="1" column="0" rowspan="1" colspan="6">
+ <property name="name">
+ <cstring>frame</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="frameShape">
+ <enum>StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>bFont</sender>
+ <signal>clicked()</signal>
+ <receiver>menuEdit</receiver>
+ <slot>bFontClick()</slot>
+ </connection>
+ <connection>
+ <sender>urBackground</sender>
+ <signal>urlSelected(const QString&amp;)</signal>
+ <receiver>menuEdit</receiver>
+ <slot>urBackgroundSelected(const QString&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>cbColor</sender>
+ <signal>changed(const QColor&amp;)</signal>
+ <receiver>menuEdit</receiver>
+ <slot>cbColorChanged(const QColor&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>leTitle</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>menuEdit</receiver>
+ <slot>leTitleChanged(const QString&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>cbPosTitle</sender>
+ <signal>activated(int)</signal>
+ <receiver>menuEdit</receiver>
+ <slot>cbPosTitleActivated(int)</slot>
+ </connection>
+ <connection>
+ <sender>bAddText</sender>
+ <signal>clicked()</signal>
+ <receiver>menuEdit</receiver>
+ <slot>bAddTextClick()</slot>
+ </connection>
+ <connection>
+ <sender>cbStart</sender>
+ <signal>activated(int)</signal>
+ <receiver>menuEdit</receiver>
+ <slot>cbStartActivated(int)</slot>
+ </connection>
+ <connection>
+ <sender>cbEnd</sender>
+ <signal>activated(int)</signal>
+ <receiver>menuEdit</receiver>
+ <slot>cbEndActivated(int)</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>cbStart</tabstop>
+ <tabstop>cbEnd</tabstop>
+ <tabstop>urBackground</tabstop>
+ <tabstop>leTitle</tabstop>
+ <tabstop>bAddText</tabstop>
+ <tabstop>cbColor</tabstop>
+ <tabstop>bFont</tabstop>
+ <tabstop>cbPosTitle</tabstop>
+</tabstops>
+<slots>
+ <slot>bFontClick()</slot>
+ <slot>urBackgroundSelected(const QString &amp;)</slot>
+ <slot>cbColorChanged(const QColor&amp;)</slot>
+ <slot>leTitleChanged(const QString &amp;)</slot>
+ <slot>cbPosTitleActivated(int)</slot>
+ <slot>bAddTextClick()</slot>
+ <slot>cbStartActivated(int)</slot>
+ <slot>cbEndActivated(int)</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kcolorbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/k9author/newTitle.cpp b/k9author/newTitle.cpp
new file mode 100644
index 0000000..25786de
--- /dev/null
+++ b/k9author/newTitle.cpp
@@ -0,0 +1,158 @@
+#include <klocale.h>
+/****************************************************************************
+** Form implementation generated from reading ui file './newTitle.ui'
+**
+** Created: dim. oct. 26 08:56:29 2008
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+
+#include "newTitle.h"
+
+#include <qvariant.h>
+#include <qpushbutton.h>
+#include <qbuttongroup.h>
+#include <knuminput.h>
+#include <ktimewidget.h>
+#include <qradiobutton.h>
+#include <kpushbutton.h>
+#include <qlabel.h>
+#include <kurlrequester.h>
+#include <qlayout.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+#include "knuminput.h"
+#include "ktimewidget.h"
+#include "kpushbutton.h"
+#include "kurlrequester.h"
+#include "klineedit.h"
+
+/*
+ * Constructs a newTitle as a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'.
+ */
+newTitle::newTitle( QWidget* parent, const char* name, WFlags fl )
+ : QWidget( parent, name, fl )
+{
+ if ( !name )
+ setName( "newTitle" );
+ newTitleLayout = new QGridLayout( this, 1, 1, 11, 6, "newTitleLayout");
+
+ buttonGroup1 = new QButtonGroup( this, "buttonGroup1" );
+ buttonGroup1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, buttonGroup1->sizePolicy().hasHeightForWidth() ) );
+ buttonGroup1->setColumnLayout(0, Qt::Vertical );
+ buttonGroup1->layout()->setSpacing( 6 );
+ buttonGroup1->layout()->setMargin( 11 );
+ buttonGroup1Layout = new QGridLayout( buttonGroup1->layout() );
+ buttonGroup1Layout->setAlignment( Qt::AlignTop );
+
+ nbChapters = new KIntNumInput( buttonGroup1, "nbChapters" );
+ nbChapters->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0, nbChapters->sizePolicy().hasHeightForWidth() ) );
+ nbChapters->setMinValue( 1 );
+ nbChapters->setMaxValue( 99 );
+
+ buttonGroup1Layout->addWidget( nbChapters, 0, 1 );
+
+ twLength = new KTimeWidget( buttonGroup1, "twLength" );
+ twLength->setEnabled( FALSE );
+ twLength->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)5, 0, 0, twLength->sizePolicy().hasHeightForWidth() ) );
+
+ buttonGroup1Layout->addWidget( twLength, 1, 1 );
+
+ rbNumber = new QRadioButton( buttonGroup1, "rbNumber" );
+ rbNumber->setChecked( TRUE );
+
+ buttonGroup1Layout->addWidget( rbNumber, 0, 0 );
+
+ rbLength = new QRadioButton( buttonGroup1, "rbLength" );
+
+ buttonGroup1Layout->addWidget( rbLength, 1, 0 );
+ spacer1 = new QSpacerItem( 131, 21, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ buttonGroup1Layout->addMultiCell( spacer1, 0, 1, 2, 2 );
+
+ newTitleLayout->addMultiCellWidget( buttonGroup1, 1, 1, 0, 1 );
+ spacer3 = new QSpacerItem( 21, 16, QSizePolicy::Minimum, QSizePolicy::Expanding );
+ newTitleLayout->addItem( spacer3, 3, 0 );
+ spacer4 = new QSpacerItem( 16, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ newTitleLayout->addItem( spacer4, 1, 2 );
+
+ bAdd = new KPushButton( this, "bAdd" );
+ bAdd->setEnabled( FALSE );
+ bAdd->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, bAdd->sizePolicy().hasHeightForWidth() ) );
+ bAdd->setProperty( "stdItem", 27 );
+
+ newTitleLayout->addWidget( bAdd, 2, 1 );
+ spacer2 = new QSpacerItem( 470, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ newTitleLayout->addItem( spacer2, 2, 0 );
+
+ layout1 = new QHBoxLayout( 0, 0, 6, "layout1");
+
+ textLabel1 = new QLabel( this, "textLabel1" );
+ textLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, textLabel1->sizePolicy().hasHeightForWidth() ) );
+ layout1->addWidget( textLabel1 );
+
+ urFile = new KURLRequester( this, "urFile" );
+ urFile->setMode( 25 );
+ layout1->addWidget( urFile );
+
+ lTotalTime = new QLabel( this, "lTotalTime" );
+ lTotalTime->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, lTotalTime->sizePolicy().hasHeightForWidth() ) );
+ layout1->addWidget( lTotalTime );
+
+ newTitleLayout->addMultiCellLayout( layout1, 0, 0, 0, 1 );
+ languageChange();
+ resize( QSize(605, 171).expandedTo(minimumSizeHint()) );
+ clearWState( WState_Polished );
+
+ // signals and slots connections
+ connect( urFile, SIGNAL( urlSelected(const QString&) ), this, SLOT( fileSelected(const QString&) ) );
+ connect( rbNumber, SIGNAL( clicked() ), this, SLOT( rbNumberClicked() ) );
+ connect( rbLength, SIGNAL( clicked() ), this, SLOT( rbLengthClicked() ) );
+ connect( bAdd, SIGNAL( clicked() ), this, SLOT( bAddClicked() ) );
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+newTitle::~newTitle()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ * Sets the strings of the subwidgets using the current
+ * language.
+ */
+void newTitle::languageChange()
+{
+ setCaption( tr2i18n( "Add title" ) );
+ buttonGroup1->setTitle( QString::null );
+ rbNumber->setText( tr2i18n( "number of chapters" ) );
+ rbLength->setText( tr2i18n( "chapter length" ) );
+ bAdd->setText( tr2i18n( "Add" ) );
+ bAdd->setAccel( QKeySequence( QString::null ) );
+ textLabel1->setText( tr2i18n( "Video file" ) );
+ lTotalTime->setText( tr2i18n( "--:--:--" ) );
+}
+
+void newTitle::fileSelected(const QString&)
+{
+ qWarning( "newTitle::fileSelected(const QString&): Not implemented yet" );
+}
+
+void newTitle::rbNumberClicked()
+{
+ qWarning( "newTitle::rbNumberClicked(): Not implemented yet" );
+}
+
+void newTitle::rbLengthClicked()
+{
+ qWarning( "newTitle::rbLengthClicked(): Not implemented yet" );
+}
+
+void newTitle::bAddClicked()
+{
+ qWarning( "newTitle::bAddClicked(): Not implemented yet" );
+}
+
+#include "newTitle.moc"
diff --git a/k9author/newTitle.ui b/k9author/newTitle.ui
new file mode 100644
index 0000000..c68ab88
--- /dev/null
+++ b/k9author/newTitle.ui
@@ -0,0 +1,284 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>newTitle</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>newTitle</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>605</width>
+ <height>171</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Add title</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QButtonGroup" row="1" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>buttonGroup1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string></string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KIntNumInput" row="0" column="1">
+ <property name="name">
+ <cstring>nbChapters</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minValue">
+ <number>1</number>
+ </property>
+ <property name="maxValue">
+ <number>99</number>
+ </property>
+ </widget>
+ <widget class="KTimeWidget" row="1" column="1">
+ <property name="name">
+ <cstring>twLength</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="0" column="0">
+ <property name="name">
+ <cstring>rbNumber</cstring>
+ </property>
+ <property name="text">
+ <string>number of chapters</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="1" column="0">
+ <property name="name">
+ <cstring>rbLength</cstring>
+ </property>
+ <property name="text">
+ <string>chapter length</string>
+ </property>
+ </widget>
+ <spacer row="0" column="2" rowspan="2" colspan="1">
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>131</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ <spacer row="3" column="0">
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>21</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <spacer row="1" column="2">
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>16</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton" row="2" column="1">
+ <property name="name">
+ <cstring>bAdd</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Add</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="stdItem" stdset="0">
+ <number>27</number>
+ </property>
+ </widget>
+ <spacer row="2" column="0">
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>470</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Video file</string>
+ </property>
+ </widget>
+ <widget class="KURLRequester">
+ <property name="name">
+ <cstring>urFile</cstring>
+ </property>
+ <property name="mode">
+ <number>25</number>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>lTotalTime</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>--:--:--</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>urFile</sender>
+ <signal>urlSelected(const QString&amp;)</signal>
+ <receiver>newTitle</receiver>
+ <slot>fileSelected(const QString&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>rbNumber</sender>
+ <signal>clicked()</signal>
+ <receiver>newTitle</receiver>
+ <slot>rbNumberClicked()</slot>
+ </connection>
+ <connection>
+ <sender>rbLength</sender>
+ <signal>clicked()</signal>
+ <receiver>newTitle</receiver>
+ <slot>rbLengthClicked()</slot>
+ </connection>
+ <connection>
+ <sender>bAdd</sender>
+ <signal>clicked()</signal>
+ <receiver>newTitle</receiver>
+ <slot>bAddClicked()</slot>
+ </connection>
+</connections>
+<slots>
+ <slot>fileSelected(const QString&amp;)</slot>
+ <slot>rbNumberClicked()</slot>
+ <slot>rbLengthClicked()</slot>
+ <slot>bAddClicked()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>knuminput.h</includehint>
+ <includehint>knuminput.h</includehint>
+ <includehint>ktimewidget.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>