14 #include <QTableWidget>
17 #include <QTextStream>
18 #include <QVBoxLayout>
20 #include <QDialogButtonBox>
23 #include "AssetsManager.h"
31 auto arch = getManager()->archetypes()->first([&] (
const auto &at) {
32 return (at->name == name || at->clone.name == name) && (at->clone.type == SKILL || at->clone.type == SPELL || at->clone.type == SPELL_EFFECT);
35 switch (arch->clone.type) {
37 return tr(
"skill use");
39 return tr(
"spell cast");
41 return tr(
"spell effect");
43 return tr(
"unknown type");
51 setWindowTitle(tr(
"Sound information"));
53 QVBoxLayout *l =
new QVBoxLayout(
this);
54 QTableWidget *table =
new QTableWidget();
56 table->setEditTriggers(QAbstractItemView::NoEditTriggers);
57 table->setColumnCount(4);
58 table->setHorizontalHeaderLabels(QStringList(tr(
"Event")) << tr(
"Volume") << tr(
"File") << tr(
"Type"));
60 auto buttons =
new QDialogButtonBox(QDialogButtonBox::Close);
61 connect(buttons, &QDialogButtonBox::rejected,
this, &QDialog::reject);
62 l->addWidget(buttons);
64 QFile file(QDir(dir).filePath(
"sounds.conf"));
65 file.open(QIODevice::ReadOnly | QIODevice::Text);
66 QTextStream in(&file);
68 const QString line = in.readLine();
69 if (line.isEmpty() || line.startsWith(
'#')) {
73 auto split = line.split(
':');
74 if (split.length() != 3) {
78 int pos = table->rowCount();
79 table->setRowCount(pos + 1);
80 for (
int s = 0; s < split.length(); s++) {
81 auto item =
new QTableWidgetItem(split[s]);
82 table->setItem(pos, s, item);
84 table->setItem(pos, split.length(),
new QTableWidgetItem(
soundType(split[0])));