* Major cleanup of screenshake code

* Add pre-5.10 support for screenshake math

* more compat, uglier too

* add surprise tool

* we don't need inline functions

* only run qsrand on old versions

* Squash compiler warnings

* >= not > please

* don't set codec in qt6

* switch to new regex

* remove qdesktopwidget (was unused)

* make enter event an enter event

* forgot header file

* rename emote_mod enum as there is an enum of the same name in chat_message

* regexp

* no more codec

* fix warning about emote_mod type

* change to new qtconcurrent

* misc was unused

* fix run

* change qtconcurrent for music

* codecs came back

* make CI run on qt6 too

* seperate artifacts

* qFormatLogMessage is wonky here

* maybe actually use the qt version from matrix

* change qt version here as well

* even lower

* use my own fixed installer

* use my own fixed version of qapng

* get websockets

* minor spelling mistake

* yOu nEeD aDdOnS

* aaaaaaaaaaaaaaaaaaaaaaaaaaaaa

* Revert "maybe actually use the qt version from matrix"

This reverts commit 7ab6b1b4c2f1200318d52f325efd2ef46c3fbd6a.

* Revert "Revert "maybe actually use the qt version from matrix""

This reverts commit a6f7c5bedf214a1992c15b296edd195f96a9196a.

* use jurplels again

* Revert "use jurplels again"

This reverts commit 5795474bca64590f1479af3ccbf7d8cc57f427e7.

* revert CI to master

* main not master

Co-authored-by: in1tiate <woodward.randall02+github@gmail.com>
This commit is contained in:
stonedDiscord 2022-12-28 21:35:11 +01:00 committed by GitHub
parent 1aca9a19db
commit a449aa86e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 67 additions and 22 deletions

View File

@ -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'
@ -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

View File

@ -16,7 +16,6 @@
#include <QVector>
#include <QDebug>
#include <QDesktopWidget>
#include <QRect>
#include <QCryptographicHash>

View File

@ -6,6 +6,7 @@
#include <QFile>
#include <QPushButton>
#include <QEnterEvent>
#include <QString>
#include <QWidget>
@ -37,7 +38,7 @@ private:
AOImage *ui_selector;
protected:
void enterEvent(QEvent *e);
void enterEvent(QEnterEvent *e);
void leaveEvent(QEvent *e);
};

View File

@ -6,6 +6,7 @@
#include <QDebug>
#include <QPushButton>
#include <QEnterEvent>
#include <QString>
class AOEvidenceButton : public QPushButton {
@ -31,7 +32,7 @@ private:
int m_id = 0;
protected:
void enterEvent(QEvent *e);
void enterEvent(QEnterEvent *e);
void leaveEvent(QEvent *e);
void mouseDoubleClickEvent(QMouseEvent *e);
/*

View File

@ -2,7 +2,7 @@
#define AOTEXTAREA_H
#include <QDebug>
#include <QRegExp>
#include <QRegularExpression>
#include <QScrollBar>
#include <QTextBrowser>
#include <QTextCursor>
@ -17,7 +17,7 @@ public:
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);

View File

@ -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>

View File

@ -113,7 +113,7 @@ enum CHAT_MESSAGE {
EFFECTS,
};
enum EMOTE_MOD {
enum EMOTE_MOD_TYPE {
IDLE = 0,
PREANIM = 1,
ZOOM = 5,

View File

@ -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

View File

@ -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();

View File

@ -104,7 +104,7 @@ void AOEvidenceButton::dragEnterEvent(QMouseEvent *e)
}
*/
void AOEvidenceButton::enterEvent(QEvent *e)
void AOEvidenceButton::enterEvent(QEnterEvent *e)
{
ui_selector->show();

View File

@ -2,7 +2,6 @@
#include "aoapplication.h"
#include "file_functions.h"
#include "misc_functions.h"
static QThreadPool *thread_pool;
@ -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

View File

@ -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();
}

View File

@ -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());
}
@ -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],
@ -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()

View File

@ -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;
@ -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("%")) {
@ -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;

View File

@ -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")
@ -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));

View File

@ -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;

View File

@ -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 " +

View File

@ -3,7 +3,7 @@
#include "file_functions.h"
#include <QDir>
#include <QRegExp>
#include <QRegularExpression>
#include <QStandardPaths>
#include <QStringBuilder>
@ -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();
}
}

View File

@ -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();
@ -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();
@ -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
@ -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())
{
@ -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(",");
@ -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;
@ -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();
@ -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();
@ -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)
@ -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();