Merge pull request #8759 from unknownbrackets/qt-size

Improve display of Qt at 1x size
This commit is contained in:
Henrik Rydgård 2016-05-22 10:56:00 +02:00
commit 540181c32d
7 changed files with 228 additions and 18 deletions

View File

@ -127,11 +127,11 @@ bool UpdateScreenScale(int width, int height, bool smallWindow) {
g_dpi_scale = 1.0f;
#if defined(__SYMBIAN32__)
g_dpi_scale = 1.4f;
#elif defined(_WIN32)
#endif
if (smallWindow) {
g_dpi_scale = 2.0f;
}
#endif
pixel_in_dps = 1.0f / g_dpi_scale;
int new_dp_xres = width * g_dpi_scale;

View File

@ -39,7 +39,7 @@ MainWindow::MainWindow(QWidget *parent, bool fullscreen) :
createMenus();
updateMenus();
SetZoom(g_Config.iInternalResolution);
SetWindowScale(-1);
if(fullscreen)
fullscrAct();
@ -83,7 +83,9 @@ void MainWindow::updateMenus()
}
foreach(QAction * action, screenGroup->actions()) {
if (g_Config.iInternalResolution == action->data().toInt()) {
int width = (g_Config.IsPortrait() ? 272 : 480) * action->data().toInt();
int height = (g_Config.IsPortrait() ? 480 : 272) * action->data().toInt();
if (g_Config.iWindowWidth == width && g_Config.iWindowHeight == height) {
action->setChecked(true);
break;
}
@ -362,7 +364,7 @@ void MainWindow::fullscrAct()
updateMenus();
showNormal();
SetZoom(g_Config.iInternalResolution);
SetWindowScale(-1);
InitPadLayout(dp_xres, dp_yres);
if (GetUIState() == UISTATE_INGAME && QApplication::overrideCursor())
QApplication::restoreOverrideCursor();
@ -414,18 +416,35 @@ void MainWindow::aboutAct()
}
/* Private functions */
void MainWindow::SetZoom(int zoom) {
void MainWindow::SetWindowScale(int zoom) {
if (isFullScreen())
fullscrAct();
if (zoom < 1) zoom = 1;
if (zoom > 4) zoom = 4;
g_Config.iInternalResolution = zoom;
emugl->setFixedSize(480 * zoom, 272 * zoom);
int width, height;
if (zoom == -1 && (g_Config.iWindowWidth <= 0 || g_Config.iWindowHeight <= 0)) {
// Default to zoom level 2.
zoom = 2;
}
if (zoom == -1) {
// Take the last setting.
width = g_Config.iWindowWidth;
height = g_Config.iWindowHeight;
} else {
// Update to the specified factor. Let's clamp first.
if (zoom < 1)
zoom = 1;
if (zoom > 4)
zoom = 4;
width = (g_Config.IsPortrait() ? 272 : 480) * zoom;
height = (g_Config.IsPortrait() ? 480 : 272) * zoom;
}
g_Config.iWindowWidth = width;
g_Config.iWindowHeight = height;
emugl->setFixedSize(g_Config.iWindowWidth, g_Config.iWindowHeight);
setFixedSize(sizeHint());
if (gpu)
gpu->Resized();
}
void MainWindow::SetGameTitle(QString text)

View File

@ -97,7 +97,7 @@ private slots:
void bufferRenderAct() { g_Config.iRenderingMode = !g_Config.iRenderingMode; }
void linearAct() { g_Config.iTexFiltering = (g_Config.iTexFiltering != 0) ? 0 : 3; }
void screenGroup_triggered(QAction *action) { SetZoom(action->data().toInt()); }
void screenGroup_triggered(QAction *action) { SetWindowScale(action->data().toInt()); }
void displayLayoutGroup_triggered(QAction *action) { g_Config.iSmallDisplayZoomType = action->data().toInt(); }
void transformAct() { g_Config.bHardwareTransform = !g_Config.bHardwareTransform; }
@ -135,7 +135,7 @@ private slots:
void langChanged(QAction *action) { loadLanguage(action->data().toString(), true); }
private:
void SetZoom(int zoom);
void SetWindowScale(int zoom);
void SetGameTitle(QString text);
void loadLanguage(const QString &language, bool retranslate);
void createMenus();

View File

@ -377,7 +377,7 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
const char *fileToLog = 0;
const char *stateToLoad = 0;
bool gfxLog = false;
bool gfxLog = true;
// Parse command line
LogTypes::LOG_LEVELS logLevel = LogTypes::LINFO;
for (int i = 1; i < argc; i++) {
@ -389,7 +389,7 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
logLevel = LogTypes::LDEBUG;
break;
case 'g':
gfxLog = true;
gfxLog = false;
break;
case 'j':
g_Config.iCpuCore = CPU_CORE_JIT;

View File

@ -293,6 +293,66 @@
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</ForcedIncludeFiles>
</ClCompile>
<ClCompile Include="..\Qt\Debugger\ctrldisasmview.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\Qt\Debugger\ctrlmemview.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\Qt\Debugger\ctrlregisterlist.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\Qt\Debugger\ctrlvfpuview.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\Qt\Debugger\debugger_disasm.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\Qt\Debugger\debugger_displaylist.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\Qt\Debugger\debugger_memory.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\Qt\Debugger\debugger_memorytex.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\Qt\Debugger\debugger_vfpu.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\Qt\mainwindow.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="GPU\D3D9Context.cpp" />
<ClCompile Include="Debugger\BreakpointWindow.cpp" />
<ClCompile Include="Debugger\CtrlDisAsmView.cpp" />
@ -349,6 +409,16 @@
<ClInclude Include="..\android\jni\Arm64EmitterTest.h" />
<ClInclude Include="..\android\jni\TestRunner.h" />
<ClInclude Include="..\ios\ViewController.h" />
<ClInclude Include="..\Qt\Debugger\ctrldisasmview.h" />
<ClInclude Include="..\Qt\Debugger\ctrlmemview.h" />
<ClInclude Include="..\Qt\Debugger\ctrlregisterlist.h" />
<ClInclude Include="..\Qt\Debugger\ctrlvfpuview.h" />
<ClInclude Include="..\Qt\Debugger\debugger_disasm.h" />
<ClInclude Include="..\Qt\Debugger\debugger_displaylist.h" />
<ClInclude Include="..\Qt\Debugger\debugger_memory.h" />
<ClInclude Include="..\Qt\Debugger\debugger_memorytex.h" />
<ClInclude Include="..\Qt\Debugger\debugger_vfpu.h" />
<ClInclude Include="..\Qt\mainwindow.h" />
<ClInclude Include="GPU\D3D9Context.h" />
<ClInclude Include="Debugger\BreakpointWindow.h" />
<ClInclude Include="Debugger\CtrlDisAsmView.h" />
@ -404,6 +474,19 @@
<None Include="..\ios\AudioEngine.mm" />
<None Include="..\ios\main.mm" />
<None Include="..\ios\ViewController.mm" />
<None Include="..\Qt\assets.qrc" />
<None Include="..\Qt\Common.pro" />
<None Include="..\Qt\Core.pro" />
<None Include="..\Qt\Debugger\debugger_disasm.ui" />
<None Include="..\Qt\Debugger\debugger_displaylist.ui" />
<None Include="..\Qt\Debugger\debugger_memory.ui" />
<None Include="..\Qt\Debugger\debugger_memorytex.ui" />
<None Include="..\Qt\Debugger\debugger_vfpu.ui" />
<None Include="..\Qt\GPU.pro" />
<None Include="..\Qt\Native.pro" />
<None Include="..\Qt\PPSSPP.pro" />
<None Include="..\Qt\PPSSPPQt.pro" />
<None Include="..\Qt\Settings.pri" />
<None Include="..\README.md" />
<None Include="git-version-gen.cmd" />
<None Include="ppsspp.ico" />

View File

@ -29,6 +29,12 @@
<Filter Include="Windows\GE Debugger">
<UniqueIdentifier>{15f0e146-e39c-4bad-ba10-3c714a7dbf74}</UniqueIdentifier>
</Filter>
<Filter Include="Other Platforms\Qt">
<UniqueIdentifier>{45191b1f-33c8-405c-a410-35fe2344d1d1}</UniqueIdentifier>
</Filter>
<Filter Include="Other Platforms\Qt\Debugger">
<UniqueIdentifier>{1d0cc0ee-fdbd-419e-b322-b35075d9d9db}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Debugger\CtrlDisAsmView.cpp">
@ -153,6 +159,36 @@
<Filter>Windows\System</Filter>
</ClCompile>
<ClCompile Include="GPU\WindowsVulkanContext.cpp" />
<ClCompile Include="..\Qt\mainwindow.cpp">
<Filter>Other Platforms\Qt</Filter>
</ClCompile>
<ClCompile Include="..\Qt\Debugger\debugger_disasm.cpp">
<Filter>Other Platforms\Qt\Debugger</Filter>
</ClCompile>
<ClCompile Include="..\Qt\Debugger\debugger_displaylist.cpp">
<Filter>Other Platforms\Qt\Debugger</Filter>
</ClCompile>
<ClCompile Include="..\Qt\Debugger\debugger_memory.cpp">
<Filter>Other Platforms\Qt\Debugger</Filter>
</ClCompile>
<ClCompile Include="..\Qt\Debugger\debugger_memorytex.cpp">
<Filter>Other Platforms\Qt\Debugger</Filter>
</ClCompile>
<ClCompile Include="..\Qt\Debugger\debugger_vfpu.cpp">
<Filter>Other Platforms\Qt\Debugger</Filter>
</ClCompile>
<ClCompile Include="..\Qt\Debugger\ctrldisasmview.cpp">
<Filter>Other Platforms\Qt\Debugger</Filter>
</ClCompile>
<ClCompile Include="..\Qt\Debugger\ctrlmemview.cpp">
<Filter>Other Platforms\Qt\Debugger</Filter>
</ClCompile>
<ClCompile Include="..\Qt\Debugger\ctrlregisterlist.cpp">
<Filter>Other Platforms\Qt\Debugger</Filter>
</ClCompile>
<ClCompile Include="..\Qt\Debugger\ctrlvfpuview.cpp">
<Filter>Other Platforms\Qt\Debugger</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Debugger\CtrlDisAsmView.h">
@ -280,6 +316,36 @@
<Filter>Windows\System</Filter>
</ClInclude>
<ClInclude Include="GPU\WindowsVulkanContext.h" />
<ClInclude Include="..\Qt\mainwindow.h">
<Filter>Other Platforms\Qt</Filter>
</ClInclude>
<ClInclude Include="..\Qt\Debugger\ctrlvfpuview.h">
<Filter>Other Platforms\Qt\Debugger</Filter>
</ClInclude>
<ClInclude Include="..\Qt\Debugger\debugger_disasm.h">
<Filter>Other Platforms\Qt\Debugger</Filter>
</ClInclude>
<ClInclude Include="..\Qt\Debugger\debugger_displaylist.h">
<Filter>Other Platforms\Qt\Debugger</Filter>
</ClInclude>
<ClInclude Include="..\Qt\Debugger\debugger_memory.h">
<Filter>Other Platforms\Qt\Debugger</Filter>
</ClInclude>
<ClInclude Include="..\Qt\Debugger\debugger_memorytex.h">
<Filter>Other Platforms\Qt\Debugger</Filter>
</ClInclude>
<ClInclude Include="..\Qt\Debugger\debugger_vfpu.h">
<Filter>Other Platforms\Qt\Debugger</Filter>
</ClInclude>
<ClInclude Include="..\Qt\Debugger\ctrldisasmview.h">
<Filter>Other Platforms\Qt\Debugger</Filter>
</ClInclude>
<ClInclude Include="..\Qt\Debugger\ctrlmemview.h">
<Filter>Other Platforms\Qt\Debugger</Filter>
</ClInclude>
<ClInclude Include="..\Qt\Debugger\ctrlregisterlist.h">
<Filter>Other Platforms\Qt\Debugger</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="icon1.ico">
@ -335,6 +401,45 @@
<Filter>Resource Files</Filter>
</None>
<None Include="..\assets\compat.ini" />
<None Include="..\Qt\Native.pro">
<Filter>Other Platforms\Qt</Filter>
</None>
<None Include="..\Qt\PPSSPP.pro">
<Filter>Other Platforms\Qt</Filter>
</None>
<None Include="..\Qt\PPSSPPQt.pro">
<Filter>Other Platforms\Qt</Filter>
</None>
<None Include="..\Qt\Settings.pri">
<Filter>Other Platforms\Qt</Filter>
</None>
<None Include="..\Qt\Common.pro">
<Filter>Other Platforms\Qt</Filter>
</None>
<None Include="..\Qt\Core.pro">
<Filter>Other Platforms\Qt</Filter>
</None>
<None Include="..\Qt\GPU.pro">
<Filter>Other Platforms\Qt</Filter>
</None>
<None Include="..\Qt\assets.qrc">
<Filter>Other Platforms\Qt</Filter>
</None>
<None Include="..\Qt\Debugger\debugger_disasm.ui">
<Filter>Other Platforms\Qt\Debugger</Filter>
</None>
<None Include="..\Qt\Debugger\debugger_displaylist.ui">
<Filter>Other Platforms\Qt\Debugger</Filter>
</None>
<None Include="..\Qt\Debugger\debugger_memory.ui">
<Filter>Other Platforms\Qt\Debugger</Filter>
</None>
<None Include="..\Qt\Debugger\debugger_memorytex.ui">
<Filter>Other Platforms\Qt\Debugger</Filter>
</None>
<None Include="..\Qt\Debugger\debugger_vfpu.ui">
<Filter>Other Platforms\Qt\Debugger</Filter>
</None>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="ppsspp.rc">

View File

@ -239,7 +239,10 @@ QString MainUI::InputBoxGetQString(QString title, QString defaultValue)
void MainUI::resizeGL(int w, int h)
{
UpdateScreenScale(w, h, false);
bool smallWindow = g_Config.IsPortrait() ? (h < 480 + 80) : (w < 480 + 80);
if (UpdateScreenScale(w, h, smallWindow)) {
NativeMessageReceived("gpu resized", "");
}
xscale = w / this->width();
yscale = h / this->height();