Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 308933 Details for
Bug 412007
media-sound/kwave-0.8.7 - segfault with media-libs/audiofile-0.3.3
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
fix for namespace collision between kwave and libaudiofile-0.3.3
kwave-fix-audiofile-0.3.3.patch (text/plain), 55.29 KB, created by
Thomas
on 2012-04-14 17:12:39 UTC
(
hide
)
Description:
fix for namespace collision between kwave and libaudiofile-0.3.3
Filename:
MIME Type:
Creator:
Thomas
Created:
2012-04-14 17:12:39 UTC
Size:
55.29 KB
patch
obsolete
>From 84b6f5a00391224aad27157fb6587ec8bd2b3938 Mon Sep 17 00:00:00 2001 >From: Thomas Eschenbacher <Thomas.Eschenbacher@gmx.de> >Date: Sat, 14 Apr 2012 18:29:38 +0200 >Subject: [PATCH 1/1] fix for namespace collission with libaudiofile-0.3.3 > >--- > kwave/MainWidget.cpp | 8 +- > kwave/MainWidget.h | 2 +- > libgui/OverViewCache.cpp | 6 +- > libgui/OverViewCache.h | 4 +- > libgui/OverViewWidget.h | 2 +- > libgui/SignalWidget.cpp | 6 +- > libgui/SignalWidget.h | 4 +- > libgui/TrackPixmap.cpp | 25 ++- > libgui/TrackPixmap.h | 14 +- > libgui/TrackView.cpp | 3 +- > libgui/TrackView.h | 5 +- > libkwave/ClipBoard.h | 1 - > libkwave/KwavePlugin.cpp | 1 - > libkwave/SampleReader.cpp | 1 - > libkwave/Signal.cpp | 42 ++-- > libkwave/Signal.h | 18 +- > libkwave/SignalManager.cpp | 8 +- > libkwave/SignalManager.h | 6 +- > libkwave/StreamWriter.h | 3 +- > libkwave/Track.cpp | 80 +++--- > libkwave/Track.h | 489 ++++++++++++++++++------------------ > libkwave/TrackWriter.cpp | 2 +- > libkwave/TrackWriter.h | 7 +- > libkwave/undo/UndoDeleteTrack.h | 2 +- > libkwave/undo/UndoModifyAction.h | 2 +- > plugins/fileinfo/KeywordWidget.cpp | 2 +- > 26 files changed, 377 insertions(+), 367 deletions(-) > >diff --git a/kwave/MainWidget.cpp b/kwave/MainWidget.cpp >index 10b65da..f7450b2 100644 >--- a/kwave/MainWidget.cpp >+++ b/kwave/MainWidget.cpp >@@ -172,8 +172,10 @@ MainWidget::MainWidget(QWidget *parent, Kwave::ApplicationContext &context) > > // -- connect all signals from/to the signal manager -- > >- connect(signal_manager, SIGNAL(sigTrackInserted(unsigned int, Track *)), >- this, SLOT(slotTrackInserted(unsigned int, Track *))); >+ connect(signal_manager, >+ SIGNAL(sigTrackInserted(unsigned int, Kwave::Track *)), >+ this, >+ SLOT(slotTrackInserted(unsigned int, Kwave::Track *))); > connect(signal_manager, SIGNAL(sigTrackDeleted(unsigned int)), > this, SLOT(slotTrackDeleted(unsigned int))); > connect(signal_manager, >@@ -319,7 +321,7 @@ void MainWidget::verticalScrollBarMoved(int newval) > } > > //*************************************************************************** >-void MainWidget::slotTrackInserted(unsigned int index, Track *track) >+void MainWidget::slotTrackInserted(unsigned int index, Kwave::Track *track) > { > // qDebug("MainWidget::slotTrackInserted(%u, %p)", > // index, static_cast<void *>(track)); >diff --git a/kwave/MainWidget.h b/kwave/MainWidget.h >index 68a444d..ab591d5 100644 >--- a/kwave/MainWidget.h >+++ b/kwave/MainWidget.h >@@ -193,7 +193,7 @@ private slots: > * @see SignalManager::sigTrackInserted > * @internal > */ >- void slotTrackInserted(unsigned int index, Track *track); >+ void slotTrackInserted(unsigned int index, Kwave::Track *track); > > /** > * Called if a track has been deleted. Updates the display by >diff --git a/libgui/OverViewCache.cpp b/libgui/OverViewCache.cpp >index 32836ae..39ce3db 100644 >--- a/libgui/OverViewCache.cpp >+++ b/libgui/OverViewCache.cpp >@@ -43,8 +43,8 @@ OverViewCache::OverViewCache(SignalManager &signal, sample_index_t src_offset, > // connect to the signal manager > SignalManager *sig = &signal; > Q_ASSERT(sig); >- connect(sig, SIGNAL(sigTrackInserted(unsigned int, Track *)), >- this, SLOT(slotTrackInserted(unsigned int, Track *))); >+ connect(sig, SIGNAL(sigTrackInserted(unsigned int, Kwave::Track *)), >+ this, SLOT(slotTrackInserted(unsigned int, Kwave::Track *))); > connect(sig, SIGNAL(sigTrackDeleted(unsigned int)), > this, SLOT(slotTrackDeleted(unsigned int))); > connect(sig, SIGNAL(sigSamplesDeleted(unsigned int, sample_index_t, >@@ -208,7 +208,7 @@ void OverViewCache::invalidateCache(unsigned int track, unsigned int first, > } > > //*************************************************************************** >-void OverViewCache::slotTrackInserted(unsigned int index, Track *) >+void OverViewCache::slotTrackInserted(unsigned int index, Kwave::Track *) > { > QMutexLocker lock(&m_lock); > >diff --git a/libgui/OverViewCache.h b/libgui/OverViewCache.h >index b4b307b..f88f0a6 100644 >--- a/libgui/OverViewCache.h >+++ b/libgui/OverViewCache.h >@@ -32,7 +32,7 @@ > > class QColor; > class SignalManager; >-class Track; >+namespace Kwave { class Track; } > > /** > * @class OverViewCache >@@ -87,7 +87,7 @@ protected slots: > * @see Signal::sigTrackInserted > * @internal > */ >- void slotTrackInserted(unsigned int index, Track *); >+ void slotTrackInserted(unsigned int index, Kwave::Track *); > > /** > * Connected to the signal's sigTrackInserted. >diff --git a/libgui/OverViewWidget.h b/libgui/OverViewWidget.h >index 9aef17c..58e9c82 100644 >--- a/libgui/OverViewWidget.h >+++ b/libgui/OverViewWidget.h >@@ -39,7 +39,7 @@ class QMouseEvent; > class QPainter; > class QResizeEvent; > class SignalManager; >-class Track; >+namespace Kwave { class Track; } > > class KDE_EXPORT OverViewWidget : public ImageView > { >diff --git a/libgui/SignalWidget.cpp b/libgui/SignalWidget.cpp >index 77724a6..7f529b6 100644 >--- a/libgui/SignalWidget.cpp >+++ b/libgui/SignalWidget.cpp >@@ -112,8 +112,8 @@ SignalWidget::SignalWidget(QWidget *parent, Kwave::ApplicationContext &context, > // connect to the signal manager's signals > SignalManager *sig = m_context.signalManager(); > >- connect(sig, SIGNAL(sigTrackInserted(unsigned int, Track *)), >- this, SLOT( slotTrackInserted(unsigned int, Track *))); >+ connect(sig, SIGNAL(sigTrackInserted(unsigned int, Kwave::Track *)), >+ this, SLOT( slotTrackInserted(unsigned int, Kwave::Track *))); > connect(sig, SIGNAL(sigTrackDeleted(unsigned int)), > this, SLOT( slotTrackDeleted(unsigned int))); > >@@ -578,7 +578,7 @@ void SignalWidget::insertView(Kwave::SignalView *view, QWidget *controls) > } > > //*************************************************************************** >-void SignalWidget::slotTrackInserted(unsigned int index, Track *track) >+void SignalWidget::slotTrackInserted(unsigned int index, Kwave::Track *track) > { > Q_ASSERT(track); > if (!track) return; >diff --git a/libgui/SignalWidget.h b/libgui/SignalWidget.h >index 816c130..5d61b3c 100644 >--- a/libgui/SignalWidget.h >+++ b/libgui/SignalWidget.h >@@ -62,7 +62,7 @@ class KUrl; > class LabelType; > class SignalManager; > class TimeOperation; >-class Track; >+namespace Kwave { class Track; } > class TrackPixmap; > > namespace Kwave { class ApplicationContext; } >@@ -154,7 +154,7 @@ private slots: > * @see Signal::sigTrackInserted > * @internal > */ >- void slotTrackInserted(unsigned int index, Track *track); >+ void slotTrackInserted(unsigned int index, Kwave::Track *track); > > /** > * Connected to the signal's sigTrackDeleted. >diff --git a/libgui/TrackPixmap.cpp b/libgui/TrackPixmap.cpp >index afd47c2..fec41a6 100644 >--- a/libgui/TrackPixmap.cpp >+++ b/libgui/TrackPixmap.cpp >@@ -63,7 +63,7 @@ static Kwave::TrackPixmap::color_set_t color_set_disabled = > }; > > //*************************************************************************** >-Kwave::TrackPixmap::TrackPixmap(Track &track) >+Kwave::TrackPixmap::TrackPixmap(Kwave::Track &track) > :QObject(), m_pixmap(), m_track(track), m_offset(0), m_zoom(0.0), > m_vertical_zoom(1.0), m_minmax_mode(false), > m_sample_buffer(), m_min_buffer(), m_max_buffer(), >@@ -72,14 +72,16 @@ Kwave::TrackPixmap::TrackPixmap(Track &track) > m_colors(color_set_normal) > { > // connect all the notification signals of the track >- connect(&track, SIGNAL(sigSamplesInserted(Track *, sample_index_t, >- sample_index_t)), this, SLOT(slotSamplesInserted(Track *, >+ connect(&track, >+ SIGNAL(sigSamplesInserted(Kwave::Track *, sample_index_t, >+ sample_index_t)), this, >+ SLOT(slotSamplesInserted(Kwave::Track *, > sample_index_t, sample_index_t))); >- connect(&track, SIGNAL(sigSamplesDeleted(Track *, sample_index_t, >- sample_index_t)), this, SLOT(slotSamplesDeleted(Track *, >+ connect(&track, SIGNAL(sigSamplesDeleted(Kwave::Track *, sample_index_t, >+ sample_index_t)), this, SLOT(slotSamplesDeleted(Kwave::Track *, > sample_index_t, sample_index_t))); >- connect(&track, SIGNAL(sigSamplesModified(Track *, sample_index_t, >- sample_index_t)), this, SLOT(slotSamplesModified(Track *, >+ connect(&track, SIGNAL(sigSamplesModified(Kwave::Track *, sample_index_t, >+ sample_index_t)), this, SLOT(slotSamplesModified(Kwave::Track *, > sample_index_t, sample_index_t))); > connect(&track, SIGNAL(sigSelectionChanged(bool)), > this, SLOT(selectionChanged())); >@@ -701,7 +703,8 @@ void Kwave::TrackPixmap::drawPolyLineSignal(QPainter &p, int width, > } > > //*************************************************************************** >-void Kwave::TrackPixmap::slotSamplesInserted(Track *, sample_index_t offset, >+void Kwave::TrackPixmap::slotSamplesInserted(Kwave::Track *, >+ sample_index_t offset, > sample_index_t length) > { > { >@@ -726,7 +729,8 @@ void Kwave::TrackPixmap::slotSamplesInserted(Track *, sample_index_t offset, > } > > //*************************************************************************** >-void Kwave::TrackPixmap::slotSamplesDeleted(Track *, sample_index_t offset, >+void Kwave::TrackPixmap::slotSamplesDeleted(Kwave::Track *, >+ sample_index_t offset, > sample_index_t length) > { > { >@@ -751,7 +755,8 @@ void Kwave::TrackPixmap::slotSamplesDeleted(Track *, sample_index_t offset, > } > > //*************************************************************************** >-void Kwave::TrackPixmap::slotSamplesModified(Track *, sample_index_t offset, >+void Kwave::TrackPixmap::slotSamplesModified(Kwave::Track *, >+ sample_index_t offset, > sample_index_t length) > { > { >diff --git a/libgui/TrackPixmap.h b/libgui/TrackPixmap.h >index 661175d..e79172e 100644 >--- a/libgui/TrackPixmap.h >+++ b/libgui/TrackPixmap.h >@@ -34,8 +34,6 @@ > #include "libkwave/Sample.h" > #include "libkwave/KwaveSampleArray.h" > >-class Track; >- > /** > * The TrackPixmap is a graphical representation of a track's sample > * data. It is connected directly to a Track object so that it is able >@@ -62,6 +60,8 @@ class Track; > */ > namespace Kwave > { >+ class Track; >+ > class KDE_EXPORT TrackPixmap : public QObject > { > Q_OBJECT >@@ -69,7 +69,7 @@ namespace Kwave > public: > > /** Default constructor */ >- TrackPixmap(Track &track); >+ TrackPixmap(Kwave::Track &track); > > /** Destructor */ > virtual ~TrackPixmap(); >@@ -153,7 +153,7 @@ namespace Kwave > * @see Track::sigSamplesInserted > * @internal > */ >- void slotSamplesInserted(Track *src, sample_index_t offset, >+ void slotSamplesInserted(Kwave::Track *src, sample_index_t offset, > sample_index_t length); > > /** >@@ -164,7 +164,7 @@ namespace Kwave > * @see Track::sigSamplesDeleted > * @internal > */ >- void slotSamplesDeleted(Track *src, sample_index_t offset, >+ void slotSamplesDeleted(Kwave::Track *src, sample_index_t offset, > sample_index_t length); > > /** >@@ -175,7 +175,7 @@ namespace Kwave > * @see Track::sigSamplesModified > * @internal > */ >- void slotSamplesModified(Track *src, sample_index_t offset, >+ void slotSamplesModified(Kwave::Track *src, sample_index_t offset, > sample_index_t length); > > /** >@@ -311,7 +311,7 @@ namespace Kwave > /** > * Reference to the track with our sample data. > */ >- Track &m_track; >+ Kwave::Track &m_track; > > /** > * Index of the first sample. Needed for converting pixel >diff --git a/libgui/TrackView.cpp b/libgui/TrackView.cpp >index 9954335..57f8ef7 100644 >--- a/libgui/TrackView.cpp >+++ b/libgui/TrackView.cpp >@@ -29,6 +29,7 @@ > #include "libkwave/Label.h" > #include "libkwave/LabelList.h" > #include "libkwave/SignalManager.h" >+#include "libkwave/Track.h" > > #include "LabelItem.h" > #include "MultiStateWidget.h" >@@ -41,7 +42,7 @@ > //*************************************************************************** > Kwave::TrackView::TrackView(QWidget *parent, QWidget *controls, > SignalManager *signal_manager, >- Track *track) >+ Kwave::Track *track) > :Kwave::SignalView(parent, controls, signal_manager, > Kwave::SignalView::AboveTrackTop), > m_signal_manager(signal_manager), >diff --git a/libgui/TrackView.h b/libgui/TrackView.h >index 358ee6c..0f65c92 100644 >--- a/libgui/TrackView.h >+++ b/libgui/TrackView.h >@@ -29,7 +29,6 @@ > #include "kdemacros.h" > > #include "libkwave/Sample.h" >-#include "libkwave/Track.h" > > #include "libgui/SignalView.h" > #include "libgui/TrackPixmap.h" >@@ -40,6 +39,8 @@ class SignalManager; // forward declaration > > namespace Kwave { > >+ class Track; >+ > class KDE_EXPORT TrackView: public SignalView > { > Q_OBJECT >@@ -53,7 +54,7 @@ namespace Kwave { > */ > TrackView(QWidget *parent, QWidget *controls, > SignalManager *signal_manager, >- Track *track); >+ Kwave::Track *track); > > /** Destructor */ > virtual ~TrackView(); >diff --git a/libkwave/ClipBoard.h b/libkwave/ClipBoard.h >index aa1a2c9..727fb50 100644 >--- a/libkwave/ClipBoard.h >+++ b/libkwave/ClipBoard.h >@@ -30,7 +30,6 @@ > > class QWidget; > class SignalManager; >-class Track; > > /** > * Implements a global clipboard for Kwave. It supports only the three >diff --git a/libkwave/KwavePlugin.cpp b/libkwave/KwavePlugin.cpp >index 7953050..ab2a1f4 100644 >--- a/libkwave/KwavePlugin.cpp >+++ b/libkwave/KwavePlugin.cpp >@@ -37,7 +37,6 @@ > #include "libkwave/Sample.h" > #include "libkwave/SampleReader.h" > #include "libkwave/Signal.h" >-#include "libkwave/Track.h" > #include "libkwave/PluginContext.h" > #include "libkwave/PluginManager.h" > #include "libkwave/PluginWorkerThread.h" >diff --git a/libkwave/SampleReader.cpp b/libkwave/SampleReader.cpp >index 959d9ba..37b80f4 100644 >--- a/libkwave/SampleReader.cpp >+++ b/libkwave/SampleReader.cpp >@@ -23,7 +23,6 @@ > #include "libkwave/Sample.h" > #include "libkwave/SampleReader.h" > #include "libkwave/Stripe.h" >-#include "libkwave/Track.h" > > // define this for using only slow Qt array functions > // #define STRICTLY_QT >diff --git a/libkwave/Signal.cpp b/libkwave/Signal.cpp >index 1ab58d3..d520531 100644 >--- a/libkwave/Signal.cpp >+++ b/libkwave/Signal.cpp >@@ -70,13 +70,13 @@ void Signal::close() > } > > //*************************************************************************** >-Track *Signal::insertTrack(unsigned int index, sample_index_t length) >+Kwave::Track *Signal::insertTrack(unsigned int index, sample_index_t length) > { >- Track *t = 0; >+ Kwave::Track *t = 0; > { > QWriteLocker lock(&m_lock_tracks); > >- t = new Track(length); >+ t = new Kwave::Track(length); > Q_ASSERT(t); > if (!t) return 0; > >@@ -88,17 +88,17 @@ Track *Signal::insertTrack(unsigned int index, sample_index_t length) > m_tracks.insert(index, t); > > // connect to the new track's signals >- connect(t, SIGNAL(sigSamplesDeleted(Track *, sample_index_t, >+ connect(t, SIGNAL(sigSamplesDeleted(Kwave::Track *, sample_index_t, > sample_index_t)), >- this, SLOT(slotSamplesDeleted(Track *, sample_index_t, >+ this, SLOT(slotSamplesDeleted(Kwave::Track *, sample_index_t, > sample_index_t))); >- connect(t, SIGNAL(sigSamplesInserted(Track *, sample_index_t, >+ connect(t, SIGNAL(sigSamplesInserted(Kwave::Track *, sample_index_t, > sample_index_t)), >- this, SLOT(slotSamplesInserted(Track *, sample_index_t, >+ this, SLOT(slotSamplesInserted(Kwave::Track *, sample_index_t, > sample_index_t))); >- connect(t, SIGNAL(sigSamplesModified(Track *, sample_index_t, >+ connect(t, SIGNAL(sigSamplesModified(Kwave::Track *, sample_index_t, > sample_index_t)), >- this, SLOT(slotSamplesModified(Track *, sample_index_t, >+ this, SLOT(slotSamplesModified(Kwave::Track *, sample_index_t, > sample_index_t))); > } > >@@ -109,7 +109,7 @@ Track *Signal::insertTrack(unsigned int index, sample_index_t length) > > > //*************************************************************************** >-Track *Signal::appendTrack(sample_index_t length) >+Kwave::Track *Signal::appendTrack(sample_index_t length) > { > return insertTrack(tracks(), length); > } >@@ -118,7 +118,7 @@ Track *Signal::appendTrack(sample_index_t length) > void Signal::deleteTrack(unsigned int index) > { > // remove the track from the list but do not delete it >- Track *t = 0; >+ Kwave::Track *t = 0; > { > QWriteLocker lock(&m_lock_tracks); > if (static_cast<int>(index) > m_tracks.count()) >@@ -149,7 +149,7 @@ Kwave::Writer *Signal::openWriter(unsigned int track, > return 0; // track does not exist ! > } > >- Track *t = m_tracks.at(track); >+ Kwave::Track *t = m_tracks.at(track); > Q_ASSERT(t); > return (t) ? t->openWriter(mode, left, right) : 0; > } >@@ -163,7 +163,7 @@ SampleReader *Signal::openSampleReader(Kwave::ReaderMode mode, > if (static_cast<int>(track) >= m_tracks.count()) > return 0; // track does not exist ! > >- Track *t = m_tracks.at(track); >+ Kwave::Track *t = m_tracks.at(track); > Q_ASSERT(t); > return (t) ? t->openSampleReader(mode, left, right) : 0; > } >@@ -192,7 +192,7 @@ void Signal::deleteRange(unsigned int track, sample_index_t offset, > if (static_cast<int>(track) >= m_tracks.count()) > return; // track does not exist ! > >- Track *t = m_tracks.at(track); >+ Kwave::Track *t = m_tracks.at(track); > Q_ASSERT(t); > if (t) t->deleteRange(offset, length); > } >@@ -207,7 +207,7 @@ void Signal::insertSpace(unsigned int track, sample_index_t offset, > if (static_cast<int>(track) >= m_tracks.count()) > return; // track does not exist ! > >- Track *t = m_tracks.at(track); >+ Kwave::Track *t = m_tracks.at(track); > Q_ASSERT(t); > if (t) t->insertSpace(offset, length); > } >@@ -225,7 +225,7 @@ sample_index_t Signal::length() > QReadLocker lock(&m_lock_tracks); > > sample_index_t max = 0; >- foreach (Track *track, m_tracks) { >+ foreach (Kwave::Track *track, m_tracks) { > if (!track) continue; > sample_index_t len = track->length(); > if (len > max) max = len; >@@ -516,16 +516,16 @@ void Signal::selectTrack(unsigned int track, bool select) > // } > > //*************************************************************************** >-unsigned int Signal::trackIndex(const Track *track) >+unsigned int Signal::trackIndex(const Kwave::Track *track) > { > QReadLocker lock(&m_lock_tracks); > >- int index = m_tracks.indexOf(const_cast<Track *>(track)); >+ int index = m_tracks.indexOf(const_cast<Kwave::Track *>(track)); > return (index >= 0) ? index : m_tracks.count(); > } > > //*************************************************************************** >-void Signal::slotSamplesInserted(Track *src, sample_index_t offset, >+void Signal::slotSamplesInserted(Kwave::Track *src, sample_index_t offset, > sample_index_t length) > { > unsigned int track = trackIndex(src); >@@ -533,7 +533,7 @@ void Signal::slotSamplesInserted(Track *src, sample_index_t offset, > } > > //*************************************************************************** >-void Signal::slotSamplesDeleted(Track *src, sample_index_t offset, >+void Signal::slotSamplesDeleted(Kwave::Track *src, sample_index_t offset, > sample_index_t length) > { > unsigned int track = trackIndex(src); >@@ -541,7 +541,7 @@ void Signal::slotSamplesDeleted(Track *src, sample_index_t offset, > } > > //*************************************************************************** >-void Signal::slotSamplesModified(Track *src, sample_index_t offset, >+void Signal::slotSamplesModified(Kwave::Track *src, sample_index_t offset, > sample_index_t length) > { > unsigned int track = trackIndex(src); >diff --git a/libkwave/Signal.h b/libkwave/Signal.h >index 0b7de09..464c02d 100644 >--- a/libkwave/Signal.h >+++ b/libkwave/Signal.h >@@ -35,7 +35,7 @@ > > class MultiTrackReader; > class SampleReader; >-class Track; >+namespace Kwave { class Track; } > namespace Kwave { class Writer; } > > //********************************************************************** >@@ -78,14 +78,14 @@ public: > * @return pointer to the created track. If the length is > * omitted or zero, the track will have zero length. > */ >- Track *insertTrack(unsigned int index, sample_index_t length = 0); >+ Kwave::Track *insertTrack(unsigned int index, sample_index_t length = 0); > > /** > * Appends a new track to the end of the tracks list, shortcut for > * insertTrack(tracks()-1, length) > * @see insertTrack > */ >- Track *appendTrack(sample_index_t length); >+ Kwave::Track *appendTrack(sample_index_t length); > > /** > * Deletes a track. >@@ -175,7 +175,7 @@ signals: > * @param index position of the new track [0...tracks()-1] > * @param track reference to the new track > */ >- void sigTrackInserted(unsigned int index, Track *track); >+ void sigTrackInserted(unsigned int index, Kwave::Track *track); > > /** > * Signals that a track has been deleted. >@@ -223,7 +223,7 @@ private slots: > * @see Track::sigSamplesInserted > * @internal > */ >- void slotSamplesInserted(Track *src, sample_index_t offset, >+ void slotSamplesInserted(Kwave::Track *src, sample_index_t offset, > sample_index_t length); > > /** >@@ -234,7 +234,7 @@ private slots: > * @see Track::sigSamplesDeleted > * @internal > */ >- void slotSamplesDeleted(Track *src, sample_index_t offset, >+ void slotSamplesDeleted(Kwave::Track *src, sample_index_t offset, > sample_index_t length); > > /** >@@ -245,7 +245,7 @@ private slots: > * @see Track::sigSamplesModified > * @internal > */ >- void slotSamplesModified(Track *src, sample_index_t offset, >+ void slotSamplesModified(Kwave::Track *src, sample_index_t offset, > sample_index_t length); > > private: >@@ -255,7 +255,7 @@ private: > * @param track reference to the trac to be looked up > * @returns index of the track [0...tracks()-1] or tracks() if not found > */ >- unsigned int trackIndex(const Track *track); >+ unsigned int trackIndex(const Kwave::Track *track); > > // //signal modifying functions > // void replaceStutter (int, int); >@@ -269,7 +269,7 @@ private: > // void averageFFT (int points, window_function_t windowtype); > > /** list of tracks */ >- QList<Track *> m_tracks; >+ QList<Kwave::Track *> m_tracks; > > /** mutex for access to the track list */ > QReadWriteLock m_lock_tracks; >diff --git a/libkwave/SignalManager.cpp b/libkwave/SignalManager.cpp >index 5e22c4e..b86c692 100644 >--- a/libkwave/SignalManager.cpp >+++ b/libkwave/SignalManager.cpp >@@ -92,8 +92,8 @@ SignalManager::SignalManager(QWidget *parent) > { > // connect to the track's signals > Signal *sig = &m_signal; >- connect(sig, SIGNAL(sigTrackInserted(unsigned int, Track *)), >- this, SLOT(slotTrackInserted(unsigned int, Track *))); >+ connect(sig, SIGNAL(sigTrackInserted(unsigned int, Kwave::Track *)), >+ this, SLOT(slotTrackInserted(unsigned int, Kwave::Track *))); > connect(sig, SIGNAL(sigTrackDeleted(unsigned int)), > this, SLOT(slotTrackDeleted(unsigned int))); > connect(sig, SIGNAL(sigSamplesDeleted(unsigned int, sample_index_t, >@@ -169,7 +169,7 @@ int SignalManager::loadFile(const KUrl &url) > if (!tracks) break; > > for (track = 0; track < tracks; ++track) { >- Track *t = m_signal.appendTrack(length); >+ Kwave::Track *t = m_signal.appendTrack(length); > Q_ASSERT(t); > if (!t || (t->length() != length)) { > qWarning("out of memory"); >@@ -927,7 +927,7 @@ void SignalManager::deleteTrack(unsigned int index) > > //*************************************************************************** > void SignalManager::slotTrackInserted(unsigned int index, >- Track *track) >+ Kwave::Track *track) > { > setModified(true); > >diff --git a/libkwave/SignalManager.h b/libkwave/SignalManager.h >index aa388c1..ca03d81 100644 >--- a/libkwave/SignalManager.h >+++ b/libkwave/SignalManager.h >@@ -46,11 +46,11 @@ class KUrl; > class MultiTrackReader; > class SampleReader; > class SignalWidget; >-class Track; > class UndoAction; > class UndoTransaction; > class UndoTransactionGuard; > namespace Kwave { class MultiTrackWriter; } >+namespace Kwave { class Track; } > namespace Kwave { class Writer; } > > #define NEW_FILENAME i18n("New File") >@@ -369,7 +369,7 @@ signals: > * @param index position of the new track [0...tracks()-1] > * @param track reference to the new track > */ >- void sigTrackInserted(unsigned int index, Track *track); >+ void sigTrackInserted(unsigned int index, Kwave::Track *track); > > /** > * Signals that a track has been deleted. >@@ -448,7 +448,7 @@ private slots: > * @see Signal::sigTrackInserted > * @internal > */ >- void slotTrackInserted(unsigned int index, Track *track); >+ void slotTrackInserted(unsigned int index, Kwave::Track *track); > > /** > * Connected to the signal's sigTrackInserted. >diff --git a/libkwave/StreamWriter.h b/libkwave/StreamWriter.h >index 1251118..b35e217 100644 >--- a/libkwave/StreamWriter.h >+++ b/libkwave/StreamWriter.h >@@ -27,11 +27,10 @@ > > #include "libkwave/Writer.h" > >-class Track; >- > namespace Kwave { > > class SampleArray; >+ class Track; > > /** > * @class StreamWriter >diff --git a/libkwave/Track.cpp b/libkwave/Track.cpp >index e1561ec..2ebc460 100644 >--- a/libkwave/Track.cpp >+++ b/libkwave/Track.cpp >@@ -52,13 +52,13 @@ > #define STRIPE_LENGTH_MINIMUM (STRIPE_LENGTH_OPTIMAL / 2) > > //*************************************************************************** >-Track::Track() >+Kwave::Track::Track() > :m_lock(), m_lock_usage(), m_stripes(), m_selected(true) > { > } > > //*************************************************************************** >-Track::Track(sample_index_t length) >+Kwave::Track::Track(sample_index_t length) > :m_lock(), m_lock_usage(), m_stripes(), m_selected(true) > { > if (length < 2*STRIPE_LENGTH_OPTIMAL) { >@@ -71,7 +71,7 @@ Track::Track(sample_index_t length) > } > > //*************************************************************************** >-Track::~Track() >+Kwave::Track::~Track() > { > // wait until all readers are finished > QWriteLocker lock_usage(&m_lock_usage); >@@ -84,7 +84,7 @@ Track::~Track() > } > > //*************************************************************************** >-void Track::appendStripe(sample_index_t length) >+void Kwave::Track::appendStripe(sample_index_t length) > { > // SharedLockGuard lock(m_lock, true); > sample_index_t start = unlockedLength(); >@@ -107,7 +107,7 @@ void Track::appendStripe(sample_index_t length) > } > > //*************************************************************************** >-Stripe Track::splitStripe(Stripe &stripe, unsigned int offset) >+Stripe Kwave::Track::splitStripe(Stripe &stripe, unsigned int offset) > { > Q_ASSERT(offset < stripe.length()); > Q_ASSERT(offset); >@@ -121,21 +121,21 @@ Stripe Track::splitStripe(Stripe &stripe, unsigned int offset) > // shrink the old stripe > stripe.resize(offset); > >-// qDebug("Track::splitStripe(%p, %u): new stripe at [%u ... %u] (%u)", >+// qDebug("Kwave::Track::splitStripe(%p, %u): new stripe at [%u ... %u] (%u)", > // stripe, offset, s->start(), s->end(), s->length()); > > return s; > } > > //*************************************************************************** >-sample_index_t Track::length() >+sample_index_t Kwave::Track::length() > { > QReadLocker lock(&m_lock); > return unlockedLength(); > } > > //*************************************************************************** >-sample_index_t Track::unlockedLength() >+sample_index_t Kwave::Track::unlockedLength() > { > if (m_stripes.isEmpty()) return 0; > const Stripe &s = m_stripes.last(); >@@ -143,7 +143,7 @@ sample_index_t Track::unlockedLength() > } > > //*************************************************************************** >-Kwave::Writer *Track::openWriter(InsertMode mode, >+Kwave::Writer *Kwave::Track::openWriter(InsertMode mode, > sample_index_t left, sample_index_t right) > { > // create the input stream >@@ -154,7 +154,7 @@ Kwave::Writer *Track::openWriter(InsertMode mode, > } > > //*************************************************************************** >-SampleReader *Track::openSampleReader(Kwave::ReaderMode mode, >+SampleReader *Kwave::Track::openSampleReader(Kwave::ReaderMode mode, > sample_index_t left, sample_index_t right) > { > QReadLocker lock(&m_lock); >@@ -182,12 +182,12 @@ SampleReader *Track::openSampleReader(Kwave::ReaderMode mode, > } > > //*************************************************************************** >-void Track::deleteRange(sample_index_t offset, sample_index_t length, >- bool make_gap) >+void Kwave::Track::deleteRange(sample_index_t offset, sample_index_t length, >+ bool make_gap) > { > if (!length) return; > >-// qDebug("Track::deleteRange() [%u ... %u] (%u)", >+// qDebug("Kwave::Track::deleteRange() [%u ... %u] (%u)", > // offset, offset + length - 1, length); > > { >@@ -199,9 +199,9 @@ void Track::deleteRange(sample_index_t offset, sample_index_t length, > } > > //*************************************************************************** >-bool Track::insertSpace(sample_index_t offset, sample_index_t shift) >+bool Kwave::Track::insertSpace(sample_index_t offset, sample_index_t shift) > { >-// qDebug("Track::insertSpace(offset=%u,shift=%u)",offset, shift); >+// qDebug("Kwave::Track::insertSpace(offset=%u,shift=%u)",offset, shift); > if (!shift) return true; > > { >@@ -219,7 +219,7 @@ bool Track::insertSpace(sample_index_t offset, sample_index_t shift) > sample_index_t start = s.start(); > if (start >= offset) break; // not "within" the stripe > >-// qDebug("Track::insertSpace => splitting [%u...%u]",start,end); >+// qDebug("Kwave::Track::insertSpace => splitting [%u...%u]",start,end); > Stripe new_stripe = splitStripe(s, offset - start); > if (!new_stripe.length()) return false; // OOM ? > it.insert(new_stripe); >@@ -227,10 +227,10 @@ bool Track::insertSpace(sample_index_t offset, sample_index_t shift) > } > > // move all stripes that are after the offset right >-// qDebug("Track::insertSpace => moving right"); >+// qDebug("Kwave::Track::insertSpace => moving right"); > moveRight(offset, shift); > } else { >-// qDebug("Track::insertSpace => appending stripe at %u", offset + shift - 1); >+// qDebug("Kwave::Track::insertSpace => appending stripe at %u", offset + shift - 1); > Stripe s(offset + shift - 1); > s.resize(1); > if (s.length()) m_stripes.append(s); >@@ -243,8 +243,8 @@ bool Track::insertSpace(sample_index_t offset, sample_index_t shift) > } > > //*************************************************************************** >-void Track::unlockedDelete(sample_index_t offset, sample_index_t length, >- bool make_gap) >+void Kwave::Track::unlockedDelete(sample_index_t offset, sample_index_t length, >+ bool make_gap) > { > if (!length) return; > >@@ -343,7 +343,7 @@ void Track::unlockedDelete(sample_index_t offset, sample_index_t length, > } > > //*************************************************************************** >-void Track::select(bool selected) >+void Kwave::Track::select(bool selected) > { > if (m_selected == selected) return; > m_selected = selected; >@@ -351,15 +351,15 @@ void Track::select(bool selected) > } > > //*************************************************************************** >-void Track::toggleSelection() >+void Kwave::Track::toggleSelection() > { > select(!selected()); > } > > //*************************************************************************** >-bool Track::appendAfter(Stripe *stripe, sample_index_t offset, >- const Kwave::SampleArray &buffer, >- unsigned int buf_offset, unsigned int length) >+bool Kwave::Track::appendAfter(Stripe *stripe, sample_index_t offset, >+ const Kwave::SampleArray &buffer, >+ unsigned int buf_offset, unsigned int length) > { > Q_ASSERT(buf_offset + length <= buffer.size()); > if (buf_offset + length > buffer.size()) return false; >@@ -373,7 +373,7 @@ bool Track::appendAfter(Stripe *stripe, sample_index_t offset, > if (len + stripe->length() > STRIPE_LENGTH_MAXIMUM) > len = STRIPE_LENGTH_MAXIMUM - stripe->length(); > >-// qDebug("Track::appendAfter(): appending %u samples to %p", >+// qDebug("Kwave::Track::appendAfter(): appending %u samples to %p", > // len, stripe); > if (!stripe->append(buffer, buf_offset, len)) > return false; // out of memory >@@ -391,13 +391,13 @@ bool Track::appendAfter(Stripe *stripe, sample_index_t offset, > if (len > STRIPE_LENGTH_MAXIMUM) > len = STRIPE_LENGTH_MAXIMUM; > >-// qDebug("Track::appendAfter: new stripe, ofs=%u, len=%u", >+// qDebug("Kwave::Track::appendAfter: new stripe, ofs=%u, len=%u", > // offset, len); > Stripe new_stripe(offset); > > // append to the new stripe > if (!new_stripe.append(buffer, buf_offset, len)) { >- qWarning("Track::appendAfter FAILED / OOM"); >+ qWarning("Kwave::Track::appendAfter FAILED / OOM"); > return false; /* out of memory */ > } > Q_ASSERT(new_stripe.length() == len); >@@ -408,12 +408,12 @@ bool Track::appendAfter(Stripe *stripe, sample_index_t offset, > if (index_before >= 0) { > // insert after the last one > index_before++; >-// qDebug("Track::appendAfter: insert after %p [%10u - %10u]", >+// qDebug("Kwave::Track::appendAfter: insert after %p [%10u - %10u]", > // stripe, stripe->start(), stripe->end()); > m_stripes.insert(index_before, new_stripe); > } else { > // the one and only or insert before all others >-// qDebug("Track::appendAfter: prepending"); >+// qDebug("Kwave::Track::appendAfter: prepending"); > m_stripes.prepend(new_stripe); > index_before = 0; > } >@@ -426,7 +426,7 @@ bool Track::appendAfter(Stripe *stripe, sample_index_t offset, > } > > //*************************************************************************** >-void Track::moveRight(sample_index_t offset, sample_index_t shift) >+void Kwave::Track::moveRight(sample_index_t offset, sample_index_t shift) > { > if (m_stripes.isEmpty()) return; > QMutableListIterator<Stripe> it(m_stripes); >@@ -441,11 +441,11 @@ void Track::moveRight(sample_index_t offset, sample_index_t shift) > } > > //*************************************************************************** >-bool Track::writeSamples(InsertMode mode, >- sample_index_t offset, >- const Kwave::SampleArray &buffer, >- unsigned int buf_offset, >- unsigned int length) >+bool Kwave::Track::writeSamples(InsertMode mode, >+ sample_index_t offset, >+ const Kwave::SampleArray &buffer, >+ unsigned int buf_offset, >+ unsigned int length) > { > Q_ASSERT(length); > if (!length) return true; // nothing to do !? >@@ -470,7 +470,7 @@ bool Track::writeSamples(InsertMode mode, > case Insert: { > m_lock.lockForWrite(); > >-// qDebug("Track::writeSamples() - Insert @ %u, length=%u", >+// qDebug("Kwave::Track::writeSamples() - Insert @ %u, length=%u", > // offset, length); > > // find the stripe into which we insert >@@ -577,19 +577,19 @@ bool Track::writeSamples(InsertMode mode, > } > > //*************************************************************************** >-void Track::use() >+void Kwave::Track::use() > { > m_lock_usage.lockForRead(); > } > > //*************************************************************************** >-void Track::release() >+void Kwave::Track::release() > { > m_lock_usage.unlock(); > } > > //*************************************************************************** >-void Track::dump() >+void Kwave::Track::dump() > { > qDebug("------------------------------------"); > unsigned int index = 0; >diff --git a/libkwave/Track.h b/libkwave/Track.h >index 685dff1..3461013 100644 >--- a/libkwave/Track.h >+++ b/libkwave/Track.h >@@ -1,5 +1,5 @@ > /*************************************************************************** >- Track.h - collects one or more stripes in one track >+ Track.h - collects one or more stripes in one track > ------------------- > begin : Feb 09 2001 > copyright : (C) 2001 by Thomas Eschenbacher >@@ -33,248 +33,253 @@ > #include "libkwave/Stripe.h" > > class SampleReader; >-namespace Kwave { class TrackWriter; } >-namespace Kwave { class Writer; } > > //*************************************************************************** >-class KDE_EXPORT Track: public QObject >-{ >- Q_OBJECT >-public: >- /** >- * Default constructor. Creates a new and empty track with >- * zero-length and no stripes >- */ >- Track(); >- >- /** >- * Constructor. Creates an empty track with one stripe >- * with specified length. >- */ >- Track(sample_index_t length); >- >- /** >- * Destructor. >- */ >- virtual ~Track(); >- >- /** >- * Returns the length of the track. This is equivalent >- * to the position of the last sample of the last Stripe. >- */ >- sample_index_t length(); >- >- /** >- * Opens a stream for writing samples, starting at a >- * sample position. >- * @param mode specifies where and how to insert >- * @param left start of the input (only useful in insert and >- * overwrite mode) >- * @param right end of the input (only useful with overwrite mode) >- * @see InsertMode >- */ >- Kwave::Writer *openWriter(InsertMode mode, >- sample_index_t left = 0, sample_index_t right = 0); >- >- /** >- * Opens a stream for reading samples. If the the last position >- * is omitted, the value UINT_MAX will be used. >- * @param mode read mode, see Kwave::ReaderMode >- * @param left first offset to be read (default = 0) >- * @param right last position to read (default = UINT_MAX) >- */ >- SampleReader *openSampleReader(Kwave::ReaderMode mode, >- sample_index_t left = 0, >- sample_index_t right = SAMPLE_INDEX_MAX); >- >- /** >- * Deletes a range of samples >- * @param offset index of the first sample >- * @param length number of samples >- * @param make_gap if true, make a gap into the list of stripes >- * instead of moving the stuff from right to left >- */ >- void deleteRange(sample_index_t offset, sample_index_t length, >- bool make_gap = false); >- >- /** >- * Inserts space at a given offset by moving all stripes that are >- * are starting at or after the given offset right. >- * >- * @param offset position after which everything is moved right >- * @param shift distance of the shift [samples] >- * @return true if succeeded, false if failed (OOM?) >- */ >- bool insertSpace(sample_index_t offset, sample_index_t shift); >- >- /** Returns the "selected" flag. */ >- inline bool selected() const { return m_selected; } >- >- /** Sets the "selected" flag. */ >- void select(bool select); >- >-public slots: >- >- /** toggles the selection of the slot on/off */ >- void toggleSelection(); >- >-signals: >- >- /** >- * Emitted if the track has grown. This implies a modification of >- * the inserted data, so no extra sigSamplesModified is emitted. >- * @param src source track of the signal (*this) >- * @param offset position from which the data was inserted >- * @param length number of samples inserted >- * @see sigSamplesModified >- */ >- void sigSamplesInserted(Track *src, sample_index_t offset, >- sample_index_t length); >- >- /** >- * Emitted if data has been removed from the track. >- * @param src source track of the signal (*this) >- * @param offset position from which the data was removed >- * @param length number of samples deleted >- */ >- void sigSamplesDeleted(Track *src, sample_index_t offset, >- sample_index_t length); >- >- /** >- * Emitted if some data within the track has been modified. >- * @param src source track of the signal (*this) >- * @param offset position from which the data was modified >- * @param length number of samples modified >- */ >- void sigSamplesModified(Track *src, sample_index_t offset, >- sample_index_t length); >- >- /** >- * Emitted whenever the selection of the track has changed. >- * @param selected true if selected, false if unselected >- */ >- void sigSelectionChanged(bool selected); >- >-private: >- /** >- * Returns the current length of the stripe in samples. This >- * function uses no locks and is therefore reserved for internal >- * usage from within locked functions. >- * @note this must be private, it does no locking ! >- */ >- sample_index_t unlockedLength(); >- >- /** >- * Deletes a range of samples, used internally by deleteRange() >- * @param offset index of the first sample >- * @param length number of samples >- * @param make_gap if true, make a gap into the list of stripes >- * instead of moving the stuff from right to left >- */ >- void unlockedDelete(sample_index_t offset, sample_index_t length, >- bool make_gap = false); >- >- /** >- * Append samples after a given stripe. >- * >- * @param stripe the stripe after which to instert. Null pointer is >- * allowed, in this case a new stripe is created >- * @param offset position where the new data should start >- * @param buffer array with samples >- * @param buf_offset offset within the buffer >- * @param length number of samples to write >- * @return true if successful, false if failed (e.g. out of memory) >- */ >- bool appendAfter(Stripe *stripe, sample_index_t offset, >- const Kwave::SampleArray &buffer, >- unsigned int buf_offset, unsigned int length); >- >- /** >- * Move all stripes after an offset to the right. Only looks at the >- * start position of the stripes, comparing with ">=", if the start >- * of a stripe is at the given offset, it will not be moved! >- * >- * @param offset position after which everything is moved right >- * @param shift distance of the shift [samples] >- */ >- void moveRight(sample_index_t offset, sample_index_t shift); >- >- /** >- * Append a new stripe with a given length. >- * >- * @param length number of samples, zero is allowed >- */ >- void appendStripe(sample_index_t length); >- >- /** >- * Split a stripe into two stripes. The new stripe will be created >- * from the right portion of the given stripe and the original >- * stripe will be shrinked to it's new size. The newly created stripe >- * will be inserted into m_stripes after the old one. >- * >- * @param stripe the stripe to be split >- * @param offset the offset within the stripe, which becomes the first >- * sample in the new stripe >- * @return the new created stripe >- */ >- Stripe splitStripe(Stripe &stripe, unsigned int offset); >- >- /** >- * dump the list of stripes, for debugging >- * @internal for debugging only >- */ >- void dump(); >- >-protected: >- >- friend class Kwave::TrackWriter; >- >- /** >- * Write a block of samples. If necessary it starts, appends to, >- * or splits a stripe. >- * >- * @param mode a InsertMode (append/overwrite/insert) >- * @param offset position where to start the write operation >- * @param buffer array with samples >- * @param buf_offset offset within the buffer >- * @param length number of samples to write >- * @return true if successful, false if failed (e.g. out of memory) >- */ >- bool writeSamples(InsertMode mode, >- sample_index_t offset, >- const Kwave::SampleArray &buffer, >- unsigned int buf_offset, >- unsigned int length); >- >- /** increments the usage counter (read lock to m_lock_usage) */ >- void use(); >- >- /** decrements the usage counter (read lock to m_lock_usage) */ >- void release(); >- >-private: >- >- /** >- * Creates a new stripe with a start position and a length. >- * @param start offset of the first sample >- * @param length number of samples, zero is allowed >- * @note this must be private, it does no locking ! >- */ >- Stripe *newStripe(sample_index_t start, unsigned int length); >- >-private: >- /** read/write lock for access to the whole track */ >- QReadWriteLock m_lock; >- >- /** lock to protect against deletion while the track is in use */ >- QReadWriteLock m_lock_usage; >- >- /** list of stripes (a track actually is a container for stripes) */ >- QList<Stripe> m_stripes; >- >- /** True if the track is selected */ >- bool m_selected; >- >-}; >+namespace Kwave { >+ >+ class TrackWriter; >+ class Writer; >+ >+ class KDE_EXPORT Track: public QObject >+ { >+ Q_OBJECT >+ public: >+ /** >+ * Default constructor. Creates a new and empty track with >+ * zero-length and no stripes >+ */ >+ Track(); >+ >+ /** >+ * Constructor. Creates an empty track with one stripe >+ * with specified length. >+ */ >+ Track(sample_index_t length); >+ >+ /** >+ * Destructor. >+ */ >+ virtual ~Track(); >+ >+ /** >+ * Returns the length of the track. This is equivalent >+ * to the position of the last sample of the last Stripe. >+ */ >+ sample_index_t length(); >+ >+ /** >+ * Opens a stream for writing samples, starting at a >+ * sample position. >+ * @param mode specifies where and how to insert >+ * @param left start of the input (only useful in insert and >+ * overwrite mode) >+ * @param right end of the input (only useful with overwrite mode) >+ * @see InsertMode >+ */ >+ Kwave::Writer *openWriter(InsertMode mode, >+ sample_index_t left = 0, >+ sample_index_t right = 0); >+ >+ /** >+ * Opens a stream for reading samples. If the the last position >+ * is omitted, the value UINT_MAX will be used. >+ * @param mode read mode, see Kwave::ReaderMode >+ * @param left first offset to be read (default = 0) >+ * @param right last position to read (default = UINT_MAX) >+ */ >+ SampleReader *openSampleReader(Kwave::ReaderMode mode, >+ sample_index_t left = 0, >+ sample_index_t right = SAMPLE_INDEX_MAX); >+ >+ /** >+ * Deletes a range of samples >+ * @param offset index of the first sample >+ * @param length number of samples >+ * @param make_gap if true, make a gap into the list of stripes >+ * instead of moving the stuff from right to left >+ */ >+ void deleteRange(sample_index_t offset, sample_index_t length, >+ bool make_gap = false); >+ >+ /** >+ * Inserts space at a given offset by moving all stripes that are >+ * are starting at or after the given offset right. >+ * >+ * @param offset position after which everything is moved right >+ * @param shift distance of the shift [samples] >+ * @return true if succeeded, false if failed (OOM?) >+ */ >+ bool insertSpace(sample_index_t offset, sample_index_t shift); >+ >+ /** Returns the "selected" flag. */ >+ inline bool selected() const { return m_selected; } >+ >+ /** Sets the "selected" flag. */ >+ void select(bool select); >+ >+ public slots: >+ >+ /** toggles the selection of the slot on/off */ >+ void toggleSelection(); >+ >+ signals: >+ >+ /** >+ * Emitted if the track has grown. This implies a modification of >+ * the inserted data, so no extra sigSamplesModified is emitted. >+ * @param src source track of the signal (*this) >+ * @param offset position from which the data was inserted >+ * @param length number of samples inserted >+ * @see sigSamplesModified >+ */ >+ void sigSamplesInserted(Kwave::Track *src, sample_index_t offset, >+ sample_index_t length); >+ >+ /** >+ * Emitted if data has been removed from the track. >+ * @param src source track of the signal (*this) >+ * @param offset position from which the data was removed >+ * @param length number of samples deleted >+ */ >+ void sigSamplesDeleted(Kwave::Track *src, sample_index_t offset, >+ sample_index_t length); >+ >+ /** >+ * Emitted if some data within the track has been modified. >+ * @param src source track of the signal (*this) >+ * @param offset position from which the data was modified >+ * @param length number of samples modified >+ */ >+ void sigSamplesModified(Kwave::Track *src, sample_index_t offset, >+ sample_index_t length); >+ >+ /** >+ * Emitted whenever the selection of the track has changed. >+ * @param selected true if selected, false if unselected >+ */ >+ void sigSelectionChanged(bool selected); >+ >+ private: >+ /** >+ * Returns the current length of the stripe in samples. This >+ * function uses no locks and is therefore reserved for internal >+ * usage from within locked functions. >+ * @note this must be private, it does no locking ! >+ */ >+ sample_index_t unlockedLength(); >+ >+ /** >+ * Deletes a range of samples, used internally by deleteRange() >+ * @param offset index of the first sample >+ * @param length number of samples >+ * @param make_gap if true, make a gap into the list of stripes >+ * instead of moving the stuff from right to left >+ */ >+ void unlockedDelete(sample_index_t offset, sample_index_t length, >+ bool make_gap = false); >+ >+ /** >+ * Append samples after a given stripe. >+ * >+ * @param stripe the stripe after which to instert. Null pointer is >+ * allowed, in this case a new stripe is created >+ * @param offset position where the new data should start >+ * @param buffer array with samples >+ * @param buf_offset offset within the buffer >+ * @param length number of samples to write >+ * @return true if successful, false if failed (e.g. out of memory) >+ */ >+ bool appendAfter(Stripe *stripe, sample_index_t offset, >+ const Kwave::SampleArray &buffer, >+ unsigned int buf_offset, unsigned int length); >+ >+ /** >+ * Move all stripes after an offset to the right. Only looks at the >+ * start position of the stripes, comparing with ">=", if the start >+ * of a stripe is at the given offset, it will not be moved! >+ * >+ * @param offset position after which everything is moved right >+ * @param shift distance of the shift [samples] >+ */ >+ void moveRight(sample_index_t offset, sample_index_t shift); >+ >+ /** >+ * Append a new stripe with a given length. >+ * >+ * @param length number of samples, zero is allowed >+ */ >+ void appendStripe(sample_index_t length); >+ >+ /** >+ * Split a stripe into two stripes. The new stripe will be created >+ * from the right portion of the given stripe and the original >+ * stripe will be shrinked to it's new size. The newly created stripe >+ * will be inserted into m_stripes after the old one. >+ * >+ * @param stripe the stripe to be split >+ * @param offset the offset within the stripe, which becomes the first >+ * sample in the new stripe >+ * @return the new created stripe >+ */ >+ Stripe splitStripe(Stripe &stripe, unsigned int offset); >+ >+ /** >+ * dump the list of stripes, for debugging >+ * @internal for debugging only >+ */ >+ void dump(); >+ >+ protected: >+ >+ friend class Kwave::TrackWriter; >+ >+ /** >+ * Write a block of samples. If necessary it starts, appends to, >+ * or splits a stripe. >+ * >+ * @param mode a InsertMode (append/overwrite/insert) >+ * @param offset position where to start the write operation >+ * @param buffer array with samples >+ * @param buf_offset offset within the buffer >+ * @param length number of samples to write >+ * @return true if successful, false if failed (e.g. out of memory) >+ */ >+ bool writeSamples(InsertMode mode, >+ sample_index_t offset, >+ const Kwave::SampleArray &buffer, >+ unsigned int buf_offset, >+ unsigned int length); >+ >+ /** increments the usage counter (read lock to m_lock_usage) */ >+ void use(); >+ >+ /** decrements the usage counter (read lock to m_lock_usage) */ >+ void release(); >+ >+ private: >+ >+ /** >+ * Creates a new stripe with a start position and a length. >+ * @param start offset of the first sample >+ * @param length number of samples, zero is allowed >+ * @note this must be private, it does no locking ! >+ */ >+ Stripe *newStripe(sample_index_t start, unsigned int length); >+ >+ private: >+ /** read/write lock for access to the whole track */ >+ QReadWriteLock m_lock; >+ >+ /** lock to protect against deletion while the track is in use */ >+ QReadWriteLock m_lock_usage; >+ >+ /** list of stripes (a track actually is a container for stripes) */ >+ QList<Stripe> m_stripes; >+ >+ /** True if the track is selected */ >+ bool m_selected; >+ >+ }; >+} > > #endif /* _TRACK_H_ */ >diff --git a/libkwave/TrackWriter.cpp b/libkwave/TrackWriter.cpp >index 7f72dca..2fbe22a 100644 >--- a/libkwave/TrackWriter.cpp >+++ b/libkwave/TrackWriter.cpp >@@ -28,7 +28,7 @@ > #define MIN_PROGRESS_INTERVAL 500 > > //*************************************************************************** >-Kwave::TrackWriter::TrackWriter(Track &track, InsertMode mode, >+Kwave::TrackWriter::TrackWriter(Kwave::Track &track, InsertMode mode, > sample_index_t left, sample_index_t right) > :Kwave::Writer(mode, left, right), > m_track(track), m_progress_time() >diff --git a/libkwave/TrackWriter.h b/libkwave/TrackWriter.h >index 170bdd4..df3dbc9 100644 >--- a/libkwave/TrackWriter.h >+++ b/libkwave/TrackWriter.h >@@ -27,11 +27,10 @@ > > #include "libkwave/Writer.h" > >-class Track; >- > namespace Kwave { > > class SampleArray; >+ class Track; > > /** > * @class TrackWriter >@@ -54,7 +53,7 @@ namespace Kwave { > * @param right end of the input (only useful with overwrite mode) > * @see InsertMode > */ >- TrackWriter(Track &track, InsertMode mode, >+ TrackWriter(Kwave::Track &track, InsertMode mode, > sample_index_t left = 0, sample_index_t right = 0); > > /** >@@ -78,7 +77,7 @@ namespace Kwave { > private: > > /** the track that receives our data */ >- Track &m_track; >+ Kwave::Track &m_track; > > /** timer for limiting the number of progress signals per second */ > QTime m_progress_time; >diff --git a/libkwave/undo/UndoDeleteTrack.h b/libkwave/undo/UndoDeleteTrack.h >index 039395a..8ea0cea 100644 >--- a/libkwave/undo/UndoDeleteTrack.h >+++ b/libkwave/undo/UndoDeleteTrack.h >@@ -75,7 +75,7 @@ protected: > sample_index_t m_length; > > /** track that serves as buffer with undo data */ >- Track m_buffer_track; >+ Kwave::Track m_buffer_track; > > }; > >diff --git a/libkwave/undo/UndoModifyAction.h b/libkwave/undo/UndoModifyAction.h >index c136db4..ae05264 100644 >--- a/libkwave/undo/UndoModifyAction.h >+++ b/libkwave/undo/UndoModifyAction.h >@@ -77,7 +77,7 @@ protected: > sample_index_t m_length; > > /** track that serves as buffer with undo data */ >- Track m_buffer_track; >+ Kwave::Track m_buffer_track; > > }; > >diff --git a/plugins/fileinfo/KeywordWidget.cpp b/plugins/fileinfo/KeywordWidget.cpp >index 0f8856d..a1d46ab 100644 >--- a/plugins/fileinfo/KeywordWidget.cpp >+++ b/plugins/fileinfo/KeywordWidget.cpp >@@ -113,7 +113,7 @@ void KeywordWidget::update() > btAdd->setEnabled(edit.length() && !contained(edit)); > > // "Remove" is only enabled if something out of the list has been selected >- btRemove->setEnabled((lstKeywords->currentItem() >= 0) && >+ btRemove->setEnabled((lstKeywords->currentItem() != 0) && > (contained(edit) || !edit.length())); > > // the list is only enabled if it is not empty >-- >1.7.4.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 412007
: 308933