Merge pull request #1459 from defnax/master

Improved Posted Links & Subscribe button look like Youtube/Reddit style
This commit is contained in:
csoler 2019-03-19 23:44:14 +01:00 committed by GitHub
commit 450fcbb0e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 579 additions and 226 deletions

View file

@ -41,23 +41,19 @@ PostedListWidget::PostedListWidget(const RsGxsGroupId &postedId, QWidget *parent
ui->setupUi(this);
/* Setup UI helper */
mStateHelper->addWidget(mTokenTypeAllPosts, ui->hotSortButton);
mStateHelper->addWidget(mTokenTypeAllPosts, ui->newSortButton);
mStateHelper->addWidget(mTokenTypeAllPosts, ui->topSortButton);
mStateHelper->addWidget(mTokenTypeAllPosts, ui->comboBox);
mStateHelper->addWidget(mTokenTypePosts, ui->hotSortButton);
mStateHelper->addWidget(mTokenTypePosts, ui->newSortButton);
mStateHelper->addWidget(mTokenTypePosts, ui->topSortButton);
mStateHelper->addWidget(mTokenTypePosts, ui->comboBox);
mStateHelper->addWidget(mTokenTypeGroupData, ui->submitPostButton);
mStateHelper->addWidget(mTokenTypeGroupData, ui->subscribeToolButton);
connect(ui->hotSortButton, SIGNAL(clicked()), this, SLOT(getRankings()));
connect(ui->newSortButton, SIGNAL(clicked()), this, SLOT(getRankings()));
connect(ui->topSortButton, SIGNAL(clicked()), this, SLOT(getRankings()));
connect(ui->nextButton, SIGNAL(clicked()), this, SLOT(showNext()));
connect(ui->prevButton, SIGNAL(clicked()), this, SLOT(showPrev()));
connect(ui->subscribeToolButton, SIGNAL(subscribe(bool)), this, SLOT(subscribeGroup(bool)));
connect(ui->comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(getRankings(int)));
// default sort method.
mSortMethod = RsPosted::HotRankType;
@ -67,12 +63,14 @@ PostedListWidget::PostedListWidget(const RsGxsGroupId &postedId, QWidget *parent
mTokenTypeVote = nextTokenType();
ui->hotSortButton->setChecked(true);
/* fill in the available OwnIds for signing */
ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, RsGxsId());
connect(ui->submitPostButton, SIGNAL(clicked()), this, SLOT(newPost()));
ui->subscribeToolButton->setToolTip(tr( "<p>Subscribing to the links will gather \
available posts from your subscribed friends, and make the \
links visible to all other friends.</p><p>Afterwards you can unsubscribe from the context menu of the links list at left.</p>"));
/* load settings */
processSettings(true);
@ -183,7 +181,7 @@ void PostedListWidget::updateShowText()
ui->showLabel->setText(showText);
}
void PostedListWidget::getRankings()
void PostedListWidget::getRankings(int i)
{
if (groupId().isNull())
return;
@ -192,23 +190,19 @@ void PostedListWidget::getRankings()
std::cerr << std::endl;
int oldSortMethod = mSortMethod;
QObject* button = sender();
if(button == ui->hotSortButton)
switch(i)
{
default:
case 0:
mSortMethod = RsPosted::HotRankType;
}
else if(button == ui->topSortButton)
{
mSortMethod = RsPosted::TopRankType;
}
else if(button == ui->newSortButton)
{
break;
case 1:
mSortMethod = RsPosted::NewRankType;
}
else
{
return;
break;
case 2:
mSortMethod = RsPosted::TopRankType;
break;
}
if (oldSortMethod != mSortMethod)
@ -298,6 +292,7 @@ void PostedListWidget::insertPostedDetails(const RsPostedGroup &group)
{
mStateHelper->setWidgetEnabled(ui->submitPostButton, IS_GROUP_SUBSCRIBED(group.mMeta.mSubscribeFlags));
ui->subscribeToolButton->setSubscribed(IS_GROUP_SUBSCRIBED(group.mMeta.mSubscribeFlags));
ui->subscribeToolButton->setHidden(IS_GROUP_SUBSCRIBED(group.mMeta.mSubscribeFlags)) ;
}
/*********************** **** **** **** ***********************/