예제 #1
0
void CDownloadManager::Run(IContentManager* pContentManager, IPathManager* pPathManager, LPCSTR pszChosenCollection /*=NULL*/)
{
	if (Init(pContentManager, pPathManager))
	{
		CDownloadCollectionArray Collections;
		// Read the list of collections.
		if (GetCollections(Collections))
		{
			// Are there any collections?
			if (Collections.GetSize() == 0)
			{
				// We have no collections. :(
				AfxMessageBox(IDS_NoCollectionsToDownload);
			}
			else
			{
				// We have collections. :)

				// Get the shared directories.
				CMapStringToString mapSharedPaths;
				GetSharedPaths(mapSharedPaths);

				// Compute the default directory to use for downloading.
				CString csDownloadDirectory = GetDownloadDirectory(mapSharedPaths);

				// Get the collection download states.
				UpdateDownloadStates(Collections);

				// Ask the user what to do.
				int iResponse = 0;
				
				while (iResponse = AskUserAboutDownload(Collections, csDownloadDirectory, pszChosenCollection))
				{
					
					if(iResponse == DOWNLOAD)
					{
						
						// Add this download directory to the registry.
						AddDownloadDirectory(mapSharedPaths, csDownloadDirectory);

						// Download the collections.
						DoDownload(Collections, csDownloadDirectory);

						// Get the collection download states.
						UpdateDownloadStates(Collections);
					}
					else if (iResponse == DELETECOLLECTION)
					{
						// Get the collection download states.
						UpdateDownloadStates(Collections);
					}						
				}
			}
		}
	}
}
예제 #2
0
int Wimp::CreateMainWindow()
{

   engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
   topLevel = engine.rootObjects().value(0);
   window = qobject_cast<QQuickWindow *>(topLevel);

   if(settings->playlist_directory[0] != '\0')
       GetCollections(settings->playlist_directory);
   else
       collections.append("Collection dir not defined");

   engine.rootContext()->setContextProperty("collections", QVariant::fromValue(collections));

   if(settings->libretro_directory[0] != '\0')
       GetCores(settings->libretro_directory);
   else
       cores.append("Core dir not defined");

   engine.rootContext()->setContextProperty("cores", QVariant::fromValue(cores));

   return this->exec();

}