-
Notifications
You must be signed in to change notification settings - Fork 63
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
Fixes #251: segfault (stopClient) and showing error (not active window) #252
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -198,18 +198,17 @@ void SpotifyClient::Runner::logOutput(const QByteArray &output, lib::log_type lo | |
|
||
log.emplace_back(lib::date_time::now(), logType, line.toStdString()); | ||
|
||
#ifdef USE_KEYCHAIN | ||
if (line.contains(QStringLiteral("Bad credentials"))) | ||
{ | ||
#ifdef USE_KEYCHAIN | ||
const auto username = QString::fromStdString(settings.spotify.username); | ||
if (Keychain::clearPassword(username)) | ||
{ | ||
lib::log::warn("Bad credentials, cleared saved password"); | ||
} | ||
|
||
#endif | ||
emit statusChanged(QStringLiteral("Bad credentials, please try again")); | ||
} | ||
#endif | ||
} | ||
} | ||
|
||
|
@@ -243,7 +242,29 @@ void SpotifyClient::Runner::onStarted() | |
|
||
void SpotifyClient::Runner::onErrorOccurred(QProcess::ProcessError error) | ||
{ | ||
emit statusChanged(QString("Error %1").arg(error)); | ||
std::string_view message; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please note that this is still primarily a C++11 project, so |
||
switch (error) | ||
{ | ||
case QProcess::FailedToStart: | ||
message = "Process failed to start"; | ||
break; | ||
case QProcess::Crashed: | ||
message = "Process stopped or crashed"; | ||
break; | ||
case QProcess::Timedout: | ||
message = "Process timed out"; | ||
break; | ||
case QProcess::WriteError: | ||
message = "Process with write error"; | ||
break; | ||
case QProcess::ReadError: | ||
message = "Process with read error"; | ||
break; | ||
default: | ||
message = "Process with unknown error"; | ||
break; | ||
} | ||
emit statusChanged(QString::fromUtf8(message.data(), message.size())); | ||
} | ||
|
||
auto SpotifyClient::Runner::getLog() -> const std::vector<lib::log_message> & | ||
|
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 think the main point of this was to not grab attention when the window is minimized. Maybe
StatusMessage::error()
is better when the window isn't active? That way, you have to actively open the window to see if anything went wrong.