コード例 #1
0
void EditChanDetails::loadChannel()
{

    if (!rsChannels)
    {
            return;
    }

    ChannelInfo ci;
    rsChannels->getChannelInfo(mChannelId, ci);

    // Set Channel Name
    ui.nameline->setText(QString::fromStdWString(ci.channelName));

    // Set Channel Description
    ui.DescriptiontextEdit->setText(QString::fromStdWString(ci.channelDesc));
    
	// Set Channel Logo
    if(ci.pngImageLen != 0)
    {
        QPixmap chanImage;
        chanImage.loadFromData(ci.pngChanImage, ci.pngImageLen, "PNG");
        ui.ChannelLogoButton->setIcon(QIcon(chanImage));
    }
    else
    {
        QPixmap defaulImage(CHAN_DEFAULT_IMAGE);
        ui.ChannelLogoButton->setIcon(QIcon(defaulImage));
    }

}
コード例 #2
0
void ChanNewItem::updateItemStatic()
{
	if (!rsChannels)
		return;


	/* fill in */
#ifdef DEBUG_ITEM
	std::cerr << "ChanNewItem::updateItemStatic()";
	std::cerr << std::endl;
#endif

	ChannelInfo ci;
	if (rsChannels->getChannelInfo(mChanId, ci))
	{
		RetroShareLink link;
		link.createChannel(ci.channelId, "");
		nameLabel->setText(link.toHtml());

		descLabel->setText(QString::fromStdWString(ci.channelDesc));
		
		if(ci.pngImageLen != 0){

    QPixmap chanImage;
    chanImage.loadFromData(ci.pngChanImage, ci.pngImageLen, "PNG");
    logo_label->setPixmap(QPixmap(chanImage));
    }else{
    QPixmap defaulImage(CHAN_DEFAULT_IMAGE);
    logo_label->setPixmap(QPixmap(defaulImage));
    }

		if (ci.channelFlags & RS_DISTRIB_SUBSCRIBED)
		{
			subscribeButton->setEnabled(false);
			//postButton->setEnabled(true);
		}
		else
		{
			subscribeButton->setEnabled(true);
			//postButton->setEnabled(false);
		}
			

		/* should also check the other flags */
	}
	else
	{
		nameLabel->setText(tr("Unknown Channel"));
		titleLabel->setText("Channel ???");
		descLabel->setText("");
	}

	if (mIsNew)
	{
		titleLabel->setText(tr("New Channel"));
	}
	else
	{
		titleLabel->setText(tr("Updated Channel"));
	}

	if (mIsHome)
	{
		/* disable buttons */
		clearButton->setEnabled(false);
	}
}