Soeren Apel [Mon, 2 May 2016 20:22:39 +0000 (22:22 +0200)]
InputFile: Use new reset() function to allow re-reading file
Commit 519d0ccbe67d005a9c442795ce3b8255e78ca46d tried to solve
the problem of being unable to re-read an opened file by clicking
the "run" button. However, the solution is insufficient.
PV expects the session device to be updated after the open()
call. If it is not, the device settings popup will show the
settings of the previously used device.
This patch fixes this and also makes use of the new reset()
method to allow re-reading of the file contents. The method
is necessary because otherwise we have to destroy the input
module and create a new instance. This however also means
setting a new session device, which is highly undesirable.
So reset() it is.
Soeren Apel [Tue, 3 May 2016 19:49:00 +0000 (21:49 +0200)]
DecoderStack: Force a viewport update more frequently
Updating the viewport every 65kib of input data causes
the decode trace to make really big leaps, leaving the
user with the feeling of a not-so-snappy user interface.
We can easily change this by updating the trace every 1kib
since the decoder and the UI thread are separate and the
decode trace drawing is much faster since when the limit
was originally set.
Users are expecting *any* device to be found when pressing
the "Scan for Devices" button. As that is not what it's doing,
we need to clarify what it does.
DecodeTrace: Make sure first row's label width can be calculated
Without a pen set, p.boundingRect() returns 0. All other rows
have their label text width calculated with a pen, which makes
p.boundingRect() work as intended. Fix this by setting a pen
before the first row is processed.
Fix #705 by preventing the use of invalid instances
As QCache owns the object instances it manages, inserting
an object into the cache transfers ownership automatically.
This means we can't use an instance after it has been
inserted into the cache as this results in a double free
situation as we'd end up calling the destructor on the same
object instance as the cache.
The InputFile currently only keeps track of the
need for a device instance local to run().
This means that when calling run() a second time
(e.g. by clicking the "Run" button after loading
a file), the function will try to create the
device instance and add it to the session.
This fails as the first created instance is
still assigned to the session and thus the
session will reject adding another device.
Furthermore, simply clearing the session
devices isn't enough for proper operation.
The issue is that once a file's content has
been sent to an input module, the module is
not going to accept another file. It needs
to be reset to its initial state. To do this,
we create the input module instance every time
we want to read the file.
View: Provide a clear setup path for the initial v_offset value
- View::update_scroll():
The range for the vertical scrollbar is only updated if there
are traces in the view.
- View::set_scroll_default():
This new function adjusts the vertical offset of the view so
that all traces are visible. Needs to be executed once after a
new device was selected.
- View::signals_changed():
We want to be able to clear stale items in-between devices, so
we no longer want to simply return when no device is selected.
This means we need to handle a missing device more gracefully.
Also, we now reset the vertical scroll bar when no device is
selected and call set_scroll_default() when needed.
TraceTreeItemOwner: Change behavior for empty containers
An empty TraceTreeItemOwner's v_extents are no longer
[INT_MAX, INT_MIN] but [0, 0] instead. As new items were added
relative to the view's own v_extents, items were added at
positions close to the over-/underflow margin. This messed up
the scrollbar among other things. Returning [0, 0] instead
allows for better handling of such cases.
Soeren Apel [Tue, 16 Feb 2016 20:15:03 +0000 (21:15 +0100)]
Use the 'default' keyword where applicable. This patch
was initially created using clang-tidy:
clang-tidy -checks="-*,moderize-use-default" -fix
However, the resulting patch only wanted to alter the
definitions in the .cpp file. I think it makes more
sense to remove the definitions completely and just
add "= default" to the declarations in the header file.
Soeren Apel [Tue, 9 Feb 2016 13:48:31 +0000 (14:48 +0100)]
Fix #181 by changing the global decode lock into an SRD lock
The global decode was insufficient insofar as it didn't
prevent a newly started decode thread from interjecting its
own decode operations. When this happens, something goes
haywire somewhere and Python crashes.
Until the underlying cause is fixed, this global SRD lock
forces one decoder thread to finish before another one can
start.
While this is a bit inconvenient for wanting to decode as
the acquisition is going on, it currently is the only
working option.
Soeren Apel [Tue, 9 Feb 2016 10:58:36 +0000 (11:58 +0100)]
DecoderStack: Make decoder sessions terminate after running
Currently, SRD sessions aren't terminating after all data
has been decoded, leaving the decode thread in a state
where it's waiting for more data.
This would be okay if an acquisition was still ongoing but
when the acquisition has been stopped, there will never be
more data. When a new acquisition is started, the previous
decode sessions will be terminated and then new ones will
be started. This is the reason why this behavior wasn't
an issue up until now.
However, the fix for #181 requires that the decode thread
terminates or else the global SRD lock will never be
released.
Soeren Apel [Sat, 6 Feb 2016 17:07:05 +0000 (18:07 +0100)]
MainWindow: Try to use any available device aside from demo
Currently, PV will only try to use the previously used device.
However, when first running PV, it will default to demo as
there is no previously used device. In this case, we still
want to use whatever device we can get our hands on so that
the user can start using PV immediately.
Soeren Apel [Thu, 4 Feb 2016 21:38:34 +0000 (22:38 +0100)]
DecodeTrace: Try to keep annotation labels within the view
Up until now, annotation labels were always drawn centered,
even if the annotation was very wide and mostly off-screen.
This resulted in annotation labels being out of view, even
if there would be enough space to draw it within the view.
This patch fixes this.
Soeren Apel [Wed, 30 Dec 2015 17:34:47 +0000 (18:34 +0100)]
DecodeTrace: Prevent trace height from jumping
In 506317984393a41000650ccca868f3dd66872a4f, the decode
trace height was made dependent on the number of currently
visible annotation rows.
This however has issues: when zooming in on an area where
there are no annotations, the height of the decode trace
collapses. With this patch, this can't happen anymore as
a new variable keeps track of the maximum number of
annotation rows ever encountered, keeping the decoder
trace height stable.
Soeren Apel [Wed, 30 Dec 2015 17:00:46 +0000 (18:00 +0100)]
DecodeTrace: Improve annotation block drawing
Instead of just drawing blocks using the color of the first
annotation in the block, draw a "special" annotation
with a dotted pattern.
The color of this annotation depends on the annotations
in that range: a color is used if they're all of the same
annotation class. If there's different kinds, gray is used.
Soeren Apel [Sat, 12 Dec 2015 14:01:03 +0000 (15:01 +0100)]
Session: Allow using sample rate from meta packet
Currently, PV only looks at the device config to determine the
sample rate. This breaks as input filters submit meta packets
containing the sample rate and provide no device config.
Example: load any file in PV using the raw binary input filter
and set the sample rate to anything but 0. PV will still show
'sa' as the time unit, indicating that it dismisses the sample
rate information sent in the meta packet.
This patch makes this work by using the sample rate if it
wasn't already set from the device config.
Tilman Sauerbeck [Mon, 23 Nov 2015 18:07:59 +0000 (19:07 +0100)]
LogicSignal: Put all trigger matches into a single trigger stage.
Previously each trigger match was assigned its own trigger stage,
which is problematic because devices may not support more than one
stage.
Ideally we would want the user to decide which matches go into
which stages, but that's a long way off and this change makes
things work just a little bit better for more devices.