Example #1
0
void Rack::add(RackElement* re) {

	// empty user name?
	if (re->getUserName().empty()) {re->setUserName(re->getProductString());}

	// ensure the element provides an unique name
	if (hasElementNamed(re->getUserName())) {

		// create a unique name
		std::string name = "";
		for (unsigned int i = 1; i < 64; ++i) {
			name = re->getProductString() + " " + std::to_string(i);
			if (!hasElementNamed(name)) {break;}
		}
		re->setUserName(name);

	}

	// add to gui
	rw.add(re);

	// add to list
	elems.push_back(re);

	// user name changed -> rack changed
	connect(re, SIGNAL(userNameChanged()), this, SIGNAL(onRackChanged()));

	// attach
	re->onRackAttach();

	//emit entryAdded( (unsigned int) elems.size() - 1);
	emit onRackChanged();

}
Example #2
0
void BackEnd::setUserName(const QString &userName)
{
    if (userName == m_userName)
        return;

    m_userName = userName;
    emit userNameChanged();
}
Example #3
0
void IrcSession::setUserName(const QString& name)
{
    Q_D(IrcSession);
    if (isActive())
        qWarning("IrcSession::setUserName() has no effect until re-connect");
    QString user = name.split(" ", QString::SkipEmptyParts).value(0).trimmed();
    if (d->userName != user)
    {
        d->userName = user;
        emit userNameChanged(user);
    }
}
void ESURegistration::setRegistrationData(const RegistrationUserInfo &data)
{
    d->dataInfo = data;
    setUserRole(data.role);
    setUserRankIndex(data.rank);
    d->dataInfo.updateTimeString();

    Q_EMIT userNameChanged();
    Q_EMIT userSpecialtyChanged();
    Q_EMIT userBirthdayChanged();
    Q_EMIT userAddressChanged();
    Q_EMIT registrationTimeChanged();
}
void ESURegistration::clearUserData()
{
    d->dataInfo.clear();

    Q_EMIT userNameChanged();
    Q_EMIT userRoleChanged();
    Q_EMIT userDutyChanged();
    Q_EMIT userRankChanged();
    Q_EMIT userRankIndexChanged();
    Q_EMIT userSpecialtyChanged();
    Q_EMIT userBirthdayChanged();
    Q_EMIT userAddressChanged();
    Q_EMIT registrationTimeChanged();
}
void tst_IdentityInterface::userName()
{
    int identityIdentifier = 0;

    // unsaved, ensure that setting the username works
    {
        QScopedPointer<IdentityInterface> identity(new IdentityInterface);
        QSignalSpy spy(identity.data(), SIGNAL(userNameChanged()));
        identity->setUserName(QString(QLatin1String("test-username")));
        QCOMPARE(spy.count(), 1);
        QCOMPARE(identity->userName(), QString(QLatin1String("test-username")));
    }

    // after save, ensure that the username can be read back
    {
        QScopedPointer<IdentityInterface> identity(new IdentityInterface);
        identity->classBegin();
        identity->componentComplete();
        QTRY_COMPARE(identity->status(), IdentityInterface::Initialized);
        QCOMPARE(identity->userName(), QString());
        identity->setUserName(QString(QLatin1String("test-username")));
        QCOMPARE(identity->userName(), QString(QLatin1String("test-username")));
        identity->sync(); // begin sync.
        QCOMPARE(identity->userName(), QString(QLatin1String("test-username")));
        QTRY_COMPARE(identity->status(), IdentityInterface::Synced);
        QCOMPARE(identity->userName(), QString(QLatin1String("test-username")));
        identityIdentifier = identity->identifier();
    }

    // ensure that it can be read from the non-writing instance
    {
        QScopedPointer<IdentityInterface> identity(new IdentityInterface);
        identity->classBegin();
        identity->setIdentifier(identityIdentifier);
        identity->componentComplete();
        QTRY_COMPARE(identity->status(), IdentityInterface::Initialized);
        QCOMPARE(identity->userName(), QString(QLatin1String("test-username")));
        identity->remove(); // cleanup.
    }
}
Example #7
0
 inline void           setUserName(const QString &c)     { m_User = c; emit userNameChanged(); }
Example #8
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    QCoreApplication::setOrganizationName("Fudeco Oy");
    QCoreApplication::setOrganizationDomain("fudeco.com");
    QCoreApplication::setApplicationName("Speed Freak");

    helpDialog = NULL;
    accstart = NULL;
    routeSaveDialog = NULL;
    topResultDialog = NULL;

    settingsDialog = new SettingsDialog;
    connect(settingsDialog, SIGNAL(sendregistration()), this, SLOT(clientRegUserToServer()));
    connect(settingsDialog, SIGNAL(userNameChanged()),  this, SLOT(clientUserLogin()));
    connect(settingsDialog, SIGNAL(logout()),           this, SLOT(setUsernameToMainPanel()));
    connect(settingsDialog, SIGNAL(saveprofile()),      this, SLOT(saveProfile()));

    httpClient = new HttpClient(this);
    connect(httpClient->myXmlreader, SIGNAL(receivedCategoryList()), this, SLOT(setCategoryCompoBox()));
    connect(httpClient->myXmlreader, SIGNAL(receivedTop10List()), this, SLOT(showTop10()));    

    welcomeDialog = new WelcomeDialog;
    welcomeDialog->show();

    this->setUsernameToMainPanel();

    //Create icon for acceleration start button
    QIcon* icon = new QIcon();
    icon->addFile(QString(":/new/prefix1/Graphics/Speedometer.png"), QSize(125,125), QIcon::Normal, QIcon::Off);
    icon->addFile(QString(":/new/prefix1/Graphics/Speedometer2.png"), QSize(125,125), QIcon::Normal, QIcon::On);

    //Acceleration start button

    customButtonAccelerate = new CustomButton(this,icon);
    delete icon;

    int buttons_x = 50,buttons_y = 165;
    customButtonAccelerate->setGeometry(buttons_x,buttons_y,130,130);
    connect(customButtonAccelerate, SIGNAL(OpenDialog()), this, SLOT(OpenAccStartDialog()));
    customButtonAccelerate->show();

    //Create icon for route dialog button
    icon = new QIcon();
    icon->addFile(QString(":/new/prefix1/Graphics/route.png"), QSize(125,125), QIcon::Normal, QIcon::Off);
    icon->addFile(QString(":/new/prefix1/Graphics/route_selected.png"), QSize(125,125), QIcon::Normal, QIcon::On);

    //Route dialog button

    customButtonRoute = new CustomButton(this,icon);
    delete icon;

    buttons_x += 140;
    customButtonRoute->setGeometry(buttons_x,buttons_y,130,130);
    connect(customButtonRoute, SIGNAL(OpenDialog()), this, SLOT(OpenRouteDialog()));
    customButtonRoute->show();

    //Create icon for results dialog button
    icon = new QIcon();
    icon->addFile(QString(":/new/prefix1/Graphics/trophy_gold.png"), QSize(125,125), QIcon::Normal, QIcon::Off);
    icon->addFile(QString(":/new/prefix1/Graphics/trophy_gold_selected.png"), QSize(125,125), QIcon::Normal, QIcon::On);

    //Results dialog button

    customButtonResults = new CustomButton(this,icon);
    delete icon;

    buttons_x += 140;
    customButtonResults->setGeometry(buttons_x,buttons_y,130,130);
    connect(customButtonResults, SIGNAL(OpenDialog()), this, SLOT(OpenResultDialog()));
    customButtonResults->show();
    //Create icon for settings dialog button
    icon = new QIcon();
    icon->addFile(QString(":/new/prefix1/Graphics/settings.png"), QSize(125,125), QIcon::Normal, QIcon::Off);
    icon->addFile(QString(":/new/prefix1/Graphics/settings_selected.png"), QSize(125,125), QIcon::Normal, QIcon::On);

    //Settings dialog button

    customButtonSettings = new CustomButton(this,icon);
    delete icon;

    buttons_x += 140;
    customButtonSettings->setGeometry(buttons_x,buttons_y,130,130);
    connect(customButtonSettings, SIGNAL(OpenDialog()), this, SLOT(OpenSettingsDialog()));
    customButtonSettings->show();

    //Create icon for www page button
    icon = new QIcon();
    icon->addFile(QString(":/new/prefix1/Graphics/applications_internet.png"), QSize(125,125), QIcon::Normal, QIcon::Off);
    icon->addFile(QString(":/new/prefix1/Graphics/applications_internet_selected.png"), QSize(125,125), QIcon::Normal, QIcon::On);

    //WWW page button

    customButtonWWW = new CustomButton(this,icon);
    delete icon;

    buttons_x += 140;
    customButtonWWW->setGeometry(buttons_x,buttons_y,130,130);
    connect(customButtonWWW, SIGNAL(OpenDialog()), this, SLOT(OpenWWWPage()));
    customButtonWWW->show();

    //Create icon for help dialog button
    icon = new QIcon();
    icon->addFile(QString(":/new/prefix1/Graphics/info.png"), QSize(105,105), QIcon::Normal, QIcon::Off);
    icon->addFile(QString(":/new/prefix1/Graphics/info_selected.png"), QSize(105,105), QIcon::Normal, QIcon::On);

    //Help dialog button

    customButtonHelp = new CustomButton(this,icon);
    delete icon;

    customButtonHelp->setGeometry(670,10,105,105);
    connect(customButtonHelp, SIGNAL(OpenDialog()), this, SLOT(OpenHelpDialog()));
    customButtonHelp->show();
}
/*! \reimp */
void FacebookUserInterface::emitPropertyChangeSignals(const QVariantMap &oldData, const QVariantMap &newData)
{
    Q_D(FacebookUserInterface);
    QString nameStr = newData.value(FACEBOOK_ONTOLOGY_USER_NAME).toString();
    QString fnStr = newData.value(FACEBOOK_ONTOLOGY_USER_FIRSTNAME).toString();
    QString mnStr = newData.value(FACEBOOK_ONTOLOGY_USER_MIDDLENAME).toString();
    QString lnStr = newData.value(FACEBOOK_ONTOLOGY_USER_LASTNAME).toString();
    QString gnStr = newData.value(FACEBOOK_ONTOLOGY_USER_GENDER).toString();
    QString locStr = newData.value(FACEBOOK_ONTOLOGY_USER_LOCALE).toString();
    QString linkStr = newData.value(FACEBOOK_ONTOLOGY_USER_LINK).toString();
    QString unStr = newData.value(FACEBOOK_ONTOLOGY_USER_USERNAME).toString();
    QString tpiStr = newData.value(FACEBOOK_ONTOLOGY_USER_THIRDPARTYIDENTIFIER).toString();
    QString insStr = newData.value(FACEBOOK_ONTOLOGY_USER_INSTALLED).toString();
    QString tzoStr = newData.value(FACEBOOK_ONTOLOGY_USER_TIMEZONEOFFSET).toString();
    QString verStr = newData.value(FACEBOOK_ONTOLOGY_USER_VERIFIED).toString();
    QString udtStr = newData.value(FACEBOOK_ONTOLOGY_USER_UPDATEDTIME).toString();
    QString bioStr = newData.value(FACEBOOK_ONTOLOGY_USER_BIO).toString();
    QString bdayStr = newData.value(FACEBOOK_ONTOLOGY_USER_BIRTHDAY).toString();
    QString emailStr = newData.value(FACEBOOK_ONTOLOGY_USER_EMAIL).toString();
    QStringList iinStr = newData.value(FACEBOOK_ONTOLOGY_USER_INTERESTEDIN).toStringList();
    QString polStr = newData.value(FACEBOOK_ONTOLOGY_USER_POLITICAL).toString();
    QString quoStr = newData.value(FACEBOOK_ONTOLOGY_USER_QUOTES).toString();
    QString rssStr = newData.value(FACEBOOK_ONTOLOGY_USER_RELATIONSHIPSTATUS).toString();
    QString relStr = newData.value(FACEBOOK_ONTOLOGY_USER_RELIGION).toString();
    QString webStr = newData.value(FACEBOOK_ONTOLOGY_USER_WEBSITE).toString();
    QVariantMap htMap = newData.value(FACEBOOK_ONTOLOGY_USER_HOMETOWN).toMap();
    QVariantMap locMap = newData.value(FACEBOOK_ONTOLOGY_USER_LOCATION).toMap();
    QVariantMap picMap = newData.value(FACEBOOK_ONTOLOGY_USER_PICTURE).toMap();
    QVariantMap sigMap = newData.value(FACEBOOK_ONTOLOGY_USER_SIGNIFICANTOTHER).toMap();

    QString oldNameStr = oldData.value(FACEBOOK_ONTOLOGY_USER_NAME).toString();
    QString oldFnStr = oldData.value(FACEBOOK_ONTOLOGY_USER_FIRSTNAME).toString();
    QString oldMnStr = oldData.value(FACEBOOK_ONTOLOGY_USER_MIDDLENAME).toString();
    QString oldLnStr = oldData.value(FACEBOOK_ONTOLOGY_USER_LASTNAME).toString();
    QString oldGnStr = oldData.value(FACEBOOK_ONTOLOGY_USER_GENDER).toString();
    QString oldLocStr = oldData.value(FACEBOOK_ONTOLOGY_USER_LOCALE).toString();
    QString oldLinkStr = oldData.value(FACEBOOK_ONTOLOGY_USER_LINK).toString();
    QString oldUnStr = oldData.value(FACEBOOK_ONTOLOGY_USER_USERNAME).toString();
    QString oldTpiStr = oldData.value(FACEBOOK_ONTOLOGY_USER_THIRDPARTYIDENTIFIER).toString();
    QString oldInsStr = oldData.value(FACEBOOK_ONTOLOGY_USER_INSTALLED).toString();
    QString oldTzoStr = newData.value(FACEBOOK_ONTOLOGY_USER_TIMEZONEOFFSET).toString();
    QString oldVerStr = newData.value(FACEBOOK_ONTOLOGY_USER_VERIFIED).toString();
    QString oldUdtStr = newData.value(FACEBOOK_ONTOLOGY_USER_UPDATEDTIME).toString();
    QString oldBioStr = oldData.value(FACEBOOK_ONTOLOGY_USER_BIO).toString();
    QString oldBdayStr = oldData.value(FACEBOOK_ONTOLOGY_USER_BIRTHDAY).toString();
    QString oldEmailStr = oldData.value(FACEBOOK_ONTOLOGY_USER_EMAIL).toString();
    QStringList oldIinStr = oldData.value(FACEBOOK_ONTOLOGY_USER_INTERESTEDIN).toStringList();
    QString oldPolStr = oldData.value(FACEBOOK_ONTOLOGY_USER_POLITICAL).toString();
    QString oldQuoStr = oldData.value(FACEBOOK_ONTOLOGY_USER_QUOTES).toString();
    QString oldRssStr = oldData.value(FACEBOOK_ONTOLOGY_USER_RELATIONSHIPSTATUS).toString();
    QString oldRelStr = oldData.value(FACEBOOK_ONTOLOGY_USER_RELIGION).toString();
    QString oldWebStr = oldData.value(FACEBOOK_ONTOLOGY_USER_WEBSITE).toString();
    QVariantMap oldHtMap = oldData.value(FACEBOOK_ONTOLOGY_USER_HOMETOWN).toMap();
    QVariantMap oldLocMap = oldData.value(FACEBOOK_ONTOLOGY_USER_LOCATION).toMap();
    QVariantMap oldPicMap = oldData.value(FACEBOOK_ONTOLOGY_USER_PICTURE).toMap();
    QVariantMap oldSigMap = oldData.value(FACEBOOK_ONTOLOGY_USER_SIGNIFICANTOTHER).toMap();

    // standard properties
    if (nameStr != oldNameStr)
        emit nameChanged();
    if (fnStr != oldFnStr)
        emit firstNameChanged();
    if (mnStr != oldMnStr)
        emit middleNameChanged();
    if (lnStr != oldLnStr)
        emit lastNameChanged();
    if (gnStr != oldGnStr)
        emit genderChanged();
    if (locStr != oldLocStr)
        emit locationChanged();
    if (linkStr != oldLinkStr)
        emit linkChanged();
    if (unStr != oldUnStr)
        emit userNameChanged();
    if (tpiStr != oldTpiStr)
        emit thirdPartyIdentifierChanged();
    if (insStr != oldInsStr)
        emit installedChanged();
    if (tzoStr != oldTzoStr)
        emit timezoneOffsetChanged();
    if (verStr != oldVerStr)
        emit verifiedChanged();
    if (udtStr != oldUdtStr)
        emit updatedTimeChanged();
    if (bioStr != oldBioStr)
        emit bioChanged();
    if (bdayStr != oldBdayStr)
        emit birthdayChanged();
    if (emailStr != oldEmailStr)
        emit emailChanged();
    if (iinStr != oldIinStr)
        emit interestedInChanged();
    if (polStr != oldPolStr)
        emit politicalChanged();
    if (quoStr != oldQuoStr)
        emit quotesChanged();
    if (rssStr != oldRssStr)
        emit relationshipStatusChanged();
    if (relStr != oldRelStr)
        emit religionChanged();
    if (webStr != oldWebStr)
        emit websiteChanged();

    // variantmap / object reference properties
    if (htMap != oldHtMap) {
        QVariantMap newHtData;
        newHtData.insert(FACEBOOK_ONTOLOGY_OBJECTREFERENCE_OBJECTTYPE, FacebookInterface::Location);
        newHtData.insert(FACEBOOK_ONTOLOGY_OBJECTREFERENCE_OBJECTIDENTIFIER, newHtData.value(FACEBOOK_ONTOLOGY_OBJECTREFERENCE_OBJECTIDENTIFIER));
        newHtData.insert(FACEBOOK_ONTOLOGY_OBJECTREFERENCE_OBJECTNAME, newHtData.value(FACEBOOK_ONTOLOGY_OBJECTREFERENCE_OBJECTNAME));
        qobject_cast<FacebookInterface*>(socialNetwork())->setFacebookContentItemData(d->hometown, newHtData);
        emit hometownChanged();
    }

    if (locMap != oldLocMap) {
        QVariantMap newLocData;
        newLocData.insert(FACEBOOK_ONTOLOGY_OBJECTREFERENCE_OBJECTTYPE, FacebookInterface::Location);
        newLocData.insert(FACEBOOK_ONTOLOGY_OBJECTREFERENCE_OBJECTIDENTIFIER, newLocData.value(FACEBOOK_ONTOLOGY_OBJECTREFERENCE_OBJECTIDENTIFIER));
        newLocData.insert(FACEBOOK_ONTOLOGY_OBJECTREFERENCE_OBJECTNAME, newLocData.value(FACEBOOK_ONTOLOGY_OBJECTREFERENCE_OBJECTNAME));
        qobject_cast<FacebookInterface*>(socialNetwork())->setFacebookContentItemData(d->location, newLocData);
        emit locationChanged();
    }

    if (picMap != oldPicMap) {
        qobject_cast<FacebookInterface*>(socialNetwork())->setFacebookContentItemData(d->picture, picMap);
        emit pictureChanged();
    }

    if (sigMap != oldSigMap) {
        QVariantMap newSigData;
        newSigData.insert(FACEBOOK_ONTOLOGY_OBJECTREFERENCE_OBJECTTYPE, FacebookInterface::User);
        newSigData.insert(FACEBOOK_ONTOLOGY_OBJECTREFERENCE_OBJECTIDENTIFIER, newSigData.value(FACEBOOK_ONTOLOGY_OBJECTREFERENCE_OBJECTIDENTIFIER));
        newSigData.insert(FACEBOOK_ONTOLOGY_OBJECTREFERENCE_OBJECTNAME, newSigData.value(FACEBOOK_ONTOLOGY_OBJECTREFERENCE_OBJECTNAME));
        qobject_cast<FacebookInterface*>(socialNetwork())->setFacebookContentItemData(d->significantOther, newSigData);
        emit significantOtherChanged();
    }

    // call the super class implementation
    QVariantMap oldDataWithId = oldData; oldDataWithId.insert(NEMOQMLPLUGINS_SOCIAL_CONTENTITEMID, oldData.value(FACEBOOK_ONTOLOGY_USER_ID));
    QVariantMap newDataWithId = newData; newDataWithId.insert(NEMOQMLPLUGINS_SOCIAL_CONTENTITEMID, newData.value(FACEBOOK_ONTOLOGY_USER_ID));
    IdentifiableContentItemInterface::emitPropertyChangeSignals(oldDataWithId, newDataWithId);
}
void ESURegistration::setUserName(const QString &name)
{
    d->dataInfo.name = name;
    Q_EMIT userNameChanged();
}
void UserNameDialog::sendUserName()
{
    emit userNameChanged(userName_);
}