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 textLines = textText.split("\n");
var maxLineWidth = Overlays.textSize(textSizeMeasureOverlay, textText).width; var maxLineWidth = Overlays.textSize(textSizeMeasureOverlay, textText).width;
var usernameLine = "--" + GlobalServices.myUsername; var usernameLine = "--" + GlobalServices.username;
var usernameWidth = Overlays.textSize(textSizeMeasureOverlay, usernameLine).width; var usernameWidth = Overlays.textSize(textSizeMeasureOverlay, usernameLine).width;
if (maxLineWidth < usernameWidth) { if (maxLineWidth < usernameWidth) {
maxLineWidth = usernameWidth; maxLineWidth = usernameWidth;

View file

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

View file

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