diff --git a/imports/Spectral/Panel/RoomListPanel.qml b/imports/Spectral/Panel/RoomListPanel.qml index f9ce1cf..d375470 100644 --- a/imports/Spectral/Panel/RoomListPanel.qml +++ b/imports/Spectral/Panel/RoomListPanel.qml @@ -432,10 +432,10 @@ Rectangle { ScrollBar.horizontal.policy: ScrollBar.AlwaysOff - padding: 16 + padding: 32 ColumnLayout { - width: main.width + width: main.width - 64 spacing: 0 Switch { @@ -465,6 +465,32 @@ Rectangle { onCheckedChanged: MSettings.confirmOnExit = checked } + + RowLayout { + Layout.fillWidth: true + + Label { + text: "DPI" + } + + Slider { + Layout.fillWidth: true + + value: controller.dpi() + from: 100 + to: 300 + stepSize: 25 + snapMode: Slider.SnapAlways + + ToolTip { + Material.foreground: "white" + visible: parent.pressed + text: parent.value + } + + onMoved: controller.setDpi(value) + } + } } } } diff --git a/qml/main.qml b/qml/main.qml index a6eb9d1..061f222 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -128,6 +128,8 @@ ApplicationWindow { ToolTip { id: loginButtonTooltip + + Material.foreground: "white" } } diff --git a/src/controller.cpp b/src/controller.cpp index 823081c..040854d 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -239,3 +239,11 @@ void Controller::postNotification(const QString& roomId, const QString& eventId, notificationsManager.postNotification(roomId, eventId, roomName, senderName, text, icon, iconPath); } + +int Controller::dpi() { + return SettingsGroup("Interface").value("dpi", 100).toInt(); +} + +void Controller::setDpi(int dpi) { + SettingsGroup("Interface").setValue("dpi", dpi); +} diff --git a/src/controller.h b/src/controller.h index 3db7c64..46c526e 100644 --- a/src/controller.h +++ b/src/controller.h @@ -32,6 +32,9 @@ class Controller : public QObject { QVector connections() { return m_connections; } + Q_INVOKABLE int dpi(); + Q_INVOKABLE void setDpi(int dpi); + // All the non-Q_INVOKABLE functions. void addConnection(Connection* c); void dropConnection(Connection* c); diff --git a/src/main.cpp b/src/main.cpp index fe6cc3e..d76b24e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -23,10 +23,21 @@ using namespace QMatrixClient; int main(int argc, char *argv[]) { -#if defined(Q_OS_WIN) - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); +#if defined(Q_OS_LINUX) || defined(Q_OS_WIN) || defined(Q_OS_FREEBSD) + if (qgetenv("QT_SCALE_FACTOR").size() == 0) { + QSettings settings("ENCOM", "Spectral"); + float factor = settings.value("Interface/dpi", 100).toFloat() / 100; + + qDebug() << "DPI:" << factor; + + if (factor != -1) + qputenv("QT_SCALE_FACTOR", QString::number(factor).toUtf8()); + } #endif + QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + QApplication app(argc, argv); app.setOrganizationName("ENCOM");