当前位置: 首页>>代码示例>>C++>>正文


C++ Downloader::setQuit方法代码示例

本文整理汇总了C++中Downloader::setQuit方法的典型用法代码示例。如果您正苦于以下问题:C++ Downloader::setQuit方法的具体用法?C++ Downloader::setQuit怎么用?C++ Downloader::setQuit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Downloader的用法示例。


在下文中一共展示了Downloader::setQuit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char *argv[])
{
	QCoreApplication app(argc, argv);
	app.setApplicationName("Grabber");
	app.setApplicationVersion(VERSION);
	app.setOrganizationName("Bionus");
	app.setOrganizationDomain("bionus.fr.cr");

	QCommandLineParser parser;
	parser.addHelpOption();
	parser.addVersionOption();

	QCommandLineOption tagsOption(QStringList() << "t" << "tags", "Tags to search for.", "tags");
	QCommandLineOption sourceOption(QStringList() << "s" << "sources", "Source websites.", "sources");
	QCommandLineOption pageOption(QStringList() << "p" << "page", "Starting page.", "page", "1");
	QCommandLineOption limitOption(QStringList() << "m" << "max", "Maximum of returned images.", "count");
	QCommandLineOption perpageOption(QStringList() << "i" << "perpage", "Number of images per page.", "count", "20");
	QCommandLineOption pathOption(QStringList() << "l" << "location", "Location to save the results.", "path");
	QCommandLineOption filenameOption(QStringList() << "f" << "filename", "Filename to save the results.", "filename");
	QCommandLineOption userOption(QStringList() << "u" << "user", "Username to connect to the source.", "user");
	QCommandLineOption passwordOption(QStringList() << "w" << "password", "Password to connect to the source.", "password");
	QCommandLineOption blacklistOption(QStringList() << "b" << "blacklist", "Download blacklisted images.");
	QCommandLineOption postfilteringOption(QStringList() << "r" << "postfilter", "Filter results.", "filter");
	QCommandLineOption noDuplicatesOption(QStringList() << "n" << "no-duplicates", "Remove duplicates from results.");
	QCommandLineOption verboseOption(QStringList() << "d" << "debug", "Show debug messages.");
	QCommandLineOption tagsMinOption(QStringList() << "tm" << "tags-min", "Minimum count for tags to be returned.", "count", "0");
	QCommandLineOption tagsFormatOption(QStringList() << "tf" << "tags-format", "Format for returning tags.", "format", "%tag\t%count\t%type");
	parser.addOption(tagsOption);
	parser.addOption(sourceOption);
	parser.addOption(pageOption);
	parser.addOption(limitOption);
	parser.addOption(perpageOption);
	parser.addOption(pathOption);
	parser.addOption(filenameOption);
	parser.addOption(userOption);
	parser.addOption(passwordOption);
	parser.addOption(blacklistOption);
	parser.addOption(postfilteringOption);
	parser.addOption(tagsMinOption);
	parser.addOption(tagsFormatOption);
	parser.addOption(noDuplicatesOption);
	parser.addOption(verboseOption);
	QCommandLineOption returnCountOption(QStringList() << "rc" << "return-count", "Return total image count.");
	QCommandLineOption returnTagsOption(QStringList() << "rt" << "return-tags", "Return tags for a search.");
	QCommandLineOption returnPureTagsOption(QStringList() << "rp" << "return-pure-tags", "Return tags.");
	QCommandLineOption returnImagesOption(QStringList() << "ri" << "return-images", "Return images url.");
	QCommandLineOption downloadOption(QStringList() << "download", "Download found images.");
	parser.addOption(returnCountOption);
	parser.addOption(returnTagsOption);
	parser.addOption(returnPureTagsOption);
	parser.addOption(returnImagesOption);
	parser.addOption(downloadOption);

	parser.process(app);

	if (!parser.isSet(verboseOption))
		qInstallMessageHandler(noMessageOutput);

	Profile *profile = new Profile(savePath());
	Downloader *dwnldr = new Downloader(profile,
										parser.value(tagsOption).split(" ", QString::SkipEmptyParts),
										parser.value(postfilteringOption).split(" ", QString::SkipEmptyParts),
										Site::getSites(profile, parser.value(sourceOption).split(" ", QString::SkipEmptyParts)),
										parser.value(pageOption).toInt(),
										parser.value(limitOption).toInt(),
										parser.value(perpageOption).toInt(),
										parser.value(pathOption),
										parser.value(filenameOption),
										parser.value(userOption),
										parser.value(passwordOption),
										parser.isSet(blacklistOption),
										profile->getBlacklist(),
										parser.isSet(noDuplicatesOption),
										parser.value(tagsMinOption).toInt(),
										parser.value(tagsFormatOption));

	if (parser.isSet(returnCountOption))
		dwnldr->getPageCount();
	else if (parser.isSet(returnTagsOption))
		dwnldr->getPageTags();
	else if (parser.isSet(returnPureTagsOption))
		dwnldr->getTags();
	else if (parser.isSet(returnImagesOption))
		dwnldr->getUrls();
	else if (parser.isSet(downloadOption))
		dwnldr->getImages();
	else
		parser.showHelp();

	dwnldr->setQuit(true);
	QObject::connect(dwnldr, SIGNAL(quit()), qApp, SLOT(quit()));

	return app.exec();
}
开发者ID:Flat,项目名称:imgbrd-grabber,代码行数:94,代码来源:main.cpp


注:本文中的Downloader::setQuit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。