aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2008-08-13 14:10:55 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2008-08-13 14:10:55 +0000
commitb5833f9423ecdc673f653dbb3f4bca6dacc918c1 (patch)
tree3ab466ec064339c789fc6f43d15c085659621413
parente16f15ff12eb654d2c09f5a280d28389a3ad74fc (diff)
downloadqmmp-b5833f9423ecdc673f653dbb3f4bca6dacc918c1.tar.gz
qmmp-b5833f9423ecdc673f653dbb3f4bca6dacc918c1.tar.bz2
qmmp-b5833f9423ecdc673f653dbb3f4bca6dacc918c1.zip
imported 0.2 fixes
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@495 90c681e8-e032-0410-971d-27865f9a5e38
-rw-r--r--src/plugins/FileDialogs/QmmpFileDialog/qmmpfiledialogimpl.cpp11
-rw-r--r--src/plugins/FileDialogs/QmmpFileDialog/qmmpfiledialogimpl.h25
-rw-r--r--src/plugins/Input/mad/decoder_mad.cpp151
-rw-r--r--src/plugins/Input/mad/decoder_mad.h49
-rw-r--r--src/ui/eqgraph.cpp226
-rw-r--r--src/ui/eqtitlebar.cpp6
-rw-r--r--src/ui/eqwidget.cpp77
-rw-r--r--src/ui/playlisttitlebar.cpp2
-rw-r--r--src/ui/skin.cpp7
-rw-r--r--src/ui/titlebar.cpp8
10 files changed, 315 insertions, 247 deletions
diff --git a/src/plugins/FileDialogs/QmmpFileDialog/qmmpfiledialogimpl.cpp b/src/plugins/FileDialogs/QmmpFileDialog/qmmpfiledialogimpl.cpp
index f3648d7e0..d515e1762 100644
--- a/src/plugins/FileDialogs/QmmpFileDialog/qmmpfiledialogimpl.cpp
+++ b/src/plugins/FileDialogs/QmmpFileDialog/qmmpfiledialogimpl.cpp
@@ -58,8 +58,14 @@ QmmpFileDialogImpl::QmmpFileDialogImpl(QWidget * parent, Qt::WindowFlags f) : QD
{
setupUi(this);
setAttribute(Qt::WA_QuitOnClose, FALSE);
+#if QT_VERSION >= 0x040400
+ m_model = new QFileSystemModel(this);
+ m_model->setNameFilterDisables (FALSE);
+#else
m_model = new QDirModel(this);
- m_model->setSorting(QDir::Type /*| QDir::Name*/);
+ m_model->setSorting(QDir::Type);
+#endif
+
fileListView->setModel(m_model);
treeView->setModel(m_model);
listToolButton->setChecked(true);
@@ -250,6 +256,9 @@ void QmmpFileDialogImpl::setModeAndMask(const QString& d,FileDialog::Mode m, con
{
fileListView->setRootIndex(m_model->index(path));
treeView->setRootIndex(m_model->index(path));
+#if QT_VERSION >= 0x040400
+ m_model->setRootPath(path);
+#endif
}
if (m == FileDialog::AddDirs || m == FileDialog::AddDir)
diff --git a/src/plugins/FileDialogs/QmmpFileDialog/qmmpfiledialogimpl.h b/src/plugins/FileDialogs/QmmpFileDialog/qmmpfiledialogimpl.h
index 279d3ef1d..443e54c5a 100644
--- a/src/plugins/FileDialogs/QmmpFileDialog/qmmpfiledialogimpl.h
+++ b/src/plugins/FileDialogs/QmmpFileDialog/qmmpfiledialogimpl.h
@@ -25,12 +25,14 @@
#include <QDialog>
#include <QCompleter>
#include <QAbstractItemView>
-#include <QDirModel>
#include <qmmpui/filedialog.h>
-//class QDirModel;
-
+#if QT_VERSION >= 0x040400
+#include <QFileSystemModel>
+#else
+#include <QDirModel>
+#endif
class QmmpFileDialogImpl : public QDialog , private Ui::QmmpFileDialog
{
@@ -54,12 +56,18 @@ protected slots:
void on_listToolButton_toggled(bool);
void on_detailsToolButton_toggled(bool);
void on_fileTypeComboBox_activated(int);
-
+
signals:
void filesAdded(const QStringList&);
protected:
+
+#if QT_VERSION >= 0x040400
+ QFileSystemModel* m_model;
+#else
QDirModel* m_model;
+#endif
+
virtual void hideEvent (QHideEvent *event);
private slots:
@@ -85,7 +93,12 @@ public:
QString pathFromIndex(const QModelIndex &index) const
{
+#if QT_VERSION >= 0x040400
+ const QFileSystemModel *dirModel = static_cast<const QFileSystemModel *>(model());
+#else
const QDirModel *dirModel = static_cast<const QDirModel *>(model());
+#endif
+
QString currentLocation = dirModel->filePath(m_itemView->rootIndex());
QString path = dirModel->filePath(index);
if (path.startsWith(currentLocation))
@@ -103,7 +116,11 @@ public:
QStringList parts;
if (!path.startsWith(QDir::separator()))
{
+#if QT_VERSION >= 0x040400
+ const QFileSystemModel *dirModel = static_cast<const QFileSystemModel *>(model());
+#else
const QDirModel *dirModel = static_cast<const QDirModel *>(model());
+#endif
QString currentLocation = QDir::toNativeSeparators(dirModel->filePath(m_itemView->rootIndex()));
parts = QCompleter::splitPath(currentLocation);
}
diff --git a/src/plugins/Input/mad/decoder_mad.cpp b/src/plugins/Input/mad/decoder_mad.cpp
index d29781622..7c8cc8f1b 100644
--- a/src/plugins/Input/mad/decoder_mad.cpp
+++ b/src/plugins/Input/mad/decoder_mad.cpp
@@ -122,9 +122,15 @@ bool DecoderMAD::initialize()
if (! findHeader())
{
- qDebug("DecoderMAD: Cannot find a valid MPEG header.");
+ qDebug("DecoderMAD: Can't find a valid MPEG header.");
return FALSE;
}
+ mad_stream_buffer(&stream, (unsigned char *) input_buf, input_bytes);
+ stream.error = MAD_ERROR_NONE;
+ stream.error = MAD_ERROR_BUFLEN;
+ mad_frame_mute (&frame);
+ stream.next_frame = NULL;
+ stream.sync = 0;
configure(freq, channels, 16, bitrate);
inited = TRUE;
@@ -221,78 +227,116 @@ fail:
bool DecoderMAD::findHeader()
{
- bool result = false;
+ bool result = FALSE;
int count = 0;
+ bool has_xing = FALSE;
+ bool is_vbr = FALSE;
+ mad_timer_t duration = mad_timer_zero;
+ struct mad_header header;
+ mad_header_init (&header);
- while (1)
+ while (TRUE)
{
- if (input_bytes < globalBufferSize)
+ input_bytes = 0;
+ if (stream.error == MAD_ERROR_BUFLEN || !stream.buffer)
{
- int bytes = input()->read(input_buf + input_bytes,
- globalBufferSize - input_bytes);
- if (bytes <= 0)
+ size_t remaining = 0;
+
+ if (!stream.next_frame)
{
- if (bytes == -1)
- result = false;
- ;
- break;
+ remaining = stream.bufend - stream.next_frame;
+ memmove (input_buf, stream.next_frame, remaining);
}
- input_bytes += bytes;
- }
- mad_stream_buffer(&stream, (unsigned char *) input_buf, input_bytes);
+ input_bytes = input()->read(input_buf + remaining, globalBufferSize - remaining);
- bool done = false;
- while (! done)
+ if (input_bytes <= 0)
+ break;
+
+ mad_stream_buffer(&stream, (unsigned char *) input_buf + remaining, input_bytes);
+ stream.error = MAD_ERROR_NONE;
+ }
+
+ if (mad_header_decode(&header, &stream) == -1)
{
- if (mad_frame_decode(&frame, &stream) != -1)
- done = true;
- else if (!MAD_RECOVERABLE(stream.error))
+ if (stream.error == MAD_ERROR_BUFLEN)
+ continue;
+ else if (MAD_RECOVERABLE(stream.error))
+ continue;
+ else
{
- qWarning("DecoderMAD: Can't decode frame");
+ qDebug ("DecoderMAD: Can't decode header: %s", mad_stream_errorstr(&stream));
break;
}
-
- count++;
}
+ result = TRUE;
- findXingHeader(stream.anc_ptr, stream.anc_bitlen);
- result = done;
- if ((stream.error != MAD_ERROR_BUFLEN))
+ if (input()->isSequential())
break;
- input_bytes = &input_buf[input_bytes] - (char *) stream.next_frame;
- memmove(input_buf, stream.next_frame, input_bytes);
- }
+ count ++;
+ //try to detect xing header
+ if (count == 1)
+ {
+ frame.header = header;
+ if (mad_frame_decode(&frame, &stream) != -1 &&
+ findXingHeader(stream.anc_ptr, stream.anc_bitlen))
+ {
+ is_vbr = TRUE;
- if (result && count)
- {
- freq = frame.header.samplerate;
- channels = MAD_NCHANNELS(&frame.header);
- bitrate = frame.header.bitrate / 1000;
- calcLength(&frame.header);
- }
+ qDebug ("DecoderMAD: Xing header detected");
- return result;
-}
+ if (xing.flags & XING_FRAMES)
+ {
+ has_xing = TRUE;
+ count = xing.frames;
+ break;
+ }
+ }
+ }
+ //try to detect VBR
+ if (!is_vbr && !(count > 15))
+ {
+ if (bitrate && header.bitrate != bitrate)
+ {
+ qDebug ("DecoderMAD: VBR detected");
+ is_vbr = TRUE;
+ }
+ else
+ bitrate = header.bitrate;
+ }
+ else if (!is_vbr)
+ {
+ qDebug ("DecoderMAD: Fixed rate detected");
+ break;
+ }
+ mad_timer_add (&duration, header.duration);
+ }
-void DecoderMAD::calcLength(struct mad_header *header)
-{
- if (! input() || input()->isSequential())
- return;
+ if (!result)
+ return FALSE;
- totalTime = 0.;
- if (xing.flags & XING_FRAMES)
+ if (!is_vbr)
{
- mad_timer_t timer;
-
- timer = header->duration;
- mad_timer_multiply(&timer, xing.frames);
-
- totalTime = double(mad_timer_count(timer, MAD_UNITS_MILLISECONDS)) / 1000.;
+ double time = (input()->size() * 8.0) / (header.bitrate);
+ double timefrac = (double)time - ((long)(time));
+ mad_timer_set(&duration, (long)time, (long)(timefrac*100), 100);
+ }
+ else if (has_xing)
+ {
+ mad_timer_multiply (&header.duration, count);
+ duration = header.duration;
}
- else if (header->bitrate > 0)
- totalTime = input()->size() * 8 / header->bitrate;
+
+ totalTime = mad_timer_count(duration, MAD_UNITS_SECONDS);
+ qDebug ("DecoderMAD: Total time: %ld", long(totalTime));
+ freq = header.samplerate;
+ channels = MAD_NCHANNELS(&header);
+ bitrate = header.bitrate / 1000;
+ mad_header_finish(&header);
+ input()->seek(0);
+ input_bytes = 0;
+ return TRUE;
}
double DecoderMAD::lengthInSeconds()
@@ -352,7 +396,7 @@ void DecoderMAD::flush(bool final)
void DecoderMAD::run()
{
- int skip_frames = 0;
+ int skip_frames = 1; //skip first frame
mutex()->lock();
if (! inited)
@@ -429,6 +473,9 @@ void DecoderMAD::run()
{
if (mad_frame_decode(&frame, &stream) == -1)
{
+ if (stream.error == MAD_ERROR_LOSTSYNC)
+ continue;
+
if (stream.error == MAD_ERROR_BUFLEN)
break;
diff --git a/src/plugins/Input/mad/decoder_mad.h b/src/plugins/Input/mad/decoder_mad.h
index 313af2e0f..f37016657 100644
--- a/src/plugins/Input/mad/decoder_mad.h
+++ b/src/plugins/Input/mad/decoder_mad.h
@@ -12,7 +12,8 @@ class DecoderMAD;
#include <qmmp/decoder.h>
#include "decodermadfactory.h"
-extern "C" {
+extern "C"
+{
#include <mad.h>
}
@@ -20,8 +21,8 @@ extern "C" {
class DecoderMAD : public Decoder
{
public:
- DecoderMAD(QObject *parent = 0, DecoderFactory *d = 0,
- QIODevice *i = 0, Output *o = 0);
+ DecoderMAD(QObject *parent = 0, DecoderFactory *d = 0,
+ QIODevice *i = 0, Output *o = 0);
virtual ~DecoderMAD();
// standard decoder API
@@ -30,17 +31,6 @@ public:
void seek(double);
void stop();
- // Equalizer
- //bool isEQSupported() const { return TRUE; }
- //void setEQEnabled(bool);
- //void setEQ(const EqPreset &);
-
- static const int maxDecodeRetries;
- static const int maxFrameSize;
- static const int maxFrameCheck;
- static const int initialFrameSize;
-
-
private:
// thread run function
void run();
@@ -53,12 +43,11 @@ private:
void deinit();
bool findHeader();
bool findXingHeader(struct mad_bitptr, unsigned int);
- void calcLength(struct mad_header *);
-
bool inited, user_stop, done, finish, derror, eof, useeq;
double totalTime, seekTime;
int channels;
- long bitrate, freq, len;
+ unsigned long bitrate;
+ long freq, len;
unsigned int bks;
mad_fixed_t eqbands[32];
@@ -71,19 +60,21 @@ private:
unsigned long output_bytes, output_at, output_size;
// MAD decoder
- struct {
- int flags;
- unsigned long frames;
- unsigned long bytes;
- unsigned char toc[100];
- long scale;
+ struct
+ {
+ int flags;
+ unsigned long frames;
+ unsigned long bytes;
+ unsigned char toc[100];
+ long scale;
} xing;
- enum {
- XING_FRAMES = 0x0001,
- XING_BYTES = 0x0002,
- XING_TOC = 0x0004,
- XING_SCALE = 0x0008
+ enum
+ {
+ XING_FRAMES = 0x0001,
+ XING_BYTES = 0x0002,
+ XING_TOC = 0x0004,
+ XING_SCALE = 0x0008
};
struct mad_stream stream;
@@ -92,4 +83,4 @@ private:
};
-#endif // __decoder_mad_h
+#endif // DECODER_MAD_H
diff --git a/src/ui/eqgraph.cpp b/src/ui/eqgraph.cpp
index 314e504d9..1492a32e6 100644
--- a/src/ui/eqgraph.cpp
+++ b/src/ui/eqgraph.cpp
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2006 by Ilya Kotov *
+ * Copyright (C) 2006-2008 by Ilya Kotov *
* forkotov02@hotmail.ru *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -22,142 +22,142 @@
#include "skin.h"
#include "eqgraph.h"
-EQGraph::EQGraph ( QWidget *parent )
- : PixmapWidget ( parent )
+EQGraph::EQGraph (QWidget *parent)
+ : PixmapWidget (parent)
{
- m_skin = Skin::getPointer();
- setPixmap ( m_skin->getEqPart ( Skin::EQ_GRAPH ) );
- clear();
- draw();
- connect ( m_skin, SIGNAL ( skinChanged() ), this, SLOT ( updateSkin() ) );
+ m_skin = Skin::getPointer();
+ setPixmap (m_skin->getEqPart (Skin::EQ_GRAPH));
+ clear();
+ draw();
+ connect (m_skin, SIGNAL (skinChanged()), this, SLOT (updateSkin()));
+ setVisible(!m_skin->getEqPart (Skin::EQ_GRAPH).isNull());
}
-
EQGraph::~EQGraph()
{}
-void EQGraph::addValue ( int value )
+void EQGraph::addValue (int value)
{
- if ( m_values.size() >= 10 )
- return;
- m_values.append ( value );
- if ( m_values.size() == 10 )
- {
- draw();
- }
+ if (m_values.size() >= 10)
+ return;
+ m_values.append (value);
+ if (m_values.size() == 10)
+ {
+ draw();
+ }
}
void EQGraph::clear ()
{
- m_values.clear();
- update();
+ m_values.clear();
+ update();
}
-void EQGraph::init_spline ( double * x, double * y, int n, double * y2 )
+void EQGraph::init_spline (double * x, double * y, int n, double * y2)
{
- int i, k;
- double p, qn, sig, un, *u;
-
- //u = ( gfloat * ) g_malloc ( n * sizeof ( gfloat ) );
- u = new double[n];
-
- y2[0] = u[0] = 0.0;
-
- for ( i = 1; i < n - 1; i++ )
- {
- sig = ( ( double ) x[i] - x[i - 1] ) / ( ( double ) x[i + 1] - x[i - 1] );
- p = sig * y2[i - 1] + 2.0;
- y2[i] = ( sig - 1.0 ) / p;
- u[i] =
- ( ( ( double ) y[i + 1] - y[i] ) / ( x[i + 1] - x[i] ) ) -
- ( ( ( double ) y[i] - y[i - 1] ) / ( x[i] - x[i - 1] ) );
- u[i] = ( 6.0 * u[i] / ( x[i + 1] - x[i - 1] ) - sig * u[i - 1] ) / p;
- }
- qn = un = 0.0;
-
- y2[n - 1] = ( un - qn * u[n - 2] ) / ( qn * y2[n - 2] + 1.0 );
- for ( k = n - 2; k >= 0; k-- )
- y2[k] = y2[k] * y2[k + 1] + u[k];
- //g_free ( u );
- delete[] u;
+ int i, k;
+ double p, qn, sig, un, *u;
+
+ u = new double[n];
+
+ y2[0] = u[0] = 0.0;
+
+ for (i = 1; i < n - 1; i++)
+ {
+ sig = ((double) x[i] - x[i - 1]) / ((double) x[i + 1] - x[i - 1]);
+ p = sig * y2[i - 1] + 2.0;
+ y2[i] = (sig - 1.0) / p;
+ u[i] =
+ (((double) y[i + 1] - y[i]) / (x[i + 1] - x[i])) -
+ (((double) y[i] - y[i - 1]) / (x[i] - x[i - 1]));
+ u[i] = (6.0 * u[i] / (x[i + 1] - x[i - 1]) - sig * u[i - 1]) / p;
+ }
+ qn = un = 0.0;
+
+ y2[n - 1] = (un - qn * u[n - 2]) / (qn * y2[n - 2] + 1.0);
+ for (k = n - 2; k >= 0; k--)
+ y2[k] = y2[k] * y2[k + 1] + u[k];
+ delete[] u;
}
-double EQGraph::eval_spline ( double xa[], double ya[], double y2a[], int n, double x )
+double EQGraph::eval_spline (double xa[], double ya[], double y2a[], int n, double x)
{
- int klo, khi, k;
- double h, b, a;
-
- klo = 0;
- khi = n - 1;
- while ( khi - klo > 1 )
- {
- k = ( khi + klo ) >> 1;
- if ( xa[k] > x )
- khi = k;
- else
- klo = k;
- }
- h = xa[khi] - xa[klo];
- a = ( xa[khi] - x ) / h;
- b = ( x - xa[klo] ) / h;
- return ( a * ya[klo] + b * ya[khi] +
- ( ( a * a * a - a ) * y2a[klo] +
- ( b * b * b - b ) * y2a[khi] ) * ( h * h ) / 6.0 );
+ int klo, khi, k;
+ double h, b, a;
+
+ klo = 0;
+ khi = n - 1;
+ while (khi - klo > 1)
+ {
+ k = (khi + klo) >> 1;
+ if (xa[k] > x)
+ khi = k;
+ else
+ klo = k;
+ }
+ h = xa[khi] - xa[klo];
+ a = (xa[khi] - x) / h;
+ b = (x - xa[klo]) / h;
+ return (a * ya[klo] + b * ya[khi] +
+ ((a * a * a - a) * y2a[klo] +
+ (b * b * b - b) * y2a[khi]) * (h * h) / 6.0);
}
void EQGraph::draw()
{
- if(m_values.size()!=10)
- {
- setPixmap ( m_skin->getEqPart ( Skin::EQ_GRAPH ) );
- return;
- }
-
- int i, y, ymin, ymax, py = 0;
- double x[] = { 0, 11, 23, 35, 47, 59, 71, 83, 97, 109 }, yf[10];
- double *bands = new double[10];
-
- for ( int i = 0; i<10; ++i )
- {
- bands[i] = m_values.at ( i );
- }
- QPixmap pixmap = m_skin->getEqPart ( Skin::EQ_GRAPH );
-
- init_spline ( x, bands, 10, yf );
- for ( i = 0; i < 109; i++ )
- {
- y = 9 -
- ( int ) ( ( eval_spline ( x, bands, yf, 10, i ) *
- 9.0 ) / 20.0 );
- if ( y < 0 )
- y = 0;
- if ( y > 18 )
- y = 18;
- if ( !i )
- py = y;
- if ( y < py )
- {
- ymin = y;
- ymax = py;
- }
- else
- {
- ymin = py;
- ymax = y;
- }
- py = y;
-
- QPainter paint ( &pixmap );
- paint.drawPixmap ( i, y, m_skin->getEqSpline ( y ) ) ;
-
-
- }
- setPixmap ( pixmap );
- delete [] bands;
+ QPixmap pixmap = m_skin->getEqPart (Skin::EQ_GRAPH);
+ if (pixmap.isNull())
+ pixmap = QPixmap(113,19);
+
+ if (m_values.size()!=10)
+ {
+ setPixmap (pixmap);
+ return;
+ }
+
+ int i, y, ymin, ymax, py = 0;
+ double x[] = { 0, 11, 23, 35, 47, 59, 71, 83, 97, 109 }, yf[10];
+ double *bands = new double[10];
+
+ for (int i = 0; i < 10; ++i)
+ {
+ bands[i] = m_values.at (i);
+ }
+
+ init_spline (x, bands, 10, yf);
+ for (i = 0; i < 109; i++)
+ {
+ y = 9 - (int) ((eval_spline (x, bands, yf, 10, i) * 9.0) / 20.0);
+ if (y < 0)
+ y = 0;
+ if (y > 18)
+ y = 18;
+ if (!i)
+ py = y;
+ if (y < py)
+ {
+ ymin = y;
+ ymax = py;
+ }
+ else
+ {
+ ymin = py;
+ ymax = y;
+ }
+ py = y;
+
+ QPainter paint (&pixmap);
+ paint.drawPixmap (i, y, m_skin->getEqSpline (y)) ;
+
+
+ }
+ setPixmap (pixmap);
+ delete [] bands;
}
void EQGraph::updateSkin()
{
- draw();
+ draw();
+ setVisible(!m_skin->getEqPart (Skin::EQ_GRAPH).isNull());
}
diff --git a/src/ui/eqtitlebar.cpp b/src/ui/eqtitlebar.cpp
index 5420831f8..076a81de1 100644
--- a/src/ui/eqtitlebar.cpp
+++ b/src/ui/eqtitlebar.cpp
@@ -163,9 +163,9 @@ void EqTitleBar::shade()
{
m_eq->setFixedSize(275,116);
setPixmap(m_skin->getEqPart(Skin::EQ_TITLEBAR_A));
- delete m_shade2;
- delete m_volumeBar;
- delete m_balanceBar;
+ m_shade2->deleteLater();
+ m_volumeBar->deleteLater();
+ m_balanceBar->deleteLater();
m_volumeBar = 0;
m_balanceBar = 0;
m_shade2 = 0;
diff --git a/src/ui/eqwidget.cpp b/src/ui/eqwidget.cpp
index 07f4ae22b..3f6e1c781 100644
--- a/src/ui/eqwidget.cpp
+++ b/src/ui/eqwidget.cpp
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2006 by Ilya Kotov *
+ * Copyright (C) 2006-2008 by Ilya Kotov *
* forkotov02@hotmail.ru *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -38,27 +38,27 @@
-EqWidget::EqWidget ( QWidget *parent )
- : PixmapWidget ( parent )
+EqWidget::EqWidget (QWidget *parent)
+ : PixmapWidget (parent)
{
m_skin = Skin::getPointer();
- setWindowFlags (Qt::Dialog | Qt::FramelessWindowHint );
- setPixmap ( m_skin->getEqPart ( Skin::EQ_MAIN ) );
+ setWindowFlags (Qt::Dialog | Qt::FramelessWindowHint);
+ setPixmap (m_skin->getEqPart (Skin::EQ_MAIN));
//setPixmap(QPixmap(275,116));
- m_titleBar = new EqTitleBar ( this );
- m_titleBar -> move ( 0,0 );
+ m_titleBar = new EqTitleBar (this);
+ m_titleBar -> move (0,0);
m_titleBar -> show();
- connect ( m_skin, SIGNAL ( skinChanged() ), this, SLOT ( updateSkin() ) );
+ connect (m_skin, SIGNAL (skinChanged()), this, SLOT (updateSkin()));
- m_preamp = new EqSlider ( this );
+ m_preamp = new EqSlider (this);
m_preamp->show();
- m_preamp->move ( 21,38 );
- connect ( m_preamp,SIGNAL ( sliderMoved ( int ) ),SLOT ( setPreamp () ) );
+ m_preamp->move (21,38);
+ connect (m_preamp,SIGNAL (sliderMoved (int)),SLOT (setPreamp ()));
- m_on = new ToggleButton ( this,Skin::EQ_BT_ON_N,Skin::EQ_BT_ON_P,
- Skin::EQ_BT_OFF_N,Skin::EQ_BT_OFF_P );
+ m_on = new ToggleButton (this,Skin::EQ_BT_ON_N,Skin::EQ_BT_ON_P,
+ Skin::EQ_BT_OFF_N,Skin::EQ_BT_OFF_P);
m_on->show();
- m_on->move ( 14,18 );
+ m_on->move (14,18);
connect (m_on, SIGNAL (clicked(bool)), SIGNAL(valueChanged()));
m_autoButton = new ToggleButton(this, Skin::EQ_BT_AUTO_1_N, Skin::EQ_BT_AUTO_1_P,
@@ -68,22 +68,21 @@ EqWidget::EqWidget ( QWidget *parent )
m_eqg = new EQGraph(this);
m_eqg->move(87,17);
- m_eqg->show();
m_presetsMenu = new QMenu(this);
- m_presetButton = new Button ( this, Skin::EQ_BT_PRESETS_N, Skin::EQ_BT_PRESETS_P);
+ m_presetButton = new Button (this, Skin::EQ_BT_PRESETS_N, Skin::EQ_BT_PRESETS_P);
m_presetButton->move(217,18);
m_presetButton->show();
connect(m_presetButton, SIGNAL(clicked()), SLOT(showPresetsMenu()));
- for ( int i = 0; i<10; ++i )
+ for (int i = 0; i<10; ++i)
{
- m_sliders << new EqSlider ( this );
- m_sliders.at ( i )->move ( 78+i*18,38 );
- m_sliders.at ( i )->show();
- connect (m_sliders.at (i), SIGNAL ( sliderMoved (int) ),SLOT (setGain()));
+ m_sliders << new EqSlider (this);
+ m_sliders.at (i)->move (78+i*18,38);
+ m_sliders.at (i)->show();
+ connect (m_sliders.at (i), SIGNAL (sliderMoved (int)),SLOT (setGain()));
}
readSettings();
createActions();
@@ -102,12 +101,12 @@ int EqWidget::preamp()
return m_preamp->value();
}
-int EqWidget::gain ( int g )
+int EqWidget::gain (int g)
{
- return m_sliders.at ( g )->value();
+ return m_sliders.at (g)->value();
}
-void EqWidget::changeEvent ( QEvent * event )
+void EqWidget::changeEvent (QEvent * event)
{
if (event->type() == QEvent::ActivationChange)
{
@@ -115,7 +114,7 @@ void EqWidget::changeEvent ( QEvent * event )
}
}
-void EqWidget::closeEvent ( QCloseEvent* e)
+void EqWidget::closeEvent (QCloseEvent* e)
{
if (e->spontaneous ())
emit closed();
@@ -124,16 +123,16 @@ void EqWidget::closeEvent ( QCloseEvent* e)
void EqWidget::updateSkin()
{
- m_titleBar->setActive ( FALSE );
- setPixmap ( m_skin->getEqPart ( Skin::EQ_MAIN ) );
+ m_titleBar->setActive (FALSE);
+ setPixmap (m_skin->getEqPart (Skin::EQ_MAIN));
}
void EqWidget::readSettings()
{
- QSettings settings ( QDir::homePath() +"/.qmmp/qmmprc", QSettings::IniFormat );
- settings.beginGroup ( "Equalizer" );
+ QSettings settings (QDir::homePath() +"/.qmmp/qmmprc", QSettings::IniFormat);
+ settings.beginGroup ("Equalizer");
//geometry
- move ( settings.value ( "pos", QPoint ( 100, 216 ) ).toPoint() );
+ move (settings.value ("pos", QPoint (100, 216)).toPoint());
//equalizer
for (int i = 0; i < m_sliders.size(); ++i)
m_sliders.at(i)->setValue(settings.value("band_"+
@@ -143,7 +142,7 @@ void EqWidget::readSettings()
settings.endGroup();
setGain();
//equalizer presets
- QSettings eq_preset (QDir::homePath() +"/.qmmp/eq.preset", QSettings::IniFormat );
+ QSettings eq_preset (QDir::homePath() +"/.qmmp/eq.preset", QSettings::IniFormat);
for (int i = 1; TRUE; ++i)
{
if (eq_preset.contains("Presets/Preset"+QString("%1").arg(i)))
@@ -166,7 +165,7 @@ void EqWidget::readSettings()
break;
}
//equalizer auto-load presets
- QSettings eq_auto (QDir::homePath() +"/.qmmp/eq.auto_preset", QSettings::IniFormat );
+ QSettings eq_auto (QDir::homePath() +"/.qmmp/eq.auto_preset", QSettings::IniFormat);
for (int i = 1; TRUE; ++i)
{
if (eq_auto.contains("Presets/Preset"+QString("%1").arg(i)))
@@ -192,10 +191,10 @@ void EqWidget::readSettings()
void EqWidget::writeSettings()
{
- QSettings settings ( QDir::homePath() +"/.qmmp/qmmprc", QSettings::IniFormat );
- settings.beginGroup ( "Equalizer" );
+ QSettings settings (QDir::homePath() +"/.qmmp/qmmprc", QSettings::IniFormat);
+ settings.beginGroup ("Equalizer");
//geometry
- settings.setValue ( "pos", this->pos() );
+ settings.setValue ("pos", this->pos());
//equalizer
for (int i = 0; i < m_sliders.size(); ++i)
settings.setValue("band_"+QString("%1").arg(i), m_sliders.at(i)->value());
@@ -203,7 +202,7 @@ void EqWidget::writeSettings()
settings.setValue("enabled",m_on->isChecked());
settings.endGroup();
//equalizer presets
- QSettings eq_preset (QDir::homePath() +"/.qmmp/eq.preset", QSettings::IniFormat );
+ QSettings eq_preset (QDir::homePath() +"/.qmmp/eq.preset", QSettings::IniFormat);
eq_preset.clear ();
for (int i = 0; i < m_presets.size(); ++i)
{
@@ -219,7 +218,7 @@ void EqWidget::writeSettings()
}
//equalizer auto-load presets
QSettings eq_auto (QDir::homePath() +"/.qmmp/eq.auto_preset",
- QSettings::IniFormat );
+ QSettings::IniFormat);
eq_auto.clear();
for (int i = 0; i < m_autoPresets.size(); ++i)
{
@@ -395,11 +394,11 @@ void EqWidget::importWinampEQF()
QFile file(path);
file.open(QIODevice::ReadOnly);
- file.read ( header, 31);
+ file.read (header, 31);
if (QString::fromAscii(header).contains("Winamp EQ library file v1.1"))
{
- while (file.read ( name, 257))
+ while (file.read (name, 257))
{
EQPreset* preset = new EQPreset;
preset->setText(QString::fromAscii(name));
diff --git a/src/ui/playlisttitlebar.cpp b/src/ui/playlisttitlebar.cpp
index 79e3a74d7..5f3b6cfea 100644
--- a/src/ui/playlisttitlebar.cpp
+++ b/src/ui/playlisttitlebar.cpp
@@ -240,7 +240,7 @@ void PlayListTitleBar::shade()
m_pl->setMinimumSize (275,116);
m_pl->setMaximumSize (10000,10000);
m_pl->resize(width(),m_height);
- delete m_shade2;
+ m_shade2->deleteLater();
m_shade2 = 0;
m_shade->show();
}
diff --git a/src/ui/skin.cpp b/src/ui/skin.cpp
index 422742bb4..269154d5b 100644
--- a/src/ui/skin.cpp
+++ b/src/ui/skin.cpp
@@ -338,7 +338,12 @@ void Skin::loadEqMain()
m_eq_parts[ EQ_MAIN ] = pixmap->copy ( 0,0,275,116 );
m_eq_parts[ EQ_TITLEBAR_A ] = pixmap->copy ( 0,134,275,14 );
m_eq_parts[ EQ_TITLEBAR_I ] = pixmap->copy ( 0,149,275,14 );
- m_eq_parts[ EQ_GRAPH ] = pixmap->copy ( 0,294,113,19 );
+
+ if(pixmap->height() > 295)
+ m_eq_parts[ EQ_GRAPH ] = pixmap->copy ( 0,294,113,19 );
+ else
+ m_eq_parts[ EQ_GRAPH ] = QPixmap();
+
for ( int i = 0; i < 14; ++i )
{
m_eq_bar << pixmap->copy ( 13 + i*15,164,14,63 );
diff --git a/src/ui/titlebar.cpp b/src/ui/titlebar.cpp
index 164cf7a60..df88539fd 100644
--- a/src/ui/titlebar.cpp
+++ b/src/ui/titlebar.cpp
@@ -179,11 +179,11 @@ void TitleBar::shade()
{
m_mw->setFixedSize(275,116);
setPixmap(m_skin->getTitleBar(Skin::TITLEBAR_A));
- delete m_shade2;
- delete m_currentTime;
- delete m_control;
+ m_shade2->deleteLater();
+ m_currentTime->deleteLater();
+ m_control->deleteLater();
SoundCore::instance()->removeVisual(m_visual);
- delete m_visual;
+ m_visual->deleteLater();
m_shade2 = 0;
m_currentTime = 0;
m_shade->show();