Files
llink/src/data.cpp
T

161 lines
7.4 KiB
C++

#include "data.h"
Data::Data(QObject *parent) : QObject(parent)
{
initializeFakeData();
}
void Data::initializeFakeData()
{
// Network 1: Private
Network net1;
net1.id = "net-private";
net1.name = "Private";
net1.openStreamCount = 2;
net1.openStreamCapacity = 5;
net1.countHumans = 1;
m_networks.append(net1);
// Stream: Personal Notes
Stream stream1;
stream1.id = "stream-notes";
stream1.name = "Personal Notes";
stream1.status = Stream::OPEN;
stream1.unseenCount = 3;
m_streams[net1.id].append(stream1);
// Particles for Personal Notes
m_particles[stream1.id].append({"p1", "text", "[email protected]", "Meeting notes from standup", true});
m_particles[stream1.id].append({"p2", "link", "[email protected]", "API documentation for new endpoint", true});
m_particles[stream1.id].append({"p3", "image", "[email protected]", "Screenshot of bug in login flow", false});
m_particles[stream1.id].append({"p4", "text", "[email protected]", "Quick thought about architecture refactor", false});
m_particles[stream1.id].append({"p5", "link", "[email protected]", "Design inspiration board from Dribbble", false});
// Stream: Quick Captures
Stream stream2;
stream2.id = "stream-captures";
stream2.name = "Quick Captures";
stream2.status = Stream::OPEN;
stream2.unseenCount = 0;
m_streams[net1.id].append(stream2);
// Particles for Quick Captures
m_particles[stream2.id].append({"p6", "text", "[email protected]", "Remember to follow up on client feedback", true});
m_particles[stream2.id].append({"p7", "image", "[email protected]", "Mockup for new feature dashboard", true});
// Network 2: Flowy Labs, Inc
Network net2;
net2.id = "net-flowy";
net2.name = "Flowy Labs, Inc";
net2.openStreamCount = 3;
net2.openStreamCapacity = 10;
net2.countHumans = 12;
m_networks.append(net2);
// Stream: Engineering
Stream stream3;
stream3.id = "stream-eng";
stream3.name = "wild-shape";
stream3.status = Stream::OPEN;
stream3.unseenCount = 10;
m_streams[net2.id].append(stream3);
// Particles for Engineering
m_particles[stream3.id].append({"p8", "text", "[email protected]", "hey team, anyone seeing issues with the auth service?", true});
m_particles[stream3.id].append({"p9", "text", "[email protected]", "yeah, getting 401s on the staging server", true});
m_particles[stream3.id].append({"p10", "text", "[email protected]", "i think it's the JWT expiration. checking now", true});
m_particles[stream3.id].append({"p11", "link", "[email protected]", "https://github.com/flowy/api/pull/234", true});
m_particles[stream3.id].append({"p12", "text", "[email protected]", "^ PR ready for review. fixed the token refresh logic", false});
m_particles[stream3.id].append({"p13", "text", "[email protected]", "looking at it now", false});
m_particles[stream3.id].append({"p14", "text", "[email protected]", "nice catch! left a few comments about error handling", false});
m_particles[stream3.id].append({"p15", "text", "[email protected]", "updated, should be good to merge", false});
m_particles[stream3.id].append({"p16", "text", "[email protected]", "merged! deploying to staging now", false});
m_particles[stream3.id].append({"p17", "text", "[email protected]", "btw, we should probably add monitoring for token expiration", false});
m_particles[stream3.id].append({"p18", "text", "[email protected]", "good idea, i can set that up after lunch", false});
m_particles[stream3.id].append({"p19", "text", "[email protected]", "also, can someone review my database migration PR?", false});
m_particles[stream3.id].append({"p20", "image", "[email protected]", "here's the schema changes", false});
m_particles[stream3.id].append({"p21", "text", "[email protected]", "looks good to me. just run it by charlie for final approval", false});
// Stream: Design
Stream stream4;
stream4.id = "stream-design";
stream4.name = "arch-rival";
stream4.status = Stream::OPEN;
stream4.unseenCount = 4;
m_streams[net2.id].append(stream4);
// Particles for Design
m_particles[stream4.id].append({"p22", "text", "[email protected]", "starting on the mobile dashboard redesign", true});
m_particles[stream4.id].append({"p23", "image", "[email protected]", "initial mockup - thoughts?", true});
m_particles[stream4.id].append({"p24", "text", "[email protected]", "love the direction! maybe try a darker header?", true});
m_particles[stream4.id].append({"p25", "text", "[email protected]", "agreed, and can we use the new color palette from the design system?", true});
m_particles[stream4.id].append({"p26", "link", "[email protected]", "https://figma.com/design-system-v2", true});
m_particles[stream4.id].append({"p27", "text", "[email protected]", "oh perfect! i'll update it", true});
m_particles[stream4.id].append({"p28", "text", "[email protected]", "hey, should the settings page follow the same style?", false});
m_particles[stream4.id].append({"p29", "text", "[email protected]", "yes definitely, keeping it consistent across all pages", false});
m_particles[stream4.id].append({"p30", "image", "[email protected]", "cool, here's my wireframe draft", false});
m_particles[stream4.id].append({"p31", "text", "[email protected]", "looks great! can you add that to the figma file?", false});
// Stream: Archive
Stream stream5;
stream5.id = "stream-archive";
stream5.name = "anthem-project";
stream5.status = Stream::CLOSED;
stream5.unseenCount = 0;
m_streams[net2.id].append(stream5);
// Particles for Archive
m_particles[stream5.id].append({"p32", "text", "[email protected]", "so we're officially deprecating the old API next week", true});
m_particles[stream5.id].append({"p33", "text", "[email protected]", "yep, all clients have migrated to v2", true});
m_particles[stream5.id].append({"p34", "text", "[email protected]", "great work everyone! this project was a long journey", true});
m_particles[stream5.id].append({"p35", "link", "[email protected]", "https://docs.flowy.com/api/v1-migration-guide", true});
m_particles[stream5.id].append({"p36", "text", "[email protected]", "should we keep the docs around for a bit?", true});
m_particles[stream5.id].append({"p37", "text", "[email protected]", "yeah i'd say 6 months, then archive everything", true});
m_particles[stream5.id].append({"p38", "text", "[email protected]", "agreed. i'll set a reminder", true});
m_particles[stream5.id].append({"p39", "text", "[email protected]", "also documented all the lessons learned", true});
m_particles[stream5.id].append({"p40", "text", "[email protected]", "nice! that'll be super helpful for future projects", true});
m_particles[stream5.id].append({"p41", "text", "[email protected]", "alright, marking this stream as closed. good job team!", true});
}
const QList<Network>& Data::networks() const
{
return m_networks;
}
const QList<Stream>& Data::streamsForNetwork(const QString &networkId) const
{
static QList<Stream> emptyList;
auto it = m_streams.find(networkId);
if (it == m_streams.end())
{
return emptyList;
}
return it.value();
}
const QList<Particle>& Data::particlesForStream(const QString &streamId) const
{
static QList<Particle> emptyList;
auto it = m_particles.find(streamId);
if (it == m_particles.end())
{
return emptyList;
}
return it.value();
}
int Data::networkCount() const
{
return m_networks.size();
}
int Data::streamCount(const QString &networkId) const
{
return m_streams.value(networkId).size();
}
int Data::particleCount(const QString &streamId) const
{
return m_particles.value(streamId).size();
}