summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/camera/gui/mainwindow.h2
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/inputDialog.cpp7
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp1
-rw-r--r--noncore/multimedia/opieplayer2/main.cpp3
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp4
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.cpp5
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.cpp1
-rw-r--r--noncore/multimedia/opieplayer2/om3u.cpp15
-rw-r--r--noncore/multimedia/opieplayer2/playlistselection.cpp8
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp1
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidgetgui.cpp1
-rw-r--r--noncore/multimedia/opieplayer2/skin.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/volumecontrol.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp1
-rw-r--r--noncore/multimedia/opieplayer2/xinevideowidget.cpp3
-rw-r--r--noncore/multimedia/opierec/main.cpp1
-rw-r--r--noncore/multimedia/opierec/qtrec.cpp1
-rw-r--r--noncore/multimedia/opierec/wavFile.cpp1
-rw-r--r--noncore/multimedia/opierec/waveform.cpp1
-rw-r--r--noncore/multimedia/powerchord/fretboard.cpp1
-rw-r--r--noncore/multimedia/powerchord/gs.cpp2
-rw-r--r--noncore/multimedia/powerchord/powerchord.cpp1
-rw-r--r--noncore/multimedia/powerchord/powerchordbase.cpp7
-rw-r--r--noncore/multimedia/showimg/ImageFileSelector.cpp11
-rw-r--r--noncore/multimedia/showimg/main.cpp1
-rw-r--r--noncore/multimedia/showimg/settingsdialog.cpp2
-rw-r--r--noncore/multimedia/showimg/settingsdialogbase.cpp4
-rw-r--r--noncore/multimedia/showimg/showimg.cpp13
-rw-r--r--noncore/multimedia/tonleiter/editinst.cpp1
-rw-r--r--noncore/multimedia/tonleiter/editstringwidget.cpp1
-rw-r--r--noncore/multimedia/tonleiter/mainwidget.cpp1
-rw-r--r--noncore/multimedia/tonleiter/menuwidget.cpp2
34 files changed, 1 insertions, 110 deletions
diff --git a/noncore/multimedia/camera/gui/mainwindow.h b/noncore/multimedia/camera/gui/mainwindow.h
index 451ad5f..d93cca1 100644
--- a/noncore/multimedia/camera/gui/mainwindow.h
+++ b/noncore/multimedia/camera/gui/mainwindow.h
@@ -1,107 +1,105 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2003 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2003 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Opie Environment. 4** This file is part of Opie 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**********************************************************************/ 14**********************************************************************/
15 15
16#ifndef MAINWINDOW_H 16#ifndef MAINWINDOW_H
17#define MAINWINDOW_H 17#define MAINWINDOW_H
18 18
19#include <qmainwindow.h> 19#include <qmainwindow.h>
20#include <qdatetime.h>
21#include <qimage.h> 20#include <qimage.h>
22#include <qpixmap.h> 21#include <qpixmap.h>
23#include <qdatetime.h>
24 22
25class QAction; 23class QAction;
26class QActionGroup; 24class QActionGroup;
27class QIconSet; 25class QIconSet;
28class QTimerEvent; 26class QTimerEvent;
29class QToolButton; 27class QToolButton;
30class QLabel; 28class QLabel;
31class MainWindowBase; 29class MainWindowBase;
32class QCopChannel; 30class QCopChannel;
33class PreviewWidget; 31class PreviewWidget;
34 32
35class CameraMainWindow: public QMainWindow 33class CameraMainWindow: public QMainWindow
36{ 34{
37 Q_OBJECT 35 Q_OBJECT
38 36
39 public: 37 public:
40 CameraMainWindow( QWidget * parent = 0, const char * name = "mainwindow", WFlags f = 0 ); 38 CameraMainWindow( QWidget * parent = 0, const char * name = "mainwindow", WFlags f = 0 );
41 virtual ~CameraMainWindow(); 39 virtual ~CameraMainWindow();
42 40
43 public slots: 41 public slots:
44 void changeZoom( int ); 42 void changeZoom( int );
45 void systemMessage( const QCString&, const QByteArray& ); 43 void systemMessage( const QCString&, const QByteArray& );
46 void showContextMenu(); 44 void showContextMenu();
47 void resoMenuItemClicked( QAction* ); 45 void resoMenuItemClicked( QAction* );
48 void qualityMenuItemClicked( QAction* ); 46 void qualityMenuItemClicked( QAction* );
49 void zoomMenuItemClicked( QAction* ); 47 void zoomMenuItemClicked( QAction* );
50 void flipMenuItemClicked( QAction* ); 48 void flipMenuItemClicked( QAction* );
51 void outputToMenuItemClicked( QAction* ); 49 void outputToMenuItemClicked( QAction* );
52 void outputMenuItemClicked( QAction* ); 50 void outputMenuItemClicked( QAction* );
53 void prefixItemChoosen(); 51 void prefixItemChoosen();
54 void appendSettingsChoosen(); 52 void appendSettingsChoosen();
55 void shutterClicked(); 53 void shutterClicked();
56 54
57 void updateCaption(); 55 void updateCaption();
58 56
59 protected: 57 protected:
60 void init(); 58 void init();
61 void startVideoCapture(); 59 void startVideoCapture();
62 void stopVideoCapture(); 60 void stopVideoCapture();
63 void postProcessVideo( const QString&, const QString& ); 61 void postProcessVideo( const QString&, const QString& );
64 void performCapture( const QString& ); 62 void performCapture( const QString& );
65 63
66 virtual void timerEvent( QTimerEvent* ); 64 virtual void timerEvent( QTimerEvent* );
67 65
68 protected slots: 66 protected slots:
69 void doSomething(); // solely for debugging purposes 67 void doSomething(); // solely for debugging purposes
70 68
71 private: 69 private:
72 PreviewWidget* preview; 70 PreviewWidget* preview;
73 int _rotation; 71 int _rotation;
74 QCopChannel* _sysChannel; 72 QCopChannel* _sysChannel;
75 73
76 QActionGroup* resog; 74 QActionGroup* resog;
77 QActionGroup* qualityg; 75 QActionGroup* qualityg;
78 QActionGroup* zoomg; 76 QActionGroup* zoomg;
79 QActionGroup* flipg; 77 QActionGroup* flipg;
80 QActionGroup* outputTog; 78 QActionGroup* outputTog;
81 QAction* custom; 79 QAction* custom;
82 QAction* docfolder; 80 QAction* docfolder;
83 QActionGroup* outputg; 81 QActionGroup* outputg;
84 82
85 QString flip; 83 QString flip;
86 int quality; 84 int quality;
87 int zoom; 85 int zoom;
88 int captureX; 86 int captureX;
89 int captureY; 87 int captureY;
90 QString captureFormat; 88 QString captureFormat;
91 89
92 QString outputTo; 90 QString outputTo;
93 QString prefix; 91 QString prefix;
94 bool appendSettings; 92 bool appendSettings;
95 93
96 bool _capturing; 94 bool _capturing;
97 int _pics; 95 int _pics;
98 int _videos; 96 int _videos;
99 97
100 QTime _time; 98 QTime _time;
101 int _videopics; 99 int _videopics;
102 int _capturefd; 100 int _capturefd;
103 int _framerate; 101 int _framerate;
104 unsigned char* _capturebuf; 102 unsigned char* _capturebuf;
105}; 103};
106 104
107#endif 105#endif
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index f3eafab..452117c 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -1,133 +1,131 @@
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 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; Library General Public License for more 22..}^=.=       =       ; Library General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = Library General Public License along with 26  -_. . .   )=.  = Library General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34 34
35#include "audiowidget.h" 35#include "audiowidget.h"
36#include "mediaplayerstate.h"
37#include "playlistwidget.h"
38 36
39#include <qpe/qpeapplication.h> 37#include <qpe/qpeapplication.h>
40 38
41namespace 39namespace
42{ 40{
43 41
44const int xo = -2; // movable x offset 42const int xo = -2; // movable x offset
45const int yo = 22; // movable y offset 43const int yo = 22; // movable y offset
46 44
47const MediaWidget::SkinButtonInfo skinInfo[] = 45const MediaWidget::SkinButtonInfo skinInfo[] =
48{ 46{
49 { MediaWidget::Play, "play", MediaWidget::ToggleButton }, 47 { MediaWidget::Play, "play", MediaWidget::ToggleButton },
50 { MediaWidget::Stop, "stop", MediaWidget::NormalButton }, 48 { MediaWidget::Stop, "stop", MediaWidget::NormalButton },
51 { MediaWidget::Next, "next", MediaWidget::NormalButton }, 49 { MediaWidget::Next, "next", MediaWidget::NormalButton },
52 { MediaWidget::Previous, "prev", MediaWidget::NormalButton }, 50 { MediaWidget::Previous, "prev", MediaWidget::NormalButton },
53 { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton }, 51 { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton },
54 { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton }, 52 { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton },
55 { MediaWidget::Loop, "loop", MediaWidget::ToggleButton }, 53 { MediaWidget::Loop, "loop", MediaWidget::ToggleButton },
56 { MediaWidget::PlayList, "playlist", MediaWidget::NormalButton }, 54 { MediaWidget::PlayList, "playlist", MediaWidget::NormalButton },
57 { MediaWidget::Forward, "forward", MediaWidget::NormalButton }, 55 { MediaWidget::Forward, "forward", MediaWidget::NormalButton },
58 { MediaWidget::Back, "back", MediaWidget::NormalButton } 56 { MediaWidget::Back, "back", MediaWidget::NormalButton }
59}; 57};
60 58
61const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] ); 59const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] );
62 60
63void changeTextColor( QWidget * w) { 61void changeTextColor( QWidget * w) {
64 QPalette p = w->palette(); 62 QPalette p = w->palette();
65 p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); 63 p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) );
66 p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); 64 p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) );
67 w->setPalette( p ); 65 w->setPalette( p );
68} 66}
69 67
70} 68}
71 69
72AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : 70AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) :
73 71
74 MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ), 72 MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ),
75 audioSliderBeingMoved( false ) 73 audioSliderBeingMoved( false )
76{ 74{
77 setCaption( tr("OpiePlayer") ); 75 setCaption( tr("OpiePlayer") );
78 76
79 loadSkin(); 77 loadSkin();
80 78
81 connect( &mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); 79 connect( &mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) );
82 connect( &mediaPlayerState, SIGNAL( isSeekableToggled(bool) ), this, SLOT( setSeekable(bool) ) ); 80 connect( &mediaPlayerState, SIGNAL( isSeekableToggled(bool) ), this, SLOT( setSeekable(bool) ) );
83 81
84 connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); 82 connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) );
85 connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); 83 connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) );
86 connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); 84 connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) );
87 connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); 85 connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) );
88 86
89 // Intialise state 87 // Intialise state
90 setLength( mediaPlayerState.length() ); 88 setLength( mediaPlayerState.length() );
91 setPosition( mediaPlayerState.position() ); 89 setPosition( mediaPlayerState.position() );
92 setLooping( mediaPlayerState.isFullscreen() ); 90 setLooping( mediaPlayerState.isFullscreen() );
93 // setPaused( mediaPlayerState->paused() ); 91 // setPaused( mediaPlayerState->paused() );
94 setPlaying( mediaPlayerState.isPlaying() ); 92 setPlaying( mediaPlayerState.isPlaying() );
95} 93}
96 94
97AudioWidget::~AudioWidget() { 95AudioWidget::~AudioWidget() {
98 96
99// mediaPlayerState->setPlaying(false); 97// mediaPlayerState->setPlaying(false);
100} 98}
101 99
102MediaWidget::GUIInfo AudioWidget::guiInfo() 100MediaWidget::GUIInfo AudioWidget::guiInfo()
103{ 101{
104 return GUIInfo( QString::null /* infix */, ::skinInfo, ::buttonCount ); 102 return GUIInfo( QString::null /* infix */, ::skinInfo, ::buttonCount );
105} 103}
106 104
107void AudioWidget::resizeEvent( QResizeEvent *e ) { 105void AudioWidget::resizeEvent( QResizeEvent *e ) {
108 int h = height(); 106 int h = height();
109 int w = width(); 107 int w = width();
110 108
111 songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) ); 109 songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) );
112 slider.setFixedWidth( w - 110 ); 110 slider.setFixedWidth( w - 110 );
113 slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); 111 slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) );
114 slider.setBackgroundOrigin( QWidget::ParentOrigin ); 112 slider.setBackgroundOrigin( QWidget::ParentOrigin );
115 time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); 113 time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) );
116 114
117 upperLeftOfButtonMask.rx() = ( w - buttonUpImage.width() ) / 2; 115 upperLeftOfButtonMask.rx() = ( w - buttonUpImage.width() ) / 2;
118 upperLeftOfButtonMask.ry() = (( h - buttonUpImage.height() ) / 2) - 10; 116 upperLeftOfButtonMask.ry() = (( h - buttonUpImage.height() ) / 2) - 10;
119 117
120 MediaWidget::resizeEvent( e ); 118 MediaWidget::resizeEvent( e );
121} 119}
122 120
123void AudioWidget::sliderPressed() { 121void AudioWidget::sliderPressed() {
124 audioSliderBeingMoved = TRUE; 122 audioSliderBeingMoved = TRUE;
125} 123}
126 124
127 125
128void AudioWidget::sliderReleased() { 126void AudioWidget::sliderReleased() {
129 audioSliderBeingMoved = FALSE; 127 audioSliderBeingMoved = FALSE;
130 if ( slider.width() == 0 ) 128 if ( slider.width() == 0 )
131 return; 129 return;
132 long val = long((double)slider.value() * mediaPlayerState.length() / slider.width()); 130 long val = long((double)slider.value() * mediaPlayerState.length() / slider.width());
133 mediaPlayerState.setPosition( val ); 131 mediaPlayerState.setPosition( val );
diff --git a/noncore/multimedia/opieplayer2/inputDialog.cpp b/noncore/multimedia/opieplayer2/inputDialog.cpp
index ebde9c6..05dc2d1 100644
--- a/noncore/multimedia/opieplayer2/inputDialog.cpp
+++ b/noncore/multimedia/opieplayer2/inputDialog.cpp
@@ -1,74 +1,67 @@
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,2003 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002,2003 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 =. 6 =.
7 .=l. 7 .=l.
8           .>+-= 8           .>+-=
9 _;:,     .>    :=|. This program is free software; you can 9 _;:,     .>    :=|. This program is free software; you can
10.> <`_,   >  .   <= redistribute it and/or modify it under 10.> <`_,   >  .   <= redistribute it and/or modify it under
11:`=1 )Y*s>-.--   : the terms of the GNU General Public 11:`=1 )Y*s>-.--   : the terms of the GNU General Public
12.="- .-=="i,     .._ License as published by the Free Software 12.="- .-=="i,     .._ License as published by the Free Software
13 - .   .-<_>     .<> Foundation; either version 2 of the License, 13 - .   .-<_>     .<> Foundation; either version 2 of the License,
14     ._= =}       : or (at your option) any later version. 14     ._= =}       : or (at your option) any later version.
15    .%`+i>       _;_. 15    .%`+i>       _;_.
16    .i_,=:_.      -<s. This program is distributed in the hope that 16    .i_,=:_.      -<s. This program is distributed in the hope that
17     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 17     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
18    : ..    .:,     . . . without even the implied warranty of 18    : ..    .:,     . . . without even the implied warranty of
19    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 19    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
20  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 20  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
21..}^=.=       =       ; General Public License for more 21..}^=.=       =       ; General Public License for more
22++=   -.     .`     .: details. 22++=   -.     .`     .: details.
23 :     =  ...= . :.=- 23 :     =  ...= . :.=-
24 -.   .:....=;==+<; You should have received a copy of the GNU 24 -.   .:....=;==+<; You should have received a copy of the GNU
25  -_. . .   )=.  = General Public License along with 25  -_. . .   )=.  = General Public License along with
26    --        :-=` this library; see the file COPYING.LIB. 26    --        :-=` this library; see the file COPYING.LIB.
27 If not, write to the Free Software Foundation, 27 If not, write to the Free Software Foundation,
28 Inc., 59 Temple Place - Suite 330, 28 Inc., 59 Temple Place - Suite 330,
29 Boston, MA 02111-1307, USA. 29 Boston, MA 02111-1307, USA.
30 30
31*/ 31*/
32 32
33 33
34#include "inputDialog.h" 34#include "inputDialog.h"
35 35
36#include <qpe/resource.h>
37#include <qpe/qpeapplication.h>
38 36
39#include <qfileinfo.h>
40#include <qlineedit.h> 37#include <qlineedit.h>
41#include <qlayout.h>
42#include <qvariant.h>
43#include <qpushbutton.h>
44#include <qwhatsthis.h>
45 38
46InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) 39InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
47 : QDialog( parent, name, modal, fl ) { 40 : QDialog( parent, name, modal, fl ) {
48 if ( !name ) { 41 if ( !name ) {
49 setName( "InputDialog" ); 42 setName( "InputDialog" );
50 } 43 }
51 resize( 234, 115); 44 resize( 234, 115);
52 setMaximumSize( QSize( 240, 40)); 45 setMaximumSize( QSize( 240, 40));
53 setCaption( tr( name ) ); 46 setCaption( tr( name ) );
54 47
55 QPushButton *browserButton; 48 QPushButton *browserButton;
56 //browserButton = new QPushButton( Resource::loadIconSet("fileopen"),"",this,"BrowseButton"); 49 //browserButton = new QPushButton( Resource::loadIconSet("fileopen"),"",this,"BrowseButton");
57 //browserButton->setGeometry( QRect( 205, 10, 22, 22)); 50 //browserButton->setGeometry( QRect( 205, 10, 22, 22));
58 //connect( browserButton, SIGNAL(released()),this,SLOT(browse())); 51 //connect( browserButton, SIGNAL(released()),this,SLOT(browse()));
59 LineEdit1 = new QLineEdit( this, "LineEdit1" ); 52 LineEdit1 = new QLineEdit( this, "LineEdit1" );
60 LineEdit1->setGeometry( QRect( 4, 10, 190, 22 ) ); 53 LineEdit1->setGeometry( QRect( 4, 10, 190, 22 ) );
61 LineEdit1->setFocus(); 54 LineEdit1->setFocus();
62} 55}
63/* 56/*
64 * return the current text(input) 57 * return the current text(input)
65 */ 58 */
66QString InputDialog::text() const { 59QString InputDialog::text() const {
67 return LineEdit1->text(); 60 return LineEdit1->text();
68} 61}
69/* 62/*
70 * Destroys the object and frees any allocated resources 63 * Destroys the object and frees any allocated resources
71 */ 64 */
72InputDialog::~InputDialog() { 65InputDialog::~InputDialog() {
73} 66}
74 67
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp
index 664ec65..a42b8e5 100644
--- a/noncore/multimedia/opieplayer2/lib.cpp
+++ b/noncore/multimedia/opieplayer2/lib.cpp
@@ -1,136 +1,135 @@
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 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 LJP <> 5 Copyright (c) 2002 LJP <>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; Library General Public License for more 22..}^=.=       =       ; Library General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = Library General Public License along with 26  -_. . .   )=.  = Library General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34 34
35#include <qtextstream.h> 35#include <qtextstream.h>
36 36
37#include <qdir.h> 37#include <qdir.h>
38 38
39#include <qgfx_qws.h> 39#include <qgfx_qws.h>
40#include <qdirectpainter_qws.h>
41 40
42#include <assert.h> 41#include <assert.h>
43 42
44#include "xinevideowidget.h" 43#include "xinevideowidget.h"
45#include "frame.h" 44#include "frame.h"
46#include "lib.h" 45#include "lib.h"
47 46
48 47
49typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, 48typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame,
50 int width, int height,int bytes ); 49 int width, int height,int bytes );
51 50
52extern "C" { 51extern "C" {
53 xine_vo_driver_t* init_video_out_plugin( xine_t *xine, void* video, display_xine_frame_t, void * ); 52 xine_vo_driver_t* init_video_out_plugin( xine_t *xine, void* video, display_xine_frame_t, void * );
54 int null_is_showing_video( const xine_vo_driver_t* self ); 53 int null_is_showing_video( const xine_vo_driver_t* self );
55 void null_set_show_video( const xine_vo_driver_t* self, int show ); 54 void null_set_show_video( const xine_vo_driver_t* self, int show );
56 int null_is_fullscreen( const xine_vo_driver_t* self ); 55 int null_is_fullscreen( const xine_vo_driver_t* self );
57 void null_set_fullscreen( const xine_vo_driver_t* self, int screen ); 56 void null_set_fullscreen( const xine_vo_driver_t* self, int screen );
58 int null_is_scaling( const xine_vo_driver_t* self ); 57 int null_is_scaling( const xine_vo_driver_t* self );
59 void null_set_scaling( const xine_vo_driver_t* self, int scale ); 58 void null_set_scaling( const xine_vo_driver_t* self, int scale );
60 void null_set_gui_width( const xine_vo_driver_t* self, int width ); 59 void null_set_gui_width( const xine_vo_driver_t* self, int width );
61 void null_set_gui_height( const xine_vo_driver_t* self, int height ); 60 void null_set_gui_height( const xine_vo_driver_t* self, int height );
62 void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb ); 61 void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb );
63 void null_set_videoGamma( const xine_vo_driver_t* self , int value ); 62 void null_set_videoGamma( const xine_vo_driver_t* self , int value );
64 void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data ); 63 void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data );
65 64
66 void null_preload_decoders( xine_stream_t *stream ); 65 void null_preload_decoders( xine_stream_t *stream );
67} 66}
68 67
69using namespace XINE; 68using namespace XINE;
70 69
71Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) 70Lib::Lib( InitializationMode initMode, XineVideoWidget* widget )
72{ 71{
73 m_initialized = false; 72 m_initialized = false;
74 m_duringInitialization = false; 73 m_duringInitialization = false;
75 m_video = false; 74 m_video = false;
76 m_wid = widget; 75 m_wid = widget;
77 printf("Lib"); 76 printf("Lib");
78 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; 77 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf";
79 // get the configuration 78 // get the configuration
80 79
81 // not really OO, should be an extra class, later 80 // not really OO, should be an extra class, later
82 if ( !QFile::exists(configPath) ) { 81 if ( !QFile::exists(configPath) ) {
83 QFile f(configPath); 82 QFile f(configPath);
84 f.open(IO_WriteOnly); 83 f.open(IO_WriteOnly);
85 QTextStream ts( &f ); 84 QTextStream ts( &f );
86 ts << "misc.memcpy_method:glibc\n"; 85 ts << "misc.memcpy_method:glibc\n";
87 ts << "# uncomment if you experience double speed audio \n #audio.oss_sync_method:softsync\n"; 86 ts << "# uncomment if you experience double speed audio \n #audio.oss_sync_method:softsync\n";
88 ts << "codec.ffmpeg_pp_quality:3\n"; 87 ts << "codec.ffmpeg_pp_quality:3\n";
89 ts << "audio.num_buffers:50\n"; 88 ts << "audio.num_buffers:50\n";
90 ts << "audio.size_buffers:4096\n"; 89 ts << "audio.size_buffers:4096\n";
91 ts << "video.num_buffers:20\n"; 90 ts << "video.num_buffers:20\n";
92 ts << "video.size_buffers:4096\n"; 91 ts << "video.size_buffers:4096\n";
93 ts << "audio.out_num_audio_buf:16\n"; 92 ts << "audio.out_num_audio_buf:16\n";
94 ts << "audio.out_size_audio_buf:8096\n"; 93 ts << "audio.out_size_audio_buf:8096\n";
95 ts << "audio.out_size_zero_buf:1024\n"; 94 ts << "audio.out_size_zero_buf:1024\n";
96 ts << "audio.passthrough_offset:0\n"; 95 ts << "audio.passthrough_offset:0\n";
97 f.close(); 96 f.close();
98 } 97 }
99 98
100 if ( initMode == InitializeImmediately ) { 99 if ( initMode == InitializeImmediately ) {
101 initialize(); 100 initialize();
102 m_initialized = true; 101 m_initialized = true;
103 } 102 }
104 else 103 else
105 start(); 104 start();
106} 105}
107 106
108void Lib::run() 107void Lib::run()
109{ 108{
110 qDebug( "Lib::run() started" ); 109 qDebug( "Lib::run() started" );
111 initialize(); 110 initialize();
112 m_initialized = true; 111 m_initialized = true;
113 qDebug( "Lib::run() finished" ); 112 qDebug( "Lib::run() finished" );
114} 113}
115 114
116void Lib::initialize() 115void Lib::initialize()
117{ 116{
118 m_duringInitialization = true; 117 m_duringInitialization = true;
119 m_xine = xine_new( ); 118 m_xine = xine_new( );
120 119
121 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; 120 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf";
122 xine_config_load( m_xine, QFile::encodeName( configPath ) ); 121 xine_config_load( m_xine, QFile::encodeName( configPath ) );
123 122
124 xine_init( m_xine ); 123 xine_init( m_xine );
125 124
126 // allocate oss for sound 125 // allocate oss for sound
127 // and fb for framebuffer 126 // and fb for framebuffer
128 m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); 127 m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL );
129 m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this ); 128 m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this );
130 129
131 130
132//xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL); 131//xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL);
133 132
134 133
135// null_display_handler( m_videoOutput, xine_display_frame, this ); 134// null_display_handler( m_videoOutput, xine_display_frame, this );
136 135
diff --git a/noncore/multimedia/opieplayer2/main.cpp b/noncore/multimedia/opieplayer2/main.cpp
index b0a22b2..00f72d1 100644
--- a/noncore/multimedia/opieplayer2/main.cpp
+++ b/noncore/multimedia/opieplayer2/main.cpp
@@ -1,29 +1,26 @@
1 1
2#include <qpe/qpeapplication.h>
3#include "mediaplayerstate.h"
4#include "playlistwidget.h"
5#include "mediaplayer.h" 2#include "mediaplayer.h"
6 3
7 4
8 5
9#include <opie/oapplicationfactory.h> 6#include <opie/oapplicationfactory.h>
10 7
11OPIE_EXPORT_APP( OApplicationFactory<PlayListWidget> ) 8OPIE_EXPORT_APP( OApplicationFactory<PlayListWidget> )
12 9
13#if 0 10#if 0
14int main(int argc, char **argv) { 11int main(int argc, char **argv) {
15 QPEApplication a(argc,argv); 12 QPEApplication a(argc,argv);
16 13
17 MediaPlayerState st( 0, "mediaPlayerState" ); 14 MediaPlayerState st( 0, "mediaPlayerState" );
18 PlayListWidget pl( st, 0, "playList" ); 15 PlayListWidget pl( st, 0, "playList" );
19 pl.showMaximized(); 16 pl.showMaximized();
20 MediaPlayer mp( pl, st, 0, "mediaPlayer" ); 17 MediaPlayer mp( pl, st, 0, "mediaPlayer" );
21 QObject::connect( &pl, SIGNAL( skinSelected() ), 18 QObject::connect( &pl, SIGNAL( skinSelected() ),
22 &mp, SLOT( reloadSkins() ) ); 19 &mp, SLOT( reloadSkins() ) );
23 20
24 a.showMainDocumentWidget(&pl); 21 a.showMainDocumentWidget(&pl);
25 22
26 return a.exec(); 23 return a.exec();
27} 24}
28#endif 25#endif
29 26
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index 1e6bc4d..a236775 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -1,109 +1,105 @@
1#include <qpe/qpeapplication.h> 1#include <qpe/qpeapplication.h>
2#include <qpe/config.h> 2#include <qpe/config.h>
3#include <qpe/qcopenvelope_qws.h>
4#include <qfileinfo.h> 3#include <qfileinfo.h>
5 4
6#include "mediaplayer.h" 5#include "mediaplayer.h"
7#include "playlistwidget.h"
8#include "audiowidget.h" 6#include "audiowidget.h"
9#include "videowidget.h" 7#include "videowidget.h"
10#include "volumecontrol.h" 8#include "volumecontrol.h"
11#include "lib.h"
12 9
13#include "mediaplayerstate.h"
14 10
15 // for setBacklight() 11 // for setBacklight()
16#include <linux/fb.h> 12#include <linux/fb.h>
17#include <sys/file.h> 13#include <sys/file.h>
18#include <sys/ioctl.h> 14#include <sys/ioctl.h>
19 15
20 16
21#define FBIOBLANK 0x4611 17#define FBIOBLANK 0x4611
22 18
23MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) 19MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name )
24 : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) { 20 : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) {
25 21
26 m_audioUI = 0; 22 m_audioUI = 0;
27 m_videoUI = 0; 23 m_videoUI = 0;
28 m_xineControl = 0; 24 m_xineControl = 0;
29 xine = new XINE::Lib( XINE::Lib::InitializeInThread ); 25 xine = new XINE::Lib( XINE::Lib::InitializeInThread );
30 26
31 fd=-1;fl=-1; 27 fd=-1;fl=-1;
32 playList.setCaption( tr( "OpiePlayer: Initializating" ) ); 28 playList.setCaption( tr( "OpiePlayer: Initializating" ) );
33 29
34 qApp->processEvents(); 30 qApp->processEvents();
35 // QPEApplication::grabKeyboard(); // EVIL 31 // QPEApplication::grabKeyboard(); // EVIL
36 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 32 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
37 33
38 connect( &mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); 34 connect( &mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) );
39 35
40// What is pauseCheck good for? (Simon) 36// What is pauseCheck good for? (Simon)
41// connect( &mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pauseCheck(bool) ) ); 37// connect( &mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pauseCheck(bool) ) );
42 38
43 connect( &mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); 39 connect( &mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) );
44 connect( &mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); 40 connect( &mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) );
45 connect( &mediaPlayerState, SIGNAL( blankToggled(bool) ), this, SLOT ( blank(bool) ) ); 41 connect( &mediaPlayerState, SIGNAL( blankToggled(bool) ), this, SLOT ( blank(bool) ) );
46 42
47 volControl = new VolumeControl; 43 volControl = new VolumeControl;
48 Config cfg( "OpiePlayer" ); 44 Config cfg( "OpiePlayer" );
49 cfg.setGroup("PlayList"); 45 cfg.setGroup("PlayList");
50 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); 46 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default");
51 playList.setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() ); 47 playList.setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() );
52 48
53 m_skinLoader = new SkinLoader; 49 m_skinLoader = new SkinLoader;
54 m_skinLoader->schedule( AudioWidget::guiInfo() ); 50 m_skinLoader->schedule( AudioWidget::guiInfo() );
55 m_skinLoader->schedule( VideoWidget::guiInfo() ); 51 m_skinLoader->schedule( VideoWidget::guiInfo() );
56 m_skinLoader->start(); 52 m_skinLoader->start();
57} 53}
58 54
59MediaPlayer::~MediaPlayer() { 55MediaPlayer::~MediaPlayer() {
60 // this shold never happen, but one never knows... 56 // this shold never happen, but one never knows...
61 if ( xine ) { 57 if ( xine ) {
62 xine->ensureInitialized(); 58 xine->ensureInitialized();
63 delete xine; 59 delete xine;
64 } 60 }
65 delete m_xineControl; 61 delete m_xineControl;
66 delete m_audioUI; 62 delete m_audioUI;
67 delete m_videoUI; 63 delete m_videoUI;
68 delete volControl; 64 delete volControl;
69} 65}
70 66
71void MediaPlayer::pauseCheck( bool b ) { 67void MediaPlayer::pauseCheck( bool b ) {
72 if ( b && !mediaPlayerState.isPlaying() ) { 68 if ( b && !mediaPlayerState.isPlaying() ) {
73 mediaPlayerState.setPaused( FALSE ); 69 mediaPlayerState.setPaused( FALSE );
74 } 70 }
75} 71}
76 72
77void MediaPlayer::play() { 73void MediaPlayer::play() {
78 mediaPlayerState.setPlaying( FALSE ); 74 mediaPlayerState.setPlaying( FALSE );
79 mediaPlayerState.setPlaying( TRUE ); 75 mediaPlayerState.setPlaying( TRUE );
80} 76}
81 77
82void MediaPlayer::setPlaying( bool play ) { 78void MediaPlayer::setPlaying( bool play ) {
83 if ( !play ) { 79 if ( !play ) {
84 return; 80 return;
85 } 81 }
86 82
87 if ( mediaPlayerState.isPaused() ) { 83 if ( mediaPlayerState.isPaused() ) {
88 mediaPlayerState.setPaused( FALSE ); 84 mediaPlayerState.setPaused( FALSE );
89 return; 85 return;
90 } 86 }
91 87
92 QString tickerText, time, fileName; 88 QString tickerText, time, fileName;
93 if ( playList.currentTab() != PlayListWidget::CurrentPlayList ) { 89 if ( playList.currentTab() != PlayListWidget::CurrentPlayList ) {
94 //if playing in file list.. play in a different way 90 //if playing in file list.. play in a different way
95 // random and looping settings enabled causes problems here, 91 // random and looping settings enabled causes problems here,
96 // since there is no selected file in the playlist, but a selected file in the file list, 92 // since there is no selected file in the playlist, but a selected file in the file list,
97 // so we remember and shutoff 93 // so we remember and shutoff
98 l = mediaPlayerState.isLooping(); 94 l = mediaPlayerState.isLooping();
99 if(l) { 95 if(l) {
100 mediaPlayerState.setLooping( false ); 96 mediaPlayerState.setLooping( false );
101 } 97 }
102 r = mediaPlayerState.isShuffled(); 98 r = mediaPlayerState.isShuffled();
103 mediaPlayerState.setShuffled( false ); 99 mediaPlayerState.setShuffled( false );
104 } 100 }
105 101
106 PlayListWidget::Entry playListEntry = playList.currentEntry(); 102 PlayListWidget::Entry playListEntry = playList.currentEntry();
107 fileName = playListEntry.name; 103 fileName = playListEntry.name;
108 xineControl()->play( playListEntry.file ); 104 xineControl()->play( playListEntry.file );
109 105
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
index 40fa1a4..203ff91 100644
--- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
@@ -1,137 +1,132 @@
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 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; General Public License for more 22..}^=.=       =       ; General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = General Public License along with 26  -_. . .   )=.  = General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34// this file is based on work by trolltech 34// this file is based on work by trolltech
35 35
36#include <qpe/qpeapplication.h>
37#include <qpe/qlibrary.h>
38#include <qpe/config.h> 36#include <qpe/config.h>
39#include <qvaluelist.h>
40#include <qobject.h>
41#include <qdir.h>
42#include "mediaplayerstate.h" 37#include "mediaplayerstate.h"
43 38
44#include <assert.h> 39#include <assert.h>
45 40
46//#define MediaPlayerDebug(x) qDebug x 41//#define MediaPlayerDebug(x) qDebug x
47#define MediaPlayerDebug(x) 42#define MediaPlayerDebug(x)
48 43
49 44
50MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) 45MediaPlayerState::MediaPlayerState( QObject *parent, const char *name )
51 : QObject( parent, name ) { 46 : QObject( parent, name ) {
52 Config cfg( "OpiePlayer" ); 47 Config cfg( "OpiePlayer" );
53 readConfig( cfg ); 48 readConfig( cfg );
54 streaming = false; 49 streaming = false;
55 seekable = true; 50 seekable = true;
56} 51}
57 52
58 53
59MediaPlayerState::~MediaPlayerState() { 54MediaPlayerState::~MediaPlayerState() {
60} 55}
61 56
62 57
63void MediaPlayerState::readConfig( Config& cfg ) { 58void MediaPlayerState::readConfig( Config& cfg ) {
64 cfg.setGroup("Options"); 59 cfg.setGroup("Options");
65 fullscreen = cfg.readBoolEntry( "FullScreen" ); 60 fullscreen = cfg.readBoolEntry( "FullScreen" );
66 scaled = cfg.readBoolEntry( "Scaling" ); 61 scaled = cfg.readBoolEntry( "Scaling" );
67 looping = cfg.readBoolEntry( "Looping" ); 62 looping = cfg.readBoolEntry( "Looping" );
68 shuffled = cfg.readBoolEntry( "Shuffle" ); 63 shuffled = cfg.readBoolEntry( "Shuffle" );
69 videoGamma = cfg.readNumEntry( "VideoGamma" ); 64 videoGamma = cfg.readNumEntry( "VideoGamma" );
70 playing = FALSE; 65 playing = FALSE;
71 streaming = FALSE; 66 streaming = FALSE;
72 paused = FALSE; 67 paused = FALSE;
73 curPosition = 0; 68 curPosition = 0;
74 curLength = 0; 69 curLength = 0;
75 m_displayType = MediaSelection; 70 m_displayType = MediaSelection;
76} 71}
77 72
78 73
79void MediaPlayerState::writeConfig( Config& cfg ) const { 74void MediaPlayerState::writeConfig( Config& cfg ) const {
80 cfg.setGroup( "Options" ); 75 cfg.setGroup( "Options" );
81 cfg.writeEntry( "FullScreen", fullscreen ); 76 cfg.writeEntry( "FullScreen", fullscreen );
82 cfg.writeEntry( "Scaling", scaled ); 77 cfg.writeEntry( "Scaling", scaled );
83 cfg.writeEntry( "Looping", looping ); 78 cfg.writeEntry( "Looping", looping );
84 cfg.writeEntry( "Shuffle", shuffled ); 79 cfg.writeEntry( "Shuffle", shuffled );
85 cfg.writeEntry( "VideoGamma", videoGamma ); 80 cfg.writeEntry( "VideoGamma", videoGamma );
86} 81}
87 82
88MediaPlayerState::DisplayType MediaPlayerState::displayType() const 83MediaPlayerState::DisplayType MediaPlayerState::displayType() const
89{ 84{
90 return m_displayType; 85 return m_displayType;
91} 86}
92 87
93// slots 88// slots
94void MediaPlayerState::setIsStreaming( bool b ) { 89void MediaPlayerState::setIsStreaming( bool b ) {
95 streaming = b; 90 streaming = b;
96} 91}
97 92
98void MediaPlayerState::setIsSeekable( bool b ) { 93void MediaPlayerState::setIsSeekable( bool b ) {
99 seekable = b; 94 seekable = b;
100 emit isSeekableToggled(b); 95 emit isSeekableToggled(b);
101} 96}
102 97
103 98
104void MediaPlayerState::setFullscreen( bool b ) { 99void MediaPlayerState::setFullscreen( bool b ) {
105 if ( fullscreen == b ) { 100 if ( fullscreen == b ) {
106 return; 101 return;
107 } 102 }
108 fullscreen = b; 103 fullscreen = b;
109 emit fullscreenToggled(b); 104 emit fullscreenToggled(b);
110} 105}
111 106
112 107
113void MediaPlayerState::setBlanked( bool b ) { 108void MediaPlayerState::setBlanked( bool b ) {
114 if ( blanked == b ) { 109 if ( blanked == b ) {
115 return; 110 return;
116 } 111 }
117 blanked = b; 112 blanked = b;
118 emit blankToggled(b); 113 emit blankToggled(b);
119} 114}
120 115
121 116
122void MediaPlayerState::setScaled( bool b ) { 117void MediaPlayerState::setScaled( bool b ) {
123 if ( scaled == b ) { 118 if ( scaled == b ) {
124 return; 119 return;
125 } 120 }
126 scaled = b; 121 scaled = b;
127 emit scaledToggled(b); 122 emit scaledToggled(b);
128} 123}
129 124
130void MediaPlayerState::setLooping( bool b ) { 125void MediaPlayerState::setLooping( bool b ) {
131 if ( looping == b ) { 126 if ( looping == b ) {
132 return; 127 return;
133 } 128 }
134 looping = b; 129 looping = b;
135 emit loopingToggled(b); 130 emit loopingToggled(b);
136} 131}
137 132
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp
index 08c62a2..563ccf5 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.cpp
+++ b/noncore/multimedia/opieplayer2/mediawidget.cpp
@@ -1,122 +1,121 @@
1/* 1/*
2 Copyright (C) 2002 Simon Hausmann <simon@lst.de> 2 Copyright (C) 2002 Simon Hausmann <simon@lst.de>
3 (C) 2002 Max Reiss <harlekin@handhelds.org> 3 (C) 2002 Max Reiss <harlekin@handhelds.org>
4 (C) 2002 L. Potter <ljp@llornkcor.com> 4 (C) 2002 L. Potter <ljp@llornkcor.com>
5 (C) 2002 Holger Freyther <zecke@handhelds.org> 5 (C) 2002 Holger Freyther <zecke@handhelds.org>
6 6
7 This program is free software; you can redistribute it and/or 7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public 8 modify it under the terms of the GNU General Public
9 License as published by the Free Software Foundation; either 9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version. 10 version 2 of the License, or (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details. 15 General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program; see the file COPYING. If not, write to 18 along with this program; see the file COPYING. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. 20 Boston, MA 02111-1307, USA.
21*/ 21*/
22 22
23#include <assert.h> 23#include <assert.h>
24 24
25#include "mediawidget.h" 25#include "mediawidget.h"
26#include "playlistwidget.h"
27#include "skin.h" 26#include "skin.h"
28 27
29MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name ) 28MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name )
30 : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) 29 : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList )
31{ 30{
32 connect( &mediaPlayerState, SIGNAL( displayTypeChanged(MediaPlayerState::DisplayType) ), 31 connect( &mediaPlayerState, SIGNAL( displayTypeChanged(MediaPlayerState::DisplayType) ),
33 this, SLOT( setDisplayType(MediaPlayerState::DisplayType) ) ); 32 this, SLOT( setDisplayType(MediaPlayerState::DisplayType) ) );
34 connect( &mediaPlayerState, SIGNAL( lengthChanged(long) ), 33 connect( &mediaPlayerState, SIGNAL( lengthChanged(long) ),
35 this, SLOT( setLength(long) ) ); 34 this, SLOT( setLength(long) ) );
36 connect( &mediaPlayerState, SIGNAL( playingToggled(bool) ), 35 connect( &mediaPlayerState, SIGNAL( playingToggled(bool) ),
37 this, SLOT( setPlaying(bool) ) ); 36 this, SLOT( setPlaying(bool) ) );
38 37
39 setBackgroundMode( NoBackground ); 38 setBackgroundMode( NoBackground );
40} 39}
41 40
42MediaWidget::~MediaWidget() 41MediaWidget::~MediaWidget()
43{ 42{
44} 43}
45 44
46void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, 45void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount,
47 const Skin &skin ) 46 const Skin &skin )
48{ 47{
49 buttonMask = skin.buttonMask( skinInfo, buttonCount ); 48 buttonMask = skin.buttonMask( skinInfo, buttonCount );
50 49
51 buttons.clear(); 50 buttons.clear();
52 buttons.reserve( buttonCount ); 51 buttons.reserve( buttonCount );
53 52
54 for ( uint i = 0; i < buttonCount; ++i ) { 53 for ( uint i = 0; i < buttonCount; ++i ) {
55 Button button = setupButton( skinInfo[ i ], skin ); 54 Button button = setupButton( skinInfo[ i ], skin );
56 buttons.push_back( button ); 55 buttons.push_back( button );
57 } 56 }
58} 57}
59 58
60MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin ) 59MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin )
61{ 60{
62 Button button; 61 Button button;
63 button.command = buttonInfo.command; 62 button.command = buttonInfo.command;
64 button.type = buttonInfo.type; 63 button.type = buttonInfo.type;
65 button.mask = skin.buttonMaskImage( buttonInfo.fileName ); 64 button.mask = skin.buttonMaskImage( buttonInfo.fileName );
66 65
67 return button; 66 return button;
68} 67}
69 68
70void MediaWidget::loadDefaultSkin( const GUIInfo &guiInfo ) 69void MediaWidget::loadDefaultSkin( const GUIInfo &guiInfo )
71{ 70{
72 Skin skin( guiInfo.fileNameInfix ); 71 Skin skin( guiInfo.fileNameInfix );
73 skin.setCachable( false ); 72 skin.setCachable( false );
74 loadSkin( guiInfo.buttonInfo, guiInfo.buttonCount, skin ); 73 loadSkin( guiInfo.buttonInfo, guiInfo.buttonCount, skin );
75} 74}
76 75
77void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const Skin &skin ) 76void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const Skin &skin )
78{ 77{
79 backgroundPixmap = skin.backgroundPixmap(); 78 backgroundPixmap = skin.backgroundPixmap();
80 buttonUpImage = skin.buttonUpImage(); 79 buttonUpImage = skin.buttonUpImage();
81 buttonDownImage = skin.buttonDownImage(); 80 buttonDownImage = skin.buttonDownImage();
82 81
83 setupButtons( skinInfo, buttonCount, skin ); 82 setupButtons( skinInfo, buttonCount, skin );
84} 83}
85 84
86void MediaWidget::closeEvent( QCloseEvent * ) 85void MediaWidget::closeEvent( QCloseEvent * )
87{ 86{
88 mediaPlayerState.setList(); 87 mediaPlayerState.setList();
89} 88}
90 89
91void MediaWidget::paintEvent( QPaintEvent *pe ) 90void MediaWidget::paintEvent( QPaintEvent *pe )
92{ 91{
93 QPainter p( this ); 92 QPainter p( this );
94 93
95 if ( mediaPlayerState.isFullscreen() ) { 94 if ( mediaPlayerState.isFullscreen() ) {
96 // Clear the background 95 // Clear the background
97 p.setBrush( QBrush( Qt::black ) ); 96 p.setBrush( QBrush( Qt::black ) );
98 return; 97 return;
99 } 98 }
100 99
101 QPixmap buffer( size() ); 100 QPixmap buffer( size() );
102 QPainter bufferedPainter( &buffer ); 101 QPainter bufferedPainter( &buffer );
103 bufferedPainter.drawTiledPixmap( rect(), backgroundPixmap, QPoint( 0, 0 ) ); 102 bufferedPainter.drawTiledPixmap( rect(), backgroundPixmap, QPoint( 0, 0 ) );
104 paintAllButtons( bufferedPainter ); 103 paintAllButtons( bufferedPainter );
105 p.drawPixmap( 0, 0, buffer ); 104 p.drawPixmap( 0, 0, buffer );
106} 105}
107 106
108void MediaWidget::resizeEvent( QResizeEvent *e ) 107void MediaWidget::resizeEvent( QResizeEvent *e )
109{ 108{
110 QPixmap pixUp = combineImageWithBackground( buttonUpImage, backgroundPixmap, upperLeftOfButtonMask ); 109 QPixmap pixUp = combineImageWithBackground( buttonUpImage, backgroundPixmap, upperLeftOfButtonMask );
111 QPixmap pixDn = combineImageWithBackground( buttonDownImage, backgroundPixmap, upperLeftOfButtonMask ); 110 QPixmap pixDn = combineImageWithBackground( buttonDownImage, backgroundPixmap, upperLeftOfButtonMask );
112 111
113 for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) { 112 for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) {
114 Button &button = *it; 113 Button &button = *it;
115 114
116 if ( button.mask.isNull() ) 115 if ( button.mask.isNull() )
117 continue; 116 continue;
118 button.pixUp = addMaskToPixmap( pixUp, button.mask ); 117 button.pixUp = addMaskToPixmap( pixUp, button.mask );
119 button.pixDown = addMaskToPixmap( pixDn, button.mask ); 118 button.pixDown = addMaskToPixmap( pixDn, button.mask );
120 } 119 }
121 120
122 QWidget::resizeEvent( e ); 121 QWidget::resizeEvent( e );
diff --git a/noncore/multimedia/opieplayer2/om3u.cpp b/noncore/multimedia/opieplayer2/om3u.cpp
index 69e87e7..26d5e15 100644
--- a/noncore/multimedia/opieplayer2/om3u.cpp
+++ b/noncore/multimedia/opieplayer2/om3u.cpp
@@ -1,143 +1,130 @@
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
49//extern PlayListWidget *playList; 36//extern PlayListWidget *playList;
50 37
51Om3u::Om3u( const QString &filePath, int mode) 38Om3u::Om3u( const QString &filePath, int mode)
52 : QStringList (){ 39 : QStringList (){
53qDebug("<<<<<<<new m3u "+filePath); 40qDebug("<<<<<<<new m3u "+filePath);
54 f.setName(filePath); 41 f.setName(filePath);
55 f.open(mode); 42 f.open(mode);
56} 43}
57 44
58Om3u::~Om3u(){} 45Om3u::~Om3u(){}
59 46
60void Om3u::readM3u() { 47void Om3u::readM3u() {
61// qDebug("<<<<<<reading m3u "+f.name()); 48// qDebug("<<<<<<reading m3u "+f.name());
62 QTextStream t(&f); 49 QTextStream t(&f);
63 t.setEncoding(QTextStream::UnicodeUTF8); 50 t.setEncoding(QTextStream::UnicodeUTF8);
64 QString s; 51 QString s;
65 while ( !t.atEnd() ) { 52 while ( !t.atEnd() ) {
66 s=t.readLine(); 53 s=t.readLine();
67// qDebug(s); 54// qDebug(s);
68 if( s.find( "#", 0, TRUE) == -1 ) { 55 if( s.find( "#", 0, TRUE) == -1 ) {
69 if( s.left(2) == "E:" || s.left(2) == "P:" ) { 56 if( s.left(2) == "E:" || s.left(2) == "P:" ) {
70 s = s.right( s.length() -2 ); 57 s = s.right( s.length() -2 );
71 QFileInfo f( s ); 58 QFileInfo f( s );
72 QString name = f.baseName(); 59 QString name = f.baseName();
73 name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); 60 name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 );
74 s=s.replace( QRegExp( "\\" ), "/" ); 61 s=s.replace( QRegExp( "\\" ), "/" );
75 append(s); 62 append(s);
76// qDebug(s); 63// qDebug(s);
77 } else { // is url 64 } else { // is url
78 QString name; 65 QString name;
79 name = s; 66 name = s;
80 append(name); 67 append(name);
81 } 68 }
82 } 69 }
83 } 70 }
84} 71}
85 72
86void Om3u::readPls() { //it's a pls file 73void Om3u::readPls() { //it's a pls file
87 QTextStream t( &f ); 74 QTextStream t( &f );
88 t.setEncoding(QTextStream::UnicodeUTF8); 75 t.setEncoding(QTextStream::UnicodeUTF8);
89 QString s; 76 QString s;
90 while ( !t.atEnd() ) { 77 while ( !t.atEnd() ) {
91 s = t.readLine(); 78 s = t.readLine();
92 if( s.left(4) == "File" ) { 79 if( s.left(4) == "File" ) {
93 s = s.right( s.length() - s.find("=",0,true)-1 ); 80 s = s.right( s.length() - s.find("=",0,true)-1 );
94 s = s.stripWhiteSpace(); 81 s = s.stripWhiteSpace();
95 s.replace( QRegExp( "%20" )," "); 82 s.replace( QRegExp( "%20" )," ");
96// qDebug( "adding " + s + " to playlist" ); 83// qDebug( "adding " + s + " to playlist" );
97 // numberofentries=2 84 // numberofentries=2
98 // File1=http 85 // File1=http
99 // Title 86 // Title
100 // Length 87 // Length
101 // Version 88 // Version
102 // File2=http 89 // File2=http
103 s = s.replace( QRegExp( "\\" ), "/" ); 90 s = s.replace( QRegExp( "\\" ), "/" );
104 QFileInfo f( s ); 91 QFileInfo f( s );
105 QString name = f.baseName(); 92 QString name = f.baseName();
106 if( name.left( 4 ) == "http" ) { 93 if( name.left( 4 ) == "http" ) {
107 name = s.right( s.length() - 7); 94 name = s.right( s.length() - 7);
108 } else { 95 } else {
109 name = s; 96 name = s;
110 } 97 }
111 name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); 98 name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 );
112 if( s.at( s.length() - 4) == '.') // if this is probably a file 99 if( s.at( s.length() - 4) == '.') // if this is probably a file
113 append(s); 100 append(s);
114 else { //if its a url 101 else { //if its a url
115// if( name.right( 1 ).find( '/' ) == -1) { 102// if( name.right( 1 ).find( '/' ) == -1) {
116// s += "/"; 103// s += "/";
117// } 104// }
118 append(s); 105 append(s);
119 } 106 }
120 } 107 }
121 } 108 }
122} 109}
123 110
124void Om3u::write() { //writes list to m3u file 111void Om3u::write() { //writes list to m3u file
125 QString list; 112 QString list;
126 QTextStream t(&f); 113 QTextStream t(&f);
127 t.setEncoding(QTextStream::UnicodeUTF8); 114 t.setEncoding(QTextStream::UnicodeUTF8);
128 if(count()>0) { 115 if(count()>0) {
129 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { 116 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) {
130// qDebug(*it); 117// qDebug(*it);
131 t << *it << "\n"; 118 t << *it << "\n";
132 } 119 }
133 } 120 }
134// f.close(); 121// f.close();
135} 122}
136 123
137void Om3u::add(const QString &filePath) { //adds to m3u file 124void Om3u::add(const QString &filePath) { //adds to m3u file
138 append(filePath); 125 append(filePath);
139} 126}
140 127
141void Om3u::remove(const QString &filePath) { //removes from m3u list 128void Om3u::remove(const QString &filePath) { //removes from m3u list
142 QString list, currentFile; 129 QString list, currentFile;
143 if(count()>0) { 130 if(count()>0) {
diff --git a/noncore/multimedia/opieplayer2/playlistselection.cpp b/noncore/multimedia/opieplayer2/playlistselection.cpp
index 2019b3a..015896f 100644
--- a/noncore/multimedia/opieplayer2/playlistselection.cpp
+++ b/noncore/multimedia/opieplayer2/playlistselection.cpp
@@ -1,125 +1,117 @@
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} 59}
68 60
69 61
70PlayListSelection::~PlayListSelection() { 62PlayListSelection::~PlayListSelection() {
71} 63}
72 64
73 65
74// #ifdef USE_PLAYLIST_BACKGROUND 66// #ifdef USE_PLAYLIST_BACKGROUND
75void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) { 67void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) {
76// qDebug("drawBackground"); 68// qDebug("drawBackground");
77 p->fillRect( r, QBrush( white ) ); 69 p->fillRect( r, QBrush( white ) );
78// QImage logo = Resource::loadImage( "launcher/opielogo" ); 70// QImage logo = Resource::loadImage( "launcher/opielogo" );
79// if ( !logo.isNull() ) 71// if ( !logo.isNull() )
80// p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo ); 72// p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo );
81} 73}
82// #endif 74// #endif
83 75
84 76
85void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) { 77void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) {
86 if ( event->state() == QMouseEvent::LeftButton ) { 78 if ( event->state() == QMouseEvent::LeftButton ) {
87 QListViewItem *currentItem = selectedItem(); 79 QListViewItem *currentItem = selectedItem();
88 QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) ); 80 QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) );
89 if ( currentItem && currentItem->itemAbove() == itemUnder ) 81 if ( currentItem && currentItem->itemAbove() == itemUnder )
90 moveSelectedUp(); 82 moveSelectedUp();
91 else if ( currentItem && currentItem->itemBelow() == itemUnder ) 83 else if ( currentItem && currentItem->itemBelow() == itemUnder )
92 moveSelectedDown(); 84 moveSelectedDown();
93 } 85 }
94} 86}
95 87
96 88
97const DocLnk *PlayListSelection::current() { 89const DocLnk *PlayListSelection::current() {
98 PlayListSelectionItem *item = (PlayListSelectionItem *)selectedItem(); 90 PlayListSelectionItem *item = (PlayListSelectionItem *)selectedItem();
99 if ( item ) 91 if ( item )
100 return item->file(); 92 return item->file();
101 return NULL; 93 return NULL;
102} 94}
103 95
104 96
105void PlayListSelection::addToSelection( const DocLnk &lnk ) { 97void PlayListSelection::addToSelection( const DocLnk &lnk ) {
106 PlayListSelectionItem *item = new PlayListSelectionItem( this, new DocLnk( lnk ) ); 98 PlayListSelectionItem *item = new PlayListSelectionItem( this, new DocLnk( lnk ) );
107 QListViewItem *current = selectedItem(); 99 QListViewItem *current = selectedItem();
108 if ( current ) 100 if ( current )
109 item->moveItem( current ); 101 item->moveItem( current );
110 setSelected( item, TRUE ); 102 setSelected( item, TRUE );
111 ensureItemVisible( selectedItem() ); 103 ensureItemVisible( selectedItem() );
112} 104}
113 105
114 106
115void PlayListSelection::removeSelected() { 107void PlayListSelection::removeSelected() {
116 QListViewItem *item = selectedItem(); 108 QListViewItem *item = selectedItem();
117 delete item; 109 delete item;
118 setSelected( currentItem(), TRUE ); 110 setSelected( currentItem(), TRUE );
119 ensureItemVisible( selectedItem() ); 111 ensureItemVisible( selectedItem() );
120} 112}
121 113
122 114
123void PlayListSelection::moveSelectedUp() { 115void PlayListSelection::moveSelectedUp() {
124 QListViewItem *item = selectedItem(); 116 QListViewItem *item = selectedItem();
125 if ( item && item->itemAbove() ) 117 if ( item && item->itemAbove() )
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 0a84268..84aba55 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -1,139 +1,138 @@
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,2003 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002,2003 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; General Public License for more 22..}^=.=       =       ; General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = General Public License along with 26  -_. . .   )=.  = General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34#include <qtoolbar.h> 34#include <qtoolbar.h>
35 35
36#include <opie/ofiledialog.h> 36#include <opie/ofiledialog.h>
37 37
38#include <qmessagebox.h> 38#include <qmessagebox.h>
39 39
40#include "playlistselection.h" 40#include "playlistselection.h"
41#include "playlistwidget.h" 41#include "playlistwidget.h"
42#include "mediaplayer.h" 42#include "mediaplayer.h"
43#include "mediaplayerstate.h"
44#include "inputDialog.h" 43#include "inputDialog.h"
45#include "om3u.h" 44#include "om3u.h"
46#include "playlistfileview.h" 45#include "playlistfileview.h"
47 46
48//only needed for the random play 47//only needed for the random play
49#include <assert.h> 48#include <assert.h>
50 49
51PlayListWidget::PlayListWidget(QWidget* parent, const char* name, WFlags fl ) 50PlayListWidget::PlayListWidget(QWidget* parent, const char* name, WFlags fl )
52 : PlayListWidgetGui( parent, "playList" ) , currentFileListView( 0 ) 51 : PlayListWidgetGui( parent, "playList" ) , currentFileListView( 0 )
53{ 52{
54 mediaPlayerState = new MediaPlayerState(0, "mediaPlayerState" ); 53 mediaPlayerState = new MediaPlayerState(0, "mediaPlayerState" );
55 m_mp = new MediaPlayer(*this, *mediaPlayerState, 0, "mediaPlayer"); 54 m_mp = new MediaPlayer(*this, *mediaPlayerState, 0, "mediaPlayer");
56 55
57 56
58 57
59 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), 58 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ),
60 "opieplayer2/add_to_playlist", 59 "opieplayer2/add_to_playlist",
61 this , SLOT(addSelected() ) ); 60 this , SLOT(addSelected() ) );
62 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), 61 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ),
63 "opieplayer2/remove_from_playlist", 62 "opieplayer2/remove_from_playlist",
64 this , SLOT(removeSelected() ) ); 63 this , SLOT(removeSelected() ) );
65 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", 64 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play",
66 this , SLOT( btnPlay(bool) ), TRUE ); 65 this , SLOT( btnPlay(bool) ), TRUE );
67 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", 66 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle",
68 mediaPlayerState, SLOT( setShuffled(bool) ), TRUE ); 67 mediaPlayerState, SLOT( setShuffled(bool) ), TRUE );
69 d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop", 68 d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop",
70 mediaPlayerState, SLOT( setLooping(bool) ), TRUE ); 69 mediaPlayerState, SLOT( setLooping(bool) ), TRUE );
71 70
72 (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); 71 (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) );
73 (void)new MenuItem( pmPlayList, tr( "Add all audio files" ), 72 (void)new MenuItem( pmPlayList, tr( "Add all audio files" ),
74 this, SLOT( addAllMusicToList() ) ); 73 this, SLOT( addAllMusicToList() ) );
75 (void)new MenuItem( pmPlayList, tr( "Add all video files" ), 74 (void)new MenuItem( pmPlayList, tr( "Add all video files" ),
76 this, SLOT( addAllVideoToList() ) ); 75 this, SLOT( addAllVideoToList() ) );
77 (void)new MenuItem( pmPlayList, tr( "Add all files" ), 76 (void)new MenuItem( pmPlayList, tr( "Add all files" ),
78 this, SLOT( addAllToList() ) ); 77 this, SLOT( addAllToList() ) );
79 pmPlayList->insertSeparator(-1); 78 pmPlayList->insertSeparator(-1);
80 (void)new MenuItem( pmPlayList, tr( "Add File" ), 79 (void)new MenuItem( pmPlayList, tr( "Add File" ),
81 this,SLOT( openFile() ) ); 80 this,SLOT( openFile() ) );
82 (void)new MenuItem( pmPlayList, tr("Add URL"), 81 (void)new MenuItem( pmPlayList, tr("Add URL"),
83 this,SLOT( openURL() ) ); 82 this,SLOT( openURL() ) );
84 pmPlayList->insertSeparator(-1); 83 pmPlayList->insertSeparator(-1);
85 (void)new MenuItem( pmPlayList, tr( "Save Playlist" ), 84 (void)new MenuItem( pmPlayList, tr( "Save Playlist" ),
86 this, SLOT(writem3u() ) ); 85 this, SLOT(writem3u() ) );
87 pmPlayList->insertSeparator(-1); 86 pmPlayList->insertSeparator(-1);
88 (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), 87 (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ),
89 audioView, SLOT( scanFiles() ) ); 88 audioView, SLOT( scanFiles() ) );
90 (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), 89 (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ),
91 videoView, SLOT( scanFiles() ) ); 90 videoView, SLOT( scanFiles() ) );
92 91
93 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), 92 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"),
94 mediaPlayerState, SLOT( toggleFullscreen() ) ); 93 mediaPlayerState, SLOT( toggleFullscreen() ) );
95 94
96 Config cfg( "OpiePlayer" ); 95 Config cfg( "OpiePlayer" );
97 bool b= cfg.readBoolEntry("FullScreen", 0); 96 bool b= cfg.readBoolEntry("FullScreen", 0);
98 mediaPlayerState->setFullscreen( b ); 97 mediaPlayerState->setFullscreen( b );
99 pmView->setItemChecked( -16, b ); 98 pmView->setItemChecked( -16, b );
100 99
101 (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", 100 (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up",
102 d->selectedFiles, SLOT(moveSelectedUp() ) ); 101 d->selectedFiles, SLOT(moveSelectedUp() ) );
103 (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", 102 (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut",
104 d->selectedFiles, SLOT(removeSelected() ) ); 103 d->selectedFiles, SLOT(removeSelected() ) );
105 (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", 104 (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down",
106 d->selectedFiles, SLOT(moveSelectedDown() ) ); 105 d->selectedFiles, SLOT(moveSelectedDown() ) );
107 QVBox *stretch2 = new QVBox( vbox1 ); 106 QVBox *stretch2 = new QVBox( vbox1 );
108 107
109 connect( tbDeletePlaylist, ( SIGNAL( released() ) ), 108 connect( tbDeletePlaylist, ( SIGNAL( released() ) ),
110 SLOT( deletePlaylist() ) ); 109 SLOT( deletePlaylist() ) );
111 connect( pmView, SIGNAL( activated(int) ), 110 connect( pmView, SIGNAL( activated(int) ),
112 this, SLOT( pmViewActivated(int) ) ); 111 this, SLOT( pmViewActivated(int) ) );
113 connect( skinsMenu, SIGNAL( activated(int) ) , 112 connect( skinsMenu, SIGNAL( activated(int) ) ,
114 this, SLOT( skinsMenuActivated(int) ) ); 113 this, SLOT( skinsMenuActivated(int) ) );
115 connect( d->selectedFiles, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ), 114 connect( d->selectedFiles, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),
116 this,SLOT( playlistViewPressed(int,QListViewItem*,const QPoint&,int) ) ); 115 this,SLOT( playlistViewPressed(int,QListViewItem*,const QPoint&,int) ) );
117 connect( audioView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ), 116 connect( audioView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),
118 this,SLOT( viewPressed(int,QListViewItem*,const QPoint&,int) ) ); 117 this,SLOT( viewPressed(int,QListViewItem*,const QPoint&,int) ) );
119 connect( audioView, SIGNAL( returnPressed(QListViewItem*) ), 118 connect( audioView, SIGNAL( returnPressed(QListViewItem*) ),
120 this,SLOT( playIt(QListViewItem*) ) ); 119 this,SLOT( playIt(QListViewItem*) ) );
121 connect( audioView, SIGNAL( doubleClicked(QListViewItem*) ), 120 connect( audioView, SIGNAL( doubleClicked(QListViewItem*) ),
122 this, SLOT( addToSelection(QListViewItem*) ) ); 121 this, SLOT( addToSelection(QListViewItem*) ) );
123 connect( videoView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ), 122 connect( videoView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),
124 this,SLOT( viewPressed(int,QListViewItem*,const QPoint&,int) ) ); 123 this,SLOT( viewPressed(int,QListViewItem*,const QPoint&,int) ) );
125 connect( videoView, SIGNAL( returnPressed(QListViewItem*) ), 124 connect( videoView, SIGNAL( returnPressed(QListViewItem*) ),
126 this,SLOT( playIt(QListViewItem*) ) ); 125 this,SLOT( playIt(QListViewItem*) ) );
127 connect( videoView, SIGNAL( doubleClicked(QListViewItem*) ), 126 connect( videoView, SIGNAL( doubleClicked(QListViewItem*) ),
128 this, SLOT( addToSelection(QListViewItem*) ) ); 127 this, SLOT( addToSelection(QListViewItem*) ) );
129 connect( playLists, SIGNAL( fileSelected(const DocLnk&) ), 128 connect( playLists, SIGNAL( fileSelected(const DocLnk&) ),
130 this, SLOT( loadList(const DocLnk&) ) ); 129 this, SLOT( loadList(const DocLnk&) ) );
131 connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), 130 connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ),
132 this, SLOT( tabChanged(QWidget*) ) ); 131 this, SLOT( tabChanged(QWidget*) ) );
133 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), 132 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ),
134 d->tbPlay, SLOT( setOn(bool) ) ); 133 d->tbPlay, SLOT( setOn(bool) ) );
135 connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), 134 connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ),
136 d->tbLoop, SLOT( setOn(bool) ) ); 135 d->tbLoop, SLOT( setOn(bool) ) );
137 connect( mediaPlayerState, SIGNAL( shuffledToggled(bool) ), 136 connect( mediaPlayerState, SIGNAL( shuffledToggled(bool) ),
138 d->tbShuffle, SLOT( setOn(bool) ) ); 137 d->tbShuffle, SLOT( setOn(bool) ) );
139 connect( d->selectedFiles, SIGNAL( doubleClicked(QListViewItem*) ), 138 connect( d->selectedFiles, SIGNAL( doubleClicked(QListViewItem*) ),
diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
index 33fe188..2ff190d 100644
--- a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
@@ -1,143 +1,142 @@
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 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; General Public License for more 22..}^=.=       =       ; General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = General Public License along with 26  -_. . .   )=.  = General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34 34
35#include <qtoolbar.h> 35#include <qtoolbar.h>
36#include <qpe/qpeapplication.h> 36#include <qpe/qpeapplication.h>
37 37
38#include <qlayout.h> 38#include <qlayout.h>
39#include <qmenubar.h> 39#include <qmenubar.h>
40 40
41#include "playlistselection.h" 41#include "playlistselection.h"
42#include "playlistwidget.h" 42#include "playlistwidget.h"
43#include "mediaplayerstate.h" 43#include "mediaplayerstate.h"
44#include "inputDialog.h" 44#include "inputDialog.h"
45#include "playlistfileview.h" 45#include "playlistfileview.h"
46 46
47#include "mediaplayerstate.h"
48 47
49PlayListWidgetGui::PlayListWidgetGui(QWidget* parent, const char* name ) 48PlayListWidgetGui::PlayListWidgetGui(QWidget* parent, const char* name )
50 : QMainWindow( parent, name ) { 49 : QMainWindow( parent, name ) {
51 50
52 d = new PlayListWidgetPrivate; 51 d = new PlayListWidgetPrivate;
53 d->setDocumentUsed = FALSE; 52 d->setDocumentUsed = FALSE;
54 53
55 setBackgroundMode( PaletteButton ); 54 setBackgroundMode( PaletteButton );
56 setToolBarsMovable( FALSE ); 55 setToolBarsMovable( FALSE );
57 56
58 // Create Toolbar 57 // Create Toolbar
59 QToolBar *toolbar = new QToolBar( this ); 58 QToolBar *toolbar = new QToolBar( this );
60 toolbar->setHorizontalStretchable( TRUE ); 59 toolbar->setHorizontalStretchable( TRUE );
61 60
62 // Create Menubar 61 // Create Menubar
63 QMenuBar *menu = new QMenuBar( toolbar ); 62 QMenuBar *menu = new QMenuBar( toolbar );
64 menu->setMargin( 0 ); 63 menu->setMargin( 0 );
65 64
66 bar = new QToolBar( this ); 65 bar = new QToolBar( this );
67 bar->setLabel( tr( "Play Operations" ) ); 66 bar->setLabel( tr( "Play Operations" ) );
68 67
69 tbDeletePlaylist = new QPushButton( Resource::loadIconSet( "trash" ), "", bar, "close" ); 68 tbDeletePlaylist = new QPushButton( Resource::loadIconSet( "trash" ), "", bar, "close" );
70 tbDeletePlaylist->setFlat( TRUE ); 69 tbDeletePlaylist->setFlat( TRUE );
71 tbDeletePlaylist->setFixedSize( 20, 20 ); 70 tbDeletePlaylist->setFixedSize( 20, 20 );
72 71
73 tbDeletePlaylist->hide(); 72 tbDeletePlaylist->hide();
74 73
75 pmPlayList = new QPopupMenu( this ); 74 pmPlayList = new QPopupMenu( this );
76 menu->insertItem( tr( "File" ), pmPlayList ); 75 menu->insertItem( tr( "File" ), pmPlayList );
77 76
78 pmView = new QPopupMenu( this ); 77 pmView = new QPopupMenu( this );
79 menu->insertItem( tr( "View" ), pmView ); 78 menu->insertItem( tr( "View" ), pmView );
80 pmView->isCheckable(); 79 pmView->isCheckable();
81 80
82 skinsMenu = new QPopupMenu( this ); 81 skinsMenu = new QPopupMenu( this );
83 pmView->insertItem( tr( "Skins" ), skinsMenu ); 82 pmView->insertItem( tr( "Skins" ), skinsMenu );
84 skinsMenu->isCheckable(); 83 skinsMenu->isCheckable();
85 84
86 gammaMenu = new QPopupMenu( this ); 85 gammaMenu = new QPopupMenu( this );
87 pmView->insertItem( tr( "Gamma (Video)" ), gammaMenu ); 86 pmView->insertItem( tr( "Gamma (Video)" ), gammaMenu );
88 87
89 gammaSlider = new QSlider( QSlider::Vertical, gammaMenu ); 88 gammaSlider = new QSlider( QSlider::Vertical, gammaMenu );
90 gammaSlider->setRange( -40, 40 ); 89 gammaSlider->setRange( -40, 40 );
91 gammaSlider->setTickmarks( QSlider::Left ); 90 gammaSlider->setTickmarks( QSlider::Left );
92 gammaSlider->setTickInterval( 20 ); 91 gammaSlider->setTickInterval( 20 );
93 gammaSlider->setFocusPolicy( QWidget::StrongFocus ); 92 gammaSlider->setFocusPolicy( QWidget::StrongFocus );
94 gammaSlider->setValue( 0 ); 93 gammaSlider->setValue( 0 );
95 gammaSlider->setMinimumHeight( 50 ); 94 gammaSlider->setMinimumHeight( 50 );
96 95
97 gammaLCD = new QLCDNumber( 3, gammaMenu ); 96 gammaLCD = new QLCDNumber( 3, gammaMenu );
98 gammaLCD-> setFrameShape ( QFrame::NoFrame ); 97 gammaLCD-> setFrameShape ( QFrame::NoFrame );
99 gammaLCD-> setSegmentStyle ( QLCDNumber::Flat ); 98 gammaLCD-> setSegmentStyle ( QLCDNumber::Flat );
100 99
101 gammaMenu->insertItem( gammaSlider ); 100 gammaMenu->insertItem( gammaSlider );
102 gammaMenu->insertItem( gammaLCD ); 101 gammaMenu->insertItem( gammaLCD );
103 102
104 connect( gammaSlider, SIGNAL( valueChanged(int) ), gammaLCD, SLOT( display(int) ) ); 103 connect( gammaSlider, SIGNAL( valueChanged(int) ), gammaLCD, SLOT( display(int) ) );
105 104
106 vbox5 = new QVBox( this ); 105 vbox5 = new QVBox( this );
107 QVBox *vbox4 = new QVBox( vbox5 ); 106 QVBox *vbox4 = new QVBox( vbox5 );
108 QHBox *hbox6 = new QHBox( vbox4 ); 107 QHBox *hbox6 = new QHBox( vbox4 );
109 108
110 tabWidget = new QTabWidget( hbox6, "tabWidget" ); 109 tabWidget = new QTabWidget( hbox6, "tabWidget" );
111 110
112 playListTab = new QWidget( tabWidget, "PlayListTab" ); 111 playListTab = new QWidget( tabWidget, "PlayListTab" );
113 tabWidget->insertTab( playListTab, "Playlist"); 112 tabWidget->insertTab( playListTab, "Playlist");
114 113
115 QGridLayout *Playout = new QGridLayout( playListTab ); 114 QGridLayout *Playout = new QGridLayout( playListTab );
116 Playout->setSpacing( 2); 115 Playout->setSpacing( 2);
117 Playout->setMargin( 2); 116 Playout->setMargin( 2);
118 117
119 // Add the playlist area 118 // Add the playlist area
120 QVBox *vbox3 = new QVBox( playListTab ); 119 QVBox *vbox3 = new QVBox( playListTab );
121 d->playListFrame = vbox3; 120 d->playListFrame = vbox3;
122 121
123 QHBox *hbox2 = new QHBox( vbox3 ); 122 QHBox *hbox2 = new QHBox( vbox3 );
124 d->selectedFiles = new PlayListSelection( hbox2 ); 123 d->selectedFiles = new PlayListSelection( hbox2 );
125 124
126 vbox1 = new QVBox( hbox2 ); 125 vbox1 = new QVBox( hbox2 );
127 QPEApplication::setStylusOperation( d->selectedFiles->viewport(), QPEApplication::RightOnHold ); 126 QPEApplication::setStylusOperation( d->selectedFiles->viewport(), QPEApplication::RightOnHold );
128 QVBox *stretch1 = new QVBox( vbox1 ); // add stretch 127 QVBox *stretch1 = new QVBox( vbox1 ); // add stretch
129 128
130 Playout->addMultiCellWidget( vbox3, 0, 0, 0, 1 ); 129 Playout->addMultiCellWidget( vbox3, 0, 0, 0, 1 );
131 130
132 QWidget *aTab; 131 QWidget *aTab;
133 aTab = new QWidget( tabWidget, "aTab" ); 132 aTab = new QWidget( tabWidget, "aTab" );
134 133
135 QGridLayout *Alayout = new QGridLayout( aTab ); 134 QGridLayout *Alayout = new QGridLayout( aTab );
136 Alayout->setSpacing( 2 ); 135 Alayout->setSpacing( 2 );
137 Alayout->setMargin( 2 ); 136 Alayout->setMargin( 2 );
138 // no m3u's here please 137 // no m3u's here please
139 audioView = new PlayListFileView( "audio/mpeg;audio/x-wav;application/ogg", "opieplayer2/musicfile", aTab, "Audioview" ); 138 audioView = new PlayListFileView( "audio/mpeg;audio/x-wav;application/ogg", "opieplayer2/musicfile", aTab, "Audioview" );
140 Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 ); 139 Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 );
141 tabWidget->insertTab( aTab, tr( "Audio" ) ); 140 tabWidget->insertTab( aTab, tr( "Audio" ) );
142 141
143 QPEApplication::setStylusOperation( audioView->viewport(), QPEApplication::RightOnHold ); 142 QPEApplication::setStylusOperation( audioView->viewport(), QPEApplication::RightOnHold );
diff --git a/noncore/multimedia/opieplayer2/skin.cpp b/noncore/multimedia/opieplayer2/skin.cpp
index 742e495..7c38983 100644
--- a/noncore/multimedia/opieplayer2/skin.cpp
+++ b/noncore/multimedia/opieplayer2/skin.cpp
@@ -1,126 +1,124 @@
1/* 1/*
2 Copyright (C) 2002 Simon Hausmann <simon@lst.de> 2 Copyright (C) 2002 Simon Hausmann <simon@lst.de>
3 (C) 2002 Max Reiss <harlekin@handhelds.org> 3 (C) 2002 Max Reiss <harlekin@handhelds.org>
4 (C) 2002 L. Potter <ljp@llornkcor.com> 4 (C) 2002 L. Potter <ljp@llornkcor.com>
5 (C) 2002 Holger Freyther <zecke@handhelds.org> 5 (C) 2002 Holger Freyther <zecke@handhelds.org>
6 6
7 This program is free software; you can redistribute it and/or 7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public 8 modify it under the terms of the GNU General Public
9 License as published by the Free Software Foundation; either 9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version. 10 version 2 of the License, or (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details. 15 General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program; see the file COPYING. If not, write to 18 along with this program; see the file COPYING. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. 20 Boston, MA 02111-1307, USA.
21*/ 21*/
22 22
23#include "skin.h" 23#include "skin.h"
24#include "singleton.h" 24#include "singleton.h"
25 25
26#include <qcache.h> 26#include <qcache.h>
27#include <qmap.h>
28#include <qtimer.h> 27#include <qtimer.h>
29 28
30#include <qpe/resource.h>
31#include <qpe/config.h> 29#include <qpe/config.h>
32 30
33#include <assert.h> 31#include <assert.h>
34 32
35struct SkinData 33struct SkinData
36{ 34{
37 typedef QMap<QString, QImage> ButtonMaskImageMap; 35 typedef QMap<QString, QImage> ButtonMaskImageMap;
38 36
39 QPixmap backgroundPixmap; 37 QPixmap backgroundPixmap;
40 QImage buttonUpImage; 38 QImage buttonUpImage;
41 QImage buttonDownImage; 39 QImage buttonDownImage;
42 QImage buttonMask; 40 QImage buttonMask;
43 ButtonMaskImageMap buttonMasks; 41 ButtonMaskImageMap buttonMasks;
44}; 42};
45 43
46class SkinCache : public Singleton<SkinCache> 44class SkinCache : public Singleton<SkinCache>
47{ 45{
48public: 46public:
49 SkinCache(); 47 SkinCache();
50 48
51 SkinData *lookupAndTake( const QString &skinPath, const QString &fileNameInfix ); 49 SkinData *lookupAndTake( const QString &skinPath, const QString &fileNameInfix );
52 50
53 void store( const QString &skinPath, const QString &fileNameInfix, SkinData *data ); 51 void store( const QString &skinPath, const QString &fileNameInfix, SkinData *data );
54 52
55private: 53private:
56 typedef QCache<SkinData> DataCache; 54 typedef QCache<SkinData> DataCache;
57 typedef QCache<QPixmap> BackgroundPixmapCache; 55 typedef QCache<QPixmap> BackgroundPixmapCache;
58 56
59 template <class CacheType> 57 template <class CacheType>
60 void store( const QCache<CacheType> &cache, const QString &key, CacheType *data ); 58 void store( const QCache<CacheType> &cache, const QString &key, CacheType *data );
61 59
62 DataCache m_cache; 60 DataCache m_cache;
63 BackgroundPixmapCache m_backgroundPixmapCache; 61 BackgroundPixmapCache m_backgroundPixmapCache;
64}; 62};
65 63
66Skin::Skin( const QString &name, const QString &fileNameInfix ) 64Skin::Skin( const QString &name, const QString &fileNameInfix )
67 : m_fileNameInfix( fileNameInfix ) 65 : m_fileNameInfix( fileNameInfix )
68{ 66{
69 init( name ); 67 init( name );
70} 68}
71 69
72Skin::Skin( const QString &fileNameInfix ) 70Skin::Skin( const QString &fileNameInfix )
73 : m_fileNameInfix( fileNameInfix ) 71 : m_fileNameInfix( fileNameInfix )
74{ 72{
75 init( defaultSkinName() ); 73 init( defaultSkinName() );
76} 74}
77 75
78Skin::~Skin() 76Skin::~Skin()
79{ 77{
80 if ( m_isCachable ) 78 if ( m_isCachable )
81 SkinCache::self().store( m_skinPath, m_fileNameInfix, d ); 79 SkinCache::self().store( m_skinPath, m_fileNameInfix, d );
82 else 80 else
83 delete d; 81 delete d;
84} 82}
85 83
86void Skin::init( const QString &name ) 84void Skin::init( const QString &name )
87{ 85{
88 m_isCachable = true; 86 m_isCachable = true;
89 m_skinPath = "opieplayer2/skins/" + name; 87 m_skinPath = "opieplayer2/skins/" + name;
90 d = SkinCache::self().lookupAndTake( m_skinPath, m_fileNameInfix ); 88 d = SkinCache::self().lookupAndTake( m_skinPath, m_fileNameInfix );
91} 89}
92 90
93QPixmap Skin::backgroundPixmap() const 91QPixmap Skin::backgroundPixmap() const
94{ 92{
95 if ( d->backgroundPixmap.isNull() ) 93 if ( d->backgroundPixmap.isNull() )
96 d->backgroundPixmap = loadImage( QString( "%1/background" ).arg( m_skinPath ) ); 94 d->backgroundPixmap = loadImage( QString( "%1/background" ).arg( m_skinPath ) );
97 return d->backgroundPixmap; 95 return d->backgroundPixmap;
98} 96}
99 97
100QImage Skin::buttonUpImage() const 98QImage Skin::buttonUpImage() const
101{ 99{
102 if ( d->buttonUpImage.isNull() ) 100 if ( d->buttonUpImage.isNull() )
103 d->buttonUpImage = loadImage( QString( "%1/skin%2_up" ).arg( m_skinPath ).arg( m_fileNameInfix ) ); 101 d->buttonUpImage = loadImage( QString( "%1/skin%2_up" ).arg( m_skinPath ).arg( m_fileNameInfix ) );
104 return d->buttonUpImage; 102 return d->buttonUpImage;
105} 103}
106 104
107QImage Skin::buttonDownImage() const 105QImage Skin::buttonDownImage() const
108{ 106{
109 if ( d->buttonDownImage.isNull() ) 107 if ( d->buttonDownImage.isNull() )
110 d->buttonDownImage = loadImage( QString( "%1/skin%2_down" ).arg( m_skinPath ).arg( m_fileNameInfix ) ); 108 d->buttonDownImage = loadImage( QString( "%1/skin%2_down" ).arg( m_skinPath ).arg( m_fileNameInfix ) );
111 return d->buttonDownImage; 109 return d->buttonDownImage;
112} 110}
113 111
114QImage Skin::buttonMask( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount ) const 112QImage Skin::buttonMask( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount ) const
115{ 113{
116 if ( !d->buttonMask.isNull() ) 114 if ( !d->buttonMask.isNull() )
117 return d->buttonMask; 115 return d->buttonMask;
118 116
119 QSize buttonAreaSize = buttonUpImage().size(); 117 QSize buttonAreaSize = buttonUpImage().size();
120 118
121 d->buttonMask = QImage( buttonAreaSize, 8, 255 ); 119 d->buttonMask = QImage( buttonAreaSize, 8, 255 );
122 d->buttonMask.fill( 0 ); 120 d->buttonMask.fill( 0 );
123 121
124 for ( uint i = 0; i < buttonCount; ++i ) 122 for ( uint i = 0; i < buttonCount; ++i )
125 addButtonToMask( skinButtonInfo[ i ].command + 1, buttonMaskImage( skinButtonInfo[ i ].fileName ) ); 123 addButtonToMask( skinButtonInfo[ i ].command + 1, buttonMaskImage( skinButtonInfo[ i ].fileName ) );
126 124
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index a4d09f5..0625376 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -1,132 +1,130 @@
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 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; Library General Public License for more 22..}^=.=       =       ; Library General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = Library General Public License along with 26  -_. . .   )=.  = Library General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34#include "videowidget.h" 34#include "videowidget.h"
35#include "mediaplayerstate.h"
36#include "playlistwidget.h"
37 35
38 36
39#ifdef Q_WS_QWS 37#ifdef Q_WS_QWS
40# define USE_DIRECT_PAINTER 38# define USE_DIRECT_PAINTER
41# include <qdirectpainter_qws.h> 39# include <qdirectpainter_qws.h>
42# include <qgfxraster_qws.h> 40# include <qgfxraster_qws.h>
43#endif 41#endif
44 42
45 43
46namespace 44namespace
47{ 45{
48 46
49const int xo = 2; // movable x offset 47const int xo = 2; // movable x offset
50const int yo = 0; // movable y offset 48const int yo = 0; // movable y offset
51 49
52const MediaWidget::SkinButtonInfo skinInfo[] = 50const MediaWidget::SkinButtonInfo skinInfo[] =
53{ 51{
54 { MediaWidget::Play, "play", MediaWidget::ToggleButton }, 52 { MediaWidget::Play, "play", MediaWidget::ToggleButton },
55 { MediaWidget::Stop, "stop", MediaWidget::NormalButton }, 53 { MediaWidget::Stop, "stop", MediaWidget::NormalButton },
56 { MediaWidget::Next, "fwd", MediaWidget::NormalButton }, 54 { MediaWidget::Next, "fwd", MediaWidget::NormalButton },
57 { MediaWidget::Previous, "back", MediaWidget::NormalButton }, 55 { MediaWidget::Previous, "back", MediaWidget::NormalButton },
58 { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton }, 56 { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton },
59 { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton }, 57 { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton },
60 { MediaWidget::FullScreen, "full", MediaWidget::ToggleButton } 58 { MediaWidget::FullScreen, "full", MediaWidget::ToggleButton }
61}; 59};
62 60
63const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] ); 61const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] );
64 62
65} 63}
66 64
67VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) 65VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name )
68 : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ), videoSliderBeingMoved( false ) 66 : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ), videoSliderBeingMoved( false )
69{ 67{
70 setCaption( tr("OpiePlayer - Video") ); 68 setCaption( tr("OpiePlayer - Video") );
71 69
72 videoFrame = new XineVideoWidget ( this, "Video frame" ); 70 videoFrame = new XineVideoWidget ( this, "Video frame" );
73 71
74 connect ( videoFrame, SIGNAL( videoResized(const QSize&)), this, SIGNAL( videoResized(const QSize&))); 72 connect ( videoFrame, SIGNAL( videoResized(const QSize&)), this, SIGNAL( videoResized(const QSize&)));
75 connect ( videoFrame, SIGNAL( clicked() ), this, SLOT ( backToNormal() ) ); 73 connect ( videoFrame, SIGNAL( clicked() ), this, SLOT ( backToNormal() ) );
76 74
77 slider = 0; 75 slider = 0;
78 76
79 loadSkin(); 77 loadSkin();
80 78
81 setLength( mediaPlayerState.length() ); 79 setLength( mediaPlayerState.length() );
82 setPosition( mediaPlayerState.position() ); 80 setPosition( mediaPlayerState.position() );
83 setFullscreen( mediaPlayerState.isFullscreen() ); 81 setFullscreen( mediaPlayerState.isFullscreen() );
84 setPlaying( mediaPlayerState.isPlaying() ); 82 setPlaying( mediaPlayerState.isPlaying() );
85} 83}
86 84
87 85
88VideoWidget::~VideoWidget() 86VideoWidget::~VideoWidget()
89{ 87{
90} 88}
91 89
92MediaWidget::GUIInfo VideoWidget::guiInfo() 90MediaWidget::GUIInfo VideoWidget::guiInfo()
93{ 91{
94 return GUIInfo( "V" /* infix */, ::skinInfo, ::buttonCount ); 92 return GUIInfo( "V" /* infix */, ::skinInfo, ::buttonCount );
95} 93}
96 94
97void VideoWidget::resizeEvent( QResizeEvent *e ) { 95void VideoWidget::resizeEvent( QResizeEvent *e ) {
98 int h = height(); 96 int h = height();
99 int w = width(); 97 int w = width();
100 //int Vh = 160; 98 //int Vh = 160;
101 //int Vw = 220; 99 //int Vw = 220;
102 100
103 slider->setFixedWidth( w - 20 ); 101 slider->setFixedWidth( w - 20 );
104 slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); 102 slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) );
105 slider->setBackgroundOrigin( QWidget::ParentOrigin ); 103 slider->setBackgroundOrigin( QWidget::ParentOrigin );
106 slider->setFocusPolicy( QWidget::NoFocus ); 104 slider->setFocusPolicy( QWidget::NoFocus );
107 slider->setBackgroundPixmap( backgroundPixmap ); 105 slider->setBackgroundPixmap( backgroundPixmap );
108 106
109 upperLeftOfButtonMask.rx() = 0;// ( imgUp->width() ) / 2; 107 upperLeftOfButtonMask.rx() = 0;// ( imgUp->width() ) / 2;
110 if(w>h) 108 if(w>h)
111 upperLeftOfButtonMask.ry() = 0; 109 upperLeftOfButtonMask.ry() = 0;
112 else 110 else
113 upperLeftOfButtonMask.ry() = 185;//(( Vh - imgUp->height() ) / 2) - 10; 111 upperLeftOfButtonMask.ry() = 185;//(( Vh - imgUp->height() ) / 2) - 10;
114 112
115 MediaWidget::resizeEvent( e ); 113 MediaWidget::resizeEvent( e );
116} 114}
117 115
118void VideoWidget::sliderPressed() { 116void VideoWidget::sliderPressed() {
119 videoSliderBeingMoved = TRUE; 117 videoSliderBeingMoved = TRUE;
120} 118}
121 119
122void VideoWidget::sliderReleased() { 120void VideoWidget::sliderReleased() {
123 videoSliderBeingMoved = FALSE; 121 videoSliderBeingMoved = FALSE;
124 if ( slider->width() == 0 ) { 122 if ( slider->width() == 0 ) {
125 return; 123 return;
126 } 124 }
127 long val = long((double)slider->value() * mediaPlayerState.length() / slider->width()); 125 long val = long((double)slider->value() * mediaPlayerState.length() / slider->width());
128 mediaPlayerState.setPosition( val ); 126 mediaPlayerState.setPosition( val );
129} 127}
130 128
131void VideoWidget::setPosition( long i ) { 129void VideoWidget::setPosition( long i ) {
132 updateSlider( i, mediaPlayerState.length() ); 130 updateSlider( i, mediaPlayerState.length() );
diff --git a/noncore/multimedia/opieplayer2/volumecontrol.cpp b/noncore/multimedia/opieplayer2/volumecontrol.cpp
index 271b84e..b3f5f8d 100644
--- a/noncore/multimedia/opieplayer2/volumecontrol.cpp
+++ b/noncore/multimedia/opieplayer2/volumecontrol.cpp
@@ -1,61 +1,59 @@
1 1
2#include <qpe/qpeapplication.h>
3#include <qpe/config.h> 2#include <qpe/config.h>
4#include "qpe/qcopenvelope_qws.h" 3#include "qpe/qcopenvelope_qws.h"
5#include <qmessagebox.h>
6 4
7#include "volumecontrol.h" 5#include "volumecontrol.h"
8 6
9int VolumeControl::volume() { 7int VolumeControl::volume() {
10 Config cfg( "qpe" ); 8 Config cfg( "qpe" );
11 cfg. setGroup( "Volume" ); 9 cfg. setGroup( "Volume" );
12 m_volumePerc = cfg. readNumEntry( "VolumePercent", 50 ); 10 m_volumePerc = cfg. readNumEntry( "VolumePercent", 50 );
13 11
14 return m_volumePerc; 12 return m_volumePerc;
15} 13}
16 14
17 15
18void VolumeControl::setVolume( int volumePerc ) { 16void VolumeControl::setVolume( int volumePerc ) {
19 Config cfg("qpe"); 17 Config cfg("qpe");
20 cfg.setGroup("Volume"); 18 cfg.setGroup("Volume");
21 19
22 if ( volumePerc > 100 ) { 20 if ( volumePerc > 100 ) {
23 volumePerc = 100; 21 volumePerc = 100;
24 } 22 }
25 if ( volumePerc < 0 ) { 23 if ( volumePerc < 0 ) {
26 volumePerc = 0; 24 volumePerc = 0;
27 } 25 }
28 26
29 m_volumePerc = volumePerc; 27 m_volumePerc = volumePerc;
30 cfg.writeEntry("VolumePercent", volumePerc ); 28 cfg.writeEntry("VolumePercent", volumePerc );
31 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false; 29 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false;
32// QCopEnvelope( "QPE/System", "setVolume(int,int)" ) << 0, volumePerc; 30// QCopEnvelope( "QPE/System", "setVolume(int,int)" ) << 0, volumePerc;
33} 31}
34 32
35 33
36void VolumeControl::incVol( int ammount ) { 34void VolumeControl::incVol( int ammount ) {
37 int oldVol = volume(); 35 int oldVol = volume();
38 setVolume( oldVol + ammount); 36 setVolume( oldVol + ammount);
39} 37}
40 38
41void VolumeControl::decVol( int ammount ) { 39void VolumeControl::decVol( int ammount ) {
42 int oldVol = volume(); 40 int oldVol = volume();
43 setVolume( oldVol - ammount); 41 setVolume( oldVol - ammount);
44} 42}
45 43
46 44
47VolumeControl::VolumeControl( ) { 45VolumeControl::VolumeControl( ) {
48 volume(); 46 volume();
49} 47}
50 48
51VolumeControl::~VolumeControl() { 49VolumeControl::~VolumeControl() {
52 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false; 50 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false;
53} 51}
54 52
55void VolumeControl::setMute(bool on) { 53void VolumeControl::setMute(bool on) {
56 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << on; 54 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << on;
57} 55}
58 56
59 57
60 58
61 59
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp
index 70f2ffd..8f11b2e 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.cpp
+++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp
@@ -1,137 +1,136 @@
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 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; General Public License for more 22..}^=.=       =       ; General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = General Public License along with 26  -_. . .   )=.  = General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34 34
35#include <qtimer.h> 35#include <qtimer.h>
36#include <qmessagebox.h> 36#include <qmessagebox.h>
37#include <qpe/qcopenvelope_qws.h> 37#include <qpe/qcopenvelope_qws.h>
38#include <qpe/qpeapplication.h> 38#include <qpe/qpeapplication.h>
39 39
40#include "xinecontrol.h" 40#include "xinecontrol.h"
41#include "mediaplayerstate.h"
42#include "xinevideowidget.h" 41#include "xinevideowidget.h"
43 42
44XineControl::XineControl( XineVideoWidget *xineWidget, 43XineControl::XineControl( XineVideoWidget *xineWidget,
45 MediaPlayerState &_mediaPlayerState, 44 MediaPlayerState &_mediaPlayerState,
46 QObject *parent, const char *name ) 45 QObject *parent, const char *name )
47 : QObject( parent, name ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget ) 46 : QObject( parent, name ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget )
48{ 47{
49 libXine = new XINE::Lib( XINE::Lib::InitializeImmediately, xineWidget ); 48 libXine = new XINE::Lib( XINE::Lib::InitializeImmediately, xineWidget );
50 49
51 init(); 50 init();
52} 51}
53 52
54XineControl::XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget, 53XineControl::XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget,
55 MediaPlayerState &_mediaPlayerState, 54 MediaPlayerState &_mediaPlayerState,
56 QObject *parent, const char *name ) 55 QObject *parent, const char *name )
57 : QObject( parent, name ), libXine( xine ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget ) 56 : QObject( parent, name ), libXine( xine ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget )
58{ 57{
59 xine->ensureInitialized(); 58 xine->ensureInitialized();
60 59
61 xine->setWidget( xineWidget ); 60 xine->setWidget( xineWidget );
62 61
63 init(); 62 init();
64} 63}
65 64
66void XineControl::init() 65void XineControl::init()
67{ 66{
68 connect( &mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) ); 67 connect( &mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) );
69 connect( this, SIGNAL( positionChanged(long) ), &mediaPlayerState, SLOT( updatePosition(long) ) ); 68 connect( this, SIGNAL( positionChanged(long) ), &mediaPlayerState, SLOT( updatePosition(long) ) );
70 connect( &mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( stop(bool) ) ); 69 connect( &mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( stop(bool) ) );
71 connect( &mediaPlayerState, SIGNAL( fullscreenToggled(bool) ), this, SLOT( setFullscreen(bool) ) ); 70 connect( &mediaPlayerState, SIGNAL( fullscreenToggled(bool) ), this, SLOT( setFullscreen(bool) ) );
72 connect( &mediaPlayerState, SIGNAL( positionChanged(long) ), this, SLOT( seekTo(long) ) ); 71 connect( &mediaPlayerState, SIGNAL( positionChanged(long) ), this, SLOT( seekTo(long) ) );
73 connect( &mediaPlayerState, SIGNAL( videoGammaChanged(int) ), this, SLOT( setGamma(int) ) ); 72 connect( &mediaPlayerState, SIGNAL( videoGammaChanged(int) ), this, SLOT( setGamma(int) ) );
74 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); 73 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) );
75 connect( xineVideoWidget, SIGNAL( videoResized(const QSize&) ), this, SLOT( videoResized(const QSize&) ) ); 74 connect( xineVideoWidget, SIGNAL( videoResized(const QSize&) ), this, SLOT( videoResized(const QSize&) ) );
76 75
77 disabledSuspendScreenSaver = FALSE; 76 disabledSuspendScreenSaver = FALSE;
78} 77}
79 78
80XineControl::~XineControl() { 79XineControl::~XineControl() {
81#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 80#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
82 if ( disabledSuspendScreenSaver ) { 81 if ( disabledSuspendScreenSaver ) {
83 disabledSuspendScreenSaver = FALSE; 82 disabledSuspendScreenSaver = FALSE;
84 // Re-enable the suspend mode 83 // Re-enable the suspend mode
85 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 84 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
86 } 85 }
87#endif 86#endif
88 delete libXine; 87 delete libXine;
89} 88}
90 89
91void XineControl::play( const QString& fileName ) { 90void XineControl::play( const QString& fileName ) {
92 91
93 hasVideoChannel = FALSE; 92 hasVideoChannel = FALSE;
94 hasAudioChannel = FALSE; 93 hasAudioChannel = FALSE;
95 m_fileName = fileName; 94 m_fileName = fileName;
96 95
97 qDebug("<<FILENAME: " + fileName + ">>>>"); 96 qDebug("<<FILENAME: " + fileName + ">>>>");
98 97
99 if ( !libXine->play( fileName, 0, 0 ) ) { 98 if ( !libXine->play( fileName, 0, 0 ) ) {
100 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); 99 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() );
101 // toggle stop so the the play button is reset 100 // toggle stop so the the play button is reset
102 mediaPlayerState.setPlaying( false ); 101 mediaPlayerState.setPlaying( false );
103 return; 102 return;
104 } 103 }
105 mediaPlayerState.setPlaying( true ); 104 mediaPlayerState.setPlaying( true );
106 105
107 MediaPlayerState::DisplayType displayType; 106 MediaPlayerState::DisplayType displayType;
108 if ( !libXine->hasVideo() ) { 107 if ( !libXine->hasVideo() ) {
109 displayType = MediaPlayerState::Audio; 108 displayType = MediaPlayerState::Audio;
110 qDebug("HAS AUDIO"); 109 qDebug("HAS AUDIO");
111 libXine->setShowVideo( false ); 110 libXine->setShowVideo( false );
112 hasAudioChannel = TRUE; 111 hasAudioChannel = TRUE;
113 } else { 112 } else {
114 displayType = MediaPlayerState::Video; 113 displayType = MediaPlayerState::Video;
115 qDebug("HAS VIDEO"); 114 qDebug("HAS VIDEO");
116 libXine->setShowVideo( true ); 115 libXine->setShowVideo( true );
117 hasVideoChannel = TRUE; 116 hasVideoChannel = TRUE;
118 } 117 }
119 // determine if slider is shown 118 // determine if slider is shown
120 mediaPlayerState.setIsSeekable( libXine->isSeekable() ); 119 mediaPlayerState.setIsSeekable( libXine->isSeekable() );
121 120
122 // which gui (video / audio) 121 // which gui (video / audio)
123 mediaPlayerState.setDisplayType( displayType ); 122 mediaPlayerState.setDisplayType( displayType );
124 123
125#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 124#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
126 if ( !disabledSuspendScreenSaver ) { 125 if ( !disabledSuspendScreenSaver ) {
127 disabledSuspendScreenSaver = TRUE; 126 disabledSuspendScreenSaver = TRUE;
128 // Stop the screen from blanking and power saving state 127 // Stop the screen from blanking and power saving state
129 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) 128 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" )
130 << ( displayType == MediaPlayerState::Video ? QPEApplication::Disable : QPEApplication::DisableSuspend ); 129 << ( displayType == MediaPlayerState::Video ? QPEApplication::Disable : QPEApplication::DisableSuspend );
131 } 130 }
132#endif 131#endif
133 132
134 length(); 133 length();
135 position(); 134 position();
136} 135}
137 136
diff --git a/noncore/multimedia/opieplayer2/xinevideowidget.cpp b/noncore/multimedia/opieplayer2/xinevideowidget.cpp
index 0833784..b55750a 100644
--- a/noncore/multimedia/opieplayer2/xinevideowidget.cpp
+++ b/noncore/multimedia/opieplayer2/xinevideowidget.cpp
@@ -1,137 +1,134 @@
1 1
2/* 2/*
3                This file is part of the Opie Project 3                This file is part of the Opie Project
4 4
5 Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> 5 Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; Library General Public License for more 22..}^=.=       =       ; Library General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = Library General Public License along with 26  -_. . .   )=.  = Library General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34#include <qimage.h> 34#include <qimage.h>
35#include <qpainter.h>
36#include <qgfx_qws.h>
37#include <qdirectpainter_qws.h> 35#include <qdirectpainter_qws.h>
38#include <qgfx_qws.h> 36#include <qgfx_qws.h>
39#include <qsize.h> 37#include <qsize.h>
40#include <qapplication.h> 38#include <qapplication.h>
41#include <qpainter.h>
42 39
43#include <qpe/resource.h> 40#include <qpe/resource.h>
44 41
45#include "xinevideowidget.h" 42#include "xinevideowidget.h"
46 43
47 44
48// 0 deg rot: copy a line from src to dst (use libc memcpy) 45// 0 deg rot: copy a line from src to dst (use libc memcpy)
49 46
50// 180 deg rot: copy a line from src to dst reversed 47// 180 deg rot: copy a line from src to dst reversed
51 48
52static inline void memcpy_rev ( void *dst, void *src, size_t len ) 49static inline void memcpy_rev ( void *dst, void *src, size_t len )
53{ 50{
54 len >>= 1; 51 len >>= 1;
55 52
56 ((char *) src ) += ( len << 1 ); 53 ((char *) src ) += ( len << 1 );
57 54
58 while ( len-- ) 55 while ( len-- )
59 *((short int *) dst )++ = *--((short int *) src ); 56 *((short int *) dst )++ = *--((short int *) src );
60} 57}
61 58
62// 90 deg rot: copy a column from src to dst 59// 90 deg rot: copy a column from src to dst
63 60
64static inline void memcpy_step ( void *dst, void *src, size_t len, size_t step ) 61static inline void memcpy_step ( void *dst, void *src, size_t len, size_t step )
65{ 62{
66 len >>= 1; 63 len >>= 1;
67 while ( len-- ) { 64 while ( len-- ) {
68 *((short int *) dst )++ = *((short int *) src ); 65 *((short int *) dst )++ = *((short int *) src );
69 ((char *) src ) += step; 66 ((char *) src ) += step;
70 } 67 }
71} 68}
72 69
73// 270 deg rot: copy a column from src to dst reversed 70// 270 deg rot: copy a column from src to dst reversed
74 71
75static inline void memcpy_step_rev ( void *dst, void *src, size_t len, size_t step ) 72static inline void memcpy_step_rev ( void *dst, void *src, size_t len, size_t step )
76{ 73{
77 len >>= 1; 74 len >>= 1;
78 75
79 ((char *) src ) += ( len * step ); 76 ((char *) src ) += ( len * step );
80 77
81 while ( len-- ) { 78 while ( len-- ) {
82 ((char *) src ) -= step; 79 ((char *) src ) -= step;
83 *((short int *) dst )++ = *((short int *) src ); 80 *((short int *) dst )++ = *((short int *) src );
84 } 81 }
85} 82}
86 83
87 84
88XineVideoWidget::XineVideoWidget ( QWidget* parent, const char* name ) 85XineVideoWidget::XineVideoWidget ( QWidget* parent, const char* name )
89 : QWidget ( parent, name, WRepaintNoErase | WResizeNoErase ) 86 : QWidget ( parent, name, WRepaintNoErase | WResizeNoErase )
90{ 87{
91 setBackgroundMode ( NoBackground ); 88 setBackgroundMode ( NoBackground );
92 89
93 m_logo = 0; 90 m_logo = 0;
94 m_buff = 0; 91 m_buff = 0;
95 m_bytes_per_line_fb = qt_screen-> linestep ( ); 92 m_bytes_per_line_fb = qt_screen-> linestep ( );
96 m_bytes_per_pixel = ( qt_screen->depth() + 7 ) / 8; 93 m_bytes_per_pixel = ( qt_screen->depth() + 7 ) / 8;
97 m_rotation = 0; 94 m_rotation = 0;
98} 95}
99 96
100 97
101XineVideoWidget::~XineVideoWidget ( ) 98XineVideoWidget::~XineVideoWidget ( )
102{ 99{
103 delete m_logo; 100 delete m_logo;
104} 101}
105 102
106void XineVideoWidget::clear ( ) 103void XineVideoWidget::clear ( )
107{ 104{
108 m_buff = 0; 105 m_buff = 0;
109 repaint ( false ); 106 repaint ( false );
110} 107}
111 108
112QSize XineVideoWidget::videoSize() const 109QSize XineVideoWidget::videoSize() const
113{ 110{
114 QSize s = size(); 111 QSize s = size();
115 bool fs = ( s == qApp->desktop()->size() ); 112 bool fs = ( s == qApp->desktop()->size() );
116 113
117 // if we are in fullscreen mode, do not rotate the video 114 // if we are in fullscreen mode, do not rotate the video
118 // (!! the paint routine uses m_rotation + qt_screen-> transformOrientation() !!) 115 // (!! the paint routine uses m_rotation + qt_screen-> transformOrientation() !!)
119 m_rotation = fs ? - qt_screen->transformOrientation() : 0; 116 m_rotation = fs ? - qt_screen->transformOrientation() : 0;
120 117
121 if ( fs && qt_screen->isTransformed() ) 118 if ( fs && qt_screen->isTransformed() )
122 s = qt_screen->mapToDevice( s ); 119 s = qt_screen->mapToDevice( s );
123 120
124 return s; 121 return s;
125} 122}
126 123
127void XineVideoWidget::paintEvent ( QPaintEvent * ) 124void XineVideoWidget::paintEvent ( QPaintEvent * )
128{ 125{
129 if ( m_buff == 0 ) { 126 if ( m_buff == 0 ) {
130 QPainter p ( this ); 127 QPainter p ( this );
131 p. fillRect ( rect ( ), black ); 128 p. fillRect ( rect ( ), black );
132 if ( m_logo ) 129 if ( m_logo )
133 p. drawImage ( 0, 0, *m_logo ); 130 p. drawImage ( 0, 0, *m_logo );
134 } 131 }
135 else { 132 else {
136 // Qt needs to be notified which areas were really updated .. strange 133 // Qt needs to be notified which areas were really updated .. strange
137 QArray <QRect> qt_bug_workaround_clip_rects; 134 QArray <QRect> qt_bug_workaround_clip_rects;
diff --git a/noncore/multimedia/opierec/main.cpp b/noncore/multimedia/opierec/main.cpp
index 714907c..74a175b 100644
--- a/noncore/multimedia/opierec/main.cpp
+++ b/noncore/multimedia/opierec/main.cpp
@@ -1,30 +1,29 @@
1/*************************************************************************** 1/***************************************************************************
2 main.cpp - main routine 2 main.cpp - main routine
3 ***************************************************************************/ 3 ***************************************************************************/
4//// main.cpp 4//// main.cpp
5//// copyright 2001, 2002, by L. J. Potter <ljp@llornkcor.com> 5//// copyright 2001, 2002, by L. J. Potter <ljp@llornkcor.com>
6/*************************************************************************** 6/***************************************************************************
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 ***************************************************************************/ 11 ***************************************************************************/
12#include "qtrec.h" 12#include "qtrec.h"
13#include <qpe/qpeapplication.h>
14 13
15#ifdef PDAUDIO 14#ifdef PDAUDIO
16int main(int argc, char* argv[]) { 15int main(int argc, char* argv[]) {
17 QPEApplication a(argc, argv); 16 QPEApplication a(argc, argv);
18 QtRec qtrec; 17 QtRec qtrec;
19 a.showMainWidget( &qtrec); 18 a.showMainWidget( &qtrec);
20 return a.exec(); 19 return a.exec();
21} 20}
22 21
23 22
24#else 23#else
25#include <opie/oapplicationfactory.h> 24#include <opie/oapplicationfactory.h>
26OPIE_EXPORT_APP( OApplicationFactory<QtRec> ) 25OPIE_EXPORT_APP( OApplicationFactory<QtRec> )
27 26
28#endif 27#endif
29 28
30 29
diff --git a/noncore/multimedia/opierec/qtrec.cpp b/noncore/multimedia/opierec/qtrec.cpp
index f2035ef..1c64ab1 100644
--- a/noncore/multimedia/opierec/qtrec.cpp
+++ b/noncore/multimedia/opierec/qtrec.cpp
@@ -1,107 +1,106 @@
1/**************************************************************************** 1/****************************************************************************
2 // qtrec.cpp 2 // qtrec.cpp
3 Created: Thu Jan 17 11:19:58 2002 3 Created: Thu Jan 17 11:19:58 2002
4 copyright 2002 by L.J. Potter <ljp@llornkcor.com> 4 copyright 2002 by L.J. Potter <ljp@llornkcor.com>
5****************************************************************************/ 5****************************************************************************/
6#define DEV_VERSION 6#define DEV_VERSION
7 7
8#include "pixmaps.h" 8#include "pixmaps.h"
9#include "qtrec.h" 9#include "qtrec.h"
10#include "waveform.h" 10#include "waveform.h"
11#include "device.h"
12 11
13#include <pthread.h> 12#include <pthread.h>
14 13
15extern "C" { 14extern "C" {
16#include "adpcm.h" 15#include "adpcm.h"
17} 16}
18 17
19#include <sys/soundcard.h> 18#include <sys/soundcard.h>
20 19
21#include <qpe/config.h> 20#include <qpe/config.h>
22#include <qpe/qcopenvelope_qws.h> 21#include <qpe/qcopenvelope_qws.h>
23#include <qpe/qpeapplication.h> 22#include <qpe/qpeapplication.h>
24#include <qpe/resource.h> 23#include <qpe/resource.h>
25#include <qpe/storage.h> 24#include <qpe/storage.h>
26 25
27#include <qcheckbox.h> 26#include <qcheckbox.h>
28#include <qcombobox.h> 27#include <qcombobox.h>
29//#include <qdatetime.h> 28//#include <qdatetime.h>
30#include <qdir.h> 29#include <qdir.h>
31#include <qgroupbox.h> 30#include <qgroupbox.h>
32#include <qlabel.h> 31#include <qlabel.h>
33#include <qlayout.h> 32#include <qlayout.h>
34#include <qlistview.h> 33#include <qlistview.h>
35#include <qmessagebox.h> 34#include <qmessagebox.h>
36#include <qpopupmenu.h> 35#include <qpopupmenu.h>
37#include <qpushbutton.h> 36#include <qpushbutton.h>
38#include <qslider.h> 37#include <qslider.h>
39#include <qtabwidget.h> 38#include <qtabwidget.h>
40#include <qtimer.h> 39#include <qtimer.h>
41 40
42#include <errno.h> 41#include <errno.h>
43#include <fcntl.h> 42#include <fcntl.h>
44#include <math.h> 43#include <math.h>
45#include <mntent.h> 44#include <mntent.h>
46#include <stdio.h> 45#include <stdio.h>
47#include <stdlib.h> 46#include <stdlib.h>
48#include <sys/ioctl.h> 47#include <sys/ioctl.h>
49#include <sys/soundcard.h> 48#include <sys/soundcard.h>
50#include <sys/stat.h> 49#include <sys/stat.h>
51#include <sys/time.h> 50#include <sys/time.h>
52#include <sys/types.h> 51#include <sys/types.h>
53#include <sys/vfs.h> 52#include <sys/vfs.h>
54#include <unistd.h> 53#include <unistd.h>
55#include <sys/wait.h> 54#include <sys/wait.h>
56#include <sys/signal.h> 55#include <sys/signal.h>
57 56
58 57
59#ifdef PDAUDIO //ALSA 58#ifdef PDAUDIO //ALSA
60#include <alsa/asoundlib.h> 59#include <alsa/asoundlib.h>
61static int deviceSampleRates[8] = { 32000, 44100, 48000, 88200, 96000, 176400, 192000, -1 }; 60static int deviceSampleRates[8] = { 32000, 44100, 48000, 88200, 96000, 176400, 192000, -1 };
62static int deviceBitRates[] = { 8, 16, 24, 32, -1 }; 61static int deviceBitRates[] = { 8, 16, 24, 32, -1 };
63#else //OSS 62#else //OSS
64static int deviceSampleRates[6] = { 11025, 16000, 22050, 32000, 44100, -1 }; 63static int deviceSampleRates[6] = { 11025, 16000, 22050, 32000, 44100, -1 };
65static int deviceBitRates[] = { 8, 16, -1 }; 64static int deviceBitRates[] = { 8, 16, -1 };
66#endif 65#endif
67 66
68#if defined(QT_QWS_SL5XXX) 67#if defined(QT_QWS_SL5XXX)
69///#if defined(QT_QWS_EBX) 68///#if defined(QT_QWS_EBX)
70 69
71#define DSPSTROUT "/dev/dsp" 70#define DSPSTROUT "/dev/dsp"
72#define DSPSTRIN "/dev/dsp1" 71#define DSPSTRIN "/dev/dsp1"
73#define DSPSTRMIXEROUT "/dev/mixer" 72#define DSPSTRMIXEROUT "/dev/mixer"
74#define DSPSTRMIXERIN "/dev/mixer1" 73#define DSPSTRMIXERIN "/dev/mixer1"
75 74
76#else 75#else
77 76
78#define DSPSTROUT "/dev/dsp" 77#define DSPSTROUT "/dev/dsp"
79#define DSPSTRIN "/dev/dsp" 78#define DSPSTRIN "/dev/dsp"
80#define DSPSTRMIXERIN "/dev/mixer" 79#define DSPSTRMIXERIN "/dev/mixer"
81#define DSPSTRMIXEROUT "/dev/mixer" 80#define DSPSTRMIXEROUT "/dev/mixer"
82 81
83#endif 82#endif
84 83
85//#define ZAURUS 0 84//#define ZAURUS 0
86struct adpcm_state encoder_state; 85struct adpcm_state encoder_state;
87struct adpcm_state decoder_state; 86struct adpcm_state decoder_state;
88 87
89typedef struct { 88typedef struct {
90 int sampleRate; 89 int sampleRate;
91 /* int fragSize; */ 90 /* int fragSize; */
92 /* int blockSize; */ 91 /* int blockSize; */
93 int resolution; //bitrate 92 int resolution; //bitrate
94 int channels; //number of channels 93 int channels; //number of channels
95 int fd; //file descriptor 94 int fd; //file descriptor
96 int sd; //sound device descriptor 95 int sd; //sound device descriptor
97 int numberSamples; //total number of samples 96 int numberSamples; //total number of samples
98 int SecondsToRecord; // number of seconds that should be recorded 97 int SecondsToRecord; // number of seconds that should be recorded
99 float numberOfRecordedSeconds; //total number of samples recorded 98 float numberOfRecordedSeconds; //total number of samples recorded
100 int samplesToRecord; //number of samples to be recorded 99 int samplesToRecord; //number of samples to be recorded
101 int inVol; //input volume 100 int inVol; //input volume
102 int outVol; //output volume 101 int outVol; //output volume
103 int format; //wavfile format PCM.. ADPCM 102 int format; //wavfile format PCM.. ADPCM
104 const char *fileName; //name of fiel to be played/recorded 103 const char *fileName; //name of fiel to be played/recorded
105} fileParameters; 104} fileParameters;
106 105
107fileParameters filePara; 106fileParameters filePara;
diff --git a/noncore/multimedia/opierec/wavFile.cpp b/noncore/multimedia/opierec/wavFile.cpp
index 1d58bb3..35bc14d 100644
--- a/noncore/multimedia/opierec/wavFile.cpp
+++ b/noncore/multimedia/opierec/wavFile.cpp
@@ -1,104 +1,103 @@
1//wavFile.cpp 1//wavFile.cpp
2#include "wavFile.h" 2#include "wavFile.h"
3#include "qtrec.h" 3#include "qtrec.h"
4 4
5#include <qmessagebox.h> 5#include <qmessagebox.h>
6#include <qdir.h> 6#include <qdir.h>
7 7
8#include <qpe/timestring.h>
9#include <qpe/config.h> 8#include <qpe/config.h>
10 9
11#include <errno.h> 10#include <errno.h>
12 11
13#include <sys/time.h> 12#include <sys/time.h>
14#include <sys/types.h> 13#include <sys/types.h>
15#include <sys/vfs.h> 14#include <sys/vfs.h>
16 15
17#include <fcntl.h> 16#include <fcntl.h>
18#include <math.h> 17#include <math.h>
19#include <mntent.h> 18#include <mntent.h>
20#include <stdio.h> 19#include <stdio.h>
21#include <stdlib.h> 20#include <stdlib.h>
22#include <unistd.h> 21#include <unistd.h>
23 22
24WavFile::WavFile( QObject * parent,const QString &fileName, bool makeNwFile, int sampleRate, 23WavFile::WavFile( QObject * parent,const QString &fileName, bool makeNwFile, int sampleRate,
25 int channels, int resolution, int format ) 24 int channels, int resolution, int format )
26 : QObject( parent) 25 : QObject( parent)
27{ 26{
28//qDebug("new wave file"); 27//qDebug("new wave file");
29 bool b = makeNwFile; 28 bool b = makeNwFile;
30 wavSampleRate=sampleRate; 29 wavSampleRate=sampleRate;
31 wavFormat=format; 30 wavFormat=format;
32 wavChannels=channels; 31 wavChannels=channels;
33 wavResolution=resolution; 32 wavResolution=resolution;
34 useTmpFile=false; 33 useTmpFile=false;
35 if( b) { 34 if( b) {
36 newFile(); 35 newFile();
37 } else { 36 } else {
38 openFile(fileName); 37 openFile(fileName);
39 } 38 }
40} 39}
41 40
42bool WavFile::newFile() { 41bool WavFile::newFile() {
43 42
44// qDebug("Set up new file"); 43// qDebug("Set up new file");
45 Config cfg("OpieRec"); 44 Config cfg("OpieRec");
46 cfg.setGroup("Settings"); 45 cfg.setGroup("Settings");
47 46
48 currentFileName=cfg.readEntry("directory",QDir::homeDirPath()); 47 currentFileName=cfg.readEntry("directory",QDir::homeDirPath());
49 QString date; 48 QString date;
50 QDateTime dt = QDateTime::currentDateTime(); 49 QDateTime dt = QDateTime::currentDateTime();
51 date = dt.toString();//TimeString::dateString( QDateTime::currentDateTime(),false,true); 50 date = dt.toString();//TimeString::dateString( QDateTime::currentDateTime(),false,true);
52 date.replace(QRegExp("'"),""); 51 date.replace(QRegExp("'"),"");
53 date.replace(QRegExp(" "),"_"); 52 date.replace(QRegExp(" "),"_");
54 date.replace(QRegExp(":"),"."); 53 date.replace(QRegExp(":"),".");
55 date.replace(QRegExp(","),""); 54 date.replace(QRegExp(","),"");
56 55
57 QString currentFile=date; 56 QString currentFile=date;
58 if(currentFileName.right(1).find("/",0,true) == -1) 57 if(currentFileName.right(1).find("/",0,true) == -1)
59 currentFileName += "/" + date; 58 currentFileName += "/" + date;
60 else 59 else
61 currentFileName += date; 60 currentFileName += date;
62 currentFileName+=".wav"; 61 currentFileName+=".wav";
63 62
64// qDebug("set up file for recording: "+currentFileName); 63// qDebug("set up file for recording: "+currentFileName);
65 char pointer[] = "/tmp/opierec-XXXXXX"; 64 char pointer[] = "/tmp/opierec-XXXXXX";
66 int fd = 0; 65 int fd = 0;
67 66
68 if( currentFileName.find("/mnt",0,true) == -1 67 if( currentFileName.find("/mnt",0,true) == -1
69 && currentFileName.find("/tmp",0,true) == -1 ) { 68 && currentFileName.find("/tmp",0,true) == -1 ) {
70 // if destination file is most likely in flash (assuming jffs2) 69 // if destination file is most likely in flash (assuming jffs2)
71 // we have to write to a different filesystem first 70 // we have to write to a different filesystem first
72 71
73 useTmpFile = true; 72 useTmpFile = true;
74 if(( fd = mkstemp( pointer)) < 0 ) { 73 if(( fd = mkstemp( pointer)) < 0 ) {
75 perror("mkstemp failed"); 74 perror("mkstemp failed");
76 return false; 75 return false;
77 } 76 }
78 77
79// qDebug("Opening tmp file %s",pointer); 78// qDebug("Opening tmp file %s",pointer);
80 track.setName( pointer); 79 track.setName( pointer);
81 80
82 } else { //just use regular file.. no moving 81 } else { //just use regular file.. no moving
83 82
84 useTmpFile = false; 83 useTmpFile = false;
85 track.setName( currentFileName); 84 track.setName( currentFileName);
86 } 85 }
87 if(!track.open( IO_ReadWrite | IO_Truncate)) { 86 if(!track.open( IO_ReadWrite | IO_Truncate)) {
88 QString errorMsg=(QString)strerror(errno); 87 QString errorMsg=(QString)strerror(errno);
89 qDebug(errorMsg); 88 qDebug(errorMsg);
90 QMessageBox::message("Note", "Error opening file.\n" +errorMsg); 89 QMessageBox::message("Note", "Error opening file.\n" +errorMsg);
91 90
92 return false; 91 return false;
93 } else { 92 } else {
94 setWavHeader( track.handle() , &hdr); 93 setWavHeader( track.handle() , &hdr);
95 } 94 }
96return true; 95return true;
97} 96}
98 97
99WavFile::~WavFile() { 98WavFile::~WavFile() {
100 99
101 closeFile(); 100 closeFile();
102} 101}
103 102
104void WavFile::closeFile() { 103void WavFile::closeFile() {
diff --git a/noncore/multimedia/opierec/waveform.cpp b/noncore/multimedia/opierec/waveform.cpp
index 05be373..9cc40b4 100644
--- a/noncore/multimedia/opierec/waveform.cpp
+++ b/noncore/multimedia/opierec/waveform.cpp
@@ -1,118 +1,117 @@
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 "waveform.h" 20#include "waveform.h"
21 21
22#include <qlabel.h>
23#include <qpainter.h> 22#include <qpainter.h>
24 23
25 24
26Waveform::Waveform( QWidget *parent, const char *name, WFlags fl ) 25Waveform::Waveform( QWidget *parent, const char *name, WFlags fl )
27 : QWidget( parent, name, fl ) 26 : QWidget( parent, name, fl )
28{ 27{
29 pixmap = 0; 28 pixmap = 0;
30 windowSize = 100; 29 windowSize = 100;
31 samplesPerPixel = 8000 / (5 * windowSize); 30 samplesPerPixel = 8000 / (5 * windowSize);
32 currentValue = 0; 31 currentValue = 0;
33 numSamples = 0; 32 numSamples = 0;
34 windowPosn = 0; 33 windowPosn = 0;
35 window = 0; 34 window = 0;
36} 35}
37 36
38 37
39void Waveform::changeSettings( int frequency, int channels ) 38void Waveform::changeSettings( int frequency, int channels )
40{ 39{
41 makePixmap(); 40 makePixmap();
42// qWarning("change waveform %d, %d", frequency, channels); 41// qWarning("change waveform %d, %d", frequency, channels);
43 samplesPerPixel = frequency * channels / (5 * windowSize); 42 samplesPerPixel = frequency * channels / (5 * windowSize);
44 qWarning("Waveform::changeSettings %d", samplesPerPixel); 43 qWarning("Waveform::changeSettings %d", samplesPerPixel);
45 if ( !samplesPerPixel ) 44 if ( !samplesPerPixel )
46 samplesPerPixel = 1; 45 samplesPerPixel = 1;
47 currentValue = 0; 46 currentValue = 0;
48 numSamples = 0; 47 numSamples = 0;
49 windowPosn = 0; 48 windowPosn = 0;
50 draw(); 49 draw();
51} 50}
52 51
53 52
54Waveform::~Waveform() 53Waveform::~Waveform()
55{ 54{
56 if ( window ) 55 if ( window )
57 delete[] window; 56 delete[] window;
58 if ( pixmap ) 57 if ( pixmap )
59 delete pixmap; 58 delete pixmap;
60} 59}
61 60
62 61
63void Waveform::reset() 62void Waveform::reset()
64{ 63{
65 makePixmap(); 64 makePixmap();
66 currentValue = 0; 65 currentValue = 0;
67 numSamples = 0; 66 numSamples = 0;
68 windowPosn = 0; 67 windowPosn = 0;
69 draw(); 68 draw();
70} 69}
71 70
72 71
73void Waveform::newSamples( const short *buf, int len ) 72void Waveform::newSamples( const short *buf, int len )
74{ 73{
75 // Cache the object values in local variables. 74 // Cache the object values in local variables.
76 int samplesPerPixel = this->samplesPerPixel; 75 int samplesPerPixel = this->samplesPerPixel;
77 int currentValue = this->currentValue; 76 int currentValue = this->currentValue;
78 int numSamples = this->numSamples; 77 int numSamples = this->numSamples;
79 short *window = this->window; 78 short *window = this->window;
80 int windowPosn = this->windowPosn; 79 int windowPosn = this->windowPosn;
81 int windowSize = this->windowSize; 80 int windowSize = this->windowSize;
82 81
83 // Average the incoming samples to scale them to the window. 82 // Average the incoming samples to scale them to the window.
84 while ( len > 0 ) { 83 while ( len > 0 ) {
85 currentValue += *buf++; 84 currentValue += *buf++;
86 --len; 85 --len;
87 if ( ++numSamples >= samplesPerPixel ) { 86 if ( ++numSamples >= samplesPerPixel ) {
88 window[windowPosn++] = (short)(currentValue / numSamples); 87 window[windowPosn++] = (short)(currentValue / numSamples);
89 if ( windowPosn >= windowSize ) { 88 if ( windowPosn >= windowSize ) {
90 this->windowPosn = windowPosn; 89 this->windowPosn = windowPosn;
91 draw(); 90 draw();
92 windowPosn = 0; 91 windowPosn = 0;
93 } 92 }
94 numSamples = 0; 93 numSamples = 0;
95 currentValue = 0; 94 currentValue = 0;
96 } 95 }
97 } 96 }
98 97
99 // Copy the final state back to the object. 98 // Copy the final state back to the object.
100//qWarning("%d, %d, %d", currentValue, numSamples, windowPosn); 99//qWarning("%d, %d, %d", currentValue, numSamples, windowPosn);
101 this->currentValue = currentValue; 100 this->currentValue = currentValue;
102 this->numSamples = numSamples; 101 this->numSamples = numSamples;
103 this->windowPosn = windowPosn; 102 this->windowPosn = windowPosn;
104} 103}
105 104
106 105
107void Waveform::makePixmap() 106void Waveform::makePixmap()
108{ 107{
109 if ( !pixmap ) { 108 if ( !pixmap ) {
110 pixmap = new QPixmap( size() ); 109 pixmap = new QPixmap( size() );
111 windowSize = pixmap->width(); 110 windowSize = pixmap->width();
112 window = new short [windowSize]; 111 window = new short [windowSize];
113 } 112 }
114} 113}
115 114
116 115
117void Waveform::draw() 116void Waveform::draw()
118{ 117{
diff --git a/noncore/multimedia/powerchord/fretboard.cpp b/noncore/multimedia/powerchord/fretboard.cpp
index 0687d00..bf78e4c 100644
--- a/noncore/multimedia/powerchord/fretboard.cpp
+++ b/noncore/multimedia/powerchord/fretboard.cpp
@@ -1,122 +1,121 @@
1// 1//
2// FretBoard class to display interface for chord finder application 2// FretBoard class to display interface for chord finder application
3// 3//
4 4
5// Copyright (c) 2001 Camilo Mesias 5// Copyright (c) 2001 Camilo Mesias
6// camilo@mesias.co.uk 6// camilo@mesias.co.uk
7// 7//
8// This program is free software; you can redistribute it and/or 8// This program is free software; you can redistribute it and/or
9// modify it under the terms of the GNU General Public License 9// modify it under the terms of the GNU General Public License
10// as published by the Free Software Foundation; either version 2 10// as published by the Free Software Foundation; either version 2
11// of the License, or (at your option) any later version. 11// of the License, or (at your option) any later version.
12// 12//
13// This program is distributed in the hope that it will be useful, 13// This program is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of 14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU General Public License for more details. 16// GNU General Public License for more details.
17// 17//
18// You should have received a copy of the GNU General Public License 18// You should have received a copy of the GNU General Public License
19// along with this program; if not, write to the Free Software 19// along with this program; if not, write to the Free Software
20// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 21
22//#include <FL/Fl.H> 22//#include <FL/Fl.H>
23//#include <FL/Fl_Widget.H> 23//#include <FL/Fl_Widget.H>
24//#include <FL/fl_draw.H> 24//#include <FL/fl_draw.H>
25#include <stdio.h> 25#include <stdio.h>
26#include <qpixmap.h>
27#include <qpe/resource.h> 26#include <qpe/resource.h>
28#include "fretboard.h" 27#include "fretboard.h"
29#include <qpainter.h> 28#include <qpainter.h>
30 29
31void FretBoard::refresh(){ 30void FretBoard::refresh(){
32 ce.calculate(); 31 ce.calculate();
33 32
34 emit nameChanged(QString(ce.label())); 33 emit nameChanged(QString(ce.label()));
35 34
36 for (int i=0;i<6;i++){ 35 for (int i=0;i<6;i++){
37 Finger(i, ce.finger(i)); 36 Finger(i, ce.finger(i));
38 // yuk 37 // yuk
39 switch (i) { 38 switch (i) {
40 case 0: 39 case 0:
41 emit s1nameChanged(QString(ce.name(i))); 40 emit s1nameChanged(QString(ce.name(i)));
42 break; 41 break;
43 case 1: 42 case 1:
44 emit s2nameChanged(QString(ce.name(i))); 43 emit s2nameChanged(QString(ce.name(i)));
45 break; 44 break;
46 case 2: 45 case 2:
47 emit s3nameChanged(QString(ce.name(i))); 46 emit s3nameChanged(QString(ce.name(i)));
48 break; 47 break;
49 case 3: 48 case 3:
50 emit s4nameChanged(QString(ce.name(i))); 49 emit s4nameChanged(QString(ce.name(i)));
51 break; 50 break;
52 case 4: 51 case 4:
53 emit s5nameChanged(QString(ce.name(i))); 52 emit s5nameChanged(QString(ce.name(i)));
54 break; 53 break;
55 case 5: 54 case 5:
56 emit s6nameChanged(QString(ce.name(i))); 55 emit s6nameChanged(QString(ce.name(i)));
57 break; 56 break;
58 } 57 }
59 } 58 }
60 59
61 update(); 60 update();
62} 61}
63 62
64FretBoard::FretBoard(QWidget *parent, const char *name ) 63FretBoard::FretBoard(QWidget *parent, const char *name )
65 : QWidget( parent, name ), ce() 64 : QWidget( parent, name ), ce()
66{ 65{
67 66
68 ce.base(9); 67 ce.base(9);
69 ce.chord(0); 68 ce.chord(0);
70 ce.fret(0); 69 ce.fret(0);
71 ce.span(1); 70 ce.span(1);
72 ce.vary(7); 71 ce.vary(7);
73 ce.tune(0); 72 ce.tune(0);
74 refresh(); 73 refresh();
75 74
76 // setPalette( QPalette( QColor( 250, 250, 200) ) ); 75 // setPalette( QPalette( QColor( 250, 250, 200) ) );
77 76
78 stringtop_pix = Resource::loadPixmap( "powerchord/stringtop_s"); 77 stringtop_pix = Resource::loadPixmap( "powerchord/stringtop_s");
79 string_pix = Resource::loadPixmap( "powerchord/string_s"); 78 string_pix = Resource::loadPixmap( "powerchord/string_s");
80 finger_pix = Resource::loadPixmap( "powerchord/justfing_s"); 79 finger_pix = Resource::loadPixmap( "powerchord/justfing_s");
81 mute_pix = Resource::loadPixmap( "powerchord/muted_s"); 80 mute_pix = Resource::loadPixmap( "powerchord/muted_s");
82 81
83 // box(FL_NO_BOX); 82 // box(FL_NO_BOX);
84 83
85 // finger[0] = OPEN; 84 // finger[0] = OPEN;
86 // finger[1] = OPEN; 85 // finger[1] = OPEN;
87 // finger[2] = OPEN; 86 // finger[2] = OPEN;
88 // finger[3] = OPEN; 87 // finger[3] = OPEN;
89 // finger[4] = OPEN; 88 // finger[4] = OPEN;
90 // finger[5] = OPEN; 89 // finger[5] = OPEN;
91 90
92 initial_fret = 0; 91 initial_fret = 0;
93 92
94 // label(FL_NORMAL_LABEL, "Chord"); 93 // label(FL_NORMAL_LABEL, "Chord");
95} 94}
96 95
97// int FretBoard::Finger(int f){ 96// int FretBoard::Finger(int f){
98// if (f < 0 || f > 5){ 97// if (f < 0 || f > 5){
99// fprintf(stderr, "Error - finger value was %d\n", f); 98// fprintf(stderr, "Error - finger value was %d\n", f);
100// return 0; 99// return 0;
101// } 100// }
102// return finger[f]; 101// return finger[f];
103// } 102// }
104 103
105void FretBoard::Finger(int f, int position){ 104void FretBoard::Finger(int f, int position){
106 if (f < 0 || f > 5){ 105 if (f < 0 || f > 5){
107 fprintf(stderr, "Error - finger2 value was %d\n", f); 106 fprintf(stderr, "Error - finger2 value was %d\n", f);
108 return; 107 return;
109 } 108 }
110 109
111 finger[f] = position; 110 finger[f] = position;
112} 111}
113 112
114// void FretBoard::draw(void) { 113// void FretBoard::draw(void) {
115// draw_box(); 114// draw_box();
116// draw_label(); 115// draw_label();
117// } 116// }
118 117
119// void FretBoard::draw_label(void) { 118// void FretBoard::draw_label(void) {
120// align(FL_ALIGN_CENTER | FL_ALIGN_TOP | FL_ALIGN_WRAP); 119// align(FL_ALIGN_CENTER | FL_ALIGN_TOP | FL_ALIGN_WRAP);
121 120
122// this->Fl_Widget::draw_label(); 121// this->Fl_Widget::draw_label();
diff --git a/noncore/multimedia/powerchord/gs.cpp b/noncore/multimedia/powerchord/gs.cpp
index fdcfb74..69d9d75 100644
--- a/noncore/multimedia/powerchord/gs.cpp
+++ b/noncore/multimedia/powerchord/gs.cpp
@@ -1,117 +1,115 @@
1 1
2//#include <FL/Fl.H> 2//#include <FL/Fl.H>
3//#include <FL/Fl_Widget.H> 3//#include <FL/Fl_Widget.H>
4//#include <FL/fl_draw.H> 4//#include <FL/fl_draw.H>
5#include <stdio.h> 5#include <stdio.h>
6//#include <qpixmap.h> 6//#include <qpixmap.h>
7#include "gs.h" 7#include "gs.h"
8 8
9#include <sys/ioctl.h> 9#include <sys/ioctl.h>
10#include <unistd.h> 10#include <unistd.h>
11#include <fcntl.h> 11#include <fcntl.h>
12#include <sys/soundcard.h> 12#include <sys/soundcard.h>
13 13
14#include <errno.h> 14#include <errno.h>
15#include <string.h> 15#include <string.h>
16 16
17#include <stdlib.h> 17#include <stdlib.h>
18 18
19//#include <qpainter.h> 19//#include <qpainter.h>
20#include <qmessagebox.h>
21#include <qstring.h>
22 20
23 21
24gs::gs() 22gs::gs()
25{ 23{
26 24
27 finger[0] = OPEN; 25 finger[0] = OPEN;
28 finger[1] = OPEN; 26 finger[1] = OPEN;
29 finger[2] = OPEN; 27 finger[2] = OPEN;
30 finger[3] = OPEN; 28 finger[3] = OPEN;
31 finger[4] = OPEN; 29 finger[4] = OPEN;
32 finger[5] = OPEN; 30 finger[5] = OPEN;
33 31
34 tuning[0] = 0; 32 tuning[0] = 0;
35 tuning[1] = 0; 33 tuning[1] = 0;
36 tuning[2] = 0; 34 tuning[2] = 0;
37 tuning[3] = 0; 35 tuning[3] = 0;
38 tuning[4] = 0; 36 tuning[4] = 0;
39 tuning[5] = 0; 37 tuning[5] = 0;
40 38
41 initial_fret = 0; 39 initial_fret = 0;
42 40
43 audio_fd = -1; 41 audio_fd = -1;
44 42
45 pb_rate0 = 0; 43 pb_rate0 = 0;
46 pb_rate1 = 0; 44 pb_rate1 = 0;
47 pb_rate2 = 0; 45 pb_rate2 = 0;
48 pb_rate3 = 0; 46 pb_rate3 = 0;
49 pb_rate4 = 0; 47 pb_rate4 = 0;
50 pb_rate5 = 0; 48 pb_rate5 = 0;
51 pb_rate6 = 0; 49 pb_rate6 = 0;
52 50
53 pb_oct0 = 0; 51 pb_oct0 = 0;
54 pb_oct1 = 0; 52 pb_oct1 = 0;
55 pb_oct2 = 0; 53 pb_oct2 = 0;
56 pb_oct3 = 0; 54 pb_oct3 = 0;
57 pb_oct4 = 0; 55 pb_oct4 = 0;
58 pb_oct5 = 0; 56 pb_oct5 = 0;
59 pb_oct6 = 0; 57 pb_oct6 = 0;
60 58
61 // initialise reverb buffer 59 // initialise reverb buffer
62 reverb = (signed short *)malloc(1024 * sizeof(signed short)); 60 reverb = (signed short *)malloc(1024 * sizeof(signed short));
63 61
64 for (reverb_ptr=0;reverb_ptr<1024;reverb_ptr++){ 62 for (reverb_ptr=0;reverb_ptr<1024;reverb_ptr++){
65 reverb[reverb_ptr] = 0; 63 reverb[reverb_ptr] = 0;
66 } 64 }
67 reverb_ptr = 0; 65 reverb_ptr = 0;
68 reverb_max = 1024; 66 reverb_max = 1024;
69 67
70 // load sampled 'E' string 68 // load sampled 'E' string
71 int samplen = 25000; 69 int samplen = 25000;
72 70
73 signed short *dsp_buf = (signed short *)malloc(samplen * sizeof(signed short)); 71 signed short *dsp_buf = (signed short *)malloc(samplen * sizeof(signed short));
74 signed short *dsp_buf_ptr = dsp_buf; 72 signed short *dsp_buf_ptr = dsp_buf;
75 73
76 int raw_fd; 74 int raw_fd;
77 75
78 QString path = getenv( "OPIEDIR" ); 76 QString path = getenv( "OPIEDIR" );
79 path.append( "/share/powerchord/acguitar.raw" ); 77 path.append( "/share/powerchord/acguitar.raw" );
80 78
81 raw_fd = open( (const char*) path, O_RDONLY); 79 raw_fd = open( (const char*) path, O_RDONLY);
82 80
83 if (raw_fd < 0){ 81 if (raw_fd < 0){
84 fprintf(stderr, "Failed to open raw file (%s)\n", strerror(errno)); 82 fprintf(stderr, "Failed to open raw file (%s)\n", strerror(errno));
85 exit(-1); 83 exit(-1);
86 } 84 }
87 85
88 int totread = 0; 86 int totread = 0;
89 int i; 87 int i;
90 88
91 while (totread < samplen*2){ 89 while (totread < samplen*2){
92 int want = samplen*2 - totread; 90 int want = samplen*2 - totread;
93 91
94 int numread = read(raw_fd, dsp_buf_ptr, want); 92 int numread = read(raw_fd, dsp_buf_ptr, want);
95 fprintf(stderr, "read %d bytes\n", numread); 93 fprintf(stderr, "read %d bytes\n", numread);
96 totread += numread; 94 totread += numread;
97 dsp_buf_ptr += numread/2; 95 dsp_buf_ptr += numread/2;
98 96
99 if (numread == 0){ 97 if (numread == 0){
100 fprintf(stderr, "failed to read bytes\n"); 98 fprintf(stderr, "failed to read bytes\n");
101 exit(-1); 99 exit(-1);
102 } 100 }
103 } 101 }
104 102
105 close(raw_fd); 103 close(raw_fd);
106 104
107 // scale down a bit for mixing 105 // scale down a bit for mixing
108 for (i=0;i<samplen;i++){ 106 for (i=0;i<samplen;i++){
109 dsp_buf[i] /= 6; 107 dsp_buf[i] /= 6;
110 } 108 }
111 109
112 set_tonebank(0, dsp_buf, samplen); 110 set_tonebank(0, dsp_buf, samplen);
113 set_tonebank(1, dsp_buf, samplen); 111 set_tonebank(1, dsp_buf, samplen);
114 set_tonebank(2, dsp_buf, samplen); 112 set_tonebank(2, dsp_buf, samplen);
115 set_tonebank(3, dsp_buf, samplen); 113 set_tonebank(3, dsp_buf, samplen);
116 set_tonebank(4, dsp_buf, samplen); 114 set_tonebank(4, dsp_buf, samplen);
117 set_tonebank(5, dsp_buf, samplen); 115 set_tonebank(5, dsp_buf, samplen);
diff --git a/noncore/multimedia/powerchord/powerchord.cpp b/noncore/multimedia/powerchord/powerchord.cpp
index 79a26ea..31d517b 100644
--- a/noncore/multimedia/powerchord/powerchord.cpp
+++ b/noncore/multimedia/powerchord/powerchord.cpp
@@ -1,28 +1,27 @@
1#include "powerchord.h" 1#include "powerchord.h"
2#include <qpushbutton.h>
3 2
4/* 3/*
5 * Constructs a Example which is a child of 'parent', with the 4 * Constructs a Example which is a child of 'parent', with the
6 * name 'name' and widget flags set to 'f' 5 * name 'name' and widget flags set to 'f'
7 */ 6 */
8Powerchord::Powerchord( QWidget* parent, const char* name, WFlags fl ) 7Powerchord::Powerchord( QWidget* parent, const char* name, WFlags fl )
9 : PowerchordBase( parent, name, fl ) 8 : PowerchordBase( parent, name, fl )
10{ 9{
11// connect(quit, SIGNAL(clicked), this, SLOT(goodBye())); 10// connect(quit, SIGNAL(clicked), this, SLOT(goodBye()));
12} 11}
13 12
14/* 13/*
15 * Destroys the object and frees any allocated resources 14 * Destroys the object and frees any allocated resources
16 */ 15 */
17Powerchord::~Powerchord() 16Powerchord::~Powerchord()
18{ 17{
19 // no need to delete child widgets, Qt does it all for us 18 // no need to delete child widgets, Qt does it all for us
20} 19}
21 20
22/* 21/*
23 * A simple slot... not very interesting. 22 * A simple slot... not very interesting.
24 */ 23 */
25void Powerchord::goodBye() 24void Powerchord::goodBye()
26{ 25{
27 close(); 26 close();
28} 27}
diff --git a/noncore/multimedia/powerchord/powerchordbase.cpp b/noncore/multimedia/powerchord/powerchordbase.cpp
index 7978426..4fb5dda 100644
--- a/noncore/multimedia/powerchord/powerchordbase.cpp
+++ b/noncore/multimedia/powerchord/powerchordbase.cpp
@@ -1,123 +1,116 @@
1/**************************************************************************** 1/****************************************************************************
2** Form implementation generated from reading ui file 'powerchordbase.ui' 2** Form implementation generated from reading ui file 'powerchordbase.ui'
3** 3**
4** Created: Sun Jan 13 23:05:11 2002 4** Created: Sun Jan 13 23:05:11 2002
5** by: The User Interface Compiler (uic) 5** by: The User Interface Compiler (uic)
6** 6**
7** WARNING! All changes made in this file will be lost! 7** WARNING! All changes made in this file will be lost!
8****************************************************************************/ 8****************************************************************************/
9#include "powerchordbase.h" 9#include "powerchordbase.h"
10 10
11#include "fretboard.h" 11#include "fretboard.h"
12#include "vumeter.h" 12#include "vumeter.h"
13#include "gs.h"
14#include <qcombobox.h> 13#include <qcombobox.h>
15#include <qframe.h>
16#include <qlabel.h> 14#include <qlabel.h>
17#include <qlistbox.h> 15#include <qlistbox.h>
18#include <qpushbutton.h> 16#include <qpushbutton.h>
19#include <qspinbox.h> 17#include <qspinbox.h>
20#include <qtabwidget.h> 18#include <qtabwidget.h>
21#include <qlayout.h> 19#include <qlayout.h>
22#include <qvariant.h>
23#include <qtooltip.h> 20#include <qtooltip.h>
24#include <qwhatsthis.h>
25#include <qimage.h>
26#include <qpixmap.h>
27#include <qbitmap.h>
28#include <qpe/resource.h> 21#include <qpe/resource.h>
29 22
30 23
31/* 24/*
32 * Constructs a PowerchordBase which is a child of 'parent', with the 25 * Constructs a PowerchordBase which is a child of 'parent', with the
33 * name 'name' and widget flags set to 'f' 26 * name 'name' and widget flags set to 'f'
34 */ 27 */
35PowerchordBase::PowerchordBase( QWidget* parent, const char* name, WFlags fl ) 28PowerchordBase::PowerchordBase( QWidget* parent, const char* name, WFlags fl )
36 : QWidget( parent, name, fl ) 29 : QWidget( parent, name, fl )
37{ 30{
38 simulation_timer = 0; 31 simulation_timer = 0;
39 audio_timer = 0; 32 audio_timer = 0;
40 33
41 // setPalette( QPalette( QColor( 232, 227, 215) ) ); 34 // setPalette( QPalette( QColor( 232, 227, 215) ) );
42 35
43 // QPixmap image0(QString("/opt/Qtopia/pics/powerchord/image0")); 36 // QPixmap image0(QString("/opt/Qtopia/pics/powerchord/image0"));
44 QPixmap image1 = Resource::loadPixmap( "powerchord/image1"); 37 QPixmap image1 = Resource::loadPixmap( "powerchord/image1");
45 QPixmap image2 = Resource::loadPixmap( "powerchord/image2"); 38 QPixmap image2 = Resource::loadPixmap( "powerchord/image2");
46 QPixmap image3 = Resource::loadPixmap( "powerchord/image3"); 39 QPixmap image3 = Resource::loadPixmap( "powerchord/image3");
47 QPixmap image4 = Resource::loadPixmap( "powerchord/image4"); 40 QPixmap image4 = Resource::loadPixmap( "powerchord/image4");
48 QPixmap image5 = Resource::loadPixmap( "powerchord/image5"); 41 QPixmap image5 = Resource::loadPixmap( "powerchord/image5");
49 image6 = Resource::loadPixmap( "powerchord/image6"); 42 image6 = Resource::loadPixmap( "powerchord/image6");
50 image_open = Resource::loadPixmap( "powerchord/image_open"); 43 image_open = Resource::loadPixmap( "powerchord/image_open");
51 44
52 // image0.setMask(image0.createHeuristicMask()); 45 // image0.setMask(image0.createHeuristicMask());
53 image1.setMask(image1.createHeuristicMask()); 46 image1.setMask(image1.createHeuristicMask());
54 // image2.setMask(image2.createHeuristicMask()); 47 // image2.setMask(image2.createHeuristicMask());
55 // image3.setMask(image3.createHeuristicMask()); 48 // image3.setMask(image3.createHeuristicMask());
56 // image4.setMask(image4.createHeuristicMask()); 49 // image4.setMask(image4.createHeuristicMask());
57 // image5.setMask(image5.createHeuristicMask()); 50 // image5.setMask(image5.createHeuristicMask());
58 // image6->setMask(image6->createHeuristicMask()); 51 // image6->setMask(image6->createHeuristicMask());
59 // image_open->setMask(image_open->createHeuristicMask()); 52 // image_open->setMask(image_open->createHeuristicMask());
60 53
61 if ( !name ) 54 if ( !name )
62 setName( "PowerchordBase" ); 55 setName( "PowerchordBase" );
63 resize( 240, 284 ); 56 resize( 240, 284 );
64 setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, sizePolicy().hasHeightForWidth() ) ); 57 setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, sizePolicy().hasHeightForWidth() ) );
65 setMinimumSize( QSize( 240, 284 ) ); 58 setMinimumSize( QSize( 240, 284 ) );
66 setMaximumSize( QSize( 240, 284 ) ); 59 setMaximumSize( QSize( 240, 284 ) );
67 setCaption( tr( "Powerchord" ) ); 60 setCaption( tr( "Powerchord" ) );
68 61
69 tabs = new QTabWidget( this, "tabs" ); 62 tabs = new QTabWidget( this, "tabs" );
70 tabs->setEnabled( TRUE ); 63 tabs->setEnabled( TRUE );
71 tabs->setGeometry( QRect( 0, 0, 240, 286 ) ); 64 tabs->setGeometry( QRect( 0, 0, 240, 286 ) );
72 tabs->setTabPosition( QTabWidget::Bottom ); 65 tabs->setTabPosition( QTabWidget::Bottom );
73 66
74 tab = new QWidget( tabs, "tab" ); 67 tab = new QWidget( tabs, "tab" );
75 68
76 chordkey = new QComboBox( FALSE, tab, "chordkey" ); 69 chordkey = new QComboBox( FALSE, tab, "chordkey" );
77 chordkey->insertItem( tr( "maj" ) ); 70 chordkey->insertItem( tr( "maj" ) );
78 chordkey->insertItem( tr( "min" ) ); 71 chordkey->insertItem( tr( "min" ) );
79 chordkey->insertItem( tr( "7th" ) ); 72 chordkey->insertItem( tr( "7th" ) );
80 chordkey->insertItem( tr( "m7" ) ); 73 chordkey->insertItem( tr( "m7" ) );
81 chordkey->insertItem( tr( "maj7" ) ); 74 chordkey->insertItem( tr( "maj7" ) );
82 chordkey->insertItem( tr( "6th" ) ); 75 chordkey->insertItem( tr( "6th" ) );
83 chordkey->insertItem( tr( "m6th" ) ); 76 chordkey->insertItem( tr( "m6th" ) );
84 chordkey->insertItem( tr( "aug" ) ); 77 chordkey->insertItem( tr( "aug" ) );
85 chordkey->insertItem( tr( "dim" ) ); 78 chordkey->insertItem( tr( "dim" ) );
86 chordkey->insertItem( tr( "sus4" ) ); 79 chordkey->insertItem( tr( "sus4" ) );
87 chordkey->insertItem( tr( "7sus4" ) ); 80 chordkey->insertItem( tr( "7sus4" ) );
88 chordkey->insertItem( tr( "9th" ) ); 81 chordkey->insertItem( tr( "9th" ) );
89 chordkey->insertItem( tr( "add9" ) ); 82 chordkey->insertItem( tr( "add9" ) );
90 chordkey->insertItem( tr( "m9th" ) ); 83 chordkey->insertItem( tr( "m9th" ) );
91 chordkey->insertItem( tr( "maj9" ) ); 84 chordkey->insertItem( tr( "maj9" ) );
92 chordkey->insertItem( tr( "sus2" ) ); 85 chordkey->insertItem( tr( "sus2" ) );
93 chordkey->insertItem( tr( "7sus2" ) ); 86 chordkey->insertItem( tr( "7sus2" ) );
94 chordkey->insertItem( tr( "11th" ) ); 87 chordkey->insertItem( tr( "11th" ) );
95 chordkey->insertItem( tr( "m11th" ) ); 88 chordkey->insertItem( tr( "m11th" ) );
96 chordkey->insertItem( tr( "13th" ) ); 89 chordkey->insertItem( tr( "13th" ) );
97 chordkey->insertItem( tr( "m13th" ) ); 90 chordkey->insertItem( tr( "m13th" ) );
98 chordkey->insertItem( tr( "maj13" ) ); 91 chordkey->insertItem( tr( "maj13" ) );
99 chordkey->insertItem( tr( "6/9" ) ); 92 chordkey->insertItem( tr( "6/9" ) );
100 chordkey->insertItem( tr( "flat5" ) ); 93 chordkey->insertItem( tr( "flat5" ) );
101 chordkey->insertItem( tr( "7#9" ) ); 94 chordkey->insertItem( tr( "7#9" ) );
102 chordkey->insertItem( tr( QString::fromUtf8( "ø7" ) ) ); 95 chordkey->insertItem( tr( QString::fromUtf8( "ø7" ) ) );
103 chordkey->insertItem( tr( "5" ) ); 96 chordkey->insertItem( tr( "5" ) );
104 chordkey->setGeometry( QRect( 40, 0, 51, 21 ) ); 97 chordkey->setGeometry( QRect( 40, 0, 51, 21 ) );
105 98
106 chordfret = new QComboBox( FALSE, tab, "chordfret" ); 99 chordfret = new QComboBox( FALSE, tab, "chordfret" );
107 chordfret->insertItem( tr( "open" ) ); 100 chordfret->insertItem( tr( "open" ) );
108 chordfret->insertItem( tr( "1st" ) ); 101 chordfret->insertItem( tr( "1st" ) );
109 chordfret->insertItem( tr( "2nd" ) ); 102 chordfret->insertItem( tr( "2nd" ) );
110 chordfret->insertItem( tr( "3rd" ) ); 103 chordfret->insertItem( tr( "3rd" ) );
111 chordfret->insertItem( tr( "4th" ) ); 104 chordfret->insertItem( tr( "4th" ) );
112 chordfret->insertItem( tr( "5th" ) ); 105 chordfret->insertItem( tr( "5th" ) );
113 chordfret->insertItem( tr( "6th" ) ); 106 chordfret->insertItem( tr( "6th" ) );
114 chordfret->insertItem( tr( "7th" ) ); 107 chordfret->insertItem( tr( "7th" ) );
115 chordfret->insertItem( tr( "8th" ) ); 108 chordfret->insertItem( tr( "8th" ) );
116 chordfret->insertItem( tr( "9th" ) ); 109 chordfret->insertItem( tr( "9th" ) );
117 chordfret->insertItem( tr( "10th" ) ); 110 chordfret->insertItem( tr( "10th" ) );
118 chordfret->insertItem( tr( "11th" ) ); 111 chordfret->insertItem( tr( "11th" ) );
119 chordfret->insertItem( tr( "12th" ) ); 112 chordfret->insertItem( tr( "12th" ) );
120 chordfret->insertItem( tr( "13th" ) ); 113 chordfret->insertItem( tr( "13th" ) );
121 chordfret->insertItem( tr( "14th" ) ); 114 chordfret->insertItem( tr( "14th" ) );
122 chordfret->insertItem( tr( "15th" ) ); 115 chordfret->insertItem( tr( "15th" ) );
123 chordfret->insertItem( tr( "16th" ) ); 116 chordfret->insertItem( tr( "16th" ) );
diff --git a/noncore/multimedia/showimg/ImageFileSelector.cpp b/noncore/multimedia/showimg/ImageFileSelector.cpp
index d2b65a9..79ee925 100644
--- a/noncore/multimedia/showimg/ImageFileSelector.cpp
+++ b/noncore/multimedia/showimg/ImageFileSelector.cpp
@@ -1,115 +1,104 @@
1 1
2 2
3#include "qpe/global.h"
4#include "qpe/applnk.h"
5#include "qpe/lnkproperties.h"
6#include "qpe/applnk.h"
7#include "qpe/qpeapplication.h" 3#include "qpe/qpeapplication.h"
8 4
9#include <stdlib.h> 5#include <stdlib.h>
10 6
11#include <qdir.h>
12#include <qwidget.h>
13#include <qheader.h>
14#include <qimage.h>
15#include <qpixmap.h>
16#include <qlabel.h> 7#include <qlabel.h>
17#include <qfileinfo.h> 8#include <qfileinfo.h>
18#include <qpainter.h>
19#include <qscrollview.h>
20 9
21#include "ImageFileSelector.h" 10#include "ImageFileSelector.h"
22 11
23 12
24ThumbWidget::ThumbWidget(QPixmap p,QString text,const DocLnk& f,QWidget *parent,int w) 13ThumbWidget::ThumbWidget(QPixmap p,QString text,const DocLnk& f,QWidget *parent,int w)
25 : QWidget( parent ),fl(f) 14 : QWidget( parent ),fl(f)
26{ 15{
27 setBackgroundMode(NoBackground); 16 setBackgroundMode(NoBackground);
28 if ( w!=-1 ) 17 if ( w!=-1 )
29 setMinimumSize(w,p.height()+24); 18 setMinimumSize(w,p.height()+24);
30 else 19 else
31 setMinimumSize(p.width(),p.height()+24); 20 setMinimumSize(p.width(),p.height()+24);
32 description=new QLabel(text,this); 21 description=new QLabel(text,this);
33 description->setBackgroundColor(colorGroup().base()); 22 description->setBackgroundColor(colorGroup().base());
34 description->setAlignment(AlignCenter); 23 description->setAlignment(AlignCenter);
35 description->setGeometry(0,height()-24,width(),24); 24 description->setGeometry(0,height()-24,width(),24);
36 pixmap=p; 25 pixmap=p;
37} 26}
38 27
39void ThumbWidget::resizeEvent(QResizeEvent *) 28void ThumbWidget::resizeEvent(QResizeEvent *)
40{ 29{
41 description->setGeometry(0,height()-24,width(),24); 30 description->setGeometry(0,height()-24,width(),24);
42} 31}
43 32
44void ThumbWidget::paintEvent( QPaintEvent *e ) 33void ThumbWidget::paintEvent( QPaintEvent *e )
45{ 34{
46 QPainter painter(this); 35 QPainter painter(this);
47 36
48 painter.setClipRect(e->rect()); 37 painter.setClipRect(e->rect());
49 painter.fillRect(0,0,width(),height(),QColor(255,255,255)); 38 painter.fillRect(0,0,width(),height(),QColor(255,255,255));
50 painter.drawPixmap((width() - pixmap.width()) / 2,0, pixmap); 39 painter.drawPixmap((width() - pixmap.width()) / 2,0, pixmap);
51 40
52} 41}
53 42
54void ThumbWidget::mouseReleaseEvent(QMouseEvent* ) 43void ThumbWidget::mouseReleaseEvent(QMouseEvent* )
55{ 44{
56 emit clicked(fl); 45 emit clicked(fl);
57} 46}
58 47
59 48
60 49
61ImageFileSelectorItem::ImageFileSelectorItem( QListView *parent, const DocLnk &f) 50ImageFileSelectorItem::ImageFileSelectorItem( QListView *parent, const DocLnk &f)
62 : QListViewItem( parent ), fl( f ) 51 : QListViewItem( parent ), fl( f )
63{ 52{
64 setText( 0, f.name() ); 53 setText( 0, f.name() );
65 QFileInfo fi(f.file()); 54 QFileInfo fi(f.file());
66 setText( 1, (fi.extension()).upper() ); 55 setText( 1, (fi.extension()).upper() );
67 setPixmap( 0, f.pixmap() ); 56 setPixmap( 0, f.pixmap() );
68 57
69 58
70} 59}
71 60
72 61
73ImageFileSelectorItem::~ImageFileSelectorItem() 62ImageFileSelectorItem::~ImageFileSelectorItem()
74{ 63{
75 64
76} 65}
77 66
78 67
79ImageFileSelector::ImageFileSelector( CURRENT_VIEW scv,QWidget *parent,const char * ) 68ImageFileSelector::ImageFileSelector( CURRENT_VIEW scv,QWidget *parent,const char * )
80 : QWidgetStack(parent) 69 : QWidgetStack(parent)
81{ 70{
82 71
83 detailed=new QListView(this); 72 detailed=new QListView(this);
84 73
85 detailed->addColumn (tr("Title")); 74 detailed->addColumn (tr("Title"));
86 detailed->addColumn (tr("Type")); 75 detailed->addColumn (tr("Type"));
87 detailed->setAllColumnsShowFocus( true ); 76 detailed->setAllColumnsShowFocus( true );
88 77
89 tList.setAutoDelete(true); 78 tList.setAutoDelete(true);
90 79
91 thumb =new QScrollView(this); 80 thumb =new QScrollView(this);
92 thumb->setVScrollBarMode (QScrollView::Auto ); 81 thumb->setVScrollBarMode (QScrollView::Auto );
93 thumb->viewport()->setBackgroundColor(colorGroup().base()); 82 thumb->viewport()->setBackgroundColor(colorGroup().base());
94 83
95 background=new QWidget(0); 84 background=new QWidget(0);
96 background->setBackgroundColor(colorGroup().base()); 85 background->setBackgroundColor(colorGroup().base());
97 thumb->addChild(background); 86 thumb->addChild(background);
98 gl = new QGridLayout(background,1,2,4,4); 87 gl = new QGridLayout(background,1,2,4,4);
99 88
100 89
101 90
102 connect( detailed, SIGNAL( mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ), 91 connect( detailed, SIGNAL( mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ),
103 this, SLOT( fileClicked(int,QListViewItem*,const QPoint&,int) ) ); 92 this, SLOT( fileClicked(int,QListViewItem*,const QPoint&,int) ) );
104 connect( detailed, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ), 93 connect( detailed, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),
105 this, SLOT( filePressed(int,QListViewItem*,const QPoint&,int) ) ); 94 this, SLOT( filePressed(int,QListViewItem*,const QPoint&,int) ) );
106 connect( detailed, SIGNAL( returnPressed(QListViewItem*) ), 95 connect( detailed, SIGNAL( returnPressed(QListViewItem*) ),
107 this, SLOT( fileClicked(QListViewItem*) ) ); 96 this, SLOT( fileClicked(QListViewItem*) ) );
108 97
109 cView=UNKNOWN; 98 cView=UNKNOWN;
110 setView(scv); 99 setView(scv);
111 reread(); 100 reread();
112 101
113} 102}
114ImageFileSelector::~ImageFileSelector() 103ImageFileSelector::~ImageFileSelector()
115{ 104{
diff --git a/noncore/multimedia/showimg/main.cpp b/noncore/multimedia/showimg/main.cpp
index efb1c68..1c864e9 100644
--- a/noncore/multimedia/showimg/main.cpp
+++ b/noncore/multimedia/showimg/main.cpp
@@ -1,27 +1,26 @@
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 20
21#include "showimg.h" 21#include "showimg.h"
22 22
23#include <qpe/qpeapplication.h>
24 23
25#include <opie/oapplicationfactory.h> 24#include <opie/oapplicationfactory.h>
26 25
27OPIE_EXPORT_APP( OApplicationFactory<ImageViewer> ) \ No newline at end of file 26OPIE_EXPORT_APP( OApplicationFactory<ImageViewer> ) \ No newline at end of file
diff --git a/noncore/multimedia/showimg/settingsdialog.cpp b/noncore/multimedia/showimg/settingsdialog.cpp
index 55d555a..202bd0c 100644
--- a/noncore/multimedia/showimg/settingsdialog.cpp
+++ b/noncore/multimedia/showimg/settingsdialog.cpp
@@ -1,88 +1,86 @@
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 "settingsdialog.h" 21#include "settingsdialog.h"
22#include <qslider.h> 22#include <qslider.h>
23#include <qlabel.h> 23#include <qlabel.h>
24#include <qcheckbox.h> 24#include <qcheckbox.h>
25#include <qradiobutton.h>
26#include <qbuttongroup.h>
27 25
28SettingsDialog::SettingsDialog( QWidget *parent, const char *name, bool modal, WFlags f ) 26SettingsDialog::SettingsDialog( QWidget *parent, const char *name, bool modal, WFlags f )
29 : SettingsDialogBase( parent, name, modal, f ) 27 : SettingsDialogBase( parent, name, modal, f )
30{ 28{
31 connect( delaySlider, SIGNAL(valueChanged(int)), this, SLOT(delayChanged(int)) ); 29 connect( delaySlider, SIGNAL(valueChanged(int)), this, SLOT(delayChanged(int)) );
32} 30}
33 31
34void SettingsDialog::setDelay( int d ) 32void SettingsDialog::setDelay( int d )
35{ 33{
36 delaySlider->setValue( d ); 34 delaySlider->setValue( d );
37 delayChanged( d ); 35 delayChanged( d );
38} 36}
39 37
40int SettingsDialog::delay() const 38int SettingsDialog::delay() const
41{ 39{
42 return delaySlider->value(); 40 return delaySlider->value();
43} 41}
44 42
45void SettingsDialog::setRepeat( bool r ) 43void SettingsDialog::setRepeat( bool r )
46{ 44{
47 repeatCheck->setChecked( r ); 45 repeatCheck->setChecked( r );
48} 46}
49 47
50bool SettingsDialog::repeat() const 48bool SettingsDialog::repeat() const
51{ 49{
52 return repeatCheck->isChecked(); 50 return repeatCheck->isChecked();
53} 51}
54 52
55void SettingsDialog::delayChanged( int d ) 53void SettingsDialog::delayChanged( int d )
56{ 54{
57 delayText->setText( QString::number( d ) + " s" ); 55 delayText->setText( QString::number( d ) + " s" );
58} 56}
59 57
60void SettingsDialog::setReverse(bool r) 58void SettingsDialog::setReverse(bool r)
61{ 59{
62 reverseCheck->setChecked(r); 60 reverseCheck->setChecked(r);
63} 61}
64 62
65bool SettingsDialog::reverse() const 63bool SettingsDialog::reverse() const
66{ 64{
67 return reverseCheck->isChecked(); 65 return reverseCheck->isChecked();
68} 66}
69 67
70void SettingsDialog::setRotate(bool r) 68void SettingsDialog::setRotate(bool r)
71{ 69{
72 rotateCheck->setChecked(r); 70 rotateCheck->setChecked(r);
73} 71}
74 72
75bool SettingsDialog::rotate() const 73bool SettingsDialog::rotate() const
76{ 74{
77 return rotateCheck->isChecked(); 75 return rotateCheck->isChecked();
78} 76}
79 77
80void SettingsDialog::setFastLoad(bool f) 78void SettingsDialog::setFastLoad(bool f)
81{ 79{
82 fastLoadCheck->setChecked(f); 80 fastLoadCheck->setChecked(f);
83} 81}
84 82
85bool SettingsDialog::fastLoad() const 83bool SettingsDialog::fastLoad() const
86{ 84{
87 return fastLoadCheck->isChecked(); 85 return fastLoadCheck->isChecked();
88} 86}
diff --git a/noncore/multimedia/showimg/settingsdialogbase.cpp b/noncore/multimedia/showimg/settingsdialogbase.cpp
index e0c5bb0..7a64e89 100644
--- a/noncore/multimedia/showimg/settingsdialogbase.cpp
+++ b/noncore/multimedia/showimg/settingsdialogbase.cpp
@@ -1,106 +1,102 @@
1/**************************************************************************** 1/****************************************************************************
2** Form implementation generated from reading ui file 'settingsdialogbase.ui' 2** Form implementation generated from reading ui file 'settingsdialogbase.ui'
3** 3**
4** Created: Sun Nov 3 07:29:03 2002 4** Created: Sun Nov 3 07:29:03 2002
5** by: The User Interface Compiler (uic) 5** by: The User Interface Compiler (uic)
6** 6**
7** WARNING! All changes made in this file will be lost! 7** WARNING! All changes made in this file will be lost!
8****************************************************************************/ 8****************************************************************************/
9#include "settingsdialogbase.h" 9#include "settingsdialogbase.h"
10 10
11#include <qcheckbox.h> 11#include <qcheckbox.h>
12#include <qgroupbox.h> 12#include <qgroupbox.h>
13#include <qlabel.h> 13#include <qlabel.h>
14#include <qpushbutton.h>
15#include <qslider.h> 14#include <qslider.h>
16#include <qlayout.h> 15#include <qlayout.h>
17#include <qvariant.h>
18#include <qtooltip.h>
19#include <qwhatsthis.h>
20 16
21/* 17/*
22 * Constructs a SettingsDialogBase which is a child of 'parent', with the 18 * Constructs a SettingsDialogBase which is a child of 'parent', with the
23 * name 'name' and widget flags set to 'f' 19 * name 'name' and widget flags set to 'f'
24 * 20 *
25 * The dialog will by default be modeless, unless you set 'modal' to 21 * The dialog will by default be modeless, unless you set 'modal' to
26 * TRUE to construct a modal dialog. 22 * TRUE to construct a modal dialog.
27 */ 23 */
28SettingsDialogBase::SettingsDialogBase( QWidget* parent, const char* name, bool modal, WFlags fl ) 24SettingsDialogBase::SettingsDialogBase( QWidget* parent, const char* name, bool modal, WFlags fl )
29 : QDialog( parent, name, modal, fl ) 25 : QDialog( parent, name, modal, fl )
30{ 26{
31 if ( !name ) 27 if ( !name )
32 setName( "SettingsDialogBase" ); 28 setName( "SettingsDialogBase" );
33 resize( 246, 201 ); 29 resize( 246, 201 );
34 setCaption( tr( "Preferences" ) ); 30 setCaption( tr( "Preferences" ) );
35 SettingsDialogBaseLayout = new QVBoxLayout( this ); 31 SettingsDialogBaseLayout = new QVBoxLayout( this );
36 SettingsDialogBaseLayout->setSpacing( 6 ); 32 SettingsDialogBaseLayout->setSpacing( 6 );
37 SettingsDialogBaseLayout->setMargin( 6 ); 33 SettingsDialogBaseLayout->setMargin( 6 );
38 34
39 GroupBox1 = new QGroupBox( this, "GroupBox1" ); 35 GroupBox1 = new QGroupBox( this, "GroupBox1" );
40 GroupBox1->setTitle( tr( "Slide Show" ) ); 36 GroupBox1->setTitle( tr( "Slide Show" ) );
41 GroupBox1->setColumnLayout(0, Qt::Vertical ); 37 GroupBox1->setColumnLayout(0, Qt::Vertical );
42 GroupBox1->layout()->setSpacing( 0 ); 38 GroupBox1->layout()->setSpacing( 0 );
43 GroupBox1->layout()->setMargin( 0 ); 39 GroupBox1->layout()->setMargin( 0 );
44 GroupBox1Layout = new QVBoxLayout( GroupBox1->layout() ); 40 GroupBox1Layout = new QVBoxLayout( GroupBox1->layout() );
45 GroupBox1Layout->setAlignment( Qt::AlignTop ); 41 GroupBox1Layout->setAlignment( Qt::AlignTop );
46 GroupBox1Layout->setSpacing( 6 ); 42 GroupBox1Layout->setSpacing( 6 );
47 GroupBox1Layout->setMargin( 11 ); 43 GroupBox1Layout->setMargin( 11 );
48 44
49 Layout3 = new QGridLayout; 45 Layout3 = new QGridLayout;
50 Layout3->setSpacing( 6 ); 46 Layout3->setSpacing( 6 );
51 Layout3->setMargin( 0 ); 47 Layout3->setMargin( 0 );
52 48
53 TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); 49 TextLabel1 = new QLabel( GroupBox1, "TextLabel1" );
54 TextLabel1->setText( tr( "Delay between pictures" ) ); 50 TextLabel1->setText( tr( "Delay between pictures" ) );
55 51
56 Layout3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); 52 Layout3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 );
57 53
58 delaySlider = new QSlider( GroupBox1, "delaySlider" ); 54 delaySlider = new QSlider( GroupBox1, "delaySlider" );
59 delaySlider->setMinValue( 2 ); 55 delaySlider->setMinValue( 2 );
60 delaySlider->setMaxValue( 60 ); 56 delaySlider->setMaxValue( 60 );
61 delaySlider->setLineStep( 2 ); 57 delaySlider->setLineStep( 2 );
62 delaySlider->setOrientation( QSlider::Horizontal ); 58 delaySlider->setOrientation( QSlider::Horizontal );
63 delaySlider->setTickmarks( QSlider::Right ); 59 delaySlider->setTickmarks( QSlider::Right );
64 delaySlider->setTickInterval( 10); 60 delaySlider->setTickInterval( 10);
65 61
66 Layout3->addWidget( delaySlider, 1, 0 ); 62 Layout3->addWidget( delaySlider, 1, 0 );
67 63
68 delayText = new QLabel( GroupBox1, "delayText" ); 64 delayText = new QLabel( GroupBox1, "delayText" );
69 delayText->setMinimumSize( QSize( 25, 0 ) ); 65 delayText->setMinimumSize( QSize( 25, 0 ) );
70 delayText->setText( tr( "s" ) ); 66 delayText->setText( tr( "s" ) );
71 delayText->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); 67 delayText->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
72 68
73 Layout3->addWidget( delayText, 1, 1 ); 69 Layout3->addWidget( delayText, 1, 1 );
74 GroupBox1Layout->addLayout( Layout3 ); 70 GroupBox1Layout->addLayout( Layout3 );
75 71
76 repeatCheck = new QCheckBox( GroupBox1, "repeatCheck" ); 72 repeatCheck = new QCheckBox( GroupBox1, "repeatCheck" );
77 repeatCheck->setText( tr( "Repeat slideshow" ) ); 73 repeatCheck->setText( tr( "Repeat slideshow" ) );
78 GroupBox1Layout->addWidget( repeatCheck ); 74 GroupBox1Layout->addWidget( repeatCheck );
79 75
80 reverseCheck = new QCheckBox( GroupBox1, "reverseCheck" ); 76 reverseCheck = new QCheckBox( GroupBox1, "reverseCheck" );
81 reverseCheck->setText( tr( "Show pictures in reverse" ) ); 77 reverseCheck->setText( tr( "Show pictures in reverse" ) );
82 GroupBox1Layout->addWidget( reverseCheck ); 78 GroupBox1Layout->addWidget( reverseCheck );
83 SettingsDialogBaseLayout->addWidget( GroupBox1 ); 79 SettingsDialogBaseLayout->addWidget( GroupBox1 );
84 80
85 rotateCheck = new QCheckBox( this, "rotateCheck" ); 81 rotateCheck = new QCheckBox( this, "rotateCheck" );
86 rotateCheck->setText( tr( "Load pictures rotated 90 degrees" ) ); 82 rotateCheck->setText( tr( "Load pictures rotated 90 degrees" ) );
87 SettingsDialogBaseLayout->addWidget( rotateCheck ); 83 SettingsDialogBaseLayout->addWidget( rotateCheck );
88 84
89 fastLoadCheck = new QCheckBox( this, "fastLoadCheck" ); 85 fastLoadCheck = new QCheckBox( this, "fastLoadCheck" );
90 fastLoadCheck->setText( tr( "Fast load pictures" ) ); 86 fastLoadCheck->setText( tr( "Fast load pictures" ) );
91 SettingsDialogBaseLayout->addWidget( fastLoadCheck ); 87 SettingsDialogBaseLayout->addWidget( fastLoadCheck );
92 fastLoadCheck->hide(); //FIXME 88 fastLoadCheck->hide(); //FIXME
93// QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding ); 89// QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding );
94// layout->addItem( spacer, 10, 0 ); 90// layout->addItem( spacer, 10, 0 );
95 91
96 92
97} 93}
98 94
99/* 95/*
100 * Destroys the object and frees any allocated resources 96 * Destroys the object and frees any allocated resources
101 */ 97 */
102SettingsDialogBase::~SettingsDialogBase() 98SettingsDialogBase::~SettingsDialogBase()
103{ 99{
104 // no need to delete child widgets, Qt does it all for us 100 // no need to delete child widgets, Qt does it all for us
105} 101}
106 102
diff --git a/noncore/multimedia/showimg/showimg.cpp b/noncore/multimedia/showimg/showimg.cpp
index 02a1d91..82eac33 100644
--- a/noncore/multimedia/showimg/showimg.cpp
+++ b/noncore/multimedia/showimg/showimg.cpp
@@ -1,148 +1,135 @@
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 20
21// 21//
22// Full-screen and rotation options contributed by Robert Wittams <robert@wittams.com> 22// Full-screen and rotation options contributed by Robert Wittams <robert@wittams.com>
23// 23//
24 24
25#include "showimg.h" 25#include "showimg.h"
26#include "ImageFileSelector.h" 26#include "ImageFileSelector.h"
27#include "settingsdialog.h" 27#include "settingsdialog.h"
28 28
29 29
30#include <opie/ofiledialog.h> 30#include <opie/ofiledialog.h>
31 31
32#include <qpe/qpeapplication.h> 32#include <qpe/qpeapplication.h>
33#include <qpe/config.h> 33#include <qpe/config.h>
34#include <qpe/resource.h> 34#include <qpe/resource.h>
35#include <qpe/fileselector.h>
36#include <qpe/applnk.h>
37#include <qfileinfo.h>
38#include <math.h> 35#include <math.h>
39#include <qmenubar.h> 36#include <qmenubar.h>
40#include <qwidgetstack.h>
41#include <qpe/qpetoolbar.h> 37#include <qpe/qpetoolbar.h>
42#include <qaction.h> 38#include <qaction.h>
43#include <qfiledialog.h> 39#include <qfiledialog.h>
44#include <qmessagebox.h>
45#include <qpopupmenu.h>
46#include <qscrollview.h>
47#include <qlabel.h>
48#include <qpainter.h>
49#include <qkeycode.h>
50#include <qapplication.h>
51#include <qclipboard.h>
52#include <qtimer.h>
53#include <qspinbox.h> 40#include <qspinbox.h>
54 41
55 42
56 43
57ControlsDialog::ControlsDialog(const QString &caption,QImage image,int *brightness,QWidget *parent) 44ControlsDialog::ControlsDialog(const QString &caption,QImage image,int *brightness,QWidget *parent)
58 : QDialog(parent,0,true) 45 : QDialog(parent,0,true)
59{ 46{
60 setCaption(caption); 47 setCaption(caption);
61 48
62 if ( parent ) { 49 if ( parent ) {
63 setPalette(parent->palette()); 50 setPalette(parent->palette());
64 } 51 }
65 52
66 b=brightness; 53 b=brightness;
67 img=image; 54 img=image;
68 55
69 setMinimumSize(140,80); 56 setMinimumSize(140,80);
70 57
71 QGridLayout *gl= new QGridLayout(this,2,2,4,4); 58 QGridLayout *gl= new QGridLayout(this,2,2,4,4);
72 59
73 pixmap =new ImageWidget(this);; 60 pixmap =new ImageWidget(this);;
74 QPixmap pm; 61 QPixmap pm;
75 pm.convertFromImage(img); 62 pm.convertFromImage(img);
76 pixmap->setPixmap(pm); 63 pixmap->setPixmap(pm);
77 pixmap->setMinimumSize(pm.width(),pm.height()); 64 pixmap->setMinimumSize(pm.width(),pm.height());
78 gl->addMultiCellWidget(pixmap,0,0,0,2,AlignCenter); 65 gl->addMultiCellWidget(pixmap,0,0,0,2,AlignCenter);
79 QLabel *l=new QLabel(tr("Brightness")+":",this); 66 QLabel *l=new QLabel(tr("Brightness")+":",this);
80 gl->addWidget(l,1,0,AlignLeft); 67 gl->addWidget(l,1,0,AlignLeft);
81 spb=new QSpinBox(-100,100,2,this); 68 spb=new QSpinBox(-100,100,2,this);
82 gl->addWidget(spb,1,1,AlignRight); 69 gl->addWidget(spb,1,1,AlignRight);
83 70
84 spb->setValue(0); 71 spb->setValue(0);
85 72
86 connect(spb,SIGNAL(valueChanged(int)),this, SLOT(bValueChanged(int))); 73 connect(spb,SIGNAL(valueChanged(int)),this, SLOT(bValueChanged(int)));
87 74
88} 75}
89 76
90void ControlsDialog::bValueChanged(int value) 77void ControlsDialog::bValueChanged(int value)
91{ 78{
92 QImage nImage=img; 79 QImage nImage=img;
93 nImage.detach(); 80 nImage.detach();
94 ImageViewer::intensity(nImage, (float)value/100); 81 ImageViewer::intensity(nImage, (float)value/100);
95 QPixmap pm; 82 QPixmap pm;
96 pm.convertFromImage(nImage); 83 pm.convertFromImage(nImage);
97 pixmap->setPixmap(pm); 84 pixmap->setPixmap(pm);
98 pixmap->repaint(false); 85 pixmap->repaint(false);
99 86
100 87
101} 88}
102 89
103void ControlsDialog::accept() 90void ControlsDialog::accept()
104{ 91{
105 *b=spb->value(); 92 *b=spb->value();
106 done(1); 93 done(1);
107} 94}
108 95
109//=========================================================================== 96//===========================================================================
110 97
111InfoDialog::InfoDialog(const QString &caption, const QStringList text,QWidget *parent) 98InfoDialog::InfoDialog(const QString &caption, const QStringList text,QWidget *parent)
112 : QDialog(parent,0,true) 99 : QDialog(parent,0,true)
113{ 100{
114 setCaption(caption); 101 setCaption(caption);
115 102
116 if ( parent ) 103 if ( parent )
117 { 104 {
118 setPalette(parent->palette()); 105 setPalette(parent->palette());
119 } 106 }
120 107
121 108
122 109
123 QString labels[]={ tr("File Name"),tr("Format"),tr("File Size"),tr("Size"),tr("Colors"),tr("Alpha") }; 110 QString labels[]={ tr("File Name"),tr("Format"),tr("File Size"),tr("Size"),tr("Colors"),tr("Alpha") };
124 111
125 setMinimumSize(180,80); 112 setMinimumSize(180,80);
126 int num=ImageViewer::LAST+1; 113 int num=ImageViewer::LAST+1;
127 if ( text[ImageViewer::ALPHA].isEmpty() ) 114 if ( text[ImageViewer::ALPHA].isEmpty() )
128 num--; 115 num--;
129 QGridLayout *gl= new QGridLayout(this,num,2,4,2); 116 QGridLayout *gl= new QGridLayout(this,num,2,4,2);
130 QLabel *l; 117 QLabel *l;
131 int count=0; 118 int count=0;
132 for ( int i=0;i<num;i++ ) 119 for ( int i=0;i<num;i++ )
133 { 120 {
134 if ( i==1 ) 121 if ( i==1 )
135 { 122 {
136 QFrame *frm=new QFrame(this); 123 QFrame *frm=new QFrame(this);
137 frm->setFrameStyle(QFrame::HLine|QFrame::Sunken); 124 frm->setFrameStyle(QFrame::HLine|QFrame::Sunken);
138 gl->addMultiCellWidget(frm,i,i,0,1); 125 gl->addMultiCellWidget(frm,i,i,0,1);
139 } 126 }
140 else 127 else
141 { 128 {
142 l=new QLabel( tr( labels[count] )+":",this); 129 l=new QLabel( tr( labels[count] )+":",this);
143 gl->addWidget(l,i,0,AlignLeft); 130 gl->addWidget(l,i,0,AlignLeft);
144 l=new QLabel(text[count],this); 131 l=new QLabel(text[count],this);
145 gl->addWidget(l,i,1,AlignRight); 132 gl->addWidget(l,i,1,AlignRight);
146 count++; 133 count++;
147 } 134 }
148 135
diff --git a/noncore/multimedia/tonleiter/editinst.cpp b/noncore/multimedia/tonleiter/editinst.cpp
index 5616569..ccb4560 100644
--- a/noncore/multimedia/tonleiter/editinst.cpp
+++ b/noncore/multimedia/tonleiter/editinst.cpp
@@ -1,99 +1,98 @@
1#include "editinst.h" 1#include "editinst.h"
2 2
3#include <qlabel.h>
4#include <qpushbutton.h> 3#include <qpushbutton.h>
5 4
6#include <qpe/qpeapplication.h> 5#include <qpe/qpeapplication.h>
7 6
8Menu::InstEditDialog::InstEditDialog(TonleiterData* data,QWidget* parent,const char* name) 7Menu::InstEditDialog::InstEditDialog(TonleiterData* data,QWidget* parent,const char* name)
9:QDialog(parent,name,true,0),data(data) 8:QDialog(parent,name,true,0),data(data)
10{ 9{
11 setCaption("Tonleiter::"+tr("Instrument")); 10 setCaption("Tonleiter::"+tr("Instrument"));
12 QBoxLayout* masterlayout=new QBoxLayout(this,QBoxLayout::TopToBottom); 11 QBoxLayout* masterlayout=new QBoxLayout(this,QBoxLayout::TopToBottom);
13 instid=data->getCurrentInstrumentID(); 12 instid=data->getCurrentInstrumentID();
14 stringlist.setAutoDelete(true); 13 stringlist.setAutoDelete(true);
15 14
16 QBoxLayout* toplayout=new QBoxLayout(masterlayout,QBoxLayout::LeftToRight); 15 QBoxLayout* toplayout=new QBoxLayout(masterlayout,QBoxLayout::LeftToRight);
17 16
18 //Name combo + Add + Delete 17 //Name combo + Add + Delete
19 boxInst=new QComboBox(this,"boxInst"); 18 boxInst=new QComboBox(this,"boxInst");
20 boxInst->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); 19 boxInst->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum));
21 connect(boxInst,SIGNAL(activated(int)),this,SLOT(setCurrentInstrumetID(int))); 20 connect(boxInst,SIGNAL(activated(int)),this,SLOT(setCurrentInstrumetID(int)));
22 for(int i=0;i<data->noOfInstruments();i++) 21 for(int i=0;i<data->noOfInstruments();i++)
23 { 22 {
24 Instrument inst=data->getInstrument(i); 23 Instrument inst=data->getInstrument(i);
25 QString name=inst.instName(); 24 QString name=inst.instName();
26 if(name.isNull()) continue; 25 if(name.isNull()) continue;
27 boxInst->insertItem(name,i); 26 boxInst->insertItem(name,i);
28 } 27 }
29 boxInst->setCurrentItem(instid); 28 boxInst->setCurrentItem(instid);
30 toplayout->addWidget(boxInst); 29 toplayout->addWidget(boxInst);
31 30
32 QPushButton* addButton=new QPushButton(tr("Add"),this,"addButton"); 31 QPushButton* addButton=new QPushButton(tr("Add"),this,"addButton");
33 connect(addButton,SIGNAL(pressed()),this,SLOT(addInstrument())); 32 connect(addButton,SIGNAL(pressed()),this,SLOT(addInstrument()));
34 toplayout->addWidget(addButton); 33 toplayout->addWidget(addButton);
35 34
36 QPushButton* delButton=new QPushButton(tr("Delete"),this,"delButton"); 35 QPushButton* delButton=new QPushButton(tr("Delete"),this,"delButton");
37 connect(delButton,SIGNAL(pressed()),this,SLOT(deleteInstrument())); 36 connect(delButton,SIGNAL(pressed()),this,SLOT(deleteInstrument()));
38 toplayout->addWidget(delButton); 37 toplayout->addWidget(delButton);
39 38
40 QPushButton* addhighButton=new QPushButton(tr("Add High String"),this,"addhighButton"); 39 QPushButton* addhighButton=new QPushButton(tr("Add High String"),this,"addhighButton");
41 masterlayout->addWidget(addhighButton); 40 masterlayout->addWidget(addhighButton);
42 41
43 scrollview=new QScrollView(this); 42 scrollview=new QScrollView(this);
44 scrollview->setVScrollBarMode(QScrollView::AlwaysOn); 43 scrollview->setVScrollBarMode(QScrollView::AlwaysOn);
45 scrollview->setHScrollBarMode(QScrollView::AlwaysOff); 44 scrollview->setHScrollBarMode(QScrollView::AlwaysOff);
46 stringwidget=new QVBox(scrollview->viewport()); 45 stringwidget=new QVBox(scrollview->viewport());
47 stringwidget->setSizePolicy(QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum)); 46 stringwidget->setSizePolicy(QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum));
48 stringwidget->setSpacing(10); 47 stringwidget->setSpacing(10);
49 scrollview->addChild(stringwidget); 48 scrollview->addChild(stringwidget);
50 scrollview->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); 49 scrollview->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum));
51 masterlayout->addWidget(scrollview); 50 masterlayout->addWidget(scrollview);
52 51
53 loadInstrument(); 52 loadInstrument();
54 53
55 QPushButton* addlowButton=new QPushButton(tr("Add Low String"),this,"addlowButton"); 54 QPushButton* addlowButton=new QPushButton(tr("Add Low String"),this,"addlowButton");
56 masterlayout->addWidget(addlowButton); 55 masterlayout->addWidget(addlowButton);
57 56
58 //make dialog fit the screen 57 //make dialog fit the screen
59 QPEApplication::showDialog( this ); 58 QPEApplication::showDialog( this );
60} 59}
61//**************************************************************************** 60//****************************************************************************
62Menu::InstEditDialog::~InstEditDialog() 61Menu::InstEditDialog::~InstEditDialog()
63{ 62{
64} 63}
65//**************************************************************************** 64//****************************************************************************
66void Menu::InstEditDialog::setCurrentInstrumetID(int id) 65void Menu::InstEditDialog::setCurrentInstrumetID(int id)
67{ 66{
68 saveInstrument(); 67 saveInstrument();
69 instid=id; 68 instid=id;
70 data->setCurrentInstrumetID(id); 69 data->setCurrentInstrumetID(id);
71 loadInstrument(); 70 loadInstrument();
72} 71}
73//**************************************************************************** 72//****************************************************************************
74void Menu::InstEditDialog::addInstrument() 73void Menu::InstEditDialog::addInstrument()
75{ 74{
76} 75}
77//**************************************************************************** 76//****************************************************************************
78void Menu::InstEditDialog::deleteInstrument() 77void Menu::InstEditDialog::deleteInstrument()
79{ 78{
80} 79}
81//**************************************************************************** 80//****************************************************************************
82void Menu::InstEditDialog::addLowString() 81void Menu::InstEditDialog::addLowString()
83{ 82{
84} 83}
85//**************************************************************************** 84//****************************************************************************
86void Menu::InstEditDialog::addHighString() 85void Menu::InstEditDialog::addHighString()
87{ 86{
88} 87}
89//**************************************************************************** 88//****************************************************************************
90void Menu::InstEditDialog::deleteString(int id) 89void Menu::InstEditDialog::deleteString(int id)
91{ 90{
92} 91}
93//**************************************************************************** 92//****************************************************************************
94void Menu::InstEditDialog::saveInstrument() 93void Menu::InstEditDialog::saveInstrument()
95{ 94{
96 //auto delete is set to true so widgets _should_ be deleted 95 //auto delete is set to true so widgets _should_ be deleted
97 stringlist.clear(); 96 stringlist.clear();
98} 97}
99//**************************************************************************** 98//****************************************************************************
diff --git a/noncore/multimedia/tonleiter/editstringwidget.cpp b/noncore/multimedia/tonleiter/editstringwidget.cpp
index d22bbc5..33dc6e1 100644
--- a/noncore/multimedia/tonleiter/editstringwidget.cpp
+++ b/noncore/multimedia/tonleiter/editstringwidget.cpp
@@ -1,32 +1,31 @@
1#include "editstringwidget.h" 1#include "editstringwidget.h"
2 2
3#include <qlabel.h>
4#include <qlayout.h> 3#include <qlayout.h>
5 4
6using namespace Data; 5using namespace Data;
7 6
8Menu::EditStringWidget::EditStringWidget(int note,QWidget* parent,const char* name,WFlags f) 7Menu::EditStringWidget::EditStringWidget(int note,QWidget* parent,const char* name,WFlags f)
9:QFrame(parent,name,f) 8:QFrame(parent,name,f)
10{ 9{
11 QBoxLayout* layout=new QBoxLayout(this,QBoxLayout::LeftToRight,10); 10 QBoxLayout* layout=new QBoxLayout(this,QBoxLayout::LeftToRight,10);
12 11
13 boxNote=new QComboBox(this,"boxNote"); 12 boxNote=new QComboBox(this,"boxNote");
14 boxNote->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); 13 boxNote->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum));
15 //connect(boxNote,SIGNAL(activated(int)),data,SLOT(setCurrentNote(int))); 14 //connect(boxNote,SIGNAL(activated(int)),data,SLOT(setCurrentNote(int)));
16 layout->addWidget(boxNote,1,1); 15 layout->addWidget(boxNote,1,1);
17 for(int a=0;a<12;a++) 16 for(int a=0;a<12;a++)
18 boxNote->insertItem(Note::notenames[a],a); 17 boxNote->insertItem(Note::notenames[a],a);
19 boxNote->setCurrentItem(note-12*Note::getOctaveOfNote(note)); 18 boxNote->setCurrentItem(note-12*Note::getOctaveOfNote(note));
20 layout->addWidget(boxNote); 19 layout->addWidget(boxNote);
21 20
22 setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); 21 setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum));
23 setFrameShape(QFrame::Panel); 22 setFrameShape(QFrame::Panel);
24 setFrameShadow(QFrame::Sunken); 23 setFrameShadow(QFrame::Sunken);
25 24
26} 25}
27//**************************************************************************** 26//****************************************************************************
28Menu::EditStringWidget::~EditStringWidget() 27Menu::EditStringWidget::~EditStringWidget()
29{ 28{
30} 29}
31//**************************************************************************** 30//****************************************************************************
32//**************************************************************************** 31//****************************************************************************
diff --git a/noncore/multimedia/tonleiter/mainwidget.cpp b/noncore/multimedia/tonleiter/mainwidget.cpp
index b9c3d01..db16541 100644
--- a/noncore/multimedia/tonleiter/mainwidget.cpp
+++ b/noncore/multimedia/tonleiter/mainwidget.cpp
@@ -1,45 +1,44 @@
1#include "mainwidget.h" 1#include "mainwidget.h"
2 2
3#include <qwidget.h>
4#include <qlayout.h> 3#include <qlayout.h>
5 4
6MainWidget::MainWidget(QWidget* parent,const char* name,WFlags f) 5MainWidget::MainWidget(QWidget* parent,const char* name,WFlags f)
7:QMainWindow(parent,name,f) 6:QMainWindow(parent,name,f)
8{ 7{
9 setCaption("Tonleiter"); 8 setCaption("Tonleiter");
10 data=new Data::TonleiterData(this); 9 data=new Data::TonleiterData(this);
11 10
12 QWidget* mainwidget=new QWidget(this,"mainwidget"); 11 QWidget* mainwidget=new QWidget(this,"mainwidget");
13 setCentralWidget(mainwidget); 12 setCentralWidget(mainwidget);
14 QBoxLayout* mainlayout=new QBoxLayout(mainwidget,QBoxLayout::TopToBottom); 13 QBoxLayout* mainlayout=new QBoxLayout(mainwidget,QBoxLayout::TopToBottom);
15 14
16 menuwidget=new Menu::MenuWidget(data,mainwidget); 15 menuwidget=new Menu::MenuWidget(data,mainwidget);
17 mainlayout->addWidget(menuwidget); 16 mainlayout->addWidget(menuwidget);
18 17
19 fretboard=new Graph::FretBoard(data,mainwidget); 18 fretboard=new Graph::FretBoard(data,mainwidget);
20 connect(fretboard,SIGNAL(pressed()),this,SLOT(fretboardPressed())); 19 connect(fretboard,SIGNAL(pressed()),this,SLOT(fretboardPressed()));
21 mainlayout->addWidget(fretboard); 20 mainlayout->addWidget(fretboard);
22 21
23 showmenu=true; 22 showmenu=true;
24 23
25} 24}
26//**************************************************************************** 25//****************************************************************************
27MainWidget::~MainWidget() 26MainWidget::~MainWidget()
28{ 27{
29} 28}
30//**************************************************************************** 29//****************************************************************************
31void MainWidget::fretboardPressed() 30void MainWidget::fretboardPressed()
32{ 31{
33 if(showmenu) 32 if(showmenu)
34 { 33 {
35 menuwidget->hide(); 34 menuwidget->hide();
36 showmenu=false; 35 showmenu=false;
37 } 36 }
38 else 37 else
39 { 38 {
40 menuwidget->show(); 39 menuwidget->show();
41 showmenu=true; 40 showmenu=true;
42 } 41 }
43} 42}
44//**************************************************************************** 43//****************************************************************************
45//**************************************************************************** 44//****************************************************************************
diff --git a/noncore/multimedia/tonleiter/menuwidget.cpp b/noncore/multimedia/tonleiter/menuwidget.cpp
index 56a2f8a..91d052e 100644
--- a/noncore/multimedia/tonleiter/menuwidget.cpp
+++ b/noncore/multimedia/tonleiter/menuwidget.cpp
@@ -1,100 +1,98 @@
1#include "menuwidget.h" 1#include "menuwidget.h"
2 2
3#include <qlabel.h>
4#include <qlayout.h>
5 3
6#include "editinst.h" 4#include "editinst.h"
7#include "editscale.h" 5#include "editscale.h"
8 6
9Menu::MenuWidget::MenuWidget(TonleiterData* data,QWidget* parent,const char* name,WFlags f) 7Menu::MenuWidget::MenuWidget(TonleiterData* data,QWidget* parent,const char* name,WFlags f)
10:QWidget(parent,name,f),data(data) 8:QWidget(parent,name,f),data(data)
11{ 9{
12 QGridLayout* layout=new QGridLayout(this,3,3,10,-1,"menulayout"); 10 QGridLayout* layout=new QGridLayout(this,3,3,10,-1,"menulayout");
13 11
14 //Instrument 12 //Instrument
15 QLabel* instLabel=new QLabel(tr("Instr."),this,"instLabel"); 13 QLabel* instLabel=new QLabel(tr("Instr."),this,"instLabel");
16 instLabel->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); 14 instLabel->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum));
17 layout->addWidget(instLabel,0,0); 15 layout->addWidget(instLabel,0,0);
18 16
19 boxInst=new QComboBox(this,"boxInst"); 17 boxInst=new QComboBox(this,"boxInst");
20 boxInst->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); 18 boxInst->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum));
21 connect(boxInst,SIGNAL(activated(int)),data,SLOT(setCurrentInstrumetID(int))); 19 connect(boxInst,SIGNAL(activated(int)),data,SLOT(setCurrentInstrumetID(int)));
22 layout->addWidget(boxInst,0,1); 20 layout->addWidget(boxInst,0,1);
23 21
24 editInst=new QPushButton(tr("Edit"),this,"editInst"); 22 editInst=new QPushButton(tr("Edit"),this,"editInst");
25 editInst->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); 23 editInst->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum));
26 connect(editInst,SIGNAL(pressed()),this,SLOT(editInstPressed())); 24 connect(editInst,SIGNAL(pressed()),this,SLOT(editInstPressed()));
27 layout->addWidget(editInst,0,2); 25 layout->addWidget(editInst,0,2);
28 26
29 //Note 27 //Note
30 QLabel* noteLabel=new QLabel(tr("Note"),this,"noteLabel"); 28 QLabel* noteLabel=new QLabel(tr("Note"),this,"noteLabel");
31 noteLabel->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); 29 noteLabel->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum));
32 layout->addWidget(noteLabel,1,0); 30 layout->addWidget(noteLabel,1,0);
33 31
34 boxNote=new QComboBox(this,"boxNote"); 32 boxNote=new QComboBox(this,"boxNote");
35 boxNote->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); 33 boxNote->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum));
36 connect(boxNote,SIGNAL(activated(int)),data,SLOT(setCurrentNote(int))); 34 connect(boxNote,SIGNAL(activated(int)),data,SLOT(setCurrentNote(int)));
37 layout->addWidget(boxNote,1,1); 35 layout->addWidget(boxNote,1,1);
38 for(int a=0;a<12;a++) 36 for(int a=0;a<12;a++)
39 boxNote->insertItem(Note::notenames[a],a); 37 boxNote->insertItem(Note::notenames[a],a);
40 boxNote->setCurrentItem(data->getCurrentBaseNote()); 38 boxNote->setCurrentItem(data->getCurrentBaseNote());
41 39
42 noteCheck=new QCheckBox(tr("show"),this,"noteCheck"); 40 noteCheck=new QCheckBox(tr("show"),this,"noteCheck");
43 noteCheck->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); 41 noteCheck->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum));
44 noteCheck->setChecked(data->isDrawNames()); 42 noteCheck->setChecked(data->isDrawNames());
45 connect(noteCheck,SIGNAL(toggled(bool)),data,SLOT(setDrawNames(bool))); 43 connect(noteCheck,SIGNAL(toggled(bool)),data,SLOT(setDrawNames(bool)));
46 layout->addWidget(noteCheck,1,2); 44 layout->addWidget(noteCheck,1,2);
47 45
48 //Scale 46 //Scale
49 QLabel* scaleLabel=new QLabel(tr("Scale"),this,"scaleLabel"); 47 QLabel* scaleLabel=new QLabel(tr("Scale"),this,"scaleLabel");
50 scaleLabel->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); 48 scaleLabel->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum));
51 layout->addWidget(scaleLabel,2,0); 49 layout->addWidget(scaleLabel,2,0);
52 50
53 boxScale=new QComboBox(this,"boxScale"); 51 boxScale=new QComboBox(this,"boxScale");
54 boxScale->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); 52 boxScale->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum));
55 connect(boxScale,SIGNAL(activated(int)),data,SLOT(setCurrentScaleID(int))); 53 connect(boxScale,SIGNAL(activated(int)),data,SLOT(setCurrentScaleID(int)));
56 layout->addWidget(boxScale,2,1); 54 layout->addWidget(boxScale,2,1);
57 55
58 editScale=new QPushButton(tr("Edit"),this,"editScale"); 56 editScale=new QPushButton(tr("Edit"),this,"editScale");
59 editScale->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); 57 editScale->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum));
60 connect(editScale,SIGNAL(pressed()),this,SLOT(editScalePressed())); 58 connect(editScale,SIGNAL(pressed()),this,SLOT(editScalePressed()));
61 layout->addWidget(editScale,2,2); 59 layout->addWidget(editScale,2,2);
62 60
63 updateBoxes(); 61 updateBoxes();
64 setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); 62 setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum));
65} 63}
66//**************************************************************************** 64//****************************************************************************
67Menu::MenuWidget::~MenuWidget() 65Menu::MenuWidget::~MenuWidget()
68{ 66{
69} 67}
70//**************************************************************************** 68//****************************************************************************
71void Menu::MenuWidget::editInstPressed() 69void Menu::MenuWidget::editInstPressed()
72{ 70{
73 InstEditDialog* instdialog=new InstEditDialog(data,this); 71 InstEditDialog* instdialog=new InstEditDialog(data,this);
74 instdialog->exec(); 72 instdialog->exec();
75} 73}
76//**************************************************************************** 74//****************************************************************************
77void Menu::MenuWidget::editScalePressed() 75void Menu::MenuWidget::editScalePressed()
78{ 76{
79 ScaleEditDialog* scaledialog=new ScaleEditDialog(data,this); 77 ScaleEditDialog* scaledialog=new ScaleEditDialog(data,this);
80 scaledialog->exec(); 78 scaledialog->exec();
81} 79}
82//**************************************************************************** 80//****************************************************************************
83void Menu::MenuWidget::updateBoxes() 81void Menu::MenuWidget::updateBoxes()
84{ 82{
85 boxInst->clear(); 83 boxInst->clear();
86 84
87 for(int i=0;i<data->noOfInstruments();i++) 85 for(int i=0;i<data->noOfInstruments();i++)
88 { 86 {
89 Instrument inst=data->getInstrument(i); 87 Instrument inst=data->getInstrument(i);
90 QString name=inst.instName(); 88 QString name=inst.instName();
91 if(name.isNull()) continue; 89 if(name.isNull()) continue;
92 boxInst->insertItem(name,i); 90 boxInst->insertItem(name,i);
93 } 91 }
94 boxInst->setCurrentItem(data->getCurrentInstrumentID()); 92 boxInst->setCurrentItem(data->getCurrentInstrumentID());
95 93
96 boxScale->clear(); 94 boxScale->clear();
97 for(int s=0;s<data->noOfScales();s++) 95 for(int s=0;s<data->noOfScales();s++)
98 { 96 {
99 Scale scale=data->getScale(s); 97 Scale scale=data->getScale(s);
100 QString name=scale.scaleName(); 98 QString name=scale.scaleName();