Files
oak-editor/app/panel/panel.h
T
Mike-Solar c0dcd33de0 R8 phase 1: extract app/engine shared utilities into shared/include/oakutil
Move the pure-header utilities shared by app/ and engine/ out of
engine/common/ into a new shared/include/oakutil/ layer (define, lerp,
decibel, digit, range, crashpadutils, autoscroll, qtutils, filefunctions
declarations, and a trimmed xmlutils exposing a CancelAtom-free void*
overload). engine/common/ keeps forwarding headers so internal include
paths are unchanged; app/ now includes oakutil/* directly.

engine/node/project.h gains an explicit NodeGroup forward declaration
previously obtained transitively through the old xmlutils.h.
2026-07-27 17:14:56 +08:00

359 lines
6.0 KiB
C++

/***
Olive - Non-Linear Video Editor
Copyright (C) 2022 Olive Team
Modifications Copyright (C) 2025 mikesolar
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef OAK_PANEL_WIDGET_H
#define OAK_PANEL_WIDGET_H
#include "KDDockWidgets/src/core/Window_p.h"
#include "KDDockWidgets/src/qtwidgets/views/TabBar.h"
#include <kddockwidgets/DockWidget.h>
#include <QEvent>
#include "oakutil/define.h"
#include <QTabWidget>
namespace olive
{
/**
* @brief A widget that is always dockable within the MainWindow.
*/
class PanelWidget : public KDDockWidgets::QtWidgets::DockWidget {
Q_OBJECT
public:
/**
* @brief PanelWidget Constructor
*
* @param parent
*
* The PanelWidget's parent, enforced to help with memory handling. Most of the time this will be an instance of
* MainWindow.
*/
PanelWidget(const QString &object_name);
virtual ~PanelWidget() override;
/**
* @brief Set visibility of panel's highlighted border, mostly used for showing panel focus
*
* @param enabled
*/
void set_border_visible(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 set_signal_instead_of_close(bool e);
using Info = std::map<QString, QString>;
virtual void load_data(const Info &info)
{
}
virtual Info save_data() const
{
return Info();
}
/**
* @brief Called whenever this panel is focused and user uses "Zoom In" (either in menus or as a keyboard shortcut)
*
* This function is up to the Panel's interpretation of what the user intends to zoom into. Default behavior is a
* no-op.
*/
virtual void zoom_in()
{
}
/**
* @brief Called whenever this panel is focused and user uses "Zoom Out" (either in menus or as a keyboard shortcut)
*
* This function is up to the Panel's interpretation of what the user intends to zoom out of. Default behavior is a
* no-op.
*/
virtual void zoom_out()
{
}
virtual void go_to_start()
{
}
virtual void prev_frame()
{
}
/**
* @brief Called whenever this panel is focused and user uses "Play/Pause" (either in menus or as a keyboard shortcut)
*
* This function is up to the Panel's interpretation of what the user intends to zoom out of. Default behavior is a
* no-op.
*/
virtual void play_pause()
{
}
virtual void play_in_to_out()
{
}
virtual void next_frame()
{
}
virtual void go_to_end()
{
}
virtual void select_all()
{
}
virtual void deselect_all()
{
}
virtual void ripple_to_in()
{
}
virtual void ripple_to_out()
{
}
virtual void edit_to_in()
{
}
virtual void edit_to_out()
{
}
virtual void shuttle_left()
{
}
virtual void shuttle_stop()
{
}
virtual void shuttle_right()
{
}
virtual void go_to_prev_cut()
{
}
virtual void go_to_next_cut()
{
}
virtual void rename_selected()
{
}
virtual void delete_selected()
{
}
virtual void ripple_delete()
{
}
virtual void increase_track_height()
{
}
virtual void decrease_track_height()
{
}
virtual void set_in()
{
}
virtual void set_out()
{
}
virtual void reset_in()
{
}
virtual void reset_out()
{
}
virtual void clear_in_out()
{
}
virtual void set_marker()
{
}
virtual void toggle_links()
{
}
virtual void cut_selected()
{
}
virtual void copy_selected()
{
}
virtual void paste()
{
}
virtual void paste_insert()
{
}
virtual void toggle_show_all()
{
}
virtual void go_to_in()
{
}
virtual void go_to_out()
{
}
virtual void delete_in_to_out()
{
}
virtual void ripple_delete_in_to_out()
{
}
virtual void toggle_selected_enabled()
{
}
virtual void duplicate()
{
}
virtual void set_color_label(int)
{
}
virtual void nudge_left()
{
}
virtual void nudge_right()
{
}
virtual void move_in_to_playhead()
{
}
virtual void move_out_to_playhead()
{
}
signals:
void close_requested();
void shown(Qt::FocusReason reason);
void hidden();
protected:
/**
* @brief paintEvent
* @param event
*/
void paintEvent(QPaintEvent *event) override;
virtual void changeEvent(QEvent *e) override;
virtual void closeEvent(QCloseEvent *event) override;
virtual void retranslate();
void set_widget_with_padding(QWidget *widget);
protected slots:
/**
* @brief Set panel's title
*
* Use this function to set the title of the panel.
*
* A PanelWidget has the default format of "Title: Subtitle" (can differ depending on translation). If no Subtitle
* is set, the title will just be formatted "Title".
*
* @param t
*
* String to set the title to
*/
void set_title(const QString &t);
/**
* @brief Set panel's subtitle
*
* Use this function to set the subtitle of the panel.
*
* A PanelWidget has the default format of "Title: Subtitle" (can differ depending on translation). If no Subtitle
* is set, the title will just be formatted "Title".
*
* @param t
*
* String to set the subtitle to
*/
void set_subtitle(const QString &t);
protected slots:
private:
/**
* @brief Internal function that sets the QDockWidget's window title whenever the title/subtitle change.
*
* Should be called any time a change is made to title_ or subtitle_
*/
void update_title();
QString title_;
QString subtitle_;
bool border_visible_;
bool signal_instead_of_close_;
QMetaObject::Connection m_tabBarConnection_;
QMetaObject::Connection m_windowConnection_;
bool m_lastVisibleState_ = false;
};
}
#endif // OAK_PANEL_WIDGET_H