Commit Graph

115 Commits

Author SHA1 Message Date
Jim Broadus f04657e7e7 Replace qrand usage with QRandomGenerator
QRandomGenerator was introduced in 5.10 and qrand has since been
deprecated. QRandomGenerator::global() returns a global instance that
has been securely seeded. QRandomGenerator provides methods that
generate values within ranges, so taking a modulus of the result isn't
necessary.
2021-04-20 10:31:07 +01:00
Jim Broadus cd41f706af libclementine-common: Move timeconstants.h to common location
This header is used by code in /ext, so move it out of /src. This is the
last /ext dependency on /src.
2021-03-17 18:26:51 +00:00
Jim Broadus 57a6fe4f20 utilities: Add common method for bug report URL generation
Move code from PodcastParser::ParseItem for reuse.

Example:
Calling Utilities::MakeBugReportUrl("New bug") returns:
https://github.com/clementine-player/Clementine/issues/new?title=New%20bug
2021-02-03 00:32:00 +00:00
John Maguire 341dc7326f Reformat all C++ 2020-09-22 14:56:06 +01:00
Jim Broadus bb736d1156 Prevent accidental usage of /usr/bin/data
Clementine detects a data directory in the same directory as the executable to
determine portable configuration. But there are some packages that create
/usr/bin/data, causing Clementine to run in portable mode.

Use a more unique data directory name, clementine-data, as the portable data
directory. For backwards compatibility, use the legacy data directory if the
already exists there.
2020-02-23 16:04:42 +00:00
Jim Broadus 5dd6d6725a Add a function that scrubs URL queries from strings.
In some cases, URL queries contain auth information. For cases where error
strings are passed from other libraries, such as from gstreamer, add a utility
function, ScrubUrlQueries, to strip queries from URLs in strings.
2020-02-17 20:31:06 +00:00
Jim Broadus e7b0667196 Fix loading songs on portable setup.
QUrl considers a URL relative if it does not include a scheme and QUrl::resolve
will fail if passed a non-relative url. Strip the scheme for the portable cases.

https://doc.qt.io/qt-5/qurl.html#relative-urls-vs-relative-paths
2020-02-12 09:53:12 +00:00
Jim Broadus b9f57c574f Add QString version of GetRelativePathToClementineBin.
Avoid converting paths to and from URLs when calling this function.
2020-02-12 09:53:12 +00:00
Jim Broadus d3d6c1ff3c Fix UNC paths.
The fix-up for URLs for files that that begin with // no longer works since the
QUrl class determines that these modifications are invalid, resulting in an
empty string when converted. Instead of attempting to modify the QUrl, add a
utility function that makes the correction on the encoded byte array at time of
usage.
2020-01-29 00:38:43 -08:00
Jonas Kvinge 7f6e7f8b30 Fix formatting 2020-01-05 00:17:18 +01:00
Jonas Kvinge f81a3aa8d8 Replace use of QString::sprintf with QString::asprintf 2020-01-05 00:12:32 +01:00
Cesar Enrique Garcia Dabo a7ad66d028 Fix issues reported by clang-format 2019-12-10 18:45:06 +01:00
Cesar Enrique Garcia Dabo f5ec88b529 Add support in GetConfigPath() for /pixmapcache directory 2019-12-07 23:30:14 +01:00
Cesar Enrique Garcia Dabo ab2f7c03ea Use QStandardPaths to define Path_Root and Path_CacheRoot.
These two directories use QStandardPaths::ConfigLocation and
QStandardPaths::GenericCacheLocation respectively, with the
application name (Clementine) appended. The QStandardPaths class from QT
honors the XDG standards:

https://specifications.freedesktop.org/basedir-spec/basedir-spec-0.6.html
https://doc.qt.io/qt-5/qstandardpaths.html#writableLocation
2019-12-07 23:22:13 +01:00
Jonas Kvinge 0da490a5e1 Replace QString::null with QString() 2019-11-09 23:45:28 +01:00
Jonas Kvinge 1a2274bd2b Merge branch 'master' into qt5-update 2019-07-21 14:20:59 +02:00
Filip Gawin be827f4f7f Simplify some statements 2019-02-22 18:49:48 +01:00
Jonas Kvinge 1f87535c2f Replace sha2 with QCryptographicHash (#6230) 2018-12-03 00:45:20 +00:00
Jonas Kvinge 16bdd39c03 Merge remote-tracking branch 'upstream/master' into qt5-update 2018-11-29 23:21:54 +01:00
Jim Broadus 5a1a5a9d95 Display podcast episode information. (#6203)
* Display podcast episode information.
Add an EpisodeInfoWidget with title, author, duration, date, and description fields. Include this in the PodcastInfoDialog. If exactly one episode is selected, then show both the podcast and episode widgets and display the episode's URL. Otherwise, hide the episode widget and follow the existing behavior. Note that the desription field for the EpisodeInfoWidget uses the QLabel and does not currently download embedded images.
Add an always_show_hours option to the PrettyTime methods to include hours in formatting even if the field is zero. This is less ambiguious in some cases where duration is displayed.

* Apply patch from automated formatter test.
2018-11-17 13:29:16 +00:00
Chocobozzz 70f68b1926
Merge remote-tracking branch 'upstream/master' into qt5 2018-02-01 09:50:42 +01:00
Mattias Andersson 650eb0534a Always include the hours in the the time string if the duration if (#5925)
longer than one day.
2017-12-13 18:37:34 +00:00
Chocobozzz fc517ce7a5 Merge remote-tracking branch 'upstream/master' into qt5 2017-06-05 21:28:05 +02:00
santigl e3ece3d4c4 SaveToTemporaryFile(): use QTemporaryFile directly 2017-03-21 10:50:12 +00:00
santigl f44414db81 Add Utilities::SaveToTemporaryFile() 2017-03-21 10:50:12 +00:00
Chocobozzz ff7026c9fe Merge remote-tracking branch 'upstream/master' into qt5 2015-12-13 20:05:12 +01:00
narunlifescience dd953fd86c check custom icon location, then system theme & then fallback theme
icons added & replaced
2015-10-13 22:35:49 -05:00
electric-indigo 2d2b037460 Revert "Workaround for malfunctioning "Show in file browser" feature in Linux" 2015-10-11 22:56:42 +02:00
Chocobozzz 631a6cdabd Merge branch 'master' into qt5 2015-09-16 17:40:54 +02:00
Tomasz Papież d3387f8ef8 Workaround for malfunctioning "Show in file browser" feature in Linux
(issue #4877).
2015-08-08 01:18:41 +02:00
Chocobozzz 5d343cbe7f remove useless qt_version defines 2015-06-03 23:13:06 +02:00
Krzysztof Sobiecki 24b6fbf36c Add ability to parse more of "innovative" datetime formats. close #4760 2015-02-27 02:11:53 +01:00
John Maguire fb2b91c874 Remove some more obsolete os x version checks. 2015-02-18 18:03:46 +01:00
Krzysztof Sobiecki bf55bc08fb Cherry pick make format changes 2014-12-14 12:23:04 +01:00
Krzysztof Sobiecki 6cc72e2f5d Fix a date parser for one podcasts 2014-12-14 12:13:05 +01:00
John Maguire 64c34f58ae Merge pull request #4608 from sobkas/src_core_fix
Fix the copyright info and formatting in src/podcast and src/core
2014-11-27 15:17:16 +01:00
Andreas ff172f6ed4 Network remote can now transcode lossless files before sending them to the remote.
- It is configurable in the settings.
- Any format can be chosen that is supported by the transcoder.
- The status of the transcoder is send to the remote.

- Transcoder format settings have now a postfix so we can define mutliple transcoder formats and use them separatly. Here one for the normal transcoder and one for the network remote transcode. You can pass the postfix in the constructor.
- Fixed Transcoder crash (was introduced with the gstreamer1.0 merge, decodebin doesn't have a "new-decoded-pad").
- Transcoder emits the output filename as well on "JobComplete" signal
- Transcoder can now convert a file to a temporary file ("AddTemporaryJob")
2014-11-13 22:31:49 +01:00
Krzysztof Sobiecki 39a3b46ead More copyright info fixes 2014-11-05 17:48:04 +01:00
Krzysztof Sobiecki a85728dfb3 Fix some problems 2014-11-05 17:48:03 +01:00
Krzysztof Sobiecki 0af1470cce Clean up src/core 2014-11-05 17:48:03 +01:00
David Sansome 7b651136d8 Use the system's sha2 library if it's available. Fixes #4217 2014-09-25 23:51:46 +10:00
vkrishtal 42f62be5b6 Fix after review 2014-04-25 08:57:31 +04:00
John Maguire 3323c2d094 Convert all instances of foreach() to a C++11 for
find ext src -name '*.cpp' -exec \
    sed -i -e 's/foreach(\([^,]\+\),/for (\1 :/' {} \;
2014-02-10 14:43:32 +01:00
John Maguire bebd781fdf Reformat all non-3rd-party C/C++/Objective-C++.
Command line:
find src ext -regex '.*\.\(h\|cpp\|mm\)' -exec clang-format -i
 -style='{BasedOnStyle: Google, DerivePointerBinding: false}' {} \;
2014-02-07 16:34:20 +01:00
John Maguire 3df3a5b645 Add missing header for syscall().
This is cunningly not defined in syscall.h
2014-02-06 19:03:10 +01:00
John Maguire 71893e4847 Use nullptr instead of NULL everywhere. 2014-02-06 17:29:59 +01:00
John Maguire d309d4ab27 Use c++11 instead of boost where possible. 2014-02-06 16:51:39 +01:00
John Maguire ddda13ceb7 u_int8_t is missing on mingw 2014-02-04 14:10:59 +01:00
David Sansome 96075faf88 Namespace clementine's 3rdparty implementation of sha2 to prevent its symbols
conflicting with the system's openssl symbols with the same names.

This was causing SSL connections to fail in weird ways on Debian.

Fixes #4130.
2014-02-02 20:25:11 +11:00
Arnaud Bienner 06184cc5fb Avoid having empty filenames, or filenames with extension only.
In this case, keep the original filename.
2014-02-01 03:22:41 +01:00