BasicmLearningEditor::BasicmLearningEditor(TemplateCore *core, QWidget *parent) : TemplateEditor(core, parent), m_ui(new Ui::BasicmLearningEditor) { m_ui->setupUi(this); // Set validators. QRegExpValidator *author_validator = new QRegExpValidator(this); QRegExpValidator *title_validator = new QRegExpValidator(this); author_validator->setRegExp(QRegExp(".{,50}")); title_validator->setRegExp(QRegExp(".{,100}")); m_ui->m_txtAuthor->lineEdit()->setValidator(author_validator); m_ui->m_txtName->lineEdit()->setValidator(title_validator); // Set tab order. QList<QWidget*> tab_order_widgets; tab_order_widgets << m_ui->m_txtTitle->lineEdit() << m_ui->m_txtDescription << m_ui->m_txtAuthor->lineEdit() << m_ui->m_txtName->lineEdit() << m_ui->m_listItems << m_ui->m_btnItemAdd << m_ui->m_btnItemRemove << m_ui->m_btnItemUp << m_ui->m_btnItemDown; for (int i = 1; i < tab_order_widgets.size(); i++) { setTabOrder(tab_order_widgets.at(i - 1), tab_order_widgets.at(i)); } m_ui->m_txtTitle->lineEdit()->setPlaceholderText(tr("Title of the item")); m_ui->m_txtNumberOfItems->lineEdit()->setEnabled(false); m_ui->m_txtAuthor->lineEdit()->setPlaceholderText(tr("Author of this collection")); m_ui->m_txtName->lineEdit()->setPlaceholderText(tr("Name of this collection")); IconFactory *factory = IconFactory::instance(); m_ui->m_btnItemAdd->setIcon(factory->fromTheme("item-add")); m_ui->m_btnItemRemove->setIcon(factory->fromTheme("item-remove")); m_ui->m_btnItemUp->setIcon(factory->fromTheme("move-up")); m_ui->m_btnItemDown->setIcon(factory->fromTheme("move-down")); connect(m_ui->m_txtTitle->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(checkTitle(QString))); connect(m_ui->m_btnItemAdd, SIGNAL(clicked()), this, SLOT(addNewItem())); connect(m_ui->m_btnItemRemove, SIGNAL(clicked()), this, SLOT(removeSelectedItem())); connect(m_ui->m_txtDescription, SIGNAL(textChanged()), this, SLOT(saveItem())); connect(m_ui->m_txtTitle->lineEdit(), SIGNAL(textEdited(QString)), this, SLOT(saveItem())); connect(m_ui->m_listItems, SIGNAL(currentRowChanged(int)), this, SLOT(displayItem(int))); connect(m_ui->m_btnItemUp, SIGNAL(clicked()), this, SLOT(moveItemUp())); connect(m_ui->m_btnItemDown, SIGNAL(clicked()), this, SLOT(moveItemDown())); connect(m_ui->m_txtAuthor->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(onAuthorChanged(QString))); connect(m_ui->m_txtName->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(onNameChanged(QString))); checkTitle(m_ui->m_txtTitle->lineEdit()->text()); checkAuthor(); checkName(); setEditorsEnabled(false); updateItemCount(); }
FileDescription::~FileDescription() { kdebugf(); disconnect(timer, SIGNAL(timeout()), this, SLOT(checkTitle())); delete timer; StatusChangerManager::instance()->unregisterStatusChanger(fileDescStatusChanger); delete fileDescStatusChanger; fileDescStatusChanger = 0; }
FileDescription::FileDescription() { kdebugf(); createDefaultConfiguration(); timer = new QTimer(); connect(timer, SIGNAL(timeout()), this, SLOT(checkTitle())); timer->start(500); fileDescStatusChanger = new FileDescStatusChanger(); StatusChangerManager::instance()->registerStatusChanger(fileDescStatusChanger); }
void MediaPlayer::init() { kdebugf(); // Initialization playerInfo = 0; playerCommands = 0; statusInterval = CHECK_STATUS_INTERVAL; // MediaPlayer menus in chats m_menu = new QMenu(); popups[0] = m_menu->addAction(tr("Put formated string"), this, SLOT(insertFormattedSong())); popups[1] = m_menu->addAction(tr("Put song title"), this, SLOT(insertSongTitle())); popups[2] = m_menu->addAction(tr("Put song file name"), this, SLOT(insertSongFilename())); popups[3] = m_menu->addAction(tr("Send all playlist titles"), this, SLOT(insertPlaylistTitles())); popups[4] = m_menu->addAction(tr("Send all playlist files"), this, SLOT(insertPlaylistFilenames())); // Title checking timer timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(checkTitle())); DockedMediaplayerStatus = 0; // Initial values of some object variables winKeyPressed = false; Changer = new MediaPlayerStatusChanger(this); m_statusChangerManager->registerStatusChanger(Changer); connect(m_statusChangerManager, SIGNAL(manualStatusAboutToBeChanged(StatusContainer*,Status)), this, SLOT(statusAboutToBeChanged())); setControlsEnabled(false); isPaused = true; Changer->changePositionInStatus((MediaPlayerStatusChanger::ChangeDescriptionTo)m_configuration->deprecatedApi()->readNumEntry("MediaPlayer", "statusPosition")); createDefaultConfiguration(); configurationUpdated(); }
/** * Process all actions for a single frame * This includes some message passing between child object */ void GameStatePlay::logic() { if (inpt->window_resized) refreshWidgets(); checkCutscene(); // check menus first (top layer gets mouse click priority) menu->logic(); if (!isPaused()) { // these actions only occur when the game isn't paused if (pc->stats.alive) checkLoot(); checkEnemyFocus(); if (pc->stats.alive) { mapr->checkHotspots(); mapr->checkNearestEvent(); checkNPCInteraction(); } checkTitle(); menu->act->checkAction(action_queue); pc->logic(action_queue, restrictPowerUse(), npc_id != -1); // Transform powers change the actionbar layout, // so we need to prevent accidental clicks if a new power is placed under the slot we clicked on. // It's a bit hacky, but it works if (pc->isTransforming()) { menu->act->resetSlots(); } // transfer hero data to enemies, for AI use if (pc->stats.get(STAT_STEALTH) > 100) enemies->hero_stealth = 100; else enemies->hero_stealth = pc->stats.get(STAT_STEALTH); enemies->logic(); hazards->logic(); loot->logic(); enemies->checkEnemiesforXP(); npcs->logic(); snd->logic(pc->stats.pos); comb->logic(mapr->cam); } // close menus when the player dies, but still allow them to be reopened if (pc->close_menus) { pc->close_menus = false; menu->closeAll(); } // these actions occur whether the game is paused or not. checkTeleport(); checkLootDrop(); checkLog(); checkBook(); checkEquipmentChange(); checkUsedItems(); checkStash(); checkSaveEvent(); checkNotifications(); checkCancel(); mapr->logic(); mapr->enemies_cleared = enemies->isCleared(); quests->logic(); pc->checkTransform(); // change hero powers on transformation if (pc->setPowers) { pc->setPowers = false; if (!pc->stats.humanoid && menu->pow->visible) menu->closeRight(); // save ActionBar state and lock slots from removing/replacing power for (int i=0; i<ACTIONBAR_MAX ; i++) { menu->act->hotkeys_temp[i] = menu->act->hotkeys[i]; menu->act->hotkeys[i] = 0; } int count = ACTIONBAR_MAIN; // put creature powers on action bar // TODO What if creature has more powers than the size of the action bar? for (size_t i=0; i<pc->charmed_stats->powers_ai.size(); i++) { if (pc->charmed_stats->powers_ai[i].id != 0 && powers->powers[pc->charmed_stats->powers_ai[i].id].beacon != true) { menu->act->hotkeys[count] = pc->charmed_stats->powers_ai[i].id; menu->act->locked[count] = true; count++; } if (count == ACTIONBAR_MAX) count = 0; } if (pc->stats.manual_untransform && pc->untransform_power > 0) { menu->act->hotkeys[count] = pc->untransform_power; menu->act->locked[count] = true; } else if (pc->stats.manual_untransform && pc->untransform_power == 0) logError("GameStatePlay: Untransform power not found, you can't untransform manually"); menu->act->updated = true; // reapply equipment if the transformation allows it if (pc->stats.transform_with_equipment) menu->inv->applyEquipment(menu->inv->inventory[EQUIPMENT].storage); } // revert hero powers if (pc->revertPowers) { pc->revertPowers = false; // restore ActionBar state for (int i=0; i<ACTIONBAR_MAX; i++) { menu->act->hotkeys[i] = menu->act->hotkeys_temp[i]; menu->act->locked[i] = false; } menu->act->updated = true; // also reapply equipment here, to account items that give bonuses to base stats menu->inv->applyEquipment(menu->inv->inventory[EQUIPMENT].storage); } // when the hero (re)spawns, reapply equipment & passive effects if (pc->respawn) { pc->stats.alive = true; pc->stats.corpse = false; pc->stats.cur_state = AVATAR_STANCE; menu->inv->applyEquipment(menu->inv->inventory[EQUIPMENT].storage); menu->inv->changed_equipment = true; checkEquipmentChange(); powers->activatePassives(&pc->stats); pc->stats.logic(); pc->stats.recalc(); pc->respawn = false; } // use a normal mouse cursor is menus are open if (menu->menus_open) { curs->setCursor(CURSOR_NORMAL); } // update the action bar as it may have been changed by items if (menu->act->updated) { menu->act->updated = false; // set all hotkeys to their base powers for (unsigned i = 0; i < menu->act->slots_count; i++) { menu->act->hotkeys_mod[i] = menu->act->hotkeys[i]; } updateActionBar(); } // reload music if changed in the pause menu if (menu->exit->reload_music) { mapr->loadMusic(); menu->exit->reload_music = false; } }
s32 checkIOS(u32 IOS) { // Get tmd to determine the version of the IOS return checkTitle(((u64)(1) << 32) | (IOS)); }