- fix: Icon size not correct under macOS high DPI / zoom factor settings.
- enhancement: "Icon zoom" in options / environment / appearance
This commit is contained in:
parent
b54a203619
commit
ed89690f7a
2
NEWS.md
2
NEWS.md
|
@ -18,6 +18,8 @@ Red Panda C++ Version 2.7
|
|||
- enhancement: Generate assembly is not correctly disabled when current file is not C/C++.
|
||||
- change: Disable "Copy Limit" int "options"/"editor"/"Copy/Export" by default.
|
||||
- fix: Project's "static link" option is overwrited by global compiler set settings, when project options dialog is opened.
|
||||
- fix: Icon size not correct under macOS high DPI / zoom factor settings.
|
||||
- enhancement: "Icon zoom" in options / environment / appearance
|
||||
|
||||
Red Panda C++ Version 2.6
|
||||
|
||||
|
|
|
@ -488,7 +488,10 @@ void MainWindow::updateStatusbarForLineCol(bool clear)
|
|||
|
||||
void MainWindow::updateEditorSettings()
|
||||
{
|
||||
pIconsManager->updateEditorGuttorIcons(pSettings->environment().iconSet(),pointToPixel(pSettings->editor().fontSize()));
|
||||
pIconsManager->updateEditorGuttorIcons(
|
||||
pSettings->environment().iconSet(),
|
||||
calIconSize(pSettings->editor().fontName(),pSettings->editor().fontSize())
|
||||
);
|
||||
mEditorList->applySettings();
|
||||
}
|
||||
|
||||
|
@ -841,7 +844,11 @@ void MainWindow::applySettings()
|
|||
pIconsManager->prepareCustomIconSet(customIconSetFolder);
|
||||
pIconsManager->setIconSetsFolder(customIconSetFolder);
|
||||
}
|
||||
pIconsManager->updateParserIcons(pSettings->environment().iconSet(),pointToPixel(pSettings->environment().interfaceFontSize()));
|
||||
pIconsManager->updateParserIcons(
|
||||
pSettings->environment().iconSet(),
|
||||
calIconSize(
|
||||
pSettings->environment().interfaceFont(),
|
||||
pSettings->environment().interfaceFontSize()));
|
||||
|
||||
QFont caseEditorFont(pSettings->executor().caseEditorFontName());
|
||||
caseEditorFont.setPixelSize(pointToPixel(pSettings->executor().caseEditorFontSize()));
|
||||
|
@ -881,7 +888,11 @@ void MainWindow::applySettings()
|
|||
updateActionIcons();
|
||||
|
||||
//icon sets for files view
|
||||
pIconsManager->updateFileSystemIcons(pSettings->environment().iconSet(),pointToPixel(pSettings->environment().interfaceFontSize()));
|
||||
pIconsManager->updateFileSystemIcons(
|
||||
pSettings->environment().iconSet(),
|
||||
calIconSize(
|
||||
pSettings->environment().interfaceFont(),
|
||||
pSettings->environment().interfaceFontSize()));
|
||||
if (!mFileSystemModel.rootPath().isEmpty() && mFileSystemModel.rootPath()!=".")
|
||||
setFilesViewRoot(pSettings->environment().currentFolder());
|
||||
// for (int i=0;i<ui->cbFilesPath->count();i++) {
|
||||
|
@ -1007,6 +1018,13 @@ void MainWindow::onFileSaved(const QString &path, bool inProject)
|
|||
//updateForEncodingInfo();
|
||||
}
|
||||
|
||||
int MainWindow::calIconSize(const QString &fontName, int fontPointSize)
|
||||
{
|
||||
QFont font(fontName,fontPointSize);
|
||||
QFontMetrics metrics(font);
|
||||
return metrics.ascent();
|
||||
}
|
||||
|
||||
void MainWindow::prepareSearchDialog()
|
||||
{
|
||||
if (!mSearchDialog)
|
||||
|
@ -1593,7 +1611,9 @@ void MainWindow::updateDebuggerSettings()
|
|||
|
||||
void MainWindow::updateActionIcons()
|
||||
{
|
||||
int size = pointToPixel(pSettings->environment().interfaceFontSize());
|
||||
int size = calIconSize(
|
||||
pSettings->environment().interfaceFont(),
|
||||
pSettings->environment().interfaceFontSize())*pSettings->environment().iconZoomFactor();
|
||||
pIconsManager->updateActionIcons(pSettings->environment().iconSet(), size);
|
||||
QSize iconSize(size,size);
|
||||
ui->toolbarMain->setIconSize(iconSize);
|
||||
|
@ -2810,7 +2830,9 @@ void MainWindow::initToolButtons()
|
|||
hlayout->setContentsMargins(2,2,2,2);
|
||||
mClassBrowserToolbar->setLayout(hlayout);
|
||||
QToolButton * toolButton;
|
||||
int size = pointToPixel(pSettings->environment().interfaceFontSize());
|
||||
int size = calIconSize(
|
||||
pSettings->environment().interfaceFont(),
|
||||
pSettings->environment().interfaceFontSize())*pSettings->environment().iconZoomFactor();
|
||||
QSize iconSize(size,size);
|
||||
toolButton = new QToolButton;
|
||||
toolButton->setIconSize(iconSize);
|
||||
|
@ -2835,7 +2857,9 @@ void MainWindow::initToolButtons()
|
|||
{
|
||||
QHBoxLayout* hlayout = dynamic_cast<QHBoxLayout*>(ui->panelFiles->layout());
|
||||
QToolButton * toolButton;
|
||||
int size = pointToPixel(pSettings->environment().interfaceFontSize());
|
||||
int size = calIconSize(
|
||||
pSettings->environment().interfaceFont(),
|
||||
pSettings->environment().interfaceFontSize())*pSettings->environment().iconZoomFactor();
|
||||
QSize iconSize(size,size);
|
||||
toolButton = new QToolButton;
|
||||
toolButton->setIconSize(iconSize);
|
||||
|
|
|
@ -258,6 +258,7 @@ public slots:
|
|||
void onFileSaved(const QString& path, bool inProject);
|
||||
|
||||
private:
|
||||
int calIconSize(const QString &fontName, int fontPointSize);
|
||||
void prepareSearchDialog();
|
||||
void prepareReplaceDialog();
|
||||
void prepareProjectForCompile();
|
||||
|
|
|
@ -332,6 +332,11 @@ int Settings::_Base::intValue(const QString &key, int defaultValue)
|
|||
return value(key,defaultValue).toInt();
|
||||
}
|
||||
|
||||
double Settings::_Base::doubleValue(const QString &key, double defaultValue)
|
||||
{
|
||||
return value(key,defaultValue).toDouble();
|
||||
}
|
||||
|
||||
unsigned int Settings::_Base::uintValue(const QString &key, unsigned int defaultValue)
|
||||
{
|
||||
return value(key,defaultValue).toUInt();
|
||||
|
@ -3268,6 +3273,7 @@ void Settings::Environment::doLoad()
|
|||
}
|
||||
mInterfaceFont = stringValue("interface_font",defaultFontName);
|
||||
mInterfaceFontSize = intValue("interface_font_size",11);
|
||||
mIconZoomFactor = doubleValue("icon_zoom_factor",1.0);
|
||||
mLanguage = stringValue("language", defaultLocaleName);
|
||||
mIconSet = stringValue("icon_set","contrast");
|
||||
mUseCustomIconSet = boolValue("use_custom_icon_set", false);
|
||||
|
@ -3408,12 +3414,23 @@ void Settings::Environment::setOpenFilesInSingleInstance(bool newOpenFilesInSing
|
|||
mOpenFilesInSingleInstance = newOpenFilesInSingleInstance;
|
||||
}
|
||||
|
||||
double Settings::Environment::iconZoomFactor() const
|
||||
{
|
||||
return mIconZoomFactor;
|
||||
}
|
||||
|
||||
void Settings::Environment::setIconZoomFactor(double newIconZoomFactor)
|
||||
{
|
||||
mIconZoomFactor = newIconZoomFactor;
|
||||
}
|
||||
|
||||
void Settings::Environment::doSave()
|
||||
{
|
||||
//Appearence
|
||||
saveValue("theme", mTheme);
|
||||
saveValue("interface_font", mInterfaceFont);
|
||||
saveValue("interface_font_size", mInterfaceFontSize);
|
||||
saveValue("icon_zoom_factor",mIconZoomFactor);
|
||||
saveValue("language", mLanguage);
|
||||
saveValue("icon_set",mIconSet);
|
||||
saveValue("use_custom_icon_set", mUseCustomIconSet);
|
||||
|
|
|
@ -69,6 +69,7 @@ private:
|
|||
bool boolValue(const QString &key, bool defaultValue);
|
||||
QSize sizeValue(const QString &key);
|
||||
int intValue(const QString &key, int defaultValue);
|
||||
double doubleValue(const QString& key, double defaultValue);
|
||||
unsigned int uintValue(const QString &key, unsigned int defaultValue);
|
||||
QStringList stringListValue(const QString &key, const QStringList& defaultValue=QStringList());
|
||||
QSet<QString> stringSetValue(const QString &key);
|
||||
|
@ -559,12 +560,16 @@ public:
|
|||
bool openFilesInSingleInstance() const;
|
||||
void setOpenFilesInSingleInstance(bool newOpenFilesInSingleInstance);
|
||||
|
||||
double iconZoomFactor() const;
|
||||
void setIconZoomFactor(double newIconZoomFactor);
|
||||
|
||||
private:
|
||||
|
||||
//Appearence
|
||||
QString mTheme;
|
||||
QString mInterfaceFont;
|
||||
int mInterfaceFontSize;
|
||||
double mIconZoomFactor;
|
||||
QString mLanguage;
|
||||
QString mCurrentFolder;
|
||||
QString mIconSet;
|
||||
|
|
|
@ -52,6 +52,7 @@ void EnvironmentAppearenceWidget::doLoad()
|
|||
break;
|
||||
}
|
||||
}
|
||||
ui->spinZoomFactor->setValue(pSettings->environment().iconZoomFactor());
|
||||
ui->chkUseCustomIconSet->setChecked(pSettings->environment().useCustomIconSet());
|
||||
ui->chkUseCustomTheme->setChecked(pSettings->environment().useCustomTheme());
|
||||
|
||||
|
@ -79,6 +80,8 @@ void EnvironmentAppearenceWidget::doSave()
|
|||
pSettings->environment().setInterfaceFontSize(ui->spinFontSize->value());
|
||||
pSettings->environment().setLanguage(ui->cbLanguage->currentData().toString());
|
||||
pSettings->environment().setIconSet(ui->cbIconSet->currentData().toString());
|
||||
pSettings->environment().setIconZoomFactor(ui->spinZoomFactor->value());
|
||||
|
||||
pSettings->environment().setUseCustomIconSet(ui->chkUseCustomIconSet->isChecked());
|
||||
pSettings->environment().setUseCustomTheme(ui->chkUseCustomTheme->isChecked());
|
||||
|
||||
|
|
|
@ -14,71 +14,10 @@
|
|||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Font:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QWidget" name="widget_4" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QComboBox" name="cbLanguage"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>*Needs restart</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Theme:</string>
|
||||
<string>Icon Set:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -120,18 +59,58 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Language:</string>
|
||||
<string>Font:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Font Size:</string>
|
||||
<item row="7" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QWidget" name="widget_3" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinFontSize"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
|
@ -175,44 +154,17 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QWidget" name="widget_3" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinFontSize"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Theme:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Icon Set:</string>
|
||||
<string>Font Size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -257,6 +209,111 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Language:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QWidget" name="widget_4" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QComboBox" name="cbLanguage"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>*Needs restart</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Icon Zoom:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QWidget" name="widget_6" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="spinZoomFactor">
|
||||
<property name="decimals">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>5.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
|
|
@ -113,6 +113,9 @@ void SettingsWidget::connectInputs()
|
|||
for (QSpinBox* p:findChildren<QSpinBox*>()) {
|
||||
connect(p, QOverload<int>::of(&QSpinBox::valueChanged), this, &SettingsWidget::setSettingsChanged);
|
||||
}
|
||||
for (QDoubleSpinBox* p:findChildren<QDoubleSpinBox*>()) {
|
||||
connect(p, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &SettingsWidget::setSettingsChanged);
|
||||
}
|
||||
for (ColorEdit* p:findChildren<ColorEdit*>()) {
|
||||
connect(p, &ColorEdit::colorChanged, this, &SettingsWidget::setSettingsChanged);
|
||||
}
|
||||
|
@ -148,6 +151,10 @@ void SettingsWidget::disconnectInputs()
|
|||
for (QSpinBox* p:findChildren<QSpinBox*>()) {
|
||||
disconnect(p, QOverload<int>::of(&QSpinBox::valueChanged), this, &SettingsWidget::setSettingsChanged);
|
||||
}
|
||||
for (QDoubleSpinBox* p:findChildren<QDoubleSpinBox*>()) {
|
||||
disconnect(p, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &SettingsWidget::setSettingsChanged);
|
||||
}
|
||||
|
||||
for (ColorEdit* p:findChildren<ColorEdit*>()) {
|
||||
disconnect(p, &ColorEdit::colorChanged, this, &SettingsWidget::setSettingsChanged);
|
||||
}
|
||||
|
|
|
@ -1698,6 +1698,10 @@
|
|||
<source>Traditional Chinese</source>
|
||||
<translation>Chinês tradicional</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Icon Zoom:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>EnvironmentFileAssociationWidget</name>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1575,6 +1575,10 @@
|
|||
<source>Traditional Chinese</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Icon Zoom:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>EnvironmentFileAssociationWidget</name>
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
#include <QDirIterator>
|
||||
#ifdef Q_OS_WIN
|
||||
#include <QDirIterator>
|
||||
#include <QFont>
|
||||
#include <QFontMetrics>
|
||||
#include <QMimeDatabase>
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
@ -718,3 +720,5 @@ QStringList absolutePaths(const QString &dirPath, const QStringList &relativePat
|
|||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue