summaryrefslogtreecommitdiffstats
path: root/src/xvplayer.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-30 06:10:56 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-30 06:10:56 +0000
commit769e63d24adf5c844137484f06a972fcce732d6a (patch)
tree5185797dcb3ff4b1b3cb71d367123bf89eb2410f /src/xvplayer.cpp
parent0a8af92185eac74d48da1225e6053a0d66c078f5 (diff)
downloadkmplayer-769e63d24adf5c844137484f06a972fcce732d6a.tar.gz
kmplayer-769e63d24adf5c844137484f06a972fcce732d6a.zip
TQt4 port kmplayer
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kmplayer@1238840 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/xvplayer.cpp')
-rw-r--r--src/xvplayer.cpp130
1 files changed, 65 insertions, 65 deletions
diff --git a/src/xvplayer.cpp b/src/xvplayer.cpp
index 7c773c3..3319813 100644
--- a/src/xvplayer.cpp
+++ b/src/xvplayer.cpp
@@ -22,13 +22,13 @@
#include <math.h>
#include <config.h>
#include <dcopclient.h>
-#include <qcstring.h>
-#include <qtimer.h>
-#include <qfile.h>
-#include <qurl.h>
-#include <qthread.h>
-#include <qmutex.h>
-#include <qdom.h>
+#include <tqcstring.h>
+#include <tqtimer.h>
+#include <tqfile.h>
+#include <tqurl.h>
+#include <tqthread.h>
+#include <tqmutex.h>
+#include <tqdom.h>
#include "kmplayer_backend.h"
#include "kmplayer_callback_stub.h"
#include "kmplayer_callback.h"
@@ -60,7 +60,7 @@ static bool reset_xv_autopaint_colorkey;
static bool reset_xv_mute;
static int xvport;
static int xv_encoding = -1;
-static QString xv_norm;
+static TQString xv_norm;
static int xv_frequency;
static int screen;
static int movie_width;
@@ -84,21 +84,21 @@ enum {
limit_last
};
static struct Limit { int min; int max; } xv_limits [limit_last];
-static QString elmentry ("entry");
-static QString elmitem ("item");
-static QString attname ("name");
-static QString atttype ("type");
-static QString attdefault ("DEFAULT");
-static QString attvalue ("value");
-//static QString attstart ("START");
-//static QString attend ("END");
-//static QString valrange ("range");
-//static QString valnum ("num");
-//static QString valbool ("bool");
-//static QString valenum ("enum");
-//static QString valstring ("string");
-static QString valtree ("tree");
-static QByteArray config_buf;
+static TQString elmentry ("entry");
+static TQString elmitem ("item");
+static TQString attname ("name");
+static TQString atttype ("type");
+static TQString attdefault ("DEFAULT");
+static TQString attvalue ("value");
+//static TQString attstart ("START");
+//static TQString attend ("END");
+//static TQString valrange ("range");
+//static TQString valnum ("num");
+//static TQString valbool ("bool");
+//static TQString valenum ("enum");
+//static TQString valstring ("string");
+static TQString valtree ("tree");
+static TQByteArray config_buf;
extern "C" {
@@ -113,15 +113,15 @@ static void putVideo () {
using namespace KMPlayer;
Backend::Backend ()
- : DCOPObject (QCString ("Backend")) {
+ : DCOPObject (TQCString ("Backend")) {
}
Backend::~Backend () {}
-void Backend::setURL (QString) {
+void Backend::setURL (TQString) {
}
-void Backend::setSubTitleURL (QString) {
+void Backend::setSubTitleURL (TQString) {
}
void Backend::play (int) {
@@ -129,7 +129,7 @@ void Backend::play (int) {
}
void Backend::stop () {
- QTimer::singleShot (0, xvapp, SLOT (stop ()));
+ TQTimer::singleShot (0, xvapp, TQT_SLOT (stop ()));
}
void Backend::pause () {
@@ -167,10 +167,10 @@ void Backend::frequency (int f) {
xvapp->frequency (f);
}
-void Backend::setAudioLang (int, QString) {
+void Backend::setAudioLang (int, TQString) {
}
-void Backend::setSubtitle (int, QString) {
+void Backend::setSubtitle (int, TQString) {
}
void Backend::quit () {
@@ -179,29 +179,29 @@ void Backend::quit () {
if (running)
stop ();
else
- QTimer::singleShot (0, qApp, SLOT (quit ()));
+ TQTimer::singleShot (0, tqApp, TQT_SLOT (quit ()));
}
-bool updateConfigEntry (const QString & name, const QString & value) {
+bool updateConfigEntry (const TQString & name, const TQString & value) {
fprintf (stderr, "%s=%s\n", name.ascii (), (const char *) value.local8Bit ());
return true;
}
-void Backend::setConfig (QByteArray data) {
- QString err;
+void Backend::setConfig (TQByteArray data) {
+ TQString err;
int line, column;
- QDomDocument dom;
+ TQDomDocument dom;
if (dom.setContent (data, false, &err, &line, &column)) {
if (dom.childNodes().length() == 1) {
- for (QDomNode node = dom.firstChild().firstChild();
+ for (TQDomNode node = dom.firstChild().firstChild();
!node.isNull ();
node = node.nextSibling ()) {
- QDomNamedNodeMap attr = node.attributes ();
+ TQDomNamedNodeMap attr = node.attributes ();
updateConfigEntry (attr.namedItem (attname).nodeValue (),
attr.namedItem (attvalue).nodeValue ());
}
} else
- err = QString ("invalid data");
+ err = TQString ("invalid data");
}
if (callback)
callback->errorMessage (0, err);
@@ -212,7 +212,7 @@ bool Backend::isPlaying () {
}
KXVideoPlayer::KXVideoPlayer (int _argc, char ** _argv)
- : QApplication (_argc, _argv, false), mute_timer (0) {
+ : TQApplication (_argc, _argv, false), mute_timer (0) {
}
void KXVideoPlayer::init () {
@@ -226,17 +226,17 @@ void KXVideoPlayer::init () {
wid = XCreateSimpleWindow(display, XDefaultRootWindow(display),
xpos, ypos, width, height, 1, 0, 0);
if (!callback)
- QTimer::singleShot (10, this, SLOT (play ()));
+ TQTimer::singleShot (10, this, TQT_SLOT (play ()));
XSelectInput (display, wid,
(PointerMotionMask | ExposureMask | KeyPressMask | ButtonPressMask | StructureNotifyMask)); // | SubstructureNotifyMask));
XvAdaptorInfo * ai;
unsigned int adaptors;
xv_success = true;
- QDomDocument doc;
- QDomElement root = doc.createElement (QString ("document"));
+ TQDomDocument doc;
+ TQDomElement root = doc.createElement (TQString ("document"));
if (XvQueryAdaptors (display, XDefaultRootWindow (display), &adaptors, &ai) == Success) {
- QDomElement elm = doc.createElement (elmentry);
- elm.setAttribute (attname, QString ("XVideo"));
+ TQDomElement elm = doc.createElement (elmentry);
+ elm.setAttribute (attname, TQString ("XVideo"));
elm.setAttribute (atttype, valtree);
for (unsigned i = 0; i < adaptors; i++) {
if ((ai[i].type & XvInputMask) &&
@@ -270,21 +270,21 @@ void KXVideoPlayer::init () {
unsigned nr_encode;
XvQueryEncodings (display, port, &nr_encode, &encodings);
if (encodings) {
- QDomElement port_item = doc.createElement (QString("Port"));
- port_item.setAttribute (attvalue, QString::number (port));
+ TQDomElement port_item = doc.createElement (TQString("Port"));
+ port_item.setAttribute (attvalue, TQString::number (port));
if (freq_found)
- port_item.setAttribute (QString("FREQ"), QString("1"));
+ port_item.setAttribute (TQString("FREQ"), TQString("1"));
for (unsigned i = 0; i < nr_encode; i++) {
if (strcmp (encodings[i].name, "XV_IMAGE")) {
- if (xvport == port && xv_encoding < 0 && !xv_norm.isEmpty () && QString (encodings[i].name).lower ().startsWith(xv_norm.lower ()))
+ if (xvport == port && xv_encoding < 0 && !xv_norm.isEmpty () && TQString (encodings[i].name).lower ().startsWith(xv_norm.lower ()))
xv_encoding = encodings[i].encoding_id;
if (port == xvport && encodings[i].encoding_id == xv_encoding) {
movie_width = encodings[i].width;
movie_height = encodings[i].height;
}
- QDomElement item = doc.createElement (QString ("Input"));
- item.setAttribute (attvalue, QString::number (encodings[i].encoding_id));
- item.setAttribute (attname, QString (encodings[i].name));
+ TQDomElement item = doc.createElement (TQString ("Input"));
+ item.setAttribute (attvalue, TQString::number (encodings[i].encoding_id));
+ item.setAttribute (attname, TQString (encodings[i].name));
port_item.appendChild (item);
fprintf (stderr, " encoding: %d %s\n", ( int ) encodings[i].encoding_id, encodings[i].name);
}
@@ -298,7 +298,7 @@ void KXVideoPlayer::init () {
XvFreeAdaptorInfo(ai);
}
doc.appendChild (root);
- QCString exp = doc.toCString ();
+ TQCString exp = doc.toCString ();
config_buf = exp;
//fprintf (stderr, "%s\n", (const char *)exp);
config_buf.resize (exp.length ()); // strip terminating \0
@@ -332,11 +332,11 @@ KXVideoPlayer::~KXVideoPlayer () {
xvapp = 0L;
}
-void getConfigEntries (QByteArray & buf) {
- QDomDocument doc;
- QDomElement root = doc.createElement (QString ("document"));
+void getConfigEntries (TQByteArray & buf) {
+ TQDomDocument doc;
+ TQDomElement root = doc.createElement (TQString ("document"));
doc.appendChild (root);
- QCString exp = doc.toCString ();
+ TQCString exp = doc.toCString ();
buf = exp;
buf.resize (exp.length ()); // strip terminating \0
}
@@ -346,7 +346,7 @@ void KXVideoPlayer::play () {
if (!xv_success)
return;
if (callback && movie_width > 0 && movie_height > 0)
- callback->movieParams (0, movie_width, movie_height, 1.0*movie_width/movie_height, QStringList (), QStringList ());
+ callback->movieParams (0, movie_width, movie_height, 1.0*movie_width/movie_height, TQStringList (), TQStringList ());
XLockDisplay (display);
if (!running && XvGrabPort (display, xvport, CurrentTime) == Success) {
gc = XCreateGC (display, wid, 0, NULL);
@@ -404,7 +404,7 @@ void KXVideoPlayer::play () {
putVideo ();
if (callback) {
callback->playing ();
- callback->statusMessage ((int) KMPlayer::Callback::stat_hasvideo, QString ());
+ callback->statusMessage ((int) KMPlayer::Callback::stat_hasvideo, TQString ());
}
}
XUnlockDisplay (display);
@@ -435,11 +435,11 @@ void KXVideoPlayer::stop () {
if (callback)
callback->finished ();
else
- QTimer::singleShot (0, qApp, SLOT (quit ()));
+ TQTimer::singleShot (0, tqApp, TQT_SLOT (quit ()));
}
void KXVideoPlayer::finished () {
- QTimer::singleShot (10, this, SLOT (stop ()));
+ TQTimer::singleShot (10, this, TQT_SLOT (stop ()));
}
void KXVideoPlayer::saturation (int val) {
@@ -502,12 +502,12 @@ void KXVideoPlayer::frequency (int val) {
}
}
-void KXVideoPlayer::saveState (QSessionManager & sm) {
+void KXVideoPlayer::saveState (TQSessionManager & sm) {
if (callback)
- sm.setRestartHint (QSessionManager::RestartNever);
+ sm.setRestartHint (TQSessionManager::RestartNever);
}
-void KXVideoPlayer::timerEvent (QTimerEvent * e) {
+void KXVideoPlayer::timerEvent (TQTimerEvent * e) {
if (e->timerId () == mute_timer) {
int step = (current_volume - xv_limits[limit_volume].min) / 20;
if (step > 0 && tmp_volume == xv_limits[limit_volume].min) {
@@ -528,7 +528,7 @@ void KXVideoPlayer::timerEvent (QTimerEvent * e) {
killTimer (e->timerId ());
}
-class XEventThread : public QThread {
+class XEventThread : public TQThread {
protected:
void run () {
Time prev_click_time = 0;
@@ -647,8 +647,8 @@ int main(int argc, char **argv) {
strncpy (configfile, argv [++i], sizeof (configfile));
configfile[sizeof (configfile) - 1] = 0;
} else if (!strcmp (argv [i], "-cb")) {
- QString str = argv [++i];
- int pos = str.find ('/');
+ TQString str = argv [++i];
+ int pos = str.tqfind ('/');
if (pos > -1) {
fprintf (stderr, "callback is %s %s\n", str.left (pos).ascii (), str.mid (pos + 1).ascii ());
callback = new KMPlayer::Callback_stub