diff --git a/app/decoder/probeserver.cpp b/app/decoder/probeserver.cpp index 02960f637..fb4a42ba6 100644 --- a/app/decoder/probeserver.cpp +++ b/app/decoder/probeserver.cpp @@ -54,7 +54,8 @@ bool olive::ProbeMedia(Footage *f) for (int i=0;iProbe(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; diff --git a/app/ui/style/CMakeLists.txt b/app/ui/style/CMakeLists.txt index aa4492f82..2e8776964 100644 --- a/app/ui/style/CMakeLists.txt +++ b/app/ui/style/CMakeLists.txt @@ -14,6 +14,13 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +add_subdirectory(css) + +set(OLIVE_RESOURCES + ${OLIVE_RESOURCES} + PARENT_SCOPE +) + set(OLIVE_SOURCES ${OLIVE_SOURCES} ui/style/style.h diff --git a/app/ui/style/css/CMakeLists.txt b/app/ui/style/css/CMakeLists.txt new file mode 100644 index 000000000..3359b5512 --- /dev/null +++ b/app/ui/style/css/CMakeLists.txt @@ -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 . + +set(OLIVE_RESOURCES + ${OLIVE_RESOURCES} + ui/style/css/stylesheets.qrc + PARENT_SCOPE +) diff --git a/app/ui/style/css/icons.qrc b/app/ui/style/css/icons.qrc new file mode 100644 index 000000000..29fbe4aa6 --- /dev/null +++ b/app/ui/style/css/icons.qrc @@ -0,0 +1,5 @@ + + + olive-dark.css + + diff --git a/app/ui/style/css/olive-dark.css b/app/ui/style/css/olive-dark.css new file mode 100644 index 000000000..31d8ced4a --- /dev/null +++ b/app/ui/style/css/olive-dark.css @@ -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 . + +***/ + +/*** + + 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; +} diff --git a/app/ui/style/css/olive-light.css b/app/ui/style/css/olive-light.css new file mode 100644 index 000000000..716af5fa5 --- /dev/null +++ b/app/ui/style/css/olive-light.css @@ -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 . + +***/ + +/*** + + 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; +} diff --git a/app/ui/style/css/olive-mid.css b/app/ui/style/css/olive-mid.css new file mode 100644 index 000000000..0b57a3f90 --- /dev/null +++ b/app/ui/style/css/olive-mid.css @@ -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 . + +***/ + +/*** + + 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; +} diff --git a/app/ui/style/css/stylesheets.qrc b/app/ui/style/css/stylesheets.qrc new file mode 100644 index 000000000..8a62af88f --- /dev/null +++ b/app/ui/style/css/stylesheets.qrc @@ -0,0 +1,7 @@ + + + olive-dark.css + olive-mid.css + olive-light.css + + diff --git a/app/ui/style/style.cpp b/app/ui/style/style.cpp index 8a5f35ccf..f83c19d7b 100644 --- a/app/ui/style/style.cpp +++ b/app/ui/style/style.cpp @@ -21,47 +21,24 @@ #include "style.h" #include +#include #include #include +#include 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)