revised UI color system when showing nodes

Olive now has a set of colors that categories can be "assigned" to. The timeline also shares the same colors as the NodeView. Colors can be configured per node (aka per clip).
This commit is contained in:
itsmattkc
2021-01-15 18:44:34 +11:00
parent 91740dd823
commit b4dd976e90
22 changed files with 443 additions and 72 deletions
+26
View File
@@ -0,0 +1,26 @@
# Olive - Non-Linear Video Editor
# Copyright (C) 2020 Olive Team
#
# 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/>.
set(OLIVE_SOURCES
${OLIVE_SOURCES}
widget/colorlabelmenu/colorcodingcombobox.cpp
widget/colorlabelmenu/colorcodingcombobox.h
widget/colorlabelmenu/colorlabelmenu.cpp
widget/colorlabelmenu/colorlabelmenu.h
widget/colorlabelmenu/colorlabelmenuitem.cpp
widget/colorlabelmenu/colorlabelmenuitem.h
PARENT_SCOPE
)
@@ -0,0 +1,73 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2020 Olive Team
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/>.
***/
#include "colorlabelmenu.h"
#include <QEvent>
#include <QWidgetAction>
#include "ui/colorcoding.h"
namespace olive {
ColorLabelMenu::ColorLabelMenu(QWidget *parent) :
Menu(parent)
{
for (int i=0; i<ColorCoding::standard_colors().size(); i++) {
ColorLabelMenuItem* item = new ColorLabelMenuItem();
item->SetColor(ColorCoding::standard_colors().at(i));
color_items_.append(item);
QWidgetAction* a = new QWidgetAction(this);
Menu::ConformItem(a, QStringLiteral("colorlabel%1").arg(i), this, &ColorLabelMenu::ActionTriggered);
a->setData(i);
a->setDefaultWidget(item);
this->addAction(a);
}
Retranslate();
}
void ColorLabelMenu::changeEvent(QEvent *event)
{
if (event->type() == QEvent::LanguageChange) {
Retranslate();
}
Menu::changeEvent(event);
}
void ColorLabelMenu::Retranslate()
{
this->setTitle(tr("Color"));
for (int i=0; i<color_items_.size(); i++) {
color_items_.at(i)->SetText(ColorCoding::GetColorName(i));
}
}
void ColorLabelMenu::ActionTriggered()
{
QAction* a = static_cast<QAction*>(sender());
emit ColorSelected(a->data().toInt());
}
}
@@ -0,0 +1,52 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2020 Olive Team
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 COLORLABELMENU_H
#define COLORLABELMENU_H
#include "colorlabelmenuitem.h"
#include "widget/menu/menu.h"
namespace olive {
class ColorLabelMenu : public Menu
{
Q_OBJECT
public:
ColorLabelMenu(QWidget* parent = nullptr);
virtual void changeEvent(QEvent* event) override;
signals:
void ColorSelected(int i);
private:
void Retranslate();
QVector<ColorLabelMenuItem*> color_items_;
private slots:
void ActionTriggered();
};
}
#endif // COLORLABELMENU_H
@@ -0,0 +1,58 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2020 Olive Team
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/>.
***/
#include "colorlabelmenuitem.h"
#include <QHBoxLayout>
#include "ui/style/style.h"
namespace olive {
ColorLabelMenuItem::ColorLabelMenuItem(QWidget* parent) :
QWidget(parent)
{
int text_height = fontMetrics().height();
int padding = text_height/4;
QHBoxLayout* layout = new QHBoxLayout(this);
layout->setMargin(padding);
layout->setSpacing(padding);
box_ = new ColorPreviewBox();
box_->setFixedSize(text_height, text_height);
layout->addWidget(box_);
label_ = new QLabel();
StyleManager::UseOSNativeStyling(label_);
layout->addWidget(label_);
}
void ColorLabelMenuItem::SetText(const QString &text)
{
label_->setText(text);
}
void ColorLabelMenuItem::SetColor(const Color &color)
{
box_->SetColor(color);
}
}
@@ -0,0 +1,48 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2020 Olive Team
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 COLORLABELMENUITEM_H
#define COLORLABELMENUITEM_H
#include <QLabel>
#include <QWidget>
#include "widget/colorwheel/colorpreviewbox.h"
namespace olive {
class ColorLabelMenuItem : public QWidget
{
public:
ColorLabelMenuItem(QWidget* parent = nullptr);
void SetText(const QString& text);
void SetColor(const Color& color);
private:
ColorPreviewBox* box_;
QLabel* label_;
};
}
#endif // COLORLABELMENUITEM_H