[welcome] Improve debugging of general requirements
- distinguish 'this has not been checked' from 'checked and failed'
This commit is contained in:
parent
9e0aa76375
commit
90f8e748ef
@ -70,16 +70,49 @@ biggestSingleScreen()
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @brief Distinguish has-not-been-checked-at-all from false.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
struct MaybeChecked
|
||||||
|
{
|
||||||
|
bool hasBeenChecked = false;
|
||||||
|
bool value = false;
|
||||||
|
|
||||||
|
MaybeChecked& operator=( bool b )
|
||||||
|
{
|
||||||
|
cDebug() << "Assigning" << b;
|
||||||
|
hasBeenChecked = true;
|
||||||
|
value = b;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
operator bool() const { return value; }
|
||||||
|
};
|
||||||
|
|
||||||
|
QDebug&
|
||||||
|
operator<<( QDebug& s, const MaybeChecked& c )
|
||||||
|
{
|
||||||
|
if ( c.hasBeenChecked )
|
||||||
|
{
|
||||||
|
s << c.value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
s << "unchecked";
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
Calamares::RequirementsList
|
Calamares::RequirementsList
|
||||||
GeneralRequirements::checkRequirements()
|
GeneralRequirements::checkRequirements()
|
||||||
{
|
{
|
||||||
QSize availableSize = biggestSingleScreen();
|
QSize availableSize = biggestSingleScreen();
|
||||||
|
|
||||||
bool enoughStorage = false;
|
MaybeChecked enoughStorage;
|
||||||
bool enoughRam = false;
|
MaybeChecked enoughRam;
|
||||||
bool hasPower = false;
|
MaybeChecked hasPower;
|
||||||
bool hasInternet = false;
|
MaybeChecked hasInternet;
|
||||||
bool isRoot = false;
|
MaybeChecked isRoot;
|
||||||
bool enoughScreen = availableSize.isValid() && ( availableSize.width() >= CalamaresUtils::windowMinimumWidth )
|
bool enoughScreen = availableSize.isValid() && ( availableSize.width() >= CalamaresUtils::windowMinimumWidth )
|
||||||
&& ( availableSize.height() >= CalamaresUtils::windowMinimumHeight );
|
&& ( availableSize.height() >= CalamaresUtils::windowMinimumHeight );
|
||||||
|
|
||||||
@ -112,7 +145,7 @@ GeneralRequirements::checkRequirements()
|
|||||||
isRoot = checkIsRoot();
|
isRoot = checkIsRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
using TR = Logger::DebugRow< const char*, bool >;
|
using TR = Logger::DebugRow< const char*, MaybeChecked >;
|
||||||
cDebug() << "GeneralRequirements output:" << TR( "enoughStorage", enoughStorage ) << TR( "enoughRam", enoughRam )
|
cDebug() << "GeneralRequirements output:" << TR( "enoughStorage", enoughStorage ) << TR( "enoughRam", enoughRam )
|
||||||
<< TR( "hasPower", hasPower ) << TR( "hasInternet", hasInternet ) << TR( "isRoot", isRoot );
|
<< TR( "hasPower", hasPower ) << TR( "hasInternet", hasInternet ) << TR( "isRoot", isRoot );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user