Convert to TDE R14 API

pull/1/head
Timothy Pearson 12 years ago
parent c53429a696
commit 17b1e78502

@ -1060,7 +1060,7 @@ elif test "$kde_use_qt_emb" = "yes"; then
x_includes="" x_includes=""
x_libraries="" x_libraries=""
elif test "$kde_use_qt_mac" = "yes"; then elif test "$kde_use_qt_mac" = "yes"; then
dnl We're using QT/Mac (I use QT_MAC so that qglobal.h doesn't *have* to dnl We're using QT/Mac (I use QT_MAC so that ntqglobal.h doesn't *have* to
dnl be included to get the information) --Sam dnl be included to get the information) --Sam
CXXFLAGS="$CXXFLAGS -DQT_MAC -no-cpp-precomp" CXXFLAGS="$CXXFLAGS -DQT_MAC -no-cpp-precomp"
CFLAGS="$CFLAGS -DQT_MAC -no-cpp-precomp" CFLAGS="$CFLAGS -DQT_MAC -no-cpp-precomp"
@ -1092,19 +1092,19 @@ AC_DEFUN([KDE_PRINT_QT_PROGRAM],
AC_REQUIRE([KDE_USE_QT]) AC_REQUIRE([KDE_USE_QT])
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#include "confdefs.h" #include "confdefs.h"
#include <qglobal.h> #include <ntqglobal.h>
#include <qapplication.h> #include <ntqapplication.h>
EOF EOF
if test "$kde_qtver" = "2"; then if test "$kde_qtver" = "2"; then
cat >> conftest.$ac_ext <<EOF cat >> conftest.$ac_ext <<EOF
#include <qevent.h> #include <ntqevent.h>
#include <qstring.h> #include <ntqstring.h>
#include <qstyle.h> #include <ntqstyle.h>
EOF EOF
if test $kde_qtsubver -gt 0; then if test $kde_qtsubver -gt 0; then
cat >> conftest.$ac_ext <<EOF cat >> conftest.$ac_ext <<EOF
#if QT_VERSION < 210 #if TQT_VERSION < 210
#error 1 #error 1
#endif #endif
EOF EOF
@ -1113,8 +1113,8 @@ fi
if test "$kde_qtver" = "3"; then if test "$kde_qtver" = "3"; then
cat >> conftest.$ac_ext <<EOF cat >> conftest.$ac_ext <<EOF
#include <qcursor.h> #include <ntqcursor.h>
#include <qstylefactory.h> #include <ntqstylefactory.h>
#include <private/qucomextra_p.h> #include <private/qucomextra_p.h>
EOF EOF
fi fi
@ -1201,22 +1201,22 @@ fi
if test -z "$3"; then if test -z "$3"; then
if test $kde_qtver = 3; then if test $kde_qtver = 3; then
if test $kde_qtsubver -gt 0; then if test $kde_qtsubver -gt 0; then
kde_qt_verstring="QT_VERSION >= 0x03@VER@00 && QT_VERSION < 0x040000" kde_qt_verstring="TQT_VERSION >= 0x03@VER@00 && TQT_VERSION < 0x040000"
qtsubver=`echo "00$kde_qtsubver" | sed -e 's,.*\(..\)$,\1,'` qtsubver=`echo "00$kde_qtsubver" | sed -e 's,.*\(..\)$,\1,'`
kde_qt_verstring=`echo $kde_qt_verstring | sed -e "s,@VER@,$qtsubver,"` kde_qt_verstring=`echo $kde_qt_verstring | sed -e "s,@VER@,$qtsubver,"`
else else
kde_qt_verstring="QT_VERSION >= 300 && QT_VERSION < 0x040000" kde_qt_verstring="TQT_VERSION >= 300 && TQT_VERSION < 0x040000"
fi fi
fi fi
if test $kde_qtver = 2; then if test $kde_qtver = 2; then
if test $kde_qtsubver -gt 0; then if test $kde_qtsubver -gt 0; then
kde_qt_verstring="QT_VERSION >= 222" kde_qt_verstring="TQT_VERSION >= 222"
else else
kde_qt_verstring="QT_VERSION >= 200" kde_qt_verstring="TQT_VERSION >= 200"
fi fi
fi fi
if test $kde_qtver = 1; then if test $kde_qtver = 1; then
kde_qt_verstring="QT_VERSION >= 142 && QT_VERSION < 200" kde_qt_verstring="TQT_VERSION >= 142 && TQT_VERSION < 200"
fi fi
else else
kde_qt_verstring="$3" kde_qt_verstring="$3"
@ -1325,7 +1325,7 @@ AC_ARG_ENABLE(
USING_QT_MT="" USING_QT_MT=""
dnl ------------------------------------------------------------------------ dnl ------------------------------------------------------------------------
dnl If we not get --disable-qt-mt then adjust some vars for the host. dnl If we not get --disable-tqt-mt then adjust some vars for the host.
dnl ------------------------------------------------------------------------ dnl ------------------------------------------------------------------------
KDE_MT_LDFLAGS= KDE_MT_LDFLAGS=
@ -1383,7 +1383,7 @@ dnl ------------------------------------------------------------
fi fi
dnl ------------------------------------------------------------------------ dnl ------------------------------------------------------------------------
dnl If we got --enable-qt-mt then adjust the Qt library name for the host. dnl If we got --enable-tqt-mt then adjust the Qt library name for the host.
dnl ------------------------------------------------------------------------ dnl ------------------------------------------------------------------------
if test "x$kde_use_qt_mt" = "xyes"; then if test "x$kde_use_qt_mt" = "xyes"; then
@ -1449,9 +1449,9 @@ if test ! "$ac_qt_includes" = "NO"; then
fi fi
if test "$kde_qtver" != "1"; then if test "$kde_qtver" != "1"; then
kde_qt_header=qstyle.h kde_qt_header=ntqstyle.h
else else
kde_qt_header=qglobal.h kde_qt_header=ntqglobal.h
fi fi
AC_FIND_FILE($kde_qt_header, $qt_incdirs, qt_incdir) AC_FIND_FILE($kde_qt_header, $qt_incdirs, qt_incdir)
@ -2034,7 +2034,7 @@ AC_CACHE_VAL(kde_cv_have_kdeqtaddon,
LDFLAGS="$LDFLAGS $all_libraries $USER_LDFLAGS" LDFLAGS="$LDFLAGS $all_libraries $USER_LDFLAGS"
AC_TRY_LINK([ AC_TRY_LINK([
#include <qdom.h> #include <ntqdom.h>
], ],
[ [
QDomDocument doc; QDomDocument doc;
@ -2595,7 +2595,7 @@ LIBS=`echo $LIBS | sed "s/$LIBJPEG//"`
ac_save_CXXFLAGS="$CXXFLAGS" ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES" CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES"
AC_TRY_LINK( AC_TRY_LINK(
[#include <qapplication.h>], [#include <ntqapplication.h>],
[ [
int argc; int argc;
char** argv; char** argv;
@ -3439,7 +3439,7 @@ AC_DEFUN([KDE_ENABLE_HIDDEN_VISIBILITY],
AC_TRY_COMPILE( AC_TRY_COMPILE(
[ [
#include <qglobal.h> #include <ntqglobal.h>
#if Q_EXPORT - 0 != 0 #if Q_EXPORT - 0 != 0
/* if this compiles, then Q_EXPORT is undefined */ /* if this compiles, then Q_EXPORT is undefined */
/* if Q_EXPORT is nonempty, this will break compilation */ /* if Q_EXPORT is nonempty, this will break compilation */
@ -4691,7 +4691,7 @@ CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes"
AC_TRY_RUN(dnl AC_TRY_RUN(dnl
[ [
#include <qimageio.h> #include <qimageio.h>
#include <qstring.h> #include <ntqstring.h>
int main() { int main() {
QString t = "hallo"; QString t = "hallo";
t.fill('t'); t.fill('t');
@ -5536,7 +5536,7 @@ if test "${with_qt_dir+set}" = set; then
kde_qtdir="$with_qt_dir" kde_qtdir="$with_qt_dir"
fi fi
AC_FIND_FILE(qsql.html, [ $kde_qtdir/doc/html $QTDIR/doc/html /usr/share/doc/packages/qt3/html /usr/lib/qt/doc /usr/lib/qt3/doc /usr/lib/qt3/doc/html /usr/doc/qt3/html /usr/doc/qt3 /usr/share/doc/qt3-doc /usr/share/qt3/doc/html /usr/X11R6/share/doc/qt/html ], QTDOCDIR) AC_FIND_FILE(ntqsql.html, [ $kde_qtdir/doc/html $QTDIR/doc/html /usr/share/doc/packages/qt3/html /usr/lib/qt/doc /usr/lib/qt3/doc /usr/lib/qt3/doc/html /usr/doc/qt3/html /usr/doc/qt3 /usr/share/doc/qt3-doc /usr/share/qt3/doc/html /usr/X11R6/share/doc/qt/html ], QTDOCDIR)
AC_MSG_RESULT($QTDOCDIR) AC_MSG_RESULT($QTDOCDIR)
AC_SUBST(QTDOCDIR) AC_SUBST(QTDOCDIR)
@ -5557,7 +5557,7 @@ AC_SUBST(DOXYGEN_PROJECT_NAME)
AC_SUBST(DOXYGEN_PROJECT_NUMBER) AC_SUBST(DOXYGEN_PROJECT_NUMBER)
KDE_HAS_DOXYGEN=no KDE_HAS_DOXYGEN=no
if test -n "$DOXYGEN" && test -x "$DOXYGEN" && test -f $QTDOCDIR/qsql.html; then if test -n "$DOXYGEN" && test -x "$DOXYGEN" && test -f $QTDOCDIR/ntqsql.html; then
KDE_HAS_DOXYGEN=yes KDE_HAS_DOXYGEN=yes
fi fi
AC_SUBST(KDE_HAS_DOXYGEN) AC_SUBST(KDE_HAS_DOXYGEN)

@ -158,17 +158,17 @@ patent issues. -->
<para>It slices! It dices! and it comes with a free toaster!</para> <para>It slices! It dices! and it comes with a free toaster!</para>
<para> <para>
The Squiggle Tool <guiicon><inlinemediaobject> The Stquiggle Tool <guiicon><inlinemediaobject>
<imageobject> <imageobject>
<imagedata fileref="squiggle.png" format="PNG"/> <imagedata fileref="stquiggle.png" format="PNG"/>
</imageobject> </imageobject>
<imageobject> <imageobject>
<imagedata fileref="squiggle.eps" format="EPS"/> <imagedata fileref="stquiggle.eps" format="EPS"/>
</imageobject> </imageobject>
<textobject> <textobject>
<phrase>Squiggle</phrase> <phrase>Stquiggle</phrase>
</textobject> </textobject>
</inlinemediaobject></guiicon> is used to draw squiggly lines all over </inlinemediaobject></guiicon> is used to draw stquiggly lines all over
the &videopreview; main window. It's not a bug, it's a feature! the &videopreview; main window. It's not a bug, it's a feature!
</para> </para>
@ -441,7 +441,7 @@ Program copyright 2006 Marco Gulino <email>marco@kmobiletools.org</email>
<para> <para>
Contributors: Contributors:
<itemizedlist> <itemizedlist>
<listitem><para>Konqui the KDE Dragon <email>konqui@kde.org</email></para> <listitem><para>Kontqui the KDE Dragon <email>kontqui@kde.org</email></para>
</listitem> </listitem>
<listitem><para>Tux the Linux Penguin <email>tux@linux.org</email></para> <listitem><para>Tux the Linux Penguin <email>tux@linux.org</email></para>
</listitem> </listitem>

@ -11,7 +11,7 @@
<Doc2 NumberOfViews="1" URL="file:///mnt/dati/Sviluppo/mplayerthumbs/src/videopreview.h" > <Doc2 NumberOfViews="1" URL="file:///mnt/dati/Sviluppo/mplayerthumbs/src/videopreview.h" >
<View0 line="53" Type="Source" /> <View0 line="53" Type="Source" />
</Doc2> </Doc2>
<Doc3 NumberOfViews="1" URL="file:///usr/qt/3/doc/html/qstringlist.html" > <Doc3 NumberOfViews="1" URL="file:///usr/qt/3/doc/html/ntqstringlist.html" >
<View0 Type="Documentation" /> <View0 Type="Documentation" />
</Doc3> </Doc3>
</DocsAndViews> </DocsAndViews>

@ -6,7 +6,7 @@ SUBDIRS = . mplayerthumbsconfig
kde_module_LTLIBRARIES = videopreview.la kde_module_LTLIBRARIES = videopreview.la
videopreview_la_SOURCES = videopreview.cpp mplayerthumbs.kcfgc videopreview_la_SOURCES = videopreview.cpp mplayerthumbs.kcfgc
videopreview_la_LDFLAGS = -avoid-version -module $(all_libraries) $(KDE_PLUGIN) videopreview_la_LDFLAGS = -avoid-version -module $(all_libraries) $(TDE_PLUGIN)
protocoldir = $(kde_servicesdir) protocoldir = $(kde_servicesdir)
@ -14,7 +14,7 @@ messages: rc.cpp
$(EXTRACTRC) `find . -name \*.ui -o -name \*.rc` > rc.cpp $(EXTRACTRC) `find . -name \*.ui -o -name \*.rc` > rc.cpp
$(XGETTEXT) *.cpp -o $(podir)/videopreview.pot $(XGETTEXT) *.cpp -o $(podir)/videopreview.pot
protocol_DATA = videopreview.desktop protocol_DATA = videopreview.desktop
videopreview_la_LIBADD = $(LIB_KDECORE) videopreview_la_LIBADD = $(LIB_TDECORE)
videothumbnail_DATA = sprocket-small.png sprocket-medium.png sprocket-large.png videothumbnail_DATA = sprocket-small.png sprocket-medium.png sprocket-large.png
videothumbnaildir = $(kde_datadir)/videothumbnail videothumbnaildir = $(kde_datadir)/videothumbnail

@ -4,19 +4,19 @@
#include "mplayerthumbs.h" #include "mplayerthumbs.h"
MPlayerThumbsCfg::MPlayerThumbsCfg( ) MPlayerThumbsCfg::MPlayerThumbsCfg( )
: KConfigSkeleton( QString::fromLatin1( "mplayerthumbs" ) ) : TDEConfigSkeleton( TQString::fromLatin1( "mplayerthumbs" ) )
{ {
setCurrentGroup( QString::fromLatin1( "MPlayerThumbsCfg" ) ); setCurrentGroup( TQString::fromLatin1( "MPlayerThumbsCfg" ) );
KConfigSkeleton::ItemString *itemMplayerbin; TDEConfigSkeleton::ItemString *itemMplayerbin;
itemMplayerbin = new KConfigSkeleton::ItemString( currentGroup(), QString::fromLatin1( "mplayerbin" ), mMplayerbin ); itemMplayerbin = new TDEConfigSkeleton::ItemString( currentGroup(), TQString::fromLatin1( "mplayerbin" ), mMplayerbin );
addItem( itemMplayerbin, QString::fromLatin1( "mplayerbin" ) ); addItem( itemMplayerbin, TQString::fromLatin1( "mplayerbin" ) );
KConfigSkeleton::ItemStringList *itemNoextensions; TDEConfigSkeleton::ItemStringList *itemNoextensions;
itemNoextensions = new KConfigSkeleton::ItemStringList( currentGroup(), QString::fromLatin1( "noextensions" ), mNoextensions ); itemNoextensions = new TDEConfigSkeleton::ItemStringList( currentGroup(), TQString::fromLatin1( "noextensions" ), mNoextensions );
addItem( itemNoextensions, QString::fromLatin1( "noextensions" ) ); addItem( itemNoextensions, TQString::fromLatin1( "noextensions" ) );
KConfigSkeleton::ItemString *itemCustomargs; TDEConfigSkeleton::ItemString *itemCustomargs;
itemCustomargs = new KConfigSkeleton::ItemString( currentGroup(), QString::fromLatin1( "customargs" ), mCustomargs ); itemCustomargs = new TDEConfigSkeleton::ItemString( currentGroup(), TQString::fromLatin1( "customargs" ), mCustomargs );
addItem( itemCustomargs, QString::fromLatin1( "customargs" ) ); addItem( itemCustomargs, TQString::fromLatin1( "customargs" ) );
} }
MPlayerThumbsCfg::~MPlayerThumbsCfg() MPlayerThumbsCfg::~MPlayerThumbsCfg()

@ -19,31 +19,31 @@
***************************************************************************/ ***************************************************************************/
#include "mplayerthumbscfg.h" #include "mplayerthumbscfg.h"
#include <qvbox.h> #include <ntqvbox.h>
#include <klineedit.h> #include <klineedit.h>
#include <kpushbutton.h> #include <kpushbutton.h>
#include <qlabel.h> #include <ntqlabel.h>
#include <klocale.h> #include <klocale.h>
#include <kstandarddirs.h> #include <kstandarddirs.h>
#include <kdebug.h> #include <kdebug.h>
#include <qtimer.h> #include <ntqtimer.h>
#include <keditlistbox.h> #include <keditlistbox.h>
MPlayerThumbsConfig::MPlayerThumbsConfig(QWidget *parent, const char *name, MPlayerThumbsCfg *config, DialogType dialogType, int dialogButtons, ButtonCode defaultButton, bool modal) MPlayerThumbsConfig::MPlayerThumbsConfig(TQWidget *parent, const char *name, MPlayerThumbsCfg *config, DialogType dialogType, int dialogButtons, ButtonCode defaultButton, bool modal)
: KConfigDialog(parent, name, config, dialogType, dialogButtons, defaultButton, modal) : KConfigDialog(parent, name, config, dialogType, dialogButtons, defaultButton, modal)
{ {
QVBox *vbox=new QVBox(0); TQVBox *vbox=new TQVBox(0);
vbox->setSpacing( 5); vbox->setSpacing( 5);
new QLabel(i18n("Enter here the path for mplayer executable file."), vbox); new TQLabel(i18n("Enter here the path for mplayer executable file."), vbox);
kcfg_mplayerbin=new KLineEdit( vbox, "kcfg_mplayerbin"); kcfg_mplayerbin=new KLineEdit( vbox, "kcfg_mplayerbin");
new QLabel(i18n("Custom arguments for mplayer."), vbox); new TQLabel(i18n("Custom arguments for mplayer."), vbox);
new KLineEdit( vbox, "kcfg_customargs"); new KLineEdit( vbox, "kcfg_customargs");
new KEditListBox( i18n("Blacklisted File Extensions"), new KEditListBox( i18n("Blacklisted File Extensions"),
vbox, "kcfg_noextensions", true, KEditListBox::Add | KEditListBox::Remove); vbox, "kcfg_noextensions", true, KEditListBox::Add | KEditListBox::Remove);
addPage( vbox, i18n("General"), "mplayer" ); addPage( vbox, i18n("General"), "mplayer" );
kdDebug() << "config->mplayerbin().isNull()::" << config->mplayerbin().length() << endl; kdDebug() << "config->mplayerbin().isNull()::" << config->mplayerbin().length() << endl;
if(!config->mplayerbin().length() ) if(!config->mplayerbin().length() )
QTimer::singleShot( 100, this, SLOT(autoFindPath())); TQTimer::singleShot( 100, this, SLOT(autoFindPath()));
} }
MPlayerThumbsConfig::~MPlayerThumbsConfig() MPlayerThumbsConfig::~MPlayerThumbsConfig()
@ -58,7 +58,7 @@ MPlayerThumbsConfig::~MPlayerThumbsConfig()
*/ */
void MPlayerThumbsConfig::autoFindPath() void MPlayerThumbsConfig::autoFindPath()
{ {
QString playerPath=KStandardDirs::findExe("mplayer-bin"); TQString playerPath=KStandardDirs::findExe("mplayer-bin");
if(playerPath.isNull() ) playerPath=KStandardDirs::findExe("mplayer"); if(playerPath.isNull() ) playerPath=KStandardDirs::findExe("mplayer");
kdDebug() << "Trying to set player path to " << playerPath << endl; kdDebug() << "Trying to set player path to " << playerPath << endl;
kcfg_mplayerbin->setText( playerPath ); kcfg_mplayerbin->setText( playerPath );

@ -27,7 +27,7 @@ class MPlayerThumbsConfig : public KConfigDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
MPlayerThumbsConfig(QWidget *parent, const char *name, MPlayerThumbsCfg *config, DialogType dialogType=IconList, int dialogButtons=Default|Ok|Apply|Cancel, ButtonCode defaultButton=Ok, bool modal=false); MPlayerThumbsConfig(TQWidget *parent, const char *name, MPlayerThumbsCfg *config, DialogType dialogType=IconList, int dialogButtons=Default|Ok|Apply|Cancel, ButtonCode defaultButton=Ok, bool modal=false);
~MPlayerThumbsConfig(); ~MPlayerThumbsConfig();
private: private:
KLineEdit *kcfg_mplayerbin; KLineEdit *kcfg_mplayerbin;

@ -20,24 +20,24 @@
#include "videopreview.h" #include "videopreview.h"
#include <qfile.h> #include <ntqfile.h>
#include <qpixmap.h> #include <ntqpixmap.h>
#include <qimage.h> #include <ntqimage.h>
#include <kstandarddirs.h> #include <kstandarddirs.h>
#include <kpixmapsplitter.h> #include <kpixmapsplitter.h>
#include <kmimetype.h> #include <kmimetype.h>
#include <qpainter.h> #include <ntqpainter.h>
#include <krandomsequence.h> #include <krandomsequence.h>
#include <qdatetime.h> #include <ntqdatetime.h>
#include <qregexp.h> #include <ntqregexp.h>
#include "videopreview.h" #include "videopreview.h"
#include <qprocess.h> #include <ntqprocess.h>
#include <kdebug.h> #include <kdebug.h>
#include <ktempdir.h> #include <ktempdir.h>
#include <kurl.h> #include <kurl.h>
#include <math.h> #include <math.h>
#include <qfileinfo.h> #include <ntqfileinfo.h>
#include "mplayerthumbs.h" #include "mplayerthumbs.h"
@ -66,10 +66,10 @@ VideoPreview::~VideoPreview()
delete mplayerprocess; delete mplayerprocess;
} }
bool VideoPreview::create(const QString &path, int width, int height, QImage &img) bool VideoPreview::create(const TQString &path, int width, int height, TQImage &img)
{ {
MPlayerThumbsCfg *cfg=new MPlayerThumbsCfg(); MPlayerThumbsCfg *cfg=new MPlayerThumbsCfg();
QFileInfo fi(path); TQFileInfo fi(path);
kdDebug() << "videopreview: file extension=\"" << fi.extension().stripWhiteSpace() << "\"\n"; kdDebug() << "videopreview: file extension=\"" << fi.extension().stripWhiteSpace() << "\"\n";
if( fi.extension().stripWhiteSpace().length() && !cfg->noextensions().grep(fi.extension().stripWhiteSpace(), false) if( fi.extension().stripWhiteSpace().length() && !cfg->noextensions().grep(fi.extension().stripWhiteSpace(), false)
.isEmpty() ) .isEmpty() )
@ -79,7 +79,7 @@ bool VideoPreview::create(const QString &path, int width, int height, QImage &im
return false; return false;
} }
playerBin=cfg->mplayerbin(); playerBin=cfg->mplayerbin();
customargs=QStringList::split(" ", cfg->customargs() ); customargs=TQStringList::split(" ", cfg->customargs() );
kdDebug() << "videopreview: customargs=" << cfg->customargs() << " ;;;; " << customargs << endl; kdDebug() << "videopreview: customargs=" << cfg->customargs() << " ;;;; " << customargs << endl;
delete cfg; delete cfg;
if(playerBin.length()) kdDebug() << "videopreview: found playerbin from config: " << playerBin << endl; if(playerBin.length()) kdDebug() << "videopreview: found playerbin from config: " << playerBin << endl;
@ -99,26 +99,26 @@ bool VideoPreview::create(const QString &path, int width, int height, QImage &im
tmpdir=new KTempDir(); tmpdir=new KTempDir();
if(tmpdir->name().isNull() ) return false; if(tmpdir->name().isNull() ) return false;
rand=new KRandomSequence(QDateTime::currentDateTime().toTime_t()); rand=new KRandomSequence(TQDateTime::currentDateTime().toTime_t());
mplayerprocess=new QProcess(); mplayerprocess=new TQProcess();
int flags=0; int flags=0;
KURL furl(path); KURL furl(path);
kdDebug() << "videopreview: url=" << furl << "; local:" << furl.isLocalFile() << endl; kdDebug() << "videopreview: url=" << furl << "; local:" << furl.isLocalFile() << endl;
fileinfo.towidth=width; fileinfo.towidth=width;
fileinfo.toheight=height; fileinfo.toheight=height;
QPixmap pix; TQPixmap pix;
// if(furl.isLocalFile()) // if(furl.isLocalFile())
// { // {
flags=framerandom; flags=framerandom;
QStringList args; TQStringList args;
args << playerBin << path << "-nocache" << "-identify" << "-vo" << "null" << "-frames" << "0"/* << "-nosound" */<< "-ao" << "null"; args << playerBin << path << "-nocache" << "-identify" << "-vo" << "null" << "-frames" << "0"/* << "-nosound" */<< "-ao" << "null";
args+= customargs; args+= customargs;
mplayerprocess->setArguments(args); mplayerprocess->setArguments(args);
mplayerprocess->setCommunication( QProcess::Stdout ); mplayerprocess->setCommunication( TQProcess::Stdout );
mplayerprocess->start(); mplayerprocess->start();
QString lineout; TQString lineout;
QRegExp findsecs("^ID_LENGTH=([\\d]*)"); TQRegExp findsecs("^ID_LENGTH=([\\d]*)");
QRegExp findfps("^ID_VIDEO_FPS=([\\d]*)"); TQRegExp findfps("^ID_VIDEO_FPS=([\\d]*)");
while (mplayerprocess->isRunning() ) usleep (10); while (mplayerprocess->isRunning() ) usleep (10);
do { do {
lineout=mplayerprocess->readLineStdout(); lineout=mplayerprocess->readLineStdout();
@ -127,7 +127,7 @@ bool VideoPreview::create(const QString &path, int width, int height, QImage &im
if(findfps.search( lineout) != -1) if(findfps.search( lineout) != -1)
fileinfo.fps=findfps.cap(1).toInt(); fileinfo.fps=findfps.cap(1).toInt();
if( fileinfo.fps!=0 && fileinfo.seconds!=0 ) break; if( fileinfo.fps!=0 && fileinfo.seconds!=0 ) break;
} while (lineout != QString::null ); } while (lineout != TQString::null );
kdDebug() << "videopreview: find length=" << fileinfo.seconds << ", fps=" << fileinfo.fps << endl; kdDebug() << "videopreview: find length=" << fileinfo.seconds << ", fps=" << fileinfo.fps << endl;
/* } else /* } else
{ {
@ -140,7 +140,7 @@ bool VideoPreview::create(const QString &path, int width, int height, QImage &im
pix=getFrame(path, ((i<LASTTRY) ? flags : framestart ) ); pix=getFrame(path, ((i<LASTTRY) ? flags : framestart ) );
if(!pix.isNull()) { if(!pix.isNull()) {
uint variance=imageVariance(pix.convertToImage()/*.bits(),( (width+ 7) & ~0x7), width, height, 1 */); uint variance=imageVariance(pix.convertToImage()/*.bits(),( (width+ 7) & ~0x7), width, height, 1 */);
kdDebug() << "videopreview: " << QFileInfo(path).fileName() << " frame variance: " << variance << "; " << kdDebug() << "videopreview: " << TQFileInfo(path).fileName() << " frame variance: " << variance << "; " <<
((variance<=40 && ( i!=LASTTRY-1))? "!!!DROPPING!!!" : "GOOD :-)" ) << endl; ((variance<=40 && ( i!=LASTTRY-1))? "!!!DROPPING!!!" : "GOOD :-)" ) << endl;
if(variance>40 || i==LASTTRY-1 ) break; if(variance>40 || i==LASTTRY-1 ) break;
} }
@ -154,17 +154,17 @@ bool VideoPreview::create(const QString &path, int width, int height, QImage &im
Copyright (C) 2002 Simon MacMullen Copyright (C) 2002 Simon MacMullen
Copyright (C) 2003 Ewald Snel <ewald@rambo.its.tudelft.nl> Copyright (C) 2003 Ewald Snel <ewald@rambo.its.tudelft.nl>
* */ * */
// QPixmap pix( createThumbnail( &frame, width, height ) ); // TQPixmap pix( createThumbnail( &frame, width, height ) );
#ifdef STRIPS_SUPPORT #ifdef STRIPS_SUPPORT
QPainter painter( &pix ); TQPainter painter( &pix );
QPixmap sprocket; TQPixmap sprocket;
if (pix.height() < 60) if (pix.height() < 60)
sprocket = QPixmap(locate( "data", "videothumbnail/sprocket-small.png" )); sprocket = TQPixmap(locate( "data", "videothumbnail/sprocket-small.png" ));
else if (pix.height() < 90) else if (pix.height() < 90)
sprocket = QPixmap(locate( "data", "videothumbnail/sprocket-medium.png" )); sprocket = TQPixmap(locate( "data", "videothumbnail/sprocket-medium.png" ));
else else
sprocket = QPixmap(locate( "data", "videothumbnail/sprocket-large.png" )); sprocket = TQPixmap(locate( "data", "videothumbnail/sprocket-large.png" ));
for (int y = 0; y < pix.height() + sprocket.height(); y += sprocket.height()) { for (int y = 0; y < pix.height() + sprocket.height(); y += sprocket.height()) {
painter.drawPixmap( 0, y, sprocket ); painter.drawPixmap( 0, y, sprocket );
@ -178,9 +178,9 @@ bool VideoPreview::create(const QString &path, int width, int height, QImage &im
return true; return true;
} }
QPixmap VideoPreview::getFrame(const QString &path, int flags) TQPixmap VideoPreview::getFrame(const TQString &path, int flags)
{ {
QStringList args; TQStringList args;
kdDebug() << "videopreview: using flags " << flags << endl; kdDebug() << "videopreview: using flags " << flags << endl;
#define START ((fileinfo.seconds*15)/100) #define START ((fileinfo.seconds*15)/100)
#define END ((fileinfo.seconds*70)/100) #define END ((fileinfo.seconds*70)/100)
@ -196,22 +196,22 @@ QPixmap VideoPreview::getFrame(const QString &path, int flags)
{ {
kdDebug() << "videopreview: framerandom\n"; kdDebug() << "videopreview: framerandom\n";
unsigned long start=(unsigned long)(START+(rand->getDouble() * (END - START) ) ); unsigned long start=(unsigned long)(START+(rand->getDouble() * (END - START) ) );
args << "-ss" << QString::number( start ) args << "-ss" << TQString::number( start )
<< "-frames" << "4"; << "-frames" << "4";
} else if (flags & frameend ) } else if (flags & frameend )
{ {
kdDebug() << "videopreview: frameend\n"; kdDebug() << "videopreview: frameend\n";
args << "-ss" << QString::number( fileinfo.seconds - 10 ) args << "-ss" << TQString::number( fileinfo.seconds - 10 )
<< "-frames" << "4"; << "-frames" << "4";
} else if (flags & framestart) } else if (flags & framestart)
{ {
kdDebug() << "videopreview: framestart\n"; kdDebug() << "videopreview: framestart\n";
if(!fileinfo.fps) fileinfo.fps=25; // if we've not autodetected a fps rate, let's assume 25fps.. even if it's wrong it shouldn't hurt. if(!fileinfo.fps) fileinfo.fps=25; // if we've not autodetected a fps rate, let's assume 25fps.. even if it's wrong it shouldn't hurt.
// If we can't skip to a random frame, let's try playing 10 seconds. // If we can't skip to a random frame, let's try playing 10 seconds.
args << "-frames" << QString::number( fileinfo.fps*10 ); args << "-frames" << TQString::number( fileinfo.fps*10 );
} }
args << "-nocache" << "-idx" /*@TODO check if it's too slow..*/ << "-ao" << "null"/*"-nosound" << */<< "-speed" << "99" /*<< "-sstep" << "5"*/ args << "-nocache" << "-idx" /*@TODO check if it's too slow..*/ << "-ao" << "null"/*"-nosound" << */<< "-speed" << "99" /*<< "-sstep" << "5"*/
<< "-vo" << QString("jpeg:outdir=%1").arg(tmpdir->name() ) << "-vf" << QString("scale=%1:%2").arg(fileinfo.towidth).arg(fileinfo.toheight); << "-vo" << TQString("jpeg:outdir=%1").arg(tmpdir->name() ) << "-vf" << TQString("scale=%1:%2").arg(fileinfo.towidth).arg(fileinfo.toheight);
args+=customargs; args+=customargs;
kdDebug() << "videopreview: Starting MPlayer with" << args.join( " ") << endl; kdDebug() << "videopreview: Starting MPlayer with" << args.join( " ") << endl;
// return false; // return false;
@ -220,9 +220,9 @@ QPixmap VideoPreview::getFrame(const QString &path, int flags)
while (mplayerprocess->isRunning() ) usleep (10); while (mplayerprocess->isRunning() ) usleep (10);
if (tmpdir->qDir()->entryList( "*.jpg" ).isEmpty() ) return false; if (tmpdir->qDir()->entryList( "*.jpg" ).isEmpty() ) return false;
QString lastframe=tmpdir->qDir()->entryList( "*.jpg" ).last(); TQString lastframe=tmpdir->qDir()->entryList( "*.jpg" ).last();
kdDebug() << "videopreview: LastFrame==" << lastframe << endl; kdDebug() << "videopreview: LastFrame==" << lastframe << endl;
QPixmap retpix(tmpdir->name().append( lastframe )); TQPixmap retpix(tmpdir->name().append( lastframe ));
return retpix; return retpix;
} }
@ -232,7 +232,7 @@ ThumbCreator::Flags VideoPreview::flags() const
} }
uint VideoPreview::imageVariance(QImage image ) uint VideoPreview::imageVariance(TQImage image )
{ {
uint delta=0; uint delta=0;
uint avg=0; uint avg=0;

@ -21,40 +21,40 @@
#ifndef _videopreview_H_ #ifndef _videopreview_H_
#define _videopreview_H_ #define _videopreview_H_
#include <qstring.h> #include <ntqstring.h>
#include <qcstring.h> #include <ntqcstring.h>
#include <qpixmap.h> #include <ntqpixmap.h>
#include <kio/thumbcreator.h> #include <kio/thumbcreator.h>
class QProcess; class TQProcess;
class QCString; class TQCString;
class KTempDir; class KTempDir;
class KRandomSequence; class KRandomSequence;
class KPixmapSplitter; class KPixmapSplitter;
#include <qobject.h> #include <ntqobject.h>
class VideoPreview : public QObject, public ThumbCreator class VideoPreview : public TQObject, public ThumbCreator
{ {
Q_OBJECT Q_OBJECT
public: public:
VideoPreview(); VideoPreview();
virtual ~VideoPreview(); virtual ~VideoPreview();
virtual bool create(const QString &path, int width, int height, QImage &img); virtual bool create(const TQString &path, int width, int height, TQImage &img);
virtual Flags flags() const; virtual Flags flags() const;
protected: protected:
QPixmap getFrame(const QString &path, int flags); TQPixmap getFrame(const TQString &path, int flags);
static uint imageVariance(QImage image ); static uint imageVariance(TQImage image );
private: private:
KPixmapSplitter *m_splitter; KPixmapSplitter *m_splitter;
char *m_data; char *m_data;
int m_dataSize; int m_dataSize;
QPixmap m_pixmap; TQPixmap m_pixmap;
QProcess *mplayerprocess; TQProcess *mplayerprocess;
QStringList customargs; TQStringList customargs;
KTempDir *tmpdir; KTempDir *tmpdir;
KRandomSequence *rand; KRandomSequence *rand;
QString playerBin; TQString playerBin;
enum frameflags { framerandom=0x1, framestart=0x2, frameend=0x4 }; enum frameflags { framerandom=0x1, framestart=0x2, frameend=0x4 };
struct { int towidth; int toheight; int fps; int seconds; } fileinfo; struct { int towidth; int toheight; int fps; int seconds; } fileinfo;
}; };

Loading…
Cancel
Save