change: change code style to Linux style except indent.
This commit is contained in:
+113
-107
@@ -31,186 +31,192 @@
|
||||
#include "widget/menu/menu.h"
|
||||
#include "widget/menu/menushared.h"
|
||||
|
||||
namespace olive {
|
||||
namespace olive
|
||||
{
|
||||
|
||||
#define super QWidget
|
||||
|
||||
Toolbar::Toolbar(QWidget *parent) :
|
||||
super(parent)
|
||||
Toolbar::Toolbar(QWidget *parent)
|
||||
: super(parent)
|
||||
{
|
||||
layout_ = new FlowLayout(this);
|
||||
layout_->setContentsMargins(0, 0, 0, 0);
|
||||
layout_ = new FlowLayout(this);
|
||||
layout_->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
// Create standard tool buttons
|
||||
btn_pointer_tool_ = CreateToolButton(Tool::kPointer);
|
||||
btn_trackselect_tool_ = CreateToolButton(Tool::kTrackSelect);
|
||||
btn_edit_tool_ = CreateToolButton(Tool::kEdit);
|
||||
btn_ripple_tool_ = CreateToolButton(Tool::kRipple);
|
||||
btn_rolling_tool_ = CreateToolButton(Tool::kRolling);
|
||||
btn_razor_tool_ = CreateToolButton(Tool::kRazor);
|
||||
btn_slip_tool_ = CreateToolButton(Tool::kSlip);
|
||||
btn_slide_tool_ = CreateToolButton(Tool::kSlide);
|
||||
btn_hand_tool_ = CreateToolButton(Tool::kHand);
|
||||
btn_zoom_tool_ = CreateToolButton(Tool::kZoom);
|
||||
btn_record_ = CreateToolButton(Tool::kRecord);
|
||||
btn_transition_tool_ = CreateToolButton(Tool::kTransition);
|
||||
btn_add_ = CreateToolButton(Tool::kAdd);
|
||||
// Create standard tool buttons
|
||||
btn_pointer_tool_ = CreateToolButton(Tool::kPointer);
|
||||
btn_trackselect_tool_ = CreateToolButton(Tool::kTrackSelect);
|
||||
btn_edit_tool_ = CreateToolButton(Tool::kEdit);
|
||||
btn_ripple_tool_ = CreateToolButton(Tool::kRipple);
|
||||
btn_rolling_tool_ = CreateToolButton(Tool::kRolling);
|
||||
btn_razor_tool_ = CreateToolButton(Tool::kRazor);
|
||||
btn_slip_tool_ = CreateToolButton(Tool::kSlip);
|
||||
btn_slide_tool_ = CreateToolButton(Tool::kSlide);
|
||||
btn_hand_tool_ = CreateToolButton(Tool::kHand);
|
||||
btn_zoom_tool_ = CreateToolButton(Tool::kZoom);
|
||||
btn_record_ = CreateToolButton(Tool::kRecord);
|
||||
btn_transition_tool_ = CreateToolButton(Tool::kTransition);
|
||||
btn_add_ = CreateToolButton(Tool::kAdd);
|
||||
|
||||
// Create snapping button, which is not actually a tool, it's a toggle option
|
||||
btn_snapping_toggle_ = CreateNonToolButton();
|
||||
connect(btn_snapping_toggle_, &QPushButton::clicked, this, &Toolbar::SnappingButtonClicked);
|
||||
// Create snapping button, which is not actually a tool, it's a toggle option
|
||||
btn_snapping_toggle_ = CreateNonToolButton();
|
||||
connect(btn_snapping_toggle_, &QPushButton::clicked, this,
|
||||
&Toolbar::SnappingButtonClicked);
|
||||
|
||||
// Connect transition button to menu signal
|
||||
connect(btn_transition_tool_, &QPushButton::clicked, this, &Toolbar::TransitionButtonClicked);
|
||||
// Connect transition button to menu signal
|
||||
connect(btn_transition_tool_, &QPushButton::clicked, this,
|
||||
&Toolbar::TransitionButtonClicked);
|
||||
|
||||
// Connect add button to menu signal
|
||||
connect(btn_add_, &QPushButton::clicked, this, &Toolbar::AddButtonClicked);
|
||||
// Connect add button to menu signal
|
||||
connect(btn_add_, &QPushButton::clicked, this, &Toolbar::AddButtonClicked);
|
||||
|
||||
Retranslate();
|
||||
UpdateIcons();
|
||||
Retranslate();
|
||||
UpdateIcons();
|
||||
}
|
||||
|
||||
void Toolbar::SetTool(const Tool::Item& tool)
|
||||
void Toolbar::SetTool(const Tool::Item &tool)
|
||||
{
|
||||
// For each tool, set the "checked" state to whether the button's tool is the current tool
|
||||
for (int i=0;i<toolbar_btns_.size();i++) {
|
||||
ToolbarButton* btn = toolbar_btns_.at(i);
|
||||
// For each tool, set the "checked" state to whether the button's tool is the current tool
|
||||
for (int i = 0; i < toolbar_btns_.size(); i++) {
|
||||
ToolbarButton *btn = toolbar_btns_.at(i);
|
||||
|
||||
btn->setChecked(btn->tool() == tool);
|
||||
}
|
||||
btn->setChecked(btn->tool() == tool);
|
||||
}
|
||||
}
|
||||
|
||||
void Toolbar::SetSnapping(const bool& snapping)
|
||||
void Toolbar::SetSnapping(const bool &snapping)
|
||||
{
|
||||
// Set checked state of snapping toggle
|
||||
btn_snapping_toggle_->setChecked(snapping);
|
||||
// Set checked state of snapping toggle
|
||||
btn_snapping_toggle_->setChecked(snapping);
|
||||
}
|
||||
|
||||
void Toolbar::changeEvent(QEvent *e)
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
Retranslate();
|
||||
} else if (e->type() == QEvent::StyleChange) {
|
||||
UpdateIcons();
|
||||
}
|
||||
super::changeEvent(e);
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
Retranslate();
|
||||
} else if (e->type() == QEvent::StyleChange) {
|
||||
UpdateIcons();
|
||||
}
|
||||
super::changeEvent(e);
|
||||
}
|
||||
|
||||
void Toolbar::resizeEvent(QResizeEvent *e)
|
||||
{
|
||||
super::resizeEvent(e);
|
||||
super::resizeEvent(e);
|
||||
|
||||
int min_height = toolbar_btns_.size() * toolbar_btns_.first()->height() + (toolbar_btns_.size()-1) * layout_->verticalSpacing();
|
||||
int new_height = e->size().height();
|
||||
int columns_required = min_height / new_height + (min_height % new_height != 0);
|
||||
setMinimumWidth(toolbar_btns_.first()->width() * columns_required + layout_->horizontalSpacing() * (columns_required-1) + 1);
|
||||
int min_height = toolbar_btns_.size() * toolbar_btns_.first()->height() +
|
||||
(toolbar_btns_.size() - 1) * layout_->verticalSpacing();
|
||||
int new_height = e->size().height();
|
||||
int columns_required =
|
||||
min_height / new_height + (min_height % new_height != 0);
|
||||
setMinimumWidth(toolbar_btns_.first()->width() * columns_required +
|
||||
layout_->horizontalSpacing() * (columns_required - 1) + 1);
|
||||
}
|
||||
|
||||
void Toolbar::Retranslate()
|
||||
{
|
||||
btn_pointer_tool_->setToolTip(tr("Pointer Tool"));
|
||||
btn_trackselect_tool_->setToolTip(tr("Track Select Tool"));
|
||||
btn_edit_tool_->setToolTip(tr("Edit Tool"));
|
||||
btn_ripple_tool_->setToolTip(tr("Ripple Tool"));
|
||||
btn_rolling_tool_->setToolTip(tr("Rolling Tool"));
|
||||
btn_razor_tool_->setToolTip(tr("Razor Tool"));
|
||||
btn_slip_tool_->setToolTip(tr("Slip Tool"));
|
||||
btn_slide_tool_->setToolTip(tr("Slide Tool"));
|
||||
btn_hand_tool_->setToolTip(tr("Hand Tool"));
|
||||
btn_zoom_tool_->setToolTip(tr("Zoom Tool"));
|
||||
btn_transition_tool_->setToolTip(tr("Transition Tool"));
|
||||
btn_record_->setToolTip(tr("Record Tool"));
|
||||
btn_add_->setToolTip(tr("Add Tool"));
|
||||
btn_snapping_toggle_->setToolTip(tr("Toggle Snapping"));
|
||||
btn_pointer_tool_->setToolTip(tr("Pointer Tool"));
|
||||
btn_trackselect_tool_->setToolTip(tr("Track Select Tool"));
|
||||
btn_edit_tool_->setToolTip(tr("Edit Tool"));
|
||||
btn_ripple_tool_->setToolTip(tr("Ripple Tool"));
|
||||
btn_rolling_tool_->setToolTip(tr("Rolling Tool"));
|
||||
btn_razor_tool_->setToolTip(tr("Razor Tool"));
|
||||
btn_slip_tool_->setToolTip(tr("Slip Tool"));
|
||||
btn_slide_tool_->setToolTip(tr("Slide Tool"));
|
||||
btn_hand_tool_->setToolTip(tr("Hand Tool"));
|
||||
btn_zoom_tool_->setToolTip(tr("Zoom Tool"));
|
||||
btn_transition_tool_->setToolTip(tr("Transition Tool"));
|
||||
btn_record_->setToolTip(tr("Record Tool"));
|
||||
btn_add_->setToolTip(tr("Add Tool"));
|
||||
btn_snapping_toggle_->setToolTip(tr("Toggle Snapping"));
|
||||
}
|
||||
|
||||
void Toolbar::UpdateIcons()
|
||||
{
|
||||
btn_pointer_tool_->setIcon(icon::ToolPointer);
|
||||
btn_trackselect_tool_->setIcon(icon::ToolTrackSelect);
|
||||
btn_edit_tool_->setIcon(icon::ToolEdit);
|
||||
btn_ripple_tool_->setIcon(icon::ToolRipple);
|
||||
btn_rolling_tool_->setIcon(icon::ToolRolling);
|
||||
btn_razor_tool_->setIcon(icon::ToolRazor);
|
||||
btn_slip_tool_->setIcon(icon::ToolSlip);
|
||||
btn_slide_tool_->setIcon(icon::ToolSlide);
|
||||
btn_hand_tool_->setIcon(icon::ToolHand);
|
||||
btn_zoom_tool_->setIcon(icon::ZoomIn);
|
||||
btn_record_->setIcon(icon::Record);
|
||||
btn_transition_tool_->setIcon(icon::ToolTransition);
|
||||
btn_add_->setIcon(icon::Add);
|
||||
btn_snapping_toggle_->setIcon(icon::Snapping);
|
||||
btn_pointer_tool_->setIcon(icon::ToolPointer);
|
||||
btn_trackselect_tool_->setIcon(icon::ToolTrackSelect);
|
||||
btn_edit_tool_->setIcon(icon::ToolEdit);
|
||||
btn_ripple_tool_->setIcon(icon::ToolRipple);
|
||||
btn_rolling_tool_->setIcon(icon::ToolRolling);
|
||||
btn_razor_tool_->setIcon(icon::ToolRazor);
|
||||
btn_slip_tool_->setIcon(icon::ToolSlip);
|
||||
btn_slide_tool_->setIcon(icon::ToolSlide);
|
||||
btn_hand_tool_->setIcon(icon::ToolHand);
|
||||
btn_zoom_tool_->setIcon(icon::ZoomIn);
|
||||
btn_record_->setIcon(icon::Record);
|
||||
btn_transition_tool_->setIcon(icon::ToolTransition);
|
||||
btn_add_->setIcon(icon::Add);
|
||||
btn_snapping_toggle_->setIcon(icon::Snapping);
|
||||
}
|
||||
|
||||
ToolbarButton* Toolbar::CreateToolButton(const Tool::Item& tool)
|
||||
ToolbarButton *Toolbar::CreateToolButton(const Tool::Item &tool)
|
||||
{
|
||||
// Create a ToolbarButton object
|
||||
ToolbarButton* b = new ToolbarButton(this, tool);
|
||||
// Create a ToolbarButton object
|
||||
ToolbarButton *b = new ToolbarButton(this, tool);
|
||||
|
||||
// Add it to the layout
|
||||
layout_->addWidget(b);
|
||||
// Add it to the layout
|
||||
layout_->addWidget(b);
|
||||
|
||||
// Add it to the list for iterating through later
|
||||
toolbar_btns_.append(b);
|
||||
// Add it to the list for iterating through later
|
||||
toolbar_btns_.append(b);
|
||||
|
||||
// Connect it to the tool button click handler
|
||||
connect(b, SIGNAL(clicked(bool)), this, SLOT(ToolButtonClicked()));
|
||||
// Connect it to the tool button click handler
|
||||
connect(b, SIGNAL(clicked(bool)), this, SLOT(ToolButtonClicked()));
|
||||
|
||||
return b;
|
||||
return b;
|
||||
}
|
||||
|
||||
ToolbarButton *Toolbar::CreateNonToolButton()
|
||||
{
|
||||
// Create a ToolbarButton object
|
||||
ToolbarButton* b = new ToolbarButton(this, Tool::kNone);
|
||||
// Create a ToolbarButton object
|
||||
ToolbarButton *b = new ToolbarButton(this, Tool::kNone);
|
||||
|
||||
// Add it to the layout
|
||||
layout_->addWidget(b);
|
||||
// Add it to the layout
|
||||
layout_->addWidget(b);
|
||||
|
||||
return b;
|
||||
return b;
|
||||
}
|
||||
|
||||
void Toolbar::ToolButtonClicked()
|
||||
{
|
||||
// Get new tool from ToolbarButton object
|
||||
Tool::Item new_tool = static_cast<ToolbarButton*>(sender())->tool();
|
||||
// Get new tool from ToolbarButton object
|
||||
Tool::Item new_tool = static_cast<ToolbarButton *>(sender())->tool();
|
||||
|
||||
// Set checked state of all tool buttons
|
||||
// NOTE: Not necessary if this is appropriately connected to Core
|
||||
//SetTool(new_tool);
|
||||
// Set checked state of all tool buttons
|
||||
// NOTE: Not necessary if this is appropriately connected to Core
|
||||
//SetTool(new_tool);
|
||||
|
||||
// Emit signal that the tool just changed
|
||||
emit ToolChanged(new_tool);
|
||||
// Emit signal that the tool just changed
|
||||
emit ToolChanged(new_tool);
|
||||
}
|
||||
|
||||
void Toolbar::SnappingButtonClicked(bool b)
|
||||
{
|
||||
emit SnappingChanged(b);
|
||||
emit SnappingChanged(b);
|
||||
}
|
||||
|
||||
void Toolbar::AddButtonClicked()
|
||||
{
|
||||
Menu m(this);
|
||||
Menu m(this);
|
||||
|
||||
MenuShared::instance()->AddItemsForAddableObjectsMenu(&m);
|
||||
MenuShared::instance()->AddItemsForAddableObjectsMenu(&m);
|
||||
|
||||
m.exec(QCursor::pos());
|
||||
m.exec(QCursor::pos());
|
||||
}
|
||||
|
||||
void Toolbar::TransitionButtonClicked()
|
||||
{
|
||||
Menu* m = NodeFactory::CreateMenu(this, false, Node::kCategoryTransition);
|
||||
Menu *m = NodeFactory::CreateMenu(this, false, Node::kCategoryTransition);
|
||||
|
||||
connect(m, &QMenu::triggered, this, &Toolbar::TransitionMenuItemTriggered);
|
||||
connect(m, &QMenu::triggered, this, &Toolbar::TransitionMenuItemTriggered);
|
||||
|
||||
m->exec(QCursor::pos());
|
||||
m->exec(QCursor::pos());
|
||||
|
||||
delete m;
|
||||
delete m;
|
||||
}
|
||||
|
||||
void Toolbar::TransitionMenuItemTriggered(QAction *a)
|
||||
{
|
||||
emit SelectedTransitionChanged(NodeFactory::GetIDFromMenuAction(a));
|
||||
emit SelectedTransitionChanged(NodeFactory::GetIDFromMenuAction(a));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,7 +27,8 @@
|
||||
#include "widget/toolbar/toolbarbutton.h"
|
||||
#include "tool/tool.h"
|
||||
|
||||
namespace olive {
|
||||
namespace olive
|
||||
{
|
||||
|
||||
/**
|
||||
* @brief A widget containing buttons for all of Olive's application-wide tools.
|
||||
@@ -40,11 +41,10 @@ namespace olive {
|
||||
* Toolbar updates the current tool application-wide, and is also automatically updated when the tool is changed
|
||||
* elsewhere.
|
||||
*/
|
||||
class Toolbar : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
class Toolbar : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
/**
|
||||
/**
|
||||
* @brief Toolbar Constructor
|
||||
*
|
||||
* Creates and connects all the Toolbar buttons
|
||||
@@ -53,10 +53,10 @@ public:
|
||||
*
|
||||
* QWidget parent.
|
||||
*/
|
||||
Toolbar(QWidget* parent);
|
||||
Toolbar(QWidget *parent);
|
||||
|
||||
public slots:
|
||||
/**
|
||||
/**
|
||||
* @brief Set the tool to be displayed as "selected"
|
||||
*
|
||||
* This function does not set the application-wide tool, it only sets which tool show as selected in this widget.
|
||||
@@ -67,9 +67,9 @@ public slots:
|
||||
*
|
||||
* Tool to show as selected
|
||||
*/
|
||||
void SetTool(const Tool::Item &tool);
|
||||
void SetTool(const Tool::Item &tool);
|
||||
|
||||
/**
|
||||
/**
|
||||
* @brief Set snapping checked value
|
||||
*
|
||||
* Similar to SetTool(), this does not set anything application-wide, it only changes the displayed button appearance.
|
||||
@@ -77,56 +77,56 @@ public slots:
|
||||
*
|
||||
* @param snapping
|
||||
*/
|
||||
void SetSnapping(const bool &snapping);
|
||||
void SetSnapping(const bool &snapping);
|
||||
|
||||
protected:
|
||||
/**
|
||||
/**
|
||||
* @brief Qt changeEvent
|
||||
*
|
||||
* Overridden to catch language change events (see Retranslate())
|
||||
*
|
||||
* @param e
|
||||
*/
|
||||
virtual void changeEvent(QEvent* e) override;
|
||||
virtual void changeEvent(QEvent *e) override;
|
||||
|
||||
virtual void resizeEvent(QResizeEvent *e) override;
|
||||
virtual void resizeEvent(QResizeEvent *e) override;
|
||||
|
||||
signals:
|
||||
/**
|
||||
/**
|
||||
* @brief Emitted whenever a tool is selected using this widget
|
||||
*
|
||||
* @param t
|
||||
*
|
||||
* Tool that was selected
|
||||
*/
|
||||
void ToolChanged(const Tool::Item& t);
|
||||
void ToolChanged(const Tool::Item &t);
|
||||
|
||||
/**
|
||||
/**
|
||||
* @brief Emitted whenever the snapping setting is changed
|
||||
*
|
||||
* @param b
|
||||
*
|
||||
* New snapping enabled setting
|
||||
*/
|
||||
void SnappingChanged(const bool& b);
|
||||
void SnappingChanged(const bool &b);
|
||||
|
||||
/**
|
||||
/**
|
||||
* @brief Emitted when the selected transition is changed from the transition tool menu
|
||||
*/
|
||||
void SelectedTransitionChanged(const QString& id);
|
||||
void SelectedTransitionChanged(const QString &id);
|
||||
|
||||
private:
|
||||
/**
|
||||
/**
|
||||
* @brief Reset all strings based on the currently selected language
|
||||
*/
|
||||
void Retranslate();
|
||||
void Retranslate();
|
||||
|
||||
/**
|
||||
/**
|
||||
* @brief Update icons after a style change
|
||||
*/
|
||||
void UpdateIcons();
|
||||
void UpdateIcons();
|
||||
|
||||
/**
|
||||
/**
|
||||
* @brief Internal convenience function for creating tool buttons quickly
|
||||
*
|
||||
* This function will create a ToolbarButton object, set the icon to `icon`, set its tool value to `tool`, add it to
|
||||
@@ -139,9 +139,9 @@ private:
|
||||
*
|
||||
* The created ToolbarButton. The button parent is automatically set to `this`.
|
||||
*/
|
||||
ToolbarButton* CreateToolButton(const Tool::Item& tool);
|
||||
ToolbarButton *CreateToolButton(const Tool::Item &tool);
|
||||
|
||||
/**
|
||||
/**
|
||||
* @brief Internal convenience function for creating buttons quickly
|
||||
*
|
||||
* Similar to CreateToolButton() but doesn't add the button to toolbar_btns_ and doesn't connect the button to
|
||||
@@ -152,39 +152,39 @@ private:
|
||||
*
|
||||
* The created ToolbarButton. The button parent is automatically set to `this`.
|
||||
*/
|
||||
ToolbarButton* CreateNonToolButton();
|
||||
ToolbarButton *CreateNonToolButton();
|
||||
|
||||
/**
|
||||
/**
|
||||
* @brief Internal layout used for buttons
|
||||
*/
|
||||
FlowLayout* layout_;
|
||||
FlowLayout *layout_;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @brief Array/list of toolbar buttons
|
||||
*
|
||||
* This list is automatically appended by CreateToolButton(). It's used to iterate through the toolbar buttons
|
||||
* quickly with for loops, etc. See SetTool() for example usage.
|
||||
*/
|
||||
QList<ToolbarButton*> toolbar_btns_;
|
||||
QList<ToolbarButton *> toolbar_btns_;
|
||||
|
||||
ToolbarButton* btn_pointer_tool_;
|
||||
ToolbarButton* btn_trackselect_tool_;
|
||||
ToolbarButton* btn_edit_tool_;
|
||||
ToolbarButton* btn_ripple_tool_;
|
||||
ToolbarButton* btn_rolling_tool_;
|
||||
ToolbarButton* btn_razor_tool_;
|
||||
ToolbarButton* btn_slip_tool_;
|
||||
ToolbarButton* btn_slide_tool_;
|
||||
ToolbarButton* btn_hand_tool_;
|
||||
ToolbarButton* btn_transition_tool_;
|
||||
ToolbarButton* btn_zoom_tool_;
|
||||
ToolbarButton* btn_record_;
|
||||
ToolbarButton* btn_add_;
|
||||
ToolbarButton *btn_pointer_tool_;
|
||||
ToolbarButton *btn_trackselect_tool_;
|
||||
ToolbarButton *btn_edit_tool_;
|
||||
ToolbarButton *btn_ripple_tool_;
|
||||
ToolbarButton *btn_rolling_tool_;
|
||||
ToolbarButton *btn_razor_tool_;
|
||||
ToolbarButton *btn_slip_tool_;
|
||||
ToolbarButton *btn_slide_tool_;
|
||||
ToolbarButton *btn_hand_tool_;
|
||||
ToolbarButton *btn_transition_tool_;
|
||||
ToolbarButton *btn_zoom_tool_;
|
||||
ToolbarButton *btn_record_;
|
||||
ToolbarButton *btn_add_;
|
||||
|
||||
ToolbarButton* btn_snapping_toggle_;
|
||||
ToolbarButton *btn_snapping_toggle_;
|
||||
|
||||
private slots:
|
||||
/**
|
||||
/**
|
||||
* @brief Slot for a ToolbarButton being clicked
|
||||
*
|
||||
* ToolbarButtons created from CreateToolButton() are automatically connected to this slot.
|
||||
@@ -192,9 +192,9 @@ private slots:
|
||||
* and emit a signal indicating that the tool has changed to the newly selected tool. This function static_casts
|
||||
* the sender to ToolbarButton so you should not connect any other class type to this slot.
|
||||
*/
|
||||
void ToolButtonClicked();
|
||||
void ToolButtonClicked();
|
||||
|
||||
/**
|
||||
/**
|
||||
* @brief Receiver for the snapping toggle button
|
||||
*
|
||||
* This function's primary purpose is to emit SnappingChanged() and should be connected to the ToolbarButton's
|
||||
@@ -204,27 +204,26 @@ private slots:
|
||||
*
|
||||
* The new snapping value received from the sender's clicked signal
|
||||
*/
|
||||
void SnappingButtonClicked(bool b);
|
||||
void SnappingButtonClicked(bool b);
|
||||
|
||||
/**
|
||||
/**
|
||||
* @brief Receiver for the add button
|
||||
*
|
||||
* The add button pops up a list for which object to create.
|
||||
*/
|
||||
void AddButtonClicked();
|
||||
void AddButtonClicked();
|
||||
|
||||
/**
|
||||
/**
|
||||
* @brief Receiver for the transition button
|
||||
*
|
||||
* The transition button pops up a list for which transition to create.
|
||||
*/
|
||||
void TransitionButtonClicked();
|
||||
void TransitionButtonClicked();
|
||||
|
||||
/**
|
||||
/**
|
||||
* @brief Receiver for the menu created by TransitionButtonClicked()
|
||||
*/
|
||||
void TransitionMenuItemTriggered(QAction* a);
|
||||
|
||||
void TransitionMenuItemTriggered(QAction *a);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -20,18 +20,19 @@
|
||||
|
||||
#include "toolbarbutton.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
ToolbarButton::ToolbarButton(QWidget *parent, const Tool::Item &tool) :
|
||||
QPushButton(parent),
|
||||
tool_(tool)
|
||||
namespace olive
|
||||
{
|
||||
setCheckable(true);
|
||||
|
||||
ToolbarButton::ToolbarButton(QWidget *parent, const Tool::Item &tool)
|
||||
: QPushButton(parent)
|
||||
, tool_(tool)
|
||||
{
|
||||
setCheckable(true);
|
||||
}
|
||||
|
||||
const Tool::Item &ToolbarButton::tool()
|
||||
{
|
||||
return tool_;
|
||||
return tool_;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,15 +25,15 @@
|
||||
|
||||
#include "tool/tool.h"
|
||||
|
||||
namespace olive {
|
||||
namespace olive
|
||||
{
|
||||
|
||||
/**
|
||||
* @brief Simple derived class of QPushButton to contain an Tool ID. Used as the main widget through Toolbar.
|
||||
*/
|
||||
class ToolbarButton : public QPushButton
|
||||
{
|
||||
class ToolbarButton : public QPushButton {
|
||||
public:
|
||||
/**
|
||||
/**
|
||||
* @brief ToolbarButton Constructor
|
||||
*
|
||||
* @param parent
|
||||
@@ -44,19 +44,20 @@ public:
|
||||
*
|
||||
* Tool object. Must be a member of enum Tool::Item, including kNone if this button does not represent a tool.
|
||||
*/
|
||||
ToolbarButton(QWidget* parent, const Tool::Item& tool);
|
||||
ToolbarButton(QWidget *parent, const Tool::Item &tool);
|
||||
|
||||
/**
|
||||
/**
|
||||
* @brief Retrieve tool ID that this button represents
|
||||
*
|
||||
* Set in the constructor and shouldn't change throughout its lifetime.
|
||||
*/
|
||||
const Tool::Item& tool();
|
||||
const Tool::Item &tool();
|
||||
|
||||
private:
|
||||
/**
|
||||
/**
|
||||
* @brief Internal tool value
|
||||
*/
|
||||
Tool::Item tool_;
|
||||
Tool::Item tool_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user