Menu

[efa3d9]: / src / slideeditor.cpp  Maximize  Restore  History

Download this file

104 lines (79 with data), 3.0 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
#include <QTreeView>
#include <QVBoxLayout>
#include "mainwindow.h"
#include "slidecontrolwidget.h"
#include "slideitem.h"
#include "slidemodel.h"
#include "vymmodel.h"
#include "slideeditor.h"
extern Main *mainWindow;
extern SlideEditor *slideEditor;
extern QString editorFocusStyle;
SlideEditor::SlideEditor(VymModel *m)
{
vymModel = m;
// Create slides model
slideModel = vymModel->getSlideModel();
// Create TreeView
view = new QTreeView(this);
view->setModel(slideModel);
slideModel->setSelectionModel(view->selectionModel());
view->setStyleSheet("QTreeView:focus {" + editorFocusStyle + "}");
// Create ControlWidget
slideControl = new SlideControlWidget(this);
connect(slideControl, SIGNAL(takeSnapshot()), this, SLOT(addSlide()));
connect(slideControl, SIGNAL(editButtonPressed()), mainWindow,
SLOT(windowToggleScriptEditor()));
connect(slideControl, SIGNAL(deleteButtonPressed()), this,
SLOT(deleteSlide()));
connect(slideControl, SIGNAL(previousButtonPressed()), this,
SLOT(previousSlide()));
connect(slideControl, SIGNAL(nextButtonPressed()), this, SLOT(nextSlide()));
connect(slideControl, SIGNAL(upButtonPressed()), this, SLOT(moveSlideUp()));
connect(slideControl, SIGNAL(downButtonPressed()), this,
SLOT(moveSlideDown()));
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(view);
mainLayout->addWidget(slideControl);
setLayout(mainLayout);
// Selection
connect(view->selectionModel(),
SIGNAL(selectionChanged(QItemSelection, QItemSelection)), vymModel,
SLOT(updateSlideSelection(QItemSelection, QItemSelection)));
connect(view->selectionModel(),
SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this,
SLOT(updateSelection(QItemSelection, QItemSelection)));
// connect (resultsModel, SIGNAL(layoutChanged() ), view, SLOT
// (expandAll() ));
}
void SlideEditor::previousSlide()
{
QModelIndex ix = slideModel->getSelectedIndex();
if (ix.isValid())
ix = view->indexAbove(ix);
if (ix.isValid())
view->selectionModel()->select(ix, QItemSelectionModel::ClearAndSelect);
}
void SlideEditor::nextSlide()
{
QModelIndex ix = slideModel->getSelectedIndex();
if (ix.isValid())
ix = view->indexBelow(ix);
if (ix.isValid())
view->selectionModel()->select(ix, QItemSelectionModel::ClearAndSelect);
}
void SlideEditor::addSlide() { vymModel->addSlide(); }
void SlideEditor::editSlide() // FIXME-5 not used yet
{
}
void SlideEditor::deleteSlide()
{
SlideItem *si = slideModel->getSelectedItem();
vymModel->deleteSlide(si);
}
void SlideEditor::moveSlideUp() { vymModel->moveSlideUp(); }
void SlideEditor::moveSlideDown() { vymModel->moveSlideDown(); }
void SlideEditor::updateSelection(QItemSelection, QItemSelection)
{
// FIXME-4 updateActions missing, e.g. state for moveUp/down
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.