Skip to content

Commit 1c9f069

Browse files
committed
Begin rewriting Excel viewer to use EXDSchema
This obviously isn't complete yet, but it's a start.
1 parent 53d8475 commit 1c9f069

File tree

12 files changed

+44598
-203
lines changed

12 files changed

+44598
-203
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ add_subdirectory(apps)
5959
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
6060

6161
file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES src/*.cpp src/*.h)
62+
list(FILTER ALL_CLANG_FORMAT_SOURCE_FILES EXCLUDE REGEX "extern/.*")
6263
kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES})
6364

6465
kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)

apps/karuku/src/mainwindow.cpp

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,12 @@ MainWindow::MainWindow(SqPackResource *data)
4747
dummyWidget->addWidget(m_exdPart);
4848

4949
connect(listWidget, &SheetListWidget::sheetSelected, this, [this, data](const QString &name) {
50-
QString definitionPath;
51-
52-
const QDir dataDir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
53-
const QDir definitionsDir = dataDir.absoluteFilePath(QStringLiteral("definitions"));
54-
5550
auto path = QStringLiteral("exd/%1.exh").arg(name.toLower());
5651
auto pathStd = path.toStdString();
5752

5853
auto file = physis_gamedata_extract_file(data, pathStd.c_str());
5954

60-
m_exdPart->loadSheet(name, file, definitionsDir.absoluteFilePath(QStringLiteral("%1.json").arg(name)));
55+
m_exdPart->loadSheet(name, file);
6156

6257
setWindowTitle(name);
6358
});
@@ -95,13 +90,13 @@ static bool copyDirectory(const QString &srcFilePath, const QString &tgtFilePath
9590

9691
void MainWindow::setupActions()
9792
{
98-
auto openList = new QAction(i18nc("@action:inmenu", "Import Definitions"));
93+
auto openList = new QAction(i18nc("@action:inmenu", "Import Schema"));
9994
openList->setIcon(QIcon::fromTheme(QStringLiteral("document-open")));
10095
connect(openList, &QAction::triggered, [this] {
101-
auto fileName = QFileDialog::getExistingDirectory(nullptr, i18nc("@title:window", "Open Defintions Directory"), QStringLiteral("~"));
96+
auto fileName = QFileDialog::getExistingDirectory(nullptr, i18nc("@title:window", "Open Schema Directory"), QStringLiteral("~"));
10297

10398
const QDir dataDir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
104-
const QDir definitionsDir = dataDir.absoluteFilePath(QStringLiteral("definitions"));
99+
const QDir definitionsDir = dataDir.absoluteFilePath(QStringLiteral("schema"));
105100

106101
// delete old directory
107102
if (definitionsDir.exists()) {
@@ -112,18 +107,18 @@ void MainWindow::setupActions()
112107

113108
copyDirectory(fileName, definitionsDir.absolutePath());
114109

115-
QMessageBox::information(this, i18nc("@title:window", "Definitions"), i18n("Successfully imported definitions!"));
110+
QMessageBox::information(this, i18nc("@title:window", "Schema"), i18n("Successfully imported schema!"));
116111
});
117112
actionCollection()->addAction(QStringLiteral("import_list"), openList);
118113

119-
auto downloadList = new QAction(i18nc("@action:inmenu", "Download Definitions"));
114+
auto downloadList = new QAction(i18nc("@action:inmenu", "Download Schema"));
120115
downloadList->setIcon(QIcon::fromTheme(QStringLiteral("download-symbolic")));
121116
connect(downloadList, &QAction::triggered, [this] {
122117
const int ret = QMessageBox::information(
123118
this,
124119
i18nc("@title:window", "Download Confirmation"),
125-
i18n("Novus will download the definitions from the <a "
126-
"href=\"https://github.com/xivapi/SaintCoinach\">SaintCoinach repository on GitHub</a>.<br><br>Would you still like to continue?"),
120+
i18n("Novus will download the schema from the <a "
121+
"href=\"https://github.com/xivdev/EXDSchema\">EXDSchema repository on GitHub</a>.<br><br>Would you still like to continue?"),
127122
QMessageBox::Ok | QMessageBox::Cancel,
128123
QMessageBox::Ok);
129124

@@ -134,7 +129,7 @@ void MainWindow::setupActions()
134129
QUrl url;
135130
url.setScheme(QStringLiteral("https"));
136131
url.setHost(QStringLiteral("github.com"));
137-
url.setPath(QStringLiteral("/xivapi/SaintCoinach/releases/latest/download/Godbert.zip"));
132+
url.setPath(QStringLiteral("/xivdev/EXDSchema/releases/latest/download/latest.zip"));
138133

139134
// TODO: Use Qcoro?
140135
auto reply = mgr->get(QNetworkRequest(url));
@@ -143,22 +138,22 @@ void MainWindow::setupActions()
143138

144139
QTemporaryDir tempDir;
145140

146-
QFile file(tempDir.filePath(QStringLiteral("Godbert.zip")));
141+
QFile file(tempDir.filePath(QStringLiteral("latest.zip")));
147142
file.open(QIODevice::WriteOnly);
148143
file.write(reply->readAll());
149144
file.close();
150145

151-
KZip archive(tempDir.filePath(QStringLiteral("Godbert.zip")));
146+
KZip archive(tempDir.filePath(QStringLiteral("latest.zip")));
152147
if (!archive.open(QIODevice::ReadOnly)) {
153148
// TODO: these should show as message boxes
154149
qFatal() << "Failed to open Godbert zip!";
155150
return;
156151
}
157152

158-
const KArchiveDirectory *root = dynamic_cast<const KArchiveDirectory *>(archive.directory()->entry(QStringLiteral("Definitions")));
153+
const KArchiveDirectory *root = dynamic_cast<const KArchiveDirectory *>(archive.directory());
159154

160155
const QDir dataDir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
161-
const QDir definitionsDir = dataDir.absoluteFilePath(QStringLiteral("definitions"));
156+
const QDir definitionsDir = dataDir.absoluteFilePath(QStringLiteral("schema"));
162157

163158
// delete old directory
164159
if (definitionsDir.exists()) {
@@ -171,7 +166,7 @@ void MainWindow::setupActions()
171166

172167
archive.close();
173168

174-
QMessageBox::information(this, i18nc("@title:window", "Definitions"), i18n("Successfully downloaded and imported definitions!"));
169+
QMessageBox::information(this, i18nc("@title:window", "Schema"), i18n("Successfully downloaded and imported schema!"));
175170
});
176171
});
177172
actionCollection()->addAction(QStringLiteral("download_list"), downloadList);

extern/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ add_subdirectory(magic_enum EXCLUDE_FROM_ALL)
2020
add_subdirectory(tinygltf EXCLUDE_FROM_ALL)
2121
add_subdirectory(imgui EXCLUDE_FROM_ALL)
2222
add_subdirectory(dxbc EXCLUDE_FROM_ALL)
23+
add_subdirectory(rapidyaml EXCLUDE_FROM_ALL)
2324

2425
# TODO: Enable in the Flatpak, it's a bit annoying though as we would have to build it separately
2526
if (NOT BUILD_FLATPAK)

extern/rapidyaml/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# SPDX-FileCopyrightText: 2025 Joshua Goins <[email protected]>
2+
# SPDX-License-Identifier: CC0-1.0
3+
4+
add_library(rapidyaml INTERFACE)
5+
target_include_directories(rapidyaml INTERFACE include)

0 commit comments

Comments
 (0)