Merge branch 'master' into gizmos

This commit is contained in:
itsmattkc
2020-05-02 17:06:49 +10:00
130 changed files with 2310 additions and 981 deletions
+29 -20
View File
@@ -83,7 +83,7 @@ MainMenu::MainMenu(MainWindow *parent) :
edit_menu_->addAction(edit_redo_item_);
edit_menu_->addSeparator();
MenuShared::instance()->AddItemsForEditMenu(edit_menu_);
MenuShared::instance()->AddItemsForEditMenu(edit_menu_, true);
edit_menu_->addSeparator();
edit_select_all_item_ = edit_menu_->AddItem("selectall", this, &MainMenu::SelectAllTriggered, "Ctrl+A");
edit_deselect_all_item_ = edit_menu_->AddItem("deselectall", this, &MainMenu::DeselectAllTriggered, "Ctrl+Shift+A");
@@ -186,7 +186,6 @@ MainMenu::MainMenu(MainWindow *parent) :
// WINDOW MENU
//
window_menu_ = new Menu(this, this, &MainMenu::WindowMenuAboutToShow);
connect(window_menu_, &Menu::aboutToHide, this, &MainMenu::WindowMenuAboutToHide);
window_menu_separator_ = window_menu_->addSeparator();
window_maximize_panel_item_ = window_menu_->AddItem("maximizepanel", parent, &MainWindow::ToggleMaximizedPanel, "`");
window_lock_layout_item_ = window_menu_->AddItem("lockpanels", PanelManager::instance(), &PanelManager::SetPanelsLocked);
@@ -365,27 +364,37 @@ void MainMenu::PlaybackMenuAboutToShow()
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(PanelManager::instance()->ArePanelsLocked());
}
void MainMenu::WindowMenuAboutToHide()
{
// Remove any previous items
while (window_menu_->actions().first() != window_menu_separator_) {
window_menu_->removeAction(window_menu_->actions().first());
}
QList<QAction*> panel_actions;
// Alphabetize actions - keeps actions in a consistent order since PanelManager::panels() is
// ordered from most recently focused to least, which may be confusing user experience.
foreach (PanelWidget* panel, PanelManager::instance()->panels()) {
QAction* panel_action = panel->toggleViewAction();
bool inserted = false;
for (int i=0;i<panel_actions.size();i++) {
if (panel_actions.at(i)->text() > panel_action->text()) {
panel_actions.insert(i, panel_action);
inserted = true;
break;
}
}
if (!inserted) {
panel_actions.append(panel_action);
}
}
// Add new items
window_menu_->insertActions(window_menu_separator_, panel_actions);
window_lock_layout_item_->setChecked(PanelManager::instance()->ArePanelsLocked());
}
void MainMenu::PopulateOpenRecent()
-5
View File
@@ -94,11 +94,6 @@ private slots:
*/
void WindowMenuAboutToShow();
/**
* @brief Slot triggered just before the Window menu hides
*/
void WindowMenuAboutToHide();
/**
* @brief Adds items to open recent menu
*/
+7
View File
@@ -76,4 +76,11 @@ void MainStatusBar::UpdateStatus()
}
}
void MainStatusBar::mouseDoubleClickEvent(QMouseEvent* e)
{
QStatusBar::mouseDoubleClickEvent(e);
emit DoubleClicked();
}
OLIVE_NAMESPACE_EXIT
+7
View File
@@ -33,11 +33,18 @@ OLIVE_NAMESPACE_ENTER
*/
class MainStatusBar : public QStatusBar
{
Q_OBJECT
public:
MainStatusBar(QWidget* parent = nullptr);
void ConnectTaskManager(TaskManager* manager);
signals:
void DoubleClicked();
protected:
virtual void mouseDoubleClickEvent(QMouseEvent* e) override;
private slots:
void UpdateStatus();
+15 -5
View File
@@ -33,18 +33,21 @@ OLIVE_NAMESPACE_ENTER
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent)
{
#ifdef Q_OS_WINDOWS
// Qt on Windows has a bug that "de-maximizes" the window when widgets are added, resizing the window beforehand
// works around that issue and we just set it to whatever size is available
// Resizes main window to desktop geometry on startup. Fixes the following issues:
// * Qt on Windows has a bug that "de-maximizes" the window when widgets are added, resizing the
// window beforehand works around that issue and we just set it to whatever size is available.
// * On Linux, it seems the window starts off at a vastly different size and then maximizes
// which throws off the proportions and makes the resulting layout wonky.
resize(qApp->desktop()->availableGeometry(this).size());
#ifdef Q_OS_WINDOWS
// Set up taskbar button progress bar (used for some modal tasks like exporting)
taskbar_btn_id_ = RegisterWindowMessage("TaskbarButtonCreated");
taskbar_interface_ = nullptr;
#endif
// Create empty central widget - we don't actually want a central widget but some of Qt's docking/undocking fails
// without it
// Create empty central widget - we don't actually want a central widget (so we set its maximum
// size to 0,0) but some of Qt's docking/undocking fails without it
QWidget* centralWidget = new QWidget(this);
centralWidget->setMaximumSize(QSize(0, 0));
setCentralWidget(centralWidget);
@@ -62,6 +65,7 @@ MainWindow::MainWindow(QWidget *parent) :
// Create and set status bar
MainStatusBar* status_bar = new MainStatusBar(this);
status_bar->ConnectTaskManager(TaskManager::instance());
connect(status_bar, &MainStatusBar::DoubleClicked, this, &MainWindow::StatusBarDoubleClicked);
setStatusBar(status_bar);
// Create standard panels
@@ -390,6 +394,12 @@ bool MainWindow::nativeEvent(const QByteArray &eventType, void *message, long *r
}
#endif
void MainWindow::StatusBarDoubleClicked()
{
task_man_panel_->show();
task_man_panel_->raise();
}
void MainWindow::UpdateTitle()
{
if (Core::instance()->GetActiveProject()) {
+2
View File
@@ -150,6 +150,8 @@ private slots:
void LoadLayoutInternal(QXmlStreamReader* reader, XMLNodeData *xml_data);
void StatusBarDoubleClicked();
};
OLIVE_NAMESPACE_EXIT