toggle for moving locked panels implemented
This commit is contained in:
+9
-9
@@ -170,7 +170,7 @@ void Core::DialogImportShow()
|
|||||||
if (!files.isEmpty()) {
|
if (!files.isEmpty()) {
|
||||||
|
|
||||||
// Locate the most recently focused Project panel (assume that's the panel the user wants to import into)
|
// Locate the most recently focused Project panel (assume that's the panel the user wants to import into)
|
||||||
ProjectPanel* active_project_panel = olive::panel_focus_manager->MostRecentlyFocused<ProjectPanel>();
|
ProjectPanel* active_project_panel = olive::panel_manager->MostRecentlyFocused<ProjectPanel>();
|
||||||
Project* active_project;
|
Project* active_project;
|
||||||
|
|
||||||
if (active_project_panel == nullptr // Check that we found a Project panel
|
if (active_project_panel == nullptr // Check that we found a Project panel
|
||||||
@@ -189,7 +189,7 @@ void Core::DialogImportShow()
|
|||||||
void Core::CreateNewFolder()
|
void Core::CreateNewFolder()
|
||||||
{
|
{
|
||||||
// Locate the most recently focused Project panel (assume that's the panel the user wants to import into)
|
// Locate the most recently focused Project panel (assume that's the panel the user wants to import into)
|
||||||
ProjectPanel* active_project_panel = olive::panel_focus_manager->MostRecentlyFocused<ProjectPanel>();
|
ProjectPanel* active_project_panel = olive::panel_manager->MostRecentlyFocused<ProjectPanel>();
|
||||||
Project* active_project;
|
Project* active_project;
|
||||||
|
|
||||||
if (active_project_panel == nullptr // Check that we found a Project panel
|
if (active_project_panel == nullptr // Check that we found a Project panel
|
||||||
@@ -234,7 +234,7 @@ void Core::CreateNewFolder()
|
|||||||
void Core::CreateNewSequence()
|
void Core::CreateNewSequence()
|
||||||
{
|
{
|
||||||
// Locate the most recently focused Project panel (assume that's the panel the user wants to import into)
|
// Locate the most recently focused Project panel (assume that's the panel the user wants to import into)
|
||||||
ProjectPanel* active_project_panel = olive::panel_focus_manager->MostRecentlyFocused<ProjectPanel>();
|
ProjectPanel* active_project_panel = olive::panel_manager->MostRecentlyFocused<ProjectPanel>();
|
||||||
Project* active_project;
|
Project* active_project;
|
||||||
|
|
||||||
if (active_project_panel == nullptr // Check that we found a Project panel
|
if (active_project_panel == nullptr // Check that we found a Project panel
|
||||||
@@ -311,9 +311,9 @@ void Core::CreateNewSequence()
|
|||||||
// Connect timeline end point to renderer
|
// Connect timeline end point to renderer
|
||||||
NodeParam::ConnectEdge(tb->length_output(), rp->length_input());
|
NodeParam::ConnectEdge(tb->length_output(), rp->length_input());
|
||||||
|
|
||||||
olive::panel_focus_manager->MostRecentlyFocused<ViewerPanel>()->ConnectViewerNode(vo);
|
olive::panel_manager->MostRecentlyFocused<ViewerPanel>()->ConnectViewerNode(vo);
|
||||||
olive::panel_focus_manager->MostRecentlyFocused<TimelinePanel>()->ConnectTimelineNode(tb);
|
olive::panel_manager->MostRecentlyFocused<TimelinePanel>()->ConnectTimelineNode(tb);
|
||||||
olive::panel_focus_manager->MostRecentlyFocused<NodePanel>()->SetGraph(new_sequence.get());
|
olive::panel_manager->MostRecentlyFocused<NodePanel>()->SetGraph(new_sequence.get());
|
||||||
|
|
||||||
olive::undo_stack.push(aic);
|
olive::undo_stack.push(aic);
|
||||||
}
|
}
|
||||||
@@ -343,12 +343,12 @@ void Core::StartGUI(bool full_screen)
|
|||||||
olive::menu_shared.Initialize();
|
olive::menu_shared.Initialize();
|
||||||
|
|
||||||
// Since we're starting GUI mode, create a PanelFocusManager (auto-deletes with QObject)
|
// Since we're starting GUI mode, create a PanelFocusManager (auto-deletes with QObject)
|
||||||
olive::panel_focus_manager = new PanelManager(this);
|
olive::panel_manager = new PanelManager(this);
|
||||||
|
|
||||||
// Connect the PanelFocusManager to the application's focus change signal
|
// Connect the PanelFocusManager to the application's focus change signal
|
||||||
connect(qApp,
|
connect(qApp,
|
||||||
SIGNAL(focusChanged(QWidget*, QWidget*)),
|
SIGNAL(focusChanged(QWidget*, QWidget*)),
|
||||||
olive::panel_focus_manager,
|
olive::panel_manager,
|
||||||
SLOT(FocusChanged(QWidget*, QWidget*)));
|
SLOT(FocusChanged(QWidget*, QWidget*)));
|
||||||
|
|
||||||
// Create main window and open it
|
// Create main window and open it
|
||||||
@@ -369,7 +369,7 @@ void Core::StartGUI(bool full_screen)
|
|||||||
Project *Core::GetActiveProject()
|
Project *Core::GetActiveProject()
|
||||||
{
|
{
|
||||||
// Locate the most recently focused Project panel (assume that's the panel the user wants to import into)
|
// Locate the most recently focused Project panel (assume that's the panel the user wants to import into)
|
||||||
ProjectPanel* active_project_panel = olive::panel_focus_manager->MostRecentlyFocused<ProjectPanel>();
|
ProjectPanel* active_project_panel = olive::panel_manager->MostRecentlyFocused<ProjectPanel>();
|
||||||
|
|
||||||
// If we couldn't find one, return nullptr
|
// If we couldn't find one, return nullptr
|
||||||
if (active_project_panel == nullptr) {
|
if (active_project_panel == nullptr) {
|
||||||
|
|||||||
@@ -20,10 +20,11 @@
|
|||||||
|
|
||||||
#include "panelmanager.h"
|
#include "panelmanager.h"
|
||||||
|
|
||||||
PanelManager* olive::panel_focus_manager = nullptr;
|
PanelManager* olive::panel_manager = nullptr;
|
||||||
|
|
||||||
PanelManager::PanelManager(QObject *parent) :
|
PanelManager::PanelManager(QObject *parent) :
|
||||||
QObject(parent)
|
QObject(parent),
|
||||||
|
locked_(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,6 +45,11 @@ PanelWidget *PanelManager::CurrentlyFocused() const
|
|||||||
return focus_history_.first();
|
return focus_history_.first();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PanelManager::ArePanelsLocked()
|
||||||
|
{
|
||||||
|
return locked_;
|
||||||
|
}
|
||||||
|
|
||||||
void PanelManager::FocusChanged(QWidget *old, QWidget *now)
|
void PanelManager::FocusChanged(QWidget *old, QWidget *now)
|
||||||
{
|
{
|
||||||
Q_UNUSED(old)
|
Q_UNUSED(old)
|
||||||
@@ -83,3 +89,12 @@ void PanelManager::FocusChanged(QWidget *old, QWidget *now)
|
|||||||
parent = parent->parent();
|
parent = parent->parent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PanelManager::SetPanelsLocked(bool locked)
|
||||||
|
{
|
||||||
|
foreach (PanelWidget* panel, focus_history_) {
|
||||||
|
panel->SetMovementLocked(locked);
|
||||||
|
}
|
||||||
|
|
||||||
|
locked_ = locked;
|
||||||
|
}
|
||||||
|
|||||||
@@ -72,6 +72,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
T* CreatePanel(QWidget* parent);
|
T* CreatePanel(QWidget* parent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get whether panels are currently prevented from moving
|
||||||
|
*/
|
||||||
|
bool ArePanelsLocked();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
/**
|
/**
|
||||||
* @brief Connect this to a QApplication's SIGNAL(focusChanged())
|
* @brief Connect this to a QApplication's SIGNAL(focusChanged())
|
||||||
@@ -80,11 +85,21 @@ public slots:
|
|||||||
*/
|
*/
|
||||||
void FocusChanged(QWidget* old, QWidget* now);
|
void FocusChanged(QWidget* old, QWidget* now);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets whether panels should be prevented from moving
|
||||||
|
*/
|
||||||
|
void SetPanelsLocked(bool locked);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* @brief History array for traversing through (see MostRecentlyFocused())
|
* @brief History array for traversing through (see MostRecentlyFocused())
|
||||||
*/
|
*/
|
||||||
QList<PanelWidget*> focus_history_;
|
QList<PanelWidget*> focus_history_;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Internal panel movement is locked value
|
||||||
|
*/
|
||||||
|
bool locked_;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
@@ -92,6 +107,8 @@ T *PanelManager::CreatePanel(QWidget *parent)
|
|||||||
{
|
{
|
||||||
T* panel = new T(parent);
|
T* panel = new T(parent);
|
||||||
|
|
||||||
|
panel->SetMovementLocked(locked_);
|
||||||
|
|
||||||
// Add panel to the bottom of the focus history
|
// Add panel to the bottom of the focus history
|
||||||
focus_history_.append(panel);
|
focus_history_.append(panel);
|
||||||
|
|
||||||
@@ -115,7 +132,7 @@ T* PanelManager::MostRecentlyFocused()
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace olive {
|
namespace olive {
|
||||||
extern PanelManager* panel_focus_manager;
|
extern PanelManager* panel_manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // PANELFOCUSMANAGER_H
|
#endif // PANELFOCUSMANAGER_H
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ void NodeParamViewWidgetBridge::CreateWidgets()
|
|||||||
|
|
||||||
// FIXME: Test code
|
// FIXME: Test code
|
||||||
// Pretty hacky way of getting the root folder for this node's sequence
|
// Pretty hacky way of getting the root folder for this node's sequence
|
||||||
ProjectPanel* pp = olive::panel_focus_manager->MostRecentlyFocused<ProjectPanel>();
|
ProjectPanel* pp = olive::panel_manager->MostRecentlyFocused<ProjectPanel>();
|
||||||
footage_combobox->SetRoot(pp->project()->root());
|
footage_combobox->SetRoot(pp->project()->root());
|
||||||
|
|
||||||
// Use multiple values
|
// Use multiple values
|
||||||
|
|||||||
@@ -32,6 +32,23 @@ PanelWidget::PanelWidget(QWidget *parent) :
|
|||||||
setFocusPolicy(Qt::ClickFocus);
|
setFocusPolicy(Qt::ClickFocus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PanelWidget::SetMovementLocked(bool locked)
|
||||||
|
{
|
||||||
|
if (locked) {
|
||||||
|
// Disable moving on QDockWidget
|
||||||
|
setFeatures(features() & ~QDockWidget::DockWidgetMovable);
|
||||||
|
|
||||||
|
// Hide the title bar (only real way to do this is to replace it with an empty QWidget)
|
||||||
|
setTitleBarWidget(new QWidget(this));
|
||||||
|
} else {
|
||||||
|
// Re-enable moving on QDockWidget
|
||||||
|
setFeatures(features() | QDockWidget::DockWidgetMovable);
|
||||||
|
|
||||||
|
// Set the "custom" titlebar to null so the default gets restored
|
||||||
|
setTitleBarWidget(nullptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void PanelWidget::SetBorderVisible(bool enabled)
|
void PanelWidget::SetBorderVisible(bool enabled)
|
||||||
{
|
{
|
||||||
border_visible_ = enabled;
|
border_visible_ = enabled;
|
||||||
|
|||||||
@@ -40,6 +40,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
PanelWidget(QWidget* parent);
|
PanelWidget(QWidget* parent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set whether panel movement is locked or not
|
||||||
|
*/
|
||||||
|
void SetMovementLocked(bool locked);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set visibility of panel's highlighted border, mostly used for showing panel focus
|
* @brief Set visibility of panel's highlighted border, mostly used for showing panel focus
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -191,11 +191,10 @@ MainMenu::MainMenu(QMainWindow *parent) :
|
|||||||
//
|
//
|
||||||
// WINDOW MENU
|
// WINDOW MENU
|
||||||
//
|
//
|
||||||
window_menu_ = new Menu(this);
|
window_menu_ = new Menu(this, this, SLOT(WindowMenuAboutToShow()));
|
||||||
window_menu_->addAction("No window support");
|
window_menu_separator_ = window_menu_->addSeparator();
|
||||||
window_menu_->addSeparator();
|
|
||||||
window_maximize_panel_item_ = window_menu_->AddItem("maximizepanel", nullptr, nullptr, "`");
|
window_maximize_panel_item_ = window_menu_->AddItem("maximizepanel", nullptr, nullptr, "`");
|
||||||
window_lock_layout_item_ = window_menu_->AddItem("lockpanels", nullptr, nullptr);
|
window_lock_layout_item_ = window_menu_->AddItem("lockpanels", olive::panel_manager, SLOT(SetPanelsLocked(bool)));
|
||||||
window_lock_layout_item_->setCheckable(true);
|
window_lock_layout_item_->setCheckable(true);
|
||||||
window_menu_->addSeparator();
|
window_menu_->addSeparator();
|
||||||
window_reset_layout_item_ = window_menu_->AddItem("resetdefaultlayout", nullptr, nullptr);
|
window_reset_layout_item_ = window_menu_->AddItem("resetdefaultlayout", nullptr, nullptr);
|
||||||
@@ -345,49 +344,67 @@ void MainMenu::ToolsMenuAboutToShow()
|
|||||||
tools_snapping_item_->setChecked(olive::core.snapping());
|
tools_snapping_item_->setChecked(olive::core.snapping());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainMenu::WindowMenuAboutToShow()
|
||||||
|
{
|
||||||
|
// QMainWindow generates a perfectly usable menu for this purpose, we just need to copy it to the window menu
|
||||||
|
QMenu* panel_menu = static_cast<QMainWindow*>(parentWidget())->createPopupMenu();
|
||||||
|
QList<QAction*> panel_menu_actions = panel_menu->actions();
|
||||||
|
|
||||||
|
// Make sure when we delete the panel_menu, it doesn't delete the actions
|
||||||
|
foreach (QAction* panel_action, panel_menu_actions) {
|
||||||
|
panel_action->setParent(window_menu_);
|
||||||
|
}
|
||||||
|
|
||||||
|
delete panel_menu;
|
||||||
|
|
||||||
|
window_menu_->insertActions(window_menu_separator_, panel_menu_actions);
|
||||||
|
|
||||||
|
window_lock_layout_item_->setChecked(olive::panel_manager->ArePanelsLocked());
|
||||||
|
}
|
||||||
|
|
||||||
void MainMenu::ZoomInTriggered()
|
void MainMenu::ZoomInTriggered()
|
||||||
{
|
{
|
||||||
olive::panel_focus_manager->CurrentlyFocused()->ZoomIn();
|
olive::panel_manager->CurrentlyFocused()->ZoomIn();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainMenu::ZoomOutTriggered()
|
void MainMenu::ZoomOutTriggered()
|
||||||
{
|
{
|
||||||
olive::panel_focus_manager->CurrentlyFocused()->ZoomOut();
|
olive::panel_manager->CurrentlyFocused()->ZoomOut();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainMenu::GoToStartTriggered()
|
void MainMenu::GoToStartTriggered()
|
||||||
{
|
{
|
||||||
olive::panel_focus_manager->CurrentlyFocused()->GoToStart();
|
olive::panel_manager->CurrentlyFocused()->GoToStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainMenu::PrevFrameTriggered()
|
void MainMenu::PrevFrameTriggered()
|
||||||
{
|
{
|
||||||
olive::panel_focus_manager->CurrentlyFocused()->PrevFrame();
|
olive::panel_manager->CurrentlyFocused()->PrevFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainMenu::PlayPauseTriggered()
|
void MainMenu::PlayPauseTriggered()
|
||||||
{
|
{
|
||||||
olive::panel_focus_manager->CurrentlyFocused()->PlayPause();
|
olive::panel_manager->CurrentlyFocused()->PlayPause();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainMenu::NextFrameTriggered()
|
void MainMenu::NextFrameTriggered()
|
||||||
{
|
{
|
||||||
olive::panel_focus_manager->CurrentlyFocused()->NextFrame();
|
olive::panel_manager->CurrentlyFocused()->NextFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainMenu::GoToEndTriggered()
|
void MainMenu::GoToEndTriggered()
|
||||||
{
|
{
|
||||||
olive::panel_focus_manager->CurrentlyFocused()->GoToEnd();
|
olive::panel_manager->CurrentlyFocused()->GoToEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainMenu::SelectAllTriggered()
|
void MainMenu::SelectAllTriggered()
|
||||||
{
|
{
|
||||||
olive::panel_focus_manager->CurrentlyFocused()->SelectAll();
|
olive::panel_manager->CurrentlyFocused()->SelectAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainMenu::DeselectAllTriggered()
|
void MainMenu::DeselectAllTriggered()
|
||||||
{
|
{
|
||||||
olive::panel_focus_manager->CurrentlyFocused()->DeselectAll();
|
olive::panel_manager->CurrentlyFocused()->DeselectAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainMenu::Retranslate()
|
void MainMenu::Retranslate()
|
||||||
|
|||||||
@@ -66,6 +66,11 @@ private slots:
|
|||||||
*/
|
*/
|
||||||
void ToolsMenuAboutToShow();
|
void ToolsMenuAboutToShow();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Slot triggered just before the Window menu shows
|
||||||
|
*/
|
||||||
|
void WindowMenuAboutToShow();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Slot for zooming in
|
* @brief Slot for zooming in
|
||||||
*
|
*
|
||||||
@@ -163,6 +168,7 @@ private:
|
|||||||
QAction* playback_loop_item_;
|
QAction* playback_loop_item_;
|
||||||
|
|
||||||
Menu* window_menu_;
|
Menu* window_menu_;
|
||||||
|
QAction* window_menu_separator_;
|
||||||
QAction* window_maximize_panel_item_;
|
QAction* window_maximize_panel_item_;
|
||||||
QAction* window_lock_layout_item_;
|
QAction* window_lock_layout_item_;
|
||||||
QAction* window_reset_layout_item_;
|
QAction* window_reset_layout_item_;
|
||||||
|
|||||||
@@ -67,23 +67,23 @@ void olive::MainWindow::SetFullscreen(bool fullscreen)
|
|||||||
void olive::MainWindow::ProjectOpen(Project* p)
|
void olive::MainWindow::ProjectOpen(Project* p)
|
||||||
{
|
{
|
||||||
// FIXME Use settings data to create panels and restore state if they exist
|
// FIXME Use settings data to create panels and restore state if they exist
|
||||||
NodePanel* node_panel = olive::panel_focus_manager->CreatePanel<NodePanel>(this);
|
NodePanel* node_panel = olive::panel_manager->CreatePanel<NodePanel>(this);
|
||||||
addDockWidget(Qt::TopDockWidgetArea, node_panel);
|
addDockWidget(Qt::TopDockWidgetArea, node_panel);
|
||||||
|
|
||||||
ParamPanel* param_panel = olive::panel_focus_manager->CreatePanel<ParamPanel>(this);
|
ParamPanel* param_panel = olive::panel_manager->CreatePanel<ParamPanel>(this);
|
||||||
addDockWidget(Qt::TopDockWidgetArea, param_panel);
|
addDockWidget(Qt::TopDockWidgetArea, param_panel);
|
||||||
|
|
||||||
ViewerPanel* viewer_panel2 = olive::panel_focus_manager->CreatePanel<ViewerPanel>(this);
|
ViewerPanel* viewer_panel2 = olive::panel_manager->CreatePanel<ViewerPanel>(this);
|
||||||
addDockWidget(Qt::TopDockWidgetArea, viewer_panel2);
|
addDockWidget(Qt::TopDockWidgetArea, viewer_panel2);
|
||||||
|
|
||||||
ProjectPanel* project_panel = olive::panel_focus_manager->CreatePanel<ProjectPanel>(this);
|
ProjectPanel* project_panel = olive::panel_manager->CreatePanel<ProjectPanel>(this);
|
||||||
project_panel->set_project(p);
|
project_panel->set_project(p);
|
||||||
addDockWidget(Qt::BottomDockWidgetArea, project_panel);
|
addDockWidget(Qt::BottomDockWidgetArea, project_panel);
|
||||||
|
|
||||||
ToolPanel* tool_panel = olive::panel_focus_manager->CreatePanel<ToolPanel>(this);
|
ToolPanel* tool_panel = olive::panel_manager->CreatePanel<ToolPanel>(this);
|
||||||
addDockWidget(Qt::BottomDockWidgetArea, tool_panel);
|
addDockWidget(Qt::BottomDockWidgetArea, tool_panel);
|
||||||
|
|
||||||
TimelinePanel* timeline_panel = olive::panel_focus_manager->CreatePanel<TimelinePanel>(this);
|
TimelinePanel* timeline_panel = olive::panel_manager->CreatePanel<TimelinePanel>(this);
|
||||||
addDockWidget(Qt::BottomDockWidgetArea, timeline_panel);
|
addDockWidget(Qt::BottomDockWidgetArea, timeline_panel);
|
||||||
|
|
||||||
connect(node_panel, SIGNAL(SelectionChanged(QList<Node*>)), param_panel, SLOT(SetNodes(QList<Node*>)));
|
connect(node_panel, SIGNAL(SelectionChanged(QList<Node*>)), param_panel, SLOT(SetNodes(QList<Node*>)));
|
||||||
@@ -96,7 +96,7 @@ void olive::MainWindow::ProjectOpen(Project* p)
|
|||||||
|
|
||||||
void olive::MainWindow::closeEvent(QCloseEvent *e)
|
void olive::MainWindow::closeEvent(QCloseEvent *e)
|
||||||
{
|
{
|
||||||
olive::panel_focus_manager->DeleteAllPanels();
|
olive::panel_manager->DeleteAllPanels();
|
||||||
|
|
||||||
// FIXME: Test code - We have no cache management and the cache is very much testing only, so we delete it on close
|
// FIXME: Test code - We have no cache management and the cache is very much testing only, so we delete it on close
|
||||||
// as to not clog up HDD space
|
// as to not clog up HDD space
|
||||||
|
|||||||
Reference in New Issue
Block a user