forked from qt-creator/qt-creator
Core: consistent InfoBar member prefix
Change-Id: Ie0cfda51b3936d7745c7876181e6d4b5242860ff Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -48,15 +48,15 @@ QSettings *InfoBar::m_settings = nullptr;
|
|||||||
Utils::Theme *InfoBar::m_theme = nullptr;
|
Utils::Theme *InfoBar::m_theme = nullptr;
|
||||||
|
|
||||||
InfoBarEntry::InfoBarEntry(Id _id, const QString &_infoText, GlobalSuppressionMode _globalSuppression)
|
InfoBarEntry::InfoBarEntry(Id _id, const QString &_infoText, GlobalSuppressionMode _globalSuppression)
|
||||||
: id(_id)
|
: m_id(_id)
|
||||||
, infoText(_infoText)
|
, m_infoText(_infoText)
|
||||||
, globalSuppression(_globalSuppression)
|
, m_globalSuppression(_globalSuppression)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void InfoBarEntry::setCustomButtonInfo(const QString &_buttonText, CallBack callBack)
|
void InfoBarEntry::setCustomButtonInfo(const QString &_buttonText, CallBack callBack)
|
||||||
{
|
{
|
||||||
buttonText = _buttonText;
|
m_buttonText = _buttonText;
|
||||||
m_buttonCallBack = callBack;
|
m_buttonCallBack = callBack;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,14 +69,14 @@ void InfoBarEntry::setCancelButtonInfo(CallBack callBack)
|
|||||||
void InfoBarEntry::setCancelButtonInfo(const QString &_cancelButtonText, CallBack callBack)
|
void InfoBarEntry::setCancelButtonInfo(const QString &_cancelButtonText, CallBack callBack)
|
||||||
{
|
{
|
||||||
m_useCancelButton = true;
|
m_useCancelButton = true;
|
||||||
cancelButtonText = _cancelButtonText;
|
m_cancelButtonText = _cancelButtonText;
|
||||||
m_cancelButtonCallBack = callBack;
|
m_cancelButtonCallBack = callBack;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InfoBarEntry::removeCancelButton()
|
void InfoBarEntry::removeCancelButton()
|
||||||
{
|
{
|
||||||
m_useCancelButton = false;
|
m_useCancelButton = false;
|
||||||
cancelButtonText.clear();
|
m_cancelButtonText.clear();
|
||||||
m_cancelButtonCallBack = nullptr;
|
m_cancelButtonCallBack = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,14 +94,14 @@ void InfoBar::addInfo(const InfoBarEntry &info)
|
|||||||
void InfoBar::removeInfo(Id id)
|
void InfoBar::removeInfo(Id id)
|
||||||
{
|
{
|
||||||
const int size = m_infoBarEntries.size();
|
const int size = m_infoBarEntries.size();
|
||||||
Utils::erase(m_infoBarEntries, Utils::equal(&InfoBarEntry::id, id));
|
Utils::erase(m_infoBarEntries, Utils::equal(&InfoBarEntry::m_id, id));
|
||||||
if (size != m_infoBarEntries.size())
|
if (size != m_infoBarEntries.size())
|
||||||
emit changed();
|
emit changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InfoBar::containsInfo(Id id) const
|
bool InfoBar::containsInfo(Id id) const
|
||||||
{
|
{
|
||||||
return Utils::anyOf(m_infoBarEntries, Utils::equal(&InfoBarEntry::id, id));
|
return Utils::anyOf(m_infoBarEntries, Utils::equal(&InfoBarEntry::m_id, id));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove and suppress id
|
// Remove and suppress id
|
||||||
@@ -240,7 +240,7 @@ void InfoBarDisplay::update()
|
|||||||
vbox->setMargin(0);
|
vbox->setMargin(0);
|
||||||
vbox->addLayout(hbox);
|
vbox->addLayout(hbox);
|
||||||
|
|
||||||
QLabel *infoWidgetLabel = new QLabel(info.infoText);
|
QLabel *infoWidgetLabel = new QLabel(info.m_infoText);
|
||||||
infoWidgetLabel->setWordWrap(true);
|
infoWidgetLabel->setWordWrap(true);
|
||||||
hbox->addWidget(infoWidgetLabel);
|
hbox->addWidget(infoWidgetLabel);
|
||||||
|
|
||||||
@@ -270,17 +270,17 @@ void InfoBarDisplay::update()
|
|||||||
m_isShowingDetailsWidget = false;
|
m_isShowingDetailsWidget = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!info.buttonText.isEmpty()) {
|
if (!info.m_buttonText.isEmpty()) {
|
||||||
auto infoWidgetButton = new QToolButton;
|
auto infoWidgetButton = new QToolButton;
|
||||||
infoWidgetButton->setText(info.buttonText);
|
infoWidgetButton->setText(info.m_buttonText);
|
||||||
connect(infoWidgetButton, &QAbstractButton::clicked, [info]() { info.m_buttonCallBack(); });
|
connect(infoWidgetButton, &QAbstractButton::clicked, [info]() { info.m_buttonCallBack(); });
|
||||||
|
|
||||||
hbox->addWidget(infoWidgetButton);
|
hbox->addWidget(infoWidgetButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Id id = info.id;
|
const Id id = info.m_id;
|
||||||
QToolButton *infoWidgetSuppressButton = nullptr;
|
QToolButton *infoWidgetSuppressButton = nullptr;
|
||||||
if (info.globalSuppression == InfoBarEntry::GlobalSuppressionEnabled) {
|
if (info.m_globalSuppression == InfoBarEntry::GlobalSuppressionEnabled) {
|
||||||
infoWidgetSuppressButton = new QToolButton;
|
infoWidgetSuppressButton = new QToolButton;
|
||||||
infoWidgetSuppressButton->setText(tr("Do Not Show Again"));
|
infoWidgetSuppressButton->setText(tr("Do Not Show Again"));
|
||||||
connect(infoWidgetSuppressButton, &QAbstractButton::clicked, this, [this, id] {
|
connect(infoWidgetSuppressButton, &QAbstractButton::clicked, this, [this, id] {
|
||||||
@@ -301,7 +301,7 @@ void InfoBarDisplay::update()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info.cancelButtonText.isEmpty()) {
|
if (info.m_cancelButtonText.isEmpty()) {
|
||||||
if (infoWidgetCloseButton) {
|
if (infoWidgetCloseButton) {
|
||||||
infoWidgetCloseButton->setAutoRaise(true);
|
infoWidgetCloseButton->setAutoRaise(true);
|
||||||
infoWidgetCloseButton->setIcon(Utils::Icons::CLOSE_FOREGROUND.icon());
|
infoWidgetCloseButton->setIcon(Utils::Icons::CLOSE_FOREGROUND.icon());
|
||||||
@@ -314,7 +314,7 @@ void InfoBarDisplay::update()
|
|||||||
if (infoWidgetCloseButton)
|
if (infoWidgetCloseButton)
|
||||||
hbox->addWidget(infoWidgetCloseButton);
|
hbox->addWidget(infoWidgetCloseButton);
|
||||||
} else {
|
} else {
|
||||||
infoWidgetCloseButton->setText(info.cancelButtonText);
|
infoWidgetCloseButton->setText(info.m_cancelButtonText);
|
||||||
hbox->addWidget(infoWidgetCloseButton);
|
hbox->addWidget(infoWidgetCloseButton);
|
||||||
if (infoWidgetSuppressButton)
|
if (infoWidgetSuppressButton)
|
||||||
hbox->addWidget(infoWidgetSuppressButton);
|
hbox->addWidget(infoWidgetSuppressButton);
|
||||||
|
@@ -67,13 +67,13 @@ public:
|
|||||||
void setDetailsWidgetCreator(const DetailsWidgetCreator &creator);
|
void setDetailsWidgetCreator(const DetailsWidgetCreator &creator);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Id id;
|
Id m_id;
|
||||||
QString infoText;
|
QString m_infoText;
|
||||||
QString buttonText;
|
QString m_buttonText;
|
||||||
CallBack m_buttonCallBack;
|
CallBack m_buttonCallBack;
|
||||||
QString cancelButtonText;
|
QString m_cancelButtonText;
|
||||||
CallBack m_cancelButtonCallBack;
|
CallBack m_cancelButtonCallBack;
|
||||||
GlobalSuppressionMode globalSuppression;
|
GlobalSuppressionMode m_globalSuppression;
|
||||||
DetailsWidgetCreator m_detailsWidgetCreator;
|
DetailsWidgetCreator m_detailsWidgetCreator;
|
||||||
bool m_useCancelButton = true;
|
bool m_useCancelButton = true;
|
||||||
friend class InfoBar;
|
friend class InfoBar;
|
||||||
|
Reference in New Issue
Block a user