Kill AssFile::GetWildcardList
It did not actually simplify or clarify any of the code that called it.
This commit is contained in:
parent
d3e2585faf
commit
33dd0abc7f
5 changed files with 8 additions and 15 deletions
|
@ -475,13 +475,6 @@ void AssFile::AddToRecent(wxString const& file) const {
|
|||
OPT_SET("Path/Last/Subtitles")->SetString(STD_STR(filepath.GetPath()));
|
||||
}
|
||||
|
||||
wxString AssFile::GetWildcardList(int mode) {
|
||||
if (mode == 0) return SubtitleFormat::GetWildcards(0);
|
||||
if (mode == 1) return "Advanced Substation Alpha (*.ass)|*.ass";
|
||||
if (mode == 2) return SubtitleFormat::GetWildcards(1);
|
||||
return "";
|
||||
}
|
||||
|
||||
int AssFile::Commit(wxString const& desc, int type, int amendId, AssEntry *single_line) {
|
||||
++commitId;
|
||||
// Allow coalescing only if it's the last change and the file has not been
|
||||
|
|
|
@ -147,9 +147,6 @@ public:
|
|||
void AddToRecent(wxString const& file) const;
|
||||
/// Can the file be saved in its current format?
|
||||
bool CanSave() const;
|
||||
/// @brief Get the list of wildcards supported
|
||||
/// @param mode 0 = open, 1 = save, 2 = export
|
||||
static wxString GetWildcardList(int mode);
|
||||
|
||||
/// @brief Get the script resolution
|
||||
/// @param[out] w Width
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
#include "../include/aegisub/context.h"
|
||||
#include "../main.h"
|
||||
#include "../subs_grid.h"
|
||||
#include "../subtitle_format.h"
|
||||
#include "../video_context.h"
|
||||
#include "../utils.h"
|
||||
|
||||
|
@ -262,7 +263,7 @@ struct subtitle_open : public Command {
|
|||
|
||||
void operator()(agi::Context *c) {
|
||||
wxString path = lagi_wxString(OPT_GET("Path/Last/Subtitles")->GetString());
|
||||
wxString filename = wxFileSelector(_("Open subtitles file"),path,"","",AssFile::GetWildcardList(0),wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
||||
wxString filename = wxFileSelector(_("Open subtitles file"),path,"","",SubtitleFormat::GetWildcards(0),wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
||||
if (!filename.empty()) {
|
||||
wxGetApp().frame->LoadSubtitles(filename);
|
||||
}
|
||||
|
@ -282,7 +283,7 @@ struct subtitle_open_charset : public Command {
|
|||
wxString path = lagi_wxString(OPT_GET("Path/Last/Subtitles")->GetString());
|
||||
|
||||
// Get options and load
|
||||
wxString filename = wxFileSelector(_("Open subtitles file"),path,"","",AssFile::GetWildcardList(0),wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
||||
wxString filename = wxFileSelector(_("Open subtitles file"),path,"","",SubtitleFormat::GetWildcards(0),wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
||||
if (!filename.empty()) {
|
||||
wxString charset = wxGetSingleChoice(_("Choose charset code:"), _("Charset"), agi::charset::GetEncodingsList<wxArrayString>(), c->parent, -1, -1, true, 250, 200);
|
||||
if (!charset.empty()) {
|
||||
|
@ -329,7 +330,7 @@ static void save_subtitles(agi::Context *c, wxString filename) {
|
|||
c->videoController->Stop();
|
||||
wxString path = lagi_wxString(OPT_GET("Path/Last/Subtitles")->GetString());
|
||||
wxFileName origPath(c->ass->filename);
|
||||
filename = wxFileSelector(_("Save subtitles file"), path, origPath.GetName() + ".ass", "ass", AssFile::GetWildcardList(1), wxFD_SAVE | wxFD_OVERWRITE_PROMPT, c->parent);
|
||||
filename = wxFileSelector(_("Save subtitles file"), path, origPath.GetName() + ".ass", "ass", "Advanced Substation Alpha (*.ass)|*.ass", wxFD_SAVE | wxFD_OVERWRITE_PROMPT, c->parent);
|
||||
if (filename.empty()) return;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include "charset_conv.h"
|
||||
#include "help_button.h"
|
||||
#include "libresrc/libresrc.h"
|
||||
#include "subtitle_format.h"
|
||||
|
||||
DialogExport::DialogExport(agi::Context *c)
|
||||
: wxDialog(c->parent, -1, _("Export"), wxDefaultPosition, wxSize(200, 100), wxCAPTION | wxCLOSE_BOX)
|
||||
|
@ -143,7 +144,7 @@ DialogExport::~DialogExport() {
|
|||
void DialogExport::OnProcess(wxCommandEvent &) {
|
||||
if (!TransferDataFromWindow()) return;
|
||||
|
||||
wxString filename = wxFileSelector(_("Export subtitles file"), "", "", "", AssFile::GetWildcardList(2), wxFD_SAVE | wxFD_OVERWRITE_PROMPT, this);
|
||||
wxString filename = wxFileSelector(_("Export subtitles file"), "", "", "", SubtitleFormat::GetWildcards(1), wxFD_SAVE | wxFD_OVERWRITE_PROMPT, this);
|
||||
if (filename.empty()) return;
|
||||
|
||||
for (size_t i = 0; i < filter_list->GetCount(); ++i) {
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
#include "persist_location.h"
|
||||
#include "selection_controller.h"
|
||||
#include "standard_paths.h"
|
||||
#include "subtitle_format.h"
|
||||
|
||||
using std::tr1::placeholders::_1;
|
||||
|
||||
|
@ -590,7 +591,7 @@ void DialogStyleManager::OnCurrentDelete() {
|
|||
void DialogStyleManager::OnCurrentImport() {
|
||||
// Get file name
|
||||
wxString path = lagi_wxString(OPT_GET("Path/Last/Subtitles")->GetString());
|
||||
wxString filename = wxFileSelector(_("Open subtitles file"),path,"","",AssFile::GetWildcardList(0),wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
||||
wxString filename = wxFileSelector(_("Open subtitles file"),path,"","",SubtitleFormat::GetWildcards(0),wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
||||
if (!filename) return;
|
||||
|
||||
OPT_SET("Path/Last/Subtitles")->SetString(STD_STR(wxFileName(filename).GetPath()));
|
||||
|
|
Loading…
Reference in a new issue