Commit 7a0ce8b7 authored by kaniini's avatar kaniini

refactor timeline widget to take a detached model

parent 595a51d7
......@@ -8,7 +8,11 @@ TimelineSelectorWidget::TimelineSelectorWidget(Michabo::AccountManager *manager,
{
setDocumentMode(true);
addTab(new TimelineWidget(m_manager, "home", this), "Home");
addTab(new TimelineWidget(m_manager, "public", this), "Public");
addTab(new TimelineWidget(m_manager, "federated", this), "Federated");
m_home_timeline = new TimelineModel(manager, "home");
m_public_timeline = new TimelineModel(manager, "public");
m_federated_timeline = new TimelineModel(manager, "federated");
addTab(new TimelineWidget(m_manager, "home", m_home_timeline, this), "Home");
addTab(new TimelineWidget(m_manager, "public", m_public_timeline, this), "Public");
addTab(new TimelineWidget(m_manager, "federated", m_federated_timeline, this), "Federated");
}
......@@ -16,9 +16,9 @@ public:
private:
Michabo::AccountManager *m_manager;
Michabo::Account *m_account;
TimelineWidget *m_home_timeline;
TimelineWidget *m_public_timeline;
TimelineWidget *m_federated_timeline;
TimelineModel *m_home_timeline;
TimelineModel *m_public_timeline;
TimelineModel *m_federated_timeline;
};
#endif // TIMELINESELECTORWIDGET_H
......@@ -903,9 +903,9 @@ void TimelineModel::handleMouseOver(const QModelIndex &index)
emit dataChanged(index, index);
}
TimelineWidget::TimelineWidget(Michabo::AccountManager *manager, QString timeline_name, QWidget *parent)
TimelineWidget::TimelineWidget(Michabo::AccountManager *manager, QString, TimelineModel *model, QWidget *parent)
: QTreeView(parent),
m_model(new TimelineModel(manager, timeline_name, this)),
m_model(model),
m_html_delegate(new HTMLDelegate),
m_avatar_delegate(new AvatarDelegate)
{
......
......@@ -98,7 +98,7 @@ public slots:
class TimelineWidget : public QTreeView
{
public:
TimelineWidget(Michabo::AccountManager *manager, QString timeline_name, QWidget *parent = nullptr);
TimelineWidget(Michabo::AccountManager *manager, QString timeline_name, TimelineModel *model, QWidget *parent = nullptr);
protected:
void resizeEvent(QResizeEvent *event);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment