Compare commits

..

No commits in common. "d69e4e13fa0eb451b6ee36dee3bad50874d090d9" and "aa2ed50adecd940e0bb68bf84437691508a13bed" have entirely different histories.

15 changed files with 55 additions and 153 deletions

View File

@ -51,7 +51,7 @@ jobs:
- name: Install Qt - name: Install Qt
uses: jurplel/install-qt-action@v4 uses: jurplel/install-qt-action@v4
with: with:
version: '6.7.2' version: '6.5.2'
- name: Install CMake - name: Install CMake
uses: lukka/get-cmake@latest uses: lukka/get-cmake@latest
@ -94,7 +94,7 @@ jobs:
- name: Install Qt - name: Install Qt
uses: jurplel/install-qt-action@v4 uses: jurplel/install-qt-action@v4
with: with:
version: '6.7.2' version: '6.5.2'
- name: Install CMake - name: Install CMake
uses: lukka/get-cmake@latest uses: lukka/get-cmake@latest

View File

@ -40,9 +40,6 @@ file(GLOB_RECURSE TABS_SOURCES ui/tabs/*.cpp)
file(GLOB_RECURSE MODELS_HEADERS ui/models/*.h) file(GLOB_RECURSE MODELS_HEADERS ui/models/*.h)
file(GLOB_RECURSE MODELS_SOURCES ui/models/*.cpp) file(GLOB_RECURSE MODELS_SOURCES ui/models/*.cpp)
## Utils
file(GLOB_RECURSE UTILS_HEADERS ui/utils/*.h)
## NDSFactory ## NDSFactory
file(GLOB_RECURSE NDSFACTORY_SOURCES ndsfactory/*.cpp) file(GLOB_RECURSE NDSFACTORY_SOURCES ndsfactory/*.cpp)
file(GLOB_RECURSE NDSFACTORY_HEADERS ndsfactory/*.h) file(GLOB_RECURSE NDSFACTORY_HEADERS ndsfactory/*.h)
@ -62,7 +59,6 @@ SET(HEADERS
${TABS_HEADERS} ${TABS_HEADERS}
${MODELS_HEADERS} ${MODELS_HEADERS}
${DIALOGS_HEADERS} ${DIALOGS_HEADERS}
${UTILS_HEADERS}
) )
set(FORMS set(FORMS

View File

@ -1,23 +1,13 @@
#include "ui/mainwindow.h" #include "ui/mainwindow.h"
#include <QApplication> #include <QApplication>
#include <QStyleFactory> #include <QStyleFactory>
#include "ui/utils/theme.h"
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QApplication::setStyle(QStyleFactory::create("Fusion")); QApplication::setStyle(QStyleFactory::create("Fusion"));
QApplication app(argc, argv); QApplication a(argc, argv);
app.setApplicationName("NDSFactory"); MainWindow w;
app.setOrganizationName("NDSFactory"); w.show();
QString theme = getCurrentTheme(); return a.exec();
if(theme == "dark")
setDarkTheme(app);
else if(theme == "light")
setLightTheme(app);
MainWindow mainWindow;
mainWindow.show();
return app.exec();
} }

View File

@ -1,4 +1,5 @@
#pragma once #ifndef CRCTABLE_H
#define CRCTABLE_H
#include <cstdint> #include <cstdint>
@ -38,3 +39,5 @@ static const uint16_t lCRCTable[] =
0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641, 0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641,
0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040 0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040
}; };
#endif // CRCTABLE_H

View File

@ -1,4 +1,5 @@
#pragma once #ifndef FATSTRUCT_H
#define FATSTRUCT_H
#include <cstdint> #include <cstdint>
@ -6,3 +7,5 @@ struct FatRange {
uint32_t startAddr; uint32_t startAddr;
uint32_t endAddr; uint32_t endAddr;
}; };
#endif // FATSTRUCT_H

View File

@ -1,4 +1,5 @@
#pragma once #ifndef NDSFACTORY_H
#define NDSFACTORY_H
#include <string> #include <string>
#include <vector> #include <vector>
@ -28,3 +29,4 @@ private:
}; };
#endif // NDSFACTORY_H

View File

@ -1,4 +1,5 @@
#pragma once #ifndef NDSHEADER_H
#define NDSHEADER_H
#include <cstdint> #include <cstdint>
@ -68,3 +69,5 @@ struct NDSHeader
unsigned char Reserved4[0x90]; unsigned char Reserved4[0x90];
}; };
#pragma pack(pop) #pragma pack(pop)
#endif // NDSHEADER_H

View File

@ -1,4 +1,5 @@
#pragma once #ifndef ABOUTDIALOG_H
#define ABOUTDIALOG_H
#include <QDialog> #include <QDialog>
@ -17,3 +18,5 @@ class AboutDialog : public QDialog
Ui::AboutDialog *ui; Ui::AboutDialog *ui;
}; };
#endif // ABOUTDIALOG_H

View File

@ -1,6 +1,6 @@
#ifndef REVISION_H #ifndef REVISION_H
#define REVISION_H #define REVISION_H
#define GIT_COMMIT_HASH "aa2ed50" #define GIT_COMMIT_HASH "c7eaa8e"
#endif #endif

View File

@ -2,7 +2,6 @@
#include "mainwindow.h" #include "mainwindow.h"
#include "ui_mainwindow.h" #include "ui_mainwindow.h"
#include "dialogs/about/aboutdialog.h" #include "dialogs/about/aboutdialog.h"
#include "utils/theme.h"
MainWindow::MainWindow(QWidget *parent) : MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent), QMainWindow(parent),
@ -27,18 +26,3 @@ void MainWindow::on_actionAbout_triggered()
AboutDialog aboutDialog; AboutDialog aboutDialog;
aboutDialog.exec(); aboutDialog.exec();
} }
void MainWindow::on_actionDark_triggered()
{
setTheme("dark");
}
void MainWindow::on_actionLight_triggered()
{
setTheme("light");
}
void MainWindow::on_actionDefault_triggered()
{
setTheme("default");
}

View File

@ -1,4 +1,5 @@
#pragma once #ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow> #include <QMainWindow>
#include <cstdint> #include <cstdint>
@ -34,9 +35,6 @@ private slots:
void on_unpackerDecodeFatFilesBtn_clicked(); void on_unpackerDecodeFatFilesBtn_clicked();
void notifyExtractionResult(bool result); void notifyExtractionResult(bool result);
void on_actionDark_triggered();
void on_actionLight_triggered();
void on_actionDefault_triggered();
void on_actionExit_triggered(); void on_actionExit_triggered();
void on_actionAbout_triggered(); void on_actionAbout_triggered();
@ -115,3 +113,5 @@ private:
bool patchFat(const std::string& loadPath, uint32_t shiftSize, const std::string& savePath); bool patchFat(const std::string& loadPath, uint32_t shiftSize, const std::string& savePath);
}; };
#endif // MAINWINDOW_H

View File

@ -617,27 +617,23 @@
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_15"> <layout class="QVBoxLayout" name="verticalLayout_15">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_5"> <widget class="QLabel" name="label_83">
<item> <property name="sizePolicy">
<widget class="QLabel" name="label_83"> <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<property name="sizePolicy"> <horstretch>0</horstretch>
<sizepolicy hsizetype="Minimum" vsizetype="Minimum"> <verstretch>0</verstretch>
<horstretch>0</horstretch> </sizepolicy>
<verstretch>0</verstretch> </property>
</sizepolicy> <property name="text">
</property> <string>If the address of the fat_data.bin file is different from the original location in ROM, you need to patch the fat.bin file...</string>
<property name="text"> </property>
<string>If the address of the fat_data.bin file is different from the original location in ROM, you need to patch the fat.bin file...</string> <property name="scaledContents">
</property> <bool>false</bool>
<property name="scaledContents"> </property>
<bool>false</bool> <property name="alignment">
</property> <set>Qt::AlignmentFlag::AlignCenter</set>
<property name="alignment"> </property>
<set>Qt::AlignmentFlag::AlignCenter</set> </widget>
</property>
</widget>
</item>
</layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_35"> <layout class="QHBoxLayout" name="horizontalLayout_35">
@ -764,15 +760,6 @@
<property name="title"> <property name="title">
<string>File</string> <string>File</string>
</property> </property>
<widget class="QMenu" name="menuTheme">
<property name="title">
<string>Theme</string>
</property>
<addaction name="actionDark"/>
<addaction name="actionLight"/>
<addaction name="actionDefault"/>
</widget>
<addaction name="menuTheme"/>
<addaction name="actionExit"/> <addaction name="actionExit"/>
</widget> </widget>
<widget class="QMenu" name="menuHelp"> <widget class="QMenu" name="menuHelp">
@ -799,21 +786,6 @@
<string>Exit</string> <string>Exit</string>
</property> </property>
</action> </action>
<action name="actionDark">
<property name="text">
<string>Dark</string>
</property>
</action>
<action name="actionLight">
<property name="text">
<string>Light</string>
</property>
</action>
<action name="actionDefault">
<property name="text">
<string>Default</string>
</property>
</action>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<resources/> <resources/>

View File

@ -1,4 +1,5 @@
#pragma once #ifndef NDSHEADERMODEL_H
#define NDSHEADERMODEL_H
#include <QAbstractTableModel> #include <QAbstractTableModel>
@ -20,3 +21,5 @@ private:
NDSHeader *ndsHeader; NDSHeader *ndsHeader;
bool isValueRowEditable = false; bool isValueRowEditable = false;
}; };
#endif // NDSHEADERMODEL_H

View File

@ -1,4 +1,5 @@
#pragma once #ifndef HEADERNAMES_H
#define HEADERNAMES_H
#include <array> #include <array>
#include <string> #include <string>
@ -51,3 +52,5 @@ namespace NDSHeaderNames {
FATFilesAddress FATFilesAddress
}; };
} }
#endif // HEADERNAMES_H

View File

@ -1,60 +0,0 @@
#pragma once
#include <QApplication>
#include <QPalette>
#include <QSettings>
#include <QMessageBox>
inline void setDarkTheme(QApplication& app)
{
QPalette darkPalette;
darkPalette.setColor(QPalette::Window, QColor(53, 53, 53));
darkPalette.setColor(QPalette::WindowText, Qt::white);
darkPalette.setColor(QPalette::Base, QColor(35, 35, 35));
darkPalette.setColor(QPalette::AlternateBase, QColor(53, 53, 53));
darkPalette.setColor(QPalette::ToolTipBase, Qt::white);
darkPalette.setColor(QPalette::ToolTipText, Qt::white);
darkPalette.setColor(QPalette::Text, Qt::white);
darkPalette.setColor(QPalette::Button, QColor(53, 53, 53));
darkPalette.setColor(QPalette::ButtonText, Qt::white);
darkPalette.setColor(QPalette::BrightText, Qt::red);
darkPalette.setColor(QPalette::Link, QColor(42, 130, 218));
darkPalette.setColor(QPalette::Highlight, QColor(42, 130, 218));
darkPalette.setColor(QPalette::HighlightedText, Qt::black);
app.setPalette(darkPalette);
}
inline void setLightTheme(QApplication& app)
{
QPalette lightPalette;
lightPalette.setColor(QPalette::Window, QColor(240, 240, 240));
lightPalette.setColor(QPalette::WindowText, Qt::black);
lightPalette.setColor(QPalette::Base, QColor(255, 255, 255));
lightPalette.setColor(QPalette::AlternateBase, QColor(233, 233, 233));
lightPalette.setColor(QPalette::ToolTipBase, Qt::black);
lightPalette.setColor(QPalette::ToolTipText, Qt::white);
lightPalette.setColor(QPalette::Text, Qt::black);
lightPalette.setColor(QPalette::Button, QColor(240, 240, 240));
lightPalette.setColor(QPalette::ButtonText, Qt::black);
lightPalette.setColor(QPalette::BrightText, Qt::red);
lightPalette.setColor(QPalette::Link, QColor(42, 130, 218));
lightPalette.setColor(QPalette::Highlight, QColor(42, 130, 218));
lightPalette.setColor(QPalette::HighlightedText, Qt::white);
app.setPalette(lightPalette);
}
inline void setTheme(QString themeValue)
{
QSettings settings;
settings.setValue("theme", themeValue);
QMessageBox::information(nullptr, "NDS Factory", "Restart NDSFactory to change theme!");
}
inline QString getCurrentTheme()
{
QSettings settings;
return settings.value("theme", "default").toString();
}