mirror of
https://github.com/libretro/RetroArch
synced 2025-03-01 16:13:40 +00:00
(Qt) Style nits
This commit is contained in:
parent
80763e0376
commit
49539dbef4
@ -156,7 +156,7 @@ void MainWindow::onFileDropWidgetContextMenuRequested(const QPoint &pos)
|
||||
{
|
||||
QHash<QString, QString> hash = getCurrentContentHash();
|
||||
QString system = QFileInfo(getCurrentPlaylistPath()).completeBaseName();
|
||||
QString title = hash.value("label");
|
||||
QString title = hash.value("label");
|
||||
|
||||
if (!title.isEmpty())
|
||||
{
|
||||
|
@ -40,8 +40,8 @@ void ThumbnailDelegate::paint(QPainter* painter, const QStyleOptionViewItem &opt
|
||||
if (!opt.text.isEmpty())
|
||||
{
|
||||
QPalette::ColorGroup cg = opt.state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled;
|
||||
QRect textRect = QRect(rect.x() + padding, rect.y() + adjusted.height() - text_top_margin + padding, rect.width() - 2 * padding, text_height);
|
||||
QString elidedText = painter->fontMetrics().elidedText(opt.text, opt.textElideMode, textRect.width(), Qt::TextShowMnemonic);
|
||||
QRect textRect = QRect(rect.x() + padding, rect.y() + adjusted.height() - text_top_margin + padding, rect.width() - 2 * padding, text_height);
|
||||
QString elidedText = painter->fontMetrics().elidedText(opt.text, opt.textElideMode, textRect.width(), Qt::TextShowMnemonic);
|
||||
|
||||
if (cg == QPalette::Normal && !(opt.state & QStyle::State_Active))
|
||||
cg = QPalette::Inactive;
|
||||
@ -84,13 +84,13 @@ void GridView::setviewMode(ViewMode mode)
|
||||
|
||||
void GridView::calculateRectsIfNecessary() const
|
||||
{
|
||||
int row;
|
||||
int nextX;
|
||||
int x, y;
|
||||
int row, nextX;
|
||||
if (!m_hashIsDirty)
|
||||
return;
|
||||
|
||||
int x = m_spacing;
|
||||
int y = m_spacing;
|
||||
x = m_spacing;
|
||||
y = m_spacing;
|
||||
const int maxWidth = viewport()->width();
|
||||
|
||||
if (m_size + m_spacing * 2 > maxWidth)
|
||||
@ -99,8 +99,8 @@ void GridView::calculateRectsIfNecessary() const
|
||||
|
||||
for (row = 1; row < model()->rowCount(); ++row)
|
||||
{
|
||||
y += m_size + m_spacing;
|
||||
m_rectForRow[row] = QRectF(x, y, m_size, m_size);
|
||||
y += m_size + m_spacing;
|
||||
m_rectForRow[row] = QRectF(x, y, m_size, m_size);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -323,13 +323,15 @@ void GridView::setSelection(const QRect &rect, QFlags<QItemSelectionModel::Selec
|
||||
QRect rectangle;
|
||||
QHash<int, QRectF>::const_iterator i;
|
||||
int firstRow = model()->rowCount();
|
||||
int lastRow = -1;
|
||||
int lastRow = -1;
|
||||
|
||||
calculateRectsIfNecessary();
|
||||
|
||||
rectangle = rect.translated(horizontalScrollBar()->value(), verticalScrollBar()->value()).normalized();
|
||||
rectangle = rect.translated(horizontalScrollBar()->value(),
|
||||
verticalScrollBar()->value()).normalized();
|
||||
|
||||
i = m_rectForRow.constBegin();
|
||||
|
||||
i = m_rectForRow.constBegin();
|
||||
while (i != m_rectForRow.constEnd())
|
||||
{
|
||||
if (i.value().intersects(rectangle))
|
||||
@ -341,7 +343,9 @@ void GridView::setSelection(const QRect &rect, QFlags<QItemSelectionModel::Selec
|
||||
}
|
||||
if (firstRow != model()->rowCount() && lastRow != -1)
|
||||
{
|
||||
QItemSelection selection(model()->index(firstRow, 0, rootIndex()), model()->index(lastRow, 0, rootIndex()));
|
||||
QItemSelection selection(model()->index(
|
||||
firstRow, 0, rootIndex()),
|
||||
model()->index(lastRow, 0, rootIndex()));
|
||||
selectionModel()->select(selection, flags);
|
||||
}
|
||||
else
|
||||
@ -354,9 +358,9 @@ void GridView::setSelection(const QRect &rect, QFlags<QItemSelectionModel::Selec
|
||||
|
||||
QRegion GridView::visualRegionForSelection(const QItemSelection &selection) const
|
||||
{
|
||||
int i;
|
||||
QRegion region;
|
||||
QItemSelectionRange range;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < selection.size(); i++)
|
||||
{
|
||||
|
@ -46,13 +46,13 @@ PlaylistEntryDialog::PlaylistEntryDialog(MainWindow *mainwindow, QWidget *parent
|
||||
,m_databaseComboBox(new QComboBox(this))
|
||||
,m_extensionArchiveCheckBox(new QCheckBox(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_FILTER_INSIDE_ARCHIVES), this))
|
||||
{
|
||||
QFormLayout *form = new QFormLayout();
|
||||
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||
QVBoxLayout *databaseVBoxLayout = new QVBoxLayout();
|
||||
QHBoxLayout *pathHBoxLayout = new QHBoxLayout();
|
||||
QFormLayout *form = new QFormLayout();
|
||||
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||
QVBoxLayout *databaseVBoxLayout = new QVBoxLayout();
|
||||
QHBoxLayout *pathHBoxLayout = new QHBoxLayout();
|
||||
QHBoxLayout *extensionHBoxLayout = new QHBoxLayout();
|
||||
QLabel *databaseLabel = new QLabel(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_FOR_THUMBNAILS), this);
|
||||
QToolButton *pathPushButton = new QToolButton(this);
|
||||
QLabel *databaseLabel = new QLabel(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_FOR_THUMBNAILS), this);
|
||||
QToolButton *pathPushButton = new QToolButton(this);
|
||||
|
||||
pathPushButton->setText(QStringLiteral("..."));
|
||||
|
||||
@ -121,8 +121,13 @@ void PlaylistEntryDialog::loadPlaylistOptions()
|
||||
m_coreComboBox->clear();
|
||||
m_databaseComboBox->clear();
|
||||
|
||||
m_coreComboBox->addItem(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_CORE_SELECTION_ASK));
|
||||
m_databaseComboBox->addItem(QString("<") + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE) + ">", QFileInfo(m_mainwindow->getCurrentPlaylistPath()).fileName().remove(".lpl"));
|
||||
m_coreComboBox->addItem(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_CORE_SELECTION_ASK));
|
||||
m_databaseComboBox->addItem(
|
||||
QString("<")
|
||||
+ msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE)
|
||||
+ ">",
|
||||
QFileInfo(m_mainwindow->getCurrentPlaylistPath()).fileName().remove(".lpl"));
|
||||
|
||||
core_info_get_list(&core_info_list);
|
||||
|
||||
@ -206,17 +211,19 @@ void PlaylistEntryDialog::setEntryValues(
|
||||
|
||||
if (contentHash.isEmpty())
|
||||
{
|
||||
m_nameLineEdit->setText(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_FIELD_MULTIPLE));
|
||||
m_pathLineEdit->setText(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_FIELD_MULTIPLE));
|
||||
m_nameLineEdit->setText(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_FIELD_MULTIPLE));
|
||||
m_pathLineEdit->setText(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_FIELD_MULTIPLE));
|
||||
m_nameLineEdit->setEnabled(false);
|
||||
m_pathLineEdit->setEnabled(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_nameLineEdit->setEnabled(true);
|
||||
m_pathLineEdit->setEnabled(true);
|
||||
m_nameLineEdit->setText(contentHash.value("label"));
|
||||
m_pathLineEdit->setText(contentHash.value("path"));
|
||||
m_nameLineEdit->setEnabled(true);
|
||||
m_pathLineEdit->setEnabled(true);
|
||||
}
|
||||
|
||||
for (i = 0; i < m_coreComboBox->count(); i++)
|
||||
@ -291,7 +298,6 @@ bool PlaylistEntryDialog::showDialog(const QHash<QString, QString> &hash)
|
||||
|
||||
if (exec() == QDialog::Accepted)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,11 @@ void MainWindow::onPlaylistThumbnailDownloadNetworkSslErrors(const QList<QSslErr
|
||||
for (i = 0; i < errors.count(); i++)
|
||||
{
|
||||
const QSslError &error = errors.at(i);
|
||||
QString string = QString("Ignoring SSL error code ") + QString::number(error.error()) + ": " + error.errorString();
|
||||
QString string =
|
||||
QString("Ignoring SSL error code ")
|
||||
+ QString::number(error.error())
|
||||
+ ": "
|
||||
+ error.errorString();
|
||||
QByteArray stringArray = string.toUtf8();
|
||||
const char *stringData = stringArray.constData();
|
||||
RARCH_ERR("[Qt]: %s\n", stringData);
|
||||
@ -62,25 +66,27 @@ void MainWindow::onPlaylistThumbnailDownloadCanceled()
|
||||
|
||||
void MainWindow::onPlaylistThumbnailDownloadFinished()
|
||||
{
|
||||
QString playlistPath;
|
||||
QNetworkReply *reply = m_playlistThumbnailDownloadReply.data();
|
||||
QNetworkReply::NetworkError error;
|
||||
int code;
|
||||
QString playlistPath;
|
||||
QNetworkReply::NetworkError error;
|
||||
QNetworkReply *reply = m_playlistThumbnailDownloadReply.data();
|
||||
|
||||
if (!reply)
|
||||
return;
|
||||
|
||||
playlistPath = reply->property("playlist").toString();
|
||||
playlistPath = reply->property("playlist").toString();
|
||||
|
||||
error = reply->error();
|
||||
code = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
||||
error = reply->error();
|
||||
code = reply->attribute(
|
||||
QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
||||
|
||||
if (m_playlistThumbnailDownloadFile.isOpen())
|
||||
m_playlistThumbnailDownloadFile.close();
|
||||
|
||||
if (code != 200)
|
||||
{
|
||||
QUrl redirectUrl = reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
|
||||
QUrl redirectUrl = reply->attribute(
|
||||
QNetworkRequest::RedirectionTargetAttribute).toUrl();
|
||||
|
||||
if (!redirectUrl.isEmpty())
|
||||
{
|
||||
@ -88,7 +94,8 @@ void MainWindow::onPlaylistThumbnailDownloadFinished()
|
||||
#if 0
|
||||
const char *redirectUrlData = redirectUrlArray.constData();
|
||||
|
||||
/*RARCH_LOG("[Qt]: Thumbnail download got redirect with HTTP code %d: %s\n", code, redirectUrlData);*/
|
||||
RARCH_LOG("[Qt]: Thumbnail download got redirect with"
|
||||
" HTTP code %d: %s\n", code, redirectUrlData);
|
||||
#endif
|
||||
reply->disconnect();
|
||||
reply->abort();
|
||||
@ -98,22 +105,22 @@ void MainWindow::onPlaylistThumbnailDownloadFinished()
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_playlistThumbnailDownloadFile.remove();
|
||||
|
||||
m_failedThumbnails++;
|
||||
m_playlistThumbnailDownloadFile.remove();
|
||||
|
||||
/*emit showErrorMessageDeferred(QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_NETWORK_ERROR)) + ": HTTP Code " + QString::number(code));
|
||||
m_failedThumbnails++;
|
||||
|
||||
RARCH_ERR("[Qt]: Thumbnail download failed with HTTP status code: %d\n", code);
|
||||
#if 0
|
||||
emit showErrorMessageDeferred(QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_NETWORK_ERROR)) + ": HTTP Code " + QString::number(code));
|
||||
|
||||
reply->disconnect();
|
||||
reply->abort();
|
||||
reply->deleteLater();
|
||||
RARCH_ERR("[Qt]: Thumbnail download failed with HTTP status code: %d\n", code);
|
||||
|
||||
return;*/
|
||||
}
|
||||
reply->disconnect();
|
||||
reply->abort();
|
||||
reply->deleteLater();
|
||||
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (error == QNetworkReply::NoError)
|
||||
@ -130,30 +137,34 @@ void MainWindow::onPlaylistThumbnailDownloadFinished()
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Thumbnail download finished succesfully? */
|
||||
if (m_playlistThumbnailDownloadFile.rename(newFileName))
|
||||
{
|
||||
/*RARCH_LOG("[Qt]: Thumbnail download finished successfully.\n");*/
|
||||
m_downloadedThumbnails++;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*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));*/
|
||||
#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
|
||||
{
|
||||
/*QByteArray errorArray = reply->errorString().toUtf8();
|
||||
const char *errorData = errorArray.constData();*/
|
||||
#if 0
|
||||
QByteArray errorArray = reply->errorString().toUtf8();
|
||||
const char *errorData = errorArray.constData();
|
||||
#endif
|
||||
|
||||
m_playlistThumbnailDownloadFile.remove();
|
||||
|
||||
m_failedThumbnails++;
|
||||
|
||||
/*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);*/
|
||||
#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());
|
||||
@ -182,7 +193,7 @@ void MainWindow::onPlaylistThumbnailDownloadProgress(qint64 bytesReceived, qint6
|
||||
{
|
||||
QNetworkReply *reply = m_playlistThumbnailDownloadReply.data();
|
||||
#if 0
|
||||
int progress = (bytesReceived / (float)bytesTotal) * 100.0f;
|
||||
int progress = (bytesReceived / (float)bytesTotal) * 100.0f;
|
||||
#endif
|
||||
|
||||
if (!reply)
|
||||
@ -199,24 +210,32 @@ void MainWindow::onPlaylistThumbnailDownloadReadyRead()
|
||||
m_playlistThumbnailDownloadFile.write(reply->readAll());
|
||||
}
|
||||
|
||||
void MainWindow::downloadNextPlaylistThumbnail(QString system, QString title, QString type, QUrl url)
|
||||
void MainWindow::downloadNextPlaylistThumbnail(
|
||||
QString system, QString title, QString type, QUrl url)
|
||||
{
|
||||
QString systemUnderscore = system;
|
||||
QString urlString;
|
||||
QNetworkReply *reply = NULL;
|
||||
QNetworkRequest request;
|
||||
QNetworkReply *reply = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!settings)
|
||||
return;
|
||||
|
||||
title = getScrubbedString(title);
|
||||
systemUnderscore = systemUnderscore.replace(" ", "_");
|
||||
title = getScrubbedString(title);
|
||||
systemUnderscore = systemUnderscore.replace(" ", "_");
|
||||
|
||||
urlString = QString(THUMBNAIL_URL_HEADER) + systemUnderscore + THUMBNAIL_URL_BRANCH + type + "/" + title + THUMBNAIL_URL_FOOTER;
|
||||
urlString =
|
||||
QString(THUMBNAIL_URL_HEADER)
|
||||
+ systemUnderscore
|
||||
+ THUMBNAIL_URL_BRANCH
|
||||
+ type
|
||||
+ "/"
|
||||
+ title
|
||||
+ THUMBNAIL_URL_FOOTER;
|
||||
|
||||
if (url.isEmpty())
|
||||
url = urlString;
|
||||
url = urlString;
|
||||
|
||||
request.setUrl(url);
|
||||
|
||||
@ -257,8 +276,10 @@ void MainWindow::downloadNextPlaylistThumbnail(QString system, QString title, QS
|
||||
}
|
||||
}
|
||||
|
||||
/*RARCH_LOG("[Qt]: Starting thumbnail download...\n");
|
||||
RARCH_LOG("[Qt]: Downloading URL %s\n", urlData);*/
|
||||
#if 0
|
||||
RARCH_LOG("[Qt]: Starting thumbnail download...\n");
|
||||
RARCH_LOG("[Qt]: Downloading URL %s\n", urlData);
|
||||
#endif
|
||||
|
||||
request.setHeader(QNetworkRequest::UserAgentHeader, USER_AGENT);
|
||||
|
||||
@ -292,11 +313,10 @@ void MainWindow::downloadNextPlaylistThumbnail(QString system, QString title, QS
|
||||
|
||||
void MainWindow::downloadPlaylistThumbnails(QString playlistPath)
|
||||
{
|
||||
QFile playlistFile(playlistPath);
|
||||
int i, count;
|
||||
QString system, title, type;
|
||||
QFile playlistFile(playlistPath);
|
||||
settings_t *settings = config_get_ptr();
|
||||
int i;
|
||||
int count;
|
||||
|
||||
if (!settings || !playlistFile.exists())
|
||||
return;
|
||||
@ -313,10 +333,10 @@ void MainWindow::downloadPlaylistThumbnails(QString playlistPath)
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
const QHash<QString, QString> &itemHash = m_playlistModel->index(i, 0).data(PlaylistModel::HASH).value< QHash<QString, QString> >();
|
||||
QHash<QString, QString> hash;
|
||||
QHash<QString, QString> hash2;
|
||||
QHash<QString, QString> hash3;
|
||||
const QHash<QString, QString> &itemHash = m_playlistModel->index(i, 0).data(PlaylistModel::HASH).value< QHash<QString, QString> >();
|
||||
|
||||
hash["db_name"] = itemHash.value("db_name");
|
||||
hash["label_noext"] = itemHash.value("label_noext");
|
||||
@ -346,7 +366,8 @@ void MainWindow::downloadPlaylistThumbnails(QString playlistPath)
|
||||
{
|
||||
QHash<QString, QString> firstThumbnail = m_pendingPlaylistThumbnails.takeAt(0);
|
||||
|
||||
/* Start downloading the first thumbnail, the rest will download as each one finishes. */
|
||||
/* Start downloading the first thumbnail,
|
||||
* the rest will download as each one finishes. */
|
||||
downloadNextPlaylistThumbnail(firstThumbnail.value("db_name"), firstThumbnail.value("label_noext"), firstThumbnail.value("type"));
|
||||
}
|
||||
}
|
||||
|
@ -1314,7 +1314,6 @@ bool MainWindow::currentPlaylistIsSpecial()
|
||||
QFileInfo currentPlaylistFileInfo;
|
||||
QString currentPlaylistPath;
|
||||
QString currentPlaylistDirPath;
|
||||
bool specialPlaylist = false;
|
||||
settings_t *settings = config_get_ptr();
|
||||
QDir playlistDir(settings->paths.directory_playlist);
|
||||
QString playlistDirAbsPath = playlistDir.absolutePath();
|
||||
@ -1330,24 +1329,20 @@ bool MainWindow::currentPlaylistIsSpecial()
|
||||
/* Don't just compare strings in case there are
|
||||
* case differences on Windows that should be ignored. */
|
||||
if (QDir(currentPlaylistDirPath) != QDir(playlistDirAbsPath))
|
||||
specialPlaylist = true;
|
||||
|
||||
return specialPlaylist;
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MainWindow::currentPlaylistIsAll()
|
||||
{
|
||||
QListWidgetItem *currentPlaylistItem = m_listWidget->currentItem();
|
||||
bool all = false;
|
||||
|
||||
if (!currentPlaylistItem)
|
||||
return false;
|
||||
|
||||
if (currentPlaylistItem->data(Qt::UserRole).toString()
|
||||
== ALL_PLAYLISTS_TOKEN)
|
||||
all = true;
|
||||
return true;
|
||||
|
||||
return all;
|
||||
return false;
|
||||
}
|
||||
|
||||
void MainWindow::deleteCurrentPlaylistItem()
|
||||
@ -1472,11 +1467,11 @@ void PlaylistModel::getPlaylistItems(QString path)
|
||||
{
|
||||
QByteArray pathArray;
|
||||
playlist_config_t playlist_config;
|
||||
const char *pathData = NULL;
|
||||
playlist_t *playlist = NULL;
|
||||
unsigned playlistSize = 0;
|
||||
unsigned i = 0;
|
||||
settings_t *settings = config_get_ptr();
|
||||
const char *pathData = NULL;
|
||||
playlist_t *playlist = NULL;
|
||||
unsigned playlistSize = 0;
|
||||
unsigned i = 0;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
playlist_config.capacity = COLLECTION_SIZE;
|
||||
playlist_config.old_format = settings->bools.playlist_use_old_format;
|
||||
@ -1500,8 +1495,8 @@ void PlaylistModel::getPlaylistItems(QString path)
|
||||
if (string_is_empty(entry->path))
|
||||
continue;
|
||||
|
||||
hash["path"] = entry->path;
|
||||
hash["index"] = QString::number(i);
|
||||
hash["path"] = entry->path;
|
||||
hash["index"] = QString::number(i);
|
||||
|
||||
if (string_is_empty(entry->label))
|
||||
{
|
||||
@ -1515,17 +1510,17 @@ void PlaylistModel::getPlaylistItems(QString path)
|
||||
}
|
||||
|
||||
if (!string_is_empty(entry->core_path))
|
||||
hash["core_path"] = entry->core_path;
|
||||
hash["core_path"] = entry->core_path;
|
||||
|
||||
if (!string_is_empty(entry->core_name))
|
||||
hash["core_name"] = entry->core_name;
|
||||
hash["core_name"] = entry->core_name;
|
||||
|
||||
if (!string_is_empty(entry->crc32))
|
||||
hash["crc32"] = entry->crc32;
|
||||
hash["crc32"] = entry->crc32;
|
||||
|
||||
if (!string_is_empty(entry->db_name))
|
||||
{
|
||||
hash["db_name"] = entry->db_name;
|
||||
hash["db_name"] = entry->db_name;
|
||||
hash["db_name"].remove(".lpl");
|
||||
}
|
||||
|
||||
@ -1574,7 +1569,7 @@ void PlaylistModel::addDir(QString path, QFlags<QDir::Filter> showHidden)
|
||||
for (i = 0; i < dirList.count(); i++)
|
||||
{
|
||||
QHash<QString, QString> hash;
|
||||
QString fileName = dirList.at(i);
|
||||
QString fileName = dirList.at(i);
|
||||
QString filePath(
|
||||
QDir::toNativeSeparators(dir.absoluteFilePath(fileName)));
|
||||
QFileInfo fileInfo(filePath);
|
||||
|
@ -331,19 +331,19 @@ void ShaderParamsDialog::onScaleComboBoxIndexChanged(int)
|
||||
|
||||
void ShaderParamsDialog::onShaderPassMoveDownClicked()
|
||||
{
|
||||
QToolButton *button = qobject_cast<QToolButton*>(sender());
|
||||
QVariant passVariant;
|
||||
struct video_shader *menu_shader = NULL;
|
||||
bool ok = false;
|
||||
struct video_shader *menu_shader = NULL;
|
||||
struct video_shader *video_shader = NULL;
|
||||
int pass = 0;
|
||||
bool ok = false;
|
||||
QToolButton *button = qobject_cast<QToolButton*>(sender());
|
||||
int pass = 0;
|
||||
|
||||
getShaders(&menu_shader, &video_shader);
|
||||
|
||||
if (!button)
|
||||
return;
|
||||
|
||||
passVariant = button->property("pass");
|
||||
passVariant = button->property("pass");
|
||||
|
||||
if (!passVariant.isValid())
|
||||
return;
|
||||
@ -497,7 +497,8 @@ void ShaderParamsDialog::onShaderLoadPresetClicked()
|
||||
|
||||
filter = "Shader Preset (";
|
||||
|
||||
/* NOTE: Maybe we should have a way to get a list of all shader types instead of hard-coding this? */
|
||||
/* NOTE: Maybe we should have a way to get a list
|
||||
* of all shader types instead of hard-coding this? */
|
||||
if (video_shader_is_supported(RARCH_SHADER_CG))
|
||||
filter += QLatin1Literal(" *") + ".cgp";
|
||||
|
||||
@ -507,8 +508,8 @@ void ShaderParamsDialog::onShaderLoadPresetClicked()
|
||||
if (video_shader_is_supported(RARCH_SHADER_SLANG))
|
||||
filter += QLatin1Literal(" *") + ".slangp";
|
||||
|
||||
filter += ")";
|
||||
path = QFileDialog::getOpenFileName(
|
||||
filter += ")";
|
||||
path = QFileDialog::getOpenFileName(
|
||||
this,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET),
|
||||
path_dir_video_shader,
|
||||
@ -517,9 +518,9 @@ void ShaderParamsDialog::onShaderLoadPresetClicked()
|
||||
if (path.isEmpty())
|
||||
return;
|
||||
|
||||
pathArray = path.toUtf8();
|
||||
pathData = pathArray.constData();
|
||||
type = video_shader_parse_type(pathData);
|
||||
pathArray = path.toUtf8();
|
||||
pathData = pathArray.constData();
|
||||
type = video_shader_parse_type(pathData);
|
||||
|
||||
menu_shader_manager_set_preset(menu_shader, type, pathData, true);
|
||||
}
|
||||
@ -627,7 +628,8 @@ void ShaderParamsDialog::onShaderAddPassClicked()
|
||||
struct video_shader_pass *shader_pass = NULL;
|
||||
const char *pathData = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
const char *path_dir_video_shader = settings->paths.directory_video_shader;
|
||||
const char *path_dir_video_shader =
|
||||
settings->paths.directory_video_shader;
|
||||
|
||||
getShaders(&menu_shader, &video_shader);
|
||||
|
||||
@ -636,7 +638,8 @@ void ShaderParamsDialog::onShaderAddPassClicked()
|
||||
|
||||
filter = "Shader (";
|
||||
|
||||
/* NOTE: Maybe we should have a way to get a list of all shader types instead of hard-coding this? */
|
||||
/* NOTE: Maybe we should have a way to get a list
|
||||
* of all shader types instead of hard-coding this? */
|
||||
if (video_shader_is_supported(RARCH_SHADER_CG))
|
||||
filter += QLatin1Literal(" *.cg");
|
||||
|
||||
@ -661,7 +664,7 @@ void ShaderParamsDialog::onShaderAddPassClicked()
|
||||
* of host platform. Have to convert to native separators,
|
||||
* or video_shader_resolve_parameters() will fail on
|
||||
* non-Linux platforms */
|
||||
path = QDir::toNativeSeparators(path);
|
||||
path = QDir::toNativeSeparators(path);
|
||||
|
||||
pathArray = path.toUtf8();
|
||||
pathData = pathArray.constData();
|
||||
@ -838,7 +841,7 @@ void ShaderParamsDialog::onShaderRemoveGamePresetClicked()
|
||||
|
||||
void ShaderParamsDialog::onShaderRemoveAllPassesClicked()
|
||||
{
|
||||
struct video_shader *menu_shader = NULL;
|
||||
struct video_shader *menu_shader = NULL;
|
||||
struct video_shader *video_shader = NULL;
|
||||
|
||||
getShaders(&menu_shader, &video_shader);
|
||||
@ -1114,28 +1117,30 @@ void ShaderParamsDialog::buildLayout()
|
||||
if (shaderBasename.isEmpty())
|
||||
continue;
|
||||
|
||||
hasPasses = true;
|
||||
hasPasses = true;
|
||||
|
||||
filterComboBox->setProperty("pass", i);
|
||||
scaleComboBox->setProperty("pass", i);
|
||||
|
||||
moveDownButton = new QToolButton(this);
|
||||
moveDownButton = new QToolButton(this);
|
||||
moveDownButton->setText("↓");
|
||||
moveDownButton->setProperty("pass", i);
|
||||
|
||||
moveUpButton = new QToolButton(this);
|
||||
moveUpButton = new QToolButton(this);
|
||||
moveUpButton->setText("↑");
|
||||
moveUpButton->setProperty("pass", i);
|
||||
|
||||
/* Can't move down if we're already at the bottom. */
|
||||
if (i < avail_shader->passes - 1)
|
||||
connect(moveDownButton, SIGNAL(clicked()), this, SLOT(onShaderPassMoveDownClicked()));
|
||||
connect(moveDownButton, SIGNAL(clicked()),
|
||||
this, SLOT(onShaderPassMoveDownClicked()));
|
||||
else
|
||||
moveDownButton->setDisabled(true);
|
||||
|
||||
/* Can't move up if we're already at the top. */
|
||||
if (i > 0)
|
||||
connect(moveUpButton, SIGNAL(clicked()), this, SLOT(onShaderPassMoveUpClicked()));
|
||||
connect(moveUpButton, SIGNAL(clicked()),
|
||||
this, SLOT(onShaderPassMoveUpClicked()));
|
||||
else
|
||||
moveUpButton->setDisabled(true);
|
||||
|
||||
@ -1238,18 +1243,18 @@ void ShaderParamsDialog::onParameterLabelContextMenuRequested(const QPoint&)
|
||||
if (!label)
|
||||
return;
|
||||
|
||||
paramVariant = label->property("parameter");
|
||||
paramVariant = label->property("parameter");
|
||||
|
||||
if (!paramVariant.isValid())
|
||||
return;
|
||||
|
||||
parameter = paramVariant.toString();
|
||||
parameter = paramVariant.toString();
|
||||
|
||||
resetParamAction.reset(new QAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_RESET_PARAMETER), 0));
|
||||
|
||||
actions.append(resetParamAction.data());
|
||||
|
||||
action = QMenu::exec(actions, QCursor::pos(), NULL, label);
|
||||
action = QMenu::exec(actions, QCursor::pos(), NULL, label);
|
||||
|
||||
if (!action)
|
||||
return;
|
||||
@ -1272,7 +1277,7 @@ void ShaderParamsDialog::onGroupBoxContextMenuRequested(const QPoint&)
|
||||
if (!groupBox)
|
||||
return;
|
||||
|
||||
passVariant = groupBox->property("pass");
|
||||
passVariant = groupBox->property("pass");
|
||||
|
||||
if (!passVariant.isValid())
|
||||
return;
|
||||
@ -1288,7 +1293,7 @@ void ShaderParamsDialog::onGroupBoxContextMenuRequested(const QPoint&)
|
||||
actions.append(resetPassAction.data());
|
||||
actions.append(resetAllPassesAction.data());
|
||||
|
||||
action = QMenu::exec(actions, QCursor::pos(), NULL, groupBox);
|
||||
action = QMenu::exec(actions, QCursor::pos(), NULL, groupBox);
|
||||
|
||||
if (!action)
|
||||
return;
|
||||
|
@ -31,8 +31,8 @@ extern "C" {
|
||||
|
||||
void MainWindow::onThumbnailDownloadNetworkError(QNetworkReply::NetworkError code)
|
||||
{
|
||||
QNetworkReply *reply = m_thumbnailDownloadReply.data();
|
||||
QByteArray errorStringArray;
|
||||
QNetworkReply *reply = m_thumbnailDownloadReply.data();
|
||||
const char *errorStringData = NULL;
|
||||
|
||||
m_thumbnailDownloadProgressDialog->cancel();
|
||||
@ -43,9 +43,11 @@ void MainWindow::onThumbnailDownloadNetworkError(QNetworkReply::NetworkError cod
|
||||
errorStringArray = reply->errorString().toUtf8();
|
||||
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);
|
||||
|
||||
/* Deleting the reply here seems to cause a strange heap-use-after-free crash. */
|
||||
/* Deleting the reply here seems to cause a strange
|
||||
* heap-use-after-free crash. */
|
||||
/*
|
||||
reply->disconnect();
|
||||
reply->abort();
|
||||
@ -53,7 +55,8 @@ void MainWindow::onThumbnailDownloadNetworkError(QNetworkReply::NetworkError cod
|
||||
*/
|
||||
}
|
||||
|
||||
void MainWindow::onThumbnailDownloadNetworkSslErrors(const QList<QSslError> &errors)
|
||||
void MainWindow::onThumbnailDownloadNetworkSslErrors(
|
||||
const QList<QSslError> &errors)
|
||||
{
|
||||
QNetworkReply *reply = m_thumbnailDownloadReply.data();
|
||||
int i;
|
||||
@ -64,7 +67,11 @@ void MainWindow::onThumbnailDownloadNetworkSslErrors(const QList<QSslError> &err
|
||||
for (i = 0; i < errors.count(); i++)
|
||||
{
|
||||
const QSslError &error = errors.at(i);
|
||||
QString string = QString("Ignoring SSL error code ") + QString::number(error.error()) + ": " + error.errorString();
|
||||
QString string =
|
||||
QString("Ignoring SSL error code ")
|
||||
+ QString::number(error.error())
|
||||
+ ": "
|
||||
+ error.errorString();
|
||||
QByteArray stringArray = string.toUtf8();
|
||||
const char *stringData = stringArray.constData();
|
||||
RARCH_ERR("[Qt]: %s\n", stringData);
|
||||
@ -81,34 +88,41 @@ void MainWindow::onThumbnailDownloadCanceled()
|
||||
|
||||
void MainWindow::onThumbnailDownloadFinished()
|
||||
{
|
||||
int code;
|
||||
QString system;
|
||||
QString title;
|
||||
QString downloadType;
|
||||
QNetworkReply *reply = m_thumbnailDownloadReply.data();
|
||||
QNetworkReply::NetworkError error;
|
||||
int code;
|
||||
QNetworkReply *reply = m_thumbnailDownloadReply.data();
|
||||
|
||||
m_thumbnailDownloadProgressDialog->cancel();
|
||||
|
||||
/* At least on Linux, the progress dialog will refuse to hide itself and will stay on screen in a corrupted way if we happen to show an error message in this function. processEvents() will sometimes fix it, other times not... seems random. */
|
||||
/* At least on Linux, the progress dialog will refuse
|
||||
* to hide itself and will stay on screen in a corrupted
|
||||
* way if we happen to show an error message in this
|
||||
* function. processEvents() will sometimes fix it,
|
||||
* other times not... seems random. */
|
||||
qApp->processEvents();
|
||||
|
||||
if (!reply)
|
||||
return;
|
||||
|
||||
system = reply->property("system").toString();
|
||||
title = reply->property("title").toString();
|
||||
system = reply->property("system").toString();
|
||||
title = reply->property("title").toString();
|
||||
downloadType = reply->property("download_type").toString();
|
||||
|
||||
error = reply->error();
|
||||
code = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
||||
error = reply->error();
|
||||
code = reply->attribute(
|
||||
QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
||||
|
||||
if (m_thumbnailDownloadFile.isOpen())
|
||||
m_thumbnailDownloadFile.close();
|
||||
|
||||
if (code != 200)
|
||||
{
|
||||
QUrl redirectUrl = reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
|
||||
QUrl redirectUrl =
|
||||
reply->attribute(
|
||||
QNetworkRequest::RedirectionTargetAttribute).toUrl();
|
||||
|
||||
if (!redirectUrl.isEmpty())
|
||||
{
|
||||
@ -127,27 +141,28 @@ void MainWindow::onThumbnailDownloadFinished()
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*emit showErrorMessageDeferred(QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_NETWORK_ERROR)) + ": HTTP Code " + QString::number(code));*/
|
||||
m_thumbnailDownloadFile.remove();
|
||||
|
||||
RARCH_ERR("[Qt]: Thumbnail download failed with HTTP status code: %d\n", code);
|
||||
#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();
|
||||
|
||||
reply->disconnect();
|
||||
reply->abort();
|
||||
reply->deleteLater();
|
||||
RARCH_ERR("[Qt]: Thumbnail download failed with HTTP status code: %d\n", code);
|
||||
|
||||
if (!m_pendingThumbnailDownloadTypes.isEmpty())
|
||||
downloadThumbnail(system, title);
|
||||
reply->disconnect();
|
||||
reply->abort();
|
||||
reply->deleteLater();
|
||||
|
||||
return;
|
||||
}
|
||||
if (!m_pendingThumbnailDownloadTypes.isEmpty())
|
||||
downloadThumbnail(system, title);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (error == QNetworkReply::NoError)
|
||||
{
|
||||
int index = m_thumbnailDownloadFile.fileName().lastIndexOf(PARTIAL_EXTENSION);
|
||||
int index = m_thumbnailDownloadFile.fileName().
|
||||
lastIndexOf(PARTIAL_EXTENSION);
|
||||
QString newFileName = m_thumbnailDownloadFile.fileName().left(index);
|
||||
QFile newFile(newFileName);
|
||||
|
||||
@ -179,7 +194,12 @@ void MainWindow::onThumbnailDownloadFinished()
|
||||
m_thumbnailDownloadFile.remove();
|
||||
|
||||
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);
|
||||
emit showErrorMessageDeferred(
|
||||
QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_NETWORK_ERROR))
|
||||
+ ": Code "
|
||||
+ QString::number(code)
|
||||
+ ": "
|
||||
+ errorData);
|
||||
}
|
||||
|
||||
reply->disconnect();
|
||||
@ -195,10 +215,11 @@ void MainWindow::onDownloadThumbnail(QString system, QString title)
|
||||
downloadThumbnail(system, title);
|
||||
}
|
||||
|
||||
void MainWindow::onThumbnailDownloadProgress(qint64 bytesReceived, qint64 bytesTotal)
|
||||
void MainWindow::onThumbnailDownloadProgress(
|
||||
qint64 bytesReceived, qint64 bytesTotal)
|
||||
{
|
||||
QNetworkReply *reply = m_thumbnailDownloadReply.data();
|
||||
int progress = (bytesReceived / (float)bytesTotal) * 100.0f;
|
||||
int progress = (bytesReceived / (float)bytesTotal) * 100.0f;
|
||||
|
||||
if (!reply)
|
||||
return;
|
||||
@ -224,8 +245,8 @@ void MainWindow::downloadThumbnail(QString system, QString title, QUrl url)
|
||||
QString downloadType;
|
||||
QString systemUnderscore = system;
|
||||
QNetworkReply *reply = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
const char *urlData = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!settings || m_pendingThumbnailDownloadTypes.isEmpty())
|
||||
return;
|
||||
|
@ -52,8 +52,8 @@ static void extractThumbnailPackCB(retro_task_t *task,
|
||||
|
||||
void MainWindow::onThumbnailPackDownloadNetworkError(QNetworkReply::NetworkError code)
|
||||
{
|
||||
QNetworkReply *reply = m_thumbnailPackDownloadReply.data();
|
||||
QByteArray errorStringArray;
|
||||
QNetworkReply *reply = m_thumbnailPackDownloadReply.data();
|
||||
const char *errorStringData = NULL;
|
||||
|
||||
m_thumbnailPackDownloadProgressDialog->cancel();
|
||||
@ -66,12 +66,13 @@ void MainWindow::onThumbnailPackDownloadNetworkError(QNetworkReply::NetworkError
|
||||
|
||||
RARCH_ERR("[Qt]: Network error code %d received: %s\n", code, errorStringData);
|
||||
|
||||
/* Deleting the reply here seems to cause a strange heap-use-after-free crash. */
|
||||
/*
|
||||
#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::onThumbnailPackDownloadNetworkSslErrors(const QList<QSslError> &errors)
|
||||
@ -85,7 +86,11 @@ void MainWindow::onThumbnailPackDownloadNetworkSslErrors(const QList<QSslError>
|
||||
for (i = 0; i < errors.count(); i++)
|
||||
{
|
||||
const QSslError &error = errors.at(i);
|
||||
QString string = QString("Ignoring SSL error code ") + QString::number(error.error()) + ": " + error.errorString();
|
||||
QString string =
|
||||
QString("Ignoring SSL error code ")
|
||||
+ QString::number(error.error())
|
||||
+ ": "
|
||||
+ error.errorString();
|
||||
QByteArray stringArray = string.toUtf8();
|
||||
const char *stringData = stringArray.constData();
|
||||
RARCH_ERR("[Qt]: %s\n", stringData);
|
||||
@ -109,7 +114,11 @@ void MainWindow::onThumbnailPackDownloadFinished()
|
||||
|
||||
m_thumbnailPackDownloadProgressDialog->cancel();
|
||||
|
||||
/* At least on Linux, the progress dialog will refuse to hide itself and will stay on screen in a corrupted way if we happen to show an error message in this function. processEvents() will sometimes fix it, other times not... seems random. */
|
||||
/* At least on Linux, the progress dialog will refuse
|
||||
* to hide itself and will stay on screen in a corrupted
|
||||
* way if we happen to show an error message in this function.
|
||||
* processEvents() will sometimes fix it, other times not...
|
||||
* seems random. */
|
||||
qApp->processEvents();
|
||||
|
||||
if (!reply)
|
||||
@ -117,8 +126,8 @@ void MainWindow::onThumbnailPackDownloadFinished()
|
||||
|
||||
system = reply->property("system").toString();
|
||||
|
||||
error = reply->error();
|
||||
code = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
||||
error = reply->error();
|
||||
code = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
||||
|
||||
if (m_thumbnailPackDownloadFile.isOpen())
|
||||
m_thumbnailPackDownloadFile.close();
|
||||
@ -142,20 +151,18 @@ void MainWindow::onThumbnailPackDownloadFinished()
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
emit showErrorMessageDeferred(QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_NETWORK_ERROR)) + ": HTTP Code " + QString::number(code));
|
||||
|
||||
m_thumbnailPackDownloadFile.remove();
|
||||
emit showErrorMessageDeferred(QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_NETWORK_ERROR)) + ": HTTP Code " + QString::number(code));
|
||||
|
||||
RARCH_ERR("[Qt]: Thumbnail pack download failed with HTTP status code: %d\n", code);
|
||||
m_thumbnailPackDownloadFile.remove();
|
||||
|
||||
reply->disconnect();
|
||||
reply->abort();
|
||||
reply->deleteLater();
|
||||
RARCH_ERR("[Qt]: Thumbnail pack download failed with HTTP status code: %d\n", code);
|
||||
|
||||
return;
|
||||
}
|
||||
reply->disconnect();
|
||||
reply->abort();
|
||||
reply->deleteLater();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (error == QNetworkReply::NoError)
|
||||
@ -234,18 +241,18 @@ void MainWindow::downloadAllThumbnails(QString system, QUrl url)
|
||||
if (!settings)
|
||||
return;
|
||||
|
||||
urlString =
|
||||
urlString =
|
||||
QString(THUMBNAILPACK_URL_HEADER)
|
||||
+ system
|
||||
+ THUMBNAILPACK_EXTENSION;
|
||||
|
||||
if (url.isEmpty())
|
||||
url = urlString;
|
||||
url = urlString;
|
||||
|
||||
request.setUrl(url);
|
||||
|
||||
urlArray = url.toString().toUtf8();
|
||||
urlData = urlArray.constData();
|
||||
urlArray = url.toString().toUtf8();
|
||||
urlData = urlArray.constData();
|
||||
|
||||
if (m_thumbnailPackDownloadFile.isOpen())
|
||||
{
|
||||
|
@ -66,7 +66,7 @@ LoadCoreWindow::LoadCoreWindow(QWidget *parent) :
|
||||
,m_table(new LoadCoreTableWidget())
|
||||
,m_statusLabel(new QLabel())
|
||||
{
|
||||
QHBoxLayout *hbox = new QHBoxLayout();
|
||||
QHBoxLayout *hbox = new QHBoxLayout();
|
||||
QPushButton *customCoreButton = new QPushButton(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_LOAD_CUSTOM_CORE));
|
||||
|
||||
connect(customCoreButton, SIGNAL(clicked()), this, SLOT(onLoadCustomCoreClicked()));
|
||||
@ -80,7 +80,8 @@ LoadCoreWindow::LoadCoreWindow(QWidget *parent) :
|
||||
centralWidget()->setLayout(&m_layout);
|
||||
|
||||
hbox->addWidget(customCoreButton);
|
||||
hbox->addItem(new QSpacerItem(width(), 20, QSizePolicy::Expanding, QSizePolicy::Minimum));
|
||||
hbox->addItem(new QSpacerItem(width(),
|
||||
20, QSizePolicy::Expanding, QSizePolicy::Minimum));
|
||||
|
||||
m_layout.addWidget(m_table);
|
||||
m_layout.addLayout(hbox);
|
||||
@ -180,13 +181,15 @@ void LoadCoreWindow::onLoadCustomCoreClicked()
|
||||
strlcat(filters, core_ext, sizeof(filters));
|
||||
strlcat(filters, ");;All Files (*.*)", sizeof(filters));
|
||||
|
||||
path = QFileDialog::getOpenFileName(this, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_LOAD_CORE), path_dir_libretro, filters, NULL);
|
||||
path = QFileDialog::getOpenFileName(
|
||||
this, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_LOAD_CORE),
|
||||
path_dir_libretro, filters, NULL);
|
||||
|
||||
if (path.isEmpty())
|
||||
return;
|
||||
|
||||
pathArray.append(path);
|
||||
pathData = pathArray.constData();
|
||||
pathData = pathArray.constData();
|
||||
|
||||
loadCore(pathData);
|
||||
}
|
||||
@ -227,12 +230,13 @@ void LoadCoreWindow::initCoreList(const QStringList &extensionFilters)
|
||||
const char *name = core->display_name;
|
||||
|
||||
if (string_is_empty(name))
|
||||
name = path_basename(core->path);
|
||||
name = path_basename(core->path);
|
||||
|
||||
name_item = new QTableWidgetItem(name);
|
||||
name_item = new QTableWidgetItem(name);
|
||||
|
||||
hash["path"] = core->path;
|
||||
hash["extensions"] = QString(core->supported_extensions).split("|");
|
||||
hash["path"] = core->path;
|
||||
hash["extensions"] = QString(
|
||||
core->supported_extensions).split("|");
|
||||
|
||||
name_item->setData(Qt::UserRole, hash);
|
||||
name_item->setFlags(name_item->flags() & ~Qt::ItemIsEditable);
|
||||
|
@ -128,17 +128,15 @@ static void scan_finished_handler(retro_task_t *task,
|
||||
{
|
||||
bool dontAsk = false;
|
||||
bool answer = false;
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
menu_ctx_environment_t menu_environ;
|
||||
menu_environ.type = MENU_ENVIRON_RESET_HORIZONTAL_LIST;
|
||||
menu_environ.data = NULL;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
menu_driver_ctl(RARCH_MENU_CTL_ENVIRONMENT, &menu_environ);
|
||||
#endif
|
||||
if (!ui_window.qtWindow->settings()->value("scan_finish_confirm", true).toBool())
|
||||
if (!ui_window.qtWindow->settings()->value(
|
||||
"scan_finish_confirm", true).toBool())
|
||||
return;
|
||||
|
||||
answer = ui_window.qtWindow->showMessageBox(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_SCAN_FINISHED), MainWindow::MSGBOX_TYPE_QUESTION_OKCANCEL, Qt::ApplicationModal, true, &dontAsk);
|
||||
@ -156,7 +154,6 @@ static double expScale(double inputValue, double midValue, double maxValue)
|
||||
double B = maxValue / (exp(C) - 1);
|
||||
double A = -1 * B;
|
||||
double returnValue = A + B * exp(C * inputValue);
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
@ -381,41 +378,51 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
qRegisterMetaType<QPointer<ThumbnailWidget> >("ThumbnailWidget");
|
||||
qRegisterMetaType<retro_task_callback_t>("retro_task_callback_t");
|
||||
|
||||
/* Cancel all progress dialogs immediately since they show as soon as they're constructed. */
|
||||
/* Cancel all progress dialogs immediately since
|
||||
* they show as soon as they're constructed. */
|
||||
m_updateProgressDialog->cancel();
|
||||
m_thumbnailDownloadProgressDialog->cancel();
|
||||
m_thumbnailPackDownloadProgressDialog->cancel();
|
||||
m_playlistThumbnailDownloadProgressDialog->cancel();
|
||||
|
||||
m_gridProgressWidget = new QWidget();
|
||||
gridProgressLabel = new QLabel(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_PROGRESS), m_gridProgressWidget);
|
||||
m_gridProgressWidget = new QWidget();
|
||||
gridProgressLabel = new QLabel(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_PROGRESS),
|
||||
m_gridProgressWidget);
|
||||
|
||||
thumbnailTypePushButton->setObjectName("thumbnailTypePushButton");
|
||||
thumbnailTypePushButton->setFlat(true);
|
||||
|
||||
thumbnailTypeBoxartAction = thumbnailTypeMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_BOXART));
|
||||
thumbnailTypeScreenshotAction = thumbnailTypeMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_SCREENSHOT));
|
||||
thumbnailTypeTitleAction = thumbnailTypeMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_TITLE_SCREEN));
|
||||
thumbnailTypeBoxartAction = thumbnailTypeMenu->addAction(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_BOXART));
|
||||
thumbnailTypeScreenshotAction = thumbnailTypeMenu->addAction(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_SCREENSHOT));
|
||||
thumbnailTypeTitleAction = thumbnailTypeMenu->addAction(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_TITLE_SCREEN));
|
||||
|
||||
thumbnailTypePushButton->setMenu(thumbnailTypeMenu);
|
||||
|
||||
viewTypePushButton->setObjectName("viewTypePushButton");
|
||||
viewTypePushButton->setFlat(true);
|
||||
|
||||
viewTypeIconsAction = viewTypeMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_VIEW_TYPE_ICONS));
|
||||
viewTypeListAction = viewTypeMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_VIEW_TYPE_LIST));
|
||||
viewTypeIconsAction = viewTypeMenu->addAction(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_VIEW_TYPE_ICONS));
|
||||
viewTypeListAction = viewTypeMenu->addAction(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_VIEW_TYPE_LIST));
|
||||
|
||||
viewTypePushButton->setMenu(viewTypeMenu);
|
||||
|
||||
gridProgressLabel->setObjectName("gridProgressLabel");
|
||||
|
||||
m_gridProgressBar = new QProgressBar(m_gridProgressWidget);
|
||||
m_gridProgressBar = new QProgressBar(
|
||||
m_gridProgressWidget);
|
||||
|
||||
m_gridProgressBar->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred));
|
||||
|
||||
zoomLabel->setObjectName("zoomLabel");
|
||||
|
||||
m_zoomSlider = new QSlider(Qt::Horizontal, m_zoomWidget);
|
||||
m_zoomSlider = new QSlider(
|
||||
Qt::Horizontal, m_zoomWidget);
|
||||
|
||||
m_zoomSlider->setMinimum(0);
|
||||
m_zoomSlider->setMaximum(100);
|
||||
@ -796,8 +803,8 @@ QVector<QPair<QString, QString> > MainWindow::getPlaylists()
|
||||
for (i = 0; i < m_listWidget->count(); i++)
|
||||
{
|
||||
QString label, path;
|
||||
QListWidgetItem *item = m_listWidget->item(i);
|
||||
QPair<QString, QString> pair;
|
||||
QListWidgetItem *item = m_listWidget->item(i);
|
||||
|
||||
if (!item)
|
||||
continue;
|
||||
@ -873,16 +880,17 @@ void MainWindow::setIconViewZoom(int zoomValue)
|
||||
|
||||
void MainWindow::onZoomValueChanged(int zoomValue)
|
||||
{
|
||||
int newSize = 0;
|
||||
int newSize = 0;
|
||||
|
||||
if (zoomValue < 50)
|
||||
newSize = expScale(lerp(0, 49, 25, 49, zoomValue) / 50.0, 102, 256);
|
||||
newSize = expScale(
|
||||
lerp(0, 49, 25, 49, zoomValue) / 50.0, 102, 256);
|
||||
else
|
||||
newSize = expScale(zoomValue / 100.0, 256, 1024);
|
||||
newSize = expScale(zoomValue / 100.0, 256, 1024);
|
||||
|
||||
m_gridView->setGridSize(newSize);
|
||||
|
||||
m_lastZoomSliderValue = zoomValue;
|
||||
m_lastZoomSliderValue = zoomValue;
|
||||
}
|
||||
|
||||
void MainWindow::showWelcomeScreen()
|
||||
@ -928,41 +936,39 @@ bool MainWindow::setCustomThemeFile(QString filePath)
|
||||
QMessageBox::critical(this, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_CUSTOM_THEME), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_FILE_PATH_IS_BLANK));
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
||||
QFile file(filePath);
|
||||
|
||||
if (file.exists())
|
||||
{
|
||||
QFile file(filePath);
|
||||
bool opened = file.open(QIODevice::ReadOnly);
|
||||
|
||||
if (file.exists())
|
||||
if (opened)
|
||||
{
|
||||
bool opened = file.open(QIODevice::ReadOnly);
|
||||
QByteArray fileArray = file.readAll();
|
||||
QString fileStr = QString::fromUtf8(fileArray);
|
||||
|
||||
if (opened)
|
||||
file.close();
|
||||
|
||||
if (fileStr.isEmpty())
|
||||
{
|
||||
QByteArray fileArray = file.readAll();
|
||||
QString fileStr = QString::fromUtf8(fileArray);
|
||||
|
||||
file.close();
|
||||
|
||||
if (fileStr.isEmpty())
|
||||
{
|
||||
QMessageBox::critical(this, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_CUSTOM_THEME), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_FILE_IS_EMPTY));
|
||||
return false;
|
||||
}
|
||||
else
|
||||
setCustomThemeString(fileStr);
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::critical(this, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_CUSTOM_THEME), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_FILE_READ_OPEN_FAILED));
|
||||
QMessageBox::critical(this, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_CUSTOM_THEME), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_FILE_IS_EMPTY));
|
||||
return false;
|
||||
}
|
||||
else
|
||||
setCustomThemeString(fileStr);
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::critical(this, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_CUSTOM_THEME), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_FILE_DOES_NOT_EXIST));
|
||||
QMessageBox::critical(this, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_CUSTOM_THEME), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_FILE_READ_OPEN_FAILED));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::critical(this, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_CUSTOM_THEME), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_FILE_DOES_NOT_EXIST));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -974,7 +980,7 @@ void MainWindow::setCustomThemeString(QString qss)
|
||||
|
||||
bool MainWindow::showMessageBox(QString msg, MessageBoxType msgType, Qt::WindowModality modality, bool showDontAsk, bool *dontAsk)
|
||||
{
|
||||
QCheckBox *checkBox = NULL;
|
||||
QCheckBox *checkBox = NULL;
|
||||
|
||||
QPointer<QMessageBox> msgBoxPtr = new QMessageBox(this);
|
||||
QMessageBox *msgBox = msgBoxPtr.data();
|
||||
@ -1024,7 +1030,9 @@ bool MainWindow::showMessageBox(QString msg, MessageBoxType msgType, Qt::WindowM
|
||||
if (!msgBoxPtr)
|
||||
return true;
|
||||
|
||||
if (msgBox->result() != QMessageBox::Ok && msgBox->result() != QMessageBox::Yes)
|
||||
if (
|
||||
msgBox->result() != QMessageBox::Ok
|
||||
&& msgBox->result() != QMessageBox::Yes)
|
||||
return false;
|
||||
|
||||
if (checkBox)
|
||||
@ -1058,7 +1066,8 @@ void MainWindow::onFileBrowserTreeContextMenuRequested(const QPoint&)
|
||||
return;
|
||||
|
||||
/* default NULL parameter for parent wasn't added until 5.7 */
|
||||
scanAction.reset(new QAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SCAN_DIRECTORY), 0));
|
||||
scanAction.reset(new QAction(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SCAN_DIRECTORY), 0));
|
||||
|
||||
actions.append(scanAction.data());
|
||||
|
||||
@ -1085,16 +1094,17 @@ void MainWindow::showStatusMessage(QString msg,
|
||||
emit gotStatusMessage(msg, priority, duration, flush);
|
||||
}
|
||||
|
||||
void MainWindow::onGotStatusMessage(QString msg, unsigned priority, unsigned duration, bool flush)
|
||||
void MainWindow::onGotStatusMessage(
|
||||
QString msg, unsigned priority, unsigned duration, bool flush)
|
||||
{
|
||||
int msecDuration = 0;
|
||||
QScreen *screen = qApp->primaryScreen();
|
||||
int msecDuration = 0;
|
||||
QScreen *screen = qApp->primaryScreen();
|
||||
QStatusBar *status = statusBar();
|
||||
|
||||
Q_UNUSED(priority)
|
||||
|
||||
if (msg.isEmpty())
|
||||
return;
|
||||
if (msg.isEmpty())
|
||||
return;
|
||||
|
||||
if (!status)
|
||||
return;
|
||||
@ -1176,9 +1186,10 @@ void MainWindow::onGotLogMessage(const QString &msg)
|
||||
|
||||
void MainWindow::onLaunchWithComboBoxIndexChanged(int)
|
||||
{
|
||||
QVector<QHash<QString, QString> > infoList = getCoreInfo();
|
||||
QString coreInfoText;
|
||||
QVariantMap coreMap = m_launchWithComboBox->currentData(Qt::UserRole).value<QVariantMap>();
|
||||
QVector<QHash<QString, QString> >
|
||||
infoList = getCoreInfo();
|
||||
QVariantMap coreMap = m_launchWithComboBox->currentData(Qt::UserRole).value<QVariantMap>();
|
||||
core_selection coreSelection = static_cast<core_selection>(coreMap.value("core_selection").toInt());
|
||||
int i = 0;
|
||||
|
||||
@ -1188,22 +1199,24 @@ void MainWindow::onLaunchWithComboBoxIndexChanged(int)
|
||||
for (i = 0; i < infoList.count(); i++)
|
||||
{
|
||||
const QHash<QString, QString> &hash = infoList.at(i);
|
||||
const QString &key = hash.value("html_key", hash.value("key"));
|
||||
const QString &value = hash.value("html_value", hash.value("value"));
|
||||
const QString &key =
|
||||
hash.value("html_key", hash.value("key"));
|
||||
const QString &value =
|
||||
hash.value("html_value", hash.value("value"));
|
||||
|
||||
if (!key.isEmpty())
|
||||
coreInfoText += key;
|
||||
coreInfoText += key;
|
||||
|
||||
if (!value.isEmpty())
|
||||
{
|
||||
if (!key.isEmpty())
|
||||
coreInfoText += " ";
|
||||
coreInfoText += " ";
|
||||
|
||||
coreInfoText += value;
|
||||
coreInfoText += value;
|
||||
}
|
||||
|
||||
if (i < infoList.count() - 1)
|
||||
coreInfoText += "<br>\n";
|
||||
coreInfoText += "<br>\n";
|
||||
}
|
||||
|
||||
m_coreInfoLabel->setText(coreInfoText);
|
||||
@ -1211,7 +1224,8 @@ void MainWindow::onLaunchWithComboBoxIndexChanged(int)
|
||||
if (coreSelection == CORE_SELECTION_LOAD_CORE)
|
||||
onLoadCoreClicked();
|
||||
else
|
||||
m_loadCoreWindow->setProperty("last_launch_with_index", m_launchWithComboBox->currentIndex());
|
||||
m_loadCoreWindow->setProperty("last_launch_with_index",
|
||||
m_launchWithComboBox->currentIndex());
|
||||
}
|
||||
|
||||
MainWindow::Theme MainWindow::getThemeFromString(QString themeString)
|
||||
@ -1395,23 +1409,22 @@ QVector<QHash<QString, QString> > MainWindow::getCoreInfo()
|
||||
{
|
||||
unsigned i;
|
||||
QVector<QHash<QString, QString> > infoList;
|
||||
QByteArray currentCorePathArray;
|
||||
core_info_ctx_find_t core_info_finder;
|
||||
QHash<QString, QString> currentCore = getSelectedCore();
|
||||
const char *current_core_path_data = NULL;
|
||||
const core_info_t *core_info = NULL;
|
||||
|
||||
currentCorePathArray = currentCore["core_path"].toUtf8();
|
||||
current_core_path_data = currentCorePathArray.constData();
|
||||
QByteArray currentCorePathArray = currentCore["core_path"].toUtf8();
|
||||
const char *current_core_path_data = currentCorePathArray.constData();
|
||||
|
||||
/* Search for current core */
|
||||
core_info_finder.inf = NULL;
|
||||
core_info_finder.path = current_core_path_data;
|
||||
core_info_finder.inf = NULL;
|
||||
core_info_finder.path = current_core_path_data;
|
||||
|
||||
if (core_info_find(&core_info_finder))
|
||||
core_info = core_info_finder.inf;
|
||||
core_info = core_info_finder.inf;
|
||||
|
||||
if (currentCore["core_path"].isEmpty() || !core_info || !core_info->config_data)
|
||||
if ( currentCore["core_path"].isEmpty()
|
||||
|| !core_info
|
||||
|| !core_info->config_data)
|
||||
{
|
||||
QHash<QString, QString> hash;
|
||||
|
||||
@ -1599,35 +1612,40 @@ QVector<QHash<QString, QString> > MainWindow::getCoreInfo()
|
||||
{
|
||||
if (core_info->firmware[i].desc)
|
||||
{
|
||||
QString labelText = "(!) ";
|
||||
QString valueText;
|
||||
QHash<QString, QString> hash;
|
||||
bool missing = false;
|
||||
QString labelText = "(!) ";
|
||||
bool missing = false;
|
||||
|
||||
if (core_info->firmware[i].missing)
|
||||
{
|
||||
missing = true;
|
||||
labelText += msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MISSING);
|
||||
missing = true;
|
||||
labelText += msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_VALUE_MISSING);
|
||||
}
|
||||
else
|
||||
labelText += msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PRESENT);
|
||||
labelText += msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_VALUE_PRESENT);
|
||||
|
||||
labelText += ", ";
|
||||
labelText += ", ";
|
||||
|
||||
if (core_info->firmware[i].optional)
|
||||
labelText += msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OPTIONAL);
|
||||
labelText += msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_VALUE_OPTIONAL);
|
||||
else
|
||||
labelText += msg_hash_to_str(MENU_ENUM_LABEL_VALUE_REQUIRED);
|
||||
labelText += msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_VALUE_REQUIRED);
|
||||
|
||||
labelText += ":";
|
||||
labelText += ":";
|
||||
|
||||
if (core_info->firmware[i].desc)
|
||||
valueText = core_info->firmware[i].desc;
|
||||
valueText = core_info->firmware[i].desc;
|
||||
else
|
||||
valueText = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_NAME);
|
||||
valueText = msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_VALUE_RDB_ENTRY_NAME);
|
||||
|
||||
hash["key"] = labelText;
|
||||
hash["value"] = valueText;
|
||||
hash["key"] = labelText;
|
||||
hash["value"] = valueText;
|
||||
|
||||
if (missing)
|
||||
{
|
||||
@ -1713,7 +1731,9 @@ void MainWindow::selectBrowserDir(QString path)
|
||||
m_fileTableView->setRootIndex(proxyIndex);
|
||||
else
|
||||
{
|
||||
/* the directory is filtered out. Remove the filter for a moment. FIXME find a way to not have to do this (not filtering dirs is one). */
|
||||
/* the directory is filtered out. Remove the filter for a moment.
|
||||
* FIXME: Find a way to not have to do this
|
||||
* (not filtering dirs is one). */
|
||||
m_proxyFileModel->setFilterRegExp(QRegExp());
|
||||
m_fileTableView->setRootIndex(m_proxyFileModel->mapFromSource(sourceIndex));
|
||||
m_proxyFileModel->setFilterRegExp(m_searchRegExp);
|
||||
@ -1917,7 +1937,7 @@ void MainWindow::loadContent(const QHash<QString, QString> &contentHash)
|
||||
return;
|
||||
}
|
||||
|
||||
switch(coreSelection)
|
||||
switch (coreSelection)
|
||||
{
|
||||
case CORE_SELECTION_CURRENT:
|
||||
corePathArray = path_get(RARCH_PATH_CORE);
|
||||
@ -1946,8 +1966,8 @@ void MainWindow::loadContent(const QHash<QString, QString> &contentHash)
|
||||
return;
|
||||
}
|
||||
|
||||
contentDbNameArray = contentHash["db_name"].toUtf8();
|
||||
contentCrc32Array = contentHash["crc32"].toUtf8();
|
||||
contentDbNameArray = contentHash["db_name"].toUtf8();
|
||||
contentCrc32Array = contentHash["crc32"].toUtf8();
|
||||
|
||||
corePath = corePathArray.constData();
|
||||
contentPath = contentPathArray.constData();
|
||||
@ -1957,8 +1977,8 @@ void MainWindow::loadContent(const QHash<QString, QString> &contentHash)
|
||||
|
||||
/* Search for specified core - ensures path
|
||||
* is 'sanitised' */
|
||||
core_info.inf = NULL;
|
||||
core_info.path = corePath;
|
||||
core_info.inf = NULL;
|
||||
core_info.path = corePath;
|
||||
|
||||
if (core_info_find(&core_info) &&
|
||||
!string_is_empty(core_info.inf->path))
|
||||
@ -1972,7 +1992,8 @@ void MainWindow::loadContent(const QHash<QString, QString> &contentHash)
|
||||
strlcpy(contentDbNameFull, contentDbName, sizeof(contentDbNameFull));
|
||||
extension = path_get_extension(contentDbNameFull);
|
||||
|
||||
if (string_is_empty(extension) || !string_is_equal_noncase(
|
||||
if ( string_is_empty(extension)
|
||||
|| !string_is_equal_noncase(
|
||||
extension, file_path_str(FILE_PATH_LPL_EXTENSION_NO_DOT)))
|
||||
strlcat(
|
||||
contentDbNameFull, file_path_str(FILE_PATH_LPL_EXTENSION),
|
||||
@ -2011,7 +2032,8 @@ void MainWindow::onRunClicked()
|
||||
switch (m_currentBrowser)
|
||||
{
|
||||
case BROWSER_TYPE_FILES:
|
||||
contentHash = getFileContentHash(m_proxyFileModel->mapToSource(m_fileTableView->currentIndex()));
|
||||
contentHash = getFileContentHash(
|
||||
m_proxyFileModel->mapToSource(m_fileTableView->currentIndex()));
|
||||
break;
|
||||
case BROWSER_TYPE_PLAYLISTS:
|
||||
contentHash = getCurrentContentHash();
|
||||
@ -2064,7 +2086,8 @@ void MainWindow::setCoreActions()
|
||||
else
|
||||
m_startCorePushButton->hide();
|
||||
|
||||
if (isCoreLoaded() && m_settings->value("suggest_loaded_core_first", false).toBool())
|
||||
if ( isCoreLoaded()
|
||||
&& m_settings->value("suggest_loaded_core_first", false).toBool())
|
||||
{
|
||||
QVariantMap comboBoxMap;
|
||||
comboBoxMap["core_name"] = m_currentCore;
|
||||
@ -2133,20 +2156,18 @@ void MainWindow::setCoreActions()
|
||||
|
||||
if (!defaultCorePath.isEmpty())
|
||||
{
|
||||
QByteArray defaultCorePathArray;
|
||||
QString currentPlaylistItemDataString;
|
||||
core_info_ctx_find_t core_info_finder;
|
||||
const char *default_core_path_data = NULL;
|
||||
bool allPlaylists = false;
|
||||
int row = 0;
|
||||
|
||||
defaultCorePathArray = defaultCorePath.toUtf8();
|
||||
default_core_path_data = defaultCorePathArray.constData();
|
||||
QByteArray defaultCorePathArray = defaultCorePath.toUtf8();
|
||||
const char *default_core_path_data = defaultCorePathArray.constData();
|
||||
|
||||
if (currentPlaylistItem)
|
||||
{
|
||||
currentPlaylistItemDataString = currentPlaylistItem->data(Qt::UserRole).toString();
|
||||
allPlaylists = (currentPlaylistItemDataString == ALL_PLAYLISTS_TOKEN);
|
||||
currentPlaylistItemDataString = currentPlaylistItem->data(Qt::UserRole).toString();
|
||||
allPlaylists = (
|
||||
currentPlaylistItemDataString == ALL_PLAYLISTS_TOKEN);
|
||||
}
|
||||
|
||||
for (row = 0; row < m_listWidget->count(); row++)
|
||||
@ -2164,8 +2185,8 @@ void MainWindow::setCoreActions()
|
||||
}
|
||||
|
||||
/* Search for default core */
|
||||
core_info_finder.inf = NULL;
|
||||
core_info_finder.path = default_core_path_data;
|
||||
core_info_finder.inf = NULL;
|
||||
core_info_finder.path = default_core_path_data;
|
||||
|
||||
if (core_info_find(&core_info_finder))
|
||||
{
|
||||
@ -2281,12 +2302,12 @@ void MainWindow::onSearchLineEditEdited(const QString &text)
|
||||
|
||||
if (code >= HIRAGANA_START && code <= HIRAGANA_END)
|
||||
{
|
||||
foundHira = true;
|
||||
foundHira = true;
|
||||
textHiraToKata += code + HIRA_KATA_OFFSET;
|
||||
}
|
||||
else if (code >= KATAKANA_START && code <= KATAKANA_END)
|
||||
{
|
||||
foundKata = true;
|
||||
foundKata = true;
|
||||
textKataToHira += code - HIRA_KATA_OFFSET;
|
||||
}
|
||||
else
|
||||
@ -2299,11 +2320,19 @@ void MainWindow::onSearchLineEditEdited(const QString &text)
|
||||
if (!foundHira && !foundKata)
|
||||
m_searchRegExp = QRegExp(text, Qt::CaseInsensitive);
|
||||
else if (foundHira && !foundKata)
|
||||
m_searchRegExp = QRegExp(text + "|" + QString::fromUcs4(textHiraToKata.constData(), textHiraToKata.size()), Qt::CaseInsensitive);
|
||||
m_searchRegExp = QRegExp(text + "|"
|
||||
+ QString::fromUcs4(textHiraToKata.constData(),
|
||||
textHiraToKata.size()), Qt::CaseInsensitive);
|
||||
else if (!foundHira && foundKata)
|
||||
m_searchRegExp = QRegExp(text + "|" + QString::fromUcs4(textKataToHira.constData(), textKataToHira.size()), Qt::CaseInsensitive);
|
||||
m_searchRegExp = QRegExp(text + "|"
|
||||
+ QString::fromUcs4(textKataToHira.constData(),
|
||||
textKataToHira.size()), Qt::CaseInsensitive);
|
||||
else
|
||||
m_searchRegExp = QRegExp(text + "|" + QString::fromUcs4(textHiraToKata.constData(), textHiraToKata.size()) + "|" + QString::fromUcs4(textKataToHira.constData(), textKataToHira.size()), Qt::CaseInsensitive);
|
||||
m_searchRegExp = QRegExp(text + "|"
|
||||
+ QString::fromUcs4(textHiraToKata.constData(),
|
||||
textHiraToKata.size()) + "|" +
|
||||
QString::fromUcs4(textKataToHira.constData(),
|
||||
textKataToHira.size()), Qt::CaseInsensitive);
|
||||
|
||||
applySearch();
|
||||
}
|
||||
@ -2328,15 +2357,15 @@ void MainWindow::applySearch()
|
||||
|
||||
void MainWindow::onViewClosedDocksAboutToShow()
|
||||
{
|
||||
QMenu *menu = qobject_cast<QMenu*>(sender());
|
||||
QList<QDockWidget*> dockWidgets;
|
||||
bool found = false;
|
||||
int i = 0;
|
||||
int i = 0;
|
||||
QMenu *menu = qobject_cast<QMenu*>(sender());
|
||||
bool found = false;
|
||||
|
||||
if (!menu)
|
||||
return;
|
||||
|
||||
dockWidgets = findChildren<QDockWidget*>();
|
||||
dockWidgets = findChildren<QDockWidget*>();
|
||||
|
||||
menu->clear();
|
||||
|
||||
@ -2352,7 +2381,9 @@ void MainWindow::onViewClosedDocksAboutToShow()
|
||||
|
||||
if (!dock->isVisible())
|
||||
{
|
||||
QAction *action = menu->addAction(dock->property("menu_text").toString(), this, SLOT(onShowHiddenDockWidgetAction()));
|
||||
QAction *action = menu->addAction(
|
||||
dock->property("menu_text").toString(),
|
||||
this, SLOT(onShowHiddenDockWidgetAction()));
|
||||
action->setProperty("dock_name", dock->objectName());
|
||||
found = true;
|
||||
}
|
||||
@ -2377,7 +2408,8 @@ void MainWindow::onShowHiddenDockWidgetAction()
|
||||
|
||||
if (!dock->isVisible())
|
||||
{
|
||||
addDockWidget(static_cast<Qt::DockWidgetArea>(dock->property("default_area").toInt()), dock);
|
||||
addDockWidget(static_cast<Qt::DockWidgetArea>(
|
||||
dock->property("default_area").toInt()), dock);
|
||||
dock->setVisible(true);
|
||||
dock->setFloating(false);
|
||||
}
|
||||
@ -2438,9 +2470,9 @@ void MainWindow::renamePlaylistItem(QListWidgetItem *item, QString newName)
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
playlistPath = item->data(Qt::UserRole).toString();
|
||||
playlistInfo = playlistPath;
|
||||
oldName = playlistInfo.completeBaseName();
|
||||
playlistPath = item->data(Qt::UserRole).toString();
|
||||
playlistInfo = playlistPath;
|
||||
oldName = playlistInfo.completeBaseName();
|
||||
|
||||
/* Don't just compare strings in case there are
|
||||
* case differences on Windows that should be ignored. */
|
||||
@ -2463,14 +2495,14 @@ void MainWindow::renamePlaylistItem(QListWidgetItem *item, QString newName)
|
||||
* an infinite loop here */
|
||||
disconnect(m_listWidget, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(onCurrentListItemDataChanged(QListWidgetItem*)));
|
||||
|
||||
oldPath = item->data(Qt::UserRole).toString();
|
||||
oldPath = item->data(Qt::UserRole).toString();
|
||||
|
||||
file.setFileName(oldPath);
|
||||
info = file;
|
||||
info = file;
|
||||
|
||||
extension = info.suffix();
|
||||
|
||||
newPath = info.absolutePath();
|
||||
newPath = info.absolutePath();
|
||||
|
||||
/* absolutePath() will always use / even on Windows */
|
||||
if (newPath.at(newPath.count() - 1) != '/')
|
||||
@ -2524,11 +2556,12 @@ void MainWindow::onCurrentItemChanged(const QHash<QString, QString> &hash)
|
||||
QString thumbnailsDir = m_playlistModel->getPlaylistThumbnailsDir(hash["db_name"]);
|
||||
QString thumbnailName = m_playlistModel->getSanitizedThumbnailName(hash["label_noext"]);
|
||||
|
||||
m_thumbnailPixmap = new QPixmap(thumbnailsDir + "/" + THUMBNAIL_BOXART + "/" + thumbnailName);
|
||||
m_thumbnailPixmap2 = new QPixmap(thumbnailsDir + "/" + THUMBNAIL_TITLE + "/" + thumbnailName);
|
||||
m_thumbnailPixmap3 = new QPixmap(thumbnailsDir + "/" + THUMBNAIL_SCREENSHOT + "/" + thumbnailName);
|
||||
m_thumbnailPixmap = new QPixmap(thumbnailsDir + "/" + THUMBNAIL_BOXART + "/" + thumbnailName);
|
||||
m_thumbnailPixmap2 = new QPixmap(thumbnailsDir + "/" + THUMBNAIL_TITLE + "/" + thumbnailName);
|
||||
m_thumbnailPixmap3 = new QPixmap(thumbnailsDir + "/" + THUMBNAIL_SCREENSHOT + "/" + thumbnailName);
|
||||
|
||||
if (m_currentBrowser == BROWSER_TYPE_PLAYLISTS && !currentPlaylistIsSpecial())
|
||||
if ( m_currentBrowser == BROWSER_TYPE_PLAYLISTS
|
||||
&& !currentPlaylistIsSpecial())
|
||||
acceptDrop = true;
|
||||
}
|
||||
|
||||
@ -2539,7 +2572,8 @@ void MainWindow::onCurrentItemChanged(const QHash<QString, QString> &hash)
|
||||
setCoreActions();
|
||||
}
|
||||
|
||||
void MainWindow::setThumbnail(QString widgetName, QPixmap &pixmap, bool acceptDrop)
|
||||
void MainWindow::setThumbnail(QString widgetName,
|
||||
QPixmap &pixmap, bool acceptDrop)
|
||||
{
|
||||
ThumbnailWidget *thumbnail = findChild<ThumbnailWidget*>(widgetName);
|
||||
|
||||
@ -2599,7 +2633,8 @@ ThumbnailType MainWindow::getCurrentThumbnailType()
|
||||
return m_thumbnailType;
|
||||
}
|
||||
|
||||
void MainWindow::onCurrentListItemChanged(QListWidgetItem *current, QListWidgetItem *previous)
|
||||
void MainWindow::onCurrentListItemChanged(
|
||||
QListWidgetItem *current, QListWidgetItem *previous)
|
||||
{
|
||||
Q_UNUSED(current)
|
||||
Q_UNUSED(previous)
|
||||
@ -2679,14 +2714,16 @@ void MainWindow::onBrowserUpClicked()
|
||||
dir.cdUp();
|
||||
|
||||
m_dirTree->setCurrentIndex(m_dirModel->index(dir.absolutePath()));
|
||||
m_dirTree->scrollTo(m_dirTree->currentIndex(), QAbstractItemView::EnsureVisible);
|
||||
m_dirTree->scrollTo(m_dirTree->currentIndex(),
|
||||
QAbstractItemView::EnsureVisible);
|
||||
}
|
||||
|
||||
void MainWindow::onBrowserStartClicked()
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
m_dirTree->setCurrentIndex(m_dirModel->index(settings->paths.directory_menu_content));
|
||||
m_dirTree->setCurrentIndex(
|
||||
m_dirModel->index(settings->paths.directory_menu_content));
|
||||
m_dirTree->scrollTo(m_dirTree->currentIndex(), QAbstractItemView::PositionAtTop);
|
||||
}
|
||||
|
||||
@ -2743,11 +2780,13 @@ void MainWindow::setCurrentCoreLabel()
|
||||
QString libraryName = system->library_name;
|
||||
const char *no_core_str = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_CORE);
|
||||
|
||||
if (m_statusLabel->text().isEmpty() || (m_currentCore != no_core_str && libraryName.isEmpty()))
|
||||
if ( (m_statusLabel->text().isEmpty())
|
||||
|| (m_currentCore != no_core_str && libraryName.isEmpty())
|
||||
)
|
||||
{
|
||||
m_currentCore = no_core_str;
|
||||
m_currentCoreVersion = "";
|
||||
update = true;
|
||||
m_currentCore = no_core_str;
|
||||
m_currentCoreVersion = "";
|
||||
update = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2762,7 +2801,7 @@ void MainWindow::setCurrentCoreLabel()
|
||||
if (update)
|
||||
{
|
||||
QAction *unloadCoreAction = findChild<QAction*>("unloadCoreAction");
|
||||
QString text = QString(PACKAGE_VERSION) + " - " + m_currentCore + " " + m_currentCoreVersion;
|
||||
QString text = QString(PACKAGE_VERSION) + " - " + m_currentCore + " " + m_currentCoreVersion;
|
||||
m_statusLabel->setText(text);
|
||||
m_loadCoreWindow->setStatusLabel(text);
|
||||
setCoreActions();
|
||||
@ -2780,9 +2819,9 @@ void MainWindow::setCurrentCoreLabel()
|
||||
void MainWindow::onCoreLoadWindowClosed()
|
||||
{
|
||||
QVariant lastLaunchWithVariant = m_loadCoreWindow->property("last_launch_with_index");
|
||||
int lastLaunchWithIndex = lastLaunchWithVariant.toInt();
|
||||
int lastLaunchWithIndex = lastLaunchWithVariant.toInt();
|
||||
|
||||
m_pendingRun = false;
|
||||
m_pendingRun = false;
|
||||
|
||||
if (lastLaunchWithVariant.isValid() && lastLaunchWithIndex >= 0)
|
||||
{
|
||||
@ -2820,11 +2859,9 @@ void MainWindow::onUnloadCoreMenuAction()
|
||||
menu_navigation_set_selection(0);
|
||||
#endif
|
||||
|
||||
/* TODO */
|
||||
if (!command_event(CMD_EVENT_UNLOAD_CORE, NULL))
|
||||
{
|
||||
/* TODO */
|
||||
return;
|
||||
}
|
||||
|
||||
setCurrentCoreLabel();
|
||||
setCoreActions();
|
||||
@ -3104,7 +3141,7 @@ int MainWindow::onExtractArchive(QString path, QString extractionDir, QString te
|
||||
|
||||
string_list_free(file_list);
|
||||
|
||||
memset(&state, 0, sizeof(state));
|
||||
memset(&state, 0, sizeof(state));
|
||||
memset(&userdata, 0, sizeof(userdata));
|
||||
|
||||
state.type = ARCHIVE_TRANSFER_INIT;
|
||||
@ -3153,23 +3190,21 @@ static void* ui_window_qt_init(void)
|
||||
|
||||
static void ui_window_qt_destroy(void *data)
|
||||
{
|
||||
(void)data;
|
||||
/*
|
||||
#if 0
|
||||
ui_window_qt_t *window = (ui_window_qt_t*)data;
|
||||
|
||||
delete window->qtWindow;
|
||||
*/
|
||||
#endif
|
||||
}
|
||||
|
||||
static void ui_window_qt_set_focused(void *data)
|
||||
{
|
||||
(void)data;
|
||||
/*
|
||||
#if 0
|
||||
ui_window_qt_t *window = (ui_window_qt_t*)data;
|
||||
|
||||
window->qtWindow->raise();
|
||||
window->qtWindow->activateWindow();
|
||||
*/
|
||||
#endif
|
||||
}
|
||||
|
||||
static void ui_window_qt_set_visible(void *data,
|
||||
@ -3182,34 +3217,30 @@ static void ui_window_qt_set_visible(void *data,
|
||||
|
||||
static void ui_window_qt_set_title(void *data, char *buf)
|
||||
{
|
||||
(void)data;
|
||||
(void)buf;
|
||||
/*
|
||||
#if 0
|
||||
ui_window_qt_t *window = (ui_window_qt_t*)data;
|
||||
|
||||
window->qtWindow->setWindowTitle(QString::fromUtf8(buf));
|
||||
*/
|
||||
#endif
|
||||
}
|
||||
|
||||
static void ui_window_qt_set_droppable(void *data, bool droppable)
|
||||
{
|
||||
(void)data;
|
||||
(void)droppable;
|
||||
/*
|
||||
#if 0
|
||||
ui_window_qt_t *window = (ui_window_qt_t*)data;
|
||||
|
||||
window->qtWindow->setAcceptDrops(droppable);
|
||||
*/
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool ui_window_qt_focused(void *data)
|
||||
{
|
||||
(void)data;
|
||||
/*
|
||||
#if 0
|
||||
ui_window_qt_t *window = (ui_window_qt_t*)data;
|
||||
return window->qtWindow->isActiveWindow() && !window->qtWindow->isMinimized();
|
||||
*/
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
ui_window_t ui_window_qt = {
|
||||
|
@ -92,11 +92,11 @@ private:
|
||||
|
||||
if (inner)
|
||||
{
|
||||
int fw = frameWidth() * 2;
|
||||
QSize minSize = inner->minimumSizeHint();
|
||||
int fw = frameWidth() * 2;
|
||||
QSize minSize = inner->minimumSizeHint();
|
||||
|
||||
minSize += QSize(fw, fw);
|
||||
minSize += QSize(scrollBarWidth(), 0);
|
||||
minSize += QSize(fw, fw);
|
||||
minSize += QSize(scrollBarWidth(), 0);
|
||||
minSize.setWidth(qMin(minSize.width(), max_min_width));
|
||||
minSize.setHeight(qMin(minSize.height(), max_min_height));
|
||||
return minSize;
|
||||
@ -169,7 +169,10 @@ ViewOptionsDialog::ViewOptionsDialog(MainWindow *mainwindow, QWidget *parent) :
|
||||
addCategory(new UserCategory(this));
|
||||
addCategory(new DirectoryCategory(this));
|
||||
|
||||
width = m_optionsList->sizeHintForColumn(0) + m_optionsList->frameWidth() * 2 + 5;
|
||||
width =
|
||||
m_optionsList->sizeHintForColumn(0)
|
||||
+ m_optionsList->frameWidth() * 2
|
||||
+ 5;
|
||||
width += m_optionsList->verticalScrollBar()->sizeHint().width();
|
||||
|
||||
m_optionsList->setMaximumWidth(width);
|
||||
@ -281,7 +284,6 @@ void ViewOptionsDialog::onRejected()
|
||||
{
|
||||
#ifdef HAVE_MENU
|
||||
int i;
|
||||
|
||||
for (i = 0; i < m_categoryList.size(); i++)
|
||||
m_categoryList.at(i)->apply();
|
||||
#endif
|
||||
@ -308,7 +310,7 @@ ViewOptionsWidget::ViewOptionsWidget(MainWindow *mainwindow, QWidget *parent) :
|
||||
/* ,m_allPlaylistsGridMaxCountSpinBox(new QSpinBox(this)) */
|
||||
{
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
QFormLayout *form = new QFormLayout;
|
||||
QFormLayout *form = new QFormLayout;
|
||||
|
||||
m_themeComboBox->addItem(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THEME_SYSTEM_DEFAULT), MainWindow::THEME_SYSTEM_DEFAULT);
|
||||
m_themeComboBox->addItem(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THEME_DARK), MainWindow::THEME_DARK);
|
||||
@ -413,10 +415,14 @@ void ViewOptionsWidget::loadViewOptions()
|
||||
int i;
|
||||
int themeIndex = 0;
|
||||
int playlistIndex = 0;
|
||||
QColor highlightColor = m_settings->value("highlight_color", QApplication::palette().highlight().color()).value<QColor>();
|
||||
QColor highlightColor =
|
||||
m_settings->value("highlight_color",
|
||||
QApplication::palette().highlight().color()).value<QColor>();
|
||||
QPixmap highlightPixmap(m_highlightColorPushButton->iconSize());
|
||||
QVector<QPair<QString, QString> > playlists = m_mainwindow->getPlaylists();
|
||||
QString initialPlaylist = m_settings->value("initial_playlist", m_mainwindow->getSpecialPlaylistPath(SPECIAL_PLAYLIST_HISTORY)).toString();
|
||||
QString initialPlaylist = m_settings->value("initial_playlist",
|
||||
m_mainwindow->getSpecialPlaylistPath(
|
||||
SPECIAL_PLAYLIST_HISTORY)).toString();
|
||||
|
||||
m_saveGeometryCheckBox->setChecked(m_settings->value("save_geometry", false).toBool());
|
||||
m_saveDockPositionsCheckBox->setChecked(m_settings->value("save_dock_positions", false).toBool());
|
||||
@ -453,7 +459,8 @@ void ViewOptionsWidget::loadViewOptions()
|
||||
m_startupPlaylistComboBox->addItem(pair.first, pair.second);
|
||||
}
|
||||
|
||||
playlistIndex = m_startupPlaylistComboBox->findData(initialPlaylist, Qt::UserRole, Qt::MatchFixedString);
|
||||
playlistIndex = m_startupPlaylistComboBox->findData(
|
||||
initialPlaylist, Qt::UserRole, Qt::MatchFixedString);
|
||||
|
||||
if (playlistIndex >= 0)
|
||||
m_startupPlaylistComboBox->setCurrentIndex(playlistIndex);
|
||||
|
Loading…
x
Reference in New Issue
Block a user