diff --git a/src/app/main.cpp b/src/app/main.cpp index dc3f22ed49d..f9d694cf502 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -353,15 +354,10 @@ int main(int argc, char **argv) return 1; } { - QStringList errors; - foreach (ExtensionSystem::PluginSpec *p, pluginManager.plugins()) - // only show errors on startup if plugin is enabled. - if (p->hasError() && p->isEnabled() && !p->isDisabledIndirectly()) - errors.append(p->name() + "\n" + p->errorString()); - if (!errors.isEmpty()) - QMessageBox::warning(0, - QCoreApplication::translate("Application", "Qt Creator - Plugin loader messages"), - errors.join(QString::fromLatin1("\n\n"))); + if (pluginManager.hasError()) { + ExtensionSystem::PluginErrorOverview errorOverview(&pluginManager); + errorOverview.exec(); + } } if (isFirstInstance) { @@ -385,4 +381,3 @@ int main(int argc, char **argv) return app.exec(); } - diff --git a/src/libs/extensionsystem/extensionsystem.pro b/src/libs/extensionsystem/extensionsystem.pro index de1f49f25b2..3d9b36c44c3 100644 --- a/src/libs/extensionsystem/extensionsystem.pro +++ b/src/libs/extensionsystem/extensionsystem.pro @@ -21,7 +21,8 @@ HEADERS += pluginerrorview.h \ pluginview.h \ pluginview_p.h \ optionsparser.h \ - plugincollection.h + plugincollection.h \ + pluginerroroverview.h SOURCES += pluginerrorview.cpp \ plugindetailsview.cpp \ invoker.cpp \ @@ -30,8 +31,13 @@ SOURCES += pluginerrorview.cpp \ pluginspec.cpp \ pluginview.cpp \ optionsparser.cpp \ - plugincollection.cpp + plugincollection.cpp \ + pluginerroroverview.cpp FORMS += pluginview.ui \ pluginerrorview.ui \ - plugindetailsview.ui + plugindetailsview.ui \ + pluginerroroverview.ui RESOURCES += pluginview.qrc + + + diff --git a/src/libs/extensionsystem/pluginerroroverview.cpp b/src/libs/extensionsystem/pluginerroroverview.cpp new file mode 100644 index 00000000000..fd4c39f8240 --- /dev/null +++ b/src/libs/extensionsystem/pluginerroroverview.cpp @@ -0,0 +1,113 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + +#include "pluginerroroverview.h" +#include "ui_pluginerroroverview.h" +#include "pluginspec.h" +#include "pluginmanager.h" + +Q_DECLARE_METATYPE(ExtensionSystem::PluginSpec*) + +namespace ExtensionSystem { +namespace Internal { + +class PluginErrorOverviewPrivate : public QObject +{ + Q_OBJECT +public: + PluginErrorOverviewPrivate(PluginManager *manager, QDialog *dialog); + ~PluginErrorOverviewPrivate(); + +private slots: + void showDetails(QListWidgetItem *item); + +private: + Ui::PluginErrorOverview *m_ui; + PluginManager *m_manager; +}; + +} // Internal +} // ExtensionSystem + +using namespace ExtensionSystem; +using namespace ExtensionSystem::Internal; + +PluginErrorOverview::PluginErrorOverview(PluginManager *manager, QWidget *parent) : + QDialog(parent), + d(new PluginErrorOverviewPrivate(manager, this)) +{ +} + +PluginErrorOverview::~PluginErrorOverview() +{ + delete d; +} + +PluginErrorOverviewPrivate::PluginErrorOverviewPrivate(PluginManager *manager, QDialog *dialog) + : m_ui(new Ui::PluginErrorOverview), + m_manager(manager) +{ + m_ui->setupUi(dialog); + m_ui->buttonBox->addButton(tr("Continue"), QDialogButtonBox::AcceptRole); + + foreach (PluginSpec *spec, m_manager->plugins()) { + // only show errors on startup if plugin is enabled. + if (spec->hasError() && spec->isEnabled() && !spec->isDisabledIndirectly()) { + QListWidgetItem *item = new QListWidgetItem(spec->name()); + item->setData(Qt::UserRole, qVariantFromValue(spec)); + m_ui->pluginList->addItem(item); + } + } + + connect(m_ui->pluginList, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), + this, SLOT(showDetails(QListWidgetItem*))); + + if (m_ui->pluginList->count() > 0) + m_ui->pluginList->setCurrentRow(0); +} + +PluginErrorOverviewPrivate::~PluginErrorOverviewPrivate() +{ + delete m_ui; +} + +void PluginErrorOverviewPrivate::showDetails(QListWidgetItem *item) +{ + if (item) { + PluginSpec *spec = item->data(Qt::UserRole).value(); + m_ui->pluginError->setText(spec->errorString()); + } else { + m_ui->pluginError->setText(QString()); + } +} + +#include "pluginerroroverview.moc" diff --git a/src/libs/extensionsystem/pluginerroroverview.h b/src/libs/extensionsystem/pluginerroroverview.h new file mode 100644 index 00000000000..44f63cc8d22 --- /dev/null +++ b/src/libs/extensionsystem/pluginerroroverview.h @@ -0,0 +1,62 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + +#ifndef PLUGINERROROVERVIEW_H +#define PLUGINERROROVERVIEW_H + +#include "extensionsystem_global.h" + +#include + +namespace ExtensionSystem { + +class PluginManager; + +namespace Internal { +class PluginErrorOverviewPrivate; +} + +class EXTENSIONSYSTEM_EXPORT PluginErrorOverview : public QDialog +{ + Q_OBJECT + +public: + explicit PluginErrorOverview(PluginManager *manager, QWidget *parent = 0); + ~PluginErrorOverview(); + +private: + Internal::PluginErrorOverviewPrivate *d; +}; + +} // ExtensionSystem + +#endif // PLUGINERROROVERVIEW_H diff --git a/src/libs/extensionsystem/pluginerroroverview.ui b/src/libs/extensionsystem/pluginerroroverview.ui new file mode 100644 index 00000000000..768b2f65732 --- /dev/null +++ b/src/libs/extensionsystem/pluginerroroverview.ui @@ -0,0 +1,91 @@ + + + ExtensionSystem::Internal::PluginErrorOverview + + + + 0 + 0 + 434 + 361 + + + + Qt Creator - Plugin loader messages + + + + + + The following plugins have errors and cannot be loaded: + + + true + + + + + + + + + + Details: + + + + + + + true + + + + + + + Qt::Horizontal + + + QDialogButtonBox::NoButton + + + + + + + + + buttonBox + accepted() + ExtensionSystem::Internal::PluginErrorOverview + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + ExtensionSystem::Internal::PluginErrorOverview + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/src/libs/extensionsystem/pluginmanager.cpp b/src/libs/extensionsystem/pluginmanager.cpp index fcb4c8443cb..e5edf5caa66 100644 --- a/src/libs/extensionsystem/pluginmanager.cpp +++ b/src/libs/extensionsystem/pluginmanager.cpp @@ -328,6 +328,22 @@ void PluginManager::loadPlugins() return d->loadPlugins(); } +/*! + \fn bool PluginManager::hasError() const + Returns true if any plugin has errors even though it is enabled. + Most useful to call after loadPlugins(). +*/ +bool PluginManager::hasError() const +{ + foreach (PluginSpec *spec, plugins()) { + // only show errors on startup if plugin is enabled. + if (spec->hasError() && spec->isEnabled() && !spec->isDisabledIndirectly()) { + return true; + } + } + return false; +} + /*! \fn void PluginManager::shutdown() Shuts down and deletes all plugins. diff --git a/src/libs/extensionsystem/pluginmanager.h b/src/libs/extensionsystem/pluginmanager.h index 883c2a14cc1..80b4c91157a 100644 --- a/src/libs/extensionsystem/pluginmanager.h +++ b/src/libs/extensionsystem/pluginmanager.h @@ -106,6 +106,7 @@ public: QHash pluginCollections() const; void setFileExtension(const QString &extension); QString fileExtension() const; + bool hasError() const; // Settings void setSettings(QSettings *settings);