File fix-amarok-startup-crashes.patch of Package kde3-amarok
From 670b8acba25ca1412a628cbf5d6460c197f92fc2 Mon Sep 17 00:00:00 2001
From: Timothy Pearson <kb9vqf@pearsoncomputing.net>
Date: Fri, 03 May 2013 20:58:35 +0000
Subject: Fix Amarok startup crashes
Fix a number of warnings and glitches
---
diff --git a/amarok/src/analyzers/blockanalyzer.cpp b/amarok/src/analyzers/blockanalyzer.cpp
index 666340a..444f177 100644
--- a/amarok/src/analyzers/blockanalyzer.cpp
+++ b/amarok/src/analyzers/blockanalyzer.cpp
@@ -148,8 +152,12 @@ BlockAnalyzer::analyze( const Analyzer::Scope &s )
// Paint the background
bitBlt( canvas(), 0, 0, background() );
- for( uint y, x = 0; x < m_scope.size(); ++x )
+ uint y;
+ for( uint x = 0; x < m_scope.size(); ++x )
{
+ if (m_yscale.size() < 1)
+ return;
+
// determine y
for( y = 0; m_scope[x] < m_yscale[y]; ++y )
;
@@ -174,15 +185,17 @@ BlockAnalyzer::analyze( const Analyzer::Scope &s )
bitBlt( canvas(), x*(WIDTH+1), y, &m_fade_bars[offset], 0, 0, WIDTH, height() - y );
}
- if( m_fade_intensity[x] == 0 )
+ if( m_fade_intensity[x] == 0 ) {
m_fade_pos[x] = m_rows;
+ }
//REMEMBER: y is a number from 0 to m_rows, 0 means all blocks are glowing, m_rows means none are
bitBlt( canvas(), x*(WIDTH+1), y*(HEIGHT+1) + m_y, bar(), 0, y*(HEIGHT+1) );
}
- for( uint x = 0; x < m_store.size(); ++x )
+ for( uint x = 0; x < m_store.size(); ++x ) {
bitBlt( canvas(), x*(WIDTH+1), int(m_store[x])*(HEIGHT+1) + m_y, &m_topBarPixmap );
+ }
}
diff --git a/amarok/src/analyzers/boomanalyzer.cpp b/amarok/src/analyzers/boomanalyzer.cpp
index 3505c82..3f7f822 100644
--- a/amarok/src/analyzers/boomanalyzer.cpp
+++ b/amarok/src/analyzers/boomanalyzer.cpp
@@ -71,7 +71,18 @@ BoomAnalyzer::init()
{
const double F = (double)y * h;
- p.setPen( QColor( 255 - int(229.0 * F), 255 - int(229.0 * F), 255 - int(191.0 * F) ) );
+ int r = 255 - int(229.0 * F);
+ int g = 255 - int(229.0 * F);
+ int b = 255 - int(191.0 * F);
+
+ if (r < 0) r = 0;
+ if (g < 0) g = 0;
+ if (b < 0) b = 0;
+ if (r > 255) r = 255;
+ if (g > 255) g = 255;
+ if (b > 255) b = 255;
+
+ p.setPen( QColor( r, g, b ) );
p.drawLine( 0, y, COLUMN_WIDTH-2, y );
}
}
diff --git a/amarok/src/browserbar.cpp b/amarok/src/browserbar.cpp
index 1d3e862..ef1babf 100644
--- a/amarok/src/browserbar.cpp
+++ b/amarok/src/browserbar.cpp
@@ -94,9 +94,11 @@ BrowserBar::BrowserBar( TQWidget *parent )
m_tabBar->setFixedWidth( m_pos );
m_tabBar->move( 0, 25 );
- QVBoxLayout *layout = new QVBoxLayout( m_browserBox );
- layout->addSpacing( 3 ); // aesthetics
- layout->setAutoAdd( true );
+ if (m_browserBox && (!m_browserBox->layout())) {
+ QVBoxLayout *layout = new QVBoxLayout( m_browserBox );
+ layout->addSpacing( 3 ); // aesthetics
+ layout->setAutoAdd( true );
+ }
m_browserBox->move( m_pos, 0 );
m_browserBox->hide();
diff --git a/amarok/src/collectionscanner/collectionscanner.cpp b/amarok/src/collectionscanner/collectionscanner.cpp
index 8636410..7dace13 100644
--- a/amarok/src/collectionscanner/collectionscanner.cpp
+++ b/amarok/src/collectionscanner/collectionscanner.cpp
@@ -213,7 +214,9 @@ CollectionScanner::readDir( const QString& dir, QStringList& entries )
f = i; break;
}
#else
- f = m_processedDirs.find( de );
+ if (m_processedDirs.count() > 0) {
+ f = m_processedDirs.find( de );
+ }
#endif
if ( ! S_ISDIR( statBuf.st_mode ) || f != -1 ) {
diff --git a/amarok/src/contextbrowser.cpp b/amarok/src/contextbrowser.cpp
index 1d3ff5b..7cdc031 100644
--- a/amarok/src/contextbrowser.cpp
+++ b/amarok/src/contextbrowser.cpp
@@ -361,7 +361,7 @@ ContextBrowser::ContextBrowser( const char *name )
this, SLOT( tagsChanged( const QString&, const QString& ) ) );
connect( CollectionDB::instance(), SIGNAL( ratingChanged( const QString&, int ) ),
this, SLOT( ratingOrScoreOrLabelsChanged( const QString& ) ) );
- connect( StarManager::instance(), SIGNAL( ratingsColorsChanged() ),
+ connect( StarManager::instance(), SIGNAL( ratingsColorsChanged( const QString& ) ),
this, SLOT( ratingOrScoreOrLabelsChanged( const QString& ) ) );
connect( CollectionDB::instance(), SIGNAL( scoreChanged( const QString&, float ) ),
this, SLOT( ratingOrScoreOrLabelsChanged( const QString& ) ) );
diff --git a/amarok/src/playlistwindow.cpp b/amarok/src/playlistwindow.cpp
index 677f73f..c7f6c79 100644
--- a/amarok/src/playlistwindow.cpp
+++ b/amarok/src/playlistwindow.cpp
@@ -419,7 +419,7 @@ void PlaylistWindow::init()
QBoxLayout *layV = new QVBoxLayout( this );
layV->addWidget( m_menubar );
layV->addWidget( m_browsers, 1 );
- layV->addWidget( m_toolbar );
+// layV->addWidget( m_toolbar );
layV->addSpacing( 2 );
layV->addWidget( statusbar );
diff --git a/amarok/src/starmanager.cpp b/amarok/src/starmanager.cpp
index d759ead..adeb866 100644
--- a/amarok/src/starmanager.cpp
+++ b/amarok/src/starmanager.cpp
@@ -101,7 +104,9 @@ StarManager::reinitStars( int height, int margin )
if( CollectionView::instance() &&
CollectionView::instance()->viewMode() == CollectionView::modeFlatView )
CollectionView::instance()->triggerUpdate();
- emit ratingsColorsChanged();
+ // FIXME
+ // Not ideal but should work sufficiently for now
+ emit ratingsColorsChanged(QString::null);
}
QPixmap*
diff --git a/amarok/src/starmanager.h b/amarok/src/starmanager.h
index acf2b5c..ebcbdaf 100644
--- a/amarok/src/starmanager.h
+++ b/amarok/src/starmanager.h
@@ -41,7 +41,7 @@ class StarManager : public QObject
void reinitStars( int height = -1, int margin = -1 );
signals:
- void ratingsColorsChanged();
+ void ratingsColorsChanged( const QString &url );
private: