From b8db1676478cdfab7a86eec8edd1207a0ef379ec Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Sat, 4 Jul 2015 20:26:38 +0200 Subject: [PATCH] Include stylesheet in main file --- apps/Launcher/infowidget.cpp | 2 - apps/Launcher/main.cpp | 494 ++++++++++------------------------- apps/Launcher/syncwidget.cpp | 2 +- 3 files changed, 136 insertions(+), 362 deletions(-) diff --git a/apps/Launcher/infowidget.cpp b/apps/Launcher/infowidget.cpp index 39cea3db00..a10d9430e6 100644 --- a/apps/Launcher/infowidget.cpp +++ b/apps/Launcher/infowidget.cpp @@ -43,9 +43,7 @@ InfoWidget::InfoWidget(QString name, int totalBytes) setFixedHeight(100); QGridLayout* layout = new QGridLayout; - //layout->setVerticalSpacing(0); layout->setHorizontalSpacing(10); - layout->setContentsMargins(0, 0, 0, 0); _name = new QLabel(name); _name->setObjectName("Name"); diff --git a/apps/Launcher/main.cpp b/apps/Launcher/main.cpp index 28f8634105..63a90a620e 100644 --- a/apps/Launcher/main.cpp +++ b/apps/Launcher/main.cpp @@ -30,370 +30,146 @@ #include -// Copyright 2013 Emanuel Claesson -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -//*/ -// -///* -// COLOR_DARK = #191919 -// COLOR_MEDIUM = #353535 -// COLOR_MEDLIGHT = #5A5A5A -// COLOR_LIGHT = #DDDDDD -// COLOR_ACCENT = #3D7848 -//*/ -// -//* { -// background: #191919; -// color: #DDDDDD; -// border: 1px solid #5A5A5A; -//} -// -//QWidget::item:selected { -// background: #3D7848; -//} -// -//QCheckBox, QRadioButton { -// border: none; -//} -// -//QRadioButton::indicator, QCheckBox::indicator { -// width: 13px; -// height: 13px; -//} -// -//QRadioButton::indicator::unchecked, QCheckBox::indicator::unchecked { -// border: 1px solid #5A5A5A; -// background: none; -//} -// -//QRadioButton::indicator:unchecked:hover, QCheckBox::indicator:unchecked:hover { -// border: 1px solid #DDDDDD; -//} -// -//QRadioButton::indicator::checked, QCheckBox::indicator::checked { -// border: 1px solid #5A5A5A; -// background: #5A5A5A; -//} -// -//QRadioButton::indicator:checked:hover, QCheckBox::indicator:checked:hover { -// border: 1px solid #DDDDDD; -// background: #DDDDDD; -//} -// -//QGroupBox { -// margin-top: 6px; -//} -// -//QGroupBox::title { -// top: -7px; -// left: 7px; -//} -// -//QScrollBar { -// border: 1px solid #5A5A5A; -// background: #191919; -//} -// -//QScrollBar:horizontal { -// height: 15px; -// margin: 0px 0px 0px 32px; -//} -// -//QScrollBar:vertical { -// width: 15px; -// margin: 32px 0px 0px 0px; -//} -// -//QScrollBar::handle { -// background: #353535; -// border: 1px solid #5A5A5A; -//} -// -//QScrollBar::handle:horizontal { -// border-width: 0px 1px 0px 1px; -//} -// -//QScrollBar::handle:vertical { -// border-width: 1px 0px 1px 0px; -//} -// -//QScrollBar::handle:horizontal { -// min-width: 20px; -//} -// -//QScrollBar::handle:vertical { -// min-height: 20px; -//} -// -//QScrollBar::add-line, QScrollBar::sub-line { -// background:#353535; -// border: 1px solid #5A5A5A; -// subcontrol-origin: margin; -//} -// -//QScrollBar::add-line { -// position: absolute; -//} -// -//QScrollBar::add-line:horizontal { -// width: 15px; -// subcontrol-position: left; -// left: 15px; -//} -// -//QScrollBar::add-line:vertical { -// height: 15px; -// subcontrol-position: top; -// top: 15px; -//} -// -//QScrollBar::sub-line:horizontal { -// width: 15px; -// subcontrol-position: top left; -//} -// -//QScrollBar::sub-line:vertical { -// height: 15px; -// subcontrol-position: top; -//} -// -//QScrollBar:left-arrow, QScrollBar::right-arrow, QScrollBar::up-arrow, QScrollBar::down-arrow { -// border: 1px solid #5A5A5A; -// width: 3px; -// height: 3px; -//} -// -//QScrollBar::add-page, QScrollBar::sub-page { -// background: none; -//} -// -//QAbstractButton:hover { -// background: #353535; -//} -// -//QAbstractButton:pressed { -// background: #5A5A5A; -//} -// -//QAbstractItemView { -// show-decoration-selected: 1; -// selection-background-color: #3D7848; -// selection-color: #DDDDDD; -// alternate-background-color: #353535; -//} -// -//QHeaderView { -// border: 1px solid #5A5A5A; -//} -// -//QHeaderView::section { -// background: #191919; -// border: 1px solid #5A5A5A; -// padding: 4px; -//} -// -//QHeaderView::section:selected, QHeaderView::section::checked { -// background: #353535; -//} -// -//QTableView { -// gridline-color: #5A5A5A; -//} -// -//QTabBar { -// margin-left: 2px; -//} -// -//QTabBar::tab { -// border-radius: 0px; -// padding: 4px; -// margin: 4px; -//} -// -//QTabBar::tab:selected { -// background: #353535; -//} -// -//QComboBox::down-arrow { -// border: 1px solid #5A5A5A; -// background: #353535; -//} -// -//QComboBox::drop-down { -// border: 1px solid #5A5A5A; -// background: #353535; -//} -// -//QComboBox::down-arrow { -// width: 3px; -// height: 3px; -// border: 1px solid #5A5A5A; -//} -// -//QAbstractSpinBox { -// padding-right: 15px; -//} -// -//QAbstractSpinBox::up-button, QAbstractSpinBox::down-button { -// border: 1px solid #5A5A5A; -// background: #353535; -// subcontrol-origin: border; -//} -// -//QAbstractSpinBox::up-arrow, QAbstractSpinBox::down-arrow { -// width: 3px; -// height: 3px; -// border: 1px solid #5A5A5A; -//} -// -//QSlider { -// border: none; -//} -// -//QSlider::groove:horizontal { -// height: 5px; -// margin: 4px 0px 4px 0px; -//} -// -//QSlider::groove:vertical { -// width: 5px; -// margin: 0px 4px 0px 4px; -//} -// -//QSlider::handle { -// border: 1px solid #5A5A5A; -// background: #353535; -//} -// -//QSlider::handle:horizontal { -// width: 15px; -// margin: -4px 0px -4px 0px; -//} -// -//QSlider::handle:vertical { -// height: 15px; -// margin: 0px -4px 0px -4px; -//} -// -//QSlider::add-page:vertical, QSlider::sub-page:horizontal { -// background: #3D7848; -//} -// -//QSlider::sub-page:vertical, QSlider::add-page:horizontal { -// background: #353535; -//} -// -//QLabel { -// border: none; -//} -// -//QProgressBar { -// text-align: center; -//} -// -//QProgressBar::chunk { -// width: 1px; -// background-color: #3D7848; -//} -// -//QMenu::separator { -// background: #353535; -//} -//)style"; - -//static const QString style = R"style( -//QWidget { -// font-family: Helvetica; -//} -//QWidget#MainWindow, QTextEdit, QWidget#SyncWidget, QWidget#DownloadArea { -// background-color: rgb(40, 40, 40); -//} -//QTextEdit, QLabel, QComboBox, QCheckBox { -// color: white; -// font-size: 12px; -//} -//QTextEdit { -// border-width: 2px 2px 0px 0px; -// border-style: solid; -// background-color: rgb(60, 60, 60); -//} -//QPushButton { -// background-color: -// qlineargradient( -// x1: 0, y1: 0, x2: 0, y2: 1, -// stop: 0 white, -// stop: 1 #505050 -// ); -// border-style: solid; -// border-color: black; -// border-width: 1px; -// font-size: 11px; -// min-height: 17.5px; -//} -//QComboBox { -// background-color: rgb(60, 60, 60); -// min-height: 20px; -//} -//QComboBox:focus, QComboBox:focus QAbstractItemView { -// color: white; -// background-color: rgb(60, 60, 60); -// selection-background-color: rgb(75, 75, 75); -//} -//QCheckBox { -// border: none; -//} -//QCheckBox::indicator { -// width: 13px; -// height: 13px; -//} -//QCheckBox::indicator::unchecked { -// border: 1px solid #5A5A5A; -// background: transparent; -//} -//QCheckBox::indicator:unchecked:hover { -// border: 1px solid #DDDDDD; -//} -//QCheckBox::indicator::checked { -// border: 1px solid #666666; -// background: #666666; -//} -//QCheckBox::indicator:checked:hover { -// border: 1px solid #DDDDDD; -// background: #555555; -//} -//QGroupBox, QScrollArea { -// border: 0px; -//} -//)style"; +static const QString style = R"style( +QWidget { + /*font-family: "Helvetica";*/ +} +QWidget#MainWindow, QTextEdit, QWidget#SyncWidget, QWidget#DownloadArea { + background-color: rgb(40, 40, 40); +} +QTextEdit, QLabel, QComboBox, QCheckBox { + color: #EDEDED; + font-size: 12px; +} +QLabel { + font-size: 13px; +} +QLabel#Image { + margin: -10px 0px -5px 0px; +} +QTextEdit { + border-width: 2px 2px 0px 0px; + border-style: solid; + background-color: rgb(60, 60, 60); +} +QPushButton { + color:#202020; + background-color: + qlineargradient( + x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 white, + stop: 1 #555555 + ); + border: 1px solid black; + font-size: 11px; + min-height: 20px; +} +QComboBox { + background-color: rgb(60, 60, 60); + min-height: 20px; +} +QComboBox:focus, QComboBox:focus QAbstractItemView { + color: white; + background-color: rgb(60, 60, 60); + selection-background-color: rgb(75, 75, 75); +} +QCheckBox { + border: none; +} +QCheckBox::indicator { + width: 12px; + height: 12px; +} +QCheckBox::indicator::unchecked { + border: 1px solid #5A5A5A; + background: transparent; +} +QCheckBox::indicator:unchecked:hover { + border: 1px solid #DDDDDD; +} +QCheckBox::indicator::checked { + border: 1px solid #AAAAAA; + background: #666666; +} +QCheckBox::indicator:checked:hover { + border: 1px solid #DDDDDD; + background: #555555; +} +QGroupBox, QScrollArea { + border: 0px; +} +InfoWidget { + border-width: 1px; + border-style: solid; + border-color: #BBBBBB; + margin: 2px 1px 2px 1px; + padding: 7.5px; +} +InfoWidget QLabel#Name { + font-size: 17px; +} +InfoWidget QLabel#Bytes { + font-size: 13px; + font-family: "Lucida Console"; +} +InfoWidget QLabel#MessageLeft, QLabel#MessageCenter, QLabel#MessageRight { + font-size: 11.5px; + margin-top: -2px; +} +InfoWidget QProgressBar { + border: 2px solid #BBBBBB; + border-radius: 5px; + background: white; + height: 15px; +} +InfoWidget QProgressBar::chunk { + background: qlineargradient( + x1: 0, y1: 0.5, x2: 1, y2: 0.5, + stop: 0 #444444, + stop: 1 #600000 + ); +} +QScrollBar { + border: 1px solid #000000; + background: #282828; + width: 15px; + margin: 16px 0px 16px 0px; +} +QScrollBar::handle { + background: #B0B0B0; + border: 1px solid #000000; + border-width: 1px 0px 1px 0px; + min-height: 20px; +} +QScrollBar::add-line, QScrollBar::sub-line { + background:#B0B0B0; + border: 1px solid #5A5A5A; + subcontrol-origin: margin; +} +QScrollBar::add-line { + top: 15px; + height: 15px; +} +QScrollBar::sub-line { + height: 15px; + subcontrol-position: top; +} +QScrollBar::up-arrow, QScrollBar::down-arrow { + border: 1px solid #5A5A5A; + width: 3px; + height: 3px; + background-color: #353535; +} +QScrollBar::add-page, QScrollBar::sub-page { + background: none; +} +)style"; int main(int argc, char** argv) { QApplication app(argc, argv); + app.setStyleSheet(style); MainWindow window; - - auto setStyle = [](const ghoul::filesystem::File& f) { - QFile file(QString::fromStdString(f.path())); - file.open(QIODevice::ReadOnly); - QTextStream in(&file); - QString style = in.readAll(); - qApp->setStyleSheet(style); - }; - - ghoul::filesystem::File f("stylesheet.css", false, setStyle); - - setStyle(f); - window.show(); return app.exec(); diff --git a/apps/Launcher/syncwidget.cpp b/apps/Launcher/syncwidget.cpp index 12d200ad74..1477efca09 100644 --- a/apps/Launcher/syncwidget.cpp +++ b/apps/Launcher/syncwidget.cpp @@ -74,7 +74,7 @@ namespace { const std::string VersionKey = "Version"; const bool OverwriteFiles = false; - const bool CleanInfoWidgets = false; + const bool CleanInfoWidgets = true; } SyncWidget::SyncWidget(QWidget* parent, Qt::WindowFlags f)