Changes to accommodate for high DPI

Not sure how this will work on Linux or macOS.
This commit is contained in:
Pengfei
2021-06-27 18:46:08 +08:00
parent 412aeaa0d4
commit 3db1c43fd6
8 changed files with 25 additions and 21 deletions
+5
View File
@@ -6,6 +6,7 @@
#include <cmath> #include <cmath>
#include <unordered_map> #include <unordered_map>
#include <QCheckBox> #include <QCheckBox>
#include <QDesktopWidget>
#include <QFileDialog> #include <QFileDialog>
#include <QFutureWatcher> #include <QFutureWatcher>
#include <QMenu> #include <QMenu>
@@ -94,6 +95,10 @@ ImportDialog::ImportDialog(QWidget* parent, const Core::Config& config)
qRegisterMetaType<Core::ContentSpecifier>(); qRegisterMetaType<Core::ContentSpecifier>();
ui->setupUi(this); ui->setupUi(this);
const double scale = qApp->desktop()->logicalDpiX() / 96.0;
resize(static_cast<int>(width() * scale), static_cast<int>(height() * scale));
if (!importer.IsGood()) { if (!importer.IsGood()) {
QMessageBox::critical( QMessageBox::critical(
this, tr("Importer Error"), this, tr("Importer Error"),
+2 -2
View File
@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>700</width> <width>560</width>
<height>400</height> <height>320</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
+4
View File
@@ -5,6 +5,7 @@
#include <regex> #include <regex>
#include <string> #include <string>
#include <QApplication> #include <QApplication>
#include <QDesktopWidget>
#include <QFileDialog> #include <QFileDialog>
#include <QMessageBox> #include <QMessageBox>
#include <QStorageInfo> #include <QStorageInfo>
@@ -38,6 +39,9 @@ bool IsConfigGood(const Core::Config& config) {
MainDialog::MainDialog(QWidget* parent) : QDialog(parent), ui(std::make_unique<Ui::MainDialog>()) { MainDialog::MainDialog(QWidget* parent) : QDialog(parent), ui(std::make_unique<Ui::MainDialog>()) {
ui->setupUi(this); ui->setupUi(this);
const double scale = qApp->desktop()->logicalDpiX() / 96.0;
resize(static_cast<int>(width() * scale), static_cast<int>(height() * scale));
ui->buttonBox->button(QDialogButtonBox::StandardButton::Ok)->setEnabled(false); ui->buttonBox->button(QDialogButtonBox::StandardButton::Ok)->setEnabled(false);
ui->buttonBox->button(QDialogButtonBox::StandardButton::Reset)->setText(tr("Refresh")); ui->buttonBox->button(QDialogButtonBox::StandardButton::Reset)->setText(tr("Refresh"));
+2 -15
View File
@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>800</width> <width>640</width>
<height>320</height> <height>256</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@@ -79,19 +79,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
<resources/> <resources/>
+4
View File
@@ -2,6 +2,7 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <QDesktopWidget>
#include <QFileDialog> #include <QFileDialog>
#include <QMessageBox> #include <QMessageBox>
#include "frontend/select_files_dialog.h" #include "frontend/select_files_dialog.h"
@@ -13,6 +14,9 @@ SelectFilesDialog::SelectFilesDialog(QWidget* parent, bool source_is_dir_, bool
ui->setupUi(this); ui->setupUi(this);
const double scale = qApp->desktop()->logicalDpiX() / 96.0;
resize(static_cast<int>(width() * scale), static_cast<int>(height() * scale));
connect(ui->buttonBox, &QDialogButtonBox::accepted, [this] { connect(ui->buttonBox, &QDialogButtonBox::accepted, [this] {
if (ui->source->text().isEmpty() || ui->destination->text().isEmpty()) { if (ui->source->text().isEmpty() || ui->destination->text().isEmpty()) {
QMessageBox::warning(this, tr("Warning"), tr("Please fill in all the fields.")); QMessageBox::warning(this, tr("Warning"), tr("Please fill in all the fields."));
+2 -2
View File
@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>600</width> <width>480</width>
<height>120</height> <height>96</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
+4
View File
@@ -2,6 +2,7 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <QDesktopWidget>
#include <QFileDialog> #include <QFileDialog>
#include <QFutureWatcher> #include <QFutureWatcher>
#include <QMessageBox> #include <QMessageBox>
@@ -21,6 +22,9 @@ UtilitiesDialog::UtilitiesDialog(QWidget* parent)
ui->setupUi(this); ui->setupUi(this);
const double scale = qApp->desktop()->logicalDpiX() / 96.0;
resize(static_cast<int>(width() * scale), static_cast<int>(height() * scale));
connect(ui->useSdDecryption, &QCheckBox::clicked, [this] { connect(ui->useSdDecryption, &QCheckBox::clicked, [this] {
const bool checked = ui->useSdDecryption->isChecked(); const bool checked = ui->useSdDecryption->isChecked();
+2 -2
View File
@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>800</width> <width>640</width>
<height>480</height> <height>384</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">