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

Merge branch 'pr529'

This commit is contained in:
Tux3 / Mlkj / !Lev.uXFMLA 2014-10-24 20:31:15 +02:00
commit 07bc995d6b
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
6 changed files with 56 additions and 2 deletions

View File

@ -20,6 +20,7 @@
#include "src/widget/widget.h"
#include "src/misc/settings.h"
#include "src/misc/smileypack.h"
#include "src/core.h"
#include <QMessageBox>
#include <QStyleFactory>
@ -85,6 +86,7 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
connect(bodyUI->cbUseProxy, &QCheckBox::stateChanged, this, &GeneralForm::onUseProxyUpdated);
connect(bodyUI->styleBrowser, SIGNAL(currentTextChanged(QString)), this, SLOT(onStyleSelected(QString)));
connect(bodyUI->autoAwaySpinBox, SIGNAL(editingFinished()), this, SLOT(onAutoAwayChanged()));
connect(bodyUI->reconnectButton, &QPushButton::clicked, this, &GeneralForm::onReconnectClicked);
}
GeneralForm::~GeneralForm()
@ -178,6 +180,15 @@ void GeneralForm::onUseProxyUpdated()
Settings::getInstance().setUseProxy(state);
}
void GeneralForm::onReconnectClicked()
{
if (Core::getInstance()->anyActiveCalls())
QMessageBox::warning(this, tr("Call active", "popup title"),
tr("You can't disconnect while a call is active!", "popup text"));
else
emit Widget::getInstance()->changeProfile(Settings::getInstance().getCurrentProfile());
}
void GeneralForm::reloadSmiles()
{
QList<QStringList> emoticons = SmileyPack::getInstance().getEmoticons();

View File

@ -45,7 +45,7 @@ private slots:
void onSetStatusChange();
void onAutoAwayChanged();
void onSetMinimizeToTray();
void onReconnectClicked();
private:
Ui::GeneralSettings *bodyUI;

View File

@ -341,6 +341,13 @@
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="reconnectButton">
<property name="text">
<string comment="reconnect button">Reconnect</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View File

@ -36,6 +36,7 @@ IdentityForm::IdentityForm() :
{
bodyUI = new Ui::IdentitySettings;
bodyUI->setupUi(this);
core = Core::getInstance();
// tox
toxId = new ClickableTE();
@ -47,7 +48,7 @@ IdentityForm::IdentityForm() :
connect(bodyUI->toxIdLabel, SIGNAL(clicked()), this, SLOT(copyIdClicked()));
connect(toxId, SIGNAL(clicked()), this, SLOT(copyIdClicked()));
connect(Core::getInstance(), &Core::idSet, this, &IdentityForm::setToxId);
connect(core, &Core::idSet, this, &IdentityForm::setToxId);
connect(bodyUI->userName, SIGNAL(editingFinished()), this, SLOT(onUserNameEdited()));
connect(bodyUI->statusMessage, SIGNAL(editingFinished()), this, SLOT(onStatusMessageEdited()));
connect(bodyUI->loadButton, &QPushButton::clicked, this, &IdentityForm::onLoadClicked);
@ -57,6 +58,16 @@ IdentityForm::IdentityForm() :
connect(bodyUI->importButton, &QPushButton::clicked, this, &IdentityForm::onImportClicked);
connect(bodyUI->newButton, &QPushButton::clicked, this, &IdentityForm::onNewClicked);
connect(core, &Core::avStart, this, &IdentityForm::disableSwitching);
connect(core, &Core::avStarting, this, &IdentityForm::disableSwitching);
connect(core, &Core::avInvite, this, &IdentityForm::disableSwitching);
connect(core, &Core::avRinging, this, &IdentityForm::disableSwitching);
connect(core, &Core::avCancel, this, &IdentityForm::enableSwitching);
connect(core, &Core::avEnd, this, &IdentityForm::enableSwitching);
connect(core, &Core::avEnding, this, &IdentityForm::enableSwitching);
connect(core, &Core::avPeerTimeout, this, &IdentityForm::enableSwitching);
connect(core, &Core::avRequestTimeout, this, &IdentityForm::enableSwitching);
connect(Core::getInstance(), &Core::usernameSet, this, [=](const QString& val) { bodyUI->userName->setText(val); });
connect(Core::getInstance(), &Core::statusMessageSet, this, [=](const QString& val) { bodyUI->statusMessage->setText(val); });
}
@ -203,3 +214,18 @@ bool IdentityForm::checkContinue(const QString& title, const QString& msg)
QMessageBox::StandardButton resp = QMessageBox::question(this, title, msg, QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
return resp == QMessageBox::Yes;
}
void IdentityForm::disableSwitching()
{
bodyUI->loadButton->setEnabled(false);
bodyUI->newButton->setEnabled(false);
}
void IdentityForm::enableSwitching()
{
if (!core->anyActiveCalls())
{
bodyUI->loadButton->setEnabled(true);
bodyUI->newButton->setEnabled(true);
}
}

View File

@ -24,6 +24,7 @@
#include <QLabel>
class CroppingLabel;
class Core;
namespace Ui {
class IdentitySettings;
@ -65,9 +66,12 @@ private slots:
void onImportClicked();
void onNewClicked();
bool checkContinue(const QString& title, const QString& msg);
void disableSwitching();
void enableSwitching();
private:
Ui::IdentitySettings* bodyUI;
Core* core;
ClickableTE* toxId;
};

View File

@ -114,6 +114,9 @@
<property name="text">
<string comment="load profile button">Load</string>
</property>
<property name="toolTip">
<string comment="tooltip">Switching profiles is disabled during calls</string>
</property>
</widget>
</item>
<item>
@ -156,6 +159,9 @@
<property name="text">
<string comment="new profile button">New Tox ID</string>
</property>
<property name="toolTip">
<string comment="tooltip">Switching profiles is disabled during calls</string>
</property>
</widget>
</item>
</layout>