Hi everybody,
I attached some patches, which contain changes I made to my working copy.
Here are short descriptions:
vumeter_bitblt.patch:
* added peak hold function to VU meters and separate VU meters for left and
right channels
* replaced all "bitBlt" with drawPixmap from QPainter and also removed
pixmaps used for double buffering in paintEvent. They're not needed, because
from Qt 4.0 QWidget automatically double-buffers its painting
* transparent background for labels if BgColor is not set in skin
* added installEventFilter to TrackTableView and ComboBox in mixxxview.cpp,
so keyboard shortcuts will work when they have focus. This probably fixes
bug #217557
* enginebuffercue.cpp: cue goto and stop only when key is pressed not
released
outlineskin.patch:
* VU meters with peak hold in outline skin and also master vu meter is
changed to stereo
splashscreen.patch:
* enables splash screen on startup
* used splash.png from src and modified SConscript to install it
defs.patch:
* changed READCHUNK_NO from 40 to 80 to get better waveform view
I'm not sure if this one is good, but at least you can try it.
Cheers,
Martin
Index: src/skins/outline/skin.xml
===================================================================
--- src/skins/outline/skin.xml (revision 2114)
+++ src/skins/outline/skin.xml (working copy)
@@ -371,16 +371,37 @@
<PathBack>vumeter-off-.png</PathBack>
<Pos>663,256</Pos>
<Horizontal>true</Horizontal>
+ <PeakHoldSize>5</PeakHoldSize>
+ <PeakHoldTime>400</PeakHoldTime>
+ <PeakFallTime>80</PeakFallTime>
+ <PeakFallStep>5</PeakFallStep>
<Connection>
- <ConfigKey>[Master],VuMeter</ConfigKey>
+ <ConfigKey>[Master],VuMeterL</ConfigKey>
</Connection>
</VuMeter>
<VuMeter>
+ <Tooltip>Master VuMeter</Tooltip>
+ <PathVu>vumeter-on-.png</PathVu>
+ <PathBack>vumeter-off-.png</PathBack>
+ <Pos>663,276</Pos>
+ <Horizontal>true</Horizontal>
+ <PeakHoldSize>5</PeakHoldSize>
+ <PeakHoldTime>400</PeakHoldTime>
+ <PeakFallTime>80</PeakFallTime>
+ <PeakFallStep>5</PeakFallStep>
+ <Connection>
+ <ConfigKey>[Master],VuMeterR</ConfigKey>
+ </Connection>
+ </VuMeter>
+
+ <VuMeter>
<Tooltip>Channel VuMeter</Tooltip>
<PathVu>vumeter-on-Ch1.png</PathVu>
<PathBack>vumeter-off-Ch1.png</PathBack>
<Pos>107,525</Pos>
+ <PeakHoldSize>5</PeakHoldSize>
+ <PeakHoldTime>400</PeakHoldTime>
<Connection>
<ConfigKey>[Channel1],VuMeter</ConfigKey>
</Connection>
@@ -391,6 +412,8 @@
<PathVu>vumeter-on-Ch2.png</PathVu>
<PathBack>vumeter-off-Ch2.png</PathBack>
<Pos>995,525</Pos>
+ <PeakHoldSize>5</PeakHoldSize>
+ <PeakHoldTime>400</PeakHoldTime>
<Connection>
<ConfigKey>[Channel2],VuMeter</ConfigKey>
</Connection>
Index: src/main.cpp
===================================================================
--- src/main.cpp (revision 2114)
+++ src/main.cpp (working copy)
@@ -163,14 +163,16 @@
//LADSPALoader ladspaloader;
#endif
+ // Read the config file from home directory
+ ConfigObject<ConfigValue> *config = new ConfigObject<ConfigValue>(QDir::homePath().append("/").append(SETTINGS_FILE));
+ QString configPath = config->getConfigPath();
+
// Show splash
- QSplashScreen * pSplash = 0;
- /*
- QPixmap pixmap("splash.png");
- pSplash = new QSplashScreen(pixmap);
- pSplash->show();
- pSplash->message("Loading...",Qt::AlignLeft|Qt::AlignBottom);
- */
+ QPixmap pixmap(configPath + "/splash.png");
+ QSplashScreen * pSplash = pSplash = new QSplashScreen(pixmap);
+ pSplash->show();
+ pSplash->message("Loading...",Qt::AlignLeft|Qt::AlignBottom);
+ qApp->processEvents();
QTranslator tor( 0 );
// set the location where your .qm files are in load() below as the last parameter instead of "."
@@ -205,7 +207,7 @@
args.qlMusicFiles += argv[i];
}
- MixxxApp * mixxx=new MixxxApp(a, args, pSplash);
+ MixxxApp * mixxx=new MixxxApp(a, args, pSplash, config);
a->setMainWidget(mixxx);
mixxx->show();
Index: src/SConscript
===================================================================
--- src/SConscript (revision 2114)
+++ src/SConscript (working copy)
@@ -900,6 +900,9 @@
#Images for preferences dialog
image_files = glob.glob('../images/preferences/*') # These are compiled in to the "mixxx" binary through mixxx.qrc
+#Splashscreen image
+splash_file = glob.glob('../splash.png')
+
#Windows DLLs
dll_files = glob.glob('../../../mixxx-winlib/*.dll') # TODO: Use reference to SharedLibrary for libsndfile and others, glob only gets all files on 2+ builds after a clean.
# dll_files = libsndfile
@@ -934,6 +937,7 @@
dotdesktop = env.Install(unix_share_path + "/applications", dotdesktop_files)
docs = env.Install(unix_share_path + "/doc/mixxx", docs_files)
icon = env.Install(unix_share_path + "/pixmaps", icon_files)
+ splash = env.Install(unix_share_path + '/mixxx', splash_file)
promotracks = env.Install(unix_share_path + "/mixxx/promo", promotracks_files)
#Makes each of those Install builders get fired off when you run "scons install" :)
@@ -944,8 +948,9 @@
env.Alias('install', docs)
env.Alias('install', dotdesktop)
env.Alias('install', icon)
+ env.Alias('install', splash)
env.Alias('install', promotracks)
-
+
#Delete the old Mixxx installation (because SCONS won't overwrite it)
#if 'install' in COMMAND_LINE_TARGETS:
#os.system('scons -c install')
@@ -999,6 +1004,7 @@
#icon = env.Install("../../dist", icon_files)
dlls = env.Install("../../dist/", dll_files)
binary = env.Install("../../dist/", binary_files)
+ splash = env.Install("../../dist/", splash_file)
#Always trigger these install builders when compiling on Windows
env.Alias('mixxx', skins)
@@ -1009,6 +1015,7 @@
env.Alias('mixxx', dlls)
#env.Alias('mixxx', icon)
env.Alias('mixxx', binary)
+ env.Alias('mixxx', splash)
Index: src/mixxx.h
===================================================================
--- src/mixxx.h (revision 2114)
+++ src/mixxx.h (working copy)
@@ -87,7 +87,7 @@
public:
/** Construtor. files is a list of command line arguments */
- MixxxApp(QApplication *app, struct CmdlineArgs args, QSplashScreen *pSplash);
+ MixxxApp(QApplication *app, struct CmdlineArgs args, QSplashScreen *pSplash, ConfigObject<ConfigValue> *pConfig = 0);
/** destructor */
~MixxxApp();
/** initializes all QActions of the application */
Index: src/mixxx.cpp
===================================================================
--- src/mixxx.cpp (revision 2114)
+++ src/mixxx.cpp (working copy)
@@ -64,7 +64,7 @@
QMessageBox::critical(0, "Mixxx", "Mixxx has encountered a serious error and needs to close.");
}
-MixxxApp::MixxxApp(QApplication * a, struct CmdlineArgs args, QSplashScreen * pSplash)
+MixxxApp::MixxxApp(QApplication * a, struct CmdlineArgs args, QSplashScreen * pSplash, ConfigObject<ConfigValue> *pConfig)
{
app = a;
@@ -98,7 +98,8 @@
prefDlg = 0;
// Read the config file from home directory
- config = new ConfigObject<ConfigValue>(QDir::homePath().append("/").append(SETTINGS_FILE));
+ config = pConfig;
+ if(!config) config = new ConfigObject<ConfigValue>(QDir::homePath().append("/").append(SETTINGS_FILE));
QString qConfigPath = config->getConfigPath();
#ifdef __C_METRICS__
Index: src/defs.h
===================================================================
--- src/defs.h (revision 2114)
+++ src/defs.h (working copy)
@@ -40,7 +40,7 @@
/** Number of readchunks. Should minimum be set to 5. In theory this should minimum be four, but
* since it is possible that the sound sources return more samples than request, 5 is on the
* safe side */
-const int READCHUNK_NO = 40;
+const int READCHUNK_NO = 80;
const unsigned int READBUFFERSIZE = READCHUNKSIZE*READCHUNK_NO;
/** Window size used in ReaderExtract objects */
const int WINDOWSIZE = 2048;
@@ -52,7 +52,7 @@
// Various fixed constants
// static CSAMPLE pi = acos(-1.0); // Conflicts with macx headers
-static CSAMPLE two_pi = (2.f*acos(-1.f));
+const CSAMPLE two_pi = (2.f*acos(-1.f));
// Ensure that CSAMPLE x stays above the intel cpu denormalization range,
// otherwise sets x equal to 0.
Index: src/wvumeter.cpp
===================================================================
--- src/wvumeter.cpp (revision 2122)
+++ src/wvumeter.cpp (working copy)
@@ -24,11 +24,16 @@
#include <QtDebug>
#include <QPixmap>
+#define DEFAULT_FALLTIME 10
+#define DEFAULT_HOLDTIME 300
+
+
WVuMeter::WVuMeter(QWidget * parent, const char * name) : WWidget(parent,name)
{
m_pPixmapBack = 0;
m_pPixmapVu = 0;
- m_pPixmapBuffer = 0;
+ m_iPeakHoldSize = m_iPeakPos = 0;
+ connect(&m_qTimer, SIGNAL(timeout()), this, SLOT(slotUpdatePeak()));
}
WVuMeter::~WVuMeter()
@@ -39,12 +44,21 @@
void WVuMeter::setup(QDomNode node)
{
WWidget::setup(node);
-
+ m_qTimer.stop();
// Set pixmaps
bool bHorizontal = false;
if (!selectNode(node, "Horizontal").isNull() && selectNodeQString(node, "Horizontal")=="true")
bHorizontal = true;
setPixmaps(getPath(selectNodeQString(node, "PathBack")), getPath(selectNodeQString(node, "PathVu")), bHorizontal);
+ m_iPeakHoldSize = selectNodeInt(node, "PeakHoldSize");
+ if(m_iPeakHoldSize < 0 || m_iPeakHoldSize > 100) m_iPeakHoldSize = 0;
+ m_iPeakFallStep = selectNodeInt(node, "PeakFallStep");
+ if(m_iPeakFallStep < 1 || m_iPeakFallStep > 1000) m_iPeakFallStep = 1;
+ m_iPeakHoldTime = selectNodeInt(node, "PeakHoldTime");
+ if(m_iPeakHoldTime < 1 || m_iPeakHoldTime > 3000) m_iPeakHoldTime = DEFAULT_HOLDTIME;
+ m_iPeakFallTime = selectNodeInt(node, "PeakFallTime");
+ if(m_iPeakFallTime < 1 || m_iPeakFallTime > 1000) m_iPeakFallTime = DEFAULT_FALLTIME;
+ if(m_iPeakHoldSize > 0) m_qTimer.start(m_iPeakFallTime);
}
void WVuMeter::resetPositions()
@@ -55,8 +69,6 @@
m_pPixmapBack = 0;
WPixmapStore::deletePixmap(m_pPixmapVu);
m_pPixmapVu = 0;
- WPixmapStore::deletePixmap(m_pPixmapBuffer);
- m_pPixmapBuffer = 0;
}
}
@@ -69,8 +81,6 @@
if (!m_pPixmapVu || m_pPixmapVu->size()==QSize(0,0))
qDebug() << "WVuMeter: Error loading vu pixmap" << vuFilename;
- m_pPixmapBuffer = new QPixmap(m_pPixmapBack->size());
-
setFixedSize(m_pPixmapBack->size());
m_bHorizontal = bHorizontal;
if (m_bHorizontal)
@@ -79,6 +89,35 @@
m_iNoPos = m_pPixmapVu->height();
}
+void WVuMeter::setValue(double fValue)
+{
+ int idx = (int)(m_fValue*(float)(m_iNoPos)/128.);
+ // Range check
+ if (idx>m_iNoPos)
+ idx = m_iNoPos;
+ else if (idx<0)
+ idx = 0;
+
+ setPeak(idx);
+ WWidget::setValue(fValue);
+}
+
+void WVuMeter::setPeak(int pos)
+{
+ if(pos > m_iPeakPos)
+ {
+ m_iPeakPos = pos;
+ m_qTimer.start(m_iPeakHoldTime);
+ }
+}
+
+void WVuMeter::slotUpdatePeak()
+{
+ if(m_iPeakPos > 0) m_iPeakPos -= m_iPeakFallStep;
+
+ m_qTimer.setInterval(m_iPeakFallTime);
+}
+
void WVuMeter::paintEvent(QPaintEvent *)
{
if (m_pPixmapBack!=0)
@@ -91,27 +130,32 @@
else if (idx<0)
idx = 0;
- // Draw back on buffer
- //bitBlt(m_pPixmapBuffer, 0, 0, m_pPixmapBack); //old QT3 code
- QPainter painter(m_pPixmapBuffer);
+ QPainter painter(this);
+ // Draw back
painter.drawPixmap(0, 0, *m_pPixmapBack);
- // Draw (part of) vu on buffer
+ // Draw (part of) vu
if (m_bHorizontal)
{
//This is a hack to fix something weird with horizontal VU meters:
if(idx == 0)
idx = 1;
-
painter.drawPixmap(0, 0, *m_pPixmapVu, 0, 0, idx, m_pPixmapVu->height());
-
+ if(m_iPeakHoldSize > 0 && m_iPeakPos > 0)
+ {
+ painter.drawPixmap(m_iPeakPos-m_iPeakHoldSize, 0, *m_pPixmapVu,
+ m_iPeakPos-m_iPeakHoldSize, 0, m_iPeakHoldSize, m_pPixmapVu->height());
+ }
}
else
+ {
painter.drawPixmap(0, m_iNoPos-idx, *m_pPixmapVu, 0, m_iNoPos-idx, m_pPixmapVu->width(), idx);
-
- // Draw buffer on screen
- QPainter widgetPainter(this);
- widgetPainter.drawPixmap(0, 0, *m_pPixmapBuffer);
+ if(m_iPeakHoldSize > 0 && m_iPeakPos > 0)
+ {
+ painter.drawPixmap(0, m_pPixmapVu->height()-m_iPeakPos, *m_pPixmapVu,
+ 0, m_pPixmapVu->height()-m_iPeakPos, m_pPixmapVu->width(), m_iPeakHoldSize);
+ }
+ }
}
}
Index: src/woverview.cpp
===================================================================
--- src/woverview.cpp (revision 2122)
+++ src/woverview.cpp (working copy)
@@ -31,7 +31,6 @@
m_iVirtualPos = -1;
m_bDrag = false;
m_pScreenBuffer = 0;
- setBackgroundMode(Qt::NoBackground);
waveformChanged = false;
}
@@ -110,15 +109,14 @@
}
void WOverview::repaint() {
+ // Erase background
+ m_pScreenBuffer->fill(this->backgroundColor());
+
if (!m_pWaveformSummary || !m_pWaveformSummary->size())
return;
- QPainter paint;
- paint.begin(m_pScreenBuffer, this);
+ QPainter paint(m_pScreenBuffer);
- // Erase background
- paint.eraseRect(rect());
-
float yscale = (((float)(height()-2)/2.)/128.); //32768.;
float xscale = (float)m_pWaveformSummary->size()/width();
@@ -205,7 +203,6 @@
}
*/
paint.end();
-
update();
}
@@ -252,14 +249,10 @@
waveformChanged = false;
}
- QPixmap pm(size());
+ QPainter paint(this);
+ // Draw waveform, then playpos
+ paint.drawPixmap(0, 0, *m_pScreenBuffer);
- // Draw waveform, then playpos to buffer
- bitBlt(&pm, 0, 0, m_pScreenBuffer);
-
- QPainter paint;
- paint.begin(&pm, this);
-
if (m_pWaveformSummary)
{
// Draw play position
@@ -288,10 +281,7 @@
}
}
}
-
paint.end();
-
- bitBlt(this, 0, 0, &pm);
}
Index: src/wstatuslight.cpp
===================================================================
--- src/wstatuslight.cpp (revision 2122)
+++ src/wstatuslight.cpp (working copy)
@@ -18,8 +18,9 @@
#include "wstatuslight.h"
#include "wpixmapstore.h"
-//Added by qt3to4:
+
#include <QPaintEvent>
+#include <QPainter>
#include <QtDebug>
#include <QPixmap>
@@ -27,8 +28,6 @@
{
m_pPixmapBack = 0;
m_pPixmapSL = 0;
- m_pPixmapBuffer = 0;
- setBackgroundMode(Qt::NoBackground);
}
WStatusLight::~WStatusLight()
@@ -55,8 +54,6 @@
m_pPixmapBack = 0;
WPixmapStore::deletePixmap(m_pPixmapSL);
m_pPixmapSL = 0;
- WPixmapStore::deletePixmap(m_pPixmapBuffer);
- m_pPixmapBuffer = 0;
}
}
@@ -69,8 +66,6 @@
if (!m_pPixmapSL || m_pPixmapSL->size()==QSize(0,0))
qDebug() << "WStatusLight: Error loading statuslight pixmap" << vuFilename;
- m_pPixmapBuffer = new QPixmap(m_pPixmapBack->size());
-
setFixedSize(m_pPixmapBack->size());
m_bHorizontal = bHorizontal;
}
@@ -79,19 +74,11 @@
{
if (m_pPixmapBack!=0 && m_pPixmapSL!=0)
{
+ QPainter p(this);
- // Draw back on buffer
if(m_fValue == 0)
- bitBlt(m_pPixmapBuffer, 0, 0, m_pPixmapBack);
+ p.drawPixmap(0, 0, *m_pPixmapBack);
else
- bitBlt(m_pPixmapBuffer, 0, 0, m_pPixmapSL);
- // Draw light on buffer
- //bitBlt(m_pPixmapBuffer, 0, 0, m_pPixmapSL, 0, 0, m_pPixmapSL->width(), m_pPixmapSL->height());
-
- // Draw buffer on screen
- bitBlt(this, 0, 0, m_pPixmapBuffer);
+ p.drawPixmap(0, 0, *m_pPixmapSL);
}
}
-
-
-
Index: src/wpushbutton.cpp
===================================================================
--- src/wpushbutton.cpp (revision 2122)
+++ src/wpushbutton.cpp (working copy)
@@ -29,7 +29,6 @@
{
m_pPixmaps = 0;
m_pPixmapBack = 0;
- m_pPixmapBuffer = 0;
setStates(0);
setBackgroundMode(Qt::NoBackground);
}
@@ -41,7 +40,6 @@
}
WPixmapStore::deletePixmap(m_pPixmapBack);
- WPixmapStore::deletePixmap(m_pPixmapBuffer);
}
void WPushButton::setup(QDomNode node)
@@ -149,9 +147,6 @@
m_pPixmapBack = WPixmapStore::getPixmap(filename);
if (!m_pPixmapBack)
qDebug() << "WPushButton: Error loading background pixmap:" << filename;
-
- // Construct corresponding double buffer
- m_pPixmapBuffer = new QPixmap(m_pPixmapBack->size());
}
void WPushButton::setValue(double v)
@@ -176,22 +171,9 @@
int idx = (((int)m_fValue%m_iNoStates)*2)+m_bPressed;
if (m_pPixmaps[idx])
{
-
- // If m_pPixmapBuffer is defined, use double buffering when painting,
- // otherwise paint the button directly to the screen.
- if (m_pPixmapBuffer!=0)
- {
- // Paint background on buffer
- bitBlt(m_pPixmapBuffer, 0, 0, m_pPixmapBack);
-
- // Paint button on buffer
- bitBlt(m_pPixmapBuffer, 0, 0, m_pPixmaps[idx]);
-
- // Paint buffer to screen
- bitBlt(this, 0, 0, m_pPixmapBuffer);
- }
- else
- bitBlt(this, 0, 0, m_pPixmaps[idx]);
+ QPainter p(this);
+ if(m_pPixmapBack) p.drawPixmap(0, 0, *m_pPixmapBack);
+ p.drawPixmap(0, 0, *m_pPixmaps[idx]);
}
}
}
Index: src/wpushbutton.h
===================================================================
--- src/wpushbutton.h (revision 2122)
+++ src/wpushbutton.h (working copy)
@@ -63,8 +63,6 @@
QPixmap **m_pPixmaps;
/** Associated background pixmap */
QPixmap *m_pPixmapBack;
- /** Double buffer. Used when background pixmap is set */
- QPixmap *m_pPixmapBuffer;
};
#endif
Index: src/wstatuslight.h
===================================================================
--- src/wstatuslight.h (revision 2122)
+++ src/wstatuslight.h (working copy)
@@ -48,7 +48,7 @@
/** Number of positions associated with this knob */
int m_iNoPos;
/** Associated pixmaps */
- QPixmap *m_pPixmapBack, *m_pPixmapSL, *m_pPixmapBuffer;
+ QPixmap *m_pPixmapBack, *m_pPixmapSL;
/** True if it's a horizontal vu meter */
bool m_bHorizontal;
};
Index: src/wvisualsimple.cpp
===================================================================
--- src/wvisualsimple.cpp (revision 2122)
+++ src/wvisualsimple.cpp (working copy)
@@ -130,13 +130,8 @@
void WVisualSimple::paintEvent(QPaintEvent *)
{
- QPixmap pm(size());
- QPainter paint;
- paint.begin(&pm, this);
+ QPainter paint(this);
- // Erase background
- paint.eraseRect(rect());
-
// Draw vertical red bar in center
paint.setPen(colorMarker);
paint.drawLine(m_qMarkerPos1, m_qMarkerPos2);
@@ -150,7 +145,4 @@
paint.drawLine(m_qMarkerPos1, p1);
paint.drawLine(m_qMarkerPos2, p2);
}
-
- paint.end();
- bitBlt(this, 0, 0, &pm);
}
Index: src/wdisplay.cpp
===================================================================
--- src/wdisplay.cpp (revision 2122)
+++ src/wdisplay.cpp (working copy)
@@ -17,7 +17,8 @@
#include "wdisplay.h"
#include "wpixmapstore.h"
-//Added by qt3to4:
+
+#include <QPainter>
#include <QPaintEvent>
#include <QtDebug>
#include <QPixmap>
@@ -26,7 +27,6 @@
{
m_pPixmaps = 0;
setPositions(0);
- setBackgroundMode(Qt::NoBackground);
}
WDisplay::~WDisplay()
@@ -96,8 +96,10 @@
idx = m_iNoPos-1;
else if (idx<0)
idx = 0;
- if (m_pPixmaps[idx])
- bitBlt(this, 0, 0, m_pPixmaps[idx]);
+ if (m_pPixmaps[idx]) {
+ QPainter p(this);
+ p.drawPixmap(0, 0, *m_pPixmaps[idx]);
+ }
}
}
Index: src/wslidercomposed.h
===================================================================
--- src/wslidercomposed.h (revision 2122)
+++ src/wslidercomposed.h (working copy)
@@ -58,8 +58,6 @@
bool m_bEventWhileDrag;
/** True if slider is dragged. Only used when m_bEventWhileDrag is false */
bool m_bDrag;
- /** Pointer to double buffer */
- QPixmap *m_pDoubleBuffer;
/** Pointer to pixmap of the slider */
QPixmap *m_pSlider;
/** Pointer to pixmap of the handle */
Index: src/wslidercomposed.cpp
===================================================================
--- src/wslidercomposed.cpp (revision 2122)
+++ src/wslidercomposed.cpp (working copy)
@@ -22,6 +22,7 @@
//Added by qt3to4:
#include <QMouseEvent>
#include <QPaintEvent>
+#include <QPainter>
#include "defs.h"
#include "wpixmapstore.h"
@@ -30,7 +31,6 @@
{
m_pSlider = 0;
m_pHandle = 0;
- m_pDoubleBuffer = 0;
m_bHorizontal = false;
m_bEventWhileDrag = true;
m_bDrag = false;
@@ -76,7 +76,6 @@
m_pHandle = WPixmapStore::getPixmap(filenameHandle);
if (!m_pHandle)
qDebug() << "WSliderComposed: Error loading handle pixmap:" << filenameHandle;
- m_pDoubleBuffer = new QPixmap(m_pSlider->size());
if (m_bHorizontal)
{
@@ -104,11 +103,8 @@
WPixmapStore::deletePixmap(m_pSlider);
if (m_pHandle)
WPixmapStore::deletePixmap(m_pHandle);
- if (m_pDoubleBuffer)
- WPixmapStore::deletePixmap(m_pDoubleBuffer);
m_pSlider = 0;
m_pHandle = 0;
- m_pDoubleBuffer = 0;
}
void WSliderComposed::mouseMoveEvent(QMouseEvent * e)
@@ -195,6 +191,7 @@
{
if (m_pSlider && m_pHandle)
{
+ QPainter p(this);
int posx;
int posy;
if (m_bHorizontal)
@@ -208,12 +205,9 @@
posy = m_iPos;
}
- // Draw slider followed by handle to double buffer
- bitBlt(m_pDoubleBuffer, 0, 0, m_pSlider);
- bitBlt(m_pDoubleBuffer, posx, posy, m_pHandle);
-
- // Draw double buffer to screen
- bitBlt(this, 0, 0, m_pDoubleBuffer);
+ // Draw slider followed by handle
+ p.drawPixmap(0, 0, *m_pSlider);
+ p.drawPixmap(posx, posy, *m_pHandle);
}
}
Index: src/mixxxview.cpp
===================================================================
--- src/mixxxview.cpp (revision 2122)
+++ src/mixxxview.cpp (working copy)
@@ -356,11 +356,7 @@
p->setup(node);
p->installEventFilter(m_pKeyboard);
m_qWidgetList.append(p);
- //p->setBackgroundRole(QPalette::Window);
p->setPalette(palette);
- p->setAutoFillBackground(true);
-
-
}
else if (WWidget::selectNodeInt(node, "Channel")==2)
{
@@ -368,9 +364,7 @@
p->setup(node);
p->installEventFilter(m_pKeyboard);
m_qWidgetList.append(p);
- //p->setBackgroundRole(QPalette::Window);
p->setPalette(palette);
- p->setAutoFillBackground(true);
}
}
else if (node.nodeName()=="Display")
@@ -477,12 +471,12 @@
QColor bgc(255,255,255);
if (!WWidget::selectNode(node, "BgColor").isNull()) {
bgc.setNamedColor(WWidget::selectNodeQString(node, "BgColor"));
+ p->setAutoFillBackground(true);
}
//p->setPaletteBackgroundColor(WSkinColor::getCorrectColor(bgc));
QPalette palette;
palette.setBrush(p->backgroundRole(), WSkinColor::getCorrectColor(bgc));
p->setPalette(palette);
- p->setAutoFillBackground(true);
// Foreground color
QColor fgc(0,0,0);
@@ -685,6 +679,7 @@
if (promoDir.exists())
m_pComboBox->addItem( "Free Tracks", TABLE_MODE_PROMO );
// m_pComboBox->addItem( "iPod", TABLE_MODE_IPOD );
+ m_pComboBox->installEventFilter(m_pKeyboard);
}
// Set position
QString pos = WWidget::selectNodeQString(node, "Pos");
@@ -700,12 +695,12 @@
m_pComboBox->show();
}
- // persistent: m_pLineEditSearch
+ // persistent: m_pLineEditSearch
else if (node.nodeName()=="Search")
{
- if (m_pLineEditSearch == 0) {
- m_pLineEditSearch = new QLineEdit(this);
- }
+ if (m_pLineEditSearch == 0) {
+ m_pLineEditSearch = new QLineEdit(this);
+ }
// Set position
QString pos = WWidget::selectNodeQString(node, "Pos");
@@ -718,17 +713,18 @@
x = size.left(size.indexOf(",")).toInt();
y = size.mid(size.indexOf(",")+1).toInt();
m_pLineEditSearch->setFixedSize(x,y);
- m_pLineEditSearch->show();
+ m_pLineEditSearch->show();
}
// persistent: m_pTrackTableView
else if (node.nodeName()=="TableView")
{
- if (m_pTrackTableView == 0) {
- m_pTrackTableView = new WTrackTableView(this, pConfig);
- }
+ if (m_pTrackTableView == 0) {
+ m_pTrackTableView = new WTrackTableView(this, pConfig);
+ }
m_pTrackTableView->setup(node);
- m_pTrackTableView->show();
+ m_pTrackTableView->installEventFilter(m_pKeyboard);
+ m_pTrackTableView->show();
}
// set default value (only if it changes from the standard value)
if (currentControl) {
Index: src/wnumber.cpp
===================================================================
--- src/wnumber.cpp (revision 2122)
+++ src/wnumber.cpp (working copy)
@@ -42,8 +42,11 @@
setNumDigits(selectNodeInt(node, "NumberOfDigits"));
// Colors
- m_qBgColor.setNamedColor(WWidget::selectNodeQString(node, "BgColor"));
- m_pLabel->setPaletteBackgroundColor(WSkinColor::getCorrectColor(m_qBgColor));
+ if(!WWidget::selectNode(node, "BgColor").isNull()) {
+ m_qBgColor.setNamedColor(WWidget::selectNodeQString(node, "BgColor"));
+ m_pLabel->setPaletteBackgroundColor(WSkinColor::getCorrectColor(m_qBgColor));
+ m_pLabel->setAutoFillBackground(true);
+ }
m_qFgColor.setNamedColor(WWidget::selectNodeQString(node, "FgColor"));
m_pLabel->setPaletteForegroundColor(WSkinColor::getCorrectColor(m_qFgColor));
@@ -86,7 +89,6 @@
int px = pos.left(pos.find(",")).toInt();
int py = pos.mid(pos.find(",")+1).toInt();
move(px,py);
- m_pLabel->setAutoFillBackground(true);
m_pLabel->show();
}
@@ -116,11 +118,6 @@
m_pLabel->setText(QString(m_qsText).append("%1.%2%3").arg((int)v,3,10).arg(d1,1,10).arg(d2,1,10));
}
-void WNumber::setAlignment(int i)
-{
- //m_pLabel->setAlignment(i);
-}
-
void WNumber::setConstFactor(double c)
{
m_dConstFactor = c;
Index: src/enginevumeter.h
===================================================================
--- src/enginevumeter.h (revision 2122)
+++ src/enginevumeter.h (working copy)
@@ -37,8 +37,12 @@
private:
ControlPotmeter *m_ctrlVuMeter;
- FLOAT_TYPE m_fRMSvolume;
- FLOAT_TYPE m_fRMSvolumeSum;
+ ControlPotmeter *m_ctrlVuMeterL;
+ ControlPotmeter *m_ctrlVuMeterR;
+ FLOAT_TYPE m_fRMSvolumeL;
+ FLOAT_TYPE m_fRMSvolumeSumL;
+ FLOAT_TYPE m_fRMSvolumeR;
+ FLOAT_TYPE m_fRMSvolumeSumR;
FLOAT_TYPE m_iSamplesCalculated;
};
Index: src/wknob.cpp
===================================================================
--- src/wknob.cpp (revision 2122)
+++ src/wknob.cpp (working copy)
@@ -17,10 +17,11 @@
#include "wknob.h"
#include "wpixmapstore.h"
-//Added by qt3to4:
+
#include <QPixmap>
#include <QtDebug>
#include <QMouseEvent>
+#include <QPainter>
#include <QPaintEvent>
WKnob::WKnob(QWidget * parent, const char * name, float defaultValue)
@@ -28,10 +29,8 @@
{
m_pPixmaps = 0;
m_pPixmapBack = 0;
- m_pPixmapBuffer = 0;
m_bDisabledLoaded = false;
setPositions(0);
- setBackgroundMode(Qt::NoBackground);
}
WKnob::~WKnob()
@@ -114,9 +113,6 @@
m_pPixmapBack = WPixmapStore::getPixmap(filename);
if (!m_pPixmapBack)
qDebug() << "WKnob: Error loading background pixmap:" << filename;
-
- // Construct corresponding double buffer
- m_pPixmapBuffer = new QPixmap(m_pPixmapBack->size());
}
void WKnob::mouseMoveEvent(QMouseEvent * e)
@@ -171,20 +167,10 @@
if (m_bOff && m_bDisabledLoaded)
idx += m_iNoPos;
- // If m_pPixmapBuffer is defined, use double buffering when painting,
- // otherwise paint the button directly to the screen.
- if (m_pPixmapBuffer!=0)
- {
- // Paint background on buffer
- bitBlt(m_pPixmapBuffer, 0, 0, m_pPixmapBack);
-
- // Paint button on buffer
- bitBlt(m_pPixmapBuffer, 0, 0, m_pPixmaps[idx]);
-
- // Paint buffer to screen
- bitBlt(this, 0, 0, m_pPixmapBuffer);
- }
- else
- bitBlt(this, 0, 0, m_pPixmaps[idx]);
+ QPainter p(this);
+ // Paint background
+ //p.drawPixmap(0, 0, m_pPixmapBack);
+ // Paint button
+ p.drawPixmap(0, 0, *m_pPixmaps[idx]);
}
}
Index: src/wlabel.cpp
===================================================================
--- src/wlabel.cpp (revision 2122)
+++ src/wlabel.cpp (working copy)
@@ -38,8 +38,11 @@
WWidget::setup(node);
// Colors
- m_qBgColor.setNamedColor(WWidget::selectNodeQString(node, "BgColor"));
- m_pLabel->setPaletteBackgroundColor(WSkinColor::getCorrectColor(m_qBgColor));
+ if(!WWidget::selectNode(node, "BgColor").isNull()) {
+ m_qBgColor.setNamedColor(WWidget::selectNodeQString(node, "BgColor"));
+ m_pLabel->setPaletteBackgroundColor(WSkinColor::getCorrectColor(m_qBgColor));
+ m_pLabel->setAutoFillBackground(true);
+ }
m_qFgColor.setNamedColor(WWidget::selectNodeQString(node, "FgColor"));
m_pLabel->setPaletteForegroundColor(WSkinColor::getCorrectColor(m_qFgColor));
Index: src/wvumeter.h
===================================================================
--- src/wvumeter.h (revision 2122)
+++ src/wvumeter.h (working copy)
@@ -23,6 +23,7 @@
#include <qstring.h>
//Added by qt3to4:
#include <QPaintEvent>
+#include <QTimer>
/**
[EMAIL PROTECTED] Tue & Ken Haste Andersen
@@ -35,20 +36,33 @@
~WVuMeter();
void setup(QDomNode node);
void setPixmaps(const QString &backFilename, const QString &vuFilename, bool bHorizontal=false);
-
+ void setValue(double fValue);
+
+protected slots:
+ void slotUpdatePeak();
+
private:
/** Set position number to zero and deallocate pixmaps */
void resetPositions();
void paintEvent(QPaintEvent *);
+ void setPeak(int pos);
/** Current position */
int m_iPos;
/** Number of positions associated with this knob */
int m_iNoPos;
/** Associated pixmaps */
- QPixmap *m_pPixmapBack, *m_pPixmapVu, *m_pPixmapBuffer;
+ QPixmap *m_pPixmapBack, *m_pPixmapVu;
/** True if it's a horizontal vu meter */
bool m_bHorizontal;
+
+ int m_iPeakHoldSize;
+ int m_iPeakFallStep;
+ int m_iPeakHoldTime;
+ int m_iPeakFallTime;
+ int m_iPeakPos;
+
+ QTimer m_qTimer;
};
#endif
Index: src/enginevumeter.cpp
===================================================================
--- src/enginevumeter.cpp (revision 2122)
+++ src/enginevumeter.cpp (working copy)
@@ -27,41 +27,55 @@
// that it should react on the setValue(int) signal.
m_ctrlVuMeter = new ControlPotmeter(ConfigKey(group, "VuMeter"), 0., 1.);
m_ctrlVuMeter->set(0);
+ // left channel VU meter
+ m_ctrlVuMeterL = new ControlPotmeter(ConfigKey(group, "VuMeterL"), 0., 1.);
+ m_ctrlVuMeterL->set(0);
+ // right channel VU meter
+ m_ctrlVuMeterR = new ControlPotmeter(ConfigKey(group, "VuMeterR"), 0., 1.);
+ m_ctrlVuMeterR->set(0);
// Initialize the calculation:
m_iSamplesCalculated = 0;
- m_fRMSvolume = 0;
+ m_fRMSvolumeL = 0;
+ m_fRMSvolumeR = 0;
}
EngineVuMeter::~EngineVuMeter()
{
delete m_ctrlVuMeter;
+ delete m_ctrlVuMeterL;
+ delete m_ctrlVuMeterR;
}
void EngineVuMeter::process(const CSAMPLE * pIn, const CSAMPLE *, const int iBufferSize)
{
// Calculate the summed absolute volume
- for (int i=0; i<iBufferSize; ++i)
+ for (int i=0; i<iBufferSize/2; ++i)
{
- m_fRMSvolumeSum += fabsf(pIn[i]);
+ m_fRMSvolumeSumL += fabsf(pIn[2*i]);
+ m_fRMSvolumeSumR += fabsf(pIn[2*i+1]);
}
+ m_iSamplesCalculated += iBufferSize/2;
- m_iSamplesCalculated += iBufferSize;
-
// Are we ready to update the VU meter?:
- if (m_iSamplesCalculated > (44100/UPDATE_RATE) )
+ if (m_iSamplesCalculated*2 > (44100/UPDATE_RATE) )
{
+ m_fRMSvolumeL = log10(m_fRMSvolumeSumL/(m_iSamplesCalculated*1000)+1);
+ m_fRMSvolumeR = log10(m_fRMSvolumeSumR/(m_iSamplesCalculated*1000)+1);
+ m_ctrlVuMeterL->set( math_min(1.0, math_max(0.0, m_fRMSvolumeL)) );
+ m_ctrlVuMeterR->set( math_min(1.0, math_max(0.0, m_fRMSvolumeR)) );
+
+ FLOAT_TYPE m_fRMSvolume = (m_fRMSvolumeL + m_fRMSvolumeR) / 2;
FLOAT_TYPE m_fRMSvolumePrev = m_fRMSvolume;
FLOAT_TYPE smoothFactor;
-
- m_fRMSvolume = log10(m_fRMSvolumeSum/(m_iSamplesCalculated*1000)+1);
- //Smooth the output
+ // Smooth the output
smoothFactor = (m_fRMSvolumePrev > m_fRMSvolume) ? DECAY_SMOOTHING : ATTACK_SMOOTHING;
m_fRMSvolume = m_fRMSvolumePrev + smoothFactor * (m_fRMSvolume - m_fRMSvolumePrev);
m_ctrlVuMeter->set( math_min(1.0, math_max(0.0, m_fRMSvolume)) );
// Reset calculation:
m_iSamplesCalculated = 0;
- m_fRMSvolumeSum = 0;
+ m_fRMSvolumeSumL = 0;
+ m_fRMSvolumeSumR = 0;
}
}
Index: src/wknob.h
===================================================================
--- src/wknob.h (revision 2122)
+++ src/wknob.h (working copy)
@@ -56,8 +56,6 @@
QPixmap **m_pPixmaps;
/** Associated background pixmap */
QPixmap *m_pPixmapBack;
- /** Double buffer. Used when background pixmap is set */
- QPixmap *m_pPixmapBuffer;
/** Values used when pressing mouse */
double m_dStartValue;
/** True if disabled pixmaps is loaded */
Index: src/wnumber.h
===================================================================
--- src/wnumber.h (revision 2122)
+++ src/wnumber.h (working copy)
@@ -35,7 +35,6 @@
void move(int, int);
void setFixedSize(int, int);
void setNumDigits(int);
- void setAlignment(int);
void setConstFactor(double);
public slots:
Index: src/wvinylcontrolindicator.cpp
===================================================================
--- src/wvinylcontrolindicator.cpp (revision 2122)
+++ src/wvinylcontrolindicator.cpp (working copy)
@@ -18,12 +18,12 @@
#include "wvinylcontrolindicator.h"
#include "wpixmapstore.h"
+#include <QPainter>
WVinylControlIndicator::WVinylControlIndicator(QWidget * parent, const char * name) : WWidget(parent,name)
{
m_pPixmapBack = 0;
//m_pPixmapVu = 0;
- m_pPixmapBuffer = 0;
iWidth = 30;
iHeight = 40;
iRadius = 10;
@@ -69,8 +69,6 @@
m_pPixmapBack = 0;
//WPixmapStore::deletePixmap(m_pPixmapVu);
//m_pPixmapVu = 0;
- WPixmapStore::deletePixmap(m_pPixmapBuffer);
- m_pPixmapBuffer = 0;
}
}
@@ -86,8 +84,6 @@
qDebug() << "WVinylControlIndicator: Error loading vu pixmap " << vuFilename.latin1();
*/
- m_pPixmapBuffer = new QPixmap(m_pPixmapBack->size());
-
setFixedSize(m_pPixmapBack->size());
//m_bHorizontal = bHorizontal;
@@ -112,14 +108,15 @@
idx = 0;
*/
+ QPainter p(this);
+
// Draw back on buffer
- bitBlt(m_pPixmapBuffer, 0, 0, m_pPixmapBack);
+ paint.drawPixmap(0, 0, m_pPixmapBack);
//qDebug() << "PAINTING WVinylControlIndicator!";
QPen tip(black, 4);
QPen tail(black, 1);
- QPainter p(m_pPixmapBuffer);
p.setBrush(Qt::black);
p.setPen(tip);
//for (int i = 0; i < iWidth; i++)
@@ -130,16 +127,6 @@
p.end();
phase++; if (phase > 360) phase = 0;
-
-
- // Draw (part of) vu on buffer
- /*if (m_bHorizontal)
- bitBlt(m_pPixmapBuffer, 0, 0, m_pPixmapVu, 0, 0, idx, m_pPixmapVu->height());
- else*/
- //bitBlt(m_pPixmapBuffer, 0, m_iNoPos-idx, m_pPixmapVu, 0, m_iNoPos-idx, m_pPixmapVu->width(), idx);
-
- // Draw buffer on screen
- bitBlt(this, 0, 0, m_pPixmapBuffer);
}
}
Index: src/enginebuffercue.cpp
===================================================================
--- src/enginebuffercue.cpp (revision 2114)
+++ src/enginebuffercue.cpp (working copy)
@@ -113,8 +113,9 @@
}
// Goto the cue point and stop, regardless of playback status:
-void EngineBufferCue::slotControlCueGotoAndStop(double /* pos */)
+void EngineBufferCue::slotControlCueGotoAndStop(double pos)
{
+ if(pos == 0.) return;
//Seek to the cue point...
m_pEngineBuffer->slotControlSeekAbs(cuePoint->get(), false);
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Mixxx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mixxx-devel