mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
parent
523847d23b
commit
eaf01aadc3
18
src/core.cpp
18
src/core.cpp
@ -226,6 +226,12 @@ void Core::start()
|
||||
}
|
||||
loadPath = "";
|
||||
}
|
||||
else // new ID
|
||||
{
|
||||
setStatusMessage(tr("Toxing on qTox")); // this also solves the not updating issue
|
||||
setUsername(tr("qTox User"));
|
||||
Widget::getInstance()->onSettingsClicked(); // update ui with new profile (im worried about threading, but it seems to work)
|
||||
}
|
||||
|
||||
tox_callback_friend_request(tox, onFriendRequest, this);
|
||||
tox_callback_friend_message(tox, onFriendMessage, this);
|
||||
@ -1187,10 +1193,7 @@ void Core::saveConfiguration(const QString& path)
|
||||
void Core::switchConfiguration(const QString& profile)
|
||||
{
|
||||
if (profile.isEmpty())
|
||||
{
|
||||
qWarning() << "Core: got null profile to switch to, not switching";
|
||||
return;
|
||||
}
|
||||
qDebug() << "Core: creating new Id";
|
||||
else
|
||||
qDebug() << "Core: switching from" << Settings::getInstance().getCurrentProfile() << "to" << profile;
|
||||
saveConfiguration();
|
||||
@ -1205,8 +1208,11 @@ void Core::switchConfiguration(const QString& profile)
|
||||
}
|
||||
emit selfAvatarChanged(QPixmap(":/img/contact_dark.png"));
|
||||
emit blockingClearContacts(); // we need this to block, but signals are required for thread safety
|
||||
|
||||
loadPath = QDir(Settings::getSettingsDirPath()).filePath(profile + TOX_EXT);
|
||||
|
||||
if (profile.isEmpty())
|
||||
loadPath = "";
|
||||
else
|
||||
loadPath = QDir(Settings::getSettingsDirPath()).filePath(profile + TOX_EXT);
|
||||
Settings::getInstance().setCurrentProfile(profile);
|
||||
|
||||
start();
|
||||
|
@ -54,6 +54,7 @@ IdentityForm::IdentityForm() :
|
||||
connect(bodyUI->exportButton, &QPushButton::clicked, this, &IdentityForm::onExportClicked);
|
||||
connect(bodyUI->deleteButton, &QPushButton::clicked, this, &IdentityForm::onDeleteClicked);
|
||||
connect(bodyUI->importButton, &QPushButton::clicked, this, &IdentityForm::onImportClicked);
|
||||
connect(bodyUI->newButton, &QPushButton::clicked, this, &IdentityForm::onNewClicked);
|
||||
|
||||
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); });
|
||||
@ -179,3 +180,8 @@ void IdentityForm::onImportClicked()
|
||||
QFile::copy(path, profilePath);
|
||||
bodyUI->profiles->addItem(profile);
|
||||
}
|
||||
|
||||
void IdentityForm::onNewClicked()
|
||||
{
|
||||
emit Widget::getInstance()->changeProfile(QString());
|
||||
}
|
||||
|
@ -63,6 +63,7 @@ private slots:
|
||||
void onExportClicked();
|
||||
void onDeleteClicked();
|
||||
void onImportClicked();
|
||||
void onNewClicked();
|
||||
|
||||
private:
|
||||
Ui::IdentitySettings* bodyUI;
|
||||
|
@ -122,11 +122,22 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="importButton">
|
||||
<property name="text">
|
||||
<string comment="import profile button">Import a profile</string>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QHBoxLayout" name="profilesButtonsLayout2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="importButton">
|
||||
<property name="text">
|
||||
<string comment="import profile button">Import a profile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="newButton">
|
||||
<property name="text">
|
||||
<string comment="new profile button">New Tox ID</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
@ -148,7 +148,6 @@ void Widget::init()
|
||||
filesForm = new FilesForm();
|
||||
addFriendForm = new AddFriendForm;
|
||||
settingsWidget = new SettingsWidget();
|
||||
|
||||
|
||||
connect(core, &Core::connected, this, &Widget::onConnected);
|
||||
connect(core, &Core::disconnected, this, &Widget::onDisconnected);
|
||||
|
@ -66,6 +66,9 @@ public:
|
||||
|
||||
virtual void closeEvent(QCloseEvent *event);
|
||||
|
||||
public slots:
|
||||
void onSettingsClicked();
|
||||
|
||||
signals:
|
||||
void friendRequestAccepted(const QString& userId);
|
||||
void friendRequested(const QString& friendAddress, const QString& message);
|
||||
@ -82,7 +85,6 @@ private slots:
|
||||
void onAddClicked();
|
||||
void onGroupClicked();
|
||||
void onTransferClicked();
|
||||
void onSettingsClicked();
|
||||
void onFailedToStartCore();
|
||||
void onBadProxyCore();
|
||||
void onAvatarClicked();
|
||||
|
Loading…
x
Reference in New Issue
Block a user