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

Implement logout button

This commit is contained in:
tux3 2015-06-04 11:56:19 +02:00
parent 05a49e8072
commit 3fd6d5d3e9
4 changed files with 20 additions and 4 deletions

View File

@ -39,7 +39,8 @@ Nexus::~Nexus()
#endif
delete loginScreen;
delete profile;
Settings::getInstance().save();
if (profile)
Settings::getInstance().save();
}
void Nexus::start()
@ -68,12 +69,23 @@ void Nexus::start()
void Nexus::showLogin()
{
((QApplication*)qApp)->setQuitOnLastWindowClosed(true);
#ifdef Q_OS_ANDROID
delete androidui;
androidgui = nullptr;
#else
delete widget;
widget = nullptr;
#endif
delete profile;
profile = nullptr;
loginScreen->reset();
#ifndef Q_OS_ANDROID
loginScreen->move(QApplication::desktop()->screen()->rect().center() - loginScreen->rect().center());
#endif
loginScreen->show();
((QApplication*)qApp)->setQuitOnLastWindowClosed(true);
}
void Nexus::showMainGUI()

View File

@ -17,7 +17,7 @@ class Nexus : public QObject
Q_OBJECT
public:
void start(); ///< Sets up invariants and calls showLogin
void showLogin(); ///< Shows the login screen
void showLogin(); ///< Hides the man GUI, delete the profile, and shows the login screen
/// Hides the login screen and shows the GUI for the given profile.
/// Will delete the current GUI, if it exists.
void showMainGUI();

View File

@ -66,6 +66,7 @@ Profile::~Profile()
{
delete core;
delete coreThread;
ProfileLocker::assertLock();
assert(ProfileLocker::getCurLockName() == name);
ProfileLocker::unlock();
}

View File

@ -310,7 +310,10 @@ void ProfileForm::onDeleteClicked()
void ProfileForm::onLogoutClicked()
{
/// TODO: Save and call Nexus show login?
Nexus& nexus = Nexus::getInstance();
nexus.getProfile()->saveToxSave();
Settings::getInstance().save();
nexus.showLogin();
}
void ProfileForm::onCopyQrClicked()