Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
libkscreen
Commits
c64d67a2
Commit
c64d67a2
authored
Apr 03, 2021
by
Méven Car
Browse files
Port Away from Qt Keywords
Those are deprecated.
parent
8615b0b1
Changes
20
Hide whitespace changes
Inline
Side-by-side
autotests/testkwaylandbackend.cpp
View file @
c64d67a2
...
...
@@ -115,7 +115,7 @@ void testWaylandBackend::verifyScreen()
void
testWaylandBackend
::
verifyOutputs
()
{
bool
primaryFound
=
false
;
Q_FOREACH
(
const
KScreen
::
OutputPtr
op
,
m_config
->
outputs
())
{
for
(
const
KScreen
::
OutputPtr
op
:
m_config
->
outputs
())
{
if
(
op
->
isPrimary
())
{
primaryFound
=
true
;
}
...
...
@@ -130,7 +130,7 @@ void testWaylandBackend::verifyOutputs()
QVERIFY
(
primary
->
isConnected
());
QList
<
int
>
ids
;
Q_FOREACH
(
const
auto
&
output
,
m_config
->
outputs
())
{
for
(
const
auto
&
output
:
m_config
->
outputs
())
{
QVERIFY
(
!
output
->
name
().
isEmpty
());
QVERIFY
(
output
->
id
()
>
-
1
);
QVERIFY
(
output
->
isConnected
());
...
...
@@ -151,8 +151,8 @@ void testWaylandBackend::verifyModes()
QVERIFY
(
primary
);
QVERIFY
(
primary
->
modes
().
count
()
>
0
);
Q_FOREACH
(
const
auto
&
output
,
m_config
->
outputs
())
{
Q_FOREACH
(
auto
mode
,
output
->
modes
())
{
for
(
const
auto
&
output
:
m_config
->
outputs
())
{
for
(
const
auto
&
mode
:
output
->
modes
())
{
QVERIFY
(
!
mode
->
name
().
isEmpty
());
QVERIFY
(
mode
->
refreshRate
()
>
0
);
QVERIFY
(
mode
->
size
().
isValid
());
...
...
@@ -163,7 +163,7 @@ void testWaylandBackend::verifyModes()
void
testWaylandBackend
::
verifyIds
()
{
QList
<
quint32
>
ids
;
Q_FOREACH
(
const
auto
&
output
,
m_config
->
outputs
())
{
for
(
const
auto
&
output
:
m_config
->
outputs
())
{
QVERIFY
(
ids
.
contains
(
output
->
id
())
==
false
);
QVERIFY
(
output
->
id
()
>
0
);
ids
<<
output
->
id
();
...
...
autotests/testkwaylanddpms.cpp
View file @
c64d67a2
...
...
@@ -84,7 +84,7 @@ void TestDpmsClient::initTestCase()
}
else
{
qDebug
()
<<
QStringLiteral
(
"Compositor does not provid a DpmsManager"
);
}
emit
this
->
dpmsAnnounced
();
Q_EMIT
this
->
dpmsAnnounced
();
});
m_registry
->
setup
();
...
...
autotests/testqscreenbackend.cpp
View file @
c64d67a2
...
...
@@ -84,7 +84,7 @@ void testQScreenBackend::verifyScreen()
void
testQScreenBackend
::
verifyOutputs
()
{
bool
primaryFound
=
false
;
for
each
(
const
KScreen
::
OutputPtr
&
op
,
m_config
->
outputs
())
{
for
(
const
KScreen
::
OutputPtr
&
op
:
m_config
->
outputs
())
{
if
(
op
->
isPrimary
())
{
primaryFound
=
true
;
}
...
...
@@ -102,7 +102,7 @@ void testQScreenBackend::verifyOutputs()
// qDebug() << " prim modes: " << primary->modes();
QList
<
int
>
ids
;
for
each
(
const
KScreen
::
OutputPtr
&
output
,
m_config
->
outputs
())
{
for
(
const
KScreen
::
OutputPtr
&
output
:
m_config
->
outputs
())
{
qDebug
()
<<
" _____________________ Output: "
<<
output
;
qDebug
()
<<
" output name: "
<<
output
->
name
();
qDebug
()
<<
" output modes: "
<<
output
->
modes
().
count
()
<<
output
->
modes
();
...
...
@@ -134,8 +134,8 @@ void testQScreenBackend::verifyModes()
QVERIFY
(
primary
);
QVERIFY
(
primary
->
modes
().
count
()
>
0
);
for
each
(
const
KScreen
::
OutputPtr
&
output
,
m_config
->
outputs
())
{
for
each
(
const
KScreen
::
ModePtr
&
mode
,
output
->
modes
())
{
for
(
const
KScreen
::
OutputPtr
&
output
:
m_config
->
outputs
())
{
for
(
const
KScreen
::
ModePtr
&
mode
:
output
->
modes
())
{
qDebug
()
<<
" Mode : "
<<
mode
->
name
();
QVERIFY
(
!
mode
->
name
().
isEmpty
());
QVERIFY
(
mode
->
refreshRate
()
>
0
);
...
...
@@ -152,7 +152,7 @@ void testQScreenBackend::commonUsagePattern()
const
KScreen
::
OutputList
outputs
=
op
->
config
()
->
outputs
();
QVariantList
outputList
;
Q_FOREACH
(
const
KScreen
::
OutputPtr
&
output
,
outputs
)
{
for
(
const
KScreen
::
OutputPtr
&
output
:
outputs
)
{
if
(
!
output
->
isConnected
())
{
continue
;
}
...
...
autotests/testscreenconfig.cpp
View file @
c64d67a2
...
...
@@ -211,7 +211,7 @@ void testScreenConfig::configCanBeApplied()
QVERIFY
(
!
brokenConfig2
.
isNull
());
int
enabledOutputsCount
=
0
;
Q_FOREACH
(
const
OutputPtr
&
output
,
brokenConfig2
->
outputs
())
{
for
(
const
OutputPtr
&
output
:
brokenConfig2
->
outputs
())
{
if
(
output
->
isEnabled
())
{
++
enabledOutputsCount
;
}
...
...
backends/fake/fake.cpp
View file @
c64d67a2
...
...
@@ -81,7 +81,7 @@ void Fake::setConfig(const ConfigPtr &config)
{
qCDebug
(
KSCREEN_FAKE
)
<<
"set config"
<<
config
->
outputs
();
mConfig
=
config
->
clone
();
emit
configChanged
(
mConfig
);
Q_EMIT
configChanged
(
mConfig
);
}
bool
Fake
::
isValid
()
const
...
...
@@ -99,7 +99,7 @@ QByteArray Fake::edid(int outputId) const
const
QJsonObject
json
=
jsonDoc
.
object
();
const
QJsonArray
outputs
=
json
[
QStringLiteral
(
"outputs"
)].
toArray
();
Q_FOREACH
(
const
QJsonValue
&
value
,
outputs
)
{
for
(
const
QJsonValue
&
value
:
outputs
)
{
const
QVariantMap
output
=
value
.
toObject
().
toVariantMap
();
if
(
output
[
QStringLiteral
(
"id"
)].
toInt
()
!=
outputId
)
{
continue
;
...
...
@@ -140,7 +140,7 @@ void Fake::setPrimary(int outputId, bool primary)
return
;
}
Q_FOREACH
(
KScreen
::
OutputPtr
output
,
config
()
->
outputs
())
{
for
(
KScreen
::
OutputPtr
output
:
config
()
->
outputs
())
{
if
(
output
->
id
()
==
outputId
)
{
output
->
setPrimary
(
primary
);
}
else
{
...
...
backends/fake/parser.cpp
View file @
c64d67a2
...
...
@@ -35,7 +35,7 @@ ConfigPtr Parser::fromJson(const QByteArray &data)
}
OutputList
outputList
;
Q_FOREACH
(
const
QVariant
&
value
,
outputs
)
{
for
(
const
QVariant
&
value
:
outputs
)
{
const
OutputPtr
output
=
Parser
::
outputFromJson
(
value
.
toMap
());
outputList
.
insert
(
output
->
id
(),
output
);
}
...
...
@@ -104,7 +104,7 @@ OutputPtr Parser::outputFromJson(QMap<QString, QVariant> map)
QStringList
preferredModes
;
const
QVariantList
prefModes
=
map
[
QStringLiteral
(
"preferredModes"
)].
toList
();
Q_FOREACH
(
const
QVariant
&
mode
,
prefModes
)
{
for
(
const
QVariant
&
mode
:
prefModes
)
{
preferredModes
.
append
(
mode
.
toString
());
}
output
->
setPreferredModes
(
preferredModes
);
...
...
@@ -112,7 +112,7 @@ OutputPtr Parser::outputFromJson(QMap<QString, QVariant> map)
ModeList
modelist
;
const
QVariantList
modes
=
map
[
QStringLiteral
(
"modes"
)].
toList
();
Q_FOREACH
(
const
QVariant
&
modeValue
,
modes
)
{
for
(
const
QVariant
&
modeValue
:
modes
)
{
const
ModePtr
mode
=
Parser
::
modeFromJson
(
modeValue
);
modelist
.
insert
(
mode
->
id
(),
mode
);
}
...
...
@@ -121,7 +121,7 @@ OutputPtr Parser::outputFromJson(QMap<QString, QVariant> map)
if
(
map
.
contains
(
QStringLiteral
(
"clones"
)))
{
QList
<
int
>
clones
;
Q_FOREACH
(
const
QVariant
&
id
,
map
[
QStringLiteral
(
"clones"
)].
toList
())
{
for
(
const
QVariant
&
id
:
map
[
QStringLiteral
(
"clones"
)].
toList
())
{
clones
.
append
(
id
.
toInt
());
}
...
...
backends/qscreen/qscreenconfig.cpp
View file @
c64d67a2
...
...
@@ -22,7 +22,7 @@ QScreenConfig::QScreenConfig(QObject *parent)
,
m_screen
(
new
QScreenScreen
(
this
))
,
m_blockSignals
(
true
)
{
for
each
(
const
QScreen
*
qscreen
,
QGuiApplication
::
screens
())
{
for
(
const
QScreen
*
qscreen
:
QGuiApplication
::
screens
())
{
screenAdded
(
qscreen
);
}
m_blockSignals
=
false
;
...
...
@@ -46,7 +46,7 @@ ConfigPtr QScreenConfig::toKScreenConfig() const
int
QScreenConfig
::
outputId
(
const
QScreen
*
qscreen
)
{
QList
<
int
>
ids
;
for
each
(
auto
output
,
m_outputMap
)
{
for
(
auto
output
:
qAsConst
(
m_outputMap
)
)
{
if
(
qscreen
==
output
->
qscreen
())
{
return
output
->
id
();
}
...
...
@@ -72,7 +72,7 @@ void QScreenConfig::screenRemoved(QScreen *qscreen)
qCDebug
(
KSCREEN_QSCREEN
)
<<
"Screen removed"
<<
qscreen
<<
QGuiApplication
::
screens
().
count
();
// Find output matching the QScreen object and remove it
int
removedOutputId
=
-
1
;
for
each
(
auto
output
,
m_outputMap
)
{
for
(
auto
output
:
m_outputMap
)
{
if
(
output
->
qscreen
()
==
qscreen
)
{
removedOutputId
=
output
->
id
();
m_outputMap
.
remove
(
removedOutputId
);
...
...
@@ -90,7 +90,7 @@ void QScreenConfig::updateKScreenConfig(ConfigPtr &config) const
// Removing removed outputs
KScreen
::
OutputList
outputs
=
config
->
outputs
();
Q_FOREACH
(
const
KScreen
::
OutputPtr
&
output
,
outputs
)
{
for
(
const
KScreen
::
OutputPtr
&
output
:
outputs
)
{
if
(
!
m_outputMap
.
contains
(
output
->
id
()))
{
config
->
removeOutput
(
output
->
id
());
}
...
...
@@ -98,7 +98,7 @@ void QScreenConfig::updateKScreenConfig(ConfigPtr &config) const
// Add KScreen::Outputs that aren't in the list yet, handle primaryOutput
KScreen
::
OutputList
kscreenOutputs
=
config
->
outputs
();
for
each
(
QScreenOutput
*
output
,
m_outputMap
)
{
for
(
QScreenOutput
*
output
:
m_outputMap
)
{
KScreen
::
OutputPtr
kscreenOutput
=
kscreenOutputs
[
output
->
id
()];
if
(
!
kscreenOutput
)
{
...
...
src/backendmanager.cpp
View file @
c64d67a2
...
...
@@ -143,7 +143,8 @@ QFileInfo BackendManager::preferredBackend(const QString &backend)
}
}
QFileInfo
fallback
;
Q_FOREACH
(
const
QFileInfo
&
f
,
listBackends
())
{
const
auto
backends
=
listBackends
();
for
(
const
QFileInfo
&
f
:
backends
)
{
// Here's the part where we do the match case-insensitive
if
(
f
.
baseName
().
toLower
()
==
QStringLiteral
(
"ksc_%1"
).
arg
(
backendFilter
.
toLower
()))
{
return
f
;
...
...
@@ -249,8 +250,8 @@ void BackendManager::requestBackend()
const
QByteArray
args
=
qgetenv
(
"KSCREEN_BACKEND_ARGS"
);
QVariantMap
arguments
;
if
(
!
args
.
isEmpty
())
{
QList
<
QByteArray
>
arglist
=
args
.
split
(
';'
);
Q_FOREACH
(
const
QByteArray
&
arg
,
arglist
)
{
const
QList
<
QByteArray
>
arglist
=
args
.
split
(
';'
);
for
(
const
QByteArray
&
arg
:
arglist
)
{
const
int
pos
=
arg
.
indexOf
(
'='
);
if
(
pos
==
-
1
)
{
continue
;
...
...
src/config.cpp
View file @
c64d67a2
...
...
@@ -108,7 +108,7 @@ bool Config::canBeApplied(const ConfigPtr &config, ValidityFlags flags)
OutputPtr
currentOutput
;
const
OutputList
outputs
=
config
->
outputs
();
int
enabledOutputsCount
=
0
;
Q_FOREACH
(
const
OutputPtr
&
output
,
outputs
)
{
for
(
const
OutputPtr
&
output
:
outputs
)
{
if
(
!
output
->
isEnabled
())
{
continue
;
}
...
...
@@ -280,7 +280,7 @@ OutputList Config::outputs() const
OutputList
Config
::
connectedOutputs
()
const
{
OutputList
outputs
;
Q_FOREACH
(
const
OutputPtr
&
output
,
d
->
outputs
)
{
for
(
const
OutputPtr
&
output
:
qAsConst
(
d
->
outputs
)
)
{
if
(
!
output
->
isConnected
())
{
continue
;
}
...
...
@@ -366,13 +366,15 @@ void Config::apply(const ConfigPtr &other)
d
->
screen
->
apply
(
other
->
screen
());
// Remove removed outputs
Q_FOREACH
(
const
OutputPtr
&
output
,
d
->
outputs
)
{
if
(
!
other
->
d
->
outputs
.
contains
(
output
->
id
()))
{
removeOutput
(
output
->
id
());
for
(
auto
it
=
d
->
outputs
.
begin
();
it
!=
d
->
outputs
.
end
();)
{
if
(
!
other
->
d
->
outputs
.
contains
((
*
it
)
->
id
()))
{
it
=
d
->
removeOutput
(
it
);
}
else
{
++
it
;
}
}
Q_FOREACH
(
const
OutputPtr
&
otherOutput
,
other
->
d
->
outputs
)
{
for
(
const
OutputPtr
&
otherOutput
:
qAsConst
(
other
->
d
->
outputs
)
)
{
// Add new outputs
if
(
!
d
->
outputs
.
contains
(
otherOutput
->
id
()))
{
addOutput
(
otherOutput
->
clone
());
...
...
@@ -393,7 +395,7 @@ QDebug operator<<(QDebug dbg, const KScreen::ConfigPtr &config)
const
auto
outputs
=
config
->
outputs
();
for
(
const
auto
&
output
:
outputs
)
{
if
(
output
->
isConnected
())
{
dbg
<<
endl
<<
output
;
dbg
<<
Qt
::
endl
<<
output
;
}
}
dbg
<<
")"
;
...
...
src/configmonitor.cpp
View file @
c64d67a2
...
...
@@ -99,7 +99,8 @@ void ConfigMonitor::Private::backendConfigChanged(const QVariantMap &configMap)
return
;
}
Q_FOREACH
(
OutputPtr
output
,
newConfig
->
connectedOutputs
())
{
const
auto
connectedOutputs
=
newConfig
->
connectedOutputs
();
for
(
const
OutputPtr
&
output
:
connectedOutputs
)
{
if
(
!
output
->
edid
()
&&
output
->
isConnected
())
{
QDBusPendingReply
<
QByteArray
>
reply
=
mBackend
->
getEdid
(
output
->
id
());
mPendingEDIDRequests
[
newConfig
].
append
(
output
->
id
());
...
...
src/configserializer.cpp
View file @
c64d67a2
...
...
@@ -48,7 +48,7 @@ QJsonObject ConfigSerializer::serializeConfig(const ConfigPtr &config)
obj
[
QLatin1String
(
"features"
)]
=
static_cast
<
int
>
(
config
->
supportedFeatures
());
QJsonArray
outputs
;
Q_FOREACH
(
const
OutputPtr
&
output
,
config
->
outputs
())
{
for
(
const
OutputPtr
&
output
:
config
->
outputs
())
{
outputs
.
append
(
serializeOutput
(
output
));
}
obj
[
QLatin1String
(
"outputs"
)]
=
outputs
;
...
...
@@ -86,7 +86,7 @@ QJsonObject ConfigSerializer::serializeOutput(const OutputPtr &output)
obj
[
QLatin1String
(
"replicationSource"
)]
=
output
->
replicationSource
();
QJsonArray
modes
;
Q_FOREACH
(
const
ModePtr
&
mode
,
output
->
modes
())
{
for
(
const
ModePtr
&
mode
:
output
->
modes
())
{
modes
.
append
(
serializeMode
(
mode
));
}
obj
[
QLatin1String
(
"modes"
)]
=
modes
;
...
...
src/configserializer_p.h
View file @
c64d67a2
...
...
@@ -25,7 +25,7 @@ KSCREEN_EXPORT QJsonObject serializeSize(const QSize &size);
template
<
typename
T
>
KSCREEN_EXPORT
QJsonArray
serializeList
(
const
QList
<
T
>
&
list
)
{
QJsonArray
arr
;
Q_FOREACH
(
const
T
&
t
,
list
)
{
for
(
const
T
&
t
:
list
)
{
arr
.
append
(
t
);
}
return
arr
;
...
...
src/doctor/doctor.cpp
View file @
c64d67a2
...
...
@@ -78,7 +78,7 @@ void Doctor::start(QCommandLineParser *parser)
}
if
(
m_parser
->
isSet
(
QStringLiteral
(
"dpms"
)))
{
if
(
!
QGuiApplication
::
platformName
().
startsWith
(
QLatin1String
(
"wayland"
)))
{
cerr
<<
"DPMS is only supported on Wayland."
<<
endl
;
cerr
<<
"DPMS is only supported on Wayland."
<<
Qt
::
endl
;
// We need to kick the event loop, otherwise .quit() hangs
QTimer
::
singleShot
(
0
,
qApp
->
quit
);
return
;
...
...
@@ -143,28 +143,28 @@ void Doctor::showDpms()
void
Doctor
::
showBackends
()
const
{
cout
<<
"Environment: "
<<
endl
;
cout
<<
"Environment: "
<<
Qt
::
endl
;
auto
env_kscreen_backend
=
(
qgetenv
(
"KSCREEN_BACKEND"
).
isEmpty
())
?
QStringLiteral
(
"[not set]"
)
:
QString
::
fromUtf8
(
qgetenv
(
"KSCREEN_BACKEND"
));
cout
<<
" * KSCREEN_BACKEND : "
<<
env_kscreen_backend
<<
endl
;
cout
<<
" * KSCREEN_BACKEND : "
<<
env_kscreen_backend
<<
Qt
::
endl
;
auto
env_kscreen_backend_inprocess
=
(
qgetenv
(
"KSCREEN_BACKEND_INPROCESS"
).
isEmpty
())
?
QStringLiteral
(
"[not set]"
)
:
QString
::
fromUtf8
(
qgetenv
(
"KSCREEN_BACKEND_INPROCESS"
));
cout
<<
" * KSCREEN_BACKEND_INPROCESS : "
<<
env_kscreen_backend_inprocess
<<
endl
;
cout
<<
" * KSCREEN_BACKEND_INPROCESS : "
<<
env_kscreen_backend_inprocess
<<
Qt
::
endl
;
auto
env_kscreen_logging
=
(
qgetenv
(
"KSCREEN_LOGGING"
).
isEmpty
())
?
QStringLiteral
(
"[not set]"
)
:
QString
::
fromUtf8
(
qgetenv
(
"KSCREEN_LOGGING"
));
cout
<<
" * KSCREEN_LOGGING : "
<<
env_kscreen_logging
<<
endl
;
cout
<<
" * KSCREEN_LOGGING : "
<<
env_kscreen_logging
<<
Qt
::
endl
;
cout
<<
"Logging to : "
<<
(
Log
::
instance
()
->
enabled
()
?
Log
::
instance
()
->
logFile
()
:
QStringLiteral
(
"[logging disabled]"
))
<<
endl
;
auto
backends
=
BackendManager
::
instance
()
->
listBackends
();
cout
<<
"Logging to : "
<<
(
Log
::
instance
()
->
enabled
()
?
Log
::
instance
()
->
logFile
()
:
QStringLiteral
(
"[logging disabled]"
))
<<
Qt
::
endl
;
const
auto
backends
=
BackendManager
::
instance
()
->
listBackends
();
auto
preferred
=
BackendManager
::
instance
()
->
preferredBackend
();
cout
<<
"Preferred KScreen backend : "
<<
green
<<
preferred
.
fileName
()
<<
cr
<<
endl
;
cout
<<
"Available KScreen backends:"
<<
endl
;
Q_FOREACH
(
const
QFileInfo
f
,
backends
)
{
cout
<<
"Preferred KScreen backend : "
<<
green
<<
preferred
.
fileName
()
<<
cr
<<
Qt
::
endl
;
cout
<<
"Available KScreen backends:"
<<
Qt
::
endl
;
for
(
const
QFileInfo
&
f
:
backends
)
{
auto
c
=
blue
;
if
(
preferred
==
f
)
{
c
=
green
;
}
cout
<<
" * "
<<
c
<<
f
.
fileName
()
<<
cr
<<
": "
<<
f
.
absoluteFilePath
()
<<
endl
;
cout
<<
" * "
<<
c
<<
f
.
fileName
()
<<
cr
<<
": "
<<
f
.
absoluteFilePath
()
<<
Qt
::
endl
;
}
cout
<<
endl
;
cout
<<
Qt
::
endl
;
}
void
Doctor
::
setOptionList
(
const
QStringList
&
positionalArgs
)
...
...
@@ -175,13 +175,13 @@ void Doctor::setOptionList(const QStringList &positionalArgs)
void
Doctor
::
parsePositionalArgs
()
{
// qCDebug(KSCREEN_DOCTOR) << "POSARGS" << m_positionalArgs;
Q_FOREACH
(
const
QString
&
op
,
m_positionalArgs
)
{
for
(
const
QString
&
op
:
qAsConst
(
m_positionalArgs
)
)
{
auto
ops
=
op
.
split
(
QLatin1Char
(
'.'
));
if
(
ops
.
count
()
>
2
)
{
bool
ok
;
int
output_id
=
-
1
;
if
(
ops
[
0
]
==
QLatin1String
(
"output"
))
{
Q_FOREACH
(
const
auto
&
output
,
m_config
->
outputs
())
{
for
(
const
auto
&
output
:
m_config
->
outputs
())
{
if
(
output
->
name
()
==
ops
[
1
])
{
output_id
=
output
->
id
();
}
...
...
@@ -189,7 +189,7 @@ void Doctor::parsePositionalArgs()
if
(
output_id
==
-
1
)
{
output_id
=
ops
[
1
].
toInt
(
&
ok
);
if
(
!
ok
)
{
cerr
<<
"Unable to parse output id: "
<<
ops
[
1
]
<<
endl
;
cerr
<<
"Unable to parse output id: "
<<
ops
[
1
]
<<
Qt
::
endl
;
qApp
->
exit
(
3
);
return
;
}
...
...
@@ -223,7 +223,7 @@ void Doctor::parsePositionalArgs()
int
x
=
_pos
[
0
].
toInt
(
&
ok
);
int
y
=
_pos
[
1
].
toInt
(
&
ok
);
if
(
!
ok
)
{
cerr
<<
"Unable to parse position: "
<<
ops
[
3
]
<<
endl
;
cerr
<<
"Unable to parse position: "
<<
ops
[
3
]
<<
Qt
::
endl
;
qApp
->
exit
(
5
);
return
;
}
...
...
@@ -267,7 +267,7 @@ void Doctor::parsePositionalArgs()
return
;
}
}
else
{
cerr
<<
"Unable to parse arguments: "
<<
op
<<
endl
;
cerr
<<
"Unable to parse arguments: "
<<
op
<<
Qt
::
endl
;
qApp
->
exit
(
2
);
return
;
}
...
...
@@ -330,7 +330,7 @@ void Doctor::showOutputs() const
typeString
[
KScreen
::
Output
::
TVC4
]
=
QStringLiteral
(
"TVC4"
);
typeString
[
KScreen
::
Output
::
DisplayPort
]
=
QStringLiteral
(
"DisplayPort"
);
Q_FOREACH
(
const
auto
&
output
,
m_config
->
outputs
())
{
for
(
const
auto
&
output
:
m_config
->
outputs
())
{
cout
<<
green
<<
"Output: "
<<
cr
<<
output
->
id
()
<<
" "
<<
output
->
name
();
cout
<<
" "
<<
(
output
->
isEnabled
()
?
green
+
QLatin1String
(
"enabled"
)
:
red
+
QLatin1String
(
"disabled"
));
cout
<<
" "
<<
(
output
->
isConnected
()
?
green
+
QLatin1String
(
"connected"
)
:
red
+
QLatin1String
(
"disconnected"
));
...
...
@@ -338,7 +338,7 @@ void Doctor::showOutputs() const
auto
_type
=
typeString
[
output
->
type
()];
cout
<<
" "
<<
yellow
<<
(
_type
.
isEmpty
()
?
QStringLiteral
(
"UnmappedOutputType"
)
:
_type
);
cout
<<
blue
<<
" Modes: "
<<
cr
;
Q_FOREACH
(
auto
mode
,
output
->
modes
())
{
for
(
const
auto
&
mode
:
output
->
modes
())
{
auto
name
=
QStringLiteral
(
"%1x%2@%3"
)
.
arg
(
QString
::
number
(
mode
->
size
().
width
()),
QString
::
number
(
mode
->
size
().
height
()),
QString
::
number
(
qRound
(
mode
->
refreshRate
())));
if
(
mode
==
output
->
currentMode
())
{
...
...
@@ -356,7 +356,7 @@ void Doctor::showOutputs() const
if
(
output
->
isPrimary
())
{
cout
<<
blue
<<
"primary"
;
}
cout
<<
cr
<<
endl
;
cout
<<
cr
<<
Qt
::
endl
;
}
}
...
...
@@ -373,15 +373,15 @@ bool Doctor::setEnabled(int id, bool enabled = true)
return
false
;
}
Q_FOREACH
(
const
auto
&
output
,
m_config
->
outputs
())
{
for
(
const
auto
&
output
:
m_config
->
outputs
())
{
if
(
output
->
id
()
==
id
)
{
cout
<<
(
enabled
?
"Enabling "
:
"Disabling "
)
<<
"output "
<<
id
<<
endl
;
cout
<<
(
enabled
?
"Enabling "
:
"Disabling "
)
<<
"output "
<<
id
<<
Qt
::
endl
;
output
->
setEnabled
(
enabled
);
m_changed
=
true
;
return
true
;
}
}
cerr
<<
"Output with id "
<<
id
<<
" not found."
<<
endl
;
cerr
<<
"Output with id "
<<
id
<<
" not found."
<<
Qt
::
endl
;
qApp
->
exit
(
8
);
return
false
;
}
...
...
@@ -393,7 +393,7 @@ bool Doctor::setPosition(int id, const QPoint &pos)
return
false
;
}
Q_FOREACH
(
const
auto
&
output
,
m_config
->
outputs
())
{
for
(
const
auto
&
output
:
m_config
->
outputs
())
{
if
(
output
->
id
()
==
id
)
{
qCDebug
(
KSCREEN_DOCTOR
)
<<
"Set output position"
<<
pos
;
output
->
setPos
(
pos
);
...
...
@@ -401,7 +401,7 @@ bool Doctor::setPosition(int id, const QPoint &pos)
return
true
;
}
}
cout
<<
"Output with id "
<<
id
<<
" not found."
<<
endl
;
cout
<<
"Output with id "
<<
id
<<
" not found."
<<
Qt
::
endl
;
return
false
;
}
...
...
@@ -412,10 +412,10 @@ bool Doctor::setMode(int id, const QString &mode_id)
return
false
;
}
Q_FOREACH
(
const
auto
&
output
,
m_config
->
outputs
())
{
for
(
const
auto
&
output
:
m_config
->
outputs
())
{
if
(
output
->
id
()
==
id
)
{
// find mode
Q_FOREACH
(
const
KScreen
::
ModePtr
mode
,
output
->
modes
())
{
for
(
const
KScreen
::
ModePtr
mode
:
output
->
modes
())
{
auto
name
=
QStringLiteral
(
"%1x%2@%3"
)
.
arg
(
QString
::
number
(
mode
->
size
().
width
()),
QString
::
number
(
mode
->
size
().
height
()),
QString
::
number
(
qRound
(
mode
->
refreshRate
())));
...
...
@@ -428,7 +428,7 @@ bool Doctor::setMode(int id, const QString &mode_id)
}
}
}
cout
<<
"Output mode "
<<
mode_id
<<
" not found."
<<
endl
;
cout
<<
"Output mode "
<<
mode_id
<<
" not found."
<<
Qt
::
endl
;
return
false
;
}
...
...
@@ -439,14 +439,14 @@ bool Doctor::setScale(int id, qreal scale)
return
false
;
}
Q_FOREACH
(
const
auto
&
output
,
m_config
->
outputs
())
{
for
(
const
auto
&
output
:
m_config
->
outputs
())
{
if
(
output
->
id
()
==
id
)
{
output
->
setScale
(
scale
);
m_changed
=
true
;
return
true
;
}
}
cout
<<
"Output scale "
<<
id
<<
" invalid."
<<
endl
;
cout
<<
"Output scale "
<<
id
<<
" invalid."
<<
Qt
::
endl
;
return
false
;
}
...
...
@@ -457,14 +457,14 @@ bool Doctor::setRotation(int id, KScreen::Output::Rotation rot)
return
false
;
}
Q_FOREACH
(
const
auto
&
output
,
m_config
->
outputs
())
{
for
(
const
auto
&
output
:
m_config
->
outputs
())
{
if
(
output
->
id
()
==
id
)
{
output
->
setRotation
(
rot
);
m_changed
=
true
;
return
true
;
}
}
cout
<<
"Output rotation "
<<
id
<<
" invalid."
<<
endl
;
cout
<<
"Output rotation "
<<
id
<<
" invalid."
<<
Qt
::
endl
;
return
false
;
}
...
...
src/doctor/dpmsclient.cpp
View file @
c64d67a2
...
...
@@ -80,7 +80,7 @@ void DpmsClient::connected()
m_dpmsManager
=
m_registry
->
createDpmsManager
(
dpmsData
.
name
,
dpmsData
.
version
);
}
emit
this
->
ready
();
Q_EMIT
this
->
ready
();
});
m_registry
->
setup
();
...
...
@@ -125,7 +125,7 @@ void DpmsClient::modeChanged()
{
m_modeChanges
=
m_modeChanges
-
1
;
if
(
m_modeChanges
<=
0
)
{
emit
finished
();
Q_EMIT
finished
();
m_modeChanges
=
0
;
}
}
...
...
@@ -133,11 +133,11 @@ void DpmsClient::modeChanged()
void
DpmsClient
::
on
()
{
changeMode
(
Dpms
::
Mode
::
On
);
//
emit
finished();
//
Q_EMIT
finished();
}
void
KScreen
::
DpmsClient
::
off
()
{
changeMode
(
Dpms
::
Mode
::
Off
);
//
emit
finished();
//
Q_EMIT
finished();
}
src/getconfigoperation.cpp
View file @
c64d67a2
...
...
@@ -100,7 +100,8 @@ void GetConfigOperationPrivate::onConfigReceived(QDBusPendingCallWatcher *watche
q
->
emitResult
();
return
;
}
Q_FOREACH
(
const
OutputPtr
&
output
,
config
->
outputs
())
{
const
auto
outputs
=
config
->
outputs
();
for
(
const
OutputPtr
&
output
:
outputs
)
{
if
(
!
output
->
isConnected
())
{
continue
;
}
...
...
@@ -174,7 +175,9 @@ void GetConfigOperationPrivate::loadEdid(KScreen::AbstractBackend *backend)
if
(
!
config
)
{
return
;
}
Q_FOREACH
(
auto
output
,
config
->
outputs
())
{
auto
outputs
=
config
->
outputs
();
for
(
auto
it
=
outputs
.
begin
();
it
!=
outputs
.
end
();
++
it
)
{
auto
output
=
*
it
;
if
(
output
->
edid
()
==
nullptr
)
{
const
QByteArray
edidData
=
backend
->
edid
(
output
->
id
());
output
->
setEdid
(
edidData
);
...
...
src/output.cpp
View file @
c64d67a2
...
...
@@ -56,7 +56,8 @@ public:
,
primary
(
other
.
primary
)
,
followPreferredMode
(
other
.
followPreferredMode
)
{
Q_FOREACH
(
const
ModePtr
&
otherMode
,
other
.
modeList
)
{
const
auto
otherModeList
=
other
.
modeList
;
for
(
const
ModePtr
&
otherMode
:
otherModeList
)
{
modeList
.
insert
(
otherMode
->
id
(),
otherMode
->
clone
());
}
if
(
other
.
edid
)
{
...
...
@@ -125,7 +126,7 @@ QString Output::Private::biggestMode(const ModeList &modes) const
{
int
area
,
total
=
0
;
KScreen
::
ModePtr
biggest
;
Q_FOREACH
(
const
KScreen
::
ModePtr
&
mode
,
modes
)
{
for
(
const
KScreen
::
ModePtr
&
mode
:
modes
)
{
area
=
mode
->
size
().
width
()
*
mode
->
size
().
height
();
if
(
area
<
total
)
{
continue
;
...
...
@@ -272,8 +273,8 @@ void Output::setModes(const ModeList &modes)
bool
changed
=
!
d
->
compareModeList
(
d
->
modeList
,
modes
);
d
->
modeList
=
modes
;
if
(
changed
)
{
emit
modesChanged
();
emit
outputChanged
();
Q_EMIT
modesChanged
();
Q_EMIT
outputChanged
();
}
}
...
...
@@ -321,7 +322,7 @@ QString Output::preferredModeId() const
int
total
=
0
;
KScreen
::