1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

fixed infinite recursion under certain conditions

This commit is contained in:
krepa098 2014-10-15 17:35:58 +02:00
parent c4529d4062
commit 87132389aa
2 changed files with 9 additions and 2 deletions

View File

@ -52,6 +52,11 @@ Widget::Widget(QWidget *parent)
: QMainWindow(parent), : QMainWindow(parent),
ui(new Ui::MainWindow), ui(new Ui::MainWindow),
activeChatroomWidget{nullptr} activeChatroomWidget{nullptr}
{
}
void Widget::init()
{ {
ui->setupUi(this); ui->setupUi(this);
@ -214,7 +219,10 @@ Widget::~Widget()
Widget* Widget::getInstance() Widget* Widget::getInstance()
{ {
if (!instance) if (!instance)
{
instance = new Widget(); instance = new Widget();
instance->init();
}
return instance; return instance;
} }
@ -465,7 +473,6 @@ void Widget::setUsername(const QString& username)
{ {
ui->nameLabel->setText(username); ui->nameLabel->setText(username);
ui->nameLabel->setToolTip(username); // for overlength names ui->nameLabel->setToolTip(username); // for overlength names
settingsWidget->getIdentityForm()->setUserName(username);
} }
void Widget::onStatusMessageChanged(const QString& newStatusMessage, const QString& oldStatusMessage) void Widget::onStatusMessageChanged(const QString& newStatusMessage, const QString& oldStatusMessage)
@ -479,7 +486,6 @@ void Widget::setStatusMessage(const QString &statusMessage)
{ {
ui->statusLabel->setText(statusMessage); ui->statusLabel->setText(statusMessage);
ui->statusLabel->setToolTip(statusMessage); // for overlength messsages ui->statusLabel->setToolTip(statusMessage); // for overlength messsages
settingsWidget->getIdentityForm()->setStatusMessage(statusMessage);
} }
void Widget::addFriend(int friendId, const QString &userId) void Widget::addFriend(int friendId, const QString &userId)

View File

@ -54,6 +54,7 @@ public:
QThread* getCoreThread(); QThread* getCoreThread();
Camera* getCamera(); Camera* getCamera();
static Widget* getInstance(); static Widget* getInstance();
void init();
void newMessageAlert(); void newMessageAlert();
bool isFriendWidgetCurActiveWidget(Friend* f); bool isFriendWidgetCurActiveWidget(Friend* f);
bool getIsWindowMinimized(); bool getIsWindowMinimized();