Rename ImportSettings dialogs to have "Dialog" in the name

This commit is contained in:
Aaron Franke 2023-10-06 02:00:36 -05:00
parent 5df9867967
commit a8dc34b8f0
No known key found for this signature in database
GPG key ID: 40A1750B977E56BF
13 changed files with 178 additions and 178 deletions

View file

@ -35,13 +35,13 @@
#include "editor/editor_string_names.h"
#include "scene/gui/check_box.h"
AudioStreamImportSettings *AudioStreamImportSettings::singleton = nullptr;
AudioStreamImportSettingsDialog *AudioStreamImportSettingsDialog::singleton = nullptr;
void AudioStreamImportSettings::_notification(int p_what) {
void AudioStreamImportSettingsDialog::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_READY: {
AudioStreamPreviewGenerator::get_singleton()->connect("preview_updated", callable_mp(this, &AudioStreamImportSettings::_preview_changed));
connect("confirmed", callable_mp(this, &AudioStreamImportSettings::_reimport));
AudioStreamPreviewGenerator::get_singleton()->connect("preview_updated", callable_mp(this, &AudioStreamImportSettingsDialog::_preview_changed));
connect("confirmed", callable_mp(this, &AudioStreamImportSettingsDialog::_reimport));
} break;
case NOTIFICATION_THEME_CHANGED: {
@ -82,7 +82,7 @@ void AudioStreamImportSettings::_notification(int p_what) {
}
}
void AudioStreamImportSettings::_draw_preview() {
void AudioStreamImportSettingsDialog::_draw_preview() {
Rect2 rect = _preview->get_rect();
Size2 rect_size = rect.size;
int width = rect_size.width;
@ -173,13 +173,13 @@ void AudioStreamImportSettings::_draw_preview() {
}
}
void AudioStreamImportSettings::_preview_changed(ObjectID p_which) {
void AudioStreamImportSettingsDialog::_preview_changed(ObjectID p_which) {
if (stream.is_valid() && stream->get_instance_id() == p_which) {
_preview->queue_redraw();
}
}
void AudioStreamImportSettings::_preview_zoom_in() {
void AudioStreamImportSettingsDialog::_preview_zoom_in() {
if (!stream.is_valid()) {
return;
}
@ -191,7 +191,7 @@ void AudioStreamImportSettings::_preview_zoom_in() {
_indicator->queue_redraw();
}
void AudioStreamImportSettings::_preview_zoom_out() {
void AudioStreamImportSettingsDialog::_preview_zoom_out() {
if (!stream.is_valid()) {
return;
}
@ -203,7 +203,7 @@ void AudioStreamImportSettings::_preview_zoom_out() {
_indicator->queue_redraw();
}
void AudioStreamImportSettings::_preview_zoom_reset() {
void AudioStreamImportSettingsDialog::_preview_zoom_reset() {
if (!stream.is_valid()) {
return;
}
@ -214,12 +214,12 @@ void AudioStreamImportSettings::_preview_zoom_reset() {
_indicator->queue_redraw();
}
void AudioStreamImportSettings::_preview_zoom_offset_changed(double) {
void AudioStreamImportSettingsDialog::_preview_zoom_offset_changed(double) {
_preview->queue_redraw();
_indicator->queue_redraw();
}
void AudioStreamImportSettings::_audio_changed() {
void AudioStreamImportSettingsDialog::_audio_changed() {
if (!is_visible()) {
return;
}
@ -228,7 +228,7 @@ void AudioStreamImportSettings::_audio_changed() {
color_rect->queue_redraw();
}
void AudioStreamImportSettings::_play() {
void AudioStreamImportSettingsDialog::_play() {
if (_player->is_playing()) {
// '_pausing' variable indicates that we want to pause the audio player, not stop it. See '_on_finished()'.
_pausing = true;
@ -242,7 +242,7 @@ void AudioStreamImportSettings::_play() {
}
}
void AudioStreamImportSettings::_stop() {
void AudioStreamImportSettingsDialog::_stop() {
_player->stop();
_play_button->set_icon(get_editor_theme_icon(SNAME("MainPlay")));
_current = 0;
@ -250,7 +250,7 @@ void AudioStreamImportSettings::_stop() {
set_process(false);
}
void AudioStreamImportSettings::_on_finished() {
void AudioStreamImportSettingsDialog::_on_finished() {
_play_button->set_icon(get_editor_theme_icon(SNAME("MainPlay")));
if (!_pausing) {
_current = 0;
@ -261,7 +261,7 @@ void AudioStreamImportSettings::_on_finished() {
set_process(false);
}
void AudioStreamImportSettings::_draw_indicator() {
void AudioStreamImportSettingsDialog::_draw_indicator() {
if (!stream.is_valid()) {
return;
}
@ -314,12 +314,12 @@ void AudioStreamImportSettings::_draw_indicator() {
_current_label->set_text(String::num(_current, 2).pad_decimals(2) + " /");
}
void AudioStreamImportSettings::_on_indicator_mouse_exited() {
void AudioStreamImportSettingsDialog::_on_indicator_mouse_exited() {
_hovering_beat = -1;
_indicator->queue_redraw();
}
void AudioStreamImportSettings::_on_input_indicator(Ref<InputEvent> p_event) {
void AudioStreamImportSettingsDialog::_on_input_indicator(Ref<InputEvent> p_event) {
const Ref<InputEventMouseButton> mb = p_event;
if (mb.is_valid() && mb->get_button_index() == MouseButton::LEFT) {
if (stream->get_bpm() > 0) {
@ -369,7 +369,7 @@ void AudioStreamImportSettings::_on_input_indicator(Ref<InputEvent> p_event) {
}
}
int AudioStreamImportSettings::_get_beat_at_pos(real_t p_x) {
int AudioStreamImportSettingsDialog::_get_beat_at_pos(real_t p_x) {
float ofs_sec = zoom_bar->get_value() + p_x * zoom_bar->get_page() / _preview->get_size().width;
ofs_sec = CLAMP(ofs_sec, 0, stream->get_length());
float beat_size = 60 / float(stream->get_bpm());
@ -381,7 +381,7 @@ int AudioStreamImportSettings::_get_beat_at_pos(real_t p_x) {
return beat;
}
void AudioStreamImportSettings::_set_beat_len_to(real_t p_x) {
void AudioStreamImportSettingsDialog::_set_beat_len_to(real_t p_x) {
int beat = _get_beat_at_pos(p_x);
if (beat < 1) {
beat = 1; // Because 0 is disable.
@ -393,16 +393,16 @@ void AudioStreamImportSettings::_set_beat_len_to(real_t p_x) {
_settings_changed();
}
void AudioStreamImportSettings::_seek_to(real_t p_x) {
void AudioStreamImportSettingsDialog::_seek_to(real_t p_x) {
_current = zoom_bar->get_value() + p_x / _preview->get_rect().size.x * zoom_bar->get_page();
_current = CLAMP(_current, 0, stream->get_length());
_player->seek(_current);
_indicator->queue_redraw();
}
void AudioStreamImportSettings::edit(const String &p_path, const String &p_importer, const Ref<AudioStream> &p_stream) {
void AudioStreamImportSettingsDialog::edit(const String &p_path, const String &p_importer, const Ref<AudioStream> &p_stream) {
if (!stream.is_null()) {
stream->disconnect_changed(callable_mp(this, &AudioStreamImportSettings::_audio_changed));
stream->disconnect_changed(callable_mp(this, &AudioStreamImportSettingsDialog::_audio_changed));
}
importer = p_importer;
@ -415,7 +415,7 @@ void AudioStreamImportSettings::edit(const String &p_path, const String &p_impor
_duration_label->set_text(text);
if (!stream.is_null()) {
stream->connect_changed(callable_mp(this, &AudioStreamImportSettings::_audio_changed));
stream->connect_changed(callable_mp(this, &AudioStreamImportSettingsDialog::_audio_changed));
_preview->queue_redraw();
_indicator->queue_redraw();
color_rect->queue_redraw();
@ -464,7 +464,7 @@ void AudioStreamImportSettings::edit(const String &p_path, const String &p_impor
}
}
void AudioStreamImportSettings::_settings_changed() {
void AudioStreamImportSettingsDialog::_settings_changed() {
if (updating_settings) {
return;
}
@ -515,7 +515,7 @@ void AudioStreamImportSettings::_settings_changed() {
color_rect->queue_redraw();
}
void AudioStreamImportSettings::_reimport() {
void AudioStreamImportSettingsDialog::_reimport() {
params["loop"] = loop->is_pressed();
params["loop_offset"] = loop_offset->get_value();
params["bpm"] = bpm_enabled->is_pressed() ? double(bpm_edit->get_value()) : double(0);
@ -525,7 +525,7 @@ void AudioStreamImportSettings::_reimport() {
EditorFileSystem::get_singleton()->reimport_file_with_custom_parameters(path, importer, params);
}
AudioStreamImportSettings::AudioStreamImportSettings() {
AudioStreamImportSettingsDialog::AudioStreamImportSettingsDialog() {
get_ok_button()->set_text(TTR("Reimport"));
get_cancel_button()->set_text(TTR("Close"));
@ -537,7 +537,7 @@ AudioStreamImportSettings::AudioStreamImportSettings() {
loop = memnew(CheckBox);
loop->set_text(TTR("Enable"));
loop->set_tooltip_text(TTR("Enable looping."));
loop->connect("toggled", callable_mp(this, &AudioStreamImportSettings::_settings_changed).unbind(1));
loop->connect("toggled", callable_mp(this, &AudioStreamImportSettingsDialog::_settings_changed).unbind(1));
loop_hb->add_child(loop);
loop_hb->add_spacer();
loop_hb->add_child(memnew(Label(TTR("Offset:"))));
@ -546,7 +546,7 @@ AudioStreamImportSettings::AudioStreamImportSettings() {
loop_offset->set_step(0.001);
loop_offset->set_suffix("sec");
loop_offset->set_tooltip_text(TTR("Loop offset (from beginning). Note that if BPM is set, this setting will be ignored."));
loop_offset->connect("value_changed", callable_mp(this, &AudioStreamImportSettings::_settings_changed).unbind(1));
loop_offset->connect("value_changed", callable_mp(this, &AudioStreamImportSettingsDialog::_settings_changed).unbind(1));
loop_hb->add_child(loop_offset);
main_vbox->add_margin_child(TTR("Loop:"), loop_hb);
@ -554,23 +554,23 @@ AudioStreamImportSettings::AudioStreamImportSettings() {
interactive_hb->add_theme_constant_override("separation", 4 * EDSCALE);
bpm_enabled = memnew(CheckBox);
bpm_enabled->set_text((TTR("BPM:")));
bpm_enabled->connect("toggled", callable_mp(this, &AudioStreamImportSettings::_settings_changed).unbind(1));
bpm_enabled->connect("toggled", callable_mp(this, &AudioStreamImportSettingsDialog::_settings_changed).unbind(1));
interactive_hb->add_child(bpm_enabled);
bpm_edit = memnew(SpinBox);
bpm_edit->set_max(400);
bpm_edit->set_step(0.01);
bpm_edit->set_tooltip_text(TTR("Configure the Beats Per Measure (tempo) used for the interactive streams.\nThis is required in order to configure beat information."));
bpm_edit->connect("value_changed", callable_mp(this, &AudioStreamImportSettings::_settings_changed).unbind(1));
bpm_edit->connect("value_changed", callable_mp(this, &AudioStreamImportSettingsDialog::_settings_changed).unbind(1));
interactive_hb->add_child(bpm_edit);
interactive_hb->add_spacer();
beats_enabled = memnew(CheckBox);
beats_enabled->set_text(TTR("Beat Count:"));
beats_enabled->connect("toggled", callable_mp(this, &AudioStreamImportSettings::_settings_changed).unbind(1));
beats_enabled->connect("toggled", callable_mp(this, &AudioStreamImportSettingsDialog::_settings_changed).unbind(1));
interactive_hb->add_child(beats_enabled);
beats_edit = memnew(SpinBox);
beats_edit->set_tooltip_text(TTR("Configure the amount of Beats used for music-aware looping. If zero, it will be autodetected from the length.\nIt is recommended to set this value (either manually or by clicking on a beat number in the preview) to ensure looping works properly."));
beats_edit->set_max(99999);
beats_edit->connect("value_changed", callable_mp(this, &AudioStreamImportSettings::_settings_changed).unbind(1));
beats_edit->connect("value_changed", callable_mp(this, &AudioStreamImportSettingsDialog::_settings_changed).unbind(1));
interactive_hb->add_child(beats_edit);
bar_beats_label = memnew(Label(TTR("Bar Beats:")));
interactive_hb->add_child(bar_beats_label);
@ -578,7 +578,7 @@ AudioStreamImportSettings::AudioStreamImportSettings() {
bar_beats_edit->set_tooltip_text(TTR("Configure the Beats Per Bar. This used for music-aware transitions between AudioStreams."));
bar_beats_edit->set_min(2);
bar_beats_edit->set_max(32);
bar_beats_edit->connect("value_changed", callable_mp(this, &AudioStreamImportSettings::_settings_changed).unbind(1));
bar_beats_edit->connect("value_changed", callable_mp(this, &AudioStreamImportSettingsDialog::_settings_changed).unbind(1));
interactive_hb->add_child(bar_beats_edit);
interactive_hb->add_spacer();
main_vbox->add_margin_child(TTR("Music Playback:"), interactive_hb);
@ -590,7 +590,7 @@ AudioStreamImportSettings::AudioStreamImportSettings() {
color_rect->set_v_size_flags(Control::SIZE_EXPAND_FILL);
_player = memnew(AudioStreamPlayer);
_player->connect("finished", callable_mp(this, &AudioStreamImportSettings::_on_finished));
_player->connect("finished", callable_mp(this, &AudioStreamImportSettingsDialog::_on_finished));
color_rect->add_child(_player);
VBoxContainer *vbox = memnew(VBoxContainer);
@ -600,7 +600,7 @@ AudioStreamImportSettings::AudioStreamImportSettings() {
_preview = memnew(ColorRect);
_preview->set_v_size_flags(Control::SIZE_EXPAND_FILL);
_preview->connect("draw", callable_mp(this, &AudioStreamImportSettings::_draw_preview));
_preview->connect("draw", callable_mp(this, &AudioStreamImportSettingsDialog::_draw_preview));
_preview->set_v_size_flags(Control::SIZE_EXPAND_FILL);
vbox->add_child(_preview);
@ -618,17 +618,17 @@ AudioStreamImportSettings::AudioStreamImportSettings() {
zoom_hbox->add_child(zoom_out);
zoom_hbox->add_child(zoom_reset);
zoom_hbox->add_child(zoom_in);
zoom_in->connect("pressed", callable_mp(this, &AudioStreamImportSettings::_preview_zoom_in));
zoom_reset->connect("pressed", callable_mp(this, &AudioStreamImportSettings::_preview_zoom_reset));
zoom_out->connect("pressed", callable_mp(this, &AudioStreamImportSettings::_preview_zoom_out));
zoom_bar->connect("value_changed", callable_mp(this, &AudioStreamImportSettings::_preview_zoom_offset_changed));
zoom_in->connect("pressed", callable_mp(this, &AudioStreamImportSettingsDialog::_preview_zoom_in));
zoom_reset->connect("pressed", callable_mp(this, &AudioStreamImportSettingsDialog::_preview_zoom_reset));
zoom_out->connect("pressed", callable_mp(this, &AudioStreamImportSettingsDialog::_preview_zoom_out));
zoom_bar->connect("value_changed", callable_mp(this, &AudioStreamImportSettingsDialog::_preview_zoom_offset_changed));
vbox->add_child(zoom_hbox);
_indicator = memnew(Control);
_indicator->set_anchors_and_offsets_preset(Control::PRESET_FULL_RECT);
_indicator->connect("draw", callable_mp(this, &AudioStreamImportSettings::_draw_indicator));
_indicator->connect("gui_input", callable_mp(this, &AudioStreamImportSettings::_on_input_indicator));
_indicator->connect("mouse_exited", callable_mp(this, &AudioStreamImportSettings::_on_indicator_mouse_exited));
_indicator->connect("draw", callable_mp(this, &AudioStreamImportSettingsDialog::_draw_indicator));
_indicator->connect("gui_input", callable_mp(this, &AudioStreamImportSettingsDialog::_on_input_indicator));
_indicator->connect("mouse_exited", callable_mp(this, &AudioStreamImportSettingsDialog::_on_indicator_mouse_exited));
_preview->add_child(_indicator);
HBoxContainer *hbox = memnew(HBoxContainer);
@ -639,13 +639,13 @@ AudioStreamImportSettings::AudioStreamImportSettings() {
_play_button->set_flat(true);
hbox->add_child(_play_button);
_play_button->set_focus_mode(Control::FOCUS_NONE);
_play_button->connect("pressed", callable_mp(this, &AudioStreamImportSettings::_play));
_play_button->connect("pressed", callable_mp(this, &AudioStreamImportSettingsDialog::_play));
_stop_button = memnew(Button);
_stop_button->set_flat(true);
hbox->add_child(_stop_button);
_stop_button->set_focus_mode(Control::FOCUS_NONE);
_stop_button->connect("pressed", callable_mp(this, &AudioStreamImportSettings::_stop));
_stop_button->connect("pressed", callable_mp(this, &AudioStreamImportSettingsDialog::_stop));
_current_label = memnew(Label);
_current_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_RIGHT);