-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds purge/unhide buttons to the missing and hidden table. Addtionally
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
Showing
32 changed files
with
551 additions
and
354 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
Oops, something went wrong.