mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Made the 'remove friend dialog' userfriendly
This commit is contained in:
parent
c7b5337723
commit
3d72a75ed3
|
@ -7,9 +7,15 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>300</width>
|
||||
<height>180</height>
|
||||
<height>110</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>110</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Remove friend</string>
|
||||
</property>
|
||||
|
@ -27,19 +33,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="yes">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>YES</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="removeHistory">
|
||||
<property name="text">
|
||||
|
@ -53,7 +46,7 @@
|
|||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
<set>QDialogButtonBox::No|QDialogButtonBox::Yes</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -9,10 +9,7 @@ RemoveFriendDialog::RemoveFriendDialog(QWidget *parent, const Friend *f)
|
|||
setAttribute(Qt::WA_QuitOnClose, false);
|
||||
ui.setupUi(this);
|
||||
ui.label->setText(ui.label->text().replace("<name>", f->getDisplayedName()));
|
||||
auto removeButton = ui.buttonBox->button(QDialogButtonBox::Ok);
|
||||
removeButton->setEnabled(false);
|
||||
removeButton->setText(tr("Remove"));
|
||||
connect(ui.yes, &QLineEdit::textChanged, this, &RemoveFriendDialog::onTextChanged);
|
||||
adjustSize();
|
||||
connect(ui.buttonBox, &QDialogButtonBox::accepted, this, &RemoveFriendDialog::onAccepted);
|
||||
connect(ui.buttonBox, &QDialogButtonBox::rejected, this, &RemoveFriendDialog::close);
|
||||
setFocus();
|
||||
|
@ -23,9 +20,3 @@ void RemoveFriendDialog::onAccepted()
|
|||
_accepted = true;
|
||||
close();
|
||||
}
|
||||
|
||||
void RemoveFriendDialog::onTextChanged(QString text)
|
||||
{
|
||||
ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(text == ui.yes->placeholderText());
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ public:
|
|||
|
||||
public slots:
|
||||
void onAccepted();
|
||||
void onTextChanged(QString text);
|
||||
|
||||
protected:
|
||||
Ui_RemoveFriendDialog ui;
|
||||
|
|
Loading…
Reference in New Issue
Block a user