Soeren Apel [Tue, 11 Oct 2016 13:55:55 +0000 (15:55 +0200)]
MainWindow: Don't use get_active_view() to determine active session
While it would be neat if it worked, it unfortunately doesn't as
the currently focused item may not be related to any view - e.g.
when one of the tabs of the QTabWidget was clicked.
For this reason, we store the last session the user interacted
with and treat it as the currently focused session.
Soeren Apel [Tue, 4 Oct 2016 17:32:58 +0000 (19:32 +0200)]
MainWindow: Use regular pointer for QDockWidgets
Using shared_ptrs conflicts with the Qt memory management,
so we can't use them if we don't have control over when
those objects are deleted by Qt. In this case, we need to
handle the dock widgets properly.
Gerhard Sittig [Thu, 13 Oct 2016 14:25:39 +0000 (16:25 +0200)]
cmake, INSTALL: Bump the Boost requirement to >= 1.55.
Support for serialization of multiprecision data (which is used for view
timestamps) was introduced in boost version 1.55. Since commit 3a21afa6
builds with versions up to and including 1.54 are reported to fail.
Bump the required version from 1.53 to 1.55. Rephrase the CMake logic
which searches for the Boost dependency. Create a list of libraries from
fixed and optional parts, which as a byproduct avoids long lines. Pass
that list of required libraries to one common find_package() call.
Soeren Apel [Sun, 28 Aug 2016 14:54:58 +0000 (16:54 +0200)]
MainWindow/MainBar: Fix signals
Before, QMetaObject::connectSlotsByName(this) was used to connect
the signals to the slots automagically. This is no longer feasible
for the MainBar as there are slots that can't be auto-assigned and
the MainWindow doesn't have any signals at the moment.
Soeren Apel [Sat, 27 Aug 2016 19:55:57 +0000 (21:55 +0200)]
Implement multi-session handling
This includes letting sessions restore their internal state on
their own and that there are unique names associated with each
session that the GUI can use when there is no data.
Soeren Apel [Fri, 26 Aug 2016 20:29:40 +0000 (22:29 +0200)]
Make the first view own the toolbar instead of the main window
Handling multiple sessions requires that every session can be
controlled individually. This means that either
a) there could be one toolbar that adjusts dynamically to the
session whose view currently has focus
or
b) every session has its own toolbar.
I opted for b) because it's more intuitive and more straightforward
to implement. So now every session has a main view (the first one
created) and a main bar that sits in the same dock widget.
The -Wl,--whole-archive in libsigrok that lead to this change no longer
exists, so this change can be reverted (since it also causes issues with
"make test").
Soeren Apel [Wed, 22 Jun 2016 16:02:34 +0000 (18:02 +0200)]
Fix #805 by resetting selected device on failure
It can happen that devices can be selected but not used
(permissions problems, connection issues, driver issues, etc.),
so in those cases we want to fail gracefully instead of
segfaulting.
The reason for the segfault is the device selector button
isn't reset in case the device couldn't be opened, causing
the rest of the application to try and work with a device
instance that is actually invalid.
Resetting the device selector when the device failed to
open not only fixes this but also makes the UI more
consistent with the internal state.
Samuel Martin [Thu, 26 May 2016 21:46:40 +0000 (23:46 +0200)]
cmake: add check for explicit linking against libatomic
To use atomics functions, some toolchains requires to explicitly add
-latomic to the linker flags (because they are not provided by libc,
but libatomic).
This change adds a helper function trying to build/link a test program
using atomics, then calls it to:
* first check if atomics are directly available in the libc;
* if not and libatomic has been found, then run the same test with
"-latomic" added to the linker flags.
The pulseview link library list is updated according to the results of
these tests.
Notes:
1- CMAKE_REQUIRED_* variables are only used in check functions. They
are not automatically forwarded to/handled by the target commands
(such as target_link_library), because the check functions are
implemented as macro in CMake code, whereas many target commands
are native.
2- Because of note #1, CMAKE_REQUIRED_LIBRARIES (or its value) must be
explicitly passed to the target_link_library command when this is
needed.
3- In this implementation, LIBATOMIC_LIBRARY is only set when it is
needed; so, unconditionally appending it to PULSEVIEW_LINK_LIBS
will produce the expected behavior.
Elias Oenal [Thu, 19 May 2016 18:34:45 +0000 (20:34 +0200)]
Trace: Make popup forms compatible with OSX
Qt behaves differently on OSX regarding widget lifetime it seems,
causing the addition of a stacked decoder to crash PV.
According to Elias, the object popup_form_ gets destroyed, yet
it still has the parent popup_ which in turn will destroy it
again at the end of its life. Either removing the parent, or the
preliminary destruction, fixes the crash.
Soeren Apel [Thu, 19 May 2016 18:29:37 +0000 (20:29 +0200)]
Session: Keep track of signal data locally
Currently, the Session class doesn't hold pointers to the signal
data itself but instead fetches the data on demand using the list
of signals it has. As the Session is providing the model in the
MVC paradigm, it owns the data and thus should keep track of it
directly. The signals are (in an ideal world) mere views on that
data, so querying them for the signal data isn't good style.
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.