various: implemented multiple project support
This required various changes to various parts of the infrastructure (mostly using paths to finding the "root project" of any given object throughout). Now theoretically infinite projects can be opened and accounted for at any given time.
This commit is contained in:
@@ -20,6 +20,8 @@
|
||||
|
||||
#include "panel.h"
|
||||
|
||||
#include <QCloseEvent>
|
||||
#include <QDebug>
|
||||
#include <QPainter>
|
||||
#include <QStyle>
|
||||
#include <QStyleOption>
|
||||
@@ -29,9 +31,12 @@ OLIVE_NAMESPACE_ENTER
|
||||
|
||||
PanelWidget::PanelWidget(QWidget *parent) :
|
||||
QDockWidget(parent),
|
||||
border_visible_(false)
|
||||
border_visible_(false),
|
||||
signal_instead_of_close_(false)
|
||||
{
|
||||
setFocusPolicy(Qt::ClickFocus);
|
||||
|
||||
connect(this, &PanelWidget::visibilityChanged, this, &PanelWidget::PanelVisibilityChanged);
|
||||
}
|
||||
|
||||
void PanelWidget::SetMovementLocked(bool locked)
|
||||
@@ -104,6 +109,28 @@ void PanelWidget::UpdateTitle()
|
||||
}
|
||||
}
|
||||
|
||||
void PanelWidget::PanelVisibilityChanged(bool e)
|
||||
{
|
||||
if (e) {
|
||||
setFocus();
|
||||
}
|
||||
}
|
||||
|
||||
void PanelWidget::SetSignalInsteadOfClose(bool e)
|
||||
{
|
||||
signal_instead_of_close_ = e;
|
||||
}
|
||||
|
||||
void PanelWidget::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
if (signal_instead_of_close_) {
|
||||
event->ignore();
|
||||
emit CloseRequested();
|
||||
} else {
|
||||
QDockWidget::closeEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void PanelWidget::changeEvent(QEvent *e)
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
|
||||
@@ -56,6 +56,13 @@ public:
|
||||
*/
|
||||
void SetBorderVisible(bool enabled);
|
||||
|
||||
/**
|
||||
* @brief If enabled, sends signal CloseRequested() when the user closes instead of closing
|
||||
*
|
||||
* Defaults to FALSE. Use this to override default panel closing functionality.
|
||||
*/
|
||||
void SetSignalInsteadOfClose(bool e);
|
||||
|
||||
/**
|
||||
* @brief Called whenever this panel is focused and user uses "Zoom In" (either in menus or as a keyboard shortcut)
|
||||
*
|
||||
@@ -156,6 +163,9 @@ public:
|
||||
|
||||
virtual void ToggleSelectedEnabled(){}
|
||||
|
||||
signals:
|
||||
void CloseRequested();
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @brief paintEvent
|
||||
@@ -165,6 +175,8 @@ protected:
|
||||
|
||||
virtual void changeEvent(QEvent* e) override;
|
||||
|
||||
virtual void closeEvent(QCloseEvent* event) override;
|
||||
|
||||
virtual void Retranslate();
|
||||
|
||||
protected slots:
|
||||
@@ -204,20 +216,17 @@ private:
|
||||
*/
|
||||
void UpdateTitle();
|
||||
|
||||
/**
|
||||
* @brief Internal title string
|
||||
*/
|
||||
QString title_;
|
||||
|
||||
/**
|
||||
* @brief Internal subtitle string
|
||||
*/
|
||||
QString subtitle_;
|
||||
|
||||
/**
|
||||
* @brief Internal border visibility value
|
||||
*/
|
||||
bool border_visible_;
|
||||
|
||||
bool signal_instead_of_close_;
|
||||
|
||||
private slots:
|
||||
void PanelVisibilityChanged(bool e);
|
||||
|
||||
};
|
||||
|
||||
OLIVE_NAMESPACE_EXIT
|
||||
|
||||
Reference in New Issue
Block a user