Skip to content

Commit

Permalink
Adds purge/unhide buttons to the missing and hidden table. Addtionally
Browse files Browse the repository at this point in the history
libraryview.h and all its childclasses are cleaned up and unused code is removed
  • Loading branch information
Max Linke committed Jan 17, 2013
1 parent c1d37e8 commit ba0bd8d
Show file tree
Hide file tree
Showing 32 changed files with 551 additions and 354 deletions.
4 changes: 4 additions & 0 deletions mixxx/build/depends.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,8 @@ def sources(self, build):
"dlgtrackinfo.cpp",
"dlgprepare.cpp",
"dlgautodj.cpp",
"dlghidden.cpp",
"dlgmissing.cpp",

"engine/engineworker.cpp",
"engine/engineworkerscheduler.cpp",
Expand Down Expand Up @@ -749,6 +751,8 @@ def sources(self, build):
build.env.Uic4('dlgautodj.ui')
build.env.Uic4('dlgprefsounditem.ui')
build.env.Uic4('dlgrecording.ui')
build.env.Uic4('dlghidden.ui')
build.env.Uic4('dlgmissing.ui')

if build.platform_is_windows:
# Add Windows resource file with icons and such
Expand Down
50 changes: 4 additions & 46 deletions mixxx/src/dlgautodj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,40 +158,10 @@ void DlgAutoDJ::onShow() {
m_pAutoDJTableModel->select();
}

void DlgAutoDJ::setup(QDomNode node) {
QPalette pal = palette();

// Row colors
if (!WWidget::selectNode(node, "BgColorRowEven").isNull() &&
!WWidget::selectNode(node, "BgColorRowUneven").isNull()) {
QColor r1;
r1.setNamedColor(WWidget::selectNodeQString(node, "BgColorRowEven"));
r1 = WSkinColor::getCorrectColor(r1);
QColor r2;
r2.setNamedColor(WWidget::selectNodeQString(node, "BgColorRowUneven"));
r2 = WSkinColor::getCorrectColor(r2);

// For now make text the inverse of the background so it's readable In
// the future this should be configurable from the skin with this as the
// fallback option
QColor text(255 - r1.red(), 255 - r1.green(), 255 - r1.blue());
QColor fgColor;
fgColor.setNamedColor(WWidget::selectNodeQString(node, "FgColor"));
fgColor = WSkinColor::getCorrectColor(fgColor);

pal.setColor(QPalette::Base, r1);
pal.setColor(QPalette::AlternateBase, r2);
pal.setColor(QPalette::Text, text);
pal.setColor(QPalette::WindowText, fgColor);
}

setPalette(pal);

pushButtonAutoDJ->setPalette(pal);

// Since we're getting this passed into us already created, shouldn't need
// to set the palette.
//m_pTrackTableView->setPalette(pal);
void DlgAutoDJ::onSearch(const QString& text) {
// Do not allow filtering the Auto DJ playlist, because
// Auto DJ will work from the filtered table
Q_UNUSED(text);
}

double DlgAutoDJ::getCrossfader() const {
Expand All @@ -208,18 +178,6 @@ void DlgAutoDJ::setCrossfader(double value) {
m_pCOCrossfader->slotSet(value);
}

void DlgAutoDJ::onSearchStarting() {
}

void DlgAutoDJ::onSearchCleared() {
}

void DlgAutoDJ::onSearch(const QString& text) {
Q_UNUSED(text);
// Do not allow filtering the Auto DJ playlist, because
// Auto DJ will work from the filtered table
}

void DlgAutoDJ::loadSelectedTrack() {
m_pTrackTableView->loadSelectedTrack();
}
Expand Down
17 changes: 7 additions & 10 deletions mixxx/src/dlgautodj.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,18 @@ class AnalyserQueue;
class QSqlTableModel;
class ControlObjectThreadMain;

class DlgAutoDJ : public QWidget, public Ui::DlgAutoDJ, public virtual LibraryView {
class DlgAutoDJ : public QWidget, public Ui::DlgAutoDJ, public LibraryView {
Q_OBJECT
public:
DlgAutoDJ(QWidget *parent, ConfigObject<ConfigValue>* pConfig,
TrackCollection* pTrackCollection, MixxxKeyboard* pKeyboard);
virtual ~DlgAutoDJ();

virtual void setup(QDomNode node);
virtual void onSearchStarting();
virtual void onSearchCleared();
virtual void onSearch(const QString& text);
virtual void onShow();
virtual void loadSelectedTrack();
virtual void loadSelectedTrackToGroup(QString group);
virtual void moveSelection(int delta);
void onShow();
void loadSelectedTrack();
void onSearch(const QString& text);
void loadSelectedTrackToGroup(QString group);
void moveSelection(int delta);

public slots:
void shufflePlaylistButton(bool buttonChecked);
Expand Down Expand Up @@ -110,7 +107,7 @@ class DlgAutoDJ : public QWidget, public Ui::DlgAutoDJ, public virtual LibraryVi
ControlPushButton* m_pCOToggleAutoDJ;
};

#endif //DLGTRIAGE_H
#endif //DLGAUTODJ_H



Expand Down
77 changes: 77 additions & 0 deletions mixxx/src/dlghidden.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#include "QItemSelection"

#include "dlghidden.h"
#include "library/hiddentablemodel.h"
#include "widget/wtracktableview.h"

DlgHidden::DlgHidden(QWidget* parent, ConfigObject<ConfigValue>* pConfig,
TrackCollection* pTrackCollection, MixxxKeyboard* pKeyboard)
: QWidget(parent),
Ui::DlgHidden(),
m_pTrackTableView(
new WTrackTableView(this,pConfig,pTrackCollection, false)) {
setupUi(this);
m_pTrackTableView->installEventFilter(pKeyboard);

// Install our own trackTable
QBoxLayout* box = dynamic_cast<QBoxLayout*>(layout());
Q_ASSERT(box); //Assumes the form layout is a QVBox/QHBoxLayout!
box->removeWidget(m_pTrackTablePlaceholder);
m_pTrackTablePlaceholder->hide();
box->insertWidget(1, m_pTrackTableView);

m_pHiddenTableModel = new HiddenTableModel(this, pTrackCollection);
m_pTrackTableView->loadTrackModel(m_pHiddenTableModel);

connect(btnUnhide, SIGNAL(clicked()),
m_pTrackTableView, SLOT(slotUnhide()));
connect(btnUnhide, SIGNAL(clicked()),
this, SLOT(clicked()));
connect(btnPurge, SIGNAL(clicked()),
m_pTrackTableView, SLOT(slotPurge()));
connect(btnPurge, SIGNAL(clicked()),
this, SLOT(clicked()));
connect(btnSelect, SIGNAL(clicked()),
this, SLOT(selectAll()));
connect(m_pTrackTableView->selectionModel(),
SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)),
this,
SLOT(selectionChanged(const QItemSelection&, const QItemSelection&)));
}

DlgHidden::~DlgHidden() {
// Delete m_pTrackTableView before the table model. This is because the
// table view saves the header state using the model.
delete m_pTrackTableView;
delete m_pHiddenTableModel;
}

void DlgHidden::onShow() {
m_pHiddenTableModel->select();
// no buttons can be selected
activateButtons(false);
}

void DlgHidden::onSearch(const QString& text) {
m_pHiddenTableModel->search(text);
}

void DlgHidden::clicked() {
// all marked tracks are gone now anyway
onShow();
}

void DlgHidden::selectAll() {
m_pTrackTableView->selectAll();
}

void DlgHidden::activateButtons(bool enable) {
btnPurge->setEnabled(enable);
btnUnhide->setEnabled(enable);
}

void DlgHidden::selectionChanged(const QItemSelection &selected,
const QItemSelection &deselected) {
Q_UNUSED(deselected);
activateButtons(!selected.indexes().isEmpty());
}
36 changes: 36 additions & 0 deletions mixxx/src/dlghidden.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#ifndef DLGHIDDEN_H
#define DLGHIDDEN_H

#include "ui_dlghidden.h"
#include "configobject.h"
#include "library/libraryview.h"
#include "library/trackcollection.h"
#include "mixxxkeyboard.h"

class WTrackTableView;
class HiddenTableModel;
class QItemSelection;

class DlgHidden : public QWidget, public Ui::DlgHidden, public LibraryView {
Q_OBJECT
public:
DlgHidden(QWidget *parent, ConfigObject<ConfigValue>* pConfig,
TrackCollection* pTrackCollection, MixxxKeyboard* pKeyboard);
virtual ~DlgHidden();

void onShow();
void onSearch(const QString& text);

public slots:
void clicked();
void selectAll();
void selectionChanged(const QItemSelection&, const QItemSelection&);

private:
void activateButtons(bool enable);
TrackCollection* m_pTrackCollection;
WTrackTableView* m_pTrackTableView;
HiddenTableModel* m_pHiddenTableModel;
};

#endif //DLGHIDDEN_H
116 changes: 116 additions & 0 deletions mixxx/src/dlghidden.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DlgHidden</class>
<widget class="QWidget" name="DlgHidden">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>560</width>
<height>399</height>
</rect>
</property>
<property name="windowTitle">
<string>Manage</string>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<property name="leftMargin">
<number>12</number>
</property>
<property name="rightMargin">
<number>12</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="btnSelect">
<property name="toolTip">
<string>Selects all tracks in the table below.</string>
</property>
<property name="text">
<string>Select All</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnPurge">
<property name="toolTip">
<string>purge selected tracks from Library</string>
</property>
<property name="text">
<string>Purge</string>
</property>
<property name="checkable">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnUnhide">
<property name="toolTip">
<string>Unhide selected tracks from library</string>
</property>
<property name="text">
<string>Unhide</string>
</property>
<property name="shortcut">
<string>Ctrl+S</string>
</property>
<property name="checkable">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QTableView" name="m_pTrackTablePlaceholder">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="showGrid">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../res/mixxx.qrc"/>
</resources>
<connections/>
</ui>
Loading

0 comments on commit ba0bd8d

Please sign in to comment.