Launching external editor in GTKmm - c++

i am writing (using C++ and GTKmm) a simple photo browser that is available on GitHub:
https://github.com/jjkrol/ZPR
Currently i am working on creating a button, which will allow user to open currently displayed photo in external editor (for example GIMP). Because of this, i have two questions:
Are there any examples of using Gtk::AppChooserDialog class? I couldn't find any and it's hard to start working on choosing the editor without them.
Most important question - i am thinking about a way to launch an application with photo in command line. The only solution that comes to my mind is using system() call to do something like this: system("gimp /path/to/current/photo.jpg"); , but it is probably not the best way of doing this. Anybody knows a better way? I would like to port my application to Windows someday and a more portable way would be great.
Thank you very much in advance.

Instead of system, you might want to use Glib::spawn_command_line_async. There are other similar functions that gives more control if you need it.
For examples, you might want to look the source code of an application like glom.

Thank you very much for answers, gpoo and ergosys! In the end i decided to use Gio::Appinfo as it looks more OOP-like. If anyone would face the same problem - this is what i have end up with:
Glib::RefPtr<Gio::AppInfo> editor = Gio::AppInfo::create_from_commandline("gimp",
"GIMP", Gio::APP_INFO_CREATE_SUPPORTS_URIS);
Glib::RefPtr<Gio::File> photo = Gio::File::create_for_path(
(*currentPhoto)->getPath().string());
editor->launch(photo);
Of course choosing the editor with Gtk::AppChooserDialog is not yet implemented.

Related

Is there a way to write to a file in online CMS from a local C++ program?

I created a very customized leaflet map on a Bitrix website (they forced me to, not my choice). Now other coworkers who are basically "afraid" of code need to be able to add markers to that. I already created a C++ program where they can simply enter all the details they want (what category, whats the popupcontent etc.) and it spits out the geoJSON code for the marker for them to copy and paste into the website.
To make it even more easy for them I am wondering if there is a way to basically have my program connect to the internet, go to the backend of my website and, after asking for login, adds the code to the respective .js file that contains only the marker code.
I have been googling the problem but unfortunately couldnt find any other related posts.
Okay I finally found the I guess easiest way, I will force my colleagues to install python and write a little thingy to concatenate the code and upload it using Selenium. Thanks for your help guys!

How can I get direct keyboard input in cpp? (cross platform)

I want to be able to control the program with direct input without pauseing the program and without waiting for the user to press enter.
I can currently achieve this with kbhit, but it appears that is a windows only solution.
Ncurses also looks promising, but it appears to only work for linux (and maybe mac? Is unix the structure mac is based on?).
I especially like the kbhit for it's simplicity, and I like the tool set that ncurses, but I was wondering if there was a simple, easy way to get something running cross-platform without having to maintain essentially 2-3 versions of the code using these different tools?
I figured out my problem. I'm trying to do many things that cpp was never intended to do by default, so the options are to use libraries like allegro, or, in my case it turns out what I needed was a game engine. I found that Unity with text mesh pro can do everything I need it to. It comes with an entire input management system.

Legends on graphs

I am new to using C++, and I have been trying to plot some basic graphs that include legends in them. I have been googling to find ways to do this, and found that chplot.h can do this, like in the link below:
http://www.softintegration.com/docs/ch/plot/
I want to download this header file online, but can't seem to find it. Is there a website that can do this? Or is there another header file that allows you to plot a legend on a graph?
Thanks very much!
A header file itself will most likely not allow you to do anything. You'd need the whole library (Ch professional in this case) for that. Have you read through the site you link to?
Anyway, they say they're based on GNUplot, so you might want to investigate that.
On the other hand, if you want to learn C++ rather than just use it for one particular task, there are easier and better suited problems to start with.

Showing text messages in augmented reality applications with ARToolkit

I would like to implement a simple AR desktop application. This application should first recognize a marker out of a set of pre-registered ones, and then, show on screen some particular information related to the detected marker.
I was thinking on using ARToolkit, even if it is quite old and not anymore supported.
Do you think ARToolkit is a good solution?
How can I show text messages on screen using ARToolkit?
I found an interesting article here http://mycodelog.com/2010/03/23/printw/.
It easily explains how to implement a "printw" function that works exactly like printf.
osgART could be helpful http://osgart.org/wiki/index.php/Main_Page

How can I develop a virtual drive

I would like to create a virtual drive for windows. I'm not looking to map a drive or something like that, I'm looking to map it to my DLL functions or something of that sort.
How can I get this accomplished?
I read that I would have to develop a device driver, or a shell extension?
I have a lot of experience with C++ and C#. Where do I get started?
I want to make it as simple as possible at first, how much time do I think it would take me? And what's the simplest way to do it, so that I could build my prototype.
My motivation is to pipe a file into an application, that currently only reads files from the file system. I'm only interested in pumping 1 file, so I think that a whole virtual drive would be an overkill, as well as writing kernel mode code.
If you want to build it from scratch then yes, you have to build a driver. However, it would be much easier for you to use a proxy driver like Dokan, and create the file system in user mode.
Take a look at the Wikipedia article on IFS, there are links to other useful tools at the bottom of the page.
I don't know what it worth, and it's not open source, but I've found this. It's a "fuse" like for windows