Merge branch 'improve-errors'
This commit is contained in:
commit
0a48696254
@ -64,17 +64,21 @@ Handler::Handler( const QString& implementation, const QString& url, const QStri
|
||||
{
|
||||
bool ok = false;
|
||||
m_type = handlerTypes().find( implementation, ok );
|
||||
#if !defined(QT_XML_LIB)
|
||||
if ( m_type == Type::XML )
|
||||
{
|
||||
m_type = Type::None;
|
||||
cWarning() << "GeoIP style XML is not supported in this version of Calamares.";
|
||||
}
|
||||
#endif
|
||||
if ( !ok )
|
||||
{
|
||||
cWarning() << "GeoIP Style" << implementation << "is not recognized.";
|
||||
cWarning() << "GeoIP style" << implementation << "is not recognized.";
|
||||
}
|
||||
else if ( m_type == Type::None )
|
||||
{
|
||||
cWarning() << "GeoIP style *none* does not do anything.";
|
||||
}
|
||||
#if !defined(QT_XML_LIB)
|
||||
else if ( m_type == Type::XML )
|
||||
{
|
||||
m_type = Type::None;
|
||||
cWarning() << "GeoIP style *xml* is not supported in this version of Calamares.";
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Handler::~Handler()
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <QString>
|
||||
#include <QVariantMap>
|
||||
|
||||
namespace CalamaresUtils
|
||||
namespace CalamaresUtils
|
||||
{
|
||||
namespace GeoIP
|
||||
{
|
||||
@ -80,6 +80,8 @@ public:
|
||||
|
||||
bool isValid() const { return m_type != Type::None; }
|
||||
Type type() const { return m_type; }
|
||||
QString url() const { return m_url; }
|
||||
QString selector() const { return m_selector; }
|
||||
|
||||
private:
|
||||
Type m_type;
|
||||
|
@ -198,7 +198,7 @@ Module::loadConfigurationFile( const QString& configFileName ) //throws YAML::Ex
|
||||
return;
|
||||
}
|
||||
}
|
||||
cDebug() << "No config file found in" << Logger::DebugList( configCandidates );
|
||||
cDebug() << "No config file for" << m_name << "found anywhere at" << Logger::DebugList( configCandidates );
|
||||
}
|
||||
|
||||
|
||||
|
@ -90,10 +90,14 @@ ModuleManager::doInit()
|
||||
if ( success )
|
||||
{
|
||||
QFileInfo descriptorFileInfo( currentDir.absoluteFilePath( QLatin1Literal( "module.desc") ) );
|
||||
if ( ! ( descriptorFileInfo.exists() && descriptorFileInfo.isReadable() ) )
|
||||
if ( !descriptorFileInfo.exists() )
|
||||
{
|
||||
cDebug() << Q_FUNC_INFO << "unreadable file: "
|
||||
<< descriptorFileInfo.absoluteFilePath();
|
||||
cDebug() << "ModuleManager expected descriptor is missing:" << descriptorFileInfo.absoluteFilePath();
|
||||
continue;
|
||||
}
|
||||
if ( !descriptorFileInfo.isReadable() )
|
||||
{
|
||||
cDebug() << "ModuleManager descriptor file is unreadable:" << descriptorFileInfo.absoluteFilePath();
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -111,13 +115,14 @@ ModuleManager::doInit()
|
||||
}
|
||||
else
|
||||
{
|
||||
cWarning() << "Cannot cd into module directory "
|
||||
<< path << "/" << subdir;
|
||||
cWarning() << "ModuleManager module directory is not accessible:" << path << "/" << subdir;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
cDebug() << "ModuleManager bad search path" << path;
|
||||
{
|
||||
cDebug() << "ModuleManager module search path does not exist:" << path;
|
||||
}
|
||||
}
|
||||
// At this point m_availableModules is filled with whatever was found in the
|
||||
// search paths.
|
||||
@ -359,7 +364,7 @@ ModuleManager::checkDependencies()
|
||||
m_availableDescriptorsByModuleName.erase( it );
|
||||
failed << moduleName;
|
||||
cWarning() << "Module" << moduleName << "requires modules" << Logger::DebugList( unmet );
|
||||
cWarning() << Logger::SubEntry << "but these are not available (listed in settings, or installed).";
|
||||
cWarning() << Logger::SubEntry << "but these are not available (listed in settings, or installed).";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -128,16 +128,24 @@ WelcomeViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
CalamaresUtils::getString( geoip, "style" ),
|
||||
CalamaresUtils::getString( geoip, "url" ),
|
||||
CalamaresUtils::getString( geoip, "selector" ) );
|
||||
auto* future = new FWString();
|
||||
connect( future, &FWString::finished, [view=this, f=future, h=handler]()
|
||||
if ( handler->type() != CalamaresUtils::GeoIP::Handler::Type::None )
|
||||
{
|
||||
QString countryResult = f->future().result();
|
||||
cDebug() << "GeoIP result for welcome=" << countryResult;
|
||||
view->setCountry( countryResult );
|
||||
f->deleteLater();
|
||||
delete h;
|
||||
} );
|
||||
future->setFuture( handler->queryRaw() );
|
||||
auto* future = new FWString();
|
||||
connect( future, &FWString::finished, [view=this, f=future, h=handler]()
|
||||
{
|
||||
QString countryResult = f->future().result();
|
||||
cDebug() << "GeoIP result for welcome=" << countryResult;
|
||||
view->setCountry( countryResult, h );
|
||||
f->deleteLater();
|
||||
delete h;
|
||||
} );
|
||||
future->setFuture( handler->queryRaw() );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Would not produce useful country code anyway.
|
||||
delete handler;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -156,12 +164,22 @@ WelcomeViewStep::checkRequirements()
|
||||
return m_requirementsChecker->checkRequirements();
|
||||
}
|
||||
|
||||
static inline void
|
||||
logGeoIPHandler( CalamaresUtils::GeoIP::Handler* handler )
|
||||
{
|
||||
if ( handler )
|
||||
{
|
||||
cDebug() << Logger::SubEntry << "Obtained from" << handler->url() << " (" << static_cast<int>( handler->type() ) << handler->selector() << ')';
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
WelcomeViewStep::setCountry( const QString& countryCode )
|
||||
WelcomeViewStep::setCountry( const QString& countryCode, CalamaresUtils::GeoIP::Handler* handler )
|
||||
{
|
||||
if ( countryCode.length() != 2 )
|
||||
{
|
||||
cDebug() << "Unusable country code" << countryCode;
|
||||
logGeoIPHandler( handler );
|
||||
return;
|
||||
}
|
||||
|
||||
@ -169,6 +187,7 @@ WelcomeViewStep::setCountry( const QString& countryCode )
|
||||
if ( c_l.first == QLocale::Country::AnyCountry )
|
||||
{
|
||||
cDebug() << "Unusable country code" << countryCode;
|
||||
logGeoIPHandler( handler );
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
@ -32,6 +32,14 @@
|
||||
class WelcomePage;
|
||||
class GeneralRequirements;
|
||||
|
||||
namespace CalamaresUtils
|
||||
{
|
||||
namespace GeoIP
|
||||
{
|
||||
class Handler;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
class PLUGINDLLEXPORT WelcomeViewStep : public Calamares::ViewStep
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -57,9 +65,10 @@ public:
|
||||
/** @brief Sets the country that Calamares is running in.
|
||||
*
|
||||
* This (ideally) sets up language and locale settings that are right for
|
||||
* the given 2-letter country code.
|
||||
* the given 2-letter country code. Uses the handler's information (if
|
||||
* given) for error reporting.
|
||||
*/
|
||||
void setCountry( const QString& );
|
||||
void setCountry( const QString&, CalamaresUtils::GeoIP::Handler* handler );
|
||||
|
||||
Calamares::RequirementsList checkRequirements() override;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user