void SimplePartWidget::slotMarkupPlainText() { // NOTICE "single shot", we get a recursion otherwise! disconnect(this, &QWebView::loadFinished, this, &SimplePartWidget::slotMarkupPlainText); // If there's no data, don't try to "fix it up" if (!m_partIndex.isValid() || !m_partIndex.data(Imap::Mailbox::RoleIsFetched).toBool()) return; QPalette palette = QApplication::palette(); // and finally set the marked up page. page()->mainFrame()->setHtml(UiUtils::htmlizedTextPart(m_partIndex, QFontDatabase::systemFont(QFontDatabase::FixedFont), palette.base().color(), palette.text().color(), palette.link().color(), palette.linkVisited().color())); }
QVariantMap Bridge::get_palette() { QVariantMap colors; QPalette palette = qApp->palette(); colors.insert("window", palette.window().color().name()); colors.insert("window_text", palette.windowText().color().name()); colors.insert("base", palette.base().color().name()); colors.insert("alternate_base", palette.alternateBase().color().name()); colors.insert("text", palette.text().color().name()); colors.insert("button", palette.buttonText().color().name()); colors.insert("bright_text", palette.brightText().color().name()); colors.insert("light", palette.light().color().name()); colors.insert("midlight", palette.midlight().color().name()); colors.insert("dark", palette.dark().color().name()); colors.insert("mid", palette.mid().color().name()); colors.insert("shadow", palette.shadow().color().name()); colors.insert("highlight", palette.highlight().color().name()); colors.insert("highlight_text", palette.highlightedText().color().name()); colors.insert("link", palette.link().color().name()); colors.insert("link_visited", palette.linkVisited().color().name()); return colors; }
void KTThemeSelector::setupChooseColor() { DVHBox *hbox = new DVHBox(this, Qt::Horizontal); DVHBox *box1 = new DVHBox(hbox, Qt::Vertical); box1->boxLayout()->setMargin(10); m_general = new QGroupBox(tr("General"), box1); QGridLayout *layout1 = new QGridLayout(m_general); QStringList labels1 = QStringList() << tr("Text") << tr("Base") << tr("Foreground") << tr("Background") << tr("Button") << tr("Button Text"); QStringList names = QStringList() << "Text" << "Base" << "Foreground" << "Background" << "Button" << "ButtonText"; QPalette colorGroup = QApplication::palette(); QList<QColor> colors = QList<QColor>() << colorGroup.text ().color() << colorGroup.base().color() << colorGroup.foreground().color() << colorGroup.background().color() << colorGroup.button().color() << colorGroup.buttonText().color(); for(int i = 0; i < labels1.count(); i++) { layout1->addWidget(new QLabel(labels1[i], m_general), i, 0 ); DColorButton *button = new DColorButton(m_general); button->setObjectName(names[i]); QPalette pal = button->palette(); pal.setColor(QPalette::Button, colors[i]); button->setPalette(pal); m_generalButtonGroup.addButton(button); layout1->addWidget(button, i, 1); m_generalSection.insert(names[i], colors[i].name()); } m_effects = new QGroupBox(tr("Effects"), box1); QGridLayout *layout2 = new QGridLayout(m_effects); QStringList labels2 = QStringList() << tr("Light") << tr("Midlight") << tr("Dark") << tr("Mid"); QStringList names2 = QStringList() << "Light" << "Midlight" << "Dark" << "Mid"; colors.clear(); colors << colorGroup.light().color() << colorGroup.midlight().color() << colorGroup.dark().color() << colorGroup.mid().color(); for(int i = 0; i < labels2.count(); i++) { layout2->addWidget(new QLabel(labels2[i], m_effects), i, 0 ); DColorButton *button = new DColorButton(m_effects); button->setObjectName(names2[i]); QPalette pal = button->palette(); pal.setColor(QPalette::Button, colors[i]); button->setPalette(pal); m_effectsButtonGroup.addButton(button); layout2->addWidget(button, i, 1); m_effectsSection.insert(names2[i], colors[i].name()); } //////////// DVHBox *box2 = new DVHBox(hbox, Qt::Vertical); box2->boxLayout()->setMargin(10); m_selections = new QGroupBox(tr("Selections"), box2); QGridLayout *layout3 = new QGridLayout(m_selections); QStringList labels3 = QStringList() << tr("Highlight") << tr("Highlighted Text"); QStringList names3 = QStringList() << "Highlight" << "HighlightedText"; colors.clear(); colors << colorGroup.highlight().color() << colorGroup.highlightedText().color(); for(int i = 0; i < labels3.count(); i++) { layout3->addWidget(new QLabel(labels3[i], m_selections), i, 0 ); DColorButton *button = new DColorButton(m_selections); button->setObjectName(names3[i]); QPalette pal = button->palette(); pal.setColor(QPalette::Button, colors[i]); button->setPalette(pal); m_selectionsButtonGroup.addButton(button); layout3->addWidget(button, i, 1); m_selectionsSection.insert(names3[i], colors[i].name()); } m_textEffects = new QGroupBox(tr("Text effects"), box2); QGridLayout *layout4 = new QGridLayout(m_textEffects); QStringList labels4 = QStringList() << tr("Bright Text") << tr("Link") << tr("Link Visited"); QStringList names4 = QStringList() << "BrightText" << "Link" << "LinkVisited"; colors.clear(); colors << colorGroup.brightText().color() << colorGroup.link().color() << colorGroup.linkVisited().color(); for(int i = 0; i < labels4.count(); i++) { layout4->addWidget(new QLabel(labels4[i], m_textEffects), i, 0 ); DColorButton *button = new DColorButton(m_textEffects); button->setObjectName(names4[i]); QPalette pal = button->palette(); pal.setColor(QPalette::Button, colors[i]); button->setPalette(pal); m_textEffectsButtonGroup.addButton(button); layout4->addWidget(button, i, 1); m_textEffectsSection.insert(names4[i], colors[i].name()); } QGroupBox *schemeWidget = new QGroupBox(tr("Schema"), box2); // FIXME: add vertical layout QVBoxLayout *schemaLayout = new QVBoxLayout; m_allSchemes = new QTreeWidget; m_allSchemes->setHeaderLabels ( QStringList() << tr("Schema") << tr( "Owner" ) << tr( "Date" ) ); m_allSchemes->header()->setResizeMode(QHeaderView::Stretch); schemaLayout->addWidget(m_allSchemes); connect(m_allSchemes, SIGNAL(itemDoubleClicked (QTreeWidgetItem *, int )), this, SLOT(loadSchemaFromListView( QTreeWidgetItem *, int ))); QPushButton *saveSchemeButton = new QPushButton(tr("Save schema")); connect(saveSchemeButton, SIGNAL(clicked()), SLOT(saveSchema())); schemaLayout->addWidget(saveSchemeButton); schemeWidget->setLayout(schemaLayout); new DSeparator(this); new QLabel(tr("Style"), this); DStyleComboBox *styleComboBox = new DStyleComboBox(this); Q_UNUSED(styleComboBox); new DSeparator(this); m_useColors = new QCheckBox(tr("Use this colors"), this); connect(&m_generalButtonGroup, SIGNAL(buttonClicked(QAbstractButton * )), SLOT(chooseGeneralColor(QAbstractButton * ))); connect(&m_effectsButtonGroup, SIGNAL(buttonClicked(QAbstractButton * )), SLOT(chooseEffectsColor(QAbstractButton * ))); connect(&m_selectionsButtonGroup, SIGNAL(buttonClicked(QAbstractButton * )), SLOT(chooseSelectionsColor(QAbstractButton * ))); connect(&m_textEffectsButtonGroup, SIGNAL(buttonClicked(QAbstractButton * )), SLOT(chooseTextEffectsColor(QAbstractButton * ))); }