[nostalgia] Port to Qt6

This commit is contained in:
Gary Talent 2021-03-30 20:35:42 -05:00
parent 37c3f117fe
commit 5bb98747a9
9 changed files with 17 additions and 19 deletions

View File

@ -3,8 +3,8 @@
if(NOSTALGIA_BUILD_TYPE STREQUAL "Native")
if(NOSTALGIA_BUILD_STUDIO)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5QuickWidgets REQUIRED)
find_package(Qt6Widgets REQUIRED)
find_package(Qt6QuickWidgets REQUIRED)
endif()
endif()

View File

@ -56,7 +56,6 @@ ox::Error modelRead(T *io, GbaPaletteTarget *t) {
template<typename T>
ox::Error modelRead(T *io, GbaTileMapTarget *t) {
io->template setTypeInfo<GbaTileMapTarget>();
uint8_t bpp;
int dummy;
oxReturnError(io->field("bpp", &bpp));

View File

@ -21,8 +21,8 @@ endif()
target_link_libraries(
NostalgiaCore-Studio
Qt5::Core
Qt5::QuickWidgets
Qt6::Core
Qt6::QuickWidgets
NostalgiaStudio
NostalgiaCore-Qt
NostalgiaCore

View File

@ -630,7 +630,7 @@ void SheetData::modGteCmd(int color, int mod) {
for (int i = 0; i < m_pixels.size(); ++i) {
const auto p = m_pixels[i];
if (p >= color) {
const auto mx = (m_palette.size() - p) - 1;
const int mx = (m_palette.size() - p) - 1;
cmd->addPixel(i, std::clamp(mod, -p, mx));
}
}
@ -666,15 +666,15 @@ std::unique_ptr<NostalgiaGraphic> SheetData::toNostalgiaGraphic() const {
ng->pixels.resize(pixelCount / 2);
for (std::size_t i = 0; i < pixelCount && i < static_cast<std::size_t>(m_pixels.size()); ++i) {
if (i & 1) {
ng->pixels[i / 2] |= static_cast<uint8_t>(m_pixels[i]) << 4;
ng->pixels[i / 2] |= static_cast<uint8_t>(m_pixels[static_cast<std::intptr_t>(i)]) << 4;
} else {
ng->pixels[i / 2] = static_cast<uint8_t>(m_pixels[i]);
ng->pixels[i / 2] = static_cast<uint8_t>(m_pixels[static_cast<std::intptr_t>(i)]);
}
}
} else {
ng->pixels.resize(pixelCount);
for (std::size_t i = 0; i < ng->pixels.size(); ++i) {
ng->pixels[i] = static_cast<uint8_t>(m_pixels[i]);
ng->pixels[i] = static_cast<uint8_t>(m_pixels[static_cast<std::intptr_t>(i)]);
}
}
return ng;

View File

@ -53,7 +53,7 @@ add_executable(
target_link_libraries(
NostalgiaStudioJsonTest
OxStd
Qt5::Widgets
Qt6::Widgets
)
add_test("[nostalgia/studio] NostalgiaStudioJson" NostalgiaStudioJsonTest)

View File

@ -17,7 +17,7 @@ target_include_directories(NostalgiaStudio PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(
NostalgiaStudio PUBLIC
Qt5::Widgets
Qt6::Widgets
OxFS
OxClaw
)

View File

@ -8,6 +8,7 @@
#include <QApplication>
#include <QDebug>
#include <QQuickWindow>
#include <ox/clargs/clargs.hpp>
#include <ox/std/trace.hpp>
#include <qdark/theme.hpp>
@ -17,18 +18,17 @@ using namespace nostalgia::studio;
int main(int argc, char **args) {
ox::trace::init();
// get profile path from command args
ox::ClArgs clargs(argc, const_cast<const char**>(args));
QString argProfilePath = clargs.getString("profile", ":/profiles/nostalgia-studio.json").c_str();
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication app(argc, args);
// load theme
if constexpr(ox::defines::OS != ox::defines::OS::Darwin) {
qdark::load(&app);
}
// force QtQuick to use OpenGL (https://doc.qt.io/qt-6/quick-changes-qt6.html#changes-to-qquickwidget)
QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGLRhi);
// open window
try {
MainWindow w(argProfilePath);
app.setApplicationName(w.windowTitle());

View File

@ -8,7 +8,6 @@
#include <QApplication>
#include <QDebug>
#include <QDesktopWidget>
#include <QDialog>
#include <QFileDialog>
#include <QGridLayout>

View File

@ -9,8 +9,8 @@ add_library(
target_link_libraries(
NostalgiaWorld-Studio
Qt5::Core
Qt5::Widgets
Qt6::Core
Qt6::Widgets
NostalgiaStudio
)