Commit Graph

2204 Commits

Author SHA1 Message Date
Scott Kostyshak
bee08b19ee Typo in a comment 2023-01-05 23:33:16 -05:00
Stephan Witt
bbc2270972 #12523 check for existence of usable Python interpreter
- present appropriate alert message in case of missing Python
- add the option to quit LyX immediately
- recheck for Python interpreter on reconfigure if it was missing
2023-01-06 00:32:09 +01:00
Enrico Forestieri
e18709b176 Further amend fb7b7e52
This restores the previous behavior of runCommand().
When the child process could not be properly terminated the
error "RunCommand: could not terminate child process" was being
issued. However, in fb7b7e52 there was a misinterpretation
between this condition and the exit status of the child and
these two different errors were mixed up. They are now
disentangled again.
2022-12-11 15:06:22 +01:00
Enrico Forestieri
d7910e1870 Amend fb7b7e52
pclose() returns -1 only in specific cases, otherwise it returns the
exit status of the child, to be retrieved by the macro WEXITSTATUS.
2022-12-11 12:15:37 +01:00
Jean-Marc Lasgouttes
9376f0203d Merge branch 'killqt4'
Remove all trace of Qt4 support. The different elements have been
considered carefully before removal.

The only changes that need to be done concern Windows and macOS
compilation instruction and will need to be taken care of by the
respective maintainers before prerelease.

The file TODO.killqt4 lists what remains to be done.
2022-11-28 15:19:41 +01:00
Scott Kostyshak
6d4ab79917 Effectively disable the "Stop command?" dialog
We now allow the user to cancel the background process at any point
(via the red "x" in the status bar or Document > Cancel Export), so
we do not need to poll the user with the dialog.

The patch works by setting timeout to "-1" which is treated as a
special value to disable the poll.

Fix (by obviation) #12531 and #9953, which were about the dialog.
2022-11-25 10:25:40 -05:00
Scott Kostyshak
68c7953422 Change os::timeout from minutes to milliseconds
We can now specify the special value of "-1" milliseconds which is
interpreted as disabling the timeout.

No change of functionality intended.
2022-11-25 09:51:30 -05:00
Jean-Marc Lasgouttes
ac248e392d Get rid of Qt4 code in src/
Qt4 code has been identidifed by
  git grep -l 'QT_VERSION.*\(0x050000\|0x04\)' src

Uses of QT_VERSION_CHECK have been checked too.

been used to remember what places need further work.

Then remaining Qt4 references have been searched using
  git grep -i qt4
  git grep -i 'qt 4'
and relevant issues have been either fixed or noted in the new
TODO.killqt4 file.
2022-11-18 17:19:50 +01:00
Jean-Marc Lasgouttes
201c95a76e Handle multiple spaces at row break
In order to work around the Qt row breaking algorithm, which considers
multiple spaces as one at QTextLine break, we insert word_joiner unicode
characters beteween each pair of spaces.

The TextLayoutHelper class makes it easy to handle that.

Update Row::Element::rtrim() to only remove one space at row end.

Update support::countExpanders() to count all spaces, without special
handling for consecutive ones.

Fixes bug #10117.
2022-11-10 15:21:02 +01:00
Jean-Marc Lasgouttes
90ea508111 Fix pasting as LaTeX in documents with no modules
When there is no module, the old code would invoke tex2lyx with option
 -m
instead of
 -m ""
and an error would ensue.

This is because the QProcess command line parser used in Systemcall is
broken and does not recognize empty parameters as such. The solution
is to rewrite our parsecmd() parser to generate a list of parameters.
This is post-2.4.0 work.

The workaround used here is:

- set the list of modules to "," when it should be empty. In effect,
  this is a list of two empty modules.

- change tex2lyx to accept empty module names and ignore them; this is
  good in terms of robustness anyway.

Additionally, when there is no receiving buffer, set the defaults as
the BufferParams defaults instead of empty (this is cleaner, but
should not make a difference in practice).

In the long term, we should switch to use the QStringList-based API of
QProcess in Systemcall (see QTBUG-80640).
2022-11-06 13:20:02 +01:00
Jean-Marc Lasgouttes
a852423781 Revert "WIP: refactor Systemcall"
This reverts commit c8015878e1.

Committed by mistake obviously!
2022-10-28 18:04:45 +02:00
Jean-Marc Lasgouttes
c8015878e1 WIP: refactor Systemcall
**WARNING; only compilation has been ested; even that does not work**

The goal of this commit is to use the list-based API to
QProcess::start, to avoid annoying syntax issues (see issues with
pasting from LaTeX).

* Create a new latexEnvironment() in filetools.h that returns a
  map<string, string> containing the variables and their values.

* Rewrite parsecmd() so that it returns a QStringList of tokenized parameters.

* Use this in startProcess. This is the part is is not finished yet.

Obviously, this will not be possible to get right for 2.4.0.
2022-10-28 17:21:33 +02:00
Jean-Marc Lasgouttes
fff28c5756 Always qualify calls to std::move()
This quashes a new warning in clang++ 15, when std::move() (the
one-parameter version) is used as simply move(). There is a strong
recommendation from WG21 to avoid that.

Details here: https://reviews.llvm.org/D119670

It might be that we should not use that many move()s. I am not
competent to decide on that.

I also used this occasion to get rid of a spacial casing for C++11
that does not seem necessary after all.
2022-10-21 14:11:36 +02:00
Jean-Marc Lasgouttes
337cc97174 Use auto const & when possible to avoid copies
In several range-based for loops, implicit copies are made. Remove
that when possible, and try to shut converity up otherwise.

Fixes issues found by coverity.
2022-08-30 17:31:37 +02:00
Juergen Spitzmueller
9214f92599 Mode [un]locLengthString() methods to support/qstring_helpers 2022-08-09 17:27:53 +02:00
Stephan Witt
a89f2fd08c Make "open -a" implicit on macOS
Fix for bug #12570 - add simple check for app bundle name and prefix it with macOS open command if name matches
2022-08-08 10:36:46 +02:00
Jean-Marc Lasgouttes
61d68d05bd Add proper extension as needed in Save as and Export
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.
2022-07-25 22:52:07 +02:00
Kornel Benko
5f5a43eb9e Guard 'isNumberChar()' from char outside ucs4-range 2022-05-29 14:08:36 +02:00
Kornel Benko
82af8778f1 Introduce isNumberChar(char_type) function
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.
2022-05-29 12:16:53 +02:00
Jean-Marc Lasgouttes
6dd5656a2c pmprof: fix missing output in the 100% miss case
Also update to the latest version of pmprof.
2022-05-19 11:37:51 +02:00
Juergen Spitzmueller
e6a7137a53 Mark aliases in the description 2022-04-24 16:51:42 +02:00
Juergen Spitzmueller
64ec812da5 Amend d8f540f51
Properly handle aliases
2022-04-24 16:51:16 +02:00
Kornel Benko
3b7a79f137 FindAdv: Amend d09f5ce1: Added new debug level :findverbose
Fix the GUI handling for the new value using now 'unsigned long long' instead of 'int'
2022-04-24 13:27:36 +02:00
Juergen Spitzmueller
9318f1b338 Improve string 2022-04-19 15:12:56 +02:00
Kornel Benko
d09f5ce1d0 FindAdv, Debug: Added new debug level :findverbose
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.
2022-04-19 13:41:38 +02:00
Jean-Marc Lasgouttes
7cb700bf67 Fix crash with countExpanders in Qt6
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.
2022-04-08 12:14:41 +02:00
Enrico Forestieri
8496b7dc9a Compile fix 2022-03-05 02:19:38 +01:00
Thibaut Cuvelier
997f0621c5 Rename LATEX debug level to OUTFILE and use it for DocBook, HTML, and XML messages. 2022-03-01 16:05:42 +01:00
Thibaut Cuvelier
75be9b1200 Slightly simplify code by using for range. 2022-02-27 20:37:51 +01:00
Stephan Witt
6b0cd451fb #9287 query Standard User Defaults on mac and adjust cursor flash time accordingly 2022-02-20 13:06:54 +01:00
Enrico Forestieri
777ccce561 Fix bug #12466
Amend 109ea2be by reintroducing the command prefix that was
inadvertently removed. The prefix sets the proper environment
for latex.
2022-02-13 04:57:27 +01:00
Thibaut Cuvelier
1eb19cb8e3 Amend 109ea2be4a
The Windows code wasn't adapted when a variable was renamed (unlike the Linux one).
2022-02-06 05:35:07 +01:00
José Matos
109ea2be4a Add new placeholder $${python} to configure
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.
2022-01-04 00:21:34 +00:00
Stephan Witt
df990b1027 Guard new code for builds with OS X 10.11 SDK and lesser (part 2). 2022-01-01 18:47:57 +01:00
Stephan Witt
718b735dfe Guard new code for builds with OS X 10.11 SDK and lesser. 2022-01-01 18:46:32 +01:00
Scott Kostyshak
4bdb1ca4c2 Add comment regarding fsanitize + Clang issue
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
2021-12-30 11:39:04 -05:00
Thibaut Cuvelier
0b5e940723 Refactor file-name sanitisation.
For now, this is only used in FileName, because it does not change the semantics of DocFileName::mangledFileName.
2021-10-19 09:15:44 +02:00
Thibaut Cuvelier
789a537182 Refactor computing hashes.
For now, this is only used in FileName, because it does not change the semantics of DocFileName::mangledFileName.
2021-10-19 09:15:44 +02:00
Yuriy Skalko
a9119c3fa8 Remove redundant declarations reported by GCC with -Wredundant-decls option 2021-09-28 20:59:21 +03:00
Yuriy Skalko
325c405541 Remove redundant semicolons reported by GCC with -Wextra-semi option 2021-09-28 11:28:43 +03:00
Jean-Marc Lasgouttes
6bbd88accf Improve (modestly) the performance of font metrics caches
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.
2021-09-24 17:12:15 +02:00
Pavel Sanda
5dd96345ab Reformat mangled filenames for (xhtml) export to have them sorted. 2021-07-09 14:35:01 +02:00
Eugene Chornyi
e9d5fc0190 prevent Qt6 from defining UNICODE (Qt6.1.1 and upwards) 2021-06-19 10:48:49 +02:00
Jean-Marc Lasgouttes
67c85f54c4 Fixup 9f92fc92: improve FIXME in SystemcallPrivate::startProcess
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.
2021-05-20 13:20:20 +02:00
Juergen Spitzmueller
511ba894ff Fix toqstr(chart_type) with Qt6 (#12252) 2021-04-17 15:10:26 +02:00
Jean-Marc Lasgouttes
9ff27f8ce0 Produce an error on bad debug level values
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.
2021-03-26 17:55:54 +01:00
Kornel Benko
a9b0f5faae Cmake build with qt6 on MAC
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)
2021-03-26 13:11:44 +01:00
Kornel Benko
92a50fa273 Cmake build Qt6: Remove some redundant statements. 2021-03-24 11:42:39 +01:00
Kornel Benko
02a3705496 Amend 635a7d77: Allow compiling with Qt6 with cmake
Thanks Scott for checking.
TODO: Check compilation on Windows and Mac.
2021-03-22 16:19:10 +01:00
Enrico Forestieri
6fa973b377 Fix Qt6 deprecation warning about QString::fromUcs4 2021-03-21 17:15:08 +01:00