]> git.lyx.org Git - lyx.git/commitdiff
#9130 Text in main work area isn't rendered with high resolution
authorStephan Witt <switt@lyx.org>
Sat, 18 Oct 2014 13:50:22 +0000 (15:50 +0200)
committerStephan Witt <switt@lyx.org>
Sat, 18 Oct 2014 13:50:22 +0000 (15:50 +0200)
Load images with search mode check_hidpi to read images with double size when present.

src/frontends/qt4/GuiApplication.cpp
src/frontends/qt4/GuiApplication.h
src/frontends/qt4/GuiToolbar.cpp
src/frontends/qt4/GuiView.cpp

index 2697abeb6146025401edcdb6ed372e02a6b47067..5c56b0a2d08b4dce7ad8b3e473d92a9f28a33546 100644 (file)
@@ -505,13 +505,14 @@ QString iconName(FuncRequest const & f, bool unknown)
 
        QStringList imagedirs;
        imagedirs << "images/" << "images/ipa/";
-       for (int i = 0; i < imagedirs.size(); ++i) { 
+       search_mode mode = theGuiApp()->imageSearchMode();
+       for (int i = 0; i < imagedirs.size(); ++i) {
                QString imagedir = imagedirs.at(i) + path;
-               FileName fname = imageLibFileSearch(imagedir, name1, "png");
+               FileName fname = imageLibFileSearch(imagedir, name1, "png", mode);
                if (fname.exists())
                        return toqstr(fname.absFileName());
 
-               fname = imageLibFileSearch(imagedir, name2, "png");
+               fname = imageLibFileSearch(imagedir, name2, "png", mode);
                if (fname.exists())
                        return toqstr(fname.absFileName());
        }
@@ -540,7 +541,7 @@ QString iconName(FuncRequest const & f, bool unknown)
 
        if (unknown) {
                QString imagedir = "images/";
-               FileName fname = imageLibFileSearch(imagedir, "unknown", "png");
+               FileName fname = imageLibFileSearch(imagedir, "unknown", "png", mode);
                if (fname.exists())
                        return toqstr(fname.absFileName());
                return QString(":/images/unknown.png");
@@ -553,7 +554,7 @@ QPixmap getPixmap(QString const & path, QString const & name, QString const & ex
 {
        QPixmap pixmap;
        QString imagedir = path;
-       FileName fname = imageLibFileSearch(imagedir, name, ext);
+       FileName fname = imageLibFileSearch(imagedir, name, ext, theGuiApp()->imageSearchMode());
        QString path1 = toqstr(fname.absFileName());
        QString path2 = ":/" + path + name + "." + ext;
 
@@ -1040,7 +1041,7 @@ GuiApplication * theGuiApp()
 
 double GuiApplication::pixelRatio() const
 {
-#if QT_VERSION > 0x050000
+#if QT_VERSION >= 0x050000
        return devicePixelRatio();
 #else
        return 1.0;
index 410ccc4426384ff33654b3254b72952af684d459..58a46d67f8d0d5b3795e1a356496a390a70d333b 100644 (file)
@@ -14,6 +14,7 @@
 #define GUIAPPLICATION_H
 
 #include "frontends/Application.h"
+#include "support/filetools.h"
 
 #include <QApplication>
 #include <QList>
@@ -142,7 +143,16 @@ public:
 
        /// Current ratio between physical pixels and device-independent pixels
        double pixelRatio() const;
-       
+
+       /// How to load image files
+       support::search_mode imageSearchMode() const {
+#if QT_VERSION >= 0x050000
+               return support::check_hidpi;
+#else
+               return support::must_exist;
+#endif
+       }
+
        void processKeySym(KeySymbol const & key, KeyModifier state);
        /// return the status bar state string
        docstring viewStatusMessage();
index a80accdddc11a3cb6b04f5bd32da4d7f8e5577ee..6b5170d481974484e387c7c76c0b5c4274633685 100644 (file)
@@ -194,9 +194,10 @@ MenuButton::MenuButton(GuiToolbar * bar, ToolbarItem const & item, bool const st
        QString const name = toqstr(tbitem_.name_);
        QStringList imagedirs;
        imagedirs << "images/math/" << "images/";
-       for (int i = 0; i < imagedirs.size(); ++i) { 
+       for (int i = 0; i < imagedirs.size(); ++i) {
                QString imagedir = imagedirs.at(i);
-               FileName const fname = imageLibFileSearch(imagedir, name, "png");
+               FileName const fname = imageLibFileSearch(imagedir, name, "png",
+                       theGuiApp()->imageSearchMode());
                if (fname.exists()) {
                        setIcon(QIcon(getPixmap(imagedir, name, "png")));
                        break;
index 8c5080763f083cf843a549df18e43b88cc65481a..09a329938cb2d3d57e29dcad32217389edcb0a1d 100644 (file)
@@ -173,7 +173,7 @@ public:
        void paintEvent(QPaintEvent *)
        {
                QRectF r = splash_.rect();
-#if QT_VERSION > 0x050000
+#if QT_VERSION >= 0x050000
                r.setWidth(r.width() / splash_.devicePixelRatio());
                r.setHeight(r.height() / splash_.devicePixelRatio());
 #endif
@@ -477,7 +477,8 @@ GuiView::GuiView(int id)
        // add busy indicator to statusbar
        QLabel * busylabel = new QLabel(statusBar());
        statusBar()->addPermanentWidget(busylabel);
-       QString fn = toqstr(lyx::libFileSearch("images", "busy.gif").absFileName());
+       search_mode mode = theGuiApp()->imageSearchMode();
+       QString fn = toqstr(lyx::libFileSearch("images", "busy", "gif", mode).absFileName());
        QMovie * busyanim = new QMovie(fn, QByteArray(), busylabel);
        busylabel->setMovie(busyanim);
        busyanim->start();
@@ -1211,7 +1212,7 @@ void GuiView::setBusy(bool busy)
 
 double GuiView::pixelRatio() const
 {
-#if QT_VERSION > 0x050000
+#if QT_VERSION >= 0x050000
        return devicePixelRatio();
 #else
        return 1.0;