added examples for moving and splitting

This commit is contained in:
fourtf 2018-10-09 18:28:40 +02:00
parent 9eacf76a79
commit e9f0eaf82e
6 changed files with 43 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

View file

@ -28,6 +28,8 @@
<file>buttons/unmod.png</file>
<file>buttons/update.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/emoji-data-source.txt</file>
<file>licenses/fmt_bsd2.txt</file>

View file

@ -33,8 +33,10 @@
#include <QDockWidget>
#include <QDrag>
#include <QJsonArray>
#include <QLabel>
#include <QListWidget>
#include <QMimeData>
#include <QMovie>
#include <QPainter>
#include <QVBoxLayout>
@ -42,6 +44,27 @@
#include <random>
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;
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()
{
auto app = getApp();

View file

@ -120,6 +120,8 @@ public slots:
void addSibling();
void deleteFromContainer();
void changeChannel();
void explainMoving();
void explainSplitting();
void popup();
void clear();
void openInBrowser();

View file

@ -185,10 +185,12 @@ void SplitHeader::initializeLayout()
std::unique_ptr<QMenu> SplitHeader::createMainMenu()
{
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,
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);