Mercurial > hg > dmlib
changeset 381:71c830840691
More work.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 17 Oct 2012 03:59:33 +0300 |
parents | ccb6e5108953 |
children | 371edff7dc3d |
files | edgui.cpp edmain.h |
diffstat | 2 files changed, 54 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/edgui.cpp Wed Oct 17 03:46:40 2012 +0300 +++ b/edgui.cpp Wed Oct 17 03:59:33 2012 +0300 @@ -5,6 +5,7 @@ #include "edmain.h" #include <QCloseEvent> +#include <QToolBar> #include <QMenuBar> #include <QStatusBar> #include <QMenu> @@ -273,6 +274,10 @@ // // Various menu actions // +void DemoEditor::actionControlChanged(QAction *act) +{ +// view->setToolMode(act->data().toInt()); +} // @@ -418,8 +423,37 @@ MCONNECT(helpMenu, act, actionAboutBox()); + + // + // Controls toolbar + // qDebug() << "- Constructing toolbars"; + actGroupControls = new QActionGroup(this); + actGroupControls->setExclusive(true); + connect(actGroupControls, SIGNAL(triggered(QAction*)), this, SLOT(actionControlChanged(QAction *))); + + createToolButton(actGroupControls, "Rewind", QIcon("rewind.png"), + "Rewind to start of the timeline", CTRL_REWIND); + + createToolButton(actGroupControls, "Play start", QIcon("play1.png"), + "Play from start", CTRL_PLAY_START); + + createToolButton(actGroupControls, "Play current", QIcon("play2.png"), + "Play from current position", CTRL_PLAY_CURRENT); + + createToolButton(actGroupControls, "Pause", QIcon("pause.png"), + "Pause", CTRL_PAUSE); + + + QToolBar *toolBarTools = new QToolBar("Player controls", this); + toolBarTools->setMovable(false); + toolBarTools->setFloatable(false); + toolBarTools->setIconSize(QSize(CTRL_ICON_SIZE, CTRL_ICON_SIZE)); + toolBarTools->setToolButtonStyle(Qt::ToolButtonIconOnly); + toolBarTools->addActions(actGroupControls->actions()); + + // // Construct the main screen // @@ -433,6 +467,7 @@ QVBoxLayout *sideVBox = new QVBoxLayout(sideVBoxContainer); sideVBox->setSpacing(0); sideVBox->setContentsMargins(0, 0, 0, 0); + sideVBox->addWidget(toolBarTools); // view = new MapView();
--- a/edmain.h Wed Oct 17 03:46:40 2012 +0300 +++ b/edmain.h Wed Oct 17 03:59:33 2012 +0300 @@ -7,10 +7,19 @@ // Defaults #define DOC_DEF_FILENAME "Untitled" -#define DOC_UNDO_MAX 30 +#define DOC_UNDO_MAX 15 + +enum +{ + CTRL_REWIND, + CTRL_PLAY_START, + CTRL_PLAY_CURRENT, + CTRL_PAUSE +}; + +#define CTRL_ICON_SIZE 32 #include "edtlobj.h" - #include <QDebug> #include <QFile> #include <QApplication> @@ -51,15 +60,13 @@ void performUndo(); void performRedo(); + void actionControlChanged(QAction *); + private: - bool changed, initSDL; - TimelineObject *tl; - DMEngineData engine; - - - QTableView *list; + QTableView *effectTable; QAction *menuActUndo, *menuActRedo, *menuActOpen, *menuActSave, *menuActSaveAs; // QAction *menuActCut, *menuActCopy, *menuActPaste, *menuActDelete; + QActionGroup *actGroupControls; QAction * createToolButton(QActionGroup *group, QString name, QIcon icon, QString statustip, QVariant data); QAction * createMenuAction(QString name, const QKeySequence &shortcut, QString tooltip); @@ -86,6 +93,10 @@ void saveToFile(QString filename); + bool changed, initSDL; + TimelineObject *tl; + DMEngineData engine; + QList<TimelineObject *> undoHistory; int undoHistoryPos, undoHistoryMax;