-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Improve: Find on web #15477
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
base: main
Are you sure you want to change the base?
Improve: Find on web #15477
Conversation
…in the "Find on Web" Menu
src/widget/findonweblast.cpp
Outdated
|
|
||
| namespace { | ||
| const QString kLibraryGroup = QStringLiteral("[Library]"); | ||
| const QString kFindOnWebLastActionKey = QStringLiteral("FindOnWebLastAction"); |
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.
Should we use snake_case here, as this appears to be a newly introduced key?
src/widget/findonweblast.cpp
Outdated
| void FindOnWebLast::openInBrowser(const QUrl& url) { | ||
| if (!mixxx::DesktopHelper::openUrl(url)) { | ||
| qWarning() << "DesktopHelper::openUrl() failed for " << url; | ||
| DEBUG_ASSERT(false); |
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 other place, we have the pattern DEBUG_ASSERT(!"An assert message");. It is pretty useful if you are running a debug build with assert without a debugger attached to it, as it will show a message directly, which you can search for (or even debug from the message itself).
This is nit tho, as the file+line is displayed as well.
src/widget/findonweblast.cpp
Outdated
| const QString& actionId, | ||
| const QString& actionText, | ||
| const QUrl& serviceUrl) { | ||
| qDebug() << "init()" << m_lastActionKey << actionId; |
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.
Do we want to keep this debug message? If yes, let's prefix with the class name to help identifying the message, as init is quite generic
| qDebug() << "init()" << m_lastActionKey << actionId; | |
| qDebug() << "FindOnWebLast::init()" << m_lastActionKey << actionId; |
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 is a debug leftover. Removed.
src/widget/findonweblast.cpp
Outdated
| } | ||
|
|
||
| QStringView service = QStringView(actionId).left(firstCommaPos); | ||
| setText(tr("Find on %1: %2").arg(service, actionText)); |
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.
suggestion
| setText(tr("Find on %1: %2").arg(service, actionText)); | |
| setText(tr("Find %1 on %2").arg(actionText, service)); |
src/widget/findonweblast.cpp
Outdated
| QStringView service = QStringView(actionId).left(firstCommaPos); | ||
| setText(tr("Find on %1: %2").arg(service, actionText)); | ||
| disconnect(); | ||
| connect(this, &QAction::triggered, this, [this, actionId, actionText, serviceUrl] { |
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.
you shouldn't need to capture those AFAIS
| connect(this, &QAction::triggered, this, [this, actionId, actionText, serviceUrl] { | |
| connect(this, &QAction::triggered, this, [this, serviceUrl] { |
src/widget/findonweblast.h
Outdated
| QString m_lastActionKey; | ||
| }; | ||
|
|
||
| #pragma once |
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.
Copy paste left over?
| #pragma once |
src/widget/findonwebmenufactory.h
Outdated
|
|
||
| void createFindOnWebSubmenus(QMenu* pFindOnWebMenu, const Track& track); | ||
| void createFindOnWebSubmenus(QMenu* pFindOnWebMenu, | ||
| FindOnWebLast* pFindOnWebLast, |
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'm wondering if this should be a shared_ptr case - I assume you kept a fat pointer because Qt parented owned?
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.
Yes, I have changed it to QPointer<>. At one point we have decided to use that, to pass a parented pointer around.
| void WCoverArtMenu::createActions() { | ||
| m_pChange = new QAction(tr("Choose new cover", | ||
| "change cover art location"), this); | ||
| m_pChange = new QAction(tr("Choose file", "change cover art location"), this); |
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's the rational for changing this? Feels like this will invalidate many translation but I'm not sure if the form is any better. Did we have some confusion with the previous wording?
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.
We the old translation my expectation was to have a chooser dialog and not a file browser. The new text should avoid this. Since we are her in the main branch, optimizing texts is allowed.
…ection in the "Find on Web" Menu
|
Done |
|
Code style fixed. |
I was annoyed form by the Discogs lookup burried to deep in the track menu. The fix is to ad a "Last used" entry that is two levels above. Now the menu looks like this:
I have also removed the literal title and artist form the menu. That feels like clutter when using it.
I had an intermediate version with a tooltip instead but that was also disturbing.
What's next:
All these URL land on a ranked search result page. This requires an unnecessary extra click if there is a full match. Instead of going there we may do an API call and check if we have a full match and than proceed to the result immediately.
Now that a overpopulated "Find on Web" menu is mitigated, I am also tempted to add Youtube Music and Spotfy to it, because I am using it on regular basis. Is this OK do we want a plug in interface?
Genius, Shazam and Spotalike are also candidatures.