Hi all,
These two patches implement a single instance LyX.
Nice work!
I can add some preference options.
- What kind of preference do we need ?
A preference to enable or disable this kind of behavior. So:
if (lyxrc.single_instance && pimpl_->application_->isRunning()) {
...
- Do we want to include the code for QtSingleApplication in our tree ?
What is the alternative?
- We then depend on QtNetwork.dll/lib and should be included in the installers.
- The actual action to be taken by the instance has to be implemented stil.
Comments ?
On the issue of whether it is included in 2.0, looking at the
QtSingleApplication class, it seems to be a pretty simple extension of
QApplication, so I don't think the switch is likely to cause problems.
Still, it needs testing. I would think you could #if most of the
necessary code fairly easily, and then people can try if it they like,
as we did for EXPORT_in_THREAD. The one thing I would do is put the
preference setting in now in LyXRC.cpp, but with no UI for setting it.
Then, even if we thought it wasn't ready for 2.0, it could still get
into the 2.0.x series, since we'd have done the format change. The
preference could be enabled by default, for now, since anyone who
compiles with USE_SINGLE_INSTANCE=1 will surely want it on, and of
course they can disable it by editing the prefs file.
Even better, in a way, would be to make the configurable via ./configure
--enable-single-instance. Then packagers could choose what to do. I
think single instance makes a lot of sense on Windows, less so on Linux,
since it's easy to get that behavior if you want via scripts.
Richard