forked from blue/squawk
an idea how to manage info object better
This commit is contained in:
parent
ec362cef55
commit
6f32e99593
12 changed files with 390 additions and 63 deletions
|
@ -30,7 +30,6 @@ UI::ContactGeneral::ContactGeneral(QWidget* parent):
|
|||
currentAvatarType(Shared::Avatar::empty),
|
||||
currentAvatarPath(""),
|
||||
currentJid(""),
|
||||
editable(false),
|
||||
avatarDiablog(nullptr)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
@ -74,6 +73,9 @@ void UI::ContactGeneral::setEditable(bool edit) {
|
|||
m_ui->avatarButton->setMenu(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
m_ui->actionSetAvatar->setEnabled(edit);
|
||||
m_ui->actionClearAvatar->setEnabled(false); //need to unlock it explicitly after the type of avatar is clear!
|
||||
}
|
||||
|
||||
void UI::ContactGeneral::deleteAvatarDialog() {
|
||||
|
@ -92,7 +94,7 @@ void UI::ContactGeneral::initializeActions() {
|
|||
connect(setAvatar, &QAction::triggered, this, &UI::ContactGeneral::onSetAvatar);
|
||||
connect(clearAvatar, &QAction::triggered, this, &UI::ContactGeneral::onClearAvatar);
|
||||
|
||||
setAvatar->setEnabled(editable);
|
||||
setAvatar->setEnabled(false);
|
||||
clearAvatar->setEnabled(false);
|
||||
}
|
||||
|
||||
|
@ -138,7 +140,7 @@ void UI::ContactGeneral::updateAvatar() {
|
|||
qreal aspectRatio = w / h;
|
||||
m_ui->avatarButton->setIconSize(QSize(height * aspectRatio, height));
|
||||
m_ui->avatarButton->setIcon(QIcon(currentAvatarPath));
|
||||
m_ui->actionClearAvatar->setEnabled(editable);
|
||||
m_ui->actionClearAvatar->setEnabled(m_ui->actionSetAvatar->isEnabled()); //I assume that if set avatar is enabled then we can also clear
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue