ImageExporter::FormatList MagickImageExporter::supportedFormats() const { // uliss: FIXME this is stupid FormatList formats; formats.push_back(FORMAT_GIF); formats.push_back(FORMAT_JPEG); formats.push_back(FORMAT_PNG); return formats; }
QList<QTextLayout::FormatRange> UiStyle::toTextLayoutList(const FormatList &formatList, int textLength, quint32 messageLabel) const { QList<QTextLayout::FormatRange> formatRanges; QTextLayout::FormatRange range; int i = 0; for(i = 0; i < formatList.count(); i++) { range.format = format(formatList.at(i).second, messageLabel); range.start = formatList.at(i).first; if(i > 0) formatRanges.last().length = range.start - formatRanges.last().start; formatRanges.append(range); } if(i > 0) formatRanges.last().length = textLength - formatRanges.last().start; return formatRanges; }
FormatList Profile::getHIDWiegandFormatList() { FormatList formats; formats.push_back(boost::shared_ptr<Wiegand26Format>(new Wiegand26Format())); formats.push_back(boost::shared_ptr<Wiegand34Format>(new Wiegand34Format())); formats.push_back(boost::shared_ptr<Wiegand34WithFacilityFormat>(new Wiegand34WithFacilityFormat())); formats.push_back(boost::shared_ptr<Wiegand37Format>(new Wiegand37Format())); formats.push_back(boost::shared_ptr<Wiegand37WithFacilityFormat>(new Wiegand37WithFacilityFormat())); formats.push_back(boost::shared_ptr<DataClockFormat>(new DataClockFormat())); formats.push_back(boost::shared_ptr<Corporate1000Format>(new Corporate1000Format())); return formats; }
FormatList ProxProfile::getSupportedFormatList() { FormatList list = Profile::getHIDWiegandFormatList(); list.push_back(boost::shared_ptr<RawFormat>(new RawFormat())); return list; }
void BatchProcessDialog::OnApplyToFiles(wxCommandEvent & WXUNUSED(event)) { long item = mChains->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); if (item == -1) { wxMessageBox(_("No chain selected")); return; } wxString name = mChains->GetItemText(item); gPrefs->Write(wxT("/Batch/ActiveChain"), name); gPrefs->Flush(); AudacityProject *project = GetActiveProject(); if (!project->GetIsEmpty()) { wxMessageBox(_("Please save and close the current project first.")); return; } wxString path = gPrefs->Read(wxT("/DefaultOpenPath"), ::wxGetCwd()); wxString prompt = _("Select file(s) for batch processing..."); FormatList l; wxString filter; wxString all; l.DeleteContents(true); wxGetApp().mImporter->GetSupportedImportFormats(&l); for (FormatList::compatibility_iterator n = l.GetFirst(); n; n = n->GetNext()) { Format *f = n->GetData(); wxString newfilter = f->formatName + wxT("|"); for (size_t i = 0; i < f->formatExtensions.GetCount(); i++) { if (!newfilter.Contains(wxT("*.") + f->formatExtensions[i] + wxT(";"))) newfilter += wxT("*.") + f->formatExtensions[i] + wxT(";"); if (!all.Contains(wxT("*.") + f->formatExtensions[i] + wxT(";"))) all += wxT("*.") + f->formatExtensions[i] + wxT(";"); } newfilter.RemoveLast(1); filter += newfilter; filter += wxT("|"); } all.RemoveLast(1); filter.RemoveLast(1); wxString mask = _("All files|*|All supported files|") + all + wxT("|") + filter; wxString type = gPrefs->Read(wxT("/DefaultOpenType"),mask.BeforeFirst(wxT('|'))); // Convert the type to the filter index int index = mask.First(type + wxT("|")); if (index == wxNOT_FOUND) { index = 0; } else { index = mask.Left(index).Freq(wxT('|')) / 2; if (index < 0) { index = 0; } } FileDialog dlog(this, prompt, path, wxT(""), mask, wxFD_OPEN | wxFD_MULTIPLE | wxRESIZE_BORDER); dlog.SetFilterIndex(index); if (dlog.ShowModal() != wxID_OK) { return; } wxArrayString files; dlog.GetPaths(files); files.Sort(); wxDialog d(this, wxID_ANY, GetTitle()); ShuttleGui S(&d, eIsCreating); S.StartVerticalLay(false); { S.StartStatic(_("Applying..."), 1); { wxImageList *imageList = new wxImageList(9, 16); imageList->Add(wxIcon(empty_9x16_xpm)); imageList->Add(wxIcon(arrow_xpm)); S.SetStyle(wxSUNKEN_BORDER | wxLC_REPORT | wxLC_HRULES | wxLC_VRULES | wxLC_SINGLE_SEL); mList = S.Id(CommandsListID).AddListControlReportMode(); mList->AssignImageList(imageList, wxIMAGE_LIST_SMALL); mList->InsertColumn(0, _("File"), wxLIST_FORMAT_LEFT); } S.EndStatic(); S.StartHorizontalLay(wxCENTER, false); { S.Id(wxID_CANCEL).AddButton(_("&Cancel")); } S.EndHorizontalLay(); } S.EndVerticalLay(); int i; for (i = 0; i < (int)files.GetCount(); i++ ) { mList->InsertItem(i, files[i], i == 0); } // Set the column size for the files list. mList->SetColumnWidth(0, wxLIST_AUTOSIZE); int width = mList->GetColumnWidth(0); wxSize sz = mList->GetClientSize(); if (width > sz.GetWidth() && width < 500) { sz.SetWidth(width); mList->SetInitialSize(sz); } d.Layout(); d.Fit(); d.SetSizeHints(d.GetSize()); d.CenterOnScreen(); d.Move(-1, 0); d.Show(); Hide(); mBatchCommands.ReadChain(name); for (i = 0; i < (int)files.GetCount(); i++) { wxWindowDisabler wd(&d); if (i > 0) { //Clear the arrow in previous item. mList->SetItemImage(i - 1, 0, 0); } mList->SetItemImage(i, 1, 1); mList->EnsureVisible(i); project->OnRemoveTracks(); project->Import(files[i]); project->OnSelectAll(); if (!mBatchCommands.ApplyChain()) { break; } if (!d.IsShown() || mAbort) { break; } UndoManager *um = project->GetUndoManager(); um->ClearStates(); } project->OnRemoveTracks(); }