mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-26 16:09:35 -05:00
Merge pull request #2069 from csoler/v0.6-ChannelsGUI
Fixes for channels GUI
This commit is contained in:
commit
fa627e6347
@ -30,7 +30,10 @@ RSTreeView::RSTreeView(QWidget *parent) : QTreeView(parent)
|
|||||||
void RSTreeView::wheelEvent(QWheelEvent *e)
|
void RSTreeView::wheelEvent(QWheelEvent *e)
|
||||||
{
|
{
|
||||||
if(e->modifiers() == Qt::ControlModifier)
|
if(e->modifiers() == Qt::ControlModifier)
|
||||||
|
{
|
||||||
emit zoomRequested(e->delta() > 0);
|
emit zoomRequested(e->delta() > 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
QTreeView::wheelEvent(e);
|
QTreeView::wheelEvent(e);
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ void GxsChannelPostItem::setup()
|
|||||||
// memory.
|
// memory.
|
||||||
|
|
||||||
ui->logoLabel->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":/images/thumb-default-video.png"));
|
ui->logoLabel->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":/images/thumb-default-video.png"));
|
||||||
ui->warn_image_label->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":/images/status_unknown.png"));
|
//ui->warn_image_label->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":/images/status_unknown.png"));
|
||||||
ui->readButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/images/message-state-unread.png"));
|
ui->readButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/images/message-state-unread.png"));
|
||||||
ui->voteUpButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/images/vote_up.png"));
|
ui->voteUpButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/images/vote_up.png"));
|
||||||
ui->voteDownButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/images/vote_down.png"));
|
ui->voteDownButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/images/vote_down.png"));
|
||||||
@ -211,12 +211,12 @@ void GxsChannelPostItem::setup()
|
|||||||
|
|
||||||
ui->downloadButton->hide();
|
ui->downloadButton->hide();
|
||||||
ui->playButton->hide();
|
ui->playButton->hide();
|
||||||
ui->warn_image_label->hide();
|
//ui->warn_image_label->hide();
|
||||||
ui->warning_label->hide();
|
//ui->warning_label->hide();
|
||||||
|
|
||||||
ui->titleLabel->setMinimumWidth(100);
|
ui->titleLabel->setMinimumWidth(100);
|
||||||
//ui->subjectLabel->setMinimumWidth(100);
|
//ui->subjectLabel->setMinimumWidth(100);
|
||||||
ui->warning_label->setMinimumWidth(100);
|
//ui->warning_label->setMinimumWidth(100);
|
||||||
|
|
||||||
ui->mainFrame->setProperty("new", false);
|
ui->mainFrame->setProperty("new", false);
|
||||||
ui->mainFrame->style()->unpolish(ui->mainFrame);
|
ui->mainFrame->style()->unpolish(ui->mainFrame);
|
||||||
@ -466,7 +466,7 @@ void GxsChannelPostItem::fill()
|
|||||||
ui->titleLabel->setText(title);
|
ui->titleLabel->setText(title);
|
||||||
|
|
||||||
RetroShareLink msgLink = RetroShareLink::createGxsMessageLink(RetroShareLink::TYPE_CHANNEL, mPost.mMeta.mGroupId, mPost.mMeta.mMsgId, messageName());
|
RetroShareLink msgLink = RetroShareLink::createGxsMessageLink(RetroShareLink::TYPE_CHANNEL, mPost.mMeta.mGroupId, mPost.mMeta.mMsgId, messageName());
|
||||||
//ui->subjectLabel->setText(msgLink.toHtml());
|
ui->subjectLabel->setText(msgLink.toHtml());
|
||||||
|
|
||||||
if (IS_GROUP_SUBSCRIBED(mGroupMeta.mSubscribeFlags) || IS_GROUP_ADMIN(mGroupMeta.mSubscribeFlags))
|
if (IS_GROUP_SUBSCRIBED(mGroupMeta.mSubscribeFlags) || IS_GROUP_ADMIN(mGroupMeta.mSubscribeFlags))
|
||||||
{
|
{
|
||||||
@ -489,12 +489,12 @@ void GxsChannelPostItem::fill()
|
|||||||
/* subject */
|
/* subject */
|
||||||
ui->titleLabel->setText(QString::fromUtf8(mPost.mMeta.mMsgName.c_str()));
|
ui->titleLabel->setText(QString::fromUtf8(mPost.mMeta.mMsgName.c_str()));
|
||||||
|
|
||||||
//uint32_t autorized_lines = (int)floor((ui->logoLabel->height() - ui->titleLabel->height() - ui->buttonHLayout->sizeHint().height())/QFontMetricsF(ui->subjectLabel->font()).height());
|
uint32_t autorized_lines = (int)floor((ui->logoLabel->height() - ui->titleLabel->height() - ui->buttonHLayout->sizeHint().height())/QFontMetricsF(ui->subjectLabel->font()).height());
|
||||||
|
|
||||||
// fill first 4 lines of message. (csoler) Disabled the replacement of smileys and links, because the cost is too crazy
|
// fill first 4 lines of message. (csoler) Disabled the replacement of smileys and links, because the cost is too crazy
|
||||||
//ui->subjectLabel->setText(RsHtml().formatText(NULL, RsStringUtil::CopyLines(QString::fromUtf8(mPost.mMsg.c_str()), autorized_lines), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
|
//ui->subjectLabel->setText(RsHtml().formatText(NULL, RsStringUtil::CopyLines(QString::fromUtf8(mPost.mMsg.c_str()), autorized_lines), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
|
||||||
|
|
||||||
//ui->subjectLabel->setText(RsStringUtil::CopyLines(QString::fromUtf8(mPost.mMsg.c_str()), 2)) ;
|
ui->subjectLabel->setText(RsStringUtil::CopyLines(QString::fromUtf8(mPost.mMsg.c_str()), 2)) ;
|
||||||
|
|
||||||
//QString score = QString::number(post.mTopScore);
|
//QString score = QString::number(post.mTopScore);
|
||||||
// scoreLabel->setText(score);
|
// scoreLabel->setText(score);
|
||||||
@ -654,21 +654,21 @@ void GxsChannelPostItem::setReadStatus(bool isNew, bool isUnread)
|
|||||||
ui->mainFrame->style()->polish( ui->mainFrame);
|
ui->mainFrame->style()->polish( ui->mainFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsChannelPostItem::setFileCleanUpWarning(uint32_t time_left)
|
// void GxsChannelPostItem::setFileCleanUpWarning(uint32_t time_left)
|
||||||
{
|
// {
|
||||||
int hours = (int)time_left/3600;
|
// int hours = (int)time_left/3600;
|
||||||
int minutes = (time_left - hours*3600)%60;
|
// int minutes = (time_left - hours*3600)%60;
|
||||||
|
//
|
||||||
ui->warning_label->setText(tr("Warning! You have less than %1 hours and %2 minute before this file is deleted Consider saving it.").arg(
|
// ui->warning_label->setText(tr("Warning! You have less than %1 hours and %2 minute before this file is deleted Consider saving it.").arg(
|
||||||
QString::number(hours)).arg(QString::number(minutes)));
|
// QString::number(hours)).arg(QString::number(minutes)));
|
||||||
|
//
|
||||||
QFont warnFont = ui->warning_label->font();
|
// QFont warnFont = ui->warning_label->font();
|
||||||
warnFont.setBold(true);
|
// warnFont.setBold(true);
|
||||||
ui->warning_label->setFont(warnFont);
|
// ui->warning_label->setFont(warnFont);
|
||||||
|
//
|
||||||
ui->warn_image_label->setVisible(true);
|
// ui->warn_image_label->setVisible(true);
|
||||||
ui->warning_label->setVisible(true);
|
// ui->warning_label->setVisible(true);
|
||||||
}
|
// }
|
||||||
|
|
||||||
void GxsChannelPostItem::updateItem()
|
void GxsChannelPostItem::updateItem()
|
||||||
{
|
{
|
||||||
|
@ -56,7 +56,7 @@ public:
|
|||||||
bool setGroup(const RsGxsChannelGroup& group, bool doFill = true);
|
bool setGroup(const RsGxsChannelGroup& group, bool doFill = true);
|
||||||
bool setPost(const RsGxsChannelPost& post, bool doFill = true);
|
bool setPost(const RsGxsChannelPost& post, bool doFill = true);
|
||||||
|
|
||||||
void setFileCleanUpWarning(uint32_t time_left);
|
//void setFileCleanUpWarning(uint32_t time_left);
|
||||||
|
|
||||||
QString getTitleLabel();
|
QString getTitleLabel();
|
||||||
QString getMsgLabel();
|
QString getMsgLabel();
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>922</width>
|
<width>1092</width>
|
||||||
<height>187</height>
|
<height>231</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gxsChannelPostItem_GLayout">
|
<layout class="QGridLayout" name="gxsChannelPostItem_GLayout">
|
||||||
@ -124,6 +124,16 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="subjectLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">TextLabel</string>
|
||||||
|
</property>
|
||||||
|
<property name="openExternalLinks">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer_2">
|
<spacer name="verticalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
@ -137,33 +147,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="subjectHLayout"/>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="warningHLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="warn_image_label">
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>24</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="warning_label">
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">TextLabel</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="newCommHLayout">
|
<layout class="QHBoxLayout" name="newCommHLayout">
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
@ -486,21 +469,18 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>StyledElidedLabel</class>
|
||||||
|
<extends>QLabel</extends>
|
||||||
|
<header>gui/common/StyledElidedLabel.h</header>
|
||||||
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>ElidedLabel</class>
|
<class>ElidedLabel</class>
|
||||||
<extends>QLabel</extends>
|
<extends>QLabel</extends>
|
||||||
<header location="global">gui/common/ElidedLabel.h</header>
|
<header location="global">gui/common/ElidedLabel.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
|
||||||
<class>StyledElidedLabel</class>
|
|
||||||
<extends>QLabel</extends>
|
|
||||||
<header>gui/common/StyledElidedLabel.h</header>
|
|
||||||
</customwidget>
|
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources/>
|
||||||
<include location="../icons.qrc"/>
|
|
||||||
<include location="../images.qrc"/>
|
|
||||||
</resources>
|
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
@ -121,7 +121,11 @@ void ChannelPostDelegate::paint(QPainter * painter, const QStyleOptionViewItem &
|
|||||||
|
|
||||||
RsGxsChannelPost post = index.data(Qt::UserRole).value<RsGxsChannelPost>() ;
|
RsGxsChannelPost post = index.data(Qt::UserRole).value<RsGxsChannelPost>() ;
|
||||||
|
|
||||||
painter->fillRect( option.rect, option.backgroundBrush);
|
// if(index.row() & 0x01)
|
||||||
|
// painter->fillRect( option.rect, option.palette.alternateBase().color());
|
||||||
|
// else
|
||||||
|
painter->fillRect( option.rect, option.palette.base().color());
|
||||||
|
|
||||||
painter->restore();
|
painter->restore();
|
||||||
|
|
||||||
if(mUseGrid || index.column()==0)
|
if(mUseGrid || index.column()==0)
|
||||||
@ -130,6 +134,7 @@ void ChannelPostDelegate::paint(QPainter * painter, const QStyleOptionViewItem &
|
|||||||
|
|
||||||
uint32_t flags = (mUseGrid)?(ChannelPostThumbnailView::FLAG_SHOW_TEXT | ChannelPostThumbnailView::FLAG_SCALE_FONT):0;
|
uint32_t flags = (mUseGrid)?(ChannelPostThumbnailView::FLAG_SHOW_TEXT | ChannelPostThumbnailView::FLAG_SCALE_FONT):0;
|
||||||
ChannelPostThumbnailView w(post,flags);
|
ChannelPostThumbnailView w(post,flags);
|
||||||
|
w.setBackgroundRole(QPalette::AlternateBase);
|
||||||
w.setAspectRatio(mAspectRatio);
|
w.setAspectRatio(mAspectRatio);
|
||||||
w.updateGeometry();
|
w.updateGeometry();
|
||||||
w.adjustSize();
|
w.adjustSize();
|
||||||
@ -139,7 +144,14 @@ void ChannelPostDelegate::paint(QPainter * painter, const QStyleOptionViewItem &
|
|||||||
if((option.state & QStyle::State_Selected) && post.mMeta.mPublishTs > 0) // check if post is selected and is not empty (end of last row)
|
if((option.state & QStyle::State_Selected) && post.mMeta.mPublishTs > 0) // check if post is selected and is not empty (end of last row)
|
||||||
pixmap.fill(SelectedColor); // I dont know how to grab the backgroud color for selected objects automatically.
|
pixmap.fill(SelectedColor); // I dont know how to grab the backgroud color for selected objects automatically.
|
||||||
else
|
else
|
||||||
pixmap.fill(QRgb(0x00ffffff)); // choose a fully transparent background
|
{
|
||||||
|
// we need to do the alternate color manually
|
||||||
|
|
||||||
|
//if(index.row() & 0x01)
|
||||||
|
// pixmap.fill(option.palette.alternateBase().color());
|
||||||
|
//else
|
||||||
|
pixmap.fill(option.palette.base().color());
|
||||||
|
}
|
||||||
|
|
||||||
w.render(&pixmap,QPoint(),QRegion(),QWidget::DrawChildren );// draw the widgets, not the background
|
w.render(&pixmap,QPoint(),QRegion(),QWidget::DrawChildren );// draw the widgets, not the background
|
||||||
|
|
||||||
@ -198,8 +210,11 @@ void ChannelPostDelegate::paint(QPainter * painter, const QStyleOptionViewItem &
|
|||||||
painter->drawText(QPoint(p.x()+0.5*font_height,y),QDateTime::fromSecsSinceEpoch(post.mMeta.mPublishTs).toString(Qt::DefaultLocaleShortDate));
|
painter->drawText(QPoint(p.x()+0.5*font_height,y),QDateTime::fromSecsSinceEpoch(post.mMeta.mPublishTs).toString(Qt::DefaultLocaleShortDate));
|
||||||
y += font_height;
|
y += font_height;
|
||||||
|
|
||||||
painter->drawText(QPoint(p.x()+0.5*font_height,y),QString::number(post.mCount)+ " " +((post.mCount>1)?tr("files"):tr("file")) + " (" + QString::number(post.mSize) + " " + tr("bytes") + ")" );
|
if(post.mCount > 0)
|
||||||
y += font_height;
|
{
|
||||||
|
painter->drawText(QPoint(p.x()+0.5*font_height,y),QString::number(post.mCount)+ " " +((post.mCount>1)?tr("files"):tr("file")) + " (" + QString::number(post.mSize) + " " + tr("bytes") + ")" );
|
||||||
|
y += font_height;
|
||||||
|
}
|
||||||
|
|
||||||
painter->restore();
|
painter->restore();
|
||||||
}
|
}
|
||||||
@ -285,8 +300,14 @@ void ChannelPostFilesDelegate::paint(QPainter * painter, const QStyleOptionViewI
|
|||||||
w.setFixedHeight(option.rect.height());
|
w.setFixedHeight(option.rect.height());
|
||||||
|
|
||||||
QPixmap pixmap(w.size());
|
QPixmap pixmap(w.size());
|
||||||
pixmap.fill(QRgb(0x00ffffff)); // choose a fully transparent background
|
|
||||||
w.render(&pixmap,QPoint(),QRegion(),QWidget::DrawChildren );// draw the widgets, not the background
|
// apparently we need to do the alternate colors manually
|
||||||
|
//if(index.row() & 0x01)
|
||||||
|
// pixmap.fill(option.palette.alternateBase().color());
|
||||||
|
//else
|
||||||
|
pixmap.fill(option.palette.base().color());
|
||||||
|
|
||||||
|
w.render(&pixmap,QPoint(),QRegion(),QWidget::DrawChildren );// draw the widgets, not the background
|
||||||
|
|
||||||
painter->drawPixmap(option.rect.topLeft(),pixmap);
|
painter->drawPixmap(option.rect.topLeft(),pixmap);
|
||||||
}
|
}
|
||||||
@ -335,6 +356,7 @@ GxsChannelPostsWidgetWithModel::GxsChannelPostsWidgetWithModel(const RsGxsGroupI
|
|||||||
ui->showUnread_TB->setToolTip(tr("Show unread posts only"));
|
ui->showUnread_TB->setToolTip(tr("Show unread posts only"));
|
||||||
connect(ui->showUnread_TB,SIGNAL(toggled(bool)),this,SLOT(switchOnlyUnread(bool)));
|
connect(ui->showUnread_TB,SIGNAL(toggled(bool)),this,SLOT(switchOnlyUnread(bool)));
|
||||||
|
|
||||||
|
ui->postsTree->setAlternatingRowColors(false);
|
||||||
ui->postsTree->setModel(mChannelPostsModel = new RsGxsChannelPostsModel());
|
ui->postsTree->setModel(mChannelPostsModel = new RsGxsChannelPostsModel());
|
||||||
ui->postsTree->setItemDelegate(mChannelPostsDelegate = new ChannelPostDelegate());
|
ui->postsTree->setItemDelegate(mChannelPostsDelegate = new ChannelPostDelegate());
|
||||||
ui->postsTree->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); // prevents bug on w10, since row size depends on widget width
|
ui->postsTree->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); // prevents bug on w10, since row size depends on widget width
|
||||||
@ -351,6 +373,7 @@ GxsChannelPostsWidgetWithModel::GxsChannelPostsWidgetWithModel(const RsGxsGroupI
|
|||||||
ui->channelPostFiles_TV->setPlaceholderText(tr("No files in this post, or no post selected"));
|
ui->channelPostFiles_TV->setPlaceholderText(tr("No files in this post, or no post selected"));
|
||||||
ui->channelPostFiles_TV->setSortingEnabled(true);
|
ui->channelPostFiles_TV->setSortingEnabled(true);
|
||||||
ui->channelPostFiles_TV->sortByColumn(0, Qt::AscendingOrder);
|
ui->channelPostFiles_TV->sortByColumn(0, Qt::AscendingOrder);
|
||||||
|
ui->channelPostFiles_TV->setAlternatingRowColors(false);
|
||||||
|
|
||||||
ui->channelFiles_TV->setModel(mChannelFilesModel = new RsGxsChannelPostFilesModel());
|
ui->channelFiles_TV->setModel(mChannelFilesModel = new RsGxsChannelPostFilesModel());
|
||||||
ui->channelFiles_TV->setItemDelegate(mFilesDelegate = new ChannelPostFilesDelegate());
|
ui->channelFiles_TV->setItemDelegate(mFilesDelegate = new ChannelPostFilesDelegate());
|
||||||
@ -894,15 +917,7 @@ void GxsChannelPostsWidgetWithModel::processSettings(bool load)
|
|||||||
Settings->beginGroup(QString("ChannelPostsWidget"));
|
Settings->beginGroup(QString("ChannelPostsWidget"));
|
||||||
|
|
||||||
if (load) {
|
if (load) {
|
||||||
#ifdef TO_REMOVE
|
|
||||||
// load settings
|
|
||||||
|
|
||||||
/* Filter */
|
|
||||||
//ui->filterLineEdit->setCurrentFilter(Settings->value("filter", FILTER_TITLE).toInt());
|
|
||||||
|
|
||||||
/* View mode */
|
|
||||||
//setViewMode(Settings->value("viewMode", VIEW_MODE_FEEDS).toInt());
|
|
||||||
#endif
|
|
||||||
// state of files tree
|
// state of files tree
|
||||||
channelpostfilesheader->restoreState(Settings->value("PostFilesTree").toByteArray());
|
channelpostfilesheader->restoreState(Settings->value("PostFilesTree").toByteArray());
|
||||||
channelfilesheader->restoreState(Settings->value("FilesTree").toByteArray());
|
channelfilesheader->restoreState(Settings->value("FilesTree").toByteArray());
|
||||||
@ -910,15 +925,6 @@ void GxsChannelPostsWidgetWithModel::processSettings(bool load)
|
|||||||
// state of splitter
|
// state of splitter
|
||||||
ui->splitter->restoreState(Settings->value("SplitterChannelPosts").toByteArray());
|
ui->splitter->restoreState(Settings->value("SplitterChannelPosts").toByteArray());
|
||||||
} else {
|
} else {
|
||||||
#ifdef TO_REMOVE
|
|
||||||
// save settings
|
|
||||||
|
|
||||||
/* Filter */
|
|
||||||
//Settings->setValue("filter", ui->filterLineEdit->currentFilter());
|
|
||||||
|
|
||||||
/* View mode */
|
|
||||||
//Settings->setValue("viewMode", viewMode());
|
|
||||||
#endif
|
|
||||||
// state of files tree
|
// state of files tree
|
||||||
Settings->setValue("PostFilesTree", channelpostfilesheader->saveState());
|
Settings->setValue("PostFilesTree", channelpostfilesheader->saveState());
|
||||||
Settings->setValue("FilesTree", channelfilesheader->saveState());
|
Settings->setValue("FilesTree", channelfilesheader->saveState());
|
||||||
@ -1106,47 +1112,6 @@ void GxsChannelPostsWidgetWithModel::insertChannelDetails(const RsGxsChannelGrou
|
|||||||
showPostDetails();
|
showPostDetails();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TODO
|
|
||||||
int GxsChannelPostsWidgetWithModel::viewMode()
|
|
||||||
{
|
|
||||||
if (ui->feedToolButton->isChecked()) {
|
|
||||||
return VIEW_MODE_FEEDS;
|
|
||||||
} else if (ui->fileToolButton->isChecked()) {
|
|
||||||
return VIEW_MODE_FILES;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Default */
|
|
||||||
return VIEW_MODE_FEEDS;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void GxsChannelPostsWidgetWithModel::setViewMode(int viewMode)
|
|
||||||
{
|
|
||||||
#ifdef TODO
|
|
||||||
switch (viewMode) {
|
|
||||||
case VIEW_MODE_FEEDS:
|
|
||||||
ui->feedWidget->show();
|
|
||||||
ui->fileWidget->hide();
|
|
||||||
|
|
||||||
ui->feedToolButton->setChecked(true);
|
|
||||||
ui->fileToolButton->setChecked(false);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case VIEW_MODE_FILES:
|
|
||||||
ui->feedWidget->hide();
|
|
||||||
ui->fileWidget->show();
|
|
||||||
|
|
||||||
ui->feedToolButton->setChecked(false);
|
|
||||||
ui->fileToolButton->setChecked(true);
|
|
||||||
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
setViewMode(VIEW_MODE_FEEDS);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void GxsChannelPostsWidgetWithModel::switchOnlyUnread(bool)
|
void GxsChannelPostsWidgetWithModel::switchOnlyUnread(bool)
|
||||||
{
|
{
|
||||||
filterChanged(ui->filterLineEdit->text());
|
filterChanged(ui->filterLineEdit->text());
|
||||||
@ -1160,150 +1125,6 @@ void GxsChannelPostsWidgetWithModel::filterChanged(QString s)
|
|||||||
mChannelFilesModel->setFilter(ql,count);
|
mChannelFilesModel->setFilter(ql,count);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TODO
|
|
||||||
/*static*/ bool GxsChannelPostsWidgetWithModel::filterItem(FeedItem *feedItem, const QString &text, int filter)
|
|
||||||
{
|
|
||||||
GxsChannelPostItem *item = dynamic_cast<GxsChannelPostItem*>(feedItem);
|
|
||||||
if (!item) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool bVisible = text.isEmpty();
|
|
||||||
|
|
||||||
if (!bVisible)
|
|
||||||
{
|
|
||||||
switch(filter)
|
|
||||||
{
|
|
||||||
case FILTER_TITLE:
|
|
||||||
bVisible = item->getTitleLabel().contains(text,Qt::CaseInsensitive);
|
|
||||||
break;
|
|
||||||
case FILTER_MSG:
|
|
||||||
bVisible = item->getMsgLabel().contains(text,Qt::CaseInsensitive);
|
|
||||||
break;
|
|
||||||
case FILTER_FILE_NAME:
|
|
||||||
{
|
|
||||||
std::list<SubFileItem *> fileItems = item->getFileItems();
|
|
||||||
std::list<SubFileItem *>::iterator lit;
|
|
||||||
for(lit = fileItems.begin(); lit != fileItems.end(); ++lit)
|
|
||||||
{
|
|
||||||
SubFileItem *fi = *lit;
|
|
||||||
QString fileName = QString::fromUtf8(fi->FileName().c_str());
|
|
||||||
bVisible = (bVisible || fileName.contains(text,Qt::CaseInsensitive));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
bVisible = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return bVisible;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GxsChannelPostsWidget::createPostItemFromMetaData(const RsGxsMsgMetaData& meta,bool related)
|
|
||||||
{
|
|
||||||
GxsChannelPostItem *item = NULL;
|
|
||||||
RsGxsChannelPost post;
|
|
||||||
|
|
||||||
if(!meta.mOrigMsgId.isNull())
|
|
||||||
{
|
|
||||||
FeedItem *feedItem = ui->feedWidget->findFeedItem(GxsChannelPostItem::computeIdentifier(meta.mOrigMsgId)) ;
|
|
||||||
item = dynamic_cast<GxsChannelPostItem*>(feedItem);
|
|
||||||
|
|
||||||
if(item)
|
|
||||||
{
|
|
||||||
post = feedItem->post();
|
|
||||||
ui->feedWidget->removeFeedItem(item) ;
|
|
||||||
|
|
||||||
post.mOlderVersions.insert(post.mMeta.mMsgId);
|
|
||||||
|
|
||||||
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, post, true, false,post.mOlderVersions);
|
|
||||||
ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, QDateTime::fromTime_t(post.mMeta.mPublishTs));
|
|
||||||
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (related)
|
|
||||||
{
|
|
||||||
FeedItem *feedItem = ui->feedWidget->findFeedItem(GxsChannelPostItem::computeIdentifier(meta.mMsgId)) ;
|
|
||||||
item = dynamic_cast<GxsChannelPostItem*>(feedItem);
|
|
||||||
}
|
|
||||||
if (item)
|
|
||||||
{
|
|
||||||
item->setPost(post);
|
|
||||||
ui->feedWidget->setSort(item, ROLE_PUBLISH, QDateTime::fromTime_t(meta.mPublishTs));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, meta.mGroupId,meta.mMsgId, true, true);
|
|
||||||
ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, QDateTime::fromTime_t(post.mMeta.mPublishTs));
|
|
||||||
}
|
|
||||||
#ifdef TODO
|
|
||||||
ui->fileWidget->addFiles(post, related);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void GxsChannelPostsWidget::createPostItem(const RsGxsChannelPost& post, bool related)
|
|
||||||
{
|
|
||||||
GxsChannelPostItem *item = NULL;
|
|
||||||
|
|
||||||
const RsMsgMetaData& meta(post.mMeta);
|
|
||||||
|
|
||||||
if(!meta.mOrigMsgId.isNull())
|
|
||||||
{
|
|
||||||
FeedItem *feedItem = ui->feedWidget->findFeedItem(GxsChannelPostItem::computeIdentifier(meta.mOrigMsgId)) ;
|
|
||||||
item = dynamic_cast<GxsChannelPostItem*>(feedItem);
|
|
||||||
|
|
||||||
if(item)
|
|
||||||
{
|
|
||||||
std::set<RsGxsMessageId> older_versions(item->olderVersions()); // we make a copy because the item will be deleted
|
|
||||||
ui->feedWidget->removeFeedItem(item) ;
|
|
||||||
|
|
||||||
older_versions.insert(meta.mMsgId);
|
|
||||||
|
|
||||||
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, mGroup.mMeta,meta.mMsgId, true, false,older_versions);
|
|
||||||
ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, QDateTime::fromTime_t(meta.mPublishTs));
|
|
||||||
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (related)
|
|
||||||
{
|
|
||||||
FeedItem *feedItem = ui->feedWidget->findFeedItem(GxsChannelPostItem::computeIdentifier(meta.mMsgId)) ;
|
|
||||||
item = dynamic_cast<GxsChannelPostItem*>(feedItem);
|
|
||||||
}
|
|
||||||
if (item)
|
|
||||||
{
|
|
||||||
item->setPost(post);
|
|
||||||
ui->feedWidget->setSort(item, ROLE_PUBLISH, QDateTime::fromTime_t(meta.mPublishTs));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, mGroup.mMeta,meta.mMsgId, true, true);
|
|
||||||
ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, QDateTime::fromTime_t(meta.mPublishTs));
|
|
||||||
}
|
|
||||||
|
|
||||||
ui->fileWidget->addFiles(post, related);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GxsChannelPostsWidget::fillThreadCreatePost(const QVariant &post, bool related, int current, int count)
|
|
||||||
{
|
|
||||||
/* show fill progress */
|
|
||||||
if (count) {
|
|
||||||
ui->progressBar->setValue(current * ui->progressBar->maximum() / count);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!post.canConvert<RsGxsChannelPost>()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
createPostItem(post.value<RsGxsChannelPost>(), related);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void GxsChannelPostsWidgetWithModel::blank()
|
void GxsChannelPostsWidgetWithModel::blank()
|
||||||
{
|
{
|
||||||
ui->postButton->setEnabled(false);
|
ui->postButton->setEnabled(false);
|
||||||
|
@ -147,7 +147,6 @@ private slots:
|
|||||||
void toggleAutoDownload();
|
void toggleAutoDownload();
|
||||||
void subscribeGroup(bool subscribe);
|
void subscribeGroup(bool subscribe);
|
||||||
void filterChanged(QString);
|
void filterChanged(QString);
|
||||||
void setViewMode(int viewMode);
|
|
||||||
void settingsChanged();
|
void settingsChanged();
|
||||||
void handlePostsTreeSizeChange(QSize s, bool force=false);
|
void handlePostsTreeSizeChange(QSize s, bool force=false);
|
||||||
void postChannelPostLoad();
|
void postChannelPostLoad();
|
||||||
@ -172,8 +171,6 @@ private:
|
|||||||
void setAutoDownload(bool autoDl);
|
void setAutoDownload(bool autoDl);
|
||||||
static bool filterItem(FeedItem *feedItem, const QString &text, int filter);
|
static bool filterItem(FeedItem *feedItem, const QString &text, int filter);
|
||||||
|
|
||||||
int viewMode();
|
|
||||||
|
|
||||||
void insertChannelDetails(const RsGxsChannelGroup &group);
|
void insertChannelDetails(const RsGxsChannelGroup &group);
|
||||||
void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
|
void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
|
||||||
|
|
||||||
|
@ -393,6 +393,9 @@ p, li { white-space: pre-wrap; }
|
|||||||
<property name="contextMenuPolicy">
|
<property name="contextMenuPolicy">
|
||||||
<enum>Qt::CustomContextMenu</enum>
|
<enum>Qt::CustomContextMenu</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Click to view post. </p><p>Use Ctrl+mouse wheel </p><p>to zoom/unzoom.</p></body></html></string>
|
||||||
|
</property>
|
||||||
<property name="sizeAdjustPolicy">
|
<property name="sizeAdjustPolicy">
|
||||||
<enum>QAbstractScrollArea::AdjustToContents</enum>
|
<enum>QAbstractScrollArea::AdjustToContents</enum>
|
||||||
</property>
|
</property>
|
||||||
@ -428,7 +431,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab">
|
<widget class="QWidget" name="tab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
@ -593,16 +596,16 @@ p, li { white-space: pre-wrap; }
|
|||||||
<extends>QToolButton</extends>
|
<extends>QToolButton</extends>
|
||||||
<header>gui/common/SubscribeToolButton.h</header>
|
<header>gui/common/SubscribeToolButton.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
|
||||||
<class>StyledElidedLabel</class>
|
|
||||||
<extends>QLabel</extends>
|
|
||||||
<header>gui/common/StyledElidedLabel.h</header>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>RSTreeView</class>
|
<class>RSTreeView</class>
|
||||||
<extends>QTreeView</extends>
|
<extends>QTreeView</extends>
|
||||||
<header>gui/common/RSTreeView.h</header>
|
<header>gui/common/RSTreeView.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>LineEditClear</class>
|
||||||
|
<extends>QLineEdit</extends>
|
||||||
|
<header>gui/common/LineEditClear.h</header>
|
||||||
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>GxsCommentDialog</class>
|
<class>GxsCommentDialog</class>
|
||||||
<extends>QWidget</extends>
|
<extends>QWidget</extends>
|
||||||
@ -610,9 +613,9 @@ p, li { white-space: pre-wrap; }
|
|||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>LineEditClear</class>
|
<class>StyledElidedLabel</class>
|
||||||
<extends>QLineEdit</extends>
|
<extends>QLabel</extends>
|
||||||
<header>gui/common/LineEditClear.h</header>
|
<header>gui/common/StyledElidedLabel.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user