mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
added examples for moving and splitting
This commit is contained in:
parent
9eacf76a79
commit
e9f0eaf82e
BIN
resources/examples/moving.gif
Normal file
BIN
resources/examples/moving.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 45 KiB |
BIN
resources/examples/splitting.gif
Normal file
BIN
resources/examples/splitting.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 127 KiB |
|
@ -28,6 +28,8 @@
|
||||||
<file>buttons/unmod.png</file>
|
<file>buttons/unmod.png</file>
|
||||||
<file>buttons/update.png</file>
|
<file>buttons/update.png</file>
|
||||||
<file>buttons/updateError.png</file>
|
<file>buttons/updateError.png</file>
|
||||||
|
<file>examples/moving.gif</file>
|
||||||
|
<file>examples/splitting.gif</file>
|
||||||
<file>licenses/boost_boost.txt</file>
|
<file>licenses/boost_boost.txt</file>
|
||||||
<file>licenses/emoji-data-source.txt</file>
|
<file>licenses/emoji-data-source.txt</file>
|
||||||
<file>licenses/fmt_bsd2.txt</file>
|
<file>licenses/fmt_bsd2.txt</file>
|
||||||
|
|
|
@ -33,8 +33,10 @@
|
||||||
#include <QDockWidget>
|
#include <QDockWidget>
|
||||||
#include <QDrag>
|
#include <QDrag>
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
|
#include <QLabel>
|
||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
|
#include <QMovie>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
|
@ -42,6 +44,27 @@
|
||||||
#include <random>
|
#include <random>
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
namespace {
|
||||||
|
void showTutorialVideo(QWidget *parent, const QString &source,
|
||||||
|
const QString &title, const QString &description)
|
||||||
|
{
|
||||||
|
auto window =
|
||||||
|
new BaseWindow(parent, BaseWindow::Flags::EnableCustomFrame);
|
||||||
|
window->setWindowTitle("Chatterino - " + title);
|
||||||
|
window->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
auto layout = new QVBoxLayout();
|
||||||
|
layout->addWidget(new QLabel(description));
|
||||||
|
auto label = new QLabel(window);
|
||||||
|
layout->addWidget(label);
|
||||||
|
auto movie = new QMovie(label);
|
||||||
|
movie->setFileName(source);
|
||||||
|
label->setMovie(movie);
|
||||||
|
movie->start();
|
||||||
|
window->getLayoutContainer()->setLayout(layout);
|
||||||
|
window->show();
|
||||||
|
}
|
||||||
|
} // namespace
|
||||||
|
|
||||||
pajlada::Signals::Signal<Qt::KeyboardModifiers> Split::modifierStatusChanged;
|
pajlada::Signals::Signal<Qt::KeyboardModifiers> Split::modifierStatusChanged;
|
||||||
Qt::KeyboardModifiers Split::modifierStatus = Qt::NoModifier;
|
Qt::KeyboardModifiers Split::modifierStatus = Qt::NoModifier;
|
||||||
|
|
||||||
|
@ -407,6 +430,18 @@ void Split::changeChannel()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Split::explainMoving()
|
||||||
|
{
|
||||||
|
showTutorialVideo(this, ":/examples/moving.gif", "Moving",
|
||||||
|
"Hold <Ctrl+Alt> to move splits.\n\nExample:");
|
||||||
|
}
|
||||||
|
|
||||||
|
void Split::explainSplitting()
|
||||||
|
{
|
||||||
|
showTutorialVideo(this, ":/examples/splitting.gif", "Splitting",
|
||||||
|
"Hold <Ctrl+Alt> to add new splits.\n\nExample:");
|
||||||
|
}
|
||||||
|
|
||||||
void Split::popup()
|
void Split::popup()
|
||||||
{
|
{
|
||||||
auto app = getApp();
|
auto app = getApp();
|
||||||
|
|
|
@ -120,6 +120,8 @@ public slots:
|
||||||
void addSibling();
|
void addSibling();
|
||||||
void deleteFromContainer();
|
void deleteFromContainer();
|
||||||
void changeChannel();
|
void changeChannel();
|
||||||
|
void explainMoving();
|
||||||
|
void explainSplitting();
|
||||||
void popup();
|
void popup();
|
||||||
void clear();
|
void clear();
|
||||||
void openInBrowser();
|
void openInBrowser();
|
||||||
|
|
|
@ -185,10 +185,12 @@ void SplitHeader::initializeLayout()
|
||||||
std::unique_ptr<QMenu> SplitHeader::createMainMenu()
|
std::unique_ptr<QMenu> SplitHeader::createMainMenu()
|
||||||
{
|
{
|
||||||
auto menu = std::make_unique<QMenu>();
|
auto menu = std::make_unique<QMenu>();
|
||||||
menu->addAction("Close channel", this->split_, &Split::deleteFromContainer,
|
|
||||||
QKeySequence("Ctrl+W"));
|
|
||||||
menu->addAction("Change channel", this->split_, &Split::changeChannel,
|
menu->addAction("Change channel", this->split_, &Split::changeChannel,
|
||||||
QKeySequence("Ctrl+R"));
|
QKeySequence("Ctrl+R"));
|
||||||
|
menu->addAction("Move", this->split_, &Split::explainMoving);
|
||||||
|
menu->addAction("Add/Split", this->split_, &Split::explainSplitting);
|
||||||
|
menu->addAction("Close", this->split_, &Split::deleteFromContainer,
|
||||||
|
QKeySequence("Ctrl+W"));
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
menu->addAction("Popup", this->split_, &Split::popup);
|
menu->addAction("Popup", this->split_, &Split::popup);
|
||||||
menu->addAction("Viewer list", this->split_, &Split::showViewerList);
|
menu->addAction("Viewer list", this->split_, &Split::showViewerList);
|
||||||
|
|
Loading…
Reference in a new issue