clang-format: Increase column limit from 80 to 120

This commit is contained in:
Ryan Foster
2024-10-04 17:33:58 -04:00
parent 109f64c446
commit a1fbf1015f
736 changed files with 22684 additions and 45435 deletions

View File

@@ -38,16 +38,12 @@ OBSBasicInteraction::OBSBasicInteraction(QWidget *parent, OBSSource source_)
main(qobject_cast<OBSBasic *>(parent)),
ui(new Ui::OBSBasicInteraction),
source(source_),
removedSignal(obs_source_get_signal_handler(source), "remove",
OBSBasicInteraction::SourceRemoved, this),
renamedSignal(obs_source_get_signal_handler(source), "rename",
OBSBasicInteraction::SourceRenamed, this),
removedSignal(obs_source_get_signal_handler(source), "remove", OBSBasicInteraction::SourceRemoved, this),
renamedSignal(obs_source_get_signal_handler(source), "rename", OBSBasicInteraction::SourceRenamed, this),
eventFilter(BuildEventFilter())
{
int cx = (int)config_get_int(App()->GetUserConfig(),
"InteractionWindow", "cx");
int cy = (int)config_get_int(App()->GetUserConfig(),
"InteractionWindow", "cy");
int cx = (int)config_get_int(App()->GetUserConfig(), "InteractionWindow", "cx");
int cy = (int)config_get_int(App()->GetUserConfig(), "InteractionWindow", "cy");
Qt::WindowFlags flags = windowFlags();
Qt::WindowFlags helpFlag = Qt::WindowContextHelpButtonHint;
@@ -66,9 +62,7 @@ OBSBasicInteraction::OBSBasicInteraction(QWidget *parent, OBSSource source_)
setWindowTitle(QTStr("Basic.InteractionWindow").arg(QT_UTF8(name)));
auto addDrawCallback = [this]() {
obs_display_add_draw_callback(ui->preview->GetDisplay(),
OBSBasicInteraction::DrawPreview,
this);
obs_display_add_draw_callback(ui->preview->GetDisplay(), OBSBasicInteraction::DrawPreview, this);
};
connect(ui->preview, &OBSQTDisplay::DisplayCreated, addDrawCallback);
@@ -88,25 +82,20 @@ OBSEventFilter *OBSBasicInteraction::BuildEventFilter()
case QEvent::MouseButtonPress:
case QEvent::MouseButtonRelease:
case QEvent::MouseButtonDblClick:
return this->HandleMouseClickEvent(
static_cast<QMouseEvent *>(event));
return this->HandleMouseClickEvent(static_cast<QMouseEvent *>(event));
case QEvent::MouseMove:
case QEvent::Enter:
case QEvent::Leave:
return this->HandleMouseMoveEvent(
static_cast<QMouseEvent *>(event));
return this->HandleMouseMoveEvent(static_cast<QMouseEvent *>(event));
case QEvent::Wheel:
return this->HandleMouseWheelEvent(
static_cast<QWheelEvent *>(event));
return this->HandleMouseWheelEvent(static_cast<QWheelEvent *>(event));
case QEvent::FocusIn:
case QEvent::FocusOut:
return this->HandleFocusEvent(
static_cast<QFocusEvent *>(event));
return this->HandleFocusEvent(static_cast<QFocusEvent *>(event));
case QEvent::KeyPress:
case QEvent::KeyRelease:
return this->HandleKeyEvent(
static_cast<QKeyEvent *>(event));
return this->HandleKeyEvent(static_cast<QKeyEvent *>(event));
default:
return false;
}
@@ -115,8 +104,7 @@ OBSEventFilter *OBSBasicInteraction::BuildEventFilter()
void OBSBasicInteraction::SourceRemoved(void *data, calldata_t *)
{
QMetaObject::invokeMethod(static_cast<OBSBasicInteraction *>(data),
"close");
QMetaObject::invokeMethod(static_cast<OBSBasicInteraction *>(data), "close");
}
void OBSBasicInteraction::SourceRenamed(void *data, calldata_t *params)
@@ -124,8 +112,7 @@ void OBSBasicInteraction::SourceRenamed(void *data, calldata_t *params)
const char *name = calldata_string(params, "new_name");
QString title = QTStr("Basic.InteractionWindow").arg(QT_UTF8(name));
QMetaObject::invokeMethod(static_cast<OBSBasicProperties *>(data),
"setWindowTitle", Q_ARG(QString, title));
QMetaObject::invokeMethod(static_cast<OBSBasicProperties *>(data), "setWindowTitle", Q_ARG(QString, title));
}
void OBSBasicInteraction::DrawPreview(void *data, uint32_t cx, uint32_t cy)
@@ -166,31 +153,24 @@ void OBSBasicInteraction::closeEvent(QCloseEvent *event)
if (!event->isAccepted())
return;
config_set_int(App()->GetAppConfig(), "InteractionWindow", "cx",
width());
config_set_int(App()->GetAppConfig(), "InteractionWindow", "cy",
height());
config_set_int(App()->GetAppConfig(), "InteractionWindow", "cx", width());
config_set_int(App()->GetAppConfig(), "InteractionWindow", "cy", height());
obs_display_remove_draw_callback(ui->preview->GetDisplay(),
OBSBasicInteraction::DrawPreview,
this);
obs_display_remove_draw_callback(ui->preview->GetDisplay(), OBSBasicInteraction::DrawPreview, this);
}
bool OBSBasicInteraction::nativeEvent(const QByteArray &, void *message,
qintptr *)
bool OBSBasicInteraction::nativeEvent(const QByteArray &, void *message, qintptr *)
{
#ifdef _WIN32
const MSG &msg = *static_cast<MSG *>(message);
switch (msg.message) {
case WM_MOVE:
for (OBSQTDisplay *const display :
findChildren<OBSQTDisplay *>()) {
for (OBSQTDisplay *const display : findChildren<OBSQTDisplay *>()) {
display->OnMove();
}
break;
case WM_DISPLAYCHANGE:
for (OBSQTDisplay *const display :
findChildren<OBSQTDisplay *>()) {
for (OBSQTDisplay *const display : findChildren<OBSQTDisplay *>()) {
display->OnDisplayChange();
}
}
@@ -201,8 +181,7 @@ bool OBSBasicInteraction::nativeEvent(const QByteArray &, void *message,
return false;
}
static int TranslateQtKeyboardEventModifiers(QInputEvent *event,
bool mouseEvent)
static int TranslateQtKeyboardEventModifiers(QInputEvent *event, bool mouseEvent)
{
int obsModifiers = INTERACT_NONE;
@@ -244,8 +223,7 @@ static int TranslateQtMouseEventModifiers(QMouseEvent *event)
return modifiers;
}
bool OBSBasicInteraction::GetSourceRelativeXY(int mouseX, int mouseY, int &relX,
int &relY)
bool OBSBasicInteraction::GetSourceRelativeXY(int mouseX, int mouseY, int &relX, int &relY)
{
float pixelRatio = devicePixelRatioF();
int mouseXscaled = (int)roundf(mouseX * pixelRatio);
@@ -259,8 +237,7 @@ bool OBSBasicInteraction::GetSourceRelativeXY(int mouseX, int mouseY, int &relX,
int x, y;
float scale;
GetScaleAndCenterPos(sourceCX, sourceCY, size.width(), size.height(), x,
y, scale);
GetScaleAndCenterPos(sourceCX, sourceCY, size.width(), size.height(), x, y, scale);
if (x > 0) {
relX = int(float(mouseXscaled - x) / scale);
@@ -312,12 +289,10 @@ bool OBSBasicInteraction::HandleMouseClickEvent(QMouseEvent *event)
// clickCount = 2;
QPoint pos = event->pos();
bool insideSource = GetSourceRelativeXY(pos.x(), pos.y(), mouseEvent.x,
mouseEvent.y);
bool insideSource = GetSourceRelativeXY(pos.x(), pos.y(), mouseEvent.x, mouseEvent.y);
if (mouseUp || insideSource)
obs_source_send_mouse_click(source, &mouseEvent, button,
mouseUp, clickCount);
obs_source_send_mouse_click(source, &mouseEvent, button, mouseUp, clickCount);
return true;
}
@@ -331,8 +306,7 @@ bool OBSBasicInteraction::HandleMouseMoveEvent(QMouseEvent *event)
if (!mouseLeave) {
mouseEvent.modifiers = TranslateQtMouseEventModifiers(event);
QPoint pos = event->pos();
mouseLeave = !GetSourceRelativeXY(pos.x(), pos.y(),
mouseEvent.x, mouseEvent.y);
mouseLeave = !GetSourceRelativeXY(pos.x(), pos.y(), mouseEvent.x, mouseEvent.y);
}
obs_source_send_mouse_move(source, &mouseEvent, mouseLeave);
@@ -367,8 +341,7 @@ bool OBSBasicInteraction::HandleMouseWheelEvent(QWheelEvent *event)
const int y = position.y();
if (GetSourceRelativeXY(x, y, mouseEvent.x, mouseEvent.y)) {
obs_source_send_mouse_wheel(source, &mouseEvent, xDelta,
yDelta);
obs_source_send_mouse_wheel(source, &mouseEvent, xDelta, yDelta);
}
return true;