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
Q
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
Tobias Hunger
qt-creator
Commits
66aa9db7
Commit
66aa9db7
authored
Feb 24, 2011
by
dt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
QtOptionsPage: Simpler code, remove shared pointer
parent
3c3ebd22
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
24 deletions
+21
-24
src/plugins/qt4projectmanager/qtoptionspage.cpp
src/plugins/qt4projectmanager/qtoptionspage.cpp
+18
-20
src/plugins/qt4projectmanager/qtoptionspage.h
src/plugins/qt4projectmanager/qtoptionspage.h
+3
-4
No files found.
src/plugins/qt4projectmanager/qtoptionspage.cpp
View file @
66aa9db7
...
...
@@ -120,11 +120,7 @@ void QtOptionsPage::apply()
m_widget
->
finish
();
QtVersionManager
*
vm
=
QtVersionManager
::
instance
();
// Turn into flat list
QList
<
QtVersion
*>
versions
;
foreach
(
const
QSharedPointerQtVersion
&
spv
,
m_widget
->
versions
())
versions
.
push_back
(
new
QtVersion
(
*
spv
));
vm
->
setNewQtVersions
(
versions
);
vm
->
setNewQtVersions
(
m_widget
->
versions
());
}
bool
QtOptionsPage
::
matches
(
const
QString
&
s
)
const
...
...
@@ -145,7 +141,7 @@ QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent, QList<QtVersion *> ver
{
// Initialize m_versions
foreach
(
QtVersion
*
version
,
versions
)
m_versions
.
push_back
(
QSharedPointerQtVersion
(
new
QtVersion
(
*
version
)
));
m_versions
.
push_back
(
new
QtVersion
(
*
version
));
QWidget
*
versionInfoWidget
=
new
QWidget
();
m_versionUi
->
setupUi
(
versionInfoWidget
);
...
...
@@ -180,7 +176,7 @@ QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent, QList<QtVersion *> ver
manualItem
->
setFirstColumnSpanned
(
true
);
for
(
int
i
=
0
;
i
<
m_versions
.
count
();
++
i
)
{
const
QtVersion
*
const
version
=
m_versions
.
at
(
i
)
.
data
()
;
const
QtVersion
*
const
version
=
m_versions
.
at
(
i
);
QTreeWidgetItem
*
item
=
new
QTreeWidgetItem
(
version
->
isAutodetected
()
?
autoItem
:
manualItem
);
item
->
setText
(
0
,
version
->
displayName
());
item
->
setText
(
1
,
QDir
::
toNativeSeparators
(
version
->
qmakeCommand
()));
...
...
@@ -258,11 +254,11 @@ QtVersion *QtOptionsPageWidget::currentVersion() const
{
const
int
currentItemIndex
=
currentIndex
();
if
(
currentItemIndex
>=
0
&&
currentItemIndex
<
m_versions
.
size
())
return
m_versions
.
at
(
currentItemIndex
)
.
data
()
;
return
m_versions
.
at
(
currentItemIndex
);
return
0
;
}
static
inline
int
findVersionById
(
const
QList
<
Q
SharedPointerQtVersion
>
&
l
,
int
id
)
static
inline
int
findVersionById
(
const
QList
<
Q
tVersion
*
>
&
l
,
int
id
)
{
const
int
size
=
l
.
size
();
for
(
int
i
=
0
;
i
<
size
;
i
++
)
...
...
@@ -289,7 +285,7 @@ void QtOptionsPageWidget::debuggingHelperBuildFinished(int qtVersionId, Debuggin
item
->
setData
(
0
,
BuildRunningRole
,
QVariant
::
fromValue
(
buildFlags
));
item
->
setData
(
0
,
BuildLogRole
,
output
);
Q
SharedPointerQtVersion
qtVersion
=
m_versions
.
at
(
index
);
Q
tVersion
*
qtVersion
=
m_versions
.
at
(
index
);
bool
success
=
true
;
if
(
tools
&
DebuggingHelperBuildTask
::
GdbDebugging
)
...
...
@@ -323,7 +319,7 @@ void QtOptionsPageWidget::buildDebuggingHelper(DebuggingHelperBuildTask::Tools t
buildFlags
|=
tools
;
item
->
setData
(
0
,
BuildRunningRole
,
QVariant
::
fromValue
(
buildFlags
));
QtVersion
*
version
=
m_versions
.
at
(
index
)
.
data
()
;
QtVersion
*
version
=
m_versions
.
at
(
index
);
if
(
!
version
)
return
;
...
...
@@ -406,11 +402,12 @@ void QtOptionsPageWidget::showDebuggingBuildLog(const QTreeWidgetItem *currentIt
QtOptionsPageWidget
::~
QtOptionsPageWidget
()
{
delete
m_ui
;
qDeleteAll
(
m_versions
);
}
void
QtOptionsPageWidget
::
addQtDir
()
{
Q
SharedPointerQtVersion
newVersion
(
new
QtVersion
(
m_specifyNameString
,
m_specifyPathString
)
);
Q
tVersion
*
newVersion
=
new
QtVersion
(
m_specifyNameString
,
m_specifyPathString
);
m_versions
.
append
(
newVersion
);
QTreeWidgetItem
*
item
=
new
QTreeWidgetItem
(
m_ui
->
qtdirList
->
topLevelItem
(
1
));
...
...
@@ -435,7 +432,9 @@ void QtOptionsPageWidget::removeQtDir()
delete
item
;
QtVersion
*
version
=
m_versions
.
at
(
index
);
m_versions
.
removeAt
(
index
);
delete
version
;
updateState
();
}
...
...
@@ -616,11 +615,11 @@ void QtOptionsPageWidget::showEnvironmentPage(QTreeWidgetItem *item)
return
;
int
index
=
indexForTreeItem
(
item
);
QSharedPointerQtVersion
qtVersion
;
if
(
index
<
0
)
return
;
qtVersion
=
m_versions
.
at
(
index
);
QtVersion
*
qtVersion
=
m_versions
.
at
(
index
);
if
(
!
qtVersion
->
isValid
())
{
m_versionUi
->
errorLabel
->
setText
(
qtVersion
->
invalidReason
());
return
;
...
...
@@ -753,7 +752,7 @@ void QtOptionsPageWidget::updateCurrentQMakeLocation()
int
currentItemIndex
=
indexForTreeItem
(
currentItem
);
if
(
currentItemIndex
<
0
)
return
;
QtVersion
*
version
=
m_versions
.
at
(
currentItemIndex
)
.
data
()
;
QtVersion
*
version
=
m_versions
.
at
(
currentItemIndex
);
QFileInfo
fi
(
m_versionUi
->
qmakePath
->
path
());
if
(
!
fi
.
exists
()
||
!
fi
.
isFile
()
||
version
->
qmakeCommand
()
==
fi
.
absoluteFilePath
())
return
;
...
...
@@ -793,13 +792,12 @@ void QtOptionsPageWidget::updateCurrentSbsV2Directory()
QDir
::
fromNativeSeparators
(
m_versionUi
->
sbsV2Path
->
path
()));
}
QList
<
Q
SharedPointerQtVersion
>
QtOptionsPageWidget
::
versions
()
const
QList
<
Q
tVersion
*
>
QtOptionsPageWidget
::
versions
()
const
{
QList
<
Q
SharedPointerQtVersion
>
result
;
for
(
int
i
=
0
;
i
<
m_versions
.
count
();
++
i
)
{
QList
<
Q
tVersion
*
>
result
;
for
(
int
i
=
0
;
i
<
m_versions
.
count
();
++
i
)
if
(
m_versions
.
at
(
i
)
->
qmakeCommand
()
!=
m_specifyPathString
)
result
.
append
(
m_versions
.
at
(
i
));
}
result
.
append
(
new
QtVersion
(
*
(
m_versions
.
at
(
i
))));
return
result
;
}
...
...
src/plugins/qt4projectmanager/qtoptionspage.h
View file @
66aa9db7
...
...
@@ -50,7 +50,6 @@ QT_END_NAMESPACE
namespace
Qt4ProjectManager
{
class
QtVersion
;
typedef
QSharedPointer
<
QtVersion
>
QSharedPointerQtVersion
;
namespace
Internal
{
namespace
Ui
{
...
...
@@ -66,7 +65,7 @@ class QtOptionsPageWidget : public QWidget
public:
QtOptionsPageWidget
(
QWidget
*
parent
,
QList
<
QtVersion
*>
versions
);
~
QtOptionsPageWidget
();
QList
<
Q
SharedPointerQtVersion
>
versions
()
const
;
QList
<
Q
tVersion
*
>
versions
()
const
;
void
finish
();
QString
searchKeywords
()
const
;
...
...
@@ -86,7 +85,7 @@ private:
Internal
::
Ui
::
QtVersionManager
*
m_ui
;
Internal
::
Ui
::
QtVersionInfo
*
m_versionUi
;
Internal
::
Ui
::
DebuggingHelper
*
m_debuggingHelperUi
;
QList
<
Q
SharedPointerQtVersion
>
m_versions
;
// Passed on to the helper build task, so, use QSharedPointerQtVersion
QList
<
Q
tVersion
*>
m_versions
;
int
m_defaultVersion
;
private
slots
:
...
...
@@ -126,7 +125,7 @@ public:
QIcon
categoryIcon
()
const
;
QWidget
*
createPage
(
QWidget
*
parent
);
void
apply
();
void
finish
()
{
}
void
finish
()
{}
virtual
bool
matches
(
const
QString
&
)
const
;
private:
...
...
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