Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
flatpak-qt-creator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
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
Marco Bubke
flatpak-qt-creator
Commits
b44efd09
Commit
b44efd09
authored
Aug 13, 2010
by
Friedemann Kleint
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Custom wizard: Add boolean 'enabled' attribute to <wizard>.
Reviewed-by:
Kai Koehne
<
kai.koehne@nokia.com
>
parent
ae55b43c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
18 deletions
+34
-18
src/plugins/projectexplorer/customwizard/customwizard.cpp
src/plugins/projectexplorer/customwizard/customwizard.cpp
+7
-2
src/plugins/projectexplorer/customwizard/customwizardparameters.cpp
...s/projectexplorer/customwizard/customwizardparameters.cpp
+21
-12
src/plugins/projectexplorer/customwizard/customwizardparameters.h
...ins/projectexplorer/customwizard/customwizardparameters.h
+6
-4
No files found.
src/plugins/projectexplorer/customwizard/customwizard.cpp
View file @
b44efd09
...
...
@@ -331,13 +331,18 @@ QList<CustomWizard*> CustomWizard::createWizards()
if
(
dir
.
exists
(
configFile
))
{
CustomWizardParametersPtr
parameters
(
new
Internal
::
CustomWizardParameters
);
Core
::
BaseFileWizardParameters
baseFileParameters
;
if
(
parameters
->
parse
(
dir
.
absoluteFilePath
(
configFile
),
&
baseFileParameters
,
&
errorMessage
))
{
switch
(
parameters
->
parse
(
dir
.
absoluteFilePath
(
configFile
),
&
baseFileParameters
,
&
errorMessage
))
{
case
Internal
::
CustomWizardParameters
::
ParseOk
:
parameters
->
directory
=
dir
.
absolutePath
();
if
(
CustomWizardPrivate
::
verbose
)
verboseLog
+=
parameters
->
toString
();
if
(
CustomWizard
*
w
=
createWizard
(
parameters
,
baseFileParameters
))
rc
.
push_back
(
w
);
}
else
{
case
Internal
::
CustomWizardParameters
::
ParseDisabled
:
if
(
CustomWizardPrivate
::
verbose
)
qWarning
(
"Ignoring disabled wizard %s..."
,
qPrintable
(
dir
.
absolutePath
()));
break
;
case
Internal
::
CustomWizardParameters
::
ParseFailed
:
qWarning
(
"Failed to initialize custom project wizard in %s: %s"
,
qPrintable
(
dir
.
absolutePath
()),
qPrintable
(
errorMessage
));
}
...
...
src/plugins/projectexplorer/customwizard/customwizardparameters.cpp
View file @
b44efd09
...
...
@@ -48,6 +48,7 @@ static const char customWizardElementC[] = "wizard";
static
const
char
iconElementC
[]
=
"icon"
;
static
const
char
descriptionElementC
[]
=
"description"
;
static
const
char
displayNameElementC
[]
=
"displayname"
;
static
const
char
wizardEnabledAttributeC
[]
=
"enabled"
;
static
const
char
idAttributeC
[]
=
"id"
;
static
const
char
kindAttributeC
[]
=
"kind"
;
static
const
char
klassAttributeC
[]
=
"class"
;
...
...
@@ -329,9 +330,13 @@ static inline QString msgError(const QXmlStreamReader &reader,
arg
(
fileName
).
arg
(
reader
.
lineNumber
()).
arg
(
reader
.
columnNumber
()).
arg
(
what
);
}
static
inline
bool
booleanAttributeValue
(
const
QXmlStreamReader
&
r
,
const
char
*
name
)
static
inline
bool
booleanAttributeValue
(
const
QXmlStreamReader
&
r
,
const
char
*
nameC
,
bool
defaultValue
)
{
return
r
.
attributes
().
value
(
QLatin1String
(
name
))
==
QLatin1String
(
"true"
);
const
QStringRef
attributeValue
=
r
.
attributes
().
value
(
QLatin1String
(
nameC
));
if
(
attributeValue
.
isEmpty
())
return
defaultValue
;
return
attributeValue
==
QLatin1String
(
"true"
);
}
static
inline
int
integerAttributeValue
(
const
QXmlStreamReader
&
r
,
const
char
*
name
,
int
defaultValue
)
...
...
@@ -368,7 +373,8 @@ static inline QString localeLanguage()
}
// Main parsing routine
bool
CustomWizardParameters
::
parse
(
QIODevice
&
device
,
CustomWizardParameters
::
ParseResult
CustomWizardParameters
::
parse
(
QIODevice
&
device
,
const
QString
&
configFileFullPath
,
Core
::
BaseFileWizardParameters
*
bp
,
QString
*
errorMessage
)
...
...
@@ -386,7 +392,7 @@ bool CustomWizardParameters::parse(QIODevice &device,
switch
(
token
)
{
case
QXmlStreamReader
::
Invalid
:
*
errorMessage
=
msgError
(
reader
,
configFileFullPath
,
reader
.
errorString
());
return
false
;
return
ParseFailed
;
case
QXmlStreamReader
::
StartElement
:
do
{
// Read out subelements applicable to current state
...
...
@@ -401,8 +407,10 @@ bool CustomWizardParameters::parse(QIODevice &device,
case
ParseError
:
*
errorMessage
=
msgError
(
reader
,
configFileFullPath
,
QString
::
fromLatin1
(
"Unexpected start element %1"
).
arg
(
reader
.
name
().
toString
()));
return
false
;
return
ParseFailed
;
case
ParseWithinWizard
:
if
(
!
booleanAttributeValue
(
reader
,
wizardEnabledAttributeC
,
true
))
return
ParseDisabled
;
bp
->
setId
(
attributeValue
(
reader
,
idAttributeC
));
bp
->
setCategory
(
attributeValue
(
reader
,
categoryAttributeC
));
bp
->
setKind
(
kindAttribute
(
reader
));
...
...
@@ -411,14 +419,14 @@ bool CustomWizardParameters::parse(QIODevice &device,
break
;
case
ParseWithinField
:
// field attribute
field
.
name
=
attributeValue
(
reader
,
fieldNameAttributeC
);
field
.
mandatory
=
booleanAttributeValue
(
reader
,
fieldMandatoryAttributeC
);
field
.
mandatory
=
booleanAttributeValue
(
reader
,
fieldMandatoryAttributeC
,
false
);
break
;
case
ParseWithinFile
:
{
// file attribute
CustomWizardFile
file
;
file
.
source
=
attributeValue
(
reader
,
fileNameSourceAttributeC
);
file
.
target
=
attributeValue
(
reader
,
fileNameTargetAttributeC
);
file
.
openEditor
=
booleanAttributeValue
(
reader
,
fileNameOpenEditorAttributeC
);
file
.
openProject
=
booleanAttributeValue
(
reader
,
fileNameOpenProjectAttributeC
);
file
.
openEditor
=
booleanAttributeValue
(
reader
,
fileNameOpenEditorAttributeC
,
false
);
file
.
openProject
=
booleanAttributeValue
(
reader
,
fileNameOpenProjectAttributeC
,
false
);
if
(
file
.
target
.
isEmpty
())
file
.
target
=
file
.
source
;
if
(
file
.
source
.
isEmpty
())
{
...
...
@@ -438,7 +446,7 @@ bool CustomWizardParameters::parse(QIODevice &device,
if
(
state
==
ParseError
)
{
*
errorMessage
=
msgError
(
reader
,
configFileFullPath
,
QString
::
fromLatin1
(
"Unexpected end element %1"
).
arg
(
reader
.
name
().
toString
()));
return
false
;
return
ParseFailed
;
}
if
(
state
==
ParseWithinFields
)
{
// Leaving a field element
fields
.
push_back
(
field
);
...
...
@@ -449,17 +457,18 @@ bool CustomWizardParameters::parse(QIODevice &device,
break
;
}
}
while
(
token
!=
QXmlStreamReader
::
EndDocument
);
return
true
;
return
ParseOk
;
}
bool
CustomWizardParameters
::
parse
(
const
QString
&
configFileFullPath
,
CustomWizardParameters
::
ParseResult
CustomWizardParameters
::
parse
(
const
QString
&
configFileFullPath
,
Core
::
BaseFileWizardParameters
*
bp
,
QString
*
errorMessage
)
{
QFile
configFile
(
configFileFullPath
);
if
(
!
configFile
.
open
(
QIODevice
::
ReadOnly
|
QIODevice
::
Text
))
{
*
errorMessage
=
QString
::
fromLatin1
(
"Cannot open %1: %2"
).
arg
(
configFileFullPath
,
configFile
.
errorString
());
return
false
;
return
ParseFailed
;
}
return
parse
(
configFile
,
configFileFullPath
,
bp
,
errorMessage
);
}
...
...
src/plugins/projectexplorer/customwizard/customwizardparameters.h
View file @
b44efd09
...
...
@@ -67,11 +67,13 @@ struct CustomWizardFile {
struct
CustomWizardParameters
{
public:
enum
ParseResult
{
ParseOk
,
ParseDisabled
,
ParseFailed
};
CustomWizardParameters
();
void
clear
();
bool
parse
(
QIODevice
&
device
,
const
QString
&
configFileFullPath
,
ParseResult
parse
(
QIODevice
&
device
,
const
QString
&
configFileFullPath
,
Core
::
BaseFileWizardParameters
*
bp
,
QString
*
errorMessage
);
bool
parse
(
const
QString
&
configFileFullPath
,
ParseResult
parse
(
const
QString
&
configFileFullPath
,
Core
::
BaseFileWizardParameters
*
bp
,
QString
*
errorMessage
);
QString
toString
()
const
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment