From 5273aa2861288dfcb0e83736b72f941707e76970 Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Mon, 30 Jul 2018 10:02:33 -0400 Subject: [PATCH 01/12] Qt: use native separators for playlist paths --- ui/drivers/qt/ui_qt_window.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ui/drivers/qt/ui_qt_window.cpp b/ui/drivers/qt/ui_qt_window.cpp index d77b59381a..fdc0caf022 100644 --- a/ui/drivers/qt/ui_qt_window.cpp +++ b/ui/drivers/qt/ui_qt_window.cpp @@ -1250,12 +1250,12 @@ void MainWindow::addFilesToPlaylist(QStringList files) if (files.count() == 1 && list.count() == 1 && i == 0) { fileBaseNameArray = selectedName.toUtf8(); - pathArray = selectedPath.toUtf8(); + pathArray = QDir::toNativeSeparators(selectedPath).toUtf8(); } else { fileBaseNameArray = fileInfo.baseName().toUtf8(); - pathArray = fileName.toUtf8(); + pathArray = QDir::toNativeSeparators(fileName).toUtf8(); } fileNameNoExten = fileBaseNameArray.constData(); @@ -1272,7 +1272,7 @@ void MainWindow::addFilesToPlaylist(QStringList files) } else { - corePathArray = selectedCore.value("core_path").toUtf8(); + corePathArray = QDir::toNativeSeparators(selectedCore.value("core_path")).toUtf8(); coreNameArray = selectedCore.value("core_name").toUtf8(); corePathData = corePathArray.constData(); coreNameData = coreNameArray.constData(); @@ -1290,7 +1290,7 @@ void MainWindow::addFilesToPlaylist(QStringList files) if (list->size == 1) { /* assume archives with one file should have that file loaded directly */ - pathArray = (QString(pathData) + "#" + list->elems[0].data).toUtf8(); + pathArray = QDir::toNativeSeparators(QString(pathData) + "#" + list->elems[0].data).toUtf8(); pathData = pathArray.constData(); } From 20a66e468eb8230d546688fb437ac66f29ee75b4 Mon Sep 17 00:00:00 2001 From: Tatsuya79 Date: Mon, 30 Jul 2018 17:26:58 +0200 Subject: [PATCH 02/12] Update ui_qt_themes.h --- ui/drivers/qt/ui_qt_themes.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/drivers/qt/ui_qt_themes.h b/ui/drivers/qt/ui_qt_themes.h index 1946618a52..2f8103d358 100644 --- a/ui/drivers/qt/ui_qt_themes.h +++ b/ui/drivers/qt/ui_qt_themes.h @@ -400,7 +400,7 @@ static const QString qt_theme_dark_stylesheet = QStringLiteral("" " background-color:rgb(40,40,40);\n" " border:3px solid %1;\n" "}\n" - "QScrollArea QWidget {\n" + "QWidget QScrollArea {\n" "background:rgb(25,25,25);\n" "}\n" ); From 50381a0463a32ad986d6c5a5606f403a1d4ce5f1 Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Mon, 30 Jul 2018 18:22:18 -0400 Subject: [PATCH 03/12] Qt: allow FileDropWidget to be styleable --- ui/drivers/qt/ui_qt_window.cpp | 13 +++++++++++++ ui/drivers/ui_qt.h | 1 + 2 files changed, 14 insertions(+) diff --git a/ui/drivers/qt/ui_qt_window.cpp b/ui/drivers/qt/ui_qt_window.cpp index fdc0caf022..539ac0cbea 100644 --- a/ui/drivers/qt/ui_qt_window.cpp +++ b/ui/drivers/qt/ui_qt_window.cpp @@ -217,6 +217,19 @@ FileDropWidget::FileDropWidget(QWidget *parent) : setAcceptDrops(true); } +void FileDropWidget::paintEvent(QPaintEvent *event) +{ + QStyleOption o; + QPainter p; + o.initFrom(this); + p.begin(this); + style()->drawPrimitive( + QStyle::PE_Widget, &o, &p, this); + p.end(); + + QWidget::paintEvent(event); +} + void FileDropWidget::keyPressEvent(QKeyEvent *event) { if (event->key() == Qt::Key_Delete) diff --git a/ui/drivers/ui_qt.h b/ui/drivers/ui_qt.h index 0a366071e5..c5ba02aaf5 100644 --- a/ui/drivers/ui_qt.h +++ b/ui/drivers/ui_qt.h @@ -153,6 +153,7 @@ protected: void dragEnterEvent(QDragEnterEvent *event); void dropEvent(QDropEvent *event); void keyPressEvent(QKeyEvent *event); + void paintEvent(QPaintEvent *event); }; class TableWidget : public QTableWidget From 1ceac715b3e4c3ef3025137ba9e610c00eecb251 Mon Sep 17 00:00:00 2001 From: Tatsuya79 Date: Tue, 31 Jul 2018 01:07:00 +0200 Subject: [PATCH 04/12] Update ui_qt_themes.h --- ui/drivers/qt/ui_qt_themes.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ui/drivers/qt/ui_qt_themes.h b/ui/drivers/qt/ui_qt_themes.h index 2f8103d358..d8e6baeb98 100644 --- a/ui/drivers/qt/ui_qt_themes.h +++ b/ui/drivers/qt/ui_qt_themes.h @@ -250,7 +250,6 @@ static const QString qt_theme_dark_stylesheet = QStringLiteral("" "}\n" "QPushButton[flat=\"true\"] {\n" " background-color: transparent;\n" - " border: 1px solid #ddd;\n" "}\n" "QRadioButton::indicator {\n" " width:18px;\n" @@ -400,7 +399,7 @@ static const QString qt_theme_dark_stylesheet = QStringLiteral("" " background-color:rgb(40,40,40);\n" " border:3px solid %1;\n" "}\n" - "QWidget QScrollArea {\n" + "QScrollArea QWidget {\n" "background:rgb(25,25,25);\n" "}\n" ); From e1b2d752ab17f1a858a6e7eacf1566118a8dd7c3 Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Mon, 30 Jul 2018 19:41:31 -0400 Subject: [PATCH 05/12] Qt: use complete base name in case file has periods in it --- ui/drivers/qt/ui_qt_window.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/drivers/qt/ui_qt_window.cpp b/ui/drivers/qt/ui_qt_window.cpp index 539ac0cbea..e09b90f00d 100644 --- a/ui/drivers/qt/ui_qt_window.cpp +++ b/ui/drivers/qt/ui_qt_window.cpp @@ -1166,7 +1166,7 @@ void MainWindow::addFilesToPlaylist(QStringList files) if (info.isFile()) { - itemToAdd["label"] = info.baseName(); + itemToAdd["label"] = info.completeBaseName(); itemToAdd["path"] = path; } } @@ -1267,7 +1267,7 @@ void MainWindow::addFilesToPlaylist(QStringList files) } else { - fileBaseNameArray = fileInfo.baseName().toUtf8(); + fileBaseNameArray = fileInfo.completeBaseName().toUtf8(); pathArray = QDir::toNativeSeparators(fileName).toUtf8(); } From e63edfa6d27695c70e5893afce123ae6f637cf53 Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Mon, 30 Jul 2018 21:18:34 -0400 Subject: [PATCH 06/12] Qt: add button to playlist entry dialog to change the path to the content --- ui/drivers/qt/ui_qt_window.cpp | 42 +++++++++++++++++++++++++++++++--- ui/drivers/ui_qt.h | 2 ++ 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/ui/drivers/qt/ui_qt_window.cpp b/ui/drivers/qt/ui_qt_window.cpp index e09b90f00d..252acede86 100644 --- a/ui/drivers/qt/ui_qt_window.cpp +++ b/ui/drivers/qt/ui_qt_window.cpp @@ -393,7 +393,14 @@ PlaylistEntryDialog::PlaylistEntryDialog(MainWindow *mainwindow, QWidget *parent QFormLayout *form = new QFormLayout(); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); QVBoxLayout *databaseVBoxLayout = new QVBoxLayout(); + QHBoxLayout *pathHBoxLayout = new QHBoxLayout(); QLabel *databaseLabel = new QLabel(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_FOR_THUMBNAILS), this); + QToolButton *pathPushButton = new QToolButton(this); + + pathPushButton->setText("..."); + + pathHBoxLayout->addWidget(m_pathLineEdit); + pathHBoxLayout->addWidget(pathPushButton); databaseVBoxLayout->addWidget(m_databaseComboBox); databaseVBoxLayout->addWidget(databaseLabel); @@ -412,13 +419,25 @@ PlaylistEntryDialog::PlaylistEntryDialog(MainWindow *mainwindow, QWidget *parent connect(this, SIGNAL(rejected()), this, SLOT(onRejected())); form->addRow(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_NAME), m_nameLineEdit); - form->addRow(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_PATH), m_pathLineEdit); + form->addRow(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_PATH), pathHBoxLayout); form->addRow(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_CORE), m_coreComboBox); form->addRow(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_DATABASE), databaseVBoxLayout); qobject_cast(layout())->addLayout(form); layout()->addItem(new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding)); layout()->addWidget(buttonBox); + + connect(pathPushButton, SIGNAL(clicked()), this, SLOT(onPathClicked())); +} + +void PlaylistEntryDialog::onPathClicked() +{ + QString filePath = QFileDialog::getOpenFileName(this); + + if (filePath.isEmpty()) + return; + + m_pathLineEdit->setText(filePath); } void PlaylistEntryDialog::loadPlaylistOptions() @@ -1605,10 +1624,10 @@ bool MainWindow::updateCurrentPlaylistEntry(const QHash &conte return false; playlistPathArray = playlistPath.toUtf8(); - pathArray = path.toUtf8(); + pathArray = QDir::toNativeSeparators(path).toUtf8(); labelArray = label.toUtf8(); coreNameArray = coreName.toUtf8(); - corePathArray = corePath.toUtf8(); + corePathArray = QDir::toNativeSeparators(corePath).toUtf8(); dbNameArray = (dbName + file_path_str(FILE_PATH_LPL_EXTENSION)).toUtf8(); crc32Array = crc32.toUtf8(); @@ -1620,6 +1639,23 @@ bool MainWindow::updateCurrentPlaylistEntry(const QHash &conte dbNameData = dbNameArray.constData(); crc32Data = crc32Array.constData(); + if (path_is_compressed_file(pathData)) + { + struct string_list *list = file_archive_get_file_list(pathData, NULL); + + if (list) + { + if (list->size == 1) + { + /* assume archives with one file should have that file loaded directly */ + pathArray = QDir::toNativeSeparators(QString(pathData) + "#" + list->elems[0].data).toUtf8(); + pathData = pathArray.constData(); + } + + string_list_free(list); + } + } + playlist = playlist_init(playlistPathData, COLLECTION_SIZE); playlist_update(playlist, index, pathData, labelData, diff --git a/ui/drivers/ui_qt.h b/ui/drivers/ui_qt.h index c5ba02aaf5..aa8ae13b62 100644 --- a/ui/drivers/ui_qt.h +++ b/ui/drivers/ui_qt.h @@ -197,6 +197,8 @@ public slots: void hideDialog(); void onAccepted(); void onRejected(); +private slots: + void onPathClicked(); private: void loadPlaylistOptions(); From d5ae00f3d8e9729d853255b319b161d44fb682fc Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Mon, 30 Jul 2018 22:52:14 -0400 Subject: [PATCH 07/12] Qt: fix loading of content from grid view with core set to "ask me" --- ui/drivers/qt/ui_qt_window.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ui/drivers/qt/ui_qt_window.cpp b/ui/drivers/qt/ui_qt_window.cpp index 252acede86..45fa15dd86 100644 --- a/ui/drivers/qt/ui_qt_window.cpp +++ b/ui/drivers/qt/ui_qt_window.cpp @@ -3036,13 +3036,20 @@ void MainWindow::onRunClicked() ViewType viewType = getCurrentViewType(); QHash contentHash; - if (!item) - return; - if (viewType == VIEW_TYPE_LIST) + { + if (!item) + return; + contentHash = item->data(Qt::UserRole).value >(); + } else if (viewType == VIEW_TYPE_ICONS) + { contentHash = m_currentGridHash; + + if (contentHash.isEmpty()) + return; + } else return; From ea05b0f3cb19422e7b1edac96c8404ccaadb8618 Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Tue, 31 Jul 2018 00:15:59 -0400 Subject: [PATCH 08/12] Qt: "add entry" option for starting a new custom playlist entry --- intl/msg_hash_ja.h | 4 ++++ intl/msg_hash_us.h | 4 ++++ msg_hash.h | 2 ++ ui/drivers/qt/ui_qt_window.cpp | 32 ++++++++++++++++++++++++++++++-- 4 files changed, 40 insertions(+), 2 deletions(-) diff --git a/intl/msg_hash_ja.h b/intl/msg_hash_ja.h index 90f3bc554c..37a82697b7 100644 --- a/intl/msg_hash_ja.h +++ b/intl/msg_hash_ja.h @@ -3672,6 +3672,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_CANNOT_ADD_TO_ALL_PLAYLISTS, "まずひとつのプレイリストを選択してください。") MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_DELETE, "削除") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_ADD_ENTRY, + "エントリー作成...") MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_ADD_FILES, "ファイルを追加...") MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_ADD_FOLDER, @@ -3686,3 +3688,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_FIELD_MULTIPLE, "<複数>") MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_COULD_NOT_UPDATE_PLAYLIST_ENTRY, "プレイリストエントリーを更新するに失敗しました。") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_PLEASE_FILL_OUT_REQUIRED_FIELDS, + "必須フィールドがすべて入力されていることを確認してください。") diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index d92b15ab4b..7ba0c75c76 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -4188,6 +4188,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_CANNOT_ADD_TO_ALL_PLAYLISTS, "Please choose a single playlist first.") MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_DELETE, "Delete") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_ADD_ENTRY, + "Add Entry...") MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_ADD_FILES, "Add File(s)...") MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_ADD_FOLDER, @@ -4202,3 +4204,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_FIELD_MULTIPLE, "") MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_COULD_NOT_UPDATE_PLAYLIST_ENTRY, "Error updating playlist entry.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_PLEASE_FILL_OUT_REQUIRED_FIELDS, + "Please fill out all required fields.") diff --git a/msg_hash.h b/msg_hash.h index 47165cf0c3..6ee4239b93 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -1953,6 +1953,7 @@ enum msg_hash_enums MENU_ENUM_LABEL_VALUE_QT_FOR_THUMBNAILS, MENU_ENUM_LABEL_VALUE_QT_CANNOT_ADD_TO_ALL_PLAYLISTS, MENU_ENUM_LABEL_VALUE_QT_DELETE, + MENU_ENUM_LABEL_VALUE_QT_ADD_ENTRY, MENU_ENUM_LABEL_VALUE_QT_ADD_FILES, MENU_ENUM_LABEL_VALUE_QT_ADD_FOLDER, MENU_ENUM_LABEL_VALUE_QT_EDIT, @@ -1960,6 +1961,7 @@ enum msg_hash_enums MENU_ENUM_LABEL_VALUE_QT_SELECT_FOLDER, MENU_ENUM_LABEL_VALUE_QT_FIELD_MULTIPLE, MENU_ENUM_LABEL_VALUE_QT_COULD_NOT_UPDATE_PLAYLIST_ENTRY, + MENU_ENUM_LABEL_VALUE_QT_PLEASE_FILL_OUT_REQUIRED_FIELDS, MENU_LABEL(MIDI_INPUT), MENU_LABEL(MIDI_OUTPUT), diff --git a/ui/drivers/qt/ui_qt_window.cpp b/ui/drivers/qt/ui_qt_window.cpp index 45fa15dd86..396ce8d617 100644 --- a/ui/drivers/qt/ui_qt_window.cpp +++ b/ui/drivers/qt/ui_qt_window.cpp @@ -1178,7 +1178,14 @@ void MainWindow::addFilesToPlaylist(QStringList files) playlist_t *playlist = NULL; int i; - if (files.count() == 1) + /* Assume a blank list means we will manually enter in all fields. */ + if (files.isEmpty()) + { + /* Make sure hash isn't blank, that would mean there's multiple entries to add at once. */ + itemToAdd["label"] = ""; + itemToAdd["path"] = ""; + } + else if (files.count() == 1) { QString path = files.at(0); QFileInfo info(path); @@ -1224,6 +1231,16 @@ void MainWindow::addFilesToPlaylist(QStringList files) dialog.reset(new QProgressDialog(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_GATHERING_LIST_OF_FILES), "Cancel", 0, 0, this)); dialog->setWindowModality(Qt::ApplicationModal); + if (selectedName.isEmpty() || selectedPath.isEmpty() || + selectedDatabase.isEmpty()) + { + ui_window.qtWindow->showMessageBox(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_PLEASE_FILL_OUT_REQUIRED_FIELDS), MainWindow::MSGBOX_TYPE_ERROR, Qt::ApplicationModal, false); + return; + } + + if (files.isEmpty()) + files.append(selectedPath); + for (i = 0; i < files.count(); i++) { QString path(files.at(i)); @@ -1243,8 +1260,12 @@ void MainWindow::addFilesToPlaylist(QStringList files) } if (fileInfo.isFile()) - { list.append(fileInfo.absoluteFilePath()); + else if (files.count() == 1) + { + /* If adding a single file, tell user that it doesn't exist. */ + ui_window.qtWindow->showMessageBox(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_FILE_DOES_NOT_EXIST), MainWindow::MSGBOX_TYPE_ERROR, Qt::ApplicationModal, false); + return; } } @@ -1671,6 +1692,7 @@ bool MainWindow::updateCurrentPlaylistEntry(const QHash &conte void MainWindow::onFileDropWidgetContextMenuRequested(const QPoint &pos) { QScopedPointer menu; + QScopedPointer addEntryAction; QScopedPointer addFilesAction; QScopedPointer addFolderAction; QScopedPointer editAction; @@ -1681,11 +1703,13 @@ void MainWindow::onFileDropWidgetContextMenuRequested(const QPoint &pos) menu.reset(new QMenu(this)); + addEntryAction.reset(new QAction(QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_ADD_ENTRY)), this)); addFilesAction.reset(new QAction(QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_ADD_FILES)), this)); addFolderAction.reset(new QAction(QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_ADD_FOLDER)), this)); editAction.reset(new QAction(QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_EDIT)), this)); deleteAction.reset(new QAction(QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_DELETE)), this)); + menu->addAction(addEntryAction.data()); menu->addAction(addFilesAction.data()); menu->addAction(addFolderAction.data()); @@ -1707,6 +1731,10 @@ void MainWindow::onFileDropWidgetContextMenuRequested(const QPoint &pos) if (!filePaths.isEmpty()) addFilesToPlaylist(filePaths); } + else if (selectedAction == addEntryAction.data()) + { + addFilesToPlaylist(QStringList()); + } else if (selectedAction == addFolderAction.data()) { QString dirPath = QFileDialog::getExistingDirectory(this, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_SELECT_FOLDER), QString(), QFileDialog::ShowDirsOnly); From b60e35ce4841c6adf4752a43f3fa5a8ed063817b Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Tue, 31 Jul 2018 00:16:48 -0400 Subject: [PATCH 09/12] Update CHANGES.md --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index c352c0e012..1727d7a36e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -19,7 +19,7 @@ - MENU/QT/WIMP: QT QSlider styling for Dark Theme. - MENU/QT/WIMP: Remove button ghostly inside highlighting. - MENU/QT/WIMP: Initial grid view. -- MENU/QT/WIMP: Drag&drop to add new playlist items, add option to add/delete playlists. +- MENU/QT/WIMP: Drag&drop to add new playlist items, add option to add/edit/delete playlists. - METAL: Initial work-in-progress video driver for Metal. macOS-only right now, and currently requires macOS 10.13. - METAL: Supports XMB/MaterialUI, has a menu display driver. Has a font rendering driver. - METAL/SLANG: Slang shaders should be compatible with Metal video driver. From bdf5efd4ab162f8d3d50029b3f9a79fc56578c07 Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Tue, 31 Jul 2018 11:34:25 -0400 Subject: [PATCH 10/12] Qt: fix thumbnail display in file browser when name has dots in it --- ui/drivers/qt/ui_qt_window.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/drivers/qt/ui_qt_window.cpp b/ui/drivers/qt/ui_qt_window.cpp index 396ce8d617..89eef139db 100644 --- a/ui/drivers/qt/ui_qt_window.cpp +++ b/ui/drivers/qt/ui_qt_window.cpp @@ -2727,7 +2727,7 @@ void MainWindow::selectBrowserDir(QString path) hash["path"] = filePath; hash["label"] = hash["path"]; - hash["label_noext"] = fileInfo.fileName().remove(QString(".") + fileInfo.completeSuffix()); + hash["label_noext"] = fileInfo.completeBaseName(); hash["db_name"] = fileInfo.dir().dirName(); item->setData(Qt::UserRole, QVariant::fromValue >(hash)); From aec7ed40dad049754cc74d003f6a49da46df71d1 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 1 Aug 2018 01:15:58 +0200 Subject: [PATCH 11/12] This crashed Wayland --- gfx/drivers_context/wayland_ctx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gfx/drivers_context/wayland_ctx.c b/gfx/drivers_context/wayland_ctx.c index decbdedadd..2462fc5ef0 100644 --- a/gfx/drivers_context/wayland_ctx.c +++ b/gfx/drivers_context/wayland_ctx.c @@ -223,8 +223,8 @@ static const struct wl_keyboard_listener keyboard_listener = { keyboard_handle_enter, keyboard_handle_leave, keyboard_handle_key, - keyboard_handle_modifiers - //keyboard_handle_repeat_info + keyboard_handle_modifiers, + keyboard_handle_repeat_info }; static void gfx_ctx_wl_show_mouse(void *data, bool state); From 5b9115c848ffb2bb3d8df7dfa37f3d4d4218d02e Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 1 Aug 2018 01:27:30 +0200 Subject: [PATCH 12/12] C89_BUILD fixes --- command.c | 25 ++++++++++++++----------- libretro-common/file/file_path.c | 2 +- managers/cheat_manager.h | 18 +++++++++--------- retroarch.c | 11 ++++++----- 4 files changed, 30 insertions(+), 26 deletions(-) diff --git a/command.c b/command.c index 46a3e51a9c..768fa2b77b 100644 --- a/command.c +++ b/command.c @@ -264,23 +264,26 @@ static bool command_read_ram(const char *arg) { cheevos_var_t var; unsigned i; - char *reply = NULL; - const uint8_t * data = NULL; - char *reply_at = NULL; - unsigned int nbytes = 0; + char *reply = NULL; + const uint8_t * data = NULL; + char *reply_at = NULL; + unsigned int nbytes = 0; unsigned int alloc_size = 0; - int addr = -1; + int addr = -1; if (sscanf(arg, "%x %d", &addr, &nbytes) != 2) return true; - alloc_size = 40 + nbytes * 3; //We alloc more than needed, saving 20 bytes is not really relevant - reply = (char*) malloc(alloc_size); - reply[0] = '\0'; - reply_at = reply + sprintf(reply, SMY_CMD_STR " %x", addr); - var.value = addr; + alloc_size = 40 + nbytes * 3; /* We alloc more than needed, saving 20 bytes is not really relevant */ + reply = (char*) malloc(alloc_size); + reply[0] = '\0'; + reply_at = reply + sprintf(reply, SMY_CMD_STR " %x", addr); + + var.value = addr; + cheevos_var_patch_addr(&var, cheevos_get_console()); - data = cheevos_var_get_memory(&var); + + data = cheevos_var_get_memory(&var); if (data) { diff --git a/libretro-common/file/file_path.c b/libretro-common/file/file_path.c index 1b4bcbb2b2..b87b5fba04 100644 --- a/libretro-common/file/file_path.c +++ b/libretro-common/file/file_path.c @@ -922,7 +922,7 @@ void fill_pathname_join_delim(char *out_path, const char *dir, const char *path, const char delim, size_t size) { size_t copied; - // behavior of strlcpy is undefined if dst and src overlap + /* behavior of strlcpy is undefined if dst and src overlap */ if (out_path == dir) copied = strlen(dir); else diff --git a/managers/cheat_manager.h b/managers/cheat_manager.h index 163002ae8c..ce795d9cc0 100644 --- a/managers/cheat_manager.h +++ b/managers/cheat_manager.h @@ -52,7 +52,7 @@ enum cheat_search_type CHEAT_SEARCH_TYPE_EQ, CHEAT_SEARCH_TYPE_NEQ, CHEAT_SEARCH_TYPE_EQPLUS, - CHEAT_SEARCH_TYPE_EQMINUS, + CHEAT_SEARCH_TYPE_EQMINUS }; enum cheat_match_action_type @@ -113,19 +113,19 @@ struct item_cheat * 1 : 11110000 */ unsigned int address_mask ; - //Whether to apply the cheat based on big-endian console memory or not + /* Whether to apply the cheat based on big-endian console memory or not */ bool big_endian ; unsigned int rumble_type ; unsigned int rumble_value ; unsigned int rumble_prev_value ; unsigned int rumble_initialized ; - unsigned int rumble_port ; //0-15 for specific port, anything else means "all ports" - unsigned int rumble_primary_strength ; //0-65535 - unsigned int rumble_primary_duration ; //in milliseconds - retro_time_t rumble_primary_end_time ; //clock value for when rumbling should stop - unsigned int rumble_secondary_strength ; //0-65535 - unsigned int rumble_secondary_duration ; //in milliseconds - retro_time_t rumble_secondary_end_time ; //clock value for when rumbling should stop + unsigned int rumble_port ; /* 0-15 for specific port, anything else means "all ports" */ + unsigned int rumble_primary_strength ; /* 0-65535 */ + unsigned int rumble_primary_duration ; /* in milliseconds */ + retro_time_t rumble_primary_end_time ; /* clock value for when rumbling should stop */ + unsigned int rumble_secondary_strength ; /* 0-65535 */ + unsigned int rumble_secondary_duration ; /* in milliseconds */ + retro_time_t rumble_secondary_end_time ; /* clock value for when rumbling should stop */ }; struct cheat_manager diff --git a/retroarch.c b/retroarch.c index 89ba805e9e..6ec4ddf508 100644 --- a/retroarch.c +++ b/retroarch.c @@ -2713,16 +2713,17 @@ static enum runloop_state runloop_check_state( } else { - if ( global->menu.prev_action == action && global->menu.noop_press_time < 200000) //250ms + if ( global->menu.prev_action == action && + global->menu.noop_press_time < 200000) /* 250ms */ { - global->menu.action_start_time = global->menu.prev_start_time ; + global->menu.action_start_time = global->menu.prev_start_time ; global->menu.action_press_time = cpu_features_get_time_usec() - global->menu.action_start_time; } else { - global->menu.prev_start_time = cpu_features_get_time_usec() ; - global->menu.prev_action = action ; - global->menu.action_press_time = 0 ; + global->menu.prev_start_time = cpu_features_get_time_usec() ; + global->menu.prev_action = action; + global->menu.action_press_time = 0; } } }