Commit 0ab39d59 authored by Gerhard Stein's avatar Gerhard Stein

More errors messages, better feedback for new users

parent bb5dff54
......@@ -563,10 +563,8 @@ bool IsAbsolutePath(const std::string& path)
static std::string specialSearchPathForTheme = "";
void initSpecialSearchPathForTheme() {
/*if(tLXOptions->sTheme != "") {
specialSearchPathForTheme = GetFullFileName("themes/" + tLXOptions->sTheme);
} else */
void initSpecialSearchPathForTheme()
{
specialSearchPathForTheme = "";
}
......
v1.9.9.6:
---------
- Better feedback for the user, more error messages and warnings,
especially for misconfigured CG and first time user
v1.9.9.5:
---------
- Code cleanups (SaveController)
......
......@@ -188,7 +188,23 @@ bool CGameLauncher::setupMenu()
mLauncherDialog.addControl( banner, GsRect<float>(0.0f, 0.95f, 1.0f, 0.05f) );
if(!gamesDetected)
{
std::stringstream ss;
const auto searchPathGames =
JoinPaths(GetFirstSearchPath(),"games");
ss << "No games detected!\n";
ss << "You can copy some into:\n";
ss << "\"" << searchPathGames << "\",\n";
ss << "or download using \"+ More\" button.\n";
std::string msg(ss.str());
showMessageBox(msg);
return false;
}
// Set the first game selected and highlight the start button
mpGameSelecList->setSelection(0);
......
......@@ -2,13 +2,14 @@
#include <widgets/GsProgressbar.h>
#include <widgets/GsButton.h>
#include <base/GsApp.h>
#include <base/utils/FindFile.h>
#include <sstream>
#include "CGameLauncher.h"
#include "gamedownloader.h"
#include "core/mode/CGameMode.h"
// Here we take a look at the game the user still does not
// have and decide if the "New Stuff" will become selectable.
// If he has all the games, the button won't be shown.
......@@ -22,6 +23,26 @@ void CGameLauncher::verifyGameStore()
std::vector< std::string > missingList;
gameDownloader.checkForMissingGames( missingList );
if(!gameDownloader.hasCatalog())
{
std::stringstream ss;
const auto cataFile = gameDownloader.catalogFName();
const auto searchPath = GetFirstSearchPath();
ss << "You seem not to have a game catalog.\n";
ss << "The file is called " << "\"" << cataFile << "\" \n";
ss << "You might want to download \n";
ss << "and copy one into:\n";
ss << "\"" << searchPath << "\".\n";
ss << "\"+ More\" button is disabled...\n";
std::string msg(ss.str());
showMessageBox(msg);
}
if(!missingList.empty())
{
GsButton *downloadBtn = new GsButton( "+ More", new GMDownloadDlgOpen() );
......
......@@ -227,32 +227,28 @@ bool GameDownloader::loadCatalogue(const std::string &catalogueFile)
#include <fileio/KeenFiles.h>
bool GameDownloader::checkForMissingGames( std::vector< std::string > &missingList )
{
std::string gameCatalogueStr = "gameCatalogue.xml";
bool cataFound = false;
{
// Load game catalogue
if( !loadCatalogue(gameCatalogueStr) )
if( !loadCatalogue(mCatalogFName) )
{
// try with search paths
for(searchpathlist::const_iterator p = tSearchPaths.begin(); p != tSearchPaths.end(); p++)
{
std::string newPath = *p;
ReplaceFileVariables(newPath);
newPath = JoinPaths(newPath, gameCatalogueStr);
newPath = JoinPaths(newPath, mCatalogFName);
gLogging.ftextOut("Looking at: %s<br>", newPath.c_str() );
if(loadCatalogue(newPath))
{
cataFound = true;
mCataFound = true;
break;
}
}
if(!cataFound)
if(!mCataFound)
{
// If not found search within for subdirectories
std::set<std::string> dirs;
......@@ -261,13 +257,13 @@ bool GameDownloader::checkForMissingGames( std::vector< std::string > &missingLi
for(std::set<std::string>::iterator i = dirs.begin(); i != dirs.end(); ++i)
{
const std::string newPath = JoinPaths(*i, gameCatalogueStr);
const std::string newPath = JoinPaths(*i, mCatalogFName);
gLogging.ftextOut("Looking at: %s<br>", newPath.c_str() );
if(loadCatalogue(newPath))
{
cataFound = true;
mCataFound = true;
break;
}
}
......@@ -276,12 +272,12 @@ bool GameDownloader::checkForMissingGames( std::vector< std::string > &missingLi
}
else
{
cataFound = true;
mCataFound = true;
}
if(!cataFound)
if(!mCataFound)
{
gLogging.ftextOut("Sorry, catalogue file was not found: %s<br>", gameCatalogueStr.c_str() );
gLogging.ftextOut("Sorry, catalogue file was not found: %s<br>", mCatalogFName.c_str() );
return -1;
}
......
......@@ -63,13 +63,26 @@ public:
int handle();
/**
* @brief hasCatalog tells user if a catalog was detected
* @return is there a catalog, return true, otherwise false
*/
bool hasCatalog() const
{ return mCataFound;}
std::string catalogFName() const
{ return mCatalogFName; }
private:
int &mProgress;
bool &mCancelDownload;
bool mCataFound = false;
const std::string mGameFileName;
const std::string mGameName;
const std::string mCatalogFName = "gameCatalogue.xml";
std::vector<GameCatalogueEntry> mGameCatalogue;
};
......
#ifndef __CG__VERSION_H__
#define __CG__VERSION_H__
#define CGVERSION "1.9.9.5-Beta"
#define CGVERSION "1.9.9.6-Beta"
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment