preferences dialog update

This commit is contained in:
itsmattkc
2019-02-11 02:29:22 -08:00
parent cee7c197ae
commit 679d7b752b
13 changed files with 2202 additions and 1906 deletions
+69 -55
View File
@@ -89,7 +89,40 @@ void PreferencesDialog::setup_kbd_shortcut_worker(QMenu* menu, QTreeWidgetItem*
key_shortcut_actions.append(a);
}
}
}
}
}
void PreferencesDialog::delete_previews(char type) {
if (type != 't' && type != 'w' && type != 1) return;
QDir preview_path(get_data_path() + "/previews");
if (type == 1) {
// indiscriminately delete everything
preview_path.removeRecursively();
} else {
QStringList preview_file_list = preview_path.entryList(QDir::Files | QDir::NoDotAndDotDot);
for (int i=0;i<preview_file_list.size();i++) {
const QString& preview_file_str = preview_file_list.at(i);
// use filename to determine whether this is a thumbnail or a waveform
int identifier_char_index = qMax(0, preview_file_str.size()-2);
// find identifier char
while (identifier_char_index >= 0
&& preview_file_str.at(identifier_char_index) >= 48
&& preview_file_str.at(identifier_char_index) <= 57) {
identifier_char_index--;
}
// thumbnails will have a 't' towards the end of the filenames, waveforms will have a 'w'
// if they match the type of preview we're deleting, remove them
if (preview_file_str.at(identifier_char_index) == type) {
QFile::remove(preview_path.filePath(preview_file_str));
}
}
}
}
void PreferencesDialog::setup_kbd_shortcuts(QMenuBar* menubar) {
@@ -131,8 +164,7 @@ void PreferencesDialog::save() {
mainWindow->load_css_from_file(config.css_path);
config.recording_mode = recordingComboBox->currentIndex() + 1;
config.img_seq_formats = imgSeqFormatEdit->text();
config.fast_seeking = fastSeekButton->isChecked();
config.disable_multithreading_for_images = disable_img_multithread->isChecked();
config.fast_seeking = fastSeekButton->isChecked();
config.upcoming_queue_size = upcoming_queue_spinbox->value();
config.upcoming_queue_type = upcoming_queue_type->currentIndex();
config.previous_queue_size = previous_queue_spinbox->value();
@@ -195,36 +227,7 @@ void PreferencesDialog::save() {
}
}
if (delete_match != 0) {
QDir preview_path(get_data_path() + "/previews");
if (delete_match == 1) {
// indiscriminately delete everything
preview_path.removeRecursively();
} else {
QStringList preview_file_list = preview_path.entryList(QDir::Files | QDir::NoDotAndDotDot);
for (int i=0;i<preview_file_list.size();i++) {
const QString& preview_file_str = preview_file_list.at(i);
// use filename to determine whether this is a thumbnail or a waveform
int identifier_char_index = qMax(0, preview_file_str.size()-2);
// find identifier char
while (identifier_char_index >= 0
&& preview_file_str.at(identifier_char_index) >= 48
&& preview_file_str.at(identifier_char_index) <= 57) {
identifier_char_index--;
}
// thumbnails will have a 't' towards the end of the filenames, waveforms will have a 'w'
// if they match the type of preview we're deleting, remove them
if (preview_file_str.at(identifier_char_index) == delete_match) {
QFile::remove(preview_path.filePath(preview_file_str));
}
}
}
}
delete_previews(delete_match);
}
// save keyboard shortcuts
@@ -362,7 +365,20 @@ void PreferencesDialog::browse_css_file() {
QString fn = QFileDialog::getOpenFileName(this, tr("Browse for CSS file"));
if (!fn.isEmpty()) {
custom_css_fn->setText(fn);
}
}
}
void PreferencesDialog::delete_all_previews() {
if (QMessageBox::question(this,
tr("Delete All Previews"),
tr("Are you sure you want to delete all previews?"),
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
delete_previews(1);
QMessageBox::information(this,
tr("Previews Deleted"),
tr("All previews deleted succesfully. You may have to re-open your current project for changes to take effect."),
QMessageBox::Ok);
}
}
void PreferencesDialog::setup_ui() {
@@ -377,7 +393,7 @@ void PreferencesDialog::setup_ui() {
QGridLayout* general_layout = new QGridLayout(general_tab);
// General -> Language
general_layout->addWidget(new QLabel(tr("Language:")), row, 0, 1, 1);
general_layout->addWidget(new QLabel(tr("Language:")), row, 0);
language_combobox = new QComboBox();
@@ -409,69 +425,72 @@ void PreferencesDialog::setup_ui() {
}
}
general_layout->addWidget(language_combobox, row, 1, 1, 3);
general_layout->addWidget(language_combobox, row, 1, 1, 4);
row++;
// General -> Custom CSS
general_layout->addWidget(new QLabel(tr("Custom CSS:"), this), row, 0, 1, 1);
general_layout->addWidget(new QLabel(tr("Custom CSS:"), this), row, 0);
custom_css_fn = new QLineEdit(general_tab);
custom_css_fn->setText(config.css_path);
general_layout->addWidget(custom_css_fn, row, 1, 1, 2);
general_layout->addWidget(custom_css_fn, row, 1, 1, 3);
QPushButton* custom_css_browse = new QPushButton(tr("Browse"), general_tab);
connect(custom_css_browse, SIGNAL(clicked(bool)), this, SLOT(browse_css_file()));
general_layout->addWidget(custom_css_browse, row, 3, 1, 1);
general_layout->addWidget(custom_css_browse, row, 4);
row++;
// General -> Image Sequence Formats
general_layout->addWidget(new QLabel(tr("Image sequence formats:"), this), row, 0, 1, 1);
general_layout->addWidget(new QLabel(tr("Image sequence formats:"), this), row, 0);
imgSeqFormatEdit = new QLineEdit(general_tab);
general_layout->addWidget(imgSeqFormatEdit, row, 1, 1, 3);
general_layout->addWidget(imgSeqFormatEdit, row, 1, 1, 4);
row++;
// General -> Audio Recording
general_layout->addWidget(new QLabel(tr("Audio Recording:"), this), row, 0, 1, 1);
general_layout->addWidget(new QLabel(tr("Audio Recording:"), this), row, 0);
recordingComboBox = new QComboBox(general_tab);
recordingComboBox->addItem(tr("Mono"));
recordingComboBox->addItem(tr("Stereo"));
general_layout->addWidget(recordingComboBox, row, 1, 1, 3);
general_layout->addWidget(recordingComboBox, row, 1, 1, 4);
row++;
// General -> Effect Textbox Lines
general_layout->addWidget(new QLabel(tr("Effect Textbox Lines:"), this), row, 0, 1, 1);
general_layout->addWidget(new QLabel(tr("Effect Textbox Lines:"), this), row, 0);
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, row, 1, 1, 3);
general_layout->addWidget(effect_textbox_lines_field, row, 1, 1, 4);
row++;
// General -> Thumbnail and Waveform Resolution
general_layout->addWidget(new QLabel(tr("Thumbnail Resolution:"), this), row, 0, 1, 1);
general_layout->addWidget(new QLabel(tr("Thumbnail Resolution:"), this), row, 0);
thumbnail_res_spinbox = new QSpinBox(this);
thumbnail_res_spinbox->setMinimum(0);
thumbnail_res_spinbox->setMaximum(INT_MAX);
thumbnail_res_spinbox->setValue(config.thumbnail_resolution);
general_layout->addWidget(thumbnail_res_spinbox, row, 1, 1, 1);
general_layout->addWidget(thumbnail_res_spinbox, row, 1);
general_layout->addWidget(new QLabel(tr("Waveform Resolution:"), this), row, 2, 1, 1);
general_layout->addWidget(new QLabel(tr("Waveform Resolution:"), this), row, 2);
waveform_res_spinbox = new QSpinBox(this);
waveform_res_spinbox->setMinimum(0);
waveform_res_spinbox->setMaximum(INT_MAX);
waveform_res_spinbox->setValue(config.waveform_resolution);
general_layout->addWidget(waveform_res_spinbox, row, 3, 1, 1);
general_layout->addWidget(waveform_res_spinbox, row, 3);
QPushButton* delete_preview_btn = new QPushButton(tr("Delete Previews"));
general_layout->addWidget(delete_preview_btn, row, 4);
connect(delete_preview_btn, SIGNAL(clicked(bool)), this, SLOT(delete_all_previews()));
row++;
@@ -489,12 +508,7 @@ void PreferencesDialog::setup_ui() {
// Playback
QWidget* playback_tab = new QWidget(this);
QVBoxLayout* playback_tab_layout = new QVBoxLayout(playback_tab);
// Playback -> Disable Multithreading on Images
disable_img_multithread = new QCheckBox(tr("Disable Multithreading on Images"), playback_tab);
disable_img_multithread->setChecked(config.disable_multithreading_for_images);
playback_tab_layout->addWidget(disable_img_multithread);
QVBoxLayout* playback_tab_layout = new QVBoxLayout(playback_tab);
// Playback -> Seeking
QGroupBox* seeking_group = new QGroupBox(playback_tab);
+6 -2
View File
@@ -44,18 +44,22 @@ private slots:
void load_shortcut_file();
void save_shortcut_file();
void browse_css_file();
void delete_all_previews();
private:
void setup_ui();
void setup_kbd_shortcut_worker(QMenu* menu, QTreeWidgetItem* parent);
// used to delete previews
// type can be: 't' for thumbnails, 'w' for waveforms, or 1 for all
void delete_previews(char type);
QLineEdit* custom_css_fn;
QLineEdit* imgSeqFormatEdit;
QComboBox* recordingComboBox;
QRadioButton* accurateSeekButton;
QRadioButton* fastSeekButton;
QTreeWidget* keyboard_tree;
QCheckBox* disable_img_multithread;
QTreeWidget* keyboard_tree;
QDoubleSpinBox* upcoming_queue_spinbox;
QComboBox* upcoming_queue_type;
QDoubleSpinBox* previous_queue_spinbox;
+3 -8
View File
@@ -39,8 +39,7 @@ Config::Config()
hover_focus(false),
project_view_type(PROJECT_VIEW_TREE),
set_name_with_marker(true),
show_project_toolbar(false),
disable_multithreading_for_images(false),
show_project_toolbar(false),
previous_queue_size(3),
previous_queue_type(FRAME_QUEUE_TYPE_FRAMES),
upcoming_queue_size(0.5),
@@ -142,10 +141,7 @@ void Config::load(QString path) {
set_name_with_marker = (stream.text() == "1");
} else if (stream.name() == "ShowProjectToolbar") {
stream.readNext();
show_project_toolbar = (stream.text() == "1");
} else if (stream.name() == "DisableMultithreadedImages") {
stream.readNext();
disable_multithreading_for_images = (stream.text() == "1");
show_project_toolbar = (stream.text() == "1");
} else if (stream.name() == "PreviousFrameQueueSize") {
stream.readNext();
previous_queue_size = stream.text().toDouble();
@@ -241,8 +237,7 @@ void Config::save(QString path) {
stream.writeTextElement("HoverFocus", QString::number(hover_focus));
stream.writeTextElement("ProjectViewType", QString::number(project_view_type));
stream.writeTextElement("SetNameWithMarker", QString::number(set_name_with_marker));
stream.writeTextElement("ShowProjectToolbar", QString::number(panel_project->toolbar_widget->isVisible()));
stream.writeTextElement("DisableMultithreadedImages", QString::number(disable_multithreading_for_images));
stream.writeTextElement("ShowProjectToolbar", QString::number(panel_project->toolbar_widget->isVisible()));
stream.writeTextElement("PreviousFrameQueueSize", QString::number(previous_queue_size));
stream.writeTextElement("PreviousFrameQueueType", QString::number(previous_queue_type));
stream.writeTextElement("UpcomingFrameQueueSize", QString::number(upcoming_queue_size));
+1 -2
View File
@@ -53,8 +53,7 @@ struct Config {
bool hover_focus;
int project_view_type;
bool set_name_with_marker;
bool show_project_toolbar;
bool disable_multithreading_for_images;
bool show_project_toolbar;
double previous_queue_size;
int previous_queue_type;
double upcoming_queue_size;
+1 -5
View File
@@ -80,11 +80,7 @@ int main(int argc, char *argv[]) {
if (use_internal_logger) {
qInstallMessageHandler(debug_message_handler);
}
// init ffmpeg subsystem
av_register_all();
avfilter_register_all();
}
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
+4 -8
View File
@@ -737,14 +737,10 @@ void open_clip_worker(Clip* clip) {
clip->opts = nullptr;
// optimized decoding settings
if ((clip->stream->codecpar->codec_id != AV_CODEC_ID_PNG &&
clip->stream->codecpar->codec_id != AV_CODEC_ID_APNG &&
clip->stream->codecpar->codec_id != AV_CODEC_ID_TIFF &&
clip->stream->codecpar->codec_id != AV_CODEC_ID_PSD)
|| !config.disable_multithreading_for_images) {
av_dict_set(&clip->opts, "threads", "auto", 0);
}
// enable multithreading on decoding
av_dict_set(&clip->opts, "threads", "auto", 0);
// enable extra optimization code on h264 (not even sure if they help)
if (clip->stream->codecpar->codec_id == AV_CODEC_ID_H264) {
av_dict_set(&clip->opts, "tune", "fastdecode", 0);
av_dict_set(&clip->opts, "tune", "zerolatency", 0);
+310 -260
View File
File diff suppressed because it is too large Load Diff
+307 -260
View File
File diff suppressed because it is too large Load Diff
+306 -260
View File
File diff suppressed because it is too large Load Diff
+296 -262
View File
File diff suppressed because it is too large Load Diff
+296 -262
View File
File diff suppressed because it is too large Load Diff
+296 -262
View File
File diff suppressed because it is too large Load Diff
+307 -260
View File
File diff suppressed because it is too large Load Diff