apparently these weren't committed before, whoops

This commit is contained in:
itsmattkc
2021-01-22 17:07:42 +11:00
parent 88d1b86d11
commit 3ce29f9093
4 changed files with 254 additions and 0 deletions
@@ -0,0 +1,53 @@
/***
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 "colorcodingcombobox.h"
#include "ui/colorcoding.h"
namespace olive {
ColorCodingComboBox::ColorCodingComboBox(QWidget *parent) :
QComboBox(parent)
{
SetColor(0);
}
void ColorCodingComboBox::showPopup()
{
ColorLabelMenu menu(this);
menu.setMinimumWidth(width());
QAction* a = menu.exec(parentWidget()->mapToGlobal(pos()));
if (a) {
SetColor(a->data().toInt());
}
}
void ColorCodingComboBox::SetColor(int index)
{
clear();
addItem(ColorCoding::GetColorName(index));
index_ = index;
}
}
@@ -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 COLORCODINGCOMBOBOX_H
#define COLORCODINGCOMBOBOX_H
#include <QComboBox>
#include "widget/colorlabelmenu/colorlabelmenu.h"
namespace olive {
class ColorCodingComboBox : public QComboBox
{
Q_OBJECT
public:
ColorCodingComboBox(QWidget* parent = nullptr);
virtual void showPopup() override;
void SetColor(int index);
int GetSelectedColor() const
{
return index_;
}
private:
int index_;
};
}
#endif // COLORCODINGCOMBOBOX_H