From dc8479928c5aee4c6ad6fe4f59006fb604cee701 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sun, 18 Sep 2016 09:38:01 +0900 Subject: Sources: Run clang-format on everything. --- src/citra_qt/bootmanager.cpp | 134 +++++++++++++++++++++---------------------- 1 file changed, 66 insertions(+), 68 deletions(-) (limited to 'src/citra_qt/bootmanager.cpp') diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index 6dddde9ba..01cc6b9ca 100644 --- a/src/citra_qt/bootmanager.cpp +++ b/src/citra_qt/bootmanager.cpp @@ -22,13 +22,13 @@ #include "video_core/debug_utils/debug_utils.h" #include "video_core/video_core.h" -#define APP_NAME "citra" -#define APP_VERSION "0.1-" VERSION -#define APP_TITLE APP_NAME " " APP_VERSION -#define COPYRIGHT "Copyright (C) 2013-2014 Citra Team" +#define APP_NAME "citra" +#define APP_VERSION "0.1-" VERSION +#define APP_TITLE APP_NAME " " APP_VERSION +#define COPYRIGHT "Copyright (C) 2013-2014 Citra Team" -EmuThread::EmuThread(GRenderWindow* render_window) : - exec_step(false), running(false), stop_run(false), render_window(render_window) { +EmuThread::EmuThread(GRenderWindow* render_window) + : exec_step(false), running(false), stop_run(false), render_window(render_window) { } void EmuThread::run() { @@ -64,7 +64,7 @@ void EmuThread::run() { was_active = false; } else { std::unique_lock lock(running_mutex); - running_cv.wait(lock, [this]{ return IsRunning() || exec_step || stop_run; }); + running_cv.wait(lock, [this] { return IsRunning() || exec_step || stop_run; }); } } @@ -78,13 +78,13 @@ void EmuThread::run() { render_window->moveContext(); } -// This class overrides paintEvent and resizeEvent to prevent the GUI thread from stealing GL context. +// This class overrides paintEvent and resizeEvent to prevent the GUI thread from stealing GL +// context. // The corresponding functionality is handled in EmuThread instead -class GGLWidgetInternal : public QGLWidget -{ +class GGLWidgetInternal : public QGLWidget { public: GGLWidgetInternal(QGLFormat fmt, GRenderWindow* parent) - : QGLWidget(fmt, parent), parent(parent) { + : QGLWidget(fmt, parent), parent(parent) { } void paintEvent(QPaintEvent* ev) override { @@ -98,37 +98,43 @@ public: parent->OnFramebufferSizeChanged(); } - void DisablePainting() { do_painting = false; } - void EnablePainting() { do_painting = true; } + void DisablePainting() { + do_painting = false; + } + void EnablePainting() { + do_painting = true; + } private: GRenderWindow* parent; bool do_painting; }; -GRenderWindow::GRenderWindow(QWidget* parent, EmuThread* emu_thread) : - QWidget(parent), keyboard_id(0), emu_thread(emu_thread), child(nullptr) { +GRenderWindow::GRenderWindow(QWidget* parent, EmuThread* emu_thread) + : QWidget(parent), keyboard_id(0), emu_thread(emu_thread), child(nullptr) { - std::string window_title = Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc); + std::string window_title = + Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc); setWindowTitle(QString::fromStdString(window_title)); keyboard_id = KeyMap::NewDeviceId(); ReloadSetKeymaps(); } -void GRenderWindow::moveContext() -{ +void GRenderWindow::moveContext() { DoneCurrent(); - // We need to move GL context to the swapping thread in Qt5 +// We need to move GL context to the swapping thread in Qt5 #if QT_VERSION > QT_VERSION_CHECK(5, 0, 0) - // If the thread started running, move the GL Context to the new thread. Otherwise, move it back. - auto thread = (QThread::currentThread() == qApp->thread() && emu_thread != nullptr) ? emu_thread : qApp->thread(); + // If the thread started running, move the GL Context to the new thread. Otherwise, move it + // back. + auto thread = (QThread::currentThread() == qApp->thread() && emu_thread != nullptr) + ? emu_thread + : qApp->thread(); child->context()->moveToThread(thread); #endif } -void GRenderWindow::SwapBuffers() -{ +void GRenderWindow::SwapBuffers() { #if !defined(QT_NO_DEBUG) // Qt debug runtime prints a bogus warning on the console if you haven't called makeCurrent // since the last time you called swapBuffers. This presumably means something if you're using @@ -139,13 +145,11 @@ void GRenderWindow::SwapBuffers() child->swapBuffers(); } -void GRenderWindow::MakeCurrent() -{ +void GRenderWindow::MakeCurrent() { child->makeCurrent(); } -void GRenderWindow::DoneCurrent() -{ +void GRenderWindow::DoneCurrent() { child->doneCurrent(); } @@ -157,36 +161,33 @@ void GRenderWindow::PollEvents() { // Older versions get the window size (density independent pixels), // and hence, do not support DPI scaling ("retina" displays). // The result will be a viewport that is smaller than the extent of the window. -void GRenderWindow::OnFramebufferSizeChanged() -{ - // Screen changes potentially incur a change in screen DPI, hence we should update the framebuffer size +void GRenderWindow::OnFramebufferSizeChanged() { + // Screen changes potentially incur a change in screen DPI, hence we should update the + // framebuffer size qreal pixelRatio = windowPixelRatio(); unsigned width = child->QPaintDevice::width() * pixelRatio; unsigned height = child->QPaintDevice::height() * pixelRatio; - NotifyFramebufferLayoutChanged(EmuWindow::FramebufferLayout::DefaultScreenLayout(width, height)); + NotifyFramebufferLayoutChanged( + EmuWindow::FramebufferLayout::DefaultScreenLayout(width, height)); } -void GRenderWindow::BackupGeometry() -{ +void GRenderWindow::BackupGeometry() { geometry = ((QGLWidget*)this)->saveGeometry(); } -void GRenderWindow::RestoreGeometry() -{ +void GRenderWindow::RestoreGeometry() { // We don't want to back up the geometry here (obviously) QWidget::restoreGeometry(geometry); } -void GRenderWindow::restoreGeometry(const QByteArray& geometry) -{ +void GRenderWindow::restoreGeometry(const QByteArray& geometry) { // Make sure users of this class don't need to deal with backing up the geometry themselves QWidget::restoreGeometry(geometry); BackupGeometry(); } -QByteArray GRenderWindow::saveGeometry() -{ +QByteArray GRenderWindow::saveGeometry() { // If we are a top-level widget, store the current geometry // otherwise, store the last backup if (parent() == nullptr) @@ -195,8 +196,7 @@ QByteArray GRenderWindow::saveGeometry() return geometry; } -qreal GRenderWindow::windowPixelRatio() -{ +qreal GRenderWindow::windowPixelRatio() { #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) // windowHandle() might not be accessible until the window is displayed to screen. return windowHandle() ? windowHandle()->screen()->devicePixelRatio() : 1.0f; @@ -210,20 +210,16 @@ void GRenderWindow::closeEvent(QCloseEvent* event) { QWidget::closeEvent(event); } -void GRenderWindow::keyPressEvent(QKeyEvent* event) -{ - KeyMap::PressKey(*this, { event->key(), keyboard_id }); +void GRenderWindow::keyPressEvent(QKeyEvent* event) { + KeyMap::PressKey(*this, {event->key(), keyboard_id}); } -void GRenderWindow::keyReleaseEvent(QKeyEvent* event) -{ - KeyMap::ReleaseKey(*this, { event->key(), keyboard_id }); +void GRenderWindow::keyReleaseEvent(QKeyEvent* event) { + KeyMap::ReleaseKey(*this, {event->key(), keyboard_id}); } -void GRenderWindow::mousePressEvent(QMouseEvent *event) -{ - if (event->button() == Qt::LeftButton) - { +void GRenderWindow::mousePressEvent(QMouseEvent* event) { + if (event->button() == Qt::LeftButton) { auto pos = event->pos(); qreal pixelRatio = windowPixelRatio(); this->TouchPressed(static_cast(pos.x() * pixelRatio), @@ -231,30 +227,28 @@ void GRenderWindow::mousePressEvent(QMouseEvent *event) } } -void GRenderWindow::mouseMoveEvent(QMouseEvent *event) -{ +void GRenderWindow::mouseMoveEvent(QMouseEvent* event) { auto pos = event->pos(); qreal pixelRatio = windowPixelRatio(); this->TouchMoved(std::max(static_cast(pos.x() * pixelRatio), 0u), std::max(static_cast(pos.y() * pixelRatio), 0u)); } -void GRenderWindow::mouseReleaseEvent(QMouseEvent *event) -{ +void GRenderWindow::mouseReleaseEvent(QMouseEvent* event) { if (event->button() == Qt::LeftButton) this->TouchReleased(); } -void GRenderWindow::ReloadSetKeymaps() -{ +void GRenderWindow::ReloadSetKeymaps() { KeyMap::ClearKeyMapping(keyboard_id); for (int i = 0; i < Settings::NativeInput::NUM_INPUTS; ++i) { - KeyMap::SetKeyMapping({ Settings::values.input_mappings[Settings::NativeInput::All[i]], keyboard_id }, KeyMap::mapping_targets[i]); + KeyMap::SetKeyMapping( + {Settings::values.input_mappings[Settings::NativeInput::All[i]], keyboard_id}, + KeyMap::mapping_targets[i]); } } -void GRenderWindow::OnClientAreaResized(unsigned width, unsigned height) -{ +void GRenderWindow::OnClientAreaResized(unsigned width, unsigned height) { NotifyClientAreaSizeChanged(std::make_pair(width, height)); } @@ -267,7 +261,8 @@ void GRenderWindow::InitRenderTarget() { delete layout(); } - // TODO: One of these flags might be interesting: WA_OpaquePaintEvent, WA_NoBackground, WA_DontShowOnScreen, WA_DeleteOnClose + // TODO: One of these flags might be interesting: WA_OpaquePaintEvent, WA_NoBackground, + // WA_DontShowOnScreen, WA_DeleteOnClose QGLFormat fmt; fmt.setVersion(3, 3); fmt.setProfile(QGLFormat::CoreProfile); @@ -279,7 +274,8 @@ void GRenderWindow::InitRenderTarget() { child = new GGLWidgetInternal(fmt, this); QBoxLayout* layout = new QHBoxLayout(this); - resize(VideoCore::kScreenTopWidth, VideoCore::kScreenTopHeight + VideoCore::kScreenBottomHeight); + resize(VideoCore::kScreenTopWidth, + VideoCore::kScreenTopHeight + VideoCore::kScreenBottomHeight); layout->addWidget(child); layout->setMargin(0); setLayout(layout); @@ -292,7 +288,8 @@ void GRenderWindow::InitRenderTarget() { BackupGeometry(); } -void GRenderWindow::OnMinimalClientAreaChangeRequest(const std::pair& minimal_size) { +void GRenderWindow::OnMinimalClientAreaChangeRequest( + const std::pair& minimal_size) { setMinimumSize(minimal_size.first, minimal_size.second); } @@ -306,11 +303,12 @@ void GRenderWindow::OnEmulationStopping() { child->EnablePainting(); } -void GRenderWindow::showEvent(QShowEvent * event) { +void GRenderWindow::showEvent(QShowEvent* event) { QWidget::showEvent(event); - // windowHandle() is not initialized until the Window is shown, so we connect it here. - #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) - connect(this->windowHandle(), SIGNAL(screenChanged(QScreen*)), this, SLOT(OnFramebufferSizeChanged()), Qt::UniqueConnection); - #endif +// windowHandle() is not initialized until the Window is shown, so we connect it here. +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + connect(this->windowHandle(), SIGNAL(screenChanged(QScreen*)), this, + SLOT(OnFramebufferSizeChanged()), Qt::UniqueConnection); +#endif } -- cgit v1.2.3