From 17b1e7850279ce936e0d090c9381d6167a7d548b Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Wed, 24 Jul 2013 10:46:19 -0500 Subject: Convert to TDE R14 API --- src/Makefile.am | 4 +- src/mplayerthumbs.cpp | 22 ++++----- src/mplayerthumbsconfig/mplayerthumbscfg.cpp | 18 +++---- src/mplayerthumbsconfig/mplayerthumbscfg.h | 2 +- src/videopreview.cpp | 72 ++++++++++++++-------------- src/videopreview.h | 28 +++++------ 6 files changed, 73 insertions(+), 73 deletions(-) (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index 4af25eb..d0313b3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -6,7 +6,7 @@ SUBDIRS = . mplayerthumbsconfig kde_module_LTLIBRARIES = videopreview.la 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) @@ -14,7 +14,7 @@ messages: rc.cpp $(EXTRACTRC) `find . -name \*.ui -o -name \*.rc` > rc.cpp $(XGETTEXT) *.cpp -o $(podir)/videopreview.pot 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 videothumbnaildir = $(kde_datadir)/videothumbnail diff --git a/src/mplayerthumbs.cpp b/src/mplayerthumbs.cpp index 12eb3b8..7ceeb86 100644 --- a/src/mplayerthumbs.cpp +++ b/src/mplayerthumbs.cpp @@ -4,19 +4,19 @@ #include "mplayerthumbs.h" MPlayerThumbsCfg::MPlayerThumbsCfg( ) - : KConfigSkeleton( QString::fromLatin1( "mplayerthumbs" ) ) + : TDEConfigSkeleton( TQString::fromLatin1( "mplayerthumbs" ) ) { - setCurrentGroup( QString::fromLatin1( "MPlayerThumbsCfg" ) ); + setCurrentGroup( TQString::fromLatin1( "MPlayerThumbsCfg" ) ); - KConfigSkeleton::ItemString *itemMplayerbin; - itemMplayerbin = new KConfigSkeleton::ItemString( currentGroup(), QString::fromLatin1( "mplayerbin" ), mMplayerbin ); - addItem( itemMplayerbin, QString::fromLatin1( "mplayerbin" ) ); - KConfigSkeleton::ItemStringList *itemNoextensions; - itemNoextensions = new KConfigSkeleton::ItemStringList( currentGroup(), QString::fromLatin1( "noextensions" ), mNoextensions ); - addItem( itemNoextensions, QString::fromLatin1( "noextensions" ) ); - KConfigSkeleton::ItemString *itemCustomargs; - itemCustomargs = new KConfigSkeleton::ItemString( currentGroup(), QString::fromLatin1( "customargs" ), mCustomargs ); - addItem( itemCustomargs, QString::fromLatin1( "customargs" ) ); + TDEConfigSkeleton::ItemString *itemMplayerbin; + itemMplayerbin = new TDEConfigSkeleton::ItemString( currentGroup(), TQString::fromLatin1( "mplayerbin" ), mMplayerbin ); + addItem( itemMplayerbin, TQString::fromLatin1( "mplayerbin" ) ); + TDEConfigSkeleton::ItemStringList *itemNoextensions; + itemNoextensions = new TDEConfigSkeleton::ItemStringList( currentGroup(), TQString::fromLatin1( "noextensions" ), mNoextensions ); + addItem( itemNoextensions, TQString::fromLatin1( "noextensions" ) ); + TDEConfigSkeleton::ItemString *itemCustomargs; + itemCustomargs = new TDEConfigSkeleton::ItemString( currentGroup(), TQString::fromLatin1( "customargs" ), mCustomargs ); + addItem( itemCustomargs, TQString::fromLatin1( "customargs" ) ); } MPlayerThumbsCfg::~MPlayerThumbsCfg() diff --git a/src/mplayerthumbsconfig/mplayerthumbscfg.cpp b/src/mplayerthumbsconfig/mplayerthumbscfg.cpp index f1fc24a..56bea69 100644 --- a/src/mplayerthumbsconfig/mplayerthumbscfg.cpp +++ b/src/mplayerthumbsconfig/mplayerthumbscfg.cpp @@ -19,31 +19,31 @@ ***************************************************************************/ #include "mplayerthumbscfg.h" -#include +#include #include #include -#include +#include #include #include #include -#include +#include #include -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) { - QVBox *vbox=new QVBox(0); + TQVBox *vbox=new TQVBox(0); 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"); - new QLabel(i18n("Custom arguments for mplayer."), vbox); + new TQLabel(i18n("Custom arguments for mplayer."), vbox); new KLineEdit( vbox, "kcfg_customargs"); new KEditListBox( i18n("Blacklisted File Extensions"), vbox, "kcfg_noextensions", true, KEditListBox::Add | KEditListBox::Remove); addPage( vbox, i18n("General"), "mplayer" ); kdDebug() << "config->mplayerbin().isNull()::" << config->mplayerbin().length() << endl; if(!config->mplayerbin().length() ) - QTimer::singleShot( 100, this, SLOT(autoFindPath())); + TQTimer::singleShot( 100, this, SLOT(autoFindPath())); } MPlayerThumbsConfig::~MPlayerThumbsConfig() @@ -58,7 +58,7 @@ MPlayerThumbsConfig::~MPlayerThumbsConfig() */ void MPlayerThumbsConfig::autoFindPath() { - QString playerPath=KStandardDirs::findExe("mplayer-bin"); + TQString playerPath=KStandardDirs::findExe("mplayer-bin"); if(playerPath.isNull() ) playerPath=KStandardDirs::findExe("mplayer"); kdDebug() << "Trying to set player path to " << playerPath << endl; kcfg_mplayerbin->setText( playerPath ); diff --git a/src/mplayerthumbsconfig/mplayerthumbscfg.h b/src/mplayerthumbsconfig/mplayerthumbscfg.h index 6757a4c..92099ac 100644 --- a/src/mplayerthumbsconfig/mplayerthumbscfg.h +++ b/src/mplayerthumbsconfig/mplayerthumbscfg.h @@ -27,7 +27,7 @@ class MPlayerThumbsConfig : public KConfigDialog { Q_OBJECT 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(); private: KLineEdit *kcfg_mplayerbin; diff --git a/src/videopreview.cpp b/src/videopreview.cpp index bf779e6..26e9055 100644 --- a/src/videopreview.cpp +++ b/src/videopreview.cpp @@ -20,24 +20,24 @@ #include "videopreview.h" -#include -#include -#include +#include +#include +#include #include #include #include -#include +#include #include -#include -#include +#include +#include #include "videopreview.h" -#include +#include #include #include #include #include -#include +#include #include "mplayerthumbs.h" @@ -66,10 +66,10 @@ VideoPreview::~VideoPreview() 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(); - QFileInfo fi(path); + TQFileInfo fi(path); kdDebug() << "videopreview: file extension=\"" << fi.extension().stripWhiteSpace() << "\"\n"; if( fi.extension().stripWhiteSpace().length() && !cfg->noextensions().grep(fi.extension().stripWhiteSpace(), false) .isEmpty() ) @@ -79,7 +79,7 @@ bool VideoPreview::create(const QString &path, int width, int height, QImage &im return false; } playerBin=cfg->mplayerbin(); - customargs=QStringList::split(" ", cfg->customargs() ); + customargs=TQStringList::split(" ", cfg->customargs() ); kdDebug() << "videopreview: customargs=" << cfg->customargs() << " ;;;; " << customargs << endl; delete cfg; 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(); if(tmpdir->name().isNull() ) return false; - rand=new KRandomSequence(QDateTime::currentDateTime().toTime_t()); - mplayerprocess=new QProcess(); + rand=new KRandomSequence(TQDateTime::currentDateTime().toTime_t()); + mplayerprocess=new TQProcess(); int flags=0; KURL furl(path); kdDebug() << "videopreview: url=" << furl << "; local:" << furl.isLocalFile() << endl; fileinfo.towidth=width; fileinfo.toheight=height; - QPixmap pix; + TQPixmap pix; // if(furl.isLocalFile()) // { flags=framerandom; - QStringList args; + TQStringList args; args << playerBin << path << "-nocache" << "-identify" << "-vo" << "null" << "-frames" << "0"/* << "-nosound" */<< "-ao" << "null"; args+= customargs; mplayerprocess->setArguments(args); - mplayerprocess->setCommunication( QProcess::Stdout ); + mplayerprocess->setCommunication( TQProcess::Stdout ); mplayerprocess->start(); - QString lineout; - QRegExp findsecs("^ID_LENGTH=([\\d]*)"); - QRegExp findfps("^ID_VIDEO_FPS=([\\d]*)"); + TQString lineout; + TQRegExp findsecs("^ID_LENGTH=([\\d]*)"); + TQRegExp findfps("^ID_VIDEO_FPS=([\\d]*)"); while (mplayerprocess->isRunning() ) usleep (10); do { lineout=mplayerprocess->readLineStdout(); @@ -127,7 +127,7 @@ bool VideoPreview::create(const QString &path, int width, int height, QImage &im if(findfps.search( lineout) != -1) fileinfo.fps=findfps.cap(1).toInt(); 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; /* } else { @@ -140,7 +140,7 @@ bool VideoPreview::create(const QString &path, int width, int height, QImage &im pix=getFrame(path, ((i40 || 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) 2003 Ewald Snel * */ -// QPixmap pix( createThumbnail( &frame, width, height ) ); +// TQPixmap pix( createThumbnail( &frame, width, height ) ); #ifdef STRIPS_SUPPORT - QPainter painter( &pix ); - QPixmap sprocket; + TQPainter painter( &pix ); + TQPixmap sprocket; 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) - sprocket = QPixmap(locate( "data", "videothumbnail/sprocket-medium.png" )); + sprocket = TQPixmap(locate( "data", "videothumbnail/sprocket-medium.png" )); 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()) { painter.drawPixmap( 0, y, sprocket ); @@ -178,9 +178,9 @@ bool VideoPreview::create(const QString &path, int width, int height, QImage &im 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; #define START ((fileinfo.seconds*15)/100) #define END ((fileinfo.seconds*70)/100) @@ -196,22 +196,22 @@ QPixmap VideoPreview::getFrame(const QString &path, int flags) { kdDebug() << "videopreview: framerandom\n"; unsigned long start=(unsigned long)(START+(rand->getDouble() * (END - START) ) ); - args << "-ss" << QString::number( start ) + args << "-ss" << TQString::number( start ) << "-frames" << "4"; } else if (flags & frameend ) { kdDebug() << "videopreview: frameend\n"; - args << "-ss" << QString::number( fileinfo.seconds - 10 ) + args << "-ss" << TQString::number( fileinfo.seconds - 10 ) << "-frames" << "4"; } else if (flags & framestart) { 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 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"*/ - << "-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; kdDebug() << "videopreview: Starting MPlayer with" << args.join( " ") << endl; // return false; @@ -220,9 +220,9 @@ QPixmap VideoPreview::getFrame(const QString &path, int flags) while (mplayerprocess->isRunning() ) usleep (10); 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; - QPixmap retpix(tmpdir->name().append( lastframe )); + TQPixmap retpix(tmpdir->name().append( lastframe )); 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 avg=0; diff --git a/src/videopreview.h b/src/videopreview.h index cb4f255..6adcf2d 100644 --- a/src/videopreview.h +++ b/src/videopreview.h @@ -21,40 +21,40 @@ #ifndef _videopreview_H_ #define _videopreview_H_ -#include -#include +#include +#include -#include +#include #include -class QProcess; -class QCString; +class TQProcess; +class TQCString; class KTempDir; class KRandomSequence; class KPixmapSplitter; -#include +#include -class VideoPreview : public QObject, public ThumbCreator +class VideoPreview : public TQObject, public ThumbCreator { Q_OBJECT public: 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; protected: - QPixmap getFrame(const QString &path, int flags); - static uint imageVariance(QImage image ); + TQPixmap getFrame(const TQString &path, int flags); + static uint imageVariance(TQImage image ); private: KPixmapSplitter *m_splitter; char *m_data; int m_dataSize; - QPixmap m_pixmap; - QProcess *mplayerprocess; - QStringList customargs; + TQPixmap m_pixmap; + TQProcess *mplayerprocess; + TQStringList customargs; KTempDir *tmpdir; KRandomSequence *rand; - QString playerBin; + TQString playerBin; enum frameflags { framerandom=0x1, framestart=0x2, frameend=0x4 }; struct { int towidth; int toheight; int fps; int seconds; } fileinfo; }; -- cgit v1.2.3