Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
qt-creator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tobias Hunger
qt-creator
Commits
15ef6ad0
Commit
15ef6ad0
authored
13 years ago
by
Friedemann Kleint
Browse files
Options
Downloads
Patches
Plain Diff
Designer: Use core settings instead of keeping QSettings instance.
parent
5cfb1941
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/plugins/designer/settingsmanager.cpp
+33
-17
33 additions, 17 deletions
src/plugins/designer/settingsmanager.cpp
src/plugins/designer/settingsmanager.h
+1
-3
1 addition, 3 deletions
src/plugins/designer/settingsmanager.h
with
34 additions
and
20 deletions
src/plugins/designer/settingsmanager.cpp
+
33
−
17
View file @
15ef6ad0
...
...
@@ -33,53 +33,69 @@
#include
"settingsmanager.h"
#include
"designerconstants.h"
#include
<coreplugin/icore.h>
#include
<utils/qtcassert.h>
#include
<QtCore/QSettings>
#include
<QtCore/QDebug>
using
namespace
Designer
::
Internal
;
static
inline
QSettings
*
coreSettings
()
{
if
(
const
Core
::
ICore
*
core
=
Core
::
ICore
::
instance
())
return
core
->
settings
();
return
0
;
}
void
SettingsManager
::
beginGroup
(
const
QString
&
prefix
)
{
if
(
Designer
::
Constants
::
Internal
::
debug
>
1
)
qDebug
()
<<
Q_FUNC_INFO
<<
addPrefix
(
prefix
);
m_
settings
.
beginGroup
(
addPrefix
(
prefix
));
QSettings
*
settings
=
coreSettings
();
QTC_ASSERT
(
settings
,
return
;
)
settings
->
beginGroup
(
addPrefix
(
prefix
));
}
void
SettingsManager
::
endGroup
()
{
if
(
Designer
::
Constants
::
Internal
::
debug
>
1
)
qDebug
()
<<
Q_FUNC_INFO
;
m_
settings
.
endGroup
();
QSettings
*
settings
=
coreSettings
();
QTC_ASSERT
(
settings
,
return
;
)
settings
->
endGroup
();
}
bool
SettingsManager
::
contains
(
const
QString
&
key
)
const
{
return
m_settings
.
contains
(
addPrefix
(
key
));
const
QSettings
*
settings
=
coreSettings
();
QTC_ASSERT
(
settings
,
return
false
;
)
return
settings
->
contains
(
addPrefix
(
key
));
}
void
SettingsManager
::
setValue
(
const
QString
&
key
,
const
QVariant
&
value
)
{
if
(
Designer
::
Constants
::
Internal
::
debug
>
1
)
qDebug
()
<<
Q_FUNC_INFO
<<
addPrefix
(
key
)
<<
": "
<<
value
;
m_
settings
.
setValue
(
addPrefix
(
key
),
value
);
QSettings
*
settings
=
coreSettings
();
QTC_ASSERT
(
settings
,
return
;
)
settings
->
setValue
(
addPrefix
(
key
),
value
);
}
QVariant
SettingsManager
::
value
(
const
QString
&
key
,
const
QVariant
&
defaultValue
)
const
{
QVariant
result
=
m_settings
.
value
(
addPrefix
(
key
),
defaultValue
);
if
(
Designer
::
Constants
::
Internal
::
debug
>
1
)
qDebug
()
<<
Q_FUNC_INFO
<<
addPrefix
(
key
)
<<
": "
<<
result
;
return
result
;
const
QSettings
*
settings
=
coreSettings
();
QTC_ASSERT
(
settings
,
return
QVariant
();
)
return
settings
->
value
(
addPrefix
(
key
),
defaultValue
);
}
void
SettingsManager
::
remove
(
const
QString
&
key
)
{
m_settings
.
remove
(
addPrefix
(
key
));
QSettings
*
settings
=
coreSettings
();
QTC_ASSERT
(
settings
,
return
;
)
settings
->
remove
(
addPrefix
(
key
));
}
QString
SettingsManager
::
addPrefix
(
const
QString
&
name
)
const
{
const
QSettings
*
settings
=
coreSettings
();
QTC_ASSERT
(
settings
,
return
name
;
)
QString
result
=
name
;
if
(
m_
settings
.
group
().
isEmpty
())
result
.
insert
(
0
,
QLatin1String
(
"Designer"
));
if
(
settings
->
group
().
isEmpty
())
result
.
prepend
(
QLatin1String
(
"Designer"
));
return
result
;
}
This diff is collapsed.
Click to expand it.
src/plugins/designer/settingsmanager.h
+
1
−
3
View file @
15ef6ad0
...
...
@@ -34,7 +34,6 @@
#define SETTINGSMANAGER_H
#include
"qt_private/abstractsettings_p.h"
#include
<QtCore/QSettings>
namespace
Designer
{
namespace
Internal
{
...
...
@@ -50,12 +49,11 @@ public:
virtual
bool
contains
(
const
QString
&
key
)
const
;
virtual
void
setValue
(
const
QString
&
key
,
const
QVariant
&
value
);
virtual
QVariant
value
(
const
QString
&
key
,
const
QVariant
&
defaultValue
=
QVariant
())
const
;
virtual
QVariant
value
(
const
QString
&
key
,
const
QVariant
&
defaultValue
=
QVariant
())
const
;
virtual
void
remove
(
const
QString
&
key
);
private:
QString
addPrefix
(
const
QString
&
name
)
const
;
QSettings
m_settings
;
};
}
// namespace Internal
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment