cleanup username API from GlobalServicesScriptingInterface

This commit is contained in:
Stephen Birarda 2015-03-09 16:28:01 -07:00
parent d662c30405
commit c9982e765e
3 changed files with 10 additions and 12 deletions

View file

@ -86,7 +86,7 @@ keyboard.onKeyRelease = function(event) {
var textLines = textText.split("\n");
var maxLineWidth = Overlays.textSize(textSizeMeasureOverlay, textText).width;
var usernameLine = "--" + GlobalServices.myUsername;
var usernameLine = "--" + GlobalServices.username;
var usernameWidth = Overlays.textSize(textSizeMeasureOverlay, usernameLine).width;
if (maxLineWidth < usernameWidth) {
maxLineWidth = usernameWidth;

View file

@ -36,10 +36,6 @@ GlobalServicesScriptingInterface* GlobalServicesScriptingInterface::getInstance(
return &sharedInstance;
}
QString GlobalServicesScriptingInterface::getMyUsername() {
return AccountManager::getInstance().getAccountInfo().getUsername();
}
void GlobalServicesScriptingInterface::loggedOut() {
emit GlobalServicesScriptingInterface::disconnected(QString("logout"));
}

View file

@ -31,20 +31,21 @@ Q_DECLARE_METATYPE(DownloadInfoResult)
QScriptValue DownloadInfoResultToScriptValue(QScriptEngine* engine, const DownloadInfoResult& result);
void DownloadInfoResultFromScriptValue(const QScriptValue& object, DownloadInfoResult& result);
class GlobalServicesScriptingInterface : public QObject {
Q_OBJECT
Q_PROPERTY(QString myUsername READ getMyUsername)
GlobalServicesScriptingInterface();
~GlobalServicesScriptingInterface();
Q_PROPERTY(QString username READ getUsername)
public:
static GlobalServicesScriptingInterface* getInstance();
QString getMyUsername();
const QString& getUsername() const { return AccountManager::getInstance().getAccountInfo().getUsername(); }
public slots:
DownloadInfoResult getDownloadInfo();
void updateDownloadInfo();
void setDiscoverability(const QString& discoverability);
private slots:
void loggedOut();
@ -53,12 +54,13 @@ private slots:
signals:
void connected();
void disconnected(const QString& reason);
void incomingMessage(const QString& username, const QString& message);
void onlineUsersChanged(const QStringList& usernames);
void myUsernameChanged(const QString& username);
void downloadInfoChanged(DownloadInfoResult info);
private:
GlobalServicesScriptingInterface();
~GlobalServicesScriptingInterface();
bool _downloading;
};