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