QStringList TToolbarEditor::saveActions() { logger()->debug("saveActions"); QStringList list; for (int row = 0; row < active_actions_table->rowCount(); row++) { QTableWidgetItem* item = active_actions_table->item(row, COL_NAME); if (item) { QString action_name = item->text(); if (action_name.startsWith("separator")) { action_name = "separator"; } QString s = action_name; bool ns = getVis(row, COL_NS); bool fs = getVis(row, COL_FS); if (ns) { if (!fs) { s += "|1|0"; } } else if (fs) { s += "|0|1"; } else { s += "|0|0"; } list << s; if (action_name != "separator") { // Update icon text QAction* action = findAction(action_name, *all_actions); if (action) { item = active_actions_table->item(row, COL_DESC); if (item) { QString action_icon_text = TActionsEditor::actionTextToDescription( item->text(), action_name).trimmed(); if (!action_icon_text.isEmpty()) { QString action_text = TActionsEditor::actionTextToDescription(action->text(), action_name); if (action_text != action_icon_text) { action->setIconText(action_icon_text); action->setProperty("modified", true); logger()->debug("saveActions: updated icon text '" + action_name + "' to '" + action_icon_text + "'"); } else { action_icon_text = TActionsEditor::actionTextToDescription(action->iconText(), action_name); if (action_icon_text != action_text) { action->setIconText(action_text); logger()->debug("saveActions: cleared icon text " + action_name); } } } } } } } } return list; }
// initialization void className::onInit() { baseClassName::onInit(); //////////////// Most typical efect //////////////// uncomment if need //// graphics //addEfect(efModel = new EfectModel("model_.txt", nullptr, true, true) ); //addEfect(efParticle = new EfectParticle( "particle_.txt", 1, 1, 1, 0, &efModel->model, nullptr) ); //addEfect(efFollowCam = new EfectFollowCam( &efModel->model, -350) ); //addEfect(efAnimation = new EfectAnimation("", "animation_.txt") ); //// collision //addEfect(efCollidionResponse = new EfectCollisionResponse(5.5, 0.001, Vector2D() ) ); //addEfect(efDamageOnCollision = new EfectDamageOnCollision(-0,-0) ); //addEfect(efCheckForCollision = new EfectCheckForCollision(&world) ); //// movement //addEfect(efTppMovement = new EfectTppMovement(4, 0.5) ); //addEfect(efFollowAim = new EfectFollowAim(nullptr,0,0,1.f,Vector2D(),Vector2D(),false, false)); //// debug //addEfect(efDebugCollider = new EfectDebugCollider(&efModel->model, sf::Keyboard::Z, Color(200, 200, 200, 100))); //addEfect(efDebugStat = new EfectDebugStat(Game::Event::hp, true, "object hp", Control::Input(sf::Keyboard::K))); //////////////// Collider //addCollider(CircleCollider(Vector2D(), 100.f)); //////////////// Animation //addAnimation("", Animation("animation_.txt")); //////////////// Realms //// position getPos().position = Vector2D(); getPos().velocity = Vector2D(); getPos().force = Vector2D(); getPos().inverseMass = 1; getPos().resetVelocity = 0.75; getPos().resetForce = 0; //// rotation getRot().position = 0; getRot().velocity = 0; getRot().force = 0; getRot().inverseMass = 1; getRot().resetVelocity = 0.75; getRot().resetForce = 0; //// hp getHp().position = 100; getHp().velocity = 0; getHp().force = 0; getHp().inverseMass = 1; getHp().resetVelocity = 0; getHp().resetForce = 0; //// vis getVis().position = 0; getVis().velocity = 0; getVis().force = 0; getVis().inverseMass = 1; getVis().resetVelocity = 0.75; getVis().resetForce = 0; }