Example #1
0
int Test::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    
#ifndef QT_NO_PROPERTIES
     if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< int*>(_v) = prop(); break;
        }
        _id -= 1;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setProp(*reinterpret_cast< int*>(_v)); break;
        }
        _id -= 1;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 1;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
/* GenLineSpecialPanel::loadSpecial
 * Opens boom generalised line special [special], setting up controls
 * as necessary
 *******************************************************************/
bool GenLineSpecialPanel::loadSpecial(int special)
{
	// Get special info
	int props[7];
	int type = BoomGenLineSpecial::getLineTypeProperties(special, props);

	if (type >= 0)
	{
		// Set special type
		choice_type->Select(type);
		setupForType(type);

		// Set selected properties
		for (unsigned a = 0; a < 7; a++)
		{
			if (choice_props[a]->IsShown())
				setProp(a, props[a]);
		}

		return true;
	}

	// Not a generalised special
	return false;
}
Example #3
0
/**
 * missing 処理用の口
 * TJSインスタンスにメンバが存在しなかった場合は javascriptインスタンスを参照する
 */
tjs_error TJSInstance::missing(tjs_uint32 flag, const tjs_char * membername, tjs_uint32 *hint,
							 tTJSVariant *result,
							 tjs_int numparams, tTJSVariant **params, iTJSDispatch2 *objthis) {
	
	if (numparams < 3) {return TJS_E_BADPARAMCOUNT;};
	iTJSNativeInstance *ninstance;
	if (TJS_SUCCEEDED(objthis->NativeInstanceSupport(TJS_NIS_GETINSTANCE, classId, &ninstance))) {
		TJSInstance *self = (TJSInstance*)ninstance;
		HandleScope handle_scope(self->isolate);
		bool ret = false;
		if (!(int)*params[0]) { // get
			tTJSVariant result;
			if (TJS_SUCCEEDED(getProp(self->isolate, self->getObject(), params[1]->GetString(), &result))) {
				params[2]->AsObjectClosureNoAddRef().PropSet(0, NULL, NULL, &result, NULL);
				ret = true;
			}
		} else { // set
			if (TJS_SUCCEEDED(setProp(self->isolate, self->getObject(), params[1]->GetString(), params[2]))) {
				ret = true;
			}
		}
		if (result) {
			*result = ret;
		}
	}
	return TJS_E_NATIVECLASSCRASH;
}
Example #4
0
//Add a coin to the given tile.
void Scene::addCoin(byte x, byte y) {
  if(_coinIndex != COINS) {
    Coin *coin = _coins[_coinIndex];
    setProp(coin, x, y);
    _coinList.add(coin);
    _coinIndex++;
  }
}
Example #5
0
void Perfboard::addedToScene(bool temporary)
{
	if (this->scene()) {
		QString temp = m_size;
		m_size = "";
		setProp("size", temp);
	}
    return Capacitor::addedToScene(temporary);
}
Example #6
0
/**
 * Initializes the given property set with the specified keys
 * and values.
 * <p>
 * <b>NOTE:<b> The given <tt>key<tt> and <tt>value<tt> arrays
 * must have the same number of elements.
 *
 * @param propertySet The property set to initialize
 * @param key An array of keys to set
 * @param value An array of values to associate with the keys
 */
static void
initializeProp(Property** propertySet, const char* key[], char* value[]) {
    int i = 0;

    while (key[i] != NULL) {
        setProp(propertySet, key[i], value[i], KNI_FALSE);
        i++;
    }
}
Example #7
0
/**
 * Parse arguments to initialize fanArgc and fanArgv, plus check for
 * arguments used by the launcher itself (prefixed via --).  Note that
 * the --v debug is handled in init(), not this method.
 */
int parseArgs(int argc, char** argv)
{
  if (debug) printf("-- parseArgs\n");

  fanArgc = 0;
  fanArgv = new char*[argc];

#ifdef FAN_MAIN
  fanArgv[fanArgc++] = FAN_MAIN;
#endif

  for (int i=1; i<argc; ++i)
  {
    char* arg = argv[i];
    int len = strlen(arg);

    // if arg starts with --
    if (len >= 3 && arg[0] == '-' && arg[1] == '-')
    {
      // --v (already handled in init)
      if (strcmp(arg, "--v") == 0)
      {
        continue;
      }

      // --Dname=value
      else if (arg[2] == 'D')
      {
        char* temp = new char[len];
        strcpy(temp, arg+3);
        char* name = strtok(temp, "=");
        char* val  = strtok(NULL, "=");
        if (val != NULL)
        {
          sysProps = setProp(sysProps, name, val);
          if (debug) printf("--   override prop %s=%s\n", name, val);
          if (strcmp(name, "runtime") == 0) cmdLineRuntime = val;
        }
        continue;
      }
    }

    // pass thru to fan
    fanArgv[fanArgc++] = arg;
  }

  if (debug)
  {
    printf("--   fanArgs (%d)\n", fanArgc);
    for (int i=0; i<fanArgc; ++i)
      printf("--     [%d] %s\n", i, fanArgv[i]);
  }

  return 0;
}
Example #8
0
RemoteXmlEclRepository::RemoteXmlEclRepository(IEclUser * _user, IXmlEclRepository &_repository, const char* _cluster, const char * _snapshot, bool _sandbox4snapshot) 
: repository(_repository), user(_user)
{
    if (_snapshot && *_snapshot)
    {
        setProp("snapshot", _snapshot);
        setPropInt("sandbox4snapshot", _sandbox4snapshot ? 1 : 0);
    }
    cachestamp = 0;

    setCurrentCluster(_cluster);
}
Example #9
0
void getProps(char *propFileName){
  std::ifstream propFile(propFileName);
	
	if (!propFile) {
		std::cout  << "propertyfile " << propFileName << " not found" << std::endl;
		exit(1);
	}
	//const char *delim = "=";
	char prop[150],val[150];
	while (!propFile.eof()) {
		propFile.getline(prop,150,'=');
		propFile.getline(val,150,'\n');
		if ((prop!=NULL) && (val!=NULL)) {
			setProp(prop,val);
			std::cout << prop << " = " << val << std::endl;
		}
	}
}
Example #10
0
void XmlEclRepository::setPropInt(const char* name,int value)
{
    StringBuffer temp;
    temp.append(value);
    setProp(name,temp.str());
}
Example #11
0
bool ScValue::setProperty(const char *propName) {
	ScValue *val = new ScValue(_gameRef);
	bool ret =  DID_SUCCEED(setProp(propName, val));
	delete val;
	return ret;
}
/**
 * Sets a property key to the specified value in the application
 * property set.
 *
 * @param key The key to set
 * @param value The value to set <tt>key</tt> to
 */
void
setSystemProperty(const char* key , const char* value) {
    setProp(&applicationProperties, key, value);
}
Example #13
0
void RemoteXmlEclRepository::setCurrentCluster(const char* _cluster)
{
    setProp("cluster",_cluster);
}
Example #14
0
//Add a unit to the given tile.
void Scene::addUnit(Unit* unit, byte x, byte y) {
  setProp(unit, x, y);
  _unitList.add(unit);
}
Example #15
0
KRootProp::KRootProp(const QString &rProp)
{
    atom = 0;
    dirty = false;
    setProp(rProp);
}
Example #16
0
void GameMapRecrusive::makeMap(int mLevel, int vLevel)
{
    m_mLevel = mLevel;
    m_vLevel = vLevel;

    //10*20 -> 20*20 -> 20*30 -> 30*30
    m_mapRows = 10* (vLevel/2+1);
    m_mapCols = 20+10*vLevel/2;
    m_mapCols = min(50, m_mapCols);

    m_roomSize = 5;//5-vLevel/3;//3 + vLevel/2;
    m_roomSize = max(3, m_roomSize);

    m_mineCount = 5 + 20*vLevel;
    m_coinCount = 5+vLevel;// + 10*vLevel;
    m_propCount = 5+vLevel;// + 10*vLevel;
// 	m_hallMin = max(2, 5 - vLevel/2);
    //
    m_objects.resize(m_mapRows);

    for(int r=0; r<m_mapRows; ++r)
    {
        m_objects[r].resize(m_mapCols);

        for(int c=0; c<m_mapCols; ++c)
        {
            MapCell* cell = MapCell::create();
            cell->setPosition(Point(c*m_tw, r*m_th) + Point(0, m_th) /*+ m_border*/);
            cell->setLocalZOrder((m_mapRows-r-1)*m_mapCols + c);
            addChild(cell);
            m_objects[r][c] = cell;
        }
    }

    //
    this->setContentSize(Size(m_mapCols*m_tw/*+m_border.width*2*/, m_mapRows*m_th/*+m_border.height*2*/));
    generate(0, 0, m_mapRows, m_mapCols);

    while(m_mineCount>0)
    {
        int r = rand()% (m_mapRows-2)+1;
        int c = rand()% (m_mapCols-2)+1;
        setTrap(r, c);
    }

    while(m_coinCount>0)
    {
        int r = rand()% (m_mapRows-2)+1;
        int c = rand()% (m_mapCols-2)+1;
        setCoin(r, c);
    }

    while(m_propCount > 0)
    {
        int r = rand()% (m_mapRows-2)+1;
        int c = rand()% (m_mapCols-2)+1;
        setProp(r, c);
    }

	for (int r = 0; r < m_mapRows; ++r)
	{
		for (int j=0; j < m_mapCols; ++j)
		{
			if (m_objects[r][j]->empty())
			{
				if (rand()%100<70)
				{
					setSoil(r, j, false);
				}
			}
		}
	}
    //
    const Index2 pos(rand()%m_mapRows,0);
    m_pPlayer = Player::create();
    m_pPlayer->setPosition(index2ToPoint(pos)+Point(m_tw/2, m_th/2));
    addChild(m_pPlayer, m_mapRows*m_mapCols+1);
    m_objects[pos.first][pos.second]->clear();

    for(auto x : getSurrounding(pos))
    {
        m_objects[x.first][x.second]->clear();
    }

    //
    ValueMap val;
    val["type"] = "LevelStair";
    const Index2 win(rand()%m_mapRows, m_mapCols-1);
    m_objects[win.first][win.second]->clear();
    m_objects[win.first][win.second]->pushObjBy(val);
}
Example #17
0
/**
 * Sets a property key to the specified value in the application
 * property set.
 *
 * @param key The key to set
 * @param value The value to set <tt>key<tt> to
 */
void
setSystemProperty(const char* key , const char* value) {
    setProp(&systemPropertySet, key, value, KNI_TRUE);
}
Example #18
0
/**
 * Sets a property key to the specified value in the internal
 * property set.
 *
 * @param key The key to set
 * @param value The value to set <tt>key<tt> to
 */
void
setInternalProp(const char* key , const char* value) {
    setProp(&internalPropertySet, key, value, KNI_TRUE);
}
Example #19
0
void SelectTool::keyPressEvent(QKeyEvent * event)
{
    if (event->key() == Qt::Key_N) {
        tikz::core::Transaction transaction(document(), QStringLiteral("Create Node"));
        tikz::ui::NodeItem * node = document()->createNodeItem();
        node->setPos(tikz::Pos(0, 0));
        setProp(node->style()->uid(), "shape", QVariant::fromValue(tikz::Shape::ShapeRectangle));
        setProp(node->style()->uid(), "minimumWidth", 4.0_mm);
        setProp(node->style()->uid(), "minimumHeight", 4.0_mm);
    }

    if (event->key() == Qt::Key_M) {
        tikz::core::Transaction transaction(document(), QStringLiteral("Create Node"));
        tikz::ui::NodeItem * node = document()->createNodeItem();
        node->setPos(tikz::Pos(0, 0));
        setProp(node->style()->uid(), "minimumWidth", 4.0_mm);
        setProp(node->style()->uid(), "minimumHeight", 4.0_mm);
        setProp(node->node()->uid(), "text", "x");
    }

    if (event->key() == Qt::Key_E) {
        tikz::core::Transaction transaction(document(), QStringLiteral("Create Edge"));
        auto path = dynamic_cast<EdgePathItem *>(document()->createPathItem(tikz::PathType::Line));
        path->edgePath()->setStartPos(tikz::Pos(-1, 0, tikz::Unit::Centimeter));
        path->edgePath()->setEndPos(tikz::Pos(1, 0, tikz::Unit::Centimeter));

        tikz::core::Style es;
        es.setArrowHead(tikz::Arrow::ToArrow);
        path->path()->setStyle(es);
    }

    if (event->key() == Qt::Key_C) {
        tikz::core::Transaction transaction(document(), QStringLiteral("Create Ellipse"));
        tikz::ui::NodeItem * node = document()->createNodeItem();
        node->setPos(tikz::Pos(0, 0));
        setProp(node->style()->uid(), "shape", QVariant::fromValue(tikz::Shape::ShapeEllipse));
        setProp(node->style()->uid(), "minimumWidth", 4.0_mm);
        setProp(node->style()->uid(), "minimumHeight", 4.0_mm);
    }

    if (event->key() == Qt::Key_V) {
        tikz::core::Transaction transaction(document(), QStringLiteral("Create Ellipse"));
        tikz::ui::NodeItem * node = document()->createNodeItem();
        node->setPos(tikz::Pos(0, 0));
        tikz::core::Style ns;
        ns.setStyle(node->node()->style());
        ns.setFillColor(Qt::black);
        setProp(node->style()->uid(), "shape", QVariant::fromValue(tikz::Shape::ShapeEllipse));
        setProp(node->style()->uid(), "minimumWidth", 1.0_mm);
        setProp(node->style()->uid(), "minimumHeight", 1.0_mm);
        setProp(node->style()->uid(), "innerSep", 0.0_mm);
    }
}
/**
 * Sets a property key to the specified value in the internal
 * property set.
 *
 * @param key The key to set
 * @param value The value to set <tt>key</tt> to
 */
void
setInternalProperty(const char* key , const char* value) {
    setProp(&implementationProperties, key, value);
}