2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2011-08-29 15:59:31 +02:00
|
|
|
**
|
2016-01-15 14:58:39 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2011-08-29 15:59:31 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2011-08-29 15:59:31 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:58:39 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2011-08-29 15:59:31 +02:00
|
|
|
**
|
2016-01-15 14:58:39 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2011-08-29 15:59:31 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
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
|