Esempio n. 1
0
sampledSet &SetsRepository::getSet(
    const dictionary &dict,
    const polyMesh &mesh
)
{
    word name(dict.lookup("setName"));

    if(debug) {
        Info << "SetsRepository: getting set " << name << endl;
    }

    if(sets_.found(name)) {
        if(debug) {
            Info << "SetsRepository: " << name << " already exists" << endl;
        }
        
        if(dict.found("set")) {
            WarningIn("SampledSet &SetsRepository::getSet")
                << "Already got a set named " << name 
                    << ". There is a specification for the set here "
                    << "which is ignored. It is: " << endl
                    << dict.subDict("set") << endl;
        }
        
        return getSet(name,mesh);
    } else {
        if(debug) {
            Info << "SetsRepository: " << name << " does not exist" << endl;
        }
        sets_.insert(
            name,
            sampledSet::New(
                name,
                mesh,
                getSearch(mesh),
                dict.subDict("set")
            ).ptr()
        );

        if(debug) {
            Info << "Created set " << name << " :" << endl;
            sets_[name]->write(Info);
            Info << endl;
        }
        return *sets_[name];
    }
}
void luProjPanel::OnObjSearchEnter(wxCommandEvent& event)
{
	wxSearchCtrl* search = getSearch();
	wxString text = search->GetValue().MakeLower();

	wxListCtrl* list = getListCtrl();
	for (int i = 0; i < list->GetItemCount(); i++)
	{
		if (list->GetItemText(i).MakeLower().find(text) != wxString::npos)
		{
			list->SetItemState(i, wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED, wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED);
			return;
		}
	}

	wxBell();
}
bool QSpotifySearch::event(QEvent *e)
{
    if (e->type() == QEvent::User) {
        auto ev = static_cast<SearchResultEvent*>(e);
        if (ev) {
            if (auto search = ev->getSearch()) {
                g_mutex.lock();
                bool is_current = (m_sp_search == search);
                g_mutex.unlock();
                if (sp_search_error(search) == SP_ERROR_OK && is_current) {
                    if(ev->getPtr()) {
                        switch(ev->getPtr()->mType) {
                        case Albums:
                            populateAlbums(search);
                            break;
                        case Artists:
                            populateArtists(search);
                            break;
                        case Playlists:
                            populatePlaylists(search);
                            break;
                        case Tracks:
                            populateTracks(search);
                            break;
                        default:
                            populateResults(search);
                            break;
                        }
                    } else
                        populateResults(search);
                }
                clearSearch(search);
            }
        }
        setBusy(false);

        emit resultsChanged();

        e->accept();
        return true;
    }
    return QObject::event(e);
}