void DataBackend::newFromBlank() { if(!checkBeforeDataUnload()) return; emit(unloadData()); dataLock=false; emit(dataLocked(false)); currentName=""; lastChangeUnpredictable=false; emit(gainedUnpredicatableChanges(lastChangeUnpredictable)); unpredictableChange=0; purgeData(); }
void DataBackend::load() { if(!checkBeforeDataUnload()) return; emit(unloadData()); dataLock=false; emit(dataLocked(false)); currentName=""; lastChangeUnpredictable=false; emit(gainedUnpredicatableChanges(lastChangeUnpredictable)); unpredictableChange=0; purgeData(); QString filename = QFileDialog::getOpenFileName(NULL, "Load Project",QString(),"*xml"); if(filename.isEmpty()) return; else { loadDataFromXML(filename); } }
void LocalController::init() { purgeData(); // std::string languageFileName = getLanguageFileName(); // std::string local2 = localPath + "text/text_" + languageFileName + ".ini"; // m_objINIFileParser = CCINIParser::parseWithFile(local2.c_str(),local2.c_str()); // bool test_xml = false; if (false == test_xml) { #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) const char* XMLS[1] = { "item_goods.xml", }; m_objXMLParser = new CCRapidXMLParser(); for (int i = 0; i < 1; i++) { std::string filePath = FileUtils::getInstance()->fullPathForFilename(XMLS[i]); CCLOG("android m_objXMLParser: %s", filePath.c_str()); m_objXMLParser->initWithFile(filePath.c_str()); } #else m_objXMLParser = CCRapidXMLParser::parseWithFileAndLocalDir("", "xml"); #endif } else { std::string local1 = localPath + xmlFile; m_objXMLParser = CCRapidXMLParser::parseWithFile(local1.c_str(), local1.c_str()); auto reset_by_single_xml = [this](const char* xml_path, const char* group_id) { auto parser = CCRapidXMLParser::parseWithFile(xml_path, xml_path); CCDictionary* new_group = parser->getGroupByKey(group_id); m_objXMLParser->getDictGroup()->setObject(new_group, group_id); for (auto k : *new_group->allKeys()) { std::string key = ((__String*)k)->_string; auto new_item = parser->getObjectByKey(key); m_objXMLParser->getDictItem()->setObject(new_item, key); } CC_SAFE_RELEASE_NULL(parser); }; reset_by_single_xml("local/xml/item_ab.xml", "ab"); reset_by_single_xml("local/xml/item_achievement.xml", "achievement"); reset_by_single_xml("local/xml/item_activity_panel.xml", "activity_panel"); reset_by_single_xml("local/xml/item_alliancescience.xml", "alliancescience"); reset_by_single_xml("local/xml/item_allianceshop.xml", "allianceshop"); reset_by_single_xml("local/xml/item_arms.xml", "arms"); reset_by_single_xml("local/xml/item_building.xml", "building"); reset_by_single_xml("local/xml/item_changeLanguage.xml", "changeLanguage"); reset_by_single_xml("local/xml/item_daily_quest.xml", "daily_quest"); reset_by_single_xml("local/xml/item_equipment.xml", "equipment"); reset_by_single_xml("local/xml/item_explore.xml", "explore"); reset_by_single_xml("local/xml/item_field_monster.xml", "field_monster"); reset_by_single_xml("local/xml/item_general.xml", "general"); reset_by_single_xml("local/xml/item_gift.xml", "gift"); reset_by_single_xml("local/xml/item_goods.xml", "goods"); reset_by_single_xml("local/xml/item_grade.xml", "grade"); reset_by_single_xml("local/xml/item_guide.xml", "guide"); reset_by_single_xml("local/xml/item_help_link.xml", "help_link"); reset_by_single_xml("local/xml/item_house.xml", "house"); reset_by_single_xml("local/xml/item_howtoplay.xml", "howtoplay"); reset_by_single_xml("local/xml/item_lordDetails.xml", "lordDetails"); reset_by_single_xml("local/xml/item_medal.xml", "medal"); reset_by_single_xml("local/xml/item_office.xml", "office"); reset_by_single_xml("local/xml/item_position_unlock.xml", "position_unlock"); reset_by_single_xml("local/xml/item_position.xml", "position"); reset_by_single_xml("local/xml/item_quest.xml", "quest"); reset_by_single_xml("local/xml/item_rank.xml", "rank"); reset_by_single_xml("local/xml/item_resource2.xml", "resource2"); reset_by_single_xml("local/xml/item_reward.xml", "reward"); reset_by_single_xml("local/xml/item_role.xml", "role"); reset_by_single_xml("local/xml/item_science.xml", "science"); reset_by_single_xml("local/xml/item_score.xml", "score"); reset_by_single_xml("local/xml/item_sk.xml", "sk"); reset_by_single_xml("local/xml/item_status.xml", "status"); reset_by_single_xml("local/xml/item_territory_effect.xml", "territory_effect"); reset_by_single_xml("local/xml/item_territory.xml", "territory"); reset_by_single_xml("local/xml/item_time_gift.xml", "time_gift"); reset_by_single_xml("local/xml/item_trial.xml", "trial"); reset_by_single_xml("local/xml/item_vip.xml", "vip"); reset_by_single_xml("local/xml/item_wonder.xml", "wonder"); reset_by_single_xml("local/xml/item_worldcastle.xml", "worldcastle"); reset_by_single_xml("local/xml/loading_tips.xml", "loading_tips"); reset_by_single_xml("local/xml/titan.xml", "titan"); } }
LocalController::~LocalController() { purgeData(); }
ListSvcs::ListSvcs(QWidget *parent,const char *name) : QDialog(parent,name,true) { setCaption(tr("Rivendell Services")); // // Fix the Window Size // setMinimumWidth(sizeHint().width()); setMinimumHeight(sizeHint().height()); // // Create Fonts // QFont bold_font=QFont("Helvetica",12,QFont::Bold); bold_font.setPixelSize(12); QFont font=QFont("Helvetica",12,QFont::Normal); font.setPixelSize(12); // // Log List // list_log_list=new QListView(this,"list_log_list"); list_log_list->setAllColumnsShowFocus(true); list_log_list->setItemMargin(5); list_log_list->addColumn(tr("SERVICE")); list_log_list->setColumnAlignment(0,Qt::AlignLeft); list_log_list->addColumn(tr("OLDEST REPORT")); list_log_list->setColumnAlignment(1,Qt::AlignCenter); connect(list_log_list, SIGNAL(doubleClicked(QListViewItem *,const QPoint &,int)), this, SLOT(listDoubleClickedData(QListViewItem *,const QPoint &,int))); // // Generate Report Button // list_generate_button=new QPushButton(this,"list_generate_button"); list_generate_button->setFont(bold_font); list_generate_button->setText(tr("&Generate\nReports")); connect(list_generate_button,SIGNAL(clicked()),this,SLOT(generateData())); // // Purge Button // list_purge_button=new QPushButton(this,"list_purge_button"); list_purge_button->setFont(bold_font); list_purge_button->setText(tr("&Purge\nData")); connect(list_purge_button,SIGNAL(clicked()),this,SLOT(purgeData())); // // Close Button // list_close_button=new QPushButton(this,"close_button"); list_close_button->setDefault(true); list_close_button->setFont(bold_font); list_close_button->setText(tr("C&lose")); connect(list_close_button,SIGNAL(clicked()),this,SLOT(closeData())); RefreshList(); }