-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Crate archives #10997
base: main
Are you sure you want to change the base?
Crate archives #10997
Conversation
if (selectedIsArchived) { | ||
QModelIndex archiveIndex = m_pSidebarModel->index(rowCount - 1, 0); | ||
m_pSidebarWidget->setExpanded(archiveIndex, true); | ||
return m_pSidebarModel->index(selectedRow, 0, archiveIndex); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my use, I find it not very convenient to keep the archived crate selected. Instead I think it might be nicer to select the crate below where it used to be in the hierarchy. This is because archiving a crate is kind of like "please make this go away" so having the selection follow the archive process doesn't quite make sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But why expand the Archive item?
This PR is marked as stale because it has been open 90 days with no activity. |
…crate into the archive folder Also, make sure to highlight archived crates when selecting tracks.
Co-authored-by: ronso0 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. This looks like a nice feature.
@@ -569,18 +577,20 @@ bool CrateStorage::onInsertingCrate( | |||
FwdSqlQuery query(m_database, | |||
QStringLiteral( | |||
"INSERT INTO %1 (%2,%3,%4) " | |||
"VALUES (:name,:locked,:autoDjSource)") | |||
"VALUES (:name,:locked,:archived,:autoDjSource)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got a violated Debug Assertion:
warning [Main] QString::arg: 1 argument(s) missing in INSERT INTO %1 (%2,%3,%4) VALUES (:name,:locked,:archived,:autoDjSource)
critical [Main] FwdSqlQuery - Failed to prepare statement "INSERT INTO crates (name,locked,archived) VALUES (:name,:locked,:archived,:autoDjSource)" : QSqlError("1", "Unable to execute statement", "4 values for 3 columns")
critical [Main] DEBUG ASSERT: "query.isPrepared()" in function bool CrateStorage::onInsertingCrate(const Crate&, CrateId*) at ../../src/library/trackset/crate/cratestorage.cpp:587
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
The debug assert in It would be a nice addon if the table view is cleared when clicking the Archived item, currently it sticks to the previous view (which might be any item of any sidebar feature). Just fyi, for the YEAR items in History I created a temporary, locked playlist. Dunno if that's too much of a hack, or if CrateTableModel could use a |
yeah I can clear the view. I'll try the different options you suggest |
treeitems can either be crates or have children, not both.
Actually I wanted something like archiving for playlists (don't use crates that much anymore). |
Btw |
#11208 was merged, so now the sidebar selection should remain unchanged if the right-clicked item wasn't also selected. This is mostly done in With this branch however, if I
I think the reselection part can be simplified if we use a dedicated crate archive method in TrackCollection, as well as a new |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. I have left some comments.
<description> | ||
Support for crates being Archived. | ||
</description> | ||
<sql> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This uses an integer column for a bool value.
Does it make sense to make the use of this column extensible? Something like "type" or even "parent". We did the same "mistake" with the hidden column for playlists.
if (archiving) { | ||
const auto index = indexFromCrateId(crate.getId()); | ||
// Constrain reselection between first and last valid crate positions. | ||
reselectRow = std::min(std::max(index.row(), 0), m_pSidebarModel->rowCount() - 3); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this required? Why -3? Can you make it a constant?
} | ||
crate.setArchived(archiving); | ||
if (!m_pTrackCollection->updateCrate(crate)) { | ||
qDebug() << "Failed to toggle archive status of crate" << crate; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the scenario for this?
Can you give more details to also desringush this message from the one below?
CrateId(pTreeItem->getData())); | ||
pTreeItem->setBold(crateContainsSelectedTrack); | ||
if (pTreeItem->hasChildren()) { | ||
for (auto subItem : pTreeItem->children()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pSubItem?
@@ -607,12 +617,13 @@ bool CrateStorage::onUpdatingCrate( | |||
FwdSqlQuery query(m_database, | |||
QString( | |||
"UPDATE %1 " | |||
"SET %2=:name,%3=:locked,%4=:autoDjSource " | |||
"WHERE %5=:id") | |||
"SET %2=:name,%3=:locked,%4=:archived,%5=:autoDjSource " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can become a QStringLiteral
@@ -14,6 +14,8 @@ const mixxx::Logger kLogger("CrateStorage"); | |||
|
|||
const QString CRATETABLE_LOCKED = "locked"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can become a QStringLiteral
I'll be picking this back up and addressing comments |
This has unfortunately build errors. I will remove it from the 2.5-beta for now. |
no problem. Hopefully I will find time for this in the future |
this seems to be a desired feature so I'm going to try to pick it back up and also add the same thing for playlists. One thing I am tempted by is instead of using a bool, use a string, and call it "Archive". Then in the future this could become a more generic feature of named folders (one layer deep, no subfolders allowed!) or perhaps a csv tag system, where one crate could have multiple tags. It's really just a matter of UX decisions. |
This is a small feature that creates an Archive subfolder of the crate menu, much like the history playlist now has per-year folders. Users can move a crate to the archive folder if they don't want it to appear in the crate submenu. This requires a small change to the db (the addition of a bool to determine if the crate is in the archive) and a small amount of qt for the new submenu.
This is a draft because it needs more testing and UX improvement