Changed: Profile ID is now a QString

This commit is contained in:
kervala 2016-05-16 14:45:43 +02:00
parent 577680c85c
commit 811aa1967d
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)); 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.name = settings.value("name").toString();
profile.account = settings.value("account").toString(); profile.account = settings.value("account").toString();
profile.server = settings.value("server").toString(); profile.server = settings.value("server").toString();
@ -590,7 +590,7 @@ CConfigFile::InstallationStep CConfigFile::getNextStep() const
} }
// no default profile // no default profile
if (profile.id < 0) if (profile.id.isEmpty())
{ {
return CreateProfile; return CreateProfile;
} }

View file

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

View file

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

View file

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

View file

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