mirror of
https://github.com/leozide/leocad
synced 2025-01-28 19:58:12 +01:00
Added the initial version of the timeline widget.
This commit is contained in:
parent
7440111b64
commit
958a7fa383
5 changed files with 83 additions and 2 deletions
|
@ -2,6 +2,7 @@
|
|||
#include "lc_mainwindow.h"
|
||||
#include <QPrintDialog>
|
||||
#include <QPrintPreviewDialog>
|
||||
#include "lc_timelinewidget.h"
|
||||
#include "lc_qglwidget.h"
|
||||
#include "lc_qpartstree.h"
|
||||
#include "lc_qcolorlist.h"
|
||||
|
@ -316,6 +317,7 @@ void lcMainWindow::CreateMenus()
|
|||
QMenu* ToolBarsMenu = ViewMenu->addMenu(tr("T&oolbars"));
|
||||
ToolBarsMenu->addAction(mPartsToolBar->toggleViewAction());
|
||||
ToolBarsMenu->addAction(mPropertiesToolBar->toggleViewAction());
|
||||
ToolBarsMenu->addAction(mTimelineToolBar->toggleViewAction());
|
||||
ToolBarsMenu->addSeparator();
|
||||
ToolBarsMenu->addAction(mStandardToolBar->toggleViewAction());
|
||||
ToolBarsMenu->addAction(mToolsToolBar->toggleViewAction());
|
||||
|
@ -541,7 +543,17 @@ void lcMainWindow::CreateToolBars()
|
|||
mPropertiesToolBar->setWidget(mPropertiesWidget);
|
||||
addDockWidget(Qt::RightDockWidgetArea, mPropertiesToolBar);
|
||||
|
||||
mTimelineToolBar = new QDockWidget(tr("Timeline"), this);
|
||||
mTimelineToolBar->setObjectName("TimelineToolbar");
|
||||
mTimelineToolBar->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||
|
||||
mTimelineWidget = new lcTimelineWidget(mTimelineToolBar);
|
||||
|
||||
mTimelineToolBar->setWidget(mTimelineWidget);
|
||||
addDockWidget(Qt::RightDockWidgetArea, mTimelineToolBar);
|
||||
|
||||
tabifyDockWidget(mPartsToolBar, mPropertiesToolBar);
|
||||
tabifyDockWidget(mPropertiesToolBar, mTimelineToolBar);
|
||||
mPartsToolBar->raise();
|
||||
}
|
||||
|
||||
|
@ -585,6 +597,7 @@ QMenu* lcMainWindow::createPopupMenu()
|
|||
|
||||
Menu->addAction(mPartsToolBar->toggleViewAction());
|
||||
Menu->addAction(mPropertiesToolBar->toggleViewAction());
|
||||
Menu->addAction(mTimelineToolBar->toggleViewAction());
|
||||
Menu->addSeparator();
|
||||
Menu->addAction(mStandardToolBar->toggleViewAction());
|
||||
Menu->addAction(mToolsToolBar->toggleViewAction());
|
||||
|
@ -1345,6 +1358,7 @@ void lcMainWindow::RemoveRecentFile(int FileIndex)
|
|||
|
||||
void lcMainWindow::UpdateFocusObject(lcObject* Focus)
|
||||
{
|
||||
UpdateTimeline();
|
||||
mPropertiesWidget->updateFocusObject(Focus);
|
||||
|
||||
lcVector3 Position;
|
||||
|
@ -1409,6 +1423,11 @@ void lcMainWindow::UpdateSelectedObjects(int Flags, int SelectedCount, lcObject*
|
|||
mStatusBarLabel->setText(Message);
|
||||
}
|
||||
|
||||
void lcMainWindow::UpdateTimeline()
|
||||
{
|
||||
mTimelineWidget->Update();
|
||||
}
|
||||
|
||||
void lcMainWindow::UpdatePaste(bool Enabled)
|
||||
{
|
||||
QAction* Action = mActions[LC_EDIT_PASTE];
|
||||
|
|
|
@ -12,6 +12,7 @@ class lcQGLWidget;
|
|||
class lcQPartsTree;
|
||||
class lcQColorList;
|
||||
class lcQPropertiesTree;
|
||||
class lcTimelineWidget;
|
||||
|
||||
#define LC_MAX_RECENT_FILES 4
|
||||
|
||||
|
@ -164,6 +165,7 @@ public:
|
|||
|
||||
void UpdateFocusObject(lcObject* Focus);
|
||||
void UpdateSelectedObjects(int Flags, int SelectedCount, lcObject* Focus);
|
||||
void UpdateTimeline();
|
||||
void UpdatePaste(bool Enabled);
|
||||
void UpdateCurrentStep();
|
||||
void SetAddKeys(bool AddKeys);
|
||||
|
@ -230,12 +232,14 @@ protected:
|
|||
QToolBar* mTimeToolBar;
|
||||
QDockWidget* mPartsToolBar;
|
||||
QDockWidget* mPropertiesToolBar;
|
||||
QDockWidget* mTimelineToolBar;
|
||||
|
||||
lcQGLWidget* mPiecePreviewWidget;
|
||||
lcQPartsTree* mPartsTree;
|
||||
QLineEdit* mPartSearchEdit;
|
||||
lcQColorList* mColorList;
|
||||
lcQPropertiesTree* mPropertiesWidget;
|
||||
lcTimelineWidget* mTimelineWidget;
|
||||
QLineEdit* mTransformXEdit;
|
||||
QLineEdit* mTransformYEdit;
|
||||
QLineEdit* mTransformZEdit;
|
||||
|
|
43
common/lc_timelinewidget.cpp
Normal file
43
common/lc_timelinewidget.cpp
Normal file
|
@ -0,0 +1,43 @@
|
|||
#include "lc_global.h"
|
||||
#include "lc_timelinewidget.h"
|
||||
#include "lc_model.h"
|
||||
#include "project.h"
|
||||
#include "piece.h"
|
||||
#include "pieceinf.h"
|
||||
|
||||
lcTimelineWidget::lcTimelineWidget(QWidget* Parent)
|
||||
: QTreeWidget(Parent)
|
||||
{
|
||||
header()->hide();
|
||||
}
|
||||
|
||||
lcTimelineWidget::~lcTimelineWidget()
|
||||
{
|
||||
}
|
||||
|
||||
void lcTimelineWidget::Update()
|
||||
{
|
||||
clear();
|
||||
|
||||
lcModel* Model = lcGetActiveModel();
|
||||
|
||||
if (!Model)
|
||||
return;
|
||||
|
||||
int Steps = Model->GetLastStep();
|
||||
QList<QTreeWidgetItem*> StepItems;
|
||||
StepItems.reserve(Steps);
|
||||
|
||||
for (int Step = 0; Step < Steps; Step++)
|
||||
StepItems.append(new QTreeWidgetItem(this, QStringList(tr("Step %1").arg(Step + 1))));
|
||||
|
||||
const lcArray<lcPiece*>& Pieces = Model->GetPieces();
|
||||
|
||||
for (int PieceIdx = 0; PieceIdx < Pieces.GetSize(); PieceIdx++)
|
||||
{
|
||||
lcPiece* Piece = Pieces[PieceIdx];
|
||||
new QTreeWidgetItem(StepItems[Piece->GetStepShow() - 1], QStringList(Piece->mPieceInfo->m_strDescription));
|
||||
}
|
||||
|
||||
insertTopLevelItems(0, StepItems);
|
||||
}
|
13
common/lc_timelinewidget.h
Normal file
13
common/lc_timelinewidget.h
Normal file
|
@ -0,0 +1,13 @@
|
|||
#ifndef _LC_TIMELINEWIDGET_H_
|
||||
#define _LC_TIMELINEWIDGET_H_
|
||||
|
||||
class lcTimelineWidget : public QTreeWidget
|
||||
{
|
||||
public:
|
||||
lcTimelineWidget(QWidget* Parent);
|
||||
virtual ~lcTimelineWidget();
|
||||
|
||||
void Update();
|
||||
};
|
||||
|
||||
#endif // _LC_TIMELINEWIDGET_H_
|
|
@ -168,7 +168,8 @@ SOURCES += common/view.cpp \
|
|||
qt/lc_qglwidget.cpp \
|
||||
qt/lc_qcolorlist.cpp \
|
||||
qt/lc_qfinddialog.cpp \
|
||||
qt/lc_qmodellistdialog.cpp
|
||||
qt/lc_qmodellistdialog.cpp \
|
||||
common/lc_timelinewidget.cpp
|
||||
HEADERS += \
|
||||
common/view.h \
|
||||
common/tr.h \
|
||||
|
@ -226,7 +227,8 @@ HEADERS += \
|
|||
qt/lc_qglwidget.h \
|
||||
qt/lc_qcolorlist.h \
|
||||
qt/lc_qfinddialog.h \
|
||||
qt/lc_qmodellistdialog.h
|
||||
qt/lc_qmodellistdialog.h \
|
||||
common/lc_timelinewidget.h
|
||||
FORMS += \
|
||||
qt/lc_qpovraydialog.ui \
|
||||
qt/lc_qarraydialog.ui \
|
||||
|
|
Loading…
Add table
Reference in a new issue