mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
parent
d07bef21a3
commit
38c68658e0
|
@ -275,7 +275,7 @@ void Nexus::setProfile(Profile* profile)
|
||||||
{
|
{
|
||||||
getInstance().profile = profile;
|
getInstance().profile = profile;
|
||||||
if (profile)
|
if (profile)
|
||||||
Settings::getInstance().loadPersonnal(profile);
|
Settings::getInstance().loadpersonal(profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
AndroidGUI* Nexus::getAndroidGUI()
|
AndroidGUI* Nexus::getAndroidGUI()
|
||||||
|
|
|
@ -48,7 +48,7 @@ Profile::Profile(QString name, QString password, bool isNewProfile)
|
||||||
s.setCurrentProfile(name);
|
s.setCurrentProfile(name);
|
||||||
s.saveGlobal();
|
s.saveGlobal();
|
||||||
|
|
||||||
// At this point it's too early to load the personnal settings (Nexus will do it), so we always load
|
// At this point it's too early to load the personal settings (Nexus will do it), so we always load
|
||||||
// the history, and if it fails we can't change the setting now, but we keep a nullptr
|
// the history, and if it fails we can't change the setting now, but we keep a nullptr
|
||||||
history.reset(new History{name, password});
|
history.reset(new History{name, password});
|
||||||
if (!history->isValid())
|
if (!history->isValid())
|
||||||
|
|
|
@ -265,18 +265,18 @@ void Settings::loadGlobal()
|
||||||
loaded = true;
|
loaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings::loadPersonnal()
|
void Settings::loadpersonal()
|
||||||
{
|
{
|
||||||
Profile* profile = Nexus::getProfile();
|
Profile* profile = Nexus::getProfile();
|
||||||
if (!profile)
|
if (!profile)
|
||||||
{
|
{
|
||||||
qCritical() << "No active profile, couldn't load personnal settings";
|
qCritical() << "No active profile, couldn't load personal settings";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
loadPersonnal(profile);
|
loadpersonal(profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings::loadPersonnal(Profile* profile)
|
void Settings::loadpersonal(Profile* profile)
|
||||||
{
|
{
|
||||||
QMutexLocker locker{&bigLock};
|
QMutexLocker locker{&bigLock};
|
||||||
|
|
||||||
|
@ -288,7 +288,7 @@ void Settings::loadPersonnal(Profile* profile)
|
||||||
if (QFile(tmp).exists()) // otherwise, filePath remains the global file
|
if (QFile(tmp).exists()) // otherwise, filePath remains the global file
|
||||||
filePath = tmp;
|
filePath = tmp;
|
||||||
|
|
||||||
qDebug()<<"Loading personnal settings from"<<filePath;
|
qDebug()<<"Loading personal settings from"<<filePath;
|
||||||
|
|
||||||
SettingsSerializer ps(filePath, profile->getPassword());
|
SettingsSerializer ps(filePath, profile->getPassword());
|
||||||
ps.load();
|
ps.load();
|
||||||
|
|
|
@ -43,14 +43,14 @@ public:
|
||||||
QString getSettingsDirPath(); ///< The returned path ends with a directory separator
|
QString getSettingsDirPath(); ///< The returned path ends with a directory separator
|
||||||
|
|
||||||
void createSettingsDir(); ///< Creates a path to the settings dir, if it doesn't already exist
|
void createSettingsDir(); ///< Creates a path to the settings dir, if it doesn't already exist
|
||||||
void createPersonal(QString basename); ///< Write a default personnal .ini settings file for a profile
|
void createPersonal(QString basename); ///< Write a default personal .ini settings file for a profile
|
||||||
|
|
||||||
void savePersonal(); ///< Asynchronous, saves the current profile
|
void savePersonal(); ///< Asynchronous, saves the current profile
|
||||||
void savePersonal(Profile *profile); ///< Asynchronous
|
void savePersonal(Profile *profile); ///< Asynchronous
|
||||||
|
|
||||||
void loadGlobal();
|
void loadGlobal();
|
||||||
void loadPersonnal();
|
void loadpersonal();
|
||||||
void loadPersonnal(Profile *profile);
|
void loadpersonal(Profile *profile);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void saveGlobal(); ///< Asynchronous
|
void saveGlobal(); ///< Asynchronous
|
||||||
|
|
|
@ -373,7 +373,7 @@ void SettingsSerializer::readSerialized()
|
||||||
stream >> sizeData;
|
stream >> sizeData;
|
||||||
if (sizeData.isEmpty())
|
if (sizeData.isEmpty())
|
||||||
{
|
{
|
||||||
qWarning("The personnal save file is corrupted!");
|
qWarning("The personal save file is corrupted!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
quint64 size = dataToVUint(sizeData);
|
quint64 size = dataToVUint(sizeData);
|
||||||
|
@ -386,7 +386,7 @@ void SettingsSerializer::readSerialized()
|
||||||
stream >> indexData;
|
stream >> indexData;
|
||||||
if (indexData.isEmpty())
|
if (indexData.isEmpty())
|
||||||
{
|
{
|
||||||
qWarning("The personnal save file is corrupted!");
|
qWarning("The personal save file is corrupted!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
quint64 index = dataToVUint(indexData);
|
quint64 index = dataToVUint(indexData);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user