mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-20 22:05:12 +00:00
Random stuff (#9589)
* minor coding style adjustment * Qt: simplify osk dialog buttons * replace std::find_if with convenience functions * RSX: use sv in swizzle comparison idk, I'll remove this if it was intentional. * overlays/osk: rename enter to return This one confused me and make me look for a bug that caused the "enter" key to be disabled, while it was actually the return key (obviously xD).
This commit is contained in:
parent
838cbe1840
commit
52deff06ba
9 changed files with 72 additions and 88 deletions
|
|
@ -2,12 +2,12 @@
|
|||
#include "custom_dialog.h"
|
||||
#include "Emu/Cell/Modules/cellMsgDialog.h"
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QTextEdit>
|
||||
#include <QHBoxLayout>
|
||||
#include <QFormLayout>
|
||||
#include <QPushButton>
|
||||
#include <QRegExpValidator>
|
||||
|
||||
constexpr auto qstr = QString::fromStdString;
|
||||
|
|
@ -47,17 +47,10 @@ void osk_dialog_frame::Create(const std::string& title, const std::u16string& me
|
|||
|
||||
// Text Input Counter
|
||||
const QString text = QString::fromStdU16String(std::u16string(init_text));
|
||||
QLabel* inputCount = new QLabel(QString("%1/%2").arg(text.length()).arg(charlimit));
|
||||
|
||||
// Ok Button
|
||||
QPushButton* button_ok = new QPushButton(tr("OK"), m_dialog);
|
||||
QLabel* input_count_label = new QLabel(QString("%1/%2").arg(text.length()).arg(charlimit));
|
||||
|
||||
// Button Layout
|
||||
QHBoxLayout* buttonsLayout = new QHBoxLayout;
|
||||
buttonsLayout->setAlignment(Qt::AlignCenter);
|
||||
buttonsLayout->addStretch();
|
||||
buttonsLayout->addWidget(button_ok);
|
||||
buttonsLayout->addStretch();
|
||||
QDialogButtonBox* button_box = new QDialogButtonBox(QDialogButtonBox::Ok);
|
||||
|
||||
// Input Layout
|
||||
QHBoxLayout* inputLayout = new QHBoxLayout;
|
||||
|
|
@ -79,7 +72,7 @@ void osk_dialog_frame::Create(const std::string& title, const std::u16string& me
|
|||
|
||||
connect(input, &QLineEdit::textChanged, [=, this](const QString& text)
|
||||
{
|
||||
inputCount->setText(QString("%1/%2").arg(text.length()).arg(charlimit));
|
||||
input_count_label->setText(QString("%1/%2").arg(text.length()).arg(charlimit));
|
||||
SetOskText(text);
|
||||
on_osk_input_entered();
|
||||
});
|
||||
|
|
@ -143,7 +136,7 @@ void osk_dialog_frame::Create(const std::string& title, const std::u16string& me
|
|||
|
||||
m_text_old = text;
|
||||
|
||||
inputCount->setText(QString("%1/%2").arg(text.length()).arg(charlimit));
|
||||
input_count_label->setText(QString("%1/%2").arg(text.length()).arg(charlimit));
|
||||
SetOskText(text);
|
||||
on_osk_input_entered();
|
||||
});
|
||||
|
|
@ -151,17 +144,17 @@ void osk_dialog_frame::Create(const std::string& title, const std::u16string& me
|
|||
inputLayout->addWidget(input);
|
||||
}
|
||||
|
||||
inputLayout->addWidget(inputCount);
|
||||
inputLayout->addWidget(input_count_label);
|
||||
|
||||
QFormLayout* layout = new QFormLayout(m_dialog);
|
||||
layout->setFormAlignment(Qt::AlignHCenter);
|
||||
layout->addRow(message_label);
|
||||
layout->addRow(inputLayout);
|
||||
layout->addRow(buttonsLayout);
|
||||
layout->addWidget(button_box);
|
||||
m_dialog->setLayout(layout);
|
||||
|
||||
// Events
|
||||
connect(button_ok, &QAbstractButton::clicked, m_dialog, &QDialog::accept);
|
||||
connect(button_box, &QDialogButtonBox::accepted, m_dialog, &QDialog::accept);
|
||||
|
||||
connect(m_dialog, &QDialog::accepted, [this]()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue