Commit Graph

741 Commits

Author SHA1 Message Date
Adriaan de Groot
f49627f417 [libcalamaresui] Improve sizeLimit handling in log upload
The log sizeLimit can be 0 (disable log upload) but that's
not so clear in the code. While here, tidy up and add
some comments to surprising bits.
2021-09-15 13:30:06 +02:00
Adriaan de Groot
6e0a8d8ca1 [libcalamaresui] Translate button texts for paste-message 2021-09-08 11:15:12 +02:00
Adriaan de Groot
dcfbb766dc [libcalamaresui] Use fixed standard-buttons labels
Move some of the texts to the new TranslationFix, from ViewManager,
and use them. Keep them in ViewManager, too, so that the translations
with context ViewManager are not removed just now.
2021-09-08 11:14:46 +02:00
Adriaan de Groot
683bad19fc i18n: introduce a "TranslationFix"
This is intended to apply translations to some common Qt UI components.

Example: a QMessageBox with standard buttons OK and Cancel; the text
for that is determined at startup using the system locale, and later
changes to the current locale or the current translation catalog,
do not affect OK and Cancel. It might be possible to load a catalog
with the right translation strings, except that there is no way to
know what the context or catalog **is** for the strings that are
used to label standard buttons: they can come from Qt base, or
the platform, or the theme. Merely loading the Qt Base translations
for the correct language does not help, because those translations
do not contain an "OK" string with the context used for standard
buttons.

Do the translation by hand; then we have all of the Calamares
languages covered, too, which is more than the Qt translations do.
2021-09-08 11:14:46 +02:00
Adriaan de Groot
38c65e80f3 [libcalamaresui] Warn when asking for nonexistent Branding instance 2021-08-24 11:57:37 +02:00
Adriaan de Groot
4114a2bbe8 CMake: chase renamed YAMLCPP 2021-07-26 15:08:29 +02:00
Adriaan de Groot
cbb1a5ef36 CMake: within Calamares repo, use the (eventual) imported names of libraries 2021-07-26 14:22:28 +02:00
Adriaan de Groot
59f11e9b67 i18n: make retranslator more consistent
- Improve naming.
- Both lambda and slot versions call the code immediately.
2021-07-24 23:26:02 +02:00
Adriaan de Groot
4b2b74bdbd [libcalamaresui] Do not link publicly to yamlcpp 2021-07-23 17:23:30 +02:00
Adriaan de Groot
acb731d823 [libcalamaresui] Provide the logFile path
This is intended for consumption by QML; the ViewManager object
acts as a proxy for a handful of global Settings values already,
so throw in global Logger values as well. A QML module that would
like to read the log file (e.g. for tailing it as part of a
slide-show) can get the path via this property.
2021-06-21 22:21:06 +02:00
Anubhav Choudhary
5691f95833 [logUpload] Added one more test 2021-04-02 23:50:41 -06:00
Anubhav Choudhary
b897619558 [logUpload] Added some basic tests 2021-04-02 07:40:03 -06:00
Anubhav Choudhary
c73e9ec89f [logUpload] Ran styleScript 2021-04-01 01:05:55 -06:00
Anubhav Choudhary
c1aa0b581e [logUpload] suggestionsAndFixes-part3
- Resolved the problem of incomplete log upload
- sizeLimit = 0 fixed (turns off paste functionality)
- Documentation update
- sizeLimit < 0 now needs no hardcoded upper limit
- Calamares::Branding::uploadServerFromMap() serves sizeLimit in bytes
2021-04-01 00:25:37 -06:00
Anubhav Choudhary
b42f86f20f [logUpload] suggestionsAndFixes-part2 2021-03-30 08:28:30 -06:00
Anubhav Choudhary
d109fc5856 [logUpload] suggestionsAndFixes 2021-03-30 08:13:29 -06:00
Anubhav Choudhary
6a6557e320 [logUpload] fixes 2021-03-29 13:22:56 -06:00
Anubhav Choudhary
6726a926a4 [logUpload] Configurable upload size limit
A key 'sizeLimit' added to uploadServer field in branding.desc to limit the size of logFile to upload.
2021-03-29 12:44:34 -06:00
Adriaan de Groot
779e5ecf8f [libcalamaresui] Factor out the pastebin UI
- offer a convenience method for showing a popup and
  URL information and copying the URL to the clipboard
- use that from ViewManager (on failure) and DebugWindow (on demand)
2021-03-19 14:17:34 +01:00
Adriaan de Groot
668921543a [libcalamaresui] Convenience method to check if paste would do anything 2021-03-19 13:36:40 +01:00
Adriaan de Groot
9341a84820 [libcalamares] Make the RETRANSLATE macros more statement-line
Require a ; after RETRANSLATE macros. They are statement-like;
this makes it easier for some of them to be recognized by
clang-format and resolves some existing weird formatting.
2021-03-16 14:55:26 +01:00
Adriaan de Groot
a90f510b85 [libcalamares] Convenience for logging subentries
For methods that log a bunch of things, and which want to
consistently use SubEntry, but don't know when the **first**
log entry is within the method, Logger::Once can be used
to log one regular message (with function info) and the
rest are subentries.
2021-03-15 22:45:29 +01:00
Adriaan de Groot
f8afb15c4c [libcalamaresui] Improve logging for QML modules
- mention which instance produces warnings
- tag additional debugging from the same method with Logger::SubEntry
2021-03-15 20:47:27 +01:00
Adriaan de Groot
1998405dbb [libcalamaresui] Fix up test for logfile
- this test would fail if the logfile already exists for
  any reason (including "I just ran the test")
- remove the file before expecting an empty logfile
- improve messages; a missing logfile is not a "things cannot
  work" situation, it's a warning
2021-03-14 21:37:31 +01:00
Adriaan de Groot
9f17d3fd12 [libcalamaresui] Paste the last 16KiB of the log file
- If Calamares is run more than once, reading the log file
  can get you older / not relevant log messages. Get the tail
  end instead.
2021-03-09 18:25:10 +01:00
Adriaan de Groot
a1ed303820 [libcalamaresui] Add test for Paste
This tests only the termbin ("fiche") paste by sending it
a derpy fixed string. Prints the resulting URL, doesn't
verify in particular.

It'd be rude to run this test too often.
2021-03-09 17:55:10 +01:00
Adriaan de Groot
44ec8a7c0b [libcalamaresui] Improve testability
- mark functions with STATICTEST so they can be compiled into a test
- move logfile-reading so we can call the pastebin-upload functions
  with an arbitrary payload.
2021-03-09 17:22:48 +01:00
Adriaan de Groot
846d6abaa8 [libcalamaresui] Move message- and clipboard handling
- The Paste API promises just a (string) URL back, not
  a whole message, so return just the URL from the
  abstract API and the concrete (fiche) implementation.
- Set clipboard contents from the UI
- Build (translated) message in the UI code
2021-03-09 15:51:24 +01:00
Adriaan de Groot
81badc36f4 [libcalamaresui] Implement abstract doLogUpload() API
This is a "do the right thing" function, which then calls
the implementation-specific code for each type.
2021-03-09 15:42:21 +01:00
Adriaan de Groot
1ff854f05d [libcalamaresui] Push upload to a more abstract API
- have a namespace Paste with just one entry point, which will handle
  untangling type &c.

This doesn't compile, but indicates the direction to take the API
2021-03-09 15:32:46 +01:00
Adriaan de Groot
efec12d001 [libcalamares] Read structured upload-server info
- Use just type and url, since port can be specified in
  a URL. Note that we only use host and port, not the
  scheme (or the path, for that matter).
- Factor out understanding the *uploadServer* key to a function.
2021-03-09 15:24:02 +01:00
Adriaan de Groot
bce6f3f1b7 [libcalamaresui] Adjust paste code to desired API
Still doesn't compile because consumers are not ready.
2021-03-09 14:56:37 +01:00
Adriaan de Groot
3c6683bd98 [libcalamaresui] Rip out untyped data about upload server
This doesn't compile, but indicates the **type** information
desired about the (a) upload server.
2021-03-09 14:51:59 +01:00
Adriaan de Groot
f72436aa0a [libcalamaresui] Drop RE-wrangling, compare hosts instead to detect valid paste URL 2021-03-09 14:41:58 +01:00
Adriaan de Groot
8af5fb5da5 [libcalamaresui] Simplify getting URL response
- get a QByteArray rather than going through a char[] buffer
- bytes-read is not important since the RE can only match if
  there **are** that many characters.
2021-03-09 14:38:43 +01:00
Adriaan de Groot
1bf95eacb0 [libcalamaresui] Tidy the logging some more 2021-03-09 14:33:47 +01:00
Adriaan de Groot
260862fabc [libcalamaresui] Move the format-string closer to where it is used 2021-03-09 14:31:46 +01:00
Adriaan de Groot
844831751d [libcalamaresui] Factor out the reading of the log file
- this will be needed for other pastebins, too
2021-03-09 14:30:20 +01:00
Adriaan de Groot
92e36558fa [libcalamaresui] Remove unnecessary shadowing in lambda 2021-03-09 14:25:40 +01:00
Adriaan de Groot
bc2435eb7d [libcalamaresui] Apply coding style 2021-03-09 14:23:52 +01:00
Adriaan de Groot
fc8830ae4a [libcalamaresui] Tidy logging 2021-03-09 14:23:27 +01:00
Adriaan de Groot
6a1e46d7f6 [libcalamaresui] Add properties to ViewManager to expose Settings 2021-03-03 16:06:53 +01:00
Adriaan de Groot
849da3f322 [libcalamaresui] The ViewManager is a UI component for QML, not core 2021-03-03 15:54:11 +01:00
Adriaan de Groot
c3860849c1 [libcalamaresui] Notify step number when modules are all loaded
- using the QML sidebar would not highlight the first step on startup,
  only after next / prev would the highlight show up. Now, notify
  when all the modules are loaded (and number 0 is active).
2021-03-03 15:43:11 +01:00
Adriaan de Groot
cc3017be53
Merge pull request #1619 from deprov447/Upload_Install_Log
[libcalamaresui] Implementing LogUpload functionality from branding
2021-02-26 13:13:16 +01:00
Adriaan de Groot
cdbf45b5d3 [libcalamaresui] Remove unused include 2021-02-19 14:29:46 +01:00
Adriaan de Groot
3a4dcb6913 [libcalamaresui] Give slideshow (ExecutionViewStep) widgets names 2021-02-17 14:34:33 +01:00
Adriaan de Groot
7e6c3a2309 [libcalamaresui] Give the slideshow-widgets a name
- this is the *working* part of the slideshow, not its background
2021-02-17 14:25:06 +01:00
Anubhav Choudhary
9738851261 YAML list for uploadServer key 2021-02-15 20:51:41 +05:30
Anubhav Choudhary
7057081bdf QUrl for serverURL + renames 2021-02-10 14:38:26 +05:30