Example #1
0
void KeyFrameModel::computeKeyFrame(const int idx){
	cout<<"keyframe model is computing keyframe for image ["<<idx<<"]"<<endl;
	if(!(coreInterface->coreIsSet())){
		cout<<"keyframe model Error: core is not set!";
		return;
	}
	//setImageIdx(idx);
	KeyFrame kf;
	int levels = 4;
	coreInterface->computeKeyFrame(idx, kf);
	cout<<"level 0 image size: "<<kf.aLevels[0].im.size()<<"corners: "<<kf.aLevels[0].vMaxCorners.size()<<"/"<<kf.aLevels[0].vCorners.size()<<endl;
	cout<<"level 1 image size: "<<kf.aLevels[1].im.size()<<"corners: "<<kf.aLevels[1].vMaxCorners.size()<<"/"<<kf.aLevels[1].vCorners.size()<<endl;
	cout<<"level 2 image size: "<<kf.aLevels[2].im.size()<<"corners: "<<kf.aLevels[2].vMaxCorners.size()<<"/"<<kf.aLevels[2].vCorners.size()<<endl;
	cout<<"level 3 image size: "<<kf.aLevels[3].im.size()<<"corners: "<<kf.aLevels[3].vMaxCorners.size()<<"/"<<kf.aLevels[3].vCorners.size()<<endl;

	QList<QList<QPointF> > levelCorners;
	for(int i=0; i<levels; i++){
		int cornerSize = kf.aLevels[i].vCorners.size();
		QList<QPointF> corners;
		for(int j=0; j<cornerSize; j++){
			int x = kf.aLevels[i].vCorners[j].x;
			int y = kf.aLevels[i].vCorners[j].y;
			double x_level0 = LevelZeroPos(x,i);
			double y_level0 = LevelZeroPos(y,i);
			corners.push_back(QPointF(x_level0,y_level0));
		}
		levelCorners.push_back(corners);
	}

	emit keyFrameCornersReady(levelCorners);
}
Example #2
0
QList<QList<double> > TableView::getColumns(int id0,int id1,int id2,int id3)
{
    QList<QList<double> > list;

    QTableWidget* table =  getTableWidget();
    if(0!=table)
    {
        for(int i=0;i<getRowCount();i++)
        {

            bool isOk = false;
            QList<double> small;
            for(int j=0;j<getColumnCount();j++)
            {
                if(j==id0||j==id1||j==id2||j==id3)
                {
                    QTableWidgetItem* wi = table->item(i,j);
                    if(!wi)
                        continue;
                    double dat = wi->data(Qt::DisplayRole).toDouble(&isOk);
                    if(isOk){
                        small.push_back(dat);
                    }
                }
            }
            list.push_back(small);
        }

    }

    return list;
}
Example #3
0
QList<QString> divMessage(QString  mess) {
    qDebug()<<" div mess total size "<<mess.size();
    QList<QString> re;
    QString sec = "\n";
    const int maxSize = 30000;
    while(mess.size() > maxSize) {
        int index =0;
        while(true) {
            int nindex = mess.indexOf(sec,index + 1);
            if (nindex > maxSize) break;
            if (nindex<0) {
                goto end;
            }
            index = nindex;
        }
        re.push_back( mess.left(index) + myTr("\n未完接楼下"));
        qDebug()<<" div size "<<index;
        mess = mess.right(mess.size() - index - sec.size());
    }
    end:
    re.push_back(mess);
    qDebug()<<" div size "<<mess.size();
    qDebug()<<" div mess over";
    return re;
}
Example #4
0
  /** 
   * This method is called when the user selects a row or rows
   * uses the delete button or selects the delete row menu item
   * from the file menu.
   * 
   */
  void TableMainWindow::deleteRows () {
    QList<QTableWidgetItem*> list = p_table->selectedItems();
    QList<int> selectedRows;

    for(int i = 0; i < list.size(); i++) {
      if(selectedRows.size() == 0) {
        selectedRows.push_back(p_table->row(list[i]));
      } else if(!selectedRows.contains(p_table->row(list[i]))){
        selectedRows.push_back(p_table->row(list[i]));
      }
    }
    
    qSort(selectedRows.begin(), selectedRows.end());
    for(int d = selectedRows.size(); d > 0; d--) {
      p_table->removeRow(selectedRows[d-1]);
    }
  
    // get the number of rows that are filled in
    int filledRows = 0;
    for(int r = 0; r <  p_table->rowCount(); r++ ) {
      for(int c =0; c < p_table->columnCount(); c++) {
        if(!p_table->item(r,c) || p_table->item(r,c)->text() != "") {
          filledRows++;
          break;
        }
      }
    }
 
    p_currentRow = filledRows;    
  }
Example #5
0
/**
 * @brief ResultsPageWidget::setResults
 * @param result
 */
void ResultsPageWidget::setResults(SearchResult result) {
    updateProgressBar(1.0);

    mResult = std::make_shared<SearchResult>(std::move(result));
    mResult->sortByScore();
    mModel.setSearchResult(mResult.get());

    ConfigData* data = ConfigData::getInstance();
    if (data->getSoundOn()) {
        Q_INIT_RESOURCE(application);
        QSound::play(":/sound.wav");
    }

    QVariant varQuery;
    emit readFromStack(3, varQuery);
    if (varQuery.canConvert<std::shared_ptr<SearchQuery>>()) {
        SearchQuery* query = varQuery.value<std::shared_ptr<SearchQuery>>().get();
        SearchFeedback feedback = mModel.getFeedback();

        QList<DataPacket*> algoInputs;
        algoInputs.push_back(query);
        algoInputs.push_back(&feedback);

        if(mAlgorithm->setInputs(algoInputs)){
            ui->btnNewSearch->setEnabled(true);
        }

    } else {
        LOG_ERR("could not find search query on stack");
    }
    setCursor(QCursor(Qt::CursorShape::ArrowCursor));
}
Example #6
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimWellLogPlot::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly)
{
    QList<caf::PdmOptionItemInfo> options; 

    if (fieldNeedingOptions == &m_depthType )
    {
        using DepthAppEnum = caf::AppEnum< DepthTypeEnum >;
        for (size_t i = 0; i < DepthAppEnum::size(); ++i)
        {
            DepthTypeEnum enumVal = DepthAppEnum::fromIndex(i);

            if (m_disabledDepthTypes.count( enumVal) == 0) 
            {
                options.push_back(caf::PdmOptionItemInfo(DepthAppEnum::uiText(enumVal), enumVal));
            }
        }    
    }
    else if ( fieldNeedingOptions == &m_depthUnit)
    {
        using UnitAppEnum = caf::AppEnum< RiaDefines::DepthUnitType >;
        options.push_back(caf::PdmOptionItemInfo(UnitAppEnum::uiText(RiaDefines::UNIT_METER), RiaDefines::UNIT_METER));
        options.push_back(caf::PdmOptionItemInfo(UnitAppEnum::uiText(RiaDefines::UNIT_FEET), RiaDefines::UNIT_FEET));
    }

    (*useOptionsOnly) = true;
    return options;
}
Example #7
0
HistoryKeeper *HistoryKeeper::getInstance()
{
    historyMutex.lock();
    if (historyInstance == nullptr)
    {
        QList<QString> initLst;
        initLst.push_back(QString("CREATE TABLE IF NOT EXISTS history (id INTEGER PRIMARY KEY AUTOINCREMENT, timestamp INTEGER NOT NULL, ") +
                          QString("chat_id INTEGER NOT NULL, sender INTEGER NOT NULL, message TEXT NOT NULL, alias TEXT);"));
        initLst.push_back(QString("CREATE TABLE IF NOT EXISTS aliases (id INTEGER PRIMARY KEY AUTOINCREMENT, user_id TEXT UNIQUE NOT NULL);"));
        initLst.push_back(QString("CREATE TABLE IF NOT EXISTS chats (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT UNIQUE NOT NULL, ctype INTEGER NOT NULL);"));
        initLst.push_back(QString("CREATE TABLE IF NOT EXISTS sent_status (id INTEGER PRIMARY KEY AUTOINCREMENT, status INTEGER NOT NULL DEFAULT 0);"));

        QString path(":memory:");
        GenericDdInterface *dbIntf;

        if (Nexus::getProfile()->isEncrypted())
        {
            path = getHistoryPath();
            dbIntf = new EncryptedDb(path, initLst);

            historyInstance = new HistoryKeeper(dbIntf);
            return historyInstance;
        }
        else
        {
            path = getHistoryPath();
        }

        dbIntf = new PlainDb(path, initLst);
        historyInstance = new HistoryKeeper(dbIntf);
    }
    historyMutex.unlock();

    return historyInstance;
}
Example #8
0
void EquipCard::use(Room *room, ServerPlayer *source, QList<ServerPlayer *> &targets) const
{
    if (targets.isEmpty()) {
        CardMoveReason reason(CardMoveReason::S_REASON_USE, source->objectName(), QString(), this->getSkillName(), QString());
        room->moveCardTo(this, source, NULL, Player::DiscardPile, reason, true);
    }
    int equipped_id = Card::S_UNKNOWN_CARD_ID;
    ServerPlayer *target = targets.first();
    if (target->getEquip(location()))
        equipped_id = target->getEquip(location())->getEffectiveId();

    QList<CardsMoveStruct> exchangeMove;
    CardsMoveStruct move1(getEffectiveId(), target, Player::PlaceEquip,
        CardMoveReason(CardMoveReason::S_REASON_USE, target->objectName()));
    exchangeMove.push_back(move1);
    if (equipped_id != Card::S_UNKNOWN_CARD_ID) {
        CardsMoveStruct move2(equipped_id, NULL, Player::DiscardPile,
            CardMoveReason(CardMoveReason::S_REASON_CHANGE_EQUIP, target->objectName()));
        exchangeMove.push_back(move2);
    }
    LogMessage log;
    log.from = target;
    log.type = "$Install";
    log.card_str = QString::number(getEffectiveId());
    room->sendLog(log);

    room->moveCardsAtomic(exchangeMove, true);
}
Example #9
0
//@function     testing function
void testor(void)
{

    qDebug() << LEFT(2);
    qDebug() << RIGHT(2);
    qDebug() << PARENT(5);
    qDebug() << PARENT(6);

    QList<QPoint> openlist;
    openlist.push_back(QPoint(1,0));
    openlist.push_back(QPoint(0,1));
    openlist.push_back(QPoint(2,1));
    openlist.push_back(QPoint(2,3));
    openlist.push_back(QPoint(1,1));

    for (int i =0; i< openlist.size(); i++)
        qDebug() << openlist.at(i);

    for (int i=0; i< openlist.size(); i++)
    {
        for(int j=i+1; j< openlist.size(); j++)
        {
            if (openlist.at(i).x()>openlist.at(j).x())
                openlist.swap(i,j);
            else if ((openlist.at(i).x()==openlist.at(j).x()) && openlist.at(i).y()>openlist.at(j).y())
                openlist.swap(i,j);

        }
    }
    qDebug() << "-----------------";
    for (int i =0; i< openlist.size(); i++)
        qDebug() << openlist.at(i);

}
void GraphGraphicsView::Dijkstra(int s, int to)
{
    QList<int> d;
    QList<int> prev;
    QList<bool> found;
    int u;
    bool foundNext = false;
    for (int i = 0; i < nodes.length(); ++i) {
        d.push_back(50000);
        prev.push_back(-1);
        found.push_back(false);
    }

    d[s] = 0;
    CondMinSearch(d,found,u,foundNext);

    while(foundNext)
    {
        found[u] = true;
        for (int v = 0; v < adjMatrix.length(); ++v) {
            if (adjMatrix[u][v] != 0 && !found[v] && d[u] + adjMatrix[u][v] < d[v]) {
                d[v] = d[u] + adjMatrix[u][v];
                prev[v] = u;
            }
        }
        CondMinSearch(d,found,u,foundNext);
    }
    prevs = prev;
    QString prevString;
    for (int i = 0; i < prevs.length(); ++i) {
        prevString.append(QString::number(prevs[i]) + " ");
    }
    //qDebug() << prevString;
    drawShortestPath(s, to);
}
Example #11
0
QString huffdecoditication::TreeHuffmanDecodificationLeft(QString huff)
{
    QList<char> test;
    QString TreeHuffmanDecodificationLeft;
    if(huff.at(0).toLatin1()=='(')
    {
        test.push_back('(');
        for(int i=1;i<huff.size();i++)
        {
            if(huff.at(i).toLatin1()=='(' && huff.at(i-1).toLatin1()!='-')
            {
                test.push_back('(');
            }
            if(huff.at(i).toLatin1()==')' && huff.at(i-1).toLatin1()!='-')
            {
                test.pop_back();
            }
            if(test.isEmpty())
            {
                break;
            }
            TreeHuffmanDecodificationLeft.append(huff.at(i));
        }
    }
    else
    {
        TreeHuffmanDecodificationLeft=huff.at(0);
        if(huff.at(0).toLatin1()=='-')
        {
            TreeHuffmanDecodificationLeft=huff.at(1);
        }
    }

    return TreeHuffmanDecodificationLeft;
}
Example #12
0
void RepisaModelo::ObtenerConsulta()
{
    QString ord;

  //  if(GrupoBoton->button(1)->isChecked())
    {
        ord="asc";
    }
  //  if(GrupoBoton->button(2)->isChecked())
    {
        ord="desc";
    }
    Ordenamiento=ord;
    OrderByCampo="codigo";
    Modelo* ObjetoBusqueda=new Modelo();

    switch (IndiceBusqueda)
    {
    case 0:
        ObjetoBusqueda->setCodigo(LineBuscar->text());
        OrderByCampo="codigo";
        break;
    case 1:
        ObjetoBusqueda->setCodigoImagen(LineBuscar->text());
        OrderByCampo="codigo_imagen";
        break;
    case 2:
        ObjetoBusqueda->setNombre(LineBuscar->text());
        OrderByCampo="nombre";
        break;
    default:
        break;
    }


    Bd->Fabrica->Conectar();


    QString Extra=" order by "+OrderByCampo+" "+ord+" LIMIT "+QString::number(RegistrosBusqueda)+" offset 0";
    QSqlQueryModel* Model= FabricaLocal->BuscarTabla(*ObjetoBusqueda,Extra,CAMPOS);
    Bd->Fabrica->Desconectar();


    Model->setHeaderData(0,Qt::Horizontal,"Codigo");
    Model->setHeaderData(1,Qt::Horizontal,"Nombre");
    Model->setHeaderData(2,Qt::Horizontal,"Codigo Imagen");
    Model->setHeaderData(3,Qt::Horizontal,"Ruta");


    QList<bool> CamposVisibles;
    CamposVisibles.push_back(true);
    CamposVisibles.push_back(true);
    CamposVisibles.push_back(true);
    CamposVisibles.push_back(true);


    emit my_signal(Model,CamposVisibles);
    ActualizarMapa((ObjetoMaestro*)ObjetoBusqueda);

}
Example #13
0
void
Splitter::setChildrenSize(int left, int right)
{
    QList<int> sizes;
    sizes.push_back(left);
    sizes.push_back(right);
    setSizes_mt_safe(sizes);
}
Example #14
0
void MainWindow::setUI(){
    QList<QString> headers;
    headers.push_back("Palabra");
    headers.push_back("Significado");
    headers.push_back("Tags");
    ui->tbWords->setHorizontalHeaderLabels(headers);
    ui->tbWords->setEditTriggers(0);
}
Example #15
0
void QgsSingleBandGrayRenderer::legendSymbologyItems( QList< QPair< QString, QColor > >& symbolItems ) const
{
  if ( mContrastEnhancement && mContrastEnhancement->contrastEnhancementAlgorithm() != QgsContrastEnhancement::NoEnhancement )
  {
    symbolItems.push_back( qMakePair( QString::number( mContrastEnhancement->minimumValue() ), QColor( 0, 0, 0 ) ) );
    symbolItems.push_back( qMakePair( QString::number( mContrastEnhancement->maximumValue() ), QColor( 255, 255, 255 ) ) );
  }
}
Example #16
0
void WikiDialog::insertGroupsData(const std::list<RsGroupMetaData> &wikiList)
{
	std::list<RsGroupMetaData>::const_iterator it;

	QList<GroupItemInfo> adminList;
	QList<GroupItemInfo> subList;
	QList<GroupItemInfo> popList;
	QList<GroupItemInfo> otherList;
	std::multimap<uint32_t, GroupItemInfo> popMap;

	for (it = wikiList.begin(); it != wikiList.end(); it++) {
		/* sort it into Publish (Own), Subscribed, Popular and Other */
		uint32_t flags = it->mSubscribeFlags;

		GroupItemInfo groupItemInfo;
		GroupMetaDataToGroupItemInfo(*it, groupItemInfo);

		if (IS_GROUP_ADMIN(flags)) {
			adminList.push_back(groupItemInfo);
		} else if (IS_GROUP_SUBSCRIBED(flags)) {
			/* subscribed forum */
			subList.push_back(groupItemInfo);
		} else {
			/* rate the others by popularity */
			popMap.insert(std::make_pair(it->mPop, groupItemInfo));
		}
	}

	/* iterate backwards through popMap - take the top 5 or 10% of list */
	uint32_t popCount = 5;
	if (popCount < popMap.size() / 10)
	{
		popCount = popMap.size() / 10;
	}

	uint32_t i = 0;
	uint32_t popLimit = 0;
	std::multimap<uint32_t, GroupItemInfo>::reverse_iterator rit;
	for(rit = popMap.rbegin(); ((rit != popMap.rend()) && (i < popCount)); rit++, i++) ;
	if (rit != popMap.rend()) {
		popLimit = rit->first;
	}

	for (rit = popMap.rbegin(); rit != popMap.rend(); rit++) {
		if (rit->second.popularity < (int) popLimit) {
			otherList.append(rit->second);
		} else {
			popList.append(rit->second);
		}
	}

	/* now we can add them in as a tree! */
	ui.groupTreeWidget->fillGroupItems(mYourGroups, adminList);
	ui.groupTreeWidget->fillGroupItems(mSubscribedGroups, subList);
	ui.groupTreeWidget->fillGroupItems(mPopularGroups, popList);
	ui.groupTreeWidget->fillGroupItems(mOtherGroups, otherList);

}
Example #17
0
QList<QVariant> GLEDrawingObject::getFontStyles()
{
	QList<QVariant> flv;
	flv.push_back(tr("Roman"));
	flv.push_back(tr("Bold"));
	flv.push_back(tr("Italic"));
	flv.push_back(tr("Bold Italic"));
	return flv;
}
 void testParseMultiLeafWhitespace() {
     lisp_exp result = lisp_exp::parseString(" \t\n ( \t\n abc \t\n def \t\n ghi \t\n ) \t\n ");
     QList<lisp_exp> elements;
     elements.push_back(lisp_exp("abc"));
     elements.push_back(lisp_exp("def"));
     elements.push_back(lisp_exp("ghi"));
     lisp_exp expected(elements);
     QCOMPARE(result, expected);
 }
 void testParseMultiLeaf() {
     lisp_exp result = lisp_exp::parseString("(abc def ghi)");
     QList<lisp_exp> elements;
     elements.push_back(lisp_exp("abc"));
     elements.push_back(lisp_exp("def"));
     elements.push_back(lisp_exp("ghi"));
     lisp_exp expected(elements);
     QCOMPARE(result, expected);
 }
Example #20
0
void MainWindow::closeSidebar()
{
  QList<int> sizeList;

  sizeList.push_back(1);

  sizeList.push_back(0);

  m_mainSplitter->setSizes(sizeList);
}
Example #21
0
void PatMainWindow::openSidebar()
{
  QList<int> sizeList;

  sizeList.push_back(2);

  sizeList.push_back(1);

  m_mainSplitter->setSizes(sizeList);
}
SetMarkedObjectPropertyDlg::SetMarkedObjectPropertyDlg(QWidget* parent)
    : QDialog(parent)
    , Ui::SetMarkedObjectPropertyDlg()
    , mMarkedObjectTreeRoot(NULL)
    , mColorSelectorLocked(false)
{
    setupUi(this);

    //设置初始值
    setMarkedTypeItems(QStringList());
    setMarkedTypeName(QString());
    setMarkedObjectName(QString());
    setMarkedObjectColor(QColor(0, 0, 255));

    //为不同类别预生成颜色列表
    //颜色分配方案说明:按灰度从0.0到1.0对应到伪彩色(从蓝到红),灰度依次为0.0、1.0、0.5、0.25、0.75、0.125、0.375、0.625、0.875……
    const unsigned PRE_CREATE_COLOR_NUM = 100; //默认预分配100个类型的颜色
    QList<float> grayValueList;
    grayValueList.reserve(PRE_CREATE_COLOR_NUM);
    grayValueList.push_back(0.0);
    grayValueList.push_back(1.0);
    unsigned level = 1;
    while (grayValueList.size() < PRE_CREATE_COLOR_NUM)
    {
        const float grayValueStep = 1.0 / (1 << level);
        for (unsigned colorIndexPerLevel = 1; colorIndexPerLevel < (1 << level); colorIndexPerLevel += 2)
        {
            grayValueList.push_back(grayValueStep * colorIndexPerLevel);
            if (grayValueList.size() >= PRE_CREATE_COLOR_NUM)
            {
                break;
            }
        }
        level++;
    }
    //qSort(grayValueList);
    mColorList.reserve(PRE_CREATE_COLOR_NUM);
    for (unsigned colorIndex = 0; colorIndex < PRE_CREATE_COLOR_NUM; colorIndex++)
    {
        mColorList.push_back(gray2PseudoColor(grayValueList.at(colorIndex)));
    }

    //设置选择颜色按钮响应
    connect(colorSelectButton, SIGNAL(clicked()), this, SLOT(selectColor()));

    //标记类型输入框内容改变时,名称输入框相应改变
    connect(typeComboBox, SIGNAL(editTextChanged(const QString &)), this, SLOT(autoSetMarkedObjectName(const QString &)));

    //标记类型输入框内容改变时,颜色相应改变
    connect(typeComboBox, SIGNAL(editTextChanged(const QString &)), this, SLOT(autoSetMarkedObjectColor(const QString &)));

    //“确定”按钮点击事件
    connect(okButton, SIGNAL(clicked()), this, SLOT(checkInputAndCommit()));
}
Example #23
0
void FirmwareUpdate::DownloadOver(bool err)
{
    isFrameTurn = false;

    //QString outString;
    if (err){
//        popWidget();
//
//        //outString = tr("The Lastest Firmware's Version was Downloaded.");
//        //DownloadPage->SetInfo(outString);
//        QList<int> outInfo;
//        outInfo.push_back(L_UPGRADE_DOWNLOAD_FINISHED);
//        DownloadPage->SetInfo(outInfo);
//
//        //WizardLayout->setCurrentIndex(2);
//        //WizardLayout->setCurrentWidget(DownloadPage);

        popWidget();

        //outString = tr("The Lastest Firmware's Version was Downloaded.");
        //DownloadPage->SetInfo(outString);
        QList<int> outInfo;
        //outInfo.push_back(L_UPGRADE_DOWNLOAD_FINISHED);
        outInfo.push_back(L_UPGRADE_DOWNLOAD_POPEXPLAIN);
        DownloadPage->SetInfo(outInfo);

        QString strPath;
        strPath = *DownInfo;
        GeniePlugin_FirmwareUpdate::writeGenieLog("Firmware save Path:" + strPath);
        CompletePage->SetInfo(strPath);
        CompletePage->setButtonEnabled(3);
        WizardLayout->setCurrentIndex(3);
        //WizardLayout->setCurrentWidget(DownloadPage);

    }else {
        //outString = tr("The Firmware Version is worng.");
        //outString = *DownInfo;
        //FinishPage->SetInfo(outString);
        QList<int> outInfo;
        outInfo.push_back(L_UPGRADE_FINISH_TITLE);
        outInfo.push_back(L_UPGRADE_FINISH_EXPLAIN);
        for(int i=0; i<intDownloadErr->size(); i++){
            outInfo.push_back(intDownloadErr->value(i));
        }
        FinishPage->SetInfo(outInfo, "NULL");
        FinishPage->setButtonEnabled(4);
        //WizardLayout->setCurrentWidget(FinishPage);
        WizardLayout->setCurrentIndex(4);
    }

    isDownloading = true;

}
Example #24
0
QList<QString> SoundSourceCoreAudio::supportedFileExtensions() {
    QList<QString> list;
    list.push_back("m4a");
    list.push_back("mp3");
    list.push_back("mp2");
    //Can add mp3, mp2, ac3, and others here if you want.
    //See:
    //  http://developer.apple.com/library/mac/documentation/MusicAudio/Reference/AudioFileConvertRef/Reference/reference.html#//apple_ref/doc/c_ref/AudioFileTypeID

    //XXX: ... but make sure you implement handling for any new format in ParseHeader!!!!!! -- asantoni
    return list;
}
Example #25
0
void VoteDialog::killThemAll()
{
    QList<int> playersForRevoting;
    playersForRevoting.push_back(condemned[0].first);
    for (int i = 1; i < condemned.size() && condemned[i].second == condemned[0].second; i++)
        playersForRevoting.push_back(condemned[i].first);


    for (int i = 0; i < players.size(); i++)
        if (playersForRevoting.contains(players[i]->getNumber())) players[i]->die();
    emit playersWereCondemned(playersForRevoting);
    this->close();
}
Example #26
0
QList<QString> HistoryKeeper::generateAddChatEntryCmd(const QString& chat, const QString& message, const QString& sender, const QDateTime &dt, bool isSent, QString dispName)
{
    QList<QString> cmds;

    int chat_id = getChatID(chat, ctSingle).first;
    int sender_id = getAliasID(sender);

    cmds.push_back(QString("INSERT INTO history (timestamp, chat_id, sender, message, alias) VALUES (%1, %2, %3, '%4', '%5');")
                   .arg(dt.toMSecsSinceEpoch()).arg(chat_id).arg(sender_id).arg(wrapMessage(message)).arg(dispName));
    cmds.push_back(QString("INSERT INTO sent_status (status) VALUES (%1);").arg(isSent));

    return cmds;
}
 void testToStringBigTree() {
     QList<lisp_exp> emptyList;
     QList<lisp_exp> list1;
     QList<lisp_exp> list2;
     QList<lisp_exp> list3;
     QList<lisp_exp> list4;
     QList<lisp_exp> innerList;
     QList<lisp_exp> baseList;
     list1.push_back(lisp_exp("abc"));
     list2.push_back(lisp_exp("def"));
     list2.push_back(lisp_exp("ghi"));
     list3.push_back(lisp_exp("jkl"));
     list3.push_back(lisp_exp("mno"));
     list4.push_back(lisp_exp("pqr"));
     innerList.push_back(lisp_exp(list2));
     innerList.push_back(lisp_exp(emptyList));
     innerList.push_back(lisp_exp(list3));
     baseList.push_back(lisp_exp(emptyList));
     baseList.push_back(lisp_exp(list1));
     baseList.push_back(lisp_exp(innerList));
     baseList.push_back(lisp_exp(list4));
     baseList.push_back(lisp_exp(emptyList));
     lisp_exp expected(baseList);
     QString s = expected.toString();
     lisp_exp result = lisp_exp::parseString(s);
     QCOMPARE(result, expected);
 }
Example #28
0
/**
 * @brief ResultsPageWidget::on_btnNewSearch_clicked
 */
void ResultsPageWidget::on_btnNewSearch_clicked() {
    bool newSearchPossible = true;

    QVariant varDatasetNo;
    emit readFromStack(4, varDatasetNo);
    if (!varDatasetNo.canConvert<int>()) {
        LOG_ERR("could not find dataset on stack");
    }

    QVariant varSearchQuery;
    emit readFromStack(3, varSearchQuery);
    if(!varSearchQuery.canConvert<std::shared_ptr<SearchQuery>>()) {
        newSearchPossible = false;
        LOG_ERR("could not find search query on stack");
    }

    QVariant varAlgorithm;
    emit readFromStack(2, varAlgorithm);
    if(!varAlgorithm.canConvert<QPointer<Algorithm>>()) {
        LOG_ERR("could not find algorithm on stack");
    }

    // ToDo: read parameters from stack

    QVariant varFeedback;
    if (newSearchPossible) {
        SearchQuery* query = varSearchQuery.value<std::shared_ptr<SearchQuery>>().get();
        auto feedback = std::make_shared<SearchFeedback>(mModel.getFeedback());

        QList<DataPacket*> algoInputs;
        algoInputs.push_back(query);
        algoInputs.push_back(feedback.get());

        varFeedback.setValue(feedback);

        if(!mAlgorithm->setInputs(algoInputs)){
            newSearchPossible = false;
        }
    }

    if (newSearchPossible) {
        emit pushToStack(varFeedback);
        emit pushToStack(varDatasetNo);
        emit pushToStack(varSearchQuery);
        emit pushToStack(varAlgorithm);
        //emit pushToStack(varParameter);
        emit exit(EXIT_NEW_SEARCH);
    }

}
 void testParseBigTree() {
     lisp_exp result = lisp_exp::parseString("(()(abc)((def ghi)()(jkl mno))(pqr)())");
     QList<lisp_exp> emptyList;
     QList<lisp_exp> list1;
     QList<lisp_exp> list2;
     QList<lisp_exp> list3;
     QList<lisp_exp> list4;
     QList<lisp_exp> innerList;
     QList<lisp_exp> baseList;
     list1.push_back(lisp_exp("abc"));
     list2.push_back(lisp_exp("def"));
     list2.push_back(lisp_exp("ghi"));
     list3.push_back(lisp_exp("jkl"));
     list3.push_back(lisp_exp("mno"));
     list4.push_back(lisp_exp("pqr"));
     innerList.push_back(lisp_exp(list2));
     innerList.push_back(lisp_exp(emptyList));
     innerList.push_back(lisp_exp(list3));
     baseList.push_back(lisp_exp(emptyList));
     baseList.push_back(lisp_exp(list1));
     baseList.push_back(lisp_exp(innerList));
     baseList.push_back(lisp_exp(list4));
     baseList.push_back(lisp_exp(emptyList));
     lisp_exp expected(baseList);
     QCOMPARE(result, expected);
 }
Example #30
0
void StarShape::updatePath(const QSizeF &size)
{
    Q_UNUSED(size);
    qreal radianStep = M_PI / static_cast<qreal>(m_cornerCount);

    createPoints(m_convex ? m_cornerCount : 2*m_cornerCount);

    KoSubpath &points = *m_subpaths[0];

    uint index = 0;
    for (uint i = 0; i < 2*m_cornerCount; ++i) {
        uint cornerType = i % 2;
        if (cornerType == base && m_convex)
            continue;
        qreal radian = static_cast<qreal>((i+1)*radianStep) + m_angles[cornerType];
        QPointF cornerPoint = QPointF(m_zoomX * m_radius[cornerType] * cos(radian), m_zoomY * m_radius[cornerType] * sin(radian));

        points[index]->setPoint(m_center + cornerPoint);
        points[index]->unsetProperty(KoPathPoint::StopSubpath);
        points[index]->unsetProperty(KoPathPoint::CloseSubpath);
        if (m_roundness[cornerType] > 1e-10 || m_roundness[cornerType] < -1e-10) {
            // normalized cross product to compute tangential vector for handle point
            QPointF tangentVector(cornerPoint.y()/m_radius[cornerType], -cornerPoint.x()/m_radius[cornerType]);
            points[index]->setControlPoint2(points[index]->point() - m_roundness[cornerType] * tangentVector);
            points[index]->setControlPoint1(points[index]->point() + m_roundness[cornerType] * tangentVector);
        } else {
            points[index]->removeControlPoint1();
            points[index]->removeControlPoint2();
        }
        index++;
    }

    // first path starts and closes path
    points[0]->setProperty(KoPathPoint::StartSubpath);
    points[0]->setProperty(KoPathPoint::CloseSubpath);
    // last point stops and closes path
    points.last()->setProperty(KoPathPoint::StopSubpath);
    points.last()->setProperty(KoPathPoint::CloseSubpath);

    normalize();

    QList<QPointF> handles;
    handles.push_back(points.at(tip)->point());
    if (! m_convex)
        handles.push_back(points.at(base)->point());
    setHandles(handles);

    m_center = computeCenter();
}