From 3c7b232361d01f79a1d48ae3d8200cb6a68bbf32 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Sun, 2 Jun 2019 11:55:13 -0400 Subject: - always show statusbar, used by the menu and toolbar to display status tips - reduced margins around central widgets to align it with status bar text, removed bottom margins completely because the statusbar is enough - notifications: now always enabled, dialog shows a special item when empty, just change the tooltip and leave the text alone - added all toolbar actions to menu - non functional in menu for now: tools, help and endorse because they're menus - changed some of the action strings to be the same on both toolbar and menu, added missing status tips --- src/problemsdialog.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'src/problemsdialog.cpp') 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 pluginObjects, QWidget *parent) - : QDialog(parent), ui(new Ui::ProblemsDialog), m_PluginObjects(pluginObjects) +ProblemsDialog::ProblemsDialog(std::vector 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(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() -- cgit v1.3.1