Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Q scale factor from preferences #3960

Merged
merged 15 commits into from
Sep 14, 2021
Merged

Conversation

daschuer
Copy link
Member

@daschuer daschuer commented Jun 6, 2021

This allows to set the environment variable QT_SCALE_FACTOR from preferences.

Unfortunately it is required to parse mixxx.cfg with custom code before initializing the QApp.
A workaround would be to use a private QT API for HID scaling which is also not nice.

This allows also to scale Mixxx by 50 % on a 200 % System while avoiding to go below 100 % for the overall scaling.

@github-actions github-actions bot added the ui label Jun 6, 2021
src/main.cpp Outdated Show resolved Hide resolved
Copy link
Member

@ronso0 ronso0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just some typos.
will test this soon.

src/preferences/dialog/dlgprefinterface.cpp Outdated Show resolved Hide resolved
src/preferences/dialog/dlgprefinterface.cpp Outdated Show resolved Hide resolved
@daschuer
Copy link
Member Author

Done.

@Holzhaus
Copy link
Member

What is the use case for using a scale factor different from the rest of the system?

@daschuer
Copy link
Member Author

To bee able using the Deere skin on a full HD 15'' device. Windows scales such a device to 150% by default. That works nice for most Applications, but does not work for Mixxx. You can also consider the other way around.
We have many users asking for the env variable trick ...

@ronso0
Copy link
Member

ronso0 commented Jul 14, 2021

What is the use case for using a scale factor different from the rest of the system?

adjust the GUI to increased eye/screen distance when djing.
work setting, laptop on desk: ~0.5m
DJ setting, standing, laptop behind/next to controller: up to 1.0m

src/preferences/dialog/dlgprefinterface.cpp Outdated Show resolved Hide resolved
src/preferences/dialog/dlgprefinterface.cpp Outdated Show resolved Hide resolved
src/preferences/dialog/dlgprefinterface.cpp Outdated Show resolved Hide resolved
@daschuer
Copy link
Member Author

Done.

@coveralls
Copy link

coveralls commented Jul 27, 2021

Pull Request Test Coverage Report for Build 1155856999

  • 6 of 6 (100.0%) changed or added relevant lines in 1 file are covered.
  • 3143 unchanged lines in 45 files lost coverage.
  • Overall coverage decreased (-0.04%) to 25.972%

Files with Coverage Reduction New Missed Lines %
src/engine/controls/cuecontrol.h 1 93.33%
src/engine/sync/internalclock.h 1 80.0%
src/control/controlobject.cpp 2 89.66%
src/engine/positionscratchcontroller.cpp 2 22.95%
src/library/browse/browsetablemodel.cpp 2 0%
src/track/beatgrid.h 2 60.0%
src/engine/controls/enginecontrol.cpp 4 90.32%
src/util/db/dbconnection.cpp 5 69.78%
src/widget/wsearchrelatedtracksmenu.cpp 5 0.68%
src/engine/readaheadmanager.cpp 7 90.83%
Totals Coverage Status
Change from base Build 1087078133: -0.04%
Covered Lines: 20014
Relevant Lines: 77061

💛 - Coveralls

Comment on lines 175 to 179
checkBoxStartFullScreen->setChecked(
m_pConfig
->getValueString(
ConfigKey(kConfigGroup, kStartInFullscreenKey))
.toInt() == 1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are some ugly linebreaks now.
what about this, precommit agrees

Suggested change
checkBoxStartFullScreen->setChecked(
m_pConfig
->getValueString(
ConfigKey(kConfigGroup, kStartInFullscreenKey))
.toInt() == 1);
m_pConfig->getValueString(
ConfigKey(kConfigGroup, kStartInFullscreenKey))
.toInt() == 1);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not make the whole config key a constant? Then the line would be shorter.

@daschuer
Copy link
Member Author

Line breaks improved

@daschuer
Copy link
Member Author

daschuer commented Aug 1, 2021

@uklotzde: merge?

Copy link
Contributor

@uklotzde uklotzde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please resolve the conflicts.

@daschuer
Copy link
Member Author

daschuer commented Aug 1, 2021

Done

src/main.cpp Outdated
QString strScaleFactor;
QString line = in.readLine();
while (!line.isNull()) {
if (line.startsWith(kScaleFactorConfigKey)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you considered using QSettings instead of hacking a new config parser here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, unfortunately the attempt failed because QSettings expects a "=" between key and value, which is not used in our ini file.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. It looks like only the constructor depends on QApplication to construct file paths. Can you just add a ConfigObject static method like ConfigObject::fromFilePath(path)?

src/main.cpp Outdated
@@ -1,11 +1,13 @@
#include <QApplication>
#include <QDir>
#include <QSettings>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QSettings seems to be unused and a left-over from previous experiments?

src/main.cpp Outdated
if (cfgFile.open(QFile::ReadOnly | QFile::Text)) {
QTextStream in(&cfgFile);
QString strScaleFactor;
QString line = in.readLine();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better use in.readLine().trimmed() (here an below) in case users edited their config file manually.

@daschuer
Copy link
Member Author

Done. Now it uses the ConfigObject parser.

@daschuer
Copy link
Member Author

@uklotzde: Please have another look.

src/util/cmdlineargs.h Outdated Show resolved Hide resolved
Copy link
Contributor

@uklotzde uklotzde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Time will tell if this fixes the scaling issues that have been reported frequently. Thank you! LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants