style: unify identifier naming per updated conventions
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.
This commit is contained in:
+22
-22
@@ -24,7 +24,7 @@
|
||||
namespace olive
|
||||
{
|
||||
|
||||
QVector<Color> ColorCoding::colors_ = {
|
||||
QVector<Color> ColorCoding::colors = {
|
||||
Color(0.545f, 0.255f, 0.255f), Color(0.412f, 0.188f, 0.259f),
|
||||
Color(0.561f, 0.427f, 0.239f), Color(0.486f, 0.306f, 0.235f),
|
||||
Color(0.631f, 0.612f, 0.212f), Color(0.404f, 0.478f, 0.243f),
|
||||
@@ -35,55 +35,55 @@ QVector<Color> ColorCoding::colors_ = {
|
||||
Color(0.800f, 0.800f, 0.800f), Color(0.502f, 0.502f, 0.502f)
|
||||
};
|
||||
|
||||
QString ColorCoding::GetColorName(int c)
|
||||
QString ColorCoding::get_color_name(int c)
|
||||
{
|
||||
// FIXME: I'm sure we could come up with more creative names for these colors
|
||||
switch (c) {
|
||||
case kRed:
|
||||
case k_red:
|
||||
return tr("Red");
|
||||
case kMaroon:
|
||||
case k_maroon:
|
||||
return tr("Maroon");
|
||||
case kOrange:
|
||||
case k_orange:
|
||||
return tr("Orange");
|
||||
case kBrown:
|
||||
case k_brown:
|
||||
return tr("Brown");
|
||||
case kYellow:
|
||||
case k_yellow:
|
||||
return tr("Yellow");
|
||||
case kOlive:
|
||||
case k_olive:
|
||||
return tr("Oak");
|
||||
case kLime:
|
||||
case k_lime:
|
||||
return tr("Lime");
|
||||
case kGreen:
|
||||
case k_green:
|
||||
return tr("Green");
|
||||
case kCyan:
|
||||
case k_cyan:
|
||||
return tr("Cyan");
|
||||
case kTeal:
|
||||
case k_teal:
|
||||
return tr("Teal");
|
||||
case kBlue:
|
||||
case k_blue:
|
||||
return tr("Blue");
|
||||
case kNavy:
|
||||
case k_navy:
|
||||
return tr("Navy");
|
||||
case kPink:
|
||||
case k_pink:
|
||||
return tr("Pink");
|
||||
case kPurple:
|
||||
case k_purple:
|
||||
return tr("Purple");
|
||||
case kSilver:
|
||||
case k_silver:
|
||||
return tr("Silver");
|
||||
case kGray:
|
||||
case k_gray:
|
||||
return tr("Gray");
|
||||
}
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
Color ColorCoding::GetColor(int c)
|
||||
Color ColorCoding::get_color(int c)
|
||||
{
|
||||
return colors_.at(c);
|
||||
return colors.at(c);
|
||||
}
|
||||
|
||||
Qt::GlobalColor ColorCoding::GetUISelectorColor(const Color &c)
|
||||
Qt::GlobalColor ColorCoding::get_ui_selector_color(const Color &c)
|
||||
{
|
||||
if (c.GetRoughLuminance() > 0.40f) {
|
||||
if (c.get_rough_luminance() > 0.40f) {
|
||||
return Qt::black;
|
||||
} else {
|
||||
return Qt::white;
|
||||
|
||||
+24
-24
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef COLORCODING_H
|
||||
#define COLORCODING_H
|
||||
#ifndef OAK_COLORCODING_H
|
||||
#define OAK_COLORCODING_H
|
||||
|
||||
#include <olive/core/core.h>
|
||||
#include <QObject>
|
||||
@@ -34,39 +34,39 @@ class ColorCoding : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Code {
|
||||
kRed,
|
||||
kMaroon,
|
||||
kOrange,
|
||||
kBrown,
|
||||
kYellow,
|
||||
kOlive,
|
||||
kLime,
|
||||
kGreen,
|
||||
kCyan,
|
||||
kTeal,
|
||||
kBlue,
|
||||
kNavy,
|
||||
kPink,
|
||||
kPurple,
|
||||
kSilver,
|
||||
kGray
|
||||
k_red,
|
||||
k_maroon,
|
||||
k_orange,
|
||||
k_brown,
|
||||
k_yellow,
|
||||
k_olive,
|
||||
k_lime,
|
||||
k_green,
|
||||
k_cyan,
|
||||
k_teal,
|
||||
k_blue,
|
||||
k_navy,
|
||||
k_pink,
|
||||
k_purple,
|
||||
k_silver,
|
||||
k_gray
|
||||
};
|
||||
|
||||
static QString GetColorName(int c);
|
||||
static QString get_color_name(int c);
|
||||
|
||||
static Color GetColor(int c);
|
||||
static Color get_color(int c);
|
||||
|
||||
static Qt::GlobalColor GetUISelectorColor(const Color &c);
|
||||
static Qt::GlobalColor get_ui_selector_color(const Color &c);
|
||||
|
||||
static const QVector<Color> &standard_colors()
|
||||
{
|
||||
return colors_;
|
||||
return colors;
|
||||
}
|
||||
|
||||
private:
|
||||
static QVector<Color> colors_;
|
||||
static QVector<Color> colors;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // COLORCODING_H
|
||||
#endif // OAK_COLORCODING_H
|
||||
|
||||
+22
-22
@@ -23,23 +23,23 @@
|
||||
namespace olive
|
||||
{
|
||||
|
||||
QString HumanStrings::SampleRateToString(const int &sample_rate)
|
||||
QString HumanStrings::sample_rate_to_string(const int &sample_rate)
|
||||
{
|
||||
return QCoreApplication::translate("AudioParams", "%1 Hz").arg(sample_rate);
|
||||
}
|
||||
|
||||
QString HumanStrings::ChannelLayoutToString(const uint64_t &layout)
|
||||
QString HumanStrings::channel_layout_to_string(const uint64_t &layout)
|
||||
{
|
||||
switch (layout) {
|
||||
case kChannelLayoutMono:
|
||||
case k_channel_layout_mono:
|
||||
return QCoreApplication::translate("AudioParams", "Mono");
|
||||
case kChannelLayoutStereo:
|
||||
case k_channel_layout_stereo:
|
||||
return QCoreApplication::translate("AudioParams", "Stereo");
|
||||
case kChannelLayout2_1:
|
||||
case k_channel_layout2_1:
|
||||
return QCoreApplication::translate("AudioParams", "2.1");
|
||||
case kChannelLayout5Point1:
|
||||
case k_channel_layout5_point1:
|
||||
return QCoreApplication::translate("AudioParams", "5.1");
|
||||
case kChannelLayout7Point1:
|
||||
case k_channel_layout7_point1:
|
||||
return QCoreApplication::translate("AudioParams", "7.1");
|
||||
default:
|
||||
return QCoreApplication::translate("AudioParams", "Unknown (0x%1)")
|
||||
@@ -47,48 +47,48 @@ QString HumanStrings::ChannelLayoutToString(const uint64_t &layout)
|
||||
}
|
||||
}
|
||||
|
||||
QString HumanStrings::FormatToString(const SampleFormat &f)
|
||||
QString HumanStrings::format_to_string(const SampleFormat &f)
|
||||
{
|
||||
switch (f) {
|
||||
case SampleFormat::U8:
|
||||
case SampleFormat::u8:
|
||||
return QCoreApplication::translate("AudioParams",
|
||||
"Unsigned 8-bit (Packed)");
|
||||
case SampleFormat::S16:
|
||||
case SampleFormat::s16:
|
||||
return QCoreApplication::translate("AudioParams",
|
||||
"Signed 16-bit (Packed)");
|
||||
case SampleFormat::S32:
|
||||
case SampleFormat::s32:
|
||||
return QCoreApplication::translate("AudioParams",
|
||||
"Signed 32-bit (Packed)");
|
||||
case SampleFormat::S64:
|
||||
case SampleFormat::s64:
|
||||
return QCoreApplication::translate("AudioParams",
|
||||
"Signed 64-bit (Packed)");
|
||||
case SampleFormat::F32:
|
||||
case SampleFormat::f32:
|
||||
return QCoreApplication::translate("AudioParams",
|
||||
"Float 32-bit (Packed)");
|
||||
case SampleFormat::F64:
|
||||
case SampleFormat::f64:
|
||||
return QCoreApplication::translate("AudioParams",
|
||||
"Float 64-bit (Packed)");
|
||||
case SampleFormat::U8P:
|
||||
case SampleFormat::u8_p:
|
||||
return QCoreApplication::translate("AudioParams",
|
||||
"Unsigned 8-bit (Planar)");
|
||||
case SampleFormat::S16P:
|
||||
case SampleFormat::s16_p:
|
||||
return QCoreApplication::translate("AudioParams",
|
||||
"Signed 16-bit (Planar)");
|
||||
case SampleFormat::S32P:
|
||||
case SampleFormat::s32_p:
|
||||
return QCoreApplication::translate("AudioParams",
|
||||
"Signed 32-bit (Planar)");
|
||||
case SampleFormat::S64P:
|
||||
case SampleFormat::s64_p:
|
||||
return QCoreApplication::translate("AudioParams",
|
||||
"Signed 64-bit (Planar)");
|
||||
case SampleFormat::F32P:
|
||||
case SampleFormat::f32_p:
|
||||
return QCoreApplication::translate("AudioParams",
|
||||
"Float 32-bit (Planar)");
|
||||
case SampleFormat::F64P:
|
||||
case SampleFormat::f64_p:
|
||||
return QCoreApplication::translate("AudioParams",
|
||||
"Float 64-bit (Planar)");
|
||||
|
||||
case SampleFormat::INVALID:
|
||||
case SampleFormat::COUNT:
|
||||
case SampleFormat::invalid:
|
||||
case SampleFormat::count:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef HUMANSTRINGS_H
|
||||
#define HUMANSTRINGS_H
|
||||
#ifndef OAK_HUMANSTRINGS_H
|
||||
#define OAK_HUMANSTRINGS_H
|
||||
|
||||
#include <olive/core/core.h>
|
||||
#include <QObject>
|
||||
@@ -32,13 +32,13 @@ class HumanStrings : public QObject {
|
||||
public:
|
||||
HumanStrings() = default;
|
||||
|
||||
static QString SampleRateToString(const int &sample_rate);
|
||||
static QString sample_rate_to_string(const int &sample_rate);
|
||||
|
||||
static QString ChannelLayoutToString(const uint64_t &layout);
|
||||
static QString channel_layout_to_string(const uint64_t &layout);
|
||||
|
||||
static QString FormatToString(const SampleFormat &f);
|
||||
static QString format_to_string(const SampleFormat &f);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // HUMANSTRINGS_H
|
||||
#endif // OAK_HUMANSTRINGS_H
|
||||
|
||||
+138
-138
@@ -25,165 +25,165 @@ namespace olive
|
||||
{
|
||||
|
||||
/// Works in conjunction with `genicons.sh` to generate and utilize icons of specific sizes
|
||||
const int ICON_SIZE_COUNT = 4;
|
||||
const int ICON_SIZES[] = { 16, 32, 64, 128 };
|
||||
const int icon_size_count = 4;
|
||||
const int icon_sizes[] = { 16, 32, 64, 128 };
|
||||
|
||||
/// Internal icon library for use throughout Olive without having to regenerate constantly
|
||||
QIcon icon::GoToStart;
|
||||
QIcon icon::PrevFrame;
|
||||
QIcon icon::Play;
|
||||
QIcon icon::Pause;
|
||||
QIcon icon::NextFrame;
|
||||
QIcon icon::GoToEnd;
|
||||
QIcon icon::go_to_start;
|
||||
QIcon icon::prev_frame;
|
||||
QIcon icon::play;
|
||||
QIcon icon::pause;
|
||||
QIcon icon::next_frame;
|
||||
QIcon icon::go_to_end;
|
||||
QIcon icon::New;
|
||||
QIcon icon::Open;
|
||||
QIcon icon::Save;
|
||||
QIcon icon::Undo;
|
||||
QIcon icon::Redo;
|
||||
QIcon icon::TreeView;
|
||||
QIcon icon::ListView;
|
||||
QIcon icon::IconView;
|
||||
QIcon icon::ToolPointer;
|
||||
QIcon icon::ToolEdit;
|
||||
QIcon icon::ToolRipple;
|
||||
QIcon icon::ToolRolling;
|
||||
QIcon icon::ToolRazor;
|
||||
QIcon icon::ToolSlip;
|
||||
QIcon icon::ToolSlide;
|
||||
QIcon icon::ToolHand;
|
||||
QIcon icon::ToolTransition;
|
||||
QIcon icon::ToolTrackSelect;
|
||||
QIcon icon::Folder;
|
||||
QIcon icon::Sequence;
|
||||
QIcon icon::Video;
|
||||
QIcon icon::Audio;
|
||||
QIcon icon::Image;
|
||||
QIcon icon::MiniMap;
|
||||
QIcon icon::TriUp;
|
||||
QIcon icon::TriLeft;
|
||||
QIcon icon::TriDown;
|
||||
QIcon icon::TriRight;
|
||||
QIcon icon::TextBold;
|
||||
QIcon icon::TextItalic;
|
||||
QIcon icon::TextUnderline;
|
||||
QIcon icon::TextStrikethrough;
|
||||
QIcon icon::TextSmallCaps;
|
||||
QIcon icon::TextAlignLeft;
|
||||
QIcon icon::TextAlignRight;
|
||||
QIcon icon::TextAlignCenter;
|
||||
QIcon icon::TextAlignJustify;
|
||||
QIcon icon::TextAlignTop;
|
||||
QIcon icon::TextAlignBottom;
|
||||
QIcon icon::TextAlignMiddle;
|
||||
QIcon icon::Snapping;
|
||||
QIcon icon::ZoomIn;
|
||||
QIcon icon::ZoomOut;
|
||||
QIcon icon::Record;
|
||||
QIcon icon::Add;
|
||||
QIcon icon::Error;
|
||||
QIcon icon::DirUp;
|
||||
QIcon icon::Clock;
|
||||
QIcon icon::Diamond;
|
||||
QIcon icon::Plus;
|
||||
QIcon icon::Minus;
|
||||
QIcon icon::AddEffect;
|
||||
QIcon icon::EyeOpened;
|
||||
QIcon icon::EyeClosed;
|
||||
QIcon icon::LockOpened;
|
||||
QIcon icon::LockClosed;
|
||||
QIcon icon::Pencil;
|
||||
QIcon icon::Subtitles;
|
||||
QIcon icon::ColorPicker;
|
||||
QIcon icon::open;
|
||||
QIcon icon::save;
|
||||
QIcon icon::undo;
|
||||
QIcon icon::redo;
|
||||
QIcon icon::tree_view;
|
||||
QIcon icon::list_view;
|
||||
QIcon icon::icon_view;
|
||||
QIcon icon::tool_pointer;
|
||||
QIcon icon::tool_edit;
|
||||
QIcon icon::tool_ripple;
|
||||
QIcon icon::tool_rolling;
|
||||
QIcon icon::tool_razor;
|
||||
QIcon icon::tool_slip;
|
||||
QIcon icon::tool_slide;
|
||||
QIcon icon::tool_hand;
|
||||
QIcon icon::tool_transition;
|
||||
QIcon icon::tool_track_select;
|
||||
QIcon icon::folder;
|
||||
QIcon icon::sequence;
|
||||
QIcon icon::video;
|
||||
QIcon icon::audio;
|
||||
QIcon icon::image;
|
||||
QIcon icon::mini_map;
|
||||
QIcon icon::tri_up;
|
||||
QIcon icon::tri_left;
|
||||
QIcon icon::tri_down;
|
||||
QIcon icon::tri_right;
|
||||
QIcon icon::text_bold;
|
||||
QIcon icon::text_italic;
|
||||
QIcon icon::text_underline;
|
||||
QIcon icon::text_strikethrough;
|
||||
QIcon icon::text_small_caps;
|
||||
QIcon icon::text_align_left;
|
||||
QIcon icon::text_align_right;
|
||||
QIcon icon::text_align_center;
|
||||
QIcon icon::text_align_justify;
|
||||
QIcon icon::text_align_top;
|
||||
QIcon icon::text_align_bottom;
|
||||
QIcon icon::text_align_middle;
|
||||
QIcon icon::snapping;
|
||||
QIcon icon::zoom_in;
|
||||
QIcon icon::zoom_out;
|
||||
QIcon icon::record;
|
||||
QIcon icon::add;
|
||||
QIcon icon::error;
|
||||
QIcon icon::dir_up;
|
||||
QIcon icon::clock;
|
||||
QIcon icon::diamond;
|
||||
QIcon icon::plus;
|
||||
QIcon icon::minus;
|
||||
QIcon icon::add_effect;
|
||||
QIcon icon::eye_opened;
|
||||
QIcon icon::eye_closed;
|
||||
QIcon icon::lock_opened;
|
||||
QIcon icon::lock_closed;
|
||||
QIcon icon::pencil;
|
||||
QIcon icon::subtitles;
|
||||
QIcon icon::color_picker;
|
||||
|
||||
void icon::LoadAll(const QString &theme)
|
||||
void icon::load_all(const QString &theme)
|
||||
{
|
||||
GoToStart = Create(theme, "prev");
|
||||
PrevFrame = Create(theme, "rew");
|
||||
Play = Create(theme, "play");
|
||||
Pause = Create(theme, "pause");
|
||||
NextFrame = Create(theme, "ff");
|
||||
GoToEnd = Create(theme, "next");
|
||||
go_to_start = create(theme, "prev");
|
||||
prev_frame = create(theme, "rew");
|
||||
play = create(theme, "play");
|
||||
pause = create(theme, "pause");
|
||||
next_frame = create(theme, "ff");
|
||||
go_to_end = create(theme, "next");
|
||||
|
||||
New = Create(theme, "new");
|
||||
Open = Create(theme, "open");
|
||||
Save = Create(theme, "save");
|
||||
Undo = Create(theme, "undo");
|
||||
Redo = Create(theme, "redo");
|
||||
TreeView = Create(theme, "treeview");
|
||||
ListView = Create(theme, "listview");
|
||||
IconView = Create(theme, "iconview");
|
||||
New = create(theme, "new");
|
||||
open = create(theme, "open");
|
||||
save = create(theme, "save");
|
||||
undo = create(theme, "undo");
|
||||
redo = create(theme, "redo");
|
||||
tree_view = create(theme, "treeview");
|
||||
list_view = create(theme, "listview");
|
||||
icon_view = create(theme, "iconview");
|
||||
|
||||
ToolPointer = Create(theme, "arrow");
|
||||
ToolEdit = Create(theme, "beam");
|
||||
ToolRipple = Create(theme, "ripple");
|
||||
ToolRolling = Create(theme, "rolling");
|
||||
ToolRazor = Create(theme, "razor");
|
||||
ToolSlip = Create(theme, "slip");
|
||||
ToolSlide = Create(theme, "slide");
|
||||
ToolHand = Create(theme, "hand");
|
||||
ToolTransition = Create(theme, "transition-tool");
|
||||
ToolTrackSelect = Create(theme, "track-tool");
|
||||
tool_pointer = create(theme, "arrow");
|
||||
tool_edit = create(theme, "beam");
|
||||
tool_ripple = create(theme, "ripple");
|
||||
tool_rolling = create(theme, "rolling");
|
||||
tool_razor = create(theme, "razor");
|
||||
tool_slip = create(theme, "slip");
|
||||
tool_slide = create(theme, "slide");
|
||||
tool_hand = create(theme, "hand");
|
||||
tool_transition = create(theme, "transition-tool");
|
||||
tool_track_select = create(theme, "track-tool");
|
||||
|
||||
Folder = Create(theme, "folder");
|
||||
Sequence = Create(theme, "sequence");
|
||||
Video = Create(theme, "videosource");
|
||||
Audio = Create(theme, "audiosource");
|
||||
Image = Create(theme, "imagesource");
|
||||
folder = create(theme, "folder");
|
||||
sequence = create(theme, "sequence");
|
||||
video = create(theme, "videosource");
|
||||
audio = create(theme, "audiosource");
|
||||
image = create(theme, "imagesource");
|
||||
|
||||
MiniMap = Create(theme, "map");
|
||||
mini_map = create(theme, "map");
|
||||
|
||||
TriUp = Create(theme, "tri-up");
|
||||
TriLeft = Create(theme, "tri-left");
|
||||
TriDown = Create(theme, "tri-down");
|
||||
TriRight = Create(theme, "tri-right");
|
||||
tri_up = create(theme, "tri-up");
|
||||
tri_left = create(theme, "tri-left");
|
||||
tri_down = create(theme, "tri-down");
|
||||
tri_right = create(theme, "tri-right");
|
||||
|
||||
TextBold = Create(theme, "text-bold");
|
||||
TextItalic = Create(theme, "text-italic");
|
||||
TextUnderline = Create(theme, "text-underline");
|
||||
TextStrikethrough = Create(theme, "text-strikethrough");
|
||||
TextSmallCaps = Create(theme, "text-small-caps");
|
||||
TextAlignLeft = Create(theme, "align-left");
|
||||
TextAlignRight = Create(theme, "align-right");
|
||||
TextAlignCenter = Create(theme, "align-center");
|
||||
TextAlignJustify = Create(theme, "align-justify-all");
|
||||
TextAlignTop = Create(theme, "align-v-top");
|
||||
TextAlignBottom = Create(theme, "align-v-bottom");
|
||||
TextAlignMiddle = Create(theme, "align-v-middle");
|
||||
text_bold = create(theme, "text-bold");
|
||||
text_italic = create(theme, "text-italic");
|
||||
text_underline = create(theme, "text-underline");
|
||||
text_strikethrough = create(theme, "text-strikethrough");
|
||||
text_small_caps = create(theme, "text-small-caps");
|
||||
text_align_left = create(theme, "align-left");
|
||||
text_align_right = create(theme, "align-right");
|
||||
text_align_center = create(theme, "align-center");
|
||||
text_align_justify = create(theme, "align-justify-all");
|
||||
text_align_top = create(theme, "align-v-top");
|
||||
text_align_bottom = create(theme, "align-v-bottom");
|
||||
text_align_middle = create(theme, "align-v-middle");
|
||||
|
||||
Snapping = Create(theme, "magnet");
|
||||
ZoomIn = Create(theme, "zoomin");
|
||||
ZoomOut = Create(theme, "zoomout");
|
||||
Record = Create(theme, "record");
|
||||
Add = Create(theme, "add-button");
|
||||
Error = Create(theme, "error");
|
||||
DirUp = Create(theme, "dirup");
|
||||
Clock = Create(theme, "clock");
|
||||
Diamond = Create(theme, "diamond");
|
||||
Plus = Create(theme, "plus");
|
||||
Minus = Create(theme, "minus");
|
||||
AddEffect = Create(theme, "add-effect");
|
||||
ColorPicker = Create(theme, "color-picker");
|
||||
snapping = create(theme, "magnet");
|
||||
zoom_in = create(theme, "zoomin");
|
||||
zoom_out = create(theme, "zoomout");
|
||||
record = create(theme, "record");
|
||||
add = create(theme, "add-button");
|
||||
error = create(theme, "error");
|
||||
dir_up = create(theme, "dirup");
|
||||
clock = create(theme, "clock");
|
||||
diamond = create(theme, "diamond");
|
||||
plus = create(theme, "plus");
|
||||
minus = create(theme, "minus");
|
||||
add_effect = create(theme, "add-effect");
|
||||
color_picker = create(theme, "color-picker");
|
||||
|
||||
EyeOpened = Create(theme, "eye-opened");
|
||||
EyeClosed = Create(theme, "eye-closed");
|
||||
LockOpened = Create(theme, "lock-opened");
|
||||
LockClosed = Create(theme, "lock-closed");
|
||||
eye_opened = create(theme, "eye-opened");
|
||||
eye_closed = create(theme, "eye-closed");
|
||||
lock_opened = create(theme, "lock-opened");
|
||||
lock_closed = create(theme, "lock-closed");
|
||||
|
||||
Pencil = Create(theme, "text-edit");
|
||||
Subtitles = Create(theme, "subtitles");
|
||||
pencil = create(theme, "text-edit");
|
||||
subtitles = create(theme, "subtitles");
|
||||
}
|
||||
|
||||
QIcon icon::Create(const QString &theme, const QString &name)
|
||||
QIcon icon::create(const QString &theme, const QString &name)
|
||||
{
|
||||
QIcon icon;
|
||||
|
||||
for (int i = 0; i < ICON_SIZE_COUNT; i++) {
|
||||
for (int i = 0; i < icon_size_count; i++) {
|
||||
icon.addFile(QStringLiteral("%1/png/%2.%3.png")
|
||||
.arg(theme, name, QString::number(ICON_SIZES[i])),
|
||||
QSize(ICON_SIZES[i], ICON_SIZES[i]), QIcon::Normal);
|
||||
.arg(theme, name, QString::number(icon_sizes[i])),
|
||||
QSize(icon_sizes[i], icon_sizes[i]), QIcon::Normal);
|
||||
icon.addFile(QStringLiteral("%1/png/%2.%3.disabled.png")
|
||||
.arg(theme, name, QString::number(ICON_SIZES[i])),
|
||||
QSize(ICON_SIZES[i], ICON_SIZES[i]), QIcon::Disabled);
|
||||
.arg(theme, name, QString::number(icon_sizes[i])),
|
||||
QSize(icon_sizes[i], icon_sizes[i]), QIcon::Disabled);
|
||||
}
|
||||
|
||||
return icon;
|
||||
|
||||
+69
-69
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef ICONS_H
|
||||
#define ICONS_H
|
||||
#ifndef OAK_ICONS_H
|
||||
#define OAK_ICONS_H
|
||||
|
||||
#include <QIcon>
|
||||
|
||||
@@ -33,85 +33,85 @@ namespace icon
|
||||
{
|
||||
|
||||
// Playback Icons
|
||||
extern QIcon GoToStart;
|
||||
extern QIcon PrevFrame;
|
||||
extern QIcon Play;
|
||||
extern QIcon Pause;
|
||||
extern QIcon NextFrame;
|
||||
extern QIcon GoToEnd;
|
||||
extern QIcon go_to_start;
|
||||
extern QIcon prev_frame;
|
||||
extern QIcon play;
|
||||
extern QIcon pause;
|
||||
extern QIcon next_frame;
|
||||
extern QIcon go_to_end;
|
||||
|
||||
// Project Management Toolbar Icons
|
||||
extern QIcon New;
|
||||
extern QIcon Open;
|
||||
extern QIcon Save;
|
||||
extern QIcon Undo;
|
||||
extern QIcon Redo;
|
||||
extern QIcon TreeView;
|
||||
extern QIcon ListView;
|
||||
extern QIcon IconView;
|
||||
extern QIcon open;
|
||||
extern QIcon save;
|
||||
extern QIcon undo;
|
||||
extern QIcon redo;
|
||||
extern QIcon tree_view;
|
||||
extern QIcon list_view;
|
||||
extern QIcon icon_view;
|
||||
|
||||
// Tool Icons
|
||||
extern QIcon ToolPointer;
|
||||
extern QIcon ToolEdit;
|
||||
extern QIcon ToolRipple;
|
||||
extern QIcon ToolRolling;
|
||||
extern QIcon ToolRazor;
|
||||
extern QIcon ToolSlip;
|
||||
extern QIcon ToolSlide;
|
||||
extern QIcon ToolHand;
|
||||
extern QIcon ToolTransition;
|
||||
extern QIcon ToolTrackSelect;
|
||||
extern QIcon tool_pointer;
|
||||
extern QIcon tool_edit;
|
||||
extern QIcon tool_ripple;
|
||||
extern QIcon tool_rolling;
|
||||
extern QIcon tool_razor;
|
||||
extern QIcon tool_slip;
|
||||
extern QIcon tool_slide;
|
||||
extern QIcon tool_hand;
|
||||
extern QIcon tool_transition;
|
||||
extern QIcon tool_track_select;
|
||||
|
||||
// Project Icons
|
||||
extern QIcon Folder;
|
||||
extern QIcon Sequence;
|
||||
extern QIcon Video;
|
||||
extern QIcon Audio;
|
||||
extern QIcon Image;
|
||||
extern QIcon folder;
|
||||
extern QIcon sequence;
|
||||
extern QIcon video;
|
||||
extern QIcon audio;
|
||||
extern QIcon image;
|
||||
|
||||
// Node Icons
|
||||
extern QIcon MiniMap;
|
||||
extern QIcon mini_map;
|
||||
|
||||
// Triangle Arrows
|
||||
extern QIcon TriUp;
|
||||
extern QIcon TriLeft;
|
||||
extern QIcon TriDown;
|
||||
extern QIcon TriRight;
|
||||
extern QIcon tri_up;
|
||||
extern QIcon tri_left;
|
||||
extern QIcon tri_down;
|
||||
extern QIcon tri_right;
|
||||
|
||||
// Text
|
||||
extern QIcon TextBold;
|
||||
extern QIcon TextItalic;
|
||||
extern QIcon TextUnderline;
|
||||
extern QIcon TextStrikethrough;
|
||||
extern QIcon TextSmallCaps;
|
||||
extern QIcon TextAlignLeft;
|
||||
extern QIcon TextAlignRight;
|
||||
extern QIcon TextAlignCenter;
|
||||
extern QIcon TextAlignJustify;
|
||||
extern QIcon TextAlignTop;
|
||||
extern QIcon TextAlignBottom;
|
||||
extern QIcon TextAlignMiddle;
|
||||
extern QIcon text_bold;
|
||||
extern QIcon text_italic;
|
||||
extern QIcon text_underline;
|
||||
extern QIcon text_strikethrough;
|
||||
extern QIcon text_small_caps;
|
||||
extern QIcon text_align_left;
|
||||
extern QIcon text_align_right;
|
||||
extern QIcon text_align_center;
|
||||
extern QIcon text_align_justify;
|
||||
extern QIcon text_align_top;
|
||||
extern QIcon text_align_bottom;
|
||||
extern QIcon text_align_middle;
|
||||
|
||||
// Miscellaneous Icons
|
||||
extern QIcon Snapping;
|
||||
extern QIcon ZoomIn;
|
||||
extern QIcon ZoomOut;
|
||||
extern QIcon Record;
|
||||
extern QIcon Add;
|
||||
extern QIcon Error;
|
||||
extern QIcon DirUp;
|
||||
extern QIcon Clock;
|
||||
extern QIcon Diamond;
|
||||
extern QIcon Plus;
|
||||
extern QIcon Minus;
|
||||
extern QIcon AddEffect;
|
||||
extern QIcon EyeOpened;
|
||||
extern QIcon EyeClosed;
|
||||
extern QIcon LockOpened;
|
||||
extern QIcon LockClosed;
|
||||
extern QIcon Pencil;
|
||||
extern QIcon Subtitles;
|
||||
extern QIcon ColorPicker;
|
||||
extern QIcon snapping;
|
||||
extern QIcon zoom_in;
|
||||
extern QIcon zoom_out;
|
||||
extern QIcon record;
|
||||
extern QIcon add;
|
||||
extern QIcon error;
|
||||
extern QIcon dir_up;
|
||||
extern QIcon clock;
|
||||
extern QIcon diamond;
|
||||
extern QIcon plus;
|
||||
extern QIcon minus;
|
||||
extern QIcon add_effect;
|
||||
extern QIcon eye_opened;
|
||||
extern QIcon eye_closed;
|
||||
extern QIcon lock_opened;
|
||||
extern QIcon lock_closed;
|
||||
extern QIcon pencil;
|
||||
extern QIcon subtitles;
|
||||
extern QIcon color_picker;
|
||||
|
||||
/**
|
||||
* @brief Create an icon object loaded from file
|
||||
@@ -142,7 +142,7 @@ extern QIcon ColorPicker;
|
||||
*
|
||||
* A QIcon object containing the various icon sizes loaded from resource
|
||||
*/
|
||||
QIcon Create(const QString &theme, const QString &name);
|
||||
QIcon create(const QString &theme, const QString &name);
|
||||
|
||||
/**
|
||||
* @brief Methodically load all Olive icons into global variables that can be accessed throughout the application
|
||||
@@ -150,10 +150,10 @@ QIcon Create(const QString &theme, const QString &name);
|
||||
* It's recommended to load any UI icons here so they're ready at startup and don't need to be re-loaded upon each
|
||||
* use.
|
||||
*/
|
||||
void LoadAll(const QString &theme);
|
||||
void load_all(const QString &theme);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // ICONS_H
|
||||
#endif // OAK_ICONS_H
|
||||
|
||||
+19
-19
@@ -35,23 +35,23 @@
|
||||
namespace olive
|
||||
{
|
||||
|
||||
QString StyleManager::current_style_;
|
||||
QString StyleManager::current_style;
|
||||
QMap<QString, QString> StyleManager::available_themes_;
|
||||
|
||||
QPalette StyleManager::ParsePalette(const QString &ini_path)
|
||||
QPalette StyleManager::parse_palette(const QString &ini_path)
|
||||
{
|
||||
QSettings ini(ini_path, QSettings::IniFormat);
|
||||
QPalette palette;
|
||||
|
||||
ParsePaletteGroup(&ini, &palette, QPalette::All);
|
||||
ParsePaletteGroup(&ini, &palette, QPalette::Active);
|
||||
ParsePaletteGroup(&ini, &palette, QPalette::Inactive);
|
||||
ParsePaletteGroup(&ini, &palette, QPalette::Disabled);
|
||||
parse_palette_group(&ini, &palette, QPalette::All);
|
||||
parse_palette_group(&ini, &palette, QPalette::Active);
|
||||
parse_palette_group(&ini, &palette, QPalette::Inactive);
|
||||
parse_palette_group(&ini, &palette, QPalette::Disabled);
|
||||
|
||||
return palette;
|
||||
}
|
||||
|
||||
void StyleManager::ParsePaletteGroup(QSettings *ini, QPalette *palette,
|
||||
void StyleManager::parse_palette_group(QSettings *ini, QPalette *palette,
|
||||
QPalette::ColorGroup group)
|
||||
{
|
||||
QString group_name;
|
||||
@@ -77,13 +77,13 @@ void StyleManager::ParsePaletteGroup(QSettings *ini, QPalette *palette,
|
||||
|
||||
QStringList keys = ini->childKeys();
|
||||
foreach (QString k, keys) {
|
||||
ParsePaletteColor(ini, palette, group, k);
|
||||
parse_palette_color(ini, palette, group, k);
|
||||
}
|
||||
|
||||
ini->endGroup();
|
||||
}
|
||||
|
||||
void StyleManager::ParsePaletteColor(QSettings *ini, QPalette *palette,
|
||||
void StyleManager::parse_palette_color(QSettings *ini, QPalette *palette,
|
||||
QPalette::ColorGroup group,
|
||||
const QString &role_name)
|
||||
{
|
||||
@@ -137,7 +137,7 @@ void StyleManager::ParsePaletteColor(QSettings *ini, QPalette *palette,
|
||||
palette->setColor(group, role, QColor(ini->value(role_name).toString()));
|
||||
}
|
||||
|
||||
void StyleManager::Init()
|
||||
void StyleManager::init()
|
||||
{
|
||||
qApp->setStyle(QStyleFactory::create("Fusion"));
|
||||
|
||||
@@ -146,33 +146,33 @@ void StyleManager::Init()
|
||||
available_themes_.insert(QStringLiteral("olive-light"),
|
||||
QStringLiteral("Oak Light"));
|
||||
|
||||
QString config_style = OLIVE_CONFIG("Style").toString();
|
||||
QString config_style = OAK_CONFIG("Style").toString();
|
||||
|
||||
if (config_style.isEmpty() || !available_themes_.contains(config_style)) {
|
||||
SetStyle(kDefaultStyle);
|
||||
set_style(k_default_style);
|
||||
} else {
|
||||
SetStyle(config_style);
|
||||
set_style(config_style);
|
||||
}
|
||||
}
|
||||
|
||||
const QString &StyleManager::GetStyle()
|
||||
const QString &StyleManager::get_style()
|
||||
{
|
||||
return current_style_;
|
||||
return current_style;
|
||||
}
|
||||
|
||||
void StyleManager::SetStyle(const QString &style_path)
|
||||
void StyleManager::set_style(const QString &style_path)
|
||||
{
|
||||
current_style_ = style_path;
|
||||
current_style = style_path;
|
||||
|
||||
QString abs_style_path = QStringLiteral(":/style/%1").arg(style_path);
|
||||
|
||||
// Load all icons for this style (icons must be loaded first because the style change below triggers the icon change)
|
||||
icon::LoadAll(abs_style_path);
|
||||
icon::load_all(abs_style_path);
|
||||
|
||||
// Set palette for this
|
||||
QString palette_file = QStringLiteral("%1/palette.ini").arg(abs_style_path);
|
||||
if (QFileInfo::exists(palette_file)) {
|
||||
qApp->setPalette(ParsePalette(palette_file));
|
||||
qApp->setPalette(parse_palette(palette_file));
|
||||
} else {
|
||||
qApp->setPalette(qApp->style()->standardPalette());
|
||||
}
|
||||
|
||||
+11
-11
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef STYLEMANAGER_H
|
||||
#define STYLEMANAGER_H
|
||||
#ifndef OAK_STYLEMANAGER_H
|
||||
#define OAK_STYLEMANAGER_H
|
||||
|
||||
#include <QSettings>
|
||||
#include <QWidget>
|
||||
@@ -32,13 +32,13 @@ namespace olive
|
||||
|
||||
class StyleManager : public QObject {
|
||||
public:
|
||||
static void Init();
|
||||
static void init();
|
||||
|
||||
static const QString &GetStyle();
|
||||
static const QString &get_style();
|
||||
|
||||
static void SetStyle(const QString &style_path);
|
||||
static void set_style(const QString &style_path);
|
||||
|
||||
inline static const char *kDefaultStyle = "olive-dark";
|
||||
inline static const char *k_default_style = "olive-dark";
|
||||
|
||||
static const QMap<QString, QString> &available_themes()
|
||||
{
|
||||
@@ -46,20 +46,20 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
static QPalette ParsePalette(const QString &ini_path);
|
||||
static QPalette parse_palette(const QString &ini_path);
|
||||
|
||||
static void ParsePaletteGroup(QSettings *ini, QPalette *palette,
|
||||
static void parse_palette_group(QSettings *ini, QPalette *palette,
|
||||
QPalette::ColorGroup group);
|
||||
|
||||
static void ParsePaletteColor(QSettings *ini, QPalette *palette,
|
||||
static void parse_palette_color(QSettings *ini, QPalette *palette,
|
||||
QPalette::ColorGroup group,
|
||||
const QString &role_name);
|
||||
|
||||
static QString current_style_;
|
||||
static QString current_style;
|
||||
|
||||
static QMap<QString, QString> available_themes_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // STYLEMANAGER_H
|
||||
#endif // OAK_STYLEMANAGER_H
|
||||
|
||||
Reference in New Issue
Block a user