mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
(Qt) Remove some if 0 code blocks
This commit is contained in:
parent
c10dfca92c
commit
f8043f847e
@ -37,11 +37,11 @@ extern "C" {
|
||||
#define THUMBNAIL_URL_HEADER "https://thumbnails.libretro.com/"
|
||||
#define THUMBNAIL_IMAGE_EXTENSION ".png"
|
||||
|
||||
static void extractThumbnailPackCB(retro_task_t *task,
|
||||
static void cb_extract_thumbnail_pack(retro_task_t *task,
|
||||
void *task_data, void *user_data, const char *err)
|
||||
{
|
||||
decompress_task_data_t *dec = (decompress_task_data_t*)task_data;
|
||||
MainWindow *mainwindow = (MainWindow*)user_data;
|
||||
MainWindow *mainwindow = (MainWindow*)user_data;
|
||||
|
||||
if (err)
|
||||
RARCH_ERR("%s", err);
|
||||
@ -70,9 +70,10 @@ void MainWindow::onThumbnailPackDownloadNetworkError(QNetworkReply::NetworkError
|
||||
return;
|
||||
|
||||
errorStringArray = reply->errorString().toUtf8();
|
||||
errorStringData = errorStringArray.constData();
|
||||
errorStringData = errorStringArray.constData();
|
||||
|
||||
RARCH_ERR("[Qt]: Network error code %d received: %s\n", code, errorStringData);
|
||||
RARCH_ERR("[Qt]: Network error code %d received: %s\n",
|
||||
code, errorStringData);
|
||||
|
||||
#if 0
|
||||
/* Deleting the reply here seems to cause a strange
|
||||
@ -104,7 +105,7 @@ void MainWindow::onThumbnailPackDownloadNetworkSslErrors(const QList<QSslError>
|
||||
RARCH_ERR("[Qt]: %s\n", stringData);
|
||||
}
|
||||
|
||||
/* ignore all SSL errors for now, like self-signed, expired etc. */
|
||||
/* Ignore all SSL errors for now, like self-signed, expired etc. */
|
||||
reply->ignoreSslErrors();
|
||||
}
|
||||
|
||||
@ -191,7 +192,7 @@ void MainWindow::onThumbnailPackDownloadFinished()
|
||||
if (settings)
|
||||
{
|
||||
RARCH_LOG("[Qt]: Thumbnail pack download finished successfully.\n");
|
||||
emit extractArchiveDeferred(newFileName, settings->paths.directory_thumbnails, TEMP_EXTENSION, extractThumbnailPackCB);
|
||||
emit extractArchiveDeferred(newFileName, settings->paths.directory_thumbnails, TEMP_EXTENSION, cb_extract_thumbnail_pack);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -231,10 +232,8 @@ void MainWindow::onThumbnailPackDownloadReadyRead()
|
||||
{
|
||||
QNetworkReply *reply = m_thumbnailPackDownloadReply.data();
|
||||
|
||||
if (!reply)
|
||||
return;
|
||||
|
||||
m_thumbnailPackDownloadFile.write(reply->readAll());
|
||||
if (reply)
|
||||
m_thumbnailPackDownloadFile.write(reply->readAll());
|
||||
}
|
||||
|
||||
void MainWindow::downloadAllThumbnails(QString system, QUrl url)
|
||||
@ -314,7 +313,7 @@ void MainWindow::downloadAllThumbnails(QString system, QUrl url)
|
||||
reply = m_thumbnailPackDownloadReply.data();
|
||||
reply->setProperty("system", system);
|
||||
|
||||
/* make sure any previous connection is removed first */
|
||||
/* Make sure any previous connection is removed first */
|
||||
disconnect(m_thumbnailPackDownloadProgressDialog, SIGNAL(canceled()), reply, SLOT(abort()));
|
||||
connect(m_thumbnailPackDownloadProgressDialog, SIGNAL(canceled()), reply, SLOT(abort()));
|
||||
|
||||
@ -353,7 +352,7 @@ void MainWindow::onThumbnailPackExtractFinished(bool success)
|
||||
void MainWindow::onThumbnailDownloadNetworkError(QNetworkReply::NetworkError code)
|
||||
{
|
||||
QByteArray errorStringArray;
|
||||
QNetworkReply *reply = m_thumbnailDownloadReply.data();
|
||||
QNetworkReply *reply = m_thumbnailDownloadReply.data();
|
||||
const char *errorStringData = NULL;
|
||||
|
||||
m_thumbnailDownloadProgressDialog->cancel();
|
||||
@ -362,18 +361,18 @@ void MainWindow::onThumbnailDownloadNetworkError(QNetworkReply::NetworkError cod
|
||||
return;
|
||||
|
||||
errorStringArray = reply->errorString().toUtf8();
|
||||
errorStringData = errorStringArray.constData();
|
||||
errorStringData = errorStringArray.constData();
|
||||
|
||||
RARCH_ERR("[Qt]: Network error code %d received: %s\n",
|
||||
code, errorStringData);
|
||||
|
||||
#if 0
|
||||
/* Deleting the reply here seems to cause a strange
|
||||
* heap-use-after-free crash. */
|
||||
/*
|
||||
reply->disconnect();
|
||||
reply->abort();
|
||||
reply->deleteLater();
|
||||
*/
|
||||
#endif
|
||||
}
|
||||
|
||||
void MainWindow::onThumbnailDownloadNetworkSslErrors(
|
||||
@ -398,7 +397,7 @@ void MainWindow::onThumbnailDownloadNetworkSslErrors(
|
||||
RARCH_ERR("[Qt]: %s\n", stringData);
|
||||
}
|
||||
|
||||
/* ignore all SSL errors for now, like self-signed, expired etc. */
|
||||
/* Ignore all SSL errors for now, like self-signed, expired etc. */
|
||||
reply->ignoreSslErrors();
|
||||
}
|
||||
|
||||
@ -463,9 +462,6 @@ void MainWindow::onThumbnailDownloadFinished()
|
||||
return;
|
||||
}
|
||||
|
||||
#if 0
|
||||
emit showErrorMessageDeferred(QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_NETWORK_ERROR)) + ": HTTP Code " + QString::number(code));
|
||||
#endif
|
||||
m_thumbnailDownloadFile.remove();
|
||||
|
||||
RARCH_ERR("[Qt]: Thumbnail download failed with HTTP status code: %d\n", code);
|
||||
@ -552,10 +548,8 @@ void MainWindow::onThumbnailDownloadReadyRead()
|
||||
{
|
||||
QNetworkReply *reply = m_thumbnailDownloadReply.data();
|
||||
|
||||
if (!reply)
|
||||
return;
|
||||
|
||||
m_thumbnailDownloadFile.write(reply->readAll());
|
||||
if (reply)
|
||||
m_thumbnailDownloadFile.write(reply->readAll());
|
||||
}
|
||||
|
||||
void MainWindow::downloadThumbnail(QString system, QString title, QUrl url)
|
||||
@ -653,7 +647,7 @@ void MainWindow::downloadThumbnail(QString system, QString title, QUrl url)
|
||||
reply->setProperty("title", title);
|
||||
reply->setProperty("download_type", downloadType);
|
||||
|
||||
/* make sure any previous connection is removed first */
|
||||
/* Make sure any previous connection is removed first */
|
||||
disconnect(m_thumbnailDownloadProgressDialog, SIGNAL(canceled()), reply, SLOT(abort()));
|
||||
connect(m_thumbnailDownloadProgressDialog, SIGNAL(canceled()), reply, SLOT(abort()));
|
||||
|
||||
@ -689,7 +683,7 @@ void MainWindow::onPlaylistThumbnailDownloadNetworkSslErrors(const QList<QSslErr
|
||||
RARCH_ERR("[Qt]: %s\n", stringData);
|
||||
}
|
||||
|
||||
/* ignore all SSL errors for now, like self-signed, expired etc. */
|
||||
/* Ignore all SSL errors for now, like self-signed, expired etc. */
|
||||
reply->ignoreSslErrors();
|
||||
}
|
||||
|
||||
@ -727,12 +721,6 @@ void MainWindow::onPlaylistThumbnailDownloadFinished()
|
||||
if (!redirectUrl.isEmpty())
|
||||
{
|
||||
QByteArray redirectUrlArray = redirectUrl.toString().toUtf8();
|
||||
#if 0
|
||||
const char *redirectUrlData = redirectUrlArray.constData();
|
||||
|
||||
RARCH_LOG("[Qt]: Thumbnail download got redirect with"
|
||||
" HTTP code %d: %s\n", code, redirectUrlData);
|
||||
#endif
|
||||
reply->disconnect();
|
||||
reply->abort();
|
||||
reply->deleteLater();
|
||||
@ -743,20 +731,7 @@ void MainWindow::onPlaylistThumbnailDownloadFinished()
|
||||
}
|
||||
|
||||
m_playlistThumbnailDownloadFile.remove();
|
||||
|
||||
m_failedThumbnails++;
|
||||
|
||||
#if 0
|
||||
emit showErrorMessageDeferred(QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_NETWORK_ERROR)) + ": HTTP Code " + QString::number(code));
|
||||
|
||||
RARCH_ERR("[Qt]: Thumbnail download failed with HTTP status code: %d\n", code);
|
||||
|
||||
reply->disconnect();
|
||||
reply->abort();
|
||||
reply->deleteLater();
|
||||
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (error == QNetworkReply::NoError)
|
||||
@ -777,30 +752,13 @@ void MainWindow::onPlaylistThumbnailDownloadFinished()
|
||||
if (m_playlistThumbnailDownloadFile.rename(newFileName))
|
||||
m_downloadedThumbnails++;
|
||||
else
|
||||
{
|
||||
#if 0
|
||||
RARCH_ERR("[Qt]: Thumbnail download finished, but temp file could not be renamed.\n");
|
||||
emit showErrorMessageDeferred(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_COULD_NOT_RENAME_FILE));
|
||||
#endif
|
||||
m_failedThumbnails++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#if 0
|
||||
QByteArray errorArray = reply->errorString().toUtf8();
|
||||
const char *errorData = errorArray.constData();
|
||||
#endif
|
||||
|
||||
m_playlistThumbnailDownloadFile.remove();
|
||||
|
||||
m_failedThumbnails++;
|
||||
|
||||
#if 0
|
||||
RARCH_ERR("[Qt]: Thumbnail download ended prematurely: %s\n", errorData);
|
||||
emit showErrorMessageDeferred(QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_NETWORK_ERROR)) + ": Code " + QString::number(code) + ": " + errorData);
|
||||
#endif
|
||||
}
|
||||
|
||||
m_playlistModel->reloadThumbnailPath(m_playlistThumbnailDownloadFile.fileName());
|
||||
@ -816,7 +774,7 @@ void MainWindow::onPlaylistThumbnailDownloadFinished()
|
||||
else
|
||||
{
|
||||
RARCH_LOG("[Qt]: Playlist thumbnails finished downloading.\n");
|
||||
/* update thumbnail */
|
||||
/* Update thumbnail */
|
||||
emit itemChanged();
|
||||
}
|
||||
|
||||
@ -827,23 +785,20 @@ void MainWindow::onPlaylistThumbnailDownloadFinished()
|
||||
|
||||
void MainWindow::onPlaylistThumbnailDownloadProgress(qint64 bytesReceived, qint64 bytesTotal)
|
||||
{
|
||||
QNetworkReply *reply = m_playlistThumbnailDownloadReply.data();
|
||||
#if 0
|
||||
QNetworkReply *reply = m_playlistThumbnailDownloadReply.data();
|
||||
int progress = (bytesReceived / (float)bytesTotal) * 100.0f;
|
||||
#endif
|
||||
|
||||
if (!reply)
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
void MainWindow::onPlaylistThumbnailDownloadReadyRead()
|
||||
{
|
||||
QNetworkReply *reply = m_playlistThumbnailDownloadReply.data();
|
||||
|
||||
if (!reply)
|
||||
return;
|
||||
|
||||
m_playlistThumbnailDownloadFile.write(reply->readAll());
|
||||
if (reply)
|
||||
m_playlistThumbnailDownloadFile.write(reply->readAll());
|
||||
}
|
||||
|
||||
void MainWindow::downloadNextPlaylistThumbnail(
|
||||
@ -909,11 +864,6 @@ void MainWindow::downloadNextPlaylistThumbnail(
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
RARCH_LOG("[Qt]: Starting thumbnail download...\n");
|
||||
RARCH_LOG("[Qt]: Downloading URL %s\n", urlData);
|
||||
#endif
|
||||
|
||||
request.setHeader(QNetworkRequest::UserAgentHeader, USER_AGENT);
|
||||
|
||||
m_playlistThumbnailDownloadReply = m_networkManager->get(request);
|
||||
@ -923,7 +873,7 @@ void MainWindow::downloadNextPlaylistThumbnail(
|
||||
reply->setProperty("title", title);
|
||||
reply->setProperty("type", type);
|
||||
|
||||
/* make sure any previous connection is removed first */
|
||||
/* Make sure any previous connection is removed first */
|
||||
disconnect(m_playlistThumbnailDownloadProgressDialog, SIGNAL(canceled()), reply, SLOT(abort()));
|
||||
connect(m_playlistThumbnailDownloadProgressDialog, SIGNAL(canceled()), reply, SLOT(abort()));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user