Exemple #1
0
void SearchThread::GetFiles(const SearchData* data, wxArrayString& files)
{
    wxStringSet_t scannedFiles;

    const wxArrayString& rootDirs = data->GetRootDirs();
    files = data->GetFiles();

    // Populate "scannedFiles" with list of files to scan
    scannedFiles.insert(files.begin(), files.end());

    for(size_t i = 0; i < rootDirs.size(); ++i) {
        // make sure it's really a dir (not a fifo, etc.)
        clFilesScanner scanner;
        std::vector<wxString> filesV;
        if(scanner.Scan(rootDirs.Item(i), filesV, data->GetExtensions())) {
            std::for_each(filesV.begin(), filesV.end(), [&](const wxString& file) { scannedFiles.insert(file); });
        }
    }

    files.clear();
    files.Alloc(scannedFiles.size());
    std::for_each(scannedFiles.begin(), scannedFiles.end(), [&](const wxString& file) { files.Add(file); });

    // Filter all non matching files
    FilterFiles(files, data);
}
void wxGenericFileDialog::GetPaths( wxArrayString& paths ) const
{
    paths.Empty();
    if (m_list->GetSelectedItemCount() == 0)
    {
        paths.Add( GetPath() );
        return;
    }

    paths.Alloc( m_list->GetSelectedItemCount() );

    wxString dir = m_list->GetDir();
#ifdef __UNIX__
    if (dir != wxT("/"))
#endif
#ifdef __WXWINCE__
        if (dir != wxT("/") && dir != wxT("\\"))
#endif
            dir += wxFILE_SEP_PATH;

    wxListItem item;
    item.m_mask = wxLIST_MASK_TEXT;

    item.m_itemId = m_list->GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
    while ( item.m_itemId != -1 )
    {
        m_list->GetItem( item );
        paths.Add( dir + item.m_text );
        item.m_itemId = m_list->GetNextItem( item.m_itemId,
                                             wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
    }
}
Exemple #3
0
void wxGenericFileDialog::GetFilenames(wxArrayString& files) const
{
#ifdef __WXGTK__
    m_list->GetFilenames(files);
#else
    files.Empty();
    if (m_list->GetSelectedItemCount() == 0)
    {
        files.Add( GetFilename() );
        return;
    }
    files.Alloc( m_list->GetSelectedItemCount() );

    wxListItem item;
    item.m_mask = wxLIST_MASK_TEXT;

    item.m_itemId = m_list->GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
    while ( item.m_itemId != -1 )
    {
        m_list->GetItem( item );
        files.Add( item.m_text );
        item.m_itemId = m_list->GetNextItem( item.m_itemId,
            wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
    }
#endif
}
void ImportM3U(const wxString & sM3UPath,wxArrayString & sFiles)
{
    sFiles.Clear();
    wxTextFile f(sM3UPath);
    if(!f.Open(wxConvISO8859_1))
    {
        wxLogError(_("File %s not found."),sM3UPath.c_str());
        return;
    }
    wxFileName fnM3UPath(sM3UPath);
    sFiles.Alloc(f.GetLineCount());
    for (size_t n =0; n < f.GetLineCount();n++)
    {
        wxString sLine(f[n]);
        sLine.Trim();
        if(sLine.IsEmpty())
            continue; // skip empty lines;
        else if(sLine.StartsWith(_T("#")))
            continue;//skip comments
        wxFileName fn(sLine);
        fn.Normalize(wxPATH_NORM_ALL,fnM3UPath.GetPath());
        sFiles.Add(fn.GetFullPath());
    }
    return;
}
void CMusikLibrary::Query( const wxString & query, wxArrayString & aReturn ,bool bClearArray )
{
	if(bClearArray)
	{
	    aReturn.Clear();
	    //--- run the query ---//
	    aReturn.Alloc( GetSongCount() );// just a guess
	}
    MusikDb::ResultCB cb(&aReturn, &db_callbackAddToStringArray);
    m_pDB->Exec(ConvQueryToMB( query ),cb);
}
Exemple #6
0
/* static */
const wxArrayString& PicType::getSupportedPicNames()
{
    static wxArrayString picNames;

    if (picNames.size() == 0)
    {
        // cache the array with the names of supported PICs
        picNames.Alloc(s_arrSupported.size());
        for(unsigned int i=0;i<s_arrSupported.size();i++)
            picNames.Add(s_arrSupported[i].name);

        picNames.Sort();
    }

    return picNames;
}
void FILEDIALOG::GetFilenames(wxArrayString& files) const
{
   files.Empty();
   if (m_list->GetSelectedItemCount() == 0)
   {
      files.Add( GetFilename() );
      return;
   }
   files.Alloc( m_list->GetSelectedItemCount() );
   
   wxListItem item;
   item.m_mask = wxLIST_MASK_TEXT;
   
   item.m_itemId = m_list->GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
   while ( item.m_itemId != -1 )
   {
      m_list->GetItem( item );
      files.Add( item.m_text );
      item.m_itemId = m_list->GetNextItem( item.m_itemId,
                                          wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
   }
}