added welcome dialog

This commit is contained in:
itsmattkc
2021-07-23 17:46:42 -07:00
parent 9e183779f3
commit d0e7258301
7 changed files with 84 additions and 13 deletions
+1
View File
@@ -95,6 +95,7 @@ void Config::SetDefaults()
SetEntryInternal(QStringLiteral("UseGradients"), NodeValue::kBoolean, true);
SetEntryInternal(QStringLiteral("AutoMergeTracks"), NodeValue::kBoolean, true);
SetEntryInternal(QStringLiteral("UseSliderLadders"), NodeValue::kBoolean, true);
SetEntryInternal(QStringLiteral("ShowWelcomeDialog"), NodeValue::kBoolean, true);
SetEntryInternal(QStringLiteral("AutoCacheEnabled"), NodeValue::kBoolean, true);
SetEntryInternal(QStringLiteral("AutoCacheDelay"), NodeValue::kInt, 1000);
+1 -1
View File
@@ -316,7 +316,7 @@ void Core::SetSnapping(const bool &b)
void Core::DialogAboutShow()
{
AboutDialog a(main_window_);
AboutDialog a(false, main_window_);
a.exec();
}
+59 -10
View File
@@ -26,23 +26,33 @@
#include <QVBoxLayout>
#include "common/qtutils.h"
#include "config/config.h"
#include "patreon.h"
#include "scrollinglabel.h"
namespace olive {
AboutDialog::AboutDialog(QWidget *parent) :
AboutDialog::AboutDialog(bool welcome_dialog, QWidget *parent) :
QDialog(parent)
{
setWindowTitle(tr("About %1").arg(QApplication::applicationName()));
if (welcome_dialog) {
setWindowTitle(tr("Welcome to %1").arg(QApplication::applicationName()));
} else {
setWindowTitle(tr("About %1").arg(QApplication::applicationName()));
}
QFontMetrics fm = fontMetrics();
QVBoxLayout* layout = new QVBoxLayout(this);
layout->setMargin(fm.height());
layout->addWidget(new QLabel());
QHBoxLayout *horiz_layout = new QHBoxLayout();
horiz_layout->setMargin(fm.height());
horiz_layout->setSpacing(fm.height()*2);
QLabel* icon = new QLabel(QStringLiteral("<html><img src=':/graphics/olive-splash.png'></html>"));
icon->setAlignment(Qt::AlignCenter);
layout->addWidget(icon);
horiz_layout->addWidget(icon);
// Construct About text
QLabel* label =
@@ -58,18 +68,33 @@ AboutDialog::AboutDialog(QWidget *parent) :
"This software is licensed under the GNU GPL Version 3.")));
// Set text formatting
label->setAlignment(Qt::AlignCenter);
label->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
label->setWordWrap(true);
label->setOpenExternalLinks(true);
label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
layout->addWidget(label);
horiz_layout->addWidget(label);
layout->addLayout(horiz_layout);
// Patrons where necessary
if (!patrons.isEmpty()) {
layout->addWidget(new QLabel());
layout->addWidget(QtUtils::CreateHorizontalLine());
layout->addWidget(new QLabel());
QLabel* support_lbl = new QLabel(tr("<html>Olive wouldn't be possible without the support of gracious "
"donations from <a href='https://www.patreon.com/olivevideoeditor'>Patreon</a></html>:"));
QString opening_statement;
if (welcome_dialog) {
opening_statement = tr("<b>Olive relies on support from the community to continue its development.</b>");
} else {
opening_statement = tr("Olive wouldn't be possible without the support of gracious donations from the following people.");
}
QLabel* support_lbl = new QLabel(tr("<html>%1 "
"If you like this project, please consider "
"<a href='https://olivevideoeditor.org/donate.php'>donating</a> or "
"<a href='https://www.patreon.com/olivevideoeditor'>pledging</a> to "
"support its development.</html>").arg(opening_statement));
support_lbl->setWordWrap(true);
support_lbl->setAlignment(Qt::AlignCenter);
support_lbl->setOpenExternalLinks(true);
@@ -82,13 +107,37 @@ AboutDialog::AboutDialog(QWidget *parent) :
layout->addWidget(new QLabel());
QHBoxLayout *btn_layout = new QHBoxLayout();
btn_layout->setMargin(0);
btn_layout->setSpacing(0);
if (welcome_dialog) {
dont_show_again_checkbox_ = new QCheckBox(tr("Don't show this message again"));
btn_layout->addWidget(dont_show_again_checkbox_);
} else {
dont_show_again_checkbox_ = nullptr;
}
QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok, this);
buttons->setCenterButtons(true);
layout->addWidget(buttons);
if (!welcome_dialog) {
buttons->setCenterButtons(true);
}
btn_layout->addWidget(buttons);
layout->addLayout(btn_layout);
connect(buttons, &QDialogButtonBox::accepted, this, &QDialog::accept);
setFixedSize(sizeHint());
}
void AboutDialog::accept()
{
if (dont_show_again_checkbox_ && dont_show_again_checkbox_->isChecked()) {
Config::Current()[QStringLiteral("ShowWelcomeDialog")] = false;
}
QDialog::accept();
}
}
+9 -1
View File
@@ -21,6 +21,7 @@
#ifndef ABOUTDIALOG_H
#define ABOUTDIALOG_H
#include <QCheckBox>
#include <QDialog>
#include "common/define.h"
@@ -46,7 +47,14 @@ public:
*
* QWidget parent object. Usually this will be MainWindow.
*/
explicit AboutDialog(QWidget *parent = nullptr);
explicit AboutDialog(bool welcome_dialog, QWidget *parent = nullptr);
public slots:
virtual void accept() override;
private:
QCheckBox *dont_show_again_checkbox_;
};
}
+1 -1
View File
@@ -26,7 +26,7 @@
namespace olive {
const int ScrollingLabel::kMinLineHeight = 5;
const int ScrollingLabel::kMinLineHeight = 10;
ScrollingLabel::ScrollingLabel(QWidget *parent) :
QWidget(parent),
+11
View File
@@ -29,6 +29,7 @@
#include <QOffscreenSurface>
#endif
#include "dialog/about/about.h"
#include "mainmenu.h"
#include "mainstatusbar.h"
@@ -486,6 +487,14 @@ void MainWindow::ProjectPanelSelectionChanged(const QVector<Node *> &nodes)
}
}
void MainWindow::ShowWelcomeDialog()
{
if (Config::Current()[QStringLiteral("ShowWelcomeDialog")].toBool()) {
AboutDialog ad(true, this);
ad.exec();
}
}
#ifdef Q_OS_LINUX
void MainWindow::ShowNouveauWarning()
{
@@ -844,6 +853,8 @@ void MainWindow::showEvent(QShowEvent *e)
}
#endif
QMetaObject::invokeMethod(this, "ShowWelcomeDialog", Qt::QueuedConnection);
first_show_ = false;
}
}
+2
View File
@@ -196,6 +196,8 @@ private slots:
void ProjectPanelSelectionChanged(const QVector<Node*> &nodes);
void ShowWelcomeDialog();
};
}