Automated with clang-tidy readability-identifier-naming (config added to .clang-tidy) plus scripted passes, per the updated rules now documented in CONTRIBUTING.md: - types (class/struct/enum/alias/template params): PascalCase - functions, variables, members: snake_case (incl. rational -> Rational) - private/protected members: trailing underscore; static member variables likewise (instance_, available_themes_) - constants and enum values: snake_case (kLinear -> k_linear, F32P -> f32p); ALL_CAPS reserved for macros - macros: OAK_ prefix (OLIVE_ADD_TEST/OLIVE_ASSERT/OLIVE_CONFIG -> OAK_ADD_TEST/OAK_ASSERT/OAK_CONFIG, GL_PREAMBLE -> OAK_GL_PREAMBLE, include guards -> OAK_*) - file names: all lowercase (Current/Plugin/OliveHost/OliveClip/ OlivePluginInstance -> current/plugin/olivehost/oliveclip/ oliveplugininstance) - getters share the member name sans underscore, setters set_foo() - Qt and third-party (OpenFX) virtual overrides and framework callbacks keep their original names (exempt in .clang-tidy) Manual follow-ups required where automation could not reach: - string-based QMetaObject/SIGNAL/SLOT references updated to renamed methods (AddTask, CreatedFile, DeleteSpecificFile, moveSelectionUp, ...) - macro bodies referencing renamed methods (OLIVE_CONFIG, NODE_DEFAULT_DESTRUCTOR, MANAGEDDISPLAYWIDGET_*) - self-shadowing locals renamed where signals/methods became same-named (size_changed, worker_count, selected_items, import param, filters) - third_party OFX member/namespace usages restored (OFX::Host::*, _created, _clipPrefsDirty, createInstance, clearPersistentMessage) - STL protocol aliases restored (const_iterator) with .clang-tidy ignore rules; qHash overloads restored Full build and test suite pass: ctest 4/4, ~1960 gtest cases green.
359 lines
6.0 KiB
C++
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 "common/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
|