mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Add lint github action (#2473)
This commit is contained in:
parent
714048a29e
commit
e015013773
21
.github/workflows/lint.yml
vendored
Normal file
21
.github/workflows/lint.yml
vendored
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
---
|
||||||
|
name: Lint
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2.3.4
|
||||||
|
|
||||||
|
- name: Lint Markdown files
|
||||||
|
uses: actionsx/prettier@v2
|
||||||
|
with:
|
||||||
|
# prettier CLI arguments.
|
||||||
|
args: --check '**/*.md'
|
5
.prettierignore
Normal file
5
.prettierignore
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# Ignore submodule files
|
||||||
|
lib/*/
|
||||||
|
conan-pkgs/*/
|
||||||
|
|
||||||
|
.github/
|
6
.prettierrc.toml
Normal file
6
.prettierrc.toml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
trailingComma = "es5"
|
||||||
|
|
||||||
|
[[overrides]]
|
||||||
|
files = ["*.md"]
|
||||||
|
[overrides.options]
|
||||||
|
proseWrap = "preserve"
|
|
@ -9,9 +9,7 @@ high that this also works on older FreeBSD releases, architectures and
|
||||||
FreeBSD 13.0-CURRENT.
|
FreeBSD 13.0-CURRENT.
|
||||||
|
|
||||||
1. Install build dependencies from package sources (or build from the
|
1. Install build dependencies from package sources (or build from the
|
||||||
ports tree): `# pkg install qt5-core qt5-multimedia qt5-svg
|
ports tree): `# pkg install qt5-core qt5-multimedia qt5-svg qt5-qmake qt5-buildtools gstreamer-plugins-good boost-libs rapidjson`
|
||||||
qt5-qmake qt5-buildtools gstreamer-plugins-good boost-libs
|
|
||||||
rapidjson`
|
|
||||||
1. go into project directory
|
1. go into project directory
|
||||||
1. create build folder `$ mkdir build && cd build`
|
1. create build folder `$ mkdir build && cd build`
|
||||||
1. `$ qmake .. && make`
|
1. `$ qmake .. && make`
|
||||||
|
|
|
@ -3,29 +3,40 @@
|
||||||
Note on Qt version compatibility: If you are installing Qt from a package manager, please ensure the version you are installing is at least **Qt 5.12 or newer**.
|
Note on Qt version compatibility: If you are installing Qt from a package manager, please ensure the version you are installing is at least **Qt 5.12 or newer**.
|
||||||
|
|
||||||
## Ubuntu 18.04
|
## Ubuntu 18.04
|
||||||
*most likely works the same for other Debian-like distros*
|
|
||||||
|
_most likely works the same for other Debian-like distros_
|
||||||
|
|
||||||
1. Install dependencies (and the C++ IDE Qt Creator) `sudo apt install qtcreator qtmultimedia5-dev libqt5svg5-dev libboost-dev libssl-dev libboost-system-dev libboost-filesystem-dev`
|
1. Install dependencies (and the C++ IDE Qt Creator) `sudo apt install qtcreator qtmultimedia5-dev libqt5svg5-dev libboost-dev libssl-dev libboost-system-dev libboost-filesystem-dev`
|
||||||
1. Open `chatterino.pro` with QT Creator and build
|
1. Open `chatterino.pro` with QT Creator and build
|
||||||
|
|
||||||
## Arch Linux
|
## Arch Linux
|
||||||
|
|
||||||
install [chatterino2-git](https://aur.archlinux.org/packages/chatterino2-git/) from the aur or build manually as follows:
|
install [chatterino2-git](https://aur.archlinux.org/packages/chatterino2-git/) from the aur or build manually as follows:
|
||||||
|
|
||||||
1. `sudo pacman -S qt5-base qt5-multimedia qt5-svg gst-plugins-ugly gst-plugins-good boost rapidjson pkgconf openssl`
|
1. `sudo pacman -S qt5-base qt5-multimedia qt5-svg gst-plugins-ugly gst-plugins-good boost rapidjson pkgconf openssl`
|
||||||
1. go into project directory
|
1. go into project directory
|
||||||
1. create build folder `mkdir build && cd build`
|
1. create build folder `mkdir build && cd build`
|
||||||
1. `qmake .. && make`
|
1. `qmake .. && make`
|
||||||
|
|
||||||
## Fedora 28 and above
|
## Fedora 28 and above
|
||||||
*most likely works the same for other Red Hat-like distros. Substitue `dnf` with `yum`.*
|
|
||||||
|
_most likely works the same for other Red Hat-like distros. Substitue `dnf` with `yum`._
|
||||||
|
|
||||||
### Development dependencies
|
### Development dependencies
|
||||||
|
|
||||||
1. `sudo dnf install qt5-qtbase-devel qt5-qtmultimedia-devel qt5-qtsvg-devel libsecret-devel openssl-devel boost-devel`
|
1. `sudo dnf install qt5-qtbase-devel qt5-qtmultimedia-devel qt5-qtsvg-devel libsecret-devel openssl-devel boost-devel`
|
||||||
1. go into project directory
|
1. go into project directory
|
||||||
1. create build folder `mkdir build && cd build`
|
1. create build folder `mkdir build && cd build`
|
||||||
1. `qmake-qt5 .. && make -j$(nproc)`
|
1. `qmake-qt5 .. && make -j$(nproc)`
|
||||||
|
|
||||||
### Optional dependencies
|
### Optional dependencies
|
||||||
*`gstreamer-plugins-good` package is retired in Fedora 31, see: [rhbz#1735324](https://bugzilla.redhat.com/show_bug.cgi?id=1735324)*
|
|
||||||
1. `sudo dnf install gstreamer-plugins-good` *(optional: for audio output)*
|
_`gstreamer-plugins-good` package is retired in Fedora 31, see: [rhbz#1735324](https://bugzilla.redhat.com/show_bug.cgi?id=1735324)_
|
||||||
|
|
||||||
|
1. `sudo dnf install gstreamer-plugins-good` _(optional: for audio output)_
|
||||||
|
|
||||||
## NixOS 18.09+
|
## NixOS 18.09+
|
||||||
|
|
||||||
1. enter the development environment with all of the dependencies: `nix-shell -p openssl boost qt5.full pkg-config`
|
1. enter the development environment with all of the dependencies: `nix-shell -p openssl boost qt5.full pkg-config`
|
||||||
1. go into project directory
|
1. go into project directory
|
||||||
1. create build folder `mkdir build && cd build`
|
1. create build folder `mkdir build && cd build`
|
||||||
|
|
|
@ -1,15 +1,18 @@
|
||||||
# Building on macOS
|
# Building on macOS
|
||||||
|
|
||||||
#### Note - If you want to develop Chatterino 2 you will also need to install Qt Creator (make sure to install **Qt 5.12 or newer**)
|
#### Note - If you want to develop Chatterino 2 you will also need to install Qt Creator (make sure to install **Qt 5.12 or newer**)
|
||||||
|
|
||||||
#### Note - Chatterino 2 is only tested on macOS 10.14 and above - anything below that is considered unsupported. It may or may not work on earlier versions
|
#### Note - Chatterino 2 is only tested on macOS 10.14 and above - anything below that is considered unsupported. It may or may not work on earlier versions
|
||||||
|
|
||||||
1. Install Xcode and Xcode Command Line Utilites
|
1. Install Xcode and Xcode Command Line Utilites
|
||||||
2. Start Xcode, settings -> Locations, activate your Command Line Tools
|
2. Start Xcode, settings -> Locations, activate your Command Line Tools
|
||||||
3. Install brew https://brew.sh/
|
3. Install brew https://brew.sh/
|
||||||
4. `brew install boost openssl rapidjson`
|
4. `brew install boost openssl rapidjson`
|
||||||
5. `brew install qt`
|
5. `brew install qt`
|
||||||
6. Step 5 should output some directions to add qt to your path, you will need to do this for qmake
|
6. Step 5 should output some directions to add qt to your path, you will need to do this for qmake
|
||||||
5. Go into project directory
|
7. Go into project directory
|
||||||
6. Create build folder `mkdir build && cd build`
|
8. Create build folder `mkdir build && cd build`
|
||||||
7. `qmake .. && make`
|
9. `qmake .. && make`
|
||||||
|
|
||||||
If the Project does not build at this point, you might need to add additional Paths/Libs, because brew does not install openssl and boost in the common path. You can get their path using
|
If the Project does not build at this point, you might need to add additional Paths/Libs, because brew does not install openssl and boost in the common path. You can get their path using
|
||||||
|
|
||||||
|
@ -17,6 +20,7 @@ If the Project does not build at this point, you might need to add additional Pa
|
||||||
`brew info boost`
|
`brew info boost`
|
||||||
|
|
||||||
If brew doesn't link openssl properly then you should be able to link it yourself using those two commands:
|
If brew doesn't link openssl properly then you should be able to link it yourself using those two commands:
|
||||||
|
|
||||||
- `ln -s /usr/local/opt/openssl/lib/* /usr/local/lib`
|
- `ln -s /usr/local/opt/openssl/lib/* /usr/local/lib`
|
||||||
- `ln -s /usr/local/opt/openssl/include/openssl /usr/local/include/openssl`
|
- `ln -s /usr/local/opt/openssl/include/openssl /usr/local/include/openssl`
|
||||||
|
|
||||||
|
|
|
@ -16,24 +16,29 @@ Notes:
|
||||||
## Boost
|
## Boost
|
||||||
|
|
||||||
1. First, download a boost installer appropriate for your version of Visual Studio.
|
1. First, download a boost installer appropriate for your version of Visual Studio.
|
||||||
|
|
||||||
- Visit the downloads list [on Bintray](https://dl.bintray.com/boostorg/release/).
|
- Visit the downloads list [on Bintray](https://dl.bintray.com/boostorg/release/).
|
||||||
- Select the latest version from the list and navigate into the `binaries/` directory.
|
- Select the latest version from the list and navigate into the `binaries/` directory.
|
||||||
- Download the `.exe` file appropriate to your Visual Studio installation version and system bitness (choose `x64` for 64-bit systems).
|
- Download the `.exe` file appropriate to your Visual Studio installation version and system bitness (choose `x64` for 64-bit systems).
|
||||||
Visual Studio versions map as follows: `14.2` in the filename corresponds to MSVC 2019, `14.1` to 2017, `14.0` to 2015. _Anything prior to Visual Studio 2015 is unsupported. Please upgrade should you have an older installation._
|
Visual Studio versions map as follows: `14.2` in the filename corresponds to MSVC 2019, `14.1` to 2017, `14.0` to 2015. _Anything prior to Visual Studio 2015 is unsupported. Please upgrade should you have an older installation._
|
||||||
|
|
||||||
**Convenience link for Visual Studio 2019: [Boost 1.75.0-MSVC-14.2](https://dl.bintray.com/boostorg/release/1.75.0/binaries/boost_1_75_0-msvc-14.2-64.exe)**
|
**Convenience link for Visual Studio 2019: [Boost 1.75.0-MSVC-14.2](https://dl.bintray.com/boostorg/release/1.75.0/binaries/boost_1_75_0-msvc-14.2-64.exe)**
|
||||||
|
|
||||||
2. When prompted where to install Boost, set the location to `C:\local\boost`.
|
2. When prompted where to install Boost, set the location to `C:\local\boost`.
|
||||||
3. After the installation finishes, rename the `C:\local\boost\lib64-msvc-14.2` (or similar) directory to simply `lib` (`C:\local\boost\lib`).
|
3. After the installation finishes, rename the `C:\local\boost\lib64-msvc-14.2` (or similar) directory to simply `lib` (`C:\local\boost\lib`).
|
||||||
|
|
||||||
Note: This installation will take about 1.5 GB of disk space.
|
Note: This installation will take about 1.5 GB of disk space.
|
||||||
|
|
||||||
## OpenSSL
|
## OpenSSL
|
||||||
|
|
||||||
### For our websocket library, we need OpenSSL 1.1
|
### For our websocket library, we need OpenSSL 1.1
|
||||||
|
|
||||||
1. Download OpenSSL for windows, version `1.1.1i`: **[Download](https://slproweb.com/download/Win64OpenSSL-1_1_1i.exe)**
|
1. Download OpenSSL for windows, version `1.1.1i`: **[Download](https://slproweb.com/download/Win64OpenSSL-1_1_1i.exe)**
|
||||||
2. When prompted, install OpenSSL to `C:\local\openssl`
|
2. When prompted, install OpenSSL to `C:\local\openssl`
|
||||||
3. When prompted, copy the OpenSSL DLLs to "The OpenSSL binaries (/bin) directory".
|
3. When prompted, copy the OpenSSL DLLs to "The OpenSSL binaries (/bin) directory".
|
||||||
|
|
||||||
### For Qt SSL, we need OpenSSL 1.0
|
### For Qt SSL, we need OpenSSL 1.0
|
||||||
|
|
||||||
1. Download OpenSSL for windows, version `1.0.2u`: **[Download](https://slproweb.com/download/Win64OpenSSL-1_0_2u.exe)**
|
1. Download OpenSSL for windows, version `1.0.2u`: **[Download](https://slproweb.com/download/Win64OpenSSL-1_0_2u.exe)**
|
||||||
2. When prompted, install it to any arbitrary empty directory.
|
2. When prompted, install it to any arbitrary empty directory.
|
||||||
3. When prompted, copy the OpenSSL DLLs to "The OpenSSL binaries (/bin) directory".
|
3. When prompted, copy the OpenSSL DLLs to "The OpenSSL binaries (/bin) directory".
|
||||||
|
@ -46,11 +51,13 @@ Note: This installation will take about 1.5 GB of disk space.
|
||||||
Note: This installation will take about 200 MB of disk space.
|
Note: This installation will take about 200 MB of disk space.
|
||||||
|
|
||||||
## Qt
|
## Qt
|
||||||
|
|
||||||
1. Visit the [Qt Open Source Page](https://www.qt.io/download-open-source).
|
1. Visit the [Qt Open Source Page](https://www.qt.io/download-open-source).
|
||||||
2. Scroll down to the bottom
|
2. Scroll down to the bottom
|
||||||
3. Then select "Download the Qt Online Installer"
|
3. Then select "Download the Qt Online Installer"
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
|
|
||||||
- Installing the latest **stable** Qt version is advised for new installations, but if you want to use your existing installation please ensure you are running **Qt 5.12 or later**.
|
- Installing the latest **stable** Qt version is advised for new installations, but if you want to use your existing installation please ensure you are running **Qt 5.12 or later**.
|
||||||
|
|
||||||
### When prompted which components to install:
|
### When prompted which components to install:
|
||||||
|
@ -66,6 +73,7 @@ Notes:
|
||||||
Note: This installation will take about 2 GB of disk space.
|
Note: This installation will take about 2 GB of disk space.
|
||||||
|
|
||||||
## Compile with Breakpad support (Optional)
|
## Compile with Breakpad support (Optional)
|
||||||
|
|
||||||
Compiling with Breakpad support enables crash reports that can be of use for developing/beta versions of Chatterino. If you have no interest in reporting crashes anyways, this optional dependency will probably be of no use to you.
|
Compiling with Breakpad support enables crash reports that can be of use for developing/beta versions of Chatterino. If you have no interest in reporting crashes anyways, this optional dependency will probably be of no use to you.
|
||||||
|
|
||||||
1. Open up `lib/qBreakpad/handler/handler.pro`in Qt Creator
|
1. Open up `lib/qBreakpad/handler/handler.pro`in Qt Creator
|
||||||
|
@ -73,6 +81,7 @@ Compiling with Breakpad support enables crash reports that can be of use for dev
|
||||||
3. Copy the newly built `qBreakpad.lib` to the following directory: `lib/qBreakpad/build/handler` (You will have to manually create this directory)
|
3. Copy the newly built `qBreakpad.lib` to the following directory: `lib/qBreakpad/build/handler` (You will have to manually create this directory)
|
||||||
|
|
||||||
## Run the build in Qt Creator
|
## Run the build in Qt Creator
|
||||||
|
|
||||||
1. Open the `chatterino.pro` file by double-clicking or by opening it via Qt Creator.
|
1. Open the `chatterino.pro` file by double-clicking or by opening it via Qt Creator.
|
||||||
2. You will be presented with a screen that is titled "Configure Project". In this screen, you should have at least one option present ready to be configured, like this:
|
2. You will be presented with a screen that is titled "Configure Project". In this screen, you should have at least one option present ready to be configured, like this:
|
||||||
![Qt Create Configure Project screenshot](https://i.imgur.com/dbz45mB.png)
|
![Qt Create Configure Project screenshot](https://i.imgur.com/dbz45mB.png)
|
||||||
|
|
|
@ -4,8 +4,7 @@ This is a set of guidelines for contributing to Chatterino. The goal is to teach
|
||||||
|
|
||||||
# Tooling
|
# Tooling
|
||||||
|
|
||||||
Formatting
|
## Formatting
|
||||||
------
|
|
||||||
|
|
||||||
Code is automatically formatted using `clang-format`. It takes the burden off of the programmer and ensures that all contributors use the same style (even if mess something up accidentally). We recommend that you set up automatic formatting on file save in your editor.
|
Code is automatically formatted using `clang-format`. It takes the burden off of the programmer and ensures that all contributors use the same style (even if mess something up accidentally). We recommend that you set up automatic formatting on file save in your editor.
|
||||||
|
|
||||||
|
@ -43,11 +42,9 @@ int compare(const QString &a, const QString &b);
|
||||||
boost::optional<QRegularExpressionMatch> matchLink(const QString &text);
|
boost::optional<QRegularExpressionMatch> matchLink(const QString &text);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
# Code
|
# Code
|
||||||
|
|
||||||
Arithmetic Types
|
## Arithmetic Types
|
||||||
-----
|
|
||||||
|
|
||||||
Arithmetic types (like char, short, int, long, float and double), bool, and pointers are NOT initialized by default in c++. They keep whatever value is already at their position in the memory. This makes debugging harder and is unpredictable, so we initialize them to zero by using `{}` after their name when declaring them.
|
Arithmetic types (like char, short, int, long, float and double), bool, and pointers are NOT initialized by default in c++. They keep whatever value is already at their position in the memory. This makes debugging harder and is unpredictable, so we initialize them to zero by using `{}` after their name when declaring them.
|
||||||
|
|
||||||
|
@ -71,11 +68,12 @@ void myFunc() {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Passing parameters
|
## Passing parameters
|
||||||
------
|
|
||||||
The way a parameter is passed signals how it is going to be used inside of the function. C++ doesn't have multiple return values so there is "out parameters" (reference to a variable that is going to be assigned inside of the function) to simulate multiple return values.
|
The way a parameter is passed signals how it is going to be used inside of the function. C++ doesn't have multiple return values so there is "out parameters" (reference to a variable that is going to be assigned inside of the function) to simulate multiple return values.
|
||||||
|
|
||||||
**Cheap to copy types** like int/enum/etc. can be passed in per value since copying them is fast.
|
**Cheap to copy types** like int/enum/etc. can be passed in per value since copying them is fast.
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
void setValue(int value) {
|
void setValue(int value) {
|
||||||
// ...
|
// ...
|
||||||
|
@ -85,14 +83,14 @@ void setValue(int value) {
|
||||||
**References** mean that the variable doesn't need to be copied when it is passed to a function.
|
**References** mean that the variable doesn't need to be copied when it is passed to a function.
|
||||||
|
|
||||||
| type | meaning |
|
| type | meaning |
|
||||||
|-|-|
|
| ------------------ | ---------------------------------------------------------------------------------------- |
|
||||||
|`const Type& name`|*in* Parameter. It is NOT going to be modified and may be copied inside of the function.|
|
| `const Type& name` | _in_ Parameter. It is NOT going to be modified and may be copied inside of the function. |
|
||||||
|`Type& name`|*out* or *in+out* Parmameter. It will be modified.|
|
| `Type& name` | _out_ or _in+out_ Parmameter. It will be modified. |
|
||||||
|
|
||||||
**Pointers** signal that objects are managed manually. While the above are only guaranteed to live as long as the function call (= don't store and use later) these may have more complex lifetimes.
|
**Pointers** signal that objects are managed manually. While the above are only guaranteed to live as long as the function call (= don't store and use later) these may have more complex lifetimes.
|
||||||
|
|
||||||
| type | meaning |
|
| type | meaning |
|
||||||
|-|-|
|
| ------------ | -------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| `Type* name` | The lifetime of the parameter may exceed the length of the function call. It may use the `QObject` parent/children system. |
|
| `Type* name` | The lifetime of the parameter may exceed the length of the function call. It may use the `QObject` parent/children system. |
|
||||||
|
|
||||||
**R-value references** `&&` work similar to regular references but signal the parameter should be "consumed".
|
**R-value references** `&&` work similar to regular references but signal the parameter should be "consumed".
|
||||||
|
@ -126,11 +124,10 @@ void main() {
|
||||||
|
|
||||||
Generally the lowest level of requirement should be used e.g. passing `Channel&` instead of `std::shared_ptr<Channel>&` (aka `ChannelPtr`) if possible.
|
Generally the lowest level of requirement should be used e.g. passing `Channel&` instead of `std::shared_ptr<Channel>&` (aka `ChannelPtr`) if possible.
|
||||||
|
|
||||||
|
## Members
|
||||||
|
|
||||||
Members
|
All functions names are in `camelCase`. _Private_ member variables are in `camelCase_` (note the underscore at the end). We don't use the `get` prefix for getters. We mark functions as `const` [if applicable](https://stackoverflow.com/questions/751681/meaning-of-const-last-in-a-function-declaration-of-a-class).
|
||||||
-----
|
|
||||||
|
|
||||||
All functions names are in `camelCase`. *Private* member variables are in `camelCase_` (note the underscore at the end). We don't use the `get` prefix for getters. We mark functions as `const` [if applicable](https://stackoverflow.com/questions/751681/meaning-of-const-last-in-a-function-declaration-of-a-class).
|
|
||||||
```cpp
|
```cpp
|
||||||
class NamedObject
|
class NamedObject
|
||||||
{
|
{
|
||||||
|
@ -151,8 +148,7 @@ private:
|
||||||
void myFreeStandingFunction(); // <- also lower case
|
void myFreeStandingFunction(); // <- also lower case
|
||||||
```
|
```
|
||||||
|
|
||||||
Casts
|
## Casts
|
||||||
------
|
|
||||||
|
|
||||||
- **Avoid** c-style casts: `(type)variable`.
|
- **Avoid** c-style casts: `(type)variable`.
|
||||||
- Instead use explicit type casts: `type(variable)`
|
- Instead use explicit type casts: `type(variable)`
|
||||||
|
@ -181,9 +177,8 @@ void example() {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## This
|
||||||
|
|
||||||
This
|
|
||||||
------
|
|
||||||
Always use `this` to refer to instance members to make it clear where we use either locals or members.
|
Always use `this` to refer to instance members to make it clear where we use either locals or members.
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
|
@ -206,15 +201,17 @@ Test::testFunc(int a)
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Managing resources
|
## Managing resources
|
||||||
------
|
|
||||||
|
|
||||||
#### Regular classes
|
#### Regular classes
|
||||||
|
|
||||||
Keep the element on the stack if possible. If you need a pointer or have complex ownership you should use one of these classes:
|
Keep the element on the stack if possible. If you need a pointer or have complex ownership you should use one of these classes:
|
||||||
|
|
||||||
- Use `std::unique_ptr` if the resource has a single owner.
|
- Use `std::unique_ptr` if the resource has a single owner.
|
||||||
- Use `std::shared_ptr` if the resource has multiple owners.
|
- Use `std::shared_ptr` if the resource has multiple owners.
|
||||||
|
|
||||||
#### QObject classes
|
#### QObject classes
|
||||||
|
|
||||||
- Use the [object tree](https://doc.qt.io/qt-5/objecttrees.html#) to manage lifetime where possible. Objects are destroyed when their parent object is destroyed.
|
- Use the [object tree](https://doc.qt.io/qt-5/objecttrees.html#) to manage lifetime where possible. Objects are destroyed when their parent object is destroyed.
|
||||||
- If you have to explicitly delete an object use `variable->deleteLater()` instead of `delete variable`. This ensures that it will be deleted on the correct thread.
|
- If you have to explicitly delete an object use `variable->deleteLater()` instead of `delete variable`. This ensures that it will be deleted on the correct thread.
|
||||||
- If an object doesn't have a parent consider using `std::unique_ptr<Type, DeleteLater>` with `DeleteLater` from "src/common/Common.hpp". This will call `deleteLater()` on the pointer once it goes out of scope or the object is destroyed.
|
- If an object doesn't have a parent consider using `std::unique_ptr<Type, DeleteLater>` with `DeleteLater` from "src/common/Common.hpp". This will call `deleteLater()` on the pointer once it goes out of scope or the object is destroyed.
|
||||||
|
|
12
README.md
12
README.md
|
@ -7,22 +7,27 @@ The Chatterino 2 wiki can be found [here](https://wiki.chatterino.com).
|
||||||
Contribution guidelines can be found [here](https://wiki.chatterino.com/contributing).
|
Contribution guidelines can be found [here](https://wiki.chatterino.com/contributing).
|
||||||
|
|
||||||
## Download
|
## Download
|
||||||
|
|
||||||
Current releases are available at [https://chatterino.com](https://chatterino.com).
|
Current releases are available at [https://chatterino.com](https://chatterino.com).
|
||||||
Windows users can also install Chatterino [from Chocolatey](https://chocolatey.org/packages/chatterino).
|
Windows users can also install Chatterino [from Chocolatey](https://chocolatey.org/packages/chatterino).
|
||||||
|
|
||||||
## Nightly build
|
## Nightly build
|
||||||
|
|
||||||
You can download the latest Chatterino 2 build over [here](https://github.com/Chatterino/chatterino2/releases/tag/nightly-build)
|
You can download the latest Chatterino 2 build over [here](https://github.com/Chatterino/chatterino2/releases/tag/nightly-build)
|
||||||
|
|
||||||
You might also need to install the [VC++ 2017 Redistributable](https://aka.ms/vs/15/release/vc_redist.x64.exe) from Microsoft if you do not have it installed already.
|
You might also need to install the [VC++ 2017 Redistributable](https://aka.ms/vs/15/release/vc_redist.x64.exe) from Microsoft if you do not have it installed already.
|
||||||
If you still receive an error about `MSVCR120.dll missing`, then you should install the [VC++ 2013 Restributable](https://download.microsoft.com/download/2/E/6/2E61CFA4-993B-4DD4-91DA-3737CD5CD6E3/vcredist_x64.exe
|
If you still receive an error about `MSVCR120.dll missing`, then you should install the [VC++ 2013 Restributable](https://download.microsoft.com/download/2/E/6/2E61CFA4-993B-4DD4-91DA-3737CD5CD6E3/vcredist_x64.exe).
|
||||||
).
|
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
|
|
||||||
To get source code with required submodules run:
|
To get source code with required submodules run:
|
||||||
|
|
||||||
```
|
```
|
||||||
git clone --recurse-submodules https://github.com/Chatterino/chatterino2.git
|
git clone --recurse-submodules https://github.com/Chatterino/chatterino2.git
|
||||||
```
|
```
|
||||||
|
|
||||||
or
|
or
|
||||||
|
|
||||||
```
|
```
|
||||||
git clone https://github.com/Chatterino/chatterino2.git
|
git clone https://github.com/Chatterino/chatterino2.git
|
||||||
cd chatterino2
|
cd chatterino2
|
||||||
|
@ -38,9 +43,11 @@ git submodule update --init --recursive
|
||||||
[Building on FreeBSD](../master/BUILDING_ON_FREEBSD.md)
|
[Building on FreeBSD](../master/BUILDING_ON_FREEBSD.md)
|
||||||
|
|
||||||
## Code style
|
## Code style
|
||||||
|
|
||||||
The code is formatted using clang format in Qt Creator. [.clang-format](src/.clang-format) contains the style file for clang format.
|
The code is formatted using clang format in Qt Creator. [.clang-format](src/.clang-format) contains the style file for clang format.
|
||||||
|
|
||||||
### Get it automated with QT Creator + Beautifier + Clang Format
|
### Get it automated with QT Creator + Beautifier + Clang Format
|
||||||
|
|
||||||
1. Download LLVM: https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/LLVM-11.0.0-win64.exe
|
1. Download LLVM: https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/LLVM-11.0.0-win64.exe
|
||||||
2. During the installation, make sure to add it to your path
|
2. During the installation, make sure to add it to your path
|
||||||
3. In QT Creator, select `Help` > `About Plugins` > `C++` > `Beautifier` to enable the plugin
|
3. In QT Creator, select `Help` > `About Plugins` > `C++` > `Beautifier` to enable the plugin
|
||||||
|
@ -52,4 +59,5 @@ The code is formatted using clang format in Qt Creator. [.clang-format](src/.cla
|
||||||
Qt creator should now format the documents when saving it.
|
Qt creator should now format the documents when saving it.
|
||||||
|
|
||||||
## Doxygen
|
## Doxygen
|
||||||
|
|
||||||
Doxygen is used to generate project information daily and is available [here](https://doxygen.chatterino.com).
|
Doxygen is used to generate project information daily and is available [here](https://doxygen.chatterino.com).
|
||||||
|
|
|
@ -1,134 +1,154 @@
|
||||||
# Twitch API
|
# Twitch API
|
||||||
|
|
||||||
this folder describes what sort of API requests we do, what permissions are required for the requests etc
|
this folder describes what sort of API requests we do, what permissions are required for the requests etc
|
||||||
|
|
||||||
## Kraken (V5)
|
## Kraken (V5)
|
||||||
|
|
||||||
We use a bunch of Kraken (V5) in Chatterino2.
|
We use a bunch of Kraken (V5) in Chatterino2.
|
||||||
|
|
||||||
### Get Cheermotes
|
### Get Cheermotes
|
||||||
|
|
||||||
URL: https://dev.twitch.tv/docs/v5/reference/bits#get-cheermotes
|
URL: https://dev.twitch.tv/docs/v5/reference/bits#get-cheermotes
|
||||||
|
|
||||||
Migration path: **Not checked**
|
Migration path: **Not checked**
|
||||||
|
|
||||||
* We implement this API in `providers/twitch/TwitchChannel.cpp` to resolve a chats available cheer emotes. This helps us parse incoming messages like `pajaCheer1000`
|
- We implement this API in `providers/twitch/TwitchChannel.cpp` to resolve a chats available cheer emotes. This helps us parse incoming messages like `pajaCheer1000`
|
||||||
|
|
||||||
### Get User Emotes
|
### Get User Emotes
|
||||||
|
|
||||||
URL: https://dev.twitch.tv/docs/v5/reference/users#get-user-emotes
|
URL: https://dev.twitch.tv/docs/v5/reference/users#get-user-emotes
|
||||||
Requires `user_subscriptions` scope
|
Requires `user_subscriptions` scope
|
||||||
|
|
||||||
Migration path: **Unknown**
|
Migration path: **Unknown**
|
||||||
|
|
||||||
* We use this in `providers/twitch/TwitchAccount.cpp loadEmotes` to figure out which emotes a user is allowed to use!
|
- We use this in `providers/twitch/TwitchAccount.cpp loadEmotes` to figure out which emotes a user is allowed to use!
|
||||||
|
|
||||||
### AUTOMOD APPROVE
|
### AUTOMOD APPROVE
|
||||||
|
|
||||||
**Unofficial** documentation: https://discuss.dev.twitch.tv/t/allowing-others-aka-bots-to-use-twitchbot-reject/8508/2
|
**Unofficial** documentation: https://discuss.dev.twitch.tv/t/allowing-others-aka-bots-to-use-twitchbot-reject/8508/2
|
||||||
|
|
||||||
* We use this in `providers/twitch/TwitchAccount.cpp autoModAllow` to approve an automod deny/allow question
|
- We use this in `providers/twitch/TwitchAccount.cpp autoModAllow` to approve an automod deny/allow question
|
||||||
|
|
||||||
### AUTOMOD DENY
|
### AUTOMOD DENY
|
||||||
|
|
||||||
**Unofficial** documentation: https://discuss.dev.twitch.tv/t/allowing-others-aka-bots-to-use-twitchbot-reject/8508/2
|
**Unofficial** documentation: https://discuss.dev.twitch.tv/t/allowing-others-aka-bots-to-use-twitchbot-reject/8508/2
|
||||||
|
|
||||||
* We use this in `providers/twitch/TwitchAccount.cpp autoModDeny` to deny an automod deny/allow question
|
- We use this in `providers/twitch/TwitchAccount.cpp autoModDeny` to deny an automod deny/allow question
|
||||||
|
|
||||||
## Helix
|
## Helix
|
||||||
|
|
||||||
Full Helix API reference: https://dev.twitch.tv/docs/api/reference
|
Full Helix API reference: https://dev.twitch.tv/docs/api/reference
|
||||||
|
|
||||||
### Get Users
|
### Get Users
|
||||||
|
|
||||||
URL: https://dev.twitch.tv/docs/api/reference#get-users
|
URL: https://dev.twitch.tv/docs/api/reference#get-users
|
||||||
|
|
||||||
* We implement this in `providers/twitch/api/Helix.cpp fetchUsers`.
|
- We implement this in `providers/twitch/api/Helix.cpp fetchUsers`.
|
||||||
Used in:
|
Used in:
|
||||||
* `UserInfoPopup` to get ID, viewCount, displayName, createdAt of username we clicked
|
- `UserInfoPopup` to get ID, viewCount, displayName, createdAt of username we clicked
|
||||||
* `CommandController` to power any commands that need to get a user ID
|
- `CommandController` to power any commands that need to get a user ID
|
||||||
* `Toasts` to get the profile picture of a streamer who just went live
|
- `Toasts` to get the profile picture of a streamer who just went live
|
||||||
* `TwitchAccount` block and unblock features to translate user name to user ID
|
- `TwitchAccount` block and unblock features to translate user name to user ID
|
||||||
|
|
||||||
### Get Users Follows
|
### Get Users Follows
|
||||||
|
|
||||||
URL: https://dev.twitch.tv/docs/api/reference#get-users-follows
|
URL: https://dev.twitch.tv/docs/api/reference#get-users-follows
|
||||||
|
|
||||||
* We implement this in `providers/twitch/api/Helix.cpp fetchUsersFollows`
|
- We implement this in `providers/twitch/api/Helix.cpp fetchUsersFollows`
|
||||||
Used in:
|
Used in:
|
||||||
* `UserInfoPopup` to get number of followers a user has
|
- `UserInfoPopup` to get number of followers a user has
|
||||||
|
|
||||||
### Get Streams
|
### Get Streams
|
||||||
|
|
||||||
URL: https://dev.twitch.tv/docs/api/reference#get-streams
|
URL: https://dev.twitch.tv/docs/api/reference#get-streams
|
||||||
|
|
||||||
* We implement this in `providers/twitch/api/Helix.cpp fetchStreams`
|
- We implement this in `providers/twitch/api/Helix.cpp fetchStreams`
|
||||||
Used in:
|
Used in:
|
||||||
* `TwitchChannel` to get live status, game, title, and viewer count of a channel
|
- `TwitchChannel` to get live status, game, title, and viewer count of a channel
|
||||||
* `NotificationController` to provide notifications for channels you might not have open in Chatterino, but are still interested in getting notifications for
|
- `NotificationController` to provide notifications for channels you might not have open in Chatterino, but are still interested in getting notifications for
|
||||||
|
|
||||||
### Follow User
|
### Follow User
|
||||||
|
|
||||||
URL: https://dev.twitch.tv/docs/api/reference#create-user-follows
|
URL: https://dev.twitch.tv/docs/api/reference#create-user-follows
|
||||||
Requires `user:edit:follows` scope
|
Requires `user:edit:follows` scope
|
||||||
|
|
||||||
* We implement this in `providers/twitch/api/Helix.cpp followUser`
|
- We implement this in `providers/twitch/api/Helix.cpp followUser`
|
||||||
Used in:
|
Used in:
|
||||||
* `widgets/dialogs/UserInfoPopup.cpp` to follow a user by ticking follow checkbox in usercard
|
- `widgets/dialogs/UserInfoPopup.cpp` to follow a user by ticking follow checkbox in usercard
|
||||||
* `controllers/commands/CommandController.cpp` in /follow command
|
- `controllers/commands/CommandController.cpp` in /follow command
|
||||||
|
|
||||||
### Unfollow User
|
### Unfollow User
|
||||||
|
|
||||||
URL: https://dev.twitch.tv/docs/api/reference#delete-user-follows
|
URL: https://dev.twitch.tv/docs/api/reference#delete-user-follows
|
||||||
Requires `user:edit:follows` scope
|
Requires `user:edit:follows` scope
|
||||||
|
|
||||||
* We implement this in `providers/twitch/api/Helix.cpp unfollowUser`
|
- We implement this in `providers/twitch/api/Helix.cpp unfollowUser`
|
||||||
Used in:
|
Used in:
|
||||||
* `widgets/dialogs/UserInfoPopup.cpp` to unfollow a user by unticking follow checkbox in usercard
|
- `widgets/dialogs/UserInfoPopup.cpp` to unfollow a user by unticking follow checkbox in usercard
|
||||||
* `controllers/commands/CommandController.cpp` in /unfollow command
|
- `controllers/commands/CommandController.cpp` in /unfollow command
|
||||||
|
|
||||||
### Create Clip
|
### Create Clip
|
||||||
|
|
||||||
URL: https://dev.twitch.tv/docs/api/reference#create-clip
|
URL: https://dev.twitch.tv/docs/api/reference#create-clip
|
||||||
Requires `clips:edit` scope
|
Requires `clips:edit` scope
|
||||||
|
|
||||||
* We implement this in `providers/twitch/api/Helix.cpp createClip`
|
- We implement this in `providers/twitch/api/Helix.cpp createClip`
|
||||||
Used in:
|
Used in:
|
||||||
* `TwitchChannel` to create a clip of a live broadcast
|
- `TwitchChannel` to create a clip of a live broadcast
|
||||||
|
|
||||||
### Get Channel
|
### Get Channel
|
||||||
|
|
||||||
URL: https://dev.twitch.tv/docs/api/reference#get-channel-information
|
URL: https://dev.twitch.tv/docs/api/reference#get-channel-information
|
||||||
|
|
||||||
* We implement this in `providers/twitch/api/Helix.cpp getChannel`
|
- We implement this in `providers/twitch/api/Helix.cpp getChannel`
|
||||||
Used in:
|
Used in:
|
||||||
* `TwitchChannel` to refresh stream title
|
- `TwitchChannel` to refresh stream title
|
||||||
|
|
||||||
### Create Stream Marker
|
### Create Stream Marker
|
||||||
|
|
||||||
URL: https://dev.twitch.tv/docs/api/reference/#create-stream-marker
|
URL: https://dev.twitch.tv/docs/api/reference/#create-stream-marker
|
||||||
Requires `user:edit:broadcast` scope
|
Requires `user:edit:broadcast` scope
|
||||||
|
|
||||||
* We implement this in `providers/twitch/api/Helix.cpp createStreamMarker`
|
- We implement this in `providers/twitch/api/Helix.cpp createStreamMarker`
|
||||||
Used in:
|
Used in:
|
||||||
* `controllers/commands/CommandController.cpp` in /marker command
|
- `controllers/commands/CommandController.cpp` in /marker command
|
||||||
|
|
||||||
### Get User Block List
|
### Get User Block List
|
||||||
|
|
||||||
URL: https://dev.twitch.tv/docs/api/reference#get-user-block-list
|
URL: https://dev.twitch.tv/docs/api/reference#get-user-block-list
|
||||||
Requires `user:read:blocked_users` scope
|
Requires `user:read:blocked_users` scope
|
||||||
|
|
||||||
* We implement this in `providers/twitch/api/Helix.cpp loadBlocks`
|
- We implement this in `providers/twitch/api/Helix.cpp loadBlocks`
|
||||||
Used in:
|
Used in:
|
||||||
* `providers/twitch/TwitchAccount.cpp loadBlocks` to load list of blocked (blocked) users by current user
|
- `providers/twitch/TwitchAccount.cpp loadBlocks` to load list of blocked (blocked) users by current user
|
||||||
|
|
||||||
### Block User
|
### Block User
|
||||||
|
|
||||||
URL: https://dev.twitch.tv/docs/api/reference#block-user
|
URL: https://dev.twitch.tv/docs/api/reference#block-user
|
||||||
Requires `user:manage:blocked_users` scope
|
Requires `user:manage:blocked_users` scope
|
||||||
|
|
||||||
* We implement this in `providers/twitch/api/Helix.cpp blockUser`
|
- We implement this in `providers/twitch/api/Helix.cpp blockUser`
|
||||||
Used in:
|
Used in:
|
||||||
* `widgets/dialogs/UserInfoPopup.cpp` to block a user via checkbox in the usercard
|
- `widgets/dialogs/UserInfoPopup.cpp` to block a user via checkbox in the usercard
|
||||||
* `controllers/commands/CommandController.cpp` to block a user via "/block" command
|
- `controllers/commands/CommandController.cpp` to block a user via "/block" command
|
||||||
|
|
||||||
### Unblock User
|
### Unblock User
|
||||||
|
|
||||||
URL: https://dev.twitch.tv/docs/api/reference#unblock-user
|
URL: https://dev.twitch.tv/docs/api/reference#unblock-user
|
||||||
Requires `user:manage:blocked_users` scope
|
Requires `user:manage:blocked_users` scope
|
||||||
|
|
||||||
* We implement this in `providers/twitch/api/Helix.cpp unblockUser`
|
- We implement this in `providers/twitch/api/Helix.cpp unblockUser`
|
||||||
Used in:
|
Used in:
|
||||||
* `widgets/dialogs/UserInfoPopup.cpp` to unblock a user via checkbox in the usercard
|
- `widgets/dialogs/UserInfoPopup.cpp` to unblock a user via checkbox in the usercard
|
||||||
* `controllers/commands/CommandController.cpp` to unblock a user via "/unblock" command
|
- `controllers/commands/CommandController.cpp` to unblock a user via "/unblock" command
|
||||||
|
|
||||||
## TMI
|
## TMI
|
||||||
|
|
||||||
The TMI api is undocumented.
|
The TMI api is undocumented.
|
||||||
|
|
||||||
### Get Chatters
|
### Get Chatters
|
||||||
|
|
||||||
**Undocumented**
|
**Undocumented**
|
||||||
|
|
||||||
* We use this in `widgets/splits/Split.cpp showViewerList`
|
- We use this in `widgets/splits/Split.cpp showViewerList`
|
||||||
* We use this in `providers/twitch/TwitchChannel.cpp refreshChatters`
|
- We use this in `providers/twitch/TwitchChannel.cpp refreshChatters`
|
||||||
|
|
Loading…
Reference in a new issue