Build fixes for Qt5 Windows/mingw/MXE support.
[pulseview.git] / pv / storesession.cpp
index 00f6af63ed0a9e1374e673bbc5adfb22e9db3b54..eaa17ea5f98096519f88f44be1373a8a697c171c 100644 (file)
@@ -14,8 +14,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <cassert>
  */
 
 #include <cassert>
@@ -38,7 +37,6 @@
 #include <pv/data/logicsegment.hpp>
 #include <pv/data/signalbase.hpp>
 #include <pv/devices/device.hpp>
 #include <pv/data/logicsegment.hpp>
 #include <pv/data/signalbase.hpp>
 #include <pv/devices/device.hpp>
-#include <pv/view/signal.hpp>
 
 #include <libsigrokcxx/libsigrokcxx.hpp>
 
 
 #include <libsigrokcxx/libsigrokcxx.hpp>
 
@@ -63,6 +61,7 @@ using std::vector;
 
 using Glib::VariantBase;
 
 
 using Glib::VariantBase;
 
+using sigrok::ChannelType;
 using sigrok::ConfigKey;
 using sigrok::Error;
 using sigrok::OutputFormat;
 using sigrok::ConfigKey;
 using sigrok::Error;
 using sigrok::OutputFormat;
@@ -106,22 +105,20 @@ const QString& StoreSession::error() const
 
 bool StoreSession::start()
 {
 
 bool StoreSession::start()
 {
-       const unordered_set< shared_ptr<view::Signal> > sigs(session_.signals());
+       const unordered_set< shared_ptr<data::SignalBase> > sigs(session_.signalbases());
 
        shared_ptr<data::Segment> any_segment;
        shared_ptr<data::LogicSegment> lsegment;
        vector< shared_ptr<data::SignalBase> > achannel_list;
        vector< shared_ptr<data::AnalogSegment> > asegment_list;
 
 
        shared_ptr<data::Segment> any_segment;
        shared_ptr<data::LogicSegment> lsegment;
        vector< shared_ptr<data::SignalBase> > achannel_list;
        vector< shared_ptr<data::AnalogSegment> > asegment_list;
 
-       for (shared_ptr<view::Signal> signal : sigs) {
+       for (shared_ptr<data::SignalBase> signal : sigs) {
                if (!signal->enabled())
                        continue;
 
                if (!signal->enabled())
                        continue;
 
-               shared_ptr<data::SignalData> data = signal->data();
-
-               if (dynamic_pointer_cast<data::Logic>(data)) {
+               if (signal->type() == ChannelType::LOGIC) {
                        // All logic channels share the same data segments
                        // All logic channels share the same data segments
-                       shared_ptr<data::Logic> ldata = dynamic_pointer_cast<data::Logic>(data);
+                       shared_ptr<data::Logic> ldata = signal->logic_data();
 
                        const deque< shared_ptr<data::LogicSegment> > &lsegments =
                                ldata->logic_segments();
 
                        const deque< shared_ptr<data::LogicSegment> > &lsegments =
                                ldata->logic_segments();
@@ -135,10 +132,9 @@ bool StoreSession::start()
                        any_segment = lsegment;
                }
 
                        any_segment = lsegment;
                }
 
-               if (dynamic_pointer_cast<data::Analog>(data)) {
+               if (signal->type() == ChannelType::ANALOG) {
                        // Each analog channel has its own segments
                        // Each analog channel has its own segments
-                       shared_ptr<data::Analog> adata =
-                               dynamic_pointer_cast<data::Analog>(data);
+                       shared_ptr<data::Analog> adata = signal->analog_data();
 
                        const deque< shared_ptr<data::AnalogSegment> > &asegments =
                                adata->analog_segments();
 
                        const deque< shared_ptr<data::AnalogSegment> > &asegments =
                                adata->analog_segments();
@@ -151,7 +147,7 @@ bool StoreSession::start()
                        asegment_list.push_back(asegments.front());
                        any_segment = asegments.front();
 
                        asegment_list.push_back(asegments.front());
                        any_segment = asegments.front();
 
-                       achannel_list.push_back(signal->base());
+                       achannel_list.push_back(signal);
                }
        }
 
                }
        }
 
@@ -304,6 +300,7 @@ void StoreSession::store_proc(vector< shared_ptr<data::SignalBase> > achannel_li
        // Zeroing the progress variables indicates completion
        units_stored_ = unit_count_ = 0;
 
        // Zeroing the progress variables indicates completion
        units_stored_ = unit_count_ = 0;
 
+       store_successful();
        progress_updated();
 
        output_.reset();
        progress_updated();
 
        output_.reset();