mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-30 21:32:50 +00:00
[Qt] style adjustments 3
rename some members and clean headers
This commit is contained in:
parent
0cbbd3a5b1
commit
a95e01290e
@ -8,15 +8,15 @@ memory_string_searcher::memory_string_searcher(QWidget* parent)
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
setFixedSize(QSize(545, 64));
|
||||
|
||||
le_addr = new QLineEdit(this);
|
||||
le_addr->setFixedWidth(460);
|
||||
le_addr->setPlaceholderText(tr("Search..."));
|
||||
m_addr_line = new QLineEdit(this);
|
||||
m_addr_line->setFixedWidth(460);
|
||||
m_addr_line->setPlaceholderText(tr("Search..."));
|
||||
|
||||
button_search = new QPushButton(tr("&Search"), this);
|
||||
QPushButton* button_search = new QPushButton(tr("&Search"), this);
|
||||
button_search->setFixedWidth(60);
|
||||
|
||||
hbox_panel = new QHBoxLayout();
|
||||
hbox_panel->addWidget(le_addr);
|
||||
QHBoxLayout* hbox_panel = new QHBoxLayout();
|
||||
hbox_panel->addWidget(m_addr_line);
|
||||
hbox_panel->addWidget(button_search);
|
||||
|
||||
setLayout(hbox_panel);
|
||||
@ -26,7 +26,7 @@ memory_string_searcher::memory_string_searcher(QWidget* parent)
|
||||
|
||||
void memory_string_searcher::OnSearch()
|
||||
{
|
||||
const QString wstr = le_addr->text();
|
||||
const QString wstr = m_addr_line->text();
|
||||
const char *str = wstr.toStdString().c_str();
|
||||
const u32 len = wstr.length();
|
||||
|
||||
|
@ -13,9 +13,7 @@ class memory_string_searcher : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
QLineEdit* le_addr;
|
||||
QHBoxLayout* hbox_panel;
|
||||
QPushButton* button_search;
|
||||
QLineEdit* m_addr_line;
|
||||
|
||||
public:
|
||||
memory_string_searcher(QWidget* parent);
|
||||
|
@ -14,12 +14,13 @@ memory_viewer_panel::memory_viewer_panel(QWidget* parent)
|
||||
m_addr = 0;
|
||||
m_colcount = 16;
|
||||
m_rowcount = 16;
|
||||
pSize = 10;
|
||||
int pSize = 10;
|
||||
|
||||
//Font and Colors
|
||||
mono = QFontDatabase::systemFont(QFontDatabase::FixedFont);
|
||||
QFont mono = QFontDatabase::systemFont(QFontDatabase::FixedFont);
|
||||
mono.setPointSize(pSize);
|
||||
fontMetrics = new QFontMetrics(mono);
|
||||
m_fontMetrics = new QFontMetrics(mono);
|
||||
QPalette pal_bg;
|
||||
pal_bg.setColor(QPalette::Background, QColor(240, 240, 240));
|
||||
setPalette(pal_bg);
|
||||
|
||||
@ -36,19 +37,19 @@ memory_viewer_panel::memory_viewer_panel(QWidget* parent)
|
||||
//Tools: Memory Viewer Options: Address
|
||||
QGroupBox* tools_mem_addr = new QGroupBox(tr("Address"));
|
||||
QHBoxLayout* hbox_tools_mem_addr = new QHBoxLayout();
|
||||
t_addr = new QLineEdit(this);
|
||||
t_addr->setPlaceholderText("00000000");
|
||||
t_addr->setFont(mono);
|
||||
t_addr->setMaxLength(8);
|
||||
t_addr->setFixedWidth(75);
|
||||
t_addr->setFocus();
|
||||
hbox_tools_mem_addr->addWidget(t_addr);
|
||||
m_addr_line = new QLineEdit(this);
|
||||
m_addr_line->setPlaceholderText("00000000");
|
||||
m_addr_line->setFont(mono);
|
||||
m_addr_line->setMaxLength(8);
|
||||
m_addr_line->setFixedWidth(75);
|
||||
m_addr_line->setFocus();
|
||||
hbox_tools_mem_addr->addWidget(m_addr_line);
|
||||
tools_mem_addr->setLayout(hbox_tools_mem_addr);
|
||||
|
||||
//Tools: Memory Viewer Options: Bytes
|
||||
QGroupBox* tools_mem_bytes = new QGroupBox(tr("Bytes"));
|
||||
QHBoxLayout* hbox_tools_mem_bytes = new QHBoxLayout();
|
||||
sb_bytes = new QSpinBox(this);
|
||||
QSpinBox* sb_bytes = new QSpinBox(this);
|
||||
sb_bytes->setRange(1, 16);
|
||||
sb_bytes->setValue(16);
|
||||
hbox_tools_mem_bytes->addWidget(sb_bytes);
|
||||
@ -89,8 +90,8 @@ memory_viewer_panel::memory_viewer_panel(QWidget* parent)
|
||||
QGroupBox* tools_img_size = new QGroupBox(tr("Size"));
|
||||
QHBoxLayout* hbox_tools_img_size = new QHBoxLayout();
|
||||
QLabel* l_x = new QLabel(" x ");
|
||||
sb_img_size_x = new QSpinBox(this);
|
||||
sb_img_size_y = new QSpinBox(this);
|
||||
QSpinBox* sb_img_size_x = new QSpinBox(this);
|
||||
QSpinBox* sb_img_size_y = new QSpinBox(this);
|
||||
sb_img_size_x->setRange(1, 8192);
|
||||
sb_img_size_y->setRange(1, 8192);
|
||||
sb_img_size_x->setValue(256);
|
||||
@ -103,7 +104,7 @@ memory_viewer_panel::memory_viewer_panel(QWidget* parent)
|
||||
//Tools: Raw Image Preview Options: Mode
|
||||
QGroupBox* tools_img_mode = new QGroupBox(tr("Mode"));
|
||||
QHBoxLayout* hbox_tools_img_mode = new QHBoxLayout();
|
||||
cbox_img_mode = new QComboBox(this);
|
||||
QComboBox* cbox_img_mode = new QComboBox(this);
|
||||
cbox_img_mode->addItem("RGB");
|
||||
cbox_img_mode->addItem("ARGB");
|
||||
cbox_img_mode->addItem("RGBA");
|
||||
@ -136,48 +137,48 @@ memory_viewer_panel::memory_viewer_panel(QWidget* parent)
|
||||
QHBoxLayout* hbox_mem_panel = new QHBoxLayout();
|
||||
|
||||
//Memory Panel: Address Panel
|
||||
t_mem_addr = new QLabel("");
|
||||
t_mem_addr->setFont(mono);
|
||||
t_mem_addr->setAutoFillBackground(true);
|
||||
t_mem_addr->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
|
||||
QPalette palette_addr = t_mem_addr->palette();
|
||||
palette_addr.setColor(t_mem_addr->backgroundRole(), QColor(240, 240, 240));
|
||||
palette_addr.setColor(t_mem_addr->foregroundRole(), QColor(75, 135, 150));
|
||||
t_mem_addr->setPalette(palette_addr);
|
||||
m_mem_addr = new QLabel("");
|
||||
m_mem_addr->setFont(mono);
|
||||
m_mem_addr->setAutoFillBackground(true);
|
||||
m_mem_addr->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
|
||||
QPalette palette_addr = m_mem_addr->palette();
|
||||
palette_addr.setColor(m_mem_addr->backgroundRole(), QColor(240, 240, 240));
|
||||
palette_addr.setColor(m_mem_addr->foregroundRole(), QColor(75, 135, 150));
|
||||
m_mem_addr->setPalette(palette_addr);
|
||||
|
||||
//Memory Panel: Hex Panel
|
||||
t_mem_hex = new QLabel("");
|
||||
t_mem_hex->setFont(mono);
|
||||
t_mem_hex->setAutoFillBackground(true);
|
||||
t_mem_hex->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
|
||||
QPalette palette_hex = t_mem_hex->palette();
|
||||
palette_hex.setColor(t_mem_hex->backgroundRole(), QColor(240, 240, 240));
|
||||
palette_hex.setColor(t_mem_hex->foregroundRole(), Qt::black);
|
||||
t_mem_hex->setPalette(palette_hex);
|
||||
m_mem_hex = new QLabel("");
|
||||
m_mem_hex->setFont(mono);
|
||||
m_mem_hex->setAutoFillBackground(true);
|
||||
m_mem_hex->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
|
||||
QPalette palette_hex = m_mem_hex->palette();
|
||||
palette_hex.setColor(m_mem_hex->backgroundRole(), QColor(240, 240, 240));
|
||||
palette_hex.setColor(m_mem_hex->foregroundRole(), Qt::black);
|
||||
m_mem_hex->setPalette(palette_hex);
|
||||
|
||||
//Memory Panel: ASCII Panel
|
||||
t_mem_ascii = new QLabel("");
|
||||
t_mem_ascii->setFont(mono);
|
||||
t_mem_ascii->setAutoFillBackground(true);
|
||||
t_mem_ascii->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
|
||||
QPalette palette_ascii = t_mem_ascii->palette();
|
||||
palette_ascii.setColor(t_mem_ascii->backgroundRole(), QColor(240, 240, 240));
|
||||
palette_ascii.setColor(t_mem_ascii->foregroundRole(), Qt::black);
|
||||
t_mem_ascii->setPalette(palette_ascii);
|
||||
m_mem_ascii = new QLabel("");
|
||||
m_mem_ascii->setFont(mono);
|
||||
m_mem_ascii->setAutoFillBackground(true);
|
||||
m_mem_ascii->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
|
||||
QPalette palette_ascii = m_mem_ascii->palette();
|
||||
palette_ascii.setColor(m_mem_ascii->backgroundRole(), QColor(240, 240, 240));
|
||||
palette_ascii.setColor(m_mem_ascii->foregroundRole(), Qt::black);
|
||||
m_mem_ascii->setPalette(palette_ascii);
|
||||
|
||||
//Merge Memory Panel:
|
||||
hbox_mem_panel->setAlignment(Qt::AlignLeft);
|
||||
hbox_mem_panel->addSpacing(20);
|
||||
hbox_mem_panel->addWidget(t_mem_addr);
|
||||
hbox_mem_panel->addWidget(m_mem_addr);
|
||||
hbox_mem_panel->addSpacing(10);
|
||||
hbox_mem_panel->addWidget(t_mem_hex);
|
||||
hbox_mem_panel->addWidget(m_mem_hex);
|
||||
hbox_mem_panel->addSpacing(10);
|
||||
hbox_mem_panel->addWidget(t_mem_ascii);
|
||||
hbox_mem_panel->addWidget(m_mem_ascii);
|
||||
hbox_mem_panel->addSpacing(10);
|
||||
|
||||
//Memory Panel: Set size of the QTextEdits
|
||||
t_mem_hex->setFixedSize(QSize(pSize * 3 * m_colcount + 6, 228));
|
||||
t_mem_ascii->setFixedSize(QSize(pSize * m_colcount + 6, 228));
|
||||
m_mem_hex->setFixedSize(QSize(pSize * 3 * m_colcount + 6, 228));
|
||||
m_mem_ascii->setFixedSize(QSize(pSize * m_colcount + 6, 228));
|
||||
|
||||
//Set Margins to adjust WindowSize
|
||||
vbox_panel->setContentsMargins(0, 0, 0, 0);
|
||||
@ -201,16 +202,18 @@ memory_viewer_panel::memory_viewer_panel(QWidget* parent)
|
||||
setLayout(vbox_panel);
|
||||
|
||||
//Events
|
||||
connect(t_addr, &QLineEdit::returnPressed, [=](){
|
||||
connect(m_addr_line, &QLineEdit::returnPressed, [=]
|
||||
{
|
||||
bool ok;
|
||||
m_addr = t_addr->text().toULong(&ok, 16);
|
||||
t_addr->setText(QString("%1").arg(m_addr, 8, 16, QChar('0'))); // get 8 digits in input line
|
||||
m_addr = m_addr_line->text().toULong(&ok, 16);
|
||||
m_addr_line->setText(QString("%1").arg(m_addr, 8, 16, QChar('0'))); // get 8 digits in input line
|
||||
ShowMemory();
|
||||
});
|
||||
connect(sb_bytes, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), [=](){
|
||||
connect(sb_bytes, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), [=]
|
||||
{
|
||||
m_colcount = sb_bytes->value();
|
||||
t_mem_hex->setFixedSize(QSize(pSize * 3 * m_colcount + 6, 228));
|
||||
t_mem_ascii->setFixedSize(QSize(pSize * m_colcount + 6, 228));
|
||||
m_mem_hex->setFixedSize(QSize(pSize * 3 * m_colcount + 6, 228));
|
||||
m_mem_ascii->setFixedSize(QSize(pSize * m_colcount + 6, 228));
|
||||
ShowMemory();
|
||||
});
|
||||
|
||||
@ -246,7 +249,7 @@ void memory_viewer_panel::wheelEvent(QWheelEvent *event)
|
||||
QPoint numSteps = event->angleDelta() / 8 / 15; // http://doc.qt.io/qt-5/qwheelevent.html#pixelDelta
|
||||
m_addr -= stepSize * m_colcount * numSteps.y();
|
||||
|
||||
t_addr->setText(qstr(fmt::format("%08x", m_addr)));
|
||||
m_addr_line->setText(qstr(fmt::format("%08x", m_addr)));
|
||||
ShowMemory();
|
||||
}
|
||||
|
||||
@ -289,19 +292,19 @@ void memory_viewer_panel::ShowMemory()
|
||||
}
|
||||
}
|
||||
|
||||
t_mem_addr->setText(t_mem_addr_str);
|
||||
t_mem_hex->setText(t_mem_hex_str);
|
||||
t_mem_ascii->setText(t_mem_ascii_str);
|
||||
m_mem_addr->setText(t_mem_addr_str);
|
||||
m_mem_hex->setText(t_mem_hex_str);
|
||||
m_mem_ascii->setText(t_mem_ascii_str);
|
||||
|
||||
// Adjust Text Boxes
|
||||
textSize = fontMetrics->size(0, t_mem_addr->text());
|
||||
t_mem_addr->setFixedSize(textSize.width() + 10, textSize.height() + 10);
|
||||
QSize textSize = m_fontMetrics->size(0, m_mem_addr->text());
|
||||
m_mem_addr->setFixedSize(textSize.width() + 10, textSize.height() + 10);
|
||||
|
||||
textSize = fontMetrics->size(0, t_mem_hex->text());
|
||||
t_mem_hex->setFixedSize(textSize.width() + 10, textSize.height() + 10);
|
||||
textSize = m_fontMetrics->size(0, m_mem_hex->text());
|
||||
m_mem_hex->setFixedSize(textSize.width() + 10, textSize.height() + 10);
|
||||
|
||||
textSize = fontMetrics->size(0, t_mem_ascii->text());
|
||||
t_mem_ascii->setFixedSize(textSize.width() + 10, textSize.height() + 10);
|
||||
textSize = m_fontMetrics->size(0, m_mem_ascii->text());
|
||||
m_mem_ascii->setFixedSize(textSize.width() + 10, textSize.height() + 10);
|
||||
}
|
||||
|
||||
void memory_viewer_panel::SetPC(const uint pc)
|
||||
|
@ -20,23 +20,14 @@ class memory_viewer_panel : public QDialog
|
||||
u32 m_addr;
|
||||
u32 m_colcount;
|
||||
u32 m_rowcount;
|
||||
u32 pSize;
|
||||
|
||||
QLineEdit* t_addr;
|
||||
QSpinBox* sb_bytes;
|
||||
QLineEdit* m_addr_line;
|
||||
|
||||
QSpinBox* sb_img_size_x;
|
||||
QSpinBox* sb_img_size_y;
|
||||
QComboBox* cbox_img_mode;
|
||||
QLabel* m_mem_addr;
|
||||
QLabel* m_mem_hex;
|
||||
QLabel* m_mem_ascii;
|
||||
|
||||
QLabel* t_mem_addr;
|
||||
QLabel* t_mem_hex;
|
||||
QLabel* t_mem_ascii;
|
||||
QFont mono;
|
||||
QFontMetrics* fontMetrics;
|
||||
QSize textSize;
|
||||
QPalette pal_bg;
|
||||
QPalette pal_fg;
|
||||
QFontMetrics* m_fontMetrics;
|
||||
|
||||
public:
|
||||
bool exit;
|
||||
|
@ -7,9 +7,9 @@ inline std::string sstr(const QVariant& _in) { return sstr(_in.toString()); }
|
||||
|
||||
register_editor_dialog::register_editor_dialog(QWidget *parent, u32 _pc, const std::shared_ptr<cpu_thread>& _cpu, CPUDisAsm* _disasm)
|
||||
: QDialog(parent)
|
||||
, pc(_pc)
|
||||
, m_pc(_pc)
|
||||
, cpu(_cpu)
|
||||
, disasm(_disasm)
|
||||
, m_disasm(_disasm)
|
||||
{
|
||||
setWindowTitle(tr("Edit registers"));
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
@ -28,16 +28,16 @@ register_editor_dialog::register_editor_dialog(QWidget *parent, u32 _pc, const s
|
||||
button_ok->setFixedWidth(80);
|
||||
button_cancel->setFixedWidth(80);
|
||||
|
||||
t1_register = new QComboBox(this);
|
||||
t2_value = new QLineEdit(this);
|
||||
t2_value->setFixedWidth(200);
|
||||
m_register_combo = new QComboBox(this);
|
||||
m_value_line = new QLineEdit(this);
|
||||
m_value_line->setFixedWidth(200);
|
||||
|
||||
// Layouts
|
||||
vbox_left_panel->addWidget(t1_text);
|
||||
vbox_left_panel->addWidget(t2_text);
|
||||
|
||||
vbox_right_panel->addWidget(t1_register);
|
||||
vbox_right_panel->addWidget(t2_value);
|
||||
vbox_right_panel->addWidget(m_register_combo);
|
||||
vbox_right_panel->addWidget(m_value_line);
|
||||
|
||||
hbox_button_panel->addWidget(button_ok);
|
||||
hbox_button_panel->addWidget(button_cancel);
|
||||
@ -49,18 +49,18 @@ register_editor_dialog::register_editor_dialog(QWidget *parent, u32 _pc, const s
|
||||
{
|
||||
if (_cpu->id_type() == 1)
|
||||
{
|
||||
for (int i = 0; i < 32; i++) t1_register->addItem(qstr(fmt::format("GPR[%d]", i)));
|
||||
for (int i = 0; i < 32; i++) t1_register->addItem(qstr(fmt::format("FPR[%d]", i)));
|
||||
for (int i = 0; i < 32; i++) t1_register->addItem(qstr(fmt::format("VR[%d]", i)));
|
||||
t1_register->addItem("CR");
|
||||
t1_register->addItem("LR");
|
||||
t1_register->addItem("CTR");
|
||||
//t1_register->addItem("XER");
|
||||
//t1_register->addItem("FPSCR");
|
||||
for (int i = 0; i < 32; i++) m_register_combo->addItem(qstr(fmt::format("GPR[%d]", i)));
|
||||
for (int i = 0; i < 32; i++) m_register_combo->addItem(qstr(fmt::format("FPR[%d]", i)));
|
||||
for (int i = 0; i < 32; i++) m_register_combo->addItem(qstr(fmt::format("VR[%d]", i)));
|
||||
m_register_combo->addItem("CR");
|
||||
m_register_combo->addItem("LR");
|
||||
m_register_combo->addItem("CTR");
|
||||
//m_register_combo->addItem("XER");
|
||||
//m_register_combo->addItem("FPSCR");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < 128; i++) t1_register->addItem(qstr(fmt::format("GPR[%d]", i)));
|
||||
for (int i = 0; i < 128; i++) m_register_combo->addItem(qstr(fmt::format("GPR[%d]", i)));
|
||||
}
|
||||
|
||||
break;
|
||||
@ -84,14 +84,14 @@ register_editor_dialog::register_editor_dialog(QWidget *parent, u32 _pc, const s
|
||||
// Events
|
||||
connect(button_ok, &QAbstractButton::pressed, this, [=](){OnOkay(_cpu); accept();});
|
||||
connect(button_cancel, &QAbstractButton::pressed, this, ®ister_editor_dialog::reject);
|
||||
connect(t1_register, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, ®ister_editor_dialog::updateRegister);
|
||||
connect(m_register_combo, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, ®ister_editor_dialog::updateRegister);
|
||||
}
|
||||
|
||||
void register_editor_dialog::updateRegister()
|
||||
{
|
||||
const auto cpu = this->cpu.lock();
|
||||
|
||||
std::string reg = sstr(t1_register->itemData(t1_register->currentIndex()));
|
||||
std::string reg = sstr(m_register_combo->itemData(m_register_combo->currentIndex()));
|
||||
std::string str;
|
||||
|
||||
if (g_system == system_type::ps3 && cpu->id_type() == 1)
|
||||
@ -123,15 +123,15 @@ void register_editor_dialog::updateRegister()
|
||||
}
|
||||
}
|
||||
|
||||
t2_value->setText(qstr(str));
|
||||
m_value_line->setText(qstr(str));
|
||||
}
|
||||
|
||||
void register_editor_dialog::OnOkay(const std::shared_ptr<cpu_thread>& _cpu)
|
||||
{
|
||||
const auto cpu = _cpu.get();
|
||||
|
||||
std::string reg = sstr(t1_register->itemData(t1_register->currentIndex()));
|
||||
std::string value = sstr(t2_value->text());
|
||||
std::string reg = sstr(m_register_combo->itemData(m_register_combo->currentIndex()));
|
||||
std::string value = sstr(m_value_line->text());
|
||||
|
||||
if (g_system == system_type::ps3 && cpu->id_type() == 1)
|
||||
{
|
||||
|
@ -17,11 +17,10 @@
|
||||
|
||||
class register_editor_dialog : public QDialog
|
||||
{
|
||||
u32 pc;
|
||||
CPUDisAsm* disasm;
|
||||
QComboBox* t1_register;
|
||||
QLineEdit* t2_value;
|
||||
QLabel* t3_preview;
|
||||
u32 m_pc;
|
||||
CPUDisAsm* m_disasm;
|
||||
QComboBox* m_register_combo;
|
||||
QLineEdit* m_value_line;
|
||||
|
||||
public:
|
||||
std::weak_ptr<cpu_thread> cpu;
|
||||
|
@ -10,49 +10,49 @@ inline std::string sstr(const QString& _in) { return _in.toUtf8().toStdString();
|
||||
vfs_dialog_tab::vfs_dialog_tab(const vfs_settings_info& settingsInfo, gui_settings* guiSettings, emu_settings* emuSettings, QWidget* parent) : QWidget(parent),
|
||||
m_info(settingsInfo), m_gui_settings(guiSettings), m_emu_settings(emuSettings)
|
||||
{
|
||||
dirList = new QListWidget(this);
|
||||
m_dirList = new QListWidget(this);
|
||||
|
||||
QStringList alldirs = m_gui_settings->GetValue(m_info.listLocation).toStringList();
|
||||
|
||||
// We must show the currently selected config.
|
||||
if (alldirs.contains(EmuConfigDir()) == false)
|
||||
{
|
||||
new QListWidgetItem(EmuConfigDir(), dirList);
|
||||
new QListWidgetItem(EmuConfigDir(), m_dirList);
|
||||
}
|
||||
for (QString dir : alldirs)
|
||||
{
|
||||
new QListWidgetItem(dir, dirList);
|
||||
new QListWidgetItem(dir, m_dirList);
|
||||
}
|
||||
|
||||
dirList->setMinimumWidth(dirList->sizeHintForColumn(0));
|
||||
m_dirList->setMinimumWidth(m_dirList->sizeHintForColumn(0));
|
||||
|
||||
QHBoxLayout* selectedConfigLayout = new QHBoxLayout;
|
||||
QLabel* selectedMessage = new QLabel(m_info.name + " directory:");
|
||||
selectedConfigLabel = new QLabel();
|
||||
selectedConfigLabel->setText(EmuConfigDir());
|
||||
if (selectedConfigLabel->text() == "")
|
||||
m_selectedConfigLabel = new QLabel();
|
||||
m_selectedConfigLabel->setText(EmuConfigDir());
|
||||
if (m_selectedConfigLabel->text() == "")
|
||||
{
|
||||
selectedConfigLabel->setText(EmptyPath);
|
||||
m_selectedConfigLabel->setText(EmptyPath);
|
||||
}
|
||||
selectedConfigLayout->addWidget(selectedMessage);
|
||||
selectedConfigLayout->addWidget(selectedConfigLabel);
|
||||
selectedConfigLayout->addWidget(m_selectedConfigLabel);
|
||||
selectedConfigLayout->addStretch();
|
||||
|
||||
QVBoxLayout* vbox = new QVBoxLayout;
|
||||
vbox->addWidget(dirList);
|
||||
vbox->addWidget(m_dirList);
|
||||
vbox->addLayout(selectedConfigLayout);
|
||||
|
||||
setLayout(vbox);
|
||||
|
||||
connect(dirList, &QListWidget::itemDoubleClicked, [this](QListWidgetItem* item)
|
||||
connect(m_dirList, &QListWidget::itemDoubleClicked, [this](QListWidgetItem* item)
|
||||
{
|
||||
if (item->text() == "")
|
||||
{
|
||||
selectedConfigLabel->setText(EmptyPath);
|
||||
m_selectedConfigLabel->setText(EmptyPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
selectedConfigLabel->setText(item->text());
|
||||
m_selectedConfigLabel->setText(item->text());
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -60,35 +60,35 @@ m_info(settingsInfo), m_gui_settings(guiSettings), m_emu_settings(emuSettings)
|
||||
void vfs_dialog_tab::SaveSettings()
|
||||
{
|
||||
QStringList allDirs;
|
||||
for (int i = 0; i < dirList->count(); ++i)
|
||||
for (int i = 0; i < m_dirList->count(); ++i)
|
||||
{
|
||||
allDirs += dirList->item(i)->text();
|
||||
allDirs += m_dirList->item(i)->text();
|
||||
}
|
||||
|
||||
m_gui_settings->SetValue(m_info.listLocation, allDirs);
|
||||
if (selectedConfigLabel->text() == EmptyPath)
|
||||
if (m_selectedConfigLabel->text() == EmptyPath)
|
||||
{
|
||||
m_info.cfg_node->from_string("");
|
||||
m_emu_settings->SetSetting(m_info.settingLoc, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_info.cfg_node->from_string(sstr(selectedConfigLabel->text()));
|
||||
m_emu_settings->SetSetting(m_info.settingLoc, sstr(selectedConfigLabel->text()));
|
||||
m_info.cfg_node->from_string(sstr(m_selectedConfigLabel->text()));
|
||||
m_emu_settings->SetSetting(m_info.settingLoc, sstr(m_selectedConfigLabel->text()));
|
||||
}
|
||||
m_emu_settings->SaveSettings();
|
||||
}
|
||||
|
||||
void vfs_dialog_tab::Reset()
|
||||
{
|
||||
dirList->clear();
|
||||
m_dirList->clear();
|
||||
m_info.cfg_node->from_default();
|
||||
selectedConfigLabel->setText(EmuConfigDir());
|
||||
if (selectedConfigLabel->text() == "")
|
||||
m_selectedConfigLabel->setText(EmuConfigDir());
|
||||
if (m_selectedConfigLabel->text() == "")
|
||||
{
|
||||
selectedConfigLabel->setText(EmptyPath);
|
||||
m_selectedConfigLabel->setText(EmptyPath);
|
||||
}
|
||||
dirList->addItem(new QListWidgetItem(EmuConfigDir()));
|
||||
m_dirList->addItem(new QListWidgetItem(EmuConfigDir()));
|
||||
m_gui_settings->SetValue(m_info.listLocation, QStringList(EmuConfigDir()));
|
||||
}
|
||||
|
||||
@ -98,8 +98,8 @@ void vfs_dialog_tab::AddNewDirectory()
|
||||
if (dir != "")
|
||||
{
|
||||
if (dir.endsWith("/") == false) dir += '/';
|
||||
new QListWidgetItem(dir, dirList);
|
||||
selectedConfigLabel->setText(dir);
|
||||
new QListWidgetItem(dir, m_dirList);
|
||||
m_selectedConfigLabel->setText(dir);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,6 @@ private:
|
||||
emu_settings* m_emu_settings;
|
||||
|
||||
// UI variables needed in higher scope
|
||||
QListWidget* dirList;
|
||||
QLabel* selectedConfigLabel;
|
||||
QListWidget* m_dirList;
|
||||
QLabel* m_selectedConfigLabel;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user