Merge branch 'issue-1293'

FIXES #1293
main
Adriaan de Groot 5 years ago
commit 3877151bd8

@ -13,6 +13,9 @@ This release contains contributions from (alphabetically by first name):
means that modules now have easier access to timezone information.
Translations for timezones have also been enabled, so it is **possible**
at least to translate the displayed zones in the *locale* module.
- Branding can now specify whether to (try to) display the Calamares window
in the middle of the desktop or not. The *windowPlacement* key in
`branding.desc` specifies *center* or *free* placement.
## Modules ##
- The *license* module has seen a significant change to its looks.

@ -35,6 +35,12 @@ windowExpanding: normal
# in CalamaresUtilsGui, 800x520.
windowSize: 800px,520px
# Placement of Calamares window. Either "center" or "free".
# Whether "center" actually works does depend on the window
# manager in use (and only makes sense if you're not using
# *windowExpanding* set to "fullscreen").
windowPlacement: center
# These are strings shown to the user in the user interface.
# There is no provision for translating them -- since they
# are names, the string is included as-is.

@ -39,6 +39,7 @@
#include <QDesktopWidget>
#include <QDir>
#include <QFileInfo>
#include <QScreen>
#include <QTimer>
@ -357,6 +358,20 @@ CalamaresApplication::initView()
QTimer::singleShot( 0, m_moduleManager, &Calamares::ModuleManager::loadModules );
if ( Calamares::Branding::instance() && Calamares::Branding::instance()->windowPlacementCentered() )
{
QList< QScreen* > screens = qApp->screens();
QPoint windowCenter = m_mainwindow->rect().center();
for ( const auto* screen : screens )
{
QPoint screenCenter = screen->availableGeometry().center();
if ( ( screenCenter.x() >= windowCenter.x() ) && ( screenCenter.y() >= windowCenter.y() ) )
{
m_mainwindow->move( screenCenter - windowCenter );
break;
}
}
}
cDebug() << "STARTUP: CalamaresWindow created; loadModules started";
}

@ -410,6 +410,9 @@ Branding::initSimpleSettings( const YAML::Node& doc )
{ QStringLiteral( "fullscreen" ), WindowExpansion::Fullscreen },
{ QStringLiteral( "noexpand" ), WindowExpansion::Fixed }
};
static const NamedEnumTable< WindowPlacement > placementNames {
{ QStringLiteral( "free" ), WindowPlacement::Free }, { QStringLiteral( "center" ), WindowPlacement::Center }
};
bool ok = false;
m_welcomeStyleCalamares = doc[ "welcomeStyleCalamares" ].as< bool >( false );
@ -420,6 +423,12 @@ Branding::initSimpleSettings( const YAML::Node& doc )
cWarning() << "Branding module-setting *windowExpanding* interpreted as"
<< expansionNames.find( m_windowExpansion, ok );
}
m_windowPlacement = placementNames.find( getString( doc, "windowPlacement" ), ok );
if ( !ok )
{
cWarning() << "Branding module-setting *windowPlacement* interpreted as"
<< placementNames.find( m_windowPlacement, ok );
}
QString windowSize = getString( doc, "windowSize" );
if ( !windowSize.isEmpty() )

@ -108,6 +108,13 @@ public:
{
}
};
/** @brief Placement of main window.
*/
enum class WindowPlacement
{
Center,
Free
};
static Branding* instance();
@ -162,6 +169,7 @@ public:
{
return QPair< WindowDimension, WindowDimension >( m_windowWidth, m_windowHeight );
}
bool windowPlacementCentered() const { return m_windowPlacement == WindowPlacement::Center; }
/**
* Creates a map called "branding" in the global storage, and inserts an
@ -193,9 +201,10 @@ private:
bool m_welcomeStyleCalamares;
bool m_welcomeExpandingLogo;
WindowExpansion m_windowExpansion;
WindowExpansion m_windowExpansion;
WindowDimension m_windowHeight, m_windowWidth;
WindowPlacement m_windowPlacement;
};
template < typename U >

Loading…
Cancel
Save