Example #1
0
/**
 * @author Rafal 'Vogel' Malinowski
 * @short Stored chat data to storage.
 *
 * Stores all chat data to storage. If details class is loaded it is stored too.
 */
void ChatShared::store()
{
	ensureLoaded();

	if (!isValidStorage())
		return;

	Shared::store();

	ConfigurationApi *configurationStorage = storage()->storage();
	QDomElement parent = storage()->point();

	storeValue("Account", ChatAccount->uuid().toString());
	storeValue("Display", Display);

	// import from alias to new name of chat type
	ChatType *chatType = m_chatTypeManager->chatType(Type);
	if (chatType)
		Type = chatType->name();

	storeValue("Type", Type);

	if (!Groups.isEmpty())
	{
		QDomElement groupsNode = configurationStorage->getNode(parent, "ChatGroups", ConfigurationApi::ModeCreate);
		foreach (const Group &group, Groups)
			configurationStorage->appendTextNode(groupsNode, "Group", group.uuid().toString());
	}
Example #2
0
    //-----------------------------------------------------------------------
	const TexturePtr& TextureUnitState::_getTexturePtr(size_t frame) const
	{
		if (mContentType == CONTENT_NAMED)
		{
			if (frame < mFrames.size() && !mTextureLoadFailed)
			{
				ensureLoaded(frame);
				return mFramePtrs[frame];
			}
			else
			{
				// Silent fail with empty texture for internal method
				static TexturePtr nullTexPtr;
				return nullTexPtr;
			}
		}
		else
		{
			// Manually bound texture, no name or loading
			assert(frame < mFramePtrs.size());
			return mFramePtrs[frame];

		}
		
	}
Example #3
0
bool AccountShared::shouldStore()
{
	ensureLoaded();

	return UuidStorableObject::shouldStore() &&
			!Id.isEmpty();
}
Example #4
0
int IdeDrvExecDLL               // EXECUTE THE DLL ONE TIME (LOAD IF REQ'D)
    ( IDEDRV *inf               // - driver control information
    , char const *cmd_line )    // - command line
#ifdef STATIC_LINKAGE
// Execute DLL
//
// One mode (with static linkage):
//
//  (1) WATCOM IDE interface is used.
//
{
    int runcode;
    int retcode;

    retcode = ensureLoaded( inf, &runcode );
    if( retcode == IDEDRV_SUCCESS ) {
        IDEBool fatal = FALSE;
        initConsole();
        runcode = IDERunYourSelf( inf->ide_handle, cmd_line, &fatal );
        finiConsole();
        retcode = retcodeFromFatal( fatal, runcode, retcode );
    }
    stashCodes( inf, runcode, retcode );
    return( retcode );
}
Example #5
0
void ContactManager::addContact(Contact contact)
{
	if (contact.isNull())
		return;

	ensureLoaded();

	if (Contacts.contains(contact))
	{
		contact.setType(ContactData::TypeNormal);
		return;
	}


	emit contactAboutToBeAdded(contact);
	Contacts.append(contact);
	emit contactAdded(contact);

	connect(contact.data(), SIGNAL(updated()), this, SLOT(contactDataUpdated()));
	connect(contact.data(), SIGNAL(accountDataAboutToBeAdded(Account *)),
			this, SLOT(contactAccountDataAboutToBeAdded(Account *)));
	connect(contact.data(), SIGNAL(accountDataAdded(Account *)),
			this, SLOT(contactAccountDataAdded(Account *)));
	connect(contact.data(), SIGNAL(accountDataAboutToBeRemoved(Account *)),
			this, SLOT(contactAccountDataAboutToBeRemoved(Account *)));
	connect(contact.data(), SIGNAL(accountDataRemoved(Account *)),
			this, SLOT(contactAccountDataRemoved(Account *)));
	connect(contact.data(), SIGNAL(accountDataIdChanged(Account *, const QString &)),
			this, SLOT(contactAccountDataIdChanged(Account *, const QString &)));
}
Example #6
0
void TextureUnitState::load()
{
    for (uint32_t i = 0; i < mFrames.size(); ++i)
    {
        ensureLoaded(i);
    }
}
QStandardItem *PluginPath::createModelItem()
{
    ensureLoaded();
    // Create a list of plugin lib files with classes.
    // If there are failed ones, create a separate "Failed"
    // category at the end
    QStandardItem *pathItem = new QStandardItem(m_path.absolutePath());
    QStandardItem *failedCategory = 0;
    const PluginDataList::iterator end = m_plugins.end();
    for (PluginDataList::iterator it = m_plugins.begin(); it != end; ++it) {
        QStandardItem *pluginItem = new QStandardItem(QFileInfo(it->path).fileName());
        if (instance(*it)) {
            pluginItem->appendRow(new QStandardItem(QString::fromLatin1(it->instanceGuard->metaObject()->className())));
            pathItem->appendRow(pluginItem);
        } else {
            pluginItem->setToolTip(it->errorMessage);
            if (!failedCategory) {
                const QString failed = QCoreApplication::translate("PluginManager", "Failed Plugins");
                failedCategory = new QStandardItem(failed);
            }
            failedCategory->appendRow(pluginItem);
        }
    }
    if (failedCategory)
        pathItem->appendRow(failedCategory);
    return pathItem;
}
Example #8
0
void ContactManager::removeContact(Contact contact)
{
	kdebugf();
	if (contact.isNull())
		return;

	ensureLoaded();

	if (!Contacts.contains(contact))
		return;

	disconnect(contact.data(), SIGNAL(updated()), this, SLOT(contactDataUpdated()));
	disconnect(contact.data(), SIGNAL(accountDataAboutToBeAdded(Account *)),
			this, SLOT(contactAccountDataAboutToBeAdded(Account *)));
	disconnect(contact.data(), SIGNAL(accountDataAdded(Account *)),
			this, SLOT(contactAccountDataAdded(Account *)));
	disconnect(contact.data(), SIGNAL(accountDataAboutToBeRemoved(Account *)),
			this, SLOT(contactAccountDataAboutToBeRemoved(Account *)));
	disconnect(contact.data(), SIGNAL(accountDataRemoved(Account *)),
			this, SLOT(contactAccountDataRemoved(Account *)));
	disconnect(contact.data(), SIGNAL(accountDataIdChanged(Account *, const QString &)),
			this, SLOT(contactAccountDataIdChanged(Account *, const QString &)));

	emit contactAboutToBeRemoved(contact);
	if (ContactRemovePredicateObject::inquireAll(contact))
	{
		Contacts.removeAll(contact);
		contact.removeFromStorage();
	}
	emit contactRemoved(contact);
	contact.setType(ContactData::TypeAnonymous);

	kdebugf();
}
Example #9
0
std::string
Config::get(const std::string &key, const std::string &def)
{
    ensureLoaded();
    std::string actualDef = (parent == nullptr) ? def : parent->get(key, def);
    std::string val = props.get<std::string>(key, actualDef);
    return val.empty() ? std::move(actualDef) : std::move(val);
}
Example #10
0
void Theme::setCurrentBackgroundIndex(int index)
{
    ensureLoaded();

    if (index < 0 || index > m_backgrounds.size())
        return;
    m_backgroundIndex = index;
}
Example #11
0
void MonoIcon::fill(QPainter &p, const QRect &rect) const {
	ensureLoaded();
	if (_pixmap.isNull()) {
		p.fillRect(rect, _color);
	} else {
		p.drawPixmap(rect, _pixmap, QRect(0, 0, _pixmap.width(), _pixmap.height()));
	}
}
Example #12
0
QString ContactShared::display(bool useBuddyData)
{
    ensureLoaded();

    if (!useBuddyData || !OwnerBuddy || !(*OwnerBuddy) || OwnerBuddy->display().isEmpty())
        return Id;

    return OwnerBuddy->display();
}
Example #13
0
void ContactShared::protocolFactoryRegistered(ProtocolFactory *protocolFactory)
{
    ensureLoaded();

    if (!protocolFactory || !*ContactAccount || ContactAccount->protocolName() != protocolFactory->name())
        return;

    changeNotifier().notify();
}
Example #14
0
Contact ContactManager::byIndex(unsigned int index)
{
	if (index < 0 || index >= count())
		return Contact::null;

	ensureLoaded();

	return Contacts.at(index);
}
/**
 * @author Rafal 'Vogel' Malinowski
 * @short Stores ChatDetailsConference object to storage.
 *
 * Stores ChatDetailsConference object to the same storage assigned Chat object is
 * using. This stores set of contacts into 'Contacts' subnode.
 */
void ChatDetailsConference::store()
{
	if (!isValidStorage())
		return;

	ensureLoaded();

	ContactSetConfigurationHelper::saveToConfiguration(this, "Contacts", Contacts);
}
Example #16
0
void Theme::getBackgroundPreview(QPixmap *pixmap)
{
    ensureLoaded();
    QString fileName = AppearanceSettings::findFile("pics/themes/"
        + m_uniqueName + '/' + m_backgrounds.value(m_backgroundIndex) + ".png");

    QPixmap bg(fileName);
    *pixmap = bg;
}
Example #17
0
void AccountShared::setProtocolName(QString protocolName)
{
	ensureLoaded();

	ProtocolName = protocolName;
	useProtocolFactory(ProtocolsManager::instance()->byName(protocolName));

	dataUpdated();
}
Example #18
0
void StorableObject::ensureStored()
{
    ensureLoaded();

    if (shouldStore())
        store();
    else
        removeFromStorage();
}
Example #19
0
void ContactManager::store()
{
	if (!isValidStorage())
		return;

	ensureLoaded();

	foreach (Contact contact, Contacts)
		contact.store();
}
Example #20
0
void ContactShared::setPriority(int priority)
{
    ensureLoaded();
    if (Priority != priority)
    {
        Priority = priority;
        changeNotifier().notify();
        emit priorityUpdated();
    }
}
void PluginPath::getInstances(PluginManager::IPluginList *list)
{
    ensureLoaded();
    // Compile list of instances
    if (m_plugins.empty())
        return;
    const PluginDataList::iterator end = m_plugins.end();
    for (PluginDataList::iterator it = m_plugins.begin(); it != end; ++it)
        if (IPlugin *i = instance(*it))
            list->push_back(i);
}
Example #22
0
ContactList ContactManager::contacts(Account *account, bool includeAnonymous)
{
	ContactList result;

	foreach (Contact contact, Contacts)
		if (contact.accountData(account) && (includeAnonymous || !contact.isAnonymous()))
			result << contact;

	ensureLoaded();

	return result;
}
Example #23
0
void ContactShared::setId(const QString &id)
{
    ensureLoaded();

    if (Id == id)
        return;

    QString oldId = Id;
    Id = id;

    changeNotifier().notify();
}
Example #24
0
Contact AccountShared::accountContact()
{
	ensureLoaded();

	if (AccountContact.isNull())
	{
		AccountContact = ContactManager::instance()->byId(this, Id, ActionCreateAndAdd);
		ContactManager::instance()->addItem(AccountContact);
	}

	return AccountContact;
}
Example #25
0
void AccountShared::setId(const QString &id)
{
	ensureLoaded();

	if (Id == id)
		return;

	Id = id;
	AccountContact.setId(id);

	dataUpdated();
}
Example #26
0
void AccountShared::protocolUnregistered(ProtocolFactory* factory)
{
	ensureLoaded();

	if (!ProtocolHandler)
		return;

	if (factory != ProtocolHandler->protocolFactory())
		return;

	useProtocolFactory(0);
}
Example #27
0
void AccountShared::protocolRegistered(ProtocolFactory *factory)
{
	ensureLoaded();

	if (factory->name() != ProtocolName)
		return;

	if (ProtocolHandler && (ProtocolHandler->protocolFactory() == factory))
		return;

	useProtocolFactory(factory);
}
Example #28
0
bool ContactShared::isAnonymous()
{
    ensureLoaded();

    if (!OwnerBuddy)
        return true;

    if (!(*OwnerBuddy))
        return true;

    return OwnerBuddy->isAnonymous();
}
Example #29
0
void Theme::getSoftMenuBarPreview(QPixmap *pixmap, QSoftMenuBar::LabelType labelType)
{
    ensureLoaded();
    if (!m_softMenuBarPreview) {
        m_softMenuBarPreview = new ThemeItemPreview("contextbar",
                AppearanceSettings::findFile(QLatin1String("etc/themes/") + m_uniqueName + "/context.xml"));
        m_softMenuBarPreview->setPalette(m_palette);
    }

    QDesktopWidget *dw = QApplication::desktop();
    QSize screenSize = dw->screenGeometry(dw->primaryScreen()).size();
    m_softMenuBarPreview->getPixmap(pixmap, screenSize.width(), int(screenSize.height() * 0.15), labelType);
}
Example #30
0
void Theme::getTitlePreview(QPixmap *pixmap)
{
    ensureLoaded();
    if (!m_titlePreview) {
        m_titlePreview = new ThemeItemPreview("title",
                AppearanceSettings::findFile(QLatin1String("etc/themes/") + m_uniqueName + "/title.xml"));
        m_titlePreview->setPalette(m_palette);
    }

    QDesktopWidget *dw = QApplication::desktop();
    QSize screenSize = dw->screenGeometry(dw->primaryScreen()).size();
    m_titlePreview->getPixmap(pixmap, screenSize.width(), int(screenSize.height() * 0.09));
}