ported styling from qpalettes to stylesheets for maximum customizability

This commit is contained in:
itsmattkc
2019-07-01 10:53:28 -07:00
parent 70cf6565f4
commit 14917ef3cc
9 changed files with 297 additions and 32 deletions
+2 -1
View File
@@ -54,7 +54,8 @@ bool olive::ProbeMedia(Footage *f)
for (int i=0;i<decoder_list.size();i++) {
if (decoder_list.at(i)->Probe(f)) {
// TODO Some way of "attaching" the Footage to the Decoder without having to iterate through Decoders like this
// TODO Some way of "attaching" the Footage to the Decoder without having to iterate through Decoders again at
// render time?
f->set_ready(true);
return true;
+7
View File
@@ -14,6 +14,13 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
add_subdirectory(css)
set(OLIVE_RESOURCES
${OLIVE_RESOURCES}
PARENT_SCOPE
)
set(OLIVE_SOURCES
${OLIVE_SOURCES}
ui/style/style.h
+21
View File
@@ -0,0 +1,21 @@
# Olive - Non-Linear Video Editor
# Copyright (C) 2019 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_RESOURCES
${OLIVE_RESOURCES}
ui/style/css/stylesheets.qrc
PARENT_SCOPE
)
+5
View File
@@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/css">
<file>olive-dark.css</file>
</qresource>
</RCC>
+82
View File
@@ -0,0 +1,82 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2019 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/>.
***/
/***
Olive Dark - Qt CSS Theme
A fairly basic CSS style for the Olive Video Editor/Qt Fusion.
The primary colors are:
Main: #353535
Text: #ffffff
Highlights: #2a82da
Highlight Text: #ffffff
Dark: #191919
**/
/* Default widget colors */
QWidget {
background: #353535;
color: #ffffff;
}
/* Default highlight colors */
QWidget::selected {
background: #2a82da;
color: #ffffff;
}
/* Default link color */
a {
color: #2a82da;
}
/* Item views use a darker background color */
QAbstractItemView {
background: #191919;
}
/* Other children of QAbstractItemView (e.g. headers) should use the original background however */
QAbstractItemView * {
background: #353535;
}
/* QLineEdit background is dark */
QLineEdit {
background: #191919;
}
/* QMenu background is dark */
QMenu {
background: #191919;
}
/* Ensure QPushButtons look dark when checked */
QPushButton::checked {
background: #191919;
}
/* Ensure QMenu separators are dark enough */
QMenu::separator {
background: #191919;
}
+82
View File
@@ -0,0 +1,82 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2019 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/>.
***/
/***
Olive Light - Qt CSS Theme
A fairly basic CSS style for the Olive Video Editor/Qt Fusion.
The primary colors are:
Main: #d0d0d0
Text: #000000
Highlights: #2a82da
Highlight Text: #ffffff
Dark: #f0f0f0
**/
/* Default widget colors */
QWidget {
background: #d0d0d0;
color: #000000;
}
/* Default highlight colors */
QWidget::selected {
background: #2a82da;
color: #ffffff;
}
/* Default link color */
a {
color: #2a82da;
}
/* Item views use a darker background color */
QAbstractItemView {
background: #f0f0f0;
}
/* Other children of QAbstractItemView (e.g. headers) should use the original background however */
QAbstractItemView * {
background: #d0d0d0;
}
/* QLineEdit background is dark */
QLineEdit {
background: #f0f0f0;
}
/* QMenu background is dark */
QMenu {
background: #f0f0f0;
}
/* Ensure QPushButtons look dark when checked */
QPushButton::checked {
background: #f0f0f0;
}
/* Ensure QMenu separators are dark enough */
QMenu::separator {
background: #f0f0f0;
}
+82
View File
@@ -0,0 +1,82 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2019 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/>.
***/
/***
Olive Mid - Qt CSS Theme
A fairly basic CSS style for the Olive Video Editor/Qt Fusion.
The primary colors are:
Main: #808080
Text: #000000
Highlights: #2a82da
Highlight Text: #ffffff
Dark: #c0c0c0
**/
/* Default widget colors */
QWidget {
background: #808080;
color: #000000;
}
/* Default highlight colors */
QWidget::selected {
background: #2a82da;
color: #ffffff;
}
/* Default link color */
a {
color: #2a82da;
}
/* Item views use a darker background color */
QAbstractItemView {
background: #c0c0c0;
}
/* Other children of QAbstractItemView (e.g. headers) should use the original background however */
QAbstractItemView * {
background: #808080;
}
/* QLineEdit background is dark */
QLineEdit {
background: #c0c0c0;
}
/* QMenu background is dark */
QMenu {
background: #c0c0c0;
}
/* Ensure QPushButtons look dark when checked */
QPushButton::checked {
background: #c0c0c0;
}
/* Ensure QMenu separators are dark enough */
QMenu::separator {
background: #c0c0c0;
}
+7
View File
@@ -0,0 +1,7 @@
<RCC>
<qresource prefix="/css">
<file>olive-dark.css</file>
<file>olive-mid.css</file>
<file>olive-light.css</file>
</qresource>
</RCC>
+9 -31
View File
@@ -21,47 +21,24 @@
#include "style.h"
#include <QApplication>
#include <QFile>
#include <QPalette>
#include <QStyleFactory>
#include <QTextStream>
void olive::style::AppSetDefault()
{
// We always use Qt Fusion since it's extremely customizable and cross platform
qApp->setStyle(QStyleFactory::create("Fusion"));
// Set palette for Fusion
QPalette palette;
// Set CSS style for this
QFile css_file(":/css/olive-dark.css");
palette.setColor(QPalette::Window, QColor(53,53,53));
palette.setColor(QPalette::WindowText, Qt::white);
palette.setColor(QPalette::Base, QColor(25,25,25));
palette.setColor(QPalette::AlternateBase, QColor(53,53,53));
palette.setColor(QPalette::ToolTipBase, QColor(25,25,25));
palette.setColor(QPalette::ToolTipText, Qt::white);
palette.setColor(QPalette::Text, Qt::white);
palette.setColor(QPalette::Button, QColor(53,53,53));
palette.setColor(QPalette::ButtonText, Qt::white);
palette.setColor(QPalette::BrightText, Qt::red);
palette.setColor(QPalette::Disabled, QPalette::ButtonText, QColor(128, 128, 128));
palette.setColor(QPalette::Link, QColor(42, 130, 218));
palette.setColor(QPalette::Highlight, QColor(42, 130, 218));
palette.setColor(QPalette::HighlightedText, Qt::white);
if (css_file.open(QFile::ReadOnly | QFile::Text)) {
QTextStream css_ts(&css_file);
qApp->setPalette(palette);
// set default CSS
QString stylesheet = "QPushButton::checked { background: rgb(25, 25, 25); }";
// Windows menus have the option of being native, so we may not need this CSS
bool set_separator_color = false;
#ifndef Q_OS_WIN
//set_separator_color = !olive::config.use_native_menu_styling;
set_separator_color = true;
#endif
if (set_separator_color) {
stylesheet.append("QMenu::separator { background: #303030; }");
qApp->setStyleSheet(css_ts.readAll());
}
qApp->setStyleSheet(stylesheet);
}
void olive::style::WidgetSetNative(QWidget *w)
@@ -69,6 +46,7 @@ void olive::style::WidgetSetNative(QWidget *w)
#ifdef Q_OS_WIN
w->setStyleSheet("");
w->setPalette(w->style()->standardPalette());
w->setStyleSheet(QString());
w->setStyle(QStyleFactory::create("windowsvista"));
#else
Q_UNUSED(w)