From 1c9018e9fdba7878b0ef605f81529c20ef3bbffe Mon Sep 17 00:00:00 2001 From: Tannin Date: Sat, 13 Apr 2013 19:23:18 +0200 Subject: - bugfix: wrong multibyte to widechar conversion in hookdll breaks internationalization - bugfix: mod names not checked for validity on rename - bugfix: mod list wasn't invalidated after rename (regression?) - problem reports moved to separate dialog - ncc plugin now does the check for dotNet - python plugin wrapper started (only supports tools currently) - new ini editor plugin in python (non-functional currently) --- src/problemsdialog.cpp | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 src/problemsdialog.cpp (limited to 'src/problemsdialog.cpp') diff --git a/src/problemsdialog.cpp b/src/problemsdialog.cpp new file mode 100644 index 00000000..e0837f45 --- /dev/null +++ b/src/problemsdialog.cpp @@ -0,0 +1,58 @@ +#include "problemsdialog.h" +#include "ui_problemsdialog.h" +#include +#include +#include +#include + + +using namespace MOBase; + + +ProblemsDialog::ProblemsDialog(std::vector diagnosePlugins, QWidget *parent) + : QDialog(parent), ui(new Ui::ProblemsDialog) +{ + ui->setupUi(this); + + foreach (IPluginDiagnose *diagnose, diagnosePlugins) { + std::vector activeProblems = diagnose->activeProblems(); + foreach (unsigned int key, activeProblems) { + QTreeWidgetItem *newItem = new QTreeWidgetItem(); + newItem->setText(0, diagnose->shortDescription(key)); + newItem->setData(0, Qt::UserRole, diagnose->fullDescription(key)); + + if (diagnose->hasGuidedFix(key)) { + ui->problemsWidget->setItemWidget(newItem, 1, new QPushButton(tr("Fix"))); + } else { + newItem->setText(1, tr("No guided fix :(")); + } + ui->problemsWidget->addTopLevelItem(newItem); + } + } + connect(ui->problemsWidget, SIGNAL(itemSelectionChanged()), this, SLOT(selectionChanged())); + connect(ui->descriptionText, SIGNAL(anchorClicked(QUrl)), this, SLOT(urlClicked(QUrl))); +} + + +ProblemsDialog::~ProblemsDialog() +{ + delete ui; +} + + +bool ProblemsDialog::hasProblems() const +{ + return ui->problemsWidget->topLevelItemCount() != 0; +} + +void ProblemsDialog::selectionChanged() +{ + QString text = ui->problemsWidget->currentItem()->data(0, Qt::UserRole).toString(); + ui->descriptionText->setText(text); + ui->descriptionText->setLineWrapMode(text.contains('\n') ? QTextEdit::NoWrap : QTextEdit::WidgetWidth); +} + +void ProblemsDialog::urlClicked(const QUrl &url) +{ + ::ShellExecuteW(NULL, L"open", ToWString(url.toString()).c_str(), NULL, NULL, SW_SHOWNORMAL); +} -- cgit v1.3.1