mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-30 05:20:04 +00:00
citra-qt : Implementing toolbar events
This commit is contained in:
parent
aaff548ef2
commit
fe094cae28
@ -105,6 +105,7 @@ GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) {
|
|||||||
|
|
||||||
ConnectMenuEvents();
|
ConnectMenuEvents();
|
||||||
ConnectWidgetEvents();
|
ConnectWidgetEvents();
|
||||||
|
ConnectToolbarEvents();
|
||||||
|
|
||||||
setWindowTitle(QString("Citra %1| %2-%3")
|
setWindowTitle(QString("Citra %1| %2-%3")
|
||||||
.arg(Common::g_build_name, Common::g_scm_branch, Common::g_scm_desc));
|
.arg(Common::g_build_name, Common::g_scm_branch, Common::g_scm_desc));
|
||||||
@ -325,6 +326,37 @@ void GMainWindow::ConnectMenuEvents() {
|
|||||||
connect(ui.action_Show_Status_Bar, &QAction::triggered, statusBar(), &QStatusBar::setVisible);
|
connect(ui.action_Show_Status_Bar, &QAction::triggered, statusBar(), &QStatusBar::setVisible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GMainWindow::ConnectToolbarEvents(){
|
||||||
|
// File
|
||||||
|
connect(ui.action_Toolbar_Load_File, &QAction::triggered, this, &GMainWindow::OnMenuLoadFile);
|
||||||
|
|
||||||
|
// Toggle fullscreen
|
||||||
|
connect(ui.action_Toolbar_Toggle_Fullscreen, &QAction::triggered, this, [this] {
|
||||||
|
if (isFullScreen()) {
|
||||||
|
showNormal();
|
||||||
|
ui.action_Toolbar_Toggle_Fullscreen->setIcon(QIcon(":toolbar_icons/rc/fullscreen.png"));
|
||||||
|
} else {
|
||||||
|
showFullScreen();
|
||||||
|
ui.action_Toolbar_Toggle_Fullscreen->setIcon(QIcon(":toolbar_icons/rc/fullscreen_exit.png"));
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
// Emulation
|
||||||
|
connect(ui.action_Toolbar_Stop, &QAction::triggered, this, &GMainWindow::OnStopGame);
|
||||||
|
connect(ui.action_Toolbar_Start_Pause, &QAction::triggered, this, [this] {
|
||||||
|
if (emulation_running) {
|
||||||
|
OnPauseGame();
|
||||||
|
emulation_running = false;
|
||||||
|
} else {
|
||||||
|
OnStartGame();
|
||||||
|
emulation_running = true;
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
// Configure
|
||||||
|
connect(ui.action_Toolbar_Configure, &QAction::triggered, this, &GMainWindow::OnConfigure);
|
||||||
|
}
|
||||||
|
|
||||||
void GMainWindow::OnDisplayTitleBars(bool show) {
|
void GMainWindow::OnDisplayTitleBars(bool show) {
|
||||||
QList<QDockWidget*> widgets = findChildren<QDockWidget*>();
|
QList<QDockWidget*> widgets = findChildren<QDockWidget*>();
|
||||||
|
|
||||||
@ -483,6 +515,10 @@ void GMainWindow::ShutdownGame() {
|
|||||||
disconnect(render_window, SIGNAL(Closed()), this, SLOT(OnStopGame()));
|
disconnect(render_window, SIGNAL(Closed()), this, SLOT(OnStopGame()));
|
||||||
|
|
||||||
// Update the GUI
|
// Update the GUI
|
||||||
|
ui.action_Toolbar_Start_Pause->setEnabled(false);
|
||||||
|
ui.action_Toolbar_Start_Pause->setIcon(QIcon(":toolbar_icons/rc/play.png"));
|
||||||
|
ui.action_Toolbar_Start_Pause->setToolTip(tr("Start"));
|
||||||
|
ui.action_Toolbar_Stop->setEnabled(false);
|
||||||
ui.action_Start->setEnabled(false);
|
ui.action_Start->setEnabled(false);
|
||||||
ui.action_Start->setText(tr("Start"));
|
ui.action_Start->setText(tr("Start"));
|
||||||
ui.action_Pause->setEnabled(false);
|
ui.action_Pause->setEnabled(false);
|
||||||
@ -610,6 +646,12 @@ void GMainWindow::OnStartGame() {
|
|||||||
|
|
||||||
ui.action_Pause->setEnabled(true);
|
ui.action_Pause->setEnabled(true);
|
||||||
ui.action_Stop->setEnabled(true);
|
ui.action_Stop->setEnabled(true);
|
||||||
|
|
||||||
|
ui.action_Toolbar_Start_Pause->setEnabled(true);
|
||||||
|
ui.action_Toolbar_Start_Pause->setIcon(QIcon(":toolbar_icons/rc/pause.png"));
|
||||||
|
ui.action_Toolbar_Start_Pause->setToolTip(tr("Pause"));
|
||||||
|
|
||||||
|
ui.action_Toolbar_Stop->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::OnPauseGame() {
|
void GMainWindow::OnPauseGame() {
|
||||||
@ -618,6 +660,9 @@ void GMainWindow::OnPauseGame() {
|
|||||||
ui.action_Start->setEnabled(true);
|
ui.action_Start->setEnabled(true);
|
||||||
ui.action_Pause->setEnabled(false);
|
ui.action_Pause->setEnabled(false);
|
||||||
ui.action_Stop->setEnabled(true);
|
ui.action_Stop->setEnabled(true);
|
||||||
|
|
||||||
|
ui.action_Toolbar_Start_Pause->setIcon(QIcon(":toolbar_icons/rc/play.png"));
|
||||||
|
ui.action_Toolbar_Start_Pause->setToolTip(tr("Continue"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::OnStopGame() {
|
void GMainWindow::OnStopGame() {
|
||||||
|
@ -75,6 +75,7 @@ private:
|
|||||||
|
|
||||||
void ConnectWidgetEvents();
|
void ConnectWidgetEvents();
|
||||||
void ConnectMenuEvents();
|
void ConnectMenuEvents();
|
||||||
|
void ConnectToolbarEvents();
|
||||||
|
|
||||||
bool LoadROM(const QString& filename);
|
bool LoadROM(const QString& filename);
|
||||||
void BootGame(const QString& filename);
|
void BootGame(const QString& filename);
|
||||||
|
@ -103,13 +103,16 @@
|
|||||||
<addaction name="menu_Help"/>
|
<addaction name="menu_Help"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QToolBar" name="toolbar">
|
<widget class="QToolBar" name="toolbar">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Toolbar</string>
|
<string>Toolbar</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
<size>
|
<size>
|
||||||
<width>30</width>
|
<width>35</width>
|
||||||
<height>28</height>
|
<height>30</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="floatable">
|
<property name="floatable">
|
||||||
@ -248,6 +251,9 @@
|
|||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_Toolbar_Start_Pause">
|
<action name="action_Toolbar_Start_Pause">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../../dist/toolbar_icons/toolbar_icons.qrc">
|
<iconset resource="../../dist/toolbar_icons/toolbar_icons.qrc">
|
||||||
<normaloff>:/toolbar_icons/rc/start.png</normaloff>:/toolbar_icons/rc/start.png</iconset>
|
<normaloff>:/toolbar_icons/rc/start.png</normaloff>:/toolbar_icons/rc/start.png</iconset>
|
||||||
@ -276,7 +282,7 @@
|
|||||||
</action>
|
</action>
|
||||||
<action name="action_Toolbar_Configure">
|
<action name="action_Toolbar_Configure">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../../dist/toolbar_icons/toolbar_icons.qrc">
|
<iconset resource="../../dist/toolbar_icons/toolbar_icons.qrc">
|
||||||
|
Loading…
Reference in New Issue
Block a user