void QgsPointDisplacementRenderer::calculateSymbolAndLabelPositions( const QPointF& centerPoint, int nPosition, double radius, \
    double symbolDiagonal, QList<QPointF>& symbolPositions, QList<QPointF>& labelShifts ) const
{
  symbolPositions.clear();
  labelShifts.clear();

  if ( nPosition < 1 )
  {
    return;
  }
  else if ( nPosition == 1 ) //If there is only one feature, draw it exactly at the center position
  {
    symbolPositions.append( centerPoint );
    labelShifts.append( QPointF( symbolDiagonal / 2.0, -symbolDiagonal / 2.0 ) );
    return;
  }

  double fullPerimeter = 2 * M_PI;
  double angleStep = fullPerimeter / nPosition;
  double currentAngle;

  for ( currentAngle = 0.0; currentAngle < fullPerimeter; currentAngle += angleStep )
  {
    double sinusCurrentAngle = sin( currentAngle );
    double cosinusCurrentAngle = cos( currentAngle );
    QPointF positionShift( radius * sinusCurrentAngle, radius * cosinusCurrentAngle );
    QPointF labelShift(( radius + symbolDiagonal / 2 ) * sinusCurrentAngle, ( radius + symbolDiagonal / 2 ) * cosinusCurrentAngle );
    symbolPositions.append( centerPoint + positionShift );
    labelShifts.append( labelShift );
  }
}
bool TestDspCmdDirGetVmList::getExpectedVmList(QList<QDomDocument>& expectedList)
{
   QString  errorMsg;
   int      errorLine, errorColumn;

   expectedList.clear();

   CAuthHelper auth(TestConfig::getUserLogin());
   if (!auth.AuthUser(TestConfig::getUserPassword()))
   {
      WRITE_TRACE(DBG_FATAL, "can't auth user[%s] on localhost ", TestConfig::getUserLogin());
      return false;
   }

	// __asm int 3;
   SmartPtr<CVmDirectory> pVmDir = GetUserVmDirectory();
   if( !pVmDir )
   {
      WRITE_TRACE(DBG_FATAL, "can't get vm directory from ");
      return false;
   }

   for (int idx=0; idx< pVmDir->m_lstVmDirectoryItems.size(); idx++)
   {
      CVmDirectoryItem* pDirItem= pVmDir->m_lstVmDirectoryItems[idx];
      QString strVmHome=pDirItem->getVmHome();
      QString strChangedBy=pDirItem->getChangedBy();
      QString strChangeDateTime=pDirItem->getChangeDateTime().toString(XML_DATETIME_FORMAT);

      //FIXME: add checking access permission to vm.xml
      // fixed: when i started as test-user it doing automatically

      if (!CFileHelper::FileCanRead(strVmHome, &auth))
         continue;

      QFile vmConfig(strVmHome);
      if(!vmConfig.open(QIODevice::ReadOnly))
      {
         WRITE_TRACE(DBG_FATAL, "can't open file [%s]", strVmHome.toUtf8().data());
         break;
      }

      expectedList.push_back(QDomDocument());
      QDomDocument& doc=expectedList[expectedList.size()-1];
      if(!doc.setContent(&vmConfig, false, &errorMsg, &errorLine, &errorColumn ))
      {
         WRITE_TRACE(DBG_FATAL, "error of parsing file: [fname=%s], errorMsg=%s, line=%d, column=%d"
            , strVmHome.toUtf8().data()
            , errorMsg.toUtf8().data(), errorLine, errorColumn);
         expectedList.clear();
         return false;
      }

      addNodeToIdentityPart(doc, XML_VM_DIR_ND_VM_HOME, strVmHome);
      addNodeToIdentityPart(doc, XML_VM_DIR_ND_CHANGED_BY, strChangedBy);
      addNodeToIdentityPart(doc, XML_VM_DIR_ND_CHANGED_DATETIME, strChangeDateTime);
   }//for
   return (true);
}
/*
    Retrieves a list of interface descriptors that fulfill the constraints specified
    by \a filter at a given \a scope.

    The last error is set when this function is called.
*/
QList<QServiceInterfaceDescriptor>  DatabaseManager::getInterfaces(const QServiceFilter &filter, DbScope scope)
{
    #ifdef Q_OS_SYMBIAN
        QService::Scope requestedScope;
        if (scope == UserScope) {
            requestedScope = QService::UserScope;
        } else {
            requestedScope = QService::SystemScope;
        }
        scope = SystemScope;
    #endif

    QList<QServiceInterfaceDescriptor> descriptors;

    int userDescriptorCount = 0;
    if (scope == UserScope) {
        if (!openDb(UserScope))
            return descriptors;

        descriptors =  m_userDb->getInterfaces(filter);
        if (m_userDb->lastError().code() != DBError::NoError ) {
            descriptors.clear();
            m_lastError = m_userDb->lastError();
            return descriptors;
        }

        userDescriptorCount = descriptors.count();
        for (int i=0; i < userDescriptorCount; ++i) {
            descriptors[i].d->scope = QService::UserScope;
        }
    }

    if (openDb(SystemScope)) {
        descriptors.append(m_systemDb->getInterfaces(filter));
        if (m_systemDb->lastError().code() != DBError::NoError) {
            descriptors.clear();
            m_lastError = m_systemDb->lastError();
            return descriptors;
        }

        for (int i = userDescriptorCount; i < descriptors.count(); ++i) {
            #ifdef Q_OS_SYMBIAN
                descriptors[i].d->scope = requestedScope;
            #else
                descriptors[i].d->scope = QService::SystemScope;
            #endif
        }
    } else {
        if ( scope == SystemScope) {
            //openDb() should already have handled lastError
            descriptors.clear();
            return descriptors;
        }
    }

    m_lastError.setError(DBError::NoError);
    return descriptors;
}
Example #4
0
    // Loads a form and create its collection, creates duplicates too
    bool loadFormCollection(const QString &uid, FormType type)
    {
        if (uid.isEmpty()) {
            LOG_ERROR_FOR(q, "No uid to load...");
            return false;
        }

        // Check from cache
        if (isCollectionLoaded(uid, type))
            return true;

        // Not in cache -> ask IFormIO plugins
        QList<Form::IFormIO *> list = pluginManager()->getObjects<Form::IFormIO>();
        if (list.isEmpty()) {
            LOG_ERROR_FOR(q, "No IFormIO loaded...");
            return false;
        }

        // Load forms
        foreach(Form::IFormIO *io, list) {
            if (io->canReadForms(uid)) {
                // Load the forms once (for the main collection)
                QList<Form::FormMain *> list = io->loadAllRootForms(uid);

                // Check list for identity form
                if (!_identityForm) {
                    FormCollection *collection = new FormCollection;
                    collection->setEmptyRootForms(list);
                    _identityForm = collection->identityForm();
                    if (_identityForm) {
                        LOG_FOR(q, "Identity form detected: " + _identityForm->uuid());
                        // Reparent identity form and delete all other Form::FormMain
                        _identityForm->setParent(q);
                        list.removeAll(_identityForm);
                        qDeleteAll(list);
                        // Re-load the forms once (for the main collection)
                        list.clear();
                        list = io->loadAllRootForms(uid);
                    }
                    collection->setEmptyRootForms(QList<Form::FormMain *>());
                    delete collection;
                }

                // Create the main collection
                createModeFormCollections(list, type, false);
                list.clear();

                // Create its duplicate
                list = io->loadAllRootForms(uid);
                createModeFormCollections(list, type, true);
                LOG_FOR(q, QString("Form %1 loaded from reader %2")
                        .arg(uid)
                        .arg(io->name()));
                return true;
            }
        }
        return false;
    }
void ProjectWizardContext::clear()
{
    activeVersionControls.clear();
    projects.clear();
    commonDirectory.clear();
    page = 0;
    repositoryExists = false;
    wizard = 0;
}
Example #6
0
void NewSalary::displayData()
{
    forgData.clear();
    nightShiftData.clear();
    ui->tableWidget->clear();
    QList<User> users;
    try
    {
        FileHandler parser(fileName);
        parser.getUsers(users);
    }catch ( char* Message)
    {
        QMessageBox::warning(this,"error",Message,QMessageBox::Ok);
    }
    catch ( QString Message)
    {
        QMessageBox::warning(this,"error",Message,QMessageBox::Ok);
    }

    int x;
    QList<Log> fogToSig;
    QList<QPair<Log,Log> > nightShift;
    int counter=0;
    ui->tableWidget->setColumnCount(4);
    ui->tableWidget->setRowCount(users.count());
    QStringList headers;
    headers.append(tr("ID"));
    headers.append(tr("Name"));
    headers.append(tr("Number of Hours"));
    headers.append(tr("Salary"));
    ui->tableWidget->setHorizontalHeaderLabels(headers);
    foreach(User u , users)
    {
        fogToSig.clear();
        nightShift.clear();
        ui->tableWidget->insertRow(counter);
        QPair<QString,double> info;
        if(userModel->getUserInfo(u.getMachineId(),info))
        {
            int hour = u.calcHour(ui->dFromDate->date(),ui->dToDate->date(),fogToSig,nightShift);
            forgData[u.getMachineId()]=fogToSig;
            nightShiftData[u.getMachineId()]=nightShift;
            QTableWidgetItem* idItem = new QTableWidgetItem(QString::number(u.getMachineId()));
            QTableWidgetItem* nameItem = new QTableWidgetItem(info.first);
            QTableWidgetItem* numOfhourItem = new QTableWidgetItem(QString::number(hour));
            QTableWidgetItem* salaryItem = new QTableWidgetItem(QString::number(info.second*hour));
            idItem->setTextAlignment(Qt::AlignCenter);
            nameItem->setTextAlignment(Qt::AlignCenter);
            numOfhourItem->setTextAlignment(Qt::AlignCenter);
            salaryItem->setTextAlignment(Qt::AlignCenter);
            ui->tableWidget->setItem(counter,0,idItem);
            ui->tableWidget->setItem(counter,1,nameItem);
            ui->tableWidget->setItem(counter,2,numOfhourItem);
            ui->tableWidget->setItem(counter,3,salaryItem);
            counter++;
        }
    }
QSimpleUpdater::~QSimpleUpdater()
{
    URLS.clear();

    foreach (Updater* updater, UPDATERS)
        updater->deleteLater();

    UPDATERS.clear();
}
Example #8
0
void test_graham::test_data()
{
    QList<Vertex> allVertexList;
    QList<Vertex> res;
    Vertex v;

    QTest::addColumn<QList<Vertex> > ("allVertexList");
    QTest::addColumn<QList<Vertex> > ("res");

    allVertexList.append(Vertex(0,0));
    allVertexList.append(Vertex(1,1));
    QTest::newRow("Переданы две точки") << allVertexList << res;

    allVertexList.clear();

    allVertexList.append(Vertex(0,0));
    allVertexList.append(Vertex(1,1));
    allVertexList.append(Vertex(2,1));

    res.append(Vertex(0,0));
    res.append(Vertex(2,1));
    res.append(Vertex(1,1));
    QTest::newRow("Переданы три точки") << allVertexList << res;

    allVertexList.clear();
    res.clear();

    allVertexList.append(Vertex(0,0));
    allVertexList.append(Vertex(4,0));
    allVertexList.append(Vertex(1,2));
    allVertexList.append(Vertex(3,2));
    allVertexList.append(Vertex(1,-2));
    allVertexList.append(Vertex(3,-2));

    res.append(Vertex(0,0));
    res.append(Vertex(1,-2));
    res.append(Vertex(3,-2));
    res.append(Vertex(4,0));
    res.append(Vertex(3,2));
    res.append(Vertex(1,2));
    QTest::newRow("Передано множество точек, все являются вершинами многоугольника") << allVertexList << res;

    allVertexList.clear();

    allVertexList.append(Vertex(0,0));
    allVertexList.append(Vertex(4,0));
    allVertexList.append(Vertex(2,5));
    res = allVertexList;
    allVertexList.append(Vertex(2,2));
    allVertexList.append(Vertex(2,3));
    allVertexList.append(Vertex(2,4));
    QTest::newRow("Передано множество точек, многоугольником будет треугольник") << allVertexList << res;

    allVertexList.clear();

}
void Ut_NotificationPreviewPresenter::cleanup()
{
    homeWindows.clear();
    homeWindowVisible.clear();
    qDeleteAll(notificationManagerNotification);
    notificationManagerNotification.clear();
    notificationManagerCloseNotificationIds.clear();
    gQmLocksStub->stubReset();
    gQmDisplayStateStub->stubReset();
}
    void shouldHandleComponentsEvents_data()
    {
        QTest::addColumn< QList<QComponent*> >("components");
        QTest::addColumn<void*>("functionPtr");

        QList<QComponent*> components;

        components.clear();
        components << new QLayer << new QLayer << new QLayer;
        QTest::newRow("layers") << components << reinterpret_cast<void*>(layersUuid);

        components.clear();
        components << new QShaderData << new QShaderData << new QShaderData;
        QTest::newRow("shader data") << components << reinterpret_cast<void*>(shadersUuid);
    }
const QList<QList<Point>> Etude::getListeDeCourbes() const
{
    QList<QList<Point>> listeDeCourbes;
    QList<Point> listeDePointsCourbe;
    const QList<Point>& listeDePoints = this->getListeDePoints();
    const int nombreDePoints = listeDePoints.count();
    for (int itPoint = 0; itPoint < nombreDePoints; itPoint++)
    {
        const Point& pointCourant = listeDePoints.at(itPoint);
        const int& typePointCourant = pointCourant.getTypePoint();
        if (typePointCourant == Point::COURBE_DEBUT)
        {
            listeDePointsCourbe.clear();
            listeDePointsCourbe.append(pointCourant);
        }
        else if (typePointCourant == Point::COURBE)
        {
            listeDePointsCourbe.append(pointCourant);
        }
        else if (typePointCourant == Point::COURBE_FIN)
        {
            listeDePointsCourbe.append(pointCourant);
            listeDeCourbes.append(listeDePointsCourbe);
        }
    }
    return listeDeCourbes;
}
Example #12
0
void Prefs_TableOfContents::generatePageItemList()
{
	itemDestFrameComboBox->clear();
	itemDestFrameComboBox->addItem(CommonStrings::tr_None);
	if (m_Doc!=NULL)
	{
		QList<PageItem*> allItems;
		for (int a = 0; a < m_Doc->DocItems.count(); ++a)
		{
			PageItem *currItem = m_Doc->DocItems.at(a);
			if (currItem->isGroup())
				allItems = currItem->getItemList();
			else
				allItems.append(currItem);
			for (int ii = 0; ii < allItems.count(); ii++)
			{
				currItem = allItems.at(ii);
				if (currItem->itemType() == PageItem::TextFrame)
					itemDestFrameComboBox->addItem(currItem->itemName());
			}
			allItems.clear();
		}
	}
	else
		itemDestFrameComboBox->setEnabled(false);
}
Example #13
0
///
/// \brief TreeView CurPlotItem slots(曲线条目树形窗口)
/// \param index
///
void SAChartDatasViewWidget::onTreeViewCurPlotItemClicked(const QModelIndex &index)
{
    Q_UNUSED(index);
    QItemSelectionModel* sel = ui->treeView->selectionModel();
    QModelIndexList indexList = sel->selectedRows();
    QList<QwtPlotItem*> items;
    for(int i = 0;i<indexList.size ();++i)
    {
        if(!indexList[i].parent().isValid())
        {//说明点击的是父窗口,就是qwtplot,这时显示所有
            items.clear();
            int childIndex = 0;
            while (indexList[i].child(childIndex,0).isValid()) {
                items.append(m_treeModel->getQwtPlotItemFromIndex (
                                 indexList[i].child(childIndex,0)));
                ++childIndex;
            }
            break;
        }
        if(indexList[i].column () != 0)
        {
            indexList[i] = indexList[i].parent().child(indexList[i].row(),0);
        }
        items.append (m_treeModel->getQwtPlotItemFromIndex (indexList[i]));
    }

    m_tableModel->setPlotItems (items);
}
void AppenderAttachable::removeAllAppenders()
{
// Avoid deadlock:
// - Only log warnings without having the write log aquired
// - Hold a reference to all appenders so that the remove does not
//   destruct the appender over the reference count while the write
//   log is held. The appender may log messages.

    //logger()->trace("Removing all appenders from logger '%1'", name());

    QList < LogObjectPtr<Appender> > appenders;
    {
        QWriteLocker locker(&mAppenderGuard);
        QMutableListIterator < LogObjectPtr<Appender> > i(mAppenders);
        while (i.hasNext())
        {
            Appender *p_appender = i.next();
            ListAppender *p_listappender = qobject_cast<ListAppender*> (p_appender);
            if (p_listappender && p_listappender->configuratorList())
                continue;
            else
            {
                appenders << p_appender;
                i.remove();
            }
        }
    }
    appenders.clear();
}
void IOSpeedMonitorThread::run()
{
    LOG(INFO,"Getting IO Speed start!");
    g_speedList.clear();
    for(int i=0; i<QReadConfig::getInstance()->getDiskCong().diskPaths.size(); i++)
    {
        DiskIOSpeedList disklist;
        disklist.mountPath = QReadConfig::getInstance()->getDiskCong().diskPaths[i];
        if(disklist.mountPath.right(1)!="/")
            disklist.mountPath += "/";
        g_speedList.append(disklist);
    }
    while(1)
    {
        mutex.lock();
        for(int i=0; i<g_speedList.size();i++)
        {
            QString cmd = "LANG=zh_US.UTF-8 && dd if=/dev/zero of="+g_speedList[i].mountPath+"test bs=8k count=35000 2>&1 | sed -n \"3,1p\" | awk  \'{print $8 \" \" $9}\'";
            QString cmd2 = "LANG=zh_US.UTF-8 && dd if="+g_speedList[i].mountPath+"test of=/dev/null bs=8k count=55000 2>&1 | sed -n \"3,1p\" | awk  \'{print $8 \" \" $9}\'";
            DiskIOSpeed ioSpeed;
            ioSpeed.wSpeed = GetSpeed(cmd).trimmed();
            ioSpeed.rSpeed = GetSpeed(cmd2).trimmed();
            qInfo()<<"ioSpeed.wSpeed.toStdString().c_str()="<<ioSpeed.wSpeed;
            qInfo()<<"ioSpeed.rSpeed.toStdString().c_str()="<<ioSpeed.rSpeed;
            if(ioSpeed.wSpeed.length()!=0 && ioSpeed.rSpeed.length()!=0)
                g_speedList[i].PushSpeedInfo(ioSpeed);
        }
         mutex.unlock();
         sleep(1);
    }
}
void AELoadedResourcesTreeView::LoadModelAnimations(Anima::AnimaModel* model, QStandardItem* parentItem)
{
	QStandardItem *animationItem1 = new QStandardItem(QString("Animations"));
	animationItem1->setEditable(false);

	QStandardItem *animationItem2 = new QStandardItem(QString(""));
	animationItem2->setEditable(false);

	QList<QStandardItem*> newItem;
	newItem.append(animationItem1);
	newItem.append(animationItem2);

	parentItem->appendRow(newItem);

	int count = model->GetAnimationsCount();
	for (int i = 0; i < count; i++)
	{
		Anima::AnimaAnimation* animation = model->GetAnimation(i);

		QStandardItem *animationItem3 = new QStandardItem(QString("%0").arg(animation->GetName()));
		animationItem3->setData(QVariant::fromValue(animation), MeshRole);
		animationItem3->setEditable(false);

		QStandardItem *animationItem4 = new QStandardItem(QString(""));
		animationItem4->setData(QVariant::fromValue(animation), MeshRole);
		animationItem4->setEditable(false);

		newItem.clear();
		newItem.append(animationItem3);
		newItem.append(animationItem4);

		animationItem1->appendRow(newItem);
	}
}
Example #17
0
void ProcessModel::clearSchedRelData() {

	// Collect the selection arcs
	QList<ListDigraph::Arc> selectionArcs;

	selectionArcs.clear();
	for (ListDigraph::ArcIt ait(this->graph); ait != INVALID; ++ait) {
		if (!this->conjunctive[ait]) {
			selectionArcs.append(ait);
		}
		this->p[ait] = 0.0;
	}

	// Clear the scheduling relevant data
	for (ListDigraph::NodeIt nit(this->graph); nit != INVALID; ++nit) {
		this->ops[nit]->machID = -1;
		this->ops[nit]->machAvailTime(0.0);
		this->ops[nit]->r(this->ops[nit]->ir());
		this->ops[nit]->s(this->ops[nit]->r());
		this->ops[nit]->p(0.0);
	}

	// Clear the selection arcs
	for (int i = 0; i < selectionArcs.size(); i++) {
		this->graph.erase(selectionArcs[i]);
	}
}
void Ut_NotificationPreviewPresenter::testAddNotificationWhenWindowAlreadyOpen()
{
    NotificationPreviewPresenter presenter;
    QSignalSpy changedSpy(&presenter, SIGNAL(notificationChanged()));
    QSignalSpy presentedSpy(&presenter, SIGNAL(notificationPresented(uint)));

    // Create a notification: this will create a window
    createNotification(1);
    presenter.updateNotification(1);

    // Reset stubs to see what happens next
    homeWindows.clear();

    // Create another notification
    LipstickNotification *notification = createNotification(2);
    presenter.updateNotification(2);

    // The second notification should not be signaled onwards yet since the first one is being presented
    QCOMPARE(changedSpy.count(), 1);
    QCOMPARE(presentedSpy.count(), 1);
    QCOMPARE(presentedSpy.last().at(0).toUInt(), (uint)1);

    // Show the next notification
    presenter.showNextNotification();

    // Check that the window was not unnecessarily created again
    QCOMPARE(homeWindows.isEmpty(), true);

    // Check that the expected notification is signaled onwards
    QCOMPARE(changedSpy.count(), 2);
    QCOMPARE(presenter.notification(), notification);
    QCOMPARE(presentedSpy.count(), 2);
    QCOMPARE(presentedSpy.last().at(0).toUInt(), (uint)2);
}
Example #19
0
void Ut_USBModeSelector::cleanup()
{
    delete usbModeSelector;
    qQuickViews.clear();
    qWindowVisible.clear();
    gNotificationManagerStub->stubReset();
}
static void valueToIntList(const QScriptValue &arr, QList<int> &list) {
  list.clear();
  if (arr.isArray()) {
    int length = arr.property("length").toInteger();
    for (int i = 0; i < length; i++) list.append(arr.property(i).toInteger());
  }
}
Example #21
0
void LayerAclMenu::userClicked(QAction *useraction)
{
	// Get exclusive user access list
	QList<uint8_t> exclusive;
	for(const QAction *a : _users) {
		if(a->isChecked())
			exclusive.append(a->property("userid").toInt());
	}

	if(useraction == _lock) {
		bool enable = !useraction->isChecked();

		_allusers->setEnabled(enable);
		foreach(QAction *a, _users)
			a->setEnabled(enable);

	} else if(useraction == _allusers) {
		// No user has exclusive access
		exclusive.clear();
		_allusers->setChecked(true);
		foreach(QAction *a, _users)
			a->setChecked(false);

	} else {
		// User exclusive access bit changed.
		_allusers->setChecked(exclusive.isEmpty());
	}

	// Send ACL update message
	emit layerAclChange(_lock->isChecked(), exclusive);
}
Example #22
0
bool Exoplanet::isDiscovered(const StelCore *core)
{
	int year, month, day;
	QList<int> discovery;
	// For getting value of new year from midnight at 1 Jan we need increase a value of JD on 0.5.
	// This hack need for correct display of discovery mode of exoplanets.
	StelUtils::getDateFromJulianDay(core->getJD()+0.5, &year, &month, &day);
	discovery.clear();
	for (const auto& p : exoplanets)
	{
		if (p.discovered>0)
		{
			discovery.append(p.discovered);
		}
	}
	qSort(discovery.begin(),discovery.end());
	if (!discovery.isEmpty()) 
	{
		if (discovery.at(0)<=year && discovery.at(0)>0)
		{
			return true;
		}
	}
	return false;
}
void Ut_DeviceLock::cleanup()
{
    delete deviceLock;

    qTimerStartMsec.clear();
    qTimerStopCount = 0;
}
Example #24
0
bool OGRGDALHelpers::convertConnectionsStringToList(const QString& ConnStr,
                                                    QList<SourceConnection>& ConnList)
{
  ConnList.clear();

  QStringList UnitsList = ConnStr.split(";",QString::SkipEmptyParts);

  if (!UnitsList.isEmpty())
  {
    for (int i=0; i< UnitsList.size(); i++)
    {
      QStringList ClassIDPair = UnitsList[i].split("#",QString::SkipEmptyParts);

      if (ClassIDPair.size() != 2)
        return false;

      ClassIDPair[0] = ClassIDPair[0].trimmed();
      ClassIDPair[1] = ClassIDPair[1].trimmed();

      bool OK = false;
      int ID = ClassIDPair[1].toInt(&OK);

      if (!OK)
        return false;

      ConnList.append(SourceConnection(ClassIDPair[0],ID));
    }
  }

  return true;
}
Example #25
0
void ConsolePlan::getSpots()
{
    m_spots.clear();
    QList<int> spotOrder;

    if (m_planeSpots.size() == 0)
    {
        emit error(ErrorPlaneNoSuchSpot);
    }else
    {
        QHash<float,QList<Plane2DCoordinate> >::iterator i;
        for (i = m_planeSpots.begin();i != m_planeSpots.end();i++)
        {
            m_spots.insert(i.key(),transferCoordinate(i.key(),i.value()));

            spotOrder.clear();
            for (int j=0;j<i.value().count();j++)
            {
                spotOrder << j;
            }
            setSpotOrder(i.key(),spotOrder);
        }
    }

    emit updateSpots(m_spots);
}
Example #26
0
void MainWindowImpl::addFile(const QString &name, QStandardItem *root)
{
    QList<QStandardItem *> items;

    QStringList libs = d->libs.getLibraryChildren(name);

    foreach(QString soname, libs) {
        QString lib = d->libs.getLibraryPath(soname);
        items << new QStandardItem(soname);

        if (lib.isEmpty()) {
            items << new QStandardItem(tr("not found"));

            QFont f = items[0]->font();
            f.setItalic(true);

            items[0]->setFont(f);
            items[1]->setFont(f);
        }
        else {
            items << new QStandardItem(lib);
        }

        root->appendRow(items);

        if(!lib.isEmpty())
        {
            addFile(soname, root->child(root->rowCount() - 1, 0));
        }

        items.clear();
    }
Example #27
0
    void refreshAddressTable()
    {
        cachedAddressTable.clear();
        {
            LOCK(wallet->cs_wallet);
            BOOST_FOREACH(const PAIRTYPE(CTxDestination, std::string)& item, wallet->mapAddressBook)
            {
                const CBitcoinAddress& address = item.first;
                const std::string& strName = item.second;
                bool fMine = IsMine(*wallet, address.Get());
                bool fMyShare = IsMyShare(*wallet, address.Get());
                AddressTableEntry::Type type = fMine ? AddressTableEntry::Receiving : AddressTableEntry::Sending;
                AddressTableEntry::Category cate = AddressTableEntry::Normal;
                if ( fMyShare )
                {
                    cate = AddressTableEntry::MultiSig;
                    type = AddressTableEntry::Sending;
                }

                cachedAddressTable.append(AddressTableEntry(type,
                                  QString::fromStdString(strName),
                                  QString::fromStdString(address.ToString()), cate));
            }
        }
        // qLowerBound() and qUpperBound() require our cachedAddressTable list to be sorted in asc order
        qSort(cachedAddressTable.begin(), cachedAddressTable.end(), AddressTableEntryLessThan());
    }
Example #28
0
QList<Dialect> Dialect::companionLanguages() const
{
    QList<Dialect> langs;
    langs << *this;
    switch (m_dialect) {
    case Dialect::JavaScript:
    case Dialect::Json:
    case Dialect::QmlProject:
    case Dialect::QmlTypeInfo:
        break;
    case Dialect::QmlQbs:
        langs << Dialect::JavaScript;
        break;
    case Dialect::Qml:
        langs << Dialect::QmlQtQuick2 << Dialect::QmlQtQuick2Ui << Dialect::JavaScript;
        break;
    case Dialect::QmlQtQuick2:
    case Dialect::QmlQtQuick2Ui:
        langs.clear();
        langs << Dialect::QmlQtQuick2 << Dialect::QmlQtQuick2Ui << Dialect::Qml
              << Dialect::JavaScript;
        break;
    case Dialect::AnyLanguage:
        langs << Dialect::JavaScript << Dialect::Json << Dialect::QmlProject << Dialect:: QmlQbs
              << Dialect::QmlTypeInfo << Dialect::QmlQtQuick2
              << Dialect::QmlQtQuick2Ui << Dialect::Qml;
        break;
    case Dialect::NoLanguage:
        return QList<Dialect>(); // return at least itself?
    }
    if (*this != Dialect::AnyLanguage)
        langs << Dialect::AnyLanguage;
    return langs;
}
Example #29
0
/** This seems to be called when the user has selected a rectangle
* using the mouse.
*
* @param dets :: returns a list of detector IDs selected.
*/
void Projection3D::getSelectedDetectors(QList<int> &dets) {
  dets.clear();
  if (!hasSelection())
    return;
  double xmin, xmax, ymin, ymax, zmin, zmax;
  m_viewport.getInstantProjection(xmin, xmax, ymin, ymax, zmin, zmax);
  QRect rect = selectionRect();
  int w, h;
  m_viewport.getViewport(w, h);

  double xLeft = xmin + (xmax - xmin) * rect.left() / w;
  double xRight = xmin + (xmax - xmin) * rect.right() / w;
  double yBottom = ymin + (ymax - ymin) * (h - rect.bottom()) / h;
  double yTop = ymin + (ymax - ymin) * (h - rect.top()) / h;
  size_t ndet = m_instrActor->ndetectors();

  // Cache all the detector positions if needed. This is slow, but just once.
  m_instrActor->cacheDetPos();

  for (size_t i = 0; i < ndet; ++i) {
    detid_t detId = m_instrActor->getDetID(i);
    V3D pos = m_instrActor->getDetPos(i);
    m_viewport.transform(pos);
    if (pos.X() >= xLeft && pos.X() <= xRight && pos.Y() >= yBottom &&
        pos.Y() <= yTop) {
      dets.push_back(detId);
    }
  }
}
Example #30
0
QList<int> MiaMarkerStatistics::findBifurcationPoints(QList<MiaPoint4D>& lineA, QList<MiaPoint4D>& lineB)
{
    QList<int> bpts;
    bpts.clear();
    bool lineMeet = false;
    for(int i = 0 ; i < lineA.size(); i ++)
    {
        MiaPoint4D pt = lineA.at(i);
        bool attachToLineB = false;

        for(int j = 0; j < lineB.size(); j++)
        {
            float dist = pt.distance(lineB.at(j));
            if(dist<0.5)
            {
                attachToLineB = true;
                break;
            }
        }

        if(attachToLineB && lineMeet == false)
        {
            lineMeet = true;
            bpts.append(i);
        }
        else if(!attachToLineB && lineMeet == true)
        {
            lineMeet = false;
            bpts.append(i);
        }

    }
    return bpts;
}