Skip to content
This repository has been archived by the owner on May 16, 2020. It is now read-only.

Commit

Permalink
!
Browse files Browse the repository at this point in the history
  • Loading branch information
Antti Lamminsalo committed Feb 27, 2016
1 parent 0a7958c commit 13f80f6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
12 changes: 5 additions & 7 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "systray.h"
#include "customapp.h"
#include "util/notificationmaker.h"
#include <QProcessEnvironment>

int main(int argc, char *argv[])
{
Expand Down Expand Up @@ -44,17 +45,17 @@ int main(int argc, char *argv[])

Power *power = new Power();

QQuickView view;
QQmlApplicationEngine engine;

#ifdef Q_OS_WIN
qreal dpiMultiplier = QGuiApplication::primaryScreen()->physicalDotsPerInch() * QGuiApplication::primaryScreen()->devicePixelRatio() / 96;
qreal dpiMultiplier = QGuiApplication::primaryScreen()->logicalDotsPerInch() / 96;

#elif defined(Q_OS_LINUX)
qreal dpiMultiplier = QGuiApplication::primaryScreen()->physicalDotsPerInch() * QGuiApplication::primaryScreen()->devicePixelRatio() / 72;
qreal dpiMultiplier = QGuiApplication::primaryScreen()->logicalDotsPerInch() / 72;

#endif

qDebug() <<"Multiplier: "<< dpiMultiplier;
qDebug() <<"DPI mult: "<< dpiMultiplier;

qDebug() << "Setting context variables...";
engine.rootContext()->setContextProperty("dpiMultiplier", dpiMultiplier);
Expand All @@ -70,9 +71,6 @@ int main(int argc, char *argv[])
std::setlocale(LC_NUMERIC, "C");
qmlRegisterType<MpvObject>("mpv", 1, 0, "MpvObject");

// QQmlComponent component(app.con, QUrl(QStringLiteral("qrc:/NotificationMaker.qml")));
//QObject *notificator = component.create();
//engine.load(QUrl("qrc:/NotificationMaker.qml"));
engine.load(QUrl("qrc:/main.qml"));

//Set up notifications
Expand Down
4 changes: 2 additions & 2 deletions src/qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import "style"
ApplicationWindow {
id: root
visible: true
width: dp(1600)
height: dp(1200)
height: Screen.height * 0.8
width: height * 1.6
title: "Orion"
//flags: Qt.FramelessWindowHint | Qt.Window
visibility: g_fullscreen ? "FullScreen" : "Windowed"
Expand Down
3 changes: 1 addition & 2 deletions src/qml/style/Dpi.qml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ Item {
//readonly property real dpiMult: (6.192510402219141 / Screen.pixelDensity * Screen.devicePixelRatio)

function scale(val){
//return val;
return Math.ceil(val * 0.666)
return Math.ceil(val * dpiMultiplier * .666)
}

}
Expand Down

0 comments on commit 13f80f6

Please sign in to comment.