Cleanups, comments, style nits

This commit is contained in:
twinaphex 2020-06-04 14:41:28 +02:00
parent 9fda2bdebd
commit 88f7515d1d
15 changed files with 216 additions and 179 deletions

View File

@ -59,25 +59,23 @@
#define SM_SERVERR2 89 #define SM_SERVERR2 89
#endif #endif
/* static public global variable */
VOID (WINAPI *DragAcceptFiles_func)(HWND, BOOL);
/* static global variables */
static bool dwm_composition_disabled = false;
static bool console_needs_free = false;
static char win32_cpu_model_name[64] = {0};
static bool pi_set = false;
#ifdef HAVE_DYNAMIC
/* We only load this library once, so we let it be /* We only load this library once, so we let it be
* unloaded at application shutdown, since unloading * unloaded at application shutdown, since unloading
* it early seems to cause issues on some systems. * it early seems to cause issues on some systems.
*/ */
#ifdef HAVE_DYNAMIC
static dylib_t dwmlib; static dylib_t dwmlib;
static dylib_t shell32lib; static dylib_t shell32lib;
#endif #endif
static char win32_cpu_model_name[64] = {0};
VOID (WINAPI *DragAcceptFiles_func)(HWND, BOOL);
static bool dwm_composition_disabled = false;
static bool console_needs_free = false;
static bool pi_set = false;
#if defined(HAVE_LANGEXTRA) && !defined(_XBOX) #if defined(HAVE_LANGEXTRA) && !defined(_XBOX)
#if (defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0500) || !defined(_MSC_VER) #if (defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0500) || !defined(_MSC_VER)
struct win32_lang_pair struct win32_lang_pair

View File

@ -39,22 +39,24 @@ CoreInfoDialog::CoreInfoDialog(MainWindow *mainwindow, QWidget *parent) :
void CoreInfoDialog::showCoreInfo() void CoreInfoDialog::showCoreInfo()
{ {
int row = 0; int row = 0;
int rowCount = m_formLayout->rowCount(); int row_count = m_formLayout->rowCount();
int i = 0; int i = 0;
QVector<QHash<QString, QString> > infoList = m_mainwindow->getCoreInfo(); QVector<QHash<QString, QString> > info_list
= m_mainwindow->getCoreInfo();
if (rowCount > 0) if (row_count > 0)
{ {
for (row = 0; row < rowCount; row++) for (row = 0; row < row_count; row++)
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)) #if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
/* removeRow() and takeRow() was only added in 5.8! */ /* removeRow() and takeRow() was only added in 5.8! */
m_formLayout->removeRow(0); m_formLayout->removeRow(0);
#else #else
/* something is buggy here... sometimes items appear duplicated, and other times not */ /* something is buggy here...
* sometimes items appear duplicated, and other times not */
QLayoutItem *item = m_formLayout->itemAt(0); QLayoutItem *item = m_formLayout->itemAt(0);
QWidget *w = NULL; QWidget *w = NULL;
if (item) if (item)
{ {
@ -76,12 +78,12 @@ void CoreInfoDialog::showCoreInfo()
} }
} }
if (infoList.count() == 0) if (info_list.count() == 0)
return; return;
for (i = 0; i < infoList.count(); i++) for (i = 0; i < info_list.count(); i++)
{ {
const QHash<QString, QString> &line = infoList.at(i); const QHash<QString, QString> &line = info_list.at(i);
QLabel *label = new QLabel(line.value("key")); QLabel *label = new QLabel(line.value("key"));
CoreInfoLabel *value = new CoreInfoLabel(line.value("value")); CoreInfoLabel *value = new CoreInfoLabel(line.value("value"));
QString labelStyle = line.value("label_style"); QString labelStyle = line.value("label_style");

View File

@ -128,16 +128,16 @@ void CoreOptionsDialog::onSaveGameSpecificOptions()
void CoreOptionsDialog::onCoreOptionComboBoxCurrentIndexChanged(int index) void CoreOptionsDialog::onCoreOptionComboBoxCurrentIndexChanged(int index)
{ {
QComboBox *comboBox = qobject_cast<QComboBox*>(sender());
QString key, val;
size_t opts = 0;
unsigned i, k; unsigned i, k;
QString key, val;
size_t opts = 0;
QComboBox *combo_box = qobject_cast<QComboBox*>(sender());
if (!comboBox) if (!combo_box)
return; return;
key = comboBox->itemData(index, Qt::UserRole).toString(); key = combo_box->itemData(index, Qt::UserRole).toString();
val = comboBox->itemText(index); val = combo_box->itemText(index);
if (rarch_ctl(RARCH_CTL_HAS_CORE_OPTIONS, NULL)) if (rarch_ctl(RARCH_CTL_HAS_CORE_OPTIONS, NULL))
{ {
@ -179,14 +179,15 @@ void CoreOptionsDialog::onCoreOptionComboBoxCurrentIndexChanged(int index)
void CoreOptionsDialog::buildLayout() void CoreOptionsDialog::buildLayout()
{ {
QFormLayout *form = NULL;
settings_t *settings = config_get_ptr();
size_t opts = 0;
unsigned j, k; unsigned j, k;
size_t opts = 0;
QFormLayout *form = NULL;
settings_t *settings = config_get_ptr();
bool has_core_options = rarch_ctl(RARCH_CTL_HAS_CORE_OPTIONS, NULL);
clearLayout(); clearLayout();
if (rarch_ctl(RARCH_CTL_HAS_CORE_OPTIONS, NULL)) if (has_core_options)
{ {
rarch_ctl(RARCH_CTL_GET_CORE_OPTION_SIZE, &opts); rarch_ctl(RARCH_CTL_GET_CORE_OPTION_SIZE, &opts);
@ -240,12 +241,14 @@ void CoreOptionsDialog::buildLayout()
for (j = 0; j < opts; j++) for (j = 0; j < opts; j++)
{ {
QString desc = core_option_manager_get_desc(coreopts, j); QString desc =
QString val = core_option_manager_get_val(coreopts, j); core_option_manager_get_desc(coreopts, j);
QComboBox *comboBox = NULL; QString val =
QLabel *descLabel = NULL; core_option_manager_get_val(coreopts, j);
QHBoxLayout *comboLayout = NULL; QComboBox *combo_box = NULL;
QToolButton *resetButton = NULL; QLabel *descLabel = NULL;
QHBoxLayout *comboLayout = NULL;
QToolButton *resetButton = NULL;
struct core_option *option = NULL; struct core_option *option = NULL;
if (desc.isEmpty() || !coreopts->opts) if (desc.isEmpty() || !coreopts->opts)
@ -257,35 +260,40 @@ void CoreOptionsDialog::buildLayout()
continue; continue;
comboLayout = new QHBoxLayout(); comboLayout = new QHBoxLayout();
descLabel = new QLabel(desc, this); descLabel = new QLabel(desc, this);
comboBox = new QComboBox(this); combo_box = new QComboBox(this);
comboBox->setObjectName("coreOptionComboBox"); combo_box->setObjectName("coreOptionComboBox");
resetButton = new QToolButton(this); resetButton = new QToolButton(this);
resetButton->setObjectName("resetButton"); resetButton->setObjectName("resetButton");
resetButton->setDefaultAction(new QAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_RESET), this)); resetButton->setDefaultAction(new QAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_RESET), this));
resetButton->setProperty("comboBox", QVariant::fromValue(comboBox)); resetButton->setProperty("comboBox",
QVariant::fromValue(combo_box));
connect(resetButton, SIGNAL(clicked()), this, SLOT(onCoreOptionResetClicked())); connect(resetButton, SIGNAL(clicked()),
this, SLOT(onCoreOptionResetClicked()));
if (!string_is_empty(option->info)) if (!string_is_empty(option->info))
{ {
char *new_info = strdup(option->info); char *new_info = strdup(option->info);
word_wrap(new_info, new_info, 50, true, 0); word_wrap(new_info, new_info, 50, true, 0);
descLabel->setToolTip(new_info); descLabel->setToolTip(new_info);
comboBox->setToolTip(new_info); combo_box->setToolTip(new_info);
free(new_info); free(new_info);
} }
for (k = 0; k < option->vals->size; k++) for (k = 0; k < option->vals->size; k++)
comboBox->addItem(option->vals->elems[k].data, option->key); combo_box->addItem(option->vals->elems[k].data, option->key);
comboBox->setCurrentText(val); combo_box->setCurrentText(val);
comboBox->setProperty("default_index", static_cast<unsigned>(option->default_index)); combo_box->setProperty("default_index",
static_cast<unsigned>(option->default_index));
/* Only connect the signal after setting the default item */ /* Only connect the signal after setting the default item */
connect(comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onCoreOptionComboBoxCurrentIndexChanged(int))); connect(combo_box, SIGNAL(currentIndexChanged(int)),
this,
SLOT(onCoreOptionComboBoxCurrentIndexChanged(int)));
comboLayout->addWidget(comboBox); comboLayout->addWidget(combo_box);
comboLayout->addWidget(resetButton); comboLayout->addWidget(resetButton);
form->addRow(descLabel, comboLayout); form->addRow(descLabel, comboLayout);
@ -300,13 +308,15 @@ void CoreOptionsDialog::buildLayout()
if (!opts) if (!opts)
{ {
QLabel *noParamsLabel = new QLabel(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_CORE_OPTIONS_AVAILABLE), this); QLabel *noParamsLabel = new QLabel(msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_NO_CORE_OPTIONS_AVAILABLE), this);
noParamsLabel->setAlignment(Qt::AlignCenter); noParamsLabel->setAlignment(Qt::AlignCenter);
m_layout->addWidget(noParamsLabel); m_layout->addWidget(noParamsLabel);
} }
m_layout->addItem(new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding)); m_layout->addItem(new QSpacerItem(20, 20,
QSizePolicy::Minimum, QSizePolicy::Expanding));
resize(width() + 1, height()); resize(width() + 1, height());
show(); show();
@ -315,48 +325,48 @@ void CoreOptionsDialog::buildLayout()
void CoreOptionsDialog::onCoreOptionResetClicked() void CoreOptionsDialog::onCoreOptionResetClicked()
{ {
QToolButton *button = qobject_cast<QToolButton*>(sender()); bool ok = false;
QComboBox *comboBox = NULL; QToolButton *button = qobject_cast<QToolButton*>(sender());
int default_index = 0; QComboBox *combo_box = NULL;
bool ok = false; int default_index = 0;
if (!button) if (!button)
return; return;
comboBox = qobject_cast<QComboBox*>(button->property("comboBox").value<QComboBox*>()); combo_box = qobject_cast<QComboBox*>(button->property("comboBox").value<QComboBox*>());
if (!comboBox) if (!combo_box)
return; return;
default_index = comboBox->property("default_index").toInt(&ok); default_index = combo_box->property("default_index").toInt(&ok);
if (!ok) if (!ok)
return; return;
if (default_index >= 0 && default_index < comboBox->count()) if (default_index >= 0 && default_index < combo_box->count())
comboBox->setCurrentIndex(default_index); combo_box->setCurrentIndex(default_index);
} }
void CoreOptionsDialog::onCoreOptionResetAllClicked() void CoreOptionsDialog::onCoreOptionResetAllClicked()
{ {
QList<QComboBox*> comboBoxes = findChildren<QComboBox*>("coreOptionComboBox");
int i; int i;
QList<QComboBox*> combo_boxes = findChildren<QComboBox*>("coreOptionComboBox");
for (i = 0; i < comboBoxes.count(); i++) for (i = 0; i < combo_boxes.count(); i++)
{ {
QComboBox *comboBox = comboBoxes.at(i); int default_index = 0;
int default_index = 0; bool ok = false;
bool ok = false; QComboBox *combo_box = combo_boxes.at(i);
if (!comboBox) if (!combo_box)
continue; continue;
default_index = comboBox->property("default_index").toInt(&ok); default_index = combo_box->property("default_index").toInt(&ok);
if (!ok) if (!ok)
continue; continue;
if (default_index >= 0 && default_index < comboBox->count()) if (default_index >= 0 && default_index < combo_box->count())
comboBox->setCurrentIndex(default_index); combo_box->setCurrentIndex(default_index);
} }
} }

View File

@ -13,14 +13,14 @@ ThumbnailDelegate::ThumbnailDelegate(const GridItem &gridItem, QObject* parent)
void ThumbnailDelegate::paint(QPainter* painter, const QStyleOptionViewItem &option, const QModelIndex& index) const void ThumbnailDelegate::paint(QPainter* painter, const QStyleOptionViewItem &option, const QModelIndex& index) const
{ {
QStyleOptionViewItem opt = option; QStyleOptionViewItem opt = option;
const QWidget *widget = opt.widget; const QWidget *widget = opt.widget;
QStyle *style = widget->style(); QStyle *style = widget->style();
int padding = m_style.padding; int padding = m_style.padding;
int textTopMargin = 4; /* Qt seemingly reports -4 the actual line height. */ int text_top_margin = 4; /* Qt seemingly reports -4 the actual line height. */
int textHeight = painter->fontMetrics().height() + padding + padding; int text_height = painter->fontMetrics().height() + padding + padding;
QRect rect = opt.rect; QRect rect = opt.rect;
QRect adjusted = rect.adjusted(padding, padding, -padding, -textHeight + textTopMargin); QRect adjusted = rect.adjusted(padding, padding, -padding, -text_height + text_top_margin);
QPixmap pixmap = index.data(PlaylistModel::THUMBNAIL).value<QPixmap>(); QPixmap pixmap = index.data(PlaylistModel::THUMBNAIL).value<QPixmap>();
painter->save(); painter->save();
@ -40,7 +40,7 @@ void ThumbnailDelegate::paint(QPainter* painter, const QStyleOptionViewItem &opt
if (!opt.text.isEmpty()) if (!opt.text.isEmpty())
{ {
QPalette::ColorGroup cg = opt.state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled; QPalette::ColorGroup cg = opt.state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled;
QRect textRect = QRect(rect.x() + padding, rect.y() + adjusted.height() - textTopMargin + padding, rect.width() - 2 * padding, textHeight); 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); QString elidedText = painter->fontMetrics().elidedText(opt.text, opt.textElideMode, textRect.width(), Qt::TextShowMnemonic);
if (cg == QPalette::Normal && !(opt.state & QStyle::State_Active)) if (cg == QPalette::Normal && !(opt.state & QStyle::State_Active))
@ -84,14 +84,13 @@ void GridView::setviewMode(ViewMode mode)
void GridView::calculateRectsIfNecessary() const void GridView::calculateRectsIfNecessary() const
{ {
int row;
int nextX;
if (!m_hashIsDirty) if (!m_hashIsDirty)
return; return;
int x = m_spacing; int x = m_spacing;
int y = m_spacing; int y = m_spacing;
int row;
int nextX;
const int maxWidth = viewport()->width(); const int maxWidth = viewport()->width();
if (m_size + m_spacing * 2 > maxWidth) if (m_size + m_spacing * 2 > maxWidth)
@ -113,7 +112,8 @@ void GridView::calculateRectsIfNecessary() const
int columns = (maxWidth - m_spacing) / (m_size + m_spacing); int columns = (maxWidth - m_spacing) / (m_size + m_spacing);
if (columns > 0) if (columns > 0)
{ {
const int actualSpacing = (maxWidth - m_spacing - m_size - (columns - 1) * m_size) / columns; const int actualSpacing = (maxWidth - m_spacing -
m_size - (columns - 1) * m_size) / columns;
for (row = 0; row < model()->rowCount(); ++row) for (row = 0; row < model()->rowCount(); ++row)
{ {
nextX = x + m_size + actualSpacing; nextX = x + m_size + actualSpacing;
@ -134,8 +134,10 @@ void GridView::calculateRectsIfNecessary() const
int columns = (maxWidth - m_spacing) / (m_size + m_spacing); int columns = (maxWidth - m_spacing) / (m_size + m_spacing);
if (columns > 0) if (columns > 0)
{ {
const int actualSpacing = (maxWidth - columns * m_size) / (columns + 1); const int actualSpacing = (maxWidth - columns * m_size)
x = actualSpacing; / (columns + 1);
x = actualSpacing;
for (row = 0; row < model()->rowCount(); ++row) for (row = 0; row < model()->rowCount(); ++row)
{ {
nextX = x + m_size + actualSpacing; nextX = x + m_size + actualSpacing;

View File

@ -169,7 +169,7 @@ void ShaderParamsDialog::clearLayout()
m_layout = new QVBoxLayout(); m_layout = new QVBoxLayout();
widget = new QWidget(); widget = new QWidget();
widget->setLayout(m_layout); widget->setLayout(m_layout);
widget->setObjectName("shaderParamsWidget"); widget->setObjectName("shaderParamsWidget");

View File

@ -38,14 +38,9 @@ extern "C" {
#include "../ui_qt.h" #include "../ui_qt.h"
static AppHandler *appHandler; static AppHandler *app_handler;
static ui_application_qt_t ui_application; static ui_application_qt_t ui_application;
/* these must last for the lifetime of the QApplication */
static int app_argc = 1;
static char app_name[] = "retroarch";
static char *app_argv[] = { app_name, NULL };
/* ARGB 16x16 */ /* ARGB 16x16 */
static const unsigned retroarch_qt_icon_data[] = { static const unsigned retroarch_qt_icon_data[] = {
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000, 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
@ -94,7 +89,12 @@ void AppHandler::onLastWindowClosed()
static void* ui_application_qt_initialize(void) static void* ui_application_qt_initialize(void)
{ {
appHandler = new AppHandler(); /* These must last for the lifetime of the QApplication */
static int app_argc = 1;
static char app_name[] = "retroarch";
static char *app_argv[] = { app_name, NULL };
app_handler = new AppHandler();
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) #if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
/* HiDpi supported since Qt 5.6 */ /* HiDpi supported since Qt 5.6 */
@ -107,7 +107,8 @@ static void* ui_application_qt_initialize(void)
ui_application.app->setOrganizationName("libretro"); ui_application.app->setOrganizationName("libretro");
ui_application.app->setApplicationName("RetroArch"); ui_application.app->setApplicationName("RetroArch");
ui_application.app->setApplicationVersion(PACKAGE_VERSION); ui_application.app->setApplicationVersion(PACKAGE_VERSION);
ui_application.app->connect(ui_application.app, SIGNAL(lastWindowClosed()), appHandler, SLOT(onLastWindowClosed())); ui_application.app->connect(ui_application.app, SIGNAL(lastWindowClosed()),
app_handler, SLOT(onLastWindowClosed()));
#ifdef Q_OS_UNIX #ifdef Q_OS_UNIX
setlocale(LC_NUMERIC, "C"); setlocale(LC_NUMERIC, "C");
@ -137,8 +138,8 @@ static void ui_application_qt_process_events(void)
static void ui_application_qt_quit(void) static void ui_application_qt_quit(void)
{ {
if (appHandler) if (app_handler)
appHandler->exit(); app_handler->exit();
} }
#ifdef HAVE_MAIN #ifdef HAVE_MAIN

View File

@ -105,16 +105,16 @@ extern "C" {
static ui_window_qt_t ui_window = {0}; static ui_window_qt_t ui_window = {0};
enum CoreSelection enum core_selection
{ {
CORE_SELECTION_CURRENT, CORE_SELECTION_CURRENT = 0,
CORE_SELECTION_PLAYLIST_SAVED, CORE_SELECTION_PLAYLIST_SAVED,
CORE_SELECTION_PLAYLIST_DEFAULT, CORE_SELECTION_PLAYLIST_DEFAULT,
CORE_SELECTION_ASK, CORE_SELECTION_ASK,
CORE_SELECTION_LOAD_CORE CORE_SELECTION_LOAD_CORE
}; };
static const QPixmap getInvader() static const QPixmap getInvader(void)
{ {
QPixmap pix; QPixmap pix;
pix.loadFromData(invader_png, invader_png_len, "PNG"); pix.loadFromData(invader_png, invader_png_len, "PNG");
@ -1179,7 +1179,7 @@ void MainWindow::onLaunchWithComboBoxIndexChanged(int)
QVector<QHash<QString, QString> > infoList = getCoreInfo(); QVector<QHash<QString, QString> > infoList = getCoreInfo();
QString coreInfoText; QString coreInfoText;
QVariantMap coreMap = m_launchWithComboBox->currentData(Qt::UserRole).value<QVariantMap>(); QVariantMap coreMap = m_launchWithComboBox->currentData(Qt::UserRole).value<QVariantMap>();
CoreSelection coreSelection = static_cast<CoreSelection>(coreMap.value("core_selection").toInt()); core_selection coreSelection = static_cast<core_selection>(coreMap.value("core_selection").toInt());
int i = 0; int i = 0;
if (infoList.count() == 0) if (infoList.count() == 0)
@ -1795,7 +1795,7 @@ void MainWindow::onStartCoreClicked()
QHash<QString, QString> MainWindow::getSelectedCore() QHash<QString, QString> MainWindow::getSelectedCore()
{ {
QVariantMap coreMap = m_launchWithComboBox->currentData(Qt::UserRole).value<QVariantMap>(); QVariantMap coreMap = m_launchWithComboBox->currentData(Qt::UserRole).value<QVariantMap>();
CoreSelection coreSelection = static_cast<CoreSelection>(coreMap.value("core_selection").toInt()); core_selection coreSelection = static_cast<core_selection>(coreMap.value("core_selection").toInt());
QHash<QString, QString> coreHash; QHash<QString, QString> coreHash;
QHash<QString, QString> contentHash; QHash<QString, QString> contentHash;
ViewType viewType = getCurrentViewType(); ViewType viewType = getCurrentViewType();
@ -1864,7 +1864,7 @@ void MainWindow::loadContent(const QHash<QString, QString> &contentHash)
const char *contentDbName = NULL; const char *contentDbName = NULL;
const char *contentCrc32 = NULL; const char *contentCrc32 = NULL;
QVariantMap coreMap = m_launchWithComboBox->currentData(Qt::UserRole).value<QVariantMap>(); QVariantMap coreMap = m_launchWithComboBox->currentData(Qt::UserRole).value<QVariantMap>();
CoreSelection coreSelection = static_cast<CoreSelection>(coreMap.value("core_selection").toInt()); core_selection coreSelection = static_cast<core_selection>(coreMap.value("core_selection").toInt());
contentDbNameFull[0] = '\0'; contentDbNameFull[0] = '\0';

View File

@ -25,7 +25,7 @@ extern "C" {
#define TEMP_EXTENSION ".update_tmp" #define TEMP_EXTENSION ".update_tmp"
#define RETROARCH_NIGHTLY_UPDATE_PATH "../RetroArch_update.zip" #define RETROARCH_NIGHTLY_UPDATE_PATH "../RetroArch_update.zip"
static void extractUpdateCB(retro_task_t *task, static void extract_update_cb(retro_task_t *task,
void *task_data, void *user_data, const char *err) void *task_data, void *user_data, const char *err)
{ {
decompress_task_data_t *dec = (decompress_task_data_t*)task_data; decompress_task_data_t *dec = (decompress_task_data_t*)task_data;
@ -85,14 +85,16 @@ void MainWindow::onUpdateNetworkError(QNetworkReply::NetworkError code)
errorStringArray = reply->errorString().toUtf8(); 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);
/* 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. */
#if 0
reply->disconnect(); reply->disconnect();
reply->abort(); reply->abort();
reply->deleteLater(); reply->deleteLater();
*/ #endif
} }
void MainWindow::onUpdateNetworkSslErrors(const QList<QSslError> &errors) void MainWindow::onUpdateNetworkSslErrors(const QList<QSslError> &errors)
@ -106,7 +108,10 @@ void MainWindow::onUpdateNetworkSslErrors(const QList<QSslError> &errors)
for (i = 0; i < errors.count(); i++) for (i = 0; i < errors.count(); i++)
{ {
const QSslError &error = errors.at(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(); QByteArray stringArray = string.toUtf8();
const char *stringData = stringArray.constData(); const char *stringData = stringArray.constData();
@ -150,7 +155,8 @@ void MainWindow::onRetroArchUpdateDownloadFinished()
emit showErrorMessageDeferred(QString( emit showErrorMessageDeferred(QString(
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_NETWORK_ERROR)) msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_NETWORK_ERROR))
+ ": HTTP Code " + QString::number(code)); + ": HTTP Code " + QString::number(code));
RARCH_ERR("[Qt]: RetroArch update failed with HTTP status code: %d\n", code); RARCH_ERR("[Qt]: RetroArch update failed with HTTP status code: %d\n",
code);
reply->disconnect(); reply->disconnect();
reply->abort(); reply->abort();
reply->deleteLater(); reply->deleteLater();
@ -159,7 +165,7 @@ void MainWindow::onRetroArchUpdateDownloadFinished()
if (error == QNetworkReply::NoError) if (error == QNetworkReply::NoError)
{ {
int index = m_updateFile.fileName().lastIndexOf(PARTIAL_EXTENSION); int index = m_updateFile.fileName().lastIndexOf(PARTIAL_EXTENSION);
QString newFileName = m_updateFile.fileName().left(index); QString newFileName = m_updateFile.fileName().left(index);
QFile newFile(newFileName); QFile newFile(newFileName);
@ -171,12 +177,15 @@ void MainWindow::onRetroArchUpdateDownloadFinished()
if (m_updateFile.rename(newFileName)) if (m_updateFile.rename(newFileName))
{ {
RARCH_LOG("[Qt]: RetroArch update finished downloading successfully.\n"); RARCH_LOG("[Qt]: RetroArch update finished downloading successfully.\n");
emit extractArchiveDeferred(newFileName, ".", TEMP_EXTENSION, extractUpdateCB); emit extractArchiveDeferred(newFileName, ".", TEMP_EXTENSION,
extract_update_cb);
} }
else else
{ {
RARCH_ERR("[Qt]: RetroArch update finished, but temp file could not be renamed.\n"); RARCH_ERR("[Qt]: RetroArch update finished, but temp file could not be renamed.\n");
emit showErrorMessageDeferred(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_COULD_NOT_RENAME_FILE)); emit showErrorMessageDeferred(
msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_QT_COULD_NOT_RENAME_FILE));
} }
} }
} }
@ -212,10 +221,11 @@ void MainWindow::onUpdateRetroArchFinished(bool success)
emit showInfoMessageDeferred(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_UPDATE_RETROARCH_FINISHED)); emit showInfoMessageDeferred(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_UPDATE_RETROARCH_FINISHED));
} }
void MainWindow::onUpdateDownloadProgress(qint64 bytesReceived, qint64 bytesTotal) void MainWindow::onUpdateDownloadProgress(
qint64 bytesReceived, qint64 bytesTotal)
{ {
QNetworkReply *reply = m_updateReply.data(); QNetworkReply *reply = m_updateReply.data();
int progress = (bytesReceived / (float)bytesTotal) * 100.0f; int progress = (bytesReceived / (float)bytesTotal) * 100.0f;
if (!reply) if (!reply)
return; return;
@ -238,8 +248,8 @@ void MainWindow::updateRetroArchNightly()
QUrl url(QUrl(DEFAULT_BUILDBOT_SERVER_URL).resolved(QUrl(RETROARCH_NIGHTLY_UPDATE_PATH))); QUrl url(QUrl(DEFAULT_BUILDBOT_SERVER_URL).resolved(QUrl(RETROARCH_NIGHTLY_UPDATE_PATH)));
QNetworkRequest request(url); QNetworkRequest request(url);
QNetworkReply *reply = NULL; QNetworkReply *reply = NULL;
QByteArray urlArray = url.toString().toUtf8(); QByteArray urlArray = url.toString().toUtf8();
const char *urlData = urlArray.constData(); const char *urlData = urlArray.constData();
if (m_updateFile.isOpen()) if (m_updateFile.isOpen())
{ {
@ -248,7 +258,8 @@ void MainWindow::updateRetroArchNightly()
} }
else else
{ {
QString fileName = QFileInfo(url.toString()).fileName() + PARTIAL_EXTENSION; QString fileName = QFileInfo(url.toString()).fileName()
+ PARTIAL_EXTENSION;
QByteArray fileNameArray = fileName.toUtf8(); QByteArray fileNameArray = fileName.toUtf8();
const char *fileNameData = fileNameArray.constData(); const char *fileNameData = fileNameArray.constData();
@ -273,7 +284,8 @@ void MainWindow::updateRetroArchNightly()
m_updateProgressDialog->setAutoClose(true); m_updateProgressDialog->setAutoClose(true);
m_updateProgressDialog->setAutoReset(true); m_updateProgressDialog->setAutoReset(true);
m_updateProgressDialog->setValue(0); m_updateProgressDialog->setValue(0);
m_updateProgressDialog->setLabelText(QString(msg_hash_to_str(MSG_DOWNLOADING)) + "..."); m_updateProgressDialog->setLabelText(QString(
msg_hash_to_str(MSG_DOWNLOADING)) + "...");
m_updateProgressDialog->setCancelButtonText(tr("Cancel")); m_updateProgressDialog->setCancelButtonText(tr("Cancel"));
m_updateProgressDialog->show(); m_updateProgressDialog->show();

View File

@ -34,10 +34,6 @@ extern "C" {
#endif #endif
#ifdef HAVE_MENU #ifdef HAVE_MENU
static const int MAX_MIN_WIDTH = 250;
static const int MAX_MIN_HEIGHT = 250;
QPixmap getColorizedPixmap(const QPixmap& oldPixmap, const QColor& color) QPixmap getColorizedPixmap(const QPixmap& oldPixmap, const QColor& color)
{ {
QPixmap pixmap = oldPixmap; QPixmap pixmap = oldPixmap;
@ -90,7 +86,9 @@ private:
QSize minimumSizeHint() const final QSize minimumSizeHint() const final
{ {
QWidget *inner = widget(); static const int max_min_width = 250;
static const int max_min_height = 250;
QWidget *inner = widget();
if (inner) if (inner)
{ {
@ -99,8 +97,8 @@ private:
minSize += QSize(fw, fw); minSize += QSize(fw, fw);
minSize += QSize(scrollBarWidth(), 0); minSize += QSize(scrollBarWidth(), 0);
minSize.setWidth(qMin(minSize.width(), MAX_MIN_WIDTH)); minSize.setWidth(qMin(minSize.width(), max_min_width));
minSize.setHeight(qMin(minSize.height(), MAX_MIN_HEIGHT)); minSize.setHeight(qMin(minSize.height(), max_min_height));
return minSize; return minSize;
} }
return QSize(0, 0); return QSize(0, 0);
@ -236,9 +234,7 @@ void ViewOptionsDialog::repaintIcons()
for (i = 0; i < m_categoryList.size(); i++) for (i = 0; i < m_categoryList.size(); i++)
m_optionsList->item(i)->setIcon(getIcon(m_categoryList.at(i))); m_optionsList->item(i)->setIcon(getIcon(m_categoryList.at(i)));
} }
#else #else
ViewOptionsDialog::ViewOptionsDialog(MainWindow *mainwindow, QWidget *parent) : ViewOptionsDialog::ViewOptionsDialog(MainWindow *mainwindow, QWidget *parent) :
QDialog(mainwindow) QDialog(mainwindow)
, m_viewOptionsWidget(new ViewOptionsWidget(mainwindow)) , m_viewOptionsWidget(new ViewOptionsWidget(mainwindow))
@ -261,7 +257,6 @@ ViewOptionsDialog::ViewOptionsDialog(MainWindow *mainwindow, QWidget *parent) :
setLayout(layout); setLayout(layout);
} }
#endif #endif
void ViewOptionsDialog::showDialog() void ViewOptionsDialog::showDialog()
@ -336,8 +331,10 @@ ViewOptionsWidget::ViewOptionsWidget(MainWindow *mainwindow, QWidget *parent) :
form->addRow(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_SAVE_LAST_TAB), m_saveLastTabCheckBox); form->addRow(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_SAVE_LAST_TAB), m_saveLastTabCheckBox);
form->addRow(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_SHOW_HIDDEN_FILES), m_showHiddenFilesCheckBox); form->addRow(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_SHOW_HIDDEN_FILES), m_showHiddenFilesCheckBox);
form->addRow(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_SUGGEST_LOADED_CORE_FIRST), m_suggestLoadedCoreFirstCheckBox); form->addRow(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_SUGGEST_LOADED_CORE_FIRST), m_suggestLoadedCoreFirstCheckBox);
/* form->addRow(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_ALL_PLAYLISTS_LIST_MAX_COUNT), m_allPlaylistsListMaxCountSpinBox); */ #if 0
/* form->addRow(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_ALL_PLAYLISTS_GRID_MAX_COUNT), m_allPlaylistsGridMaxCountSpinBox); */ form->addRow(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_ALL_PLAYLISTS_LIST_MAX_COUNT), m_allPlaylistsListMaxCountSpinBox);
form->addRow(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_ALL_PLAYLISTS_GRID_MAX_COUNT), m_allPlaylistsGridMaxCountSpinBox);
#endif
form->addRow(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_STARTUP_PLAYLIST), m_startupPlaylistComboBox); form->addRow(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_STARTUP_PLAYLIST), m_startupPlaylistComboBox);
form->addRow(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THUMBNAIL_CACHE_LIMIT), m_thumbnailCacheSpinBox); form->addRow(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THUMBNAIL_CACHE_LIMIT), m_thumbnailCacheSpinBox);
form->addRow(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THUMBNAIL_DROP_SIZE_LIMIT), m_thumbnailDropSizeSpinBox); form->addRow(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THUMBNAIL_DROP_SIZE_LIMIT), m_thumbnailDropSizeSpinBox);
@ -392,12 +389,16 @@ void ViewOptionsWidget::onThemeComboBoxIndexChanged(int)
void ViewOptionsWidget::onHighlightColorChoose() void ViewOptionsWidget::onHighlightColorChoose()
{ {
QPixmap highlightPixmap(m_highlightColorPushButton->iconSize()); QPixmap highlightPixmap(m_highlightColorPushButton->iconSize());
QColor currentHighlightColor = m_settings->value("highlight_color", QApplication::palette().highlight().color()).value<QColor>(); QColor currentHighlightColor = m_settings->value("highlight_color",
QColor newHighlightColor = QColorDialog::getColor(currentHighlightColor, this, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_SELECT_COLOR)); QApplication::palette().highlight().color()).value<QColor>();
QColor newHighlightColor = QColorDialog::getColor(
currentHighlightColor, this,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_SELECT_COLOR));
if (newHighlightColor.isValid()) if (newHighlightColor.isValid())
{ {
MainWindow::Theme theme = static_cast<MainWindow::Theme>(m_themeComboBox->currentData(Qt::UserRole).toInt()); MainWindow::Theme theme = static_cast<MainWindow::Theme>(
m_themeComboBox->currentData(Qt::UserRole).toInt());
m_highlightColor = newHighlightColor; m_highlightColor = newHighlightColor;
m_settings->setValue("highlight_color", m_highlightColor); m_settings->setValue("highlight_color", m_highlightColor);
@ -422,8 +423,10 @@ void ViewOptionsWidget::loadViewOptions()
m_saveLastTabCheckBox->setChecked(m_settings->value("save_last_tab", false).toBool()); m_saveLastTabCheckBox->setChecked(m_settings->value("save_last_tab", false).toBool());
m_showHiddenFilesCheckBox->setChecked(m_settings->value("show_hidden_files", true).toBool()); m_showHiddenFilesCheckBox->setChecked(m_settings->value("show_hidden_files", true).toBool());
m_suggestLoadedCoreFirstCheckBox->setChecked(m_settings->value("suggest_loaded_core_first", false).toBool()); m_suggestLoadedCoreFirstCheckBox->setChecked(m_settings->value("suggest_loaded_core_first", false).toBool());
/* m_allPlaylistsListMaxCountSpinBox->setValue(m_settings->value("all_playlists_list_max_count", 0).toInt()); */ #if 0
/* m_allPlaylistsGridMaxCountSpinBox->setValue(m_settings->value("all_playlists_grid_max_count", 5000).toInt()); */ m_allPlaylistsListMaxCountSpinBox->setValue(m_settings->value("all_playlists_list_max_count", 0).toInt());
m_allPlaylistsGridMaxCountSpinBox->setValue(m_settings->value("all_playlists_grid_max_count", 5000).toInt());
#endif
m_thumbnailCacheSpinBox->setValue(m_settings->value("thumbnail_cache_limit", 512).toInt()); m_thumbnailCacheSpinBox->setValue(m_settings->value("thumbnail_cache_limit", 512).toInt());
m_thumbnailDropSizeSpinBox->setValue(m_settings->value("thumbnail_max_size", 0).toInt()); m_thumbnailDropSizeSpinBox->setValue(m_settings->value("thumbnail_max_size", 0).toInt());
@ -479,8 +482,10 @@ void ViewOptionsWidget::saveViewOptions()
m_settings->setValue("show_hidden_files", m_showHiddenFilesCheckBox->isChecked()); m_settings->setValue("show_hidden_files", m_showHiddenFilesCheckBox->isChecked());
m_settings->setValue("highlight_color", m_highlightColor); m_settings->setValue("highlight_color", m_highlightColor);
m_settings->setValue("suggest_loaded_core_first", m_suggestLoadedCoreFirstCheckBox->isChecked()); m_settings->setValue("suggest_loaded_core_first", m_suggestLoadedCoreFirstCheckBox->isChecked());
/* m_settings->setValue("all_playlists_list_max_count", m_allPlaylistsListMaxCountSpinBox->value()); */ #if 0
/* m_settings->setValue("all_playlists_grid_max_count", m_allPlaylistsGridMaxCountSpinBox->value()); */ m_settings->setValue("all_playlists_list_max_count", m_allPlaylistsListMaxCountSpinBox->value());
m_settings->setValue("all_playlists_grid_max_count", m_allPlaylistsGridMaxCountSpinBox->value());
#endif
m_settings->setValue("initial_playlist", m_startupPlaylistComboBox->currentData(Qt::UserRole).toString()); m_settings->setValue("initial_playlist", m_startupPlaylistComboBox->currentData(Qt::UserRole).toString());
m_settings->setValue("thumbnail_cache_limit", m_thumbnailCacheSpinBox->value()); m_settings->setValue("thumbnail_cache_limit", m_thumbnailCacheSpinBox->value());
m_settings->setValue("thumbnail_max_size", m_thumbnailDropSizeSpinBox->value()); m_settings->setValue("thumbnail_max_size", m_thumbnailDropSizeSpinBox->value());
@ -488,8 +493,10 @@ void ViewOptionsWidget::saveViewOptions()
if (!m_mainwindow->customThemeString().isEmpty()) if (!m_mainwindow->customThemeString().isEmpty())
m_settings->setValue("custom_theme", m_customThemePath); m_settings->setValue("custom_theme", m_customThemePath);
/* m_mainwindow->setAllPlaylistsListMaxCount(m_allPlaylistsListMaxCountSpinBox->value()); */ #if 0
/* m_mainwindow->setAllPlaylistsGridMaxCount(m_allPlaylistsGridMaxCountSpinBox->value()); */ m_mainwindow->setAllPlaylistsListMaxCount(m_allPlaylistsListMaxCountSpinBox->value());
m_mainwindow->setAllPlaylistsGridMaxCount(m_allPlaylistsGridMaxCountSpinBox->value());
#endif
m_mainwindow->setThumbnailCacheLimit(m_thumbnailCacheSpinBox->value()); m_mainwindow->setThumbnailCacheLimit(m_thumbnailCacheSpinBox->value());
} }

View File

@ -136,11 +136,13 @@ static void app_terminate(void)
pos = [[CocoaView get] convertPoint:[event locationInWindow] fromView:nil]; pos = [[CocoaView get] convertPoint:[event locationInWindow] fromView:nil];
#endif #endif
// FIXME: Disable clipping until graphical offset issues are fixed /* FIXME: Disable clipping until graphical offset issues
//NSInteger window_number = [[[NSApplication sharedApplication] keyWindow] windowNumber]; * are fixed */
//if ([NSWindow windowNumberAtPoint:pos belowWindowWithWindowNumber:0] != window_number) { #if 0
// return; NSInteger window_number = [[[NSApplication sharedApplication] keyWindow] windowNumber];
//} if ([NSWindow windowNumberAtPoint:pos belowWindowWithWindowNumber:0] != window_number)
return;
#endif
/* Relative */ /* Relative */
apple->mouse_rel_x += (int16_t)event.deltaX; apple->mouse_rel_x += (int16_t)event.deltaX;
@ -199,8 +201,9 @@ static void app_terminate(void)
@end @end
/* TODO/FIXME - static global variables */
static int waiting_argc; static int waiting_argc;
static char** waiting_argv; static char **waiting_argv;
@implementation RetroArch_OSX @implementation RetroArch_OSX
@ -348,7 +351,7 @@ static char** waiting_argv;
if (mode.width > 0) if (mode.width > 0)
{ {
// HACK(sgc): ensure MTKView posts a drawable resize event /* HACK(sgc): ensure MTKView posts a drawable resize event */
[self.window setContentSize:NSMakeSize(mode.width-1, mode.height)]; [self.window setContentSize:NSMakeSize(mode.width-1, mode.height)];
} }
[self.window setContentSize:NSMakeSize(mode.width, mode.height)]; [self.window setContentSize:NSMakeSize(mode.width, mode.height)];

View File

@ -39,7 +39,6 @@
#import <AVFoundation/AVFoundation.h> #import <AVFoundation/AVFoundation.h>
static char msg_old[PATH_MAX_LENGTH];
#ifdef HAVE_COCOA_METAL #ifdef HAVE_COCOA_METAL
id<ApplePlatform> apple_platform; id<ApplePlatform> apple_platform;
#else #else
@ -47,9 +46,7 @@ static id apple_platform;
#endif #endif
static CFRunLoopObserverRef iterate_observer; static CFRunLoopObserverRef iterate_observer;
static size_t old_size = 0; /* Forward declaration */
/* forward declaration */
static void apple_rarch_exited(void); static void apple_rarch_exited(void);
static void rarch_enable_ui(void) static void rarch_enable_ui(void)
@ -326,14 +323,15 @@ enum
} }
-(NSString*)documentsDirectory { -(NSString*)documentsDirectory {
if ( _documentsDirectory == nil ) { if (_documentsDirectory == nil)
{
#if TARGET_OS_IOS #if TARGET_OS_IOS
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
#elif TARGET_OS_TV #elif TARGET_OS_TV
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
#endif #endif
_documentsDirectory = paths.firstObject; _documentsDirectory = paths.firstObject;
} }
return _documentsDirectory; return _documentsDirectory;
} }
@ -489,7 +487,7 @@ enum
- (void)mainMenuPushPop: (bool)pushp - (void)mainMenuPushPop: (bool)pushp
{ {
#if TARGET_OS_IOS #if TARGET_OS_IOS
if ( pushp ) if (pushp)
{ {
self.menu_count++; self.menu_count++;
RAMenuBase* next_menu = [RAMainMenu new]; RAMenuBase* next_menu = [RAMainMenu new];
@ -499,7 +497,7 @@ enum
} }
else else
{ {
if ( self.menu_count == 0 ) if (self.menu_count == 0)
[self.mainmenu reloadData]; [self.mainmenu reloadData];
else else
{ {
@ -592,28 +590,29 @@ static void *ui_companion_cocoatouch_init(void)
static void ui_companion_cocoatouch_notify_list_pushed(void *data, static void ui_companion_cocoatouch_notify_list_pushed(void *data,
file_list_t *list, file_list_t *menu_list) file_list_t *list, file_list_t *menu_list)
{ {
RetroArch_iOS *ap = (RetroArch_iOS *)apple_platform; static size_t old_size = 0;
bool pushp = false; RetroArch_iOS *ap = (RetroArch_iOS *)apple_platform;
size_t new_size = file_list_get_size( menu_list ); bool pushp = false;
size_t new_size = file_list_get_size(menu_list);
/* FIXME workaround for the double call */ /* FIXME workaround for the double call */
if ( old_size == 0 ) if (old_size == 0)
{ {
old_size = new_size; old_size = new_size;
return; return;
} }
if ( old_size == new_size ) if (old_size == new_size)
pushp = false; pushp = false;
else if ( old_size < new_size ) else if (old_size < new_size)
pushp = true; pushp = true;
else if ( old_size > new_size ) else if (old_size > new_size)
printf( "notify_list_pushed: old size should not be larger\n" ); printf("notify_list_pushed: old size should not be larger\n" );
old_size = new_size; old_size = new_size;
if (ap) if (ap)
[ap mainMenuPushPop: pushp]; [ap mainMenuPushPop: pushp];
} }
static void ui_companion_cocoatouch_notify_refresh(void *data) static void ui_companion_cocoatouch_notify_refresh(void *data)
@ -626,6 +625,7 @@ static void ui_companion_cocoatouch_notify_refresh(void *data)
static void ui_companion_cocoatouch_render_messagebox(const char *msg) static void ui_companion_cocoatouch_render_messagebox(const char *msg)
{ {
static char msg_old[PATH_MAX_LENGTH];
RetroArch_iOS *ap = (RetroArch_iOS *)apple_platform; RetroArch_iOS *ap = (RetroArch_iOS *)apple_platform;
if (ap && !string_is_equal(msg, msg_old)) if (ap && !string_is_equal(msg, msg_old))

View File

@ -53,8 +53,6 @@ extern "C" {
#define GROUPED_DRAGGING static_cast<QMainWindow::DockOption>(0) #define GROUPED_DRAGGING static_cast<QMainWindow::DockOption>(0)
#endif #endif
static bool already_started = false;
typedef struct ui_companion_qt typedef struct ui_companion_qt
{ {
ui_application_qt_t *app; ui_application_qt_t *app;
@ -652,11 +650,12 @@ static void ui_companion_qt_notify_content_loaded(void *data) { }
static void ui_companion_qt_toggle(void *data, bool force) static void ui_companion_qt_toggle(void *data, bool force)
{ {
ui_companion_qt_t *handle = (ui_companion_qt_t*)data; static bool already_started = false;
ui_window_qt_t *win_handle = (ui_window_qt_t*)handle->window; ui_companion_qt_t *handle = (ui_companion_qt_t*)data;
settings_t *settings = config_get_ptr(); ui_window_qt_t *win_handle = (ui_window_qt_t*)handle->window;
bool ui_companion_toggle = settings->bools.ui_companion_toggle; settings_t *settings = config_get_ptr();
bool video_fullscreen = settings->bools.video_fullscreen; bool ui_companion_toggle = settings->bools.ui_companion_toggle;
bool video_fullscreen = settings->bools.video_fullscreen;
if (ui_companion_toggle || force) if (ui_companion_toggle || force)
{ {

View File

@ -27,7 +27,8 @@
#include "../../ui_companion_driver.h" #include "../../ui_companion_driver.h"
#include "../../configuration.h" #include "../../configuration.h"
static bool ui_browser_window_win32_core(ui_browser_window_state_t *state, bool save) static bool ui_browser_window_win32_core(
ui_browser_window_state_t *state, bool save)
{ {
OPENFILENAME ofn; OPENFILENAME ofn;
bool okay = false; bool okay = false;

View File

@ -23,7 +23,8 @@
#include "../../ui_companion_driver.h" #include "../../ui_companion_driver.h"
static enum ui_msg_window_response ui_msg_window_win32_response(ui_msg_window_state *state, UINT response) static enum ui_msg_window_response ui_msg_window_win32_response(
ui_msg_window_state *state, UINT response)
{ {
switch (response) switch (response)
{ {

View File

@ -82,9 +82,10 @@ static void ui_window_win32_set_title(void *data, char *buf)
void ui_window_win32_set_droppable(void *data, bool droppable) void ui_window_win32_set_droppable(void *data, bool droppable)
{ {
/* Minimum supported client: Windows XP, minimum supported server: Windows 2000 Server */ /* Minimum supported client: Windows XP,
* minimum supported server: Windows 2000 Server */
ui_window_win32_t *window = (ui_window_win32_t*)data; ui_window_win32_t *window = (ui_window_win32_t*)data;
if (DragAcceptFiles_func != NULL) if (DragAcceptFiles_func)
DragAcceptFiles_func(window->hwnd, droppable); DragAcceptFiles_func(window->hwnd, droppable);
} }