[app] Better guess at screen DPI
This commit is contained in:
parent
3ebb82b208
commit
ef19a5c2e7
2 changed files with 15 additions and 8 deletions
|
@ -56,12 +56,7 @@
|
|||
|
||||
#define BOOKS_STATE_FILE_SUFFIX ".state"
|
||||
|
||||
#if defined(__i386__)
|
||||
# define BOOKS_PPI (330) // Tablet 1536x2048
|
||||
#elif defined(__arm__)
|
||||
# define BOOKS_PPI (245) // Jolla1 540x960
|
||||
#else
|
||||
# error Unexpected architechture
|
||||
#endif
|
||||
extern int booksPPI;
|
||||
#define BOOKS_PPI booksPPI
|
||||
|
||||
#endif // BOOKS_DEFS_H
|
||||
|
|
|
@ -74,6 +74,8 @@ const std::string ZLibrary::PathDelimiter(":");
|
|||
const std::string ZLibrary::EndOfLine("\n");
|
||||
const std::string ZLibrary::BaseDirectory;
|
||||
|
||||
int booksPPI = 300;
|
||||
|
||||
void ZLibrary::initLocale()
|
||||
{
|
||||
const char* locale = setlocale(LC_MESSAGES, "");
|
||||
|
@ -167,7 +169,17 @@ void ZLibrary::run(ZLApplication* aApp)
|
|||
|
||||
QQuickView* view = SailfishApp::createView();
|
||||
QQmlContext* root = view->rootContext();
|
||||
root->setContextProperty("PointsPerInch", BOOKS_PPI);
|
||||
QSize screenSize(view->screen()->size());
|
||||
booksPPI =
|
||||
#if defined(__i386__)
|
||||
(screenSize == QSize(1536,2048)) ? 330 : 300;
|
||||
#elif defined(__arm__)
|
||||
(screenSize == QSize(540,960)) ? 245 : 290;
|
||||
#else
|
||||
# error Unexpected architechture
|
||||
#endif
|
||||
HDEBUG("screen" << screenSize << booksPPI << "dpi");
|
||||
root->setContextProperty("PointsPerInch", booksPPI);
|
||||
root->setContextProperty("MaximumHintCount", 1);
|
||||
|
||||
view->setTitle(qtTrId("books-app-name"));
|
||||
|
|
Loading…
Reference in a new issue