Example #1
0
QString HTML::resolveEntity(quint16 entityCode)
{
    HtmlEntity* he = (HtmlEntity*) qFind(start_first,end_first,entityCode);
    if (he != end_first) return he->name;
    he = (HtmlEntity*) qFind(start_ent,end_ent,entityCode);
    if (he == end_ent) return QString();
    return he->name;
}
Example #2
0
void Shred::Unregister(Active * const active) {
    *qFind(activeListAll.begin(), activeListAll.end(), active) = nullptr;
    *qFind(activeListFrequent.begin(), activeListFrequent.end(), active) =
        nullptr;
    Falling * const falling = active->ShouldFall();
    if ( falling != nullptr ) {
        *qFind(fallList.begin(), fallList.end(), falling) = nullptr;
        falling->SetFalling(false);
    }
    RemShining(active);
}
Example #3
0
int Menu::actionGroup(const Action *AAction) const
{
    QMultiMap<int,Action *>::const_iterator it = qFind(FActions.begin(),FActions.end(),AAction);
    if (it != FActions.constEnd())
        return it.key();
    return AG_NULL;
}
Example #4
0
bool LiveDataWidget::checkShortNameAndCatalog(const QStringList &checkedShortName,
    const QStringList &checkedCatalog,
    const QString &shortName,
    const QString &catalog)
{
    QStringList::const_iterator shortNameIt = qFind(checkedShortName.begin(), checkedShortName.end(), shortName);
    QStringList::const_iterator catalogIt = qFind(checkedCatalog.begin(), checkedCatalog.end(), catalog);

    if (shortNameIt == checkedShortName.end() ||
        catalogIt == checkedCatalog.end())
    {
        return false;
    }

    return true;
}
void QAndroidPlatformMenu::removeMenuItem(QPlatformMenuItem *menuItem)
{
    QMutexLocker lock(&m_menuItemsMutex);
    m_menuItems.erase(qFind(m_menuItems.begin(),
                            m_menuItems.end(),
                            static_cast<QAndroidPlatformMenuItem *>(menuItem)));
}
Example #6
0
MDebug::MDebug(DModule model, DLevel level)
    :QDebug(MDebugConfig::GetInstance()->GetFile()),
    debug_(NULL)
{
    MDebugConfig* config = MDebugConfig::GetInstance();

    QList<DModule> mlist = config->module_list();
    QList<DModule>::iterator itr = qFind(mlist.begin(),mlist.end(),model);
    if(itr == mlist.end())
    {
        output_ = DType_Invalid;
    }
    else
    {
        file_ = config->GetFile();
        output_ = config->IsOutput(model,level);

        if((output_ & DType_Terminal) == DType_Terminal)
        {
            debug_ = new QDebug(QtDebugMsg);
        }

        PrintTitle(model);
    }


}
void AutomationPatternView::disconnectObject( QAction * _a )
{
	JournallingObject * j = Engine::projectJournal()->
				journallingObject( _a->data().toInt() );
	if( j && dynamic_cast<AutomatableModel *>( j ) )
	{
		float oldMin = m_pat->getMin();
		float oldMax = m_pat->getMax();

		m_pat->m_objects.erase( qFind( m_pat->m_objects.begin(),
					m_pat->m_objects.end(),
				dynamic_cast<AutomatableModel *>( j ) ) );
		update();

		//If automation editor is opened, update its display after disconnection
		if( gui->automationEditor() )
		{
			gui->automationEditor()->m_editor->updateAfterPatternChange();
		}

		//if there is no more connection connected to the AutomationPattern
		if( m_pat->m_objects.size() == 0 )
		{
			//scale the points to fit the new min. and max. value
			this->scaleTimemapToFit( oldMin, oldMax );
		}
	}
}
void QAndroidPlatformMenuBar::removeMenu(QPlatformMenu *menu)
{
    QMutexLocker lock(&m_menusListMutex);
    m_menus.erase(qFind(m_menus.begin(),
                        m_menus.end(),
                        static_cast<QAndroidPlatformMenu *>(menu)));
}
Example #9
0
void Mixer::removePlayHandle( PlayHandle * _ph )
{
	// check thread affinity as we must not delete play-handles
	// which were created in a thread different than mixer thread
	if( _ph->affinityMatters() &&
				_ph->affinity() == QThread::currentThread() )
	{
		lockPlayHandleRemoval();
		_ph->audioPort()->removePlayHandle( _ph );
		PlayHandleList::Iterator it =
				qFind( m_playHandles.begin(),
						m_playHandles.end(), _ph );
		if( it != m_playHandles.end() )
		{
			m_playHandles.erase( it );
			if( _ph->type() == PlayHandle::TypeNotePlayHandle )
			{
				NotePlayHandleManager::release( (NotePlayHandle*) _ph );
			}
			else delete _ph;
		}
		unlockPlayHandleRemoval();
	}
	else
	{
		m_playHandlesToRemove.push_back( _ph );
	}
}
Example #10
0
int BooksBookModel::Data::pickPage(const BooksPos& aPagePos,
    const BooksPos& aNextPagePos, int aPageCount) const
{
    int page = 0;
    if (aPagePos.valid()) {
        if (!aNextPagePos.valid()) {
            // Last page stays the last
            page = iPageMarks.count() - 1;
            HDEBUG("last page" << page);
        } else {
            BooksPos::ConstIterator it = qFind(iPageMarks, aPagePos);
            if (it == iPageMarks.end()) {
                // Two 90-degrees rotations should return the reader
                // back to the same page. That's what this is about.
                const BooksPos& pos = (iPageMarks.count() > aPageCount) ?
                    aPagePos : aNextPagePos;
                it = qUpperBound(iPageMarks, pos);
                page = (int)(it - iPageMarks.begin());
                if (page > 0) page--;
                HDEBUG("using page" << page << "for" << pos);
            } else {
                page = it - iPageMarks.begin();
                HDEBUG("found" << aPagePos << "at page" << page);
            }
        }
    }
    return page;
}
void ControllerRackView::deleteController( ControllerView * _view )
{
	Controller * c = _view->getController();

	int connectionCount = c->connectionCount();
	if( connectionCount > 0 )
	{
		QMessageBox msgBox;
		msgBox.setIcon( QMessageBox::Question );
		msgBox.setWindowTitle( tr("Confirm Delete") );
		msgBox.setText( tr("Confirm delete? There are existing connection(s) "
				"associted with this controller. There is no way to undo.") );
		msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
		if( msgBox.exec() != QMessageBox::Ok )
		{
			return;
		}
	}


	m_controllerViews.erase( qFind( m_controllerViews.begin(),
				m_controllerViews.end(), _view ) );
	delete _view;
	delete c;
	update();
}
Example #12
0
void ConnectionManagerImpl::AddSignal(const int type, const QObject *obj, const QString &signal)
{
    Q_ASSERT(obj != NULL);
    Q_ASSERT(!signal.isEmpty());
    if(obj == NULL || signal.isEmpty())
    {
        return;
    }

    ConnectionItem item;
    item.obj = (QObject*)obj;
    item.method = signal;
    if(!signal_map_.contains(type))
    {
        ConnectionItemList list;
        list.push_back(item);
        signal_map_.insert(type,list);
    }
    else
    {
        if(qFind(signal_map_[type],item) == signal_map_[type].end())
        {
            signal_map_[type].push_back(item);
        }
    }
}
Example #13
0
void BodyInfo::loadSegmentsData(){
    if (_sub_segments.size() == 0){
        CSVParser parser;
        QString filepath("../assets/CSV/input/segments_subs.csv");
        QString sub_segment_name;
        QString segment_name;
        float mass;

        parser.parseFile(filepath,";");
        if (parser.size() > 1){
            for (int i = 1; i < parser.size(); ++i) {
                sub_segment_name = parser.at(i).at(0).toLower().replace(" ","");
                segment_name =     parser.at(i).at(1).toLower().replace(" ","");
                mass = parser.at(i).at(5).toFloat();
                _sub_segments.insert(sub_segment_name,mass);
                _segments_parenting.insert(sub_segment_name,segment_name);

                if (qFind(_segments,segment_name)==_segments.end()){
                    _segments.append(segment_name);
                }
            }
            qDebug()<<"Loaded segment mass file "<<filepath;
        } else {
            qWarning()<<"Target file "<<filepath<<" not found";
        }
    }
}
Example #14
0
GraphicsWidget* WidgetStyle::WidgetScene::removeWidget(GraphicsWidget* wgt)
{
    auto iter = qFind(m_graphicsWgt_.begin(), m_graphicsWgt_.end(), wgt);
    if(iter == m_graphicsWgt_.end())
        return nullptr;
    m_graphicsWgt_.erase(iter);
    return *iter;
}
Example #15
0
void QAndroidPlatformMenu::insertMenuItem(QPlatformMenuItem *menuItem, QPlatformMenuItem *before)
{
    QMutexLocker lock(&m_menuItemsMutex);
    m_menuItems.insert(qFind(m_menuItems.begin(),
                             m_menuItems.end(),
                             static_cast<QAndroidPlatformMenuItem *>(before)),
                       static_cast<QAndroidPlatformMenuItem *>(menuItem));
}
Example #16
0
void EffectChain::removeEffect( Effect * _effect )
{
	engine::mixer()->lock();
	m_effects.erase( qFind( m_effects.begin(), m_effects.end(), _effect ) );
	engine::mixer()->unlock();

	emit dataChanged();
}
Example #17
0
void EffectRackView::moveDown( EffectView* view )
{
	if( view != m_effectViews.last() )
	{
		// moving next effect up is the same
		moveUp( *( qFind( m_effectViews.begin(), m_effectViews.end(), view ) + 1 ) );
	}
}
void QAndroidPlatformMenuBar::insertMenu(QPlatformMenu *menu, QPlatformMenu *before)
{
    QMutexLocker lock(&m_menusListMutex);
    m_menus.insert(qFind(m_menus.begin(),
                         m_menus.end(),
                         static_cast<QAndroidPlatformMenu *>(before)),
                         static_cast<QAndroidPlatformMenu *>(menu));
}
Example #19
0
 int id(QObject* object) const
 {
     QHash<int, QLabel*>::const_iterator it = qFind(items, object);
     if (it != items.constEnd())
         return it.key();
     // Not found. This happens when a subclass uses an eventFilter too,
     // on objects not registered here.
     return -1;
 }
Example #20
0
void AutomatableModel::unlinkModel( AutomatableModel* model )
{
	AutoModelVector::Iterator it = qFind( m_linkedModels.begin(), m_linkedModels.end(), model );
	if( it != m_linkedModels.end() )
	{
		m_linkedModels.erase( it );
	}
	m_hasLinkedModels = !m_linkedModels.isEmpty();
}
Example #21
0
void EffectRackView::deletePlugin( EffectView* view )
{
	Effect * e = view->effect();
	m_effectViews.erase( qFind( m_effectViews.begin(), m_effectViews.end(), view ) );
	delete view;
	fxChain()->removeEffect( e );
	e->deleteLater();
	update();
}
Example #22
0
void MidiClient::removePort( MidiPort * _port )
{
	QVector<MidiPort *>::Iterator it =
		qFind( m_midiPorts.begin(), m_midiPorts.end(), _port );
	if( it != m_midiPorts.end() )
	{
		m_midiPorts.erase( it );
	}
}
void QAndroidPlatformMenu::removeMenuItem(QPlatformMenuItem *menuItem)
{
    QMutexLocker lock(&m_menuItemsMutex);
    PlatformMenuItemsType::iterator it = qFind(m_menuItems.begin(),
                                         m_menuItems.end(),
                                         static_cast<QAndroidPlatformMenuItem *>(menuItem));
    if (it != m_menuItems.end())
        m_menuItems.erase(it);
}
bool AccountRecord::addCharacter( P_PLAYER d )
{
	if( qFind( characters_.begin(), characters_.end(), d ) == characters_.end() )
	{
		characters_.push_back(d);
		return true;
	}
	return false;
}
Example #25
0
void LiveDataWidget::setCurrentCatalog(const QString &catalog)
{
    if (catalog.isEmpty())
        return;

    _currentCatalog = catalog;
    QSqlQuery query(_db);
    //if (!query.prepare(QString("SELECT ShortName FROM [LiveData") +
    //    _langList[0] +
    //    QString("] WHERE Catalog='") +
    //    catalog +
    //    QString("'")))
    //{
    //    return;
    //}
    if (!query.prepare(QString("SELECT ShortName FROM [LiveData") +
        _langList[0] +
        QString("] WHERE Catalog=:catalog")))
    {
        return;
    }
    query.bindValue(":catalog", catalog);

    if (!query.exec())
    {
        return;
    }

    _shortNameList.clear();
    _commandIDBox->clear();
    while (query.next())
    {
        _shortNameList.append(query.value(0).toString());
    }

    QStringList::const_iterator it = qFind(_catalogList.begin(), _catalogList.end(), catalog);
    if (it == _catalogList.end())
    {
        _catalogList.append(catalog);
    }

    //query.prepare(QString("SELECT ID FROM [Command] WHERE Catalog='") +
    //    catalog +
    //    QString("'"));
    query.prepare(QString("SELECT ID FROM [Command] WHERE Catalog=:catalog"));
    query.bindValue(":catalog", catalog);
    query.exec();

    while (query.next())
    {
        _commandIDBox->addItem(query.value(0).toString());
    }

    _shortNameListModel->setStringList(_shortNameList);
    _shortNameListView->setCurrentIndex(_shortNameListModel->index(0));
    setCurrentShortName(_shortNameListModel->index(0));
}
Example #26
0
void Mixer::removePlayHandle( PlayHandle * _ph )
{
	requestChangeInModel();
	// check thread affinity as we must not delete play-handles
	// which were created in a thread different than mixer thread
	if( _ph->affinityMatters() &&
				_ph->affinity() == QThread::currentThread() )
	{
		_ph->audioPort()->removePlayHandle( _ph );
		bool removedFromList = false;
		// Check m_newPlayHandles first because doing it the other way around
		// creates a race condition
		for( LocklessListElement * e = m_newPlayHandles.first(),
				* ePrev = NULL; e; ePrev = e, e = e->next )
		{
			if( e->value == _ph )
			{
				if( ePrev )
				{
					ePrev->next = e->next;
				}
				else
				{
					m_newPlayHandles.setFirst( e->next );
				}
				m_newPlayHandles.free( e );
				removedFromList = true;
				break;
			}
		}
		// Now check m_playHandles
		PlayHandleList::Iterator it = qFind( m_playHandles.begin(),
					m_playHandles.end(), _ph );
		if( it != m_playHandles.end() )
		{
			m_playHandles.erase( it );
			removedFromList = true;
		}
		// Only deleting PlayHandles that were actually found in the list
		// "fixes crash when previewing a preset under high load"
		// (See tobydox's 2008 commit 4583e48)
		if ( removedFromList )
		{
			if( _ph->type() == PlayHandle::TypeNotePlayHandle )
			{
				NotePlayHandleManager::release( (NotePlayHandle*) _ph );
			}
			else delete _ph;
		}
	}
	else
	{
		m_playHandlesToRemove.push_back( _ph );
	}
	doneChangeInModel();
}
Example #27
0
void AudioPort::removePlayHandle( PlayHandle * handle )
{
    m_playHandleLock.lock();
    PlayHandleList::Iterator it =	qFind( m_playHandles.begin(), m_playHandles.end(), handle );
    if( it != m_playHandles.end() )
    {
        m_playHandles.erase( it );
    }
    m_playHandleLock.unlock();
}
int SimpleFSModel::findRow(const NodeInfo* nodeInfo) const
{
    Q_ASSERT(nodeInfo != 0);
    const NodeInfoList& parentInfoChildren = nodeInfo->parent != 0 ?
                nodeInfo->parent->children :
                nodes_;
    NodeInfoList::const_iterator position = qFind(parentInfoChildren, *nodeInfo);
    Q_ASSERT(position != parentInfoChildren.end());
    return std::distance(parentInfoChildren.begin(), position);
}
bool AccountRecord::removeCharacter( P_PLAYER d )
{
	QValueVector<P_PLAYER>::iterator it = qFind( characters_.begin(), characters_.end(), d );
	if ( it != characters_.end() )
	{
		characters_.erase(it);
		return true;
	}
	return false;
}
Example #30
0
void MDebug::PrintTitle(DModule model)
{
    MDebugConfig* config = MDebugConfig::GetInstance();
    if((output_ & DType_Terminal) == DType_Terminal)
    {
        if(config->timestamp_enable())
        {
            *debug_ << QTime::currentTime().toString("[hh:mm:ss.zzz]").toLatin1().data();
        }

        if(config->module_enable())
        {
            QList<DModule> mlist = config->module_list();
            QList<DModule>::iterator itr = qFind(mlist.begin(),mlist.end(),model);
            if(itr != mlist.end())
            {
                *debug_ << '[' << module_g[*itr] << ']';
            }
        }
    }

    if((output_ & DType_File) == DType_File)
    {
        if(file_ != NULL && file_->isOpen() && file_->isWritable())
        {
            if(config->timestamp_enable())
            {
                (QDebug)*this << QTime::currentTime().toString("[hh:mm:ss.zzz]").toLatin1().data();
            }

            if(config->module_enable())
            {
                QList<DModule> mlist = config->module_list();
                QList<DModule>::iterator itr = qFind(mlist.begin(),mlist.end(),model);
                if(itr != mlist.end())
                {
                    (QDebug)*this << '[' << module_g[*itr] << ']';
                }
            }
        }
    }
}