Example #1
0
uint8_t MD_TCS230::readFSM(uint8_t	s)
// Finite State Machine to read a value (internal function)
{
	static const uint8_t	seq[] = { TCS230_RGB_R, TCS230_RGB_G, TCS230_RGB_B };
	static uint8_t	currCol;	// index for seq above

	switch(s)
	{
	case 0:	// enable the hardware for reading
		DUMPS("\n0");
		currCol = 0;	// RGB_R but we don't care
		setEnable(true);
		s++;
		// fall through to the next state

	case 1:	// select a filter and start a reading
		DUMPS("\n1");
		setFilter(seq[currCol]);
		FreqCount.begin(1000/_readDiv);
		s++;
		break;

	case 2:	// see if a value is available
		DUMPS("2");
		if (FreqCount.available())
		{
			DUMP(" VALUE ", FreqCount.read());
			// read the value and save it 
			_Fo.value[seq[currCol++]] = FreqCount.read() * _readDiv;

			if (currCol < RGB_SIZE)
			{
				// loop around again on next call to available()
				s--;
			}
			else
			{
				// end this reading session
				FreqCount.end();
				setEnable(false);
				RGBTransformation();
				s = 0;
			}
		}
		break;
	}

	return(s);
}
Example #2
0
UIConfig::UIConfig()
{
	m_Scale = 1;
	m_band = 0;
	m_column = 0;
	m_row = 0;
	debug = 0;
	setFilter( NN_FILTER );
	setCoordMode( ANA_MODE );
	m_delta_treshold = 0;
	m_translate = true;
	m_sync = true;
	m_aim = true;

}
Example #3
0
    Node::~Node()
    {
#if FZ_GL_SHADERS
        setFilter(NULL);
        setGLProgram(nullptr);
#endif
        if(p_camera)
            delete p_camera;
        
        Node *child;
        FZ_LIST_FOREACH_MUTABLE(m_children, child)
        {
            child->setParent(NULL);
            child->release();
        }
Example #4
0
void sim_bandstack_cb(GtkWidget *widget, gpointer data) {
  BANDSTACK_ENTRY *entry;
  fprintf(stderr,"sim_bandstack_cb\n");
  if(function) {
    entry=bandstack_entry_previous();
  } else {
    entry=bandstack_entry_next();
  }
  setFrequency(entry->frequencyA);
  setMode(entry->mode);
  FILTER* band_filters=filters[entry->mode];
  FILTER* band_filter=&band_filters[entry->filter];
  setFilter(band_filter->low,band_filter->high);
  vfo_update(NULL);
}
void LensDistortionTool::preparePreview()
{
    double m = d->mainInput->value();
    double e = d->edgeInput->value();
    double r = d->rescaleInput->value();
    double b = d->brightenInput->value();

    LensDistortionFilter transformPreview(&d->previewRasterImage, 0, m, e, r, b, 0, 0);
    transformPreview.startFilterDirectly();
    d->maskPreviewLabel->setPixmap(transformPreview.getTargetImage().convertToPixmap());

    ImageIface* const iface = d->previewWidget->imageIface();

    setFilter(new LensDistortionFilter(iface->original(), this, m, e, r, b, 0, 0));
}
Example #6
0
 Message::Message(const std::string& message)
     : m_command         (),
       m_commandStr      (),
       m_idPattern       (),
       m_filterBits      (Filter::Global),
       m_idMatchMethod   (nullptr),
       m_tagMatchMethod  (nullptr)
 {
     if (!message.empty())
     {
         setFilter(message);
         std::size_t startPos = message.find_first_of(']');
         m_command << (startPos == std::string::npos ? message : message.substr(std::min(message.length() - 1, message.find_first_not_of(' ', startPos + 1))));
     }
 }
Example #7
0
bool MultiQFileDialog::eventFilter(QObject *obj, QEvent *e)
{
    if (e->type() == QEvent::KeyPress)
    {
        QKeyEvent* keyEvent = dynamic_cast<QKeyEvent*>(e);
        Qt::KeyboardModifiers modifiers = QApplication::queryKeyboardModifiers();
        if (modifiers.testFlag(Qt::ControlModifier) && keyEvent && keyEvent->key() == Qt::Key_H)
        {
            if (showHidden)
            {
                if (multiSelect)
                {
                    setFilter(QDir::AllDirs | QDir::AllEntries | QDir::NoDotAndDotDot);
                }
                else
                {
                    setFilter(QDir::AllDirs | QDir::NoDotAndDotDot);
                }
            }
            else
            {
                if (multiSelect)
                {
                    setFilter(QDir::AllDirs | QDir::AllEntries | QDir::Hidden | QDir::System | QDir::NoDotAndDotDot);
                }
                else
                {
                    setFilter(QDir::AllDirs | QDir::Hidden | QDir::System | QDir::NoDotAndDotDot);
                }
            }
            showHidden = !showHidden;
        }
    }

    return QFileDialog::eventFilter(obj, e);
}
Example #8
0
  ImageViewerDirModel::ImageViewerDirModel(QObject *parent /*= 0*/)
  : QDirModel(parent) {

	  //insertColumn(1);
    QStringList nameFilterList;
    QList<QByteArray> formats = QImageReader::supportedImageFormats();
    for (QList<QByteArray>::iterator it = formats.begin();
         it != formats.end();
         ++it) {
      QString filter("*.");
      filter.append(it->data());
      nameFilterList << filter;
    }
    setNameFilters(nameFilterList);
    setFilter(QDir::Files);
  }
Example #9
0
void KNoteTip::timerEvent(QTimerEvent *)
{
    killTimers();

    if(!isVisible())
    {
        startTimer(15000);   // show the tooltip for 15 sec
        reposition();
        show();
    }
    else
    {
        setFilter(false);
        hide();
    }
}
Status ParsedUpdate::parseQueryToCQ() {
    dassert(!_canonicalQuery.get());

    const ExtensionsCallbackReal extensionsCallback(_opCtx, &_request->getNamespaceString());

    // The projection needs to be applied after the update operation, so we do not specify a
    // projection during canonicalization.
    auto qr = stdx::make_unique<QueryRequest>(_request->getNamespaceString());
    qr->setFilter(_request->getQuery());
    qr->setSort(_request->getSort());
    qr->setCollation(_request->getCollation());
    qr->setExplain(_request->isExplain());

    // Limit should only used for the findAndModify command when a sort is specified. If a sort
    // is requested, we want to use a top-k sort for efficiency reasons, so should pass the
    // limit through. Generally, a update stage expects to be able to skip documents that were
    // deleted/modified under it, but a limit could inhibit that and give an EOF when the update
    // has not actually updated a document. This behavior is fine for findAndModify, but should
    // not apply to update in general.
    if (!_request->isMulti() && !_request->getSort().isEmpty()) {
        qr->setLimit(1);
    }

    // $expr is not allowed in the query for an upsert, since it is not clear what the equality
    // extraction behavior for $expr should be.
    MatchExpressionParser::AllowedFeatureSet allowedMatcherFeatures =
        MatchExpressionParser::kAllowAllSpecialFeatures;
    if (_request->isUpsert()) {
        allowedMatcherFeatures &= ~MatchExpressionParser::AllowedFeatures::kExpr;
    }

    boost::intrusive_ptr<ExpressionContext> expCtx;
    auto statusWithCQ = CanonicalQuery::canonicalize(
        _opCtx, std::move(qr), std::move(expCtx), extensionsCallback, allowedMatcherFeatures);
    if (statusWithCQ.isOK()) {
        _canonicalQuery = std::move(statusWithCQ.getValue());
    }

    if (statusWithCQ.getStatus().code() == ErrorCodes::QueryFeatureNotAllowed) {
        // The default error message for disallowed $expr is not descriptive enough, so we rewrite
        // it here.
        return {ErrorCodes::QueryFeatureNotAllowed,
                "$expr is not allowed in the query predicate for an upsert"};
    }

    return statusWithCQ.getStatus();
}
Example #11
0
bool Image::loadVolatilePOT()
{
	glGenTextures(1,(GLuint *)&texture);
	bindTexture(texture);

	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

	float p2width = next_p2(width);
	float p2height = next_p2(height);
	float s = width/p2width;
	float t = height/p2height;

	vertices[1].t = t;
	vertices[2].t = t;
	vertices[2].s = s;
	vertices[3].s = s;

	glTexImage2D(GL_TEXTURE_2D,
				 0,
				 GL_RGBA8,
				 (GLsizei)p2width,
				 (GLsizei)p2height,
				 0,
				 GL_RGBA,
				 GL_UNSIGNED_BYTE,
				 0);

	glTexSubImage2D(GL_TEXTURE_2D,
					0,
					0,
					0,
					(GLsizei)width,
					(GLsizei)height,
					GL_RGBA,
					GL_UNSIGNED_BYTE,
					data->getData());

	setMipmapSharpness(mipmapsharpness);
	setFilter(filter);
	setWrap(wrap);

	return true;
}
Example #12
0
FilmModel::FilmModel(QObject *parent) :
    QSqlTableModel(parent)
{
    setTable("films");
    setEditStrategy(QSqlTableModel::OnManualSubmit);
    setSort(0, Qt::AscendingOrder);
    setFilter("");
    select();
    setHeaderData(1, Qt::Horizontal, "Name");
    setHeaderData(2, Qt::Horizontal, "Year");
    setHeaderData(3, Qt::Horizontal, "Country");
    setHeaderData(4, Qt::Horizontal, "Director");
    setHeaderData(5, Qt::Horizontal, "Actors");
    setHeaderData(6, Qt::Horizontal, "Type");
    setHeaderData(7, Qt::Horizontal, "Genre");
    setHeaderData(8, Qt::Horizontal, "Score");
}
Example #13
0
void ActionEditor::setFormWindow(QDesignerFormWindowInterface *formWindow)
{
    if (formWindow != 0 && formWindow->mainContainer() == 0)
        formWindow = 0;

    // we do NOT rely on this function to update the action editor
    if (m_formWindow == formWindow)
        return;

    if (m_formWindow != 0) {
        const ActionList actionList = m_formWindow->mainContainer()->findChildren<QAction*>();
        foreach (QAction *action, actionList)
            disconnect(action, SIGNAL(changed()), this, SLOT(slotActionChanged()));
    }

    m_formWindow = formWindow;

    m_actionView->model()->clearActions();

    m_actionEdit->setEnabled(false);
#ifndef QT_NO_CLIPBOARD
    m_actionCopy->setEnabled(false);
    m_actionCut->setEnabled(false);
#endif
    m_actionDelete->setEnabled(false);

    if (!formWindow || !formWindow->mainContainer()) {
        m_actionNew->setEnabled(false);
        m_filterWidget->setEnabled(false);
        return;
    }

    m_actionNew->setEnabled(true);
    m_filterWidget->setEnabled(true);

    const ActionList actionList = formWindow->mainContainer()->findChildren<QAction*>();
    foreach (QAction *action, actionList)
        if (!action->isSeparator() && core()->metaDataBase()->item(action) != 0) {
            // Show unless it has a menu. However, listen for change on menu actions also as it might be removed
            if (!action->menu())
                m_actionView->model()->addAction(action);
            connect(action, SIGNAL(changed()), this, SLOT(slotActionChanged()));
        }

    setFilter(m_filter);
}
Example #14
0
void sim_band_cb(GtkWidget *widget, gpointer data) {
  BAND* band;
  BANDSTACK_ENTRY *entry;
fprintf(stderr,"sim_band_cb\n");
  int b=band_get_current();
  if(function) {
    b--;
    if(b<0) {
      b=BANDS-1;
    }
#ifdef LIMESDR
    if(protocol!=LIMESDR_PROTOCOL) {
      if(b==band3400) {
        b=band6;
      }
    }
#endif
  } else {
    b++;
    if(b>=BANDS) {
      b=0;
    }
#ifdef LIMESDR
    if(protocol!=LIMESDR_PROTOCOL) {
      if(b==band70) { 
        b=bandGen;
      }
    }
#endif
  }
  band=band_set_current(b);
  entry=bandstack_entry_get_current();

  setFrequency(entry->frequencyA);
  setMode(entry->mode);
  FILTER* band_filters=filters[entry->mode];
  FILTER* band_filter=&band_filters[entry->filter];
  setFilter(band_filter->low,band_filter->high);

  band=band_get_current_band();
  set_alex_rx_antenna(band->alexRxAntenna);
  set_alex_tx_antenna(band->alexTxAntenna);
  set_alex_attenuation(band->alexAttenuation);
  vfo_update(NULL);
}
Example #15
0
RKImportDialog::RKImportDialog (const QString &context_id, QWidget *parent) : KFileDialog (KUrl (), QString (), parent, format_selector=new RKImportDialogFormatSelector ()) {
	RK_TRACE (DIALOGS);

	setModal (false);

	context = RKComponentMap::getContext (context_id);
	if (!context) {
		KMessageBox::sorry (this, i18n ("No plugins defined for context '%1'", context_id));
		return;
	}

	component_ids = context->components ();
	QString formats = "*|" + i18n ("All Files") + " (*)\n";
	int format_count = 0;
	for (QStringList::const_iterator it = component_ids.constBegin (); it != component_ids.constEnd (); ++it) {
		if (format_count++) formats.append ('\n');

		RKComponentHandle *handle = RKComponentMap::getComponentHandle (*it);
		if (!handle) {
			RK_ASSERT (false);
			continue;
		}

		QString filter = handle->getAttributeValue ("format");
		QString label = handle->getAttributeLabel ("format");

		QString elabel = label;
		elabel.replace ('/', "\\/");
		elabel.replace ('|', "\\|");
		formats.append (filter + '|' + elabel + " (" + filter + ')');

		format_labels.append (label);
		filters.append (filter);
	}

	// file format selection box
	format_selector->combo->insertItems (0, format_labels);

	// initialize
	setMode (KFile::File | KFile::ExistingOnly | KFile::LocalOnly);
	setFilter (formats);
	connect (this, SIGNAL (filterChanged(QString)), this, SLOT (filterWasChanged(QString)));
	filterWasChanged (QString ());
	show ();
}
/**
 * Test that hitting the cached plan stage trial period's threshold for work cycles causes the
 * query to be replanned. Also verify that the replanning results in a new plan cache entry.
 */
TEST_F(QueryStageCachedPlan, QueryStageCachedPlanHitMaxWorks) {
    AutoGetCollectionForReadCommand ctx(&_opCtx, nss);
    Collection* collection = ctx.getCollection();
    ASSERT(collection);

    // Query can be answered by either index on "a" or index on "b".
    auto qr = stdx::make_unique<QueryRequest>(nss);
    qr->setFilter(fromjson("{a: {$gte: 8}, b: 1}"));
    auto statusWithCQ = CanonicalQuery::canonicalize(opCtx(), std::move(qr));
    ASSERT_OK(statusWithCQ.getStatus());
    const std::unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());

    // We shouldn't have anything in the plan cache for this shape yet.
    PlanCache* cache = collection->infoCache()->getPlanCache();
    ASSERT(cache);
    ASSERT_EQ(cache->get(*cq).state, PlanCache::CacheEntryState::kNotPresent);

    // Get planner params.
    QueryPlannerParams plannerParams;
    fillOutPlannerParams(&_opCtx, collection, cq.get(), &plannerParams);

    // Set up queued data stage to take a long time before returning EOF. Should be long
    // enough to trigger a replan.
    const size_t decisionWorks = 10;
    const size_t mockWorks =
        1U + static_cast<size_t>(internalQueryCacheEvictionRatio * decisionWorks);
    auto mockChild = stdx::make_unique<QueuedDataStage>(&_opCtx, &_ws);
    for (size_t i = 0; i < mockWorks; i++) {
        mockChild->pushBack(PlanStage::NEED_TIME);
    }

    CachedPlanStage cachedPlanStage(
        &_opCtx, collection, &_ws, cq.get(), plannerParams, decisionWorks, mockChild.release());

    // This should succeed after triggering a replan.
    PlanYieldPolicy yieldPolicy(PlanExecutor::NO_YIELD,
                                _opCtx.getServiceContext()->getFastClockSource());
    ASSERT_OK(cachedPlanStage.pickBestPlan(&yieldPolicy));

    ASSERT_EQ(getNumResultsForStage(_ws, &cachedPlanStage, cq.get()), 2U);

    // This time we expect to find something in the plan cache. Replans after hitting the
    // works threshold result in a cache entry.
    ASSERT_EQ(cache->get(*cq).state, PlanCache::CacheEntryState::kPresentInactive);
}
Example #17
0
void JConsoleHandler::configure() {
    //TODO JLogManager* manager = JLogManager::getLogManager();
    //TODO JString cname = getClass()->getName();

    setLevel(JLevel::INFO);//TODO manager.getLevelProperty(cname +".level", Level.INFO));
    setFilter(NULL);//TODO manager.getFilterProperty(cname +".filter", null));
    setFormatter(new JSimpleFormatter());//TODO manager.getFormatterProperty(cname +".formatter", new SimpleFormatter()));
    try {
        setEncoding("");//TODO manager.getStringProperty(cname +".encoding", null));
    } catch (JException* ex) {
        delete ex;
        try {
            setEncoding("");
        } catch (JException* ex2) {
            delete ex2;
        }
    }
}
Example #18
0
void Terrain::setup() {
  frames = 0;
  meshResolution = 128;
  dist = 300;
  begin.set(18, 3, 194);
  end.set(38, 172, 22);
  indexLow = 0;
  indexHigh = 0;
  setColors(begin, end);
  gridSurfaceSetup();
  setPeeks();
  setBands(meshResolution);
  setFilter(1.25f);
  setSmoothingFactor(0.975f);
  cam.setDistance(dist);
  cam.enableMouseInput();
  ofBackground(0, 0, 0);
}
int qtMonitor::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: band_160_buttonPressed(); break;
        case 1: band_80_buttonPressed(); break;
        case 2: band_60_buttonPressed(); break;
        case 3: band_40_buttonPressed(); break;
        case 4: band_30_buttonPressed(); break;
        case 5: band_20_buttonPressed(); break;
        case 6: band_17_buttonPressed(); break;
        case 7: band_15_buttonPressed(); break;
        case 8: band_12_buttonPressed(); break;
        case 9: band_10_buttonPressed(); break;
        case 10: band_6_buttonPressed(); break;
        case 11: band_gen_buttonPressed(); break;
        case 12: mode_lsb_buttonPressed(); break;
        case 13: mode_usb_buttonPressed(); break;
        case 14: mode_dsb_buttonPressed(); break;
        case 15: mode_cwl_buttonPressed(); break;
        case 16: mode_cwu_buttonPressed(); break;
        case 17: mode_am_buttonPressed(); break;
        case 18: connect_buttonPressed(); break;
        case 19: socketError((*reinterpret_cast< QAbstractSocket::SocketError(*)>(_a[1]))); break;
        case 20: connected(); break;
        case 21: socketData(); break;
        case 22: update(); break;
        case 23: setMode((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 24: setFilter((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 25: setFrequency((*reinterpret_cast< long long(*)>(_a[1]))); break;
        case 26: moveFrequency((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 27: vfo_dialMoved((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 28: afgain_dialMoved((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 29: setGain((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 30: audioChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 31;
    }
    return _id;
}
Example #20
0
PlaylistWidget::PlaylistWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::PlaylistWidget)
{
    ui->setupUi(this);

    m_delegate = new TrackDelegate(this);
    ui->listView->setItemDelegate(m_delegate);
    ui->listView->setAcceptDrops(true);

    m_model = new PlaylistModel(this);
    m_model->setTrackCycler(Player::instance()->cycler());
    m_model->setMediaLibrary(Player::instance()->media());
    m_model->setFavoritesManager(Player::instance()->favorites());

    m_favFilterModel = new FavoritesFilterModel(this);
    m_favFilterModel->setSourceModel(m_model);
    m_favFilterModel->setDynamicSortFilter(true);
    connect(ui->listView,       SIGNAL(showFavoritesToggled(bool)), this,           SLOT(setFavoritesFilterEnabled(bool)));
    connect(m_favFilterModel,   SIGNAL(enabledChanged(bool)),       ui->listView,   SLOT(toggleFavorites(bool)));

    m_sortModel = new QSortFilterProxyModel(this);
    m_sortModel->setSourceModel(m_favFilterModel);
    m_sortModel->setFilterRole(PlaylistModel::SearchRole);
    m_sortModel->setDynamicSortFilter(true);
    m_sortModel->setFilterCaseSensitivity(Qt::CaseInsensitive);

    ui->listView->setModel(m_sortModel);

    connect(ui->clearButton,    SIGNAL(clicked()),              ui->filterEdit, SLOT(clear()));
    connect(ui->filterEdit,     SIGNAL(textChanged(QString)),   this,           SLOT(setFilter(QString)));

    TrackCycler * cycler = Player::instance()->cycler();
    if (cycler != 0) {
        connect(cycler, SIGNAL(trackChanged(PlayId)), this, SLOT(onTrackChanged(PlayId)));
    }

    PlaylistHistory *history = Player::instance()->history();
    if (history != 0) {
        connect(history,SIGNAL(currentChanged(Playlist*)),  this,   SLOT(setPlaylist(Playlist*)));
        connect(history,SIGNAL(countChanged()),             this,   SLOT(onPlaylistCountChanged()));
        setPlaylist(history->current());
    }
Example #21
0
    void run() {
        OldClientWriteContext ctx(&_txn, nss.ns());
        addIndex(BSON("a" << 1 << "b" << 1));
        addIndex(BSON("a" << 1 << "c" << 1));

        // Every doc matches.
        insert(BSON("_id" << 1 << "a" << 1));
        insert(BSON("_id" << 2 << "a" << 2));
        insert(BSON("_id" << 3 << "a" << 3));
        insert(BSON("_id" << 4));

        auto qr = stdx::make_unique<QueryRequest>(nss);
        qr->setFilter(fromjson("{$or: [{a: 1}, {a: {$ne:1}}]}"));
        qr->setSort(BSON("d" << 1));
        auto cq = unittest::assertGet(CanonicalQuery::canonicalize(
            txn(), std::move(qr), ExtensionsCallbackDisallowExtensions()));

        Collection* collection = ctx.getCollection();

        QueryPlannerParams plannerParams;
        fillOutPlannerParams(&_txn, collection, cq.get(), &plannerParams);

        WorkingSet ws;
        std::unique_ptr<SubplanStage> subplan(
            new SubplanStage(&_txn, collection, &ws, plannerParams, cq.get()));

        PlanYieldPolicy yieldPolicy(PlanExecutor::YIELD_MANUAL, _clock);
        ASSERT_OK(subplan->pickBestPlan(&yieldPolicy));

        size_t numResults = 0;
        PlanStage::StageState stageState = PlanStage::NEED_TIME;
        while (stageState != PlanStage::IS_EOF) {
            WorkingSetID id = WorkingSet::INVALID_ID;
            stageState = subplan->work(&id);
            ASSERT_NE(stageState, PlanStage::DEAD);
            ASSERT_NE(stageState, PlanStage::FAILURE);
            if (stageState == PlanStage::ADVANCED) {
                ++numResults;
            }
        }

        ASSERT_EQ(numResults, 4U);
    }
Example #22
0
ofxSynth::ofxSynth(){

	currentFrequency = startFrequency = targetFrequency = 440;
	
	setFrequency(440);
	currentAmp = 0;
	noteTime = 0;
	usesEnv = false;
	gain = 0.1;
	sustain = 0.5;

	modEnv.setADSR(44100*0.01, 44100*0.2, 0.0, 44100.0*0.1);
	env.setADSR(0.01*44100, 0.1*44100, 0.5, 0.93*44100);
	filter.setup();
	setFilter(0.7, 0.5);
	setFilterLowPass();
	waveMode = 0;
	
}
int BucketModel::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = BucketListModel::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 7)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 7;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QString*>(_v) = filter(); break;
        case 1: *reinterpret_cast< QString*>(_v) = jsonAssetPath(); break;
        case 2: *reinterpret_cast< bool*>(_v) = bucketIsFull(); break;
        }
        _id -= 3;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setFilter(*reinterpret_cast< QString*>(_v)); break;
        case 1: setJsonAssetPath(*reinterpret_cast< QString*>(_v)); break;
        }
        _id -= 3;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 3;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Example #24
0
void Enemy::Initialize()
{
    BallBase::CreateBall();

    //((UserData*)m_b2Body->GetUserData())->kind = UserData::Enemy;
    auto ud = (UserData*)m_b2Body->GetUserData();
    ud->kind = UserData::Enemy;
    ud->isCore = true;


    //setFilterGroup(-3); // random number
    //setFilter(UserData::Enemy, UserData::ball | UserData::player | UserData::Enemy);
    //setFilter(UserData::Enemy, -1 & ~UserData::Enemy);
    setFilter(UserData::Enemy, ~(UserData::Enemy << 1));

    m_b2Body->ApplyForceToCenter(b2Vec2(rand() % 2000 - 1000, rand() % 2000 - 1000));

    //Gameplay::getInst().MakeCircle(to_Vector2(m_b2Body->GetPosition()), 6, 3);
    Gameplay::getInst().MakeCircle(to_Vector2(m_b2Body->GetPosition()), 7, 3);
}
bool FilterToolButton::setFilter(FilterToolButton::ItemId id,const QString & filter) {
    QList<QAction *> actions = menu()->actions();
    for (int i=0;i<actions.count();i++) {
        ItemId item_id = ((actions[i]->menu() == NULL)?((IdAction *)actions[i])->id():IS_UNKNOWN);

        if (actions[i]->menu() == NULL) {
            bool is_ok = ((id == IS_GROUP) && (id == item_id) && (actions[i]->text() == filter));
            if (!is_ok) is_ok = ((id != IS_UNKNOWN) && (id != IS_GROUP) && (id == item_id));
            if (is_ok) {
                actions[i]->trigger();
                triggerSignal(actions[i]);
                return true;
            }
        }
        else if (actions[i]->menu() != NULL) {
            if (setFilter(actions[i]->menu(),id,filter)) return true;
        }
    }
    return false;
}
Example #26
0
void ListWidget::append(const String &s, ThemeEngine::FontColor color) {
	if (_dataList.size() == _listColors.size()) {
		// If the color list has the size of the data list, we append the color.
		_listColors.push_back(color);
	} else if (!_listColors.size() && color != ThemeEngine::kFontColorNormal) {
		// If it's the first entry to use a non default color, we will fill
		// up all other entries of the color list with the default color and
		// add the requested color for the new entry.
		for (uint i = 0; i < _dataList.size(); ++i)
			_listColors.push_back(ThemeEngine::kFontColorNormal);
		_listColors.push_back(color);
	}

	_dataList.push_back(s);
	_list.push_back(s);

	setFilter(_filter, false);

	scrollBarRecalc();
}
Example #27
0
void Texture::create2DTexture() {
	// Bind the texture
	glBindTexture(GL_TEXTURE_2D, _textureID);

	// Edge wrap mode
	setWrap(GL_TEXTURE_2D, GL_REPEAT, GL_REPEAT);

	// Pixel row alignment
	setAlign();

	// Filter method
	setFilter(GL_TEXTURE_2D);

	// Mip map parameters
	setMipMaps(GL_TEXTURE_2D);

	// Texture image data
	for (size_t i = 0; i < _image->getMipMapCount(); i++)
		setMipMapData(GL_TEXTURE_2D, 0, i);
}
Example #28
0
            void JSocketHandler::configure() {
                //TODO JLogManager* manager = JLogManager::getLogManager();
                JString cname = getClass()->getName();

                setLevel(JLevel::ALL);//TODO manager.getLevelProperty(cname +".level", Level.ALL));
                setFilter(NULL);//TODO manager.getFilterProperty(cname +".filter", null));
                setFormatter(new JXMLFormatter());//TODO manager.getFormatterProperty(cname +".formatter", new XMLFormatter()));
                try {
                    setEncoding("");//TODOmanager.getStringProperty(cname +".encoding", null));
                } catch (JException* ex) {
                    delete ex;
                    try {
                        setEncoding("");
                    } catch (JException* ex2) {
                        delete ex2;
                    }
                }
                port = 0;//TODO manager.getIntProperty(cname + ".port", 0);
                host = new JString("localhost");//TODO manager.getStringProperty(cname + ".host", null);
            }
/**
 * Test that on failure, the cached plan stage replans the query but does not create a new cache
 * entry.
 */
TEST_F(QueryStageCachedPlan, QueryStageCachedPlanFailure) {
    AutoGetCollectionForReadCommand ctx(&_opCtx, nss);
    Collection* collection = ctx.getCollection();
    ASSERT(collection);

    // Query can be answered by either index on "a" or index on "b".
    auto qr = stdx::make_unique<QueryRequest>(nss);
    qr->setFilter(fromjson("{a: {$gte: 8}, b: 1}"));
    auto statusWithCQ = CanonicalQuery::canonicalize(opCtx(), std::move(qr));
    ASSERT_OK(statusWithCQ.getStatus());
    const std::unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());

    // We shouldn't have anything in the plan cache for this shape yet.
    PlanCache* cache = collection->infoCache()->getPlanCache();
    ASSERT(cache);
    ASSERT_EQ(cache->get(*cq).state, PlanCache::CacheEntryState::kNotPresent);

    // Get planner params.
    QueryPlannerParams plannerParams;
    fillOutPlannerParams(&_opCtx, collection, cq.get(), &plannerParams);

    // Queued data stage will return a failure during the cached plan trial period.
    auto mockChild = stdx::make_unique<QueuedDataStage>(&_opCtx, &_ws);
    mockChild->pushBack(PlanStage::FAILURE);

    // High enough so that we shouldn't trigger a replan based on works.
    const size_t decisionWorks = 50;
    CachedPlanStage cachedPlanStage(
        &_opCtx, collection, &_ws, cq.get(), plannerParams, decisionWorks, mockChild.release());

    // This should succeed after triggering a replan.
    PlanYieldPolicy yieldPolicy(PlanExecutor::NO_YIELD,
                                _opCtx.getServiceContext()->getFastClockSource());
    ASSERT_OK(cachedPlanStage.pickBestPlan(&yieldPolicy));

    ASSERT_EQ(getNumResultsForStage(_ws, &cachedPlanStage, cq.get()), 2U);

    // Plan cache should still be empty, as we don't write to it when we replan a failed
    // query.
    ASSERT_EQ(cache->get(*cq).state, PlanCache::CacheEntryState::kNotPresent);
}
int tlp::FileNameEditorWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 5)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 5;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QString*>(_v) = fileName(); break;
        case 1: *reinterpret_cast< QString*>(_v) = filter(); break;
        }
        _id -= 2;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setFileName(*reinterpret_cast< QString*>(_v)); break;
        case 1: setFilter(*reinterpret_cast< QString*>(_v)); break;
        }
        _id -= 2;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 2;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}