mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge branch 'pr439'
This commit is contained in:
commit
f81a4ad6b4
@ -1184,7 +1184,7 @@ void Core::saveConfiguration(const QString& path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::switchConfiguration(QString profile)
|
void Core::switchConfiguration(const QString& profile)
|
||||||
{
|
{
|
||||||
if (profile.isEmpty())
|
if (profile.isEmpty())
|
||||||
{
|
{
|
||||||
@ -1204,7 +1204,7 @@ void Core::switchConfiguration(QString profile)
|
|||||||
tox = nullptr;
|
tox = nullptr;
|
||||||
}
|
}
|
||||||
emit selfAvatarChanged(QPixmap(":/img/contact_dark.png"));
|
emit selfAvatarChanged(QPixmap(":/img/contact_dark.png"));
|
||||||
Widget::getInstance()->clearContactsList(); // we need this to block, so no signals for us
|
emit blockingClearContacts(); // we need this to block, but signals are required for thread safety
|
||||||
|
|
||||||
loadPath = QDir(Settings::getSettingsDirPath()).filePath(profile + TOX_EXT);
|
loadPath = QDir(Settings::getSettingsDirPath()).filePath(profile + TOX_EXT);
|
||||||
Settings::getInstance().setCurrentProfile(profile);
|
Settings::getInstance().setCurrentProfile(profile);
|
||||||
|
@ -53,7 +53,6 @@ public:
|
|||||||
|
|
||||||
void saveConfiguration();
|
void saveConfiguration();
|
||||||
void saveConfiguration(const QString& path);
|
void saveConfiguration(const QString& path);
|
||||||
void switchConfiguration(QString profile);
|
|
||||||
|
|
||||||
QString getIDString();
|
QString getIDString();
|
||||||
|
|
||||||
@ -64,10 +63,13 @@ public:
|
|||||||
void increaseVideoBusyness();
|
void increaseVideoBusyness();
|
||||||
void decreaseVideoBusyness();
|
void decreaseVideoBusyness();
|
||||||
|
|
||||||
|
bool anyActiveCalls();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void start();
|
void start();
|
||||||
void process();
|
void process();
|
||||||
void bootstrapDht();
|
void bootstrapDht();
|
||||||
|
void switchConfiguration(const QString& profile);
|
||||||
|
|
||||||
void acceptFriendRequest(const QString& userId);
|
void acceptFriendRequest(const QString& userId);
|
||||||
void requestFriendship(const QString& friendAddress, const QString& message);
|
void requestFriendship(const QString& friendAddress, const QString& message);
|
||||||
@ -105,6 +107,7 @@ public slots:
|
|||||||
signals:
|
signals:
|
||||||
void connected();
|
void connected();
|
||||||
void disconnected();
|
void disconnected();
|
||||||
|
void blockingClearContacts();
|
||||||
|
|
||||||
void friendRequestReceived(const QString& userId, const QString& message);
|
void friendRequestReceived(const QString& userId, const QString& message);
|
||||||
void friendMessageReceived(int friendId, const QString& message, bool isAction);
|
void friendMessageReceived(int friendId, const QString& message, bool isAction);
|
||||||
|
@ -28,6 +28,14 @@ ALCdevice* Core::alOutDev, *Core::alInDev;
|
|||||||
ALCcontext* Core::alContext;
|
ALCcontext* Core::alContext;
|
||||||
ALuint Core::alMainSource;
|
ALuint Core::alMainSource;
|
||||||
|
|
||||||
|
bool Core::anyActiveCalls()
|
||||||
|
{
|
||||||
|
for (auto& call : calls)
|
||||||
|
if (call.active)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void Core::prepareCall(int friendId, int callId, ToxAv* toxav, bool videoEnabled)
|
void Core::prepareCall(int friendId, int callId, ToxAv* toxav, bool videoEnabled)
|
||||||
{
|
{
|
||||||
qDebug() << QString("Core: preparing call %1").arg(callId);
|
qDebug() << QString("Core: preparing call %1").arg(callId);
|
||||||
|
@ -108,7 +108,15 @@ void IdentityForm::setStatusMessage(const QString &msg)
|
|||||||
|
|
||||||
void IdentityForm::onLoadClicked()
|
void IdentityForm::onLoadClicked()
|
||||||
{
|
{
|
||||||
Core::getInstance()->switchConfiguration(bodyUI->profiles->currentText());
|
if (bodyUI->profiles->currentText() != Settings::getInstance().getCurrentProfile())
|
||||||
|
{
|
||||||
|
if (Core::getInstance()->anyActiveCalls())
|
||||||
|
QMessageBox::warning(this, tr("Call active", "popup title"),
|
||||||
|
tr("You can't switch profiles while a call is active!", "popup text"));
|
||||||
|
else
|
||||||
|
emit Widget::getInstance()->changeProfile(bodyUI->profiles->currentText());
|
||||||
|
// I think by directly calling the function, I may have been causing thread issues
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IdentityForm::onRenameClicked()
|
void IdentityForm::onRenameClicked()
|
||||||
|
@ -146,6 +146,7 @@ Widget::Widget(QWidget *parent)
|
|||||||
connect(core, &Core::groupNamelistChanged, this, &Widget::onGroupNamelistChanged);
|
connect(core, &Core::groupNamelistChanged, this, &Widget::onGroupNamelistChanged);
|
||||||
connect(core, &Core::emptyGroupCreated, this, &Widget::onEmptyGroupCreated);
|
connect(core, &Core::emptyGroupCreated, this, &Widget::onEmptyGroupCreated);
|
||||||
connect(core, &Core::avInvite, this, &Widget::playRingtone);
|
connect(core, &Core::avInvite, this, &Widget::playRingtone);
|
||||||
|
connect(core, &Core::blockingClearContacts, this, &Widget::clearContactsList, Qt::BlockingQueuedConnection);
|
||||||
|
|
||||||
connect(core, SIGNAL(messageSentResult(int,QString,int)), this, SLOT(onMessageSendResult(int,QString,int)));
|
connect(core, SIGNAL(messageSentResult(int,QString,int)), this, SLOT(onMessageSendResult(int,QString,int)));
|
||||||
connect(core, SIGNAL(groupSentResult(int,QString,int)), this, SLOT(onGroupSendResult(int,QString,int)));
|
connect(core, SIGNAL(groupSentResult(int,QString,int)), this, SLOT(onGroupSendResult(int,QString,int)));
|
||||||
@ -153,6 +154,7 @@ Widget::Widget(QWidget *parent)
|
|||||||
connect(this, &Widget::statusSet, core, &Core::setStatus);
|
connect(this, &Widget::statusSet, core, &Core::setStatus);
|
||||||
connect(this, &Widget::friendRequested, core, &Core::requestFriendship);
|
connect(this, &Widget::friendRequested, core, &Core::requestFriendship);
|
||||||
connect(this, &Widget::friendRequestAccepted, core, &Core::acceptFriendRequest);
|
connect(this, &Widget::friendRequestAccepted, core, &Core::acceptFriendRequest);
|
||||||
|
connect(this, &Widget::changeProfile, core, &Core::switchConfiguration);
|
||||||
|
|
||||||
connect(ui->addButton, SIGNAL(clicked()), this, SLOT(onAddClicked()));
|
connect(ui->addButton, SIGNAL(clicked()), this, SLOT(onAddClicked()));
|
||||||
connect(ui->groupButton, SIGNAL(clicked()), this, SLOT(onGroupClicked()));
|
connect(ui->groupButton, SIGNAL(clicked()), this, SLOT(onGroupClicked()));
|
||||||
|
@ -69,6 +69,7 @@ signals:
|
|||||||
void statusSelected(Status status);
|
void statusSelected(Status status);
|
||||||
void usernameChanged(const QString& username);
|
void usernameChanged(const QString& username);
|
||||||
void statusMessageChanged(const QString& statusMessage);
|
void statusMessageChanged(const QString& statusMessage);
|
||||||
|
void changeProfile(const QString& profile);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onConnected();
|
void onConnected();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user