rev 3309 - in kde-extras/codeine/trunk/debian: . patches

Achim Bohnet ach-guest at costa.debian.org
Thu Mar 16 01:43:27 UTC 2006


Author: ach-guest
Date: 2006-03-16 01:43:26 +0000 (Thu, 16 Mar 2006)
New Revision: 3309

Added:
   kde-extras/codeine/trunk/debian/patches/02_add_media_support.diff
Modified:
   kde-extras/codeine/trunk/debian/changelog
   kde-extras/codeine/trunk/debian/rules
Log:
codeine: added Toms media patch. ** Does not build yet **
	I still have to figure out how to add a rule to 
	create the dcop _skel file.

Modified: kde-extras/codeine/trunk/debian/changelog
===================================================================
--- kde-extras/codeine/trunk/debian/changelog	2006-03-16 00:29:58 UTC (rev 3308)
+++ kde-extras/codeine/trunk/debian/changelog	2006-03-16 01:43:26 UTC (rev 3309)
@@ -1,11 +1,15 @@
 codeine (1.0-1~mediatest1) experimental; urgency=low
 
   [ Achim Bohnet ]
-  o fix typos in codeine manpage
-  o renamed patches/kubuntu_01_add_translations_to_desktop_file.diff
+  * fix typos in codeine manpage
+  * renamed patches/kubuntu_01_add_translations_to_desktop_file.diff
     to patches/01_add_translations_to_desktop_file.diff. Patch is not
     kubuntu specific
 
+  [ Tom Albers ]
+  * New patches/02_add_media_support.diff: with my patch codeine
+    can handle input files like: media:/sda1/bla.dv
+
  -- Debian KDE Extras Team <pkg-kde-extras at lists.alioth.debian.org>  Thu, 16 Mar 2006 01:07:21 +0100
 
 codeine (1.0-0ubuntu1) dapper; urgency=low

Added: kde-extras/codeine/trunk/debian/patches/02_add_media_support.diff
===================================================================
--- kde-extras/codeine/trunk/debian/patches/02_add_media_support.diff	2006-03-16 00:29:58 UTC (rev 3308)
+++ kde-extras/codeine/trunk/debian/patches/02_add_media_support.diff	2006-03-16 01:43:26 UTC (rev 3309)
@@ -0,0 +1,442 @@
+diff -r -u codeine-1.0/src/app/SConscript codeine-1.0-new/src/app/SConscript
+--- codeine-1.0.orig/src/app/SConscript	2005-07-28 02:23:56.000000000 +0200
++++ codeine-1.0/src/app/SConscript	2006-03-05 19:19:00.000000000 +0100
+@@ -35,6 +35,7 @@
+ 
+         ../mxcl.library.cpp
+ 
++        medialib.cpp
+         main.cpp
+         mainWindow.cpp""")
+ 
+diff -r -u codeine-1.0/src/app/xineEngine.cpp codeine-1.0-new/src/app/xineEngine.cpp
+--- codeine-1.0.orig/src/app/xineEngine.cpp	2005-08-28 20:38:35.000000000 +0200
++++ codeine-1.0/src/app/xineEngine.cpp	2006-03-05 18:11:34.000000000 +0100
+@@ -18,7 +18,7 @@
+ #include <xine.h>
+ #include "xineEngine.h"
+ #include "xineScope.h"
+-
++#include "medialib.h"
+ 
+ #define XINE_SAFE_MODE 1
+ 
+@@ -235,13 +235,25 @@
+ 
+    m_url = url;
+ 
++   if (url.protocol() == "media")
++   {
++      mediaLib* media = new mediaLib(url.url());
++      debug() << "Media protocol: detected, valid: " << media->isValid() 
++              << ", mounted: " << media->isMounted() << "\n";
++      if (media->isValid() && media->isMounted())
++      {
++         m_url = media->localFile(); 
++         debug() << "Media protocol: play " << m_url << "\n";
++      }
++   }
++
+    // only gets shown if there is an error generally, as no event processing
+    // occurs, so no paint event. This is fine IMO, TODO although if xine_open hangs
+    // due to something, it would be good to show the message...
+-   emit statusMessage( i18n("Loading media: %1" ).arg( url.fileName() ) );
++   emit statusMessage( i18n("Loading media: %1" ).arg( m_url.fileName() ) );
+ 
+    debug() << "xine_open()\n";
+-   if( xine_open( m_stream, url.url().local8Bit() ) )
++   if( xine_open( m_stream, m_url.url().local8Bit() ) )
+    {
+       KConfig *profile = TheStream::profile();
+       #define setParameter( param, default ) xine_set_param( m_stream, param, profile->readNumEntry( QString::number( param ), default ) );
+--- codeine-1.0.orig/src/app/medialib.cpp
++++ codeine-1.0/src/app/medialib.cpp
+@@ -0,0 +1,159 @@
++/* ============================================================
++ * Authors: Tom Albers <tomalbers at kde.nl>
++ * Date  : 19 jan 2006
++ * Description : Library for accessing Media Devices.
++ * Version: 0.0.1
++ * Remark:
++ *          Please mail me when you use this library so
++ *          I can keep you informed on updates and errors
++ * 
++ * Copyright (C) 2006 Tom Albers <tomalbers at kde.nl>
++ *
++ * 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, 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.
++ * 
++ * ============================================================ */
++
++#include <kdebug.h>
++#include <klocale.h>
++#include <kurl.h>
++#include <kdeversion.h>
++#include <kapplication.h>
++#include <kcmdlineargs.h>
++#include <kaboutdata.h>
++#include <kio/netaccess.h>
++#include <kglobal.h>
++#include <qstring.h>
++#include <dcopref.h>
++#include <dcopclient.h>
++
++#include <kio/netaccess.h>
++
++// Qt Includes;
++#include <qstring.h>
++#include <qmap.h>
++#include <qtimer.h>
++
++// local Includes;
++#include "medialib.h"
++
++mediaLib::mediaLib( const QString& folder, QObject *parent, const char *name )
++    : QObject( parent, name ), DCOPObject( "dcopMediaLib" )
++{
++    // Split up folder, as that might be a file....
++    QString device = folder.section("/",0,1,QString::SectionSkipEmpty);
++    m_file =  folder.section("/",2,-1,QString::SectionIncludeLeadingSep);
++    
++    kdDebug() << "Device: " << device << " File: "  << m_file << endl;
++
++    retrieveInfo( KURL( device ));
++    
++    m_timer = new QTimer(this);
++    connect( m_timer, SIGNAL(timeout()), SLOT(slotMediumChangedFinal()) );
++    
++    m_wasOriginallyMounted = isMounted();
++}
++
++mediaLib::~mediaLib()
++{
++}
++
++void mediaLib::retrieveInfo(const KURL& folder)
++{
++    m_folder=folder;
++    
++    DCOPRef mediamanager("kded", "mediamanager");
++    DCOPReply reply = mediamanager.call( "properties", folder.filename() );
++    if (reply.isValid()) 
++    {
++        m_properties = reply;
++        // kdDebug() << m_properties.count() << m_properties << endl;
++        
++        if (!KApplication::dcopClient()->connectDCOPSignal( "kded", 
++             "mediamanager", "mediumChanged(QString, bool)",
++             "dcopMediaLib", "onMediumChange(QString, bool)", true ))
++        {
++            kdDebug() << "connectDCOPSignal failed" << endl;
++        }
++    } 
++    else
++        kdWarning() << "Is KDED running?" << endl;
++}
++
++void mediaLib::mount()
++{
++    kdDebug() << "Mounting" << endl;
++    if (!isMountable() )
++        return;
++    
++    KIO::Job* job = KIO::mount( false, 0, device(), 
++                                QString("/media/%1").arg(name()), false);
++    connect(job, SIGNAL(result(KIO::Job*)), SLOT(signalDone()));
++}
++
++void mediaLib::synchronousMount()
++{
++    kdDebug() << "Mounting" << endl;
++    if (!isMountable() )
++        return;
++    
++    KIO::Job* job = KIO::mount( false, 0, device(), 
++                                QString("/media/%1").arg(name()), false);
++    KIO::NetAccess::synchronousRun(job,0);
++}
++
++void mediaLib::unmount()
++{
++    if (!isMounted())
++        return;
++    
++    KIO::Job* job = KIO::unmount( mountPoint(), false );
++    connect(job, SIGNAL(result(KIO::Job*)), SLOT(signalDone()));
++}
++
++void mediaLib::synchronousUnmount()
++{
++    if (!isMounted())
++        return;
++    
++    KIO::Job* job = KIO::unmount( mountPoint(), false );
++    KIO::NetAccess::synchronousRun(job,0);
++}
++
++void mediaLib::signalDone()
++{
++    // No need to retrieve info, slotMediumChanged will be activated
++    emit finished();    
++}
++
++void mediaLib::onMediumChange(const QString &name, bool)
++{
++    kdDebug() << "Changed:" << name << endl;
++    
++    if (name == m_properties[1])
++        m_timer->start ( 300, true );
++}
++
++void mediaLib::slotMediumChangedFinal()
++{
++    kdDebug() << "ChangedFinal:" << endl;
++    
++    retrieveInfo(m_folder);
++    emit changed();
++}
++
++void mediaLib::unmountIfOriginallyUnmounted()
++{
++    if ( !m_wasOriginallyMounted && isMounted() )
++        unmount();
++}
++
++#include "medialib.moc"
+--- codeine-1.0.orig/src/app/medialib.h
++++ codeine-1.0/src/app/medialib.h
+@@ -0,0 +1,226 @@
++/* ============================================================
++ * Authors     : Tom Albers <tomalbers at kde.nl>
++ * Date        : 19 jan 2006
++ * Version     : 0.1
++ * Description : library for media management
++ * 
++ * Copyright (C) 2006 Tom Albers <tomalbers at kde.nl>
++ *
++ * 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, 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.
++ * 
++ * ============================================================ */
++
++
++#ifndef MEDIALIB_H
++#define MEDIALIB_H
++
++#include <qstringlist.h>
++#include <dcopobject.h>
++#include <kdebug.h>
++#include <kio/job.h>
++
++/**
++ * @file medialib.h
++ * @class mediaLib
++ * This class is dedicated to easy operations on media devices, basically you can
++ * access a media device, get information from it, mount it, and all operations you
++ * would expect. It is a gathering of functions which are available via all different
++ * kinds of functions elsewhere, but using this lib is much easier, at least I hope.
++ * If you use the lib, please be so kind to drop me a note, so I can keep track of it.
++ * @author Tom Albers <tomalbers at kde.nl>
++ */
++class mediaLib : public QObject, public DCOPObject
++{
++    Q_OBJECT
++    K_DCOP
++
++    public:
++        /**
++         * The constructor. Check with isValid() if this is succesfull.
++         * @param folder This is the folder or file which you want to operate on, like
++                         "media:/sda1/file.mov" or "media:/sda1"
++         * @param parent The parent
++         * @param name The name
++         */
++        mediaLib(const QString& folder, QObject *parent = 0, const char *name = 0);
++        
++        /**
++         * Destructor. 
++         * @return 
++         */
++        ~mediaLib();
++        
++        /**
++         * Returns if the construction has been successfull. If it is valid, then 
++         * info like name() and label() is available.
++         * @return true if valid, false if no info is avialable for the folder.
++         */
++        bool isValid()          const { return m_properties.count() > 0; };
++        
++        /**
++         * returns the id for the device
++         * @return the id
++         */
++        QString id()            const { return m_properties[0];  };
++        
++        /**
++         * returns the name of the device, something like 'sda1'
++         * @return the name
++         */
++        QString name()          const { return m_properties[1];  };
++        
++        /**
++         * returns the label of the device, something like '128MB Storage device'
++         * @return the label
++         */
++        QString label()         const { return m_properties[2];  };
++        
++        /**
++         * returns the userlabel of the device
++         * @return the userlabel
++         */
++        QString userLabel()     const { return m_properties[3];  };
++        
++        /**
++         * returns if the device is mountable
++         * @return true if mountable, false means not mountable
++         */
++        bool isMountable()      const { return m_properties[4] == "true";  };
++        
++        /**
++         * returns the actual device, something like '/dev/sda1'
++         * @return the device
++         */
++        QString device()        const { return m_properties[5];  };
++        
++        /**
++         * returns the mountpoint if the device is mounted, which can be checked
++         * via isMounted(), if you are operating on a file, you might prefer using
++         * localFile(), as this only returns the mountpoint of the device so the 
++         * filename part is chopped of. 
++         * @return the point where the device is mounted (for example '/media/sda1')
++         */
++        QString mountPoint()    const { return m_properties[6];  };
++        
++        /**
++         * returns the fileSystem of the device, something like 'vfat'
++         * @return the fileSystem
++         */
++        QString fsType()        const { return m_properties[7];  };
++        
++        /**
++         * returns if the device is mounted. You can use mount() or synchronousMount()
++         * to mount the device if it returns false and you want it mounted.
++         * @return true if mounted, false means not mounted
++         */
++        bool isMounted()        const { return m_properties[8] == "true";  };
++                
++        /**
++         * returns the baseURL, have not seen any value here ;-)
++         * @return the baseURL
++         */
++        QString baseURL()       const { return m_properties[9];  };
++        
++        /**
++         * returns the mimetype, something like 'media/removable_mounted'
++         * @return the mimetype
++         */
++        QString mimeType()      const { return m_properties[10]; };
++        
++        /**
++         * returns the iconName, have not seen any value here ;-)
++         * @return the iconName
++         */
++        QString iconName()      const { return m_properties[11]; };
++        
++        /** 
++         * mounts the device, it will emit finished() when finished. Use unmount()
++         * to unmount the device. You can also use synchronousMount() if you have 
++         * kdelibs>=3.4 as minimum dependency.
++         * Also note that changed() will also get emitted when succesfull.
++         */
++        void mount();
++        
++        /** 
++         * mounts the device synchronously, so you dont have to connect to a 
++         * signal to know when it is mounted. The signal changed() will get emitted
++         * when succesfull.
++         * @since 3.4 
++         */     
++        void synchronousMount();
++        
++        /** 
++         * unmounts the device, it will emit finished() when finished. Use mount()
++         * to mount the device. You can also use synchronousUnmount() if you have 
++         * kdelibs>=3.4 as minimum dependency.
++         * unmount can fail if any other process is working on the device.
++         * Also note that changed() will also get emitted when succesfull.
++         */
++        void unmount();
++        
++        /** 
++         * unmounts the device synchronously, so you dont have to connect to a 
++         * signal to know when it is mounted. The signal changed() will get emitted
++         * when succesfull.
++         * unmount can fail if any other process is working on the device. 
++         * @since 3.4 
++         */     
++        void synchronousUnmount();
++        
++        /**
++         * this will unmount the device if the device was unmounted when constructed.
++         * it will emit finished() when done.
++         * unmount can fail if any other process is working on the device.
++         */
++        void unmountIfOriginallyUnmounted();
++        
++        /** 
++         * when constructed with a filename, this will return the mountPoint() + the 
++         * filename. If it is not mounted, it will only return the filename.
++         */
++        QString mediaLib::localFile() const { return mountPoint()+m_file; };
++        
++    k_dcop:
++        void onMediumChange(const QString &name, bool);
++
++    signals:
++        /** 
++         * This signal will get emitted as a result of mount() or unmount(). Note that
++         * unmountIfOriginallyUnmounted() also uses mount().
++         * The information like isMounted() will get updated.
++         */
++        void finished();
++        
++        /**
++         * This signal is emitted whenever the media manager on which this class relies
++         * notices a change. In most cases this is the case when a user tries to open the
++         * media device, hence it gets mounted.
++         * The information like isMounted() will get updated.
++         */
++        void changed();
++        
++    private slots:
++        void signalDone();
++        void slotMediumChangedFinal();
++                        
++    private:
++        void retrieveInfo(const KURL& folder);
++        
++        QStringList m_properties;
++        KURL        m_folder;
++        QString     m_file;
++        QTimer*     m_timer;
++        bool        m_wasOriginallyMounted;
++
++};
++
++#endif


Property changes on: kde-extras/codeine/trunk/debian/patches/02_add_media_support.diff
___________________________________________________________________
Name: svn:mime-type
   + text/x-patch

Modified: kde-extras/codeine/trunk/debian/rules
===================================================================
--- kde-extras/codeine/trunk/debian/rules	2006-03-16 00:29:58 UTC (rev 3308)
+++ kde-extras/codeine/trunk/debian/rules	2006-03-16 01:43:26 UTC (rev 3309)
@@ -39,6 +39,7 @@
 	rm -f generic.cache.py kde.cache.py configure.log
 	rm -f scons/*.pyc scons/signatures.dblite
 	rm -f codeine.1
+	rm -f build/app/medialib.o
 
 DEB_INSTALL_MANPAGES_codeine = codeine.1
 




More information about the pkg-kde-commits mailing list