mirror of
https://github.com/strawberrymusicplayer/strawberry
synced 2025-01-29 00:30:01 +01:00
Fix Tidal authentication on macOS
This commit is contained in:
parent
201ac47943
commit
7d3ceb7d8c
@ -78,7 +78,7 @@ const char *CommandlineOptions::kHelpText =
|
||||
|
||||
const char *CommandlineOptions::kVersionText = "Strawberry %1";
|
||||
|
||||
CommandlineOptions::CommandlineOptions(int argc, char* *argv)
|
||||
CommandlineOptions::CommandlineOptions(int argc, char **argv)
|
||||
: argc_(argc),
|
||||
argv_(argv),
|
||||
url_list_action_(UrlList_None),
|
||||
|
@ -148,8 +148,11 @@ QDebug operator<<(QDebug dbg, NSObject* object) {
|
||||
}
|
||||
|
||||
- (void)applicationDidFinishLaunching:(NSNotification*)aNotification {
|
||||
|
||||
Q_UNUSED(aNotification);
|
||||
|
||||
[[NSAppleEventManager sharedAppleEventManager] setEventHandler:self andSelector:@selector(handleURLEvent:withReplyEvent:) forEventClass:kInternetEventClass andEventID:kAEGetURL];
|
||||
|
||||
key_tap_ = [ [SPMediaKeyTap alloc] initWithDelegate:self];
|
||||
if ([SPMediaKeyTap usesGlobalMediaKeyTap]) {
|
||||
if ([key_tap_ startWatchingMediaKeys]) {
|
||||
@ -187,6 +190,13 @@ QDebug operator<<(QDebug dbg, NSObject* object) {
|
||||
|
||||
}
|
||||
|
||||
- (void)handleURLEvent:(NSAppleEventDescriptor*)theEvent withReplyEvent:(NSAppleEventDescriptor*)replyEvent {
|
||||
|
||||
NSString *url = [[theEvent paramDescriptorForKeyword:keyDirectObject] stringValue];
|
||||
application_handler_->LoadUrl(QString::fromNSString(url));
|
||||
|
||||
}
|
||||
|
||||
- (void) mediaKeyTap: (SPMediaKeyTap*)keyTap receivedMediaKeyEvent:(NSEvent*)event {
|
||||
#pragma unused(keyTap)
|
||||
[self handleMediaEvent:event];
|
||||
|
@ -2391,13 +2391,23 @@ void MainWindow::Activate() {
|
||||
|
||||
bool MainWindow::LoadUrl(const QString &url) {
|
||||
|
||||
if (!QFile::exists(url)) return false;
|
||||
if (QFile::exists(url)) {
|
||||
MimeData *mimedata = new MimeData;
|
||||
mimedata->setUrls(QList<QUrl>() << QUrl::fromLocalFile(url));
|
||||
AddToPlaylist(mimedata);
|
||||
return true;
|
||||
}
|
||||
#ifdef HAVE_TIDAL
|
||||
else if (url.startsWith("tidal://login")) {
|
||||
emit AuthorizationUrlReceived(QUrl(url));
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
qLog(Error) << "Can't open" << url;
|
||||
}
|
||||
|
||||
MimeData *mimedata = new MimeData;
|
||||
mimedata->setUrls(QList<QUrl>() << QUrl::fromLocalFile(url));
|
||||
AddToPlaylist(mimedata);
|
||||
|
||||
return true;
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user