QML UI: remove manual setting of web service userid

It's just not user friendly to have two different user IDs for two
different web services that we provide. Instead in the following commits
we'll add a way to retrieve the location service web service userid with
your cloud storage user id.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-11-18 13:12:34 -08:00
parent ddef5650f6
commit 18e52c1da4
3 changed files with 1 additions and 36 deletions

View file

@ -79,17 +79,6 @@ Item {
Layout.columnSpan: 2 Layout.columnSpan: 2
} }
Label {
text: "ID"
Layout.alignment: Qt.AlignRight
}
TextField {
id: userid
text: manager.ssrfGpsWebUserid
Layout.fillWidth: true
}
Label { Label {
text: "Distance threshold (meters)" text: "Distance threshold (meters)"
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
@ -124,7 +113,6 @@ Item {
manager.cloudUserName = login.text manager.cloudUserName = login.text
manager.cloudPassword = password.text manager.cloudPassword = password.text
manager.saveCloudPassword = savePassword.checked manager.saveCloudPassword = savePassword.checked
manager.ssrfGpsWebUserid = userid.text
manager.distanceThreshold = distanceThreshold.text manager.distanceThreshold = distanceThreshold.text
manager.timeThreshold = timeThreshold.text manager.timeThreshold = timeThreshold.text
manager.savePreferences() manager.savePreferences()

View file

@ -25,7 +25,6 @@ QMLManager::QMLManager() :
setCloudUserName(prefs.cloud_storage_email); setCloudUserName(prefs.cloud_storage_email);
setCloudPassword(prefs.cloud_storage_password); setCloudPassword(prefs.cloud_storage_password);
setSaveCloudPassword(prefs.save_password_local); setSaveCloudPassword(prefs.save_password_local);
setSsrfGpsWebUserid(prefs.userid);
setDistanceThreshold(prefs.distance_threshold); setDistanceThreshold(prefs.distance_threshold);
setTimeThreshold(prefs.time_threshold / 60); setTimeThreshold(prefs.time_threshold / 60);
if (!same_string(prefs.cloud_storage_email, "") && !same_string(prefs.cloud_storage_password, "")) if (!same_string(prefs.cloud_storage_email, "") && !same_string(prefs.cloud_storage_password, ""))
@ -39,7 +38,6 @@ QMLManager::~QMLManager()
void QMLManager::savePreferences() void QMLManager::savePreferences()
{ {
QSettings s; QSettings s;
s.setValue("subsurface_webservice_uid", ssrfGpsWebUserid());
s.beginGroup("LocationService"); s.beginGroup("LocationService");
s.setValue("time_threshold", timeThreshold() * 60); s.setValue("time_threshold", timeThreshold() * 60);
prefs.time_threshold = timeThreshold() * 60; prefs.time_threshold = timeThreshold() * 60;
@ -56,19 +54,14 @@ void QMLManager::savePreferences()
free(prefs.cloud_storage_email); free(prefs.cloud_storage_email);
prefs.cloud_storage_email = strdup(qPrintable(cloudUserName())); prefs.cloud_storage_email = strdup(qPrintable(cloudUserName()));
} }
if (saveCloudPassword() != prefs.save_password_local) { if (saveCloudPassword() != prefs.save_password_local)
prefs.save_password_local = saveCloudPassword(); prefs.save_password_local = saveCloudPassword();
}
if (saveCloudPassword()) { if (saveCloudPassword()) {
if (!same_string(prefs.cloud_storage_password, qPrintable(cloudPassword()))) { if (!same_string(prefs.cloud_storage_password, qPrintable(cloudPassword()))) {
free(prefs.cloud_storage_password); free(prefs.cloud_storage_password);
prefs.cloud_storage_password = strdup(qPrintable(cloudPassword())); prefs.cloud_storage_password = strdup(qPrintable(cloudPassword()));
} }
} }
if (!same_string(prefs.userid, qPrintable(ssrfGpsWebUserid()))) {
free(prefs.userid);
prefs.userid = strdup(qPrintable(ssrfGpsWebUserid()));
}
} }
void QMLManager::loadDives() void QMLManager::loadDives()
@ -238,17 +231,6 @@ void QMLManager::setCloudUserName(const QString &cloudUserName)
emit cloudUserNameChanged(); emit cloudUserNameChanged();
} }
QString QMLManager::ssrfGpsWebUserid() const
{
return m_ssrfGpsWebUserid;
}
void QMLManager::setSsrfGpsWebUserid(const QString &userid)
{
m_ssrfGpsWebUserid = userid;
emit ssrfGpsWebUseridChanged();
}
int QMLManager::distanceThreshold() const int QMLManager::distanceThreshold() const
{ {
return m_distanceThreshold; return m_distanceThreshold;

View file

@ -16,7 +16,6 @@ class QMLManager : public QObject
Q_PROPERTY(bool saveCloudPassword READ saveCloudPassword WRITE setSaveCloudPassword NOTIFY saveCloudPasswordChanged) Q_PROPERTY(bool saveCloudPassword READ saveCloudPassword WRITE setSaveCloudPassword NOTIFY saveCloudPasswordChanged)
Q_PROPERTY(QString logText READ logText WRITE setLogText NOTIFY logTextChanged) Q_PROPERTY(QString logText READ logText WRITE setLogText NOTIFY logTextChanged)
Q_PROPERTY(bool locationServiceEnabled READ locationServiceEnabled WRITE setLocationServiceEnabled NOTIFY locationServiceEnabledChanged) Q_PROPERTY(bool locationServiceEnabled READ locationServiceEnabled WRITE setLocationServiceEnabled NOTIFY locationServiceEnabledChanged)
Q_PROPERTY(QString ssrfGpsWebUserid READ ssrfGpsWebUserid WRITE setSsrfGpsWebUserid NOTIFY ssrfGpsWebUseridChanged)
Q_PROPERTY(int distanceThreshold READ distanceThreshold WRITE setDistanceThreshold NOTIFY distanceThresholdChanged) Q_PROPERTY(int distanceThreshold READ distanceThreshold WRITE setDistanceThreshold NOTIFY distanceThresholdChanged)
Q_PROPERTY(int timeThreshold READ timeThreshold WRITE setTimeThreshold NOTIFY timeThresholdChanged) Q_PROPERTY(int timeThreshold READ timeThreshold WRITE setTimeThreshold NOTIFY timeThresholdChanged)
public: public:
@ -32,9 +31,6 @@ public:
bool saveCloudPassword() const; bool saveCloudPassword() const;
void setSaveCloudPassword(bool saveCloudPassword); void setSaveCloudPassword(bool saveCloudPassword);
QString ssrfGpsWebUserid() const;
void setSsrfGpsWebUserid(const QString &userid);
bool locationServiceEnabled() const; bool locationServiceEnabled() const;
void setLocationServiceEnabled(bool locationServiceEnable); void setLocationServiceEnabled(bool locationServiceEnable);
@ -72,7 +68,6 @@ private:
signals: signals:
void cloudUserNameChanged(); void cloudUserNameChanged();
void cloudPasswordChanged(); void cloudPasswordChanged();
void ssrfGpsWebUseridChanged();
void saveCloudPasswordChanged(); void saveCloudPasswordChanged();
void locationServiceEnabledChanged(); void locationServiceEnabledChanged();
void logTextChanged(); void logTextChanged();