/************************************************************************ Copyright (c) 2005-2012 by Juphoon System Software Co., Ltd. All rights reserved. This software is confidential and proprietary to Juphoon System Software Co., Ltd.. No part of this software may be reproduced, stored, transmitted, disclosed or used in any form or by any means other than as expressly provided by the written license agreement between JusTel and its licensee. THIS SOFTWARE IS PROVIDED BY JusTel "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JusTel BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Juphoon System Software Co., Ltd. ************************************************************************/ /************************************************* File name : rstylemanager.cpp Module : UI Manager Author : vic.ren Created on : 2012-07-26 Description : The style manager Modify History: 1. Date: Author: Modification: 2012-07-27 Vic Ren Upgrade *************************************************/ /* include header files */ #include "JusCallPch.h" #include RStyle *RStyle::m_psRStyle = ZNULL; RStyle::RStyle(QObject *parent) : QObject(parent) { } RStyle *RStyle::Instance() { if (!m_psRStyle) m_psRStyle = new RStyle; return m_psRStyle; } QColor RStyle::backgroundColor() { return QColor(245, 245, 245); } QColor RStyle::mainColor() { return QColor(0, 123, 187); } QColor RStyle::secondaryColor() { return QColor(80, 80, 80); } QColor RStyle::thirdColor() { return QColor(100, 100, 100); } QColor RStyle::fourthColor() { return QColor(150, 150, 150); } QColor RStyle::fontColor() { return secondaryColor(); } QColor RStyle::fontColorInactive() { return QColor(137, 137, 137); } QColor RStyle::fontColorDisabled() { return QColor(216, 216, 216); } QColor RStyle::fontColorHeightLight() { return Qt::white; } QColor RStyle::boderColor() { return secondaryColor(); } QColor RStyle::boderColorDisabled() { return QColor(216, 216, 216); } QColor RStyle::hoverBgColor() { QColor colorRet = mainColor(); int Hue = colorRet.hue(); colorRet.setHsv(Hue, 77, 251); return colorRet; } QColor RStyle::pressedBgColor() { QColor colorRet = mainColor(); int Hue = colorRet.hue(); colorRet.setHsv(Hue, 255, 123); return colorRet; } QColor RStyle::selectedBgColor() { QColor colorRet = thirdColor(); int Hue = colorRet.hue(); colorRet.setHsv(Hue, 0, 204); return colorRet; } QColor RStyle::disabledColor() { return QColor(180, 180, 180); } QColor RStyle::missedColor() { return mainColor(); } QString RStyle::menuStyle() { return "QMenu{background:" + backgroundColor().name() + "; color:" + fontColor().name() + "; min-height: 30px; min-width: 110px; padding-top: 0px;" "padding-right: 1px; padding-bottom: 0px; border:1px solid " + boderColor().name() + ";}" "QMenu::item {padding-left: 10px; padding-right: 10px; height: 30px; min-width: 108px}" "QMenu::item:selected {color:" + fontColor().name()+ "; background: " + hoverBgColor().name() + ";}" "QMenu::item:pressed {color:white; background: " + pressedBgColor().name() + ";}" "QMenu::item:disabled{color:gray;}" "QMenu::separator{height:1px; background-color:" + boderColor().name() + "; margin-left: 0px;}"; } QString RStyle::editStyle(bool bHasBoder) { QString qsStyle; if (bHasBoder) { qsStyle = "RMetroEdt {color: " + fontColor().name() + "; border-radius:0px; border:1px solid " + boderColor().name() + "; background:transparent; padding-left: 10px}" + "RMetroEdt:focus {border:1px solid " + mainColor().name() + "}"; } else { qsStyle = "RMetroEdt{color: " + fontColor().name() + "; border-radius:0px; border:0px; background:transparent;" "padding-left: 0px}"; } qsStyle += "RMetroEdt:disabled {color: " + fontColorDisabled().name() + ";border:1px solid " + boderColorDisabled().name() + "; background:transparent;}" + "RMetroEdt:read-only {color: " + fontColor().name() + "; border-radius:0px; border:0px;" + "background:transparent;}"; return qsStyle; } QString RStyle::textEditStyle() { return "QTextEdit {border-radius:0px; border:1px solid " + boderColor().name() + "; color: " + fontColor().name() + "; background-color: " + backgroundColor().name() + ";}" "QTextEdit:disabled {border:0px;}" + menuStyle() + scrollBarStyle(); } QString RStyle::comboBoxStyle() { return "QComboBox {color: " + fontColor().name() + "; border: 1px solid " + boderColor().name() + "; padding-left: 10px;" "background:transparent; padding-right: 0px;}" "QComboBox:disabled {color: " + fontColorDisabled().name() + ";border:1px solid " + boderColorDisabled().name() + ";}" "QComboBox:focus {border:1px solid " + fontColor().name() + "}" "QComboBox::drop-down {border:none; width:30px; height:30px;" "background:transparent;}" "QComboBox::down-arrow {border:none; background:transparent;" "image:url(:/images/ic_combobox_dropdown.png);}" "QComboBox::down-arrow:disabled {border:none; background:transparent;" "image:url();}" "QComboBox QAbstractItemView {border: 1px solid " + boderColor().name() + ";selection-background-color: rgb(4, 78, 128); color: white;" "background:black;}"; } QString RStyle::contactComboBoxStyle() { return "QComboBox {color: " + fontColor().name() + "; border: 1px solid " + boderColor().name() + "; padding-left: 10px;" "background:transparent; padding-right: 0px; }" "QComboBox:focus {border:1px solid " + fontColor().name() + "}" "QComboBox::drop-down {border:none; width: 25px; height: 25px;" "background:transparent;}" "QComboBox::down-arrow {border:none; background:transparent;" "image:url(:/images/ic_combobox_dropdown_small.png);}" "QComboBox::down-arrow:disabled {border:none; background:transparent;" "image:url();}" "QComboBox QAbstractItemView {border: 1px solid " + boderColor().name() + ";selection-background-color: rgb(4, 78, 128); color: white;" "background:black;}"; } QString RStyle::sessLogComboBoxStyle() { return "QComboBox {color: " + fontColor().name() + "; padding-left: 20px;" "background:transparent; padding-right: 0px;}" "QComboBox:focus {border:1px solid " + fontColor().name() + "}" "QComboBox::drop-down {border:none; width:30px; height:30px;" "background:transparent;}" "QComboBox::down-arrow {border:none; background:transparent;" "image:url(:/images/ic_combobox_switch.png); padding-right: 250px;" "padding-bottom: 5px}" "QComboBox::down-arrow:disabled {border:none; background:transparent;" "image:url();}" "QComboBox QAbstractItemView {border: 1px solid " + boderColor().name() + ";selection-background-color: rgb(4, 78, 128); color: white;" "background:black;}"; } QString RStyle::scrollBarStyle() { return "QScrollBar {border:none;background: transparent; width: 14px; " "margin: 0px; padding-right: 0px; padding-left: 7px}" "QScrollBar::handle:vertical {background:rgb(222, 222, 222);" "min-height:20px; width:7px; margin:0px;}" "QScrollBar::handle:vertical:hover {background:" + RStyle::fontColorInactive().name() + ";}" "QScrollBar::handle:vertical:pressed {background: rgb(80, 80, 80);}" "QScrollBar::sub-line:vertical {width: 0px; height: 0px; background: transparent;}" "QScrollBar::add-line:vertical {width: 0px; height: 0px; background: transparent;}" "QScrollBar::add-page:vertical {width: 0px; height: 0px; background: transparent;}" "QScrollBar::sub-page:vertical {width: 0px; height: 0px; background: transparent;}"; } QString RStyle::scrollAreaStyle() { return "QScrollArea{border:none; background:" + backgroundColor().name() +";}" + scrollBarStyle(); } QString RStyle::listViewStyle() { return "QAbstractItemView {border:none; background:transparent;}" "QAbstractItemView::branch {image:none;}" + scrollBarStyle() + menuStyle(); } QString RStyle::treeViewStyle() { return "QAbstractItemView {border:none; background:" + backgroundColor().name() + ";}" + scrollBarStyle() + menuStyle(); } QString RStyle::volumeMicBtnStyle() { return "QCheckBox::indicator:unchecked{border:none; background:transparent;" "image:url(:/images/ic_btn_mic.png);}" "QCheckBox::indicator:checked{border:none; background:transparent;" "image:url(:/images/ic_btn_mic.png);}"; } QString RStyle::volumeSpkBtnStyle() { return "QCheckBox::indicator:unchecked{border:none; background:transparent;" "image:url(:/images/ic_btn_spk.png);}" "QCheckBox::indicator:checked{border:none; background:transparent;" "image:url(:/images/ic_btn_spk.png);}"; } QString RStyle::sliderStyle() { return "QSlider:horizontal {min-width: 10px;}" "QSlider::groove:horizontal {border: 0px; height: 3px}" "QSlider::handle:horizontal {background: rgb(80, 80, 80); width:3px; height: 10px;" "margin: -2px 0px;}" "QSlider::sub-page:horizontal {border: 0px; background: rgb(80, 80, 80);" "margin:0px 0px 0px 0px;}" "QSlider::add-page:horizontal {border: 0px; background: rgb(80, 80, 80);" "margin:0px 0px 0px 0px;}" "QSlider:horizontal:disabled {min-width: 10px;}" "QSlider::groove:horizontal:disabled {border: 0px; height: 3px}" "QSlider::handle:horizontal:disabled {background: rgb(77, 77, 77); width:3px; height: 10px;" "margin: -2px 0px;}" "QSlider::sub-page:horizontal:disabled {border: 0px; background: rgb(77, 77, 77);" "margin:0px 0px 0px 0px;}" "QSlider::add-page:horizontal:disabled {border: 0px; background: rgb(77, 77, 77);" "margin:0px 0px 0px 0px;}"; } QString RStyle::sliderVerticalStyle(QColor color) { return "QSlider::groove:vertical {background: red; position: absolute;" "left: 4px; right: 4px; width: 15px}" "QSlider::handle:vertical {height: 10px; background: white; " "margin: 0 -4px;}" "QSlider::add-page:vertical {background: " + color.name() + ";}" "QSlider::sub-page:vertical {background: " + fontColorDisabled().name() + ";}"; } QFont RStyle::fontSize(int nFontSize) { QFont font = QApplication::font(); font.setPixelSize(nFontSize); font.setBold(false); return font; } QString RStyle::appStyle() { return "QCheckBox {color: " + fontColor().name() + "}" "QCheckBox:disabled {color: " + disabledColor().name() + ";}" "QCheckBox::indicator:unchecked{border:none; background:transparent;" "image:url(:/images/ic_checkbox_n.png);}" "QCheckBox::indicator:checked{border:none; background:transparent;" "image:url(:/images/ic_checkbox_s.png);}" "QCheckBox::indicator:unchecked:disabled {border:none;" "background:transparent;image:url(:/images/ic_checkbox_dn.png);}" "QCheckBox::indicator:checked:disabled {border:none;" "background:transparent;image:url(:/images/ic_checkbox_ds.png);}" "QRadioButton {color: " + fontColor().name() + "}" "QRadioButton::indicator:unchecked{border:none; background:transparent;" "image:url(:/images/ic_radio_n.png);}" "QRadioButton::indicator:checked{border:none; background:transparent;" "image:url(:/images/ic_radio_s.png);}" "QLabel {color: " + fontColor().name() + "}" "QLabel:disabled {color: " + fontColorDisabled().name() + "}" + menuStyle() + scrollBarStyle(); }