Posting from c++, fltk GUI.
Next up is grabbing and showing the timeline, then all the other stuff needed. :)
Was fast to get this up and running, and nice to end the weekend with this working.
@stigatle@twtxt.net Nice 👌
Created the function that grabs the timeline.
Now I have to plan a bit to make the actual gui for it, I think I might try and create my own custom fltk widget that I can feed with the json reply, and then it will set itself up based on that.
Or maybe something simple at first - not sure yet.
Did some more work on the timeline stuff today, now I have added parsing of each status, so that I can get the data I need from each status (user, image url, text, links - all that stuff I need).
Working some more on timeline, trying to create a group widget and add label child widgets, those labels should then show the text for each status.
Okay, so it seems like the label\text I use for statuses does not like the strings from posts.
Especially if they contain html tags and such (which the often do), it just breaks the text.
I wonder what I can do with that.. I kinda want to not have html tags in the json reply.
Have to think a bit about how to solve it. Took a while to figure it out, the text was just garbled.
I created some long example strings with regular letters and such, to see if X number of posts would show up, and they did, but when I then replace my test strings with text from json - it goes all wrong again.
Okay, so was easier to solve (for now) then what I initially thought.
First thing I found was this:
https://stackoverflow.com/questions/49333136/removing-html-tags-from-a-string-of-text
This one did the trick:
std::regex tags("<[^<]*>");
std::regex_replace(std::back_inserter(outputString), inputString.begin(), inputString.end(), tags, "");
I will work more on it this weekend. I hope to tidy it up enough for a screenshot 😀
@stigatle@yarn.stigatle.no Can’t wait to see it 🤗
A lot of more work needs to be done, but at least now I got the basic timeline stuff done, took a good while to figure out how to solve it, but now I know. The reason why the statuses are cut short on some is because of html tags and stuff like that - c++ is a bit picky with strings and stuff like that. but I’ll get that sorted as well.
At least I can show the first screenshot. Keep in mind the GUI is not at all finished, I’m working on the basics first, implement all the features, then I work on finishing touches.
Soooo… Fltk uses @ symbol in strings to apply effects to text, now wonder I’ve been having issues with the timeline.. https://www.fltk.org/doc-2.0/html/group__symbols.html
@ is used for mentions and all that stuff, so well - it just breaks the strings in the labels.
@stigatle@twtxt.net Huh interestinf 🤔
Got some time for coding today, dog is resting a bit, and kids are busy.
Today I’m resuming on the timeline, I’ll see if I can fetch and show the avatars next to the statuses.
And I’ll see if I can get a reply button to work, also need to clean up stuff that I’ve done so far.
A bit of duplicate stuff that can be simplified etc.
Oh, and also image upload needs to be done.
Well, the code for getting and setting the avatar works.
I need to align things better though. But cool that it works.
@stigatle@yarn.stigatle.no Looking good 👌 Before long you’ll matc the experience on teh web 😅
Working on things again today, made the timeline layout a bit better, now I’ll work on the reply button, makes it more useful to use :)
The reply button works from my application! I think it’s really fun to work on this. Yarn’s great API makes it fast to to develop for! :)
I will spend a evening replacing the GUI library. FLTK is a pain when it comes to getting the strings the way I need them. I think Ill try gtkmm or nanogui.
I have cleaned up the timeline a bit, I like this much more.
I use the markdown text now, instead of the ‘text’ field in the json file, looks much cleaner.
I can work with this. One thing that I want to sort out next is the way the nicknames and url is shown.
Also links in posts should be clickable - not sure if the current labels support that, but I’ll try and figure it out somehow. Anyways - latest screenshot is attached here.. :)
@prologic@twtxt.net thank you!
Okay, so back at it today. I want to start and fix the text where nick and url is included, strip that away from the text being shown, makes the statuses much more cleaner. Also need to get started on clickable url’s somehow.
Also- refresh of the timeline needs to be fixed.
And threads would be nice to see as well, the list goes on and on :)
Timeline is cleaned up, so now I think I have that part sorted.
Next is to refactor a bit and then fix so that the timeline refreshes properly.
Once that is done I think I’ll clean it up and upload the source somewhere and create tickets for outstanding known issues. Most likely upload it to github and continue the work there.
Also - did a quick test on linux, it gave a lot of errors with the rapidjson library, so I have to find a way to work around that. I think I’ll pull the latest, then compile it - and then point to that - instead of installing the rapidjson-dev package. Maybe that’ll work.
Turns out the problem I had was also there when I build rapidjson from source, but if I moved the include to earlier (rapidjson in my project) - the problem went away, so I suspect it’s the same as in this issue going on.
The cool thing is that the client now works fine on linux without changing anything else then the include order!
So now I’ll do all development there - instead of on windows.
@stigatle@yarn.stigatle.no Good progress 👌 Hope you get the build working on all the platforms you care about 😆
@prologic@twtxt.net thank you! Openbsd is also one of my target platforms. Want to have it in the ports tree there as well, but Ill get to that a bit later.
@stigatle@yarn.stigatle.no It’ll be exciting to see for sure 👌
Got the timeline to refresh, now I need to add a timer for that, but for now I’ll just make a refresh button.
It’s not smart - so it grabs and adds the whole timeline again at this moment (but clears it first). Later I’ll make it so that it only appends new statuses that are not already in the list. But feels good to have this sorted, makes it much more usable.
@stigatle@yarn.stigatle.no Nice 👌
Time to get back at it, I want to fix so that when you hit ‘reply’ it will also add any mentioned user in the reply.
Been going back and forth on the gui, I will move away from FLTK and go for https://www.gtk.org/ instead.
I’ll spend tomorrow working on that. I need a more refreshing GUI then what I have now.
And also FLTK is a pain to get to work as I need - spend the whole afternoon trying to get it to use images (avatar etc) on my linux machine, and no matter what I’ve tried it refuses. So instead of wasting more time battling fltk I will switch to GTK.
Got the cmake file updated, compiles and now it opens a GTK window, need to add the timeline and buttons that I had in FLTK, the other code related to parsing the statuses and all that is independent from the GUI so it’ll be pretty quick to switch over once I have defined the new GUI elements.
Got some good progress on the GTK gui today, got the timeline to work!
Took some time to figure out how the UI layout stuff works, but it looks good now.
I will add the avatars next.
The way it is right now - I got this up and running in a couple of hours, instead of ‘days’ with FLTK.
So I’m glad I made the decision to switch to GTK,
Right now I’m doing all development on Trisquel OS, windows version will come later on.
Also - since I thought about the possibility that I wanted to switch early in the process the code that does all the work is UI independent, meaning this was easy to do. +1 for planning ahead.. :)
I will post a screenshot of the new UI soon, once it’s a bit polished.