mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-30 03:32:55 +00:00
Qt: Improve Check Config utility
Warn if the user selects a weird file. Allow more file types and show them all by default.
This commit is contained in:
parent
b2c4fed39c
commit
5b95cfda40
@ -11,7 +11,7 @@
|
||||
|
||||
LOG_CHANNEL(gui_log, "GUI");
|
||||
|
||||
config_checker::config_checker(QWidget* parent, const QString& path, bool is_log) : QDialog(parent)
|
||||
config_checker::config_checker(QWidget* parent, const QString& content, bool is_log) : QDialog(parent)
|
||||
{
|
||||
setObjectName("config_checker");
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
@ -22,7 +22,7 @@ config_checker::config_checker(QWidget* parent, const QString& path, bool is_log
|
||||
|
||||
QString result;
|
||||
|
||||
if (check_config(path, result, is_log))
|
||||
if (check_config(content, result, is_log))
|
||||
{
|
||||
setWindowTitle(tr("Interesting!"));
|
||||
|
||||
|
@ -2379,13 +2379,23 @@ void main_window::CreateConnects()
|
||||
connect(ui->toolsCheckConfigAct, &QAction::triggered, this, [this]
|
||||
{
|
||||
const QString path_last_cfg = m_gui_settings->GetValue(gui::fd_cfg_check).toString();
|
||||
const QString file_path = QFileDialog::getOpenFileName(this, tr("Select rpcs3.log or config.yml"), path_last_cfg, tr("Log files (*.log);;Config Files (*.yml);;All files (*.*)"));
|
||||
const QString file_path = QFileDialog::getOpenFileName(this, tr("Select rpcs3.log or config.yml"), path_last_cfg, tr("Log or Config files (*.log *.txt *.yml);;Log files (*.log);;Config Files (*.yml);;Text Files (*.txt);;All files (*.*)"));
|
||||
if (file_path.isEmpty())
|
||||
{
|
||||
// Aborted
|
||||
return;
|
||||
}
|
||||
|
||||
const QFileInfo file_info(file_path);
|
||||
|
||||
if (file_info.isExecutable() || !(file_path.endsWith(".log") || file_path.endsWith(".txt") || file_path.endsWith(".yml")))
|
||||
{
|
||||
if (QMessageBox::question(this, tr("Weird file!"), tr("This file seems to have an unexpected type:\n%0\n\nCheck anyway?").arg(file_path)) != QMessageBox::Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
QFile file(file_path);
|
||||
if (!file.exists() || !file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
@ -2393,7 +2403,7 @@ void main_window::CreateConnects()
|
||||
return;
|
||||
}
|
||||
|
||||
m_gui_settings->SetValue(gui::fd_cfg_check, QFileInfo(file_path).path());
|
||||
m_gui_settings->SetValue(gui::fd_cfg_check, file_info.path());
|
||||
|
||||
config_checker* dlg = new config_checker(this, file.readAll(), file_path.endsWith(".log"));
|
||||
dlg->exec();
|
||||
|
Loading…
x
Reference in New Issue
Block a user