Skip to content

Commit

Permalink
v0.6.2
Browse files Browse the repository at this point in the history
[MpvWidget] workaround for hidpi scaling. This is probably a libmpv bug.
[README] add mpv dependency in addition to libmpv.
  • Loading branch information
easymodo committed Mar 2, 2018
1 parent 0e6d588 commit 9269ccd
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 14 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
qimgv | Current version: 0.6.1
qimgv | Current version: 0.6.2
=====
A cross-platform image viewer with webm support. Written in qt5.

Expand Down Expand Up @@ -75,7 +75,7 @@ If qimgv appears too small / too big on your display, you can override the scale
```
QT_SCALE_FACTOR="1.5" qimgv /path/to/image.png
```
Edit the .desktop file to make it permanent. Using values less than 1.0 may break some things.
You can put it in `qimgv.desktop` file to make it permanent. Using values less than `1.0` may break some things.

## Installation instructions

Expand All @@ -85,7 +85,7 @@ Edit the .desktop file to make it permanent. Using values less than 1.0 may brea

__Others distros (build & install via script):__

1. Install dependencies ( git, cmake, qt5 >= 5.6, libmpv >= 0.22)
1. Install dependencies ( git, cmake, qt5 >= 5.6, libmpv >= 0.22, mpv)
- Ubuntu & derivatives
```
sudo apt install build-essential cmake qt5-default libmpv-dev
Expand Down
6 changes: 4 additions & 2 deletions gui/customwidgets/slidepanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ SlidePanel::SlidePanel(ContainerWidget *parent)
{
// workaround for https://bugreports.qt.io/browse/QTBUG-66387
// TODO: remove this when it'll get fixed. And the QtGlobal include
if( strcmp(qVersion(), "5.10.1") == 0 || strcmp(qVersion(), "5.9.4") == 0) {

// ok i'm not sure when this will get fixed so let's apply this by default for now
//if( strcmp(qVersion(), "5.10.1") == 0 || strcmp(qVersion(), "5.9.4") == 0) {
panelVisibleOpacity = 0.999f;
}
//}

mLayout.setSpacing(0);
mLayout.setContentsMargins(0,0,0,0);
Expand Down
2 changes: 2 additions & 0 deletions gui/viewers/mpvwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ MpvWidget::MpvWidget(QWidget *parent, Qt::WindowFlags f)
mpv::qt::set_option_variant(mpv, "vo", "opengl-cb");
mpv::qt::set_option_variant(mpv, "video-unscaled", "downscale-big");

//mpv::qt::set_option_variant(mpv, "video-pan-x", "0.5");

// Loop video
setRepeat(true);

Expand Down
10 changes: 9 additions & 1 deletion gui/viewers/mpvwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,15 @@ class MpvWidget Q_DECL_FINAL: public QOpenGLWidget
void setOption(const QString &name, const QVariant &value);
void setProperty(const QString& name, const QVariant& value);
QVariant getProperty(const QString& name) const;
QSize sizeHint() const { return QSize(480, 270);}
// Related to this:
// https://github.com/gnome-mpv/gnome-mpv/issues/245
// Let's hope this wont break more than it fixes
int width() const {
return QOpenGLWidget::width() * this->devicePixelRatioF();
}
int height() const {
return QOpenGLWidget::height() * this->devicePixelRatioF();
}
void setMuted(bool mode);
void setRepeat(bool mode);
Q_SIGNALS:
Expand Down
1 change: 1 addition & 0 deletions gui/viewers/videoplayermpv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ bool VideoPlayerMpv::openMedia(Clip *clip) {
return false;
m_mpv->command(QStringList() << "loadfile" << file);
setPaused(false);
//qDebug() << m_mpv->size() << this->devicePixelRatioF();
return true;
}
return false;
Expand Down
12 changes: 9 additions & 3 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,21 @@ void saveSettings() {
}

int main(int argc, char *argv[]) {
//qputenv("QT_AUTO_SCREEN_SCALE_FACTOR","0");
//qputenv("QT_SCREEN_SCALE_FACTORS", "1;1.7");

// I'm not sure what this does but "1" breaks the UI
// Huge widgets but tiny fonts
qputenv("QT_AUTO_SCREEN_SCALE_FACTOR","0");

// for testing purposes
//qputenv("QT_SCALE_FACTOR","1.0");
//qputenv("QT_SCREEN_SCALE_FACTORS", "1;1.7");

QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication a(argc, argv);
QCoreApplication::setOrganizationName("greenpepper software");
QCoreApplication::setOrganizationDomain("github.com/easymodo/qimgv");
QCoreApplication::setApplicationName("qimgv");
QCoreApplication::setApplicationVersion("0.6.1");
QCoreApplication::setApplicationVersion("0.6.2");

// needed for mpv
std::setlocale(LC_NUMERIC, "C");
Expand Down
5 changes: 0 additions & 5 deletions settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ void Settings::validate() {
settings->s.setValue("lastDir",
QDir::homePath());
}
// minimum cache size
if(settings->s.value("cacheSize").toInt() < 32) {
settings->s.setValue("cacheSize", "32");
}

if(!ok) {
qDebug() << "Settings: error reading thumbnail size (int conversion failed).";
qDebug() << "Settings: setting default size.";
Expand Down

0 comments on commit 9269ccd

Please sign in to comment.