diff --git a/.github/workflows/windows-ci.yaml b/.github/workflows/windows-ci.yaml index 095365c..0bf937c 100644 --- a/.github/workflows/windows-ci.yaml +++ b/.github/workflows/windows-ci.yaml @@ -8,8 +8,22 @@ jobs: strategy: matrix: cfg: - - { os: windows-2019, generator: Visual Studio 16 2019, cmake-arch: Win32, triplet: x86-windows-static-md, kf5: v5.106.0, qt: 5.15.2, qt-arch: win32_msvc2019 } - - { os: windows-2019, generator: Visual Studio 16 2019, cmake-arch: x64, triplet: x64-windows-static-md, kf5: v5.106.0, qt: 5.15.2, qt_arch: win64_msvc2019_64 } + - os: windows-2019 + generator: Visual Studio 16 2019 + cmake-arch: Win32 + triplet: x86-windows-static-md + kf5: v5.106.0 + qt: 5.15.2 + kf5_cmake_args: "" + qt-arch: win32_msvc2019 + - os: windows-2019 + generator: Visual Studio 16 2019 + cmake-arch: x64 + triplet: x64-windows-static-md + kf5: v5.106.0 + kf5_cmake_args: "-DBUILD_WITH_QT6=ON" + qt: 6.5.1 + qt_arch: win64_msvc2019_64 steps: - uses: actions/checkout@v3 @@ -76,7 +90,7 @@ jobs: -G "${{ matrix.cfg.generator }}" -A ${{ matrix.cfg.cmake-arch }} ` -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}\install ` -DBUILD_HTML_DOCS=OFF -DBUILD_MAN_DOCS=OFF -DBUILD_QTHELP_DOCS=OFF -DBUILD_TESTING=OFF ` - .. + ${{ matrix.cfg.kf5_cmake_args }} .. cmake --build . --config Release -j 2 cmake --build . --config Release --target INSTALL @@ -97,7 +111,7 @@ jobs: -G "${{ matrix.cfg.generator }}" -A ${{ matrix.cfg.cmake-arch }} ` -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}\install ` -DBUILD_HTML_DOCS=OFF -DBUILD_MAN_DOCS=OFF -DBUILD_QTHELP_DOCS=OFF -DBUILD_TESTING=OFF ` - .. + ${{ matrix.cfg.kf5_cmake_args }} .. cmake --build . --config Release -j 2 cmake --build . --config Release --target INSTALL @@ -134,11 +148,10 @@ jobs: - name: Deploy Qt run: | - cd ${{ env.Qt5_Dir }}\bin $ExeFiles = Get-ChildItem "${{ github.workspace }}\install\bin" -Filter *.exe $DllFiles = Get-ChildItem "${{ github.workspace }}\install\bin" -Filter *.dll ForEach-Object -InputObject ($ExeFiles + $DllFiles) { - ./windeployqt.exe --release $_.FullName + windeployqt.exe --release $_.FullName } - name: Upload Artifacts diff --git a/CMakeLists.txt b/CMakeLists.txt index 5460f82..6d9de03 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.7) project(PlasmaShop) set(CMAKE_CXX_STANDARD 14) @@ -6,6 +6,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_AUTOMOC TRUE) +set(CMAKE_AUTORCC TRUE) if(POLICY CMP0071) # Don't run generated source files (bytes/python_*.cpp) through automoc @@ -14,10 +15,22 @@ endif() find_package(HSPlasma REQUIRED) find_package(string_theory 2.0 REQUIRED) -find_package(Qt5 5.8 REQUIRED COMPONENTS Core Gui Widgets) -find_package(KF5SyntaxHighlighting REQUIRED) find_package(PythonInterp REQUIRED) +if(NOT DEFINED QT_VERSION_MAJOR) + find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core) +endif() +find_package(Qt${QT_VERSION_MAJOR} 5.10 REQUIRED COMPONENTS Core Widgets) +if(Qt5_FOUND AND NOT TARGET Qt::Core) + # The version-generic targets were only added in Qt 5.15 + foreach(_qt_lib Core Widgets) + add_library(Qt::${_qt_lib} INTERFACE IMPORTED) + set_target_properties(Qt::${_qt_lib} PROPERTIES + INTERFACE_LINK_LIBRARIES "Qt5::${_qt_lib}") + endforeach() +endif() + +find_package(KF5SyntaxHighlighting REQUIRED) if(KF5SyntaxHighlighting_VERSION VERSION_LESS "5.39.0") message(WARNING "KF5SyntaxHighlighting version 5.39.0 or later is required \ in order to use custom highlighting rules. KF5SyntaxHighlighting version \ @@ -61,7 +74,6 @@ endif() add_definitions(-DPLASMASHOP_VERSION="${PlasmaShop_VERSION}") set(QTEXTPAD_WIDGET_ONLY ON) -set(QT_VERSION_MAJOR 5) add_subdirectory(qtextpad) include_directories("${CMAKE_CURRENT_SOURCE_DIR}/qtextpad/lib") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a01020a..316f7e2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -21,7 +21,7 @@ set(PSCommon_Sources ) add_library(PSCommon STATIC ${PSCommon_Headers} ${PSCommon_Sources}) -target_link_libraries(PSCommon PUBLIC HSPlasma Qt5::Widgets syntaxtextedit) +target_link_libraries(PSCommon PUBLIC HSPlasma Qt::Widgets syntaxtextedit) add_subdirectory(PlasmaShop) add_subdirectory(PrpShop) diff --git a/src/PlasmaShop/CMakeLists.txt b/src/PlasmaShop/CMakeLists.txt index 95dddae..6891e95 100644 --- a/src/PlasmaShop/CMakeLists.txt +++ b/src/PlasmaShop/CMakeLists.txt @@ -124,15 +124,15 @@ if(WIN32) endif() # generate rules for building source files from the resources -qt5_add_resources(PlasmaShop_RCC images.qrc PlasmaSyntax.qrc) +set(PlasmaShop_QRC images.qrc PlasmaSyntax.qrc) include_directories("${pycdc_SOURCE_DIR}") add_executable(PlasmaShop WIN32 MACOSX_BUNDLE ${PlasmaShop_Headers} ${PlasmaShop_Sources} ${pycdc_Headers} ${pycdc_Sources} ${pycdc_GeneratedSources} - ${PlasmaShop_RCC}) -target_link_libraries(PlasmaShop PSCommon Qt5::Core Qt5::Widgets) + ${PlasmaShop_QRC}) +target_link_libraries(PlasmaShop PSCommon Qt::Core Qt::Widgets) target_link_libraries(PlasmaShop HSPlasma) if(WIN32) diff --git a/src/PlasmaShop/Main.cpp b/src/PlasmaShop/Main.cpp index 13e1a46..2d515e7 100644 --- a/src/PlasmaShop/Main.cpp +++ b/src/PlasmaShop/Main.cpp @@ -89,22 +89,22 @@ PlasmaShopMain::PlasmaShopMain() fActions[kTreeRename] = new QAction(tr("&Rename"), this); fActions[kTreeDelete] = new QAction(tr("&Delete"), this); - fActions[kFileNew]->setShortcut(Qt::CTRL + Qt::Key_N); - fActions[kFileOpen]->setShortcut(Qt::CTRL + Qt::Key_O); - fActions[kFileSave]->setShortcut(Qt::CTRL + Qt::Key_S); - fActions[kFileSaveAs]->setShortcut(Qt::SHIFT + Qt::CTRL + Qt::Key_S); + fActions[kFileNew]->setShortcut(Qt::CTRL | Qt::Key_N); + fActions[kFileOpen]->setShortcut(Qt::CTRL | Qt::Key_O); + fActions[kFileSave]->setShortcut(Qt::CTRL | Qt::Key_S); + fActions[kFileSaveAs]->setShortcut(Qt::SHIFT | Qt::CTRL | Qt::Key_S); fActions[kFileRevert]->setShortcut(Qt::Key_F5); - fActions[kFileExit]->setShortcut(Qt::ALT + Qt::Key_F4); - fActions[kEditUndo]->setShortcut(Qt::CTRL + Qt::Key_Z); - fActions[kEditRedo]->setShortcut(Qt::SHIFT + Qt::CTRL + Qt::Key_Z); - fActions[kEditCut]->setShortcut(Qt::CTRL + Qt::Key_X); - fActions[kEditCopy]->setShortcut(Qt::CTRL + Qt::Key_C); - fActions[kEditPaste]->setShortcut(Qt::CTRL + Qt::Key_V); + fActions[kFileExit]->setShortcut(Qt::ALT | Qt::Key_F4); + fActions[kEditUndo]->setShortcut(Qt::CTRL | Qt::Key_Z); + fActions[kEditRedo]->setShortcut(Qt::SHIFT | Qt::CTRL | Qt::Key_Z); + fActions[kEditCut]->setShortcut(Qt::CTRL | Qt::Key_X); + fActions[kEditCopy]->setShortcut(Qt::CTRL | Qt::Key_C); + fActions[kEditPaste]->setShortcut(Qt::CTRL | Qt::Key_V); fActions[kEditDelete]->setShortcut(Qt::Key_Delete); - fActions[kEditSelectAll]->setShortcut(Qt::CTRL + Qt::Key_A); - fActions[kTextFind]->setShortcut(Qt::CTRL + Qt::Key_F); + fActions[kEditSelectAll]->setShortcut(Qt::CTRL | Qt::Key_A); + fActions[kTextFind]->setShortcut(Qt::CTRL | Qt::Key_F); fActions[kTextFindNext]->setShortcut(Qt::Key_F3); - fActions[kTextReplace]->setShortcut(Qt::CTRL + Qt::Key_R); + fActions[kTextReplace]->setShortcut(Qt::CTRL | Qt::Key_R); fActions[kFileShowBrowser]->setCheckable(true); fActions[kTextStxNone]->setCheckable(true); @@ -312,16 +312,10 @@ void PlasmaShopMain::loadFile(QString filename) } // Guess the filetype based on its extension - QString ext, fnameNoPath, fnameDisplay = filename; - QRegExp re; - re.setPattern(".*\\.([^\\.]*)"); - if (re.indexIn(filename) >= 0) - ext = re.cap(1).toLower(); - re.setPattern("(.*[\\\\\\/])?([^\\\\\\/]*)"); - if (re.indexIn(filename) >= 0) { - fnameNoPath = re.cap(2).toLower(); - fnameDisplay = re.cap(2); - } + QFileInfo fileInfo(filename); + QString ext = fileInfo.suffix().toLower(); + QString fnameDisplay = fileInfo.fileName(); + QString fnameNoPath = fnameDisplay.toLower(); DocumentType dtype = kDocUnknown; if (ext == "age" || ext == "cfg" || ext == "csv" || ext == "elf" || @@ -371,7 +365,7 @@ void PlasmaShopMain::loadFile(QString filename) } else { QMessageBox::critical(this, tr("Unsupported File Type"), tr("Error: File %1 has an unsupported file type (%2)") - .arg(fnameNoPath).arg(ext), + .arg(fnameDisplay).arg(ext), QMessageBox::Ok); return; } @@ -424,7 +418,7 @@ void PlasmaShopMain::loadFile(QString filename) } else { QMessageBox::critical(this, tr("Oops"), tr("No editor is currently available for %1") - .arg(fnameNoPath), QMessageBox::Ok); + .arg(fnameDisplay), QMessageBox::Ok); } } @@ -676,14 +670,7 @@ void PlasmaShopMain::onSaveAs() return; QPlasmaDocument* doc = (QPlasmaDocument*)fEditorPane->currentWidget(); - QString ext, fnameNoPath; - QRegExp re; - re.setPattern(".*\\.([^.]*)"); - if (re.indexIn(doc->filename()) >= 0) - ext = re.cap(1).toLower(); - re.setPattern(".*[\\/]([^\\/]*)"); - if (re.indexIn(doc->filename()) >= 0) - fnameNoPath = re.cap(1).toLower(); + QString ext = QFileInfo(doc->filename()).suffix().toLower(); QString typeList; QString curFilter; @@ -775,11 +762,7 @@ void PlasmaShopMain::onSaveAs() fDialogDir = dir.absolutePath(); // Update the displayed filename for the file - QString fnameDisplay = filename; - QRegExp re; - re.setPattern("(.*[\\\\\\/])?([^\\\\\\/]*)"); - if (re.indexIn(filename) >= 0) - fnameDisplay = re.cap(2); + QString fnameDisplay = QFileInfo(filename).fileName(); fEditorPane->setTabText(fEditorPane->currentIndex(), fnameDisplay); } } @@ -1426,7 +1409,7 @@ void PlasmaShopMain::onDocClean() int main(int argc, char* argv[]) { // Redirect libPlasma's debug stuff to PlasmaShop.log - QString logpath = QStandardPaths::writableLocation(QStandardPaths::DataLocation); + QString logpath = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation); QDir dir; dir.mkpath(logpath); logpath += "/PlasmaShop.log"; diff --git a/src/PlasmaShop/OptionsDialog.cpp b/src/PlasmaShop/OptionsDialog.cpp index a8b766a..ab2440d 100644 --- a/src/PlasmaShop/OptionsDialog.cpp +++ b/src/PlasmaShop/OptionsDialog.cpp @@ -157,7 +157,13 @@ OptionsDialog::OptionsDialog(QWidget* parent) QFont fnt; fnt.setFamily(settings.value("SciFont", PLAT_FONT).toString()); fnt.setPointSize(settings.value("SciFontSize", 10).toInt()); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + // Qt6 changed the values for this enum... + fnt.setWeight(static_cast( + settings.value("SciFontWeight-qt6", QFont::Normal).toInt())); +#else fnt.setWeight(settings.value("SciFontWeight", QFont::Normal).toInt()); +#endif fnt.setItalic(settings.value("SciFontItalic", false).toBool()); fSciFont->setFont(fnt); @@ -211,7 +217,12 @@ void OptionsDialog::onSave() settings.setValue("SciTabWidth", fSciTabWidth->text().toInt()); settings.setValue("SciFont", fSciFont->font().family()); settings.setValue("SciFontSize", fSciFont->font().pointSize()); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + // Qt6 changed the values for this enum... + settings.setValue("SciFontWeight-qt6", static_cast(fSciFont->font().weight())); +#else settings.setValue("SciFontWeight", fSciFont->font().weight()); +#endif settings.setValue("SciFontItalic", fSciFont->font().italic()); accept(); diff --git a/src/PlasmaShop/QPlasmaDocument.cpp b/src/PlasmaShop/QPlasmaDocument.cpp index 0186063..e105eba 100644 --- a/src/PlasmaShop/QPlasmaDocument.cpp +++ b/src/PlasmaShop/QPlasmaDocument.cpp @@ -23,6 +23,7 @@ #include #include #include +#include QIcon QPlasmaDocument::GetDocIcon(const QString& filename) { @@ -46,14 +47,9 @@ QIcon QPlasmaDocument::GetDocIcon(const QString& filename) return QIcon(":/img/db.png"); } - QString ext, fnameNoPath; - QRegExp re; - re.setPattern(".*\\.([^\\.]*)"); - if (re.indexIn(filename) >= 0) - ext = re.cap(1).toLower(); - re.setPattern("(.*[\\\\\\/])?([^\\\\\\/]*)"); - if (re.indexIn(filename) >= 0) - fnameNoPath = re.cap(2).toLower(); + QFileInfo fileInfo(filename); + QString ext = fileInfo.suffix().toLower(); + QString fnameNoPath = fileInfo.fileName().toLower(); if (ext == "age") return QIcon(":/img/age.png"); diff --git a/src/PlasmaShop/QPlasmaSumFile.cpp b/src/PlasmaShop/QPlasmaSumFile.cpp index 040f0cb..f061f80 100644 --- a/src/PlasmaShop/QPlasmaSumFile.cpp +++ b/src/PlasmaShop/QPlasmaSumFile.cpp @@ -32,7 +32,7 @@ void QPlasmaSumFile::addToSumFile(const QString& filename) QFileInfo finfo(filename); ST::string sumPath; - uint32_t timestamp = finfo.lastModified().toTime_t(); + uint32_t timestamp = finfo.lastModified().toSecsSinceEpoch(); // Construct a default path based on the file extension if (finfo.suffix() == "prp" || finfo.suffix() == "fni" || finfo.suffix() == "age" || @@ -259,7 +259,7 @@ void QPlasmaSumFile::onItemChanged(QTreeWidgetItem* item, int column) item->setText(1, locale.toString(dateTime, QLocale::ShortFormat)); break; } - file.fTimestamp = ts.toTime_t(); + file.fTimestamp = ts.toSecsSinceEpoch(); makeDirty(); } break; diff --git a/src/PlasmaShop/QPlasmaTextDoc.cpp b/src/PlasmaShop/QPlasmaTextDoc.cpp index e8c8b5c..3ed2d7e 100644 --- a/src/PlasmaShop/QPlasmaTextDoc.cpp +++ b/src/PlasmaShop/QPlasmaTextDoc.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include "QPlasma.h" @@ -332,9 +333,14 @@ QPlasmaTextDoc::QPlasmaTextDoc(QWidget* parent) void QPlasmaTextDoc::updateSettings() { QSettings settings("PlasmaShop", "PlasmaShop"); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + // Qt6 changed the values for this enum... + QFont::Weight weight = static_cast(settings.value("SciFontWeight-qt6", QFont::Normal).toInt()); +#else + int weight = static_cast(settings.value("SciFontWeight", QFont::Normal).toInt()); +#endif QFont textFont(settings.value("SciFont", PLAT_FONT).toString(), - settings.value("SciFontSize", 10).toInt(), - settings.value("SciFontWeight", QFont::Normal).toInt(), + settings.value("SciFontSize", 10).toInt(), weight, settings.value("SciFontItalic", false).toBool()); fEditor->setFont(textFont); @@ -392,15 +398,18 @@ bool QPlasmaTextDoc::onFind(const QString& text, bool regex, bool cs, bool wo, bool reverse) { QTextDocument::FindFlags options; + QRegularExpression::PatternOptions regex_options; if (cs) options |= QTextDocument::FindCaseSensitively; + else + regex_options |= QRegularExpression::CaseInsensitiveOption; if (wo) options |= QTextDocument::FindWholeWords; if (reverse) options |= QTextDocument::FindBackward; if (regex) - return fEditor->find(QRegExp(text, cs ? Qt::CaseSensitive : Qt::CaseInsensitive), options); + return fEditor->find(QRegularExpression(text, regex_options), options); else return fEditor->find(text, options); } diff --git a/src/PrpShop/CMakeLists.txt b/src/PrpShop/CMakeLists.txt index b267d22..63e0961 100644 --- a/src/PrpShop/CMakeLists.txt +++ b/src/PrpShop/CMakeLists.txt @@ -139,10 +139,12 @@ if(WIN32) set(PrpShop_Sources ${PrpShop_Sources} res/PrpShop.rc) endif() -find_package(Qt5OpenGL REQUIRED) +if(QT_VERSION_MAJOR VERSION_GREATER_EQUAL 6) + find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS OpenGLWidgets) +endif() # generate rules for building source files from the resources -qt5_add_resources(PrpShop_RCC images.qrc) +set(PrpShop_QRC images.qrc) include_directories("${PROJECT_SOURCE_DIR}/src/PrpShop") @@ -152,8 +154,11 @@ find_package(OpenGL) set(QT_QTOPENGL_LIB_DEPENDENCIES ${OPENGL_glu_LIBRARY} ${OPENGL_gl_LIBRARY}) add_executable(PrpShop WIN32 MACOSX_BUNDLE - ${PrpShop_Sources} ${PrpShop_Headers} ${PrpShop_RCC}) -target_link_libraries(PrpShop PSCommon Qt5::Core Qt5::Widgets Qt5::OpenGL) + ${PrpShop_Sources} ${PrpShop_Headers} ${PrpShop_QRC}) +target_link_libraries(PrpShop PSCommon Qt::Core Qt::Widgets) +if(QT_VERSION_MAJOR VERSION_GREATER_EQUAL 6) + target_link_libraries(PrpShop Qt::OpenGLWidgets) +endif() target_link_libraries(PrpShop HSPlasma) target_link_libraries(PrpShop ${QT_QTOPENGL_LIB_DEPENDENCIES}) diff --git a/src/PrpShop/Main.cpp b/src/PrpShop/Main.cpp index 7d47d06..af7c096 100644 --- a/src/PrpShop/Main.cpp +++ b/src/PrpShop/Main.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -86,12 +87,12 @@ PrpShopMain::PrpShopMain() fActions[kTreeExport] = new QAction(tr("E&xport..."), this); fActions[kTreeNewObject] = new QAction(tr("&New Object..."), this); - fActions[kFileOpen]->setShortcut(Qt::CTRL + Qt::Key_O); - fActions[kFileSave]->setShortcut(Qt::CTRL + Qt::Key_S); + fActions[kFileOpen]->setShortcut(Qt::CTRL | Qt::Key_O); + fActions[kFileSave]->setShortcut(Qt::CTRL | Qt::Key_S); fActions[kFileSaveAs]->setEnabled(false); //Enable if a page is selected - fActions[kFileSaveAs]->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_S); - fActions[kFileExit]->setShortcut(Qt::ALT + Qt::Key_F4); - fActions[kWindowClose]->setShortcut(Qt::CTRL + Qt::Key_W); + fActions[kFileSaveAs]->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_S); + fActions[kFileExit]->setShortcut(Qt::ALT | Qt::Key_F4); + fActions[kWindowClose]->setShortcut(Qt::CTRL | Qt::Key_W); fActions[kWindowClose]->setShortcutContext(Qt::WidgetWithChildrenShortcut); fActions[kToolsProperties]->setCheckable(true); fActions[kToolsProperties]->setChecked(true); @@ -658,7 +659,8 @@ void PrpShopMain::treeExport() if (item == NULL || item->obj() == NULL) return; - QString fnfix = st2qstr(item->obj()->getKey()->getName()).replace(QRegExp("[?:/\\*\"<>|]"), "_"); + QString fnfix = st2qstr(item->obj()->getKey()->getName()) + .replace(QRegularExpression("[?:/\\*\"<>|]"), "_"); QString genPath = tr("%1/[%2]%3.po").arg(fDialogDir) .arg(item->obj()->ClassName()) .arg(fnfix); @@ -1193,7 +1195,7 @@ void PrpShopMain::showTypeIDs(bool show) int main(int argc, char* argv[]) { // Redirect libPlasma's debug stuff to PrpShop.log - QString logpath = QStandardPaths::writableLocation(QStandardPaths::DataLocation); + QString logpath = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation); QDir dir; dir.mkpath(logpath); logpath += "/PrpShop.log"; diff --git a/src/PrpShop/PRP/Render/QPlasmaRender.cpp b/src/PrpShop/PRP/Render/QPlasmaRender.cpp index 6123566..ad43646 100644 --- a/src/PrpShop/PRP/Render/QPlasmaRender.cpp +++ b/src/PrpShop/PRP/Render/QPlasmaRender.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include @@ -68,12 +67,11 @@ int32_t QPlasmaRender::ObjectInfo::getList(DrawMode mode) } const float RADS = 0.0174532925f; -static QGLFormat s_format = QGL::DepthBuffer | QGL::StencilBuffer - | QGL::Rgba | QGL::AlphaChannel | QGL::DoubleBuffer; QPlasmaRender::QPlasmaRender(QWidget* parent) - : QGLWidget(s_format, parent), fDrawMode(kDrawTextured), - fNavMode(kNavModel), fRotZ(), fRotX(), fModelDist(), fTexList() + : QOpenGLWidget(parent), fTexCount(), fDrawMode(kDrawTextured), + fNavMode(kNavModel), fRotZ(), fRotX(), fModelDist(), fStartDist(), + fTexList() { } @@ -199,7 +197,7 @@ void QPlasmaRender::mouseMoveEvent(QMouseEvent* evt) fViewPos.Y += cosf((fRotZ + 90.0f) * RADS) * (evt->pos().x() - fMouseFrom.x()); } } - updateGL(); + update(); } QPointF QPlasmaRender::pixelPosToViewPos(const QPoint& p) @@ -234,7 +232,7 @@ void QPlasmaRender::setView(const hsVector3& view, float angle) fViewPos = view; fRotZ = angle; fRotX = 0.0f; - updateGL(); + update(); } void QPlasmaRender::center(plKey obj, bool world) @@ -767,5 +765,5 @@ void QPlasmaRender::changeMode(DrawMode mode) fDrawMode = mode; buildNewMode(fDrawMode); - updateGL(); + update(); } diff --git a/src/PrpShop/PRP/Render/QPlasmaRender.h b/src/PrpShop/PRP/Render/QPlasmaRender.h index 124e922..d067861 100644 --- a/src/PrpShop/PRP/Render/QPlasmaRender.h +++ b/src/PrpShop/PRP/Render/QPlasmaRender.h @@ -17,7 +17,7 @@ #ifndef _QPLASMARENDER_H #define _QPLASMARENDER_H -#include +#include #include #include #include @@ -25,7 +25,7 @@ #include "QTrackball.h" -class QPlasmaRender : public QGLWidget +class QPlasmaRender : public QOpenGLWidget { Q_OBJECT diff --git a/src/PrpShop/PRP/Surface/QMipmap.cpp b/src/PrpShop/PRP/Surface/QMipmap.cpp index 5d9cbf2..cd0bbaa 100644 --- a/src/PrpShop/PRP/Surface/QMipmap.cpp +++ b/src/PrpShop/PRP/Surface/QMipmap.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include "QLinkLabel.h" #include "QPlasmaUtils.h" @@ -446,7 +447,8 @@ static bool getJAlphaSurface(const plDDSurface& dds, plMipmap* tex) void QMipmap::onExportDDS() { plMipmap* tex = plMipmap::Convert(fCreatable); - QString filename = st2qstr(tex->getKey()->getName()).replace(QRegExp("[?:/\\*\"<>|]"), "_"); + QString filename = st2qstr(tex->getKey()->getName()) + .replace(QRegularExpression("[?:/\\*\"<>|]"), "_"); filename = QFileDialog::getSaveFileName(this, tr("Export DDS"), getExportDir() + "/" + filename, "DDS Files (*.dds)"); if (filename.isEmpty()) @@ -477,7 +479,8 @@ void QMipmap::onExportJPEG() QString exportDir = getExportDir(); plMipmap* tex = plMipmap::Convert(fCreatable); - exportDir.append("/" + st2qstr(tex->getKey()->getName()).replace(QRegExp("[?:/\\*\"<>|]"), "_")); + exportDir.append("/" + st2qstr(tex->getKey()->getName()) + .replace(QRegularExpression("[?:/\\*\"<>|]"), "_")); QString filter = tex->isImageJPEG() ? "JPEG Files (*.jpg)" : "DDS Files (*.dds)"; QString filename = QFileDialog::getSaveFileName(this, tr("Export JPEG Image"), exportDir, filter); diff --git a/src/PrpShop/QPrcEditor.cpp b/src/PrpShop/QPrcEditor.cpp index d2c2222..0a683e9 100644 --- a/src/PrpShop/QPrcEditor.cpp +++ b/src/PrpShop/QPrcEditor.cpp @@ -72,9 +72,15 @@ QPrcEditor::QPrcEditor(plCreatable* pCre, QWidget* parent) QSize QPrcEditor::sizeHint() const { QSettings settings("PlasmaShop", "PlasmaShop"); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + // Qt6 changed the values for this enum... + QFont::Weight weight = static_cast(settings.value("SciFontWeight-qt6", QFont::Normal).toInt()); +#else + int weight = settings.value("SciFontWeight", QFont::Normal).toInt(); +#endif + QFont textFont(settings.value("SciFont", PLAT_FONT).toString(), - settings.value("SciFontSize", 10).toInt(), - settings.value("SciFontWeight", QFont::Normal).toInt(), + settings.value("SciFontSize", 10).toInt(), weight, settings.value("SciFontItalic", false).toBool()); QFontMetrics fm(textFont); @@ -102,9 +108,14 @@ void QPrcEditor::loadPrcData() void QPrcEditor::updateSettings() { QSettings settings("PlasmaShop", "PlasmaShop"); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + // Qt6 changed the values for this enum... + QFont::Weight weight = static_cast(settings.value("SciFontWeight-qt6", QFont::Normal).toInt()); +#else + int weight = settings.value("SciFontWeight", QFont::Normal).toInt(); +#endif QFont textFont(settings.value("SciFont", PLAT_FONT).toString(), - settings.value("SciFontSize", 10).toInt(), - settings.value("SciFontWeight", QFont::Normal).toInt(), + settings.value("SciFontSize", 10).toInt(), weight, settings.value("SciFontItalic", false).toBool()); fEditor->setFont(textFont); diff --git a/src/VaultShop/CMakeLists.txt b/src/VaultShop/CMakeLists.txt index 43e53c0..e5e96ac 100644 --- a/src/VaultShop/CMakeLists.txt +++ b/src/VaultShop/CMakeLists.txt @@ -37,11 +37,11 @@ set(VaultShop_Sources #endif() # generate rules for building source files from the resources -qt5_add_resources(VaultShop_RCC images.qrc) +set(VaultShop_QRC images.qrc) add_executable(VaultShop WIN32 MACOSX_BUNDLE - ${VaultShop_Sources} ${VaultShop_Headers} ${VaultShop_RCC}) -target_link_libraries(VaultShop PSCommon Qt5::Core Qt5::Widgets) + ${VaultShop_Sources} ${VaultShop_Headers} ${VaultShop_QRC}) +target_link_libraries(VaultShop PSCommon Qt::Core Qt::Widgets) target_link_libraries(VaultShop HSPlasma) if(APPLE) diff --git a/src/VaultShop/Main.cpp b/src/VaultShop/Main.cpp index 326ebb7..6b36e60 100644 --- a/src/VaultShop/Main.cpp +++ b/src/VaultShop/Main.cpp @@ -116,9 +116,9 @@ VaultShopMain::VaultShopMain() fActions[kNodeUnsubscribe] = new QAction(tr("Un-subscribe"), this); //fActions[kNodeRenameVault] = new QAction(tr("Rename Vault..."), this); - fActions[kFileOpenVault]->setShortcut(Qt::CTRL + Qt::Key_O); - fActions[kFileSaveVault]->setShortcut(Qt::CTRL + Qt::Key_S); - fActions[kFileExit]->setShortcut(Qt::ALT + Qt::Key_F4); + fActions[kFileOpenVault]->setShortcut(Qt::CTRL | Qt::Key_O); + fActions[kFileSaveVault]->setShortcut(Qt::CTRL | Qt::Key_S); + fActions[kFileExit]->setShortcut(Qt::ALT | Qt::Key_F4); fActions[kVaultOpenNode]->setShortcut(Qt::Key_F2); // Main Menus @@ -763,7 +763,7 @@ void VaultShopMain::renameVault() int main(int argc, char* argv[]) { // Redirect libPlasma's debug stuff to VaultShop.log - QString logpath = QStandardPaths::writableLocation(QStandardPaths::DataLocation); + QString logpath = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation); QDir dir; dir.mkpath(logpath); logpath += "/VaultShop.log"; diff --git a/src/VaultShop/QVaultAgeInfoNode.cpp b/src/VaultShop/QVaultAgeInfoNode.cpp index 925cd06..3d51d16 100644 --- a/src/VaultShop/QVaultAgeInfoNode.cpp +++ b/src/VaultShop/QVaultAgeInfoNode.cpp @@ -18,7 +18,7 @@ #include #include -#include +#include #include QVaultAgeInfoNode::QVaultAgeInfoNode(QWidget* parent) @@ -35,7 +35,8 @@ QVaultAgeInfoNode::QVaultAgeInfoNode(QWidget* parent) fAgeUserDefinedName = new QLineEdit(this); fAgeDescription = new QLineEdit(this); fAgeInstanceGuid = new QLineEdit("0000000000000000", this); - fAgeInstanceGuid->setValidator(new QRegExpValidator(QRegExp("[0-9A-Fa-f]{16}"), fAgeInstanceGuid)); + fAgeInstanceGuid->setValidator(new QRegularExpressionValidator( + QRegularExpression("[0-9A-Fa-f]{16}"), fAgeInstanceGuid)); QGridLayout* layout = new QGridLayout(this); layout->setContentsMargins(8, 8, 8, 8); diff --git a/src/VaultShop/QVaultAgeNode.cpp b/src/VaultShop/QVaultAgeNode.cpp index 19f60eb..fc27bfa 100644 --- a/src/VaultShop/QVaultAgeNode.cpp +++ b/src/VaultShop/QVaultAgeNode.cpp @@ -19,14 +19,15 @@ #include #include #include -#include +#include #include QVaultAgeNode::QVaultAgeNode(QWidget* parent) : QVaultNodeEdit(parent) { fAgeInstanceGuid = new QLineEdit("0000000000000000", this); - fAgeInstanceGuid->setValidator(new QRegExpValidator(QRegExp("[0-9A-Fa-f]{16}"), fAgeInstanceGuid)); + fAgeInstanceGuid->setValidator(new QRegularExpressionValidator( + QRegularExpression("[0-9A-Fa-f]{16}"), fAgeInstanceGuid)); QGridLayout* layout = new QGridLayout(this); layout->setContentsMargins(8, 8, 8, 8); diff --git a/src/VaultShop/QVaultImageNode.cpp b/src/VaultShop/QVaultImageNode.cpp index 451191d..289bf1b 100644 --- a/src/VaultShop/QVaultImageNode.cpp +++ b/src/VaultShop/QVaultImageNode.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include /* QStaticImage */ @@ -192,7 +193,7 @@ void QVaultImageNode::IExportImage() plVaultBlob blob = img->getImageData(); QString fname = fImgTitle->text() + ".jpg"; - fname.replace(QRegExp("[\\\\/:*?\"<>|]"), "_"); + fname.replace(QRegularExpression("[\\\\/:*?\"<>|]"), "_"); if (!ieDir.isEmpty()) fname = ieDir + "/" + fname; fname = QFileDialog::getSaveFileName(this, tr("Export JPEG"), fname, diff --git a/src/VaultShop/QVaultNode.cpp b/src/VaultShop/QVaultNode.cpp index e29f006..f5ec21c 100644 --- a/src/VaultShop/QVaultNode.cpp +++ b/src/VaultShop/QVaultNode.cpp @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include #include "QVaultSDLNode.h" @@ -106,7 +106,8 @@ QVaultNode::QVaultNode(QWidget* parent) fAgeTime = new QLabel("N/A", top); fAgeName = new QLineEdit(top); fAgeGUID = new QLineEdit("0000000000000000", top); - fAgeGUID->setValidator(new QRegExpValidator(QRegExp("[0-9A-Fa-f]{16}"), fAgeGUID)); + fAgeGUID->setValidator(new QRegularExpressionValidator( + QRegularExpression("[0-9A-Fa-f]{16}"), fAgeGUID)); fCreatorID = new QLineEdit("0", top); fOwnerID = new QLineEdit("0", top); @@ -274,19 +275,19 @@ void QVaultNode::setNode(const plVaultNode& node) QDateTime dt; if (!fNode.getAutoTime().atEpoch()) { - dt.setTime_t(fNode.getAutoTime().getSecs()); + dt.setSecsSinceEpoch(fNode.getAutoTime().getSecs()); fAutoTime->setText(dt.toString("yyyy/MM/dd hh:mm:ss")); } else { fAutoTime->setText("N/A"); } if (!fNode.getAutoTime().atEpoch()) { - dt.setTime_t(fNode.getModifyTime().getSecs()); + dt.setSecsSinceEpoch(fNode.getModifyTime().getSecs()); fModifyTime->setText(dt.toString("yyyy/MM/dd hh:mm:ss")); } else { fModifyTime->setText("N/A"); } if (!fNode.getAutoTime().atEpoch()) { - dt.setTime_t(fNode.getCreateAgeTime().getSecs()); + dt.setSecsSinceEpoch(fNode.getCreateAgeTime().getSecs()); fAgeTime->setText(dt.toString("yyyy/MM/dd hh:mm:ss")); } else { fAgeTime->setText("N/A"); diff --git a/src/VaultShop/QVaultPlayerNode.cpp b/src/VaultShop/QVaultPlayerNode.cpp index 36d8f1d..4f26bb5 100644 --- a/src/VaultShop/QVaultPlayerNode.cpp +++ b/src/VaultShop/QVaultPlayerNode.cpp @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include @@ -29,7 +29,9 @@ QVaultPlayerNode::QVaultPlayerNode(QWidget* parent) fPlayerName = new QLineEdit(this); fAvatarShape = new QLineEdit(this); fAccountUUID = new QLineEdit(this); - fAccountUUID->setValidator(new QRegExpValidator(QRegExp("[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}"), fAccountUUID)); + fAccountUUID->setValidator(new QRegularExpressionValidator( + QRegularExpression("[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}"), + fAccountUUID)); QStringList builtInAvatars; builtInAvatars << "Female" << "Male" << "DrWatson" << "Engberg" << "Kodama" diff --git a/src/VaultShop/QVaultSDLNode.cpp b/src/VaultShop/QVaultSDLNode.cpp index fec8e4d..42a3e22 100644 --- a/src/VaultShop/QVaultSDLNode.cpp +++ b/src/VaultShop/QVaultSDLNode.cpp @@ -170,7 +170,7 @@ QString QSDLEditor::GetVarDisplay(plStateVariable* var) QDateTime dt; QLocale locale = QLocale::system(); if (!((plSimpleStateVariable*)var)->getTimeStamp().atEpoch()) { - dt.setTime_t(((plSimpleStateVariable*)var)->getTimeStamp().getSecs()); + dt.setSecsSinceEpoch(((plSimpleStateVariable*)var)->getTimeStamp().getSecs()); result += locale.toString(dt, QLocale::ShortFormat); } else { result += "N/A"; @@ -182,7 +182,7 @@ QString QSDLEditor::GetVarDisplay(plStateVariable* var) QDateTime dt; QLocale locale = QLocale::system(); if (!((plSimpleStateVariable*)var)->Time(i).atEpoch()) { - dt.setTime_t(((plSimpleStateVariable*)var)->Time(i).getSecs()); + dt.setSecsSinceEpoch(((plSimpleStateVariable*)var)->Time(i).getSecs()); result += locale.toString(dt, QLocale::ShortFormat); } else { result += "N/A"; @@ -422,7 +422,7 @@ void QSDLEditor::setVarCustomEdit(QTreeWidgetItem* item, int which) case plVarDescriptor::kAgeTimeOfDay: { QDateTime dt; - dt.setTime_t(((plSimpleStateVariable*)var)->getTimeStamp().getSecs()); + dt.setSecsSinceEpoch(((plSimpleStateVariable*)var)->getTimeStamp().getSecs()); fDTEdit->setDateTime(dt); fIntEdit->setValue(((plSimpleStateVariable*)var)->getTimeStamp().getMicros()); } @@ -430,7 +430,7 @@ void QSDLEditor::setVarCustomEdit(QTreeWidgetItem* item, int which) case plVarDescriptor::kTime: { QDateTime dt; - dt.setTime_t(((plSimpleStateVariable*)var)->Time(which).getSecs()); + dt.setSecsSinceEpoch(((plSimpleStateVariable*)var)->Time(which).getSecs()); fDTEdit->setDateTime(dt); fIntEdit->setValue(((plSimpleStateVariable*)var)->Time(which).getMicros()); } @@ -516,13 +516,13 @@ void QSDLEditor::saveVarCustomEdit(QTreeWidgetItem* item, int which) case plVarDescriptor::kAgeTimeOfDay: { plUnifiedTime ts; - ts.setSecs(fDTEdit->dateTime().toTime_t()); + ts.setSecs(fDTEdit->dateTime().toSecsSinceEpoch()); ts.setMicros(fIntEdit->value()); ((plSimpleStateVariable*)var)->setTimeStamp(ts); } break; case plVarDescriptor::kTime: - ((plSimpleStateVariable*)var)->Time(which).setSecs(fDTEdit->dateTime().toTime_t()); + ((plSimpleStateVariable*)var)->Time(which).setSecs(fDTEdit->dateTime().toSecsSinceEpoch()); ((plSimpleStateVariable*)var)->Time(which).setMicros(fIntEdit->value()); break; default: