Skip to content
Merged

Qt6 #824

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
adb5437
Major cleanup of screenshake code
in1tiate Jul 18, 2022
c306a25
Add pre-5.10 support for screenshake math
in1tiate Jul 18, 2022
0e78b2b
more compat, uglier too
in1tiate Jul 18, 2022
ea4e9c9
add surprise tool
in1tiate Jul 18, 2022
cbee9cd
we don't need inline functions
in1tiate Jul 19, 2022
e673c06
only run qsrand on old versions
in1tiate Jul 19, 2022
c1ca74d
Squash compiler warnings
in1tiate Jul 19, 2022
2455a0b
>= not > please
in1tiate Jul 19, 2022
2a78950
Merge branch 'master' into compiler-warnings-begone
stonedDiscord Jul 24, 2022
1693219
don't set codec in qt6
stonedDiscord Jul 24, 2022
4a4b52a
switch to new regex
stonedDiscord Jul 24, 2022
a0a8bcb
remove qdesktopwidget (was unused)
stonedDiscord Jul 24, 2022
7eb74e1
make enter event an enter event
stonedDiscord Jul 24, 2022
046d60e
forgot header file
stonedDiscord Jul 24, 2022
ff1b1f3
rename emote_mod enum as there is an enum of the same name in chat_me…
stonedDiscord Jul 24, 2022
756077b
regexp
stonedDiscord Jul 24, 2022
7b0424c
no more codec
stonedDiscord Jul 24, 2022
1d59be2
fix warning about emote_mod type
stonedDiscord Jul 24, 2022
1f9a528
change to new qtconcurrent
stonedDiscord Jul 24, 2022
ec5c34e
misc was unused
stonedDiscord Jul 24, 2022
f8f7f34
fix run
stonedDiscord Jul 24, 2022
b7136c3
change qtconcurrent for music
stonedDiscord Jul 24, 2022
9f2f2a5
Merge branch 'master' into qt6666
stonedDiscord Aug 20, 2022
6cac710
codecs came back
stonedDiscord Aug 20, 2022
55ad5fa
make CI run on qt6 too
stonedDiscord Aug 20, 2022
497676f
seperate artifacts
stonedDiscord Aug 20, 2022
d278cae
Merge branch 'master' into qt6666
stonedDiscord Sep 2, 2022
b573085
qFormatLogMessage is wonky here
stonedDiscord Sep 3, 2022
b3df6a1
Merge branch 'debug_log_crash' into qt6666
stonedDiscord Sep 3, 2022
7ab6b1b
maybe actually use the qt version from matrix
stonedDiscord Sep 3, 2022
64f5b14
change qt version here as well
stonedDiscord Sep 3, 2022
916b7b9
even lower
stonedDiscord Sep 3, 2022
41c680e
use my own fixed installer
stonedDiscord Sep 3, 2022
f80f8bc
use my own fixed version of qapng
stonedDiscord Sep 3, 2022
d2b1aee
get websockets
stonedDiscord Sep 3, 2022
d64464c
minor spelling mistake
stonedDiscord Sep 3, 2022
42867dd
yOu nEeD aDdOnS
stonedDiscord Sep 3, 2022
93cbb29
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa
stonedDiscord Sep 3, 2022
a6f7c5b
Revert "maybe actually use the qt version from matrix"
stonedDiscord Oct 3, 2022
0d8772c
Revert "Revert "maybe actually use the qt version from matrix""
stonedDiscord Oct 3, 2022
5795474
use jurplels again
stonedDiscord Oct 3, 2022
55bae45
Revert "use jurplels again"
stonedDiscord Oct 3, 2022
afe8a0f
revert CI to master
stonedDiscord Dec 17, 2022
ab35627
main not master
stonedDiscord Dec 17, 2022
035da02
Merge branch 'master' into qt6666
stonedDiscord Dec 17, 2022
dac68d8
Merge branch 'master' into qt6666
stonedDiscord Dec 17, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:

- name: Add msbuild to PATH
if: matrix.platform == 'msvc2019'
uses: microsoft/setup-msbuild@master
uses: microsoft/setup-msbuild@main

- name: Downgrade Android NDK
if: matrix.platform == 'android'
Expand All @@ -64,7 +64,7 @@ jobs:
- uses: Skycoder42/action-setup-qt@master
id: qt
with:
version: 5.15.1
version: ${{matrix.version}}
platform: ${{matrix.platform}}

- name: Install QtApng
Expand Down
1 change: 0 additions & 1 deletion include/aoapplication.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include <QVector>

#include <QDebug>
#include <QDesktopWidget>
#include <QRect>

#include <QCryptographicHash>
Expand Down
3 changes: 2 additions & 1 deletion include/aocharbutton.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <QFile>
#include <QPushButton>
#include <QEnterEvent>
#include <QString>
#include <QWidget>

Expand Down Expand Up @@ -37,7 +38,7 @@ class AOCharButton : public QPushButton {
AOImage *ui_selector;

protected:
void enterEvent(QEvent *e);
void enterEvent(QEnterEvent *e);
void leaveEvent(QEvent *e);
};

Expand Down
3 changes: 2 additions & 1 deletion include/aoevidencebutton.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <QDebug>
#include <QPushButton>
#include <QEnterEvent>
#include <QString>

class AOEvidenceButton : public QPushButton {
Expand All @@ -31,7 +32,7 @@ class AOEvidenceButton : public QPushButton {
int m_id = 0;

protected:
void enterEvent(QEvent *e);
void enterEvent(QEnterEvent *e);
void leaveEvent(QEvent *e);
void mouseDoubleClickEvent(QMouseEvent *e);
/*
Expand Down
4 changes: 2 additions & 2 deletions include/aotextarea.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define AOTEXTAREA_H

#include <QDebug>
#include <QRegExp>
#include <QRegularExpression>
#include <QScrollBar>
#include <QTextBrowser>
#include <QTextCursor>
Expand All @@ -17,7 +17,7 @@ class AOTextArea : public QTextBrowser {
void append_error(QString p_message);

private:
const QRegExp url_parser_regex = QRegExp("\\b(https?://\\S+\\.\\S+)\\b");
const QRegularExpression url_parser_regex = QRegularExpression("\\b(https?://\\S+\\.\\S+)\\b");

void auto_scroll(QTextCursor old_cursor, int scrollbar_value,
bool is_scrolled_down);
Expand Down
2 changes: 1 addition & 1 deletion include/courtroom.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
#include <QRandomGenerator> //added in Qt 5.10
#endif
#include <QRegExp>
#include <QRegularExpression>
#include <QScrollBar>
#include <QTextBoundaryFinder>
#include <QTextCharFormat>
Expand Down
2 changes: 1 addition & 1 deletion include/datatypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ enum CHAT_MESSAGE {
EFFECTS,
};

enum EMOTE_MOD {
enum EMOTE_MOD_TYPE {
IDLE = 0,
PREANIM = 1,
ZOOM = 5,
Expand Down
2 changes: 2 additions & 0 deletions src/aoapplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ void AOApplication::load_favorite_list()
void AOApplication::save_favorite_list()
{
QSettings favorite_servers_ini(get_base_path() + "favorite_servers.ini", QSettings::IniFormat);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
favorite_servers_ini.setIniCodec("UTF-8");
#endif

favorite_servers_ini.clear();
// skip demo server entry, demo server entry is always at index 0
Expand Down
2 changes: 1 addition & 1 deletion src/aocharbutton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void AOCharButton::set_image(QString p_character)
}
}

void AOCharButton::enterEvent(QEvent *e)
void AOCharButton::enterEvent(QEnterEvent *e)
{
ui_selector->move(this->x() - 1, this->y() - 1);
ui_selector->raise();
Expand Down
2 changes: 1 addition & 1 deletion src/aoevidencebutton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ void AOEvidenceButton::dragEnterEvent(QMouseEvent *e)
}
*/

void AOEvidenceButton::enterEvent(QEvent *e)
void AOEvidenceButton::enterEvent(QEnterEvent *e)
{
ui_selector->show();

Expand Down
5 changes: 4 additions & 1 deletion src/aolayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include "aoapplication.h"
#include "file_functions.h"
#include "misc_functions.h"

static QThreadPool *thread_pool;

Expand Down Expand Up @@ -336,7 +335,11 @@ void AOLayer::start_playback(QString p_image)
frame = 0;
continuous = false;
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
frame_loader = QtConcurrent::run(thread_pool, this, &AOLayer::populate_vectors);
#else
frame_loader = QtConcurrent::run(thread_pool, &AOLayer::populate_vectors, this);
#endif
last_path = p_image;
while (movie_frames.size() <= frame) // if we haven't loaded the frame we need yet
frameAdded.wait(&mutex); // wait for the frame loader to add another frame, then check again
Expand Down
2 changes: 2 additions & 0 deletions src/aooptionsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1334,7 +1334,9 @@ void AOOptionsDialog::save_pressed()
if (callwordsini->open(QIODevice::WriteOnly | QIODevice::Truncate |
QIODevice::Text)) {
QTextStream out(callwordsini);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
out.setCodec("UTF-8");
#endif
out << ui_callwords_textbox->toPlainText();
callwordsini->close();
}
Expand Down
9 changes: 7 additions & 2 deletions src/courtroom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1788,7 +1788,7 @@ void Courtroom::debug_message_handler(QtMsgType type, const QMessageLogContext &
};
const QString color_id = QString("debug_log_%1_color").arg(colors.value(type, "info"));
ui_debug_log->append_chatmessage(
QString(), qFormatLogMessage(type, context, msg),
colors.value(type, "info"), msg,
QString(), ao_app->get_color(color_id, "courtroom_fonts.ini").name());
}

Expand Down Expand Up @@ -2479,7 +2479,7 @@ bool Courtroom::handle_objection()
ao_app->get_chat(m_chatmessage[CHAR_NAME]));
}
break;
m_chatmessage[EMOTE_MOD] = PREANIM;
m_chatmessage[EMOTE_MOD] = QChar(PREANIM);
}
ui_vp_objection->load_image(
filename, m_chatmessage[CHAR_NAME],
Expand Down Expand Up @@ -4091,8 +4091,13 @@ void Courtroom::handle_song(QStringList *p_contents)
}
ui_music_name->setText(tr("[LOADING] %1").arg(f_song_clear));
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
music_player->music_watcher.setFuture(QtConcurrent::run(music_player, &AOMusicPlayer::play, f_song, channel,
looping, effect_flags));
#else
music_player->music_watcher.setFuture(QtConcurrent::run(&AOMusicPlayer::play, music_player, f_song, channel,
looping, effect_flags));
#endif
}

void Courtroom::update_ui_music_name()
Expand Down
9 changes: 8 additions & 1 deletion src/demoserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,11 @@ void DemoServer::recv_data()
{
QString in_data = QString::fromUtf8(client_sock->readAll());

// Copypasted from NetworkManager
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
const QStringList packet_list = in_data.split("%", QString::SplitBehavior(QString::SkipEmptyParts));
#else
const QStringList packet_list = in_data.split("%", Qt::SkipEmptyParts);
#endif

for (const QString &packet : packet_list) {
QStringList f_contents;
Expand Down Expand Up @@ -288,7 +291,9 @@ void DemoServer::load_demo(QString filename)
p_path = filename;
// Process the demo file
QTextStream demo_stream(&demo_file);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
demo_stream.setCodec("UTF-8");
#endif
QString line = demo_stream.readLine();
while (!line.isNull()) {
while (!line.endsWith("%")) {
Expand Down Expand Up @@ -330,7 +335,9 @@ void DemoServer::load_demo(QString filename)
if (demo_file.open(QIODevice::WriteOnly | QIODevice::Text |
QIODevice::Truncate)) {
QTextStream out(&demo_file);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
out.setCodec("UTF-8");
#endif
out << p_demo_data.dequeue();
for (const QString &line : qAsConst(p_demo_data)) {
out << "\n" << line;
Expand Down
4 changes: 4 additions & 0 deletions src/evidence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,9 @@ void Courtroom::evidence_load(QString filename)
return;
}
QSettings inventory(filename, QSettings::IniFormat);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
inventory.setIniCodec("UTF-8");
#endif
private_evidence_list.clear();
foreach (QString evi, inventory.childGroups()) {
if (evi == "General")
Expand All @@ -825,7 +827,9 @@ void Courtroom::evidence_save(QString filename)
}

QSettings inventory(filename, QSettings::IniFormat);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
inventory.setIniCodec("UTF-8");
#endif
inventory.clear();
for (int i = 0; i < private_evidence_list.size(); i++) {
inventory.beginGroup(QString::number(i));
Expand Down
5 changes: 4 additions & 1 deletion src/networkmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,11 @@ void NetworkManager::handle_server_packet(const QString& p_data)
partial_packet = false;
}
}

#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
const QStringList packet_list = in_data.split("%", QString::SkipEmptyParts);
#else
const QStringList packet_list = in_data.split("%", Qt::SkipEmptyParts);
#endif

for (const QString &packet : packet_list) {
QStringList f_contents;
Expand Down
2 changes: 1 addition & 1 deletion src/packet_distribution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
// here
if (AOApplication::get_demo_logging_enabled() && server_name != "Demo playback") {
this->log_filename = QDateTime::currentDateTime().toUTC().toString(
"'logs/" + server_name.remove(QRegExp("[\\\\/:*?\"<>|\']")) +
"'logs/" + server_name.remove(QRegularExpression("[\\\\/:*?\"<>|\']")) +
"/'yyyy-MM-dd hh-mm-ss t'.log'");
this->write_to_file("Joined server " + server_name + " hosted on address " +
server_address + " on " +
Expand Down
6 changes: 3 additions & 3 deletions src/path_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "file_functions.h"

#include <QDir>
#include <QRegExp>
#include <QRegularExpression>
#include <QStandardPaths>
#include <QStringBuilder>

Expand Down Expand Up @@ -235,14 +235,14 @@ QString AOApplication::get_config_value(QString p_identifier, QString p_config,
path = get_real_path(p);
if (!path.isEmpty()) {
QSettings settings(path, QSettings::IniFormat);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
settings.setIniCodec("UTF-8");
#endif
QVariant value = settings.value(p_identifier);
if (value.type() == QVariant::StringList) {
// qDebug() << "got" << p << "is a string list, returning" << value.toStringList().join(",");
return value.toStringList().join(",");
}
else if (!value.isNull()){
// qDebug() << "got" << p << "is a string, returning" << value.toString();
return value.toString();
}
}
Expand Down
22 changes: 20 additions & 2 deletions src/text_file_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,9 @@ bool AOApplication::write_to_file(QString p_text, QString p_file, bool make_dir)
if (f_log.open(QIODevice::WriteOnly | QIODevice::Text |
QIODevice::Truncate)) {
QTextStream out(&f_log);

#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
out.setCodec("UTF-8");
#endif
out << p_text;

f_log.flush();
Expand Down Expand Up @@ -232,8 +233,9 @@ bool AOApplication::append_to_file(QString p_text, QString p_file,
QFile f_log(p_file);
if (f_log.open(QIODevice::WriteOnly | QIODevice::Append)) {
QTextStream out(&f_log);

#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
out.setCodec("UTF-8");
#endif
out << "\r\n" << p_text;

f_log.flush();
Expand Down Expand Up @@ -262,7 +264,9 @@ QVector<server_type> AOApplication::read_favorite_servers()
}
else {
QSettings fav_servers_ini(fav_servers_ini_path, QSettings::IniFormat);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
fav_servers_ini.setIniCodec("UTF-8");
#endif

auto grouplist = fav_servers_ini.childGroups();
{ // remove all negative and non-numbers
Expand Down Expand Up @@ -308,7 +312,9 @@ QVector<server_type> AOApplication::read_legacy_favorite_servers()
qWarning() << "failed to open serverlist.txt";
} else {
QTextStream stream(&serverlist_txt);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
stream.setCodec("UTF-8");
#endif

while (!stream.atEnd())
{
Expand Down Expand Up @@ -346,7 +352,9 @@ QString AOApplication::read_design_ini(QString p_identifier,
QString p_design_path)
{
QSettings settings(p_design_path, QSettings::IniFormat);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
settings.setIniCodec("UTF-8");
#endif
QVariant value = settings.value(p_identifier);
if (value.type() == QVariant::StringList) {
return value.toStringList().join(",");
Expand Down Expand Up @@ -608,7 +616,9 @@ QString AOApplication::read_char_ini(QString p_char, QString p_search_line,
QSettings settings(get_real_path(get_character_path(p_char, "char.ini")),
QSettings::IniFormat);
settings.beginGroup(target_tag);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
settings.setIniCodec("UTF-8");
#endif
QString value = settings.value(p_search_line).value<QString>();
settings.endGroup();
return value;
Expand All @@ -619,7 +629,9 @@ void AOApplication::set_char_ini(QString p_char, QString value,
{
QSettings settings(get_real_path(get_character_path(p_char, "char.ini")),
QSettings::IniFormat);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
settings.setIniCodec("UTF-8");
#endif
settings.beginGroup(target_tag);
settings.setValue(p_search_line, value);
settings.endGroup();
Expand All @@ -630,7 +642,9 @@ QStringList AOApplication::read_ini_tags(VPath p_path, QString target_tag)
{
QStringList r_values;
QSettings settings(get_real_path(p_path), QSettings::IniFormat);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
settings.setIniCodec("UTF-8");
#endif
if (!target_tag.isEmpty())
settings.beginGroup(target_tag);
QStringList keys = settings.allKeys();
Expand Down Expand Up @@ -926,7 +940,9 @@ QStringList AOApplication::get_effects(QString p_char)
}

QSettings l_effects_ini(i_filepath, QSettings::IniFormat);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
l_effects_ini.setIniCodec("UTF-8");
#endif

// port legacy effects
if (!l_effects_ini.contains("version/major") || l_effects_ini.value("version/major").toInt() < 2)
Expand Down Expand Up @@ -1006,7 +1022,9 @@ QString AOApplication::get_effect_property(QString fx_name, QString p_char,
path = get_real_path(p);
if (!path.isEmpty()) {
QSettings settings(path, QSettings::IniFormat);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
settings.setIniCodec("UTF-8");
#endif
QStringList char_effects = settings.childGroups();
for (int i = 0; i < char_effects.size(); ++i) {
QString effect = settings.value(char_effects[i] + "/name").toString();
Expand Down