Introduce the new FileName method ensureExtension, which does the following:
* if the extension is already correct (in a case-insensitive way), do nothing.
* if it is not correct, add the extension to the file name.
This is different from changeExtension that will fail in a case where
the file contains dots, but not a real extension, like newfile2.1.
Use this new method in renameBuffer() and exportBufferAs().
Fixes bug #11008.
In FindAdv we use Qt to interpret regular expressions.
Regex uses for instance '\w', '\d' etc.
'\d' finds not just '0-9' but also e.g. '߂' (Nko Digit Two: U+07c2)
'\w' includes also such numbers.
ATM, only FindAdv uses this function.
With the debug-level 'find' there are now less output.
The original output can be received now with debig-level 'findverbose'
Also constructions like
LYXERR(Debug::FIND|Debug::FINDVERBOSE, "...");
are now possible.
It is not a good idea to contruct a QChar from a char_type that is
really 32bits.
Use lyx::isSpace, which already catters for this case.
Since this code does not depend on qt anymore, move it to
support::countExpanders.
Get rid of Row::countSeparators, which is not used anymore.
Fixes bug #12519.
This ensures that we use a consistent Python interpreter in LyX.
$${python} is replaced by the Python version found.
Users can apply this in preferences and use the same version defined by
LyX.
We could not figure out the root issue, or at least not to the point
where we felt changing this code considering we could not trigger
any bug from a user perspective.
For now, we just add a comment in the code.
For more information, see our ML discussion here:
https://www.mail-archive.com/search?l=mid&q=20211227113249.53bf5a63%40admin1-desktop
This fixes two performance issues and improves the performance of
TextMetrics::redoParagraph by 15% in a workload that uses the cache a
lot. The difference will be much less when the cache is not used much.
1/ repetion of the hash code computation
The code
if (cache.contains(key))
result = cache[key]:
is not efficient, since qHash(key) has to be computed twice.
To fix this a new Cache::object_str() method is added, which allows
if (auto * obj = cache.object(key))
result = *obj;
2/ code of has code computation
Instead of using a verbose string that is complicated to build as
key, new key structs BreakAtKey and TextLayoutKey are introduced,
along with the relevant qHash() implementation.
I wanted to remove the test Qt >= 5.15, but now I see that it is
not possible because of QProcess::splitCommand.
Neverthless, the best would be to change parsecmd.
Add new funciton Debug::badValue, that returns the first bad value in a debug
setting string.
Use it to parse the -dbg comand line option and to control the
execution of the debug-level-set lfun.
Use range-based loops in a few places.
Patch from P. De Visschere
Citing:
I also must exclude the QMacPasteboardMimeGraphics class in
GuiApplication.cpp since QMacPasteboard is not available anymore with qt6.
and add an #include <QStandardPaths> in support/Package.cpp (I suppose
this will pose no problem for qt5 but have not checked it, it's only
needed with USE_MACOSX_PACKAGING)
This commit allows compiling LyX with Qt6 when using autotools.
For a successful compilation the following 2 conditions must be met.
1) The Qt6 qmake has to come first in PATH, so that the command
"qmake -v | grep -o 'Qt version .'" returns "Qt version 6".
2) The --enable-qt6 switch has to be passed to the configure command.
If --enable-qt6 is used but Qt6 is not found, Qt5 is tried as a fallback.
If also Qt5 is not found, configuring for Qt4 is attempted.
If --enable-qt6 is not used, then things go as usual. This means that Qt5
is tried first and then Qt4, unless --disable-qt5 is used, in which case
Qt4 is directly attempted. This means that existing scripts should
continue working unmodified.
LyX should compile with Qt6 on windows and linux, and possibly also on
mac, but I could not test that. However, it is not guaranteed that it
works as it should. In particular I am not sure that I got right the
conversion from QRegExp to QRegularExpression. For sure, the syntax
highlighting seems to not work right. Someone in the know should take
a look at that. I am able to load documents and compile them but some
thourough testing is needed. However, when compiling for Qt5 or Qt4,
I tried to make sure that the functionality is preserved.
This is a variant of Input for layout files that only searches build
and system directories and thus allows "InputGlobal name.inc" in a user
file name.inc that attempts to modify its global counterpart.
At the moment, there is no support for plurals and capitalization.
A long comment explains why. Support could be added for that without
a format change.
References to environment variables embedded in a filename are expanded
and replaced by their value. However, if a variable does not exist, its
reference is simply erased from the filename, causing havoc (see #7801).
This has been like that since ever and cannot be changed, both for
backward compatibility and because this feature is currently used in
the Windows installer.
A possible backward compatible strategy is leaving as is the reference
to the environment variable (introduced by a $ sign) in the filename
if it does not exist. This is done in this patch, which also assumes
that an escape character is never used in a filename (inserting a $ in
the filename is easy, but I don't think one is able to easily insert
an escape character).