summaryrefslogtreecommitdiffstats
path: root/src/widget
diff options
context:
space:
mode:
authorRJ Ryan <rryan@mixxx.org>2013-06-19 00:46:54 -0400
committerRJ Ryan <rryan@mixxx.org>2013-06-19 00:46:54 -0400
commit25d57b59dff3947212909634864dd82365c9606b (patch)
treef0d0f8a048f8ed2f45c5ff015fc96891662f72f1 /src/widget
parente50f9f168fa08f2be6d0f13e8a225bbcc9de09bb (diff)
Moving mixxx/* to the root. A new era begins!
Diffstat (limited to 'src/widget')
-rw-r--r--src/widget/hexspinbox.cpp32
-rw-r--r--src/widget/hexspinbox.h18
-rw-r--r--src/widget/wabstractcontrol.cpp24
-rw-r--r--src/widget/wabstractcontrol.h32
-rw-r--r--src/widget/wdisplay.cpp91
-rw-r--r--src/widget/wdisplay.h53
-rw-r--r--src/widget/wimagestore.cpp92
-rw-r--r--src/widget/wimagestore.h32
-rw-r--r--src/widget/wknob.cpp228
-rw-r--r--src/widget/wknob.h66
-rw-r--r--src/widget/wlabel.cpp68
-rw-r--r--src/widget/wlabel.h48
-rw-r--r--src/widget/wlibrary.cpp57
-rw-r--r--src/widget/wlibrary.h44
-rw-r--r--src/widget/wlibrarysidebar.cpp179
-rw-r--r--src/widget/wlibrarysidebar.h32
-rw-r--r--src/widget/wlibrarytableview.cpp108
-rw-r--r--src/widget/wlibrarytableview.h45
-rw-r--r--src/widget/wlibrarytextbrowser.cpp11
-rw-r--r--src/widget/wlibrarytextbrowser.h20
-rw-r--r--src/widget/wnumber.cpp108
-rw-r--r--src/widget/wnumber.h53
-rw-r--r--src/widget/wnumberpos.cpp120
-rw-r--r--src/widget/wnumberpos.h46
-rw-r--r--src/widget/wnumberrate.cpp49
-rw-r--r--src/widget/wnumberrate.h37
-rw-r--r--src/widget/woverview.cpp617
-rw-r--r--src/widget/woverview.h128
-rw-r--r--src/widget/wpixmapstore.cpp103
-rw-r--r--src/widget/wpixmapstore.h50
-rw-r--r--src/widget/wpreparecratestableview.cpp102
-rw-r--r--src/widget/wpreparecratestableview.h24
-rw-r--r--src/widget/wpreparelibrarytableview.cpp27
-rw-r--r--src/widget/wpreparelibrarytableview.h23
-rw-r--r--src/widget/wpushbutton.cpp306
-rw-r--r--src/widget/wpushbutton.h79
-rw-r--r--src/widget/wsearchlineedit.cpp185
-rw-r--r--src/widget/wsearchlineedit.h48
-rw-r--r--src/widget/wskincolor.cpp16
-rw-r--r--src/widget/wskincolor.h33
-rw-r--r--src/widget/wslider.cpp26
-rw-r--r--src/widget/wslider.h33
-rw-r--r--src/widget/wslidercomposed.cpp231
-rw-r--r--src/widget/wslidercomposed.h69
-rw-r--r--src/widget/wspinny.cpp516
-rw-r--r--src/widget/wspinny.h95
-rw-r--r--src/widget/wstatuslight.cpp136
-rw-r--r--src/widget/wstatuslight.h54
-rw-r--r--src/widget/wtime.cpp59
-rw-r--r--src/widget/wtime.h35
-rw-r--r--src/widget/wtrackproperty.cpp43
-rw-r--r--src/widget/wtrackproperty.h28
-rw-r--r--src/widget/wtracktableview.cpp1383
-rw-r--r--src/widget/wtracktableview.h148
-rw-r--r--src/widget/wtracktableviewheader.cpp199
-rw-r--r--src/widget/wtracktableviewheader.h44
-rw-r--r--src/widget/wtracktext.cpp35
-rw-r--r--src/widget/wtracktext.h24
-rw-r--r--src/widget/wvumeter.cpp198
-rw-r--r--src/widget/wvumeter.h69
-rw-r--r--src/widget/wwaveformviewer.cpp215
-rw-r--r--src/widget/wwaveformviewer.h79
-rw-r--r--src/widget/wwidget.cpp135
-rw-r--r--src/widget/wwidget.h86
-rw-r--r--src/widget/wwidgetgroup.cpp77
-rw-r--r--src/widget/wwidgetgroup.h26
-rw-r--r--src/widget/wwidgetstack.cpp77
-rw-r--r--src/widget/wwidgetstack.h53
68 files changed, 7607 insertions, 0 deletions
diff --git a/src/widget/hexspinbox.cpp b/src/widget/hexspinbox.cpp
new file mode 100644
index 0000000000..e3f25c4c53
--- /dev/null
+++ b/src/widget/hexspinbox.cpp
@@ -0,0 +1,32 @@
+#include <qvalidator.h>
+
+#include "hexspinbox.h"
+
+HexSpinBox::HexSpinBox(QWidget *parent)
+ : QSpinBox(parent)
+{
+
+ setRange(0, 255);
+}
+
+QString HexSpinBox::textFromValue(int value) const
+{
+ //Construct a hex string formatted like 0x0f.
+ return QString("0x") + QString("%1").arg(value,
+ 2, //Field width (makes "F" become "0F")
+ 16,
+ QLatin1Char('0')).toUpper();
+}
+
+int HexSpinBox::valueFromText(const QString& text) const
+{
+ bool ok;
+ return text.toInt(&ok, 16);
+}
+
+QValidator::State HexSpinBox::validate ( QString & input, int & pos ) const
+{
+ const QRegExp regExp("^0(x|X)[0-9A-Fa-f]+");
+ QRegExpValidator validator(regExp, NULL);
+ return validator.validate(input, pos);
+}
diff --git a/src/widget/hexspinbox.h b/src/widget/hexspinbox.h
new file mode 100644
index 0000000000..c7a795cf0d
--- /dev/null
+++ b/src/widget/hexspinbox.h
@@ -0,0 +1,18 @@
+#ifndef HEXSPINBOX_H
+#define HEXSPINBOX_H
+
+#include <qspinbox.h>
+#include <qvalidator.h>
+
+class HexSpinBox : public QSpinBox
+{
+public:
+ HexSpinBox(QWidget *parent);
+
+protected:
+ QString textFromValue(int value) const;
+ int valueFromText(const QString& text) const;
+ QValidator::State validate( QString & input, int & pos ) const;
+};
+
+#endif
diff --git a/src/widget/wabstractcontrol.cpp b/src/widget/wabstractcontrol.cpp
new file mode 100644
index 0000000000..fcb3496050
--- /dev/null
+++ b/src/widget/wabstractcontrol.cpp
@@ -0,0 +1,24 @@
+/***************************************************************************
+ wabstractcontrol.cpp - Abstract Control Widget
+ -------------------
+ copyright : (C) 2007 by Wesley Stessens
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "wabstractcontrol.h"
+
+WAbstractControl::WAbstractControl(QWidget *parent)
+ : WWidget(parent) {
+ m_bRightButtonPressed = false;
+}
+
+WAbstractControl::~WAbstractControl() {
+}
diff --git a/src/widget/wabstractcontrol.h b/src/widget/wabstractcontrol.h
new file mode 100644
index 0000000000..fbcd965948
--- /dev/null
+++ b/src/widget/wabstractcontrol.h
@@ -0,0 +1,32 @@
+/***************************************************************************
+ wabstractcontrol.h - Abstract Control Widget
+ -------------------
+ copyright : (C) 2007 by Wesley Stessens
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef WABSTRACTCONTROL_H
+#define WABSTRACTCONTROL_H
+
+#include <QObject>
+#include "wwidget.h"
+
+class WAbstractControl : public WWidget {
+ Q_OBJECT
+public:
+ WAbstractControl(QWidget *parent=0);
+ ~WAbstractControl();
+protected:
+ /** True if right mouse button is pressed */
+ bool m_bRightButtonPressed;
+};
+
+#endif
diff --git a/src/widget/wdisplay.cpp b/src/widget/wdisplay.cpp
new file mode 100644
index 0000000000..63cc194060
--- /dev/null
+++ b/src/widget/wdisplay.cpp
@@ -0,0 +1,91 @@
+/***************************************************************************
+ wdisplay.cpp - description
+ -------------------
+ begin : Fri Jun 21 2002
+ copyright : (C) 2002 by Tue & Ken Haste Andersen
+ email : haste@diku.dk
+***************************************************************************/
+
+/***************************************************************************
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+***************************************************************************/
+
+#include "wdisplay.h"
+#include "wpixmapstore.h"
+
+#include <QPainter>
+#include <QPaintEvent>
+#include <QtDebug>
+#include <QPixmap>
+
+WDisplay::WDisplay(QWidget * parent) : WWidget(parent) {
+ m_pPixmaps = 0;
+ setPositions(0);
+}
+
+WDisplay::~WDisplay() {
+ resetPositions();
+}
+
+void WDisplay::setup(QDomNode node) {
+ // Number of states
+ setPositions(selectNodeInt(node, "NumberStates"));
+
+ // Load knob pixmaps
+ QString path = selectNodeQString(node, "Path");
+ for (int i=0; i<m_iNoPos; ++i) {
+ setPixmap(i, getPath(path.arg(i)));
+ }
+}
+
+void WDisplay::setPositions(int iNoPos) {
+ m_iNoPos = iNoPos;
+ m_iPos = 0;
+
+ resetPositions();
+
+ if (m_iNoPos>0) {
+ m_pPixmaps = new QPixmap*[m_iNoPos];
+ for (int i=0; i<m_iNoPos; i++)
+ m_pPixmaps[i] = 0;
+ }
+}
+
+void WDisplay::resetPositions() {
+ if (m_pPixmaps) {
+ for (int i=0; i<m_iNoPos; i++)
+ if (m_pPixmaps[i])
+ WPixmapStore::deletePixmap(m_pPixmaps[i]);
+
+ //WPixmapStore::deletePixmap(m_pPixmaps);
+ m_pPixmaps = 0;
+ }
+}
+
+void WDisplay::setPixmap(int iPos, const QString &filename) {
+ m_pPixmaps[iPos] = WPixmapStore::getPixmap(filename);
+ if (!m_pPixmaps[iPos])
+ qDebug() << "WDisplay: Error loading pixmap" << filename;
+ else
+ setFixedSize(m_pPixmaps[iPos]->size());
+}
+
+void WDisplay::paintEvent(QPaintEvent *) {
+ if (m_pPixmaps) {
+ int idx = (int)(m_fValue*(float)(m_iNoPos)/128.);
+ // Range check
+ if (idx>(m_iNoPos-1))
+ idx = m_iNoPos-1;
+ else if (idx<0)
+ idx = 0;
+ if (m_pPixmaps[idx]) {
+ QPainter p(this);
+ p.drawPixmap(0, 0, *m_pPixmaps[idx]);
+ }
+ }
+}
diff --git a/src/widget/wdisplay.h b/src/widget/wdisplay.h
new file mode 100644
index 0000000000..c55e1407b0
--- /dev/null
+++ b/src/widget/wdisplay.h
@@ -0,0 +1,53 @@
+/***************************************************************************
+ wdisplay.h - description
+ -------------------
+ begin : Fri Jun 21 2002
+ copyright : (C) 2002 by Tue & Ken Haste Andersen
+ email : haste@diku.dk
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef WDISPLAY_H
+#define WDISPLAY_H
+
+#include "wwidget.h"
+#include <qpixmap.h>
+#include <qstring.h>
+//Added by qt3to4:
+#include <QPaintEvent>
+
+/**
+ *@author Tue & Ken Haste Andersen
+ */
+
+class WDisplay : public WWidget {
+ Q_OBJECT
+public:
+ WDisplay(QWidget *parent=0);
+ ~WDisplay();
+ void setup(QDomNode node);
+ void setPositions(int iNoPos);
+ void setPixmap(int iPos, const QString &filename);
+
+private:
+ /** Set position number to zero and deallocate pixmaps */
+ void resetPositions();
+ void paintEvent(QPaintEvent *);
+
+ /** Current position */
+ int m_iPos;
+ /** Number of positions associated with this knob */
+ int m_iNoPos;
+ /** Array of associated pixmaps */
+ QPixmap **m_pPixmaps;
+ };
+
+#endif
diff --git a/src/widget/wimagestore.cpp b/src/widget/wimagestore.cpp
new file mode 100644
index 0000000000..6c4c115e6f
--- /dev/null
+++ b/src/widget/wimagestore.cpp
@@ -0,0 +1,92 @@
+#include "wimagestore.h"
+
+#include <QtDebug>
+
+// static
+QHash<QString, WImageStore::ImageInfoType*> WImageStore::m_dictionary;
+QSharedPointer<ImgSource> WImageStore::m_loader = QSharedPointer<ImgSource>();
+
+// static
+QImage * WImageStore::getImage(const QString &fileName) {
+ // Search for Image in list
+ ImageInfoType* info = NULL;
+
+ QHash<QString, ImageInfoType*>::iterator it = m_dictionary.find(fileName);
+ if (it != m_dictionary.end()) {
+ info = it.value();
+ info->instCount++;
+ //qDebug() << "WImageStore returning cached Image for:" << fileName;
+ return info->image;
+ }
+
+ // Image wasn't found, construct it
+ //qDebug() << "WImageStore Loading Image from file" << fileName;
+
+ QImage* loadedImage = getImageNoCache(fileName);
+
+ if (loadedImage == NULL) {
+ return NULL;
+ }
+
+
+ if (loadedImage->isNull()) {
+ qDebug() << "WImageStore couldn't load:" << fileName << (loadedImage == NULL);
+ delete loadedImage;
+ return NULL;
+ }
+
+ info = new ImageInfoType;
+ info->image = loadedImage;
+ info->instCount = 1;
+ m_dictionary.insert(fileName, info);
+ return info->image;
+}
+
+// static
+QImage * WImageStore::getImageNoCache(const QString& fileName) {
+ QImage* pImage;
+ if (m_loader) {
+ pImage = m_loader->getImage(fileName);
+ } else {
+ pImage = new QImage(fileName);
+ }
+ return pImage;
+}
+
+// static
+void WImageStore::deleteImage(QImage * p)
+{
+ // Search for Image in list
+ ImageInfoType *info = NULL;
+ QMutableHashIterator<QString, ImageInfoType*> it(m_dictionary);
+
+ while (it.hasNext())
+ {
+ info = it.next().value();
+ if (p == info->image)
+ {
+ info->instCount--;
+ if (info->instCount<1)
+ {
+ it.remove();
+ delete info->image;
+ delete info;
+ }
+ break;
+ }
+ }
+}
+
+// static
+void WImageStore::correctImageColors(QImage* p) {
+ if (m_loader) {
+ m_loader->correctImageColors(p);
+ }
+}
+
+// static
+void WImageStore::setLoader(QSharedPointer<ImgSource> ld) {
+ m_loader = ld;
+}
+
+
diff --git a/src/widget/wimagestore.h b/src/widget/wimagestore.h
new file mode 100644
index 0000000000..55c9ab6f93
--- /dev/null
+++ b/src/widget/wimagestore.h
@@ -0,0 +1,32 @@
+
+#ifndef WIMAGESTORE_H
+#define WIMAGESTORE_H
+
+#include <QHash>
+#include <QSharedPointer>
+
+#include "skin/imgsource.h"
+
+class QImage;
+
+class WImageStore {
+ public:
+ static QImage* getImage(const QString &fileName);
+ static QImage* getImageNoCache(const QString &fileName);
+ static void deleteImage(QImage* p);
+ static void setLoader(QSharedPointer<ImgSource> ld);
+ // For external owned images like software generated ones.
+ static void correctImageColors(QImage* p);
+
+ private:
+ struct ImageInfoType {
+ QImage *image;
+ int instCount;
+ };
+
+ /** Dictionary of Images already instantiated */
+ static QHash<QString, ImageInfoType*> m_dictionary;
+ static QSharedPointer<ImgSource> m_loader;
+};
+
+#endif
diff --git a/src/widget/wknob.cpp b/src/widget/wknob.cpp
new file mode 100644
index 0000000000..eb0ff3dbe5
--- /dev/null
+++ b/src/widget/wknob.cpp
@@ -0,0 +1,228 @@
+/***************************************************************************
+ wknob.cpp - description
+ -------------------
+ begin : Fri Jun 21 2002
+ copyright : (C) 2002 by Tue & Ken Haste Andersen
+ email : haste@diku.dk
+***************************************************************************/
+
+/***************************************************************************
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+***************************************************************************/
+
+#include <QPixmap>
+#include <QtDebug>
+#include <QMouseEvent>
+#include <QPainter>
+#include <QPaintEvent>
+
+#include "widget/wknob.h"
+
+#include "defs.h"
+#include "widget/wpixmapstore.h"
+
+WKnob::WKnob(QWidget * parent)
+ : WAbstractControl(parent),
+ m_iPos(0),
+ m_iNoPos(0),
+ m_pPixmaps(NULL),
+ m_pPixmapBack(NULL),
+ m_bDisabledLoaded(false) {
+}
+
+WKnob::~WKnob()
+{
+ resetPositions();
+ if (m_pPixmapBack) {
+ WPixmapStore::deletePixmap(m_pPixmapBack);
+ }
+}
+
+void WKnob::setup(QDomNode node)
+{
+ // Set background pixmap if available
+ if (!selectNode(node, "BackPath").isNull())
+ setPixmapBackground(getPath(selectNodeQString(node, "BackPath")));
+
+ // Number of states. Depends if disabled pics are defined as well
+ setPositions(selectNodeInt(node, "NumberStates"),
+ !selectNode(node, "DisabledPath").isNull());
+
+ // Load knob pixmaps
+ QString path = selectNodeQString(node, "Path");
+ for (int i=0; i<m_iNoPos; ++i)
+ setPixmap(i, getPath(path.arg(i)));
+
+ // See if disabled images is defined, and load them...
+ if (!selectNode(node, "DisabledPath").isNull())
+ {
+ path = selectNodeQString(node, "DisabledPath");
+ for (int i=0; i<m_iNoPos; ++i)
+ setPixmap(i+m_iNoPos, getPath(path.arg(i)));
+ m_bDisabledLoaded = true;
+ }
+}
+
+void WKnob::setPositions(int iNoPos, bool bIncludingDisabled)
+{
+ resetPositions();
+
+ m_iNoPos = iNoPos;
+ m_iPos = 0;
+
+ if (m_iNoPos>0)
+ {
+ int pics = m_iNoPos;
+ if (bIncludingDisabled)
+ pics *= 2;
+
+ m_pPixmaps = new QPixmap*[pics];
+ for (int i=0; i<pics; i++)
+ m_pPixmaps[i] = 0;
+ }
+}
+
+void WKnob::resetPositions()
+{
+ if (m_pPixmaps)
+ {
+ int pics = m_iNoPos;
+ if( m_bDisabledLoaded ){
+ pics *= 2;
+ }
+ for (int i=0; i<pics; i++) {
+ if (m_pPixmaps[i]) {
+ WPixmapStore::deletePixmap(m_pPixmaps[i]);
+ }
+ }
+ delete [] m_pPixmaps;
+ m_pPixmaps = NULL;
+ }
+}
+
+void WKnob::setPixmap(int iPos, const QString &filename)
+{
+ m_pPixmaps[iPos] = WPixmapStore::getPixmap(filename);
+ if (!m_pPixmaps[iPos])
+ qDebug() << "WKnob: Error loading pixmap" << filename;
+ setFixedSize(m_pPixmaps[iPos]->size());
+}
+
+void WKnob::setPixmapBackground(const QString &filename)
+{
+ // Load background pixmap
+ if (m_pPixmapBack) {
+ WPixmapStore::deletePixmap(m_pPixmapBack);
+ }
+ m_pPixmapBack = WPixmapStore::getPixmap(filename);
+ if (!m_pPixmapBack)</