Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
calamares
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
17
Issues
17
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Applications
calamares
Commits
de5c97af
Commit
de5c97af
authored
Mar 25, 2020
by
Adriaan de Groot
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'milohr-qml-bits'
FIXES #1352
parents
875f79b4
2a93c7e2
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
364 additions
and
266 deletions
+364
-266
src/modules/welcome/CMakeLists.txt
src/modules/welcome/CMakeLists.txt
+0
-2
src/modules/welcome/Config.cpp
src/modules/welcome/Config.cpp
+135
-81
src/modules/welcome/Config.h
src/modules/welcome/Config.h
+54
-48
src/modules/welcome/WelcomePage.cpp
src/modules/welcome/WelcomePage.cpp
+9
-6
src/modules/welcome/WelcomePage.h
src/modules/welcome/WelcomePage.h
+2
-2
src/modules/welcome/WelcomeViewStep.cpp
src/modules/welcome/WelcomeViewStep.cpp
+117
-116
src/modules/welcome/WelcomeViewStep.h
src/modules/welcome/WelcomeViewStep.h
+10
-10
src/modules/welcomeq/WelcomeQmlViewStep.cpp
src/modules/welcomeq/WelcomeQmlViewStep.cpp
+37
-1
No files found.
src/modules/welcome/CMakeLists.txt
View file @
de5c97af
...
...
@@ -12,8 +12,6 @@ else()
add_definitions
(
-DWITHOUT_LIBPARTED
)
endif
()
include_directories
(
${
PROJECT_BINARY_DIR
}
/src/libcalamaresui
)
set
(
CHECKER_SOURCES
checker/CheckerContainer.cpp
checker/GeneralRequirements.cpp
...
...
src/modules/welcome/Config.cpp
View file @
de5c97af
This diff is collapsed.
Click to expand it.
src/modules/welcome/Config.h
View file @
de5c97af
...
...
@@ -19,21 +19,23 @@
#ifndef WELCOME_CONFIG_H
#define WELCOME_CONFIG_H
#include <QObject>
#include <QUrl>
#include "modulesystem/Requirement.h"
#include "locale/LabelModel.h"
#include <QObject>
#include <QUrl>
// TODO: move this (and modulesystem/Requirement) to libcalamares
class
RequirementsModel
:
public
QAbstractListModel
{
Q_OBJECT
using
QAbstractListModel
::
QAbstractListModel
;
Q_PROPERTY
(
bool
satisfiedRequirements
READ
satisfiedRequirements
NOTIFY
satisfiedRequirementsChanged
FINAL
)
Q_PROPERTY
(
bool
satisfiedMandatory
READ
satisfiedMandatory
NOTIFY
satisfiedMandatoryChanged
FINAL
)
Q_PROPERTY
(
bool
satisfiedRequirements
READ
satisfiedRequirements
NOTIFY
satisfiedRequirementsChanged
FINAL
)
Q_PROPERTY
(
bool
satisfiedMandatory
READ
satisfiedMandatory
NOTIFY
satisfiedMandatoryChanged
FINAL
)
Q_PROPERTY
(
QString
warningMessage
READ
warningMessage
NOTIFY
warningMessageChanged
FINAL
)
public:
using
QAbstractListModel
::
QAbstractListModel
;
enum
Roles
:
short
{
Name
,
...
...
@@ -44,90 +46,92 @@ public:
HasDetails
};
bool
satisfiedRequirements
()
const
{
return
m_satisfiedRequirements
;
}
bool
satisfiedRequirements
()
const
{
return
m_satisfiedRequirements
;
}
bool
satisfiedMandatory
()
const
{
return
m_satisfiedMandatory
;
}
bool
satisfiedMandatory
()
const
{
return
m_satisfiedMandatory
;
}
const
Calamares
::
RequirementEntry
&
getEntry
(
const
int
&
index
)
const
const
Calamares
::
RequirementEntry
&
getEntry
(
const
int
&
index
)
const
{
if
(
index
>
count
()
||
index
<
0
)
{
return
*
(
new
Calamares
::
RequirementEntry
()
);
}
if
(
index
>
count
()
||
index
<
0
)
return
*
(
new
Calamares
::
RequirementEntry
());
return
m_requierements
.
at
(
index
);
return
m_requirements
.
at
(
index
);
}
void
setRequirementsList
(
const
Calamares
::
RequirementsList
&
requirements
);
int
rowCount
(
const
QModelIndex
&
)
const
override
;
int
count
()
const
{
return
m_requierements
.
count
();
}
int
rowCount
(
const
QModelIndex
&
)
const
override
;
int
count
()
const
{
return
m_requirements
.
count
();
}
QString
warningMessage
()
const
{
return
m_warningMessage
;
}
QVariant
data
(
const
QModelIndex
&
index
,
int
role
)
const
override
;
void
retranslate
();
QVariant
data
(
const
QModelIndex
&
index
,
int
role
)
const
override
;
protected:
QHash
<
int
,
QByteArray
>
roleNames
()
const
override
;
QHash
<
int
,
QByteArray
>
roleNames
()
const
override
;
private:
Calamares
::
RequirementsList
m_requi
e
rements
;
Calamares
::
RequirementsList
m_requirements
;
bool
m_satisfiedRequirements
=
false
;
bool
m_satisfiedMandatory
=
false
;
QString
m_warningMessage
;
signals:
void
satisfiedRequirementsChanged
(
bool
value
);
void
satisfiedRequirementsChanged
(
bool
value
);
void
satisfiedMandatoryChanged
();
void
warningMessageChanged
();
};
class
Config
:
public
QObject
{
Q_OBJECT
Q_PROPERTY
(
CalamaresUtils
::
Locale
::
LabelModel
*
languagesModel
READ
languagesModel
CONSTANT
FINAL
)
Q_PROPERTY
(
CalamaresUtils
::
Locale
::
LabelModel
*
languagesModel
READ
languagesModel
CONSTANT
FINAL
)
Q_PROPERTY
(
RequirementsModel
*
requirementsModel
MEMBER
m_requirementsModel
CONSTANT
FINAL
)
Q_PROPERTY
(
QString
languageIcon
READ
languageIcon
CONSTANT
FINAL
)
Q_PROPERTY
(
QString
countryCode
MEMBER
m_countryCode
NOTIFY
countryCodeChanged
FINAL
)
Q_PROPERTY
(
int
localeIndex
READ
localeIndex
WRITE
setLocaleIndex
NOTIFY
localeIndexChanged
)
Q_PROPERTY
(
int
localeIndex
READ
localeIndex
WRITE
setLocaleIndex
NOTIFY
localeIndexChanged
)
Q_PROPERTY
(
QString
genericWelcomeMessage
MEMBER
m_genericWelcomeMessage
NOTIFY
genericWelcomeMessageChanged
FINAL
)
Q_PROPERTY
(
QString
warningMessage
MEMBER
m_warningMessage
CONSTANT
FINAL
)
Q_PROPERTY
(
QString
supportUrl
MEMBER
m_supportUrl
CONSTANT
FINAL
)
Q_PROPERTY
(
QString
knownIssuesUrl
MEMBER
m_knownIssuesUrl
CONSTANT
FINAL
)
Q_PROPERTY
(
QString
releaseNotesUrl
MEMBER
m_releaseNotesUrl
CONSTANT
FINAL
)
Q_PROPERTY
(
QString
donateUrl
MEMBER
m_donateUrl
CONSTANT
FINAL
)
Q_PROPERTY
(
QString
supportUrl
MEMBER
m_supportUrl
NOTIFY
supportUrlChanged
FINAL
)
Q_PROPERTY
(
QString
knownIssuesUrl
MEMBER
m_knownIssuesUrl
NOTIFY
knownIssuesUrlChanged
FINAL
)
Q_PROPERTY
(
QString
releaseNotesUrl
MEMBER
m_releaseNotesUrl
NOTIFY
releaseNotesUrlChanged
FINAL
)
Q_PROPERTY
(
QString
donateUrl
MEMBER
m_donateUrl
NOTIFY
donateUrlChanged
FINAL
)
Q_PROPERTY
(
bool
isNextEnabled
MEMBER
m_isNextEnabled
NOTIFY
isNextEnabledChanged
FINAL
)
public:
Config
(
QObject
*
parent
=
nullptr
);
void
setCountryCode
(
const
QString
&
countryCode
);
void
setLanguageIcon
(
const
QString
&
languageIcon
);
RequirementsModel
&
requirementsModel
()
const
;
void
setCountryCode
(
const
QString
&
countryCode
);
void
setLanguageIcon
(
const
QString
&
languageIcon
);
RequirementsModel
&
requirementsModel
()
const
;
void
setIsNextEnabled
(
const
bool
&
isNextEnabled
);
void
setLocaleIndex
(
const
int
&
index
);
void
setLocaleIndex
(
const
int
&
index
);
int
localeIndex
()
const
{
return
m_localeIndex
;
}
QString
supportUrl
()
const
;
void
setSupportUrl
(
const
QString
&
url
);
void
setSupportUrl
(
const
QString
&
url
);
QString
knownIssuesUrl
()
const
;
void
setKnownIssuesUrl
(
const
QString
&
url
);
void
setKnownIssuesUrl
(
const
QString
&
url
);
QString
releaseNotesUrl
()
const
;
void
setReleaseNotesUrl
(
const
QString
&
url
);
void
setReleaseNotesUrl
(
const
QString
&
url
);
QString
donateUrl
()
const
;
void
setDonateUrl
(
const
QString
&
url
);
void
setDonateUrl
(
const
QString
&
url
);
QString
genericWelcomeMessage
();
public
slots
:
CalamaresUtils
::
Locale
::
LabelModel
*
languagesModel
()
const
;
...
...
@@ -144,9 +148,7 @@ private:
bool
m_isNextEnabled
=
false
;
CalamaresUtils
::
Locale
::
LabelModel
*
m_languages
;
QString
m_genericWelcomeMessage
=
tr
(
"This program will ask you some questions and set up your installation"
);
QString
m_warningMessage
=
tr
(
"This program does not satisfy the minimum requirements for installing.
\n
Installation can not continue"
);
QString
m_genericWelcomeMessage
;
QString
m_supportUrl
;
QString
m_knownIssuesUrl
;
...
...
@@ -158,6 +160,10 @@ signals:
void
localeIndexChanged
(
int
localeIndex
);
void
isNextEnabledChanged
(
bool
isNextEnabled
);
void
genericWelcomeMessageChanged
();
void
supportUrlChanged
();
void
knownIssuesUrlChanged
();
void
releaseNotesUrlChanged
();
void
donateUrlChanged
();
};
#endif
src/modules/welcome/WelcomePage.cpp
View file @
de5c97af
...
...
@@ -25,9 +25,9 @@
#include "Branding.h"
#include "CalamaresVersion.h"
#include "Config.h"
#include "Settings.h"
#include "ViewManager.h"
#include "Config.h"
#include "locale/LabelModel.h"
#include "modulesystem/ModuleManager.h"
...
...
@@ -44,7 +44,7 @@
#include <QLabel>
#include <QMessageBox>
WelcomePage
::
WelcomePage
(
Config
*
conf
,
QWidget
*
parent
)
WelcomePage
::
WelcomePage
(
Config
*
conf
,
QWidget
*
parent
)
:
QWidget
(
parent
)
,
ui
(
new
Ui
::
WelcomePage
)
,
m_checkingWidget
(
new
CheckerContainer
(
conf
->
requirementsModel
(),
this
)
)
...
...
@@ -84,13 +84,14 @@ WelcomePage::WelcomePage( Config *conf, QWidget* parent )
ui
->
verticalLayout
->
insertWidget
(
welcome_text_idx
+
1
,
m_checkingWidget
);
}
void
WelcomePage
::
init
()
void
WelcomePage
::
init
()
{
//setup the url buttons
setupButton
(
WelcomePage
::
Button
::
Support
,
m_conf
->
supportUrl
());
setupButton
(
WelcomePage
::
Button
::
Support
,
m_conf
->
supportUrl
()
);
setupButton
(
WelcomePage
::
Button
::
KnownIssues
,
m_conf
->
knownIssuesUrl
()
);
setupButton
(
WelcomePage
::
Button
::
ReleaseNotes
,
m_conf
->
releaseNotesUrl
()
);
setupButton
(
WelcomePage
::
Button
::
Donate
,
m_conf
->
donateUrl
());
setupButton
(
WelcomePage
::
Button
::
Donate
,
m_conf
->
donateUrl
()
);
//language icon
auto
icon
=
Calamares
::
Branding
::
instance
()
->
image
(
m_conf
->
languageIcon
(),
QSize
(
48
,
48
)
);
...
...
@@ -113,7 +114,9 @@ WelcomePage::initLanguages()
ui
->
languageWidget
->
setCurrentIndex
(
m_conf
->
localeIndex
()
);
connect
(
ui
->
languageWidget
,
static_cast
<
void
(
QComboBox
::*
)(
int
)
>
(
&
QComboBox
::
currentIndexChanged
),
m_conf
,
&
Config
::
setLocaleIndex
);
static_cast
<
void
(
QComboBox
::*
)(
int
)
>
(
&
QComboBox
::
currentIndexChanged
),
m_conf
,
&
Config
::
setLocaleIndex
);
}
void
...
...
src/modules/welcome/WelcomePage.h
View file @
de5c97af
...
...
@@ -36,7 +36,7 @@ class WelcomePage : public QWidget
{
Q_OBJECT
public:
explicit
WelcomePage
(
Config
*
conf
,
QWidget
*
parent
=
nullptr
);
explicit
WelcomePage
(
Config
*
conf
,
QWidget
*
parent
=
nullptr
);
enum
class
Button
{
...
...
@@ -75,7 +75,7 @@ private:
CheckerContainer
*
m_checkingWidget
;
CalamaresUtils
::
Locale
::
LabelModel
*
m_languages
;
Config
*
m_conf
;
Config
*
m_conf
;
};
/** @brief Delegate to display language information in two columns.
...
...
src/modules/welcome/WelcomeViewStep.cpp
View file @
de5c97af
...
...
@@ -18,92 +18,91 @@
*/
#include "WelcomeViewStep.h"
#include "Config.h"
#include "Config.h"
#include "WelcomePage.h"
#include "checker/GeneralRequirements.h"
#include "Branding.h"
#include "geoip/Handler.h"
#include "locale/Lookup.h"
#include "modulesystem/ModuleManager.h"
#include "utils/Logger.h"
#include "utils/Variant.h"
#include "Branding.h"
#include "modulesystem/ModuleManager.h"
#include <QFutureWatcher>
#include <QVariant>
CALAMARES_PLUGIN_FACTORY_DEFINITION
(
WelcomeViewStepFactory
,
registerPlugin
<
WelcomeViewStep
>
();
)
WelcomeViewStep
::
WelcomeViewStep
(
QObject
*
parent
)
:
Calamares
::
ViewStep
(
parent
)
,
m_requirementsChecker
(
new
GeneralRequirements
(
this
)
)
,
m_conf
(
new
Config
(
this
)
)
:
Calamares
::
ViewStep
(
parent
)
,
m_requirementsChecker
(
new
GeneralRequirements
(
this
)
)
,
m_conf
(
new
Config
(
this
)
)
{
connect
(
Calamares
::
ModuleManager
::
instance
(),
&
Calamares
::
ModuleManager
::
requirementsComplete
,
this
,
&
WelcomeViewStep
::
nextStatusChanged
);
connect
(
Calamares
::
ModuleManager
::
instance
(),
&
Calamares
::
ModuleManager
::
requirementsComplete
,
this
,
&
WelcomeViewStep
::
nextStatusChanged
);
// the instance of the qqc2 or qwidgets page
m_widget
=
new
WelcomePage
(
m_conf
);
m_widget
=
new
WelcomePage
(
m_conf
);
}
WelcomeViewStep
::~
WelcomeViewStep
()
{
if
(
m_widget
&&
m_widget
->
parent
()
==
nullptr
)
{
m_widget
->
deleteLater
();
}
if
(
m_widget
&&
m_widget
->
parent
()
==
nullptr
)
{
m_widget
->
deleteLater
();
}
}
QString
WelcomeViewStep
::
prettyName
()
const
{
return
tr
(
"Welcome"
);
return
tr
(
"Welcome"
);
}
QWidget
*
WelcomeViewStep
::
widget
()
{
return
m_widget
;
return
m_widget
;
}
bool
WelcomeViewStep
::
isNextEnabled
()
const
{
return
m_widget
->
verdict
();
return
m_widget
->
verdict
();
}
bool
WelcomeViewStep
::
isBackEnabled
()
const
{
return
false
;
return
false
;
}
bool
WelcomeViewStep
::
isAtBeginning
()
const
{
return
true
;
return
true
;
}
bool
WelcomeViewStep
::
isAtEnd
()
const
{
return
true
;
return
true
;
}
Calamares
::
JobList
WelcomeViewStep
::
jobs
()
const
{
return
Calamares
::
JobList
();
return
Calamares
::
JobList
();
}
...
...
@@ -122,125 +121,127 @@ WelcomeViewStep::jobs() const
static
QString
jobOrBrandingSetting
(
Calamares
::
Branding
::
StringEntry
e
,
const
QVariantMap
&
map
,
const
QString
&
key
)
{
if
(
!
map
.
contains
(
key
)
)
{
return
QString
();
}
auto
v
=
map
.
value
(
key
);
if
(
v
.
type
()
==
QVariant
::
Bool
)
{
return
v
.
toBool
()
?
(
*
e
)
:
QString
();
}
if
(
v
.
type
()
==
QVariant
::
String
)
{
return
v
.
toString
();
}
return
QString
();
if
(
!
map
.
contains
(
key
)
)
{
return
QString
();
}
auto
v
=
map
.
value
(
key
);
if
(
v
.
type
()
==
QVariant
::
Bool
)
{
return
v
.
toBool
()
?
(
*
e
)
:
QString
();
}
if
(
v
.
type
()
==
QVariant
::
String
)
{
return
v
.
toString
();
}
return
QString
();
}
void
WelcomeViewStep
::
setConfigurationMap
(
const
QVariantMap
&
configurationMap
)
{
using
Calamares
::
Branding
;
using
Calamares
::
Branding
;
m_conf
->
setSupportUrl
(
jobOrBrandingSetting
(
Branding
::
SupportUrl
,
configurationMap
,
"showSupportUrl"
)
);
m_conf
->
setKnownIssuesUrl
(
jobOrBrandingSetting
(
Branding
::
KnownIssuesUrl
,
configurationMap
,
"showKnownIssuesUrl"
)
);
m_conf
->
setReleaseNotesUrl
(
jobOrBrandingSetting
(
Branding
::
ReleaseNotesUrl
,
configurationMap
,
"showReleaseNotesUrl"
)
);
m_conf
->
setDonateUrl
(
CalamaresUtils
::
getString
(
configurationMap
,
"showDonateUrl"
)
);
m_conf
->
setSupportUrl
(
jobOrBrandingSetting
(
Branding
::
SupportUrl
,
configurationMap
,
"showSupportUrl"
)
);
m_conf
->
setKnownIssuesUrl
(
jobOrBrandingSetting
(
Branding
::
KnownIssuesUrl
,
configurationMap
,
"showKnownIssuesUrl"
)
);
m_conf
->
setReleaseNotesUrl
(
jobOrBrandingSetting
(
Branding
::
ReleaseNotesUrl
,
configurationMap
,
"showReleaseNotesUrl"
)
);
m_conf
->
setDonateUrl
(
CalamaresUtils
::
getString
(
configurationMap
,
"showDonateUrl"
)
);
if
(
configurationMap
.
contains
(
"requirements"
)
&&
configurationMap
.
value
(
"requirements"
).
type
()
==
QVariant
::
Map
)
{
m_requirementsChecker
->
setConfigurationMap
(
configurationMap
.
value
(
"requirements"
).
toMap
()
);
if
(
configurationMap
.
contains
(
"requirements"
)
&&
configurationMap
.
value
(
"requirements"
).
type
()
==
QVariant
::
Map
)
{
m_requirementsChecker
->
setConfigurationMap
(
configurationMap
.
value
(
"requirements"
).
toMap
()
);
m_conf
->
requirementsModel
().
setRequirementsList
(
checkRequirements
()
);
}
else
cWarning
()
<<
"no valid requirements map found in welcome "
"module configuration."
;
bool
ok
=
false
;
QVariantMap
geoip
=
CalamaresUtils
::
getSubMap
(
configurationMap
,
"geoip"
,
ok
);
if
(
ok
)
{
using
FWString
=
QFutureWatcher
<
QString
>
;
auto
*
handler
=
new
CalamaresUtils
::
GeoIP
::
Handler
(
CalamaresUtils
::
getString
(
geoip
,
"style"
),
CalamaresUtils
::
getString
(
geoip
,
"url"
),
CalamaresUtils
::
getString
(
geoip
,
"selector"
)
);
if
(
handler
->
type
()
!=
CalamaresUtils
::
GeoIP
::
Handler
::
Type
::
None
)
{
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
;
}
}
QString
language
=
CalamaresUtils
::
getString
(
configurationMap
,
"languageIcon"
);
if
(
!
language
.
isEmpty
()
)
{
}
else
cWarning
()
<<
"no valid requirements map found in welcome "
"module configuration."
;
bool
ok
=
false
;
QVariantMap
geoip
=
CalamaresUtils
::
getSubMap
(
configurationMap
,
"geoip"
,
ok
);
if
(
ok
)
{
using
FWString
=
QFutureWatcher
<
QString
>
;
auto
*
handler
=
new
CalamaresUtils
::
GeoIP
::
Handler
(
CalamaresUtils
::
getString
(
geoip
,
"style"
),
CalamaresUtils
::
getString
(
geoip
,
"url"
),
CalamaresUtils
::
getString
(
geoip
,
"selector"
)
);
if
(
handler
->
type
()
!=
CalamaresUtils
::
GeoIP
::
Handler
::
Type
::
None
)
{
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
;
}
}
QString
language
=
CalamaresUtils
::
getString
(
configurationMap
,
"languageIcon"
);
if
(
!
language
.
isEmpty
()
)
{
m_conf
->
setLanguageIcon
(
language
);
}
}
//here init the qml or qwidgets needed bits
m_widget
->
init
();
//here init the qml or qwidgets needed bits
m_widget
->
init
();
}
Calamares
::
RequirementsList
WelcomeViewStep
::
checkRequirements
()
{
return
m_requirementsChecker
->
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
()
<<
')'
;
}
if
(
handler
)
{
cDebug
()
<<
Logger
::
SubEntry
<<
"Obtained from"
<<
handler
->
url
()
<<
" ("
<<
static_cast
<
int
>
(
handler
->
type
()
)
<<
handler
->
selector
()
<<
')'
;
}
}
void
WelcomeViewStep
::
setCountry
(
const
QString
&
countryCode
,
CalamaresUtils
::
GeoIP
::
Handler
*
handler
)
{
if
(
countryCode
.
length
()
!=
2
)
{
cDebug
()
<<
"Unusable country code"
<<
countryCode
;
logGeoIPHandler
(
handler
);
return
;
}
auto
c_l
=
CalamaresUtils
::
Locale
::
countryData
(
countryCode
);
if
(
c_l
.
first
==
QLocale
::
Country
::
AnyCountry
)
{
cDebug
()
<<
"Unusable country code"
<<
countryCode
;
logGeoIPHandler
(
handler
);
return
;
}
else
{
int
r
=
CalamaresUtils
::
Locale
::
availableTranslations
()
->
find
(
countryCode
);
if
(
r
<
0
)
{
cDebug
()
<<
"Unusable country code"
<<
countryCode
<<
"(no suitable translation)"
;
}
if
(
(
r
>=
0
)
&&
m_conf
)
{
if
(
countryCode
.
length
()
!=
2
)
{
cDebug
()
<<
"Unusable country code"
<<
countryCode
;
logGeoIPHandler
(
handler
);
return
;
}
auto
c_l
=
CalamaresUtils
::
Locale
::
countryData
(
countryCode
);
if
(
c_l
.
first
==
QLocale
::
Country
::
AnyCountry
)
{
cDebug
()
<<
"Unusable country code"
<<
countryCode
;
logGeoIPHandler
(
handler
);
return
;
}
else
{
int
r
=
CalamaresUtils
::
Locale
::
availableTranslations
()
->
find
(
countryCode
);
if
(
r
<
0
)
{
cDebug
()
<<
"Unusable country code"
<<
countryCode
<<
"(no suitable translation)"
;
}
if
(
(
r
>=
0
)
&&
m_conf
)
{
m_conf
->
setCountryCode
(
countryCode
);
}
}
}
}
src/modules/welcome/WelcomeViewStep.h
View file @
de5c97af
...
...
@@ -16,22 +16,22 @@
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef WELCOME
PAGEPLUGIN
_H
#define WELCOME
PAGEPLUGIN
_H
#ifndef WELCOME
VIEWSTEP
_H
#define WELCOME
VIEWSTEP
_H
#include <QObject>
#include <modulesystem/Requirement.h>
#include <utils/PluginFactory.h>
#include <viewpages/ViewStep.h>
#include <DllMacro.h>
#include "DllMacro.h"
#include "modulesystem/Requirement.h"
#include "utils/PluginFactory.h"
#include "viewpages/ViewStep.h"
#include <QObject>
#include <QVariantMap>
class
WelcomePage
;
class
GeneralRequirements
;
class
Config
;
namespace
CalamaresUtils
{
namespace
GeoIP
...
...
@@ -75,9 +75,9 @@ public:
private:
WelcomePage
*
m_widget
;