mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Merge branch 'master' into fix/stop_windows_code_from_abort()ing_our_process
This commit is contained in:
commit
ca97fa4d76
40 changed files with 301 additions and 117 deletions
38
.github/workflows/build.yml
vendored
38
.github/workflows/build.yml
vendored
|
@ -37,7 +37,6 @@ jobs:
|
|||
plugins: false
|
||||
skip-artifact: false
|
||||
skip-crashpad: false
|
||||
clang-tidy-review: false
|
||||
# Ubuntu 22.04, Qt 5.15
|
||||
- os: ubuntu-22.04
|
||||
qt-version: 5.15.2
|
||||
|
@ -45,7 +44,6 @@ jobs:
|
|||
plugins: false
|
||||
skip-artifact: false
|
||||
skip-crashpad: false
|
||||
clang-tidy-review: true
|
||||
# Ubuntu 22.04, Qt 6.2.4 - tests LTO & plugins
|
||||
- os: ubuntu-22.04
|
||||
qt-version: 6.2.4
|
||||
|
@ -53,7 +51,6 @@ jobs:
|
|||
plugins: true
|
||||
skip-artifact: false
|
||||
skip-crashpad: false
|
||||
clang-tidy-review: false
|
||||
# macOS
|
||||
- os: macos-latest
|
||||
qt-version: 5.15.2
|
||||
|
@ -61,7 +58,6 @@ jobs:
|
|||
plugins: false
|
||||
skip-artifact: false
|
||||
skip-crashpad: false
|
||||
clang-tidy-review: false
|
||||
# Windows
|
||||
- os: windows-latest
|
||||
qt-version: 6.5.0
|
||||
|
@ -69,7 +65,6 @@ jobs:
|
|||
plugins: false
|
||||
skip-artifact: false
|
||||
skip-crashpad: false
|
||||
clang-tidy-review: false
|
||||
# Windows 7/8
|
||||
- os: windows-latest
|
||||
qt-version: 5.15.2
|
||||
|
@ -77,7 +72,6 @@ jobs:
|
|||
plugins: false
|
||||
skip-artifact: false
|
||||
skip-crashpad: true
|
||||
clang-tidy-review: false
|
||||
|
||||
fail-fast: false
|
||||
|
||||
|
@ -329,38 +323,6 @@ jobs:
|
|||
make -j"$(nproc)"
|
||||
shell: bash
|
||||
|
||||
- name: clang-tidy review
|
||||
if: matrix.clang-tidy-review && github.event_name == 'pull_request'
|
||||
timeout-minutes: 10
|
||||
uses: ZedThree/clang-tidy-review@v0.14.0
|
||||
with:
|
||||
build_dir: build-clang-tidy
|
||||
config_file: ".clang-tidy"
|
||||
split_workflow: true
|
||||
exclude: "lib/*"
|
||||
cmake_command: >-
|
||||
cmake -S. -Bbuild-clang-tidy
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
-DPAJLADA_SETTINGS_USE_BOOST_FILESYSTEM=On
|
||||
-DUSE_PRECOMPILED_HEADERS=OFF
|
||||
-DCMAKE_EXPORT_COMPILE_COMMANDS=On
|
||||
-DCHATTERINO_LTO=Off
|
||||
-DCHATTERINO_PLUGINS=On
|
||||
-DBUILD_WITH_QT6=Off
|
||||
-DBUILD_TESTS=On
|
||||
-DBUILD_BENCHMARKS=On
|
||||
apt_packages: >-
|
||||
qttools5-dev, qt5-image-formats-plugins, libqt5svg5-dev,
|
||||
libsecret-1-dev,
|
||||
libboost-dev, libboost-system-dev, libboost-filesystem-dev,
|
||||
libssl-dev,
|
||||
rapidjson-dev,
|
||||
libbenchmark-dev
|
||||
|
||||
- name: clang-tidy-review upload
|
||||
if: matrix.clang-tidy-review && github.event_name == 'pull_request'
|
||||
uses: ZedThree/clang-tidy-review/upload@v0.14.0
|
||||
|
||||
- name: Package - AppImage (Ubuntu)
|
||||
if: startsWith(matrix.os, 'ubuntu-20.04') && !matrix.skip-artifact
|
||||
run: |
|
||||
|
|
148
.github/workflows/clang-tidy.yml
vendored
Normal file
148
.github/workflows/clang-tidy.yml
vendored
Normal file
|
@ -0,0 +1,148 @@
|
|||
---
|
||||
name: clang-tidy
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
concurrency:
|
||||
group: clang-tidy-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
CHATTERINO_REQUIRE_CLEAN_GIT: On
|
||||
C2_BUILD_WITH_QT6: Off
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: "clang-tidy ${{ matrix.os }}, Qt ${{ matrix.qt-version }})"
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
# Ubuntu 22.04, Qt 5.15
|
||||
- os: ubuntu-22.04
|
||||
qt-version: 5.15.2
|
||||
plugins: false
|
||||
|
||||
fail-fast: false
|
||||
|
||||
steps:
|
||||
- name: Enable plugin support
|
||||
if: matrix.plugins
|
||||
run: |
|
||||
echo "C2_PLUGINS=ON" >> "$GITHUB_ENV"
|
||||
shell: bash
|
||||
|
||||
- name: Set BUILD_WITH_QT6
|
||||
if: startsWith(matrix.qt-version, '6.')
|
||||
run: |
|
||||
echo "C2_BUILD_WITH_QT6=ON" >> "$GITHUB_ENV"
|
||||
shell: bash
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0 # allows for tags access
|
||||
|
||||
- name: Install Qt5
|
||||
if: startsWith(matrix.qt-version, '5.')
|
||||
uses: jurplel/install-qt-action@v3.3.0
|
||||
with:
|
||||
cache: true
|
||||
cache-key-prefix: ${{ runner.os }}-QtCache-${{ matrix.qt-version }}-v2
|
||||
version: ${{ matrix.qt-version }}
|
||||
|
||||
- name: Install Qt 6.5.3 imageformats
|
||||
if: startsWith(matrix.qt-version, '6.')
|
||||
uses: jurplel/install-qt-action@v3.3.0
|
||||
with:
|
||||
cache: false
|
||||
modules: qtimageformats
|
||||
set-env: false
|
||||
version: 6.5.3
|
||||
extra: --noarchives
|
||||
|
||||
- name: Install Qt6
|
||||
if: startsWith(matrix.qt-version, '6.')
|
||||
uses: jurplel/install-qt-action@v3.3.0
|
||||
with:
|
||||
cache: true
|
||||
cache-key-prefix: ${{ runner.os }}-QtCache-${{ matrix.qt-version }}-v2
|
||||
modules: qt5compat qtimageformats
|
||||
version: ${{ matrix.qt-version }}
|
||||
|
||||
# LINUX
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get -y install \
|
||||
cmake \
|
||||
virtualenv \
|
||||
rapidjson-dev \
|
||||
libfuse2 \
|
||||
libssl-dev \
|
||||
libboost-dev \
|
||||
libxcb-randr0-dev \
|
||||
libboost-system-dev \
|
||||
libboost-filesystem-dev \
|
||||
libpulse-dev \
|
||||
libxkbcommon-x11-0 \
|
||||
build-essential \
|
||||
libgl1-mesa-dev \
|
||||
libxcb-icccm4 \
|
||||
libxcb-image0 \
|
||||
libxcb-keysyms1 \
|
||||
libxcb-render-util0 \
|
||||
libxcb-xinerama0
|
||||
|
||||
- name: Apply Qt5 patches
|
||||
if: startsWith(matrix.qt-version, '5.')
|
||||
run: |
|
||||
patch "$Qt5_DIR/include/QtConcurrent/qtconcurrentthreadengine.h" .patches/qt5-on-newer-gcc.patch
|
||||
shell: bash
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
CXXFLAGS=-fno-sized-deallocation cmake \
|
||||
-DCMAKE_INSTALL_PREFIX=appdir/usr/ \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DPAJLADA_SETTINGS_USE_BOOST_FILESYSTEM=On \
|
||||
-DUSE_PRECOMPILED_HEADERS=OFF \
|
||||
-DCMAKE_EXPORT_COMPILE_COMMANDS=On \
|
||||
-DCHATTERINO_LTO="$C2_ENABLE_LTO" \
|
||||
-DCHATTERINO_PLUGINS="$C2_PLUGINS" \
|
||||
-DBUILD_WITH_QT6="$C2_BUILD_WITH_QT6" \
|
||||
..
|
||||
shell: bash
|
||||
|
||||
- name: clang-tidy review
|
||||
timeout-minutes: 20
|
||||
uses: ZedThree/clang-tidy-review@v0.14.0
|
||||
with:
|
||||
build_dir: build-clang-tidy
|
||||
config_file: ".clang-tidy"
|
||||
split_workflow: true
|
||||
exclude: "lib/*"
|
||||
cmake_command: >-
|
||||
cmake -S. -Bbuild-clang-tidy
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
-DPAJLADA_SETTINGS_USE_BOOST_FILESYSTEM=On
|
||||
-DUSE_PRECOMPILED_HEADERS=OFF
|
||||
-DCMAKE_EXPORT_COMPILE_COMMANDS=On
|
||||
-DCHATTERINO_LTO=Off
|
||||
-DCHATTERINO_PLUGINS=On
|
||||
-DBUILD_WITH_QT6=Off
|
||||
-DBUILD_TESTS=On
|
||||
-DBUILD_BENCHMARKS=On
|
||||
apt_packages: >-
|
||||
qttools5-dev, qt5-image-formats-plugins, libqt5svg5-dev,
|
||||
libsecret-1-dev,
|
||||
libboost-dev, libboost-system-dev, libboost-filesystem-dev,
|
||||
libssl-dev,
|
||||
rapidjson-dev,
|
||||
libbenchmark-dev
|
||||
|
||||
- name: clang-tidy-review upload
|
||||
uses: ZedThree/clang-tidy-review/upload@v0.14.0
|
4
.github/workflows/post-clang-tidy-review.yml
vendored
4
.github/workflows/post-clang-tidy-review.yml
vendored
|
@ -3,13 +3,15 @@ name: Post clang-tidy review comments
|
|||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["Build"]
|
||||
workflows: ["clang-tidy"]
|
||||
types:
|
||||
- completed
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
# Only when a build succeeds
|
||||
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||
|
||||
steps:
|
||||
- uses: ZedThree/clang-tidy-review/post@v0.14.0
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
- Bugfix: Fixed lookahead/-behind not working in _Ignores_. (#4965)
|
||||
- Bugfix: Fixed Image Uploader accidentally deleting images with some hosts when link resolver was enabled. (#4971)
|
||||
- Bugfix: Fixed rare crash with Image Uploader when closing a split right after starting an upload. (#4971)
|
||||
- Bugfix: Fixed some windows appearing between screens. (#4797)
|
||||
- Dev: Run miniaudio in a separate thread, and simplify it to not manage the device ourselves. There's a chance the simplification is a bad idea. (#4978)
|
||||
- Dev: Change clang-format from v14 to v16. (#4929)
|
||||
- Dev: Fixed UTF16 encoding of `modes` file for the installer. (#4791)
|
||||
|
@ -61,6 +62,7 @@
|
|||
- Dev: Add a compile-time flag `CHATTERINO_UPDATER` which can be turned off to disable update checks. (#4854)
|
||||
- Dev: Add a compile-time flag `USE_SYSTEM_MINIAUDIO` which can be turned on to use the system miniaudio. (#4867)
|
||||
- Dev: Update vcpkg to use Qt6. (#4872)
|
||||
- Dev: Update `magic_enum` to v0.9.5. (#4992)
|
||||
- Dev: Replace `boost::optional` with `std::optional`. (#4877)
|
||||
- Dev: Improve performance of selecting text. (#4889, #4911)
|
||||
- Dev: Removed direct dependency on Qt 5 compatibility module. (#4906)
|
||||
|
@ -73,6 +75,7 @@
|
|||
- Dev: `Details` file properties tab is now populated on Windows. (#4912)
|
||||
- Dev: Removed `Outcome` from network requests. (#4959)
|
||||
- Dev: Added Tests for Windows and MacOS in CI. (#4970)
|
||||
- Dev: Move `clang-tidy` checker to its own CI job. (#4996)
|
||||
- Dev: Refactored the Image Uploader feature. (#4971)
|
||||
- Dev: Fixed deadlock and use-after-free in tests. (#4981)
|
||||
- Dev: Cleanly exit Chatterino instead of force exiting. (#4993)
|
||||
|
|
|
@ -32,9 +32,6 @@ IncludeCategories:
|
|||
# Project includes
|
||||
- Regex: '^"[a-zA-Z\._-]+(/[a-zA-Z0-9\._-]+)*"$'
|
||||
Priority: 1
|
||||
# Third party library includes
|
||||
- Regex: '<[[:alnum:].]+/[a-zA-Z0-9\._\/-]+>'
|
||||
Priority: 3
|
||||
# Qt includes
|
||||
- Regex: '^<Q[a-zA-Z0-9\._\/-]+>$'
|
||||
Priority: 3
|
||||
|
@ -42,12 +39,12 @@ IncludeCategories:
|
|||
# LibCommuni includes
|
||||
- Regex: "^<Irc[a-zA-Z]+>$"
|
||||
Priority: 3
|
||||
# Misc libraries
|
||||
- Regex: '^<[a-zA-Z_0-9]+\.h(pp)?>$'
|
||||
Priority: 3
|
||||
# Standard library includes
|
||||
- Regex: "^<[a-zA-Z_]+>$"
|
||||
Priority: 4
|
||||
# Third party library includes
|
||||
- Regex: "^<([a-zA-Z_0-9-]+/)*[a-zA-Z_0-9-]+.h(pp)?>$"
|
||||
Priority: 3
|
||||
NamespaceIndentation: Inner
|
||||
PointerBindsToType: false
|
||||
SpacesBeforeTrailingComments: 2
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_path(MagicEnum_INCLUDE_DIR magic_enum.hpp HINTS ${CMAKE_SOURCE_DIR}/lib/magic_enum/include)
|
||||
find_path(MagicEnum_INCLUDE_DIR magic_enum/magic_enum.hpp HINTS ${CMAKE_SOURCE_DIR}/lib/magic_enum/include)
|
||||
|
||||
find_package_handle_standard_args(MagicEnum DEFAULT_MSG MagicEnum_INCLUDE_DIR)
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit e1a68e9dd3d2e9180b04c8aeacd4975db745e6b8
|
||||
Subproject commit e55b9b54d5cf61f8e117cafb17846d7d742dd3b4
|
|
@ -32,9 +32,6 @@ IncludeCategories:
|
|||
# Project includes
|
||||
- Regex: '^"[a-zA-Z\._-]+(/[a-zA-Z0-9\._-]+)*"$'
|
||||
Priority: 1
|
||||
# Third party library includes
|
||||
- Regex: '<[[:alnum:].]+/[a-zA-Z0-9\._\/-]+>'
|
||||
Priority: 3
|
||||
# Qt includes
|
||||
- Regex: '^<Q[a-zA-Z0-9\._\/-]+>$'
|
||||
Priority: 3
|
||||
|
@ -42,12 +39,12 @@ IncludeCategories:
|
|||
# LibCommuni includes
|
||||
- Regex: "^<Irc[a-zA-Z]+>$"
|
||||
Priority: 3
|
||||
# Misc libraries
|
||||
- Regex: '^<[a-zA-Z_0-9]+\.h(pp)?>$'
|
||||
Priority: 3
|
||||
# Standard library includes
|
||||
- Regex: "^<[a-zA-Z_]+>$"
|
||||
Priority: 4
|
||||
# Third party library includes
|
||||
- Regex: "^<([a-zA-Z_0-9-]+/)*[a-zA-Z_0-9-]+.h(pp)?>$"
|
||||
Priority: 3
|
||||
NamespaceIndentation: Inner
|
||||
PointerBindsToType: false
|
||||
SpacesBeforeTrailingComments: 2
|
||||
|
|
|
@ -32,9 +32,6 @@ IncludeCategories:
|
|||
# Project includes
|
||||
- Regex: '^"[a-zA-Z\._-]+(/[a-zA-Z0-9\._-]+)*"$'
|
||||
Priority: 1
|
||||
# Third party library includes
|
||||
- Regex: '<[[:alnum:].]+/[a-zA-Z0-9\._\/-]+>'
|
||||
Priority: 3
|
||||
# Qt includes
|
||||
- Regex: '^<Q[a-zA-Z0-9\._\/-]+>$'
|
||||
Priority: 3
|
||||
|
@ -42,12 +39,12 @@ IncludeCategories:
|
|||
# LibCommuni includes
|
||||
- Regex: "^<Irc[a-zA-Z]+>$"
|
||||
Priority: 3
|
||||
# Misc libraries
|
||||
- Regex: '^<[a-zA-Z_0-9]+\.h(pp)?>$'
|
||||
Priority: 3
|
||||
# Standard library includes
|
||||
- Regex: "^<[a-zA-Z_]+>$"
|
||||
Priority: 4
|
||||
# Third party library includes
|
||||
- Regex: "^<([a-zA-Z_0-9-]+/)*[a-zA-Z_0-9-]+.h(pp)?>$"
|
||||
Priority: 3
|
||||
NamespaceIndentation: Inner
|
||||
PointerBindsToType: false
|
||||
SpacesBeforeTrailingComments: 2
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <magic_enum.hpp>
|
||||
#include <magic_enum/magic_enum.hpp>
|
||||
#include <pajlada/settings.hpp>
|
||||
#include <QString>
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ std::vector<QShortcut *> HotkeyController::shortcutsForCategory(
|
|||
{
|
||||
qCDebug(chatterinoHotkeys)
|
||||
<< qPrintable(parent->objectName())
|
||||
<< "Unimplemeneted hotkey action:" << hotkey->action() << "in "
|
||||
<< "Unimplemented hotkey action:" << hotkey->action() << "in"
|
||||
<< hotkey->getCategory();
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
# include <lua.h>
|
||||
# include <lualib.h>
|
||||
# include <magic_enum.hpp>
|
||||
# include <magic_enum/magic_enum.hpp>
|
||||
# include <QList>
|
||||
|
||||
# include <string>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# include "controllers/commands/CommandController.hpp"
|
||||
|
||||
# include <lua.h>
|
||||
# include <magic_enum.hpp>
|
||||
# include <magic_enum/magic_enum.hpp>
|
||||
# include <QJsonArray>
|
||||
# include <QJsonObject>
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <magic_enum.hpp>
|
||||
#include <magic_enum/magic_enum.hpp>
|
||||
|
||||
namespace chatterino::seventv {
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include "providers/seventv/eventapi/Subscription.hpp"
|
||||
|
||||
#include <magic_enum.hpp>
|
||||
#include <magic_enum/magic_enum.hpp>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QString>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <magic_enum.hpp>
|
||||
#include <magic_enum/magic_enum.hpp>
|
||||
#include <QByteArray>
|
||||
#include <QHash>
|
||||
#include <QJsonObject>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include "common/QLogging.hpp"
|
||||
#include "util/CancellationToken.hpp"
|
||||
|
||||
#include <magic_enum.hpp>
|
||||
#include <magic_enum/magic_enum.hpp>
|
||||
#include <QJsonDocument>
|
||||
|
||||
namespace {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <magic_enum.hpp>
|
||||
#include <magic_enum/magic_enum.hpp>
|
||||
#include <QColor>
|
||||
#include <QJsonObject>
|
||||
#include <QString>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <magic_enum.hpp>
|
||||
#include <magic_enum/magic_enum.hpp>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QString>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <magic_enum.hpp>
|
||||
#include <magic_enum/magic_enum.hpp>
|
||||
#include <QJsonObject>
|
||||
#include <QString>
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <magic_enum.hpp>
|
||||
#include <magic_enum/magic_enum.hpp>
|
||||
#include <QJsonObject>
|
||||
#include <QString>
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <magic_enum.hpp>
|
||||
#include <magic_enum/magic_enum.hpp>
|
||||
#include <QColor>
|
||||
#include <QJsonObject>
|
||||
#include <QString>
|
||||
|
|
|
@ -87,8 +87,7 @@ void WindowManager::showAccountSelectPopup(QPoint point)
|
|||
|
||||
w->refresh();
|
||||
|
||||
QPoint buttonPos = point;
|
||||
w->move(buttonPos.x() - 30, buttonPos.y());
|
||||
w->moveTo(point - QPoint(30, 0), widgets::BoundsChecking::CursorPosition);
|
||||
w->show();
|
||||
w->setFocus();
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ void initUpdateButton(Button &button,
|
|||
globalPoint.setX(0);
|
||||
}
|
||||
|
||||
dialog->move(globalPoint);
|
||||
dialog->moveTo(globalPoint, widgets::BoundsChecking::DesiredPosition);
|
||||
dialog->show();
|
||||
dialog->raise();
|
||||
|
||||
|
|
|
@ -79,4 +79,17 @@ void moveWindowTo(QWidget *window, QPoint position, BoundsChecking mode)
|
|||
}
|
||||
}
|
||||
|
||||
void showAndMoveWindowTo(QWidget *window, QPoint position, BoundsChecking mode)
|
||||
{
|
||||
#ifdef Q_OS_WINDOWS
|
||||
window->show();
|
||||
|
||||
moveWindowTo(window, position, mode);
|
||||
#else
|
||||
moveWindowTo(window, position, mode);
|
||||
|
||||
window->show();
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace chatterino::widgets
|
||||
|
|
|
@ -26,4 +26,14 @@ enum class BoundsChecking {
|
|||
void moveWindowTo(QWidget *window, QPoint position,
|
||||
BoundsChecking mode = BoundsChecking::DesiredPosition);
|
||||
|
||||
/// Moves the `window` to the (global) `position`
|
||||
/// while doing bounds-checking according to `mode` to ensure the window stays on one screen.
|
||||
/// Will also call show on the `window`, order is dependant on platform.
|
||||
///
|
||||
/// @param window The window to move.
|
||||
/// @param position The global position to move the window to.
|
||||
/// @param mode The desired bounds checking.
|
||||
void showAndMoveWindowTo(QWidget *window, QPoint position,
|
||||
BoundsChecking mode = BoundsChecking::DesiredPosition);
|
||||
|
||||
} // namespace chatterino::widgets
|
||||
|
|
|
@ -508,6 +508,11 @@ void BaseWindow::moveTo(QPoint point, widgets::BoundsChecking mode)
|
|||
widgets::moveWindowTo(this, point, mode);
|
||||
}
|
||||
|
||||
void BaseWindow::showAndMoveTo(QPoint point, widgets::BoundsChecking mode)
|
||||
{
|
||||
widgets::showAndMoveWindowTo(this, point, mode);
|
||||
}
|
||||
|
||||
void BaseWindow::resizeEvent(QResizeEvent *)
|
||||
{
|
||||
// Queue up save because: Window resized
|
||||
|
@ -559,6 +564,12 @@ void BaseWindow::closeEvent(QCloseEvent *)
|
|||
|
||||
void BaseWindow::showEvent(QShowEvent *)
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
if (this->flags_.has(BoundsCheckOnShow))
|
||||
{
|
||||
this->moveTo(this->pos(), widgets::BoundsChecking::CursorPosition);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
|
|
|
@ -27,14 +27,15 @@ class BaseWindow : public BaseWidget
|
|||
public:
|
||||
enum Flags {
|
||||
None = 0,
|
||||
EnableCustomFrame = 1,
|
||||
Frameless = 2,
|
||||
TopMost = 4,
|
||||
DisableCustomScaling = 8,
|
||||
FramelessDraggable = 16,
|
||||
DontFocus = 32,
|
||||
Dialog = 64,
|
||||
DisableLayoutSave = 128,
|
||||
EnableCustomFrame = 1 << 0,
|
||||
Frameless = 1 << 1,
|
||||
TopMost = 1 << 2,
|
||||
DisableCustomScaling = 1 << 3,
|
||||
FramelessDraggable = 1 << 4,
|
||||
DontFocus = 1 << 5,
|
||||
Dialog = 1 << 6,
|
||||
DisableLayoutSave = 1 << 7,
|
||||
BoundsCheckOnShow = 1 << 8,
|
||||
};
|
||||
|
||||
enum ActionOnFocusLoss { Nothing, Delete, Close, Hide };
|
||||
|
@ -57,6 +58,12 @@ public:
|
|||
|
||||
void moveTo(QPoint point, widgets::BoundsChecking mode);
|
||||
|
||||
/**
|
||||
* Moves the window to the given point and does bounds checking according to `mode`
|
||||
* Depending on the platform, either the move or the show will take place first
|
||||
**/
|
||||
void showAndMoveTo(QPoint point, widgets::BoundsChecking mode);
|
||||
|
||||
float scale() const override;
|
||||
float qtFontScale() const;
|
||||
|
||||
|
|
|
@ -13,8 +13,13 @@
|
|||
namespace chatterino {
|
||||
|
||||
ColorPickerDialog::ColorPickerDialog(const QColor &initial, QWidget *parent)
|
||||
: BasePopup({BaseWindow::EnableCustomFrame, BaseWindow::DisableLayoutSave},
|
||||
parent)
|
||||
: BasePopup(
|
||||
{
|
||||
BaseWindow::EnableCustomFrame,
|
||||
BaseWindow::DisableLayoutSave,
|
||||
BaseWindow::BoundsCheckOnShow,
|
||||
},
|
||||
parent)
|
||||
, color_()
|
||||
, dialogConfirmed_(false)
|
||||
{
|
||||
|
|
|
@ -9,8 +9,12 @@
|
|||
namespace chatterino {
|
||||
|
||||
QualityPopup::QualityPopup(const QString &channelURL, QStringList options)
|
||||
: BasePopup({BaseWindow::DisableLayoutSave},
|
||||
static_cast<QWidget *>(&(getApp()->windows->getMainWindow())))
|
||||
: BasePopup(
|
||||
{
|
||||
BaseWindow::DisableLayoutSave,
|
||||
BaseWindow::BoundsCheckOnShow,
|
||||
},
|
||||
static_cast<QWidget *>(&(getApp()->windows->getMainWindow())))
|
||||
, channelURL_(channelURL)
|
||||
{
|
||||
this->ui_.selector = new QComboBox(this);
|
||||
|
|
|
@ -31,9 +31,14 @@
|
|||
namespace chatterino {
|
||||
|
||||
SelectChannelDialog::SelectChannelDialog(QWidget *parent)
|
||||
: BaseWindow({BaseWindow::Flags::EnableCustomFrame,
|
||||
BaseWindow::Flags::Dialog, BaseWindow::DisableLayoutSave},
|
||||
parent)
|
||||
: BaseWindow(
|
||||
{
|
||||
BaseWindow::Flags::EnableCustomFrame,
|
||||
BaseWindow::Flags::Dialog,
|
||||
BaseWindow::DisableLayoutSave,
|
||||
BaseWindow::BoundsCheckOnShow,
|
||||
},
|
||||
parent)
|
||||
, selectedChannel_(Channel::getEmpty())
|
||||
{
|
||||
this->setWindowTitle("Select a channel to join");
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "controllers/hotkeys/HotkeyController.hpp"
|
||||
#include "singletons/Settings.hpp"
|
||||
#include "util/LayoutCreator.hpp"
|
||||
#include "widgets/BaseWindow.hpp"
|
||||
#include "widgets/helper/Button.hpp"
|
||||
#include "widgets/helper/SettingsDialogTab.hpp"
|
||||
#include "widgets/settingspages/AboutPage.hpp"
|
||||
|
@ -29,9 +30,14 @@
|
|||
namespace chatterino {
|
||||
|
||||
SettingsDialog::SettingsDialog(QWidget *parent)
|
||||
: BaseWindow({BaseWindow::Flags::DisableCustomScaling,
|
||||
BaseWindow::Flags::Dialog, BaseWindow::DisableLayoutSave},
|
||||
parent)
|
||||
: BaseWindow(
|
||||
{
|
||||
BaseWindow::Flags::DisableCustomScaling,
|
||||
BaseWindow::Flags::Dialog,
|
||||
BaseWindow::DisableLayoutSave,
|
||||
BaseWindow::BoundsCheckOnShow,
|
||||
},
|
||||
parent)
|
||||
{
|
||||
this->setObjectName("SettingsDialog");
|
||||
this->setWindowTitle("Chatterino Settings");
|
||||
|
@ -380,9 +386,10 @@ void SettingsDialog::themeChangedEvent()
|
|||
this->setPalette(palette);
|
||||
}
|
||||
|
||||
void SettingsDialog::showEvent(QShowEvent *)
|
||||
void SettingsDialog::showEvent(QShowEvent *e)
|
||||
{
|
||||
this->ui_.search->setText("");
|
||||
BaseWindow::showEvent(e);
|
||||
}
|
||||
|
||||
///// Widget creation helpers
|
||||
|
|
|
@ -37,9 +37,14 @@ QList<SplitContainer *> openPages(Window *window)
|
|||
namespace chatterino {
|
||||
|
||||
QuickSwitcherPopup::QuickSwitcherPopup(Window *parent)
|
||||
: BasePopup({BaseWindow::Flags::Frameless, BaseWindow::Flags::TopMost,
|
||||
BaseWindow::DisableLayoutSave},
|
||||
parent)
|
||||
: BasePopup(
|
||||
{
|
||||
BaseWindow::Flags::Frameless,
|
||||
BaseWindow::Flags::TopMost,
|
||||
BaseWindow::DisableLayoutSave,
|
||||
BaseWindow::BoundsCheckOnShow,
|
||||
},
|
||||
parent)
|
||||
, switcherModel_(this)
|
||||
, window(parent)
|
||||
{
|
||||
|
|
|
@ -2914,8 +2914,8 @@ void ChannelView::showReplyThreadPopup(const MessagePtr &message)
|
|||
popup->setThread(message->replyThread);
|
||||
|
||||
QPoint offset(int(150 * this->scale()), int(70 * this->scale()));
|
||||
popup->move(QCursor::pos() - offset);
|
||||
popup->show();
|
||||
popup->showAndMoveTo(QCursor::pos() - offset,
|
||||
widgets::BoundsChecking::CursorPosition);
|
||||
popup->giveFocus(Qt::MouseFocusReason);
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,12 @@ ChannelPtr SearchPopup::filter(const QString &text, const QString &channelName,
|
|||
}
|
||||
|
||||
SearchPopup::SearchPopup(QWidget *parent, Split *split)
|
||||
: BasePopup({BaseWindow::DisableLayoutSave}, parent)
|
||||
: BasePopup(
|
||||
{
|
||||
BaseWindow::DisableLayoutSave,
|
||||
BaseWindow::BoundsCheckOnShow,
|
||||
},
|
||||
parent)
|
||||
, split_(split)
|
||||
{
|
||||
this->initLayout();
|
||||
|
@ -180,9 +185,10 @@ void SearchPopup::updateWindowTitle()
|
|||
this->setWindowTitle("Searching in " + historyName + " history");
|
||||
}
|
||||
|
||||
void SearchPopup::showEvent(QShowEvent *)
|
||||
void SearchPopup::showEvent(QShowEvent *e)
|
||||
{
|
||||
this->search();
|
||||
BaseWindow::showEvent(e);
|
||||
}
|
||||
|
||||
bool SearchPopup::eventFilter(QObject *object, QEvent *event)
|
||||
|
|
|
@ -227,9 +227,13 @@ void AboutPage::addLicense(QFormLayout *form, const QString &name,
|
|||
auto *b = new QLabel("<a href=\"" + licenseLink + "\">show license</a>");
|
||||
QObject::connect(
|
||||
b, &QLabel::linkActivated, [parent = this, name, licenseLink] {
|
||||
auto window = new BasePopup({BaseWindow::Flags::EnableCustomFrame,
|
||||
BaseWindow::DisableLayoutSave},
|
||||
parent);
|
||||
auto *window = new BasePopup(
|
||||
{
|
||||
BaseWindow::EnableCustomFrame,
|
||||
BaseWindow::DisableLayoutSave,
|
||||
BaseWindow::BoundsCheckOnShow,
|
||||
},
|
||||
parent);
|
||||
window->setWindowTitle("Chatterino - License for " + name);
|
||||
window->setAttribute(Qt::WA_DeleteOnClose);
|
||||
auto layout = new QVBoxLayout();
|
||||
|
|
|
@ -45,9 +45,8 @@ FiltersPage::FiltersPage()
|
|||
});
|
||||
|
||||
// We can safely ignore this signal connection since we own the view
|
||||
std::ignore = view->addButtonPressed.connect([] {
|
||||
ChannelFilterEditorDialog d(
|
||||
static_cast<QWidget *>(&(getApp()->windows->getMainWindow())));
|
||||
std::ignore = view->addButtonPressed.connect([this] {
|
||||
ChannelFilterEditorDialog d(this->window());
|
||||
if (d.exec() == QDialog::Accepted)
|
||||
{
|
||||
getSettings()->filterRecords.append(
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "widgets/settingspages/GeneralPageView.hpp"
|
||||
#include "widgets/splits/SplitInput.hpp"
|
||||
|
||||
#include <magic_enum.hpp>
|
||||
#include <magic_enum/magic_enum.hpp>
|
||||
#include <QDesktopServices>
|
||||
#include <QFileDialog>
|
||||
#include <QFontDialog>
|
||||
|
|
|
@ -192,8 +192,12 @@ namespace {
|
|||
void showTutorialVideo(QWidget *parent, const QString &source,
|
||||
const QString &title, const QString &description)
|
||||
{
|
||||
auto window =
|
||||
new BasePopup(BaseWindow::Flags::EnableCustomFrame, parent);
|
||||
auto *window = new BasePopup(
|
||||
{
|
||||
BaseWindow::EnableCustomFrame,
|
||||
BaseWindow::BoundsCheckOnShow,
|
||||
},
|
||||
parent);
|
||||
window->setWindowTitle("Chatterino - " + title);
|
||||
window->setAttribute(Qt::WA_DeleteOnClose);
|
||||
auto layout = new QVBoxLayout();
|
||||
|
@ -1393,7 +1397,9 @@ void Split::showChatterList()
|
|||
multiWidget->setLayout(dockVbox);
|
||||
chatterDock->setWidget(multiWidget);
|
||||
chatterDock->setFloating(true);
|
||||
chatterDock->show();
|
||||
widgets::showAndMoveWindowTo(
|
||||
chatterDock, this->mapToGlobal(QPoint{0, this->header_->height()}),
|
||||
widgets::BoundsChecking::CursorPosition);
|
||||
chatterDock->activateWindow();
|
||||
}
|
||||
|
||||
|
|
|
@ -32,9 +32,6 @@ IncludeCategories:
|
|||
# Project includes
|
||||
- Regex: '^"[a-zA-Z\._-]+(/[a-zA-Z0-9\._-]+)*"$'
|
||||
Priority: 1
|
||||
# Third party library includes
|
||||
- Regex: '<[[:alnum:].]+/[a-zA-Z0-9\._\/-]+>'
|
||||
Priority: 3
|
||||
# Qt includes
|
||||
- Regex: '^<Q[a-zA-Z0-9\._\/-]+>$'
|
||||
Priority: 3
|
||||
|
@ -42,12 +39,12 @@ IncludeCategories:
|
|||
# LibCommuni includes
|
||||
- Regex: "^<Irc[a-zA-Z]+>$"
|
||||
Priority: 3
|
||||
# Misc libraries
|
||||
- Regex: '^<[a-zA-Z_0-9]+\.h(pp)?>$'
|
||||
Priority: 3
|
||||
# Standard library includes
|
||||
- Regex: "^<[a-zA-Z_]+>$"
|
||||
Priority: 4
|
||||
# Third party library includes
|
||||
- Regex: "^<([a-zA-Z_0-9-]+/)*[a-zA-Z_0-9-]+.h(pp)?>$"
|
||||
Priority: 3
|
||||
NamespaceIndentation: Inner
|
||||
PointerBindsToType: false
|
||||
SpacesBeforeTrailingComments: 2
|
||||
|
|
Loading…
Reference in a new issue