diff options
| author | Osmium Sorcerer <os@sof.beauty> | 2026-03-22 17:44:46 +0000 |
|---|---|---|
| committer | Osmium Sorcerer <os@sof.beauty> | 2026-03-29 22:22:25 +0000 |
| commit | d4e99dcee4f48bcb34e6f6a38d5bae4fa380c841 (patch) | |
| tree | a5174bfb5aa98e3075625a20f8b8e5c4ccf37b86 | |
| parent | 7cc36dc9ccad26dad216217f0527c1fe5c1072eb (diff) | |
Fix warnings and deprecated functions
- For QCheckBox: stateChanged -> checkStateChanged
- QChar(PREANIM) -> QLatin1Char(PREANIM)
- Unused result on demo_file.open()
- QPointer include was missing from lobby.h
- Missing const and override qualifiers
| -rw-r--r-- | src/aotextboxwidgets.cpp | 8 | ||||
| -rw-r--r-- | src/aotextboxwidgets.h | 10 | ||||
| -rw-r--r-- | src/charselect.cpp | 2 | ||||
| -rw-r--r-- | src/courtroom.cpp | 2 | ||||
| -rw-r--r-- | src/demoserver.cpp | 3 | ||||
| -rw-r--r-- | src/emotes.cpp | 2 | ||||
| -rw-r--r-- | src/lobby.h | 1 | ||||
| -rw-r--r-- | src/widgets/aooptionsdialog.cpp | 2 | ||||
| -rw-r--r-- | src/widgets/playerlistwidget.cpp | 2 |
9 files changed, 16 insertions, 16 deletions
diff --git a/src/aotextboxwidgets.cpp b/src/aotextboxwidgets.cpp index fd770e5..ea6c537 100644 --- a/src/aotextboxwidgets.cpp +++ b/src/aotextboxwidgets.cpp @@ -15,7 +15,7 @@ void AOChatboxLabel::setIsOutlined(bool outlined) m_outline = outlined; } -bool AOChatboxLabel::pointMode() +bool AOChatboxLabel::pointMode() const { return m_pointmode; } @@ -25,7 +25,7 @@ void AOChatboxLabel::setPointMode(bool mode) m_pointmode = mode; } -double AOChatboxLabel::outlineThickness() +double AOChatboxLabel::outlineThickness() const { if (pointMode()) { @@ -49,12 +49,12 @@ void AOChatboxLabel::setPen(QPen pen) m_pen = pen; } -QSize AOChatboxLabel::sizeHint() +QSize AOChatboxLabel::sizeHint() const { int nrml_w = std::ceil(outlineThickness() * 2); return QLabel::sizeHint() + QSize(nrml_w, nrml_w); } -QSize AOChatboxLabel::minimumSizeHint() +QSize AOChatboxLabel::minimumSizeHint() const { int nrml_w = std::ceil(outlineThickness() * 2); return QLabel::minimumSizeHint() + QSize(nrml_w, nrml_w); diff --git a/src/aotextboxwidgets.h b/src/aotextboxwidgets.h index 6f25809..732b75c 100644 --- a/src/aotextboxwidgets.h +++ b/src/aotextboxwidgets.h @@ -18,20 +18,20 @@ public: void setIsOutlined(bool outlined); - bool pointMode(); + bool pointMode() const; void setPointMode(bool mode); - double outlineThickness(); + double outlineThickness() const; void setOutlineThickness(double w); void setBrush(QBrush brush); void setPen(QPen pen); - QSize sizeHint(); - QSize minimumSizeHint(); + QSize sizeHint() const override; + QSize minimumSizeHint() const override; protected: - void paintEvent(QPaintEvent *event); + void paintEvent(QPaintEvent *event) override; private: bool m_outline = false; diff --git a/src/charselect.cpp b/src/charselect.cpp index 5097814..7430522 100644 --- a/src/charselect.cpp +++ b/src/charselect.cpp @@ -236,7 +236,7 @@ void Courtroom::on_char_button_context_menu_requested(const QPoint &pos) } QMenu *menu = new QMenu(this); - menu->addAction(QString("Edit " + char_name + "/char.ini"), this, [=, this] { QDesktopServices::openUrl(QUrl::fromLocalFile(char_ini_path)); }); + menu->addAction(QString("Edit " + char_name + "/char.ini"), this, [=] { QDesktopServices::openUrl(QUrl::fromLocalFile(char_ini_path)); }); menu->addSeparator(); menu->addAction(QString("Open character folder " + char_name), this, [=, this] { QString p_path = ao_app->get_real_path(VPath("characters/" + char_name + "/")); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index bbac24c..df3872c 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2740,7 +2740,7 @@ bool Courtroom::handle_objection() objection_player->findAndPlayCharacterShout("custom", m_chatmessage[CHAR_NAME], ao_app->get_chat(m_chatmessage[CHAR_NAME])); } break; - m_chatmessage[EMOTE_MOD] = QChar(PREANIM); + m_chatmessage[EMOTE_MOD] = QLatin1Char(PREANIM); } ui_vp_objection->loadAndPlayAnimation(filename, m_chatmessage[CHAR_NAME], ao_app->get_chat(m_chatmessage[CHAR_NAME])); sfx_player->stopAll(); // Objection played! Cut all sfx. diff --git a/src/demoserver.cpp b/src/demoserver.cpp index dace861..f087dbd 100644 --- a/src/demoserver.cpp +++ b/src/demoserver.cpp @@ -296,8 +296,7 @@ void DemoServer::handle_packet(AOPacket p_packet) void DemoServer::load_demo(QString filename) { QFile demo_file(filename); - demo_file.open(QIODevice::ReadOnly); - if (!demo_file.isOpen()) + if (!demo_file.open(QIODevice::ReadOnly)) { return; } diff --git a/src/emotes.cpp b/src/emotes.cpp index 1f90cad..73e9e3b 100644 --- a/src/emotes.cpp +++ b/src/emotes.cpp @@ -30,7 +30,7 @@ void Courtroom::initialize_emotes() connect(ui_emote_dropdown, QOverload<int>::of(&QComboBox::activated), this, &Courtroom::on_emote_dropdown_changed); connect(ui_emote_dropdown, &AOEmoteButton::customContextMenuRequested, this, &Courtroom::show_emote_menu); - connect(ui_pre, QOverload<int>::of(&QCheckBox::stateChanged), this, &Courtroom::update_emote_preview); + connect(ui_pre, &QCheckBox::checkStateChanged, this, &Courtroom::update_emote_preview); connect(ui_flip, &AOButton::clicked, this, &Courtroom::update_emote_preview); connect(ui_pair_offset_spinbox, QOverload<int>::of(&QSpinBox::valueChanged), this, &Courtroom::update_emote_preview); connect(ui_pair_vert_offset_spinbox, QOverload<int>::of(&QSpinBox::valueChanged), this, &Courtroom::update_emote_preview); diff --git a/src/lobby.h b/src/lobby.h index 0221b5f..b678b5f 100644 --- a/src/lobby.h +++ b/src/lobby.h @@ -2,6 +2,7 @@ #include <QLabel> #include <QLineEdit> +#include <QPointer> #include <QPushButton> #include <QTextBrowser> #include <QTreeWidget> diff --git a/src/widgets/aooptionsdialog.cpp b/src/widgets/aooptionsdialog.cpp index eeab53b..e1648da 100644 --- a/src/widgets/aooptionsdialog.cpp +++ b/src/widgets/aooptionsdialog.cpp @@ -557,7 +557,7 @@ void AOOptionsDialog::setupUI() FROM_UI(QCheckBox, log_timestamp_cb); registerOption<QCheckBox, bool>("log_timestamp_cb", &Options::logTimestampEnabled, &Options::setLogTimestampEnabled); - connect(ui_log_timestamp_cb, &QCheckBox::stateChanged, this, &::AOOptionsDialog::timestampCbChanged); + connect(ui_log_timestamp_cb, &QCheckBox::checkStateChanged, this, &::AOOptionsDialog::timestampCbChanged); ui_log_timestamp_format_lbl->setText(tr("Log timestamp format:\n") + QDateTime::currentDateTime().toString(Options::getInstance().logTimestampFormat())); FROM_UI(QComboBox, log_timestamp_format_combobox); diff --git a/src/widgets/playerlistwidget.cpp b/src/widgets/playerlistwidget.cpp index 04147b8..c67c6b0 100644 --- a/src/widgets/playerlistwidget.cpp +++ b/src/widgets/playerlistwidget.cpp @@ -136,7 +136,7 @@ void PlayerListWidget::onCustomContextMenuRequested(const QPoint &pos) void PlayerListWidget::addPlayer(int playerId) { - m_player_map.insert(playerId, PlayerData{.id = playerId}); + m_player_map[playerId].id = playerId; QListWidgetItem *item = new QListWidgetItem(this); item->setData(Qt::UserRole, playerId); m_item_map.insert(playerId, item); |
