/** @details
 * Odstrani postupne vsechny generovane objekty a pro kazdy
 * vyvola signal removingGeneratedObject().
 * Nakonec vyvola signal canGenerateChanged(), kdyby se nahodou
 * timto ukonem neco zmenilo.
 */
void MapObjectGenerator::removeGeneratedObjects() {
	while(!generatedObjects_.isEmpty()) {
		BombicMapObject * o = generatedObjects_.takeFirst();
		o->graphicsItem()->hide();
		emit removingGeneratedObject(o);
	}

	emit canGenerateChanged();
}
/**
 * @param block zda se ma generovani blokovat (jinym objektem)
 */
void MapObjectGenerator::setBlocking(bool block) {
	if(block == blocked_) {
		return;
	}
	blocked_ = block;
	emit canGenerateChanged();
	updateLabelVisibility();
	// if blocked_ changed to false
	// there weren't any generated objects
	// so we can remove "them"
	removeGeneratedObjects();
}
/**
 * @param allow zda se ma generovani povolit
 */
void MapObjectGenerator::setAllowance(bool allow) {
	if(allow == allowed_) {
		return;
	}
	allowed_ = allow;
	emit allowanceChanged();
	emit canGenerateChanged();
	updateLabelVisibility();
	// if allowed_ changed to true
	// there weren't any generated objects
	// so we can remove "them"
	removeGeneratedObjects();
}
void TemplateEditor::issueNewGenereationStatus(bool can_generate, const QString &message) {
  m_canGenerate = can_generate;
  m_generateMessage = message;

  emit canGenerateChanged(can_generate, message);
}