Small main_window refactoring. Fixed one of the guiconfig crashes too somehow.

This commit is contained in:
Robbie 2017-07-13 19:21:40 -05:00 committed by Ivan
parent 3df960bb52
commit eb80b7ec34
3 changed files with 24 additions and 18 deletions

View File

@ -68,6 +68,8 @@ void rpcs3_app::Init()
// Create connects to propagate events throughout Gui.
InitializeConnects();
RPCS3MainWin->Init();
setApplicationName("RPCS3");
RPCS3MainWin->show();

View File

@ -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);
@ -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

View File

@ -55,6 +55,7 @@ class main_window : public QMainWindow
public:
explicit main_window(QWidget *parent = 0);
void Init();
~main_window();
void CreateThumbnailToolbar();
QIcon GetAppIcon();