mirror of
https://github.com/libretro/RetroArch.git
synced 2025-02-19 17:12:10 +00:00
Qt: "add entry" option for starting a new custom playlist entry
This commit is contained in:
parent
d5ae00f3d8
commit
ea05b0f3cb
@ -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,
|
||||
"必須フィールドがすべて入力されていることを確認してください。")
|
||||
|
@ -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,
|
||||
"<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.")
|
||||
|
@ -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),
|
||||
|
@ -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<QString, QString> &conte
|
||||
void MainWindow::onFileDropWidgetContextMenuRequested(const QPoint &pos)
|
||||
{
|
||||
QScopedPointer<QMenu> menu;
|
||||
QScopedPointer<QAction> addEntryAction;
|
||||
QScopedPointer<QAction> addFilesAction;
|
||||
QScopedPointer<QAction> addFolderAction;
|
||||
QScopedPointer<QAction> 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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user