Exemple #1
0
//---------------------------------------------------------------------------------
void consolePrintChar(char c) {
//---------------------------------------------------------------------------------

	if(consoleX >= CONSOLE_WIDTH) {
		consoleX = 0;
		newRow();
	}

	u16*	ScreenBase = (u16 *)(VRAM + (SCREEN_BASE(consoleMap)<<3) + (consoleX<<1) + (consoleY<<6) );

	switch(c) {

		case 10:
		case 11:
		case 12:
		case 13:
			newRow();
			consoleX = 0;
			break;
		default:
			*(ScreenBase) = CHAR_PALETTE(consolePalette) | (u8)c;
		consoleX++;

	}
}
static void test_addMafLineToRow_1(CuTest *testCase) {
    row_t *obs = newRow(20);
    obs->name = stString_copy("seq1.chr0");
    obs->prevName = stString_copy("seq1.amazing");
    obs->multipleNames = true;
    obs->start = 3;
    obs->length = 10;
    obs->prevRightPos = 20;
    obs->strand = '+';
    obs->prevStrand = '+';
    obs->sourceLength = 100;
    row_copyIn(obs, "acgtacgtac");
    mafLine_t *ml = maf_newMafLineFromString("s seq1.chr_bleh 13 5 + 100 ACGTA", 10);
    addMafLineToRow(obs, ml);
    row_t *exp = newRow(20);
    exp->name = stString_copy("seq1.chr0");
    exp->prevName = stString_copy("seq1.chr_bleh");
    exp->multipleNames = true;
    exp->start = 3;
    exp->length = 15;
    exp->prevRightPos = 17;
    exp->strand = '+';
    exp->prevStrand = '+';
    exp->sourceLength = 15;
    row_copyIn(exp, "acgtacgtacACGTA");
    CuAssertTrue(testCase, rowsAreEqual(obs, exp));
    destroyRow(obs);
    destroyRow(exp);
    maf_destroyMafLineList(ml);
}
//---------------------------------------------------------------------------------
void consolePrintChar(char c) {
//---------------------------------------------------------------------------------

	if(col >= CONSOLE_WIDTH) {
		col = 0;

		newRow();
	}

	switch(c) {
		/*
			The only special characters we will handle are tab (\t), carriage return (\r) & line feed (\n).
			Carriage return & line feed will function the same: go to next line and put cursor at the beginning.
			For everything else, use VT sequences.

			Reason: VT sequences are more specific to the task of cursor placement.
			The special escape sequences \b \f & \v are archaic and non-portable.
		*/
		case 9:
			col += TAB_SIZE;
			break;
		case 10:
		case 13:
			newRow();
			col = 0;
			break;
		default:
			fontMap[col + row * CONSOLE_WIDTH] = fontPal | (u16)(c + fontOffset - fontStart);
			++col;
			break;
	}
}
Exemple #4
0
//---------------------------------------------------------------------------------
void consolePrintChar(char c) {
//---------------------------------------------------------------------------------
	if (c==0) return;
	if(currentConsole->fontBgMap == 0) return;

	if(currentConsole->PrintChar)
		if(currentConsole->PrintChar(currentConsole, c))
			return;

	if(currentConsole->cursorX  >= currentConsole->windowWidth) {
		currentConsole->cursorX  = 0;

		newRow();
	}

	switch(c) {
		/*
		The only special characters we will handle are tab (\t), carriage return (\r), line feed (\n)
		and backspace (\b).
		Carriage return & line feed will function the same: go to next line and put cursor at the beginning.
		For everything else, use VT sequences.

		Reason: VT sequences are more specific to the task of cursor placement.
		The special escape sequences \b \f & \v are archaic and non-portable.
		*/
		case 8:
			currentConsole->cursorX--;

			if(currentConsole->cursorX < 0) {
				if(currentConsole->cursorY > 0) {
					currentConsole->cursorX = currentConsole->windowX - 1;
					currentConsole->cursorY--;
				} else {
					currentConsole->cursorX = 0;
				}
			}

			currentConsole->fontBgMap[currentConsole->cursorX + currentConsole->windowX + (currentConsole->cursorY + currentConsole->windowY) * currentConsole->consoleWidth] = currentConsole->fontCurPal | (u16)(' ' + currentConsole->fontCharOffset - currentConsole->font.asciiOffset);

			break;

		case 9:
			currentConsole->cursorX  += currentConsole->tabSize - ((currentConsole->cursorX)%(currentConsole->tabSize));
			break;
		case 10:
			newRow();
		case 13:
			currentConsole->cursorX  = 0;
			break;
		default:
			currentConsole->fontBgMap[currentConsole->cursorX + currentConsole->windowX + (currentConsole->cursorY + currentConsole->windowY) * currentConsole->consoleWidth] = currentConsole->fontCurPal | (u16)(c + currentConsole->fontCharOffset - currentConsole->font.asciiOffset);
			++currentConsole->cursorX ;
			break;
	}
}
void QTodoExportPluginCSV::exportHead()
{
    addData(QObject::tr("Todo-List:")+" "+name()+" "+QObject::tr("Description: ")+" "+description()+" "+QObject::tr("Standing:")+" "+QTodoMisc::dateTime2LocalString(QDateTime::currentDateTime()));
    newRow();
    addData(QObject::tr("ID"));
    addData(QObject::tr("Parent"));
    addData(QObject::tr("Priority"));
    addData(QObject::tr("Status"));
    addData(QObject::tr("Deadline"));
    addData(QObject::tr("Assigned to"));
    addData(QObject::tr("Created"));
    addData(QObject::tr("Done"));
    addData(QObject::tr("Task"));
    newRow();
}
Exemple #6
0
ScreenControl::ScreenControl(QWidget *parent) : 
  QWidget(parent)
{
  setupUi(this);
  _autoSave=false;
  _keyColumns=1;
  _searchType=Query;
  _shown=false;
  _listReportName=QString();
  _print->setVisible(! _listReportName.isEmpty());
  
  _model = new XSqlTableModel;
  
  connect (_new,	SIGNAL(clicked()),	this,	SLOT(newRow()));
  connect (_save,       SIGNAL(clicked()),      this,   SIGNAL(saveClicked()));
  connect (_save,	SIGNAL(clicked()),	this,	SLOT(save()));
  connect (_print,	SIGNAL(clicked()),	this,	SIGNAL(printClicked()));
  connect (_print,      SIGNAL(clicked()),      this,   SLOT(print()));
  connect (_prev,	SIGNAL(clicked()),	this,	SLOT(toPrevious()));
  connect (_next,	SIGNAL(clicked()),	this,	SLOT(toNext()));
  connect (_search,	SIGNAL(clicked()),	this,	SLOT(search()));
  connect (_model,      SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, SLOT(enableSave()));
  
  _view->setVisible(FALSE);
  _save->setEnabled(false);

  _model->setEditStrategy(QSqlTableModel::OnManualSubmit);
}
Exemple #7
0
void ScreenControl::setMode(Modes p)
{
  if (DEBUG)
    qDebug("ScreenControl::setMode(%d)", p);

  if (p==New)
  {
    _mode=New;
    if (_new)  _new->setEnabled(true);
    newRow();
  }
  else if (p==Edit)
  {
    _mode=Edit;
    if (_new)  _new->setEnabled(true);
  }
  else
  {
    _mode=View;
    if (_new)  _new->setEnabled(false);
    if (_save) _save->setEnabled(false);
  }

  if (DEBUG)
    qDebug("ScreenControl::setMode() about to enable/disable widgets ");

  for (int i = 0; _mapper.model() && i < _mapper.model()->columnCount(); i++)
    if (_mapper.mappedWidgetAt(i))
      _mapper.mappedWidgetAt(i)->setEnabled(_mode != View);

  if (DEBUG)
    qDebug("ScreenControl::setMode() returning");
}
void tst_QScriptValueGenerated::qscriptvalue_castqint32_makeData(const char* expr)
{
    static const QHash<QString, qint32> value =
        charValueArraysToHash(qscriptvalue_castqint32_tagArray, qscriptvalue_castqint32_valueArray,
                              int(sizeof(qscriptvalue_castqint32_tagArray) / sizeof(const char *)));
    newRow(expr) << value.value(expr);
}
Exemple #9
0
void CSVParserHandler::addToRow(ValueVariable* val) {
	if (_currentrow==NULL) {
		newRow();
	}
	_currentrow->set(_column, val);
	_gtoken=(val!=NULL);
}
void tst_QScriptValueGenerated::qscriptvalue_castQString_makeData(const char* expr)
{
    static const QHash<QString, QString> valueMap =
        charArraysToStringHash(qscriptvalue_castQString_tagArray, qscriptvalue_castQString_valueArray,
                               int(sizeof(qscriptvalue_castQString_tagArray) / sizeof(const char *)));
    newRow(expr) << valueMap.value(expr);
}
Exemple #11
0
/* Future functionality
void formControl::previewForm()
{
}

void formControl::previewList()
{
}

void formControl::print()
{
}

void formControl::printForm()
{
}

void formControl::printList()
{
}
*/
void formControl::save()
{
  _mapper.submit();
  _model.submitAll();
  if (_mode=New)
    newRow();
}
Exemple #12
0
void PageScheme::connectSignals()
{
    connect(BtnCopy, SIGNAL(clicked()), this, SLOT(copyRow()));
    connect(BtnNew, SIGNAL(clicked()), this, SLOT(newRow()));
    connect(BtnDelete, SIGNAL(clicked()), this, SLOT(deleteRow()));
    mapper = new QDataWidgetMapper(this);
    connect(selectScheme, SIGNAL(currentIndexChanged(int)), mapper, SLOT(setCurrentIndex(int)));
    connect(selectScheme, SIGNAL(currentIndexChanged(int)), this, SLOT(schemeSelected(int)));
}
void tst_QScriptValueGenerated::qscriptvalue_castqint32_makeData(const char* expr)
{
    static QHash<QString, qint32> value;
    if (value.isEmpty()) {
        value.reserve(148);
        for (unsigned i = 0; i < 148; ++i)
            value.insert(qscriptvalue_castqint32_tagArray[i], qscriptvalue_castqint32_valueArray[i]);
    }
    newRow(expr) << value.value(expr);
}
Exemple #14
0
void CSVParserHandler::handleToken(Token& token) {
	switch (token.getType()) {
	case StringToken: {
		if (_gtoken) {
			if (token.compare(CSVParser::_whitespaceset)) {
				return; // ignore whitespace
			} else {
				throwex(CSVParserException(PARSERERROR_PARSER, "CSVParserHandler::handleToken", &token, &_parser,
					"Unexpected non-whitespace StringToken"));
			}
		}
		const UnicodeString& str=token.toString();
		int bv=Variable::stringToBool(str);
		if (bv!=-1) {
			addToRow(new BoolVariable(bv==1 ? true : false));
		} else {
			addToRow(new StringVariable(str));
		}
		}
		break;
	case QuotedStringToken:
		if (_gtoken) {
			throwex(CSVParserException(PARSERERROR_PARSER, "CSVParserHandler::handleToken", &token, &_parser,
				"Unexpected QuotedStringToken"));
		}
		addToRow(new StringVariable(token.toString()));
		break;
	case NumberToken:
		if (_gtoken) {
			throwex(CSVParserException(PARSERERROR_PARSER, "CSVParserHandler::handleToken", &token, &_parser,
				"Unexpected NumberToken"));
		}
		addToRow(new IntVariable(token.toInt()));
		break;
	case DoubleToken:
		if (_gtoken) {
			throwex(CSVParserException(PARSERERROR_PARSER, "CSVParserHandler::handleToken", &token, &_parser,
				"Unexpected DoubleToken"));
		}
		addToRow(new FloatVariable(token.toFloat()));
		break;
	case SeparatorToken:
		if (!_gtoken) {
			addToRow(NULL);
		}
		_gtoken=false;
		_column++;
		break;
	case EOLToken:
		newRow();
		break;
	case EOFToken:
		break;
	}
}
Exemple #15
0
// -- AboCommentsDialog -----------------------------------------------
AboCommentsDialog::AboCommentsDialog(const QString &telA, QWidget *parent)
  : QDialog(parent), telA_(telA)
{
  relModel = new AboCommentsModel(telA);

  tableView = new QTableView;
  tableView->setModel(relModel);

  // tableView->setItemDelegate(new QSqlRelationalDelegate(tableView));
  tableView->setSelectionMode(QAbstractItemView::SingleSelection);
  tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
  tableView->setColumnHidden(AboCommentsModel::TelA, true);
  tableView->setColumnHidden(AboCommentsModel::Uid, true);
  //tableView->resizeRowsToContents();

  newAction = new QAction(trUtf8("Добавить"), this);
  connect(newAction, SIGNAL(triggered()), this, SLOT(newRow()));

  removeAction = new QAction(trUtf8("Удалить"), this);
  connect(removeAction, SIGNAL(triggered()), this, SLOT(removeRow()));

  updateActions();

  tableView->addAction(newAction);
  tableView->addAction(removeAction);
  
  tableView->setContextMenuPolicy(Qt::ActionsContextMenu);
  tableView->setAlternatingRowColors(true);
  
  // tableView->sortByColumn(AboCommentsModel::Text, Qt::AscendingOrder);
  // tableView->setSortingEnabled(true);
  
  //tableView->setEditTriggers(QAbstractItemTableView::NoEditTriggers);

  tableView->verticalHeader()->hide();
  tableView->resizeColumnsToContents();

  tableView->setColumnWidth(AboCommentsModel::Text, 350);
  tableView->setColumnWidth(AboCommentsModel::Date, 90);
  tableView->selectRow(0);

  // tableView->setColumnWidth(AboComments_CatNum, 160);
  // tableView->setColumnWidth(AboComments_Text, 250);
  // tableView->setColumnWidth(AboComments_Place, 80);
  // tableView->setColumnWidth(AboComments_Brandname, 130);
  // tableView->horizontalHeader()->setStretchLastSection(true);

  QVBoxLayout *mainLayout = new QVBoxLayout;
  mainLayout->addWidget(tableView);
  setLayout(mainLayout);

  setWindowTitle(trUtf8("Комментарии [ %1 ]").arg(telA));
  setFixedWidth(tableView->horizontalHeader()->length()+50);
  setFixedHeight(380);
}
Exemple #16
0
 //! Change the number of bins per power spectrum
 void setNumColumns(const size_t numCols)
 {
     std::unique_lock<std::mutex> lock(_rasterMutex);
     if (numCols == _numCols) return;
     _numCols = numCols;
     for (auto &row : _data)
     {
         std::valarray<float> newRow(_numCols);
         for (size_t i = 0; i < newRow.size(); i++)
             newRow[i] = row[size_t((double(i)*(row.size()-1))/(newRow.size()-1))];
         row = newRow;
     }
 }
void TpccPaymentProcedure::insertHistory() {
  auto history = std::const_pointer_cast<storage::Store>(getTpccTable("HISTORY"));
  size_t row = newRow(history);
  storage::atable_ptr_t delta = history->getDeltaTable();
  delta->setValue<hyrise_int_t>("H_C_ID", row, _c_id);
  delta->setValue<hyrise_int_t>("H_C_D_ID", row, _c_d_id);
  delta->setValue<hyrise_int_t>("H_C_W_ID", row, _c_w_id);
  delta->setValue<hyrise_int_t>("H_D_ID", row, _d_id);
  delta->setValue<hyrise_int_t>("H_W_ID", row, _w_id);
  delta->setValue<hyrise_string_t>("H_DATE", row, _date);
  delta->setValue<hyrise_float_t>("H_AMOUNT", row, _h_amount);
  delta->setValue<hyrise_string_t>("H_DATA", row, _h_data);

  insert(history, row + history->deltaOffset());
}
void QTodoExportPluginCSV::exportItem(const QTodoItem& item)
{
    addData(QString::number(current_id));
    QTodoItem* parent = item.list()->parentTodo(&item);
    if(parent)
        addData(QString::number(item.list()->itemPos(item.list()->parentTodo(&item))+1));
    else
        addData("");
    addData(QTodo::priorityToString(item.getPriority()));
    addData(QTodo::statusToString(item.getStatus()));
    addData(item.getDeadlineLocalString());
    addData(item.getAgent());
    addData(item.getCreatedLocalString());
    addData(item.getDoneLocalString());
    addData(item.getTaskPlainText());
    newRow();
}
Exemple #19
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ListControl&
ListControl::addRow(const std::vector<std::string>& strings)
{
    ASSERT ( strings.size() <= numberOfColumns() );

    Row newRow(*this);
    for(unsigned i = 0; i < strings.size(); ++i)
    {
        newRow.setEntry(i, strings[i]);
    }

    rows_.push_back(newRow);

    onContentsChanged();

    return *this;
}
Exemple #20
0
void formControl::setMode(Modes p)
{
  if (p=New)
  {
    _mode=New;
    newRow();
  }
  else if (p=Edit)
  {
    _mode=Edit;
  }
  else
  {
    _mode=View;
    //to do: loop through each field, see if the is a widget     _mapper.mappedWidgetAt(int)  and disable
  }
    
}
Exemple #21
0
bool CSVWriter::writeCell(string str)
{
   if (!is_open())
       return false;
   else
   {
       if (str.find(' ') != string::npos)
           m_fout<<'\"'<<str<<'\"';
       else
           m_fout<<str;

       m_curCol++;

       if (m_curCol == m_cols && m_cols != 0)
           newRow();
       else
           m_fout<<", ";

       return true;
   }
}
Exemple #22
0
formControl::formControl(QWidget *parent) : 
  QWidget(parent)
{
  setupUi(this);
  _autoSave=false;
  _searchType=Query;
  _shown=false;
  
  connect (_new,	SIGNAL(clicked()),	this,	SLOT(newRow()));
  connect (_save,       SIGNAL(clicked()),      this,   SIGNAL(saveClicked()));
  connect (_save,	SIGNAL(clicked()),	this,	SLOT(save()));
  connect (_print,	SIGNAL(clicked()),	this,	SLOT(print()));
  connect (_prev,	SIGNAL(clicked()),	this,	SLOT(toPrevious()));
  connect (_next,	SIGNAL(clicked()),	this,	SLOT(toNext()));
  connect (_search,	SIGNAL(clicked()),	this,	SLOT(search()));
  
  //Hiding future functionality that has been commented out for now
  _print->setVisible(FALSE);
  _view->setVisible(FALSE);

}
Exemple #23
0
void ScreenControl::save()
{
  emit saving();
  int i=_mapper.currentIndex();
  _mapper.submit();
  _model->submitAll();
  _mapper.setCurrentIndex(i);
  qDebug("error %d",_model->lastError().isValid());
  if (_model->lastError().type() != QSqlError::NoError && _model->lastError().driverText() != "No Fields to update")
  {
    QMessageBox::critical(this, tr("Error Saving %1").arg(_tableName),
                          tr("Error saving %1 at %2::%3\n\n%4")
                          .arg(_tableName).arg(__FILE__).arg(__LINE__)
                          .arg(_model->lastError().databaseText()));
    return;
  }
  if (_mode==New)
    newRow();
  _save->setEnabled(false);
  emit saved(true);
}
Exemple #24
0
ReplyKeyboard::ReplyKeyboard(const HistoryItem *item, StylePtr &&s)
	: _item(item)
	, _a_selected(animation(this, &ReplyKeyboard::step_selected))
	, _st(std_::forward<StylePtr>(s)) {
	if (auto markup = item->Get<HistoryMessageReplyMarkup>()) {
		_rows.reserve(markup->rows.size());
		for (int i = 0, l = markup->rows.size(); i != l; ++i) {
			auto &row = markup->rows.at(i);
			int s = row.size();
			ButtonRow newRow(s, Button());
			for (int j = 0; j != s; ++j) {
				auto &button = newRow[j];
				auto str = row.at(j).text;
				button.type = row.at(j).type;
				button.link = MakeShared<ReplyMarkupClickHandler>(item, i, j);
				button.text.setText(_st->textFont(), textOneLine(str), _textPlainOptions);
				button.characters = str.isEmpty() ? 1 : str.size();
			}
			_rows.push_back(newRow);
		}
	}
}
        BodyMotionGenerationSetupDialog() : QDialog(MainWindow::instance()){

            setWindowTitle(_("Body Motion Generation Setup"));

            vbox = new QVBoxLayout();

            QHBoxLayout* hbox = newRow(vbox);
            hbox->addWidget(new QLabel(_("Time scale")));
            timeScaleRatioSpin.setDecimals(2);
            timeScaleRatioSpin.setRange(0.01, 9.99);
            timeScaleRatioSpin.setSingleStep(0.01);
            timeScaleRatioSpin.setValue(1.0);
            hbox->addWidget(&timeScaleRatioSpin);
            
            hbox->addSpacing(8);
            hbox->addWidget(new QLabel(_("Pre-initial")));
            preInitialDurationSpin.setDecimals(1);
            preInitialDurationSpin.setRange(0.0, 9.9);
            preInitialDurationSpin.setSingleStep(0.1);
            preInitialDurationSpin.setValue(1.0);
            hbox->addWidget(&preInitialDurationSpin);
            hbox->addWidget(new QLabel(_("[s]")));
            
            hbox->addSpacing(8);
            hbox->addWidget(new QLabel(_("Post-final")));
            postFinalDurationSpin.setDecimals(1);
            postFinalDurationSpin.setRange(0.0, 9.9);
            postFinalDurationSpin.setSingleStep(0.1);
            postFinalDurationSpin.setValue(1.0);
            hbox->addWidget(&postFinalDurationSpin);
            hbox->addWidget(new QLabel(_("[s]")));
            hbox->addStretch();

            hbox = newRow(vbox);
            onlyTimeBarRangeCheck.setText(_("Time bar's range only"));
            onlyTimeBarRangeCheck.setChecked(false);
            hbox->addWidget(&onlyTimeBarRangeCheck);
            
            se3Check.setText(_("Put all link positions"));
            se3Check.setChecked(false);
            hbox->addWidget(&se3Check);
            hbox->addStretch();
            
            hbox = newRow(vbox);
            newBodyItemCheck.setText(_("Make a new body item"));
            newBodyItemCheck.setChecked(true);
            hbox->addWidget(&newBodyItemCheck);
            hbox->addStretch();

            addSeparator(vbox, &stealthyStepCheck);
            stealthyStepCheck.setText(_("Stealthy Step Mode"));
            stealthyStepCheck.setToolTip(_("This mode makes foot lifting / landing smoother to increase the stability"));
            stealthyStepCheck.setChecked(true);

            hbox = newRow(vbox);
            hbox->addWidget(new QLabel(_("Height ratio thresh")));
            stealthyHeightRatioThreshSpin.setAlignment(Qt::AlignCenter);
            stealthyHeightRatioThreshSpin.setDecimals(2);
            stealthyHeightRatioThreshSpin.setRange(1.00, 9.99);
            stealthyHeightRatioThreshSpin.setSingleStep(0.01);
            stealthyHeightRatioThreshSpin.setValue(2.0);
            hbox->addWidget(&stealthyHeightRatioThreshSpin);
            hbox->addStretch();

            hbox = newRow(vbox);
            hbox->addWidget(new QLabel(_("Flat Lifting Height")));
            flatLiftingHeightSpin.setAlignment(Qt::AlignCenter);
            flatLiftingHeightSpin.setDecimals(3);
            flatLiftingHeightSpin.setRange(0.0, 0.0999);
            flatLiftingHeightSpin.setSingleStep(0.001);
            flatLiftingHeightSpin.setValue(0.005);
            hbox->addWidget(&flatLiftingHeightSpin);
            hbox->addWidget(new QLabel(_("[m]")));

            hbox->addSpacing(8);
            hbox->addWidget(new QLabel(_("Flat Landing Height")));
            flatLandingHeightSpin.setAlignment(Qt::AlignCenter);
            flatLandingHeightSpin.setDecimals(3);
            flatLandingHeightSpin.setRange(0.0, 0.0999);
            flatLandingHeightSpin.setSingleStep(0.001);
            flatLandingHeightSpin.setValue(0.005);
            hbox->addWidget(&flatLandingHeightSpin);
            hbox->addWidget(new QLabel(_("[m]")));
            hbox->addStretch();

            hbox = newRow(vbox);
            hbox->addWidget(new QLabel(_("Impact reduction height")));
            impactReductionHeightSpin.setAlignment(Qt::AlignCenter);
            impactReductionHeightSpin.setDecimals(3);
            impactReductionHeightSpin.setRange(0.0, 0.099);
            impactReductionHeightSpin.setSingleStep(0.001);
            impactReductionHeightSpin.setValue(0.005);
            hbox->addWidget(&impactReductionHeightSpin);
            hbox->addWidget(new QLabel(_("[m]")));
            
            hbox->addSpacing(8);
            hbox->addWidget(new QLabel(_("Impact reduction time")));
            impactReductionTimeSpin.setAlignment(Qt::AlignCenter);
            impactReductionTimeSpin.setDecimals(3);
            impactReductionTimeSpin.setRange(0.001, 0.999);
            impactReductionTimeSpin.setSingleStep(0.001);
            impactReductionTimeSpin.setValue(0.04);
            hbox->addWidget(&impactReductionTimeSpin);
            hbox->addWidget(new QLabel(_("[s]")));
            hbox->addStretch();
                             
            addSeparator(vbox, &autoZmpCheck);
            autoZmpCheck.setText(_("Auto ZMP Mode"));
            autoZmpCheck.setToolTip(_("Automatically insert ZMP and foot key poses for stable motion"));
            autoZmpCheck.setChecked(true);

            hbox = newRow(vbox);
            hbox->addWidget(new QLabel(_("Min. transtion time")));
            minZmpTransitionTimeSpin.setDecimals(2);
            minZmpTransitionTimeSpin.setRange(0.01, 0.99);
            minZmpTransitionTimeSpin.setSingleStep(0.01);
            minZmpTransitionTimeSpin.setValue(0.1);
            hbox->addWidget(&minZmpTransitionTimeSpin);
            hbox->addWidget(new QLabel(_("[s]")));

            hbox->addSpacing(8);
            hbox->addWidget(new QLabel(_("Centering time thresh")));
            zmpCenteringTimeThreshSpin.setDecimals(3);
            zmpCenteringTimeThreshSpin.setRange(0.001, 0.999);
            zmpCenteringTimeThreshSpin.setSingleStep(0.001);
            zmpCenteringTimeThreshSpin.setValue(0.03);
            hbox->addWidget(&zmpCenteringTimeThreshSpin);
            hbox->addWidget(new QLabel(_("[s]")));
            hbox->addStretch();

            hbox = newRow(vbox);
            hbox->addWidget(new QLabel(_("Time margin before lifting")));
            zmpTimeMarginBeforeLiftingSpin.setDecimals(3);
            zmpTimeMarginBeforeLiftingSpin.setRange(0.0, 0.999);
            zmpTimeMarginBeforeLiftingSpin.setSingleStep(0.001);
            zmpTimeMarginBeforeLiftingSpin.setValue(0.0);
            hbox->addWidget(&zmpTimeMarginBeforeLiftingSpin);
            hbox->addWidget(new QLabel(_("[s]")));
            hbox->addStretch();
            
            addSeparator(vbox);
            hbox = newRow(vbox);

            lipSyncMixCheck.setText(_("Mix lip-sync motion"));
            lipSyncMixCheck.setChecked(false);
            hbox->addWidget(&lipSyncMixCheck);
            hbox->addStretch();

            QVBoxLayout* topVBox = new QVBoxLayout();
            topVBox->addLayout(vbox);

            addSeparator(topVBox);

            QPushButton* okButton = new QPushButton(_("&Ok"));
            okButton->setDefault(true);
            QDialogButtonBox* buttonBox = new QDialogButtonBox(this);
            buttonBox->addButton(okButton, QDialogButtonBox::AcceptRole);
            connect(buttonBox,SIGNAL(accepted()), this, SLOT(accept()));
            topVBox->addWidget(buttonBox);

            setLayout(topVBox);
        }
void tst_QScriptValueGenerated::isQMetaObject_makeData(const char* expr)
{
    newRow(expr) << (qstrcmp(expr, "engine->newQMetaObject(&QObject::staticMetaObject)") ==  0);
}
void tst_QScriptValueGenerated::assignAndCopyConstruct_makeData(const char *expr)
{
    newRow(expr) << 0;
}
Exemple #28
0
void LimitedOrderBy::processRow(const rowgroup::Row& row)
{
    // check if this is a distinct row
    if (fDistinct && fDistinctMap->find(row.getPointer()) != fDistinctMap->end())
        return;

    // @bug5312, limit count is 0, do nothing.
    if (fCount == 0)
        return;

    // if the row count is less than the limit
    if (fOrderByQueue.size() < fStart+fCount)
    {
        copyRow(row, &fRow0);
        //memcpy(fRow0.getData(), row.getData(), row.getSize());
        OrderByRow newRow(fRow0, fRule);
        fOrderByQueue.push(newRow);

        // add to the distinct map
        if (fDistinct)
            fDistinctMap->insert(fRow0.getPointer());
        //fDistinctMap->insert(make_pair((fRow0.getData()+2), fRow0.getData()));

        fRowGroup.incRowCount();
        fRow0.nextRow();

        if (fRowGroup.getRowCount() >= fRowsPerRG)
        {
            fDataQueue.push(fData);
            uint64_t newSize = fRowsPerRG * fRowGroup.getRowSize();
            if (!fRm->getMemory(newSize))
            {
                cerr << IDBErrorInfo::instance()->errorMsg(fErrorCode)
                     << " @" << __FILE__ << ":" << __LINE__;
                throw IDBExcept(fErrorCode);
            }
            fMemSize += newSize;
            fData.reinit(fRowGroup, fRowsPerRG);
            fRowGroup.setData(&fData);
            fRowGroup.resetRowGroup(0);
            fRowGroup.getRow(0, &fRow0);
        }
    }

    else if (fOrderByCond.size() > 0 && fRule.less(row.getPointer(), fOrderByQueue.top().fData))
    {
        OrderByRow swapRow = fOrderByQueue.top();
        row1.setData(swapRow.fData);
        if (!fDistinct)
        {
            copyRow(row, &row1);
            //memcpy(swapRow.fData, row.getData(), row.getSize());
        }
        else
        {
            fDistinctMap->erase(row.getPointer());
            copyRow(row, &row1);
            fDistinctMap->insert(row1.getPointer());
            //fDistinctMap->erase(fDistinctMap->find(row.getData() + 2));
            //memcpy(swapRow.fData, row.getData(), row.getSize());
            //fDistinctMap->insert(make_pair((swapRow.fData+2), swapRow.fData));
        }
        fOrderByQueue.pop();
        fOrderByQueue.push(swapRow);
    }
}
void tst_QScriptValueGenerated::isError_makeData(const char* expr)
{
    static QSet<QString> isError =
        charArrayToQStringSet(isError_array, int(sizeof(isError_array) / sizeof(const char *)));
    newRow(expr) << isError.contains(expr);
}
Exemple #30
0
// -- ServicesDialog -----------------------------------------------
ServicesDialog::ServicesDialog(QWidget *parent)
  : QDialog(parent)
{
  findLabel = new QLabel(trUtf8("&Поиск"));
  findEdit = new QLineEdit;
  findLabel->setBuddy(findEdit);

  QHBoxLayout *topLayout = new QHBoxLayout;
  topLayout->addWidget(findLabel);
  topLayout->addWidget(findEdit);
  
  relModel = new ServicesModel;
  proxyModel = new QSortFilterProxyModel;
  // proxyModel->setDynamicSortFilter(false);
  proxyModel->setSourceModel(relModel);
  proxyModel->setFilterKeyColumn(-1);
  proxyModel->sort(ServicesModel::Text, Qt::AscendingOrder);

  connect(findEdit, SIGNAL(textChanged(QString)),
  	  this, SLOT(filterRegExpChanged()), Qt::UniqueConnection);

  tableView = new QTableView;
  tableView->setModel(proxyModel);

  tableView->setItemDelegate(new QSqlRelationalDelegate(tableView));
  tableView->setSelectionMode(QAbstractItemView::SingleSelection);
  tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
  tableView->setColumnHidden(ServicesModel::Id, true);
  tableView->setColumnHidden(ServicesModel::Prim, true);
  tableView->setColumnHidden(ServicesModel::Cost, true);
  tableView->setColumnHidden(ServicesModel::CostR, true);
  //tableView->resizeRowsToContents();
  tableView->setItemDelegateForColumn(ServicesModel::Type,
  				      new ServicesModelTypeDelegate(this));
  tableView->setItemDelegateForColumn(ServicesModel::Operator,
				      new ServicesModelOperatorDelegate(this));


  QAction *newRowAction = new QAction(trUtf8("Добавить"), this);
  connect(newRowAction, SIGNAL(triggered()), this, SLOT(newRow()));

  // QAction *showMovesAction = new QAction(trUtf8("Движение.."), this);
  // connect(showMovesAction, SIGNAL(triggered()), this, SLOT(showMovesDialog()));

  tableView->addAction(newRowAction);
  // tableView->addAction(copyRowAction);
  // tableView->addAction(showMovesAction);
  
  tableView->setContextMenuPolicy(Qt::ActionsContextMenu);
  tableView->setAlternatingRowColors(true);
  
  // tableView->sortByColumn(ServicesModel::Text, Qt::AscendingOrder);
  // tableView->setSortingEnabled(true);
  
  //tableView->setEditTriggers(QAbstractItemTableView::NoEditTriggers);

  tableView->verticalHeader()->hide();
  tableView->resizeColumnsToContents();
  // tableView->setColumnWidth(Services_CatNum, 160);
  // tableView->setColumnWidth(Services_Text, 250);
  // tableView->setColumnWidth(Services_Place, 80);
  // tableView->setColumnWidth(Services_Brandname, 130);
  // tableView->horizontalHeader()->setStretchLastSection(true);

  QVBoxLayout *mainLayout = new QVBoxLayout;
  mainLayout->addLayout(topLayout);
  mainLayout->addWidget(tableView);
  setLayout(mainLayout);

  setWindowTitle(trUtf8("Услуги"));
  setFixedWidth(tableView->horizontalHeader()->length()+50);
  setFixedHeight(380);
}