mirror of
https://github.com/redstrate/Novus.git
synced 2025-04-20 11:47:45 +00:00
Switch to KXmlGuiWindow
This will eventually use more KStandardAction, and gets rid of our custom code which is just doing a worse job than KXmlGui.
This commit is contained in:
parent
6e4e8c81a2
commit
0cf37355cb
36 changed files with 226 additions and 179 deletions
|
@ -49,6 +49,7 @@ target_link_libraries(novus-armoury
|
||||||
Qt6::Network)
|
Qt6::Network)
|
||||||
|
|
||||||
install(TARGETS novus-armoury ${KF${QT_MAJOR_VERSION}_INSTALL_TARGETS_DEFAULT_ARGS})
|
install(TARGETS novus-armoury ${KF${QT_MAJOR_VERSION}_INSTALL_TARGETS_DEFAULT_ARGS})
|
||||||
|
install(FILES geareditor.rc DESTINATION ${KDE_INSTALL_KXMLGUIDIR}/novus)
|
||||||
|
|
||||||
ecm_add_app_icon(novus-armoury
|
ecm_add_app_icon(novus-armoury
|
||||||
ICONS
|
ICONS
|
||||||
|
|
23
apps/armoury/geareditor.rc
Normal file
23
apps/armoury/geareditor.rc
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<gui name="geareditor"
|
||||||
|
version="1"
|
||||||
|
xmlns="https://www.kde.org/standards/kxmlgui/1.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="https://www.kde.org/standards/kxmlgui/1.0
|
||||||
|
https://www.kde.org/standards/kxmlgui/1.0/kxmlgui.xsd">
|
||||||
|
<MenuBar>
|
||||||
|
<Menu name="penumbra" >
|
||||||
|
<text>Penumbra</text>
|
||||||
|
<Action name="redraw_all" />
|
||||||
|
<Action name="open_window" />
|
||||||
|
</Menu>
|
||||||
|
<Menu name="tools" >
|
||||||
|
<text>Tools</text>
|
||||||
|
<Action name="cmp_editor" />
|
||||||
|
</Menu>
|
||||||
|
<Menu name="view" >
|
||||||
|
<text>View</text>
|
||||||
|
<Action name="show_fmv" />
|
||||||
|
</Menu>
|
||||||
|
</MenuBar>
|
||||||
|
</gui>
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <KXmlGuiWindow>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <physis.hpp>
|
#include <physis.hpp>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
@ -11,24 +12,25 @@
|
||||||
#include "gearview.h"
|
#include "gearview.h"
|
||||||
#include "metadataview.h"
|
#include "metadataview.h"
|
||||||
#include "mtrlpart.h"
|
#include "mtrlpart.h"
|
||||||
#include "novusmainwindow.h"
|
|
||||||
#include "singlegearview.h"
|
#include "singlegearview.h"
|
||||||
|
|
||||||
struct GameData;
|
struct GameData;
|
||||||
class FileCache;
|
class FileCache;
|
||||||
class PenumbraApi;
|
class PenumbraApi;
|
||||||
|
|
||||||
class MainWindow : public NovusMainWindow
|
class MainWindow : public KXmlGuiWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit MainWindow(GameData *data);
|
explicit MainWindow(GameData *data);
|
||||||
|
|
||||||
protected:
|
public Q_SLOTS:
|
||||||
void setupAdditionalMenus(QMenuBar *menuBar) override;
|
void configure();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void setupActions();
|
||||||
|
|
||||||
SingleGearView *gearView = nullptr;
|
SingleGearView *gearView = nullptr;
|
||||||
FullModelViewer *fullModelViewer = nullptr;
|
FullModelViewer *fullModelViewer = nullptr;
|
||||||
QTabWidget *materialsView = nullptr;
|
QTabWidget *materialsView = nullptr;
|
||||||
|
|
|
@ -16,7 +16,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
KLocalizedString::setApplicationDomain(QByteArrayLiteral("novus"));
|
KLocalizedString::setApplicationDomain(QByteArrayLiteral("novus"));
|
||||||
|
|
||||||
customizeAboutData(QStringLiteral("armoury"), QStringLiteral("zone.xiv.armoury"), QStringLiteral("Gear Editor"), i18n("Program to view FFXIV gear."));
|
customizeAboutData(QStringLiteral("novus"), QStringLiteral("zone.xiv.armoury"), QStringLiteral("Gear Editor"), i18n("Program to view FFXIV gear."));
|
||||||
|
|
||||||
// Default to a sensible message pattern
|
// Default to a sensible message pattern
|
||||||
if (qEnvironmentVariableIsEmpty("QT_MESSAGE_PATTERN")) {
|
if (qEnvironmentVariableIsEmpty("QT_MESSAGE_PATTERN")) {
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <QTableWidget>
|
#include <QTableWidget>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
|
#include <KActionCollection>
|
||||||
#include <KLocalizedString>
|
#include <KLocalizedString>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
@ -24,13 +25,12 @@
|
||||||
#include "settingswindow.h"
|
#include "settingswindow.h"
|
||||||
|
|
||||||
MainWindow::MainWindow(GameData *in_data)
|
MainWindow::MainWindow(GameData *in_data)
|
||||||
: NovusMainWindow()
|
: KXmlGuiWindow()
|
||||||
, data(*in_data)
|
, data(*in_data)
|
||||||
, cache(FileCache{*in_data})
|
, cache(FileCache{*in_data})
|
||||||
, m_api(new PenumbraApi(this))
|
, m_api(new PenumbraApi(this))
|
||||||
{
|
{
|
||||||
setMinimumSize(QSize(800, 600));
|
setMinimumSize(QSize(800, 600));
|
||||||
setupMenubar();
|
|
||||||
|
|
||||||
auto dummyWidget = new QSplitter();
|
auto dummyWidget = new QSplitter();
|
||||||
dummyWidget->setChildrenCollapsible(false);
|
dummyWidget->setChildrenCollapsible(false);
|
||||||
|
@ -78,55 +78,63 @@ MainWindow::MainWindow(GameData *in_data)
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
setupActions();
|
||||||
|
setupGUI(Keys | Save | Create, QStringLiteral("geareditor.rc"));
|
||||||
|
|
||||||
|
// We don't provide help (yet)
|
||||||
|
actionCollection()->removeAction(actionCollection()->action(KStandardAction::name(KStandardAction::HelpContents)));
|
||||||
|
// This isn't KDE software
|
||||||
|
actionCollection()->removeAction(actionCollection()->action(KStandardAction::name(KStandardAction::AboutKDE)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::setupAdditionalMenus(QMenuBar *menuBar)
|
void MainWindow::configure()
|
||||||
{
|
{
|
||||||
auto toolsMenu = menuBar->addMenu(i18nc("@title:menu", "Tools"));
|
auto settingsWindow = new SettingsWindow();
|
||||||
|
settingsWindow->show();
|
||||||
|
}
|
||||||
|
|
||||||
auto cmpEditorMenu = toolsMenu->addAction(i18nc("@action:inmenu CMP is an abbreviation", "CMP Editor"));
|
void MainWindow::setupActions()
|
||||||
cmpEditorMenu->setIcon(QIcon::fromTheme(QStringLiteral("document-edit")));
|
{
|
||||||
connect(cmpEditorMenu, &QAction::triggered, [this] {
|
KStandardAction::preferences(this, &MainWindow::configure, actionCollection());
|
||||||
auto cmpEditor = new CmpEditor(&data);
|
KStandardAction::quit(qApp, &QCoreApplication::quit, actionCollection());
|
||||||
cmpEditor->show();
|
|
||||||
});
|
|
||||||
|
|
||||||
auto windowMenu = menuBar->addMenu(i18nc("@title:menu", "Window"));
|
auto showFMVAction = new QAction(this);
|
||||||
|
showFMVAction->setText(i18n("&Full Model Viewer"));
|
||||||
auto fmvMenu = windowMenu->addAction(i18nc("@action:inmenu", "Full Model Viewer"));
|
showFMVAction->setCheckable(true);
|
||||||
fmvMenu->setCheckable(true);
|
showFMVAction->setIcon(QIcon::fromTheme(QStringLiteral("user-symbolic")));
|
||||||
fmvMenu->setIcon(QIcon::fromTheme(QStringLiteral("user-symbolic")));
|
connect(showFMVAction, &QAction::toggled, [this](bool toggled) {
|
||||||
connect(fmvMenu, &QAction::toggled, [this](bool toggled) {
|
|
||||||
if (toggled) {
|
if (toggled) {
|
||||||
fullModelViewer->show();
|
fullModelViewer->show();
|
||||||
} else {
|
} else {
|
||||||
fullModelViewer->hide();
|
fullModelViewer->hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
connect(fullModelViewer, &FullModelViewer::visibleChanged, this, [this, fmvMenu] {
|
connect(fullModelViewer, &FullModelViewer::visibleChanged, this, [this, showFMVAction] {
|
||||||
fmvMenu->setChecked(fullModelViewer->isVisible());
|
showFMVAction->setChecked(fullModelViewer->isVisible());
|
||||||
});
|
});
|
||||||
|
actionCollection()->addAction(QStringLiteral("show_fmv"), showFMVAction);
|
||||||
|
|
||||||
auto penumbraMenu = menuBar->addMenu(i18nc("@title:menu", "Penumbra"));
|
auto cmpEditorAction = new QAction(this);
|
||||||
|
cmpEditorAction->setText(i18n("&CMP Editor"));
|
||||||
|
cmpEditorAction->setIcon(QIcon::fromTheme(QStringLiteral("document-edit")));
|
||||||
|
connect(cmpEditorAction, &QAction::triggered, [this] {
|
||||||
|
auto cmpEditor = new CmpEditor(&data);
|
||||||
|
cmpEditor->show();
|
||||||
|
});
|
||||||
|
actionCollection()->addAction(QStringLiteral("cmp_editor"), cmpEditorAction);
|
||||||
|
|
||||||
auto redrawAction = penumbraMenu->addAction(i18nc("@action:inmenu", "Redraw All"));
|
auto redrawAction = new QAction(i18nc("@action:inmenu", "Redraw All"));
|
||||||
connect(redrawAction, &QAction::triggered, [this] {
|
connect(redrawAction, &QAction::triggered, [this] {
|
||||||
m_api->redrawAll();
|
m_api->redrawAll();
|
||||||
});
|
});
|
||||||
|
actionCollection()->addAction(QStringLiteral("redraw_all"), redrawAction);
|
||||||
|
|
||||||
auto openWindowAction = penumbraMenu->addAction(i18nc("@action:inmenu", "Open Window"));
|
auto openWindowAction = new QAction(i18nc("@action:inmenu", "Open Window"));
|
||||||
connect(openWindowAction, &QAction::triggered, [this] {
|
connect(openWindowAction, &QAction::triggered, [this] {
|
||||||
m_api->openWindow();
|
m_api->openWindow();
|
||||||
});
|
});
|
||||||
|
actionCollection()->addAction(QStringLiteral("open_window"), openWindowAction);
|
||||||
auto settingsMenu = menuBar->addMenu(i18nc("@title:menu", "Settings"));
|
|
||||||
|
|
||||||
auto settingsAction = settingsMenu->addAction(i18nc("@action:inmenu", "Configure Armoury…"));
|
|
||||||
settingsAction->setIcon(QIcon::fromTheme(QStringLiteral("configure-symbolic")));
|
|
||||||
connect(settingsAction, &QAction::triggered, [this] {
|
|
||||||
auto settingsWindow = new SettingsWindow();
|
|
||||||
settingsWindow->show();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "moc_mainwindow.cpp"
|
#include "moc_mainwindow.cpp"
|
||||||
|
|
|
@ -3,13 +3,13 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QProcess>
|
#include <KXmlGuiWindow>
|
||||||
|
|
||||||
#include "novusmainwindow.h"
|
#include <QProcess>
|
||||||
|
|
||||||
struct GameData;
|
struct GameData;
|
||||||
|
|
||||||
class MainWindow : public NovusMainWindow
|
class MainWindow : public KXmlGuiWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
KLocalizedString::setApplicationDomain(QByteArrayLiteral("novus"));
|
KLocalizedString::setApplicationDomain(QByteArrayLiteral("novus"));
|
||||||
|
|
||||||
customizeAboutData(QStringLiteral("gamelauncher"),
|
customizeAboutData(QStringLiteral("novus"),
|
||||||
QStringLiteral("zone.xiv.gamelauncher"),
|
QStringLiteral("zone.xiv.gamelauncher"),
|
||||||
QStringLiteral("Game Launcher"),
|
QStringLiteral("Game Launcher"),
|
||||||
i18n("Program to launch the game for debug purposes."));
|
i18n("Program to launch the game for debug purposes."));
|
||||||
|
|
|
@ -4,19 +4,20 @@
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
|
#include <KActionCollection>
|
||||||
#include <KLocalizedString>
|
#include <KLocalizedString>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <QFormLayout>
|
||||||
|
#include <QLineEdit>
|
||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
#include <QFormLayout>
|
|
||||||
#include <QPushButton>
|
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QLineEdit>
|
#include <QPushButton>
|
||||||
|
|
||||||
MainWindow::MainWindow() : NovusMainWindow()
|
MainWindow::MainWindow()
|
||||||
|
: KXmlGuiWindow()
|
||||||
{
|
{
|
||||||
setMinimumSize(1280, 720);
|
setMinimumSize(1280, 720);
|
||||||
setupMenubar();
|
|
||||||
|
|
||||||
process = new QProcess();
|
process = new QProcess();
|
||||||
process->setWorkingDirectory(getGameDirectory());
|
process->setWorkingDirectory(getGameDirectory());
|
||||||
|
@ -38,6 +39,13 @@ MainWindow::MainWindow() : NovusMainWindow()
|
||||||
process->start();
|
process->start();
|
||||||
});
|
});
|
||||||
layout->addWidget(launchGameButton);
|
layout->addWidget(launchGameButton);
|
||||||
|
|
||||||
|
setupGUI(Keys | Save | Create);
|
||||||
|
|
||||||
|
// We don't provide help (yet)
|
||||||
|
actionCollection()->removeAction(actionCollection()->action(KStandardAction::name(KStandardAction::HelpContents)));
|
||||||
|
// This isn't KDE software
|
||||||
|
actionCollection()->removeAction(actionCollection()->action(KStandardAction::name(KStandardAction::AboutKDE)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "moc_mainwindow.cpp"
|
#include "moc_mainwindow.cpp"
|
|
@ -25,6 +25,7 @@ target_link_libraries(novus-karuku
|
||||||
Qt6::Network)
|
Qt6::Network)
|
||||||
|
|
||||||
install(TARGETS novus-karuku ${KF${QT_MAJOR_VERSION}_INSTALL_TARGETS_DEFAULT_ARGS})
|
install(TARGETS novus-karuku ${KF${QT_MAJOR_VERSION}_INSTALL_TARGETS_DEFAULT_ARGS})
|
||||||
|
install(FILES exceleditor.rc DESTINATION ${KDE_INSTALL_KXMLGUIDIR}/novus)
|
||||||
|
|
||||||
ecm_add_app_icon(novus-karuku
|
ecm_add_app_icon(novus-karuku
|
||||||
ICONS
|
ICONS
|
||||||
|
|
15
apps/karuku/exceleditor.rc
Normal file
15
apps/karuku/exceleditor.rc
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<gui name="exceleditor"
|
||||||
|
version="1"
|
||||||
|
xmlns="https://www.kde.org/standards/kxmlgui/1.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="https://www.kde.org/standards/kxmlgui/1.0
|
||||||
|
https://www.kde.org/standards/kxmlgui/1.0/kxmlgui.xsd">
|
||||||
|
<MenuBar>
|
||||||
|
<Menu name="file" >
|
||||||
|
<text>File</text>
|
||||||
|
<Action name="import_list" />
|
||||||
|
<Action name="download_list" />
|
||||||
|
</Menu>
|
||||||
|
</MenuBar>
|
||||||
|
</gui>
|
|
@ -3,23 +3,21 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <KXmlGuiWindow>
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
|
|
||||||
#include "novusmainwindow.h"
|
|
||||||
|
|
||||||
struct GameData;
|
struct GameData;
|
||||||
|
|
||||||
class MainWindow : public NovusMainWindow
|
class MainWindow : public KXmlGuiWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit MainWindow(GameData *data);
|
explicit MainWindow(GameData *data);
|
||||||
|
|
||||||
protected:
|
|
||||||
void setupFileMenu(QMenu *menu) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void setupActions();
|
||||||
|
|
||||||
GameData *data = nullptr;
|
GameData *data = nullptr;
|
||||||
QNetworkAccessManager *mgr = nullptr;
|
QNetworkAccessManager *mgr = nullptr;
|
||||||
};
|
};
|
|
@ -16,7 +16,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
KLocalizedString::setApplicationDomain(QByteArrayLiteral("novus"));
|
KLocalizedString::setApplicationDomain(QByteArrayLiteral("novus"));
|
||||||
|
|
||||||
customizeAboutData(QStringLiteral("karuku"), QStringLiteral("zone.xiv.karaku"), QStringLiteral("Excel Editor"), i18n("Program to view FFXIV Excel files."));
|
customizeAboutData(QStringLiteral("novus"), QStringLiteral("zone.xiv.karaku"), QStringLiteral("Excel Editor"), i18n("Program to view FFXIV Excel files."));
|
||||||
|
|
||||||
// Default to a sensible message pattern
|
// Default to a sensible message pattern
|
||||||
if (qEnvironmentVariableIsEmpty("QT_MESSAGE_PATTERN")) {
|
if (qEnvironmentVariableIsEmpty("QT_MESSAGE_PATTERN")) {
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
|
#include <KActionCollection>
|
||||||
#include <KLocalizedString>
|
#include <KLocalizedString>
|
||||||
#include <KZip>
|
#include <KZip>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
@ -23,11 +24,10 @@
|
||||||
#include "sheetlistwidget.h"
|
#include "sheetlistwidget.h"
|
||||||
|
|
||||||
MainWindow::MainWindow(GameData *data)
|
MainWindow::MainWindow(GameData *data)
|
||||||
: NovusMainWindow()
|
: KXmlGuiWindow()
|
||||||
, data(data)
|
, data(data)
|
||||||
{
|
{
|
||||||
setMinimumSize(1280, 720);
|
setMinimumSize(1280, 720);
|
||||||
setupMenubar();
|
|
||||||
|
|
||||||
mgr = new QNetworkAccessManager(this);
|
mgr = new QNetworkAccessManager(this);
|
||||||
|
|
||||||
|
@ -55,6 +55,14 @@ MainWindow::MainWindow(GameData *data)
|
||||||
|
|
||||||
exdPart->loadSheet(name, file, definitionsDir.absoluteFilePath(QStringLiteral("%1.json").arg(name)));
|
exdPart->loadSheet(name, file, definitionsDir.absoluteFilePath(QStringLiteral("%1.json").arg(name)));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
setupActions();
|
||||||
|
setupGUI(Keys | Save | Create, QStringLiteral("exceleditor.rc"));
|
||||||
|
|
||||||
|
// We don't provide help (yet)
|
||||||
|
actionCollection()->removeAction(actionCollection()->action(KStandardAction::name(KStandardAction::HelpContents)));
|
||||||
|
// This isn't KDE software
|
||||||
|
actionCollection()->removeAction(actionCollection()->action(KStandardAction::name(KStandardAction::AboutKDE)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool copyDirectory(const QString &srcFilePath, const QString &tgtFilePath)
|
static bool copyDirectory(const QString &srcFilePath, const QString &tgtFilePath)
|
||||||
|
@ -79,9 +87,9 @@ static bool copyDirectory(const QString &srcFilePath, const QString &tgtFilePath
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::setupFileMenu(QMenu *menu)
|
void MainWindow::setupActions()
|
||||||
{
|
{
|
||||||
auto openList = menu->addAction(i18nc("@action:inmenu", "Import Definitions…"));
|
auto openList = new QAction(i18nc("@action:inmenu", "Import Definitions…"));
|
||||||
openList->setIcon(QIcon::fromTheme(QStringLiteral("document-open")));
|
openList->setIcon(QIcon::fromTheme(QStringLiteral("document-open")));
|
||||||
connect(openList, &QAction::triggered, [this] {
|
connect(openList, &QAction::triggered, [this] {
|
||||||
auto fileName = QFileDialog::getExistingDirectory(nullptr, i18nc("@title:window", "Open Defintions Directory"), QStringLiteral("~"));
|
auto fileName = QFileDialog::getExistingDirectory(nullptr, i18nc("@title:window", "Open Defintions Directory"), QStringLiteral("~"));
|
||||||
|
@ -100,8 +108,9 @@ void MainWindow::setupFileMenu(QMenu *menu)
|
||||||
|
|
||||||
QMessageBox::information(this, i18nc("@title:window", "Definitions"), i18n("Successfully imported definitions!"));
|
QMessageBox::information(this, i18nc("@title:window", "Definitions"), i18n("Successfully imported definitions!"));
|
||||||
});
|
});
|
||||||
|
actionCollection()->addAction(QStringLiteral("import_list"), openList);
|
||||||
|
|
||||||
auto downloadList = menu->addAction(i18nc("@action:inmenu", "Download Definitions…"));
|
auto downloadList = new QAction(i18nc("@action:inmenu", "Download Definitions…"));
|
||||||
downloadList->setIcon(QIcon::fromTheme(QStringLiteral("download-symbolic")));
|
downloadList->setIcon(QIcon::fromTheme(QStringLiteral("download-symbolic")));
|
||||||
connect(downloadList, &QAction::triggered, [this] {
|
connect(downloadList, &QAction::triggered, [this] {
|
||||||
const int ret = QMessageBox::information(
|
const int ret = QMessageBox::information(
|
||||||
|
@ -159,6 +168,7 @@ void MainWindow::setupFileMenu(QMenu *menu)
|
||||||
QMessageBox::information(this, i18nc("@title:window", "Definitions"), i18n("Successfully downloaded and imported definitions!"));
|
QMessageBox::information(this, i18nc("@title:window", "Definitions"), i18n("Successfully downloaded and imported definitions!"));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
actionCollection()->addAction(QStringLiteral("download_list"), downloadList);
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "moc_mainwindow.cpp"
|
#include "moc_mainwindow.cpp"
|
|
@ -3,12 +3,13 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <KXmlGuiWindow>
|
||||||
|
|
||||||
#include "filecache.h"
|
#include "filecache.h"
|
||||||
#include "novusmainwindow.h"
|
|
||||||
|
|
||||||
struct GameData;
|
struct GameData;
|
||||||
|
|
||||||
class MainWindow : public NovusMainWindow
|
class MainWindow : public KXmlGuiWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
KLocalizedString::setApplicationDomain(QByteArrayLiteral("novus"));
|
KLocalizedString::setApplicationDomain(QByteArrayLiteral("novus"));
|
||||||
|
|
||||||
customizeAboutData(QStringLiteral("mapeditor"), QStringLiteral("zone.xiv.mapeditor"), QStringLiteral("Map Editor"), i18n("Program to view FFXIV maps."));
|
customizeAboutData(QStringLiteral("novus"), QStringLiteral("zone.xiv.mapeditor"), QStringLiteral("Map Editor"), i18n("Program to view FFXIV maps."));
|
||||||
|
|
||||||
// Default to a sensible message pattern
|
// Default to a sensible message pattern
|
||||||
if (qEnvironmentVariableIsEmpty("QT_MESSAGE_PATTERN")) {
|
if (qEnvironmentVariableIsEmpty("QT_MESSAGE_PATTERN")) {
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
|
#include <KActionCollection>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
|
@ -16,12 +17,11 @@
|
||||||
#include "mapview.h"
|
#include "mapview.h"
|
||||||
|
|
||||||
MainWindow::MainWindow(GameData *data)
|
MainWindow::MainWindow(GameData *data)
|
||||||
: NovusMainWindow()
|
: KXmlGuiWindow()
|
||||||
, data(data)
|
, data(data)
|
||||||
, cache(*data)
|
, cache(*data)
|
||||||
{
|
{
|
||||||
setMinimumSize(1280, 720);
|
setMinimumSize(1280, 720);
|
||||||
setupMenubar();
|
|
||||||
|
|
||||||
auto dummyWidget = new QSplitter();
|
auto dummyWidget = new QSplitter();
|
||||||
dummyWidget->setChildrenCollapsible(false);
|
dummyWidget->setChildrenCollapsible(false);
|
||||||
|
@ -45,6 +45,13 @@ MainWindow::MainWindow(GameData *data)
|
||||||
auto tera = physis_parse_tera(tera_buffer);
|
auto tera = physis_parse_tera(tera_buffer);
|
||||||
mapView->addTerrain(bgPath, tera);
|
mapView->addTerrain(bgPath, tera);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
setupGUI(Keys | Save | Create);
|
||||||
|
|
||||||
|
// We don't provide help (yet)
|
||||||
|
actionCollection()->removeAction(actionCollection()->action(KStandardAction::name(KStandardAction::HelpContents)));
|
||||||
|
// This isn't KDE software
|
||||||
|
actionCollection()->removeAction(actionCollection()->action(KStandardAction::name(KStandardAction::AboutKDE)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "moc_mainwindow.cpp"
|
#include "moc_mainwindow.cpp"
|
|
@ -3,12 +3,13 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <KXmlGuiWindow>
|
||||||
|
|
||||||
#include "filecache.h"
|
#include "filecache.h"
|
||||||
#include "novusmainwindow.h"
|
|
||||||
|
|
||||||
struct GameData;
|
struct GameData;
|
||||||
|
|
||||||
class MainWindow : public NovusMainWindow
|
class MainWindow : public KXmlGuiWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
KLocalizedString::setApplicationDomain(QByteArrayLiteral("novus"));
|
KLocalizedString::setApplicationDomain(QByteArrayLiteral("novus"));
|
||||||
|
|
||||||
customizeAboutData(QStringLiteral("mateditor"),
|
customizeAboutData(QStringLiteral("novus"),
|
||||||
QStringLiteral("zone.xiv.mateditor"),
|
QStringLiteral("zone.xiv.mateditor"),
|
||||||
QStringLiteral("Material Editor"),
|
QStringLiteral("Material Editor"),
|
||||||
i18n("Program to view FFXIV materials."));
|
i18n("Program to view FFXIV materials."));
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
#include <KLocalizedString>
|
#include <KActionCollection>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
|
@ -14,12 +14,11 @@
|
||||||
#include "mtrlpart.h"
|
#include "mtrlpart.h"
|
||||||
|
|
||||||
MainWindow::MainWindow(GameData *data)
|
MainWindow::MainWindow(GameData *data)
|
||||||
: NovusMainWindow()
|
: KXmlGuiWindow()
|
||||||
, data(data)
|
, data(data)
|
||||||
, cache(*data)
|
, cache(*data)
|
||||||
{
|
{
|
||||||
setMinimumSize(1280, 720);
|
setMinimumSize(1280, 720);
|
||||||
setupMenubar();
|
|
||||||
|
|
||||||
auto matFile = physis_gamedata_extract_file(data, "chara/equipment/e0028/material/v0001/mt_c0101e0028_top_a.mtrl");
|
auto matFile = physis_gamedata_extract_file(data, "chara/equipment/e0028/material/v0001/mt_c0101e0028_top_a.mtrl");
|
||||||
m_material = physis_material_parse(matFile);
|
m_material = physis_material_parse(matFile);
|
||||||
|
@ -36,6 +35,13 @@ MainWindow::MainWindow(GameData *data)
|
||||||
auto matView = new MaterialView(data, cache);
|
auto matView = new MaterialView(data, cache);
|
||||||
matView->addSphere(m_material);
|
matView->addSphere(m_material);
|
||||||
dummyWidget->addWidget(matView);
|
dummyWidget->addWidget(matView);
|
||||||
|
|
||||||
|
setupGUI(Keys | Save | Create);
|
||||||
|
|
||||||
|
// We don't provide help (yet)
|
||||||
|
actionCollection()->removeAction(actionCollection()->action(KStandardAction::name(KStandardAction::HelpContents)));
|
||||||
|
// This isn't KDE software
|
||||||
|
actionCollection()->removeAction(actionCollection()->action(KStandardAction::name(KStandardAction::AboutKDE)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "moc_mainwindow.cpp"
|
#include "moc_mainwindow.cpp"
|
|
@ -22,6 +22,7 @@ target_link_libraries(novus-mdlviewer
|
||||||
Qt6::Widgets)
|
Qt6::Widgets)
|
||||||
|
|
||||||
install(TARGETS novus-mdlviewer ${KF${QT_MAJOR_VERSION}_INSTALL_TARGETS_DEFAULT_ARGS})
|
install(TARGETS novus-mdlviewer ${KF${QT_MAJOR_VERSION}_INSTALL_TARGETS_DEFAULT_ARGS})
|
||||||
|
install(FILES mdlviewer.rc DESTINATION ${KDE_INSTALL_KXMLGUIDIR}/novus)
|
||||||
|
|
||||||
ecm_add_app_icon(novus-mdlviewer
|
ecm_add_app_icon(novus-mdlviewer
|
||||||
ICONS
|
ICONS
|
||||||
|
|
|
@ -4,22 +4,22 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "filecache.h"
|
#include "filecache.h"
|
||||||
#include "novusmainwindow.h"
|
|
||||||
|
|
||||||
|
#include <KXmlGuiWindow>
|
||||||
#include <QFormLayout>
|
#include <QFormLayout>
|
||||||
|
|
||||||
struct GameData;
|
struct GameData;
|
||||||
class MDLPart;
|
class MDLPart;
|
||||||
|
|
||||||
class MainWindow : public NovusMainWindow
|
class MainWindow : public KXmlGuiWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit MainWindow(GameData *data);
|
explicit MainWindow(GameData *data);
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
void setupFileMenu(QMenu *menu) override;
|
void setupActions();
|
||||||
|
|
||||||
GameData *data = nullptr;
|
GameData *data = nullptr;
|
||||||
MDLPart *part = nullptr;
|
MDLPart *part = nullptr;
|
||||||
|
|
14
apps/mdlviewer/mdlviewer.rc
Normal file
14
apps/mdlviewer/mdlviewer.rc
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<gui name="mdlviewer"
|
||||||
|
version="1"
|
||||||
|
xmlns="https://www.kde.org/standards/kxmlgui/1.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="https://www.kde.org/standards/kxmlgui/1.0
|
||||||
|
https://www.kde.org/standards/kxmlgui/1.0/kxmlgui.xsd">
|
||||||
|
<MenuBar>
|
||||||
|
<Menu name="file" >
|
||||||
|
<text>File</text>
|
||||||
|
<Action name="open_mdl" />
|
||||||
|
</Menu>
|
||||||
|
</MenuBar>
|
||||||
|
</gui>
|
|
@ -16,10 +16,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
KLocalizedString::setApplicationDomain(QByteArrayLiteral("novus"));
|
KLocalizedString::setApplicationDomain(QByteArrayLiteral("novus"));
|
||||||
|
|
||||||
customizeAboutData(QStringLiteral("mdlviewer"),
|
customizeAboutData(QStringLiteral("novus"), QStringLiteral("zone.xiv.mdlviewer"), QStringLiteral("MDLViewer"), i18n("Program to view FFXIV MDL files."));
|
||||||
QStringLiteral("zone.xiv.mdlviewer"),
|
|
||||||
QStringLiteral("MDLViewer"),
|
|
||||||
i18n("Program to view FFXIV MDL files."));
|
|
||||||
|
|
||||||
// Default to a sensible message pattern
|
// Default to a sensible message pattern
|
||||||
if (qEnvironmentVariableIsEmpty("QT_MESSAGE_PATTERN")) {
|
if (qEnvironmentVariableIsEmpty("QT_MESSAGE_PATTERN")) {
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
|
#include <KActionCollection>
|
||||||
#include <KLocalizedString>
|
#include <KLocalizedString>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
@ -18,12 +19,11 @@
|
||||||
#include "mdlpart.h"
|
#include "mdlpart.h"
|
||||||
|
|
||||||
MainWindow::MainWindow(GameData *data)
|
MainWindow::MainWindow(GameData *data)
|
||||||
: NovusMainWindow()
|
: KXmlGuiWindow()
|
||||||
, data(data)
|
, data(data)
|
||||||
, cache(FileCache{*data})
|
, cache(FileCache{*data})
|
||||||
{
|
{
|
||||||
setMinimumSize(640, 480);
|
setMinimumSize(640, 480);
|
||||||
setupMenubar();
|
|
||||||
|
|
||||||
auto dummyWidget = new QWidget();
|
auto dummyWidget = new QWidget();
|
||||||
setCentralWidget(dummyWidget);
|
setCentralWidget(dummyWidget);
|
||||||
|
@ -68,11 +68,19 @@ MainWindow::MainWindow(GameData *data)
|
||||||
tabWidget->tabBar()->setExpanding(true);
|
tabWidget->tabBar()->setExpanding(true);
|
||||||
|
|
||||||
layout->addWidget(tabWidget);
|
layout->addWidget(tabWidget);
|
||||||
|
|
||||||
|
setupActions();
|
||||||
|
setupGUI(Keys | Save | Create, QStringLiteral("mdlviewer.rc"));
|
||||||
|
|
||||||
|
// We don't provide help (yet)
|
||||||
|
actionCollection()->removeAction(actionCollection()->action(KStandardAction::name(KStandardAction::HelpContents)));
|
||||||
|
// This isn't KDE software
|
||||||
|
actionCollection()->removeAction(actionCollection()->action(KStandardAction::name(KStandardAction::AboutKDE)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::setupFileMenu(QMenu *menu)
|
void MainWindow::setupActions()
|
||||||
{
|
{
|
||||||
auto openMDLFile = menu->addAction(i18nc("@action:inmenu MDL is an abbreviation for a file type", "Open MDL…"));
|
auto openMDLFile = new QAction(i18nc("@action:inmenu MDL is an abbreviation for a file type", "Open MDL…"));
|
||||||
openMDLFile->setIcon(QIcon::fromTheme(QStringLiteral("document-open")));
|
openMDLFile->setIcon(QIcon::fromTheme(QStringLiteral("document-open")));
|
||||||
connect(openMDLFile, &QAction::triggered, [this] {
|
connect(openMDLFile, &QAction::triggered, [this] {
|
||||||
auto fileName = QFileDialog::getOpenFileName(nullptr, i18nc("@title:window", "Open MDL File"), QStringLiteral("~"), i18n("FFXIV Model File (*.mdl)"));
|
auto fileName = QFileDialog::getOpenFileName(nullptr, i18nc("@title:window", "Open MDL File"), QStringLiteral("~"), i18n("FFXIV Model File (*.mdl)"));
|
||||||
|
@ -110,6 +118,7 @@ void MainWindow::setupFileMenu(QMenu *menu)
|
||||||
m_detailsLayout->addRow(i18n("Triangle #:"), new QLabel(QString::number(triangleCount)));
|
m_detailsLayout->addRow(i18n("Triangle #:"), new QLabel(QString::number(triangleCount)));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
actionCollection()->addAction(QStringLiteral("open_mdl"), openMDLFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "moc_mainwindow.cpp"
|
#include "moc_mainwindow.cpp"
|
||||||
|
|
|
@ -50,6 +50,7 @@ target_link_libraries(novus-sagasu
|
||||||
Qt6::Network)
|
Qt6::Network)
|
||||||
|
|
||||||
install(TARGETS novus-sagasu ${KF${QT_MAJOR_VERSION}_INSTALL_TARGETS_DEFAULT_ARGS})
|
install(TARGETS novus-sagasu ${KF${QT_MAJOR_VERSION}_INSTALL_TARGETS_DEFAULT_ARGS})
|
||||||
|
install(FILES dataexplorer.rc DESTINATION ${KDE_INSTALL_KXMLGUIDIR}/novus)
|
||||||
|
|
||||||
ecm_add_app_icon(novus-sagasu
|
ecm_add_app_icon(novus-sagasu
|
||||||
ICONS
|
ICONS
|
||||||
|
|
15
apps/sagasu/dataexplorer.rc
Normal file
15
apps/sagasu/dataexplorer.rc
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<gui name="exceleditor"
|
||||||
|
version="1"
|
||||||
|
xmlns="https://www.kde.org/standards/kxmlgui/1.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="https://www.kde.org/standards/kxmlgui/1.0
|
||||||
|
https://www.kde.org/standards/kxmlgui/1.0/kxmlgui.xsd">
|
||||||
|
<MenuBar>
|
||||||
|
<Menu name="file" >
|
||||||
|
<text>File</text>
|
||||||
|
<Action name="import_list" />
|
||||||
|
<Action name="download_list" />
|
||||||
|
</Menu>
|
||||||
|
</MenuBar>
|
||||||
|
</gui>
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <KXmlGuiWindow>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QMdiArea>
|
#include <QMdiArea>
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
|
@ -11,21 +12,19 @@
|
||||||
#include "filecache.h"
|
#include "filecache.h"
|
||||||
#include "filetreewindow.h"
|
#include "filetreewindow.h"
|
||||||
#include "hashdatabase.h"
|
#include "hashdatabase.h"
|
||||||
#include "novusmainwindow.h"
|
|
||||||
|
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
|
||||||
struct GameData;
|
struct GameData;
|
||||||
|
|
||||||
class MainWindow : public NovusMainWindow
|
class MainWindow : public KXmlGuiWindow
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MainWindow(const QString &gamePath, GameData *data);
|
MainWindow(const QString &gamePath, GameData *data);
|
||||||
|
|
||||||
protected:
|
|
||||||
void setupFileMenu(QMenu *menu) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void setupActions();
|
||||||
|
|
||||||
GameData *data = nullptr;
|
GameData *data = nullptr;
|
||||||
QTabWidget *partHolder = nullptr;
|
QTabWidget *partHolder = nullptr;
|
||||||
FileCache fileCache;
|
FileCache fileCache;
|
||||||
|
|
|
@ -17,7 +17,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
KLocalizedString::setApplicationDomain(QByteArrayLiteral("novus"));
|
KLocalizedString::setApplicationDomain(QByteArrayLiteral("novus"));
|
||||||
|
|
||||||
customizeAboutData(QStringLiteral("sagasu"),
|
customizeAboutData(QStringLiteral("novus"),
|
||||||
QStringLiteral("zone.xiv.sagasu"),
|
QStringLiteral("zone.xiv.sagasu"),
|
||||||
QStringLiteral("Data Explorer"),
|
QStringLiteral("Data Explorer"),
|
||||||
i18n("Program to explore FFXIV data archives."));
|
i18n("Program to explore FFXIV data archives."));
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
|
#include <KActionCollection>
|
||||||
#include <KLocalizedString>
|
#include <KLocalizedString>
|
||||||
#include <KZip>
|
#include <KZip>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
@ -31,11 +32,11 @@
|
||||||
#include "texpart.h"
|
#include "texpart.h"
|
||||||
|
|
||||||
MainWindow::MainWindow(const QString &gamePath, GameData *data)
|
MainWindow::MainWindow(const QString &gamePath, GameData *data)
|
||||||
: NovusMainWindow()
|
: KXmlGuiWindow()
|
||||||
, data(data)
|
, data(data)
|
||||||
, fileCache(*data)
|
, fileCache(*data)
|
||||||
{
|
{
|
||||||
setupMenubar();
|
// setupMenubar();
|
||||||
setMinimumSize(1280, 720);
|
setMinimumSize(1280, 720);
|
||||||
|
|
||||||
m_mgr = new QNetworkAccessManager(this);
|
m_mgr = new QNetworkAccessManager(this);
|
||||||
|
@ -86,6 +87,14 @@ MainWindow::MainWindow(const QString &gamePath, GameData *data)
|
||||||
dummyWidget->addWidget(partHolder);
|
dummyWidget->addWidget(partHolder);
|
||||||
|
|
||||||
refreshParts({});
|
refreshParts({});
|
||||||
|
|
||||||
|
setupActions();
|
||||||
|
setupGUI(Keys | Save | Create, QStringLiteral("dataexplorer.rc"));
|
||||||
|
|
||||||
|
// We don't provide help (yet)
|
||||||
|
actionCollection()->removeAction(actionCollection()->action(KStandardAction::name(KStandardAction::HelpContents)));
|
||||||
|
// This isn't KDE software
|
||||||
|
actionCollection()->removeAction(actionCollection()->action(KStandardAction::name(KStandardAction::AboutKDE)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::refreshParts(const QString &path)
|
void MainWindow::refreshParts(const QString &path)
|
||||||
|
@ -177,9 +186,9 @@ void MainWindow::refreshParts(const QString &path)
|
||||||
partHolder->tabBar()->setExpanding(true);
|
partHolder->tabBar()->setExpanding(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::setupFileMenu(QMenu *menu)
|
void MainWindow::setupActions()
|
||||||
{
|
{
|
||||||
auto openList = menu->addAction(i18nc("@action:inmenu", "Import Path List…"));
|
auto openList = new QAction(i18nc("@action:inmenu", "Import Path List…"));
|
||||||
openList->setIcon(QIcon::fromTheme(QStringLiteral("document-open")));
|
openList->setIcon(QIcon::fromTheme(QStringLiteral("document-open")));
|
||||||
connect(openList, &QAction::triggered, [this] {
|
connect(openList, &QAction::triggered, [this] {
|
||||||
auto fileName = QFileDialog::getOpenFileName(nullptr, i18nc("@title:window", "Open Path List"), QStringLiteral("~"));
|
auto fileName = QFileDialog::getOpenFileName(nullptr, i18nc("@title:window", "Open Path List"), QStringLiteral("~"));
|
||||||
|
@ -199,8 +208,9 @@ void MainWindow::setupFileMenu(QMenu *menu)
|
||||||
|
|
||||||
QMessageBox::information(this, i18nc("@title:window", "Import Complete"), i18n("Successfully imported path list!"), QMessageBox::Ok, QMessageBox::Ok);
|
QMessageBox::information(this, i18nc("@title:window", "Import Complete"), i18n("Successfully imported path list!"), QMessageBox::Ok, QMessageBox::Ok);
|
||||||
});
|
});
|
||||||
|
actionCollection()->addAction(QStringLiteral("import_list"), openList);
|
||||||
|
|
||||||
auto downloadList = menu->addAction(i18nc("@action:inmenu", "Download Path List…"));
|
auto downloadList = new QAction(i18nc("@action:inmenu", "Download Path List…"));
|
||||||
downloadList->setIcon(QIcon::fromTheme(QStringLiteral("download-symbolic")));
|
downloadList->setIcon(QIcon::fromTheme(QStringLiteral("download-symbolic")));
|
||||||
connect(downloadList, &QAction::triggered, [this] {
|
connect(downloadList, &QAction::triggered, [this] {
|
||||||
const int ret =
|
const int ret =
|
||||||
|
@ -253,4 +263,5 @@ void MainWindow::setupFileMenu(QMenu *menu)
|
||||||
QMessageBox::Ok);
|
QMessageBox::Ok);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
actionCollection()->addAction(QStringLiteral("download_list"), downloadList);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "novusmainwindow.h"
|
#include <KXmlGuiWindow>
|
||||||
|
|
||||||
class MainWindow : public NovusMainWindow
|
class MainWindow : public KXmlGuiWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
KLocalizedString::setApplicationDomain(QByteArrayLiteral("novus"));
|
KLocalizedString::setApplicationDomain(QByteArrayLiteral("novus"));
|
||||||
|
|
||||||
customizeAboutData(QStringLiteral("launcher"),
|
customizeAboutData(QStringLiteral("novus"),
|
||||||
QStringLiteral("zone.xiv.novus"),
|
QStringLiteral("zone.xiv.novus"),
|
||||||
QStringLiteral("Novus SDK"),
|
QStringLiteral("Novus SDK"),
|
||||||
i18n("Handles setting up and launching various Novus SDK components."));
|
i18n("Handles setting up and launching various Novus SDK components."));
|
||||||
|
|
|
@ -30,10 +30,8 @@ static QMap<QString, QString> links = {{QStringLiteral("XIV Dev Wiki"), QStringL
|
||||||
{QStringLiteral("XIV Docs"), QStringLiteral("https://docs.xiv.zone")}};
|
{QStringLiteral("XIV Docs"), QStringLiteral("https://docs.xiv.zone")}};
|
||||||
|
|
||||||
MainWindow::MainWindow()
|
MainWindow::MainWindow()
|
||||||
: NovusMainWindow()
|
: KXmlGuiWindow()
|
||||||
{
|
{
|
||||||
setupMenubar();
|
|
||||||
|
|
||||||
auto appList = new QListWidget();
|
auto appList = new QListWidget();
|
||||||
|
|
||||||
auto applicationHeader = new QListWidgetItem();
|
auto applicationHeader = new QListWidgetItem();
|
||||||
|
@ -102,6 +100,9 @@ MainWindow::MainWindow()
|
||||||
centralWidget->setLayout(mainLayout);
|
centralWidget->setLayout(mainLayout);
|
||||||
|
|
||||||
setCentralWidget(centralWidget);
|
setCentralWidget(centralWidget);
|
||||||
|
|
||||||
|
// setupGUI(StandardWindowOption::ToolBar | StandardWindowOption::Keys | StandardWindowOption::StatusBar | StandardWindowOption::Save);
|
||||||
|
createGUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "moc_mainwindow.cpp"
|
#include "moc_mainwindow.cpp"
|
|
@ -11,7 +11,6 @@ target_sources(novus-common
|
||||||
include/aboutdata.h
|
include/aboutdata.h
|
||||||
include/filecache.h
|
include/filecache.h
|
||||||
include/filetypes.h
|
include/filetypes.h
|
||||||
include/novusmainwindow.h
|
|
||||||
include/quaternionedit.h
|
include/quaternionedit.h
|
||||||
include/settings.h
|
include/settings.h
|
||||||
include/vec3edit.h
|
include/vec3edit.h
|
||||||
|
@ -19,7 +18,6 @@ target_sources(novus-common
|
||||||
src/aboutdata.cpp
|
src/aboutdata.cpp
|
||||||
src/filecache.cpp
|
src/filecache.cpp
|
||||||
src/filetypes.cpp
|
src/filetypes.cpp
|
||||||
src/novusmainwindow.cpp
|
|
||||||
src/quaternionedit.cpp
|
src/quaternionedit.cpp
|
||||||
src/settings.cpp
|
src/settings.cpp
|
||||||
src/vec3edit.cpp)
|
src/vec3edit.cpp)
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
|
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <QMainWindow>
|
|
||||||
|
|
||||||
#include "novuscommon_export.h"
|
|
||||||
|
|
||||||
class NOVUSCOMMON_EXPORT NovusMainWindow : public QMainWindow
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit NovusMainWindow();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void setupMenubar();
|
|
||||||
|
|
||||||
virtual void setupFileMenu(QMenu *menu)
|
|
||||||
{
|
|
||||||
Q_UNUSED(menu)
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void setupAdditionalMenus(QMenuBar *menuBar)
|
|
||||||
{
|
|
||||||
Q_UNUSED(menuBar)
|
|
||||||
}
|
|
||||||
};
|
|
|
@ -88,7 +88,7 @@ void customizeAboutData(const QString &componentName, const QString &desktopFile
|
||||||
{},
|
{},
|
||||||
QStringLiteral("https://github.com/Neargye/magic_enum"),
|
QStringLiteral("https://github.com/Neargye/magic_enum"),
|
||||||
KAboutLicense::MIT);
|
KAboutLicense::MIT);
|
||||||
about.setBugAddress(QByteArrayLiteral("https://lists.sr.ht/~redstrate/public-inbox"));
|
about.setBugAddress(QByteArrayLiteral("https://github.com/redstrate/Novus/issues"));
|
||||||
about.setComponentName(componentName);
|
about.setComponentName(componentName);
|
||||||
about.setProgramLogo(desktopFilename);
|
about.setProgramLogo(desktopFilename);
|
||||||
about.setDesktopFileName(desktopFilename);
|
about.setDesktopFileName(desktopFilename);
|
||||||
|
|
|
@ -1,53 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
|
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
#include "novusmainwindow.h"
|
|
||||||
|
|
||||||
#include <KAboutApplicationDialog>
|
|
||||||
#include <KAboutData>
|
|
||||||
#include <KLocalizedString>
|
|
||||||
#include <QApplication>
|
|
||||||
#include <QDesktopServices>
|
|
||||||
#include <QMenuBar>
|
|
||||||
|
|
||||||
NovusMainWindow::NovusMainWindow()
|
|
||||||
{
|
|
||||||
setWindowTitle(KAboutData::applicationData().displayName());
|
|
||||||
}
|
|
||||||
|
|
||||||
void NovusMainWindow::setupMenubar()
|
|
||||||
{
|
|
||||||
auto fileMenu = menuBar()->addMenu(i18nc("@title:menu", "File"));
|
|
||||||
|
|
||||||
setupFileMenu(fileMenu);
|
|
||||||
if (!fileMenu->isEmpty()) {
|
|
||||||
fileMenu->addSeparator();
|
|
||||||
}
|
|
||||||
|
|
||||||
auto quitAction = fileMenu->addAction(i18nc("@action:inmenu", "Quit"));
|
|
||||||
quitAction->setIcon(QIcon::fromTheme(QStringLiteral("gtk-quit")));
|
|
||||||
connect(quitAction, &QAction::triggered, qApp, &QCoreApplication::quit);
|
|
||||||
|
|
||||||
setupAdditionalMenus(menuBar());
|
|
||||||
|
|
||||||
auto helpMenu = menuBar()->addMenu(i18nc("@title:menu", "Help"));
|
|
||||||
|
|
||||||
auto donateAction = helpMenu->addAction(i18nc("@action:inmenu", "Donate"));
|
|
||||||
connect(donateAction, &QAction::triggered, this, [] {
|
|
||||||
QDesktopServices::openUrl(QUrl(QStringLiteral("https://redstrate.com/fund")));
|
|
||||||
});
|
|
||||||
donateAction->setIcon(QIcon::fromTheme(QStringLiteral("help-donate")));
|
|
||||||
|
|
||||||
helpMenu->addSeparator();
|
|
||||||
|
|
||||||
auto aboutNovusAction = helpMenu->addAction(i18nc("@action:inmenu About application", "About %1", KAboutData::applicationData().displayName()));
|
|
||||||
aboutNovusAction->setIcon(QIcon::fromTheme(QStringLiteral("help-about")));
|
|
||||||
connect(aboutNovusAction, &QAction::triggered, this, [this] {
|
|
||||||
auto window = new KAboutApplicationDialog(KAboutData::applicationData(), this);
|
|
||||||
window->show();
|
|
||||||
});
|
|
||||||
|
|
||||||
auto aboutQtAction = helpMenu->addAction(i18nc("@action:inmenu", "About Qt"));
|
|
||||||
aboutQtAction->setIcon(QIcon(QStringLiteral(":/qt-project.org/qmessagebox/images/qtlogo-64.png")));
|
|
||||||
connect(aboutQtAction, &QAction::triggered, QApplication::instance(), &QApplication::aboutQt);
|
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue