summaryrefslogtreecommitdiff
path: root/src/problemsdialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/problemsdialog.cpp')
-rw-r--r--src/problemsdialog.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/problemsdialog.cpp b/src/problemsdialog.cpp
index 56109d34..1e8e800f 100644
--- a/src/problemsdialog.cpp
+++ b/src/problemsdialog.cpp
@@ -11,8 +11,9 @@
using namespace MOBase;
-ProblemsDialog::ProblemsDialog(std::vector<QObject *> pluginObjects, QWidget *parent)
- : QDialog(parent), ui(new Ui::ProblemsDialog), m_PluginObjects(pluginObjects)
+ProblemsDialog::ProblemsDialog(std::vector<QObject *> pluginObjects, QWidget *parent) :
+ QDialog(parent), ui(new Ui::ProblemsDialog), m_PluginObjects(pluginObjects),
+ m_hasProblems(false)
{
ui->setupUi(this);
@@ -30,7 +31,9 @@ ProblemsDialog::~ProblemsDialog()
void ProblemsDialog::runDiagnosis()
{
+ m_hasProblems = false;
ui->problemsWidget->clear();
+
for(QObject *pluginObj : m_PluginObjects) {
IPlugin *plugin = qobject_cast<IPlugin*>(pluginObj);
if (plugin != nullptr && !plugin->isActive())
@@ -47,6 +50,7 @@ void ProblemsDialog::runDiagnosis()
newItem->setData(0, Qt::UserRole, diagnose->fullDescription(key));
ui->problemsWidget->addTopLevelItem(newItem);
+ m_hasProblems = true;
if (diagnose->hasGuidedFix(key)) {
newItem->setText(1, tr("Fix"));
@@ -60,11 +64,25 @@ void ProblemsDialog::runDiagnosis()
}
}
}
+
+ if (!m_hasProblems) {
+ auto* item = new QTreeWidgetItem;
+
+ item->setText(0, tr("(There are no notifications)"));
+ item->setText(1, "");
+ item->setData(0, Qt::UserRole, QString());
+
+ QFont font = item->font(0);
+ font.setItalic(true);
+ item->setFont(0, font);
+
+ ui->problemsWidget->addTopLevelItem(item);
+ }
}
bool ProblemsDialog::hasProblems() const
{
- return ui->problemsWidget->topLevelItemCount() != 0;
+ return m_hasProblems;
}
void ProblemsDialog::selectionChanged()