summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/multimedia/opieplayer/config.in3
-rw-r--r--core/multimedia/opieplayer/inputDialog.cpp3
-rw-r--r--core/multimedia/opieplayer/libmad/config.in2
-rw-r--r--core/multimedia/opieplayer/libmad/libmadplugin.h1
-rw-r--r--core/multimedia/opieplayer/libmpeg3/config.in2
-rw-r--r--core/multimedia/opieplayer/main.cpp1
-rw-r--r--core/multimedia/opieplayer/modplug/config.in2
-rw-r--r--core/multimedia/opieplayer/modplug/load_j2b.cpp1
-rw-r--r--core/multimedia/opieplayer/modplug/tables.cpp1
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp4
-rw-r--r--core/multimedia/opieplayer/vorbis/config.in3
-rw-r--r--core/multimedia/opieplayer/vorbis/libtremorplugin.cpp1
-rw-r--r--core/multimedia/opieplayer/vorbis/tremor/config.in2
-rw-r--r--core/multimedia/opieplayer/vorbis/vorbis.pro2
-rw-r--r--core/multimedia/opieplayer/wavplugin/config.in2
15 files changed, 12 insertions, 18 deletions
diff --git a/core/multimedia/opieplayer/config.in b/core/multimedia/opieplayer/config.in
index dc1b79a..a7ac444 100644
--- a/core/multimedia/opieplayer/config.in
+++ b/core/multimedia/opieplayer/config.in
@@ -1,12 +1,13 @@
config OPIEPLAYER
- boolean "opie-mediaplayer (mediaplayer that plays mp3, mpeg, and wav)"
+ boolean "Opieplayer"
default "y"
depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE
source core/multimedia/opieplayer/libflash/config.in
source core/multimedia/opieplayer/libmad/config.in
source core/multimedia/opieplayer/libmpeg3/config.in
source core/multimedia/opieplayer/modplug/config.in
source core/multimedia/opieplayer/wavplugin/config.in
source core/multimedia/opieplayer/vorbis/tremor/config.in
source core/multimedia/opieplayer/vorbis/config.in
+ \ No newline at end of file
diff --git a/core/multimedia/opieplayer/inputDialog.cpp b/core/multimedia/opieplayer/inputDialog.cpp
index 62240b2..38b8f53 100644
--- a/core/multimedia/opieplayer/inputDialog.cpp
+++ b/core/multimedia/opieplayer/inputDialog.cpp
@@ -1,62 +1,59 @@
#include "inputDialog.h"
#include <qpe/resource.h>
#include <opie/ofiledialog.h>
#include <qlineedit.h>
-#include <qlayout.h>
-#include <qvariant.h>
#include <qpushbutton.h>
-#include <qwhatsthis.h>
InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
: QDialog( parent, name, modal, fl ) {
if ( !name ) {
setName( "InputDialog" );
}
resize( 234, 115);
setMaximumSize( QSize( 240, 40));
setCaption( tr( name ) );
QPushButton *browserButton;
browserButton = new QPushButton( Resource::loadIconSet("fileopen"),"",this,"BrowseButton");
browserButton->setGeometry( QRect( 205, 10, 22, 22));
connect( browserButton, SIGNAL(released()),this,SLOT(browse()));
LineEdit1 = new QLineEdit( this, "LineEdit1" );
LineEdit1->setGeometry( QRect( 4, 10, 190, 22 ) );
LineEdit1->setFocus();
}
/*
* return the current text(input)
*/
QString InputDialog::text() const {
return LineEdit1->text();
}
/*
* Destroys the object and frees any allocated resources
*/
InputDialog::~InputDialog() {
}
void InputDialog::browse() {
MimeTypes types;
QStringList audio, video, all;
audio << "audio/*";
audio << "playlist/plain";
audio << "audio/x-mpegurl";
video << "video/*";
video << "playlist/plain";
all += audio;
all += video;
types.insert("All Media Files", all );
types.insert("Audio", audio );
types.insert("Video", video );
QString str = OFileDialog::getOpenFileName( 1,"/","", types, 0 );
LineEdit1->setText(str);
}
diff --git a/core/multimedia/opieplayer/libmad/config.in b/core/multimedia/opieplayer/libmad/config.in
index 72249dc..1239166 100644
--- a/core/multimedia/opieplayer/libmad/config.in
+++ b/core/multimedia/opieplayer/libmad/config.in
@@ -1,4 +1,4 @@
config LIBMAD
- boolean "opieplayer1-libmadplugin (plugin with shoutcast/icecast support to play MP3 files)"
+ boolean "libmadplugin"
default "y"
depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && OPIEPLAYER
diff --git a/core/multimedia/opieplayer/libmad/libmadplugin.h b/core/multimedia/opieplayer/libmad/libmadplugin.h
index 6747712..b05ba15 100644
--- a/core/multimedia/opieplayer/libmad/libmadplugin.h
+++ b/core/multimedia/opieplayer/libmad/libmadplugin.h
@@ -1,117 +1,116 @@
/**********************************************************************
** Copyright (C) 2001 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef LIBMAD_PLUGIN_H
#define LIBMAD_PLUGIN_H
#include <qstring.h>
#include <qpe/mediaplayerplugininterface.h>
/* #include "../mediaplayerplugininterface.h" */
// #define OLD_MEDIAPLAYER_API
class LibMadPluginData;
class LibMadPlugin : public MediaPlayerDecoder {
-
public:
LibMadPlugin();
~LibMadPlugin();
const char *pluginName() { return "LibMadPlugin"; }
const char *pluginComment() { return "This is the libmad library that has been wrapped as a plugin"; }
double pluginVersion() { return 1.0; }
bool isFileSupported( const QString& );
bool open( const QString& );
bool close();
bool isOpen();
const QString &fileInfo() { return info; }
// If decoder doesn't support audio then return 0 here
int audioStreams();
int audioChannels( int stream );
int audioFrequency( int stream );
int audioSamples( int stream );
bool audioSetSample( long sample, int stream );
/* int audioBitsPerSample(int) {return 0;} */
long audioGetSample( int stream );
#ifdef OLD_MEDIAPLAYER_API
bool audioReadMonoSamples( short *output, long samples, long& samplesRead, int stream );
bool audioReadStereoSamples( short *output, long samples, long& samplesRead, int stream );
bool audioReadSamples( short *output, int channel, long samples, int stream );
bool audioReReadSamples( short *output, int channel, long samples, int stream );
#else
bool audioReadSamples( short *output, int channels, long samples, long& samplesRead, int stream );
#endif
bool read();
bool decode( short *output, long samples, long& samplesRead );
void printID3Tags();
// If decoder doesn't support video then return 0 here
int videoStreams() { return 0; }
int videoWidth( int ) { return 0; }
int videoHeight( int ) { return 0; }
double videoFrameRate( int ) { return 0.0; }
int videoFrames( int ) { return 0; }
bool videoSetFrame( long, int ) { return FALSE; }
long videoGetFrame( int ) { return 0; }
bool videoReadFrame( unsigned char **, int, int, int, int, ColorFormat, int ) { return FALSE; }
bool videoReadScaledFrame( unsigned char **, int, int, int, int, int, int, ColorFormat, int ) { return FALSE; }
bool videoReadYUVFrame( char *, char *, char *, int, int, int, int, int ) { return FALSE; }
// Profiling
double getTime();
// Ignore if these aren't supported
bool setSMP( int ) { return FALSE; }
bool setMMX( bool ) { return FALSE; }
// Capabilities
bool supportsAudio() { return TRUE; }
bool supportsVideo() { return FALSE; }
bool supportsYUV() { return FALSE; }
bool supportsMMX() { return TRUE; }
bool supportsSMP() { return FALSE; }
bool supportsStereo() { return TRUE; }
bool supportsScaling() { return FALSE; }
long getPlayTime() { return -1; }
private:
int is_address_multicast(unsigned long address);
int udp_open(char *address, int port);
int tcp_open(char *address, int port);
int http_read_line(int tcp_sock, char *buf, int size) ;
int http_open(const QString& path );
LibMadPluginData *d;
QString info;
int bufferSize;
};
#endif
diff --git a/core/multimedia/opieplayer/libmpeg3/config.in b/core/multimedia/opieplayer/libmpeg3/config.in
index b965a40..b634594 100644
--- a/core/multimedia/opieplayer/libmpeg3/config.in
+++ b/core/multimedia/opieplayer/libmpeg3/config.in
@@ -1,4 +1,4 @@
config LIBMPEG3
- boolean "opieplayer1-libmpeg3plugin (play MPEG3 video files)"
+ boolean "libmpeg3plugin"
default "y"
depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && OPIEPLAYER
diff --git a/core/multimedia/opieplayer/main.cpp b/core/multimedia/opieplayer/main.cpp
index 18cd7a6..32dc1d5 100644
--- a/core/multimedia/opieplayer/main.cpp
+++ b/core/multimedia/opieplayer/main.cpp
@@ -1,56 +1,55 @@
/**********************************************************************
** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
**
** This file is part of the Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
-#include <qpe/qpeapplication.h>
#include "mediaplayerstate.h"
#include "playlistwidget.h"
#include "audiowidget.h"
#include "videowidget.h"
#include "loopcontrol.h"
#include "mediaplayer.h"
MediaPlayerState *mediaPlayerState;
PlayListWidget *playList;
AudioWidget *audioUI;
VideoWidget *videoUI;
LoopControl *loopControl;
int main(int argc, char **argv) {
QPEApplication a(argc,argv);
MediaPlayerState st( 0, "mediaPlayerState" );
mediaPlayerState = &st;
PlayListWidget pl( 0, "playList" );
playList = &pl;
AudioWidget aw( 0, "audioUI" );
audioUI = &aw;
VideoWidget vw( 0, "videoUI" );
videoUI = &vw;
LoopControl lc( 0, "loopControl" );
loopControl = &lc;
MediaPlayer mp( 0, "mediaPlayer" );
// pl.setCaption( MediaPlayer::tr("OpiePlayer") );
a.showMainDocumentWidget(&pl);
return a.exec();
}
diff --git a/core/multimedia/opieplayer/modplug/config.in b/core/multimedia/opieplayer/modplug/config.in
index 86e4725..769db1b 100644
--- a/core/multimedia/opieplayer/modplug/config.in
+++ b/core/multimedia/opieplayer/modplug/config.in
@@ -1,4 +1,4 @@
config MODPLUG
- boolean "opieplayer1-modplugin (play MOD/XM/S3M/IT amiga tracker modules)"
+ boolean "modplugin"
default "y"
depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && OPIEPLAYER
diff --git a/core/multimedia/opieplayer/modplug/load_j2b.cpp b/core/multimedia/opieplayer/modplug/load_j2b.cpp
index 5f60bbb..4f0b85c 100644
--- a/core/multimedia/opieplayer/modplug/load_j2b.cpp
+++ b/core/multimedia/opieplayer/modplug/load_j2b.cpp
@@ -1,18 +1,17 @@
/*
* This program is free software; you can redistribute it and modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the license or (at your
* option) any later version.
*
* Authors: Olivier Lapicque <olivierl@jps.net>
*/
///////////////////////////////////////////////////
//
// J2B module loader
//
///////////////////////////////////////////////////
#include "stdafx.h"
-#include "sndfile.h"
diff --git a/core/multimedia/opieplayer/modplug/tables.cpp b/core/multimedia/opieplayer/modplug/tables.cpp
index e7198b2..baf4517 100644
--- a/core/multimedia/opieplayer/modplug/tables.cpp
+++ b/core/multimedia/opieplayer/modplug/tables.cpp
@@ -1,399 +1,398 @@
/*
* This program is free software; you can redistribute it and modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the license or (at your
* option) any later version.
*
* Authors: Olivier Lapicque <olivierl@jps.net>
*/
#include "stdafx.h"
-#include "sndfile.h"
#ifndef FASTSOUNDLIB
//#pragma data_seg(".tables")
#endif
extern const BYTE ImpulseTrackerPortaVolCmd[16];
const BYTE ImpulseTrackerPortaVolCmd[16] =
{
0x00, 0x01, 0x04, 0x08, 0x10, 0x20, 0x40, 0x60,
0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
};
// Period table for Protracker octaves 0-5:
extern const WORD ProTrackerPeriodTable[6*12];
const WORD ProTrackerPeriodTable[6*12] =
{
1712,1616,1524,1440,1356,1280,1208,1140,1076,1016,960,907,
856,808,762,720,678,640,604,570,538,508,480,453,
428,404,381,360,339,320,302,285,269,254,240,226,
214,202,190,180,170,160,151,143,135,127,120,113,
107,101,95,90,85,80,75,71,67,63,60,56,
53,50,47,45,42,40,37,35,33,31,30,28
};
extern const WORD ProTrackerTunedPeriods[16*12];
const WORD ProTrackerTunedPeriods[16*12] =
{
1712,1616,1524,1440,1356,1280,1208,1140,1076,1016,960,907,
1700,1604,1514,1430,1348,1274,1202,1134,1070,1010,954,900,
1688,1592,1504,1418,1340,1264,1194,1126,1064,1004,948,894,
1676,1582,1492,1408,1330,1256,1184,1118,1056,996,940,888,
1664,1570,1482,1398,1320,1246,1176,1110,1048,990,934,882,
1652,1558,1472,1388,1310,1238,1168,1102,1040,982,926,874,
1640,1548,1460,1378,1302,1228,1160,1094,1032,974,920,868,
1628,1536,1450,1368,1292,1220,1150,1086,1026,968,914,862,
1814,1712,1616,1524,1440,1356,1280,1208,1140,1076,1016,960,
1800,1700,1604,1514,1430,1350,1272,1202,1134,1070,1010,954,
1788,1688,1592,1504,1418,1340,1264,1194,1126,1064,1004,948,
1774,1676,1582,1492,1408,1330,1256,1184,1118,1056,996,940,
1762,1664,1570,1482,1398,1320,1246,1176,1110,1048,988,934,
1750,1652,1558,1472,1388,1310,1238,1168,1102,1040,982,926,
1736,1640,1548,1460,1378,1302,1228,1160,1094,1032,974,920,
1724,1628,1536,1450,1368,1292,1220,1150,1086,1026,968,914
};
// S3M C-4 periods
extern const WORD FreqS3MTable[16];
const WORD FreqS3MTable[16] =
{
1712,1616,1524,1440,1356,1280,
1208,1140,1076,1016,960,907,
0,0,0,0
};
// S3M FineTune frequencies
extern const WORD S3MFineTuneTable[16];
const WORD S3MFineTuneTable[16] =
{
7895,7941,7985,8046,8107,8169,8232,8280,
8363,8413,8463,8529,8581,8651,8723,8757, // 8363*2^((i-8)/(12*8))
};
// Sinus table
extern const short int ModSinusTable[64];
const short int ModSinusTable[64] =
{
0,12,25,37,49,60,71,81,90,98,106,112,117,122,125,126,
127,126,125,122,117,112,106,98,90,81,71,60,49,37,25,12,
0,-12,-25,-37,-49,-60,-71,-81,-90,-98,-106,-112,-117,-122,-125,-126,
-127,-126,-125,-122,-117,-112,-106,-98,-90,-81,-71,-60,-49,-37,-25,-12
};
// Triangle wave table (ramp down)
extern const short int ModRampDownTable[64];
const short int ModRampDownTable[64] =
{
0,-4,-8,-12,-16,-20,-24,-28,-32,-36,-40,-44,-48,-52,-56,-60,
-64,-68,-72,-76,-80,-84,-88,-92,-96,-100,-104,-108,-112,-116,-120,-124,
127,123,119,115,111,107,103,99,95,91,87,83,79,75,71,67,
63,59,55,51,47,43,39,35,31,27,23,19,15,11,7,3
};
// Square wave table
extern const short int ModSquareTable[64];
const short int ModSquareTable[64] =
{
127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,
-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,
-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127
};
// Random wave table
extern const short int ModRandomTable[64];
const short int ModRandomTable[64] =
{
98,-127,-43,88,102,41,-65,-94,125,20,-71,-86,-70,-32,-16,-96,
17,72,107,-5,116,-69,-62,-40,10,-61,65,109,-18,-38,-13,-76,
-23,88,21,-94,8,106,21,-112,6,109,20,-88,-30,9,-127,118,
42,-34,89,-4,-51,-72,21,-29,112,123,84,-101,-92,98,-54,-95
};
// volume fade tables for Retrig Note:
extern const signed char retrigTable1[16];
const signed char retrigTable1[16] =
{ 0, 0, 0, 0, 0, 0, 10, 8, 0, 0, 0, 0, 0, 0, 24, 32 };
extern const signed char retrigTable2[16];
const signed char retrigTable2[16] =
{ 0, -1, -2, -4, -8, -16, 0, 0, 0, 1, 2, 4, 8, 16, 0, 0 };
extern const WORD XMPeriodTable[104];
const WORD XMPeriodTable[104] =
{
907,900,894,887,881,875,868,862,856,850,844,838,832,826,820,814,
808,802,796,791,785,779,774,768,762,757,752,746,741,736,730,725,
720,715,709,704,699,694,689,684,678,675,670,665,660,655,651,646,
640,636,632,628,623,619,614,610,604,601,597,592,588,584,580,575,
570,567,563,559,555,551,547,543,538,535,532,528,524,520,516,513,
508,505,502,498,494,491,487,484,480,477,474,470,467,463,460,457,
453,450,447,443,440,437,434,431
};
extern const UINT XMLinearTable[768];
const UINT XMLinearTable[768] =
{
535232,534749,534266,533784,533303,532822,532341,531861,
531381,530902,530423,529944,529466,528988,528511,528034,
527558,527082,526607,526131,525657,525183,524709,524236,
523763,523290,522818,522346,521875,521404,520934,520464,
519994,519525,519057,518588,518121,517653,517186,516720,
516253,515788,515322,514858,514393,513929,513465,513002,
512539,512077,511615,511154,510692,510232,509771,509312,
508852,508393,507934,507476,507018,506561,506104,505647,
505191,504735,504280,503825,503371,502917,502463,502010,
501557,501104,500652,500201,499749,499298,498848,498398,
497948,497499,497050,496602,496154,495706,495259,494812,
494366,493920,493474,493029,492585,492140,491696,491253,
490809,490367,489924,489482,489041,488600,488159,487718,
487278,486839,486400,485961,485522,485084,484647,484210,
483773,483336,482900,482465,482029,481595,481160,480726,
480292,479859,479426,478994,478562,478130,477699,477268,
476837,476407,475977,475548,475119,474690,474262,473834,
473407,472979,472553,472126,471701,471275,470850,470425,
470001,469577,469153,468730,468307,467884,467462,467041,
466619,466198,465778,465358,464938,464518,464099,463681,
463262,462844,462427,462010,461593,461177,460760,460345,
459930,459515,459100,458686,458272,457859,457446,457033,
456621,456209,455797,455386,454975,454565,454155,453745,
453336,452927,452518,452110,451702,451294,450887,450481,
450074,449668,449262,448857,448452,448048,447644,447240,
446836,446433,446030,445628,445226,444824,444423,444022,
443622,443221,442821,442422,442023,441624,441226,440828,
440430,440033,439636,439239,438843,438447,438051,437656,
437261,436867,436473,436079,435686,435293,434900,434508,
434116,433724,433333,432942,432551,432161,431771,431382,
430992,430604,430215,429827,429439,429052,428665,428278,
427892,427506,427120,426735,426350,425965,425581,425197,
424813,424430,424047,423665,423283,422901,422519,422138,
421757,421377,420997,420617,420237,419858,419479,419101,
418723,418345,417968,417591,417214,416838,416462,416086,
415711,415336,414961,414586,414212,413839,413465,413092,
412720,412347,411975,411604,411232,410862,410491,410121,
409751,409381,409012,408643,408274,407906,407538,407170,
406803,406436,406069,405703,405337,404971,404606,404241,
403876,403512,403148,402784,402421,402058,401695,401333,
400970,400609,400247,399886,399525,399165,398805,398445,
398086,397727,397368,397009,396651,396293,395936,395579,
395222,394865,394509,394153,393798,393442,393087,392733,
392378,392024,391671,391317,390964,390612,390259,389907,
389556,389204,388853,388502,388152,387802,387452,387102,
386753,386404,386056,385707,385359,385012,384664,384317,
383971,383624,383278,382932,382587,382242,381897,381552,
381208,380864,380521,380177,379834,379492,379149,378807,
378466,378124,377783,377442,377102,376762,376422,376082,
375743,375404,375065,374727,374389,374051,373714,373377,
373040,372703,372367,372031,371695,371360,371025,370690,
370356,370022,369688,369355,369021,368688,368356,368023,
367691,367360,367028,366697,366366,366036,365706,365376,
365046,364717,364388,364059,363731,363403,363075,362747,
362420,362093,361766,361440,361114,360788,360463,360137,
359813,359488,359164,358840,358516,358193,357869,357547,
357224,356902,356580,356258,355937,355616,355295,354974,
354654,354334,354014,353695,353376,353057,352739,352420,
352103,351785,351468,351150,350834,350517,350201,349885,
349569,349254,348939,348624,348310,347995,347682,347368,
347055,346741,346429,346116,345804,345492,345180,344869,
344558,344247,343936,343626,343316,343006,342697,342388,
342079,341770,341462,341154,340846,340539,340231,339924,
339618,339311,339005,338700,338394,338089,337784,337479,
337175,336870,336566,336263,335959,335656,335354,335051,
334749,334447,334145,333844,333542,333242,332941,332641,
332341,332041,331741,331442,331143,330844,330546,330247,
329950,329652,329355,329057,328761,328464,328168,327872,
327576,327280,326985,326690,326395,326101,325807,325513,
325219,324926,324633,324340,324047,323755,323463,323171,
322879,322588,322297,322006,321716,321426,321136,320846,
320557,320267,319978,319690,319401,319113,318825,318538,
318250,317963,317676,317390,317103,316817,316532,316246,
315961,315676,315391,315106,314822,314538,314254,313971,
313688,313405,313122,312839,312557,312275,311994,311712,
311431,311150,310869,310589,310309,310029,309749,309470,
309190,308911,308633,308354,308076,307798,307521,307243,
306966,306689,306412,306136,305860,305584,305308,305033,
304758,304483,304208,303934,303659,303385,303112,302838,
302565,302292,302019,301747,301475,301203,300931,300660,
300388,300117,299847,299576,299306,299036,298766,298497,
298227,297958,297689,297421,297153,296884,296617,296349,
296082,295815,295548,295281,295015,294749,294483,294217,
293952,293686,293421,293157,292892,292628,292364,292100,
291837,291574,291311,291048,290785,290523,290261,289999,
289737,289476,289215,288954,288693,288433,288173,287913,
287653,287393,287134,286875,286616,286358,286099,285841,
285583,285326,285068,284811,284554,284298,284041,283785,
283529,283273,283017,282762,282507,282252,281998,281743,
281489,281235,280981,280728,280475,280222,279969,279716,
279464,279212,278960,278708,278457,278206,277955,277704,
277453,277203,276953,276703,276453,276204,275955,275706,
275457,275209,274960,274712,274465,274217,273970,273722,
273476,273229,272982,272736,272490,272244,271999,271753,
271508,271263,271018,270774,270530,270286,270042,269798,
269555,269312,269069,268826,268583,268341,268099,267857
};
extern const signed char ft2VibratoTable[256];
const signed char ft2VibratoTable[256] =
{
0,-2,-3,-5,-6,-8,-9,-11,-12,-14,-16,-17,-19,-20,-22,-23,
-24,-26,-27,-29,-30,-32,-33,-34,-36,-37,-38,-39,-41,-42,
-43,-44,-45,-46,-47,-48,-49,-50,-51,-52,-53,-54,-55,-56,
-56,-57,-58,-59,-59,-60,-60,-61,-61,-62,-62,-62,-63,-63,
-63,-64,-64,-64,-64,-64,-64,-64,-64,-64,-64,-64,-63,-63,
-63,-62,-62,-62,-61,-61,-60,-60,-59,-59,-58,-57,-56,-56,
-55,-54,-53,-52,-51,-50,-49,-48,-47,-46,-45,-44,-43,-42,
-41,-39,-38,-37,-36,-34,-33,-32,-30,-29,-27,-26,-24,-23,
-22,-20,-19,-17,-16,-14,-12,-11,-9,-8,-6,-5,-3,-2,0,
2,3,5,6,8,9,11,12,14,16,17,19,20,22,23,24,26,27,29,30,
32,33,34,36,37,38,39,41,42,43,44,45,46,47,48,49,50,51,
52,53,54,55,56,56,57,58,59,59,60,60,61,61,62,62,62,63,
63,63,64,64,64,64,64,64,64,64,64,64,64,63,63,63,62,62,
62,61,61,60,60,59,59,58,57,56,56,55,54,53,52,51,50,49,
48,47,46,45,44,43,42,41,39,38,37,36,34,33,32,30,29,27,
26,24,23,22,20,19,17,16,14,12,11,9,8,6,5,3,2
};
extern const DWORD FineLinearSlideUpTable[16];
const DWORD FineLinearSlideUpTable[16] =
{
65536, 65595, 65654, 65714, 65773, 65832, 65892, 65951,
66011, 66071, 66130, 66190, 66250, 66309, 66369, 66429
};
extern const DWORD FineLinearSlideDownTable[16];
const DWORD FineLinearSlideDownTable[16] =
{
65535, 65477, 65418, 65359, 65300, 65241, 65182, 65123,
65065, 65006, 64947, 64888, 64830, 64772, 64713, 64645
};
extern const DWORD LinearSlideUpTable[256];
const DWORD LinearSlideUpTable[256] =
{
65536, 65773, 66010, 66249, 66489, 66729, 66971, 67213,
67456, 67700, 67945, 68190, 68437, 68685, 68933, 69182,
69432, 69684, 69936, 70189, 70442, 70697, 70953, 71209,
71467, 71725, 71985, 72245, 72507, 72769, 73032, 73296,
73561, 73827, 74094, 74362, 74631, 74901, 75172, 75444,
75717, 75991, 76265, 76541, 76818, 77096, 77375, 77655,
77935, 78217, 78500, 78784, 79069, 79355, 79642, 79930,
80219, 80509, 80800, 81093, 81386, 81680, 81976, 82272,
82570, 82868, 83168, 83469, 83771, 84074, 84378, 84683,
84989, 85297, 85605, 85915, 86225, 86537, 86850, 87164,
87480, 87796, 88113, 88432, 88752, 89073, 89395, 89718,
90043, 90369, 90695, 91023, 91353, 91683, 92015, 92347,
92681, 93017, 93353, 93691, 94029, 94370, 94711, 95053,
95397, 95742, 96088, 96436, 96785, 97135, 97486, 97839,
98193, 98548, 98904, 99262, 99621, 99981, 100343, 100706,
101070, 101435, 101802, 102170, 102540, 102911, 103283, 103657,
104031, 104408, 104785, 105164, 105545, 105926, 106309, 106694,
107080, 107467, 107856, 108246, 108637, 109030, 109425, 109820,
110217, 110616, 111016, 111418, 111821, 112225, 112631, 113038,
113447, 113857, 114269, 114682, 115097, 115514, 115931, 116351,
116771, 117194, 117618, 118043, 118470, 118898, 119328, 119760,
120193, 120628, 121064, 121502, 121941, 122382, 122825, 123269,
123715, 124162, 124611, 125062, 125514, 125968, 126424, 126881,
127340, 127801, 128263, 128727, 129192, 129660, 130129, 130599,
131072, 131546, 132021, 132499, 132978, 133459, 133942, 134426,
134912, 135400, 135890, 136381, 136875, 137370, 137866, 138365,
138865, 139368, 139872, 140378, 140885, 141395, 141906, 142419,
142935, 143451, 143970, 144491, 145014, 145538, 146064, 146593,
147123, 147655, 148189, 148725, 149263, 149803, 150344, 150888,
151434, 151982, 152531, 153083, 153637, 154192, 154750, 155310,
155871, 156435, 157001, 157569, 158138, 158710, 159284, 159860,
160439, 161019, 161601, 162186, 162772, 163361, 163952, 164545,
};
extern const DWORD LinearSlideDownTable[256];
const DWORD LinearSlideDownTable[256] =
{
65536, 65299, 65064, 64830, 64596, 64363, 64131, 63900,
63670, 63440, 63212, 62984, 62757, 62531, 62305, 62081,
61857, 61634, 61412, 61191, 60970, 60751, 60532, 60314,
60096, 59880, 59664, 59449, 59235, 59021, 58809, 58597,
58385, 58175, 57965, 57757, 57548, 57341, 57134, 56928,
56723, 56519, 56315, 56112, 55910, 55709, 55508, 55308,
55108, 54910, 54712, 54515, 54318, 54123, 53928, 53733,
53540, 53347, 53154, 52963, 52772, 52582, 52392, 52204,
52015, 51828, 51641, 51455, 51270, 51085, 50901, 50717,
50535, 50353, 50171, 49990, 49810, 49631, 49452, 49274,
49096, 48919, 48743, 48567, 48392, 48218, 48044, 47871,
47698, 47526, 47355, 47185, 47014, 46845, 46676, 46508,
46340, 46173, 46007, 45841, 45676, 45511, 45347, 45184,
45021, 44859, 44697, 44536, 44376, 44216, 44056, 43898,
43740, 43582, 43425, 43268, 43112, 42957, 42802, 42648,
42494, 42341, 42189, 42037, 41885, 41734, 41584, 41434,
41285, 41136, 40988, 40840, 40693, 40546, 40400, 40254,
40109, 39965, 39821, 39677, 39534, 39392, 39250, 39108,
38967, 38827, 38687, 38548, 38409, 38270, 38132, 37995,
37858, 37722, 37586, 37450, 37315, 37181, 37047, 36913,
36780, 36648, 36516, 36384, 36253, 36122, 35992, 35862,
35733, 35604, 35476, 35348, 35221, 35094, 34968, 34842,
34716, 34591, 34466, 34342, 34218, 34095, 33972, 33850,
33728, 33606, 33485, 33364, 33244, 33124, 33005, 32886,
32768, 32649, 32532, 32415, 32298, 32181, 32065, 31950,
31835, 31720, 31606, 31492, 31378, 31265, 31152, 31040,
30928, 30817, 30706, 30595, 30485, 30375, 30266, 30157,
30048, 29940, 29832, 29724, 29617, 29510, 29404, 29298,
29192, 29087, 28982, 28878, 28774, 28670, 28567, 28464,
28361, 28259, 28157, 28056, 27955, 27854, 27754, 27654,
27554, 27455, 27356, 27257, 27159, 27061, 26964, 26866,
26770, 26673, 26577, 26481, 26386, 26291, 26196, 26102,
};
extern const int SpectrumSinusTable[256*2];
const int SpectrumSinusTable[256*2] =
{
0, 1, 1, 2, 3, 3, 4, 5, 6, 7, 7, 8, 9, 10, 10, 11,
12, 13, 14, 14, 15, 16, 17, 17, 18, 19, 20, 20, 21, 22, 22, 23,
24, 25, 25, 26, 27, 28, 28, 29, 30, 30, 31, 32, 32, 33, 34, 34,
35, 36, 36, 37, 38, 38, 39, 39, 40, 41, 41, 42, 42, 43, 44, 44,
45, 45, 46, 46, 47, 47, 48, 48, 49, 49, 50, 50, 51, 51, 52, 52,
53, 53, 53, 54, 54, 55, 55, 55, 56, 56, 57, 57, 57, 58, 58, 58,
59, 59, 59, 59, 60, 60, 60, 60, 61, 61, 61, 61, 61, 62, 62, 62,
62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62,
62, 62, 62, 62, 61, 61, 61, 61, 61, 60, 60, 60, 60, 59, 59, 59,
59, 58, 58, 58, 57, 57, 57, 56, 56, 55, 55, 55, 54, 54, 53, 53,
53, 52, 52, 51, 51, 50, 50, 49, 49, 48, 48, 47, 47, 46, 46, 45,
45, 44, 44, 43, 42, 42, 41, 41, 40, 39, 39, 38, 38, 37, 36, 36,
35, 34, 34, 33, 32, 32, 31, 30, 30, 29, 28, 28, 27, 26, 25, 25,
24, 23, 22, 22, 21, 20, 20, 19, 18, 17, 17, 16, 15, 14, 14, 13,
12, 11, 10, 10, 9, 8, 7, 7, 6, 5, 4, 3, 3, 2, 1, 0,
0, -1, -1, -2, -3, -3, -4, -5, -6, -7, -7, -8, -9, -10, -10, -11,
-12, -13, -14, -14, -15, -16, -17, -17, -18, -19, -20, -20, -21, -22, -22, -23,
-24, -25, -25, -26, -27, -28, -28, -29, -30, -30, -31, -32, -32, -33, -34, -34,
-35, -36, -36, -37, -38, -38, -39, -39, -40, -41, -41, -42, -42, -43, -44, -44,
-45, -45, -46, -46, -47, -47, -48, -48, -49, -49, -50, -50, -51, -51, -52, -52,
-53, -53, -53, -54, -54, -55, -55, -55, -56, -56, -57, -57, -57, -58, -58, -58,
-59, -59, -59, -59, -60, -60, -60, -60, -61, -61, -61, -61, -61, -62, -62, -62,
-62, -62, -62, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63,
-63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -62, -62,
-62, -62, -62, -62, -61, -61, -61, -61, -61, -60, -60, -60, -60, -59, -59, -59,
-59, -58, -58, -58, -57, -57, -57, -56, -56, -55, -55, -55, -54, -54, -53, -53,
-53, -52, -52, -51, -51, -50, -50, -49, -49, -48, -48, -47, -47, -46, -46, -45,
-45, -44, -44, -43, -42, -42, -41, -41, -40, -39, -39, -38, -38, -37, -36, -36,
-35, -34, -34, -33, -32, -32, -31, -30, -30, -29, -28, -28, -27, -26, -25, -25,
-24, -23, -22, -22, -21, -20, -20, -19, -18, -17, -17, -16, -15, -14, -14, -13,
-12, -11, -10, -10, -9, -8, -7, -7, -6, -5, -4, -3, -3, -2, -1, 0,
};
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index b393230..8016d8e 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -1,1482 +1,1482 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
// code added by L. J. Potter Sat 03-02-2002 06:17:54
#define QTOPIA_INTERNAL_FSLP
#include <qpe/qcopenvelope_qws.h>
#include <qpe/qpemenubar.h>
#include <qpe/qpetoolbar.h>
#include <qpe/fileselector.h>
#include <qpe/qpeapplication.h>
#include <qpe/lnkproperties.h>
#include <qpe/storage.h>
#include <qpe/applnk.h>
#include <qpe/config.h>
#include <qpe/global.h>
#include <qpe/resource.h>
#include <qaction.h>
#include <qcursor.h>
#include <qimage.h>
#include <qfile.h>
#include <qdir.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qlist.h>
#include <qlistbox.h>
#include <qmainwindow.h>
#include <qmessagebox.h>
#include <qtoolbutton.h>
#include <qtabwidget.h>
#include <qlistview.h>
#include <qpoint.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qregexp.h>
#include <qtextstream.h>
//#include <qtimer.h>
#include "playlistselection.h"
#include "playlistwidget.h"
#include "mediaplayerstate.h"
#include "inputDialog.h"
#include <stdlib.h>
#include "audiowidget.h"
#include "videowidget.h"
#include <unistd.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include <sys/soundcard.h>
// for setBacklight()
#include <linux/fb.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#define BUTTONS_ON_TOOLBAR
#define SIDE_BUTTONS
#define CAN_SAVE_LOAD_PLAYLISTS
extern AudioWidget *audioUI;
extern VideoWidget *videoUI;
extern MediaPlayerState *mediaPlayerState;
static inline QString fullBaseName ( const QFileInfo &fi )
{
QString str = fi. fileName ( );
return str. left ( str. findRev ( '.' ));
}
-QString audioMimes ="audio/mpeg;audio/x-wav;audio/x-ogg;audio/x-mod;audio/x-ogg";
+QString audioMimes ="audio/mpeg;audio/x-wav;application/ogg;audio/x-mod";
// class myFileSelector {
// };
class PlayListWidgetPrivate {
public:
QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove;
QFrame *playListFrame;
FileSelector *files;
PlayListSelection *selectedFiles;
bool setDocumentUsed;
DocLnk *current;
};
class ToolButton : public QToolButton {
public:
ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE )
: QToolButton( parent, name ) {
setTextLabel( name );
setPixmap( Resource::loadPixmap( icon ) );
setAutoRaise( TRUE );
setFocusPolicy( QWidget::NoFocus );
setToggleButton( t );
connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot );
QPEMenuToolFocusManager::manager()->addWidget( this );
}
};
class MenuItem : public QAction {
public:
MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot )
: QAction( text, QString::null, 0, 0 ) {
connect( this, SIGNAL( activated() ), handler, slot );
addTo( parent );
}
};
PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
: QMainWindow( parent, name, fl ) {
d = new PlayListWidgetPrivate;
d->setDocumentUsed = FALSE;
d->current = NULL;
fromSetDocument = FALSE;
insanityBool=FALSE;
audioScan = FALSE;
videoScan = FALSE;
// menuTimer = new QTimer( this ,"menu timer"),
// connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) );
channel = new QCopChannel( "QPE/Application/opieplayer", this );
connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
this, SLOT( qcopReceive(const QCString&, const QByteArray&)) );
setBackgroundMode( PaletteButton );
setCaption( tr("OpiePlayer") );
setIcon( Resource::loadPixmap( "opieplayer/MPEGPlayer" ) );
setToolBarsMovable( FALSE );
// Create Toolbar
QPEToolBar *toolbar = new QPEToolBar( this );
toolbar->setHorizontalStretchable( TRUE );
// Create Menubar
QPEMenuBar *menu = new QPEMenuBar( toolbar );
menu->setMargin( 0 );
QPEToolBar *bar = new QPEToolBar( this );
bar->setLabel( tr( "Play Operations" ) );
// d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "opieplayer/play_current_list",
// this , SLOT( addSelected()) );
tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close");
tbDeletePlaylist->setFlat(TRUE);
tbDeletePlaylist->setFixedSize(20,20);
d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer/add_to_playlist",
this , SLOT(addSelected()) );
d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer/remove_from_playlist",
this , SLOT(removeSelected()) );
// d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool) /* btnPlay() */), TRUE );
d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play",
this , SLOT( btnPlay(bool) ), TRUE );
d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer/shuffle",
mediaPlayerState, SLOT(setShuffled(bool)), TRUE );
d->tbLoop = new ToolButton( bar, tr( "Loop" ),"opieplayer/loop",
mediaPlayerState, SLOT(setLooping(bool)), TRUE );
tbDeletePlaylist->hide();
QPopupMenu *pmPlayList = new QPopupMenu( this );
menu->insertItem( tr( "File" ), pmPlayList );
new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) );
new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) );
new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) );
new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) );
pmPlayList->insertSeparator(-1);
new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) );
new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) );
pmPlayList->insertSeparator(-1);
new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) );
new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) );
QPopupMenu *pmView = new QPopupMenu( this );
menu->insertItem( tr( "View" ), pmView );
fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0);
fullScreenButton->addTo(pmView);
scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("opieplayer/scale"), QString::null, 0, this, 0);
scaleButton->addTo(pmView);
skinsMenu = new QPopupMenu( this );
menu->insertItem( tr( "Skins" ), skinsMenu );
skinsMenu->isCheckable();
connect( skinsMenu, SIGNAL( activated( int ) ) ,
this, SLOT( skinsMenuActivated( int ) ) );
populateSkinsMenu();
QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton );
QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton );
QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton );
tabWidget = new QTabWidget( hbox6, "tabWidget" );
// tabWidget->setTabShape(QTabWidget::Triangular);
QWidget *pTab;
pTab = new QWidget( tabWidget, "pTab" );
// playlistView = new QListView( pTab, "playlistview" );
// playlistView->setMinimumSize(236,260);
tabWidget->insertTab( pTab,"Playlist");
// Add the playlist area
QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton );
d->playListFrame = vbox3;
QGridLayout *layoutF = new QGridLayout( pTab );
layoutF->setSpacing( 2);
layoutF->setMargin( 2);
layoutF->addMultiCellWidget( d->playListFrame , 0, 0, 0, 1 );
QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton );
d->selectedFiles = new PlayListSelection( hbox2);
QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton );
QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold);
QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch
new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) );
new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) );
new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) );
QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch
QWidget *aTab;
aTab = new QWidget( tabWidget, "aTab" );
audioView = new QListView( aTab, "Audioview" );
QGridLayout *layoutA = new QGridLayout( aTab );
layoutA->setSpacing( 2);
layoutA->setMargin( 2);
layoutA->addMultiCellWidget( audioView, 0, 0, 0, 1 );
audioView->addColumn( tr("Title"),-1);
audioView->addColumn(tr("Size"), -1);
audioView->addColumn(tr("Media"),-1);
audioView->addColumn( tr( "Path" ), -1 );
audioView->setColumnAlignment(1, Qt::AlignRight);
audioView->setColumnAlignment(2, Qt::AlignRight);
audioView->setAllColumnsShowFocus(TRUE);
audioView->setMultiSelection( TRUE );
audioView->setSelectionMode( QListView::Extended);
audioView->setSorting( 3, TRUE );
tabWidget->insertTab(aTab,tr("Audio"));
QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold);
// audioView
// populateAudioView();
// videowidget
QWidget *vTab;
vTab = new QWidget( tabWidget, "vTab" );
videoView = new QListView( vTab, "Videoview" );
QGridLayout *layoutV = new QGridLayout( vTab );
layoutV->setSpacing( 2);
layoutV->setMargin( 2);
layoutV->addMultiCellWidget( videoView, 0, 0, 0, 1 );
videoView->addColumn(tr("Title"),-1);
videoView->addColumn(tr("Size"),-1);
videoView->addColumn(tr("Media"),-1);
videoView->addColumn(tr( "Path" ), -1 );
videoView->setColumnAlignment(1, Qt::AlignRight);
videoView->setColumnAlignment(2, Qt::AlignRight);
videoView->setAllColumnsShowFocus(TRUE);
videoView->setMultiSelection( TRUE );
videoView->setSelectionMode( QListView::Extended);
QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold);
tabWidget->insertTab( vTab,tr("Video"));
QWidget *LTab;
LTab = new QWidget( tabWidget, "LTab" );
playLists = new FileSelector( "playlist/plain;audio/x-mpegurl", LTab, "fileselector" , FALSE, FALSE);
QGridLayout *layoutL = new QGridLayout( LTab );
layoutL->setSpacing( 2);
layoutL->setMargin( 2);
layoutL->addMultiCellWidget( playLists, 0, 0, 0, 1 );
tabWidget->insertTab(LTab,tr("Lists"));
connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist()));
connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) );
connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) );
connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) );
///audioView
connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) );
connect( audioView, SIGNAL( returnPressed( QListViewItem *)),
this,SLOT( playIt( QListViewItem *)) );
connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
//videoView
connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) );
connect( videoView, SIGNAL( returnPressed( QListViewItem *)),
this,SLOT( playIt( QListViewItem *)) );
connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
//playlists
connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) );
connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*)));
connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) );
connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) );
connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) );
connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) );
connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) );
setCentralWidget( vbox5 );
Config cfg( "OpiePlayer" );
readConfig( cfg );
currentPlayList = cfg.readEntry("CurrentPlaylist","default");
loadList(DocLnk( currentPlayList));
setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(currentPlayList)));
initializeStates();
}
PlayListWidget::~PlayListWidget() {
Config cfg( "OpiePlayer" );
writeConfig( cfg );
if ( d->current )
delete d->current;
if(d) delete d;
}
void PlayListWidget::initializeStates() {
d->tbPlay->setOn( mediaPlayerState->playing() );
d->tbLoop->setOn( mediaPlayerState->looping() );
d->tbShuffle->setOn( mediaPlayerState->shuffled() );
setPlaylist( true);
}
void PlayListWidget::readConfig( Config& cfg ) {
cfg.setGroup("PlayList");
QString currentString = cfg.readEntry("current", "" );
int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
for ( int i = 0; i < noOfFiles; i++ ) {
QString entryName;
entryName.sprintf( "File%i", i + 1 );
QString linkFile = cfg.readEntry( entryName );
DocLnk lnk( linkFile );
if ( lnk.isValid() ) {
d->selectedFiles->addToSelection( lnk );
}
}
d->selectedFiles->setSelectedItem( currentString);
}
void PlayListWidget::writeConfig( Config& cfg ) const {
d->selectedFiles->writeCurrent( cfg);
cfg.setGroup("PlayList");
int noOfFiles = 0;
d->selectedFiles->first();
do {
const DocLnk *lnk = d->selectedFiles->current();
if ( lnk ) {
QString entryName;
entryName.sprintf( "File%i", noOfFiles + 1 );
// qDebug(entryName);
cfg.writeEntry( entryName, lnk->linkFile() );
// if this link does exist, add it so we have the file
// next time...
if ( !QFile::exists( lnk->linkFile() ) ) {
// the way writing lnks doesn't really check for out
// of disk space, but check it anyway.
// if ( !lnk->writeLink() ) {
// QMessageBox::critical( 0, tr("Out of space"),
// tr( "There was a problem saving "
// "the playlist.\n"
// "Your playlist "
// "may be missing some entries\n"
// "the next time you start it." )
// );
// }
}
noOfFiles++;
}
}
while ( d->selectedFiles->next() );
cfg.writeEntry("NumberOfFiles", noOfFiles );
}
void PlayListWidget::addToSelection( const DocLnk& lnk ) {
d->setDocumentUsed = false;
if ( mediaPlayerState->playlist() ) {
if(QFileInfo(lnk.file()).exists() || lnk.file().left(4) == "http" )
d->selectedFiles->addToSelection( lnk );
}
else
mediaPlayerState->setPlaying( true);
}
void PlayListWidget::clearList() {
while ( first() )
d->selectedFiles->removeSelected();
Config cfg( "OpiePlayer" );
cfg.setGroup("PlayList");
cfg.writeEntry("CurrentPlaylist","");
currentPlayList="";
}
void PlayListWidget::addAllToList() {
DocLnkSet filesAll;
Global::findDocuments(&filesAll, "video/*;audio/*");
QListIterator<DocLnk> Adit( filesAll.children() );
for ( ; Adit.current(); ++Adit )
if(QFileInfo(Adit.current()->file()).exists())
d->selectedFiles->addToSelection( **Adit );
tabWidget->setCurrentPage(0);
writeCurrentM3u();
d->selectedFiles->first();
}
void PlayListWidget::addAllMusicToList() {
QListIterator<DocLnk> dit( files.children() );
for ( ; dit.current(); ++dit )
if(QFileInfo(dit.current()->file()).exists())
d->selectedFiles->addToSelection( **dit );
tabWidget->setCurrentPage(0);
writeCurrentM3u();
d->selectedFiles->first();
}
void PlayListWidget::addAllVideoToList() {
QListIterator<DocLnk> dit( vFiles.children() );
for ( ; dit.current(); ++dit )
if(QFileInfo( dit.current()->file()).exists())
d->selectedFiles->addToSelection( **dit );
tabWidget->setCurrentPage(0);
writeCurrentM3u();
d->selectedFiles->first();
}
void PlayListWidget::setDocument(const QString& fileref) {
fromSetDocument = true;
d->setDocumentUsed = TRUE;
setDocumentEx(fileref);
}
void PlayListWidget::setDocumentEx(const QString& fileref) {
qDebug("opieplayer receive "+fileref);
clearList();
DocLnk lnk;
QFileInfo fileInfo(fileref);
if ( !fileInfo.exists() ) {
QMessageBox::critical( 0, tr( "Invalid File" ),
tr( "There was a problem in getting the file." ) );
return;
}
// qDebug("<<<<<<<<<<<<<<<<<<<<<<setDocument "+fileref);
QString extension = fileInfo.extension(false);
if( extension.find( "m3u", 0, false) != -1) { //is m3u
readm3u( fileref);
}
else if( extension.find( "pls", 0, false) != -1 ) { //is pls
readPls( fileref);
}
else if( fileref.find("playlist",0,TRUE) != -1) {//is playlist
clearList();
lnk.setName( fileInfo.baseName() ); //sets name
lnk.setFile( fileref ); //sets file name
lnk.setIcon("Sound");
//addToSelection( lnk );
loadList( lnk);
d->selectedFiles->first();
} else {
if( fileref.find(".desktop",0,TRUE) != -1) {
lnk = DocLnk(fileref);
} else {
lnk.setName( fileInfo.baseName() ); //sets name
lnk.setFile( fileref ); //sets file name
lnk.setIcon("Sound");
}
addToSelection( lnk );
// addToSelection( DocLnk( fileref ) );
lnk.removeLinkFile();
// qApp->processEvents();
}
setCaption(tr("OpiePlayer"));
d->setDocumentUsed = TRUE;
d->selectedFiles->setSelected(d->selectedFiles->firstChild(),true );
mediaPlayerState->setPlaying( FALSE );
qApp->processEvents();
mediaPlayerState->setPlaying( TRUE );
}
void PlayListWidget::setActiveWindow() {
// qDebug("SETTING active window");
// When we get raised we need to ensure that it switches views
char origView = mediaPlayerState->view();
mediaPlayerState->setView( 'l' ); // invalidate
mediaPlayerState->setView( origView ); // now switch back
}
void PlayListWidget::useSelectedDocument() {
d->setDocumentUsed = FALSE;
}
const DocLnk *PlayListWidget::current() { // this is fugly
switch (tabWidget->currentPageIndex()) {
case 0: //playlist
{
// qDebug("playlist");
if ( mediaPlayerState->playlist() ) {
return d->selectedFiles->current();
}
else if ( d->setDocumentUsed && d->current ) {
return d->current;
} else {
return &(d->files->selectedDocument());
}
}
break;
case 1://audio
{
// qDebug("audioView");
QListIterator<DocLnk> dit( files.children() );
for ( ; dit.current(); ++dit ) {
if( dit.current()->name() == audioView->currentItem()->text(0) && !insanityBool) {
insanityBool=TRUE;
return dit;
}
}
}
break;
case 2: // video
{
QListIterator<DocLnk> Vdit( vFiles.children() );
for ( ; Vdit.current(); ++Vdit ) {
if( Vdit.current()->name() == videoView->currentItem()->text(0) && !insanityBool) {
insanityBool=TRUE;
return Vdit;
}
}
}
break;
};
return 0;
}
bool PlayListWidget::prev() {
if ( mediaPlayerState->playlist() ) {
if ( mediaPlayerState->shuffled() ) {
const DocLnk *cur = current();
int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0));
for ( int i = 0; i < j; i++ ) {
if ( !d->selectedFiles->next() )
d->selectedFiles->first();
}
if ( cur == current() )
if ( !d->selectedFiles->next() )
d->selectedFiles->first();
return TRUE;
} else {
if ( !d->selectedFiles->prev() ) {
if ( mediaPlayerState->looping() ) {
return d->selectedFiles->last();
} else {
return FALSE;
}
}
return TRUE;
}
} else {
return mediaPlayerState->looping();
}
}
bool PlayListWidget::next() {
if ( mediaPlayerState->playlist() ) {
if ( mediaPlayerState->shuffled() ) {
return prev();
} else {
if ( !d->selectedFiles->next() ) {
if ( mediaPlayerState->looping() ) {
return d->selectedFiles->first();
} else {
return FALSE;
}
}
return TRUE;
}
} else {
return mediaPlayerState->looping();
}
}
bool PlayListWidget::first() {
if ( mediaPlayerState->playlist() )
return d->selectedFiles->first();
else
return mediaPlayerState->looping();
}
bool PlayListWidget::last() {
if ( mediaPlayerState->playlist() )
return d->selectedFiles->last();
else
return mediaPlayerState->looping();
}
void PlayListWidget::saveList() {
writem3u();
}
void PlayListWidget::loadList( const DocLnk & lnk) {
QString name = lnk.name();
// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name);
if( name.length()>0) {
setCaption("OpiePlayer: "+name);
// qDebug("<<<<<<<<<<<<load list "+ lnk.file());
clearList();
readm3u(lnk.file());
tabWidget->setCurrentPage(0);
}
}
void PlayListWidget::setPlaylist( bool shown ) {
if ( shown )
d->playListFrame->show();
else
d->playListFrame->hide();
}
void PlayListWidget::setView( char view ) {
if ( view == 'l' )
showMaximized();
else
hide();
}
void PlayListWidget::addSelected() {
DocLnk lnk;
QString filename;
switch (tabWidget->currentPageIndex()) {
case 0: //playlist
return;
break;
case 1: { //audio
QListViewItemIterator it( audioView );
for ( ; it.current(); ++it ) {
if ( it.current()->isSelected() ) {
filename = it.current()->text(3);
lnk.setName( QFileInfo(filename).baseName() ); //sets name
lnk.setFile( filename ); //sets file name
d->selectedFiles->addToSelection( lnk);
}
}
audioView->clearSelection();
// d->selectedFiles->next();
}
break;
case 2: { // video
QListViewItemIterator it( videoView );
for ( ; it.current(); ++it ) {
if ( it.current()->isSelected() ) {
filename = it.current()->text(3);
lnk.setName( QFileInfo(filename).baseName() ); //sets name
lnk.setFile( filename ); //sets file name
d->selectedFiles->addToSelection( lnk);
}
}
videoView->clearSelection();
}
break;
};
// tabWidget->setCurrentPage(0);
writeCurrentM3u();
}
void PlayListWidget::removeSelected() {
d->selectedFiles->removeSelected( );
}
void PlayListWidget::playIt( QListViewItem *) {
// d->setDocumentUsed = FALSE;
// mediaPlayerState->curPosition =0;
// mediaPlayerState->setPlaying(FALSE);
mediaPlayerState->setPlaying(TRUE);
d->selectedFiles->unSelect();
}
void PlayListWidget::addToSelection( QListViewItem *it) {
d->setDocumentUsed = FALSE;
if(it) {
switch ( tabWidget->currentPageIndex()) {
case 0: //playlist
return;
break;
};
// case 1: {
DocLnk lnk;
QString filename;
filename=it->text(3);
lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name
lnk.setFile( filename ); //sets file name
d->selectedFiles->addToSelection( lnk);
if(tabWidget->currentPageIndex() == 0)
writeCurrentM3u();
// tabWidget->setCurrentPage(0);
}
}
void PlayListWidget::tabChanged(QWidget *) {
switch ( tabWidget->currentPageIndex()) {
case 0:
{
if( !tbDeletePlaylist->isHidden())
tbDeletePlaylist->hide();
d->tbRemoveFromList->setEnabled(TRUE);
d->tbAddToList->setEnabled(FALSE);
}
break;
case 1:
{
audioView->clear();
populateAudioView();
if( !tbDeletePlaylist->isHidden())
tbDeletePlaylist->hide();
d->tbRemoveFromList->setEnabled(FALSE);
d->tbAddToList->setEnabled(TRUE);
}
break;
case 2:
{
videoView->clear();
populateVideoView();
if( !tbDeletePlaylist->isHidden())
tbDeletePlaylist->hide();
d->tbRemoveFromList->setEnabled(FALSE);
d->tbAddToList->setEnabled(TRUE);
}
break;
case 3:
{
if( tbDeletePlaylist->isHidden())
tbDeletePlaylist->show();
playLists->reread();
}
break;
};
}
void PlayListWidget::btnPlay(bool b) {
// mediaPlayerState->setPlaying(b);
switch ( tabWidget->currentPageIndex()) {
case 0:
{
// if( d->selectedFiles->current()->file().find(" ",0,TRUE) != -1
// if( d->selectedFiles->current()->file().find("%20",0,TRUE) != -1) {
// QMessageBox::message("Note","You are trying to play\na malformed url.");
// } else {
mediaPlayerState->setPlaying(b);
insanityBool=FALSE;
qDebug("insanity");
// }
}
break;
case 1:
{
// d->selectedFiles->unSelect();
addToSelection( audioView->currentItem() );
mediaPlayerState->setPlaying( b);
d->selectedFiles->removeSelected( );
d->selectedFiles->unSelect();
tabWidget->setCurrentPage(1);
insanityBool=FALSE;
}// audioView->clearSelection();
break;
case 2:
{
addToSelection( videoView->currentItem() );
mediaPlayerState->setPlaying( b);
// qApp->processEvents();
d->selectedFiles->removeSelected( );
d->selectedFiles->unSelect();
tabWidget->setCurrentPage(2);
insanityBool=FALSE;
}// videoView->clearSelection();
break;
};
}
void PlayListWidget::deletePlaylist() {
switch( QMessageBox::information( this, (tr("Remove Playlist?")),
(tr("You really want to delete\nthis playlist?")),
(tr("Yes")), (tr("No")), 0 )){
case 0: // Yes clicked,
QFile().remove(playLists->selectedDocument().file());
QFile().remove(playLists->selectedDocument().linkFile());
playLists->reread();
break;
case 1: // Cancel
break;
};
}
void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint&, int )
{
switch (mouse) {
case 1:
break;
case 2:{
QPopupMenu m;
m.insertItem( tr( "Play" ), this, SLOT( playSelected() ));
m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() ));
m.insertSeparator();
if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() )
m.insertItem( tr( "Properties" ), this, SLOT( listDelete() ));
m.exec( QCursor::pos() );
}
break;
};
}
void PlayListWidget::playSelected()
{
btnPlay( true);
// d->selectedFiles->unSelect();
}
void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint&, int)
{
switch (mouse) {
case 1:
break;
case 2:{
QPopupMenu m;
m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() ));
m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() ));
// m.insertSeparator();
// m.insertItem( tr( "Properties" ), this, SLOT( listDelete() ));
m.exec( QCursor::pos() );
}
break;
};
}
void PlayListWidget::listDelete() {
Config cfg( "OpiePlayer" );
cfg.setGroup("PlayList");
currentPlayList = cfg.readEntry("CurrentPlaylist","");
QString file;
// int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
switch ( tabWidget->currentPageIndex()) {
case 0:
break;
case 1:
{
file = audioView->currentItem()->text(0);
QListIterator<DocLnk> Pdit( files.children() );
for ( ; Pdit.current(); ++Pdit ) {
if( Pdit.current()->name() == file) {
LnkProperties prop( Pdit.current() );
prop.showMaximized();
prop.exec();
}
}
populateAudioView();
}
break;
case 2:
{
// file = videoView->selectedItem()->text(0);
// for ( int i = 0; i < noOfFiles; i++ ) {
// QString entryName;
// entryName.sprintf( "File%i", i + 1 );
// QString linkFile = cfg.readEntry( entryName );
// AppLnk lnk( AppLnk(linkFile));
// if( lnk.name() == file ) {
// LnkProperties prop( &lnk);
// // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *)));
// prop.showMaximized();
// prop.exec();
// }
// }
}
break;
};
}
void PlayListWidget::scanForAudio() {
// qDebug("scan for audio");
files.detachChildren();
QListIterator<DocLnk> sdit( files.children() );
for ( ; sdit.current(); ++sdit ) {
delete sdit.current();
}
Global::findDocuments( &files, audioMimes);
audioScan = true;
}
void PlayListWidget::scanForVideo() {
// qDebug("scan for video");
vFiles.detachChildren();
QListIterator<DocLnk> sdit( vFiles.children() );
for ( ; sdit.current(); ++sdit ) {
delete sdit.current();
}
Global::findDocuments(&vFiles, "video/*");
videoScan = true;
}
void PlayListWidget::populateAudioView() {
audioView->clear();
StorageInfo storageInfo;
const QList<FileSystem> &fs = storageInfo.fileSystems();
if(!audioScan) scanForAudio();
QListIterator<DocLnk> dit( files.children() );
QListIterator<FileSystem> it ( fs );
QString storage;
for ( ; dit.current(); ++dit ) {
for( ; it.current(); ++it ){
const QString name = (*it)->name();
const QString path = (*it)->path();
if(dit.current()->file().find(path) != -1 ) storage=name;
}
QListViewItem * newItem;
if ( QFile( dit.current()->file()).exists() || dit.current()->file().left(4) == "http" ) {
long size;
if( dit.current()->file().left(4) == "http" )
size=0;
else
size = QFile( dit.current()->file() ).size();
// qDebug(dit.current()->name());
newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(),
QString::number(size ), storage, dit.current()->file());
newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/musicfile" ));
}
}
}
void PlayListWidget::populateVideoView() {
videoView->clear();
StorageInfo storageInfo;
const QList<FileSystem> &fs = storageInfo.fileSystems();
if(!videoScan ) scanForVideo();
QListIterator<DocLnk> Vdit( vFiles.children() );
QListIterator<FileSystem> it ( fs );
videoView->clear();
QString storage;
for ( ; Vdit.current(); ++Vdit ) {
for( ; it.current(); ++it ){
const QString name = (*it)->name();
const QString path = (*it)->path();
if( Vdit.current()->file().find(path) != -1 ) storage=name;
}
QListViewItem * newItem;
if ( QFile( Vdit.current()->file()).exists() ) {
newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(),
QString::number( QFile( Vdit.current()->file() ).size() ),
storage, Vdit.current()->file());
newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/videofile" ));
}
}
}
void PlayListWidget::openFile() {
QString filename, name;
InputDialog *fileDlg;
fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0);
fileDlg->exec();
if( fileDlg->result() == 1 ) {
filename = fileDlg->text();
// qDebug( "Selected filename is " + filename );
DocLnk lnk;
Config cfg( "OpiePlayer" );
cfg.setGroup("PlayList");
QString m3uFile;
m3uFile = filename;
if(filename.left(4) == "http") {
if(filename.find(":",8,TRUE) != -1) { //found a port
m3uFile = filename;
if( m3uFile.right( 1 ).find( '/' ) == -1) {
m3uFile += "/";
}
filename = m3uFile;
}
lnk.setName( m3uFile ); //sets name
lnk.setFile( filename ); //sets file name
lnk.setIcon("opieplayer2/musicfile");
d->selectedFiles->addToSelection( lnk );
writeCurrentM3u();
}
else if( filename.right( 3) == "m3u" ) {
readm3u( filename );
} else if( filename.right(3) == "pls" ) {
readPls( filename );
} else {
lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name
lnk.setFile( filename ); //sets file name
d->selectedFiles->addToSelection( lnk);
lnk.removeLinkFile();
writeCurrentM3u();
}
}
if( fileDlg ) {
delete fileDlg;
}
}
/*
reads m3u and shows files/urls to playlist widget */
void PlayListWidget::readm3u( const QString &filename ) {
// qDebug( "read m3u filename " + filename );
Om3u *m3uList;
QString s, name;
m3uList = new Om3u( filename, IO_ReadOnly );
m3uList->readM3u();
DocLnk lnk;
for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) {
s = *it;
// qDebug("reading "+ s);
if(s.left(4)=="http") {
lnk.setName( s ); //sets file name
lnk.setIcon("opieplayer2/musicfile");
// if(s.right(4) != '.' || s.right(5) != '.')
if(s.right(4) != '.' || s.right(5) != '.' )
if( s.right(1) != "/")
lnk.setFile( s+"/"); //if url with no extension
else
lnk.setFile( s ); //sets file name
} else {
// if( QFileInfo( s ).exists() ) {
lnk.setName( fullBaseName ( QFileInfo(s)));
// if(s.right(4) == '.') {//if regular file
if(s.left(1) != "/") {
// qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s);
lnk.setFile( QFileInfo(filename).dirPath()+"/"+s);
lnk.setIcon("SoundPlayer");
} else {
// qDebug("set link2 "+s);
lnk.setFile( s);
lnk.setIcon("SoundPlayer");
}
}
d->selectedFiles->addToSelection( lnk );
}
Config config( "OpiePlayer" );
config.setGroup( "PlayList" );
config.writeEntry("CurrentPlaylist",filename);
config.write();
currentPlayList=filename;
// m3uList->write();
m3uList->close();
if(m3uList) delete m3uList;
d->selectedFiles->setSelectedItem( s);
setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(filename)));
}
/*
reads pls and adds files/urls to playlist */
void PlayListWidget::readPls( const QString &filename ) {
// qDebug( "pls filename is " + filename );
Om3u *m3uList;
QString s, name;
m3uList = new Om3u( filename, IO_ReadOnly );
m3uList->readPls();
for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) {
s = *it;
// s.replace( QRegExp( "%20" )," " );
DocLnk lnk( s );
QFileInfo f( s );
QString name = fullBaseName ( f);
if( name.left( 4 ) == "http" ) {
name = s.right( s.length() - 7);
} else {
name = s;
}
name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 );
lnk.setName( name );
if( s.at( s.length() - 4) == '.') {// if this is probably a file
lnk.setFile( s );
} else { //if its a url
if( name.right( 1 ).find( '/' ) == -1) {
s += "/";
}
lnk.setFile( s );
}
lnk.setType( "audio/x-mpegurl" );
lnk.writeLink();
d->selectedFiles->addToSelection( lnk );
}
m3uList->close();
if(m3uList) delete m3uList;
}
/*
writes current playlist to current m3u file */
void PlayListWidget::writeCurrentM3u() {
// qDebug("writing to current m3u");
Config cfg( "OpiePlayer" );
cfg.setGroup("PlayList");
currentPlayList = cfg.readEntry("CurrentPlaylist","");
Om3u *m3uList;
m3uList = new Om3u( currentPlayList, IO_ReadWrite | IO_Truncate );
if( d->selectedFiles->first()) {
do {
// qDebug( "writeCurrentM3u " +d->selectedFiles->current()->file());
m3uList->add( d->selectedFiles->current()->file() );
}
while ( d->selectedFiles->next() );
// qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" );
m3uList->write();
m3uList->close();
if(m3uList) delete m3uList;
}
}
/*
writes current playlist to m3u file */
void PlayListWidget::writem3u() {
InputDialog *fileDlg;
fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0);
fileDlg->exec();
QString name, filename, list;
Om3u *m3uList;
if( fileDlg->result() == 1 ) {
name = fileDlg->text();
// qDebug( filename );
if( name.find("/",0,true) != -1) {// assume they specify a file path
filename = name;
name = name.right(name.length()- name.findRev("/",-1,true) - 1 );
}
else //otherwise dump it somewhere noticable
filename = QPEApplication::documentDir() + "/" + name;
if( filename.right( 3 ) != "m3u" ) //needs filename extension
filename += ".m3u";
if( d->selectedFiles->first()) {
m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate);
do {
m3uList->add( d->selectedFiles->current()->file());
}
while ( d->selectedFiles->next() );
// qDebug( list );
m3uList->write();
m3uList->close();
if(m3uList) delete m3uList;
if(fileDlg) delete fileDlg;
DocLnk lnk;
lnk.setFile( filename);
lnk.setIcon("opieplayer2/playlist2");
lnk.setName( name); //sets file name
// qDebug(filename);
Config config( "OpiePlayer" );
config.setGroup( "PlayList" );
config.writeEntry("CurrentPlaylist",filename);
currentPlayList=filename;
if(!lnk.writeLink()) {
// qDebug("Writing doclink did not work");
}
setCaption(tr("OpiePlayer: ") + name);
}
}
}
void PlayListWidget::keyReleaseEvent( QKeyEvent *e)
{
switch ( e->key() ) {
////////////////////////////// Zaurus keys
case Key_F9: //activity
// if(audioUI->isHidden())
// audioUI->showMaximized();
break;
case Key_F10: //contacts
// if( videoUI->isHidden())
// videoUI->showMaximized();
break;
case Key_F11: //menu
break;
case Key_F12: //home
// doBlank();
break;
case Key_F13: //mail
// doUnblank();
break;
case Key_Q: //add to playlist
addSelected();
break;
case Key_R: //remove from playlist
removeSelected();
break;
// case Key_P: //play
// qDebug("Play");
// playSelected();
// break;
case Key_Space:
// playSelected(); puh
break;
case Key_1:
tabWidget->setCurrentPage(0);
break;
case Key_2:
tabWidget->setCurrentPage(1);
break;
case Key_3:
tabWidget->setCurrentPage(2);
break;
case Key_4:
tabWidget->setCurrentPage(3);
break;
case Key_Down:
if ( !d->selectedFiles->next() )
d->selectedFiles->first();
break;
case Key_Up:
if ( !d->selectedFiles->prev() )
// d->selectedFiles->last();
break;
}
}
void PlayListWidget::keyPressEvent( QKeyEvent *)
{
// qDebug("Key press");
// switch ( e->key() ) {
// ////////////////////////////// Zaurus keys
// case Key_A: //add to playlist
// qDebug("Add");
// addSelected();
// break;
// case Key_R: //remove from playlist
// removeSelected();
// break;
// case Key_P: //play
// qDebug("Play");
// playSelected();
// break;
// case Key_Space:
// qDebug("Play");
// playSelected();
// break;
// }
}
void PlayListWidget::doBlank() {
- // TODO: why do we blank this way, why don't we use ODevice or ScreenSaver?
+ // qDebug("do blanking");
#ifdef QT_QWS_DEVFS
fd=open("/dev/fb/0",O_RDWR);
#else
fd=open("/dev/fb0",O_RDWR);
#endif
if (fd != -1) {
ioctl(fd,FBIOBLANK,1);
// close(fd);
}
}
void PlayListWidget::doUnblank() {
// this crashes opieplayer with a segfault
// int fd;
// fd=open("/dev/fb0",O_RDWR);
// qDebug("do unblanking");
if (fd != -1) {
ioctl(fd,FBIOBLANK,0);
close(fd);
}
QCopEnvelope h("QPE/System", "setBacklight(int)");
h <<-3;// v[1]; // -3 Force on
}
void PlayListWidget::populateSkinsMenu() {
int item = 0;
defaultSkinIndex = 0;
QString skinName;
Config cfg( "OpiePlayer" );
cfg.setGroup("Options" );
QString skin = cfg.readEntry( "Skin", "default" );
QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" );
skinsDir.setFilter( QDir::Dirs );
skinsDir.setSorting(QDir::Name );
const QFileInfoList *skinslist = skinsDir.entryInfoList();
QFileInfoListIterator it( *skinslist );
QFileInfo *fi;
while ( ( fi = it.current() ) ) {
skinName = fi->fileName();
// qDebug( fi->fileName() );
if( skinName != "." && skinName != ".." && skinName !="CVS" ) {
item = skinsMenu->insertItem( fi->fileName() ) ;
}
if( skinName == "default" ) {
defaultSkinIndex = item;
}
if( skinName == skin ) {
skinsMenu->setItemChecked( item, TRUE );
}
++it;
}
}
void PlayListWidget::skinsMenuActivated( int item ) {
for( int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) {
skinsMenu->setItemChecked( i, FALSE );
}
skinsMenu->setItemChecked( item, TRUE );
Config cfg( "OpiePlayer" );
cfg.setGroup("Options");
cfg.writeEntry("Skin", skinsMenu->text( item ) );
}
void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) {
// qDebug("qcop message "+msg );
QDataStream stream ( data, IO_ReadOnly );
if ( msg == "play()" ) { //plays current selection
btnPlay( true);
} else if ( msg == "stop()" ) {
mediaPlayerState->setPlaying( false);
} else if ( msg == "togglePause()" ) {
mediaPlayerState->togglePaused();
} else if ( msg == "next()" ) { //select next in lis
mediaPlayerState->setNext();
} else if ( msg == "prev()" ) { //select previous in list
mediaPlayerState->setPrev();
} else if ( msg == "toggleLooping()" ) { //loop or not loop
mediaPlayerState->toggleLooping();
} else if ( msg == "toggleShuffled()" ) { //shuffled or not shuffled
mediaPlayerState->toggleShuffled();
} else if ( msg == "volUp()" ) { //volume more
// emit moreClicked();
// emit moreReleased();
} else if ( msg == "volDown()" ) { //volume less
// emit lessClicked();
// emit lessReleased();
} else if ( msg == "play(QString)" ) { //play this now
QString file;
stream >> file;
setDocumentEx( (const QString &) file);
} else if ( msg == "add(QString)" ) { //add to playlist
QString file;
stream >> file;
QFileInfo fileInfo(file);
DocLnk lnk;
lnk.setName( fileInfo.baseName() ); //sets name
lnk.setFile( file ); //sets file name
addToSelection( lnk );
} else if ( msg == "rem(QString)" ) { //remove from playlist
QString file;
stream >> file;
} else if ( msg == "setDocument(QString)" ) { //loop or not loop
QCopEnvelope h("QPE/Application/opieplayer", "raise()");
}
}
diff --git a/core/multimedia/opieplayer/vorbis/config.in b/core/multimedia/opieplayer/vorbis/config.in
index bad9922..d66ec88 100644
--- a/core/multimedia/opieplayer/vorbis/config.in
+++ b/core/multimedia/opieplayer/vorbis/config.in
@@ -1,5 +1,6 @@
config LIBTREMORPLUGIN
- boolean "opieplayer1-libtremorplugin (play OGG vorbis files)"
+ boolean "libtremorplugin"
default "y"
depends ( LIBQPE || LIBQPE-X11 ) && OPIEPLAYER
+ comment "tremor is ogg vorbis!!"
\ No newline at end of file
diff --git a/core/multimedia/opieplayer/vorbis/libtremorplugin.cpp b/core/multimedia/opieplayer/vorbis/libtremorplugin.cpp
index c1e1a23..53c4b2b 100644
--- a/core/multimedia/opieplayer/vorbis/libtremorplugin.cpp
+++ b/core/multimedia/opieplayer/vorbis/libtremorplugin.cpp
@@ -1,274 +1,273 @@
/****************************************************************************
* libtremorplugin.cpp
*
* Copyright (C) 2002 Latchesar Ionkov <lucho@ionkov.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
****************************************************************************/
// fixed and adapted for opieplayer 2003 ljp <llornkcor@handhelds.org>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <time.h>
#include <locale.h>
#include <math.h>
#include <assert.h>
#include <qmap.h>
#include "libtremorplugin.h"
extern "C" {
-#include "tremor/ivorbiscodec.h"
#include "tremor/ivorbisfile.h"
}
#define MPEG_BUFFER_SIZE 65536
//#define debugMsg(a) qDebug(a)
#define debugMsg(a)
class LibTremorPluginData {
public:
char* filename;
FILE* f;
OggVorbis_File vf;
vorbis_info* vi;
vorbis_comment* vc;
bool bos;
int csection;
QString finfo;
};
LibTremorPlugin::LibTremorPlugin() {
qDebug("<<<<<<<<<<<<<TREMOR!!!!!>>>>>>>>>>>>>>>>>>");
d = new LibTremorPluginData;
d->f = 0;
d->vi = 0;
d->vc = 0;
d->bos = 0;
d->csection = 0;
d->finfo = "";
}
LibTremorPlugin::~LibTremorPlugin() {
close();
delete d;
}
bool LibTremorPlugin::isFileSupported( const QString& path ) {
debugMsg( "LibTremorPlugin::isFileSupported" );
// Mpeg file extensions
// "mp2","mp3","m1v","m2v","m2s","mpg","vob","mpeg",ac3"
// Other media extensions
// "wav","mid","mod","s3m","ogg","avi","mov","sid"
char *ext = strrchr( path.latin1(), '.' );
// Test file extension
if ( ext ) {
if ( strncasecmp(ext, ".ogg", 4) == 0 )
return TRUE;
}
return FALSE;
}
bool LibTremorPlugin::open( const QString& path ) {
debugMsg( "LibTremorPlugin::open" );
d->filename = (char*) path.latin1();
d->f = fopen( d->filename, "r" );
if (d->f == 0) {
qDebug("error opening %s", d->filename );
return FALSE;
}
if (ov_open(d->f, &d->vf, NULL, 0) < 0) {
qDebug("error opening %s", d->filename);
return FALSE;
}
d->vc = ov_comment(&d->vf, -1);
d->vi = ov_info(&d->vf, -1);
d->bos = false;
QString comments[] = { "title", "artist", "album", "year", "tracknumber", "" };
QString cdescr[] = { "Title", "Artist", "Album", "Year", "Track", "" };
QMap<QString, QString> cmap;
char** cptr = d->vc->user_comments;
while (*cptr != 0) {
QString s(*cptr);
int n = s.find('=');
if (n < 0) {
continue;
}
QString key = s.left(n).lower();
QString value = s.mid(n+1);
cmap[key] = value;
cptr++;
}
d->finfo = "";
for(int i = 0; !comments[i].isEmpty(); i++) {
QString v = cmap[comments[i].lower()];
if (!v.isEmpty()) {
if (!d->finfo.isEmpty()) {
d->finfo += ", ";
}
d->finfo += cdescr[i] + ": " + v;
}
}
qDebug("finfo: " + d->finfo);
return TRUE;
}
bool LibTremorPlugin::close() {
debugMsg( "LibTremorPlugin::close" );
int result = TRUE;
if (fclose(d->f) == -1) {
qDebug("error closing file %s", d->filename);
result = FALSE;
}
d->f = 0;
d->finfo = "";
return result;
}
bool LibTremorPlugin::isOpen() {
debugMsg( "LibTremorPlugin::isOpen" );
return ( d->f != 0 );
}
const QString &LibTremorPlugin::fileInfo() {
return d->finfo;
}
int LibTremorPlugin::audioStreams() {
debugMsg( "LibTremorPlugin::audioStreams" );
return 1;
}
int LibTremorPlugin::audioChannels( int ) {
qDebug( "LibTremorPlugin::audioChannels: %i", d->vi->channels );
return d->vi->channels;
}
int LibTremorPlugin::audioFrequency( int ) {
qDebug( "LibTremorPlugin::audioFrequency: %ld", d->vi->rate );
return d->vi->rate;
}
int LibTremorPlugin::audioSamples( int ) {
debugMsg( "LibTremorPlugin::audioSamples" );
return (int) ov_pcm_total(&d->vf,-1);
}
bool LibTremorPlugin::audioSetSample( long, int ) {
debugMsg( "LibTremorPlugin::audioSetSample" );
return FALSE;
}
long LibTremorPlugin::audioGetSample( int ) {
debugMsg( "LibTremorPlugin::audioGetSample" );
return 0;
}
bool LibTremorPlugin::audioReadSamples( short *output, int, long samples, long& samplesMade, int ) {
// qDebug( "<<<<<<<<<<<<LibTremorPlugin::audioReadStereoSamples %d", samples );
int old_section = d->csection;
char* buf = (char*) output;
int length = samples * 4;
if ( samples == 0 )
return false;
while (length > 0) {
if (d->bos) {
d->vi = ov_info(&d->vf, -1);
d->vc = ov_comment(&d->vf, -1);
}
int n = 4096;
if (length < n) {
n = length;
}
long ret = ov_read(&d->vf, buf, n, &d->csection);
// qDebug("%d", ret);
if (ret == 0) {
break;
} else if (ret < 0) {
return true;
}
if (old_section != d->csection) {
d->bos = true;
}
buf += ret;
length -= ret;
}
samplesMade = samples;
return true;
}
double LibTremorPlugin::getTime() {
debugMsg( "LibTremorPlugin::getTime" );
return 0.0;
}
diff --git a/core/multimedia/opieplayer/vorbis/tremor/config.in b/core/multimedia/opieplayer/vorbis/tremor/config.in
index 8ee753c..f803d16 100644
--- a/core/multimedia/opieplayer/vorbis/tremor/config.in
+++ b/core/multimedia/opieplayer/vorbis/tremor/config.in
@@ -1,4 +1,4 @@
config LIBTREMOR
- boolean "libtremor (library needed to play OGG files)"
+ boolean "libtremor"
default "y"
depends ( LIBQPE || LIBQPE-X11 ) && OPIEPLAYER
diff --git a/core/multimedia/opieplayer/vorbis/vorbis.pro b/core/multimedia/opieplayer/vorbis/vorbis.pro
index a15cf9c..d566003 100644
--- a/core/multimedia/opieplayer/vorbis/vorbis.pro
+++ b/core/multimedia/opieplayer/vorbis/vorbis.pro
@@ -1,11 +1,11 @@
TEMPLATE = lib
CONFIG += qt warn_on release
-HEADERS = libtremorplugin.h libtremorinimpl.h
+HEADERS = libtremorplugin.h libtremorpluginimpl.h
SOURCES = libtremorplugin.cpp libtremorpluginimpl.cpp
TARGET = tremorplugin
DESTDIR = $(OPIEDIR)/plugins/codecs
INCLUDEPATH += $(OPIEDIR)/include .. tremor
DEPENDPATH += $(OPIEDIR)/include .. tremor
LIBS += -lqpe -lm -ltremor
VERSION = 1.0.0
include ( $(OPIEDIR)/include.pro )
diff --git a/core/multimedia/opieplayer/wavplugin/config.in b/core/multimedia/opieplayer/wavplugin/config.in
index 56bdfab..6e4c4b3 100644
--- a/core/multimedia/opieplayer/wavplugin/config.in
+++ b/core/multimedia/opieplayer/wavplugin/config.in
@@ -1,4 +1,4 @@
config WAVPLUGIN
- boolean "opieplayer1-wavplugin (play WAV files)"
+ boolean "wavplugin"
default "y"
depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && OPIEPLAYER