diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2019-06-02 11:55:13 -0400 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2019-06-02 11:55:13 -0400 |
| commit | 3c7b232361d01f79a1d48ae3d8200cb6a68bbf32 (patch) | |
| tree | 3b82f55b743f9ccf6a5b2cbcca2ab364f9a1ce87 /src/problemsdialog.cpp | |
| parent | f00314442b9c3c28e846c64da3c3f776e50656de (diff) | |
- 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
Diffstat (limited to 'src/problemsdialog.cpp')
| -rw-r--r-- | src/problemsdialog.cpp | 24 |
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()
|
