From 16ea643f903837aab05b41ddccad28d12cf2663e Mon Sep 17 00:00:00 2001 From: numzero Date: Sat, 15 Nov 2025 18:48:22 +0300 Subject: [PATCH] clang-format --- .clang-format | 9 +++++++++ ui/src/api.cxx | 9 ++++----- ui/src/api.hxx | 4 ++-- ui/src/main.cxx | 11 +++++------ ui/src/main_window.cxx | 7 +++---- ui/src/main_window.hxx | 11 +++++------ ui/src/viewport.cxx | 3 ++- ui/src/viewport.hxx | 2 +- 8 files changed, 31 insertions(+), 25 deletions(-) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..ac4266e --- /dev/null +++ b/.clang-format @@ -0,0 +1,9 @@ +BasedOnStyle: LLVM +UseTab: Always +TabWidth: 4 +IndentWidth: 4 +AccessModifierOffset: -4 +IndentCaseLabels: false +ColumnLimit: 0 +PointerAlignment: Left +PackConstructorInitializers: Never diff --git a/ui/src/api.cxx b/ui/src/api.cxx index 0c6c40d..2acbb55 100644 --- a/ui/src/api.cxx +++ b/ui/src/api.cxx @@ -1,25 +1,24 @@ #include "api.hxx" -#include #include +#include namespace ffi { extern "C" Core* rt4_viewport_create(xcb_connection_t* connection, std::uint32_t window); extern "C" void rt4_viewport_destroy(Core* viewport); extern "C" void rt4_viewport_configure(Core* viewport, std::uint32_t width, std::uint32_t height); extern "C" void rt4_viewport_redraw(Core* viewport); -} +} // namespace ffi BoxCore::BoxCore(BoxCore&& b) - : ptr(std::exchange(b.ptr, {})) -{ + : ptr(std::exchange(b.ptr, {})) { } BoxCore::~BoxCore() { reset(); } -BoxCore& BoxCore::operator= (BoxCore&& b) { +BoxCore& BoxCore::operator=(BoxCore&& b) { if (&b == this) return *this; std::swap(ptr, b.ptr); diff --git a/ui/src/api.hxx b/ui/src/api.hxx index 0055435..02b8e70 100644 --- a/ui/src/api.hxx +++ b/ui/src/api.hxx @@ -27,8 +27,8 @@ public: BoxCore() = default; BoxCore(const BoxCore&) = delete; BoxCore(BoxCore&&); - BoxCore& operator= (const BoxCore&) = delete; - BoxCore& operator= (BoxCore&&); + BoxCore& operator=(const BoxCore&) = delete; + BoxCore& operator=(BoxCore&&); ~BoxCore(); explicit operator bool() const { return !!ptr; } diff --git a/ui/src/main.cxx b/ui/src/main.cxx index ca53693..f8ab482 100644 --- a/ui/src/main.cxx +++ b/ui/src/main.cxx @@ -2,12 +2,11 @@ #include -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); +int main(int argc, char* argv[]) { + QApplication app(argc, argv); - auto w = new PhotonLight; - w->show(); + auto w = new PhotonLight; + w->show(); - return app.exec(); + return app.exec(); } diff --git a/ui/src/main_window.cxx b/ui/src/main_window.cxx index de1b0d6..abdb991 100644 --- a/ui/src/main_window.cxx +++ b/ui/src/main_window.cxx @@ -2,10 +2,9 @@ #include "ui_main_window.h" -PhotonLight::PhotonLight(QWidget *parent) - : QMainWindow(parent) - , m_ui(new Ui::MainWindow) -{ +PhotonLight::PhotonLight(QWidget* parent) + : QMainWindow(parent), + m_ui(new Ui::MainWindow) { m_ui->setupUi(this); } diff --git a/ui/src/main_window.hxx b/ui/src/main_window.hxx index 92db5db..94005de 100644 --- a/ui/src/main_window.hxx +++ b/ui/src/main_window.hxx @@ -7,14 +7,13 @@ namespace Ui { class MainWindow; } -class PhotonLight : public QMainWindow -{ - Q_OBJECT +class PhotonLight : public QMainWindow { + Q_OBJECT public: - explicit PhotonLight(QWidget *parent = nullptr); - ~PhotonLight() override; + explicit PhotonLight(QWidget* parent = nullptr); + ~PhotonLight() override; private: - const std::unique_ptr m_ui; + const std::unique_ptr m_ui; }; diff --git a/ui/src/viewport.cxx b/ui/src/viewport.cxx index 0f89097..bf53b59 100644 --- a/ui/src/viewport.cxx +++ b/ui/src/viewport.cxx @@ -4,7 +4,8 @@ #include #include -Viewport::Viewport(QWidget* parent, Qt::WindowFlags f) : QWidget(parent, f) { +Viewport::Viewport(QWidget* parent, Qt::WindowFlags f) + : QWidget(parent, f) { setAttribute(Qt::WA_DontCreateNativeAncestors); setAttribute(Qt::WA_NativeWindow); setAttribute(Qt::WA_PaintOnScreen); diff --git a/ui/src/viewport.hxx b/ui/src/viewport.hxx index 846b53c..67eb446 100644 --- a/ui/src/viewport.hxx +++ b/ui/src/viewport.hxx @@ -4,7 +4,7 @@ #include "api.hxx" -class Viewport: public QWidget { +class Viewport : public QWidget { Q_OBJECT public: