Merge pull request #9440 from lioncash/qt6
DolphinQt: Qt 6.0 forward-compatibility changes
This commit is contained in:
commit
28cd6f6520
|
@ -11,6 +11,7 @@
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
#include <QRegularExpression>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
#include <QStringListModel>
|
#include <QStringListModel>
|
||||||
#include <QTextCursor>
|
#include <QTextCursor>
|
||||||
|
@ -161,7 +162,7 @@ void GameConfigEdit::AddBoolOption(QMenu* menu, const QString& name, const QStri
|
||||||
void GameConfigEdit::SetOption(const QString& section, const QString& key, const QString& value)
|
void GameConfigEdit::SetOption(const QString& section, const QString& key, const QString& value)
|
||||||
{
|
{
|
||||||
auto section_cursor =
|
auto section_cursor =
|
||||||
m_edit->document()->find(QRegExp(QStringLiteral("^\\[%1\\]").arg(section)), 0);
|
m_edit->document()->find(QRegularExpression(QStringLiteral("^\\[%1\\]").arg(section)), 0);
|
||||||
|
|
||||||
// Check if the section this belongs in can be found
|
// Check if the section this belongs in can be found
|
||||||
if (section_cursor.isNull())
|
if (section_cursor.isNull())
|
||||||
|
@ -170,8 +171,8 @@ void GameConfigEdit::SetOption(const QString& section, const QString& key, const
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto value_cursor =
|
auto value_cursor = m_edit->document()->find(
|
||||||
m_edit->document()->find(QRegExp(QStringLiteral("^%1 = .*").arg(key)), section_cursor);
|
QRegularExpression(QStringLiteral("^%1 = .*").arg(key)), section_cursor);
|
||||||
|
|
||||||
const QString new_line = QStringLiteral("%1 = %2").arg(key).arg(value);
|
const QString new_line = QStringLiteral("%1 = %2").arg(key).arg(value);
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QRegExp>
|
#include <QRegularExpression>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
|
@ -51,8 +51,8 @@ QString GetExpressionForControl(const QString& control_name,
|
||||||
|
|
||||||
if (quote == Quote::On)
|
if (quote == Quote::On)
|
||||||
{
|
{
|
||||||
QRegExp reg(QStringLiteral("[a-zA-Z]+"));
|
const QRegularExpression reg(QStringLiteral("[a-zA-Z]+"));
|
||||||
if (!reg.exactMatch(expr))
|
if (!reg.match(expr).hasMatch())
|
||||||
expr = QStringLiteral("`%1`").arg(expr);
|
expr = QStringLiteral("`%1`").arg(expr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,9 +40,9 @@ QTableWidgetItem* GetSocketDomain(s32 host_fd)
|
||||||
switch (sa.sa_family)
|
switch (sa.sa_family)
|
||||||
{
|
{
|
||||||
case 2:
|
case 2:
|
||||||
return new QTableWidgetItem(QLatin1Literal("AF_INET"));
|
return new QTableWidgetItem(QStringLiteral("AF_INET"));
|
||||||
case 23:
|
case 23:
|
||||||
return new QTableWidgetItem(QLatin1Literal("AF_INET6"));
|
return new QTableWidgetItem(QStringLiteral("AF_INET6"));
|
||||||
default:
|
default:
|
||||||
return new QTableWidgetItem(QString::number(sa.sa_family));
|
return new QTableWidgetItem(QString::number(sa.sa_family));
|
||||||
}
|
}
|
||||||
|
@ -63,9 +63,9 @@ QTableWidgetItem* GetSocketType(s32 host_fd)
|
||||||
switch (so_type)
|
switch (so_type)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
return new QTableWidgetItem(QLatin1Literal("SOCK_STREAM"));
|
return new QTableWidgetItem(QStringLiteral("SOCK_STREAM"));
|
||||||
case 2:
|
case 2:
|
||||||
return new QTableWidgetItem(QLatin1Literal("SOCK_DGRAM"));
|
return new QTableWidgetItem(QStringLiteral("SOCK_DGRAM"));
|
||||||
default:
|
default:
|
||||||
return new QTableWidgetItem(QString::number(so_type));
|
return new QTableWidgetItem(QString::number(so_type));
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
#include <QActionGroup>
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QTableWidget>
|
#include <QTableWidget>
|
||||||
|
|
|
@ -131,10 +131,10 @@ void ThreadWidget::ShowContextMenu(QTableWidget* table)
|
||||||
|
|
||||||
QLineEdit* ThreadWidget::CreateLineEdit() const
|
QLineEdit* ThreadWidget::CreateLineEdit() const
|
||||||
{
|
{
|
||||||
QLineEdit* line_edit = new QLineEdit(QLatin1Literal("00000000"));
|
QLineEdit* line_edit = new QLineEdit(QStringLiteral("00000000"));
|
||||||
line_edit->setReadOnly(true);
|
line_edit->setReadOnly(true);
|
||||||
line_edit->setFixedWidth(
|
line_edit->setFixedWidth(
|
||||||
line_edit->fontMetrics().boundingRect(QLatin1Literal(" 00000000 ")).width());
|
line_edit->fontMetrics().boundingRect(QStringLiteral(" 00000000 ")).width());
|
||||||
return line_edit;
|
return line_edit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -374,39 +374,39 @@ void ThreadWidget::UpdateThreadContext(const Common::Debug::PartialContext& cont
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case 8:
|
case 8:
|
||||||
m_context_table->setItem(i, 6, new QTableWidgetItem(QLatin1Literal("CR")));
|
m_context_table->setItem(i, 6, new QTableWidgetItem(QStringLiteral("CR")));
|
||||||
m_context_table->setItem(i, 7, new QTableWidgetItem(format_hex(context.cr)));
|
m_context_table->setItem(i, 7, new QTableWidgetItem(format_hex(context.cr)));
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
m_context_table->setItem(i, 6, new QTableWidgetItem(QLatin1Literal("LR")));
|
m_context_table->setItem(i, 6, new QTableWidgetItem(QStringLiteral("LR")));
|
||||||
m_context_table->setItem(i, 7, new QTableWidgetItem(format_hex(context.lr)));
|
m_context_table->setItem(i, 7, new QTableWidgetItem(format_hex(context.lr)));
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
m_context_table->setItem(i, 6, new QTableWidgetItem(QLatin1Literal("CTR")));
|
m_context_table->setItem(i, 6, new QTableWidgetItem(QStringLiteral("CTR")));
|
||||||
m_context_table->setItem(i, 7, new QTableWidgetItem(format_hex(context.ctr)));
|
m_context_table->setItem(i, 7, new QTableWidgetItem(format_hex(context.ctr)));
|
||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
m_context_table->setItem(i, 6, new QTableWidgetItem(QLatin1Literal("XER")));
|
m_context_table->setItem(i, 6, new QTableWidgetItem(QStringLiteral("XER")));
|
||||||
m_context_table->setItem(i, 7, new QTableWidgetItem(format_hex(context.xer)));
|
m_context_table->setItem(i, 7, new QTableWidgetItem(format_hex(context.xer)));
|
||||||
break;
|
break;
|
||||||
case 12:
|
case 12:
|
||||||
m_context_table->setItem(i, 6, new QTableWidgetItem(QLatin1Literal("FPSCR")));
|
m_context_table->setItem(i, 6, new QTableWidgetItem(QStringLiteral("FPSCR")));
|
||||||
m_context_table->setItem(i, 7, new QTableWidgetItem(format_hex(context.fpscr)));
|
m_context_table->setItem(i, 7, new QTableWidgetItem(format_hex(context.fpscr)));
|
||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
m_context_table->setItem(i, 6, new QTableWidgetItem(QLatin1Literal("SRR0")));
|
m_context_table->setItem(i, 6, new QTableWidgetItem(QStringLiteral("SRR0")));
|
||||||
m_context_table->setItem(i, 7, new QTableWidgetItem(format_hex(context.srr0)));
|
m_context_table->setItem(i, 7, new QTableWidgetItem(format_hex(context.srr0)));
|
||||||
break;
|
break;
|
||||||
case 14:
|
case 14:
|
||||||
m_context_table->setItem(i, 6, new QTableWidgetItem(QLatin1Literal("SRR1")));
|
m_context_table->setItem(i, 6, new QTableWidgetItem(QStringLiteral("SRR1")));
|
||||||
m_context_table->setItem(i, 7, new QTableWidgetItem(format_hex(context.srr1)));
|
m_context_table->setItem(i, 7, new QTableWidgetItem(format_hex(context.srr1)));
|
||||||
break;
|
break;
|
||||||
case 15:
|
case 15:
|
||||||
m_context_table->setItem(i, 6, new QTableWidgetItem(QLatin1Literal("DUMMY")));
|
m_context_table->setItem(i, 6, new QTableWidgetItem(QStringLiteral("DUMMY")));
|
||||||
m_context_table->setItem(i, 7, new QTableWidgetItem(format_hex(context.dummy)));
|
m_context_table->setItem(i, 7, new QTableWidgetItem(format_hex(context.dummy)));
|
||||||
break;
|
break;
|
||||||
case 16:
|
case 16:
|
||||||
m_context_table->setItem(i, 6, new QTableWidgetItem(QLatin1Literal("STATE")));
|
m_context_table->setItem(i, 6, new QTableWidgetItem(QStringLiteral("STATE")));
|
||||||
m_context_table->setItem(i, 7, new QTableWidgetItem(format_hex(context.state)));
|
m_context_table->setItem(i, 7, new QTableWidgetItem(format_hex(context.state)));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -454,7 +454,7 @@ void ThreadWidget::UpdateThreadCallstack(const Common::Debug::PartialContext& co
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_callstack_table->setItem(i, 2, new QTableWidgetItem(QLatin1Literal("--------")));
|
m_callstack_table->setItem(i, 2, new QTableWidgetItem(QStringLiteral("--------")));
|
||||||
}
|
}
|
||||||
sp = PowerPC::HostRead_U32(sp);
|
sp = PowerPC::HostRead_U32(sp);
|
||||||
m_callstack_table->setItem(i, 1, new QTableWidgetItem(format_hex(sp)));
|
m_callstack_table->setItem(i, 1, new QTableWidgetItem(format_hex(sp)));
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
|
#include <QRegularExpression>
|
||||||
|
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
|
|
||||||
|
@ -96,7 +97,8 @@ QVariant GameListModel::data(const QModelIndex& index, int role) const
|
||||||
const int disc_nr = game.GetDiscNumber() + 1;
|
const int disc_nr = game.GetDiscNumber() + 1;
|
||||||
if (disc_nr > 1)
|
if (disc_nr > 1)
|
||||||
{
|
{
|
||||||
if (!name.contains(QRegExp(QStringLiteral("disc ?%1").arg(disc_nr), Qt::CaseInsensitive)))
|
if (!name.contains(QRegularExpression(QStringLiteral("disc ?%1").arg(disc_nr),
|
||||||
|
QRegularExpression::CaseInsensitiveOption)))
|
||||||
{
|
{
|
||||||
name.append(tr(" (Disc %1)").arg(disc_nr));
|
name.append(tr(" (Disc %1)").arg(disc_nr));
|
||||||
}
|
}
|
||||||
|
@ -107,11 +109,14 @@ QVariant GameListModel::data(const QModelIndex& index, int role) const
|
||||||
{
|
{
|
||||||
constexpr int MAX_NUMBER_LENGTH = 10;
|
constexpr int MAX_NUMBER_LENGTH = 10;
|
||||||
|
|
||||||
QRegExp rx(QStringLiteral("\\d+"));
|
const QRegularExpression rx(QStringLiteral("\\d+"));
|
||||||
|
QRegularExpressionMatch match;
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
while ((pos = rx.indexIn(name, pos)) != -1)
|
while ((match = rx.match(name, pos)).hasMatch())
|
||||||
{
|
{
|
||||||
name.replace(pos, rx.matchedLength(), rx.cap().rightJustified(MAX_NUMBER_LENGTH));
|
pos = match.capturedStart();
|
||||||
|
name.replace(pos, match.capturedLength(),
|
||||||
|
match.captured().rightJustified(MAX_NUMBER_LENGTH));
|
||||||
pos += MAX_NUMBER_LENGTH;
|
pos += MAX_NUMBER_LENGTH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -654,7 +654,7 @@ void MainWindow::ConnectStack()
|
||||||
|
|
||||||
layout->addWidget(m_game_list);
|
layout->addWidget(m_game_list);
|
||||||
layout->addWidget(m_search_bar);
|
layout->addWidget(m_search_bar);
|
||||||
layout->setMargin(0);
|
layout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
connect(m_search_bar, &SearchBar::Search, m_game_list, &GameList::SetSearchTerm);
|
connect(m_search_bar, &SearchBar::Search, m_game_list, &GameList::SetSearchTerm);
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
#include <QActionGroup>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QFontDialog>
|
#include <QFontDialog>
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "DolphinQt/NetPlay/NetPlayDialog.h"
|
#include "DolphinQt/NetPlay/NetPlayDialog.h"
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
#include <QActionGroup>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
|
|
|
@ -151,7 +151,11 @@ QSize FlowLayout::minimumSize() const
|
||||||
for (const auto& item : m_item_list)
|
for (const auto& item : m_item_list)
|
||||||
size = size.expandedTo(item->minimumSize());
|
size = size.expandedTo(item->minimumSize());
|
||||||
|
|
||||||
size += QSize(2 * margin(), 2 * margin());
|
// Any direction's margin works, as they all set the same within the constructor.
|
||||||
|
int margin = 0;
|
||||||
|
getContentsMargins(&margin, nullptr, nullptr, nullptr);
|
||||||
|
|
||||||
|
size += QSize(2 * margin, 2 * margin);
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ void WrapInScrollArea(QWidget* parent, QLayout* wrapped_layout, QWidget* to_resi
|
||||||
|
|
||||||
auto* scroll_layout = new QVBoxLayout;
|
auto* scroll_layout = new QVBoxLayout;
|
||||||
scroll_layout->addWidget(scroll_area);
|
scroll_layout->addWidget(scroll_area);
|
||||||
scroll_layout->setMargin(0);
|
scroll_layout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
parent->setLayout(scroll_layout);
|
parent->setLayout(scroll_layout);
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,10 +221,10 @@ void AdvancedPane::ConnectLayout()
|
||||||
});
|
});
|
||||||
|
|
||||||
QDateTime initial_date_time;
|
QDateTime initial_date_time;
|
||||||
initial_date_time.setTime_t(SConfig::GetInstance().m_customRTCValue);
|
initial_date_time.setSecsSinceEpoch(SConfig::GetInstance().m_customRTCValue);
|
||||||
m_custom_rtc_datetime->setDateTime(initial_date_time);
|
m_custom_rtc_datetime->setDateTime(initial_date_time);
|
||||||
connect(m_custom_rtc_datetime, &QDateTimeEdit::dateTimeChanged, [this](QDateTime date_time) {
|
connect(m_custom_rtc_datetime, &QDateTimeEdit::dateTimeChanged, [this](QDateTime date_time) {
|
||||||
SConfig::GetInstance().m_customRTCValue = date_time.toTime_t();
|
SConfig::GetInstance().m_customRTCValue = static_cast<u32>(date_time.toSecsSinceEpoch());
|
||||||
Update();
|
Update();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue