mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge branch 'pr471'
This commit is contained in:
commit
3e5908348a
|
@ -74,10 +74,10 @@ void Widget::init()
|
|||
layout()->setContentsMargins(0, 0, 0, 0);
|
||||
ui->friendList->setStyleSheet(Style::getStylesheet(":ui/friendList/friendList.css"));
|
||||
|
||||
profilePicture = new MaskablePixmapWidget(this, QSize(40,40), ":/img/avatar_mask.png");
|
||||
profilePicture = new MaskablePixmapWidget(this, QSize(40, 40), ":/img/avatar_mask.png");
|
||||
profilePicture->setPixmap(QPixmap(":/img/contact_dark.png"));
|
||||
profilePicture->setClickable(true);
|
||||
ui->horizontalLayout_3->insertWidget(0,profilePicture);
|
||||
ui->horizontalLayout_3->insertWidget(0, profilePicture);
|
||||
ui->horizontalLayout_3->insertSpacing(1, 7);
|
||||
|
||||
ui->mainContent->setLayout(new QVBoxLayout());
|
||||
|
@ -145,6 +145,11 @@ void Widget::init()
|
|||
core->moveToThread(coreThread);
|
||||
connect(coreThread, &QThread::started, core, &Core::start);
|
||||
|
||||
filesForm = new FilesForm();
|
||||
addFriendForm = new AddFriendForm;
|
||||
settingsWidget = new SettingsWidget();
|
||||
|
||||
|
||||
connect(core, &Core::connected, this, &Widget::onConnected);
|
||||
connect(core, &Core::disconnected, this, &Widget::onDisconnected);
|
||||
connect(core, &Core::failedToStart, this, &Widget::onFailedToStartCore);
|
||||
|
@ -153,8 +158,8 @@ void Widget::init()
|
|||
connect(core, &Core::usernameSet, this, &Widget::setUsername);
|
||||
connect(core, &Core::statusMessageSet, this, &Widget::setStatusMessage);
|
||||
connect(core, &Core::selfAvatarChanged, this, &Widget::onSelfAvatarLoaded);
|
||||
connect(core, SIGNAL(fileDownloadFinished(const QString&)), &filesForm, SLOT(onFileDownloadComplete(const QString&)));
|
||||
connect(core, SIGNAL(fileUploadFinished(const QString&)), &filesForm, SLOT(onFileUploadComplete(const QString&)));
|
||||
connect(core, SIGNAL(fileDownloadFinished(const QString&)), filesForm, SLOT(onFileDownloadComplete(const QString&)));
|
||||
connect(core, SIGNAL(fileUploadFinished(const QString&)), filesForm, SLOT(onFileUploadComplete(const QString&)));
|
||||
connect(core, &Core::friendAdded, this, &Widget::addFriend);
|
||||
connect(core, &Core::failedToAddFriend, this, &Widget::addFriendFailed);
|
||||
connect(core, &Core::friendUsernameChanged, this, &Widget::onFriendUsernameChanged);
|
||||
|
@ -181,19 +186,33 @@ void Widget::init()
|
|||
connect(ui->groupButton, SIGNAL(clicked()), this, SLOT(onGroupClicked()));
|
||||
connect(ui->transferButton, SIGNAL(clicked()), this, SLOT(onTransferClicked()));
|
||||
connect(ui->settingsButton, SIGNAL(clicked()), this, SLOT(onSettingsClicked()));
|
||||
connect(ui->nameLabel, SIGNAL(textChanged(QString,QString)), this, SLOT(onUsernameChanged(QString,QString)));
|
||||
connect(ui->statusLabel, SIGNAL(textChanged(QString,QString)), this, SLOT(onStatusMessageChanged(QString,QString)));
|
||||
connect(ui->nameLabel, SIGNAL(textChanged(QString, QString)), this, SLOT(onUsernameChanged(QString, QString)));
|
||||
connect(ui->statusLabel, SIGNAL(textChanged(QString, QString)), this, SLOT(onStatusMessageChanged(QString, QString)));
|
||||
connect(profilePicture, SIGNAL(clicked()), this, SLOT(onAvatarClicked()));
|
||||
connect(setStatusOnline, SIGNAL(triggered()), this, SLOT(setStatusOnline()));
|
||||
connect(setStatusAway, SIGNAL(triggered()), this, SLOT(setStatusAway()));
|
||||
connect(setStatusBusy, SIGNAL(triggered()), this, SLOT(setStatusBusy()));
|
||||
connect(&friendForm, SIGNAL(friendRequested(QString,QString)), this, SIGNAL(friendRequested(QString,QString)));
|
||||
connect(addFriendForm, SIGNAL(friendRequested(QString, QString)), this, SIGNAL(friendRequested(QString, QString)));
|
||||
connect(idleTimer, &QTimer::timeout, this, &Widget::onUserAway);
|
||||
|
||||
coreThread->start();
|
||||
|
||||
settingsWidget = new SettingsWidget();
|
||||
friendForm.show(*ui);
|
||||
addFriendForm->show(*ui);
|
||||
}
|
||||
|
||||
void Widget::setTranslation()
|
||||
{
|
||||
// Load translations
|
||||
QCoreApplication::removeTranslator(translator);
|
||||
QString locale;
|
||||
if ((locale = Settings::getInstance().getTranslation()).isEmpty())
|
||||
locale = QLocale::system().name().section('_', 0, 0);
|
||||
|
||||
if (translator->load(locale, ":translations/"))
|
||||
qDebug() << "Loaded translation" << locale;
|
||||
else
|
||||
qDebug() << "Error loading translation" << locale;
|
||||
QCoreApplication::installTranslator(translator);
|
||||
}
|
||||
|
||||
Widget::~Widget()
|
||||
|
@ -205,6 +224,8 @@ Widget::~Widget()
|
|||
coreThread->terminate();
|
||||
delete core;
|
||||
delete settingsWidget;
|
||||
delete addFriendForm;
|
||||
delete filesForm;
|
||||
|
||||
for (Friend* f : FriendList::friendList)
|
||||
delete f;
|
||||
|
@ -418,7 +439,7 @@ void Widget::onStatusSet(Status status)
|
|||
void Widget::onAddClicked()
|
||||
{
|
||||
hideMainForms();
|
||||
friendForm.show(*ui);
|
||||
addFriendForm->show(*ui);
|
||||
}
|
||||
|
||||
void Widget::onGroupClicked()
|
||||
|
@ -429,7 +450,7 @@ void Widget::onGroupClicked()
|
|||
void Widget::onTransferClicked()
|
||||
{
|
||||
hideMainForms();
|
||||
filesForm.show(*ui);
|
||||
filesForm->show(*ui);
|
||||
activeChatroomWidget = nullptr;
|
||||
}
|
||||
|
||||
|
@ -907,17 +928,3 @@ void Widget::onGroupSendResult(int groupId, const QString& message, int result)
|
|||
if (result == -1)
|
||||
g->chatForm->addSystemInfoMessage("Message failed to send", "red");
|
||||
}
|
||||
|
||||
void Widget::setTranslation()
|
||||
{
|
||||
// Load translations
|
||||
QCoreApplication::removeTranslator(translator);
|
||||
QString locale;
|
||||
if ((locale = Settings::getInstance().getTranslation()) == "")
|
||||
locale = QLocale::system().name().section('_', 0, 0);
|
||||
if (translator->load(locale,":translations/"))
|
||||
qDebug() << "Loaded translation" << locale;
|
||||
else
|
||||
qDebug() << "Error loading translation" << locale;
|
||||
QCoreApplication::installTranslator(translator);
|
||||
}
|
||||
|
|
|
@ -130,9 +130,9 @@ private:
|
|||
QPoint dragPosition;
|
||||
Core* core;
|
||||
QThread* coreThread;
|
||||
AddFriendForm friendForm;
|
||||
AddFriendForm* addFriendForm;
|
||||
SettingsWidget* settingsWidget;
|
||||
FilesForm filesForm;
|
||||
FilesForm* filesForm;
|
||||
static Widget* instance;
|
||||
GenericChatroomWidget* activeChatroomWidget;
|
||||
FriendListWidget* contactListWidget;
|
||||
|
|
Loading…
Reference in New Issue
Block a user