mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Add tooltips to user-provided text (helps to accomodate too-long names and msgs)
Ideally this would be done only if the widget is too small for the message, but that can be quite difficult
This commit is contained in:
parent
047d1fdd50
commit
4bb2ec3356
|
@ -36,12 +36,14 @@ Friend::~Friend()
|
||||||
void Friend::setName(QString name)
|
void Friend::setName(QString name)
|
||||||
{
|
{
|
||||||
widget->name.setText(name);
|
widget->name.setText(name);
|
||||||
|
widget->name.setToolTip(name); // for overlength names
|
||||||
chatForm->setName(name);
|
chatForm->setName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Friend::setStatusMessage(QString message)
|
void Friend::setStatusMessage(QString message)
|
||||||
{
|
{
|
||||||
widget->statusMessage.setText(message);
|
widget->statusMessage.setText(message);
|
||||||
|
widget->statusMessage.setToolTip(message); // for overlength messsages
|
||||||
chatForm->setStatusMessage(message);
|
chatForm->setStatusMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
QT += core gui network multimedia multimediawidgets
|
QT += core gui network multimedia multimediawidgets
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||||
|
|
||||||
TARGET = toxgui
|
TARGET = qtox
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
FORMS += widget.ui
|
FORMS += widget.ui
|
||||||
CONFIG += c++11
|
CONFIG += c++11
|
|
@ -207,11 +207,13 @@ void ChatForm::show(Ui::Widget &ui)
|
||||||
void ChatForm::setName(QString newName)
|
void ChatForm::setName(QString newName)
|
||||||
{
|
{
|
||||||
name->setText(newName);
|
name->setText(newName);
|
||||||
|
name->setToolTip(newName); // for overlength names
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatForm::setStatusMessage(QString newMessage)
|
void ChatForm::setStatusMessage(QString newMessage)
|
||||||
{
|
{
|
||||||
statusMessage->setText(newMessage);
|
statusMessage->setText(newMessage);
|
||||||
|
statusMessage->setToolTip(newMessage); // for overlength messsages
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatForm::onSendTriggered()
|
void ChatForm::onSendTriggered()
|
||||||
|
|
|
@ -422,6 +422,7 @@ void Widget::onUsernameChanged()
|
||||||
{
|
{
|
||||||
const QString newUsername = settingsForm.name.text();
|
const QString newUsername = settingsForm.name.text();
|
||||||
ui->nameLabel->setText(newUsername);
|
ui->nameLabel->setText(newUsername);
|
||||||
|
ui->nameLabel->setToolTip(newUsername); // for overlength names
|
||||||
settingsForm.name.setText(newUsername);
|
settingsForm.name.setText(newUsername);
|
||||||
core->setUsername(newUsername);
|
core->setUsername(newUsername);
|
||||||
}
|
}
|
||||||
|
@ -429,6 +430,7 @@ void Widget::onUsernameChanged()
|
||||||
void Widget::onUsernameChanged(const QString& newUsername, const QString& oldUsername)
|
void Widget::onUsernameChanged(const QString& newUsername, const QString& oldUsername)
|
||||||
{
|
{
|
||||||
ui->nameLabel->setText(oldUsername); // restore old username until Core tells us to set it
|
ui->nameLabel->setText(oldUsername); // restore old username until Core tells us to set it
|
||||||
|
ui->nameLabel->setToolTip(oldUsername); // for overlength names
|
||||||
settingsForm.name.setText(oldUsername);
|
settingsForm.name.setText(oldUsername);
|
||||||
core->setUsername(newUsername);
|
core->setUsername(newUsername);
|
||||||
}
|
}
|
||||||
|
@ -436,6 +438,7 @@ void Widget::onUsernameChanged(const QString& newUsername, const QString& oldUse
|
||||||
void Widget::setUsername(const QString& username)
|
void Widget::setUsername(const QString& username)
|
||||||
{
|
{
|
||||||
ui->nameLabel->setText(username);
|
ui->nameLabel->setText(username);
|
||||||
|
ui->nameLabel->setToolTip(username); // for overlength names
|
||||||
settingsForm.name.setText(username);
|
settingsForm.name.setText(username);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -443,6 +446,7 @@ void Widget::onStatusMessageChanged()
|
||||||
{
|
{
|
||||||
const QString newStatusMessage = settingsForm.statusText.text();
|
const QString newStatusMessage = settingsForm.statusText.text();
|
||||||
ui->statusLabel->setText(newStatusMessage);
|
ui->statusLabel->setText(newStatusMessage);
|
||||||
|
ui->statusLabel->setToolTip(newStatusMessage); // for overlength messsages
|
||||||
settingsForm.statusText.setText(newStatusMessage);
|
settingsForm.statusText.setText(newStatusMessage);
|
||||||
core->setStatusMessage(newStatusMessage);
|
core->setStatusMessage(newStatusMessage);
|
||||||
}
|
}
|
||||||
|
@ -450,6 +454,7 @@ void Widget::onStatusMessageChanged()
|
||||||
void Widget::onStatusMessageChanged(const QString& newStatusMessage, const QString& oldStatusMessage)
|
void Widget::onStatusMessageChanged(const QString& newStatusMessage, const QString& oldStatusMessage)
|
||||||
{
|
{
|
||||||
ui->statusLabel->setText(oldStatusMessage); // restore old status message until Core tells us to set it
|
ui->statusLabel->setText(oldStatusMessage); // restore old status message until Core tells us to set it
|
||||||
|
ui->statusLabel->setToolTip(oldStatusMessage); // for overlength messsages
|
||||||
settingsForm.statusText.setText(oldStatusMessage);
|
settingsForm.statusText.setText(oldStatusMessage);
|
||||||
core->setStatusMessage(newStatusMessage);
|
core->setStatusMessage(newStatusMessage);
|
||||||
}
|
}
|
||||||
|
@ -457,6 +462,7 @@ void Widget::onStatusMessageChanged(const QString& newStatusMessage, const QStri
|
||||||
void Widget::setStatusMessage(const QString &statusMessage)
|
void Widget::setStatusMessage(const QString &statusMessage)
|
||||||
{
|
{
|
||||||
ui->statusLabel->setText(statusMessage);
|
ui->statusLabel->setText(statusMessage);
|
||||||
|
ui->statusLabel->setToolTip(statusMessage); // for overlength messsages
|
||||||
settingsForm.statusText.setText(statusMessage);
|
settingsForm.statusText.setText(statusMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user