forked from qt-creator/qt-creator
Core: Modernize PluginDialog style
Change-Id: I407fe2ec6753255cc5fad6014187cd592fe4aee1 Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
@@ -44,9 +44,10 @@
|
|||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
using namespace Core::Internal;
|
namespace Core {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
bool PluginDialog::m_isRestartRequired = false;
|
static bool s_isRestartRequired = false;
|
||||||
|
|
||||||
PluginDialog::PluginDialog(QWidget *parent)
|
PluginDialog::PluginDialog(QWidget *parent)
|
||||||
: QDialog(parent),
|
: QDialog(parent),
|
||||||
@@ -64,7 +65,7 @@ PluginDialog::PluginDialog(QWidget *parent)
|
|||||||
m_closeButton->setDefault(true);
|
m_closeButton->setDefault(true);
|
||||||
|
|
||||||
m_restartRequired = new QLabel(tr("Restart required."), this);
|
m_restartRequired = new QLabel(tr("Restart required."), this);
|
||||||
if (!m_isRestartRequired)
|
if (!s_isRestartRequired)
|
||||||
m_restartRequired->setVisible(false);
|
m_restartRequired->setVisible(false);
|
||||||
|
|
||||||
QHBoxLayout *hl = new QHBoxLayout;
|
QHBoxLayout *hl = new QHBoxLayout;
|
||||||
@@ -77,19 +78,21 @@ PluginDialog::PluginDialog(QWidget *parent)
|
|||||||
|
|
||||||
vl->addLayout(hl);
|
vl->addLayout(hl);
|
||||||
|
|
||||||
|
|
||||||
resize(650, 400);
|
resize(650, 400);
|
||||||
setWindowTitle(tr("Installed Plugins"));
|
setWindowTitle(tr("Installed Plugins"));
|
||||||
|
|
||||||
connect(m_view, SIGNAL(currentPluginChanged(ExtensionSystem::PluginSpec*)),
|
connect(m_view, &ExtensionSystem::PluginView::currentPluginChanged,
|
||||||
this, SLOT(updateButtons()));
|
this, &PluginDialog::updateButtons);
|
||||||
connect(m_view, SIGNAL(pluginActivated(ExtensionSystem::PluginSpec*)),
|
connect(m_view, &ExtensionSystem::PluginView::pluginActivated,
|
||||||
this, SLOT(openDetails(ExtensionSystem::PluginSpec*)));
|
this, &PluginDialog::openDetails);
|
||||||
connect(m_view, SIGNAL(pluginSettingsChanged(ExtensionSystem::PluginSpec*)),
|
connect(m_view, &ExtensionSystem::PluginView::pluginSettingsChanged,
|
||||||
this, SLOT(updateRestartRequired()));
|
this, &PluginDialog::updateRestartRequired);
|
||||||
connect(m_detailsButton, SIGNAL(clicked()), this, SLOT(openDetails()));
|
connect(m_detailsButton, &QAbstractButton::clicked,
|
||||||
connect(m_errorDetailsButton, SIGNAL(clicked()), this, SLOT(openErrorDetails()));
|
[this] { openDetails(m_view->currentPlugin()); });
|
||||||
connect(m_closeButton, SIGNAL(clicked()), this, SLOT(closeDialog()));
|
connect(m_errorDetailsButton, &QAbstractButton::clicked,
|
||||||
|
this, &PluginDialog::openErrorDetails);
|
||||||
|
connect(m_closeButton, &QAbstractButton::clicked,
|
||||||
|
this, &PluginDialog::closeDialog);
|
||||||
updateButtons();
|
updateButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,7 +105,7 @@ void PluginDialog::closeDialog()
|
|||||||
void PluginDialog::updateRestartRequired()
|
void PluginDialog::updateRestartRequired()
|
||||||
{
|
{
|
||||||
// just display the notice all the time after once changing something
|
// just display the notice all the time after once changing something
|
||||||
m_isRestartRequired = true;
|
s_isRestartRequired = true;
|
||||||
m_restartRequired->setVisible(true);
|
m_restartRequired->setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,12 +121,6 @@ void PluginDialog::updateButtons()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PluginDialog::openDetails()
|
|
||||||
{
|
|
||||||
openDetails(m_view->currentPlugin());
|
|
||||||
}
|
|
||||||
|
|
||||||
void PluginDialog::openDetails(ExtensionSystem::PluginSpec *spec)
|
void PluginDialog::openDetails(ExtensionSystem::PluginSpec *spec)
|
||||||
{
|
{
|
||||||
if (!spec)
|
if (!spec)
|
||||||
@@ -137,8 +134,8 @@ void PluginDialog::openDetails(ExtensionSystem::PluginSpec *spec)
|
|||||||
details->update(spec);
|
details->update(spec);
|
||||||
QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Close, Qt::Horizontal, &dialog);
|
QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Close, Qt::Horizontal, &dialog);
|
||||||
layout->addWidget(buttons);
|
layout->addWidget(buttons);
|
||||||
connect(buttons, SIGNAL(accepted()), &dialog, SLOT(accept()));
|
connect(buttons, &QDialogButtonBox::accepted, &dialog, &QDialog::accept);
|
||||||
connect(buttons, SIGNAL(rejected()), &dialog, SLOT(reject()));
|
connect(buttons, &QDialogButtonBox::rejected, &dialog, &QDialog::reject);
|
||||||
dialog.resize(400, 500);
|
dialog.resize(400, 500);
|
||||||
dialog.exec();
|
dialog.exec();
|
||||||
}
|
}
|
||||||
@@ -157,9 +154,11 @@ void PluginDialog::openErrorDetails()
|
|||||||
errors->update(spec);
|
errors->update(spec);
|
||||||
QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Close, Qt::Horizontal, &dialog);
|
QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Close, Qt::Horizontal, &dialog);
|
||||||
layout->addWidget(buttons);
|
layout->addWidget(buttons);
|
||||||
connect(buttons, SIGNAL(accepted()), &dialog, SLOT(accept()));
|
connect(buttons, &QDialogButtonBox::accepted, &dialog, &QDialog::accept);
|
||||||
connect(buttons, SIGNAL(rejected()), &dialog, SLOT(reject()));
|
connect(buttons, &QDialogButtonBox::rejected, &dialog, &QDialog::reject);
|
||||||
dialog.resize(500, 300);
|
dialog.resize(500, 300);
|
||||||
dialog.exec();
|
dialog.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace Core
|
||||||
|
@@ -53,22 +53,19 @@ class PluginDialog : public QDialog
|
|||||||
public:
|
public:
|
||||||
explicit PluginDialog(QWidget *parent);
|
explicit PluginDialog(QWidget *parent);
|
||||||
|
|
||||||
private slots:
|
private:
|
||||||
void updateRestartRequired();
|
void updateRestartRequired();
|
||||||
void updateButtons();
|
void updateButtons();
|
||||||
void openDetails();
|
|
||||||
void openDetails(ExtensionSystem::PluginSpec *spec);
|
void openDetails(ExtensionSystem::PluginSpec *spec);
|
||||||
void openErrorDetails();
|
void openErrorDetails();
|
||||||
void closeDialog();
|
void closeDialog();
|
||||||
|
|
||||||
private:
|
|
||||||
ExtensionSystem::PluginView *m_view;
|
ExtensionSystem::PluginView *m_view;
|
||||||
|
|
||||||
QPushButton *m_detailsButton;
|
QPushButton *m_detailsButton;
|
||||||
QPushButton *m_errorDetailsButton;
|
QPushButton *m_errorDetailsButton;
|
||||||
QPushButton *m_closeButton;
|
QPushButton *m_closeButton;
|
||||||
QLabel *m_restartRequired;
|
QLabel *m_restartRequired;
|
||||||
static bool m_isRestartRequired;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
Reference in New Issue
Block a user