ensuring UI items are parented

This commit is contained in:
itsmattkc
2019-01-30 14:03:23 +11:00
parent fac9213833
commit 373875c72b
9 changed files with 70 additions and 57 deletions
+12 -12
View File
@@ -10,21 +10,21 @@ AboutDialog::AboutDialog(QWidget *parent) :
setWindowTitle("About Olive");
setMaximumWidth(360);
QVBoxLayout* layout = new QVBoxLayout();
QVBoxLayout* layout = new QVBoxLayout(this);
layout->setSpacing(20);
setLayout(layout);
QLabel* label =
new QLabel("<html><head/><body>"
"<p><img src=\":/icons/olive-splash.png\"/></p>"
"<p><a href=\"https://www.olivevideoeditor.org/\">"
"<span style=\" text-decoration: underline; color:#007af4;\">"
"https://www.olivevideoeditor.org/"
"</span></a></p><p>"
+ tr("Olive is a non-linear video editor. This software is free and protected by the GNU GPL.")
+ "</p><p>"
+ tr("Olive Team is obliged to inform users that Olive source code is available for download from its website.")
+ "</p></body></html>");
QLabel* label =
new QLabel("<html><head/><body>"
"<p><img src=\":/icons/olive-splash.png\"/></p>"
"<p><a href=\"https://www.olivevideoeditor.org/\">"
"<span style=\" text-decoration: underline; color:#007af4;\">"
"https://www.olivevideoeditor.org/"
"</span></a></p><p>"
+ tr("Olive is a non-linear video editor. This software is free and protected by the GNU GPL.")
+ "</p><p>"
+ tr("Olive Team is obliged to inform users that Olive source code is available for download from its website.")
+ "</p></body></html>", this);
label->setAlignment(Qt::AlignCenter);
label->setWordWrap(true);
layout->addWidget(label);
+9 -5
View File
@@ -17,20 +17,20 @@ ActionSearch::ActionSearch(QWidget *parent) :
setWindowFlags(Qt::Popup);
QVBoxLayout* layout = new QVBoxLayout();
QVBoxLayout* layout = new QVBoxLayout(this);
ActionSearchEntry* entry_field = new ActionSearchEntry();
ActionSearchEntry* entry_field = new ActionSearchEntry(this);
QFont entry_field_font = entry_field->font();
entry_field_font.setPointSize(qRound(entry_field_font.pointSize()*1.2));
entry_field->setFont(entry_field_font);
entry_field->setPlaceholderText(tr("Search for action..."));
entry_field->setPlaceholderText(tr("Search for action..."));
connect(entry_field, SIGNAL(textChanged(const QString&)), this, SLOT(search_update(const QString &)));
connect(entry_field, SIGNAL(returnPressed()), this, SLOT(perform_action()));
connect(entry_field, SIGNAL(moveSelectionUp()), this, SLOT(move_selection_up()));
connect(entry_field, SIGNAL(moveSelectionDown()), this, SLOT(move_selection_down()));
layout->addWidget(entry_field);
list_widget = new ActionSearchList();
list_widget = new ActionSearchList(this);
QFont list_widget_font = list_widget->font();
list_widget_font.setPointSize(qRound(list_widget_font.pointSize()*1.2));
list_widget->setFont(list_widget_font);
@@ -65,7 +65,7 @@ void ActionSearch::search_update(const QString &s, const QString &p, QMenu *pare
} else {
QString comp = a->text().replace("&", "");
if (comp.contains(s, Qt::CaseInsensitive)) {
QListWidgetItem* item = new QListWidgetItem(comp + "\n(" + menu_text + ")");
QListWidgetItem* item = new QListWidgetItem(QString("%1\n(%2)").arg(comp, menu_text), list_widget);
item->setData(Qt::UserRole+1, reinterpret_cast<quintptr>(a));
list_widget->addItem(item);
}
@@ -107,6 +107,8 @@ void ActionSearch::move_selection_down() {
}
}
ActionSearchEntry::ActionSearchEntry(QWidget *parent) : QLineEdit(parent) {}
void ActionSearchEntry::keyPressEvent(QKeyEvent * event) {
switch (event->key()) {
case Qt::Key_Up:
@@ -120,6 +122,8 @@ void ActionSearchEntry::keyPressEvent(QKeyEvent * event) {
}
}
ActionSearchList::ActionSearchList(QWidget *parent) : QListWidget(parent) {}
void ActionSearchList::mouseDoubleClickEvent(QMouseEvent *) {
emit dbl_click();
}
+6 -2
View File
@@ -10,6 +10,8 @@ class QMenu;
class ActionSearchList : public QListWidget {
Q_OBJECT
public:
ActionSearchList(QWidget* parent);
protected:
void mouseDoubleClickEvent(QMouseEvent *event);
signals:
@@ -20,9 +22,9 @@ class ActionSearch : public QDialog
{
Q_OBJECT
public:
ActionSearch(QWidget* parent = 0);
ActionSearch(QWidget* parent = nullptr);
private slots:
void search_update(const QString& s, const QString &p = 0, QMenu *parent = nullptr);
void search_update(const QString& s, const QString &p = nullptr, QMenu *parent = nullptr);
void perform_action();
void move_selection_up();
void move_selection_down();
@@ -32,6 +34,8 @@ private:
class ActionSearchEntry : public QLineEdit {
Q_OBJECT
public:
ActionSearchEntry(QWidget* parent);
protected:
void keyPressEvent(QKeyEvent * event);
signals:
+2 -2
View File
@@ -11,10 +11,10 @@ DebugDialog* debug_dialog = nullptr;
DebugDialog::DebugDialog(QWidget *parent) : QDialog(parent) {
setWindowTitle(tr("Debug Log"));
QVBoxLayout* layout = new QVBoxLayout();
QVBoxLayout* layout = new QVBoxLayout(this);
setLayout(layout);
textEdit = new QTextEdit();
textEdit = new QTextEdit(this);
textEdit->setWordWrapMode(QTextOption::NoWrap);
layout->addWidget(textEdit);
}
+16 -16
View File
@@ -7,31 +7,31 @@
DemoNotice::DemoNotice(QWidget *parent) :
QDialog(parent)
{
setWindowTitle(tr("Welcome to Olive!"));
setWindowTitle(tr("Welcome to Olive!"));
setMaximumWidth(600);
QVBoxLayout* vlayout = new QVBoxLayout();
QVBoxLayout* vlayout = new QVBoxLayout(this);
setLayout(vlayout);
QHBoxLayout* layout = new QHBoxLayout();
QHBoxLayout* layout = new QHBoxLayout(this);
layout->setMargin(10);
layout->setSpacing(20);
QLabel* icon = new QLabel("<html><head/><body>"
"<p><img src=\":/icons/olive-splash.png\"/></p>"
"</body></html>");
QLabel* icon = new QLabel("<html><head/><body>"
"<p><img src=\":/icons/olive-splash.png\"/></p>"
"</body></html>", this);
layout->addWidget(icon);
QLabel* text = new QLabel("<html><head/><body><p>"
"<span style=\" font-size:14pt;\">"
+ tr("Welcome to Olive!")
+ "</span></p><p>"
+ tr("Olive is a free open-source video editor released under the GNU GPL. If you have paid for this software, you have been scammed.")
+ "</p><p>"
+ tr("This software is currently in ALPHA which means it is unstable and very likely to crash, have bugs, and have missing features. We offer no warranty so use at your own risk. Please report any bugs or feature requests at %1").arg("<a href=\"https://olivevideoeditor.org/\"><span style=\" text-decoration: underline; color:#007af4;\">www.olivevideoeditor.org</span></a>")
+ "</p><p>"
+ tr("Thank you for trying Olive and we hope you enjoy it!")
+ "</p></body></html>");
QLabel* text = new QLabel("<html><head/><body><p>"
"<span style=\" font-size:14pt;\">"
+ tr("Welcome to Olive!")
+ "</span></p><p>"
+ tr("Olive is a free open-source video editor released under the GNU GPL. If you have paid for this software, you have been scammed.")
+ "</p><p>"
+ tr("This software is currently in ALPHA which means it is unstable and very likely to crash, have bugs, and have missing features. We offer no warranty so use at your own risk. Please report any bugs or feature requests at %1").arg("<a href=\"https://olivevideoeditor.org/\"><span style=\" text-decoration: underline; color:#007af4;\">www.olivevideoeditor.org</span></a>")
+ "</p><p>"
+ tr("Thank you for trying Olive and we hope you enjoy it!")
+ "</p></body></html>", this);
text->setWordWrap(true);
layout->addWidget(text);
+5 -5
View File
@@ -498,7 +498,7 @@ void ExportDialog::export_action() {
}
}
et = new ExportThread();
et = new ExportThread(this);
connect(et, SIGNAL(finished()), et, SLOT(deleteLater()));
connect(et, SIGNAL(finished()), this, SLOT(render_thread_finished()));
@@ -599,9 +599,9 @@ void ExportDialog::comp_type_changed(int) {
void ExportDialog::setup_ui() {
QVBoxLayout* verticalLayout = new QVBoxLayout(this);
QHBoxLayout* format_layout = new QHBoxLayout();
QHBoxLayout* format_layout = new QHBoxLayout(this);
format_layout->addWidget(new QLabel(tr("Format:")));
format_layout->addWidget(new QLabel(tr("Format:"), this));
formatCombobox = new QComboBox(this);
@@ -609,9 +609,9 @@ void ExportDialog::setup_ui() {
verticalLayout->addLayout(format_layout);
QHBoxLayout* range_layout = new QHBoxLayout();
QHBoxLayout* range_layout = new QHBoxLayout(this);
range_layout->addWidget(new QLabel(tr("Range:")));
range_layout->addWidget(new QLabel(tr("Range:"), this));
rangeCombobox = new QComboBox(this);
rangeCombobox->addItem(tr("Entire Sequence"));
+4 -1
View File
@@ -27,7 +27,10 @@ extern "C" {
#include <QOpenGLPaintDevice>
#include <QPainter>
ExportThread::ExportThread() : continueEncode(true) {
ExportThread::ExportThread(QObject *parent) :
QThread(parent),
continueEncode(true)
{
surface.create();
fmt_ctx = nullptr;
+1 -1
View File
@@ -28,7 +28,7 @@ extern "C" {
class ExportThread : public QThread {
Q_OBJECT
public:
ExportThread();
ExportThread(QObject* parent = nullptr);
void run();
// export parameters
+15 -13
View File
@@ -4,10 +4,12 @@
#include <QThread>
#include <QSemaphore>
#define ICON_TYPE_VIDEO 0
#define ICON_TYPE_AUDIO 1
#define ICON_TYPE_IMAGE 2
#define ICON_TYPE_ERROR 3
enum IconType {
ICON_TYPE_VIDEO,
ICON_TYPE_AUDIO,
ICON_TYPE_IMAGE,
ICON_TYPE_ERROR
};
struct Footage;
struct FootageStream;
@@ -16,28 +18,28 @@ class Media;
class PreviewGenerator : public QThread
{
Q_OBJECT
Q_OBJECT
public:
PreviewGenerator(Media*, Footage*, bool);
void run();
void run();
void cancel();
signals:
void set_icon(int, bool);
private:
void parse_media();
void parse_media();
bool retrieve_preview(const QString &hash);
void generate_waveform();
void generate_waveform();
void finalize_media();
AVFormatContext* fmt_ctx;
Media* media;
Footage* footage;
AVFormatContext* fmt_ctx;
Media* media;
Footage* footage;
bool retrieve_duration;
bool contains_still_image;
bool replace;
bool cancelled;
QString data_path;
QString get_thumbnail_path(const QString &hash, const FootageStream &ms);
QString get_waveform_path(const QString& hash, const FootageStream &ms);
QString get_thumbnail_path(const QString &hash, const FootageStream &ms);
QString get_waveform_path(const QString& hash, const FootageStream &ms);
};
#endif // PREVIEWGENERATOR_H