/**************************************************************************/1/* run_instances_dialog.h */2/**************************************************************************/3/* This file is part of: */4/* GODOT ENGINE */5/* https://godotengine.org */6/**************************************************************************/7/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */8/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */9/* */10/* Permission is hereby granted, free of charge, to any person obtaining */11/* a copy of this software and associated documentation files (the */12/* "Software"), to deal in the Software without restriction, including */13/* without limitation the rights to use, copy, modify, merge, publish, */14/* distribute, sublicense, and/or sell copies of the Software, and to */15/* permit persons to whom the Software is furnished to do so, subject to */16/* the following conditions: */17/* */18/* The above copyright notice and this permission notice shall be */19/* included in all copies or substantial portions of the Software. */20/* */21/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */22/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */23/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */24/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */25/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */26/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */27/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */28/**************************************************************************/2930#pragma once3132#include "scene/gui/dialogs.h"3334class CheckBox;35class LineEdit;36class SpinBox;37class Timer;38class Tree;39class TreeItem;40class PopupMenu;4142class RunInstancesDialog : public AcceptDialog {43GDCLASS(RunInstancesDialog, AcceptDialog);4445enum Columns {46COLUMN_OVERRIDE_ARGS,47COLUMN_LAUNCH_ARGUMENTS,48COLUMN_OVERRIDE_FEATURES,49COLUMN_FEATURE_TAGS,50};5152struct InstanceData {53TreeItem *item = nullptr;5455bool overrides_run_args() const;56String get_launch_arguments() const;57bool overrides_features() const;58String get_feature_tags() const;59};6061// Right-click popup menu.62enum {63CLEAR_ITEM,64CLEAR_ALL,65};6667inline static RunInstancesDialog *singleton = nullptr;6869TypedArray<Dictionary> stored_data;70Vector<InstanceData> instances_data;7172Timer *main_apply_timer = nullptr;73Timer *instance_apply_timer = nullptr;7475LineEdit *main_args_edit = nullptr;76LineEdit *main_features_edit = nullptr;77SpinBox *instance_count = nullptr;78CheckBox *enable_multiple_instances_checkbox = nullptr;79Tree *instance_tree = nullptr;80PopupMenu *popup_menu = nullptr;8182void _fetch_main_args();83// These 2 methods are necessary due to callable_mp() not supporting default arguments.84void _start_main_timer();85void _start_instance_timer();8687void _refresh_argument_count();88void _create_instance(InstanceData &p_instance, const Dictionary &p_data, int p_idx);89void _save_main_args();90void _save_arguments();91// Separates command line arguments without splitting up quoted strings.92Vector<String> _split_cmdline_args(const String &p_arg_string) const;93void _instance_menu_id_pressed(int p_option);94void _instance_tree_rmb(const Vector2 &p_pos, MouseButton p_button);9596public:97void popup_dialog();98int get_instance_count() const;99void get_argument_list_for_instance(int p_idx, List<String> &r_list) const;100void apply_custom_features(int p_instance_idx);101102static RunInstancesDialog *get_singleton() { return singleton; }103RunInstancesDialog();104};105106107