retina settings fixed for os x tray icon

This commit is contained in:
John Preston 2016-02-05 22:53:01 +03:00
parent 2b8ef0e9b2
commit c240295a74
3 changed files with 33 additions and 19 deletions

View File

@ -281,7 +281,7 @@ void Application::singleInstanceChecked() {
} else if (status == SignalHandlers::LastCrashed) {
new LastCrashedWindow();
} else {
new AppClass();
Sandboxer::startSandbox();
}
}
}
@ -636,13 +636,38 @@ namespace Sandboxer {
}
}
#endif
void connect(const char *signal, QObject *object, const char *method) {
if (Application *a = application()) {
a->connect(a, signal, object, method);
}
}
#endif
void startSandbox() {
t_assert(application() != 0);
float64 dpi = Application::primaryScreen()->logicalDotsPerInch();
if (dpi <= 108) { // 0-96-108
cSetScreenScale(dbisOne);
} else if (dpi <= 132) { // 108-120-132
cSetScreenScale(dbisOneAndQuarter);
} else if (dpi <= 168) { // 132-144-168
cSetScreenScale(dbisOneAndHalf);
} else { // 168-192-inf
cSetScreenScale(dbisTwo);
}
if (application()->devicePixelRatio() > 1) {
cSetRetina(true);
cSetRetinaFactor(application()->devicePixelRatio());
cSetIntRetinaFactor(int32(cRetinaFactor()));
cSetConfigScale(dbisOne);
cSetRealScale(dbisOne);
}
new AppClass();
}
}
@ -667,21 +692,7 @@ AppClass::AppClass() : QObject()
application()->installEventFilter(new EventFilterForKeys(this));
float64 dpi = QApplication::primaryScreen()->logicalDotsPerInch();
if (dpi <= 108) { // 0-96-108
cSetScreenScale(dbisOne);
} else if (dpi <= 132) { // 108-120-132
cSetScreenScale(dbisOneAndQuarter);
} else if (dpi <= 168) { // 132-144-168
cSetScreenScale(dbisOneAndHalf);
} else { // 168-192-inf
cSetScreenScale(dbisTwo);
}
if (application()->devicePixelRatio() > 1) {
cSetRetina(true);
cSetRetinaFactor(application()->devicePixelRatio());
cSetIntRetinaFactor(int32(cRetinaFactor()));
if (cRetina()) {
cSetConfigScale(dbisOne);
cSetRealScale(dbisOne);
}

View File

@ -128,10 +128,13 @@ namespace Sandboxer {
void updateProgress(qint64 ready, qint64 total);
void updateFailed();
void updateReady();
void connect(const char *signal, QObject *object, const char *method);
#endif
void connect(const char *signal, QObject *object, const char *method);
void startSandbox();
}
class MainWidget;

View File

@ -2692,7 +2692,7 @@ void LastCrashedWindow::onContinue() {
if (SignalHandlers::restart() == SignalHandlers::CantOpen) {
new NotStartedWindow();
} else {
new AppClass();
Sandboxer::startSandbox();
}
close();
}