diff --git a/resources/examples/moving.gif b/resources/examples/moving.gif new file mode 100644 index 000000000..fccd794f2 Binary files /dev/null and b/resources/examples/moving.gif differ diff --git a/resources/examples/splitting.gif b/resources/examples/splitting.gif new file mode 100644 index 000000000..17e950c5b Binary files /dev/null and b/resources/examples/splitting.gif differ diff --git a/resources/resources_autogenerated.qrc b/resources/resources_autogenerated.qrc index 9db78ea02..1b05c1fd6 100644 --- a/resources/resources_autogenerated.qrc +++ b/resources/resources_autogenerated.qrc @@ -28,6 +28,8 @@ buttons/unmod.png buttons/update.png buttons/updateError.png + examples/moving.gif + examples/splitting.gif licenses/boost_boost.txt licenses/emoji-data-source.txt licenses/fmt_bsd2.txt diff --git a/src/widgets/splits/Split.cpp b/src/widgets/splits/Split.cpp index 57348be6c..d67652d58 100644 --- a/src/widgets/splits/Split.cpp +++ b/src/widgets/splits/Split.cpp @@ -33,8 +33,10 @@ #include #include #include +#include #include #include +#include #include #include @@ -42,6 +44,27 @@ #include 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 Split::modifierStatusChanged; Qt::KeyboardModifiers Split::modifierStatus = Qt::NoModifier; @@ -407,6 +430,18 @@ void Split::changeChannel() } } +void Split::explainMoving() +{ + showTutorialVideo(this, ":/examples/moving.gif", "Moving", + "Hold to move splits.\n\nExample:"); +} + +void Split::explainSplitting() +{ + showTutorialVideo(this, ":/examples/splitting.gif", "Splitting", + "Hold to add new splits.\n\nExample:"); +} + void Split::popup() { auto app = getApp(); diff --git a/src/widgets/splits/Split.hpp b/src/widgets/splits/Split.hpp index 9571c74da..3708e7a1a 100644 --- a/src/widgets/splits/Split.hpp +++ b/src/widgets/splits/Split.hpp @@ -120,6 +120,8 @@ public slots: void addSibling(); void deleteFromContainer(); void changeChannel(); + void explainMoving(); + void explainSplitting(); void popup(); void clear(); void openInBrowser(); diff --git a/src/widgets/splits/SplitHeader.cpp b/src/widgets/splits/SplitHeader.cpp index 4f80bcf2a..bb28fc531 100644 --- a/src/widgets/splits/SplitHeader.cpp +++ b/src/widgets/splits/SplitHeader.cpp @@ -185,10 +185,12 @@ void SplitHeader::initializeLayout() std::unique_ptr SplitHeader::createMainMenu() { auto menu = std::make_unique(); - menu->addAction("Close channel", this->split_, &Split::deleteFromContainer, - QKeySequence("Ctrl+W")); menu->addAction("Change channel", this->split_, &Split::changeChannel, 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->addAction("Popup", this->split_, &Split::popup); menu->addAction("Viewer list", this->split_, &Split::showViewerList);