mirror of
				https://git.zaroz.cloud/nintendo-back-up/yuzu/yuzu.git
				synced 2025-05-12 00:45:25 +00:00 
			
		
		
		
	qt: Migrate to Qt 5 signal/slot connection syntax where applicable
This commit is contained in:
		
							parent
							
								
									cb3ab6ec77
								
							
						
					
					
						commit
						5e46a9bb2b
					
				@ -289,6 +289,6 @@ void GRenderWindow::showEvent(QShowEvent* event) {
 | 
				
			|||||||
    QWidget::showEvent(event);
 | 
					    QWidget::showEvent(event);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // windowHandle() is not initialized until the Window is shown, so we connect it here.
 | 
					    // windowHandle() is not initialized until the Window is shown, so we connect it here.
 | 
				
			||||||
    connect(this->windowHandle(), SIGNAL(screenChanged(QScreen*)), this,
 | 
					    connect(windowHandle(), &QWindow::screenChanged, this, &GRenderWindow::OnFramebufferSizeChanged,
 | 
				
			||||||
            SLOT(OnFramebufferSizeChanged()), Qt::UniqueConnection);
 | 
					            Qt::UniqueConnection);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -74,7 +74,7 @@ QAction* MicroProfileDialog::toggleViewAction() {
 | 
				
			|||||||
        toggle_view_action = new QAction(windowTitle(), this);
 | 
					        toggle_view_action = new QAction(windowTitle(), this);
 | 
				
			||||||
        toggle_view_action->setCheckable(true);
 | 
					        toggle_view_action->setCheckable(true);
 | 
				
			||||||
        toggle_view_action->setChecked(isVisible());
 | 
					        toggle_view_action->setChecked(isVisible());
 | 
				
			||||||
        connect(toggle_view_action, SIGNAL(toggled(bool)), SLOT(setVisible(bool)));
 | 
					        connect(toggle_view_action, &QAction::toggled, this, &MicroProfileDialog::setVisible);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return toggle_view_action;
 | 
					    return toggle_view_action;
 | 
				
			||||||
@ -107,7 +107,8 @@ MicroProfileWidget::MicroProfileWidget(QWidget* parent) : QWidget(parent) {
 | 
				
			|||||||
    MicroProfileSetDisplayMode(1); // Timers screen
 | 
					    MicroProfileSetDisplayMode(1); // Timers screen
 | 
				
			||||||
    MicroProfileInitUI();
 | 
					    MicroProfileInitUI();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    connect(&update_timer, SIGNAL(timeout()), SLOT(update()));
 | 
					    connect(&update_timer, &QTimer::timeout, this,
 | 
				
			||||||
 | 
					            static_cast<void (MicroProfileWidget::*)()>(&MicroProfileWidget::update));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void MicroProfileWidget::paintEvent(QPaintEvent* ev) {
 | 
					void MicroProfileWidget::paintEvent(QPaintEvent* ev) {
 | 
				
			||||||
 | 
				
			|||||||
@ -114,8 +114,7 @@ GameList::SearchField::SearchField(GameList* parent) : QWidget{parent} {
 | 
				
			|||||||
    edit_filter->setPlaceholderText(tr("Enter pattern to filter"));
 | 
					    edit_filter->setPlaceholderText(tr("Enter pattern to filter"));
 | 
				
			||||||
    edit_filter->installEventFilter(keyReleaseEater);
 | 
					    edit_filter->installEventFilter(keyReleaseEater);
 | 
				
			||||||
    edit_filter->setClearButtonEnabled(true);
 | 
					    edit_filter->setClearButtonEnabled(true);
 | 
				
			||||||
    connect(edit_filter, SIGNAL(textChanged(const QString&)), parent,
 | 
					    connect(edit_filter, &QLineEdit::textChanged, parent, &GameList::onTextChanged);
 | 
				
			||||||
            SLOT(onTextChanged(const QString&)));
 | 
					 | 
				
			||||||
    label_filter_result = new QLabel;
 | 
					    label_filter_result = new QLabel;
 | 
				
			||||||
    button_filter_close = new QToolButton(this);
 | 
					    button_filter_close = new QToolButton(this);
 | 
				
			||||||
    button_filter_close->setText("X");
 | 
					    button_filter_close->setText("X");
 | 
				
			||||||
@ -124,7 +123,7 @@ GameList::SearchField::SearchField(GameList* parent) : QWidget{parent} {
 | 
				
			|||||||
                                       "#000000; font-weight: bold; background: #F0F0F0; }"
 | 
					                                       "#000000; font-weight: bold; background: #F0F0F0; }"
 | 
				
			||||||
                                       "QToolButton:hover{ border: none; padding: 0px; color: "
 | 
					                                       "QToolButton:hover{ border: none; padding: 0px; color: "
 | 
				
			||||||
                                       "#EEEEEE; font-weight: bold; background: #E81123}");
 | 
					                                       "#EEEEEE; font-weight: bold; background: #E81123}");
 | 
				
			||||||
    connect(button_filter_close, SIGNAL(clicked()), parent, SLOT(onFilterCloseClicked()));
 | 
					    connect(button_filter_close, &QToolButton::clicked, parent, &GameList::onFilterCloseClicked);
 | 
				
			||||||
    layout_filter->setSpacing(10);
 | 
					    layout_filter->setSpacing(10);
 | 
				
			||||||
    layout_filter->addWidget(label_filter);
 | 
					    layout_filter->addWidget(label_filter);
 | 
				
			||||||
    layout_filter->addWidget(edit_filter);
 | 
					    layout_filter->addWidget(edit_filter);
 | 
				
			||||||
 | 
				
			|||||||
@ -175,7 +175,7 @@ void GMainWindow::InitializeRecentFileMenuActions() {
 | 
				
			|||||||
    for (int i = 0; i < max_recent_files_item; ++i) {
 | 
					    for (int i = 0; i < max_recent_files_item; ++i) {
 | 
				
			||||||
        actions_recent_files[i] = new QAction(this);
 | 
					        actions_recent_files[i] = new QAction(this);
 | 
				
			||||||
        actions_recent_files[i]->setVisible(false);
 | 
					        actions_recent_files[i]->setVisible(false);
 | 
				
			||||||
        connect(actions_recent_files[i], SIGNAL(triggered()), this, SLOT(OnMenuRecentFile()));
 | 
					        connect(actions_recent_files[i], &QAction::triggered, this, &GMainWindow::OnMenuRecentFile);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ui.menu_recent_files->addAction(actions_recent_files[i]);
 | 
					        ui.menu_recent_files->addAction(actions_recent_files[i]);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -190,10 +190,10 @@ void GMainWindow::InitializeHotkeys() {
 | 
				
			|||||||
    RegisterHotkey("Main Window", "Exit Fullscreen", QKeySequence::Cancel, Qt::ApplicationShortcut);
 | 
					    RegisterHotkey("Main Window", "Exit Fullscreen", QKeySequence::Cancel, Qt::ApplicationShortcut);
 | 
				
			||||||
    LoadHotkeys();
 | 
					    LoadHotkeys();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    connect(GetHotkey("Main Window", "Load File", this), SIGNAL(activated()), this,
 | 
					    connect(GetHotkey("Main Window", "Load File", this), &QShortcut::activated, this,
 | 
				
			||||||
            SLOT(OnMenuLoadFile()));
 | 
					            &GMainWindow::OnMenuLoadFile);
 | 
				
			||||||
    connect(GetHotkey("Main Window", "Start Emulation", this), SIGNAL(activated()), this,
 | 
					    connect(GetHotkey("Main Window", "Start Emulation", this), &QShortcut::activated, this,
 | 
				
			||||||
            SLOT(OnStartGame()));
 | 
					            &GMainWindow::OnStartGame);
 | 
				
			||||||
    connect(GetHotkey("Main Window", "Fullscreen", render_window), &QShortcut::activated,
 | 
					    connect(GetHotkey("Main Window", "Fullscreen", render_window), &QShortcut::activated,
 | 
				
			||||||
            ui.action_Fullscreen, &QAction::trigger);
 | 
					            ui.action_Fullscreen, &QAction::trigger);
 | 
				
			||||||
    connect(GetHotkey("Main Window", "Fullscreen", render_window), &QShortcut::activatedAmbiguously,
 | 
					    connect(GetHotkey("Main Window", "Fullscreen", render_window), &QShortcut::activatedAmbiguously,
 | 
				
			||||||
@ -245,13 +245,14 @@ void GMainWindow::RestoreUIState() {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void GMainWindow::ConnectWidgetEvents() {
 | 
					void GMainWindow::ConnectWidgetEvents() {
 | 
				
			||||||
    connect(game_list, SIGNAL(GameChosen(QString)), this, SLOT(OnGameListLoadFile(QString)));
 | 
					    connect(game_list, &GameList::GameChosen, this, &GMainWindow::OnGameListLoadFile);
 | 
				
			||||||
    connect(game_list, SIGNAL(OpenSaveFolderRequested(u64)), this,
 | 
					    connect(game_list, &GameList::OpenSaveFolderRequested, this,
 | 
				
			||||||
            SLOT(OnGameListOpenSaveFolder(u64)));
 | 
					            &GMainWindow::OnGameListOpenSaveFolder);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    connect(this, SIGNAL(EmulationStarting(EmuThread*)), render_window,
 | 
					    connect(this, &GMainWindow::EmulationStarting, render_window,
 | 
				
			||||||
            SLOT(OnEmulationStarting(EmuThread*)));
 | 
					            &GRenderWindow::OnEmulationStarting);
 | 
				
			||||||
    connect(this, SIGNAL(EmulationStopping()), render_window, SLOT(OnEmulationStopping()));
 | 
					    connect(this, &GMainWindow::EmulationStopping, render_window,
 | 
				
			||||||
 | 
					            &GRenderWindow::OnEmulationStopping);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    connect(&status_bar_update_timer, &QTimer::timeout, this, &GMainWindow::UpdateStatusBar);
 | 
					    connect(&status_bar_update_timer, &QTimer::timeout, this, &GMainWindow::UpdateStatusBar);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -398,17 +399,17 @@ void GMainWindow::BootGame(const QString& filename) {
 | 
				
			|||||||
    render_window->moveContext();
 | 
					    render_window->moveContext();
 | 
				
			||||||
    emu_thread->start();
 | 
					    emu_thread->start();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    connect(render_window, SIGNAL(Closed()), this, SLOT(OnStopGame()));
 | 
					    connect(render_window, &GRenderWindow::Closed, this, &GMainWindow::OnStopGame);
 | 
				
			||||||
    // BlockingQueuedConnection is important here, it makes sure we've finished refreshing our views
 | 
					    // BlockingQueuedConnection is important here, it makes sure we've finished refreshing our views
 | 
				
			||||||
    // before the CPU continues
 | 
					    // before the CPU continues
 | 
				
			||||||
    connect(emu_thread.get(), SIGNAL(DebugModeEntered()), registersWidget,
 | 
					    connect(emu_thread.get(), &EmuThread::DebugModeEntered, registersWidget,
 | 
				
			||||||
            SLOT(OnDebugModeEntered()), Qt::BlockingQueuedConnection);
 | 
					            &RegistersWidget::OnDebugModeEntered, Qt::BlockingQueuedConnection);
 | 
				
			||||||
    connect(emu_thread.get(), SIGNAL(DebugModeEntered()), waitTreeWidget,
 | 
					    connect(emu_thread.get(), &EmuThread::DebugModeEntered, waitTreeWidget,
 | 
				
			||||||
            SLOT(OnDebugModeEntered()), Qt::BlockingQueuedConnection);
 | 
					            &WaitTreeWidget::OnDebugModeEntered, Qt::BlockingQueuedConnection);
 | 
				
			||||||
    connect(emu_thread.get(), SIGNAL(DebugModeLeft()), registersWidget, SLOT(OnDebugModeLeft()),
 | 
					    connect(emu_thread.get(), &EmuThread::DebugModeLeft, registersWidget,
 | 
				
			||||||
            Qt::BlockingQueuedConnection);
 | 
					            &RegistersWidget::OnDebugModeLeft, Qt::BlockingQueuedConnection);
 | 
				
			||||||
    connect(emu_thread.get(), SIGNAL(DebugModeLeft()), waitTreeWidget, SLOT(OnDebugModeLeft()),
 | 
					    connect(emu_thread.get(), &EmuThread::DebugModeLeft, waitTreeWidget,
 | 
				
			||||||
            Qt::BlockingQueuedConnection);
 | 
					            &WaitTreeWidget::OnDebugModeLeft, Qt::BlockingQueuedConnection);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Update the GUI
 | 
					    // Update the GUI
 | 
				
			||||||
    registersWidget->OnDebugModeEntered();
 | 
					    registersWidget->OnDebugModeEntered();
 | 
				
			||||||
@ -437,7 +438,7 @@ void GMainWindow::ShutdownGame() {
 | 
				
			|||||||
    emu_thread = nullptr;
 | 
					    emu_thread = nullptr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // The emulation is stopped, so closing the window or not does not matter anymore
 | 
					    // The emulation is stopped, so closing the window or not does not matter anymore
 | 
				
			||||||
    disconnect(render_window, SIGNAL(Closed()), this, SLOT(OnStopGame()));
 | 
					    disconnect(render_window, &GRenderWindow::Closed, this, &GMainWindow::OnStopGame);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Update the GUI
 | 
					    // Update the GUI
 | 
				
			||||||
    ui.action_Start->setEnabled(false);
 | 
					    ui.action_Start->setEnabled(false);
 | 
				
			||||||
@ -548,8 +549,7 @@ void GMainWindow::OnStartGame() {
 | 
				
			|||||||
    emu_thread->SetRunning(true);
 | 
					    emu_thread->SetRunning(true);
 | 
				
			||||||
    qRegisterMetaType<Core::System::ResultStatus>("Core::System::ResultStatus");
 | 
					    qRegisterMetaType<Core::System::ResultStatus>("Core::System::ResultStatus");
 | 
				
			||||||
    qRegisterMetaType<std::string>("std::string");
 | 
					    qRegisterMetaType<std::string>("std::string");
 | 
				
			||||||
    connect(emu_thread.get(), SIGNAL(ErrorThrown(Core::System::ResultStatus, std::string)), this,
 | 
					    connect(emu_thread.get(), &EmuThread::ErrorThrown, this, &GMainWindow::OnCoreError);
 | 
				
			||||||
            SLOT(OnCoreError(Core::System::ResultStatus, std::string)));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ui.action_Start->setEnabled(false);
 | 
					    ui.action_Start->setEnabled(false);
 | 
				
			||||||
    ui.action_Start->setText(tr("Continue"));
 | 
					    ui.action_Start->setText(tr("Continue"));
 | 
				
			||||||
 | 
				
			|||||||
@ -39,7 +39,7 @@ CSpinBox::CSpinBox(QWidget* parent)
 | 
				
			|||||||
    // TODO: Might be nice to not immediately call the slot.
 | 
					    // TODO: Might be nice to not immediately call the slot.
 | 
				
			||||||
    //       Think of an address that is being replaced by a different one, in which case a lot
 | 
					    //       Think of an address that is being replaced by a different one, in which case a lot
 | 
				
			||||||
    //       invalid intermediate addresses would be read from during editing.
 | 
					    //       invalid intermediate addresses would be read from during editing.
 | 
				
			||||||
    connect(lineEdit(), SIGNAL(textEdited(QString)), this, SLOT(OnEditingFinished()));
 | 
					    connect(lineEdit(), &QLineEdit::textEdited, this, &CSpinBox::OnEditingFinished);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    UpdateText();
 | 
					    UpdateText();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user