1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-06-25 22:09:35 +00:00

Add support for crop in GUI

This commit is contained in:
Sergey Lipskiy 2016-09-10 21:08:31 +07:00
parent aab6726117
commit 35cca6dc4c
4 changed files with 168 additions and 70 deletions

View File

@ -30,7 +30,7 @@ struct
{ 1440, 1080, "1440 x 1080" },
{ 1600, 1024, "1600 x 1024" },
{ 1600, 1200, "1600 x 1200" },
{ 640, 480, "custom" }
{ 640, 480, "Custom" }
};
static
const unsigned int numWindowedModes = sizeof(WindowedModes) / sizeof(WindowedModes[0]);
@ -79,6 +79,11 @@ void ConfigDialog::_init()
}
ui->windowedResolutionComboBox->insertItems(0, windowedModesList);
ui->windowedResolutionComboBox->setCurrentIndex(windowedModesCurrent);
ui->cropImageComboBox->setCurrentIndex(config.video.cropMode);
ui->cropImageWidthSpinBox->setValue(config.video.cropWidth);
ui->cropImageWidthSpinBox->setEnabled(config.video.cropMode == Config::cmCustom);
ui->cropImageHeightSpinBox->setValue(config.video.cropHeight);
ui->cropImageHeightSpinBox->setEnabled(config.video.cropMode == Config::cmCustom);
QStringList fullscreenModesList, fullscreenRatesList;
int fullscreenMode, fullscreenRate;
@ -306,6 +311,10 @@ void ConfigDialog::accept()
getFullscreenResolutions(ui->fullScreenResolutionComboBox->currentIndex(), config.video.fullscreenWidth, config.video.fullscreenHeight);
getFullscreenRefreshRate(ui->fullScreenRefreshRateComboBox->currentIndex(), config.video.fullscreenRefresh);
config.video.cropMode = ui->cropImageComboBox->currentIndex();
config.video.cropWidth = ui->cropImageWidthSpinBox->value();
config.video.cropHeight = ui->cropImageHeightSpinBox->value();
config.video.multisampling = ui->aliasingSlider->value();
config.texture.maxAnisotropy = ui->anisotropicSlider->value();
config.texture.maxBytes = ui->cacheSizeSpinBox->value() * gc_uMegabyte;
@ -518,3 +527,10 @@ void ConfigDialog::on_nativeRes2D_checkBox_toggled(bool checked)
ui->fixTexrectSmartRadioButton->setEnabled(!checked);
ui->fixTexrectForceRadioButton->setEnabled(!checked);
}
void ConfigDialog::on_cropImageComboBox_currentIndexChanged(int index)
{
const bool bCustom = index == Config::cmCustom;
ui->cropImageWidthSpinBox->setEnabled(bCustom);
ui->cropImageHeightSpinBox->setEnabled(bCustom);
}

View File

@ -39,6 +39,8 @@ private slots:
void on_nativeRes2D_checkBox_toggled(bool checked);
void on_cropImageComboBox_currentIndexChanged(int index);
private:
void _init();
void _getTranslations(QStringList & _translationFiles) const;

View File

@ -26,6 +26,9 @@ void _loadSettings(QSettings & settings)
config.video.windowedHeight = settings.value("windowedHeight", config.video.windowedHeight).toInt();
config.video.fullscreenRefresh = settings.value("fullscreenRefresh", config.video.fullscreenRefresh).toInt();
config.video.multisampling = settings.value("multisampling", config.video.multisampling).toInt();
config.video.cropMode = settings.value("cropMode", config.video.cropMode).toInt();
config.video.cropWidth = settings.value("cropWidth", config.video.cropWidth).toInt();
config.video.cropHeight = settings.value("cropHeight", config.video.cropHeight).toInt();
settings.endGroup();
settings.beginGroup("texture");
@ -142,6 +145,9 @@ void writeSettings(const QString & _strIniFolder)
settings.setValue("windowedHeight", config.video.windowedHeight);
settings.setValue("fullscreenRefresh", config.video.fullscreenRefresh);
settings.setValue("multisampling", config.video.multisampling);
settings.setValue("cropMode", config.video.cropMode);
settings.setValue("cropWidth", config.video.cropWidth);
settings.setValue("cropHeight", config.video.cropHeight);
settings.endGroup();
settings.beginGroup("texture");

View File

@ -47,7 +47,7 @@
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="0">
<item row="0" column="0">
<widget class="QLabel" name="fullScreenResolutionLabel">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Full screen resolution:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;This sets the full screen resolution. All the resolutions that your video card/monitor supports should be displayed.&lt;/p&gt;&lt;p&gt;[Recommended: &lt;span style=&quot; font-style:italic;&quot;&gt;native (max) resolution of your monitor - unless performance becomes an issue&lt;/span&gt;]&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
@ -57,14 +57,21 @@
</property>
</widget>
</item>
<item row="1" column="2">
<item row="0" column="2">
<widget class="QComboBox" name="fullScreenRefreshRateComboBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Full screen resolution:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;This sets the full screen resolution. All the resolutions that your video card/monitor supports should be displayed.&lt;/p&gt;&lt;p&gt;[Recommended: &lt;span style=&quot; font-style:italic;&quot;&gt;native (max) resolution of your monitor - unless performance becomes an issue&lt;/span&gt;]&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="2" column="0">
<item row="1" column="1">
<widget class="QComboBox" name="windowedResolutionComboBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Resolution:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;This option selects resolution for windowed mode. You also may select &lt;span style=&quot; font-style:italic;&quot;&gt;custom&lt;/span&gt; and enter necessary window sizes.&lt;/p&gt;&lt;p&gt;[Recommended: &lt;span style=&quot; font-style:italic;&quot;&gt;640x480, 800x600, 1024x768&lt;/span&gt;]&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="windowedResolutionLabel">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Resolution:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;This option selects resolution for windowed mode. You also may select &lt;span style=&quot; font-style:italic;&quot;&gt;custom&lt;/span&gt; and enter necessary window sizes.&lt;/p&gt;&lt;p&gt;[Recommended: &lt;span style=&quot; font-style:italic;&quot;&gt;640x480, 800x600, 1024x768&lt;/span&gt;]&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
@ -74,37 +81,10 @@
</property>
</widget>
</item>
<item row="1" column="1">
<item row="0" column="1">
<widget class="QComboBox" name="fullScreenResolutionComboBox"/>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_18">
<property name="text">
<string>Refresh rate:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_17">
<property name="text">
<string>Resolution:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="windowedResolutionComboBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Resolution:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;This option selects resolution for windowed mode. You also may select &lt;span style=&quot; font-style:italic;&quot;&gt;custom&lt;/span&gt; and enter necessary window sizes.&lt;/p&gt;&lt;p&gt;[Recommended: &lt;span style=&quot; font-style:italic;&quot;&gt;640x480, 800x600, 1024x768&lt;/span&gt;]&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="2" column="2">
<item row="1" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_21">
<item>
<widget class="QLabel" name="label_32">
@ -148,6 +128,100 @@
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_35">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Crop image:&lt;/span&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;This option allows user to crop black boarders from resulted image. It has two modes:&lt;br/&gt;&lt;br/&gt;* Auto - plugin sets crop automatically using game's frame scissor.&lt;/p&gt;&lt;p&gt;* Custom - crop using user defined vaules. User should set number of pixels to crop from original native-res image.&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Crop image&lt;span style=&quot; vertical-align:super;&quot;&gt;*:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="cropImageComboBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Crop image:&lt;/span&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;This option allows user to crop black boarders from resulted image. It has two modes:&lt;br/&gt;&lt;br/&gt;* Auto - plugin sets crop automatically using game's frame scissor.&lt;/p&gt;&lt;p&gt;* Custom - crop using user defined vaules. User should set number of pixels to crop from original native-res image.&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>
<item>
<property name="text">
<string>Disable</string>
</property>
</item>
<item>
<property name="text">
<string>Auto</string>
</property>
</item>
<item>
<property name="text">
<string>Custom</string>
</property>
</item>
</widget>
</item>
<item row="2" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_23">
<item>
<widget class="QLabel" name="label_36">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Crop image:&lt;/span&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;This option allows user to crop black boarders from resulted image. It has two modes:&lt;br/&gt;&lt;br/&gt;* Auto - plugin sets crop automatically using game's frame scissor.&lt;/p&gt;&lt;p&gt;* Custom - crop using user defined vaules. User should set number of pixels to crop from original native-res image.&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>
<property name="text">
<string>W:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="cropImageWidthSpinBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Crop image:&lt;/span&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;This option allows user to crop black boarders from resulted image. It has two modes:&lt;br/&gt;&lt;br/&gt;* Auto - plugin sets crop automatically using game's frame scissor.&lt;/p&gt;&lt;p&gt;* Custom - crop using user defined vaules. User should set number of pixels to crop from original native-res image.&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>
<property name="maximum">
<number>64</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_37">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Crop image:&lt;/span&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;This option allows user to crop black boarders from resulted image. It has two modes:&lt;br/&gt;&lt;br/&gt;* Auto - plugin sets crop automatically using game's frame scissor.&lt;/p&gt;&lt;p&gt;* Custom - crop using user defined vaules. User should set number of pixels to crop from original native-res image.&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>
<property name="text">
<string>H:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="cropImageHeightSpinBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Crop image:&lt;/span&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;This option allows user to crop black boarders from resulted image. It has two modes:&lt;br/&gt;&lt;br/&gt;* Auto - plugin sets crop automatically using game's frame scissor.&lt;/p&gt;&lt;p&gt;* Custom - crop using user defined vaules. User should set number of pixels to crop from original native-res image.&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>
<property name="maximum">
<number>48</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
@ -1816,8 +1890,8 @@
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>351</x>
<y>602</y>
<x>360</x>
<y>710</y>
</hint>
<hint type="destinationlabel">
<x>316</x>
@ -1832,8 +1906,8 @@
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>331</x>
<y>602</y>
<x>340</x>
<y>710</y>
</hint>
<hint type="destinationlabel">
<x>276</x>
@ -1848,12 +1922,12 @@
<slot>setNum(int)</slot>
<hints>
<hint type="sourcelabel">
<x>107</x>
<y>347</y>
<x>122</x>
<y>453</y>
</hint>
<hint type="destinationlabel">
<x>459</x>
<y>346</y>
<x>529</x>
<y>452</y>
</hint>
</hints>
</connection>
@ -1864,12 +1938,12 @@
<slot>setNum(int)</slot>
<hints>
<hint type="sourcelabel">
<x>107</x>
<y>243</y>
<x>122</x>
<y>334</y>
</hint>
<hint type="destinationlabel">
<x>459</x>
<y>242</y>
<x>529</x>
<y>333</y>
</hint>
</hints>
</connection>
@ -1880,12 +1954,12 @@
<slot>setNum(int)</slot>
<hints>
<hint type="sourcelabel">
<x>219</x>
<y>96</y>
<x>362</x>
<y>138</y>
</hint>
<hint type="destinationlabel">
<x>459</x>
<y>115</y>
<x>535</x>
<y>138</y>
</hint>
</hints>
</connection>
@ -1896,12 +1970,12 @@
<slot>setNum(int)</slot>
<hints>
<hint type="sourcelabel">
<x>216</x>
<y>126</y>
<x>359</x>
<y>178</y>
</hint>
<hint type="destinationlabel">
<x>459</x>
<y>148</y>
<x>535</x>
<y>178</y>
</hint>
</hints>
</connection>
@ -1912,12 +1986,12 @@
<slot>setNum(int)</slot>
<hints>
<hint type="sourcelabel">
<x>147</x>
<y>161</y>
<x>290</x>
<y>218</y>
</hint>
<hint type="destinationlabel">
<x>459</x>
<y>181</y>
<x>535</x>
<y>218</y>
</hint>
</hints>
</connection>
@ -1928,12 +2002,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>102</x>
<y>226</y>
<x>130</x>
<y>283</y>
</hint>
<hint type="destinationlabel">
<x>173</x>
<y>258</y>
<x>269</x>
<y>317</y>
</hint>
</hints>
</connection>
@ -1944,23 +2018,23 @@
<slot>setNum(int)</slot>
<hints>
<hint type="sourcelabel">
<x>400</x>
<y>168</y>
<x>415</x>
<y>267</y>
</hint>
<hint type="destinationlabel">
<x>457</x>
<y>174</y>
<x>529</x>
<y>266</y>
</hint>
</hints>
</connection>
</connections>
<buttongroups>
<buttongroup name="bilinearButtonGroup"/>
<buttongroup name="copyDepthBufferButtonGroup"/>
<buttongroup name="bloomBlendModeButtonGroup"/>
<buttongroup name="copyFrameBufferButtonGroup"/>
<buttongroup name="screenshotButtonGroup"/>
<buttongroup name="aspectButtonGroup"/>
<buttongroup name="fixTexrectCoordsButtonGroup"/>
<buttongroup name="screenshotButtonGroup"/>
<buttongroup name="copyDepthBufferButtonGroup"/>
<buttongroup name="copyFrameBufferButtonGroup"/>
<buttongroup name="bloomBlendModeButtonGroup"/>
<buttongroup name="aspectButtonGroup"/>
</buttongroups>
</ui>