2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
2011-08-29 15:59:31 +02:00
|
|
|
|
|
|
|
|
#include "pluginerroroverview.h"
|
|
|
|
|
#include "ui_pluginerroroverview.h"
|
|
|
|
|
#include "pluginspec.h"
|
|
|
|
|
#include "pluginmanager.h"
|
|
|
|
|
|
|
|
|
|
Q_DECLARE_METATYPE(ExtensionSystem::PluginSpec*)
|
|
|
|
|
|
|
|
|
|
namespace ExtensionSystem {
|
|
|
|
|
|
2020-02-07 16:02:22 +01:00
|
|
|
/*!
|
|
|
|
|
\class ExtensionSystem::PluginErrorOverview
|
|
|
|
|
\internal
|
|
|
|
|
*/
|
|
|
|
|
|
2012-06-18 11:34:15 +02:00
|
|
|
PluginErrorOverview::PluginErrorOverview(QWidget *parent) :
|
2011-08-29 15:59:31 +02:00
|
|
|
QDialog(parent),
|
2012-11-02 09:44:53 +01:00
|
|
|
m_ui(new Internal::Ui::PluginErrorOverview)
|
2011-08-29 15:59:31 +02:00
|
|
|
{
|
2012-11-02 09:44:53 +01:00
|
|
|
m_ui->setupUi(this);
|
2011-08-29 15:59:31 +02:00
|
|
|
m_ui->buttonBox->addButton(tr("Continue"), QDialogButtonBox::AcceptRole);
|
|
|
|
|
|
2020-02-14 08:51:08 +01:00
|
|
|
for (PluginSpec *spec : PluginManager::plugins()) {
|
2011-08-29 15:59:31 +02:00
|
|
|
// only show errors on startup if plugin is enabled.
|
2015-03-31 17:42:14 +02:00
|
|
|
if (spec->hasError() && spec->isEffectivelyEnabled()) {
|
2011-08-29 15:59:31 +02:00
|
|
|
QListWidgetItem *item = new QListWidgetItem(spec->name());
|
2019-05-27 13:32:20 +02:00
|
|
|
item->setData(Qt::UserRole, QVariant::fromValue(spec));
|
2011-08-29 15:59:31 +02:00
|
|
|
m_ui->pluginList->addItem(item);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-04 10:11:46 +01:00
|
|
|
connect(m_ui->pluginList, &QListWidget::currentItemChanged,
|
|
|
|
|
this, &PluginErrorOverview::showDetails);
|
2011-08-29 15:59:31 +02:00
|
|
|
|
|
|
|
|
if (m_ui->pluginList->count() > 0)
|
|
|
|
|
m_ui->pluginList->setCurrentRow(0);
|
|
|
|
|
}
|
|
|
|
|
|
2012-11-02 09:44:53 +01:00
|
|
|
PluginErrorOverview::~PluginErrorOverview()
|
2011-08-29 15:59:31 +02:00
|
|
|
{
|
|
|
|
|
delete m_ui;
|
|
|
|
|
}
|
|
|
|
|
|
2012-11-02 09:44:53 +01:00
|
|
|
void PluginErrorOverview::showDetails(QListWidgetItem *item)
|
2011-08-29 15:59:31 +02:00
|
|
|
{
|
|
|
|
|
if (item) {
|
2018-07-19 23:19:33 +02:00
|
|
|
auto *spec = item->data(Qt::UserRole).value<PluginSpec *>();
|
2011-08-29 15:59:31 +02:00
|
|
|
m_ui->pluginError->setText(spec->errorString());
|
|
|
|
|
} else {
|
2014-07-23 09:53:06 +02:00
|
|
|
m_ui->pluginError->clear();
|
2011-08-29 15:59:31 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-11-02 09:44:53 +01:00
|
|
|
} // namespace ExtensionSystem
|