Merge pull request #6008 from spycrab/qt_older
Qt: Support versions < 5.6
This commit is contained in:
commit
0de3593b45
|
@ -27,6 +27,7 @@
|
||||||
#include "DolphinQt2/GameList/GameList.h"
|
#include "DolphinQt2/GameList/GameList.h"
|
||||||
#include "DolphinQt2/GameList/GridProxyModel.h"
|
#include "DolphinQt2/GameList/GridProxyModel.h"
|
||||||
#include "DolphinQt2/GameList/ListProxyModel.h"
|
#include "DolphinQt2/GameList/ListProxyModel.h"
|
||||||
|
#include "DolphinQt2/QtUtils/ActionHelper.h"
|
||||||
#include "DolphinQt2/QtUtils/DoubleClickEventFilter.h"
|
#include "DolphinQt2/QtUtils/DoubleClickEventFilter.h"
|
||||||
#include "DolphinQt2/Settings.h"
|
#include "DolphinQt2/Settings.h"
|
||||||
#include "DolphinQt2/WiiUpdate.h"
|
#include "DolphinQt2/WiiUpdate.h"
|
||||||
|
@ -155,26 +156,26 @@ void GameList::ShowContextMenu(const QPoint&)
|
||||||
|
|
||||||
QMenu* menu = new QMenu(this);
|
QMenu* menu = new QMenu(this);
|
||||||
DiscIO::Platform platform = game->GetPlatformID();
|
DiscIO::Platform platform = game->GetPlatformID();
|
||||||
menu->addAction(tr("&Properties"), this, &GameList::OpenProperties);
|
AddAction(menu, tr("&Properties"), this, &GameList::OpenProperties);
|
||||||
menu->addAction(tr("&Wiki"), this, &GameList::OpenWiki);
|
AddAction(menu, tr("&Wiki"), this, &GameList::OpenWiki);
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
|
|
||||||
if (platform == DiscIO::Platform::GAMECUBE_DISC || platform == DiscIO::Platform::WII_DISC)
|
if (platform == DiscIO::Platform::GAMECUBE_DISC || platform == DiscIO::Platform::WII_DISC)
|
||||||
{
|
{
|
||||||
menu->addAction(tr("Set as &default ISO"), this, &GameList::SetDefaultISO);
|
AddAction(menu, tr("Set as &default ISO"), this, &GameList::SetDefaultISO);
|
||||||
const auto blob_type = game->GetBlobType();
|
const auto blob_type = game->GetBlobType();
|
||||||
|
|
||||||
if (blob_type == DiscIO::BlobType::GCZ)
|
if (blob_type == DiscIO::BlobType::GCZ)
|
||||||
menu->addAction(tr("Decompress ISO..."), this, &GameList::CompressISO);
|
AddAction(menu, tr("Decompress ISO..."), this, &GameList::CompressISO);
|
||||||
else if (blob_type == DiscIO::BlobType::PLAIN)
|
else if (blob_type == DiscIO::BlobType::PLAIN)
|
||||||
menu->addAction(tr("Compress ISO..."), this, &GameList::CompressISO);
|
AddAction(menu, tr("Compress ISO..."), this, &GameList::CompressISO);
|
||||||
|
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (platform == DiscIO::Platform::WII_DISC)
|
if (platform == DiscIO::Platform::WII_DISC)
|
||||||
{
|
{
|
||||||
menu->addAction(tr("Perform System Update"), [this] {
|
AddAction(menu, tr("Perform System Update"), this, [this] {
|
||||||
WiiUpdate::PerformDiscUpdate(GetSelectedGame()->GetFilePath().toStdString(), this);
|
WiiUpdate::PerformDiscUpdate(GetSelectedGame()->GetFilePath().toStdString(), this);
|
||||||
});
|
});
|
||||||
menu->setEnabled(!Core::IsRunning() || !SConfig::GetInstance().bWii);
|
menu->setEnabled(!Core::IsRunning() || !SConfig::GetInstance().bWii);
|
||||||
|
@ -206,13 +207,13 @@ void GameList::ShowContextMenu(const QPoint&)
|
||||||
|
|
||||||
if (platform == DiscIO::Platform::WII_WAD || platform == DiscIO::Platform::WII_DISC)
|
if (platform == DiscIO::Platform::WII_WAD || platform == DiscIO::Platform::WII_DISC)
|
||||||
{
|
{
|
||||||
menu->addAction(tr("Open Wii &save folder"), this, &GameList::OpenSaveFolder);
|
AddAction(menu, tr("Open Wii &save folder"), this, &GameList::OpenSaveFolder);
|
||||||
menu->addAction(tr("Export Wii save (Experimental)"), this, &GameList::ExportWiiSave);
|
AddAction(menu, tr("Export Wii save (Experimental)"), this, &GameList::ExportWiiSave);
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
}
|
}
|
||||||
|
|
||||||
menu->addAction(tr("Open &containing folder"), this, &GameList::OpenContainingFolder);
|
AddAction(menu, tr("Open &containing folder"), this, &GameList::OpenContainingFolder);
|
||||||
menu->addAction(tr("Delete File..."), this, &GameList::DeleteFile);
|
AddAction(menu, tr("Delete File..."), this, &GameList::DeleteFile);
|
||||||
|
|
||||||
QAction* netplay_host = new QAction(tr("Host with NetPlay"), menu);
|
QAction* netplay_host = new QAction(tr("Host with NetPlay"), menu);
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,10 @@ bool QtMsgAlertHandler(const char* caption, const char* text, bool yes_no, MsgTy
|
||||||
// /SubSystem:Windows
|
// /SubSystem:Windows
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
||||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||||
|
#endif
|
||||||
|
|
||||||
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||||
QCoreApplication::setOrganizationName(QStringLiteral("Dolphin Emulator"));
|
QCoreApplication::setOrganizationName(QStringLiteral("Dolphin Emulator"));
|
||||||
QCoreApplication::setOrganizationDomain(QStringLiteral("dolphin-emu.org"));
|
QCoreApplication::setOrganizationDomain(QStringLiteral("dolphin-emu.org"));
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "DiscIO/NANDImporter.h"
|
#include "DiscIO/NANDImporter.h"
|
||||||
#include "DolphinQt2/AboutDialog.h"
|
#include "DolphinQt2/AboutDialog.h"
|
||||||
#include "DolphinQt2/GameList/GameFile.h"
|
#include "DolphinQt2/GameList/GameFile.h"
|
||||||
|
#include "DolphinQt2/QtUtils/ActionHelper.h"
|
||||||
#include "DolphinQt2/Settings.h"
|
#include "DolphinQt2/Settings.h"
|
||||||
|
|
||||||
MenuBar::MenuBar(QWidget* parent) : QMenuBar(parent)
|
MenuBar::MenuBar(QWidget* parent) : QMenuBar(parent)
|
||||||
|
@ -100,9 +101,9 @@ void MenuBar::EmulationStopped()
|
||||||
void MenuBar::AddFileMenu()
|
void MenuBar::AddFileMenu()
|
||||||
{
|
{
|
||||||
QMenu* file_menu = addMenu(tr("&File"));
|
QMenu* file_menu = addMenu(tr("&File"));
|
||||||
m_open_action = file_menu->addAction(tr("&Open..."), this, &MenuBar::Open,
|
m_open_action = AddAction(file_menu, tr("&Open..."), this, &MenuBar::Open,
|
||||||
QKeySequence(QStringLiteral("Ctrl+O")));
|
QKeySequence(QStringLiteral("Ctrl+O")));
|
||||||
m_exit_action = file_menu->addAction(tr("E&xit"), this, &MenuBar::Exit,
|
m_exit_action = AddAction(file_menu, tr("E&xit"), this, &MenuBar::Exit,
|
||||||
QKeySequence(QStringLiteral("Alt+F4")));
|
QKeySequence(QStringLiteral("Alt+F4")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,32 +111,33 @@ void MenuBar::AddToolsMenu()
|
||||||
{
|
{
|
||||||
QMenu* tools_menu = addMenu(tr("&Tools"));
|
QMenu* tools_menu = addMenu(tr("&Tools"));
|
||||||
|
|
||||||
tools_menu->addAction(tr("Import Wii Save..."), this, &MenuBar::ImportWiiSave);
|
AddAction(tools_menu, tr("Import Wii Save..."), this, &MenuBar::ImportWiiSave);
|
||||||
tools_menu->addAction(tr("Export All Wii Saves"), this, &MenuBar::ExportWiiSaves);
|
AddAction(tools_menu, tr("Export All Wii Saves"), this, &MenuBar::ExportWiiSaves);
|
||||||
|
|
||||||
tools_menu->addSeparator();
|
tools_menu->addSeparator();
|
||||||
|
|
||||||
m_wad_install_action = tools_menu->addAction(tr("Install WAD..."), this, &MenuBar::InstallWAD);
|
m_wad_install_action = AddAction(tools_menu, tr("Install WAD..."), this, &MenuBar::InstallWAD);
|
||||||
|
|
||||||
tools_menu->addSeparator();
|
tools_menu->addSeparator();
|
||||||
QMenu* gc_ipl = tools_menu->addMenu(tr("Load GameCube Main Menu"));
|
QMenu* gc_ipl = tools_menu->addMenu(tr("Load GameCube Main Menu"));
|
||||||
|
|
||||||
m_ntscj_ipl = gc_ipl->addAction(tr("NTSC-J"), this,
|
m_ntscj_ipl = AddAction(gc_ipl, tr("NTSC-J"), this,
|
||||||
[this] { emit BootGameCubeIPL(DiscIO::Region::NTSC_J); });
|
[this] { emit BootGameCubeIPL(DiscIO::Region::NTSC_J); });
|
||||||
m_ntscu_ipl = gc_ipl->addAction(tr("NTSC-U"), this,
|
m_ntscu_ipl = AddAction(gc_ipl, tr("NTSC-U"), this,
|
||||||
[this] { emit BootGameCubeIPL(DiscIO::Region::NTSC_U); });
|
[this] { emit BootGameCubeIPL(DiscIO::Region::NTSC_U); });
|
||||||
m_pal_ipl =
|
m_pal_ipl =
|
||||||
gc_ipl->addAction(tr("PAL"), this, [this] { emit BootGameCubeIPL(DiscIO::Region::PAL); });
|
AddAction(gc_ipl, tr("PAL"), this, [this] { emit BootGameCubeIPL(DiscIO::Region::PAL); });
|
||||||
|
|
||||||
tools_menu->addAction(tr("Start &NetPlay..."), this, &MenuBar::StartNetPlay);
|
AddAction(tools_menu, tr("Start &NetPlay..."), this, &MenuBar::StartNetPlay);
|
||||||
tools_menu->addSeparator();
|
tools_menu->addSeparator();
|
||||||
|
|
||||||
// Label will be set by a NANDRefresh later
|
// Label will be set by a NANDRefresh later
|
||||||
m_boot_sysmenu = tools_menu->addAction(QStringLiteral(""), [this] { emit BootWiiSystemMenu(); });
|
m_boot_sysmenu =
|
||||||
m_import_backup = tools_menu->addAction(tr("Import BootMii NAND Backup..."),
|
AddAction(gc_ipl, QStringLiteral(""), this, [this] { emit BootWiiSystemMenu(); });
|
||||||
|
m_import_backup = AddAction(gc_ipl, tr("Import BootMii NAND Backup..."), this,
|
||||||
[this] { emit ImportNANDBackup(); });
|
[this] { emit ImportNANDBackup(); });
|
||||||
|
|
||||||
m_extract_certificates = tools_menu->addAction(tr("Extract Certificates from NAND"), this,
|
m_extract_certificates = AddAction(tools_menu, tr("Extract Certificates from NAND"), this,
|
||||||
&MenuBar::NANDExtractCertificates);
|
&MenuBar::NANDExtractCertificates);
|
||||||
|
|
||||||
m_boot_sysmenu->setEnabled(false);
|
m_boot_sysmenu->setEnabled(false);
|
||||||
|
@ -143,28 +145,31 @@ void MenuBar::AddToolsMenu()
|
||||||
connect(&Settings::Instance(), &Settings::NANDRefresh, [this] { UpdateToolsMenu(false); });
|
connect(&Settings::Instance(), &Settings::NANDRefresh, [this] { UpdateToolsMenu(false); });
|
||||||
|
|
||||||
m_perform_online_update_menu = tools_menu->addMenu(tr("Perform Online System Update"));
|
m_perform_online_update_menu = tools_menu->addMenu(tr("Perform Online System Update"));
|
||||||
m_perform_online_update_for_current_region = m_perform_online_update_menu->addAction(
|
m_perform_online_update_for_current_region =
|
||||||
tr("Current Region"), [this] { emit PerformOnlineUpdate(""); });
|
AddAction(m_perform_online_update_menu, tr("Current Region"), this,
|
||||||
|
[this] { emit PerformOnlineUpdate(""); });
|
||||||
m_perform_online_update_menu->addSeparator();
|
m_perform_online_update_menu->addSeparator();
|
||||||
m_perform_online_update_menu->addAction(tr("Europe"),
|
AddAction(m_perform_online_update_menu, tr("Europe"), this,
|
||||||
[this] { emit PerformOnlineUpdate("EUR"); });
|
[this] { emit PerformOnlineUpdate("EUR"); });
|
||||||
m_perform_online_update_menu->addAction(tr("Japan"), [this] { emit PerformOnlineUpdate("JPN"); });
|
AddAction(m_perform_online_update_menu, tr("Japan"), this,
|
||||||
m_perform_online_update_menu->addAction(tr("Korea"), [this] { emit PerformOnlineUpdate("KOR"); });
|
[this] { emit PerformOnlineUpdate("JPN"); });
|
||||||
m_perform_online_update_menu->addAction(tr("United States"),
|
AddAction(m_perform_online_update_menu, tr("Korea"), this,
|
||||||
|
[this] { emit PerformOnlineUpdate("KOR"); });
|
||||||
|
AddAction(m_perform_online_update_menu, tr("United States"), this,
|
||||||
[this] { emit PerformOnlineUpdate("USA"); });
|
[this] { emit PerformOnlineUpdate("USA"); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuBar::AddEmulationMenu()
|
void MenuBar::AddEmulationMenu()
|
||||||
{
|
{
|
||||||
QMenu* emu_menu = addMenu(tr("&Emulation"));
|
QMenu* emu_menu = addMenu(tr("&Emulation"));
|
||||||
m_play_action = emu_menu->addAction(tr("&Play"), this, &MenuBar::Play);
|
m_play_action = AddAction(emu_menu, tr("&Play"), this, &MenuBar::Play);
|
||||||
m_pause_action = emu_menu->addAction(tr("&Pause"), this, &MenuBar::Pause);
|
m_pause_action = AddAction(emu_menu, tr("&Pause"), this, &MenuBar::Pause);
|
||||||
m_stop_action = emu_menu->addAction(tr("&Stop"), this, &MenuBar::Stop);
|
m_stop_action = AddAction(emu_menu, tr("&Stop"), this, &MenuBar::Stop);
|
||||||
m_reset_action = emu_menu->addAction(tr("&Reset"), this, &MenuBar::Reset);
|
m_reset_action = AddAction(emu_menu, tr("&Reset"), this, &MenuBar::Reset);
|
||||||
m_fullscreen_action = emu_menu->addAction(tr("Toggle &Fullscreen"), this, &MenuBar::Fullscreen);
|
m_fullscreen_action = AddAction(emu_menu, tr("Toggle &Fullscreen"), this, &MenuBar::Fullscreen);
|
||||||
m_frame_advance_action = emu_menu->addAction(tr("&Frame Advance"), this, &MenuBar::FrameAdvance);
|
m_frame_advance_action = AddAction(emu_menu, tr("&Frame Advance"), this, &MenuBar::FrameAdvance);
|
||||||
|
|
||||||
m_screenshot_action = emu_menu->addAction(tr("Take Screenshot"), this, &MenuBar::Screenshot);
|
m_screenshot_action = AddAction(emu_menu, tr("Take Screenshot"), this, &MenuBar::Screenshot);
|
||||||
|
|
||||||
emu_menu->addSeparator();
|
emu_menu->addSeparator();
|
||||||
|
|
||||||
|
@ -177,10 +182,10 @@ void MenuBar::AddEmulationMenu()
|
||||||
void MenuBar::AddStateLoadMenu(QMenu* emu_menu)
|
void MenuBar::AddStateLoadMenu(QMenu* emu_menu)
|
||||||
{
|
{
|
||||||
m_state_load_menu = emu_menu->addMenu(tr("&Load State"));
|
m_state_load_menu = emu_menu->addMenu(tr("&Load State"));
|
||||||
m_state_load_menu->addAction(tr("Load State from File"), this, &MenuBar::StateLoad);
|
AddAction(m_state_load_menu, tr("Load State from File"), this, &MenuBar::StateLoad);
|
||||||
m_state_load_menu->addAction(tr("Load State from Selected Slot"), this, &MenuBar::StateLoadSlot);
|
AddAction(m_state_load_menu, tr("Load State from Selected Slot"), this, &MenuBar::StateLoadSlot);
|
||||||
m_state_load_slots_menu = m_state_load_menu->addMenu(tr("Load State from Slot"));
|
m_state_load_slots_menu = m_state_load_menu->addMenu(tr("Load State from Slot"));
|
||||||
m_state_load_menu->addAction(tr("Undo Load State"), this, &MenuBar::StateLoadUndo);
|
AddAction(m_state_load_menu, tr("Undo Load State"), this, &MenuBar::StateLoadUndo);
|
||||||
|
|
||||||
for (int i = 1; i <= 10; i++)
|
for (int i = 1; i <= 10; i++)
|
||||||
{
|
{
|
||||||
|
@ -193,11 +198,11 @@ void MenuBar::AddStateLoadMenu(QMenu* emu_menu)
|
||||||
void MenuBar::AddStateSaveMenu(QMenu* emu_menu)
|
void MenuBar::AddStateSaveMenu(QMenu* emu_menu)
|
||||||
{
|
{
|
||||||
m_state_save_menu = emu_menu->addMenu(tr("Sa&ve State"));
|
m_state_save_menu = emu_menu->addMenu(tr("Sa&ve State"));
|
||||||
m_state_save_menu->addAction(tr("Save State to File"), this, &MenuBar::StateSave);
|
AddAction(m_state_save_menu, tr("Save State to File"), this, &MenuBar::StateSave);
|
||||||
m_state_save_menu->addAction(tr("Save State to Selected Slot"), this, &MenuBar::StateSaveSlot);
|
AddAction(m_state_save_menu, tr("Save State to Selected Slot"), this, &MenuBar::StateSaveSlot);
|
||||||
m_state_save_menu->addAction(tr("Save State to Oldest Slot"), this, &MenuBar::StateSaveOldest);
|
AddAction(m_state_save_menu, tr("Save State to Oldest Slot"), this, &MenuBar::StateSaveOldest);
|
||||||
m_state_save_slots_menu = m_state_save_menu->addMenu(tr("Save State to Slot"));
|
m_state_save_slots_menu = m_state_save_menu->addMenu(tr("Save State to Slot"));
|
||||||
m_state_save_menu->addAction(tr("Undo Save State"), this, &MenuBar::StateSaveUndo);
|
AddAction(m_state_save_menu, tr("Undo Save State"), this, &MenuBar::StateSaveUndo);
|
||||||
|
|
||||||
for (int i = 1; i <= 10; i++)
|
for (int i = 1; i <= 10; i++)
|
||||||
{
|
{
|
||||||
|
@ -272,12 +277,12 @@ void MenuBar::AddViewMenu()
|
||||||
void MenuBar::AddOptionsMenu()
|
void MenuBar::AddOptionsMenu()
|
||||||
{
|
{
|
||||||
QMenu* options_menu = addMenu(tr("&Options"));
|
QMenu* options_menu = addMenu(tr("&Options"));
|
||||||
options_menu->addAction(tr("Co&nfiguration"), this, &MenuBar::Configure);
|
AddAction(options_menu, tr("Co&nfiguration"), this, &MenuBar::Configure);
|
||||||
options_menu->addSeparator();
|
options_menu->addSeparator();
|
||||||
options_menu->addAction(tr("&Graphics Settings"), this, &MenuBar::ConfigureGraphics);
|
AddAction(options_menu, tr("&Graphics Settings"), this, &MenuBar::ConfigureGraphics);
|
||||||
options_menu->addAction(tr("&Audio Settings"), this, &MenuBar::ConfigureAudio);
|
AddAction(options_menu, tr("&Audio Settings"), this, &MenuBar::ConfigureAudio);
|
||||||
options_menu->addAction(tr("&Controller Settings"), this, &MenuBar::ConfigureControllers);
|
AddAction(options_menu, tr("&Controller Settings"), this, &MenuBar::ConfigureControllers);
|
||||||
options_menu->addAction(tr("&Hotkey Settings"), this, &MenuBar::ConfigureHotkeys);
|
AddAction(options_menu, tr("&Hotkey Settings"), this, &MenuBar::ConfigureHotkeys);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuBar::AddHelpMenu()
|
void MenuBar::AddHelpMenu()
|
||||||
|
@ -296,7 +301,7 @@ void MenuBar::AddHelpMenu()
|
||||||
});
|
});
|
||||||
|
|
||||||
help_menu->addSeparator();
|
help_menu->addSeparator();
|
||||||
help_menu->addAction(tr("&About"), this, &MenuBar::ShowAboutDialog);
|
AddAction(help_menu, tr("&About"), this, &MenuBar::ShowAboutDialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuBar::AddGameListTypeSection(QMenu* view_menu)
|
void MenuBar::AddGameListTypeSection(QMenu* view_menu)
|
||||||
|
@ -413,13 +418,13 @@ void MenuBar::AddMovieMenu()
|
||||||
{
|
{
|
||||||
auto* movie_menu = addMenu(tr("&Movie"));
|
auto* movie_menu = addMenu(tr("&Movie"));
|
||||||
m_recording_start =
|
m_recording_start =
|
||||||
movie_menu->addAction(tr("Start Recording Input"), [this] { emit StartRecording(); });
|
AddAction(movie_menu, tr("Start Recording Input"), this, [this] { emit StartRecording(); });
|
||||||
m_recording_play =
|
m_recording_play =
|
||||||
movie_menu->addAction(tr("Play Input Recording..."), [this] { emit PlayRecording(); });
|
AddAction(movie_menu, tr("Play Input Recording..."), this, [this] { emit PlayRecording(); });
|
||||||
m_recording_stop =
|
m_recording_stop = AddAction(movie_menu, tr("Stop Playing/Recording Input"), this,
|
||||||
movie_menu->addAction(tr("Stop Playing/Recording Input"), [this] { emit StopRecording(); });
|
[this] { emit StopRecording(); });
|
||||||
m_recording_export =
|
m_recording_export =
|
||||||
movie_menu->addAction(tr("Export Recording..."), [this] { emit ExportRecording(); });
|
AddAction(movie_menu, tr("Export Recording..."), this, [this] { emit ExportRecording(); });
|
||||||
|
|
||||||
m_recording_start->setEnabled(false);
|
m_recording_start->setEnabled(false);
|
||||||
m_recording_play->setEnabled(false);
|
m_recording_play->setEnabled(false);
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
// Copyright 2017 Dolphin Emulator Project
|
||||||
|
// Licensed under GPLv2+
|
||||||
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QAction>
|
||||||
|
#include <QKeySequence>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
// Since we have to support Qt < 5.6, we need our own implementation of addAction(QString&
|
||||||
|
// text,QObject*,PointerToMemberFunction);
|
||||||
|
template <typename ParentClass, typename RecieverClass, typename Func>
|
||||||
|
QAction* AddAction(ParentClass* parent, const QString& text, const RecieverClass* receiver,
|
||||||
|
Func slot, const QKeySequence& shortcut = 0)
|
||||||
|
{
|
||||||
|
QAction* action = parent->addAction(text);
|
||||||
|
action->setShortcut(shortcut);
|
||||||
|
action->connect(action, &QAction::triggered, receiver, slot);
|
||||||
|
|
||||||
|
return action;
|
||||||
|
}
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
|
|
||||||
|
#include "DolphinQt2/QtUtils/ActionHelper.h"
|
||||||
#include "DolphinQt2/Resources.h"
|
#include "DolphinQt2/Resources.h"
|
||||||
#include "DolphinQt2/Settings.h"
|
#include "DolphinQt2/Settings.h"
|
||||||
#include "DolphinQt2/ToolBar.h"
|
#include "DolphinQt2/ToolBar.h"
|
||||||
|
@ -60,33 +61,33 @@ void ToolBar::EmulationStopped()
|
||||||
void ToolBar::MakeActions()
|
void ToolBar::MakeActions()
|
||||||
{
|
{
|
||||||
constexpr int button_width = 65;
|
constexpr int button_width = 65;
|
||||||
m_open_action = addAction(tr("Open"), this, &ToolBar::OpenPressed);
|
m_open_action = AddAction(this, tr("Open"), this, &ToolBar::OpenPressed);
|
||||||
widgetForAction(m_open_action)->setMinimumWidth(button_width);
|
widgetForAction(m_open_action)->setMinimumWidth(button_width);
|
||||||
|
|
||||||
m_play_action = addAction(tr("Play"), this, &ToolBar::PlayPressed);
|
m_play_action = AddAction(this, tr("Play"), this, &ToolBar::PlayPressed);
|
||||||
widgetForAction(m_play_action)->setMinimumWidth(button_width);
|
widgetForAction(m_play_action)->setMinimumWidth(button_width);
|
||||||
|
|
||||||
m_pause_action = addAction(tr("Pause"), this, &ToolBar::PausePressed);
|
m_pause_action = AddAction(this, tr("Pause"), this, &ToolBar::PausePressed);
|
||||||
widgetForAction(m_pause_action)->setMinimumWidth(button_width);
|
widgetForAction(m_pause_action)->setMinimumWidth(button_width);
|
||||||
|
|
||||||
m_stop_action = addAction(tr("Stop"), this, &ToolBar::StopPressed);
|
m_stop_action = AddAction(this, tr("Stop"), this, &ToolBar::StopPressed);
|
||||||
widgetForAction(m_stop_action)->setMinimumWidth(button_width);
|
widgetForAction(m_stop_action)->setMinimumWidth(button_width);
|
||||||
|
|
||||||
m_fullscreen_action = addAction(tr("FullScr"), this, &ToolBar::FullScreenPressed);
|
m_fullscreen_action = AddAction(this, tr("FullScr"), this, &ToolBar::FullScreenPressed);
|
||||||
widgetForAction(m_fullscreen_action)->setMinimumWidth(button_width);
|
widgetForAction(m_fullscreen_action)->setMinimumWidth(button_width);
|
||||||
|
|
||||||
m_screenshot_action = addAction(tr("ScrShot"), this, &ToolBar::ScreenShotPressed);
|
m_screenshot_action = AddAction(this, tr("ScrShot"), this, &ToolBar::ScreenShotPressed);
|
||||||
widgetForAction(m_screenshot_action)->setMinimumWidth(button_width);
|
widgetForAction(m_screenshot_action)->setMinimumWidth(button_width);
|
||||||
|
|
||||||
addSeparator();
|
addSeparator();
|
||||||
|
|
||||||
m_config_action = addAction(tr("Config"), this, &ToolBar::SettingsPressed);
|
m_config_action = AddAction(this, tr("Config"), this, &ToolBar::SettingsPressed);
|
||||||
widgetForAction(m_config_action)->setMinimumWidth(button_width);
|
widgetForAction(m_config_action)->setMinimumWidth(button_width);
|
||||||
|
|
||||||
m_graphics_action = addAction(tr("Graphics"), this, &ToolBar::GraphicsPressed);
|
m_graphics_action = AddAction(this, tr("Graphics"), this, &ToolBar::GraphicsPressed);
|
||||||
widgetForAction(m_graphics_action)->setMinimumWidth(button_width);
|
widgetForAction(m_graphics_action)->setMinimumWidth(button_width);
|
||||||
|
|
||||||
m_controllers_action = addAction(tr("Controllers"), this, &ToolBar::ControllersPressed);
|
m_controllers_action = AddAction(this, tr("Controllers"), this, &ToolBar::ControllersPressed);
|
||||||
widgetForAction(m_controllers_action)->setMinimumWidth(button_width);
|
widgetForAction(m_controllers_action)->setMinimumWidth(button_width);
|
||||||
m_controllers_action->setEnabled(true);
|
m_controllers_action->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue