Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some style issues #14

Merged
merged 3 commits into from
Jan 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/dialog/savedqueries/dlgsavedquerieseditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ DlgSavedQueriesEditor::DlgSavedQueriesEditor(LibraryFeature* pFeature,
m_pTrackCollection->getSavedQueriesDAO(),
parent);
tableView->setModel(pSaveModel);
for (int i = 0; i < SavedQueryColumns::NUM_COLUMNS; ++i) {
int numColumns = static_cast<int>(SavedQueryColumns::NUM_COLUMNS);
for (int i = 0; i < numColumns; ++i) {
tableView->setColumnHidden(i, pSaveModel->isColumnInternal(i));
}

Expand All @@ -34,13 +35,13 @@ void DlgSavedQueriesEditor::accept() {
}

void DlgSavedQueriesEditor::removeQuery() {
QItemSelectionModel* model = tableView->selectionModel();
auto model = tableView->selectionModel();
if (model == nullptr) return;

QModelIndexList selected = model->selectedRows();

QSet<int> removedRows;
for (const QModelIndex& index : selected) {
for (const auto& index : selected) {
removedRows << index.row();
}

Expand Down
2 changes: 1 addition & 1 deletion src/library/coverartdelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void CoverArtDelegate::paint(QPainter* painter,

// Draw original item without text as background
opt.text = QString();
const QWidget *widget = opt.widget;
const auto widget = opt.widget;
QStyle *style = widget ? widget->style() : QApplication::style();
style->drawControl(QStyle::CE_ItemViewItem, &opt, painter, widget);

Expand Down
22 changes: 6 additions & 16 deletions src/library/features/analysis/analysisfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ AnalysisFeature::AnalysisFeature(UserSettingsPointer pConfig,
m_pAnalyzerQueue(nullptr),
m_iOldBpmEnabled(0),
m_analysisTitleName(tr("Analyze")),
m_pAnalysisView(nullptr){
m_pAnalysisView(nullptr),
m_analysisLibraryTableModel(this, m_pTrackCollection) {

m_childModel.setRootItem(std::make_unique<TreeItem>(this));
setTitleDefault();
Expand Down Expand Up @@ -62,7 +63,7 @@ QString AnalysisFeature::getSettingsName() const {

QWidget* AnalysisFeature::createPaneWidget(KeyboardEventFilter*, int paneId) {
WTrackTableView* pTable = createTableWidget(paneId);
pTable->loadTrackModel(getAnalysisTableModel());
pTable->loadTrackModel(&m_analysisLibraryTableModel);
connect(pTable->selectionModel(),
SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)),
this,
Expand All @@ -74,7 +75,7 @@ QWidget* AnalysisFeature::createPaneWidget(KeyboardEventFilter*, int paneId) {
QWidget* AnalysisFeature::createInnerSidebarWidget(KeyboardEventFilter* pKeyboard) {
m_pAnalysisView = new DlgAnalysis(nullptr, this, m_pTrackCollection);

m_pAnalysisView->setTableModel(getAnalysisTableModel());
m_pAnalysisView->setTableModel(&m_analysisLibraryTableModel);

connect(this, SIGNAL(analysisActive(bool)),
m_pAnalysisView, SLOT(analysisActive(bool)));
Expand Down Expand Up @@ -194,24 +195,13 @@ void AnalysisFeature::tableSelectionChanged(const QItemSelection&,

bool AnalysisFeature::dropAccept(QList<QUrl> urls, QObject* pSource) {
Q_UNUSED(pSource);
QList<QFileInfo> files =
DragAndDropHelper::supportedTracksFromUrls(urls, false, true);
auto files = DragAndDropHelper::supportedTracksFromUrls(urls, false, true);
// Adds track, does not insert duplicates, handles unremoving logic.
QList<TrackId> trackIds =
m_pTrackCollection->getTrackDAO().addMultipleTracks(files, true);
auto trackIds = m_pTrackCollection->getTrackDAO().addMultipleTracks(files, true);
analyzeTracks(trackIds);
return trackIds.size() > 0;
}

bool AnalysisFeature::dragMoveAccept(QUrl url) {
return SoundSourceProxy::isUrlSupported(url);
}

AnalysisLibraryTableModel* AnalysisFeature::getAnalysisTableModel() {
if (m_pAnalysisLibraryTableModel.isNull()) {
m_pAnalysisLibraryTableModel =
new AnalysisLibraryTableModel(this, m_pTrackCollection);
}

return m_pAnalysisLibraryTableModel;
}
2 changes: 1 addition & 1 deletion src/library/features/analysis/analysisfeature.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class AnalysisFeature : public LibraryFeature {
TreeItemModel m_childModel;
QString m_analysisTitleName;
QPointer<DlgAnalysis> m_pAnalysisView;
QPointer<AnalysisLibraryTableModel> m_pAnalysisLibraryTableModel;
AnalysisLibraryTableModel m_analysisLibraryTableModel;
};


Expand Down
18 changes: 2 additions & 16 deletions src/library/features/baseplaylist/baseplaylistfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ void BasePlaylistFeature::activate() {
adoptPreselectedPane();

auto modelIt = m_lastChildClicked.constFind(m_featurePane);
if (modelIt != m_lastChildClicked.constEnd() && (*modelIt).isValid()) {
if (modelIt != m_lastChildClicked.constEnd() && modelIt->isValid()) {
qDebug() << "BasePlaylistFeature::activate" << "m_lastChildClicked found";
// Open last clicked Playlist in the preselectded pane
activateChild(*modelIt);
Expand Down Expand Up @@ -341,21 +341,7 @@ void BasePlaylistFeature::slotDeletePlaylist() {
return;
}

m_playlistDao.deletePlaylist(playlistId);

// This avoids a bug where the m_lastChildClicked index is still a valid
// index but it's not true since we just deleted it
for (auto it = m_playlistTableModel.begin();
it != m_playlistTableModel.end(); ++it) {

if ((*it)->getPlaylist() == playlistId) {
// Show the browse widget, this avoids a problem when the same
// playlist is shown twice and gets deleted. One of the panes
// gets still showing the unexisting playlist.
m_lastChildClicked[it.key()] = QModelIndex();
showBrowse(it.key());
}
}
m_playlistDao.deletePlaylist(playlistId);
activate();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/library/features/libraryfolder/libraryfoldermodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ QVariant LibraryFolderModel::data(const QModelIndex& index, int role) const {
if (role == AbstractRole::RoleQuery) {
// User has clicked the show all item or we are showing the library
// instead of the folders
if (!m_folderRecursive || pTree == m_pShowAll || pTree == m_pGrouping) {
if (!m_showFolders || pTree == m_pShowAll || pTree == m_pGrouping) {
return MixxxLibraryTreeModel::data(index, role);
}

Expand Down