refactor(settings-daemon): remove global device pixel ratio setting

main
Reion Wong 3 weeks ago
parent 171390fdc9
commit 5b37ae3b28

@ -22,9 +22,6 @@
<method name="setSystemFontPointSize"> <method name="setSystemFontPointSize">
<arg name="fontSize" type="d" direction="in"/> <arg name="fontSize" type="d" direction="in"/>
</method> </method>
<method name="setDevicePixelRatio">
<arg name="ratio" type="d" direction="in"/>
</method>
<method name="setWallpaper"> <method name="setWallpaper">
<arg name="path" type="s" direction="in"/> <arg name="path" type="s" direction="in"/>
</method> </method>
@ -57,7 +54,6 @@
<property name="systemFont" type="s" access="read"/> <property name="systemFont" type="s" access="read"/>
<property name="systemFixedFont" type="s" access="read"/> <property name="systemFixedFont" type="s" access="read"/>
<property name="systemFontPointSize" type="d" access="read"/> <property name="systemFontPointSize" type="d" access="read"/>
<property name="devicePixelRatio" type="d" access="read"/>
<property name="wallpaper" type="s" access="read"/> <property name="wallpaper" type="s" access="read"/>
<property name="accentColor" type="i" access="read"/> <property name="accentColor" type="i" access="read"/>
<property name="backgroundType" type="i" access="read"/> <property name="backgroundType" type="i" access="read"/>

@ -30,7 +30,6 @@
static const QByteArray s_systemFontName = QByteArrayLiteral("Font"); static const QByteArray s_systemFontName = QByteArrayLiteral("Font");
static const QByteArray s_systemFixedFontName = QByteArrayLiteral("FixedFont"); static const QByteArray s_systemFixedFontName = QByteArrayLiteral("FixedFont");
static const QByteArray s_systemPointFontSize = QByteArrayLiteral("FontSize"); static const QByteArray s_systemPointFontSize = QByteArrayLiteral("FontSize");
static const QByteArray s_devicePixelRatio = QByteArrayLiteral("PixelRatio");
static QString gtkRc2Path() static QString gtkRc2Path()
{ {
@ -266,45 +265,6 @@ void ThemeManager::setSystemFontPointSize(qreal fontSize)
emit systemFontPointSizeChanged(); emit systemFontPointSizeChanged();
} }
qreal ThemeManager::devicePixelRatio()
{
return m_settings->value(s_devicePixelRatio, 1.0).toReal();
}
void ThemeManager::setDevicePixelRatio(qreal ratio)
{
ratio = qBound<qreal>(1.0, ratio, 4.0);
m_settings->setValue(s_devicePixelRatio, ratio);
m_settings->sync();
updateGtk3Config();
applyCursorSettings();
QProcess p;
p.setProgram("pkexec");
p.setArguments(QStringList() << "cutefish-sddm-helper"
<< "--scale" << QString::number(ratio));
p.start();
p.waitForFinished(-1);
QDBusInterface iface("org.freedesktop.Notifications",
"/org/freedesktop/Notifications",
"org.freedesktop.Notifications",
QDBusConnection::sessionBus());
if (iface.isValid()) {
QList<QVariant> args;
args << "cutefish-settings";
args << ((unsigned int) 0);
args << "preferences-system";
args << "";
args << tr("Screen scaling needs to be re-login to take effect");
args << QStringList();
args << QVariantMap();
args << (int) 10;
iface.asyncCallWithArgumentList("Notify", args);
}
}
QString ThemeManager::wallpaper() QString ThemeManager::wallpaper()
{ {
return m_wallpaperPath; return m_wallpaperPath;
@ -360,7 +320,7 @@ void ThemeManager::updateGtk3Config()
// icon theme // icon theme
settings.setValue("gtk-icon-theme-name", m_iconTheme); settings.setValue("gtk-icon-theme-name", m_iconTheme);
settings.setValue("gtk-cursor-theme-name", m_cursorTheme); settings.setValue("gtk-cursor-theme-name", m_cursorTheme);
settings.setValue("gtk-cursor-theme-size", qRound(m_cursorSize * devicePixelRatio())); settings.setValue("gtk-cursor-theme-size", m_cursorSize);
// other // other
settings.setValue("gtk-enable-animations", true); settings.setValue("gtk-enable-animations", true);
// theme // theme
@ -384,8 +344,7 @@ void ThemeManager::applyCursorSettings()
QSettings::IniFormat); QSettings::IniFormat);
inputSettings.beginGroup(QStringLiteral("Mouse")); inputSettings.beginGroup(QStringLiteral("Mouse"));
inputSettings.setValue(QStringLiteral("cursorTheme"), cursorTheme()); inputSettings.setValue(QStringLiteral("cursorTheme"), cursorTheme());
inputSettings.setValue(QStringLiteral("cursorSize"), inputSettings.setValue(QStringLiteral("cursorSize"), cursorSize());
qRound(cursorSize() * devicePixelRatio()));
inputSettings.endGroup(); inputSettings.endGroup();
inputSettings.sync(); inputSettings.sync();

@ -33,7 +33,6 @@ class ThemeManager : public QObject
Q_PROPERTY(QString systemFont READ systemFont WRITE setSystemFont NOTIFY systemFontChanged) Q_PROPERTY(QString systemFont READ systemFont WRITE setSystemFont NOTIFY systemFontChanged)
Q_PROPERTY(QString systemFixedFont READ systemFixedFont WRITE setSystemFixedFont) Q_PROPERTY(QString systemFixedFont READ systemFixedFont WRITE setSystemFixedFont)
Q_PROPERTY(qreal systemFontPointSize READ systemFontPointSize WRITE setSystemFontPointSize NOTIFY systemFontPointSizeChanged) Q_PROPERTY(qreal systemFontPointSize READ systemFontPointSize WRITE setSystemFontPointSize NOTIFY systemFontPointSizeChanged)
Q_PROPERTY(qreal devicePixelRatio READ devicePixelRatio WRITE setDevicePixelRatio)
Q_PROPERTY(QString wallpaper READ wallpaper WRITE setWallpaper NOTIFY wallpaperChanged) Q_PROPERTY(QString wallpaper READ wallpaper WRITE setWallpaper NOTIFY wallpaperChanged)
Q_PROPERTY(int accentColor READ accentColor WRITE setAccentColor NOTIFY accentColorChanged) Q_PROPERTY(int accentColor READ accentColor WRITE setAccentColor NOTIFY accentColorChanged)
Q_PROPERTY(int backgroundType READ backgroundType WRITE setBackgroundType NOTIFY backgroundTypeChanged) Q_PROPERTY(int backgroundType READ backgroundType WRITE setBackgroundType NOTIFY backgroundTypeChanged)
@ -67,9 +66,6 @@ public:
qreal systemFontPointSize(); qreal systemFontPointSize();
void setSystemFontPointSize(qreal fontSize); void setSystemFontPointSize(qreal fontSize);
qreal devicePixelRatio();
void setDevicePixelRatio(qreal ratio);
QString wallpaper(); QString wallpaper();
void setWallpaper(const QString &path); void setWallpaper(const QString &path);

Loading…
Cancel
Save