//--------------------------------------------------------------------------------------
void BaseLayout::loadLayout(MyGUI::Widget* _parent)
{
    if(mMainWidgetName.empty())
        mMainWidgetName = "_Main";

    mPrefix = MyGUI::utility::toString(this, "_");

    mMainWidget = loadLayoutPart(mLayoutName, mMainWidgetName, mPrefix, _parent);
    mMainWidget->setVisible(true);

    // get parameters from user strings of the main widget
    if(mConfigSection.empty())
    {
        String userStr = mMainWidget->getUserString("ConfigSection");
        if(!userStr.empty())
            setConfigSection(userStr);
    }

    if(mDefaultCoord == MyGUI::FloatCoord())
    {
        String userStr = mMainWidget->getUserString("DefaultCoord");
        if(!userStr.empty())
        {
            StrStream ss(userStr, StrStream::DONT_COPY);
            ss >> mDefaultCoord.left;
            ss >> mDefaultCoord.top;
            ss >> mDefaultCoord.width;
            ss >> mDefaultCoord.height;
        }
Example #2
0
QuotaForIntervalsPtr Quota::get(const String & quota_key, const String & user_name, const Poco::Net::IPAddress & ip)
{
    if (!quota_key.empty() && !ignore_key_if_not_keyed && (!is_keyed || keyed_by_ip))
        throw Exception("Quota " + name + " (for user " + user_name + ") doesn't allow client supplied keys.",
            ErrorCodes::QUOTA_DOESNT_ALLOW_KEYS);

    /** Quota is calculated separately:
      * - for each IP-address, if 'keyed_by_ip';
      * - otherwise for each 'quota_key', if present;
      * - otherwise for each 'user_name'.
      */

    UInt64 quota_key_hashed = sipHash64(
        keyed_by_ip
            ? ip.toString()
            : (!quota_key.empty()
                ? quota_key
                : user_name));

    std::lock_guard<std::mutex> lock(mutex);

    Container::iterator it = quota_for_keys.find(quota_key_hashed);
    if (quota_for_keys.end() == it)
        it = quota_for_keys.emplace(quota_key_hashed, std::make_shared<QuotaForIntervals>(max, user_name)).first;

    return it->second;
}
Example #3
0
Variant HHVM_METHOD(XMLReader, getAttributeNs,
                    const String& name,
                    const String& namespaceURI) {
  auto* data = Native::data<XMLReader>(this_);
  SYNC_VM_REGS_SCOPED();
  if (name.empty() || namespaceURI.empty()) {
    raise_warning("Attribute Name and Namespace URI cannot be empty");
    return false;
  }

  char *retchar = nullptr;
  if (data->m_ptr) {
    retchar = (char *)xmlTextReaderGetAttributeNs(data->m_ptr,
                                                  (xmlChar *)name.data(),
                                                  (xmlChar *)namespaceURI.data());
  }

  if (retchar) {
    String ret((const char*)retchar, CopyString);
    xmlFree(retchar);
    return ret;
  } else {
    return init_null();
  }
}
Example #4
0
bool XMLReader::set_relaxng_schema(String source, int type) {
  SYNC_VM_REGS_SCOPED();
  if (source.empty()) {
    raise_warning("Schema data source is required");
    return false;
  }

  if (m_ptr) {
    int ret = -1;
    xmlRelaxNGPtr schema = nullptr;
    if (!source.empty()) {
      schema =  _xmlreader_get_relaxNG(source, type, nullptr, nullptr);
      if (schema) {
        ret = xmlTextReaderRelaxNGSetSchema(m_ptr, schema);
      }
    } else {
      ret = xmlTextReaderRelaxNGSetSchema(m_ptr, nullptr);
    }

    if (ret == 0) {
      if (m_schema) {
        xmlRelaxNGFree((xmlRelaxNGPtr) m_schema);
      }
      m_schema = schema;
      return true;
    }
  }

  raise_warning("Unable to set schema. This must be set prior to reading or schema contains errors.");
  return false;
}
Example #5
0
void Field::ConstructField(const String& name, const String& value, Store store, Index index, TermVector termVector) {
    if (name.empty() && value.empty()) {
        boost::throw_exception(IllegalArgumentException(L"name and value cannot both be empty"));
    }
    if (index == INDEX_NO && store == STORE_NO) {
        boost::throw_exception(IllegalArgumentException(L"it doesn't make sense to have a field that is neither indexed nor stored"));
    }
    if (index == INDEX_NO && termVector != TERM_VECTOR_NO) {
        boost::throw_exception(IllegalArgumentException(L"cannot store term vector information for a field that is not indexed"));
    }

    this->_name = name;
    this->fieldsData = value;
    this->_isStored = isStored(store);
    this->_isIndexed = isIndexed(index);
    this->_isTokenized = isAnalyzed(index);
    this->_omitNorms = omitNorms(index);
    this->_isBinary = false;

    if (index == INDEX_NO) {
        this->omitTermFreqAndPositions = false;
    }

    setStoreTermVector(termVector);
}
Example #6
0
bool MySQL::connect(const String& host, int port, const String& socket,
                    const String& username, const String& password,
                    const String& database, int client_flags,
                    int connect_timeout) {
    if (m_conn == nullptr) {
        m_conn = create_new_conn();
    }
    if (connect_timeout >= 0) {
        MySQLUtil::set_mysql_timeout(m_conn, MySQLUtil::ConnectTimeout,
                                     connect_timeout);
    }
    if (RuntimeOption::EnableStats && RuntimeOption::EnableSQLStats) {
        ServerStats::Log("sql.conn", 1);
    }
    IOStatusHelper io("mysql::connect", host.data(), port);
    m_xaction_count = 0;
    bool ret = mysql_real_connect(m_conn, host.data(), username.data(),
                                  password.data(),
                                  (database.empty() ? nullptr : database.data()),
                                  port,
                                  socket.empty() ? nullptr : socket.data(),
                                  client_flags);
    if (ret && mysqlExtension::WaitTimeout > 0) {
        String query("set session wait_timeout=");
        query += String((int64_t)(mysqlExtension::WaitTimeout / 1000));
        if (mysql_real_query(m_conn, query.data(), query.size())) {
            raise_notice("MySQL::connect: failed setting session wait timeout: %s",
                         mysql_error(m_conn));
        }
    }
    m_state = (ret) ? MySQLState::CONNECTED : MySQLState::CLOSED;
    return ret;
}
Example #7
0
void Html::openLink(const String &url, String id, bool newTab)
{
	if(!id.empty() && id[0] == '#') id.ignore();
	String cl = id.cut('.');

	*mStream<<"<a href=\""<<url<<"\"";
	if(!id.empty()) *mStream<<" id=\""<<id<<"\"";
	if(!cl.empty()) *mStream<<" class=\""<<cl<<"\"";
	if(newTab) *mStream<<" target=\"_blank\"";
	*mStream<<">";
}
Example #8
0
void Html::open(const String &type, String id)
{
	Assert(!type.empty());
	
	if(!id.empty() && id[0] == '#') id.ignore();
	String cl = id.cut('.');
	
	*mStream<<"<"<<type;
	if(!id.empty()) *mStream<<" id=\""<<id<<"\"";
	if(!cl.empty()) *mStream<<" class=\""<<cl<<"\"";
	*mStream<<">";
}
Example #9
0
int GmModule::hasGmLoginData()
{
  int bLoginDataAvailable = 0;

  String sUser = Apollo::getModuleConfig(MODULE_NAME, "User", "");
  String sPassword = getPassword();

  if (!sUser.empty() && !sPassword.empty()) {
    bLoginDataAvailable = 1;
  }

  return bLoginDataAvailable;
}
Example #10
0
void Html::image(	const String &url,
			const String &alt,
			String id)
{
	if(!id.empty() && id[0] == '#') id.ignore();
  	String cl = id.cut('.');
	
	*mStream<<"<img src=\""<<url<<"\"";
	if(!alt.empty()) *mStream<<" alt=\""<<alt<<"\"";
	if(!id.empty())  *mStream<<" id=\""<<id<<"\"";
	if(!cl.empty())  *mStream<<" class=\""<<cl<<"\"";
	*mStream<<"/>";
}
Example #11
0
Vector<String> Path::SplitCommandLine(const String& input)
{
	String buffer = input;
	Vector<String> res;
	while(!buffer.empty())
	{
		String a = ExtractPathFromCmdLine(buffer);
		a.Trim();
		if(!a.empty())
			res.push_back(a);
	}
	return res;
}
Example #12
0
// Utility function to allow the user to modify the layout of vertex buffers.
void reorganiseVertexBuffers(const String& desc, Mesh& mesh, SubMesh* sm, VertexData* vertexData)
{
	cout << endl << desc << ":- " << endl;
	// Copy elements into a list
	VertexDeclaration::VertexElementList elemList;
	copyElems(vertexData->vertexDeclaration, &elemList);

	bool finish = false;
	bool anyChanges = false;
	while (!finish)
	{
		displayVertexBuffers(elemList);
		cout << endl;

		cout << "Options: (a)utomatic" << endl;
        cout << "         (m)ove element" << endl;
		cout << "         (d)elete element" << endl;
		cout << "         (r)eset" << endl;
		cout << "         (f)inish" << endl;
		String response = "";
		while (response.empty())
		{
			cin >> response;
			StringUtil::toLowerCase(response);

			if (response == "m")
			{
				String moveResp;
				cout << "Which element do you want to move (type number): ";
				cin >> moveResp;
				if (!moveResp.empty())
				{
					int eindex = StringConverter::parseInt(moveResp);
					VertexDeclaration::VertexElementList::iterator movei = elemList.begin();
					std::advance(movei, eindex);
					cout << endl << "Move element " << eindex << "(" + describeSemantic(movei->getSemantic()) << ") to which buffer: ";
					cin >> moveResp;
					if (!moveResp.empty())
					{
						int bindex = StringConverter::parseInt(moveResp);
						// Move (note offset will be wrong)
						*movei = VertexElement(bindex, 0, movei->getType(),
							movei->getSemantic(), movei->getIndex());
						elemList.sort(vertexElementLess);
                        anyChanges = true;
								
					}
				}
			}
            else if (response == "a")
Example #13
0
BlobLocator* Database::newLocator(const String& name, const String& path)
{
	if (path.empty())
		NIT_THROW(EX_INVALID_PARAMS);

	size_t pos;

	pos = path.find('/');

	bool ok = true;

	if (pos == path.npos)
		ok = false;

	String dbName;
	String tblName;
	String blobColumn;
	String idColumn = "rowid";

	if (ok)
	{
		tblName = path.substr(0, pos);
		blobColumn = path.substr(pos+1);

		pos = tblName.find('.');

		if (pos != tblName.npos)
		{
			dbName = tblName.substr(0, pos);
			tblName = tblName.substr(pos + 1);
		}

		pos = blobColumn.find('.');

		if (pos != blobColumn.npos)
		{
			idColumn = blobColumn.substr(pos + 1);
			blobColumn = blobColumn.substr(0, pos);
		}
	}

	ok = ok && !tblName.empty();
	ok = ok && !blobColumn.empty();
	ok = ok && !idColumn.empty();

	if (!ok)
		NIT_THROW_FMT(EX_INVALID_PARAMS, "invalid db locator path: '%s: %s'", name.c_str(), path.c_str());

	return new BlobLocator(name, this, tblName, blobColumn, idColumn, dbName);
}
void CvCascadeParams::write( FileStorage &fs ) const
{
    String stageTypeStr = stageType == BOOST ? CC_BOOST : String();
    CV_Assert( !stageTypeStr.empty() );
    fs << CC_STAGE_TYPE << stageTypeStr;
    String featureTypeStr = featureType == CvFeatureParams::HAAR ? CC_HAAR :
                            featureType == CvFeatureParams::LBP ? CC_LBP :
                            featureType == CvFeatureParams::HOG ? CC_HOG :
                            0;
    CV_Assert( !stageTypeStr.empty() );
    fs << CC_FEATURE_TYPE << featureTypeStr;
    fs << CC_HEIGHT << winSize.height;
    fs << CC_WIDTH << winSize.width;
}
Example #15
0
bool c_XMLWriter::t_startdocument(const String& version /* = "1.0" */,
                                  const String& encoding /* = null_string */,
                                  const String& standalone /* = null_string */) {
  int ret = -1;
  if (m_ptr) {
    const auto pencoding = encoding.empty() ? nullptr : xmls(encoding);
    const auto pstandalone = standalone.empty() ? nullptr : xmls(standalone);
    ret = xmlTextWriterStartDocument(m_ptr,
                                     (const char *)xmls(version),
                                     (const char *)pencoding,
                                     (const char *)pstandalone);
  }
  return ret != -1;
}
Example #16
0
static Variant php_xml_parser_create_impl(const String& encoding_param,
                                          const String& ns_param,
                                          int ns_support) {
  int auto_detect = 0;
  XML_Char *encoding;

  if (!encoding_param.isNull()) {
    /* The supported encoding types are hardcoded here because
     * we are limited to the encodings supported by expat/xmltok.
     */
    if (encoding_param.size() == 0) {
      encoding = XML(default_encoding);
      auto_detect = 1;
    } else if (strcasecmp(encoding_param.data(), "ISO-8859-1") == 0) {
      encoding = (XML_Char*)"ISO-8859-1";
    } else if (strcasecmp(encoding_param.data(), "UTF-8") == 0) {
      encoding = (XML_Char*)"UTF-8";
    } else if (strcasecmp(encoding_param.data(), "US-ASCII") == 0) {
      encoding = (XML_Char*)"US-ASCII";
    } else {
      raise_warning("unsupported source encoding \"%s\"",
                    encoding_param.c_str());
      return false;
    }
  } else {
    encoding = XML(default_encoding);
  }

  String separator;
  if (ns_support && ns_param.empty()) {
    separator = ":";
  } else {
    separator = ns_param;
  }

  auto parser = req::make<XmlParser>();
  parser->parser = XML_ParserCreate_MM
    ((auto_detect ? NULL : encoding), &php_xml_mem_hdlrs,
     !separator.empty() ? (const XML_Char*)separator.data() : NULL);

  parser->target_encoding = encoding;
  parser->case_folding = 1;
  parser->object.asTypedValue()->m_type = KindOfNull;
  parser->isparsing = 0;

  XML_SetUserData(parser->parser, getParserToken(parser));

  return Variant(std::move(parser));
}
Example #17
0
static void mysql_set_conn_attr(MYSQL* mysql, const String& key,
                                const String& value) {
  if (key.empty()) {
    raise_warning("MySQL: Invalid connection attribute - empty key");
  }
  else if (value.empty()) {
    raise_warning(
        std::string("MySQL: Invalid connection attribute - empty value for ") +
        key.toCppString());
  }
  else {
    mysql_options4(mysql, MYSQL_OPT_CONNECT_ATTR_ADD, key.c_str(),
                   value.c_str());
  }
}
Example #18
0
String URI::assembleUri(const String& scheme,
                        const String& authority,
                        const String& path,
                        const String& query,
                        const String& fragment,
                        bool forceLibxmlCompatible) {
    String p = safeSubstr(path, 0, 3);
    bool libxmlHack = forceLibxmlCompatible && scheme == "file";
    bool uncPath = false;
    String uri;

    if (!scheme.empty())
        uri += scheme + "://";

    /*			if (!authority.empty() || libxmlHack || (p[0] == '/' && p[1] == '/'))
    				uri += "//";
    */
    if (!authority.empty())
    {
        if (libxmlHack) {
            // We have a UNC path URI of the form file://otherMachine/file.dae.
            // Convert it to file://///otherMachine/file.dae, which is how libxml
            // does UNC paths.
            uri += "///" + authority;
            uncPath = true;
        }
        else {
            uri += authority;
        }
    }

    if (!uncPath && libxmlHack && Utils::getSystemType() == Utils::WINDOWS) {
        // We have to be delicate in how we pass absolute path URIs to libxml on Windows.
        // If the path is an absolute path with no drive letter, add an extra slash to
        // appease libxml.
        if (p[0] == '/' && p[1] != '/' && p[2] != ':') {
            uri += "/";
        }
    }
    uri += path;

    if (!query.empty())
        uri += "?" + query;
    if (!fragment.empty())
        uri += "#" + fragment;

    return uri;
}
Example #19
0
StoragePtr Context::getTableImpl(const String & database_name, const String & table_name, Exception * exception) const
{
	auto lock = getLock();

	/** Возможность обратиться к временным таблицам другого запроса в виде _query_QUERY_ID.table
	  * NOTE В дальнейшем может потребоваться подумать об изоляции.
	  */
	if (startsWith(database_name, "_query_"))
	{
		String requested_query_id = database_name.substr(strlen("_query_"));

		auto res = shared->process_list.tryGetTemporaryTable(requested_query_id, table_name);

		if (!res && exception)
			*exception = Exception(
				"Cannot find temporary table with name " + table_name + " for query with id " + requested_query_id, ErrorCodes::UNKNOWN_TABLE);

		return res;
	}

	if (database_name.empty())
	{
		StoragePtr res = tryGetExternalTable(table_name);
		if (res)
			return res;
	}

	String db = database_name.empty() ? current_database : database_name;
	checkDatabaseAccessRights(db);

	Databases::const_iterator it = shared->databases.find(db);
	if (shared->databases.end() == it)
	{
		if (exception)
			*exception = Exception("Database " + db + " doesn't exist", ErrorCodes::UNKNOWN_DATABASE);
		return {};
	}

	auto table = it->second->tryGetTable(table_name);
	if (!table)
	{
		if (exception)
			*exception = Exception("Table " + db + "." + table_name + " doesn't exist.", ErrorCodes::UNKNOWN_TABLE);
		return {};
	}

	return table;
}
Example #20
0
String TimeZone::CurrentName() {
  /* Checking configure timezone */
  String timezone = g_context->getTimeZone();
  if (!timezone.empty()) {
    return timezone;
  }

  /* Check environment variable */
  char *env = getenv("TZ");
  if (env && *env && IsValid(env)) {
    return String(env, CopyString);
  }

  /* Check config setting for default timezone */
  String default_timezone = g_context->getDefaultTimeZone();
  if (!default_timezone.empty() && IsValid(default_timezone.data())) {
    return default_timezone;
  }

  /* Try to guess timezone from system information */

  time_t the_time = time(0);
  struct tm tmbuf;
  struct tm *ta = localtime_r(&the_time, &tmbuf);
  const char *tzid = NULL;
  if (ta) {
    tzid = timelib_timezone_id_from_abbr(ta->tm_zone, ta->tm_gmtoff,
                                         ta->tm_isdst);
  }
  if (!tzid) {
    tzid = "UTC";
  }
  return String(tzid, CopyString);
}
//----------------------------------------------------------------------------//
RenderedStringTextComponent::RenderedStringTextComponent(
        const String& text, const String& font_name) :
    d_text(text),
    d_font(font_name.empty() ? 0 : &FontManager::getSingleton().get(font_name)),
    d_colours(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF)
{
}
Example #22
0
sElement* SCsTranslator::_createElement(const String &idtf, sc_type type)
{
    String newIdtf = idtf;
    if (!idtf.empty())
    {
        if (idtf == "...")
        {
            StringStream ss;
            ss << "..." << msAutoIdtfCount++ << "...auto...";
            newIdtf = ss.str();
        } else {
            tElementIdtfMap::iterator it = mElementIdtf.find(idtf);
            if (it != mElementIdtf.end())
            {
                it->second->type = it->second->type | type;
                return it->second;
            }
        }
    }

    sElement *el = new sElement();

    el->idtf = newIdtf;
    el->type = type;
    assert(mElementIdtf.find(newIdtf) == mElementIdtf.end());
    if (!newIdtf.empty())
        mElementIdtf[newIdtf] = el;
    mElementSet.insert(el);

    return el;
}
Example #23
0
bool FSDirectory::hasFile(const String &name) const {
    if (name.empty() || !_node.isDirectory())
        return false;

    FSNode *node = lookupCache(_fileCache, name);
    return node && node->exists();
}
Example #24
0
  const Residue* ResidueDB::getModifiedResidue(const Residue* residue, const String& modification)
  {
    OPENMS_PRECONDITION(!modification.empty(), "Modification cannot be empty")
    // search if the mod already exists
    String res_name = residue->getName();

    if (residue_names_.find(res_name) == residue_names_.end())
    {
      throw Exception::IllegalArgument(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
                                       String("Residue with name " + res_name + " was not registered in residue DB, register first!").c_str());
    }

    // terminal mods. don't apply to residue (side chain), so don't consider them:
    const ResidueModification& mod = ModificationsDB::getInstance()->getModification(modification, residue->getOneLetterCode(), ResidueModification::ANYWHERE);
    String id = mod.getId();
    if (id.empty()) id = mod.getFullId();

    if (residue_mod_names_.has(res_name) && residue_mod_names_[res_name].has(id))
    {
      return residue_mod_names_[res_name][id];
    }

    Residue* res = new Residue(*residue_names_[res_name]);
    res->setModification_(mod);
    //res->setLossFormulas(vector<EmpiricalFormula>());
    //res->setLossNames(vector<String>());

    // now register this modified residue
    addResidue_(res);
    return res;
  }
Example #25
0
synfig::String
Action::Base::get_layer_descriptions(const std::list<std::pair<synfig::Layer::Handle,int> > layers, synfig::String singular_prefix, synfig::String plural_prefix)
{
	String ret;
	bool first = true;

	if (plural_prefix.empty())
		plural_prefix = singular_prefix;

	if (layers.empty())
		return plural_prefix;

	if (layers.size() == 1)
		ret = singular_prefix;
	else
		ret = plural_prefix;

	if (!ret.empty())
		ret.push_back(' ');

	for(std::list<std::pair<synfig::Layer::Handle,int> >::const_iterator iter=layers.begin(); iter!=layers.end(); ++iter)
	{
		if (first)
			first = false;
		else
			ret += ", ";

		ret += strprintf("'%s'", iter->first->get_non_empty_description().c_str());
	}

	return ret;
}
Example #26
0
static void apply_changes_on_x(const char *current, const String *previous) {
	if(repeat_press_value)
		XAutoRepeatOn(fl_display);
	else
		XAutoRepeatOff(fl_display);

	/* do not do anything if selected layout is the same as previous */
	if(!previous || *previous != current) {
		/* 
		 * believe me, it is easier to call this command than to reimplmement a mess for 
		 * uploading keyboard layout on X server! 
		 */
		String setxkbmap = file_path("setxkbmap");

		if(setxkbmap.empty()) {
			alert(_("Unable to find 'setxkbmap' tool.\n\nThis tool is used as helper tool for "
					"easier keyboard setup and is standard tool shipped with every X package. "
					"Please install it first and run this program again."));
		} else {
			int ret = run_sync("%s %s", setxkbmap.c_str(), current);
			/* do not show dialog since we can fail if config has bad entry when called from apply_chages_from_config() */
			if(ret != 0) 
				E_WARNING(E_STRLOC ": 'setxkbmap %s' failed with %i\n", current, ret);
		}
	}

	/* force panel applet to re-read config file to see if flag should be displayed or not */
	foreign_callback_call(PANEL_APPLET_ID);
}
Example #27
0
void VirtualKeyboard::KeyPressQueue::insertKey(KeyState key) {
	_strChanged = true;
	key.flags ^= _flags;
	if ((key.keycode >= KEYCODE_a) && (key.keycode <= KEYCODE_z))
		key.ascii = (key.flags & KBD_SHIFT) ? key.keycode - 32 : key.keycode;
	clearFlags();

	String keyStr;
	if (key.flags & KBD_CTRL) keyStr += "Ctrl+";
	if (key.flags & KBD_ALT) keyStr += "Alt+";

	if (key.ascii >= 32 && key.ascii <= 255) {
		if (key.flags & KBD_SHIFT && (key.ascii < 65 || key.ascii > 90))
			keyStr += "Shift+";
		keyStr += (char)key.ascii;
	} else {
		if (key.flags & KBD_SHIFT) keyStr += "Shift+";
		if (key.keycode >= 0 && key.keycode < keycodeDescTableSize)
			keyStr += keycodeDescTable[key.keycode];
	}

	if (keyStr.empty()) keyStr += "???";

	_keysStr.insertChar(KEY_START_CHAR, _strPos++);
	const char *k = keyStr.c_str();
	while (char ch = *k++)
		_keysStr.insertChar(ch, _strPos++);
	_keysStr.insertChar(KEY_END_CHAR, _strPos++);

	VirtualKeyPress kp;
	kp.key = key;
	kp.strLen = keyStr.size() + 2;
	_keys.insert(_keyPos, kp);
}
Example #28
0
static EM_BOOL _fullscreen_change_callback(int event_type, const EmscriptenFullscreenChangeEvent *event, void *user_data) {

	ERR_FAIL_COND_V(event_type!=EMSCRIPTEN_EVENT_FULLSCREENCHANGE, false);

	OS_JavaScript* os = static_cast<OS_JavaScript*>(user_data);
	String id = String::utf8(event->id);

	// empty id is canvas
	if (id.empty() || id=="canvas") {

		OS::VideoMode vm = os->get_video_mode();
		// this event property is the only reliable information on
		// browser fullscreen state
		vm.fullscreen = event->isFullscreen;

		if (event->isFullscreen) {
			vm.width = event->screenWidth;
			vm.height = event->screenHeight;
			os->set_video_mode(vm);
			emscripten_set_canvas_size(vm.width, vm.height);
		}
		else {
			os->set_video_mode(vm);
			if (!os->is_window_maximized()) {
				os->set_window_size(_windowed_size);
			}
		}
	}
	return false;
}
Example #29
0
void CmdHeaptrace::onClient(DebuggerClient &client) {
  if (DebuggerCommand::displayedHelp(client)) return;

  String format;
  String file;
  if (client.argCount() == 3) {
    format = client.argValue(2);
    file = client.argValue(3);
  } else if (client.argCount() != 1) {
    help(client);
    return;
  }

  CmdHeaptracePtr cmd = client.xend<CmdHeaptrace>(this);

  if (file.empty()) {
    cmd->printHeap(client);
  } else {
    std::string formatStr = format->data();
    const auto it = s_formatMap.find(formatStr);

    if (it == s_formatMap.end()) {
      client.print("Unsupported format type");
      return;
    }
    cmd->printGraphToFile(client, file, it->second);
  }

}
Example #30
0
    void Player::playStream(const String& item, const xbmcgui::ListItem* plistitem, bool windowed)
    {
      XBMC_TRACE;
      DelayedCallGuard dc(languageHook);
      if (!item.empty())
      {
        // set fullscreen or windowed
        CMediaSettings::GetInstance().SetVideoStartWindowed(windowed);

        const AddonClass::Ref<xbmcgui::ListItem> listitem(plistitem);

        if (listitem.isSet())
        {
          // set m_strPath to the passed url
          listitem->item->SetPath(item.c_str());
          CApplicationMessenger::GetInstance().PostMsg(TMSG_MEDIA_PLAY, 0, 0, static_cast<void*>(new CFileItem(*listitem->item)));
        }
        else
        {
          CFileItemList *l = new CFileItemList; //don't delete,
          l->Add(std::make_shared<CFileItem>(item, false));
          CApplicationMessenger::GetInstance().PostMsg(TMSG_MEDIA_PLAY, -1, -1, static_cast<void*>(l));
        }
      }
      else
        playCurrent(windowed);
    }