aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/courtroom.cpp27
-rw-r--r--src/courtroom.h6
-rw-r--r--src/datatypes.h6
-rw-r--r--src/demoserver.cpp2
-rw-r--r--src/eventfilters.cpp5
-rw-r--r--src/lobby.cpp11
-rw-r--r--src/net/nettcpconnection.cpp2
-rw-r--r--src/scrolltext.cpp10
8 files changed, 12 insertions, 57 deletions
diff --git a/src/courtroom.cpp b/src/courtroom.cpp
index 94f6af5b..89c5c75c 100644
--- a/src/courtroom.cpp
+++ b/src/courtroom.cpp
@@ -9,9 +9,6 @@ Courtroom::Courtroom(AOApplication *p_ao_app)
this->setWindowFlags((this->windowFlags() | Qt::CustomizeWindowHint) & ~Qt::WindowMaximizeButtonHint);
ao_app->initBASS();
-#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) // Needed for pre-5.10 RNG stuff
- qsrand(static_cast<uint>(QDateTime::currentMSecsSinceEpoch() / 1000));
-#endif
keepalive_timer = new QTimer(this);
keepalive_timer->start(45000);
@@ -2947,13 +2944,8 @@ void Courtroom::do_screenshake()
for (int frame = 0; frame < maxframes; frame++)
{
double fraction = double(frame * frequency) / duration;
-#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
- int rand_x = max_deviation * (2 * (qrand() / (float)RAND_MAX) - 1) + 1;
- int rand_y = max_deviation * (2 * (qrand() / (float)RAND_MAX) - 1) + 1;
-#else
int rand_x = QRandomGenerator::system()->bounded(-max_deviation, max_deviation);
int rand_y = QRandomGenerator::system()->bounded(-max_deviation, max_deviation);
-#endif
screenshake_animation->setKeyValueAt(fraction, QPoint(pos_default.x() + rand_x, pos_default.y() + rand_y));
}
screenshake_animation->setEndValue(pos_default);
@@ -3144,12 +3136,8 @@ void Courtroom::initialize_chatbox()
}
QFontMetrics fm(ui_vp_showname->font());
-// Gotta support the slow paced ubuntu 18 STUCK IN 5.9.5!!
-#if QT_VERSION > QT_VERSION_CHECK(5, 11, 0)
+
int fm_width = fm.horizontalAdvance(ui_vp_showname->text());
-#else
- int fm_width = fm.boundingRect((ui_vp_showname->text())).width();
-#endif
if (extra_width > 0)
{
QString current_path = ui_vp_chatbox->image().left(ui_vp_chatbox->image().lastIndexOf('.'));
@@ -4699,7 +4687,7 @@ void Courtroom::on_ooc_return_pressed()
if (ooc_message.startsWith("/load_case"))
{
- QStringList command = ooc_message.split(" ", AOSplitBehaviorFlags::SkipEmptyParts);
+ QStringList command = ooc_message.split(" ", Qt::SkipEmptyParts);
QDir casefolder(get_base_path() + "/cases");
if (!casefolder.exists())
{
@@ -4795,7 +4783,7 @@ void Courtroom::on_ooc_return_pressed()
}
else if (ooc_message.startsWith("/save_case"))
{
- QStringList command = ooc_message.split(" ", AOSplitBehaviorFlags::SkipEmptyParts);
+ QStringList command = ooc_message.split(" ", Qt::SkipEmptyParts);
QDir casefolder(get_base_path() + "cases");
if (!casefolder.exists())
{
@@ -5615,11 +5603,8 @@ void Courtroom::music_random()
{
return;
}
-#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
- on_music_list_double_clicked(clist.at(qrand() % clist.length()), 1);
-#else
+
on_music_list_double_clicked(clist.at(QRandomGenerator::global()->bounded(0, clist.length())), 1);
-#endif
}
void Courtroom::music_list_expand_all()
@@ -6028,11 +6013,7 @@ void Courtroom::on_text_color_changed(int p_color)
markdown_end = markdown_start;
}
int start = ui_ic_chat_message->selectionStart();
-#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
int end = ui_ic_chat_message->selectionEnd() + 1;
-#else
- int end = ui_ic_chat_message->selectedText().length() + 1;
-#endif
ui_ic_chat_message->setCursorPosition(start);
ui_ic_chat_message->insert(markdown_start);
diff --git a/src/courtroom.h b/src/courtroom.h
index a42adca7..0f49839c 100644
--- a/src/courtroom.h
+++ b/src/courtroom.h
@@ -45,6 +45,7 @@
#include <QBrush>
#include <QDebug>
#include <QDesktopServices>
+#include <QElapsedTimer>
#include <QFileDialog>
#include <QFont>
#include <QInputDialog>
@@ -52,10 +53,7 @@
#include <QMessageBox>
#include <QParallelAnimationGroup>
#include <QPropertyAnimation>
-#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
-#include <QRandomGenerator> //added in Qt 5.10
-#endif
-#include <QElapsedTimer>
+#include <QRandomGenerator>
#include <QRegularExpression>
#include <QScrollBar>
#include <QTextBoundaryFinder>
diff --git a/src/datatypes.h b/src/datatypes.h
index ab92c2e5..9463a471 100644
--- a/src/datatypes.h
+++ b/src/datatypes.h
@@ -3,12 +3,6 @@
#include <QMap>
#include <QString>
-#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
-using AOSplitBehaviorFlags = QString::SplitBehaviorFlags;
-#else
-using AOSplitBehaviorFlags = Qt::SplitBehaviorFlags;
-#endif
-
enum ServerConnectionType
{
TcpServerConnection,
diff --git a/src/demoserver.cpp b/src/demoserver.cpp
index 22f383a1..bc7cc4bd 100644
--- a/src/demoserver.cpp
+++ b/src/demoserver.cpp
@@ -95,7 +95,7 @@ void DemoServer::recv_data()
{
QString in_data = QString::fromUtf8(client_sock->readAll());
- const QStringList packet_list = in_data.split("%", AOSplitBehaviorFlags::SkipEmptyParts);
+ const QStringList packet_list = in_data.split("%", Qt::SkipEmptyParts);
for (const QString &packet : packet_list)
{
QStringList f_contents;
diff --git a/src/eventfilters.cpp b/src/eventfilters.cpp
index 2e11b587..6f0b0f12 100644
--- a/src/eventfilters.cpp
+++ b/src/eventfilters.cpp
@@ -6,11 +6,8 @@ bool AOLineEditFilter::eventFilter(QObject *obj, QEvent *event)
if (event->type() == QEvent::FocusOut && lineEdit != nullptr && preserve_selection)
{ // lost focus
int start = lineEdit->selectionStart();
-#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
int len = lineEdit->selectionLength();
-#else
- int len = lineEdit->selectedText().length();
-#endif
+
if (start != -1 && len != -1)
{
lineEdit->setSelection(start, len);
diff --git a/src/lobby.cpp b/src/lobby.cpp
index 6d42485d..f853380f 100644
--- a/src/lobby.cpp
+++ b/src/lobby.cpp
@@ -174,19 +174,12 @@ void Lobby::loadUI()
if (!l_changelog.open(QFile::ReadOnly))
{
qDebug() << "Unable to locate changelog file. Does it even exist?";
-#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
+
ui_game_changelog_text->setMarkdown(l_changelog_text);
-#else
- ui_game_changelog_text->setPlainText(l_changelog_text); // imperfect solution, but implementing Markdown
- // ourselves for this edge case is out of scope
-#endif
return;
}
-#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
+
ui_game_changelog_text->setMarkdown(l_changelog.readAll());
-#else
- ui_game_changelog_text->setPlainText((l_changelog.readAll()));
-#endif
l_changelog.close();
QTabWidget *l_tabbar = findChild<QTabWidget *>("motd_changelog_tab");
diff --git a/src/net/nettcpconnection.cpp b/src/net/nettcpconnection.cpp
index 744eed9e..2bc52b71 100644
--- a/src/net/nettcpconnection.cpp
+++ b/src/net/nettcpconnection.cpp
@@ -78,7 +78,7 @@ void NetTcpConnection::onReadyRead()
return;
}
- QStringList raw_packet_list = m_cached_data.split('%', AOSplitBehaviorFlags::SkipEmptyParts);
+ QStringList raw_packet_list = m_cached_data.split('%', Qt::SkipEmptyParts);
m_cached_data.clear();
for (QString raw_packet : raw_packet_list)
{
diff --git a/src/scrolltext.cpp b/src/scrolltext.cpp
index a45d6abd..8e25692e 100644
--- a/src/scrolltext.cpp
+++ b/src/scrolltext.cpp
@@ -42,12 +42,8 @@ void ScrollText::setSeparator(QString separator)
void ScrollText::updateText()
{
timer.stop();
-#if QT_VERSION > QT_VERSION_CHECK(5, 11, 0)
- singleTextWidth = fontMetrics().horizontalAdvance(m_text);
-#else
- singleTextWidth = fontMetrics().boundingRect(_text).width();
-#endif
+ singleTextWidth = fontMetrics().horizontalAdvance(m_text);
scrollEnabled = (singleTextWidth > width() - leftMargin * 2);
if (scrollEnabled)
@@ -62,11 +58,7 @@ void ScrollText::updateText()
}
staticText.prepare(QTransform(), font());
-#if QT_VERSION > QT_VERSION_CHECK(5, 11, 0)
wholeTextSize = QSize(fontMetrics().horizontalAdvance(staticText.text()), fontMetrics().height());
-#else
- wholeTextSize = QSize(fontMetrics().boundingRect(staticText.text()).width(), fontMetrics().height());
-#endif
}
void ScrollText::paintEvent(QPaintEvent *)