comparison main/MainWindow.cpp @ 219:0f635e16881d

* Improvements to layer summary dialog (LayerTree, LayerTreeDialog), & rename. It's still rather unstable though.
author Chris Cannam
date Wed, 28 Nov 2007 17:45:37 +0000
parents e6b581c7c246
children 474ddd0f4bb4
comparison
equal deleted inserted replaced
218:e6b581c7c246 219:0f635e16881d
39 #include "view/Overview.h" 39 #include "view/Overview.h"
40 #include "widgets/PropertyBox.h" 40 #include "widgets/PropertyBox.h"
41 #include "widgets/PropertyStack.h" 41 #include "widgets/PropertyStack.h"
42 #include "widgets/AudioDial.h" 42 #include "widgets/AudioDial.h"
43 #include "widgets/IconLoader.h" 43 #include "widgets/IconLoader.h"
44 #include "widgets/LayerTree.h" 44 #include "widgets/LayerTreeDialog.h"
45 #include "widgets/ListInputDialog.h" 45 #include "widgets/ListInputDialog.h"
46 #include "widgets/SubdividingMenu.h" 46 #include "widgets/SubdividingMenu.h"
47 #include "widgets/NotifyingPushButton.h" 47 #include "widgets/NotifyingPushButton.h"
48 #include "widgets/KeyReference.h" 48 #include "widgets/KeyReference.h"
49 #include "widgets/LabelCounterInputDialog.h" 49 #include "widgets/LabelCounterInputDialog.h"
131 m_soloModified(false), 131 m_soloModified(false),
132 m_prevSolo(false), 132 m_prevSolo(false),
133 m_ffwdAction(0), 133 m_ffwdAction(0),
134 m_rwdAction(0), 134 m_rwdAction(0),
135 m_preferencesDialog(0), 135 m_preferencesDialog(0),
136 m_layerTreeView(0), 136 m_layerTreeDialog(0),
137 m_keyReference(new KeyReference()) 137 m_keyReference(new KeyReference())
138 { 138 {
139 setWindowTitle(tr("Sonic Visualiser")); 139 setWindowTitle(tr("Sonic Visualiser"));
140 140
141 UnitDatabase *udb = UnitDatabase::getInstance(); 141 UnitDatabase *udb = UnitDatabase::getInstance();
283 283
284 MainWindow::~MainWindow() 284 MainWindow::~MainWindow()
285 { 285 {
286 delete m_keyReference; 286 delete m_keyReference;
287 delete m_preferencesDialog; 287 delete m_preferencesDialog;
288 delete m_layerTreeView; 288 delete m_layerTreeDialog;
289 Profiles::getInstance()->dump(); 289 Profiles::getInstance()->dump();
290 } 290 }
291 291
292 void 292 void
293 MainWindow::setupMenus() 293 MainWindow::setupMenus()
816 } 816 }
817 settings.endGroup(); 817 settings.endGroup();
818 818
819 menu->addSeparator(); 819 menu->addSeparator();
820 820
821 action = new QAction(tr("Show La&yer Hierarchy"), this); 821 action = new QAction(tr("Show La&yer Summary"), this);
822 action->setShortcut(tr("H")); 822 action->setShortcut(tr("Y"));
823 action->setStatusTip(tr("Open a window displaying the hierarchy of panes and layers in this session")); 823 action->setStatusTip(tr("Open a window displaying the hierarchy of panes and layers in this session"));
824 connect(action, SIGNAL(triggered()), this, SLOT(showLayerTree())); 824 connect(action, SIGNAL(triggered()), this, SLOT(showLayerTree()));
825 m_keyReference->registerShortcut(action); 825 m_keyReference->registerShortcut(action);
826 menu->addAction(action); 826 menu->addAction(action);
827 } 827 }
2519 m_preferencesDialog->isVisible()) { 2519 m_preferencesDialog->isVisible()) {
2520 closeSession(); // otherwise we'll have to wait for prefs changes 2520 closeSession(); // otherwise we'll have to wait for prefs changes
2521 m_preferencesDialog->applicationClosing(false); 2521 m_preferencesDialog->applicationClosing(false);
2522 } 2522 }
2523 2523
2524 if (m_layerTreeView && 2524 if (m_layerTreeDialog &&
2525 m_layerTreeView->isVisible()) { 2525 m_layerTreeDialog->isVisible()) {
2526 delete m_layerTreeView; 2526 delete m_layerTreeDialog;
2527 } 2527 }
2528 2528
2529 closeSession(); 2529 closeSession();
2530 2530
2531 e->accept(); 2531 e->accept();
2875 PluginTransformer::ExecutionContext context(channel); 2875 PluginTransformer::ExecutionContext context(channel);
2876 2876
2877 std::vector<Model *> candidateInputModels = 2877 std::vector<Model *> candidateInputModels =
2878 m_document->getTransformerInputModels(); 2878 m_document->getTransformerInputModels();
2879 2879
2880 Model *defaultInputModel = 0;
2881 for (int j = 0; j < pane->getLayerCount(); ++j) {
2882 Layer *layer = pane->getLayer(j);
2883 if (!layer) continue;
2884 Model *model = layer->getModel();
2885 if (!model) continue;
2886 for (size_t k = 0; k < candidateInputModels.size(); ++k) {
2887 if (candidateInputModels[k] == model) {
2888 defaultInputModel = model;
2889 break;
2890 }
2891 }
2892 if (defaultInputModel) break;
2893 }
2894
2880 size_t startFrame = 0, duration = 0; 2895 size_t startFrame = 0, duration = 0;
2881 size_t endFrame = 0; 2896 size_t endFrame = 0;
2882 m_viewManager->getSelection().getExtents(startFrame, endFrame); 2897 m_viewManager->getSelection().getExtents(startFrame, endFrame);
2883 if (endFrame > startFrame) duration = endFrame - startFrame; 2898 if (endFrame > startFrame) duration = endFrame - startFrame;
2884 else startFrame = 0; 2899 else startFrame = 0;
2885 2900
2886 Model *inputModel = factory->getConfigurationForTransformer 2901 Model *inputModel = factory->getConfigurationForTransformer
2887 (transform, 2902 (transform,
2888 candidateInputModels, 2903 candidateInputModels,
2904 defaultInputModel,
2889 context, 2905 context,
2890 configurationXml, 2906 configurationXml,
2891 m_playSource, 2907 m_playSource,
2892 startFrame, 2908 startFrame,
2893 duration); 2909 duration);
3253 } 3269 }
3254 3270
3255 void 3271 void
3256 MainWindow::showLayerTree() 3272 MainWindow::showLayerTree()
3257 { 3273 {
3258 if (!m_layerTreeView.isNull()) { 3274 if (!m_layerTreeDialog.isNull()) {
3259 m_layerTreeView->show(); 3275 m_layerTreeDialog->show();
3260 m_layerTreeView->raise(); 3276 m_layerTreeDialog->raise();
3261 return; 3277 return;
3262 } 3278 }
3263 3279
3264 //!!! should use an actual dialog class 3280 m_layerTreeDialog = new LayerTreeDialog(m_paneStack);
3265 3281 m_layerTreeDialog->show();
3266 m_layerTreeView = new QTreeView();
3267 LayerTreeModel *tree = new LayerTreeModel(m_paneStack);
3268 m_layerTreeView->resize(500, 300); //!!!
3269 m_layerTreeView->setModel(tree);
3270 m_layerTreeView->expandAll();
3271 m_layerTreeView->show();
3272 } 3282 }
3273 3283
3274 void 3284 void
3275 MainWindow::preferences() 3285 MainWindow::preferences()
3276 { 3286 {