Skip to content

Commit

Permalink
Merge pull request #194 from sithlord48/qt660
Browse files Browse the repository at this point in the history
Qt660
  • Loading branch information
myst6re committed Nov 17, 2023
2 parents c4cc466 + e20fa56 commit 230a9df
Show file tree
Hide file tree
Showing 41 changed files with 97 additions and 96 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
fail-fast: false
matrix:
qt:
- 6.5.1
- 6.6.0
os:
- ubuntu-latest
- macos-latest
Expand Down
11 changes: 6 additions & 5 deletions .vcpkg/ports/ff7tk/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
set(COMMIT_HASH 2e7b52d695a04ba6bbaba6f0dae1b173126a191d)
set(VCPKG_C_FLAGS "-bigobj ${VCPKG_C_FLAGS}")
set(VCPKG_CXX_FLAGS "-bigobj ${VCPKG_CXX_FLAGS}")
if(MSVC)
set(VCPKG_C_FLAGS "-bigobj ${VCPKG_C_FLAGS}")
set(VCPKG_CXX_FLAGS "-bigobj ${VCPKG_CXX_FLAGS}")
endif()

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO sithlord48/ff7tk
REF ${COMMIT_HASH}
SHA512 690b523e6e1d179cf3d429f9c9391b8537a3092814165bc513c6aab90bd404e50f3d34df7719bd656d83bf5cc5468ebef20ca14917134647495db83eb2030f1c
REF v0.83.3
SHA512 4c1f01670a5c34619d172f1abb47e1f7d4a597fe7e05eeedc2ecb3829825498f1e51f2dfd1ac03a858c2a828dbd4a80cc6c95c7ef8b64d3a7d686062de5ecf0c
HEAD_REF master
)

Expand Down
2 changes: 1 addition & 1 deletion .vcpkg/ports/ff7tk/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ff7tk",
"version": "0.83.1",
"version": "0.83.3",
"description": "Toolkit for making tools to edit Final Fantasy VII",
"homepage": "https://github.com/sithlord48/ff7tk",
"license": " LGPL-3.0",
Expand Down
2 changes: 1 addition & 1 deletion .vcpkg/versions/baseline.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"default": {
"ff7tk": {
"baseline": "0.83.1",
"baseline": "0.83.3",
"port-version": 0
}
}
Expand Down
2 changes: 1 addition & 1 deletion .vcpkg/versions/f-/ff7tk.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"versions": [
{
"version": "0.83.1",
"version": "0.83.3",
"path": "$/ports/ff7tk"
}
]
Expand Down
2 changes: 1 addition & 1 deletion src/Data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ QString Data::ff7KernelPath()
else {
QStringList langs;
langs << "de" << "en" << "es" << "fr" << "ja";
for (const QString &lang : qAsConst(langs)) {
for (const QString &lang : std::as_const(langs)) {
if (QFile::exists(path + QString("/lang-%1/kernel").arg(lang))) {
path.append(QString("/lang-%1/kernel").arg(lang));
break;
Expand Down
4 changes: 2 additions & 2 deletions src/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ Window::Window() :

menuLang->addSeparator();
QTranslator translator;
for (const QString &str : qAsConst(stringList)) {
for (const QString &str : std::as_const(stringList)) {
if (translator.load(dir.filePath(str))) {
action = menuLang->addAction(translator.translate("Window", "English"));
QString lang = str.mid(14, 2);
Expand Down Expand Up @@ -387,7 +387,7 @@ void Window::changeLanguage(QAction *action)
{
Config::setValue("lang", action->data());
QList<QAction *> actions = menuLang->actions();
for (QAction *act : qAsConst(actions)) {
for (QAction *act : std::as_const(actions)) {
act->setChecked(false);
}

Expand Down
10 changes: 5 additions & 5 deletions src/core/FF7Font.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ void FF7Font::openTxt(const QString &data)
return;
}

for (const QString &line : qAsConst(lines)) {
for (const QString &line : std::as_const(lines)) {
if (line.startsWith("#")) {
QRegularExpressionMatch match = nameRegExp.match(line);
if (match.hasMatch()) {
Expand Down Expand Up @@ -160,7 +160,7 @@ QString FF7Font::saveTxt()
data.append("#NAME\t").append(_name).append("\n");
}

for (const QStringList &t : qAsConst(_tables)) {
for (const QStringList &t : std::as_const(_tables)) {
for (int j=0; j<14; ++j) {
for (int i=0; i<16; ++i) {
data.append(QString("\"%1\"").arg(t[j*16 + i]));
Expand Down Expand Up @@ -231,7 +231,7 @@ bool FF7Font::listFonts()
fonts.insert("00", latinFont);
fonts.insert("01", jpFont);

for (const QString &str : qAsConst(stringList)) {
for (const QString &str : std::as_const(stringList)) {
qsizetype index = str.lastIndexOf('.');
fonts.insert(str.left(index), nullptr);
}
Expand Down Expand Up @@ -311,7 +311,7 @@ bool FF7Font::saveFonts()
{
bool ok = true;

for (FF7Font *font : qAsConst(fonts)) {
for (FF7Font *font : std::as_const(fonts)) {
if (font && !font->isReadOnly() && font->isModified()) {
QFile f1(font->txtPath());
if (f1.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
Expand Down Expand Up @@ -571,7 +571,7 @@ int FF7Font::calcFF7StringWidth(const FF7String &ff7String)
int width = 0;
const QByteArray &data = ff7String.data();

for (const char &c : qAsConst(data)) {
for (const char &c : std::as_const(data)) {
if (quint8(c) < 0xe0) {
width += charFullWidth(0, c);
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/field/BackgroundFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ QImage BackgroundFile::drawBackground(const BackgroundTiles &tiles, const QRect
qint32 top = (area.y() + tile.dstY) * area.width();
qint32 baseX = area.x() + tile.dstX;

for (uint indexOrColor : qAsConst(indexOrColorList)) {
for (uint indexOrColor : std::as_const(indexOrColorList)) {
if (palette == nullptr) {
if (indexOrColor != 0) {
pixels[baseX + right + top] = qRgb(qRed(indexOrColor), qGreen(indexOrColor), qBlue(indexOrColor));
Expand Down Expand Up @@ -251,7 +251,7 @@ bool BackgroundFile::exportLayers(const QString &dirPath, const QString &extensi
.arg(field()->name())
.arg(i == 0 ? 0 : i - 1);
if (i == 1) {
for (quint16 ID: qAsConst(usedIDs)) {
for (quint16 ID: std::as_const(usedIDs)) {
exportTiles(dir.filePath(fileName.arg(ID)), tiles().tilesByID(ID));
}
} else {
Expand Down
12 changes: 6 additions & 6 deletions src/core/field/BackgroundTextures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ QImage BackgroundTextures::toImage(const Tile &tile, const Palettes &palettes) c
QRgb *pixels = reinterpret_cast<QRgb *>(image.bits());

int i = 0;
for (uint indexOrColor : qAsConst(indexOrColorList)) {
for (uint indexOrColor : std::as_const(indexOrColorList)) {
pixels[i] = indexOrColor;
i += 1;
}
Expand All @@ -145,7 +145,7 @@ QImage BackgroundTextures::toImage(const Tile &tile, const Palettes &palettes) c
uchar *pixels = image.bits();

int i = 0;
for (uint indexOrColor : qAsConst(indexOrColorList)) {
for (uint indexOrColor : std::as_const(indexOrColorList)) {
pixels[i] = indexOrColor;
i += 1;
}
Expand Down Expand Up @@ -451,7 +451,7 @@ QImage BackgroundTexturesPC::toImage(quint8 texID) const
img.fill(Qt::black);
QRgb *bits = (QRgb *)img.bits();

for (uint indexOrRgb : qAsConst(indexOrRgbList)) {
for (uint indexOrRgb : std::as_const(indexOrRgbList)) {
if (infos.depth != 2) {
*bits = qRgb(indexOrRgb, indexOrRgb, indexOrRgb);
} else {
Expand Down Expand Up @@ -494,7 +494,7 @@ QImage BackgroundTexturesPC::toImage(quint8 texID, const BackgroundTiles &tiles,
palette = palettes.at(tile.paletteID);
}

for (uint indexOrRgb : qAsConst(indexOrRgbList)) {
for (uint indexOrRgb : std::as_const(indexOrRgbList)) {
// if (tile.depth == 0) {
// bits[pos + y * 256 + x] = qRgb(0, 255, 0);
// } else if (tile.depth == 1) {
Expand Down Expand Up @@ -721,7 +721,7 @@ BackgroundTexturesPC BackgroundTexturesPS::toPC(const BackgroundTiles &psTiles,

// Detection of transparency PC flag: true if one of used indexes is transparent
const QList<bool> &areZero = palette->areZero();
for (uint index : qAsConst(tileData)) {
for (uint index : std::as_const(tileData)) {
if (areZero.at(int(index))) {
palette->setTransparency(true);
break;
Expand Down Expand Up @@ -773,7 +773,7 @@ BackgroundTexturesPC BackgroundTexturesPS::toPC(const BackgroundTiles &psTiles,
int indexOfFirstZero = areZero.indexOf(true, 1);
if (firstIsZero || indexOfFirstZero >= 0) {
int i = 0;
for (const uint index : qAsConst(tileConversion.data)) {
for (const uint index : std::as_const(tileConversion.data)) {
if (index > 0 && areZero.at(int(index))) {
// When the index refer to a transparent color, change this index to 0

Expand Down
4 changes: 2 additions & 2 deletions src/core/field/BackgroundTiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ QMap<LayerParam, quint8> BackgroundTiles::usedParams(bool *layerExists, QSet<qui

if (effectLayers != nullptr) {
for (quint8 layer = 0; layer < 3; ++layer) {
for (const QMap< DstTex, QList<quint16> > &dst: qAsConst(collectEffectLayerTexPos[layer])) {
for (const QMap< DstTex, QList<quint16> > &dst: std::as_const(collectEffectLayerTexPos[layer])) {
qsizetype maxSize = -1;
for (const QList<quint16> &tileIDs: dst) {
if (tileIDs.size() > maxSize) {
Expand Down Expand Up @@ -619,7 +619,7 @@ bool BackgroundTiles::checkOrdering() const
}

QList<int> firstTextureIds, lastTextureIds;
for (const TextureCursor &cur: qAsConst(textureCursors)) {
for (const TextureCursor &cur: std::as_const(textureCursors)) {
firstTextureIds.append(cur.firstTextureId);
int last = lastTextureIds.isEmpty() ? -1 : lastTextureIds.last();
lastTextureIds.append(cur.lastTextureId);
Expand Down
14 changes: 7 additions & 7 deletions src/core/field/BackgroundTilesIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ bool BackgroundTilesIOPC::writeData(const BackgroundTiles &tiles) const
device()->write((char *)&depth, 2);
device()->write("\0\0", 2);

for (const Tile &tile : qAsConst(tiles1)) {
for (const Tile &tile : std::as_const(tiles1)) {
writeTile(tile);
}

Expand All @@ -459,7 +459,7 @@ bool BackgroundTilesIOPC::writeData(const BackgroundTiles &tiles) const
device()->write((char *)&headerLayer2, 16);
device()->write("\0\0", 2);

for (const Tile &tile : qAsConst(tiles2)) {
for (const Tile &tile : std::as_const(tiles2)) {
writeTile(tile);
}

Expand All @@ -483,7 +483,7 @@ bool BackgroundTilesIOPC::writeData(const BackgroundTiles &tiles) const
device()->write(QByteArray(10, '\0'));
device()->write("\0\0", 2);

for (const Tile &tile : qAsConst(tiles3)) {
for (const Tile &tile : std::as_const(tiles3)) {
writeTile(tile);
}

Expand All @@ -506,7 +506,7 @@ bool BackgroundTilesIOPC::writeData(const BackgroundTiles &tiles) const
device()->write((char *)&headerLayer4, 8);
device()->write("\0\0", 2);

for (const Tile &tile : qAsConst(tiles4)) {
for (const Tile &tile : std::as_const(tiles4)) {
writeTile(tile);
}

Expand Down Expand Up @@ -945,7 +945,7 @@ bool BackgroundTilesIOPS::writeData(const BackgroundTiles &tiles) const
if (!_demo) {
// Collect tiles2 for layers 2 and 3
firstTurn = true;
for (const Tile &tile : qAsConst(tilesLayers2And3)) {
for (const Tile &tile : std::as_const(tilesLayers2And3)) {
if (firstTurn || tile.dstY != dstY) {
tiles2.append(tile);
dstY = tile.dstY;
Expand Down Expand Up @@ -973,7 +973,7 @@ bool BackgroundTilesIOPS::writeData(const BackgroundTiles &tiles) const
if (!_demo) {
positions[3] = device()->pos();

for (const Tile &tile : qAsConst(tilesLayers2And3)) {
for (const Tile &tile : std::as_const(tilesLayers2And3)) {
writeTileBase(tile);
writeTileParam(tile);
}
Expand All @@ -984,7 +984,7 @@ bool BackgroundTilesIOPS::writeData(const BackgroundTiles &tiles) const
return false;
}

for (quint32 pos : qAsConst(positions)) {
for (quint32 pos : std::as_const(positions)) {
device()->write((char *)&pos, 4);
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/field/BsxFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ bool BsxFile::readTextures(FieldModelTexturesPS *textures) const

QList<QRect> rects;

for (const BsxTextureHeader &h : qAsConst(headers)) {
for (const BsxTextureHeader &h : std::as_const(headers)) {
rects.append(QRect(h.vramX, h.vramY,
h.width, h.height));
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/field/CharArchive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ bool CharArchive::openHrcBoneAndPartCount()

int partCount = 0;

for (const QStringList &rsds: qAsConst(rsdFiles)) {
for (const QStringList &rsds: std::as_const(rsdFiles)) {
partCount += rsds.size();
}

Expand Down
8 changes: 4 additions & 4 deletions src/core/field/Field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Field::Field(const QString &name) :

Field::~Field()
{
for (FieldPart *part : qAsConst(_parts)) {
for (FieldPart *part : std::as_const(_parts)) {
if (part) {
delete part;
}
Expand Down Expand Up @@ -215,7 +215,7 @@ void Field::initEmpty()
{
QList<Field::FieldSection> sections = orderOfSections();
sections << Akaos;
for (const FieldSection &section : qAsConst(sections)) {
for (const FieldSection &section : std::as_const(sections)) {
FieldPart *p = part(section);

if (!p) {
Expand Down Expand Up @@ -307,7 +307,7 @@ void Field::setSaved()
if (_io != nullptr) {
_isOpen = false; // Force reopen to refresh positions automatically
}
for (FieldPart *part : qAsConst(_parts)) {
for (FieldPart *part : std::as_const(_parts)) {
part->setModified(false);
}
_oldName.clear();
Expand All @@ -331,7 +331,7 @@ bool Field::save(QByteArray &newData, bool compress)
// Sections
int id=0;
QList<Field::FieldSection> fieldSections = orderOfSections();
for (const FieldSection &fieldSection : qAsConst(fieldSections)) {
for (const FieldSection &fieldSection : std::as_const(fieldSections)) {
// Section position
quint32 pos = headerSize() + newData.size() + diffSectionPos();
toc.append((char *)&pos, 4);
Expand Down
6 changes: 3 additions & 3 deletions src/core/field/FieldArchive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ FieldArchiveIO::ErrorCode FieldArchive::open()
}

int fieldID = 0;
for (Field *f : qAsConst(fileList)) {
for (Field *f : std::as_const(fileList)) {
if (f != nullptr) {
updateFieldLists(f, fieldID);
}
Expand Down Expand Up @@ -306,7 +306,7 @@ QList<FF7Var> FieldArchive::searchAllVars(QMap<FF7Var, QSet<QString> > &fieldNam
QList<FF7Var> fieldVars;
field->scriptsAndTexts()->searchAllVars(fieldVars);

for (const FF7Var &fieldVar : qAsConst(fieldVars)) {
for (const FF7Var &fieldVar : std::as_const(fieldVars)) {
QSet<QString> names = fieldNames.value(fieldVar);
names.insert(field->scriptsAndTexts()->author());
fieldNames.insert(fieldVar, names);
Expand Down Expand Up @@ -1926,7 +1926,7 @@ bool FieldArchive::importation(const QList<int> &selectedFields, const QString &

void FieldArchive::setSaved()
{
for (Field *field : qAsConst(fileList)) {
for (Field *field : std::as_const(fileList)) {
if (field != nullptr) {
field->setSaved();
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/field/FieldArchiveIOPC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ FieldArchiveIO::ErrorCode FieldArchiveIOPCLgp::open2(ArchiveObserver *observer)
// QTime t;t.start();

i = 0;
for (const QString &name : qAsConst(archiveList)) {
for (const QString &name : std::as_const(archiveList)) {
if (i % freq == 0) {
if (observer) {
if (observer->observerWasCanceled()) {
Expand Down Expand Up @@ -377,7 +377,7 @@ FieldArchiveIO::ErrorCode FieldArchiveIOPCDir::open2(ArchiveObserver *observer)
fieldArchive()->setMapList(mapList);

int i = 0;
for (const QString &name : qAsConst(list)) {
for (const QString &name : std::as_const(list)) {
if (observer) {
if (observer->observerWasCanceled()) {
return Aborted;
Expand Down
4 changes: 2 additions & 2 deletions src/core/field/FieldArchiveIOPS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ FieldArchiveIO::ErrorCode FieldArchiveIOPSIso::open2(ArchiveObserver *observer)
// QTime t;t.start();

int i = 0;
for (IsoFile *file : qAsConst(files)) {
for (IsoFile *file : std::as_const(files)) {
if (observer) {
if (observer->observerWasCanceled()) {
return Aborted;
Expand Down Expand Up @@ -509,7 +509,7 @@ FieldArchiveIO::ErrorCode FieldArchiveIOPSDir::open2(ArchiveObserver *observer)
// QTime t;t.start();

int i = 0;
for (const QString &name : qAsConst(list)) {
for (const QString &name : std::as_const(list)) {
if (observer) {
if (observer->observerWasCanceled()) {
return Aborted;
Expand Down
Loading

0 comments on commit 230a9df

Please sign in to comment.