本文整理汇总了C++中http::Downloader类的典型用法代码示例。如果您正苦于以下问题:C++ Downloader类的具体用法?C++ Downloader怎么用?C++ Downloader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Downloader类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Draw
void HttpImageFileView::Draw(UIContext &dc) {
using namespace Draw;
if (!texture_ && !textureFailed_ && !path_.empty() && !download_) {
download_ = downloader_->StartDownloadWithCallback(path_, "", std::bind(&HttpImageFileView::DownloadCompletedCallback, this, std::placeholders::_1));
download_->SetHidden(true);
}
if (!textureData_.empty()) {
texture_ = CreateTextureFromFileData(dc.GetDrawContext(), (const uint8_t *)(textureData_.data()), (int)textureData_.size(), DETECT);
if (!texture_)
textureFailed_ = true;
textureData_.clear();
download_.reset();
}
if (HasFocus()) {
dc.FillRect(dc.theme->itemFocusedStyle.background, bounds_.Expand(3));
}
// TODO: involve sizemode
if (texture_) {
dc.Flush();
dc.GetDrawContext()->BindTexture(0, texture_->GetTexture());
dc.Draw()->Rect(bounds_.x, bounds_.y, bounds_.w, bounds_.h, color_);
dc.Flush();
dc.RebindTexture();
} else {
// draw a black rectangle to represent the missing image.
dc.FillRect(UI::Drawable(0xFF000000), GetBounds());
}
}
开发者ID:Orphis,项目名称:ppsspp,代码行数:31,代码来源:Store.cpp
示例2: Load
void Config::Load(const char *iniFileName, const char *controllerIniFilename) {
const bool useIniFilename = iniFileName != nullptr && strlen(iniFileName) > 0;
iniFilename_ = FindConfigFile(useIniFilename ? iniFileName : "ppsspp.ini");
const bool useControllerIniFilename = controllerIniFilename != nullptr && strlen(controllerIniFilename) > 0;
controllerIniFilename_ = FindConfigFile(useControllerIniFilename ? controllerIniFilename : "controls.ini");
INFO_LOG(LOADER, "Loading config: %s", iniFilename_.c_str());
bSaveSettings = true;
bShowFrameProfiler = true;
IniFile iniFile;
if (!iniFile.Load(iniFilename_)) {
ERROR_LOG(LOADER, "Failed to read %s. Setting config to default.", iniFilename_.c_str());
// Continue anyway to initialize the config.
}
for (size_t i = 0; i < ARRAY_SIZE(sections); ++i) {
IniFile::Section *section = iniFile.GetOrCreateSection(sections[i].section);
for (auto setting = sections[i].settings; setting->HasMore(); ++setting) {
setting->Get(section);
}
}
iRunCount++;
if (!File::Exists(currentDirectory))
currentDirectory = "";
IniFile::Section *recent = iniFile.GetOrCreateSection("Recent");
recent->Get("MaxRecent", &iMaxRecent, 30);
// Fix issue from switching from uint (hex in .ini) to int (dec)
// -1 is okay, though. We'll just ignore recent stuff if it is.
if (iMaxRecent == 0)
iMaxRecent = 30;
if (iMaxRecent > 0) {
recentIsos.clear();
for (int i = 0; i < iMaxRecent; i++) {
char keyName[64];
std::string fileName;
snprintf(keyName, sizeof(keyName), "FileName%d", i);
if (recent->Get(keyName, &fileName, "") && !fileName.empty()) {
recentIsos.push_back(fileName);
}
}
}
auto pinnedPaths = iniFile.GetOrCreateSection("PinnedPaths")->ToMap();
vPinnedPaths.clear();
for (auto it = pinnedPaths.begin(), end = pinnedPaths.end(); it != end; ++it) {
vPinnedPaths.push_back(it->second);
}
if (iAnisotropyLevel > 4) {
iAnisotropyLevel = 4;
}
// Check for an old dpad setting
IniFile::Section *control = iniFile.GetOrCreateSection("Control");
float f;
control->Get("DPadRadius", &f, 0.0f);
if (f > 0.0f) {
ResetControlLayout();
}
// MIGRATION: For users who had the old static touch layout, aren't I nice?
// We can probably kill this in 0.9.8 or something.
if (fDpadX > 1.0 || fDpadY > 1.0) { // Likely the rest are too!
float screen_width = dp_xres;
float screen_height = dp_yres;
fActionButtonCenterX /= screen_width;
fActionButtonCenterY /= screen_height;
fDpadX /= screen_width;
fDpadY /= screen_height;
fStartKeyX /= screen_width;
fStartKeyY /= screen_height;
fSelectKeyX /= screen_width;
fSelectKeyY /= screen_height;
fUnthrottleKeyX /= screen_width;
fUnthrottleKeyY /= screen_height;
fLKeyX /= screen_width;
fLKeyY /= screen_height;
fRKeyX /= screen_width;
fRKeyY /= screen_height;
fAnalogStickX /= screen_width;
fAnalogStickY /= screen_height;
}
const char *gitVer = PPSSPP_GIT_VERSION;
Version installed(gitVer);
Version upgrade(upgradeVersion);
const bool versionsValid = installed.IsValid() && upgrade.IsValid();
// Do this regardless of iRunCount to prevent a silly bug where one might use an older
// build of PPSSPP, receive an upgrade notice, then start a newer version, and still receive the upgrade notice,
// even if said newer version is >= the upgrade found online.
//.........这里部分代码省略.........
开发者ID:Roceso1337,项目名称:ppsspp,代码行数:101,代码来源:Config.cpp
示例3: Load
void Config::Load(const char *iniFileName, const char *controllerIniFilename) {
iniFilename_ = FindConfigFile(iniFileName != NULL ? iniFileName : "ppsspp.ini");
controllerIniFilename_ = FindConfigFile(controllerIniFilename != NULL ? controllerIniFilename : "controls.ini");
INFO_LOG(LOADER, "Loading config: %s", iniFilename_.c_str());
bSaveSettings = true;
IniFile iniFile;
if (!iniFile.Load(iniFilename_)) {
ERROR_LOG(LOADER, "Failed to read %s. Setting config to default.", iniFilename_.c_str());
// Continue anyway to initialize the config.
}
IniFile::Section *general = iniFile.GetOrCreateSection("General");
general->Get("FirstRun", &bFirstRun, true);
general->Get("RunCount", &iRunCount, 0);
iRunCount++;
general->Get("Enable Logging", &bEnableLogging, true);
general->Get("AutoRun", &bAutoRun, true);
general->Get("Browse", &bBrowse, false);
general->Get("IgnoreBadMemAccess", &bIgnoreBadMemAccess, true);
general->Get("CurrentDirectory", ¤tDirectory, "");
general->Get("ShowDebuggerOnLoad", &bShowDebuggerOnLoad, false);
general->Get("HomebrewStore", &bHomebrewStore, false);
if (!File::Exists(currentDirectory))
currentDirectory = "";
std::string defaultLangRegion = "en_US";
if (bFirstRun) {
std::string langRegion = System_GetProperty(SYSPROP_LANGREGION);
if (i18nrepo.IniExists(langRegion))
defaultLangRegion = langRegion;
// TODO: Be smart about same language, different country
}
general->Get("Language", &sLanguageIni, defaultLangRegion.c_str());
general->Get("NumWorkerThreads", &iNumWorkerThreads, cpu_info.num_cores);
general->Get("EnableAutoLoad", &bEnableAutoLoad, false);
general->Get("EnableCheats", &bEnableCheats, false);
general->Get("ScreenshotsAsPNG", &bScreenshotsAsPNG, false);
general->Get("StateSlot", &iCurrentStateSlot, 0);
general->Get("RewindFlipFrequency", &iRewindFlipFrequency, 0);
general->Get("GridView1", &bGridView1, true);
general->Get("GridView2", &bGridView2, true);
general->Get("GridView3", &bGridView3, false);
// "default" means let emulator decide, "" means disable.
general->Get("ReportingHost", &sReportHost, "default");
general->Get("Recent", recentIsos);
general->Get("AutoSaveSymbolMap", &bAutoSaveSymbolMap, false);
#ifdef _WIN32
general->Get("TopMost", &bTopMost);
general->Get("WindowX", &iWindowX, -1); // -1 tells us to center the window.
general->Get("WindowY", &iWindowY, -1);
general->Get("WindowWidth", &iWindowWidth, 0); // 0 will be automatically reset later (need to do the AdjustWindowRect dance).
general->Get("WindowHeight", &iWindowHeight, 0);
general->Get("PauseOnLostFocus", &bPauseOnLostFocus, false);
#endif
IniFile::Section *recent = iniFile.GetOrCreateSection("Recent");
recent->Get("MaxRecent", &iMaxRecent, 30);
// Fix issue from switching from uint (hex in .ini) to int (dec)
if (iMaxRecent == 0)
iMaxRecent = 30;
recentIsos.clear();
for (int i = 0; i < iMaxRecent; i++)
{
char keyName[64];
std::string fileName;
sprintf(keyName,"FileName%d",i);
if (!recent->Get(keyName,&fileName,"") || fileName.length() == 0) {
// just skip it to get the next key
}
else {
recentIsos.push_back(fileName);
}
}
IniFile::Section *cpu = iniFile.GetOrCreateSection("CPU");
#ifdef IOS
cpu->Get("Jit", &bJit, iosCanUseJit);
#else
cpu->Get("Jit", &bJit, true);
#endif
cpu->Get("SeparateCPUThread", &bSeparateCPUThread, false);
cpu->Get("AtomicAudioLocks", &bAtomicAudioLocks, false);
cpu->Get("SeparateIOThread", &bSeparateIOThread, true);
cpu->Get("FastMemoryAccess", &bFastMemory, true);
cpu->Get("CPUSpeed", &iLockedCPUSpeed, 0);
IniFile::Section *graphics = iniFile.GetOrCreateSection("Graphics");
graphics->Get("ShowFPSCounter", &iShowFPSCounter, false);
int renderingModeDefault = 1; // Buffered
//.........这里部分代码省略.........
开发者ID:Jeweis,项目名称:ppsspp,代码行数:101,代码来源:Config.cpp
示例4: Load
void Config::Load(const char *iniFileName, const char *controllerIniFilename) {
iniFilename_ = FindConfigFile(iniFileName != NULL ? iniFileName : "ppsspp.ini");
controllerIniFilename_ = FindConfigFile(controllerIniFilename != NULL ? controllerIniFilename : "controls.ini");
INFO_LOG(LOADER, "Loading config: %s", iniFilename_.c_str());
bSaveSettings = true;
IniFile iniFile;
if (!iniFile.Load(iniFilename_)) {
ERROR_LOG(LOADER, "Failed to read %s. Setting config to default.", iniFilename_.c_str());
// Continue anyway to initialize the config.
}
for (size_t i = 0; i < ARRAY_SIZE(sections); ++i) {
IniFile::Section *section = iniFile.GetOrCreateSection(sections[i].section);
for (auto setting = sections[i].settings; setting->HasMore(); ++setting) {
setting->Get(section);
}
}
iRunCount++;
if (!File::Exists(currentDirectory))
currentDirectory = "";
IniFile::Section *recent = iniFile.GetOrCreateSection("Recent");
recent->Get("MaxRecent", &iMaxRecent, 30);
// Fix issue from switching from uint (hex in .ini) to int (dec)
if (iMaxRecent == 0)
iMaxRecent = 30;
recentIsos.clear();
for (int i = 0; i < iMaxRecent; i++) {
char keyName[64];
std::string fileName;
sprintf(keyName, "FileName%d", i);
if (recent->Get(keyName, &fileName, "") && !fileName.empty()) {
recentIsos.push_back(fileName);
}
}
auto pinnedPaths = iniFile.GetOrCreateSection("PinnedPaths")->ToMap();
vPinnedPaths.clear();
for (auto it = pinnedPaths.begin(), end = pinnedPaths.end(); it != end; ++it) {
vPinnedPaths.push_back(it->second);
}
if (iAnisotropyLevel > 4) {
iAnisotropyLevel = 4;
}
// Check for an old dpad setting
IniFile::Section *control = iniFile.GetOrCreateSection("Control");
float f;
control->Get("DPadRadius", &f, 0.0f);
if (f > 0.0f) {
ResetControlLayout();
}
// MIGRATION: For users who had the old static touch layout, aren't I nice?
// We can probably kill this in 0.9.8 or something.
if (fDpadX > 1.0 || fDpadY > 1.0) { // Likely the rest are too!
float screen_width = dp_xres;
float screen_height = dp_yres;
fActionButtonCenterX /= screen_width;
fActionButtonCenterY /= screen_height;
fDpadX /= screen_width;
fDpadY /= screen_height;
fStartKeyX /= screen_width;
fStartKeyY /= screen_height;
fSelectKeyX /= screen_width;
fSelectKeyY /= screen_height;
fUnthrottleKeyX /= screen_width;
fUnthrottleKeyY /= screen_height;
fLKeyX /= screen_width;
fLKeyY /= screen_height;
fRKeyX /= screen_width;
fRKeyY /= screen_height;
fAnalogStickX /= screen_width;
fAnalogStickY /= screen_height;
}
if (dismissedVersion == upgradeVersion) {
upgradeMessage = "";
}
// Check for new version on every 10 runs.
// Sometimes the download may not be finished when the main screen shows (if the user dismisses the
// splash screen quickly), but then we'll just show the notification next time instead, we store the
// upgrade number in the ini.
if (iRunCount % 10 == 0 && bCheckForNewVersion) {
std::shared_ptr<http::Download> dl = g_DownloadManager.StartDownloadWithCallback(
"http://www.ppsspp.org/version.json", "", &DownloadCompletedCallback);
dl->SetHidden(true);
}
INFO_LOG(LOADER, "Loading controller config: %s", controllerIniFilename_.c_str());
bSaveSettings = true;
//.........这里部分代码省略.........
开发者ID:LOSTT,项目名称:ppsspp,代码行数:101,代码来源:Config.cpp
注:本文中的http::Downloader类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论