std::string MapcrafterConfigHelper::generateTemplateJavascript() const {
	std::string js = "";

	auto maps = config.getMaps();
	for (auto it = maps.begin(); it != maps.end(); ++it) {
		auto world = config.getWorld(it->getWorld());

		js += "\"" + it->getShortName() + "\" : {\n";
		js += "\tname: \"" + it->getLongName() + "\",\n";
		js += "\tworld: \"" + it->getWorld() + "\",\n";
		js += "\tworldName: \"" + world.getWorldName() + "\",\n";
		js += "\ttextureSize: " + util::str(it->getTextureSize()) + ",\n";
		js += "\ttileSize: " + util::str(32 * it->getTextureSize()) + ",\n";
		js += "\tmaxZoom: " + util::str(getMapZoomlevel(it->getShortName())) + ",\n";
		js += "\timageFormat: \"" + it->getImageFormatSuffix() + "\",\n";

		js += "\trotations: [";
		auto rotations = it->getRotations();
		for (auto it2 = rotations.begin(); it2 != rotations.end(); ++it2)
			js += util::str(*it2) + ",";
		js += "],\n";

		std::string tile_offsets = "[";
		auto offsets = world_tile_offsets.at(it->getWorld());
		for (auto it2 = offsets.begin(); it2 != offsets.end(); ++it2)
			tile_offsets += "[" + util::str(it2->getX()) + ", " + util::str(it2->getY()) + "], ";
		tile_offsets += "]";

		js += "\ttileOffsets: " + tile_offsets + ",\n";

		if (!world.getDefaultView().empty())
			js += "\tdefaultView: [" + world.getDefaultView() + "],\n";
		if (world.getDefaultZoom() != 0)
			js += "\tdefaultZoom: " + util::str(world.getDefaultZoom()) + ",\n";
		if (world.getDefaultRotation() != -1)
			js += "\tdefaultRotation: " + util::str(world.getDefaultRotation()) + ",\n";

		js += "},";
	}

	return js;
}
Esempio n. 2
0
void Window::setDefaultView()
{
    return setView(getDefaultView());
}
Esempio n. 3
0
void Panel::endDraw()
{
	auto win = m_sharedWin.getObject();
	win->setView(win->getDefaultView());
}
Esempio n. 4
0
void Window::setDefaultView()
{
    setView(getDefaultView());
}
Esempio n. 5
0
qvortaro::qvortaro(QWidget *parent) :
  QMainWindow(parent)
{
  Config::instance()->read();

  ui.setupUi(this);
  statusBar()->hide();
  createMenuAndActions();
  QObject::connect(m_aBeenden, SIGNAL(triggered()), this, SLOT(slot_quit()));
  QObject::connect(m_agAnordnungLexika, SIGNAL(triggered(QAction*)), this, SLOT(slot_changeAnordnungLexika(QAction*)));
  QObject::connect(m_agGestaltungLexikaAnordnung, SIGNAL(triggered(QAction*)), this, SLOT(slot_changeGestaltungLexika(QAction*)));
  QObject::connect(m_agGestaltungLexikaGestaltung, SIGNAL(triggered(QAction*)), this, SLOT(slot_changeGestaltungLexika(QAction*)));
  QObject::connect(m_agLexika1, SIGNAL(triggered(QAction*)), this, SLOT(slot_changeLexika1(QAction*)));
  QObject::connect(m_agLexika2, SIGNAL(triggered(QAction*)), this, SLOT(slot_changeLexika2(QAction*)));
  QObject::connect(m_agCaption, SIGNAL(triggered(QAction*)), this, SLOT(slot_changeCaption(QAction*)));
  QObject::connect(m_aProgrammEinrichten, SIGNAL(triggered()), this, SLOT(slot_configDgl()));
  QObject::connect(m_aAnsichtSpeichern, SIGNAL(triggered()), this, SLOT(slot_ansichtSpeichern()));
  QObject::connect(m_aAnsichtZeigeLanguage2, SIGNAL(triggered(bool)), this, SLOT(slot_zeigeLanguage2()));
  QObject::connect(m_aAnsichtZeigeLanguage2, SIGNAL(toggled(bool)), this, SLOT(slot_zeigeLanguage2()));
  QObject::connect(m_agAnsichtLaden, SIGNAL(triggered(QAction*)), this, SLOT(slot_ansichtLaden(QAction*)));
  QObject::connect(m_aUeber, SIGNAL(triggered()), this, SLOT(slot_showUeber()));
  QObject::connect(m_aStayOnTop, SIGNAL(triggered(bool)), this, SLOT(slot_stayOnTop()));

  mySearchLayout1 = new SearchLayout1();
  ui.sw->insertWidget(0, mySearchLayout1);

  ui.sw->setCurrentIndex(0);

  // Zwischenablage
  m_cb = QApplication::clipboard();
  m_cbStringLast = getCbString();
  m_cbTimer = new QTimer(this);
  m_cbTimer->setSingleShot(true);
  QObject::connect(m_cbTimer, SIGNAL(timeout()), this, SLOT(slot_checkCb()));
  slot_checkCb();

  // Keine Wörterbücher gefunden
  if (Config::instance()->languages().isEmpty())
  {
    if (!Config::instance()->containsPathLexika(QApplication::applicationDirPath()+QDir::separator()+"dict") && !Config::instance()->containsPathLexika(QApplication::applicationDirPath()))
      QMessageBox::warning(
          this,
          "qVortaro - "+trUtf8("Keine Wörterbücher gefunden"),
          trUtf8("Es konnten keine Wörterbucher gefunden werden!\n\n"
            "Bitte überprüfen Sie unter »Einstellungen->aVortaro einrichten«,\n" "ob der richtige Pfad zum Ordner mit den Wörterbüchern\n" "angegeben wurde."),
          QMessageBox::Ok);
  }

  if (Config::instance()->restoreOnStartup() && !Config::instance()->currentView().isEmpty() && Config::instance()->currentView().contains("zeigeLanguage2"))
  {
    restoreView(Config::instance()->currentView());
    m_aStayOnTop->setChecked(Config::instance()->stayOnTop());
    slot_stayOnTop();
  }
  else
  {
    m_aStayOnTop->setChecked(false);
    slot_stayOnTop();
    Config::instance()->setCurrentView(getDefaultView());
    restoreView(getDefaultView());
    adjustSize();
  }
}