24 #include <KLocalizedString> 43 m_initial_pos(label.pos()),
44 m_current_pos(label.pos()),
45 m_description(label.
name()),
46 m_undo_transaction(Q_NULLPTR)
55 qDebug(
"Kwave::LabelItem::~LabelItem() -> aborted -> reverting!");
74 i18nc(
"tooltip of a label, %1=index, %2=description/name",
76 i18nc(
"tooltip of a label, without description, %1=index",
80 QString tip =
_(
"%1\n%2\n%3").arg(description).arg(
m_current_pos).arg(hms);
92 QMenu *label_menu = Q_NULLPTR;
93 foreach (
const QAction *action, parent->actions()) {
94 if (action->text() == i18n(
"Label")) {
95 label_menu = action->menu();
104 foreach (QAction *action, label_menu->actions()) {
105 if (action->text() == i18n(
"New")) {
106 action->setEnabled(
false);
111 QAction *action_label_delete = label_menu->addAction(
112 QIcon::fromTheme(
_(
"list-remove")),
114 Q_ASSERT(action_label_delete);
115 if (!action_label_delete)
return;
117 QAction *action_label_properties = label_menu->addAction(
118 QIcon::fromTheme(
_(
"configure")),
120 Q_ASSERT(action_label_properties);
121 if (!action_label_properties)
return;
141 return Qt::SizeHorCursor;
167 qWarning(
"Kwave::LabelItem::done(): saving undo data failed!");
virtual void appendContextMenu(QMenu *parent) Q_DECL_OVERRIDE
void contextMenuLabelProperties()
sample_index_t m_current_pos
sample_index_t m_initial_pos
void contextMenuLabelDelete()
virtual void done() Q_DECL_OVERRIDE
QString Q_DECL_EXPORT ms2hms(double ms)
virtual sample_index_t pos() const
virtual QCursor mouseCursor() const Q_DECL_OVERRIDE
sample_index_t offset() const
Kwave::SignalManager & m_signal_manager
Kwave::SignalView & m_view
bool registerUndoAction(UndoAction *action)
virtual ~LabelItem() Q_DECL_OVERRIDE
virtual QString toolTip(sample_index_t &ofs) Q_DECL_OVERRIDE
double samples2ms(sample_index_t samples)
virtual Kwave::ViewItem::Flags flags() const Q_DECL_OVERRIDE
int labelIndex(const Kwave::Label &label) const
void sigCommand(const QString &command)
sample_index_t pixels2samples(int pixels) const
Kwave::UndoTransactionGuard * m_undo_transaction
Kwave::Label findLabel(sample_index_t pos)
bool modifyLabel(int index, sample_index_t pos, const QString &name, bool with_undo)
virtual void moveTo(const QPoint &mouse_pos) Q_DECL_OVERRIDE
LabelItem(Kwave::SignalView &view, Kwave::SignalManager &signal_manager, unsigned int index, const Kwave::Label &label)