6 ms·
Is there a solution better than implementing OS-specific GUI to provide native look and feel? I was thinking about that and came to the conclusion that the best
by grn 13y ago
Is there a solution better than implementing OS-specific GUI to provide native look and feel? I was thinking about that and came to the conclusion that the best thing we can do is to separate the business logic from the GUI. We can then equip the application with a CLI, a GTK GUI, a Qt GUI, etc.
- bluedino 13y agoThat's what is suggested by this blog: http://blog.backblaze.com/2008/12/15/10-rules-for-how-to-write-cross-platform-code/ http://blog.backblaze.com/2008/12/15/10-rules-for-how-to-wri... Rule #2: Factor out the GUI into non-reusable code – then develop a cross-platform library for the underlying logic I'd like to hear others experiences and views with doing that as opposed to using something like QT or GTK.
- bcoates 13y agoThat link has some solid advice. I had to learn a lot of that the hard way.
- ballard 13y agoThis makes sense, since vying for cross-platform tends to result in awkward experiences like the windows Treo. Using MVC, it's more straightforward what components are specialized per OS and which ones are common. Not only that, having native apps would make the app UX "feel" better too.
- erichocean 13y agoThat's exactly how the iOS app I'm building right now is factored, specifically so that all of the networking/model layer/sync code is identical between iOS and Android. I'm using libuv, SQLite, CurveCP/NaCl and MessagePack for the cross-platform stuff, and the rest of the code is straight C (which I prefer to C++). So far, it's working well, although it did require more effort to set up initially, primarily due to multi-threading.
- AnthonBerg 13y agoQt is very very good at being non-OS-specific. Qt is also a lot more than a GUI toolkit. Until something major changes, me, my colleagues, and my company made the decision to just use Qt. You can do CLI and very very good cross-platform GUIs. Qt is underappreciated.
- CrLf 13y agoThe last time I built something on Qt was some 10 years ago, but it was the only time where I really enjoyed programming in C++. Underappreciated indeed.
- landr0id 13y agoQt 5.2 also adds Windows, Mac, and Android extras (platform-specific things for a native feel) [1]. For example, on Windows you can set the task bar progress, and on OS X you can use some native components, such as the toolbar. The OS X documentation is poor, but there is a GitHub repo/mirror for it [2] [1] http://blog.qt.digia.com/blog/2013/09/30/qt-5-2-alpha-available/ http://blog.qt.digia.com/blog/2013/09/30/qt-5-2-alpha-availa... [2] https://github.com/qtproject/qtmacextras https://github.com/qtproject/qtmacextras
- cbhl 13y agoThis was the approach that Transmission used, although it gets kind of weird at times. (The GTK and Qt interfaces can be used with the server/CLI bit built-in, or you can attach them over an HTTP/JSON RPC to a headless server; there is a CLI command (distinct from the server) that runs standalone, and there is a different CLI command that connects to a server over the HTTP/JSON RPC and controls it; some subset of the clients and the headless server come with a web interface that manipulates the "server" bits using HTTP/JSON etc.) Assuming that you solve the CLI bits, using Qt is probably reasonable enough for all your GUI users that aren't running pure GNOME/GTK systems -- at one point in the past, Qt could even make itself look like the current GTK theme (although I'm not sure if that's still true now).
- sho_hn 13y agoIt's still true today. Qt bundles a style engine plugin that calls into the currently active GTK+ theme. Qt also has a concept of "platform plugins" that make it DE-aware and pick up various behaviors that go beyond looks.
- wmf 13y agoI prefer native UIs, but does Wireshark have people willing to write separate Linux, Mac, and Windows UIs?
- RivieraKid 13y agoYes, SWT, but it's Java-only.
- hcarvalhoalves 13y agoWell, for CLI there's `tshark`[1][2], of limited usefulness but could be used to build a GUI on top. http://www.wireshark.org/docs/man-pages/tshark.html http://www.wireshark.org/docs/man-pages/tshark.html http://www.youtube.com/watch?v=JZDiQ6f_TRs http://www.youtube.com/watch?v=JZDiQ6f_TRs