# HG changeset patch # User Chris Cannam # Date 1235484102 0 # Node ID 73a58a4dfebdd782f90cc45bf46d26a6bb1e59f3 # Parent 08e1ccfe289c5e25986bd8258a53378eb680b7df * Add vestigial Activity Log diff -r 08e1ccfe289c -r 73a58a4dfebd layer/Layer.h --- a/layer/Layer.h Tue Feb 24 12:17:18 2009 +0000 +++ b/layer/Layer.h Tue Feb 24 14:01:42 2009 +0000 @@ -55,7 +55,7 @@ virtual ~Layer(); virtual const Model *getModel() const = 0; - virtual Model *getModel() { + Model *getModel() { return const_cast(const_cast(this)->getModel()); } diff -r 08e1ccfe289c -r 73a58a4dfebd view/ViewManager.cpp --- a/view/ViewManager.cpp Tue Feb 24 12:17:18 2009 +0000 +++ b/view/ViewManager.cpp Tue Feb 24 14:01:42 2009 +0000 @@ -15,6 +15,7 @@ #include "ViewManager.h" #include "base/AudioPlaySource.h" +#include "base/RealTime.h" #include "data/model/Model.h" #include "widgets/CommandHistory.h" #include "View.h" @@ -324,7 +325,8 @@ ViewManager::SetSelectionCommand::getName() const { if (m_newSelection.getSelections().empty()) return tr("Clear Selection"); - else return tr("Select"); + if (m_newSelection.getSelections().size() > 1) return tr("Select Multiple Regions"); + else return tr("Select Region"); } Selection @@ -339,6 +341,15 @@ m_toolMode = mode; emit toolModeChanged(); + + switch (mode) { + case NavigateMode: emit activity(tr("Enter Navigate mode")); break; + case SelectMode: emit activity(tr("Enter Select mode")); break; + case EditMode: emit activity(tr("Enter Edit mode")); break; + case DrawMode: emit activity(tr("Enter Draw mode")); break; + case EraseMode: emit activity(tr("Enter Erase mode")); break; + case MeasureMode: emit activity(tr("Enter Measure mode")); break; + }; } void @@ -350,6 +361,9 @@ emit playLoopModeChanged(); emit playLoopModeChanged(mode); + + if (mode) emit activity(tr("Switch on Loop mode")); + else emit activity(tr("Switch off Loop mode")); } } @@ -362,6 +376,9 @@ emit playSelectionModeChanged(); emit playSelectionModeChanged(mode); + + if (mode) emit activity(tr("Switch on Play Selection mode")); + else emit activity(tr("Switch off Play Selection mode")); } } @@ -374,6 +391,9 @@ emit playSoloModeChanged(); emit playSoloModeChanged(mode); + + if (mode) emit activity(tr("Switch on Play Solo mode")); + else emit activity(tr("Switch off Play Solo mode")); } } @@ -386,6 +406,9 @@ emit alignModeChanged(); emit alignModeChanged(mode); + + if (mode) emit activity(tr("Switch on Alignment mode")); + else emit activity(tr("Switch off Alignment mode")); } } @@ -485,6 +508,10 @@ if (v) emit viewCentreFrameChanged(v, f); } + emit activity(tr("Scroll view to %1") + .arg(RealTime::frame2RealTime + (f, m_mainModelSampleRate).toText().c_str())); + if (mode == PlaybackIgnore) { return; } @@ -539,6 +566,7 @@ #endif emit viewZoomLevelChanged(v, z, locked); + emit activity(tr("Zoom to %n sample(s) per pixel", "", z)); } void @@ -547,6 +575,7 @@ if (m_overlayMode != mode) { m_overlayMode = mode; emit overlayModeChanged(); + emit activity(tr("Change overlay level")); } QSettings settings; @@ -561,6 +590,8 @@ if (m_zoomWheelsEnabled != enabled) { m_zoomWheelsEnabled = enabled; emit zoomWheelsEnabledChanged(); + if (enabled) emit activity("Show zoom wheels"); + else emit activity("Hide zoom wheels"); } QSettings settings; diff -r 08e1ccfe289c -r 73a58a4dfebd view/ViewManager.h --- a/view/ViewManager.h Tue Feb 24 12:17:18 2009 +0000 +++ b/view/ViewManager.h Tue Feb 24 14:01:42 2009 +0000 @@ -235,6 +235,9 @@ /** Emitted when the zoom wheels have been toggled. */ void zoomWheelsEnabledChanged(); + /** Emitted when any loggable activity has occurred. */ + void activity(QString); + public slots: void viewCentreFrameChanged(unsigned long, bool, PlaybackFollowMode); void viewZoomLevelChanged(unsigned long, bool); diff -r 08e1ccfe289c -r 73a58a4dfebd widgets/ActivityLog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgets/ActivityLog.cpp Tue Feb 24 14:01:42 2009 +0000 @@ -0,0 +1,50 @@ +/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ + +/* + Sonic Visualiser + An audio file viewer and annotation editor. + Centre for Digital Music, Queen Mary, University of London. + This file copyright 2009 QMUL. + + 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. See the file + COPYING included with this distribution for more information. +*/ + +#include "ActivityLog.h" + +#include +#include +#include + +#include + +ActivityLog::ActivityLog() : QDialog() +{ + m_model = new QStringListModel; + m_listView = new QListView; + QGridLayout *layout = new QGridLayout; + layout->addWidget(m_listView, 0, 0); + setLayout(layout); + m_listView->setModel(m_model); +} + +ActivityLog::~ActivityLog() +{ +} + +void +ActivityLog::activityHappened(QString name) +{ + name = name.replace("&", ""); + std::cerr << "ActivityLog::activityHappened(" << name.toStdString() << ")" << std::endl; +// int row = m_model->rowCount(); + int row = 0; + m_model->insertRows(row, 1); + m_model->setData(m_model->index(row, 0), name); +} + + + diff -r 08e1ccfe289c -r 73a58a4dfebd widgets/ActivityLog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgets/ActivityLog.h Tue Feb 24 14:01:42 2009 +0000 @@ -0,0 +1,41 @@ +/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ + +/* + Sonic Visualiser + An audio file viewer and annotation editor. + Centre for Digital Music, Queen Mary, University of London. + This file copyright 2009 QMUL. + + 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. See the file + COPYING included with this distribution for more information. +*/ + +#ifndef _ACTIVITY_LOG_H_ +#define _ACTIVITY_LOG_H_ + +#include +#include + +class QListView; +class QStringListModel; + +class ActivityLog : public QDialog +{ + Q_OBJECT + +public: + ActivityLog(); + ~ActivityLog(); + +public slots: + void activityHappened(QString); + +private: + QListView *m_listView; + QStringListModel *m_model; +}; + +#endif diff -r 08e1ccfe289c -r 73a58a4dfebd widgets/CommandHistory.cpp --- a/widgets/CommandHistory.cpp Tue Feb 24 12:17:18 2009 +0000 +++ b/widgets/CommandHistory.cpp Tue Feb 24 14:01:42 2009 +0000 @@ -47,8 +47,9 @@ m_currentCompound(0), m_executeCompound(false), m_currentBundle(0), + m_bundling(false), m_bundleTimer(0), - m_bundleTimeout(5000) + m_bundleTimeout(3000) { m_undoAction = new QAction(QIcon(":/icons/undo.png"), tr("&Undo"), this); m_undoAction->setShortcut(tr("Ctrl+Z")); @@ -178,7 +179,8 @@ // someone must have executed it for this to make any sense emit commandExecuted(); emit commandExecuted(command); - + if (!m_bundling) emit activity(command->getName()); + updateActions(); } @@ -209,7 +211,9 @@ // need to addCommand before setting m_currentBundle, as addCommand // with bundle false will reset m_currentBundle to 0 MacroCommand *mc = new BundleCommand(command->getName()); + m_bundling = true; addCommand(mc, false); + m_bundling = false; m_currentBundle = mc; m_currentBundleName = command->getName(); } @@ -243,6 +247,7 @@ std::cerr << "CommandHistory::closeBundle" << std::endl; #endif + if (m_currentBundle) emit activity(m_currentBundle->getName()); m_currentBundle = 0; m_currentBundleName = ""; } @@ -334,6 +339,7 @@ command->unexecute(); emit commandExecuted(); emit commandUnexecuted(command); + emit activity(tr("Undo %1").arg(command->getName())); m_redoStack.push(command); m_undoStack.pop(); @@ -359,6 +365,7 @@ command->execute(); emit commandExecuted(); emit commandExecuted(command); + emit activity(tr("Redo %1").arg(command->getName())); m_undoStack.push(command); m_redoStack.pop(); diff -r 08e1ccfe289c -r 73a58a4dfebd widgets/CommandHistory.h --- a/widgets/CommandHistory.h Tue Feb 24 12:17:18 2009 +0000 +++ b/widgets/CommandHistory.h Tue Feb 24 14:01:42 2009 +0000 @@ -181,6 +181,11 @@ */ void documentRestored(); + /** + * Emitted when some activity happened (for activity logging). + */ + void activity(QString); + protected: CommandHistory(); static CommandHistory *m_instance; @@ -208,6 +213,7 @@ void addToCompound(Command *command, bool execute); MacroCommand *m_currentBundle; + bool m_bundling; QString m_currentBundleName; QTimer *m_bundleTimer; int m_bundleTimeout; diff -r 08e1ccfe289c -r 73a58a4dfebd widgets/widgets.pro --- a/widgets/widgets.pro Tue Feb 24 12:17:18 2009 +0000 +++ b/widgets/widgets.pro Tue Feb 24 14:01:42 2009 +0000 @@ -14,7 +14,8 @@ MOC_DIR = tmp_moc # Input -HEADERS += AudioDial.h \ +HEADERS += ActivityLog.h \ + AudioDial.h \ ClickableLabel.h \ ColourNameDialog.h \ CommandHistory.h \ @@ -51,7 +52,8 @@ TransformFinder.h \ WindowShapePreview.h \ WindowTypeSelector.h -SOURCES += AudioDial.cpp \ +SOURCES += ActivityLog.cpp \ + AudioDial.cpp \ ColourNameDialog.cpp \ CommandHistory.cpp \ CSVFormatDialog.cpp \