void GxsChannelPostItem::setup()
{
	/* Invoke the Qt Designer generated object setup routine */
	ui = new Ui::GxsChannelPostItem;
	ui->setupUi(this);

	setAttribute(Qt::WA_DeleteOnClose, true);

	mInFill = false;
	mCloseOnRead = false;

	/* clear ui */
	ui->titleLabel->setText(tr("Loading"));
	ui->subjectLabel->clear();
	ui->datetimelabel->clear();
	ui->filelabel->clear();
	ui->newCommentLabel->hide();
	ui->commLabel->hide();

	/* general ones */
	connect(ui->expandButton, SIGNAL(clicked()), this, SLOT(toggle()));
	connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(removeItem()));

	/* specific */
	connect(ui->readAndClearButton, SIGNAL(clicked()), this, SLOT(readAndClearItem()));
	connect(ui->unsubscribeButton, SIGNAL(clicked()), this, SLOT(unsubscribeChannel()));

	connect(ui->downloadButton, SIGNAL(clicked()), this, SLOT(download()));
	// HACK FOR NOW.
	connect(ui->commentButton, SIGNAL(clicked()), this, SLOT(loadComments()));

	connect(ui->playButton, SIGNAL(clicked()), this, SLOT(play(void)));
	connect(ui->copyLinkButton, SIGNAL(clicked()), this, SLOT(copyMessageLink()));

	connect(ui->readButton, SIGNAL(toggled(bool)), this, SLOT(readToggled(bool)));

    // hide voting buttons, backend is not implemented yet
    ui->voteUpButton->hide();
    ui->voteDownButton->hide();
	//connect(ui-> voteUpButton, SIGNAL(clicked()), this, SLOT(makeUpVote()));
	//connect(ui->voteDownButton, SIGNAL(clicked()), this, SLOT(makeDownVote()));

	ui->scoreLabel->hide();

	ui->downloadButton->hide();
	ui->playButton->hide();
	ui->warn_image_label->hide();
	ui->warning_label->hide();

	ui->titleLabel->setMinimumWidth(100);
	ui->subjectLabel->setMinimumWidth(100);
	ui->warning_label->setMinimumWidth(100);

	ui->mainFrame->setProperty("state", "");
	QPalette palette = ui->mainFrame->palette();
	palette.setColor(ui->mainFrame->backgroundRole(), COLOR_NORMAL);
	ui->mainFrame->setPalette(palette);

	ui->expandFrame->hide();
}
Exemple #2
0
void PostedItem::setup()
{
	/* Invoke the Qt Designer generated object setup routine */
	ui = new Ui::PostedItem;
	ui->setupUi(this);

	setAttribute(Qt::WA_DeleteOnClose, true);

	mInFill = false;

	/* clear ui */
	ui->titleLabel->setText(tr("Loading"));
	ui->dateLabel->clear();
	ui->fromLabel->clear();
	ui->siteLabel->clear();
	ui->newCommentLabel->hide();
	ui->commLabel->hide();

	/* general ones */
	connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(removeItem()));

	/* specific */
	connect(ui->readAndClearButton, SIGNAL(clicked()), this, SLOT(readAndClearItem()));

	connect(ui->commentButton, SIGNAL( clicked()), this, SLOT(loadComments()));
	connect(ui->voteUpButton, SIGNAL(clicked()), this, SLOT(makeUpVote()));
	connect(ui->voteDownButton, SIGNAL(clicked()), this, SLOT( makeDownVote()));

	connect(ui->readButton, SIGNAL(toggled(bool)), this, SLOT(readToggled(bool)));

	ui->clearButton->hide();
	ui->readAndClearButton->hide();

	ui->frame_notes->hide();
}
/** Constructor */
FeedReaderFeedItem::FeedReaderFeedItem(RsFeedReader *feedReader, FeedReaderNotify *notify, FeedHolder *parent, const FeedInfo &feedInfo, const FeedMsgInfo &msgInfo)
    : QWidget(NULL), mFeedReader(feedReader), mNotify(notify), mParent(parent), ui(new Ui::FeedReaderFeedItem)
{
    /* Invoke the Qt Designer generated object setup routine */
    ui->setupUi(this);

    setAttribute(Qt::WA_DeleteOnClose, true);

    connect(ui->expandButton, SIGNAL(clicked(void)), this, SLOT(toggle(void)));
    connect(ui->clearButton, SIGNAL(clicked(void)), this, SLOT(removeItem(void)));
    connect(ui->readAndClearButton, SIGNAL(clicked()), this, SLOT(readAndClearItem()));
    connect(ui->linkButton, SIGNAL(clicked()), this, SLOT(openLink()));

    connect(mNotify, SIGNAL(msgChanged(QString,QString,int)), this, SLOT(msgChanged(QString,QString,int)), Qt::QueuedConnection);

    ui->expandFrame->hide();

    mFeedId = feedInfo.feedId;
    mMsgId = msgInfo.msgId;

    if (feedInfo.icon.empty()) {
        ui->feedIconLabel->hide();
    } else {
        /* use icon from feed */
        QPixmap pixmap;
        if (pixmap.loadFromData(QByteArray::fromBase64(feedInfo.icon.c_str()))) {
            ui->feedIconLabel->setPixmap(pixmap.scaled(16, 16, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
        } else {
            ui->feedIconLabel->hide();
        }
    }

    ui->titleLabel->setText(QString::fromUtf8(feedInfo.name.c_str()));
    ui->msgTitleLabel->setText(QString::fromUtf8(msgInfo.title.c_str()));
    ui->descriptionLabel->setText(QString::fromUtf8((msgInfo.descriptionTransformed.empty() ? msgInfo.description : msgInfo.descriptionTransformed).c_str()));

    ui->dateTimeLabel->setText(DateTime::formatLongDateTime(msgInfo.pubDate));

    /* build menu for link button */
    mLink = QString::fromUtf8(msgInfo.link.c_str());
    if (mLink.isEmpty()) {
        ui->linkButton->setEnabled(false);
    } else {
        QMenu *menu = new QMenu(this);
        QAction *action = menu->addAction(tr("Open link in browser"), this, SLOT(openLink()));
        menu->addAction(tr("Copy link to clipboard"), this, SLOT(copyLink()));

        QFont font = action->font();
        font.setBold(true);
        action->setFont(font);

        ui->linkButton->setMenu(menu);
    }
}
void GxsChannelPostItem::setup()
{
	/* Invoke the Qt Designer generated object setup routine */
	setupUi(this);

	setAttribute ( Qt::WA_DeleteOnClose, true );

	m_inUpdateItemStatic = false;

	/* general ones */
	connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
	connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );

	/* specific */
	connect(readAndClearButton, SIGNAL(clicked()), this, SLOT(readAndClearItem()));
	connect( unsubscribeButton, SIGNAL( clicked( void ) ), this, SLOT( unsubscribeChannel ( void ) ) );

	connect( downloadButton, SIGNAL( clicked( void ) ), this, SLOT( download ( void ) ) );
	// HACK FOR NOW.
	connect( commentButton, SIGNAL( clicked( void ) ), this, SLOT( loadComments ( void ) ) );

	connect( playButton, SIGNAL( clicked( void ) ), this, SLOT( play ( void ) ) );
	connect( copyLinkButton, SIGNAL( clicked( void ) ), this, SLOT( copyLink ( void ) ) );

	connect( readButton, SIGNAL( toggled(bool) ), this, SLOT( readToggled(bool) ) );
	connect( NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int)), Qt::QueuedConnection);

	downloadButton->hide();
	playButton->hide();
	warn_image_label->hide();
	warning_label->hide();

	titleLabel->setMinimumWidth(100);
	subjectLabel->setMinimumWidth(100);
	warning_label->setMinimumWidth(100);

	frame->setProperty("state", "");
	QPalette palette = frame->palette();
	palette.setColor(frame->backgroundRole(), COLOR_NORMAL);
	frame->setPalette(palette);

	expandFrame->hide();
}