X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fviews%2Ftrace%2Fflag.hpp;fp=pv%2Fviews%2Ftrace%2Fflag.hpp;h=4f707bddf3caaa5d9c9fc233950769510041bf21;hp=0000000000000000000000000000000000000000;hb=1573bf16ba50d1c023ad3a9ce596f0ab6eaeacff;hpb=4c7a19d3d7049bcc9fb3185ce2bc91333a7ca9e1;ds=sidebyside diff --git a/pv/views/trace/flag.hpp b/pv/views/trace/flag.hpp new file mode 100644 index 00000000..4f707bdd --- /dev/null +++ b/pv/views/trace/flag.hpp @@ -0,0 +1,85 @@ +/* + * This file is part of the PulseView project. + * + * Copyright (C) 2014 Joel Holdsworth + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * 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, see . + */ + +#ifndef PULSEVIEW_PV_VIEWS_TRACEVIEW_FLAG_HPP +#define PULSEVIEW_PV_VIEWS_TRACEVIEW_FLAG_HPP + +#include + +#include "timemarker.hpp" + +using std::enable_shared_from_this; + +class QMenu; + +namespace pv { +namespace views { +namespace trace { + +class Flag : public TimeMarker, public enable_shared_from_this +{ + Q_OBJECT + +public: + static const QColor FillColour; + +public: + /** + * Constructor. + * @param view A reference to the view that owns this cursor pair. + * @param time The time to set the flag to. + * @param text The text of the marker. + */ + Flag(View &view, const pv::util::Timestamp& time, const QString &text); + + /** + * Copy constructor. + */ + Flag(const Flag &flag); + + /** + * Returns true if the item is visible and enabled. + */ + bool enabled() const; + + /** + * Gets the text to show in the marker. + */ + QString get_text() const; + + pv::widgets::Popup* create_popup(QWidget *parent); + + QMenu* create_context_menu(QWidget *parent); + + void delete_pressed(); + +private Q_SLOTS: + void on_delete(); + + void on_text_changed(const QString &text); + +private: + QString text_; +}; + +} // namespace trace +} // namespace views +} // namespace pv + +#endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_FLAG_HPP