added preference for effect textbox size

This commit is contained in:
itsmattkc
2019-01-17 23:38:42 +11:00
parent 96043aa8c5
commit 9143561bb4
5 changed files with 39 additions and 14 deletions
+15 -1
View File
@@ -130,6 +130,7 @@ void PreferencesDialog::save() {
config.upcoming_queue_type = upcoming_queue_type->currentIndex();
config.previous_queue_size = previous_queue_spinbox->value();
config.previous_queue_type = previous_queue_type->currentIndex();
config.effect_textbox_lines = effect_textbox_lines_field->value();
// save keyboard shortcuts
for (int i=0;i<key_shortcut_fields.size();i++) {
@@ -265,9 +266,11 @@ void PreferencesDialog::setup_ui() {
QVBoxLayout* verticalLayout = new QVBoxLayout(this);
QTabWidget* tabWidget = new QTabWidget(this);
// General
QTabWidget* general_tab = new QTabWidget();
QGridLayout* general_layout = new QGridLayout(general_tab);
// General -> Custom CSS
general_layout->addWidget(new QLabel(tr("Custom CSS:")), 0, 0, 1, 1);
custom_css_fn = new QLineEdit(general_tab);
@@ -278,21 +281,32 @@ void PreferencesDialog::setup_ui() {
connect(custom_css_browse, SIGNAL(clicked(bool)), this, SLOT(browse_css_file()));
general_layout->addWidget(custom_css_browse, 0, 2, 1, 1);
// General -> Image Sequence Formats
general_layout->addWidget(new QLabel(tr("Image sequence formats:")), 1, 0, 1, 1);
imgSeqFormatEdit = new QLineEdit(general_tab);
general_layout->addWidget(imgSeqFormatEdit, 1, 1, 1, 2);
// General -> Audio Recording
general_layout->addWidget(new QLabel(tr("Audio Recording:")), 2, 0, 1, 1);
recordingComboBox = new QComboBox(general_tab);
recordingComboBox->addItem(tr("Mono"));
recordingComboBox->addItem(tr("Stereo"));
general_layout->addWidget(recordingComboBox, 2, 1, 1, 2);
// General -> Effect Textbox Lines
general_layout->addWidget(new QLabel(tr("Effect Textbox Lines:")), 3, 0, 1, 1);
effect_textbox_lines_field = new QSpinBox(general_tab);
effect_textbox_lines_field->setMinimum(1);
effect_textbox_lines_field->setValue(config.effect_textbox_lines);
general_layout->addWidget(effect_textbox_lines_field, 3, 1, 1, 2);
tabWidget->addTab(general_tab, tr("General"));
// Behavior
QWidget* behavior_tab = new QWidget();
tabWidget->addTab(behavior_tab, tr("Behavior"));
+4 -2
View File
@@ -12,6 +12,7 @@ class QTreeWidgetItem;
class QMenu;
class QCheckBox;
class QDoubleSpinBox;
class QSpinBox;
class KeySequenceEditor : public QKeySequenceEdit {
Q_OBJECT
@@ -42,13 +43,13 @@ private slots:
bool refine_shortcut_list(const QString &, QTreeWidgetItem* parent = nullptr);
void load_shortcut_file();
void save_shortcut_file();
void browse_css_file();
void browse_css_file();
private:
void setup_ui();
void setup_kbd_shortcut_worker(QMenu* menu, QTreeWidgetItem* parent);
QLineEdit* custom_css_fn;
QLineEdit* custom_css_fn;
QLineEdit* imgSeqFormatEdit;
QComboBox* recordingComboBox;
QRadioButton* accurateSeekButton;
@@ -59,6 +60,7 @@ private:
QComboBox* upcoming_queue_type;
QDoubleSpinBox* previous_queue_spinbox;
QComboBox* previous_queue_type;
QSpinBox* effect_textbox_lines_field;
QVector<QAction*> key_shortcut_actions;
QVector<QTreeWidgetItem*> key_shortcut_items;
+12 -7
View File
@@ -46,7 +46,8 @@ Config::Config()
upcoming_queue_type(FRAME_QUEUE_TYPE_SECONDS),
loop(true),
pause_at_out_point(true),
seek_also_selects(false)
seek_also_selects(false),
effect_textbox_lines(3)
{}
void Config::load(QString path) {
@@ -162,10 +163,13 @@ void Config::load(QString path) {
} else if (stream.name() == "SeekAlsoSelects") {
stream.readNext();
seek_also_selects = (stream.text() == "1");
} else if (stream.name() == "CSSPath") {
stream.readNext();
css_path = stream.text().toString();
}
} else if (stream.name() == "CSSPath") {
stream.readNext();
css_path = stream.text().toString();
} else if (stream.name() == "EffectTextboxLines") {
stream.readNext();
effect_textbox_lines = stream.text().toInt();
}
}
}
if (stream.hasError()) {
@@ -223,8 +227,9 @@ void Config::save(QString path) {
stream.writeTextElement("UpcomingFrameQueueType", QString::number(upcoming_queue_type));
stream.writeTextElement("Loop", QString::number(loop));
stream.writeTextElement("PauseAtOutPoint", QString::number(pause_at_out_point));
stream.writeTextElement("SeekAlsoSelects", QString::number(seek_also_selects));
stream.writeTextElement("CSSPath", css_path);
stream.writeTextElement("SeekAlsoSelects", QString::number(seek_also_selects));
stream.writeTextElement("CSSPath", css_path);
stream.writeTextElement("EffectTextboxLines", QString::number(effect_textbox_lines));
stream.writeEndElement(); // configuration
stream.writeEndDocument(); // doc
+5 -4
View File
@@ -58,10 +58,11 @@ struct Config {
int previous_queue_type;
double upcoming_queue_size;
int upcoming_queue_type;
bool loop;
bool pause_at_out_point;
bool seek_also_selects;
QString css_path;
bool loop;
bool pause_at_out_point;
bool seek_also_selects;
QString css_path;
int effect_textbox_lines;
void load(QString path);
void save(QString path);
+3
View File
@@ -8,6 +8,8 @@
#include "ui/fontcombobox.h"
#include "ui/embeddedfilechooser.h"
#include "io/config.h"
#include "effectrow.h"
#include "effect.h"
@@ -44,6 +46,7 @@ EffectField::EffectField(EffectRow *parent, int t, const QString &i) :
case EFFECT_FIELD_STRING:
{
TextEditEx* edit = new TextEditEx();
edit->setFixedHeight(edit->fontMetrics().lineSpacing()*config.effect_textbox_lines);
edit->setUndoRedoEnabled(true);
ui_element = edit;
connect(edit, SIGNAL(textChanged()), this, SLOT(ui_element_change()));