void ConfigDialog::setIniPath(const QString & _strIniPath) { m_strIniPath = _strIniPath; QStringList translationFiles; _getTranslations(translationFiles); const QString currentTranslation = getTranslationFile(); int listIndex = 0; QStringList translationLanguages("English"); for (int i = 0; i < translationFiles.size(); ++i) { // get locale extracted by filename QString locale = translationFiles[i]; // "TranslationExample_de.qm" const bool bCurrent = locale == currentTranslation; locale.truncate(locale.lastIndexOf('.')); // "TranslationExample_de" locale.remove(0, locale.indexOf('_') + 1); // "de" QString language = QLocale::languageToString(QLocale(locale).language()); if (bCurrent) { listIndex = i + 1; } translationLanguages << language; } ui->translationsComboBox->insertItems(0, translationLanguages); ui->translationsComboBox->setCurrentIndex(listIndex); }
void ConfigDialog::setIniPath(const QString & _strIniPath) { m_strIniPath = _strIniPath; QStringList translationFiles; _getTranslations(translationFiles); const QString currentTranslation = getTranslationFile(); int listIndex = 0; QStringList translationLanguages("English"); for (int i = 0; i < translationFiles.size(); ++i) { // get locale extracted by filename QString locale = translationFiles[i]; // "TranslationExample_de.qm" const bool bCurrent = locale == currentTranslation; locale.truncate(locale.lastIndexOf('.')); // "TranslationExample_de" locale.remove(0, locale.indexOf('_') + 1); // "de" QString language = QLocale(locale).nativeLanguageName(); language = language.left(1).toUpper() + language.remove(0, 1); if (bCurrent) { listIndex = i + 1; } translationLanguages << language; } ui->translationsComboBox->insertItems(0, translationLanguages); ui->translationsComboBox->setCurrentIndex(listIndex); // Profile ui->profilesComboBox->blockSignals(true); const QStringList aProfiles = getProfiles(m_strIniPath); ui->profilesComboBox->addItems(aProfiles); ui->profilesComboBox->setCurrentIndex(aProfiles.indexOf(getCurrentProfile(m_strIniPath))); ui->profilesComboBox->blockSignals(false); ui->removeProfilePushButton->setEnabled(ui->profilesComboBox->count() > 1); }
void ConfigDialog::accept() { m_accepted = true; const int currentWindowedResolution = ui->windowedResolutionComboBox->currentIndex(); config.video.windowedWidth = WindowedModes[currentWindowedResolution].width; config.video.windowedHeight = WindowedModes[currentWindowedResolution].height; getFullscreenResolutions(ui->fullScreenResolutionComboBox->currentIndex(), config.video.fullscreenWidth, config.video.fullscreenHeight); getFullscreenRefreshRate(ui->fullScreenRefreshRateComboBox->currentIndex(), config.video.fullscreenRefresh); config.video.multisampling = ui->aliasingSlider->value(); config.texture.maxAnisotropy = ui->anisotropicSlider->value(); config.texture.maxBytes = ui->cacheSizeSpinBox->value() * gc_uMegabyte; if (ui->blnrStandardRadioButton->isChecked()) config.texture.bilinearMode = BILINEAR_STANDARD; else if (ui->blnr3PointRadioButton->isChecked()) config.texture.bilinearMode = BILINEAR_3POINT; if (ui->bmpRadioButton->isChecked()) config.texture.screenShotFormat = 0; else if (ui->jpegRadioButton->isChecked()) config.texture.screenShotFormat = 1; const int lanuageIndex = ui->translationsComboBox->currentIndex(); if (lanuageIndex == 0) // English config.translationFile.clear(); else { QStringList translationFiles; _getTranslations(translationFiles); config.translationFile = translationFiles[lanuageIndex-1].toLocal8Bit().constData(); } // Emulation settings config.generalEmulation.enableLOD = ui->emulateLodCheckBox->isChecked() ? 1 : 0; config.generalEmulation.enableNoise = ui->emulateNoiseCheckBox->isChecked() ? 1 : 0; config.generalEmulation.enableFog = ui->emulateFogCheckBox->isChecked() ? 1 : 0; config.generalEmulation.enableHWLighting = ui->enableHWLightingCheckBox->isChecked() ? 1 : 0; config.generalEmulation.enableShadersStorage = ui->enableShadersStorageCheckBox->isChecked() ? 1 : 0; config.generalEmulation.enableCustomSettings = ui->customSettingsCheckBox->isChecked() ? 1 : 0; config.frameBufferEmulation.bufferSwapMode = ui->bufferSwapComboBox->currentIndex(); config.frameBufferEmulation.enable = ui->frameBufferGroupBox->isChecked() ? 1 : 0; if (ui->copyBufferDisableRadioButton->isChecked()) config.frameBufferEmulation.copyToRDRAM = Config::ctDisable; else if (ui->copyBufferSyncRadioButton->isChecked()) config.frameBufferEmulation.copyToRDRAM = Config::ctSync; else if (ui->copyBufferAsyncRadioButton->isChecked()) config.frameBufferEmulation.copyToRDRAM = Config::ctAsync; config.frameBufferEmulation.copyFromRDRAM = ui->RenderFBCheckBox->isChecked() ? 1 : 0; config.frameBufferEmulation.copyDepthToRDRAM = ui->CopyDepthCheckBox->isChecked() ? 1 : 0; config.frameBufferEmulation.N64DepthCompare = ui->n64DepthCompareCheckBox->isChecked() ? 1 : 0; if (ui->aspectStretchRadioButton->isChecked()) config.frameBufferEmulation.aspect = Config::aStretch; else if (ui->aspect43RadioButton->isChecked()) config.frameBufferEmulation.aspect = Config::a43; else if (ui->aspect169RadioButton->isChecked()) config.frameBufferEmulation.aspect = Config::a169; else if (ui->aspectAdjustRadioButton->isChecked()) config.frameBufferEmulation.aspect = Config::aAdjust; // Texture filter settings config.textureFilter.txFilterMode = ui->filterComboBox->currentIndex(); config.textureFilter.txEnhancementMode = ui->enhancementComboBox->currentIndex(); config.textureFilter.txCacheSize = ui->textureFilterCacheSpinBox->value() * gc_uMegabyte; config.textureFilter.txFilterIgnoreBG = ui->ignoreBackgroundsCheckBox->isChecked() ? 1 : 0; config.textureFilter.txHiresEnable = ui->texturePackGroupBox->isChecked() ? 1 : 0; config.textureFilter.txHiresFullAlphaChannel = ui->alphaChannelCheckBox->isChecked() ? 1 : 0; config.textureFilter.txHresAltCRC = ui->alternativeCRCCheckBox->isChecked() ? 1 : 0; config.textureFilter.txDump = ui->textureDumpCheckBox->isChecked() ? 1 : 0; config.textureFilter.txCacheCompression = ui->compressCacheCheckBox->isChecked() ? 1 : 0; config.textureFilter.txForce16bpp = ui->force16bppCheckBox->isChecked() ? 1 : 0; config.textureFilter.txSaveCache = ui->saveTextureCacheCheckBox->isChecked() ? 1 : 0; QString txPath = ui->txPathLabel->text(); if (!txPath.isEmpty()) config.textureFilter.txPath[txPath.toWCharArray(config.textureFilter.txPath)] = L'\0'; config.font.size = m_font.pointSize(); QString fontName = m_font.family() + ".ttf"; #ifdef OS_WINDOWS config.font.name = fontName.toLocal8Bit().constData(); #else config.font.name = fontName.toStdString(); #endif config.font.color[0] = m_color.red(); config.font.color[1] = m_color.green(); config.font.color[2] = m_color.blue(); config.font.color[3] = m_color.alpha(); config.font.colorf[0] = m_color.redF(); config.font.colorf[1] = m_color.greenF(); config.font.colorf[2] = m_color.blueF(); config.font.colorf[3] = m_color.alphaF(); // Post filter settings config.bloomFilter.enable = ui->bloomGroupBox->isChecked() ? 1 : 0; if (ui->bloomStrongRadioButton->isChecked()) config.bloomFilter.blendMode = 0; else if (ui->bloomMildRadioButton->isChecked()) config.bloomFilter.blendMode = 1; else if (ui->bloomLightRadioButton->isChecked()) config.bloomFilter.blendMode = 2; config.bloomFilter.thresholdLevel = ui->bloomThresholdSlider->value(); config.bloomFilter.blurAmount = ui->blurAmountSlider->value(); config.bloomFilter.blurStrength = ui->blurStrengthSlider->value(); config.gammaCorrection.force = ui->forceGammaCorrectionCheckBox->isChecked() ? 1 : 0; config.gammaCorrection.level = ui->gammaLevelSpinBox->value(); writeSettings(m_strIniPath); QDialog::accept(); }
void ConfigDialog::accept() { m_accepted = true; int windowedValidatorPos = 0; QString currentText = ui->windowedResolutionComboBox->currentText(); if (ui->windowedResolutionComboBox->validator()->validate( currentText, windowedValidatorPos ) == QValidator::Acceptable) { QStringList windowedResolutionDimensions = currentText.split("x"); config.video.windowedWidth = windowedResolutionDimensions[0].trimmed().toInt(); config.video.windowedHeight = windowedResolutionDimensions[1].trimmed().toInt(); } 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->n64DepthCompareCheckBox->isChecked() ? 0 : pow2(ui->aliasingSlider->value()); config.texture.maxAnisotropy = ui->anisotropicSlider->value(); if (ui->blnrStandardRadioButton->isChecked()) config.texture.bilinearMode = BILINEAR_STANDARD; else if (ui->blnr3PointRadioButton->isChecked()) config.texture.bilinearMode = BILINEAR_3POINT; if (ui->pngRadioButton->isChecked()) config.texture.screenShotFormat = 0; else if (ui->jpegRadioButton->isChecked()) config.texture.screenShotFormat = 1; const int lanuageIndex = ui->translationsComboBox->currentIndex(); if (lanuageIndex == 0) // English config.translationFile.clear(); else { QStringList translationFiles; _getTranslations(translationFiles); config.translationFile = translationFiles[lanuageIndex-1].toLocal8Bit().constData(); } config.video.verticalSync = ui->vSyncCheckBox->isChecked() ? 1 : 0; // Emulation settings config.generalEmulation.enableLOD = ui->emulateLodCheckBox->isChecked() ? 1 : 0; config.generalEmulation.enableNoise = ui->emulateNoiseCheckBox->isChecked() ? 1 : 0; config.generalEmulation.enableHWLighting = ui->enableHWLightingCheckBox->isChecked() ? 1 : 0; config.generalEmulation.enableShadersStorage = ui->enableShadersStorageCheckBox->isChecked() ? 1 : 0; config.generalEmulation.enableCustomSettings = ui->customSettingsCheckBox->isChecked() ? 1 : 0; config.gammaCorrection.force = ui->gammaCorrectionCheckBox->isChecked() ? 1 : 0; config.gammaCorrection.level = ui->gammaLevelSpinBox->value(); if (ui->fixTexrectDisableRadioButton->isChecked()) config.generalEmulation.correctTexrectCoords = Config::tcDisable; else if (ui->fixTexrectSmartRadioButton->isChecked()) config.generalEmulation.correctTexrectCoords = Config::tcSmart; else if (ui->fixTexrectForceRadioButton->isChecked()) config.generalEmulation.correctTexrectCoords = Config::tcForce; config.generalEmulation.enableNativeResTexrects = ui->nativeRes2D_checkBox->isChecked() ? 1 : 0; config.frameBufferEmulation.enable = ui->frameBufferCheckBox->isChecked() ? 1 : 0; config.frameBufferEmulation.bufferSwapMode = ui->frameBufferSwapComboBox->currentIndex(); config.frameBufferEmulation.copyToRDRAM = ui->copyColorBufferComboBox->currentIndex(); config.frameBufferEmulation.copyDepthToRDRAM = ui->copyDepthBufferComboBox->currentIndex(); config.frameBufferEmulation.copyFromRDRAM = ui->RenderFBCheckBox->isChecked() ? 1 : 0; config.frameBufferEmulation.N64DepthCompare = ui->n64DepthCompareCheckBox->isChecked() ? 1 : 0; if (ui->aspectStretchRadioButton->isChecked()) config.frameBufferEmulation.aspect = Config::aStretch; else if (ui->aspect43RadioButton->isChecked()) config.frameBufferEmulation.aspect = Config::a43; else if (ui->aspect169RadioButton->isChecked()) config.frameBufferEmulation.aspect = Config::a169; else if (ui->aspectAdjustRadioButton->isChecked()) config.frameBufferEmulation.aspect = Config::aAdjust; if (ui->factor0xRadioButton->isChecked()) config.frameBufferEmulation.nativeResFactor = 0; else if (ui->factor1xRadioButton->isChecked()) config.frameBufferEmulation.nativeResFactor = 1; else if (ui->factorXxRadioButton->isChecked()) config.frameBufferEmulation.nativeResFactor = ui->resolutionFactorSlider->value(); config.frameBufferEmulation.copyAuxToRDRAM = ui->copyAuxBuffersCheckBox->isChecked() ? 1 : 0; config.frameBufferEmulation.fbInfoDisabled = ui->fbInfoEnableCheckBox->isChecked() ? 0 : 1; config.frameBufferEmulation.fbInfoReadColorChunk = ui->readColorChunkCheckBox->isChecked() ? 1 : 0; config.frameBufferEmulation.fbInfoReadDepthChunk = ui->readDepthChunkCheckBox->isChecked() ? 1 : 0; // Texture filter settings config.textureFilter.txFilterMode = ui->filterComboBox->currentIndex(); config.textureFilter.txEnhancementMode = ui->enhancementComboBox->currentIndex(); config.textureFilter.txCacheSize = ui->textureFilterCacheSpinBox->value() * gc_uMegabyte; config.textureFilter.txDeposterize = ui->deposterizeCheckBox->isChecked() ? 1 : 0; config.textureFilter.txFilterIgnoreBG = ui->ignoreBackgroundsCheckBox->isChecked() ? 1 : 0; config.textureFilter.txHiresEnable = ui->texturePackOnCheckBox->isChecked() ? 1 : 0; config.textureFilter.txHiresFullAlphaChannel = ui->alphaChannelCheckBox->isChecked() ? 1 : 0; config.textureFilter.txHresAltCRC = ui->alternativeCRCCheckBox->isChecked() ? 1 : 0; config.textureFilter.txDump = ui->textureDumpCheckBox->isChecked() ? 1 : 0; config.textureFilter.txCacheCompression = ui->compressCacheCheckBox->isChecked() ? 1 : 0; config.textureFilter.txForce16bpp = ui->force16bppCheckBox->isChecked() ? 1 : 0; config.textureFilter.txSaveCache = ui->saveTextureCacheCheckBox->isChecked() ? 1 : 0; QString txPath = ui->txPathLabel->text(); if (!txPath.isEmpty()) config.textureFilter.txPath[txPath.toWCharArray(config.textureFilter.txPath)] = L'\0'; QString txCachePath = ui->txCachePathLabel->text(); if (!txPath.isEmpty()) config.textureFilter.txCachePath[txCachePath.toWCharArray(config.textureFilter.txCachePath)] = L'\0'; QString txDumpPath = ui->txDumpPathLabel->text(); if (!txDumpPath.isEmpty()) config.textureFilter.txDumpPath[txDumpPath.toWCharArray(config.textureFilter.txDumpPath)] = L'\0'; // OSD settings config.font.size = ui->fontSizeSpinBox->value(); #ifdef OS_WINDOWS config.font.name = ui->fontLineEdit->text().toLocal8Bit().constData(); #else config.font.name = ui->fontLineEdit->text().toStdString(); #endif config.font.color[0] = m_color.red(); config.font.color[1] = m_color.green(); config.font.color[2] = m_color.blue(); config.font.color[3] = m_color.alpha(); config.font.colorf[0] = m_color.redF(); config.font.colorf[1] = m_color.greenF(); config.font.colorf[2] = m_color.blueF(); config.font.colorf[3] = m_color.alphaF(); if (ui->topLeftPushButton->isChecked()) config.onScreenDisplay.pos = Config::posTopLeft; else if (ui->topPushButton->isChecked()) config.onScreenDisplay.pos = Config::posTopCenter; else if (ui->topRightPushButton->isChecked()) config.onScreenDisplay.pos = Config::posTopRight; else if (ui->bottomLeftPushButton->isChecked()) config.onScreenDisplay.pos = Config::posBottomLeft; else if (ui->bottomPushButton->isChecked()) config.onScreenDisplay.pos = Config::posBottomCenter; else if (ui->bottomRightPushButton->isChecked()) config.onScreenDisplay.pos = Config::posBottomRight; config.onScreenDisplay.fps = ui->fpsCheckBox->isChecked() ? 1 : 0; config.onScreenDisplay.vis = ui->visCheckBox->isChecked() ? 1 : 0; config.onScreenDisplay.percent = ui->percentCheckBox->isChecked() ? 1 : 0; config.onScreenDisplay.internalResolution = ui->internalResolutionCheckBox->isChecked() ? 1 : 0; config.onScreenDisplay.renderingResolution = ui->renderingResolutionCheckBox->isChecked() ? 1 : 0; config.debug.dumpMode = 0; if (ui->dumpLowCheckBox->isChecked()) config.debug.dumpMode |= DEBUG_LOW; if (ui->dumpNormalCheckBox->isChecked()) config.debug.dumpMode |= DEBUG_NORMAL; if (ui->dumpDetailCheckBox->isChecked()) config.debug.dumpMode |= DEBUG_DETAIL; writeSettings(m_strIniPath); QDialog::accept(); }