Re: [LyX/master] Enable QWindowsMimeMetafile with Qt6

2021-10-17 Thread Kornel Benko
Am Sun, 17 Oct 2021 19:21:52 +0200
schrieb Enrico Forestieri :

> On Sun, Oct 17, 2021 at 04:16:22PM +0200, Kornel Benko wrote:
> > Am Sun, 17 Oct 2021 15:29:09 +0200
> > schrieb Enrico Forestieri :
> >   
> > > On Sun, Oct 17, 2021 at 02:48:31PM +0200, Enrico Forestieri wrote:  
> > > > commit 771f30e9463d8d7bf7acd4dfc564f462b28eae16
> > > > Author: Enrico Forestieri 
> > > > Date:   Sun Oct 17 15:06:05 2021 +0200
> > > > 
> > > > Enable QWindowsMimeMetafile with Qt6
> > > > 
> > > > The QWinMime class has been removed in Qt6 but the functionality
> > > > is still present. However, one has to allow inclusion of private
> > > > headers and register the mime handling to the QWindowsApplication
> > > > native interface.
> > > 
> > > Kornel, according to
> > > https://www.qt.io/blog/qt-extras-modules-in-qt-6#qwinmime
> > > to enable private headers with cmake one has to add a project dependency
> > > to Qt::GuiPrivate. I honestly don't know how to do that. This only
> > > matters for Windows and after this commit compilation cannot succeed
> > > when configuring with cmake if private headers are not enabled.
> > >   
> > 
> > My only idea is to use
> > if (MINGW AND LYX_USE_QT MATCHES "QT6")
> > add_dependencies(${_lyx} Qt::CorePrivate Qt::GuiPrivate)
> > endif()
> > somewhere at src/CMakeLists.txt:125  
> 
> That did not work. However, I found a solution here:
> https://stackoverflow.com/questions/65060435/add-qt-private-headers-to-cmake-project
> and committed the corresponding patch at e8b366d4.
> 

Thanks.

Kornel


pgpCxWKvjZj3R.pgp
Description: Digitale Signatur von OpenPGP
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Enable QWindowsMimeMetafile with Qt6

2021-10-17 Thread Enrico Forestieri
On Sun, Oct 17, 2021 at 04:16:22PM +0200, Kornel Benko wrote:
> Am Sun, 17 Oct 2021 15:29:09 +0200
> schrieb Enrico Forestieri :
> 
> > On Sun, Oct 17, 2021 at 02:48:31PM +0200, Enrico Forestieri wrote:
> > > commit 771f30e9463d8d7bf7acd4dfc564f462b28eae16
> > > Author: Enrico Forestieri 
> > > Date:   Sun Oct 17 15:06:05 2021 +0200
> > > 
> > > Enable QWindowsMimeMetafile with Qt6
> > > 
> > > The QWinMime class has been removed in Qt6 but the functionality
> > > is still present. However, one has to allow inclusion of private
> > > headers and register the mime handling to the QWindowsApplication
> > > native interface.  
> > 
> > Kornel, according to
> > https://www.qt.io/blog/qt-extras-modules-in-qt-6#qwinmime
> > to enable private headers with cmake one has to add a project dependency
> > to Qt::GuiPrivate. I honestly don't know how to do that. This only
> > matters for Windows and after this commit compilation cannot succeed
> > when configuring with cmake if private headers are not enabled.
> > 
> 
> My only idea is to use
>   if (MINGW AND LYX_USE_QT MATCHES "QT6")
>   add_dependencies(${_lyx} Qt::CorePrivate Qt::GuiPrivate)
>   endif()
> somewhere at src/CMakeLists.txt:125

That did not work. However, I found a solution here:
https://stackoverflow.com/questions/65060435/add-qt-private-headers-to-cmake-project
and committed the corresponding patch at e8b366d4.

-- 
Enrico
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: Setting up a development env on macOS big sur (M1)

2021-10-17 Thread Stephan Witt
Am 14.10.2021 um 16:38 schrieb Nusret BALCI :
> 
> Hi there,
> How can I set up my development environment to be able to compile a git 
> cloned lyx sourcecode directory? 
> I have XCode installed. My OS is Big Sur. I installed Homebrew and autotools. 
> I downloaded QT 6.2 (official release from Qt). I run autogen, then configure 
> script. But I am not sure what command line arguments I should pass and 
> although I pass the bin directory of the Qt installation (6.2.0) it cannot 
> find Qt. So I can't even start. Anyone willing to help or share their build 
> command?

Hi Nusret,

I’m regularly using Qt5 for my builds on Mac. Last time I tried Qt6 it was 
Qt6.0 and it was incomplete for Mac development. Now you’re asking I’ve had a 
look at Qt 6.2. Guess what - I’m unable to build like you. I’m afraid I have to 
inspect the details of the problem. I’m sure I get them because of my scripts 
are doing the build of multi-architecture Qt frameworks (usable for both the 
Intel and ARM processors) and the recipe to do it has changed from Qt5 to Qt6. 
I have to investigate and my scripts are not ready for Qt 6.x.

But the recipe for a single architecture LyX build with home brew from Christop 
Schmitz should work for you. If not you may show us your error messages.

Best regards,
Stephan
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [PATCH] Re: Weird compile result -- bug?

2021-10-17 Thread Richard Kimberly Heck

On 10/17/21 05:34, Jürgen Spitzmüller wrote:

Am Samstag, dem 16.10.2021 um 12:30 -0400 schrieb Richard Kimberly
Heck:

As I tried to explain this is not due to preamble edits per se,
but due
to doing any change in document preferences. As biber is not
available,
it cannot be (re-)selected in settings. All we could do about
that is
issue a warning.

I think this would be an adequate solution.

The attached patches implement a better solution:

* LyX does _not_ change document settings silently. Rather than that,
it keeps the current setting but indicates it is not available, like we
do for document classes, e.g. "biber (not available)". This prevents
unwanted changes on document sharing (patch 0002).


I was going to suggest this, but didn't want to create more work for you!

Riki


--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [PATCH] Re: Weird compile result -- bug?

2021-10-17 Thread Richard Kimberly Heck

On 10/17/21 11:15, Jürgen Spitzmüller wrote:

Am Sonntag, dem 17.10.2021 um 11:34 +0200 schrieb Jürgen Spitzmüller:

Could somebody please commit to master? I still cannot connect to the
git server.

I solved the connection issues and will commit myself.


Riki, this might also be candidate for stable. If you think so,
please cherry-pick.

Just let me know, I can do that.


Please go ahead.

Riki


--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: Error when compiling LyX under macOS

2021-10-17 Thread Enrico Forestieri
On Sat, Oct 16, 2021 at 02:58:19PM +0200, Kornel Benko wrote:
> Am Sat, 16 Oct 2021 14:50:54 +0200
> schrieb pdv :
> 
> > A similar modification is needed when building with CMake on MacOS.
> > 
> > I've included module SvgWidgets with qt6 and MacExtras with previous 
> > versions (I have checked builds on MacOS with qt6 and qt5, but not with 
> > qt4). (patch included)
> > I have also not touched the windows code which will probably show the 
> > same problem.
> > 
> > Patrick
> > 
> > [qt6svgwidgetspatch20211016.diff  text/plain (801 Bytes)] 
> 
> Looks good, please commit.

I have committed a fix valid for all platforms at 3048878e.

-- 
Enrico
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [PATCH] Re: Weird compile result -- bug?

2021-10-17 Thread Jürgen Spitzmüller
Am Sonntag, dem 17.10.2021 um 11:34 +0200 schrieb Jürgen Spitzmüller:
> Could somebody please commit to master? I still cannot connect to the
> git server.

I solved the connection issues and will commit myself.

> Riki, this might also be candidate for stable. If you think so,
> please cherry-pick.

Just let me know, I can do that.

Jürgen



signature.asc
Description: This is a digitally signed message part
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Enable QWindowsMimeMetafile with Qt6

2021-10-17 Thread Kornel Benko
Am Sun, 17 Oct 2021 15:29:09 +0200
schrieb Enrico Forestieri :

> On Sun, Oct 17, 2021 at 02:48:31PM +0200, Enrico Forestieri wrote:
> > commit 771f30e9463d8d7bf7acd4dfc564f462b28eae16
> > Author: Enrico Forestieri 
> > Date:   Sun Oct 17 15:06:05 2021 +0200
> > 
> > Enable QWindowsMimeMetafile with Qt6
> > 
> > The QWinMime class has been removed in Qt6 but the functionality
> > is still present. However, one has to allow inclusion of private
> > headers and register the mime handling to the QWindowsApplication
> > native interface.  
> 
> Kornel, according to
> https://www.qt.io/blog/qt-extras-modules-in-qt-6#qwinmime
> to enable private headers with cmake one has to add a project dependency
> to Qt::GuiPrivate. I honestly don't know how to do that. This only
> matters for Windows and after this commit compilation cannot succeed
> when configuring with cmake if private headers are not enabled.
> 

My only idea is to use
if (MINGW AND LYX_USE_QT MATCHES "QT6")
add_dependencies(${_lyx} Qt::CorePrivate Qt::GuiPrivate)
endif()
somewhere at src/CMakeLists.txt:125

Sorry, I am only fishing in muddy waters ...

Kornel


pgpD7by4rq9sr.pgp
Description: Digitale Signatur von OpenPGP
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Enable QWindowsMimeMetafile with Qt6

2021-10-17 Thread Enrico Forestieri
On Sun, Oct 17, 2021 at 02:48:31PM +0200, Enrico Forestieri wrote:
> commit 771f30e9463d8d7bf7acd4dfc564f462b28eae16
> Author: Enrico Forestieri 
> Date:   Sun Oct 17 15:06:05 2021 +0200
> 
> Enable QWindowsMimeMetafile with Qt6
> 
> The QWinMime class has been removed in Qt6 but the functionality
> is still present. However, one has to allow inclusion of private
> headers and register the mime handling to the QWindowsApplication
> native interface.

Kornel, according to
https://www.qt.io/blog/qt-extras-modules-in-qt-6#qwinmime
to enable private headers with cmake one has to add a project dependency
to Qt::GuiPrivate. I honestly don't know how to do that. This only
matters for Windows and after this commit compilation cannot succeed
when configuring with cmake if private headers are not enabled.

-- 
Enrico
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


[PATCH] Re: Weird compile result -- bug?

2021-10-17 Thread Jürgen Spitzmüller
Am Samstag, dem 16.10.2021 um 12:30 -0400 schrieb Richard Kimberly
Heck:
> > > As I tried to explain this is not due to preamble edits per se,
> > > but due
> > > to doing any change in document preferences. As biber is not
> > > available,
> > > it cannot be (re-)selected in settings. All we could do about
> > > that is
> > > issue a warning.
> 
> I think this would be an adequate solution.

The attached patches implement a better solution:

* LyX does _not_ change document settings silently. Rather than that,
it keeps the current setting but indicates it is not available, like we
do for document classes, e.g. "biber (not available)". This prevents
unwanted changes on document sharing (patch 0002).

* on compilation of such documents, LyX tries to fall back to a
sensible available compiler (e.g. biber -> bibtex8) and warns the user
about that, suggesting to install the missing compiler (patch 0001).

I think this addresses Paul's concerns as good as it gets.

Could somebody please commit to master? I still cannot connect to the
git server.

Riki, this might also be candidate for stable. If you think so, please
cherry-pick.

Thanks,
Jürgen

From 4106fdfc522e1bf28da80ac3ddfe601569318f8f Mon Sep 17 00:00:00 2001
From: Juergen Spitzmueller 
Date: Sun, 17 Oct 2021 11:30:24 +0200
Subject: [PATCH 2/2] Do not change bibliography processor to default if it is
 not found

Rather than that, keep it with a warning that it is not available.
Fallback procedure (which maintains security measures) is done in
the conversion step.

This prevents document properties being silently changed on sharing.
---
 src/frontends/qt/GuiDocument.cpp | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/frontends/qt/GuiDocument.cpp b/src/frontends/qt/GuiDocument.cpp
index 9389272335..8f8661c5b2 100644
--- a/src/frontends/qt/GuiDocument.cpp
+++ b/src/frontends/qt/GuiDocument.cpp
@@ -3996,17 +3996,17 @@ void GuiDocument::paramsToDialog()
 	string options =
 		split(bp_.bibtex_command, command, ' ');
 
-	int const bpos = biblioModule->bibtexCO->findData(toqstr(command));
-	if (bpos != -1) {
-		biblioModule->bibtexCO->setCurrentIndex(bpos);
-		biblioModule->bibtexOptionsLE->setText(toqstr(options).trimmed());
-	} else {
-		// We reset to default if we do not know the specified compiler
-		// This is for security reasons
-		biblioModule->bibtexCO->setCurrentIndex(
-			biblioModule->bibtexCO->findData(toqstr("default")));
-		biblioModule->bibtexOptionsLE->clear();
+	int bpos = biblioModule->bibtexCO->findData(toqstr(command));
+	if (bpos == -1) {
+		// We add and set the unknown compiler, indicating that it is unavailable
+		// to assure document compilation and for security reasons, a fallback
+		// will be used on document processing stage
+		biblioModule->bibtexCO->addItem(toqstr(bformat(_("%1$s (not available)"),
+			from_utf8(command))), toqstr(command));
+		bpos = biblioModule->bibtexCO->findData(toqstr(command));
 	}
+	biblioModule->bibtexCO->setCurrentIndex(bpos);
+	biblioModule->bibtexOptionsLE->setText(toqstr(options).trimmed());
 	biblioModule->bibtexOptionsLE->setEnabled(
 		biblioModule->bibtexCO->currentIndex() != 0);
 
-- 
2.33.0

From 5be89422751e8ba6c9389f4019e19b2609d74357 Mon Sep 17 00:00:00 2001
From: Juergen Spitzmueller 
Date: Sun, 17 Oct 2021 11:29:18 +0200
Subject: [PATCH 1/2] Provide proper fallback if a bibliography processor is
 not found

Check for appropriate fallbacks and warn user if the requested
bibliography processor is unavailable.
---
 src/BufferParams.cpp | 66 ++--
 src/BufferParams.h   |  5 +++-
 src/Converter.cpp|  2 +-
 src/LaTeX.cpp|  2 +-
 4 files changed, 69 insertions(+), 6 deletions(-)

diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp
index d9fb39e3b6..a41a570751 100644
--- a/src/BufferParams.cpp
+++ b/src/BufferParams.cpp
@@ -3612,11 +3612,71 @@ vector BufferParams::citeStyles() const
 }
 
 
-string const BufferParams::bibtexCommand() const
+string const BufferParams::getBibtexCommand(string const cmd, bool const warn) const
+{
+	// split from options
+	string command_in;
+	split(cmd, command_in, ' ');
+
+	// Look if the requested command is available. If so, use that.
+	for (auto const & alts : lyxrc.bibtex_alternatives) {
+		string command_prov;
+		split(alts, command_prov, ' ');
+		if (command_in == command_prov)
+			return cmd;
+	}
+
+	// If not, find the most suitable fallback for the current cite framework,
+	// and warn. Note that we omit options in any such case.
+	string fallback;
+	if (useBiblatex()) {
+		// For Biblatex, we prefer biber (also for Japanese)
+		// and try to fall back to bibtex8
+		if (lyxrc.bibtex_alternatives.find("biber") != lyxrc.bibtex_alternatives.end())
+			fallback = "biber";
+		else if (lyxrc.bibtex_alternatives.find("bibtex8") != lyxrc.bibtex_alternatives.end())
+			fallback = "bibtex8";
+	}
+	// For classic BibTeX and as last resort for biblatex, try bibtex