14 #include <QTableWidget>
17 #include <QTextStream>
18 #include <QVBoxLayout>
20 #include <QDialogButtonBox>
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(
'#')) {
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);