* Split up Window Layout loading into a loading and application stage
Previously, we were creating UI elements at while we were reading the window-layout.json file.
We now read the window-layout.json file fully first, which results in a
WindowLayout struct which is built up of a list of windows with a list
of tabs with a root node which contains containers and splits.
This WindowLayout can then be applied.
This will enable PRs like #1940 to start Chatterino with Window Layouts
that aren't defined in a json file.
This commit has deprecated loading of v1 window layouts (we're now on v2). If a v1 window layout is there, it will just be ignored and Chatterino will boot up as if it did not have a window layout at all, and on save that old window layout will be gone.
* Fix compile error for mac
This is done by deliberately setting and reading the enabled state of
the widget whenever the stateChanged event happens.
If the stateChanged event happens while the widget is not enabled, we
know the event must have been triggered by our "check user follow state"
event, and then we don't act upon that event
On macOS, trying to display a dialog before showing the main window
(like when starting minimized) leads to a crash. The dialog will now
show before the main window is opened, preventing this issue.
* (#1874) Disable update checking for unsupported platforms
As described #1874, only Windows, macOS and GNU/Linux are officially
supplied with builds. Thus checking for updates is unnecessary if we
are e.g. on FreeBSD, OpenBSD, illumos distros and possibly other
Operating Systems.
This fixes#1874 by ifdef-ing the 3 officially supported platforms
when checking for updates. Otherwise a debug warning will be emitted
and in the settings the checkbox for beta-updates is hidden and
replaced by a message, explaining the reason for why there are no beta
updates.
* Update CHANGELOG
In accordance with #1874
* (#1874) Move platform check into checkForUpdates
As discussed in #1914
* (#1874) Move check for supported OS to a seperate function.
As requested in #1914
* fixed SearchWindow memory leak
* Update CHANGELOG.md
* added DebugCount for BaseWindow
* [Bug Fix] Color of second user highlight cannot be set (#1898)
* Highlighting: Fix bug preventing user highlight from being set
Before this commit, only the row of a clicked cell was checked, but not
the tab it was clicked in.
Since the "Whispers" row is the second row in the "Messages" tab on the
highlighting page, the color picker was not opened for the second entry
in the "Users" tab either. This commit fixes the bug by also checking
tab the cell was clicked in.
* Update CHANGELOG.md
* Emote Popup Improvements (#1895)
* Put exact matching emotes first
* Close GenericListView on Escape press
* smol fix
* fixed emote input when not in the first char
* fixes#1902
* closes#1904
Co-authored-by: Leon Richardt <leon.richardt@gmail.com>
Co-authored-by: Daniel <24928223+dnsge@users.noreply.github.com>
* Highlighting: Fix bug preventing user highlight from being set
Before this commit, only the row of a clicked cell was checked, but not
the tab it was clicked in.
Since the "Whispers" row is the second row in the "Messages" tab on the
highlighting page, the color picker was not opened for the second entry
in the "Users" tab either. This commit fixes the bug by also checking
tab the cell was clicked in.
* Update CHANGELOG.md
* Add missing includes
We would normally have these included in another file already, or even
the precompiled headers, but having the files included here too makes
testing single parts easier.
* Modify the regex building of highlight phrases for non-regex phrases
For phrases like !test, the word boundary checking we did before was not
enough, so we now check for either a word boundary, a whitespace
character, or the line start/end.
* Add tests for ensuring I haven't fully broken the highlight system
* Add changelog entry
* Proof of Concept for Quick Switcher
* Fix crash when suggestions are empty
* QuickSwitcher: Use tab name instead of a single channel
* Rebase later
* Add missing include for <functional>
* Move QuickSwitcher related classes into own subfolder
* Refactor switcher list items
Now, items are responsible for taking the right action when selected in
the switcher list. This should allow for more focused code and
responsibilities.
* Add note about memory management
* Add option to open channel in a new tab
* Add support for using the mouse
* Spawn switcher popup in the middle of the window
Works reliably on i3 at least. Might need some additional testing on
other WMs (and especially on Windows!).
* Add some icons for switcher items
Note that the final design of the list is not final but I do plan to
incorporate these in the future.
* Set Qt::Dialog window flag on switcher popup
Prevents tiling window managers like i3 from trying to tile the window.
* Rename "SwitcherItem" to "AbstractSwitcherItem"
* Add comments about what items are inserted
* Use custom model and view
Still missing: Currently selected item is not highlighted yet. You can
move between selected items with tab and arrow keys though.
* Add helper function to convert QVariant to AbstractSwitcherItem *
* Remove useless constant
* Highlight currently selected switcher item
* Use a different method for centering QuickSwitcherPopup window
* QuickSwitcherModel: Add documentation
* Add default parameter to QuickSwitcherModel::rowCount
* QuickSwitcherPopup: Add comments
* Remove outdated TODO
* QuickSwitcherModel: Init vector with default capacity
* Remove outdated comment
* Add comment about 0 ms timeout interval
* NewTabItem: Simplify interface
* Only fetch opened splits once
This is better than the prior approach since opened splits cannot change
anyways while the switcher is open.
* Use SplitContainer to pass information instead of custom type
* Allow searching for tab titles as well
Before this commit, only channel names could be searched.
* Refactor switcher item interface to be more flexible
Also show tab name and channel name in the switcher list.
* Add documentation for AbstractSwitcherItem
* Add documentation for NewTabItem
* Add comments about {begin,end}{Insert,Remove}Rows
* Remove unused method
* Replace magic size with named constant
* Add change log entry
Co-authored-by: fourtf <tf.four@gmail.com>
This makes it so that we consistently start with the same values after
having cleared a ChannelView.
Example place where this happens: UserInfoPopup when user messages are
loaded and refreshed
This has historically been done in the Recent Messages API, but this functionality is being moved to Chatterino instead
* Remove `clearchatToNotice=true` query parameter to the Recent Messages API
This ensures that the layout will survive for the lifetime of the menu,
so any of the menu actions can with confidence do things with the
layout, not having to worry whether it's dead or not.
This means that the user, while having the message menu open, could have
one extra MessageLayout alive. I have ensured that when the menu dies
the reference to the shared pointer dies with it.
- /usercard command doesn't close imidiatelly
- removed "Dialog" window flag. It seems to be unnecessary and causes issues (on left-clicking user name it sometimes didnt render unless you clicked 2-3 times.
There's a Refresh button added to the popup to refresh the users messages in the popup. Not automatic now while we figure out how fast/slow it would be.
Co-authored-by: dnsge <sagedanielr@gmail.com>
Upon joining a channel or pressing F5, BTTV and FFZ emotes are
(re)loaded. This change adds visual feedback of the network requests and
their outcome, in the form of a system message in the associated
channel's chat window.
Non-error messages are suppressed when joining a
channel (which automatically loads emotes).
This feature is off by default and can be enabled in the settings with the "Show link thumbnail" setting. This feature also requires the "Show link info when hovering" setting to be enabled.
thumbnails support is only there for direct image links, twitch clips, and youtube links. can be expanded in the future in the /api repo
Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit adds support for uploading images to i.nuuls.com from clipboard or by dragging an image into a split.
Documentation for how to self-host the image uploader is available in ENV.md
By default, you will be asked before an image upload takes place. There's an option in the dialog to not be asked again, if that option is chosen you can revert that choice in the settings dialog.
* ChannelView: Rename mouse event related members
This is more in line with the naming of the other members as well as
future members.
* ChannelView: Add ability to scroll with middle mouse button
* Add scrolling resources
* Use custom icons for scroll cursor
* Slightly refactor scrolling logic
* Respect screen scaling when calculating scroll offset
* Nicer scrolling UX
This change allows scrolling to be feel smoother when close to the
starting point.
* Add scrolling with keeping middle mouse pressed
This mimics the behavior of browsers as well.
* Refactor ChannelView::enableScrolling
* Disable drag-scrolling on left or right click
* Don't require mod rights to listen to moderation actions topic
* Format timeout messages directed at you differently
e.g. "You were banned" or "You were timed out for 4h20m", also including
reason if specified.
* Better Highlights: Fix wrong color for migrated phrases
Prior to this commit, no default color was set when an "old" highlight
phrase (one added prior to #1320 / 5957551) was deserialized. This
commit makes highlight phrases uses the default self-highlight color for
these situations. This approach is reasonably sensible since that color
is also similar to the old highlight color.
Fixes#1565.
* Update default self-highlight color
The new default color was suggested in [1] by @RAnders00. Refer to the
link for further information.
[1]: https://github.com/Chatterino/chatterino2/issues/1565#issuecomment-590441625
* Theme: Remove highlight color
As highlight color is independent of the selected theme now, the member
has been removed from the `Theme` singleton. Instead, the fallback theme
color is defined in `HighlightPhrase` now.
Uses of `themes->messages.backgrounds.highlighted` have been replaced
with `HighlightPhrase::FALLBACK_COLOR` accordingly.
* Update src/controllers/highlights/HighlightPhrase.hpp
attempt to just remove constexpr
Co-Authored-By: Ruben Anders <ruben.anders@robotty.de>
* Initialize FALLBACK_COLOR outside header file
* Rename FALLBACK_COLOR to FALLBACK_HIGHLIGHT_COLOR
In preparation for the next commit introducing a new variable.
* Moved subscription highlight color into HighlightPhrase
* Use actual subscription color as a fallback
Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
Co-authored-by: Ruben Anders <ruben.anders@robotty.de>
There's a document in src/providers/twitch/api which describes how we interact with the Twitch API.
Keeping this up to date might be a healthy way for us to ensure we keep using the right APIs for the right job.
Fixes#1546
This change introduces a "window timer" that runs every 100ms that we
use to update the pixmap if necessary, since there is no signal for "let
me know when this image is done loading".
- get rid of `getImageFileFormat`, now uses QMimeDatabase
- now uses a `QMutex` to be thread safe,
- uploading two things at the same time is now impossible
This commit is in response to #1523.
Whispers are now only added to the `/mentions` tab if they also match a
user name or phrase highlight. On a related note, the `highlightVisual_`
member has been removed as it is no longer necessary.
* HighlightPhrase: Fix wrong documentation
* Use right constructor for new HighlightPhrases
* Fix preset highlights changing unintentionally
Prior to this commit, the callback for reacting to user input on the
highlight table (namely, `HighlightingPage::tableCellClicked`) only
checked for the row number in order to determine whether preset
highlights (self highlights, whispers, and subscriptions) need to be
updated. Hence, changing rows 0 through 2 in the "User Highlights" tab
would also update the preset highlights.
This commit adds a check to determine whether the callback was triggered
by the "Messages" highlight tab, or not.
Since #1320, subscription messages are treated as highlights in order to
allow customization. This caused subscription messages to highlight the
split(s) the message was received in. This is not intended behavior.
This commit fixes the issue by additionally checking if the
`Subscription` flag is set on a highlighted message.
* Support for user-defined sounds and colors
* Make color & sound columns selectable
* Add custom row for subscription highlights
* Add subscriptions to custom highlights and centrally manage highlight colors
* Dynamically update message highlight colors
* Introduce crossPlatformCopy()
It sets the text of the clipboard and also syncs it with the selection
clipboard if it is supported. Such behaviour is pretty common for X11
application on Unix-like Operating Systems.
* Fix clang-format remarks
* Fix weird clang-format config discrepancy between my machine and CI
* Remove clipboard argument from crossPlatformCopy
* Fix clang-format remarks
* Channel text for offline chats
* Title refresh timer
* Fixed typo
* Refresh title when room id is loaded
* removed timer
* Typo
* Loaded on demand when hovered over
* removed the extra api request
* Moved refreshTitle function call
* Added thottling for 10s
* Fixed formating style
* reformat
* make status fetcher safer
* Requested changes from fourtf
Things changed:
- make getImageFileFormat case insensitive
- use QTextEdit::dragEnterEvent instead of QAbstractScrollArea::dragEnterEvent,
- Make dragEnterEvent() and dropEvent() overrides.
This includes:
- NuulsUploader.cpp
- changing upload delay to a #define
- moving png conversion code to `boost::optional<QByteArray> convertToPng(QImage image)`
- in uploadImageToNuuls: moving content type definition to a variable, move things around a bit to eliminate an if
- in upload: adding a comment about `source->hasUrls()` and `source->urls()`, change `uploadQueue.size()` to `!uploadQueue.empty()`
- ResizingTextEdit.cpp
- changing #include order