/** * \brief 管理器初始化,由于这事情总是发生在角色上线的时候所以1加载数据库,2发送关系列表给客户端,3发送黑名单给网关 */ void CRelationManager::init() { if (this->size() == 0) { loadFromDatabase(); sendRelationList(); sendAllBlackListToGateway(); } }
void GmailServiceRoot::start(bool freshly_activated) { Q_UNUSED(freshly_activated) loadFromDatabase(); loadCacheFromFile(accountId()); if (childCount() <= 1) { syncIn(); } m_network->oauth()->login(); }
void StandardServiceRoot::start(bool freshly_activated) { loadFromDatabase(); if (freshly_activated) { // In other words, if there are no feeds or categories added. if (MessageBox::show(qApp->mainFormWidget(), QMessageBox::Question, QObject::tr("Load initial set of feeds"), tr("This new account does not include any feeds. You can now add default set of feeds."), tr("Do you want to load initial set of feeds?"), QString(), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { QString target_opml_file = APP_INITIAL_FEEDS_PATH + QDir::separator() + FEED_INITIAL_OPML_PATTERN; QString current_locale = qApp->localization()->loadedLanguage(); QString file_to_load; if (QFile::exists(target_opml_file.arg(current_locale))) { file_to_load = target_opml_file.arg(current_locale); } else if (QFile::exists(target_opml_file.arg(DEFAULT_LOCALE))) { file_to_load = target_opml_file.arg(DEFAULT_LOCALE); } FeedsImportExportModel model; QString output_msg; try { model.importAsOPML20(IOFactory::readTextFile(file_to_load), false); model.checkAllItems(); if (mergeImportExportModel(&model, this, output_msg)) { requestItemExpand(getSubTree(), true); } } catch (ApplicationException &ex) { MessageBox::show(qApp->mainFormWidget(), QMessageBox::Critical, tr("Error when loading initial feeds"), ex.message()); } } } checkArgumentsForFeedAdding(); }
void QFontDatabase::load(const QFontPrivate *d, int script) { // sanity checks if(!qApp) qWarning("QFont: Must construct a QApplication before a QFont"); Q_ASSERT(script >= 0 && script < QUnicodeTables::ScriptCount); Q_UNUSED(script); QFontDef req = d->request; req.pixelSize = qt_mac_pixelsize(req, d->dpi); // set the point size to 0 to get better caching req.pointSize = 0; QFontCache::Key key = QFontCache::Key(req, QUnicodeTables::Common, d->screen); if(!(d->engineData = QFontCache::instance()->findEngineData(key))) { d->engineData = new QFontEngineData; QFontCache::instance()->insertEngineData(key, d->engineData); } else { d->engineData->ref.ref(); } if(d->engineData->engine) // already loaded return; // set it to the actual pointsize, so QFontInfo will do the right thing req.pointSize = qRound(qt_mac_pointsize(d->request, d->dpi)); QFontEngine *e = QFontCache::instance()->findEngine(key); if(!e && qt_enable_test_font && req.family == QLatin1String("__Qt__Box__Engine__")) { e = new QTestFontEngine(req.pixelSize); e->fontDef = req; } if(e) { e->ref.ref(); d->engineData->engine = e; return; // the font info and fontdef should already be filled } QFontEngine *engine = NULL; #if defined(QT_MAC_USE_COCOA) // Shortcut to get the font directly without going through the font database if (!req.family.isEmpty() && !req.styleName.isEmpty()) { QCFString expectedFamily = QCFString(req.family); QCFString expectedStyle = QCFString(req.styleName); QCFType<CFMutableDictionaryRef> attributes = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); CFDictionaryAddValue(attributes, kCTFontFamilyNameAttribute, expectedFamily); CFDictionaryAddValue(attributes, kCTFontStyleNameAttribute, expectedStyle); QCFType<CTFontDescriptorRef> descriptor = CTFontDescriptorCreateWithAttributes(attributes); CGAffineTransform transform = qt_transform_from_fontdef(req); QCFType<CTFontRef> ctFont = CTFontCreateWithFontDescriptor(descriptor, req.pixelSize, &transform); if (ctFont) { QCFString familyName = CTFontCopyFamilyName(ctFont); // Only accept the font if the family name is exactly the same as we specified if (CFEqual(expectedFamily, familyName)) { engine = new QCoreTextFontEngineMulti(ctFont, req, d->kerning); } } } #endif if (!engine) engine = loadFromDatabase(req, d); if (engine) { d->engineData->engine = engine; engine->ref.ref(); QFontCache::instance()->insertEngine(key, engine); } }