Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gui refactoring #3007

Merged
merged 4 commits into from Jul 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitignore
Expand Up @@ -41,7 +41,6 @@
/Vulkan/Vulkan-build
/Vulkan/glslang-build

/wxWidgets/lib
/bin/rpcs3.ini
/bin/rpcs3.ipdb
/bin/rpcs3.iobj
Expand Down Expand Up @@ -92,4 +91,4 @@ rpcs3/rpcs3_*_cotire.cmake
moc_*.cpp
qrc_resources.cpp
rpcs3_automoc.cpp
ui_*.h
ui_*.h
2 changes: 1 addition & 1 deletion CMakeLists.txt
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8.12)
cmake_minimum_required(VERSION 3.0.2)

option(WITH_GDB "WITH_GDB" OFF)
option(WITHOUT_LLVM "WITHOUT_LLVM" OFF)
Expand Down
3 changes: 0 additions & 3 deletions rpcs3/CMakeLists.txt
Expand Up @@ -268,9 +268,6 @@ if(NOT WIN32 AND NOT "${CMAKE_SYSTEM}" MATCHES "Linux")
set (EXCLUDE_FILES "/RSX/VK/")
endif()

# The Gui folder contains wxWidgets stuff, which we no longer want.
set (EXCLUDE_FILES ${EXCLUDE_FILES} "/Gui/")

# Ignore autogenerated moc_* files if present
set (EXCLUDE_FILES ${EXCLUDE_FILES} "moc_")
set (EXCLUDE_FILES ${EXCLUDE_FILES} "rpcs3_automoc")
Expand Down
2 changes: 2 additions & 0 deletions rpcs3/rpcs3_app.cpp
Expand Up @@ -68,6 +68,8 @@ void rpcs3_app::Init()
// Create connects to propagate events throughout Gui.
InitializeConnects();

RPCS3MainWin->Init();

setApplicationName("RPCS3");
RPCS3MainWin->show();

Expand Down
3 changes: 2 additions & 1 deletion rpcs3/rpcs3qt/game_list_frame.cpp
Expand Up @@ -565,6 +565,7 @@ void game_list_frame::doubleClickedSlot(const QModelIndex& index)
{
LOG_SUCCESS(LOADER, "Boot from gamelist per doubleclick: done");
RequestAddRecentGame(q_string_pair(qstr(Emu.GetBoot()), qstr("[" + m_game_data[i].info.serial + "] " + m_game_data[i].info.name)));
Refresh(true);
}
}
else
Expand Down Expand Up @@ -863,7 +864,7 @@ void game_list_frame::PopulateGameGrid(uint maxCols, const QSize& image_size, co

std::string selected_item = CurrentSelectionIconPath();

delete m_xgrid;
m_xgrid->deleteLater();

bool showText = m_Icon_Size_Str != GUI::gl_icon_key_small && m_Icon_Size_Str != GUI::gl_icon_key_tiny;

Expand Down
42 changes: 24 additions & 18 deletions rpcs3/rpcs3qt/main_window.cpp
Expand Up @@ -47,6 +47,25 @@
inline std::string sstr(const QString& _in) { return _in.toUtf8().toStdString(); }

main_window::main_window(QWidget *parent) : QMainWindow(parent), m_sys_menu_opened(false), ui(new Ui::main_window)
{
}

main_window::~main_window()
{
}

auto Pause = []()
{
if (Emu.IsReady()) Emu.Run();
else if (Emu.IsPaused()) Emu.Resume();
else if (Emu.IsRunning()) Emu.Pause();
else if (!Emu.GetPath().empty()) Emu.Load();
};

/* An init method is used so that RPCS3App can create the necessary connects before calling init (specifically the stylesheet connect).
* Simplifies logic a bit.
*/
void main_window::Init()
{
ui->setupUi(this);

Expand Down Expand Up @@ -87,26 +106,10 @@ main_window::main_window(QWidget *parent) : QMainWindow(parent), m_sys_menu_open
setWindowTitle(QString::fromStdString("RPCS3 v" + rpcs3::version.to_string()));
!appIcon.isNull() ? setWindowIcon(appIcon) : LOG_WARNING(GENERAL, "AppImage could not be loaded!");

QTimer::singleShot(1, [=]() {
// Need to have this happen fast, but not now because connects aren't created yet.
// So, a tricky balance in terms of time but this works.
RequestGlobalStylesheetChange(guiSettings->GetCurrentStylesheetPath());
ConfigureGuiFromSettings(true);
});
RequestGlobalStylesheetChange(guiSettings->GetCurrentStylesheetPath());
ConfigureGuiFromSettings(true);
}

main_window::~main_window()
{
}

auto Pause = []()
{
if (Emu.IsReady()) Emu.Run();
else if (Emu.IsPaused()) Emu.Resume();
else if (Emu.IsRunning()) Emu.Pause();
else if (!Emu.GetPath().empty()) Emu.Load();
};

void main_window::CreateThumbnailToolbar()
{
#ifdef _WIN32
Expand Down Expand Up @@ -240,6 +243,7 @@ void main_window::BootElf()

const std::string serial = Emu.GetTitleID().empty() ? "" : "[" + Emu.GetTitleID() + "] ";
AddRecentAction(q_string_pair(qstr(Emu.GetBoot()), qstr(serial + Emu.GetTitle())));
gameListFrame->Refresh(true);
}
}

Expand Down Expand Up @@ -276,6 +280,7 @@ void main_window::BootGame()

const std::string serial = Emu.GetTitleID().empty() ? "" : "[" + Emu.GetTitleID() + "] ";
AddRecentAction(q_string_pair(qstr(Emu.GetBoot()), qstr(serial + Emu.GetTitle())));
gameListFrame->Refresh(true);
}
}

Expand Down Expand Up @@ -791,6 +796,7 @@ void main_window::BootRecentAction(const QAction* act)
{
LOG_SUCCESS(LOADER, "Boot from Recent List: done");
AddRecentAction(q_string_pair(qstr(Emu.GetBoot()), nam));
gameListFrame->Refresh(true);
}
};

Expand Down
1 change: 1 addition & 0 deletions rpcs3/rpcs3qt/main_window.h
Expand Up @@ -55,6 +55,7 @@ class main_window : public QMainWindow

public:
explicit main_window(QWidget *parent = 0);
void Init();
~main_window();
void CreateThumbnailToolbar();
QIcon GetAppIcon();
Expand Down