本文整理汇总了C++中Quest::get_dialogs_path方法的典型用法代码示例。如果您正苦于以下问题:C++ Quest::get_dialogs_path方法的具体用法?C++ Quest::get_dialogs_path怎么用?C++ Quest::get_dialogs_path使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Quest
的用法示例。
在下文中一共展示了Quest::get_dialogs_path方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: open_dialogs_editor
/**
* @brief Opens a file with a language dialogs editor in a new tab.
* @param quest A Solarus quest.
* @param path Path of the dialogs file to open.
*/
void EditorTabs::open_dialogs_editor(Quest& quest, const QString& language_id) {
// Get the strings file path.
QString path = quest.get_dialogs_path(language_id);
if (!quest.is_in_root_path(path)) {
// Not a file of this quest.
return;
}
// Find the existing tab if any.
int index = find_editor(path);
if (index != -1) {
// Already open.
setCurrentIndex(index);
return;
}
try {
add_editor(new DialogsEditor(quest, language_id));
}
catch (const EditorException& ex) {
ex.show_dialog();
}
}
示例2: EditorException
/**
* @brief Creates a dialogs model.
* @param quest The quest.
* @param language_id Id of the language of dialogs to manage.
* @param parent The parent object or nullptr.
* @throws EditorException If the file could not be opened.
*/
DialogsModel::DialogsModel(
const Quest& quest,
const QString& language_id,
QObject* parent) :
QAbstractItemModel(parent),
quest(quest),
language_id(language_id),
selection_model(this) {
// Load the strings data file.
QString path = quest.get_dialogs_path(language_id);
if (!resources.import_from_file(path.toStdString())) {
throw EditorException(tr("Cannot open dialogs data file '%1'").arg(path));
}
// Create the indexed tree.
build_dialog_tree();
}