Exemplo n.º 1
0
void InputManager::removeBinding(const QString &input)
{
	InputSource source_index = extractSource(input);

	if(source_index != INVALID_SOURCE)
	{
		// TODO
	}
}
Exemplo n.º 2
0
bool InputManager::addBinding(const QString &input, const QString &control)
{
	InputSource source_index = extractSource(input);

	// If input exists
	if(source_index != INVALID_SOURCE)
	{
		// Find control id
		QMap<QString, Control>::Iterator control_id = m_controls_dict.find(control);

		if(control_id != m_controls_dict.end())
		{
			int input_value = m_translator.toValue(input);

			if(input_value != -1)
			{
				QMap<int,Control>::Iterator input_id = m_bindings[source_index].find(input_value);

				if(input_id != m_bindings[source_index].end())
				{
					logError( input << " already bound to " << input_id.value().name );
				}
				else
				{
					m_bindings[source_index].insert(input_value, *control_id);
					return true;
				}
			}
			else
			{
				logError( input << " is not a valid key" );
			}
		}
		else
		{
			logError( "cannot bind to control " << control << " because it does not exist");
		}
	}
	else
	{
		logError( "cannot bind " << input << " because it is not a valid key");
	}

	return false;
}
Exemplo n.º 3
0
void executeCommands(File& file, Command** commands, size_t commandsSize)
{
	SourceCode& code = extractSource(file);
	bool isWindowsStyle = true;
	for (size_t comPos = 0; comPos < commandsSize; ++comPos)
	{
		Command* curr = commands[comPos];
		curr->setCode(code);
		try
		{
			curr->transformCode(isWindowsStyle);
		}
		catch (std::invalid_argument& i)
		{
			throw;
		}
	}
	char* rawCode = code.genRawCode(isWindowsStyle);
	file.writeToFile(rawCode);
}
Exemplo n.º 4
0
 ArrayClass    *getSourceRexx() { return extractSource(); }