|
|
|
@ -158,41 +158,18 @@ qreal ThemeManager::devicePixelRatio()
|
|
|
|
|
|
|
|
|
|
|
|
void ThemeManager::setDevicePixelRatio(qreal ratio)
|
|
|
|
void ThemeManager::setDevicePixelRatio(qreal ratio)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
m_settings->setValue(s_devicePixelRatio, ratio);
|
|
|
|
int scaleDpi = qRound(ratio * 96.0);
|
|
|
|
|
|
|
|
QProcess process;
|
|
|
|
// Set font dpi
|
|
|
|
process.start(QStringLiteral("xrdb"), {QStringLiteral("-quiet"), QStringLiteral("-merge"), QStringLiteral("-nocpp")});
|
|
|
|
// ref kscreen.
|
|
|
|
|
|
|
|
if (qFuzzyCompare(ratio, 1.0)) {
|
|
|
|
if (process.waitForStarted()) {
|
|
|
|
const int scaleDpi = qRound(ratio * 96.0);
|
|
|
|
process.write(QByteArray("Xft.dpi: " + QString::number(scaleDpi).toLatin1()));
|
|
|
|
QProcess proc;
|
|
|
|
process.closeWriteChannel();
|
|
|
|
proc.start(QStringLiteral("xrdb"), {QStringLiteral("-quiet"), QStringLiteral("-merge"), QStringLiteral("-nocpp")});
|
|
|
|
process.waitForFinished();
|
|
|
|
if (proc.waitForStarted()) {
|
|
|
|
|
|
|
|
proc.write(QByteArray("Xft.dpi: " + QString::number(scaleDpi).toLatin1()));
|
|
|
|
|
|
|
|
proc.closeWriteChannel();
|
|
|
|
|
|
|
|
proc.waitForFinished();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if dpi is the default (96) remove the entry rather than setting it
|
|
|
|
|
|
|
|
// QProcess proc;
|
|
|
|
|
|
|
|
// proc.start(QStringLiteral("xrdb"), {QStringLiteral("-quiet"), QStringLiteral("-remove"), QStringLiteral("-nocpp")});
|
|
|
|
|
|
|
|
// if (proc.waitForStarted()) {
|
|
|
|
|
|
|
|
// proc.write(QByteArray("Xft.dpi\n"));
|
|
|
|
|
|
|
|
// proc.closeWriteChannel();
|
|
|
|
|
|
|
|
// proc.waitForFinished();
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_settings->setValue("forceFontDPI", 96);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
const int scaleDpi = qRound(ratio * 96.0);
|
|
|
|
|
|
|
|
QProcess proc;
|
|
|
|
|
|
|
|
proc.start(QStringLiteral("xrdb"), {QStringLiteral("-quiet"), QStringLiteral("-merge"), QStringLiteral("-nocpp")});
|
|
|
|
|
|
|
|
if (proc.waitForStarted()) {
|
|
|
|
|
|
|
|
proc.write(QByteArray("Xft.dpi: " + QString::number(scaleDpi).toLatin1()));
|
|
|
|
|
|
|
|
proc.closeWriteChannel();
|
|
|
|
|
|
|
|
proc.waitForFinished();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
m_settings->setValue("forceFontDPI", scaleDpi);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_settings->setValue(s_devicePixelRatio, ratio);
|
|
|
|
|
|
|
|
m_settings->setValue("forceFontDPI", scaleDpi);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QString ThemeManager::wallpaper()
|
|
|
|
QString ThemeManager::wallpaper()
|
|
|
|
|