Merge pull request #2390 from darkengine-io/new-qt

More miscellaneous Qt fixes
This commit is contained in:
Ryan Houdek 2015-05-25 23:45:21 -04:00
commit f706518dc0
3 changed files with 32 additions and 7 deletions

View File

@ -78,6 +78,7 @@ DMainWindow::DMainWindow(QWidget* parent_widget)
connect(m_ui->actionGitHub, SIGNAL(triggered()), this, SLOT(OnOpenGitHub()));
connect(m_ui->actionSystemInfo, SIGNAL(triggered()), this, SLOT(OnOpenSystemInfo()));
connect(m_ui->actionAbout, SIGNAL(triggered()), this, SLOT(OnOpenAbout()));
connect(m_ui->actionAboutQt, SIGNAL(triggered()), this, SLOT(OnOpenAboutQt()));
// Update GUI items
emit CoreStateChanged(Core::CORE_UNINITIALIZED);
@ -92,6 +93,11 @@ DMainWindow::~DMainWindow()
{
}
void DMainWindow::closeEvent(QCloseEvent* ce)
{
Stop();
}
// Emulation
void DMainWindow::StartGame(const QString filename)
@ -111,9 +117,15 @@ void DMainWindow::StartGame(const QString filename)
m_ui->centralWidget->addWidget(m_render_widget.get());
m_ui->centralWidget->setCurrentWidget(m_render_widget.get());
// TODO: When rendering to main, this won't resize the parent window...
m_render_widget->resize(SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowWidth,
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderWindowAutoSize)
{
// Resize main window to fit render
m_render_widget->setMinimumSize(SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowWidth,
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight);
qApp->processEvents(); // Force a redraw so the window has time to resize
m_render_widget->setMinimumSize(0, 0); // Allow the widget to scale down
}
m_render_widget->adjustSize();
}
if (!BootManager::BootCore(filename.toStdString()))
@ -351,3 +363,8 @@ void DMainWindow::OnOpenAbout()
DAboutDialog* dlg = new DAboutDialog(this);
dlg->open();
}
void DMainWindow::OnOpenAboutQt()
{
QApplication::aboutQt();
}

View File

@ -58,11 +58,13 @@ private slots:
void OnOpenGitHub();
void OnOpenSystemInfo();
void OnOpenAbout();
void OnOpenAboutQt();
// Misc.
void UpdateIcons();
private:
void closeEvent(QCloseEvent* ce);
std::unique_ptr<Ui::DMainWindow> m_ui;
DGameTracker* m_game_tracker;

View File

@ -32,7 +32,7 @@
<x>0</x>
<y>0</y>
<width>990</width>
<height>24</height>
<height>19</height>
</rect>
</property>
<widget class="QMenu" name="mnuFile">
@ -218,17 +218,23 @@
</action>
<action name="actionPlay_mnu">
<property name="text">
<string>Play</string>
<string>&amp;Play</string>
</property>
<property name="shortcut">
<string>F10</string>
</property>
</action>
<action name="actionStop_mnu">
<property name="text">
<string>Stop</string>
<string>&amp;Stop</string>
</property>
<property name="shortcut">
<string>Esc</string>
</property>
</action>
<action name="actionReset">
<property name="text">
<string>Reset</string>
<string>&amp;Reset</string>
</property>
</action>
</widget>