void FoldersPanel::loadTree(const QUrl& url) { Q_ASSERT(m_controller); m_updateCurrentItem = false; QUrl baseUrl; if (url.isLocalFile()) { // Use the root directory as base for local URLs (#150941) baseUrl = QUrl::fromLocalFile(QDir::rootPath()); } else { // Clear the path for non-local URLs and use it as base baseUrl = url; baseUrl.setPath(QString('/')); } if (m_model->directory() != baseUrl) { m_updateCurrentItem = true; m_model->refreshDirectory(baseUrl); } const int index = m_model->index(url); if (index >= 0) { updateCurrentItem(index); } else { m_updateCurrentItem = true; m_model->expandParentDirectories(url); // slotLoadingCompleted() will be invoked after the model has // expanded the url } }
void HistoryController::updateForStandardLoad(HistoryUpdateType updateType) { LOG(History, "HistoryController %p updateForStandardLoad: Updating History for standard load in frame %p (main frame %d) %s", this, &m_frame, m_frame.isMainFrame(), m_frame.loader().documentLoader()->url().string().ascii().data()); FrameLoader& frameLoader = m_frame.loader(); bool needPrivacy = m_frame.page()->usesEphemeralSession(); const URL& historyURL = frameLoader.documentLoader()->urlForHistory(); if (!frameLoader.documentLoader()->isClientRedirect()) { if (!historyURL.isEmpty()) { if (updateType != UpdateAllExceptBackForwardList) updateBackForwardListClippedAtTarget(true); if (!needPrivacy) { frameLoader.client().updateGlobalHistory(); frameLoader.documentLoader()->setDidCreateGlobalHistoryEntry(true); if (frameLoader.documentLoader()->unreachableURL().isEmpty()) frameLoader.client().updateGlobalHistoryRedirectLinks(); } m_frame.loader().client().updateGlobalHistoryItemForPage(); } } else { // The client redirect replaces the current history item. updateCurrentItem(); } if (!historyURL.isEmpty() && !needPrivacy) { if (Page* page = m_frame.page()) addVisitedLink(*page, historyURL); if (!frameLoader.documentLoader()->didCreateGlobalHistoryEntry() && frameLoader.documentLoader()->unreachableURL().isEmpty() && !m_frame.document()->url().isEmpty()) frameLoader.client().updateGlobalHistoryRedirectLinks(); } }
void HistoryController::updateForBackForwardNavigation() { LOG(History, "HistoryController %p updateForBackForwardNavigation: Updating History for back/forward navigation in frame %p (main frame %d) %s", this, &m_frame, m_frame.isMainFrame(), m_frame.loader().documentLoader() ? m_frame.loader().documentLoader()->url().string().utf8().data() : ""); // Must grab the current scroll position before disturbing it if (!m_frameLoadComplete) saveScrollPositionAndViewStateToItem(m_previousItem.get()); // When traversing history, we may end up redirecting to a different URL // this time (e.g., due to cookies). See http://webkit.org/b/49654. updateCurrentItem(); }
void HistoryController::updateForBackForwardNavigation() { #if !LOG_DISABLED LOG(History, "WebCoreHistory: Updating History for back/forward navigation in frame %s", m_frame->document()->title().utf8().data()); #endif saveScrollPositionAndViewStateToItem(m_previousItem.get()); // When traversing history, we may end up redirecting to a different URL // this time (e.g., due to cookies). See http://webkit.org/b/49654. updateCurrentItem(); }
void HistoryController::updateForRedirectWithLockedBackForwardList() { #if !LOG_DISABLED LOG(History, "WebCoreHistory: Updating History for redirect load in frame %s", m_frame->document()->title().utf8().data()); #endif if (!m_currentItem && !m_frame->tree()->parent()) { if (!m_frame->loader()->documentLoader()->urlForHistory().isEmpty()) updateBackForwardListClippedAtTarget(true); } // The client redirect replaces the current history item. updateCurrentItem(); }
Database_Items::~Database_Items() { if (itemRef != NULL) { updateCurrentItem(); delete itemRef; itemRef = NULL; } if (animRef != NULL) { delete animRef; animRef = NULL; } }
void HistoryController::updateForBackForwardNavigation() { #if !LOG_DISABLED if (m_frame.loader().documentLoader()) LOG(History, "WebCoreHistory: Updating History for back/forward navigation in frame %s", m_frame.loader().documentLoader()->title().string().utf8().data()); #endif // Must grab the current scroll position before disturbing it if (!m_frameLoadComplete) saveScrollPositionAndViewStateToItem(m_previousItem.get()); // When traversing history, we may end up redirecting to a different URL // this time (e.g., due to cookies). See http://webkit.org/b/49654. updateCurrentItem(); }
void HistoryController::updateForReload() { #if !LOG_DISABLED LOG(History, "WebCoreHistory: Updating History for reload in frame %s", m_frame->document()->title().utf8().data()); #endif if (m_currentItem) { if (m_frame->loader()->loadType() == FrameLoadTypeReload || m_frame->loader()->loadType() == FrameLoadTypeReloadFromOrigin) saveScrollPositionAndViewStateToItem(m_currentItem.get()); } // When reloading the page, we may end up redirecting to a different URL // this time (e.g., due to cookies). See http://webkit.org/b/4072. updateCurrentItem(); }
void Database_Items::shutdownItems() { if (itemRef != NULL) { updateCurrentItem(); delete itemRef; itemRef = NULL; } if (animRef != NULL) { delete animRef; animRef = NULL; } weapon_wBattleAnimationPreview->stopAnimation(); }
void HistoryController::updateForReload() { LOG(History, "HistoryController %p updateForBackForwardNavigation: Updating History for reload in frame %p (main frame %d) %s", this, &m_frame, m_frame.isMainFrame(), m_frame.loader().documentLoader() ? m_frame.loader().documentLoader()->url().string().utf8().data() : ""); if (m_currentItem) { PageCache::singleton().remove(*m_currentItem); if (m_frame.loader().loadType() == FrameLoadType::Reload || m_frame.loader().loadType() == FrameLoadType::ReloadFromOrigin) saveScrollPositionAndViewStateToItem(m_currentItem.get()); // Rebuild the history item tree when reloading as trying to re-associate everything is too error-prone. m_currentItem->clearChildren(); } // When reloading the page, we may end up redirecting to a different URL // this time (e.g., due to cookies). See http://webkit.org/b/4072. updateCurrentItem(); }
void KOEditorFreeBusy::showAttendeeStatusMenu() { if ( mGanttView->mapFromGlobal( QCursor::pos() ).x() > 22 ) return; QPopupMenu popup; popup.insertItem( SmallIcon( "help" ), Attendee::statusName( Attendee::NeedsAction ), Attendee::NeedsAction ); popup.insertItem( KOGlobals::self()->smallIcon( "ok" ), Attendee::statusName( Attendee::Accepted ), Attendee::Accepted ); popup.insertItem( KOGlobals::self()->smallIcon( "no" ), Attendee::statusName( Attendee::Declined ), Attendee::Declined ); popup.insertItem( KOGlobals::self()->smallIcon( "apply" ), Attendee::statusName( Attendee::Tentative ), Attendee::Tentative ); popup.insertItem( KOGlobals::self()->smallIcon( "mail_forward" ), Attendee::statusName( Attendee::Delegated ), Attendee::Delegated ); popup.insertItem( Attendee::statusName( Attendee::Completed ), Attendee::Completed ); popup.insertItem( KOGlobals::self()->smallIcon( "help" ), Attendee::statusName( Attendee::InProcess ), Attendee::InProcess ); popup.setItemChecked( currentAttendee()->status(), true ); int status = popup.exec( QCursor::pos() ); if ( status >= 0 ) { currentAttendee()->setStatus( (Attendee::PartStat)status ); updateCurrentItem(); updateAttendeeInput(); } }
void FoldersPanel::slotLoadingCompleted() { if (m_controller->view()->opacity() == 0) { // The loading of the initial tree after opening the Folders panel // has been finished. Trigger the increasing of the opacity after // a short delay to give the view the chance to finish its internal // animations. // TODO: Check whether it makes sense to allow accessing the // view-internal delay for usecases like this. QTimer::singleShot(250, this, SLOT(startFadeInAnimation())); } if (!m_updateCurrentItem) { return; } const int index = m_model->index(url()); updateCurrentItem(index); m_updateCurrentItem = false; }
int AmPlaylist::put(unsigned int user_ts, unsigned char* buffer, unsigned int size) { int ret = -1; cur_mut.lock(); updateCurrentItem(); while(cur_item && cur_item->record && (ret = cur_item->record->put(user_ts,buffer,size)) < 0){ DBG("put: gotoNextItem\n"); gotoNextItem(); } if(!cur_item || !cur_item->record) ret = size; cur_mut.unlock(); return ret; }
void HistoryController::updateForRedirectWithLockedBackForwardList() { #if !LOG_DISABLED if (m_frame->loader()->documentLoader()) LOG(History, "WebCoreHistory: Updating History for redirect load in frame %s", m_frame->loader()->documentLoader()->title().string().utf8().data()); #endif Settings* settings = m_frame->settings(); bool needPrivacy = !settings || settings->privateBrowsingEnabled(); const KURL& historyURL = m_frame->loader()->documentLoader()->urlForHistory(); if (m_frame->loader()->documentLoader()->isClientRedirect()) { if (!m_currentItem && !m_frame->tree()->parent()) { if (!historyURL.isEmpty()) { updateBackForwardListClippedAtTarget(true); if (!needPrivacy) { m_frame->loader()->client()->updateGlobalHistory(); m_frame->loader()->documentLoader()->setDidCreateGlobalHistoryEntry(true); if (m_frame->loader()->documentLoader()->unreachableURL().isEmpty()) m_frame->loader()->client()->updateGlobalHistoryRedirectLinks(); } m_frame->loader()->client()->updateGlobalHistoryItemForPage(); } } // The client redirect replaces the current history item. updateCurrentItem(); } else { Frame* parentFrame = m_frame->tree()->parent(); if (parentFrame && parentFrame->loader()->history()->m_currentItem) parentFrame->loader()->history()->m_currentItem->setChildItem(createItem()); } if (!historyURL.isEmpty() && !needPrivacy) { if (Page* page = m_frame->page()) addVisitedLink(page, historyURL); if (!m_frame->loader()->documentLoader()->didCreateGlobalHistoryEntry() && m_frame->loader()->documentLoader()->unreachableURL().isEmpty() && !m_frame->document()->url().isEmpty()) m_frame->loader()->client()->updateGlobalHistoryRedirectLinks(); } }
bool SQLToolWidget::eventFilter(QObject *object, QEvent *event) { if(object==objects_trw && event->type()==QEvent::KeyPress) { QKeyEvent *k_event=dynamic_cast<QKeyEvent *>(event); if(k_event->key()==Qt::Key_Delete || k_event->key()==Qt::Key_F5) { if(k_event->key()==Qt::Key_F5) updateCurrentItem(); else dropObject(objects_trw->currentItem()); return(true); } else return(false); } return(QWidget::eventFilter(object, event)); }
void HistoryController::updateForReload() { #if !LOG_DISABLED if (m_frame.loader().documentLoader()) LOG(History, "WebCoreHistory: Updating History for reload in frame %s", m_frame.loader().documentLoader()->title().string().utf8().data()); #endif if (m_currentItem) { PageCache::singleton().remove(*m_currentItem); if (m_frame.loader().loadType() == FrameLoadType::Reload || m_frame.loader().loadType() == FrameLoadType::ReloadFromOrigin) saveScrollPositionAndViewStateToItem(m_currentItem.get()); // Rebuild the history item tree when reloading as trying to re-associate everything is too error-prone. m_currentItem->clearChildren(); } // When reloading the page, we may end up redirecting to a different URL // this time (e.g., due to cookies). See http://webkit.org/b/4072. updateCurrentItem(); }
void AmPlaylist::gotoNextItem(bool notify) { bool had_item = false; if(cur_item){ // if(cur_item->play) // cur_item->play->close(); // if(cur_item->record) // cur_item->record->close(); delete cur_item; cur_item = 0; had_item = true; } updateCurrentItem(); if(notify && had_item && !cur_item){ DBG("posting AmAudioEvent::noAudio event!\n"); ev_q->postEvent(new AmAudioEvent(AmAudioEvent::noAudio)); } }
int AmPlaylist::get(unsigned int user_ts, unsigned char* buffer, unsigned int nb_samples) { int ret = -1; cur_mut.lock(); updateCurrentItem(); while(cur_item && cur_item->play && (ret = cur_item->play->get(user_ts,buffer,nb_samples)) <= 0){ DBG("get: gotoNextItem\n"); gotoNextItem(); } if(!cur_item || !cur_item->play) { ret = calcBytesToRead(nb_samples); memset(buffer,0,ret); } cur_mut.unlock(); return ret; }
void HistoryController::updateForRedirectWithLockedBackForwardList() { LOG(History, "HistoryController %p updateForRedirectWithLockedBackForwardList: Updating History for redirect load in frame %p (main frame %d) %s", this, &m_frame, m_frame.isMainFrame(), m_frame.loader().documentLoader() ? m_frame.loader().documentLoader()->url().string().utf8().data() : ""); bool needPrivacy = m_frame.page()->usesEphemeralSession(); const URL& historyURL = m_frame.loader().documentLoader()->urlForHistory(); if (m_frame.loader().documentLoader()->isClientRedirect()) { if (!m_currentItem && !m_frame.tree().parent()) { if (!historyURL.isEmpty()) { updateBackForwardListClippedAtTarget(true); if (!needPrivacy) { m_frame.loader().client().updateGlobalHistory(); m_frame.loader().documentLoader()->setDidCreateGlobalHistoryEntry(true); if (m_frame.loader().documentLoader()->unreachableURL().isEmpty()) m_frame.loader().client().updateGlobalHistoryRedirectLinks(); } m_frame.loader().client().updateGlobalHistoryItemForPage(); } } // The client redirect replaces the current history item. updateCurrentItem(); } else { Frame* parentFrame = m_frame.tree().parent(); if (parentFrame && parentFrame->loader().history().currentItem()) parentFrame->loader().history().currentItem()->setChildItem(createItem()); } if (!historyURL.isEmpty() && !needPrivacy) { if (Page* page = m_frame.page()) addVisitedLink(*page, historyURL); if (!m_frame.loader().documentLoader()->didCreateGlobalHistoryEntry() && m_frame.loader().documentLoader()->unreachableURL().isEmpty() && !m_frame.document()->url().isEmpty()) m_frame.loader().client().updateGlobalHistoryRedirectLinks(); } }
void HistoryController::updateForStandardLoad(HistoryUpdateType updateType) { LOG(History, "WebCoreHistory: Updating History for Standard Load in frame %s", m_frame->loader()->documentLoader()->url().string().ascii().data()); FrameLoader* frameLoader = m_frame->loader(); Settings* settings = m_frame->settings(); bool needPrivacy = !settings || settings->privateBrowsingEnabled(); const KURL& historyURL = frameLoader->documentLoader()->urlForHistory(); if (!frameLoader->documentLoader()->isClientRedirect()) { if (!historyURL.isEmpty()) { if (updateType != UpdateAllExceptBackForwardList) updateBackForwardListClippedAtTarget(true); if (!needPrivacy) { frameLoader->client()->updateGlobalHistory(); frameLoader->documentLoader()->setDidCreateGlobalHistoryEntry(true); if (frameLoader->documentLoader()->unreachableURL().isEmpty()) frameLoader->client()->updateGlobalHistoryRedirectLinks(); } m_frame->loader()->client()->updateGlobalHistoryItemForPage(); } } else { // The client redirect replaces the current history item. updateCurrentItem(); } if (!historyURL.isEmpty() && !needPrivacy) { if (Page* page = m_frame->page()) addVisitedLink(page, historyURL); if (!frameLoader->documentLoader()->didCreateGlobalHistoryEntry() && frameLoader->documentLoader()->unreachableURL().isEmpty() && !m_frame->document()->url().isEmpty()) frameLoader->client()->updateGlobalHistoryRedirectLinks(); } }
void KOAttendeeEditor::updateAttendee() { Attendee *a = currentAttendee(); if ( !a || mDisableItemUpdate ) { return; } QString name; QString email; KPIMUtils::extractEmailAddressAndName( mNameEdit->text(), email, name ); bool iAmTheOrganizer = mOrganizerCombo && KOPrefs::instance()->thatIsMe( mOrganizerCombo->currentText() ); if ( iAmTheOrganizer ) { bool myself = KPIMUtils::compareEmail( email, mOrganizerCombo->currentText(), false ); bool wasMyself = KPIMUtils::compareEmail( a->email(), mOrganizerCombo->currentText(), false ); if ( myself ) { mRsvpButton->setChecked( false ); mRsvpButton->setEnabled( false ); } else if ( wasMyself ) { // this was me, but is no longer, reset mStatusCombo->setCurrentIndex( KCal::Attendee::NeedsAction ); mRsvpButton->setChecked( true ); mRsvpButton->setEnabled( true ); } } a->setName( name ); a->setUid( mUid ); a->setEmail( email ); a->setRole( Attendee::Role( mRoleCombo->currentIndex() ) ); a->setStatus( Attendee::PartStat( mStatusCombo->currentIndex() ) ); a->setRSVP( mRsvpButton->isChecked() ); updateCurrentItem(); }
SQLToolWidget::SQLToolWidget(QWidget * parent) : QWidget(parent) { setupUi(this); sql_cmd_hl=new SyntaxHighlighter(sql_cmd_txt, false, false); sql_cmd_hl->loadConfiguration(GlobalAttributes::CONFIGURATIONS_DIR + GlobalAttributes::DIR_SEPARATOR + GlobalAttributes::SQL_HIGHLIGHT_CONF + GlobalAttributes::CONFIGURATION_EXT); h_splitter->setSizes({0, 10000}); h_splitter1->setSizes({1000, 250}); results_parent->setVisible(false); cmd_history_gb->setVisible(false); sql_file_dlg.setDefaultSuffix("sql"); sql_file_dlg.setFileMode(QFileDialog::AnyFile); sql_file_dlg.setNameFilter(tr("SQL file (*.sql);;All files (*.*)")); sql_file_dlg.setModal(true); csv_file_dlg.setDefaultSuffix("csv"); csv_file_dlg.setFileMode(QFileDialog::AnyFile); csv_file_dlg.setWindowTitle(trUtf8("Save CSV file")); csv_file_dlg.setNameFilter(tr("Comma-separated values file (*.csv);;All files (*.*)")); csv_file_dlg.setModal(true); csv_file_dlg.setAcceptMode(QFileDialog::AcceptSave); copy_action=new QAction(trUtf8("Copy"), ©_menu); copy_menu.addAction(copy_action); drop_action=new QAction(QIcon(":icones/icones/excluir.png"), trUtf8("Drop object"), &handle_menu); drop_action->setShortcut(QKeySequence(Qt::Key_Delete)); show_data_action=new QAction(QIcon(":icones/icones/result.png"), trUtf8("Show data"), &handle_menu); refresh_action=new QAction(QIcon(":icones/icones/atualizar.png"), trUtf8("Update"), &handle_menu); refresh_action->setShortcut(QKeySequence(Qt::Key_F5)); connect(hide_tb, SIGNAL(clicked(void)), this, SLOT(hide(void))); connect(clear_btn, SIGNAL(clicked(void)), this, SLOT(clearAll(void))); connect(connect_tb, SIGNAL(clicked(void)), this, SLOT(connectToDatabase(void))); connect(database_cmb, SIGNAL(currentIndexChanged(int)), this, SLOT(listObjects(void))); connect(refresh_tb, SIGNAL(clicked(void)), this, SLOT(listObjects(void))); connect(expand_all_tb, SIGNAL(clicked(bool)), objects_trw, SLOT(expandAll(void))); connect(collapse_all_tb, SIGNAL(clicked(bool)), objects_trw, SLOT(collapseAll(void))); connect(sql_cmd_txt, SIGNAL(textChanged(void)), this, SLOT(enableCommandButtons(void))); connect(run_sql_tb, SIGNAL(clicked(void)), this, SLOT(runSQLCommand(void))); connect(save_tb, SIGNAL(clicked(void)), this, SLOT(saveCommands(void))); connect(load_tb, SIGNAL(clicked(void)), this, SLOT(loadCommands(void))); connect(export_tb, SIGNAL(clicked(void)), this, SLOT(exportResults(void))); connect(history_tb, SIGNAL(toggled(bool)), cmd_history_gb, SLOT(setVisible(bool))); connect(results_tbw, SIGNAL(itemPressed(QTableWidgetItem*)), this, SLOT(copySelection(void))); connect(objects_trw, SIGNAL(itemPressed(QTreeWidgetItem*,int)), this, SLOT(handleObject(QTreeWidgetItem *,int))); connect(clear_history_btn, SIGNAL(clicked(void)), cmd_history_lst, SLOT(clear(void))); connect(hide_ext_objs_chk, SIGNAL(toggled(bool)), this, SLOT(listObjects(void))); connect(hide_sys_objs_chk, SIGNAL(toggled(bool)), this, SLOT(listObjects(void))); connect(refresh_action, SIGNAL(triggered()), this, SLOT(updateCurrentItem())); //Signal handling with C++11 lambdas Slots connect(clear_history_btn, &QPushButton::clicked, [=]() { clear_history_btn->setDisabled(true); }); connect(cmd_history_lst, &QListWidget::itemDoubleClicked, [=]() { sql_cmd_txt->setText(cmd_history_lst->currentItem()->data(Qt::UserRole).toString()); }); connect(filter_edt, &QLineEdit::textChanged, [=]() { DatabaseImportForm::filterObjects(objects_trw, filter_edt->text(), false); }); objects_trw->installEventFilter(this); }
void Database_Items::on_lwItemList_itemSelectionChanged() { Item::WeaponItem *weaponData; Item::EquipmentItem *equipmentData; Item::MedicineItem *medicineData; Item::SkillBookItem *skillBookData; Item::SeedItem *seedData; Item::SkillScrollItem *skillScrollData; Item::SwitchItem *switchData; Item::EventItem *eventData; int itemType; int itemID; updateCurrentItem(); commonItem_clearData(); equipment_clearData(); event_clearData(); medicine_clearData(); seed_clearData(); skillBook_clearData(); skillScroll_clearData(); switch_clearData(); weapon_clearData(); if (itemRef != NULL) { delete itemRef; itemRef = NULL; } itemID = lwItemList->currentRow(); if (itemID >= 0) { itemRef = new ProjectData::DataReference<Item>(itemID, __FILE__, __LINE__); leName->setText((*itemRef)->getName()); cboxType->setCurrentIndex((*itemRef)->getType()); sbPrice->setValue((*itemRef)->getPrice()); itemType = (*itemRef)->getType(); if (itemType == Item::TYPE_COMMONITEM) commonItem_leDescription->setText((*itemRef)->getDescription()); else if (itemType == Item::TYPE_WEAPON) { weapon_wBattleAnimationPreview->stopAnimation(); weaponData = (*itemRef)->getWeaponData(); if (weaponData->twoHanded) rbBothHands->setChecked(true); else rbOneHand->setChecked(true); weapon_leDescription->setText((*itemRef)->getDescription()); weapon_cboxSkill->setCurrentIndex(weaponData->skillID + 1); if (weaponData->usableByCharacters) weapon_rbUsableByCharacter->setChecked(true); else weapon_rbUsableByClass->setChecked(true); for (int i = 0; i < weapon_twCharacterClassList->rowCount(); ++i) { QCheckBox *checkBox = (QCheckBox*)weapon_twCharacterClassList->cellWidget(i, 0); if (i >= weaponData->usableBy.size()) checkBox->setChecked(true); else checkBox->setChecked(weaponData->usableBy[i]); } weapon_sbAttackChange->setValue(weaponData->attackChange); weapon_sbDefenseChange->setValue(weaponData->defenseChange); weapon_sbWisdomChange->setValue(weaponData->wisdomChange); weapon_sbAgilityChange->setValue(weaponData->agilityChange); weapon_cbAttackFirst->setChecked(weaponData->alwaysAttackFirst); weapon_cbAttackTwice->setChecked(weaponData->attackTwice); weapon_cbAttackAllEnemies->setChecked(weaponData->attackAllEnemies); weapon_cbIgnoreEnemyEvasion->setChecked(weaponData->ignoreEnemyEvasion); weapon_cbCursed->setChecked(weaponData->cursed); weapon_cbUsableOnTheDead->setChecked(weaponData->usableOnTheDead); weapon_sbMPConsumed->setValue(weaponData->amountMPConsumed); weapon_sbHitProbability->setValue(weaponData->percentHitProbability); weapon_sbCriticalBonus->setValue(weaponData->percentCriticalBonus); for (int i = 0; i < weapon_twAttributeList->rowCount(); ++i) { QCheckBox *checkBox = (QCheckBox*)weapon_twAttributeList->cellWidget(i, 0); if (i >= weaponData->attribute.size()) checkBox->setChecked(false); else checkBox->setChecked(weaponData->attribute[i]); } for (int i = 0; i < weapon_twConditionList->rowCount(); ++i) { QCheckBox *checkBox = (QCheckBox*)weapon_twConditionList->cellWidget(i, 0); if (i >= weaponData->conditions.size()) checkBox->setChecked(false); else checkBox->setChecked(weaponData->conditions[i]); } if (weaponData->inflictConditions) weapon_rbInflictCondition->setChecked(true); else weapon_rbRemoveCondition->setChecked(true); weapon_sbConditionEffectiveness->setValue(weaponData->percentConditionEffectivenessProbability); weapon_cboxBattleAnimation->setCurrentIndex(weaponData->battleAnimationID); on_weapon_cboxBattleAnimation_currentIndexChanged(weaponData->battleAnimationID); // called just in case the new weapons battle animation ID is the same as the previous. TODO("Handle weaponData->animationSettings"); } else if (itemType == Item::TYPE_SHIELD || itemType == Item::TYPE_ARMOR || itemType == Item::TYPE_HELMET || itemType == Item::TYPE_ACCESSORY) { equipmentData = (*itemRef)->getEquipmentData(); equipment_leDescription->setText((*itemRef)->getDescription()); equipment_cboxSkill->setCurrentIndex(equipmentData->skillID + 1); if (equipmentData->usableByCharacters) equipment_rbUsableByCharacter->setChecked(true); else equipment_rbUsableByClass->setChecked(true); for (int i = 0; i < equipment_twCharacterClassList->rowCount(); ++i) { QCheckBox *checkBox = (QCheckBox*)equipment_twCharacterClassList->cellWidget(i, 0); if (i >= equipmentData->usableBy.size()) checkBox->setChecked(true); else checkBox->setChecked(equipmentData->usableBy[i]); } equipment_sbAttackChange->setValue(equipmentData->attackChange); equipment_sbDefenseChange->setValue(equipmentData->defenseChange); equipment_sbWisdomChange->setValue(equipmentData->wisdomChange); equipment_sbAgilityChange->setValue(equipmentData->agilityChange); equipment_cbPreventCriticalHits->setChecked(equipmentData->preventCriticalHits); equipment_cbIncreaseEvasion->setChecked(equipmentData->increaseEvasion); equipment_cbHalfMPConsumption->setChecked(equipmentData->halfMPConsumption); equipment_cbCursed->setChecked(equipmentData->cursed); for (int i = 0; i < equipment_twResistance->rowCount(); ++i) { QCheckBox *checkBox = (QCheckBox*)equipment_twResistance->cellWidget(i, 0); if (i >= equipmentData->attributeResistance.size()) checkBox->setChecked(false); else checkBox->setChecked(equipmentData->attributeResistance[i]); } for (int i = 0; i < equipment_twConditions->rowCount(); ++i) { QCheckBox *checkBox = (QCheckBox*)equipment_twConditions->cellWidget(i, 0); if (i >= equipmentData->conditions.size()) checkBox->setChecked(false); else checkBox->setChecked(equipmentData->conditions[i]); } if (equipmentData->resistConditions) equipment_rbResistCondition->setChecked(true); else equipment_rbInflictCondition->setChecked(true); equipment_sbResistance->setValue(equipmentData->percentConditionResistanceEffectiveness); } else if (itemType == Item::TYPE_MEDICINE) { medicineData = (*itemRef)->getMedicineData(); cboxNumberOfUses->setCurrentIndex(medicineData->numberOfUses); medicine_leDescription->setText((*itemRef)->getDescription()); if (medicineData->targetSingleAlly) medicine_rbTargetSingleAlly->setChecked(true); else medicine_rbTargetAllAllies->setChecked(true); if (medicineData->usableByCharacters) medicine_rbUsableByCharacter->setChecked(true); else medicine_rbUsableByClass->setChecked(true); for (int i = 0; i < medicine_twCharacterClassList->rowCount(); ++i) { QCheckBox *checkBox = (QCheckBox*)medicine_twCharacterClassList->cellWidget(i, 0); if (i >= medicineData->usableBy.size()) checkBox->setChecked(true); else checkBox->setChecked(medicineData->usableBy[i]); } for (int i = 0; i < medicine_twConditionList->rowCount(); ++i) { QCheckBox *checkBox = (QCheckBox*)medicine_twConditionList->cellWidget(i, 0); if (i >= medicineData->cureCondition.size()) checkBox->setChecked(false); else checkBox->setChecked(medicineData->cureCondition[i]); } medicine_sbPercentHPRecovery->setValue(medicineData->percentRestoredHP); medicine_sbAmountHPRecovery->setValue(medicineData->amountRestoredHP); medicine_sbPercentMPRecovery->setValue(medicineData->percentRestoredMP); medicine_sbAmountMPRecovery->setValue(medicineData->amountRestoredMP); medicine_cbFieldMapOnly->setChecked(medicineData->onlyUsableOnFieldMap); medicine_cbDeadCharactersOnly->setChecked(medicineData->onlyUsableOnDeadCharacters); } else if (itemType == Item::TYPE_SKILLBOOK) { skillBookData = (*itemRef)->getSkillBookData(); cboxNumberOfUses->setCurrentIndex(skillBookData->numberOfUses); skillBook_leDescription->setText((*itemRef)->getDescription()); if (skillBookData->usableByCharacters) skillBook_rbUsableByCharacter->setChecked(true); else skillBook_rbUsableByClass->setChecked(true); for (int i = 0; i < skillBook_twCharacterClassList->rowCount(); ++i) { QCheckBox *checkBox = (QCheckBox*)skillBook_twCharacterClassList->cellWidget(i, 0); if (i >= skillBookData->usableBy.size()) checkBox->setChecked(true); else checkBox->setChecked(skillBookData->usableBy[i]); } skillBook_cboxSkillLearned->setCurrentIndex(skillBookData->skillID); } else if (itemType == Item::TYPE_SEED) { seedData = (*itemRef)->getSeedData(); cboxNumberOfUses->setCurrentIndex(seedData->numberOfUses); seed_leDescription->setText((*itemRef)->getDescription()); if (seedData->usableByCharacters) seed_rbUsableByCharacter->setChecked(true); else seed_rbUsableByClass->setChecked(true); for (int i = 0; i < seed_twCharacterClassList->rowCount(); ++i) { QCheckBox *checkBox = (QCheckBox*)seed_twCharacterClassList->cellWidget(i, 0); if (i >= seedData->usableBy.size()) checkBox->setChecked(true); else checkBox->setChecked(seedData->usableBy[i]); } seed_sbMaxHPChange->setValue(seedData->maxHPChange); seed_sbMaxMPChange->setValue(seedData->maxMPChange); seed_sbAttackChange->setValue(seedData->attackChange); seed_sbDefenseChange->setValue(seedData->defenseChange); seed_sbWisdomChange->setValue(seedData->wisdomChange); seed_sbAgilityChange->setValue(seedData->agilityChange); } else if (itemType == Item::TYPE_SKILLSCROLL) { skillScrollData = (*itemRef)->getSkillScrollData(); cboxNumberOfUses->setCurrentIndex(skillScrollData->numberOfUses); skillScroll_leDescription->setText((*itemRef)->getDescription()); if (skillScrollData->usableByCharacters) skillScroll_rbUsableByCharacter->setChecked(true); else skillScroll_rbUsableByClass->setChecked(true); for (int i = 0; i < skillScroll_twCharacterClassList->rowCount(); ++i) { QCheckBox *checkBox = (QCheckBox*)skillScroll_twCharacterClassList->cellWidget(i, 0); if (i >= skillScrollData->usableBy.size()) checkBox->setChecked(true); else checkBox->setChecked(skillScrollData->usableBy[i]); } skillScroll_cboxSkillInvoked->setCurrentIndex(skillScrollData->skillID); if (skillScrollData->showItemNameMessageWhenUsed) skillScroll_rbItemName->setChecked(true); else skillScroll_rbSkillName->setChecked(true); } else if (itemType == Item::TYPE_SWITCH) { switchData = (*itemRef)->getSwitchData(); cboxNumberOfUses->setCurrentIndex(switchData->numberOfUses); switch_leDescription->setText((*itemRef)->getDescription()); TODO("Handle switchData->switchID"); switch_cbAllowField->setChecked(switchData->allowFieldActivation); switch_cbAllowBattle->setChecked(switchData->allowBattleActivation); } else if (itemType == Item::TYPE_EVENT) { eventData = (*itemRef)->getEventData(); cboxNumberOfUses->setCurrentIndex(eventData->numberOfUses); event_leDescription->setText((*itemRef)->getDescription()); event_cbAllowField->setChecked(eventData->allowFieldActivation); event_cbAllowBattle->setChecked(eventData->allowBattleActivation); TODO("Handle eventData->event"); } } }