Skip to content

Commit

Permalink
WLibrary/WTrackTableView: fix & tweak some debug messages
Browse files Browse the repository at this point in the history
  • Loading branch information
ronso0 committed May 11, 2022
1 parent e9b6f3f commit 54deccf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
13 changes: 7 additions & 6 deletions src/widget/wlibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ void WLibrary::setup(const QDomNode& node, const SkinContext& context) {
}

bool WLibrary::registerView(const QString& name, QWidget* view) {
//qDebug() << "WLibrary::registerView" << name;
const auto lock = lockMutex(&m_mutex);
if (m_viewMap.contains(name)) {
return false;
}
if (dynamic_cast<LibraryView*>(view) == nullptr) {
qDebug() << "WARNING: Attempted to register a view with WLibrary "
<< "that does not implement the LibraryView interface. "
qDebug() << "WARNING: Attempted to register view" << name << "with WLibrary "
<< "which does not implement the LibraryView interface. "
<< "Ignoring.";
return false;
}
Expand All @@ -58,8 +59,8 @@ void WLibrary::switchToView(const QString& name) {
if (widget != nullptr) {
LibraryView * lview = dynamic_cast<LibraryView*>(widget);
if (lview == nullptr) {
qDebug() << "WARNING: Attempted to register a view with WLibrary "
<< "that does not implement the LibraryView interface. "
qDebug() << "WARNING: Attempted to switch to view" << name << "with WLibrary "
<< "which does not implement the LibraryView interface. "
<< "Ignoring.";
return;
}
Expand All @@ -80,8 +81,8 @@ void WLibrary::search(const QString& name) {
QWidget* current = currentWidget();
LibraryView* view = dynamic_cast<LibraryView*>(current);
if (view == nullptr) {
qDebug() << "WARNING: Attempted to register a view with WLibrary "
<< "that does not implement the LibraryView interface. Ignoring.";
qDebug() << "WARNING: Attempted to search in view" << name << "with WLibrary "
<< "which does not implement the LibraryView interface. Ignoring.";
return;
}
lock.unlock();
Expand Down
9 changes: 5 additions & 4 deletions src/widget/wtracktableview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -965,13 +965,13 @@ bool WTrackTableView::isTrackInCurrentView(const TrackId& trackId) {
void WTrackTableView::setSelectedTracks(const QList<TrackId>& trackIds) {
QItemSelectionModel* pSelectionModel = selectionModel();
VERIFY_OR_DEBUG_ASSERT(pSelectionModel != nullptr) {
qWarning() << "No selected tracks available";
qWarning() << "No selection model";
return;
}

TrackModel* pTrackModel = getTrackModel();
VERIFY_OR_DEBUG_ASSERT(pTrackModel != nullptr) {
qWarning() << "No selected tracks available";
qWarning() << "No track model";
return;
}

Expand All @@ -988,17 +988,18 @@ void WTrackTableView::setSelectedTracks(const QList<TrackId>& trackIds) {
bool WTrackTableView::setCurrentTrackId(const TrackId& trackId, int column, bool scrollToTrack) {
QItemSelectionModel* pSelectionModel = selectionModel();
VERIFY_OR_DEBUG_ASSERT(pSelectionModel != nullptr) {
qWarning() << "No selected tracks available";
qWarning() << "No selection model";
return false;
}

TrackModel* pTrackModel = getTrackModel();
VERIFY_OR_DEBUG_ASSERT(pTrackModel != nullptr) {
qWarning() << "No selected tracks available";
qWarning() << "No track model";
return false;
}
const QVector<int> trackRows = pTrackModel->getTrackRows(trackId);
if (trackRows.empty()) {
qDebug() << "WTrackTableView: track" << trackId << "is not in current view";
return false;
}

Expand Down

0 comments on commit 54deccf

Please sign in to comment.