summaryrefslogtreecommitdiff
authorchicken <chicken>2004-03-01 17:07:58 (UTC)
committer chicken <chicken>2004-03-01 17:07:58 (UTC)
commit796de538b7b7bc7c3e2af3e8dd081000c21569ac (patch) (unidiff)
treefbe33813de3cd593baa44bbf6d6340709b836490
parent8de0eea414192d758746a5f3950b9765e9709bf9 (diff)
downloadopie-796de538b7b7bc7c3e2af3e8dd081000c21569ac.zip
opie-796de538b7b7bc7c3e2af3e8dd081000c21569ac.tar.gz
opie-796de538b7b7bc7c3e2af3e8dd081000c21569ac.tar.bz2
fix includes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/audiodevice.cpp1
-rw-r--r--core/multimedia/opieplayer/audiowidget.cpp6
-rw-r--r--core/multimedia/opieplayer/mediaplayer.cpp7
-rw-r--r--core/multimedia/opieplayer/mediaplayerstate.cpp2
-rw-r--r--core/multimedia/opieplayer/modplug/load_j2b.cpp1
-rw-r--r--core/multimedia/opieplayer/om3u.cpp15
-rw-r--r--core/multimedia/opieplayer/playlistselection.cpp8
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp25
-rw-r--r--core/multimedia/opieplayer/videowidget.cpp4
-rw-r--r--core/opie-login/loginwindowimpl.cpp4
-rw-r--r--core/opie-login/main.cpp4
-rw-r--r--core/opie-login/opie-login.pro2
12 files changed, 2 insertions, 77 deletions
diff --git a/core/multimedia/opieplayer/audiodevice.cpp b/core/multimedia/opieplayer/audiodevice.cpp
index d296d27..355062b 100644
--- a/core/multimedia/opieplayer/audiodevice.cpp
+++ b/core/multimedia/opieplayer/audiodevice.cpp
@@ -1,155 +1,154 @@
1/********************************************************************** 1/**********************************************************************
2 ** Copyright (C) 2000 Trolltech AS. All rights reserved. 2 ** Copyright (C) 2000 Trolltech AS. All rights reserved.
3 ** 3 **
4 ** This file is part of Qtopia Environment. 4 ** This file is part of Qtopia Environment.
5 ** 5 **
6 ** This file may be distributed and/or modified under the terms of the 6 ** This file may be distributed and/or modified under the terms of the
7 ** GNU General Public License version 2 as published by the Free Software 7 ** GNU General Public License version 2 as published by the Free Software
8 ** Foundation and appearing in the file LICENSE.GPL included in the 8 ** Foundation and appearing in the file LICENSE.GPL included in the
9 ** packaging of this file. 9 ** packaging of this file.
10 ** 10 **
11 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13 ** 13 **
14 ** See http://www.trolltech.com/gpl/ for GPL licensing information. 14 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
15 ** 15 **
16 ** Contact info@trolltech.com if any conditions of this licensing are 16 ** Contact info@trolltech.com if any conditions of this licensing are
17 ** not clear to you. 17 ** not clear to you.
18 ** 18 **
19 **********************************************************************/ 19 **********************************************************************/
20// L.J.Potter added better error code Fri 02-15-2002 14:37:47 20// L.J.Potter added better error code Fri 02-15-2002 14:37:47
21 21
22 22
23#include <stdlib.h> 23#include <stdlib.h>
24#include <stdio.h> 24#include <stdio.h>
25#include <qpe/qpeapplication.h> 25#include <qpe/qpeapplication.h>
26#include <qpe/config.h> 26#include <qpe/config.h>
27#include <qpe/custom.h>
28#include <qmessagebox.h> 27#include <qmessagebox.h>
29 28
30#include "audiodevice.h" 29#include "audiodevice.h"
31 30
32 31
33#include <errno.h> 32#include <errno.h>
34 33
35#if !defined(QT_NO_COP) 34#if !defined(QT_NO_COP)
36#include <qpe/qcopenvelope_qws.h> 35#include <qpe/qcopenvelope_qws.h>
37#endif 36#endif
38 37
39#if defined(Q_WS_X11) || defined(Q_WS_QWS) 38#if defined(Q_WS_X11) || defined(Q_WS_QWS)
40#include <fcntl.h> 39#include <fcntl.h>
41#include <sys/ioctl.h> 40#include <sys/ioctl.h>
42#include <sys/soundcard.h> 41#include <sys/soundcard.h>
43#include <sys/stat.h> 42#include <sys/stat.h>
44#include <sys/time.h> 43#include <sys/time.h>
45#include <sys/types.h> 44#include <sys/types.h>
46#include <unistd.h> 45#include <unistd.h>
47#endif 46#endif
48 47
49#ifdef OPIE_SOUND_FRAGMENT_SHIFT 48#ifdef OPIE_SOUND_FRAGMENT_SHIFT
50static const int sound_fragment_shift = OPIE_SOUND_FRAGMENT_SHIFT; 49static const int sound_fragment_shift = OPIE_SOUND_FRAGMENT_SHIFT;
51#else 50#else
52static const int sound_fragment_shift = 16; 51static const int sound_fragment_shift = 16;
53#endif 52#endif
54static const int sound_fragment_bytes = (1<<sound_fragment_shift); 53static const int sound_fragment_bytes = (1<<sound_fragment_shift);
55//#endif 54//#endif
56 55
57 56
58class AudioDevicePrivate { 57class AudioDevicePrivate {
59public: 58public:
60 int handle; 59 int handle;
61 unsigned int frequency; 60 unsigned int frequency;
62 unsigned int channels; 61 unsigned int channels;
63 unsigned int bytesPerSample; 62 unsigned int bytesPerSample;
64 unsigned int bufferSize; 63 unsigned int bufferSize;
65//#ifndef Q_OS_WIN32 64//#ifndef Q_OS_WIN32
66 bool can_GETOSPACE; 65 bool can_GETOSPACE;
67 char* unwrittenBuffer; 66 char* unwrittenBuffer;
68 unsigned int unwritten; 67 unsigned int unwritten;
69//#endif 68//#endif
70 69
71 static int dspFd; 70 static int dspFd;
72 static bool muted; 71 static bool muted;
73 static unsigned int leftVolume; 72 static unsigned int leftVolume;
74 static unsigned int rightVolume; 73 static unsigned int rightVolume;
75}; 74};
76 75
77 76
78#ifdef Q_WS_QWS 77#ifdef Q_WS_QWS
79// This is for keeping the device open in-between playing files when 78// This is for keeping the device open in-between playing files when
80// the device makes clicks and it starts to drive you insane! :) 79// the device makes clicks and it starts to drive you insane! :)
81// Best to have the device not open when not using it though 80// Best to have the device not open when not using it though
82//#define KEEP_DEVICE_OPEN 81//#define KEEP_DEVICE_OPEN
83#endif 82#endif
84 83
85 84
86int AudioDevicePrivate::dspFd = 0; 85int AudioDevicePrivate::dspFd = 0;
87bool AudioDevicePrivate::muted = FALSE; 86bool AudioDevicePrivate::muted = FALSE;
88unsigned int AudioDevicePrivate::leftVolume = 0; 87unsigned int AudioDevicePrivate::leftVolume = 0;
89unsigned int AudioDevicePrivate::rightVolume = 0; 88unsigned int AudioDevicePrivate::rightVolume = 0;
90 89
91 90
92void AudioDevice::getVolume( unsigned int& leftVolume, unsigned int& rightVolume, bool &muted ) { 91void AudioDevice::getVolume( unsigned int& leftVolume, unsigned int& rightVolume, bool &muted ) {
93 muted = AudioDevicePrivate::muted; 92 muted = AudioDevicePrivate::muted;
94 unsigned int volume; 93 unsigned int volume;
95#ifdef QT_QWS_DEVFS 94#ifdef QT_QWS_DEVFS
96 int mixerHandle = open( "/dev/sound/mixer", O_RDWR ); 95 int mixerHandle = open( "/dev/sound/mixer", O_RDWR );
97#else 96#else
98 int mixerHandle = open( "/dev/mixer", O_RDWR ); 97 int mixerHandle = open( "/dev/mixer", O_RDWR );
99#endif 98#endif
100 if ( mixerHandle >= 0 ) { 99 if ( mixerHandle >= 0 ) {
101 if(ioctl( mixerHandle, MIXER_READ(0), &volume )==-1) 100 if(ioctl( mixerHandle, MIXER_READ(0), &volume )==-1)
102 perror("ioctl(\"MIXER_READ\")"); 101 perror("ioctl(\"MIXER_READ\")");
103 close( mixerHandle ); 102 close( mixerHandle );
104 } else 103 } else
105 perror("open(\"/dev/mixer\")"); 104 perror("open(\"/dev/mixer\")");
106 leftVolume = ((volume & 0x00FF) << 16) / 101; 105 leftVolume = ((volume & 0x00FF) << 16) / 101;
107 rightVolume = ((volume & 0xFF00) << 8) / 101; 106 rightVolume = ((volume & 0xFF00) << 8) / 101;
108} 107}
109 108
110 109
111void AudioDevice::setVolume( unsigned int leftVolume, unsigned int rightVolume, bool muted ) { 110void AudioDevice::setVolume( unsigned int leftVolume, unsigned int rightVolume, bool muted ) {
112 AudioDevicePrivate::muted = muted; 111 AudioDevicePrivate::muted = muted;
113 if ( muted ) { 112 if ( muted ) {
114 AudioDevicePrivate::leftVolume = leftVolume; 113 AudioDevicePrivate::leftVolume = leftVolume;
115 AudioDevicePrivate::rightVolume = rightVolume; 114 AudioDevicePrivate::rightVolume = rightVolume;
116 leftVolume = 0; 115 leftVolume = 0;
117 rightVolume = 0; 116 rightVolume = 0;
118 } else { 117 } else {
119 leftVolume = ( (int) leftVolume < 0 ) ? 0 : (( leftVolume > 0xFFFF ) ? 0xFFFF : leftVolume ); 118 leftVolume = ( (int) leftVolume < 0 ) ? 0 : (( leftVolume > 0xFFFF ) ? 0xFFFF : leftVolume );
120 rightVolume = ( (int)rightVolume < 0 ) ? 0 : (( rightVolume > 0xFFFF ) ? 0xFFFF : rightVolume ); 119 rightVolume = ( (int)rightVolume < 0 ) ? 0 : (( rightVolume > 0xFFFF ) ? 0xFFFF : rightVolume );
121 } 120 }
122 // Volume can be from 0 to 100 which is 101 distinct values 121 // Volume can be from 0 to 100 which is 101 distinct values
123 unsigned int rV = (rightVolume * 101) >> 16; 122 unsigned int rV = (rightVolume * 101) >> 16;
124 123
125# if 0 124# if 0
126 unsigned int lV = (leftVolume * 101) >> 16; 125 unsigned int lV = (leftVolume * 101) >> 16;
127 unsigned int volume = ((rV << 8) & 0xFF00) | (lV & 0x00FF); 126 unsigned int volume = ((rV << 8) & 0xFF00) | (lV & 0x00FF);
128 int mixerHandle = 0; 127 int mixerHandle = 0;
129#ifdef QT_QWS_DEVFS 128#ifdef QT_QWS_DEVFS
130 if ( ( mixerHandle = open( "/dev/sound/mixer", O_RDWR ) ) >= 0 ) { 129 if ( ( mixerHandle = open( "/dev/sound/mixer", O_RDWR ) ) >= 0 ) {
131#else 130#else
132 if ( ( mixerHandle = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { 131 if ( ( mixerHandle = open( "/dev/mixer", O_RDWR ) ) >= 0 ) {
133#endif 132#endif
134 if(ioctl( mixerHandle, MIXER_WRITE(0), &volume ) ==-1) 133 if(ioctl( mixerHandle, MIXER_WRITE(0), &volume ) ==-1)
135 perror("ioctl(\"MIXER_WRITE\")"); 134 perror("ioctl(\"MIXER_WRITE\")");
136 close( mixerHandle ); 135 close( mixerHandle );
137 } else 136 } else
138 perror("open(\"/dev/mixer\")"); 137 perror("open(\"/dev/mixer\")");
139 138
140# else 139# else
141 // This is the way this has to be done now I guess, doesn't allow for 140 // This is the way this has to be done now I guess, doesn't allow for
142 // independant right and left channel setting, or setting for different outputs 141 // independant right and left channel setting, or setting for different outputs
143 Config cfg("qpe"); // qtopia is "Sound" 142 Config cfg("qpe"); // qtopia is "Sound"
144 cfg.setGroup("Volume"); // qtopia is "Settings" 143 cfg.setGroup("Volume"); // qtopia is "Settings"
145 cfg.writeEntry("VolumePercent",(int)rV); //qtopia is Volume 144 cfg.writeEntry("VolumePercent",(int)rV); //qtopia is Volume
146# endif 145# endif
147 146
148//#endif 147//#endif
149// qDebug( "setting volume to: 0x%x", volume ); 148// qDebug( "setting volume to: 0x%x", volume );
150#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) 149#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP)
151 // Send notification that the volume has changed 150 // Send notification that the volume has changed
152 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << muted; 151 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << muted;
153#endif 152#endif
154} 153}
155 154
diff --git a/core/multimedia/opieplayer/audiowidget.cpp b/core/multimedia/opieplayer/audiowidget.cpp
index fbc5072..8bcc567 100644
--- a/core/multimedia/opieplayer/audiowidget.cpp
+++ b/core/multimedia/opieplayer/audiowidget.cpp
@@ -1,157 +1,151 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include <qpe/qpeapplication.h> 20#include <qpe/qpeapplication.h>
21#include <qpe/resource.h> 21#include <qpe/resource.h>
22#include <qpe/config.h> 22#include <qpe/config.h>
23 23
24#include <qwidget.h>
25#include <qpixmap.h>
26#include <qbutton.h>
27#include <qpainter.h>
28#include <qframe.h>
29#include <qlayout.h>
30#include <qdir.h> 24#include <qdir.h>
31#include "audiowidget.h" 25#include "audiowidget.h"
32#include "mediaplayerstate.h" 26#include "mediaplayerstate.h"
33 27
34#include <stdlib.h> 28#include <stdlib.h>
35#include <stdio.h> 29#include <stdio.h>
36 30
37extern MediaPlayerState *mediaPlayerState; 31extern MediaPlayerState *mediaPlayerState;
38 32
39 33
40static const int xo = -2; // movable x offset 34static const int xo = -2; // movable x offset
41static const int yo = 22; // movable y offset 35static const int yo = 22; // movable y offset
42 36
43struct MediaButton { 37struct MediaButton {
44 bool isToggle, isHeld, isDown; 38 bool isToggle, isHeld, isDown;
45}; 39};
46 40
47//Layout information for the audioButtons (and if it is a toggle button or not) 41//Layout information for the audioButtons (and if it is a toggle button or not)
48MediaButton audioButtons[] = { 42MediaButton audioButtons[] = {
49 { TRUE, FALSE, FALSE }, // play 43 { TRUE, FALSE, FALSE }, // play
50 { FALSE, FALSE, FALSE }, // stop 44 { FALSE, FALSE, FALSE }, // stop
51 { FALSE, FALSE, FALSE }, // next 45 { FALSE, FALSE, FALSE }, // next
52 { FALSE, FALSE, FALSE }, // previous 46 { FALSE, FALSE, FALSE }, // previous
53 { FALSE, FALSE, FALSE }, // volume up 47 { FALSE, FALSE, FALSE }, // volume up
54 { FALSE, FALSE, FALSE }, // volume down 48 { FALSE, FALSE, FALSE }, // volume down
55 { TRUE, FALSE, FALSE }, // repeat/loop 49 { TRUE, FALSE, FALSE }, // repeat/loop
56 { FALSE, FALSE, FALSE }, // playlist 50 { FALSE, FALSE, FALSE }, // playlist
57 { FALSE, FALSE, FALSE }, // forward 51 { FALSE, FALSE, FALSE }, // forward
58 { FALSE, FALSE, FALSE } // back 52 { FALSE, FALSE, FALSE } // back
59}; 53};
60 54
61const char *skin_mask_file_names[10] = { 55const char *skin_mask_file_names[10] = {
62 "play", "stop", "next", "prev", "up", 56 "play", "stop", "next", "prev", "up",
63 "down", "loop", "playlist", "forward", "back" 57 "down", "loop", "playlist", "forward", "back"
64}; 58};
65 59
66static void changeTextColor( QWidget *w ) { 60static void changeTextColor( QWidget *w ) {
67 QPalette p = w->palette(); 61 QPalette p = w->palette();
68 p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); 62 p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) );
69 p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); 63 p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) );
70 w->setPalette( p ); 64 w->setPalette( p );
71} 65}
72 66
73static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); 67static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton));
74 68
75AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : 69AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
76 QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) 70 QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this )
77{ 71{
78 setCaption( tr("OpiePlayer") ); 72 setCaption( tr("OpiePlayer") );
79 // qDebug("<<<<<audioWidget"); 73 // qDebug("<<<<<audioWidget");
80 74
81 Config cfg("OpiePlayer"); 75 Config cfg("OpiePlayer");
82 cfg.setGroup("Options"); 76 cfg.setGroup("Options");
83 skin = cfg.readEntry("Skin","default"); 77 skin = cfg.readEntry("Skin","default");
84 //skin = "scaleTest"; 78 //skin = "scaleTest";
85// color of background, frame, degree of transparency 79// color of background, frame, degree of transparency
86 80
87// QString skinPath = "opieplayer/skins/" + skin; 81// QString skinPath = "opieplayer/skins/" + skin;
88 QString skinPath; 82 QString skinPath;
89 skinPath = "opieplayer2/skins/" + skin; 83 skinPath = "opieplayer2/skins/" + skin;
90 if(!QDir(QString(getenv("OPIEDIR")) +"/pics/"+skinPath).exists()) 84 if(!QDir(QString(getenv("OPIEDIR")) +"/pics/"+skinPath).exists())
91 skinPath = "opieplayer2/skins/default"; 85 skinPath = "opieplayer2/skins/default";
92 86
93 // qDebug("skin path " + skinPath); 87 // qDebug("skin path " + skinPath);
94 88
95 pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); 89 pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
96 imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); 90 imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) );
97 imgDn = new QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); 91 imgDn = new QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) );
98 92
99 imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); 93 imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 );
100 imgButtonMask->fill( 0 ); 94 imgButtonMask->fill( 0 );
101 95
102 for ( int i = 0; i < 10; i++ ) { 96 for ( int i = 0; i < 10; i++ ) {
103 QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png"; 97 QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png";
104 masks[i] = new QBitmap( filename ); 98 masks[i] = new QBitmap( filename );
105 99
106 if ( !masks[i]->isNull() ) { 100 if ( !masks[i]->isNull() ) {
107 QImage imgMask = masks[i]->convertToImage(); 101 QImage imgMask = masks[i]->convertToImage();
108 uchar **dest = imgButtonMask->jumpTable(); 102 uchar **dest = imgButtonMask->jumpTable();
109 for ( int y = 0; y < imgUp->height(); y++ ) { 103 for ( int y = 0; y < imgUp->height(); y++ ) {
110 uchar *line = dest[y]; 104 uchar *line = dest[y];
111 for ( int x = 0; x < imgUp->width(); x++ ) 105 for ( int x = 0; x < imgUp->width(); x++ )
112 if ( !qRed( imgMask.pixel( x, y ) ) ) 106 if ( !qRed( imgMask.pixel( x, y ) ) )
113 line[x] = i + 1; 107 line[x] = i + 1;
114 } 108 }
115 } 109 }
116 110
117 } 111 }
118 112
119 for ( int i = 0; i < 11; i++ ) { 113 for ( int i = 0; i < 11; i++ ) {
120 buttonPixUp[i] = NULL; 114 buttonPixUp[i] = NULL;
121 buttonPixDown[i] = NULL; 115 buttonPixDown[i] = NULL;
122 } 116 }
123 117
124 QWidget *d = QApplication::desktop(); 118 QWidget *d = QApplication::desktop();
125 int width = d->width(); 119 int width = d->width();
126 int height = d->height(); 120 int height = d->height();
127 121
128 if( (width != pixBg->width() ) || (height != pixBg->height() ) ) { 122 if( (width != pixBg->width() ) || (height != pixBg->height() ) ) {
129 // qDebug("<<<<<<<< scale image >>>>>>>>>>>>"); 123 // qDebug("<<<<<<<< scale image >>>>>>>>>>>>");
130 QImage img; 124 QImage img;
131 img = pixBg->convertToImage(); 125 img = pixBg->convertToImage();
132 pixBg->convertFromImage( img.smoothScale( width, height)); 126 pixBg->convertFromImage( img.smoothScale( width, height));
133 } 127 }
134 setBackgroundPixmap( *pixBg); 128 setBackgroundPixmap( *pixBg);
135 129
136 songInfo.setFocusPolicy( QWidget::NoFocus ); 130 songInfo.setFocusPolicy( QWidget::NoFocus );
137 131
138// changeTextColor( &songInfo ); 132// changeTextColor( &songInfo );
139// songInfo.setBackgroundColor( QColor( 167, 212, 167 )); 133// songInfo.setBackgroundColor( QColor( 167, 212, 167 ));
140// songInfo.setFrameStyle( QFrame::NoFrame); 134// songInfo.setFrameStyle( QFrame::NoFrame);
141// songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); 135// songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken );
142 //NoFrame 136 //NoFrame
143// songInfo.setForegroundColor(Qt::white); 137// songInfo.setForegroundColor(Qt::white);
144 138
145 slider.setFixedHeight( 20 ); 139 slider.setFixedHeight( 20 );
146 slider.setMinValue( 0 ); 140 slider.setMinValue( 0 );
147 slider.setMaxValue( 1 ); 141 slider.setMaxValue( 1 );
148 slider.setFocusPolicy( QWidget::NoFocus ); 142 slider.setFocusPolicy( QWidget::NoFocus );
149 143
150 slider.setBackgroundPixmap( *pixBg ); 144 slider.setBackgroundPixmap( *pixBg );
151 145
152 time.setFocusPolicy( QWidget::NoFocus ); 146 time.setFocusPolicy( QWidget::NoFocus );
153 time.setAlignment( Qt::AlignCenter ); 147 time.setAlignment( Qt::AlignCenter );
154 time.setFrame(FALSE); 148 time.setFrame(FALSE);
155 changeTextColor( &time ); 149 changeTextColor( &time );
156 150
157 resizeEvent( NULL ); 151 resizeEvent( NULL );
diff --git a/core/multimedia/opieplayer/mediaplayer.cpp b/core/multimedia/opieplayer/mediaplayer.cpp
index 753b2e3..b77708c 100644
--- a/core/multimedia/opieplayer/mediaplayer.cpp
+++ b/core/multimedia/opieplayer/mediaplayer.cpp
@@ -1,157 +1,150 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include <qpe/qpeapplication.h>
22#include <qpe/qlibrary.h>
23#include <qpe/resource.h>
24#include <qpe/config.h>
25 21
26#include <qmainwindow.h>
27#include <qmessagebox.h> 22#include <qmessagebox.h>
28#include <qwidgetstack.h>
29#include <qfile.h>
30 23
31#include "mediaplayer.h" 24#include "mediaplayer.h"
32#include "playlistwidget.h" 25#include "playlistwidget.h"
33#include "audiowidget.h" 26#include "audiowidget.h"
34#include "loopcontrol.h" 27#include "loopcontrol.h"
35#include "audiodevice.h" 28#include "audiodevice.h"
36 29
37#include "mediaplayerstate.h" 30#include "mediaplayerstate.h"
38 31
39 32
40extern AudioWidget *audioUI; 33extern AudioWidget *audioUI;
41extern PlayListWidget *playList; 34extern PlayListWidget *playList;
42extern LoopControl *loopControl; 35extern LoopControl *loopControl;
43extern MediaPlayerState *mediaPlayerState; 36extern MediaPlayerState *mediaPlayerState;
44 37
45 38
46MediaPlayer::MediaPlayer( QObject *parent, const char *name ) 39MediaPlayer::MediaPlayer( QObject *parent, const char *name )
47 : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) { 40 : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) {
48 41
49// QPEApplication::grabKeyboard(); 42// QPEApplication::grabKeyboard();
50 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 43 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
51 44
52 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); 45 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) );
53 connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); 46 connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) );
54 connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); 47 connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) );
55 connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); 48 connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) );
56 49
57 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 50 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
58 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 51 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
59 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 52 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
60 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); 53 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
61} 54}
62 55
63 56
64MediaPlayer::~MediaPlayer() { 57MediaPlayer::~MediaPlayer() {
65 58
66} 59}
67 60
68 61
69void MediaPlayer::pauseCheck( bool b ) { 62void MediaPlayer::pauseCheck( bool b ) {
70 // Only pause if playing 63 // Only pause if playing
71 if ( b && !mediaPlayerState->playing() ) 64 if ( b && !mediaPlayerState->playing() )
72 mediaPlayerState->setPaused( FALSE ); 65 mediaPlayerState->setPaused( FALSE );
73} 66}
74 67
75 68
76void MediaPlayer::play() { 69void MediaPlayer::play() {
77 mediaPlayerState->setPlaying( FALSE ); 70 mediaPlayerState->setPlaying( FALSE );
78 mediaPlayerState->setPlaying( TRUE ); 71 mediaPlayerState->setPlaying( TRUE );
79} 72}
80 73
81 74
82void MediaPlayer::setPlaying( bool play ) { 75void MediaPlayer::setPlaying( bool play ) {
83 // qDebug("MediaPlayer setPlaying %d", play); 76 // qDebug("MediaPlayer setPlaying %d", play);
84 if ( !play ) { 77 if ( !play ) {
85 mediaPlayerState->setPaused( FALSE ); 78 mediaPlayerState->setPaused( FALSE );
86 loopControl->stop( FALSE ); 79 loopControl->stop( FALSE );
87 return; 80 return;
88 } 81 }
89 82
90 if ( mediaPlayerState->paused() ) { 83 if ( mediaPlayerState->paused() ) {
91 mediaPlayerState->setPaused( FALSE ); 84 mediaPlayerState->setPaused( FALSE );
92 return; 85 return;
93 } 86 }
94 // qDebug("about to ctrash"); 87 // qDebug("about to ctrash");
95 const DocLnk *playListCurrent = playList->current(); 88 const DocLnk *playListCurrent = playList->current();
96 89
97 if ( playListCurrent != NULL ) { 90 if ( playListCurrent != NULL ) {
98 loopControl->stop( TRUE ); 91 loopControl->stop( TRUE );
99 currentFile = playListCurrent; 92 currentFile = playListCurrent;
100 } 93 }
101 if ( currentFile == NULL ) { 94 if ( currentFile == NULL ) {
102 QMessageBox::critical( 0, tr( "No file"), tr( "Error: There is no file selected" ) ); 95 QMessageBox::critical( 0, tr( "No file"), tr( "Error: There is no file selected" ) );
103 mediaPlayerState->setPlaying( FALSE ); 96 mediaPlayerState->setPlaying( FALSE );
104 return; 97 return;
105 } 98 }
106 99
107 if ( ((currentFile->file()).left(4) != "http") && !QFile::exists( currentFile->file() ) ) { 100 if ( ((currentFile->file()).left(4) != "http") && !QFile::exists( currentFile->file() ) ) {
108 QMessageBox::critical( 0, tr( "File not found"), 101 QMessageBox::critical( 0, tr( "File not found"),
109 tr( "The following file was not found: <i>" ) 102 tr( "The following file was not found: <i>" )
110 + currentFile->file() + "</i>" ); 103 + currentFile->file() + "</i>" );
111 mediaPlayerState->setPlaying( FALSE ); 104 mediaPlayerState->setPlaying( FALSE );
112 return; 105 return;
113 } 106 }
114 107
115 if ( !mediaPlayerState->newDecoder( currentFile->file() ) ) { 108 if ( !mediaPlayerState->newDecoder( currentFile->file() ) ) {
116 QMessageBox::critical( 0, tr( "No decoder found"), 109 QMessageBox::critical( 0, tr( "No decoder found"),
117 tr( "Sorry, no appropriate decoders found for this file: <i>" ) 110 tr( "Sorry, no appropriate decoders found for this file: <i>" )
118 + currentFile->file() + "</i>" ); 111 + currentFile->file() + "</i>" );
119 mediaPlayerState->setPlaying( FALSE ); 112 mediaPlayerState->setPlaying( FALSE );
120 return; 113 return;
121 } 114 }
122 115
123 if ( !loopControl->init( currentFile->file() ) ) { 116 if ( !loopControl->init( currentFile->file() ) ) {
124 QMessageBox::critical( 0, tr( "Error opening file"), 117 QMessageBox::critical( 0, tr( "Error opening file"),
125 tr( "Sorry, an error occured trying to play the file: <i>" ) + currentFile->file() + "</i>" ); 118 tr( "Sorry, an error occured trying to play the file: <i>" ) + currentFile->file() + "</i>" );
126 mediaPlayerState->setPlaying( FALSE ); 119 mediaPlayerState->setPlaying( FALSE );
127 return; 120 return;
128 } 121 }
129 long seconds = loopControl->totalPlaytime(); 122 long seconds = loopControl->totalPlaytime();
130 QString time; time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); 123 QString time; time.sprintf("%li:%02i", seconds/60, (int)seconds%60 );
131 QString tickerText; 124 QString tickerText;
132 if( currentFile->file().left(4) == "http" ) 125 if( currentFile->file().left(4) == "http" )
133 tickerText= tr( " File: " ) + currentFile->name(); 126 tickerText= tr( " File: " ) + currentFile->name();
134 else 127 else
135 tickerText = tr( " File: " ) + currentFile->name() + tr(", Length: ") + time; 128 tickerText = tr( " File: " ) + currentFile->name() + tr(", Length: ") + time;
136 129
137 QString fileInfo = mediaPlayerState->curDecoder()->fileInfo(); 130 QString fileInfo = mediaPlayerState->curDecoder()->fileInfo();
138 if ( !fileInfo.isEmpty() ) 131 if ( !fileInfo.isEmpty() )
139 tickerText += ", " + fileInfo; 132 tickerText += ", " + fileInfo;
140 audioUI->setTickerText( tickerText + "." ); 133 audioUI->setTickerText( tickerText + "." );
141 134
142 loopControl->play(); 135 loopControl->play();
143 136
144 mediaPlayerState->setView( loopControl->hasVideo() ? 'v' : 'a' ); 137 mediaPlayerState->setView( loopControl->hasVideo() ? 'v' : 'a' );
145} 138}
146 139
147 140
148void MediaPlayer::prev() { 141void MediaPlayer::prev() {
149 if ( playList->prev() ) 142 if ( playList->prev() )
150 play(); 143 play();
151 else if ( mediaPlayerState->looping() ) { 144 else if ( mediaPlayerState->looping() ) {
152 if ( playList->last() ) 145 if ( playList->last() )
153 play(); 146 play();
154 } else 147 } else
155 mediaPlayerState->setList(); 148 mediaPlayerState->setList();
156} 149}
157 150
diff --git a/core/multimedia/opieplayer/mediaplayerstate.cpp b/core/multimedia/opieplayer/mediaplayerstate.cpp
index 6823076..5bfb87e 100644
--- a/core/multimedia/opieplayer/mediaplayerstate.cpp
+++ b/core/multimedia/opieplayer/mediaplayerstate.cpp
@@ -1,152 +1,150 @@
1/********************************************************************** 1/**********************************************************************
2 ** Copyright (C) 2000 Trolltech AS. All rights reserved. 2 ** Copyright (C) 2000 Trolltech AS. All rights reserved.
3 ** 3 **
4 ** This file is part of Qtopia Environment. 4 ** This file is part of Qtopia Environment.
5 ** 5 **
6 ** This file may be distributed and/or modified under the terms of the 6 ** This file may be distributed and/or modified under the terms of the
7 ** GNU General Public License version 2 as published by the Free Software 7 ** GNU General Public License version 2 as published by the Free Software
8 ** Foundation and appearing in the file LICENSE.GPL included in the 8 ** Foundation and appearing in the file LICENSE.GPL included in the
9 ** packaging of this file. 9 ** packaging of this file.
10 ** 10 **
11 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13 ** 13 **
14 ** See http://www.trolltech.com/gpl/ for GPL licensing information. 14 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
15 ** 15 **
16 ** Contact info@trolltech.com if any conditions of this licensing are 16 ** Contact info@trolltech.com if any conditions of this licensing are
17 ** not clear to you. 17 ** not clear to you.
18 ** 18 **
19 **********************************************************************/ 19 **********************************************************************/
20#include <qpe/qpeapplication.h> 20#include <qpe/qpeapplication.h>
21#include <qpe/qlibrary.h> 21#include <qpe/qlibrary.h>
22#include <qpe/config.h> 22#include <qpe/config.h>
23#include <qvaluelist.h>
24#include <qobject.h>
25#include <qdir.h> 23#include <qdir.h>
26#include <qpe/mediaplayerplugininterface.h> 24#include <qpe/mediaplayerplugininterface.h>
27#include "mediaplayerstate.h" 25#include "mediaplayerstate.h"
28 26
29 27
30 28
31#ifdef QT_NO_COMPONENT 29#ifdef QT_NO_COMPONENT
32// Plugins which are compiled in when no plugin architecture available 30// Plugins which are compiled in when no plugin architecture available
33#include "libmad/libmadpluginimpl.h" 31#include "libmad/libmadpluginimpl.h"
34#include "libmpeg3/libmpeg3pluginimpl.h" 32#include "libmpeg3/libmpeg3pluginimpl.h"
35#include "wavplugin/wavpluginimpl.h" 33#include "wavplugin/wavpluginimpl.h"
36#endif 34#endif
37 35
38 36
39//#define MediaPlayerDebug(x) qDebug x 37//#define MediaPlayerDebug(x) qDebug x
40#define MediaPlayerDebug(x) 38#define MediaPlayerDebug(x)
41 39
42 40
43MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) 41MediaPlayerState::MediaPlayerState( QObject *parent, const char *name )
44 : QObject( parent, name ), decoder( NULL ), libmpeg3decoder( NULL ) { 42 : QObject( parent, name ), decoder( NULL ), libmpeg3decoder( NULL ) {
45 Config cfg( "OpiePlayer" ); 43 Config cfg( "OpiePlayer" );
46 readConfig( cfg ); 44 readConfig( cfg );
47 loadPlugins(); 45 loadPlugins();
48} 46}
49 47
50 48
51MediaPlayerState::~MediaPlayerState() { 49MediaPlayerState::~MediaPlayerState() {
52 Config cfg( "OpiePlayer" ); 50 Config cfg( "OpiePlayer" );
53 writeConfig( cfg ); 51 writeConfig( cfg );
54} 52}
55 53
56 54
57void MediaPlayerState::readConfig( Config& cfg ) { 55void MediaPlayerState::readConfig( Config& cfg ) {
58 cfg.setGroup("Options"); 56 cfg.setGroup("Options");
59 isFullscreen = cfg.readBoolEntry( "FullScreen" ); 57 isFullscreen = cfg.readBoolEntry( "FullScreen" );
60 isScaled = cfg.readBoolEntry( "Scaling" ); 58 isScaled = cfg.readBoolEntry( "Scaling" );
61 isLooping = cfg.readBoolEntry( "Looping" ); 59 isLooping = cfg.readBoolEntry( "Looping" );
62 isShuffled = cfg.readBoolEntry( "Shuffle" ); 60 isShuffled = cfg.readBoolEntry( "Shuffle" );
63 usePlaylist = cfg.readBoolEntry( "UsePlayList" ); 61 usePlaylist = cfg.readBoolEntry( "UsePlayList" );
64 usePlaylist = TRUE; 62 usePlaylist = TRUE;
65 isPlaying = FALSE; 63 isPlaying = FALSE;
66 isPaused = FALSE; 64 isPaused = FALSE;
67 curPosition = 0; 65 curPosition = 0;
68 curLength = 0; 66 curLength = 0;
69 curView = 'l'; 67 curView = 'l';
70} 68}
71 69
72 70
73void MediaPlayerState::writeConfig( Config& cfg ) const { 71void MediaPlayerState::writeConfig( Config& cfg ) const {
74 cfg.setGroup("Options"); 72 cfg.setGroup("Options");
75 cfg.writeEntry("FullScreen", isFullscreen ); 73 cfg.writeEntry("FullScreen", isFullscreen );
76 cfg.writeEntry("Scaling", isScaled ); 74 cfg.writeEntry("Scaling", isScaled );
77 cfg.writeEntry("Looping", isLooping ); 75 cfg.writeEntry("Looping", isLooping );
78 cfg.writeEntry("Shuffle", isShuffled ); 76 cfg.writeEntry("Shuffle", isShuffled );
79 cfg.writeEntry("UsePlayList", usePlaylist ); 77 cfg.writeEntry("UsePlayList", usePlaylist );
80} 78}
81 79
82 80
83struct MediaPlayerPlugin { 81struct MediaPlayerPlugin {
84#ifndef QT_NO_COMPONENT 82#ifndef QT_NO_COMPONENT
85 QLibrary *library; 83 QLibrary *library;
86#endif 84#endif
87 MediaPlayerPluginInterface *iface; 85 MediaPlayerPluginInterface *iface;
88 MediaPlayerDecoder *decoder; 86 MediaPlayerDecoder *decoder;
89 MediaPlayerEncoder *encoder; 87 MediaPlayerEncoder *encoder;
90}; 88};
91 89
92 90
93static QValueList<MediaPlayerPlugin> pluginList; 91static QValueList<MediaPlayerPlugin> pluginList;
94 92
95 93
96// Find the first decoder which supports this type of file 94// Find the first decoder which supports this type of file
97MediaPlayerDecoder *MediaPlayerState::newDecoder( const QString& file ) { 95MediaPlayerDecoder *MediaPlayerState::newDecoder( const QString& file ) {
98 MediaPlayerDecoder *tmpDecoder = NULL; 96 MediaPlayerDecoder *tmpDecoder = NULL;
99 QValueList<MediaPlayerPlugin>::Iterator it; 97 QValueList<MediaPlayerPlugin>::Iterator it;
100 for ( it = pluginList.begin(); it != pluginList.end(); ++it ) { 98 for ( it = pluginList.begin(); it != pluginList.end(); ++it ) {
101 if ( (*it).decoder->isFileSupported( file ) ) { 99 if ( (*it).decoder->isFileSupported( file ) ) {
102 tmpDecoder = (*it).decoder; 100 tmpDecoder = (*it).decoder;
103 break; 101 break;
104 } 102 }
105 } 103 }
106 if(file.left(4)=="http") 104 if(file.left(4)=="http")
107 isStreaming = TRUE; 105 isStreaming = TRUE;
108 else 106 else
109 isStreaming = FALSE; 107 isStreaming = FALSE;
110 return decoder = tmpDecoder; 108 return decoder = tmpDecoder;
111} 109}
112 110
113 111
114MediaPlayerDecoder *MediaPlayerState::curDecoder() { 112MediaPlayerDecoder *MediaPlayerState::curDecoder() {
115 return decoder; 113 return decoder;
116} 114}
117 115
118 116
119// ### hack to get true sample count 117// ### hack to get true sample count
120MediaPlayerDecoder *MediaPlayerState::libMpeg3Decoder() { 118MediaPlayerDecoder *MediaPlayerState::libMpeg3Decoder() {
121 return libmpeg3decoder; 119 return libmpeg3decoder;
122} 120}
123 121
124// ### hack to get true sample count 122// ### hack to get true sample count
125// MediaPlayerDecoder *MediaPlayerState::libWavDecoder() { 123// MediaPlayerDecoder *MediaPlayerState::libWavDecoder() {
126// return libwavdecoder; 124// return libwavdecoder;
127// } 125// }
128 126
129void MediaPlayerState::loadPlugins() { 127void MediaPlayerState::loadPlugins() {
130 // qDebug("load plugins"); 128 // qDebug("load plugins");
131#ifndef QT_NO_COMPONENT 129#ifndef QT_NO_COMPONENT
132 QValueList<MediaPlayerPlugin>::Iterator mit; 130 QValueList<MediaPlayerPlugin>::Iterator mit;
133 for ( mit = pluginList.begin(); mit != pluginList.end(); ++mit ) { 131 for ( mit = pluginList.begin(); mit != pluginList.end(); ++mit ) {
134 (*mit).iface->release(); 132 (*mit).iface->release();
135 (*mit).library->unload(); 133 (*mit).library->unload();
136 delete (*mit).library; 134 delete (*mit).library;
137 } 135 }
138 pluginList.clear(); 136 pluginList.clear();
139 137
140 QString path = QPEApplication::qpeDir() + "/plugins/codecs"; 138 QString path = QPEApplication::qpeDir() + "/plugins/codecs";
141 QDir dir( path, "lib*.so" ); 139 QDir dir( path, "lib*.so" );
142 QStringList list = dir.entryList(); 140 QStringList list = dir.entryList();
143 QStringList::Iterator it; 141 QStringList::Iterator it;
144 for ( it = list.begin(); it != list.end(); ++it ) { 142 for ( it = list.begin(); it != list.end(); ++it ) {
145 MediaPlayerPluginInterface *iface = 0; 143 MediaPlayerPluginInterface *iface = 0;
146 QLibrary *lib = new QLibrary( path + "/" + *it ); 144 QLibrary *lib = new QLibrary( path + "/" + *it );
147// qDebug( "querying: %s", QString( path + "/" + *it ).latin1() ); 145// qDebug( "querying: %s", QString( path + "/" + *it ).latin1() );
148 146
149 if ( lib->queryInterface( IID_MediaPlayerPlugin, (QUnknownInterface**)&iface ) == QS_OK ) { 147 if ( lib->queryInterface( IID_MediaPlayerPlugin, (QUnknownInterface**)&iface ) == QS_OK ) {
150 148
151// qDebug( "loading: %s", QString( path + "/" + *it ).latin1() ); 149// qDebug( "loading: %s", QString( path + "/" + *it ).latin1() );
152 150
diff --git a/core/multimedia/opieplayer/modplug/load_j2b.cpp b/core/multimedia/opieplayer/modplug/load_j2b.cpp
index 4f0b85c..8b4cccd 100644
--- a/core/multimedia/opieplayer/modplug/load_j2b.cpp
+++ b/core/multimedia/opieplayer/modplug/load_j2b.cpp
@@ -1,17 +1,16 @@
1/* 1/*
2 * This program is free software; you can redistribute it and modify it 2 * This program is free software; you can redistribute it and modify it
3 * under the terms of the GNU General Public License as published by the 3 * under the terms of the GNU General Public License as published by the
4 * Free Software Foundation; either version 2 of the license or (at your 4 * Free Software Foundation; either version 2 of the license or (at your
5 * option) any later version. 5 * option) any later version.
6 * 6 *
7 * Authors: Olivier Lapicque <olivierl@jps.net> 7 * Authors: Olivier Lapicque <olivierl@jps.net>
8*/ 8*/
9 9
10 10
11/////////////////////////////////////////////////// 11///////////////////////////////////////////////////
12// 12//
13// J2B module loader 13// J2B module loader
14// 14//
15/////////////////////////////////////////////////// 15///////////////////////////////////////////////////
16#include "stdafx.h"
17 16
diff --git a/core/multimedia/opieplayer/om3u.cpp b/core/multimedia/opieplayer/om3u.cpp
index 778eb22..ae89518 100644
--- a/core/multimedia/opieplayer/om3u.cpp
+++ b/core/multimedia/opieplayer/om3u.cpp
@@ -1,175 +1,162 @@
1/* 1/*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 3
4 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 4 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
5 =. 5 =.
6 .=l. 6 .=l.
7           .>+-= 7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can 8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under 9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU General Public 10:`=1 )Y*s>-.--   : the terms of the GNU General Public
11.="- .-=="i,     .._ License as published by the Free Software 11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License, 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version. 13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_. 14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that 15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17    : ..    .:,     . . . without even the implied warranty of 17    : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; General Public License for more 20..}^=.=       =       ; General Public License for more
21++=   -.     .`     .: details. 21++=   -.     .`     .: details.
22 :     =  ...= . :.=- 22 :     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU 23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = General Public License along with 24  -_. . .   )=.  = General Public License along with
25    --        :-=` this library; see the file COPYING.LIB. 25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
29 29
30*/ 30*/
31 31
32#include "playlistwidget.h"
33#include "om3u.h" 32#include "om3u.h"
34 33
35#include <qpe/applnk.h> 34
36#include <qpe/qpeapplication.h>
37#include <qpe/storage.h>
38#include <qpe/mimetype.h>
39#include <qpe/global.h>
40#include <qpe/resource.h>
41
42#include <qdir.h>
43#include <qregexp.h>
44#include <qstring.h>
45#include <qtextstream.h>
46#include <qstringlist.h>
47#include <qcstring.h>
48 35
49static inline QString fullBaseName ( const QFileInfo &fi ) 36static inline QString fullBaseName ( const QFileInfo &fi )
50{ 37{
51 QString str = fi. fileName ( ); 38 QString str = fi. fileName ( );
52 return str. left ( str. findRev ( '.' )); 39 return str. left ( str. findRev ( '.' ));
53} 40}
54 41
55 42
56//extern PlayListWidget *playList; 43//extern PlayListWidget *playList;
57 44
58Om3u::Om3u( const QString &filePath, int mode) 45Om3u::Om3u( const QString &filePath, int mode)
59 : QStringList (){ 46 : QStringList (){
60//qDebug("<<<<<<<new m3u "+filePath); 47//qDebug("<<<<<<<new m3u "+filePath);
61 f.setName(filePath); 48 f.setName(filePath);
62 f.open(mode); 49 f.open(mode);
63} 50}
64 51
65Om3u::~Om3u(){} 52Om3u::~Om3u(){}
66 53
67void Om3u::readM3u() { 54void Om3u::readM3u() {
68// qDebug("<<<<<<reading m3u "+f.name()); 55// qDebug("<<<<<<reading m3u "+f.name());
69 QTextStream t(&f); 56 QTextStream t(&f);
70 t.setEncoding(QTextStream::UnicodeUTF8); 57 t.setEncoding(QTextStream::UnicodeUTF8);
71 QString s; 58 QString s;
72 while ( !t.atEnd() ) { 59 while ( !t.atEnd() ) {
73 s=t.readLine(); 60 s=t.readLine();
74 // qDebug(s); 61 // qDebug(s);
75 if( s.find( "#", 0, TRUE) == -1 ) { 62 if( s.find( "#", 0, TRUE) == -1 ) {
76 if( s.left(2) == "E:" || s.left(2) == "P:" ) { 63 if( s.left(2) == "E:" || s.left(2) == "P:" ) {
77 s = s.right( s.length() -2 ); 64 s = s.right( s.length() -2 );
78 QFileInfo f( s ); 65 QFileInfo f( s );
79 QString name = fullBaseName ( f ); 66 QString name = fullBaseName ( f );
80 name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); 67 name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 );
81 s=s.replace( QRegExp( "\\" ), "/" ); 68 s=s.replace( QRegExp( "\\" ), "/" );
82 append(s); 69 append(s);
83 // qDebug(s); 70 // qDebug(s);
84 } else { // is url 71 } else { // is url
85 s.replace( QRegExp( "%20" )," " ); 72 s.replace( QRegExp( "%20" )," " );
86 QString name; 73 QString name;
87 // if( name.left( 4 ) == "http" ) { 74 // if( name.left( 4 ) == "http" ) {
88 // name = s.right( s.length() - 7 ); 75 // name = s.right( s.length() - 7 );
89 // } else { 76 // } else {
90 name = s; 77 name = s;
91 // } 78 // }
92 append(name); 79 append(name);
93 // qDebug(name); 80 // qDebug(name);
94 } 81 }
95 } 82 }
96 } 83 }
97} 84}
98 85
99void Om3u::readPls() { //it's a pls file 86void Om3u::readPls() { //it's a pls file
100 QTextStream t( &f ); 87 QTextStream t( &f );
101 t.setEncoding(QTextStream::UnicodeUTF8); 88 t.setEncoding(QTextStream::UnicodeUTF8);
102 QString s; 89 QString s;
103 while ( !t.atEnd() ) { 90 while ( !t.atEnd() ) {
104 s = t.readLine(); 91 s = t.readLine();
105 if( s.left(4) == "File" ) { 92 if( s.left(4) == "File" ) {
106 s = s.right( s.length() - 6 ); 93 s = s.right( s.length() - 6 );
107 s.replace( QRegExp( "%20" )," "); 94 s.replace( QRegExp( "%20" )," ");
108// qDebug( "adding " + s + " to playlist" ); 95// qDebug( "adding " + s + " to playlist" );
109 // numberofentries=2 96 // numberofentries=2
110 // File1=http 97 // File1=http
111 // Title 98 // Title
112 // Length 99 // Length
113 // Version 100 // Version
114 // File2=http 101 // File2=http
115 s = s.replace( QRegExp( "\\" ), "/" ); 102 s = s.replace( QRegExp( "\\" ), "/" );
116 QFileInfo f( s ); 103 QFileInfo f( s );
117 QString name = fullBaseName ( f ); 104 QString name = fullBaseName ( f );
118 if( name.left( 4 ) == "http" ) { 105 if( name.left( 4 ) == "http" ) {
119 name = s.right( s.length() - 7); 106 name = s.right( s.length() - 7);
120 } else { 107 } else {
121 name = s; 108 name = s;
122 } 109 }
123 name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); 110 name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 );
124 if( s.at( s.length() - 4) == '.') // if this is probably a file 111 if( s.at( s.length() - 4) == '.') // if this is probably a file
125 append(s); 112 append(s);
126 else { //if its a url 113 else { //if its a url
127 if( name.right( 1 ).find( '/' ) == -1) { 114 if( name.right( 1 ).find( '/' ) == -1) {
128 s += "/"; 115 s += "/";
129 } 116 }
130 append(s); 117 append(s);
131 } 118 }
132 } 119 }
133 } 120 }
134} 121}
135 122
136void Om3u::write() { //writes list to m3u file 123void Om3u::write() { //writes list to m3u file
137 QString list; 124 QString list;
138 QTextStream t(&f); 125 QTextStream t(&f);
139 t.setEncoding(QTextStream::UnicodeUTF8); 126 t.setEncoding(QTextStream::UnicodeUTF8);
140 if(count()>0) { 127 if(count()>0) {
141 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { 128 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) {
142 // qDebug(*it); 129 // qDebug(*it);
143 t << *it << "\n"; 130 t << *it << "\n";
144 } 131 }
145 } 132 }
146// f.close(); 133// f.close();
147} 134}
148 135
149void Om3u::add(const QString &filePath) { //adds to m3u file 136void Om3u::add(const QString &filePath) { //adds to m3u file
150 append(filePath); 137 append(filePath);
151} 138}
152 139
153void Om3u::remove(const QString &filePath) { //removes from m3u list 140void Om3u::remove(const QString &filePath) { //removes from m3u list
154 QString list, currentFile; 141 QString list, currentFile;
155 if(count()>0) { 142 if(count()>0) {
156 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { 143 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) {
157 currentFile=*it; 144 currentFile=*it;
158 // qDebug(*it); 145 // qDebug(*it);
159 146
160 if( filePath != currentFile) 147 if( filePath != currentFile)
161 list += currentFile+"\n"; 148 list += currentFile+"\n";
162 } 149 }
163 f.writeBlock( list, list.length() ); 150 f.writeBlock( list, list.length() );
164 } 151 }
165} 152}
166 153
167void Om3u::deleteFile(const QString &filePath) {//deletes m3u file 154void Om3u::deleteFile(const QString &filePath) {//deletes m3u file
168 f.close(); 155 f.close();
169 f.remove(); 156 f.remove();
170 157
171} 158}
172 159
173void Om3u::close() { //closes m3u file 160void Om3u::close() { //closes m3u file
174 f.close(); 161 f.close();
175} 162}
diff --git a/core/multimedia/opieplayer/playlistselection.cpp b/core/multimedia/opieplayer/playlistselection.cpp
index 94567f2..ad831cf 100644
--- a/core/multimedia/opieplayer/playlistselection.cpp
+++ b/core/multimedia/opieplayer/playlistselection.cpp
@@ -1,157 +1,149 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include <qpe/applnk.h>
21#include <qpe/resource.h>
22#include <qpe/config.h>
23 20
24#include <qpainter.h>
25#include <qimage.h>
26#include <qheader.h> 21#include <qheader.h>
27#include <qlistview.h>
28#include <qlist.h>
29#include <qpixmap.h>
30 22
31#include "playlistselection.h" 23#include "playlistselection.h"
32 24
33#include <stdlib.h> 25#include <stdlib.h>
34 26
35class PlayListSelectionItem : public QListViewItem { 27class PlayListSelectionItem : public QListViewItem {
36public: 28public:
37 PlayListSelectionItem( QListView *parent, const DocLnk *f ) : QListViewItem( parent ), fl( f ) { 29 PlayListSelectionItem( QListView *parent, const DocLnk *f ) : QListViewItem( parent ), fl( f ) {
38 setText( 0, f->name() ); 30 setText( 0, f->name() );
39 setPixmap( 0, f->pixmap() ); 31 setPixmap( 0, f->pixmap() );
40 } 32 }
41 33
42 ~PlayListSelectionItem() { 34 ~PlayListSelectionItem() {
43 }; 35 };
44 36
45 const DocLnk *file() const { return fl; } 37 const DocLnk *file() const { return fl; }
46 38
47private: 39private:
48 const DocLnk *fl; 40 const DocLnk *fl;
49}; 41};
50 42
51 43
52PlayListSelection::PlayListSelection( QWidget *parent, const char *name ) 44PlayListSelection::PlayListSelection( QWidget *parent, const char *name )
53 : QListView( parent, name ) 45 : QListView( parent, name )
54{ 46{
55// qDebug("starting playlistselector"); 47// qDebug("starting playlistselector");
56// #ifdef USE_PLAYLIST_BACKGROUND 48// #ifdef USE_PLAYLIST_BACKGROUND
57// setStaticBackground( TRUE ); 49// setStaticBackground( TRUE );
58// setBackgroundPixmap( Resource::loadPixmap( "opieplayer/background" ) ); 50// setBackgroundPixmap( Resource::loadPixmap( "opieplayer/background" ) );
59 51
60// setBackgroundPixmap( Resource::loadPixmap( "launcher/opielogo" ) ); 52// setBackgroundPixmap( Resource::loadPixmap( "launcher/opielogo" ) );
61// #endif 53// #endif
62// addColumn("Title",236); 54// addColumn("Title",236);
63// setAllColumnsShowFocus( TRUE ); 55// setAllColumnsShowFocus( TRUE );
64 addColumn( tr( "Playlist Selection" ) ); 56 addColumn( tr( "Playlist Selection" ) );
65 header()->hide(); 57 header()->hide();
66// setSorting( -1, FALSE ); 58// setSorting( -1, FALSE );
67 // FIXME 59 // FIXME
68} 60}
69 61
70 62
71PlayListSelection::~PlayListSelection() { 63PlayListSelection::~PlayListSelection() {
72} 64}
73 65
74 66
75// #ifdef USE_PLAYLIST_BACKGROUND 67// #ifdef USE_PLAYLIST_BACKGROUND
76void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) { 68void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) {
77// qDebug("drawBackground"); 69// qDebug("drawBackground");
78 p->fillRect( r, QBrush( white ) ); 70 p->fillRect( r, QBrush( white ) );
79// QImage logo = Resource::loadImage( "launcher/opielogo" ); 71// QImage logo = Resource::loadImage( "launcher/opielogo" );
80// if ( !logo.isNull() ) 72// if ( !logo.isNull() )
81// p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo ); 73// p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo );
82} 74}
83// #endif 75// #endif
84 76
85 77
86void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) { 78void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) {
87 if ( event->state() == QMouseEvent::LeftButton ) { 79 if ( event->state() == QMouseEvent::LeftButton ) {
88 QListViewItem *currentItem = selectedItem(); 80 QListViewItem *currentItem = selectedItem();
89 QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) ); 81 QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) );
90 if ( currentItem && currentItem->itemAbove() == itemUnder ) 82 if ( currentItem && currentItem->itemAbove() == itemUnder )
91 moveSelectedUp(); 83 moveSelectedUp();
92 else if ( currentItem && currentItem->itemBelow() == itemUnder ) 84 else if ( currentItem && currentItem->itemBelow() == itemUnder )
93 moveSelectedDown(); 85 moveSelectedDown();
94 } 86 }
95} 87}
96 88
97 89
98const DocLnk *PlayListSelection::current() { 90const DocLnk *PlayListSelection::current() {
99 PlayListSelectionItem *item = (PlayListSelectionItem *)selectedItem(); 91 PlayListSelectionItem *item = (PlayListSelectionItem *)selectedItem();
100 if ( item ) 92 if ( item )
101 return item->file(); 93 return item->file();
102 return NULL; 94 return NULL;
103} 95}
104 96
105 97
106void PlayListSelection::addToSelection( const DocLnk &lnk ) { 98void PlayListSelection::addToSelection( const DocLnk &lnk ) {
107 PlayListSelectionItem *item = new PlayListSelectionItem( this, new DocLnk( lnk ) ); 99 PlayListSelectionItem *item = new PlayListSelectionItem( this, new DocLnk( lnk ) );
108 QListViewItem *current = selectedItem(); 100 QListViewItem *current = selectedItem();
109 if ( current ) 101 if ( current )
110 item->moveItem( current ); 102 item->moveItem( current );
111 setSelected( item, TRUE ); 103 setSelected( item, TRUE );
112 ensureItemVisible( item); 104 ensureItemVisible( item);
113} 105}
114 106
115 107
116void PlayListSelection::removeSelected() { 108void PlayListSelection::removeSelected() {
117 QListViewItem *item = selectedItem(); 109 QListViewItem *item = selectedItem();
118 if ( item ) 110 if ( item )
119 delete item; 111 delete item;
120 setSelected( currentItem(), TRUE ); 112 setSelected( currentItem(), TRUE );
121 ensureItemVisible( selectedItem() ); 113 ensureItemVisible( selectedItem() );
122} 114}
123 115
124 116
125void PlayListSelection::moveSelectedUp() { 117void PlayListSelection::moveSelectedUp() {
126 QListViewItem *item = selectedItem(); 118 QListViewItem *item = selectedItem();
127 if ( item && item->itemAbove() ) 119 if ( item && item->itemAbove() )
128 item->itemAbove()->moveItem( item ); 120 item->itemAbove()->moveItem( item );
129 ensureItemVisible( selectedItem() ); 121 ensureItemVisible( selectedItem() );
130} 122}
131 123
132 124
133void PlayListSelection::moveSelectedDown() { 125void PlayListSelection::moveSelectedDown() {
134 QListViewItem *item = selectedItem(); 126 QListViewItem *item = selectedItem();
135 if ( item && item->itemBelow() ) 127 if ( item && item->itemBelow() )
136 item->moveItem( item->itemBelow() ); 128 item->moveItem( item->itemBelow() );
137 ensureItemVisible( selectedItem() ); 129 ensureItemVisible( selectedItem() );
138} 130}
139 131
140 132
141bool PlayListSelection::prev() { 133bool PlayListSelection::prev() {
142 QListViewItem *item = selectedItem(); 134 QListViewItem *item = selectedItem();
143 if ( item && item->itemAbove() ) 135 if ( item && item->itemAbove() )
144 setSelected( item->itemAbove(), TRUE ); 136 setSelected( item->itemAbove(), TRUE );
145 else 137 else
146 return FALSE; 138 return FALSE;
147 ensureItemVisible( selectedItem() ); 139 ensureItemVisible( selectedItem() );
148 return TRUE; 140 return TRUE;
149} 141}
150 142
151bool PlayListSelection::next() { 143bool PlayListSelection::next() {
152 QListViewItem *item = selectedItem(); 144 QListViewItem *item = selectedItem();
153 if ( item && item->itemBelow() ) 145 if ( item && item->itemBelow() )
154 setSelected( item->itemBelow(), TRUE ); 146 setSelected( item->itemBelow(), TRUE );
155 else 147 else
156 return FALSE; 148 return FALSE;
157 ensureItemVisible( selectedItem() ); 149 ensureItemVisible( selectedItem() );
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index db99866..a359843 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -1,182 +1,157 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20// code added by L. J. Potter Sat 03-02-2002 06:17:54 20// code added by L. J. Potter Sat 03-02-2002 06:17:54
21#define QTOPIA_INTERNAL_FSLP 21#define QTOPIA_INTERNAL_FSLP
22#include <qpe/qcopenvelope_qws.h>
23 22
24#include <qmenubar.h>
25#include <qtoolbar.h> 23#include <qtoolbar.h>
26#include <qpe/qpemenubar.h> 24#include <qpe/qpemenubar.h>
27#include <qpe/fileselector.h>
28#include <qpe/qpeapplication.h>
29#include <qpe/lnkproperties.h> 25#include <qpe/lnkproperties.h>
30#include <qpe/storage.h>
31 26
32#include <qpe/applnk.h>
33#include <qpe/config.h>
34#include <qpe/global.h>
35#include <qpe/resource.h>
36#include <qaction.h> 27#include <qaction.h>
37#include <qcursor.h>
38#include <qimage.h>
39#include <qfile.h>
40#include <qdir.h>
41#include <qlayout.h> 28#include <qlayout.h>
42#include <qlabel.h>
43#include <qlist.h>
44#include <qlistbox.h>
45#include <qmainwindow.h>
46#include <qmessagebox.h> 29#include <qmessagebox.h>
47#include <qtoolbutton.h>
48#include <qtabwidget.h>
49#include <qlistview.h>
50#include <qpoint.h>
51#include <qlineedit.h>
52#include <qpushbutton.h>
53#include <qregexp.h>
54#include <qtextstream.h>
55 30
56//#include <qtimer.h> 31//#include <qtimer.h>
57 32
58#include "playlistselection.h" 33#include "playlistselection.h"
59#include "playlistwidget.h" 34#include "playlistwidget.h"
60#include "mediaplayerstate.h" 35#include "mediaplayerstate.h"
61 36
62#include "inputDialog.h" 37#include "inputDialog.h"
63 38
64#include <stdlib.h> 39#include <stdlib.h>
65#include "audiowidget.h" 40#include "audiowidget.h"
66#include "videowidget.h" 41#include "videowidget.h"
67 42
68#include <unistd.h> 43#include <unistd.h>
69#include <sys/file.h> 44#include <sys/file.h>
70#include <sys/ioctl.h> 45#include <sys/ioctl.h>
71#include <sys/soundcard.h> 46#include <sys/soundcard.h>
72 47
73// for setBacklight() 48// for setBacklight()
74#include <linux/fb.h> 49#include <linux/fb.h>
75#include <sys/types.h> 50#include <sys/types.h>
76#include <sys/stat.h> 51#include <sys/stat.h>
77#include <stdlib.h> 52#include <stdlib.h>
78 53
79#define BUTTONS_ON_TOOLBAR 54#define BUTTONS_ON_TOOLBAR
80#define SIDE_BUTTONS 55#define SIDE_BUTTONS
81#define CAN_SAVE_LOAD_PLAYLISTS 56#define CAN_SAVE_LOAD_PLAYLISTS
82 57
83extern AudioWidget *audioUI; 58extern AudioWidget *audioUI;
84extern VideoWidget *videoUI; 59extern VideoWidget *videoUI;
85extern MediaPlayerState *mediaPlayerState; 60extern MediaPlayerState *mediaPlayerState;
86 61
87static inline QString fullBaseName ( const QFileInfo &fi ) 62static inline QString fullBaseName ( const QFileInfo &fi )
88{ 63{
89 QString str = fi. fileName ( ); 64 QString str = fi. fileName ( );
90 return str. left ( str. findRev ( '.' )); 65 return str. left ( str. findRev ( '.' ));
91} 66}
92 67
93 68
94QString audioMimes ="audio/mpeg;audio/x-wav;application/ogg;audio/x-mod"; 69QString audioMimes ="audio/mpeg;audio/x-wav;application/ogg;audio/x-mod";
95// class myFileSelector { 70// class myFileSelector {
96 71
97// }; 72// };
98class PlayListWidgetPrivate { 73class PlayListWidgetPrivate {
99public: 74public:
100 QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; 75 QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove;
101 QFrame *playListFrame; 76 QFrame *playListFrame;
102 FileSelector *files; 77 FileSelector *files;
103 PlayListSelection *selectedFiles; 78 PlayListSelection *selectedFiles;
104 bool setDocumentUsed; 79 bool setDocumentUsed;
105 DocLnk *current; 80 DocLnk *current;
106}; 81};
107 82
108 83
109class ToolButton : public QToolButton { 84class ToolButton : public QToolButton {
110public: 85public:
111 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) 86 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE )
112 : QToolButton( parent, name ) { 87 : QToolButton( parent, name ) {
113 setTextLabel( name ); 88 setTextLabel( name );
114 setPixmap( Resource::loadPixmap( icon ) ); 89 setPixmap( Resource::loadPixmap( icon ) );
115 setAutoRaise( TRUE ); 90 setAutoRaise( TRUE );
116 setFocusPolicy( QWidget::NoFocus ); 91 setFocusPolicy( QWidget::NoFocus );
117 setToggleButton( t ); 92 setToggleButton( t );
118 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); 93 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot );
119 QPEMenuToolFocusManager::manager()->addWidget( this ); 94 QPEMenuToolFocusManager::manager()->addWidget( this );
120 } 95 }
121}; 96};
122 97
123 98
124class MenuItem : public QAction { 99class MenuItem : public QAction {
125public: 100public:
126 MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) 101 MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot )
127 : QAction( text, QString::null, 0, 0 ) { 102 : QAction( text, QString::null, 0, 0 ) {
128 connect( this, SIGNAL( activated() ), handler, slot ); 103 connect( this, SIGNAL( activated() ), handler, slot );
129 addTo( parent ); 104 addTo( parent );
130 } 105 }
131}; 106};
132 107
133 108
134PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) 109PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
135 : QMainWindow( parent, name, fl ) { 110 : QMainWindow( parent, name, fl ) {
136 111
137 d = new PlayListWidgetPrivate; 112 d = new PlayListWidgetPrivate;
138 d->setDocumentUsed = FALSE; 113 d->setDocumentUsed = FALSE;
139 d->current = NULL; 114 d->current = NULL;
140 fromSetDocument = FALSE; 115 fromSetDocument = FALSE;
141 insanityBool=FALSE; 116 insanityBool=FALSE;
142 audioScan = FALSE; 117 audioScan = FALSE;
143 videoScan = FALSE; 118 videoScan = FALSE;
144// menuTimer = new QTimer( this ,"menu timer"), 119// menuTimer = new QTimer( this ,"menu timer"),
145// connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); 120// connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) );
146 channel = new QCopChannel( "QPE/Application/opieplayer", this ); 121 channel = new QCopChannel( "QPE/Application/opieplayer", this );
147 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 122 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
148 this, SLOT( qcopReceive(const QCString&, const QByteArray&)) ); 123 this, SLOT( qcopReceive(const QCString&, const QByteArray&)) );
149 124
150 setBackgroundMode( PaletteButton ); 125 setBackgroundMode( PaletteButton );
151 126
152 setCaption( tr("OpiePlayer") ); 127 setCaption( tr("OpiePlayer") );
153 setIcon( Resource::loadPixmap( "opieplayer/MPEGPlayer" ) ); 128 setIcon( Resource::loadPixmap( "opieplayer/MPEGPlayer" ) );
154 129
155 setToolBarsMovable( FALSE ); 130 setToolBarsMovable( FALSE );
156 131
157 // Create Toolbar 132 // Create Toolbar
158 QToolBar *toolbar = new QToolBar( this ); 133 QToolBar *toolbar = new QToolBar( this );
159 toolbar->setHorizontalStretchable( TRUE ); 134 toolbar->setHorizontalStretchable( TRUE );
160 135
161 // Create Menubar 136 // Create Menubar
162 QMenuBar *menu = new QMenuBar( toolbar ); 137 QMenuBar *menu = new QMenuBar( toolbar );
163 menu->setMargin( 0 ); 138 menu->setMargin( 0 );
164 139
165 QToolBar *bar = new QToolBar( this ); 140 QToolBar *bar = new QToolBar( this );
166 bar->setLabel( tr( "Play Operations" ) ); 141 bar->setLabel( tr( "Play Operations" ) );
167// d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "opieplayer/play_current_list", 142// d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "opieplayer/play_current_list",
168// this , SLOT( addSelected()) ); 143// this , SLOT( addSelected()) );
169 tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); 144 tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close");
170 tbDeletePlaylist->setFlat(TRUE); 145 tbDeletePlaylist->setFlat(TRUE);
171 146
172 tbDeletePlaylist->setFixedSize(20,20); 147 tbDeletePlaylist->setFixedSize(20,20);
173 148
174 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer/add_to_playlist", 149 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer/add_to_playlist",
175 this , SLOT(addSelected()) ); 150 this , SLOT(addSelected()) );
176 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer/remove_from_playlist", 151 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer/remove_from_playlist",
177 this , SLOT(removeSelected()) ); 152 this , SLOT(removeSelected()) );
178// d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool) /* btnPlay() */), TRUE ); 153// d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool) /* btnPlay() */), TRUE );
179 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", 154 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play",
180 this , SLOT( btnPlay(bool) ), TRUE ); 155 this , SLOT( btnPlay(bool) ), TRUE );
181 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer/shuffle", 156 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer/shuffle",
182 mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); 157 mediaPlayerState, SLOT(setShuffled(bool)), TRUE );
diff --git a/core/multimedia/opieplayer/videowidget.cpp b/core/multimedia/opieplayer/videowidget.cpp
index 5273ad3..d002c42 100644
--- a/core/multimedia/opieplayer/videowidget.cpp
+++ b/core/multimedia/opieplayer/videowidget.cpp
@@ -1,158 +1,154 @@
1/********************************************************************** 1/**********************************************************************
2 ** Copyright (C) 2000 Trolltech AS. All rights reserved. 2 ** Copyright (C) 2000 Trolltech AS. All rights reserved.
3 ** 3 **
4 ** This file is part of Qtopia Environment. 4 ** This file is part of Qtopia Environment.
5 ** 5 **
6 ** This file may be distributed and/or modified under the terms of the 6 ** This file may be distributed and/or modified under the terms of the
7 ** GNU General Public License version 2 as published by the Free Software 7 ** GNU General Public License version 2 as published by the Free Software
8 ** Foundation and appearing in the file LICENSE.GPL included in the 8 ** Foundation and appearing in the file LICENSE.GPL included in the
9 ** packaging of this file. 9 ** packaging of this file.
10 ** 10 **
11 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13 ** 13 **
14 ** See http://www.trolltech.com/gpl/ for GPL licensing information. 14 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
15 ** 15 **
16 ** Contact info@trolltech.com if any conditions of this licensing are 16 ** Contact info@trolltech.com if any conditions of this licensing are
17 ** not clear to you. 17 ** not clear to you.
18 ** 18 **
19 **********************************************************************/ 19 **********************************************************************/
20#include <qpe/resource.h> 20#include <qpe/resource.h>
21#include <qpe/mediaplayerplugininterface.h> 21#include <qpe/mediaplayerplugininterface.h>
22#include <qpe/config.h> 22#include <qpe/config.h>
23#include <qpe/qpeapplication.h> 23#include <qpe/qpeapplication.h>
24 24
25#include <qdir.h> 25#include <qdir.h>
26#include <qwidget.h>
27#include <qpainter.h>
28#include <qpixmap.h>
29#include <qslider.h> 26#include <qslider.h>
30#include <qdrawutil.h>
31#include "videowidget.h" 27#include "videowidget.h"
32#include "mediaplayerstate.h" 28#include "mediaplayerstate.h"
33 29
34 30
35#ifdef Q_WS_QWS 31#ifdef Q_WS_QWS
36# define USE_DIRECT_PAINTER 32# define USE_DIRECT_PAINTER
37# include <qdirectpainter_qws.h> 33# include <qdirectpainter_qws.h>
38# include <qgfxraster_qws.h> 34# include <qgfxraster_qws.h>
39#endif 35#endif
40 36
41 37
42extern MediaPlayerState *mediaPlayerState; 38extern MediaPlayerState *mediaPlayerState;
43 39
44 40
45static const int xo = 2; // movable x offset 41static const int xo = 2; // movable x offset
46static const int yo = 0; // movable y offset 42static const int yo = 0; // movable y offset
47 43
48 44
49struct MediaButton { 45struct MediaButton {
50// int xPos, yPos; 46// int xPos, yPos;
51 bool isToggle, isHeld, isDown; 47 bool isToggle, isHeld, isDown;
52// int controlType; 48// int controlType;
53}; 49};
54 50
55 51
56// Layout information for the videoButtons (and if it is a toggle button or not) 52// Layout information for the videoButtons (and if it is a toggle button or not)
57MediaButton videoButtons[] = { 53MediaButton videoButtons[] = {
58 { FALSE, FALSE, FALSE }, // stop 54 { FALSE, FALSE, FALSE }, // stop
59 { FALSE, FALSE, FALSE }, // play 55 { FALSE, FALSE, FALSE }, // play
60 { FALSE, FALSE, FALSE }, // previous 56 { FALSE, FALSE, FALSE }, // previous
61 { FALSE, FALSE, FALSE }, // next 57 { FALSE, FALSE, FALSE }, // next
62 { FALSE, FALSE, FALSE }, // volUp 58 { FALSE, FALSE, FALSE }, // volUp
63 { FALSE, FALSE, FALSE }, // volDown 59 { FALSE, FALSE, FALSE }, // volDown
64 { TRUE, FALSE, FALSE } // fullscreen 60 { TRUE, FALSE, FALSE } // fullscreen
65}; 61};
66 62
67//static const int numButtons = (sizeof(videoButtons)/sizeof(MediaButton)); 63//static const int numButtons = (sizeof(videoButtons)/sizeof(MediaButton));
68 64
69const char *skinV_mask_file_names[7] = { 65const char *skinV_mask_file_names[7] = {
70 "stop","play","back","fwd","up","down","full" 66 "stop","play","back","fwd","up","down","full"
71}; 67};
72 68
73static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton)); 69static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton));
74 70
75VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : 71VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) :
76 QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) 72 QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 )
77{ 73{
78 setCaption( tr("OpiePlayer") ); 74 setCaption( tr("OpiePlayer") );
79 Config cfg("OpiePlayer"); 75 Config cfg("OpiePlayer");
80 76
81 cfg.setGroup("Options"); 77 cfg.setGroup("Options");
82 skin = cfg.readEntry("Skin","default"); 78 skin = cfg.readEntry("Skin","default");
83 79
84 QString skinPath; 80 QString skinPath;
85 skinPath = "opieplayer2/skins/" + skin; 81 skinPath = "opieplayer2/skins/" + skin;
86 if(!QDir(QString(getenv("OPIEDIR")) +"/pics/"+skinPath).exists()) 82 if(!QDir(QString(getenv("OPIEDIR")) +"/pics/"+skinPath).exists())
87 skinPath = "opieplayer2/skins/default"; 83 skinPath = "opieplayer2/skins/default";
88 84
89 // qDebug("skin path " + skinPath); 85 // qDebug("skin path " + skinPath);
90 86
91// QString skinPath = "opieplayer2/skins/" + skin; 87// QString skinPath = "opieplayer2/skins/" + skin;
92 88
93 pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); 89 pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
94 imgUp = new QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); 90 imgUp = new QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) );
95 imgDn = new QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); 91 imgDn = new QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) );
96 92
97 imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); 93 imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 );
98 imgButtonMask->fill( 0 ); 94 imgButtonMask->fill( 0 );
99 95
100 for ( int i = 0; i < 7; i++ ) { 96 for ( int i = 0; i < 7; i++ ) {
101 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + 97 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath +
102 "/skinV_mask_" + skinV_mask_file_names[i] + ".png" ); 98 "/skinV_mask_" + skinV_mask_file_names[i] + ".png" );
103 // qDebug("loading "+filename); 99 // qDebug("loading "+filename);
104 masks[i] = new QBitmap( filename ); 100 masks[i] = new QBitmap( filename );
105 101
106 if ( !masks[i]->isNull() ) { 102 if ( !masks[i]->isNull() ) {
107 QImage imgMask = masks[i]->convertToImage(); 103 QImage imgMask = masks[i]->convertToImage();
108 uchar **dest = imgButtonMask->jumpTable(); 104 uchar **dest = imgButtonMask->jumpTable();
109 for ( int y = 0; y < imgUp->height(); y++ ) { 105 for ( int y = 0; y < imgUp->height(); y++ ) {
110 uchar *line = dest[y]; 106 uchar *line = dest[y];
111 for ( int x = 0; x < imgUp->width(); x++ ) { 107 for ( int x = 0; x < imgUp->width(); x++ ) {
112 if ( !qRed( imgMask.pixel( x, y ) ) ) 108 if ( !qRed( imgMask.pixel( x, y ) ) )
113 line[x] = i + 1; 109 line[x] = i + 1;
114 } 110 }
115 } 111 }
116 } 112 }
117 } 113 }
118 // qDebug("finished loading first pics"); 114 // qDebug("finished loading first pics");
119 for ( int i = 0; i < 7; i++ ) { 115 for ( int i = 0; i < 7; i++ ) {
120 buttonPixUp[i] = NULL; 116 buttonPixUp[i] = NULL;
121 buttonPixDown[i] = NULL; 117 buttonPixDown[i] = NULL;
122 } 118 }
123 119
124 120
125 QWidget *d = QApplication::desktop(); 121 QWidget *d = QApplication::desktop();
126 int width = d->width(); 122 int width = d->width();
127 int height = d->height(); 123 int height = d->height();
128 124
129 if( (width != pixBg->width() ) || (height != pixBg->height() ) ) { 125 if( (width != pixBg->width() ) || (height != pixBg->height() ) ) {
130 // qDebug("<<<<<<<< scale image >>>>>>>>>>>>"); 126 // qDebug("<<<<<<<< scale image >>>>>>>>>>>>");
131 QImage img; 127 QImage img;
132 img = pixBg->convertToImage(); 128 img = pixBg->convertToImage();
133 pixBg->convertFromImage( img.smoothScale( width, height)); 129 pixBg->convertFromImage( img.smoothScale( width, height));
134 } 130 }
135 setBackgroundPixmap( *pixBg ); 131 setBackgroundPixmap( *pixBg );
136 132
137 currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 ); 133 currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 );
138 134
139 slider = new QSlider( Qt::Horizontal, this ); 135 slider = new QSlider( Qt::Horizontal, this );
140 slider->setMinValue( 0 ); 136 slider->setMinValue( 0 );
141 slider->setMaxValue( 1 ); 137 slider->setMaxValue( 1 );
142 slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); 138 slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) );
143 slider->setFocusPolicy( QWidget::NoFocus ); 139 slider->setFocusPolicy( QWidget::NoFocus );
144// slider->setGeometry( QRect( 7, 250, 220, 20 ) ); 140// slider->setGeometry( QRect( 7, 250, 220, 20 ) );
145 141
146 connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 142 connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
147 connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 143 connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
148 144
149 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); 145 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) );
150 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 146 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
151 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 147 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
152 connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); 148 connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) );
153// connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); 149// connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) );
154 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); 150 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) );
155 151
156 // Intialise state 152 // Intialise state
157 setLength( mediaPlayerState->length() ); 153 setLength( mediaPlayerState->length() );
158 setPosition( mediaPlayerState->position() ); 154 setPosition( mediaPlayerState->position() );
diff --git a/core/opie-login/loginwindowimpl.cpp b/core/opie-login/loginwindowimpl.cpp
index 330fac5..3037ba3 100644
--- a/core/opie-login/loginwindowimpl.cpp
+++ b/core/opie-login/loginwindowimpl.cpp
@@ -1,167 +1,163 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> 3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This file is free software; you can 5 _;:,     .>    :=|. This file is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This file is distributed in the hope that 12    .i_,=:_.      -<s. This file is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
17..}^=.=       =       ; Public License for more details. 17..}^=.=       =       ; Public License for more details.
18++=   -.     .`     .: 18++=   -.     .`     .:
19 :     =  ...= . :.=- You should have received a copy of the GNU 19 :     =  ...= . :.=- You should have received a copy of the GNU
20 -.   .:....=;==+<; General Public License along with this file; 20 -.   .:....=;==+<; General Public License along with this file;
21  -_. . .   )=.  = see the file COPYING. If not, write to the 21  -_. . .   )=.  = see the file COPYING. If not, write to the
22    --        :-=` Free Software Foundation, Inc., 22    --        :-=` Free Software Foundation, Inc.,
23 59 Temple Place - Suite 330, 23 59 Temple Place - Suite 330,
24 Boston, MA 02111-1307, USA. 24 Boston, MA 02111-1307, USA.
25 25
26*/ 26*/
27#include <qpe/version.h> 27#include <qpe/version.h>
28#include <qapplication.h>
29#include <qpushbutton.h> 28#include <qpushbutton.h>
30#include <qlayout.h> 29#include <qlayout.h>
31#include <qframe.h>
32#include <qlineedit.h> 30#include <qlineedit.h>
33#include <qtimer.h> 31#include <qtimer.h>
34#include <qcombobox.h> 32#include <qcombobox.h>
35#include <qpixmap.h>
36#include <qlabel.h> 33#include <qlabel.h>
37#include <qpopupmenu.h> 34#include <qpopupmenu.h>
38#include <qmessagebox.h> 35#include <qmessagebox.h>
39#include <qimage.h>
40#if QT_VERSION < 300 36#if QT_VERSION < 300
41#include <qgfx_qws.h> 37#include <qgfx_qws.h>
42#endif 38#endif
43#include <qwindowsystem_qws.h> 39#include <qwindowsystem_qws.h>
44 40
45#include <qpe/resource.h> 41#include <qpe/resource.h>
46#include <qpe/qcopenvelope_qws.h> 42#include <qpe/qcopenvelope_qws.h>
47#include <qpe/config.h> 43#include <qpe/config.h>
48 44
49#include <opie/odevice.h> 45#include <opie/odevice.h>
50 46
51#include <stdio.h> 47#include <stdio.h>
52#include <stdlib.h> 48#include <stdlib.h>
53 49
54#include "loginwindowimpl.h" 50#include "loginwindowimpl.h"
55#include "loginapplication.h" 51#include "loginapplication.h"
56#include "inputmethods.h" 52#include "inputmethods.h"
57 53
58using namespace Opie; 54using namespace Opie;
59 55
60 56
61LoginWindowImpl::LoginWindowImpl ( ) : LoginWindow ( 0, "LOGIN-WINDOW", WStyle_Customize | WStyle_NoBorder | WDestructiveClose ) 57LoginWindowImpl::LoginWindowImpl ( ) : LoginWindow ( 0, "LOGIN-WINDOW", WStyle_Customize | WStyle_NoBorder | WDestructiveClose )
62{ 58{
63 QPopupMenu *pop = new QPopupMenu ( this ); 59 QPopupMenu *pop = new QPopupMenu ( this );
64 pop-> insertItem ( tr( "Restart" ), this, SLOT( restart ( ))); 60 pop-> insertItem ( tr( "Restart" ), this, SLOT( restart ( )));
65 pop-> insertItem ( tr( "Quit" ), this, SLOT( quit ( ))); 61 pop-> insertItem ( tr( "Quit" ), this, SLOT( quit ( )));
66 m_menu-> setPopup ( pop ); 62 m_menu-> setPopup ( pop );
67 63
68 QCopChannel *channel = new QCopChannel ( "QPE/TaskBar", this ); 64 QCopChannel *channel = new QCopChannel ( "QPE/TaskBar", this );
69 connect ( channel, SIGNAL( received ( const QCString &, const QByteArray & )), this, SLOT( receive ( const QCString &, const QByteArray & ))); 65 connect ( channel, SIGNAL( received ( const QCString &, const QByteArray & )), this, SLOT( receive ( const QCString &, const QByteArray & )));
70 66
71 QHBoxLayout *lay = new QHBoxLayout ( m_taskbar, 4, 4 ); 67 QHBoxLayout *lay = new QHBoxLayout ( m_taskbar, 4, 4 );
72 m_input = new InputMethods ( m_taskbar ); 68 m_input = new InputMethods ( m_taskbar );
73 connect ( m_input, SIGNAL( inputToggled ( bool )), this, SLOT( calcMaxWindowRect ( ))); 69 connect ( m_input, SIGNAL( inputToggled ( bool )), this, SLOT( calcMaxWindowRect ( )));
74 lay-> addWidget ( m_input ); 70 lay-> addWidget ( m_input );
75 lay-> addStretch ( 10 ); 71 lay-> addStretch ( 10 );
76 72
77 setActiveWindow ( ); 73 setActiveWindow ( );
78 m_password-> setFocus ( ); 74 m_password-> setFocus ( );
79 75
80 m_user-> insertStringList ( lApp-> allUsers ( )); 76 m_user-> insertStringList ( lApp-> allUsers ( ));
81 77
82 //there is no point in displaying the IM for a zaurus 78 //there is no point in displaying the IM for a zaurus
83 if (ODevice::inst ( )-> series ( ) != Model_Zaurus){ 79 if (ODevice::inst ( )-> series ( ) != Model_Zaurus){
84 QTimer::singleShot ( 0, this, SLOT( showIM ( ))); 80 QTimer::singleShot ( 0, this, SLOT( showIM ( )));
85 } 81 }
86 82
87 QString opiedir = ::getenv ( "OPIEDIR" ); 83 QString opiedir = ::getenv ( "OPIEDIR" );
88 QPixmap bgpix ( opiedir + "/pics/launcher/opie-background.jpg" ); 84 QPixmap bgpix ( opiedir + "/pics/launcher/opie-background.jpg" );
89 85
90 if ( !bgpix. isNull ( )) { 86 if ( !bgpix. isNull ( )) {
91 setBackgroundPixmap ( bgpix ); 87 setBackgroundPixmap ( bgpix );
92 m_caption-> setBackgroundPixmap ( bgpix); 88 m_caption-> setBackgroundPixmap ( bgpix);
93 TextLabel1-> setBackgroundPixmap ( bgpix); 89 TextLabel1-> setBackgroundPixmap ( bgpix);
94 TextLabel2-> setBackgroundPixmap ( bgpix); 90 TextLabel2-> setBackgroundPixmap ( bgpix);
95 } 91 }
96 92
97 m_caption-> setText ( tr("<center>Welcome to OPIE %1</center><center>& %2 %3</center>"). arg(QPE_VERSION). arg ( ODevice::inst ( )-> systemString ( )). arg ( ODevice::inst ( )-> systemVersionString ( ))); 93 m_caption-> setText ( tr("<center>Welcome to OPIE %1</center><center>& %2 %3</center>"). arg(QPE_VERSION). arg ( ODevice::inst ( )-> systemString ( )). arg ( ODevice::inst ( )-> systemVersionString ( )));
98 94
99 Config cfg ( "opie-login" ); 95 Config cfg ( "opie-login" );
100 cfg. setGroup ( "General" ); 96 cfg. setGroup ( "General" );
101 QString last = cfg. readEntry ( "LastLogin" ); 97 QString last = cfg. readEntry ( "LastLogin" );
102 98
103 if ( !last. isEmpty ( )) 99 if ( !last. isEmpty ( ))
104 m_user-> setEditText ( last ); 100 m_user-> setEditText ( last );
105 101
106 calcMaxWindowRect ( ); 102 calcMaxWindowRect ( );
107} 103}
108 104
109LoginWindowImpl::~LoginWindowImpl ( ) 105LoginWindowImpl::~LoginWindowImpl ( )
110{ 106{
111} 107}
112 108
113 109
114void LoginWindowImpl::receive ( const QCString &msg, const QByteArray &data ) 110void LoginWindowImpl::receive ( const QCString &msg, const QByteArray &data )
115{ 111{
116 QDataStream stream ( data, IO_ReadOnly ); 112 QDataStream stream ( data, IO_ReadOnly );
117 113
118 if ( msg == "hideInputMethod()" ) 114 if ( msg == "hideInputMethod()" )
119 m_input-> hideInputMethod ( ); 115 m_input-> hideInputMethod ( );
120 else if ( msg == "showInputMethod()" ) 116 else if ( msg == "showInputMethod()" )
121 m_input-> showInputMethod ( ); 117 m_input-> showInputMethod ( );
122 else if ( msg == "reloadInputMethods()" ) 118 else if ( msg == "reloadInputMethods()" )
123 m_input-> loadInputMethods ( ); 119 m_input-> loadInputMethods ( );
124} 120}
125 121
126void LoginWindowImpl::calcMaxWindowRect ( ) 122void LoginWindowImpl::calcMaxWindowRect ( )
127{ 123{
128#ifdef Q_WS_QWS 124#ifdef Q_WS_QWS
129 QRect wr; 125 QRect wr;
130 int displayWidth = qApp-> desktop ( )-> width ( ); 126 int displayWidth = qApp-> desktop ( )-> width ( );
131 QRect ir = m_input-> inputRect ( ); 127 QRect ir = m_input-> inputRect ( );
132 if ( ir.isValid() ) 128 if ( ir.isValid() )
133 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); 129 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 );
134 else 130 else
135 wr.setCoords( 0, 0, displayWidth-1, m_taskbar->y()-1 ); 131 wr.setCoords( 0, 0, displayWidth-1, m_taskbar->y()-1 );
136 132
137#if QT_VERSION < 300 133#if QT_VERSION < 300
138 wr = qt_screen-> mapToDevice ( wr, QSize ( qt_screen-> width ( ), qt_screen-> height ( ))); 134 wr = qt_screen-> mapToDevice ( wr, QSize ( qt_screen-> width ( ), qt_screen-> height ( )));
139#endif 135#endif
140 136
141 QWSServer::setMaxWindowRect( wr ); 137 QWSServer::setMaxWindowRect( wr );
142#endif 138#endif
143} 139}
144 140
145 141
146void LoginWindowImpl::keyPressEvent ( QKeyEvent *e ) 142void LoginWindowImpl::keyPressEvent ( QKeyEvent *e )
147{ 143{
148 switch ( e-> key ( )) { 144 switch ( e-> key ( )) {
149 case HardKey_Suspend: suspend ( ); 145 case HardKey_Suspend: suspend ( );
150 break; 146 break;
151 case HardKey_Backlight: backlight ( ); 147 case HardKey_Backlight: backlight ( );
152 break; 148 break;
153 default: e-> ignore ( ); 149 default: e-> ignore ( );
154 break; 150 break;
155 } 151 }
156 LoginWindow::keyPressEvent ( e ); 152 LoginWindow::keyPressEvent ( e );
157} 153}
158 154
159 155
160void LoginWindowImpl::toggleEchoMode ( bool t ) 156void LoginWindowImpl::toggleEchoMode ( bool t )
161{ 157{
162 m_password-> setEchoMode ( t ? QLineEdit::Normal : QLineEdit::Password ); 158 m_password-> setEchoMode ( t ? QLineEdit::Normal : QLineEdit::Password );
163} 159}
164 160
165void LoginWindowImpl::showIM ( ) 161void LoginWindowImpl::showIM ( )
166{ 162{
167 m_input-> showInputMethod ( ); 163 m_input-> showInputMethod ( );
diff --git a/core/opie-login/main.cpp b/core/opie-login/main.cpp
index 7d2ed63..bf98735 100644
--- a/core/opie-login/main.cpp
+++ b/core/opie-login/main.cpp
@@ -1,185 +1,181 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> 3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This file is free software; you can 5 _;:,     .>    :=|. This file is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This file is distributed in the hope that 12    .i_,=:_.      -<s. This file is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
17..}^=.=       =       ; Public License for more details. 17..}^=.=       =       ; Public License for more details.
18++=   -.     .`     .: 18++=   -.     .`     .:
19 :     =  ...= . :.=- You should have received a copy of the GNU 19 :     =  ...= . :.=- You should have received a copy of the GNU
20 -.   .:....=;==+<; General Public License along with this file; 20 -.   .:....=;==+<; General Public License along with this file;
21  -_. . .   )=.  = see the file COPYING. If not, write to the 21  -_. . .   )=.  = see the file COPYING. If not, write to the
22    --        :-=` Free Software Foundation, Inc., 22    --        :-=` Free Software Foundation, Inc.,
23 59 Temple Place - Suite 330, 23 59 Temple Place - Suite 330,
24 Boston, MA 02111-1307, USA. 24 Boston, MA 02111-1307, USA.
25 25
26*/ 26*/
27 27
28#define _GNU_SOURCE 28#define _GNU_SOURCE
29 29
30#include <sys/types.h> 30#include <sys/types.h>
31#include <time.h> 31#include <time.h>
32#include <sys/time.h> 32#include <sys/time.h>
33#include <sys/resource.h> 33#include <sys/resource.h>
34#include <unistd.h> 34#include <unistd.h>
35#include <syslog.h> 35#include <syslog.h>
36#include <sys/wait.h> 36#include <sys/wait.h>
37#include <stdio.h> 37#include <stdio.h>
38#include <stdlib.h> 38#include <stdlib.h>
39#include <signal.h> 39#include <signal.h>
40#include <getopt.h> 40#include <getopt.h>
41#include <string.h> 41#include <string.h>
42 42
43#include <qpe/qpeapplication.h>
44#include <qpe/qcopenvelope_qws.h>
45#include <qpe/qpestyle.h> 43#include <qpe/qpestyle.h>
46#include <qpe/power.h> 44#include <qpe/power.h>
47#include <qpe/config.h> 45#include <qpe/config.h>
48 46
49#include <opie/odevice.h> 47#include <opie/odevice.h>
50 48
51#include <qwindowsystem_qws.h> 49#include <qwindowsystem_qws.h>
52#include <qwsmouse_qws.h>
53#include <qmessagebox.h> 50#include <qmessagebox.h>
54#include <qlabel.h> 51#include <qlabel.h>
55#include <qtimer.h> 52#include <qtimer.h>
56#include <qfile.h> 53#include <qfile.h>
57#include <qtextstream.h>
58 54
59#include "loginapplication.h" 55#include "loginapplication.h"
60#include "loginwindowimpl.h" 56#include "loginwindowimpl.h"
61#include "calibrate.h" 57#include "calibrate.h"
62 58
63using namespace Opie; 59using namespace Opie;
64 60
65int login_main ( int argc, char **argv, pid_t ppid ); 61int login_main ( int argc, char **argv, pid_t ppid );
66void sigterm ( int sig ); 62void sigterm ( int sig );
67void sigint ( int sig ); 63void sigint ( int sig );
68void exit_closelog ( ); 64void exit_closelog ( );
69 65
70static struct option long_options [] = { 66static struct option long_options [] = {
71 { "autologin", 1, 0, 'a' }, 67 { "autologin", 1, 0, 'a' },
72 { 0, 0, 0, 0 } 68 { 0, 0, 0, 0 }
73}; 69};
74 70
75 71
76int main ( int argc, char **argv ) 72int main ( int argc, char **argv )
77{ 73{
78 int userExited = 0; 74 int userExited = 0;
79 pid_t ppid = ::getpid ( ); 75 pid_t ppid = ::getpid ( );
80 76
81 if ( ::geteuid ( ) != 0 ) { 77 if ( ::geteuid ( ) != 0 ) {
82 ::fprintf ( stderr, "%s can only be executed by root. (or chmod +s)", argv [0] ); 78 ::fprintf ( stderr, "%s can only be executed by root. (or chmod +s)", argv [0] );
83 return 1; 79 return 1;
84 } 80 }
85 if ( ::getuid ( ) != 0 ) // qt doesn't really like SUID and 81 if ( ::getuid ( ) != 0 ) // qt doesn't really like SUID and
86 ::setuid ( 0 ); // messes up things like config files 82 ::setuid ( 0 ); // messes up things like config files
87 83
88 char *autolog = 0; 84 char *autolog = 0;
89 int c; 85 int c;
90 while (( c = ::getopt_long ( argc, argv, "a:", long_options, 0 )) != -1 ) { 86 while (( c = ::getopt_long ( argc, argv, "a:", long_options, 0 )) != -1 ) {
91 switch ( c ) { 87 switch ( c ) {
92 case 'a': 88 case 'a':
93 autolog = optarg; 89 autolog = optarg;
94 break; 90 break;
95 default: 91 default:
96 ::fprintf ( stderr, "Usage: %s [-a|--autologin=<user>]\n", argv [0] ); 92 ::fprintf ( stderr, "Usage: %s [-a|--autologin=<user>]\n", argv [0] );
97 return 2; 93 return 2;
98 } 94 }
99 } 95 }
100 96
101 //struct rlimit rl; 97 //struct rlimit rl;
102 //::getrlimit ( RLIMIT_NOFILE, &rl ); 98 //::getrlimit ( RLIMIT_NOFILE, &rl );
103 99
104 //for ( unsigned int i = 0; i < rl. rlim_cur; i++ ) 100 //for ( unsigned int i = 0; i < rl. rlim_cur; i++ )
105 // ::close ( i ); 101 // ::close ( i );
106 102
107 ::setpgid ( 0, 0 ); 103 ::setpgid ( 0, 0 );
108 ::setsid ( ); 104 ::setsid ( );
109 105
110 ::signal ( SIGTERM, sigterm ); 106 ::signal ( SIGTERM, sigterm );
111 ::signal ( SIGINT, sigterm ); 107 ::signal ( SIGINT, sigterm );
112 108
113 ::openlog ( "opie-login", LOG_CONS, LOG_AUTHPRIV ); 109 ::openlog ( "opie-login", LOG_CONS, LOG_AUTHPRIV );
114 ::atexit ( exit_closelog ); 110 ::atexit ( exit_closelog );
115 111
116 while ( true ) { 112 while ( true ) {
117 pid_t child = ::fork ( ); 113 pid_t child = ::fork ( );
118 114
119 if ( child < 0 ) { 115 if ( child < 0 ) {
120 ::syslog ( LOG_ERR, "Could not fork GUI process\n" ); 116 ::syslog ( LOG_ERR, "Could not fork GUI process\n" );
121 break; 117 break;
122 } 118 }
123 else if ( child > 0 ) { 119 else if ( child > 0 ) {
124 int status = 0; 120 int status = 0;
125 time_t started = ::time ( 0 ); 121 time_t started = ::time ( 0 );
126 122
127 while ( ::waitpid ( child, &status, 0 ) < 0 ) { } 123 while ( ::waitpid ( child, &status, 0 ) < 0 ) { }
128 124
129 LoginApplication::logout ( ); 125 LoginApplication::logout ( );
130 126
131 if (( ::time ( 0 ) - started ) < 3 ) { 127 if (( ::time ( 0 ) - started ) < 3 ) {
132 if ( autolog ) { 128 if ( autolog ) {
133 ::syslog ( LOG_ERR, "Respawning too fast -- disabling auto-login\n" ); 129 ::syslog ( LOG_ERR, "Respawning too fast -- disabling auto-login\n" );
134 autolog = 0; 130 autolog = 0;
135 } 131 }
136 else { 132 else {
137 ::syslog ( LOG_ERR, "Respawning too fast -- going down\n" ); 133 ::syslog ( LOG_ERR, "Respawning too fast -- going down\n" );
138 break; 134 break;
139 } 135 }
140 } 136 }
141 int killedbysig = 0; 137 int killedbysig = 0;
142 userExited=0; 138 userExited=0;
143 if (WIFEXITED(status)!=0 ) { 139 if (WIFEXITED(status)!=0 ) {
144 if (WEXITSTATUS(status)==137) { 140 if (WEXITSTATUS(status)==137) {
145 userExited=1; 141 userExited=1;
146 } 142 }
147 } 143 }
148 144
149 if ( WIFSIGNALED( status )) { 145 if ( WIFSIGNALED( status )) {
150 switch ( WTERMSIG( status )) { 146 switch ( WTERMSIG( status )) {
151 case SIGTERM: 147 case SIGTERM:
152 case SIGINT : 148 case SIGINT :
153 case SIGKILL: 149 case SIGKILL:
154 break; 150 break;
155 151
156 default : 152 default :
157 killedbysig = WTERMSIG( status ); 153 killedbysig = WTERMSIG( status );
158 break; 154 break;
159 } 155 }
160 } 156 }
161 if ( killedbysig ) { // qpe was killed by an uncaught signal 157 if ( killedbysig ) { // qpe was killed by an uncaught signal
162 qApp = 0; 158 qApp = 0;
163 159
164 ::syslog ( LOG_ERR, "Opie was killed by a signal #%d", killedbysig ); 160 ::syslog ( LOG_ERR, "Opie was killed by a signal #%d", killedbysig );
165 161
166 QWSServer::setDesktopBackground ( QImage ( )); 162 QWSServer::setDesktopBackground ( QImage ( ));
167 QApplication *app = new QApplication ( argc, argv, QApplication::GuiServer ); 163 QApplication *app = new QApplication ( argc, argv, QApplication::GuiServer );
168 app-> setFont ( QFont ( "Helvetica", 10 )); 164 app-> setFont ( QFont ( "Helvetica", 10 ));
169 app-> setStyle ( new QPEStyle ( )); 165 app-> setStyle ( new QPEStyle ( ));
170 166
171 const char *sig = ::strsignal ( killedbysig ); 167 const char *sig = ::strsignal ( killedbysig );
172 QLabel *l = new QLabel ( 0, "sig", Qt::WStyle_Customize | Qt::WStyle_NoBorder | Qt::WStyle_Tool ); 168 QLabel *l = new QLabel ( 0, "sig", Qt::WStyle_Customize | Qt::WStyle_NoBorder | Qt::WStyle_Tool );
173 l-> setText ( LoginWindowImpl::tr( "Opie was terminated\nby an uncaught signal\n(%1)\n" ). arg ( sig )); 169 l-> setText ( LoginWindowImpl::tr( "Opie was terminated\nby an uncaught signal\n(%1)\n" ). arg ( sig ));
174 l-> setAlignment ( Qt::AlignCenter ); 170 l-> setAlignment ( Qt::AlignCenter );
175 l-> move ( 0, 0 ); 171 l-> move ( 0, 0 );
176 l-> resize ( app-> desktop ( )-> width ( ), app-> desktop ( )-> height ( )); 172 l-> resize ( app-> desktop ( )-> width ( ), app-> desktop ( )-> height ( ));
177 l-> show ( ); 173 l-> show ( );
178 QTimer::singleShot ( 3000, app, SLOT( quit ( ))); 174 QTimer::singleShot ( 3000, app, SLOT( quit ( )));
179 app-> exec ( ); 175 app-> exec ( );
180 delete app; 176 delete app;
181 qApp = 0; 177 qApp = 0;
182 } 178 }
183 } 179 }
184 else { 180 else {
185 if ( !autolog ) { 181 if ( !autolog ) {
diff --git a/core/opie-login/opie-login.pro b/core/opie-login/opie-login.pro
index f9dbe2b..0fdd8e1 100644
--- a/core/opie-login/opie-login.pro
+++ b/core/opie-login/opie-login.pro
@@ -1,28 +1,28 @@
1TEMPLATE = app 1TEMPLATE = app
2CONFIG = qt warn_on debug usepam 2CONFIG = qt warn_on debug
3 3
4HEADERS = loginwindowimpl.h \ 4HEADERS = loginwindowimpl.h \
5 loginapplication.h \ 5 loginapplication.h \
6 ../launcher/inputmethods.h \ 6 ../launcher/inputmethods.h \
7 ../apps/calibrate/calibrate.h 7 ../apps/calibrate/calibrate.h
8 8
9SOURCES = loginwindowimpl.cpp \ 9SOURCES = loginwindowimpl.cpp \
10 loginapplication.cpp \ 10 loginapplication.cpp \
11 ../launcher/inputmethods.cpp \ 11 ../launcher/inputmethods.cpp \
12 ../apps/calibrate/calibrate.cpp \ 12 ../apps/calibrate/calibrate.cpp \
13 main.cpp 13 main.cpp
14 14
15INTERFACES = loginwindow.ui 15INTERFACES = loginwindow.ui
16 16
17INCLUDEPATH += $(OPIEDIR)/include ../launcher ../apps/calibrate 17INCLUDEPATH += $(OPIEDIR)/include ../launcher ../apps/calibrate
18DEPENDPATH += $(OPIEDIR)/include ../launcher ../apps/calibrate 18DEPENDPATH += $(OPIEDIR)/include ../launcher ../apps/calibrate
19 19
20LIBS += -lqpe -lopie 20LIBS += -lqpe -lopie
21 21
22usepam:LIBS += -lpam 22usepam:LIBS += -lpam
23usepam:DEFINES += USEPAM 23usepam:DEFINES += USEPAM
24 24
25DESTDIR = $(OPIEDIR)/bin 25DESTDIR = $(OPIEDIR)/bin
26TARGET = opie-login 26TARGET = opie-login
27 27
28include ( $(OPIEDIR)/include.pro ) 28include ( $(OPIEDIR)/include.pro )