当前位置: 首页>>代码示例>>C++>>正文


C++ sim::PropertyHubPtr类代码示例

本文整理汇总了C++中sim::PropertyHubPtr的典型用法代码示例。如果您正苦于以下问题:C++ PropertyHubPtr类的具体用法?C++ PropertyHubPtr怎么用?C++ PropertyHubPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PropertyHubPtr类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: QWidget

MessageConfig::MessageConfig(QWidget *parent, SIM::PropertyHubPtr _data)
  : QWidget(parent)
{
    setupUi(this);
    m_file = NULL;
    for (QObject *p = parent; p != NULL; p = p->parent()){
        QTabWidget *tab = qobject_cast<QTabWidget*>(p);
        if(!tab)
            continue;
        m_file = new FileConfig(tab, _data);
        tab->addTab(m_file, i18n("File"));
        tab->adjustSize();
        break;
    }

	SIM::PropertyHubPtr data = _data;
    chkOnline->setChecked(data->value("OpenOnOnline").toBool());
    chkStatus->setChecked(data->value("LogStatus").toBool());
    switch (data->value("OpenNewMessage").toUInt()){
    case NEW_MSG_NOOPEN:
        btnNoOpen->setChecked(true);
        break;
    case NEW_MSG_MINIMIZE:
        btnMinimize->setChecked(true);
        break;
    case NEW_MSG_RAISE:
        btnRaise->setChecked(true);
        break;
    }
}
开发者ID:BackupTheBerlios,项目名称:sim-im,代码行数:30,代码来源:msgcfg.cpp

示例2: messageSound

QString SoundPlugin::messageSound(unsigned type, unsigned long contact_id)
{
    SIM::PropertyHubPtr data;
    Contact *c = getContacts()->contact(contact_id);
    if(!contact_id)
        data = getContacts()->userdata();
    else if(c)
    {
        data = c->getUserData()->root();
        if(!data->value("sound/override").toBool())
        {
            Group* g = getContacts()->group(c->getGroup(), false);
            if(g->userdata()->value("sound/override").toBool())
                data = g->userdata();
            else
                data = getContacts()->userdata();
        }
    }
    QString sound;
    if(data)
        sound = data->value("sound/Receive" + QString::number(type)).toString();
    if(sound == "(nosound)")
        return QString();
    return sound;
}
开发者ID:BackupTheBerlios,项目名称:sim-im,代码行数:25,代码来源:sound.cpp

示例3: it

ActionConfig::ActionConfig(QWidget *parent, SIM::PropertyHubPtr data, ActionPlugin *plugin)
  : QWidget(parent)
  , m_menu(NULL)
  , m_data(data)
  , m_plugin(plugin)
{
    setupUi(this);
    setButtonsPict(this);

    connect(btnHelp, SIGNAL(clicked()), this, SLOT(help()));

    int row = 0;
    addRow(lstEvent, row, Icon("SIM"), i18n("Contact online"), CONTACT_ONLINE, data->value("OnLine").toString() );

    row++;
    addRow(lstEvent, row, Icon("SIM"), i18n("Status changed"), CONTACT_STATUS, data->value("Status").toString() );

    CommandDef *cmd;
    CorePlugin *core = GET_CorePlugin();
    CommandsMapIterator it(core->messageTypes);
    while ((cmd = ++it) != NULL){
        MessageDef *def = (MessageDef*)(cmd->param);
        if ((def == NULL) || (cmd->icon.isEmpty()) ||
                (def->flags & (MESSAGE_HIDDEN | MESSAGE_SENDONLY | MESSAGE_CHILD)))
            continue;
        if ((def->singular == NULL) || (def->plural == NULL) ||
                (*def->singular == 0) || (*def->plural == 0))
            continue;
        QString type = i18n(def->singular, def->plural, 1);
        int pos = type.indexOf("1 ");
        if (pos == 0){
            type = type.mid(2);
        }else if (pos > 0){
            type = type.left(pos);
        }
        type = type.left(1).toUpper() + type.mid(1);

        row++;
        addRow(lstEvent, row, Icon(cmd->icon), type, cmd->id, data->stringMapValue("Message", cmd->id));
    }
    EventTmplHelpList e;
    e.process();
    LineEditDelegate *dg = new LineEditDelegate(1, lstEvent);
    dg->setHelpList(e.helpList());
    lstEvent->setItemDelegate(dg);
    lstEvent->resizeColumnToContents(0);
    lstEvent->sortByColumn(0, Qt::AscendingOrder);

    for (QObject *p = parent; p != NULL; p = p->parent()){
        QTabWidget *tab = qobject_cast<QTabWidget*>(p);
        if (!tab)
            continue;
        m_menu = new MenuConfig(tab, data);
        tab->addTab(m_menu, i18n("Menu"));
        tab->adjustSize();
        break;
    }
}
开发者ID:BackupTheBerlios,项目名称:sim-im,代码行数:58,代码来源:actioncfg.cpp

示例4: userDataManipulation

	void Test::userDataManipulation()
	{
		SIM::UserDataPtr data = SIM::UserData::create();
		SIM::PropertyHubPtr hub = data->getUserData("nonexistant");
		QVERIFY(hub.isNull());
		
		hub = data->createUserData("alpha");
		QVERIFY(!hub.isNull());
		hub->setValue("foo", 12);
		QCOMPARE(hub->value("foo").toInt(), 12);

		SIM::PropertyHubPtr anotherhub = data->getUserData("alpha");
		QCOMPARE(anotherhub->value("foo").toInt(), 12);

		hub.clear();
		anotherhub.clear();
		data->destroyUserData("alpha");
		hub = data->getUserData("alpha");
		QVERIFY(hub.isNull());
	}
开发者ID:BackupTheBerlios,项目名称:sim-im,代码行数:20,代码来源:testuserdata.cpp

示例5: QWidget

FileConfig::FileConfig(QWidget *parent, SIM::PropertyHubPtr data)
  : QWidget(parent)
{
    setupUi(this);
    edtPath->setDirMode(true);
    edtPath->setText(user_file(data->value("IncomingPath").toString()));
    switch (data->value("AcceptMode").toUInt())
    {
    case 0:
        btnDialog->setChecked(true);
        break;
    case 1:
        btnAccept->setChecked(true);
        chkOverwrite->setEnabled(true);
        break;
    case 2:
        btnDecline->setChecked(true);
        edtDecline->setEnabled(true);
        break;
    }
    chkOverwrite->setChecked(data->value("OverwriteFiles").toBool());
    edtDecline->setPlainText(data->value("DeclineMessage").toString());
}
开发者ID:BackupTheBerlios,项目名称:sim-im,代码行数:23,代码来源:filecfg.cpp

示例6: apply

void FileConfig::apply(SIM::PropertyHubPtr data)
{
    QString def = edtPath->text().isEmpty() ? "Incoming Files" : edtPath->text();
    data->setValue("IncomingPath", def);
    edtPath->setText(user_file(data->value("IncomingPath").toString()));
    data->setValue("AcceptMode", 0);
    if (btnAccept->isChecked())
    {
        data->setValue("AcceptMode", 1);
        data->setValue("OverwriteFiles", chkOverwrite->isChecked());
    }
    if (btnDecline->isChecked())
    {
        data->setValue("AcceptMode", 2);
        data->setValue("DeclineMessage", edtDecline->toPlainText());
    }
}
开发者ID:BackupTheBerlios,项目名称:sim-im,代码行数:17,代码来源:filecfg.cpp

示例7: apply

void MessageConfig::apply(SIM::PropertyHubPtr _data)
{
    if (m_file)
        m_file->apply(_data);

	SIM::PropertyHubPtr data = _data;
    data->setValue("OpenOnOnline", chkOnline->isChecked());
    data->setValue("LogStatus", chkStatus->isChecked());
    data->setValue("OpenNewMessage", NEW_MSG_NOOPEN);
    if (btnMinimize->isChecked())
        data->setValue("OpenNewMessage", NEW_MSG_MINIMIZE);
    if (btnRaise->isChecked())
        data->setValue("OpenNewMessage", NEW_MSG_RAISE);
}
开发者ID:BackupTheBerlios,项目名称:sim-im,代码行数:14,代码来源:msgcfg.cpp

示例8: apply

void OSDConfig::apply(SIM::PropertyHubPtr data)
{
    data->setValue("EnableMessage", chkMessage->isChecked());
    data->setValue("EnableMessageShowContent", chkMessageContent->isChecked());
    data->setValue("EnableCapsLockFlash", chkCapsLockFlash->isChecked());
    data->setValue("EnableAlert", chkStatus->isChecked());
    data->setValue("EnableAlertOnline", chkStatusOnline->isChecked());
    data->setValue("EnableAlertAway", chkStatusAway->isChecked());
    data->setValue("EnableAlertNA", chkStatusNA->isChecked());
    data->setValue("EnableAlertDND", chkStatusDND->isChecked());
    data->setValue("EnableAlertOccupied", chkStatusOccupied->isChecked());
    data->setValue("EnableAlertFFC", chkStatusFFC->isChecked());
    data->setValue("EnableAlertOffline", chkStatusOffline->isChecked());
    data->setValue("EnableTyping", chkTyping->isChecked());
    data->setValue("ContentLines", (uint)edtLines->text().toULong());
    m_iface->apply(data);
}
开发者ID:BackupTheBerlios,项目名称:sim-im,代码行数:17,代码来源:osdconfig.cpp

示例9: processEvent

bool ForwardPlugin::processEvent(Event *e)
{
    if (e->type() == eEventMessageReceived){
        EventMessage *em = static_cast<EventMessage*>(e);
        Message *msg = em->msg();
        if (msg->type() == MessageStatus)
            return false;
        QString text = msg->getPlainText();
        if (text.isEmpty())
            return false;
        if (msg->type() == MessageSMS){
            SMSMessage *sms = static_cast<SMSMessage*>(msg);
            QString phone = sms->getPhone();
            bool bMyPhone;
            SIM::PropertyHubPtr data = getContacts()->getUserData("forward");
            bMyPhone = ContactList::cmpPhone(phone, data->value("Phone").toString());
            if (!bMyPhone){
                Group *grp;
                ContactList::GroupIterator it;
                while ((grp = ++it) != NULL){
                    data = grp->getUserData("forward", false);
                    if (data && !data->value("Phone").toString().isEmpty()){
                        bMyPhone = ContactList::cmpPhone(phone, data->value("Phone").toString());
                        break;
                    }
                }
            }
            if (!bMyPhone){
                Contact *contact;
                ContactList::ContactIterator it;
                while ((contact = ++it) != NULL){
                    data = contact->getUserData("forward", false);
                    if (data && !data->value("Phone").toString().isEmpty())
                    {
                        bMyPhone = ContactList::cmpPhone(phone, data->value("Phone").toString());
                        break;
                    }
                }
            }
            if (bMyPhone){
                int n = text.indexOf(": ");
                if (n > 0){
                    QString name = text.left(n);
                    QString msg_text = text.mid(n + 2);
                    Contact *contact;
                    ContactList::ContactIterator it;
                    while ((contact = ++it) != NULL){
                        if (contact->getName() == name){
                            Message *msg = new Message(MessageGeneric);
                            msg->setContact(contact->id());
                            msg->setText(msg_text);
                            void *data;
                            ClientDataIterator it(contact->clientData);
                            while ((data = ++it) != NULL){
                                if (it.client()->send(msg, data))
                                    break;
                            }
                            if (data == NULL)
                                delete msg;
                            return true;
                        }
                    }
                }
            }
        }
        Contact *contact = getContacts()->contact(msg->contact());
        if (contact == NULL)
            return false;
        SIM::PropertyHubPtr data = contact->getUserData("forward");
        if (!data || data->value("Key").toString().isEmpty())
            return false;
        CorePlugin *core = GET_CorePlugin();
        unsigned status = core->getManualStatus();
        if ((status == STATUS_AWAY) || (status == STATUS_NA)){
            text = contact->getName() + ": " + text;
            unsigned flags = MESSAGE_NOHISTORY;
            if (data->value("Send1st").toBool())
                flags |= MESSAGE_1ST_PART;
            if (data->value("Translit").toBool())
                flags |= MESSAGE_TRANSLIT;
            SMSMessage *m = new SMSMessage;
            m->setPhone(data->value("Phone").toString());
            m->setText(text);
            m->setFlags(flags);
            unsigned i;
            for (i = 0; i < getContacts()->nClients(); i++){
                Client *client = getContacts()->getClient(i);
                if (client->send(m, NULL))
                    break;
            }
            if (i >= getContacts()->nClients())
                delete m;
        }
    }
    return false;
}
开发者ID:BackupTheBerlios,项目名称:sim-im,代码行数:96,代码来源:forward.cpp

示例10: QWidget

OSDConfig::OSDConfig(QWidget *parent, SIM::PropertyHubPtr data, OSDPlugin *plugin)
  : QWidget(parent)
  , m_plugin(plugin)
{
    setupUi(this);
    chkMessage->setChecked(data->value("EnableMessage").toBool());
    chkMessageContent->setChecked(data->value("EnableMessageShowContent").toBool());
    chkCapsLockFlash->setChecked(data->value("EnableCapsLockFlash").toBool());
    chkStatus->setChecked(data->value("EnableAlert").toBool());
    chkStatusOnline->setChecked(data->value("EnableAlertOnline").toBool());
    chkStatusAway->setChecked(data->value("EnableAlertAway").toBool());
    chkStatusNA->setChecked(data->value("EnableAlertNA").toBool());
    chkStatusDND->setChecked(data->value("EnableAlertDND").toBool());
    chkStatusOccupied->setChecked(data->value("EnableAlertOccupied").toBool());
    chkStatusFFC->setChecked(data->value("EnableAlertFFC").toBool());
    chkStatusOffline->setChecked(data->value("EnableAlertOffline").toBool());
    chkTyping->setChecked(data->value("EnableTyping").toBool());
    for (QObject *p = parent; p != NULL; p = p->parent()){
        QTabWidget *tab = qobject_cast<QTabWidget*>(p);
        if (!tab)
            continue;
		SIM::PropertyHubPtr data = getContacts()->getUserData("OSD");
        m_iface = new OSDIface(tab, data, plugin);
        tab->addTab(m_iface, i18n("&Interface"));
        break;
    }
    edtLines->setValue(data->value("ContentLines").toUInt());
    connect(chkStatus, SIGNAL(toggled(bool)), this, SLOT(statusToggled(bool)));
    connect(chkMessage, SIGNAL(toggled(bool)), this, SLOT(showMessageToggled(bool)));
    connect(chkMessageContent, SIGNAL(toggled(bool)), this, SLOT(contentToggled(bool)));
    showMessageToggled(chkMessage->isChecked());
    contentToggled(chkMessageContent->isChecked());
    statusToggled(data->value("EnableAlert").toBool());
}
开发者ID:BackupTheBerlios,项目名称:sim-im,代码行数:34,代码来源:osdconfig.cpp

示例11: processEvent

bool MsgEdit::processEvent(Event *e)
{
    switch (e->type()) {
    case eEventContact: {
        EventContact *ec = static_cast<EventContact*>(e);
        if (ec->contact()->id() != m_userWnd->m_id)
            break;
        adjustType();
        break;
    }
    case eEventClientChanged: {
        adjustType();
        break;
    }
    case eEventMessageReceived: {
        EventMessage *em = static_cast<EventMessage*>(e);
        Message *msg = em->msg();
        if (msg->getFlags() & MESSAGE_NOVIEW)
            return false;
        if ((msg->contact() == m_userWnd->id()) && (msg->type() != MessageStatus)){
            if (CorePlugin::instance()->getContainerMode()){
                bool bSetFocus = false;
                if (topLevelWidget() && topLevelWidget()->inherits("Container")){
                    Container *container = static_cast<Container*>(topLevelWidget());
                    if (container->wnd() == m_userWnd)
                        bSetFocus = true;
                }
                setMessage(msg, bSetFocus);
            }else{
                if (m_edit->isReadOnly())
                    QTimer::singleShot(0, this, SLOT(setupNext()));
            }
        }
        break;
    }
    case eEventRealSendMessage: {
        EventRealSendMessage *ersm = static_cast<EventRealSendMessage*>(e);
        if (ersm->edit() == this){
            sendMessage(ersm->msg());
            return true;
        }
        break;
    }
    case eEventCheckCommandState: {
        EventCheckCommandState *ecs = static_cast<EventCheckCommandState*>(e);
        CommandDef *cmd = ecs->cmd();
        if ((cmd->param == (TextEdit*)m_edit) && (cmd->id == CmdTranslit)){
            Contact *contact = getContacts()->contact(m_userWnd->id());
            if (contact){
				SIM::PropertyHubPtr data = contact->getUserData("translit");
                if(!data.isNull()) {
                    cmd->flags &= ~COMMAND_CHECKED;
                    if (data->value("Translit").toBool())
                        cmd->flags |= COMMAND_CHECKED;
                    // FIXME: return true; missing here?
                }
            }
            return false;
        }
        if ((cmd->menu_id != MenuTextEdit) || (cmd->param != (TextEdit*)m_edit))
            return false;
        cmd->flags &= ~(COMMAND_CHECKED | COMMAND_DISABLED);
        switch (cmd->id){
        case CmdUndo:
            if (m_edit->isReadOnly())
                return false;
            if (!m_edit->document()->isUndoAvailable())
                cmd->flags |= COMMAND_DISABLED;
            return true;
        case CmdRedo:
            if (m_edit->isReadOnly())
                return false;
            if (!m_edit->document()->isRedoAvailable())
                cmd->flags |= COMMAND_DISABLED;
            return true;
        case CmdCut:
            if (m_edit->isReadOnly())
                return false;
        case CmdCopy:
            if (m_edit->textCursor().selectedText().isEmpty())
                cmd->flags |= COMMAND_DISABLED;
            return true;
        case CmdPaste:
            if (m_edit->isReadOnly())
                return false;
            if (QApplication::clipboard()->text().isEmpty())
                cmd->flags |= COMMAND_DISABLED;
            return true;
        case CmdClear:
            if (m_edit->isReadOnly())
                return false;
        case CmdSelectAll:
            if (m_edit->toPlainText().isEmpty())
                cmd->flags |= COMMAND_DISABLED;
            return true;
        }
        break;
    }
    case eEventCommandExec: {
        EventCommandExec *ece = static_cast<EventCommandExec*>(e);
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:sim-im-svn,代码行数:101,代码来源:msgedit.cpp

示例12: sendMessage

bool MsgEdit::sendMessage(Message *msg)
{
    if (m_retry.msg){
        delete m_retry.msg;
        m_retry.msg = NULL;
    }
    if (m_msg){
        delete msg;
        if (EventMessageCancel(m_msg).process())
            m_msg = NULL;
        stopSend(false);
        return false;
    }
    bool bClose = true;
    if (CorePlugin::instance()->getContainerMode()){
        bClose = false;
        Command cmd;
        cmd->id		= CmdSendClose;
        cmd->param	= this;
        EventCommandWidget eWidget(cmd);
        eWidget.process();
        QToolButton *btnClose = qobject_cast<QToolButton*>(eWidget.widget());
        if (btnClose)
            bClose = btnClose->isChecked();
    }
    CorePlugin::instance()->setValue("CloseSend", bClose);

    Contact *contact = getContacts()->contact(m_userWnd->id());
    if (contact){
		SIM::PropertyHubPtr data = contact->getUserData("translit");
        if (!data.isNull() && data->value("Translit").toBool())
            msg->setFlags(msg->getFlags() | MESSAGE_TRANSLIT);
    }

    msg->setFlags(msg->getFlags() | m_flags);
    m_flags = 0;

    if (m_userWnd->m_list){
        if( !m_userWnd->m_list->isHaveSelected() )
            return false;
        multiply = m_userWnd->m_list->selected();
        msg->setContact( multiply.first() );
        multiply.pop_front();
        msg->setClient(NULL);
        if( multiply.count() > 0 )
            msg->setFlags(msg->getFlags() | MESSAGE_MULTIPLY);
    }else if (!m_resource.isEmpty()){
        void *data = NULL;
        Client *c = client(data, true, false, msg->contact(), true);
        if (c){
            QString resources = c->resources(data);
            while (!resources.isEmpty()){
                QString res = getToken(resources, ';');
                getToken(res, ',');
                if (m_resource == res){
                    msg->setResource(m_resource);
                    break;
                }
            }
        }
    }

    editLostFocus();
    Command cmd;
    cmd->id		= CmdSend;
    cmd->text	= I18N_NOOP("Cancel");
    cmd->icon	= "cancel";
    cmd->flags	= BTN_PICT;
    cmd->param	= this;
    EventCommandChange(cmd).process();
    m_msg = msg;
    return send();
}
开发者ID:BackupTheBerlios,项目名称:sim-im-svn,代码行数:73,代码来源:msgedit.cpp


注:本文中的sim::PropertyHubPtr类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。