1 /* 2 * Copyright (C) 2014-2018 Christopho, Solarus - http://www.solarus-games.org 3 * 4 * Solarus Quest Editor is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation, either version 3 of the License, or 7 * (at your option) any later version. 8 * 9 * Solarus Quest Editor is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License along 15 * with this program. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 #ifndef SOLARUSEDITOR_DIALOGS_EDITOR_H 18 #define SOLARUSEDITOR_DIALOGS_EDITOR_H 19 20 #include "widgets/editor.h" 21 #include "ui_dialogs_editor.h" 22 23 namespace SolarusEditor { 24 25 class DialogsModel; 26 27 /** 28 * \brief A widget to edit graphically a dialogs file. 29 */ 30 class DialogsEditor : public Editor { 31 Q_OBJECT 32 33 public: 34 35 DialogsEditor( 36 Quest& quest, const QString& language_id, QWidget* parent = nullptr); 37 ~DialogsEditor(); 38 39 DialogsModel& get_model(); 40 41 void set_selected_property(const QString &key); 42 43 virtual void save() override; 44 45 public slots: 46 47 void update(); 48 49 void update_language_id_field(); 50 51 void update_description_to_gui(); 52 void set_description_from_gui(); 53 54 void update_selection(); 55 56 void create_dialog_requested(); 57 void duplicate_requested(); 58 void change_dialog_id_requested(); 59 void delete_dialog_requested(); 60 61 void update_dialog_view(); 62 void update_dialog_id_field(); 63 void update_dialog_text_field(); 64 void change_dialog_text_requested(); 65 void update_translation_text_field(); 66 void update_dialog_cursor_position_label(); 67 68 void update_properties_buttons(); 69 70 void create_dialog_property_requested(); 71 void delete_dialog_property_requested(); 72 void change_dialog_property_key_requested(); 73 void change_dialog_property_value_requested( 74 const QString &key, const QString &value); 75 void set_dialog_property_from_translation_requested(); 76 77 void translation_selector_activated(); 78 void translation_refresh_requested(); 79 80 void update_display_margin(); 81 82 private: 83 84 Ui::DialogsEditor ui; /**< The dialogs editor widgets. */ 85 QString language_id; /**< Id of the language of dialogs being edited. */ 86 DialogsModel* model; /**< Dialogs model being edited. */ 87 Quest& quest; /**< The quest. */ 88 89 }; 90 91 } 92 93 #endif 94