Squashed commit of the following:

commit 60c0f65c5e3c2faf1f7b0ae10b4131dabbcf715b
Author: itsmattkc <34096995+itsmattkc@users.noreply.github.com>
Date:   Wed Feb 15 22:34:16 2023 -0800

    mainwindow: don't close last timeline panel when removing sequence

commit bc892810d67c1dd4f9c0639767c563681f29701d
Merge: 69051a120 aef08f8cd
Author: itsmattkc <34096995+itsmattkc@users.noreply.github.com>
Date:   Tue Feb 14 17:05:25 2023 -0800

    Merge branch 'master' into kddockwidgets

commit 69051a120b8423d0ad7b38def2f7555d323cd74d
Author: itsmattkc <34096995+itsmattkc@users.noreply.github.com>
Date:   Tue Feb 14 15:29:24 2023 -0800

    finished kddockwidgets integration

commit 9a39dbeade871a0b9454b424c7f7a7482671d40b
Author: itsmattkc <34096995+itsmattkc@users.noreply.github.com>
Date:   Tue Feb 14 11:54:25 2023 -0800

    switch to kddockwidgets
This commit is contained in:
itsmattkc
2023-02-16 00:44:08 -08:00
parent 9a87b197b3
commit 25b6b07a06
49 changed files with 252 additions and 331 deletions
+28 -57
View File
@@ -28,7 +28,6 @@ PanelManager* PanelManager::instance_ = nullptr;
PanelManager::PanelManager(QObject *parent) :
QObject(parent),
locked_(false),
suppress_changed_signal_(false)
{
}
@@ -89,11 +88,6 @@ PanelWidget *PanelManager::GetPanelWithName(const QString &name) const
return nullptr;
}
bool PanelManager::ArePanelsLocked()
{
return locked_;
}
void PanelManager::CreateInstance()
{
instance_ = new PanelManager();
@@ -114,23 +108,10 @@ void PanelManager::RegisterPanel(PanelWidget *panel)
// Add panel to the bottom of the focus history
focus_history_.append(panel);
panel->SetMovementLocked(locked_);
// Get panel parent (it's assumed it has one)
QWidget *parent = panel->parentWidget();
// Sane default for panel size
panel->resize(parent->size() / 3);
// We're about to center the panel relative to the parent (usually the main window), but for some
// reason this requires the panel to be shown first.
panel->show();
// Center the panel relative to the parent
QPoint parent_center = panel->mapFromGlobal(parent->mapToGlobal(parent->rect().center()));
QPoint panel_center = panel->rect().center();
panel->move(parent_center - panel_center);
if (focus_history_.size() == 1) {
// This is the first panel, focus it
panel->SetBorderVisible(true);
@@ -151,54 +132,44 @@ void PanelManager::FocusChanged(QWidget *old, QWidget *now)
PanelWidget* panel_cast_test;
// Loop through widget's parent hierarchy
while (parent != nullptr) {
if (!focus_history_.empty()) {
while (parent != nullptr) {
// Use dynamic_cast to test if this object is a PanelWidget
panel_cast_test = dynamic_cast<PanelWidget*>(parent);
// Use dynamic_cast to test if this object is a PanelWidget
panel_cast_test = dynamic_cast<PanelWidget*>(parent);
if (panel_cast_test) {
if (panel_cast_test) {
if (focus_history_.first() != panel_cast_test) {
// If so, bump this to the top of the focus history
int panel_index = focus_history_.indexOf(panel_cast_test);
if (focus_history_.first() != panel_cast_test) {
// If so, bump this to the top of the focus history
int panel_index = focus_history_.indexOf(panel_cast_test);
// Disable highlight border on old panel
if (!focus_history_.isEmpty()) {
focus_history_.first()->SetBorderVisible(false);
// Disable highlight border on old panel
if (!focus_history_.isEmpty()) {
focus_history_.first()->SetBorderVisible(false);
}
// Enable new border's highlight
panel_cast_test->SetBorderVisible(true);
// If it's not in the focus history, prepend it, otherwise move it
if (panel_index == -1) {
focus_history_.prepend(panel_cast_test);
} else {
focus_history_.move(panel_index, 0);
}
if (!suppress_changed_signal_) {
emit FocusedPanelChanged(panel_cast_test);
}
}
// Enable new border's highlight
panel_cast_test->SetBorderVisible(true);
// If it's not in the focus history, prepend it, otherwise move it
if (panel_index == -1) {
focus_history_.prepend(panel_cast_test);
} else {
focus_history_.move(panel_index, 0);
}
if (!suppress_changed_signal_) {
emit FocusedPanelChanged(panel_cast_test);
}
break;
}
break;
}
parent = parent->parent();
}
}
void PanelManager::SetPanelsLocked(bool locked)
{
foreach (PanelWidget* panel, focus_history_) {
// Only affect panels actually in our layout
if (!panel->isFloating()) {
panel->SetMovementLocked(locked);
parent = parent->parent();
}
}
locked_ = locked;
}
}