ported styling from qpalettes to stylesheets for maximum customizability
This commit is contained in:
+9
-31
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user