mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2024-12-29 11:06:07 +00:00
new main window working
This commit is contained in:
parent
4306dce221
commit
9962cf333c
|
@ -68,6 +68,9 @@ namespace gui
|
||||||
const QColor game_list_icon_color = QColor(240, 240, 240, 255);
|
const QColor game_list_icon_color = QColor(240, 240, 240, 255);
|
||||||
|
|
||||||
const gui_save main_window_gamelist_visible = gui_save(main_window, "gamelistVisible", true);
|
const gui_save main_window_gamelist_visible = gui_save(main_window, "gamelistVisible", true);
|
||||||
|
const gui_save main_window_geometry = gui_save(main_window, "geometry", QByteArray());
|
||||||
|
const gui_save main_window_windowState = gui_save(main_window, "windowState", QByteArray());
|
||||||
|
const gui_save main_window_mwState = gui_save(main_window, "mwState", QByteArray());
|
||||||
|
|
||||||
const gui_save game_list_sortAsc = gui_save(game_list, "sortAsc", true);
|
const gui_save game_list_sortAsc = gui_save(game_list, "sortAsc", true);
|
||||||
const gui_save game_list_sortCol = gui_save(game_list, "sortCol", 1);
|
const gui_save game_list_sortCol = gui_save(game_list, "sortCol", 1);
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
main_window::main_window(std::shared_ptr<gui_settings> gui_settings, QWidget* parent)
|
main_window::main_window(std::shared_ptr<gui_settings> gui_settings, QWidget* parent)
|
||||||
: QMainWindow(parent)
|
: QMainWindow(parent)
|
||||||
, ui(new Ui::main_window)
|
, ui(new Ui::main_window)
|
||||||
|
, m_gui_settings(std::move(gui_settings))
|
||||||
{
|
{
|
||||||
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
@ -15,7 +16,7 @@ main_window::main_window(std::shared_ptr<gui_settings> gui_settings, QWidget* pa
|
||||||
|
|
||||||
main_window::~main_window()
|
main_window::~main_window()
|
||||||
{
|
{
|
||||||
|
SaveWindowState();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool main_window::Init()
|
bool main_window::Init()
|
||||||
|
@ -35,6 +36,11 @@ bool main_window::Init()
|
||||||
|
|
||||||
ConfigureGuiFromSettings();
|
ConfigureGuiFromSettings();
|
||||||
|
|
||||||
|
show();
|
||||||
|
|
||||||
|
// Fix possible hidden game list columns. The game list has to be visible already. Use this after show()
|
||||||
|
m_game_list_frame->FixNarrowColumns();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,5 +191,42 @@ void main_window::ResizeIcons(int index)
|
||||||
}
|
}
|
||||||
void main_window::ConfigureGuiFromSettings()
|
void main_window::ConfigureGuiFromSettings()
|
||||||
{
|
{
|
||||||
|
// Restore GUI state if needed. We need to if they exist.
|
||||||
|
if (!restoreGeometry(m_gui_settings->GetValue(gui::main_window_geometry).toByteArray()))
|
||||||
|
{
|
||||||
|
resize(QGuiApplication::primaryScreen()->availableSize() * 0.7);
|
||||||
|
}
|
||||||
|
|
||||||
|
restoreState(m_gui_settings->GetValue(gui::main_window_windowState).toByteArray());
|
||||||
|
m_main_window->restoreState(m_gui_settings->GetValue(gui::main_window_mwState).toByteArray());
|
||||||
|
|
||||||
|
ui->showGameListAct->setChecked(m_gui_settings->GetValue(gui::main_window_gamelist_visible).toBool());
|
||||||
|
|
||||||
|
m_game_list_frame->setVisible(ui->showGameListAct->isChecked());
|
||||||
|
|
||||||
|
// handle icon size options
|
||||||
|
m_is_list_mode = m_gui_settings->GetValue(gui::game_list_listMode).toBool();
|
||||||
|
if (m_is_list_mode)
|
||||||
|
ui->setlistModeListAct->setChecked(true);
|
||||||
|
else
|
||||||
|
ui->setlistModeGridAct->setChecked(true);
|
||||||
|
|
||||||
|
const int icon_size_index = m_gui_settings->GetValue(m_is_list_mode ? gui::game_list_iconSize : gui::game_list_iconSizeGrid).toInt();
|
||||||
|
m_other_slider_pos = m_gui_settings->GetValue(!m_is_list_mode ? gui::game_list_iconSize : gui::game_list_iconSizeGrid).toInt();
|
||||||
|
ui->sizeSlider->setSliderPosition(icon_size_index);
|
||||||
|
SetIconSizeActions(icon_size_index);
|
||||||
|
|
||||||
|
// Gamelist
|
||||||
|
m_game_list_frame->LoadSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
void main_window::SaveWindowState() const
|
||||||
|
{
|
||||||
|
// Save gui settings
|
||||||
|
m_gui_settings->SetValue(gui::main_window_geometry, saveGeometry());
|
||||||
|
m_gui_settings->SetValue(gui::main_window_windowState, saveState());
|
||||||
|
m_gui_settings->SetValue(gui::main_window_mwState, m_main_window->saveState());
|
||||||
|
|
||||||
|
// Save column settings
|
||||||
|
m_game_list_frame->SaveSettings();
|
||||||
}
|
}
|
|
@ -30,6 +30,7 @@ private Q_SLOTS:
|
||||||
void ConfigureGuiFromSettings();
|
void ConfigureGuiFromSettings();
|
||||||
void SetIconSizeActions(int idx) const;
|
void SetIconSizeActions(int idx) const;
|
||||||
void ResizeIcons(int index);
|
void ResizeIcons(int index);
|
||||||
|
void SaveWindowState() const;
|
||||||
private:
|
private:
|
||||||
void CreateActions();
|
void CreateActions();
|
||||||
void CreateDockWindows();
|
void CreateDockWindows();
|
||||||
|
|
|
@ -1,13 +1,17 @@
|
||||||
#include "gui/shadps4gui.h"
|
#include "gui/shadps4gui.h"
|
||||||
#include <QtWidgets/QApplication>
|
#include <QtWidgets/QApplication>
|
||||||
#include "gui/gui_settings.h"
|
#include "gui/gui_settings.h"
|
||||||
|
#include "gui/main_window.h"
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
std::shared_ptr<gui_settings> m_gui_settings;
|
std::shared_ptr<gui_settings> m_gui_settings;
|
||||||
m_gui_settings.reset(new gui_settings());
|
m_gui_settings.reset(new gui_settings());
|
||||||
shadps4gui w(m_gui_settings,nullptr);
|
//shadps4gui w(m_gui_settings,nullptr);
|
||||||
w.show();
|
//w.show();
|
||||||
|
main_window* m_main_window = new main_window(m_gui_settings, nullptr);
|
||||||
|
m_main_window->Init();
|
||||||
|
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
|
@ -33,6 +33,12 @@
|
||||||
<Filter Include="emulator\fileFormat">
|
<Filter Include="emulator\fileFormat">
|
||||||
<UniqueIdentifier>{ed31734c-f010-4590-9f01-18e0b2497ffb}</UniqueIdentifier>
|
<UniqueIdentifier>{ed31734c-f010-4590-9f01-18e0b2497ffb}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter Include="gui\game list">
|
||||||
|
<UniqueIdentifier>{b4b58418-b124-41bb-96ef-610faa1c8812}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="gui\main window">
|
||||||
|
<UniqueIdentifier>{731089fd-7d11-4f10-8f55-4854c2e42e9e}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="main.cpp">
|
<ClCompile Include="main.cpp">
|
||||||
|
@ -59,26 +65,26 @@
|
||||||
<ClCompile Include="gui\gui_settings.cpp">
|
<ClCompile Include="gui\gui_settings.cpp">
|
||||||
<Filter>gui</Filter>
|
<Filter>gui</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="gui\custom_table_widget_item.cpp">
|
|
||||||
<Filter>gui</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="gui\game_list_table.cpp">
|
|
||||||
<Filter>gui</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="gui\game_list_grid_delegate.cpp">
|
|
||||||
<Filter>gui</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="gui\game_list_grid.cpp">
|
|
||||||
<Filter>gui</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="gui\game_list_frame.cpp">
|
|
||||||
<Filter>gui</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="gui\settings.cpp">
|
<ClCompile Include="gui\settings.cpp">
|
||||||
<Filter>gui</Filter>
|
<Filter>gui</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="gui\game_list_frame.cpp">
|
||||||
|
<Filter>gui\game list</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="gui\game_list_grid.cpp">
|
||||||
|
<Filter>gui\game list</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="gui\game_list_grid_delegate.cpp">
|
||||||
|
<Filter>gui\game list</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="gui\game_list_table.cpp">
|
||||||
|
<Filter>gui\game list</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="gui\custom_table_widget_item.cpp">
|
||||||
|
<Filter>gui\game list</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="gui\main_window.cpp">
|
<ClCompile Include="gui\main_window.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>gui\main window</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -96,20 +102,20 @@
|
||||||
<QtMoc Include="gui\GameListViewer.h">
|
<QtMoc Include="gui\GameListViewer.h">
|
||||||
<Filter>gui</Filter>
|
<Filter>gui</Filter>
|
||||||
</QtMoc>
|
</QtMoc>
|
||||||
<QtMoc Include="gui\game_list_grid.h">
|
|
||||||
<Filter>gui</Filter>
|
|
||||||
</QtMoc>
|
|
||||||
<QtMoc Include="gui\game_list_frame.h">
|
|
||||||
<Filter>gui</Filter>
|
|
||||||
</QtMoc>
|
|
||||||
<QtMoc Include="gui\settings.h">
|
<QtMoc Include="gui\settings.h">
|
||||||
<Filter>gui</Filter>
|
<Filter>gui</Filter>
|
||||||
</QtMoc>
|
</QtMoc>
|
||||||
<QtMoc Include="gui\gui_settings.h">
|
<QtMoc Include="gui\gui_settings.h">
|
||||||
<Filter>gui</Filter>
|
<Filter>gui</Filter>
|
||||||
</QtMoc>
|
</QtMoc>
|
||||||
|
<QtMoc Include="gui\game_list_frame.h">
|
||||||
|
<Filter>gui\game list</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="gui\game_list_grid.h">
|
||||||
|
<Filter>gui\game list</Filter>
|
||||||
|
</QtMoc>
|
||||||
<QtMoc Include="gui\main_window.h">
|
<QtMoc Include="gui\main_window.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>gui\main window</Filter>
|
||||||
</QtMoc>
|
</QtMoc>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -131,15 +137,6 @@
|
||||||
<ClInclude Include="emulator\gameInfo.h">
|
<ClInclude Include="emulator\gameInfo.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="gui\custom_table_widget_item.h">
|
|
||||||
<Filter>gui</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="gui\game_list_table.h">
|
|
||||||
<Filter>gui</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="gui\game_list_grid_delegate.h">
|
|
||||||
<Filter>gui</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="gui\gui_save.h">
|
<ClInclude Include="gui\gui_save.h">
|
||||||
<Filter>gui</Filter>
|
<Filter>gui</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@ -152,5 +149,14 @@
|
||||||
<ClInclude Include="gui\custom_dock_widget.h">
|
<ClInclude Include="gui\custom_dock_widget.h">
|
||||||
<Filter>gui</Filter>
|
<Filter>gui</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="gui\game_list_table.h">
|
||||||
|
<Filter>gui\game list</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="gui\game_list_grid_delegate.h">
|
||||||
|
<Filter>gui\game list</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="gui\custom_table_widget_item.h">
|
||||||
|
<Filter>gui\game list</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
Loading…
Reference in a new issue