summaryrefslogtreecommitdiff
path: root/src/problemsdialog.cpp
diff options
context:
space:
mode:
authorTannin <devnull@localhost>2013-04-13 19:23:18 +0200
committerTannin <devnull@localhost>2013-04-13 19:23:18 +0200
commit1c9018e9fdba7878b0ef605f81529c20ef3bbffe (patch)
tree7b52a5f7b9091ea68f03d06692bba4c240d30d49 /src/problemsdialog.cpp
parent528338d7bfb5479115511f77b70219eda1b32a62 (diff)
- 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)
Diffstat (limited to 'src/problemsdialog.cpp')
-rw-r--r--src/problemsdialog.cpp58
1 files changed, 58 insertions, 0 deletions
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 <utility.h>
+#include <iplugindiagnose.h>
+#include <QPushButton>
+#include <Shellapi.h>
+
+
+using namespace MOBase;
+
+
+ProblemsDialog::ProblemsDialog(std::vector<MOBase::IPluginDiagnose *> diagnosePlugins, QWidget *parent)
+ : QDialog(parent), ui(new Ui::ProblemsDialog)
+{
+ ui->setupUi(this);
+
+ foreach (IPluginDiagnose *diagnose, diagnosePlugins) {
+ std::vector<unsigned int> 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);
+}