Changed: Profile ID is now a QString

--HG--
branch : develop
This commit is contained in:
kervala 2016-05-16 14:45:43 +02:00
parent db70d04dce
commit a161968c3c
5 changed files with 8 additions and 9 deletions

View file

@ -105,7 +105,7 @@ bool CConfigFile::load(const QString &filename)
settings.beginGroup(QString("profile_%1").arg(i));
profile.id = settings.value("id").toInt();
profile.id = settings.value("id").toString();
profile.name = settings.value("name").toString();
profile.account = settings.value("account").toString();
profile.server = settings.value("server").toString();
@ -590,7 +590,7 @@ CConfigFile::InstallationStep CConfigFile::getNextStep() const
}
// no default profile
if (profile.id < 0)
if (profile.id.isEmpty())
{
return CreateProfile;
}

View file

@ -46,12 +46,11 @@ struct CProfile
{
CProfile()
{
id = -1;
desktopShortcut = false;
menuShortcut = false;
}
int id;
QString id;
QString account;
QString name;
QString server;

View file

@ -97,7 +97,7 @@ void CProfilesDialog::displayProfile(int index)
const CProfile &profile = m_model->getProfiles()[index];
// update all widgets with content of profile
profileIdLabel->setText(QString::number(profile.id));
profileIdLabel->setText(profile.id);
accountEdit->setText(profile.account);
nameEdit->setText(profile.name);
serverComboBox->setCurrentIndex(m_serversModel->getIndexFromServerID(profile.server));

View file

@ -48,7 +48,7 @@ bool CProfilesModel::save() const
return true;
}
int CProfilesModel::getIndexFromProfileID(int profileId) const
int CProfilesModel::getIndexFromProfileID(const QString &profileId) const
{
for(int i = 0; i < m_profiles.size(); ++i)
{
@ -58,7 +58,7 @@ int CProfilesModel::getIndexFromProfileID(int profileId) const
return -1;
}
int CProfilesModel::getProfileIDFromIndex(int index) const
QString CProfilesModel::getProfileIDFromIndex(int index) const
{
if (index < 0 || index >= m_profiles.size()) return -1;

View file

@ -25,8 +25,8 @@ public:
bool save() const;
int getIndexFromProfileID(int profileId) const;
int getProfileIDFromIndex(int index) const;
int getIndexFromProfileID(const QString &profileId) const;
QString getProfileIDFromIndex(int index) const;
private:
CProfiles m_profiles;