Commit Graph

389 Commits

Author SHA1 Message Date
Jim Broadus 8a88a0a57e Properly handle connect errors when initiated from properties dialog.
If connection fails when initiated from the device properties dialog, the
connected page is shown after the update formats worker thread completes.
2020-01-07 23:20:04 -08:00
Jim Broadus 79b7e3fe13 Fix abort from Mtp loader thread.
A commit in qt 5.7 changes a qWarning to a qFatal if a QThread is still running
when it's deleted. When we get the LoadFinished signal in MtpDevice, stop
the loader thread's event loop to avoid this situation.

See qtbase commit c8277b6e532
2020-01-07 22:29:59 +00:00
Jonas Kvinge f81a3aa8d8 Replace use of QString::sprintf with QString::asprintf 2020-01-05 00:12:32 +01:00
Jonas Kvinge d09c27f719 Remove extra ';' 2019-11-10 00:30:18 +01:00
John Maguire cb6cd7c485 Merge remote-tracking branch 'origin/master' into qt5 2019-10-04 16:51:43 +01:00
luz.paz fb93ae4b02 Fix misc. source comment typos
Typos found via `codespell`
2019-08-21 23:43:16 -04:00
Jonas Kvinge 1a2274bd2b Merge branch 'master' into qt5-update 2019-07-21 14:20:59 +02:00
John Maguire e3609b27cd
Merge pull request #6296 from ShFil119/impr/simplify
Simplify some statements
2019-04-10 11:12:09 +01:00
Jim Broadus d041da18cc Handle case where a lister adds a device before loaded from database.
There is a small chance that a device lister is able to discover and add a
previously known device before it is added by the database loader thread.
In this case, copy the data that is user-settable to the existing DeviceInfo
object and destroy the object created from the database query.

This adds and utilizes a new FindEquivalentDevice method that compares the
device unique IDs. This could probably be made more robust as the unique
IDs for some listers may change. However, this is a problem with the database
storage implementation in general.
2019-02-24 00:05:18 -08:00
Jim Broadus a62062127e Fix thread-safety issues when initially loading devices from the database.
When DeviceManager initializes, it creates a thread to load device information
from the database. Part of this process includes use of QPixMap for icons which
produced a warning message:

22:32:53.763 WARN  unknown                          QPixmap: It is not safe to use pixmaps outside the GUI thread

In addition, the device is added to the view using beginInsertRows and
endInsertRows. This could contend with a device added by a lister signaling
PhysicalDeviceAdded.

To solve these problems, this change moves the icon loading and insertion to the
main thread. LoadAllDevices reads the data from the database and creates the
DeviceInfo object, then sends a signal to the main thread. In the signal
handler, the icon is loaded and the device is added to the master list and view.
2019-02-24 00:03:45 -08:00
Filip Gawin be827f4f7f Simplify some statements 2019-02-22 18:49:48 +01:00
Jim Broadus 248f1d8596 Prevent UI hang during device scan. (#6291)
When unmounting a device, the ConnectedDevice object is destroyed. The
FileSystemDevice destructor waits on its worker thread. If a scan is in
progress, this will block until completion.

There is an existing Stop method in the LibraryWatcher class that is intended to
stop long running operations. To fix, or at least significantly shorten this
hang, we'll call this before waiting for the thread to exit. Also add a
stop_requested check in the cover art scan.

In addition, add a call to Stop in the Library destructor, which has a similar
usage.
2019-02-20 19:03:44 +11:00
Jonas Kvinge d8788d6a0d Update qt5 branch 2019-01-27 01:00:36 +01:00
Jonas Kvinge ed3d462674 Fix memory leak and use ItemToIndex / IndexToItem (#6262) 2019-01-21 21:38:46 +00:00
Jonas Kvinge 7e25a7c7e4 Convert devices manager(model) to QAbstractItemModel (#6260) 2019-01-21 09:06:48 +00:00
Jonas Kvinge d772c8078d Fix formatting 2019-01-18 01:49:17 +01:00
Jonas Kvinge 89f40ee88f Use QUrlQuery 2019-01-18 01:47:26 +01:00
Jonas Kvinge 1d17bee44a Merge with master and fix conflicts 2019-01-18 01:38:12 +01:00
Jim Broadus 6c159481ed Handle MTP connection failures more gracefully. (#6256)
Currently, the failure to connect to an MTP device results in the UI displaying
an open device that appears empty. This change introduces a method
ConnectedDevice::ConnectAsync() that is expected to handle any connecting tasks
that could block asynchronously. Upon completion, this emits a ConnectFinished
signal that indicates success or failure. The row in the UI is only updated
after the successful response is received. Upon failure, DeviceManager will
clean up and the row in UI is left in the pre-connect state.

Currently, only the MtpDevice utilizes this mechanism. All other devices use a
default implementation that immediately reports success.
2019-01-15 21:10:05 +00:00
Jonas Kvinge 8d78dae9b6 Quit thread before deleting the loader (#6254) 2019-01-15 17:57:00 +00:00
Jim Broadus 74fa386c90 Try to obtain USB bus and device number from device name if unavailable in URI. (#6243)
In 1.37.2, gvfs switched to URIs that remain consistent across USB device
re-enumerations. This removed the usb bus and device numbers from the URI. In
the case that these values aren't found in the URI, try to parse Unix device
name property and pass results as query params on the URL. Pay attention to
these params in MtpConnection.

See gvfs commits 3a7bb06b and efc76d0c for reference.
2019-01-02 15:06:22 +00:00
Jim Broadus 95187ed0a1 Fix encoding of GError messages when logging. (#6228)
GError messages contain non-ascii characters. This normally just produces some garbage when we use the default QString contructor that assumes ASCII for logging. However, when a message includes the right double quote, UTF-8 sequence 0xE2 0x80 0x9D, the final byte is OSC. VT100 expects a command sequence to follow and stops echoing output until it sees ST or BEL character, which may never come. Thus, the console output is halted.

This change uses QString::fromLocal8Bit instead of depending on the default constructor. About half of the sites in the codebase had already been converted.

One side effect is that log messages are quoted. There are additional options to control this, but those were only introduced in Qt 5.4.
2018-12-02 09:51:19 +00:00
Jonas Kvinge 16bdd39c03 Merge remote-tracking branch 'upstream/master' into qt5-update 2018-11-29 23:21:54 +01:00
Jim Broadus 122d28eab9 Fix device loader error messages. (#6215)
GPodLoader and MtpLoader Error signals were connected to Error signals in their repective device classes, but the actual signal definition in ConnectedDevice was removed in a refactor several years ago. This change adds LoaderError slots to these device classes and reports the error in the manner of the refactored code.
2018-11-28 10:23:31 +00:00
Jonas Kvinge 8c198a99a5 Qt 5 fixes 2018-11-21 10:31:17 +00:00
Jonas Kvinge c29c2e95cc Fixed merge conflicts 2018-09-30 15:11:06 +02:00
Mattias Andersson 3e53e23bb8 Fix formatting 2018-07-06 17:09:21 +01:00
Mattias Andersson 84f1b7bae0 Load the audio cd in a separate thread 2018-07-06 17:09:21 +01:00
Mattias Andersson 4458d45200 Give the cd device some more time to spin up 2018-07-06 17:09:21 +01:00
Jonas Kvinge 335bc89c97 Workaround for broken CD playback in Qt5 (#6021)
* Workaround for cdda URL in qUrl()

* Workaround for cdda URL in qUrl()

* Fix code formatting

* Fix code style
2018-03-09 23:09:55 +00:00
Chocobozzz 70f68b1926
Merge remote-tracking branch 'upstream/master' into qt5 2018-02-01 09:50:42 +01:00
Allan Nordhøy b89ccb04f2 Spelling: D-Bus (#5838) 2017-08-28 23:37:47 +02:00
Allan Nordhøy 050813bf9c Spelling: D-Bus (#5837) 2017-08-28 23:37:25 +02:00
Chocobozzz fc517ce7a5 Merge remote-tracking branch 'upstream/master' into qt5 2017-06-05 21:28:05 +02:00
Morris Hafner 8a6cc8b506 Add missing <functional> includes (#5630) 2017-02-13 16:46:46 +00:00
Chocobozzz 2ede85bdcd Merge branch 'master' into qt5 2016-12-18 17:04:08 +01:00
John Maguire 6f356592a5 Fixes for cross compiling for mac. 2016-12-15 11:36:05 +00:00
Chocobozzz 18a89f78a9 Merge remote-tracking branch 'upstream/master' into qt5 2016-10-07 14:30:09 +02:00
John Maguire 1f95a23fd4 Remove non-static data member initializers 2016-07-06 14:26:45 +01:00
John Maguire 6b90f69894 Fix typo 2016-06-01 11:46:52 +01:00
John Maguire b90fb73480 Merge pull request #5394 from Chemrat/udisks2
Udisks2 support
2016-06-01 00:10:26 +01:00
Valeriy ecaa9de788 fix variable names 2016-05-31 20:31:39 +03:00
Valeriy 1812f089b0 feed udisks2lister.* through format.py
add copyright headers
2016-05-31 18:31:00 +03:00
Valeriy 0172f7265b fix code style 2016-05-31 18:19:46 +03:00
Valeriy cc6a99ef92 handle our unmount responses because those unmount jobs expire too fast
for jobs use dbus interface when possible
clean up the code a bit
2016-05-30 18:24:02 +03:00
Valeriy ed986d3863 UDisks2.Job interface support 2016-05-22 23:44:22 +03:00
Valeriy 68001ff7e8 udisks2: handle unmount jobs too, more verbose logging 2016-05-21 23:29:18 +03:00
Valeriy d4e932db9a udisks2 support for devicemanager (refs #3264) 2016-05-17 22:56:16 +03:00
Valeriy cbc7092ed9 fix code style 2016-05-17 14:47:02 +03:00
Valeriy 806e689d1d replace foreach with range-based for 2016-05-11 19:00:30 +03:00
Valeriy 948140fab5 disconnect GVolumeMonitor signals from GioLister before destroying it
fixes #5369
2016-05-11 17:58:12 +03:00
Chocobozzz ff7026c9fe Merge remote-tracking branch 'upstream/master' into qt5 2015-12-13 20:05:12 +01:00
John Maguire f300946c81 Remove most usages of QFutureWatcher 2015-11-27 14:28:12 +00:00
narunlifescience dd953fd86c check custom icon location, then system theme & then fallback theme
icons added & replaced
2015-10-13 22:35:49 -05:00
Chocobozzz 42aafd247a Update optional components to qt5 2015-04-15 18:26:09 +02:00
Chocobozzz 8b226c2171 Update non optionnals sources to qt5 2015-04-11 23:24:07 +02:00
Chocobozzz 8fba1c30f4 Make format 2014-11-05 13:05:58 +01:00
Chocobozzz da99c55eed Use constructor for QString 2014-11-05 12:25:55 +01:00
Chocobozzz 2e64b24290 Revert "Use constructor for QString and make format"
This reverts commit 5a2348fae6.
2014-11-05 12:25:09 +01:00
Chocobozzz 5a2348fae6 Use constructor for QString and make format 2014-11-05 11:51:38 +01:00
Chocobozzz 942fda88bf Check if there is a current icon item in the device manager. Fixes #4604 #4555 2014-11-04 21:46:10 +01:00
Arnaud Bienner 7ac9e4c6d1 Fix a bug in InsertItems functions that makes Cdda tracks to not be saved/restored correctly when restarting Clementine 2014-10-26 17:08:12 +01:00
Arnaud Bienner 5a7c462fc3 Remove useless includes 2014-10-26 03:37:17 +01:00
Arnaud Bienner dc0d3436c8 Finish CD integration update to Gstreamer 1.0
Move everything related to CDDA to a seperate class, so we can more easily reuse it in SongLoader
2014-10-26 03:32:37 +01:00
Arnaud Bienner a8266173c5 Start to reactivate audio CD support 2014-10-26 00:28:03 +02:00
David Sansome 39d99247a2 gstreamer-cdda is in gst-plugins-base in 1.0 and has a different header name.
This still doesn't work because the API has changed and track listings are
now delivered via a bus message instead of direct access to the struct's
members.
2014-09-22 22:28:53 +10:00
Mattias Andersson 0be0498e94 Reset the model during init of CddaDevice
This ensures that the track list in the device tab is correctly updated when a
disc is replaced with one that doesn't exist in the MusicBrainz database.
2014-05-24 13:54:07 +02:00
John Maguire 5146bcdebc Some more NULL -> nullptr conversions. 2014-02-21 17:30:46 +01:00
John Maguire 192b60d965 Use nullptr as parent parameter default everywhere 2014-02-10 16:03:54 +01: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
Krzysztof A. Sobiecki 0ecf1e76a6 Reformat done with clang-3.5 svn200967 2014-02-07 17:08:31 +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 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 b96ec7555a Reformat all Objective-C++ files with clang-format.
clang-format -style=Google -i src/*/*.mm
2014-01-30 14:54:51 +01:00
David Sansome 8416188056 Show a message in the Devices pane on Windows to say that most devices won't work. Fixes #4059 2014-01-05 11:32:07 +11:00
John Maguire 95330a3d7c Deal more gracefully with a device's library not having any directories on second mount.
Fixes issue #3940
2013-11-04 18:44:07 +01:00
John Maguire a650ac91bd Don't probe stupid printers on OS X. 2013-07-09 12:03:01 +02:00
David Sansome eb20fb5945 Remove all the soruce for WMDM devices. Fixes issue 3748 2013-06-30 08:25:12 +00:00
John Maguire 3d434f1c88 Remove iDevice support as it doesn't work well for modern devices and libgpod shows no signs of updating to support them.
Fixes issue #3683
2013-05-17 15:30:56 +02:00
David Sansome d89954ae31 Fix style, hide the new columns by default, and move the new columns to the end of the enum 2013-03-10 18:16:14 +11:00
Uwe Klotz a6d3b48231 Extend tag support: performer, grouping
The transaction handling while upgrading the database schema had to be revised.
Furthermore some QSqlQuery statements needed to be finished properly.

Fixes issue 2556
2013-03-10 18:16:03 +11:00
John Maguire 42e7e4ff6f Use boost::bind in DeviceManager. 2012-11-21 17:21:20 +01:00
John Maguire 80d35ef128 Merge remote branch 'origin/mingw-w64' 2012-11-19 18:17:19 +01:00
Arnaud Bienner e9c98733b3 Also update song count when tags are loaded: I don't know why but there not updated in Init 2012-11-18 22:14:06 +01:00
Arnaud Bienner fb07308607 Slightly modify the way CddaLister::Init worksr: as cdio_get_devices sometimes return only symlinks, we should not ignore them. 2012-11-18 22:05:18 +01:00
John Maguire 8501ac0d96 Do WMDM static init in main() to avoid static mutex. 2012-11-15 22:08:04 +00:00
John Maguire 543a6bf2fa Remove use of linked SAC shim and depend on DLL version (which doesn't exist yet) 2012-11-13 17:04:54 +01:00
John Maguire 79318cc4e1 Build fixes for mingw-w64 2012-11-13 14:43:13 +01:00
Veniamin Gvozdikov e6e72dc68d Change the include order to fix a build error on FreeBSD.
Fixes issue 3247
2012-10-31 10:45:18 -07:00
John Maguire 896a8739e9 Maybe fix mac build. 2012-09-26 18:12:14 +02:00
John Maguire 5ddabb4b76 Remove use of functions deprecated in Mountain Lion. 2012-09-13 16:24:45 +02:00
Arnaud Bienner 0e3dc5a8be Add new ConcurrentRun templates for void functions, and functions with 3 arguments + corresponding test cases.
+ SongLoader now has its own QThreadPool to load folders/playlist in background.
Update issue 2598
This should fix slowliness problems reported.
2012-07-16 00:06:55 +02:00
John Maguire 905ef90882 Add missing header. 2012-06-29 17:06:47 +02:00
John Maguire 20b11961f9 Set the max size of the DeviceManager thread pool to 1. 2012-06-29 16:58:30 +02:00
John Maguire 58a3a6831a Move loading of devices from the database onto a different thread. 2012-06-29 16:56:17 +02:00
John Maguire cbc650f44b Use CHECKED_GCONNECT instead of g_signal_connect everywhere. 2012-06-08 15:34:00 +02:00
Patrick Stewart fd35ce8b5d When listing devicekit devices, include drives that only contain a single partition (with no partition table).
Fixes issue 1508
2012-06-05 18:42:11 +01:00
John Maguire c62e996607 Fix come compile warnings from Clang 3.1 2012-06-04 17:44:01 +02:00
David Sansome 5d4844acdd Add copyright headers to ilister.{cpp,h} 2012-03-27 21:31:20 +01:00