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);